LibreOffice Module sfx2 (master) 1
appuno.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <fltoptint.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>
29
30#include <sal/config.h>
31#include <sal/log.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>
41
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>
51
52#include <memory>
53
54using namespace ::com::sun::star;
55using namespace ::com::sun::star::ucb;
56using namespace ::com::sun::star::uno;
57using namespace ::com::sun::star::frame;
58using namespace ::com::sun::star::beans;
59using namespace ::com::sun::star::io;
60
61// needs to be converted to a better data structure
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", FN_PARAM_ADDITIONS_TAG },
94};
95
97
98constexpr OUStringLiteral sTemplateRegionName = u"TemplateRegionName";
99constexpr OUStringLiteral sTemplateName = u"TemplateName";
100constexpr OUStringLiteral sAsTemplate = u"AsTemplate";
101constexpr OUStringLiteral sOpenNewView = u"OpenNewView";
102constexpr OUStringLiteral sViewId = u"ViewId";
103constexpr OUStringLiteral sPluginMode = u"PluginMode";
104constexpr OUStringLiteral sReadOnly = u"ReadOnly";
105constexpr OUStringLiteral sDdeReconnect = u"DDEReconnect";
106constexpr OUStringLiteral sStartPresentation = u"StartPresentation";
107constexpr OUStringLiteral sFrameName = u"FrameName";
108constexpr OUStringLiteral sMediaType = u"MediaType";
109constexpr OUStringLiteral sPostData = u"PostData";
110constexpr OUStringLiteral sCharacterSet = u"CharacterSet";
111constexpr OUStringLiteral sInputStream = u"InputStream";
112constexpr OUStringLiteral sStream = u"Stream";
113constexpr OUStringLiteral sOutputStream = u"OutputStream";
114constexpr OUStringLiteral sHidden = u"Hidden";
115constexpr OUStringLiteral sPreview = u"Preview";
116constexpr OUStringLiteral sViewOnly = u"ViewOnly";
117constexpr OUStringLiteral sDontEdit = u"DontEdit";
118constexpr OUStringLiteral sSilent = u"Silent";
119constexpr OUStringLiteral sJumpMark = u"JumpMark";
120constexpr OUStringLiteral sSalvagedFile = u"SalvagedFile";
121constexpr OUStringLiteral sStatusInd = u"StatusIndicator";
122constexpr OUStringLiteral sModel = u"Model";
123constexpr OUStringLiteral sFrame = u"Frame";
124constexpr OUStringLiteral sViewData = u"ViewData";
125constexpr OUStringLiteral sFilterData = u"FilterData";
126constexpr OUStringLiteral sSelectionOnly = u"SelectionOnly";
127constexpr OUStringLiteral sMacroExecMode = u"MacroExecutionMode";
128constexpr OUStringLiteral sUpdateDocMode = u"UpdateDocMode";
129constexpr OUStringLiteral sMinimized = u"Minimized";
130constexpr OUStringLiteral sInteractionHdl = u"InteractionHandler";
131constexpr OUStringLiteral sUCBContent = u"UCBContent";
132constexpr OUStringLiteral sRepairPackage = u"RepairPackage";
133constexpr OUStringLiteral sDocumentTitle = u"DocumentTitle";
134constexpr OUStringLiteral sComponentData = u"ComponentData";
135constexpr OUStringLiteral sComponentContext = u"ComponentContext";
136constexpr OUStringLiteral sDocumentBaseURL = u"DocumentBaseURL";
137constexpr OUStringLiteral sHierarchicalDocumentName = u"HierarchicalDocumentName";
138constexpr OUStringLiteral sCopyStreamIfPossible = u"CopyStreamIfPossible";
139constexpr OUStringLiteral sNoAutoSave = u"NoAutoSave";
140constexpr OUStringLiteral sFolderName = u"FolderName";
141constexpr OUStringLiteral sUseSystemDialog = u"UseSystemDialog";
142constexpr OUStringLiteral sStandardDir = u"StandardDir";
143constexpr OUStringLiteral sDenyList = u"DenyList";
144constexpr OUStringLiteral sModifyPasswordInfo = u"ModifyPasswordInfo";
145constexpr OUStringLiteral sSuggestedSaveAsDir = u"SuggestedSaveAsDir";
146constexpr OUStringLiteral sSuggestedSaveAsName = u"SuggestedSaveAsName";
147constexpr OUStringLiteral sEncryptionData = u"EncryptionData";
148constexpr OUStringLiteral sFailOnWarning = u"FailOnWarning";
149constexpr OUStringLiteral sDocumentService = u"DocumentService";
150constexpr OUStringLiteral sFilterProvider = u"FilterProvider";
151constexpr OUStringLiteral sImageFilter = u"ImageFilter";
152constexpr OUStringLiteral sLockContentExtraction = u"LockContentExtraction";
153constexpr OUStringLiteral sLockExport = u"LockExport";
154constexpr OUStringLiteral sLockPrint = u"LockPrint";
155constexpr OUStringLiteral sLockSave = u"LockSave";
156constexpr OUStringLiteral sLockEditDoc = u"LockEditDoc";
157constexpr OUStringLiteral sReplaceable = u"Replaceable";
158
159static bool isMediaDescriptor( sal_uInt16 nSlotId )
160{
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);
168}
169
170void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
171{
172 if ( !pSlot )
173 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
174
175 if ( !pSlot )
176 return;
177
178 if ( nSlotId == SID_OPENURL )
179 nSlotId = SID_OPENDOC;
180
181 const sal_Int32 nCount = rArgs.getLength();
182 if ( !nCount )
183 return;
184
185 const beans::PropertyValue* pPropsVal = rArgs.getConstArray();
186 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
187 {
188 // slot is a property
189 const SfxType* pType = pSlot->GetType();
190 std::unique_ptr<SfxPoolItem> pItem(pType->CreateItem());
191
192 if ( !pItem )
193 {
194 SAL_WARN( "sfx", "No creator method for item: " << nSlotId );
195 return;
196 }
197
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;
202
203 const beans::PropertyValue& rProp = pPropsVal[0];
204 const OUString& rName = rProp.Name;
205 if ( nCount == 1 && rName == pSlot->pUnoName )
206 {
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
213 {
214 SAL_WARN( "sfx", "Property not convertible: " << pSlot->pUnoName );
215 }
216 }
217#ifdef DBG_UTIL
218 else if ( nSubCount == 0 )
219 {
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);
222 }
223#endif
224 else
225 {
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 )
233 {
234 SAL_INFO("sfx.appl", "MacroPlayer: wrong number of parameters for slot: " << nSlotId );
235 }
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 )
240 {
241 sal_uInt16 nSub;
242 for ( nSub=0; nSub<nSubCount; nSub++ )
243 {
244 // search sub item by name
245 OUString aStr = pSlot->pUnoName + "." + OUString::createFromAscii(pType->aAttrib[nSub].pName);
246 if ( rPropValue.Name == aStr )
247 {
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
254 {
255 SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot->pUnoName);
256 }
257 break;
258 }
259 }
260
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 );
263 }
264
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( std::move(pItem) );
268 }
269
270 return;
271 }
272
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++ )
281 {
282 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
283 std::unique_ptr<SfxPoolItem> pItem(rArg.CreateItem());
284 if ( !pItem )
285 {
286 SAL_WARN( "sfx", "No creator method for argument: " << rArg.pName );
287 return;
288 }
289
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 )
296 {
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())
301 {
302#ifdef DBG_UTIL
303 ++nFoundArgs;
304#endif
305 if( pItem->PutValue( pProp->Value, 0 ) )
306 // only use successfully converted items
307 rSet.Put( std::move(pItem) );
308 else
309 {
310 SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
311 }
312 }
313 }
314 else
315 {
316 // complex argument, could be passed in one struct
317 bool bAsWholeItem = false;
318 for ( const beans::PropertyValue& rProp : rArgs )
319 {
320 const OUString& rName = rProp.Name;
321 if ( rName == OUString(rArg.pName, strlen(rArg.pName), RTL_TEXTENCODING_UTF8) )
322 {
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( std::move(pItem) );
330 else
331 {
332 SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
333 }
334 }
335 }
336
337 if ( !bAsWholeItem )
338 {
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 )
344 {
345 for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
346 {
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()) )
350 {
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 ) )
360 {
361 // ... but it was not convertible
362 bRet = false;
363 SAL_WARN( "sfx", "Property not convertible: " << rArg.pName );
364 }
365
366 break;
367 }
368 }
369 }
370
371 if ( bRet )
372 // only use successfully converted items
373 rSet.Put( std::move(pItem) );
374
375 }
376 }
377 }
378
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 )
385 {
386 for ( const beans::PropertyValue& rProp : rArgs )
387 {
388 const OUString& rName = rProp.Name;
389 if ( rName == sFrame )
390 {
391 Reference< XFrame > xFrame;
392 OSL_VERIFY( rProp.Value >>= xFrame );
393 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
394 }
395 else
396 if ( rName == sHidden )
397 {
398 bool bVal = false;
399 if (rProp.Value >>= bVal)
400 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
401 }
402 }
403 }
404 else if ( bIsMediaDescriptor )
405 {
406 for ( const beans::PropertyValue& rProp : rArgs )
407 {
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 )
415 {
416 rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
417 }
418 else if ( aName == sComponentContext )
419 {
420 rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
421 }
422 else if ( aName == sStatusInd )
423 {
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 ) );
429 }
430 else if ( aName == sInteractionHdl )
431 {
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 ) );
437 }
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 )
443 {
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 ) );
449 }
450 else if ( aName == sStream )
451 {
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 ) );
457 }
458 else if ( aName == sUCBContent )
459 {
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 ) );
465 }
466 else if ( aName == sOutputStream )
467 {
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 ) );
473 }
474 else if ( aName == sPostData )
475 {
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 ) );
481 }
482 else if ( aName == sFrame )
483 {
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 ) );
489 }
490 else if ( aName == sAsTemplate )
491 {
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 ) );
497 }
498 else if ( aName == sOpenNewView )
499 {
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 ) );
505 }
506 else if ( aName == sFailOnWarning )
507 {
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 ) );
513 }
514 else if ( aName == sViewId )
515 {
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 ) );
521 }
522 else if ( aName == sPluginMode )
523 {
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 ) );
529 }
530 else if ( aName == sReadOnly )
531 {
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 ) );
537 }
538 else if ( aName == sDdeReconnect )
539 {
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 ) );
545 }
546 else if ( aName == sStartPresentation )
547 {
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 ) );
553 }
554 else if ( aName == sSelectionOnly )
555 {
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 ) );
561 }
562 else if ( aName == sHidden )
563 {
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 ) );
569 }
570 else if ( aName == sMinimized )
571 {
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 ) );
577 }
578 else if ( aName == sSilent )
579 {
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 ) );
585 }
586 else if ( aName == sPreview )
587 {
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 ) );
593 }
594 else if ( aName == sViewOnly )
595 {
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 ) );
601 }
602 else if ( aName == sDontEdit )
603 {
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 ) );
609 }
610 else if ( aName == sUseSystemDialog )
611 {
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 ) );
617 }
618 else if ( aName == sStandardDir )
619 {
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 ) );
625 }
626 else if ( aName == sDenyList )
627 {
628 uno::Sequence<OUString> xVal;
629 bool bOK = (rProp.Value >>= xVal);
630 DBG_ASSERT( bOK, "invalid type or value for DenyList" );
631 if (bOK)
632 {
633 SfxStringListItem stringList(SID_DENY_LIST);
634 stringList.SetStringList( xVal );
635 rSet.Put( stringList );
636 }
637 }
638 else if ( aName == "FileName" )
639 {
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 ) );
645 }
646 else if ( aName == sSalvagedFile )
647 {
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 ) );
653 }
654 else if ( aName == sFolderName )
655 {
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 ) );
661 }
662 else if ( aName == sFrameName )
663 {
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 ) );
669 }
670 else if ( aName == sMediaType )
671 {
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 ) );
677 }
678 else if ( aName == sTemplateName )
679 {
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 ) );
685 }
686 else if ( aName == sTemplateRegionName )
687 {
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 ) );
693 }
694 else if ( aName == sJumpMark )
695 {
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 ) );
701 }
702 else if ( aName == sCharacterSet )
703 {
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 ) );
709 }
710 else if ( aName == "FilterFlags" )
711 {
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 ) );
717 }
718 else if ( aName == sImageFilter )
719 {
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 ) );
725 }
726 else if ( aName == sMacroExecMode )
727 {
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 ) );
733 }
734 else if ( aName == sUpdateDocMode )
735 {
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 ) );
741 }
742 else if ( aName == sRepairPackage )
743 {
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 ) );
749 }
750 else if ( aName == sDocumentTitle )
751 {
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 ) );
757 }
758 else if ( aName == sDocumentBaseURL )
759 {
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 ) );
766 }
767 else if ( aName == sHierarchicalDocumentName )
768 {
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 ) );
774 }
775 else if ( aName == sCopyStreamIfPossible )
776 {
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 ) );
782 }
783 else if ( aName == sNoAutoSave )
784 {
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 ) );
790 }
791 else if ( aName == sModifyPasswordInfo )
792 {
793 rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
794 }
795 else if ( aName == sEncryptionData )
796 {
797 rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
798 }
799 else if ( aName == sSuggestedSaveAsDir )
800 {
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 ) );
806 }
807 else if ( aName == sSuggestedSaveAsName )
808 {
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 ) );
814 }
815 else if (aName == sDocumentService)
816 {
817 OUString aVal;
818 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
819 if (bOK)
820 rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
821 }
822 else if (aName == sFilterProvider)
823 {
824 OUString aVal;
825 bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
826 if (bOK)
827 rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
828 }
829 else if (aName == sLockContentExtraction)
830 {
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 ) );
836 }
837 else if (aName == sLockExport)
838 {
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 ) );
844 }
845 else if (aName == sLockPrint)
846 {
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 ) );
852 }
853 else if (aName == sLockSave)
854 {
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 ) );
860 }
861 else if (aName == sLockEditDoc)
862 {
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 ) );
868 }
869 else if (aName == sReplaceable)
870 {
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));
876 }
877#ifdef DBG_UTIL
878 else
879 --nFoundArgs;
880#endif
881 }
882 }
883 // API to raise options dialog with a specified options ab page (#i83757#)
884 else
885 {
886 // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
887 if ( "OptionsTreeDialog" == pSlot->pUnoName )
888 {
889 auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
890 [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL"; });
891 if (pProp != rArgs.end())
892 {
893 OUString sURL;
894 if ( pProp->Value >>= sURL )
895 rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
896 }
897 }
898 }
899#ifdef DBG_UTIL
900 if ( nFoundArgs == nCount )
901 {
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 );
904 }
905#endif
906}
907
908void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, uno::Sequence<beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
909{
910 if ( !pSlot )
911 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
912
913 if ( !pSlot)
914 return;
915
916 if ( nSlotId == SID_OPENURL )
917 nSlotId = SID_OPENDOC;
918 if ( nSlotId == SID_SAVEASREMOTE )
919 nSlotId = SID_SAVEASDOC;
920
921 // find number of properties to avoid permanent reallocations in the sequence
922 sal_Int32 nProps=0;
923
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
928
929 const SfxType *pType = pSlot->GetType();
930 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
931 {
932 // slot is a property
933 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
934 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
935 {
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++;
944 }
945 else
946 {
947 // we will not rely on the "toggle" ability of some property slots
948 SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId );
949 }
950
951#ifdef DBG_UTIL
952 nItems++;
953#endif
954 }
955 else
956 {
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 )
961 {
962 // check every formal argument of the method
963 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
964
965 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
966 if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
967 {
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
979 }
980 }
981
982 // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
983 if ( bIsMediaDescriptor )
984 {
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++;
1106
1107 // consider additional arguments
1108 nProps += nAdditional;
1109#ifdef DBG_UTIL
1110 nItems += nAdditional;
1111#endif
1112 }
1113 }
1114
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 )
1119 {
1120 // detect unknown item and present error message
1121 for ( auto const & rPair : rSet.GetRanges() )
1122 {
1123 sal_uInt16 nStartWhich = rPair.first;
1124 sal_uInt16 nEndWhich = rPair.second;
1125 for(sal_uInt16 nId = nStartWhich; nId <= nEndWhich; ++nId)
1126 {
1127 if ( rSet.GetItemState(nId) < SfxItemState::SET ) //???
1128 // not really set
1129 continue;
1130
1131 if ( !pSlot->IsMode(SfxSlotMode::METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) )
1132 continue;
1133
1134 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1135 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
1136 sal_uInt16 nArg;
1137 for ( nArg=0; nArg<nFormalArgs; ++nArg )
1138 {
1139 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
1140 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1141 if ( nId == nWhich )
1142 break;
1143 }
1144
1145 if ( nArg<nFormalArgs )
1146 continue;
1147
1148 if ( bIsMediaDescriptor )
1149 {
1150 if ( nId == SID_DOCFRAME )
1151 continue;
1152 if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
1153 continue;
1154 if ( nId == SID_INTERACTIONHANDLER )
1155 continue;
1156 if ( nId == SID_VIEW_DATA )
1157 continue;
1158 if ( nId == SID_FILTER_DATA )
1159 continue;
1160 if ( nId == SID_DOCUMENT )
1161 continue;
1162 if ( nId == SID_CONTENT )
1163 continue;
1164 if ( nId == SID_INPUTSTREAM )
1165 continue;
1166 if ( nId == SID_STREAM )
1167 continue;
1168 if ( nId == SID_OUTPUTSTREAM )
1169 continue;
1170 if ( nId == SID_POSTDATA )
1171 continue;
1172 if ( nId == SID_FILLFRAME )
1173 continue;
1174 if ( nId == SID_TEMPLATE )
1175 continue;
1176 if ( nId == SID_OPEN_NEW_VIEW )
1177 continue;
1178 if ( nId == SID_VIEW_ID )
1179 continue;
1180 if ( nId == SID_PLUGIN_MODE )
1181 continue;
1182 if ( nId == SID_DOC_READONLY )
1183 continue;
1184 if ( nId == SID_DOC_STARTPRESENTATION )
1185 continue;
1186 if ( nId == SID_SELECTION )
1187 continue;
1188 if ( nId == SID_HIDDEN )
1189 continue;
1190 if ( nId == SID_MINIMIZED )
1191 continue;
1192 if ( nId == SID_SILENT )
1193 continue;
1194 if ( nId == SID_PREVIEW )
1195 continue;
1196 if ( nId == SID_VIEWONLY )
1197 continue;
1198 if ( nId == SID_EDITDOC )
1199 continue;
1200 if ( nId == SID_TARGETNAME )
1201 continue;
1202 if ( nId == SID_DOC_SALVAGE )
1203 continue;
1204 if ( nId == SID_PATH )
1205 continue;
1206 if ( nId == SID_FILE_DIALOG )
1207 continue;
1208 if ( nId == SID_STANDARD_DIR )
1209 continue;
1210 if ( nId == SID_DENY_LIST )
1211 continue;
1212 if ( nId == SID_CONTENTTYPE )
1213 continue;
1214 if ( nId == SID_TEMPLATE_NAME )
1215 continue;
1216 if ( nId == SID_TEMPLATE_REGIONNAME )
1217 continue;
1218 if ( nId == SID_JUMPMARK )
1219 continue;
1220 if ( nId == SID_CHARSET )
1221 continue;
1222 if ( nId == SID_MACROEXECMODE )
1223 continue;
1224 if ( nId == SID_UPDATEDOCMODE )
1225 continue;
1226 if ( nId == SID_REPAIRPACKAGE )
1227 continue;
1228 if ( nId == SID_DOCINFO_TITLE )
1229 continue;
1230 if ( nId == SID_COMPONENTDATA )
1231 continue;
1232 if ( nId == SID_COMPONENTCONTEXT )
1233 continue;
1234 if ( nId == SID_DOC_BASEURL )
1235 continue;
1236 if ( nId == SID_DOC_HIERARCHICALNAME )
1237 continue;
1238 if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
1239 continue;
1240 if ( nId == SID_NOAUTOSAVE )
1241 continue;
1242 if ( nId == SID_ENCRYPTIONDATA )
1243 continue;
1244 if ( nId == SID_DOC_SERVICE )
1245 continue;
1246 if (nId == SID_FILTER_PROVIDER)
1247 continue;
1248 if ( nId == SID_CONVERT_IMAGES )
1249 continue;
1250
1251 // used only internally
1252 if ( nId == SID_SAVETO )
1253 continue;
1254 if ( nId == SID_SAVEACOPYITEM )
1255 continue;
1256 if ( nId == SID_MODIFYPASSWORDINFO )
1257 continue;
1258 if ( nId == SID_SUGGESTEDSAVEASDIR )
1259 continue;
1260 if ( nId == SID_SUGGESTEDSAVEASNAME )
1261 continue;
1262 if ( nId == SID_LOCK_CONTENT_EXTRACTION )
1263 continue;
1264 if ( nId == SID_LOCK_EXPORT )
1265 continue;
1266 if ( nId == SID_LOCK_PRINT )
1267 continue;
1268 if ( nId == SID_LOCK_SAVE )
1269 continue;
1270 if ( nId == SID_LOCK_EDITDOC )
1271 continue;
1272 if (nId == SID_REPLACEABLE)
1273 continue;
1274 }
1275
1276 OString aDbg = "Unknown item detected: " + OString::number(static_cast<sal_Int32>(nId));
1277 DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
1278 }
1279 }
1280 }
1281#endif
1282
1283 if ( !nProps )
1284 return;
1285
1286 // convert every item into a property
1287 uno::Sequence<beans::PropertyValue> aSequ(nProps);
1288 beans::PropertyValue *pValue = aSequ.getArray();
1289
1290 sal_Int32 nActProp=0;
1291 if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
1292 {
1293 // slot is a property
1294 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId);
1295 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
1296 const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
1297 if ( pItem ) //???
1298 {
1299 sal_uInt16 nSubCount = pType->nAttribs;
1300 if ( !nSubCount )
1301 {
1302 pValue[nActProp].Name = pSlot->pUnoName;
1303 if ( !pItem->QueryValue( pValue[nActProp].Value ) )
1304 {
1305 SAL_WARN( "sfx", "Item not convertible: " << nSlotId );
1306 }
1307 }
1308 else
1309 {
1310 // complex type, add a property value for every member of the struct
1311 for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1312 {
1313 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[n-1].nAID));
1314 if ( bConvertTwips )
1315 nSubId |= CONVERT_TWIPS;
1316
1317 DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" );
1318 pValue[nActProp].Name = pSlot->pUnoName +
1319 "." +
1320 OUString::createFromAscii( pType->aAttrib[n-1].pName );
1321 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1322 {
1323 SAL_WARN( "sfx", "Sub item " << pType->aAttrib[n-1].nAID
1324 << " not convertible in slot: " << nSlotId );
1325 }
1326 }
1327 }
1328 }
1329
1330 rArgs = aSequ;
1331 return;
1332 }
1333
1334 // slot is a method
1335 sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1336 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1337 {
1338 const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1339 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId );
1340 bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
1341 const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
1342 if ( pItem ) //???
1343 {
1344 sal_uInt16 nSubCount = rArg.pType->nAttribs;
1345 if ( !nSubCount )
1346 {
1347 pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) ;
1348 if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
1349 {
1350 SAL_WARN( "sfx", "Item not convertible: " << rArg.nSlotId );
1351 }
1352 }
1353 else
1354 {
1355 // complex type, add a property value for every member of the struct
1356 for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1357 {
1358 sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(rArg.pType->aAttrib[n-1].nAID));
1359 if ( bConvertTwips )
1360 nSubId |= CONVERT_TWIPS;
1361
1362 DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" );
1363 pValue[nActProp].Name = OUString::createFromAscii( rArg.pName ) +
1364 "." +
1365 OUString::createFromAscii( rArg.pType->aAttrib[n-1].pName ) ;
1366 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) )
1367 {
1368 SAL_WARN( "sfx", "Sub item "
1369 << rArg.pType->aAttrib[n-1].nAID
1370 << " not convertible in slot: "
1371 << rArg.nSlotId );
1372 }
1373 }
1374 }
1375 }
1376 }
1377
1378 if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
1379 nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
1380 nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
1381 nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC || nSlotId == SID_SAVEACOPY )
1382 {
1383 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTDATA, false) )
1384 {
1385 pValue[nActProp].Name = sComponentData;
1386 pValue[nActProp++].Value = pItem->GetValue();
1387 }
1388 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTCONTEXT, false) )
1389 {
1390 pValue[nActProp].Name = sComponentContext;
1391 pValue[nActProp++].Value = pItem->GetValue();
1392 }
1393 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_PROGRESS_STATUSBAR_CONTROL, false) )
1394 {
1395 pValue[nActProp].Name = sStatusInd;
1396 pValue[nActProp++].Value = pItem->GetValue();
1397 }
1398 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INTERACTIONHANDLER, false) )
1399 {
1400 pValue[nActProp].Name = sInteractionHdl;
1401 pValue[nActProp++].Value = pItem->GetValue();
1402 }
1403 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_VIEW_DATA, false) )
1404 {
1405 pValue[nActProp].Name = sViewData;
1406 pValue[nActProp++].Value = pItem->GetValue();
1407 }
1408 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_FILTER_DATA, false) )
1409 {
1410 pValue[nActProp].Name = sFilterData;
1411 pValue[nActProp++].Value = pItem->GetValue();
1412 }
1413 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_DOCUMENT, false) )
1414 {
1415 pValue[nActProp].Name = sModel;
1416 pValue[nActProp++].Value = pItem->GetValue();
1417 }
1418 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_CONTENT, false) )
1419 {
1420 pValue[nActProp].Name = sUCBContent;
1421 pValue[nActProp++].Value = pItem->GetValue();
1422 }
1423 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INPUTSTREAM, false) )
1424 {
1425 pValue[nActProp].Name = sInputStream;
1426 pValue[nActProp++].Value = pItem->GetValue();
1427 }
1428 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_STREAM, false) )
1429 {
1430 pValue[nActProp].Name = sStream;
1431 pValue[nActProp++].Value = pItem->GetValue();
1432 }
1433 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_OUTPUTSTREAM, false) )
1434 {
1435 pValue[nActProp].Name = sOutputStream;
1436 pValue[nActProp++].Value = pItem->GetValue();
1437 }
1438 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_POSTDATA, false) )
1439 {
1440 pValue[nActProp].Name = sPostData;
1441 pValue[nActProp++].Value = pItem->GetValue();
1442 }
1443 if ( const SfxPoolItem *pItem = nullptr; SfxItemState::SET == rSet.GetItemState( SID_FILLFRAME, false, &pItem) )
1444 {
1445 pValue[nActProp].Name = sFrame;
1446 if ( auto pUsrAnyItem = dynamic_cast< const SfxUnoAnyItem *>( pItem ) )
1447 {
1448 OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUnoAnyItem is not deprecated!" );
1449 pValue[nActProp++].Value = pUsrAnyItem->GetValue();
1450 }
1451 else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem *>( pItem ) )
1452 pValue[nActProp++].Value <<= pUnoFrameItem->GetFrame();
1453 else
1454 OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1455 }
1456 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE, false) )
1457 {
1458 pValue[nActProp].Name = sAsTemplate;
1459 pValue[nActProp++].Value <<= pItem->GetValue();
1460 }
1461 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_OPEN_NEW_VIEW, false) )
1462 {
1463 pValue[nActProp].Name = sOpenNewView;
1464 pValue[nActProp++].Value <<= pItem->GetValue();
1465 }
1466 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FAIL_ON_WARNING, false) )
1467 {
1468 pValue[nActProp].Name = sFailOnWarning;
1469 pValue[nActProp++].Value <<= pItem->GetValue();
1470 }
1471 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_VIEW_ID, false) )
1472 {
1473 pValue[nActProp].Name = sViewId;
1474 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1475 }
1476 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_PLUGIN_MODE, false) )
1477 {
1478 pValue[nActProp].Name = sPluginMode;
1479 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1480 }
1481 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_READONLY, false) )
1482 {
1483 pValue[nActProp].Name = sReadOnly;
1484 pValue[nActProp++].Value <<= pItem->GetValue();
1485 }
1486 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DDE_RECONNECT_ONLOAD, false) )
1487 {
1488 pValue[nActProp].Name = sDdeReconnect;
1489 pValue[nActProp++].Value <<= pItem->GetValue();
1490 }
1491 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_STARTPRESENTATION, false) )
1492 {
1493 pValue[nActProp].Name = sStartPresentation;
1494 pValue[nActProp++].Value <<= pItem->GetValue();
1495 }
1496 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SELECTION, false) )
1497 {
1498 pValue[nActProp].Name = sSelectionOnly;
1499 pValue[nActProp++].Value <<= pItem->GetValue();
1500 }
1501 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_HIDDEN, false) )
1502 {
1503 pValue[nActProp].Name = sHidden;
1504 pValue[nActProp++].Value <<= pItem->GetValue();
1505 }
1506 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_MINIMIZED, false) )
1507 {
1508 pValue[nActProp].Name = sMinimized;
1509 pValue[nActProp++].Value <<= pItem->GetValue();
1510 }
1511 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SILENT, false) )
1512 {
1513 pValue[nActProp].Name = sSilent;
1514 pValue[nActProp++].Value <<= pItem->GetValue();
1515 }
1516 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_PREVIEW, false) )
1517 {
1518 pValue[nActProp].Name = sPreview;
1519 pValue[nActProp++].Value <<= pItem->GetValue();
1520 }
1521 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_VIEWONLY, false) )
1522 {
1523 pValue[nActProp].Name = sViewOnly;
1524 pValue[nActProp++].Value <<= pItem->GetValue();
1525 }
1526 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_EDITDOC, false) )
1527 {
1528 pValue[nActProp].Name = sDontEdit;
1529 pValue[nActProp++].Value <<= !pItem->GetValue();
1530 }
1531 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FILE_DIALOG, false) )
1532 {
1533 pValue[nActProp].Name = sUseSystemDialog;
1534 pValue[nActProp++].Value <<= pItem->GetValue();
1535 }
1536 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_STANDARD_DIR, false) )
1537 {
1538 pValue[nActProp].Name = sStandardDir;
1539 pValue[nActProp++].Value <<= pItem->GetValue();
1540 }
1541 if ( const SfxStringListItem *pItem = rSet.GetItemIfSet( SID_DENY_LIST, false) )
1542 {
1543 pValue[nActProp].Name = sDenyList;
1544
1545 css::uno::Sequence< OUString > aList;
1546 pItem->GetStringList( aList );
1547 pValue[nActProp++].Value <<= aList ;
1548 }
1549 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TARGETNAME, false) )
1550 {
1551 pValue[nActProp].Name = sFrameName;
1552 pValue[nActProp++].Value <<= pItem->GetValue();
1553 }
1554 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SALVAGE, false) )
1555 {
1556 pValue[nActProp].Name = sSalvagedFile;
1557 pValue[nActProp++].Value <<= pItem->GetValue();
1558 }
1559 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_PATH, false) )
1560 {
1561 pValue[nActProp].Name = sFolderName;
1562 pValue[nActProp++].Value <<= pItem->GetValue();
1563 }
1564 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CONTENTTYPE, false) )
1565 {
1566 pValue[nActProp].Name = sMediaType;
1567 pValue[nActProp++].Value <<= pItem->GetValue();
1568 }
1569 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_NAME, false) )
1570 {
1571 pValue[nActProp].Name = sTemplateName;
1572 pValue[nActProp++].Value <<= pItem->GetValue();
1573 }
1574 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_REGIONNAME, false) )
1575 {
1576 pValue[nActProp].Name = sTemplateRegionName;
1577 pValue[nActProp++].Value <<= pItem->GetValue();
1578 }
1579 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_JUMPMARK, false) )
1580 {
1581 pValue[nActProp].Name = sJumpMark;
1582 pValue[nActProp++].Value <<= pItem->GetValue();
1583 }
1584
1585 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CHARSET, false) )
1586 {
1587 pValue[nActProp].Name = sCharacterSet;
1588 pValue[nActProp++].Value <<= pItem->GetValue();
1589 }
1590 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_MACROEXECMODE, false) )
1591 {
1592 pValue[nActProp].Name = sMacroExecMode;
1593 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1594 }
1595 if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_UPDATEDOCMODE, false) )
1596 {
1597 pValue[nActProp].Name = sUpdateDocMode;
1598 pValue[nActProp++].Value <<= static_cast<sal_Int16>(pItem->GetValue());
1599 }
1600 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_REPAIRPACKAGE, false) )
1601 {
1602 pValue[nActProp].Name = sRepairPackage;
1603 pValue[nActProp++].Value <<= pItem->GetValue() ;
1604 }
1605 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOCINFO_TITLE, false) )
1606 {
1607 pValue[nActProp].Name = sDocumentTitle;
1608 pValue[nActProp++].Value <<= pItem->GetValue();
1609 }
1610 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_BASEURL, false) )
1611 {
1612 pValue[nActProp].Name = sDocumentBaseURL;
1613 pValue[nActProp++].Value <<= pItem->GetValue();
1614 }
1615 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_HIERARCHICALNAME, false) )
1616 {
1617 pValue[nActProp].Name = sHierarchicalDocumentName;
1618 pValue[nActProp++].Value <<= pItem->GetValue();
1619 }
1620 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_COPY_STREAM_IF_POSSIBLE, false) )
1621 {
1622 pValue[nActProp].Name = sCopyStreamIfPossible;
1623 pValue[nActProp++].Value <<= pItem->GetValue();
1624 }
1625 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_NOAUTOSAVE, false) )
1626 {
1627 pValue[nActProp].Name = sNoAutoSave;
1628 pValue[nActProp++].Value <<= pItem->GetValue() ;
1629 }
1630 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_MODIFYPASSWORDINFO, false) )
1631 {
1632 pValue[nActProp].Name = sModifyPasswordInfo;
1633 pValue[nActProp++].Value = pItem->GetValue();
1634 }
1635 if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_ENCRYPTIONDATA, false) )
1636 {
1637 pValue[nActProp].Name = sEncryptionData;
1638 pValue[nActProp++].Value = pItem->GetValue();
1639 }
1640 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASDIR, false) )
1641 {
1642 pValue[nActProp].Name = sSuggestedSaveAsDir;
1643 pValue[nActProp++].Value <<= pItem->GetValue();
1644 }
1645 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASNAME, false) )
1646 {
1647 pValue[nActProp].Name = sSuggestedSaveAsName;
1648 pValue[nActProp++].Value <<= pItem->GetValue();
1649 }
1650 if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SERVICE, false) )
1651 {
1652 pValue[nActProp].Name = sDocumentService;
1653 pValue[nActProp++].Value <<= pItem->GetValue();
1654 }
1655 if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_FILTER_PROVIDER))
1656 {
1657 pValue[nActProp].Name = sFilterProvider;
1658 pValue[nActProp++].Value <<= pItem->GetValue();
1659 }
1660 if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_CONVERT_IMAGES))
1661 {
1662 pValue[nActProp].Name = sImageFilter;
1663 pValue[nActProp++].Value <<= pItem->GetValue();
1664 }
1665 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_CONTENT_EXTRACTION, false) )
1666 {
1667 pValue[nActProp].Name = sLockContentExtraction;
1668 pValue[nActProp++].Value <<= pItem->GetValue() ;
1669 }
1670 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EXPORT, false) )
1671 {
1672 pValue[nActProp].Name = sLockExport;
1673 pValue[nActProp++].Value <<= pItem->GetValue() ;
1674 }
1675 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_PRINT, false) )
1676 {
1677 pValue[nActProp].Name = sLockPrint;
1678 pValue[nActProp++].Value <<= pItem->GetValue() ;
1679 }
1680 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_SAVE, false) )
1681 {
1682 pValue[nActProp].Name = sLockSave;
1683 pValue[nActProp++].Value <<= pItem->GetValue() ;
1684 }
1685 if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EDITDOC, false) )
1686 {
1687 pValue[nActProp].Name = sLockEditDoc;
1688 pValue[nActProp++].Value <<= pItem->GetValue();
1689 }
1690 if (const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_REPLACEABLE, false))
1691 {
1692 pValue[nActProp].Name = sReplaceable;
1693 pValue[nActProp++].Value <<= pItem->GetValue();
1694 }
1695 }
1696
1697 rArgs = aSequ;
1698}
1699
1701 const uno::Sequence<beans::PropertyValue>& rProps )
1702{
1703 rProperties = rProps;
1704}
1705
1706uno::Sequence< beans::PropertyValue > SAL_CALL
1708{
1709 return rProperties;
1710}
1711
1712
1713RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > const & rModel,
1714 const uno::Sequence< beans::PropertyValue >& rProperties )
1715{
1716 uno::Reference< uno::XInterface > temp2;
1717 document::FilterOptionsRequest aOptionsRequest( OUString(),
1718 temp2,
1719 rModel,
1720 rProperties );
1721
1722 m_aRequest <<= aOptionsRequest;
1723
1726}
1727
1729{
1730 return m_aRequest;
1731}
1732
1733uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1735{
1736 return { m_xAbort, m_xOptions };
1737}
1738
1739
1740class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1741{
1745
1746public:
1747 explicit RequestPackageReparation_Impl( const OUString& aName );
1748 bool isApproved() const;
1749 virtual uno::Any SAL_CALL getRequest() override;
1750 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1751};
1752
1754{
1755 uno::Reference< uno::XInterface > temp2;
1756 document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1757 m_aRequest <<= aBrokenPackageRequest;
1760}
1761
1763{
1764 return m_xApprove->wasSelected();
1765}
1766
1768{
1769 return m_aRequest;
1770}
1771
1772uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1774{
1775 return { m_xApprove, m_xDisapprove };
1776}
1777
1779 : mxImpl(new RequestPackageReparation_Impl( aName ))
1780{
1781}
1782
1784{
1785}
1786
1788{
1789 return mxImpl->isApproved();
1790}
1791
1792css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest() const
1793{
1794 return mxImpl;
1795}
1796
1797
1798class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1799{
1802
1803public:
1804 explicit NotifyBrokenPackage_Impl(const OUString& rName);
1805 virtual uno::Any SAL_CALL getRequest() override;
1806 virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1807};
1808
1810{
1811 uno::Reference< uno::XInterface > temp2;
1812 document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1813 m_aRequest <<= aBrokenPackageRequest;
1815}
1816
1818{
1819 return m_aRequest;
1820}
1821
1822uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1824{
1825 return { m_xAbort };
1826}
1827
1829 : mxImpl(new NotifyBrokenPackage_Impl( aName ))
1830{
1831}
1832
1834{
1835}
1836
1837css::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest() const
1838{
1839 return mxImpl;
1840}
1841
1842/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr OUStringLiteral sDenyList
Definition: appuno.cxx:143
constexpr OUStringLiteral sPluginMode
Definition: appuno.cxx:103
constexpr OUStringLiteral sLockContentExtraction
Definition: appuno.cxx:152
constexpr OUStringLiteral sUCBContent
Definition: appuno.cxx:131
constexpr OUStringLiteral sModifyPasswordInfo
Definition: appuno.cxx:144
constexpr OUStringLiteral sInputStream
Definition: appuno.cxx:111
constexpr OUStringLiteral sViewOnly
Definition: appuno.cxx:116
constexpr OUStringLiteral sOpenNewView
Definition: appuno.cxx:101
constexpr OUStringLiteral sViewData
Definition: appuno.cxx:124
constexpr OUStringLiteral sEncryptionData
Definition: appuno.cxx:147
constexpr OUStringLiteral sViewId
Definition: appuno.cxx:102
constexpr OUStringLiteral sImageFilter
Definition: appuno.cxx:151
constexpr OUStringLiteral sStartPresentation
Definition: appuno.cxx:106
constexpr OUStringLiteral sRepairPackage
Definition: appuno.cxx:132
static bool isMediaDescriptor(sal_uInt16 nSlotId)
Definition: appuno.cxx:159
constexpr OUStringLiteral sTemplateRegionName
Definition: appuno.cxx:98
constexpr OUStringLiteral sDocumentTitle
Definition: appuno.cxx:133
constexpr OUStringLiteral sPostData
Definition: appuno.cxx:109
constexpr OUStringLiteral sTemplateName
Definition: appuno.cxx:99
constexpr OUStringLiteral sUpdateDocMode
Definition: appuno.cxx:128
constexpr OUStringLiteral sLockPrint
Definition: appuno.cxx:154
void TransformItems(sal_uInt16 nSlotId, const SfxItemSet &rSet, uno::Sequence< beans::PropertyValue > &rArgs, const SfxSlot *pSlot)
Definition: appuno.cxx:908
constexpr OUStringLiteral sModel
Definition: appuno.cxx:122
constexpr OUStringLiteral sSalvagedFile
Definition: appuno.cxx:120
constexpr OUStringLiteral sStatusInd
Definition: appuno.cxx:121
constexpr OUStringLiteral sStream
Definition: appuno.cxx:112
constexpr OUStringLiteral sAsTemplate
Definition: appuno.cxx:100
constexpr OUStringLiteral sMinimized
Definition: appuno.cxx:129
constexpr OUStringLiteral sDdeReconnect
Definition: appuno.cxx:105
constexpr OUStringLiteral sPreview
Definition: appuno.cxx:115
constexpr OUStringLiteral sMediaType
Definition: appuno.cxx:108
constexpr OUStringLiteral sSilent
Definition: appuno.cxx:118
constexpr OUStringLiteral sLockSave
Definition: appuno.cxx:155
constexpr OUStringLiteral sFilterProvider
Definition: appuno.cxx:150
constexpr OUStringLiteral sDocumentBaseURL
Definition: appuno.cxx:136
constexpr OUStringLiteral sFrame
Definition: appuno.cxx:123
constexpr OUStringLiteral sUseSystemDialog
Definition: appuno.cxx:141
constexpr OUStringLiteral sFolderName
Definition: appuno.cxx:140
constexpr OUStringLiteral sFilterData
Definition: appuno.cxx:125
constexpr OUStringLiteral sCopyStreamIfPossible
Definition: appuno.cxx:138
void TransformParameters(sal_uInt16 nSlotId, const uno::Sequence< beans::PropertyValue > &rArgs, SfxAllItemSet &rSet, const SfxSlot *pSlot)
Definition: appuno.cxx:170
constexpr OUStringLiteral sLockEditDoc
Definition: appuno.cxx:156
constexpr OUStringLiteral sComponentData
Definition: appuno.cxx:134
constexpr OUStringLiteral sSelectionOnly
Definition: appuno.cxx:126
constexpr OUStringLiteral sReplaceable
Definition: appuno.cxx:157
SfxFormalArgument const aFormalArgs[]
Definition: appuno.cxx:62
constexpr OUStringLiteral sLockExport
Definition: appuno.cxx:153
constexpr OUStringLiteral sSuggestedSaveAsName
Definition: appuno.cxx:146
constexpr OUStringLiteral sInteractionHdl
Definition: appuno.cxx:130
constexpr OUStringLiteral sCharacterSet
Definition: appuno.cxx:110
constexpr OUStringLiteral sDocumentService
Definition: appuno.cxx:149
constexpr OUStringLiteral sFailOnWarning
Definition: appuno.cxx:148
constexpr OUStringLiteral sComponentContext
Definition: appuno.cxx:135
constexpr OUStringLiteral sSuggestedSaveAsDir
Definition: appuno.cxx:145
constexpr OUStringLiteral sDontEdit
Definition: appuno.cxx:117
constexpr OUStringLiteral sOutputStream
Definition: appuno.cxx:113
constexpr OUStringLiteral sReadOnly
Definition: appuno.cxx:104
constexpr OUStringLiteral sStandardDir
Definition: appuno.cxx:142
constexpr OUStringLiteral sFrameName
Definition: appuno.cxx:107
constexpr OUStringLiteral sJumpMark
Definition: appuno.cxx:119
constexpr OUStringLiteral sHidden
Definition: appuno.cxx:114
sal_uInt16 const nMediaArgsCount
Definition: appuno.cxx:96
constexpr OUStringLiteral sMacroExecMode
Definition: appuno.cxx:127
constexpr OUStringLiteral sHierarchicalDocumentName
Definition: appuno.cxx:137
constexpr OUStringLiteral sNoAutoSave
Definition: appuno.cxx:139
virtual void SAL_CALL setFilterOptions(const css::uno::Sequence< css::beans::PropertyValue > &rProp) override
Definition: appuno.cxx:1700
css::uno::Sequence< css::beans::PropertyValue > rProperties
Definition: fltoptint.hxx:30
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getFilterOptions() override
Definition: appuno.cxx:1707
virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override
Definition: appuno.cxx:1823
NotifyBrokenPackage_Impl(const OUString &rName)
Definition: appuno.cxx:1809
rtl::Reference< comphelper::OInteractionAbort > m_xAbort
Definition: appuno.cxx:1801
virtual uno::Any SAL_CALL getRequest() override
Definition: appuno.cxx:1817
NotifyBrokenPackage(const OUString &aName)
Definition: appuno.cxx:1828
css::uno::Reference< css::task::XInteractionRequest > GetRequest() const
Definition: appuno.cxx:1837
rtl::Reference< NotifyBrokenPackage_Impl > mxImpl
rtl::Reference< comphelper::OInteractionAbort > m_xAbort
Definition: fltoptint.hxx:41
RequestFilterOptions(css::uno::Reference< css::frame::XModel > const &rModel, const css::uno::Sequence< css::beans::PropertyValue > &rProperties)
Definition: appuno.cxx:1713
css::uno::Any m_aRequest
Definition: fltoptint.hxx:39
virtual css::uno::Sequence< css::uno::Reference< css::task::XInteractionContinuation > > SAL_CALL getContinuations() override
Definition: appuno.cxx:1734
rtl::Reference< FilterOptionsContinuation > m_xOptions
Definition: fltoptint.hxx:42
virtual css::uno::Any SAL_CALL getRequest() override
Definition: appuno.cxx:1728
virtual uno::Any SAL_CALL getRequest() override
Definition: appuno.cxx:1767
virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override
Definition: appuno.cxx:1773
RequestPackageReparation_Impl(const OUString &aName)
Definition: appuno.cxx:1753
rtl::Reference< comphelper::OInteractionDisapprove > m_xDisapprove
Definition: appuno.cxx:1744
rtl::Reference< comphelper::OInteractionApprove > m_xApprove
Definition: appuno.cxx:1743
rtl::Reference< RequestPackageReparation_Impl > mxImpl
RequestPackageReparation(const OUString &aName)
Definition: appuno.cxx:1778
bool isApproved() const
Definition: appuno.cxx:1787
css::uno::Reference< css::task::XInteractionRequest > GetRequest() const
Definition: appuno.cxx:1792
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
virtual MapUnit GetMetric(sal_uInt16 nWhich) const
const WhichRangesContainer & GetRanges() const
SfxItemPool * GetPool() const
sal_uInt16 Count() const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
bool HasItem(sal_uInt16 nWhich, const SfxPoolItem **ppItem=nullptr) const
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * GetItem(sal_uInt16 nWhich, bool bSearchInParent=true) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
Definition: msg.hxx:184
sal_uInt16 GetSlotId() const
Definition: msg.hxx:253
OUString pUnoName
Definition: msg.hxx:205
const SfxType * GetType() const
Definition: msg.hxx:236
const SfxFormalArgument & GetFormalArgument(sal_uInt16 nNo) const
Definition: msg.hxx:241
sal_uInt16 GetFormalArgumentCount() const
Definition: msg.hxx:240
sal_uInt16 nArgDefCount
Definition: msg.hxx:201
bool IsMode(SfxSlotMode nMode) const
Definition: msg.hxx:268
void SetStringList(const css::uno::Sequence< OUString > &rList)
int nCount
#define DBG_ASSERT(sCon, aError)
float u
OUString aName
sal_Int64 n
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
#define SAL_N_ELEMENTS(arr)
aStr
Definition: mgetempl.cxx:407
#define SFX_SLOTPOOL()
Definition: msgpool.hxx:70
OInteraction< css::task::XInteractionDisapprove > OInteractionDisapprove
OInteraction< css::task::XInteractionApprove > OInteractionApprove
OInteraction< css::task::XInteractionAbort > OInteractionAbort
sal_Int16 nId
#define CONVERT_TWIPS
static SfxItemSet & rSet
Definition: shell.cxx:534
sal_uInt16 nSlotId
Definition: msg.hxx:176
const char * pName
Definition: msg.hxx:175
std::unique_ptr< SfxPoolItem > CreateItem() const
Definition: msg.hxx:178
const SfxType * pType
Definition: msg.hxx:174
const char * pName
Definition: msg.hxx:96
sal_uInt16 nAID
Definition: msg.hxx:95
Definition: msg.hxx:104
std::unique_ptr< SfxPoolItem > CreateItem() const
Definition: msg.hxx:111
SfxTypeAttrib aAttrib[1]
Definition: msg.hxx:108
sal_uInt16 nAttribs
Definition: msg.hxx:107
Reference< XFrame > xFrame
unsigned char sal_uInt8
signed char sal_Int8