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 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "SuggestedSaveAsName", SID_DEFAULTFILENAME
},
64 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "SuggestedSaveAsDir", SID_DEFAULTFILEPATH
},
65 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "VersionAuthor", SID_DOCINFO_AUTHOR
},
66 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "VersionComment", SID_DOCINFO_COMMENTS
},
67 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "DontTerminateEdit", FN_PARAM_1
},
68 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "VersionMajor", SID_DOCINFO_MAJOR
},
69 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "FilterOptions", SID_FILE_FILTEROPTIONS
},
70 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "FilterName", SID_FILTER_NAME
},
71 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "Margin1", SID_RULER_MARGIN1
},
72 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "Margin2", SID_RULER_MARGIN2
},
73 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
74 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "URL", SID_FILE_NAME
},
75 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "OpenFlags", SID_OPTIONS
},
76 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "Overwrite", SID_OVERWRITE
},
77 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "Password", SID_PASSWORD
},
78 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "PasswordInteraction", SID_PASSWORDINTERACTION
},
79 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "Referer", SID_REFERER
},
80 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "SaveTo", SID_SAVETO
},
81 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "TemplateName", SID_TEMPLATE_NAME
},
82 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "TemplateRegion", SID_TEMPLATE_REGIONNAME
},
83 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Region", SID_TEMPLATE_REGIONNAME },
84 // { reinterpret_cast<SfxType*>(&aSfxStringItem_Impl), "Name", SID_TEMPLATE_NAME },
85 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "Unpacked", SID_UNPACK
},
86 { reinterpret_cast<SfxType
*>(&aSfxInt16Item_Impl
), "Version", SID_VERSION
},
87 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "SaveACopy", SID_SAVEACOPYITEM
},
88 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "NoFileSync", SID_NO_FILE_SYNC
},
89 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "NoThumbnail", SID_NO_THUMBNAIL
},
90 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "NoEmbDataSet", SID_NO_EMBEDDED_DS
},
91 { reinterpret_cast<SfxType
*>(&aSfxBoolItem_Impl
), "IsRedactMode", SID_IS_REDACT_MODE
},
92 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "RedactionStyle", SID_REDACTION_STYLE
},
93 { reinterpret_cast<SfxType
*>(&aSfxStringItem_Impl
), "AdditionsTag", SID_ADDITIONS_TAG
},
96 sal_uInt16
const nMediaArgsCount
= SAL_N_ELEMENTS(aFormalArgs
);
98 char const sTemplateRegionName
[] = "TemplateRegionName";
99 char const sTemplateName
[] = "TemplateName";
100 char const sAsTemplate
[] = "AsTemplate";
101 char const sOpenNewView
[] = "OpenNewView";
102 char const sViewId
[] = "ViewId";
103 char const sPluginMode
[] = "PluginMode";
104 char const sReadOnly
[] = "ReadOnly";
105 char const sDdeReconnect
[] = "DDEReconnect";
106 char const sStartPresentation
[] = "StartPresentation";
107 char const sFrameName
[] = "FrameName";
108 char const sMediaType
[] = "MediaType";
109 char const sPostData
[] = "PostData";
110 char const sCharacterSet
[] = "CharacterSet";
111 char const sInputStream
[] = "InputStream";
112 char const sStream
[] = "Stream";
113 char const sOutputStream
[] = "OutputStream";
114 char const sHidden
[] = "Hidden";
115 char const sPreview
[] = "Preview";
116 char const sViewOnly
[] = "ViewOnly";
117 char const sDontEdit
[] = "DontEdit";
118 char const sSilent
[] = "Silent";
119 char const sJumpMark
[] = "JumpMark";
120 char const sSalvagedFile
[] = "SalvagedFile";
121 char const sStatusInd
[] = "StatusIndicator";
122 char const sModel
[] = "Model";
123 char const sFrame
[] = "Frame";
124 char const sViewData
[] = "ViewData";
125 char const sFilterData
[] = "FilterData";
126 char const sSelectionOnly
[] = "SelectionOnly";
127 char const sMacroExecMode
[] = "MacroExecutionMode";
128 char const sUpdateDocMode
[] = "UpdateDocMode";
129 char const sMinimized
[] = "Minimized";
130 char const sInteractionHdl
[] = "InteractionHandler";
131 char const sUCBContent
[] = "UCBContent";
132 char const sRepairPackage
[] = "RepairPackage";
133 char const sDocumentTitle
[] = "DocumentTitle";
134 char const sComponentData
[] = "ComponentData";
135 char const sComponentContext
[] = "ComponentContext";
136 char const sDocumentBaseURL
[] = "DocumentBaseURL";
137 char const sHierarchicalDocumentName
[] = "HierarchicalDocumentName";
138 char const sCopyStreamIfPossible
[] = "CopyStreamIfPossible";
139 char const sNoAutoSave
[] = "NoAutoSave";
140 char const sFolderName
[] = "FolderName";
141 char const sUseSystemDialog
[] = "UseSystemDialog";
142 char const sStandardDir
[] = "StandardDir";
143 char const sDenyList
[] = "DenyList";
144 char const sModifyPasswordInfo
[] = "ModifyPasswordInfo";
145 char const sSuggestedSaveAsDir
[] = "SuggestedSaveAsDir";
146 char const sSuggestedSaveAsName
[] = "SuggestedSaveAsName";
147 char const sEncryptionData
[] = "EncryptionData";
148 char const sFailOnWarning
[] = "FailOnWarning";
149 char const sDocumentService
[] = "DocumentService";
150 char const sFilterProvider
[] = "FilterProvider";
151 char const sImageFilter
[] = "ImageFilter";
152 char const sLockContentExtraction
[] = "LockContentExtraction";
153 char const sLockExport
[] = "LockExport";
154 char const sLockPrint
[] = "LockPrint";
155 char const sLockSave
[] = "LockSave";
156 char const sLockEditDoc
[] = "LockEditDoc";
157 char const sReplaceable
[] = "Replaceable";
159 static bool isMediaDescriptor( sal_uInt16 nSlotId
)
161 return ( nSlotId
== SID_OPENDOC
|| nSlotId
== SID_EXPORTDOC
||
162 nSlotId
== SID_SAVEASDOC
|| nSlotId
== SID_SAVEDOC
||
163 nSlotId
== SID_SAVETO
|| nSlotId
== SID_SAVEACOPY
||
164 nSlotId
== SID_EXPORTDOCASPDF
|| nSlotId
== SID_DIRECTEXPORTDOCASPDF
||
165 nSlotId
== SID_EXPORTDOCASEPUB
|| nSlotId
== SID_DIRECTEXPORTDOCASEPUB
||
166 nSlotId
== SID_REDACTDOC
|| nSlotId
== SID_AUTOREDACTDOC
||
167 nSlotId
== SID_SAVEACOPYITEM
);
170 void TransformParameters( sal_uInt16 nSlotId
, const uno::Sequence
<beans::PropertyValue
>& rArgs
, SfxAllItemSet
& rSet
, const SfxSlot
* pSlot
)
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()->GetWhich(nSlotId
);
199 bool bConvertTwips
= ( rSet
.GetPool()->GetMetric( nWhich
) == MapUnit::MapTwip
);
200 pItem
->SetWhich( nWhich
);
201 sal_uInt16 nSubCount
= pType
->nAttribs
;
203 const beans::PropertyValue
& rProp
= pPropsVal
[0];
204 const OUString
& rName
= rProp
.Name
;
205 if ( nCount
== 1 && rName
== OUString( pSlot
->pUnoName
, strlen( pSlot
->pUnoName
), RTL_TEXTENCODING_UTF8
) )
207 // there is only one parameter and its name matches the name of the property,
208 // so it's either a simple property or a complex property in one single UNO struct
209 if( pItem
->PutValue( rProp
.Value
, bConvertTwips
? CONVERT_TWIPS
: 0 ) )
210 // only use successfully converted items
214 SAL_WARN( "sfx", "Property not convertible: " << pSlot
->pUnoName
);
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 OString aStr
= OString::Concat(pSlot
->pUnoName
) + "." + pType
->aAttrib
[nSub
].pName
;
246 if ( rPropValue
.Name
.equalsAsciiL(aStr
.getStr(), aStr
.getLength()) )
248 sal_uInt8 nSubId
= static_cast<sal_uInt8
>(static_cast<sal_Int8
>(pType
->aAttrib
[nSub
].nAID
));
250 nSubId
|= CONVERT_TWIPS
;
251 if ( pItem
->PutValue( rPropValue
.Value
, nSubId
) )
255 SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot
->pUnoName
);
261 // there was a parameter with a name that didn't match to any of the members
262 SAL_WARN_IF( nSub
>= nSubCount
, "sfx.appl", "Property name does not match: " << rPropValue
.Name
);
265 // at least one part of the complex item must be present; other parts can have default values
274 // detect parameters that don't match to any formal argument or one of its members
275 sal_Int32 nFoundArgs
= 0;
278 bool bIsMediaDescriptor
= isMediaDescriptor( nSlotId
);
279 sal_uInt16 nMaxArgs
= bIsMediaDescriptor
? nMediaArgsCount
: pSlot
->nArgDefCount
;
280 for ( sal_uInt16 nArgs
=0; nArgs
<nMaxArgs
; nArgs
++ )
282 const SfxFormalArgument
&rArg
= bIsMediaDescriptor
? aFormalArgs
[nArgs
] : pSlot
->GetFormalArgument( nArgs
);
283 std::unique_ptr
<SfxPoolItem
> pItem(rArg
.CreateItem());
286 SAL_WARN( "sfx", "No creator method for argument: " << rArg
.pName
);
290 sal_uInt16 nWhich
= rSet
.GetPool()->GetWhich(rArg
.nSlotId
);
291 bool bConvertTwips
= ( rSet
.GetPool()->GetMetric( nWhich
) == MapUnit::MapTwip
);
292 pItem
->SetWhich( nWhich
);
293 const SfxType
* pType
= rArg
.pType
;
294 sal_uInt16 nSubCount
= pType
->nAttribs
;
295 if ( nSubCount
== 0 )
297 // "simple" (base type) argument
298 auto pProp
= std::find_if(rArgs
.begin(), rArgs
.end(),
299 [&rArg
](const beans::PropertyValue
& rProp
) { return rProp
.Name
.equalsAscii(rArg
.pName
); });
300 if (pProp
!= rArgs
.end())
305 if( pItem
->PutValue( pProp
->Value
, 0 ) )
306 // only use successfully converted items
310 SAL_WARN( "sfx", "Property not convertible: " << rArg
.pName
);
316 // complex argument, could be passed in one struct
317 bool bAsWholeItem
= false;
318 for ( const beans::PropertyValue
& rProp
: rArgs
)
320 const OUString
& rName
= rProp
.Name
;
321 if ( rName
== OUString(rArg
.pName
, strlen(rArg
.pName
), RTL_TEXTENCODING_UTF8
) )
327 if( pItem
->PutValue( rProp
.Value
, 0 ) )
328 // only use successfully converted items
332 SAL_WARN( "sfx", "Property not convertible: " << rArg
.pName
);
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?)
343 for ( const beans::PropertyValue
& rProp
: rArgs
)
345 for ( sal_uInt16 nSub
=0; nSub
<nSubCount
; nSub
++ )
347 // search sub item by name
348 OString aStr
= OString::Concat(rArg
.pName
) + "." + pType
->aAttrib
[nSub
].pName
;
349 if ( rProp
.Name
.equalsAsciiL(aStr
.getStr(), aStr
.getLength()) )
351 // at least one member found ...
356 sal_uInt8 nSubId
= static_cast<sal_uInt8
>(static_cast<sal_Int8
>(pType
->aAttrib
[nSub
].nAID
));
358 nSubId
|= CONVERT_TWIPS
;
359 if (!pItem
->PutValue( rProp
.Value
, nSubId
) )
361 // ... but it was not convertible
363 SAL_WARN( "sfx", "Property not convertible: " << rArg
.pName
);
372 // only use successfully converted items
379 // special additional parameters for some slots not seen in the slot definitions
380 // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
381 // but as dispatching or factory or arbitrary URLs to the frame
382 // Some also can use additional arguments that are not recordable (will be changed later,
383 // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
384 if ( nSlotId
== SID_NEWWINDOW
)
386 for ( const beans::PropertyValue
& rProp
: rArgs
)
388 const OUString
& rName
= rProp
.Name
;
389 if ( rName
== sFrame
)
391 Reference
< XFrame
> xFrame
;
392 OSL_VERIFY( rProp
.Value
>>= xFrame
);
393 rSet
.Put( SfxUnoFrameItem( SID_FILLFRAME
, xFrame
) );
396 if ( rName
== sHidden
)
399 if (rProp
.Value
>>= bVal
)
400 rSet
.Put( SfxBoolItem( SID_HIDDEN
, bVal
) );
404 else if ( bIsMediaDescriptor
)
406 for ( const beans::PropertyValue
& rProp
: rArgs
)
411 const OUString
& aName
= rProp
.Name
;
412 if ( aName
== sModel
)
413 rSet
.Put( SfxUnoAnyItem( SID_DOCUMENT
, rProp
.Value
) );
414 else if ( aName
== sComponentData
)
416 rSet
.Put( SfxUnoAnyItem( SID_COMPONENTDATA
, rProp
.Value
) );
418 else if ( aName
== sComponentContext
)
420 rSet
.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT
, rProp
.Value
) );
422 else if ( aName
== sStatusInd
)
424 Reference
<task::XStatusIndicator
> xVal
;
425 bool bOK
= (rProp
.Value
>>= xVal
);
426 DBG_ASSERT( bOK
, "invalid type for StatusIndicator" );
427 if (bOK
&& xVal
.is())
428 rSet
.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL
, rProp
.Value
) );
430 else if ( aName
== sInteractionHdl
)
432 Reference
<task::XInteractionHandler
> xVal
;
433 bool bOK
= (rProp
.Value
>>= xVal
);
434 DBG_ASSERT( bOK
, "invalid type for InteractionHandler" );
435 if (bOK
&& xVal
.is())
436 rSet
.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER
, rProp
.Value
) );
438 else if ( aName
== sViewData
)
439 rSet
.Put( SfxUnoAnyItem( SID_VIEW_DATA
, rProp
.Value
) );
440 else if ( aName
== sFilterData
)
441 rSet
.Put( SfxUnoAnyItem( SID_FILTER_DATA
, rProp
.Value
) );
442 else if ( aName
== sInputStream
)
444 Reference
< XInputStream
> xVal
;
445 bool bOK
= ((rProp
.Value
>>= xVal
) && xVal
.is());
446 DBG_ASSERT( bOK
, "invalid type for InputStream" );
448 rSet
.Put( SfxUnoAnyItem( SID_INPUTSTREAM
, rProp
.Value
) );
450 else if ( aName
== sStream
)
452 Reference
< XInputStream
> xVal
;
453 bool bOK
= ((rProp
.Value
>>= xVal
) && xVal
.is());
454 DBG_ASSERT( bOK
, "invalid type for Stream" );
456 rSet
.Put( SfxUnoAnyItem( SID_STREAM
, rProp
.Value
) );
458 else if ( aName
== sUCBContent
)
460 Reference
< XContent
> xVal
;
461 bool bOK
= ((rProp
.Value
>>= xVal
) && xVal
.is());
462 DBG_ASSERT( bOK
, "invalid type for UCBContent" );
464 rSet
.Put( SfxUnoAnyItem( SID_CONTENT
, rProp
.Value
) );
466 else if ( aName
== sOutputStream
)
468 Reference
< XOutputStream
> xVal
;
469 bool bOK
= ((rProp
.Value
>>= xVal
) && xVal
.is());
470 DBG_ASSERT( bOK
, "invalid type for OutputStream" );
472 rSet
.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM
, rProp
.Value
) );
474 else if ( aName
== sPostData
)
476 Reference
< XInputStream
> xVal
;
477 bool bOK
= (rProp
.Value
>>= xVal
);
478 DBG_ASSERT( bOK
, "invalid type for PostData" );
480 rSet
.Put( SfxUnoAnyItem( SID_POSTDATA
, rProp
.Value
) );
482 else if ( aName
== sFrame
)
484 Reference
< XFrame
> xFrame
;
485 bool bOK
= (rProp
.Value
>>= xFrame
);
486 DBG_ASSERT( bOK
, "invalid type for Frame" );
488 rSet
.Put( SfxUnoFrameItem( SID_FILLFRAME
, xFrame
) );
490 else if ( aName
== sAsTemplate
)
493 bool bOK
= (rProp
.Value
>>= bVal
);
494 DBG_ASSERT( bOK
, "invalid type for AsTemplate" );
496 rSet
.Put( SfxBoolItem( SID_TEMPLATE
, bVal
) );
498 else if ( aName
== sOpenNewView
)
501 bool bOK
= (rProp
.Value
>>= bVal
);
502 DBG_ASSERT( bOK
, "invalid type for OpenNewView" );
504 rSet
.Put( SfxBoolItem( SID_OPEN_NEW_VIEW
, bVal
) );
506 else if ( aName
== sFailOnWarning
)
509 bool bOK
= (rProp
.Value
>>= bVal
);
510 DBG_ASSERT( bOK
, "invalid type for FailOnWarning" );
512 rSet
.Put( SfxBoolItem( SID_FAIL_ON_WARNING
, bVal
) );
514 else if ( aName
== sViewId
)
517 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
518 DBG_ASSERT( bOK
, "invalid type for ViewId" );
520 rSet
.Put( SfxUInt16Item( SID_VIEW_ID
, nVal
) );
522 else if ( aName
== sPluginMode
)
525 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
526 DBG_ASSERT( bOK
, "invalid type for PluginMode" );
528 rSet
.Put( SfxUInt16Item( SID_PLUGIN_MODE
, nVal
) );
530 else if ( aName
== sReadOnly
)
533 bool bOK
= (rProp
.Value
>>= bVal
);
534 DBG_ASSERT( bOK
, "invalid type for ReadOnly" );
536 rSet
.Put( SfxBoolItem( SID_DOC_READONLY
, bVal
) );
538 else if ( aName
== sDdeReconnect
)
541 bool bOK
= (rProp
.Value
>>= bVal
);
542 DBG_ASSERT( bOK
, "invalid type for DDEReconnect" );
544 rSet
.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD
, bVal
) );
546 else if ( aName
== sStartPresentation
)
549 bool bOK
= (rProp
.Value
>>= bVal
);
550 DBG_ASSERT( bOK
, "invalid type for StartPresentation" );
552 rSet
.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION
, bVal
) );
554 else if ( aName
== sSelectionOnly
)
557 bool bOK
= (rProp
.Value
>>= bVal
);
558 DBG_ASSERT( bOK
, "invalid type for SelectionOnly" );
560 rSet
.Put( SfxBoolItem( SID_SELECTION
, bVal
) );
562 else if ( aName
== sHidden
)
565 bool bOK
= (rProp
.Value
>>= bVal
);
566 DBG_ASSERT( bOK
, "invalid type for Hidden" );
568 rSet
.Put( SfxBoolItem( SID_HIDDEN
, bVal
) );
570 else if ( aName
== sMinimized
)
573 bool bOK
= (rProp
.Value
>>= bVal
);
574 DBG_ASSERT( bOK
, "invalid type for Minimized" );
576 rSet
.Put( SfxBoolItem( SID_MINIMIZED
, bVal
) );
578 else if ( aName
== sSilent
)
581 bool bOK
= (rProp
.Value
>>= bVal
);
582 DBG_ASSERT( bOK
, "invalid type for Silent" );
584 rSet
.Put( SfxBoolItem( SID_SILENT
, bVal
) );
586 else if ( aName
== sPreview
)
589 bool bOK
= (rProp
.Value
>>= bVal
);
590 DBG_ASSERT( bOK
, "invalid type for Preview" );
592 rSet
.Put( SfxBoolItem( SID_PREVIEW
, bVal
) );
594 else if ( aName
== sViewOnly
)
597 bool bOK
= (rProp
.Value
>>= bVal
);
598 DBG_ASSERT( bOK
, "invalid type for ViewOnly" );
600 rSet
.Put( SfxBoolItem( SID_VIEWONLY
, bVal
) );
602 else if ( aName
== sDontEdit
)
605 bool bOK
= (rProp
.Value
>>= bVal
);
606 DBG_ASSERT( bOK
, "invalid type for ViewOnly" );
608 rSet
.Put( SfxBoolItem( SID_EDITDOC
, !bVal
) );
610 else if ( aName
== sUseSystemDialog
)
613 bool bOK
= (rProp
.Value
>>= bVal
);
614 DBG_ASSERT( bOK
, "invalid type for ViewOnly" );
616 rSet
.Put( SfxBoolItem( SID_FILE_DIALOG
, bVal
) );
618 else if ( aName
== sStandardDir
)
621 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
622 DBG_ASSERT( bOK
, "invalid type or value for StandardDir" );
624 rSet
.Put( SfxStringItem( SID_STANDARD_DIR
, sVal
) );
626 else if ( aName
== sDenyList
)
628 uno::Sequence
<OUString
> xVal
;
629 bool bOK
= (rProp
.Value
>>= xVal
);
630 DBG_ASSERT( bOK
, "invalid type or value for DenyList" );
633 SfxStringListItem
stringList(SID_DENY_LIST
);
634 stringList
.SetStringList( xVal
);
635 rSet
.Put( stringList
);
638 else if ( aName
== "FileName" )
641 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
642 DBG_ASSERT( bOK
, "invalid type or value for FileName" );
644 rSet
.Put( SfxStringItem( SID_FILE_NAME
, sVal
) );
646 else if ( aName
== sSalvagedFile
)
649 bool bOK
= (rProp
.Value
>>= sVal
);
650 DBG_ASSERT( bOK
, "invalid type or value for SalvagedFile" );
652 rSet
.Put( SfxStringItem( SID_DOC_SALVAGE
, sVal
) );
654 else if ( aName
== sFolderName
)
657 bool bOK
= (rProp
.Value
>>= sVal
);
658 DBG_ASSERT( bOK
, "invalid type or value for FolderName" );
660 rSet
.Put( SfxStringItem( SID_PATH
, sVal
) );
662 else if ( aName
== sFrameName
)
665 bool bOK
= (rProp
.Value
>>= sVal
);
666 DBG_ASSERT( bOK
, "invalid type for FrameName" );
667 if (bOK
&& !sVal
.isEmpty())
668 rSet
.Put( SfxStringItem( SID_TARGETNAME
, sVal
) );
670 else if ( aName
== sMediaType
)
673 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
674 DBG_ASSERT( bOK
, "invalid type or value for MediaType" );
676 rSet
.Put( SfxStringItem( SID_CONTENTTYPE
, sVal
) );
678 else if ( aName
== sTemplateName
)
681 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
682 DBG_ASSERT( bOK
, "invalid type or value for TemplateName" );
684 rSet
.Put( SfxStringItem( SID_TEMPLATE_NAME
, sVal
) );
686 else if ( aName
== sTemplateRegionName
)
689 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
690 DBG_ASSERT( bOK
, "invalid type or value for TemplateRegionName" );
692 rSet
.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME
, sVal
) );
694 else if ( aName
== sJumpMark
)
697 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
698 DBG_ASSERT( bOK
, "invalid type or value for JumpMark" );
700 rSet
.Put( SfxStringItem( SID_JUMPMARK
, sVal
) );
702 else if ( aName
== sCharacterSet
)
705 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
706 DBG_ASSERT( bOK
, "invalid type or value for CharacterSet" );
708 rSet
.Put( SfxStringItem( SID_CHARSET
, sVal
) );
710 else if ( aName
== "FilterFlags" )
713 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
714 DBG_ASSERT( bOK
, "invalid type or value for FilterFlags" );
716 rSet
.Put( SfxStringItem( SID_FILE_FILTEROPTIONS
, sVal
) );
718 else if ( aName
== sImageFilter
)
721 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
722 DBG_ASSERT( bOK
, "invalid type or value for FilterFlags" );
724 rSet
.Put( SfxStringItem( SID_CONVERT_IMAGES
, sVal
) );
726 else if ( aName
== sMacroExecMode
)
729 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
730 DBG_ASSERT( bOK
, "invalid type for MacroExecMode" );
732 rSet
.Put( SfxUInt16Item( SID_MACROEXECMODE
, nVal
) );
734 else if ( aName
== sUpdateDocMode
)
737 bool bOK
= ((rProp
.Value
>>= nVal
) && (nVal
!= -1));
738 DBG_ASSERT( bOK
, "invalid type for UpdateDocMode" );
740 rSet
.Put( SfxUInt16Item( SID_UPDATEDOCMODE
, nVal
) );
742 else if ( aName
== sRepairPackage
)
745 bool bOK
= (rProp
.Value
>>= bVal
);
746 DBG_ASSERT( bOK
, "invalid type for RepairPackage" );
748 rSet
.Put( SfxBoolItem( SID_REPAIRPACKAGE
, bVal
) );
750 else if ( aName
== sDocumentTitle
)
753 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
754 DBG_ASSERT( bOK
, "invalid type or value for DocumentTitle" );
756 rSet
.Put( SfxStringItem( SID_DOCINFO_TITLE
, sVal
) );
758 else if ( aName
== sDocumentBaseURL
)
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" );
765 rSet
.Put( SfxStringItem( SID_DOC_BASEURL
, sVal
) );
767 else if ( aName
== sHierarchicalDocumentName
)
770 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
771 DBG_ASSERT( bOK
, "invalid type or value for HierarchicalDocumentName" );
773 rSet
.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME
, sVal
) );
775 else if ( aName
== sCopyStreamIfPossible
)
778 bool bOK
= (rProp
.Value
>>= bVal
);
779 DBG_ASSERT( bOK
, "invalid type for CopyStreamIfPossible" );
781 rSet
.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE
, bVal
) );
783 else if ( aName
== sNoAutoSave
)
786 bool bOK
= (rProp
.Value
>>= bVal
);
787 DBG_ASSERT( bOK
, "invalid type for NoAutoSave" );
789 rSet
.Put( SfxBoolItem( SID_NOAUTOSAVE
, bVal
) );
791 else if ( aName
== sModifyPasswordInfo
)
793 rSet
.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO
, rProp
.Value
) );
795 else if ( aName
== sEncryptionData
)
797 rSet
.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA
, rProp
.Value
) );
799 else if ( aName
== sSuggestedSaveAsDir
)
802 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
803 DBG_ASSERT( bOK
, "invalid type or value for SuggestedSaveAsDir" );
805 rSet
.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR
, sVal
) );
807 else if ( aName
== sSuggestedSaveAsName
)
810 bool bOK
= ((rProp
.Value
>>= sVal
) && !sVal
.isEmpty());
811 DBG_ASSERT( bOK
, "invalid type or value for SuggestedSaveAsName" );
813 rSet
.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME
, sVal
) );
815 else if (aName
== sDocumentService
)
818 bool bOK
= ((rProp
.Value
>>= aVal
) && !aVal
.isEmpty());
820 rSet
.Put(SfxStringItem(SID_DOC_SERVICE
, aVal
));
822 else if (aName
== sFilterProvider
)
825 bool bOK
= ((rProp
.Value
>>= aVal
) && !aVal
.isEmpty());
827 rSet
.Put(SfxStringItem(SID_FILTER_PROVIDER
, aVal
));
829 else if (aName
== sLockContentExtraction
)
832 bool bOK
= (rProp
.Value
>>= bVal
);
833 DBG_ASSERT( bOK
, "invalid type for LockContentExtraction" );
835 rSet
.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION
, bVal
) );
837 else if (aName
== sLockExport
)
840 bool bOK
= (rProp
.Value
>>= bVal
);
841 DBG_ASSERT( bOK
, "invalid type for LockExport" );
843 rSet
.Put( SfxBoolItem( SID_LOCK_EXPORT
, bVal
) );
845 else if (aName
== sLockPrint
)
848 bool bOK
= (rProp
.Value
>>= bVal
);
849 DBG_ASSERT( bOK
, "invalid type for LockPrint" );
851 rSet
.Put( SfxBoolItem( SID_LOCK_PRINT
, bVal
) );
853 else if (aName
== sLockSave
)
856 bool bOK
= (rProp
.Value
>>= bVal
);
857 DBG_ASSERT( bOK
, "invalid type for LockSave" );
859 rSet
.Put( SfxBoolItem( SID_LOCK_SAVE
, bVal
) );
861 else if (aName
== sLockEditDoc
)
864 bool bOK
= (rProp
.Value
>>= bVal
);
865 DBG_ASSERT( bOK
, "invalid type for LockEditDoc" );
867 rSet
.Put( SfxBoolItem( SID_LOCK_EDITDOC
, bVal
) );
869 else if (aName
== sReplaceable
)
872 bool bOK
= (rProp
.Value
>>= bVal
);
873 DBG_ASSERT(bOK
, "invalid type for Replaceable");
875 rSet
.Put(SfxBoolItem(SID_REPLACEABLE
, bVal
));
883 // API to raise options dialog with a specified options ab page (#i83757#)
886 // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
887 if ( "OptionsTreeDialog" == OUString( pSlot
->pUnoName
, strlen(pSlot
->pUnoName
), RTL_TEXTENCODING_UTF8
) )
889 auto pProp
= std::find_if(rArgs
.begin(), rArgs
.end(),
890 [](const PropertyValue
& rProp
) { return rProp
.Name
== "OptionsPageURL"; });
891 if (pProp
!= rArgs
.end())
894 if ( pProp
->Value
>>= sURL
)
895 rSet
.Put( SfxStringItem( SID_OPTIONS_PAGEURL
, sURL
) );
900 if ( nFoundArgs
== nCount
)
902 // except for the "special" slots: assure that every argument was convertible
903 SAL_INFO( "sfx.appl", "MacroPlayer: Some properties didn't match to any formal argument for slot: "<< pSlot
->pUnoName
);
908 void TransformItems( sal_uInt16 nSlotId
, const SfxItemSet
& rSet
, uno::Sequence
<beans::PropertyValue
>& rArgs
, const SfxSlot
* pSlot
)
911 pSlot
= SFX_SLOTPOOL().GetSlot( nSlotId
);
916 if ( nSlotId
== SID_OPENURL
)
917 nSlotId
= SID_OPENDOC
;
918 if ( nSlotId
== SID_SAVEASREMOTE
)
919 nSlotId
= SID_SAVEASDOC
;
921 // find number of properties to avoid permanent reallocations in the sequence
925 // trace number of items and compare with number of properties for debugging purposes
929 const SfxType
*pType
= pSlot
->GetType();
930 if ( !pSlot
->IsMode(SfxSlotMode::METHOD
) )
932 // slot is a property
933 sal_uInt16 nWhich
= rSet
.GetPool()->GetWhich(nSlotId
);
934 if ( rSet
.GetItemState( nWhich
) == SfxItemState::SET
) //???
936 sal_uInt16 nSubCount
= pType
->nAttribs
;
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
942 // simple property: we expect to get exactly one item
947 // we will not rely on the "toggle" ability of some property slots
948 SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId
);
958 bool bIsMediaDescriptor
= isMediaDescriptor( nSlotId
);
959 sal_uInt16 nFormalArgs
= bIsMediaDescriptor
? nMediaArgsCount
: pSlot
->GetFormalArgumentCount();
960 for ( sal_uInt16 nArg
=0; nArg
<nFormalArgs
; ++nArg
)
962 // check every formal argument of the method
963 const SfxFormalArgument
&rArg
= bIsMediaDescriptor
? aFormalArgs
[nArg
] : pSlot
->GetFormalArgument( nArg
);
965 sal_uInt16 nWhich
= rSet
.GetPool()->GetWhich( rArg
.nSlotId
);
966 if ( rSet
.GetItemState( nWhich
) == SfxItemState::SET
) //???
968 sal_uInt16 nSubCount
= rArg
.pType
->nAttribs
;
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
974 // argument of simple type: we expect to get exactly one item for it
982 // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
983 if ( bIsMediaDescriptor
)
985 sal_Int32 nAdditional
=0;
986 if ( rSet
.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL
) == SfxItemState::SET
)
988 if ( rSet
.GetItemState( SID_INTERACTIONHANDLER
) == SfxItemState::SET
)
990 if ( rSet
.GetItemState( SID_DOC_SALVAGE
) == SfxItemState::SET
)
992 if ( rSet
.GetItemState( SID_PATH
) == SfxItemState::SET
)
994 if ( rSet
.GetItemState( SID_FILE_DIALOG
) == SfxItemState::SET
)
996 if ( rSet
.GetItemState( SID_STANDARD_DIR
) == SfxItemState::SET
)
998 if ( rSet
.GetItemState( SID_DENY_LIST
) == SfxItemState::SET
)
1000 if ( rSet
.GetItemState( SID_CONTENT
) == SfxItemState::SET
)
1002 if ( rSet
.GetItemState( SID_INPUTSTREAM
) == SfxItemState::SET
)
1004 if ( rSet
.GetItemState( SID_STREAM
) == SfxItemState::SET
)
1006 if ( rSet
.GetItemState( SID_OUTPUTSTREAM
) == SfxItemState::SET
)
1008 if ( rSet
.GetItemState( SID_TEMPLATE
) == SfxItemState::SET
)
1010 if ( rSet
.GetItemState( SID_OPEN_NEW_VIEW
) == SfxItemState::SET
)
1012 if ( rSet
.GetItemState( SID_FAIL_ON_WARNING
) == SfxItemState::SET
)
1014 if ( rSet
.GetItemState( SID_VIEW_ID
) == SfxItemState::SET
)
1016 if ( rSet
.GetItemState( SID_VIEW_DATA
) == SfxItemState::SET
)
1018 if ( rSet
.GetItemState( SID_FILTER_DATA
) == SfxItemState::SET
)
1020 if ( rSet
.GetItemState( SID_PLUGIN_MODE
) == SfxItemState::SET
)
1022 if ( rSet
.GetItemState( SID_DOC_READONLY
) == SfxItemState::SET
)
1024 if ( rSet
.GetItemState( SID_DDE_RECONNECT_ONLOAD
) == SfxItemState::SET
)
1026 if ( rSet
.GetItemState( SID_DOC_STARTPRESENTATION
) == SfxItemState::SET
)
1028 if ( rSet
.GetItemState( SID_SELECTION
) == SfxItemState::SET
)
1030 if ( rSet
.GetItemState( SID_CONTENTTYPE
) == SfxItemState::SET
)
1032 if ( rSet
.GetItemState( SID_POSTDATA
) == SfxItemState::SET
)
1034 if ( rSet
.GetItemState( SID_FILLFRAME
) == SfxItemState::SET
)
1036 if ( rSet
.GetItemState( SID_CHARSET
) == SfxItemState::SET
)
1038 if ( rSet
.GetItemState( SID_TARGETNAME
) == SfxItemState::SET
)
1040 if ( rSet
.GetItemState( SID_TEMPLATE_NAME
) == SfxItemState::SET
)
1042 if ( rSet
.GetItemState( SID_TEMPLATE_REGIONNAME
) == SfxItemState::SET
)
1044 if ( rSet
.GetItemState( SID_HIDDEN
) == SfxItemState::SET
)
1046 if ( rSet
.GetItemState( SID_MINIMIZED
) == SfxItemState::SET
)
1048 if ( rSet
.GetItemState( SID_PREVIEW
) == SfxItemState::SET
)
1050 if ( rSet
.GetItemState( SID_VIEWONLY
) == SfxItemState::SET
)
1052 if ( rSet
.GetItemState( SID_EDITDOC
) == SfxItemState::SET
)
1054 if ( rSet
.GetItemState( SID_SILENT
) == SfxItemState::SET
)
1056 if ( rSet
.GetItemState( SID_JUMPMARK
) == SfxItemState::SET
)
1058 if ( rSet
.GetItemState( SID_DOCUMENT
) == SfxItemState::SET
)
1060 if ( rSet
.GetItemState( SID_MACROEXECMODE
) == SfxItemState::SET
)
1062 if ( rSet
.GetItemState( SID_UPDATEDOCMODE
) == SfxItemState::SET
)
1064 if ( rSet
.GetItemState( SID_REPAIRPACKAGE
) == SfxItemState::SET
)
1066 if ( rSet
.GetItemState( SID_DOCINFO_TITLE
) == SfxItemState::SET
)
1068 if ( rSet
.GetItemState( SID_COMPONENTDATA
) == SfxItemState::SET
)
1070 if ( rSet
.GetItemState( SID_COMPONENTCONTEXT
) == SfxItemState::SET
)
1072 if ( rSet
.GetItemState( SID_DOC_BASEURL
) == SfxItemState::SET
)
1074 if ( rSet
.GetItemState( SID_DOC_HIERARCHICALNAME
) == SfxItemState::SET
)
1076 if ( rSet
.GetItemState( SID_COPY_STREAM_IF_POSSIBLE
) == SfxItemState::SET
)
1078 if ( rSet
.GetItemState( SID_NOAUTOSAVE
) == SfxItemState::SET
)
1080 if ( rSet
.GetItemState( SID_MODIFYPASSWORDINFO
) == SfxItemState::SET
)
1082 if ( rSet
.GetItemState( SID_SUGGESTEDSAVEASDIR
) == SfxItemState::SET
)
1084 if ( rSet
.GetItemState( SID_ENCRYPTIONDATA
) == SfxItemState::SET
)
1086 if ( rSet
.GetItemState( SID_SUGGESTEDSAVEASNAME
) == SfxItemState::SET
)
1088 if ( rSet
.GetItemState( SID_DOC_SERVICE
) == SfxItemState::SET
)
1090 if (rSet
.HasItem(SID_FILTER_PROVIDER
))
1092 if ( rSet
.GetItemState( SID_CONVERT_IMAGES
) == SfxItemState::SET
)
1094 if ( rSet
.GetItemState( SID_LOCK_CONTENT_EXTRACTION
) == SfxItemState::SET
)
1096 if ( rSet
.GetItemState( SID_LOCK_EXPORT
) == SfxItemState::SET
)
1098 if ( rSet
.GetItemState( SID_LOCK_PRINT
) == SfxItemState::SET
)
1100 if ( rSet
.GetItemState( SID_LOCK_SAVE
) == SfxItemState::SET
)
1102 if ( rSet
.GetItemState( SID_LOCK_EDITDOC
) == SfxItemState::SET
)
1104 if (rSet
.GetItemState(SID_REPLACEABLE
) == SfxItemState::SET
)
1107 // consider additional arguments
1108 nProps
+= nAdditional
;
1110 nItems
+= nAdditional
;
1116 // now check the itemset: is there any item that is not convertible using the list of formal arguments
1117 // or the table of additional items?!
1118 if ( rSet
.Count() != nItems
)
1120 // detect unknown item and present error message
1121 const sal_uInt16
*pRanges
= rSet
.GetRanges();
1124 sal_uInt16 nStartWhich
= *pRanges
++;
1125 sal_uInt16 nEndWhich
= *pRanges
++;
1126 for(sal_uInt16 nId
= nStartWhich
; nId
<= nEndWhich
; ++nId
)
1128 if ( rSet
.GetItemState(nId
) < SfxItemState::SET
) //???
1132 if ( !pSlot
->IsMode(SfxSlotMode::METHOD
) && nId
== rSet
.GetPool()->GetWhich( 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()->GetWhich( 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()->GetWhich(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
= OUString::createFromAscii(pSlot
->pUnoName
) ;
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
->aAttrib
[n
-1].nAID
));
1315 if ( bConvertTwips
)
1316 nSubId
|= CONVERT_TWIPS
;
1318 DBG_ASSERT(( pType
->aAttrib
[n
-1].nAID
) <= 127, "Member ID out of range" );
1319 pValue
[nActProp
].Name
= OUString::createFromAscii( pSlot
->pUnoName
) +
1321 OUString::createFromAscii( pType
->aAttrib
[n
-1].pName
);
1322 if ( !pItem
->QueryValue( pValue
[nActProp
++].Value
, nSubId
) )
1324 SAL_WARN( "sfx", "Sub item " << pType
->aAttrib
[n
-1].nAID
1325 << " not convertible in slot: " << nSlotId
);
1336 sal_uInt16 nFormalArgs
= pSlot
->GetFormalArgumentCount();
1337 for ( sal_uInt16 nArg
=0; nArg
<nFormalArgs
; ++nArg
)
1339 const SfxFormalArgument
&rArg
= pSlot
->GetFormalArgument( nArg
);
1340 sal_uInt16 nWhich
= rSet
.GetPool()->GetWhich( rArg
.nSlotId
);
1341 bool bConvertTwips
= ( rSet
.GetPool()->GetMetric( nWhich
) == MapUnit::MapTwip
);
1342 const SfxPoolItem
* pItem
= rSet
.GetItem
<SfxPoolItem
>(nWhich
, false);
1345 sal_uInt16 nSubCount
= rArg
.pType
->nAttribs
;
1348 pValue
[nActProp
].Name
= OUString::createFromAscii( rArg
.pName
) ;
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
->aAttrib
[n
-1].nAID
));
1360 if ( bConvertTwips
)
1361 nSubId
|= CONVERT_TWIPS
;
1363 DBG_ASSERT((rArg
.pType
->aAttrib
[n
-1].nAID
) <= 127, "Member ID out of range" );
1364 pValue
[nActProp
].Name
= OUString::createFromAscii( rArg
.pName
) +
1366 OUString::createFromAscii( rArg
.pType
->aAttrib
[n
-1].pName
) ;
1367 if ( !pItem
->QueryValue( pValue
[nActProp
++].Value
, nSubId
) )
1369 SAL_WARN( "sfx", "Sub item "
1370 << rArg
.pType
->aAttrib
[n
-1].nAID
1371 << " not convertible in slot: "
1379 if ( nSlotId
== SID_OPENDOC
|| nSlotId
== SID_EXPORTDOC
|| nSlotId
== SID_SAVEASDOC
|| nSlotId
== SID_SAVEDOC
||
1380 nSlotId
== SID_SAVETO
|| nSlotId
== SID_EXPORTDOCASPDF
|| nSlotId
== SID_DIRECTEXPORTDOCASPDF
||
1381 nSlotId
== SID_EXPORTDOCASEPUB
|| nSlotId
== SID_DIRECTEXPORTDOCASEPUB
||
1382 nSlotId
== SID_REDACTDOC
|| nSlotId
== SID_AUTOREDACTDOC
|| nSlotId
== SID_SAVEACOPY
)
1384 const SfxPoolItem
*pItem
=nullptr;
1385 if ( rSet
.GetItemState( SID_COMPONENTDATA
, false, &pItem
) == SfxItemState::SET
)
1387 pValue
[nActProp
].Name
= sComponentData
;
1388 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1390 if ( rSet
.GetItemState( SID_COMPONENTCONTEXT
, false, &pItem
) == SfxItemState::SET
)
1392 pValue
[nActProp
].Name
= sComponentContext
;
1393 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1395 if ( rSet
.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL
, false, &pItem
) == SfxItemState::SET
)
1397 pValue
[nActProp
].Name
= sStatusInd
;
1398 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1400 if ( rSet
.GetItemState( SID_INTERACTIONHANDLER
, false, &pItem
) == SfxItemState::SET
)
1402 pValue
[nActProp
].Name
= sInteractionHdl
;
1403 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1405 if ( rSet
.GetItemState( SID_VIEW_DATA
, false, &pItem
) == SfxItemState::SET
)
1407 pValue
[nActProp
].Name
= sViewData
;
1408 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1410 if ( rSet
.GetItemState( SID_FILTER_DATA
, false, &pItem
) == SfxItemState::SET
)
1412 pValue
[nActProp
].Name
= sFilterData
;
1413 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1415 if ( rSet
.GetItemState( SID_DOCUMENT
, false, &pItem
) == SfxItemState::SET
)
1417 pValue
[nActProp
].Name
= sModel
;
1418 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1420 if ( rSet
.GetItemState( SID_CONTENT
, false, &pItem
) == SfxItemState::SET
)
1422 pValue
[nActProp
].Name
= sUCBContent
;
1423 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1425 if ( rSet
.GetItemState( SID_INPUTSTREAM
, false, &pItem
) == SfxItemState::SET
)
1427 pValue
[nActProp
].Name
= sInputStream
;
1428 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1430 if ( rSet
.GetItemState( SID_STREAM
, false, &pItem
) == SfxItemState::SET
)
1432 pValue
[nActProp
].Name
= sStream
;
1433 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1435 if ( rSet
.GetItemState( SID_OUTPUTSTREAM
, false, &pItem
) == SfxItemState::SET
)
1437 pValue
[nActProp
].Name
= sOutputStream
;
1438 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1440 if ( rSet
.GetItemState( SID_POSTDATA
, false, &pItem
) == SfxItemState::SET
)
1442 pValue
[nActProp
].Name
= sPostData
;
1443 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1445 if ( rSet
.GetItemState( SID_FILLFRAME
, false, &pItem
) == SfxItemState::SET
)
1447 pValue
[nActProp
].Name
= sFrame
;
1448 if ( auto pUsrAnyItem
= dynamic_cast< const SfxUnoAnyItem
*>( pItem
) )
1450 OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUnoAnyItem is not deprecated!" );
1451 pValue
[nActProp
++].Value
= pUsrAnyItem
->GetValue();
1453 else if ( auto pUnoFrameItem
= dynamic_cast< const SfxUnoFrameItem
*>( pItem
) )
1454 pValue
[nActProp
++].Value
<<= pUnoFrameItem
->GetFrame();
1456 OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1458 if ( rSet
.GetItemState( SID_TEMPLATE
, false, &pItem
) == SfxItemState::SET
)
1460 pValue
[nActProp
].Name
= sAsTemplate
;
1461 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1463 if ( rSet
.GetItemState( SID_OPEN_NEW_VIEW
, false, &pItem
) == SfxItemState::SET
)
1465 pValue
[nActProp
].Name
= sOpenNewView
;
1466 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1468 if ( rSet
.GetItemState( SID_FAIL_ON_WARNING
, false, &pItem
) == SfxItemState::SET
)
1470 pValue
[nActProp
].Name
= sFailOnWarning
;
1471 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1473 if ( rSet
.GetItemState( SID_VIEW_ID
, false, &pItem
) == SfxItemState::SET
)
1475 pValue
[nActProp
].Name
= sViewId
;
1476 pValue
[nActProp
++].Value
<<= static_cast<sal_Int16
>(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue());
1478 if ( rSet
.GetItemState( SID_PLUGIN_MODE
, false, &pItem
) == SfxItemState::SET
)
1480 pValue
[nActProp
].Name
= sPluginMode
;
1481 pValue
[nActProp
++].Value
<<= static_cast<sal_Int16
>(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue());
1483 if ( rSet
.GetItemState( SID_DOC_READONLY
, false, &pItem
) == SfxItemState::SET
)
1485 pValue
[nActProp
].Name
= sReadOnly
;
1486 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1488 if ( rSet
.GetItemState( SID_DDE_RECONNECT_ONLOAD
, false, &pItem
) == SfxItemState::SET
)
1490 pValue
[nActProp
].Name
= sDdeReconnect
;
1491 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1493 if ( rSet
.GetItemState( SID_DOC_STARTPRESENTATION
, false, &pItem
) == SfxItemState::SET
)
1495 pValue
[nActProp
].Name
= sStartPresentation
;
1496 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1498 if ( rSet
.GetItemState( SID_SELECTION
, false, &pItem
) == SfxItemState::SET
)
1500 pValue
[nActProp
].Name
= sSelectionOnly
;
1501 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1503 if ( rSet
.GetItemState( SID_HIDDEN
, false, &pItem
) == SfxItemState::SET
)
1505 pValue
[nActProp
].Name
= sHidden
;
1506 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1508 if ( rSet
.GetItemState( SID_MINIMIZED
, false, &pItem
) == SfxItemState::SET
)
1510 pValue
[nActProp
].Name
= sMinimized
;
1511 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1513 if ( rSet
.GetItemState( SID_SILENT
, false, &pItem
) == SfxItemState::SET
)
1515 pValue
[nActProp
].Name
= sSilent
;
1516 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1518 if ( rSet
.GetItemState( SID_PREVIEW
, false, &pItem
) == SfxItemState::SET
)
1520 pValue
[nActProp
].Name
= sPreview
;
1521 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1523 if ( rSet
.GetItemState( SID_VIEWONLY
, false, &pItem
) == SfxItemState::SET
)
1525 pValue
[nActProp
].Name
= sViewOnly
;
1526 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1528 if ( rSet
.GetItemState( SID_EDITDOC
, false, &pItem
) == SfxItemState::SET
)
1530 pValue
[nActProp
].Name
= sDontEdit
;
1531 pValue
[nActProp
++].Value
<<= !static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1533 if ( rSet
.GetItemState( SID_FILE_DIALOG
, false, &pItem
) == SfxItemState::SET
)
1535 pValue
[nActProp
].Name
= sUseSystemDialog
;
1536 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1538 if ( rSet
.GetItemState( SID_STANDARD_DIR
, false, &pItem
) == SfxItemState::SET
)
1540 pValue
[nActProp
].Name
= sStandardDir
;
1541 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1543 if ( rSet
.GetItemState( SID_DENY_LIST
, false, &pItem
) == SfxItemState::SET
)
1545 pValue
[nActProp
].Name
= sDenyList
;
1547 css::uno::Sequence
< OUString
> aList
;
1548 static_cast<const SfxStringListItem
*>(pItem
)->GetStringList( aList
);
1549 pValue
[nActProp
++].Value
<<= aList
;
1551 if ( rSet
.GetItemState( SID_TARGETNAME
, false, &pItem
) == SfxItemState::SET
)
1553 pValue
[nActProp
].Name
= sFrameName
;
1554 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1556 if ( rSet
.GetItemState( SID_DOC_SALVAGE
, false, &pItem
) == SfxItemState::SET
)
1558 pValue
[nActProp
].Name
= sSalvagedFile
;
1559 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1561 if ( rSet
.GetItemState( SID_PATH
, false, &pItem
) == SfxItemState::SET
)
1563 pValue
[nActProp
].Name
= sFolderName
;
1564 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1566 if ( rSet
.GetItemState( SID_CONTENTTYPE
, false, &pItem
) == SfxItemState::SET
)
1568 pValue
[nActProp
].Name
= sMediaType
;
1569 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1571 if ( rSet
.GetItemState( SID_TEMPLATE_NAME
, false, &pItem
) == SfxItemState::SET
)
1573 pValue
[nActProp
].Name
= sTemplateName
;
1574 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1576 if ( rSet
.GetItemState( SID_TEMPLATE_REGIONNAME
, false, &pItem
) == SfxItemState::SET
)
1578 pValue
[nActProp
].Name
= sTemplateRegionName
;
1579 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1581 if ( rSet
.GetItemState( SID_JUMPMARK
, false, &pItem
) == SfxItemState::SET
)
1583 pValue
[nActProp
].Name
= sJumpMark
;
1584 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1587 if ( rSet
.GetItemState( SID_CHARSET
, false, &pItem
) == SfxItemState::SET
)
1589 pValue
[nActProp
].Name
= sCharacterSet
;
1590 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1592 if ( rSet
.GetItemState( SID_MACROEXECMODE
, false, &pItem
) == SfxItemState::SET
)
1594 pValue
[nActProp
].Name
= sMacroExecMode
;
1595 pValue
[nActProp
++].Value
<<= static_cast<sal_Int16
>(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue());
1597 if ( rSet
.GetItemState( SID_UPDATEDOCMODE
, false, &pItem
) == SfxItemState::SET
)
1599 pValue
[nActProp
].Name
= sUpdateDocMode
;
1600 pValue
[nActProp
++].Value
<<= static_cast<sal_Int16
>(static_cast<const SfxUInt16Item
*>(pItem
)->GetValue());
1602 if ( rSet
.GetItemState( SID_REPAIRPACKAGE
, false, &pItem
) == SfxItemState::SET
)
1604 pValue
[nActProp
].Name
= sRepairPackage
;
1605 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue() ;
1607 if ( rSet
.GetItemState( SID_DOCINFO_TITLE
, false, &pItem
) == SfxItemState::SET
)
1609 pValue
[nActProp
].Name
= sDocumentTitle
;
1610 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1612 if ( rSet
.GetItemState( SID_DOC_BASEURL
, false, &pItem
) == SfxItemState::SET
)
1614 pValue
[nActProp
].Name
= sDocumentBaseURL
;
1615 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1617 if ( rSet
.GetItemState( SID_DOC_HIERARCHICALNAME
, false, &pItem
) == SfxItemState::SET
)
1619 pValue
[nActProp
].Name
= sHierarchicalDocumentName
;
1620 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1622 if ( rSet
.GetItemState( SID_COPY_STREAM_IF_POSSIBLE
, false, &pItem
) == SfxItemState::SET
)
1624 pValue
[nActProp
].Name
= sCopyStreamIfPossible
;
1625 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1627 if ( rSet
.GetItemState( SID_NOAUTOSAVE
, false, &pItem
) == SfxItemState::SET
)
1629 pValue
[nActProp
].Name
= sNoAutoSave
;
1630 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue() ;
1632 if ( rSet
.GetItemState( SID_MODIFYPASSWORDINFO
, false, &pItem
) == SfxItemState::SET
)
1634 pValue
[nActProp
].Name
= sModifyPasswordInfo
;
1635 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1637 if ( rSet
.GetItemState( SID_ENCRYPTIONDATA
, false, &pItem
) == SfxItemState::SET
)
1639 pValue
[nActProp
].Name
= sEncryptionData
;
1640 pValue
[nActProp
++].Value
= static_cast<const SfxUnoAnyItem
*>(pItem
)->GetValue();
1642 if ( rSet
.GetItemState( SID_SUGGESTEDSAVEASDIR
, false, &pItem
) == SfxItemState::SET
)
1644 pValue
[nActProp
].Name
= sSuggestedSaveAsDir
;
1645 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1647 if ( rSet
.GetItemState( SID_SUGGESTEDSAVEASNAME
, false, &pItem
) == SfxItemState::SET
)
1649 pValue
[nActProp
].Name
= sSuggestedSaveAsName
;
1650 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1652 if ( rSet
.GetItemState( SID_DOC_SERVICE
, false, &pItem
) == SfxItemState::SET
)
1654 pValue
[nActProp
].Name
= sDocumentService
;
1655 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1657 if (rSet
.HasItem(SID_FILTER_PROVIDER
, &pItem
))
1659 pValue
[nActProp
].Name
= sFilterProvider
;
1660 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1662 if (rSet
.HasItem(SID_CONVERT_IMAGES
, &pItem
))
1664 pValue
[nActProp
].Name
= sImageFilter
;
1665 pValue
[nActProp
++].Value
<<= static_cast<const SfxStringItem
*>(pItem
)->GetValue();
1667 if ( rSet
.GetItemState( SID_LOCK_CONTENT_EXTRACTION
, false, &pItem
) == SfxItemState::SET
)
1669 pValue
[nActProp
].Name
= sLockContentExtraction
;
1670 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue() ;
1672 if ( rSet
.GetItemState( SID_LOCK_EXPORT
, false, &pItem
) == SfxItemState::SET
)
1674 pValue
[nActProp
].Name
= sLockExport
;
1675 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue() ;
1677 if ( rSet
.GetItemState( SID_LOCK_PRINT
, false, &pItem
) == SfxItemState::SET
)
1679 pValue
[nActProp
].Name
= sLockPrint
;
1680 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue() ;
1682 if ( rSet
.GetItemState( SID_LOCK_SAVE
, false, &pItem
) == SfxItemState::SET
)
1684 pValue
[nActProp
].Name
= sLockSave
;
1685 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue() ;
1687 if ( rSet
.GetItemState( SID_LOCK_EDITDOC
, false, &pItem
) == SfxItemState::SET
)
1689 pValue
[nActProp
].Name
= sLockEditDoc
;
1690 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1692 if (rSet
.GetItemState(SID_REPLACEABLE
, false, &pItem
) == SfxItemState::SET
)
1694 pValue
[nActProp
].Name
= sReplaceable
;
1695 pValue
[nActProp
++].Value
<<= static_cast<const SfxBoolItem
*>(pItem
)->GetValue();
1702 void SAL_CALL
FilterOptionsContinuation::setFilterOptions(
1703 const uno::Sequence
<beans::PropertyValue
>& rProps
)
1705 rProperties
= rProps
;
1708 uno::Sequence
< beans::PropertyValue
> SAL_CALL
1709 FilterOptionsContinuation::getFilterOptions()
1715 RequestFilterOptions::RequestFilterOptions( uno::Reference
< frame::XModel
> const & rModel
,
1716 const uno::Sequence
< beans::PropertyValue
>& rProperties
)
1718 uno::Reference
< uno::XInterface
> temp2
;
1719 document::FilterOptionsRequest
aOptionsRequest( OUString(),
1724 m_aRequest
<<= aOptionsRequest
;
1726 m_xAbort
= new comphelper::OInteractionAbort
;
1727 m_xOptions
= new FilterOptionsContinuation
;
1730 uno::Any SAL_CALL
RequestFilterOptions::getRequest()
1735 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> >
1736 SAL_CALL
RequestFilterOptions::getContinuations()
1738 return { m_xAbort
.get(), m_xOptions
.get() };
1742 class RequestPackageReparation_Impl
: public ::cppu::WeakImplHelper
< task::XInteractionRequest
>
1744 uno::Any m_aRequest
;
1745 rtl::Reference
<comphelper::OInteractionApprove
> m_xApprove
;
1746 rtl::Reference
<comphelper::OInteractionDisapprove
> m_xDisapprove
;
1749 explicit RequestPackageReparation_Impl( const OUString
& aName
);
1750 bool isApproved() const;
1751 virtual uno::Any SAL_CALL
getRequest() override
;
1752 virtual uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > SAL_CALL
getContinuations() override
;
1755 RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString
& aName
)
1757 uno::Reference
< uno::XInterface
> temp2
;
1758 document::BrokenPackageRequest
aBrokenPackageRequest( OUString(), temp2
, aName
);
1759 m_aRequest
<<= aBrokenPackageRequest
;
1760 m_xApprove
= new comphelper::OInteractionApprove
;
1761 m_xDisapprove
= new comphelper::OInteractionDisapprove
;
1764 bool RequestPackageReparation_Impl::isApproved() const
1766 return m_xApprove
->wasSelected();
1769 uno::Any SAL_CALL
RequestPackageReparation_Impl::getRequest()
1774 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> >
1775 SAL_CALL
RequestPackageReparation_Impl::getContinuations()
1777 return { m_xApprove
.get(), m_xDisapprove
.get() };
1780 RequestPackageReparation::RequestPackageReparation( const OUString
& aName
)
1781 : mxImpl(new RequestPackageReparation_Impl( aName
))
1785 RequestPackageReparation::~RequestPackageReparation()
1789 bool RequestPackageReparation::isApproved() const
1791 return mxImpl
->isApproved();
1794 css::uno::Reference
< task::XInteractionRequest
> RequestPackageReparation::GetRequest()
1796 return mxImpl
.get();
1800 class NotifyBrokenPackage_Impl
: public ::cppu::WeakImplHelper
< task::XInteractionRequest
>
1802 uno::Any m_aRequest
;
1803 rtl::Reference
<comphelper::OInteractionAbort
> m_xAbort
;
1806 explicit NotifyBrokenPackage_Impl(const OUString
& rName
);
1807 virtual uno::Any SAL_CALL
getRequest() override
;
1808 virtual uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> > SAL_CALL
getContinuations() override
;
1811 NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString
& aName
)
1813 uno::Reference
< uno::XInterface
> temp2
;
1814 document::BrokenPackageRequest
aBrokenPackageRequest( OUString(), temp2
, aName
);
1815 m_aRequest
<<= aBrokenPackageRequest
;
1816 m_xAbort
= new comphelper::OInteractionAbort
;
1819 uno::Any SAL_CALL
NotifyBrokenPackage_Impl::getRequest()
1824 uno::Sequence
< uno::Reference
< task::XInteractionContinuation
> >
1825 SAL_CALL
NotifyBrokenPackage_Impl::getContinuations()
1827 return { m_xAbort
.get() };
1830 NotifyBrokenPackage::NotifyBrokenPackage( const OUString
& aName
)
1831 : mxImpl(new NotifyBrokenPackage_Impl( aName
))
1835 NotifyBrokenPackage::~NotifyBrokenPackage()
1839 css::uno::Reference
< task::XInteractionRequest
> NotifyBrokenPackage::GetRequest()
1841 return mxImpl
.get();
1844 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */