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