tdf#130857 qt weld: Support mail merge "Server Auth" dialog
[LibreOffice.git] / sfx2 / source / appl / appuno.cxx
blob46ca28982fec1d9bdfd6cdb8589878f3464ac0c5
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 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"SuggestedSaveAsName"_ustr, SID_DEFAULTFILENAME },
64 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"SuggestedSaveAsDir"_ustr, SID_DEFAULTFILEPATH },
65 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"VersionAuthor"_ustr, SID_DOCINFO_AUTHOR },
66 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"VersionComment"_ustr, SID_DOCINFO_COMMENTS },
67 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"DontTerminateEdit"_ustr, FN_PARAM_1 },
68 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"VersionMajor"_ustr, SID_DOCINFO_MAJOR },
69 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"FilterOptions"_ustr, SID_FILE_FILTEROPTIONS },
70 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"FilterName"_ustr, SID_FILTER_NAME },
71 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Margin1"_ustr, SID_RULER_MARGIN1 },
72 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Margin2"_ustr, SID_RULER_MARGIN2 },
73 // { static_cast<const SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
74 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"URL"_ustr, SID_FILE_NAME },
75 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"OpenFlags"_ustr, SID_OPTIONS },
76 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"Overwrite"_ustr, SID_OVERWRITE },
77 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Password"_ustr, SID_PASSWORD },
78 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"PasswordInteraction"_ustr, SID_PASSWORDINTERACTION },
79 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Referer"_ustr, SID_REFERER },
80 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"SaveTo"_ustr, SID_SAVETO },
81 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"TemplateName"_ustr, SID_TEMPLATE_NAME },
82 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"TemplateRegion"_ustr, SID_TEMPLATE_REGIONNAME },
83 // { static_cast<const SfxType*>(&aSfxStringItem_Impl), "Region", SID_TEMPLATE_REGIONNAME },
84 // { static_cast<const SfxType*>(&aSfxStringItem_Impl), "Name", SID_TEMPLATE_NAME },
85 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"Unpacked"_ustr, SID_UNPACK },
86 { static_cast<const SfxType*>(&aSfxInt16Item_Impl), u"Version"_ustr, SID_VERSION },
87 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"SaveACopy"_ustr, SID_SAVEACOPYITEM },
88 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"NoFileSync"_ustr, SID_NO_FILE_SYNC },
89 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"NoThumbnail"_ustr, SID_NO_THUMBNAIL },
90 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"NoEmbDataSet"_ustr, SID_NO_EMBEDDED_DS },
91 { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"IsRedactMode"_ustr, SID_IS_REDACT_MODE },
92 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"RedactionStyle"_ustr, SID_REDACTION_STYLE },
93 { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"AdditionsTag"_ustr, FN_PARAM_ADDITIONS_TAG },
96 sal_uInt16 const nMediaArgsCount = SAL_N_ELEMENTS(aFormalArgs);
98 constexpr OUString sTemplateRegionName = u"TemplateRegionName"_ustr;
99 constexpr OUString sTemplateName = u"TemplateName"_ustr;
100 constexpr OUString sAsTemplate = u"AsTemplate"_ustr;
101 constexpr OUString sOpenNewView = u"OpenNewView"_ustr;
102 constexpr OUString sViewId = u"ViewId"_ustr;
103 constexpr OUString sPluginMode = u"PluginMode"_ustr;
104 constexpr OUString sReadOnly = u"ReadOnly"_ustr;
105 constexpr OUString sDdeReconnect = u"DDEReconnect"_ustr;
106 constexpr OUString sStartPresentation = u"StartPresentation"_ustr;
107 constexpr OUString sFrameName = u"FrameName"_ustr;
108 constexpr OUString sMediaType = u"MediaType"_ustr;
109 constexpr OUString sPostData = u"PostData"_ustr;
110 constexpr OUString sCharacterSet = u"CharacterSet"_ustr;
111 constexpr OUString sInputStream = u"InputStream"_ustr;
112 constexpr OUString sStream = u"Stream"_ustr;
113 constexpr OUString sOutputStream = u"OutputStream"_ustr;
114 constexpr OUString sHidden = u"Hidden"_ustr;
115 constexpr OUString sPreview = u"Preview"_ustr;
116 constexpr OUString sViewOnly = u"ViewOnly"_ustr;
117 constexpr OUString sDontEdit = u"DontEdit"_ustr;
118 constexpr OUString sSilent = u"Silent"_ustr;
119 constexpr OUString sJumpMark = u"JumpMark"_ustr;
120 constexpr OUString sSalvagedFile = u"SalvagedFile"_ustr;
121 constexpr OUString sStatusInd = u"StatusIndicator"_ustr;
122 constexpr OUString sModel = u"Model"_ustr;
123 constexpr OUString sFrame = u"Frame"_ustr;
124 constexpr OUString sViewData = u"ViewData"_ustr;
125 constexpr OUString sFilterData = u"FilterData"_ustr;
126 constexpr OUString sSelectionOnly = u"SelectionOnly"_ustr;
127 constexpr OUString sMacroExecMode = u"MacroExecutionMode"_ustr;
128 constexpr OUString sUpdateDocMode = u"UpdateDocMode"_ustr;
129 constexpr OUString sMinimized = u"Minimized"_ustr;
130 constexpr OUString sInteractionHdl = u"InteractionHandler"_ustr;
131 constexpr OUString sUCBContent = u"UCBContent"_ustr;
132 constexpr OUString sRepairPackage = u"RepairPackage"_ustr;
133 constexpr OUString sDocumentTitle = u"DocumentTitle"_ustr;
134 constexpr OUString sComponentData = u"ComponentData"_ustr;
135 constexpr OUString sComponentContext = u"ComponentContext"_ustr;
136 constexpr OUString sDocumentBaseURL = u"DocumentBaseURL"_ustr;
137 constexpr OUString sHierarchicalDocumentName = u"HierarchicalDocumentName"_ustr;
138 constexpr OUString sCopyStreamIfPossible = u"CopyStreamIfPossible"_ustr;
139 constexpr OUString sNoAutoSave = u"NoAutoSave"_ustr;
140 constexpr OUString sFolderName = u"FolderName"_ustr;
141 constexpr OUString sUseSystemDialog = u"UseSystemDialog"_ustr;
142 constexpr OUString sStandardDir = u"StandardDir"_ustr;
143 constexpr OUString sDenyList = u"DenyList"_ustr;
144 constexpr OUString sModifyPasswordInfo = u"ModifyPasswordInfo"_ustr;
145 constexpr OUString sSuggestedSaveAsDir = u"SuggestedSaveAsDir"_ustr;
146 constexpr OUString sSuggestedSaveAsName = u"SuggestedSaveAsName"_ustr;
147 constexpr OUString sEncryptionData = u"EncryptionData"_ustr;
148 constexpr OUString sFailOnWarning = u"FailOnWarning"_ustr;
149 constexpr OUString sDocumentService = u"DocumentService"_ustr;
150 constexpr OUString sFilterProvider = u"FilterProvider"_ustr;
151 constexpr OUString sImageFilter = u"ImageFilter"_ustr;
152 constexpr OUString sLockContentExtraction = u"LockContentExtraction"_ustr;
153 constexpr OUString sLockExport = u"LockExport"_ustr;
154 constexpr OUString sLockPrint = u"LockPrint"_ustr;
155 constexpr OUString sLockSave = u"LockSave"_ustr;
156 constexpr OUString sLockEditDoc = u"LockEditDoc"_ustr;
157 constexpr OUString sReplaceable = u"Replaceable"_ustr;
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()->GetWhichIDFromSlotID(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 == pSlot->aUnoName )
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( std::move(pItem) );
212 else
214 SAL_WARN( "sfx", "Property not convertible: " << pSlot->aUnoName );
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 if ( rPropValue.Name == (pSlot->aUnoName + "." + pType->getAttrib(nSub).aName) )
247 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(nSub).nAID));
248 if ( bConvertTwips )
249 nSubId |= CONVERT_TWIPS;
250 if ( pItem->PutValue( rPropValue.Value, nSubId ) )
251 nFound++;
252 else
254 SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot->aUnoName);
256 break;
260 // there was a parameter with a name that didn't match to any of the members
261 SAL_WARN_IF( nSub >= nSubCount, "sfx.appl", "Property name does not match: " << rPropValue.Name );
264 // at least one part of the complex item must be present; other parts can have default values
265 if ( nFound > 0 )
266 rSet.Put( std::move(pItem) );
269 return;
272 #ifdef DBG_UTIL
273 // detect parameters that don't match to any formal argument or one of its members
274 sal_Int32 nFoundArgs = 0;
275 #endif
276 // slot is a method
277 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
278 sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
279 for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
281 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
282 std::unique_ptr<SfxPoolItem> pItem(rArg.CreateItem());
283 if ( !pItem )
285 SAL_WARN( "sfx", "No creator method for argument: " << rArg.aName );
286 return;
289 sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(rArg.nSlotId);
290 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
291 pItem->SetWhich( nWhich );
292 const SfxType* pType = rArg.pType;
293 sal_uInt16 nSubCount = pType->nAttribs;
294 if ( nSubCount == 0 )
296 // "simple" (base type) argument
297 auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
298 [&rArg](const beans::PropertyValue& rProp) { return rProp.Name == rArg.aName; });
299 if (pProp != rArgs.end())
301 #ifdef DBG_UTIL
302 ++nFoundArgs;
303 #endif
304 if( pItem->PutValue( pProp->Value, 0 ) )
305 // only use successfully converted items
306 rSet.Put( std::move(pItem) );
307 else
309 SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
313 else
315 // complex argument, could be passed in one struct
316 bool bAsWholeItem = false;
317 for ( const beans::PropertyValue& rProp : rArgs )
319 const OUString& rName = rProp.Name;
320 if ( rName == rArg.aName )
322 bAsWholeItem = true;
323 #ifdef DBG_UTIL
324 ++nFoundArgs;
325 #endif
326 if( pItem->PutValue( rProp.Value, 0 ) )
327 // only use successfully converted items
328 rSet.Put( std::move(pItem) );
329 else
331 SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
336 if ( !bAsWholeItem )
338 // complex argument; collect sub items from argument array and reconstruct complex item
339 // only put item if at least one member was found and had the correct type
340 // (is this a good idea?! Should we ask for *all* members?)
341 bool bRet = false;
342 for ( const beans::PropertyValue& rProp : rArgs )
344 for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
346 // search sub item by name
347 if ( rProp.Name == (rArg.aName + "." + pType->getAttrib(nSub).aName) )
349 // at least one member found ...
350 bRet = true;
351 #ifdef DBG_UTIL
352 ++nFoundArgs;
353 #endif
354 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(nSub).nAID));
355 if ( bConvertTwips )
356 nSubId |= CONVERT_TWIPS;
357 if (!pItem->PutValue( rProp.Value, nSubId ) )
359 // ... but it was not convertible
360 bRet = false;
361 SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
364 break;
369 if ( bRet )
370 // only use successfully converted items
371 rSet.Put( std::move(pItem) );
377 // special additional parameters for some slots not seen in the slot definitions
378 // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
379 // but as dispatching or factory or arbitrary URLs to the frame
380 // Some also can use additional arguments that are not recordable (will be changed later,
381 // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
382 if ( nSlotId == SID_NEWWINDOW )
384 for ( const beans::PropertyValue& rProp : rArgs )
386 const OUString& rName = rProp.Name;
387 if ( rName == sFrame )
389 Reference< XFrame > xFrame;
390 OSL_VERIFY( rProp.Value >>= xFrame );
391 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
393 else
394 if ( rName == sHidden )
396 bool bVal = false;
397 if (rProp.Value >>= bVal)
398 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
402 else if ( bIsMediaDescriptor )
404 for ( const beans::PropertyValue& rProp : rArgs )
406 #ifdef DBG_UTIL
407 ++nFoundArgs;
408 #endif
409 const OUString& aName = rProp.Name;
410 if ( aName == sModel )
411 rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
412 else if ( aName == sComponentData )
414 rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
416 else if ( aName == sComponentContext )
418 rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
420 else if ( aName == sStatusInd )
422 Reference<task::XStatusIndicator> xVal;
423 bool bOK = (rProp.Value >>= xVal);
424 DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
425 if (bOK && xVal.is())
426 rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
428 else if ( aName == sInteractionHdl )
430 Reference<task::XInteractionHandler> xVal;
431 bool bOK = (rProp.Value >>= xVal);
432 DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
433 if (bOK && xVal.is())
434 rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
436 else if ( aName == sViewData )
437 rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
438 else if ( aName == sFilterData )
439 rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
440 else if ( aName == sInputStream )
442 Reference< XInputStream > xVal;
443 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
444 DBG_ASSERT( bOK, "invalid type for InputStream" );
445 if (bOK)
446 rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
448 else if ( aName == sStream )
450 Reference< XInputStream > xVal;
451 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
452 DBG_ASSERT( bOK, "invalid type for Stream" );
453 if (bOK)
454 rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
456 else if ( aName == sUCBContent )
458 Reference< XContent > xVal;
459 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
460 DBG_ASSERT( bOK, "invalid type for UCBContent" );
461 if (bOK)
462 rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
464 else if ( aName == sOutputStream )
466 Reference< XOutputStream > xVal;
467 bool bOK = ((rProp.Value >>= xVal) && xVal.is());
468 DBG_ASSERT( bOK, "invalid type for OutputStream" );
469 if (bOK)
470 rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
472 else if ( aName == sPostData )
474 Reference< XInputStream > xVal;
475 bool bOK = (rProp.Value >>= xVal);
476 DBG_ASSERT( bOK, "invalid type for PostData" );
477 if (bOK)
478 rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
480 else if ( aName == sFrame )
482 Reference< XFrame > xFrame;
483 bool bOK = (rProp.Value >>= xFrame);
484 DBG_ASSERT( bOK, "invalid type for Frame" );
485 if (bOK)
486 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
488 else if ( aName == sAsTemplate )
490 bool bVal = false;
491 bool bOK = (rProp.Value >>= bVal);
492 DBG_ASSERT( bOK, "invalid type for AsTemplate" );
493 if (bOK)
494 rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
496 else if ( aName == sOpenNewView )
498 bool bVal = false;
499 bool bOK = (rProp.Value >>= bVal);
500 DBG_ASSERT( bOK, "invalid type for OpenNewView" );
501 if (bOK)
502 rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
504 else if ( aName == sFailOnWarning )
506 bool bVal = false;
507 bool bOK = (rProp.Value >>= bVal);
508 DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
509 if (bOK)
510 rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
512 else if ( aName == sViewId )
514 sal_Int16 nVal = -1;
515 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
516 DBG_ASSERT( bOK, "invalid type for ViewId" );
517 if (bOK)
518 rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
520 else if ( aName == sPluginMode )
522 sal_Int16 nVal = -1;
523 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
524 DBG_ASSERT( bOK, "invalid type for PluginMode" );
525 if (bOK)
526 rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
528 else if ( aName == sReadOnly )
530 bool bVal = false;
531 bool bOK = (rProp.Value >>= bVal);
532 DBG_ASSERT( bOK, "invalid type for ReadOnly" );
533 if (bOK)
534 rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
536 else if ( aName == sDdeReconnect )
538 bool bVal = true;
539 bool bOK = (rProp.Value >>= bVal);
540 DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
541 if (bOK)
542 rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
544 else if ( aName == sStartPresentation )
546 sal_uInt16 nVal = 0;
547 bool bOK = (rProp.Value >>= nVal);
548 DBG_ASSERT( bOK, "invalid type for StartPresentation" );
549 if (bOK)
550 rSet.Put(SfxUInt16Item(SID_DOC_STARTPRESENTATION, nVal));
552 else if ( aName == sSelectionOnly )
554 bool bVal = false;
555 bool bOK = (rProp.Value >>= bVal);
556 DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
557 if (bOK)
558 rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
560 else if ( aName == sHidden )
562 bool bVal = false;
563 bool bOK = (rProp.Value >>= bVal);
564 DBG_ASSERT( bOK, "invalid type for Hidden" );
565 if (bOK)
566 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
568 else if ( aName == sMinimized )
570 bool bVal = false;
571 bool bOK = (rProp.Value >>= bVal);
572 DBG_ASSERT( bOK, "invalid type for Minimized" );
573 if (bOK)
574 rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
576 else if ( aName == sSilent )
578 bool bVal = false;
579 bool bOK = (rProp.Value >>= bVal);
580 DBG_ASSERT( bOK, "invalid type for Silent" );
581 if (bOK)
582 rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
584 else if ( aName == sPreview )
586 bool bVal = false;
587 bool bOK = (rProp.Value >>= bVal);
588 DBG_ASSERT( bOK, "invalid type for Preview" );
589 if (bOK)
590 rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
592 else if ( aName == sViewOnly )
594 bool bVal = false;
595 bool bOK = (rProp.Value >>= bVal);
596 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
597 if (bOK)
598 rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
600 else if ( aName == sDontEdit )
602 bool bVal = false;
603 bool bOK = (rProp.Value >>= bVal);
604 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
605 if (bOK)
606 rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
608 else if ( aName == sUseSystemDialog )
610 bool bVal = false;
611 bool bOK = (rProp.Value >>= bVal);
612 DBG_ASSERT( bOK, "invalid type for ViewOnly" );
613 if (bOK)
614 rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
616 else if ( aName == sStandardDir )
618 OUString sVal;
619 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
620 DBG_ASSERT( bOK, "invalid type or value for StandardDir" );
621 if (bOK)
622 rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) );
624 else if ( aName == sDenyList )
626 uno::Sequence<OUString> xVal;
627 bool bOK = (rProp.Value >>= xVal);
628 DBG_ASSERT( bOK, "invalid type or value for DenyList" );
629 if (bOK)
631 SfxStringListItem stringList(SID_DENY_LIST);
632 stringList.SetStringList( xVal );
633 rSet.Put( stringList );
636 else if ( aName == "FileName" )
638 OUString sVal;
639 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
640 DBG_ASSERT( bOK, "invalid type or value for FileName" );
641 if (bOK)
642 rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
644 else if ( aName == sSalvagedFile )
646 OUString sVal;
647 bool bOK = (rProp.Value >>= sVal);
648 DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
649 if (bOK)
650 rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
652 else if ( aName == sFolderName )
654 OUString sVal;
655 bool bOK = (rProp.Value >>= sVal);
656 DBG_ASSERT( bOK, "invalid type or value for FolderName" );
657 if (bOK)
658 rSet.Put( SfxStringItem( SID_PATH, sVal ) );
660 else if ( aName == sFrameName )
662 OUString sVal;
663 bool bOK = (rProp.Value >>= sVal);
664 DBG_ASSERT( bOK, "invalid type for FrameName" );
665 if (bOK && !sVal.isEmpty())
666 rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
668 else if ( aName == sMediaType )
670 OUString sVal;
671 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
672 DBG_ASSERT( bOK, "invalid type or value for MediaType" );
673 if (bOK)
674 rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
676 else if ( aName == sTemplateName )
678 OUString sVal;
679 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
680 DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
681 if (bOK)
682 rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
684 else if ( aName == sTemplateRegionName )
686 OUString sVal;
687 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
688 DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
689 if (bOK)
690 rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
692 else if ( aName == sJumpMark )
694 OUString sVal;
695 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
696 DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
697 if (bOK)
698 rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
700 else if ( aName == sCharacterSet )
702 OUString sVal;
703 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
704 DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
705 if (bOK)
706 rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
708 else if ( aName == "FilterFlags" )
710 OUString sVal;
711 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
712 DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
713 if (bOK)
714 rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
716 else if ( aName == sImageFilter )
718 OUString sVal;
719 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
720 DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
721 if (bOK)
722 rSet.Put( SfxStringItem( SID_CONVERT_IMAGES, sVal ) );
724 else if ( aName == sMacroExecMode )
726 sal_Int16 nVal =-1;
727 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
728 DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
729 if (bOK)
730 rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
732 else if ( aName == sUpdateDocMode )
734 sal_Int16 nVal =-1;
735 bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
736 DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
737 if (bOK)
738 rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
740 else if ( aName == sRepairPackage )
742 bool bVal = false;
743 bool bOK = (rProp.Value >>= bVal);
744 DBG_ASSERT( bOK, "invalid type for RepairPackage" );
745 if (bOK)
746 rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
748 else if ( aName == sDocumentTitle )
750 OUString sVal;
751 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
752 DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
753 if (bOK)
754 rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
756 else if ( aName == sDocumentBaseURL )
758 OUString sVal;
759 // the base url can be set to empty ( for embedded objects for example )
760 bool bOK = (rProp.Value >>= sVal);
761 DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
762 if (bOK)
763 rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
765 else if ( aName == sHierarchicalDocumentName )
767 OUString sVal;
768 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
769 DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
770 if (bOK)
771 rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
773 else if ( aName == sCopyStreamIfPossible )
775 bool bVal = false;
776 bool bOK = (rProp.Value >>= bVal);
777 DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
778 if (bOK)
779 rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
781 else if ( aName == sNoAutoSave )
783 bool bVal = false;
784 bool bOK = (rProp.Value >>= bVal);
785 DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
786 if (bOK)
787 rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
789 else if ( aName == sModifyPasswordInfo )
791 rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
793 else if ( aName == sEncryptionData )
795 rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
797 else if ( aName == sSuggestedSaveAsDir )
799 OUString sVal;
800 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
801 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
802 if (bOK)
803 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
805 else if ( aName == sSuggestedSaveAsName )
807 OUString sVal;
808 bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
809 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
810 if (bOK)
811 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
813 else if (aName == sDocumentService)
815 OUString aVal;
816 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
817 if (bOK)
818 rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
820 else if (aName == sFilterProvider)
822 OUString aVal;
823 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
824 if (bOK)
825 rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
827 else if (aName == sLockContentExtraction)
829 bool bVal = false;
830 bool bOK = (rProp.Value >>= bVal);
831 DBG_ASSERT( bOK, "invalid type for LockContentExtraction" );
832 if (bOK)
833 rSet.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION, bVal ) );
835 else if (aName == sLockExport)
837 bool bVal = false;
838 bool bOK = (rProp.Value >>= bVal);
839 DBG_ASSERT( bOK, "invalid type for LockExport" );
840 if (bOK)
841 rSet.Put( SfxBoolItem( SID_LOCK_EXPORT, bVal ) );
843 else if (aName == sLockPrint)
845 bool bVal = false;
846 bool bOK = (rProp.Value >>= bVal);
847 DBG_ASSERT( bOK, "invalid type for LockPrint" );
848 if (bOK)
849 rSet.Put( SfxBoolItem( SID_LOCK_PRINT, bVal ) );
851 else if (aName == sLockSave)
853 bool bVal = false;
854 bool bOK = (rProp.Value >>= bVal);
855 DBG_ASSERT( bOK, "invalid type for LockSave" );
856 if (bOK)
857 rSet.Put( SfxBoolItem( SID_LOCK_SAVE, bVal ) );
859 else if (aName == sLockEditDoc)
861 bool bVal = false;
862 bool bOK = (rProp.Value >>= bVal);
863 DBG_ASSERT( bOK, "invalid type for LockEditDoc" );
864 if (bOK)
865 rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
867 else if (aName == sReplaceable)
869 bool bVal = false;
870 bool bOK = (rProp.Value >>= bVal);
871 DBG_ASSERT(bOK, "invalid type for Replaceable");
872 if (bOK)
873 rSet.Put(SfxBoolItem(SID_REPLACEABLE, bVal));
875 #ifdef DBG_UTIL
876 else
877 --nFoundArgs;
878 #endif
881 // API to raise options dialog with a specified options ab page (#i83757#)
882 else
884 // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
885 if ( "OptionsTreeDialog" == pSlot->aUnoName )
887 auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
888 [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL" || rProp.Name == "OptionsPageID"; });
889 if (pProp != rArgs.end())
891 OUString sURL;
892 sal_uInt16 nPageID;
893 if ( pProp->Name == "OptionsPageURL" && (pProp->Value >>= sURL) )
894 rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
895 else if ( pProp->Name == "OptionsPageID" && (pProp->Value >>= nPageID) )
896 rSet.Put( SfxUInt16Item( SID_OPTIONS_PAGEID, nPageID ) );
900 #ifdef DBG_UTIL
901 if ( nFoundArgs == nCount )
903 // except for the "special" slots: assure that every argument was convertible
904 SAL_INFO( "sfx.appl", "MacroPlayer: Some properties didn't match to any formal argument for slot: "<< pSlot->aUnoName );
906 #endif
909 void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
911 if ( !pSlot )
912 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
914 if ( !pSlot)
915 return;
917 if ( nSlotId == SID_OPENURL )
918 nSlotId = SID_OPENDOC;
919 if ( nSlotId == SID_SAVEASREMOTE )
920 nSlotId = SID_SAVEASDOC;
922 // find number of properties to avoid permanent reallocations in the sequence
923 sal_Int32 nProps=0;
925 #ifdef DBG_UTIL
926 // trace number of items and compare with number of properties for debugging purposes
927 sal_Int32 nItems=0;
928 #endif
930 const SfxType *pType = pSlot->GetType();
931 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
933 // slot is a property
934 sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId);
935 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
937 sal_uInt16 nSubCount = pType->nAttribs;
938 if ( nSubCount )
939 // it's a complex property, we want it split into simple types
940 // so we expect to get as many items as we have (sub) members
941 nProps = nSubCount;
942 else
943 // simple property: we expect to get exactly one item
944 nProps++;
946 else
948 // we will not rely on the "toggle" ability of some property slots
949 SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId );
952 #ifdef DBG_UTIL
953 nItems++;
954 #endif
956 else
958 // slot is a method
959 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
960 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
961 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
963 // check every formal argument of the method
964 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
966 sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID( rArg.nSlotId );
967 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
969 sal_uInt16 nSubCount = rArg.pType->nAttribs;
970 if ( nSubCount )
971 // argument has a complex type, we want it split into simple types
972 // so for this argument we expect to get as many items as we have (sub) members
973 nProps += nSubCount;
974 else
975 // argument of simple type: we expect to get exactly one item for it
976 nProps++;
977 #ifdef DBG_UTIL
978 nItems++;
979 #endif
983 // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
984 if ( bIsMediaDescriptor )
986 sal_Int32 nAdditional=0;
987 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SfxItemState::SET )
988 nAdditional++;
989 if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SfxItemState::SET )
990 nAdditional++;
991 if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SfxItemState::SET )
992 nAdditional++;
993 if ( rSet.GetItemState( SID_PATH ) == SfxItemState::SET )
994 nAdditional++;
995 if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET )
996 nAdditional++;
997 if ( rSet.GetItemState( SID_STANDARD_DIR ) == SfxItemState::SET )
998 nAdditional++;
999 if ( rSet.GetItemState( SID_DENY_LIST ) == SfxItemState::SET )
1000 nAdditional++;
1001 if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET )
1002 nAdditional++;
1003 if ( rSet.GetItemState( SID_INPUTSTREAM ) == SfxItemState::SET )
1004 nAdditional++;
1005 if ( rSet.GetItemState( SID_STREAM ) == SfxItemState::SET )
1006 nAdditional++;
1007 if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SfxItemState::SET )
1008 nAdditional++;
1009 if ( rSet.GetItemState( SID_TEMPLATE ) == SfxItemState::SET )
1010 nAdditional++;
1011 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SfxItemState::SET )
1012 nAdditional++;
1013 if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SfxItemState::SET )
1014 nAdditional++;
1015 if ( rSet.GetItemState( SID_VIEW_ID ) == SfxItemState::SET )
1016 nAdditional++;
1017 if ( rSet.GetItemState( SID_VIEW_DATA ) == SfxItemState::SET )
1018 nAdditional++;
1019 if ( rSet.GetItemState( SID_FILTER_DATA ) == SfxItemState::SET )
1020 nAdditional++;
1021 if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SfxItemState::SET )
1022 nAdditional++;
1023 if ( rSet.GetItemState( SID_DOC_READONLY ) == SfxItemState::SET )
1024 nAdditional++;
1025 if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SfxItemState::SET )
1026 nAdditional++;
1027 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SfxItemState::SET )
1028 nAdditional++;
1029 if ( rSet.GetItemState( SID_SELECTION ) == SfxItemState::SET )
1030 nAdditional++;
1031 if ( rSet.GetItemState( SID_CONTENTTYPE ) == SfxItemState::SET )
1032 nAdditional++;
1033 if ( rSet.GetItemState( SID_POSTDATA ) == SfxItemState::SET )
1034 nAdditional++;
1035 if ( rSet.GetItemState( SID_FILLFRAME ) == SfxItemState::SET )
1036 nAdditional++;
1037 if ( rSet.GetItemState( SID_CHARSET ) == SfxItemState::SET )
1038 nAdditional++;
1039 if ( rSet.GetItemState( SID_TARGETNAME ) == SfxItemState::SET )
1040 nAdditional++;
1041 if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SfxItemState::SET )
1042 nAdditional++;
1043 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SfxItemState::SET )
1044 nAdditional++;
1045 if ( rSet.GetItemState( SID_HIDDEN ) == SfxItemState::SET )
1046 nAdditional++;
1047 if ( rSet.GetItemState( SID_MINIMIZED ) == SfxItemState::SET )
1048 nAdditional++;
1049 if ( rSet.GetItemState( SID_PREVIEW ) == SfxItemState::SET )
1050 nAdditional++;
1051 if ( rSet.GetItemState( SID_VIEWONLY ) == SfxItemState::SET )
1052 nAdditional++;
1053 if ( rSet.GetItemState( SID_EDITDOC ) == SfxItemState::SET )
1054 nAdditional++;
1055 if ( rSet.GetItemState( SID_SILENT ) == SfxItemState::SET )
1056 nAdditional++;
1057 if ( rSet.GetItemState( SID_JUMPMARK ) == SfxItemState::SET )
1058 nAdditional++;
1059 if ( rSet.GetItemState( SID_DOCUMENT ) == SfxItemState::SET )
1060 nAdditional++;
1061 if ( rSet.GetItemState( SID_MACROEXECMODE ) == SfxItemState::SET )
1062 nAdditional++;
1063 if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SfxItemState::SET )
1064 nAdditional++;
1065 if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SfxItemState::SET )
1066 nAdditional++;
1067 if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SfxItemState::SET )
1068 nAdditional++;
1069 if ( rSet.GetItemState( SID_COMPONENTDATA ) == SfxItemState::SET )
1070 nAdditional++;
1071 if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SfxItemState::SET )
1072 nAdditional++;
1073 if ( rSet.GetItemState( SID_DOC_BASEURL ) == SfxItemState::SET )
1074 nAdditional++;
1075 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SfxItemState::SET )
1076 nAdditional++;
1077 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SfxItemState::SET )
1078 nAdditional++;
1079 if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SfxItemState::SET )
1080 nAdditional++;
1081 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SfxItemState::SET )
1082 nAdditional++;
1083 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SfxItemState::SET )
1084 nAdditional++;
1085 if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SfxItemState::SET )
1086 nAdditional++;
1087 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SfxItemState::SET )
1088 nAdditional++;
1089 if ( rSet.GetItemState( SID_DOC_SERVICE ) == SfxItemState::SET )
1090 nAdditional++;
1091 if (rSet.HasItem(SID_FILTER_PROVIDER))
1092 ++nAdditional;
1093 if ( rSet.GetItemState( SID_CONVERT_IMAGES ) == SfxItemState::SET )
1094 nAdditional++;
1095 if ( rSet.GetItemState( SID_LOCK_CONTENT_EXTRACTION ) == SfxItemState::SET )
1096 nAdditional++;
1097 if ( rSet.GetItemState( SID_LOCK_EXPORT ) == SfxItemState::SET )
1098 nAdditional++;
1099 if ( rSet.GetItemState( SID_LOCK_PRINT ) == SfxItemState::SET )
1100 nAdditional++;
1101 if ( rSet.GetItemState( SID_LOCK_SAVE ) == SfxItemState::SET )
1102 nAdditional++;
1103 if ( rSet.GetItemState( SID_LOCK_EDITDOC ) == SfxItemState::SET )
1104 nAdditional++;
1105 if (rSet.GetItemState(SID_REPLACEABLE) == SfxItemState::SET)
1106 nAdditional++;
1108 // consider additional arguments
1109 nProps += nAdditional;
1110 #ifdef DBG_UTIL
1111 nItems += nAdditional;
1112 #endif
1116 #ifdef DBG_UTIL
1117 // now check the itemset: is there any item that is not convertible using the list of formal arguments
1118 // or the table of additional items?!
1119 if ( rSet.Count() != nItems )
1121 // detect unknown item and present error message
1122 for ( auto const & rPair : rSet.GetRanges() )
1124 sal_uInt16 nStartWhich = rPair.first;
1125 sal_uInt16 nEndWhich = rPair.second;
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()->GetWhichIDFromSlotID( 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()->GetWhichIDFromSlotID( 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()->GetWhichIDFromSlotID(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 = pSlot->aUnoName;
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->getAttrib(n-1).nAID));
1315 if ( bConvertTwips )
1316 nSubId |= CONVERT_TWIPS;
1318 DBG_ASSERT(( pType->getAttrib(n-1).nAID ) <= 127, "Member ID out of range" );
1319 pValue[nActProp].Name = pSlot->aUnoName +
1320 "." +
1321 pType->getAttrib(n-1).aName;
1322 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1324 SAL_WARN( "sfx", "Sub item " << pType->getAttrib(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()->GetWhichIDFromSlotID( 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 = rArg.aName;
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->getAttrib(n-1).nAID));
1360 if ( bConvertTwips )
1361 nSubId |= CONVERT_TWIPS;
1363 DBG_ASSERT((rArg.pType->getAttrib(n-1).nAID) <= 127, "Member ID out of range" );
1364 pValue[nActProp].Name = rArg.aName +
1365 "." +
1366 rArg.pType->getAttrib(n-1).aName ;
1367 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1369 SAL_WARN( "sfx", "Sub item "
1370 << rArg.pType->getAttrib(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 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTDATA, false) )
1386 pValue[nActProp].Name = sComponentData;
1387 pValue[nActProp++].Value = pItem->GetValue();
1389 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTCONTEXT, false) )
1391 pValue[nActProp].Name = sComponentContext;
1392 pValue[nActProp++].Value = pItem->GetValue();
1394 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_PROGRESS_STATUSBAR_CONTROL, false) )
1396 pValue[nActProp].Name = sStatusInd;
1397 pValue[nActProp++].Value = pItem->GetValue();
1399 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INTERACTIONHANDLER, false) )
1401 pValue[nActProp].Name = sInteractionHdl;
1402 pValue[nActProp++].Value = pItem->GetValue();
1404 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_VIEW_DATA, false) )
1406 pValue[nActProp].Name = sViewData;
1407 pValue[nActProp++].Value = pItem->GetValue();
1409 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_FILTER_DATA, false) )
1411 pValue[nActProp].Name = sFilterData;
1412 pValue[nActProp++].Value = pItem->GetValue();
1414 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_DOCUMENT, false) )
1416 pValue[nActProp].Name = sModel;
1417 pValue[nActProp++].Value = pItem->GetValue();
1419 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_CONTENT, false) )
1421 pValue[nActProp].Name = sUCBContent;
1422 pValue[nActProp++].Value = pItem->GetValue();
1424 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INPUTSTREAM, false) )
1426 pValue[nActProp].Name = sInputStream;
1427 pValue[nActProp++].Value = pItem->GetValue();
1429 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_STREAM, false) )
1431 pValue[nActProp].Name = sStream;
1432 pValue[nActProp++].Value = pItem->GetValue();
1434 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_OUTPUTSTREAM, false) )
1436 pValue[nActProp].Name = sOutputStream;
1437 pValue[nActProp++].Value = pItem->GetValue();
1439 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_POSTDATA, false) )
1441 pValue[nActProp].Name = sPostData;
1442 pValue[nActProp++].Value = pItem->GetValue();
1444 if ( const SfxPoolItem *pItem = nullptr; SfxItemState::SET == rSet.GetItemState( SID_FILLFRAME, false, &pItem) )
1446 pValue[nActProp].Name = sFrame;
1447 if ( auto pUsrAnyItem = dynamic_cast< const SfxUnoAnyItem *>( pItem ) )
1449 OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUnoAnyItem is not deprecated!" );
1450 pValue[nActProp++].Value = pUsrAnyItem->GetValue();
1452 else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem *>( pItem ) )
1453 pValue[nActProp++].Value <<= pUnoFrameItem->GetFrame();
1454 else
1455 OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1457 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE, false) )
1459 pValue[nActProp].Name = sAsTemplate;
1460 pValue[nActProp++].Value <<= pItem->GetValue();
1462 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_OPEN_NEW_VIEW, false) )
1464 pValue[nActProp].Name = sOpenNewView;
1465 pValue[nActProp++].Value <<= pItem->GetValue();
1467 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FAIL_ON_WARNING, false) )
1469 pValue[nActProp].Name = sFailOnWarning;
1470 pValue[nActProp++].Value <<= pItem->GetValue();
1472 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_VIEW_ID, false) )
1474 pValue[nActProp].Name = sViewId;
1475 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1477 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_PLUGIN_MODE, false) )
1479 pValue[nActProp].Name = sPluginMode;
1480 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1482 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_READONLY, false) )
1484 pValue[nActProp].Name = sReadOnly;
1485 pValue[nActProp++].Value <<= pItem->GetValue();
1487 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DDE_RECONNECT_ONLOAD, false) )
1489 pValue[nActProp].Name = sDdeReconnect;
1490 pValue[nActProp++].Value <<= pItem->GetValue();
1492 if (const SfxUInt16Item* pItem = rSet.GetItemIfSet(SID_DOC_STARTPRESENTATION, false))
1494 pValue[nActProp].Name = sStartPresentation;
1495 pValue[nActProp++].Value <<= pItem->GetValue();
1497 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SELECTION, false) )
1499 pValue[nActProp].Name = sSelectionOnly;
1500 pValue[nActProp++].Value <<= pItem->GetValue();
1502 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_HIDDEN, false) )
1504 pValue[nActProp].Name = sHidden;
1505 pValue[nActProp++].Value <<= pItem->GetValue();
1507 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_MINIMIZED, false) )
1509 pValue[nActProp].Name = sMinimized;
1510 pValue[nActProp++].Value <<= pItem->GetValue();
1512 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SILENT, false) )
1514 pValue[nActProp].Name = sSilent;
1515 pValue[nActProp++].Value <<= pItem->GetValue();
1517 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_PREVIEW, false) )
1519 pValue[nActProp].Name = sPreview;
1520 pValue[nActProp++].Value <<= pItem->GetValue();
1522 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_VIEWONLY, false) )
1524 pValue[nActProp].Name = sViewOnly;
1525 pValue[nActProp++].Value <<= pItem->GetValue();
1527 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_EDITDOC, false) )
1529 pValue[nActProp].Name = sDontEdit;
1530 pValue[nActProp++].Value <<= !pItem->GetValue();
1532 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FILE_DIALOG, false) )
1534 pValue[nActProp].Name = sUseSystemDialog;
1535 pValue[nActProp++].Value <<= pItem->GetValue();
1537 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_STANDARD_DIR, false) )
1539 pValue[nActProp].Name = sStandardDir;
1540 pValue[nActProp++].Value <<= pItem->GetValue();
1542 if ( const SfxStringListItem *pItem = rSet.GetItemIfSet( SID_DENY_LIST, false) )
1544 pValue[nActProp].Name = sDenyList;
1546 css::uno::Sequence< OUString > aList;
1547 pItem->GetStringList( aList );
1548 pValue[nActProp++].Value <<= aList ;
1550 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TARGETNAME, false) )
1552 pValue[nActProp].Name = sFrameName;
1553 pValue[nActProp++].Value <<= pItem->GetValue();
1555 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SALVAGE, false) )
1557 pValue[nActProp].Name = sSalvagedFile;
1558 pValue[nActProp++].Value <<= pItem->GetValue();
1560 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_PATH, false) )
1562 pValue[nActProp].Name = sFolderName;
1563 pValue[nActProp++].Value <<= pItem->GetValue();
1565 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CONTENTTYPE, false) )
1567 pValue[nActProp].Name = sMediaType;
1568 pValue[nActProp++].Value <<= pItem->GetValue();
1570 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_NAME, false) )
1572 pValue[nActProp].Name = sTemplateName;
1573 pValue[nActProp++].Value <<= pItem->GetValue();
1575 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_REGIONNAME, false) )
1577 pValue[nActProp].Name = sTemplateRegionName;
1578 pValue[nActProp++].Value <<= pItem->GetValue();
1580 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_JUMPMARK, false) )
1582 pValue[nActProp].Name = sJumpMark;
1583 pValue[nActProp++].Value <<= pItem->GetValue();
1586 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CHARSET, false) )
1588 pValue[nActProp].Name = sCharacterSet;
1589 pValue[nActProp++].Value <<= pItem->GetValue();
1591 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_MACROEXECMODE, false) )
1593 pValue[nActProp].Name = sMacroExecMode;
1594 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1596 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_UPDATEDOCMODE, false) )
1598 pValue[nActProp].Name = sUpdateDocMode;
1599 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1601 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_REPAIRPACKAGE, false) )
1603 pValue[nActProp].Name = sRepairPackage;
1604 pValue[nActProp++].Value <<= pItem->GetValue() ;
1606 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOCINFO_TITLE, false) )
1608 pValue[nActProp].Name = sDocumentTitle;
1609 pValue[nActProp++].Value <<= pItem->GetValue();
1611 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_BASEURL, false) )
1613 pValue[nActProp].Name = sDocumentBaseURL;
1614 pValue[nActProp++].Value <<= pItem->GetValue();
1616 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_HIERARCHICALNAME, false) )
1618 pValue[nActProp].Name = sHierarchicalDocumentName;
1619 pValue[nActProp++].Value <<= pItem->GetValue();
1621 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_COPY_STREAM_IF_POSSIBLE, false) )
1623 pValue[nActProp].Name = sCopyStreamIfPossible;
1624 pValue[nActProp++].Value <<= pItem->GetValue();
1626 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_NOAUTOSAVE, false) )
1628 pValue[nActProp].Name = sNoAutoSave;
1629 pValue[nActProp++].Value <<= pItem->GetValue() ;
1631 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_MODIFYPASSWORDINFO, false) )
1633 pValue[nActProp].Name = sModifyPasswordInfo;
1634 pValue[nActProp++].Value = pItem->GetValue();
1636 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_ENCRYPTIONDATA, false) )
1638 pValue[nActProp].Name = sEncryptionData;
1639 pValue[nActProp++].Value = pItem->GetValue();
1641 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASDIR, false) )
1643 pValue[nActProp].Name = sSuggestedSaveAsDir;
1644 pValue[nActProp++].Value <<= pItem->GetValue();
1646 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASNAME, false) )
1648 pValue[nActProp].Name = sSuggestedSaveAsName;
1649 pValue[nActProp++].Value <<= pItem->GetValue();
1651 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SERVICE, false) )
1653 pValue[nActProp].Name = sDocumentService;
1654 pValue[nActProp++].Value <<= pItem->GetValue();
1656 if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_FILTER_PROVIDER))
1658 pValue[nActProp].Name = sFilterProvider;
1659 pValue[nActProp++].Value <<= pItem->GetValue();
1661 if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_CONVERT_IMAGES))
1663 pValue[nActProp].Name = sImageFilter;
1664 pValue[nActProp++].Value <<= pItem->GetValue();
1666 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_CONTENT_EXTRACTION, false) )
1668 pValue[nActProp].Name = sLockContentExtraction;
1669 pValue[nActProp++].Value <<= pItem->GetValue() ;
1671 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EXPORT, false) )
1673 pValue[nActProp].Name = sLockExport;
1674 pValue[nActProp++].Value <<= pItem->GetValue() ;
1676 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_PRINT, false) )
1678 pValue[nActProp].Name = sLockPrint;
1679 pValue[nActProp++].Value <<= pItem->GetValue() ;
1681 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_SAVE, false) )
1683 pValue[nActProp].Name = sLockSave;
1684 pValue[nActProp++].Value <<= pItem->GetValue() ;
1686 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EDITDOC, false) )
1688 pValue[nActProp].Name = sLockEditDoc;
1689 pValue[nActProp++].Value <<= pItem->GetValue();
1691 if (const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_REPLACEABLE, false))
1693 pValue[nActProp].Name = sReplaceable;
1694 pValue[nActProp++].Value <<= pItem->GetValue();
1698 rArgs = std::move(aSequ);
1701 void SAL_CALL FilterOptionsContinuation::setFilterOptions(
1702 const uno::Sequence<beans::PropertyValue>& rProps )
1704 rProperties = rProps;
1707 uno::Sequence< beans::PropertyValue > SAL_CALL
1708 FilterOptionsContinuation::getFilterOptions()
1710 return rProperties;
1714 RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > const & rModel,
1715 const uno::Sequence< beans::PropertyValue >& rProperties )
1717 uno::Reference< uno::XInterface > temp2;
1718 document::FilterOptionsRequest aOptionsRequest( OUString(),
1719 temp2,
1720 rModel,
1721 rProperties );
1723 m_aRequest <<= aOptionsRequest;
1725 m_xAbort = new comphelper::OInteractionAbort;
1726 m_xOptions = new FilterOptionsContinuation;
1729 uno::Any SAL_CALL RequestFilterOptions::getRequest()
1731 return m_aRequest;
1734 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1735 SAL_CALL RequestFilterOptions::getContinuations()
1737 return { m_xAbort, m_xOptions };
1741 class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1743 uno::Any m_aRequest;
1744 rtl::Reference<comphelper::OInteractionApprove> m_xApprove;
1745 rtl::Reference<comphelper::OInteractionDisapprove> m_xDisapprove;
1747 public:
1748 explicit RequestPackageReparation_Impl( const OUString& aName );
1749 bool isApproved() const;
1750 virtual uno::Any SAL_CALL getRequest() override;
1751 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1754 RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aName )
1756 uno::Reference< uno::XInterface > temp2;
1757 document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1758 m_aRequest <<= aBrokenPackageRequest;
1759 m_xApprove = new comphelper::OInteractionApprove;
1760 m_xDisapprove = new comphelper::OInteractionDisapprove;
1763 bool RequestPackageReparation_Impl::isApproved() const
1765 return m_xApprove->wasSelected();
1768 uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
1770 return m_aRequest;
1773 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1774 SAL_CALL RequestPackageReparation_Impl::getContinuations()
1776 return { m_xApprove, m_xDisapprove };
1779 RequestPackageReparation::RequestPackageReparation( const OUString& aName )
1780 : mxImpl(new RequestPackageReparation_Impl( aName ))
1784 RequestPackageReparation::~RequestPackageReparation()
1788 bool RequestPackageReparation::isApproved() const
1790 return mxImpl->isApproved();
1793 css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest() const
1795 return mxImpl;
1799 class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1801 uno::Any m_aRequest;
1802 rtl::Reference<comphelper::OInteractionAbort> m_xAbort;
1804 public:
1805 explicit NotifyBrokenPackage_Impl(const OUString& rName);
1806 virtual uno::Any SAL_CALL getRequest() override;
1807 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1810 NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
1812 uno::Reference< uno::XInterface > temp2;
1813 document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1814 m_aRequest <<= aBrokenPackageRequest;
1815 m_xAbort = new comphelper::OInteractionAbort;
1818 uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
1820 return m_aRequest;
1823 uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1824 SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
1826 return { m_xAbort };
1829 NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
1830 : mxImpl(new NotifyBrokenPackage_Impl( aName ))
1834 NotifyBrokenPackage::~NotifyBrokenPackage()
1838 css::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest() const
1840 return mxImpl;
1843 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */