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 : :
30 : : #include <com/sun/star/beans/PropertyValue.hpp>
31 : : #include <rtl/ustrbuf.hxx>
32 : : #include <tools/rtti.hxx>
33 : : #include <tools/solar.h>
34 : : #include <svtools/unoevent.hxx>
35 : : #include <svl/macitem.hxx>
36 : :
37 : : using namespace ::com::sun::star;
38 : : using namespace ::com::sun::star::uno;
39 : :
40 : : using ::com::sun::star::container::NoSuchElementException;
41 : : using ::com::sun::star::container::XNameReplace;
42 : : using ::com::sun::star::lang::IllegalArgumentException;
43 : : using ::com::sun::star::lang::WrappedTargetException;
44 : : using ::com::sun::star::lang::XServiceInfo;
45 : : using ::com::sun::star::beans::PropertyValue;
46 : : using ::cppu::WeakImplHelper2;
47 : : using ::rtl::OUString;
48 : : using ::rtl::OUStringBuffer;
49 : :
50 : :
51 : : const sal_Char sAPI_ServiceName[] = "com.sun.star.container.XNameReplace";
52 : : const sal_Char sAPI_SvDetachedEventDescriptor[] = "SvDetachedEventDescriptor";
53 : :
54 : : //
55 : : // SvBaseEventDescriptor
56 : : //
57 : :
58 : 9 : SvBaseEventDescriptor::SvBaseEventDescriptor( const SvEventDescription* pSupportedMacroItems ) :
59 : : sEventType(RTL_CONSTASCII_USTRINGPARAM("EventType")),
60 : : sMacroName(RTL_CONSTASCII_USTRINGPARAM("MacroName")),
61 : : sLibrary(RTL_CONSTASCII_USTRINGPARAM("Library")),
62 : : sStarBasic(RTL_CONSTASCII_USTRINGPARAM("StarBasic")),
63 : : sJavaScript(RTL_CONSTASCII_USTRINGPARAM("JavaScript")),
64 : : sScript(RTL_CONSTASCII_USTRINGPARAM("Script")),
65 : : sNone(RTL_CONSTASCII_USTRINGPARAM("None")),
66 : : sServiceName(RTL_CONSTASCII_USTRINGPARAM(sAPI_ServiceName)),
67 : : sEmpty(),
68 : : mpSupportedMacroItems(pSupportedMacroItems),
69 [ + - ][ + - ]: 9 : mnMacroItems(0)
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
70 : : {
71 : : DBG_ASSERT(pSupportedMacroItems != NULL, "Need a list of supported events!");
72 : :
73 [ + + ]: 23 : for( ; mpSupportedMacroItems[mnMacroItems].mnEvent != 0; mnMacroItems++) ;
74 : 9 : }
75 : :
76 : :
77 : 9 : SvBaseEventDescriptor::~SvBaseEventDescriptor()
78 : : {
79 [ - + ]: 9 : }
80 : :
81 : 0 : void SvBaseEventDescriptor::replaceByName(
82 : : const OUString& rName,
83 : : const Any& rElement )
84 : : throw(
85 : : IllegalArgumentException,
86 : : NoSuchElementException,
87 : : WrappedTargetException,
88 : : RuntimeException)
89 : : {
90 [ # # ]: 0 : sal_uInt16 nMacroID = getMacroID(rName);
91 : :
92 : : // error checking
93 [ # # ]: 0 : if (0 == nMacroID)
94 [ # # ]: 0 : throw NoSuchElementException();
95 [ # # ][ # # ]: 0 : if (rElement.getValueType() != getElementType())
96 [ # # ]: 0 : throw IllegalArgumentException();
97 : :
98 : : // get sequence
99 [ # # ]: 0 : Sequence<PropertyValue> aSequence;
100 [ # # ]: 0 : rElement >>= aSequence;
101 : :
102 : : // perform replace (in subclass)
103 [ # # ]: 0 : SvxMacro aMacro(sEmpty,sEmpty);
104 [ # # ]: 0 : getMacroFromAny(aMacro, rElement);
105 [ # # ][ # # ]: 0 : replaceByName(nMacroID, aMacro);
[ # # ]
106 : 0 : }
107 : :
108 : 0 : Any SvBaseEventDescriptor::getByName(
109 : : const OUString& rName )
110 : : throw(
111 : : NoSuchElementException,
112 : : WrappedTargetException,
113 : : RuntimeException)
114 : : {
115 [ # # ]: 0 : sal_uInt16 nMacroID = getMacroID(rName);
116 : :
117 : : // error checking
118 [ # # ]: 0 : if (0 == nMacroID)
119 [ # # ]: 0 : throw NoSuchElementException();
120 : :
121 : : // perform get (in subclass)
122 : 0 : Any aAny;
123 [ # # ]: 0 : SvxMacro aMacro( sEmpty, sEmpty );
124 [ # # ]: 0 : getByName(aMacro, nMacroID);
125 [ # # ]: 0 : getAnyFromMacro(aAny, aMacro);
126 [ # # ]: 0 : return aAny;
127 : : }
128 : :
129 : 0 : Sequence<OUString> SvBaseEventDescriptor::getElementNames()
130 : : throw(RuntimeException)
131 : : {
132 : : // create and fill sequence
133 : 0 : Sequence<OUString> aSequence(mnMacroItems);
134 [ # # ]: 0 : for( sal_Int16 i = 0; i < mnMacroItems; i++)
135 : : {
136 [ # # ]: 0 : aSequence[i] = OUString::createFromAscii( mpSupportedMacroItems[i].mpEventName );
137 : : }
138 : :
139 : 0 : return aSequence;
140 : : }
141 : :
142 : 0 : sal_Bool SvBaseEventDescriptor::hasByName(
143 : : const OUString& rName )
144 : : throw(RuntimeException)
145 : : {
146 : 0 : sal_uInt16 nMacroID = getMacroID(rName);
147 : 0 : return (nMacroID != 0);
148 : : }
149 : :
150 : 0 : Type SvBaseEventDescriptor::getElementType()
151 : : throw(RuntimeException)
152 : : {
153 : 0 : return ::getCppuType((Sequence<PropertyValue> *)0);
154 : : }
155 : :
156 : 0 : sal_Bool SvBaseEventDescriptor::hasElements()
157 : : throw(RuntimeException)
158 : : {
159 : 0 : return mnMacroItems != 0;
160 : : }
161 : :
162 : 0 : sal_Bool SvBaseEventDescriptor::supportsService(const OUString& rServiceName)
163 : : throw(RuntimeException)
164 : : {
165 : 0 : return sServiceName.equals(rServiceName);
166 : : }
167 : :
168 : 0 : Sequence<OUString> SvBaseEventDescriptor::getSupportedServiceNames(void)
169 : : throw(RuntimeException)
170 : : {
171 : 0 : Sequence<OUString> aSequence(1);
172 [ # # ]: 0 : aSequence[0] = sServiceName;
173 : :
174 : 0 : return aSequence;
175 : : }
176 : :
177 : 0 : sal_uInt16 SvBaseEventDescriptor::mapNameToEventID(const OUString& rName) const
178 : : {
179 : : // iterate over known event names
180 [ # # ]: 0 : for(sal_Int16 i = 0; i < mnMacroItems; i++)
181 : : {
182 [ # # ]: 0 : if (0 == rName.compareToAscii(mpSupportedMacroItems[i].mpEventName))
183 : : {
184 : 0 : return mpSupportedMacroItems[i].mnEvent;
185 : : }
186 : : }
187 : :
188 : : // not found -> return zero
189 : 0 : return 0;
190 : : }
191 : :
192 : 0 : sal_uInt16 SvBaseEventDescriptor::getMacroID(const OUString& rName) const
193 : : {
194 : 0 : return mapNameToEventID(rName);
195 : : }
196 : :
197 : 0 : void SvBaseEventDescriptor::getAnyFromMacro(Any& rAny,
198 : : const SvxMacro& rMacro)
199 : : {
200 : 0 : sal_Bool bRetValueOK = sal_False; // do we have a ret value?
201 : :
202 [ # # ]: 0 : if (rMacro.HasMacro())
203 : : {
204 [ # # # ]: 0 : switch (rMacro.GetScriptType())
205 : : {
206 : : case STARBASIC:
207 : : {
208 : : // create sequence
209 [ # # ]: 0 : Sequence<PropertyValue> aSequence(3);
210 : 0 : Any aTmp;
211 : :
212 : : // create type
213 : 0 : PropertyValue aTypeValue;
214 : 0 : aTypeValue.Name = sEventType;
215 [ # # ]: 0 : aTmp <<= sStarBasic;
216 : 0 : aTypeValue.Value = aTmp;
217 [ # # ]: 0 : aSequence[0] = aTypeValue;
218 : :
219 : : // macro name
220 : 0 : PropertyValue aNameValue;
221 : 0 : aNameValue.Name = sMacroName;
222 : 0 : OUString sNameTmp(rMacro.GetMacName());
223 [ # # ]: 0 : aTmp <<= sNameTmp;
224 : 0 : aNameValue.Value = aTmp;
225 [ # # ]: 0 : aSequence[1] = aNameValue;
226 : :
227 : : // library name
228 : 0 : PropertyValue aLibValue;
229 : 0 : aLibValue.Name = sLibrary;
230 : 0 : OUString sLibTmp(rMacro.GetLibName());
231 [ # # ]: 0 : aTmp <<= sLibTmp;
232 : 0 : aLibValue.Value = aTmp;
233 [ # # ]: 0 : aSequence[2] = aLibValue;
234 : :
235 [ # # ]: 0 : rAny <<= aSequence;
236 : 0 : bRetValueOK = sal_True;
237 [ # # ]: 0 : break;
238 : : }
239 : : case EXTENDED_STYPE:
240 : : {
241 : : // create sequence
242 [ # # ]: 0 : Sequence<PropertyValue> aSequence(2);
243 : 0 : Any aTmp;
244 : :
245 : : // create type
246 : 0 : PropertyValue aTypeValue;
247 : 0 : aTypeValue.Name = sEventType;
248 [ # # ]: 0 : aTmp <<= sScript;
249 : 0 : aTypeValue.Value = aTmp;
250 [ # # ]: 0 : aSequence[0] = aTypeValue;
251 : :
252 : : // macro name
253 : 0 : PropertyValue aNameValue;
254 : 0 : aNameValue.Name = sScript;
255 : 0 : OUString sNameTmp(rMacro.GetMacName());
256 [ # # ]: 0 : aTmp <<= sNameTmp;
257 : 0 : aNameValue.Value = aTmp;
258 [ # # ]: 0 : aSequence[1] = aNameValue;
259 : :
260 [ # # ]: 0 : rAny <<= aSequence;
261 : 0 : bRetValueOK = sal_True;
262 [ # # ]: 0 : break;
263 : : }
264 : : case JAVASCRIPT:
265 : : default:
266 : : OSL_FAIL("not implemented");
267 : : }
268 : : }
269 : : // else: bRetValueOK not set
270 : :
271 : : // if we don't have a return value, make an empty one
272 [ # # ]: 0 : if (! bRetValueOK)
273 : : {
274 : : // create "None" macro
275 [ # # ]: 0 : Sequence<PropertyValue> aSequence(1);
276 : :
277 : 0 : PropertyValue aKindValue;
278 : 0 : aKindValue.Name = sEventType;
279 : 0 : Any aTmp;
280 [ # # ]: 0 : aTmp <<= sNone;
281 : 0 : aKindValue.Value = aTmp;
282 [ # # ]: 0 : aSequence[0] = aKindValue;
283 : :
284 [ # # ]: 0 : rAny <<= aSequence;
285 [ # # ]: 0 : bRetValueOK = sal_True;
286 : : }
287 : 0 : }
288 : :
289 : :
290 : 0 : void SvBaseEventDescriptor::getMacroFromAny(
291 : : SvxMacro& rMacro,
292 : : const Any& rAny)
293 : : throw ( IllegalArgumentException )
294 : : {
295 : : // get sequence
296 [ # # ]: 0 : Sequence<PropertyValue> aSequence;
297 [ # # ]: 0 : rAny >>= aSequence;
298 : :
299 : : // process ...
300 : 0 : sal_Bool bTypeOK = sal_False;
301 : 0 : sal_Bool bNone = sal_False; // true if EventType=="None"
302 : 0 : enum ScriptType eType = EXTENDED_STYPE;
303 : 0 : OUString sScriptVal;
304 : 0 : OUString sMacroVal;
305 : 0 : OUString sLibVal;
306 : 0 : sal_Int32 nCount = aSequence.getLength();
307 [ # # ]: 0 : for (sal_Int32 i = 0; i < nCount; i++)
308 : : {
309 [ # # ]: 0 : PropertyValue& aValue = aSequence[i];
310 [ # # ]: 0 : if (aValue.Name.equals(sEventType))
311 : : {
312 : 0 : OUString sTmp;
313 : 0 : aValue.Value >>= sTmp;
314 [ # # ]: 0 : if (sTmp.equals(sStarBasic))
315 : : {
316 : 0 : eType = STARBASIC;
317 : 0 : bTypeOK = sal_True;
318 : : }
319 [ # # ]: 0 : else if (sTmp.equals(sJavaScript))
320 : : {
321 : 0 : eType = JAVASCRIPT;
322 : 0 : bTypeOK = sal_True;
323 : : }
324 [ # # ]: 0 : else if (sTmp.equals(sScript))
325 : : {
326 : 0 : eType = EXTENDED_STYPE;
327 : 0 : bTypeOK = sal_True;
328 : : }
329 [ # # ]: 0 : else if (sTmp.equals(sNone))
330 : : {
331 : 0 : bNone = sal_True;
332 : 0 : bTypeOK = sal_True;
333 : 0 : }
334 : : // else: unknown script type
335 : : }
336 [ # # ]: 0 : else if (aValue.Name.equals(sMacroName))
337 : : {
338 : 0 : aValue.Value >>= sMacroVal;
339 : : }
340 [ # # ]: 0 : else if (aValue.Name.equals(sLibrary))
341 : : {
342 : 0 : aValue.Value >>= sLibVal;
343 : : }
344 [ # # ]: 0 : else if (aValue.Name.equals(sScript))
345 : : {
346 : 0 : aValue.Value >>= sScriptVal;
347 : : }
348 : : // else: unknown PropertyValue -> ignore
349 : : }
350 : :
351 [ # # ]: 0 : if (bTypeOK)
352 : : {
353 [ # # ]: 0 : if (bNone)
354 : : {
355 : : // return empty macro
356 [ # # ][ # # ]: 0 : rMacro = SvxMacro( sEmpty, sEmpty );
[ # # ]
357 : : }
358 : : else
359 : : {
360 [ # # ]: 0 : if (eType == STARBASIC)
361 : : {
362 : : // create macro and return
363 [ # # ]: 0 : SvxMacro aMacro(sMacroVal, sLibVal, eType);
364 [ # # ][ # # ]: 0 : rMacro = aMacro;
365 : : }
366 [ # # ]: 0 : else if (eType == EXTENDED_STYPE)
367 : : {
368 [ # # ]: 0 : SvxMacro aMacro(sScriptVal, sScript);
369 [ # # ][ # # ]: 0 : rMacro = aMacro;
370 : : }
371 : : else
372 : : {
373 : : // we can't process type: abort
374 : : // TODO: JavaScript macros
375 [ # # ]: 0 : throw IllegalArgumentException();
376 : : }
377 : : }
378 : : }
379 : : else
380 : : {
381 : : // no valid type: abort
382 [ # # ]: 0 : throw IllegalArgumentException();
383 [ # # ]: 0 : }
384 : 0 : }
385 : :
386 : :
387 : :
388 : :
389 : : //
390 : : // SvEventDescriptor
391 : : //
392 : :
393 : :
394 : 0 : SvEventDescriptor::SvEventDescriptor(
395 : : XInterface& rParent,
396 : : const SvEventDescription* pSupportedMacroItems) :
397 : : SvBaseEventDescriptor(pSupportedMacroItems),
398 [ # # ]: 0 : xParentRef(&rParent)
399 : : {
400 : 0 : }
401 : :
402 : :
403 : 0 : SvEventDescriptor::~SvEventDescriptor()
404 : : {
405 : : // automatically release xParentRef !
406 [ # # ]: 0 : }
407 : :
408 : 0 : void SvEventDescriptor::replaceByName(
409 : : const sal_uInt16 nEvent,
410 : : const SvxMacro& rMacro)
411 : : throw(
412 : : IllegalArgumentException,
413 : : NoSuchElementException,
414 : : WrappedTargetException,
415 : : RuntimeException)
416 : : {
417 [ # # ][ # # ]: 0 : SvxMacroItem aItem(getMacroItemWhich());
418 [ # # ][ # # ]: 0 : aItem.SetMacroTable(getMacroItem().GetMacroTable());
419 [ # # ]: 0 : aItem.SetMacro(nEvent, rMacro);
420 [ # # ][ # # ]: 0 : setMacroItem(aItem);
421 : 0 : }
422 : :
423 : 0 : void SvEventDescriptor::getByName(
424 : : SvxMacro& rMacro,
425 : : const sal_uInt16 nEvent )
426 : : throw(
427 : : NoSuchElementException,
428 : : WrappedTargetException,
429 : : RuntimeException)
430 : : {
431 : 0 : const SvxMacroItem& rItem = getMacroItem();
432 [ # # ]: 0 : if( rItem.HasMacro( nEvent ) )
433 : 0 : rMacro = rItem.GetMacro(nEvent);
434 : : else
435 : : {
436 [ # # ]: 0 : SvxMacro aEmptyMacro(sEmpty, sEmpty);
437 [ # # ][ # # ]: 0 : rMacro = aEmptyMacro;
438 : : }
439 : 0 : }
440 : :
441 : :
442 : :
443 : :
444 : : //
445 : : // SvDetachedEventDescriptor
446 : : //
447 : :
448 : 9 : SvDetachedEventDescriptor::SvDetachedEventDescriptor(
449 : : const SvEventDescription* pSupportedMacroItems) :
450 : : SvBaseEventDescriptor(pSupportedMacroItems),
451 [ + - ]: 9 : sImplName(RTL_CONSTASCII_USTRINGPARAM(sAPI_SvDetachedEventDescriptor))
452 : : {
453 : : // allocate aMacros
454 [ + - ]: 9 : aMacros = new SvxMacro*[mnMacroItems];
455 : :
456 : : // ... and initialize
457 [ + + ]: 23 : for(sal_Int16 i = 0; i < mnMacroItems; i++)
458 : : {
459 : 14 : aMacros[i] = NULL;
460 : : }
461 : 9 : }
462 : :
463 : 9 : SvDetachedEventDescriptor::~SvDetachedEventDescriptor()
464 : : {
465 : : // delete contents of aMacros
466 [ + + ]: 23 : for(sal_Int16 i = 0; i < mnMacroItems; i++)
467 : : {
468 [ - + ]: 14 : if (NULL != aMacros[i])
469 [ # # ][ # # ]: 0 : delete aMacros[i];
470 : : }
471 : :
472 [ + - ]: 9 : delete [] aMacros;
473 [ - + ]: 9 : }
474 : :
475 : 4 : sal_Int16 SvDetachedEventDescriptor::getIndex(const sal_uInt16 nID) const
476 : : {
477 : : // iterate over supported events
478 : 4 : sal_Int16 nIndex = 0;
479 [ + + ][ + - ]: 6 : while ( (mpSupportedMacroItems[nIndex].mnEvent != nID) &&
[ + + ]
480 : 2 : (mpSupportedMacroItems[nIndex].mnEvent != 0) )
481 : : {
482 : 2 : nIndex++;
483 : : }
484 [ + - ]: 4 : return (mpSupportedMacroItems[nIndex].mnEvent == nID) ? nIndex : -1;
485 : : }
486 : :
487 : 0 : OUString SvDetachedEventDescriptor::getImplementationName()
488 : : throw( ::com::sun::star::uno::RuntimeException )
489 : : {
490 : 0 : return sImplName;
491 : : }
492 : :
493 : :
494 : 0 : void SvDetachedEventDescriptor::replaceByName(
495 : : const sal_uInt16 nEvent,
496 : : const SvxMacro& rMacro)
497 : : throw(
498 : : IllegalArgumentException,
499 : : NoSuchElementException,
500 : : WrappedTargetException,
501 : : RuntimeException)
502 : : {
503 : 0 : sal_Int16 nIndex = getIndex(nEvent);
504 [ # # ]: 0 : if (-1 == nIndex)
505 [ # # ]: 0 : throw IllegalArgumentException();
506 : :
507 : 0 : aMacros[nIndex] = new SvxMacro(rMacro.GetMacName(), rMacro.GetLibName(),
508 [ # # ]: 0 : rMacro.GetScriptType() );
509 : 0 : }
510 : :
511 : :
512 : 0 : void SvDetachedEventDescriptor::getByName(
513 : : SvxMacro& rMacro,
514 : : const sal_uInt16 nEvent )
515 : : throw(
516 : : NoSuchElementException,
517 : : WrappedTargetException,
518 : : RuntimeException)
519 : : {
520 : 0 : sal_Int16 nIndex = getIndex(nEvent);
521 [ # # ]: 0 : if (-1 == nIndex )
522 [ # # ]: 0 : throw NoSuchElementException();
523 : :
524 [ # # ]: 0 : if( aMacros[nIndex] )
525 : 0 : rMacro = (*aMacros[nIndex]);
526 : 0 : }
527 : :
528 : 4 : sal_Bool SvDetachedEventDescriptor::hasByName(
529 : : const sal_uInt16 nEvent ) const /// item ID of event
530 : : throw(IllegalArgumentException)
531 : : {
532 : 4 : sal_Int16 nIndex = getIndex(nEvent);
533 [ - + ]: 4 : if (-1 == nIndex)
534 [ # # ]: 0 : throw IllegalArgumentException();
535 : :
536 [ - + ]: 4 : return (NULL == aMacros[nIndex]) ? sal_False : aMacros[nIndex]->HasMacro();
537 : : }
538 : :
539 : :
540 : : //
541 : : // SvMacroTableEventDescriptor
542 : : //
543 : :
544 : 5 : SvMacroTableEventDescriptor::SvMacroTableEventDescriptor(const SvEventDescription* pSupportedMacroItems) :
545 : 5 : SvDetachedEventDescriptor(pSupportedMacroItems)
546 : : {
547 : 5 : }
548 : :
549 : 2 : SvMacroTableEventDescriptor::SvMacroTableEventDescriptor(
550 : : const SvxMacroTableDtor& rMacroTable,
551 : : const SvEventDescription* pSupportedMacroItems) :
552 : 2 : SvDetachedEventDescriptor(pSupportedMacroItems)
553 : : {
554 [ + - ]: 2 : copyMacrosFromTable(rMacroTable);
555 : 2 : }
556 : :
557 : 7 : SvMacroTableEventDescriptor::~SvMacroTableEventDescriptor()
558 : : {
559 [ - + ]: 14 : }
560 : :
561 : 2 : void SvMacroTableEventDescriptor::copyMacrosFromTable(
562 : : const SvxMacroTableDtor& rMacroTable)
563 : : {
564 [ + + ]: 6 : for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
565 : : {
566 : 4 : const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent;
567 : 4 : const SvxMacro* pMacro = rMacroTable.Get(nEvent);
568 [ - + ]: 4 : if (NULL != pMacro)
569 : 0 : replaceByName(nEvent, *pMacro);
570 : : }
571 : :
572 : 2 : }
573 : :
574 : 2 : void SvMacroTableEventDescriptor::copyMacrosIntoTable(
575 : : SvxMacroTableDtor& rMacroTable)
576 : : {
577 [ + + ]: 6 : for(sal_Int16 i = 0; mpSupportedMacroItems[i].mnEvent != 0; i++)
578 : : {
579 : 4 : const sal_uInt16 nEvent = mpSupportedMacroItems[i].mnEvent;
580 [ - + ]: 4 : if (hasByName(nEvent))
581 : : {
582 [ # # ]: 0 : SvxMacro& rMacro = rMacroTable.Insert(nEvent, SvxMacro(sEmpty, sEmpty));
583 : 0 : getByName(rMacro, nEvent);
584 : : }
585 : : }
586 : 2 : }
587 : :
588 : :
589 : :
590 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|