1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sfx2.hxx" 26 #if defined(_MSC_VER) && (_MSC_VER >= 1300) 27 #pragma warning( disable : 4290 ) 28 #endif 29 #include <com/sun/star/document/UpdateDocMode.hpp> 30 31 #include "sal/config.h" 32 33 #include <sfx2/appuno.hxx> 34 #include "appbaslib.hxx" 35 36 #include "sfx2/dllapi.h" 37 38 #include <basic/sbx.hxx> 39 #include <svl/itempool.hxx> 40 #include <svl/rectitem.hxx> 41 #include <tools/debug.hxx> 42 #include <tools/wldcrd.hxx> 43 44 #include <tools/urlobj.hxx> 45 #include <tools/config.hxx> 46 #include <basic/sbxmeth.hxx> 47 #include <basic/sbmeth.hxx> 48 #include <basic/sbxobj.hxx> 49 #include <basic/sberrors.hxx> 50 #include <basic/basmgr.hxx> 51 #include <basic/sbuno.hxx> 52 53 #include <basic/sbxcore.hxx> 54 #include <svl/ownlist.hxx> 55 #include <svl/lckbitem.hxx> 56 #include <svl/stritem.hxx> 57 #include <svl/slstitm.hxx> 58 #include <svl/intitem.hxx> 59 #include <svl/eitem.hxx> 60 #include <com/sun/star/task/XStatusIndicatorFactory.hpp> 61 #include <com/sun/star/task/XInteractionHandler.hpp> 62 #include <com/sun/star/io/XInputStream.hpp> 63 #include <com/sun/star/beans/XPropertySet.hpp> 64 #include <com/sun/star/frame/XFrameActionListener.hpp> 65 #include <com/sun/star/frame/XComponentLoader.hpp> 66 #include <com/sun/star/frame/XFrame.hpp> 67 #include <com/sun/star/frame/FrameActionEvent.hpp> 68 #include <com/sun/star/frame/FrameAction.hpp> 69 #include <com/sun/star/container/XContainer.hpp> 70 #include <com/sun/star/container/XIndexContainer.hpp> 71 #include <com/sun/star/container/XNameReplace.hpp> 72 #include <com/sun/star/container/XContainerListener.hpp> 73 #include <com/sun/star/container/XSet.hpp> 74 #include <com/sun/star/container/ContainerEvent.hpp> 75 #include <com/sun/star/container/XIndexReplace.hpp> 76 #include <com/sun/star/container/XNameContainer.hpp> 77 #include <com/sun/star/awt/XTopWindow.hpp> 78 #include <com/sun/star/awt/XWindow.hpp> 79 #include <com/sun/star/awt/PosSize.hpp> 80 #include <com/sun/star/registry/RegistryValueType.hpp> 81 #include <comphelper/processfactory.hxx> 82 #include <com/sun/star/awt/PosSize.hpp> 83 #include <com/sun/star/awt/XButton.hpp> 84 #include <com/sun/star/frame/DispatchResultEvent.hpp> 85 #include <com/sun/star/frame/DispatchResultState.hpp> 86 #include <com/sun/star/frame/XModel.hpp> 87 #include <com/sun/star/document/MacroExecMode.hpp> 88 #include <com/sun/star/ucb/XContent.hpp> 89 90 #include <tools/cachestr.hxx> 91 #include <osl/mutex.hxx> 92 #include <comphelper/sequence.hxx> 93 #include <framework/documentundoguard.hxx> 94 #include <rtl/ustrbuf.hxx> 95 #include <comphelper/interaction.hxx> 96 97 using namespace ::com::sun::star; 98 using namespace ::com::sun::star::ucb; 99 using namespace ::com::sun::star::uno; 100 using namespace ::com::sun::star::registry; 101 using namespace ::com::sun::star::frame; 102 using namespace ::com::sun::star::beans; 103 using namespace ::com::sun::star::io; 104 105 #include "sfxtypes.hxx" 106 #include <sfx2/sfxuno.hxx> 107 #include <sfx2/app.hxx> 108 #include <sfx2/sfxsids.hrc> 109 #include <sfx2/msg.hxx> 110 #include <sfx2/msgpool.hxx> 111 #include <sfx2/request.hxx> 112 #include <sfx2/module.hxx> 113 #include <sfx2/fcontnr.hxx> 114 #include "frmload.hxx" 115 #include <sfx2/frame.hxx> 116 #include <sfx2/objsh.hxx> 117 #include <sfx2/objuno.hxx> 118 #include <sfx2/unoctitm.hxx> 119 #include <sfx2/dispatch.hxx> 120 #include "doctemplates.hxx" 121 #include "shutdownicon.hxx" 122 #include "objshimp.hxx" 123 #include "fltoptint.hxx" 124 #include <sfx2/docfile.hxx> 125 #include <sfx2/sfxbasecontroller.hxx> 126 #include <sfx2/brokenpackageint.hxx> 127 #include "eventsupplier.hxx" 128 #include "xpackcreator.hxx" 129 #include "plugin.hxx" 130 #include "iframe.hxx" 131 #include <ownsubfilterservice.hxx> 132 #include "SfxDocumentMetaData.hxx" 133 134 #define FRAMELOADER_SERVICENAME "com.sun.star.frame.FrameLoader" 135 #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" 136 137 #include <sfxslots.hxx> 138 139 // needs to be converted to a better data structure 140 SfxFormalArgument aFormalArgs[] = 141 { 142 SFX_ARGUMENT(SID_DEFAULTFILENAME,"SuggestedSaveAsName",SfxStringItem), 143 SFX_ARGUMENT(SID_DEFAULTFILEPATH,"SuggestedSaveAsDir",SfxStringItem), 144 SFX_ARGUMENT(SID_DOCINFO_AUTHOR,"VersionAuthor",SfxStringItem), 145 SFX_ARGUMENT(SID_DOCINFO_COMMENTS,"VersionComment",SfxStringItem), 146 SFX_ARGUMENT(SID_FILE_FILTEROPTIONS,"FilterOptions",SfxStringItem), 147 SFX_ARGUMENT(SID_FILTER_NAME,"FilterName",SfxStringItem), 148 // SFX_ARGUMENT(SID_FILE_NAME,"FileName",SfxStringItem), 149 SFX_ARGUMENT(SID_FILE_NAME,"URL",SfxStringItem), 150 SFX_ARGUMENT(SID_OPTIONS,"OpenFlags",SfxStringItem), 151 SFX_ARGUMENT(SID_OVERWRITE,"Overwrite",SfxBoolItem), 152 SFX_ARGUMENT(SID_PASSWORD,"Password",SfxStringItem), 153 SFX_ARGUMENT(SID_PASSWORDINTERACTION,"PasswordInteraction",SfxBoolItem), 154 SFX_ARGUMENT(SID_REFERER,"Referer",SfxStringItem), 155 SFX_ARGUMENT(SID_SAVETO,"SaveTo",SfxBoolItem), 156 SFX_ARGUMENT(SID_TEMPLATE_NAME,"TemplateName",SfxStringItem), 157 SFX_ARGUMENT(SID_TEMPLATE_REGIONNAME,"TemplateRegion",SfxStringItem), 158 // SFX_ARGUMENT(SID_TEMPLATE_REGIONNAME,"Region",SfxStringItem), 159 // SFX_ARGUMENT(SID_TEMPLATE_NAME,"Name",SfxStringItem), 160 SFX_ARGUMENT(SID_UNPACK,"Unpacked",SfxBoolItem), 161 SFX_ARGUMENT(SID_VERSION,"Version",SfxInt16Item), 162 }; 163 164 static sal_uInt16 nMediaArgsCount = sizeof(aFormalArgs) / sizeof (SfxFormalArgument); 165 166 static char const sTemplateRegionName[] = "TemplateRegionName"; 167 static char const sTemplateName[] = "TemplateName"; 168 static char const sAsTemplate[] = "AsTemplate"; 169 static char const sOpenNewView[] = "OpenNewView"; 170 static char const sViewId[] = "ViewId"; 171 static char const sPluginMode[] = "PluginMode"; 172 static char const sReadOnly[] = "ReadOnly"; 173 static char const sStartPresentation[] = "StartPresentation"; 174 static char const sFrameName[] = "FrameName"; 175 static char const sMediaType[] = "MediaType"; 176 static char const sPostData[] = "PostData"; 177 static char const sCharacterSet[] = "CharacterSet"; 178 static char const sInputStream[] = "InputStream"; 179 static char const sStream[] = "Stream"; 180 static char const sOutputStream[] = "OutputStream"; 181 static char const sHidden[] = "Hidden"; 182 static char const sPreview[] = "Preview"; 183 static char const sViewOnly[] = "ViewOnly"; 184 static char const sDontEdit[] = "DontEdit"; 185 static char const sSilent[] = "Silent"; 186 static char const sJumpMark[] = "JumpMark"; 187 static char const sFileName[] = "FileName"; 188 static char const sSalvagedFile[] = "SalvagedFile"; 189 static char const sStatusInd[] = "StatusIndicator"; 190 static char const sModel[] = "Model"; 191 static char const sFrame[] = "Frame"; 192 static char const sViewData[] = "ViewData"; 193 static char const sFilterData[] = "FilterData"; 194 static char const sSelectionOnly[] = "SelectionOnly"; 195 static char const sFilterFlags[] = "FilterFlags"; 196 static char const sMacroExecMode[] = "MacroExecutionMode"; 197 static char const sUpdateDocMode[] = "UpdateDocMode"; 198 static char const sMinimized[] = "Minimized"; 199 static char const sInteractionHdl[] = "InteractionHandler"; 200 static char const sUCBContent[] = "UCBContent"; 201 static char const sRepairPackage[] = "RepairPackage"; 202 static char const sDocumentTitle[] = "DocumentTitle"; 203 static char const sComponentData[] = "ComponentData"; 204 static char const sComponentContext[] = "ComponentContext"; 205 static char const sDocumentBaseURL[] = "DocumentBaseURL"; 206 static char const sHierarchicalDocumentName[] = "HierarchicalDocumentName"; 207 static char const sCopyStreamIfPossible[] = "CopyStreamIfPossible"; 208 static char const sNoAutoSave[] = "NoAutoSave"; 209 static char const sFolderName[] = "FolderName"; 210 static char const sUseSystemDialog[] = "UseSystemDialog"; 211 static char const sStandardDir[] = "StandardDir"; 212 static char const sBlackList[] = "BlackList"; 213 static char const sModifyPasswordInfo[] = "ModifyPasswordInfo"; 214 static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir"; 215 static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName"; 216 static char const sEncryptionData[] = "EncryptionData"; 217 static char const sFailOnWarning[] = "FailOnWarning"; 218 219 bool isMediaDescriptor( sal_uInt16 nSlotId ) 220 { 221 return ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC || 222 nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ); 223 } 224 225 void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) 226 { 227 if ( !pSlot ) 228 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId ); 229 230 if ( !pSlot ) 231 return; 232 233 if ( nSlotId == SID_OPENURL ) 234 nSlotId = SID_OPENDOC; 235 if ( nSlotId == SID_SAVEASURL ) 236 nSlotId = SID_SAVEASDOC; 237 238 sal_Int32 nCount = rArgs.getLength(); 239 if ( !nCount ) 240 return; 241 242 const ::com::sun::star::beans::PropertyValue* pPropsVal = rArgs.getConstArray(); 243 if ( !pSlot->IsMode(SFX_SLOT_METHOD) ) 244 { 245 // slot is a property 246 const SfxType* pType = pSlot->GetType(); 247 SfxPoolItem* pItem = pType->CreateItem(); 248 if ( !pItem ) 249 { 250 #ifdef DBG_UTIL 251 ByteString aStr( "No creator method for item: "); 252 aStr += ByteString::CreateFromInt32( nSlotId ); 253 DBG_ERROR( aStr.GetBuffer() ); 254 #endif 255 return; 256 } 257 258 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId); 259 sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); 260 pItem->SetWhich( nWhich ); 261 sal_uInt16 nSubCount = pType->nAttribs; 262 263 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[0]; 264 String aName = rProp.Name; 265 if ( nCount == 1 && aName.CompareToAscii( pSlot->pUnoName ) == COMPARE_EQUAL ) 266 { 267 // there is only one parameter and its name matches the name of the property, 268 // so it's either a simple property or a complex property in one single UNO struct 269 if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) ) 270 // only use successfully converted items 271 rSet.Put( *pItem ); 272 #ifdef DBG_UTIL 273 else 274 { 275 ByteString aStr( "Property not convertable: "); 276 aStr += pSlot->pUnoName; 277 DBG_ERROR( aStr.GetBuffer() ); 278 } 279 #endif 280 } 281 #ifdef DBG_UTIL 282 else if ( nSubCount == 0 ) 283 { 284 // for a simple property there can be only one parameter and its name *must* match 285 ByteString aStr( "Property name does not match: "); 286 aStr += ByteString( aName, RTL_TEXTENCODING_UTF8 ); 287 DBG_ERROR( aStr.GetBuffer() ); 288 } 289 #endif 290 else 291 { 292 // there is more than one parameter and the property is a complex one 293 #ifdef DBG_UTIL 294 // if the dispatch API is used for UI purposes or from the testtool, 295 // it is possible to skip some or all arguments, 296 // but it indicates an error for macro recording; 297 // so this should be notified as a warning only 298 if ( nCount != nSubCount ) 299 { 300 ByteString aStr( "MacroPlayer: wrong number of parameters for slot: "); 301 aStr += ByteString::CreateFromInt32( nSlotId ); 302 DBG_WARNING( aStr.GetBuffer() ); 303 } 304 #endif 305 // complex property; collect sub items from the parameter set and reconstruct complex item 306 sal_uInt16 nFound=0; 307 for ( sal_uInt16 n=0; n<nCount; n++ ) 308 { 309 const ::com::sun::star::beans::PropertyValue& rPropValue = pPropsVal[n]; 310 sal_uInt16 nSub; 311 for ( nSub=0; nSub<nSubCount; nSub++ ) 312 { 313 // search sub item by name 314 ByteString aStr( pSlot->pUnoName ); 315 aStr += '.'; 316 aStr += ByteString( pType->aAttrib[nSub].pName ); 317 const char* pName = aStr.GetBuffer(); 318 if ( rPropValue.Name.compareToAscii( pName ) == COMPARE_EQUAL ) 319 { 320 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID; 321 if ( bConvertTwips ) 322 nSubId |= CONVERT_TWIPS; 323 if ( pItem->PutValue( rPropValue.Value, nSubId ) ) 324 nFound++; 325 #ifdef DBG_UTIL 326 else 327 { 328 ByteString aDbgStr( "Property not convertable: "); 329 aDbgStr += pSlot->pUnoName; 330 DBG_ERROR( aDbgStr.GetBuffer() ); 331 } 332 #endif 333 break; 334 } 335 } 336 337 #ifdef DBG_UTIL 338 if ( nSub >= nSubCount ) 339 { 340 // there was a parameter with a name that didn't match to any of the members 341 ByteString aStr( "Property name does not match: "); 342 aStr += ByteString( String(rPropValue.Name), RTL_TEXTENCODING_UTF8 ); 343 DBG_ERROR( aStr.GetBuffer() ); 344 } 345 #endif 346 } 347 348 // at least one part of the complex item must be present; other parts can have default values 349 if ( nFound > 0 ) 350 rSet.Put( *pItem ); 351 } 352 353 delete pItem; 354 } 355 else if ( nCount ) 356 { 357 #ifdef DBG_UTIL 358 // detect parameters that don't match to any formal argument or one of its members 359 sal_Int32 nFoundArgs = 0; 360 #endif 361 // slot is a method 362 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId ); 363 sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount; 364 for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ ) 365 { 366 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs ); 367 SfxPoolItem* pItem = rArg.CreateItem(); 368 if ( !pItem ) 369 { 370 #ifdef DBG_UTIL 371 ByteString aStr( "No creator method for argument: "); 372 aStr += rArg.pName; 373 DBG_ERROR( aStr.GetBuffer() ); 374 #endif 375 return; 376 } 377 378 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(rArg.nSlotId); 379 sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); 380 pItem->SetWhich( nWhich ); 381 const SfxType* pType = rArg.pType; 382 sal_uInt16 nSubCount = pType->nAttribs; 383 if ( nSubCount == 0 ) 384 { 385 // "simple" (base type) argument 386 for ( sal_uInt16 n=0; n<nCount; n++ ) 387 { 388 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; 389 String aName = rProp.Name; 390 if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL ) 391 { 392 #ifdef DBG_UTIL 393 ++nFoundArgs; 394 #endif 395 if( pItem->PutValue( rProp.Value ) ) 396 // only use successfully converted items 397 rSet.Put( *pItem ); 398 #ifdef DBG_UTIL 399 else 400 { 401 ByteString aStr( "Property not convertable: "); 402 aStr += rArg.pName; 403 DBG_ERROR( aStr.GetBuffer() ); 404 } 405 #endif 406 break; 407 } 408 } 409 } 410 else 411 { 412 // complex argument, could be passed in one struct 413 sal_Bool bAsWholeItem = sal_False; 414 for ( sal_uInt16 n=0; n<nCount; n++ ) 415 { 416 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; 417 String aName = rProp.Name; 418 if ( aName.CompareToAscii(rArg.pName) == COMPARE_EQUAL ) 419 { 420 bAsWholeItem = sal_True; 421 #ifdef DBG_UTIL 422 ++nFoundArgs; 423 #endif 424 if( pItem->PutValue( rProp.Value ) ) 425 // only use successfully converted items 426 rSet.Put( *pItem ); 427 #ifdef DBG_UTIL 428 else 429 { 430 ByteString aStr( "Property not convertable: "); 431 aStr += rArg.pName; 432 DBG_ERROR( aStr.GetBuffer() ); 433 } 434 #endif 435 } 436 } 437 438 if ( !bAsWholeItem ) 439 { 440 // complex argument; collect sub items from argument array and reconstruct complex item 441 // only put item if at least one member was found and had the correct type 442 // (is this a good idea?! Should we ask for *all* members?) 443 sal_Bool bRet = sal_False; 444 for ( sal_uInt16 n=0; n<nCount; n++ ) 445 { 446 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; 447 for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ ) 448 { 449 // search sub item by name 450 ByteString aStr( rArg.pName ); 451 aStr += '.'; 452 aStr += pType->aAttrib[nSub].pName; 453 const char* pName = aStr.GetBuffer(); 454 if ( rProp.Name.compareToAscii( pName ) == COMPARE_EQUAL ) 455 { 456 // at least one member found ... 457 bRet = sal_True; 458 #ifdef DBG_UTIL 459 ++nFoundArgs; 460 #endif 461 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[nSub].nAID; 462 if ( bConvertTwips ) 463 nSubId |= CONVERT_TWIPS; 464 if (!pItem->PutValue( rProp.Value, nSubId ) ) 465 { 466 // ... but it was not convertable 467 bRet = sal_False; 468 #ifdef DBG_UTIL 469 ByteString aDbgStr( "Property not convertable: "); 470 aDbgStr += rArg.pName; 471 DBG_ERROR( aDbgStr.GetBuffer() ); 472 #endif 473 } 474 475 break; 476 } 477 } 478 } 479 480 if ( bRet ) 481 // only use successfully converted items 482 rSet.Put( *pItem ); 483 484 } 485 } 486 487 delete pItem; 488 } 489 490 // special additional parameters for some slots not seen in the slot definitions 491 // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots, 492 // but as dispatching or factory or arbitrary URLs to the frame 493 // Some also can use additional arguments that are not recordable (will be changed later, 494 // f.e. "SaveAs" shouldn't support parameters not in the slot definition!) 495 if ( nSlotId == SID_NEWWINDOW ) 496 { 497 for ( sal_uInt16 n=0; n<nCount; n++ ) 498 { 499 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; 500 rtl::OUString aName = rProp.Name; 501 if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) 502 { 503 Reference< XFrame > xFrame; 504 OSL_VERIFY( rProp.Value >>= xFrame ); 505 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); 506 } 507 else 508 if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) 509 { 510 sal_Bool bVal = sal_False; 511 if (rProp.Value >>= bVal) 512 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) ); 513 } 514 } 515 } 516 else if ( bIsMediaDescriptor ) 517 { 518 for ( sal_uInt16 n=0; n<nCount; n++ ) 519 { 520 #ifdef DBG_UTIL 521 ++nFoundArgs; 522 #endif 523 const ::com::sun::star::beans::PropertyValue& rProp = pPropsVal[n]; 524 rtl::OUString aName = rProp.Name; 525 if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModel)) ) 526 rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) ); 527 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentData)) ) 528 { 529 rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) ); 530 } 531 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sComponentContext)) ) 532 { 533 rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) ); 534 } 535 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStatusInd)) ) 536 { 537 Reference< ::com::sun::star::task::XStatusIndicator > xVal; 538 sal_Bool bOK = (rProp.Value >>= xVal); 539 DBG_ASSERT( bOK, "invalid type for StatusIndicator" ); 540 if (bOK && xVal.is()) 541 rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) ); 542 } 543 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInteractionHdl)) ) 544 { 545 Reference< ::com::sun::star::task::XInteractionHandler > xVal; 546 sal_Bool bOK = (rProp.Value >>= xVal); 547 DBG_ASSERT( bOK, "invalid type for InteractionHandler" ); 548 if (bOK && xVal.is()) 549 rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) ); 550 } 551 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewData)) ) 552 rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) ); 553 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterData)) ) 554 rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) ); 555 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sInputStream)) ) 556 { 557 Reference< XInputStream > xVal; 558 sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); 559 DBG_ASSERT( bOK, "invalid type for InputStream" ); 560 if (bOK) 561 rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) ); 562 } 563 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStream)) ) 564 { 565 Reference< XInputStream > xVal; 566 sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); 567 DBG_ASSERT( bOK, "invalid type for Stream" ); 568 if (bOK) 569 rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) ); 570 } 571 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUCBContent)) ) 572 { 573 Reference< XContent > xVal; 574 sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); 575 DBG_ASSERT( bOK, "invalid type for UCBContent" ); 576 if (bOK) 577 rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) ); 578 } 579 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOutputStream)) ) 580 { 581 Reference< XOutputStream > xVal; 582 sal_Bool bOK = ((rProp.Value >>= xVal) && xVal.is()); 583 DBG_ASSERT( bOK, "invalid type for OutputStream" ); 584 if (bOK) 585 rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) ); 586 } 587 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPostData)) ) 588 { 589 Reference< XInputStream > xVal; 590 sal_Bool bOK = (rProp.Value >>= xVal); 591 DBG_ASSERT( bOK, "invalid type for PostData" ); 592 if (bOK) 593 rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) ); 594 } 595 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrame)) ) 596 { 597 Reference< XFrame > xFrame; 598 sal_Bool bOK = (rProp.Value >>= xFrame); 599 DBG_ASSERT( bOK, "invalid type for Frame" ); 600 if (bOK) 601 rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) ); 602 } 603 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sAsTemplate)) ) 604 { 605 sal_Bool bVal = sal_False; 606 sal_Bool bOK = (rProp.Value >>= bVal); 607 DBG_ASSERT( bOK, "invalid type for AsTemplate" ); 608 if (bOK) 609 rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) ); 610 } 611 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sOpenNewView)) ) 612 { 613 sal_Bool bVal = sal_False; 614 sal_Bool bOK = (rProp.Value >>= bVal); 615 DBG_ASSERT( bOK, "invalid type for OpenNewView" ); 616 if (bOK) 617 rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) ); 618 } 619 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFailOnWarning)) ) 620 { 621 sal_Bool bVal = sal_False; 622 sal_Bool bOK = (rProp.Value >>= bVal); 623 DBG_ASSERT( bOK, "invalid type for FailOnWarning" ); 624 if (bOK) 625 rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) ); 626 } 627 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewId)) ) 628 { 629 sal_Int16 nVal = -1; 630 sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); 631 DBG_ASSERT( bOK, "invalid type for ViewId" ); 632 if (bOK) 633 rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) ); 634 } 635 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPluginMode)) ) 636 { 637 sal_Int16 nVal = -1; 638 sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); 639 DBG_ASSERT( bOK, "invalid type for PluginMode" ); 640 if (bOK) 641 rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) ); 642 } 643 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sReadOnly)) ) 644 { 645 sal_Bool bVal = sal_False; 646 sal_Bool bOK = (rProp.Value >>= bVal); 647 DBG_ASSERT( bOK, "invalid type for ReadOnly" ); 648 if (bOK) 649 rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) ); 650 } 651 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStartPresentation)) ) 652 { 653 sal_Bool bVal = sal_False; 654 sal_Bool bOK = (rProp.Value >>= bVal); 655 DBG_ASSERT( bOK, "invalid type for StartPresentation" ); 656 if (bOK) 657 rSet.Put( SfxBoolItem( SID_DOC_STARTPRESENTATION, bVal ) ); 658 } 659 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSelectionOnly)) ) 660 { 661 sal_Bool bVal = sal_False; 662 sal_Bool bOK = (rProp.Value >>= bVal); 663 DBG_ASSERT( bOK, "invalid type for SelectionOnly" ); 664 if (bOK) 665 rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) ); 666 } 667 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHidden)) ) 668 { 669 sal_Bool bVal = sal_False; 670 sal_Bool bOK = (rProp.Value >>= bVal); 671 DBG_ASSERT( bOK, "invalid type for Hidden" ); 672 if (bOK) 673 rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) ); 674 } 675 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMinimized)) ) 676 { 677 sal_Bool bVal = sal_False; 678 sal_Bool bOK = (rProp.Value >>= bVal); 679 DBG_ASSERT( bOK, "invalid type for Minimized" ); 680 if (bOK) 681 rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) ); 682 } 683 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSilent)) ) 684 { 685 sal_Bool bVal = sal_False; 686 sal_Bool bOK = (rProp.Value >>= bVal); 687 DBG_ASSERT( bOK, "invalid type for Silent" ); 688 if (bOK) 689 rSet.Put( SfxBoolItem( SID_SILENT, bVal ) ); 690 } 691 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sPreview)) ) 692 { 693 sal_Bool bVal = sal_False; 694 sal_Bool bOK = (rProp.Value >>= bVal); 695 DBG_ASSERT( bOK, "invalid type for Preview" ); 696 if (bOK) 697 rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) ); 698 } 699 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sViewOnly)) ) 700 { 701 sal_Bool bVal = sal_False; 702 sal_Bool bOK = (rProp.Value >>= bVal); 703 DBG_ASSERT( bOK, "invalid type for ViewOnly" ); 704 if (bOK) 705 rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) ); 706 } 707 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDontEdit)) ) 708 { 709 sal_Bool bVal = sal_False; 710 sal_Bool bOK = (rProp.Value >>= bVal); 711 DBG_ASSERT( bOK, "invalid type for ViewOnly" ); 712 if (bOK) 713 rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) ); 714 } 715 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUseSystemDialog)) ) 716 { 717 sal_Bool bVal = sal_False; 718 sal_Bool bOK = (rProp.Value >>= bVal); 719 DBG_ASSERT( bOK, "invalid type for ViewOnly" ); 720 if (bOK) 721 rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) ); 722 } 723 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sStandardDir)) ) 724 { 725 ::rtl::OUString sVal; 726 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 727 DBG_ASSERT( bOK, "invalid type or value for StandardDir" ); 728 if (bOK) 729 rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); 730 } 731 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sBlackList)) ) 732 { 733 ::com::sun::star::uno::Sequence< ::rtl::OUString > xVal; 734 sal_Bool bOK = (rProp.Value >>= xVal); 735 DBG_ASSERT( bOK, "invalid type or value for BlackList" ); 736 if (bOK) 737 { 738 SfxStringListItem stringList(SID_BLACK_LIST); 739 stringList.SetStringList( xVal ); 740 rSet.Put( stringList ); 741 } 742 } 743 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFileName)) ) 744 { 745 ::rtl::OUString sVal; 746 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 747 DBG_ASSERT( bOK, "invalid type or value for FileName" ); 748 if (bOK) 749 rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); 750 } 751 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvagedFile)) ) 752 { 753 ::rtl::OUString sVal; 754 sal_Bool bOK = (rProp.Value >>= sVal); 755 DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" ); 756 if (bOK) 757 rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) ); 758 } 759 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFolderName)) ) 760 { 761 ::rtl::OUString sVal; 762 sal_Bool bOK = (rProp.Value >>= sVal); 763 DBG_ASSERT( bOK, "invalid type or value for FolderName" ); 764 if (bOK) 765 rSet.Put( SfxStringItem( SID_PATH, sVal ) ); 766 } 767 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFrameName)) ) 768 { 769 ::rtl::OUString sVal; 770 sal_Bool bOK = (rProp.Value >>= sVal); 771 DBG_ASSERT( bOK, "invalid type for FrameName" ); 772 if (bOK && sVal.getLength()) 773 rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) ); 774 } 775 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMediaType)) ) 776 { 777 ::rtl::OUString sVal; 778 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 779 DBG_ASSERT( bOK, "invalid type or value for MediaType" ); 780 if (bOK) 781 rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) ); 782 } 783 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateName)) ) 784 { 785 ::rtl::OUString sVal; 786 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 787 DBG_ASSERT( bOK, "invalid type or value for TemplateName" ); 788 if (bOK) 789 rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) ); 790 } 791 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sTemplateRegionName)) ) 792 { 793 ::rtl::OUString sVal; 794 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 795 DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" ); 796 if (bOK) 797 rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) ); 798 } 799 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sJumpMark)) ) 800 { 801 ::rtl::OUString sVal; 802 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 803 DBG_ASSERT( bOK, "invalid type or value for JumpMark" ); 804 if (bOK) 805 rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) ); 806 } 807 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCharacterSet)) ) 808 { 809 ::rtl::OUString sVal; 810 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 811 DBG_ASSERT( bOK, "invalid type or value for CharacterSet" ); 812 if (bOK) 813 rSet.Put( SfxStringItem( SID_CHARSET, sVal ) ); 814 } 815 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sFilterFlags)) ) 816 { 817 ::rtl::OUString sVal; 818 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 819 DBG_ASSERT( bOK, "invalid type or value for FilterFlags" ); 820 if (bOK) 821 rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) ); 822 } 823 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sMacroExecMode)) ) 824 { 825 sal_Int16 nVal =-1; 826 sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); 827 DBG_ASSERT( bOK, "invalid type for MacroExecMode" ); 828 if (bOK) 829 rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) ); 830 } 831 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sUpdateDocMode)) ) 832 { 833 sal_Int16 nVal =-1; 834 sal_Bool bOK = ((rProp.Value >>= nVal) && (nVal != -1)); 835 DBG_ASSERT( bOK, "invalid type for UpdateDocMode" ); 836 if (bOK) 837 rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) ); 838 } 839 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sRepairPackage)) ) 840 { 841 sal_Bool bVal = sal_False; 842 sal_Bool bOK = (rProp.Value >>= bVal); 843 DBG_ASSERT( bOK, "invalid type for RepairPackage" ); 844 if (bOK) 845 rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) ); 846 } 847 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentTitle)) ) 848 { 849 ::rtl::OUString sVal; 850 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 851 DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" ); 852 if (bOK) 853 rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) ); 854 } 855 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sDocumentBaseURL)) ) 856 { 857 ::rtl::OUString sVal; 858 // the base url can be set to empty ( for embedded objects for example ) 859 sal_Bool bOK = (rProp.Value >>= sVal); 860 DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" ); 861 if (bOK) 862 rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) ); 863 } 864 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sHierarchicalDocumentName)) ) 865 { 866 ::rtl::OUString sVal; 867 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 868 DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" ); 869 if (bOK) 870 rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) ); 871 } 872 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sCopyStreamIfPossible)) ) 873 { 874 sal_Bool bVal = sal_False; 875 sal_Bool bOK = (rProp.Value >>= bVal); 876 DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" ); 877 if (bOK) 878 rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) ); 879 } 880 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sNoAutoSave)) ) 881 { 882 sal_Bool bVal = sal_False; 883 sal_Bool bOK = (rProp.Value >>= bVal); 884 DBG_ASSERT( bOK, "invalid type for NoAutoSave" ); 885 if (bOK) 886 rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) ); 887 } 888 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sModifyPasswordInfo)) ) 889 { 890 rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) ); 891 } 892 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sEncryptionData)) ) 893 { 894 rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) ); 895 } 896 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsDir)) ) 897 { 898 ::rtl::OUString sVal; 899 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 900 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" ); 901 if (bOK) 902 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) ); 903 } 904 else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsName)) ) 905 { 906 ::rtl::OUString sVal; 907 sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); 908 DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" ); 909 if (bOK) 910 rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) ); 911 } 912 #ifdef DBG_UTIL 913 else 914 --nFoundArgs; 915 #endif 916 } 917 } 918 // --> PB 2007-12-09 #i83757# 919 else 920 { 921 // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog" 922 String sSlotName( DEFINE_CONST_UNICODE( "OptionsTreeDialog" ) ); 923 String sPropName( DEFINE_CONST_UNICODE( "OptionsPageURL" ) ); 924 if ( sSlotName.EqualsAscii( pSlot->pUnoName ) ) 925 { 926 for ( sal_uInt16 n = 0; n < nCount; ++n ) 927 { 928 const PropertyValue& rProp = pPropsVal[n]; 929 String sName( rProp.Name ); 930 if ( sName == sPropName ) 931 { 932 ::rtl::OUString sURL; 933 if ( rProp.Value >>= sURL ) 934 rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) ); 935 break; 936 } 937 } 938 } 939 } 940 // <-- 941 #ifdef DB_UTIL 942 if ( nFoundArgs == nCount ) 943 { 944 // except for the "special" slots: assure that every argument was convertable 945 ByteString aStr( "MacroPlayer: Some properties didn't match to any formal argument for slot: "); 946 aStr += pSlot->pUnoName; 947 DBG_WARNING( aStr.GetBuffer() ); 948 } 949 #endif 950 } 951 } 952 953 void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, const SfxSlot* pSlot ) 954 { 955 if ( !pSlot ) 956 pSlot = SFX_SLOTPOOL().GetSlot( nSlotId ); 957 958 if ( !pSlot) 959 return; 960 961 if ( nSlotId == SID_OPENURL ) 962 nSlotId = SID_OPENDOC; 963 if ( nSlotId == SID_SAVEASURL ) 964 nSlotId = SID_SAVEASDOC; 965 966 // find number of properties to avoid permanent reallocations in the sequence 967 sal_Int32 nProps=0; 968 969 #ifdef DBG_UTIL 970 // trace number of items and compare with number of properties for debugging purposes 971 sal_Int32 nItems=0; 972 #endif 973 974 const SfxType *pType = pSlot->GetType(); 975 if ( !pSlot->IsMode(SFX_SLOT_METHOD) ) 976 { 977 // slot is a property 978 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId); 979 if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //??? 980 { 981 sal_uInt16 nSubCount = pType->nAttribs; 982 if ( nSubCount ) 983 // it's a complex property, we want it split into simple types 984 // so we expect to get as many items as we have (sub) members 985 nProps = nSubCount; 986 else 987 // simple property: we expect to get exactly one item 988 nProps++; 989 } 990 #ifdef DBG_UTIL 991 else 992 { 993 // we will not rely on the "toggle" ability of some property slots 994 ByteString aStr( "Processing property slot without argument: "); 995 aStr += ByteString::CreateFromInt32( nSlotId ); 996 DBG_ERROR( aStr.GetBuffer() ); 997 } 998 #endif 999 1000 #ifdef DBG_UTIL 1001 nItems++; 1002 #endif 1003 } 1004 else 1005 { 1006 // slot is a method 1007 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId ); 1008 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount(); 1009 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg ) 1010 { 1011 // check every formal argument of the method 1012 const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg ); 1013 1014 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId ); 1015 if ( rSet.GetItemState( nWhich ) == SFX_ITEM_SET ) //??? 1016 { 1017 sal_uInt16 nSubCount = rArg.pType->nAttribs; 1018 if ( nSubCount ) 1019 // argument has a complex type, we want it split into simple types 1020 // so for this argument we expect to get as many items as we have (sub) members 1021 nProps += nSubCount; 1022 else 1023 // argument of simple type: we expect to get exactly one item for it 1024 nProps++; 1025 #ifdef DBG_UTIL 1026 nItems++; 1027 #endif 1028 } 1029 } 1030 1031 // special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To) 1032 if ( bIsMediaDescriptor ) 1033 { 1034 sal_Int32 nAdditional=0; 1035 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SFX_ITEM_SET ) 1036 nAdditional++; 1037 if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SFX_ITEM_SET ) 1038 nAdditional++; 1039 if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SFX_ITEM_SET ) 1040 nAdditional++; 1041 if ( rSet.GetItemState( SID_PATH ) == SFX_ITEM_SET ) 1042 nAdditional++; 1043 if ( rSet.GetItemState( SID_FILE_DIALOG ) == SFX_ITEM_SET ) 1044 nAdditional++; 1045 if ( rSet.GetItemState( SID_STANDARD_DIR ) == SFX_ITEM_SET ) 1046 nAdditional++; 1047 if ( rSet.GetItemState( SID_BLACK_LIST ) == SFX_ITEM_SET ) 1048 nAdditional++; 1049 if ( rSet.GetItemState( SID_CONTENT ) == SFX_ITEM_SET ) 1050 nAdditional++; 1051 if ( rSet.GetItemState( SID_INPUTSTREAM ) == SFX_ITEM_SET ) 1052 nAdditional++; 1053 if ( rSet.GetItemState( SID_STREAM ) == SFX_ITEM_SET ) 1054 nAdditional++; 1055 if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SFX_ITEM_SET ) 1056 nAdditional++; 1057 if ( rSet.GetItemState( SID_TEMPLATE ) == SFX_ITEM_SET ) 1058 nAdditional++; 1059 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SFX_ITEM_SET ) 1060 nAdditional++; 1061 if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SFX_ITEM_SET ) 1062 nAdditional++; 1063 if ( rSet.GetItemState( SID_VIEW_ID ) == SFX_ITEM_SET ) 1064 nAdditional++; 1065 if ( rSet.GetItemState( SID_VIEW_DATA ) == SFX_ITEM_SET ) 1066 nAdditional++; 1067 if ( rSet.GetItemState( SID_FILTER_DATA ) == SFX_ITEM_SET ) 1068 nAdditional++; 1069 if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SFX_ITEM_SET ) 1070 nAdditional++; 1071 if ( rSet.GetItemState( SID_DOC_READONLY ) == SFX_ITEM_SET ) 1072 nAdditional++; 1073 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SFX_ITEM_SET ) 1074 nAdditional++; 1075 if ( rSet.GetItemState( SID_SELECTION ) == SFX_ITEM_SET ) 1076 nAdditional++; 1077 if ( rSet.GetItemState( SID_CONTENTTYPE ) == SFX_ITEM_SET ) 1078 nAdditional++; 1079 if ( rSet.GetItemState( SID_POSTDATA ) == SFX_ITEM_SET ) 1080 nAdditional++; 1081 if ( rSet.GetItemState( SID_FILLFRAME ) == SFX_ITEM_SET ) 1082 nAdditional++; 1083 if ( rSet.GetItemState( SID_CHARSET ) == SFX_ITEM_SET ) 1084 nAdditional++; 1085 if ( rSet.GetItemState( SID_TARGETNAME ) == SFX_ITEM_SET ) 1086 nAdditional++; 1087 if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SFX_ITEM_SET ) 1088 nAdditional++; 1089 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SFX_ITEM_SET ) 1090 nAdditional++; 1091 if ( rSet.GetItemState( SID_HIDDEN ) == SFX_ITEM_SET ) 1092 nAdditional++; 1093 if ( rSet.GetItemState( SID_MINIMIZED ) == SFX_ITEM_SET ) 1094 nAdditional++; 1095 if ( rSet.GetItemState( SID_PREVIEW ) == SFX_ITEM_SET ) 1096 nAdditional++; 1097 if ( rSet.GetItemState( SID_VIEWONLY ) == SFX_ITEM_SET ) 1098 nAdditional++; 1099 if ( rSet.GetItemState( SID_EDITDOC ) == SFX_ITEM_SET ) 1100 nAdditional++; 1101 if ( rSet.GetItemState( SID_SILENT ) == SFX_ITEM_SET ) 1102 nAdditional++; 1103 if ( rSet.GetItemState( SID_JUMPMARK ) == SFX_ITEM_SET ) 1104 nAdditional++; 1105 if ( rSet.GetItemState( SID_DOCUMENT ) == SFX_ITEM_SET ) 1106 nAdditional++; 1107 if ( rSet.GetItemState( SID_MACROEXECMODE ) == SFX_ITEM_SET ) 1108 nAdditional++; 1109 if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SFX_ITEM_SET ) 1110 nAdditional++; 1111 if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SFX_ITEM_SET ) 1112 nAdditional++; 1113 if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SFX_ITEM_SET ) 1114 nAdditional++; 1115 if ( rSet.GetItemState( SID_COMPONENTDATA ) == SFX_ITEM_SET ) 1116 nAdditional++; 1117 if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SFX_ITEM_SET ) 1118 nAdditional++; 1119 if ( rSet.GetItemState( SID_DOC_BASEURL ) == SFX_ITEM_SET ) 1120 nAdditional++; 1121 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SFX_ITEM_SET ) 1122 nAdditional++; 1123 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SFX_ITEM_SET ) 1124 nAdditional++; 1125 if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SFX_ITEM_SET ) 1126 nAdditional++; 1127 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET ) 1128 nAdditional++; 1129 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET ) 1130 nAdditional++; 1131 if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SFX_ITEM_SET ) 1132 nAdditional++; 1133 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET ) 1134 nAdditional++; 1135 1136 // consider additional arguments 1137 nProps += nAdditional; 1138 #ifdef DBG_UTIL 1139 nItems += nAdditional; 1140 #endif 1141 } 1142 } 1143 1144 #ifdef DBG_UTIL 1145 // now check the itemset: is there any item that is not convertable using the list of formal arguments 1146 // or the table of additional items?! 1147 if ( rSet.Count() != nItems ) 1148 { 1149 // detect unknown item and present error message 1150 const sal_uInt16 *pRanges = rSet.GetRanges(); 1151 while ( *pRanges ) 1152 { 1153 for(sal_uInt16 nId = *pRanges++; nId <= *pRanges; ++nId) 1154 { 1155 if ( rSet.GetItemState(nId) < SFX_ITEM_SET ) //??? 1156 // not really set 1157 continue; 1158 1159 if ( !pSlot->IsMode(SFX_SLOT_METHOD) && nId == rSet.GetPool()->GetWhich( pSlot->GetSlotId() ) ) 1160 continue; 1161 1162 bool bIsMediaDescriptor = isMediaDescriptor( nSlotId ); 1163 sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount; 1164 sal_uInt16 nArg; 1165 for ( nArg=0; nArg<nFormalArgs; ++nArg ) 1166 { 1167 const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg ); 1168 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId ); 1169 if ( nId == nWhich ) 1170 break; 1171 } 1172 1173 if ( nArg<nFormalArgs ) 1174 continue; 1175 1176 if ( bIsMediaDescriptor ) 1177 { 1178 if ( nId == SID_DOCFRAME ) 1179 continue; 1180 if ( nId == SID_PROGRESS_STATUSBAR_CONTROL ) 1181 continue; 1182 if ( nId == SID_INTERACTIONHANDLER ) 1183 continue; 1184 if ( nId == SID_VIEW_DATA ) 1185 continue; 1186 if ( nId == SID_FILTER_DATA ) 1187 continue; 1188 if ( nId == SID_DOCUMENT ) 1189 continue; 1190 if ( nId == SID_CONTENT ) 1191 continue; 1192 if ( nId == SID_INPUTSTREAM ) 1193 continue; 1194 if ( nId == SID_STREAM ) 1195 continue; 1196 if ( nId == SID_OUTPUTSTREAM ) 1197 continue; 1198 if ( nId == SID_POSTDATA ) 1199 continue; 1200 if ( nId == SID_FILLFRAME ) 1201 continue; 1202 if ( nId == SID_TEMPLATE ) 1203 continue; 1204 if ( nId == SID_OPEN_NEW_VIEW ) 1205 continue; 1206 if ( nId == SID_VIEW_ID ) 1207 continue; 1208 if ( nId == SID_PLUGIN_MODE ) 1209 continue; 1210 if ( nId == SID_DOC_READONLY ) 1211 continue; 1212 if ( nId == SID_DOC_STARTPRESENTATION ) 1213 continue; 1214 if ( nId == SID_SELECTION ) 1215 continue; 1216 if ( nId == SID_HIDDEN ) 1217 continue; 1218 if ( nId == SID_MINIMIZED ) 1219 continue; 1220 if ( nId == SID_SILENT ) 1221 continue; 1222 if ( nId == SID_PREVIEW ) 1223 continue; 1224 if ( nId == SID_VIEWONLY ) 1225 continue; 1226 if ( nId == SID_EDITDOC ) 1227 continue; 1228 if ( nId == SID_TARGETNAME ) 1229 continue; 1230 if ( nId == SID_DOC_SALVAGE ) 1231 continue; 1232 if ( nId == SID_PATH ) 1233 continue; 1234 if ( nId == SID_FILE_DIALOG ) 1235 continue; 1236 if ( nId == SID_STANDARD_DIR ) 1237 continue; 1238 if ( nId == SID_BLACK_LIST ) 1239 continue; 1240 if ( nId == SID_CONTENTTYPE ) 1241 continue; 1242 if ( nId == SID_TEMPLATE_NAME ) 1243 continue; 1244 if ( nId == SID_TEMPLATE_REGIONNAME ) 1245 continue; 1246 if ( nId == SID_JUMPMARK ) 1247 continue; 1248 if ( nId == SID_CHARSET ) 1249 continue; 1250 if ( nId == SID_MACROEXECMODE ) 1251 continue; 1252 if ( nId == SID_UPDATEDOCMODE ) 1253 continue; 1254 if ( nId == SID_REPAIRPACKAGE ) 1255 continue; 1256 if ( nId == SID_DOCINFO_TITLE ) 1257 continue; 1258 if ( nId == SID_COMPONENTDATA ) 1259 continue; 1260 if ( nId == SID_COMPONENTCONTEXT ) 1261 continue; 1262 if ( nId == SID_DOC_BASEURL ) 1263 continue; 1264 if ( nId == SID_DOC_HIERARCHICALNAME ) 1265 continue; 1266 if ( nId == SID_COPY_STREAM_IF_POSSIBLE ) 1267 continue; 1268 if ( nId == SID_NOAUTOSAVE ) 1269 continue; 1270 if ( nId == SID_ENCRYPTIONDATA ) 1271 continue; 1272 1273 // used only internally 1274 if ( nId == SID_SAVETO ) 1275 continue; 1276 if ( nId == SID_MODIFYPASSWORDINFO ) 1277 continue; 1278 if ( nId == SID_SUGGESTEDSAVEASDIR ) 1279 continue; 1280 if ( nId == SID_SUGGESTEDSAVEASNAME ) 1281 continue; 1282 } 1283 1284 ByteString aDbg( "Unknown item detected: "); 1285 aDbg += ByteString::CreateFromInt32( nId ); 1286 DBG_ASSERT( nArg<nFormalArgs, aDbg.GetBuffer() ); 1287 } 1288 } 1289 } 1290 #endif 1291 1292 if ( !nProps ) 1293 return; 1294 1295 // convert every item into a property 1296 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue> aSequ( nProps ); 1297 ::com::sun::star::beans::PropertyValue *pValue = aSequ.getArray(); 1298 1299 sal_Int32 nActProp=0; 1300 if ( !pSlot->IsMode(SFX_SLOT_METHOD) ) 1301 { 1302 // slot is a property 1303 sal_uInt16 nWhich = rSet.GetPool()->GetWhich(nSlotId); 1304 sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); 1305 SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False ); 1306 if ( pItem ) //??? 1307 { 1308 sal_uInt16 nSubCount = pType->nAttribs; 1309 if ( !nSubCount ) 1310 { 1311 //rPool.FillVariable( *pItem, *pVar, eUserMetric ); 1312 pValue[nActProp].Name = String( String::CreateFromAscii( pSlot->pUnoName ) ) ; 1313 if ( !pItem->QueryValue( pValue[nActProp].Value ) ) 1314 { 1315 ByteString aStr( "Item not convertable: "); 1316 aStr += ByteString::CreateFromInt32(nSlotId); 1317 DBG_ERROR( aStr.GetBuffer() ); 1318 } 1319 } 1320 else 1321 { 1322 // complex type, add a property value for every member of the struct 1323 for ( sal_uInt16 n=1; n<=nSubCount; ++n ) 1324 { 1325 //rPool.FillVariable( *pItem, *pVar, eUserMetric ); 1326 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) pType->aAttrib[n-1].nAID; 1327 if ( bConvertTwips ) 1328 nSubId |= CONVERT_TWIPS; 1329 1330 DBG_ASSERT(( pType->aAttrib[n-1].nAID ) <= 127, "Member ID out of range" ); 1331 String aName( String::CreateFromAscii( pSlot->pUnoName ) ) ; 1332 aName += '.'; 1333 aName += String( String::CreateFromAscii( pType->aAttrib[n-1].pName ) ) ; 1334 pValue[nActProp].Name = aName; 1335 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) ) 1336 { 1337 ByteString aStr( "Sub item "); 1338 aStr += ByteString::CreateFromInt32( pType->aAttrib[n-1].nAID ); 1339 aStr += " not convertable in slot: "; 1340 aStr += ByteString::CreateFromInt32(nSlotId); 1341 DBG_ERROR( aStr.GetBuffer() ); 1342 } 1343 } 1344 } 1345 } 1346 } 1347 else 1348 { 1349 // slot is a method 1350 sal_uInt16 nFormalArgs = pSlot->GetFormalArgumentCount(); 1351 for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg ) 1352 { 1353 const SfxFormalArgument &rArg = pSlot->GetFormalArgument( nArg ); 1354 sal_uInt16 nWhich = rSet.GetPool()->GetWhich( rArg.nSlotId ); 1355 sal_Bool bConvertTwips = ( rSet.GetPool()->GetMetric( nWhich ) == SFX_MAPUNIT_TWIP ); 1356 SFX_ITEMSET_ARG( &rSet, pItem, SfxPoolItem, nWhich, sal_False ); 1357 if ( pItem ) //??? 1358 { 1359 sal_uInt16 nSubCount = rArg.pType->nAttribs; 1360 if ( !nSubCount ) 1361 { 1362 //rPool.FillVariable( *pItem, *pVar, eUserMetric ); 1363 pValue[nActProp].Name = String( String::CreateFromAscii( rArg.pName ) ) ; 1364 if ( !pItem->QueryValue( pValue[nActProp++].Value ) ) 1365 { 1366 ByteString aStr( "Item not convertable: "); 1367 aStr += ByteString::CreateFromInt32(rArg.nSlotId); 1368 DBG_ERROR( aStr.GetBuffer() ); 1369 } 1370 } 1371 else 1372 { 1373 // complex type, add a property value for every member of the struct 1374 for ( sal_uInt16 n = 1; n <= nSubCount; ++n ) 1375 { 1376 //rPool.FillVariable( rItem, *pVar, eUserMetric ); 1377 sal_uInt8 nSubId = (sal_uInt8) (sal_Int8) rArg.pType->aAttrib[n-1].nAID; 1378 if ( bConvertTwips ) 1379 nSubId |= CONVERT_TWIPS; 1380 1381 DBG_ASSERT((rArg.pType->aAttrib[n-1].nAID) <= 127, "Member ID out of range" ); 1382 String aName( String::CreateFromAscii( rArg.pName ) ) ; 1383 aName += '.'; 1384 aName += String( String::CreateFromAscii( rArg.pType->aAttrib[n-1].pName ) ) ; 1385 pValue[nActProp].Name = aName; 1386 if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId ) ) 1387 { 1388 ByteString aStr( "Sub item "); 1389 aStr += ByteString::CreateFromInt32( rArg.pType->aAttrib[n-1].nAID ); 1390 aStr += " not convertable in slot: "; 1391 aStr += ByteString::CreateFromInt32(rArg.nSlotId); 1392 DBG_ERROR( aStr.GetBuffer() ); 1393 } 1394 } 1395 } 1396 } 1397 } 1398 1399 if ( nSlotId == SID_OPENDOC || nSlotId == SID_EXPORTDOC || nSlotId == SID_SAVEASDOC || nSlotId == SID_SAVEDOC || 1400 nSlotId == SID_SAVETO || nSlotId == SID_EXPORTDOCASPDF || nSlotId == SID_DIRECTEXPORTDOCASPDF ) 1401 { 1402 const SfxPoolItem *pItem=0; 1403 if ( rSet.GetItemState( SID_COMPONENTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) 1404 { 1405 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentData)); 1406 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1407 } 1408 if ( rSet.GetItemState( SID_COMPONENTCONTEXT, sal_False, &pItem ) == SFX_ITEM_SET ) 1409 { 1410 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sComponentContext)); 1411 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1412 } 1413 if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL, sal_False, &pItem ) == SFX_ITEM_SET ) 1414 { 1415 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStatusInd)); 1416 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1417 } 1418 if ( rSet.GetItemState( SID_INTERACTIONHANDLER, sal_False, &pItem ) == SFX_ITEM_SET ) 1419 { 1420 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInteractionHdl)); 1421 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1422 } 1423 if ( rSet.GetItemState( SID_VIEW_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) 1424 { 1425 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewData)); 1426 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1427 } 1428 if ( rSet.GetItemState( SID_FILTER_DATA, sal_False, &pItem ) == SFX_ITEM_SET ) 1429 { 1430 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFilterData)); 1431 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1432 } 1433 if ( rSet.GetItemState( SID_DOCUMENT, sal_False, &pItem ) == SFX_ITEM_SET ) 1434 { 1435 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModel)); 1436 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1437 } 1438 if ( rSet.GetItemState( SID_CONTENT, sal_False, &pItem ) == SFX_ITEM_SET ) 1439 { 1440 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUCBContent)); 1441 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1442 } 1443 if ( rSet.GetItemState( SID_INPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) 1444 { 1445 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sInputStream)); 1446 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1447 } 1448 if ( rSet.GetItemState( SID_STREAM, sal_False, &pItem ) == SFX_ITEM_SET ) 1449 { 1450 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStream)); 1451 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1452 } 1453 if ( rSet.GetItemState( SID_OUTPUTSTREAM, sal_False, &pItem ) == SFX_ITEM_SET ) 1454 { 1455 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOutputStream)); 1456 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1457 } 1458 if ( rSet.GetItemState( SID_POSTDATA, sal_False, &pItem ) == SFX_ITEM_SET ) 1459 { 1460 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPostData)); 1461 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1462 } 1463 if ( rSet.GetItemState( SID_FILLFRAME, sal_False, &pItem ) == SFX_ITEM_SET ) 1464 { 1465 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrame)); 1466 if ( pItem->ISA( SfxUsrAnyItem ) ) 1467 { 1468 OSL_ENSURE( false, "TransformItems: transporting an XFrame via an SfxUsrAnyItem is not deprecated!" ); 1469 pValue[nActProp++].Value = static_cast< const SfxUsrAnyItem* >( pItem )->GetValue(); 1470 } 1471 else if ( pItem->ISA( SfxUnoFrameItem ) ) 1472 pValue[nActProp++].Value <<= static_cast< const SfxUnoFrameItem* >( pItem )->GetFrame(); 1473 else 1474 OSL_ENSURE( false, "TransformItems: invalid item type for SID_FILLFRAME!" ); 1475 } 1476 if ( rSet.GetItemState( SID_TEMPLATE, sal_False, &pItem ) == SFX_ITEM_SET ) 1477 { 1478 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sAsTemplate)); 1479 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1480 } 1481 if ( rSet.GetItemState( SID_OPEN_NEW_VIEW, sal_False, &pItem ) == SFX_ITEM_SET ) 1482 { 1483 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sOpenNewView)); 1484 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1485 } 1486 if ( rSet.GetItemState( SID_FAIL_ON_WARNING, sal_False, &pItem ) == SFX_ITEM_SET ) 1487 { 1488 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFailOnWarning)); 1489 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1490 } 1491 if ( rSet.GetItemState( SID_VIEW_ID, sal_False, &pItem ) == SFX_ITEM_SET ) 1492 { 1493 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewId)); 1494 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); 1495 } 1496 if ( rSet.GetItemState( SID_PLUGIN_MODE, sal_False, &pItem ) == SFX_ITEM_SET ) 1497 { 1498 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPluginMode)); 1499 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); 1500 } 1501 if ( rSet.GetItemState( SID_DOC_READONLY, sal_False, &pItem ) == SFX_ITEM_SET ) 1502 { 1503 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sReadOnly)); 1504 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1505 } 1506 if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION, sal_False, &pItem ) == SFX_ITEM_SET ) 1507 { 1508 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStartPresentation)); 1509 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1510 } 1511 if ( rSet.GetItemState( SID_SELECTION, sal_False, &pItem ) == SFX_ITEM_SET ) 1512 { 1513 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSelectionOnly)); 1514 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1515 } 1516 if ( rSet.GetItemState( SID_HIDDEN, sal_False, &pItem ) == SFX_ITEM_SET ) 1517 { 1518 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHidden)); 1519 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1520 } 1521 if ( rSet.GetItemState( SID_MINIMIZED, sal_False, &pItem ) == SFX_ITEM_SET ) 1522 { 1523 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMinimized)); 1524 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1525 } 1526 if ( rSet.GetItemState( SID_SILENT, sal_False, &pItem ) == SFX_ITEM_SET ) 1527 { 1528 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSilent)); 1529 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1530 } 1531 if ( rSet.GetItemState( SID_PREVIEW, sal_False, &pItem ) == SFX_ITEM_SET ) 1532 { 1533 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sPreview)); 1534 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1535 } 1536 if ( rSet.GetItemState( SID_VIEWONLY, sal_False, &pItem ) == SFX_ITEM_SET ) 1537 { 1538 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sViewOnly)); 1539 pValue[nActProp++].Value <<= (sal_Bool) (( ((SfxBoolItem*)pItem)->GetValue() )); 1540 } 1541 if ( rSet.GetItemState( SID_EDITDOC, sal_False, &pItem ) == SFX_ITEM_SET ) 1542 { 1543 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDontEdit)); 1544 pValue[nActProp++].Value <<= (sal_Bool) (!( ((SfxBoolItem*)pItem)->GetValue() )); 1545 } 1546 if ( rSet.GetItemState( SID_FILE_DIALOG, sal_False, &pItem ) == SFX_ITEM_SET ) 1547 { 1548 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUseSystemDialog)); 1549 pValue[nActProp++].Value <<= (sal_Bool) ( ((SfxBoolItem*)pItem)->GetValue() ); 1550 } 1551 if ( rSet.GetItemState( SID_STANDARD_DIR, sal_False, &pItem ) == SFX_ITEM_SET ) 1552 { 1553 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sStandardDir)); 1554 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1555 } 1556 if ( rSet.GetItemState( SID_BLACK_LIST, sal_False, &pItem ) == SFX_ITEM_SET ) 1557 { 1558 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sBlackList)); 1559 1560 com::sun::star::uno::Sequence< rtl::OUString > aList; 1561 ((SfxStringListItem*)pItem)->GetStringList( aList ); 1562 pValue[nActProp++].Value <<= aList ; 1563 } 1564 if ( rSet.GetItemState( SID_TARGETNAME, sal_False, &pItem ) == SFX_ITEM_SET ) 1565 { 1566 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFrameName)); 1567 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1568 } 1569 if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET ) 1570 { 1571 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvagedFile)); 1572 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1573 } 1574 if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET ) 1575 { 1576 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sFolderName)); 1577 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1578 } 1579 if ( rSet.GetItemState( SID_CONTENTTYPE, sal_False, &pItem ) == SFX_ITEM_SET ) 1580 { 1581 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMediaType)); 1582 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1583 } 1584 if ( rSet.GetItemState( SID_TEMPLATE_NAME, sal_False, &pItem ) == SFX_ITEM_SET ) 1585 { 1586 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateName)); 1587 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1588 } 1589 if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME, sal_False, &pItem ) == SFX_ITEM_SET ) 1590 { 1591 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sTemplateRegionName)); 1592 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1593 } 1594 if ( rSet.GetItemState( SID_JUMPMARK, sal_False, &pItem ) == SFX_ITEM_SET ) 1595 { 1596 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sJumpMark)); 1597 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1598 } 1599 1600 if ( rSet.GetItemState( SID_CHARSET, sal_False, &pItem ) == SFX_ITEM_SET ) 1601 { 1602 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCharacterSet)); 1603 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1604 } 1605 if ( rSet.GetItemState( SID_MACROEXECMODE, sal_False, &pItem ) == SFX_ITEM_SET ) 1606 { 1607 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sMacroExecMode)); 1608 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); 1609 } 1610 if ( rSet.GetItemState( SID_UPDATEDOCMODE, sal_False, &pItem ) == SFX_ITEM_SET ) 1611 { 1612 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sUpdateDocMode)); 1613 pValue[nActProp++].Value <<= ( (sal_Int16) ((SfxUInt16Item*)pItem)->GetValue() ); 1614 } 1615 if ( rSet.GetItemState( SID_REPAIRPACKAGE, sal_False, &pItem ) == SFX_ITEM_SET ) 1616 { 1617 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sRepairPackage)); 1618 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1619 } 1620 if ( rSet.GetItemState( SID_DOCINFO_TITLE, sal_False, &pItem ) == SFX_ITEM_SET ) 1621 { 1622 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentTitle)); 1623 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1624 } 1625 if ( rSet.GetItemState( SID_DOC_BASEURL, sal_False, &pItem ) == SFX_ITEM_SET ) 1626 { 1627 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sDocumentBaseURL)); 1628 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1629 } 1630 if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME, sal_False, &pItem ) == SFX_ITEM_SET ) 1631 { 1632 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sHierarchicalDocumentName)); 1633 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1634 } 1635 if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE, sal_False, &pItem ) == SFX_ITEM_SET ) 1636 { 1637 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sCopyStreamIfPossible)); 1638 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1639 } 1640 if ( rSet.GetItemState( SID_NOAUTOSAVE, sal_False, &pItem ) == SFX_ITEM_SET ) 1641 { 1642 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sNoAutoSave)); 1643 pValue[nActProp++].Value <<= ( ((SfxBoolItem*)pItem)->GetValue() ); 1644 } 1645 if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO, sal_False, &pItem ) == SFX_ITEM_SET ) 1646 { 1647 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo)); 1648 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1649 } 1650 if ( rSet.GetItemState( SID_ENCRYPTIONDATA, sal_False, &pItem ) == SFX_ITEM_SET ) 1651 { 1652 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sEncryptionData)); 1653 pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); 1654 } 1655 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, sal_False, &pItem ) == SFX_ITEM_SET ) 1656 { 1657 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsDir)); 1658 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1659 } 1660 if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, sal_False, &pItem ) == SFX_ITEM_SET ) 1661 { 1662 pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsName)); 1663 pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); 1664 } 1665 } 1666 } 1667 1668 rArgs = aSequ; 1669 } 1670 1671 SFX_IMPL_XINTERFACE_5( SfxMacroLoader, OWeakObject, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization ) 1672 SFX_IMPL_XTYPEPROVIDER_5( SfxMacroLoader, ::com::sun::star::frame::XDispatchProvider, ::com::sun::star::frame::XNotifyingDispatch, ::com::sun::star::frame::XDispatch, ::com::sun::star::frame::XSynchronousDispatch,::com::sun::star::lang::XInitialization ) 1673 SFX_IMPL_XSERVICEINFO( SfxMacroLoader, PROTOCOLHANDLER_SERVICENAME, "com.sun.star.comp.sfx2.SfxMacroLoader" ) 1674 SFX_IMPL_SINGLEFACTORY( SfxMacroLoader ) 1675 1676 void SAL_CALL SfxMacroLoader::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) 1677 { 1678 Reference < XFrame > xFrame; 1679 if ( aArguments.getLength() ) 1680 { 1681 aArguments[0] >>= xFrame; 1682 m_xFrame = xFrame; 1683 } 1684 } 1685 1686 SfxObjectShell* SfxMacroLoader::GetObjectShell_Impl() 1687 { 1688 SfxObjectShell* pDocShell = NULL; 1689 Reference < XFrame > xFrame( m_xFrame.get(), UNO_QUERY ); 1690 if ( xFrame.is() ) 1691 { 1692 SfxFrame* pFrame=0; 1693 for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) ) 1694 { 1695 if ( pFrame->GetFrameInterface() == xFrame ) 1696 break; 1697 } 1698 1699 if ( pFrame ) 1700 pDocShell = pFrame->GetCurrentDocument(); 1701 } 1702 1703 return pDocShell; 1704 } 1705 1706 // ----------------------------------------------------------------------- 1707 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL SfxMacroLoader::queryDispatch( 1708 const ::com::sun::star::util::URL& aURL , 1709 const ::rtl::OUString& /*sTargetFrameName*/, 1710 sal_Int32 /*nSearchFlags*/ ) throw( ::com::sun::star::uno::RuntimeException ) 1711 { 1712 ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatcher; 1713 if(aURL.Complete.compareToAscii("macro:",6)==0) 1714 xDispatcher = this; 1715 return xDispatcher; 1716 } 1717 1718 // ----------------------------------------------------------------------- 1719 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > SAL_CALL 1720 SfxMacroLoader::queryDispatches( const ::com::sun::star::uno::Sequence < ::com::sun::star::frame::DispatchDescriptor >& seqDescriptor ) 1721 throw( ::com::sun::star::uno::RuntimeException ) 1722 { 1723 sal_Int32 nCount = seqDescriptor.getLength(); 1724 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount); 1725 for( sal_Int32 i=0; i<nCount; ++i ) 1726 lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL, 1727 seqDescriptor[i].FrameName, 1728 seqDescriptor[i].SearchFlags ); 1729 return lDispatcher; 1730 } 1731 1732 // ----------------------------------------------------------------------- 1733 void SAL_CALL SfxMacroLoader::dispatchWithNotification( const ::com::sun::star::util::URL& aURL , 1734 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs , 1735 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchResultListener >& xListener ) 1736 throw (::com::sun::star::uno::RuntimeException) 1737 { 1738 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1739 1740 sal_uInt32 nPropertyCount = lArgs.getLength(); 1741 ::rtl::OUString aReferer; 1742 for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) 1743 { 1744 if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) ) 1745 { 1746 lArgs[nProperty].Value >>= aReferer; 1747 break; 1748 } 1749 } 1750 1751 ::com::sun::star::uno::Any aAny; 1752 ErrCode nErr = loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() ); 1753 if( xListener.is() ) 1754 { 1755 // always call dispatchFinished(), because we didn't load a document but 1756 // executed a macro instead! 1757 ::com::sun::star::frame::DispatchResultEvent aEvent; 1758 1759 aEvent.Source = static_cast< ::cppu::OWeakObject* >(this); 1760 if( nErr == ERRCODE_NONE ) 1761 aEvent.State = ::com::sun::star::frame::DispatchResultState::SUCCESS; 1762 else 1763 aEvent.State = ::com::sun::star::frame::DispatchResultState::FAILURE; 1764 1765 xListener->dispatchFinished( aEvent ) ; 1766 } 1767 } 1768 1769 ::com::sun::star::uno::Any SAL_CALL SfxMacroLoader::dispatchWithReturnValue( 1770 const ::com::sun::star::util::URL& aURL, 1771 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& ) throw (::com::sun::star::uno::RuntimeException) 1772 { 1773 ::com::sun::star::uno::Any aRet; 1774 /*ErrCode nErr = */loadMacro( aURL.Complete, aRet, GetObjectShell_Impl() ); 1775 return aRet; 1776 } 1777 1778 // ----------------------------------------------------------------------- 1779 void SAL_CALL SfxMacroLoader::dispatch( const ::com::sun::star::util::URL& aURL , 1780 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArgs ) 1781 throw (::com::sun::star::uno::RuntimeException) 1782 { 1783 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 1784 1785 sal_uInt32 nPropertyCount = lArgs.getLength(); 1786 ::rtl::OUString aReferer; 1787 for( sal_uInt32 nProperty=0; nProperty<nPropertyCount; ++nProperty ) 1788 { 1789 if( lArgs[nProperty].Name == ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Referer")) ) 1790 { 1791 lArgs[nProperty].Value >>= aReferer; 1792 break; 1793 } 1794 } 1795 1796 ::com::sun::star::uno::Any aAny; 1797 /*ErrCode nErr = */loadMacro( aURL.Complete, aAny, GetObjectShell_Impl() ); 1798 } 1799 1800 // ----------------------------------------------------------------------- 1801 void SAL_CALL SfxMacroLoader::addStatusListener( 1802 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >& , 1803 const ::com::sun::star::util::URL& ) 1804 throw (::com::sun::star::uno::RuntimeException) 1805 { 1806 /* TODO 1807 How we can handle different listener for further coming or currently running dispatch() jobs 1808 without any inconsistency! 1809 */ 1810 } 1811 1812 // ----------------------------------------------------------------------- 1813 void SAL_CALL SfxMacroLoader::removeStatusListener( 1814 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener >&, 1815 const ::com::sun::star::util::URL& ) 1816 throw (::com::sun::star::uno::RuntimeException) 1817 { 1818 } 1819 1820 ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star::uno::Any& rRetval, SfxObjectShell* pSh ) 1821 throw ( ::com::sun::star::uno::RuntimeException ) 1822 { 1823 SfxObjectShell* pCurrent = pSh; 1824 if ( !pCurrent ) 1825 // all not full qualified names use the BASIC of the given or current document 1826 pCurrent = SfxObjectShell::Current(); 1827 1828 // 'macro:///lib.mod.proc(args)' => macro of App-BASIC 1829 // 'macro://[docname|.]/lib.mod.proc(args)' => macro of current or qualified document 1830 // 'macro://obj.method(args)' => direct API call, execute it via App-BASIC 1831 String aMacro( rURL ); 1832 sal_uInt16 nHashPos = aMacro.Search( '/', 8 ); 1833 sal_uInt16 nArgsPos = aMacro.Search( '(' ); 1834 BasicManager *pAppMgr = SFX_APP()->GetBasicManager(); 1835 BasicManager *pBasMgr = 0; 1836 ErrCode nErr = ERRCODE_NONE; 1837 1838 // should a macro function be executed ( no direct API call)? 1839 if ( STRING_NOTFOUND != nHashPos && nHashPos < nArgsPos ) 1840 { 1841 // find BasicManager 1842 SfxObjectShell* pDoc = NULL; 1843 String aBasMgrName( INetURLObject::decode(aMacro.Copy( 8, nHashPos-8 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); 1844 if ( !aBasMgrName.Len() ) 1845 pBasMgr = pAppMgr; 1846 else if ( aBasMgrName.EqualsAscii(".") ) 1847 { 1848 // current/actual document 1849 pDoc = pCurrent; 1850 if (pDoc) 1851 pBasMgr = pDoc->GetBasicManager(); 1852 } 1853 else 1854 { 1855 // full qualified name, find document by name 1856 for ( SfxObjectShell *pObjSh = SfxObjectShell::GetFirst(); 1857 pObjSh && !pBasMgr; 1858 pObjSh = SfxObjectShell::GetNext(*pObjSh) ) 1859 if ( aBasMgrName == pObjSh->GetTitle(SFX_TITLE_APINAME) ) 1860 { 1861 pDoc = pObjSh; 1862 pBasMgr = pDoc->GetBasicManager(); 1863 } 1864 } 1865 1866 if ( pBasMgr ) 1867 { 1868 const bool bIsAppBasic = ( pBasMgr == pAppMgr ); 1869 const bool bIsDocBasic = ( pBasMgr != pAppMgr ); 1870 1871 if ( pDoc ) 1872 { 1873 // security check for macros from document basic if an SFX doc is given 1874 if ( !pDoc->AdjustMacroMode( String() ) ) 1875 // check forbids execution 1876 return ERRCODE_IO_ACCESSDENIED; 1877 } 1878 else if ( pDoc && pDoc->GetMedium() ) 1879 { 1880 pDoc->AdjustMacroMode( String() ); 1881 SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pUpdateDocItem, SfxUInt16Item, SID_UPDATEDOCMODE, sal_False); 1882 SFX_ITEMSET_ARG( pDoc->GetMedium()->GetItemSet(), pMacroExecModeItem, SfxUInt16Item, SID_MACROEXECMODE, sal_False); 1883 if ( pUpdateDocItem && pMacroExecModeItem 1884 && pUpdateDocItem->GetValue() == document::UpdateDocMode::NO_UPDATE 1885 && pMacroExecModeItem->GetValue() == document::MacroExecMode::NEVER_EXECUTE ) 1886 return ERRCODE_IO_ACCESSDENIED; 1887 } 1888 1889 // find BASIC method 1890 String aQualifiedMethod( INetURLObject::decode(aMacro.Copy( nHashPos+1 ), INET_HEX_ESCAPE, INetURLObject::DECODE_WITH_CHARSET) ); 1891 String aArgs; 1892 if ( STRING_NOTFOUND != nArgsPos ) 1893 { 1894 // remove arguments from macro name 1895 aArgs = aQualifiedMethod.Copy( nArgsPos - nHashPos - 1 ); 1896 aQualifiedMethod.Erase( nArgsPos - nHashPos - 1 ); 1897 } 1898 1899 if ( pBasMgr->HasMacro( aQualifiedMethod ) ) 1900 { 1901 Any aOldThisComponent; 1902 const bool bSetDocMacroMode = ( pDoc != NULL ) && bIsDocBasic; 1903 const bool bSetGlobalThisComponent = ( pDoc != NULL ) && bIsAppBasic; 1904 if ( bSetDocMacroMode ) 1905 { 1906 // mark document: it executes an own macro, so it's in a modal mode 1907 pDoc->SetMacroMode_Impl( sal_True ); 1908 } 1909 1910 if ( bSetGlobalThisComponent ) 1911 { 1912 // document is executed via AppBASIC, adjust ThisComponent variable 1913 aOldThisComponent = pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( pDoc->GetModel() ) ); 1914 } 1915 1916 // just to let the shell be alive 1917 SfxObjectShellRef xKeepDocAlive = pDoc; 1918 1919 { 1920 // attempt to protect the document against the script tampering with its Undo Context 1921 ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard; 1922 if ( bIsDocBasic ) 1923 pUndoGuard.reset( new ::framework::DocumentUndoGuard( pDoc->GetModel() ) ); 1924 1925 // execute the method 1926 SbxVariableRef retValRef = new SbxVariable; 1927 nErr = pBasMgr->ExecuteMacro( aQualifiedMethod, aArgs, retValRef ); 1928 if ( nErr == ERRCODE_NONE ) 1929 rRetval = sbxToUnoValue( retValRef ); 1930 } 1931 1932 if ( bSetGlobalThisComponent ) 1933 { 1934 pAppMgr->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent ); 1935 } 1936 1937 if ( bSetDocMacroMode ) 1938 { 1939 // remove flag for modal mode 1940 pDoc->SetMacroMode_Impl( sal_False ); 1941 } 1942 } 1943 else 1944 nErr = ERRCODE_BASIC_PROC_UNDEFINED; 1945 } 1946 else 1947 nErr = ERRCODE_IO_NOTEXISTS; 1948 } 1949 else 1950 { 1951 // direct API call on a specified object 1952 String aCall( '[' ); 1953 aCall += String(INetURLObject::decode(aMacro.Copy(6), INET_HEX_ESCAPE, 1954 INetURLObject::DECODE_WITH_CHARSET)); 1955 aCall += ']'; 1956 pAppMgr->GetLib(0)->Execute( aCall ); 1957 nErr = SbxBase::GetError(); 1958 } 1959 1960 SbxBase::ResetError(); 1961 return nErr; 1962 } 1963 1964 SFX_IMPL_XSERVICEINFO( SfxAppDispatchProvider, "com.sun.star.frame.DispatchProvider", "com.sun.star.comp.sfx2.AppDispatchProvider" ) \ 1965 SFX_IMPL_SINGLEFACTORY( SfxAppDispatchProvider ); 1966 1967 void SAL_CALL SfxAppDispatchProvider::initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException) 1968 { 1969 Reference < XFrame > xFrame; 1970 if ( aArguments.getLength() ) 1971 { 1972 aArguments[0] >>= xFrame; 1973 m_xFrame = xFrame; 1974 } 1975 } 1976 1977 Reference < XDispatch > SAL_CALL SfxAppDispatchProvider::queryDispatch( 1978 const ::com::sun::star::util::URL& aURL, 1979 const ::rtl::OUString& /*sTargetFrameName*/, 1980 FrameSearchFlags /*eSearchFlags*/ ) throw( RuntimeException ) 1981 { 1982 sal_uInt16 nId( 0 ); 1983 sal_Bool bMasterCommand( sal_False ); 1984 Reference < XDispatch > xDisp; 1985 const SfxSlot* pSlot = 0; 1986 SfxDispatcher* pAppDisp = SFX_APP()->GetAppDispatcher_Impl(); 1987 if ( aURL.Protocol.compareToAscii( "slot:" ) == COMPARE_EQUAL || 1988 aURL.Protocol.compareToAscii( "commandId:" ) == COMPARE_EQUAL ) 1989 { 1990 nId = (sal_uInt16) aURL.Path.toInt32(); 1991 SfxShell* pShell; 1992 pAppDisp->GetShellAndSlot_Impl( nId, &pShell, &pSlot, sal_True, sal_True ); 1993 } 1994 else if ( aURL.Protocol.compareToAscii( ".uno:" ) == COMPARE_EQUAL ) 1995 { 1996 // Support ".uno" commands. Map commands to slotid 1997 bMasterCommand = SfxOfficeDispatch::IsMasterUnoCommand( aURL ); 1998 if ( bMasterCommand ) 1999 pSlot = pAppDisp->GetSlot( SfxOfficeDispatch::GetMasterUnoCommand( aURL ) ); 2000 else 2001 pSlot = pAppDisp->GetSlot( aURL.Main ); 2002 } 2003 2004 if ( pSlot ) 2005 { 2006 SfxOfficeDispatch* pDispatch = new SfxOfficeDispatch( pAppDisp, pSlot, aURL ) ; 2007 pDispatch->SetFrame(m_xFrame); 2008 pDispatch->SetMasterUnoCommand( bMasterCommand ); 2009 xDisp = pDispatch; 2010 } 2011 2012 return xDisp; 2013 } 2014 2015 Sequence< Reference < XDispatch > > SAL_CALL SfxAppDispatchProvider::queryDispatches( const Sequence < DispatchDescriptor >& seqDescriptor ) 2016 throw( RuntimeException ) 2017 { 2018 sal_Int32 nCount = seqDescriptor.getLength(); 2019 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference < ::com::sun::star::frame::XDispatch > > lDispatcher(nCount); 2020 for( sal_Int32 i=0; i<nCount; ++i ) 2021 lDispatcher[i] = this->queryDispatch( seqDescriptor[i].FeatureURL, 2022 seqDescriptor[i].FrameName, 2023 seqDescriptor[i].SearchFlags ); 2024 return lDispatcher; 2025 } 2026 2027 Sequence< sal_Int16 > SAL_CALL SfxAppDispatchProvider::getSupportedCommandGroups() 2028 throw (::com::sun::star::uno::RuntimeException) 2029 { 2030 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2031 2032 std::list< sal_Int16 > aGroupList; 2033 SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl(); 2034 2035 const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG ); 2036 2037 // Gruppe anw"ahlen ( Gruppe 0 ist intern ) 2038 for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ ) 2039 { 2040 String aName = pAppSlotPool->SeekGroup( i ); 2041 const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot(); 2042 while ( pSfxSlot ) 2043 { 2044 if ( pSfxSlot->GetMode() & nMode ) 2045 { 2046 sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() ); 2047 aGroupList.push_back( nCommandGroup ); 2048 break; 2049 } 2050 pSfxSlot = pAppSlotPool->NextSlot(); 2051 } 2052 } 2053 2054 ::com::sun::star::uno::Sequence< sal_Int16 > aSeq = 2055 comphelper::containerToSequence< sal_Int16, std::list< sal_Int16 > >( aGroupList ); 2056 2057 return aSeq; 2058 } 2059 2060 Sequence< ::com::sun::star::frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfigurableDispatchInformation( sal_Int16 nCmdGroup ) 2061 throw (::com::sun::star::uno::RuntimeException) 2062 { 2063 std::list< ::com::sun::star::frame::DispatchInformation > aCmdList; 2064 2065 ::vos::OGuard aGuard( Application::GetSolarMutex() ); 2066 SfxSlotPool* pAppSlotPool = &SFX_APP()->GetAppSlotPool_Impl(); 2067 2068 if ( pAppSlotPool ) 2069 { 2070 const sal_uIntPtr nMode( SFX_SLOT_TOOLBOXCONFIG|SFX_SLOT_ACCELCONFIG|SFX_SLOT_MENUCONFIG ); 2071 rtl::OUString aCmdPrefix( RTL_CONSTASCII_USTRINGPARAM( ".uno:" )); 2072 2073 // Gruppe anw"ahlen ( Gruppe 0 ist intern ) 2074 for ( sal_uInt16 i=0; i<pAppSlotPool->GetGroupCount(); i++ ) 2075 { 2076 String aName = pAppSlotPool->SeekGroup( i ); 2077 const SfxSlot* pSfxSlot = pAppSlotPool->FirstSlot(); 2078 if ( pSfxSlot ) 2079 { 2080 sal_Int16 nCommandGroup = MapGroupIDToCommandGroup( pSfxSlot->GetGroupId() ); 2081 if ( nCommandGroup == nCmdGroup ) 2082 { 2083 while ( pSfxSlot ) 2084 { 2085 if ( pSfxSlot->GetMode() & nMode ) 2086 { 2087 ::com::sun::star::frame::DispatchInformation aCmdInfo; 2088 ::rtl::OUStringBuffer aBuf( aCmdPrefix ); 2089 aBuf.appendAscii( pSfxSlot->GetUnoName() ); 2090 aCmdInfo.Command = aBuf.makeStringAndClear(); 2091 aCmdInfo.GroupId = nCommandGroup; 2092 aCmdList.push_back( aCmdInfo ); 2093 } 2094 pSfxSlot = pAppSlotPool->NextSlot(); 2095 } 2096 } 2097 } 2098 } 2099 } 2100 2101 ::com::sun::star::uno::Sequence< ::com::sun::star::frame::DispatchInformation > aSeq = 2102 comphelper::containerToSequence< ::com::sun::star::frame::DispatchInformation, std::list< ::com::sun::star::frame::DispatchInformation > >( aCmdList ); 2103 2104 return aSeq; 2105 } 2106 2107 #ifdef TEST_HANDLERS 2108 #include <cppuhelper/implbase2.hxx> 2109 2110 #include <com/sun/star/awt/XKeyHandler.hdl> 2111 #include <com/sun/star/awt/XMouseClickHandler.hdl> 2112 2113 class TestKeyHandler: public ::cppu::WeakImplHelper2 2114 < 2115 com::sun::star::awt::XKeyHandler, 2116 com::sun::star::lang::XServiceInfo 2117 > 2118 { 2119 public: 2120 TestKeyHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){} 2121 2122 SFX_DECL_XSERVICEINFO 2123 virtual sal_Bool SAL_CALL keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 2124 virtual sal_Bool SAL_CALL keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException); 2125 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source) 2126 throw (::com::sun::star::uno::RuntimeException); 2127 }; 2128 2129 class TestMouseClickHandler: public ::cppu::WeakImplHelper2 2130 < 2131 com::sun::star::awt::XMouseClickHandler, 2132 com::sun::star::lang::XServiceInfo 2133 > 2134 { 2135 public: 2136 TestMouseClickHandler( const com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& ){} 2137 2138 SFX_DECL_XSERVICEINFO 2139 virtual sal_Bool SAL_CALL mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException); 2140 virtual sal_Bool SAL_CALL mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException); 2141 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source) 2142 throw (::com::sun::star::uno::RuntimeException); 2143 }; 2144 2145 sal_Bool SAL_CALL TestKeyHandler::keyPressed( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException) 2146 { 2147 return sal_False; 2148 } 2149 2150 sal_Bool SAL_CALL TestKeyHandler::keyReleased( const ::com::sun::star::awt::KeyEvent& aEvent ) throw (::com::sun::star::uno::RuntimeException) 2151 { 2152 return sal_False; 2153 } 2154 2155 void SAL_CALL TestKeyHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException) 2156 { 2157 } 2158 2159 sal_Bool SAL_CALL TestMouseClickHandler::mousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException) 2160 { 2161 return sal_False; 2162 } 2163 2164 sal_Bool SAL_CALL TestMouseClickHandler::mouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException) 2165 { 2166 return sal_False; 2167 } 2168 2169 void SAL_CALL TestMouseClickHandler::disposing( const ::com::sun::star::lang::EventObject& Source) throw (::com::sun::star::uno::RuntimeException) 2170 { 2171 } 2172 2173 SFX_IMPL_XSERVICEINFO( TestKeyHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.KeyHandler"); 2174 SFX_IMPL_XSERVICEINFO( TestMouseClickHandler, "com.sun.star.task.Job", "com.sun.star.comp.Office.MouseClickHandler"); 2175 SFX_IMPL_SINGLEFACTORY( TestKeyHandler ); 2176 SFX_IMPL_SINGLEFACTORY( TestMouseClickHandler ); 2177 #endif 2178 // ----------------------------------------------------------------------- 2179 2180 extern "C" { 2181 2182 SFX2_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( 2183 const sal_Char** ppEnvironmentTypeName , 2184 uno_Environment** ) 2185 { 2186 *ppEnvironmentTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME ; 2187 } 2188 2189 SFX2_DLLPUBLIC void* SAL_CALL component_getFactory( 2190 const sal_Char* pImplementationName , 2191 void* pServiceManager , 2192 void* ) 2193 { 2194 // Set default return value for this operation - if it failed. 2195 void* pReturn = NULL ; 2196 2197 if ( 2198 ( pImplementationName != NULL ) && 2199 ( pServiceManager != NULL ) 2200 ) 2201 { 2202 // Define variables which are used in following macros. 2203 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > 2204 xFactory; 2205 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager( reinterpret_cast< ::com::sun::star::lang::XMultiServiceFactory* >( pServiceManager ) ) ; 2206 2207 //============================================================================= 2208 // Add new macro line to handle new service. 2209 // 2210 // !!! ATTENTION !!! 2211 // Write no ";" at end of line and dont forget "else" ! (see macro) 2212 //============================================================================= 2213 IF_NAME_CREATECOMPONENTFACTORY( SfxGlobalEvents_Impl ) 2214 IF_NAME_CREATECOMPONENTFACTORY( SfxFrameLoader_Impl ) 2215 IF_NAME_CREATECOMPONENTFACTORY( SfxMacroLoader ) 2216 IF_NAME_CREATECOMPONENTFACTORY( SfxStandaloneDocumentInfoObject ) 2217 IF_NAME_CREATECOMPONENTFACTORY( SfxAppDispatchProvider ) 2218 IF_NAME_CREATECOMPONENTFACTORY( SfxDocTplService ) 2219 IF_NAME_CREATECOMPONENTFACTORY( ShutdownIcon ) 2220 IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationScriptLibraryContainer ) 2221 IF_NAME_CREATECOMPONENTFACTORY( SfxApplicationDialogLibraryContainer ) 2222 #ifdef TEST_HANDLERS 2223 IF_NAME_CREATECOMPONENTFACTORY( TestKeyHandler ) 2224 IF_NAME_CREATECOMPONENTFACTORY( TestMouseClickHandler ) 2225 #endif 2226 IF_NAME_CREATECOMPONENTFACTORY( OPackageStructureCreator ) 2227 #if 0 2228 if ( ::sfx2::AppletObject::impl_getStaticImplementationName().equals( 2229 ::rtl::OUString::createFromAscii( pImplementationName ) ) ) 2230 { 2231 xFactory = ::sfx2::AppletObject::impl_createFactory(); 2232 } 2233 #endif 2234 IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::PluginObject ) 2235 IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::IFrameObject ) 2236 IF_NAME_CREATECOMPONENTFACTORY( ::sfx2::OwnSubFilterService ) 2237 if ( ::comp_SfxDocumentMetaData::_getImplementationName().equals( 2238 ::rtl::OUString::createFromAscii( pImplementationName ) ) ) 2239 { 2240 xFactory = ::cppu::createSingleComponentFactory( 2241 ::comp_SfxDocumentMetaData::_create, 2242 ::comp_SfxDocumentMetaData::_getImplementationName(), 2243 ::comp_SfxDocumentMetaData::_getSupportedServiceNames()); 2244 } 2245 2246 // Factory is valid - service was found. 2247 if ( xFactory.is() ) 2248 { 2249 xFactory->acquire(); 2250 pReturn = xFactory.get(); 2251 } 2252 } 2253 // Return with result of this operation. 2254 return pReturn ; 2255 } 2256 } // extern "C" 2257 2258 //========================================================================= 2259 2260 void SAL_CALL FilterOptionsContinuation::setFilterOptions( 2261 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProps ) 2262 throw (::com::sun::star::uno::RuntimeException) 2263 { 2264 rProperties = rProps; 2265 } 2266 2267 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL 2268 FilterOptionsContinuation::getFilterOptions() 2269 throw (::com::sun::star::uno::RuntimeException) 2270 { 2271 return rProperties; 2272 } 2273 2274 //========================================================================= 2275 2276 RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > rModel, 2277 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > rProperties ) 2278 { 2279 ::rtl::OUString temp; 2280 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; 2281 ::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp, 2282 temp2, 2283 rModel, 2284 rProperties ); 2285 2286 m_aRequest <<= aOptionsRequest; 2287 2288 m_pAbort = new comphelper::OInteractionAbort; 2289 m_pOptions = new FilterOptionsContinuation; 2290 2291 m_lContinuations.realloc( 2 ); 2292 m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); 2293 m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions ); 2294 } 2295 2296 ::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest() 2297 throw( ::com::sun::star::uno::RuntimeException ) 2298 { 2299 return m_aRequest; 2300 } 2301 2302 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > 2303 SAL_CALL RequestFilterOptions::getContinuations() 2304 throw( ::com::sun::star::uno::RuntimeException ) 2305 { 2306 return m_lContinuations; 2307 } 2308 2309 //========================================================================= 2310 class RequestPackageReparation_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > 2311 { 2312 ::com::sun::star::uno::Any m_aRequest; 2313 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations; 2314 comphelper::OInteractionApprove* m_pApprove; 2315 comphelper::OInteractionDisapprove* m_pDisapprove; 2316 2317 public: 2318 RequestPackageReparation_Impl( ::rtl::OUString aName ); 2319 sal_Bool isApproved(); 2320 virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException ); 2321 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() 2322 throw( ::com::sun::star::uno::RuntimeException ); 2323 }; 2324 2325 RequestPackageReparation_Impl::RequestPackageReparation_Impl( ::rtl::OUString aName ) 2326 { 2327 ::rtl::OUString temp; 2328 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; 2329 ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp, 2330 temp2, 2331 aName ); 2332 m_aRequest <<= aBrokenPackageRequest; 2333 m_pApprove = new comphelper::OInteractionApprove; 2334 m_pDisapprove = new comphelper::OInteractionDisapprove; 2335 m_lContinuations.realloc( 2 ); 2336 m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove ); 2337 m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove ); 2338 } 2339 2340 sal_Bool RequestPackageReparation_Impl::isApproved() 2341 { 2342 return m_pApprove->wasSelected(); 2343 } 2344 2345 ::com::sun::star::uno::Any SAL_CALL RequestPackageReparation_Impl::getRequest() 2346 throw( ::com::sun::star::uno::RuntimeException ) 2347 { 2348 return m_aRequest; 2349 } 2350 2351 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > 2352 SAL_CALL RequestPackageReparation_Impl::getContinuations() 2353 throw( ::com::sun::star::uno::RuntimeException ) 2354 { 2355 return m_lContinuations; 2356 } 2357 2358 RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName ) 2359 { 2360 pImp = new RequestPackageReparation_Impl( aName ); 2361 pImp->acquire(); 2362 } 2363 2364 RequestPackageReparation::~RequestPackageReparation() 2365 { 2366 pImp->release(); 2367 } 2368 2369 sal_Bool RequestPackageReparation::isApproved() 2370 { 2371 return pImp->isApproved(); 2372 } 2373 2374 com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > RequestPackageReparation::GetRequest() 2375 { 2376 return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp); 2377 } 2378 2379 //========================================================================= 2380 class NotifyBrokenPackage_Impl : public ::cppu::WeakImplHelper1< ::com::sun::star::task::XInteractionRequest > 2381 { 2382 ::com::sun::star::uno::Any m_aRequest; 2383 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > m_lContinuations; 2384 comphelper::OInteractionAbort* m_pAbort; 2385 2386 public: 2387 NotifyBrokenPackage_Impl( ::rtl::OUString aName ); 2388 sal_Bool isAborted(); 2389 virtual ::com::sun::star::uno::Any SAL_CALL getRequest() throw( ::com::sun::star::uno::RuntimeException ); 2390 virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > SAL_CALL getContinuations() 2391 throw( ::com::sun::star::uno::RuntimeException ); 2392 }; 2393 2394 NotifyBrokenPackage_Impl::NotifyBrokenPackage_Impl( ::rtl::OUString aName ) 2395 { 2396 ::rtl::OUString temp; 2397 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; 2398 ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp, 2399 temp2, 2400 aName ); 2401 m_aRequest <<= aBrokenPackageRequest; 2402 m_pAbort = new comphelper::OInteractionAbort; 2403 m_lContinuations.realloc( 1 ); 2404 m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); 2405 } 2406 2407 sal_Bool NotifyBrokenPackage_Impl::isAborted() 2408 { 2409 return m_pAbort->wasSelected(); 2410 } 2411 2412 ::com::sun::star::uno::Any SAL_CALL NotifyBrokenPackage_Impl::getRequest() 2413 throw( ::com::sun::star::uno::RuntimeException ) 2414 { 2415 return m_aRequest; 2416 } 2417 2418 ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation > > 2419 SAL_CALL NotifyBrokenPackage_Impl::getContinuations() 2420 throw( ::com::sun::star::uno::RuntimeException ) 2421 { 2422 return m_lContinuations; 2423 } 2424 2425 NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName ) 2426 { 2427 pImp = new NotifyBrokenPackage_Impl( aName ); 2428 pImp->acquire(); 2429 } 2430 2431 NotifyBrokenPackage::~NotifyBrokenPackage() 2432 { 2433 pImp->release(); 2434 } 2435 2436 sal_Bool NotifyBrokenPackage::isAborted() 2437 { 2438 return pImp->isAborted(); 2439 } 2440 2441 com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest > NotifyBrokenPackage::GetRequest() 2442 { 2443 return com::sun::star::uno::Reference < ::com::sun::star::task::XInteractionRequest >(pImp); 2444 } 2445 2446