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 <svl/smplhint.hxx>
30 : :
31 : :
32 : : #include "rangelst.hxx"
33 : : #include <editeng/unotext.hxx>
34 : : #include <svx/svdpool.hxx>
35 : : #include <svx/svdobj.hxx>
36 : : #include <vcl/svapp.hxx>
37 : : #include "notesuno.hxx"
38 : : #include "textuno.hxx"
39 : : #include "cellsuno.hxx" // getParent
40 : : #include "docsh.hxx"
41 : : #include "docfunc.hxx"
42 : : #include "hints.hxx"
43 : : #include "editsrc.hxx"
44 : : #include "miscuno.hxx"
45 : : #include "fielduno.hxx"
46 : :
47 : : // setVisible:
48 : : #include <svx/svdundo.hxx>
49 : : #include "drwlayer.hxx"
50 : : #include "detfunc.hxx"
51 : : #include "undocell.hxx"
52 : : #include "userdat.hxx"
53 : : #include <editeng/outlobj.hxx>
54 : : #include "editeng/unofield.hxx"
55 : : #include <svx/unoshape.hxx>
56 : : #include <svx/svdocapt.hxx>
57 : : #include <svx/svditer.hxx>
58 : : #include <svx/svdpage.hxx>
59 : : #include <com/sun/star/drawing/XShapeDescriptor.hpp>
60 : : #include <editeng/unoprnms.hxx>
61 : :
62 : : using namespace com::sun::star;
63 : :
64 : : //------------------------------------------------------------------------
65 : :
66 : 10 : const SvxItemPropertySet* lcl_GetAnnotationPropertySet()
67 : : {
68 : : static SfxItemPropertyMapEntry aAnnotationPropertyMap_Impl[] =
69 : : {
70 [ + - ][ + - ]: 6 : SVX_UNOEDIT_CHAR_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
71 [ + - ]: 6 : SVX_UNOEDIT_FONT_PROPERTIES,
72 [ + - ][ + - ]: 6 : SVX_UNOEDIT_PARA_PROPERTIES,
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
73 [ + - ][ + - ]: 6 : SVX_UNOEDIT_NUMBERING_PROPERTIE, // for completeness of service ParagraphProperties
74 : : {0,0,0,0,0,0}
75 [ + + ][ + - ]: 16 : };
[ # # ]
76 [ + + ][ + - ]: 10 : static SvxItemPropertySet aAnnotationPropertySet_Impl( aAnnotationPropertyMap_Impl, SdrObject::GetGlobalDrawObjectItemPool() );
[ + - ][ + - ]
[ # # ]
77 : 10 : return &aAnnotationPropertySet_Impl;
78 : : }
79 : :
80 : : //------------------------------------------------------------------------
81 : :
82 [ # # ]: 0 : SC_SIMPLE_SERVICE_INFO( ScAnnotationObj, "ScAnnotationObj", "com.sun.star.sheet.CellAnnotation" )
83 [ # # ]: 4 : SC_SIMPLE_SERVICE_INFO( ScAnnotationShapeObj, "ScAnnotationShapeObj", "com.sun.star.sheet.CellAnnotationShape" )
84 : :
85 : : //------------------------------------------------------------------------
86 : :
87 : 8 : ScAnnotationObj::ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos) :
88 : : pDocShell( pDocSh ),
89 : : aCellPos( rPos ),
90 [ + - ]: 8 : pUnoText( NULL )
91 : : {
92 [ + - ]: 8 : pDocShell->GetDocument()->AddUnoObject(*this);
93 : :
94 : : // pUnoText is allocated on demand (GetUnoText)
95 : : // can't be aggregated because getString/setString is handled here
96 : 8 : }
97 : :
98 [ + - ]: 8 : ScAnnotationObj::~ScAnnotationObj()
99 : : {
100 [ + + ]: 8 : if (pDocShell)
101 [ + - ]: 5 : pDocShell->GetDocument()->RemoveUnoObject(*this);
102 : :
103 [ + + ]: 8 : if (pUnoText)
104 : 4 : pUnoText->release();
105 [ - + ]: 16 : }
106 : :
107 : 14 : void ScAnnotationObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
108 : : {
109 [ + - ]: 14 : if ( rHint.ISA( ScUpdateRefHint ) )
110 : : {
111 : : // const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
112 : :
113 : : //! Ref-Update
114 : : }
115 [ + - + + ]: 28 : else if ( rHint.ISA( SfxSimpleHint ) &&
[ + + ]
116 : 14 : ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
117 : : {
118 : 3 : pDocShell = NULL; // ungueltig geworden
119 : : }
120 : 14 : }
121 : :
122 : :
123 : : // XChild
124 : :
125 : 1 : uno::Reference<uno::XInterface> SAL_CALL ScAnnotationObj::getParent() throw(uno::RuntimeException)
126 : : {
127 [ + - ]: 1 : SolarMutexGuard aGuard;
128 : :
129 : : // Parent der Notiz ist die zugehoerige Zelle
130 : : //! existierendes Objekt finden und zurueckgeben ???
131 : :
132 [ + - ]: 1 : if (pDocShell)
133 [ + - ][ + - ]: 1 : return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
[ + - ]
134 : :
135 [ # # ][ + - ]: 1 : return NULL;
136 : : }
137 : :
138 : 1 : void SAL_CALL ScAnnotationObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
139 : : throw(lang::NoSupportException, uno::RuntimeException)
140 : : {
141 : : // hamma nich
142 : : //! Exception oder so ??!
143 : 1 : }
144 : :
145 : : // XSimpleText
146 : :
147 : 0 : uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationObj::createTextCursor()
148 : : throw(uno::RuntimeException)
149 : : {
150 [ # # ]: 0 : SolarMutexGuard aGuard;
151 : : // Notizen brauchen keine Extrawurst
152 [ # # ][ # # ]: 0 : return GetUnoText().createTextCursor();
[ # # ]
153 : : }
154 : :
155 : 0 : uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationObj::createTextCursorByRange(
156 : : const uno::Reference<text::XTextRange>& aTextPosition )
157 : : throw(uno::RuntimeException)
158 : : {
159 [ # # ]: 0 : SolarMutexGuard aGuard;
160 : : // Notizen brauchen keine Extrawurst
161 [ # # ][ # # ]: 0 : return GetUnoText().createTextCursorByRange(aTextPosition);
[ # # ]
162 : : }
163 : :
164 : 0 : rtl::OUString SAL_CALL ScAnnotationObj::getString() throw(uno::RuntimeException)
165 : : {
166 [ # # ]: 0 : SolarMutexGuard aGuard;
167 [ # # ][ # # ]: 0 : return GetUnoText().getString();
[ # # ]
168 : : }
169 : :
170 : 4 : void SAL_CALL ScAnnotationObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
171 : : {
172 [ + - ]: 4 : SolarMutexGuard aGuard;
173 [ + - ][ + - ]: 4 : GetUnoText().setString(aText);
[ + - ]
174 : 4 : }
175 : :
176 : 0 : void SAL_CALL ScAnnotationObj::insertString( const uno::Reference<text::XTextRange>& xRange,
177 : : const rtl::OUString& aString, sal_Bool bAbsorb )
178 : : throw(uno::RuntimeException)
179 : : {
180 [ # # ]: 0 : SolarMutexGuard aGuard;
181 [ # # ][ # # ]: 0 : GetUnoText().insertString( xRange, aString, bAbsorb );
[ # # ]
182 : 0 : }
183 : :
184 : 0 : void SAL_CALL ScAnnotationObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
185 : : sal_Int16 nControlCharacter, sal_Bool bAbsorb )
186 : : throw(lang::IllegalArgumentException, uno::RuntimeException)
187 : : {
188 [ # # ]: 0 : SolarMutexGuard aGuard;
189 [ # # ][ # # ]: 0 : GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
[ # # ]
190 : 0 : }
191 : :
192 : 0 : uno::Reference<text::XText> SAL_CALL ScAnnotationObj::getText() throw(uno::RuntimeException)
193 : : {
194 [ # # ]: 0 : SolarMutexGuard aGuard;
195 [ # # ][ # # ]: 0 : return GetUnoText().getText();
[ # # ]
196 : : }
197 : :
198 : 0 : uno::Reference<text::XTextRange> SAL_CALL ScAnnotationObj::getStart() throw(uno::RuntimeException)
199 : : {
200 [ # # ]: 0 : SolarMutexGuard aGuard;
201 [ # # ][ # # ]: 0 : return GetUnoText().getStart();
[ # # ]
202 : : }
203 : :
204 : 0 : uno::Reference<text::XTextRange> SAL_CALL ScAnnotationObj::getEnd() throw(uno::RuntimeException)
205 : : {
206 [ # # ]: 0 : SolarMutexGuard aGuard;
207 [ # # ][ # # ]: 0 : return GetUnoText().getEnd();
[ # # ]
208 : : }
209 : :
210 : : // XSheetAnnotation
211 : :
212 : 0 : table::CellAddress SAL_CALL ScAnnotationObj::getPosition() throw(uno::RuntimeException)
213 : : {
214 [ # # ]: 0 : SolarMutexGuard aGuard;
215 : 0 : table::CellAddress aAdr;
216 : 0 : aAdr.Sheet = aCellPos.Tab();
217 : 0 : aAdr.Column = aCellPos.Col();
218 : 0 : aAdr.Row = aCellPos.Row();
219 [ # # ]: 0 : return aAdr;
220 : : }
221 : :
222 : 0 : rtl::OUString SAL_CALL ScAnnotationObj::getAuthor() throw(uno::RuntimeException)
223 : : {
224 [ # # ]: 0 : SolarMutexGuard aGuard;
225 [ # # ]: 0 : const ScPostIt* pNote = ImplGetNote();
226 [ # # ][ # # ]: 0 : return pNote ? pNote->GetAuthor() : rtl::OUString();
227 : : }
228 : :
229 : 0 : rtl::OUString SAL_CALL ScAnnotationObj::getDate() throw(uno::RuntimeException)
230 : : {
231 [ # # ]: 0 : SolarMutexGuard aGuard;
232 [ # # ]: 0 : const ScPostIt* pNote = ImplGetNote();
233 [ # # ][ # # ]: 0 : return pNote ? pNote->GetDate() : rtl::OUString();
234 : : }
235 : :
236 : 0 : sal_Bool SAL_CALL ScAnnotationObj::getIsVisible() throw(uno::RuntimeException)
237 : : {
238 [ # # ]: 0 : SolarMutexGuard aGuard;
239 [ # # ]: 0 : const ScPostIt* pNote = ImplGetNote();
240 [ # # ][ # # ]: 0 : return pNote && pNote->IsCaptionShown();
[ # # ]
241 : : }
242 : :
243 : 3 : void SAL_CALL ScAnnotationObj::setIsVisible( sal_Bool bIsVisible ) throw(uno::RuntimeException)
244 : : {
245 [ + - ]: 3 : SolarMutexGuard aGuard;
246 : : // show/hide note with undo action
247 [ + - ]: 3 : if( pDocShell )
248 [ + - ][ + - ]: 3 : pDocShell->GetDocFunc().ShowNote( aCellPos, bIsVisible );
249 : 3 : }
250 : :
251 : : // XSheetAnnotationShapeSupplier
252 : 7 : uno::Reference < drawing::XShape > SAL_CALL ScAnnotationObj::getAnnotationShape()
253 : : throw(::com::sun::star::uno::RuntimeException)
254 : : {
255 [ + - ]: 7 : SolarMutexGuard aGuard;
256 [ + - ][ + - ]: 7 : return new ScAnnotationShapeObj(pDocShell, aCellPos);
[ + - ][ + - ]
257 : : }
258 : :
259 : 4 : SvxUnoText& ScAnnotationObj::GetUnoText()
260 : : {
261 [ + - ]: 4 : if (!pUnoText)
262 : : {
263 [ + - ]: 4 : ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
264 : : pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
265 [ + - ]: 4 : uno::Reference<text::XText>() );
266 [ + - ]: 4 : pUnoText->acquire();
267 : : }
268 : 4 : return *pUnoText;
269 : : }
270 : :
271 : 0 : const ScPostIt* ScAnnotationObj::ImplGetNote() const
272 : : {
273 [ # # ]: 0 : return pDocShell ? pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) : 0;
274 : : }
275 : : //------------------------------------------------------------------------
276 : :
277 : 7 : ScAnnotationShapeObj::ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos) :
278 : : pDocShell( pDocSh ),
279 : : aCellPos( rPos ),
280 [ + - ]: 7 : pUnoText( NULL )
281 : : {
282 [ + - ]: 7 : pDocShell->GetDocument()->AddUnoObject(*this);
283 : :
284 : : // pUnoText is allocated on demand (GetUnoText)
285 : : // can't be aggregated because getString/setString is handled here
286 : 7 : }
287 : :
288 : 13 : SvxUnoText& ScAnnotationShapeObj::GetUnoText()
289 : : {
290 [ + + ]: 13 : if (!pUnoText)
291 : : {
292 [ + - ]: 6 : ScAnnotationEditSource aEditSource( pDocShell, aCellPos );
293 : : pUnoText = new SvxUnoText( &aEditSource, lcl_GetAnnotationPropertySet(),
294 [ + - ]: 6 : uno::Reference<text::XText>() );
295 [ + - ]: 6 : pUnoText->acquire();
296 : : }
297 : 13 : return *pUnoText;
298 : : }
299 : :
300 : 33 : uno::Reference < drawing::XShape > ScAnnotationShapeObj::GetXShape()
301 : : {
302 [ + + ]: 33 : if (!xShape.is())
303 [ + - ]: 3 : if( ScPostIt* pNote = pDocShell->GetDocument()->GetNotes( aCellPos.Tab() )->findByAddress(aCellPos) )
304 [ + - ]: 3 : if( SdrObject* pCaption = pNote->GetOrCreateCaption( aCellPos ) )
305 [ + - ]: 3 : xShape.set( pCaption->getUnoShape(), uno::UNO_QUERY );
306 : 33 : return xShape;
307 : : }
308 : :
309 [ + - ]: 7 : ScAnnotationShapeObj::~ScAnnotationShapeObj()
310 : : {
311 [ + + ]: 7 : if (pDocShell)
312 [ + - ]: 5 : pDocShell->GetDocument()->RemoveUnoObject(*this);
313 [ + + ]: 7 : if (pUnoText)
314 : 6 : pUnoText->release();
315 [ - + ]: 14 : }
316 : :
317 : 8 : void ScAnnotationShapeObj::Notify( SfxBroadcaster&, const SfxHint& rHint )
318 : : {
319 [ + - ]: 8 : if ( rHint.ISA( ScUpdateRefHint ) )
320 : : {
321 : : // const ScUpdateRefHint& rRef = (const ScUpdateRefHint&)rHint;
322 : :
323 : : //! Ref-Update
324 : : }
325 [ + - + + ]: 16 : else if ( rHint.ISA( SfxSimpleHint ) &&
[ + + ]
326 : 8 : ((const SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING )
327 : : {
328 : 2 : pDocShell = NULL; // ungueltig geworden
329 : : }
330 : 8 : }
331 : :
332 : :
333 : : // XChild
334 : :
335 : 0 : uno::Reference<uno::XInterface> SAL_CALL ScAnnotationShapeObj::getParent() throw(uno::RuntimeException)
336 : : {
337 [ # # ]: 0 : SolarMutexGuard aGuard;
338 : :
339 : : // Parent der Notiz ist die zugehoerige Zelle
340 : : //! existierendes Objekt finden und zurueckgeben ???
341 : :
342 [ # # ]: 0 : if (pDocShell)
343 [ # # ][ # # ]: 0 : return (cppu::OWeakObject*)new ScCellObj( pDocShell, aCellPos );
[ # # ]
344 : :
345 [ # # ][ # # ]: 0 : return NULL;
346 : : }
347 : :
348 : 0 : void SAL_CALL ScAnnotationShapeObj::setParent( const uno::Reference<uno::XInterface>& /* Parent */ )
349 : : throw(lang::NoSupportException, uno::RuntimeException)
350 : : {
351 : : // hamma nich
352 : : //! Exception oder so ??!
353 : 0 : }
354 : :
355 : : // XElementAccess
356 : 0 : uno::Type SAL_CALL ScAnnotationShapeObj::getElementType( ) throw (uno::RuntimeException)
357 : : {
358 [ # # ]: 0 : SolarMutexGuard aGuard;
359 : :
360 [ # # ][ # # ]: 0 : return GetUnoText().getElementType();
[ # # ]
361 : : }
362 : :
363 : 0 : sal_Bool SAL_CALL ScAnnotationShapeObj::hasElements( ) throw (uno::RuntimeException)
364 : : {
365 [ # # ]: 0 : SolarMutexGuard aGuard;
366 : :
367 [ # # ][ # # ]: 0 : return GetUnoText().hasElements();
[ # # ]
368 : : }
369 : :
370 : : // XEnumerationAccess
371 : 0 : uno::Reference< container::XEnumeration > SAL_CALL ScAnnotationShapeObj::createEnumeration( ) throw (uno::RuntimeException)
372 : : {
373 [ # # ]: 0 : SolarMutexGuard aGuard;
374 : :
375 [ # # ][ # # ]: 0 : return GetUnoText().createEnumeration();
[ # # ]
376 : : }
377 : :
378 : : // XTextRangeMover
379 : 0 : void SAL_CALL ScAnnotationShapeObj::moveTextRange( const uno::Reference< text::XTextRange >& xRange, sal_Int16 nParagraphs )
380 : : throw (uno::RuntimeException)
381 : : {
382 [ # # ]: 0 : SolarMutexGuard aGuard;
383 : :
384 [ # # ][ # # ]: 0 : GetUnoText().moveTextRange( xRange, nParagraphs );
[ # # ]
385 : 0 : }
386 : :
387 : : // XText
388 : 4 : void SAL_CALL ScAnnotationShapeObj::insertTextContent( const uno::Reference< text::XTextRange >& xRange,
389 : : const uno::Reference< text::XTextContent >& xContent, sal_Bool bAbsorb )
390 : : throw (lang::IllegalArgumentException,
391 : : uno::RuntimeException)
392 : : {
393 [ + - ]: 4 : SolarMutexGuard aGuard;
394 [ + - ][ + + ]: 4 : GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
[ + - ]
395 : 3 : }
396 : :
397 : 3 : void SAL_CALL ScAnnotationShapeObj::removeTextContent( const uno::Reference< text::XTextContent >& xContent )
398 : : throw (container::NoSuchElementException,
399 : : uno::RuntimeException)
400 : : {
401 [ + - ]: 3 : SolarMutexGuard aGuard;
402 : :
403 [ + - ][ + - ]: 3 : GetUnoText().removeTextContent( xContent );
[ + - ]
404 : 3 : }
405 : :
406 : : // XSimpleText
407 : :
408 : 3 : uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursor()
409 : : throw(uno::RuntimeException)
410 : : {
411 [ + - ]: 3 : SolarMutexGuard aGuard;
412 : : // Notizen brauchen keine Extrawurst
413 [ + - ][ + - ]: 3 : return GetUnoText().createTextCursor();
[ + - ]
414 : : }
415 : :
416 : 0 : uno::Reference<text::XTextCursor> SAL_CALL ScAnnotationShapeObj::createTextCursorByRange(
417 : : const uno::Reference<text::XTextRange>& aTextPosition )
418 : : throw(uno::RuntimeException)
419 : : {
420 [ # # ]: 0 : SolarMutexGuard aGuard;
421 : : // Notizen brauchen keine Extrawurst
422 [ # # ][ # # ]: 0 : return GetUnoText().createTextCursorByRange(aTextPosition);
[ # # ]
423 : : }
424 : :
425 : 0 : rtl::OUString SAL_CALL ScAnnotationShapeObj::getString() throw(uno::RuntimeException)
426 : : {
427 [ # # ]: 0 : SolarMutexGuard aGuard;
428 [ # # ][ # # ]: 0 : return GetUnoText().getString();
[ # # ]
429 : : }
430 : :
431 : 3 : void SAL_CALL ScAnnotationShapeObj::setString( const rtl::OUString& aText ) throw(uno::RuntimeException)
432 : : {
433 [ + - ]: 3 : SolarMutexGuard aGuard;
434 [ + - ][ + - ]: 3 : GetUnoText().setString(aText);
[ + - ]
435 : 3 : }
436 : :
437 : 0 : void SAL_CALL ScAnnotationShapeObj::insertString( const uno::Reference<text::XTextRange>& xRange,
438 : : const rtl::OUString& aString, sal_Bool bAbsorb )
439 : : throw(uno::RuntimeException)
440 : : {
441 [ # # ]: 0 : SolarMutexGuard aGuard;
442 [ # # ][ # # ]: 0 : GetUnoText().insertString( xRange, aString, bAbsorb );
[ # # ]
443 : 0 : }
444 : :
445 : 0 : void SAL_CALL ScAnnotationShapeObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
446 : : sal_Int16 nControlCharacter, sal_Bool bAbsorb )
447 : : throw(lang::IllegalArgumentException, uno::RuntimeException)
448 : : {
449 [ # # ]: 0 : SolarMutexGuard aGuard;
450 [ # # ][ # # ]: 0 : GetUnoText().insertControlCharacter( xRange, nControlCharacter, bAbsorb );
[ # # ]
451 : 0 : }
452 : :
453 : 0 : uno::Reference<text::XText> SAL_CALL ScAnnotationShapeObj::getText() throw(uno::RuntimeException)
454 : : {
455 [ # # ]: 0 : SolarMutexGuard aGuard;
456 [ # # ][ # # ]: 0 : return GetUnoText().getText();
[ # # ]
457 : : }
458 : :
459 : 0 : uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getStart() throw(uno::RuntimeException)
460 : : {
461 [ # # ]: 0 : SolarMutexGuard aGuard;
462 [ # # ][ # # ]: 0 : return GetUnoText().getStart();
[ # # ]
463 : : }
464 : :
465 : 0 : uno::Reference<text::XTextRange> SAL_CALL ScAnnotationShapeObj::getEnd() throw(uno::RuntimeException)
466 : : {
467 [ # # ]: 0 : SolarMutexGuard aGuard;
468 [ # # ][ # # ]: 0 : return GetUnoText().getEnd();
[ # # ]
469 : : }
470 : :
471 : : // XShapeDescriptor
472 : 0 : ::rtl::OUString SAL_CALL ScAnnotationShapeObj::getShapeType( )
473 : : throw (uno::RuntimeException)
474 : : {
475 [ # # ]: 0 : SolarMutexGuard aGuard;
476 [ # # ][ # # ]: 0 : uno::Reference < drawing::XShapeDescriptor > xDesc(GetXShape(), uno::UNO_QUERY);
477 [ # # ]: 0 : if (xDesc.is())
478 [ # # ][ # # ]: 0 : return xDesc->getShapeType();
479 [ # # ]: 0 : return rtl::OUString();
480 : : }
481 : :
482 : : // XShape
483 : 0 : awt::Point SAL_CALL ScAnnotationShapeObj::getPosition( )
484 : : throw (uno::RuntimeException)
485 : : {
486 [ # # ]: 0 : SolarMutexGuard aGuard;
487 [ # # ]: 0 : GetXShape();
488 [ # # ][ # # ]: 0 : return xShape.is() ? xShape->getPosition() : awt::Point();
[ # # ][ # # ]
489 : : }
490 : :
491 : 3 : void SAL_CALL ScAnnotationShapeObj::setPosition( const awt::Point& aPosition )
492 : : throw (uno::RuntimeException)
493 : : {
494 [ + - ]: 3 : SolarMutexGuard aGuard;
495 [ + - ]: 3 : GetXShape();
496 [ + - ]: 3 : if( xShape.is() )
497 [ + - ][ + - ]: 3 : xShape->setPosition(aPosition);
[ + - ]
498 : 3 : }
499 : :
500 : 0 : awt::Size SAL_CALL ScAnnotationShapeObj::getSize( )
501 : : throw (uno::RuntimeException)
502 : : {
503 [ # # ]: 0 : SolarMutexGuard aGuard;
504 [ # # ]: 0 : GetXShape();
505 [ # # ][ # # ]: 0 : return xShape.is() ? xShape->getSize() : awt::Size();
[ # # ][ # # ]
506 : : }
507 : :
508 : 3 : void SAL_CALL ScAnnotationShapeObj::setSize( const awt::Size& aSize )
509 : : throw (beans::PropertyVetoException, uno::RuntimeException)
510 : : {
511 [ + - ]: 3 : SolarMutexGuard aGuard;
512 [ + - ]: 3 : GetXShape();
513 [ + - ]: 3 : if( xShape.is() )
514 [ + - ][ + - ]: 3 : xShape->setSize(aSize);
[ + - ]
515 : 3 : }
516 : :
517 : : // XPropertyState
518 : 0 : beans::PropertyState SAL_CALL ScAnnotationShapeObj::getPropertyState( const rtl::OUString& PropertyName )
519 : : throw (beans::UnknownPropertyException,
520 : : uno::RuntimeException)
521 : : {
522 [ # # ]: 0 : SolarMutexGuard aGuard;
523 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
524 [ # # ]: 0 : if (xState.is())
525 [ # # ][ # # ]: 0 : return xState->getPropertyState( PropertyName );
526 [ # # ]: 0 : return beans::PropertyState();
527 : : }
528 : :
529 : 0 : uno::Sequence< beans::PropertyState > SAL_CALL ScAnnotationShapeObj::getPropertyStates(
530 : : const uno::Sequence< rtl::OUString >& aPropertyName )
531 : : throw (beans::UnknownPropertyException,
532 : : uno::RuntimeException)
533 : : {
534 [ # # ]: 0 : SolarMutexGuard aGuard;
535 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
536 [ # # ]: 0 : if (xState.is())
537 [ # # ][ # # ]: 0 : return xState->getPropertyStates( aPropertyName );
538 [ # # ][ # # ]: 0 : return uno::Sequence< beans::PropertyState >();
539 : : }
540 : :
541 : 0 : void SAL_CALL ScAnnotationShapeObj::setPropertyToDefault( const ::rtl::OUString& PropertyName )
542 : : throw (::com::sun::star::beans::UnknownPropertyException,
543 : : ::com::sun::star::uno::RuntimeException)
544 : : {
545 [ # # ]: 0 : SolarMutexGuard aGuard;
546 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
547 [ # # ]: 0 : if (xState.is())
548 [ # # ][ # # ]: 0 : xState->setPropertyToDefault( PropertyName );
[ # # ]
549 : 0 : }
550 : :
551 : 0 : uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyDefault( const rtl::OUString& aPropertyName )
552 : : throw (beans::UnknownPropertyException,
553 : : lang::WrappedTargetException, uno::RuntimeException)
554 : : {
555 [ # # ]: 0 : SolarMutexGuard aGuard;
556 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertyState > xState (GetXShape(), uno::UNO_QUERY);
557 [ # # ]: 0 : if (xState.is())
558 [ # # ][ # # ]: 0 : return xState->getPropertyDefault( aPropertyName );
559 [ # # ]: 0 : return uno::Any();
560 : : }
561 : :
562 : : // XPropertySet
563 : 9 : uno::Reference< beans::XPropertySetInfo > SAL_CALL ScAnnotationShapeObj::getPropertySetInfo( )
564 : : throw (uno::RuntimeException)
565 : : {
566 [ + - ]: 9 : SolarMutexGuard aGuard;
567 [ + - ][ + - ]: 9 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
568 [ + - ]: 9 : if (xProp.is())
569 [ + - ][ + - ]: 9 : return xProp->getPropertySetInfo();
570 [ + - ]: 9 : return uno::Reference< beans::XPropertySetInfo >();
571 : : }
572 : :
573 : 12 : void SAL_CALL ScAnnotationShapeObj::setPropertyValue( const rtl::OUString& aPropertyName, const uno::Any& aValue )
574 : : throw (beans::UnknownPropertyException,
575 : : beans::PropertyVetoException,
576 : : lang::IllegalArgumentException,
577 : : lang::WrappedTargetException,
578 : : uno::RuntimeException)
579 : : {
580 [ + - ]: 12 : SolarMutexGuard aGuard;
581 [ + - ][ + - ]: 12 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
582 [ + - ]: 12 : if (xProp.is())
583 [ + - ][ + - ]: 12 : xProp->setPropertyValue( aPropertyName, aValue );
[ + - ]
584 : 12 : }
585 : :
586 : 0 : uno::Any SAL_CALL ScAnnotationShapeObj::getPropertyValue( const rtl::OUString& PropertyName )
587 : : throw (beans::UnknownPropertyException,
588 : : lang::WrappedTargetException,
589 : : uno::RuntimeException)
590 : : {
591 [ # # ]: 0 : SolarMutexGuard aGuard;
592 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
593 [ # # ]: 0 : if (xProp.is())
594 [ # # ][ # # ]: 0 : return xProp->getPropertyValue( PropertyName );
595 [ # # ]: 0 : return uno::Any();
596 : : }
597 : :
598 : 0 : void SAL_CALL ScAnnotationShapeObj::addPropertyChangeListener( const rtl::OUString& aPropertyName,
599 : : const uno::Reference< beans::XPropertyChangeListener >& xListener )
600 : : throw (beans::UnknownPropertyException,
601 : : lang::WrappedTargetException,
602 : : uno::RuntimeException)
603 : : {
604 [ # # ]: 0 : SolarMutexGuard aGuard;
605 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
606 [ # # ]: 0 : if (xProp.is())
607 [ # # ][ # # ]: 0 : return xProp->addPropertyChangeListener( aPropertyName, xListener );
[ # # ][ # # ]
[ # # ]
608 : : }
609 : :
610 : 0 : void SAL_CALL ScAnnotationShapeObj::removePropertyChangeListener( const rtl::OUString& aPropertyName,
611 : : const uno::Reference< beans::XPropertyChangeListener >& aListener )
612 : : throw (beans::UnknownPropertyException,
613 : : lang::WrappedTargetException,
614 : : uno::RuntimeException)
615 : : {
616 [ # # ]: 0 : SolarMutexGuard aGuard;
617 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
618 [ # # ]: 0 : if (xProp.is())
619 [ # # ][ # # ]: 0 : return xProp->removePropertyChangeListener( aPropertyName, aListener );
[ # # ][ # # ]
[ # # ]
620 : : }
621 : :
622 : 0 : void SAL_CALL ScAnnotationShapeObj::addVetoableChangeListener( const rtl::OUString& PropertyName,
623 : : const uno::Reference< beans::XVetoableChangeListener >& aListener )
624 : : throw (beans::UnknownPropertyException,
625 : : lang::WrappedTargetException,
626 : : uno::RuntimeException)
627 : : {
628 [ # # ]: 0 : SolarMutexGuard aGuard;
629 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
630 [ # # ]: 0 : if (xProp.is())
631 [ # # ][ # # ]: 0 : return xProp->addVetoableChangeListener( PropertyName, aListener );
[ # # ][ # # ]
[ # # ]
632 : : }
633 : :
634 : 0 : void SAL_CALL ScAnnotationShapeObj::removeVetoableChangeListener( const rtl::OUString& PropertyName,
635 : : const uno::Reference< beans::XVetoableChangeListener >& aListener )
636 : : throw (beans::UnknownPropertyException,
637 : : lang::WrappedTargetException,
638 : : uno::RuntimeException)
639 : : {
640 [ # # ]: 0 : SolarMutexGuard aGuard;
641 [ # # ][ # # ]: 0 : uno::Reference < beans::XPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
642 [ # # ]: 0 : if (xProp.is())
643 [ # # ][ # # ]: 0 : return xProp->removeVetoableChangeListener( PropertyName, aListener );
[ # # ][ # # ]
[ # # ]
644 : : }
645 : :
646 : : // XMultiPropertySet
647 : 6 : void SAL_CALL ScAnnotationShapeObj::setPropertyValues( const uno::Sequence< rtl::OUString >& aPropertyNames,
648 : : const uno::Sequence< uno::Any >& aValues )
649 : : throw (beans::PropertyVetoException,
650 : : lang::IllegalArgumentException,
651 : : lang::WrappedTargetException,
652 : : uno::RuntimeException)
653 : : {
654 [ + - ]: 6 : SolarMutexGuard aGuard;
655 [ + - ][ + - ]: 6 : uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
656 [ + - ]: 6 : if (xProp.is())
657 [ + - ][ + - ]: 6 : xProp->setPropertyValues( aPropertyNames, aValues );
[ + - ]
658 : 6 : }
659 : :
660 : 0 : uno::Sequence< uno::Any > SAL_CALL ScAnnotationShapeObj::getPropertyValues(
661 : : const uno::Sequence< rtl::OUString >& aPropertyNames )
662 : : throw (uno::RuntimeException)
663 : : {
664 [ # # ]: 0 : SolarMutexGuard aGuard;
665 [ # # ][ # # ]: 0 : uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
666 [ # # ]: 0 : if (xProp.is())
667 [ # # ][ # # ]: 0 : return xProp->getPropertyValues( aPropertyNames );
668 [ # # ][ # # ]: 0 : return uno::Sequence< uno::Any >();
669 : : }
670 : :
671 : 0 : void SAL_CALL ScAnnotationShapeObj::addPropertiesChangeListener( const uno::Sequence< rtl::OUString >& aPropertyNames,
672 : : const uno::Reference< beans::XPropertiesChangeListener >& xListener )
673 : : throw (uno::RuntimeException)
674 : : {
675 [ # # ]: 0 : SolarMutexGuard aGuard;
676 [ # # ][ # # ]: 0 : uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
677 [ # # ]: 0 : if (xProp.is())
678 [ # # ][ # # ]: 0 : xProp->addPropertiesChangeListener( aPropertyNames, xListener );
[ # # ]
679 : 0 : }
680 : :
681 : 0 : void SAL_CALL ScAnnotationShapeObj::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& xListener )
682 : : throw (uno::RuntimeException)
683 : : {
684 [ # # ]: 0 : SolarMutexGuard aGuard;
685 [ # # ][ # # ]: 0 : uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
686 [ # # ]: 0 : if (xProp.is())
687 [ # # ][ # # ]: 0 : xProp->removePropertiesChangeListener( xListener );
[ # # ]
688 : 0 : }
689 : :
690 : 0 : void SAL_CALL ScAnnotationShapeObj::firePropertiesChangeEvent( const uno::Sequence< rtl::OUString >& aPropertyNames,
691 : : const uno::Reference< beans::XPropertiesChangeListener >& xListener )
692 : : throw (uno::RuntimeException)
693 : : {
694 [ # # ]: 0 : SolarMutexGuard aGuard;
695 [ # # ][ # # ]: 0 : uno::Reference < beans::XMultiPropertySet > xProp (GetXShape(), uno::UNO_QUERY);
696 [ # # ]: 0 : if (xProp.is())
697 [ # # ][ # # ]: 0 : xProp->firePropertiesChangeEvent( aPropertyNames, xListener );
[ # # ]
698 : 0 : }
699 : :
700 : : // XComponent
701 : 0 : void SAL_CALL ScAnnotationShapeObj::dispose( ) throw (uno::RuntimeException)
702 : : {
703 [ # # ]: 0 : SolarMutexGuard aGuard;
704 [ # # ][ # # ]: 0 : uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
705 [ # # ]: 0 : if (xComp.is())
706 [ # # ][ # # ]: 0 : xComp->dispose();
707 [ # # ]: 0 : if (xShape.is())
708 [ # # ]: 0 : xShape.clear();
709 : 0 : }
710 : :
711 : 0 : void SAL_CALL ScAnnotationShapeObj::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
712 : : throw (uno::RuntimeException)
713 : : {
714 [ # # ]: 0 : SolarMutexGuard aGuard;
715 [ # # ][ # # ]: 0 : uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
716 [ # # ]: 0 : if (xComp.is())
717 [ # # ][ # # ]: 0 : xComp->addEventListener( xListener );
[ # # ]
718 : 0 : }
719 : :
720 : 0 : void SAL_CALL ScAnnotationShapeObj::removeEventListener( const uno::Reference< lang::XEventListener >& aListener )
721 : : throw (uno::RuntimeException)
722 : : {
723 [ # # ]: 0 : SolarMutexGuard aGuard;
724 [ # # ][ # # ]: 0 : uno::Reference < lang::XComponent > xComp (GetXShape(), uno::UNO_QUERY);
725 [ # # ]: 0 : if (xComp.is())
726 [ # # ][ # # ]: 0 : xComp->removeEventListener( aListener );
[ # # ]
727 : 0 : }
728 : :
729 : : //------------------------------------------------------------------------
730 : :
731 : :
732 : :
733 : :
734 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|