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 <vcl/svapp.hxx>
30 : : #include <com/sun/star/style/LineSpacing.hpp>
31 : : #include <com/sun/star/text/ControlCharacter.hpp>
32 : : #include <com/sun/star/text/XTextField.hpp>
33 : : #include <com/sun/star/text/TextRangeSelection.hpp>
34 : :
35 : : #include <osl/mutex.hxx>
36 : : #include <svl/itemset.hxx>
37 : : #include <svl/itempool.hxx>
38 : : #include <svl/intitem.hxx>
39 : : #include <svl/eitem.hxx>
40 : : #include <rtl/instance.hxx>
41 : :
42 : : #include <editeng/fontitem.hxx>
43 : : #include <editeng/tstpitem.hxx>
44 : : #include <editeng/unoprnms.hxx>
45 : : #include <editeng/unotext.hxx>
46 : : #include <editeng/unoedsrc.hxx>
47 : : #include <editeng/unonrule.hxx>
48 : : #include <editeng/unofdesc.hxx>
49 : : #include <editeng/unofield.hxx>
50 : : #include <editeng/flditem.hxx>
51 : : #include <editeng/numitem.hxx>
52 : : #include <editeng/editeng.hxx>
53 : : #include <editeng/outliner.hxx>
54 : : #include <editeng/unoipset.hxx>
55 : : #include <comphelper/serviceinfohelper.hxx>
56 : : #include <comphelper/servicehelper.hxx>
57 : :
58 : : #include "editeng/unonames.hxx"
59 : :
60 : : #include <boost/scoped_ptr.hpp>
61 : :
62 : : using namespace ::rtl;
63 : : using namespace ::cppu;
64 : : using namespace ::com::sun::star;
65 : :
66 : : namespace {
67 : :
68 : 152 : ESelection toESelection(const text::TextRangeSelection& rSel)
69 : : {
70 : 152 : ESelection aESel;
71 : 152 : aESel.nStartPara = rSel.Start.Paragraph;
72 : 152 : aESel.nStartPos = rSel.Start.PositionInParagraph;
73 : 152 : aESel.nEndPara = rSel.End.Paragraph;
74 : 152 : aESel.nEndPos = rSel.End.PositionInParagraph;
75 : 152 : return aESel;
76 : : }
77 : :
78 : : }
79 : :
80 : 94140 : const SvxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSvxPropertySet()
81 : : {
82 [ + + ][ + - ]: 94140 : static SvxItemPropertySet aTextCursorSvxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap(), EditEngine::GetGlobalItemPool() );
[ + - ][ + - ]
[ + - ][ # # ]
83 : 94140 : return &aTextCursorSvxPropertySet;
84 : : }
85 : :
86 : 13 : const SfxItemPropertyMapEntry* ImplGetSvxTextPortionPropertyMap()
87 : : {
88 : : // Propertymap for an Outliner Text
89 : : static const SfxItemPropertyMapEntry aSvxTextPortionPropertyMap[] =
90 : : {
91 [ + - ][ + - ]: 13 : SVX_UNOEDIT_CHAR_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
92 [ + - ]: 13 : SVX_UNOEDIT_FONT_PROPERTIES,
93 [ + - ][ + - ]: 13 : SVX_UNOEDIT_OUTLINER_PROPERTIES,
[ + - ][ + - ]
[ + - ]
94 [ + - ][ + - ]: 13 : SVX_UNOEDIT_PARA_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
95 [ + - ]: 13 : {MAP_CHAR_LEN("TextField"), EE_FEATURE_FIELD, &::getCppuType((const uno::Reference< text::XTextField >*)0), beans::PropertyAttribute::READONLY, 0 },
96 [ + - ]: 13 : {MAP_CHAR_LEN("TextPortionType"), WID_PORTIONTYPE, &::getCppuType((const ::rtl::OUString*)0), beans::PropertyAttribute::READONLY, 0 },
97 [ + - ]: 13 : {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
98 [ + - ]: 13 : {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
99 : : {0,0,0,0,0,0}
100 [ + - ][ + - ]: 26 : };
[ # # ]
101 : 13 : return aSvxTextPortionPropertyMap;
102 : : }
103 : 293 : const SvxItemPropertySet* ImplGetSvxTextPortionSvxPropertySet()
104 : : {
105 [ + + ][ + - ]: 293 : static SvxItemPropertySet aSvxTextPortionPropertySet( ImplGetSvxTextPortionPropertyMap(), EditEngine::GetGlobalItemPool() );
[ + - ][ + - ]
[ + - ][ # # ]
106 : 293 : return &aSvxTextPortionPropertySet;
107 : : }
108 : :
109 : 12 : const SfxItemPropertySet* ImplGetSvxTextPortionSfxPropertySet()
110 : : {
111 [ + + ][ + - ]: 12 : static SfxItemPropertySet aSvxTextPortionSfxPropertySet( ImplGetSvxTextPortionPropertyMap() );
[ + - ][ + - ]
[ # # ]
112 : 12 : return &aSvxTextPortionSfxPropertySet;
113 : : }
114 : :
115 : 63 : const SfxItemPropertyMapEntry* ImplGetSvxUnoOutlinerTextCursorPropertyMap()
116 : : {
117 : : // Propertymap for an Outliner Text
118 : : static const SfxItemPropertyMapEntry aSvxUnoOutlinerTextCursorPropertyMap[] =
119 : : {
120 [ + - ][ + - ]: 60 : SVX_UNOEDIT_CHAR_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
121 [ + - ]: 60 : SVX_UNOEDIT_FONT_PROPERTIES,
122 [ + - ][ + - ]: 60 : SVX_UNOEDIT_OUTLINER_PROPERTIES,
[ + - ][ + - ]
[ + - ]
123 [ + - ][ + - ]: 60 : SVX_UNOEDIT_PARA_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
124 [ + - ]: 60 : {MAP_CHAR_LEN("TextUserDefinedAttributes"), EE_CHAR_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
125 [ + - ]: 60 : {MAP_CHAR_LEN("ParaUserDefinedAttributes"), EE_PARA_XMLATTRIBS, &::getCppuType((const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >*)0) , 0, 0},
126 : : {0,0,0,0,0,0}
127 [ + + ][ + - ]: 123 : };
[ # # ]
128 : :
129 : 63 : return aSvxUnoOutlinerTextCursorPropertyMap;
130 : : }
131 : 12 : const SfxItemPropertySet* ImplGetSvxUnoOutlinerTextCursorSfxPropertySet()
132 : : {
133 [ + + ][ + - ]: 12 : static SfxItemPropertySet aTextCursorSfxPropertySet( ImplGetSvxUnoOutlinerTextCursorPropertyMap() );
[ + - ][ + - ]
[ # # ]
134 : 12 : return &aTextCursorSfxPropertySet;
135 : : }
136 : :
137 : : // ====================================================================
138 : : // helper for Item/Property conversion
139 : : // ====================================================================
140 : :
141 : 166914 : void GetSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
142 : : {
143 : : DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
144 [ + - ]: 166914 : if( pForwarder )
145 : : {
146 : 166914 : sal_Int16 nParaCount = pForwarder->GetParagraphCount();
147 [ + - ]: 166914 : if(nParaCount>0)
148 : 166914 : nParaCount--;
149 : :
150 : 166914 : rSel = ESelection( 0,0, nParaCount, pForwarder->GetTextLen( nParaCount ));
151 : : }
152 : 166914 : }
153 : :
154 : 138725 : void CheckSelection( struct ESelection& rSel, SvxTextForwarder* pForwarder ) throw()
155 : : {
156 : : DBG_ASSERT( pForwarder, "I need a valid SvxTextForwarder!" );
157 [ + - ]: 138725 : if( pForwarder )
158 : : {
159 [ + + ]: 138725 : if( rSel.nStartPara == 0xffff )
160 : : {
161 : 1350 : ::GetSelection( rSel, pForwarder );
162 : : }
163 : : else
164 : : {
165 : 137375 : ESelection aMaxSelection;
166 : 137375 : GetSelection( aMaxSelection, pForwarder );
167 : :
168 : : // check start position
169 [ - + ]: 137375 : if( rSel.nStartPara < aMaxSelection.nStartPara )
170 : : {
171 : 0 : rSel.nStartPara = aMaxSelection.nStartPara;
172 : 0 : rSel.nStartPos = aMaxSelection.nStartPos;
173 : : }
174 [ - + ]: 137375 : else if( rSel.nStartPara > aMaxSelection.nEndPara )
175 : : {
176 : 0 : rSel.nStartPara = aMaxSelection.nEndPara;
177 : 0 : rSel.nStartPos = aMaxSelection.nEndPos;
178 : : }
179 [ + - ][ + + ]: 137375 : else if( rSel.nStartPos > pForwarder->GetTextLen( rSel.nStartPara ) )
180 : : {
181 [ + - ]: 3 : rSel.nStartPos = pForwarder->GetTextLen( rSel.nStartPara );
182 : : }
183 : :
184 : : // check end position
185 [ - + ]: 137375 : if( rSel.nEndPara < aMaxSelection.nStartPara )
186 : : {
187 : 0 : rSel.nEndPara = aMaxSelection.nStartPara;
188 : 0 : rSel.nEndPos = aMaxSelection.nStartPos;
189 : : }
190 [ + + ]: 137375 : else if( rSel.nEndPara > aMaxSelection.nEndPara )
191 : : {
192 : 811 : rSel.nEndPara = aMaxSelection.nEndPara;
193 : 811 : rSel.nEndPos = aMaxSelection.nEndPos;
194 : : }
195 [ + - ][ + + ]: 136564 : else if( rSel.nEndPos > pForwarder->GetTextLen( rSel.nEndPara ) )
196 : : {
197 [ + - ]: 137375 : rSel.nEndPos = pForwarder->GetTextLen( rSel.nEndPara );
198 : : }
199 : : }
200 : : }
201 : 138725 : }
202 : :
203 : 48627 : void CheckSelection( struct ESelection& rSel, SvxEditSource *pEdit ) throw()
204 : : {
205 [ - + ]: 48627 : if (!pEdit)
206 : 48627 : return;
207 : 48627 : CheckSelection( rSel, pEdit->GetTextForwarder() );
208 : : }
209 : :
210 : : // ====================================================================
211 : : // class SvxUnoTextRangeBase
212 : : // ====================================================================
213 : :
214 [ + - ][ + + ]: 25512 : UNO3_GETIMPLEMENTATION_IMPL( SvxUnoTextRangeBase );
[ + + ][ + - ]
[ + - ][ + - ]
[ + - ]
215 : :
216 : 94344 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxItemPropertySet* _pSet ) throw()
217 : 94344 : : mpEditSource(NULL) , mpPropSet(_pSet)
218 : : {
219 : 94344 : }
220 : :
221 : 1937 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet ) throw()
222 : 1937 : : mpPropSet(_pSet)
223 : : {
224 [ + - ]: 1937 : SolarMutexGuard aGuard;
225 : :
226 : : DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
227 : :
228 [ + - ]: 1937 : mpEditSource = pSource->Clone();
229 [ + - ]: 1937 : if (mpEditSource != NULL)
230 : : {
231 : 1937 : ESelection aSelection;
232 [ + - ]: 1937 : ::GetSelection( aSelection, mpEditSource->GetTextForwarder() );
233 : 1937 : SetSelection( aSelection );
234 : :
235 [ + - ]: 1937 : mpEditSource->addRange( this );
236 [ + - ]: 1937 : }
237 : 1937 : }
238 : :
239 : 5485 : SvxUnoTextRangeBase::SvxUnoTextRangeBase( const SvxUnoTextRangeBase& rRange ) throw()
240 : : : SvxUnoTextRangeBase_Base()
241 : : , osl::DebugBase<SvxUnoTextRangeBase>()
242 : 5485 : , mpPropSet(rRange.getPropertySet())
243 : : {
244 [ + - ]: 5485 : SolarMutexGuard aGuard;
245 : :
246 [ + - ][ + - ]: 5485 : mpEditSource = rRange.mpEditSource ? rRange.mpEditSource->Clone() : NULL;
247 : :
248 [ + - ][ + - ]: 5485 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
249 [ + - ]: 5485 : if( pForwarder )
250 : : {
251 : 5485 : maSelection = rRange.maSelection;
252 : 5485 : CheckSelection( maSelection, pForwarder );
253 : : }
254 : :
255 [ + - ]: 5485 : if( mpEditSource )
256 [ + - ][ + - ]: 5485 : mpEditSource->addRange( this );
257 : 5485 : }
258 : :
259 : 101747 : SvxUnoTextRangeBase::~SvxUnoTextRangeBase() throw()
260 : : {
261 [ + + ]: 101747 : if( mpEditSource )
262 [ + - ]: 101650 : mpEditSource->removeRange( this );
263 : :
264 [ + + ][ + - ]: 101747 : delete mpEditSource;
265 [ - + ]: 101747 : }
266 : :
267 : 94247 : void SvxUnoTextRangeBase::SetEditSource( SvxEditSource* pSource ) throw()
268 : : {
269 : : DBG_ASSERT(pSource,"SvxUnoTextRangeBase: I need a valid SvxEditSource!");
270 : : DBG_ASSERT(mpEditSource==NULL,"SvxUnoTextRangeBase::SetEditSource called while SvxEditSource already set" );
271 : :
272 : 94247 : mpEditSource = pSource;
273 : :
274 : 94247 : maSelection.nStartPara = 0xffff;
275 : :
276 [ + - ]: 94247 : if( mpEditSource )
277 : 94247 : mpEditSource->addRange( this );
278 : 94247 : }
279 : :
280 : : /** puts a field item with a copy of the given FieldData into the itemset
281 : : corresponding with this range */
282 : 2 : void SvxUnoTextRangeBase::attachField( const SvxFieldData* pData ) throw()
283 : : {
284 [ + - ]: 2 : SolarMutexGuard aGuard;
285 : :
286 [ + - ]: 2 : if( pData )
287 : : {
288 [ + - ][ + - ]: 2 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
289 [ + - ]: 2 : if( pForwarder )
290 : : {
291 [ + - ]: 2 : SvxFieldItem aField( *pData, EE_FEATURE_FIELD );
292 [ + - ][ + - ]: 2 : pForwarder->QuickInsertField( aField, maSelection );
293 : : }
294 [ + - ]: 2 : }
295 : 2 : }
296 : :
297 : 14005 : void SvxUnoTextRangeBase::SetSelection( const ESelection& rSelection ) throw()
298 : : {
299 [ + - ]: 14005 : SolarMutexGuard aGuard;
300 : :
301 : 14005 : maSelection = rSelection;
302 [ + - ]: 14005 : CheckSelection( maSelection, mpEditSource );
303 : 14005 : }
304 : :
305 : : // Interface XTextRange ( XText )
306 : :
307 : 640 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getStart(void)
308 : : throw( uno::RuntimeException )
309 : : {
310 [ + - ]: 640 : SolarMutexGuard aGuard;
311 : :
312 : 640 : uno::Reference< text::XTextRange > xRange;
313 : :
314 [ + - ][ + - ]: 640 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
315 [ + - ]: 640 : if( pForwarder )
316 : : {
317 : 640 : CheckSelection( maSelection, pForwarder );
318 : :
319 [ + - ][ + - ]: 640 : SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
320 : :
321 [ - + ]: 640 : if(pText == NULL)
322 [ # # ]: 0 : throw uno::RuntimeException();
323 : :
324 : 640 : SvxUnoTextRange* pRange = new SvxUnoTextRange( *pText );
325 [ + - ][ + - ]: 640 : xRange = pRange;
326 : :
327 : 640 : ESelection aNewSel = maSelection;
328 : 640 : aNewSel.nEndPara = aNewSel.nStartPara;
329 : 640 : aNewSel.nEndPos = aNewSel.nStartPos;
330 : 640 : pRange->SetSelection( aNewSel );
331 : : }
332 : :
333 [ + - ]: 640 : return xRange;
334 : : }
335 : :
336 : 15 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextRangeBase::getEnd(void)
337 : : throw( uno::RuntimeException )
338 : : {
339 [ + - ]: 15 : SolarMutexGuard aGuard;
340 : :
341 : 15 : uno::Reference< text::XTextRange > xRet;
342 : :
343 [ + - ][ + - ]: 15 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
344 [ + - ]: 15 : if( pForwarder )
345 : : {
346 : 15 : CheckSelection( maSelection, pForwarder );
347 : :
348 [ + - ][ + - ]: 15 : SvxUnoTextBase* pText = SvxUnoTextBase::getImplementation( getText() );
349 : :
350 [ - + ]: 15 : if(pText == NULL)
351 [ # # ]: 0 : throw uno::RuntimeException();
352 : :
353 : 15 : SvxUnoTextRange* pNew = new SvxUnoTextRange( *pText );
354 [ + - ][ + - ]: 15 : xRet = pNew;
355 : :
356 : 15 : ESelection aNewSel = maSelection;
357 : 15 : aNewSel.nStartPara = aNewSel.nEndPara;
358 : 15 : aNewSel.nStartPos = aNewSel.nEndPos;
359 : 15 : pNew->SetSelection( aNewSel );
360 : : }
361 [ + - ]: 15 : return xRet;
362 : : }
363 : :
364 : 388 : OUString SAL_CALL SvxUnoTextRangeBase::getString(void)
365 : : throw( uno::RuntimeException )
366 : : {
367 [ + - ]: 388 : SolarMutexGuard aGuard;
368 : :
369 [ + - ][ + - ]: 388 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
370 [ + - ]: 388 : if( pForwarder )
371 : : {
372 : 388 : CheckSelection( maSelection, pForwarder );
373 : :
374 [ + - ][ + - ]: 388 : return pForwarder->GetText( maSelection );
[ + - ]
375 : : }
376 : : else
377 : : {
378 : 0 : const OUString aEmpty;
379 : 0 : return aEmpty;
380 [ + - ]: 388 : }
381 : : }
382 : :
383 : 25047 : void SAL_CALL SvxUnoTextRangeBase::setString(const OUString& aString)
384 : : throw( uno::RuntimeException )
385 : : {
386 [ + - ]: 25047 : SolarMutexGuard aGuard;
387 : :
388 [ + - ][ + - ]: 25047 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
389 [ + - ]: 25047 : if( pForwarder )
390 : : {
391 : 25047 : CheckSelection( maSelection, pForwarder );
392 : :
393 [ + - ][ + - ]: 25047 : String aConverted(convertLineEnd(aString, LINEEND_LF)); // Simply count the number of line endings
394 : :
395 [ + - ]: 25047 : pForwarder->QuickInsertText( aConverted, maSelection );
396 [ + - ]: 25047 : mpEditSource->UpdateData();
397 : :
398 : : // Adapt selection
399 : : //! It would be easier if the EditEngine would return the selection
400 : : //! on QuickInsertText...
401 : 25047 : CollapseToStart();
402 : :
403 : 25047 : sal_uInt16 nLen = aConverted.Len();
404 [ + + ]: 25047 : if (nLen)
405 [ + - ]: 25047 : GoRight( nLen, sal_True );
406 [ + - ]: 25047 : }
407 : 25047 : }
408 : :
409 : : // Interface beans::XPropertySet
410 : 3766 : uno::Reference< beans::XPropertySetInfo > SAL_CALL SvxUnoTextRangeBase::getPropertySetInfo(void)
411 : : throw( uno::RuntimeException )
412 : : {
413 : 3766 : return mpPropSet->getPropertySetInfo();
414 : : }
415 : :
416 : 2538 : void SAL_CALL SvxUnoTextRangeBase::setPropertyValue(const OUString& PropertyName, const uno::Any& aValue)
417 : : throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
418 : : {
419 [ + + ]: 2538 : if (PropertyName == UNO_TR_PROP_SELECTION)
420 : : {
421 [ + - ]: 76 : text::TextRangeSelection aSel = aValue.get<text::TextRangeSelection>();
422 : 76 : SetSelection(toESelection(aSel));
423 : :
424 : 2532 : return;
425 : : }
426 : :
427 : 2462 : _setPropertyValue( PropertyName, aValue, -1 );
428 : : }
429 : :
430 : 2760 : void SAL_CALL SvxUnoTextRangeBase::_setPropertyValue( const OUString& PropertyName, const uno::Any& aValue, sal_Int32 nPara )
431 : : throw( beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException )
432 : : {
433 [ + - ]: 2760 : SolarMutexGuard aGuard;
434 : :
435 [ + - ][ + - ]: 2760 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
436 [ + - ]: 2760 : if( pForwarder )
437 : : {
438 : 2760 : CheckSelection( maSelection, pForwarder );
439 : :
440 [ + - ]: 2760 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
441 [ + + ]: 2760 : if ( pMap )
442 : : {
443 : 2750 : ESelection aSel( GetSelection() );
444 [ + + ][ + + ]: 2750 : sal_Bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
445 : :
446 [ + + ][ + + ]: 2750 : if( nPara == -1 && !bParaAttrib )
447 : : {
448 [ + - ]: 1166 : SfxItemSet aOldSet( pForwarder->GetAttribs( aSel ) );
449 : : // we have a selection and no para attribute
450 [ + - ]: 1166 : SfxItemSet aNewSet( *aOldSet.GetPool(), aOldSet.GetRanges() );
451 : :
452 [ + - ]: 1166 : setPropertyValue( pMap, aValue, maSelection, aOldSet, aNewSet );
453 : :
454 : :
455 [ + - ][ + - ]: 1166 : pForwarder->QuickSetAttribs( aNewSet, GetSelection() );
[ + - ]
456 : : }
457 : : else
458 : : {
459 : : sal_Int32 nEndPara;
460 : :
461 [ + + ]: 1584 : if( nPara == -1 )
462 : : {
463 : 1290 : nPara = aSel.nStartPara;
464 : 1290 : nEndPara = aSel.nEndPara;
465 : : }
466 : : else
467 : : {
468 : : // only one paragraph
469 : 294 : nEndPara = nPara;
470 : : }
471 : :
472 [ + + ]: 3342 : while( nPara <= nEndPara )
473 : : {
474 : : // we have a paragraph
475 [ + - ]: 1758 : SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nPara ) );
476 [ + - ]: 1758 : setPropertyValue( pMap, aValue, maSelection, aSet, aSet );
477 [ + - ]: 1758 : pForwarder->SetParaAttribs( (sal_uInt16)nPara, aSet );
478 : 1758 : nPara++;
479 [ + - ]: 1758 : }
480 : : }
481 : :
482 [ + - ]: 2750 : GetEditSource()->UpdateData();
483 : 2750 : return;
484 : : }
485 : : }
486 : :
487 [ + - ][ + - ]: 2760 : throw beans::UnknownPropertyException();
488 : : }
489 : :
490 : 7346 : void SvxUnoTextRangeBase::setPropertyValue( const SfxItemPropertySimpleEntry* pMap, const uno::Any& rValue, const ESelection& rSelection, const SfxItemSet& rOldSet, SfxItemSet& rNewSet ) throw( beans::UnknownPropertyException, lang::IllegalArgumentException )
491 : : {
492 [ + + ]: 7346 : if(!SetPropertyValueHelper( rOldSet, pMap, rValue, rNewSet, &rSelection, GetEditSource() ))
493 : : {
494 : : // For parts of composite items with multiple properties (eg background)
495 : : // must be taken from the document before the old item.
496 : 6296 : rNewSet.Put(rOldSet.Get(pMap->nWID)); // Old Item in new Set
497 : 6296 : mpPropSet->setPropertyValue(pMap, rValue, rNewSet, false );
498 : : }
499 : 7346 : }
500 : :
501 : 1433676 : sal_Bool SvxUnoTextRangeBase::SetPropertyValueHelper( const SfxItemSet&, const SfxItemPropertySimpleEntry* pMap, const uno::Any& aValue, SfxItemSet& rNewSet, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL*/ )
502 : : {
503 [ - + + + : 1433676 : switch( pMap->nWID )
+ + + ]
504 : : {
505 : : case WID_FONTDESC:
506 : : {
507 : 0 : awt::FontDescriptor aDesc;
508 [ # # ][ # # ]: 0 : if(aValue >>= aDesc)
509 : : {
510 [ # # ]: 0 : SvxUnoFontDescriptor::FillItemSet( aDesc, rNewSet );
511 : 0 : return sal_True;
512 [ # # ]: 0 : }
513 : : }
514 : 0 : break;
515 : :
516 : : case EE_PARA_NUMBULLET:
517 : : {
518 : 910 : uno::Reference< container::XIndexReplace > xRule;
519 [ + - ][ + - ]: 910 : if( !aValue.hasValue() || ((aValue >>= xRule) && !xRule.is()) )
[ - + ][ + + ]
[ + + ]
520 : 794 : return sal_True;
521 : :
522 : 910 : return sal_False;
523 : : }
524 : :
525 : : case WID_NUMLEVEL:
526 : : {
527 [ + - ]: 150 : SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
528 [ + - ][ + - ]: 150 : if(pForwarder && pSelection)
529 : : {
530 : 150 : sal_Int16 nLevel = sal_Int16();
531 [ + - ]: 150 : if( aValue >>= nLevel )
532 : : {
533 : : // #101004# Call interface method instead of unsafe cast
534 [ + - ][ - + ]: 150 : if(! pForwarder->SetDepth( pSelection->nStartPara, nLevel ) )
535 [ # # ]: 0 : throw lang::IllegalArgumentException();
536 : :
537 : 150 : return sal_True;
538 : : }
539 : : }
540 : : }
541 : 0 : break;
542 : : case WID_NUMBERINGSTARTVALUE:
543 : : {
544 [ + - ]: 8 : SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
545 [ + - ][ + - ]: 8 : if(pForwarder && pSelection)
546 : : {
547 : 8 : sal_Int16 nStartValue = -1;
548 [ + - ]: 8 : if( aValue >>= nStartValue )
549 : : {
550 [ + - ]: 8 : pForwarder->SetNumberingStartValue( pSelection->nStartPara, nStartValue );
551 : 8 : return sal_True;
552 : : }
553 : : }
554 : : }
555 : 0 : break;
556 : : case WID_PARAISNUMBERINGRESTART:
557 : : {
558 [ + - ]: 8 : SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
559 [ + - ][ + - ]: 8 : if(pForwarder && pSelection)
560 : : {
561 : 8 : sal_Bool bParaIsNumberingRestart = sal_False;
562 [ + - ]: 8 : if( aValue >>= bParaIsNumberingRestart )
563 : : {
564 [ + - ]: 8 : pForwarder->SetParaIsNumberingRestart( pSelection->nStartPara, bParaIsNumberingRestart );
565 : 8 : return sal_True;
566 : : }
567 : : }
568 : : }
569 : 0 : break;
570 : : case EE_PARA_BULLETSTATE:
571 : : {
572 : 180 : sal_Bool bBullet = sal_True;
573 [ + - ]: 180 : if( aValue >>= bBullet )
574 : : {
575 [ + - ]: 180 : SfxBoolItem aItem( EE_PARA_BULLETSTATE, bBullet );
576 [ + - ]: 180 : rNewSet.Put(aItem);
577 [ + - ]: 180 : return sal_True;
578 : : }
579 : : }
580 : 0 : break;
581 : :
582 : : default:
583 : 1432420 : return sal_False;
584 : : }
585 : :
586 [ # # ]: 1433676 : throw lang::IllegalArgumentException();
587 : : }
588 : :
589 : 15305 : uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyValue(const OUString& PropertyName)
590 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
591 : : {
592 [ + + ]: 15305 : if (PropertyName == UNO_TR_PROP_SELECTION)
593 : : {
594 : 81 : const ESelection& rSel = GetSelection();
595 : 81 : text::TextRangeSelection aSel;
596 : 81 : aSel.Start.Paragraph = static_cast<sal_Int32>(rSel.nStartPara);
597 : 81 : aSel.Start.PositionInParagraph = static_cast<sal_Int32>(rSel.nStartPos);
598 : 81 : aSel.End.Paragraph = static_cast<sal_Int32>(rSel.nEndPara);
599 : 81 : aSel.End.PositionInParagraph = static_cast<sal_Int32>(rSel.nEndPos);
600 [ + - ]: 81 : return uno::makeAny(aSel);
601 : : }
602 : :
603 : 15305 : return _getPropertyValue( PropertyName, -1 );
604 : : }
605 : :
606 : 15993 : uno::Any SAL_CALL SvxUnoTextRangeBase::_getPropertyValue(const OUString& PropertyName, sal_Int32 nPara )
607 : : throw( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException )
608 : : {
609 [ + - ]: 15993 : SolarMutexGuard aGuard;
610 : :
611 : 15993 : uno::Any aAny;
612 : :
613 [ + - ][ + - ]: 15993 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
614 [ + - ]: 15993 : if( pForwarder )
615 : : {
616 [ + - ]: 15993 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry(PropertyName );
617 [ + + ]: 15993 : if( pMap )
618 : : {
619 : 15980 : SfxItemSet* pAttribs = NULL;
620 [ + + ]: 15980 : if( nPara != -1 )
621 [ + - ][ + - ]: 769 : pAttribs = pForwarder->GetParaAttribs( (sal_uInt16)nPara ).Clone();
[ + - ]
622 : : else
623 [ + - ][ + - ]: 15211 : pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
[ + - ]
624 : :
625 : : // Replace Dontcare with Default, so that one always has a mirror
626 [ + - ]: 15980 : pAttribs->ClearInvalidItems();
627 : :
628 [ + - ]: 15980 : getPropertyValue( pMap, aAny, *pAttribs );
629 : :
630 [ + - ][ + - ]: 15980 : delete pAttribs;
631 : 15980 : return aAny;
632 : : }
633 : : }
634 : :
635 [ + - ][ + - ]: 15993 : throw beans::UnknownPropertyException();
636 : : }
637 : :
638 : 16387 : void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pMap, uno::Any& rAny, const SfxItemSet& rSet ) throw( beans::UnknownPropertyException )
639 : : {
640 [ + + + ]: 16387 : switch( pMap->nWID )
641 : : {
642 : : case EE_FEATURE_FIELD:
643 [ + - ]: 152 : if ( rSet.GetItemState( EE_FEATURE_FIELD, sal_False ) == SFX_ITEM_SET )
644 : : {
645 [ + - ]: 152 : SvxFieldItem* pItem = (SvxFieldItem*)rSet.GetItem( EE_FEATURE_FIELD );
646 : 152 : const SvxFieldData* pData = pItem->GetField();
647 [ + - ]: 152 : uno::Reference< text::XTextRange > xAnchor( this );
648 : :
649 : : // get presentation string for field
650 : 152 : Color* pTColor = NULL;
651 : 152 : Color* pFColor = NULL;
652 : :
653 [ + - ]: 152 : SvxTextForwarder* pForwarder = mpEditSource->GetTextForwarder();
654 [ + - ][ + - ]: 152 : OUString aPresentation( pForwarder->CalcFieldValue( SvxFieldItem(*pData, EE_FEATURE_FIELD), maSelection.nStartPara, maSelection.nStartPos, pTColor, pFColor ) );
[ + - ][ + - ]
[ + - ]
655 : :
656 : 152 : delete pTColor;
657 : 152 : delete pFColor;
658 : :
659 [ + - ][ + - ]: 152 : uno::Reference< text::XTextField > xField( new SvxUnoTextField( xAnchor, aPresentation, pData ) );
660 [ + - ]: 152 : rAny <<= xField;
661 : : }
662 : 152 : break;
663 : :
664 : : case WID_PORTIONTYPE:
665 [ + + ]: 285 : if ( rSet.GetItemState( EE_FEATURE_FIELD, sal_False ) == SFX_ITEM_SET )
666 : : {
667 [ + - ]: 152 : OUString aType( RTL_CONSTASCII_USTRINGPARAM("TextField") );
668 [ + - ]: 152 : rAny <<= aType;
669 : : }
670 : : else
671 : : {
672 [ + - ]: 133 : OUString aType( RTL_CONSTASCII_USTRINGPARAM("Text") );
673 [ + - ]: 133 : rAny <<= aType;
674 : : }
675 : 285 : break;
676 : :
677 : : default:
678 [ + + ]: 15950 : if(!GetPropertyValueHelper( *((SfxItemSet*)(&rSet)), pMap, rAny, &maSelection, GetEditSource() ))
679 : 14877 : rAny = mpPropSet->getPropertyValue(pMap, rSet, true, false );
680 : : }
681 : 16387 : }
682 : :
683 : 34261 : sal_Bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxItemPropertySimpleEntry* pMap, uno::Any& aAny, const ESelection* pSelection /* = NULL */, SvxEditSource* pEditSource /* = NULL */ )
684 : : throw( uno::RuntimeException )
685 : : {
686 [ - + + + : 34261 : switch( pMap->nWID )
+ + + ]
687 : : {
688 : : case WID_FONTDESC:
689 : : {
690 : 0 : awt::FontDescriptor aDesc;
691 [ # # ]: 0 : SvxUnoFontDescriptor::FillFromItemSet( rSet, aDesc );
692 [ # # ]: 0 : aAny <<= aDesc;
693 : : }
694 : 0 : break;
695 : :
696 : : case EE_PARA_NUMBULLET:
697 : : {
698 [ - + ]: 976 : if((rSet.GetItemState( EE_PARA_NUMBULLET, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT)) == 0)
699 [ # # ]: 0 : throw uno::RuntimeException();
700 : :
701 : 976 : SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET, sal_True );
702 : :
703 [ - + ]: 976 : if( pBulletItem == NULL )
704 [ # # ]: 0 : throw uno::RuntimeException();
705 : :
706 [ + - ]: 976 : aAny <<= SvxCreateNumRule( pBulletItem->GetNumRule() );
707 : : }
708 : 976 : break;
709 : :
710 : : case WID_NUMLEVEL:
711 : : {
712 [ + - ]: 51 : SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
713 [ + - ][ + - ]: 51 : if(pForwarder && pSelection)
714 : : {
715 [ + - ]: 51 : sal_Int16 nLevel = pForwarder->GetDepth( pSelection->nStartPara );
716 [ + + ]: 51 : if( nLevel >= 0 )
717 [ + - ]: 51 : aAny <<= nLevel;
718 : : }
719 : : }
720 : 51 : break;
721 : : case WID_NUMBERINGSTARTVALUE:
722 : : {
723 [ + - ]: 20 : SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
724 [ + - ][ + - ]: 20 : if(pForwarder && pSelection)
725 [ + - ]: 20 : aAny <<= pForwarder->GetNumberingStartValue( pSelection->nStartPara );
726 : : }
727 : 20 : break;
728 : : case WID_PARAISNUMBERINGRESTART:
729 : : {
730 [ + - ]: 20 : SvxTextForwarder* pForwarder = pEditSource? pEditSource->GetTextForwarder() : NULL;
731 [ + - ][ + - ]: 20 : if(pForwarder && pSelection)
732 [ + - ]: 20 : aAny <<= pForwarder->IsParaIsNumberingRestart( pSelection->nStartPara );
733 : : }
734 : 20 : break;
735 : :
736 : : case EE_PARA_BULLETSTATE:
737 : : {
738 : 30 : sal_Bool bState = sal_False;
739 [ + - ][ + - ]: 30 : if( rSet.GetItemState( EE_PARA_BULLETSTATE, sal_True ) & (SFX_ITEM_SET|SFX_ITEM_DEFAULT))
740 : : {
741 [ + - ]: 30 : SfxBoolItem* pItem = (SfxBoolItem*)rSet.GetItem( EE_PARA_BULLETSTATE, sal_True );
742 [ + + ]: 30 : bState = pItem->GetValue() ? sal_True : sal_False;
743 : : }
744 : :
745 [ + - ]: 30 : aAny <<= bState;
746 : : }
747 : 30 : break;
748 : : default:
749 : :
750 : 33164 : return sal_False;
751 : : }
752 : :
753 : 34261 : return sal_True;
754 : : }
755 : :
756 : : // is not (yet) supported
757 : 0 : void SAL_CALL SvxUnoTextRangeBase::addPropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
758 : 0 : void SAL_CALL SvxUnoTextRangeBase::removePropertyChangeListener( const OUString& , const uno::Reference< beans::XPropertyChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
759 : 204 : void SAL_CALL SvxUnoTextRangeBase::addVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
760 : 185 : void SAL_CALL SvxUnoTextRangeBase::removeVetoableChangeListener( const OUString& , const uno::Reference< beans::XVetoableChangeListener >& ) throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException) {}
761 : :
762 : : // XMultiPropertySet
763 : 361 : void SAL_CALL SvxUnoTextRangeBase::setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
764 : : {
765 : 361 : _setPropertyValues( aPropertyNames, aValues, -1 );
766 : 361 : }
767 : :
768 : 361 : void SAL_CALL SvxUnoTextRangeBase::_setPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, const uno::Sequence< uno::Any >& aValues, sal_Int32 nPara ) throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
769 : : {
770 [ + - ]: 361 : SolarMutexGuard aGuard;
771 : :
772 [ + - ][ + - ]: 361 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
773 [ + - ]: 361 : if( pForwarder )
774 : : {
775 : 361 : CheckSelection( maSelection, pForwarder );
776 : :
777 : 361 : ESelection aSel( GetSelection() );
778 : :
779 : 361 : const OUString* pPropertyNames = aPropertyNames.getConstArray();
780 : 361 : const uno::Any* pValues = aValues.getConstArray();
781 : 361 : sal_Int32 nCount = aPropertyNames.getLength();
782 : :
783 : 361 : sal_Int32 nEndPara = nPara;
784 : 361 : sal_Int32 nTempPara = nPara;
785 : :
786 [ + - ]: 361 : if( nTempPara == -1 )
787 : : {
788 : 361 : nTempPara = aSel.nStartPara;
789 : 361 : nEndPara = aSel.nEndPara;
790 : : }
791 : :
792 : 361 : SfxItemSet* pOldAttrSet = NULL;
793 : 361 : SfxItemSet* pNewAttrSet = NULL;
794 : :
795 : 361 : SfxItemSet* pOldParaSet = NULL;
796 : 361 : SfxItemSet* pNewParaSet = NULL;
797 : :
798 [ + + ]: 4891 : for( ; nCount; nCount--, pPropertyNames++, pValues++ )
799 : : {
800 [ + - ]: 4530 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
801 : :
802 [ + + ]: 4530 : if( pMap )
803 : : {
804 [ + + ][ + + ]: 4422 : sal_Bool bParaAttrib = (pMap->nWID >= EE_PARA_START) && ( pMap->nWID <= EE_PARA_END );
805 : :
806 [ + - ][ + + ]: 4422 : if( (nPara == -1) && !bParaAttrib )
807 : : {
808 [ + + ]: 4122 : if( NULL == pNewAttrSet )
809 : : {
810 [ + - ]: 361 : const SfxItemSet aSet( pForwarder->GetAttribs( aSel ) );
811 [ + - ][ + - ]: 361 : pOldAttrSet = new SfxItemSet( aSet );
812 [ + - ][ + - ]: 361 : pNewAttrSet = new SfxItemSet( *pOldAttrSet->GetPool(), pOldAttrSet->GetRanges() );
[ + - ]
813 : : }
814 : :
815 [ + - ]: 4122 : setPropertyValue( pMap, *pValues, GetSelection(), *pOldAttrSet, *pNewAttrSet );
816 : :
817 [ + + ][ + - ]: 4122 : if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
818 : : {
819 : : const SfxPoolItem* pItem;
820 [ + - ][ + - ]: 4056 : if( pNewAttrSet->GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
821 : : {
822 [ + - ]: 4056 : pOldAttrSet->Put( *pItem );
823 : : }
824 : 4122 : }
825 : : }
826 : : else
827 : : {
828 [ + + ]: 300 : if( NULL == pNewParaSet )
829 : : {
830 [ + - ]: 99 : const SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nTempPara ) );
831 [ + - ][ + - ]: 99 : pOldParaSet = new SfxItemSet( aSet );
832 [ + - ][ + - ]: 99 : pNewParaSet = new SfxItemSet( *pOldParaSet->GetPool(), pOldParaSet->GetRanges() );
[ + - ]
833 : : }
834 : :
835 [ + - ]: 300 : setPropertyValue( pMap, *pValues, GetSelection(), *pOldParaSet, *pNewParaSet );
836 : :
837 [ + - ][ + - ]: 300 : if( pMap->nWID >= EE_ITEMS_START && pMap->nWID <= EE_ITEMS_END )
838 : : {
839 : : const SfxPoolItem* pItem;
840 [ + - ][ + - ]: 300 : if( pNewParaSet->GetItemState( pMap->nWID, sal_True, &pItem ) == SFX_ITEM_SET )
841 : : {
842 [ + - ]: 4422 : pOldParaSet->Put( *pItem );
843 : : }
844 : : }
845 : :
846 : : }
847 : : }
848 : : }
849 : :
850 : 361 : sal_Bool bNeedsUpdate = sal_False;
851 : :
852 [ + + ]: 361 : if( pNewParaSet )
853 : : {
854 [ + - ]: 99 : if( pNewParaSet->Count() )
855 : : {
856 [ + + ]: 198 : while( nTempPara <= nEndPara )
857 : : {
858 [ + - ]: 99 : SfxItemSet aSet( pForwarder->GetParaAttribs( (sal_uInt16)nTempPara ) );
859 [ + - ]: 99 : aSet.Put( *pNewParaSet );
860 [ + - ]: 99 : pForwarder->SetParaAttribs( (sal_uInt16)nTempPara, aSet );
861 : 99 : nTempPara++;
862 [ + - ]: 99 : }
863 : 99 : bNeedsUpdate = sal_True;
864 : : }
865 : :
866 [ + - ][ + - ]: 99 : delete pNewParaSet;
867 [ + - ][ + - ]: 99 : delete pOldParaSet;
868 : : }
869 : :
870 [ + - ]: 361 : if( pNewAttrSet )
871 : : {
872 [ + + ]: 361 : if( pNewAttrSet->Count() )
873 : : {
874 [ + - ]: 295 : pForwarder->QuickSetAttribs( *pNewAttrSet, GetSelection() );
875 : 295 : bNeedsUpdate = sal_True;
876 : : }
877 [ + - ][ + - ]: 361 : delete pNewAttrSet;
878 [ + - ][ + - ]: 361 : delete pOldAttrSet;
879 : :
880 : : }
881 : :
882 [ + - ]: 361 : if( bNeedsUpdate )
883 [ + - ]: 361 : GetEditSource()->UpdateData();
884 [ + - ]: 361 : }
885 : 361 : }
886 : :
887 : 0 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (uno::RuntimeException)
888 : : {
889 : 0 : return _getPropertyValues( aPropertyNames, -1 );
890 : : }
891 : :
892 : 135 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::_getPropertyValues( const uno::Sequence< ::rtl::OUString >& aPropertyNames, sal_Int32 nPara ) throw (uno::RuntimeException)
893 : : {
894 [ + - ]: 135 : SolarMutexGuard aGuard;
895 : :
896 : 135 : sal_Int32 nCount = aPropertyNames.getLength();
897 : :
898 : :
899 [ + - ]: 135 : uno::Sequence< uno::Any > aValues( nCount );
900 : :
901 [ + - ][ + - ]: 135 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
902 [ + - ]: 135 : if( pForwarder )
903 : : {
904 : 135 : SfxItemSet* pAttribs = NULL;
905 [ + - ]: 135 : if( nPara != -1 )
906 [ + - ][ + - ]: 135 : pAttribs = pForwarder->GetParaAttribs( (sal_uInt16)nPara ).Clone();
[ + - ]
907 : : else
908 [ # # ][ # # ]: 0 : pAttribs = pForwarder->GetAttribs( GetSelection() ).Clone();
[ # # ]
909 : :
910 [ + - ]: 135 : pAttribs->ClearInvalidItems();
911 : :
912 : 135 : const OUString* pPropertyNames = aPropertyNames.getConstArray();
913 [ + - ]: 135 : uno::Any* pValues = aValues.getArray();
914 : :
915 [ + + ]: 542 : for( ; nCount; nCount--, pPropertyNames++, pValues++ )
916 : : {
917 [ + - ]: 407 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pPropertyNames );
918 [ + - ]: 407 : if( pMap )
919 : : {
920 [ + - ]: 407 : getPropertyValue( pMap, *pValues, *pAttribs );
921 : : }
922 : : }
923 : :
924 [ + - ][ + - ]: 135 : delete pAttribs;
925 : :
926 : : }
927 : :
928 [ + - ]: 135 : return aValues;
929 : : }
930 : :
931 : 204 : void SAL_CALL SvxUnoTextRangeBase::addPropertiesChangeListener( const uno::Sequence< ::rtl::OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException)
932 : : {
933 : 204 : }
934 : :
935 : 185 : void SAL_CALL SvxUnoTextRangeBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException)
936 : : {
937 : 185 : }
938 : :
939 : 0 : void SAL_CALL SvxUnoTextRangeBase::firePropertiesChangeEvent( const uno::Sequence< ::rtl::OUString >& , const uno::Reference< beans::XPropertiesChangeListener >& ) throw (uno::RuntimeException)
940 : : {
941 : 0 : }
942 : :
943 : : // beans::XPropertyState
944 : 6 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::getPropertyState( const OUString& PropertyName )
945 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
946 : : {
947 : 6 : return _getPropertyState( PropertyName, -1 );
948 : : }
949 : :
950 : : static sal_uInt16 aSvxUnoFontDescriptorWhichMap[] = { EE_CHAR_FONTINFO, EE_CHAR_FONTHEIGHT, EE_CHAR_ITALIC,
951 : : EE_CHAR_UNDERLINE, EE_CHAR_WEIGHT, EE_CHAR_STRIKEOUT,
952 : : EE_CHAR_WLM, 0 };
953 : :
954 : 8 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara)
955 : : throw( beans::UnknownPropertyException, uno::RuntimeException )
956 : : {
957 [ + - ]: 8 : if ( pMap )
958 : : {
959 [ + - ]: 8 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
960 [ + - ]: 8 : if( pForwarder )
961 : : {
962 : 8 : SfxItemState eItemState = SFX_ITEM_UNKNOWN;
963 : 8 : sal_uInt16 nWID = 0;
964 : :
965 [ - - + ]: 8 : switch( pMap->nWID )
966 : : {
967 : : case WID_FONTDESC:
968 : : {
969 : 0 : sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
970 : : SfxItemState eTempItemState;
971 [ # # ]: 0 : while( *pWhichId )
972 : : {
973 [ # # ]: 0 : if(nPara != -1)
974 : 0 : eTempItemState = pForwarder->GetItemState( (sal_uInt16)nPara, *pWhichId );
975 : : else
976 : 0 : eTempItemState = pForwarder->GetItemState( GetSelection(), *pWhichId );
977 : :
978 [ # # # # ]: 0 : switch( eTempItemState )
979 : : {
980 : : case SFX_ITEM_DISABLED:
981 : : case SFX_ITEM_DONTCARE:
982 : 0 : eItemState = SFX_ITEM_DONTCARE;
983 : 0 : break;
984 : :
985 : : case SFX_ITEM_DEFAULT:
986 [ # # ]: 0 : if( eItemState != SFX_ITEM_DEFAULT )
987 : : {
988 [ # # ]: 0 : if( eItemState == SFX_ITEM_UNKNOWN )
989 : 0 : eItemState = SFX_ITEM_DEFAULT;
990 : : }
991 : 0 : break;
992 : :
993 : : case SFX_ITEM_READONLY:
994 : : case SFX_ITEM_SET:
995 [ # # ]: 0 : if( eItemState != SFX_ITEM_SET )
996 : : {
997 [ # # ]: 0 : if( eItemState == SFX_ITEM_UNKNOWN )
998 : 0 : eItemState = SFX_ITEM_SET;
999 : : }
1000 : 0 : break;
1001 : : default:
1002 [ # # ]: 0 : throw beans::UnknownPropertyException();
1003 : : }
1004 : :
1005 : 0 : pWhichId++;
1006 : : }
1007 : : }
1008 : 0 : break;
1009 : :
1010 : : case WID_NUMLEVEL:
1011 : : case WID_NUMBERINGSTARTVALUE:
1012 : : case WID_PARAISNUMBERINGRESTART:
1013 : 0 : eItemState = SFX_ITEM_SET;
1014 : 0 : break;
1015 : :
1016 : : default:
1017 : 8 : nWID = pMap->nWID;
1018 : : }
1019 : :
1020 [ + - ]: 8 : if( nWID != 0 )
1021 : : {
1022 [ + + ]: 8 : if( nPara != -1 )
1023 : 2 : eItemState = pForwarder->GetItemState( (sal_uInt16)nPara, nWID );
1024 : : else
1025 : 6 : eItemState = pForwarder->GetItemState( GetSelection(), nWID );
1026 : : }
1027 : :
1028 [ - - + - ]: 8 : switch( eItemState )
1029 : : {
1030 : : case SFX_ITEM_DONTCARE:
1031 : : case SFX_ITEM_DISABLED:
1032 : 0 : return beans::PropertyState_AMBIGUOUS_VALUE;
1033 : : case SFX_ITEM_READONLY:
1034 : : case SFX_ITEM_SET:
1035 : 0 : return beans::PropertyState_DIRECT_VALUE;
1036 : : case SFX_ITEM_DEFAULT:
1037 : 8 : return beans::PropertyState_DEFAULT_VALUE;
1038 : : // case SFX_ITEM_UNKNOWN:
1039 : : }
1040 : : }
1041 : : }
1042 [ # # ]: 8 : throw beans::UnknownPropertyException();
1043 : : }
1044 : :
1045 : 8 : beans::PropertyState SAL_CALL SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
1046 : : throw( beans::UnknownPropertyException, uno::RuntimeException )
1047 : : {
1048 [ + - ]: 8 : SolarMutexGuard aGuard;
1049 : :
1050 [ + - ][ + - ]: 8 : return _getPropertyState( mpPropSet->getPropertyMapEntry( PropertyName ), nPara);
[ + - ]
1051 : : }
1052 : :
1053 : 291 : uno::Sequence< beans::PropertyState > SAL_CALL SvxUnoTextRangeBase::getPropertyStates( const uno::Sequence< OUString >& aPropertyName )
1054 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
1055 : : {
1056 : 291 : return _getPropertyStates( aPropertyName, -1 );
1057 : : }
1058 : :
1059 : 387 : uno::Sequence< beans::PropertyState > SvxUnoTextRangeBase::_getPropertyStates(const uno::Sequence< OUString >& PropertyName, sal_Int32 nPara /* = -1 */)
1060 : : throw( beans::UnknownPropertyException, uno::RuntimeException )
1061 : : {
1062 : 387 : const sal_Int32 nCount = PropertyName.getLength();
1063 : 387 : const OUString* pNames = PropertyName.getConstArray();
1064 : :
1065 : 387 : uno::Sequence< beans::PropertyState > aRet( nCount );
1066 [ + - ]: 387 : beans::PropertyState* pState = aRet.getArray();
1067 : :
1068 [ + - ][ + - ]: 387 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
1069 [ + - ]: 387 : if( pForwarder )
1070 : : {
1071 : 387 : SfxItemSet* pSet = NULL;
1072 [ + + ]: 387 : if( nPara != -1 )
1073 : : {
1074 [ + - ][ + - ]: 96 : pSet = new SfxItemSet( pForwarder->GetParaAttribs( (sal_uInt16)nPara ) );
1075 : : }
1076 : : else
1077 : : {
1078 : 291 : ESelection aSel( GetSelection() );
1079 : 291 : CheckSelection( aSel, pForwarder );
1080 [ + - ][ + - ]: 291 : pSet = new SfxItemSet( pForwarder->GetAttribs( aSel, EditEngineAttribs_OnlyHard ) );
1081 : : }
1082 : :
1083 : 387 : sal_Bool bUnknownPropertyFound = sal_False;
1084 [ + + ]: 20000 : for( sal_Int32 nIdx = 0; nIdx < nCount; nIdx++ )
1085 : : {
1086 [ + - ]: 19613 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( *pNames++ );
1087 [ - + ]: 19613 : if( NULL == pMap )
1088 : : {
1089 : 0 : bUnknownPropertyFound = sal_True;
1090 : 0 : break;
1091 : : }
1092 [ + - ]: 19613 : bUnknownPropertyFound = !_getOnePropertyStates(pSet, pMap, *pState++);
1093 : : }
1094 : :
1095 [ + - ][ + - ]: 387 : delete pSet;
1096 : :
1097 [ - + ]: 387 : if( bUnknownPropertyFound )
1098 [ # # ]: 0 : throw beans::UnknownPropertyException();
1099 : : }
1100 : :
1101 : 387 : return aRet;
1102 : : }
1103 : :
1104 : 19613 : sal_Bool SvxUnoTextRangeBase::_getOnePropertyStates(const SfxItemSet* pSet, const SfxItemPropertySimpleEntry* pMap, beans::PropertyState& rState)
1105 : : {
1106 : 19613 : sal_Bool bUnknownPropertyFound = sal_False;
1107 [ + - ][ + - ]: 19613 : if(pSet && pMap)
1108 : : {
1109 : 19613 : SfxItemState eItemState = SFX_ITEM_UNKNOWN;
1110 : 19613 : sal_uInt16 nWID = 0;
1111 : :
1112 [ - - + ]: 19613 : switch( pMap->nWID )
1113 : : {
1114 : : case WID_FONTDESC:
1115 : : {
1116 : 0 : sal_uInt16* pWhichId = aSvxUnoFontDescriptorWhichMap;
1117 : : SfxItemState eTempItemState;
1118 [ # # ]: 0 : while( *pWhichId )
1119 : : {
1120 : 0 : eTempItemState = pSet->GetItemState( *pWhichId );
1121 : :
1122 [ # # # # ]: 0 : switch( eTempItemState )
1123 : : {
1124 : : case SFX_ITEM_DISABLED:
1125 : : case SFX_ITEM_DONTCARE:
1126 : 0 : eItemState = SFX_ITEM_DONTCARE;
1127 : 0 : break;
1128 : :
1129 : : case SFX_ITEM_DEFAULT:
1130 [ # # ]: 0 : if( eItemState != SFX_ITEM_DEFAULT )
1131 : : {
1132 [ # # ]: 0 : if( eItemState == SFX_ITEM_UNKNOWN )
1133 : 0 : eItemState = SFX_ITEM_DEFAULT;
1134 : : }
1135 : 0 : break;
1136 : :
1137 : : case SFX_ITEM_READONLY:
1138 : : case SFX_ITEM_SET:
1139 [ # # ]: 0 : if( eItemState != SFX_ITEM_SET )
1140 : : {
1141 [ # # ]: 0 : if( eItemState == SFX_ITEM_UNKNOWN )
1142 : 0 : eItemState = SFX_ITEM_SET;
1143 : : }
1144 : 0 : break;
1145 : : default:
1146 : 0 : bUnknownPropertyFound = sal_True;
1147 : 0 : break;
1148 : : }
1149 : :
1150 : 0 : pWhichId++;
1151 : : }
1152 : : }
1153 : 0 : break;
1154 : :
1155 : : case WID_NUMLEVEL:
1156 : : case WID_NUMBERINGSTARTVALUE:
1157 : : case WID_PARAISNUMBERINGRESTART:
1158 : 0 : eItemState = SFX_ITEM_SET;
1159 : 0 : break;
1160 : :
1161 : : default:
1162 : 19613 : nWID = pMap->nWID;
1163 : : }
1164 : :
1165 [ - + ]: 19613 : if( bUnknownPropertyFound )
1166 : 0 : return !bUnknownPropertyFound;
1167 : :
1168 [ + - ]: 19613 : if( nWID != 0 )
1169 : 19613 : eItemState = pSet->GetItemState( nWID, sal_False );
1170 : :
1171 [ + + - ]: 19613 : switch( eItemState )
1172 : : {
1173 : : case SFX_ITEM_READONLY:
1174 : : case SFX_ITEM_SET:
1175 : 360 : rState = beans::PropertyState_DIRECT_VALUE;
1176 : 360 : break;
1177 : : case SFX_ITEM_DEFAULT:
1178 : 19253 : rState = beans::PropertyState_DEFAULT_VALUE;
1179 : 19253 : break;
1180 : : // case SFX_ITEM_UNKNOWN:
1181 : : // case SFX_ITEM_DONTCARE:
1182 : : // case SFX_ITEM_DISABLED:
1183 : : default:
1184 : 19613 : rState = beans::PropertyState_AMBIGUOUS_VALUE;
1185 : : }
1186 : : }
1187 : 19613 : return !bUnknownPropertyFound;
1188 : : }
1189 : :
1190 : 6 : void SAL_CALL SvxUnoTextRangeBase::setPropertyToDefault( const OUString& PropertyName )
1191 : : throw(beans::UnknownPropertyException, uno::RuntimeException)
1192 : : {
1193 : 6 : _setPropertyToDefault( PropertyName, -1 );
1194 : 6 : }
1195 : :
1196 : 8 : void SvxUnoTextRangeBase::_setPropertyToDefault(const OUString& PropertyName, sal_Int32 nPara /* = -1 */)
1197 : : throw( beans::UnknownPropertyException, uno::RuntimeException )
1198 : : {
1199 [ + - ]: 8 : SolarMutexGuard aGuard;
1200 : :
1201 [ + - ][ + - ]: 8 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
1202 : :
1203 [ + - ]: 8 : if( pForwarder )
1204 : : {
1205 [ + - ]: 8 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( PropertyName );
1206 [ + - ]: 8 : if ( pMap )
1207 : : {
1208 [ + - ]: 8 : CheckSelection( maSelection, mpEditSource->GetTextForwarder() );
1209 [ + - ]: 8 : _setPropertyToDefault( pForwarder, pMap, nPara );
1210 : 8 : return;
1211 : : }
1212 : : }
1213 : :
1214 [ # # ][ + - ]: 8 : throw beans::UnknownPropertyException();
1215 : : }
1216 : :
1217 : 8 : void SvxUnoTextRangeBase::_setPropertyToDefault(SvxTextForwarder* pForwarder, const SfxItemPropertySimpleEntry* pMap, sal_Int32 nPara )
1218 : : throw( beans::UnknownPropertyException, uno::RuntimeException )
1219 : : {
1220 : : do
1221 : : {
1222 [ + - ][ + - ]: 8 : SfxItemSet aSet( *pForwarder->GetPool(), sal_True );
1223 : :
1224 [ - + ]: 8 : if( pMap->nWID == WID_FONTDESC )
1225 : : {
1226 [ # # ]: 0 : SvxUnoFontDescriptor::setPropertyToDefault( aSet );
1227 : : }
1228 [ - + ]: 8 : else if( pMap->nWID == WID_NUMLEVEL )
1229 : : {
1230 : : // #101004# Call interface method instead of unsafe cast
1231 [ # # ]: 0 : pForwarder->SetDepth( maSelection.nStartPara, -1 );
1232 : : return;
1233 : : }
1234 [ - + ]: 8 : else if( pMap->nWID == WID_NUMBERINGSTARTVALUE )
1235 : : {
1236 [ # # ]: 0 : pForwarder->SetNumberingStartValue( maSelection.nStartPara, -1 );
1237 : : }
1238 [ - + ]: 8 : else if( pMap->nWID == WID_PARAISNUMBERINGRESTART )
1239 : : {
1240 [ # # ]: 0 : pForwarder->SetParaIsNumberingRestart( maSelection.nStartPara, sal_False );
1241 : : }
1242 : : else
1243 : : {
1244 [ + - ]: 8 : aSet.InvalidateItem( pMap->nWID );
1245 : : }
1246 : :
1247 [ + + ]: 8 : if(nPara != -1)
1248 [ + - ]: 2 : pForwarder->SetParaAttribs( (sal_uInt16)nPara, aSet );
1249 : : else
1250 [ + - ]: 6 : pForwarder->QuickSetAttribs( aSet, GetSelection() );
1251 : :
1252 [ + - ]: 8 : GetEditSource()->UpdateData();
1253 : :
1254 [ + - ]: 8 : return;
1255 : : }
1256 : : while(0);
1257 : : }
1258 : :
1259 : 8 : uno::Any SAL_CALL SvxUnoTextRangeBase::getPropertyDefault( const OUString& aPropertyName )
1260 : : throw(beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1261 : : {
1262 [ + - ]: 8 : SolarMutexGuard aGuard;
1263 : :
1264 [ + - ][ + - ]: 8 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
1265 [ + - ]: 8 : if( pForwarder )
1266 : : {
1267 [ + - ]: 8 : const SfxItemPropertySimpleEntry* pMap = mpPropSet->getPropertyMapEntry( aPropertyName );
1268 [ + - ]: 8 : if( pMap )
1269 : : {
1270 [ + - ]: 8 : SfxItemPool* pPool = pForwarder->GetPool();
1271 : :
1272 [ - - - - : 8 : switch( pMap->nWID )
+ ]
1273 : : {
1274 : : case WID_FONTDESC:
1275 [ # # ]: 0 : return SvxUnoFontDescriptor::getPropertyDefault( pPool );
1276 : :
1277 : : case WID_NUMLEVEL:
1278 : : {
1279 : 0 : uno::Any aAny;
1280 : 0 : return aAny;
1281 : : }
1282 : :
1283 : : case WID_NUMBERINGSTARTVALUE:
1284 [ # # ]: 0 : return uno::Any( (sal_Int16)-1 );
1285 : :
1286 : : case WID_PARAISNUMBERINGRESTART:
1287 [ # # ]: 0 : return uno::Any( (sal_Bool)sal_False );
1288 : :
1289 : : default:
1290 : : {
1291 : : // Get Default from ItemPool
1292 [ + - ]: 8 : if(pPool->IsWhich(pMap->nWID))
1293 : : {
1294 [ + - ]: 8 : SfxItemSet aSet( *pPool, pMap->nWID, pMap->nWID);
1295 [ + - ][ + - ]: 8 : aSet.Put(pPool->GetDefaultItem(pMap->nWID));
1296 [ + - ][ + - ]: 8 : return mpPropSet->getPropertyValue(pMap, aSet, true, false );
1297 : : }
1298 : : }
1299 : : }
1300 : : }
1301 : : }
1302 [ # # ][ + - ]: 8 : throw beans::UnknownPropertyException();
1303 : : }
1304 : :
1305 : : // beans::XMultiPropertyStates
1306 : 0 : void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault( ) throw (uno::RuntimeException)
1307 : : {
1308 [ # # ]: 0 : SolarMutexGuard aGuard;
1309 : :
1310 [ # # ][ # # ]: 0 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
1311 : :
1312 [ # # ]: 0 : if( pForwarder )
1313 : : {
1314 [ # # ]: 0 : PropertyEntryVector_t aEntries = mpPropSet->getPropertyMap()->getPropertyEntries();
1315 [ # # ]: 0 : PropertyEntryVector_t::const_iterator aIt = aEntries.begin();
1316 [ # # ][ # # ]: 0 : while( aIt != aEntries.end() )
1317 : : {
1318 [ # # ]: 0 : _setPropertyToDefault( pForwarder, &(*aIt), -1 );
1319 : 0 : ++aIt;
1320 : 0 : }
1321 [ # # ]: 0 : }
1322 : 0 : }
1323 : :
1324 : 0 : void SAL_CALL SvxUnoTextRangeBase::setPropertiesToDefault( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, uno::RuntimeException)
1325 : : {
1326 : 0 : sal_Int32 nCount = aPropertyNames.getLength();
1327 [ # # ]: 0 : for( const OUString* pName = aPropertyNames.getConstArray(); nCount; pName++, nCount-- )
1328 : : {
1329 : 0 : setPropertyToDefault( *pName );
1330 : : }
1331 : 0 : }
1332 : :
1333 : 0 : uno::Sequence< uno::Any > SAL_CALL SvxUnoTextRangeBase::getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
1334 : : {
1335 : 0 : sal_Int32 nCount = aPropertyNames.getLength();
1336 : 0 : uno::Sequence< uno::Any > ret( nCount );
1337 [ # # ]: 0 : uno::Any* pDefaults = ret.getArray();
1338 : :
1339 [ # # ]: 0 : for( const OUString* pName = aPropertyNames.getConstArray(); nCount; pName++, nCount--, pDefaults++ )
1340 : : {
1341 [ # # ]: 0 : *pDefaults = getPropertyDefault( *pName );
1342 : : }
1343 : :
1344 : 0 : return ret;
1345 : : }
1346 : :
1347 : : // internal
1348 : 25091 : void SvxUnoTextRangeBase::CollapseToStart(void) throw()
1349 : : {
1350 : 25091 : CheckSelection( maSelection, mpEditSource );
1351 : :
1352 : 25091 : maSelection.nEndPara = maSelection.nStartPara;
1353 : 25091 : maSelection.nEndPos = maSelection.nStartPos;
1354 : 25091 : }
1355 : :
1356 : 5682 : void SvxUnoTextRangeBase::CollapseToEnd(void) throw()
1357 : : {
1358 : 5682 : CheckSelection( maSelection, mpEditSource );
1359 : :
1360 : 5682 : maSelection.nStartPara = maSelection.nEndPara;
1361 : 5682 : maSelection.nStartPos = maSelection.nEndPos;
1362 : 5682 : }
1363 : :
1364 : 170 : sal_Bool SvxUnoTextRangeBase::IsCollapsed(void) throw()
1365 : : {
1366 : 170 : CheckSelection( maSelection, mpEditSource );
1367 : :
1368 : : return ( maSelection.nStartPara == maSelection.nEndPara &&
1369 [ + + ][ + - ]: 170 : maSelection.nStartPos == maSelection.nEndPos );
1370 : : }
1371 : :
1372 : 871 : sal_Bool SvxUnoTextRangeBase::GoLeft(sal_Int16 nCount, sal_Bool Expand) throw()
1373 : : {
1374 : 871 : CheckSelection( maSelection, mpEditSource );
1375 : :
1376 : : // #75098# use end position, as in Writer (start is anchor, end is cursor)
1377 : 871 : sal_uInt16 nNewPos = maSelection.nEndPos;
1378 : 871 : sal_uInt16 nNewPar = maSelection.nEndPara;
1379 : :
1380 : 871 : sal_Bool bOk = sal_True;
1381 : 871 : SvxTextForwarder* pForwarder = NULL;
1382 [ + + ][ + + ]: 1738 : while ( nCount > nNewPos && bOk )
[ + + ]
1383 : : {
1384 [ + + ]: 867 : if ( nNewPar == 0 )
1385 : 61 : bOk = sal_False;
1386 : : else
1387 : : {
1388 [ + - ]: 806 : if ( !pForwarder )
1389 : 806 : pForwarder = mpEditSource->GetTextForwarder(); // first here, it it is necessary...
1390 : :
1391 : 806 : --nNewPar;
1392 : 806 : nCount -= nNewPos + 1;
1393 : 806 : nNewPos = pForwarder->GetTextLen( nNewPar );
1394 : : }
1395 : : }
1396 : :
1397 [ + + ]: 871 : if ( bOk )
1398 : : {
1399 : 810 : nNewPos = nNewPos - nCount;
1400 : 810 : maSelection.nStartPara = nNewPar;
1401 : 810 : maSelection.nStartPos = nNewPos;
1402 : : }
1403 : :
1404 [ + + ]: 871 : if (!Expand)
1405 : 4 : CollapseToStart();
1406 : :
1407 : 871 : return bOk;
1408 : : }
1409 : :
1410 : 24101 : sal_Bool SvxUnoTextRangeBase::GoRight(sal_Int16 nCount, sal_Bool Expand) throw()
1411 : : {
1412 [ + - ]: 24101 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
1413 [ + - ]: 24101 : if( pForwarder )
1414 : : {
1415 : 24101 : CheckSelection( maSelection, pForwarder );
1416 : :
1417 : 24101 : sal_uInt16 nNewPos = maSelection.nEndPos + nCount; //! Overflow???
1418 : 24101 : sal_uInt16 nNewPar = maSelection.nEndPara;
1419 : :
1420 : 24101 : sal_Bool bOk = sal_True;
1421 : 24101 : sal_uInt16 nParCount = pForwarder->GetParagraphCount();
1422 : 24101 : sal_uInt16 nThisLen = pForwarder->GetTextLen( nNewPar );
1423 [ + + ][ + + ]: 25339 : while ( nNewPos > nThisLen && bOk )
[ + + ]
1424 : : {
1425 [ + + ]: 1238 : if ( nNewPar + 1 >= nParCount )
1426 : 4 : bOk = sal_False;
1427 : : else
1428 : : {
1429 : 1234 : nNewPos -= nThisLen+1;
1430 : 1234 : ++nNewPar;
1431 : 1234 : nThisLen = pForwarder->GetTextLen( nNewPar );
1432 : : }
1433 : : }
1434 : :
1435 [ + + ]: 24101 : if (bOk)
1436 : : {
1437 : 24097 : maSelection.nEndPara = nNewPar;
1438 : 24097 : maSelection.nEndPos = nNewPos;
1439 : : }
1440 : :
1441 [ + + ]: 24101 : if (!Expand)
1442 : 4 : CollapseToEnd();
1443 : :
1444 : 24101 : return bOk;
1445 : : }
1446 : 24101 : return sal_False;
1447 : : }
1448 : :
1449 : 36 : void SvxUnoTextRangeBase::GotoStart(sal_Bool Expand) throw()
1450 : : {
1451 : 36 : maSelection.nStartPara = 0;
1452 : 36 : maSelection.nStartPos = 0;
1453 : :
1454 [ + - ]: 36 : if (!Expand)
1455 : 36 : CollapseToStart();
1456 : 36 : }
1457 : :
1458 : 2808 : void SvxUnoTextRangeBase::GotoEnd(sal_Bool Expand) throw()
1459 : : {
1460 : 2808 : CheckSelection( maSelection, mpEditSource );
1461 : :
1462 [ + - ]: 2808 : SvxTextForwarder* pForwarder = mpEditSource ? mpEditSource->GetTextForwarder() : NULL;
1463 [ + - ]: 2808 : if( pForwarder )
1464 : : {
1465 : :
1466 : 2808 : sal_uInt16 nPar = pForwarder->GetParagraphCount();
1467 [ + - ]: 2808 : if (nPar)
1468 : 2808 : --nPar;
1469 : :
1470 : 2808 : maSelection.nEndPara = nPar;
1471 : 2808 : maSelection.nEndPos = pForwarder->GetTextLen( nPar );
1472 : :
1473 [ + + ]: 2808 : if (!Expand)
1474 : 1655 : CollapseToEnd();
1475 : : }
1476 : 2808 : }
1477 : :
1478 : : // lang::XServiceInfo
1479 : 235 : sal_Bool SAL_CALL SvxUnoTextRangeBase::supportsService( const OUString& ServiceName )
1480 : : throw(uno::RuntimeException)
1481 : : {
1482 : 235 : return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames() );
1483 : : }
1484 : :
1485 : 255 : uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames()
1486 : : throw(uno::RuntimeException)
1487 : : {
1488 : 255 : return getSupportedServiceNames_Static();
1489 : : }
1490 : :
1491 : 362 : uno::Sequence< OUString > SAL_CALL SvxUnoTextRangeBase::getSupportedServiceNames_Static()
1492 : : SAL_THROW(())
1493 : : {
1494 : 362 : uno::Sequence< OUString > aSeq;
1495 : : comphelper::ServiceInfoHelper::addToSequence( aSeq, 3, "com.sun.star.style.CharacterProperties",
1496 : : "com.sun.star.style.CharacterPropertiesComplex",
1497 : 362 : "com.sun.star.style.CharacterPropertiesAsian");
1498 : 362 : return aSeq;
1499 : : }
1500 : :
1501 : : // XTextRangeCompare
1502 : 0 : sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionStarts( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) throw (lang::IllegalArgumentException, uno::RuntimeException)
1503 : : {
1504 : 0 : SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 );
1505 : 0 : SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 );
1506 : :
1507 [ # # ][ # # ]: 0 : if( (pR1 == 0) || (pR2 == 0) )
1508 [ # # ]: 0 : throw lang::IllegalArgumentException();
1509 : :
1510 : 0 : const ESelection& r1 = pR1->maSelection;
1511 : 0 : const ESelection& r2 = pR2->maSelection;
1512 : :
1513 [ # # ]: 0 : if( r1.nStartPara == r2.nStartPara )
1514 : : {
1515 [ # # ]: 0 : if( r1.nStartPos == r2.nStartPos )
1516 : 0 : return 0;
1517 : : else
1518 [ # # ]: 0 : return r1.nStartPos < r2.nStartPos ? 1 : -1;
1519 : : }
1520 : : else
1521 : : {
1522 [ # # ]: 0 : return r1.nStartPara < r2.nStartPara ? 1 : -1;
1523 : : }
1524 : : }
1525 : :
1526 : 0 : sal_Int16 SAL_CALL SvxUnoTextRangeBase::compareRegionEnds( const uno::Reference< text::XTextRange >& xR1, const uno::Reference< text::XTextRange >& xR2 ) throw (lang::IllegalArgumentException, uno::RuntimeException)
1527 : : {
1528 : 0 : SvxUnoTextRangeBase* pR1 = SvxUnoTextRangeBase::getImplementation( xR1 );
1529 : 0 : SvxUnoTextRangeBase* pR2 = SvxUnoTextRangeBase::getImplementation( xR2 );
1530 : :
1531 [ # # ][ # # ]: 0 : if( (pR1 == 0) || (pR2 == 0) )
1532 [ # # ]: 0 : throw lang::IllegalArgumentException();
1533 : :
1534 : 0 : const ESelection& r1 = pR1->maSelection;
1535 : 0 : const ESelection& r2 = pR2->maSelection;
1536 : :
1537 [ # # ]: 0 : if( r1.nEndPara == r2.nEndPara )
1538 : : {
1539 [ # # ]: 0 : if( r1.nEndPos == r2.nEndPos )
1540 : 0 : return 0;
1541 : : else
1542 [ # # ]: 0 : return r1.nEndPos < r2.nEndPos ? 1 : -1;
1543 : : }
1544 : : else
1545 : : {
1546 [ # # ]: 0 : return r1.nEndPara < r2.nEndPara ? 1 : -1;
1547 : : }
1548 : : }
1549 : :
1550 : : // ====================================================================
1551 : : // class SvxUnoTextRange
1552 : : // ====================================================================
1553 : :
1554 : 0 : uno::Reference< uno::XInterface > SvxUnoTextRange_NewInstance()
1555 : : {
1556 : 0 : SvxUnoText aText;
1557 [ # # ][ # # ]: 0 : uno::Reference< text::XTextRange > xRange( new SvxUnoTextRange( aText ) );
1558 : : #if (_MSC_VER < 1300)
1559 : 0 : return xRange;
1560 : : #else
1561 : : return (uno::Reference< uno::XInterface >)xRange;
1562 : : #endif
1563 : : }
1564 : :
1565 : 960 : SvxUnoTextRange::SvxUnoTextRange( const SvxUnoTextBase& rParent, sal_Bool bPortion /* = sal_False */ ) throw()
1566 : 960 : :SvxUnoTextRangeBase( rParent.GetEditSource(), bPortion ? ImplGetSvxTextPortionSvxPropertySet() : rParent.getPropertySet() ),
1567 [ + + ]: 1920 : mbPortion( bPortion )
1568 : : {
1569 [ + - ]: 960 : xParentText = (text::XText*)&rParent;
1570 : 960 : }
1571 : :
1572 : 960 : SvxUnoTextRange::~SvxUnoTextRange() throw()
1573 : : {
1574 [ - + ]: 1920 : }
1575 : :
1576 : : // XTextRange
1577 : 0 : uno::Reference< text::XText > SAL_CALL SvxUnoTextRange::getText()
1578 : : throw(uno::RuntimeException)
1579 : : {
1580 : 0 : return xParentText;
1581 : : }
1582 : :
1583 : : // lang::XServiceInfo
1584 : 0 : OUString SAL_CALL SvxUnoTextRange::getImplementationName()
1585 : : throw(uno::RuntimeException)
1586 : : {
1587 : 0 : return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextRange"));
1588 : : }
1589 : :
1590 : : // ====================================================================
1591 : : // class SvxUnoText
1592 : : // ====================================================================
1593 : :
1594 : 0 : SvxUnoTextBase_Base::SvxUnoTextBase_Base(SvxUnoTextBase_Base const & base)
1595 : : throw ():
1596 : 0 : SvxUnoTextBase_Base0(base)
1597 : 0 : {}
1598 : :
1599 : 94344 : SvxUnoTextBase_Base::SvxUnoTextBase_Base(SvxItemPropertySet const * set)
1600 : : throw ():
1601 : 94344 : SvxUnoTextBase_Base0(set)
1602 : 94344 : {}
1603 : :
1604 : 973 : SvxUnoTextBase_Base::SvxUnoTextBase_Base(
1605 : : SvxEditSource const * source, SvxItemPropertySet const * set) throw ():
1606 : 973 : SvxUnoTextBase_Base0(source, set)
1607 : 973 : {}
1608 : :
1609 [ - + ]: 95298 : SvxUnoTextBase_Base::~SvxUnoTextBase_Base() throw () {}
1610 : :
1611 : 0 : SvxUnoTextBase::SvxUnoTextBase() throw()
1612 : 0 : : SvxUnoTextBase_Base( static_cast< SvxItemPropertySet * >(NULL) )
1613 : : {
1614 : :
1615 : 0 : }
1616 : :
1617 : 94344 : SvxUnoTextBase::SvxUnoTextBase( const SvxItemPropertySet* _pSet ) throw()
1618 : 94344 : : SvxUnoTextBase_Base( _pSet )
1619 : : {
1620 : 94344 : }
1621 : :
1622 : 973 : SvxUnoTextBase::SvxUnoTextBase( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
1623 : 973 : : SvxUnoTextBase_Base( pSource, _pSet )
1624 : : {
1625 [ + - ]: 973 : xParentText = xParent;
1626 : 973 : ESelection aSelection;
1627 [ + - ]: 973 : ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
1628 : 973 : SetSelection( aSelection );
1629 : 973 : }
1630 : :
1631 : 0 : SvxUnoTextBase::SvxUnoTextBase( const SvxUnoTextBase& rText ) throw()
1632 : 0 : : SvxUnoTextBase_Base( rText )
1633 : : {
1634 [ # # ]: 0 : xParentText = rText.xParentText;
1635 : 0 : }
1636 : :
1637 : 95298 : SvxUnoTextBase::~SvxUnoTextBase() throw()
1638 : : {
1639 [ - + ]: 95298 : }
1640 : :
1641 : 1613 : uno::Reference< text::XTextCursor > SvxUnoTextBase::createTextCursorBySelection( const ESelection& rSel )
1642 : : {
1643 : 1613 : SvxUnoTextCursor* pCursor = new SvxUnoTextCursor( *this );
1644 [ + - ]: 1613 : uno::Reference< text::XTextCursor > xCursor( pCursor );
1645 : 1613 : pCursor->SetSelection( rSel );
1646 : 1613 : return xCursor;
1647 : : }
1648 : :
1649 : : // XSimpleText
1650 : :
1651 : 1350 : uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursor()
1652 : : throw(uno::RuntimeException)
1653 : : {
1654 [ + - ]: 1350 : SolarMutexGuard aGuard;
1655 [ + - ][ + - ]: 1350 : return new SvxUnoTextCursor( *this );
[ + - ]
1656 : : }
1657 : :
1658 : 1613 : uno::Reference< text::XTextCursor > SAL_CALL SvxUnoTextBase::createTextCursorByRange( const uno::Reference< text::XTextRange >& aTextPosition )
1659 : : throw(uno::RuntimeException)
1660 : : {
1661 [ + - ]: 1613 : SolarMutexGuard aGuard;
1662 : :
1663 : 1613 : uno::Reference< text::XTextCursor > xCursor;
1664 : :
1665 [ + - ]: 1613 : if( aTextPosition.is() )
1666 : : {
1667 [ + - ]: 1613 : SvxUnoTextRangeBase* pRange = SvxUnoTextRangeBase::getImplementation( aTextPosition );
1668 [ + - ]: 1613 : if(pRange)
1669 [ + - ][ + - ]: 1613 : xCursor = createTextCursorBySelection( pRange->GetSelection() );
1670 : : }
1671 : :
1672 [ + - ]: 1613 : return xCursor;
1673 : : }
1674 : :
1675 : 2257 : void SAL_CALL SvxUnoTextBase::insertString( const uno::Reference< text::XTextRange >& xRange, const OUString& aString, sal_Bool bAbsorb )
1676 : : throw(uno::RuntimeException)
1677 : : {
1678 [ + - ]: 2257 : SolarMutexGuard aGuard;
1679 : :
1680 [ - + ]: 2257 : if( !xRange.is() )
1681 : 2257 : return;
1682 : :
1683 : 2257 : ESelection aSelection;
1684 [ + - ]: 2257 : if (GetEditSource())
1685 : : {
1686 [ + - ]: 2257 : ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
1687 : 2257 : SetSelection( aSelection );
1688 : : }
1689 : :
1690 [ + - ]: 2257 : SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
1691 [ + - ]: 2257 : if(pRange)
1692 : : {
1693 : : // setString on SvxUnoTextRangeBase instead of itself QuickInsertText
1694 : : // and UpdateData, so that the selection will be adjusted to
1695 : : // SvxUnoTextRangeBase. Actually all cursor objects of this Text must
1696 : : // to be statement to be adapted!
1697 : :
1698 [ + + ]: 2257 : if (!bAbsorb) // do not replace -> append on tail
1699 : 1762 : pRange->CollapseToEnd();
1700 : :
1701 [ + - ]: 2257 : pRange->setString( aString );
1702 : :
1703 : 2257 : pRange->CollapseToEnd();
1704 [ + - ][ + - ]: 2257 : }
1705 : : }
1706 : :
1707 : 917 : void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb )
1708 : : throw(lang::IllegalArgumentException, uno::RuntimeException)
1709 : : {
1710 [ + - ]: 917 : SolarMutexGuard aGuard;
1711 : :
1712 [ + - ][ + - ]: 917 : SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
1713 : :
1714 [ + - ]: 917 : if( pForwarder )
1715 : : {
1716 : 917 : ESelection aSelection;
1717 : 917 : ::GetSelection( aSelection, pForwarder );
1718 : 917 : SetSelection( aSelection );
1719 : :
1720 [ + + + - ]: 917 : switch( nControlCharacter )
1721 : : {
1722 : : case text::ControlCharacter::PARAGRAPH_BREAK:
1723 : : {
1724 : 104 : const rtl::OUString aText( (sal_Unicode)13 ); // '\r' does not work on Mac
1725 [ + - ]: 104 : insertString( xRange, aText, bAbsorb );
1726 : :
1727 : 104 : return;
1728 : : }
1729 : : case text::ControlCharacter::LINE_BREAK:
1730 : : {
1731 [ + - ]: 13 : SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
1732 [ + - ]: 13 : if(pRange)
1733 : : {
1734 : 13 : ESelection aRange = pRange->GetSelection();
1735 : :
1736 [ - + ]: 13 : if( bAbsorb )
1737 : : {
1738 [ # # ]: 0 : const String aEmpty;
1739 [ # # ]: 0 : pForwarder->QuickInsertText( aEmpty, aRange );
1740 : :
1741 : 0 : aRange.nEndPos = aRange.nStartPos;
1742 [ # # ]: 0 : aRange.nEndPara = aRange.nStartPara;
1743 : : }
1744 : : else
1745 : : {
1746 : 13 : aRange.nStartPos = aRange.nEndPos;
1747 : 13 : aRange.nStartPara = aRange.nStartPara;
1748 : : }
1749 : :
1750 [ + - ]: 13 : pForwarder->QuickInsertLineBreak( aRange );
1751 [ + - ]: 13 : GetEditSource()->UpdateData();
1752 : :
1753 : 13 : aRange.nEndPos += 1;
1754 [ + - ]: 13 : if( !bAbsorb )
1755 : 13 : aRange.nStartPos += 1;
1756 : :
1757 : 13 : pRange->SetSelection( aRange );
1758 : : }
1759 : : return;
1760 : : }
1761 : : case text::ControlCharacter::APPEND_PARAGRAPH:
1762 : : {
1763 [ + - ]: 800 : SvxUnoTextRangeBase* pRange = SvxUnoTextRange::getImplementation( xRange );
1764 [ + - ]: 800 : if(pRange)
1765 : : {
1766 : 800 : ESelection aRange = pRange->GetSelection();
1767 : : // ESelection aOldSelection = aRange;
1768 : :
1769 [ + - ]: 800 : aRange.nStartPos = pForwarder->GetTextLen( aRange.nStartPara );
1770 : :
1771 : 800 : aRange.nEndPara = aRange.nStartPara;
1772 : 800 : aRange.nEndPos = aRange.nStartPos;
1773 : :
1774 : 800 : pRange->SetSelection( aRange );
1775 : 800 : const rtl::OUString aText( (sal_Unicode)13 ); // '\r' geht auf'm Mac nicht
1776 [ + - ]: 800 : pRange->setString( aText );
1777 : :
1778 : 800 : aRange.nStartPos = 0;
1779 : 800 : aRange.nStartPara += 1;
1780 : 800 : aRange.nEndPos = 0;
1781 : 800 : aRange.nEndPara += 1;
1782 : :
1783 : 800 : pRange->SetSelection( aRange );
1784 : :
1785 : 800 : return;
1786 : : }
1787 : : }
1788 : : default:
1789 [ # # ]: 917 : throw lang::IllegalArgumentException();
1790 : : }
1791 [ + - ][ - + ]: 917 : }
1792 : : }
1793 : :
1794 : : // XText
1795 : 83 : void SAL_CALL SvxUnoTextBase::insertTextContent( const uno::Reference< text::XTextRange >& xRange, const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
1796 : : throw(lang::IllegalArgumentException, uno::RuntimeException)
1797 : : {
1798 [ + - ]: 83 : SolarMutexGuard aGuard;
1799 : :
1800 [ + - ][ + - ]: 83 : SvxTextForwarder* pForwarder = GetEditSource() ? GetEditSource()->GetTextForwarder() : NULL;
1801 [ - + ]: 83 : if (!pForwarder)
1802 : 76 : return;
1803 : :
1804 [ + - ]: 83 : uno::Reference<beans::XPropertySet> xPropSet(xRange, uno::UNO_QUERY);
1805 [ + + ]: 83 : if (!xPropSet.is())
1806 [ + - ]: 2 : throw lang::IllegalArgumentException();
1807 : :
1808 [ + - ][ + - ]: 81 : uno::Any aAny = xPropSet->getPropertyValue(UNO_TR_PROP_SELECTION);
1809 [ + - ]: 81 : text::TextRangeSelection aSel = aAny.get<text::TextRangeSelection>();
1810 [ + - ]: 81 : if (!bAbsorb)
1811 : 81 : aSel.Start = aSel.End;
1812 : :
1813 [ + - ]: 81 : boost::scoped_ptr<SvxFieldData> pFieldData(SvxFieldData::Create(xContent));
1814 [ + + ]: 81 : if (!pFieldData)
1815 [ + - ]: 5 : throw lang::IllegalArgumentException();
1816 : :
1817 [ + - ]: 76 : SvxFieldItem aField( *pFieldData, EE_FEATURE_FIELD );
1818 [ + - ]: 76 : pForwarder->QuickInsertField(aField, toESelection(aSel));
1819 [ + - ]: 76 : GetEditSource()->UpdateData();
1820 : :
1821 [ + - ]: 76 : uno::Reference<beans::XPropertySet> xPropSetContent(xContent, uno::UNO_QUERY);
1822 [ - + ]: 76 : if (!xContent.is())
1823 [ # # ]: 0 : throw lang::IllegalArgumentException();
1824 : :
1825 [ + - ][ + - ]: 76 : xPropSetContent->setPropertyValue(UNO_TC_PROP_ANCHOR, uno::makeAny(xRange));
[ + - ]
1826 : :
1827 : 76 : aSel.End.PositionInParagraph += 1;
1828 : 76 : aSel.Start.PositionInParagraph = aSel.End.PositionInParagraph;
1829 [ + - ][ + - ]: 83 : xPropSet->setPropertyValue(UNO_TR_PROP_SELECTION, uno::makeAny(aSel));
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ]
1830 : : }
1831 : :
1832 : 7 : void SAL_CALL SvxUnoTextBase::removeTextContent( const uno::Reference< text::XTextContent >& ) throw(container::NoSuchElementException, uno::RuntimeException)
1833 : : {
1834 : 7 : }
1835 : :
1836 : : // XTextRange
1837 : :
1838 : 46 : uno::Reference< text::XText > SAL_CALL SvxUnoTextBase::getText()
1839 : : throw(uno::RuntimeException)
1840 : : {
1841 [ + - ]: 46 : SolarMutexGuard aGuard;
1842 : :
1843 [ + - ]: 46 : if (GetEditSource())
1844 : : {
1845 : 46 : ESelection aSelection;
1846 [ + - ]: 46 : ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
1847 : 46 : ((SvxUnoTextBase*)this)->SetSelection( aSelection );
1848 : : }
1849 : :
1850 [ + - ][ + - ]: 46 : return (text::XText*)this;
1851 : : }
1852 : :
1853 : 6 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getStart()
1854 : : throw(uno::RuntimeException)
1855 : : {
1856 : 6 : return SvxUnoTextRangeBase::getStart();
1857 : : }
1858 : :
1859 : 15 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::getEnd()
1860 : : throw(uno::RuntimeException)
1861 : : {
1862 : 15 : return SvxUnoTextRangeBase::getEnd();
1863 : : }
1864 : :
1865 : 333 : OUString SAL_CALL SvxUnoTextBase::getString() throw( uno::RuntimeException )
1866 : : {
1867 : 333 : return SvxUnoTextRangeBase::getString();
1868 : : }
1869 : :
1870 : 21506 : void SAL_CALL SvxUnoTextBase::setString( const OUString& aString ) throw(uno::RuntimeException)
1871 : : {
1872 : 21506 : SvxUnoTextRangeBase::setString(aString);
1873 : 21506 : }
1874 : :
1875 : :
1876 : : // XEnumerationAccess
1877 : 243 : uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumeration()
1878 : : throw(uno::RuntimeException)
1879 : : {
1880 [ + - ]: 243 : SolarMutexGuard aGuard;
1881 : :
1882 : 243 : ESelection aSelection;
1883 [ + - ]: 243 : ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
1884 : 243 : SetSelection( aSelection );
1885 : :
1886 [ + - ][ + - ]: 243 : uno::Reference< container::XEnumeration > xEnum( (container::XEnumeration*) new SvxUnoTextContentEnumeration( *this ) );
1887 [ + - ]: 243 : return xEnum;
1888 : : }
1889 : :
1890 : : // XElementAccess ( container::XEnumerationAccess )
1891 : 4 : uno::Type SAL_CALL SvxUnoTextBase::getElementType( ) throw(uno::RuntimeException)
1892 : : {
1893 : 4 : return ::getCppuType((const uno::Reference< text::XTextRange >*)0 );
1894 : : }
1895 : :
1896 : 48 : sal_Bool SAL_CALL SvxUnoTextBase::hasElements( ) throw(uno::RuntimeException)
1897 : : {
1898 [ + - ]: 48 : SolarMutexGuard aGuard;
1899 : :
1900 [ + - ]: 48 : if(GetEditSource())
1901 : : {
1902 [ + - ]: 48 : SvxTextForwarder* pForwarder = GetEditSource()->GetTextForwarder();
1903 [ + - ]: 48 : if(pForwarder)
1904 [ + - ]: 48 : return pForwarder->GetParagraphCount() != 0;
1905 : : }
1906 : :
1907 [ + - ]: 48 : return sal_False;
1908 : : }
1909 : :
1910 : : // text::XTextRangeMover
1911 : 0 : void SAL_CALL SvxUnoTextBase::moveTextRange( const uno::Reference< text::XTextRange >&, sal_Int16 )
1912 : : throw(uno::RuntimeException)
1913 : : {
1914 : 0 : }
1915 : :
1916 : 24 : void SvxPropertyValuesToItemSet(
1917 : : SfxItemSet &rItemSet,
1918 : : const uno::Sequence< beans::PropertyValue > rPropertyVaules,
1919 : : const SfxItemPropertySet *pPropSet,
1920 : : SvxTextForwarder *pForwarder /*needed for WID_NUMLEVEL*/,
1921 : : sal_uInt16 nPara /*needed for WID_NUMLEVEL*/)
1922 : : throw(lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
1923 : : {
1924 : 24 : sal_Int32 nProps = rPropertyVaules.getLength();
1925 : 24 : const beans::PropertyValue *pProps = rPropertyVaules.getConstArray();
1926 [ + + ]: 24 : for (sal_Int32 i = 0; i < nProps; ++i)
1927 : : {
1928 : 12 : const SfxItemPropertySimpleEntry *pEntry = pPropSet->getPropertyMap().getByName( pProps[i].Name );
1929 [ - + ]: 12 : if (pEntry)
1930 : : {
1931 : : // Note: there is no need to take special care of the properties
1932 : : // TextField (EE_FEATURE_FIELD) and
1933 : : // TextPortionType (WID_PORTIONTYPE)
1934 : : // since they are read-only and thus are already taken care of below.
1935 : :
1936 [ # # ]: 0 : if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
1937 : : // should be PropertyVetoException which is not yet defined for the new import API's functions
1938 [ # # ][ # # ]: 0 : throw uno::RuntimeException( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
[ # # ]
1939 : : //throw PropertyVetoException ( OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Property is read-only: " ) ) + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
1940 : :
1941 [ # # ]: 0 : if (pEntry->nWID == WID_FONTDESC)
1942 : : {
1943 : 0 : awt::FontDescriptor aDesc;
1944 [ # # ][ # # ]: 0 : if (pProps[i].Value >>= aDesc)
1945 [ # # ]: 0 : SvxUnoFontDescriptor::FillItemSet( aDesc, rItemSet );
1946 : : }
1947 [ # # ]: 0 : else if (pEntry->nWID == WID_NUMLEVEL)
1948 : : {
1949 [ # # ]: 0 : if (pForwarder)
1950 : : {
1951 : 0 : sal_Int16 nLevel = -1;
1952 : 0 : pProps[i].Value >>= nLevel;
1953 : :
1954 : : // #101004# Call interface method instead of unsafe cast
1955 [ # # ][ # # ]: 0 : if (!pForwarder->SetDepth( nPara, nLevel ))
1956 [ # # ]: 0 : throw lang::IllegalArgumentException();
1957 : : }
1958 : : }
1959 [ # # ]: 0 : else if (pEntry->nWID == WID_NUMBERINGSTARTVALUE )
1960 : : {
1961 [ # # ]: 0 : if( pForwarder )
1962 : : {
1963 : 0 : sal_Int16 nStartValue = -1;
1964 [ # # ]: 0 : if( !(pProps[i].Value >>= nStartValue) )
1965 [ # # ]: 0 : throw lang::IllegalArgumentException();
1966 : :
1967 [ # # ]: 0 : pForwarder->SetNumberingStartValue( nPara, nStartValue );
1968 : : }
1969 : : }
1970 [ # # ]: 0 : else if (pEntry->nWID == WID_PARAISNUMBERINGRESTART )
1971 : : {
1972 [ # # ]: 0 : if( pForwarder )
1973 : : {
1974 : 0 : sal_Bool bParaIsNumberingRestart = sal_False;
1975 [ # # ]: 0 : if( !(pProps[i].Value >>= bParaIsNumberingRestart) )
1976 [ # # ]: 0 : throw lang::IllegalArgumentException();
1977 : :
1978 [ # # ]: 0 : pForwarder->SetParaIsNumberingRestart( nPara, bParaIsNumberingRestart );
1979 : : }
1980 : : }
1981 : : else
1982 : 0 : pPropSet->setPropertyValue( pProps[i].Name, pProps[i].Value, rItemSet );
1983 : : }
1984 : : else
1985 [ + - ][ + - ]: 12 : throw beans::UnknownPropertyException(OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Unknown property: " ) ) + pProps[i].Name, static_cast < cppu::OWeakObject * > ( 0 ) );
[ + - ]
1986 : : }
1987 : 12 : }
1988 : :
1989 : : // com::sun::star::text::XParagraphAppend (new import API)
1990 : 0 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendParagraph(
1991 : : const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
1992 : : throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
1993 : : {
1994 [ # # ]: 0 : SolarMutexGuard aGuard;
1995 : 0 : uno::Reference< text::XTextRange > xRet;
1996 : 0 : SvxEditSource *pEditSource = GetEditSource();
1997 [ # # ][ # # ]: 0 : SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
1998 [ # # ]: 0 : if (pTextForwarder)
1999 : : {
2000 [ # # ]: 0 : sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
2001 : : DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
2002 [ # # ]: 0 : pTextForwarder->AppendParagraph();
2003 : :
2004 : : // set properties for new appended (now last) paragraph
2005 : 0 : ESelection aSel( nParaCount, 0, nParaCount, 0 );
2006 [ # # ][ # # ]: 0 : SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
2007 : : SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
2008 : : ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(),
2009 : : pTextForwarder,
2010 [ # # ][ # # ]: 0 : nParaCount );
[ # # ][ # # ]
2011 [ # # ]: 0 : pTextForwarder->QuickSetAttribs( aItemSet, aSel );
2012 [ # # ]: 0 : pEditSource->UpdateData();
2013 : 0 : SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
2014 [ # # ][ # # ]: 0 : xRet = pRange;
2015 [ # # ]: 0 : pRange->SetSelection( aSel );
2016 : : }
2017 [ # # ]: 0 : return xRet;
2018 : : }
2019 : :
2020 : 12 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::finishParagraph(
2021 : : const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
2022 : : throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
2023 : : {
2024 [ + - ]: 12 : SolarMutexGuard aGuard;
2025 : :
2026 : 12 : uno::Reference< text::XTextRange > xRet;
2027 : 12 : SvxEditSource *pEditSource = GetEditSource();
2028 [ + - ][ + - ]: 12 : SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
2029 [ + - ]: 12 : if (pTextForwarder)
2030 : : {
2031 [ + - ]: 12 : sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
2032 : : DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
2033 [ + - ]: 12 : pTextForwarder->AppendParagraph();
2034 : :
2035 : : // set properties for the previously last paragraph
2036 : 12 : sal_uInt16 nPara = nParaCount - 1;
2037 : 12 : ESelection aSel( nPara, 0, nPara, 0 );
2038 [ + - ][ + - ]: 12 : SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
2039 : : SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
2040 [ + - ][ + - ]: 12 : ImplGetSvxUnoOutlinerTextCursorSfxPropertySet(), pTextForwarder, nPara );
[ - + ][ # # ]
2041 [ # # ]: 0 : pTextForwarder->QuickSetAttribs( aItemSet, aSel );
2042 [ # # ]: 0 : pEditSource->UpdateData();
2043 : 0 : SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
2044 [ # # ][ # # ]: 0 : xRet = pRange;
2045 [ # # ]: 12 : pRange->SetSelection( aSel );
2046 : : }
2047 [ # # ]: 12 : return xRet;
2048 : : }
2049 : :
2050 : : // com::sun::star::text::XTextPortionAppend (new import API)
2051 : 12 : uno::Reference< text::XTextRange > SAL_CALL SvxUnoTextBase::appendTextPortion(
2052 : : const ::rtl::OUString& rText,
2053 : : const uno::Sequence< beans::PropertyValue >& rCharAndParaProps )
2054 : : throw (lang::IllegalArgumentException, beans::UnknownPropertyException, uno::RuntimeException)
2055 : : {
2056 [ + - ]: 12 : SolarMutexGuard aGuard;
2057 : :
2058 : 12 : SvxEditSource *pEditSource = GetEditSource();
2059 [ + - ][ + - ]: 12 : SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
2060 : 12 : uno::Reference< text::XTextRange > xRet;
2061 [ + - ]: 12 : if (pTextForwarder)
2062 : : {
2063 [ + - ]: 12 : sal_uInt16 nParaCount = pTextForwarder->GetParagraphCount();
2064 : : DBG_ASSERT( nParaCount > 0, "paragraph count is 0 or negative" );
2065 : 12 : sal_uInt16 nPara = nParaCount - 1;
2066 [ + - ]: 12 : SfxItemSet aSet( pTextForwarder->GetParaAttribs( nPara ) );
2067 [ + - ][ + - ]: 12 : xub_StrLen nStart = pTextForwarder->AppendTextPortion( nPara, rText, aSet );
[ + - ]
2068 [ + - ]: 12 : pEditSource->UpdateData();
2069 [ + - ]: 12 : xub_StrLen nEnd = pTextForwarder->GetTextLen( nPara );
2070 : :
2071 : : // set properties for the new text portion
2072 : 12 : ESelection aSel( nPara, nStart, nPara, nEnd );
2073 [ + - ]: 12 : pTextForwarder->RemoveAttribs( aSel, sal_False, 0 );
2074 [ + - ]: 12 : pEditSource->UpdateData();
2075 : :
2076 [ + - ][ + - ]: 12 : SfxItemSet aItemSet( *pTextForwarder->GetEmptyItemSetPtr() );
2077 : : SvxPropertyValuesToItemSet( aItemSet, rCharAndParaProps,
2078 [ + - ][ + - ]: 12 : ImplGetSvxTextPortionSfxPropertySet(), pTextForwarder, nPara );
[ + - ][ + - ]
2079 [ + - ]: 12 : pTextForwarder->QuickSetAttribs( aItemSet, aSel );
2080 : 12 : SvxUnoTextRange* pRange = new SvxUnoTextRange( *this );
2081 [ + - ][ + - ]: 12 : xRet = pRange;
2082 : 12 : pRange->SetSelection( aSel );
2083 : 12 : const beans::PropertyValue* pProps = rCharAndParaProps.getConstArray();
2084 [ - + ]: 12 : for( sal_Int32 nProp = 0; nProp < rCharAndParaProps.getLength(); ++nProp )
2085 [ # # ][ + - ]: 12 : pRange->setPropertyValue( pProps[nProp].Name, pProps[nProp].Value );
[ + - ]
2086 : : }
2087 [ + - ]: 12 : return xRet;
2088 : : }
2089 : :
2090 : 0 : void SvxUnoTextBase::copyText(
2091 : : const uno::Reference< text::XTextCopy >& xSource ) throw ( uno::RuntimeException )
2092 : : {
2093 [ # # ]: 0 : SolarMutexGuard aGuard;
2094 [ # # ]: 0 : uno::Reference< lang::XUnoTunnel > xUT( xSource, uno::UNO_QUERY );
2095 : 0 : SvxEditSource *pEditSource = GetEditSource();
2096 [ # # ][ # # ]: 0 : SvxTextForwarder *pTextForwarder = pEditSource ? pEditSource->GetTextForwarder() : 0;
2097 [ # # ]: 0 : if( !pTextForwarder )
2098 : 0 : return;
2099 [ # # ]: 0 : if( xUT.is() )
2100 : : {
2101 : : SvxUnoTextBase* pSource = reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(
2102 [ # # ][ # # ]: 0 : xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
2103 : 0 : SvxEditSource *pSourceEditSource = pSource->GetEditSource();
2104 [ # # ][ # # ]: 0 : SvxTextForwarder *pSourceTextForwarder = pSourceEditSource ? pSourceEditSource->GetTextForwarder() : 0;
2105 [ # # ]: 0 : if( pSourceTextForwarder )
2106 : : {
2107 [ # # ]: 0 : pTextForwarder->CopyText( *pSourceTextForwarder );
2108 [ # # ]: 0 : pEditSource->UpdateData();
2109 : : }
2110 : : }
2111 : : else
2112 : : {
2113 [ # # ]: 0 : uno::Reference< text::XText > xSourceText( xSource, uno::UNO_QUERY );
2114 [ # # ]: 0 : if( xSourceText.is() )
2115 : : {
2116 [ # # ][ # # ]: 0 : setString( xSourceText->getString() );
[ # # ]
2117 : 0 : }
2118 [ # # ][ # # ]: 0 : }
[ # # ]
2119 : : }
2120 : :
2121 : : // lang::XServiceInfo
2122 : 0 : OUString SAL_CALL SvxUnoTextBase::getImplementationName()
2123 : : throw(uno::RuntimeException)
2124 : : {
2125 : 0 : return OUString(RTL_CONSTASCII_USTRINGPARAM("SvxUnoTextBase"));
2126 : : }
2127 : :
2128 : 107 : uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames( )
2129 : : throw(uno::RuntimeException)
2130 : : {
2131 : 107 : return getSupportedServiceNames_Static();
2132 : : }
2133 : :
2134 : 107 : uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Static( )
2135 : : SAL_THROW(())
2136 : : {
2137 : 107 : uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames_Static() );
2138 : 107 : comphelper::ServiceInfoHelper::addToSequence( aSeq, 1, "com.sun.star.text.Text" );
2139 : 107 : return aSeq;
2140 : : }
2141 : :
2142 : : namespace
2143 : : {
2144 : : class theSvxUnoTextBaseUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextBaseUnoTunnelId > {};
2145 : : }
2146 : :
2147 : 2816 : const uno::Sequence< sal_Int8 > & SvxUnoTextBase::getUnoTunnelId() throw()
2148 : : {
2149 : 2816 : return theSvxUnoTextBaseUnoTunnelId::get().getSeq();
2150 : : }
2151 : :
2152 : 893 : SvxUnoTextBase* SvxUnoTextBase::getImplementation( const uno::Reference< uno::XInterface >& xInt )
2153 : : {
2154 [ + - ]: 893 : uno::Reference< lang::XUnoTunnel > xUT( xInt, uno::UNO_QUERY );
2155 [ + - ]: 893 : if( xUT.is() )
2156 [ + - ][ + - ]: 893 : return reinterpret_cast<SvxUnoTextBase*>(sal::static_int_cast<sal_uIntPtr>(xUT->getSomething( SvxUnoTextBase::getUnoTunnelId())));
2157 : : else
2158 : 893 : return NULL;
2159 : : }
2160 : :
2161 : 1923 : sal_Int64 SAL_CALL SvxUnoTextBase::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \
2162 : : {
2163 [ + - + + ]: 5769 : if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
[ + + ]
2164 : 3846 : rId.getConstArray(), 16 ) )
2165 : : {
2166 : 866 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
2167 : : }
2168 : : else
2169 : : {
2170 : 1923 : return SvxUnoTextRangeBase::getSomething( rId );
2171 : : }
2172 : : }
2173 : :
2174 : : // --------------------------------------------------------------------
2175 : :
2176 : 0 : SvxUnoText::SvxUnoText( ) throw()
2177 : : {
2178 : 0 : }
2179 : :
2180 : 204 : SvxUnoText::SvxUnoText( const SvxItemPropertySet* _pSet ) throw()
2181 : 204 : : SvxUnoTextBase( _pSet )
2182 : : {
2183 : 204 : }
2184 : :
2185 : 973 : SvxUnoText::SvxUnoText( const SvxEditSource* pSource, const SvxItemPropertySet* _pSet, uno::Reference < text::XText > xParent ) throw()
2186 : 973 : : SvxUnoTextBase( pSource, _pSet, xParent )
2187 : : {
2188 : 973 : }
2189 : :
2190 : 0 : SvxUnoText::SvxUnoText( const SvxUnoText& rText ) throw()
2191 : 0 : : SvxUnoTextBase( rText )
2192 : : {
2193 : 0 : }
2194 : :
2195 : 1158 : SvxUnoText::~SvxUnoText() throw()
2196 : : {
2197 [ - + ]: 2089 : }
2198 : :
2199 : : namespace
2200 : : {
2201 : : class theSvxUnoTextUnoTunnelId : public rtl::Static< UnoTunnelIdInit, theSvxUnoTextUnoTunnelId > {};
2202 : : }
2203 : :
2204 : 27 : const uno::Sequence< sal_Int8 > & SvxUnoText::getUnoTunnelId() throw()
2205 : : {
2206 : 27 : return theSvxUnoTextUnoTunnelId::get().getSeq();
2207 : : }
2208 : :
2209 : 27 : sal_Int64 SAL_CALL SvxUnoText::getSomething( const uno::Sequence< sal_Int8 >& rId ) throw(uno::RuntimeException) \
2210 : : {
2211 [ + - - + ]: 81 : if( rId.getLength() == 16 && 0 == rtl_compareMemory( getUnoTunnelId().getConstArray(),
[ - + ]
2212 : 54 : rId.getConstArray(), 16 ) )
2213 : : {
2214 : 0 : return sal::static_int_cast<sal_Int64>(reinterpret_cast<sal_uIntPtr>(this));
2215 : : }
2216 : : else
2217 : : {
2218 : 27 : return SvxUnoTextBase::getSomething( rId );
2219 : : }
2220 : : }
2221 : :
2222 : :
2223 : : // --------------------------------------------------------------------
2224 : :
2225 [ # # ]: 0 : SvxDummyTextSource::~SvxDummyTextSource()
2226 : : {
2227 [ # # ]: 0 : };
2228 : :
2229 : 0 : SvxEditSource* SvxDummyTextSource::Clone() const
2230 : : {
2231 [ # # ]: 0 : return new SvxDummyTextSource();
2232 : : }
2233 : :
2234 : 0 : SvxTextForwarder* SvxDummyTextSource::GetTextForwarder()
2235 : : {
2236 : 0 : return this;
2237 : : }
2238 : :
2239 : 0 : void SvxDummyTextSource::UpdateData()
2240 : : {
2241 : 0 : }
2242 : :
2243 : 0 : sal_uInt16 SvxDummyTextSource::GetParagraphCount() const
2244 : : {
2245 : 0 : return 0;
2246 : : }
2247 : :
2248 : 0 : sal_uInt16 SvxDummyTextSource::GetTextLen( sal_uInt16 ) const
2249 : : {
2250 : 0 : return 0;
2251 : : }
2252 : :
2253 : 0 : String SvxDummyTextSource::GetText( const ESelection& ) const
2254 : : {
2255 : 0 : return String();
2256 : : }
2257 : :
2258 : 0 : SfxItemSet SvxDummyTextSource::GetAttribs( const ESelection&, sal_Bool ) const
2259 : : {
2260 : : // Very dangerous: The former implementation used a SfxItemPool created on the
2261 : : // fly which of course was deleted again ASAP. Thus, the returned SfxItemSet was using
2262 : : // a deleted Pool by design.
2263 : 0 : return SfxItemSet(EditEngine::GetGlobalItemPool());
2264 : : }
2265 : :
2266 : 0 : SfxItemSet SvxDummyTextSource::GetParaAttribs( sal_uInt16 ) const
2267 : : {
2268 [ # # ]: 0 : return GetAttribs(ESelection());
2269 : : }
2270 : :
2271 : 0 : void SvxDummyTextSource::SetParaAttribs( sal_uInt16, const SfxItemSet& )
2272 : : {
2273 : 0 : }
2274 : :
2275 : 0 : void SvxDummyTextSource::RemoveAttribs( const ESelection& , sal_Bool , sal_uInt16 )
2276 : : {
2277 : 0 : }
2278 : :
2279 : 0 : void SvxDummyTextSource::GetPortions( sal_uInt16, std::vector<sal_uInt16>& ) const
2280 : : {
2281 : 0 : }
2282 : :
2283 : 0 : sal_uInt16 SvxDummyTextSource::GetItemState( const ESelection&, sal_uInt16 ) const
2284 : : {
2285 : 0 : return 0;
2286 : : }
2287 : :
2288 : 0 : sal_uInt16 SvxDummyTextSource::GetItemState( sal_uInt16, sal_uInt16 ) const
2289 : : {
2290 : 0 : return 0;
2291 : : }
2292 : :
2293 : 0 : SfxItemPool* SvxDummyTextSource::GetPool() const
2294 : : {
2295 : 0 : return NULL;
2296 : : }
2297 : :
2298 : 0 : void SvxDummyTextSource::QuickInsertText( const String&, const ESelection& )
2299 : : {
2300 : 0 : }
2301 : :
2302 : 0 : void SvxDummyTextSource::QuickInsertField( const SvxFieldItem&, const ESelection& )
2303 : : {
2304 : 0 : }
2305 : :
2306 : 0 : void SvxDummyTextSource::QuickSetAttribs( const SfxItemSet&, const ESelection& )
2307 : : {
2308 : 0 : }
2309 : :
2310 : 0 : void SvxDummyTextSource::QuickInsertLineBreak( const ESelection& )
2311 : : {
2312 : 0 : };
2313 : :
2314 : 0 : XubString SvxDummyTextSource::CalcFieldValue( const SvxFieldItem&, sal_uInt16, sal_uInt16, Color*&, Color*& )
2315 : : {
2316 : 0 : return XubString();
2317 : : }
2318 : :
2319 : 0 : void SvxDummyTextSource::FieldClicked( const SvxFieldItem&, sal_uInt16, xub_StrLen )
2320 : : {
2321 : 0 : }
2322 : :
2323 : 0 : sal_Bool SvxDummyTextSource::IsValid() const
2324 : : {
2325 : 0 : return sal_False;
2326 : : }
2327 : :
2328 : 0 : void SvxDummyTextSource::SetNotifyHdl( const Link& )
2329 : : {
2330 : 0 : }
2331 : :
2332 : 0 : LanguageType SvxDummyTextSource::GetLanguage( sal_uInt16, sal_uInt16 ) const
2333 : : {
2334 : 0 : return LANGUAGE_DONTKNOW;
2335 : : }
2336 : :
2337 : 0 : sal_uInt16 SvxDummyTextSource::GetFieldCount( sal_uInt16 ) const
2338 : : {
2339 : 0 : return 0;
2340 : : }
2341 : :
2342 : 0 : EFieldInfo SvxDummyTextSource::GetFieldInfo( sal_uInt16, sal_uInt16 ) const
2343 : : {
2344 : 0 : return EFieldInfo();
2345 : : }
2346 : :
2347 : 0 : EBulletInfo SvxDummyTextSource::GetBulletInfo( sal_uInt16 ) const
2348 : : {
2349 : 0 : return EBulletInfo();
2350 : : }
2351 : :
2352 : 0 : Rectangle SvxDummyTextSource::GetCharBounds( sal_uInt16, sal_uInt16 ) const
2353 : : {
2354 : 0 : return Rectangle();
2355 : : }
2356 : :
2357 : 0 : Rectangle SvxDummyTextSource::GetParaBounds( sal_uInt16 ) const
2358 : : {
2359 : 0 : return Rectangle();
2360 : : }
2361 : :
2362 : 0 : MapMode SvxDummyTextSource::GetMapMode() const
2363 : : {
2364 : 0 : return MapMode();
2365 : : }
2366 : :
2367 : 0 : OutputDevice* SvxDummyTextSource::GetRefDevice() const
2368 : : {
2369 : 0 : return NULL;
2370 : : }
2371 : :
2372 : 0 : sal_Bool SvxDummyTextSource::GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const
2373 : : {
2374 : 0 : return sal_False;
2375 : : }
2376 : :
2377 : 0 : sal_Bool SvxDummyTextSource::GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const
2378 : : {
2379 : 0 : return sal_False;
2380 : : }
2381 : :
2382 : 0 : sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const
2383 : : {
2384 : 0 : return sal_False;
2385 : : }
2386 : :
2387 : 0 : sal_uInt16 SvxDummyTextSource::GetLineCount( sal_uInt16 ) const
2388 : : {
2389 : 0 : return 0;
2390 : : }
2391 : :
2392 : 0 : sal_uInt16 SvxDummyTextSource::GetLineLen( sal_uInt16, sal_uInt16 ) const
2393 : : {
2394 : 0 : return 0;
2395 : : }
2396 : :
2397 : 0 : void SvxDummyTextSource::GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const
2398 : : {
2399 : 0 : rStart = rEnd = 0;
2400 : 0 : }
2401 : :
2402 : 0 : sal_uInt16 SvxDummyTextSource::GetLineNumberAtIndex( sal_uInt16 /*nPara*/, sal_uInt16 /*nIndex*/ ) const
2403 : : {
2404 : 0 : return 0;
2405 : : }
2406 : :
2407 : 0 : sal_Bool SvxDummyTextSource::QuickFormatDoc( sal_Bool )
2408 : : {
2409 : 0 : return sal_False;
2410 : : }
2411 : :
2412 : 0 : sal_Int16 SvxDummyTextSource::GetDepth( sal_uInt16 ) const
2413 : : {
2414 : 0 : return -1;
2415 : : }
2416 : :
2417 : 0 : sal_Bool SvxDummyTextSource::SetDepth( sal_uInt16, sal_Int16 nNewDepth )
2418 : : {
2419 [ # # ]: 0 : return nNewDepth == 0 ? sal_True : sal_False;
2420 : : }
2421 : :
2422 : 0 : sal_Bool SvxDummyTextSource::Delete( const ESelection& )
2423 : : {
2424 : 0 : return sal_False;
2425 : : }
2426 : :
2427 : 0 : sal_Bool SvxDummyTextSource::InsertText( const String&, const ESelection& )
2428 : : {
2429 : 0 : return sal_False;
2430 : : }
2431 : :
2432 : 0 : const SfxItemSet * SvxDummyTextSource::GetEmptyItemSetPtr()
2433 : : {
2434 : 0 : return 0;
2435 : : }
2436 : :
2437 : 0 : void SvxDummyTextSource::AppendParagraph()
2438 : : {
2439 : 0 : }
2440 : :
2441 : 0 : xub_StrLen SvxDummyTextSource::AppendTextPortion( sal_uInt16, const String &, const SfxItemSet & )
2442 : : {
2443 : 0 : return 0;
2444 : : }
2445 : :
2446 : 0 : void SvxDummyTextSource::CopyText(const SvxTextForwarder& )
2447 : : {
2448 : 0 : }
2449 : :
2450 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|