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