Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
5 : : * This Source Code Form is subject to the terms of the Mozilla Public
6 : : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
11 : : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : : * contributor license agreements. See the NOTICE file distributed
13 : : * with this work for additional information regarding copyright
14 : : * ownership. The ASF licenses this file to you under the Apache
15 : : * License, Version 2.0 (the "License"); you may not use this file
16 : : * except in compliance with the License. You may obtain a copy of
17 : : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : : */
19 : :
20 : : #if defined(_MSC_VER) && (_MSC_VER >= 1300)
21 : : #pragma warning( disable : 4290 )
22 : : #endif
23 : : #include <com/sun/star/document/UpdateDocMode.hpp>
24 : :
25 : : #include "sal/config.h"
26 : :
27 : : #include <sfx2/appuno.hxx>
28 : : #include "appbaslib.hxx"
29 : :
30 : : #include "sfx2/dllapi.h"
31 : :
32 : : #include <basic/sbx.hxx>
33 : : #include <svl/itempool.hxx>
34 : : #include <svl/rectitem.hxx>
35 : : #include <tools/debug.hxx>
36 : :
37 : : #include <tools/urlobj.hxx>
38 : : #include <tools/config.hxx>
39 : : #include <basic/sbxmeth.hxx>
40 : : #include <basic/sbmeth.hxx>
41 : : #include <basic/sbxobj.hxx>
42 : : #include <basic/sberrors.hxx>
43 : : #include <basic/basmgr.hxx>
44 : : #include <basic/sbuno.hxx>
45 : :
46 : : #include <basic/sbxcore.hxx>
47 : : #include <svl/ownlist.hxx>
48 : : #include <svl/lckbitem.hxx>
49 : : #include <svl/stritem.hxx>
50 : : #include <svl/slstitm.hxx>
51 : : #include <svl/intitem.hxx>
52 : : #include <svl/eitem.hxx>
53 : : #include <com/sun/star/task/XStatusIndicatorFactory.hpp>
54 : : #include <com/sun/star/task/XInteractionHandler.hpp>
55 : : #include <com/sun/star/io/XInputStream.hpp>
56 : : #include <com/sun/star/beans/XPropertySet.hpp>
57 : : #include <com/sun/star/frame/XFrameActionListener.hpp>
58 : : #include <com/sun/star/frame/XComponentLoader.hpp>
59 : : #include <com/sun/star/frame/XFrame.hpp>
60 : : #include <com/sun/star/frame/FrameActionEvent.hpp>
61 : : #include <com/sun/star/frame/FrameAction.hpp>
62 : : #include <com/sun/star/container/XContainer.hpp>
63 : : #include <com/sun/star/container/XIndexContainer.hpp>
64 : : #include <com/sun/star/container/XNameReplace.hpp>
65 : : #include <com/sun/star/container/XContainerListener.hpp>
66 : : #include <com/sun/star/container/XSet.hpp>
67 : : #include <com/sun/star/container/ContainerEvent.hpp>
68 : : #include <com/sun/star/container/XIndexReplace.hpp>
69 : : #include <com/sun/star/container/XNameContainer.hpp>
70 : : #include <com/sun/star/awt/XTopWindow.hpp>
71 : : #include <com/sun/star/awt/XWindow.hpp>
72 : : #include <com/sun/star/awt/PosSize.hpp>
73 : : #include <com/sun/star/registry/RegistryValueType.hpp>
74 : : #include <comphelper/processfactory.hxx>
75 : : #include <com/sun/star/awt/XButton.hpp>
76 : : #include <com/sun/star/frame/DispatchResultEvent.hpp>
77 : : #include <com/sun/star/frame/DispatchResultState.hpp>
78 : : #include <com/sun/star/frame/XModel.hpp>
79 : : #include <com/sun/star/document/MacroExecMode.hpp>
80 : : #include <com/sun/star/ucb/XContent.hpp>
81 : :
82 : : #include <osl/mutex.hxx>
83 : : #include <comphelper/sequence.hxx>
84 : : #include <framework/documentundoguard.hxx>
85 : : #include <rtl/ustrbuf.hxx>
86 : : #include <comphelper/interaction.hxx>
87 : :
88 : : using namespace ::com::sun::star;
89 : : using namespace ::com::sun::star::ucb;
90 : : using namespace ::com::sun::star::uno;
91 : : using namespace ::com::sun::star::registry;
92 : : using namespace ::com::sun::star::frame;
93 : : using namespace ::com::sun::star::beans;
94 : : using namespace ::com::sun::star::io;
95 : :
96 : : #include "sfxtypes.hxx"
97 : : #include <sfx2/sfxuno.hxx>
98 : : #include <sfx2/app.hxx>
99 : : #include <sfx2/sfxsids.hrc>
100 : : #include <sfx2/msg.hxx>
101 : : #include <sfx2/msgpool.hxx>
102 : : #include <sfx2/request.hxx>
103 : : #include <sfx2/module.hxx>
104 : : #include <sfx2/fcontnr.hxx>
105 : : #include "frmload.hxx"
106 : : #include <sfx2/frame.hxx>
107 : : #include <sfx2/objsh.hxx>
108 : : #include <sfx2/objuno.hxx>
109 : : #include <sfx2/unoctitm.hxx>
110 : : #include <sfx2/dispatch.hxx>
111 : : #include "doctemplates.hxx"
112 : : #include "shutdownicon.hxx"
113 : : #include "objshimp.hxx"
114 : : #include "fltoptint.hxx"
115 : : #include <sfx2/docfile.hxx>
116 : : #include <sfx2/sfxbasecontroller.hxx>
117 : : #include <sfx2/brokenpackageint.hxx>
118 : : #include "eventsupplier.hxx"
119 : : #include "xpackcreator.hxx"
120 : : #include "plugin.hxx"
121 : : #include "iframe.hxx"
122 : : #include <ownsubfilterservice.hxx>
123 : : #include "SfxDocumentMetaData.hxx"
124 : :
125 : : #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler"
126 : :
127 : : #include <sfxslots.hxx>
128 : :
129 : : // needs to be converted to a better data structure
130 : : SfxFormalArgument aFormalArgs[] = {
131 : : SFX_ARGUMENT(SID_DEFAULTFILENAME,"SuggestedSaveAsName",SfxStringItem),
132 : : SFX_ARGUMENT(SID_DEFAULTFILEPATH,"SuggestedSaveAsDir",SfxStringItem),
133 : : SFX_ARGUMENT(SID_DOCINFO_AUTHOR,"VersionAuthor",SfxStringItem),
134 : : SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxStringItem),
135 : : SFX_ARGUMENT(SID_FILE_FILTEROPTIONS,"FilterOptions",SfxStringItem),
136 : : SFX_ARGUMENT(SID_FILTER_NAME,"FilterName",SfxStringItem),
137 : : // SFX_ARGUMENT(SID_FILE_NAME,"FileName",SfxStringItem),
138 : : SFX_ARGUMENT(SID_FILE_NAME,"URL",SfxStringItem),
139 : : SFX_ARGUMENT(SID_OPTIONS,"OpenFlags",SfxStringItem),
140 : : SFX_ARGUMENT(SID_OVERWRITE,"Overwrite",SfxBoolItem),
141 : : SFX_ARGUMENT(SID_PASSWORD,"Password",SfxStringItem),
142 : : SFX_ARGUMENT(SID_PASSWORDINTERACTION,"PasswordInteraction",SfxBoolItem),
143 : : SFX_ARGUMENT(SID_REFERER,"Referer",SfxStringItem),
144 : : SFX_ARGUMENT(SID_SAVETO,"SaveTo",SfxBoolItem),
145 : : SFX_ARGUMENT(SID_TEMPLATE_NAME,"TemplateName",SfxStringItem),
146 : : SFX_ARGUMENT(SID_TEMPLATE_REGIONNAME,"TemplateRegion",SfxStringItem),
147 : : // SFX_ARGUMENT(SID_TEMPLATE_REGIONNAME,"Region",SfxStringItem),
148 : : // SFX_ARGUMENT(SID_TEMPLATE_NAME,"Name",SfxStringItem),
149 : : SFX_ARGUMENT(SID_UNPACK,"Unpacked",SfxBoolItem),
150 : : SFX_ARGUMENT(SID_VERSION,"Version",SfxInt16Item),
151 : : };
152 : :
153 : : static sal_uInt16 nMediaArgsCount = sizeof(aFormalArgs) / sizeof (SfxFormalArgument);
154 : :
155 : : static char const sTemplateRegionName[] = "TemplateRegionName";
156 : : static char const sTemplateName[] = "TemplateName";
157 : : static char const sAsTemplate[] = "AsTemplate";
158 : : static char const sOpenNewView[] = "OpenNewView";
159 : : static char const sViewId[] = "ViewId";
160 : : static char const sPluginMode[] = "PluginMode";
161 : : static char const sReadOnly[] = "ReadOnly";
162 : : static char const sDdeReconnect[] = "DDEReconnect";
163 : : static char const sStartPresentation[] = "StartPresentation";
164 : : static char const sFrameName[] = "FrameName";
165 : : static char const sMediaType[] = "MediaType";
166 : : static char const sPostData[] = "PostData";
167 : : static char const sCharacterSet[] = "CharacterSet";
168 : : static char const sInputStream[] = "InputStream";
169 : : static char const sStream[] = "Stream";
170 : : static char const sOutputStream[] = "OutputStream";
171 : : static char const sHidden[] = "Hidden";
172 : : static char const sPreview[] = "Preview";
173 : : static char const sViewOnly[] = "ViewOnly";
174 : : static char const sDontEdit[] = "DontEdit";
175 : : static char const sSilent[] = "Silent";
176 : : static char const sJumpMark[] = "JumpMark";
177 : : static char const sFileName[] = "FileName";
178 : : static char const sSalvagedFile[] = "SalvagedFile";
179 : : static char const sStatusInd[] = "StatusIndicator";
180 : : static char const sModel[] = "Model";
181 : : static char const sFrame[] = "Frame";
182 : : static char const sViewData[] = "ViewData";
183 : : static char const sFilterData[] = "FilterData";
184 : : static char const sSelectionOnly[] = "SelectionOnly";
185 : : static char const sFilterFlags[] = "FilterFlags";
186 : : static char const sMacroExecMode[] = "MacroExecutionMode";
187 : : static char const sUpdateDocMode[] = "UpdateDocMode";
188 : : static char const sMinimized[] = "Minimized";
189 : : static char const sInteractionHdl[] = "InteractionHandler";
190 : : static char const sUCBContent[] = "UCBContent";
191 : : static char const sRepairPackage[] = "RepairPackage";
192 : : static char const sDocumentTitle[] = "DocumentTitle";
193 : : static char const sComponentData[] = "ComponentData";
194 : : static char const sComponentContext[] = "ComponentContext";
195 : : static char const sDocumentBaseURL[] = "DocumentBaseURL";
196 : : static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName";
197 : : static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible";
198 : : static char const sNoAutoSave[] = "NoAutoSave";
199 : : static char const sFolderName[] = "FolderName";
200 : : static char const sUseSystemDialog[] = "UseSystemDialog";
201 : : static char const sStandardDir[] = "StandardDir";
202 : : static char const sBlackList[] = "BlackList";
203 : : static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
204 : : static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
205 : : static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
206 : : static char const sEncryptionData[] = "EncryptionData";
207 : : static char const sFailOnWarning[] = "FailOnWarning";
208 : : static char const sDocumentService[] = "DocumentService";
209 : :
210 : 32888 : static bool isMediaDescriptor( sal_uInt16 nSlotId )
211 : : {
212 : : return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC ||
213 : : nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
214 : : nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF ||
215 [ + + ][ + - ]: 32888 : nSlotId == SID_DIRECTEXPORTDOCASPDF );
[ + + ][ + - ]
[ + - ][ + - ]
[ - + ]
216 : : }
217 : :
218 : 14178 : void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
219 : : {
220 [ + + ]: 14178 : if ( !pSlot )
221 : 14116 : pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
222 : :
223 [ - + ]: 14178 : if ( !pSlot )
224 : 0 : return;
225 : :
226 [ - + ]: 14178 : if ( nSlotId == SID_OPENURL )
227 : 0 : nSlotId = SID_OPENDOC;
228 [ - + ]: 14178 : if ( nSlotId == SID_SAVEASURL )
229 : 0 : nSlotId = SID_SAVEASDOC;
230 : :
231 : 14178 : sal_Int32 nCount = rArgs.getLength();
232 [ + + ]: 14178 : if ( !nCount )
233 : 512 : return;
234 : :
235 : 13666 : const ::com::sun::star::beans::PropertyValue* pPropsVal = rArgs.getConstArray();
236 [ + + ]: 13666 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
237 : : {
238 : : // slot is a property
239 : 2 : const SfxType* pType = pSlot->GetType();
240 [ + - ]: 2 : SfxPoolItem* pItem = pType->CreateItem();
241 [ + - ]: 2 : if ( !pItem )
242 : : {
243 : : #ifdef DBG_UTIL
244 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
245 : : "No creator method for item: "));
246 : : aStr.append(static_cast<sal_Int32>(nSlotId));
247 : : OSL_FAIL(aStr.getStr());
248 : : #endif
249 : : return;
250 : : }
251 : :
252 [ + - ]: 2 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
253 [ + - ]: 2 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
254 : 2 : pItem->SetWhich( nWhich );
255 : 2 : sal_uInt16 nSubCount = pType->nAttribs;
256 : :
257 : 2 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[0];
258 [ + - ]: 2 : String aName = rProp.Name;
259 [ + - ][ + - ]: 2 : if ( nCount == 1 && aName.CompareToAscii( pSlot->pUnoName ) == COMPARE_EQUAL )
[ + - ][ + - ]
260 : : {
261 : : // there is only one parameter and its name matches the name of the property,
262 : : // so it's either a simple property or a complex property in one single UNO struct
263 [ - + ][ + - ]: 2 : if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
[ + - ]
264 : : // only use successfully converted items
265 [ + - ]: 2 : rSet.Put( *pItem );
266 : : #ifdef DBG_UTIL
267 : : else
268 : : {
269 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Property not convertable: "));
270 : : aStr.append(pSlot->pUnoName);
271 : : OSL_FAIL( aStr.getStr() );
272 : : }
273 : : #endif
274 : : }
275 : : #ifdef DBG_UTIL
276 : : else if ( nSubCount == 0 )
277 : : {
278 : : // for a simple property there can be only one parameter and its name *must* match
279 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Property name does not match: "));
280 : : aStr.append(rtl::OUStringToOString(aName, RTL_TEXTENCODING_UTF8));
281 : : OSL_FAIL( aStr.getStr() );
282 : : }
283 : : #endif
284 : : else
285 : : {
286 : : // there is more than one parameter and the property is a complex one
287 : : #ifdef DBG_UTIL
288 : : // if the dispatch API is used for UI purposes or from the testtool,
289 : : // it is possible to skip some or all arguments,
290 : : // but it indicates an error for macro recording;
291 : : // so this should be notified as a warning only
292 : : if ( nCount != nSubCount )
293 : : {
294 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
295 : : "MacroPlayer: wrong number of parameters for slot: "));
296 : : aStr.append(static_cast<sal_Int32>(nSlotId));
297 : : DBG_WARNING(aStr.getStr());
298 : : }
299 : : #endif
300 : : // complex property; collect sub items from the parameter set and reconstruct complex item
301 : 0 : sal_uInt16 nFound=0;
302 [ # # ]: 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
303 : : {
304 : 0 : const ::com::sun::star::beans::PropertyValue& rPropValue = pPropsVal[n];
305 : : sal_uInt16 nSub;
306 [ # # ]: 0 : for ( nSub=0; nSub<nSubCount; nSub++ )
307 : : {
308 : : // search sub item by name
309 : 0 : rtl::OStringBuffer aStr;
310 [ # # ][ # # ]: 0 : aStr.append(pSlot->pUnoName).append('.').append(pType->aAttrib[nSub].pName);
[ # # ]
311 [ # # ]: 0 : if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
312 : : {
313 : 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
314 [ # # ]: 0 : if ( bConvertTwips )
315 : 0 : nSubId |= CONVERT_TWIPS;
316 [ # # ][ # # ]: 0 : if ( pItem->PutValue( rPropValue.Value, nSubId ) )
317 : 0 : nFound++;
318 : : #ifdef DBG_UTIL
319 : : else
320 : : {
321 : : rtl::OStringBuffer aDbgStr(RTL_CONSTASCII_STRINGPARAM("Property not convertable: "));
322 : : aDbgStr.append(pSlot->pUnoName);
323 : : OSL_FAIL( aDbgStr.getStr() );
324 : : }
325 : : #endif
326 : : break;
327 : : }
328 [ # # ]: 0 : }
329 : :
330 : : #ifdef DBG_UTIL
331 : : if ( nSub >= nSubCount )
332 : : {
333 : : // there was a parameter with a name that didn't match to any of the members
334 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Property name does not match: "));
335 : : aStr.append(rtl::OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8));
336 : : OSL_FAIL( aStr.getStr() );
337 : : }
338 : : #endif
339 : : }
340 : :
341 : : // at least one part of the complex item must be present; other parts can have default values
342 [ # # ]: 0 : if ( nFound > 0 )
343 [ # # ]: 0 : rSet.Put( *pItem );
344 : : }
345 : :
346 [ + - ][ + - ]: 2 : delete pItem;
[ + - ]
347 : : }
348 [ + - ]: 13664 : else if ( nCount )
349 : : {
350 : : #ifdef DBG_UTIL
351 : : // detect parameters that don't match to any formal argument or one of its members
352 : : sal_Int32 nFoundArgs = 0;
353 : : #endif
354 : : // slot is a method
355 : 13664 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
356 [ + + ]: 13664 : sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
357 [ + + ]: 245792 : for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
358 : : {
359 [ + + ]: 232128 : const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
360 : 232128 : SfxPoolItem* pItem = rArg.CreateItem();
361 [ - + ]: 232128 : if ( !pItem )
362 : : {
363 : : #ifdef DBG_UTIL
364 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("No creator method for argument: "));
365 : : aStr.append(rArg.pName);
366 : : OSL_FAIL( aStr.getStr() );
367 : : #endif
368 : 0 : return;
369 : : }
370 : :
371 : 232128 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
372 : 232128 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
373 : 232128 : pItem->SetWhich( nWhich );
374 : 232128 : const SfxType* pType = rArg.pType;
375 : 232128 : sal_uInt16 nSubCount = pType->nAttribs;
376 [ + - ]: 232128 : if ( nSubCount == 0 )
377 : : {
378 : : // "simple" (base type) argument
379 [ + + ]: 1147601 : for ( sal_uInt16 n=0; n<nCount; n++ )
380 : : {
381 : 915473 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
382 [ + - ]: 915473 : String aName = rProp.Name;
383 [ + - ][ + + ]: 915473 : if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
384 : : {
385 : : #ifdef DBG_UTIL
386 : : ++nFoundArgs;
387 : : #endif
388 [ + - ][ + - ]: 11688 : if( pItem->PutValue( rProp.Value ) )
389 : : // only use successfully converted items
390 [ + - ]: 915473 : rSet.Put( *pItem );
391 : : #ifdef DBG_UTIL
392 : : else
393 : : {
394 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Property not convertable: "));
395 : : aStr.append(rArg.pName);
396 : : OSL_FAIL( aStr.getStr() );
397 : : }
398 : : #endif
399 : : break;
400 : : }
401 [ + - ][ + + ]: 915473 : }
402 : : }
403 : : else
404 : : {
405 : : // complex argument, could be passed in one struct
406 : 0 : sal_Bool bAsWholeItem = sal_False;
407 [ # # ]: 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
408 : : {
409 : 0 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
410 [ # # ]: 0 : String aName = rProp.Name;
411 [ # # ][ # # ]: 0 : if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
412 : : {
413 : 0 : bAsWholeItem = sal_True;
414 : : #ifdef DBG_UTIL
415 : : ++nFoundArgs;
416 : : #endif
417 [ # # ][ # # ]: 0 : if( pItem->PutValue( rProp.Value ) )
418 : : // only use successfully converted items
419 [ # # ]: 0 : rSet.Put( *pItem );
420 : : #ifdef DBG_UTIL
421 : : else
422 : : {
423 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Property not convertable: "));
424 : : aStr.append(rArg.pName);
425 : : OSL_FAIL( aStr.getStr() );
426 : : }
427 : : #endif
428 : : }
429 [ # # ]: 0 : }
430 : :
431 [ # # ]: 0 : if ( !bAsWholeItem )
432 : : {
433 : : // complex argument; collect sub items from argument array and reconstruct complex item
434 : : // only put item if at least one member was found and had the correct type
435 : : // (is this a good idea?! Should we ask for *all* members?)
436 : 0 : sal_Bool bRet = sal_False;
437 [ # # ]: 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
438 : : {
439 : 0 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
440 [ # # ]: 0 : for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
441 : : {
442 : : // search sub item by name
443 : 0 : rtl::OStringBuffer aStr;
444 [ # # ][ # # ]: 0 : aStr.append(rArg.pName).append('.').append(pType->aAttrib[nSub].pName);
[ # # ]
445 [ # # ]: 0 : if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
446 : : {
447 : : // at least one member found ...
448 : 0 : bRet = sal_True;
449 : : #ifdef DBG_UTIL
450 : : ++nFoundArgs;
451 : : #endif
452 : 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
453 [ # # ]: 0 : if ( bConvertTwips )
454 : 0 : nSubId |= CONVERT_TWIPS;
455 [ # # ][ # # ]: 0 : if (!pItem->PutValue( rProp.Value, nSubId ) )
456 : : {
457 : : // ... but it was not convertable
458 : 0 : bRet = sal_False;
459 : : #ifdef DBG_UTIL
460 : : rtl::OStringBuffer aDbgStr(RTL_CONSTASCII_STRINGPARAM("Property not convertable: "));
461 : : aDbgStr.append(rArg.pName);
462 : : OSL_FAIL( aDbgStr.getStr() );
463 : : #endif
464 : : }
465 : :
466 : : break;
467 : : }
468 [ # # ]: 0 : }
469 : : }
470 : :
471 [ # # ]: 0 : if ( bRet )
472 : : // only use successfully converted items
473 : 0 : rSet.Put( *pItem );
474 : :
475 : : }
476 : : }
477 : :
478 [ + - ]: 232128 : delete pItem;
479 : : }
480 : :
481 : : // special additional parameters for some slots not seen in the slot definitions
482 : : // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
483 : : // but as dispatching or factory or arbitrary URLs to the frame
484 : : // Some also can use additional arguments that are not recordable (will be changed later,
485 : : // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
486 [ - + ]: 13664 : if ( nSlotId == SID_NEWWINDOW )
487 : : {
488 [ # # ]: 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
489 : : {
490 : 0 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
491 : 0 : rtl::OUString aName = rProp.Name;
492 [ # # ]: 0 : if ( aName == sFrame )
493 : : {
494 : 0 : Reference< XFrame > xFrame;
495 [ # # ]: 0 : OSL_VERIFY( rProp.Value >>= xFrame );
496 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
[ # # ]
497 : : }
498 : : else
499 [ # # ]: 0 : if ( aName == sHidden )
500 : : {
501 : 0 : sal_Bool bVal = sal_False;
502 [ # # ]: 0 : if (rProp.Value >>= bVal)
503 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
[ # # ]
504 : : }
505 : 0 : }
506 : : }
507 [ + + ]: 13664 : else if ( bIsMediaDescriptor )
508 : : {
509 [ + + ]: 70033 : for ( sal_uInt16 n=0; n<nCount; n++ )
510 : : {
511 : : #ifdef DBG_UTIL
512 : : ++nFoundArgs;
513 : : #endif
514 : 56379 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
515 : 56379 : rtl::OUString aName = rProp.Name;
516 [ - + ]: 56379 : if ( aName == sModel )
517 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
[ # # ]
518 [ - + ]: 56379 : else if ( aName == sComponentData )
519 : : {
520 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
[ # # ]
521 : : }
522 [ - + ]: 56379 : else if ( aName == sComponentContext )
523 : : {
524 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
[ # # ]
525 : : }
526 [ + + ]: 56379 : else if ( aName == sStatusInd )
527 : : {
528 : 598 : Reference< ::com::sun::star::task::XStatusIndicator > xVal;
529 [ + - ]: 598 : sal_Bool bOK = (rProp.Value >>= xVal);
530 : : DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
531 [ + - ][ + - ]: 598 : if (bOK && xVal.is())
[ + - ]
532 [ + - ][ + - ]: 598 : rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
[ + - ]
533 : : }
534 [ + + ]: 55781 : else if ( aName == sInteractionHdl )
535 : : {
536 : 4626 : Reference< ::com::sun::star::task::XInteractionHandler > xVal;
537 [ + - ]: 4626 : sal_Bool bOK = (rProp.Value >>= xVal);
538 : : DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
539 [ + - ][ + + ]: 4626 : if (bOK && xVal.is())
[ + + ]
540 [ + - ][ + - ]: 4626 : rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
[ + - ]
541 : : }
542 [ - + ]: 51155 : else if ( aName == sViewData )
543 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
[ # # ]
544 [ - + ]: 51155 : else if ( aName == sFilterData )
545 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
[ # # ]
546 [ + + ]: 51155 : else if ( aName == sInputStream )
547 : : {
548 : 1365 : Reference< XInputStream > xVal;
549 [ + - ][ + - ]: 1365 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
[ + - ]
550 : : DBG_ASSERT( bOK, "invalid type for InputStream" );
551 [ + - ]: 1365 : if (bOK)
552 [ + - ][ + - ]: 1365 : rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
[ + - ]
553 : : }
554 [ + + ]: 49790 : else if ( aName == sStream )
555 : : {
556 : 157 : Reference< XInputStream > xVal;
557 [ + - ][ + - ]: 157 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
[ + - ]
558 : : DBG_ASSERT( bOK, "invalid type for Stream" );
559 [ + - ]: 157 : if (bOK)
560 [ + - ][ + - ]: 157 : rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
[ + - ]
561 : : }
562 [ + + ]: 49633 : else if ( aName == sUCBContent )
563 : : {
564 : 2308 : Reference< XContent > xVal;
565 [ + - ][ + - ]: 2308 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
[ + - ]
566 : : DBG_ASSERT( bOK, "invalid type for UCBContent" );
567 [ + - ]: 2308 : if (bOK)
568 [ + - ][ + - ]: 2308 : rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
[ + - ]
569 : : }
570 [ + + ]: 47325 : else if ( aName == sOutputStream )
571 : : {
572 : 57 : Reference< XOutputStream > xVal;
573 [ + - ][ + - ]: 57 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
[ + - ]
574 : : DBG_ASSERT( bOK, "invalid type for OutputStream" );
575 [ + - ]: 57 : if (bOK)
576 [ + - ][ + - ]: 57 : rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
[ + - ]
577 : : }
578 [ - + ]: 47268 : else if ( aName == sPostData )
579 : : {
580 : 0 : Reference< XInputStream > xVal;
581 [ # # ]: 0 : sal_Bool bOK = (rProp.Value >>= xVal);
582 : : DBG_ASSERT( bOK, "invalid type for PostData" );
583 [ # # ]: 0 : if (bOK)
584 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
[ # # ]
585 : : }
586 [ + + ]: 47268 : else if ( aName == sFrame )
587 : : {
588 : 2408 : Reference< XFrame > xFrame;
589 [ + - ]: 2408 : sal_Bool bOK = (rProp.Value >>= xFrame);
590 : : DBG_ASSERT( bOK, "invalid type for Frame" );
591 [ + - ]: 2408 : if (bOK)
592 [ + - ][ + - ]: 2408 : rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
[ + - ]
593 : : }
594 [ + + ]: 44860 : else if ( aName == sAsTemplate )
595 : : {
596 : 32 : sal_Bool bVal = sal_False;
597 : 32 : sal_Bool bOK = (rProp.Value >>= bVal);
598 : : DBG_ASSERT( bOK, "invalid type for AsTemplate" );
599 [ + - ]: 32 : if (bOK)
600 [ + - ][ + - ]: 32 : rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
[ + - ]
601 : : }
602 [ - + ]: 44828 : else if ( aName == sOpenNewView )
603 : : {
604 : 0 : sal_Bool bVal = sal_False;
605 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
606 : : DBG_ASSERT( bOK, "invalid type for OpenNewView" );
607 [ # # ]: 0 : if (bOK)
608 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
[ # # ]
609 : : }
610 [ - + ]: 44828 : else if ( aName == sFailOnWarning )
611 : : {
612 : 0 : sal_Bool bVal = sal_False;
613 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
614 : : DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
615 [ # # ]: 0 : if (bOK)
616 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
[ # # ]
617 : : }
618 [ + + ]: 44828 : else if ( aName == sViewId )
619 : : {
620 : 40 : sal_Int16 nVal = -1;
621 [ + - ][ + - ]: 40 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
622 : : DBG_ASSERT( bOK, "invalid type for ViewId" );
623 [ + - ]: 40 : if (bOK)
624 [ + - ][ + - ]: 40 : rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
[ + - ]
625 : : }
626 [ - + ]: 44788 : else if ( aName == sPluginMode )
627 : : {
628 : 0 : sal_Int16 nVal = -1;
629 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
630 : : DBG_ASSERT( bOK, "invalid type for PluginMode" );
631 [ # # ]: 0 : if (bOK)
632 [ # # ][ # # ]: 0 : rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
[ # # ]
633 : : }
634 [ + + ]: 44788 : else if ( aName == sReadOnly )
635 : : {
636 : 322 : sal_Bool bVal = sal_False;
637 : 322 : sal_Bool bOK = (rProp.Value >>= bVal);
638 : : DBG_ASSERT( bOK, "invalid type for ReadOnly" );
639 [ + - ]: 322 : if (bOK)
640 [ + - ][ + - ]: 322 : rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
[ + - ]
641 : : }
642 [ - + ]: 44466 : else if ( aName == sDdeReconnect )
643 : : {
644 : 0 : sal_Bool bVal = sal_True;
645 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
646 : : DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
647 [ # # ]: 0 : if (bOK)
648 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
[ # # ]
649 : : }
650 [ - + ]: 44466 : else if ( aName == sStartPresentation )
651 : : {
652 : 0 : sal_Bool bVal = sal_False;
653 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
654 : : DBG_ASSERT( bOK, "invalid type for StartPresentation" );
655 [ # # ]: 0 : if (bOK)
656 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
[ # # ]
657 : : }
658 [ - + ]: 44466 : else if ( aName == sSelectionOnly )
659 : : {
660 : 0 : sal_Bool bVal = sal_False;
661 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
662 : : DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
663 [ # # ]: 0 : if (bOK)
664 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
[ # # ]
665 : : }
666 [ + + ]: 44466 : else if ( aName == sHidden )
667 : : {
668 : 78 : sal_Bool bVal = sal_False;
669 : 78 : sal_Bool bOK = (rProp.Value >>= bVal);
670 : : DBG_ASSERT( bOK, "invalid type for Hidden" );
671 [ + - ]: 78 : if (bOK)
672 [ + - ][ + - ]: 78 : rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
[ + - ]
673 : : }
674 [ - + ]: 44388 : else if ( aName == sMinimized )
675 : : {
676 : 0 : sal_Bool bVal = sal_False;
677 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
678 : : DBG_ASSERT( bOK, "invalid type for Minimized" );
679 [ # # ]: 0 : if (bOK)
680 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
[ # # ]
681 : : }
682 [ - + ]: 44388 : else if ( aName == sSilent )
683 : : {
684 : 0 : sal_Bool bVal = sal_False;
685 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
686 : : DBG_ASSERT( bOK, "invalid type for Silent" );
687 [ # # ]: 0 : if (bOK)
688 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
[ # # ]
689 : : }
690 [ - + ]: 44388 : else if ( aName == sPreview )
691 : : {
692 : 0 : sal_Bool bVal = sal_False;
693 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
694 : : DBG_ASSERT( bOK, "invalid type for Preview" );
695 [ # # ]: 0 : if (bOK)
696 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
[ # # ]
697 : : }
698 [ - + ]: 44388 : else if ( aName == sViewOnly )
699 : : {
700 : 0 : sal_Bool bVal = sal_False;
701 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
702 : : DBG_ASSERT( bOK, "invalid type for ViewOnly" );
703 [ # # ]: 0 : if (bOK)
704 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
[ # # ]
705 : : }
706 [ - + ]: 44388 : else if ( aName == sDontEdit )
707 : : {
708 : 0 : sal_Bool bVal = sal_False;
709 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
710 : : DBG_ASSERT( bOK, "invalid type for ViewOnly" );
711 [ # # ]: 0 : if (bOK)
712 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
[ # # ]
713 : : }
714 [ - + ]: 44388 : else if ( aName == sUseSystemDialog )
715 : : {
716 : 0 : sal_Bool bVal = sal_False;
717 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
718 : : DBG_ASSERT( bOK, "invalid type for ViewOnly" );
719 [ # # ]: 0 : if (bOK)
720 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
[ # # ]
721 : : }
722 [ - + ]: 44388 : else if ( aName == sStandardDir )
723 : : {
724 : 0 : ::rtl::OUString sVal;
725 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
726 : : DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
727 [ # # ]: 0 : if (bOK)
728 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
[ # # ][ # # ]
[ # # ]
729 : : }
730 [ - + ]: 44388 : else if ( aName == sBlackList )
731 : : {
732 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal;
733 [ # # ]: 0 : sal_Bool bOK = (rProp.Value >>= xVal);
734 : : DBG_ASSERT( bOK, "invalid type or value for BlackList" );
735 [ # # ]: 0 : if (bOK)
736 : : {
737 [ # # ]: 0 : SfxStringListItem stringList(SID_BLACK_LIST);
738 [ # # ]: 0 : stringList.SetStringList( xVal );
739 [ # # ][ # # ]: 0 : rSet.Put( stringList );
740 [ # # ]: 0 : }
741 : : }
742 [ + + ]: 44388 : else if ( aName == sFileName )
743 : : {
744 : 702 : ::rtl::OUString sVal;
745 [ + - ][ + - ]: 702 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
746 : : DBG_ASSERT( bOK, "invalid type or value for FileName" );
747 [ + - ]: 702 : if (bOK)
748 [ + - ][ + - ]: 702 : rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
[ + - ][ + - ]
[ + - ]
749 : : }
750 [ - + ]: 43686 : else if ( aName == sSalvagedFile )
751 : : {
752 : 0 : ::rtl::OUString sVal;
753 : 0 : sal_Bool bOK = (rProp.Value >>= sVal);
754 : : DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
755 [ # # ]: 0 : if (bOK)
756 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
[ # # ][ # # ]
[ # # ]
757 : : }
758 [ - + ]: 43686 : else if ( aName == sFolderName )
759 : : {
760 : 0 : ::rtl::OUString sVal;
761 : 0 : sal_Bool bOK = (rProp.Value >>= sVal);
762 : : DBG_ASSERT( bOK, "invalid type or value for FolderName" );
763 [ # # ]: 0 : if (bOK)
764 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_PATH, sVal ) );
[ # # ][ # # ]
[ # # ]
765 : : }
766 [ - + ]: 43686 : else if ( aName == sFrameName )
767 : : {
768 : 0 : ::rtl::OUString sVal;
769 : 0 : sal_Bool bOK = (rProp.Value >>= sVal);
770 : : DBG_ASSERT( bOK, "invalid type for FrameName" );
771 [ # # ][ # # ]: 0 : if (bOK && !sVal.isEmpty())
[ # # ]
772 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
[ # # ][ # # ]
[ # # ]
773 : : }
774 [ + + ]: 43686 : else if ( aName == sMediaType )
775 : : {
776 : 8 : ::rtl::OUString sVal;
777 [ + - ][ + - ]: 8 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
778 : : DBG_ASSERT( bOK, "invalid type or value for MediaType" );
779 [ + - ]: 8 : if (bOK)
780 [ + - ][ + - ]: 8 : rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
[ + - ][ + - ]
[ + - ]
781 : : }
782 [ - + ]: 43678 : else if ( aName == sTemplateName )
783 : : {
784 : 0 : ::rtl::OUString sVal;
785 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
786 : : DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
787 [ # # ]: 0 : if (bOK)
788 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
[ # # ][ # # ]
[ # # ]
789 : : }
790 [ - + ]: 43678 : else if ( aName == sTemplateRegionName )
791 : : {
792 : 0 : ::rtl::OUString sVal;
793 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
794 : : DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
795 [ # # ]: 0 : if (bOK)
796 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
[ # # ][ # # ]
[ # # ]
797 : : }
798 [ - + ]: 43678 : else if ( aName == sJumpMark )
799 : : {
800 : 0 : ::rtl::OUString sVal;
801 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
802 : : DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
803 [ # # ]: 0 : if (bOK)
804 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
[ # # ][ # # ]
[ # # ]
805 : : }
806 [ - + ]: 43678 : else if ( aName == sCharacterSet )
807 : : {
808 : 0 : ::rtl::OUString sVal;
809 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
810 : : DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
811 [ # # ]: 0 : if (bOK)
812 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
[ # # ][ # # ]
[ # # ]
813 : : }
814 [ - + ]: 43678 : else if ( aName == sFilterFlags )
815 : : {
816 : 0 : ::rtl::OUString sVal;
817 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
818 : : DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
819 [ # # ]: 0 : if (bOK)
820 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
[ # # ][ # # ]
[ # # ]
821 : : }
822 [ + + ]: 43678 : else if ( aName == sMacroExecMode )
823 : : {
824 : 6520 : sal_Int16 nVal =-1;
825 [ + - ][ + - ]: 6520 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
826 : : DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
827 [ + - ]: 6520 : if (bOK)
828 [ + - ][ + - ]: 6520 : rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
[ + - ]
829 : : }
830 [ + + ]: 37158 : else if ( aName == sUpdateDocMode )
831 : : {
832 : 4701 : sal_Int16 nVal =-1;
833 [ + - ][ + - ]: 4701 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
834 : : DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
835 [ + - ]: 4701 : if (bOK)
836 [ + - ][ + - ]: 4701 : rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
[ + - ]
837 : : }
838 [ - + ]: 32457 : else if ( aName == sRepairPackage )
839 : : {
840 : 0 : sal_Bool bVal = sal_False;
841 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
842 : : DBG_ASSERT( bOK, "invalid type for RepairPackage" );
843 [ # # ]: 0 : if (bOK)
844 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
[ # # ]
845 : : }
846 [ - + ]: 32457 : else if ( aName == sDocumentTitle )
847 : : {
848 : 0 : ::rtl::OUString sVal;
849 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
850 : : DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
851 [ # # ]: 0 : if (bOK)
852 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
[ # # ][ # # ]
[ # # ]
853 : : }
854 [ + + ]: 32457 : else if ( aName == sDocumentBaseURL )
855 : : {
856 : 3324 : ::rtl::OUString sVal;
857 : : // the base url can be set to empty ( for embedded objects for example )
858 : 3324 : sal_Bool bOK = (rProp.Value >>= sVal);
859 : : DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
860 [ + - ]: 3324 : if (bOK)
861 [ + - ][ + - ]: 3324 : rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
[ + - ][ + - ]
[ + - ]
862 : : }
863 [ + + ]: 29133 : else if ( aName == sHierarchicalDocumentName )
864 : : {
865 : 852 : ::rtl::OUString sVal;
866 [ + - ][ + - ]: 852 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
867 : : DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
868 [ + - ]: 852 : if (bOK)
869 [ + - ][ + - ]: 852 : rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
[ + - ][ + - ]
[ + - ]
870 : : }
871 [ - + ]: 28281 : else if ( aName == sCopyStreamIfPossible )
872 : : {
873 : 0 : sal_Bool bVal = sal_False;
874 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
875 : : DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
876 [ # # ]: 0 : if (bOK)
877 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
[ # # ]
878 : : }
879 [ - + ]: 28281 : else if ( aName == sNoAutoSave )
880 : : {
881 : 0 : sal_Bool bVal = sal_False;
882 : 0 : sal_Bool bOK = (rProp.Value >>= bVal);
883 : : DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
884 [ # # ]: 0 : if (bOK)
885 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
[ # # ]
886 : : }
887 [ - + ]: 28281 : else if ( aName == sModifyPasswordInfo )
888 : : {
889 [ # # ][ # # ]: 0 : rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
[ # # ]
890 : : }
891 [ + + ]: 28281 : else if ( aName == sEncryptionData )
892 : : {
893 [ + - ][ + - ]: 6 : rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
[ + - ]
894 : : }
895 [ - + ]: 28275 : else if ( aName == sSuggestedSaveAsDir )
896 : : {
897 : 0 : ::rtl::OUString sVal;
898 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
899 : : DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
900 [ # # ]: 0 : if (bOK)
901 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
[ # # ][ # # ]
[ # # ]
902 : : }
903 [ - + ]: 28275 : else if ( aName == sSuggestedSaveAsName )
904 : : {
905 : 0 : ::rtl::OUString sVal;
906 [ # # ][ # # ]: 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
907 : : DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
908 [ # # ]: 0 : if (bOK)
909 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
[ # # ][ # # ]
[ # # ]
910 : : }
911 [ + + ]: 28275 : else if (aName == sDocumentService)
912 : : {
913 : 4241 : rtl::OUString aVal;
914 [ + - ][ + - ]: 4241 : bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
915 [ + - ]: 4241 : if (bOK)
916 [ + - ][ + - ]: 4241 : rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
[ + - ][ + - ]
[ + - ]
917 : : }
918 : : #ifdef DBG_UTIL
919 : : else
920 : : --nFoundArgs;
921 : : #endif
922 : 56379 : }
923 : : }
924 : : // API to raise options dialog with a specified options ab page (#i83757#)
925 : : else
926 : : {
927 : : // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
928 [ + - ]: 10 : String sSlotName( DEFINE_CONST_UNICODE( "OptionsTreeDialog" ) );
929 [ + - ]: 10 : String sPropName( DEFINE_CONST_UNICODE( "OptionsPageURL" ) );
930 [ + - ][ - + ]: 10 : if ( sSlotName.EqualsAscii( pSlot->pUnoName ) )
931 : : {
932 [ # # ]: 0 : for ( sal_uInt16 n = 0; n < nCount; ++n )
933 : : {
934 : 0 : const PropertyValue& rProp = pPropsVal[n];
935 [ # # ]: 0 : String sName( rProp.Name );
936 [ # # ][ # # ]: 0 : if ( sName == sPropName )
937 : : {
938 : 0 : ::rtl::OUString sURL;
939 [ # # ]: 0 : if ( rProp.Value >>= sURL )
940 [ # # ][ # # ]: 0 : rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
[ # # ][ # # ]
[ # # ]
941 : 0 : break;
942 : : }
943 [ # # ][ # # ]: 0 : }
944 [ + - ][ + - ]: 14178 : }
945 : : }
946 : : #ifdef DB_UTIL
947 : : if ( nFoundArgs == nCount )
948 : : {
949 : : // except for the "special" slots: assure that every argument was convertable
950 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("MacroPlayer: Some properties didn't match to any formal argument for slot: "));
951 : : aStr.append(pSlot->pUnoName);
952 : : DBG_WARNING( aStr.getStr() );
953 : : }
954 : : #endif
955 : : }
956 : : }
957 : :
958 : 19224 : void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
959 : : {
960 [ + - ]: 19224 : if ( !pSlot )
961 [ + - ][ + - ]: 19224 : pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
962 : :
963 [ + - ]: 19224 : if ( !pSlot)
964 : : return;
965 : :
966 [ - + ]: 19224 : if ( nSlotId == SID_OPENURL )
967 : 0 : nSlotId = SID_OPENDOC;
968 [ - + ]: 19224 : if ( nSlotId == SID_SAVEASURL )
969 : 0 : nSlotId = SID_SAVEASDOC;
970 : :
971 : : // find number of properties to avoid permanent reallocations in the sequence
972 : 19224 : sal_Int32 nProps=0;
973 : :
974 : : #ifdef DBG_UTIL
975 : : // trace number of items and compare with number of properties for debugging purposes
976 : : sal_Int32 nItems=0;
977 : : #endif
978 : :
979 : 19224 : const SfxType *pType = pSlot->GetType();
980 [ - + ]: 19224 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
981 : : {
982 : : // slot is a property
983 [ # # ]: 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
984 [ # # ][ # # ]: 0 : if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
985 : : {
986 : 0 : sal_uInt16 nSubCount = pType->nAttribs;
987 [ # # ]: 0 : if ( nSubCount )
988 : : // it's a complex property, we want it split into simple types
989 : : // so we expect to get as many items as we have (sub) members
990 : 0 : nProps = nSubCount;
991 : : else
992 : : // simple property: we expect to get exactly one item
993 : 0 : nProps++;
994 : : }
995 : : #ifdef DBG_UTIL
996 : : else
997 : : {
998 : : // we will not rely on the "toggle" ability of some property slots
999 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
1000 : : "Processing property slot without argument: "));
1001 : : aStr.append(static_cast<sal_Int32>(nSlotId));
1002 : : OSL_FAIL(aStr.getStr());
1003 : : }
1004 : : #endif
1005 : :
1006 : : #ifdef DBG_UTIL
1007 : : nItems++;
1008 : : #endif
1009 : : }
1010 : : else
1011 : : {
1012 : : // slot is a method
1013 : 19224 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1014 [ + - ]: 19224 : sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
1015 [ + + ]: 346032 : for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1016 : : {
1017 : : // check every formal argument of the method
1018 : 326808 : const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1019 : :
1020 [ + - ]: 326808 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1021 [ + - ][ + + ]: 326808 : if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
1022 : : {
1023 : 23335 : sal_uInt16 nSubCount = rArg.pType->nAttribs;
1024 [ - + ]: 23335 : if ( nSubCount )
1025 : : // argument has a complex type, we want it split into simple types
1026 : : // so for this argument we expect to get as many items as we have (sub) members
1027 : 0 : nProps += nSubCount;
1028 : : else
1029 : : // argument of simple type: we expect to get exactly one item for it
1030 : 23335 : nProps++;
1031 : : #ifdef DBG_UTIL
1032 : : nItems++;
1033 : : #endif
1034 : : }
1035 : : }
1036 : :
1037 : : // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
1038 [ + - ]: 19224 : if ( bIsMediaDescriptor )
1039 : : {
1040 : 19224 : sal_Int32 nAdditional=0;
1041 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET )
1042 : 565 : nAdditional++;
1043 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET )
1044 : 10193 : nAdditional++;
1045 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET )
1046 : 0 : nAdditional++;
1047 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_PATH ) == SFX_ITEM_SET )
1048 : 0 : nAdditional++;
1049 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_FILE_DIALOG ) == SFX_ITEM_SET )
1050 : 0 : nAdditional++;
1051 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET )
1052 : 0 : nAdditional++;
1053 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET )
1054 : 0 : nAdditional++;
1055 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET )
1056 : 4298 : nAdditional++;
1057 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET )
1058 : 683 : nAdditional++;
1059 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_STREAM ) == SFX_ITEM_SET )
1060 : 71 : nAdditional++;
1061 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET )
1062 : 0 : nAdditional++;
1063 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET )
1064 : 45 : nAdditional++;
1065 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET )
1066 : 0 : nAdditional++;
1067 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SFX_ITEM_SET )
1068 : 0 : nAdditional++;
1069 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET )
1070 : 88 : nAdditional++;
1071 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET )
1072 : 0 : nAdditional++;
1073 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET )
1074 : 0 : nAdditional++;
1075 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET )
1076 : 0 : nAdditional++;
1077 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET )
1078 : 1098 : nAdditional++;
1079 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SFX_ITEM_SET )
1080 : 0 : nAdditional++;
1081 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET )
1082 : 0 : nAdditional++;
1083 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET )
1084 : 0 : nAdditional++;
1085 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET )
1086 : 8 : nAdditional++;
1087 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET )
1088 : 0 : nAdditional++;
1089 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET )
1090 : 3848 : nAdditional++;
1091 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET )
1092 : 0 : nAdditional++;
1093 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET )
1094 : 0 : nAdditional++;
1095 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET )
1096 : 0 : nAdditional++;
1097 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET )
1098 : 0 : nAdditional++;
1099 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET )
1100 : 176 : nAdditional++;
1101 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_MINIMIZED ) == SFX_ITEM_SET )
1102 : 0 : nAdditional++;
1103 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET )
1104 : 0 : nAdditional++;
1105 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET )
1106 : 0 : nAdditional++;
1107 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET )
1108 : 0 : nAdditional++;
1109 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET )
1110 : 0 : nAdditional++;
1111 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET )
1112 : 0 : nAdditional++;
1113 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET )
1114 : 0 : nAdditional++;
1115 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET )
1116 : 12339 : nAdditional++;
1117 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET )
1118 : 10372 : nAdditional++;
1119 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET )
1120 : 0 : nAdditional++;
1121 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET )
1122 : 0 : nAdditional++;
1123 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_COMPONENTDATA ) == SFX_ITEM_SET )
1124 : 0 : nAdditional++;
1125 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SFX_ITEM_SET )
1126 : 0 : nAdditional++;
1127 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_DOC_BASEURL ) == SFX_ITEM_SET )
1128 : 5935 : nAdditional++;
1129 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SFX_ITEM_SET )
1130 : 0 : nAdditional++;
1131 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SFX_ITEM_SET )
1132 : 0 : nAdditional++;
1133 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET )
1134 : 0 : nAdditional++;
1135 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
1136 : 0 : nAdditional++;
1137 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
1138 : 0 : nAdditional++;
1139 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET )
1140 : 6 : nAdditional++;
1141 [ + - ][ - + ]: 19224 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
1142 : 0 : nAdditional++;
1143 [ + - ][ + + ]: 19224 : if ( rSet.GetItemState( SID_DOC_SERVICE ) == SFX_ITEM_SET )
1144 : 10360 : nAdditional++;
1145 : :
1146 : : // consider additional arguments
1147 : 19224 : nProps += nAdditional;
1148 : : #ifdef DBG_UTIL
1149 : : nItems += nAdditional;
1150 : : #endif
1151 : : }
1152 : : }
1153 : :
1154 : : #ifdef DBG_UTIL
1155 : : // now check the itemset: is there any item that is not convertable using the list of formal arguments
1156 : : // or the table of additional items?!
1157 : : if ( rSet.Count() != nItems )
1158 : : {
1159 : : // detect unknown item and present error message
1160 : : const sal_uInt16 *pRanges = rSet.GetRanges();
1161 : : while ( *pRanges )
1162 : : {
1163 : : for(sal_uInt16 nId = *pRanges++; nId <= *pRanges; ++nId)
1164 : : {
1165 : : if ( rSet.GetItemState(nId) < SFX_ITEM_SET ) //???
1166 : : // not really set
1167 : : continue;
1168 : :
1169 : : if ( !pSlot->IsMode(SFX_SLOT_METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
1170 : : continue;
1171 : :
1172 : : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1173 : : sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
1174 : : sal_uInt16 nArg;
1175 : : for ( nArg=0; nArg<nFormalArgs; ++nArg )
1176 : : {
1177 : : const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
1178 : : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1179 : : if ( nId == nWhich )
1180 : : break;
1181 : : }
1182 : :
1183 : : if ( nArg<nFormalArgs )
1184 : : continue;
1185 : :
1186 : : if ( bIsMediaDescriptor )
1187 : : {
1188 : : if ( nId == SID_DOCFRAME )
1189 : : continue;
1190 : : if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
1191 : : continue;
1192 : : if ( nId == SID_INTERACTIONHANDLER )
1193 : : continue;
1194 : : if ( nId == SID_VIEW_DATA )
1195 : : continue;
1196 : : if ( nId == SID_FILTER_DATA )
1197 : : continue;
1198 : : if ( nId == SID_DOCUMENT )
1199 : : continue;
1200 : : if ( nId == SID_CONTENT )
1201 : : continue;
1202 : : if ( nId == SID_INPUTSTREAM )
1203 : : continue;
1204 : : if ( nId == SID_STREAM )
1205 : : continue;
1206 : : if ( nId == SID_OUTPUTSTREAM )
1207 : : continue;
1208 : : if ( nId == SID_POSTDATA )
1209 : : continue;
1210 : : if ( nId == SID_FILLFRAME )
1211 : : continue;
1212 : : if ( nId == SID_TEMPLATE )
1213 : : continue;
1214 : : if ( nId == SID_OPEN_NEW_VIEW )
1215 : : continue;
1216 : : if ( nId == SID_VIEW_ID )
1217 : : continue;
1218 : : if ( nId == SID_PLUGIN_MODE )
1219 : : continue;
1220 : : if ( nId == SID_DOC_READONLY )
1221 : : continue;
1222 : : if ( nId == SID_DOC_STARTPRESENTATION )
1223 : : continue;
1224 : : if ( nId == SID_SELECTION )
1225 : : continue;
1226 : : if ( nId == SID_HIDDEN )
1227 : : continue;
1228 : : if ( nId == SID_MINIMIZED )
1229 : : continue;
1230 : : if ( nId == SID_SILENT )
1231 : : continue;
1232 : : if ( nId == SID_PREVIEW )
1233 : : continue;
1234 : : if ( nId == SID_VIEWONLY )
1235 : : continue;
1236 : : if ( nId == SID_EDITDOC )
1237 : : continue;
1238 : : if ( nId == SID_TARGETNAME )
1239 : : continue;
1240 : : if ( nId == SID_DOC_SALVAGE )
1241 : : continue;
1242 : : if ( nId == SID_PATH )
1243 : : continue;
1244 : : if ( nId == SID_FILE_DIALOG )
1245 : : continue;
1246 : : if ( nId == SID_STANDARD_DIR )
1247 : : continue;
1248 : : if ( nId == SID_BLACK_LIST )
1249 : : continue;
1250 : : if ( nId == SID_CONTENTTYPE )
1251 : : continue;
1252 : : if ( nId == SID_TEMPLATE_NAME )
1253 : : continue;
1254 : : if ( nId == SID_TEMPLATE_REGIONNAME )
1255 : : continue;
1256 : : if ( nId == SID_JUMPMARK )
1257 : : continue;
1258 : : if ( nId == SID_CHARSET )
1259 : : continue;
1260 : : if ( nId == SID_MACROEXECMODE )
1261 : : continue;
1262 : : if ( nId == SID_UPDATEDOCMODE )
1263 : : continue;
1264 : : if ( nId == SID_REPAIRPACKAGE )
1265 : : continue;
1266 : : if ( nId == SID_DOCINFO_TITLE )
1267 : : continue;
1268 : : if ( nId == SID_COMPONENTDATA )
1269 : : continue;
1270 : : if ( nId == SID_COMPONENTCONTEXT )
1271 : : continue;
1272 : : if ( nId == SID_DOC_BASEURL )
1273 : : continue;
1274 : : if ( nId == SID_DOC_HIERARCHICALNAME )
1275 : : continue;
1276 : : if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
1277 : : continue;
1278 : : if ( nId == SID_NOAUTOSAVE )
1279 : : continue;
1280 : : if ( nId == SID_ENCRYPTIONDATA )
1281 : : continue;
1282 : : if ( nId == SID_DOC_SERVICE )
1283 : : continue;
1284 : :
1285 : : // used only internally
1286 : : if ( nId == SID_SAVETO )
1287 : : continue;
1288 : : if ( nId == SID_MODIFYPASSWORDINFO )
1289 : : continue;
1290 : : if ( nId == SID_SUGGESTEDSAVEASDIR )
1291 : : continue;
1292 : : if ( nId == SID_SUGGESTEDSAVEASNAME )
1293 : : continue;
1294 : : }
1295 : :
1296 : : rtl::OStringBuffer aDbg(RTL_CONSTASCII_STRINGPARAM(
1297 : : "Unknown item detected: "));
1298 : : aDbg.append(static_cast<sal_Int32>(nId));
1299 : : DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
1300 : : }
1301 : : }
1302 : : }
1303 : : #endif
1304 : :
1305 [ + + ]: 19224 : if ( !nProps )
1306 : : return;
1307 : :
1308 : : // convert every item into a property
1309 [ + - ]: 14379 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aSequ( nProps );
1310 [ + - ]: 14379 : ::com::sun::star::beans::PropertyValue *pValue = aSequ.getArray();
1311 : :
1312 : 14379 : sal_Int32 nActProp=0;
1313 [ - + ]: 14379 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
1314 : : {
1315 : : // slot is a property
1316 [ # # ]: 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
1317 [ # # ]: 0 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1318 [ # # ][ # # ]: 0 : SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
1319 [ # # ]: 0 : if ( pItem ) //???
1320 : : {
1321 : 0 : sal_uInt16 nSubCount = pType->nAttribs;
1322 [ # # ]: 0 : if ( !nSubCount )
1323 : : {
1324 : 0 : pValue[nActProp].Name = rtl::OUString::createFromAscii(pSlot->pUnoName) ;
1325 [ # # ][ # # ]: 0 : if ( !pItem->QueryValue( pValue[nActProp].Value ) )
1326 : : {
1327 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
1328 [ # # ]: 0 : "Item not convertable: "));
1329 [ # # ]: 0 : aStr.append(static_cast<sal_Int32>(nSlotId));
1330 : 0 : OSL_FAIL(aStr.getStr());
1331 : : }
1332 : : }
1333 : : else
1334 : : {
1335 : : // complex type, add a property value for every member of the struct
1336 [ # # ]: 0 : for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1337 : : {
1338 : 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID;
1339 [ # # ]: 0 : if ( bConvertTwips )
1340 : 0 : nSubId |= CONVERT_TWIPS;
1341 : :
1342 : : DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
1343 [ # # ]: 0 : String aName( rtl::OUString::createFromAscii( pSlot->pUnoName ) ) ;
1344 [ # # ]: 0 : aName += '.';
1345 [ # # ]: 0 : aName += rtl::OUString::createFromAscii( pType->aAttrib[n-1].pName ) ;
1346 [ # # ]: 0 : pValue[nActProp].Name = aName;
1347 [ # # ][ # # ]: 0 : if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1348 : : {
1349 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
1350 [ # # ]: 0 : "Sub item "));
1351 : : aStr.append(static_cast<sal_Int32>(
1352 [ # # ]: 0 : pType->aAttrib[n-1].nAID));
1353 : : aStr.append(RTL_CONSTASCII_STRINGPARAM(
1354 [ # # ]: 0 : " not convertable in slot: "));
1355 [ # # ]: 0 : aStr.append(static_cast<sal_Int32>(nSlotId));
1356 : 0 : OSL_FAIL( aStr.getStr() );
1357 : : }
1358 [ # # ]: 0 : }
1359 : : }
1360 : : }
1361 : : }
1362 : : else
1363 : : {
1364 : : // slot is a method
1365 : 14379 : sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1366 [ + + ]: 143943 : for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1367 : : {
1368 : 129564 : const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1369 [ + - ]: 129564 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1370 [ + - ]: 129564 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1371 [ + - ][ + - ]: 129564 : SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
1372 [ + + ]: 129564 : if ( pItem ) //???
1373 : : {
1374 : 22638 : sal_uInt16 nSubCount = rArg.pType->nAttribs;
1375 [ + - ]: 22638 : if ( !nSubCount )
1376 : : {
1377 : 22638 : pValue[nActProp].Name = rtl::OUString::createFromAscii( rArg.pName ) ;
1378 [ - + ][ + - ]: 22638 : if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
1379 : : {
1380 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
1381 [ # # ]: 0 : "Item not convertable: "));
1382 [ # # ]: 0 : aStr.append(static_cast<sal_Int32>(rArg.nSlotId));
1383 : 0 : OSL_FAIL(aStr.getStr());
1384 : : }
1385 : : }
1386 : : else
1387 : : {
1388 : : // complex type, add a property value for every member of the struct
1389 [ # # ]: 0 : for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1390 : : {
1391 : 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID;
1392 [ # # ]: 0 : if ( bConvertTwips )
1393 : 0 : nSubId |= CONVERT_TWIPS;
1394 : :
1395 : : DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
1396 [ # # ]: 0 : String aName( rtl::OUString::createFromAscii( rArg.pName ) ) ;
1397 [ # # ]: 0 : aName += '.';
1398 [ # # ]: 0 : aName += rtl::OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
1399 [ # # ]: 0 : pValue[nActProp].Name = aName;
1400 [ # # ][ # # ]: 0 : if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1401 : : {
1402 : : rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM(
1403 [ # # ]: 0 : "Sub item "));
1404 : : aStr.append(static_cast<sal_Int32>(
1405 [ # # ]: 0 : rArg.pType->aAttrib[n-1].nAID));
1406 : : aStr.append(RTL_CONSTASCII_STRINGPARAM(
1407 [ # # ]: 0 : " not convertable in slot: "));
1408 [ # # ]: 0 : aStr.append(static_cast<sal_Int32>(rArg.nSlotId));
1409 : 0 : OSL_FAIL(aStr.getStr());
1410 : : }
1411 [ # # ]: 0 : }
1412 : : }
1413 : : }
1414 : : }
1415 : :
1416 [ + + ][ + - ]: 14379 : if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
[ - + ][ # # ]
[ # # ][ # # ]
[ # # ]
1417 : : nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF )
1418 : : {
1419 : 14379 : const SfxPoolItem *pItem=0;
1420 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1421 : : {
1422 : 0 : pValue[nActProp].Name = rtl::OUString(sComponentData);
1423 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1424 : : }
1425 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET )
1426 : : {
1427 : 0 : pValue[nActProp].Name = rtl::OUString(sComponentContext);
1428 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1429 : : }
1430 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET )
1431 : : {
1432 : 565 : pValue[nActProp].Name = rtl::OUString(sStatusInd);
1433 : 565 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1434 : : }
1435 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET )
1436 : : {
1437 : 10193 : pValue[nActProp].Name = rtl::OUString(sInteractionHdl);
1438 : 10193 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1439 : : }
1440 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
1441 : : {
1442 : 0 : pValue[nActProp].Name = rtl::OUString(sViewData);
1443 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1444 : : }
1445 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET )
1446 : : {
1447 : 0 : pValue[nActProp].Name = rtl::OUString(sFilterData);
1448 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1449 : : }
1450 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET )
1451 : : {
1452 : 0 : pValue[nActProp].Name = rtl::OUString(sModel);
1453 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1454 : : }
1455 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET )
1456 : : {
1457 : 4298 : pValue[nActProp].Name = rtl::OUString(sUCBContent);
1458 : 4298 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1459 : : }
1460 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1461 : : {
1462 : 683 : pValue[nActProp].Name = rtl::OUString(sInputStream);
1463 : 683 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1464 : : }
1465 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1466 : : {
1467 : 71 : pValue[nActProp].Name = rtl::OUString(sStream);
1468 : 71 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1469 : : }
1470 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1471 : : {
1472 : 0 : pValue[nActProp].Name = rtl::OUString(sOutputStream);
1473 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1474 : : }
1475 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1476 : : {
1477 : 0 : pValue[nActProp].Name = rtl::OUString(sPostData);
1478 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1479 : : }
1480 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
1481 : : {
1482 : 3848 : pValue[nActProp].Name = rtl::OUString(sFrame);
1483 [ + - ][ - + ]: 3848 : if ( pItem->ISA( SfxUsrAnyItem ) )
[ + - ]
1484 : : {
1485 : : OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" );
1486 : 0 : pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue();
1487 : : }
1488 [ + - ][ + - ]: 3848 : else if ( pItem->ISA( SfxUnoFrameItem ) )
[ + - ]
1489 [ + - ]: 3848 : pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame();
1490 : : else
1491 : : OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1492 : : }
1493 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET )
1494 : : {
1495 : 45 : pValue[nActProp].Name = rtl::OUString(sAsTemplate);
1496 [ + - ]: 45 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1497 : : }
1498 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET )
1499 : : {
1500 : 0 : pValue[nActProp].Name = rtl::OUString(sOpenNewView);
1501 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1502 : : }
1503 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_FAIL_ON_WARNING, sal_False, &pItem ) == SFX_ITEM_SET )
1504 : : {
1505 [ # # ]: 0 : pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFailOnWarning));
1506 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1507 : : }
1508 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET )
1509 : : {
1510 : 88 : pValue[nActProp].Name = rtl::OUString(sViewId);
1511 [ + - ]: 88 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1512 : : }
1513 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET )
1514 : : {
1515 : 0 : pValue[nActProp].Name = rtl::OUString(sPluginMode);
1516 [ # # ]: 0 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1517 : : }
1518 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET )
1519 : : {
1520 : 1098 : pValue[nActProp].Name = rtl::OUString(sReadOnly);
1521 [ + - ]: 1098 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1522 : : }
1523 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, sal_False, &pItem ) == SFX_ITEM_SET )
1524 : : {
1525 : 0 : pValue[nActProp].Name = rtl::OUString(sDdeReconnect);
1526 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1527 : : }
1528 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET )
1529 : : {
1530 : 0 : pValue[nActProp].Name = rtl::OUString(sStartPresentation);
1531 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1532 : : }
1533 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET )
1534 : : {
1535 : 0 : pValue[nActProp].Name = rtl::OUString(sSelectionOnly);
1536 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1537 : : }
1538 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET )
1539 : : {
1540 : 176 : pValue[nActProp].Name = rtl::OUString(sHidden);
1541 [ + - ]: 176 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1542 : : }
1543 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET )
1544 : : {
1545 : 0 : pValue[nActProp].Name = rtl::OUString(sMinimized);
1546 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1547 : : }
1548 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET )
1549 : : {
1550 : 0 : pValue[nActProp].Name = rtl::OUString(sSilent);
1551 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1552 : : }
1553 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET )
1554 : : {
1555 : 0 : pValue[nActProp].Name = rtl::OUString(sPreview);
1556 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1557 : : }
1558 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET )
1559 : : {
1560 : 0 : pValue[nActProp].Name = rtl::OUString(sViewOnly);
1561 [ # # ]: 0 : pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() ));
1562 : : }
1563 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET )
1564 : : {
1565 : 0 : pValue[nActProp].Name = rtl::OUString(sDontEdit);
1566 [ # # ]: 0 : pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() ));
1567 : : }
1568 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET )
1569 : : {
1570 : 0 : pValue[nActProp].Name = rtl::OUString(sUseSystemDialog);
1571 [ # # ]: 0 : pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() );
1572 : : }
1573 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET )
1574 : : {
1575 : 0 : pValue[nActProp].Name = rtl::OUString(sStandardDir);
1576 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1577 : : }
1578 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET )
1579 : : {
1580 : 0 : pValue[nActProp].Name = rtl::OUString(sBlackList);
1581 : :
1582 [ # # ]: 0 : com::sun::star::uno::Sequence< rtl::OUString > aList;
1583 [ # # ]: 0 : ((SfxStringListItem*)pItem)->GetStringList( aList );
1584 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= aList ;
1585 : : }
1586 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1587 : : {
1588 : 0 : pValue[nActProp].Name = rtl::OUString(sFrameName);
1589 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1590 : : }
1591 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET )
1592 : : {
1593 : 0 : pValue[nActProp].Name = rtl::OUString(sSalvagedFile);
1594 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1595 : : }
1596 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET )
1597 : : {
1598 : 0 : pValue[nActProp].Name = rtl::OUString(sFolderName);
1599 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1600 : : }
1601 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET )
1602 : : {
1603 : 8 : pValue[nActProp].Name = rtl::OUString(sMediaType);
1604 [ + - ][ + - ]: 8 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1605 : : }
1606 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET )
1607 : : {
1608 : 0 : pValue[nActProp].Name = rtl::OUString(sTemplateName);
1609 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1610 : : }
1611 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1612 : : {
1613 : 0 : pValue[nActProp].Name = rtl::OUString(sTemplateRegionName);
1614 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1615 : : }
1616 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET )
1617 : : {
1618 : 0 : pValue[nActProp].Name = rtl::OUString(sJumpMark);
1619 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1620 : : }
1621 : :
1622 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET )
1623 : : {
1624 : 0 : pValue[nActProp].Name = rtl::OUString(sCharacterSet);
1625 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1626 : : }
1627 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET )
1628 : : {
1629 : 12339 : pValue[nActProp].Name = rtl::OUString(sMacroExecMode);
1630 [ + - ]: 12339 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1631 : : }
1632 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET )
1633 : : {
1634 : 10372 : pValue[nActProp].Name = rtl::OUString(sUpdateDocMode);
1635 [ + - ]: 10372 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1636 : : }
1637 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET )
1638 : : {
1639 : 0 : pValue[nActProp].Name = rtl::OUString(sRepairPackage);
1640 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1641 : : }
1642 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET )
1643 : : {
1644 : 0 : pValue[nActProp].Name = rtl::OUString(sDocumentTitle);
1645 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1646 : : }
1647 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET )
1648 : : {
1649 : 5935 : pValue[nActProp].Name = rtl::OUString(sDocumentBaseURL);
1650 [ + - ][ + - ]: 5935 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1651 : : }
1652 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1653 : : {
1654 : 0 : pValue[nActProp].Name = rtl::OUString(sHierarchicalDocumentName);
1655 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1656 : : }
1657 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET )
1658 : : {
1659 : 0 : pValue[nActProp].Name = rtl::OUString(sCopyStreamIfPossible);
1660 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1661 : : }
1662 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET )
1663 : : {
1664 : 0 : pValue[nActProp].Name = rtl::OUString(sNoAutoSave);
1665 [ # # ]: 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1666 : : }
1667 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET )
1668 : : {
1669 : 0 : pValue[nActProp].Name = rtl::OUString(sModifyPasswordInfo);
1670 : 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1671 : : }
1672 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1673 : : {
1674 : 6 : pValue[nActProp].Name = rtl::OUString(sEncryptionData);
1675 : 6 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1676 : : }
1677 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, sal_False, &pItem ) == SFX_ITEM_SET )
1678 : : {
1679 : 0 : pValue[nActProp].Name = rtl::OUString(sSuggestedSaveAsDir);
1680 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1681 : : }
1682 [ + - ][ - + ]: 14379 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, sal_False, &pItem ) == SFX_ITEM_SET )
1683 : : {
1684 : 0 : pValue[nActProp].Name = rtl::OUString(sSuggestedSaveAsName);
1685 [ # # ][ # # ]: 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1686 : : }
1687 [ + - ][ + + ]: 14379 : if ( rSet.GetItemState( SID_DOC_SERVICE, sal_False, &pItem ) == SFX_ITEM_SET )
1688 : : {
1689 : 10360 : pValue[nActProp].Name = rtl::OUString(sDocumentService);
1690 [ + - ][ + - ]: 14379 : pValue[nActProp++].Value <<= rtl::OUString(static_cast<const SfxStringItem*>(pItem)->GetValue());
1691 : : }
1692 : : }
1693 : : }
1694 : :
1695 [ + - ][ + - ]: 19224 : rArgs = aSequ;
1696 : : }
1697 : :
1698 [ + - ][ + + ]: 170 : SFX_IMPL_XINTERFACE_5( SfxMacroLoader, OWeakObject, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization )
[ + - ]
1699 [ + + ][ + - ]: 4 : SFX_IMPL_XTYPEPROVIDER_5( SfxMacroLoader, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization )
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ + - ][ + - ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
1700 [ + - ][ + - ]: 554 : SFX_IMPL_XSERVICEINFO( SfxMacroLoader, PROTOCOLHANDLER_SERVICENAME, "com.sun.star.comp.sfx2.SfxMacroLoader" )
[ # # ][ # # ]
[ # # ][ # # ]
1701 [ + - ][ + - ]: 2 : SFX_IMPL_SINGLEFACTORY( SfxMacroLoader )
1702 : :
1703 : 2 : void SAL_CALL SfxMacroLoader::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
1704 : : {
1705 : 2 : Reference < XFrame > xFrame;
1706 [ - + ]: 2 : if ( aArguments.getLength() )
1707 : : {
1708 [ # # ]: 0 : aArguments[0] >>= xFrame;
1709 [ # # ]: 0 : m_xFrame = xFrame;
1710 : 2 : }
1711 : 2 : }
1712 : :
1713 : 0 : SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl()
1714 : : {
1715 : 0 : SfxObjectShell* pDocShell = NULL;
1716 [ # # ][ # # ]: 0 : Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
1717 [ # # ]: 0 : if ( xFrame.is() )
1718 : : {
1719 : 0 : SfxFrame* pFrame=0;
1720 [ # # ][ # # ]: 0 : for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
[ # # ]
1721 : : {
1722 [ # # ][ # # ]: 0 : if ( pFrame->GetFrameInterface() == xFrame )
[ # # ]
1723 : 0 : break;
1724 : : }
1725 : :
1726 [ # # ]: 0 : if ( pFrame )
1727 [ # # ]: 0 : pDocShell = pFrame->GetCurrentDocument();
1728 : : }
1729 : :
1730 : 0 : return pDocShell;
1731 : : }
1732 : :
1733 : : // -----------------------------------------------------------------------
1734 : 6 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SfxMacroLoader::queryDispatch(
1735 : : const ::com::sun::star::util::URL& aURL ,
1736 : : const ::rtl::OUString& /*sTargetFrameName*/,
1737 : : sal_Int32 /*nSearchFlags*/ ) throw( ::com::sun::star::uno::RuntimeException )
1738 : : {
1739 : 6 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher;
1740 [ + - ]: 6 : if(aURL.Complete.compareToAscii("macro:",6)==0)
1741 [ + - ]: 6 : xDispatcher = this;
1742 : 6 : return xDispatcher;
1743 : : }
1744 : :
1745 : : // -----------------------------------------------------------------------
1746 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
1747 : 2 : SfxMacroLoader::queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
1748 : : throw( ::com::sun::star::uno::RuntimeException )
1749 : : {
1750 : 2 : sal_Int32 nCount = seqDescriptor.getLength();
1751 : 2 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
1752 [ + + ]: 6 : for( sal_Int32 i=0; i<nCount; ++i )
1753 [ + - ]: 8 : lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
1754 : 4 : seqDescriptor[i].FrameName,
1755 [ + - ][ + - ]: 12 : seqDescriptor[i].SearchFlags );
1756 : 2 : return lDispatcher;
1757 : : }
1758 : :
1759 : : // -----------------------------------------------------------------------
1760 : 0 : void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star::util::URL& aURL ,
1761 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*lArgs*/ ,
1762 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener )
1763 : : throw (::com::sun::star::uno::RuntimeException)
1764 : : {
1765 [ # # ]: 0 : SolarMutexGuard aGuard;
1766 : :
1767 : 0 : ::com::sun::star::uno::Any aAny;
1768 [ # # ][ # # ]: 0 : ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
1769 [ # # ]: 0 : if( xListener.is() )
1770 : : {
1771 : : // always call dispatchFinished(), because we didn't load a document but
1772 : : // executed a macro instead!
1773 [ # # ]: 0 : ::com::sun::star::frame::DispatchResultEvent aEvent;
1774 : :
1775 [ # # ]: 0 : aEvent.Source = static_cast< ::cppu::OWeakObject* >(this);
1776 [ # # ]: 0 : if( nErr == ERRCODE_NONE )
1777 : 0 : aEvent.State = ::com::sun::star::frame::DispatchResultState::SUCCESS;
1778 : : else
1779 : 0 : aEvent.State = ::com::sun::star::frame::DispatchResultState::FAILURE;
1780 : :
1781 [ # # ][ # # ]: 0 : xListener->dispatchFinished( aEvent ) ;
[ # # ]
1782 [ # # ]: 0 : }
1783 : 0 : }
1784 : :
1785 : 0 : ::com::sun::star::uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue(
1786 : : const ::com::sun::star::util::URL& aURL,
1787 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& ) throw (::com::sun::star::uno::RuntimeException)
1788 : : {
1789 : 0 : ::com::sun::star::uno::Any aRet;
1790 [ # # ][ # # ]: 0 : /*ErrCode nErr = */loadMacro( aURL.Complete, aRet, GetObjectShell_Impl() );
1791 : 0 : return aRet;
1792 : : }
1793 : :
1794 : : // -----------------------------------------------------------------------
1795 : 0 : void SAL_CALL SfxMacroLoader::dispatch( const ::com::sun::star::util::URL& aURL ,
1796 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& /*lArgs*/ )
1797 : : throw (::com::sun::star::uno::RuntimeException)
1798 : : {
1799 [ # # ]: 0 : SolarMutexGuard aGuard;
1800 : :
1801 : 0 : ::com::sun::star::uno::Any aAny;
1802 [ # # ][ # # ]: 0 : /*ErrCode nErr = */loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() );
[ # # ]
1803 : 0 : }
1804 : :
1805 : : // -----------------------------------------------------------------------
1806 : 0 : void SAL_CALL SfxMacroLoader::addStatusListener(
1807 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& ,
1808 : : const ::com::sun::star::util::URL& )
1809 : : throw (::com::sun::star::uno::RuntimeException)
1810 : : {
1811 : : /* TODO
1812 : : How we can handle different listener for further coming or currently running dispatch() jobs
1813 : : without any inconsistency!
1814 : : */
1815 : 0 : }
1816 : :
1817 : : // -----------------------------------------------------------------------
1818 : 0 : void SAL_CALL SfxMacroLoader::removeStatusListener(
1819 : : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >&,
1820 : : const ::com::sun::star::util::URL& )
1821 : : throw (::com::sun::star::uno::RuntimeException)
1822 : : {
1823 : 0 : }
1824 : :
1825 : 0 : ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh )
1826 : : throw ( ::com::sun::star::uno::RuntimeException )
1827 : : {
1828 : : #ifdef DISABLE_SCRIPTING
1829 : : (void) rURL;
1830 : : (void) rRetval;
1831 : : (void) pSh;
1832 : : return ERRCODE_BASIC_PROC_UNDEFINED;
1833 : : #else
1834 : 0 : SfxObjectShell* pCurrent = pSh;
1835 [ # # ]: 0 : if ( !pCurrent )
1836 : : // all not full qualified names use the BASIC of the given or current document
1837 [ # # ]: 0 : pCurrent = SfxObjectShell::Current();
1838 : :
1839 : : // 'macro:///lib.mod.proc(args)' => macro of App-BASIC
1840 : : // 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document
1841 : : // 'macro://obj.method(args)' => direct API call, execute it via App-BASIC
1842 [ # # ]: 0 : String aMacro( rURL );
1843 [ # # ]: 0 : sal_uInt16 nHashPos = aMacro.Search( '/', 8 );
1844 [ # # ]: 0 : sal_uInt16 nArgsPos = aMacro.Search( '(' );
1845 [ # # ][ # # ]: 0 : BasicManager *pAppMgr = SFX_APP()->GetBasicManager();
1846 : 0 : BasicManager *pBasMgr = 0;
1847 : 0 : ErrCode nErr = ERRCODE_NONE;
1848 : :
1849 : : // should a macro function be executed ( no direct API call)?
1850 [ # # ][ # # ]: 0 : if ( STRING_NOTFOUND != nHashPos && nHashPos < nArgsPos )
1851 : : {
1852 : : // find BasicManager
1853 : 0 : SfxObjectShell* pDoc = NULL;
1854 [ # # ][ # # ]: 0 : String aBasMgrName( INetURLObject::decode(aMacro.Copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
[ # # ][ # # ]
[ # # ]
1855 [ # # ]: 0 : if ( !aBasMgrName.Len() )
1856 : 0 : pBasMgr = pAppMgr;
1857 [ # # ][ # # ]: 0 : else if ( aBasMgrName.EqualsAscii(".") )
1858 : : {
1859 : : // current/actual document
1860 : 0 : pDoc = pCurrent;
1861 [ # # ]: 0 : if (pDoc)
1862 [ # # ]: 0 : pBasMgr = pDoc->GetBasicManager();
1863 : : }
1864 : : else
1865 : : {
1866 : : // full qualified name, find document by name
1867 [ # # ][ # # ]: 0 : for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst();
[ # # ][ # # ]
[ # # ]
1868 : : pObjSh && !pBasMgr;
1869 : : pObjSh = SfxObjectShell::GetNext(*pObjSh) )
1870 [ # # ][ # # ]: 0 : if ( aBasMgrName == pObjSh->GetTitle(SFX_TITLE_APINAME) )
[ # # ][ # # ]
1871 : : {
1872 : 0 : pDoc = pObjSh;
1873 [ # # ]: 0 : pBasMgr = pDoc->GetBasicManager();
1874 : : }
1875 : : }
1876 : :
1877 [ # # ]: 0 : if ( pBasMgr )
1878 : : {
1879 : 0 : const bool bIsAppBasic = ( pBasMgr == pAppMgr );
1880 : 0 : const bool bIsDocBasic = ( pBasMgr != pAppMgr );
1881 : :
1882 [ # # ]: 0 : if ( pDoc )
1883 : : {
1884 : : // security check for macros from document basic if an SFX doc is given
1885 [ # # ][ # # ]: 0 : if ( !pDoc->AdjustMacroMode( String() ) )
[ # # ][ # # ]
1886 : : // check forbids execution
1887 : 0 : return ERRCODE_IO_ACCESSDENIED;
1888 : : }
1889 [ # # ][ # # ]: 0 : else if ( pDoc && pDoc->GetMedium() )
[ # # ]
1890 : : {
1891 [ # # ][ # # ]: 0 : pDoc->AdjustMacroMode( String() );
[ # # ]
1892 [ # # ][ # # ]: 0 : SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False);
[ # # ]
1893 [ # # ][ # # ]: 0 : SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False);
[ # # ]
1894 [ # # ][ # # : 0 : if ( pUpdateDocItem && pMacroExecModeItem
# # # # ]
[ # # ]
1895 : 0 : && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE
1896 : 0 : && pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE )
1897 : 0 : return ERRCODE_IO_ACCESSDENIED;
1898 : : }
1899 : :
1900 : : // find BASIC method
1901 [ # # ][ # # ]: 0 : String aQualifiedMethod( INetURLObject::decode(aMacro.Copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) );
[ # # ][ # # ]
[ # # ]
1902 [ # # ]: 0 : String aArgs;
1903 [ # # ]: 0 : if ( STRING_NOTFOUND != nArgsPos )
1904 : : {
1905 : : // remove arguments from macro name
1906 [ # # ][ # # ]: 0 : aArgs = aQualifiedMethod.Copy( nArgsPos - nHashPos - 1 );
[ # # ]
1907 [ # # ]: 0 : aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 );
1908 : : }
1909 : :
1910 [ # # ][ # # ]: 0 : if ( pBasMgr->HasMacro( aQualifiedMethod ) )
1911 : : {
1912 : 0 : Any aOldThisComponent;
1913 [ # # ][ # # ]: 0 : const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic;
1914 [ # # ][ # # ]: 0 : const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic;
1915 [ # # ]: 0 : if ( bSetDocMacroMode )
1916 : : {
1917 : : // mark document: it executes an own macro, so it's in a modal mode
1918 [ # # ]: 0 : pDoc->SetMacroMode_Impl( sal_True );
1919 : : }
1920 : :
1921 [ # # ]: 0 : if ( bSetGlobalThisComponent )
1922 : : {
1923 : : // document is executed via AppBASIC, adjust ThisComponent variable
1924 [ # # ][ # # ]: 0 : aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) );
[ # # ]
1925 : : }
1926 : :
1927 : : // just to let the shell be alive
1928 : 0 : SfxObjectShellRef xKeepDocAlive = pDoc;
1929 : :
1930 : : {
1931 : : // attempt to protect the document against the script tampering with its Undo Context
1932 : 0 : ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
1933 [ # # ]: 0 : if ( bIsDocBasic )
1934 [ # # ][ # # ]: 0 : pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) );
[ # # ]
1935 : :
1936 : : // execute the method
1937 [ # # ][ # # ]: 0 : SbxVariableRef retValRef = new SbxVariable;
1938 [ # # ]: 0 : nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef );
1939 [ # # ]: 0 : if ( nErr == ERRCODE_NONE )
1940 [ # # ][ # # ]: 0 : rRetval = sbxToUnoValue( retValRef );
[ # # ]
1941 : : }
1942 : :
1943 [ # # ]: 0 : if ( bSetGlobalThisComponent )
1944 : : {
1945 [ # # ]: 0 : pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
1946 : : }
1947 : :
1948 [ # # ]: 0 : if ( bSetDocMacroMode )
1949 : : {
1950 : : // remove flag for modal mode
1951 [ # # ]: 0 : pDoc->SetMacroMode_Impl( sal_False );
1952 [ # # ]: 0 : }
1953 : : }
1954 : : else
1955 [ # # ][ # # ]: 0 : nErr = ERRCODE_BASIC_PROC_UNDEFINED;
1956 : : }
1957 : : else
1958 [ # # ][ # # ]: 0 : nErr = ERRCODE_IO_NOTEXISTS;
1959 : : }
1960 : : else
1961 : : {
1962 : : // direct API call on a specified object
1963 : 0 : rtl::OUStringBuffer aCall;
1964 [ # # ]: 0 : aCall.append('[').append(INetURLObject::decode(aMacro.Copy(6), INET_HEX_ESCAPE,
1965 [ # # ][ # # ]: 0 : INetURLObject::DECODE_WITH_CHARSET));
[ # # ][ # # ]
[ # # ]
1966 [ # # ]: 0 : aCall.append(']');
1967 [ # # ][ # # ]: 0 : pAppMgr->GetLib(0)->Execute(aCall.makeStringAndClear());
[ # # ][ # # ]
[ # # ]
1968 [ # # ]: 0 : nErr = SbxBase::GetError();
1969 : : }
1970 : :
1971 [ # # ]: 0 : SbxBase::ResetError();
1972 [ # # ]: 0 : return nErr;
1973 : : #endif
1974 : : }
1975 : :
1976 [ + - ][ + - ]: 4450 : SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" ) \
[ # # ][ # # ]
[ # # ][ # # ]
1977 [ + - ][ + - ]: 62 : SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider );
1978 : :
1979 : 3770 : void SAL_CALL SfxAppDispatchProvider::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
1980 : : {
1981 : 3770 : Reference < XFrame > xFrame;
1982 [ + + ]: 3770 : if ( aArguments.getLength() )
1983 : : {
1984 [ + - ]: 3768 : aArguments[0] >>= xFrame;
1985 [ + - ]: 3768 : m_xFrame = xFrame;
1986 : 3770 : }
1987 : 3770 : }
1988 : :
1989 : 3774 : Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch(
1990 : : const ::com::sun::star::util::URL& aURL,
1991 : : const ::rtl::OUString& /*sTargetFrameName*/,
1992 : : FrameSearchFlags /*eSearchFlags*/ ) throw( RuntimeException )
1993 : : {
1994 : 3774 : sal_uInt16 nId( 0 );
1995 : 3774 : sal_Bool bMasterCommand( sal_False );
1996 : 3774 : Reference < XDispatch > xDisp;
1997 : 3774 : const SfxSlot* pSlot = 0;
1998 [ + - ][ + - ]: 3774 : SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl();
1999 [ + - - + ]: 7548 : if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL ||
[ - + ]
2000 : 3774 : aURL.Protocol.compareToAscii( "commandId:" ) == COMPARE_EQUAL )
2001 : : {
2002 : 0 : nId = (sal_uInt16) aURL.Path.toInt32();
2003 : : SfxShell* pShell;
2004 [ # # ]: 0 : pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, sal_True, sal_True );
2005 : : }
2006 [ + - ]: 3774 : else if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL )
2007 : : {
2008 : : // Support ".uno" commands. Map commands to slotid
2009 [ + - ]: 3774 : bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL );
2010 [ - + ]: 3774 : if ( bMasterCommand )
2011 [ # # ][ # # ]: 0 : pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) );
[ # # ][ # # ]
2012 : : else
2013 [ + - ][ + - ]: 3774 : pSlot = pAppDisp->GetSlot( aURL.Main );
[ + - ]
2014 : : }
2015 : :
2016 [ + + ]: 3774 : if ( pSlot )
2017 : : {
2018 [ + - ]: 108 : SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ;
2019 [ + - ][ + - ]: 108 : pDispatch->SetFrame(m_xFrame);
2020 [ + - ]: 108 : pDispatch->SetMasterUnoCommand( bMasterCommand );
2021 [ + - ]: 3774 : xDisp = pDispatch;
2022 : : }
2023 : :
2024 : 3774 : return xDisp;
2025 : : }
2026 : :
2027 : 2 : Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor )
2028 : : throw( RuntimeException )
2029 : : {
2030 : 2 : sal_Int32 nCount = seqDescriptor.getLength();
2031 : 2 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
2032 [ + + ]: 6 : for( sal_Int32 i=0; i<nCount; ++i )
2033 [ + - ]: 8 : lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
2034 : 4 : seqDescriptor[i].FrameName,
2035 [ + - ][ + - ]: 12 : seqDescriptor[i].SearchFlags );
2036 : 2 : return lDispatcher;
2037 : : }
2038 : :
2039 : 0 : Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups()
2040 : : throw (::com::sun::star::uno::RuntimeException)
2041 : : {
2042 [ # # ]: 0 : SolarMutexGuard aGuard;
2043 : :
2044 [ # # ]: 0 : std::list< sal_Int16 > aGroupList;
2045 [ # # ][ # # ]: 0 : SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
2046 : :
2047 : 0 : const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
2048 : :
2049 : : // Gruppe anw"ahlen ( Gruppe 0 ist intern )
2050 [ # # ][ # # ]: 0 : for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
2051 : : {
2052 [ # # ]: 0 : String aName = pAppSlotPool->SeekGroup( i );
2053 [ # # ]: 0 : const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
2054 [ # # ]: 0 : while ( pSfxSlot )
2055 : : {
2056 [ # # ]: 0 : if ( pSfxSlot->GetMode() & nMode )
2057 : : {
2058 [ # # ]: 0 : sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
2059 [ # # ]: 0 : aGroupList.push_back( nCommandGroup );
2060 : : break;
2061 : : }
2062 [ # # ]: 0 : pSfxSlot = pAppSlotPool->NextSlot();
2063 : : }
2064 [ # # ]: 0 : }
2065 : :
2066 : : ::com::sun::star::uno::Sequence< sal_Int16 > aSeq =
2067 [ # # ]: 0 : comphelper::containerToSequence< sal_Int16, std::list< sal_Int16 > >( aGroupList );
2068 : :
2069 [ # # ]: 0 : return aSeq;
2070 : : }
2071 : :
2072 : 0 : Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup )
2073 : : throw (::com::sun::star::uno::RuntimeException)
2074 : : {
2075 [ # # ]: 0 : std::list< ::com::sun::star::frame::DispatchInformation > aCmdList;
2076 : :
2077 [ # # ]: 0 : SolarMutexGuard aGuard;
2078 [ # # ][ # # ]: 0 : SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl();
2079 : :
2080 [ # # ]: 0 : if ( pAppSlotPool )
2081 : : {
2082 : 0 : const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG );
2083 : 0 : rtl::OUString aCmdPrefix( ".uno:" );
2084 : :
2085 : : // Gruppe anw"ahlen ( Gruppe 0 ist intern )
2086 [ # # ][ # # ]: 0 : for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ )
2087 : : {
2088 [ # # ]: 0 : String aName = pAppSlotPool->SeekGroup( i );
2089 [ # # ]: 0 : const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot();
2090 [ # # ]: 0 : if ( pSfxSlot )
2091 : : {
2092 [ # # ]: 0 : sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() );
2093 [ # # ]: 0 : if ( nCommandGroup == nCmdGroup )
2094 : : {
2095 [ # # ]: 0 : while ( pSfxSlot )
2096 : : {
2097 [ # # ]: 0 : if ( pSfxSlot->GetMode() & nMode )
2098 : : {
2099 : 0 : ::com::sun::star::frame::DispatchInformation aCmdInfo;
2100 [ # # ]: 0 : ::rtl::OUStringBuffer aBuf( aCmdPrefix );
2101 [ # # ]: 0 : aBuf.appendAscii( pSfxSlot->GetUnoName() );
2102 [ # # ]: 0 : aCmdInfo.Command = aBuf.makeStringAndClear();
2103 : 0 : aCmdInfo.GroupId = nCommandGroup;
2104 [ # # ]: 0 : aCmdList.push_back( aCmdInfo );
2105 : : }
2106 [ # # ]: 0 : pSfxSlot = pAppSlotPool->NextSlot();
2107 : : }
2108 : : }
2109 : : }
2110 [ # # ]: 0 : }
2111 : : }
2112 : :
2113 : : ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq =
2114 [ # # ]: 0 : comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aCmdList );
2115 : :
2116 [ # # ]: 0 : return aSeq;
2117 : : }
2118 : :
2119 : : #ifdef TEST_HANDLERS
2120 : : #include <cppuhelper/implbase2.hxx>
2121 : :
2122 : : #include <com/sun/star/awt/XKeyHandler.hpp>
2123 : : #include <com/sun/star/awt/XMouseClickHandler.hpp>
2124 : :
2125 : : class TestKeyHandler: public ::cppu::WeakImplHelper2
2126 : : <
2127 : : com::sun::star::awt::XKeyHandler,
2128 : : com::sun::star::lang::XServiceInfo
2129 : : >
2130 : : {
2131 : : public:
2132 : : TestKeyHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){}
2133 : :
2134 : : SFX_DECL_XSERVICEINFO
2135 : : virtual sal_Bool SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
2136 : : virtual sal_Bool SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException);
2137 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source)
2138 : : throw (::com::sun::star::uno::RuntimeException);
2139 : : };
2140 : :
2141 : : class TestMouseClickHandler: public ::cppu::WeakImplHelper2
2142 : : <
2143 : : com::sun::star::awt::XMouseClickHandler,
2144 : : com::sun::star::lang::XServiceInfo
2145 : : >
2146 : : {
2147 : : public:
2148 : : TestMouseClickHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){}
2149 : :
2150 : : SFX_DECL_XSERVICEINFO
2151 : : virtual sal_Bool SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
2152 : : virtual sal_Bool SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException);
2153 : : virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source)
2154 : : throw (::com::sun::star::uno::RuntimeException);
2155 : : };
2156 : :
2157 : : sal_Bool SAL_CALL TestKeyHandler::keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
2158 : : {
2159 : : return sal_False;
2160 : : }
2161 : :
2162 : : sal_Bool SAL_CALL TestKeyHandler::keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException)
2163 : : {
2164 : : return sal_False;
2165 : : }
2166 : :
2167 : : void SAL_CALL TestKeyHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException)
2168 : : {
2169 : : }
2170 : :
2171 : : sal_Bool SAL_CALL TestMouseClickHandler::mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException)
2172 : : {
2173 : : return sal_False;
2174 : : }
2175 : :
2176 : : sal_Bool SAL_CALL TestMouseClickHandler::mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException)
2177 : : {
2178 : : return sal_False;
2179 : : }
2180 : :
2181 : : void SAL_CALL TestMouseClickHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException)
2182 : : {
2183 : : }
2184 : :
2185 : : SFX_IMPL_XSERVICEINFO( TestKeyHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.KeyHandler");
2186 : : SFX_IMPL_XSERVICEINFO( TestMouseClickHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.MouseClickHandler");
2187 : : SFX_IMPL_SINGLEFACTORY( TestKeyHandler );
2188 : : SFX_IMPL_SINGLEFACTORY( TestMouseClickHandler );
2189 : : #endif
2190 : : // -----------------------------------------------------------------------
2191 : :
2192 : : extern "C" {
2193 : :
2194 : 546 : SFX2_DLLPUBLIC void* SAL_CALL sfx_component_getFactory(
2195 : : const sal_Char* pImplementationName ,
2196 : : void* pServiceManager ,
2197 : : void* )
2198 : : {
2199 : : // Set default return value for this operation - if it failed.
2200 : 546 : void* pReturn = NULL ;
2201 : :
2202 [ + - ][ + - ]: 546 : if (
2203 : : ( pImplementationName != NULL ) &&
2204 : : ( pServiceManager != NULL )
2205 : : )
2206 : : {
2207 : : // Define variables which are used in following macros.
2208 : : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
2209 : 546 : xFactory;
2210 [ + - ]: 546 : ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager( reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ) ;
2211 : :
2212 : : //=============================================================================
2213 : : // Add new macro line to handle new service.
2214 : : // !!! ATTENTION !!!
2215 : : // Write no ";" at end of line and dont forget "else" ! (see macro)
2216 : : //=============================================================================
2217 [ + - ][ + + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
[ + - ][ + - ]
2218 [ + - ][ + + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
[ + - ][ + - ]
2219 [ + + ][ + - ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
[ + - ]
2220 [ + - ][ + + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject )
[ + - ][ + - ]
2221 [ + + ][ + - ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
[ + - ]
2222 [ + - ][ + + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
[ + - ][ + - ]
2223 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
[ # # ][ # # ]
2224 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationScriptLibraryContainer )
[ # # ][ # # ]
2225 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationDialogLibraryContainer )
[ # # ][ # # ]
2226 : : #ifdef TEST_HANDLERS
2227 : : IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
2228 : : IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
2229 : : #endif
2230 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator )
[ # # ][ # # ]
2231 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject )
[ # # ][ # # ]
2232 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject )
[ # # ][ # # ]
2233 [ + - ][ - + ]: 546 : IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService )
[ # # ][ # # ]
2234 [ + + ]: 546 : if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals(
2235 [ + - ]: 546 : ::rtl::OUString::createFromAscii( pImplementationName ) ) )
2236 : : {
2237 : : xFactory = ::cppu::createSingleComponentFactory(
2238 : : ::comp_SfxDocumentMetaData::_create,
2239 : : ::comp_SfxDocumentMetaData::_getImplementationName(),
2240 [ + - ][ + - ]: 127 : ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
[ + - ][ + - ]
[ + - ]
2241 : : }
2242 [ - + ]: 546 : if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
2243 [ + - ]: 546 : ::rtl::OUString::createFromAscii( pImplementationName ) ) )
2244 : : {
2245 : : xFactory = ::cppu::createSingleComponentFactory(
2246 : : ::comp_CompatWriterDocProps::_create,
2247 : : ::comp_CompatWriterDocProps::_getImplementationName(),
2248 [ # # ][ # # ]: 0 : ::comp_CompatWriterDocProps::_getSupportedServiceNames());
[ # # ][ # # ]
[ # # ]
2249 : : }
2250 : :
2251 : : // Factory is valid - service was found.
2252 : :
2253 : : // Factory is valid - service was found.
2254 [ + - ]: 546 : if ( xFactory.is() )
2255 : : {
2256 [ + - ]: 546 : xFactory->acquire();
2257 [ + - ]: 546 : pReturn = xFactory.get();
2258 : 546 : }
2259 : : }
2260 : : // Return with result of this operation.
2261 : 546 : return pReturn ;
2262 : : }
2263 : : } // extern "C"
2264 : :
2265 : : //=========================================================================
2266 : :
2267 : 0 : void SAL_CALL FilterOptionsContinuation::setFilterOptions(
2268 : : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps )
2269 : : throw (::com::sun::star::uno::RuntimeException)
2270 : : {
2271 : 0 : rProperties = rProps;
2272 : 0 : }
2273 : :
2274 : : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
2275 : 0 : FilterOptionsContinuation::getFilterOptions()
2276 : : throw (::com::sun::star::uno::RuntimeException)
2277 : : {
2278 : 0 : return rProperties;
2279 : : }
2280 : :
2281 : : //=========================================================================
2282 : :
2283 : 0 : RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel,
2284 [ # # ]: 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties )
2285 : : {
2286 : 0 : ::rtl::OUString temp;
2287 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2288 : : ::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp,
2289 : : temp2,
2290 : : rModel,
2291 [ # # ]: 0 : rProperties );
2292 : :
2293 [ # # ]: 0 : m_aRequest <<= aOptionsRequest;
2294 : :
2295 [ # # ]: 0 : m_pAbort = new comphelper::OInteractionAbort;
2296 [ # # ]: 0 : m_pOptions = new FilterOptionsContinuation;
2297 : :
2298 [ # # ]: 0 : m_lContinuations.realloc( 2 );
2299 [ # # ][ # # ]: 0 : m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
[ # # ][ # # ]
2300 [ # # ][ # # ]: 0 : m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions );
[ # # ][ # # ]
[ # # ]
2301 : 0 : }
2302 : :
2303 : 0 : ::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest()
2304 : : throw( ::com::sun::star::uno::RuntimeException )
2305 : : {
2306 : 0 : return m_aRequest;
2307 : : }
2308 : :
2309 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2310 : 0 : SAL_CALL RequestFilterOptions::getContinuations()
2311 : : throw( ::com::sun::star::uno::RuntimeException )
2312 : : {
2313 : 0 : return m_lContinuations;
2314 : : }
2315 : :
2316 : : //=========================================================================
2317 [ # # ][ # # ]: 0 : class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
2318 : : {
2319 : : ::com::sun::star::uno::Any m_aRequest;
2320 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
2321 : : comphelper::OInteractionApprove* m_pApprove;
2322 : : comphelper::OInteractionDisapprove* m_pDisapprove;
2323 : :
2324 : : public:
2325 : : RequestPackageReparation_Impl( ::rtl::OUString aName );
2326 : : sal_Bool isApproved();
2327 : : virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
2328 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
2329 : : throw( ::com::sun::star::uno::RuntimeException );
2330 : : };
2331 : :
2332 [ # # ]: 0 : RequestPackageReparation_Impl::RequestPackageReparation_Impl( ::rtl::OUString aName )
2333 : : {
2334 : 0 : ::rtl::OUString temp;
2335 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2336 : : ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
2337 : : temp2,
2338 [ # # ]: 0 : aName );
2339 [ # # ]: 0 : m_aRequest <<= aBrokenPackageRequest;
2340 [ # # ]: 0 : m_pApprove = new comphelper::OInteractionApprove;
2341 [ # # ]: 0 : m_pDisapprove = new comphelper::OInteractionDisapprove;
2342 [ # # ]: 0 : m_lContinuations.realloc( 2 );
2343 [ # # ][ # # ]: 0 : m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove );
[ # # ][ # # ]
2344 [ # # ][ # # ]: 0 : m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove );
[ # # ][ # # ]
[ # # ]
2345 : 0 : }
2346 : :
2347 : 0 : sal_Bool RequestPackageReparation_Impl::isApproved()
2348 : : {
2349 : 0 : return m_pApprove->wasSelected();
2350 : : }
2351 : :
2352 : 0 : ::com::sun::star::uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
2353 : : throw( ::com::sun::star::uno::RuntimeException )
2354 : : {
2355 : 0 : return m_aRequest;
2356 : : }
2357 : :
2358 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2359 : 0 : SAL_CALL RequestPackageReparation_Impl::getContinuations()
2360 : : throw( ::com::sun::star::uno::RuntimeException )
2361 : : {
2362 : 0 : return m_lContinuations;
2363 : : }
2364 : :
2365 : 0 : RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName )
2366 : : {
2367 [ # # ]: 0 : pImp = new RequestPackageReparation_Impl( aName );
2368 : 0 : pImp->acquire();
2369 : 0 : }
2370 : :
2371 : 0 : RequestPackageReparation::~RequestPackageReparation()
2372 : : {
2373 : 0 : pImp->release();
2374 : 0 : }
2375 : :
2376 : 0 : sal_Bool RequestPackageReparation::isApproved()
2377 : : {
2378 : 0 : return pImp->isApproved();
2379 : : }
2380 : :
2381 : 0 : com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > RequestPackageReparation::GetRequest()
2382 : : {
2383 [ # # ]: 0 : return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
2384 : : }
2385 : :
2386 : : //=========================================================================
2387 [ # # ][ # # ]: 0 : class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
2388 : : {
2389 : : ::com::sun::star::uno::Any m_aRequest;
2390 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
2391 : : comphelper::OInteractionAbort* m_pAbort;
2392 : :
2393 : : public:
2394 : : NotifyBrokenPackage_Impl( ::rtl::OUString aName );
2395 : : virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
2396 : : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
2397 : : throw( ::com::sun::star::uno::RuntimeException );
2398 : : };
2399 : :
2400 [ # # ]: 0 : NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( ::rtl::OUString aName )
2401 : : {
2402 : 0 : ::rtl::OUString temp;
2403 : 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2404 : : ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
2405 : : temp2,
2406 [ # # ]: 0 : aName );
2407 [ # # ]: 0 : m_aRequest <<= aBrokenPackageRequest;
2408 [ # # ]: 0 : m_pAbort = new comphelper::OInteractionAbort;
2409 [ # # ]: 0 : m_lContinuations.realloc( 1 );
2410 [ # # ][ # # ]: 0 : m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
[ # # ][ # # ]
[ # # ]
2411 : 0 : }
2412 : :
2413 : 0 : ::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
2414 : : throw( ::com::sun::star::uno::RuntimeException )
2415 : : {
2416 : 0 : return m_aRequest;
2417 : : }
2418 : :
2419 : : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2420 : 0 : SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
2421 : : throw( ::com::sun::star::uno::RuntimeException )
2422 : : {
2423 : 0 : return m_lContinuations;
2424 : : }
2425 : :
2426 : 0 : NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName )
2427 : : {
2428 [ # # ]: 0 : pImp = new NotifyBrokenPackage_Impl( aName );
2429 : 0 : pImp->acquire();
2430 : 0 : }
2431 : :
2432 : 0 : NotifyBrokenPackage::~NotifyBrokenPackage()
2433 : : {
2434 : 0 : pImp->release();
2435 : 0 : }
2436 : :
2437 : 0 : com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
2438 : : {
2439 [ # # ]: 0 : return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
2440 : : }
2441 : :
2442 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|