xref: /AOO41X/main/sw/source/core/unocore/unocrsrhelper.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sw.hxx"
30 
31 #include <svx/svxids.hrc>
32 #include <map>
33 #include <com/sun/star/text/XTextSection.hpp>
34 #include <cmdid.h>
35 #include <unocrsrhelper.hxx>
36 #include <unofootnote.hxx>
37 #include <unorefmark.hxx>
38 #include <unostyle.hxx>
39 #include <unoidx.hxx>
40 #include <unofield.hxx>
41 #include <unotbl.hxx>
42 #include <unosett.hxx>
43 #include <unoframe.hxx>
44 #include <unocrsr.hxx>
45 #include <doc.hxx>
46 #include <IDocumentUndoRedo.hxx>
47 #include <IDocumentRedlineAccess.hxx>
48 #include <fmtftn.hxx>
49 #include <fmtpdsc.hxx>
50 #include <charfmt.hxx>
51 #include <pagedesc.hxx>
52 #include <docstyle.hxx>
53 #include <ndtxt.hxx>
54 #include <txtrfmrk.hxx>
55 #include <fmtfld.hxx>
56 #include <docsh.hxx>
57 #include <section.hxx>
58 #include <shellio.hxx>
59 #include <edimp.hxx>
60 #include <swundo.hxx>
61 #include <cntfrm.hxx>
62 #include <pagefrm.hxx>
63 #include <svl/eitem.hxx>
64 #include <tools/urlobj.hxx>
65 #include <docary.hxx>
66 #include <swtable.hxx>
67 #include <tox.hxx>
68 #include <doctxm.hxx>
69 #include <fchrfmt.hxx>
70 #include <editeng/flstitem.hxx>
71 #include <vcl/metric.hxx>
72 #include <svtools/ctrltool.hxx>
73 #define _SVSTDARR_USHORTS
74 #define _SVSTDARR_USHORTSSORT
75 #include <svl/svstdarr.hxx>
76 #include <sfx2/docfilt.hxx>
77 #include <sfx2/docfile.hxx>
78 #include <sfx2/fcontnr.hxx>
79 #include <svl/stritem.hxx>
80 #include <com/sun/star/beans/PropertyState.hpp>
81 #include <SwStyleNameMapper.hxx>
82 #include <redline.hxx>
83 #include <numrule.hxx>
84 #include <comphelper/storagehelper.hxx>
85 #include <comphelper/mediadescriptor.hxx>
86 #include <comphelper/sequenceashashmap.hxx>
87 #include <com/sun/star/embed/ElementModes.hpp>
88 #include <com/sun/star/embed/XStorage.hpp>
89 // --> OD 2008-11-26 #158694#
90 #include <SwNodeNum.hxx>
91 // <--
92 #include <fmtmeta.hxx>
93 
94 
95 using namespace ::com::sun::star;
96 using namespace ::com::sun::star::uno;
97 using namespace ::com::sun::star::beans;
98 using namespace ::com::sun::star::text;
99 using namespace ::com::sun::star::table;
100 using namespace ::com::sun::star::container;
101 using namespace ::com::sun::star::lang;
102 using ::rtl::OUString;
103 
104 
105 namespace SwUnoCursorHelper
106 {
107 
108 uno::Reference<text::XTextContent>
109 GetNestedTextContent(SwTxtNode & rTextNode, xub_StrLen const nIndex,
110         bool const bParent)
111 {
112     // these should be unambiguous because of the dummy character
113     SwTxtNode::GetTxtAttrMode const eMode( (bParent)
114         ? SwTxtNode::PARENT : SwTxtNode::EXPAND );
115     SwTxtAttr *const pMetaTxtAttr =
116         rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_META, eMode);
117     SwTxtAttr *const pMetaFieldTxtAttr =
118         rTextNode.GetTxtAttrAt(nIndex, RES_TXTATR_METAFIELD, eMode);
119     // which is innermost?
120     SwTxtAttr *const pTxtAttr = (pMetaTxtAttr)
121         ? ((pMetaFieldTxtAttr)
122             ? ((*pMetaFieldTxtAttr->GetStart() >
123                     *pMetaTxtAttr->GetStart())
124                 ? pMetaFieldTxtAttr : pMetaTxtAttr)
125             : pMetaTxtAttr)
126         : pMetaFieldTxtAttr;
127     uno::Reference<XTextContent> xRet;
128     if (pTxtAttr)
129     {
130         ::sw::Meta *const pMeta(
131             static_cast<SwFmtMeta &>(pTxtAttr->GetAttr()).GetMeta());
132         OSL_ASSERT(pMeta);
133         xRet.set(pMeta->MakeUnoObject(), uno::UNO_QUERY);
134     }
135     return xRet;
136 }
137 
138 
139 /* -----------------16.09.98 12:27-------------------
140 * 	Lesen spezieller Properties am Cursor
141  * --------------------------------------------------*/
142 sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry
143 										, SwPaM& rPam
144 										, Any *pAny
145                                         , PropertyState& eState
146                                         , const SwTxtNode* pNode  )
147 {
148 	PropertyState eNewState = PropertyState_DIRECT_VALUE;
149 //    PropertyState_DEFAULT_VALUE
150 //    PropertyState_AMBIGUOUS_VALUE
151 	sal_Bool bDone = sal_True;
152     switch(rEntry.nWID)
153 	{
154         // --> OD 2008-11-26 #158694#
155         case FN_UNO_PARA_CONT_PREV_SUBTREE:
156             if (pAny)
157             {
158                 const SwTxtNode * pTmpNode = pNode;
159 
160                 if (!pTmpNode)
161                     pTmpNode = rPam.GetNode()->GetTxtNode();
162 
163                 bool bRet = false;
164 
165                 if ( pTmpNode &&
166                      pTmpNode->GetNum() &&
167                      pTmpNode->GetNum()->IsContinueingPreviousSubTree() )
168                 {
169                     bRet = true;
170                 }
171 
172                 *pAny <<= bRet;
173             }
174         break;
175         case FN_UNO_PARA_NUM_STRING:
176             if (pAny)
177             {
178                 const SwTxtNode * pTmpNode = pNode;
179 
180                 if (!pTmpNode)
181                     pTmpNode = rPam.GetNode()->GetTxtNode();
182 
183                 String sRet;
184                 if ( pTmpNode && pTmpNode->GetNum() )
185                 {
186                     sRet = pTmpNode->GetNumString();
187                 }
188 
189                 *pAny <<= OUString(sRet);
190             }
191         break;
192         // <--
193         // --> OD 2008-05-20 #outlinelevel# - no longer needed
194 //        case FN_UNO_PARA_CHAPTER_NUMBERING_LEVEL:
195 //            if (pAny)
196 //            {
197 //                const SwTxtNode * pTmpNode = pNode;
198 
199 //                if (!pTmpNode)
200 //                    pTmpNode = rPam.GetNode()->GetTxtNode();
201 
202 //                sal_Int8 nRet = -1;
203 //                if (pTmpNode && pTmpNode->GetOutlineLevel() != NO_NUMBERING)
204 //                nRet = sal::static_int_cast< sal_Int8 >(pTmpNode->GetOutlineLevel());
205 //                *pAny <<= nRet;
206 //            }
207 //        break;
208         // <--
209 		case RES_PARATR_OUTLINELEVEL: //#outlinelevel added by zhaojianwei
210             if (pAny)
211             {
212                 const SwTxtNode * pTmpNode = pNode;
213 
214                 if (!pTmpNode)
215                     pTmpNode = rPam.GetNode()->GetTxtNode();
216 
217                 sal_Int16 nRet = -1;
218                 if ( pTmpNode )
219                     nRet = sal::static_int_cast< sal_Int16 >( pTmpNode->GetAttrOutlineLevel() );
220 
221                 *pAny <<= nRet;
222             }
223         break; //<-end,zhaojianwei
224 		case FN_UNO_PARA_CONDITIONAL_STYLE_NAME:
225 		case FN_UNO_PARA_STYLE :
226 		{
227             SwFmtColl* pFmt = 0;
228             if(pNode)
229                 pFmt = FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID
230                             ? pNode->GetFmtColl() : &pNode->GetAnyFmtColl();
231             else
232             {
233                 pFmt = SwUnoCursorHelper::GetCurTxtFmtColl(rPam,
234                         FN_UNO_PARA_CONDITIONAL_STYLE_NAME == rEntry.nWID);
235             }
236 			if(pFmt)
237 			{
238 				if( pAny )
239 				{
240 					String sVal;
241 					SwStyleNameMapper::FillProgName(pFmt->GetName(), sVal, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL, sal_True );
242 					*pAny <<= OUString(sVal);
243 				}
244 			}
245 			else
246 				eNewState = PropertyState_AMBIGUOUS_VALUE;
247 		}
248 		break;
249 		case FN_UNO_PAGE_STYLE :
250 		{
251 			String sVal;
252 			GetCurPageStyle(rPam, sVal);
253 			if( pAny )
254 				*pAny <<= OUString(sVal);
255 			if(!sVal.Len())
256 				eNewState = PropertyState_AMBIGUOUS_VALUE;
257 		}
258 		break;
259 		case FN_UNO_NUM_START_VALUE  :
260 			if( pAny )
261 			{
262 				sal_Int16 nValue = IsNodeNumStart(rPam, eNewState);
263 				*pAny <<= nValue;
264 			}
265 		break;
266 		case FN_UNO_NUM_LEVEL  :
267 		case FN_UNO_IS_NUMBER  :
268         // --> OD 2008-07-14 #i91601#
269         case FN_UNO_LIST_ID:
270         // <--
271 		case FN_NUMBER_NEWSTART:
272 		{
273             // a multi selection is not considered
274             const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
275             // --> OD 2010-01-13 #b6912256#
276             if ( pTxtNd && pTxtNd->IsInList() )
277             // <--
278 			{
279 				if( pAny )
280 				{
281                     if(rEntry.nWID == FN_UNO_NUM_LEVEL)
282                         *pAny <<= (sal_Int16)(pTxtNd->GetActualListLevel());
283                     else if(rEntry.nWID == FN_UNO_IS_NUMBER)
284 					{
285                         sal_Bool bIsNumber = pTxtNd->IsCountedInList();
286 						pAny->setValue(&bIsNumber, ::getBooleanCppuType());
287 					}
288                     // --> OD 2008-07-14 #i91601#
289                     else if ( rEntry.nWID == FN_UNO_LIST_ID )
290                     {
291                         const String sListId = pTxtNd->GetListId();
292                         *pAny <<= OUString(sListId);
293                     }
294                     // <--
295                     else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
296 					{
297                         sal_Bool bIsRestart = pTxtNd->IsListRestart();
298 						pAny->setValue(&bIsRestart, ::getBooleanCppuType());
299 					}
300 				}
301 			}
302 			else
303 			{
304 				eNewState = PropertyState_DEFAULT_VALUE;
305 
306 				if( pAny )
307 				{
308 					// #i30838# set default values for default properties
309                     if(rEntry.nWID == FN_UNO_NUM_LEVEL)
310 						*pAny <<= static_cast<sal_Int16>( 0 );
311                     else if(rEntry.nWID == FN_UNO_IS_NUMBER)
312 						*pAny <<= false;
313                     // --> OD 2008-07-14 #i91601#
314                     else if ( rEntry.nWID == FN_UNO_LIST_ID )
315                     {
316                         *pAny <<= OUString();
317                     }
318                     // <--
319                     else /*if(rEntry.nWID == UNO_NAME_PARA_IS_NUMBERING_RESTART)*/
320 						*pAny <<= false;
321 				}
322 			}
323 			//PROPERTY_MAYBEVOID!
324 		}
325 		break;
326 		case FN_UNO_NUM_RULES  :
327 			if( pAny )
328 				getNumberingProperty(rPam, eNewState, pAny);
329 			else
330 			{
331 				if( !rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() ) )
332 					eNewState = PropertyState_DEFAULT_VALUE;
333 			}
334 			break;
335 		case FN_UNO_DOCUMENT_INDEX_MARK:
336 		{
337             ::std::vector<SwTxtAttr *> const marks(
338                 rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
339                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_TOXMARK));
340             if (marks.size())
341             {
342 				if( pAny )
343                 {   // hmm... can only return 1 here
344                     SwTOXMark & rMark =
345                         static_cast<SwTOXMark &>((*marks.begin())->GetAttr());
346                     const uno::Reference< text::XDocumentIndexMark > xRef =
347                         SwXDocumentIndexMark::CreateXDocumentIndexMark(
348                             *rPam.GetDoc(),
349                             *const_cast<SwTOXType*>(rMark.GetTOXType()), rMark);
350                     (*pAny) <<= xRef;
351 				}
352 			}
353 			else
354 				//auch hier - nicht zu unterscheiden
355 				eNewState = PropertyState_DEFAULT_VALUE;
356 		}
357 		break;
358 		case FN_UNO_DOCUMENT_INDEX:
359 		{
360 			const SwTOXBase* pBase = rPam.GetDoc()->GetCurTOX(
361 													*rPam.Start() );
362 			if( pBase )
363 			{
364 				if( pAny )
365 				{
366                     const uno::Reference< text::XDocumentIndex > xRef =
367                         SwXDocumentIndex::CreateXDocumentIndex(*rPam.GetDoc(),
368                             *static_cast<SwTOXBaseSection const*>(pBase));
369                     (*pAny) <<= xRef;
370 				}
371 			}
372 			else
373 				eNewState = PropertyState_DEFAULT_VALUE;
374 		}
375 		break;
376 		case FN_UNO_TEXT_FIELD:
377 		{
378 			const SwPosition *pPos = rPam.Start();
379 			const SwTxtNode *pTxtNd =
380 				rPam.GetDoc()->GetNodes()[pPos->nNode.GetIndex()]->GetTxtNode();
381             SwTxtAttr *const pTxtAttr = (pTxtNd)
382                 ? pTxtNd->GetTxtAttrForCharAt(
383                         pPos->nContent.GetIndex(), RES_TXTATR_FIELD)
384                 : 0;
385 			if(pTxtAttr)
386 			{
387 				if( pAny )
388                 {
389                     SwXTextField* pField = SwXTextField::CreateSwXTextField(*rPam.GetDoc(),
390                            pTxtAttr->GetFld());
391                     *pAny <<= uno::Reference< XTextField >( pField );
392                 }
393             }
394 			else
395 				eNewState = PropertyState_DEFAULT_VALUE;
396 		}
397 		break;
398 /*				laesst sich nicht feststellen
399 * 				case FN_UNO_BOOKMARK:
400 		{
401 			if()
402 			{
403 				uno::Reference< XBookmark >  xBkm = SwXBookmarks::GetObject(rBkm);
404 				rAny.set(&xBkm, ::getCppuType((const XBookmark*)0)());
405 			}
406 		}
407 		break;*/
408 		case FN_UNO_TEXT_TABLE:
409 		case FN_UNO_CELL:
410 		{
411             SwStartNode* pSttNode = rPam.GetNode()->StartOfSectionNode();
412 			SwStartNodeType eType = pSttNode->GetStartNodeType();
413 			if(SwTableBoxStartNode == eType)
414 			{
415 				if( pAny )
416 				{
417 					const SwTableNode* pTblNode = pSttNode->FindTableNode();
418 					SwFrmFmt* pTableFmt = (SwFrmFmt*)pTblNode->GetTable().GetFrmFmt();
419 					//SwTable& rTable = ((SwTableNode*)pSttNode)->GetTable();
420                     if(FN_UNO_TEXT_TABLE == rEntry.nWID)
421 					{
422 						uno::Reference< XTextTable >  xTable = SwXTextTables::GetObject(*pTableFmt);
423 						pAny->setValue(&xTable, ::getCppuType((uno::Reference<XTextTable>*)0));
424 					}
425 					else
426 					{
427 						SwTableBox* pBox = pSttNode->GetTblBox();
428 						uno::Reference< XCell >  xCell = SwXCell::CreateXCell(pTableFmt, pBox);
429 						pAny->setValue(&xCell, ::getCppuType((uno::Reference<XCell>*)0));
430 					}
431 				}
432 			}
433 			else
434 				eNewState = PropertyState_DEFAULT_VALUE;
435 		}
436 		break;
437 		case FN_UNO_TEXT_FRAME:
438 		{
439             SwStartNode* pSttNode = rPam.GetNode()->StartOfSectionNode();
440 			SwStartNodeType eType = pSttNode->GetStartNodeType();
441 
442 			SwFrmFmt* pFmt;
443 			if(eType == SwFlyStartNode && 0 != (pFmt = pSttNode->GetFlyFmt()))
444 			{
445 				if( pAny )
446 				{
447 					uno::Reference< XTextFrame >  xFrm = (SwXTextFrame*) SwXFrames::GetObject(*pFmt, FLYCNTTYPE_FRM);
448 					pAny->setValue(&xFrm, ::getCppuType((uno::Reference<XTextFrame>*)0));
449 				}
450 			}
451 			else
452 				eNewState = PropertyState_DEFAULT_VALUE;
453 		}
454 		break;
455 		case FN_UNO_TEXT_SECTION:
456 		{
457 			SwSection* pSect = rPam.GetDoc()->GetCurrSection(*rPam.GetPoint());
458 			if(pSect)
459 			{
460 				if( pAny )
461 				{
462 					uno::Reference< XTextSection >  xSect = SwXTextSections::GetObject( *pSect->GetFmt() );
463 					pAny->setValue(&xSect, ::getCppuType((uno::Reference<XTextSection>*)0) );
464 				}
465 			}
466 			else
467 				eNewState = PropertyState_DEFAULT_VALUE;
468 		}
469 		break;
470 		case FN_UNO_ENDNOTE:
471 		case FN_UNO_FOOTNOTE:
472 		{
473             SwTxtAttr *const pTxtAttr =
474                 rPam.GetNode()->GetTxtNode()->GetTxtAttrForCharAt(
475                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_FTN);
476 			if(pTxtAttr)
477 			{
478 				const SwFmtFtn& rFtn = pTxtAttr->GetFtn();
479                 if(rFtn.IsEndNote() == (FN_UNO_ENDNOTE == rEntry.nWID))
480 				{
481 					if( pAny )
482 					{
483                         const uno::Reference< text::XFootnote > xFootnote =
484                             SwXFootnote::CreateXFootnote(*rPam.GetDoc(), rFtn);
485                         *pAny <<= xFootnote;
486 					}
487 				}
488 				else
489 					eNewState = PropertyState_DEFAULT_VALUE;
490 			}
491 			else
492 				eNewState = PropertyState_DEFAULT_VALUE;
493 		}
494 		break;
495 		case FN_UNO_REFERENCE_MARK:
496         {
497             ::std::vector<SwTxtAttr *> const marks(
498                 rPam.GetNode()->GetTxtNode()->GetTxtAttrsAt(
499                     rPam.GetPoint()->nContent.GetIndex(), RES_TXTATR_REFMARK));
500             if (marks.size())
501             {
502 				if( pAny )
503                 {   // hmm... can only return 1 here
504                     const SwFmtRefMark& rRef = (*marks.begin())->GetRefMark();
505 					uno::Reference< XTextContent >  xRef = SwXReferenceMarks::GetObject( rPam.GetDoc(), &rRef );
506 					pAny->setValue(&xRef, ::getCppuType((uno::Reference<XTextContent>*)0));
507 				}
508 			}
509 			else
510 				eNewState = PropertyState_DEFAULT_VALUE;
511 		}
512 		break;
513         case FN_UNO_NESTED_TEXT_CONTENT:
514         {
515             uno::Reference<XTextContent> const xRet(
516                 GetNestedTextContent(*rPam.GetNode()->GetTxtNode(),
517                     rPam.GetPoint()->nContent.GetIndex(), false));
518             if (xRet.is())
519             {
520                 if (pAny)
521                 {
522                     (*pAny) <<= xRet;
523                 }
524             }
525             else
526             {
527                 eNewState = PropertyState_DEFAULT_VALUE;
528             }
529         }
530         break;
531         case FN_UNO_CHARFMT_SEQUENCE:
532         {
533 
534             SwTxtNode* pTxtNode;
535             if((pTxtNode = (SwTxtNode*)rPam.GetNode( sal_True )) == rPam.GetNode(sal_False) &&
536                     pTxtNode->GetpSwpHints())
537             {
538                 sal_uInt16 nPaMStart = rPam.GetPoint()->nContent.GetIndex();
539                 sal_uInt16 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart;
540                 if(nPaMStart > nPaMEnd)
541                 {
542                     sal_uInt16 nTmp = nPaMStart;
543                     nPaMStart = nPaMEnd;
544                     nPaMEnd = nTmp;
545                 }
546                 Sequence< ::rtl::OUString> aCharStyles;
547                 SwpHints* pHints = pTxtNode->GetpSwpHints();
548                 for(sal_uInt16 nAttr = 0; nAttr < pHints->GetStartCount(); nAttr++ )
549                 {
550                     SwTxtAttr* pAttr = pHints->GetStart( nAttr );
551                     if(pAttr->Which() != RES_TXTATR_CHARFMT)
552                         continue;
553                     sal_uInt16 nAttrStart = *pAttr->GetStart();
554                     sal_uInt16 nAttrEnd = *pAttr->GetEnd();
555                     //check if the attribute touches the selection
556                     if( ( nAttrEnd > nPaMStart && nAttrStart < nPaMEnd ) ||
557                         ( !nAttrStart && !nAttrEnd && !nPaMStart && !nPaMEnd ) )
558                     {
559                         //check for overlapping
560                         if(nAttrStart > nPaMStart ||
561                                     nAttrEnd < nPaMEnd)
562                         {
563                             aCharStyles.realloc(0);
564                             eNewState = PropertyState_AMBIGUOUS_VALUE;
565                             break;
566                         }
567                         else
568                         {
569                             //now the attribute should start before or at the selection
570                             //and it should end at the end of the selection or behind
571                             DBG_ASSERT(nAttrStart <= nPaMStart && nAttrEnd >=nPaMEnd,
572                                     "attribute overlaps or is outside");
573                             //now the name of the style has to be added to the sequence
574                             aCharStyles.realloc(aCharStyles.getLength() + 1);
575                             DBG_ASSERT(pAttr->GetCharFmt().GetCharFmt(), "no character format set");
576                             aCharStyles.getArray()[aCharStyles.getLength() - 1] =
577                                         SwStyleNameMapper::GetProgName(
578                                             pAttr->GetCharFmt().GetCharFmt()->GetName(), nsSwGetPoolIdFromName::GET_POOLID_CHRFMT);
579                         }
580                     }
581 
582                 }
583                 eNewState =
584                     aCharStyles.getLength() ?
585                         PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;;
586                 if(pAny)
587                     (*pAny) <<= aCharStyles;
588             }
589             else
590                 eNewState = PropertyState_DEFAULT_VALUE;
591         }
592         break;
593 		case RES_TXTATR_CHARFMT:
594 		// kein break hier!
595 		default: bDone = sal_False;
596 	}
597 	if( bDone )
598 		eState = eNewState;
599 	return bDone;
600 };
601 /* -----------------30.06.98 10:30-------------------
602  *
603  * --------------------------------------------------*/
604 sal_Int16 IsNodeNumStart(SwPaM& rPam, PropertyState& eState)
605 {
606 	const SwTxtNode* pTxtNd = rPam.GetNode()->GetTxtNode();
607     // --> OD 2008-02-28 #refactorlists#
608     // correction: check, if restart value is set at the text node and use
609     // new method <SwTxtNode::GetAttrListRestartValue()> to retrieve the value
610     if ( pTxtNd && pTxtNd->GetNumRule() && pTxtNd->IsListRestart() &&
611          pTxtNd->HasAttrListRestartValue() )
612 	{
613 		eState = PropertyState_DIRECT_VALUE;
614         sal_Int16 nTmp = sal::static_int_cast< sal_Int16 >(pTxtNd->GetAttrListRestartValue());
615         return nTmp;
616 	}
617     // <--
618 	eState = PropertyState_DEFAULT_VALUE;
619 	return -1;
620 }
621 
622 /* -----------------25.05.98 11:41-------------------
623  *
624  * --------------------------------------------------*/
625 void setNumberingProperty(const Any& rValue, SwPaM& rPam)
626 {
627     uno::Reference<XIndexReplace> xIndexReplace;
628     if(rValue >>= xIndexReplace)
629 	{
630 		SwXNumberingRules* pSwNum = 0;
631 
632         uno::Reference<XUnoTunnel> xNumTunnel(xIndexReplace, UNO_QUERY);
633 		if(xNumTunnel.is())
634 		{
635 			pSwNum = reinterpret_cast< SwXNumberingRules * >(
636 				sal::static_int_cast< sal_IntPtr >( xNumTunnel->getSomething( SwXNumberingRules::getUnoTunnelId() )));
637 		}
638 
639 		if(pSwNum)
640 		{
641             SwDoc* pDoc = rPam.GetDoc();
642 			if(pSwNum->GetNumRule())
643 			{
644 				SwNumRule aRule(*pSwNum->GetNumRule());
645 				const String* pNewCharStyles =  pSwNum->GetNewCharStyleNames();
646 				const String* pBulletFontNames = pSwNum->GetBulletFontNames();
647 				for(sal_uInt16 i = 0; i < MAXLEVEL; i++)
648 				{
649 					SwNumFmt aFmt(aRule.Get( i ));
650 					if( pNewCharStyles[i].Len() &&
651 						pNewCharStyles[i] != SwXNumberingRules::GetInvalidStyle() &&
652 						(!aFmt.GetCharFmt() || pNewCharStyles[i] != aFmt.GetCharFmt()->GetName()))
653 					{
654 						if(!pNewCharStyles[i].Len())
655 							aFmt.SetCharFmt(0);
656 						else
657 						{
658 
659                             // CharStyle besorgen und an der Rule setzen
660 							sal_uInt16 nChCount = pDoc->GetCharFmts()->Count();
661 							SwCharFmt* pCharFmt = 0;
662                             for(sal_uInt16 nCharFmt = 0; nCharFmt < nChCount; nCharFmt++)
663 							{
664                                 SwCharFmt& rChFmt = *((*(pDoc->GetCharFmts()))[nCharFmt]);;
665 								if(rChFmt.GetName() == pNewCharStyles[i])
666 								{
667 									pCharFmt = &rChFmt;
668 									break;
669 								}
670 							}
671 
672 							if(!pCharFmt)
673 							{
674 								SfxStyleSheetBasePool* pPool = pDoc->GetDocShell()->GetStyleSheetPool();
675 								SfxStyleSheetBase* pBase;
676 								pBase = pPool->Find(pNewCharStyles[i], SFX_STYLE_FAMILY_CHAR);
677 							// soll das wirklich erzeugt werden?
678 								if(!pBase)
679 									pBase = &pPool->Make(pNewCharStyles[i], SFX_STYLE_FAMILY_PAGE);
680 								pCharFmt = ((SwDocStyleSheet*)pBase)->GetCharFmt();
681 							}
682 							if(pCharFmt)
683 								aFmt.SetCharFmt(pCharFmt);
684 						}
685 					}
686 					//jetzt nochmal fuer Fonts
687 					if(
688 					   pBulletFontNames[i] != SwXNumberingRules::GetInvalidStyle() &&
689 					   (
690 					    (pBulletFontNames[i].Len() && !aFmt.GetBulletFont()) ||
691 					    (pBulletFontNames[i].Len() &&
692 							aFmt.GetBulletFont()->GetName() != pBulletFontNames[i])
693 					   )
694 					  )
695 					{
696 						const SvxFontListItem* pFontListItem =
697 								(const SvxFontListItem* )pDoc->GetDocShell()
698 													->GetItem( SID_ATTR_CHAR_FONTLIST );
699 						const FontList*	 pList = pFontListItem->GetFontList();
700 
701 						FontInfo aInfo = pList->Get(
702 							pBulletFontNames[i],WEIGHT_NORMAL, ITALIC_NONE);
703 						Font aFont(aInfo);
704 						aFmt.SetBulletFont(&aFont);
705 					}
706 					aRule.Set( i, aFmt );
707 				}
708                 UnoActionContext aAction(pDoc);
709 
710                 if( rPam.GetNext() != &rPam )           // Mehrfachselektion ?
711 				{
712                     pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
713 					SwPamRanges aRangeArr( rPam );
714 					SwPaM aPam( *rPam.GetPoint() );
715 					for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
716                     {
717                         // --> OD 2008-03-17 #refactorlists#
718                         // no start of a new list
719                         pDoc->SetNumRule( aRangeArr.SetPam( n, aPam ), aRule, false );
720                         // <--
721                     }
722                     pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
723                 }
724                 else
725                 {
726                     // --> OD 2008-03-17 #refactorlists#
727                     // no start of a new list
728                     pDoc->SetNumRule( rPam, aRule, false );
729                     // <--
730                 }
731 
732 
733 			}
734 			else if(pSwNum->GetCreatedNumRuleName().Len())
735 			{
736 				UnoActionContext aAction(pDoc);
737 				SwNumRule* pRule = pDoc->FindNumRulePtr( pSwNum->GetCreatedNumRuleName() );
738 				if(!pRule)
739 					throw RuntimeException();
740                 // --> OD 2008-03-17 #refactorlists#
741                 // no start of a new list
742                 pDoc->SetNumRule( rPam, *pRule, false );
743                 // <--
744 			}
745             // --> OD 2009-08-18 #i103817#
746             // outline numbering
747             else
748             {
749                 UnoActionContext aAction(pDoc);
750                 SwNumRule* pRule = pDoc->GetOutlineNumRule();
751                 if(!pRule)
752                     throw RuntimeException();
753                 pDoc->SetNumRule( rPam, *pRule, false );
754             }
755             // <--
756 		}
757 	}
758     else if(rValue.getValueType() == ::getVoidCppuType())
759     {
760         rPam.GetDoc()->DelNumRules(rPam);
761     }
762 }
763 
764 
765 /* -----------------25.05.98 11:40-------------------
766  *
767  * --------------------------------------------------*/
768 void  getNumberingProperty(SwPaM& rPam, PropertyState& eState, Any * pAny )
769 {
770 	const SwNumRule* pNumRule = rPam.GetDoc()->GetCurrNumRule( *rPam.GetPoint() );
771 	if(pNumRule)
772 	{
773 		uno::Reference< XIndexReplace >  xNum = new SwXNumberingRules(*pNumRule);
774 		if ( pAny )
775 			pAny->setValue(&xNum, ::getCppuType((const uno::Reference<XIndexReplace>*)0));
776 		eState = PropertyState_DIRECT_VALUE;
777 	}
778 	else
779 		eState = PropertyState_DEFAULT_VALUE;
780 }
781 /* -----------------04.07.98 15:15-------------------
782  *
783  * --------------------------------------------------*/
784 void GetCurPageStyle(SwPaM& rPaM, String &rString)
785 {
786 	const SwPageFrm* pPage = rPaM.GetCntntNode()->getLayoutFrm(rPaM.GetDoc()->GetCurrentLayout())->FindPageFrm();
787 	if(pPage)
788 		SwStyleNameMapper::FillProgName( pPage->GetPageDesc()->GetName(), rString, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC, sal_True );
789 }
790 /* -----------------30.03.99 10:52-------------------
791  * spezielle Properties am Cursor zuruecksetzen
792  * --------------------------------------------------*/
793 void resetCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry, SwPaM& rPam)
794 {
795 	SwDoc* pDoc = rPam.GetDoc();
796     switch(rEntry.nWID)
797 	{
798 		case FN_UNO_PARA_STYLE :
799 //			lcl_SetTxtFmtColl(aValue, pUnoCrsr);
800 		break;
801 		case FN_UNO_PAGE_STYLE :
802 		break;
803 		case FN_UNO_NUM_START_VALUE  :
804 		{
805 			UnoActionContext aAction(pDoc);
806 
807 			if( rPam.GetNext() != &rPam )			// Mehrfachselektion ?
808             {
809                 pDoc->GetIDocumentUndoRedo().StartUndo( UNDO_START, NULL );
810 				SwPamRanges aRangeArr( rPam );
811 				SwPaM aPam( *rPam.GetPoint() );
812 				for( sal_uInt16 n = 0; n < aRangeArr.Count(); ++n )
813 					pDoc->SetNodeNumStart( *aRangeArr.SetPam( n, aPam ).GetPoint(), 1 );
814                 pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_END, NULL );
815             }
816             else
817 				pDoc->SetNodeNumStart( *rPam.GetPoint(), 0 );
818 		}
819 
820 		break;
821 		case FN_UNO_NUM_LEVEL  :
822 		break;
823 		case FN_UNO_NUM_RULES:
824 //    		lcl_setNumberingProperty(aValue, pUnoCrsr);
825 		break;
826         case FN_UNO_CHARFMT_SEQUENCE:
827         {
828             SvUShortsSort aWhichIds;
829             aWhichIds.Insert(RES_TXTATR_CHARFMT);
830             pDoc->ResetAttrs(rPam, sal_True, &aWhichIds);
831         }
832         break;
833     }
834 }
835 /* -----------------21.07.98 11:36-------------------
836  *
837  * --------------------------------------------------*/
838 void InsertFile(SwUnoCrsr* pUnoCrsr,
839     const String& rURL,
840     const uno::Sequence< beans::PropertyValue >& rOptions
841     ) throw( lang::IllegalArgumentException, io::IOException, uno::RuntimeException )
842 {
843 	SfxMedium* pMed = 0;
844 	SwDoc* pDoc = pUnoCrsr->GetDoc();
845 	SwDocShell* pDocSh = pDoc->GetDocShell();
846     comphelper::MediaDescriptor aMediaDescriptor( rOptions );
847     ::rtl::OUString sFileName = rURL;
848     ::rtl::OUString sFilterName, sFilterOptions, sPassword, sBaseURL;
849     uno::Reference < io::XStream > xStream;
850     uno::Reference < io::XInputStream > xInputStream;
851 
852     if( !sFileName.getLength() )
853         aMediaDescriptor[comphelper::MediaDescriptor::PROP_URL()] >>= sFileName;
854     if( !sFileName.getLength() )
855         aMediaDescriptor[comphelper::MediaDescriptor::PROP_FILENAME()] >>= sFileName;
856     aMediaDescriptor[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
857     aMediaDescriptor[comphelper::MediaDescriptor::PROP_STREAM()] >>= xStream;
858     aMediaDescriptor[comphelper::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
859     aMediaDescriptor[comphelper::MediaDescriptor::PROP_FILTERNAME()] >>= sFilterName;
860     aMediaDescriptor[comphelper::MediaDescriptor::PROP_FILTEROPTIONS()] >>= sFilterOptions;
861     aMediaDescriptor[comphelper::MediaDescriptor::PROP_PASSWORD()] >>= sPassword;
862     aMediaDescriptor[comphelper::MediaDescriptor::PROP_DOCUMENTBASEURL() ] >>= sBaseURL;
863     if ( !xInputStream.is() && xStream.is() )
864         xInputStream = xStream->getInputStream();
865 
866     if(!pDocSh || (!sFileName.getLength() && !xInputStream.is()))
867 		return;
868 
869     SfxObjectFactory& rFact = pDocSh->GetFactory();
870     const SfxFilter* pFilter = rFact.GetFilterContainer()->GetFilter4FilterName( sFilterName );
871     uno::Reference < embed::XStorage > xReadStorage;
872     if( xInputStream.is() )
873     {
874         uno::Sequence< uno::Any > aArgs( 2 );
875         aArgs[0] <<= xInputStream;
876         aArgs[1] <<= embed::ElementModes::READ;
877         try
878         {
879             xReadStorage = uno::Reference< embed::XStorage >(
880                             ::comphelper::OStorageHelper::GetStorageFactory()->createInstanceWithArguments( aArgs ),
881                             uno::UNO_QUERY );
882         }
883         catch( const io::IOException& rEx)
884         {
885             (void)rEx;
886         }
887     }
888     if ( !pFilter )
889 	{
890         if( xInputStream.is() && !xReadStorage.is())
891         {
892             pMed = new SfxMedium;
893             pMed->setStreamToLoadFrom(xInputStream, sal_True );
894         }
895         else
896             pMed = xReadStorage.is() ?
897                 new SfxMedium(xReadStorage, sBaseURL, 0 ) :
898                 new SfxMedium(sFileName, STREAM_READ, sal_True, 0, 0 );
899         if( sBaseURL.getLength() )
900             pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
901 
902 		SfxFilterMatcher aMatcher( rFact.GetFilterContainer()->GetName() );
903 		ErrCode nErr = aMatcher.GuessFilter( *pMed, &pFilter, sal_False );
904 		if ( nErr || !pFilter)
905 			DELETEZ(pMed);
906 		else
907 			pMed->SetFilter( pFilter );
908 	}
909 	else
910 	{
911         if(!pMed)
912         {
913             if( xInputStream.is() && !xReadStorage.is())
914             {
915                 pMed = new SfxMedium;
916                 pMed->setStreamToLoadFrom(xInputStream, sal_True );
917                 pMed->SetFilter( pFilter );
918             }
919             else
920             {
921                 if( xReadStorage.is() )
922                 {
923                     pMed = new SfxMedium(xReadStorage, sBaseURL, 0 );
924                     pMed->SetFilter( pFilter );
925                 }
926                 else
927                     pMed = new SfxMedium(sFileName, STREAM_READ, sal_True, pFilter, 0);
928             }
929         }
930         if(sFilterOptions.getLength())
931             pMed->GetItemSet()->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sFilterOptions ) );
932         if( sBaseURL.getLength())
933             pMed->GetItemSet()->Put( SfxStringItem( SID_DOC_BASEURL, sBaseURL ) );
934 	}
935 
936 	if( !pMed )
937 		return;
938 
939     // this sourcecode is not responsible for the lifetime of the shell, SfxObjectShellLock should not be used
940 	SfxObjectShellRef aRef( pDocSh );
941 
942 	pDocSh->RegisterTransfer( *pMed );
943 	pMed->DownLoad();	// ggfs. den DownLoad anstossen
944 	if( aRef.Is() && 1 < aRef->GetRefCount() )	// noch gueltige Ref?
945 	{
946 		SwReader* pRdr;
947 		SfxItemSet* pSet = 	pMed->GetItemSet();
948 		pSet->Put(SfxBoolItem(FN_API_CALL, sal_True));
949         if(sPassword.getLength())
950             pSet->Put(SfxStringItem(SID_PASSWORD, sPassword));
951 		Reader *pRead = pDocSh->StartConvertFrom( *pMed, &pRdr, 0, pUnoCrsr);
952 		if( pRead )
953 		{
954 
955 			UnoActionContext aContext(pDoc);
956 
957 			if(pUnoCrsr->HasMark())
958 				pDoc->DeleteAndJoin(*pUnoCrsr);
959 
960 			SwNodeIndex aSave(  pUnoCrsr->GetPoint()->nNode, -1 );
961 			xub_StrLen nCntnt = pUnoCrsr->GetPoint()->nContent.GetIndex();
962 
963             sal_uInt32 nErrno = pRdr->Read( *pRead );   // und Dokument einfuegen
964 
965 			if(!nErrno)
966 			{
967 				aSave++;
968 				pUnoCrsr->SetMark();
969 				pUnoCrsr->GetMark()->nNode = aSave;
970 
971 				SwCntntNode* pCntNode = aSave.GetNode().GetCntntNode();
972 				if( !pCntNode )
973 					nCntnt = 0;
974 				pUnoCrsr->GetMark()->nContent.Assign( pCntNode, nCntnt );
975 			}
976 
977 			delete pRdr;
978 
979 			// ggfs. alle Verzeichnisse updaten:
980 /*			if( pWrtShell->IsUpdateTOX() )
981 			{
982 				SfxRequest aReq( *this, FN_UPDATE_TOX );
983 				Execute( aReq );
984 				pWrtShell->SetUpdateTOX( sal_False );		// wieder zurueck setzen
985 			}*/
986 
987 		}
988 	}
989 	delete pMed;
990 }
991 
992 /* -----------------14.07.04 ------------------------
993  *
994  * --------------------------------------------------*/
995 
996 // insert text and scan for CR characters in order to insert
997 // paragraph breaks at those positions by calling SplitNode
998 sal_Bool DocInsertStringSplitCR(
999         SwDoc &rDoc,
1000         const SwPaM &rNewCursor, const String &rText,
1001         const bool bForceExpandHints )
1002 {
1003     sal_Bool bOK = sal_True;
1004 
1005         const enum IDocumentContentOperations::InsertFlags nInsertFlags =
1006             (bForceExpandHints)
1007             ? static_cast<IDocumentContentOperations::InsertFlags>(
1008                     IDocumentContentOperations::INS_FORCEHINTEXPAND |
1009                     IDocumentContentOperations::INS_EMPTYEXPAND)
1010             : IDocumentContentOperations::INS_EMPTYEXPAND;
1011 
1012     // grouping done in InsertString is intended for typing, not API calls
1013     ::sw::GroupUndoGuard const undoGuard(rDoc.GetIDocumentUndoRedo());
1014     OUString aTxt;
1015     xub_StrLen nStartIdx = 0;
1016     SwTxtNode* const pTxtNd =
1017         rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode();
1018     const xub_StrLen nMaxLength = ( pTxtNd )
1019         ? STRING_LEN - pTxtNd->GetTxt().Len()
1020         : STRING_LEN;
1021     xub_StrLen nIdx = rText.Search( '\r', nStartIdx );
1022     if( ( nIdx == STRING_NOTFOUND && nMaxLength < rText.Len() ) ||
1023         ( nIdx != STRING_NOTFOUND && nMaxLength < nIdx ) )
1024     {
1025         nIdx = nMaxLength;
1026     }
1027     while (nIdx != STRING_NOTFOUND )
1028     {
1029         DBG_ASSERT( nIdx - nStartIdx >= 0, "index negative!" );
1030         aTxt = rText.Copy( nStartIdx, nIdx - nStartIdx );
1031         if (aTxt.getLength() &&
1032             !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
1033         {
1034             DBG_ERROR( "Doc->Insert(Str) failed." );
1035             bOK = sal_False;
1036         }
1037         if (!rDoc.SplitNode( *rNewCursor.GetPoint(), false ) )
1038         {
1039             DBG_ERROR( "SplitNode failed" );
1040             bOK = sal_False;
1041         }
1042         nStartIdx = nIdx + 1;
1043         nIdx = rText.Search( '\r', nStartIdx );
1044     }
1045     aTxt = rText.Copy( nStartIdx );
1046     if (aTxt.getLength() &&
1047         !rDoc.InsertString( rNewCursor, aTxt, nInsertFlags ))
1048     {
1049         DBG_ERROR( "Doc->Insert(Str) failed." );
1050         bOK = sal_False;
1051     }
1052 
1053     return bOK;
1054 }
1055 /*-- 10.03.2008 09:58:47---------------------------------------------------
1056 
1057   -----------------------------------------------------------------------*/
1058 void makeRedline( SwPaM& rPaM,
1059     const ::rtl::OUString& rRedlineType,
1060     const uno::Sequence< beans::PropertyValue >& rRedlineProperties )
1061         throw (lang::IllegalArgumentException, uno::RuntimeException)
1062 {
1063     IDocumentRedlineAccess* pRedlineAccess = rPaM.GetDoc();
1064 
1065     RedlineType_t eType = nsRedlineType_t::REDLINE_INSERT;
1066     if( rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Delete" ) ))
1067         eType = nsRedlineType_t::REDLINE_DELETE;
1068     else if( rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Format" ) ))
1069         eType = nsRedlineType_t::REDLINE_FORMAT;
1070     else if( rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "TextTable" ) ))
1071         eType = nsRedlineType_t::REDLINE_TABLE;
1072     else if( !rRedlineType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( "Insert" ) ))
1073         throw lang::IllegalArgumentException();
1074 
1075     //todo: what about REDLINE_FMTCOLL?
1076     comphelper::SequenceAsHashMap aPropMap( rRedlineProperties );
1077     uno::Any aAuthorValue;
1078     aAuthorValue = aPropMap.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("RedlineAuthor"), aAuthorValue);
1079     sal_uInt16 nAuthor = 0;
1080     ::rtl::OUString sAuthor;
1081     if( aAuthorValue >>= sAuthor )
1082         nAuthor = pRedlineAccess->InsertRedlineAuthor(sAuthor);
1083 
1084     ::rtl::OUString sComment;
1085     uno::Any aCommentValue;
1086     aCommentValue = aPropMap.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("RedlineComment"), aCommentValue);
1087 
1088     SwRedlineData aRedlineData( eType, nAuthor );
1089     if( aCommentValue >>= sComment )
1090         aRedlineData.SetComment( sComment );
1091 
1092     ::util::DateTime aStamp;
1093     uno::Any aDateTimeValue;
1094     aDateTimeValue = aPropMap.getUnpackedValueOrDefault( ::rtl::OUString::createFromAscii("RedlineDateTime"), aDateTimeValue);
1095     if( aDateTimeValue >>= aStamp )
1096     {
1097        aRedlineData.SetTimeStamp(
1098         DateTime( Date( aStamp.Day, aStamp.Month, aStamp.Year ), Time( aStamp.Hours, aStamp.Minutes, aStamp.Seconds ) ) );
1099     }
1100 
1101     SwRedline* pRedline = new SwRedline( aRedlineData, rPaM );
1102     RedlineMode_t nPrevMode = pRedlineAccess->GetRedlineMode( );
1103 
1104     pRedlineAccess->SetRedlineMode_intern(nsRedlineMode_t::REDLINE_ON);
1105     bool bRet = pRedlineAccess->AppendRedline( pRedline, false );
1106     pRedlineAccess->SetRedlineMode_intern( nPrevMode );
1107     if( !bRet )
1108         throw lang::IllegalArgumentException();
1109 }
1110 
1111 /*-- 19.02.2009 09:27:26---------------------------------------------------
1112 
1113   -----------------------------------------------------------------------*/
1114 SwAnyMapHelper::~SwAnyMapHelper()
1115 {
1116     AnyMapHelper_t::iterator aIt = begin();
1117     while( aIt != end() )
1118     {
1119         delete ( aIt->second );
1120         ++aIt;
1121     }
1122 }
1123 /*-- 19.02.2009 09:27:26---------------------------------------------------
1124 
1125   -----------------------------------------------------------------------*/
1126 void SwAnyMapHelper::SetValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any& rAny )
1127 {
1128     sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1129     AnyMapHelper_t::iterator aIt = find( nKey );
1130     if( aIt != end() )
1131     {
1132         *(aIt->second) = rAny;
1133     }
1134     else
1135         insert( value_type(nKey, new uno::Any( rAny )) );
1136 }
1137 /*-- 19.02.2009 09:27:26---------------------------------------------------
1138 
1139   -----------------------------------------------------------------------*/
1140 bool    SwAnyMapHelper::FillValue( sal_uInt16 nWhichId, sal_uInt16 nMemberId, const uno::Any*& pAny )
1141 {
1142     bool bRet = false;
1143     sal_uInt32 nKey = (nWhichId << 16) + nMemberId;
1144     AnyMapHelper_t::iterator aIt = find( nKey );
1145     if( aIt != end() )
1146     {
1147         pAny = aIt->second;
1148         bRet = true;
1149     }
1150     return bRet;
1151 }
1152 
1153 }//namespace SwUnoCursorHelper
1154 
1155