1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
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
)
173 pSlot
= SFX_SLOTPOOL().GetSlot( nSlotId
);
178 if ( nSlotId
== SID_OPENURL
)
179 nSlotId
= SID_OPENDOC
;
181 const sal_Int32 nCount
= rArgs
.getLength();
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());
194 SAL_WARN( "sfx", "No creator method for item: " << nSlotId
);
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
) );
214 SAL_WARN( "sfx", "Property not convertible: " << pSlot
->aUnoName
);
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
);
226 // there is more than one parameter and the property is a complex one
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
);
237 // complex property; collect sub items from the parameter set and reconstruct complex item
239 for ( const beans::PropertyValue
& rPropValue
: rArgs
)
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
));
249 nSubId
|= CONVERT_TWIPS
;
250 if ( pItem
->PutValue( rPropValue
.Value
, nSubId
) )
254 SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot
->aUnoName
);
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
266 rSet
.Put( std::move(pItem
) );
273 // detect parameters that don't match to any formal argument or one of its members
274 sal_Int32 nFoundArgs
= 0;
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());
285 SAL_WARN( "sfx", "No creator method for argument: " << rArg
.aName
);
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())
304 if( pItem
->PutValue( pProp
->Value
, 0 ) )
305 // only use successfully converted items
306 rSet
.Put( std::move(pItem
) );
309 SAL_WARN( "sfx", "Property not convertible: " << rArg
.aName
);
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
)
326 if( pItem
->PutValue( rProp
.Value
, 0 ) )
327 // only use successfully converted items
328 rSet
.Put( std::move(pItem
) );
331 SAL_WARN( "sfx", "Property not convertible: " << rArg
.aName
);
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?)
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 ...
354 sal_uInt8 nSubId
= static_cast<sal_uInt8
>(static_cast<sal_Int8
>(pType
->getAttrib(nSub
).nAID
));
356 nSubId
|= CONVERT_TWIPS
;
357 if (!pItem
->PutValue( rProp
.Value
, nSubId
) )
359 // ... but it was not convertible
361 SAL_WARN( "sfx", "Property not convertible: " << rArg
.aName
);
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
) );
394 if ( rName
== sHidden
)
397 if (rProp
.Value
>>= bVal
)
398 rSet
.Put( SfxBoolItem( SID_HIDDEN
, bVal
) );
402 else if ( bIsMediaDescriptor
)
404 for ( const beans::PropertyValue
& rProp
: rArgs
)
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" );
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" );
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" );
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" );
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" );
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" );
486 rSet
.Put( SfxUnoFrameItem( SID_FILLFRAME
, xFrame
) );
488 else if ( aName
== sAsTemplate
)
491 bool bOK
= (rProp
.Value
>>= bVal
);
492 DBG_ASSERT( bOK
, "invalid type for AsTemplate" );
494 rSet
.Put( SfxBoolItem( SID_TEMPLATE
, bVal
) );
496 else if ( aName
== sOpenNewView
)
499 bool bOK
= (rProp
.Value
>>= bVal
);
500 DBG_ASSERT( bOK
, "invalid type for OpenNewView" );
502 rSet
.Put( SfxBoolItem( SID_OPEN_NEW_VIEW
, bVal
) );
504 else if ( aName
== sFailOnWarning
)
507 bool bOK
= (rProp
.Value
>>= bVal
);
508 DBG_ASSERT( bOK
, "invalid type for FailOnWarning" );
510 rSet
.Put( SfxBoolItem( SID_FAIL_ON_WARNING
, bVal
) );
512 else if ( aName
== sViewId
)
515 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
516 DBG_ASSERT( bOK
, "invalid type for ViewId" );
518 rSet
.Put( SfxUInt16Item( SID_VIEW_ID
, nVal
) );
520 else if ( aName
== sPluginMode
)
523 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
524 DBG_ASSERT( bOK
, "invalid type for PluginMode" );
526 rSet
.Put( SfxUInt16Item( SID_PLUGIN_MODE
, nVal
) );
528 else if ( aName
== sReadOnly
)
531 bool bOK
= (rProp
.Value
>>= bVal
);
532 DBG_ASSERT( bOK
, "invalid type for ReadOnly" );
534 rSet
.Put( SfxBoolItem( SID_DOC_READONLY
, bVal
) );
536 else if ( aName
== sDdeReconnect
)
539 bool bOK
= (rProp
.Value
>>= bVal
);
540 DBG_ASSERT( bOK
, "invalid type for DDEReconnect" );
542 rSet
.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD
, bVal
) );
544 else if ( aName
== sStartPresentation
)
547 bool bOK
= (rProp
.Value
>>= nVal
);
548 DBG_ASSERT( bOK
, "invalid type for StartPresentation" );
550 rSet
.Put(SfxUInt16Item(SID_DOC_STARTPRESENTATION
, nVal
));
552 else if ( aName
== sSelectionOnly
)
555 bool bOK
= (rProp
.Value
>>= bVal
);
556 DBG_ASSERT( bOK
, "invalid type for SelectionOnly" );
558 rSet
.Put( SfxBoolItem( SID_SELECTION
, bVal
) );
560 else if ( aName
== sHidden
)
563 bool bOK
= (rProp
.Value
>>= bVal
);
564 DBG_ASSERT( bOK
, "invalid type for Hidden" );
566 rSet
.Put( SfxBoolItem( SID_HIDDEN
, bVal
) );
568 else if ( aName
== sMinimized
)
571 bool bOK
= (rProp
.Value
>>= bVal
);
572 DBG_ASSERT( bOK
, "invalid type for Minimized" );
574 rSet
.Put( SfxBoolItem( SID_MINIMIZED
, bVal
) );
576 else if ( aName
== sSilent
)
579 bool bOK
= (rProp
.Value
>>= bVal
);
580 DBG_ASSERT( bOK
, "invalid type for Silent" );
582 rSet
.Put( SfxBoolItem( SID_SILENT
, bVal
) );
584 else if ( aName
== sPreview
)
587 bool bOK
= (rProp
.Value
>>= bVal
);
588 DBG_ASSERT( bOK
, "invalid type for Preview" );
590 rSet
.Put( SfxBoolItem( SID_PREVIEW
, bVal
) );
592 else if ( aName
== sViewOnly
)
595 bool bOK
= (rProp
.Value
>>= bVal
);
596 DBG_ASSERT( bOK
, "invalid type for ViewOnly" );
598 rSet
.Put( SfxBoolItem( SID_VIEWONLY
, bVal
) );
600 else if ( aName
== sDontEdit
)
603 bool bOK
= (rProp
.Value
>>= bVal
);
604 DBG_ASSERT( bOK
, "invalid type for ViewOnly" );
606 rSet
.Put( SfxBoolItem( SID_EDITDOC
, !bVal
) );
608 else if ( aName
== sUseSystemDialog
)
611 bool bOK
= (rProp
.Value
>>= bVal
);
612 DBG_ASSERT( bOK
, "invalid type for ViewOnly" );
614 rSet
.Put( SfxBoolItem( SID_FILE_DIALOG
, bVal
) );
616 else if ( aName
== sStandardDir
)
619 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
620 DBG_ASSERT( bOK
, "invalid type or value for StandardDir" );
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" );
631 SfxStringListItem
stringList(SID_DENY_LIST
);
632 stringList
.SetStringList( xVal
);
633 rSet
.Put( stringList
);
636 else if ( aName
== "FileName" )
639 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
640 DBG_ASSERT( bOK
, "invalid type or value for FileName" );
642 rSet
.Put( SfxStringItem( SID_FILE_NAME
, sVal
) );
644 else if ( aName
== sSalvagedFile
)
647 bool bOK
= (rProp
.Value
>>= sVal
);
648 DBG_ASSERT( bOK
, "invalid type or value for SalvagedFile" );
650 rSet
.Put( SfxStringItem( SID_DOC_SALVAGE
, sVal
) );
652 else if ( aName
== sFolderName
)
655 bool bOK
= (rProp
.Value
>>= sVal
);
656 DBG_ASSERT( bOK
, "invalid type or value for FolderName" );
658 rSet
.Put( SfxStringItem( SID_PATH
, sVal
) );
660 else if ( aName
== sFrameName
)
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
)
671 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
672 DBG_ASSERT( bOK
, "invalid type or value for MediaType" );
674 rSet
.Put( SfxStringItem( SID_CONTENTTYPE
, sVal
) );
676 else if ( aName
== sTemplateName
)
679 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
680 DBG_ASSERT( bOK
, "invalid type or value for TemplateName" );
682 rSet
.Put( SfxStringItem( SID_TEMPLATE_NAME
, sVal
) );
684 else if ( aName
== sTemplateRegionName
)
687 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
688 DBG_ASSERT( bOK
, "invalid type or value for TemplateRegionName" );
690 rSet
.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME
, sVal
) );
692 else if ( aName
== sJumpMark
)
695 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
696 DBG_ASSERT( bOK
, "invalid type or value for JumpMark" );
698 rSet
.Put( SfxStringItem( SID_JUMPMARK
, sVal
) );
700 else if ( aName
== sCharacterSet
)
703 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
704 DBG_ASSERT( bOK
, "invalid type or value for CharacterSet" );
706 rSet
.Put( SfxStringItem( SID_CHARSET
, sVal
) );
708 else if ( aName
== "FilterFlags" )
711 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
712 DBG_ASSERT( bOK
, "invalid type or value for FilterFlags" );
714 rSet
.Put( SfxStringItem( SID_FILE_FILTEROPTIONS
, sVal
) );
716 else if ( aName
== sImageFilter
)
719 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
720 DBG_ASSERT( bOK
, "invalid type or value for FilterFlags" );
722 rSet
.Put( SfxStringItem( SID_CONVERT_IMAGES
, sVal
) );
724 else if ( aName
== sMacroExecMode
)
727 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
728 DBG_ASSERT( bOK
, "invalid type for MacroExecMode" );
730 rSet
.Put( SfxUInt16Item( SID_MACROEXECMODE
, nVal
) );
732 else if ( aName
== sUpdateDocMode
)
735 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
736 DBG_ASSERT( bOK
, "invalid type for UpdateDocMode" );
738 rSet
.Put( SfxUInt16Item( SID_UPDATEDOCMODE
, nVal
) );
740 else if ( aName
== sRepairPackage
)
743 bool bOK
= (rProp
.Value
>>= bVal
);
744 DBG_ASSERT( bOK
, "invalid type for RepairPackage" );
746 rSet
.Put( SfxBoolItem( SID_REPAIRPACKAGE
, bVal
) );
748 else if ( aName
== sDocumentTitle
)
751 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
752 DBG_ASSERT( bOK
, "invalid type or value for DocumentTitle" );
754 rSet
.Put( SfxStringItem( SID_DOCINFO_TITLE
, sVal
) );
756 else if ( aName
== sDocumentBaseURL
)
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" );
763 rSet
.Put( SfxStringItem( SID_DOC_BASEURL
, sVal
) );
765 else if ( aName
== sHierarchicalDocumentName
)
768 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
769 DBG_ASSERT( bOK
, "invalid type or value for HierarchicalDocumentName" );
771 rSet
.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME
, sVal
) );
773 else if ( aName
== sCopyStreamIfPossible
)
776 bool bOK
= (rProp
.Value
>>= bVal
);
777 DBG_ASSERT( bOK
, "invalid type for CopyStreamIfPossible" );
779 rSet
.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE
, bVal
) );
781 else if ( aName
== sNoAutoSave
)
784 bool bOK
= (rProp
.Value
>>= bVal
);
785 DBG_ASSERT( bOK
, "invalid type for NoAutoSave" );
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
)
800 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
801 DBG_ASSERT( bOK
, "invalid type or value for SuggestedSaveAsDir" );
803 rSet
.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR
, sVal
) );
805 else if ( aName
== sSuggestedSaveAsName
)
808 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
809 DBG_ASSERT( bOK
, "invalid type or value for SuggestedSaveAsName" );
811 rSet
.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME
, sVal
) );
813 else if (aName
== sDocumentService
)
816 bool bOK
= ((rProp
.Value
>>= aVal
) && !aVal
.isEmpty());
818 rSet
.Put(SfxStringItem(SID_DOC_SERVICE
, aVal
));
820 else if (aName
== sFilterProvider
)
823 bool bOK
= ((rProp
.Value
>>= aVal
) && !aVal
.isEmpty());
825 rSet
.Put(SfxStringItem(SID_FILTER_PROVIDER
, aVal
));
827 else if (aName
== sLockContentExtraction
)
830 bool bOK
= (rProp
.Value
>>= bVal
);
831 DBG_ASSERT( bOK
, "invalid type for LockContentExtraction" );
833 rSet
.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION
, bVal
) );
835 else if (aName
== sLockExport
)
838 bool bOK
= (rProp
.Value
>>= bVal
);
839 DBG_ASSERT( bOK
, "invalid type for LockExport" );
841 rSet
.Put( SfxBoolItem( SID_LOCK_EXPORT
, bVal
) );
843 else if (aName
== sLockPrint
)
846 bool bOK
= (rProp
.Value
>>= bVal
);
847 DBG_ASSERT( bOK
, "invalid type for LockPrint" );
849 rSet
.Put( SfxBoolItem( SID_LOCK_PRINT
, bVal
) );
851 else if (aName
== sLockSave
)
854 bool bOK
= (rProp
.Value
>>= bVal
);
855 DBG_ASSERT( bOK
, "invalid type for LockSave" );
857 rSet
.Put( SfxBoolItem( SID_LOCK_SAVE
, bVal
) );
859 else if (aName
== sLockEditDoc
)
862 bool bOK
= (rProp
.Value
>>= bVal
);
863 DBG_ASSERT( bOK
, "invalid type for LockEditDoc" );
865 rSet
.Put( SfxBoolItem( SID_LOCK_EDITDOC
, bVal
) );
867 else if (aName
== sReplaceable
)
870 bool bOK
= (rProp
.Value
>>= bVal
);
871 DBG_ASSERT(bOK
, "invalid type for Replaceable");
873 rSet
.Put(SfxBoolItem(SID_REPLACEABLE
, bVal
));
881 // API to raise options dialog with a specified options ab page (#i83757#)
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())
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
) );
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
);
909 void TransformItems( sal_uInt16 nSlotId
, const SfxItemSet
& rSet
, uno::Sequence
<beans::PropertyValue
>& rArgs
, const SfxSlot
* pSlot
)
912 pSlot
= SFX_SLOTPOOL().GetSlot( nSlotId
);
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
926 // trace number of items and compare with number of properties for debugging purposes
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
;
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
943 // simple property: we expect to get exactly one item
948 // we will not rely on the "toggle" ability of some property slots
949 SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId
);
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
;
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
975 // argument of simple type: we expect to get exactly one item for it
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
)
989 if ( rSet
.GetItemState( SID_INTERACTIONHANDLER
) == SfxItemState::SET
)
991 if ( rSet
.GetItemState( SID_DOC_SALVAGE
) == SfxItemState::SET
)
993 if ( rSet
.GetItemState( SID_PATH
) == SfxItemState::SET
)
995 if ( rSet
.GetItemState( SID_FILE_DIALOG
) == SfxItemState::SET
)
997 if ( rSet
.GetItemState( SID_STANDARD_DIR
) == SfxItemState::SET
)
999 if ( rSet
.GetItemState( SID_DENY_LIST
) == SfxItemState::SET
)
1001 if ( rSet
.GetItemState( SID_CONTENT
) == SfxItemState::SET
)
1003 if ( rSet
.GetItemState( SID_INPUTSTREAM
) == SfxItemState::SET
)
1005 if ( rSet
.GetItemState( SID_STREAM
) == SfxItemState::SET
)
1007 if ( rSet
.GetItemState( SID_OUTPUTSTREAM
) == SfxItemState::SET
)
1009 if ( rSet
.GetItemState( SID_TEMPLATE
) == SfxItemState::SET
)
1011 if ( rSet
.GetItemState( SID_OPEN_NEW_VIEW
) == SfxItemState::SET
)
1013 if ( rSet
.GetItemState( SID_FAIL_ON_WARNING
) == SfxItemState::SET
)
1015 if ( rSet
.GetItemState( SID_VIEW_ID
) == SfxItemState::SET
)
1017 if ( rSet
.GetItemState( SID_VIEW_DATA
) == SfxItemState::SET
)
1019 if ( rSet
.GetItemState( SID_FILTER_DATA
) == SfxItemState::SET
)
1021 if ( rSet
.GetItemState( SID_PLUGIN_MODE
) == SfxItemState::SET
)
1023 if ( rSet
.GetItemState( SID_DOC_READONLY
) == SfxItemState::SET
)
1025 if ( rSet
.GetItemState( SID_DDE_RECONNECT_ONLOAD
) == SfxItemState::SET
)
1027 if ( rSet
.GetItemState( SID_DOC_STARTPRESENTATION
) == SfxItemState::SET
)
1029 if ( rSet
.GetItemState( SID_SELECTION
) == SfxItemState::SET
)
1031 if ( rSet
.GetItemState( SID_CONTENTTYPE
) == SfxItemState::SET
)
1033 if ( rSet
.GetItemState( SID_POSTDATA
) == SfxItemState::SET
)
1035 if ( rSet
.GetItemState( SID_FILLFRAME
) == SfxItemState::SET
)
1037 if ( rSet
.GetItemState( SID_CHARSET
) == SfxItemState::SET
)
1039 if ( rSet
.GetItemState( SID_TARGETNAME
) == SfxItemState::SET
)
1041 if ( rSet
.GetItemState( SID_TEMPLATE_NAME
) == SfxItemState::SET
)
1043 if ( rSet
.GetItemState( SID_TEMPLATE_REGIONNAME
) == SfxItemState::SET
)
1045 if ( rSet
.GetItemState( SID_HIDDEN
) == SfxItemState::SET
)
1047 if ( rSet
.GetItemState( SID_MINIMIZED
) == SfxItemState::SET
)
1049 if ( rSet
.GetItemState( SID_PREVIEW
) == SfxItemState::SET
)
1051 if ( rSet
.GetItemState( SID_VIEWONLY
) == SfxItemState::SET
)
1053 if ( rSet
.GetItemState( SID_EDITDOC
) == SfxItemState::SET
)
1055 if ( rSet
.GetItemState( SID_SILENT
) == SfxItemState::SET
)
1057 if ( rSet
.GetItemState( SID_JUMPMARK
) == SfxItemState::SET
)
1059 if ( rSet
.GetItemState( SID_DOCUMENT
) == SfxItemState::SET
)
1061 if ( rSet
.GetItemState( SID_MACROEXECMODE
) == SfxItemState::SET
)
1063 if ( rSet
.GetItemState( SID_UPDATEDOCMODE
) == SfxItemState::SET
)
1065 if ( rSet
.GetItemState( SID_REPAIRPACKAGE
) == SfxItemState::SET
)
1067 if ( rSet
.GetItemState( SID_DOCINFO_TITLE
) == SfxItemState::SET
)
1069 if ( rSet
.GetItemState( SID_COMPONENTDATA
) == SfxItemState::SET
)
1071 if ( rSet
.GetItemState( SID_COMPONENTCONTEXT
) == SfxItemState::SET
)
1073 if ( rSet
.GetItemState( SID_DOC_BASEURL
) == SfxItemState::SET
)
1075 if ( rSet
.GetItemState( SID_DOC_HIERARCHICALNAME
) == SfxItemState::SET
)
1077 if ( rSet
.GetItemState( SID_COPY_STREAM_IF_POSSIBLE
) == SfxItemState::SET
)
1079 if ( rSet
.GetItemState( SID_NOAUTOSAVE
) == SfxItemState::SET
)
1081 if ( rSet
.GetItemState( SID_MODIFYPASSWORDINFO
) == SfxItemState::SET
)
1083 if ( rSet
.GetItemState( SID_SUGGESTEDSAVEASDIR
) == SfxItemState::SET
)
1085 if ( rSet
.GetItemState( SID_ENCRYPTIONDATA
) == SfxItemState::SET
)
1087 if ( rSet
.GetItemState( SID_SUGGESTEDSAVEASNAME
) == SfxItemState::SET
)
1089 if ( rSet
.GetItemState( SID_DOC_SERVICE
) == SfxItemState::SET
)
1091 if (rSet
.HasItem(SID_FILTER_PROVIDER
))
1093 if ( rSet
.GetItemState( SID_CONVERT_IMAGES
) == SfxItemState::SET
)
1095 if ( rSet
.GetItemState( SID_LOCK_CONTENT_EXTRACTION
) == SfxItemState::SET
)
1097 if ( rSet
.GetItemState( SID_LOCK_EXPORT
) == SfxItemState::SET
)
1099 if ( rSet
.GetItemState( SID_LOCK_PRINT
) == SfxItemState::SET
)
1101 if ( rSet
.GetItemState( SID_LOCK_SAVE
) == SfxItemState::SET
)
1103 if ( rSet
.GetItemState( SID_LOCK_EDITDOC
) == SfxItemState::SET
)
1105 if (rSet
.GetItemState(SID_REPLACEABLE
) == SfxItemState::SET
)
1108 // consider additional arguments
1109 nProps
+= nAdditional
;
1111 nItems
+= nAdditional
;
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
) //???
1132 if ( !pSlot
->IsMode(SfxSlotMode::METHOD
) && nId
== rSet
.GetPool()->GetWhichIDFromSlotID( pSlot
->GetSlotId() ) )
1135 bool bIsMediaDescriptor
= isMediaDescriptor( nSlotId
);
1136 sal_uInt16 nFormalArgs
= bIsMediaDescriptor
? nMediaArgsCount
: pSlot
->nArgDefCount
;
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
)
1146 if ( nArg
<nFormalArgs
)
1149 if ( bIsMediaDescriptor
)
1151 if ( nId
== SID_DOCFRAME
)
1153 if ( nId
== SID_PROGRESS_STATUSBAR_CONTROL
)
1155 if ( nId
== SID_INTERACTIONHANDLER
)
1157 if ( nId
== SID_VIEW_DATA
)
1159 if ( nId
== SID_FILTER_DATA
)
1161 if ( nId
== SID_DOCUMENT
)
1163 if ( nId
== SID_CONTENT
)
1165 if ( nId
== SID_INPUTSTREAM
)
1167 if ( nId
== SID_STREAM
)
1169 if ( nId
== SID_OUTPUTSTREAM
)
1171 if ( nId
== SID_POSTDATA
)
1173 if ( nId
== SID_FILLFRAME
)
1175 if ( nId
== SID_TEMPLATE
)
1177 if ( nId
== SID_OPEN_NEW_VIEW
)
1179 if ( nId
== SID_VIEW_ID
)
1181 if ( nId
== SID_PLUGIN_MODE
)
1183 if ( nId
== SID_DOC_READONLY
)
1185 if ( nId
== SID_DOC_STARTPRESENTATION
)
1187 if ( nId
== SID_SELECTION
)
1189 if ( nId
== SID_HIDDEN
)
1191 if ( nId
== SID_MINIMIZED
)
1193 if ( nId
== SID_SILENT
)
1195 if ( nId
== SID_PREVIEW
)
1197 if ( nId
== SID_VIEWONLY
)
1199 if ( nId
== SID_EDITDOC
)
1201 if ( nId
== SID_TARGETNAME
)
1203 if ( nId
== SID_DOC_SALVAGE
)
1205 if ( nId
== SID_PATH
)
1207 if ( nId
== SID_FILE_DIALOG
)
1209 if ( nId
== SID_STANDARD_DIR
)
1211 if ( nId
== SID_DENY_LIST
)
1213 if ( nId
== SID_CONTENTTYPE
)
1215 if ( nId
== SID_TEMPLATE_NAME
)
1217 if ( nId
== SID_TEMPLATE_REGIONNAME
)
1219 if ( nId
== SID_JUMPMARK
)
1221 if ( nId
== SID_CHARSET
)
1223 if ( nId
== SID_MACROEXECMODE
)
1225 if ( nId
== SID_UPDATEDOCMODE
)
1227 if ( nId
== SID_REPAIRPACKAGE
)
1229 if ( nId
== SID_DOCINFO_TITLE
)
1231 if ( nId
== SID_COMPONENTDATA
)
1233 if ( nId
== SID_COMPONENTCONTEXT
)
1235 if ( nId
== SID_DOC_BASEURL
)
1237 if ( nId
== SID_DOC_HIERARCHICALNAME
)
1239 if ( nId
== SID_COPY_STREAM_IF_POSSIBLE
)
1241 if ( nId
== SID_NOAUTOSAVE
)
1243 if ( nId
== SID_ENCRYPTIONDATA
)
1245 if ( nId
== SID_DOC_SERVICE
)
1247 if (nId
== SID_FILTER_PROVIDER
)
1249 if ( nId
== SID_CONVERT_IMAGES
)
1252 // used only internally
1253 if ( nId
== SID_SAVETO
)
1255 if ( nId
== SID_SAVEACOPYITEM
)
1257 if ( nId
== SID_MODIFYPASSWORDINFO
)
1259 if ( nId
== SID_SUGGESTEDSAVEASDIR
)
1261 if ( nId
== SID_SUGGESTEDSAVEASNAME
)
1263 if ( nId
== SID_LOCK_CONTENT_EXTRACTION
)
1265 if ( nId
== SID_LOCK_EXPORT
)
1267 if ( nId
== SID_LOCK_PRINT
)
1269 if ( nId
== SID_LOCK_SAVE
)
1271 if ( nId
== SID_LOCK_EDITDOC
)
1273 if (nId
== SID_REPLACEABLE
)
1277 OString aDbg
= "Unknown item detected: " + OString::number(static_cast<sal_Int32
>(nId
));
1278 DBG_ASSERT(nArg
<nFormalArgs
, aDbg
.getStr());
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);
1300 sal_uInt16 nSubCount
= pType
->nAttribs
;
1303 pValue
[nActProp
].Name
= pSlot
->aUnoName
;
1304 if ( !pItem
->QueryValue( pValue
[nActProp
].Value
) )
1306 SAL_WARN( "sfx", "Item not convertible: " << nSlotId
);
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
+
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
);
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);
1345 sal_uInt16 nSubCount
= rArg
.pType
->nAttribs
;
1348 pValue
[nActProp
].Name
= rArg
.aName
;
1349 if ( !pItem
->QueryValue( pValue
[nActProp
++].Value
) )
1351 SAL_WARN( "sfx", "Item not convertible: " << rArg
.nSlotId
);
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
+
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: "
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();
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()
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(),
1723 m_aRequest
<<= aOptionsRequest
;
1725 m_xAbort
= new comphelper::OInteractionAbort
;
1726 m_xOptions
= new FilterOptionsContinuation
;
1729 uno::Any SAL_CALL
RequestFilterOptions::getRequest()
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
;
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()
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
1799 class NotifyBrokenPackage_Impl
: public ::cppu::WeakImplHelper
< task::XInteractionRequest
>
1801 uno::Any m_aRequest
;
1802 rtl::Reference
<comphelper::OInteractionAbort
> m_xAbort
;
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()
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
1843 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */