Branch libreoffice-5-0-4
[LibreOffice.git] / sfx2 / source / appl / appuno.cxx
blob29e0892dce4c7cfa2f9a05d268e5aa98e7c498f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "fltoptint.hxx"
21 #include "objshimp.hxx"
22 #include <sfx2/app.hxx>
23 #include <sfx2/brokenpackageint.hxx>
24 #include <sfx2/dispatch.hxx>
25 #include <sfx2/docfile.hxx>
26 #include <sfx2/fcontnr.hxx>
27 #include <sfx2/frame.hxx>
28 #include <sfx2/module.hxx>
29 #include <sfx2/msg.hxx>
30 #include <sfx2/msgpool.hxx>
31 #include <sfx2/objsh.hxx>
32 #include <sfx2/request.hxx>
33 #include <sfx2/sfxbasecontroller.hxx>
34 #include <sfx2/sfxsids.hrc>
35 #include <sfx2/sfxuno.hxx>
36 #include <sfx2/unoctitm.hxx>
37 #include "sfxslots.hxx"
38 #include "sfxtypes.hxx"
40 #include <sal/config.h>
41 #include <basic/basmgr.hxx>
42 #include <basic/sberrors.hxx>
43 #include <basic/sbmeth.hxx>
44 #include <basic/sbuno.hxx>
45 #include <basic/sbx.hxx>
46 #include <basic/sbxcore.hxx>
47 #include <basic/sbxmeth.hxx>
48 #include <basic/sbxobj.hxx>
49 #include <comphelper/interaction.hxx>
50 #include <framework/documentundoguard.hxx>
51 #include <svl/eitem.hxx>
52 #include <svl/intitem.hxx>
53 #include <svl/itempool.hxx>
54 #include <svl/lckbitem.hxx>
55 #include <svl/ownlist.hxx>
56 #include <svl/rectitem.hxx>
57 #include <svl/slstitm.hxx>
58 #include <svl/stritem.hxx>
59 #include <tools/config.hxx>
60 #include <tools/debug.hxx>
61 #include <tools/urlobj.hxx>
63 #include <com/sun/star/document/FilterOptionsRequest.hpp>
64 #include <com/sun/star/frame/XFrame.hpp>
65 #include <com/sun/star/frame/XModel.hpp>
66 #include <com/sun/star/io/XInputStream.hpp>
67 #include <com/sun/star/task/XInteractionHandler.hpp>
68 #include <com/sun/star/ucb/XContent.hpp>
70 #include <boost/scoped_ptr.hpp>
72 using namespace ::com::sun::star;
73 using namespace ::com::sun::star::ucb;
74 using namespace ::com::sun::star::uno;
75 using namespace ::com::sun::star::registry;
76 using namespace ::com::sun::star::frame;
77 using namespace ::com::sun::star::beans;
78 using namespace ::com::sun::star::io;
80 // needs to be converted to a better data structure
81 SfxFormalArgument aFormalArgs[] = {
82 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "SuggestedSaveAsName", SID_DEFAULTFILENAME },
83 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "SuggestedSaveAsDir", SID_DEFAULTFILEPATH },
84 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "VersionAuthor", SID_DOCINFO_AUTHOR },
85 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "VersionComment", SID_DOCINFO_COMMENTS },
86 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "VersionMajor", SID_DOCINFO_MAJOR },
87 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterOptions", SID_FILE_FILTEROPTIONS },
88 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterName", SID_FILTER_NAME },
89 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
90 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "URL", SID_FILE_NAME },
91 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "OpenFlags", SID_OPTIONS },
92 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "Overwrite", SID_OVERWRITE },
93 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Password", SID_PASSWORD },
94 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "PasswordInteraction", SID_PASSWORDINTERACTION },
95 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Referer", SID_REFERER },
96 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveTo", SID_SAVETO },
97 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "TemplateName", SID_TEMPLATE_NAME },
98 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "TemplateRegion", SID_TEMPLATE_REGIONNAME },
99 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Region", SID_TEMPLATE_REGIONNAME },
100 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Name", SID_TEMPLATE_NAME },
101 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "Unpacked", SID_UNPACK },
102 { reinterpret_cast<SfxType*>(&aSfxInt16Item_Impl), "Version", SID_VERSION },
103 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveACopy", SID_SAVEACOPYITEM },
106 static sal_uInt16 nMediaArgsCount = sizeof(aFormalArgs) / sizeof (SfxFormalArgument);
108 static char const sTemplateRegionName[] = "TemplateRegionName";
109 static char const sTemplateName[] = "TemplateName";
110 static char const sAsTemplate[] = "AsTemplate";
111 static char const sOpenNewView[] = "OpenNewView";
112 static char const sViewId[] = "ViewId";
113 static char const sPluginMode[] = "PluginMode";
114 static char const sReadOnly[] = "ReadOnly";
115 static char const sDdeReconnect[] = "DDEReconnect";
116 static char const sStartPresentation[] = "StartPresentation";
117 static char const sFrameName[] = "FrameName";
118 static char const sMediaType[] = "MediaType";
119 static char const sPostData[] = "PostData";
120 static char const sCharacterSet[] = "CharacterSet";
121 static char const sInputStream[] = "InputStream";
122 static char const sStream[] = "Stream";
123 static char const sOutputStream[] = "OutputStream";
124 static char const sHidden[] = "Hidden";
125 static char const sPreview[] = "Preview";
126 static char const sViewOnly[] = "ViewOnly";
127 static char const sDontEdit[] = "DontEdit";
128 static char const sSilent[] = "Silent";
129 static char const sJumpMark[] = "JumpMark";
130 static char const sFileName[] = "FileName";
131 static char const sSalvagedFile[] = "SalvagedFile";
132 static char const sStatusInd[] = "StatusIndicator";
133 static char const sModel[] = "Model";
134 static char const sFrame[] = "Frame";
135 static char const sViewData[] = "ViewData";
136 static char const sFilterData[] = "FilterData";
137 static char const sSelectionOnly[] = "SelectionOnly";
138 static char const sFilterFlags[] = "FilterFlags";
139 static char const sMacroExecMode[] = "MacroExecutionMode";
140 static char const sUpdateDocMode[] = "UpdateDocMode";
141 static char const sMinimized[] = "Minimized";
142 static char const sInteractionHdl[] = "InteractionHandler";
143 static char const sUCBContent[] = "UCBContent";
144 static char const sRepairPackage[] = "RepairPackage";
145 static char const sDocumentTitle[] = "DocumentTitle";
146 static char const sComponentData[] = "ComponentData";
147 static char const sComponentContext[] = "ComponentContext";
148 static char const sDocumentBaseURL[] = "DocumentBaseURL";
149 static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName";
150 static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible";
151 static char const sNoAutoSave[] = "NoAutoSave";
152 static char const sFolderName[] = "FolderName";
153 static char const sUseSystemDialog[] = "UseSystemDialog";
154 static char const sStandardDir[] = "StandardDir";
155 static char const sBlackList[] = "BlackList";
156 static char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
157 static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
158 static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
159 static char const sEncryptionData[] = "EncryptionData";
160 static char const sFailOnWarning[] = "FailOnWarning";
161 static char const sDocumentService[] = "DocumentService";
162 static char const sFilterProvider[] = "FilterProvider";
164 static bool isMediaDescriptor( sal_uInt16 nSlotId )
166 return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC ||
167 nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
168 nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF ||
169 nSlotId == SID_DIRECTEXPORTDOCASPDF || nSlotId == SID_SAVEACOPY ||
170 nSlotId == SID_SAVEACOPYITEM);
173 void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
175 if ( !pSlot )
176 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
178 if ( !pSlot )
179 return;
181 if ( nSlotId == SID_OPENURL )
182 nSlotId = SID_OPENDOC;
183 if ( nSlotId == SID_SAVEASURL )
184 nSlotId = SID_SAVEASDOC;
186 sal_Int32 nCount = rArgs.getLength();
187 if ( !nCount )
188 return;
190 const beans::PropertyValue* pPropsVal = rArgs.getConstArray();
191 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
193 // slot is a property
194 const SfxType* pType = pSlot->GetType();
195 boost::scoped_ptr<SfxPoolItem> pItem(pType->CreateItem());
197 if ( !pItem )
199 #ifdef DBG_UTIL
200 OStringBuffer aStr("No creator method for item: ");
201 aStr.append(static_cast<sal_Int32>(nSlotId));
202 OSL_FAIL(aStr.getStr());
203 #endif
204 return;
207 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
208 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
209 pItem->SetWhich( nWhich );
210 sal_uInt16 nSubCount = pType->nAttribs;
212 const beans::PropertyValue& rProp = pPropsVal[0];
213 OUString aName = rProp.Name;
214 if ( nCount == 1 && aName == OUString( pSlot->pUnoName, strlen( pSlot->pUnoName ), RTL_TEXTENCODING_UTF8 ) )
216 // there is only one parameter and its name matches the name of the property,
217 // so it's either a simple property or a complex property in one single UNO struct
218 if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
219 // only use successfully converted items
220 rSet.Put( *pItem );
221 #ifdef DBG_UTIL
222 else
224 OStringBuffer aStr("Property not convertible: ");
225 aStr.append(pSlot->pUnoName);
226 OSL_FAIL( aStr.getStr() );
228 #endif
230 #ifdef DBG_UTIL
231 else if ( nSubCount == 0 )
233 // for a simple property there can be only one parameter and its name *must* match
234 SAL_WARN("sfx.appl", "Property name does not match: " << aName);
236 #endif
237 else
239 // there is more than one parameter and the property is a complex one
240 #ifdef DBG_UTIL
241 // if the dispatch API is used for UI purposes or from the testtool,
242 // it is possible to skip some or all arguments,
243 // but it indicates an error for macro recording;
244 // so this should be notified as a warning only
245 if ( nCount != nSubCount )
247 OStringBuffer aStr("MacroPlayer: wrong number of parameters for slot: ");
248 aStr.append(static_cast<sal_Int32>(nSlotId));
249 DBG_WARNING(aStr.getStr());
251 #endif
252 // complex property; collect sub items from the parameter set and reconstruct complex item
253 sal_uInt16 nFound=0;
254 for ( sal_uInt16 n=0; n<nCount; n++ )
256 const beans::PropertyValue& rPropValue = pPropsVal[n];
257 sal_uInt16 nSub;
258 for ( nSub=0; nSub<nSubCount; nSub++ )
260 // search sub item by name
261 OStringBuffer aStr;
262 aStr.append(pSlot->pUnoName).append('.').append(pType->aAttrib[nSub].pName);
263 if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
265 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
266 if ( bConvertTwips )
267 nSubId |= CONVERT_TWIPS;
268 if ( pItem->PutValue( rPropValue.Value, nSubId ) )
269 nFound++;
270 #ifdef DBG_UTIL
271 else
273 OStringBuffer aDbgStr("Property not convertible: ");
274 aDbgStr.append(pSlot->pUnoName);
275 OSL_FAIL( aDbgStr.getStr() );
277 #endif
278 break;
282 #ifdef DBG_UTIL
283 if ( nSub >= nSubCount )
285 // there was a parameter with a name that didn't match to any of the members
286 OStringBuffer aStr("Property name does not match: ");
287 aStr.append(OUStringToOString(rPropValue.Name, RTL_TEXTENCODING_UTF8));
288 OSL_FAIL( aStr.getStr() );
290 #endif
293 // at least one part of the complex item must be present; other parts can have default values
294 if ( nFound > 0 )
295 rSet.Put( *pItem );
298 return;
301 OSL_ASSERT(nCount > 0);
303 #ifdef DBG_UTIL
304 // detect parameters that don't match to any formal argument or one of its members
305 sal_Int32 nFoundArgs = 0;
306 #endif
307 // slot is a method
308 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
309 sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
310 for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
312 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
313 boost::scoped_ptr<SfxPoolItem> pItem(rArg.CreateItem());
314 if ( !pItem )
316 #ifdef DBG_UTIL
317 OStringBuffer aStr("No creator method for argument: ");
318 aStr.append(rArg.pName);
319 OSL_FAIL( aStr.getStr() );
320 #endif
321 return;
324 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
325 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
326 pItem->SetWhich( nWhich );
327 const SfxType* pType = rArg.pType;
328 sal_uInt16 nSubCount = pType->nAttribs;
329 if ( nSubCount == 0 )
331 // "simple" (base type) argument
332 for ( sal_uInt16 n=0; n<nCount; n++ )
334 const beans::PropertyValue& rProp = pPropsVal[n];
335 OUString aName = rProp.Name;
336 if ( aName == OUString( rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8 ) )
338 #ifdef DBG_UTIL
339 ++nFoundArgs;
340 #endif
341 if( pItem->PutValue( rProp.Value ) )
342 // only use successfully converted items
343 rSet.Put( *pItem );
344 #ifdef DBG_UTIL
345 else
347 OStringBuffer aStr("Property not convertible: ");
348 aStr.append(rArg.pName);
349 OSL_FAIL( aStr.getStr() );
351 #endif
352 break;
356 else
358 // complex argument, could be passed in one struct
359 bool bAsWholeItem = false;
360 for ( sal_uInt16 n=0; n<nCount; n++ )
362 const beans::PropertyValue& rProp = pPropsVal[n];
363 OUString aName = rProp.Name;
364 if ( aName == OUString(rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8) )
366 bAsWholeItem = true;
367 #ifdef DBG_UTIL
368 ++nFoundArgs;
369 #endif
370 if( pItem->PutValue( rProp.Value ) )
371 // only use successfully converted items
372 rSet.Put( *pItem );
373 #ifdef DBG_UTIL
374 else
376 OStringBuffer aStr("Property not convertible: ");
377 aStr.append(rArg.pName);
378 OSL_FAIL( aStr.getStr() );
380 #endif
384 if ( !bAsWholeItem )
386 // complex argument; collect sub items from argument array and reconstruct complex item
387 // only put item if at least one member was found and had the correct type
388 // (is this a good idea?! Should we ask for *all* members?)
389 bool bRet = false;
390 for ( sal_uInt16 n=0; n<nCount; n++ )
392 const beans::PropertyValue& rProp = pPropsVal[n];
393 for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
395 // search sub item by name
396 OStringBuffer aStr;
397 aStr.append(rArg.pName).append('.').append(pType->aAttrib[nSub].pName);
398 if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
400 // at least one member found ...
401 bRet = true;
402 #ifdef DBG_UTIL
403 ++nFoundArgs;
404 #endif
405 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID;
406 if ( bConvertTwips )
407 nSubId |= CONVERT_TWIPS;
408 if (!pItem->PutValue( rProp.Value, nSubId ) )
410 // ... but it was not convertible
411 bRet = false;
412 #ifdef DBG_UTIL
413 OStringBuffer aDbgStr("Property not convertible: ");
414 aDbgStr.append(rArg.pName);
415 OSL_FAIL( aDbgStr.getStr() );
416 #endif
419 break;
424 if ( bRet )
425 // only use successfully converted items
426 rSet.Put( *pItem );
432 // special additional parameters for some slots not seen in the slot definitions
433 // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
434 // but as dispatching or factory or arbitrary URLs to the frame
435 // Some also can use additional arguments that are not recordable (will be changed later,
436 // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
437 if ( nSlotId == SID_NEWWINDOW )
439 for ( sal_uInt16 n=0; n<nCount; n++ )
441 const beans::PropertyValue& rProp = pPropsVal[n];
442 OUString aName = rProp.Name;
443 if ( aName == sFrame )
445 Reference< XFrame > xFrame;
446 OSL_VERIFY( rProp.Value >>= xFrame );
447 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
449 else
450 if ( aName == sHidden )
452 bool bVal = false;
453 if (rProp.Value >>= bVal)
454 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
458 else if ( bIsMediaDescriptor )
460 for ( sal_uInt16 n=0; n<nCount; n++ )
462 #ifdef DBG_UTIL
463 ++nFoundArgs;
464 #endif
465 const beans::PropertyValue& rProp = pPropsVal[n];
466 const OUString& aName = rProp.Name;
467 if ( aName == sModel )
468 rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
469 else if ( aName == sComponentData )
471 rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
473 else if ( aName == sComponentContext )
475 rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
477 else if ( aName == sStatusInd )
479 Reference<task::XStatusIndicator> xVal;
480 bool bOK = (rProp.Value >>= xVal);
481 DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
482 if (bOK && xVal.is())
483 rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
485 else if ( aName == sInteractionHdl )
487 Reference<task::XInteractionHandler> xVal;
488 bool bOK = (rProp.Value >>= xVal);
489 DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
490 if (bOK && xVal.is())
491 rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
493 else if ( aName == sViewData )
494 rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
495 else if ( aName == sFilterData )
496 rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
497 else if ( aName == sInputStream )
499 Reference< XInputStream > xVal;
500 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
501 DBG_ASSERT( bOK, "invalid type for InputStream" );
502 if (bOK)
503 rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
505 else if ( aName == sStream )
507 Reference< XInputStream > xVal;
508 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
509 DBG_ASSERT( bOK, "invalid type for Stream" );
510 if (bOK)
511 rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
513 else if ( aName == sUCBContent )
515 Reference< XContent > xVal;
516 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
517 DBG_ASSERT( bOK, "invalid type for UCBContent" );
518 if (bOK)
519 rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
521 else if ( aName == sOutputStream )
523 Reference< XOutputStream > xVal;
524 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
525 DBG_ASSERT( bOK, "invalid type for OutputStream" );
526 if (bOK)
527 rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
529 else if ( aName == sPostData )
531 Reference< XInputStream > xVal;
532 bool bOK = (rProp.Value >>= xVal);
533 DBG_ASSERT( bOK, "invalid type for PostData" );
534 if (bOK)
535 rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
537 else if ( aName == sFrame )
539 Reference< XFrame > xFrame;
540 bool bOK = (rProp.Value >>= xFrame);
541 DBG_ASSERT( bOK, "invalid type for Frame" );
542 if (bOK)
543 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
545 else if ( aName == sAsTemplate )
547 bool bVal = false;
548 bool bOK = (rProp.Value >>= bVal);
549 DBG_ASSERT( bOK, "invalid type for AsTemplate" );
550 if (bOK)
551 rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
553 else if ( aName == sOpenNewView )
555 bool bVal = false;
556 bool bOK = (rProp.Value >>= bVal);
557 DBG_ASSERT( bOK, "invalid type for OpenNewView" );
558 if (bOK)
559 rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
561 else if ( aName == sFailOnWarning )
563 bool bVal = false;
564 bool bOK = (rProp.Value >>= bVal);
565 DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
566 if (bOK)
567 rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
569 else if ( aName == sViewId )
571 sal_Int16 nVal = -1;
572 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
573 DBG_ASSERT( bOK, "invalid type for ViewId" );
574 if (bOK)
575 rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
577 else if ( aName == sPluginMode )
579 sal_Int16 nVal = -1;
580 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
581 DBG_ASSERT( bOK, "invalid type for PluginMode" );
582 if (bOK)
583 rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
585 else if ( aName == sReadOnly )
587 bool bVal = false;
588 bool bOK = (rProp.Value >>= bVal);
589 DBG_ASSERT( bOK, "invalid type for ReadOnly" );
590 if (bOK)
591 rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
593 else if ( aName == sDdeReconnect )
595 bool bVal = true;
596 bool bOK = (rProp.Value >>= bVal);
597 DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
598 if (bOK)
599 rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
601 else if ( aName == sStartPresentation )
603 bool bVal = false;
604 bool bOK = (rProp.Value >>= bVal);
605 DBG_ASSERT( bOK, "invalid type for StartPresentation" );
606 if (bOK)
607 rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
609 else if ( aName == sSelectionOnly )
611 bool bVal = false;
612 bool bOK = (rProp.Value >>= bVal);
613 DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
614 if (bOK)
615 rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
617 else if ( aName == sHidden )
619 bool bVal = false;
620 bool bOK = (rProp.Value >>= bVal);
621 DBG_ASSERT( bOK, "invalid type for Hidden" );
622 if (bOK)
623 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
625 else if ( aName == sMinimized )
627 bool bVal = false;
628 bool bOK = (rProp.Value >>= bVal);
629 DBG_ASSERT( bOK, "invalid type for Minimized" );
630 if (bOK)
631 rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
633 else if ( aName == sSilent )
635 bool bVal = false;
636 bool bOK = (rProp.Value >>= bVal);
637 DBG_ASSERT( bOK, "invalid type for Silent" );
638 if (bOK)
639 rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
641 else if ( aName == sPreview )
643 bool bVal = false;
644 bool bOK = (rProp.Value >>= bVal);
645 DBG_ASSERT( bOK, "invalid type for Preview" );
646 if (bOK)
647 rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
649 else if ( aName == sViewOnly )
651 bool bVal = false;
652 bool bOK = (rProp.Value >>= bVal);
653 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
654 if (bOK)
655 rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
657 else if ( aName == sDontEdit )
659 bool bVal = false;
660 bool bOK = (rProp.Value >>= bVal);
661 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
662 if (bOK)
663 rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
665 else if ( aName == sUseSystemDialog )
667 bool bVal = false;
668 bool bOK = (rProp.Value >>= bVal);
669 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
670 if (bOK)
671 rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
673 else if ( aName == sStandardDir )
675 OUString sVal;
676 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
677 DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
678 if (bOK)
679 rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
681 else if ( aName == sBlackList )
683 uno::Sequence<OUString> xVal;
684 bool bOK = (rProp.Value >>= xVal);
685 DBG_ASSERT( bOK, "invalid type or value for BlackList" );
686 if (bOK)
688 SfxStringListItem stringList(SID_BLACK_LIST);
689 stringList.SetStringList( xVal );
690 rSet.Put( stringList );
693 else if ( aName == sFileName )
695 OUString sVal;
696 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
697 DBG_ASSERT( bOK, "invalid type or value for FileName" );
698 if (bOK)
699 rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
701 else if ( aName == sSalvagedFile )
703 OUString sVal;
704 bool bOK = (rProp.Value >>= sVal);
705 DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
706 if (bOK)
707 rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
709 else if ( aName == sFolderName )
711 OUString sVal;
712 bool bOK = (rProp.Value >>= sVal);
713 DBG_ASSERT( bOK, "invalid type or value for FolderName" );
714 if (bOK)
715 rSet.Put( SfxStringItem( SID_PATH, sVal ) );
717 else if ( aName == sFrameName )
719 OUString sVal;
720 bool bOK = (rProp.Value >>= sVal);
721 DBG_ASSERT( bOK, "invalid type for FrameName" );
722 if (bOK && !sVal.isEmpty())
723 rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
725 else if ( aName == sMediaType )
727 OUString sVal;
728 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
729 DBG_ASSERT( bOK, "invalid type or value for MediaType" );
730 if (bOK)
731 rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
733 else if ( aName == sTemplateName )
735 OUString sVal;
736 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
737 DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
738 if (bOK)
739 rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
741 else if ( aName == sTemplateRegionName )
743 OUString sVal;
744 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
745 DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
746 if (bOK)
747 rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
749 else if ( aName == sJumpMark )
751 OUString sVal;
752 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
753 DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
754 if (bOK)
755 rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
757 else if ( aName == sCharacterSet )
759 OUString sVal;
760 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
761 DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
762 if (bOK)
763 rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
765 else if ( aName == sFilterFlags )
767 OUString sVal;
768 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
769 DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
770 if (bOK)
771 rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
773 else if ( aName == sMacroExecMode )
775 sal_Int16 nVal =-1;
776 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
777 DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
778 if (bOK)
779 rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
781 else if ( aName == sUpdateDocMode )
783 sal_Int16 nVal =-1;
784 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
785 DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
786 if (bOK)
787 rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
789 else if ( aName == sRepairPackage )
791 bool bVal = false;
792 bool bOK = (rProp.Value >>= bVal);
793 DBG_ASSERT( bOK, "invalid type for RepairPackage" );
794 if (bOK)
795 rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
797 else if ( aName == sDocumentTitle )
799 OUString sVal;
800 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
801 DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
802 if (bOK)
803 rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
805 else if ( aName == sDocumentBaseURL )
807 OUString sVal;
808 // the base url can be set to empty ( for embedded objects for example )
809 bool bOK = (rProp.Value >>= sVal);
810 DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
811 if (bOK)
812 rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
814 else if ( aName == sHierarchicalDocumentName )
816 OUString sVal;
817 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
818 DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
819 if (bOK)
820 rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
822 else if ( aName == sCopyStreamIfPossible )
824 bool bVal = false;
825 bool bOK = (rProp.Value >>= bVal);
826 DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
827 if (bOK)
828 rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
830 else if ( aName == sNoAutoSave )
832 bool bVal = false;
833 bool bOK = (rProp.Value >>= bVal);
834 DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
835 if (bOK)
836 rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
838 else if ( aName == sModifyPasswordInfo )
840 rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
842 else if ( aName == sEncryptionData )
844 rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
846 else if ( aName == sSuggestedSaveAsDir )
848 OUString sVal;
849 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
850 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
851 if (bOK)
852 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
854 else if ( aName == sSuggestedSaveAsName )
856 OUString sVal;
857 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
858 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
859 if (bOK)
860 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
862 else if (aName == sDocumentService)
864 OUString aVal;
865 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
866 if (bOK)
867 rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
869 else if (aName == sFilterProvider)
871 OUString aVal;
872 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
873 if (bOK)
874 rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
876 #ifdef DBG_UTIL
877 else
878 --nFoundArgs;
879 #endif
882 // API to raise options dialog with a specified options ab page (#i83757#)
883 else
885 // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
886 OUString sSlotName( "OptionsTreeDialog" );
887 OUString sPropName( "OptionsPageURL" );
888 if ( sSlotName == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) )
890 for ( sal_uInt16 n = 0; n < nCount; ++n )
892 const PropertyValue& rProp = pPropsVal[n];
893 OUString sName( rProp.Name );
894 if ( sName == sPropName )
896 OUString sURL;
897 if ( rProp.Value >>= sURL )
898 rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
899 break;
904 #ifdef DB_UTIL
905 if ( nFoundArgs == nCount )
907 // except for the "special" slots: assure that every argument was convertible
908 OStringBuffer aStr("MacroPlayer: Some properties didn't match to any formal argument for slot: ");
909 aStr.append(pSlot->pUnoName);
910 DBG_WARNING( aStr.getStr() );
912 #endif
915 void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
917 if ( !pSlot )
918 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
920 if ( !pSlot)
921 return;
923 if ( nSlotId == SID_OPENURL )
924 nSlotId = SID_OPENDOC;
925 if ( nSlotId == SID_SAVEASURL )
926 nSlotId = SID_SAVEASDOC;
928 // find number of properties to avoid permanent reallocations in the sequence
929 sal_Int32 nProps=0;
931 #ifdef DBG_UTIL
932 // trace number of items and compare with number of properties for debugging purposes
933 sal_Int32 nItems=0;
934 #endif
936 const SfxType *pType = pSlot->GetType();
937 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
939 // slot is a property
940 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
941 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
943 sal_uInt16 nSubCount = pType->nAttribs;
944 if ( nSubCount )
945 // it's a complex property, we want it split into simple types
946 // so we expect to get as many items as we have (sub) members
947 nProps = nSubCount;
948 else
949 // simple property: we expect to get exactly one item
950 nProps++;
952 #ifdef DBG_UTIL
953 else
955 // we will not rely on the "toggle" ability of some property slots
956 OStringBuffer aStr("Processing property slot without argument: ");
957 aStr.append(static_cast<sal_Int32>(nSlotId));
958 OSL_FAIL(aStr.getStr());
960 #endif
962 #ifdef DBG_UTIL
963 nItems++;
964 #endif
966 else
968 // slot is a method
969 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
970 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
971 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
973 // check every formal argument of the method
974 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
976 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
977 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
979 sal_uInt16 nSubCount = rArg.pType->nAttribs;
980 if ( nSubCount )
981 // argument has a complex type, we want it split into simple types
982 // so for this argument we expect to get as many items as we have (sub) members
983 nProps += nSubCount;
984 else
985 // argument of simple type: we expect to get exactly one item for it
986 nProps++;
987 #ifdef DBG_UTIL
988 nItems++;
989 #endif
993 // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
994 if ( bIsMediaDescriptor )
996 sal_Int32 nAdditional=0;
997 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SfxItemState::SET )
998 nAdditional++;
999 if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SfxItemState::SET )
1000 nAdditional++;
1001 if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SfxItemState::SET )
1002 nAdditional++;
1003 if ( rSet.GetItemState( SID_PATH ) == SfxItemState::SET )
1004 nAdditional++;
1005 if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET )
1006 nAdditional++;
1007 if ( rSet.GetItemState( SID_STANDARD_DIR ) == SfxItemState::SET )
1008 nAdditional++;
1009 if ( rSet.GetItemState( SID_BLACK_LIST ) == SfxItemState::SET )
1010 nAdditional++;
1011 if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET )
1012 nAdditional++;
1013 if ( rSet.GetItemState( SID_INPUTSTREAM ) == SfxItemState::SET )
1014 nAdditional++;
1015 if ( rSet.GetItemState( SID_STREAM ) == SfxItemState::SET )
1016 nAdditional++;
1017 if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SfxItemState::SET )
1018 nAdditional++;
1019 if ( rSet.GetItemState( SID_TEMPLATE ) == SfxItemState::SET )
1020 nAdditional++;
1021 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SfxItemState::SET )
1022 nAdditional++;
1023 if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SfxItemState::SET )
1024 nAdditional++;
1025 if ( rSet.GetItemState( SID_VIEW_ID ) == SfxItemState::SET )
1026 nAdditional++;
1027 if ( rSet.GetItemState( SID_VIEW_DATA ) == SfxItemState::SET )
1028 nAdditional++;
1029 if ( rSet.GetItemState( SID_FILTER_DATA ) == SfxItemState::SET )
1030 nAdditional++;
1031 if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SfxItemState::SET )
1032 nAdditional++;
1033 if ( rSet.GetItemState( SID_DOC_READONLY ) == SfxItemState::SET )
1034 nAdditional++;
1035 if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SfxItemState::SET )
1036 nAdditional++;
1037 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SfxItemState::SET )
1038 nAdditional++;
1039 if ( rSet.GetItemState( SID_SELECTION ) == SfxItemState::SET )
1040 nAdditional++;
1041 if ( rSet.GetItemState( SID_CONTENTTYPE ) == SfxItemState::SET )
1042 nAdditional++;
1043 if ( rSet.GetItemState( SID_POSTDATA ) == SfxItemState::SET )
1044 nAdditional++;
1045 if ( rSet.GetItemState( SID_FILLFRAME ) == SfxItemState::SET )
1046 nAdditional++;
1047 if ( rSet.GetItemState( SID_CHARSET ) == SfxItemState::SET )
1048 nAdditional++;
1049 if ( rSet.GetItemState( SID_TARGETNAME ) == SfxItemState::SET )
1050 nAdditional++;
1051 if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SfxItemState::SET )
1052 nAdditional++;
1053 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SfxItemState::SET )
1054 nAdditional++;
1055 if ( rSet.GetItemState( SID_HIDDEN ) == SfxItemState::SET )
1056 nAdditional++;
1057 if ( rSet.GetItemState( SID_MINIMIZED ) == SfxItemState::SET )
1058 nAdditional++;
1059 if ( rSet.GetItemState( SID_PREVIEW ) == SfxItemState::SET )
1060 nAdditional++;
1061 if ( rSet.GetItemState( SID_VIEWONLY ) == SfxItemState::SET )
1062 nAdditional++;
1063 if ( rSet.GetItemState( SID_EDITDOC ) == SfxItemState::SET )
1064 nAdditional++;
1065 if ( rSet.GetItemState( SID_SILENT ) == SfxItemState::SET )
1066 nAdditional++;
1067 if ( rSet.GetItemState( SID_JUMPMARK ) == SfxItemState::SET )
1068 nAdditional++;
1069 if ( rSet.GetItemState( SID_DOCUMENT ) == SfxItemState::SET )
1070 nAdditional++;
1071 if ( rSet.GetItemState( SID_MACROEXECMODE ) == SfxItemState::SET )
1072 nAdditional++;
1073 if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SfxItemState::SET )
1074 nAdditional++;
1075 if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SfxItemState::SET )
1076 nAdditional++;
1077 if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SfxItemState::SET )
1078 nAdditional++;
1079 if ( rSet.GetItemState( SID_COMPONENTDATA ) == SfxItemState::SET )
1080 nAdditional++;
1081 if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SfxItemState::SET )
1082 nAdditional++;
1083 if ( rSet.GetItemState( SID_DOC_BASEURL ) == SfxItemState::SET )
1084 nAdditional++;
1085 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SfxItemState::SET )
1086 nAdditional++;
1087 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SfxItemState::SET )
1088 nAdditional++;
1089 if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SfxItemState::SET )
1090 nAdditional++;
1091 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SfxItemState::SET )
1092 nAdditional++;
1093 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SfxItemState::SET )
1094 nAdditional++;
1095 if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SfxItemState::SET )
1096 nAdditional++;
1097 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SfxItemState::SET )
1098 nAdditional++;
1099 if ( rSet.GetItemState( SID_DOC_SERVICE ) == SfxItemState::SET )
1100 nAdditional++;
1101 if (rSet.HasItem(SID_FILTER_PROVIDER))
1102 ++nAdditional;
1104 // consider additional arguments
1105 nProps += nAdditional;
1106 #ifdef DBG_UTIL
1107 nItems += nAdditional;
1108 #endif
1112 #ifdef DBG_UTIL
1113 // now check the itemset: is there any item that is not convertible using the list of formal arguments
1114 // or the table of additional items?!
1115 if ( rSet.Count() != nItems )
1117 // detect unknown item and present error message
1118 const sal_uInt16 *pRanges = rSet.GetRanges();
1119 while ( *pRanges )
1121 for(sal_uInt16 nId = *pRanges++; nId <= *pRanges; ++nId)
1123 if ( rSet.GetItemState(nId) < SfxItemState::SET ) //???
1124 // not really set
1125 continue;
1127 if ( !pSlot->IsMode(SfxSlotMode::METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
1128 continue;
1130 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1131 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
1132 sal_uInt16 nArg;
1133 for ( nArg=0; nArg<nFormalArgs; ++nArg )
1135 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
1136 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1137 if ( nId == nWhich )
1138 break;
1141 if ( nArg<nFormalArgs )
1142 continue;
1144 if ( bIsMediaDescriptor )
1146 if ( nId == SID_DOCFRAME )
1147 continue;
1148 if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
1149 continue;
1150 if ( nId == SID_INTERACTIONHANDLER )
1151 continue;
1152 if ( nId == SID_VIEW_DATA )
1153 continue;
1154 if ( nId == SID_FILTER_DATA )
1155 continue;
1156 if ( nId == SID_DOCUMENT )
1157 continue;
1158 if ( nId == SID_CONTENT )
1159 continue;
1160 if ( nId == SID_INPUTSTREAM )
1161 continue;
1162 if ( nId == SID_STREAM )
1163 continue;
1164 if ( nId == SID_OUTPUTSTREAM )
1165 continue;
1166 if ( nId == SID_POSTDATA )
1167 continue;
1168 if ( nId == SID_FILLFRAME )
1169 continue;
1170 if ( nId == SID_TEMPLATE )
1171 continue;
1172 if ( nId == SID_OPEN_NEW_VIEW )
1173 continue;
1174 if ( nId == SID_VIEW_ID )
1175 continue;
1176 if ( nId == SID_PLUGIN_MODE )
1177 continue;
1178 if ( nId == SID_DOC_READONLY )
1179 continue;
1180 if ( nId == SID_DOC_STARTPRESENTATION )
1181 continue;
1182 if ( nId == SID_SELECTION )
1183 continue;
1184 if ( nId == SID_HIDDEN )
1185 continue;
1186 if ( nId == SID_MINIMIZED )
1187 continue;
1188 if ( nId == SID_SILENT )
1189 continue;
1190 if ( nId == SID_PREVIEW )
1191 continue;
1192 if ( nId == SID_VIEWONLY )
1193 continue;
1194 if ( nId == SID_EDITDOC )
1195 continue;
1196 if ( nId == SID_TARGETNAME )
1197 continue;
1198 if ( nId == SID_DOC_SALVAGE )
1199 continue;
1200 if ( nId == SID_PATH )
1201 continue;
1202 if ( nId == SID_FILE_DIALOG )
1203 continue;
1204 if ( nId == SID_STANDARD_DIR )
1205 continue;
1206 if ( nId == SID_BLACK_LIST )
1207 continue;
1208 if ( nId == SID_CONTENTTYPE )
1209 continue;
1210 if ( nId == SID_TEMPLATE_NAME )
1211 continue;
1212 if ( nId == SID_TEMPLATE_REGIONNAME )
1213 continue;
1214 if ( nId == SID_JUMPMARK )
1215 continue;
1216 if ( nId == SID_CHARSET )
1217 continue;
1218 if ( nId == SID_MACROEXECMODE )
1219 continue;
1220 if ( nId == SID_UPDATEDOCMODE )
1221 continue;
1222 if ( nId == SID_REPAIRPACKAGE )
1223 continue;
1224 if ( nId == SID_DOCINFO_TITLE )
1225 continue;
1226 if ( nId == SID_COMPONENTDATA )
1227 continue;
1228 if ( nId == SID_COMPONENTCONTEXT )
1229 continue;
1230 if ( nId == SID_DOC_BASEURL )
1231 continue;
1232 if ( nId == SID_DOC_HIERARCHICALNAME )
1233 continue;
1234 if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
1235 continue;
1236 if ( nId == SID_NOAUTOSAVE )
1237 continue;
1238 if ( nId == SID_ENCRYPTIONDATA )
1239 continue;
1240 if ( nId == SID_DOC_SERVICE )
1241 continue;
1242 if (nId == SID_FILTER_PROVIDER)
1243 continue;
1245 // used only internally
1246 if ( nId == SID_SAVETO )
1247 continue;
1248 if ( nId == SID_SAVEACOPYITEM )
1249 continue;
1250 if ( nId == SID_MODIFYPASSWORDINFO )
1251 continue;
1252 if ( nId == SID_SUGGESTEDSAVEASDIR )
1253 continue;
1254 if ( nId == SID_SUGGESTEDSAVEASNAME )
1255 continue;
1258 OStringBuffer aDbg("Unknown item detected: ");
1259 aDbg.append(static_cast<sal_Int32>(nId));
1260 DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
1264 #endif
1266 if ( !nProps )
1267 return;
1269 // convert every item into a property
1270 uno::Sequence<beans::PropertyValue> aSequ(nProps);
1271 beans::PropertyValue *pValue = aSequ.getArray();
1273 sal_Int32 nActProp=0;
1274 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
1276 // slot is a property
1277 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
1278 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1279 SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, false );
1280 if ( pItem ) //???
1282 sal_uInt16 nSubCount = pType->nAttribs;
1283 if ( !nSubCount )
1285 pValue[nActProp].Name = OUString::createFromAscii(pSlot->pUnoName) ;
1286 if ( !pItem->QueryValue( pValue[nActProp].Value ) )
1288 OStringBuffer aStr("Item not convertible: ");
1289 aStr.append(static_cast<sal_Int32>(nSlotId));
1290 OSL_FAIL(aStr.getStr());
1293 else
1295 // complex type, add a property value for every member of the struct
1296 for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1298 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID;
1299 if ( bConvertTwips )
1300 nSubId |= CONVERT_TWIPS;
1302 DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
1303 OUString aName( OUString::createFromAscii( pSlot->pUnoName ) ) ;
1304 aName += ".";
1305 aName += OUString::createFromAscii( pType->aAttrib[n-1].pName ) ;
1306 pValue[nActProp].Name = aName;
1307 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1309 OStringBuffer aStr("Sub item ");
1310 aStr.append(static_cast<sal_Int32>(
1311 pType->aAttrib[n-1].nAID));
1312 aStr.append(" not convertible in slot: ");
1313 aStr.append(static_cast<sal_Int32>(nSlotId));
1314 OSL_FAIL( aStr.getStr() );
1320 rArgs = aSequ;
1321 return;
1324 // slot is a method
1325 sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1326 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1328 const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1329 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1330 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP );
1331 SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, false );
1332 if ( pItem ) //???
1334 sal_uInt16 nSubCount = rArg.pType->nAttribs;
1335 if ( !nSubCount )
1337 pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) ;
1338 if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
1340 OStringBuffer aStr("Item not convertible: ");
1341 aStr.append(static_cast<sal_Int32>(rArg.nSlotId));
1342 OSL_FAIL(aStr.getStr());
1345 else
1347 // complex type, add a property value for every member of the struct
1348 for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1350 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID;
1351 if ( bConvertTwips )
1352 nSubId |= CONVERT_TWIPS;
1354 DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
1355 OUString aName( OUString::createFromAscii( rArg.pName ) ) ;
1356 aName += ".";
1357 aName += OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
1358 pValue[nActProp].Name = aName;
1359 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1361 OStringBuffer aStr("Sub item ");
1362 aStr.append(static_cast<sal_Int32>(
1363 rArg.pType->aAttrib[n-1].nAID));
1364 aStr.append(" not convertible in slot: ");
1365 aStr.append(static_cast<sal_Int32>(rArg.nSlotId));
1366 OSL_FAIL(aStr.getStr());
1373 if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
1374 nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
1375 nSlotId == SID_SAVEACOPY )
1377 const SfxPoolItem *pItem=0;
1378 if ( rSet.GetItemState( SID_COMPONENTDATA, false, &pItem ) == SfxItemState::SET )
1380 pValue[nActProp].Name = sComponentData;
1381 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1383 if ( rSet.GetItemState( SID_COMPONENTCONTEXT, false, &pItem ) == SfxItemState::SET )
1385 pValue[nActProp].Name = sComponentContext;
1386 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1388 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, false, &pItem ) == SfxItemState::SET )
1390 pValue[nActProp].Name = sStatusInd;
1391 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1393 if ( rSet.GetItemState( SID_INTERACTIONHANDLER, false, &pItem ) == SfxItemState::SET )
1395 pValue[nActProp].Name = sInteractionHdl;
1396 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1398 if ( rSet.GetItemState( SID_VIEW_DATA, false, &pItem ) == SfxItemState::SET )
1400 pValue[nActProp].Name = sViewData;
1401 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1403 if ( rSet.GetItemState( SID_FILTER_DATA, false, &pItem ) == SfxItemState::SET )
1405 pValue[nActProp].Name = sFilterData;
1406 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1408 if ( rSet.GetItemState( SID_DOCUMENT, false, &pItem ) == SfxItemState::SET )
1410 pValue[nActProp].Name = sModel;
1411 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1413 if ( rSet.GetItemState( SID_CONTENT, false, &pItem ) == SfxItemState::SET )
1415 pValue[nActProp].Name = sUCBContent;
1416 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1418 if ( rSet.GetItemState( SID_INPUTSTREAM, false, &pItem ) == SfxItemState::SET )
1420 pValue[nActProp].Name = sInputStream;
1421 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1423 if ( rSet.GetItemState( SID_STREAM, false, &pItem ) == SfxItemState::SET )
1425 pValue[nActProp].Name = sStream;
1426 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1428 if ( rSet.GetItemState( SID_OUTPUTSTREAM, false, &pItem ) == SfxItemState::SET )
1430 pValue[nActProp].Name = sOutputStream;
1431 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1433 if ( rSet.GetItemState( SID_POSTDATA, false, &pItem ) == SfxItemState::SET )
1435 pValue[nActProp].Name = sPostData;
1436 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1438 if ( rSet.GetItemState( SID_FILLFRAME, false, &pItem ) == SfxItemState::SET )
1440 pValue[nActProp].Name = sFrame;
1441 if ( pItem->ISA( SfxUsrAnyItem ) )
1443 OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" );
1444 pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue();
1446 else if ( pItem->ISA( SfxUnoFrameItem ) )
1447 pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame();
1448 else
1449 OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1451 if ( rSet.GetItemState( SID_TEMPLATE, false, &pItem ) == SfxItemState::SET )
1453 pValue[nActProp].Name = sAsTemplate;
1454 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1456 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, false, &pItem ) == SfxItemState::SET )
1458 pValue[nActProp].Name = sOpenNewView;
1459 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1461 if ( rSet.GetItemState( SID_FAIL_ON_WARNING, false, &pItem ) == SfxItemState::SET )
1463 pValue[nActProp].Name = sFailOnWarning;
1464 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1466 if ( rSet.GetItemState( SID_VIEW_ID, false, &pItem ) == SfxItemState::SET )
1468 pValue[nActProp].Name = sViewId;
1469 pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1471 if ( rSet.GetItemState( SID_PLUGIN_MODE, false, &pItem ) == SfxItemState::SET )
1473 pValue[nActProp].Name = sPluginMode;
1474 pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1476 if ( rSet.GetItemState( SID_DOC_READONLY, false, &pItem ) == SfxItemState::SET )
1478 pValue[nActProp].Name = sReadOnly;
1479 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1481 if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, false, &pItem ) == SfxItemState::SET )
1483 pValue[nActProp].Name = sDdeReconnect;
1484 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1486 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, false, &pItem ) == SfxItemState::SET )
1488 pValue[nActProp].Name = sStartPresentation;
1489 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1491 if ( rSet.GetItemState( SID_SELECTION, false, &pItem ) == SfxItemState::SET )
1493 pValue[nActProp].Name = sSelectionOnly;
1494 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1496 if ( rSet.GetItemState( SID_HIDDEN, false, &pItem ) == SfxItemState::SET )
1498 pValue[nActProp].Name = sHidden;
1499 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1501 if ( rSet.GetItemState( SID_MINIMIZED, false, &pItem ) == SfxItemState::SET )
1503 pValue[nActProp].Name = sMinimized;
1504 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1506 if ( rSet.GetItemState( SID_SILENT, false, &pItem ) == SfxItemState::SET )
1508 pValue[nActProp].Name = sSilent;
1509 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1511 if ( rSet.GetItemState( SID_PREVIEW, false, &pItem ) == SfxItemState::SET )
1513 pValue[nActProp].Name = sPreview;
1514 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1516 if ( rSet.GetItemState( SID_VIEWONLY, false, &pItem ) == SfxItemState::SET )
1518 pValue[nActProp].Name = sViewOnly;
1519 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1521 if ( rSet.GetItemState( SID_EDITDOC, false, &pItem ) == SfxItemState::SET )
1523 pValue[nActProp].Name = sDontEdit;
1524 pValue[nActProp++].Value <<= !static_cast<const SfxBoolItem*>(pItem)->GetValue();
1526 if ( rSet.GetItemState( SID_FILE_DIALOG, false, &pItem ) == SfxItemState::SET )
1528 pValue[nActProp].Name = sUseSystemDialog;
1529 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1531 if ( rSet.GetItemState( SID_STANDARD_DIR, false, &pItem ) == SfxItemState::SET )
1533 pValue[nActProp].Name = sStandardDir;
1534 pValue[nActProp++].Value <<= OUString( static_cast<const SfxStringItem*>(pItem)->GetValue());
1536 if ( rSet.GetItemState( SID_BLACK_LIST, false, &pItem ) == SfxItemState::SET )
1538 pValue[nActProp].Name = sBlackList;
1540 com::sun::star::uno::Sequence< OUString > aList;
1541 static_cast<const SfxStringListItem*>(pItem)->GetStringList( aList );
1542 pValue[nActProp++].Value <<= aList ;
1544 if ( rSet.GetItemState( SID_TARGETNAME, false, &pItem ) == SfxItemState::SET )
1546 pValue[nActProp].Name = sFrameName;
1547 pValue[nActProp++].Value <<= OUString( static_cast<const SfxStringItem*>(pItem)->GetValue() );
1549 if ( rSet.GetItemState( SID_DOC_SALVAGE, false, &pItem ) == SfxItemState::SET )
1551 pValue[nActProp].Name = sSalvagedFile;
1552 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1554 if ( rSet.GetItemState( SID_PATH, false, &pItem ) == SfxItemState::SET )
1556 pValue[nActProp].Name = sFolderName;
1557 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1559 if ( rSet.GetItemState( SID_CONTENTTYPE, false, &pItem ) == SfxItemState::SET )
1561 pValue[nActProp].Name = sMediaType;
1562 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1564 if ( rSet.GetItemState( SID_TEMPLATE_NAME, false, &pItem ) == SfxItemState::SET )
1566 pValue[nActProp].Name = sTemplateName;
1567 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1569 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, false, &pItem ) == SfxItemState::SET )
1571 pValue[nActProp].Name = sTemplateRegionName;
1572 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1574 if ( rSet.GetItemState( SID_JUMPMARK, false, &pItem ) == SfxItemState::SET )
1576 pValue[nActProp].Name = sJumpMark;
1577 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1580 if ( rSet.GetItemState( SID_CHARSET, false, &pItem ) == SfxItemState::SET )
1582 pValue[nActProp].Name = sCharacterSet;
1583 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1585 if ( rSet.GetItemState( SID_MACROEXECMODE, false, &pItem ) == SfxItemState::SET )
1587 pValue[nActProp].Name = sMacroExecMode;
1588 pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1590 if ( rSet.GetItemState( SID_UPDATEDOCMODE, false, &pItem ) == SfxItemState::SET )
1592 pValue[nActProp].Name = sUpdateDocMode;
1593 pValue[nActProp++].Value <<= (sal_Int16) static_cast<const SfxUInt16Item*>(pItem)->GetValue();
1595 if ( rSet.GetItemState( SID_REPAIRPACKAGE, false, &pItem ) == SfxItemState::SET )
1597 pValue[nActProp].Name = sRepairPackage;
1598 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1600 if ( rSet.GetItemState( SID_DOCINFO_TITLE, false, &pItem ) == SfxItemState::SET )
1602 pValue[nActProp].Name = sDocumentTitle;
1603 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1605 if ( rSet.GetItemState( SID_DOC_BASEURL, false, &pItem ) == SfxItemState::SET )
1607 pValue[nActProp].Name = sDocumentBaseURL;
1608 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1610 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, false, &pItem ) == SfxItemState::SET )
1612 pValue[nActProp].Name = sHierarchicalDocumentName;
1613 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1615 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, false, &pItem ) == SfxItemState::SET )
1617 pValue[nActProp].Name = sCopyStreamIfPossible;
1618 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1620 if ( rSet.GetItemState( SID_NOAUTOSAVE, false, &pItem ) == SfxItemState::SET )
1622 pValue[nActProp].Name = sNoAutoSave;
1623 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1625 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, false, &pItem ) == SfxItemState::SET )
1627 pValue[nActProp].Name = sModifyPasswordInfo;
1628 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1630 if ( rSet.GetItemState( SID_ENCRYPTIONDATA, false, &pItem ) == SfxItemState::SET )
1632 pValue[nActProp].Name = sEncryptionData;
1633 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1635 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, false, &pItem ) == SfxItemState::SET )
1637 pValue[nActProp].Name = sSuggestedSaveAsDir;
1638 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1640 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, false, &pItem ) == SfxItemState::SET )
1642 pValue[nActProp].Name = sSuggestedSaveAsName;
1643 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1645 if ( rSet.GetItemState( SID_DOC_SERVICE, false, &pItem ) == SfxItemState::SET )
1647 pValue[nActProp].Name = sDocumentService;
1648 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1650 if (rSet.HasItem(SID_FILTER_PROVIDER, &pItem))
1652 pValue[nActProp].Name = sFilterProvider;
1653 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1657 rArgs = aSequ;
1660 void SAL_CALL FilterOptionsContinuation::setFilterOptions(
1661 const uno::Sequence<beans::PropertyValue>& rProps )
1662 throw (uno::RuntimeException, std::exception)
1664 rProperties = rProps;
1667 uno::Sequence< beans::PropertyValue > SAL_CALL
1668 FilterOptionsContinuation::getFilterOptions()
1669 throw (uno::RuntimeException, std::exception)
1671 return rProperties;
1676 RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > rModel,
1677 const uno::Sequence< beans::PropertyValue >& rProperties )
1679 OUString temp;
1680 uno::Reference< uno::XInterface > temp2;
1681 document::FilterOptionsRequest aOptionsRequest( temp,
1682 temp2,
1683 rModel,
1684 rProperties );
1686 m_aRequest <<= aOptionsRequest;
1688 m_pAbort = new comphelper::OInteractionAbort;
1689 m_pOptions = new FilterOptionsContinuation;
1691 m_lContinuations.realloc( 2 );
1692 m_lContinuations[0] = uno::Reference< task::XInteractionContinuation >( m_pAbort );
1693 m_lContinuations[1] = uno::Reference< task::XInteractionContinuation >( m_pOptions );
1696 uno::Any SAL_CALL RequestFilterOptions::getRequest()
1697 throw( uno::RuntimeException, std::exception )
1699 return m_aRequest;
1702 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1703 SAL_CALL RequestFilterOptions::getContinuations()
1704 throw( uno::RuntimeException, std::exception )
1706 return m_lContinuations;
1710 class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< task::XInteractionRequest >
1712 uno::Any m_aRequest;
1713 uno::Sequence< uno::Reference< task::XInteractionContinuation > > m_lContinuations;
1714 comphelper::OInteractionApprove* m_pApprove;
1715 comphelper::OInteractionDisapprove* m_pDisapprove;
1717 public:
1718 RequestPackageReparation_Impl( const OUString& aName );
1719 bool isApproved();
1720 virtual uno::Any SAL_CALL getRequest() throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1721 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations()
1722 throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1725 RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aName )
1727 OUString temp;
1728 uno::Reference< uno::XInterface > temp2;
1729 document::BrokenPackageRequest aBrokenPackageRequest( temp,
1730 temp2,
1731 aName );
1732 m_aRequest <<= aBrokenPackageRequest;
1733 m_pApprove = new comphelper::OInteractionApprove;
1734 m_pDisapprove = new comphelper::OInteractionDisapprove;
1735 m_lContinuations.realloc( 2 );
1736 m_lContinuations[0] = uno::Reference< task::XInteractionContinuation >( m_pApprove );
1737 m_lContinuations[1] = uno::Reference< task::XInteractionContinuation >( m_pDisapprove );
1740 bool RequestPackageReparation_Impl::isApproved()
1742 return m_pApprove->wasSelected();
1745 uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
1746 throw( uno::RuntimeException, std::exception )
1748 return m_aRequest;
1751 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1752 SAL_CALL RequestPackageReparation_Impl::getContinuations()
1753 throw( uno::RuntimeException, std::exception )
1755 return m_lContinuations;
1758 RequestPackageReparation::RequestPackageReparation( const OUString& aName )
1760 pImp = new RequestPackageReparation_Impl( aName );
1761 pImp->acquire();
1764 RequestPackageReparation::~RequestPackageReparation()
1766 pImp->release();
1769 bool RequestPackageReparation::isApproved()
1771 return pImp->isApproved();
1774 com::sun::star::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest()
1776 return com::sun::star::uno::Reference < task::XInteractionRequest >(pImp);
1780 class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< task::XInteractionRequest >
1782 uno::Any m_aRequest;
1783 uno::Sequence< uno::Reference< task::XInteractionContinuation > > m_lContinuations;
1784 comphelper::OInteractionAbort* m_pAbort;
1786 public:
1787 NotifyBrokenPackage_Impl( const OUString& aName );
1788 virtual uno::Any SAL_CALL getRequest() throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1789 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations()
1790 throw( uno::RuntimeException, std::exception ) SAL_OVERRIDE;
1793 NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
1795 OUString temp;
1796 uno::Reference< uno::XInterface > temp2;
1797 document::BrokenPackageRequest aBrokenPackageRequest( temp,
1798 temp2,
1799 aName );
1800 m_aRequest <<= aBrokenPackageRequest;
1801 m_pAbort = new comphelper::OInteractionAbort;
1802 m_lContinuations.realloc( 1 );
1803 m_lContinuations[0] = uno::Reference< task::XInteractionContinuation >( m_pAbort );
1806 uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
1807 throw( uno::RuntimeException, std::exception )
1809 return m_aRequest;
1812 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1813 SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
1814 throw( uno::RuntimeException, std::exception )
1816 return m_lContinuations;
1819 NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
1821 pImp = new NotifyBrokenPackage_Impl( aName );
1822 pImp->acquire();
1825 NotifyBrokenPackage::~NotifyBrokenPackage()
1827 pImp->release();
1830 com::sun::star::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
1832 return com::sun::star::uno::Reference < task::XInteractionRequest >(pImp);
1835 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */