Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <unotextmarkup.hxx>
21 :
22 : #include <osl/mutex.hxx>
23 : #include <vcl/svapp.hxx>
24 : #include <SwSmartTagMgr.hxx>
25 : #include <com/sun/star/text/TextMarkupType.hpp>
26 : #include <com/sun/star/text/TextMarkupDescriptor.hpp>
27 : #include <com/sun/star/container/XStringKeyMap.hpp>
28 : #include <ndtxt.hxx>
29 : #include <SwGrammarMarkUp.hxx>
30 :
31 : #include <IGrammarContact.hxx>
32 :
33 : #include <com/sun/star/lang/XUnoTunnel.hpp>
34 : #include <com/sun/star/text/XTextRange.hpp>
35 :
36 : #include <pam.hxx>
37 :
38 : #include <unotextrange.hxx>
39 : #include <unotextcursor.hxx>
40 :
41 :
42 : using namespace ::com::sun::star;
43 :
44 : /*
45 : * SwXTextMarkup
46 : */
47 0 : SwXTextMarkup::SwXTextMarkup( SwTxtNode& rTxtNode, const ModelToViewHelper& rMap )
48 0 : : mpTxtNode( &rTxtNode ), maConversionMap( rMap )
49 : {
50 : // FME 2007-07-16 #i79641# SwXTextMarkup is allowed to be removed ...
51 0 : SetIsAllowedToBeRemovedInModifyCall(true);
52 0 : mpTxtNode->Add(this);
53 0 : }
54 :
55 0 : SwXTextMarkup::~SwXTextMarkup()
56 : {
57 0 : }
58 :
59 0 : uno::Reference< container::XStringKeyMap > SAL_CALL SwXTextMarkup::getMarkupInfoContainer() throw (uno::RuntimeException)
60 : {
61 0 : SolarMutexGuard aGuard;
62 :
63 0 : uno::Reference< container::XStringKeyMap > xProp = new SwXStringKeyMap;
64 0 : return xProp;
65 : }
66 :
67 0 : void SAL_CALL SwXTextMarkup::commitTextRangeMarkup(::sal_Int32 nType, const ::rtl::OUString & aIdentifier, const uno::Reference< text::XTextRange> & xRange,
68 : const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer) throw (uno::RuntimeException)
69 : {
70 0 : SolarMutexGuard aGuard;
71 :
72 0 : uno::Reference<lang::XUnoTunnel> xRangeTunnel( xRange, uno::UNO_QUERY);
73 :
74 0 : if(!xRangeTunnel.is()) return;
75 :
76 0 : SwXTextRange* pRange = 0;
77 0 : OTextCursorHelper* pCursor = 0;
78 :
79 0 : if(xRangeTunnel.is())
80 : {
81 0 : pRange = reinterpret_cast<SwXTextRange*>( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(SwXTextRange::getUnoTunnelId())));
82 0 : pCursor = reinterpret_cast<OTextCursorHelper*>( sal::static_int_cast< sal_IntPtr >( xRangeTunnel->getSomething(OTextCursorHelper::getUnoTunnelId())));
83 : }
84 :
85 0 : if (pRange)
86 : {
87 0 : SwDoc* pDoc = reinterpret_cast<SwDoc*>(pRange->GetDoc());
88 :
89 0 : if (!pDoc) return;
90 :
91 0 : SwUnoInternalPaM aPam(*pDoc);
92 :
93 0 : ::sw::XTextRangeToSwPaM(aPam, xRange);
94 :
95 0 : SwPosition* startPos = aPam.Start();
96 0 : SwPosition* endPos = aPam.End();
97 :
98 0 : commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
99 : }
100 0 : else if (pCursor)
101 : {
102 0 : SwPaM aPam(*pCursor->GetPaM());
103 :
104 0 : SwPosition* startPos = aPam.Start();
105 0 : SwPosition* endPos = aPam.End();
106 :
107 0 : commitStringMarkup (nType, aIdentifier, startPos->nContent.GetIndex(), endPos->nContent.GetIndex() - startPos->nContent.GetIndex(), xMarkupInfoContainer);
108 0 : }
109 : }
110 :
111 :
112 0 : void SAL_CALL SwXTextMarkup::commitStringMarkup(
113 : ::sal_Int32 nType,
114 : const OUString & rIdentifier,
115 : ::sal_Int32 nStart,
116 : ::sal_Int32 nLength,
117 : const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
118 : throw (uno::RuntimeException)
119 : {
120 0 : SolarMutexGuard aGuard;
121 :
122 : // paragraph already dead or modified?
123 0 : if ( !mpTxtNode || nLength <= 0 )
124 0 : return;
125 :
126 0 : if ( nType == text::TextMarkupType::SMARTTAG &&
127 0 : !SwSmartTagMgr::Get().IsSmartTagTypeEnabled( rIdentifier ) )
128 0 : return;
129 :
130 : // get appropriate list to use...
131 0 : SwWrongList* pWList = 0;
132 0 : bool bRepaint = false;
133 0 : if ( nType == text::TextMarkupType::SPELLCHECK )
134 : {
135 0 : pWList = mpTxtNode->GetWrong();
136 0 : if ( !pWList )
137 : {
138 0 : pWList = new SwWrongList( WRONGLIST_SPELL );
139 0 : mpTxtNode->SetWrong( pWList );
140 : }
141 : }
142 0 : else if ( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
143 : {
144 0 : IGrammarContact *pGrammarContact = getGrammarContact( *mpTxtNode );
145 0 : if( pGrammarContact )
146 : {
147 0 : pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true );
148 : OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
149 : }
150 : else
151 : {
152 0 : pWList = mpTxtNode->GetGrammarCheck();
153 0 : if ( !pWList )
154 : {
155 0 : mpTxtNode->SetGrammarCheck( new SwGrammarMarkUp() );
156 0 : pWList = mpTxtNode->GetGrammarCheck();
157 : }
158 : }
159 0 : bRepaint = pWList == mpTxtNode->GetGrammarCheck();
160 0 : if( pWList->GetBeginInv() < STRING_LEN )
161 0 : ((SwGrammarMarkUp*)pWList)->ClearGrammarList();
162 : }
163 0 : else if ( nType == text::TextMarkupType::SMARTTAG )
164 : {
165 0 : pWList = mpTxtNode->GetSmartTags();
166 0 : if ( !pWList )
167 : {
168 0 : pWList = new SwWrongList( WRONGLIST_SMARTTAG );
169 0 : mpTxtNode->SetSmartTags( pWList );
170 : }
171 : }
172 : else
173 : {
174 : OSL_FAIL( "Unknown mark-up type" );
175 0 : return;
176 : }
177 :
178 :
179 : const ModelToViewHelper::ModelPosition aStartPos =
180 0 : maConversionMap.ConvertToModelPosition( nStart );
181 : const ModelToViewHelper::ModelPosition aEndPos =
182 0 : maConversionMap.ConvertToModelPosition( nStart + nLength - 1);
183 :
184 0 : const bool bStartInField = aStartPos.mbIsField;
185 0 : const bool bEndInField = aEndPos.mbIsField;
186 0 : bool bCommit = false;
187 :
188 0 : if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
189 : {
190 0 : nStart = aStartPos.mnSubPos;
191 0 : const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
192 0 : const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
193 :
194 0 : SwWrongList* pSubList = pWList->SubList( nInsertPos );
195 0 : if ( !pSubList )
196 : {
197 0 : if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
198 0 : pSubList = new SwGrammarMarkUp();
199 : else
200 0 : pSubList = new SwWrongList( pWList->GetWrongListType() );
201 0 : pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
202 : }
203 :
204 0 : pWList = pSubList;
205 0 : bCommit = true;
206 : }
207 0 : else if ( !bStartInField && !bEndInField )
208 : {
209 0 : nStart = aStartPos.mnPos;
210 0 : bCommit = true;
211 0 : nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
212 : }
213 0 : else if( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE )
214 : {
215 0 : bCommit = true;
216 0 : nStart = aStartPos.mnPos;
217 0 : sal_Int32 nEnd = aEndPos.mnPos;
218 0 : if( bStartInField && nType != text::TextMarkupType::SENTENCE )
219 : {
220 0 : const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
221 0 : const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
222 0 : SwWrongList* pSubList = pWList->SubList( nInsertPos );
223 0 : if ( !pSubList )
224 : {
225 0 : pSubList = new SwGrammarMarkUp();
226 0 : pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
227 : }
228 0 : const sal_uInt32 nTmpStart = maConversionMap.ConvertToViewPosition( aStartPos.mnPos );
229 0 : const sal_uInt32 nTmpLen = maConversionMap.ConvertToViewPosition( aStartPos.mnPos + 1 )
230 0 : - nTmpStart - aStartPos.mnSubPos;
231 0 : if( nTmpLen > 0 )
232 : {
233 0 : if( nType == text::TextMarkupType::SENTENCE )
234 : {
235 0 : ((SwGrammarMarkUp*)pSubList)->setSentence( static_cast< xub_StrLen >(aStartPos.mnSubPos) );
236 0 : bCommit = false;
237 : }
238 : else
239 : pSubList->Insert( rIdentifier, xMarkupInfoContainer,
240 0 : static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) );
241 : }
242 0 : ++nStart;
243 : }
244 0 : if( bEndInField && nType != text::TextMarkupType::SENTENCE )
245 : {
246 0 : const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos);
247 0 : const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
248 0 : SwWrongList* pSubList = pWList->SubList( nInsertPos );
249 0 : if ( !pSubList )
250 : {
251 0 : pSubList = new SwGrammarMarkUp();
252 0 : pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
253 : }
254 0 : const sal_uInt32 nTmpLen = aEndPos.mnSubPos + 1;
255 0 : pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) );
256 : }
257 : else
258 0 : ++nEnd;
259 0 : if( nEnd > nStart )
260 0 : nLength = nEnd - nStart;
261 : else
262 0 : bCommit = false;
263 : }
264 :
265 0 : if ( bCommit )
266 : {
267 0 : if( nType == text::TextMarkupType::SENTENCE )
268 0 : ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart) );
269 : else
270 : pWList->Insert( rIdentifier, xMarkupInfoContainer,
271 0 : static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) );
272 : }
273 :
274 0 : if( bRepaint )
275 0 : finishGrammarCheck( *mpTxtNode );
276 : }
277 :
278 :
279 0 : static void lcl_commitGrammarMarkUp(
280 : const ModelToViewHelper& rConversionMap,
281 : SwGrammarMarkUp* pWList,
282 : ::sal_Int32 nType,
283 : const OUString & rIdentifier,
284 : ::sal_Int32 nStart,
285 : ::sal_Int32 nLength,
286 : const uno::Reference< container::XStringKeyMap > & xMarkupInfoContainer)
287 : {
288 : OSL_ENSURE( nType == text::TextMarkupType::PROOFREADING || nType == text::TextMarkupType::SENTENCE, "Wrong mark-up type" );
289 : const ModelToViewHelper::ModelPosition aStartPos =
290 0 : rConversionMap.ConvertToModelPosition( nStart );
291 : const ModelToViewHelper::ModelPosition aEndPos =
292 0 : rConversionMap.ConvertToModelPosition( nStart + nLength - 1);
293 :
294 0 : const bool bStartInField = aStartPos.mbIsField;
295 0 : const bool bEndInField = aEndPos.mbIsField;
296 0 : bool bCommit = false;
297 :
298 0 : if ( bStartInField && bEndInField && aStartPos.mnPos == aEndPos.mnPos )
299 : {
300 0 : nStart = aStartPos.mnSubPos;
301 0 : const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
302 0 : const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
303 :
304 0 : SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
305 0 : if ( !pSubList )
306 : {
307 0 : pSubList = new SwGrammarMarkUp();
308 0 : pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
309 : }
310 :
311 0 : pWList = pSubList;
312 0 : bCommit = true;
313 : }
314 0 : else if ( !bStartInField && !bEndInField )
315 : {
316 0 : nStart = aStartPos.mnPos;
317 0 : bCommit = true;
318 0 : nLength = aEndPos.mnPos + 1 - aStartPos.mnPos;
319 : }
320 : else
321 : {
322 0 : bCommit = true;
323 0 : nStart = aStartPos.mnPos;
324 0 : sal_Int32 nEnd = aEndPos.mnPos;
325 0 : if( bStartInField && nType != text::TextMarkupType::SENTENCE )
326 : {
327 0 : const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aStartPos.mnPos);
328 0 : const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
329 0 : SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
330 0 : if ( !pSubList )
331 : {
332 0 : pSubList = new SwGrammarMarkUp();
333 0 : pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
334 : }
335 0 : const sal_uInt32 nTmpStart = rConversionMap.ConvertToViewPosition( aStartPos.mnPos );
336 0 : const sal_uInt32 nTmpLen = rConversionMap.ConvertToViewPosition( aStartPos.mnPos + 1 )
337 0 : - nTmpStart - aStartPos.mnSubPos;
338 0 : if( nTmpLen > 0 )
339 : pSubList->Insert( rIdentifier, xMarkupInfoContainer,
340 0 : static_cast< xub_StrLen >(aStartPos.mnSubPos), static_cast< xub_StrLen >(nTmpLen) );
341 0 : ++nStart;
342 : }
343 0 : if( bEndInField && nType != text::TextMarkupType::SENTENCE )
344 : {
345 0 : const xub_StrLen nFieldPosModel = static_cast< xub_StrLen >(aEndPos.mnPos);
346 0 : const sal_uInt16 nInsertPos = pWList->GetWrongPos( nFieldPosModel );
347 0 : SwGrammarMarkUp* pSubList = (SwGrammarMarkUp*)pWList->SubList( nInsertPos );
348 0 : if ( !pSubList )
349 : {
350 0 : pSubList = new SwGrammarMarkUp();
351 0 : pWList->InsertSubList( nFieldPosModel, 1, nInsertPos, pSubList );
352 : }
353 0 : const sal_uInt32 nTmpLen = aEndPos.mnSubPos + 1;
354 0 : pSubList->Insert( rIdentifier, xMarkupInfoContainer, 0, static_cast< xub_StrLen >(nTmpLen) );
355 : }
356 : else
357 0 : ++nEnd;
358 0 : if( nEnd > nStart )
359 0 : nLength = nEnd - nStart;
360 : else
361 0 : bCommit = false;
362 : }
363 :
364 0 : if ( bCommit )
365 : {
366 0 : if( nType == text::TextMarkupType::SENTENCE )
367 0 : ((SwGrammarMarkUp*)pWList)->setSentence( static_cast< xub_StrLen >(nStart+nLength) );
368 : else
369 : pWList->Insert( rIdentifier, xMarkupInfoContainer,
370 0 : static_cast< xub_StrLen >(nStart), static_cast< xub_StrLen >(nLength) );
371 : }
372 0 : }
373 :
374 :
375 0 : void SAL_CALL SwXTextMarkup::commitMultiTextMarkup(
376 : const uno::Sequence< text::TextMarkupDescriptor > &rMarkups )
377 : throw (lang::IllegalArgumentException, uno::RuntimeException)
378 : {
379 0 : SolarMutexGuard aGuard;
380 :
381 : // paragraph already dead or modified?
382 0 : if ( !mpTxtNode )
383 0 : return;
384 :
385 : // check for equal length of all sequnces
386 0 : sal_Int32 nLen = rMarkups.getLength();
387 :
388 : // for grammar checking there should be exactly one sentence markup
389 : // and 0..n grammar markups.
390 : // Different markups are not expected but may be applied anyway since
391 : // that should be no problem...
392 : // but it has to be implemented, at the moment only this function is for
393 : // grammar markups and sentence markup only!
394 0 : sal_Int32 nSentenceMarkUpIndex = -1;
395 0 : const text::TextMarkupDescriptor *pMarkups = rMarkups.getConstArray();
396 : sal_Int32 i;
397 0 : for( i = 0; i < nLen; ++i )
398 : {
399 0 : if (pMarkups[i].nType == text::TextMarkupType::SENTENCE)
400 : {
401 0 : if (nSentenceMarkUpIndex == -1)
402 0 : nSentenceMarkUpIndex = i;
403 : else // there is already one sentence markup
404 0 : throw lang::IllegalArgumentException();
405 : }
406 0 : else if( pMarkups[i].nType != text::TextMarkupType::PROOFREADING )
407 0 : return;
408 : }
409 :
410 0 : if( nSentenceMarkUpIndex == -1 )
411 0 : return;
412 :
413 : // get appropriate list to use...
414 0 : SwGrammarMarkUp* pWList = 0;
415 0 : bool bRepaint = false;
416 0 : IGrammarContact *pGrammarContact = getGrammarContact( *mpTxtNode );
417 0 : if( pGrammarContact )
418 : {
419 0 : pWList = pGrammarContact->getGrammarCheck( *mpTxtNode, true );
420 : OSL_ENSURE( pWList, "GrammarContact _has_ to deliver a wrong list" );
421 : }
422 : else
423 : {
424 0 : pWList = mpTxtNode->GetGrammarCheck();
425 0 : if ( !pWList )
426 : {
427 0 : mpTxtNode->SetGrammarCheck( new SwGrammarMarkUp() );
428 0 : pWList = mpTxtNode->GetGrammarCheck();
429 0 : pWList->SetInvalid( 0, STRING_LEN );
430 : }
431 : }
432 0 : bRepaint = pWList == mpTxtNode->GetGrammarCheck();
433 :
434 0 : bool bAcceptGrammarError = false;
435 0 : if( pWList->GetBeginInv() < STRING_LEN )
436 : {
437 : const ModelToViewHelper::ModelPosition aSentenceEnd =
438 : maConversionMap.ConvertToModelPosition(
439 0 : pMarkups[nSentenceMarkUpIndex].nOffset + pMarkups[nSentenceMarkUpIndex].nLength );
440 0 : bAcceptGrammarError = (xub_StrLen)aSentenceEnd.mnPos > pWList->GetBeginInv();
441 0 : pWList->ClearGrammarList( (xub_StrLen)aSentenceEnd.mnPos );
442 : }
443 :
444 0 : if( bAcceptGrammarError )
445 : {
446 0 : for( i = 0; i < nLen; ++i )
447 : {
448 0 : const text::TextMarkupDescriptor &rDesc = pMarkups[i];
449 : lcl_commitGrammarMarkUp( maConversionMap, pWList, rDesc.nType,
450 0 : rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
451 : }
452 : }
453 : else
454 : {
455 0 : bRepaint = false;
456 0 : i = nSentenceMarkUpIndex;
457 0 : const text::TextMarkupDescriptor &rDesc = pMarkups[i];
458 : lcl_commitGrammarMarkUp( maConversionMap, pWList, rDesc.nType,
459 0 : rDesc.aIdentifier, rDesc.nOffset, rDesc.nLength, rDesc.xMarkupInfoContainer );
460 : }
461 :
462 0 : if( bRepaint )
463 0 : finishGrammarCheck( *mpTxtNode );
464 :
465 0 : return;
466 : }
467 :
468 :
469 0 : void SwXTextMarkup::Modify( const SfxPoolItem* /*pOld*/, const SfxPoolItem* /*pNew*/ )
470 : {
471 : // FME 2007-07-16 #i79641# In my opinion this is perfectly legal,
472 : // therefore I remove the assertion in SwModify::_Remove()
473 0 : if ( GetRegisteredIn() )
474 0 : GetRegisteredInNonConst()->Remove( this );
475 :
476 0 : SolarMutexGuard aGuard;
477 0 : mpTxtNode = 0;
478 0 : }
479 :
480 : /*
481 : * SwXStringKeyMap
482 : */
483 0 : SwXStringKeyMap::SwXStringKeyMap()
484 : {
485 0 : }
486 :
487 0 : uno::Any SAL_CALL SwXStringKeyMap::getValue(const OUString & aKey) throw (uno::RuntimeException, container::NoSuchElementException)
488 : {
489 0 : std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
490 0 : if ( aIter == maMap.end() )
491 0 : throw container::NoSuchElementException();
492 :
493 0 : return (*aIter).second;
494 : }
495 :
496 0 : ::sal_Bool SAL_CALL SwXStringKeyMap::hasValue(const OUString & aKey) throw (uno::RuntimeException)
497 : {
498 0 : return maMap.find( aKey ) != maMap.end();
499 : }
500 :
501 0 : void SAL_CALL SwXStringKeyMap::insertValue(const OUString & aKey, const uno::Any & aValue) throw (uno::RuntimeException, lang::IllegalArgumentException, container::ElementExistException)
502 : {
503 0 : std::map< OUString, uno::Any >::const_iterator aIter = maMap.find( aKey );
504 0 : if ( aIter != maMap.end() )
505 0 : throw container::ElementExistException();
506 :
507 0 : maMap[ aKey ] = aValue;
508 0 : }
509 :
510 0 : ::sal_Int32 SAL_CALL SwXStringKeyMap::getCount() throw (uno::RuntimeException)
511 : {
512 0 : return maMap.size();
513 : }
514 :
515 0 : OUString SAL_CALL SwXStringKeyMap::getKeyByIndex(::sal_Int32 nIndex) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
516 : {
517 0 : if ( (sal_uInt32)nIndex >= maMap.size() )
518 0 : throw lang::IndexOutOfBoundsException();
519 :
520 0 : return OUString();
521 : }
522 :
523 0 : uno::Any SAL_CALL SwXStringKeyMap::getValueByIndex(::sal_Int32 nIndex) throw (uno::RuntimeException, lang::IndexOutOfBoundsException)
524 : {
525 0 : if ( (sal_uInt32)nIndex >= maMap.size() )
526 0 : throw lang::IndexOutOfBoundsException();
527 :
528 0 : return uno::Any();
529 99 : }
530 :
531 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|