Coverage Report

Created: 2026-07-10 11:04

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/sfx2/source/appl/appuno.cxx
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/*
3
 * This file is part of the LibreOffice project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 *
9
 * This file incorporates work covered by the following license notice:
10
 *
11
 *   Licensed to the Apache Software Foundation (ASF) under one or more
12
 *   contributor license agreements. See the NOTICE file distributed
13
 *   with this work for additional information regarding copyright
14
 *   ownership. The ASF licenses this file to you under the Apache
15
 *   License, Version 2.0 (the "License"); you may not use this file
16
 *   except in compliance with the License. You may obtain a copy of
17
 *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18
 */
19
20
#include <fltoptint.hxx>
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>
29
30
#include <sal/config.h>
31
#include <sal/log.hxx>
32
#include <comphelper/interaction.hxx>
33
#include <comphelper/sequenceashashmap.hxx>
34
#include <osl/diagnose.h>
35
#include <svl/eitem.hxx>
36
#include <svl/intitem.hxx>
37
#include <svl/itempool.hxx>
38
#include <svl/itemset.hxx>
39
#include <svl/slstitm.hxx>
40
#include <svl/stritem.hxx>
41
#include <tools/debug.hxx>
42
#include <tools/mapunit.hxx>
43
#include <cppuhelper/implbase.hxx>
44
45
#include <com/sun/star/document/BrokenPackageRequest.hpp>
46
#include <com/sun/star/document/FilterOptionsRequest.hpp>
47
#include <com/sun/star/frame/XFrame.hpp>
48
#include <com/sun/star/frame/XModel.hpp>
49
#include <com/sun/star/io/XInputStream.hpp>
50
#include <com/sun/star/io/XOutputStream.hpp>
51
#include <com/sun/star/task/XInteractionHandler.hpp>
52
#include <com/sun/star/task/XStatusIndicator.hpp>
53
#include <com/sun/star/ucb/XContent.hpp>
54
55
#include <memory>
56
57
using namespace ::com::sun::star;
58
using namespace ::com::sun::star::ucb;
59
using namespace ::com::sun::star::uno;
60
using namespace ::com::sun::star::frame;
61
using namespace ::com::sun::star::beans;
62
using namespace ::com::sun::star::io;
63
64
// needs to be converted to a better data structure
65
constexpr SfxFormalArgument aFormalArgs[] = {
66
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"SuggestedSaveAsName"_ustr, SID_DEFAULTFILENAME },
67
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"SuggestedSaveAsDir"_ustr, SID_DEFAULTFILEPATH },
68
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"VersionAuthor"_ustr, SID_DOCINFO_AUTHOR },
69
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"VersionComment"_ustr, SID_DOCINFO_COMMENTS },
70
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"DontTerminateEdit"_ustr, FN_PARAM_1 },
71
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"VersionMajor"_ustr, SID_DOCINFO_MAJOR },
72
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"FilterOptions"_ustr, SID_FILE_FILTEROPTIONS },
73
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"FilterName"_ustr, SID_FILTER_NAME },
74
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Margin1"_ustr, SID_RULER_MARGIN1 },
75
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Margin2"_ustr, SID_RULER_MARGIN2 },
76
//    { static_cast<const SfxType*>(&aSfxStringItem_Impl), "FileName", SID_FILE_NAME },
77
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"URL"_ustr, SID_FILE_NAME },
78
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"OpenFlags"_ustr, SID_OPTIONS },
79
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"Overwrite"_ustr, SID_OVERWRITE },
80
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Password"_ustr, SID_PASSWORD },
81
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"PasswordInteraction"_ustr, SID_PASSWORDINTERACTION },
82
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"Referer"_ustr, SID_REFERER },
83
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"SaveTo"_ustr, SID_SAVETO },
84
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"TemplateName"_ustr, SID_TEMPLATE_NAME },
85
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"TemplateRegion"_ustr, SID_TEMPLATE_REGIONNAME },
86
//    { static_cast<const SfxType*>(&aSfxStringItem_Impl), "Region", SID_TEMPLATE_REGIONNAME },
87
//    { static_cast<const SfxType*>(&aSfxStringItem_Impl), "Name", SID_TEMPLATE_NAME },
88
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"Unpacked"_ustr, SID_UNPACK },
89
    { static_cast<const SfxType*>(&aSfxInt16Item_Impl), u"Version"_ustr, SID_VERSION },
90
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"SaveACopy"_ustr, SID_SAVEACOPYITEM },
91
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"NoFileSync"_ustr, SID_NO_FILE_SYNC },
92
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"NoThumbnail"_ustr, SID_NO_THUMBNAIL },
93
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"NoEmbDataSet"_ustr, SID_NO_EMBEDDED_DS },
94
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"IsRedactMode"_ustr, SID_IS_REDACT_MODE },
95
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"RedactionStyle"_ustr, SID_REDACTION_STYLE },
96
    { static_cast<const SfxType*>(&aSfxStringItem_Impl), u"AdditionsTag"_ustr, FN_PARAM_ADDITIONS_TAG },
97
    { static_cast<const SfxType*>(&aSfxBoolItem_Impl), u"RedactImages"_ustr, SID_REDACT_IMAGE},
98
};
99
100
constexpr sal_uInt16 nMediaArgsCount = std::size(aFormalArgs);
101
102
constexpr OUString sTemplateRegionName = u"TemplateRegionName"_ustr;
103
constexpr OUString sTemplateName = u"TemplateName"_ustr;
104
constexpr OUString sAsTemplate = u"AsTemplate"_ustr;
105
constexpr OUString sOpenNewView = u"OpenNewView"_ustr;
106
constexpr OUString sViewId = u"ViewId"_ustr;
107
constexpr OUString sPluginMode = u"PluginMode"_ustr;
108
constexpr OUString sReadOnly = u"ReadOnly"_ustr;
109
constexpr OUString sDdeReconnect = u"DDEReconnect"_ustr;
110
constexpr OUString sStartPresentation = u"StartPresentation"_ustr;
111
constexpr OUString sFrameName = u"FrameName"_ustr;
112
constexpr OUString sMediaType = u"MediaType"_ustr;
113
constexpr OUString sPostData = u"PostData"_ustr;
114
constexpr OUString sCharacterSet = u"CharacterSet"_ustr;
115
constexpr OUString sInputStream = u"InputStream"_ustr;
116
constexpr OUString sStream = u"Stream"_ustr;
117
constexpr OUString sOutputStream = u"OutputStream"_ustr;
118
constexpr OUString sHidden = u"Hidden"_ustr;
119
constexpr OUString sPreview = u"Preview"_ustr;
120
constexpr OUString sViewOnly = u"ViewOnly"_ustr;
121
constexpr OUString sDontEdit = u"DontEdit"_ustr;
122
constexpr OUString sSilent = u"Silent"_ustr;
123
constexpr OUString sJumpMark = u"JumpMark"_ustr;
124
constexpr OUString sSalvagedFile = u"SalvagedFile"_ustr;
125
constexpr OUString sStatusInd = u"StatusIndicator"_ustr;
126
constexpr OUString sModel = u"Model"_ustr;
127
constexpr OUString sFrame = u"Frame"_ustr;
128
constexpr OUString sViewData = u"ViewData"_ustr;
129
constexpr OUString sFilterData = u"FilterData"_ustr;
130
constexpr OUString sSelectionOnly = u"SelectionOnly"_ustr;
131
constexpr OUString sMacroExecMode = u"MacroExecutionMode"_ustr;
132
constexpr OUString sUpdateDocMode = u"UpdateDocMode"_ustr;
133
constexpr OUString sMinimized = u"Minimized"_ustr;
134
constexpr OUString sInteractionHdl = u"InteractionHandler"_ustr;
135
constexpr OUString sUCBContent = u"UCBContent"_ustr;
136
constexpr OUString sRepairPackage = u"RepairPackage"_ustr;
137
constexpr OUString sDocumentTitle = u"DocumentTitle"_ustr;
138
constexpr OUString sComponentData = u"ComponentData"_ustr;
139
constexpr OUString sComponentContext = u"ComponentContext"_ustr;
140
constexpr OUString sDocumentBaseURL = u"DocumentBaseURL"_ustr;
141
constexpr OUString sHierarchicalDocumentName = u"HierarchicalDocumentName"_ustr;
142
constexpr OUString sCopyStreamIfPossible = u"CopyStreamIfPossible"_ustr;
143
constexpr OUString sNoAutoSave = u"NoAutoSave"_ustr;
144
constexpr OUString sFolderName = u"FolderName"_ustr;
145
constexpr OUString sUseSystemDialog = u"UseSystemDialog"_ustr;
146
constexpr OUString sDenyList = u"DenyList"_ustr;
147
constexpr OUString sModifyPasswordInfo = u"ModifyPasswordInfo"_ustr;
148
constexpr OUString sSuggestedSaveAsDir = u"SuggestedSaveAsDir"_ustr;
149
constexpr OUString sSuggestedSaveAsName = u"SuggestedSaveAsName"_ustr;
150
constexpr OUString sExportDirectory = u"ExportDirectory"_ustr;
151
constexpr OUString sEncryptionData = u"EncryptionData"_ustr;
152
constexpr OUString sFailOnWarning = u"FailOnWarning"_ustr;
153
constexpr OUString sDocumentService = u"DocumentService"_ustr;
154
constexpr OUString sFilterProvider = u"FilterProvider"_ustr;
155
constexpr OUString sImageFilter = u"ImageFilter"_ustr;
156
constexpr OUString sLockContentExtraction = u"LockContentExtraction"_ustr;
157
constexpr OUString sLockExport = u"LockExport"_ustr;
158
constexpr OUString sLockPrint = u"LockPrint"_ustr;
159
constexpr OUString sLockSave = u"LockSave"_ustr;
160
constexpr OUString sLockEditDoc = u"LockEditDoc"_ustr;
161
constexpr OUString sReplaceable = u"Replaceable"_ustr;
162
163
static bool isMediaDescriptor( sal_uInt16 nSlotId )
164
325k
{
165
325k
    return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC ||
166
0
             nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC ||
167
0
             nSlotId == SID_SAVETO || nSlotId == SID_SAVEACOPY ||
168
0
             nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
169
0
             nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
170
0
             nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC ||
171
0
             nSlotId == SID_SAVEACOPYITEM);
172
325k
}
173
174
void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot )
175
142k
{
176
142k
    if ( !pSlot )
177
142k
        pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
178
179
142k
    if ( !pSlot )
180
0
        return;
181
182
142k
    if ( nSlotId == SID_OPENURL )
183
0
        nSlotId = SID_OPENDOC;
184
185
142k
    const sal_Int32 nCount = rArgs.getLength();
186
142k
    if ( !nCount )
187
0
        return;
188
189
142k
    if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
190
0
    {
191
        // slot is a property
192
0
        const SfxType* pType = pSlot->GetType();
193
0
        std::unique_ptr<SfxPoolItem> pItem(pType->CreateItem());
194
195
0
        if ( !pItem )
196
0
        {
197
0
            SAL_WARN( "sfx", "No creator method for item: " << nSlotId );
198
0
            return;
199
0
        }
200
201
0
        sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId);
202
0
        bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
203
0
        pItem->SetWhich( nWhich );
204
0
        sal_uInt16 nSubCount = pType->nAttribs;
205
206
0
        const beans::PropertyValue& rProp = rArgs[0];
207
0
        const OUString& rName = rProp.Name;
208
0
        if ( nCount == 1 && rName == pSlot->aUnoName )
209
0
        {
210
            // there is only one parameter and its name matches the name of the property,
211
            // so it's either a simple property or a complex property in one single UNO struct
212
0
            if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) )
213
                // only use successfully converted items
214
0
                rSet.Put( std::move(pItem) );
215
0
            else
216
0
            {
217
0
                SAL_WARN( "sfx", "Property not convertible: " << pSlot->aUnoName );
218
0
            }
219
0
        }
220
#ifdef DBG_UTIL
221
        else if ( nSubCount == 0 )
222
        {
223
            // for a simple property there can be only one parameter and its name *must* match
224
            SAL_WARN("sfx.appl", "Property name of '" << rName << "' does not match '" << pSlot->aUnoName << "'");
225
        }
226
#endif
227
0
        else
228
0
        {
229
            // there is more than one parameter and the property is a complex one
230
#ifdef DBG_UTIL
231
            // if the dispatch API is used for UI purposes or from the testtool,
232
            // it is possible to skip some or all arguments,
233
            // but it indicates an error for macro recording;
234
            // so this should be notified as a warning only
235
            if ( nCount != nSubCount )
236
            {
237
                SAL_INFO("sfx.appl", "MacroPlayer: wrong number of parameters for slot: " << nSlotId );
238
            }
239
#endif
240
            // complex property; collect sub items from the parameter set and reconstruct complex item
241
0
            sal_uInt16 nFound=0;
242
0
            for ( const beans::PropertyValue& rPropValue : rArgs )
243
0
            {
244
0
                sal_uInt16 nSub;
245
0
                for ( nSub=0; nSub<nSubCount; nSub++ )
246
0
                {
247
                    // search sub item by name
248
0
                    if ( rPropValue.Name == (pSlot->aUnoName + "." + pType->getAttrib(nSub).aName) )
249
0
                    {
250
0
                        sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(nSub).nAID));
251
0
                        if ( bConvertTwips )
252
0
                            nSubId |= CONVERT_TWIPS;
253
0
                        if ( pItem->PutValue( rPropValue.Value, nSubId ) )
254
0
                            nFound++;
255
0
                        else
256
0
                        {
257
0
                            SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot->aUnoName);
258
0
                        }
259
0
                        break;
260
0
                    }
261
0
                }
262
263
                // there was a parameter with a name that didn't match to any of the members
264
0
                SAL_WARN_IF( nSub >= nSubCount, "sfx.appl", "Property name does not match: " << rPropValue.Name );
265
0
            }
266
267
            // at least one part of the complex item must be present; other parts can have default values
268
0
            if ( nFound > 0 )
269
0
                rSet.Put( std::move(pItem) );
270
0
        }
271
272
0
        return;
273
0
    }
274
275
#ifdef DBG_UTIL
276
    // detect parameters that don't match to any formal argument or one of its members
277
    sal_Int32 nFoundArgs = 0;
278
#endif
279
    // slot is a method
280
142k
    bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
281
142k
    sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
282
4.26M
    for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
283
4.12M
    {
284
4.12M
        const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
285
4.12M
        std::unique_ptr<SfxPoolItem> pItem(rArg.CreateItem());
286
4.12M
        if ( !pItem )
287
0
        {
288
0
            SAL_WARN( "sfx", "No creator method for argument: " << rArg.aName );
289
0
            return;
290
0
        }
291
292
4.12M
        sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(rArg.nSlotId);
293
4.12M
        bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
294
4.12M
        pItem->SetWhich( nWhich );
295
4.12M
        const SfxType* pType = rArg.pType;
296
4.12M
        sal_uInt16 nSubCount = pType->nAttribs;
297
4.12M
        if ( nSubCount == 0 )
298
4.12M
        {
299
            // "simple" (base type) argument
300
4.12M
            auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
301
8.55M
                [&rArg](const beans::PropertyValue& rProp) { return rProp.Name == rArg.aName; });
302
4.12M
            if (pProp != rArgs.end())
303
39
            {
304
#ifdef DBG_UTIL
305
                ++nFoundArgs;
306
#endif
307
39
                if( pItem->PutValue( pProp->Value, 0 ) )
308
                    // only use successfully converted items
309
39
                    rSet.Put( std::move(pItem) );
310
0
                else
311
0
                {
312
0
                    SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
313
0
                }
314
39
            }
315
4.12M
        }
316
0
        else
317
0
        {
318
            // complex argument, could be passed in one struct
319
0
            bool bAsWholeItem = false;
320
0
            for ( const beans::PropertyValue& rProp : rArgs )
321
0
            {
322
0
                const OUString& rName = rProp.Name;
323
0
                if ( rName == rArg.aName )
324
0
                {
325
0
                    bAsWholeItem = true;
326
#ifdef DBG_UTIL
327
                    ++nFoundArgs;
328
#endif
329
0
                    if( pItem->PutValue( rProp.Value, 0 ) )
330
                        // only use successfully converted items
331
0
                        rSet.Put( std::move(pItem) );
332
0
                    else
333
0
                    {
334
0
                        SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
335
0
                    }
336
0
                }
337
0
            }
338
339
0
            if ( !bAsWholeItem )
340
0
            {
341
                // complex argument; collect sub items from argument array and reconstruct complex item
342
                // only put item if at least one member was found and had the correct type
343
                // (is this a good idea?! Should we ask for *all* members?)
344
0
                bool bRet = false;
345
0
                for ( const beans::PropertyValue& rProp : rArgs )
346
0
                {
347
0
                    for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
348
0
                    {
349
                        // search sub item by name
350
0
                        if ( rProp.Name == (rArg.aName + "." + pType->getAttrib(nSub).aName) )
351
0
                        {
352
                            // at least one member found ...
353
0
                            bRet = true;
354
#ifdef DBG_UTIL
355
                            ++nFoundArgs;
356
#endif
357
0
                            sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(nSub).nAID));
358
0
                            if ( bConvertTwips )
359
0
                                nSubId |= CONVERT_TWIPS;
360
0
                            if (!pItem->PutValue( rProp.Value, nSubId ) )
361
0
                            {
362
                                // ... but it was not convertible
363
0
                                bRet = false;
364
0
                                SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
365
0
                            }
366
367
0
                            break;
368
0
                        }
369
0
                    }
370
0
                }
371
372
0
                if ( bRet )
373
                    // only use successfully converted items
374
0
                    rSet.Put( std::move(pItem) );
375
376
0
            }
377
0
        }
378
4.12M
    }
379
380
    // special additional parameters for some slots not seen in the slot definitions
381
    // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots,
382
    // but as dispatching or factory or arbitrary URLs to the frame
383
    // Some also can use additional arguments that are not recordable (will be changed later,
384
    // f.e. "SaveAs" shouldn't support parameters not in the slot definition!)
385
142k
    if ( nSlotId == SID_NEWWINDOW )
386
0
    {
387
0
        for ( const beans::PropertyValue& rProp : rArgs )
388
0
        {
389
0
            const OUString& rName = rProp.Name;
390
0
            if ( rName == sFrame )
391
0
            {
392
0
                Reference< XFrame > xFrame;
393
0
                OSL_VERIFY( rProp.Value >>= xFrame );
394
0
                rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
395
0
            }
396
0
            else
397
0
            if ( rName == sHidden )
398
0
            {
399
0
                bool bVal = false;
400
0
                if (rProp.Value >>= bVal)
401
0
                    rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
402
0
            }
403
0
        }
404
0
    }
405
142k
    else if ( bIsMediaDescriptor )
406
142k
    {
407
142k
        for ( const beans::PropertyValue& rProp : rArgs )
408
294k
        {
409
#ifdef DBG_UTIL
410
            ++nFoundArgs;
411
#endif
412
294k
            const OUString& aName = rProp.Name;
413
294k
            if ( aName == sModel )
414
0
                rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) );
415
294k
            else if ( aName == sComponentData )
416
0
            {
417
0
                rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
418
0
            }
419
294k
            else if ( aName == sComponentContext )
420
0
            {
421
0
                rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
422
0
            }
423
294k
            else if ( aName == sStatusInd )
424
0
            {
425
0
                Reference<task::XStatusIndicator> xVal;
426
0
                bool bOK = (rProp.Value >>= xVal);
427
0
                DBG_ASSERT( bOK, "invalid type for StatusIndicator" );
428
0
                if (bOK && xVal.is())
429
0
                    rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
430
0
            }
431
294k
            else if ( aName == sInteractionHdl )
432
0
            {
433
0
                Reference<task::XInteractionHandler> xVal;
434
0
                bool bOK = (rProp.Value >>= xVal);
435
0
                DBG_ASSERT( bOK, "invalid type for InteractionHandler" );
436
0
                if (bOK && xVal.is())
437
0
                    rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
438
0
            }
439
294k
            else if ( aName == sViewData )
440
0
                rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) );
441
294k
            else if ( aName == sFilterData )
442
0
                rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) );
443
294k
            else if ( aName == sInputStream )
444
39
            {
445
39
                Reference< XInputStream > xVal;
446
39
                bool bOK = ((rProp.Value >>= xVal) && xVal.is());
447
39
                DBG_ASSERT( bOK, "invalid type for InputStream" );
448
39
                if (bOK)
449
0
                    rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
450
39
            }
451
294k
            else if ( aName == sStream )
452
0
            {
453
0
                Reference< XInputStream > xVal;
454
0
                bool bOK = ((rProp.Value >>= xVal) && xVal.is());
455
0
                DBG_ASSERT( bOK, "invalid type for Stream" );
456
0
                if (bOK)
457
0
                    rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
458
0
            }
459
294k
            else if ( aName == sUCBContent )
460
0
            {
461
0
                Reference< XContent > xVal;
462
0
                bool bOK = ((rProp.Value >>= xVal) && xVal.is());
463
0
                DBG_ASSERT( bOK, "invalid type for UCBContent" );
464
0
                if (bOK)
465
0
                    rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
466
0
            }
467
294k
            else if ( aName == sOutputStream )
468
0
            {
469
0
                Reference< XOutputStream > xVal;
470
0
                bool bOK = ((rProp.Value >>= xVal) && xVal.is());
471
0
                DBG_ASSERT( bOK, "invalid type for OutputStream" );
472
0
                if (bOK)
473
0
                    rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
474
0
            }
475
294k
            else if ( aName == sPostData )
476
0
            {
477
0
                Reference< XInputStream > xVal;
478
0
                bool bOK = (rProp.Value >>= xVal);
479
0
                DBG_ASSERT( bOK, "invalid type for PostData" );
480
0
                if (bOK)
481
0
                    rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
482
0
            }
483
294k
            else if ( aName == sFrame )
484
0
            {
485
0
                Reference< XFrame > xFrame;
486
0
                bool bOK = (rProp.Value >>= xFrame);
487
0
                DBG_ASSERT( bOK, "invalid type for Frame" );
488
0
                if (bOK)
489
0
                    rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
490
0
            }
491
294k
            else if ( aName == sAsTemplate )
492
0
            {
493
0
                bool bVal = false;
494
0
                bool bOK = (rProp.Value >>= bVal);
495
0
                DBG_ASSERT( bOK, "invalid type for AsTemplate" );
496
0
                if (bOK)
497
0
                    rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
498
0
            }
499
294k
            else if ( aName == sOpenNewView )
500
0
            {
501
0
                bool bVal = false;
502
0
                bool bOK = (rProp.Value >>= bVal);
503
0
                DBG_ASSERT( bOK, "invalid type for OpenNewView" );
504
0
                if (bOK)
505
0
                    rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
506
0
            }
507
294k
            else if ( aName == sFailOnWarning )
508
0
            {
509
0
                bool bVal = false;
510
0
                bool bOK = (rProp.Value >>= bVal);
511
0
                DBG_ASSERT( bOK, "invalid type for FailOnWarning" );
512
0
                if (bOK)
513
0
                    rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
514
0
            }
515
294k
            else if ( aName == sViewId )
516
0
            {
517
0
                sal_Int16 nVal = -1;
518
0
                bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
519
0
                DBG_ASSERT( bOK, "invalid type for ViewId" );
520
0
                if (bOK)
521
0
                    rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
522
0
            }
523
294k
            else if ( aName == sPluginMode )
524
0
            {
525
0
                sal_Int16 nVal = -1;
526
0
                bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
527
0
                DBG_ASSERT( bOK, "invalid type for PluginMode" );
528
0
                if (bOK)
529
0
                    rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
530
0
            }
531
294k
            else if ( aName == sReadOnly )
532
0
            {
533
0
                bool bVal = false;
534
0
                bool bOK = (rProp.Value >>= bVal);
535
0
                DBG_ASSERT( bOK, "invalid type for ReadOnly" );
536
0
                if (bOK)
537
0
                    rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
538
0
            }
539
294k
            else if ( aName == sDdeReconnect )
540
0
            {
541
0
                bool bVal = true;
542
0
                bool bOK = (rProp.Value >>= bVal);
543
0
                DBG_ASSERT( bOK, "invalid type for DDEReconnect" );
544
0
                if (bOK)
545
0
                    rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
546
0
            }
547
294k
            else if ( aName == sStartPresentation )
548
0
            {
549
0
                sal_uInt16 nVal = 0;
550
0
                bool bOK = (rProp.Value >>= nVal);
551
0
                DBG_ASSERT( bOK, "invalid type for StartPresentation" );
552
0
                if (bOK)
553
0
                    rSet.Put(SfxUInt16Item(SID_DOC_STARTPRESENTATION, nVal));
554
0
            }
555
294k
            else if ( aName == sSelectionOnly )
556
0
            {
557
0
                bool bVal = false;
558
0
                bool bOK = (rProp.Value >>= bVal);
559
0
                DBG_ASSERT( bOK, "invalid type for SelectionOnly" );
560
0
                if (bOK)
561
0
                    rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
562
0
            }
563
294k
            else if ( aName == sHidden )
564
0
            {
565
0
                bool bVal = false;
566
0
                bool bOK = (rProp.Value >>= bVal);
567
0
                DBG_ASSERT( bOK, "invalid type for Hidden" );
568
0
                if (bOK)
569
0
                    rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
570
0
            }
571
294k
            else if ( aName == sMinimized )
572
0
            {
573
0
                bool bVal = false;
574
0
                bool bOK = (rProp.Value >>= bVal);
575
0
                DBG_ASSERT( bOK, "invalid type for Minimized" );
576
0
                if (bOK)
577
0
                    rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
578
0
            }
579
294k
            else if ( aName == sSilent )
580
0
            {
581
0
                bool bVal = false;
582
0
                bool bOK = (rProp.Value >>= bVal);
583
0
                DBG_ASSERT( bOK, "invalid type for Silent" );
584
0
                if (bOK)
585
0
                    rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
586
0
            }
587
294k
            else if ( aName == sPreview )
588
0
            {
589
0
                bool bVal = false;
590
0
                bool bOK = (rProp.Value >>= bVal);
591
0
                DBG_ASSERT( bOK, "invalid type for Preview" );
592
0
                if (bOK)
593
0
                    rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
594
0
            }
595
294k
            else if ( aName == sViewOnly )
596
0
            {
597
0
                bool bVal = false;
598
0
                bool bOK = (rProp.Value >>= bVal);
599
0
                DBG_ASSERT( bOK, "invalid type for ViewOnly" );
600
0
                if (bOK)
601
0
                    rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
602
0
            }
603
294k
            else if ( aName == sDontEdit )
604
0
            {
605
0
                bool bVal = false;
606
0
                bool bOK = (rProp.Value >>= bVal);
607
0
                DBG_ASSERT( bOK, "invalid type for ViewOnly" );
608
0
                if (bOK)
609
0
                    rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
610
0
            }
611
294k
            else if ( aName == sUseSystemDialog )
612
0
            {
613
0
                bool bVal = false;
614
0
                bool bOK = (rProp.Value >>= bVal);
615
0
                DBG_ASSERT( bOK, "invalid type for ViewOnly" );
616
0
                if (bOK)
617
0
                    rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
618
0
            }
619
294k
            else if ( aName == sDenyList )
620
0
            {
621
0
                uno::Sequence<OUString> xVal;
622
0
                bool bOK = (rProp.Value >>= xVal);
623
0
                DBG_ASSERT( bOK, "invalid type or value for DenyList" );
624
0
                if (bOK)
625
0
                {
626
0
                    SfxStringListItem stringList(SID_DENY_LIST);
627
0
                    stringList.SetStringList( xVal );
628
0
                    rSet.Put( stringList );
629
0
                }
630
0
            }
631
294k
            else if ( aName == "FileName" )
632
0
            {
633
0
                OUString sVal;
634
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
635
0
                DBG_ASSERT( bOK, "invalid type or value for FileName" );
636
0
                if (bOK)
637
0
                    rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
638
0
            }
639
294k
            else if ( aName == sSalvagedFile )
640
0
            {
641
0
                OUString sVal;
642
0
                bool bOK = (rProp.Value >>= sVal);
643
0
                DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" );
644
0
                if (bOK)
645
0
                    rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
646
0
            }
647
294k
            else if ( aName == sFolderName )
648
0
            {
649
0
                OUString sVal;
650
0
                bool bOK = (rProp.Value >>= sVal);
651
0
                DBG_ASSERT( bOK, "invalid type or value for FolderName" );
652
0
                if (bOK)
653
0
                    rSet.Put( SfxStringItem( SID_PATH, sVal ) );
654
0
            }
655
294k
            else if ( aName == sFrameName )
656
0
            {
657
0
                OUString sVal;
658
0
                bool bOK = (rProp.Value >>= sVal);
659
0
                DBG_ASSERT( bOK, "invalid type for FrameName" );
660
0
                if (bOK && !sVal.isEmpty())
661
0
                    rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
662
0
            }
663
294k
            else if ( aName == sMediaType )
664
0
            {
665
0
                OUString sVal;
666
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
667
0
                DBG_ASSERT( bOK, "invalid type or value for MediaType" );
668
0
                if (bOK)
669
0
                    rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
670
0
            }
671
294k
            else if ( aName == sTemplateName )
672
0
            {
673
0
                OUString sVal;
674
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
675
0
                DBG_ASSERT( bOK, "invalid type or value for TemplateName" );
676
0
                if (bOK)
677
0
                    rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
678
0
            }
679
294k
            else if ( aName == sTemplateRegionName )
680
0
            {
681
0
                OUString sVal;
682
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
683
0
                DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" );
684
0
                if (bOK)
685
0
                    rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
686
0
            }
687
294k
            else if ( aName == sJumpMark )
688
0
            {
689
0
                OUString sVal;
690
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
691
0
                DBG_ASSERT( bOK, "invalid type or value for JumpMark" );
692
0
                if (bOK)
693
0
                    rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
694
0
            }
695
294k
            else if ( aName == sCharacterSet )
696
0
            {
697
0
                OUString sVal;
698
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
699
0
                DBG_ASSERT( bOK, "invalid type or value for CharacterSet" );
700
0
                if (bOK)
701
0
                    rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
702
0
            }
703
294k
            else if ( aName == "FilterFlags" )
704
0
            {
705
0
                OUString sVal;
706
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
707
0
                DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
708
0
                if (bOK)
709
0
                    rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
710
0
            }
711
294k
            else if ( aName == sImageFilter )
712
0
            {
713
0
                OUString sVal;
714
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
715
0
                DBG_ASSERT( bOK, "invalid type or value for FilterFlags" );
716
0
                if (bOK)
717
0
                    rSet.Put( SfxStringItem( SID_CONVERT_IMAGES, sVal ) );
718
0
            }
719
294k
            else if ( aName == sMacroExecMode )
720
142k
            {
721
142k
                sal_Int16 nVal =-1;
722
142k
                bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
723
142k
                DBG_ASSERT( bOK, "invalid type for MacroExecMode" );
724
142k
                if (bOK)
725
142k
                    rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
726
142k
            }
727
152k
            else if ( aName == sUpdateDocMode )
728
0
            {
729
0
                sal_Int16 nVal =-1;
730
0
                bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
731
0
                DBG_ASSERT( bOK, "invalid type for UpdateDocMode" );
732
0
                if (bOK)
733
0
                    rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
734
0
            }
735
152k
            else if ( aName == sRepairPackage )
736
0
            {
737
0
                bool bVal = false;
738
0
                bool bOK = (rProp.Value >>= bVal);
739
0
                DBG_ASSERT( bOK, "invalid type for RepairPackage" );
740
0
                if (bOK)
741
0
                    rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
742
0
            }
743
152k
            else if ( aName == sDocumentTitle )
744
0
            {
745
0
                OUString sVal;
746
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
747
0
                DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" );
748
0
                if (bOK)
749
0
                    rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
750
0
            }
751
152k
            else if ( aName == sDocumentBaseURL )
752
0
            {
753
0
                OUString sVal;
754
                // the base url can be set to empty ( for embedded objects for example )
755
0
                bool bOK = (rProp.Value >>= sVal);
756
0
                DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" );
757
0
                if (bOK)
758
0
                    rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
759
0
            }
760
152k
            else if ( aName == sHierarchicalDocumentName )
761
0
            {
762
0
                OUString sVal;
763
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
764
0
                DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" );
765
0
                if (bOK)
766
0
                    rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
767
0
            }
768
152k
            else if ( aName == sCopyStreamIfPossible )
769
0
            {
770
0
                bool bVal = false;
771
0
                bool bOK = (rProp.Value >>= bVal);
772
0
                DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" );
773
0
                if (bOK)
774
0
                    rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
775
0
            }
776
152k
            else if ( aName == sNoAutoSave )
777
0
            {
778
0
                bool bVal = false;
779
0
                bool bOK = (rProp.Value >>= bVal);
780
0
                DBG_ASSERT( bOK, "invalid type for NoAutoSave" );
781
0
                if (bOK)
782
0
                    rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
783
0
            }
784
152k
            else if ( aName == sModifyPasswordInfo )
785
0
            {
786
0
                rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
787
0
            }
788
152k
            else if ( aName == sEncryptionData )
789
0
            {
790
0
                rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
791
0
            }
792
152k
            else if ( aName == sSuggestedSaveAsDir )
793
0
            {
794
0
                OUString sVal;
795
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
796
0
                DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" );
797
0
                if (bOK)
798
0
                    rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
799
0
            }
800
152k
            else if ( aName == sSuggestedSaveAsName )
801
0
            {
802
0
                OUString sVal;
803
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
804
0
                DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" );
805
0
                if (bOK)
806
0
                    rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
807
0
            }
808
152k
            else if ( aName == sExportDirectory )
809
0
            {
810
0
                OUString sVal;
811
0
                bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
812
0
                DBG_ASSERT( bOK, "invalid type or value for ExportDirectoy" );
813
0
                if (bOK)
814
0
                    rSet.Put( SfxStringItem( SID_EXPORTDIRECTORY, sVal ) );
815
0
            }
816
152k
            else if (aName == sDocumentService)
817
0
            {
818
0
                OUString aVal;
819
0
                bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
820
0
                if (bOK)
821
0
                    rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
822
0
            }
823
152k
            else if (aName == sFilterProvider)
824
0
            {
825
0
                OUString aVal;
826
0
                bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty());
827
0
                if (bOK)
828
0
                    rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
829
0
            }
830
152k
            else if (aName == sLockContentExtraction)
831
0
            {
832
0
                bool bVal = false;
833
0
                bool bOK = (rProp.Value >>= bVal);
834
0
                DBG_ASSERT( bOK, "invalid type for LockContentExtraction" );
835
0
                if (bOK)
836
0
                    rSet.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION, bVal ) );
837
0
            }
838
152k
            else if (aName == sLockExport)
839
0
            {
840
0
                bool bVal = false;
841
0
                bool bOK = (rProp.Value >>= bVal);
842
0
                DBG_ASSERT( bOK, "invalid type for LockExport" );
843
0
                if (bOK)
844
0
                    rSet.Put( SfxBoolItem( SID_LOCK_EXPORT, bVal ) );
845
0
            }
846
152k
            else if (aName == sLockPrint)
847
0
            {
848
0
                bool bVal = false;
849
0
                bool bOK = (rProp.Value >>= bVal);
850
0
                DBG_ASSERT( bOK, "invalid type for LockPrint" );
851
0
                if (bOK)
852
0
                    rSet.Put( SfxBoolItem( SID_LOCK_PRINT, bVal ) );
853
0
            }
854
152k
            else if (aName == sLockSave)
855
0
            {
856
0
                bool bVal = false;
857
0
                bool bOK = (rProp.Value >>= bVal);
858
0
                DBG_ASSERT( bOK, "invalid type for LockSave" );
859
0
                if (bOK)
860
0
                    rSet.Put( SfxBoolItem( SID_LOCK_SAVE, bVal ) );
861
0
            }
862
152k
            else if (aName == sLockEditDoc)
863
0
            {
864
0
                bool bVal = false;
865
0
                bool bOK = (rProp.Value >>= bVal);
866
0
                DBG_ASSERT( bOK, "invalid type for LockEditDoc" );
867
0
                if (bOK)
868
0
                    rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
869
0
            }
870
152k
            else if (aName == sReplaceable)
871
0
            {
872
0
                bool bVal = false;
873
0
                bool bOK = (rProp.Value >>= bVal);
874
0
                DBG_ASSERT(bOK, "invalid type for Replaceable");
875
0
                if (bOK)
876
0
                    rSet.Put(SfxBoolItem(SID_REPLACEABLE, bVal));
877
0
            }
878
#ifdef DBG_UTIL
879
            else
880
                --nFoundArgs;
881
#endif
882
294k
        }
883
142k
    }
884
    // API to raise options dialog with a specified options ab page (#i83757#)
885
0
    else
886
0
    {
887
        // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog"
888
0
        if ( "OptionsTreeDialog" == pSlot->aUnoName )
889
0
        {
890
0
            auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
891
0
                [](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL" || rProp.Name == "OptionsPageID"; });
892
0
            if (pProp != rArgs.end())
893
0
            {
894
0
                OUString sURL;
895
0
                sal_uInt16 nPageID;
896
0
                if ( pProp->Name == "OptionsPageURL" && (pProp->Value >>= sURL) )
897
0
                    rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) );
898
0
                else if ( pProp->Name == "OptionsPageID" && (pProp->Value >>= nPageID) )
899
0
                    rSet.Put( SfxUInt16Item( SID_OPTIONS_PAGEID, nPageID ) );
900
0
            }
901
0
        }
902
0
    }
903
#ifdef DBG_UTIL
904
    if ( nFoundArgs == nCount )
905
    {
906
        // except for the "special" slots: assure that every argument was convertible
907
        SAL_INFO( "sfx.appl", "MacroPlayer: Some properties didn't match to any formal argument for slot: "<< pSlot->aUnoName );
908
    }
909
#endif
910
142k
}
911
912
comphelper::SequenceAsHashMap TransformItems(sal_uInt16 nSlotId, const SfxItemSet& rSet,
913
                                             const SfxSlot* pSlot)
914
183k
{
915
183k
    if ( !pSlot )
916
183k
        pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
917
918
183k
    if ( !pSlot)
919
0
        return {};
920
921
183k
    if ( nSlotId == SID_OPENURL )
922
0
        nSlotId = SID_OPENDOC;
923
183k
    if ( nSlotId == SID_SAVEASREMOTE )
924
0
        nSlotId = SID_SAVEASDOC;
925
926
    // find number of properties to avoid permanent reallocations in the sequence
927
183k
    sal_Int32 nProps=0;
928
929
#ifdef DBG_UTIL
930
    // trace number of items and compare with number of properties for debugging purposes
931
    sal_Int32 nItems=0;
932
#endif
933
934
183k
    const SfxType *pType = pSlot->GetType();
935
183k
    if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
936
0
    {
937
        // slot is a property
938
0
        sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId);
939
0
        if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
940
0
        {
941
0
            sal_uInt16 nSubCount = pType->nAttribs;
942
0
            if ( nSubCount )
943
                // it's a complex property, we want it split into simple types
944
                // so we expect to get as many items as we have (sub) members
945
0
                nProps = nSubCount;
946
0
            else
947
                // simple property: we expect to get exactly one item
948
0
                nProps++;
949
0
        }
950
0
        else
951
0
        {
952
            // we will not rely on the "toggle" ability of some property slots
953
0
            SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId );
954
0
        }
955
956
#ifdef DBG_UTIL
957
        nItems++;
958
#endif
959
0
    }
960
183k
    else
961
183k
    {
962
        // slot is a method
963
183k
        bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
964
183k
        sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount();
965
5.49M
        for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
966
5.31M
        {
967
            // check every formal argument of the method
968
5.31M
            const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
969
970
5.31M
            sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID( rArg.nSlotId );
971
5.31M
            if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
972
24.9k
            {
973
24.9k
                sal_uInt16 nSubCount = rArg.pType->nAttribs;
974
24.9k
                if ( nSubCount )
975
                    // argument has a complex type, we want it split into simple types
976
                    // so for this argument we expect to get as many items as we have (sub) members
977
0
                    nProps += nSubCount;
978
24.9k
                else
979
                    // argument of simple type: we expect to get exactly one item for it
980
24.9k
                    nProps++;
981
#ifdef DBG_UTIL
982
                nItems++;
983
#endif
984
24.9k
            }
985
5.31M
        }
986
987
        // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To)
988
183k
        if ( bIsMediaDescriptor )
989
183k
        {
990
183k
            sal_Int32 nAdditional=0;
991
183k
            if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SfxItemState::SET )
992
0
                nAdditional++;
993
183k
            if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SfxItemState::SET )
994
0
                nAdditional++;
995
183k
            if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SfxItemState::SET )
996
0
                nAdditional++;
997
183k
            if ( rSet.GetItemState( SID_PATH ) == SfxItemState::SET )
998
0
                nAdditional++;
999
183k
            if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET )
1000
0
                nAdditional++;
1001
183k
            if ( rSet.GetItemState( SID_DENY_LIST ) == SfxItemState::SET )
1002
0
                nAdditional++;
1003
183k
            if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET )
1004
0
                nAdditional++;
1005
183k
            if ( rSet.GetItemState( SID_INPUTSTREAM ) == SfxItemState::SET )
1006
39
                nAdditional++;
1007
183k
            if ( rSet.GetItemState( SID_STREAM ) == SfxItemState::SET )
1008
0
                nAdditional++;
1009
183k
            if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SfxItemState::SET )
1010
0
                nAdditional++;
1011
183k
            if ( rSet.GetItemState( SID_TEMPLATE ) == SfxItemState::SET )
1012
0
                nAdditional++;
1013
183k
            if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SfxItemState::SET )
1014
0
                nAdditional++;
1015
183k
            if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SfxItemState::SET )
1016
0
                nAdditional++;
1017
183k
            if ( rSet.GetItemState( SID_VIEW_ID ) == SfxItemState::SET )
1018
0
                nAdditional++;
1019
183k
            if ( rSet.GetItemState( SID_VIEW_DATA ) == SfxItemState::SET )
1020
0
                nAdditional++;
1021
183k
            if ( rSet.GetItemState( SID_FILTER_DATA ) == SfxItemState::SET )
1022
0
                nAdditional++;
1023
183k
            if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SfxItemState::SET )
1024
0
                nAdditional++;
1025
183k
            if ( rSet.GetItemState( SID_DOC_READONLY ) == SfxItemState::SET )
1026
6.25k
                nAdditional++;
1027
183k
            if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SfxItemState::SET )
1028
0
                nAdditional++;
1029
183k
            if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SfxItemState::SET )
1030
0
                nAdditional++;
1031
183k
            if ( rSet.GetItemState( SID_SELECTION ) == SfxItemState::SET )
1032
0
                nAdditional++;
1033
183k
            if ( rSet.GetItemState( SID_CONTENTTYPE ) == SfxItemState::SET )
1034
0
                nAdditional++;
1035
183k
            if ( rSet.GetItemState( SID_POSTDATA ) == SfxItemState::SET )
1036
0
                nAdditional++;
1037
183k
            if ( rSet.GetItemState( SID_FILLFRAME ) == SfxItemState::SET )
1038
0
                nAdditional++;
1039
183k
            if ( rSet.GetItemState( SID_CHARSET ) == SfxItemState::SET )
1040
0
                nAdditional++;
1041
183k
            if ( rSet.GetItemState( SID_TARGETNAME ) == SfxItemState::SET )
1042
0
                nAdditional++;
1043
183k
            if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SfxItemState::SET )
1044
0
                nAdditional++;
1045
183k
            if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SfxItemState::SET )
1046
0
                nAdditional++;
1047
183k
            if ( rSet.GetItemState( SID_HIDDEN ) == SfxItemState::SET )
1048
0
                nAdditional++;
1049
183k
            if ( rSet.GetItemState( SID_MINIMIZED ) == SfxItemState::SET )
1050
0
                nAdditional++;
1051
183k
            if ( rSet.GetItemState( SID_PREVIEW ) == SfxItemState::SET )
1052
0
                nAdditional++;
1053
183k
            if ( rSet.GetItemState( SID_VIEWONLY ) == SfxItemState::SET )
1054
0
                nAdditional++;
1055
183k
            if ( rSet.GetItemState( SID_EDITDOC ) == SfxItemState::SET )
1056
0
                nAdditional++;
1057
183k
            if ( rSet.GetItemState( SID_SILENT ) == SfxItemState::SET )
1058
0
                nAdditional++;
1059
183k
            if ( rSet.GetItemState( SID_JUMPMARK ) == SfxItemState::SET )
1060
2.90k
                nAdditional++;
1061
183k
            if ( rSet.GetItemState( SID_DOCUMENT ) == SfxItemState::SET )
1062
0
                nAdditional++;
1063
183k
            if ( rSet.GetItemState( SID_MACROEXECMODE ) == SfxItemState::SET )
1064
177k
                nAdditional++;
1065
183k
            if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SfxItemState::SET )
1066
0
                nAdditional++;
1067
183k
            if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SfxItemState::SET )
1068
0
                nAdditional++;
1069
183k
            if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SfxItemState::SET )
1070
0
                nAdditional++;
1071
183k
            if ( rSet.GetItemState( SID_COMPONENTDATA ) == SfxItemState::SET )
1072
0
                nAdditional++;
1073
183k
            if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SfxItemState::SET )
1074
0
                nAdditional++;
1075
183k
            if ( rSet.GetItemState( SID_DOC_BASEURL ) == SfxItemState::SET )
1076
0
                nAdditional++;
1077
183k
            if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SfxItemState::SET )
1078
0
                nAdditional++;
1079
183k
            if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SfxItemState::SET )
1080
0
                nAdditional++;
1081
183k
            if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SfxItemState::SET )
1082
0
                nAdditional++;
1083
183k
            if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SfxItemState::SET )
1084
0
                nAdditional++;
1085
183k
            if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SfxItemState::SET )
1086
0
                nAdditional++;
1087
183k
            if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SfxItemState::SET )
1088
329
                nAdditional++;
1089
183k
            if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SfxItemState::SET )
1090
0
                nAdditional++;
1091
183k
            if ( rSet.GetItemState( SID_EXPORTDIRECTORY ) == SfxItemState::SET )
1092
0
                nAdditional++;
1093
183k
            if ( rSet.GetItemState( SID_DOC_SERVICE ) == SfxItemState::SET )
1094
0
                nAdditional++;
1095
183k
            if (rSet.HasItem(SID_FILTER_PROVIDER))
1096
0
                ++nAdditional;
1097
183k
            if ( rSet.GetItemState( SID_CONVERT_IMAGES ) == SfxItemState::SET )
1098
0
                nAdditional++;
1099
183k
            if ( rSet.GetItemState( SID_LOCK_CONTENT_EXTRACTION ) == SfxItemState::SET )
1100
0
                nAdditional++;
1101
183k
            if ( rSet.GetItemState( SID_LOCK_EXPORT ) == SfxItemState::SET )
1102
0
                nAdditional++;
1103
183k
            if ( rSet.GetItemState( SID_LOCK_PRINT ) == SfxItemState::SET )
1104
0
                nAdditional++;
1105
183k
            if ( rSet.GetItemState( SID_LOCK_SAVE ) == SfxItemState::SET )
1106
0
                nAdditional++;
1107
183k
            if ( rSet.GetItemState( SID_LOCK_EDITDOC ) == SfxItemState::SET )
1108
0
                nAdditional++;
1109
183k
            if (rSet.GetItemState(SID_REPLACEABLE) == SfxItemState::SET)
1110
0
                nAdditional++;
1111
1112
            // consider additional arguments
1113
183k
            nProps += nAdditional;
1114
#ifdef DBG_UTIL
1115
            nItems += nAdditional;
1116
#endif
1117
183k
        }
1118
183k
    }
1119
1120
#ifdef DBG_UTIL
1121
    // now check the itemset: is there any item that is not convertible using the list of formal arguments
1122
    // or the table of additional items?!
1123
    if ( rSet.Count() != nItems )
1124
    {
1125
        // detect unknown item and present error message
1126
        for ( auto const & rPair : rSet.GetRanges() )
1127
        {
1128
            sal_uInt16 nStartWhich = rPair.first;
1129
            sal_uInt16 nEndWhich = rPair.second;
1130
            for(sal_uInt16 nId = nStartWhich; nId <= nEndWhich; ++nId)
1131
            {
1132
                if ( rSet.GetItemState(nId) < SfxItemState::SET ) //???
1133
                    // not really set
1134
                    continue;
1135
1136
                if ( !pSlot->IsMode(SfxSlotMode::METHOD) && nId == rSet.GetPool()->GetWhichIDFromSlotID( pSlot->GetSlotId() ) )
1137
                    continue;
1138
1139
                bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
1140
                sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount;
1141
                sal_uInt16 nArg;
1142
                for ( nArg=0; nArg<nFormalArgs; ++nArg )
1143
                {
1144
                    const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
1145
                    sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID( rArg.nSlotId );
1146
                    if ( nId == nWhich )
1147
                        break;
1148
                }
1149
1150
                if ( nArg<nFormalArgs )
1151
                    continue;
1152
1153
                if ( bIsMediaDescriptor )
1154
                {
1155
                    if ( nId == SID_DOCFRAME )
1156
                        continue;
1157
                    if ( nId == SID_PROGRESS_STATUSBAR_CONTROL )
1158
                        continue;
1159
                    if ( nId == SID_INTERACTIONHANDLER )
1160
                        continue;
1161
                    if ( nId == SID_VIEW_DATA )
1162
                        continue;
1163
                    if ( nId == SID_FILTER_DATA )
1164
                        continue;
1165
                    if ( nId == SID_DOCUMENT )
1166
                        continue;
1167
                    if ( nId == SID_CONTENT )
1168
                        continue;
1169
                    if ( nId == SID_INPUTSTREAM )
1170
                        continue;
1171
                    if ( nId == SID_STREAM )
1172
                        continue;
1173
                    if ( nId == SID_OUTPUTSTREAM )
1174
                        continue;
1175
                    if ( nId == SID_POSTDATA )
1176
                        continue;
1177
                    if ( nId == SID_FILLFRAME )
1178
                        continue;
1179
                    if ( nId == SID_TEMPLATE )
1180
                        continue;
1181
                    if ( nId == SID_OPEN_NEW_VIEW )
1182
                        continue;
1183
                    if ( nId == SID_VIEW_ID )
1184
                        continue;
1185
                    if ( nId == SID_PLUGIN_MODE )
1186
                        continue;
1187
                    if ( nId == SID_DOC_READONLY )
1188
                        continue;
1189
                    if ( nId == SID_DOC_STARTPRESENTATION )
1190
                        continue;
1191
                    if ( nId == SID_SELECTION )
1192
                        continue;
1193
                    if ( nId == SID_HIDDEN )
1194
                        continue;
1195
                    if ( nId == SID_MINIMIZED )
1196
                        continue;
1197
                    if ( nId == SID_SILENT )
1198
                        continue;
1199
                    if ( nId == SID_PREVIEW )
1200
                        continue;
1201
                    if ( nId == SID_VIEWONLY )
1202
                        continue;
1203
                    if ( nId == SID_EDITDOC )
1204
                        continue;
1205
                    if ( nId == SID_TARGETNAME )
1206
                        continue;
1207
                    if ( nId == SID_DOC_SALVAGE )
1208
                        continue;
1209
                    if ( nId == SID_PATH )
1210
                        continue;
1211
                    if ( nId == SID_FILE_DIALOG )
1212
                        continue;
1213
                    if ( nId == SID_DENY_LIST )
1214
                        continue;
1215
                    if ( nId == SID_CONTENTTYPE )
1216
                        continue;
1217
                    if ( nId == SID_TEMPLATE_NAME )
1218
                        continue;
1219
                    if ( nId == SID_TEMPLATE_REGIONNAME )
1220
                        continue;
1221
                    if ( nId == SID_JUMPMARK )
1222
                        continue;
1223
                    if ( nId == SID_CHARSET )
1224
                        continue;
1225
                    if ( nId == SID_MACROEXECMODE )
1226
                        continue;
1227
                    if ( nId == SID_UPDATEDOCMODE )
1228
                        continue;
1229
                    if ( nId == SID_REPAIRPACKAGE )
1230
                        continue;
1231
                    if ( nId == SID_DOCINFO_TITLE )
1232
                        continue;
1233
                    if ( nId == SID_COMPONENTDATA )
1234
                        continue;
1235
                    if ( nId == SID_COMPONENTCONTEXT )
1236
                        continue;
1237
                    if ( nId == SID_DOC_BASEURL )
1238
                        continue;
1239
                    if ( nId == SID_DOC_HIERARCHICALNAME )
1240
                        continue;
1241
                    if ( nId == SID_COPY_STREAM_IF_POSSIBLE )
1242
                        continue;
1243
                    if ( nId == SID_NOAUTOSAVE )
1244
                        continue;
1245
                    if ( nId == SID_ENCRYPTIONDATA )
1246
                        continue;
1247
                    if ( nId == SID_DOC_SERVICE )
1248
                        continue;
1249
                    if (nId == SID_FILTER_PROVIDER)
1250
                        continue;
1251
                    if ( nId == SID_CONVERT_IMAGES )
1252
                        continue;
1253
1254
                    // used only internally
1255
                    if ( nId == SID_SAVETO )
1256
                        continue;
1257
                    if ( nId == SID_SAVEACOPYITEM )
1258
                        continue;
1259
                    if ( nId == SID_MODIFYPASSWORDINFO )
1260
                        continue;
1261
                    if ( nId == SID_SUGGESTEDSAVEASDIR )
1262
                        continue;
1263
                    if ( nId == SID_SUGGESTEDSAVEASNAME )
1264
                        continue;
1265
                    if ( nId == SID_EXPORTDIRECTORY )
1266
                        continue;
1267
                    if ( nId == SID_LOCK_CONTENT_EXTRACTION )
1268
                        continue;
1269
                    if ( nId == SID_LOCK_EXPORT )
1270
                        continue;
1271
                    if ( nId == SID_LOCK_PRINT )
1272
                        continue;
1273
                    if ( nId == SID_LOCK_SAVE )
1274
                        continue;
1275
                    if ( nId == SID_LOCK_EDITDOC )
1276
                        continue;
1277
                    if (nId == SID_REPLACEABLE)
1278
                        continue;
1279
                }
1280
1281
                OString aDbg = "Unknown item detected: " + OString::number(static_cast<sal_Int32>(nId));
1282
                DBG_ASSERT(nArg<nFormalArgs, aDbg.getStr());
1283
            }
1284
        }
1285
    }
1286
#endif
1287
1288
183k
    if ( !nProps )
1289
0
        return {};
1290
1291
    // convert every item into a property
1292
183k
    comphelper::SequenceAsHashMap aSequ;
1293
1294
183k
    if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
1295
0
    {
1296
        // slot is a property
1297
0
        sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId);
1298
0
        bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
1299
0
        const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
1300
0
        if ( pItem ) //???
1301
0
        {
1302
0
            sal_uInt16 nSubCount = pType->nAttribs;
1303
0
            if ( !nSubCount )
1304
0
            {
1305
0
                if (!pItem->QueryValue(aSequ[pSlot->aUnoName]))
1306
0
                {
1307
0
                    SAL_WARN( "sfx", "Item not convertible: " << nSlotId );
1308
0
                }
1309
0
            }
1310
0
            else
1311
0
            {
1312
                // complex type, add a property value for every member of the struct
1313
0
                for ( sal_uInt16 n=1; n<=nSubCount; ++n )
1314
0
                {
1315
0
                    sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(n-1).nAID));
1316
0
                    if ( bConvertTwips )
1317
0
                        nSubId |= CONVERT_TWIPS;
1318
1319
0
                    DBG_ASSERT(( pType->getAttrib(n-1).nAID ) <= 127, "Member ID out of range" );
1320
0
                    if (!pItem->QueryValue(
1321
0
                            aSequ[pSlot->aUnoName + "." + pType->getAttrib(n - 1).aName], nSubId))
1322
0
                    {
1323
0
                        SAL_WARN( "sfx", "Sub item " << pType->getAttrib(n-1).nAID
1324
0
                                    << " not convertible in slot: " << nSlotId );
1325
0
                    }
1326
0
                }
1327
0
            }
1328
0
        }
1329
1330
0
        return aSequ;
1331
0
    }
1332
1333
    // slot is a method
1334
183k
    sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount();
1335
1.83M
    for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
1336
1.64M
    {
1337
1.64M
        const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg );
1338
1.64M
        sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID( rArg.nSlotId );
1339
1.64M
        bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == MapUnit::MapTwip );
1340
1.64M
        const SfxPoolItem* pItem = rSet.GetItem<SfxPoolItem>(nWhich, false);
1341
1.64M
        if ( pItem ) //???
1342
24.9k
        {
1343
24.9k
            sal_uInt16 nSubCount = rArg.pType->nAttribs;
1344
24.9k
            if ( !nSubCount )
1345
24.9k
            {
1346
24.9k
                if (!pItem->QueryValue(aSequ[rArg.aName]))
1347
0
                {
1348
0
                    SAL_WARN( "sfx", "Item not convertible: " << rArg.nSlotId );
1349
0
                }
1350
24.9k
            }
1351
0
            else
1352
0
            {
1353
                // complex type, add a property value for every member of the struct
1354
0
                for ( sal_uInt16 n = 1; n <= nSubCount; ++n )
1355
0
                {
1356
0
                    sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(rArg.pType->getAttrib(n-1).nAID));
1357
0
                    if ( bConvertTwips )
1358
0
                        nSubId |= CONVERT_TWIPS;
1359
1360
0
                    DBG_ASSERT((rArg.pType->getAttrib(n-1).nAID) <= 127, "Member ID out of range" );
1361
0
                    if (!pItem->QueryValue(
1362
0
                            aSequ[rArg.aName + "." + rArg.pType->getAttrib(n - 1).aName], nSubId))
1363
0
                    {
1364
0
                        SAL_WARN( "sfx", "Sub item "
1365
0
                                    << rArg.pType->getAttrib(n-1).nAID
1366
0
                                    << " not convertible in slot: "
1367
0
                                    << rArg.nSlotId );
1368
0
                    }
1369
0
                }
1370
0
            }
1371
24.9k
        }
1372
1.64M
    }
1373
1374
183k
    if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC ||  nSlotId == SID_SAVEDOC ||
1375
0
         nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ||
1376
0
         nSlotId == SID_EXPORTDOCASEPUB || nSlotId == SID_DIRECTEXPORTDOCASEPUB ||
1377
0
         nSlotId == SID_REDACTDOC || nSlotId == SID_AUTOREDACTDOC || nSlotId == SID_SAVEACOPY )
1378
183k
    {
1379
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTDATA, false) )
1380
0
        {
1381
0
            aSequ[sComponentData] = pItem->GetValue();
1382
0
        }
1383
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_COMPONENTCONTEXT, false) )
1384
0
        {
1385
0
            aSequ[sComponentContext] = pItem->GetValue();
1386
0
        }
1387
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_PROGRESS_STATUSBAR_CONTROL, false) )
1388
0
        {
1389
0
            aSequ[sStatusInd] = pItem->GetValue();
1390
0
        }
1391
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INTERACTIONHANDLER, false) )
1392
0
        {
1393
0
            aSequ[sInteractionHdl] = pItem->GetValue();
1394
0
        }
1395
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_VIEW_DATA, false) )
1396
0
        {
1397
0
            aSequ[sViewData] = pItem->GetValue();
1398
0
        }
1399
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_FILTER_DATA, false) )
1400
0
        {
1401
0
            aSequ[sFilterData] = pItem->GetValue();
1402
0
        }
1403
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_DOCUMENT, false) )
1404
0
        {
1405
0
            aSequ[sModel] = pItem->GetValue();
1406
0
        }
1407
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_CONTENT, false) )
1408
0
        {
1409
0
            aSequ[sUCBContent] = pItem->GetValue();
1410
0
        }
1411
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INPUTSTREAM, false) )
1412
39
        {
1413
39
            aSequ[sInputStream] = pItem->GetValue();
1414
39
        }
1415
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_STREAM, false) )
1416
0
        {
1417
0
            aSequ[sStream] = pItem->GetValue();
1418
0
        }
1419
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_OUTPUTSTREAM, false) )
1420
0
        {
1421
0
            aSequ[sOutputStream] = pItem->GetValue();
1422
0
        }
1423
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_POSTDATA, false) )
1424
0
        {
1425
0
            aSequ[sPostData] = pItem->GetValue();
1426
0
        }
1427
183k
        if ( const SfxPoolItem *pItem = nullptr; SfxItemState::SET == rSet.GetItemState( SID_FILLFRAME, false, &pItem) )
1428
0
        {
1429
0
            if ( auto pUsrAnyItem = dynamic_cast< const SfxUnoAnyItem *>( pItem ) )
1430
0
            {
1431
0
                OSL_FAIL( "TransformItems: transporting an XFrame via an SfxUnoAnyItem is not deprecated!" );
1432
0
                aSequ[sFrame] = pUsrAnyItem->GetValue();
1433
0
            }
1434
0
            else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem *>( pItem ) )
1435
0
                aSequ[sFrame] <<= pUnoFrameItem->GetFrame();
1436
0
            else
1437
0
                OSL_FAIL( "TransformItems: invalid item type for SID_FILLFRAME!" );
1438
0
        }
1439
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE, false) )
1440
0
        {
1441
0
            aSequ[sAsTemplate] <<= pItem->GetValue();
1442
0
        }
1443
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_OPEN_NEW_VIEW, false) )
1444
0
        {
1445
0
            aSequ[sOpenNewView] <<= pItem->GetValue();
1446
0
        }
1447
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FAIL_ON_WARNING, false) )
1448
0
        {
1449
0
            aSequ[sFailOnWarning] <<= pItem->GetValue();
1450
0
        }
1451
183k
        if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_VIEW_ID, false) )
1452
0
        {
1453
0
            aSequ[sViewId] <<= static_cast<sal_Int16>(pItem->GetValue());
1454
0
        }
1455
183k
        if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_PLUGIN_MODE, false) )
1456
0
        {
1457
0
            aSequ[sPluginMode] <<= static_cast<sal_Int16>(pItem->GetValue());
1458
0
        }
1459
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_READONLY, false) )
1460
6.25k
        {
1461
6.25k
            aSequ[sReadOnly] <<= pItem->GetValue();
1462
6.25k
        }
1463
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DDE_RECONNECT_ONLOAD, false) )
1464
0
        {
1465
0
            aSequ[sDdeReconnect] <<= pItem->GetValue();
1466
0
        }
1467
183k
        if (const SfxUInt16Item* pItem = rSet.GetItemIfSet(SID_DOC_STARTPRESENTATION, false))
1468
0
        {
1469
0
            aSequ[sStartPresentation] <<= pItem->GetValue();
1470
0
        }
1471
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SELECTION, false) )
1472
0
        {
1473
0
            aSequ[sSelectionOnly] <<= pItem->GetValue();
1474
0
        }
1475
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_HIDDEN, false) )
1476
0
        {
1477
0
            aSequ[sHidden] <<= pItem->GetValue();
1478
0
        }
1479
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_MINIMIZED, false) )
1480
0
        {
1481
0
            aSequ[sMinimized] <<= pItem->GetValue();
1482
0
        }
1483
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SILENT, false) )
1484
0
        {
1485
0
            aSequ[sSilent] <<= pItem->GetValue();
1486
0
        }
1487
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_PREVIEW, false) )
1488
0
        {
1489
0
            aSequ[sPreview] <<= pItem->GetValue();
1490
0
        }
1491
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_VIEWONLY, false) )
1492
0
        {
1493
0
            aSequ[sViewOnly] <<= pItem->GetValue();
1494
0
        }
1495
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_EDITDOC, false) )
1496
0
        {
1497
0
            aSequ[sDontEdit] <<= !pItem->GetValue();
1498
0
        }
1499
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FILE_DIALOG, false) )
1500
0
        {
1501
0
            aSequ[sUseSystemDialog] <<= pItem->GetValue();
1502
0
        }
1503
183k
        if ( const SfxStringListItem *pItem = rSet.GetItemIfSet( SID_DENY_LIST, false) )
1504
0
        {
1505
0
            css::uno::Sequence< OUString > aList;
1506
0
            pItem->GetStringList( aList );
1507
0
            aSequ[sDenyList] <<= aList;
1508
0
        }
1509
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TARGETNAME, false) )
1510
0
        {
1511
0
            aSequ[sFrameName] <<= pItem->GetValue();
1512
0
        }
1513
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SALVAGE, false) )
1514
0
        {
1515
0
            aSequ[sSalvagedFile] <<= pItem->GetValue();
1516
0
        }
1517
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_PATH, false) )
1518
0
        {
1519
0
            aSequ[sFolderName] <<= pItem->GetValue();
1520
0
        }
1521
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CONTENTTYPE, false) )
1522
0
        {
1523
0
            aSequ[sMediaType] <<= pItem->GetValue();
1524
0
        }
1525
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_NAME, false) )
1526
0
        {
1527
0
            aSequ[sTemplateName] <<= pItem->GetValue();
1528
0
        }
1529
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE_REGIONNAME, false) )
1530
0
        {
1531
0
            aSequ[sTemplateRegionName] <<= pItem->GetValue();
1532
0
        }
1533
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_JUMPMARK, false) )
1534
2.90k
        {
1535
2.90k
            aSequ[sJumpMark] <<= pItem->GetValue();
1536
2.90k
        }
1537
1538
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CHARSET, false) )
1539
0
        {
1540
0
            aSequ[sCharacterSet] <<= pItem->GetValue();
1541
0
        }
1542
183k
        if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_MACROEXECMODE, false) )
1543
177k
        {
1544
177k
            aSequ[sMacroExecMode] <<= static_cast<sal_Int16>(pItem->GetValue());
1545
177k
        }
1546
183k
        if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_UPDATEDOCMODE, false) )
1547
0
        {
1548
0
            aSequ[sUpdateDocMode] <<= static_cast<sal_Int16>(pItem->GetValue());
1549
0
        }
1550
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_REPAIRPACKAGE, false) )
1551
0
        {
1552
0
            aSequ[sRepairPackage] <<= pItem->GetValue() ;
1553
0
        }
1554
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOCINFO_TITLE, false) )
1555
0
        {
1556
0
            aSequ[sDocumentTitle] <<= pItem->GetValue();
1557
0
        }
1558
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_BASEURL, false) )
1559
0
        {
1560
0
            aSequ[sDocumentBaseURL] <<= pItem->GetValue();
1561
0
        }
1562
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_HIERARCHICALNAME, false) )
1563
0
        {
1564
0
            aSequ[sHierarchicalDocumentName] <<= pItem->GetValue();
1565
0
        }
1566
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_COPY_STREAM_IF_POSSIBLE, false) )
1567
0
        {
1568
0
            aSequ[sCopyStreamIfPossible] <<= pItem->GetValue();
1569
0
        }
1570
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_NOAUTOSAVE, false) )
1571
0
        {
1572
0
            aSequ[sNoAutoSave] <<= pItem->GetValue() ;
1573
0
        }
1574
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_MODIFYPASSWORDINFO, false) )
1575
0
        {
1576
0
            aSequ[sModifyPasswordInfo] = pItem->GetValue();
1577
0
        }
1578
183k
        if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_ENCRYPTIONDATA, false) )
1579
329
        {
1580
329
            aSequ[sEncryptionData] = pItem->GetValue();
1581
329
        }
1582
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASDIR, false) )
1583
0
        {
1584
0
            aSequ[sSuggestedSaveAsDir] <<= pItem->GetValue();
1585
0
        }
1586
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_SUGGESTEDSAVEASNAME, false) )
1587
0
        {
1588
0
            aSequ[sSuggestedSaveAsName] <<= pItem->GetValue();
1589
0
        }
1590
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_EXPORTDIRECTORY, false) )
1591
0
        {
1592
0
            aSequ[sExportDirectory] <<= pItem->GetValue();
1593
0
        }
1594
183k
        if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SERVICE, false) )
1595
0
        {
1596
0
            aSequ[sDocumentService] <<= pItem->GetValue();
1597
0
        }
1598
183k
        if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_FILTER_PROVIDER))
1599
0
        {
1600
0
            aSequ[sFilterProvider] <<= pItem->GetValue();
1601
0
        }
1602
183k
        if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_CONVERT_IMAGES))
1603
0
        {
1604
0
            aSequ[sImageFilter] <<= pItem->GetValue();
1605
0
        }
1606
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_CONTENT_EXTRACTION, false) )
1607
0
        {
1608
0
            aSequ[sLockContentExtraction] <<= pItem->GetValue() ;
1609
0
        }
1610
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EXPORT, false) )
1611
0
        {
1612
0
            aSequ[sLockExport] <<= pItem->GetValue() ;
1613
0
        }
1614
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_PRINT, false) )
1615
0
        {
1616
0
            aSequ[sLockPrint] <<= pItem->GetValue() ;
1617
0
        }
1618
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_SAVE, false) )
1619
0
        {
1620
0
            aSequ[sLockSave] <<= pItem->GetValue() ;
1621
0
        }
1622
183k
        if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EDITDOC, false) )
1623
0
        {
1624
0
            aSequ[sLockEditDoc] <<= pItem->GetValue();
1625
0
        }
1626
183k
        if (const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_REPLACEABLE, false))
1627
0
        {
1628
0
            aSequ[sReplaceable] <<= pItem->GetValue();
1629
0
        }
1630
183k
    }
1631
1632
183k
    return aSequ;
1633
183k
}
1634
1635
void SAL_CALL FilterOptionsContinuation::setFilterOptions(
1636
                const uno::Sequence<beans::PropertyValue>& rProps )
1637
0
{
1638
0
    rProperties = rProps;
1639
0
}
1640
1641
uno::Sequence< beans::PropertyValue > SAL_CALL
1642
    FilterOptionsContinuation::getFilterOptions()
1643
0
{
1644
0
    return rProperties;
1645
0
}
1646
1647
1648
RequestFilterOptions::RequestFilterOptions( uno::Reference< frame::XModel > const & rModel,
1649
                              const uno::Sequence< beans::PropertyValue >& rProperties )
1650
0
{
1651
0
    uno::Reference< uno::XInterface > temp2;
1652
0
    document::FilterOptionsRequest aOptionsRequest( OUString(),
1653
0
                                                    temp2,
1654
0
                                                    rModel,
1655
0
                                                    rProperties );
1656
1657
0
    m_aRequest <<= aOptionsRequest;
1658
1659
0
    m_xAbort  = new comphelper::OInteractionAbort;
1660
0
    m_xOptions = new FilterOptionsContinuation;
1661
0
}
1662
1663
uno::Any SAL_CALL RequestFilterOptions::getRequest()
1664
0
{
1665
0
    return m_aRequest;
1666
0
}
1667
1668
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1669
    SAL_CALL RequestFilterOptions::getContinuations()
1670
0
{
1671
0
    return { m_xAbort, m_xOptions };
1672
0
}
1673
1674
1675
class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1676
{
1677
    uno::Any m_aRequest;
1678
    rtl::Reference<comphelper::OInteractionApprove> m_xApprove;
1679
    rtl::Reference<comphelper::OInteractionDisapprove>  m_xDisapprove;
1680
1681
public:
1682
    explicit RequestPackageReparation_Impl( const OUString& aName );
1683
    bool    isApproved() const;
1684
    virtual uno::Any SAL_CALL getRequest() override;
1685
    virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1686
};
1687
1688
RequestPackageReparation_Impl::RequestPackageReparation_Impl( const OUString& aName )
1689
0
{
1690
0
    uno::Reference< uno::XInterface > temp2;
1691
0
    document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1692
0
    m_aRequest <<= aBrokenPackageRequest;
1693
0
    m_xApprove = new comphelper::OInteractionApprove;
1694
0
    m_xDisapprove = new comphelper::OInteractionDisapprove;
1695
0
}
1696
1697
bool RequestPackageReparation_Impl::isApproved() const
1698
0
{
1699
0
    return m_xApprove->wasSelected();
1700
0
}
1701
1702
uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest()
1703
0
{
1704
0
    return m_aRequest;
1705
0
}
1706
1707
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1708
    SAL_CALL RequestPackageReparation_Impl::getContinuations()
1709
0
{
1710
0
    return { m_xApprove, m_xDisapprove };
1711
0
}
1712
1713
RequestPackageReparation::RequestPackageReparation( const OUString& aName )
1714
0
    : mxImpl(new RequestPackageReparation_Impl( aName ))
1715
0
{
1716
0
}
1717
1718
RequestPackageReparation::~RequestPackageReparation()
1719
0
{
1720
0
}
1721
1722
bool RequestPackageReparation::isApproved() const
1723
0
{
1724
0
    return mxImpl->isApproved();
1725
0
}
1726
1727
css::uno::Reference < task::XInteractionRequest > RequestPackageReparation::GetRequest() const
1728
0
{
1729
0
    return mxImpl;
1730
0
}
1731
1732
1733
class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper< task::XInteractionRequest >
1734
{
1735
    uno::Any m_aRequest;
1736
    rtl::Reference<comphelper::OInteractionAbort>  m_xAbort;
1737
1738
public:
1739
    explicit NotifyBrokenPackage_Impl(const OUString& rName);
1740
    virtual uno::Any SAL_CALL getRequest() override;
1741
    virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override;
1742
};
1743
1744
NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( const OUString& aName )
1745
0
{
1746
0
    uno::Reference< uno::XInterface > temp2;
1747
0
    document::BrokenPackageRequest aBrokenPackageRequest( OUString(), temp2, aName );
1748
0
    m_aRequest <<= aBrokenPackageRequest;
1749
0
    m_xAbort = new comphelper::OInteractionAbort;
1750
0
}
1751
1752
uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest()
1753
0
{
1754
0
    return m_aRequest;
1755
0
}
1756
1757
uno::Sequence< uno::Reference< task::XInteractionContinuation > >
1758
    SAL_CALL NotifyBrokenPackage_Impl::getContinuations()
1759
0
{
1760
0
    return { m_xAbort };
1761
0
}
1762
1763
NotifyBrokenPackage::NotifyBrokenPackage( const OUString& aName )
1764
0
    : mxImpl(new NotifyBrokenPackage_Impl( aName ))
1765
0
{
1766
0
}
1767
1768
NotifyBrokenPackage::~NotifyBrokenPackage()
1769
0
{
1770
0
}
1771
1772
css::uno::Reference < task::XInteractionRequest > NotifyBrokenPackage::GetRequest() const
1773
0
{
1774
0
    return mxImpl;
1775
0
}
1776
1777
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */