1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: unoobj.cxx,v $
10 * $Revision: 1.111.80.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
35 #include <osl/endian.h>
36 #include <rtl/ustrbuf.hxx>
37 #include <swtypes.hxx>
38 #include <hintids.hxx>
44 #include <istyleaccess.hxx>
46 #include <ndnotxt.hxx>
47 #include <unocrsrhelper.hxx>
49 #include <rootfrm.hxx>
52 #include <sfx2/linkmgr.hxx>
55 #include <tools/urlobj.hxx>
57 #include <tools/cachestr.hxx>
58 #include <shellio.hxx>
60 #include <swtblfmt.hxx>
61 #include <fmtruby.hxx>
63 #include <docstyle.hxx>
64 #include <charfmt.hxx>
67 #include <fmtpdsc.hxx>
68 #include <pagedesc.hxx>
70 #include <poolfmt.hrc>
72 #include <poolfmt.hxx>
74 #include <fchrfmt.hxx>
75 #include <fmtautofmt.hxx>
77 #include <pagefrm.hxx>
79 #include <sfx2/docfilt.hxx>
80 #include <sfx2/docfile.hxx>
81 #include <sfx2/fcontnr.hxx>
82 #include <fmtrfmrk.hxx>
83 #include <txtrfmrk.hxx>
84 #include <unoclbck.hxx>
87 #include <unosett.hxx>
88 #include <unoprnms.hxx>
90 #include <unodraw.hxx>
91 #include <unocoll.hxx>
92 #include <unostyle.hxx>
93 #include <unofield.hxx>
94 #include <unometa.hxx>
95 #include <fmtanchr.hxx>
96 #include <svx/flstitem.hxx>
97 #include <svtools/ctrltool.hxx>
100 #include <fmtftn.hxx>
101 #include <com/sun/star/text/WrapTextMode.hpp>
102 #include <com/sun/star/text/TextContentAnchorType.hpp>
103 #include <com/sun/star/style/PageStyleLayout.hpp>
104 #include <com/sun/star/text/XTextDocument.hpp>
105 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
106 #include <com/sun/star/drawing/XDrawPageSupplier.hpp>
107 #include <unoidx.hxx>
108 #include <unoframe.hxx>
109 #include <fmthdft.hxx>
110 #include <vos/mutex.hxx>
111 #include <vcl/svapp.hxx>
112 #include <fmtflcnt.hxx>
113 #define _SVSTDARR_USHORTS
114 #define _SVSTDARR_USHORTSSORT
115 #include <svtools/svstdarr.hxx>
116 #include <svx/brshitem.hxx>
117 #include <fmtclds.hxx>
118 #include <dcontact.hxx>
119 #include <SwStyleNameMapper.hxx>
120 #include <crsskip.hxx>
121 #include <com/sun/star/beans/PropertyAttribute.hpp>
125 using namespace ::com::sun::star
;
126 using namespace ::com::sun::star::uno
;
127 using namespace ::com::sun::star::lang
;
128 using namespace ::com::sun::star::uno
;
129 using namespace ::com::sun::star::text
;
130 using namespace ::com::sun::star::container
;
131 using namespace ::com::sun::star::beans
;
132 using namespace ::com::sun::star::drawing
;
134 using ::rtl::OUString
;
135 using ::rtl::OUStringBuffer
;
137 /****************************************************************************
139 ****************************************************************************/
140 uno::Sequence
< sal_Int8
> CreateUnoTunnelId()
142 static osl::Mutex aCreateMutex
;
143 osl::Guard
<osl::Mutex
> aGuard( aCreateMutex
);
144 uno::Sequence
< sal_Int8
> aSeq( 16 );
145 rtl_createUuid( (sal_uInt8
*)aSeq
.getArray(), 0, sal_True
);
148 /****************************************************************************
150 ****************************************************************************/
152 /* -----------------13.05.98 12:15-------------------
154 * --------------------------------------------------*/
155 SwUnoInternalPaM::SwUnoInternalPaM(SwDoc
& rDoc
) :
156 SwPaM(rDoc
.GetNodes())
159 SwUnoInternalPaM::~SwUnoInternalPaM()
161 while( GetNext() != this)
167 SwUnoInternalPaM
& SwUnoInternalPaM::operator=(const SwPaM
& rPaM
)
169 const SwPaM
* pTmp
= &rPaM
;
170 *GetPoint() = *rPaM
.GetPoint();
174 *GetMark() = *rPaM
.GetMark();
178 while(&rPaM
!= (pTmp
= (const SwPaM
*)pTmp
->GetNext()))
181 new SwPaM(*pTmp
->GetMark(), *pTmp
->GetPoint(), this);
183 new SwPaM(*pTmp
->GetPoint(), this);
187 /****************************************************************************
189 ****************************************************************************/
190 UnoActionContext::UnoActionContext(SwDoc
* pDc
) :
193 SwRootFrm
* pRootFrm
= pDoc
->GetRootFrm();
195 pRootFrm
->StartAllAction();
197 /*-----------------04.03.98 11:56-------------------
199 --------------------------------------------------*/
200 UnoActionContext::~UnoActionContext()
202 //das Doc kann hier schon entfernt worden sein
205 SwRootFrm
* pRootFrm
= pDoc
->GetRootFrm();
207 pRootFrm
->EndAllAction();
211 /****************************************************************************
213 ****************************************************************************/
214 UnoActionRemoveContext::UnoActionRemoveContext(SwDoc
* pDc
) :
217 SwRootFrm
* pRootFrm
= pDoc
->GetRootFrm();
219 pRootFrm
->UnoRemoveAllActions();
221 /* -----------------07.07.98 12:05-------------------
223 * --------------------------------------------------*/
224 UnoActionRemoveContext::~UnoActionRemoveContext()
226 SwRootFrm
* pRootFrm
= pDoc
->GetRootFrm();
228 pRootFrm
->UnoRestoreAllActions();
232 /*-----------------09.03.98 08:29-------------------
234 --------------------------------------------------*/
235 void SwXTextCursor::SelectPam(SwPaM
& rCrsr
, sal_Bool bExpand
)
242 else if(rCrsr
.HasMark())
247 /* -----------------20.05.98 14:59-------------------
249 * --------------------------------------------------*/
250 void SwXTextCursor::getTextFromPam(SwPaM
& aCrsr
, OUString
& rBuffer
)
254 SvCacheStream
aStream( 20480 );
256 aStream
.SetNumberFormatInt( NUMBERFORMAT_INT_BIGENDIAN
);
258 aStream
.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN
);
261 // TODO/MBA: looks like a BaseURL doesn't make sense here
262 SwReaderWriter::GetWriter( C2S(FILTER_TEXT_DLG
), String(), xWrt
);
265 SwWriter
aWriter( aStream
, aCrsr
);
266 xWrt
->bASCII_NoLastLineEnd
= sal_True
;
267 xWrt
->bExportPargraphNumbering
= sal_False
;
268 SwAsciiOptions aOpt
= xWrt
->GetAsciiOptions();
269 aOpt
.SetCharSet( RTL_TEXTENCODING_UNICODE
);
270 xWrt
->SetAsciiOptions( aOpt
);
271 xWrt
->bUCS2_WithStartChar
= FALSE
;
273 const BOOL bOldShowProgress
= xWrt
->bShowProgress
;
274 xWrt
->bShowProgress
= FALSE
;
278 if( !IsError( aWriter
.Write( xWrt
) ) &&
279 0x7ffffff > (( lLen
= aStream
.GetSize() )
280 / sizeof( sal_Unicode
)) + 1 )
282 aStream
<< (sal_Unicode
)'\0';
284 long lUniLen
= (lLen
/ sizeof( sal_Unicode
));
285 ::rtl::OUStringBuffer
aStrBuffer( lUniLen
);
287 aStream
.ResetError();
291 sal_Int32 nLocalLen
= 0;
292 if( lUniLen
>= STRING_MAXLEN
)
293 nLocalLen
= STRING_MAXLEN
- 1;
296 sal_Unicode
* pStrBuf
= sBuf
.AllocBuffer( xub_StrLen( nLocalLen
+ 1));
297 aStream
.Read( pStrBuf
, 2 * nLocalLen
);
298 pStrBuf
[ nLocalLen
] = '\0';
299 aStrBuffer
.append( pStrBuf
, nLocalLen
);
300 lUniLen
-= nLocalLen
;
302 rBuffer
= aStrBuffer
.makeStringAndClear();
304 xWrt
->bShowProgress
= bOldShowProgress
;
308 /* -----------------06.07.98 07:33-------------------
310 * --------------------------------------------------*/
311 void lcl_setCharStyle(SwDoc
* pDoc
, const uno::Any aValue
, SfxItemSet
& rSet
)
312 throw (lang::IllegalArgumentException
)
314 SwDocShell
* pDocSh
= pDoc
->GetDocShell();
320 SwStyleNameMapper::FillUIName(uStyle
, sStyle
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
, sal_True
);
321 SwDocStyleSheet
* pStyle
=
322 (SwDocStyleSheet
*)pDocSh
->GetStyleSheetPool()->Find(sStyle
, SFX_STYLE_FAMILY_CHAR
);
325 SwFmtCharFmt
aFmt(pStyle
->GetCharFmt());
330 throw lang::IllegalArgumentException();
335 /* -----------------08.06.06 10:43-------------------
337 * --------------------------------------------------*/
338 void lcl_setAutoStyle(IStyleAccess
& rStyleAccess
, const uno::Any aValue
, SfxItemSet
& rSet
, bool bPara
)
339 throw (lang::IllegalArgumentException
)
344 StylePool::SfxItemSet_Pointer_t pStyle
= bPara
?
345 rStyleAccess
.getByName(uStyle
, IStyleAccess::AUTO_STYLE_PARA
):
346 rStyleAccess
.getByName(uStyle
, IStyleAccess::AUTO_STYLE_CHAR
);
349 SwFmtAutoFmt
aFmt( bPara
? sal::static_int_cast
< USHORT
>(RES_AUTO_STYLE
)
350 : sal::static_int_cast
< USHORT
>(RES_TXTATR_AUTOFMT
) );
351 aFmt
.SetStyleHandle( pStyle
);
356 throw lang::IllegalArgumentException();
359 /* -----------------30.06.98 08:46-------------------
361 * --------------------------------------------------*/
362 void lcl_SetTxtFmtColl(const uno::Any
& rAny
, SwPaM
& rPaM
)
363 throw (lang::IllegalArgumentException
)
365 SwDoc
* pDoc
= rPaM
.GetDoc();
366 SwDocShell
* pDocSh
= pDoc
->GetDocShell();
372 SwStyleNameMapper::FillUIName(uStyle
, sStyle
, nsSwGetPoolIdFromName::GET_POOLID_TXTCOLL
, sal_True
);
373 SwDocStyleSheet
* pStyle
=
374 (SwDocStyleSheet
*)pDocSh
->GetStyleSheetPool()->Find(sStyle
, SFX_STYLE_FAMILY_PARA
);
377 SwTxtFmtColl
*pLocal
= pStyle
->GetCollection();
378 UnoActionContext
aAction(pDoc
);
379 pDoc
->StartUndo( UNDO_START
, NULL
);
380 SwPaM
*pTmpCrsr
= &rPaM
;
382 pDoc
->SetTxtFmtColl(*pTmpCrsr
, pLocal
);
383 pTmpCrsr
= static_cast<SwPaM
*>(pTmpCrsr
->GetNext());
384 } while ( pTmpCrsr
!= &rPaM
);
385 pDoc
->EndUndo( UNDO_END
, NULL
);
389 throw lang::IllegalArgumentException();
393 /* -----------------06.07.98 07:38-------------------
395 * --------------------------------------------------*/
396 void lcl_setPageDesc(SwDoc
* pDoc
, const uno::Any
& aValue
, SfxItemSet
& rSet
)
398 if(aValue
.getValueType() != ::getCppuType((const OUString
*)0))
400 SwFmtPageDesc
*pNewDesc
= 0 ;
401 const SfxPoolItem
* pItem
;
402 if(SFX_ITEM_SET
== rSet
.GetItemState( RES_PAGEDESC
, sal_True
, &pItem
) )
404 pNewDesc
= new SwFmtPageDesc(*((SwFmtPageDesc
*)pItem
));
407 pNewDesc
= new SwFmtPageDesc();
409 aValue
>>= uDescName
;
411 SwStyleNameMapper::FillUIName(uDescName
, sDescName
, nsSwGetPoolIdFromName::GET_POOLID_PAGEDESC
, sal_True
);
412 if(!pNewDesc
->GetPageDesc() || pNewDesc
->GetPageDesc()->GetName() != sDescName
)
414 sal_Bool bPut
= sal_False
;
417 SwPageDesc
* pPageDesc
= ::GetPageDescByName_Impl(*pDoc
, sDescName
);
420 pPageDesc
->Add( pNewDesc
);
425 throw lang::IllegalArgumentException();
430 rSet
.ClearItem(RES_BREAK
);
431 rSet
.Put(SwFmtPageDesc());
438 /* -----------------30.06.98 10:29-------------------
440 * --------------------------------------------------*/
441 void lcl_SetNodeNumStart( SwPaM
& rCrsr
, uno::Any aValue
)
445 sal_uInt16 nStt
= (nTmp
< 0 ? USHRT_MAX
: (sal_uInt16
)nTmp
);
446 SwDoc
* pDoc
= rCrsr
.GetDoc();
447 UnoActionContext
aAction(pDoc
);
449 if( rCrsr
.GetNext() != &rCrsr
) // Mehrfachselektion ?
451 pDoc
->StartUndo( UNDO_START
, NULL
);
452 SwPamRanges
aRangeArr( rCrsr
);
453 SwPaM
aPam( *rCrsr
.GetPoint() );
454 for( sal_uInt16 n
= 0; n
< aRangeArr
.Count(); ++n
)
456 pDoc
->SetNumRuleStart(*aRangeArr
.SetPam( n
, aPam
).GetPoint());
457 pDoc
->SetNodeNumStart(*aRangeArr
.SetPam( n
, aPam
).GetPoint(),
460 pDoc
->EndUndo( UNDO_END
, NULL
);
464 pDoc
->SetNumRuleStart( *rCrsr
.GetPoint());
465 pDoc
->SetNodeNumStart( *rCrsr
.GetPoint(), nStt
);
469 /* -----------------17.09.98 09:44-------------------
471 * --------------------------------------------------*/
472 sal_Bool
lcl_setCrsrPropertyValue(const SfxItemPropertySimpleEntry
* pEntry
,
474 SfxItemSet
& rItemSet
,
475 const uno::Any
& aValue
) throw (lang::IllegalArgumentException
)
477 sal_Bool bRet
= sal_True
;
478 if(0 == ( pEntry
->nFlags
&PropertyAttribute::MAYBEVOID
) &&
479 aValue
.getValueType() == ::getCppuVoidType())
485 case RES_TXTATR_CHARFMT
:
486 lcl_setCharStyle(rPam
.GetDoc(), aValue
, rItemSet
);
488 case RES_TXTATR_AUTOFMT
:
489 lcl_setAutoStyle(rPam
.GetDoc()->GetIStyleAccess(), aValue
, rItemSet
, false );
491 case FN_UNO_CHARFMT_SEQUENCE
:
493 Sequence
<OUString
> aCharStyles
;
494 if(aValue
>>= aCharStyles
)
496 for(sal_Int32 nStyle
= 0; nStyle
< aCharStyles
.getLength(); nStyle
++)
499 rPam
.GetDoc()->StartUndo( UNDO_START
, NULL
);
500 aStyle
<<= aCharStyles
.getConstArray()[nStyle
];
501 //create a local set and apply each format directly
502 SfxItemSet
aSet(rPam
.GetDoc()->GetAttrPool(), RES_TXTATR_CHARFMT
, RES_TXTATR_CHARFMT
);
503 lcl_setCharStyle(rPam
.GetDoc(), aStyle
, aSet
);
504 //the first style should replace the current attributes, all other have to be added
505 SwXTextCursor::SetCrsrAttr(rPam
, aSet
, nStyle
? CRSR_ATTR_MODE_DONTREPLACE
: 0);
506 rPam
.GetDoc()->EndUndo( UNDO_START
, NULL
);
513 case FN_UNO_PARA_STYLE
:
514 lcl_SetTxtFmtColl(aValue
, rPam
);
517 lcl_setAutoStyle(rPam
.GetDoc()->GetIStyleAccess(), aValue
, rItemSet
, true );
519 case FN_UNO_PAGE_STYLE
:
521 case FN_UNO_NUM_START_VALUE
:
522 lcl_SetNodeNumStart( rPam
, aValue
);
524 case FN_UNO_NUM_LEVEL
:
525 // --> OD 2008-07-14 #i91601#
528 case FN_UNO_IS_NUMBER
:
530 // multi selection is not considered
531 SwTxtNode
* pTxtNd
= rPam
.GetNode()->GetTxtNode();
532 // --> OD 2008-05-14 #refactorlists# - check on list style not needed
533 // const SwNumRule* pRule = pTxtNd->GetNumRule();
534 // if( FN_UNO_NUM_LEVEL == pEntry->nWID && pRule != NULL )
535 if ( FN_UNO_NUM_LEVEL
== pEntry
->nWID
)
538 sal_Int16 nLevel
= 0;
541 pTxtNd
->SetAttrListLevel(nLevel
);
544 // --> OD 2008-07-14 #i91601#
545 else if( FN_UNO_LIST_ID
== pEntry
->nWID
)
547 ::rtl::OUString sListId
;
549 pTxtNd
->SetListId( sListId
);
552 else if( FN_UNO_IS_NUMBER
== pEntry
->nWID
)
554 BOOL bIsNumber
= *(sal_Bool
*) aValue
.getValue();
556 pTxtNd
->SetCountedInList( false );
558 //PROPERTY_MAYBEVOID!
561 case FN_NUMBER_NEWSTART
:
563 sal_Bool bVal
= sal_False
;
565 rPam
.GetDoc()->SetNumRuleStart(*rPam
.GetPoint(), bVal
);
567 throw lang::IllegalArgumentException();
570 case FN_UNO_NUM_RULES
:
571 SwUnoCursorHelper::setNumberingProperty(aValue
, rPam
);
573 case RES_PARATR_DROP
:
575 if( MID_DROPCAP_CHAR_STYLE_NAME
== pEntry
->nMemberId
)
578 if(aValue
>>= uStyle
)
581 SwStyleNameMapper::FillUIName(uStyle
, sStyle
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
, sal_True
);
582 SwDoc
* pDoc
= rPam
.GetDoc();
583 //default character style mustn't be set as default format
584 SwDocStyleSheet
* pStyle
=
585 (SwDocStyleSheet
*)pDoc
->GetDocShell()->GetStyleSheetPool()->Find(sStyle
, SFX_STYLE_FAMILY_CHAR
);
586 SwFmtDrop
* pDrop
= 0;
588 ((SwDocStyleSheet
*)pStyle
)->GetCharFmt() != pDoc
->GetDfltCharFmt())
590 const SfxPoolItem
* pItem
;
591 if(SFX_ITEM_SET
== rItemSet
.GetItemState( RES_PARATR_DROP
, sal_True
, &pItem
) )
592 pDrop
= new SwFmtDrop(*((SwFmtDrop
*)pItem
));
594 pDrop
= new SwFmtDrop();
595 rtl::Reference
< SwDocStyleSheet
> xStyle( new SwDocStyleSheet( *(SwDocStyleSheet
*)pStyle
) );
596 pDrop
->SetCharFmt(xStyle
->GetCharFmt());
599 throw lang::IllegalArgumentException();
600 rItemSet
.Put(*pDrop
);
604 throw lang::IllegalArgumentException();
610 case RES_TXTATR_CJK_RUBY
:
611 if(MID_RUBY_CHARSTYLE
== pEntry
->nMemberId
)
616 SwFmtRuby
* pRuby
= 0;
617 const SfxPoolItem
* pItem
;
618 if(SFX_ITEM_SET
== rItemSet
.GetItemState( RES_TXTATR_CJK_RUBY
, sal_True
, &pItem
) )
619 pRuby
= new SwFmtRuby(*((SwFmtRuby
*)pItem
));
621 pRuby
= new SwFmtRuby(aEmptyStr
);
623 SwStyleNameMapper::FillUIName(sTmp
, sStyle
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
, sal_True
);
624 pRuby
->SetCharFmtName( sStyle
);
625 pRuby
->SetCharFmtId( 0 );
628 sal_uInt16 nId
= SwStyleNameMapper::GetPoolIdFromUIName( sStyle
, nsSwGetPoolIdFromName::GET_POOLID_CHRFMT
);
629 pRuby
->SetCharFmtId(nId
);
631 rItemSet
.Put(*pRuby
);
635 throw lang::IllegalArgumentException();
642 if(MID_PAGEDESC_PAGEDESCNAME
== pEntry
->nMemberId
)
644 lcl_setPageDesc(rPam
.GetDoc(), aValue
, rItemSet
);
648 default: bRet
= sal_False
;
654 /* -----------------30.06.98 08:39-------------------
656 * --------------------------------------------------*/
657 SwFmtColl
* SwXTextCursor::GetCurTxtFmtColl(SwPaM
& rPaM
, BOOL bConditional
)
659 static const sal_uInt16 nMaxLookup
= 1000;
662 // if ( GetCrsrCnt() > nMaxLookup )
664 sal_Bool bError
= sal_False
;
665 SwPaM
*pTmpCrsr
= &rPaM
;
668 ULONG nSttNd
= pTmpCrsr
->GetMark()->nNode
.GetIndex();
669 ULONG nEndNd
= pTmpCrsr
->GetPoint()->nNode
.GetIndex();
670 xub_StrLen nSttCnt
= pTmpCrsr
->GetMark()->nContent
.GetIndex();
671 xub_StrLen nEndCnt
= pTmpCrsr
->GetPoint()->nContent
.GetIndex();
673 if( nSttNd
> nEndNd
|| ( nSttNd
== nEndNd
&& nSttCnt
> nEndCnt
))
675 sal_uInt32 nTmp
= nSttNd
; nSttNd
= nEndNd
; nEndNd
= nTmp
;
676 nTmp
= nSttCnt
; nSttCnt
= nEndCnt
; nEndCnt
= (sal_uInt16
)nTmp
;
679 if( nEndNd
- nSttNd
>= nMaxLookup
)
685 const SwNodes
& rNds
= rPaM
.GetDoc()->GetNodes();
686 for( ULONG n
= nSttNd
; n
<= nEndNd
; ++n
)
688 const SwTxtNode
* pNd
= rNds
[ n
]->GetTxtNode();
691 SwFmtColl
* pNdFmt
= bConditional
? pNd
->GetFmtColl()
692 : &pNd
->GetAnyFmtColl();
695 else if( pFmt
!= pNdFmt
)
705 pTmpCrsr
= static_cast<SwPaM
*>(pTmpCrsr
->GetNext());
706 } while ( pTmpCrsr
!= &rPaM
);
707 return bError
? 0 : pFmt
;
710 /* -----------------26.06.98 16:20-------------------
711 * Hilfsfunktion fuer PageDesc
712 * --------------------------------------------------*/
713 SwPageDesc
* GetPageDescByName_Impl(SwDoc
& rDoc
, const String
& rName
)
715 SwPageDesc
* pRet
= 0;
716 sal_uInt16 nDCount
= rDoc
.GetPageDescCnt();
719 for( i
= 0; i
< nDCount
; i
++ )
721 SwPageDesc
* pDsc
= &rDoc
._GetPageDesc( i
);
722 if(pDsc
->GetName() == rName
)
730 for(i
= RC_POOLPAGEDESC_BEGIN
; i
<= STR_POOLPAGE_LANDSCAPE
; ++i
)
732 const String
aFmtName(SW_RES(i
));
733 if(aFmtName
== rName
)
735 pRet
= rDoc
.GetPageDescFromPool( static_cast< sal_uInt16
>(RES_POOLPAGE_BEGIN
+ i
- RC_POOLPAGEDESC_BEGIN
) );
743 /******************************************************************************
744 ******************************************************************************
745 ******************************************************************************
747 ******************************************************************************/
749 /******************************************************************
751 ******************************************************************/
753 /*-- 09.12.98 14:19:19---------------------------------------------------
755 -----------------------------------------------------------------------*/
756 OUString
SwXTextCursor::getImplementationName(void) throw( RuntimeException
)
758 return C2U("SwXTextCursor");
760 /*-- 09.12.98 14:19:19---------------------------------------------------
762 -----------------------------------------------------------------------*/
763 BOOL
SwXTextCursor::supportsService(const OUString
& rServiceName
) throw( RuntimeException
)
765 String
sServiceName(rServiceName
);
766 return sServiceName
.EqualsAscii("com.sun.star.text.TextCursor") ||
767 sServiceName
.EqualsAscii("com.sun.star.style.CharacterProperties")||
768 sServiceName
.EqualsAscii("com.sun.star.style.CharacterPropertiesAsian")||
769 sServiceName
.EqualsAscii("com.sun.star.style.CharacterPropertiesComplex")||
770 sServiceName
.EqualsAscii("com.sun.star.style.ParagraphProperties") ||
771 sServiceName
.EqualsAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
772 sServiceName
.EqualsAscii("com.sun.star.style.ParagraphPropertiesComplex") ||
773 sServiceName
.EqualsAscii("com.sun.star.text.TextSortable");
775 /*-- 09.12.98 14:19:19---------------------------------------------------
777 -----------------------------------------------------------------------*/
778 Sequence
< OUString
> SwXTextCursor::getSupportedServiceNames(void) throw( RuntimeException
)
780 Sequence
< OUString
> aRet(8);
781 OUString
* pArray
= aRet
.getArray();
782 pArray
[0] = C2U("com.sun.star.text.TextCursor");
783 pArray
[1] = C2U("com.sun.star.style.CharacterProperties");
784 pArray
[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
785 pArray
[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
786 pArray
[4] = C2U("com.sun.star.style.ParagraphProperties");
787 pArray
[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
788 pArray
[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
789 pArray
[7] = C2U("com.sun.star.text.TextSortable");
792 /*-- 09.12.98 14:19:19---------------------------------------------------
794 -----------------------------------------------------------------------*/
795 SwXTextCursor::SwXTextCursor(uno::Reference
< XText
> xParent
, const SwPosition
& rPos
,
796 CursorType eSet
, SwDoc
* pDoc
, const SwPosition
* pMark
) :
797 aLstnrCntnr(( util::XSortable
*)this),
798 m_pPropSet(aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR
)),
799 xParentText(xParent
),
802 mbRemoveUserEvent( false )
804 SwUnoCrsr
* pUnoCrsr
= pDoc
->CreateUnoCrsr(rPos
, sal_False
);
808 *pUnoCrsr
->GetMark() = *pMark
;
813 /* -----------------04.03.99 09:02-------------------
815 * --------------------------------------------------*/
816 SwXTextCursor::SwXTextCursor(uno::Reference
< XText
> xParent
,
817 SwUnoCrsr
* pSourceCrsr
, CursorType eSet
) :
818 aLstnrCntnr( (util::XSortable
*)this),
819 m_pPropSet(aSwMapProvider
.GetPropertySet(PROPERTY_MAP_TEXT_CURSOR
)),
820 xParentText(xParent
),
823 mbRemoveUserEvent( false )
825 SwUnoCrsr
* pUnoCrsr
= pSourceCrsr
->GetDoc()->CreateUnoCrsr(*pSourceCrsr
->GetPoint(), sal_False
);
826 if(pSourceCrsr
->HasMark())
829 *pUnoCrsr
->GetMark() = *pSourceCrsr
->GetMark();
834 /*-- 09.12.98 14:19:20---------------------------------------------------
836 -----------------------------------------------------------------------*/
837 SwXTextCursor::~SwXTextCursor()
839 vos::OGuard
aGuard(Application::GetSolarMutex());
841 // --> FME 2006-03-07 #126177# A user event has been posted in order
842 // to delete the SwUnoCursor. Remove the user event if the SwXTextCursor
843 // is destroyed before the user event could be handled.
844 if ( mbRemoveUserEvent
)
846 mbRemoveUserEvent
= false;
847 Application::RemoveUserEvent( mnUserEventId
);
851 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
853 delete pLastSortOptions
;
855 /*-- 09.12.98 14:19:18---------------------------------------------------
857 -----------------------------------------------------------------------*/
858 void SwXTextCursor::DeleteAndInsert(const String
& rText
,
859 const bool bForceExpandHints
)
861 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
865 SwDoc
* pDoc
= pUnoCrsr
->GetDoc();
866 UnoActionContext
aAction(pDoc
);
867 xub_StrLen nTxtLen
= rText
.Len();
868 pDoc
->StartUndo(UNDO_INSERT
, NULL
);
869 SwCursor
*_pStartCrsr
= pUnoCrsr
;
872 if(_pStartCrsr
->HasMark())
874 pDoc
->DeleteAndJoin(*_pStartCrsr
);
879 SwUnoCursorHelper::DocInsertStringSplitCR(
880 *pDoc
, *_pStartCrsr
, rText
, bForceExpandHints
) );
881 DBG_ASSERT( bSuccess
, "Doc->Insert(Str) failed." );
884 SwXTextCursor::SelectPam(*pUnoCrsr
, sal_True
);
885 _pStartCrsr
->Left(rText
.Len(), CRSR_SKIP_CHARS
, FALSE
, FALSE
);
887 } while( (_pStartCrsr
=(SwCursor
*)_pStartCrsr
->GetNext()) != pUnoCrsr
);
888 pDoc
->EndUndo(UNDO_INSERT
, NULL
);
893 enum ForceIntoMetaMode
{ META_CHECK_BOTH
, META_INIT_START
, META_INIT_END
};
895 sal_Bool
lcl_ForceIntoMeta(SwPaM
& rCursor
,
896 uno::Reference
<text::XText
> const & xParentText
,
897 const enum ForceIntoMetaMode eMode
)
899 sal_Bool
bRet( sal_True
); // means not forced in META_CHECK_BOTH
900 SwXMeta
const * const pXMeta( dynamic_cast<SwXMeta
*>(xParentText
.get()) );
901 ASSERT(pXMeta
, "no parent?");
903 throw uno::RuntimeException();
904 SwTxtNode
* pTxtNode
;
907 const bool bSuccess( pXMeta
->SetContentRange(pTxtNode
, nStart
, nEnd
) );
908 ASSERT(bSuccess
, "no pam?");
910 throw uno::RuntimeException();
911 // force the cursor back into the meta if it has moved outside
912 SwPosition
start(*pTxtNode
, nStart
);
913 SwPosition
end(*pTxtNode
, nEnd
);
916 case META_INIT_START
:
917 *rCursor
.GetPoint() = start
;
920 *rCursor
.GetPoint() = end
;
922 case META_CHECK_BOTH
:
923 if (*rCursor
.Start() < start
)
925 *rCursor
.Start() = start
;
928 if (*rCursor
.End() > end
)
930 *rCursor
.End() = end
;
938 bool SwXTextCursor::IsAtEndOfMeta() const
940 if (CURSOR_META
== eType
)
942 SwUnoCrsr
const * const pCursor( GetCrsr() );
943 SwXMeta
const*const pXMeta( dynamic_cast<SwXMeta
*>(xParentText
.get()) );
944 ASSERT(pXMeta
, "no meta?");
945 if (pCursor
&& pXMeta
)
947 SwTxtNode
* pTxtNode
;
951 pXMeta
->SetContentRange(pTxtNode
, nStart
, nEnd
) );
952 ASSERT(bSuccess
, "no pam?");
955 const SwPosition
end(*pTxtNode
, nEnd
);
956 if ( (*pCursor
->GetPoint() == end
)
957 || (*pCursor
->GetMark() == end
))
967 /* -----------------------------10.03.00 18:02--------------------------------
969 ---------------------------------------------------------------------------*/
970 const uno::Sequence
< sal_Int8
> & SwXTextCursor::getUnoTunnelId()
972 static uno::Sequence
< sal_Int8
> aSeq
= ::CreateUnoTunnelId();
975 /* -----------------------------10.03.00 18:04--------------------------------
977 ---------------------------------------------------------------------------*/
978 sal_Int64 SAL_CALL
SwXTextCursor::getSomething( const uno::Sequence
< sal_Int8
>& rId
)
979 throw(uno::RuntimeException
)
981 if( rId
.getLength() == 16
982 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
983 rId
.getConstArray(), 16 ) )
985 return sal::static_int_cast
< sal_Int64
>( reinterpret_cast< sal_IntPtr
>(this) );
987 return OTextCursorHelper::getSomething(rId
);
990 /*-- 09.12.98 14:18:12---------------------------------------------------
992 -----------------------------------------------------------------------*/
993 void SwXTextCursor::collapseToStart(void) throw( uno::RuntimeException
)
995 vos::OGuard
aGuard(Application::GetSolarMutex());
996 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
999 if(pUnoCrsr
->HasMark())
1001 if(*pUnoCrsr
->GetPoint() > *pUnoCrsr
->GetMark())
1002 pUnoCrsr
->Exchange();
1003 pUnoCrsr
->DeleteMark();
1008 throw uno::RuntimeException();
1011 /*-- 09.12.98 14:18:14---------------------------------------------------
1013 -----------------------------------------------------------------------*/
1014 void SwXTextCursor::collapseToEnd(void) throw( uno::RuntimeException
)
1016 vos::OGuard
aGuard(Application::GetSolarMutex());
1017 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1020 if(pUnoCrsr
->HasMark())
1022 if(*pUnoCrsr
->GetPoint() < *pUnoCrsr
->GetMark())
1023 pUnoCrsr
->Exchange();
1024 pUnoCrsr
->DeleteMark();
1029 throw uno::RuntimeException();
1032 /*-- 09.12.98 14:18:41---------------------------------------------------
1034 -----------------------------------------------------------------------*/
1035 sal_Bool
SwXTextCursor::isCollapsed(void) throw( uno::RuntimeException
)
1037 vos::OGuard
aGuard(Application::GetSolarMutex());
1038 sal_Bool bRet
= sal_True
;
1039 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1040 if(pUnoCrsr
&& pUnoCrsr
->GetMark())
1042 bRet
= (*pUnoCrsr
->GetPoint() == *pUnoCrsr
->GetMark());
1046 /*-- 09.12.98 14:18:42---------------------------------------------------
1048 -----------------------------------------------------------------------*/
1049 sal_Bool
SwXTextCursor::goLeft(sal_Int16 nCount
, sal_Bool Expand
) throw( uno::RuntimeException
)
1051 vos::OGuard
aGuard(Application::GetSolarMutex());
1052 sal_Bool bRet
= sal_False
;
1053 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1056 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1057 bRet
= pUnoCrsr
->Left( nCount
, CRSR_SKIP_CHARS
, FALSE
, FALSE
);
1058 if (CURSOR_META
== eType
)
1060 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
)
1066 throw uno::RuntimeException();
1070 /*-- 09.12.98 14:18:42---------------------------------------------------
1072 -----------------------------------------------------------------------*/
1073 sal_Bool
SwXTextCursor::goRight(sal_Int16 nCount
, sal_Bool Expand
) throw( uno::RuntimeException
)
1075 vos::OGuard
aGuard(Application::GetSolarMutex());
1076 sal_Bool bRet
= sal_False
;
1077 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1080 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1081 bRet
= pUnoCrsr
->Right(nCount
, CRSR_SKIP_CHARS
, FALSE
, FALSE
);
1082 if (CURSOR_META
== eType
)
1084 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
)
1090 throw uno::RuntimeException();
1094 /*-- 09.12.98 14:18:43---------------------------------------------------
1096 -----------------------------------------------------------------------*/
1097 void SwXTextCursor::gotoStart(sal_Bool Expand
) throw( uno::RuntimeException
)
1099 vos::OGuard
aGuard(Application::GetSolarMutex());
1100 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1103 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1104 if(eType
== CURSOR_BODY
)
1106 pUnoCrsr
->Move( fnMoveBackward
, fnGoDoc
);
1107 //check, that the cursor is not in a table
1108 SwTableNode
* pTblNode
= pUnoCrsr
->GetNode()->FindTableNode();
1109 SwCntntNode
* pCont
= 0;
1112 pUnoCrsr
->GetPoint()->nNode
= *pTblNode
->EndOfSectionNode();
1113 pCont
= GetDoc()->GetNodes().GoNext(&pUnoCrsr
->GetPoint()->nNode
);
1114 pTblNode
= pCont
? pCont
->FindTableNode() : 0;
1117 pUnoCrsr
->GetPoint()->nContent
.Assign(pCont
, 0);
1118 const SwStartNode
* pTmp
= pUnoCrsr
->GetNode()->StartOfSectionNode();
1119 if(pTmp
->IsSectionNode())
1121 SwSectionNode
* pSectionStartNode
= (SwSectionNode
*)pTmp
;
1122 if(pSectionStartNode
->GetSection().IsHiddenFlag())
1124 pCont
= GetDoc()->GetNodes().GoNextSection(
1125 &pUnoCrsr
->GetPoint()->nNode
, sal_True
, sal_False
);
1127 pUnoCrsr
->GetPoint()->nContent
.Assign(pCont
, 0);
1131 else if(eType
== CURSOR_FRAME
||
1132 eType
== CURSOR_TBLTEXT
||
1133 eType
== CURSOR_HEADER
||
1134 eType
== CURSOR_FOOTER
||
1135 eType
== CURSOR_FOOTNOTE
||
1136 eType
== CURSOR_REDLINE
)
1138 pUnoCrsr
->MoveSection( fnSectionCurr
, fnSectionStart
);
1140 else if (CURSOR_META
== eType
)
1142 lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_INIT_START
);
1147 throw uno::RuntimeException();
1150 /*-- 09.12.98 14:18:43---------------------------------------------------
1152 -----------------------------------------------------------------------*/
1153 void SwXTextCursor::gotoEnd(sal_Bool Expand
) throw( uno::RuntimeException
)
1155 vos::OGuard
aGuard(Application::GetSolarMutex());
1156 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1159 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1160 if(eType
== CURSOR_BODY
)
1162 pUnoCrsr
->Move( fnMoveForward
, fnGoDoc
);
1164 else if(eType
== CURSOR_FRAME
||
1165 eType
== CURSOR_TBLTEXT
||
1166 eType
== CURSOR_HEADER
||
1167 eType
== CURSOR_FOOTER
||
1168 eType
== CURSOR_FOOTNOTE
||
1169 eType
== CURSOR_REDLINE
)
1171 pUnoCrsr
->MoveSection( fnSectionCurr
, fnSectionEnd
);
1173 else if (CURSOR_META
== eType
)
1175 lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_INIT_END
);
1180 throw uno::RuntimeException();
1184 void SwXTextCursor::gotoRange(const uno::Reference
< XTextRange
> & xRange
, sal_Bool bExpand
)
1185 throw( uno::RuntimeException
)
1187 vos::OGuard
aGuard(Application::GetSolarMutex());
1188 SwUnoCrsr
* pOwnCursor
= GetCrsr();
1189 if(!pOwnCursor
|| !xRange
.is())
1191 throw uno::RuntimeException();
1194 uno::Reference
<lang::XUnoTunnel
> xRangeTunnel( xRange
, uno::UNO_QUERY
);
1195 SwXTextRange
* pRange
= 0;
1196 OTextCursorHelper
* pCursor
= 0;
1197 if(xRangeTunnel
.is())
1199 pRange
= reinterpret_cast< SwXTextRange
* >(
1200 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( SwXTextRange::getUnoTunnelId()) ));
1201 pCursor
= reinterpret_cast< OTextCursorHelper
* >(
1202 sal::static_int_cast
< sal_IntPtr
>( xRangeTunnel
->getSomething( OTextCursorHelper::getUnoTunnelId()) ));
1205 if (!pRange
&& !pCursor
)
1207 throw uno::RuntimeException();
1210 SwStartNodeType eSearchNodeType
= SwNormalStartNode
;
1213 case CURSOR_FRAME
: eSearchNodeType
= SwFlyStartNode
; break;
1214 case CURSOR_TBLTEXT
: eSearchNodeType
= SwTableBoxStartNode
; break;
1215 case CURSOR_FOOTNOTE
: eSearchNodeType
= SwFootnoteStartNode
; break;
1216 case CURSOR_HEADER
: eSearchNodeType
= SwHeaderStartNode
; break;
1217 case CURSOR_FOOTER
: eSearchNodeType
= SwFooterStartNode
; break;
1218 //case CURSOR_INVALID:
1223 const SwStartNode
* pOwnStartNode
= pOwnCursor
->GetNode()->
1224 FindSttNodeByType(eSearchNodeType
);
1226 const SwNode
* pSrcNode
= 0;
1227 if(pCursor
&& pCursor
->GetPaM())
1229 pSrcNode
= pCursor
->GetPaM()->GetNode();
1231 else if(pRange
&& pRange
->GetBookmark())
1233 ::sw::mark::IMark
const * const pBkmk
= pRange
->GetBookmark();
1234 pSrcNode
= &pBkmk
->GetMarkPos().nNode
.GetNode();
1236 const SwStartNode
* pTmp
= pSrcNode
? pSrcNode
->FindSttNodeByType(eSearchNodeType
) : 0;
1238 //SectionNodes ueberspringen
1239 while(pTmp
&& pTmp
->IsSectionNode())
1241 pTmp
= pTmp
->StartOfSectionNode();
1243 while(pOwnStartNode
&& pOwnStartNode
->IsSectionNode())
1245 pOwnStartNode
= pOwnStartNode
->StartOfSectionNode();
1247 if(pOwnStartNode
!= pTmp
)
1249 throw uno::RuntimeException();
1252 if (CURSOR_META
== eType
)
1254 const SwPosition
& rPoint( (pRange
)
1255 ? pRange
->GetBookmark()->GetMarkPos()
1256 : *pCursor
->GetPaM()->GetPoint() );
1257 const SwPosition
& rMark ( (pRange
)
1258 ? ((pRange
->GetBookmark()->IsExpanded())
1259 ? pRange
->GetBookmark()->GetOtherMarkPos() : rPoint
)
1260 : *pCursor
->GetPaM()->GetMark() );
1261 SwPaM
aPam(rPoint
, rMark
);
1262 const bool bNotForced(
1263 lcl_ForceIntoMeta(aPam
, xParentText
, META_CHECK_BOTH
) );
1266 throw uno::RuntimeException(
1267 C2U("gotoRange: parameter range not contained in nesting"
1268 " text content for which this cursor was created"),
1269 static_cast<text::XWordCursor
*>(this));
1273 //jetzt muss die Selektion erweitert werden
1276 // der Cursor soll alles einschliessen, was bisher von ihm und dem uebergebenen
1277 // Range eingeschlossen wurde
1278 SwPosition
aOwnLeft(*pOwnCursor
->GetPoint());
1279 SwPosition
aOwnRight(pOwnCursor
->HasMark() ? *pOwnCursor
->GetMark() : aOwnLeft
);
1280 if(aOwnRight
< aOwnLeft
)
1282 SwPosition aTmp
= aOwnLeft
;
1283 aOwnLeft
= aOwnRight
;
1286 SwPosition
* pParamLeft
;
1287 SwPosition
* pParamRight
;
1290 const SwPaM
* pTmp2
= pCursor
->GetPaM();
1291 pParamLeft
= new SwPosition(*pTmp2
->GetPoint());
1292 pParamRight
= new SwPosition(pTmp2
->HasMark() ? *pTmp2
->GetMark() : *pParamLeft
);
1296 ::sw::mark::IMark
const * const pBkmk
= pRange
->GetBookmark();
1297 pParamLeft
= new SwPosition(pBkmk
->GetMarkPos());
1298 pParamRight
= new SwPosition(pBkmk
->IsExpanded() ? pBkmk
->GetOtherMarkPos() : *pParamLeft
);
1300 if(*pParamRight
< *pParamLeft
)
1302 SwPosition
* pTmp2
= pParamLeft
;
1303 pParamLeft
= pParamRight
;
1304 pParamRight
= pTmp2
;
1306 // jetzt sind vier SwPositions da, zwei davon werden gebraucht, also welche?
1307 if(aOwnRight
> *pParamRight
)
1308 *pOwnCursor
->GetPoint() = aOwnRight
;
1310 *pOwnCursor
->GetPoint() = *pParamRight
;
1311 pOwnCursor
->SetMark();
1312 if(aOwnLeft
< *pParamLeft
)
1313 *pOwnCursor
->GetMark() = aOwnLeft
;
1315 *pOwnCursor
->GetMark() = *pParamLeft
;
1321 //der Cursor soll dem uebergebenen Range entsprechen
1324 const SwPaM
* pTmp2
= pCursor
->GetPaM();
1325 *pOwnCursor
->GetPoint() = *pTmp2
->GetPoint();
1326 if(pTmp2
->HasMark())
1328 pOwnCursor
->SetMark();
1329 *pOwnCursor
->GetMark() = *pTmp2
->GetMark();
1332 pOwnCursor
->DeleteMark();
1336 ::sw::mark::IMark
const * const pBkmk
= pRange
->GetBookmark();
1337 *pOwnCursor
->GetPoint() = pBkmk
->GetMarkPos();
1338 if(pBkmk
->IsExpanded())
1340 pOwnCursor
->SetMark();
1341 *pOwnCursor
->GetMark() = pBkmk
->GetOtherMarkPos();
1344 pOwnCursor
->DeleteMark();
1349 /*-- 09.12.98 14:18:44---------------------------------------------------
1351 -----------------------------------------------------------------------*/
1352 sal_Bool
SwXTextCursor::isStartOfWord(void) throw( uno::RuntimeException
)
1354 vos::OGuard
aGuard(Application::GetSolarMutex());
1355 sal_Bool bRet
= sal_False
;
1356 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1359 bRet
= pUnoCrsr
->IsStartWordWT( i18n::WordType::DICTIONARY_WORD
);
1363 throw uno::RuntimeException();
1367 /*-- 09.12.98 14:18:44---------------------------------------------------
1369 -----------------------------------------------------------------------*/
1370 sal_Bool
SwXTextCursor::isEndOfWord(void) throw( uno::RuntimeException
)
1372 vos::OGuard
aGuard(Application::GetSolarMutex());
1373 sal_Bool bRet
= sal_False
;
1374 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1377 bRet
= pUnoCrsr
->IsEndWordWT( i18n::WordType::DICTIONARY_WORD
);
1381 throw uno::RuntimeException();
1385 /*-- 09.12.98 14:18:44---------------------------------------------------
1387 -----------------------------------------------------------------------*/
1388 sal_Bool
SwXTextCursor::gotoNextWord(sal_Bool Expand
) throw( uno::RuntimeException
)
1390 vos::OGuard
aGuard(Application::GetSolarMutex());
1391 //Probleme gibt's noch mit einem Absatzanfang, an dem kein Wort beginnt.
1393 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1395 sal_Bool bRet
= sal_False
;
1398 // remember old position to check if cursor has moved
1399 // since the called functions are sometimes a bit unreliable
1400 // in specific cases...
1401 SwPosition
*pPoint
= pUnoCrsr
->GetPoint();
1402 SwNode
*pOldNode
= &pPoint
->nNode
.GetNode();
1403 xub_StrLen nOldIndex
= pPoint
->nContent
.GetIndex();
1405 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1407 if(pUnoCrsr
->GetCntntNode() &&
1408 pPoint
->nContent
== pUnoCrsr
->GetCntntNode()->Len())
1410 pUnoCrsr
->Right(1, CRSR_SKIP_CHARS
, FALSE
, FALSE
);
1414 sal_Bool bTmp
= pUnoCrsr
->GoNextWordWT( i18n::WordType::DICTIONARY_WORD
);
1415 //if there is no next word within the current paragraph try to go to the start of the next paragraph
1417 pUnoCrsr
->MovePara(fnParaNext
, fnParaStart
);
1420 // return true if cursor has moved
1421 bRet
= &pPoint
->nNode
.GetNode() != pOldNode
||
1422 pPoint
->nContent
.GetIndex() != nOldIndex
;
1423 if (bRet
&& (CURSOR_META
== eType
))
1425 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
);
1430 throw uno::RuntimeException();
1435 /*-- 09.12.98 14:18:45---------------------------------------------------
1437 -----------------------------------------------------------------------*/
1438 sal_Bool
SwXTextCursor::gotoPreviousWord(sal_Bool Expand
) throw( uno::RuntimeException
)
1440 vos::OGuard
aGuard(Application::GetSolarMutex());
1441 // hier machen Leerzeichen am Absatzanfang Probleme
1442 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1444 sal_Bool bRet
= sal_False
;
1447 SwPosition
*pPoint
= pUnoCrsr
->GetPoint();
1448 SwNode
*pOldNode
= &pPoint
->nNode
.GetNode();
1449 xub_StrLen nOldIndex
= pPoint
->nContent
.GetIndex();
1451 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1453 if(pPoint
->nContent
== 0)
1455 pUnoCrsr
->Left(1, CRSR_SKIP_CHARS
, FALSE
, FALSE
);
1459 pUnoCrsr
->GoPrevWordWT( i18n::WordType::DICTIONARY_WORD
);
1460 if(pPoint
->nContent
== 0)
1461 pUnoCrsr
->Left(1, CRSR_SKIP_CHARS
, FALSE
, FALSE
);
1464 // return true if cursor has moved
1465 bRet
= &pPoint
->nNode
.GetNode() != pOldNode
||
1466 pPoint
->nContent
.GetIndex() != nOldIndex
;
1467 if (bRet
&& (CURSOR_META
== eType
))
1469 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
);
1474 throw uno::RuntimeException();
1479 /*-- 09.12.98 14:18:45---------------------------------------------------
1481 -----------------------------------------------------------------------*/
1482 sal_Bool
SwXTextCursor::gotoEndOfWord(sal_Bool Expand
) throw( uno::RuntimeException
)
1484 vos::OGuard
aGuard(Application::GetSolarMutex());
1485 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1487 sal_Bool bRet
= sal_False
;
1490 SwPosition
*pPoint
= pUnoCrsr
->GetPoint();
1491 SwNode
&rOldNode
= pPoint
->nNode
.GetNode();
1492 xub_StrLen nOldIndex
= pPoint
->nContent
.GetIndex();
1494 sal_Int16 nWordType
= i18n::WordType::DICTIONARY_WORD
;
1495 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1496 if(!pUnoCrsr
->IsEndWordWT( nWordType
))
1497 pUnoCrsr
->GoEndWordWT( nWordType
);
1499 // restore old cursor if we are not at the end of a word by now
1500 // otherwise use current one
1501 bRet
= pUnoCrsr
->IsEndWordWT( nWordType
);
1504 pPoint
->nNode
= rOldNode
;
1505 pPoint
->nContent
= nOldIndex
;
1507 else if (CURSOR_META
== eType
)
1509 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
);
1514 throw uno::RuntimeException();
1519 /*-- 09.12.98 14:18:46---------------------------------------------------
1521 -----------------------------------------------------------------------*/
1522 sal_Bool
SwXTextCursor::gotoStartOfWord(sal_Bool Expand
) throw( uno::RuntimeException
)
1524 vos::OGuard
aGuard(Application::GetSolarMutex());
1525 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1527 sal_Bool bRet
= sal_False
;
1530 SwPosition
*pPoint
= pUnoCrsr
->GetPoint();
1531 SwNode
&rOldNode
= pPoint
->nNode
.GetNode();
1532 xub_StrLen nOldIndex
= pPoint
->nContent
.GetIndex();
1534 sal_Int16 nWordType
= i18n::WordType::DICTIONARY_WORD
;
1535 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1536 if(!pUnoCrsr
->IsStartWordWT( nWordType
))
1537 pUnoCrsr
->GoStartWordWT( nWordType
);
1539 // restore old cursor if we are not at the start of a word by now
1540 // otherwise use current one
1541 bRet
= pUnoCrsr
->IsStartWordWT( nWordType
);
1544 pPoint
->nNode
= rOldNode
;
1545 pPoint
->nContent
= nOldIndex
;
1547 else if (CURSOR_META
== eType
)
1549 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
);
1554 throw uno::RuntimeException();
1559 /*-- 09.12.98 14:18:46---------------------------------------------------
1561 -----------------------------------------------------------------------*/
1562 sal_Bool
SwXTextCursor::isStartOfSentence(void) throw( uno::RuntimeException
)
1564 vos::OGuard
aGuard(Application::GetSolarMutex());
1565 sal_Bool bRet
= sal_False
;
1566 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1569 // start of paragraph?
1570 bRet
= pUnoCrsr
->GetPoint()->nContent
== 0;
1571 // with mark ->no sentence start
1572 // (check if cursor is no selection, i.e. it does not have
1573 // a mark or else point and mark are identical)
1574 if(!bRet
&& (!pUnoCrsr
->HasMark() ||
1575 *pUnoCrsr
->GetPoint() == *pUnoCrsr
->GetMark()))
1577 SwCursor
aCrsr(*pUnoCrsr
->GetPoint(),0,false);
1578 SwPosition aOrigPos
= *aCrsr
.GetPoint();
1579 aCrsr
.GoSentence(SwCursor::START_SENT
);
1580 bRet
= aOrigPos
== *aCrsr
.GetPoint();
1584 throw uno::RuntimeException();
1587 /*-- 09.12.98 14:18:47---------------------------------------------------
1589 -----------------------------------------------------------------------*/
1590 sal_Bool
SwXTextCursor::isEndOfSentence(void) throw( uno::RuntimeException
)
1592 vos::OGuard
aGuard(Application::GetSolarMutex());
1593 sal_Bool bRet
= sal_False
;
1594 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1598 bRet
= pUnoCrsr
->GetCntntNode() &&
1599 pUnoCrsr
->GetPoint()->nContent
== pUnoCrsr
->GetCntntNode()->Len();
1600 // with mark->no sentence end
1601 // (check if cursor is no selection, i.e. it does not have
1602 // a mark or else point and mark are identical)
1603 if(!bRet
&& (!pUnoCrsr
->HasMark() ||
1604 *pUnoCrsr
->GetPoint() == *pUnoCrsr
->GetMark()))
1606 SwCursor
aCrsr(*pUnoCrsr
->GetPoint(),0,false);
1607 SwPosition aOrigPos
= *aCrsr
.GetPoint();
1608 aCrsr
.GoSentence(SwCursor::END_SENT
);
1609 bRet
= aOrigPos
== *aCrsr
.GetPoint();
1613 throw uno::RuntimeException();
1616 /*-- 09.12.98 14:18:47---------------------------------------------------
1618 -----------------------------------------------------------------------*/
1619 sal_Bool
SwXTextCursor::gotoNextSentence(sal_Bool Expand
) throw( uno::RuntimeException
)
1621 vos::OGuard
aGuard(Application::GetSolarMutex());
1622 sal_Bool bRet
= sal_False
;
1623 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1626 BOOL bWasEOS
= isEndOfSentence();
1627 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1628 bRet
= pUnoCrsr
->GoSentence(SwCursor::NEXT_SENT
);
1630 bRet
= pUnoCrsr
->MovePara(fnParaNext
, fnParaStart
);
1632 // if at the end of the sentence (i.e. at the space after the '.')
1633 // advance to next word in order for GoSentence to work properly
1634 // next time and have isStartOfSentence return true after this call
1635 if (!pUnoCrsr
->IsStartWord())
1637 BOOL bNextWord
= pUnoCrsr
->GoNextWord();
1638 if (bWasEOS
&& !bNextWord
)
1641 if (CURSOR_META
== eType
)
1643 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
)
1648 throw uno::RuntimeException();
1651 /*-- 09.12.98 14:18:47---------------------------------------------------
1653 -----------------------------------------------------------------------*/
1654 sal_Bool
SwXTextCursor::gotoPreviousSentence(sal_Bool Expand
) throw( uno::RuntimeException
)
1656 vos::OGuard
aGuard(Application::GetSolarMutex());
1657 sal_Bool bRet
= sal_False
;
1658 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1661 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1662 bRet
= pUnoCrsr
->GoSentence(SwCursor::PREV_SENT
);
1665 if(0 != (bRet
= pUnoCrsr
->MovePara(fnParaPrev
, fnParaStart
)))
1667 pUnoCrsr
->MovePara(fnParaCurr
, fnParaEnd
);
1668 //at the end of a paragraph move to the sentence end again
1670 pUnoCrsr
->GoSentence(SwCursor::PREV_SENT
);
1673 if (CURSOR_META
== eType
)
1675 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
)
1680 throw uno::RuntimeException();
1683 /* -----------------15.10.99 08:24-------------------
1685 --------------------------------------------------*/
1686 sal_Bool
SwXTextCursor::gotoStartOfSentence(sal_Bool Expand
) throw( uno::RuntimeException
)
1688 vos::OGuard
aGuard(Application::GetSolarMutex());
1689 sal_Bool bRet
= sal_False
;
1690 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1693 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1694 // if we're at the para start then we wont move
1695 // but bRet is also true if GoSentence failed but
1696 // the start of the sentence is reached
1697 bRet
= SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr
)
1698 || pUnoCrsr
->GoSentence(SwCursor::START_SENT
) ||
1699 SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr
);
1700 if (CURSOR_META
== eType
)
1702 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
)
1707 throw uno::RuntimeException();
1710 /* -----------------15.10.99 08:24-------------------
1712 --------------------------------------------------*/
1713 sal_Bool
SwXTextCursor::gotoEndOfSentence(sal_Bool Expand
) throw( uno::RuntimeException
)
1715 vos::OGuard
aGuard(Application::GetSolarMutex());
1716 sal_Bool bRet
= sal_False
;
1717 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1720 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1721 // bRet is true if GoSentence() succeeded or if the
1722 // MovePara() succeeded while the end of the para is
1723 // not reached already
1724 sal_Bool bAlreadyParaEnd
= SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr
);
1725 bRet
= !bAlreadyParaEnd
&&
1726 (pUnoCrsr
->GoSentence(SwCursor::END_SENT
) ||
1727 pUnoCrsr
->MovePara(fnParaCurr
, fnParaEnd
));
1728 if (CURSOR_META
== eType
)
1730 bRet
= lcl_ForceIntoMeta(*pUnoCrsr
, xParentText
, META_CHECK_BOTH
)
1735 throw uno::RuntimeException();
1739 /*-- 09.12.98 14:18:48---------------------------------------------------
1741 -----------------------------------------------------------------------*/
1742 sal_Bool
SwXTextCursor::isStartOfParagraph(void) throw( uno::RuntimeException
)
1744 vos::OGuard
aGuard(Application::GetSolarMutex());
1745 sal_Bool bRet
= sal_False
;
1746 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1748 bRet
= SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr
);
1750 throw uno::RuntimeException();
1753 /*-- 09.12.98 14:18:48---------------------------------------------------
1755 -----------------------------------------------------------------------*/
1756 sal_Bool
SwXTextCursor::isEndOfParagraph(void) throw( uno::RuntimeException
)
1758 vos::OGuard
aGuard(Application::GetSolarMutex());
1759 sal_Bool bRet
= sal_False
;
1760 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1762 bRet
= SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr
);
1764 throw uno::RuntimeException();
1767 /*-- 09.12.98 14:18:49---------------------------------------------------
1769 -----------------------------------------------------------------------*/
1770 sal_Bool
SwXTextCursor::gotoStartOfParagraph(sal_Bool Expand
) throw( uno::RuntimeException
)
1772 vos::OGuard
aGuard(Application::GetSolarMutex());
1773 sal_Bool bRet
= sal_False
;
1774 if (CURSOR_META
== eType
)
1776 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1779 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1780 bRet
= SwUnoCursorHelper::IsStartOfPara(*pUnoCrsr
);
1782 bRet
= pUnoCrsr
->MovePara(fnParaCurr
, fnParaStart
);
1785 throw uno::RuntimeException();
1787 // since MovePara(fnParaCurr, fnParaStart) only returns false
1788 // if we were already at the start of the paragraph this function
1789 // should always complete successfully.
1790 DBG_ASSERT( bRet
, "gotoStartOfParagraph failed" );
1793 /*-- 09.12.98 14:18:49---------------------------------------------------
1795 -----------------------------------------------------------------------*/
1796 sal_Bool
SwXTextCursor::gotoEndOfParagraph(sal_Bool Expand
) throw( uno::RuntimeException
)
1798 vos::OGuard
aGuard(Application::GetSolarMutex());
1799 sal_Bool bRet
= sal_False
;
1800 if (CURSOR_META
== eType
)
1802 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1805 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1806 bRet
= SwUnoCursorHelper::IsEndOfPara(*pUnoCrsr
);
1808 bRet
= pUnoCrsr
->MovePara(fnParaCurr
, fnParaEnd
);
1811 throw uno::RuntimeException();
1813 // since MovePara(fnParaCurr, fnParaEnd) only returns false
1814 // if we were already at the end of the paragraph this function
1815 // should always complete successfully.
1816 DBG_ASSERT( bRet
, "gotoEndOfParagraph failed" );
1819 /*-- 09.12.98 14:18:50---------------------------------------------------
1821 -----------------------------------------------------------------------*/
1822 sal_Bool
SwXTextCursor::gotoNextParagraph(sal_Bool Expand
) throw( uno::RuntimeException
)
1824 vos::OGuard
aGuard(Application::GetSolarMutex());
1825 sal_Bool bRet
= sal_False
;
1826 if (CURSOR_META
== eType
)
1828 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1831 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1832 bRet
= pUnoCrsr
->MovePara(fnParaNext
, fnParaStart
);
1835 throw uno::RuntimeException();
1838 /*-- 09.12.98 14:18:50---------------------------------------------------
1840 -----------------------------------------------------------------------*/
1841 sal_Bool
SwXTextCursor::gotoPreviousParagraph(sal_Bool Expand
) throw( uno::RuntimeException
)
1843 vos::OGuard
aGuard(Application::GetSolarMutex());
1844 sal_Bool bRet
= sal_False
;
1845 if (CURSOR_META
== eType
)
1847 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1850 SwXTextCursor::SelectPam(*pUnoCrsr
, Expand
);
1851 bRet
= pUnoCrsr
->MovePara(fnParaPrev
, fnParaStart
);
1854 throw uno::RuntimeException();
1857 /*-- 09.12.98 14:18:50---------------------------------------------------
1859 -----------------------------------------------------------------------*/
1860 uno::Reference
< XText
> SwXTextCursor::getText(void) throw( uno::RuntimeException
)
1864 /*-- 09.12.98 14:18:50---------------------------------------------------
1866 -----------------------------------------------------------------------*/
1867 uno::Reference
< XTextRange
> SwXTextCursor::getStart(void) throw( uno::RuntimeException
)
1869 vos::OGuard
aGuard(Application::GetSolarMutex());
1870 uno::Reference
< XTextRange
> xRet
;
1871 SwUnoCrsr
* pUnoCrsr
= ((SwXTextCursor
*)this)->GetCrsr();
1874 SwPaM
aPam(*pUnoCrsr
->Start());
1875 uno::Reference
< XText
> xParent
= getText();
1876 if (CURSOR_META
== eType
)
1878 // return cursor to prevent modifying SwXTextRange for META
1879 SwXTextCursor
* const pCursor(
1880 new SwXTextCursor(xParent
, *pUnoCrsr
->GetPoint(),
1881 CURSOR_META
, pUnoCrsr
->GetDoc()) );
1882 pCursor
->gotoStart(sal_False
);
1883 xRet
= static_cast<text::XWordCursor
*>(pCursor
);
1887 xRet
= new SwXTextRange(aPam
, xParent
);
1891 throw uno::RuntimeException();
1894 /*-- 09.12.98 14:18:51---------------------------------------------------
1896 -----------------------------------------------------------------------*/
1897 uno::Reference
< XTextRange
> SwXTextCursor::getEnd(void) throw( uno::RuntimeException
)
1899 vos::OGuard
aGuard(Application::GetSolarMutex());
1900 uno::Reference
< XTextRange
> xRet
;
1901 SwUnoCrsr
* pUnoCrsr
= ((SwXTextCursor
*)this)->GetCrsr();
1904 SwPaM
aPam(*pUnoCrsr
->End());
1905 uno::Reference
< XText
> xParent
= getText();
1906 if (CURSOR_META
== eType
)
1908 // return cursor to prevent modifying SwXTextRange for META
1909 SwXTextCursor
* const pCursor(
1910 new SwXTextCursor(xParent
, *pUnoCrsr
->GetPoint(),
1911 CURSOR_META
, pUnoCrsr
->GetDoc()) );
1912 pCursor
->gotoEnd(sal_False
);
1913 xRet
= static_cast<text::XWordCursor
*>(pCursor
);
1917 xRet
= new SwXTextRange(aPam
, xParent
);
1921 throw uno::RuntimeException();
1924 /*-- 09.12.98 14:18:51---------------------------------------------------
1926 -----------------------------------------------------------------------*/
1927 OUString
SwXTextCursor::getString(void) throw( uno::RuntimeException
)
1929 vos::OGuard
aGuard(Application::GetSolarMutex());
1931 SwUnoCrsr
* pUnoCrsr
= ((SwXTextCursor
*)this)->GetCrsr();
1934 /* if( pUnoCrsr->GetPoint()->nNode.GetIndex() ==
1935 pUnoCrsr->GetMark()->nNode.GetIndex() )
1937 SwTxtNode* pTxtNd = pUnoCrsr->GetNode()->GetTxtNode();
1940 sal_uInt16 nStt = pUnoCrsr->Start()->nContent.GetIndex();
1941 aTxt = pTxtNd->GetExpandTxt( nStt,
1942 pUnoCrsr->End()->nContent.GetIndex() - nStt );
1947 //Text ueber mehrere Absaetze
1948 SwXTextCursor::getTextFromPam(*pUnoCrsr
, aTxt
);
1952 throw uno::RuntimeException();
1955 /*-- 09.12.98 14:18:52---------------------------------------------------
1957 -----------------------------------------------------------------------*/
1958 void SwXTextCursor::setString(const OUString
& aString
) throw( uno::RuntimeException
)
1960 vos::OGuard
aGuard(Application::GetSolarMutex());
1961 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
1963 throw uno::RuntimeException();
1965 const bool bForceExpandHints( (CURSOR_META
!= eType
)
1967 : dynamic_cast<SwXMeta
*>(xParentText
.get())->CheckForOwnMemberMeta(
1968 0, GetPaM(), true) );
1969 DeleteAndInsert(aString
, bForceExpandHints
);
1971 /* -----------------------------03.05.00 12:56--------------------------------
1973 ---------------------------------------------------------------------------*/
1974 Any
SwXTextCursor::GetPropertyValue(
1975 SwPaM
& rPaM
, const SfxItemPropertySet
& rPropSet
,
1976 const OUString
& rPropertyName
)
1977 throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
1980 const SfxItemPropertySimpleEntry
* pEntry
= rPropSet
.getPropertyMap()->getByName(
1984 PropertyState eTemp
;
1985 BOOL bDone
= SwUnoCursorHelper::getCrsrPropertyValue( *pEntry
, rPaM
, &aAny
, eTemp
);
1988 SfxItemSet
aSet(rPaM
.GetDoc()->GetAttrPool(),
1989 RES_CHRATR_BEGIN
, RES_FRMATR_END
-1,
1990 RES_TXTATR_UNKNOWN_CONTAINER
, RES_TXTATR_UNKNOWN_CONTAINER
,
1991 RES_UNKNOWNATR_CONTAINER
, RES_UNKNOWNATR_CONTAINER
,
1993 SwXTextCursor::GetCrsrAttr(rPaM
, aSet
);
1995 rPropSet
.getPropertyValue(*pEntry
, aSet
, aAny
);
1999 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( 0 ) );
2003 /* -----------------------------03.05.00 12:57--------------------------------
2005 ---------------------------------------------------------------------------*/
2006 void SwXTextCursor::SetPropertyValue(
2007 SwPaM
& rPaM
, const SfxItemPropertySet
& rPropSet
, const OUString
& rPropertyName
,
2008 const Any
& aValue
, USHORT nAttrMode
)
2009 throw (UnknownPropertyException
, PropertyVetoException
,
2010 IllegalArgumentException
, WrappedTargetException
, RuntimeException
)
2012 SwDoc
* pDoc
= rPaM
.GetDoc();
2013 const SfxItemPropertySimpleEntry
* pEntry
= rPropSet
.getPropertyMap()->getByName(rPropertyName
);
2016 if( pEntry
->nFlags
& PropertyAttribute::READONLY
)
2017 throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( 0 ) );
2019 SfxItemSet
aItemSet( pDoc
->GetAttrPool(), pEntry
->nWID
, pEntry
->nWID
);
2020 SwXTextCursor::GetCrsrAttr( rPaM
, aItemSet
);
2022 if(!lcl_setCrsrPropertyValue( pEntry
, rPaM
, aItemSet
, aValue
))
2023 rPropSet
.setPropertyValue(*pEntry
, aValue
, aItemSet
);
2024 SwXTextCursor::SetCrsrAttr(rPaM
, aItemSet
, nAttrMode
);
2027 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( 0 ) );
2029 /* -----------------------------03.05.00 13:16--------------------------------
2031 ---------------------------------------------------------------------------*/
2032 Sequence
< PropertyState
> SwXTextCursor::GetPropertyStates(
2033 SwPaM
& rPaM
, const SfxItemPropertySet
& rPropSet
,
2034 const Sequence
< OUString
>& PropertyNames
,
2035 SwGetPropertyStatesCaller eCaller
)
2036 throw(UnknownPropertyException
, RuntimeException
)
2038 const OUString
* pNames
= PropertyNames
.getConstArray();
2039 Sequence
< PropertyState
> aRet ( PropertyNames
.getLength() );
2040 PropertyState
* pStates
= aRet
.getArray();
2042 SfxItemSet
*pSet
= 0, *pSetParent
= 0;
2043 const SfxItemPropertyMap
*pMap
= rPropSet
.getPropertyMap();
2044 for( INT32 i
= 0, nEnd
= PropertyNames
.getLength(); i
< nEnd
; i
++ )
2046 const SfxItemPropertySimpleEntry
* pEntry
= pMap
->getByName( pNames
[i
] );
2049 if(pNames
[i
].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT
)) ||
2050 pNames
[i
].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT
)))
2052 pStates
[i
] = beans::PropertyState_DEFAULT_VALUE
;
2055 else if( SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
== eCaller
)
2057 //this values marks the element as unknown property
2058 pStates
[i
] = beans::PropertyState_MAKE_FIXED_SIZE
;
2062 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames
[i
], static_cast < cppu::OWeakObject
* > ( 0 ) );
2064 if ((eCaller
== SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION
|| eCaller
== SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
) &&
2065 pEntry
->nWID
< FN_UNO_RANGE_BEGIN
&&
2066 pEntry
->nWID
> FN_UNO_RANGE_END
&&
2067 pEntry
->nWID
< RES_CHRATR_BEGIN
&&
2068 pEntry
->nWID
> RES_TXTATR_END
)
2069 pStates
[i
] = beans::PropertyState_DEFAULT_VALUE
;
2072 if ( pEntry
->nWID
>= FN_UNO_RANGE_BEGIN
&&
2073 pEntry
->nWID
<= FN_UNO_RANGE_END
)
2074 SwUnoCursorHelper::getCrsrPropertyValue(*pEntry
, rPaM
, 0, pStates
[i
] );
2081 case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT
:
2082 case SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION
:
2083 pSet
= new SfxItemSet( rPaM
.GetDoc()->GetAttrPool(),
2084 RES_CHRATR_BEGIN
, RES_TXTATR_END
);
2086 case SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY
:
2087 pSet
= new SfxItemSet( rPaM
.GetDoc()->GetAttrPool(),
2088 pEntry
->nWID
, pEntry
->nWID
);
2091 pSet
= new SfxItemSet( rPaM
.GetDoc()->GetAttrPool(),
2092 RES_CHRATR_BEGIN
, RES_FRMATR_END
- 1,
2093 RES_UNKNOWNATR_CONTAINER
, RES_UNKNOWNATR_CONTAINER
,
2094 RES_TXTATR_UNKNOWN_CONTAINER
, RES_TXTATR_UNKNOWN_CONTAINER
,
2097 // --> OD 2006-07-12 #i63870#
2098 SwXTextCursor::GetCrsrAttr( rPaM
, *pSet
);
2103 pStates
[i
] = rPropSet
.getPropertyState( *pEntry
, *pSet
);
2105 pStates
[i
] = PropertyState_DEFAULT_VALUE
;
2107 //try again to find out if a value has been inherited
2108 if( beans::PropertyState_DIRECT_VALUE
== pStates
[i
] )
2112 pSetParent
= pSet
->Clone( FALSE
);
2113 // --> OD 2006-07-12 #i63870#
2114 SwXTextCursor::GetCrsrAttr( rPaM
, *pSetParent
, TRUE
, FALSE
);
2118 if( (pSetParent
)->Count() )
2119 pStates
[i
] = rPropSet
.getPropertyState( *pEntry
, *pSetParent
);
2121 pStates
[i
] = PropertyState_DEFAULT_VALUE
;
2130 /* -----------------------------03.05.00 13:17--------------------------------
2132 ---------------------------------------------------------------------------*/
2133 PropertyState
SwXTextCursor::GetPropertyState(
2134 SwPaM
& rPaM
, const SfxItemPropertySet
& rPropSet
, const OUString
& rPropertyName
)
2135 throw(UnknownPropertyException
, RuntimeException
)
2137 Sequence
< OUString
> aStrings ( 1 );
2138 aStrings
[0] = rPropertyName
;
2139 Sequence
< PropertyState
> aSeq
= GetPropertyStates( rPaM
, rPropSet
, aStrings
, SW_PROPERTY_STATE_CALLER_SINGLE_VALUE_ONLY
);
2142 /* -----------------------------03.05.00 13:20--------------------------------
2144 ---------------------------------------------------------------------------*/
2145 void lcl_SelectParaAndReset ( SwPaM
&rPaM
, SwDoc
* pDoc
, const SvUShortsSort
* pWhichIds
= 0 )
2147 // if we are reseting paragraph attributes, we need to select the full paragraph first
2148 SwPosition aStart
= *rPaM
.Start();
2149 SwPosition aEnd
= *rPaM
.End();
2150 auto_ptr
< SwUnoCrsr
> pTemp ( pDoc
->CreateUnoCrsr(aStart
, FALSE
) );
2151 if(!SwUnoCursorHelper::IsStartOfPara(*pTemp
))
2152 pTemp
->MovePara(fnParaCurr
, fnParaStart
);
2154 *pTemp
->GetPoint() = aEnd
;
2155 SwXTextCursor::SelectPam(*pTemp
, sal_True
);
2156 if(!SwUnoCursorHelper::IsEndOfPara(*pTemp
))
2157 pTemp
->MovePara(fnParaCurr
, fnParaEnd
);
2158 pDoc
->ResetAttrs(*pTemp
, sal_True
, pWhichIds
);
2162 void SwXTextCursor::SetPropertyToDefault(
2163 SwPaM
& rPaM
, const SfxItemPropertySet
& rPropSet
,
2164 const OUString
& rPropertyName
)
2165 throw(UnknownPropertyException
, RuntimeException
)
2167 NAMESPACE_VOS(OGuard
) aGuard(Application::GetSolarMutex());
2168 SwDoc
* pDoc
= rPaM
.GetDoc();
2169 const SfxItemPropertySimpleEntry
* pEntry
= rPropSet
.getPropertyMap()->getByName( rPropertyName
);
2172 if ( pEntry
->nFlags
& PropertyAttribute::READONLY
)
2173 throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertyToDefault: property is read-only: " ) ) + rPropertyName
, 0 );
2174 if(pEntry
->nWID
< RES_FRMATR_END
)
2176 SvUShortsSort aWhichIds
;
2177 aWhichIds
.Insert(pEntry
->nWID
);
2178 if(pEntry
->nWID
< RES_PARATR_BEGIN
)
2179 pDoc
->ResetAttrs(rPaM
, sal_True
, &aWhichIds
);
2181 lcl_SelectParaAndReset ( rPaM
, pDoc
, &aWhichIds
);
2184 SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry
, rPaM
);
2187 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( 0 ) );
2189 /* -----------------------------03.05.00 13:19--------------------------------
2191 ---------------------------------------------------------------------------*/
2192 Any
SwXTextCursor::GetPropertyDefault(
2193 SwPaM
& rPaM
, const SfxItemPropertySet
& rPropSet
,
2194 const OUString
& rPropertyName
)
2195 throw( UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
2198 SwDoc
* pDoc
= rPaM
.GetDoc();
2199 const SfxItemPropertySimpleEntry
* pEntry
= rPropSet
.getPropertyMap()->getByName( rPropertyName
);
2202 if(pEntry
->nWID
< RES_FRMATR_END
)
2204 const SfxPoolItem
& rDefItem
= pDoc
->GetAttrPool().GetDefaultItem(pEntry
->nWID
);
2205 rDefItem
.QueryValue(aRet
, pEntry
->nMemberId
);
2209 throw UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + rPropertyName
, static_cast < cppu::OWeakObject
* > ( 0 ) );
2212 /*-- 09.12.98 14:18:54---------------------------------------------------
2214 -----------------------------------------------------------------------*/
2215 uno::Reference
< beans::XPropertySetInfo
> SwXTextCursor::getPropertySetInfo(void) throw( uno::RuntimeException
)
2217 static uno::Reference
< beans::XPropertySetInfo
> xRef
;
2220 static SfxItemPropertyMapEntry aCrsrExtMap_Impl
[] =
2222 { SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT
), FN_SKIP_HIDDEN_TEXT
, &::getBooleanCppuType(), PROPERTY_NONE
, 0},
2223 { SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT
), FN_SKIP_PROTECTED_TEXT
, &::getBooleanCppuType(), PROPERTY_NONE
, 0},
2226 uno::Reference
< beans::XPropertySetInfo
> xInfo
= m_pPropSet
->getPropertySetInfo();
2227 // PropertySetInfo verlaengern!
2228 const uno::Sequence
<beans::Property
> aPropSeq
= xInfo
->getProperties();
2229 xRef
= new SfxExtItemPropertySetInfo(
2235 /*-- 09.12.98 14:18:54---------------------------------------------------
2237 -----------------------------------------------------------------------*/
2238 void SwXTextCursor::setPropertyValue(const OUString
& rPropertyName
, const uno::Any
& aValue
)
2239 throw( beans::UnknownPropertyException
, beans::PropertyVetoException
,
2240 lang::IllegalArgumentException
, lang::WrappedTargetException
, uno::RuntimeException
)
2242 vos::OGuard
aGuard(Application::GetSolarMutex());
2243 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2246 if(rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT
)))
2248 sal_Bool bSet
= *(sal_Bool
*)aValue
.getValue();
2249 pUnoCrsr
->SetSkipOverHiddenSections(bSet
);
2251 else if(rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT
)))
2253 sal_Bool bSet
= *(sal_Bool
*)aValue
.getValue();
2254 pUnoCrsr
->SetSkipOverProtectSections(bSet
);
2257 SetPropertyValue(*pUnoCrsr
, *m_pPropSet
, rPropertyName
, aValue
);
2260 throw uno::RuntimeException();
2263 /*-- 09.12.98 14:18:55---------------------------------------------------
2265 -----------------------------------------------------------------------*/
2266 Any
SwXTextCursor::getPropertyValue(const OUString
& rPropertyName
)
2267 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2269 vos::OGuard
aGuard(Application::GetSolarMutex());
2271 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2274 if(rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT
)))
2276 BOOL bSet
= pUnoCrsr
->IsSkipOverHiddenSections();
2277 aAny
.setValue(&bSet
, ::getBooleanCppuType());
2279 else if(rPropertyName
.equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT
)))
2281 BOOL bSet
= pUnoCrsr
->IsSkipOverProtectSections();
2282 aAny
.setValue(&bSet
, ::getBooleanCppuType());
2285 aAny
= GetPropertyValue(*pUnoCrsr
, *m_pPropSet
, rPropertyName
);
2288 throw uno::RuntimeException();
2292 /*-- 09.12.98 14:18:55---------------------------------------------------
2294 -----------------------------------------------------------------------*/
2295 void SwXTextCursor::addPropertyChangeListener(const OUString
& /*PropertyName*/, const uno::Reference
< beans::XPropertyChangeListener
> & /*aListener*/) throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2297 DBG_WARNING("not implemented");
2299 /*-- 09.12.98 14:18:57---------------------------------------------------
2301 -----------------------------------------------------------------------*/
2302 void SwXTextCursor::removePropertyChangeListener(const OUString
& /*PropertyName*/, const uno::Reference
< beans::XPropertyChangeListener
> & /*aListener*/) throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2304 DBG_WARNING("not implemented");
2306 /*-- 09.12.98 14:18:57---------------------------------------------------
2308 -----------------------------------------------------------------------*/
2309 void SwXTextCursor::addVetoableChangeListener(const OUString
& /*PropertyName*/, const uno::Reference
< beans::XVetoableChangeListener
> & /*aListener*/) throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2311 DBG_WARNING("not implemented");
2313 /*-- 09.12.98 14:18:58---------------------------------------------------
2315 -----------------------------------------------------------------------*/
2316 void SwXTextCursor::removeVetoableChangeListener(const OUString
& /*PropertyName*/, const uno::Reference
< beans::XVetoableChangeListener
> & /*aListener*/) throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2318 DBG_WARNING("not implemented");
2320 /*-- 05.03.99 11:36:11---------------------------------------------------
2322 -----------------------------------------------------------------------*/
2323 beans::PropertyState
SwXTextCursor::getPropertyState(const OUString
& rPropertyName
)
2324 throw( beans::UnknownPropertyException
, uno::RuntimeException
)
2326 vos::OGuard
aGuard(Application::GetSolarMutex());
2327 beans::PropertyState eRet
= beans::PropertyState_DEFAULT_VALUE
;
2328 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2331 eRet
= GetPropertyState(*pUnoCrsr
, *m_pPropSet
, rPropertyName
);
2334 throw RuntimeException();
2337 /*-- 05.03.99 11:36:11---------------------------------------------------
2339 -----------------------------------------------------------------------*/
2340 uno::Sequence
< beans::PropertyState
> SwXTextCursor::getPropertyStates(
2341 const uno::Sequence
< OUString
>& PropertyNames
)
2342 throw( beans::UnknownPropertyException
, uno::RuntimeException
)
2344 vos::OGuard
aGuard(Application::GetSolarMutex());
2345 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2347 throw RuntimeException();
2348 return GetPropertyStates(*pUnoCrsr
, *m_pPropSet
, PropertyNames
);
2350 /*-- 05.03.99 11:36:12---------------------------------------------------
2352 -----------------------------------------------------------------------*/
2353 void SwXTextCursor::setPropertyToDefault(const OUString
& rPropertyName
)
2354 throw( beans::UnknownPropertyException
, uno::RuntimeException
)
2356 Sequence
< OUString
> aSequence ( &rPropertyName
, 1 );
2357 setPropertiesToDefault ( aSequence
);
2359 /*-- 05.03.99 11:36:12---------------------------------------------------
2361 -----------------------------------------------------------------------*/
2362 uno::Any
SwXTextCursor::getPropertyDefault(const OUString
& rPropertyName
)
2363 throw( beans::UnknownPropertyException
, lang::WrappedTargetException
, uno::RuntimeException
)
2365 const Sequence
< OUString
> aSequence ( &rPropertyName
, 1 );
2366 return getPropertyDefaults ( aSequence
).getConstArray()[0];
2369 void SAL_CALL
SwXTextCursor::setAllPropertiesToDefault()
2370 throw (RuntimeException
)
2372 vos::OGuard
aGuard(Application::GetSolarMutex());
2374 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2377 // para specific attribut ranges
2378 USHORT aParaResetableSetRange
[] = {
2379 RES_FRMATR_BEGIN
, RES_FRMATR_END
-1,
2380 RES_PARATR_BEGIN
, RES_PARATR_END
-1,
2381 // --> OD 2008-02-25 #refactorlists#
2382 RES_PARATR_LIST_BEGIN
, RES_PARATR_LIST_END
-1,
2384 RES_UNKNOWNATR_BEGIN
, RES_UNKNOWNATR_END
-1,
2387 // selection specific attribut ranges
2388 USHORT aResetableSetRange
[] = {
2389 RES_CHRATR_BEGIN
, RES_CHRATR_END
-1,
2390 RES_TXTATR_CHARFMT
, RES_TXTATR_CHARFMT
,
2391 RES_TXTATR_INETFMT
, RES_TXTATR_INETFMT
,
2392 RES_TXTATR_CJK_RUBY
, RES_TXTATR_UNKNOWN_CONTAINER
,
2395 SvUShortsSort aParaWhichIds
;
2396 SvUShortsSort aWhichIds
;
2397 for (USHORT k
= 0; k
< 2; ++k
)
2399 SvUShortsSort
&rWhichIds
= k
== 0? aParaWhichIds
: aWhichIds
;
2400 USHORT
*pResetableSetRange
= k
== 0? aParaResetableSetRange
: aResetableSetRange
;
2401 while (*pResetableSetRange
)
2403 USHORT nStart
= sal::static_int_cast
< USHORT
>(*pResetableSetRange
++);
2404 USHORT nEnd
= sal::static_int_cast
< USHORT
>(*pResetableSetRange
++);
2405 for (USHORT nId
= nStart
+ 1; nId
<= nEnd
; ++nId
)
2406 rWhichIds
.Insert( nId
);
2409 if (aParaWhichIds
.Count())
2410 lcl_SelectParaAndReset( *pUnoCrsr
, pUnoCrsr
->GetDoc(), &aParaWhichIds
);
2411 if (aWhichIds
.Count() )
2412 pUnoCrsr
->GetDoc()->ResetAttrs( *pUnoCrsr
, sal_True
, &aWhichIds
);
2415 throw uno::RuntimeException();
2418 void SAL_CALL
SwXTextCursor::setPropertiesToDefault( const Sequence
< OUString
>& aPropertyNames
)
2419 throw (UnknownPropertyException
, RuntimeException
)
2421 vos::OGuard
aGuard(Application::GetSolarMutex());
2422 sal_Int32 nCount
= aPropertyNames
.getLength();
2425 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2428 SwDoc
* pDoc
= pUnoCrsr
->GetDoc();
2429 const OUString
* pNames
= aPropertyNames
.getConstArray();
2430 SvUShortsSort aWhichIds
, aParaWhichIds
;
2431 for ( sal_Int32 i
= 0; i
< nCount
; i
++ )
2433 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( pNames
[i
] );
2436 if(pNames
[i
].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT
)) ||
2437 pNames
[i
].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT
)))
2442 throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames
[i
], static_cast < cppu::OWeakObject
* > ( 0 ) );
2444 if( pEntry
->nFlags
& PropertyAttribute::READONLY
)
2445 throw RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "setPropertiesToDefault: property is read-only: " ) ) + pNames
[i
], static_cast < cppu::OWeakObject
* > ( this ) );
2447 if( pEntry
->nWID
< RES_FRMATR_END
)
2449 if(pEntry
->nWID
< RES_PARATR_BEGIN
)
2450 aWhichIds
.Insert(pEntry
->nWID
);
2452 aParaWhichIds
.Insert (pEntry
->nWID
);
2454 else if ( pEntry
->nWID
== FN_UNO_NUM_START_VALUE
)
2455 SwUnoCursorHelper::resetCrsrPropertyValue(*pEntry
, *pUnoCrsr
);
2458 if ( aParaWhichIds
.Count() )
2459 lcl_SelectParaAndReset ( *pUnoCrsr
, pDoc
, &aParaWhichIds
);
2460 if (aWhichIds
.Count() )
2461 pDoc
->ResetAttrs(*pUnoCrsr
, sal_True
, &aWhichIds
);
2464 throw uno::RuntimeException();
2467 Sequence
< Any
> SAL_CALL
SwXTextCursor::getPropertyDefaults( const Sequence
< OUString
>& aPropertyNames
)
2468 throw (UnknownPropertyException
, WrappedTargetException
, RuntimeException
)
2470 vos::OGuard
aGuard(Application::GetSolarMutex());
2471 sal_Int32 nCount
= aPropertyNames
.getLength();
2472 Sequence
< Any
> aRet ( nCount
);
2475 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2478 SwDoc
* pDoc
= pUnoCrsr
->GetDoc();
2479 const OUString
*pNames
= aPropertyNames
.getConstArray();
2480 Any
*pAny
= aRet
.getArray();
2481 for ( sal_Int32 i
= 0; i
< nCount
; i
++)
2483 const SfxItemPropertySimpleEntry
* pEntry
= m_pPropSet
->getPropertyMap()->getByName( pNames
[i
] );
2486 if(pNames
[i
].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_HIDDEN_TEXT
)) ||
2487 pNames
[i
].equalsAsciiL( SW_PROP_NAME(UNO_NAME_IS_SKIP_PROTECTED_TEXT
)))
2492 throw UnknownPropertyException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pNames
[i
], static_cast < cppu::OWeakObject
* > ( 0 ) );
2494 if(pEntry
->nWID
< RES_FRMATR_END
)
2496 const SfxPoolItem
& rDefItem
= pDoc
->GetAttrPool().GetDefaultItem(pEntry
->nWID
);
2497 rDefItem
.QueryValue(pAny
[i
], pEntry
->nMemberId
);
2502 throw UnknownPropertyException();
2507 /*-- 10.03.2008 09:58:47---------------------------------------------------
2509 -----------------------------------------------------------------------*/
2510 void SwXTextCursor::makeRedline(
2511 const ::rtl::OUString
& rRedlineType
,
2512 const uno::Sequence
< beans::PropertyValue
>& rRedlineProperties
)
2513 throw (lang::IllegalArgumentException
, uno::RuntimeException
)
2515 vos::OGuard
aGuard(Application::GetSolarMutex());
2516 SwUnoCrsr
* pUnoCrsr
= GetCrsr();
2518 SwUnoCursorHelper::makeRedline( *pUnoCrsr
, rRedlineType
, rRedlineProperties
);
2520 throw uno::RuntimeException();