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 : #ifdef _MSC_VER
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/unoctitm.hxx>
109 : #include <sfx2/dispatch.hxx>
110 : #include "doctemplates.hxx"
111 : #include "shutdownicon.hxx"
112 : #include "objshimp.hxx"
113 : #include "fltoptint.hxx"
114 : #include <sfx2/docfile.hxx>
115 : #include <sfx2/sfxbasecontroller.hxx>
116 : #include <sfx2/brokenpackageint.hxx>
117 : #include "eventsupplier.hxx"
118 : #include "xpackcreator.hxx"
119 : #include "plugin.hxx"
120 : #include "iframe.hxx"
121 : #include <ownsubfilterservice.hxx>
122 : #include "SfxDocumentMetaData.hxx"
123 :
124 : #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler"
125 :
126 : #include <sfxslots.hxx>
127 :
128 : // needs to be converted to a better data structure
129 : SfxFormalArgument aFormalArgs[] = {
130 : SFX_ARGUMENT(SID_DEFAULTFILENAME,"SuggestedSaveAsName",SfxStringItem),
131 : SFX_ARGUMENT(SID_DEFAULTFILEPATH,"SuggestedSaveAsDir",SfxStringItem),
132 : SFX_ARGUMENT(SID_DOCINFO_AUTHOR,"VersionAuthor",SfxStringItem),
133 : SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxBoolItem),
134 : SFX_ARGUMENT(SID_DOCINFO_MAJOR,"VersionMajor",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 5974 : 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 5974 : nSlotId == SID_DIRECTEXPORTDOCASPDF );
216 : }
217 :
218 2700 : void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
219 : {
220 2700 : if ( !pSlot )
221 2700 : pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
222 :
223 2700 : if ( !pSlot )
224 0 : return;
225 :
226 2700 : if ( nSlotId == SID_OPENURL )
227 0 : nSlotId = SID_OPENDOC;
228 2700 : if ( nSlotId == SID_SAVEASURL )
229 0 : nSlotId = SID_SAVEASDOC;
230 :
231 2700 : sal_Int32 nCount = rArgs.getLength();
232 2700 : if ( !nCount )
233 145 : return;
234 :
235 2555 : const ::com::sun::star::beans::PropertyValue* pPropsVal = rArgs.getConstArray();
236 2555 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
237 : {
238 : // slot is a property
239 0 : const SfxType* pType = pSlot->GetType();
240 0 : SfxPoolItem* pItem = pType->CreateItem();
241 0 : 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 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
253 0 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
254 0 : pItem->SetWhich( nWhich );
255 0 : sal_uInt16 nSubCount = pType->nAttribs;
256 :
257 0 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[0];
258 0 : String aName = rProp.Name;
259 0 : 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 0 : if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
264 : // only use successfully converted items
265 0 : 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 0 : delete pItem;
347 : }
348 2555 : 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 2555 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
356 2555 : sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
357 48545 : for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
358 : {
359 45990 : const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
360 45990 : SfxPoolItem* pItem = rArg.CreateItem();
361 45990 : 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 45990 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
372 45990 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
373 45990 : pItem->SetWhich( nWhich );
374 45990 : const SfxType* pType = rArg.pType;
375 45990 : sal_uInt16 nSubCount = pType->nAttribs;
376 45990 : if ( nSubCount == 0 )
377 : {
378 : // "simple" (base type) argument
379 231039 : for ( sal_uInt16 n=0; n<nCount; n++ )
380 : {
381 187215 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
382 187215 : String aName = rProp.Name;
383 187215 : if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL )
384 : {
385 : #ifdef DBG_UTIL
386 : ++nFoundArgs;
387 : #endif
388 2166 : if( pItem->PutValue( rProp.Value ) )
389 : // only use successfully converted items
390 2166 : 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 187215 : }
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 45990 : 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 2555 : 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 2555 : else if ( bIsMediaDescriptor )
508 : {
509 13386 : for ( sal_uInt16 n=0; n<nCount; n++ )
510 : {
511 : #ifdef DBG_UTIL
512 : ++nFoundArgs;
513 : #endif
514 10831 : const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n];
515 10831 : rtl::OUString aName = rProp.Name;
516 10831 : if ( aName == sModel )
517 0 : rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
518 10831 : else if ( aName == sComponentData )
519 : {
520 0 : rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
521 : }
522 10831 : else if ( aName == sComponentContext )
523 : {
524 0 : rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
525 : }
526 10831 : else if ( aName == sStatusInd )
527 : {
528 236 : Reference< ::com::sun::star::task::XStatusIndicator > xVal;
529 236 : sal_Bool bOK = (rProp.Value >>= xVal);
530 : DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
531 236 : if (bOK && xVal.is())
532 236 : rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
533 : }
534 10595 : else if ( aName == sInteractionHdl )
535 : {
536 886 : Reference< ::com::sun::star::task::XInteractionHandler > xVal;
537 886 : sal_Bool bOK = (rProp.Value >>= xVal);
538 : DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
539 886 : if (bOK && xVal.is())
540 886 : rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
541 : }
542 9709 : else if ( aName == sViewData )
543 0 : rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
544 9709 : else if ( aName == sFilterData )
545 0 : rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
546 9709 : else if ( aName == sInputStream )
547 : {
548 502 : Reference< XInputStream > xVal;
549 502 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
550 : DBG_ASSERT( bOK, "invalid type for InputStream" );
551 502 : if (bOK)
552 502 : rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
553 : }
554 9207 : else if ( aName == sStream )
555 : {
556 1 : Reference< XInputStream > xVal;
557 1 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
558 : DBG_ASSERT( bOK, "invalid type for Stream" );
559 1 : if (bOK)
560 1 : rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
561 : }
562 9206 : else if ( aName == sUCBContent )
563 : {
564 852 : Reference< XContent > xVal;
565 852 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
566 : DBG_ASSERT( bOK, "invalid type for UCBContent" );
567 852 : if (bOK)
568 852 : rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
569 : }
570 8354 : else if ( aName == sOutputStream )
571 : {
572 27 : Reference< XOutputStream > xVal;
573 27 : sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is());
574 : DBG_ASSERT( bOK, "invalid type for OutputStream" );
575 27 : if (bOK)
576 27 : rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
577 : }
578 8327 : 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 8327 : else if ( aName == sFrame )
587 : {
588 0 : Reference< XFrame > xFrame;
589 0 : sal_Bool bOK = (rProp.Value >>= xFrame);
590 : DBG_ASSERT( bOK, "invalid type for Frame" );
591 0 : if (bOK)
592 0 : rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
593 : }
594 8327 : else if ( aName == sAsTemplate )
595 : {
596 6 : sal_Bool bVal = sal_False;
597 6 : sal_Bool bOK = (rProp.Value >>= bVal);
598 : DBG_ASSERT( bOK, "invalid type for AsTemplate" );
599 6 : if (bOK)
600 6 : rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
601 : }
602 8321 : 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 8321 : 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 8321 : else if ( aName == sViewId )
619 : {
620 0 : sal_Int16 nVal = -1;
621 0 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
622 : DBG_ASSERT( bOK, "invalid type for ViewId" );
623 0 : if (bOK)
624 0 : rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
625 : }
626 8321 : 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 8321 : else if ( aName == sReadOnly )
635 : {
636 195 : sal_Bool bVal = sal_False;
637 195 : sal_Bool bOK = (rProp.Value >>= bVal);
638 : DBG_ASSERT( bOK, "invalid type for ReadOnly" );
639 195 : if (bOK)
640 195 : rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
641 : }
642 8126 : 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 8126 : 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 8126 : 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 8126 : else if ( aName == sHidden )
667 : {
668 8 : sal_Bool bVal = sal_False;
669 8 : sal_Bool bOK = (rProp.Value >>= bVal);
670 : DBG_ASSERT( bOK, "invalid type for Hidden" );
671 8 : if (bOK)
672 8 : rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
673 : }
674 8118 : 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 8118 : 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 8118 : 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 8118 : 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 8118 : 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 8118 : 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 8118 : 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 8118 : 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 8118 : else if ( aName == sFileName )
743 : {
744 252 : ::rtl::OUString sVal;
745 252 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
746 : DBG_ASSERT( bOK, "invalid type or value for FileName" );
747 252 : if (bOK)
748 252 : rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
749 : }
750 7866 : 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 7866 : 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 7866 : 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 7866 : else if ( aName == sMediaType )
775 : {
776 0 : ::rtl::OUString sVal;
777 0 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
778 : DBG_ASSERT( bOK, "invalid type or value for MediaType" );
779 0 : if (bOK)
780 0 : rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
781 : }
782 7866 : 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 7866 : 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 7866 : 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 7866 : 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 7866 : 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 7866 : else if ( aName == sMacroExecMode )
823 : {
824 1053 : sal_Int16 nVal =-1;
825 1053 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
826 : DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
827 1053 : if (bOK)
828 1053 : rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
829 : }
830 6813 : else if ( aName == sUpdateDocMode )
831 : {
832 886 : sal_Int16 nVal =-1;
833 886 : sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
834 : DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
835 886 : if (bOK)
836 886 : rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
837 : }
838 5927 : 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 5927 : 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 5927 : else if ( aName == sDocumentBaseURL )
855 : {
856 1273 : ::rtl::OUString sVal;
857 : // the base url can be set to empty ( for embedded objects for example )
858 1273 : sal_Bool bOK = (rProp.Value >>= sVal);
859 : DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
860 1273 : if (bOK)
861 1273 : rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
862 : }
863 4654 : else if ( aName == sHierarchicalDocumentName )
864 : {
865 286 : ::rtl::OUString sVal;
866 286 : sal_Bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
867 : DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
868 286 : if (bOK)
869 286 : rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
870 : }
871 4368 : 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 4368 : 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 4368 : else if ( aName == sModifyPasswordInfo )
888 : {
889 0 : rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
890 : }
891 4368 : else if ( aName == sEncryptionData )
892 : {
893 3 : rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
894 : }
895 4365 : 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 4365 : 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 4365 : else if (aName == sDocumentService)
912 : {
913 735 : rtl::OUString aVal;
914 735 : bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
915 735 : if (bOK)
916 735 : rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
917 : }
918 : #ifdef DBG_UTIL
919 : else
920 : --nFoundArgs;
921 : #endif
922 10831 : }
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 0 : String sSlotName( DEFINE_CONST_UNICODE( "OptionsTreeDialog" ) );
929 0 : String sPropName( DEFINE_CONST_UNICODE( "OptionsPageURL" ) );
930 0 : 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 0 : }
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 3419 : void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
959 : {
960 3419 : if ( !pSlot )
961 3419 : pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
962 :
963 3419 : if ( !pSlot)
964 : return;
965 :
966 3419 : if ( nSlotId == SID_OPENURL )
967 0 : nSlotId = SID_OPENDOC;
968 3419 : if ( nSlotId == SID_SAVEASURL )
969 0 : nSlotId = SID_SAVEASDOC;
970 :
971 : // find number of properties to avoid permanent reallocations in the sequence
972 3419 : 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 3419 : const SfxType *pType = pSlot->GetType();
980 3419 : 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 3419 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1014 3419 : sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
1015 64961 : for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1016 : {
1017 : // check every formal argument of the method
1018 61542 : const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1019 :
1020 61542 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1021 61542 : if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
1022 : {
1023 4136 : sal_uInt16 nSubCount = rArg.pType->nAttribs;
1024 4136 : 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 4136 : 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 3419 : if ( bIsMediaDescriptor )
1039 : {
1040 3419 : sal_Int32 nAdditional=0;
1041 3419 : if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET )
1042 228 : nAdditional++;
1043 3419 : if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET )
1044 1699 : nAdditional++;
1045 3419 : if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET )
1046 0 : nAdditional++;
1047 3419 : if ( rSet.GetItemState( SID_PATH ) == SFX_ITEM_SET )
1048 0 : nAdditional++;
1049 3419 : if ( rSet.GetItemState( SID_FILE_DIALOG ) == SFX_ITEM_SET )
1050 0 : nAdditional++;
1051 3419 : if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET )
1052 0 : nAdditional++;
1053 3419 : if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET )
1054 0 : nAdditional++;
1055 3419 : if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET )
1056 1623 : nAdditional++;
1057 3419 : if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET )
1058 326 : nAdditional++;
1059 3419 : if ( rSet.GetItemState( SID_STREAM ) == SFX_ITEM_SET )
1060 1 : nAdditional++;
1061 3419 : if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET )
1062 2 : nAdditional++;
1063 3419 : if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET )
1064 9 : nAdditional++;
1065 3419 : if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET )
1066 0 : nAdditional++;
1067 3419 : if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SFX_ITEM_SET )
1068 0 : nAdditional++;
1069 3419 : if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET )
1070 0 : nAdditional++;
1071 3419 : if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET )
1072 0 : nAdditional++;
1073 3419 : if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET )
1074 0 : nAdditional++;
1075 3419 : if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET )
1076 0 : nAdditional++;
1077 3419 : if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET )
1078 584 : nAdditional++;
1079 3419 : if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SFX_ITEM_SET )
1080 0 : nAdditional++;
1081 3419 : if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET )
1082 0 : nAdditional++;
1083 3419 : if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET )
1084 0 : nAdditional++;
1085 3419 : if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET )
1086 0 : nAdditional++;
1087 3419 : if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET )
1088 0 : nAdditional++;
1089 3419 : if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET )
1090 0 : nAdditional++;
1091 3419 : if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET )
1092 0 : nAdditional++;
1093 3419 : if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET )
1094 0 : nAdditional++;
1095 3419 : if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET )
1096 0 : nAdditional++;
1097 3419 : if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET )
1098 0 : nAdditional++;
1099 3419 : if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET )
1100 16 : nAdditional++;
1101 3419 : if ( rSet.GetItemState( SID_MINIMIZED ) == SFX_ITEM_SET )
1102 0 : nAdditional++;
1103 3419 : if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET )
1104 0 : nAdditional++;
1105 3419 : if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET )
1106 0 : nAdditional++;
1107 3419 : if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET )
1108 0 : nAdditional++;
1109 3419 : if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET )
1110 0 : nAdditional++;
1111 3419 : if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET )
1112 0 : nAdditional++;
1113 3419 : if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET )
1114 0 : nAdditional++;
1115 3419 : if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET )
1116 1878 : nAdditional++;
1117 3419 : if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET )
1118 1699 : nAdditional++;
1119 3419 : if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET )
1120 0 : nAdditional++;
1121 3419 : if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET )
1122 0 : nAdditional++;
1123 3419 : if ( rSet.GetItemState( SID_COMPONENTDATA ) == SFX_ITEM_SET )
1124 0 : nAdditional++;
1125 3419 : if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SFX_ITEM_SET )
1126 0 : nAdditional++;
1127 3419 : if ( rSet.GetItemState( SID_DOC_BASEURL ) == SFX_ITEM_SET )
1128 2501 : nAdditional++;
1129 3419 : if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SFX_ITEM_SET )
1130 0 : nAdditional++;
1131 3419 : if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SFX_ITEM_SET )
1132 0 : nAdditional++;
1133 3419 : if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET )
1134 0 : nAdditional++;
1135 3419 : if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
1136 0 : nAdditional++;
1137 3419 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
1138 0 : nAdditional++;
1139 3419 : if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET )
1140 14 : nAdditional++;
1141 3419 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
1142 0 : nAdditional++;
1143 3419 : if ( rSet.GetItemState( SID_DOC_SERVICE ) == SFX_ITEM_SET )
1144 1683 : nAdditional++;
1145 :
1146 : // consider additional arguments
1147 3419 : 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 3419 : if ( !nProps )
1306 : return;
1307 :
1308 : // convert every item into a property
1309 2789 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aSequ( nProps );
1310 2789 : ::com::sun::star::beans::PropertyValue *pValue = aSequ.getArray();
1311 :
1312 2789 : sal_Int32 nActProp=0;
1313 2789 : 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 2789 : sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1366 27944 : for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1367 : {
1368 25155 : const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1369 25155 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1370 25155 : sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1371 25155 : SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False );
1372 25155 : if ( pItem ) //???
1373 : {
1374 4082 : sal_uInt16 nSubCount = rArg.pType->nAttribs;
1375 4082 : if ( !nSubCount )
1376 : {
1377 4082 : pValue[nActProp].Name = rtl::OUString::createFromAscii( rArg.pName ) ;
1378 4082 : 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 2789 : 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 2789 : const SfxPoolItem *pItem=0;
1420 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET )
1431 : {
1432 228 : pValue[nActProp].Name = rtl::OUString(sStatusInd);
1433 228 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1434 : }
1435 2789 : if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET )
1436 : {
1437 1699 : pValue[nActProp].Name = rtl::OUString(sInteractionHdl);
1438 1699 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1439 : }
1440 2789 : 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 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET )
1456 : {
1457 1623 : pValue[nActProp].Name = rtl::OUString(sUCBContent);
1458 1623 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1459 : }
1460 2789 : if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1461 : {
1462 326 : pValue[nActProp].Name = rtl::OUString(sInputStream);
1463 326 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1464 : }
1465 2789 : if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1466 : {
1467 1 : pValue[nActProp].Name = rtl::OUString(sStream);
1468 1 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1469 : }
1470 2789 : if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET )
1471 : {
1472 2 : pValue[nActProp].Name = rtl::OUString(sOutputStream);
1473 2 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1474 : }
1475 2789 : 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 2789 : if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET )
1481 : {
1482 0 : pValue[nActProp].Name = rtl::OUString(sFrame);
1483 0 : 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 0 : else if ( pItem->ISA( SfxUnoFrameItem ) )
1489 0 : pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame();
1490 : else
1491 : OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1492 : }
1493 2789 : if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET )
1494 : {
1495 9 : pValue[nActProp].Name = rtl::OUString(sAsTemplate);
1496 9 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1497 : }
1498 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET )
1509 : {
1510 0 : pValue[nActProp].Name = rtl::OUString(sViewId);
1511 0 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1512 : }
1513 2789 : 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 2789 : if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET )
1519 : {
1520 584 : pValue[nActProp].Name = rtl::OUString(sReadOnly);
1521 584 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1522 : }
1523 2789 : 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 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET )
1539 : {
1540 16 : pValue[nActProp].Name = rtl::OUString(sHidden);
1541 16 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1542 : }
1543 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET )
1602 : {
1603 0 : pValue[nActProp].Name = rtl::OUString(sMediaType);
1604 0 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1605 : }
1606 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET )
1628 : {
1629 1878 : pValue[nActProp].Name = rtl::OUString(sMacroExecMode);
1630 1878 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1631 : }
1632 2789 : if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET )
1633 : {
1634 1699 : pValue[nActProp].Name = rtl::OUString(sUpdateDocMode);
1635 1699 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1636 : }
1637 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET )
1648 : {
1649 2501 : pValue[nActProp].Name = rtl::OUString(sDocumentBaseURL);
1650 2501 : pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) );
1651 : }
1652 2789 : 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 2789 : 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 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET )
1673 : {
1674 14 : pValue[nActProp].Name = rtl::OUString(sEncryptionData);
1675 14 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1676 : }
1677 2789 : 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 2789 : 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 2789 : if ( rSet.GetItemState( SID_DOC_SERVICE, sal_False, &pItem ) == SFX_ITEM_SET )
1688 : {
1689 1683 : pValue[nActProp].Name = rtl::OUString(sDocumentService);
1690 1683 : pValue[nActProp++].Value <<= rtl::OUString(static_cast<const SfxStringItem*>(pItem)->GetValue());
1691 : }
1692 : }
1693 : }
1694 :
1695 2789 : rArgs = aSequ;
1696 : }
1697 :
1698 0 : 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 0 : 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 44 : SFX_IMPL_XSERVICEINFO( SfxMacroLoader, PROTOCOLHANDLER_SERVICENAME, "com.sun.star.comp.sfx2.SfxMacroLoader" )
1701 0 : SFX_IMPL_SINGLEFACTORY( SfxMacroLoader )
1702 :
1703 0 : 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 0 : Reference < XFrame > xFrame;
1706 0 : if ( aArguments.getLength() )
1707 : {
1708 0 : aArguments[0] >>= xFrame;
1709 0 : m_xFrame = xFrame;
1710 0 : }
1711 0 : }
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 0 : ::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 0 : ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher;
1740 0 : if(aURL.Complete.compareToAscii("macro:",6)==0)
1741 0 : xDispatcher = this;
1742 0 : return xDispatcher;
1743 : }
1744 :
1745 : // -----------------------------------------------------------------------
1746 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL
1747 0 : SfxMacroLoader::queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor )
1748 : throw( ::com::sun::star::uno::RuntimeException )
1749 : {
1750 0 : sal_Int32 nCount = seqDescriptor.getLength();
1751 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
1752 0 : for( sal_Int32 i=0; i<nCount; ++i )
1753 0 : lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
1754 0 : seqDescriptor[i].FrameName,
1755 0 : seqDescriptor[i].SearchFlags );
1756 0 : 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( OUString(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 44 : SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" ) \
1977 0 : SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider );
1978 :
1979 0 : 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 0 : Reference < XFrame > xFrame;
1982 0 : if ( aArguments.getLength() )
1983 : {
1984 0 : aArguments[0] >>= xFrame;
1985 0 : m_xFrame = xFrame;
1986 0 : }
1987 0 : }
1988 :
1989 0 : 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 0 : sal_uInt16 nId( 0 );
1995 0 : sal_Bool bMasterCommand( sal_False );
1996 0 : Reference < XDispatch > xDisp;
1997 0 : const SfxSlot* pSlot = 0;
1998 0 : SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl();
1999 0 : if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL ||
2000 0 : 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 0 : else if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL )
2007 : {
2008 : // Support ".uno" commands. Map commands to slotid
2009 0 : bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL );
2010 0 : if ( bMasterCommand )
2011 0 : pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) );
2012 : else
2013 0 : pSlot = pAppDisp->GetSlot( aURL.Main );
2014 : }
2015 :
2016 0 : if ( pSlot )
2017 : {
2018 0 : SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ;
2019 0 : pDispatch->SetFrame(m_xFrame);
2020 0 : pDispatch->SetMasterUnoCommand( bMasterCommand );
2021 0 : xDisp = pDispatch;
2022 : }
2023 :
2024 0 : return xDisp;
2025 : }
2026 :
2027 0 : Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor )
2028 : throw( RuntimeException )
2029 : {
2030 0 : sal_Int32 nCount = seqDescriptor.getLength();
2031 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount);
2032 0 : for( sal_Int32 i=0; i<nCount; ++i )
2033 0 : lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL,
2034 0 : seqDescriptor[i].FrameName,
2035 0 : seqDescriptor[i].SearchFlags );
2036 0 : 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 44 : 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 44 : void* pReturn = NULL ;
2201 :
2202 44 : 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 44 : xFactory;
2210 44 : ::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 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl )
2218 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl )
2219 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader )
2220 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider )
2221 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService )
2222 44 : IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon )
2223 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationScriptLibraryContainer )
2224 44 : IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationDialogLibraryContainer )
2225 : #ifdef TEST_HANDLERS
2226 : IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler )
2227 : IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler )
2228 : #endif
2229 44 : IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator )
2230 44 : IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject )
2231 44 : IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject )
2232 44 : IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService )
2233 88 : if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals(
2234 88 : ::rtl::OUString::createFromAscii( pImplementationName ) ) )
2235 : {
2236 : xFactory = ::cppu::createSingleComponentFactory(
2237 : ::comp_SfxDocumentMetaData::_create,
2238 : ::comp_SfxDocumentMetaData::_getImplementationName(),
2239 15 : ::comp_SfxDocumentMetaData::_getSupportedServiceNames());
2240 : }
2241 88 : if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
2242 88 : ::rtl::OUString::createFromAscii( pImplementationName ) ) )
2243 : {
2244 : xFactory = ::cppu::createSingleComponentFactory(
2245 : ::comp_CompatWriterDocProps::_create,
2246 : ::comp_CompatWriterDocProps::_getImplementationName(),
2247 0 : ::comp_CompatWriterDocProps::_getSupportedServiceNames());
2248 : }
2249 :
2250 : // Factory is valid - service was found.
2251 :
2252 : // Factory is valid - service was found.
2253 44 : if ( xFactory.is() )
2254 : {
2255 44 : xFactory->acquire();
2256 44 : pReturn = xFactory.get();
2257 44 : }
2258 : }
2259 : // Return with result of this operation.
2260 44 : return pReturn ;
2261 : }
2262 : } // extern "C"
2263 :
2264 : //=========================================================================
2265 :
2266 0 : void SAL_CALL FilterOptionsContinuation::setFilterOptions(
2267 : const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps )
2268 : throw (::com::sun::star::uno::RuntimeException)
2269 : {
2270 0 : rProperties = rProps;
2271 0 : }
2272 :
2273 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL
2274 0 : FilterOptionsContinuation::getFilterOptions()
2275 : throw (::com::sun::star::uno::RuntimeException)
2276 : {
2277 0 : return rProperties;
2278 : }
2279 :
2280 : //=========================================================================
2281 :
2282 0 : RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel,
2283 0 : ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties )
2284 : {
2285 0 : ::rtl::OUString temp;
2286 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2287 : ::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp,
2288 : temp2,
2289 : rModel,
2290 0 : rProperties );
2291 :
2292 0 : m_aRequest <<= aOptionsRequest;
2293 :
2294 0 : m_pAbort = new comphelper::OInteractionAbort;
2295 0 : m_pOptions = new FilterOptionsContinuation;
2296 :
2297 0 : m_lContinuations.realloc( 2 );
2298 0 : m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
2299 0 : m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions );
2300 0 : }
2301 :
2302 0 : ::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest()
2303 : throw( ::com::sun::star::uno::RuntimeException )
2304 : {
2305 0 : return m_aRequest;
2306 : }
2307 :
2308 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2309 0 : SAL_CALL RequestFilterOptions::getContinuations()
2310 : throw( ::com::sun::star::uno::RuntimeException )
2311 : {
2312 0 : return m_lContinuations;
2313 : }
2314 :
2315 : //=========================================================================
2316 0 : class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
2317 : {
2318 : ::com::sun::star::uno::Any m_aRequest;
2319 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
2320 : comphelper::OInteractionApprove* m_pApprove;
2321 : comphelper::OInteractionDisapprove* m_pDisapprove;
2322 :
2323 : public:
2324 : RequestPackageReparation_Impl( ::rtl::OUString aName );
2325 : sal_Bool isApproved();
2326 : virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
2327 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
2328 : throw( ::com::sun::star::uno::RuntimeException );
2329 : };
2330 :
2331 0 : RequestPackageReparation_Impl::RequestPackageReparation_Impl( ::rtl::OUString aName )
2332 : {
2333 0 : ::rtl::OUString temp;
2334 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2335 : ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
2336 : temp2,
2337 0 : aName );
2338 0 : m_aRequest <<= aBrokenPackageRequest;
2339 0 : m_pApprove = new comphelper::OInteractionApprove;
2340 0 : m_pDisapprove = new comphelper::OInteractionDisapprove;
2341 0 : m_lContinuations.realloc( 2 );
2342 0 : m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove );
2343 0 : m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove );
2344 0 : }
2345 :
2346 0 : sal_Bool RequestPackageReparation_Impl::isApproved()
2347 : {
2348 0 : return m_pApprove->wasSelected();
2349 : }
2350 :
2351 0 : ::com::sun::star::uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
2352 : throw( ::com::sun::star::uno::RuntimeException )
2353 : {
2354 0 : return m_aRequest;
2355 : }
2356 :
2357 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2358 0 : SAL_CALL RequestPackageReparation_Impl::getContinuations()
2359 : throw( ::com::sun::star::uno::RuntimeException )
2360 : {
2361 0 : return m_lContinuations;
2362 : }
2363 :
2364 0 : RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName )
2365 : {
2366 0 : pImp = new RequestPackageReparation_Impl( aName );
2367 0 : pImp->acquire();
2368 0 : }
2369 :
2370 0 : RequestPackageReparation::~RequestPackageReparation()
2371 : {
2372 0 : pImp->release();
2373 0 : }
2374 :
2375 0 : sal_Bool RequestPackageReparation::isApproved()
2376 : {
2377 0 : return pImp->isApproved();
2378 : }
2379 :
2380 0 : com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > RequestPackageReparation::GetRequest()
2381 : {
2382 0 : return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
2383 : }
2384 :
2385 : //=========================================================================
2386 0 : class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest >
2387 : {
2388 : ::com::sun::star::uno::Any m_aRequest;
2389 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations;
2390 : comphelper::OInteractionAbort* m_pAbort;
2391 :
2392 : public:
2393 : NotifyBrokenPackage_Impl( ::rtl::OUString aName );
2394 : virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException );
2395 : virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations()
2396 : throw( ::com::sun::star::uno::RuntimeException );
2397 : };
2398 :
2399 0 : NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( ::rtl::OUString aName )
2400 : {
2401 0 : ::rtl::OUString temp;
2402 0 : ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2;
2403 : ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp,
2404 : temp2,
2405 0 : aName );
2406 0 : m_aRequest <<= aBrokenPackageRequest;
2407 0 : m_pAbort = new comphelper::OInteractionAbort;
2408 0 : m_lContinuations.realloc( 1 );
2409 0 : m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort );
2410 0 : }
2411 :
2412 0 : ::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
2413 : throw( ::com::sun::star::uno::RuntimeException )
2414 : {
2415 0 : return m_aRequest;
2416 : }
2417 :
2418 : ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > >
2419 0 : SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
2420 : throw( ::com::sun::star::uno::RuntimeException )
2421 : {
2422 0 : return m_lContinuations;
2423 : }
2424 :
2425 0 : NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName )
2426 : {
2427 0 : pImp = new NotifyBrokenPackage_Impl( aName );
2428 0 : pImp->acquire();
2429 0 : }
2430 :
2431 0 : NotifyBrokenPackage::~NotifyBrokenPackage()
2432 : {
2433 0 : pImp->release();
2434 0 : }
2435 :
2436 0 : com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
2437 : {
2438 0 : return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp);
2439 : }
2440 :
2441 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|