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