Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
31 : : #include <com/sun/star/container/XIndexReplace.hpp>
32 : : #include <com/sun/star/frame/XModel.hpp>
33 : : #include <com/sun/star/text/ChapterFormat.hpp>
34 : : #include <com/sun/star/text/ReferenceFieldPart.hpp>
35 : : #include <com/sun/star/text/BibliographyDataField.hpp>
36 : : #include <com/sun/star/text/XTextDocument.hpp>
37 : :
38 : : #include <osl/mutex.hxx>
39 : : #include <vcl/svapp.hxx>
40 : : #include <editeng/unolingu.hxx>
41 : : #include <hints.hxx>
42 : : #include <cmdid.h>
43 : : #include <swtypes.hxx>
44 : : #include <shellres.hxx>
45 : : #include <viewsh.hxx>
46 : : #include <doc.hxx>
47 : : #include <docary.hxx>
48 : : #include <poolfmt.hxx>
49 : : #include <poolfmt.hrc>
50 : : #include <pagedesc.hxx>
51 : : #include <fmtcntnt.hxx>
52 : : #include <unomap.hxx>
53 : : #include <unotextrange.hxx>
54 : : #include <unotextcursor.hxx>
55 : : #include <unosection.hxx>
56 : : #include <doctxm.hxx>
57 : : #include <txttxmrk.hxx>
58 : : #include <unocrsr.hxx>
59 : : #include <unostyle.hxx>
60 : : #include <ndtxt.hxx>
61 : : #include <unoidx.hxx>
62 : : #include <docsh.hxx>
63 : : #include <chpfld.hxx>
64 : : #include <SwStyleNameMapper.hxx>
65 : : #include <unoevtlstnr.hxx>
66 : : #include <comphelper/servicehelper.hxx>
67 : : #include <comphelper/string.hxx>
68 : :
69 : :
70 : : using namespace ::com::sun::star;
71 : : using ::rtl::OUString;
72 : :
73 : : static OUString
74 : 1474 : lcl_AnyToString(uno::Any const& rVal) throw (lang::IllegalArgumentException)
75 : : {
76 : 1474 : OUString sRet;
77 [ - + ]: 1474 : if(!(rVal >>= sRet))
78 : : {
79 [ # # ]: 0 : throw lang::IllegalArgumentException();
80 : : }
81 : 1474 : return sRet;
82 : : }
83 : :
84 : : static sal_Int16
85 : 12 : lcl_AnyToInt16(uno::Any const& rVal) throw (lang::IllegalArgumentException)
86 : : {
87 : 12 : sal_Int16 nRet = 0;
88 [ - + ]: 12 : if(!(rVal >>= nRet))
89 : : {
90 [ # # ]: 0 : throw lang::IllegalArgumentException();
91 : : }
92 : 12 : return nRet;
93 : : }
94 : :
95 : : static sal_Bool
96 : 404 : lcl_AnyToBool(uno::Any const& rVal) throw (lang::IllegalArgumentException)
97 : : {
98 : 404 : sal_Bool bRet = sal_False;
99 [ - + ]: 404 : if(!(rVal >>= bRet))
100 : : {
101 [ # # ]: 0 : throw lang::IllegalArgumentException();
102 : : }
103 : 404 : return bRet;
104 : : }
105 : :
106 : : static void
107 : 98 : lcl_AnyToBitMask(uno::Any const& rValue,
108 : : sal_uInt16 & rBitMask, const sal_uInt16 nBit)
109 : : throw (lang::IllegalArgumentException)
110 : : {
111 : 98 : rBitMask = lcl_AnyToBool(rValue)
112 : : ? (rBitMask | nBit)
113 [ + + ]: 98 : : (rBitMask & ~nBit);
114 : 98 : }
115 : :
116 : : static void
117 : 70 : lcl_BitMaskToAny(uno::Any & o_rValue,
118 : : const sal_uInt16 nBitMask, const sal_uInt16 nBit)
119 : : {
120 : 70 : const sal_Bool bRet = 0 != (nBitMask & nBit);
121 [ + - ]: 70 : o_rValue <<= bRet;
122 : 70 : }
123 : :
124 : : static void
125 : 0 : lcl_ReAssignTOXType(SwDoc* pDoc, SwTOXBase& rTOXBase, const OUString& rNewName)
126 : : {
127 : 0 : const sal_uInt16 nUserCount = pDoc->GetTOXTypeCount( TOX_USER );
128 : 0 : const SwTOXType* pNewType = 0;
129 [ # # ]: 0 : for(sal_uInt16 nUser = 0; nUser < nUserCount; nUser++)
130 : : {
131 : 0 : const SwTOXType* pType = pDoc->GetTOXType( TOX_USER, nUser );
132 [ # # ][ # # ]: 0 : if(pType->GetTypeName().Equals((String)rNewName))
133 : : {
134 : 0 : pNewType = pType;
135 : 0 : break;
136 : : }
137 : : }
138 [ # # ]: 0 : if(!pNewType)
139 : : {
140 [ # # ][ # # ]: 0 : SwTOXType aNewType(TOX_USER, rNewName);
[ # # ]
141 [ # # ][ # # ]: 0 : pNewType = pDoc->InsertTOXType( aNewType );
142 : : }
143 : :
144 : 0 : rTOXBase.RegisterToTOXType( *((SwTOXType*)pNewType) );
145 : 0 : }
146 : :
147 : : static const char cUserDefined[] = "User-Defined";
148 : : static const char cUserSuffix[] = " (user)";
149 : : #define USER_LEN 12
150 : : #define USER_AND_SUFFIXLEN 19
151 : :
152 : 2 : void lcl_ConvertTOUNameToProgrammaticName(OUString& rTmp)
153 : : {
154 : 2 : ShellResource* pShellRes = ViewShell::GetShellRes();
155 : :
156 [ + - ]: 2 : if(rTmp.equals(pShellRes->aTOXUserName))
157 : : {
158 : 2 : rTmp = OUString(C2U(cUserDefined));
159 : : }
160 : : // if the version is not English but the alternative index's name is
161 : : // "User-Defined" a " (user)" is appended
162 [ # # ]: 0 : else if(rTmp.equalsAscii(cUserDefined))
163 : : {
164 : 0 : rTmp += C2U(cUserSuffix);
165 : : }
166 : 2 : }
167 : :
168 : : static void
169 : 4 : lcl_ConvertTOUNameToUserName(OUString& rTmp)
170 : : {
171 : 4 : ShellResource* pShellRes = ViewShell::GetShellRes();
172 [ + - ]: 4 : if(rTmp.equalsAscii(cUserDefined))
173 : : {
174 : 4 : rTmp = pShellRes->aTOXUserName;
175 : : }
176 [ # # # # ]: 0 : else if(!pShellRes->aTOXUserName.EqualsAscii(cUserDefined) &&
[ # # ]
177 : 0 : USER_AND_SUFFIXLEN == rTmp.getLength())
178 : : {
179 : : //make sure that in non-English versions the " (user)" suffix is removed
180 [ # # # # ]: 0 : if (rTmp.matchAsciiL(cUserDefined, sizeof(cUserDefined)) &&
[ # # ]
181 : 0 : rTmp.matchAsciiL(cUserSuffix, sizeof(cUserSuffix), USER_LEN))
182 : : {
183 : 0 : rTmp = C2U(cUserDefined);
184 : : }
185 : : }
186 : 4 : }
187 : :
188 : : typedef ::cppu::WeakImplHelper2
189 : : < lang::XServiceInfo
190 : : , container::XIndexReplace
191 : : > SwXDocumentIndexStyleAccess_Base;
192 : :
193 : : class SwXDocumentIndex::StyleAccess_Impl
194 : : : public SwXDocumentIndexStyleAccess_Base
195 : : {
196 : :
197 : : private:
198 : : /// can be destroyed threadsafely, so no UnoImplPtr here
199 : : ::rtl::Reference<SwXDocumentIndex> m_xParent;
200 : :
201 : : virtual ~StyleAccess_Impl();
202 : :
203 : : public:
204 : : StyleAccess_Impl(SwXDocumentIndex& rParentIdx);
205 : :
206 : : // XServiceInfo
207 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
208 : : throw (uno::RuntimeException);
209 : : virtual sal_Bool SAL_CALL
210 : : supportsService(const ::rtl::OUString& rServiceName)
211 : : throw (uno::RuntimeException);
212 : : virtual uno::Sequence< ::rtl::OUString > SAL_CALL
213 : : getSupportedServiceNames() throw (uno::RuntimeException);
214 : :
215 : : // XElementAccess
216 : : virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
217 : : virtual sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
218 : :
219 : : // XIndexAccess
220 : : virtual sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
221 : : virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
222 : : throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
223 : : uno::RuntimeException);
224 : :
225 : : // XIndexReplace
226 : : virtual void SAL_CALL
227 : : replaceByIndex(sal_Int32 Index, const uno::Any& rElement)
228 : : throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
229 : : lang::WrappedTargetException, uno::RuntimeException);
230 : :
231 : : };
232 : :
233 : : typedef ::cppu::WeakImplHelper2
234 : : < lang::XServiceInfo
235 : : , container::XIndexReplace
236 : : > SwXDocumentIndexTokenAccess_Base;
237 : :
238 : : class SwXDocumentIndex::TokenAccess_Impl
239 : : : public SwXDocumentIndexTokenAccess_Base
240 : : {
241 : :
242 : : private:
243 : : /// can be destroyed threadsafely, so no UnoImplPtr here
244 : : ::rtl::Reference<SwXDocumentIndex> m_xParent;
245 : :
246 : : virtual ~TokenAccess_Impl();
247 : :
248 : : public:
249 : :
250 : : TokenAccess_Impl(SwXDocumentIndex& rParentIdx);
251 : :
252 : : // XServiceInfo
253 : : virtual ::rtl::OUString SAL_CALL getImplementationName()
254 : : throw (uno::RuntimeException);
255 : : virtual sal_Bool SAL_CALL
256 : : supportsService(const ::rtl::OUString& rServiceName)
257 : : throw (uno::RuntimeException);
258 : : virtual uno::Sequence< ::rtl::OUString > SAL_CALL
259 : : getSupportedServiceNames() throw (uno::RuntimeException);
260 : :
261 : : // XElementAccess
262 : : virtual uno::Type SAL_CALL getElementType() throw (uno::RuntimeException);
263 : : virtual sal_Bool SAL_CALL hasElements() throw (uno::RuntimeException);
264 : :
265 : : // XIndexAccess
266 : : virtual sal_Int32 SAL_CALL getCount() throw (uno::RuntimeException);
267 : : virtual uno::Any SAL_CALL getByIndex(sal_Int32 nIndex)
268 : : throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
269 : : uno::RuntimeException);
270 : :
271 : : // XIndexReplace
272 : : virtual void SAL_CALL
273 : : replaceByIndex(sal_Int32 Index, const uno::Any& rElement)
274 : : throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
275 : : lang::WrappedTargetException, uno::RuntimeException);
276 : :
277 : : };
278 : :
279 : : /******************************************************************
280 : : * SwXDocumentIndex
281 : : ******************************************************************/
282 : 38 : class SwDocIndexDescriptorProperties_Impl
283 : : {
284 : : private:
285 : : ::std::auto_ptr<SwTOXBase> m_pTOXBase;
286 : : OUString m_sUserTOXTypeName;
287 : :
288 : : public:
289 : : SwDocIndexDescriptorProperties_Impl(SwTOXType const*const pType);
290 : :
291 : 76 : SwTOXBase & GetTOXBase() { return *m_pTOXBase; }
292 : 4 : const OUString& GetTypeName() const { return m_sUserTOXTypeName; }
293 : 0 : void SetTypeName(const OUString& rSet) { m_sUserTOXTypeName = rSet; }
294 : : };
295 : :
296 : 38 : SwDocIndexDescriptorProperties_Impl::SwDocIndexDescriptorProperties_Impl(
297 : 38 : SwTOXType const*const pType)
298 : : {
299 [ + - ]: 38 : SwForm aForm(pType->GetType());
300 : : m_pTOXBase.reset(new SwTOXBase(pType, aForm,
301 [ + - ][ + - ]: 38 : nsSwTOXElement::TOX_MARK, pType->GetTypeName()));
302 [ + + ][ + + ]: 38 : if(pType->GetType() == TOX_CONTENT || pType->GetType() == TOX_USER)
[ + + ]
303 : : {
304 : 10 : m_pTOXBase->SetLevel(MAXLEVEL);
305 : : }
306 [ + - ][ + - ]: 38 : m_sUserTOXTypeName = pType->GetTypeName();
307 : 38 : }
308 : :
309 : : static sal_uInt16
310 : 66 : lcl_TypeToPropertyMap_Index(const TOXTypes eType)
311 : : {
312 [ + + + + : 66 : switch (eType)
+ + + ]
313 : : {
314 : 16 : case TOX_INDEX: return PROPERTY_MAP_INDEX_IDX;
315 : 10 : case TOX_CONTENT: return PROPERTY_MAP_INDEX_CNTNT;
316 : 8 : case TOX_TABLES: return PROPERTY_MAP_INDEX_TABLES;
317 : 8 : case TOX_ILLUSTRATIONS: return PROPERTY_MAP_INDEX_ILLUSTRATIONS;
318 : 8 : case TOX_OBJECTS: return PROPERTY_MAP_INDEX_OBJECTS;
319 : 8 : case TOX_AUTHORITIES: return PROPERTY_MAP_BIBLIOGRAPHY;
320 : : //case TOX_USER:
321 : : default:
322 : 66 : return PROPERTY_MAP_INDEX_USER;
323 : : }
324 : : }
325 : :
326 [ + - ][ + - ]: 132 : class SwXDocumentIndex::Impl
[ + - ][ + - ]
[ - + ]
327 : : : public SwClient
328 : : {
329 : :
330 : : public:
331 : :
332 : : SfxItemPropertySet const& m_rPropSet;
333 : : const TOXTypes m_eTOXType;
334 : : SwEventListenerContainer m_ListenerContainer;
335 : : bool m_bIsDescriptor;
336 : : SwDoc * m_pDoc;
337 : : ::std::auto_ptr<SwDocIndexDescriptorProperties_Impl> m_pProps;
338 : : uno::WeakReference<container::XIndexReplace> m_wStyleAccess;
339 : : uno::WeakReference<container::XIndexReplace> m_wTokenAccess;
340 : :
341 : 66 : Impl( SwXDocumentIndex & rThis,
342 : : SwDoc & rDoc,
343 : : const TOXTypes eType,
344 : : SwTOXBaseSection const*const pBaseSection)
345 : 28 : : SwClient((pBaseSection) ? pBaseSection->GetFmt() : 0)
346 : : , m_rPropSet(
347 [ + - ]: 66 : *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Index(eType)))
348 : : , m_eTOXType(eType)
349 : : , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
350 : : // #i111177# unxsols4 (Sun C++ 5.9 SunOS_sparc) may generate wrong code
351 : : , m_bIsDescriptor((0 == pBaseSection) ? true : false)
352 : : , m_pDoc(&rDoc)
353 : : , m_pProps((m_bIsDescriptor)
354 [ + - ]: 38 : ? new SwDocIndexDescriptorProperties_Impl(rDoc.GetTOXType(eType, 0))
355 [ + + ][ + - ]: 170 : : 0)
[ + + ][ + - ]
[ + - ][ + - ]
[ + - ]
356 : : {
357 : 66 : }
358 : :
359 : 1986 : SwSectionFmt * GetSectionFmt() const {
360 : : return static_cast<SwSectionFmt *>(
361 : 1986 : const_cast<SwModify *>(GetRegisteredIn()));
362 : : }
363 : :
364 : 820 : SwTOXBase & GetTOXSectionOrThrow() const
365 : : {
366 : 820 : SwSectionFmt *const pSectionFmt(GetSectionFmt());
367 : : SwTOXBase *const pTOXSection( (m_bIsDescriptor)
368 : 0 : ? &m_pProps->GetTOXBase()
369 : : : ((pSectionFmt)
370 [ + - ]: 820 : ? static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection())
371 [ + - ][ - + ]: 1640 : : 0));
372 [ - + ]: 820 : if (!pTOXSection)
373 : : {
374 : : throw uno::RuntimeException(OUString(RTL_CONSTASCII_USTRINGPARAM(
375 [ # # ][ # # ]: 0 : "SwXDocumentIndex: disposed or invalid")), 0);
[ # # ]
376 : : }
377 : 820 : return *pTOXSection;
378 : : }
379 : :
380 : 42 : sal_Int32 GetFormMax() const
381 : : {
382 : 42 : SwTOXBase & rSection( GetTOXSectionOrThrow() );
383 : : return (m_bIsDescriptor)
384 : 0 : ? SwForm::GetFormMaxLevel(m_eTOXType)
385 [ - + ]: 42 : : rSection.GetTOXForm().GetFormMax();
386 : : }
387 : : protected:
388 : : // SwClient
389 : : virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew);
390 : :
391 : : };
392 : :
393 : 154 : void SwXDocumentIndex::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
394 : : {
395 : 154 : ClientModify(this, pOld, pNew);
396 : :
397 [ + + ]: 154 : if (!GetRegisteredIn())
398 : : {
399 : 38 : m_ListenerContainer.Disposing();
400 : : }
401 : 154 : }
402 : :
403 : 28 : SwXDocumentIndex::SwXDocumentIndex(
404 : : SwTOXBaseSection const& rBaseSection, SwDoc & rDoc)
405 : : : m_pImpl( new SwXDocumentIndex::Impl( *this,
406 [ + - ][ + - ]: 28 : rDoc, rBaseSection.SwTOXBase::GetType(), & rBaseSection) )
[ + - ]
407 : : {
408 : 28 : }
409 : :
410 : 38 : SwXDocumentIndex::SwXDocumentIndex(const TOXTypes eType, SwDoc& rDoc)
411 [ + - ][ + - ]: 38 : : m_pImpl( new SwXDocumentIndex::Impl( *this, rDoc, eType, 0) )
412 : : {
413 : 38 : }
414 : :
415 [ + - ]: 66 : SwXDocumentIndex::~SwXDocumentIndex()
416 : : {
417 [ - + ]: 132 : }
418 : :
419 : : uno::Reference<text::XDocumentIndex>
420 : 92 : SwXDocumentIndex::CreateXDocumentIndex(
421 : : SwDoc & rDoc, SwTOXBaseSection const& rSection)
422 : : {
423 : : // re-use existing SwXDocumentIndex
424 : : // #i105557#: do not iterate over the registered clients: race condition
425 : 92 : SwSectionFmt *const pFmt = rSection.GetFmt();
426 : 92 : uno::Reference<text::XDocumentIndex> xIndex(pFmt->GetXObject(),
427 [ + - ]: 92 : uno::UNO_QUERY);
428 [ + + ]: 92 : if (!xIndex.is())
429 : : {
430 [ + - ]: 28 : SwXDocumentIndex *const pIndex(new SwXDocumentIndex(rSection, rDoc));
431 [ + - ][ + - ]: 28 : xIndex.set(pIndex);
432 [ + - ]: 28 : pFmt->SetXObject(uno::Reference<uno::XInterface>(xIndex));
433 : : }
434 : 92 : return xIndex;
435 : : }
436 : :
437 : : namespace
438 : : {
439 : : class theSwXDocumentIndexUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXDocumentIndexUnoTunnelId > {};
440 : : }
441 : :
442 : 216 : const uno::Sequence< sal_Int8 > & SwXDocumentIndex::getUnoTunnelId()
443 : : {
444 : 216 : return theSwXDocumentIndexUnoTunnelId::get().getSeq();
445 : : }
446 : :
447 : : sal_Int64 SAL_CALL
448 : 216 : SwXDocumentIndex::getSomething(const uno::Sequence< sal_Int8 >& rId)
449 : : throw (uno::RuntimeException)
450 : : {
451 : 216 : return ::sw::UnoTunnelImpl<SwXDocumentIndex>(rId, this);
452 : : }
453 : :
454 : : OUString SAL_CALL
455 : 0 : SwXDocumentIndex::getImplementationName() throw (uno::RuntimeException)
456 : : {
457 : 0 : return C2U("SwXDocumentIndex");
458 : : }
459 : :
460 : : sal_Bool SAL_CALL
461 : 4 : SwXDocumentIndex::supportsService(const OUString& rServiceName)
462 : : throw (uno::RuntimeException)
463 : : {
464 [ + - ]: 4 : SolarMutexGuard g;
465 : :
466 [ + - ][ + - ]: 8 : return C2U("com.sun.star.text.BaseIndex") == rServiceName
[ # # ]
467 : 4 : || ((TOX_INDEX == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.DocumentIndex")
468 : 0 : || ((TOX_CONTENT == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.ContentIndex")
469 : 0 : || ((TOX_USER == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.UserDefinedIndex")
470 : 0 : || ((TOX_ILLUSTRATIONS == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.IllustrationsIndex")
471 : 0 : || ((TOX_TABLES == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.TableIndex")
472 : 0 : || ((TOX_OBJECTS == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.ObjectIndex")
473 [ # # ][ # # ]: 12 : || ((TOX_AUTHORITIES == m_pImpl->m_eTOXType) && rServiceName == "com.sun.star.text.Bibliography");
[ + - ][ + +
+ - - + #
# # # # #
# # # # #
# # # # #
# # # # ]
474 : : }
475 : :
476 : : uno::Sequence< OUString > SAL_CALL
477 : 0 : SwXDocumentIndex::getSupportedServiceNames() throw (uno::RuntimeException)
478 : : {
479 [ # # ]: 0 : SolarMutexGuard g;
480 : :
481 [ # # ]: 0 : uno::Sequence< OUString > aRet(2);
482 [ # # ]: 0 : OUString* pArray = aRet.getArray();
483 [ # # ]: 0 : pArray[0] = C2U("com.sun.star.text.BaseIndex");
484 [ # # # # : 0 : switch (m_pImpl->m_eTOXType)
# # # ]
485 : : {
486 : : case TOX_INDEX:
487 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.DocumentIndex");
488 : 0 : break;
489 : : case TOX_CONTENT:
490 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.ContentIndex");
491 : 0 : break;
492 : : case TOX_TABLES:
493 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.TableIndex");
494 : 0 : break;
495 : : case TOX_ILLUSTRATIONS:
496 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.IllustrationsIndex");
497 : 0 : break;
498 : : case TOX_OBJECTS:
499 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.ObjectIndex");
500 : 0 : break;
501 : : case TOX_AUTHORITIES:
502 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.Bibliography");
503 : 0 : break;
504 : : //case TOX_USER:
505 : : default:
506 [ # # ]: 0 : pArray[1] = C2U("com.sun.star.text.UserDefinedIndex");
507 : : }
508 [ # # ]: 0 : return aRet;
509 : : }
510 : :
511 : 30 : OUString SAL_CALL SwXDocumentIndex::getServiceName()
512 : : throw (uno::RuntimeException)
513 : : {
514 [ + - ]: 30 : SolarMutexGuard g;
515 : :
516 : 30 : sal_uInt16 nObjectType = SW_SERVICE_TYPE_INDEX;
517 [ + + + + : 30 : switch (m_pImpl->m_eTOXType)
+ + + ]
518 : : {
519 : : // case TOX_INDEX: break;
520 : 4 : case TOX_USER: nObjectType = SW_SERVICE_USER_INDEX;
521 : 4 : break;
522 : 4 : case TOX_CONTENT: nObjectType = SW_SERVICE_CONTENT_INDEX;
523 : 4 : break;
524 : 4 : case TOX_ILLUSTRATIONS: nObjectType = SW_SERVICE_INDEX_ILLUSTRATIONS;
525 : 4 : break;
526 : 4 : case TOX_OBJECTS: nObjectType = SW_SERVICE_INDEX_OBJECTS;
527 : 4 : break;
528 : 4 : case TOX_TABLES: nObjectType = SW_SERVICE_INDEX_TABLES;
529 : 4 : break;
530 : 4 : case TOX_AUTHORITIES: nObjectType = SW_SERVICE_INDEX_BIBLIOGRAPHY;
531 : 4 : break;
532 : : default:
533 : 6 : break;
534 : : }
535 [ + - ][ + - ]: 30 : return SwXServiceProvider::GetProviderName(nObjectType);
536 : : }
537 : :
538 : 2 : void SAL_CALL SwXDocumentIndex::update() throw (uno::RuntimeException)
539 : : {
540 [ + - ]: 2 : SolarMutexGuard aGuard;
541 : :
542 : 2 : SwSectionFmt *const pFmt = m_pImpl->GetSectionFmt();
543 : : SwTOXBaseSection *const pTOXBase = (pFmt) ?
544 [ + - ][ + - ]: 2 : static_cast<SwTOXBaseSection*>(pFmt->GetSection()) : 0;
[ + - ]
545 [ - + ]: 2 : if(!pTOXBase)
546 : : {
547 [ # # ]: 0 : throw uno::RuntimeException();
548 : : }
549 [ + - ]: 2 : pTOXBase->Update();
550 : : // page numbers
551 [ + - ][ + - ]: 2 : pTOXBase->UpdatePageNum();
552 : 2 : }
553 : :
554 : : uno::Reference< beans::XPropertySetInfo > SAL_CALL
555 : 178 : SwXDocumentIndex::getPropertySetInfo() throw (uno::RuntimeException)
556 : : {
557 [ + - ]: 178 : SolarMutexGuard g;
558 : :
559 : : const uno::Reference< beans::XPropertySetInfo > xRef =
560 [ + - ]: 178 : m_pImpl->m_rPropSet.getPropertySetInfo();
561 [ + - ]: 178 : return xRef;
562 : : }
563 : :
564 : : void SAL_CALL
565 : 422 : SwXDocumentIndex::setPropertyValue(
566 : : const OUString& rPropertyName, const uno::Any& rValue)
567 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
568 : : lang::IllegalArgumentException, lang::WrappedTargetException,
569 : : uno::RuntimeException)
570 : : {
571 [ + - ]: 422 : SolarMutexGuard aGuard;
572 : :
573 : : SfxItemPropertySimpleEntry const*const pEntry =
574 [ + - ]: 422 : m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
575 [ - + ]: 422 : if (!pEntry)
576 : : {
577 : : throw beans::UnknownPropertyException(
578 : : OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
579 : : + rPropertyName,
580 [ # # ][ # # ]: 0 : static_cast<cppu::OWeakObject *>(this));
[ # # ]
581 : : }
582 [ + + ]: 422 : if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
583 : : {
584 : : throw beans::PropertyVetoException(
585 : : OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: " ))
586 : : + rPropertyName,
587 [ + - ][ + - ]: 4 : static_cast<cppu::OWeakObject *>(this));
[ + - ]
588 : : }
589 : :
590 : 418 : SwSectionFmt *const pSectionFmt(m_pImpl->GetSectionFmt());
591 [ + - ]: 418 : SwTOXBase & rTOXBase( m_pImpl->GetTOXSectionOrThrow() );
592 : :
593 [ + - ]: 418 : sal_uInt16 nCreate = rTOXBase.GetCreateType();
594 : 418 : sal_uInt16 nTOIOptions = 0;
595 : 418 : sal_uInt16 nOLEOptions = rTOXBase.GetOLEOptions();
596 [ + - ]: 418 : const TOXTypes eTxBaseType = rTOXBase.GetTOXType()->GetType();
597 [ + + ]: 418 : if (eTxBaseType == TOX_INDEX)
598 : : {
599 : 134 : nTOIOptions = rTOXBase.GetOptions();
600 : : }
601 [ + - ][ + - ]: 418 : SwForm aForm(rTOXBase.GetTOXForm());
602 : 418 : sal_Bool bForm = sal_False;
603 [ + + + + : 418 : switch (pEntry->nWID)
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + ]
604 : : {
605 : : case WID_IDX_TITLE:
606 : : {
607 : 30 : OUString sNewName;
608 [ - + ]: 30 : if (!(rValue >>= sNewName))
609 : : {
610 [ # # ]: 0 : throw lang::IllegalArgumentException();
611 : : }
612 [ + - ][ + - ]: 30 : rTOXBase.SetTitle(sNewName);
[ + - ]
613 : : }
614 : 30 : break;
615 : : case WID_IDX_NAME:
616 : : {
617 : 28 : OUString sNewName;
618 [ - + ]: 28 : if (!(rValue >>= sNewName))
619 : : {
620 [ # # ]: 0 : throw lang::IllegalArgumentException();
621 : : }
622 [ + - ][ + - ]: 28 : rTOXBase.SetTOXName(sNewName);
[ + - ]
623 : : }
624 : 28 : break;
625 : : case WID_USER_IDX_NAME:
626 : : {
627 : 4 : OUString sNewName;
628 [ - + ]: 4 : if (!(rValue >>= sNewName))
629 : : {
630 [ # # ]: 0 : throw lang::IllegalArgumentException();
631 : : }
632 [ + - ]: 4 : lcl_ConvertTOUNameToUserName(sNewName);
633 : : OSL_ENSURE(TOX_USER == eTxBaseType,
634 : : "tox type name can only be changed for user indexes");
635 [ + - ]: 4 : if (pSectionFmt)
636 : : {
637 [ + - ][ + - ]: 4 : OUString sTmp = rTOXBase.GetTOXType()->GetTypeName();
638 [ - + ]: 4 : if (sTmp != sNewName)
639 : : {
640 : : lcl_ReAssignTOXType(pSectionFmt->GetDoc(),
641 [ # # ]: 0 : rTOXBase, sNewName);
642 : 4 : }
643 : : }
644 : : else
645 : : {
646 : 0 : m_pImpl->m_pProps->SetTypeName(sNewName);
647 : 4 : }
648 : : }
649 : 4 : break;
650 : : case WID_IDX_LOCALE:
651 : : {
652 : 6 : lang::Locale aLocale;
653 [ - + ][ + - ]: 6 : if (!(rValue>>= aLocale))
654 : : {
655 [ # # ]: 0 : throw lang::IllegalArgumentException();
656 : : }
657 [ + - ]: 6 : rTOXBase.SetLanguage(SvxLocaleToLanguage(aLocale));
658 : : }
659 : 6 : break;
660 : : case WID_IDX_SORT_ALGORITHM:
661 : : {
662 : 6 : OUString sTmp;
663 [ - + ]: 6 : if (!(rValue >>= sTmp))
664 : : {
665 [ # # ]: 0 : throw lang::IllegalArgumentException();
666 : : }
667 [ + - ][ + - ]: 6 : rTOXBase.SetSortAlgorithm(sTmp);
[ + - ]
668 : : }
669 : 6 : break;
670 : : case WID_LEVEL:
671 : : {
672 [ + - ]: 4 : rTOXBase.SetLevel(lcl_AnyToInt16(rValue));
673 : : }
674 : 4 : break;
675 : : case WID_CREATE_FROM_MARKS:
676 [ + - ]: 8 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_MARK);
677 : 8 : break;
678 : : case WID_CREATE_FROM_OUTLINE:
679 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_OUTLINELEVEL);
680 : 4 : break;
681 : : // case WID_PARAGRAPH_STYLE_NAMES :OSL_FAIL("not implemented")
682 : : // break;
683 : : case WID_CREATE_FROM_CHAPTER:
684 [ + - ]: 26 : rTOXBase.SetFromChapter(lcl_AnyToBool(rValue));
685 : 26 : break;
686 : : case WID_CREATE_FROM_LABELS:
687 [ + - ]: 8 : rTOXBase.SetFromObjectNames(! lcl_AnyToBool(rValue));
688 : 8 : break;
689 : : case WID_PROTECTED:
690 : : {
691 [ + - ]: 30 : sal_Bool bSet = lcl_AnyToBool(rValue);
692 : 30 : rTOXBase.SetProtected(bSet);
693 [ + - ]: 30 : if (pSectionFmt)
694 : : {
695 [ + - ]: 30 : static_cast<SwTOXBaseSection &>(rTOXBase).SetProtect(bSet);
696 : : }
697 : : }
698 : 30 : break;
699 : : case WID_USE_ALPHABETICAL_SEPARATORS:
700 : : lcl_AnyToBitMask(rValue, nTOIOptions,
701 [ + - ]: 6 : nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
702 : 6 : break;
703 : : case WID_USE_KEY_AS_ENTRY:
704 : : lcl_AnyToBitMask(rValue, nTOIOptions,
705 [ + - ]: 6 : nsSwTOIOptions::TOI_KEY_AS_ENTRY);
706 : 6 : break;
707 : : case WID_USE_COMBINED_ENTRIES:
708 : : lcl_AnyToBitMask(rValue, nTOIOptions,
709 [ + - ]: 6 : nsSwTOIOptions::TOI_SAME_ENTRY);
710 : 6 : break;
711 : : case WID_IS_CASE_SENSITIVE:
712 : : lcl_AnyToBitMask(rValue, nTOIOptions,
713 [ + - ]: 6 : nsSwTOIOptions::TOI_CASE_SENSITIVE);
714 : 6 : break;
715 : : case WID_USE_P_P:
716 [ + - ]: 6 : lcl_AnyToBitMask(rValue, nTOIOptions, nsSwTOIOptions::TOI_FF);
717 : 6 : break;
718 : : case WID_USE_DASH:
719 [ + - ]: 6 : lcl_AnyToBitMask(rValue, nTOIOptions, nsSwTOIOptions::TOI_DASH);
720 : 6 : break;
721 : : case WID_USE_UPPER_CASE:
722 : : lcl_AnyToBitMask(rValue, nTOIOptions,
723 [ + - ]: 6 : nsSwTOIOptions::TOI_INITIAL_CAPS);
724 : 6 : break;
725 : : case WID_IS_COMMA_SEPARATED:
726 : 4 : bForm = sal_True;
727 [ + - ]: 4 : aForm.SetCommaSeparated(lcl_AnyToBool(rValue));
728 : 4 : break;
729 : : case WID_LABEL_CATEGORY:
730 : : {
731 : : // convert file-format/API/external programmatic english name
732 : : // to internal UI name before usage
733 : : String aName( SwStyleNameMapper::GetSpecialExtraUIName(
734 [ + - ][ + - ]: 8 : lcl_AnyToString(rValue) ) );
[ + - ][ + - ]
735 [ + - ][ + - ]: 8 : rTOXBase.SetSequenceName( aName );
736 : : }
737 : 8 : break;
738 : : case WID_LABEL_DISPLAY_TYPE:
739 : : {
740 [ + - ]: 8 : const sal_Int16 nVal = lcl_AnyToInt16(rValue);
741 : 8 : sal_uInt16 nSet = CAPTION_COMPLETE;
742 [ + - - - ]: 8 : switch (nVal)
743 : : {
744 : : case text::ReferenceFieldPart::TEXT:
745 : 8 : nSet = CAPTION_COMPLETE;
746 : 8 : break;
747 : : case text::ReferenceFieldPart::CATEGORY_AND_NUMBER:
748 : 0 : nSet = CAPTION_NUMBER;
749 : 0 : break;
750 : : case text::ReferenceFieldPart::ONLY_CAPTION:
751 : 0 : nSet = CAPTION_TEXT;
752 : 0 : break;
753 : : default:
754 [ # # ]: 0 : throw lang::IllegalArgumentException();
755 : : }
756 : 8 : rTOXBase.SetCaptionDisplay(static_cast<SwCaptionDisplay>(nSet));
757 : : }
758 : 8 : break;
759 : : case WID_USE_LEVEL_FROM_SOURCE:
760 [ + - ]: 4 : rTOXBase.SetLevelFromChapter(lcl_AnyToBool(rValue));
761 : 4 : break;
762 : : case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME:
763 : : {
764 [ + - ]: 2 : String aString;
765 : : SwStyleNameMapper::FillUIName(lcl_AnyToString(rValue),
766 [ + - ][ + - ]: 2 : aString, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT, sal_True);
[ + - ][ + - ]
767 [ + - ][ + - ]: 2 : rTOXBase.SetMainEntryCharStyle( aString );
768 : : }
769 : 2 : break;
770 : : case WID_CREATE_FROM_TABLES:
771 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TABLE);
772 : 4 : break;
773 : : case WID_CREATE_FROM_TEXT_FRAMES:
774 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_FRAME);
775 : 4 : break;
776 : : case WID_CREATE_FROM_GRAPHIC_OBJECTS:
777 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_GRAPHIC);
778 : 4 : break;
779 : : case WID_CREATE_FROM_EMBEDDED_OBJECTS:
780 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_OLE);
781 : 4 : break;
782 : : case WID_CREATE_FROM_STAR_MATH:
783 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_MATH);
784 : 4 : break;
785 : : case WID_CREATE_FROM_STAR_CHART:
786 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_CHART);
787 : 4 : break;
788 : : case WID_CREATE_FROM_STAR_CALC:
789 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_CALC);
790 : 4 : break;
791 : : case WID_CREATE_FROM_STAR_DRAW:
792 : : lcl_AnyToBitMask(rValue, nOLEOptions,
793 [ + - ]: 4 : nsSwTOOElements::TOO_DRAW_IMPRESS);
794 : 4 : break;
795 : : case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
796 [ + - ]: 4 : lcl_AnyToBitMask(rValue, nOLEOptions, nsSwTOOElements::TOO_OTHER);
797 : 4 : break;
798 : : case WID_PARA_HEAD:
799 : : {
800 [ + - ]: 30 : String aString;
801 : : SwStyleNameMapper::FillUIName( lcl_AnyToString(rValue),
802 [ + - ][ + - ]: 30 : aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
[ + - ][ + - ]
803 : 30 : bForm = sal_True;
804 : : // Header is on Pos 0
805 [ + - ][ + - ]: 30 : aForm.SetTemplate( 0, aString );
806 : : }
807 : 30 : break;
808 : : case WID_IS_RELATIVE_TABSTOPS:
809 : 24 : bForm = sal_True;
810 [ + - ]: 24 : aForm.SetRelTabPos(lcl_AnyToBool(rValue));
811 : 24 : break;
812 : : case WID_PARA_SEP:
813 : : {
814 [ + - ]: 2 : String aString;
815 : 2 : bForm = sal_True;
816 : : SwStyleNameMapper::FillUIName( lcl_AnyToString(rValue),
817 [ + - ][ + - ]: 2 : aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
[ + - ][ + - ]
818 [ + - ][ + - ]: 2 : aForm.SetTemplate( 1, aString );
819 : : }
820 : 2 : break;
821 : : case WID_CREATE_FROM_PARAGRAPH_STYLES:
822 [ + - ]: 8 : lcl_AnyToBitMask(rValue, nCreate, nsSwTOXElement::TOX_TEMPLATE);
823 : 8 : break;
824 : :
825 : : case WID_PARA_LEV1:
826 : : case WID_PARA_LEV2:
827 : : case WID_PARA_LEV3:
828 : : case WID_PARA_LEV4:
829 : : case WID_PARA_LEV5:
830 : : case WID_PARA_LEV6:
831 : : case WID_PARA_LEV7:
832 : : case WID_PARA_LEV8:
833 : : case WID_PARA_LEV9:
834 : : case WID_PARA_LEV10:
835 : : {
836 : 6 : bForm = sal_True;
837 : : // in sdbcx::Index Label 1 begins at Pos 2 otherwise at Pos 1
838 [ + - ][ + - ]: 6 : const sal_uInt16 nLPos = rTOXBase.GetType() == TOX_INDEX ? 2 : 1;
839 [ + - ]: 6 : String aString;
840 : : SwStyleNameMapper::FillUIName( lcl_AnyToString(rValue),
841 [ + - ][ + - ]: 6 : aString, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
[ + - ][ + - ]
842 [ + - ][ + - ]: 6 : aForm.SetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1, aString );
843 : : }
844 : 6 : break;
845 : : default:
846 : : //this is for items only
847 [ + + ]: 90 : if (WID_PRIMARY_KEY > pEntry->nWID)
848 : : {
849 : : const SwAttrSet& rSet =
850 [ + - ]: 88 : m_pImpl->m_pDoc->GetTOXBaseAttrSet(rTOXBase);
851 [ + - ]: 88 : SfxItemSet aAttrSet(rSet);
852 : 88 : m_pImpl->m_rPropSet.setPropertyValue(
853 [ + - ]: 88 : rPropertyName, rValue, aAttrSet);
854 : :
855 : 88 : const SwSectionFmts& rSects = m_pImpl->m_pDoc->GetSections();
856 [ + - ]: 568 : for (sal_uInt16 i = 0; i < rSects.size(); i++)
857 : : {
858 : 568 : const SwSectionFmt* pTmpFmt = rSects[ i ];
859 [ + + ]: 568 : if (pTmpFmt == pSectionFmt)
860 : : {
861 : : SwSectionData tmpData(
862 [ + - ]: 88 : static_cast<SwTOXBaseSection&>(rTOXBase));
863 [ + - ]: 88 : m_pImpl->m_pDoc->UpdateSection(i, tmpData, & aAttrSet);
864 [ + - ]: 88 : break;
865 : : }
866 [ + - ]: 88 : }
867 : : }
868 : : }
869 [ + - ]: 418 : rTOXBase.SetCreate(nCreate);
870 : 418 : rTOXBase.SetOLEOptions(nOLEOptions);
871 [ + + ][ + - ]: 418 : if (rTOXBase.GetTOXType()->GetType() == TOX_INDEX)
872 : : {
873 : 134 : rTOXBase.SetOptions(nTOIOptions);
874 : : }
875 [ + + ]: 418 : if (bForm)
876 : : {
877 [ + - ]: 66 : rTOXBase.SetTOXForm(aForm);
878 [ + - ][ + - ]: 422 : }
879 : 418 : }
880 : :
881 : : uno::Any SAL_CALL
882 : 682 : SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
883 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
884 : : uno::RuntimeException)
885 : : {
886 [ + - ]: 682 : SolarMutexGuard aGuard;
887 : :
888 : 682 : uno::Any aRet;
889 : : SfxItemPropertySimpleEntry const*const pEntry =
890 [ + - ]: 682 : m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
891 [ - + ]: 682 : if (!pEntry)
892 : : {
893 : : throw beans::UnknownPropertyException(
894 : : OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
895 : : + rPropertyName,
896 [ # # ][ # # ]: 0 : static_cast< cppu::OWeakObject * >(this));
[ # # ]
897 : : }
898 : :
899 : 682 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
900 : 682 : SwTOXBase* pTOXBase = 0;
901 [ + - ]: 682 : if (pSectionFmt)
902 : : {
903 [ + - ][ + - ]: 682 : pTOXBase = static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection());
904 : : }
905 [ # # ]: 0 : else if (m_pImpl->m_bIsDescriptor)
906 : : {
907 : 0 : pTOXBase = &m_pImpl->m_pProps->GetTOXBase();
908 : : }
909 [ + - ]: 682 : if(pTOXBase)
910 : : {
911 [ + - ]: 682 : const sal_uInt16 nCreate = pTOXBase->GetCreateType();
912 : 682 : const sal_uInt16 nOLEOptions = pTOXBase->GetOLEOptions();
913 : : const sal_uInt16 nTOIOptions =
914 [ + - ]: 682 : (pTOXBase->GetTOXType()->GetType() == TOX_INDEX)
915 : : ? pTOXBase->GetOptions()
916 [ + + ]: 682 : : 0U;
917 [ + - ]: 682 : const SwForm& rForm = pTOXBase->GetTOXForm();
918 [ + + + + : 682 : switch(pEntry->nWID)
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + + +
+ + + ]
919 : : {
920 : : case WID_IDX_CONTENT_SECTION:
921 : : case WID_IDX_HEADER_SECTION :
922 [ + + ]: 118 : if(WID_IDX_CONTENT_SECTION == pEntry->nWID)
923 : : {
924 : : const uno::Reference <text::XTextSection> xContentSect =
925 [ + - ]: 60 : SwXTextSection::CreateXTextSection( pSectionFmt );
926 [ + - ]: 60 : aRet <<= xContentSect;
927 : : }
928 : : else
929 : : {
930 [ + - ]: 58 : SwSections aSectArr;
931 : : pSectionFmt->GetChildSections(aSectArr,
932 [ + - ]: 58 : SORTSECT_NOT, sal_False);
933 [ + + ]: 58 : for(sal_uInt16 i = 0; i < aSectArr.size(); i++)
934 : : {
935 [ + - ]: 56 : SwSection* pSect = aSectArr[i];
936 [ + - ]: 56 : if(pSect->GetType() == TOX_HEADER_SECTION)
937 : : {
938 : : const uno::Reference <text::XTextSection> xHeader =
939 : : SwXTextSection::CreateXTextSection(
940 [ + - ]: 56 : pSect->GetFmt() );
941 [ + - ]: 56 : aRet <<= xHeader;
942 : 56 : break;
943 : : }
944 : 58 : }
945 : : }
946 : 118 : break;
947 : : case WID_IDX_TITLE :
948 : : {
949 [ + - ][ + - ]: 18 : OUString uRet(pTOXBase->GetTitle());
950 [ + - ]: 18 : aRet <<= uRet;
951 : 18 : break;
952 : : }
953 : : case WID_IDX_NAME:
954 [ + - ][ + - ]: 14 : aRet <<= OUString(pTOXBase->GetTOXName());
955 : 14 : break;
956 : : case WID_USER_IDX_NAME:
957 : : {
958 : 2 : OUString sTmp;
959 [ + - ]: 2 : if (!m_pImpl->m_bIsDescriptor)
960 : : {
961 [ + - ][ + - ]: 2 : sTmp = pTOXBase->GetTOXType()->GetTypeName();
962 : : }
963 : : else
964 : : {
965 : 0 : sTmp = m_pImpl->m_pProps->GetTypeName();
966 : : }
967 : : //I18N
968 [ + - ]: 2 : lcl_ConvertTOUNameToProgrammaticName(sTmp);
969 [ + - ]: 2 : aRet <<= sTmp;
970 : : }
971 : 2 : break;
972 : : case WID_IDX_LOCALE:
973 [ + - ][ + - ]: 6 : aRet <<= SvxCreateLocale(pTOXBase->GetLanguage());
974 : 6 : break;
975 : : case WID_IDX_SORT_ALGORITHM:
976 [ + - ][ + - ]: 6 : aRet <<= OUString(pTOXBase->GetSortAlgorithm());
977 : 6 : break;
978 : : case WID_LEVEL :
979 [ + - ]: 2 : aRet <<= static_cast<sal_Int16>(pTOXBase->GetLevel());
980 : 2 : break;
981 : : case WID_CREATE_FROM_MARKS:
982 [ + - ]: 4 : lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_MARK);
983 : 4 : break;
984 : : case WID_CREATE_FROM_OUTLINE:
985 : : lcl_BitMaskToAny(aRet, nCreate,
986 [ + - ]: 2 : nsSwTOXElement::TOX_OUTLINELEVEL);
987 : 2 : break;
988 : : case WID_CREATE_FROM_CHAPTER:
989 : : {
990 : 16 : const sal_Bool bRet = pTOXBase->IsFromChapter();
991 [ + - ]: 16 : aRet <<= bRet;
992 : : }
993 : 16 : break;
994 : : case WID_CREATE_FROM_LABELS:
995 : : {
996 : 4 : const sal_Bool bRet = ! pTOXBase->IsFromObjectNames();
997 [ + - ]: 4 : aRet <<= bRet;
998 : : }
999 : 4 : break;
1000 : : case WID_PROTECTED:
1001 : : {
1002 : 18 : const sal_Bool bRet = pTOXBase->IsProtected();
1003 [ + - ]: 18 : aRet <<= bRet;
1004 : : }
1005 : 18 : break;
1006 : : case WID_USE_ALPHABETICAL_SEPARATORS:
1007 : : lcl_BitMaskToAny(aRet, nTOIOptions,
1008 [ + - ]: 6 : nsSwTOIOptions::TOI_ALPHA_DELIMITTER);
1009 : 6 : break;
1010 : : case WID_USE_KEY_AS_ENTRY:
1011 : : lcl_BitMaskToAny(aRet, nTOIOptions,
1012 [ + - ]: 6 : nsSwTOIOptions::TOI_KEY_AS_ENTRY);
1013 : 6 : break;
1014 : : case WID_USE_COMBINED_ENTRIES:
1015 : : lcl_BitMaskToAny(aRet, nTOIOptions,
1016 [ + - ]: 6 : nsSwTOIOptions::TOI_SAME_ENTRY);
1017 : 6 : break;
1018 : : case WID_IS_CASE_SENSITIVE:
1019 : : lcl_BitMaskToAny(aRet, nTOIOptions,
1020 [ + - ]: 6 : nsSwTOIOptions::TOI_CASE_SENSITIVE);
1021 : 6 : break;
1022 : : case WID_USE_P_P:
1023 [ + - ]: 6 : lcl_BitMaskToAny(aRet, nTOIOptions, nsSwTOIOptions::TOI_FF);
1024 : 6 : break;
1025 : : case WID_USE_DASH:
1026 [ + - ]: 6 : lcl_BitMaskToAny(aRet, nTOIOptions, nsSwTOIOptions::TOI_DASH);
1027 : 6 : break;
1028 : : case WID_USE_UPPER_CASE:
1029 : : lcl_BitMaskToAny(aRet, nTOIOptions,
1030 [ + - ]: 6 : nsSwTOIOptions::TOI_INITIAL_CAPS);
1031 : 6 : break;
1032 : : case WID_IS_COMMA_SEPARATED:
1033 : : {
1034 : 2 : const sal_Bool bRet = rForm.IsCommaSeparated();
1035 [ + - ]: 2 : aRet <<= bRet;
1036 : : }
1037 : 2 : break;
1038 : : case WID_LABEL_CATEGORY:
1039 : : {
1040 : : // convert internal UI name to
1041 : : // file-format/API/external programmatic english name
1042 : : // before usage
1043 : : String aName( SwStyleNameMapper::GetSpecialExtraProgName(
1044 [ + - ]: 4 : pTOXBase->GetSequenceName() ) );
1045 [ + - ][ + - ]: 4 : aRet <<= OUString( aName );
[ + - ]
1046 : : }
1047 : 4 : break;
1048 : : case WID_LABEL_DISPLAY_TYPE:
1049 : : {
1050 : 4 : sal_Int16 nSet = text::ReferenceFieldPart::TEXT;
1051 [ + - - - ]: 4 : switch (pTOXBase->GetCaptionDisplay())
1052 : : {
1053 : : case CAPTION_COMPLETE:
1054 : 4 : nSet = text::ReferenceFieldPart::TEXT;
1055 : 4 : break;
1056 : : case CAPTION_NUMBER:
1057 : 0 : nSet = text::ReferenceFieldPart::CATEGORY_AND_NUMBER;
1058 : 0 : break;
1059 : : case CAPTION_TEXT:
1060 : 0 : nSet = text::ReferenceFieldPart::ONLY_CAPTION;
1061 : 0 : break;
1062 : : }
1063 [ + - ]: 4 : aRet <<= nSet;
1064 : : }
1065 : 4 : break;
1066 : : case WID_USE_LEVEL_FROM_SOURCE:
1067 : : {
1068 : 2 : const sal_Bool bRet = pTOXBase->IsLevelFromChapter();
1069 [ + - ]: 2 : aRet <<= bRet;
1070 : : }
1071 : 2 : break;
1072 : : case WID_LEVEL_FORMAT:
1073 : : {
1074 : : uno::Reference< container::XIndexReplace > xTokenAccess(
1075 [ + - ]: 214 : m_pImpl->m_wTokenAccess);
1076 [ + + ]: 214 : if (!xTokenAccess.is())
1077 : : {
1078 [ + - ][ + - ]: 212 : xTokenAccess = new TokenAccess_Impl(*this);
[ + - ]
1079 [ + - ]: 212 : m_pImpl->m_wTokenAccess = xTokenAccess;
1080 : : }
1081 [ + - ]: 214 : aRet <<= xTokenAccess;
1082 : : }
1083 : 214 : break;
1084 : : case WID_LEVEL_PARAGRAPH_STYLES:
1085 : : {
1086 : : uno::Reference< container::XIndexReplace > xStyleAccess(
1087 [ + - ]: 4 : m_pImpl->m_wStyleAccess);
1088 [ + - ]: 4 : if (!xStyleAccess.is())
1089 : : {
1090 [ + - ][ + - ]: 4 : xStyleAccess = new StyleAccess_Impl(*this);
[ + - ]
1091 [ + - ]: 4 : m_pImpl->m_wStyleAccess = xStyleAccess;
1092 : : }
1093 [ + - ]: 4 : aRet <<= xStyleAccess;
1094 : : }
1095 : 4 : break;
1096 : : case WID_MAIN_ENTRY_CHARACTER_STYLE_NAME:
1097 : : {
1098 [ + - ]: 6 : String aString;
1099 : : SwStyleNameMapper::FillProgName(
1100 : 6 : pTOXBase->GetMainEntryCharStyle(),
1101 : : aString,
1102 : : nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
1103 [ + - ]: 6 : sal_True);
1104 [ + - ][ + - ]: 6 : aRet <<= OUString( aString );
[ + - ]
1105 : : }
1106 : 6 : break;
1107 : : case WID_CREATE_FROM_TABLES:
1108 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_TABLE);
1109 : 2 : break;
1110 : : case WID_CREATE_FROM_TEXT_FRAMES:
1111 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_FRAME);
1112 : 2 : break;
1113 : : case WID_CREATE_FROM_GRAPHIC_OBJECTS:
1114 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_GRAPHIC);
1115 : 2 : break;
1116 : : case WID_CREATE_FROM_EMBEDDED_OBJECTS:
1117 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_OLE);
1118 : 2 : break;
1119 : : case WID_CREATE_FROM_STAR_MATH:
1120 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_MATH);
1121 : 2 : break;
1122 : : case WID_CREATE_FROM_STAR_CHART:
1123 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_CHART);
1124 : 2 : break;
1125 : : case WID_CREATE_FROM_STAR_CALC:
1126 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_CALC);
1127 : 2 : break;
1128 : : case WID_CREATE_FROM_STAR_DRAW:
1129 : : lcl_BitMaskToAny(aRet, nOLEOptions,
1130 [ + - ]: 2 : nsSwTOOElements::TOO_DRAW_IMPRESS);
1131 : 2 : break;
1132 : : case WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS:
1133 [ + - ]: 2 : lcl_BitMaskToAny(aRet, nOLEOptions, nsSwTOOElements::TOO_OTHER);
1134 : 2 : break;
1135 : : case WID_CREATE_FROM_PARAGRAPH_STYLES:
1136 [ + - ]: 4 : lcl_BitMaskToAny(aRet, nCreate, nsSwTOXElement::TOX_TEMPLATE);
1137 : 4 : break;
1138 : : case WID_PARA_HEAD:
1139 : : {
1140 : : //Header steht an Pos 0
1141 [ + - ]: 18 : String aString;
1142 : 18 : SwStyleNameMapper::FillProgName(rForm.GetTemplate( 0 ), aString,
1143 [ + - ]: 18 : nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
1144 [ + - ][ + - ]: 18 : aRet <<= OUString( aString );
[ + - ]
1145 : : }
1146 : 18 : break;
1147 : : case WID_PARA_SEP:
1148 : : {
1149 [ + - ]: 6 : String aString;
1150 : : SwStyleNameMapper::FillProgName(
1151 : 6 : rForm.GetTemplate( 1 ),
1152 : : aString,
1153 : : nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
1154 [ + - ]: 6 : sal_True);
1155 [ + - ][ + - ]: 6 : aRet <<= OUString( aString );
[ + - ]
1156 : : }
1157 : 6 : break;
1158 : : case WID_PARA_LEV1:
1159 : : case WID_PARA_LEV2:
1160 : : case WID_PARA_LEV3:
1161 : : case WID_PARA_LEV4:
1162 : : case WID_PARA_LEV5:
1163 : : case WID_PARA_LEV6:
1164 : : case WID_PARA_LEV7:
1165 : : case WID_PARA_LEV8:
1166 : : case WID_PARA_LEV9:
1167 : : case WID_PARA_LEV10:
1168 : : {
1169 : : // in sdbcx::Index Label 1 begins at Pos 2 otherwise at Pos 1
1170 [ + - ][ + + ]: 108 : sal_uInt16 nLPos = pTOXBase->GetType() == TOX_INDEX ? 2 : 1;
1171 [ + - ]: 108 : String aString;
1172 : : SwStyleNameMapper::FillProgName(
1173 : 108 : rForm.GetTemplate(nLPos + pEntry->nWID - WID_PARA_LEV1),
1174 : : aString,
1175 : : nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
1176 [ + - ]: 108 : sal_True);
1177 [ + - ][ + - ]: 108 : aRet <<= OUString( aString );
[ + - ]
1178 : : }
1179 : 108 : break;
1180 : : case WID_IS_RELATIVE_TABSTOPS:
1181 : : {
1182 : 12 : const sal_Bool bRet = rForm.IsRelTabPos();
1183 [ + - ]: 12 : aRet <<= bRet;
1184 : : }
1185 : 12 : break;
1186 : : case WID_INDEX_MARKS:
1187 : : {
1188 [ + - ]: 4 : SwTOXMarks aMarks;
1189 [ + - ]: 4 : const SwTOXType* pType = pTOXBase->GetTOXType();
1190 [ + - ]: 4 : SwTOXMark::InsertTOXMarks( aMarks, *pType );
1191 [ + - ]: 4 : uno::Sequence< uno::Reference<text::XDocumentIndexMark> > aXMarks(aMarks.size());
1192 [ + - ]: 4 : uno::Reference<text::XDocumentIndexMark>* pxMarks = aXMarks.getArray();
1193 [ - + ]: 4 : for(sal_uInt16 i = 0; i < aMarks.size(); i++)
1194 : : {
1195 : 0 : SwTOXMark* pMark = aMarks[i];
1196 : : pxMarks[i] = SwXDocumentIndexMark::CreateXDocumentIndexMark(
1197 : 0 : *m_pImpl->m_pDoc,
1198 [ # # ][ # # ]: 0 : *const_cast<SwTOXType*>(pType), *pMark);
1199 : : }
1200 [ + - ][ + - ]: 4 : aRet <<= aXMarks;
1201 : : }
1202 : 4 : break;
1203 : : default:
1204 : : //this is for items only
1205 [ + - ]: 24 : if(WID_PRIMARY_KEY > pEntry->nWID)
1206 : : {
1207 : : const SwAttrSet& rSet =
1208 [ + - ]: 24 : m_pImpl->m_pDoc->GetTOXBaseAttrSet(*pTOXBase);
1209 : 24 : aRet = m_pImpl->m_rPropSet.getPropertyValue(
1210 [ + - ]: 682 : rPropertyName, rSet);
1211 : : }
1212 : : }
1213 : : }
1214 [ + - ]: 682 : return aRet;
1215 : : }
1216 : :
1217 : : void SAL_CALL
1218 : 0 : SwXDocumentIndex::addPropertyChangeListener(
1219 : : const ::rtl::OUString& /*rPropertyName*/,
1220 : : const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
1221 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
1222 : : uno::RuntimeException)
1223 : : {
1224 : : OSL_FAIL("SwXDocumentIndex::addPropertyChangeListener(): not implemented");
1225 : 0 : }
1226 : :
1227 : : void SAL_CALL
1228 : 0 : SwXDocumentIndex::removePropertyChangeListener(
1229 : : const ::rtl::OUString& /*rPropertyName*/,
1230 : : const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
1231 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
1232 : : uno::RuntimeException)
1233 : : {
1234 : : OSL_FAIL("SwXDocumentIndex::removePropertyChangeListener(): not implemented");
1235 : 0 : }
1236 : :
1237 : : void SAL_CALL
1238 : 0 : SwXDocumentIndex::addVetoableChangeListener(
1239 : : const ::rtl::OUString& /*rPropertyName*/,
1240 : : const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
1241 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
1242 : : uno::RuntimeException)
1243 : : {
1244 : : OSL_FAIL("SwXDocumentIndex::addVetoableChangeListener(): not implemented");
1245 : 0 : }
1246 : :
1247 : : void SAL_CALL
1248 : 0 : SwXDocumentIndex::removeVetoableChangeListener(
1249 : : const ::rtl::OUString& /*rPropertyName*/,
1250 : : const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
1251 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
1252 : : uno::RuntimeException)
1253 : : {
1254 : : OSL_FAIL("SwXDocumentIndex::removeVetoableChangeListener(): not implemented");
1255 : 0 : }
1256 : :
1257 : : void SAL_CALL
1258 : 38 : SwXDocumentIndex::attach(const uno::Reference< text::XTextRange > & xTextRange)
1259 : : throw (lang::IllegalArgumentException, uno::RuntimeException)
1260 : : {
1261 [ + - ]: 38 : SolarMutexGuard aGuard;
1262 : :
1263 [ - + ]: 38 : if (!m_pImpl->m_bIsDescriptor)
1264 : : {
1265 [ # # ]: 0 : throw uno::RuntimeException();
1266 : : }
1267 [ + - ]: 38 : const uno::Reference<XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
1268 : : SwXTextRange *const pRange =
1269 [ + - ]: 38 : ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
1270 : : OTextCursorHelper *const pCursor =
1271 [ + - ]: 38 : ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
1272 : :
1273 : : SwDoc *const pDoc =
1274 [ + + ][ + - ]: 38 : (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
[ + - ][ + - ]
1275 [ - + ]: 38 : if (!pDoc)
1276 : : {
1277 [ # # ]: 0 : throw lang::IllegalArgumentException();
1278 : : }
1279 : :
1280 [ + - ]: 38 : SwUnoInternalPaM aPam(*pDoc);
1281 : : //das muss jetzt sal_True liefern
1282 [ + - ]: 38 : ::sw::XTextRangeToSwPaM(aPam, xTextRange);
1283 : :
1284 [ + - ][ + - ]: 38 : const SwTOXBase* pOld = pDoc->GetCurTOX( *aPam.Start() );
1285 [ - + ]: 38 : if (pOld)
1286 : : {
1287 [ # # ]: 0 : throw lang::IllegalArgumentException();
1288 : : }
1289 : :
1290 [ + - ]: 38 : UnoActionContext aAction(pDoc);
1291 [ - + ]: 38 : if (aPam.HasMark())
1292 : : {
1293 [ # # ]: 0 : pDoc->DeleteAndJoin(aPam);
1294 : : }
1295 : :
1296 : 38 : SwTOXBase & rTOXBase = m_pImpl->m_pProps->GetTOXBase();
1297 [ + - ]: 38 : SwTOXType const*const pTOXType = rTOXBase.GetTOXType();
1298 [ + + - + ]: 80 : if ((TOX_USER == pTOXType->GetType()) &&
[ - + ]
1299 [ + - ][ + + ]: 42 : !m_pImpl->m_pProps->GetTypeName().equals(pTOXType->GetTypeName()))
[ # # ]
1300 : : {
1301 [ # # ]: 0 : lcl_ReAssignTOXType(pDoc, rTOXBase, m_pImpl->m_pProps->GetTypeName());
1302 : : }
1303 : : //TODO: apply Section attributes (columns and background)
1304 : : SwTOXBaseSection const*const pTOX =
1305 [ + - ]: 38 : pDoc->InsertTableOf( *aPam.GetPoint(), rTOXBase, 0, sal_False );
1306 : :
1307 [ + - ]: 38 : pDoc->SetTOXBaseName(*pTOX, m_pImpl->m_pProps->GetTOXBase().GetTOXName());
1308 : :
1309 : : // update page numbers
1310 [ + - ]: 38 : pTOX->GetFmt()->Add(m_pImpl.get());
1311 [ + - ][ + - ]: 38 : pTOX->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
1312 [ + - ]: 38 : const_cast<SwTOXBaseSection*>(pTOX)->UpdatePageNum();
1313 : :
1314 : 38 : m_pImpl->m_pProps.reset();
1315 : 38 : m_pImpl->m_pDoc = pDoc;
1316 [ + - ][ + - ]: 38 : m_pImpl->m_bIsDescriptor = sal_False;
[ + - ]
1317 : 38 : }
1318 : :
1319 : : uno::Reference< text::XTextRange > SAL_CALL
1320 : 6 : SwXDocumentIndex::getAnchor() throw (uno::RuntimeException)
1321 : : {
1322 [ + - ]: 6 : SolarMutexGuard aGuard;
1323 : :
1324 : 6 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
1325 [ - + ]: 6 : if (!pSectionFmt)
1326 : : {
1327 [ # # ]: 0 : throw uno::RuntimeException();
1328 : : }
1329 : :
1330 : 6 : uno::Reference< text::XTextRange > xRet;
1331 [ + - ]: 6 : SwNodeIndex const*const pIdx( pSectionFmt->GetCntnt().GetCntntIdx() );
1332 [ + - ][ + - ]: 6 : if (pIdx && pIdx->GetNode().GetNodes().IsDocNodes())
[ + - ][ + - ]
1333 : : {
1334 [ + - ]: 6 : SwPaM aPaM(*pIdx);
1335 [ + - ]: 6 : aPaM.Move( fnMoveForward, fnGoCntnt );
1336 [ + - ]: 6 : aPaM.SetMark();
1337 [ + - ]: 6 : aPaM.GetPoint()->nNode = *pIdx->GetNode().EndOfSectionNode();
1338 [ + - ]: 6 : aPaM.Move( fnMoveBackward, fnGoCntnt );
1339 : 6 : xRet = SwXTextRange::CreateXTextRange(*pSectionFmt->GetDoc(),
1340 [ + - ][ + - ]: 12 : *aPaM.GetMark(), aPaM.GetPoint());
[ + - ]
1341 : : }
1342 [ + - ]: 6 : return xRet;
1343 : : }
1344 : :
1345 : 0 : void lcl_RemoveChildSections(SwSectionFmt& rParentFmt)
1346 : : {
1347 [ # # ]: 0 : SwSections aTmpArr;
1348 : 0 : SwDoc *const pDoc = rParentFmt.GetDoc();
1349 [ # # ]: 0 : const sal_uInt16 nCnt = rParentFmt.GetChildSections(aTmpArr, SORTSECT_POS);
1350 [ # # ]: 0 : if( nCnt )
1351 : : {
1352 [ # # ]: 0 : for( sal_uInt16 n = 0; n < nCnt; ++n )
1353 : : {
1354 [ # # ][ # # ]: 0 : if( aTmpArr[n]->GetFmt()->IsInNodesArr() )
[ # # ]
1355 : : {
1356 [ # # ]: 0 : SwSectionFmt* pFmt = aTmpArr[n]->GetFmt();
1357 [ # # ]: 0 : lcl_RemoveChildSections(*pFmt);
1358 [ # # ]: 0 : pDoc->DelSectionFmt( pFmt );
1359 : : }
1360 : : }
1361 : 0 : }
1362 : 0 : }
1363 : :
1364 : 2 : void SAL_CALL SwXDocumentIndex::dispose() throw (uno::RuntimeException)
1365 : : {
1366 [ + - ]: 2 : SolarMutexGuard aGuard;
1367 : :
1368 : 2 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
1369 [ + - ]: 2 : if (pSectionFmt)
1370 : : {
1371 : : pSectionFmt->GetDoc()->DeleteTOX(
1372 [ + - ][ + - ]: 2 : *static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection()),
1373 [ + - ]: 2 : sal_True);
1374 [ + - ]: 2 : }
1375 : 2 : }
1376 : :
1377 : : void SAL_CALL
1378 : 4 : SwXDocumentIndex::addEventListener(
1379 : : const uno::Reference< lang::XEventListener > & xListener)
1380 : : throw (uno::RuntimeException)
1381 : : {
1382 [ + - ]: 4 : SolarMutexGuard g;
1383 : :
1384 [ - + ]: 4 : if (!m_pImpl->GetRegisteredIn())
1385 : : {
1386 [ # # ]: 0 : throw uno::RuntimeException();
1387 : : }
1388 [ + - ][ + - ]: 4 : m_pImpl->m_ListenerContainer.AddListener(xListener);
1389 : 4 : }
1390 : :
1391 : : void SAL_CALL
1392 : 2 : SwXDocumentIndex::removeEventListener(
1393 : : const uno::Reference< lang::XEventListener > & xListener)
1394 : : throw (uno::RuntimeException)
1395 : : {
1396 [ + - ]: 2 : SolarMutexGuard g;
1397 : :
1398 [ + - ][ - + ]: 4 : if (!m_pImpl->GetRegisteredIn() ||
[ - + ]
1399 [ + - ]: 2 : !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
1400 : : {
1401 [ # # ]: 0 : throw uno::RuntimeException();
1402 [ + - ]: 2 : }
1403 : 2 : }
1404 : :
1405 : 0 : OUString SAL_CALL SwXDocumentIndex::getName() throw (uno::RuntimeException)
1406 : : {
1407 [ # # ]: 0 : SolarMutexGuard g;
1408 : :
1409 : 0 : OUString uRet;
1410 : 0 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
1411 [ # # ]: 0 : if (m_pImpl->m_bIsDescriptor)
1412 : : {
1413 [ # # ]: 0 : uRet = OUString(m_pImpl->m_pProps->GetTOXBase().GetTOXName());
1414 : : }
1415 [ # # ]: 0 : else if(pSectionFmt)
1416 : : {
1417 [ # # ][ # # ]: 0 : uRet = OUString(pSectionFmt->GetSection()->GetSectionName());
1418 : : }
1419 : : else
1420 : : {
1421 [ # # ]: 0 : throw uno::RuntimeException();
1422 : : }
1423 [ # # ]: 0 : return uRet;
1424 : : }
1425 : :
1426 : : void SAL_CALL
1427 : 0 : SwXDocumentIndex::setName(const OUString& rName) throw (uno::RuntimeException)
1428 : : {
1429 [ # # ]: 0 : SolarMutexGuard g;
1430 : :
1431 [ # # ]: 0 : if (rName.isEmpty())
1432 : : {
1433 [ # # ]: 0 : throw uno::RuntimeException();
1434 : : }
1435 : :
1436 : 0 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
1437 [ # # ]: 0 : if (m_pImpl->m_bIsDescriptor)
1438 : : {
1439 [ # # ][ # # ]: 0 : m_pImpl->m_pProps->GetTOXBase().SetTOXName(rName);
[ # # ]
1440 : : }
1441 [ # # ]: 0 : else if (pSectionFmt)
1442 : : {
1443 : : const bool bSuccess = pSectionFmt->GetDoc()->SetTOXBaseName(
1444 [ # # ][ # # ]: 0 : *static_cast<SwTOXBaseSection*>(pSectionFmt->GetSection()), rName);
[ # # ][ # # ]
[ # # ]
1445 [ # # ]: 0 : if (!bSuccess)
1446 : : {
1447 [ # # ]: 0 : throw uno::RuntimeException();
1448 : : }
1449 : : }
1450 : : else
1451 : : {
1452 [ # # ]: 0 : throw uno::RuntimeException();
1453 [ # # ]: 0 : }
1454 : 0 : }
1455 : :
1456 : : // MetadatableMixin
1457 : 56 : ::sfx2::Metadatable* SwXDocumentIndex::GetCoreObject()
1458 : : {
1459 : 56 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
1460 [ + - ]: 56 : return pSectionFmt;
1461 : : }
1462 : :
1463 : 0 : uno::Reference<frame::XModel> SwXDocumentIndex::GetModel()
1464 : : {
1465 : 0 : SwSectionFmt *const pSectionFmt( m_pImpl->GetSectionFmt() );
1466 [ # # ]: 0 : if (pSectionFmt)
1467 : : {
1468 : 0 : SwDocShell const*const pShell( pSectionFmt->GetDoc()->GetDocShell() );
1469 [ # # ]: 0 : return (pShell) ? pShell->GetModel() : 0;
1470 : : }
1471 : 0 : return 0;
1472 : : }
1473 : :
1474 : :
1475 : : /******************************************************************
1476 : : * SwXDocumentIndexMark
1477 : : ******************************************************************/
1478 : : static sal_uInt16
1479 : 134 : lcl_TypeToPropertyMap_Mark(const TOXTypes eType)
1480 : : {
1481 [ + - - ]: 134 : switch (eType)
1482 : : {
1483 : 134 : case TOX_INDEX: return PROPERTY_MAP_INDEX_MARK;
1484 : 0 : case TOX_CONTENT: return PROPERTY_MAP_CNTIDX_MARK;
1485 : : //case TOX_USER:
1486 : : default:
1487 : 134 : return PROPERTY_MAP_USER_MARK;
1488 : : }
1489 : : }
1490 : :
1491 [ + - ][ + - ]: 268 : class SwXDocumentIndexMark::Impl
[ - + ]
1492 : : : public SwClient
1493 : : {
1494 : : private:
1495 : : bool m_bInReplaceMark;
1496 : :
1497 : : public:
1498 : :
1499 : : SfxItemPropertySet const& m_rPropSet;
1500 : : const TOXTypes m_eTOXType;
1501 : : SwEventListenerContainer m_ListenerContainer;
1502 : : bool m_bIsDescriptor;
1503 : : SwDepend m_TypeDepend;
1504 : : const SwTOXMark * m_pTOXMark;
1505 : : SwDoc * m_pDoc;
1506 : :
1507 : : sal_Bool m_bMainEntry;
1508 : : sal_uInt16 m_nLevel;
1509 : : OUString m_sAltText;
1510 : : OUString m_sPrimaryKey;
1511 : : OUString m_sSecondaryKey;
1512 : : OUString m_sTextReading;
1513 : : OUString m_sPrimaryKeyReading;
1514 : : OUString m_sSecondaryKeyReading;
1515 : : OUString m_sUserIndexName;
1516 : :
1517 : 134 : Impl( SwXDocumentIndexMark & rThis,
1518 : : SwDoc *const pDoc,
1519 : : const enum TOXTypes eType,
1520 : : SwTOXType *const pType, SwTOXMark const*const pMark)
1521 : : : SwClient(const_cast<SwTOXMark*>(pMark))
1522 : : , m_bInReplaceMark(false)
1523 : : , m_rPropSet(
1524 [ + - ]: 134 : *aSwMapProvider.GetPropertySet(lcl_TypeToPropertyMap_Mark(eType)))
1525 : : , m_eTOXType(eType)
1526 : : , m_ListenerContainer(static_cast< ::cppu::OWeakObject* >(&rThis))
1527 : : // #i112513#: unxsols4 (Sun C++ 5.9 SunOS_sparc) generates wrong code for this
1528 : : // , m_bIsDescriptor(0 == pMark)
1529 : : , m_bIsDescriptor((0 == pMark) ? true : false)
1530 : : , m_TypeDepend(this, pType)
1531 : : , m_pTOXMark(pMark)
1532 : : , m_pDoc(pDoc)
1533 : : , m_bMainEntry(sal_False)
1534 [ + + ][ + - ]: 268 : , m_nLevel(0)
[ + - ]
1535 : : {
1536 : 134 : }
1537 : :
1538 : 182 : SwTOXType * GetTOXType() const {
1539 : : return static_cast<SwTOXType*>(
1540 : 182 : const_cast<SwModify *>(m_TypeDepend.GetRegisteredIn()));
1541 : : }
1542 : :
1543 : 10 : void DeleteTOXMark()
1544 : : {
1545 : 10 : m_pDoc->DeleteTOXMark(m_pTOXMark); // calls Invalidate() via Modify!
1546 : 10 : m_pTOXMark = 0;
1547 : 10 : }
1548 : :
1549 : : void InsertTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
1550 : : SwXTextCursor const*const pTextCursor);
1551 : :
1552 : 8 : void ReplaceTOXMark(SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam)
1553 : : {
1554 : 8 : m_bInReplaceMark = true;
1555 : 8 : DeleteTOXMark();
1556 : 8 : m_bInReplaceMark = false;
1557 : : try {
1558 [ + - ]: 8 : InsertTOXMark(rTOXType, rMark, rPam, 0);
1559 : 0 : } catch (...) {
1560 : : OSL_FAIL("ReplaceTOXMark() failed!");
1561 [ # # ]: 0 : m_ListenerContainer.Disposing();
1562 : 0 : throw;
1563 : : }
1564 : 8 : }
1565 : :
1566 : : void Invalidate();
1567 : : protected:
1568 : : // SwClient
1569 : : virtual void Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew);
1570 : : };
1571 : :
1572 : 141 : void SwXDocumentIndexMark::Impl::Invalidate()
1573 : : {
1574 [ - + ]: 141 : if (GetRegisteredIn())
1575 : : {
1576 : 0 : const_cast<SwModify*>(GetRegisteredIn())->Remove(this);
1577 [ # # ]: 0 : if (m_TypeDepend.GetRegisteredIn())
1578 : : {
1579 : 0 : const_cast<SwModify*>(m_TypeDepend.GetRegisteredIn())->Remove(
1580 : 0 : &m_TypeDepend);
1581 : : }
1582 : : }
1583 [ + + ]: 141 : if (!m_bInReplaceMark) // #i109983# only dispose on delete, not on replace!
1584 : : {
1585 : 133 : m_ListenerContainer.Disposing();
1586 : : }
1587 : 141 : m_pDoc = 0;
1588 : 141 : m_pTOXMark = 0;
1589 : 141 : }
1590 : :
1591 : 141 : void SwXDocumentIndexMark::Impl::Modify(const SfxPoolItem *pOld, const SfxPoolItem *pNew)
1592 : : {
1593 : 141 : ClientModify(this, pOld, pNew);
1594 : :
1595 [ + - ]: 141 : if (!GetRegisteredIn()) // removed => dispose
1596 : : {
1597 : 141 : Invalidate();
1598 : : }
1599 : 141 : }
1600 : :
1601 : 70 : SwXDocumentIndexMark::SwXDocumentIndexMark(const TOXTypes eToxType)
1602 [ + - ][ + - ]: 70 : : m_pImpl( new SwXDocumentIndexMark::Impl(*this, 0, eToxType, 0, 0) )
1603 : : {
1604 : 70 : }
1605 : :
1606 : 64 : SwXDocumentIndexMark::SwXDocumentIndexMark(SwDoc & rDoc,
1607 : : SwTOXType & rType, SwTOXMark & rMark)
1608 : : : m_pImpl( new SwXDocumentIndexMark::Impl(*this, &rDoc, rType.GetType(),
1609 [ + - ][ + - ]: 64 : &rType, &rMark) )
1610 : : {
1611 : 64 : }
1612 : :
1613 [ + - ]: 134 : SwXDocumentIndexMark::~SwXDocumentIndexMark()
1614 : : {
1615 [ - + ]: 268 : }
1616 : :
1617 : : uno::Reference<text::XDocumentIndexMark>
1618 : 90 : SwXDocumentIndexMark::CreateXDocumentIndexMark(
1619 : : SwDoc & rDoc, SwTOXType & rType, SwTOXMark & rMark)
1620 : : {
1621 : : // re-use existing SwXDocumentIndexMark
1622 : : // NB: xmloff depends on this caching to generate ID from the address!
1623 : : // #i105557#: do not iterate over the registered clients: race condition
1624 : 90 : uno::Reference< text::XDocumentIndexMark > xTOXMark(rMark.GetXTOXMark());
1625 [ + + ]: 90 : if (!xTOXMark.is())
1626 : : {
1627 : : SwXDocumentIndexMark *const pNew =
1628 [ + - ]: 64 : new SwXDocumentIndexMark(rDoc, rType, rMark);
1629 [ + - ][ + - ]: 64 : xTOXMark.set(pNew);
1630 [ + - ]: 64 : rMark.SetXTOXMark(xTOXMark);
1631 : : }
1632 : 90 : return xTOXMark;
1633 : : }
1634 : :
1635 : : namespace
1636 : : {
1637 : : class theSwXDocumentIndexMarkUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSwXDocumentIndexMarkUnoTunnelId > {};
1638 : : }
1639 : :
1640 : 5114 : const uno::Sequence< sal_Int8 > & SwXDocumentIndexMark::getUnoTunnelId()
1641 : : {
1642 : 5114 : return theSwXDocumentIndexMarkUnoTunnelId::get().getSeq();
1643 : : }
1644 : :
1645 : : sal_Int64 SAL_CALL
1646 : 96 : SwXDocumentIndexMark::getSomething(const uno::Sequence< sal_Int8 >& rId)
1647 : : throw (uno::RuntimeException)
1648 : : {
1649 : 96 : return ::sw::UnoTunnelImpl<SwXDocumentIndexMark>(rId, this);
1650 : : }
1651 : :
1652 : : static const sal_Char cBaseMark[] = "com.sun.star.text.BaseIndexMark";
1653 : : static const sal_Char cContentMark[] = "com.sun.star.text.ContentIndexMark";
1654 : : static const sal_Char cIdxMark[] = "com.sun.star.text.DocumentIndexMark";
1655 : : static const sal_Char cIdxMarkAsian[] = "com.sun.star.text.DocumentIndexMarkAsian";
1656 : : static const sal_Char cUserMark[] = "com.sun.star.text.UserIndexMark";
1657 : : static const sal_Char cTextContent[] = "com.sun.star.text.TextContent";
1658 : :
1659 : : OUString SAL_CALL
1660 : 0 : SwXDocumentIndexMark::getImplementationName() throw (uno::RuntimeException)
1661 : : {
1662 : 0 : return C2U("SwXDocumentIndexMark");
1663 : : }
1664 : :
1665 : : sal_Bool SAL_CALL
1666 : 6 : SwXDocumentIndexMark::supportsService(const OUString& rServiceName)
1667 : : throw (uno::RuntimeException)
1668 : : {
1669 [ + - ]: 6 : SolarMutexGuard g;
1670 : :
1671 : 6 : return rServiceName.equalsAscii(cBaseMark)
1672 : 4 : || rServiceName.equalsAscii(cTextContent)
1673 : 2 : || ((m_pImpl->m_eTOXType == TOX_USER)
1674 : 0 : && rServiceName.equalsAscii(cUserMark))
1675 : 2 : || ((m_pImpl->m_eTOXType == TOX_CONTENT)
1676 : 0 : && rServiceName.equalsAscii(cContentMark))
1677 : 2 : || ((m_pImpl->m_eTOXType == TOX_INDEX)
1678 : 2 : && rServiceName.equalsAscii(cIdxMark))
1679 : 0 : || ((m_pImpl->m_eTOXType == TOX_INDEX)
1680 [ # # ][ + - ]: 18 : && rServiceName.equalsAscii(cIdxMarkAsian));
[ + + + +
- + # # -
+ # # + -
- + # # ]
1681 : : }
1682 : :
1683 : : uno::Sequence< OUString > SAL_CALL
1684 : 0 : SwXDocumentIndexMark::getSupportedServiceNames() throw (uno::RuntimeException)
1685 : : {
1686 [ # # ]: 0 : SolarMutexGuard g;
1687 : :
1688 [ # # ]: 0 : const sal_Int32 nCnt = (m_pImpl->m_eTOXType == TOX_INDEX) ? 4 : 3;
1689 [ # # ]: 0 : uno::Sequence< OUString > aRet(nCnt);
1690 [ # # ]: 0 : OUString* pArray = aRet.getArray();
1691 [ # # ]: 0 : pArray[0] = C2U(cBaseMark);
1692 [ # # ]: 0 : pArray[1] = C2U(cTextContent);
1693 [ # # # # ]: 0 : switch (m_pImpl->m_eTOXType)
1694 : : {
1695 : : case TOX_USER:
1696 [ # # ]: 0 : pArray[2] = C2U(cUserMark);
1697 : 0 : break;
1698 : : case TOX_CONTENT:
1699 [ # # ]: 0 : pArray[2] = C2U(cContentMark);
1700 : 0 : break;
1701 : : case TOX_INDEX:
1702 [ # # ]: 0 : pArray[2] = C2U(cIdxMark);
1703 [ # # ]: 0 : pArray[3] = C2U(cIdxMarkAsian);
1704 : 0 : break;
1705 : :
1706 : : default:
1707 : : ;
1708 : : }
1709 [ # # ]: 0 : return aRet;
1710 : : }
1711 : :
1712 : : OUString SAL_CALL
1713 : 0 : SwXDocumentIndexMark::getMarkEntry() throw (uno::RuntimeException)
1714 : : {
1715 [ # # ]: 0 : SolarMutexGuard aGuard;
1716 : :
1717 : 0 : OUString sRet;
1718 : 0 : SwTOXType *const pType = m_pImpl->GetTOXType();
1719 [ # # ][ # # ]: 0 : if (pType && m_pImpl->m_pTOXMark)
[ # # ]
1720 : : {
1721 [ # # ]: 0 : sRet = OUString(m_pImpl->m_pTOXMark->GetAlternativeText());
1722 : : }
1723 [ # # ]: 0 : else if (m_pImpl->m_bIsDescriptor)
1724 : : {
1725 : 0 : sRet = m_pImpl->m_sAltText;
1726 : : }
1727 : : else
1728 : : {
1729 [ # # ]: 0 : throw uno::RuntimeException();
1730 : : }
1731 [ # # ]: 0 : return sRet;
1732 : : }
1733 : :
1734 : : void SAL_CALL
1735 : 0 : SwXDocumentIndexMark::setMarkEntry(const OUString& rIndexEntry)
1736 : : throw (uno::RuntimeException)
1737 : : {
1738 [ # # ]: 0 : SolarMutexGuard aGuard;
1739 : :
1740 : 0 : SwTOXType *const pType = m_pImpl->GetTOXType();
1741 [ # # ][ # # ]: 0 : if (pType && m_pImpl->m_pTOXMark)
[ # # ]
1742 : : {
1743 [ # # ]: 0 : SwTOXMark aMark(*m_pImpl->m_pTOXMark);
1744 [ # # ][ # # ]: 0 : aMark.SetAlternativeText(rIndexEntry);
[ # # ]
1745 : : SwTxtTOXMark const*const pTxtMark =
1746 : 0 : m_pImpl->m_pTOXMark->GetTxtTOXMark();
1747 [ # # ]: 0 : SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
1748 [ # # ]: 0 : aPam.SetMark();
1749 [ # # ]: 0 : if(pTxtMark->GetEnd())
1750 : : {
1751 [ # # ]: 0 : aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
1752 : : }
1753 : : else
1754 [ # # ]: 0 : aPam.GetPoint()->nContent++;
1755 : :
1756 [ # # ][ # # ]: 0 : m_pImpl->ReplaceTOXMark(*pType, aMark, aPam);
[ # # ]
1757 : : }
1758 [ # # ]: 0 : else if (m_pImpl->m_bIsDescriptor)
1759 : : {
1760 : 0 : m_pImpl->m_sAltText = rIndexEntry;
1761 : : }
1762 : : else
1763 : : {
1764 [ # # ]: 0 : throw uno::RuntimeException();
1765 [ # # ]: 0 : }
1766 : 0 : }
1767 : :
1768 : : void SAL_CALL
1769 : 70 : SwXDocumentIndexMark::attach(
1770 : : const uno::Reference< text::XTextRange > & xTextRange)
1771 : : throw (lang::IllegalArgumentException, uno::RuntimeException)
1772 : : {
1773 [ + - ]: 70 : SolarMutexGuard aGuard;
1774 : :
1775 [ - + ]: 70 : if (!m_pImpl->m_bIsDescriptor)
1776 : : {
1777 [ # # ]: 0 : throw uno::RuntimeException();
1778 : : }
1779 : :
1780 [ + - ]: 70 : const uno::Reference<XUnoTunnel> xRangeTunnel(xTextRange, uno::UNO_QUERY);
1781 : : SwXTextRange *const pRange =
1782 [ + - ]: 70 : ::sw::UnoTunnelGetImplementation<SwXTextRange>(xRangeTunnel);
1783 : : OTextCursorHelper *const pCursor =
1784 [ + - ]: 70 : ::sw::UnoTunnelGetImplementation<OTextCursorHelper>(xRangeTunnel);
1785 : : SwDoc *const pDoc =
1786 [ + + ][ + - ]: 70 : (pRange) ? pRange->GetDoc() : ((pCursor) ? pCursor->GetDoc() : 0);
[ + - ][ + - ]
1787 [ - + ]: 70 : if (!pDoc)
1788 : : {
1789 [ # # ]: 0 : throw lang::IllegalArgumentException();
1790 : : }
1791 : :
1792 : 70 : const SwTOXType* pTOXType = 0;
1793 [ + - - ]: 70 : switch (m_pImpl->m_eTOXType)
1794 : : {
1795 : : case TOX_INDEX:
1796 : : case TOX_CONTENT:
1797 [ + - ]: 70 : pTOXType = pDoc->GetTOXType( m_pImpl->m_eTOXType, 0 );
1798 : 70 : break;
1799 : : case TOX_USER:
1800 : : {
1801 [ # # ]: 0 : if (m_pImpl->m_sUserIndexName.isEmpty())
1802 : : {
1803 [ # # ]: 0 : pTOXType = pDoc->GetTOXType( m_pImpl->m_eTOXType, 0 );
1804 : : }
1805 : : else
1806 : : {
1807 : : const sal_uInt16 nCount =
1808 [ # # ]: 0 : pDoc->GetTOXTypeCount(m_pImpl->m_eTOXType);
1809 [ # # ]: 0 : for (sal_uInt16 i = 0; i < nCount; i++)
1810 : : {
1811 : : SwTOXType const*const pTemp =
1812 [ # # ]: 0 : pDoc->GetTOXType( m_pImpl->m_eTOXType, i );
1813 [ # # ]: 0 : if (m_pImpl->m_sUserIndexName ==
1814 [ # # ]: 0 : OUString(pTemp->GetTypeName()))
1815 : : {
1816 : 0 : pTOXType = pTemp;
1817 : 0 : break;
1818 : : }
1819 : : }
1820 [ # # ]: 0 : if (!pTOXType)
1821 : : {
1822 [ # # ][ # # ]: 0 : SwTOXType aUserType(TOX_USER, m_pImpl->m_sUserIndexName);
[ # # ]
1823 [ # # ][ # # ]: 0 : pTOXType = pDoc->InsertTOXType(aUserType);
1824 : : }
1825 : : }
1826 : : }
1827 : 0 : break;
1828 : :
1829 : : default:
1830 : 0 : break;
1831 : : }
1832 [ - + ]: 70 : if (!pTOXType)
1833 : : {
1834 [ # # ]: 0 : throw lang::IllegalArgumentException();
1835 : : }
1836 : :
1837 [ + - ]: 70 : SwUnoInternalPaM aPam(*pDoc);
1838 : : //which must now return sal_True
1839 [ + - ]: 70 : ::sw::XTextRangeToSwPaM(aPam, xTextRange);
1840 [ + - ]: 70 : SwTOXMark aMark (pTOXType);
1841 [ - + ]: 70 : if (!m_pImpl->m_sAltText.isEmpty())
1842 : : {
1843 [ # # ][ # # ]: 0 : aMark.SetAlternativeText(m_pImpl->m_sAltText);
[ # # ]
1844 : : }
1845 [ + - - ]: 70 : switch (m_pImpl->m_eTOXType)
1846 : : {
1847 : : case TOX_INDEX:
1848 [ + + ]: 70 : if (!m_pImpl->m_sPrimaryKey.isEmpty())
1849 : : {
1850 [ + - ][ + - ]: 64 : aMark.SetPrimaryKey(m_pImpl->m_sPrimaryKey);
[ + - ]
1851 : : }
1852 [ - + ]: 70 : if (!m_pImpl->m_sSecondaryKey.isEmpty())
1853 : : {
1854 [ # # ][ # # ]: 0 : aMark.SetSecondaryKey(m_pImpl->m_sSecondaryKey);
[ # # ]
1855 : : }
1856 [ - + ]: 70 : if (!m_pImpl->m_sTextReading.isEmpty())
1857 : : {
1858 [ # # ][ # # ]: 0 : aMark.SetTextReading(m_pImpl->m_sTextReading);
[ # # ]
1859 : : }
1860 [ - + ]: 70 : if (!m_pImpl->m_sPrimaryKeyReading.isEmpty())
1861 : : {
1862 [ # # ][ # # ]: 0 : aMark.SetPrimaryKeyReading(m_pImpl->m_sPrimaryKeyReading);
[ # # ]
1863 : : }
1864 [ - + ]: 70 : if (!m_pImpl->m_sSecondaryKeyReading.isEmpty())
1865 : : {
1866 [ # # ][ # # ]: 0 : aMark.SetSecondaryKeyReading(m_pImpl->m_sSecondaryKeyReading);
[ # # ]
1867 : : }
1868 : 70 : aMark.SetMainEntry(m_pImpl->m_bMainEntry);
1869 : 70 : break;
1870 : : case TOX_USER:
1871 : : case TOX_CONTENT:
1872 [ # # ]: 0 : if (USHRT_MAX != m_pImpl->m_nLevel)
1873 : : {
1874 : 0 : aMark.SetLevel(m_pImpl->m_nLevel+1);
1875 : : }
1876 : 0 : break;
1877 : :
1878 : : default:
1879 : 0 : break;
1880 : : }
1881 : :
1882 : : m_pImpl->InsertTOXMark(*const_cast<SwTOXType *>(pTOXType), aMark, aPam,
1883 [ + + ][ + - ]: 70 : dynamic_cast<SwXTextCursor const*>(pCursor));
1884 : :
1885 [ + - ][ + - ]: 70 : m_pImpl->m_bIsDescriptor = sal_False;
[ + - ]
1886 : 70 : }
1887 : :
1888 : : template<typename T> struct NotContainedIn
1889 : : {
1890 : : ::std::vector<T> const& m_rVector;
1891 : 56 : explicit NotContainedIn(::std::vector<T> const& rVector)
1892 : 56 : : m_rVector(rVector) { }
1893 : 56 : bool operator() (T const& rT) {
1894 : : return ::std::find(m_rVector.begin(), m_rVector.end(), rT)
1895 [ + - ][ + - ]: 56 : == m_rVector.end();
1896 : : }
1897 : : };
1898 : :
1899 : 78 : void SwXDocumentIndexMark::Impl::InsertTOXMark(
1900 : : SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam,
1901 : : SwXTextCursor const*const pTextCursor)
1902 : : {
1903 : 78 : SwDoc *const pDoc( rPam.GetDoc() );
1904 [ + - ]: 78 : UnoActionContext aAction(pDoc);
1905 [ + - ]: 78 : bool bMark = *rPam.GetPoint() != *rPam.GetMark();
1906 : : // n.b.: toxmarks must have either alternative text or an extent
1907 [ + + ][ - + ]: 78 : if (bMark && rMark.GetAlternativeText().Len())
[ - + ]
1908 : : {
1909 [ # # ]: 0 : rPam.Normalize(sal_True);
1910 [ # # ]: 0 : rPam.DeleteMark();
1911 : 0 : bMark = false;
1912 : : }
1913 : : // Marks ohne Alternativtext ohne selektierten Text koennen nicht eingefuegt werden,
1914 : : // deshalb hier ein Leerzeichen - ob das die ideale Loesung ist?
1915 [ + + ][ + + ]: 78 : if (!bMark && !rMark.GetAlternativeText().Len())
[ + + ]
1916 : : {
1917 [ + - ][ + - ]: 42 : rMark.SetAlternativeText( rtl::OUString(' ') );
[ + - ]
1918 : : }
1919 : :
1920 : 78 : const bool bForceExpandHints( (!bMark && pTextCursor)
1921 [ + + ][ + + ]: 78 : ? pTextCursor->IsAtEndOfMeta() : false );
[ + - ]
1922 : : const SetAttrMode nInsertFlags = (bForceExpandHints)
1923 : : ? ( nsSetAttrMode::SETATTR_FORCEHINTEXPAND
1924 : : | nsSetAttrMode::SETATTR_DONTEXPAND)
1925 [ + + ]: 78 : : nsSetAttrMode::SETATTR_DONTEXPAND;
1926 : :
1927 [ + - ]: 78 : ::std::vector<SwTxtAttr *> oldMarks;
1928 [ + + ]: 78 : if (bMark)
1929 : : {
1930 : : oldMarks = rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
1931 [ + - ]: 28 : rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK);
1932 : : }
1933 : :
1934 [ + - ]: 78 : pDoc->InsertPoolItem(rPam, rMark, nInsertFlags);
1935 [ + + ][ + - ]: 78 : if (bMark && *rPam.GetPoint() > *rPam.GetMark())
[ + + ][ + + ]
1936 : : {
1937 : 26 : rPam.Exchange();
1938 : : }
1939 : :
1940 : : // rMark was copied into the document pool; now retrieve real format...
1941 : 78 : SwTxtAttr * pTxtAttr(0);
1942 [ + + ]: 78 : if (bMark)
1943 : : {
1944 : : // #i107672#
1945 : : // ensure that we do not retrieve a different mark at the same position
1946 : : ::std::vector<SwTxtAttr *> const newMarks(
1947 : : rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
1948 [ + - ]: 28 : rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
1949 : : ::std::vector<SwTxtAttr *>::const_iterator const iter(
1950 : : ::std::find_if(newMarks.begin(), newMarks.end(),
1951 [ + - ]: 28 : NotContainedIn<SwTxtAttr *>(oldMarks)));
1952 : : OSL_ASSERT(newMarks.end() != iter);
1953 [ + - ][ + - ]: 28 : if (newMarks.end() != iter)
1954 : : {
1955 : 28 : pTxtAttr = *iter;
1956 : 28 : }
1957 : : }
1958 : : else
1959 : : {
1960 : : pTxtAttr = rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
1961 [ + - ]: 50 : rPam.GetPoint()->nContent.GetIndex()-1, RES_TXTATR_TOXMARK );
1962 : : }
1963 : :
1964 [ - + ]: 78 : if (!pTxtAttr)
1965 : : {
1966 : : throw uno::RuntimeException(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
1967 : : "SwXDocumentIndexMark::InsertTOXMark(): cannot insert attribute")),
1968 [ # # ][ # # ]: 0 : 0);
[ # # ]
1969 : : }
1970 : :
1971 : 78 : m_pDoc = pDoc;
1972 : 78 : m_pTOXMark = & pTxtAttr->GetTOXMark();
1973 [ + - ]: 78 : const_cast<SwTOXMark*>(m_pTOXMark)->Add(this);
1974 [ + - ][ + - ]: 78 : const_cast<SwTOXType &>(rTOXType).Add(& m_TypeDepend);
1975 : 78 : }
1976 : :
1977 : : uno::Reference< text::XTextRange > SAL_CALL
1978 : 2 : SwXDocumentIndexMark::getAnchor() throw (uno::RuntimeException)
1979 : : {
1980 [ + - ]: 2 : SolarMutexGuard aGuard;
1981 : :
1982 : 2 : SwTOXType *const pType = m_pImpl->GetTOXType();
1983 [ - + ][ - + ]: 2 : if (!pType || !m_pImpl->m_pTOXMark)
[ + - ]
1984 : : {
1985 [ # # ]: 0 : throw uno::RuntimeException();
1986 : : }
1987 [ - + ]: 2 : if (!m_pImpl->m_pTOXMark->GetTxtTOXMark())
1988 : : {
1989 [ # # ]: 0 : throw uno::RuntimeException();
1990 : : }
1991 : 2 : const SwTxtTOXMark* pTxtMark = m_pImpl->m_pTOXMark->GetTxtTOXMark();
1992 [ + - ]: 2 : SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
1993 [ + - ]: 2 : aPam.SetMark();
1994 [ - + ]: 2 : if(pTxtMark->GetEnd())
1995 : : {
1996 [ # # ]: 0 : aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
1997 : : }
1998 : : else
1999 : : {
2000 [ + - ]: 2 : aPam.GetPoint()->nContent++;
2001 : : }
2002 : : const uno::Reference< frame::XModel > xModel =
2003 [ + - ]: 2 : m_pImpl->m_pDoc->GetDocShell()->GetBaseModel();
2004 [ + - ]: 2 : const uno::Reference< text::XTextDocument > xTDoc(xModel, uno::UNO_QUERY);
2005 : : const uno::Reference< text::XTextRange > xRet =
2006 [ + - ][ + - ]: 2 : new SwXTextRange(aPam, xTDoc->getText());
[ + - ][ + - ]
[ + - ]
2007 : :
2008 [ + - ][ + - ]: 2 : return xRet;
2009 : : }
2010 : :
2011 : : void SAL_CALL
2012 : 2 : SwXDocumentIndexMark::dispose() throw (uno::RuntimeException)
2013 : : {
2014 [ + - ]: 2 : SolarMutexGuard aGuard;
2015 : :
2016 : 2 : SwTOXType *const pType = m_pImpl->GetTOXType();
2017 [ + - ][ + - ]: 2 : if (pType && m_pImpl->m_pTOXMark)
[ + - ]
2018 : : {
2019 [ + - ]: 2 : m_pImpl->DeleteTOXMark(); // call Invalidate() via modify!
2020 [ + - ]: 2 : }
2021 : 2 : }
2022 : :
2023 : : void SAL_CALL
2024 : 4 : SwXDocumentIndexMark::addEventListener(
2025 : : const uno::Reference< lang::XEventListener > & xListener)
2026 : : throw (uno::RuntimeException)
2027 : : {
2028 [ + - ]: 4 : SolarMutexGuard g;
2029 : :
2030 [ - + ]: 4 : if (!m_pImpl->GetRegisteredIn())
2031 : : {
2032 [ # # ]: 0 : throw uno::RuntimeException();
2033 : : }
2034 [ + - ][ + - ]: 4 : m_pImpl->m_ListenerContainer.AddListener(xListener);
2035 : 4 : }
2036 : :
2037 : : void SAL_CALL
2038 : 2 : SwXDocumentIndexMark::removeEventListener(
2039 : : const uno::Reference< lang::XEventListener > & xListener)
2040 : : throw (uno::RuntimeException)
2041 : : {
2042 [ + - ]: 2 : SolarMutexGuard g;
2043 : :
2044 [ + - ][ - + ]: 4 : if (!m_pImpl->GetRegisteredIn() ||
[ - + ]
2045 [ + - ]: 2 : !m_pImpl->m_ListenerContainer.RemoveListener(xListener))
2046 : : {
2047 [ # # ]: 0 : throw uno::RuntimeException();
2048 [ + - ]: 2 : }
2049 : 2 : }
2050 : :
2051 : : uno::Reference< beans::XPropertySetInfo > SAL_CALL
2052 : 28 : SwXDocumentIndexMark::getPropertySetInfo() throw (uno::RuntimeException)
2053 : : {
2054 [ + - ]: 28 : SolarMutexGuard g;
2055 : :
2056 [ + + ][ + - ]: 42 : static uno::Reference< beans::XPropertySetInfo > xInfos[3];
[ + + ][ + + ]
2057 : 28 : int nPos = 0;
2058 [ + - - - ]: 28 : switch (m_pImpl->m_eTOXType)
2059 : : {
2060 : 28 : case TOX_INDEX: nPos = 0; break;
2061 : 0 : case TOX_CONTENT: nPos = 1; break;
2062 : 0 : case TOX_USER: nPos = 2; break;
2063 : : default:
2064 : : ;
2065 : : }
2066 [ + + ]: 28 : if(!xInfos[nPos].is())
2067 : : {
2068 : : const uno::Reference< beans::XPropertySetInfo > xInfo =
2069 [ + - ]: 2 : m_pImpl->m_rPropSet.getPropertySetInfo();
2070 : : // extend PropertySetInfo!
2071 [ + - ][ + - ]: 2 : const uno::Sequence<beans::Property> aPropSeq = xInfo->getProperties();
2072 : : xInfos[nPos] = new SfxExtItemPropertySetInfo(
2073 : : aSwMapProvider.GetPropertyMapEntries(
2074 : : PROPERTY_MAP_PARAGRAPH_EXTENSIONS),
2075 [ + - ][ + - ]: 2 : aPropSeq );
[ + - ][ + - ]
[ + - ]
2076 : : }
2077 [ + - ]: 28 : return xInfos[nPos];
2078 : : }
2079 : :
2080 : : void SAL_CALL
2081 : 78 : SwXDocumentIndexMark::setPropertyValue(
2082 : : const OUString& rPropertyName, const uno::Any& rValue)
2083 : : throw (beans::UnknownPropertyException, beans::PropertyVetoException,
2084 : : lang::IllegalArgumentException, lang::WrappedTargetException,
2085 : : uno::RuntimeException)
2086 : : {
2087 [ + - ]: 78 : SolarMutexGuard aGuard;
2088 : :
2089 : : SfxItemPropertySimpleEntry const*const pEntry =
2090 [ + - ]: 78 : m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
2091 [ - + ]: 78 : if (!pEntry)
2092 : : {
2093 : : throw beans::UnknownPropertyException(
2094 : : OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
2095 : : + rPropertyName,
2096 [ # # ][ # # ]: 0 : static_cast<cppu::OWeakObject *>(this));
[ # # ]
2097 : : }
2098 [ + + ]: 78 : if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
2099 : : {
2100 : : throw beans::PropertyVetoException(
2101 : : OUString(RTL_CONSTASCII_USTRINGPARAM("Property is read-only: "))
2102 : : + rPropertyName,
2103 [ + - ][ + - ]: 6 : static_cast<cppu::OWeakObject *>(this));
[ + - ]
2104 : : }
2105 : :
2106 : 72 : SwTOXType *const pType = m_pImpl->GetTOXType();
2107 [ + - ][ + + ]: 72 : if (pType && m_pImpl->m_pTOXMark)
[ + + ]
2108 : : {
2109 [ + - ]: 8 : SwTOXMark aMark(*m_pImpl->m_pTOXMark);
2110 [ + - + + : 8 : switch(pEntry->nWID)
+ - - -
- ]
2111 : : {
2112 : : case WID_ALT_TEXT:
2113 [ + - ][ + - ]: 2 : aMark.SetAlternativeText(lcl_AnyToString(rValue));
[ + - ][ + - ]
2114 : 2 : break;
2115 : : case WID_LEVEL:
2116 : : aMark.SetLevel(Min( static_cast<sal_Int8>( MAXLEVEL ),
2117 [ # # ]: 0 : static_cast<sal_Int8>(lcl_AnyToInt16(rValue)+1)));
2118 : 0 : break;
2119 : : case WID_PRIMARY_KEY :
2120 [ + - ][ + - ]: 2 : aMark.SetPrimaryKey(lcl_AnyToString(rValue));
[ + - ][ + - ]
2121 : 2 : break;
2122 : : case WID_SECONDARY_KEY:
2123 [ + - ][ + - ]: 2 : aMark.SetSecondaryKey(lcl_AnyToString(rValue));
[ + - ][ + - ]
2124 : 2 : break;
2125 : : case WID_MAIN_ENTRY:
2126 [ + - ]: 2 : aMark.SetMainEntry(lcl_AnyToBool(rValue));
2127 : 2 : break;
2128 : : case WID_TEXT_READING:
2129 [ # # ][ # # ]: 0 : aMark.SetTextReading(lcl_AnyToString(rValue));
[ # # ][ # # ]
2130 : 0 : break;
2131 : : case WID_PRIMARY_KEY_READING:
2132 [ # # ][ # # ]: 0 : aMark.SetPrimaryKeyReading(lcl_AnyToString(rValue));
[ # # ][ # # ]
2133 : 0 : break;
2134 : : case WID_SECONDARY_KEY_READING:
2135 [ # # ][ # # ]: 0 : aMark.SetSecondaryKeyReading(lcl_AnyToString(rValue));
[ # # ][ # # ]
2136 : 0 : break;
2137 : : }
2138 : : SwTxtTOXMark const*const pTxtMark =
2139 : 8 : m_pImpl->m_pTOXMark->GetTxtTOXMark();
2140 [ + - ]: 8 : SwPaM aPam(pTxtMark->GetTxtNode(), *pTxtMark->GetStart());
2141 [ + - ]: 8 : aPam.SetMark();
2142 [ - + ]: 8 : if(pTxtMark->GetEnd())
2143 : : {
2144 [ # # ]: 0 : aPam.GetPoint()->nContent = *pTxtMark->GetEnd();
2145 : : }
2146 : : else
2147 : : {
2148 [ + - ]: 8 : aPam.GetPoint()->nContent++;
2149 : : }
2150 : :
2151 [ + - ][ + - ]: 8 : m_pImpl->ReplaceTOXMark(*pType, aMark, aPam);
[ + - ]
2152 : : }
2153 [ + - ]: 64 : else if (m_pImpl->m_bIsDescriptor)
2154 : : {
2155 [ - - + - : 64 : switch(pEntry->nWID)
- - - - -
- ]
2156 : : {
2157 : : case WID_ALT_TEXT:
2158 [ # # ]: 0 : m_pImpl->m_sAltText = lcl_AnyToString(rValue);
2159 : 0 : break;
2160 : : case WID_LEVEL:
2161 : : {
2162 [ # # ]: 0 : const sal_Int16 nVal = lcl_AnyToInt16(rValue);
2163 [ # # ][ # # ]: 0 : if(nVal >= 0 && nVal < MAXLEVEL)
2164 : : {
2165 : 0 : m_pImpl->m_nLevel = nVal;
2166 : : }
2167 : : else
2168 : : {
2169 [ # # ]: 0 : throw lang::IllegalArgumentException();
2170 : : }
2171 : : }
2172 : 0 : break;
2173 : : case WID_PRIMARY_KEY:
2174 [ + - ]: 64 : m_pImpl->m_sPrimaryKey = lcl_AnyToString(rValue);
2175 : 64 : break;
2176 : : case WID_SECONDARY_KEY:
2177 [ # # ]: 0 : m_pImpl->m_sSecondaryKey = lcl_AnyToString(rValue);
2178 : 0 : break;
2179 : : case WID_TEXT_READING:
2180 [ # # ]: 0 : m_pImpl->m_sTextReading = lcl_AnyToString(rValue);
2181 : 0 : break;
2182 : : case WID_PRIMARY_KEY_READING:
2183 [ # # ]: 0 : m_pImpl->m_sPrimaryKeyReading = lcl_AnyToString(rValue);
2184 : 0 : break;
2185 : : case WID_SECONDARY_KEY_READING:
2186 [ # # ]: 0 : m_pImpl->m_sSecondaryKeyReading = lcl_AnyToString(rValue);
2187 : 0 : break;
2188 : : case WID_USER_IDX_NAME:
2189 : : {
2190 [ # # ]: 0 : OUString sTmp(lcl_AnyToString(rValue));
2191 [ # # ]: 0 : lcl_ConvertTOUNameToUserName(sTmp);
2192 : 0 : m_pImpl->m_sUserIndexName = sTmp;
2193 : : }
2194 : 0 : break;
2195 : : case WID_MAIN_ENTRY:
2196 [ # # ]: 0 : m_pImpl->m_bMainEntry = lcl_AnyToBool(rValue);
2197 : 64 : break;
2198 : : }
2199 : : }
2200 : : else
2201 : : {
2202 [ # # ]: 0 : throw uno::RuntimeException();
2203 [ + - ]: 78 : }
2204 : 72 : }
2205 : :
2206 : : uno::Any SAL_CALL
2207 : 118 : SwXDocumentIndexMark::getPropertyValue(const OUString& rPropertyName)
2208 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
2209 : : uno::RuntimeException)
2210 : : {
2211 [ + - ]: 118 : SolarMutexGuard aGuard;
2212 : :
2213 : 118 : uno::Any aRet;
2214 : : SfxItemPropertySimpleEntry const*const pEntry =
2215 [ + - ]: 118 : m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
2216 [ - + ]: 118 : if (!pEntry)
2217 : : {
2218 : : throw beans::UnknownPropertyException(
2219 : : OUString(RTL_CONSTASCII_USTRINGPARAM("Unknown property: "))
2220 : : + rPropertyName,
2221 [ # # ][ # # ]: 0 : static_cast<cppu::OWeakObject *>(this));
[ # # ]
2222 : : }
2223 [ + - ][ + + ]: 118 : if (::sw::GetDefaultTextContentValue(aRet, rPropertyName, pEntry->nWID))
2224 : : {
2225 : : return aRet;
2226 : : }
2227 : :
2228 : 106 : SwTOXType *const pType = m_pImpl->GetTOXType();
2229 [ + - ][ + - ]: 106 : if (pType && m_pImpl->m_pTOXMark)
[ + - ]
2230 : : {
2231 [ + - + + : 106 : switch(pEntry->nWID)
- - - - +
- ]
2232 : : {
2233 : : case WID_ALT_TEXT:
2234 [ + - ][ + - ]: 4 : aRet <<= OUString(m_pImpl->m_pTOXMark->GetAlternativeText());
2235 : 4 : break;
2236 : : case WID_LEVEL:
2237 : : aRet <<= static_cast<sal_Int16>(
2238 [ # # ]: 0 : m_pImpl->m_pTOXMark->GetLevel() - 1);
2239 : 0 : break;
2240 : : case WID_PRIMARY_KEY :
2241 [ + - ][ + - ]: 94 : aRet <<= OUString(m_pImpl->m_pTOXMark->GetPrimaryKey());
2242 : 94 : break;
2243 : : case WID_SECONDARY_KEY:
2244 [ + - ][ + - ]: 4 : aRet <<= OUString(m_pImpl->m_pTOXMark->GetSecondaryKey());
2245 : 4 : break;
2246 : : case WID_TEXT_READING:
2247 [ # # ][ # # ]: 0 : aRet <<= OUString(m_pImpl->m_pTOXMark->GetTextReading());
2248 : 0 : break;
2249 : : case WID_PRIMARY_KEY_READING:
2250 [ # # ][ # # ]: 0 : aRet <<= OUString(m_pImpl->m_pTOXMark->GetPrimaryKeyReading());
2251 : 0 : break;
2252 : : case WID_SECONDARY_KEY_READING:
2253 : : aRet <<= OUString(
2254 [ # # ][ # # ]: 0 : m_pImpl->m_pTOXMark->GetSecondaryKeyReading());
2255 : 0 : break;
2256 : : case WID_USER_IDX_NAME :
2257 : : {
2258 [ # # ]: 0 : OUString sTmp(pType->GetTypeName());
2259 [ # # ]: 0 : lcl_ConvertTOUNameToProgrammaticName(sTmp);
2260 [ # # ]: 0 : aRet <<= sTmp;
2261 : : }
2262 : 0 : break;
2263 : : case WID_MAIN_ENTRY:
2264 : : {
2265 : 4 : const sal_Bool bTemp = m_pImpl->m_pTOXMark->IsMainEntry();
2266 [ + - ]: 4 : aRet <<= bTemp;
2267 : : }
2268 : 106 : break;
2269 : : }
2270 : : }
2271 [ # # ]: 0 : else if (m_pImpl->m_bIsDescriptor)
2272 : : {
2273 [ # # # # : 0 : switch(pEntry->nWID)
# # # # #
# ]
2274 : : {
2275 : : case WID_ALT_TEXT:
2276 [ # # ]: 0 : aRet <<= m_pImpl->m_sAltText;
2277 : 0 : break;
2278 : : case WID_LEVEL:
2279 [ # # ]: 0 : aRet <<= static_cast<sal_Int16>(m_pImpl->m_nLevel);
2280 : 0 : break;
2281 : : case WID_PRIMARY_KEY:
2282 [ # # ]: 0 : aRet <<= m_pImpl->m_sPrimaryKey;
2283 : 0 : break;
2284 : : case WID_SECONDARY_KEY:
2285 [ # # ]: 0 : aRet <<= m_pImpl->m_sSecondaryKey;
2286 : 0 : break;
2287 : : case WID_TEXT_READING:
2288 [ # # ]: 0 : aRet <<= m_pImpl->m_sTextReading;
2289 : 0 : break;
2290 : : case WID_PRIMARY_KEY_READING:
2291 [ # # ]: 0 : aRet <<= m_pImpl->m_sPrimaryKeyReading;
2292 : 0 : break;
2293 : : case WID_SECONDARY_KEY_READING:
2294 [ # # ]: 0 : aRet <<= m_pImpl->m_sSecondaryKeyReading;
2295 : 0 : break;
2296 : : case WID_USER_IDX_NAME :
2297 [ # # ]: 0 : aRet <<= m_pImpl->m_sUserIndexName;
2298 : 0 : break;
2299 : : case WID_MAIN_ENTRY:
2300 : : {
2301 [ # # ]: 0 : aRet <<= static_cast<sal_Bool>(m_pImpl->m_bMainEntry);
2302 : : }
2303 : 0 : break;
2304 : : }
2305 : : }
2306 : : else
2307 : : {
2308 [ # # ]: 0 : throw uno::RuntimeException();
2309 : : }
2310 [ + - ]: 118 : return aRet;
2311 : : }
2312 : :
2313 : : void SAL_CALL
2314 : 0 : SwXDocumentIndexMark::addPropertyChangeListener(
2315 : : const ::rtl::OUString& /*rPropertyName*/,
2316 : : const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
2317 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
2318 : : uno::RuntimeException)
2319 : : {
2320 : : OSL_FAIL("SwXDocumentIndexMark::addPropertyChangeListener(): not implemented");
2321 : 0 : }
2322 : :
2323 : : void SAL_CALL
2324 : 0 : SwXDocumentIndexMark::removePropertyChangeListener(
2325 : : const ::rtl::OUString& /*rPropertyName*/,
2326 : : const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
2327 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
2328 : : uno::RuntimeException)
2329 : : {
2330 : : OSL_FAIL("SwXDocumentIndexMark::removePropertyChangeListener(): not implemented");
2331 : 0 : }
2332 : :
2333 : : void SAL_CALL
2334 : 0 : SwXDocumentIndexMark::addVetoableChangeListener(
2335 : : const ::rtl::OUString& /*rPropertyName*/,
2336 : : const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
2337 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
2338 : : uno::RuntimeException)
2339 : : {
2340 : : OSL_FAIL("SwXDocumentIndexMark::addVetoableChangeListener(): not implemented");
2341 : 0 : }
2342 : :
2343 : : void SAL_CALL
2344 : 0 : SwXDocumentIndexMark::removeVetoableChangeListener(
2345 : : const ::rtl::OUString& /*rPropertyName*/,
2346 : : const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
2347 : : throw (beans::UnknownPropertyException, lang::WrappedTargetException,
2348 : : uno::RuntimeException)
2349 : : {
2350 : : OSL_FAIL("SwXDocumentIndexMark::removeVetoableChangeListener(): not implemented");
2351 : 0 : }
2352 : :
2353 : : /******************************************************************
2354 : : * SwXDocumentIndexes
2355 : : ******************************************************************/
2356 : 481 : SwXDocumentIndexes::SwXDocumentIndexes(SwDoc *const _pDoc)
2357 : 481 : : SwUnoCollection(_pDoc)
2358 : : {
2359 : 481 : }
2360 : :
2361 : 409 : SwXDocumentIndexes::~SwXDocumentIndexes()
2362 : : {
2363 [ - + ]: 818 : }
2364 : :
2365 : : OUString SAL_CALL
2366 : 0 : SwXDocumentIndexes::getImplementationName() throw (uno::RuntimeException)
2367 : : {
2368 : 0 : return C2U("SwXDocumentIndexes");
2369 : : }
2370 : :
2371 : : static char const*const g_ServicesDocumentIndexes[] =
2372 : : {
2373 : : "com.sun.star.text.DocumentIndexes",
2374 : : };
2375 : :
2376 : : sal_Bool SAL_CALL
2377 : 0 : SwXDocumentIndexes::supportsService(const OUString& rServiceName)
2378 : : throw (uno::RuntimeException)
2379 : : {
2380 : : return ::sw::SupportsServiceImpl(
2381 : : SAL_N_ELEMENTS(g_ServicesDocumentIndexes),
2382 : 0 : g_ServicesDocumentIndexes, rServiceName);
2383 : : }
2384 : :
2385 : : uno::Sequence< OUString > SAL_CALL
2386 : 0 : SwXDocumentIndexes::getSupportedServiceNames() throw (uno::RuntimeException)
2387 : : {
2388 : : return ::sw::GetSupportedServiceNamesImpl(
2389 : 0 : SAL_N_ELEMENTS(g_ServicesDocumentIndexes), g_ServicesDocumentIndexes);
2390 : : }
2391 : :
2392 : : sal_Int32 SAL_CALL
2393 : 509 : SwXDocumentIndexes::getCount() throw (uno::RuntimeException)
2394 : : {
2395 [ + - ]: 509 : SolarMutexGuard aGuard;
2396 : :
2397 [ - + ]: 509 : if(!IsValid())
2398 [ # # ]: 0 : throw uno::RuntimeException();
2399 : :
2400 : 509 : sal_uInt32 nRet = 0;
2401 : 509 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
2402 [ + + ]: 522 : for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
2403 : : {
2404 [ + - ]: 13 : const SwSection* pSect = rFmts[ n ]->GetSection();
2405 [ + + ][ + - ]: 19 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ + + ]
2406 [ + - ]: 6 : pSect->GetFmt()->GetSectionNode() )
2407 : : {
2408 : 6 : ++nRet;
2409 : : }
2410 : : }
2411 [ + - ]: 509 : return nRet;
2412 : : }
2413 : :
2414 : : uno::Any SAL_CALL
2415 : 8 : SwXDocumentIndexes::getByIndex(sal_Int32 nIndex)
2416 : : throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
2417 : : uno::RuntimeException)
2418 : : {
2419 [ + - ]: 8 : SolarMutexGuard aGuard;
2420 : :
2421 [ - + ]: 8 : if(!IsValid())
2422 [ # # ]: 0 : throw uno::RuntimeException();
2423 : :
2424 : 8 : sal_Int32 nIdx = 0;
2425 : :
2426 : 8 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
2427 [ + + ]: 10 : for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
2428 : : {
2429 [ + - ]: 8 : const SwSection* pSect = rFmts[ n ]->GetSection();
2430 [ + - ][ + - ]: 16 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ + + ][ + + ]
2431 [ + - ]: 8 : pSect->GetFmt()->GetSectionNode() &&
2432 : : nIdx++ == nIndex )
2433 : : {
2434 : : const uno::Reference< text::XDocumentIndex > xTmp =
2435 : : SwXDocumentIndex::CreateXDocumentIndex(
2436 [ + - ][ + - ]: 6 : *GetDoc(), static_cast<SwTOXBaseSection const&>(*pSect));
2437 : 6 : uno::Any aRet;
2438 [ + - ]: 6 : aRet <<= xTmp;
2439 : 12 : return aRet;
2440 : : }
2441 : : }
2442 : :
2443 [ + - ][ + - ]: 8 : throw lang::IndexOutOfBoundsException();
2444 : : }
2445 : :
2446 : : uno::Any SAL_CALL
2447 : 32 : SwXDocumentIndexes::getByName(const OUString& rName)
2448 : : throw (container::NoSuchElementException, lang::WrappedTargetException,
2449 : : uno::RuntimeException)
2450 : : {
2451 [ + - ]: 32 : SolarMutexGuard aGuard;
2452 : :
2453 [ - + ]: 32 : if(!IsValid())
2454 [ # # ]: 0 : throw uno::RuntimeException();
2455 : :
2456 [ + - ]: 32 : String sToFind(rName);
2457 : 32 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
2458 [ + + ]: 258 : for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
2459 : : {
2460 [ + - ]: 256 : const SwSection* pSect = rFmts[ n ]->GetSection();
2461 [ + + ][ + - ]: 488 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ + + ][ + + ]
2462 [ + - ]: 116 : pSect->GetFmt()->GetSectionNode() &&
2463 [ + - ]: 116 : (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()
2464 [ + - ]: 116 : == sToFind))
2465 : : {
2466 : : const uno::Reference< text::XDocumentIndex > xTmp =
2467 : : SwXDocumentIndex::CreateXDocumentIndex(
2468 [ + - ][ + - ]: 30 : *GetDoc(), static_cast<SwTOXBaseSection const&>(*pSect));
2469 : 30 : uno::Any aRet;
2470 [ + - ]: 30 : aRet <<= xTmp;
2471 : 60 : return aRet;
2472 : : }
2473 : : }
2474 [ + - ][ + - ]: 32 : throw container::NoSuchElementException();
[ + - ]
2475 : : }
2476 : :
2477 : : uno::Sequence< OUString > SAL_CALL
2478 : 2 : SwXDocumentIndexes::getElementNames() throw (uno::RuntimeException)
2479 : : {
2480 [ + - ]: 2 : SolarMutexGuard aGuard;
2481 : :
2482 [ - + ]: 2 : if(!IsValid())
2483 [ # # ]: 0 : throw uno::RuntimeException();
2484 : :
2485 : 2 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
2486 : 2 : sal_Int32 nCount = 0;
2487 : : sal_uInt16 n;
2488 [ + + ]: 4 : for( n = 0; n < rFmts.size(); ++n )
2489 : : {
2490 [ + - ]: 2 : SwSection const*const pSect = rFmts[ n ]->GetSection();
2491 [ + - ][ + - ]: 4 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ + - ]
2492 [ + - ]: 2 : pSect->GetFmt()->GetSectionNode() )
2493 : : {
2494 : 2 : ++nCount;
2495 : : }
2496 : : }
2497 : :
2498 [ + - ]: 2 : uno::Sequence< OUString > aRet(nCount);
2499 [ + - ]: 2 : OUString* pArray = aRet.getArray();
2500 : : sal_uInt16 nCnt;
2501 [ + + ]: 4 : for( n = 0, nCnt = 0; n < rFmts.size(); ++n )
2502 : : {
2503 [ + - ]: 2 : SwSection const*const pSect = rFmts[ n ]->GetSection();
2504 [ + - ][ + - ]: 4 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ + - ]
2505 [ + - ]: 2 : pSect->GetFmt()->GetSectionNode())
2506 : : {
2507 : : pArray[nCnt++] = OUString(
2508 [ + - ][ + - ]: 2 : static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName());
2509 : : }
2510 : : }
2511 [ + - ]: 2 : return aRet;
2512 : : }
2513 : :
2514 : : sal_Bool SAL_CALL
2515 : 4 : SwXDocumentIndexes::hasByName(const OUString& rName)
2516 : : throw (uno::RuntimeException)
2517 : : {
2518 [ + - ]: 4 : SolarMutexGuard aGuard;
2519 : :
2520 [ - + ]: 4 : if(!IsValid())
2521 [ # # ]: 0 : throw uno::RuntimeException();
2522 : :
2523 [ + - ]: 4 : String sToFind(rName);
2524 : 4 : const SwSectionFmts& rFmts = GetDoc()->GetSections();
2525 [ + + ]: 6 : for( sal_uInt16 n = 0; n < rFmts.size(); ++n )
2526 : : {
2527 [ + - ]: 4 : SwSection const*const pSect = rFmts[ n ]->GetSection();
2528 [ + - ][ + - ]: 8 : if( TOX_CONTENT_SECTION == pSect->GetType() &&
[ + - ]
2529 [ + - ]: 4 : pSect->GetFmt()->GetSectionNode())
2530 : : {
2531 [ + - ][ + + ]: 8 : if (static_cast<SwTOXBaseSection const*>(pSect)->GetTOXName()
2532 [ + - ]: 4 : == sToFind)
2533 : : {
2534 : 2 : return sal_True;
2535 : : }
2536 : : }
2537 : : }
2538 [ + - ][ + - ]: 4 : return sal_False;
2539 : : }
2540 : :
2541 : : uno::Type SAL_CALL
2542 : 2 : SwXDocumentIndexes::getElementType() throw (uno::RuntimeException)
2543 : : {
2544 : 2 : return text::XDocumentIndex::static_type();
2545 : : }
2546 : :
2547 : : sal_Bool SAL_CALL
2548 : 2 : SwXDocumentIndexes::hasElements() throw (uno::RuntimeException)
2549 : : {
2550 : 2 : return 0 != getCount();
2551 : : }
2552 : :
2553 : : /******************************************************************
2554 : : * SwXDocumentIndex::StyleAccess_Impl
2555 : : ******************************************************************/
2556 : 4 : SwXDocumentIndex::StyleAccess_Impl::StyleAccess_Impl(
2557 : : SwXDocumentIndex& rParentIdx)
2558 : 4 : : m_xParent(&rParentIdx)
2559 : : {
2560 : 4 : }
2561 : :
2562 : 4 : SwXDocumentIndex::StyleAccess_Impl::~StyleAccess_Impl()
2563 : : {
2564 [ - + ]: 8 : }
2565 : :
2566 : : OUString SAL_CALL
2567 : 0 : SwXDocumentIndex::StyleAccess_Impl::getImplementationName()
2568 : : throw (uno::RuntimeException)
2569 : : {
2570 : 0 : return C2U("SwXDocumentIndex::StyleAccess_Impl");
2571 : : }
2572 : :
2573 : : static char const*const g_ServicesIndexStyleAccess[] =
2574 : : {
2575 : : "com.sun.star.text.DocumentIndexParagraphStyles",
2576 : : };
2577 : :
2578 : : sal_Bool SAL_CALL
2579 : 0 : SwXDocumentIndex::StyleAccess_Impl::supportsService(
2580 : : const OUString& rServiceName)
2581 : : throw (uno::RuntimeException)
2582 : : {
2583 : : return ::sw::SupportsServiceImpl(
2584 : : SAL_N_ELEMENTS(g_ServicesIndexStyleAccess),
2585 : 0 : g_ServicesIndexStyleAccess, rServiceName);
2586 : : }
2587 : :
2588 : : uno::Sequence< OUString > SAL_CALL
2589 : 0 : SwXDocumentIndex::StyleAccess_Impl::getSupportedServiceNames()
2590 : : throw (uno::RuntimeException)
2591 : : {
2592 : : return ::sw::GetSupportedServiceNamesImpl(
2593 : : SAL_N_ELEMENTS(g_ServicesIndexStyleAccess),
2594 : 0 : g_ServicesIndexStyleAccess);
2595 : : }
2596 : :
2597 : : void SAL_CALL
2598 : 0 : SwXDocumentIndex::StyleAccess_Impl::replaceByIndex(
2599 : : sal_Int32 nIndex, const uno::Any& rElement)
2600 : : throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
2601 : : lang::WrappedTargetException, uno::RuntimeException)
2602 : : {
2603 [ # # ]: 0 : SolarMutexGuard aGuard;
2604 : :
2605 [ # # ][ # # ]: 0 : if(nIndex < 0 || nIndex > MAXLEVEL)
2606 : : {
2607 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2608 : : }
2609 : :
2610 [ # # ]: 0 : SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
2611 : :
2612 [ # # ]: 0 : uno::Sequence<OUString> aSeq;
2613 [ # # ][ # # ]: 0 : if(!(rElement >>= aSeq))
2614 : : {
2615 [ # # ]: 0 : throw lang::IllegalArgumentException();
2616 : : }
2617 : :
2618 : 0 : const sal_Int32 nStyles = aSeq.getLength();
2619 : 0 : const OUString* pStyles = aSeq.getConstArray();
2620 [ # # ]: 0 : String sSetStyles;
2621 [ # # ]: 0 : String aString;
2622 [ # # ]: 0 : for(sal_Int32 i = 0; i < nStyles; i++)
2623 : : {
2624 [ # # ]: 0 : if(i)
2625 : : {
2626 [ # # ]: 0 : sSetStyles += TOX_STYLE_DELIMITER;
2627 : : }
2628 : 0 : SwStyleNameMapper::FillUIName(pStyles[i], aString,
2629 [ # # ][ # # ]: 0 : nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True);
[ # # ]
2630 [ # # ]: 0 : sSetStyles += aString;
2631 : : }
2632 [ # # ][ # # ]: 0 : rTOXBase.SetStyleNames(sSetStyles, static_cast<sal_uInt16>(nIndex));
[ # # ][ # # ]
[ # # ]
2633 : 0 : }
2634 : :
2635 : : sal_Int32 SAL_CALL
2636 : 4 : SwXDocumentIndex::StyleAccess_Impl::getCount() throw (uno::RuntimeException)
2637 : : {
2638 : 4 : return MAXLEVEL;
2639 : : }
2640 : :
2641 : : uno::Any SAL_CALL
2642 : 40 : SwXDocumentIndex::StyleAccess_Impl::getByIndex(sal_Int32 nIndex)
2643 : : throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
2644 : : uno::RuntimeException)
2645 : : {
2646 [ + - ]: 40 : SolarMutexGuard aGuard;
2647 : :
2648 [ + - ][ - + ]: 40 : if(nIndex < 0 || nIndex > MAXLEVEL)
2649 : : {
2650 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2651 : : }
2652 : :
2653 [ + - ]: 40 : SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
2654 : :
2655 : : const String& rStyles =
2656 : 40 : rTOXBase.GetStyleNames(static_cast<sal_uInt16>(nIndex));
2657 [ + - ][ + - ]: 40 : const sal_uInt16 nStyles = comphelper::string::getTokenCount(rStyles, TOX_STYLE_DELIMITER);
2658 [ + - ]: 40 : uno::Sequence<OUString> aStyles(nStyles);
2659 [ + - ]: 40 : OUString* pStyles = aStyles.getArray();
2660 [ + - ]: 40 : String aString;
2661 [ - + ]: 40 : for(sal_uInt16 i = 0; i < nStyles; i++)
2662 : : {
2663 : : SwStyleNameMapper::FillProgName(
2664 : : rStyles.GetToken(i, TOX_STYLE_DELIMITER),
2665 : : aString,
2666 : : nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL,
2667 [ # # ][ # # ]: 0 : sal_True);
[ # # ]
2668 [ # # ]: 0 : pStyles[i] = OUString( aString );
2669 : : }
2670 [ + - ]: 40 : uno::Any aRet(&aStyles, ::getCppuType((uno::Sequence<OUString>*)0));
2671 [ + - ][ + - ]: 40 : return aRet;
[ + - ]
2672 : : }
2673 : :
2674 : : uno::Type SAL_CALL
2675 : 0 : SwXDocumentIndex::StyleAccess_Impl::getElementType()
2676 : : throw (uno::RuntimeException)
2677 : : {
2678 : 0 : return ::getCppuType((uno::Sequence<OUString>*)0);
2679 : : }
2680 : :
2681 : : sal_Bool SAL_CALL
2682 : 0 : SwXDocumentIndex::StyleAccess_Impl::hasElements() throw (uno::RuntimeException)
2683 : : {
2684 : 0 : return sal_True;
2685 : : }
2686 : :
2687 : : /******************************************************************
2688 : : * SwXDocumentIndex::TokenAccess_Impl
2689 : : ******************************************************************/
2690 : 212 : SwXDocumentIndex::TokenAccess_Impl::TokenAccess_Impl(
2691 : : SwXDocumentIndex& rParentIdx)
2692 : 212 : : m_xParent(&rParentIdx)
2693 : : {
2694 : 212 : }
2695 : :
2696 : 212 : SwXDocumentIndex::TokenAccess_Impl::~TokenAccess_Impl()
2697 : : {
2698 [ - + ]: 424 : }
2699 : :
2700 : : OUString SAL_CALL
2701 : 0 : SwXDocumentIndex::TokenAccess_Impl::getImplementationName()
2702 : : throw (uno::RuntimeException)
2703 : : {
2704 : 0 : return C2U("SwXDocumentIndex::TokenAccess_Impl");
2705 : : }
2706 : :
2707 : : static char const*const g_ServicesIndexTokenAccess[] =
2708 : : {
2709 : : "com.sun.star.text.DocumentIndexLevelFormat",
2710 : : };
2711 : :
2712 : : sal_Bool SAL_CALL
2713 : 0 : SwXDocumentIndex::TokenAccess_Impl::supportsService(
2714 : : const OUString& rServiceName)
2715 : : throw (uno::RuntimeException)
2716 : : {
2717 : : return ::sw::SupportsServiceImpl(
2718 : : SAL_N_ELEMENTS(g_ServicesIndexTokenAccess),
2719 : 0 : g_ServicesIndexTokenAccess, rServiceName);
2720 : : }
2721 : :
2722 : : uno::Sequence< OUString > SAL_CALL
2723 : 0 : SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames()
2724 : : throw (uno::RuntimeException)
2725 : : {
2726 : : return ::sw::GetSupportedServiceNamesImpl(
2727 : : SAL_N_ELEMENTS(g_ServicesIndexTokenAccess),
2728 : 0 : g_ServicesIndexTokenAccess);
2729 : : }
2730 : :
2731 : : struct TokenType {
2732 : : const char *pName;
2733 : : enum FormTokenType eTokenType;
2734 : : };
2735 : :
2736 : : static const struct TokenType g_TokenTypes[] =
2737 : : {
2738 : : { "TokenEntryNumber", TOKEN_ENTRY_NO },
2739 : : { "TokenEntryText", TOKEN_ENTRY_TEXT },
2740 : : { "TokenTabStop", TOKEN_TAB_STOP },
2741 : : { "TokenText", TOKEN_TEXT },
2742 : : { "TokenPageNumber", TOKEN_PAGE_NUMS },
2743 : : { "TokenChapterInfo", TOKEN_CHAPTER_INFO },
2744 : : { "TokenHyperlinkStart", TOKEN_LINK_START },
2745 : : { "TokenHyperlinkEnd", TOKEN_LINK_END },
2746 : : { "TokenBibliographyDataField", TOKEN_AUTHORITY },
2747 : : { 0, static_cast<enum FormTokenType>(0) }
2748 : : };
2749 : :
2750 : : void SAL_CALL
2751 : 198 : SwXDocumentIndex::TokenAccess_Impl::replaceByIndex(
2752 : : sal_Int32 nIndex, const uno::Any& rElement)
2753 : : throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException,
2754 : : lang::WrappedTargetException, uno::RuntimeException)
2755 : : {
2756 [ + - ]: 198 : SolarMutexGuard aGuard;
2757 : :
2758 [ + - ]: 198 : SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
2759 : :
2760 [ + - ][ + - ]: 198 : if ((nIndex < 0) || (nIndex > rTOXBase.GetTOXForm().GetFormMax()))
[ - + ][ - + ]
2761 : : {
2762 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2763 : : }
2764 : :
2765 [ + - ]: 198 : uno::Sequence<beans::PropertyValues> aSeq;
2766 [ + - ][ - + ]: 198 : if(!(rElement >>= aSeq))
2767 : : {
2768 [ # # ]: 0 : throw lang::IllegalArgumentException();
2769 : : }
2770 : :
2771 [ + - ]: 198 : String sPattern;
2772 : 198 : const sal_Int32 nTokens = aSeq.getLength();
2773 : 198 : const beans::PropertyValues* pTokens = aSeq.getConstArray();
2774 [ + + ]: 1180 : for(sal_Int32 i = 0; i < nTokens; i++)
2775 : : {
2776 : 982 : const beans::PropertyValue* pProperties = pTokens[i].getConstArray();
2777 : 982 : const sal_Int32 nProperties = pTokens[i].getLength();
2778 : : //create an invalid token
2779 [ + - ]: 982 : SwFormToken aToken(TOKEN_END);
2780 [ + + ]: 2902 : for(sal_Int32 j = 0; j < nProperties; j++)
2781 : : {
2782 [ + + ]: 1920 : if ( pProperties[j].Name == "TokenType" )
2783 : : {
2784 : : const OUString sTokenType =
2785 [ + - ]: 982 : lcl_AnyToString(pProperties[j].Value);
2786 [ + - ]: 5368 : for (TokenType const* pTokenType = g_TokenTypes;
2787 : : pTokenType->pName; ++pTokenType)
2788 : : {
2789 [ + + ]: 5368 : if (sTokenType.equalsAscii(pTokenType->pName))
2790 : : {
2791 : 982 : aToken.eTokenType = pTokenType->eTokenType;
2792 : 982 : break;
2793 : : }
2794 : 982 : }
2795 : : }
2796 [ - + ]: 938 : else if ( pProperties[j].Name == "CharacterStyleName" )
2797 : : {
2798 [ # # ]: 0 : String sCharStyleName;
2799 : : SwStyleNameMapper::FillUIName(
2800 : 0 : lcl_AnyToString(pProperties[j].Value),
2801 : : sCharStyleName,
2802 : : nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
2803 [ # # ][ # # ]: 0 : sal_True);
[ # # ][ # # ]
2804 [ # # ]: 0 : aToken.sCharStyleName = sCharStyleName;
2805 : : aToken.nPoolId = SwStyleNameMapper::GetPoolIdFromUIName (
2806 [ # # ][ # # ]: 0 : sCharStyleName, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT );
2807 : : }
2808 [ + + ]: 938 : else if ( pProperties[j].Name == "TabStopRightAligned" )
2809 : : {
2810 [ + - ]: 104 : const sal_Bool bRight = lcl_AnyToBool(pProperties[j].Value);
2811 : : aToken.eTabAlign = bRight ?
2812 [ + - ]: 104 : SVX_TAB_ADJUST_END : SVX_TAB_ADJUST_LEFT;
2813 : : }
2814 [ - + ]: 834 : else if ( pProperties[j].Name == "TabStopPosition" )
2815 : : {
2816 : 0 : sal_Int32 nPosition = 0;
2817 [ # # ]: 0 : if (!(pProperties[j].Value >>= nPosition))
2818 : : {
2819 [ # # ]: 0 : throw lang::IllegalArgumentException();
2820 : : }
2821 [ # # ]: 0 : nPosition = MM100_TO_TWIP(nPosition);
2822 [ # # ]: 0 : if(nPosition < 0)
2823 : : {
2824 [ # # ]: 0 : throw lang::IllegalArgumentException();
2825 : : }
2826 : 0 : aToken.nTabStopPosition = nPosition;
2827 : : }
2828 [ + + ]: 834 : else if ( pProperties[j].Name == "TabStopFillCharacter" )
2829 : : {
2830 : : const OUString sFillChar =
2831 [ + - ]: 104 : lcl_AnyToString(pProperties[j].Value);
2832 [ - + ]: 104 : if (sFillChar.getLength() > 1)
2833 : : {
2834 [ # # ]: 0 : throw lang::IllegalArgumentException();
2835 : : }
2836 : : aToken.cTabFillChar =
2837 [ - + ]: 104 : sFillChar.isEmpty() ? ' ' : sFillChar[0];
2838 : : }
2839 [ + + ]: 730 : else if ( pProperties[j].Name == "Text" )
2840 : : {
2841 [ + - ]: 270 : const OUString sText = lcl_AnyToString(pProperties[j].Value);
2842 [ + - ]: 270 : aToken.sText = sText;
2843 : : }
2844 [ - + ]: 460 : else if ( pProperties[j].Name == "ChapterFormat" )
2845 : : {
2846 [ # # ]: 0 : sal_Int16 nFormat = lcl_AnyToInt16(pProperties[j].Value);
2847 [ # # # # : 0 : switch(nFormat)
# # ]
2848 : : {
2849 : : case text::ChapterFormat::NUMBER:
2850 : 0 : nFormat = CF_NUMBER;
2851 : 0 : break;
2852 : : case text::ChapterFormat::NAME:
2853 : 0 : nFormat = CF_TITLE;
2854 : 0 : break;
2855 : : case text::ChapterFormat::NAME_NUMBER:
2856 : 0 : nFormat = CF_NUM_TITLE;
2857 : 0 : break;
2858 : : case text::ChapterFormat::NO_PREFIX_SUFFIX:
2859 : 0 : nFormat = CF_NUMBER_NOPREPST;
2860 : 0 : break;
2861 : : case text::ChapterFormat::DIGIT:
2862 : 0 : nFormat = CF_NUM_NOPREPST_TITLE;
2863 : 0 : break;
2864 : : default:
2865 [ # # ]: 0 : throw lang::IllegalArgumentException();
2866 : : }
2867 : 0 : aToken.nChapterFormat = nFormat;
2868 : : }
2869 : : // #i53420#
2870 [ - + ]: 460 : else if ( pProperties[j].Name == "ChapterLevel" )
2871 : : {
2872 [ # # ]: 0 : const sal_Int16 nLevel = lcl_AnyToInt16(pProperties[j].Value);
2873 [ # # ][ # # ]: 0 : if( nLevel < 1 || nLevel > MAXLEVEL )
2874 : : {
2875 [ # # ]: 0 : throw lang::IllegalArgumentException();
2876 : : }
2877 : 0 : aToken.nOutlineLevel = nLevel;
2878 : : }
2879 [ + + ]: 460 : else if ( pProperties[j].Name == "BibliographyDataField" )
2880 : : {
2881 : 356 : sal_Int16 nType = 0;
2882 : 356 : pProperties[j].Value >>= nType;
2883 [ - + ][ + - ]: 356 : if(nType < 0 || nType > text::BibliographyDataField::ISBN)
2884 : : {
2885 [ # # ]: 0 : lang::IllegalArgumentException aExcept;
2886 [ # # ]: 0 : aExcept.Message = C2U("BibliographyDataField - wrong value");
2887 : 0 : aExcept.ArgumentPosition = static_cast< sal_Int16 >(j);
2888 [ # # ]: 0 : throw aExcept;
2889 : : }
2890 : 356 : aToken.nAuthorityField = nType;
2891 : : }
2892 : : // #i21237#
2893 [ + - ]: 104 : else if ( pProperties[j].Name == "WithTab" )
2894 : : {
2895 [ + - ]: 104 : aToken.bWithTab = lcl_AnyToBool(pProperties[j].Value);
2896 : : }
2897 : :
2898 : : }
2899 : : //exception if wrong TokenType
2900 [ - + ]: 982 : if(TOKEN_END <= aToken.eTokenType )
2901 : : {
2902 [ # # ]: 0 : throw lang::IllegalArgumentException();
2903 : : }
2904 : : // set TokenType from TOKEN_ENTRY_TEXT to TOKEN_ENTRY if it is
2905 : : // not a content index
2906 [ + + ][ + + ]: 1092 : if(TOKEN_ENTRY_TEXT == aToken.eTokenType &&
[ + + ]
2907 [ + - ]: 110 : (TOX_CONTENT != rTOXBase.GetType()))
2908 : : {
2909 : 70 : aToken.eTokenType = TOKEN_ENTRY;
2910 : : }
2911 : : // #i53420#
2912 : : // check for chapter format allowed values if it was TOKEN_ENTRY_NO type
2913 : : // only allowed value are CF_NUMBER and CF_NUM_NOPREPST_TITLE
2914 : : // reading from file
2915 [ + + ]: 982 : if( TOKEN_ENTRY_NO == aToken.eTokenType )
2916 : : {
2917 [ + - ]: 40 : switch(aToken.nChapterFormat)
2918 : : {
2919 : : case CF_NUMBER:
2920 : : case CF_NUM_NOPREPST_TITLE:
2921 : 40 : break;
2922 : : default:
2923 [ # # ]: 40 : throw lang::IllegalArgumentException();
2924 : : }
2925 : : }
2926 [ + - ][ + - ]: 982 : sPattern += aToken.GetString();
[ + - ]
2927 [ + - ]: 982 : }
2928 [ + - ][ + - ]: 198 : SwForm aForm(rTOXBase.GetTOXForm());
2929 [ + - ]: 198 : aForm.SetPattern(static_cast<sal_uInt16>(nIndex), sPattern);
2930 [ + - ][ + - ]: 198 : rTOXBase.SetTOXForm(aForm);
[ + - ][ + - ]
[ + - ]
2931 : 198 : }
2932 : :
2933 : : sal_Int32 SAL_CALL
2934 : 42 : SwXDocumentIndex::TokenAccess_Impl::getCount() throw (uno::RuntimeException)
2935 : : {
2936 [ + - ]: 42 : SolarMutexGuard aGuard;
2937 : :
2938 [ + - ]: 42 : const sal_Int32 nRet = m_xParent->m_pImpl->GetFormMax();
2939 [ + - ]: 42 : return nRet;
2940 : : }
2941 : :
2942 : : uno::Any SAL_CALL
2943 : 122 : SwXDocumentIndex::TokenAccess_Impl::getByIndex(sal_Int32 nIndex)
2944 : : throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException,
2945 : : uno::RuntimeException)
2946 : : {
2947 [ + - ]: 122 : SolarMutexGuard aGuard;
2948 : :
2949 [ + - ]: 122 : SwTOXBase & rTOXBase( m_xParent->m_pImpl->GetTOXSectionOrThrow() );
2950 : :
2951 [ + - ][ + - ]: 122 : if ((nIndex < 0) || (nIndex > rTOXBase.GetTOXForm().GetFormMax()))
[ - + ][ - + ]
2952 : : {
2953 [ # # ]: 0 : throw lang::IndexOutOfBoundsException();
2954 : : }
2955 : :
2956 : : // #i21237#
2957 [ + - ]: 122 : SwFormTokens aPattern = rTOXBase.GetTOXForm().
2958 [ + - ][ + - ]: 122 : GetPattern(static_cast<sal_uInt16>(nIndex));
2959 : 122 : SwFormTokens::iterator aIt = aPattern.begin();
2960 : :
2961 : 122 : sal_uInt16 nTokenCount = 0;
2962 [ + - ]: 122 : uno::Sequence< beans::PropertyValues > aRetSeq;
2963 [ + - ]: 122 : String aString;
2964 [ + - ][ + + ]: 656 : while(aIt != aPattern.end()) // #i21237#
2965 : : {
2966 : 534 : nTokenCount++;
2967 [ + - ]: 534 : aRetSeq.realloc(nTokenCount);
2968 [ + - ]: 534 : beans::PropertyValues* pTokenProps = aRetSeq.getArray();
2969 [ + - ][ + - ]: 534 : SwFormToken aToken = *aIt; // #i21237#
2970 : :
2971 : : uno::Sequence< beans::PropertyValue >& rCurTokenSeq =
2972 : 534 : pTokenProps[nTokenCount-1];
2973 : : SwStyleNameMapper::FillProgName(
2974 : : aToken.sCharStyleName,
2975 : : aString,
2976 : : nsSwGetPoolIdFromName::GET_POOLID_CHRFMT,
2977 [ + - ]: 534 : sal_True );
2978 [ + - ]: 534 : const OUString aProgCharStyle( aString );
2979 [ + + + + : 534 : switch(aToken.eTokenType)
+ - - - +
- ]
2980 : : {
2981 : : case TOKEN_ENTRY_NO:
2982 : : {
2983 : : // #i53420#
2984 : : // writing to file (from doc to properties)
2985 : 20 : sal_Int32 nElements = 2;
2986 : 20 : sal_Int32 nCurrentElement = 0;
2987 : :
2988 : : // check for default value
2989 [ - + ]: 20 : if (aToken.nChapterFormat != CF_NUMBER)
2990 : : {
2991 : 0 : nElements++;//we need the element
2992 : : }
2993 [ - + ]: 20 : if( aToken.nOutlineLevel != MAXLEVEL )
2994 : : {
2995 : 0 : nElements++;
2996 : : }
2997 : :
2998 [ + - ]: 20 : rCurTokenSeq.realloc( nElements );
2999 : :
3000 [ + - ]: 20 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3001 : :
3002 [ + - ]: 20 : pArr[nCurrentElement].Name = C2U("TokenType");
3003 : 40 : pArr[nCurrentElement++].Value <<=
3004 [ + - ][ + - ]: 20 : OUString(RTL_CONSTASCII_USTRINGPARAM("TokenEntryNumber"));
3005 : :
3006 [ + - ]: 20 : pArr[nCurrentElement].Name = C2U("CharacterStyleName");
3007 [ + - ]: 20 : pArr[nCurrentElement++].Value <<= aProgCharStyle;
3008 [ - + ]: 20 : if( aToken.nChapterFormat != CF_NUMBER )
3009 : : {
3010 [ # # ]: 0 : pArr[nCurrentElement].Name = C2U("ChapterFormat");
3011 : : sal_Int16 nVal;
3012 : : // the allowed values for chapter format, when used as entry number,
3013 : : // are CF_NUMBER and CF_NUM_NOPREPST_TITLE only, all else forced to
3014 : : //CF_NUMBER
3015 [ # # ]: 0 : switch(aToken.nChapterFormat)
3016 : : {
3017 : : default:
3018 : : case CF_NUMBER:
3019 : 0 : nVal = text::ChapterFormat::NUMBER;
3020 : 0 : break;
3021 : : case CF_NUM_NOPREPST_TITLE:
3022 : 0 : nVal = text::ChapterFormat::DIGIT;
3023 : 0 : break;
3024 : : }
3025 [ # # ]: 0 : pArr[nCurrentElement++].Value <<= nVal;
3026 : : }
3027 : :
3028 : : // only a ChapterLevel != MAXLEVEL is registered
3029 [ - + ]: 20 : if (aToken.nOutlineLevel != MAXLEVEL)
3030 : : {
3031 [ # # ]: 0 : pArr[nCurrentElement].Name = C2U("ChapterLevel");
3032 [ # # ]: 0 : pArr[nCurrentElement].Value <<= aToken.nOutlineLevel;
3033 : : }
3034 : : }
3035 : 20 : break;
3036 : : case TOKEN_ENTRY: // no difference between Entry and Entry Text
3037 : : case TOKEN_ENTRY_TEXT:
3038 : : {
3039 [ + - ]: 74 : rCurTokenSeq.realloc( 2 );
3040 [ + - ]: 74 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3041 : :
3042 [ + - ]: 74 : pArr[0].Name = C2U("TokenType");
3043 [ + - ][ + - ]: 74 : pArr[0].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TokenEntryText"));
3044 : :
3045 [ + - ]: 74 : pArr[1].Name = C2U("CharacterStyleName");
3046 [ + - ]: 74 : pArr[1].Value <<= aProgCharStyle;
3047 : : }
3048 : 74 : break;
3049 : : case TOKEN_TAB_STOP:
3050 : : {
3051 [ + - ]: 64 : rCurTokenSeq.realloc(5); // #i21237#
3052 [ + - ]: 64 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3053 : :
3054 [ + - ]: 64 : pArr[0].Name = C2U("TokenType");
3055 [ + - ][ + - ]: 64 : pArr[0].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TokenTabStop"));
3056 : :
3057 [ + - ]: 64 : if(SVX_TAB_ADJUST_END == aToken.eTabAlign)
3058 : : {
3059 [ + - ]: 64 : pArr[1].Name = C2U("TabStopRightAligned");
3060 : 64 : sal_Bool bTemp = sal_True;
3061 [ + - ]: 64 : pArr[1].Value.setValue(&bTemp, ::getCppuBooleanType());
3062 : : }
3063 : : else
3064 : : {
3065 [ # # ]: 0 : pArr[1].Name = C2U("TabStopPosition");
3066 [ # # ]: 0 : sal_Int32 nPos = (TWIP_TO_MM100(aToken.nTabStopPosition));
3067 [ # # ]: 0 : if(nPos < 0)
3068 : 0 : nPos = 0;
3069 [ # # ]: 0 : pArr[1].Value <<= (sal_Int32)nPos;
3070 : : }
3071 [ + - ]: 64 : pArr[2].Name = C2U("TabStopFillCharacter");
3072 [ + - ]: 64 : pArr[2].Value <<= OUString(aToken.cTabFillChar);
3073 [ + - ]: 64 : pArr[3].Name = C2U("CharacterStyleName");
3074 [ + - ]: 64 : pArr[3].Value <<= aProgCharStyle;
3075 : : // #i21237#
3076 [ + - ]: 64 : pArr[4].Name = C2U("WithTab");
3077 [ + - ]: 64 : pArr[4].Value <<= static_cast<sal_Bool>(aToken.bWithTab);
3078 : : }
3079 : 64 : break;
3080 : : case TOKEN_TEXT:
3081 : : {
3082 [ + - ]: 134 : rCurTokenSeq.realloc( 3 );
3083 [ + - ]: 134 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3084 : :
3085 [ + - ]: 134 : pArr[0].Name = C2U("TokenType");
3086 [ + - ][ + - ]: 134 : pArr[0].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TokenText"));
3087 : :
3088 [ + - ]: 134 : pArr[1].Name = C2U("CharacterStyleName");
3089 [ + - ]: 134 : pArr[1].Value <<= aProgCharStyle;
3090 : :
3091 [ + - ]: 134 : pArr[2].Name = C2U("Text");
3092 [ + - ][ + - ]: 134 : pArr[2].Value <<= OUString(aToken.sText);
3093 : : }
3094 : 134 : break;
3095 : : case TOKEN_PAGE_NUMS:
3096 : : {
3097 [ + - ]: 64 : rCurTokenSeq.realloc( 2 );
3098 [ + - ]: 64 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3099 : :
3100 [ + - ]: 64 : pArr[0].Name = C2U("TokenType");
3101 [ + - ][ + - ]: 64 : pArr[0].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TokenPageNumber"));
3102 : :
3103 [ + - ]: 64 : pArr[1].Name = C2U("CharacterStyleName");
3104 [ + - ]: 64 : pArr[1].Value <<= aProgCharStyle;
3105 : : }
3106 : 64 : break;
3107 : : case TOKEN_CHAPTER_INFO:
3108 : : {
3109 [ # # ]: 0 : rCurTokenSeq.realloc( 4 );
3110 [ # # ]: 0 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3111 : :
3112 [ # # ]: 0 : pArr[0].Name = C2U("TokenType");
3113 [ # # ][ # # ]: 0 : pArr[0].Value <<= OUString(RTL_CONSTASCII_USTRINGPARAM("TokenChapterInfo"));
3114 : :
3115 [ # # ]: 0 : pArr[1].Name = C2U("CharacterStyleName");
3116 [ # # ]: 0 : pArr[1].Value <<= aProgCharStyle;
3117 : :
3118 [ # # ]: 0 : pArr[2].Name = C2U("ChapterFormat");
3119 : 0 : sal_Int16 nVal = text::ChapterFormat::NUMBER;
3120 [ # # # # : 0 : switch(aToken.nChapterFormat)
# # ]
3121 : : {
3122 : : case CF_NUMBER:
3123 : 0 : nVal = text::ChapterFormat::NUMBER;
3124 : 0 : break;
3125 : : case CF_TITLE:
3126 : 0 : nVal = text::ChapterFormat::NAME;
3127 : 0 : break;
3128 : : case CF_NUM_TITLE:
3129 : 0 : nVal = text::ChapterFormat::NAME_NUMBER;
3130 : 0 : break;
3131 : : case CF_NUMBER_NOPREPST:
3132 : 0 : nVal = text::ChapterFormat::NO_PREFIX_SUFFIX;
3133 : 0 : break;
3134 : : case CF_NUM_NOPREPST_TITLE:
3135 : 0 : nVal = text::ChapterFormat::DIGIT;
3136 : 0 : break;
3137 : : }
3138 [ # # ]: 0 : pArr[2].Value <<= nVal;
3139 : : // #i53420#
3140 [ # # ]: 0 : pArr[3].Name = C2U("ChapterLevel");
3141 [ # # ]: 0 : pArr[3].Value <<= aToken.nOutlineLevel;
3142 : : }
3143 : 0 : break;
3144 : : case TOKEN_LINK_START:
3145 : : {
3146 [ # # ]: 0 : rCurTokenSeq.realloc( 2 );
3147 [ # # ]: 0 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3148 : :
3149 [ # # ]: 0 : pArr[0].Name = C2U("TokenType");
3150 : : pArr[0].Value <<=
3151 [ # # ][ # # ]: 0 : OUString(RTL_CONSTASCII_USTRINGPARAM("TokenHyperlinkStart"));
3152 [ # # ]: 0 : pArr[1].Name = C2U("CharacterStyleName");
3153 [ # # ]: 0 : pArr[1].Value <<= aProgCharStyle;
3154 : : }
3155 : 0 : break;
3156 : : case TOKEN_LINK_END:
3157 : : {
3158 [ # # ]: 0 : rCurTokenSeq.realloc( 1 );
3159 [ # # ]: 0 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3160 : :
3161 [ # # ]: 0 : pArr[0].Name = C2U("TokenType");
3162 : : pArr[0].Value <<=
3163 [ # # ][ # # ]: 0 : OUString(RTL_CONSTASCII_USTRINGPARAM("TokenHyperlinkEnd"));
3164 : : }
3165 : 0 : break;
3166 : : case TOKEN_AUTHORITY:
3167 : : {
3168 [ + - ]: 178 : rCurTokenSeq.realloc( 3 );
3169 [ + - ]: 178 : beans::PropertyValue* pArr = rCurTokenSeq.getArray();
3170 : :
3171 [ + - ]: 178 : pArr[0].Name = C2U("TokenType");
3172 : : pArr[0].Value <<=
3173 [ + - ][ + - ]: 178 : OUString(RTL_CONSTASCII_USTRINGPARAM("TokenBibliographyDataField"));
3174 : :
3175 [ + - ]: 178 : pArr[1].Name = C2U("CharacterStyleName");
3176 [ + - ]: 178 : pArr[1].Value <<= aProgCharStyle;
3177 : :
3178 [ + - ]: 178 : pArr[2].Name = C2U("BibliographyDataField");
3179 [ + - ]: 178 : pArr[2].Value <<= sal_Int16(aToken.nAuthorityField);
3180 : : }
3181 : 178 : break;
3182 : :
3183 : : default:
3184 : : ;
3185 : : }
3186 : :
3187 [ + - ]: 534 : ++aIt; // #i21237#
3188 [ + - ]: 534 : }
3189 : :
3190 : 122 : uno::Any aRet;
3191 [ + - ]: 122 : aRet <<= aRetSeq;
3192 [ + - ][ + - ]: 122 : return aRet;
[ + - ]
3193 : : }
3194 : :
3195 : : uno::Type SAL_CALL
3196 : 0 : SwXDocumentIndex::TokenAccess_Impl::getElementType()
3197 : : throw (uno::RuntimeException)
3198 : : {
3199 : 0 : return ::getCppuType((uno::Sequence< beans::PropertyValues >*)0);
3200 : : }
3201 : :
3202 : : sal_Bool SAL_CALL
3203 : 0 : SwXDocumentIndex::TokenAccess_Impl::hasElements()
3204 : : throw (uno::RuntimeException)
3205 : : {
3206 : 0 : return sal_True;
3207 : : }
3208 : :
3209 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|