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