xref: /aoo41x/main/sw/source/core/unocore/unoport.cxx (revision dec99bbd)
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 
28 #include <cmdid.h>
29 #include <vos/mutex.hxx>
30 #include <vcl/svapp.hxx>
31 #include <svl/itemprop.hxx>
32 
33 #include <unocrsrhelper.hxx>
34 #include <unoport.hxx>
35 #include <unoparaframeenum.hxx>
36 #include <unotextrange.hxx>
37 #include <unomap.hxx>
38 #include <unoprnms.hxx>
39 #include <unomid.h>
40 #include <txtatr.hxx>
41 #include <txtfld.hxx>
42 #include <ndtxt.hxx>
43 #include <doc.hxx>
44 #include <fmtflcnt.hxx>
45 #include <fmtfld.hxx>
46 #include <frmfmt.hxx>
47 
48 #include <com/sun/star/beans/PropertyAttribute.hpp>
49 #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
50 #include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
51 #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
52 
53 
54 using namespace ::com::sun::star;
55 using ::rtl::OUString;
56 
57 
58 /******************************************************************
59  * SwXTextPortion
60  ******************************************************************/
61 
init(const SwUnoCrsr * pPortionCursor)62 void SwXTextPortion::init(const SwUnoCrsr* pPortionCursor)
63 {
64     SwUnoCrsr* pUnoCursor =
65         pPortionCursor->GetDoc()->CreateUnoCrsr(*pPortionCursor->GetPoint());
66     if (pPortionCursor->HasMark())
67     {
68         pUnoCursor->SetMark();
69         *pUnoCursor->GetMark() = *pPortionCursor->GetMark();
70     }
71     pUnoCursor->Add(this);
72 }
73 
74 /*-- 11.12.98 09:56:55---------------------------------------------------
75 
76   -----------------------------------------------------------------------*/
SwXTextPortion(const SwUnoCrsr * pPortionCrsr,uno::Reference<text::XText> const & rParent,SwTextPortionType eType)77 SwXTextPortion::SwXTextPortion(
78     const SwUnoCrsr* pPortionCrsr,
79     uno::Reference< text::XText > const& rParent,
80     SwTextPortionType eType )
81     : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
82     , m_pPropSet(aSwMapProvider.GetPropertySet(
83         (PORTION_REDLINE_START == eType ||
84          PORTION_REDLINE_END   == eType)
85             ?  PROPERTY_MAP_REDLINE_PORTION
86             :  PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
87     , m_xParentText(rParent)
88     , m_pRubyText(0)
89     , m_pRubyStyle(0)
90     , m_pRubyAdjust(0)
91     , m_pRubyIsAbove(0)
92     , m_FrameDepend(this, 0)
93     , m_pFrameFmt(0)
94     , m_ePortionType(eType)
95     , m_bIsCollapsed(false)
96 {
97     init( pPortionCrsr);
98 }
99 
100 /* -----------------24.03.99 16:30-------------------
101  *
102  * --------------------------------------------------*/
SwXTextPortion(const SwUnoCrsr * pPortionCrsr,uno::Reference<text::XText> const & rParent,SwFrmFmt & rFmt)103 SwXTextPortion::SwXTextPortion(
104     const SwUnoCrsr* pPortionCrsr,
105     uno::Reference< text::XText > const& rParent,
106     SwFrmFmt& rFmt )
107     : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
108     , m_pPropSet(aSwMapProvider.GetPropertySet(
109                     PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
110     , m_xParentText(rParent)
111     , m_pRubyText(0)
112     , m_pRubyStyle(0)
113     , m_pRubyAdjust(0)
114     , m_pRubyIsAbove(0)
115     , m_FrameDepend(this, &rFmt)
116     , m_pFrameFmt(&rFmt)
117     , m_ePortionType(PORTION_FRAME)
118     , m_bIsCollapsed(false)
119 {
120     init( pPortionCrsr);
121 }
122 
123 /* -----------------------------19.02.01 10:52--------------------------------
124 
125  ---------------------------------------------------------------------------*/
SwXTextPortion(const SwUnoCrsr * pPortionCrsr,SwTxtRuby const & rAttr,uno::Reference<text::XText> const & xParent,sal_Bool bIsEnd)126 SwXTextPortion::SwXTextPortion(
127     const SwUnoCrsr* pPortionCrsr,
128     SwTxtRuby const& rAttr,
129     uno::Reference< text::XText > const& xParent,
130     sal_Bool bIsEnd )
131     : m_ListenerContainer( static_cast<text::XTextRange*>(this) )
132     , m_pPropSet(aSwMapProvider.GetPropertySet(
133                     PROPERTY_MAP_TEXTPORTION_EXTENSIONS))
134     , m_xParentText(xParent)
135     , m_pRubyText   ( bIsEnd ? 0 : new uno::Any )
136     , m_pRubyStyle  ( bIsEnd ? 0 : new uno::Any )
137     , m_pRubyAdjust ( bIsEnd ? 0 : new uno::Any )
138     , m_pRubyIsAbove( bIsEnd ? 0 : new uno::Any )
139     , m_FrameDepend(this, 0)
140     , m_pFrameFmt(0)
141     , m_ePortionType( bIsEnd ? PORTION_RUBY_END : PORTION_RUBY_START )
142     , m_bIsCollapsed(false)
143 {
144     init( pPortionCrsr);
145 
146     if (!bIsEnd)
147     {
148         const SfxPoolItem& rItem = rAttr.GetAttr();
149         rItem.QueryValue(*m_pRubyText, MID_RUBY_TEXT);
150         rItem.QueryValue(*m_pRubyStyle, MID_RUBY_CHARSTYLE);
151         rItem.QueryValue(*m_pRubyAdjust, MID_RUBY_ADJUST);
152         rItem.QueryValue(*m_pRubyIsAbove, MID_RUBY_ABOVE);
153     }
154 }
155 
156 /*-- 11.12.98 09:56:55---------------------------------------------------
157 
158   -----------------------------------------------------------------------*/
~SwXTextPortion()159 SwXTextPortion::~SwXTextPortion()
160 {
161     vos::OGuard aGuard(Application::GetSolarMutex());
162     SwUnoCrsr* pUnoCrsr = GetCursor();
163 	delete pUnoCrsr;
164 }
165 /*-- 11.12.98 09:56:56---------------------------------------------------
166 
167   -----------------------------------------------------------------------*/
getText()168 uno::Reference< text::XText >  SwXTextPortion::getText()
169 throw( uno::RuntimeException )
170 {
171     return m_xParentText;
172 }
173 /*-- 11.12.98 09:56:56---------------------------------------------------
174 
175   -----------------------------------------------------------------------*/
getStart()176 uno::Reference< text::XTextRange >  SwXTextPortion::getStart()
177 throw( uno::RuntimeException )
178 {
179 	vos::OGuard aGuard(Application::GetSolarMutex());
180 	uno::Reference< text::XTextRange >  xRet;
181     SwUnoCrsr* pUnoCrsr = GetCursor();
182     if (!pUnoCrsr)
183         throw uno::RuntimeException();
184 
185     SwPaM aPam(*pUnoCrsr->Start());
186     uno::Reference< text::XText > xParent = getText();
187     xRet = new SwXTextRange(aPam, xParent);
188 	return xRet;
189 }
190 /*-- 11.12.98 09:56:57---------------------------------------------------
191 
192   -----------------------------------------------------------------------*/
getEnd()193 uno::Reference< text::XTextRange >  SwXTextPortion::getEnd()
194 throw( uno::RuntimeException )
195 {
196 	vos::OGuard aGuard(Application::GetSolarMutex());
197 	uno::Reference< text::XTextRange >  xRet;
198     SwUnoCrsr* pUnoCrsr = GetCursor();
199     if (!pUnoCrsr)
200         throw uno::RuntimeException();
201 
202     SwPaM aPam(*pUnoCrsr->End());
203     uno::Reference< text::XText > xParent = getText();
204     xRet = new SwXTextRange(aPam, xParent);
205 	return xRet;
206 }
207 /*-- 11.12.98 09:56:57---------------------------------------------------
208 
209   -----------------------------------------------------------------------*/
getString()210 OUString SwXTextPortion::getString()
211 throw( uno::RuntimeException )
212 {
213 	vos::OGuard aGuard(Application::GetSolarMutex());
214     OUString aTxt;
215     SwUnoCrsr* pUnoCrsr = GetCursor();
216     if (!pUnoCrsr)
217         throw uno::RuntimeException();
218 
219     // TextPortions are always within a paragraph
220     SwTxtNode* pTxtNd = pUnoCrsr->GetNode()->GetTxtNode();
221     if ( pTxtNd )
222     {
223         xub_StrLen nStt = pUnoCrsr->Start()->nContent.GetIndex();
224         aTxt = pTxtNd->GetExpandTxt( nStt,
225                 pUnoCrsr->End()->nContent.GetIndex() - nStt );
226     }
227 	return aTxt;
228 }
229 /*-- 11.12.98 09:56:57---------------------------------------------------
230 
231   -----------------------------------------------------------------------*/
setString(const OUString & aString)232 void SwXTextPortion::setString(const OUString& aString) throw( uno::RuntimeException )
233 {
234 	vos::OGuard aGuard(Application::GetSolarMutex());
235     SwUnoCrsr* pUnoCrsr = GetCursor();
236     if (!pUnoCrsr)
237         throw uno::RuntimeException();
238 
239     SwUnoCursorHelper::SetString(*pUnoCrsr, aString);
240 }
241 /*-- 11.12.98 09:56:57---------------------------------------------------
242 
243   -----------------------------------------------------------------------*/
getPropertySetInfo()244 uno::Reference< beans::XPropertySetInfo >  SwXTextPortion::getPropertySetInfo()
245 throw( uno::RuntimeException )
246 {
247     vos::OGuard aGuard(Application::GetSolarMutex());
248     //! PropertySetInfo for text portion extensions
249     static uno::Reference< beans::XPropertySetInfo >
250             xTxtPorExtRef = aSwMapProvider.GetPropertySet(
251                     PROPERTY_MAP_TEXTPORTION_EXTENSIONS)->getPropertySetInfo();
252     //! PropertySetInfo for redline portions
253     static uno::Reference< beans::XPropertySetInfo >
254             xRedlPorRef = aSwMapProvider.GetPropertySet(
255                     PROPERTY_MAP_REDLINE_PORTION)->getPropertySetInfo();
256 
257     return (PORTION_REDLINE_START == m_ePortionType ||
258             PORTION_REDLINE_END   == m_ePortionType) ? xRedlPorRef : xTxtPorExtRef;
259 }
260 /*-- 11.12.98 09:56:57---------------------------------------------------
261 
262   -----------------------------------------------------------------------*/
setPropertyValue(const OUString & rPropertyName,const uno::Any & aValue)263 void SwXTextPortion::setPropertyValue(const OUString& rPropertyName,
264 	const uno::Any& aValue)
265 	throw( beans::UnknownPropertyException,
266 		beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
267 {
268 	vos::OGuard aGuard(Application::GetSolarMutex());
269     SwUnoCrsr* pUnoCrsr = GetCursor();
270     if (!pUnoCrsr)
271         throw uno::RuntimeException();
272 
273     SwUnoCursorHelper::SetPropertyValue(*pUnoCrsr, *m_pPropSet,
274             rPropertyName, aValue);
275 }
276 /*-- 04.11.03 09:56:58---------------------------------------------------
277 
278   -----------------------------------------------------------------------*/
GetPropertyValue(uno::Any & rVal,const SfxItemPropertySimpleEntry & rEntry,SwUnoCrsr * pUnoCrsr,SfxItemSet * & pSet)279 void SwXTextPortion::GetPropertyValue(
280         uno::Any &rVal,
281         const SfxItemPropertySimpleEntry& rEntry,
282         SwUnoCrsr *pUnoCrsr,
283         SfxItemSet *&pSet )
284 {
285     DBG_ASSERT( pUnoCrsr, "UNO cursor missing" );
286     if (!pUnoCrsr)
287         return;
288     if(pUnoCrsr)
289     {
290         switch(rEntry.nWID)
291         {
292             case FN_UNO_TEXT_PORTION_TYPE:
293             {
294                 const char* pRet;
295                 switch (m_ePortionType)
296                 {
297                 case PORTION_TEXT:          pRet = "Text";break;
298                 case PORTION_FIELD:         pRet = "TextField";break;
299                 case PORTION_FRAME:         pRet = "Frame";break;
300                 case PORTION_FOOTNOTE:      pRet = "Footnote";break;
301                 case PORTION_REFMARK_START:
302                 case PORTION_REFMARK_END:   pRet = SW_PROP_NAME_STR(UNO_NAME_REFERENCE_MARK);break;
303                 case PORTION_TOXMARK_START:
304                 case PORTION_TOXMARK_END:   pRet = SW_PROP_NAME_STR(UNO_NAME_DOCUMENT_INDEX_MARK);break;
305                 case PORTION_BOOKMARK_START :
306                 case PORTION_BOOKMARK_END : pRet = SW_PROP_NAME_STR(UNO_NAME_BOOKMARK);break;
307                 case PORTION_REDLINE_START:
308                 case PORTION_REDLINE_END:   pRet = "Redline";break;
309                 case PORTION_RUBY_START:
310                 case PORTION_RUBY_END:      pRet = "Ruby";break;
311                 case PORTION_SOFT_PAGEBREAK:pRet = "SoftPageBreak";break;
312                 case PORTION_META:          pRet = SW_PROP_NAME_STR(UNO_NAME_META); break;
313                 case PORTION_FIELD_START:pRet = "TextFieldStart";break;
314                 case PORTION_FIELD_END:pRet = "TextFieldEnd";break;
315                 case PORTION_FIELD_START_END:pRet = "TextFieldStartEnd";break;
316                 case PORTION_ANNOTATION:
317                     pRet = "Annotation";
318                     break;
319                 case PORTION_ANNOTATION_END:
320                     pRet = "AnnotationEnd";
321                     break;
322                 default:
323                     pRet = 0;
324                 }
325 
326                 OUString sRet;
327                 if( pRet )
328                     sRet = C2U( pRet );
329                 rVal <<= sRet;
330             }
331             break;
332             case FN_UNO_CONTROL_CHARACTER: // obsolete!
333             break;
334             case FN_UNO_DOCUMENT_INDEX_MARK:
335                 rVal <<= m_xTOXMark;
336             break;
337             case FN_UNO_REFERENCE_MARK:
338                 rVal <<= m_xRefMark;
339             break;
340             case FN_UNO_BOOKMARK:
341                 rVal <<= m_xBookmark;
342             break;
343             case FN_UNO_FOOTNOTE:
344                 rVal <<= m_xFootnote;
345             break;
346             case FN_UNO_TEXT_FIELD:
347                 rVal <<= m_xTextField;
348             break;
349             case FN_UNO_META:
350                 rVal <<= m_xMeta;
351             break;
352             case FN_UNO_IS_COLLAPSED:
353             {
354                 switch (m_ePortionType)
355                 {
356                     case PORTION_REFMARK_START:
357                     case PORTION_BOOKMARK_START :
358                     case PORTION_TOXMARK_START:
359                     case PORTION_REFMARK_END:
360                     case PORTION_TOXMARK_END:
361                     case PORTION_BOOKMARK_END :
362                     case PORTION_REDLINE_START :
363                     case PORTION_REDLINE_END :
364                     case PORTION_RUBY_START:
365                     case PORTION_RUBY_END:
366                     case PORTION_FIELD_START:
367                     case PORTION_FIELD_END:
368                         rVal.setValue(&m_bIsCollapsed, ::getBooleanCppuType());
369                     break;
370                     default:
371                     break;
372                 }
373             }
374             break;
375             case FN_UNO_IS_START:
376             {
377                 sal_Bool bStart = sal_True, bPut = sal_True;
378                 switch (m_ePortionType)
379                 {
380                     case PORTION_REFMARK_START:
381                     case PORTION_BOOKMARK_START:
382                     case PORTION_TOXMARK_START:
383                     case PORTION_REDLINE_START:
384                     case PORTION_RUBY_START:
385                     case PORTION_FIELD_START:
386                     break;
387 
388                     case PORTION_REFMARK_END:
389                     case PORTION_TOXMARK_END:
390                     case PORTION_BOOKMARK_END:
391                     case PORTION_REDLINE_END:
392                     case PORTION_RUBY_END:
393                     case PORTION_FIELD_END:
394                         bStart = sal_False;
395                     break;
396                     default:
397                         bPut = sal_False;
398                 }
399                 if(bPut)
400                     rVal.setValue(&bStart, ::getBooleanCppuType());
401             }
402             break;
403             case RES_TXTATR_CJK_RUBY:
404             {
405                 const uno::Any* pToSet = 0;
406                 switch(rEntry.nMemberId)
407                 {
408                     case MID_RUBY_TEXT :    pToSet = m_pRubyText.get();   break;
409                     case MID_RUBY_ADJUST :  pToSet = m_pRubyAdjust.get(); break;
410                     case MID_RUBY_CHARSTYLE:pToSet = m_pRubyStyle.get();  break;
411                     case MID_RUBY_ABOVE :   pToSet = m_pRubyIsAbove.get();break;
412                 }
413                 if(pToSet)
414                     rVal = *pToSet;
415             }
416             break;
417             default:
418                 beans::PropertyState eTemp;
419                 sal_Bool bDone = SwUnoCursorHelper::getCrsrPropertyValue(
420                                     rEntry, *pUnoCrsr, &(rVal), eTemp );
421                 if(!bDone)
422                 {
423                     if(!pSet)
424                     {
425                         pSet = new SfxItemSet(pUnoCrsr->GetDoc()->GetAttrPool(),
426                             RES_CHRATR_BEGIN, RES_FRMATR_END - 1,
427                             RES_UNKNOWNATR_CONTAINER, RES_UNKNOWNATR_CONTAINER,
428                             RES_TXTATR_UNKNOWN_CONTAINER, RES_TXTATR_UNKNOWN_CONTAINER,
429                             0L);
430                         SwUnoCursorHelper::GetCrsrAttr(*pUnoCrsr, *pSet);
431                     }
432                     m_pPropSet->getPropertyValue(rEntry, *pSet, rVal);
433                 }
434         }
435     }
436 }
437 
438 
GetPropertyValues_Impl(const uno::Sequence<OUString> & rPropertyNames)439 uno::Sequence< uno::Any > SAL_CALL SwXTextPortion::GetPropertyValues_Impl(
440         const uno::Sequence< OUString >& rPropertyNames )
441     throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
442 {
443     sal_Int32 nLength = rPropertyNames.getLength();
444     const OUString *pPropertyNames = rPropertyNames.getConstArray();
445     uno::Sequence< uno::Any > aValues(rPropertyNames.getLength());
446     uno::Any *pValues = aValues.getArray();
447     SwUnoCrsr* pUnoCrsr = GetCursor();
448     if (!pUnoCrsr)
449         throw uno::RuntimeException();
450 
451     {
452         SfxItemSet *pSet = 0;
453         // get startting pount fo the look-up, either the provided one or else
454         // from the beginning of the map
455         const SfxItemPropertyMap*   pMap = m_pPropSet->getPropertyMap();
456         for(sal_Int32 nProp = 0; nProp < nLength; nProp++)
457         {
458             const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pPropertyNames[nProp]);
459             if(pEntry)
460             {
461                 GetPropertyValue( pValues[nProp], *pEntry, pUnoCrsr, pSet );
462             }
463             else
464                 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
465         }
466         delete pSet;
467     }
468     return aValues;
469 }
470 /*-- 11.12.98 09:56:58---------------------------------------------------
471 
472   -----------------------------------------------------------------------*/
getPropertyValue(const OUString & rPropertyName)473 uno::Any SwXTextPortion::getPropertyValue(
474     const OUString& rPropertyName)
475         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
476 {
477     vos::OGuard aGuard(Application::GetSolarMutex());
478     uno::Sequence< ::rtl::OUString > aPropertyNames(1);
479     aPropertyNames.getArray()[0] = rPropertyName;
480     return GetPropertyValues_Impl(aPropertyNames).getConstArray()[0];
481 }
482 /* -----------------------------02.04.01 11:44--------------------------------
483 
484  ---------------------------------------------------------------------------*/
SetPropertyValues_Impl(const uno::Sequence<OUString> & rPropertyNames,const uno::Sequence<uno::Any> & rValues)485 void SAL_CALL SwXTextPortion::SetPropertyValues_Impl(
486     const uno::Sequence< OUString >& rPropertyNames,
487     const uno::Sequence< uno::Any >& rValues )
488     throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException,
489             lang::WrappedTargetException, uno::RuntimeException)
490 {
491     SwUnoCrsr* pUnoCrsr = GetCursor();
492     if (!pUnoCrsr)
493         throw uno::RuntimeException();
494 
495     {
496         const OUString* pPropertyNames = rPropertyNames.getConstArray();
497         const uno::Any* pValues = rValues.getConstArray();
498         const SfxItemPropertyMap* pMap = m_pPropSet->getPropertyMap();
499         for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength(); nProp++)
500         {
501             const SfxItemPropertySimpleEntry* pEntry = pMap->getByName(pPropertyNames[nProp]);
502             if (!pEntry)
503                 throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
504             if ( pEntry->nFlags & beans::PropertyAttribute::READONLY)
505                 throw beans::PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pPropertyNames[nProp], static_cast < cppu::OWeakObject * > ( this ) );
506 
507             SwUnoCursorHelper::SetPropertyValue( *pUnoCrsr, *m_pPropSet,
508                      pPropertyNames[nProp], pValues[nProp]);
509         }
510     }
511 }
512 
setPropertyValues(const uno::Sequence<OUString> & rPropertyNames,const uno::Sequence<uno::Any> & rValues)513 void SwXTextPortion::setPropertyValues(
514     const uno::Sequence< OUString >& rPropertyNames,
515     const uno::Sequence< uno::Any >& rValues )
516         throw(beans::PropertyVetoException, lang::IllegalArgumentException,
517             lang::WrappedTargetException, uno::RuntimeException)
518 {
519     vos::OGuard aGuard(Application::GetSolarMutex());
520 
521     // workaround for bad designed API
522     try
523     {
524         SetPropertyValues_Impl( rPropertyNames, rValues );
525     }
526     catch (beans::UnknownPropertyException &rException)
527     {
528         // wrap the original (here not allowed) exception in
529         // a lang::WrappedTargetException that gets thrown instead.
530         lang::WrappedTargetException aWExc;
531         aWExc.TargetException <<= rException;
532         throw aWExc;
533     }
534 }
535 /* -----------------------------02.04.01 11:44--------------------------------
536 
537  ---------------------------------------------------------------------------*/
getPropertyValues(const uno::Sequence<OUString> & rPropertyNames)538 uno::Sequence< uno::Any > SwXTextPortion::getPropertyValues(
539     const uno::Sequence< OUString >& rPropertyNames )
540         throw(uno::RuntimeException)
541 {
542     vos::OGuard aGuard(Application::GetSolarMutex());
543     uno::Sequence< uno::Any > aValues;
544 
545     // workaround for bad designed API
546     try
547     {
548         aValues = GetPropertyValues_Impl( rPropertyNames );
549     }
550     catch (beans::UnknownPropertyException &)
551     {
552         throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property exception caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
553     }
554     catch (lang::WrappedTargetException &)
555     {
556         throw uno::RuntimeException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "WrappedTargetException caught" ) ), static_cast < cppu::OWeakObject * > ( this ) );
557     }
558 
559     return aValues;
560 }
561 /* -----------------------------29.09.03 11:44--------------------------------
562 
563  ---------------------------------------------------------------------------*/
564 
565 /* disabled for #i46921# */
566 
setPropertyValuesTolerant(const uno::Sequence<OUString> & rPropertyNames,const uno::Sequence<uno::Any> & rValues)567 uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL SwXTextPortion::setPropertyValuesTolerant(
568         const uno::Sequence< OUString >& rPropertyNames,
569         const uno::Sequence< uno::Any >& rValues )
570     throw (lang::IllegalArgumentException, uno::RuntimeException)
571 {
572     vos::OGuard aGuard(Application::GetSolarMutex());
573 
574     if (rPropertyNames.getLength() != rValues.getLength())
575         throw lang::IllegalArgumentException();
576     SwUnoCrsr* pUnoCrsr = this->GetCursor();
577     if (!pUnoCrsr)
578         throw uno::RuntimeException();
579 
580     sal_Int32 nProps = rPropertyNames.getLength();
581     const OUString *pProp = rPropertyNames.getConstArray();
582 
583     //sal_Int32 nVals = rValues.getLength();
584     const uno::Any *pValue = rValues.getConstArray();
585 
586     sal_Int32 nFailed = 0;
587     uno::Sequence< beans::SetPropertyTolerantFailed > aFailed( nProps );
588     beans::SetPropertyTolerantFailed *pFailed = aFailed.getArray();
589 
590     const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap();
591 
592     OUString sTmp;
593     for (sal_Int32 i = 0;  i < nProps;  ++i)
594     {
595         try
596         {
597             pFailed[ nFailed ].Name    = pProp[i];
598 
599             const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] );
600             if (!pEntry)
601                 pFailed[ nFailed++ ].Result  = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
602             else
603             {
604                 // set property value
605                 // (compare to SwXTextPortion::setPropertyValues)
606                 if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
607                     pFailed[ nFailed++ ].Result  = beans::TolerantPropertySetResultType::PROPERTY_VETO;
608                 else
609                 {
610                     SwUnoCursorHelper::SetPropertyValue(
611                                 *pUnoCrsr, *m_pPropSet, pProp[i], pValue[i] );
612                 }
613             }
614         }
615         catch (beans::UnknownPropertyException &)
616         {
617             // should not occur because property was searched for before
618             DBG_ERROR( "unexpected exception catched" );
619             pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
620         }
621         catch (lang::IllegalArgumentException &)
622         {
623             pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
624         }
625         catch (beans::PropertyVetoException &)
626         {
627             pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
628         }
629         catch (lang::WrappedTargetException &)
630         {
631             pFailed[ nFailed++ ].Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
632         }
633     }
634 
635     aFailed.realloc( nFailed );
636     return aFailed;
637 }
638 
639 
getPropertyValuesTolerant(const uno::Sequence<OUString> & rPropertyNames)640 uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL SwXTextPortion::getPropertyValuesTolerant(
641         const uno::Sequence< OUString >& rPropertyNames )
642     throw (uno::RuntimeException)
643 {
644     vos::OGuard aGuard( Application::GetSolarMutex() );
645 
646     uno::Sequence< beans::GetDirectPropertyTolerantResult > aTmpRes(
647             GetPropertyValuesTolerant_Impl( rPropertyNames, sal_False ) );
648     const beans::GetDirectPropertyTolerantResult *pTmpRes = aTmpRes.getConstArray();
649 
650     // copy temporary result to final result type
651     sal_Int32 nLen = aTmpRes.getLength();
652     uno::Sequence< beans::GetPropertyTolerantResult > aRes( nLen );
653     beans::GetPropertyTolerantResult *pRes = aRes.getArray();
654     for (sal_Int32 i = 0;  i < nLen;  i++)
655         *pRes++ = *pTmpRes++;
656     return aRes;
657 }
658 
659 
getDirectPropertyValuesTolerant(const uno::Sequence<OUString> & rPropertyNames)660 uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::getDirectPropertyValuesTolerant(
661         const uno::Sequence< OUString >& rPropertyNames )
662     throw (uno::RuntimeException)
663 {
664     vos::OGuard aGuard( Application::GetSolarMutex() );
665     return GetPropertyValuesTolerant_Impl( rPropertyNames, sal_True );
666 }
667 
668 
GetPropertyValuesTolerant_Impl(const uno::Sequence<OUString> & rPropertyNames,sal_Bool bDirectValuesOnly)669 uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL SwXTextPortion::GetPropertyValuesTolerant_Impl(
670         const uno::Sequence< OUString >& rPropertyNames,
671         sal_Bool bDirectValuesOnly )
672     throw (uno::RuntimeException)
673 {
674     vos::OGuard aGuard(Application::GetSolarMutex());
675 
676     SwUnoCrsr* pUnoCrsr = this->GetCursor();
677     if(!pUnoCrsr)
678         throw uno::RuntimeException();
679 
680     sal_Int32 nProps = rPropertyNames.getLength();
681     const OUString *pProp = rPropertyNames.getConstArray();
682 
683     SfxItemSet *pSet = 0;
684 
685     const SfxItemPropertyMap* pPropMap = m_pPropSet->getPropertyMap();
686 
687 	uno::Sequence< beans::PropertyState > aPropertyStates =
688         SwUnoCursorHelper::GetPropertyStates(
689             *pUnoCrsr, *m_pPropSet,
690 			rPropertyNames,
691 			SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION_TOLERANT );
692 	const beans::PropertyState* pPropertyStates = aPropertyStates.getConstArray();
693 
694     std::vector< beans::GetDirectPropertyTolerantResult > aResultVector;
695     for (sal_Int32 i = 0;  i < nProps;  ++i)
696     {
697         beans::GetDirectPropertyTolerantResult aResult;
698         try
699         {
700             aResult.Name = pProp[i];
701             if(pPropertyStates[i] == beans::PropertyState_MAKE_FIXED_SIZE)     // property unknown?
702             {
703                 if( bDirectValuesOnly )
704                     continue;
705                 else
706                     aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
707             }
708             else
709             {
710       			const SfxItemPropertySimpleEntry* pEntry = pPropMap->getByName( pProp[i] );
711                 aResult.State  = pPropertyStates[i];
712 
713                 aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_FAILURE;
714                 //#i104499# ruby portion attributes need special handling:
715                 if( pEntry->nWID == RES_TXTATR_CJK_RUBY &&
716                     m_ePortionType == PORTION_RUBY_START )
717                 {
718                         aResult.State = beans::PropertyState_DIRECT_VALUE;
719                 }
720                 if (!bDirectValuesOnly  ||  beans::PropertyState_DIRECT_VALUE == aResult.State)
721                 {
722 					// get property value
723 					// (compare to SwXTextPortion::getPropertyValue(s))
724                     GetPropertyValue( aResult.Value, *pEntry, pUnoCrsr, pSet );
725                     aResult.Result = beans::TolerantPropertySetResultType::SUCCESS;
726 					aResultVector.push_back( aResult );
727                 }
728             }
729         }
730         catch (beans::UnknownPropertyException &)
731         {
732             // should not occur because property was searched for before
733             DBG_ERROR( "unexpected exception catched" );
734             aResult.Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
735         }
736         catch (lang::IllegalArgumentException &)
737         {
738             aResult.Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
739         }
740         catch (beans::PropertyVetoException &)
741         {
742             aResult.Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
743         }
744         catch (lang::WrappedTargetException &)
745         {
746             aResult.Result = beans::TolerantPropertySetResultType::WRAPPED_TARGET;
747         }
748     }
749     delete pSet;
750 
751     uno::Sequence< beans::GetDirectPropertyTolerantResult > aResult( aResultVector.size() );
752     std::vector< beans::GetDirectPropertyTolerantResult >::const_iterator aIt = aResultVector.begin();
753     beans::GetDirectPropertyTolerantResult *pResult = aResult.getArray();
754     for( sal_Int32 nResult = 0; nResult < aResult.getLength(); ++nResult )
755     {
756         pResult[nResult] = *aIt;
757         ++aIt;
758     }
759 
760     return aResult;
761 }
762 
763 
764 /* -----------------------------02.04.01 11:44--------------------------------
765 
766  ---------------------------------------------------------------------------*/
addPropertiesChangeListener(const uno::Sequence<OUString> &,const uno::Reference<beans::XPropertiesChangeListener> &)767 void SwXTextPortion::addPropertiesChangeListener(
768     const uno::Sequence< OUString >& /*aPropertyNames*/,
769     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
770         throw(uno::RuntimeException)
771 {}
772 /* -----------------------------02.04.01 11:44--------------------------------
773 
774  ---------------------------------------------------------------------------*/
removePropertiesChangeListener(const uno::Reference<beans::XPropertiesChangeListener> &)775 void SwXTextPortion::removePropertiesChangeListener(
776     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
777         throw(uno::RuntimeException)
778 {}
779 /* -----------------------------02.04.01 11:44--------------------------------
780 
781  ---------------------------------------------------------------------------*/
firePropertiesChangeEvent(const uno::Sequence<OUString> &,const uno::Reference<beans::XPropertiesChangeListener> &)782 void SwXTextPortion::firePropertiesChangeEvent(
783     const uno::Sequence< OUString >& /*aPropertyNames*/,
784     const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
785         throw(uno::RuntimeException)
786 {}
787 /*-- 11.12.98 09:56:58---------------------------------------------------
788 
789   -----------------------------------------------------------------------*/
addPropertyChangeListener(const OUString &,const uno::Reference<beans::XPropertyChangeListener> &)790 void SwXTextPortion::addPropertyChangeListener(
791     const OUString& /*PropertyName*/,
792     const uno::Reference< beans::XPropertyChangeListener > & /*xListener*/)
793         throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
794 {
795 	DBG_WARNING("not implemented");
796 }
797 /*-- 11.12.98 09:56:58---------------------------------------------------
798 
799   -----------------------------------------------------------------------*/
removePropertyChangeListener(const OUString &,const uno::Reference<beans::XPropertyChangeListener> &)800 void SwXTextPortion::removePropertyChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XPropertyChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
801 {
802 	DBG_WARNING("not implemented");
803 }
804 /*-- 11.12.98 09:56:58---------------------------------------------------
805 
806   -----------------------------------------------------------------------*/
addVetoableChangeListener(const OUString &,const uno::Reference<beans::XVetoableChangeListener> &)807 void SwXTextPortion::addVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
808 {
809 	DBG_WARNING("not implemented");
810 }
811 /*-- 11.12.98 09:56:59---------------------------------------------------
812 
813   -----------------------------------------------------------------------*/
removeVetoableChangeListener(const OUString &,const uno::Reference<beans::XVetoableChangeListener> &)814 void SwXTextPortion::removeVetoableChangeListener(const OUString& /*rPropertyName*/, const uno::Reference< beans::XVetoableChangeListener > & /*aListener*/) throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
815 {
816 	DBG_WARNING("not implemented");
817 }
818 /*-- 08.03.99 09:41:43---------------------------------------------------
819 
820   -----------------------------------------------------------------------*/
getPropertyState(const OUString & rPropertyName)821 beans::PropertyState SwXTextPortion::getPropertyState(const OUString& rPropertyName)
822 			throw( beans::UnknownPropertyException, uno::RuntimeException )
823 {
824 	vos::OGuard aGuard(Application::GetSolarMutex());
825 	beans::PropertyState eRet = beans::PropertyState_DEFAULT_VALUE;
826     SwUnoCrsr* pUnoCrsr = GetCursor();
827     if (!pUnoCrsr)
828         throw uno::RuntimeException();
829 
830     if (GetTextPortionType() == PORTION_RUBY_START &&
831         !rPropertyName.compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
832     {
833         eRet = beans::PropertyState_DIRECT_VALUE;
834     }
835     else
836     {
837         eRet = SwUnoCursorHelper::GetPropertyState(*pUnoCrsr, *m_pPropSet,
838                 rPropertyName);
839     }
840 	return eRet;
841 }
842 /*-- 08.03.99 09:41:47---------------------------------------------------
843 
844   -----------------------------------------------------------------------*/
getPropertyStates(const uno::Sequence<OUString> & rPropertyNames)845 uno::Sequence< beans::PropertyState > SwXTextPortion::getPropertyStates(
846         const uno::Sequence< OUString >& rPropertyNames)
847 		throw( beans::UnknownPropertyException, uno::RuntimeException )
848 {
849 	vos::OGuard aGuard(Application::GetSolarMutex());
850     SwUnoCrsr* pUnoCrsr = GetCursor();
851 	if(!pUnoCrsr)
852 		throw uno::RuntimeException();
853 
854     uno::Sequence< beans::PropertyState > aRet =
855         SwUnoCursorHelper::GetPropertyStates(*pUnoCrsr, *m_pPropSet,
856                 rPropertyNames, SW_PROPERTY_STATE_CALLER_SWX_TEXT_PORTION);
857 
858     if(GetTextPortionType() == PORTION_RUBY_START)
859     {
860         const OUString* pNames = rPropertyNames.getConstArray();
861         beans::PropertyState* pStates = aRet.getArray();
862         for(sal_Int32 nProp = 0; nProp < rPropertyNames.getLength();nProp++)
863         {
864            if(!pNames[nProp].compareToAscii( RTL_CONSTASCII_STRINGPARAM("Ruby") ))
865                 pStates[nProp] = beans::PropertyState_DIRECT_VALUE;
866         }
867     }
868     return aRet;
869 }
870 /*-- 08.03.99 09:41:47---------------------------------------------------
871 
872   -----------------------------------------------------------------------*/
setPropertyToDefault(const OUString & rPropertyName)873 void SwXTextPortion::setPropertyToDefault(const OUString& rPropertyName)
874 				throw( beans::UnknownPropertyException, uno::RuntimeException )
875 {
876 	vos::OGuard aGuard(Application::GetSolarMutex());
877 	SwUnoCrsr* pUnoCrsr = GetCursor();
878     if (!pUnoCrsr)
879         throw uno::RuntimeException();
880 
881     SwUnoCursorHelper::SetPropertyToDefault(
882             *pUnoCrsr, *m_pPropSet, rPropertyName);
883 }
884 /*-- 08.03.99 09:41:48---------------------------------------------------
885 
886   -----------------------------------------------------------------------*/
getPropertyDefault(const OUString & rPropertyName)887 uno::Any SwXTextPortion::getPropertyDefault(const OUString& rPropertyName)
888 		throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
889 {
890     vos::OGuard aGuard(Application::GetSolarMutex());
891 	uno::Any aRet;
892     SwUnoCrsr* pUnoCrsr = GetCursor();
893     if (!pUnoCrsr)
894         throw uno::RuntimeException();
895 
896     aRet = SwUnoCursorHelper::GetPropertyDefault(*pUnoCrsr, *m_pPropSet,
897                 rPropertyName);
898 	return aRet;
899 }
900 
901 /*-- 11.12.98 09:56:59---------------------------------------------------
902 
903   -----------------------------------------------------------------------*/
attach(const uno::Reference<text::XTextRange> &)904 void SwXTextPortion::attach(const uno::Reference< text::XTextRange > & /*xTextRange*/)
905     throw( lang::IllegalArgumentException, uno::RuntimeException )
906 {
907 	vos::OGuard aGuard(Application::GetSolarMutex());
908     // SwXTextPortion cannot be created at the factory therefore
909     // they cannot be attached
910     throw uno::RuntimeException();
911 }
912 /*-- 11.12.98 09:57:00---------------------------------------------------
913 
914   -----------------------------------------------------------------------*/
getAnchor()915 uno::Reference< text::XTextRange >  SwXTextPortion::getAnchor()
916 throw( uno::RuntimeException )
917 {
918 	vos::OGuard aGuard(Application::GetSolarMutex());
919 	uno::Reference< text::XTextRange >  aRet;
920     SwUnoCrsr* pUnoCrsr = GetCursor();
921     if (!pUnoCrsr)
922         throw uno::RuntimeException();
923 
924     aRet = new SwXTextRange(*pUnoCrsr, m_xParentText);
925 	return aRet;
926 }
927 /*-- 11.12.98 09:57:00---------------------------------------------------
928 
929   -----------------------------------------------------------------------*/
dispose()930 void SwXTextPortion::dispose()
931 throw( uno::RuntimeException )
932 {
933 	vos::OGuard aGuard(Application::GetSolarMutex());
934     SwUnoCrsr* pUnoCrsr = GetCursor();
935     if (!pUnoCrsr)
936         throw uno::RuntimeException();
937 
938     setString(aEmptyStr);
939     pUnoCrsr->Remove(this);
940 }
941 /*-- 11.12.98 09:57:00---------------------------------------------------
942 
943   -----------------------------------------------------------------------*/
addEventListener(const uno::Reference<lang::XEventListener> & aListener)944 void SwXTextPortion::addEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
945 {
946 	vos::OGuard aGuard(Application::GetSolarMutex());
947 	if(!GetRegisteredIn())
948 		throw uno::RuntimeException();
949 
950     m_ListenerContainer.AddListener(aListener);
951 }
952 /*-- 11.12.98 09:57:01---------------------------------------------------
953 
954   -----------------------------------------------------------------------*/
removeEventListener(const uno::Reference<lang::XEventListener> & aListener)955 void SwXTextPortion::removeEventListener(const uno::Reference< lang::XEventListener > & aListener) throw( uno::RuntimeException )
956 {
957 	vos::OGuard aGuard(Application::GetSolarMutex());
958     if (!GetRegisteredIn() || !m_ListenerContainer.RemoveListener(aListener))
959 		throw uno::RuntimeException();
960 }
961 /* -----------------24.03.99 13:30-------------------
962  *
963  * --------------------------------------------------*/
createContentEnumeration(const OUString &)964 uno::Reference< container::XEnumeration >  SwXTextPortion::createContentEnumeration(const OUString& /*aServiceName*/)
965 		throw( uno::RuntimeException )
966 {
967 	vos::OGuard aGuard(Application::GetSolarMutex());
968 	SwUnoCrsr* pUnoCrsr = GetCursor();
969 	if(!pUnoCrsr)
970 		throw uno::RuntimeException();
971 
972     uno::Reference< container::XEnumeration >  xRet =
973         new SwXParaFrameEnumeration(*pUnoCrsr, PARAFRAME_PORTION_CHAR,
974                 m_pFrameFmt);
975 	return xRet;
976 
977 }
978 /* -----------------------------04.07.01 08:52--------------------------------
979 
980  ---------------------------------------------------------------------------*/
getUnoTunnelId()981 const uno::Sequence< sal_Int8 > & SwXTextPortion::getUnoTunnelId()
982 {
983     static uno::Sequence< sal_Int8 > aSeq = ::CreateUnoTunnelId();
984 	return aSeq;
985 }
986 /* -----------------------------04.07.01 08:52--------------------------------
987 
988  ---------------------------------------------------------------------------*/
getSomething(const uno::Sequence<sal_Int8> & rId)989 sal_Int64 SwXTextPortion::getSomething( const uno::Sequence< sal_Int8 >& rId )
990 	throw(uno::RuntimeException)
991 {
992     if( rId.getLength() == 16
993         && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
994 										rId.getConstArray(), 16 ) )
995     {
996 		return sal::static_int_cast< sal_Int64 >( reinterpret_cast< sal_IntPtr >(this) );
997     }
998 	return 0;
999 }
1000 /* -----------------24.03.99 13:30-------------------
1001  *
1002  * --------------------------------------------------*/
getAvailableServiceNames()1003 uno::Sequence< OUString > SwXTextPortion::getAvailableServiceNames()
1004 throw( uno::RuntimeException )
1005 {
1006 	vos::OGuard aGuard(Application::GetSolarMutex());
1007 	uno::Sequence< OUString > aRet(1);
1008 	OUString* pArray = aRet.getArray();
1009 	pArray[0] = C2U("com.sun.star.text.TextContent");
1010 	return aRet;
1011 }
1012 /* -----------------25.03.99 10:30-------------------
1013  *
1014  * --------------------------------------------------*/
getImplementationName()1015 OUString SwXTextPortion::getImplementationName()
1016 throw( uno::RuntimeException )
1017 {
1018 	return C2U("SwXTextPortion");
1019 }
1020 /* -----------------25.03.99 10:30-------------------
1021  *
1022  * --------------------------------------------------*/
supportsService(const OUString & rServiceName)1023 sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
1024 {
1025 	vos::OGuard aGuard(Application::GetSolarMutex());
1026 	SwUnoCrsr* pUnoCrsr = GetCursor();
1027 	if(!pUnoCrsr)
1028 		throw uno::RuntimeException();
1029 
1030 	sal_Bool bRet = sal_False;
1031     if(!rServiceName.compareToAscii("com.sun.star.text.TextPortion") ||
1032             !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
1033             !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
1034             !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
1035             !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
1036             !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
1037             !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex"))
1038     {
1039         bRet = sal_True;
1040     }
1041 
1042 	return bRet;
1043 }
1044 /* ---------------------------------------------------------------------------
1045 
1046  ---------------------------------------------------------------------------*/
getSupportedServiceNames()1047 uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames()
1048 throw( uno::RuntimeException )
1049 {
1050 	vos::OGuard aGuard(Application::GetSolarMutex());
1051     SwUnoCrsr* pUnoCrsr = GetCursor();
1052     if (!pUnoCrsr)
1053         throw uno::RuntimeException();
1054 
1055     uno::Sequence< OUString > aRet(7);
1056 	OUString* pArray = aRet.getArray();
1057 	pArray[0] = C2U("com.sun.star.text.TextPortion");
1058     pArray[1] = C2U("com.sun.star.style.CharacterProperties");
1059     pArray[2] = C2U("com.sun.star.style.CharacterPropertiesAsian");
1060     pArray[3] = C2U("com.sun.star.style.CharacterPropertiesComplex");
1061     pArray[4] = C2U("com.sun.star.style.ParagraphProperties");
1062     pArray[5] = C2U("com.sun.star.style.ParagraphPropertiesAsian");
1063     pArray[6] = C2U("com.sun.star.style.ParagraphPropertiesComplex");
1064 	return aRet;
1065 }
1066 /*-- 11.12.98 09:57:01---------------------------------------------------
1067 
1068   -----------------------------------------------------------------------*/
Modify(const SfxPoolItem * pOld,const SfxPoolItem * pNew)1069 void SwXTextPortion::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew)
1070 {
1071 	ClientModify(this, pOld, pNew);
1072     if (!m_FrameDepend.GetRegisteredIn())
1073     {
1074         m_pFrameFmt = 0;
1075     }
1076 }
1077 
1078