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