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 :
24 : #include "fltoptint.hxx"
25 : #include "objshimp.hxx"
26 : #include <sfx2/app.hxx>
27 : #include <sfx2/brokenpackageint.hxx>
28 : #include <sfx2/dispatch.hxx>
29 : #include <sfx2/docfile.hxx>
30 : #include <sfx2/fcontnr.hxx>
31 : #include <sfx2/frame.hxx>
32 : #include <sfx2/module.hxx>
33 : #include <sfx2/msg.hxx>
34 : #include <sfx2/msgpool.hxx>
35 : #include <sfx2/objsh.hxx>
36 : #include <sfx2/request.hxx>
37 : #include <sfx2/sfxbasecontroller.hxx>
38 : #include <sfx2/sfxsids.hrc>
39 : #include <sfx2/sfxuno.hxx>
40 : #include <sfx2/unoctitm.hxx>
41 : #include "sfxslots.hxx"
42 : #include "sfxtypes.hxx"
43 :
44 : #include <sal/config.h>
45 : #include <basic/basmgr.hxx>
46 : #include <basic/sberrors.hxx>
47 : #include <basic/sbmeth.hxx>
48 : #include <basic/sbuno.hxx>
49 : #include <basic/sbx.hxx>
50 : #include <basic/sbxcore.hxx>
51 : #include <basic/sbxmeth.hxx>
52 : #include <basic/sbxobj.hxx>
53 : #include <comphelper/interaction.hxx>
54 : #include <framework/documentundoguard.hxx>
55 : #include <svl/eitem.hxx>
56 : #include <svl/intitem.hxx>
57 : #include <svl/itempool.hxx>
58 : #include <svl/lckbitem.hxx>
59 : #include <svl/ownlist.hxx>
60 : #include <svl/rectitem.hxx>
61 : #include <svl/slstitm.hxx>
62 : #include <svl/stritem.hxx>
63 : #include <tools/config.hxx>
64 : #include <tools/debug.hxx>
65 : #include <tools/urlobj.hxx>
66 :
67 : #include <com/sun/star/frame/XFrame.hpp>
68 : #include <com/sun/star/frame/XModel.hpp>
69 : #include <com/sun/star/io/XInputStream.hpp>
70 : #include <com/sun/star/task/XInteractionHandler.hpp>
71 : #include <com/sun/star/ucb/XContent.hpp>
72 :
73 : #include <boost/scoped_ptr.hpp>
74 :
75 : using namespace ::com::sun::star;
76 : using namespace ::com::sun::star::ucb;
77 : using namespace ::com::sun::star::uno;
78 : using namespace ::com::sun::star::registry;
79 : using namespace ::com::sun::star::frame;
80 : using namespace ::com::sun::star::beans;
81 : using namespace ::com::sun::star::io;
82 :
83 : // needs to be converted to a better data structure
84 : SfxFormalArgument aFormalArgs[] = {
85 : SFX_ARGUMENT(SID_DEFAULTFILENAME,"SuggestedSaveAsName",SfxStringItem),
86 : SFX_ARGUMENT(SID_DEFAULTFILEPATH,"SuggestedSaveAsDir",SfxStringItem),
87 : SFX_ARGUMENT(SID_DOCINFO_AUTHOR,"VersionAuthor",SfxStringItem),
88 : SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxStringItem),
89 : SFX_ARGUMENT(SID_DOCINFO_MAJOR,"VersionMajor",SfxBoolItem),
90 : SFX_ARGUMENT(SID_FILE_FILTEROPTIONS,"FilterOptions",SfxStringItem),
91 : SFX_ARGUMENT(SID_FILTER_NAME,"FilterName",SfxStringItem),
92 : // SFX_ARGUMENT(SID_FILE_NAME,"FileName",SfxStringItem),
93 : SFX_ARGUMENT(SID_FILE_NAME,"URL",SfxStringItem),
94 : SFX_ARGUMENT(SID_OPTIONS,"OpenFlags",SfxStringItem),
95 : SFX_ARGUMENT(SID_OVERWRITE,"Overwrite",SfxBoolItem),
96 : SFX_ARGUMENT(SID_PASSWORD,"Password",SfxStringItem),
97 : SFX_ARGUMENT(SID_PASSWORDINTERACTION,"PasswordInteraction",SfxBoolItem),
98 : SFX_ARGUMENT(SID_REFERER,"Referer",SfxStringItem),
99 : SFX_ARGUMENT(SID_SAVETO,"SaveTo",SfxBoolItem),
100 : SFX_ARGUMENT(SID_TEMPLATE_NAME,"TemplateName",SfxStringItem),
101 : SFX_ARGUMENT(SID_TEMPLATE_REGIONNAME,"TemplateRegion",SfxStringItem),
102 : // SFX_ARGUMENT(SID_TEMPLATE_REGIONNAME,"Region",SfxStringItem),
103 : // SFX_ARGUMENT(SID_TEMPLATE_NAME,"Name",SfxStringItem),
104 : SFX_ARGUMENT(SID_UNPACK,"Unpacked",SfxBoolItem),
105 : SFX_ARGUMENT(SID_VERSION,"Version",SfxInt16Item),
106 : SFX_ARGUMENT(SID_SAVEACOPYITEM,"SaveACopy",SfxBoolItem),
107 : };
108 :
109 : static sal_uInt16 nMediaArgsCount = sizeof(aFormalArgs) / sizeof (SfxFormalArgument);
110 :
111 : static char const sTemplateRegionName[] = "TemplateRegionName";
112 : static char const sTemplateName[] = "TemplateName";
113 : static char const sAsTemplate[] = "AsTemplate";
114 : static char const sOpenNewView[] = "OpenNewView";
115 : static char const sViewId[] = "ViewId";
116 : static char const sPluginMode[] = "PluginMode";
117 : static char const sReadOnly[] = "ReadOnly";
118 : static char const sDdeReconnect[] = "DDEReconnect";
119 : static char const sStartPresentation[] = "StartPresentation";
120 : static char const sFrameName[] = "FrameName";
121 : static char const sMediaType[] = "MediaType";
122 : static char const sPostData[] = "PostData";
123 : static char const sCharacterSet[] = "CharacterSet";
124 : static char const sInputStream[] = "InputStream";
125 : static char const sStream[] = "Stream";
126 : static char const sOutputStream[] = "OutputStream";
127 : static char const sHidden[] = "Hidden";
128 : static char const sPreview[] = "Preview";
129 : static char const sViewOnly[] = "ViewOnly";
130 : static char const sDontEdit[] = "DontEdit";
131 : static char const sSilent[] = "Silent";
132 : static char const sJumpMark[] = "JumpMark";
133 : static char const sFileName[] = "FileName";
134 : static char const sSalvagedFile[] = "SalvagedFile";
135 : static char const sStatusInd[] = "StatusIndicator";
136 : static char const sModel[] = "Model";
137 : static char const sFrame[] = "Frame";
138 : static char const sViewData[] = "ViewData";
139 : static char const sFilterData[] = "FilterData";
140 : static char const sSelectionOnly[] = "SelectionOnly";
141 : static char const sFilterFlags[] = "FilterFlags";
142 : static char const sMacroExecMode[] = "MacroExecutionMode";
143 : static char const sUpdateDocMode[] = "UpdateDocMode";
144 : static char const sMinimized[] = "Minimized";
145 : static char const sInteractionHdl[] = "InteractionHandler";
146 : static char const sUCBContent[] = "UCBContent";
147 : static char const sRepairPackage[] = "RepairPackage";
148 : static char const sDocumentTitle[] = "DocumentTitle";
149 : static char const sComponentData[] = "ComponentData";
150 : static char const sComponentContext[] = "ComponentContext";
151 : static char const sDocumentBaseURL[] = "DocumentBaseURL";
152 : static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName";
153 : static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible";
154 : static char const sNoAutoSave[] = "NoAutoSave";
155 : static char const sFolderName[] = "FolderName";
156 : static char const sUseSystemDialog[] = "UseSystemDialog";
157 : static char const sStandardDir[] = "StandardDir";
158 : static char const sBlackList[] = "BlackList";
159 : static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
160 : static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
161 : static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
162 : static char const sEncryptionData[] = "EncryptionData";
163 : static char const sFailOnWarning[] = "FailOnWarning";
164 : static char const sDocumentService[] = "DocumentService";
165 : static char const sFilterProvider[] = "FilterProvider";
166 :
167 0 : static bool isMediaDescriptor( sal_uInt16 nSlotId )
168 : {
169 0 : return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC ||
170 0 : nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
171 0 : nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF ||
172 0 : nSlotId == SID_DIRECTEXPORTDOCASPDF || nSlotId == SID_SAVEACOPY ||
173 0 : nSlotId == SID_SAVEACOPYITEM);
174 : }
175 :
176 0 : void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
177 : {
178 0 : if ( !pSlot )
179 0 : pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
180 :
181 0 : if ( !pSlot )
182 0 : return;
183 :
184 0 : if ( nSlotId == SID_OPENURL )
185 0 : nSlotId = SID_OPENDOC;
186 0 : if ( nSlotId == SID_SAVEASURL )
187 0 : nSlotId = SID_SAVEASDOC;
188 :
189 0 : sal_Int32 nCount = rArgs.getLength();
190 0 : if ( !nCount )
191 0 : return;
192 :
193 0 : const beans::PropertyValue* pPropsVal = rArgs.getConstArray();
194 0 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
195 : {
196 : // slot is a property
197 0 : const SfxType* pType = pSlot->GetType();
198 0 : boost::scoped_ptr<SfxPoolItem> pItem(pType->CreateItem());
199 :
200 0 : if ( !pItem )
201 : {
202 : #ifdef DBG_UTIL
203 : OStringBuffer aStr("No creator method for item: ");
204 : aStr.append(static_cast<sal_Int32>(nSlotId));
205 : OSL_FAIL(aStr.getStr());
206 : #endif
207 0 : return;
208 : }
209 :
210 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
211 0 : bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
212 0 : pItem->SetWhich( nWhich );
213 0 : sal_uInt16 nSubCount = pType->nAttribs;
214 :
215 0 : const beans::PropertyValue& rProp = pPropsVal[0];
216 0 : OUString aName = rProp.Name;
217 0 : if ( nCount == 1 && aName == OUString( pSlot->pUnoName, strlen( pSlot->pUnoName ), RTL_TEXTENCODING_UTF8 ) )
218 : {
219 : // there is only one parameter and its name matches the name of the property,
220 : // so it's either a simple property or a complex property in one single UNO struct
221 0 : if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
222 : // only use successfully converted items
223 0 : rSet.Put( *pItem );
224 : #ifdef DBG_UTIL
225 : else
226 : {
227 : OStringBuffer aStr("Property not convertible: ");
228 : aStr.append(pSlot->pUnoName);
229 : OSL_FAIL( aStr.getStr() );
230 : }
231 : #endif
232 : }
233 : #ifdef DBG_UTIL
234 : else if ( nSubCount == 0 )
235 : {
236 : // for a simple property there can be only one parameter and its name *must* match
237 : OUStringBuffer aStr("Property name does not match: ");
238 : aStr.append(aName);
239 : OSL_FAIL( aStr.getStr() );
240 : }
241 : #endif
242 : else
243 : {
244 : // there is more than one parameter and the property is a complex one
245 : #ifdef DBG_UTIL
246 : // if the dispatch API is used for UI purposes or from the testtool,
247 : // it is possible to skip some or all arguments,
248 : // but it indicates an error for macro recording;
249 : // so this should be notified as a warning only
250 : if ( nCount != nSubCount )
251 : {
252 : OStringBuffer aStr("MacroPlayer: wrong number of parameters for slot: ");
253 : aStr.append(static_cast<sal_Int32>(nSlotId));
254 : DBG_WARNING(aStr.getStr());
255 : }
256 : #endif
257 : // complex property; collect sub items from the parameter set and reconstruct complex item
258 0 : sal_uInt16 nFound=0;
259 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
260 : {
261 0 : const beans::PropertyValue& rPropValue = pPropsVal[n];
262 : sal_uInt16 nSub;
263 0 : for ( nSub=0; nSub<nSubCount; nSub++ )
264 : {
265 : // search sub item by name
266 0 : OStringBuffer aStr;
267 0 : aStr.append(pSlot->pUnoName).append('.').append(pType->aAttrib[nSub].pName);
268 0 : if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
269 : {
270 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
271 0 : if ( bConvertTwips )
272 0 : nSubId |= CONVERT_TWIPS;
273 0 : if ( pItem->PutValue( rPropValue.Value, nSubId ) )
274 0 : nFound++;
275 : #ifdef DBG_UTIL
276 : else
277 : {
278 : OStringBuffer aDbgStr("Property not convertible: ");
279 : aDbgStr.append(pSlot->pUnoName);
280 : OSL_FAIL( aDbgStr.getStr() );
281 : }
282 : #endif
283 0 : break;
284 : }
285 0 : }
286 :
287 : #ifdef DBG_UTIL
288 : if ( nSub >= nSubCount )
289 : {
290 : // there was a parameter with a name that didn't match to any of the members
291 : OStringBuffer aStr("Property name does not match: ");
292 : aStr.append(OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8));
293 : OSL_FAIL( aStr.getStr() );
294 : }
295 : #endif
296 : }
297 :
298 : // at least one part of the complex item must be present; other parts can have default values
299 0 : if ( nFound > 0 )
300 0 : rSet.Put( *pItem );
301 : }
302 :
303 0 : return;
304 : }
305 :
306 : OSL_ASSERT(nCount > 0);
307 :
308 : #ifdef DBG_UTIL
309 : // detect parameters that don't match to any formal argument or one of its members
310 : sal_Int32 nFoundArgs = 0;
311 : #endif
312 : // slot is a method
313 0 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
314 0 : sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
315 0 : for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
316 : {
317 0 : const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
318 0 : boost::scoped_ptr<SfxPoolItem> pItem(rArg.CreateItem());
319 0 : if ( !pItem )
320 : {
321 : #ifdef DBG_UTIL
322 : OStringBuffer aStr("No creator method for argument: ");
323 : aStr.append(rArg.pName);
324 : OSL_FAIL( aStr.getStr() );
325 : #endif
326 0 : return;
327 : }
328 :
329 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
330 0 : bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
331 0 : pItem->SetWhich( nWhich );
332 0 : const SfxType* pType = rArg.pType;
333 0 : sal_uInt16 nSubCount = pType->nAttribs;
334 0 : if ( nSubCount == 0 )
335 : {
336 : // "simple" (base type) argument
337 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
338 : {
339 0 : const beans::PropertyValue& rProp = pPropsVal[n];
340 0 : OUString aName = rProp.Name;
341 0 : if ( aName == OUString( rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8 ) )
342 : {
343 : #ifdef DBG_UTIL
344 : ++nFoundArgs;
345 : #endif
346 0 : if( pItem->PutValue( rProp.Value ) )
347 : // only use successfully converted items
348 0 : rSet.Put( *pItem );
349 : #ifdef DBG_UTIL
350 : else
351 : {
352 : OStringBuffer aStr("Property not convertible: ");
353 : aStr.append(rArg.pName);
354 : OSL_FAIL( aStr.getStr() );
355 : }
356 : #endif
357 0 : break;
358 : }
359 0 : }
360 : }
361 : else
362 : {
363 : // complex argument, could be passed in one struct
364 0 : bool bAsWholeItem = false;
365 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
366 : {
367 0 : const beans::PropertyValue& rProp = pPropsVal[n];
368 0 : OUString aName = rProp.Name;
369 0 : if ( aName == OUString(rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8) )
370 : {
371 0 : bAsWholeItem = true;
372 : #ifdef DBG_UTIL
373 : ++nFoundArgs;
374 : #endif
375 0 : if( pItem->PutValue( rProp.Value ) )
376 : // only use successfully converted items
377 0 : rSet.Put( *pItem );
378 : #ifdef DBG_UTIL
379 : else
380 : {
381 : OStringBuffer aStr("Property not convertible: ");
382 : aStr.append(rArg.pName);
383 : OSL_FAIL( aStr.getStr() );
384 : }
385 : #endif
386 : }
387 0 : }
388 :
389 0 : if ( !bAsWholeItem )
390 : {
391 : // complex argument; collect sub items from argument array and reconstruct complex item
392 : // only put item if at least one member was found and had the correct type
393 : // (is this a good idea?! Should we ask for *all* members?)
394 0 : bool bRet = false;
395 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
396 : {
397 0 : const beans::PropertyValue& rProp = pPropsVal[n];
398 0 : for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
399 : {
400 : // search sub item by name
401 0 : OStringBuffer aStr;
402 0 : aStr.append(rArg.pName).append('.').append(pType->aAttrib[nSub].pName);
403 0 : if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
404 : {
405 : // at least one member found ...
406 0 : bRet = true;
407 : #ifdef DBG_UTIL
408 : ++nFoundArgs;
409 : #endif
410 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
411 0 : if ( bConvertTwips )
412 0 : nSubId |= CONVERT_TWIPS;
413 0 : if (!pItem->PutValue( rProp.Value, nSubId ) )
414 : {
415 : // ... but it was not convertible
416 0 : bRet = false;
417 : #ifdef DBG_UTIL
418 : OStringBuffer aDbgStr("Property not convertible: ");
419 : aDbgStr.append(rArg.pName);
420 : OSL_FAIL( aDbgStr.getStr() );
421 : #endif
422 : }
423 :
424 0 : break;
425 : }
426 0 : }
427 : }
428 :
429 0 : if ( bRet )
430 : // only use successfully converted items
431 0 : rSet.Put( *pItem );
432 :
433 : }
434 : }
435 0 : }
436 :
437 : // special additional parameters for some slots not seen in the slot definitions
438 : // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
439 : // but as dispatching or factory or arbitrary URLs to the frame
440 : // Some also can use additional arguments that are not recordable (will be changed later,
441 : // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
442 0 : if ( nSlotId == SID_NEWWINDOW )
443 : {
444 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
445 : {
446 0 : const beans::PropertyValue& rProp = pPropsVal[n];
447 0 : OUString aName = rProp.Name;
448 0 : if ( aName == sFrame )
449 : {
450 0 : Reference< XFrame > xFrame;
451 0 : OSL_VERIFY( rProp.Value >>= xFrame );
452 0 : rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
453 : }
454 : else
455 0 : if ( aName == sHidden )
456 : {
457 0 : bool bVal = false;
458 0 : if (rProp.Value >>= bVal)
459 0 : rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
460 : }
461 0 : }
462 : }
463 0 : else if ( bIsMediaDescriptor )
464 : {
465 0 : for ( sal_uInt16 n=0; n<nCount; n++ )
466 : {
467 : #ifdef DBG_UTIL
468 : ++nFoundArgs;
469 : #endif
470 0 : const beans::PropertyValue& rProp = pPropsVal[n];
471 0 : const OUString& aName = rProp.Name;
472 0 : if ( aName == sModel )
473 0 : rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
474 0 : else if ( aName == sComponentData )
475 : {
476 0 : rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
477 : }
478 0 : else if ( aName == sComponentContext )
479 : {
480 0 : rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
481 : }
482 0 : else if ( aName == sStatusInd )
483 : {
484 0 : Reference<task::XStatusIndicator> xVal;
485 0 : bool bOK = (rProp.Value >>= xVal);
486 : DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
487 0 : if (bOK && xVal.is())
488 0 : rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
489 : }
490 0 : else if ( aName == sInteractionHdl )
491 : {
492 0 : Reference<task::XInteractionHandler> xVal;
493 0 : bool bOK = (rProp.Value >>= xVal);
494 : DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
495 0 : if (bOK && xVal.is())
496 0 : rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
497 : }
498 0 : else if ( aName == sViewData )
499 0 : rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
500 0 : else if ( aName == sFilterData )
501 0 : rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
502 0 : else if ( aName == sInputStream )
503 : {
504 0 : Reference< XInputStream > xVal;
505 0 : bool bOK = ((rProp.Value >>= xVal) && xVal.is());
506 : DBG_ASSERT( bOK, "invalid type for InputStream" );
507 0 : if (bOK)
508 0 : rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
509 : }
510 0 : else if ( aName == sStream )
511 : {
512 0 : Reference< XInputStream > xVal;
513 0 : bool bOK = ((rProp.Value >>= xVal) && xVal.is());
514 : DBG_ASSERT( bOK, "invalid type for Stream" );
515 0 : if (bOK)
516 0 : rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
517 : }
518 0 : else if ( aName == sUCBContent )
519 : {
520 0 : Reference< XContent > xVal;
521 0 : bool bOK = ((rProp.Value >>= xVal) && xVal.is());
522 : DBG_ASSERT( bOK, "invalid type for UCBContent" );
523 0 : if (bOK)
524 0 : rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
525 : }
526 0 : else if ( aName == sOutputStream )
527 : {
528 0 : Reference< XOutputStream > xVal;
529 0 : bool bOK = ((rProp.Value >>= xVal) && xVal.is());
530 : DBG_ASSERT( bOK, "invalid type for OutputStream" );
531 0 : if (bOK)
532 0 : rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
533 : }
534 0 : else if ( aName == sPostData )
535 : {
536 0 : Reference< XInputStream > xVal;
537 0 : bool bOK = (rProp.Value >>= xVal);
538 : DBG_ASSERT( bOK, "invalid type for PostData" );
539 0 : if (bOK)
540 0 : rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
541 : }
542 0 : else if ( aName == sFrame )
543 : {
544 0 : Reference< XFrame > xFrame;
545 0 : bool bOK = (rProp.Value >>= xFrame);
546 : DBG_ASSERT( bOK, "invalid type for Frame" );
547 0 : if (bOK)
548 0 : rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
549 : }
550 0 : else if ( aName == sAsTemplate )
551 : {
552 0 : bool bVal = false;
553 0 : bool bOK = (rProp.Value >>= bVal);
554 : DBG_ASSERT( bOK, "invalid type for AsTemplate" );
555 0 : if (bOK)
556 0 : rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
557 : }
558 0 : else if ( aName == sOpenNewView )
559 : {
560 0 : bool bVal = false;
561 0 : bool bOK = (rProp.Value >>= bVal);
562 : DBG_ASSERT( bOK, "invalid type for OpenNewView" );
563 0 : if (bOK)
564 0 : rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
565 : }
566 0 : else if ( aName == sFailOnWarning )
567 : {
568 0 : bool bVal = false;
569 0 : bool bOK = (rProp.Value >>= bVal);
570 : DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
571 0 : if (bOK)
572 0 : rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
573 : }
574 0 : else if ( aName == sViewId )
575 : {
576 0 : sal_Int16 nVal = -1;
577 0 : bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
578 : DBG_ASSERT( bOK, "invalid type for ViewId" );
579 0 : if (bOK)
580 0 : rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
581 : }
582 0 : else if ( aName == sPluginMode )
583 : {
584 0 : sal_Int16 nVal = -1;
585 0 : bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
586 : DBG_ASSERT( bOK, "invalid type for PluginMode" );
587 0 : if (bOK)
588 0 : rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
589 : }
590 0 : else if ( aName == sReadOnly )
591 : {
592 0 : bool bVal = false;
593 0 : bool bOK = (rProp.Value >>= bVal);
594 : DBG_ASSERT( bOK, "invalid type for ReadOnly" );
595 0 : if (bOK)
596 0 : rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
597 : }
598 0 : else if ( aName == sDdeReconnect )
599 : {
600 0 : bool bVal = true;
601 0 : bool bOK = (rProp.Value >>= bVal);
602 : DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
603 0 : if (bOK)
604 0 : rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
605 : }
606 0 : else if ( aName == sStartPresentation )
607 : {
608 0 : bool bVal = false;
609 0 : bool bOK = (rProp.Value >>= bVal);
610 : DBG_ASSERT( bOK, "invalid type for StartPresentation" );
611 0 : if (bOK)
612 0 : rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
613 : }
614 0 : else if ( aName == sSelectionOnly )
615 : {
616 0 : bool bVal = false;
617 0 : bool bOK = (rProp.Value >>= bVal);
618 : DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
619 0 : if (bOK)
620 0 : rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
621 : }
622 0 : else if ( aName == sHidden )
623 : {
624 0 : bool bVal = false;
625 0 : bool bOK = (rProp.Value >>= bVal);
626 : DBG_ASSERT( bOK, "invalid type for Hidden" );
627 0 : if (bOK)
628 0 : rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
629 : }
630 0 : else if ( aName == sMinimized )
631 : {
632 0 : bool bVal = false;
633 0 : bool bOK = (rProp.Value >>= bVal);
634 : DBG_ASSERT( bOK, "invalid type for Minimized" );
635 0 : if (bOK)
636 0 : rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
637 : }
638 0 : else if ( aName == sSilent )
639 : {
640 0 : bool bVal = false;
641 0 : bool bOK = (rProp.Value >>= bVal);
642 : DBG_ASSERT( bOK, "invalid type for Silent" );
643 0 : if (bOK)
644 0 : rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
645 : }
646 0 : else if ( aName == sPreview )
647 : {
648 0 : bool bVal = false;
649 0 : bool bOK = (rProp.Value >>= bVal);
650 : DBG_ASSERT( bOK, "invalid type for Preview" );
651 0 : if (bOK)
652 0 : rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
653 : }
654 0 : else if ( aName == sViewOnly )
655 : {
656 0 : bool bVal = false;
657 0 : bool bOK = (rProp.Value >>= bVal);
658 : DBG_ASSERT( bOK, "invalid type for ViewOnly" );
659 0 : if (bOK)
660 0 : rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
661 : }
662 0 : else if ( aName == sDontEdit )
663 : {
664 0 : bool bVal = false;
665 0 : bool bOK = (rProp.Value >>= bVal);
666 : DBG_ASSERT( bOK, "invalid type for ViewOnly" );
667 0 : if (bOK)
668 0 : rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
669 : }
670 0 : else if ( aName == sUseSystemDialog )
671 : {
672 0 : bool bVal = false;
673 0 : bool bOK = (rProp.Value >>= bVal);
674 : DBG_ASSERT( bOK, "invalid type for ViewOnly" );
675 0 : if (bOK)
676 0 : rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
677 : }
678 0 : else if ( aName == sStandardDir )
679 : {
680 0 : OUString sVal;
681 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
682 : DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
683 0 : if (bOK)
684 0 : rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
685 : }
686 0 : else if ( aName == sBlackList )
687 : {
688 0 : uno::Sequence<OUString> xVal;
689 0 : bool bOK = (rProp.Value >>= xVal);
690 : DBG_ASSERT( bOK, "invalid type or value for BlackList" );
691 0 : if (bOK)
692 : {
693 0 : SfxStringListItem stringList(SID_BLACK_LIST);
694 0 : stringList.SetStringList( xVal );
695 0 : rSet.Put( stringList );
696 0 : }
697 : }
698 0 : else if ( aName == sFileName )
699 : {
700 0 : OUString sVal;
701 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
702 : DBG_ASSERT( bOK, "invalid type or value for FileName" );
703 0 : if (bOK)
704 0 : rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
705 : }
706 0 : else if ( aName == sSalvagedFile )
707 : {
708 0 : OUString sVal;
709 0 : bool bOK = (rProp.Value >>= sVal);
710 : DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
711 0 : if (bOK)
712 0 : rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
713 : }
714 0 : else if ( aName == sFolderName )
715 : {
716 0 : OUString sVal;
717 0 : bool bOK = (rProp.Value >>= sVal);
718 : DBG_ASSERT( bOK, "invalid type or value for FolderName" );
719 0 : if (bOK)
720 0 : rSet.Put( SfxStringItem( SID_PATH, sVal ) );
721 : }
722 0 : else if ( aName == sFrameName )
723 : {
724 0 : OUString sVal;
725 0 : bool bOK = (rProp.Value >>= sVal);
726 : DBG_ASSERT( bOK, "invalid type for FrameName" );
727 0 : if (bOK && !sVal.isEmpty())
728 0 : rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
729 : }
730 0 : else if ( aName == sMediaType )
731 : {
732 0 : OUString sVal;
733 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
734 : DBG_ASSERT( bOK, "invalid type or value for MediaType" );
735 0 : if (bOK)
736 0 : rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
737 : }
738 0 : else if ( aName == sTemplateName )
739 : {
740 0 : OUString sVal;
741 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
742 : DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
743 0 : if (bOK)
744 0 : rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
745 : }
746 0 : else if ( aName == sTemplateRegionName )
747 : {
748 0 : OUString sVal;
749 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
750 : DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
751 0 : if (bOK)
752 0 : rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
753 : }
754 0 : else if ( aName == sJumpMark )
755 : {
756 0 : OUString sVal;
757 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
758 : DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
759 0 : if (bOK)
760 0 : rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
761 : }
762 0 : else if ( aName == sCharacterSet )
763 : {
764 0 : OUString sVal;
765 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
766 : DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
767 0 : if (bOK)
768 0 : rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
769 : }
770 0 : else if ( aName == sFilterFlags )
771 : {
772 0 : OUString sVal;
773 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
774 : DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
775 0 : if (bOK)
776 0 : rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
777 : }
778 0 : else if ( aName == sMacroExecMode )
779 : {
780 0 : sal_Int16 nVal =-1;
781 0 : bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
782 : DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
783 0 : if (bOK)
784 0 : rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
785 : }
786 0 : else if ( aName == sUpdateDocMode )
787 : {
788 0 : sal_Int16 nVal =-1;
789 0 : bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
790 : DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
791 0 : if (bOK)
792 0 : rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
793 : }
794 0 : else if ( aName == sRepairPackage )
795 : {
796 0 : bool bVal = false;
797 0 : bool bOK = (rProp.Value >>= bVal);
798 : DBG_ASSERT( bOK, "invalid type for RepairPackage" );
799 0 : if (bOK)
800 0 : rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
801 : }
802 0 : else if ( aName == sDocumentTitle )
803 : {
804 0 : OUString sVal;
805 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
806 : DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
807 0 : if (bOK)
808 0 : rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
809 : }
810 0 : else if ( aName == sDocumentBaseURL )
811 : {
812 0 : OUString sVal;
813 : // the base url can be set to empty ( for embedded objects for example )
814 0 : bool bOK = (rProp.Value >>= sVal);
815 : DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
816 0 : if (bOK)
817 0 : rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
818 : }
819 0 : else if ( aName == sHierarchicalDocumentName )
820 : {
821 0 : OUString sVal;
822 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
823 : DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
824 0 : if (bOK)
825 0 : rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
826 : }
827 0 : else if ( aName == sCopyStreamIfPossible )
828 : {
829 0 : bool bVal = false;
830 0 : bool bOK = (rProp.Value >>= bVal);
831 : DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
832 0 : if (bOK)
833 0 : rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
834 : }
835 0 : else if ( aName == sNoAutoSave )
836 : {
837 0 : bool bVal = false;
838 0 : bool bOK = (rProp.Value >>= bVal);
839 : DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
840 0 : if (bOK)
841 0 : rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
842 : }
843 0 : else if ( aName == sModifyPasswordInfo )
844 : {
845 0 : rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
846 : }
847 0 : else if ( aName == sEncryptionData )
848 : {
849 0 : rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
850 : }
851 0 : else if ( aName == sSuggestedSaveAsDir )
852 : {
853 0 : OUString sVal;
854 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
855 : DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
856 0 : if (bOK)
857 0 : rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
858 : }
859 0 : else if ( aName == sSuggestedSaveAsName )
860 : {
861 0 : OUString sVal;
862 0 : bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
863 : DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
864 0 : if (bOK)
865 0 : rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
866 : }
867 0 : else if (aName == sDocumentService)
868 : {
869 0 : OUString aVal;
870 0 : bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
871 0 : if (bOK)
872 0 : rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
873 : }
874 0 : else if (aName == sFilterProvider)
875 : {
876 0 : OUString aVal;
877 0 : bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
878 0 : if (bOK)
879 0 : rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
880 : }
881 : #ifdef DBG_UTIL
882 : else
883 : --nFoundArgs;
884 : #endif
885 : }
886 : }
887 : // API to raise options dialog with a specified options ab page (#i83757#)
888 : else
889 : {
890 : // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
891 0 : OUString sSlotName( "OptionsTreeDialog" );
892 0 : OUString sPropName( "OptionsPageURL" );
893 0 : if ( sSlotName == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) )
894 : {
895 0 : for ( sal_uInt16 n = 0; n < nCount; ++n )
896 : {
897 0 : const PropertyValue& rProp = pPropsVal[n];
898 0 : OUString sName( rProp.Name );
899 0 : if ( sName == sPropName )
900 : {
901 0 : OUString sURL;
902 0 : if ( rProp.Value >>= sURL )
903 0 : rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
904 0 : break;
905 : }
906 0 : }
907 0 : }
908 : }
909 : #ifdef DB_UTIL
910 : if ( nFoundArgs == nCount )
911 : {
912 : // except for the "special" slots: assure that every argument was convertible
913 : OStringBuffer aStr("MacroPlayer: Some properties didn't match to any formal argument for slot: ");
914 : aStr.append(pSlot->pUnoName);
915 : DBG_WARNING( aStr.getStr() );
916 : }
917 : #endif
918 : }
919 :
920 0 : void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
921 : {
922 0 : if ( !pSlot )
923 0 : pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
924 :
925 0 : if ( !pSlot)
926 0 : return;
927 :
928 0 : if ( nSlotId == SID_OPENURL )
929 0 : nSlotId = SID_OPENDOC;
930 0 : if ( nSlotId == SID_SAVEASURL )
931 0 : nSlotId = SID_SAVEASDOC;
932 :
933 : // find number of properties to avoid permanent reallocations in the sequence
934 0 : sal_Int32 nProps=0;
935 :
936 : #ifdef DBG_UTIL
937 : // trace number of items and compare with number of properties for debugging purposes
938 : sal_Int32 nItems=0;
939 : #endif
940 :
941 0 : const SfxType *pType = pSlot->GetType();
942 0 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
943 : {
944 : // slot is a property
945 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
946 0 : if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
947 : {
948 0 : sal_uInt16 nSubCount = pType->nAttribs;
949 0 : if ( nSubCount )
950 : // it's a complex property, we want it split into simple types
951 : // so we expect to get as many items as we have (sub) members
952 0 : nProps = nSubCount;
953 : else
954 : // simple property: we expect to get exactly one item
955 0 : nProps++;
956 : }
957 : #ifdef DBG_UTIL
958 : else
959 : {
960 : // we will not rely on the "toggle" ability of some property slots
961 : OStringBuffer aStr("Processing property slot without argument: ");
962 : aStr.append(static_cast<sal_Int32>(nSlotId));
963 : OSL_FAIL(aStr.getStr());
964 : }
965 : #endif
966 :
967 : #ifdef DBG_UTIL
968 : nItems++;
969 : #endif
970 : }
971 : else
972 : {
973 : // slot is a method
974 0 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
975 0 : sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
976 0 : for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
977 : {
978 : // check every formal argument of the method
979 0 : const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
980 :
981 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
982 0 : if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //???
983 : {
984 0 : sal_uInt16 nSubCount = rArg.pType->nAttribs;
985 0 : if ( nSubCount )
986 : // argument has a complex type, we want it split into simple types
987 : // so for this argument we expect to get as many items as we have (sub) members
988 0 : nProps += nSubCount;
989 : else
990 : // argument of simple type: we expect to get exactly one item for it
991 0 : nProps++;
992 : #ifdef DBG_UTIL
993 : nItems++;
994 : #endif
995 : }
996 : }
997 :
998 : // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
999 0 : if ( bIsMediaDescriptor )
1000 : {
1001 0 : sal_Int32 nAdditional=0;
1002 0 : if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET )
1003 0 : nAdditional++;
1004 0 : if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET )
1005 0 : nAdditional++;
1006 0 : if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET )
1007 0 : nAdditional++;
1008 0 : if ( rSet.GetItemState( SID_PATH ) == SFX_ITEM_SET )
1009 0 : nAdditional++;
1010 0 : if ( rSet.GetItemState( SID_FILE_DIALOG ) == SFX_ITEM_SET )
1011 0 : nAdditional++;
1012 0 : if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET )
1013 0 : nAdditional++;
1014 0 : if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET )
1015 0 : nAdditional++;
1016 0 : if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET )
1017 0 : nAdditional++;
1018 0 : if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET )
1019 0 : nAdditional++;
1020 0 : if ( rSet.GetItemState( SID_STREAM ) == SFX_ITEM_SET )
1021 0 : nAdditional++;
1022 0 : if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET )
1023 0 : nAdditional++;
1024 0 : if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET )
1025 0 : nAdditional++;
1026 0 : if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET )
1027 0 : nAdditional++;
1028 0 : if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SFX_ITEM_SET )
1029 0 : nAdditional++;
1030 0 : if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET )
1031 0 : nAdditional++;
1032 0 : if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET )
1033 0 : nAdditional++;
1034 0 : if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET )
1035 0 : nAdditional++;
1036 0 : if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET )
1037 0 : nAdditional++;
1038 0 : if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET )
1039 0 : nAdditional++;
1040 0 : if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SFX_ITEM_SET )
1041 0 : nAdditional++;
1042 0 : if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET )
1043 0 : nAdditional++;
1044 0 : if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET )
1045 0 : nAdditional++;
1046 0 : if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET )
1047 0 : nAdditional++;
1048 0 : if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET )
1049 0 : nAdditional++;
1050 0 : if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET )
1051 0 : nAdditional++;
1052 0 : if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET )
1053 0 : nAdditional++;
1054 0 : if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET )
1055 0 : nAdditional++;
1056 0 : if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET )
1057 0 : nAdditional++;
1058 0 : if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET )
1059 0 : nAdditional++;
1060 0 : if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET )
1061 0 : nAdditional++;
1062 0 : if ( rSet.GetItemState( SID_MINIMIZED ) == SFX_ITEM_SET )
1063 0 : nAdditional++;
1064 0 : if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET )
1065 0 : nAdditional++;
1066 0 : if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET )
1067 0 : nAdditional++;
1068 0 : if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET )
1069 0 : nAdditional++;
1070 0 : if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET )
1071 0 : nAdditional++;
1072 0 : if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET )
1073 0 : nAdditional++;
1074 0 : if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET )
1075 0 : nAdditional++;
1076 0 : if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET )
1077 0 : nAdditional++;
1078 0 : if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET )
1079 0 : nAdditional++;
1080 0 : if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET )
1081 0 : nAdditional++;
1082 0 : if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET )
1083 0 : nAdditional++;
1084 0 : if ( rSet.GetItemState( SID_COMPONENTDATA ) == SFX_ITEM_SET )
1085 0 : nAdditional++;
1086 0 : if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SFX_ITEM_SET )
1087 0 : nAdditional++;
1088 0 : if ( rSet.GetItemState( SID_DOC_BASEURL ) == SFX_ITEM_SET )
1089 0 : nAdditional++;
1090 0 : if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SFX_ITEM_SET )
1091 0 : nAdditional++;
1092 0 : if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SFX_ITEM_SET )
1093 0 : nAdditional++;
1094 0 : if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET )
1095 0 : nAdditional++;
1096 0 : if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET )
1097 0 : nAdditional++;
1098 0 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET )
1099 0 : nAdditional++;
1100 0 : if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET )
1101 0 : nAdditional++;
1102 0 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET )
1103 0 : nAdditional++;
1104 0 : if ( rSet.GetItemState( SID_DOC_SERVICE ) == SFX_ITEM_SET )
1105 0 : nAdditional++;
1106 0 : if (rSet.HasItem(SID_FILTER_PROVIDER))
1107 0 : ++nAdditional;
1108 :
1109 : // consider additional arguments
1110 0 : nProps += nAdditional;
1111 : #ifdef DBG_UTIL
1112 : nItems += nAdditional;
1113 : #endif
1114 : }
1115 : }
1116 :
1117 : #ifdef DBG_UTIL
1118 : // now check the itemset: is there any item that is not convertible using the list of formal arguments
1119 : // or the table of additional items?!
1120 : if ( rSet.Count() != nItems )
1121 : {
1122 : // detect unknown item and present error message
1123 : const sal_uInt16 *pRanges = rSet.GetRanges();
1124 : while ( *pRanges )
1125 : {
1126 : for(sal_uInt16 nId = *pRanges++; nId <= *pRanges; ++nId)
1127 : {
1128 : if ( rSet.GetItemState(nId) < SFX_ITEM_SET ) //???
1129 : // not really set
1130 : continue;
1131 :
1132 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
1133 : continue;
1134 :
1135 : bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1136 : sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
1137 : sal_uInt16 nArg;
1138 : for ( nArg=0; nArg<nFormalArgs; ++nArg )
1139 : {
1140 : const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
1141 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1142 : if ( nId == nWhich )
1143 : break;
1144 : }
1145 :
1146 : if ( nArg<nFormalArgs )
1147 : continue;
1148 :
1149 : if ( bIsMediaDescriptor )
1150 : {
1151 : if ( nId == SID_DOCFRAME )
1152 : continue;
1153 : if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
1154 : continue;
1155 : if ( nId == SID_INTERACTIONHANDLER )
1156 : continue;
1157 : if ( nId == SID_VIEW_DATA )
1158 : continue;
1159 : if ( nId == SID_FILTER_DATA )
1160 : continue;
1161 : if ( nId == SID_DOCUMENT )
1162 : continue;
1163 : if ( nId == SID_CONTENT )
1164 : continue;
1165 : if ( nId == SID_INPUTSTREAM )
1166 : continue;
1167 : if ( nId == SID_STREAM )
1168 : continue;
1169 : if ( nId == SID_OUTPUTSTREAM )
1170 : continue;
1171 : if ( nId == SID_POSTDATA )
1172 : continue;
1173 : if ( nId == SID_FILLFRAME )
1174 : continue;
1175 : if ( nId == SID_TEMPLATE )
1176 : continue;
1177 : if ( nId == SID_OPEN_NEW_VIEW )
1178 : continue;
1179 : if ( nId == SID_VIEW_ID )
1180 : continue;
1181 : if ( nId == SID_PLUGIN_MODE )
1182 : continue;
1183 : if ( nId == SID_DOC_READONLY )
1184 : continue;
1185 : if ( nId == SID_DOC_STARTPRESENTATION )
1186 : continue;
1187 : if ( nId == SID_SELECTION )
1188 : continue;
1189 : if ( nId == SID_HIDDEN )
1190 : continue;
1191 : if ( nId == SID_MINIMIZED )
1192 : continue;
1193 : if ( nId == SID_SILENT )
1194 : continue;
1195 : if ( nId == SID_PREVIEW )
1196 : continue;
1197 : if ( nId == SID_VIEWONLY )
1198 : continue;
1199 : if ( nId == SID_EDITDOC )
1200 : continue;
1201 : if ( nId == SID_TARGETNAME )
1202 : continue;
1203 : if ( nId == SID_DOC_SALVAGE )
1204 : continue;
1205 : if ( nId == SID_PATH )
1206 : continue;
1207 : if ( nId == SID_FILE_DIALOG )
1208 : continue;
1209 : if ( nId == SID_STANDARD_DIR )
1210 : continue;
1211 : if ( nId == SID_BLACK_LIST )
1212 : continue;
1213 : if ( nId == SID_CONTENTTYPE )
1214 : continue;
1215 : if ( nId == SID_TEMPLATE_NAME )
1216 : continue;
1217 : if ( nId == SID_TEMPLATE_REGIONNAME )
1218 : continue;
1219 : if ( nId == SID_JUMPMARK )
1220 : continue;
1221 : if ( nId == SID_CHARSET )
1222 : continue;
1223 : if ( nId == SID_MACROEXECMODE )
1224 : continue;
1225 : if ( nId == SID_UPDATEDOCMODE )
1226 : continue;
1227 : if ( nId == SID_REPAIRPACKAGE )
1228 : continue;
1229 : if ( nId == SID_DOCINFO_TITLE )
1230 : continue;
1231 : if ( nId == SID_COMPONENTDATA )
1232 : continue;
1233 : if ( nId == SID_COMPONENTCONTEXT )
1234 : continue;
1235 : if ( nId == SID_DOC_BASEURL )
1236 : continue;
1237 : if ( nId == SID_DOC_HIERARCHICALNAME )
1238 : continue;
1239 : if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
1240 : continue;
1241 : if ( nId == SID_NOAUTOSAVE )
1242 : continue;
1243 : if ( nId == SID_ENCRYPTIONDATA )
1244 : continue;
1245 : if ( nId == SID_DOC_SERVICE )
1246 : continue;
1247 : if (nId == SID_FILTER_PROVIDER)
1248 : continue;
1249 :
1250 : // used only internally
1251 : if ( nId == SID_SAVETO )
1252 : continue;
1253 : if ( nId == SID_SAVEACOPYITEM )
1254 : continue;
1255 : if ( nId == SID_MODIFYPASSWORDINFO )
1256 : continue;
1257 : if ( nId == SID_SUGGESTEDSAVEASDIR )
1258 : continue;
1259 : if ( nId == SID_SUGGESTEDSAVEASNAME )
1260 : continue;
1261 : }
1262 :
1263 : OStringBuffer aDbg("Unknown item detected: ");
1264 : aDbg.append(static_cast<sal_Int32>(nId));
1265 : DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
1266 : }
1267 : }
1268 : }
1269 : #endif
1270 :
1271 0 : if ( !nProps )
1272 0 : return;
1273 :
1274 : // convert every item into a property
1275 0 : uno::Sequence<beans::PropertyValue> aSequ(nProps);
1276 0 : beans::PropertyValue *pValue = aSequ.getArray();
1277 :
1278 0 : sal_Int32 nActProp=0;
1279 0 : if ( !pSlot->IsMode(SFX_SLOT_METHOD) )
1280 : {
1281 : // slot is a property
1282 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
1283 0 : bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1284 0 : SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, false );
1285 0 : if ( pItem ) //???
1286 : {
1287 0 : sal_uInt16 nSubCount = pType->nAttribs;
1288 0 : if ( !nSubCount )
1289 : {
1290 0 : pValue[nActProp].Name = OUString::createFromAscii(pSlot->pUnoName) ;
1291 0 : if ( !pItem->QueryValue( pValue[nActProp].Value ) )
1292 : {
1293 0 : OStringBuffer aStr("Item not convertible: ");
1294 0 : aStr.append(static_cast<sal_Int32>(nSlotId));
1295 0 : OSL_FAIL(aStr.getStr());
1296 : }
1297 : }
1298 : else
1299 : {
1300 : // complex type, add a property value for every member of the struct
1301 0 : for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1302 : {
1303 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID;
1304 0 : if ( bConvertTwips )
1305 0 : nSubId |= CONVERT_TWIPS;
1306 :
1307 : DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
1308 0 : OUString aName( OUString::createFromAscii( pSlot->pUnoName ) ) ;
1309 0 : aName += ".";
1310 0 : aName += OUString::createFromAscii( pType->aAttrib[n-1].pName ) ;
1311 0 : pValue[nActProp].Name = aName;
1312 0 : if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1313 : {
1314 0 : OStringBuffer aStr("Sub item ");
1315 : aStr.append(static_cast<sal_Int32>(
1316 0 : pType->aAttrib[n-1].nAID));
1317 0 : aStr.append(" not convertible in slot: ");
1318 0 : aStr.append(static_cast<sal_Int32>(nSlotId));
1319 0 : OSL_FAIL( aStr.getStr() );
1320 : }
1321 0 : }
1322 : }
1323 : }
1324 :
1325 0 : rArgs = aSequ;
1326 0 : return;
1327 : }
1328 :
1329 : // slot is a method
1330 0 : sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1331 0 : for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1332 : {
1333 0 : const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1334 0 : sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1335 0 : bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1336 0 : SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, false );
1337 0 : if ( pItem ) //???
1338 : {
1339 0 : sal_uInt16 nSubCount = rArg.pType->nAttribs;
1340 0 : if ( !nSubCount )
1341 : {
1342 0 : pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) ;
1343 0 : if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
1344 : {
1345 0 : OStringBuffer aStr("Item not convertible: ");
1346 0 : aStr.append(static_cast<sal_Int32>(rArg.nSlotId));
1347 0 : OSL_FAIL(aStr.getStr());
1348 : }
1349 : }
1350 : else
1351 : {
1352 : // complex type, add a property value for every member of the struct
1353 0 : for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1354 : {
1355 0 : sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID;
1356 0 : if ( bConvertTwips )
1357 0 : nSubId |= CONVERT_TWIPS;
1358 :
1359 : DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
1360 0 : OUString aName( OUString::createFromAscii( rArg.pName ) ) ;
1361 0 : aName += ".";
1362 0 : aName += OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
1363 0 : pValue[nActProp].Name = aName;
1364 0 : if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1365 : {
1366 0 : OStringBuffer aStr("Sub item ");
1367 : aStr.append(static_cast<sal_Int32>(
1368 0 : rArg.pType->aAttrib[n-1].nAID));
1369 0 : aStr.append(" not convertible in slot: ");
1370 0 : aStr.append(static_cast<sal_Int32>(rArg.nSlotId));
1371 0 : OSL_FAIL(aStr.getStr());
1372 : }
1373 0 : }
1374 : }
1375 : }
1376 : }
1377 :
1378 0 : if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
1379 0 : nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
1380 : nSlotId == SID_SAVEACOPY )
1381 : {
1382 0 : const SfxPoolItem *pItem=0;
1383 0 : if ( rSet.GetItemState( SID_COMPONENTDATA, false, &pItem ) == SFX_ITEM_SET )
1384 : {
1385 0 : pValue[nActProp].Name = OUString(sComponentData);
1386 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1387 : }
1388 0 : if ( rSet.GetItemState( SID_COMPONENTCONTEXT, false, &pItem ) == SFX_ITEM_SET )
1389 : {
1390 0 : pValue[nActProp].Name = OUString(sComponentContext);
1391 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1392 : }
1393 0 : if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, false, &pItem ) == SFX_ITEM_SET )
1394 : {
1395 0 : pValue[nActProp].Name = OUString(sStatusInd);
1396 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1397 : }
1398 0 : if ( rSet.GetItemState( SID_INTERACTIONHANDLER, false, &pItem ) == SFX_ITEM_SET )
1399 : {
1400 0 : pValue[nActProp].Name = OUString(sInteractionHdl);
1401 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1402 : }
1403 0 : if ( rSet.GetItemState( SID_VIEW_DATA, false, &pItem ) == SFX_ITEM_SET )
1404 : {
1405 0 : pValue[nActProp].Name = OUString(sViewData);
1406 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1407 : }
1408 0 : if ( rSet.GetItemState( SID_FILTER_DATA, false, &pItem ) == SFX_ITEM_SET )
1409 : {
1410 0 : pValue[nActProp].Name = OUString(sFilterData);
1411 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1412 : }
1413 0 : if ( rSet.GetItemState( SID_DOCUMENT, false, &pItem ) == SFX_ITEM_SET )
1414 : {
1415 0 : pValue[nActProp].Name = OUString(sModel);
1416 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1417 : }
1418 0 : if ( rSet.GetItemState( SID_CONTENT, false, &pItem ) == SFX_ITEM_SET )
1419 : {
1420 0 : pValue[nActProp].Name = OUString(sUCBContent);
1421 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1422 : }
1423 0 : if ( rSet.GetItemState( SID_INPUTSTREAM, false, &pItem ) == SFX_ITEM_SET )
1424 : {
1425 0 : pValue[nActProp].Name = OUString(sInputStream);
1426 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1427 : }
1428 0 : if ( rSet.GetItemState( SID_STREAM, false, &pItem ) == SFX_ITEM_SET )
1429 : {
1430 0 : pValue[nActProp].Name = OUString(sStream);
1431 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1432 : }
1433 0 : if ( rSet.GetItemState( SID_OUTPUTSTREAM, false, &pItem ) == SFX_ITEM_SET )
1434 : {
1435 0 : pValue[nActProp].Name = OUString(sOutputStream);
1436 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1437 : }
1438 0 : if ( rSet.GetItemState( SID_POSTDATA, false, &pItem ) == SFX_ITEM_SET )
1439 : {
1440 0 : pValue[nActProp].Name = OUString(sPostData);
1441 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1442 : }
1443 0 : if ( rSet.GetItemState( SID_FILLFRAME, false, &pItem ) == SFX_ITEM_SET )
1444 : {
1445 0 : pValue[nActProp].Name = OUString(sFrame);
1446 0 : if ( pItem->ISA( SfxUsrAnyItem ) )
1447 : {
1448 : OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" );
1449 0 : pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue();
1450 : }
1451 0 : else if ( pItem->ISA( SfxUnoFrameItem ) )
1452 0 : pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame();
1453 : else
1454 : OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1455 : }
1456 0 : if ( rSet.GetItemState( SID_TEMPLATE, false, &pItem ) == SFX_ITEM_SET )
1457 : {
1458 0 : pValue[nActProp].Name = OUString(sAsTemplate);
1459 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1460 : }
1461 0 : if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, false, &pItem ) == SFX_ITEM_SET )
1462 : {
1463 0 : pValue[nActProp].Name = OUString(sOpenNewView);
1464 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1465 : }
1466 0 : if ( rSet.GetItemState( SID_FAIL_ON_WARNING, false, &pItem ) == SFX_ITEM_SET )
1467 : {
1468 0 : pValue[nActProp].Name = OUString(sFailOnWarning);
1469 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1470 : }
1471 0 : if ( rSet.GetItemState( SID_VIEW_ID, false, &pItem ) == SFX_ITEM_SET )
1472 : {
1473 0 : pValue[nActProp].Name = OUString(sViewId);
1474 0 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1475 : }
1476 0 : if ( rSet.GetItemState( SID_PLUGIN_MODE, false, &pItem ) == SFX_ITEM_SET )
1477 : {
1478 0 : pValue[nActProp].Name = OUString(sPluginMode);
1479 0 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1480 : }
1481 0 : if ( rSet.GetItemState( SID_DOC_READONLY, false, &pItem ) == SFX_ITEM_SET )
1482 : {
1483 0 : pValue[nActProp].Name = OUString(sReadOnly);
1484 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1485 : }
1486 0 : if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, false, &pItem ) == SFX_ITEM_SET )
1487 : {
1488 0 : pValue[nActProp].Name = OUString(sDdeReconnect);
1489 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1490 : }
1491 0 : if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, false, &pItem ) == SFX_ITEM_SET )
1492 : {
1493 0 : pValue[nActProp].Name = OUString(sStartPresentation);
1494 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1495 : }
1496 0 : if ( rSet.GetItemState( SID_SELECTION, false, &pItem ) == SFX_ITEM_SET )
1497 : {
1498 0 : pValue[nActProp].Name = OUString(sSelectionOnly);
1499 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1500 : }
1501 0 : if ( rSet.GetItemState( SID_HIDDEN, false, &pItem ) == SFX_ITEM_SET )
1502 : {
1503 0 : pValue[nActProp].Name = OUString(sHidden);
1504 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1505 : }
1506 0 : if ( rSet.GetItemState( SID_MINIMIZED, false, &pItem ) == SFX_ITEM_SET )
1507 : {
1508 0 : pValue[nActProp].Name = OUString(sMinimized);
1509 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1510 : }
1511 0 : if ( rSet.GetItemState( SID_SILENT, false, &pItem ) == SFX_ITEM_SET )
1512 : {
1513 0 : pValue[nActProp].Name = OUString(sSilent);
1514 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1515 : }
1516 0 : if ( rSet.GetItemState( SID_PREVIEW, false, &pItem ) == SFX_ITEM_SET )
1517 : {
1518 0 : pValue[nActProp].Name = OUString(sPreview);
1519 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1520 : }
1521 0 : if ( rSet.GetItemState( SID_VIEWONLY, false, &pItem ) == SFX_ITEM_SET )
1522 : {
1523 0 : pValue[nActProp].Name = OUString(sViewOnly);
1524 0 : pValue[nActProp++].Value <<= ((SfxBoolItem*)pItem)->GetValue() ;
1525 : }
1526 0 : if ( rSet.GetItemState( SID_EDITDOC, false, &pItem ) == SFX_ITEM_SET )
1527 : {
1528 0 : pValue[nActProp].Name = OUString(sDontEdit);
1529 0 : pValue[nActProp++].Value <<= !( ((SfxBoolItem*)pItem)->GetValue() );
1530 : }
1531 0 : if ( rSet.GetItemState( SID_FILE_DIALOG, false, &pItem ) == SFX_ITEM_SET )
1532 : {
1533 0 : pValue[nActProp].Name = OUString(sUseSystemDialog);
1534 0 : pValue[nActProp++].Value <<= ((SfxBoolItem*)pItem)->GetValue();
1535 : }
1536 0 : if ( rSet.GetItemState( SID_STANDARD_DIR, false, &pItem ) == SFX_ITEM_SET )
1537 : {
1538 0 : pValue[nActProp].Name = OUString(sStandardDir);
1539 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1540 : }
1541 0 : if ( rSet.GetItemState( SID_BLACK_LIST, false, &pItem ) == SFX_ITEM_SET )
1542 : {
1543 0 : pValue[nActProp].Name = OUString(sBlackList);
1544 :
1545 0 : com::sun::star::uno::Sequence< OUString > aList;
1546 0 : ((SfxStringListItem*)pItem)->GetStringList( aList );
1547 0 : pValue[nActProp++].Value <<= aList ;
1548 : }
1549 0 : if ( rSet.GetItemState( SID_TARGETNAME, false, &pItem ) == SFX_ITEM_SET )
1550 : {
1551 0 : pValue[nActProp].Name = OUString(sFrameName);
1552 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1553 : }
1554 0 : if ( rSet.GetItemState( SID_DOC_SALVAGE, false, &pItem ) == SFX_ITEM_SET )
1555 : {
1556 0 : pValue[nActProp].Name = OUString(sSalvagedFile);
1557 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1558 : }
1559 0 : if ( rSet.GetItemState( SID_PATH, false, &pItem ) == SFX_ITEM_SET )
1560 : {
1561 0 : pValue[nActProp].Name = OUString(sFolderName);
1562 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1563 : }
1564 0 : if ( rSet.GetItemState( SID_CONTENTTYPE, false, &pItem ) == SFX_ITEM_SET )
1565 : {
1566 0 : pValue[nActProp].Name = OUString(sMediaType);
1567 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1568 : }
1569 0 : if ( rSet.GetItemState( SID_TEMPLATE_NAME, false, &pItem ) == SFX_ITEM_SET )
1570 : {
1571 0 : pValue[nActProp].Name = OUString(sTemplateName);
1572 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1573 : }
1574 0 : if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, false, &pItem ) == SFX_ITEM_SET )
1575 : {
1576 0 : pValue[nActProp].Name = OUString(sTemplateRegionName);
1577 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1578 : }
1579 0 : if ( rSet.GetItemState( SID_JUMPMARK, false, &pItem ) == SFX_ITEM_SET )
1580 : {
1581 0 : pValue[nActProp].Name = OUString(sJumpMark);
1582 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1583 : }
1584 :
1585 0 : if ( rSet.GetItemState( SID_CHARSET, false, &pItem ) == SFX_ITEM_SET )
1586 : {
1587 0 : pValue[nActProp].Name = OUString(sCharacterSet);
1588 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1589 : }
1590 0 : if ( rSet.GetItemState( SID_MACROEXECMODE, false, &pItem ) == SFX_ITEM_SET )
1591 : {
1592 0 : pValue[nActProp].Name = OUString(sMacroExecMode);
1593 0 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1594 : }
1595 0 : if ( rSet.GetItemState( SID_UPDATEDOCMODE, false, &pItem ) == SFX_ITEM_SET )
1596 : {
1597 0 : pValue[nActProp].Name = OUString(sUpdateDocMode);
1598 0 : pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() );
1599 : }
1600 0 : if ( rSet.GetItemState( SID_REPAIRPACKAGE, false, &pItem ) == SFX_ITEM_SET )
1601 : {
1602 0 : pValue[nActProp].Name = OUString(sRepairPackage);
1603 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1604 : }
1605 0 : if ( rSet.GetItemState( SID_DOCINFO_TITLE, false, &pItem ) == SFX_ITEM_SET )
1606 : {
1607 0 : pValue[nActProp].Name = OUString(sDocumentTitle);
1608 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1609 : }
1610 0 : if ( rSet.GetItemState( SID_DOC_BASEURL, false, &pItem ) == SFX_ITEM_SET )
1611 : {
1612 0 : pValue[nActProp].Name = OUString(sDocumentBaseURL);
1613 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1614 : }
1615 0 : if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, false, &pItem ) == SFX_ITEM_SET )
1616 : {
1617 0 : pValue[nActProp].Name = OUString(sHierarchicalDocumentName);
1618 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1619 : }
1620 0 : if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, false, &pItem ) == SFX_ITEM_SET )
1621 : {
1622 0 : pValue[nActProp].Name = OUString(sCopyStreamIfPossible);
1623 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1624 : }
1625 0 : if ( rSet.GetItemState( SID_NOAUTOSAVE, false, &pItem ) == SFX_ITEM_SET )
1626 : {
1627 0 : pValue[nActProp].Name = OUString(sNoAutoSave);
1628 0 : pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() );
1629 : }
1630 0 : if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, false, &pItem ) == SFX_ITEM_SET )
1631 : {
1632 0 : pValue[nActProp].Name = OUString(sModifyPasswordInfo);
1633 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1634 : }
1635 0 : if ( rSet.GetItemState( SID_ENCRYPTIONDATA, false, &pItem ) == SFX_ITEM_SET )
1636 : {
1637 0 : pValue[nActProp].Name = OUString(sEncryptionData);
1638 0 : pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() );
1639 : }
1640 0 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, false, &pItem ) == SFX_ITEM_SET )
1641 : {
1642 0 : pValue[nActProp].Name = OUString(sSuggestedSaveAsDir);
1643 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1644 : }
1645 0 : if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, false, &pItem ) == SFX_ITEM_SET )
1646 : {
1647 0 : pValue[nActProp].Name = OUString(sSuggestedSaveAsName);
1648 0 : pValue[nActProp++].Value <<= ( OUString(((SfxStringItem*)pItem)->GetValue()) );
1649 : }
1650 0 : if ( rSet.GetItemState( SID_DOC_SERVICE, false, &pItem ) == SFX_ITEM_SET )
1651 : {
1652 0 : pValue[nActProp].Name = OUString(sDocumentService);
1653 0 : pValue[nActProp++].Value <<= OUString(static_cast<const SfxStringItem*>(pItem)->GetValue());
1654 : }
1655 0 : if (rSet.HasItem(SID_FILTER_PROVIDER, &pItem))
1656 : {
1657 0 : pValue[nActProp].Name = sFilterProvider;
1658 0 : pValue[nActProp++].Value <<= OUString(static_cast<const SfxStringItem*>(pItem)->GetValue());
1659 : }
1660 : }
1661 :
1662 0 : rArgs = aSequ;
1663 : }
1664 :
1665 0 : void SAL_CALL FilterOptionsContinuation::setFilterOptions(
1666 : const uno::Sequence<beans::PropertyValue>& rProps )
1667 : throw (uno::RuntimeException, std::exception)
1668 : {
1669 0 : rProperties = rProps;
1670 0 : }
1671 :
1672 : uno::Sequence< beans::PropertyValue > SAL_CALL
1673 0 : FilterOptionsContinuation::getFilterOptions()
1674 : throw (uno::RuntimeException, std::exception)
1675 : {
1676 0 : return rProperties;
1677 : }
1678 :
1679 :
1680 :
1681 0 : RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > rModel,
1682 0 : uno::Sequence< beans::PropertyValue > rProperties )
1683 : {
1684 0 : OUString temp;
1685 0 : uno::Reference< uno::XInterface > temp2;
1686 : document::FilterOptionsRequest aOptionsRequest( temp,
1687 : temp2,
1688 : rModel,
1689 0 : rProperties );
1690 :
1691 0 : m_aRequest <<= aOptionsRequest;
1692 :
1693 0 : m_pAbort = new comphelper::OInteractionAbort;
1694 0 : m_pOptions = new FilterOptionsContinuation;
1695 :
1696 0 : m_lContinuations.realloc( 2 );
1697 0 : m_lContinuations[0] = uno::Reference< task::XInteractionContinuation >( m_pAbort );
1698 0 : m_lContinuations[1] = uno::Reference< task::XInteractionContinuation >( m_pOptions );
1699 0 : }
1700 :
1701 0 : uno::Any SAL_CALL RequestFilterOptions::getRequest()
1702 : throw( uno::RuntimeException, std::exception )
1703 : {
1704 0 : return m_aRequest;
1705 : }
1706 :
1707 : uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1708 0 : SAL_CALL RequestFilterOptions::getContinuations()
1709 : throw( uno::RuntimeException, std::exception )
1710 : {
1711 0 : return m_lContinuations;
1712 : }
1713 :
1714 :
1715 0 : class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< task::XInteractionRequest >
1716 : {
1717 : uno::Any m_aRequest;
1718 : uno::Sequence< uno::Reference< task::XInteractionContinuation > > m_lContinuations;
1719 : comphelper::OInteractionApprove* m_pApprove;
1720 : comphelper::OInteractionDisapprove* m_pDisapprove;
1721 :
1722 : public:
1723 : RequestPackageReparation_Impl( const OUString& aName );
1724 : bool isApproved();
1725 : virtual uno::Any SAL_CALL getRequest() throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1726 : virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations()
1727 : throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1728 : };
1729 :
1730 0 : RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aName )
1731 : {
1732 0 : OUString temp;
1733 0 : uno::Reference< uno::XInterface > temp2;
1734 : document::BrokenPackageRequest aBrokenPackageRequest( temp,
1735 : temp2,
1736 0 : aName );
1737 0 : m_aRequest <<= aBrokenPackageRequest;
1738 0 : m_pApprove = new comphelper::OInteractionApprove;
1739 0 : m_pDisapprove = new comphelper::OInteractionDisapprove;
1740 0 : m_lContinuations.realloc( 2 );
1741 0 : m_lContinuations[0] = uno::Reference< task::XInteractionContinuation >( m_pApprove );
1742 0 : m_lContinuations[1] = uno::Reference< task::XInteractionContinuation >( m_pDisapprove );
1743 0 : }
1744 :
1745 0 : bool RequestPackageReparation_Impl::isApproved()
1746 : {
1747 0 : return m_pApprove->wasSelected();
1748 : }
1749 :
1750 0 : uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
1751 : throw( uno::RuntimeException, std::exception )
1752 : {
1753 0 : return m_aRequest;
1754 : }
1755 :
1756 : uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1757 0 : SAL_CALL RequestPackageReparation_Impl::getContinuations()
1758 : throw( uno::RuntimeException, std::exception )
1759 : {
1760 0 : return m_lContinuations;
1761 : }
1762 :
1763 0 : RequestPackageReparation::RequestPackageReparation( const OUString& aName )
1764 : {
1765 0 : pImp = new RequestPackageReparation_Impl( aName );
1766 0 : pImp->acquire();
1767 0 : }
1768 :
1769 0 : RequestPackageReparation::~RequestPackageReparation()
1770 : {
1771 0 : pImp->release();
1772 0 : }
1773 :
1774 0 : bool RequestPackageReparation::isApproved()
1775 : {
1776 0 : return pImp->isApproved();
1777 : }
1778 :
1779 0 : com::sun::star::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest()
1780 : {
1781 0 : return com::sun::star::uno::Reference < task::XInteractionRequest >(pImp);
1782 : }
1783 :
1784 :
1785 0 : class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< task::XInteractionRequest >
1786 : {
1787 : uno::Any m_aRequest;
1788 : uno::Sequence< uno::Reference< task::XInteractionContinuation > > m_lContinuations;
1789 : comphelper::OInteractionAbort* m_pAbort;
1790 :
1791 : public:
1792 : NotifyBrokenPackage_Impl( const OUString& aName );
1793 : virtual uno::Any SAL_CALL getRequest() throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1794 : virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations()
1795 : throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1796 : };
1797 :
1798 0 : NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
1799 : {
1800 0 : OUString temp;
1801 0 : uno::Reference< uno::XInterface > temp2;
1802 : document::BrokenPackageRequest aBrokenPackageRequest( temp,
1803 : temp2,
1804 0 : aName );
1805 0 : m_aRequest <<= aBrokenPackageRequest;
1806 0 : m_pAbort = new comphelper::OInteractionAbort;
1807 0 : m_lContinuations.realloc( 1 );
1808 0 : m_lContinuations[0] = uno::Reference< task::XInteractionContinuation >( m_pAbort );
1809 0 : }
1810 :
1811 0 : uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
1812 : throw( uno::RuntimeException, std::exception )
1813 : {
1814 0 : return m_aRequest;
1815 : }
1816 :
1817 : uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1818 0 : SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
1819 : throw( uno::RuntimeException, std::exception )
1820 : {
1821 0 : return m_lContinuations;
1822 : }
1823 :
1824 0 : NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
1825 : {
1826 0 : pImp = new NotifyBrokenPackage_Impl( aName );
1827 0 : pImp->acquire();
1828 0 : }
1829 :
1830 0 : NotifyBrokenPackage::~NotifyBrokenPackage()
1831 : {
1832 0 : pImp->release();
1833 0 : }
1834 :
1835 0 : com::sun::star::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
1836 : {
1837 0 : return com::sun::star::uno::Reference < task::XInteractionRequest >(pImp);
1838 : }
1839 :
1840 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|