Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / sfx2 / source / appl / appuno.cxx
blob559cadd8f5347cec47511510cc0034ebbe67ca71
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 <sfx2/brokenpackageint.hxx>
22 #include <sfx2/docfile.hxx>
23 #include <sfx2/frame.hxx>
24 #include <sfx2/msg.hxx>
25 #include <sfx2/msgpool.hxx>
26 #include <sfx2/sfxsids.hrc>
27 #include <sfx2/sfxuno.hxx>
28 #include <sfxslots.hxx>
30 #include <sal/config.h>
31 #include <sal/log.hxx>
32 #include <comphelper/interaction.hxx>
33 #include <osl/diagnose.h>
34 #include <svl/eitem.hxx>
35 #include <svl/intitem.hxx>
36 #include <svl/itempool.hxx>
37 #include <svl/slstitm.hxx>
38 #include <svl/stritem.hxx>
39 #include <tools/debug.hxx>
40 #include <cppuhelper/implbase.hxx>
42 #include <com/sun/star/document/BrokenPackageRequest.hpp>
43 #include <com/sun/star/document/FilterOptionsRequest.hpp>
44 #include <com/sun/star/frame/XFrame.hpp>
45 #include <com/sun/star/frame/XModel.hpp>
46 #include <com/sun/star/io/XInputStream.hpp>
47 #include <com/sun/star/io/XOutputStream.hpp>
48 #include <com/sun/star/task/XInteractionHandler.hpp>
49 #include <com/sun/star/task/XStatusIndicator.hpp>
50 #include <com/sun/star/ucb/XContent.hpp>
52 #include <memory>
54 using namespace ::com::sun::star;
55 using namespace ::com::sun::star::ucb;
56 using namespace ::com::sun::star::uno;
57 using namespace ::com::sun::star::frame;
58 using namespace ::com::sun::star::beans;
59 using namespace ::com::sun::star::io;
61 // needs to be converted to a better data structure
62 SfxFormalArgument const aFormalArgs[] = {
63 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "SuggestedSaveAsName", SID_DEFAULTFILENAME },
64 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "SuggestedSaveAsDir", SID_DEFAULTFILEPATH },
65 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "VersionAuthor", SID_DOCINFO_AUTHOR },
66 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "VersionComment", SID_DOCINFO_COMMENTS },
67 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "DontTerminateEdit", FN_PARAM_1 },
68 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "VersionMajor", SID_DOCINFO_MAJOR },
69 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterOptions", SID_FILE_FILTEROPTIONS },
70 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FilterName", SID_FILTER_NAME },
71 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Margin1", SID_RULER_MARGIN1 },
72 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Margin2", SID_RULER_MARGIN2 },
73 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
74 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "URL", SID_FILE_NAME },
75 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "OpenFlags", SID_OPTIONS },
76 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "Overwrite", SID_OVERWRITE },
77 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Password", SID_PASSWORD },
78 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "PasswordInteraction", SID_PASSWORDINTERACTION },
79 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Referer", SID_REFERER },
80 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveTo", SID_SAVETO },
81 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "TemplateName", SID_TEMPLATE_NAME },
82 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "TemplateRegion", SID_TEMPLATE_REGIONNAME },
83 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Region", SID_TEMPLATE_REGIONNAME },
84 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Name", SID_TEMPLATE_NAME },
85 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "Unpacked", SID_UNPACK },
86 { reinterpret_cast<SfxType*>(&aSfxInt16Item_Impl), "Version", SID_VERSION },
87 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "SaveACopy", SID_SAVEACOPYITEM },
88 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoFileSync", SID_NO_FILE_SYNC },
89 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoThumbnail", SID_NO_THUMBNAIL },
90 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "NoEmbDataSet", SID_NO_EMBEDDED_DS },
91 { reinterpret_cast<SfxType*>(&aSfxBoolItem_Impl), "IsRedactMode", SID_IS_REDACT_MODE },
92 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "RedactionStyle", SID_REDACTION_STYLE },
93 { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "AdditionsTag", SID_ADDITIONS_TAG },
96 sal_uInt16 const nMediaArgsCount = SAL_N_ELEMENTS(aFormalArgs);
98 char const sTemplateRegionName[] = "TemplateRegionName";
99 char const sTemplateName[] = "TemplateName";
100 char const sAsTemplate[] = "AsTemplate";
101 char const sOpenNewView[] = "OpenNewView";
102 char const sViewId[] = "ViewId";
103 char const sPluginMode[] = "PluginMode";
104 char const sReadOnly[] = "ReadOnly";
105 char const sDdeReconnect[] = "DDEReconnect";
106 char const sStartPresentation[] = "StartPresentation";
107 char const sFrameName[] = "FrameName";
108 char const sMediaType[] = "MediaType";
109 char const sPostData[] = "PostData";
110 char const sCharacterSet[] = "CharacterSet";
111 char const sInputStream[] = "InputStream";
112 char const sStream[] = "Stream";
113 char const sOutputStream[] = "OutputStream";
114 char const sHidden[] = "Hidden";
115 char const sPreview[] = "Preview";
116 char const sViewOnly[] = "ViewOnly";
117 char const sDontEdit[] = "DontEdit";
118 char const sSilent[] = "Silent";
119 char const sJumpMark[] = "JumpMark";
120 char const sSalvagedFile[] = "SalvagedFile";
121 char const sStatusInd[] = "StatusIndicator";
122 char const sModel[] = "Model";
123 char const sFrame[] = "Frame";
124 char const sViewData[] = "ViewData";
125 char const sFilterData[] = "FilterData";
126 char const sSelectionOnly[] = "SelectionOnly";
127 char const sMacroExecMode[] = "MacroExecutionMode";
128 char const sUpdateDocMode[] = "UpdateDocMode";
129 char const sMinimized[] = "Minimized";
130 char const sInteractionHdl[] = "InteractionHandler";
131 char const sUCBContent[] = "UCBContent";
132 char const sRepairPackage[] = "RepairPackage";
133 char const sDocumentTitle[] = "DocumentTitle";
134 char const sComponentData[] = "ComponentData";
135 char const sComponentContext[] = "ComponentContext";
136 char const sDocumentBaseURL[] = "DocumentBaseURL";
137 char const sHierarchicalDocumentName[] = "HierarchicalDocumentName";
138 char const sCopyStreamIfPossible[] = "CopyStreamIfPossible";
139 char const sNoAutoSave[] = "NoAutoSave";
140 char const sFolderName[] = "FolderName";
141 char const sUseSystemDialog[] = "UseSystemDialog";
142 char const sStandardDir[] = "StandardDir";
143 char const sDenyList[] = "DenyList";
144 char const sModifyPasswordInfo[] = "ModifyPasswordInfo";
145 char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir";
146 char const sSuggestedSaveAsName[] = "SuggestedSaveAsName";
147 char const sEncryptionData[] = "EncryptionData";
148 char const sFailOnWarning[] = "FailOnWarning";
149 char const sDocumentService[] = "DocumentService";
150 char const sFilterProvider[] = "FilterProvider";
151 char const sImageFilter[] = "ImageFilter";
152 char const sLockContentExtraction[] = "LockContentExtraction";
153 char const sLockExport[] = "LockExport";
154 char const sLockPrint[] = "LockPrint";
155 char const sLockSave[] = "LockSave";
156 char const sLockEditDoc[] = "LockEditDoc";
157 char const sReplaceable[] = "Replaceable";
159 static bool isMediaDescriptor( sal_uInt16 nSlotId )
161 return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC ||
162 nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
163 nSlotId == SID_SAVETO || nSlotId == SID_SAVEACOPY ||
164 nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
165 nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
166 nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC ||
167 nSlotId == SID_SAVEACOPYITEM);
170 void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
172 if ( !pSlot )
173 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
175 if ( !pSlot )
176 return;
178 if ( nSlotId == SID_OPENURL )
179 nSlotId = SID_OPENDOC;
181 const sal_Int32 nCount = rArgs.getLength();
182 if ( !nCount )
183 return;
185 const beans::PropertyValue* pPropsVal = rArgs.getConstArray();
186 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
188 // slot is a property
189 const SfxType* pType = pSlot->GetType();
190 std::unique_ptr<SfxPoolItem> pItem(pType->CreateItem());
192 if ( !pItem )
194 SAL_WARN( "sfx", "No creator method for item: " << nSlotId );
195 return;
198 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
199 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
200 pItem->SetWhich( nWhich );
201 sal_uInt16 nSubCount = pType->nAttribs;
203 const beans::PropertyValue& rProp = pPropsVal[0];
204 const OUString& rName = rProp.Name;
205 if ( nCount == 1 && rName == OUString( pSlot->pUnoName, strlen( pSlot->pUnoName ), RTL_TEXTENCODING_UTF8 ) )
207 // there is only one parameter and its name matches the name of the property,
208 // so it's either a simple property or a complex property in one single UNO struct
209 if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
210 // only use successfully converted items
211 rSet.Put( *pItem );
212 else
214 SAL_WARN( "sfx", "Property not convertible: " << pSlot->pUnoName );
217 #ifdef DBG_UTIL
218 else if ( nSubCount == 0 )
220 // for a simple property there can be only one parameter and its name *must* match
221 SAL_WARN("sfx.appl", "Property name does not match: " << rName);
223 #endif
224 else
226 // there is more than one parameter and the property is a complex one
227 #ifdef DBG_UTIL
228 // if the dispatch API is used for UI purposes or from the testtool,
229 // it is possible to skip some or all arguments,
230 // but it indicates an error for macro recording;
231 // so this should be notified as a warning only
232 if ( nCount != nSubCount )
234 SAL_INFO("sfx.appl", "MacroPlayer: wrong number of parameters for slot: " << nSlotId );
236 #endif
237 // complex property; collect sub items from the parameter set and reconstruct complex item
238 sal_uInt16 nFound=0;
239 for ( const beans::PropertyValue& rPropValue : rArgs )
241 sal_uInt16 nSub;
242 for ( nSub=0; nSub<nSubCount; nSub++ )
244 // search sub item by name
245 OString aStr = OString::Concat(pSlot->pUnoName) + "." + pType->aAttrib[nSub].pName;
246 if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
248 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID));
249 if ( bConvertTwips )
250 nSubId |= CONVERT_TWIPS;
251 if ( pItem->PutValue( rPropValue.Value, nSubId ) )
252 nFound++;
253 else
255 SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot->pUnoName);
257 break;
261 // there was a parameter with a name that didn't match to any of the members
262 SAL_WARN_IF( nSub >= nSubCount, "sfx.appl", "Property name does not match: " << rPropValue.Name );
265 // at least one part of the complex item must be present; other parts can have default values
266 if ( nFound > 0 )
267 rSet.Put( *pItem );
270 return;
273 #ifdef DBG_UTIL
274 // detect parameters that don't match to any formal argument or one of its members
275 sal_Int32 nFoundArgs = 0;
276 #endif
277 // slot is a method
278 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
279 sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
280 for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
282 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
283 std::unique_ptr<SfxPoolItem> pItem(rArg.CreateItem());
284 if ( !pItem )
286 SAL_WARN( "sfx", "No creator method for argument: " << rArg.pName );
287 return;
290 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId);
291 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
292 pItem->SetWhich( nWhich );
293 const SfxType* pType = rArg.pType;
294 sal_uInt16 nSubCount = pType->nAttribs;
295 if ( nSubCount == 0 )
297 // "simple" (base type) argument
298 auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
299 [&rArg](const beans::PropertyValue& rProp) { return rProp.Name.equalsAscii(rArg.pName); });
300 if (pProp != rArgs.end())
302 #ifdef DBG_UTIL
303 ++nFoundArgs;
304 #endif
305 if( pItem->PutValue( pProp->Value, 0 ) )
306 // only use successfully converted items
307 rSet.Put( *pItem );
308 else
310 SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
314 else
316 // complex argument, could be passed in one struct
317 bool bAsWholeItem = false;
318 for ( const beans::PropertyValue& rProp : rArgs )
320 const OUString& rName = rProp.Name;
321 if ( rName == OUString(rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8) )
323 bAsWholeItem = true;
324 #ifdef DBG_UTIL
325 ++nFoundArgs;
326 #endif
327 if( pItem->PutValue( rProp.Value, 0 ) )
328 // only use successfully converted items
329 rSet.Put( *pItem );
330 else
332 SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
337 if ( !bAsWholeItem )
339 // complex argument; collect sub items from argument array and reconstruct complex item
340 // only put item if at least one member was found and had the correct type
341 // (is this a good idea?! Should we ask for *all* members?)
342 bool bRet = false;
343 for ( const beans::PropertyValue& rProp : rArgs )
345 for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
347 // search sub item by name
348 OString aStr = OString::Concat(rArg.pName) + "." + pType->aAttrib[nSub].pName;
349 if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) )
351 // at least one member found ...
352 bRet = true;
353 #ifdef DBG_UTIL
354 ++nFoundArgs;
355 #endif
356 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID));
357 if ( bConvertTwips )
358 nSubId |= CONVERT_TWIPS;
359 if (!pItem->PutValue( rProp.Value, nSubId ) )
361 // ... but it was not convertible
362 bRet = false;
363 SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
366 break;
371 if ( bRet )
372 // only use successfully converted items
373 rSet.Put( *pItem );
379 // special additional parameters for some slots not seen in the slot definitions
380 // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
381 // but as dispatching or factory or arbitrary URLs to the frame
382 // Some also can use additional arguments that are not recordable (will be changed later,
383 // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
384 if ( nSlotId == SID_NEWWINDOW )
386 for ( const beans::PropertyValue& rProp : rArgs )
388 const OUString& rName = rProp.Name;
389 if ( rName == sFrame )
391 Reference< XFrame > xFrame;
392 OSL_VERIFY( rProp.Value >>= xFrame );
393 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
395 else
396 if ( rName == sHidden )
398 bool bVal = false;
399 if (rProp.Value >>= bVal)
400 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
404 else if ( bIsMediaDescriptor )
406 for ( const beans::PropertyValue& rProp : rArgs )
408 #ifdef DBG_UTIL
409 ++nFoundArgs;
410 #endif
411 const OUString& aName = rProp.Name;
412 if ( aName == sModel )
413 rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
414 else if ( aName == sComponentData )
416 rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
418 else if ( aName == sComponentContext )
420 rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
422 else if ( aName == sStatusInd )
424 Reference<task::XStatusIndicator> xVal;
425 bool bOK = (rProp.Value >>= xVal);
426 DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
427 if (bOK && xVal.is())
428 rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
430 else if ( aName == sInteractionHdl )
432 Reference<task::XInteractionHandler> xVal;
433 bool bOK = (rProp.Value >>= xVal);
434 DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
435 if (bOK && xVal.is())
436 rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
438 else if ( aName == sViewData )
439 rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
440 else if ( aName == sFilterData )
441 rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
442 else if ( aName == sInputStream )
444 Reference< XInputStream > xVal;
445 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
446 DBG_ASSERT( bOK, "invalid type for InputStream" );
447 if (bOK)
448 rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
450 else if ( aName == sStream )
452 Reference< XInputStream > xVal;
453 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
454 DBG_ASSERT( bOK, "invalid type for Stream" );
455 if (bOK)
456 rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
458 else if ( aName == sUCBContent )
460 Reference< XContent > xVal;
461 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
462 DBG_ASSERT( bOK, "invalid type for UCBContent" );
463 if (bOK)
464 rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
466 else if ( aName == sOutputStream )
468 Reference< XOutputStream > xVal;
469 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
470 DBG_ASSERT( bOK, "invalid type for OutputStream" );
471 if (bOK)
472 rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
474 else if ( aName == sPostData )
476 Reference< XInputStream > xVal;
477 bool bOK = (rProp.Value >>= xVal);
478 DBG_ASSERT( bOK, "invalid type for PostData" );
479 if (bOK)
480 rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
482 else if ( aName == sFrame )
484 Reference< XFrame > xFrame;
485 bool bOK = (rProp.Value >>= xFrame);
486 DBG_ASSERT( bOK, "invalid type for Frame" );
487 if (bOK)
488 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
490 else if ( aName == sAsTemplate )
492 bool bVal = false;
493 bool bOK = (rProp.Value >>= bVal);
494 DBG_ASSERT( bOK, "invalid type for AsTemplate" );
495 if (bOK)
496 rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
498 else if ( aName == sOpenNewView )
500 bool bVal = false;
501 bool bOK = (rProp.Value >>= bVal);
502 DBG_ASSERT( bOK, "invalid type for OpenNewView" );
503 if (bOK)
504 rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
506 else if ( aName == sFailOnWarning )
508 bool bVal = false;
509 bool bOK = (rProp.Value >>= bVal);
510 DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
511 if (bOK)
512 rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
514 else if ( aName == sViewId )
516 sal_Int16 nVal = -1;
517 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
518 DBG_ASSERT( bOK, "invalid type for ViewId" );
519 if (bOK)
520 rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
522 else if ( aName == sPluginMode )
524 sal_Int16 nVal = -1;
525 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
526 DBG_ASSERT( bOK, "invalid type for PluginMode" );
527 if (bOK)
528 rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
530 else if ( aName == sReadOnly )
532 bool bVal = false;
533 bool bOK = (rProp.Value >>= bVal);
534 DBG_ASSERT( bOK, "invalid type for ReadOnly" );
535 if (bOK)
536 rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
538 else if ( aName == sDdeReconnect )
540 bool bVal = true;
541 bool bOK = (rProp.Value >>= bVal);
542 DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
543 if (bOK)
544 rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
546 else if ( aName == sStartPresentation )
548 bool bVal = false;
549 bool bOK = (rProp.Value >>= bVal);
550 DBG_ASSERT( bOK, "invalid type for StartPresentation" );
551 if (bOK)
552 rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) );
554 else if ( aName == sSelectionOnly )
556 bool bVal = false;
557 bool bOK = (rProp.Value >>= bVal);
558 DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
559 if (bOK)
560 rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
562 else if ( aName == sHidden )
564 bool bVal = false;
565 bool bOK = (rProp.Value >>= bVal);
566 DBG_ASSERT( bOK, "invalid type for Hidden" );
567 if (bOK)
568 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
570 else if ( aName == sMinimized )
572 bool bVal = false;
573 bool bOK = (rProp.Value >>= bVal);
574 DBG_ASSERT( bOK, "invalid type for Minimized" );
575 if (bOK)
576 rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
578 else if ( aName == sSilent )
580 bool bVal = false;
581 bool bOK = (rProp.Value >>= bVal);
582 DBG_ASSERT( bOK, "invalid type for Silent" );
583 if (bOK)
584 rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
586 else if ( aName == sPreview )
588 bool bVal = false;
589 bool bOK = (rProp.Value >>= bVal);
590 DBG_ASSERT( bOK, "invalid type for Preview" );
591 if (bOK)
592 rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
594 else if ( aName == sViewOnly )
596 bool bVal = false;
597 bool bOK = (rProp.Value >>= bVal);
598 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
599 if (bOK)
600 rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
602 else if ( aName == sDontEdit )
604 bool bVal = false;
605 bool bOK = (rProp.Value >>= bVal);
606 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
607 if (bOK)
608 rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
610 else if ( aName == sUseSystemDialog )
612 bool bVal = false;
613 bool bOK = (rProp.Value >>= bVal);
614 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
615 if (bOK)
616 rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
618 else if ( aName == sStandardDir )
620 OUString sVal;
621 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
622 DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
623 if (bOK)
624 rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
626 else if ( aName == sDenyList )
628 uno::Sequence<OUString> xVal;
629 bool bOK = (rProp.Value >>= xVal);
630 DBG_ASSERT( bOK, "invalid type or value for DenyList" );
631 if (bOK)
633 SfxStringListItem stringList(SID_DENY_LIST);
634 stringList.SetStringList( xVal );
635 rSet.Put( stringList );
638 else if ( aName == "FileName" )
640 OUString sVal;
641 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
642 DBG_ASSERT( bOK, "invalid type or value for FileName" );
643 if (bOK)
644 rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
646 else if ( aName == sSalvagedFile )
648 OUString sVal;
649 bool bOK = (rProp.Value >>= sVal);
650 DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
651 if (bOK)
652 rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
654 else if ( aName == sFolderName )
656 OUString sVal;
657 bool bOK = (rProp.Value >>= sVal);
658 DBG_ASSERT( bOK, "invalid type or value for FolderName" );
659 if (bOK)
660 rSet.Put( SfxStringItem( SID_PATH, sVal ) );
662 else if ( aName == sFrameName )
664 OUString sVal;
665 bool bOK = (rProp.Value >>= sVal);
666 DBG_ASSERT( bOK, "invalid type for FrameName" );
667 if (bOK && !sVal.isEmpty())
668 rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
670 else if ( aName == sMediaType )
672 OUString sVal;
673 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
674 DBG_ASSERT( bOK, "invalid type or value for MediaType" );
675 if (bOK)
676 rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
678 else if ( aName == sTemplateName )
680 OUString sVal;
681 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
682 DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
683 if (bOK)
684 rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
686 else if ( aName == sTemplateRegionName )
688 OUString sVal;
689 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
690 DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
691 if (bOK)
692 rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
694 else if ( aName == sJumpMark )
696 OUString sVal;
697 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
698 DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
699 if (bOK)
700 rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
702 else if ( aName == sCharacterSet )
704 OUString sVal;
705 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
706 DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
707 if (bOK)
708 rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
710 else if ( aName == "FilterFlags" )
712 OUString sVal;
713 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
714 DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
715 if (bOK)
716 rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
718 else if ( aName == sImageFilter )
720 OUString sVal;
721 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
722 DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
723 if (bOK)
724 rSet.Put( SfxStringItem( SID_CONVERT_IMAGES, sVal ) );
726 else if ( aName == sMacroExecMode )
728 sal_Int16 nVal =-1;
729 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
730 DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
731 if (bOK)
732 rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
734 else if ( aName == sUpdateDocMode )
736 sal_Int16 nVal =-1;
737 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
738 DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
739 if (bOK)
740 rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
742 else if ( aName == sRepairPackage )
744 bool bVal = false;
745 bool bOK = (rProp.Value >>= bVal);
746 DBG_ASSERT( bOK, "invalid type for RepairPackage" );
747 if (bOK)
748 rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
750 else if ( aName == sDocumentTitle )
752 OUString sVal;
753 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
754 DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
755 if (bOK)
756 rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
758 else if ( aName == sDocumentBaseURL )
760 OUString sVal;
761 // the base url can be set to empty ( for embedded objects for example )
762 bool bOK = (rProp.Value >>= sVal);
763 DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
764 if (bOK)
765 rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
767 else if ( aName == sHierarchicalDocumentName )
769 OUString sVal;
770 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
771 DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
772 if (bOK)
773 rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
775 else if ( aName == sCopyStreamIfPossible )
777 bool bVal = false;
778 bool bOK = (rProp.Value >>= bVal);
779 DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
780 if (bOK)
781 rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
783 else if ( aName == sNoAutoSave )
785 bool bVal = false;
786 bool bOK = (rProp.Value >>= bVal);
787 DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
788 if (bOK)
789 rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
791 else if ( aName == sModifyPasswordInfo )
793 rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
795 else if ( aName == sEncryptionData )
797 rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
799 else if ( aName == sSuggestedSaveAsDir )
801 OUString sVal;
802 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
803 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
804 if (bOK)
805 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
807 else if ( aName == sSuggestedSaveAsName )
809 OUString sVal;
810 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
811 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
812 if (bOK)
813 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
815 else if (aName == sDocumentService)
817 OUString aVal;
818 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
819 if (bOK)
820 rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
822 else if (aName == sFilterProvider)
824 OUString aVal;
825 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
826 if (bOK)
827 rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
829 else if (aName == sLockContentExtraction)
831 bool bVal = false;
832 bool bOK = (rProp.Value >>= bVal);
833 DBG_ASSERT( bOK, "invalid type for LockContentExtraction" );
834 if (bOK)
835 rSet.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION, bVal ) );
837 else if (aName == sLockExport)
839 bool bVal = false;
840 bool bOK = (rProp.Value >>= bVal);
841 DBG_ASSERT( bOK, "invalid type for LockExport" );
842 if (bOK)
843 rSet.Put( SfxBoolItem( SID_LOCK_EXPORT, bVal ) );
845 else if (aName == sLockPrint)
847 bool bVal = false;
848 bool bOK = (rProp.Value >>= bVal);
849 DBG_ASSERT( bOK, "invalid type for LockPrint" );
850 if (bOK)
851 rSet.Put( SfxBoolItem( SID_LOCK_PRINT, bVal ) );
853 else if (aName == sLockSave)
855 bool bVal = false;
856 bool bOK = (rProp.Value >>= bVal);
857 DBG_ASSERT( bOK, "invalid type for LockSave" );
858 if (bOK)
859 rSet.Put( SfxBoolItem( SID_LOCK_SAVE, bVal ) );
861 else if (aName == sLockEditDoc)
863 bool bVal = false;
864 bool bOK = (rProp.Value >>= bVal);
865 DBG_ASSERT( bOK, "invalid type for LockEditDoc" );
866 if (bOK)
867 rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
869 else if (aName == sReplaceable)
871 bool bVal = false;
872 bool bOK = (rProp.Value >>= bVal);
873 DBG_ASSERT(bOK, "invalid type for Replaceable");
874 if (bOK)
875 rSet.Put(SfxBoolItem(SID_REPLACEABLE, bVal));
877 #ifdef DBG_UTIL
878 else
879 --nFoundArgs;
880 #endif
883 // API to raise options dialog with a specified options ab page (#i83757#)
884 else
886 // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
887 if ( "OptionsTreeDialog" == OUString( pSlot->pUnoName, strlen(pSlot->pUnoName), RTL_TEXTENCODING_UTF8 ) )
889 auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
890 [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL"; });
891 if (pProp != rArgs.end())
893 OUString sURL;
894 if ( pProp->Value >>= sURL )
895 rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
899 #ifdef DBG_UTIL
900 if ( nFoundArgs == nCount )
902 // except for the "special" slots: assure that every argument was convertible
903 SAL_INFO( "sfx.appl", "MacroPlayer: Some properties didn't match to any formal argument for slot: "<< pSlot->pUnoName );
905 #endif
908 void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
910 if ( !pSlot )
911 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
913 if ( !pSlot)
914 return;
916 if ( nSlotId == SID_OPENURL )
917 nSlotId = SID_OPENDOC;
918 if ( nSlotId == SID_SAVEASREMOTE )
919 nSlotId = SID_SAVEASDOC;
921 // find number of properties to avoid permanent reallocations in the sequence
922 sal_Int32 nProps=0;
924 #ifdef DBG_UTIL
925 // trace number of items and compare with number of properties for debugging purposes
926 sal_Int32 nItems=0;
927 #endif
929 const SfxType *pType = pSlot->GetType();
930 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
932 // slot is a property
933 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
934 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
936 sal_uInt16 nSubCount = pType->nAttribs;
937 if ( nSubCount )
938 // it's a complex property, we want it split into simple types
939 // so we expect to get as many items as we have (sub) members
940 nProps = nSubCount;
941 else
942 // simple property: we expect to get exactly one item
943 nProps++;
945 else
947 // we will not rely on the "toggle" ability of some property slots
948 SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId );
951 #ifdef DBG_UTIL
952 nItems++;
953 #endif
955 else
957 // slot is a method
958 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
959 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
960 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
962 // check every formal argument of the method
963 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
965 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
966 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
968 sal_uInt16 nSubCount = rArg.pType->nAttribs;
969 if ( nSubCount )
970 // argument has a complex type, we want it split into simple types
971 // so for this argument we expect to get as many items as we have (sub) members
972 nProps += nSubCount;
973 else
974 // argument of simple type: we expect to get exactly one item for it
975 nProps++;
976 #ifdef DBG_UTIL
977 nItems++;
978 #endif
982 // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
983 if ( bIsMediaDescriptor )
985 sal_Int32 nAdditional=0;
986 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SfxItemState::SET )
987 nAdditional++;
988 if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SfxItemState::SET )
989 nAdditional++;
990 if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SfxItemState::SET )
991 nAdditional++;
992 if ( rSet.GetItemState( SID_PATH ) == SfxItemState::SET )
993 nAdditional++;
994 if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET )
995 nAdditional++;
996 if ( rSet.GetItemState( SID_STANDARD_DIR ) == SfxItemState::SET )
997 nAdditional++;
998 if ( rSet.GetItemState( SID_DENY_LIST ) == SfxItemState::SET )
999 nAdditional++;
1000 if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET )
1001 nAdditional++;
1002 if ( rSet.GetItemState( SID_INPUTSTREAM ) == SfxItemState::SET )
1003 nAdditional++;
1004 if ( rSet.GetItemState( SID_STREAM ) == SfxItemState::SET )
1005 nAdditional++;
1006 if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SfxItemState::SET )
1007 nAdditional++;
1008 if ( rSet.GetItemState( SID_TEMPLATE ) == SfxItemState::SET )
1009 nAdditional++;
1010 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SfxItemState::SET )
1011 nAdditional++;
1012 if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SfxItemState::SET )
1013 nAdditional++;
1014 if ( rSet.GetItemState( SID_VIEW_ID ) == SfxItemState::SET )
1015 nAdditional++;
1016 if ( rSet.GetItemState( SID_VIEW_DATA ) == SfxItemState::SET )
1017 nAdditional++;
1018 if ( rSet.GetItemState( SID_FILTER_DATA ) == SfxItemState::SET )
1019 nAdditional++;
1020 if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SfxItemState::SET )
1021 nAdditional++;
1022 if ( rSet.GetItemState( SID_DOC_READONLY ) == SfxItemState::SET )
1023 nAdditional++;
1024 if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SfxItemState::SET )
1025 nAdditional++;
1026 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SfxItemState::SET )
1027 nAdditional++;
1028 if ( rSet.GetItemState( SID_SELECTION ) == SfxItemState::SET )
1029 nAdditional++;
1030 if ( rSet.GetItemState( SID_CONTENTTYPE ) == SfxItemState::SET )
1031 nAdditional++;
1032 if ( rSet.GetItemState( SID_POSTDATA ) == SfxItemState::SET )
1033 nAdditional++;
1034 if ( rSet.GetItemState( SID_FILLFRAME ) == SfxItemState::SET )
1035 nAdditional++;
1036 if ( rSet.GetItemState( SID_CHARSET ) == SfxItemState::SET )
1037 nAdditional++;
1038 if ( rSet.GetItemState( SID_TARGETNAME ) == SfxItemState::SET )
1039 nAdditional++;
1040 if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SfxItemState::SET )
1041 nAdditional++;
1042 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SfxItemState::SET )
1043 nAdditional++;
1044 if ( rSet.GetItemState( SID_HIDDEN ) == SfxItemState::SET )
1045 nAdditional++;
1046 if ( rSet.GetItemState( SID_MINIMIZED ) == SfxItemState::SET )
1047 nAdditional++;
1048 if ( rSet.GetItemState( SID_PREVIEW ) == SfxItemState::SET )
1049 nAdditional++;
1050 if ( rSet.GetItemState( SID_VIEWONLY ) == SfxItemState::SET )
1051 nAdditional++;
1052 if ( rSet.GetItemState( SID_EDITDOC ) == SfxItemState::SET )
1053 nAdditional++;
1054 if ( rSet.GetItemState( SID_SILENT ) == SfxItemState::SET )
1055 nAdditional++;
1056 if ( rSet.GetItemState( SID_JUMPMARK ) == SfxItemState::SET )
1057 nAdditional++;
1058 if ( rSet.GetItemState( SID_DOCUMENT ) == SfxItemState::SET )
1059 nAdditional++;
1060 if ( rSet.GetItemState( SID_MACROEXECMODE ) == SfxItemState::SET )
1061 nAdditional++;
1062 if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SfxItemState::SET )
1063 nAdditional++;
1064 if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SfxItemState::SET )
1065 nAdditional++;
1066 if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SfxItemState::SET )
1067 nAdditional++;
1068 if ( rSet.GetItemState( SID_COMPONENTDATA ) == SfxItemState::SET )
1069 nAdditional++;
1070 if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SfxItemState::SET )
1071 nAdditional++;
1072 if ( rSet.GetItemState( SID_DOC_BASEURL ) == SfxItemState::SET )
1073 nAdditional++;
1074 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SfxItemState::SET )
1075 nAdditional++;
1076 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SfxItemState::SET )
1077 nAdditional++;
1078 if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SfxItemState::SET )
1079 nAdditional++;
1080 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SfxItemState::SET )
1081 nAdditional++;
1082 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SfxItemState::SET )
1083 nAdditional++;
1084 if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SfxItemState::SET )
1085 nAdditional++;
1086 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SfxItemState::SET )
1087 nAdditional++;
1088 if ( rSet.GetItemState( SID_DOC_SERVICE ) == SfxItemState::SET )
1089 nAdditional++;
1090 if (rSet.HasItem(SID_FILTER_PROVIDER))
1091 ++nAdditional;
1092 if ( rSet.GetItemState( SID_CONVERT_IMAGES ) == SfxItemState::SET )
1093 nAdditional++;
1094 if ( rSet.GetItemState( SID_LOCK_CONTENT_EXTRACTION ) == SfxItemState::SET )
1095 nAdditional++;
1096 if ( rSet.GetItemState( SID_LOCK_EXPORT ) == SfxItemState::SET )
1097 nAdditional++;
1098 if ( rSet.GetItemState( SID_LOCK_PRINT ) == SfxItemState::SET )
1099 nAdditional++;
1100 if ( rSet.GetItemState( SID_LOCK_SAVE ) == SfxItemState::SET )
1101 nAdditional++;
1102 if ( rSet.GetItemState( SID_LOCK_EDITDOC ) == SfxItemState::SET )
1103 nAdditional++;
1104 if (rSet.GetItemState(SID_REPLACEABLE) == SfxItemState::SET)
1105 nAdditional++;
1107 // consider additional arguments
1108 nProps += nAdditional;
1109 #ifdef DBG_UTIL
1110 nItems += nAdditional;
1111 #endif
1115 #ifdef DBG_UTIL
1116 // now check the itemset: is there any item that is not convertible using the list of formal arguments
1117 // or the table of additional items?!
1118 if ( rSet.Count() != nItems )
1120 // detect unknown item and present error message
1121 const sal_uInt16 *pRanges = rSet.GetRanges();
1122 while ( *pRanges )
1124 sal_uInt16 nStartWhich = *pRanges++;
1125 sal_uInt16 nEndWhich = *pRanges++;
1126 for(sal_uInt16 nId = nStartWhich; nId <= nEndWhich; ++nId)
1128 if ( rSet.GetItemState(nId) < SfxItemState::SET ) //???
1129 // not really set
1130 continue;
1132 if ( !pSlot->IsMode(SfxSlotMode::METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
1133 continue;
1135 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1136 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
1137 sal_uInt16 nArg;
1138 for ( nArg=0; nArg<nFormalArgs; ++nArg )
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;
1146 if ( nArg<nFormalArgs )
1147 continue;
1149 if ( bIsMediaDescriptor )
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_DENY_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 if ( nId == SID_CONVERT_IMAGES )
1250 continue;
1252 // used only internally
1253 if ( nId == SID_SAVETO )
1254 continue;
1255 if ( nId == SID_SAVEACOPYITEM )
1256 continue;
1257 if ( nId == SID_MODIFYPASSWORDINFO )
1258 continue;
1259 if ( nId == SID_SUGGESTEDSAVEASDIR )
1260 continue;
1261 if ( nId == SID_SUGGESTEDSAVEASNAME )
1262 continue;
1263 if ( nId == SID_LOCK_CONTENT_EXTRACTION )
1264 continue;
1265 if ( nId == SID_LOCK_EXPORT )
1266 continue;
1267 if ( nId == SID_LOCK_PRINT )
1268 continue;
1269 if ( nId == SID_LOCK_SAVE )
1270 continue;
1271 if ( nId == SID_LOCK_EDITDOC )
1272 continue;
1273 if (nId == SID_REPLACEABLE)
1274 continue;
1277 OString aDbg = "Unknown item detected: " + OString::number(static_cast<sal_Int32>(nId));
1278 DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
1282 #endif
1284 if ( !nProps )
1285 return;
1287 // convert every item into a property
1288 uno::Sequence<beans::PropertyValue> aSequ(nProps);
1289 beans::PropertyValue *pValue = aSequ.getArray();
1291 sal_Int32 nActProp=0;
1292 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
1294 // slot is a property
1295 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
1296 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
1297 const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
1298 if ( pItem ) //???
1300 sal_uInt16 nSubCount = pType->nAttribs;
1301 if ( !nSubCount )
1303 pValue[nActProp].Name = OUString::createFromAscii(pSlot->pUnoName) ;
1304 if ( !pItem->QueryValue( pValue[nActProp].Value ) )
1306 SAL_WARN( "sfx", "Item not convertible: " << nSlotId );
1309 else
1311 // complex type, add a property value for every member of the struct
1312 for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1314 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[n-1].nAID));
1315 if ( bConvertTwips )
1316 nSubId |= CONVERT_TWIPS;
1318 DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
1319 pValue[nActProp].Name = OUString::createFromAscii( pSlot->pUnoName ) +
1320 "." +
1321 OUString::createFromAscii( pType->aAttrib[n-1].pName );
1322 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1324 SAL_WARN( "sfx", "Sub item " << pType->aAttrib[n-1].nAID
1325 << " not convertible in slot: " << nSlotId );
1331 rArgs = aSequ;
1332 return;
1335 // slot is a method
1336 sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1337 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1339 const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1340 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1341 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
1342 const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
1343 if ( pItem ) //???
1345 sal_uInt16 nSubCount = rArg.pType->nAttribs;
1346 if ( !nSubCount )
1348 pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) ;
1349 if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
1351 SAL_WARN( "sfx", "Item not convertible: " << rArg.nSlotId );
1354 else
1356 // complex type, add a property value for every member of the struct
1357 for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1359 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(rArg.pType->aAttrib[n-1].nAID));
1360 if ( bConvertTwips )
1361 nSubId |= CONVERT_TWIPS;
1363 DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
1364 pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) +
1365 "." +
1366 OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
1367 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1369 SAL_WARN( "sfx", "Sub item "
1370 << rArg.pType->aAttrib[n-1].nAID
1371 << " not convertible in slot: "
1372 << rArg.nSlotId );
1379 if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
1380 nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
1381 nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
1382 nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC || nSlotId == SID_SAVEACOPY )
1384 const SfxPoolItem *pItem=nullptr;
1385 if ( rSet.GetItemState( SID_COMPONENTDATA, false, &pItem ) == SfxItemState::SET )
1387 pValue[nActProp].Name = sComponentData;
1388 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1390 if ( rSet.GetItemState( SID_COMPONENTCONTEXT, false, &pItem ) == SfxItemState::SET )
1392 pValue[nActProp].Name = sComponentContext;
1393 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1395 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, false, &pItem ) == SfxItemState::SET )
1397 pValue[nActProp].Name = sStatusInd;
1398 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1400 if ( rSet.GetItemState( SID_INTERACTIONHANDLER, false, &pItem ) == SfxItemState::SET )
1402 pValue[nActProp].Name = sInteractionHdl;
1403 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1405 if ( rSet.GetItemState( SID_VIEW_DATA, false, &pItem ) == SfxItemState::SET )
1407 pValue[nActProp].Name = sViewData;
1408 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1410 if ( rSet.GetItemState( SID_FILTER_DATA, false, &pItem ) == SfxItemState::SET )
1412 pValue[nActProp].Name = sFilterData;
1413 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1415 if ( rSet.GetItemState( SID_DOCUMENT, false, &pItem ) == SfxItemState::SET )
1417 pValue[nActProp].Name = sModel;
1418 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1420 if ( rSet.GetItemState( SID_CONTENT, false, &pItem ) == SfxItemState::SET )
1422 pValue[nActProp].Name = sUCBContent;
1423 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1425 if ( rSet.GetItemState( SID_INPUTSTREAM, false, &pItem ) == SfxItemState::SET )
1427 pValue[nActProp].Name = sInputStream;
1428 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1430 if ( rSet.GetItemState( SID_STREAM, false, &pItem ) == SfxItemState::SET )
1432 pValue[nActProp].Name = sStream;
1433 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1435 if ( rSet.GetItemState( SID_OUTPUTSTREAM, false, &pItem ) == SfxItemState::SET )
1437 pValue[nActProp].Name = sOutputStream;
1438 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1440 if ( rSet.GetItemState( SID_POSTDATA, false, &pItem ) == SfxItemState::SET )
1442 pValue[nActProp].Name = sPostData;
1443 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1445 if ( rSet.GetItemState( SID_FILLFRAME, false, &pItem ) == SfxItemState::SET )
1447 pValue[nActProp].Name = sFrame;
1448 if ( auto pUsrAnyItem = dynamic_cast< const SfxUnoAnyItem *>( pItem ) )
1450 OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUnoAnyItem is not deprecated!" );
1451 pValue[nActProp++].Value = pUsrAnyItem->GetValue();
1453 else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem *>( pItem ) )
1454 pValue[nActProp++].Value <<= pUnoFrameItem->GetFrame();
1455 else
1456 OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1458 if ( rSet.GetItemState( SID_TEMPLATE, false, &pItem ) == SfxItemState::SET )
1460 pValue[nActProp].Name = sAsTemplate;
1461 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1463 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, false, &pItem ) == SfxItemState::SET )
1465 pValue[nActProp].Name = sOpenNewView;
1466 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1468 if ( rSet.GetItemState( SID_FAIL_ON_WARNING, false, &pItem ) == SfxItemState::SET )
1470 pValue[nActProp].Name = sFailOnWarning;
1471 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1473 if ( rSet.GetItemState( SID_VIEW_ID, false, &pItem ) == SfxItemState::SET )
1475 pValue[nActProp].Name = sViewId;
1476 pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
1478 if ( rSet.GetItemState( SID_PLUGIN_MODE, false, &pItem ) == SfxItemState::SET )
1480 pValue[nActProp].Name = sPluginMode;
1481 pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
1483 if ( rSet.GetItemState( SID_DOC_READONLY, false, &pItem ) == SfxItemState::SET )
1485 pValue[nActProp].Name = sReadOnly;
1486 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1488 if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD, false, &pItem ) == SfxItemState::SET )
1490 pValue[nActProp].Name = sDdeReconnect;
1491 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1493 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, false, &pItem ) == SfxItemState::SET )
1495 pValue[nActProp].Name = sStartPresentation;
1496 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1498 if ( rSet.GetItemState( SID_SELECTION, false, &pItem ) == SfxItemState::SET )
1500 pValue[nActProp].Name = sSelectionOnly;
1501 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1503 if ( rSet.GetItemState( SID_HIDDEN, false, &pItem ) == SfxItemState::SET )
1505 pValue[nActProp].Name = sHidden;
1506 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1508 if ( rSet.GetItemState( SID_MINIMIZED, false, &pItem ) == SfxItemState::SET )
1510 pValue[nActProp].Name = sMinimized;
1511 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1513 if ( rSet.GetItemState( SID_SILENT, false, &pItem ) == SfxItemState::SET )
1515 pValue[nActProp].Name = sSilent;
1516 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1518 if ( rSet.GetItemState( SID_PREVIEW, false, &pItem ) == SfxItemState::SET )
1520 pValue[nActProp].Name = sPreview;
1521 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1523 if ( rSet.GetItemState( SID_VIEWONLY, false, &pItem ) == SfxItemState::SET )
1525 pValue[nActProp].Name = sViewOnly;
1526 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1528 if ( rSet.GetItemState( SID_EDITDOC, false, &pItem ) == SfxItemState::SET )
1530 pValue[nActProp].Name = sDontEdit;
1531 pValue[nActProp++].Value <<= !static_cast<const SfxBoolItem*>(pItem)->GetValue();
1533 if ( rSet.GetItemState( SID_FILE_DIALOG, false, &pItem ) == SfxItemState::SET )
1535 pValue[nActProp].Name = sUseSystemDialog;
1536 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1538 if ( rSet.GetItemState( SID_STANDARD_DIR, false, &pItem ) == SfxItemState::SET )
1540 pValue[nActProp].Name = sStandardDir;
1541 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1543 if ( rSet.GetItemState( SID_DENY_LIST, false, &pItem ) == SfxItemState::SET )
1545 pValue[nActProp].Name = sDenyList;
1547 css::uno::Sequence< OUString > aList;
1548 static_cast<const SfxStringListItem*>(pItem)->GetStringList( aList );
1549 pValue[nActProp++].Value <<= aList ;
1551 if ( rSet.GetItemState( SID_TARGETNAME, false, &pItem ) == SfxItemState::SET )
1553 pValue[nActProp].Name = sFrameName;
1554 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1556 if ( rSet.GetItemState( SID_DOC_SALVAGE, false, &pItem ) == SfxItemState::SET )
1558 pValue[nActProp].Name = sSalvagedFile;
1559 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1561 if ( rSet.GetItemState( SID_PATH, false, &pItem ) == SfxItemState::SET )
1563 pValue[nActProp].Name = sFolderName;
1564 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1566 if ( rSet.GetItemState( SID_CONTENTTYPE, false, &pItem ) == SfxItemState::SET )
1568 pValue[nActProp].Name = sMediaType;
1569 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1571 if ( rSet.GetItemState( SID_TEMPLATE_NAME, false, &pItem ) == SfxItemState::SET )
1573 pValue[nActProp].Name = sTemplateName;
1574 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1576 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, false, &pItem ) == SfxItemState::SET )
1578 pValue[nActProp].Name = sTemplateRegionName;
1579 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1581 if ( rSet.GetItemState( SID_JUMPMARK, false, &pItem ) == SfxItemState::SET )
1583 pValue[nActProp].Name = sJumpMark;
1584 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1587 if ( rSet.GetItemState( SID_CHARSET, false, &pItem ) == SfxItemState::SET )
1589 pValue[nActProp].Name = sCharacterSet;
1590 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1592 if ( rSet.GetItemState( SID_MACROEXECMODE, false, &pItem ) == SfxItemState::SET )
1594 pValue[nActProp].Name = sMacroExecMode;
1595 pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
1597 if ( rSet.GetItemState( SID_UPDATEDOCMODE, false, &pItem ) == SfxItemState::SET )
1599 pValue[nActProp].Name = sUpdateDocMode;
1600 pValue[nActProp++].Value <<= static_cast<sal_Int16>(static_cast<const SfxUInt16Item*>(pItem)->GetValue());
1602 if ( rSet.GetItemState( SID_REPAIRPACKAGE, false, &pItem ) == SfxItemState::SET )
1604 pValue[nActProp].Name = sRepairPackage;
1605 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1607 if ( rSet.GetItemState( SID_DOCINFO_TITLE, false, &pItem ) == SfxItemState::SET )
1609 pValue[nActProp].Name = sDocumentTitle;
1610 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1612 if ( rSet.GetItemState( SID_DOC_BASEURL, false, &pItem ) == SfxItemState::SET )
1614 pValue[nActProp].Name = sDocumentBaseURL;
1615 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1617 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, false, &pItem ) == SfxItemState::SET )
1619 pValue[nActProp].Name = sHierarchicalDocumentName;
1620 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1622 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, false, &pItem ) == SfxItemState::SET )
1624 pValue[nActProp].Name = sCopyStreamIfPossible;
1625 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1627 if ( rSet.GetItemState( SID_NOAUTOSAVE, false, &pItem ) == SfxItemState::SET )
1629 pValue[nActProp].Name = sNoAutoSave;
1630 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1632 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, false, &pItem ) == SfxItemState::SET )
1634 pValue[nActProp].Name = sModifyPasswordInfo;
1635 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1637 if ( rSet.GetItemState( SID_ENCRYPTIONDATA, false, &pItem ) == SfxItemState::SET )
1639 pValue[nActProp].Name = sEncryptionData;
1640 pValue[nActProp++].Value = static_cast<const SfxUnoAnyItem*>(pItem)->GetValue();
1642 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, false, &pItem ) == SfxItemState::SET )
1644 pValue[nActProp].Name = sSuggestedSaveAsDir;
1645 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1647 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, false, &pItem ) == SfxItemState::SET )
1649 pValue[nActProp].Name = sSuggestedSaveAsName;
1650 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1652 if ( rSet.GetItemState( SID_DOC_SERVICE, false, &pItem ) == SfxItemState::SET )
1654 pValue[nActProp].Name = sDocumentService;
1655 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1657 if (rSet.HasItem(SID_FILTER_PROVIDER, &pItem))
1659 pValue[nActProp].Name = sFilterProvider;
1660 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1662 if (rSet.HasItem(SID_CONVERT_IMAGES, &pItem))
1664 pValue[nActProp].Name = sImageFilter;
1665 pValue[nActProp++].Value <<= static_cast<const SfxStringItem*>(pItem)->GetValue();
1667 if ( rSet.GetItemState( SID_LOCK_CONTENT_EXTRACTION, false, &pItem ) == SfxItemState::SET )
1669 pValue[nActProp].Name = sLockContentExtraction;
1670 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1672 if ( rSet.GetItemState( SID_LOCK_EXPORT, false, &pItem ) == SfxItemState::SET )
1674 pValue[nActProp].Name = sLockExport;
1675 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1677 if ( rSet.GetItemState( SID_LOCK_PRINT, false, &pItem ) == SfxItemState::SET )
1679 pValue[nActProp].Name = sLockPrint;
1680 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1682 if ( rSet.GetItemState( SID_LOCK_SAVE, false, &pItem ) == SfxItemState::SET )
1684 pValue[nActProp].Name = sLockSave;
1685 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue() ;
1687 if ( rSet.GetItemState( SID_LOCK_EDITDOC, false, &pItem ) == SfxItemState::SET )
1689 pValue[nActProp].Name = sLockEditDoc;
1690 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1692 if (rSet.GetItemState(SID_REPLACEABLE, false, &pItem) == SfxItemState::SET)
1694 pValue[nActProp].Name = sReplaceable;
1695 pValue[nActProp++].Value <<= static_cast<const SfxBoolItem*>(pItem)->GetValue();
1699 rArgs = aSequ;
1702 void SAL_CALL FilterOptionsContinuation::setFilterOptions(
1703 const uno::Sequence<beans::PropertyValue>& rProps )
1705 rProperties = rProps;
1708 uno::Sequence< beans::PropertyValue > SAL_CALL
1709 FilterOptionsContinuation::getFilterOptions()
1711 return rProperties;
1715 RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > const & rModel,
1716 const uno::Sequence< beans::PropertyValue >& rProperties )
1718 uno::Reference< uno::XInterface > temp2;
1719 document::FilterOptionsRequest aOptionsRequest( OUString(),
1720 temp2,
1721 rModel,
1722 rProperties );
1724 m_aRequest <<= aOptionsRequest;
1726 m_xAbort = new comphelper::OInteractionAbort;
1727 m_xOptions = new FilterOptionsContinuation;
1730 uno::Any SAL_CALL RequestFilterOptions::getRequest()
1732 return m_aRequest;
1735 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1736 SAL_CALL RequestFilterOptions::getContinuations()
1738 return { m_xAbort.get(), m_xOptions.get() };
1742 class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1744 uno::Any m_aRequest;
1745 rtl::Reference<comphelper::OInteractionApprove> m_xApprove;
1746 rtl::Reference<comphelper::OInteractionDisapprove> m_xDisapprove;
1748 public:
1749 explicit RequestPackageReparation_Impl( const OUString& aName );
1750 bool isApproved() const;
1751 virtual uno::Any SAL_CALL getRequest() override;
1752 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1755 RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aName )
1757 uno::Reference< uno::XInterface > temp2;
1758 document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1759 m_aRequest <<= aBrokenPackageRequest;
1760 m_xApprove = new comphelper::OInteractionApprove;
1761 m_xDisapprove = new comphelper::OInteractionDisapprove;
1764 bool RequestPackageReparation_Impl::isApproved() const
1766 return m_xApprove->wasSelected();
1769 uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
1771 return m_aRequest;
1774 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1775 SAL_CALL RequestPackageReparation_Impl::getContinuations()
1777 return { m_xApprove.get(), m_xDisapprove.get() };
1780 RequestPackageReparation::RequestPackageReparation( const OUString& aName )
1781 : mxImpl(new RequestPackageReparation_Impl( aName ))
1785 RequestPackageReparation::~RequestPackageReparation()
1789 bool RequestPackageReparation::isApproved() const
1791 return mxImpl->isApproved();
1794 css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest()
1796 return mxImpl.get();
1800 class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1802 uno::Any m_aRequest;
1803 rtl::Reference<comphelper::OInteractionAbort> m_xAbort;
1805 public:
1806 explicit NotifyBrokenPackage_Impl(const OUString& rName);
1807 virtual uno::Any SAL_CALL getRequest() override;
1808 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1811 NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
1813 uno::Reference< uno::XInterface > temp2;
1814 document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1815 m_aRequest <<= aBrokenPackageRequest;
1816 m_xAbort = new comphelper::OInteractionAbort;
1819 uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
1821 return m_aRequest;
1824 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1825 SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
1827 return { m_xAbort.get() };
1830 NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
1831 : mxImpl(new NotifyBrokenPackage_Impl( aName ))
1835 NotifyBrokenPackage::~NotifyBrokenPackage()
1839 css::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest()
1841 return mxImpl.get();
1844 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */