/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
const beans::PropertyValue& rProp = pPropsVal[0]; const OUString& rName = rProp.Name; if ( nCount == 1 && rName == pSlot->aUnoName )
{ // there is only one parameter and its name matches the name of the property, // so it's either a simple property or a complex property in one single UNO struct if( pItem->PutValue( rProp.Value, bConvertTwips ? CONVERT_TWIPS : 0 ) ) // only use successfully converted items
rSet.Put( std::move(pItem) ); else
{
SAL_WARN( "sfx", "Property not convertible: " << pSlot->aUnoName );
}
} #ifdef DBG_UTIL elseif ( nSubCount == 0 )
{ // for a simple property there can be only one parameter and its name *must* match
SAL_WARN("sfx.appl", "Property name of '" << rName << "' does not match '" << pSlot->aUnoName << "'");
} #endif else
{ // there is more than one parameter and the property is a complex one #ifdef DBG_UTIL // if the dispatch API is used for UI purposes or from the testtool, // it is possible to skip some or all arguments, // but it indicates an error for macro recording; // so this should be notified as a warning only if ( nCount != nSubCount )
{
SAL_INFO("sfx.appl", "MacroPlayer: wrong number of parameters for slot: " << nSlotId );
} #endif // complex property; collect sub items from the parameter set and reconstruct complex item
sal_uInt16 nFound=0; for ( const beans::PropertyValue& rPropValue : rArgs )
{
sal_uInt16 nSub; for ( nSub=0; nSub<nSubCount; nSub++ )
{ // search sub item by name if ( rPropValue.Name == (pSlot->aUnoName + "." + pType->getAttrib(nSub).aName) )
{
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(nSub).nAID)); if ( bConvertTwips )
nSubId |= CONVERT_TWIPS; if ( pItem->PutValue( rPropValue.Value, nSubId ) )
nFound++; else
{
SAL_WARN( "sfx.appl", "Property not convertible: " << pSlot->aUnoName);
} break;
}
}
// there was a parameter with a name that didn't match to any of the members
SAL_WARN_IF( nSub >= nSubCount, "sfx.appl", "Property name does not match: " << rPropValue.Name );
}
// at least one part of the complex item must be present; other parts can have default values if ( nFound > 0 )
rSet.Put( std::move(pItem) );
}
return;
}
#ifdef DBG_UTIL // detect parameters that don't match to any formal argument or one of its members
sal_Int32 nFoundArgs = 0; #endif // slot is a method bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
sal_uInt16 nMaxArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->nArgDefCount; for ( sal_uInt16 nArgs=0; nArgs<nMaxArgs; nArgs++ )
{ const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArgs] : pSlot->GetFormalArgument( nArgs );
std::unique_ptr<SfxPoolItem> pItem(rArg.CreateItem()); if ( !pItem )
{
SAL_WARN( "sfx", "No creator method for argument: " << rArg.aName ); return;
}
if ( !bAsWholeItem )
{ // complex argument; collect sub items from argument array and reconstruct complex item // only put item if at least one member was found and had the correct type // (is this a good idea?! Should we ask for *all* members?) bool bRet = false; for ( const beans::PropertyValue& rProp : rArgs )
{ for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ )
{ // search sub item by name if ( rProp.Name == (rArg.aName + "." + pType->getAttrib(nSub).aName) )
{ // at least one member found ...
bRet = true; #ifdef DBG_UTIL
++nFoundArgs; #endif
sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->getAttrib(nSub).nAID)); if ( bConvertTwips )
nSubId |= CONVERT_TWIPS; if (!pItem->PutValue( rProp.Value, nSubId ) )
{ // ... but it was not convertible
bRet = false;
SAL_WARN( "sfx", "Property not convertible: " << rArg.aName );
}
break;
}
}
}
if ( bRet ) // only use successfully converted items
rSet.Put( std::move(pItem) );
}
}
}
// special additional parameters for some slots not seen in the slot definitions // Some of these slots are not considered to be used for macro recording, because they shouldn't be recorded as slots, // but as dispatching or factory or arbitrary URLs to the frame // Some also can use additional arguments that are not recordable (will be changed later, // f.e. "SaveAs" shouldn't support parameters not in the slot definition!) if ( nSlotId == SID_NEWWINDOW )
{ for ( const beans::PropertyValue& rProp : rArgs )
{ const OUString& rName = rProp.Name; if ( rName == sFrame )
{
Reference< XFrame > xFrame;
OSL_VERIFY( rProp.Value >>= xFrame );
rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
} else if ( rName == sHidden )
{ bool bVal = false; if (rProp.Value >>= bVal)
rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
}
}
} elseif ( bIsMediaDescriptor )
{ for ( const beans::PropertyValue& rProp : rArgs )
{ #ifdef DBG_UTIL
++nFoundArgs; #endif const OUString& aName = rProp.Name; if ( aName == sModel )
rSet.Put( SfxUnoAnyItem( SID_DOCUMENT, rProp.Value ) ); elseif ( aName == sComponentData )
{
rSet.Put( SfxUnoAnyItem( SID_COMPONENTDATA, rProp.Value ) );
} elseif ( aName == sComponentContext )
{
rSet.Put( SfxUnoAnyItem( SID_COMPONENTCONTEXT, rProp.Value ) );
} elseif ( aName == sStatusInd )
{
Reference<task::XStatusIndicator> xVal; bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for StatusIndicator" ); if (bOK && xVal.is())
rSet.Put( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, rProp.Value ) );
} elseif ( aName == sInteractionHdl )
{
Reference<task::XInteractionHandler> xVal; bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for InteractionHandler" ); if (bOK && xVal.is())
rSet.Put( SfxUnoAnyItem( SID_INTERACTIONHANDLER, rProp.Value ) );
} elseif ( aName == sViewData )
rSet.Put( SfxUnoAnyItem( SID_VIEW_DATA, rProp.Value ) ); elseif ( aName == sFilterData )
rSet.Put( SfxUnoAnyItem( SID_FILTER_DATA, rProp.Value ) ); elseif ( aName == sInputStream )
{
Reference< XInputStream > xVal; bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for InputStream" ); if (bOK)
rSet.Put( SfxUnoAnyItem( SID_INPUTSTREAM, rProp.Value ) );
} elseif ( aName == sStream )
{
Reference< XInputStream > xVal; bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for Stream" ); if (bOK)
rSet.Put( SfxUnoAnyItem( SID_STREAM, rProp.Value ) );
} elseif ( aName == sUCBContent )
{
Reference< XContent > xVal; bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for UCBContent" ); if (bOK)
rSet.Put( SfxUnoAnyItem( SID_CONTENT, rProp.Value ) );
} elseif ( aName == sOutputStream )
{
Reference< XOutputStream > xVal; bool bOK = ((rProp.Value >>= xVal) && xVal.is());
DBG_ASSERT( bOK, "invalid type for OutputStream" ); if (bOK)
rSet.Put( SfxUnoAnyItem( SID_OUTPUTSTREAM, rProp.Value ) );
} elseif ( aName == sPostData )
{
Reference< XInputStream > xVal; bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type for PostData" ); if (bOK)
rSet.Put( SfxUnoAnyItem( SID_POSTDATA, rProp.Value ) );
} elseif ( aName == sFrame )
{
Reference< XFrame > xFrame; bool bOK = (rProp.Value >>= xFrame);
DBG_ASSERT( bOK, "invalid type for Frame" ); if (bOK)
rSet.Put( SfxUnoFrameItem( SID_FILLFRAME, xFrame ) );
} elseif ( aName == sAsTemplate )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for AsTemplate" ); if (bOK)
rSet.Put( SfxBoolItem( SID_TEMPLATE, bVal ) );
} elseif ( aName == sOpenNewView )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for OpenNewView" ); if (bOK)
rSet.Put( SfxBoolItem( SID_OPEN_NEW_VIEW, bVal ) );
} elseif ( aName == sFailOnWarning )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for FailOnWarning" ); if (bOK)
rSet.Put( SfxBoolItem( SID_FAIL_ON_WARNING, bVal ) );
} elseif ( aName == sViewId )
{
sal_Int16 nVal = -1; bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for ViewId" ); if (bOK)
rSet.Put( SfxUInt16Item( SID_VIEW_ID, nVal ) );
} elseif ( aName == sPluginMode )
{
sal_Int16 nVal = -1; bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for PluginMode" ); if (bOK)
rSet.Put( SfxUInt16Item( SID_PLUGIN_MODE, nVal ) );
} elseif ( aName == sReadOnly )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ReadOnly" ); if (bOK)
rSet.Put( SfxBoolItem( SID_DOC_READONLY, bVal ) );
} elseif ( aName == sDdeReconnect )
{ bool bVal = true; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for DDEReconnect" ); if (bOK)
rSet.Put( SfxBoolItem( SID_DDE_RECONNECT_ONLOAD, bVal ) );
} elseif ( aName == sStartPresentation )
{
sal_uInt16 nVal = 0; bool bOK = (rProp.Value >>= nVal);
DBG_ASSERT( bOK, "invalid type for StartPresentation" ); if (bOK)
rSet.Put(SfxUInt16Item(SID_DOC_STARTPRESENTATION, nVal));
} elseif ( aName == sSelectionOnly )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for SelectionOnly" ); if (bOK)
rSet.Put( SfxBoolItem( SID_SELECTION, bVal ) );
} elseif ( aName == sHidden )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Hidden" ); if (bOK)
rSet.Put( SfxBoolItem( SID_HIDDEN, bVal ) );
} elseif ( aName == sMinimized )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Minimized" ); if (bOK)
rSet.Put( SfxBoolItem( SID_MINIMIZED, bVal ) );
} elseif ( aName == sSilent )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Silent" ); if (bOK)
rSet.Put( SfxBoolItem( SID_SILENT, bVal ) );
} elseif ( aName == sPreview )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for Preview" ); if (bOK)
rSet.Put( SfxBoolItem( SID_PREVIEW, bVal ) );
} elseif ( aName == sViewOnly )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" ); if (bOK)
rSet.Put( SfxBoolItem( SID_VIEWONLY, bVal ) );
} elseif ( aName == sDontEdit )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" ); if (bOK)
rSet.Put( SfxBoolItem( SID_EDITDOC, !bVal ) );
} elseif ( aName == sUseSystemDialog )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for ViewOnly" ); if (bOK)
rSet.Put( SfxBoolItem( SID_FILE_DIALOG, bVal ) );
} elseif ( aName == sDenyList )
{
uno::Sequence<OUString> xVal; bool bOK = (rProp.Value >>= xVal);
DBG_ASSERT( bOK, "invalid type or value for DenyList" ); if (bOK)
{
SfxStringListItem stringList(SID_DENY_LIST);
stringList.SetStringList( xVal );
rSet.Put( stringList );
}
} elseif ( aName == "FileName" )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for FileName" ); if (bOK)
rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) );
} elseif ( aName == sSalvagedFile )
{
OUString sVal; bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" ); if (bOK)
rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) );
} elseif ( aName == sFolderName )
{
OUString sVal; bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type or value for FolderName" ); if (bOK)
rSet.Put( SfxStringItem( SID_PATH, sVal ) );
} elseif ( aName == sFrameName )
{
OUString sVal; bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type for FrameName" ); if (bOK && !sVal.isEmpty())
rSet.Put( SfxStringItem( SID_TARGETNAME, sVal ) );
} elseif ( aName == sMediaType )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for MediaType" ); if (bOK)
rSet.Put( SfxStringItem( SID_CONTENTTYPE, sVal ) );
} elseif ( aName == sTemplateName )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for TemplateName" ); if (bOK)
rSet.Put( SfxStringItem( SID_TEMPLATE_NAME, sVal ) );
} elseif ( aName == sTemplateRegionName )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for TemplateRegionName" ); if (bOK)
rSet.Put( SfxStringItem( SID_TEMPLATE_REGIONNAME, sVal ) );
} elseif ( aName == sJumpMark )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for JumpMark" ); if (bOK)
rSet.Put( SfxStringItem( SID_JUMPMARK, sVal ) );
} elseif ( aName == sCharacterSet )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for CharacterSet" ); if (bOK)
rSet.Put( SfxStringItem( SID_CHARSET, sVal ) );
} elseif ( aName == "FilterFlags" )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for FilterFlags" ); if (bOK)
rSet.Put( SfxStringItem( SID_FILE_FILTEROPTIONS, sVal ) );
} elseif ( aName == sImageFilter )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for FilterFlags" ); if (bOK)
rSet.Put( SfxStringItem( SID_CONVERT_IMAGES, sVal ) );
} elseif ( aName == sMacroExecMode )
{
sal_Int16 nVal =-1; bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for MacroExecMode" ); if (bOK)
rSet.Put( SfxUInt16Item( SID_MACROEXECMODE, nVal ) );
} elseif ( aName == sUpdateDocMode )
{
sal_Int16 nVal =-1; bool bOK = ((rProp.Value >>= nVal) && (nVal != -1));
DBG_ASSERT( bOK, "invalid type for UpdateDocMode" ); if (bOK)
rSet.Put( SfxUInt16Item( SID_UPDATEDOCMODE, nVal ) );
} elseif ( aName == sRepairPackage )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for RepairPackage" ); if (bOK)
rSet.Put( SfxBoolItem( SID_REPAIRPACKAGE, bVal ) );
} elseif ( aName == sDocumentTitle )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for DocumentTitle" ); if (bOK)
rSet.Put( SfxStringItem( SID_DOCINFO_TITLE, sVal ) );
} elseif ( aName == sDocumentBaseURL )
{
OUString sVal; // the base url can be set to empty ( for embedded objects for example ) bool bOK = (rProp.Value >>= sVal);
DBG_ASSERT( bOK, "invalid type or value for DocumentBaseURL" ); if (bOK)
rSet.Put( SfxStringItem( SID_DOC_BASEURL, sVal ) );
} elseif ( aName == sHierarchicalDocumentName )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for HierarchicalDocumentName" ); if (bOK)
rSet.Put( SfxStringItem( SID_DOC_HIERARCHICALNAME, sVal ) );
} elseif ( aName == sCopyStreamIfPossible )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for CopyStreamIfPossible" ); if (bOK)
rSet.Put( SfxBoolItem( SID_COPY_STREAM_IF_POSSIBLE, bVal ) );
} elseif ( aName == sNoAutoSave )
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for NoAutoSave" ); if (bOK)
rSet.Put( SfxBoolItem( SID_NOAUTOSAVE, bVal ) );
} elseif ( aName == sModifyPasswordInfo )
{
rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) );
} elseif ( aName == sEncryptionData )
{
rSet.Put( SfxUnoAnyItem( SID_ENCRYPTIONDATA, rProp.Value ) );
} elseif ( aName == sSuggestedSaveAsDir )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" ); if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) );
} elseif ( aName == sSuggestedSaveAsName )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" ); if (bOK)
rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) );
} elseif ( aName == sExportDirectory )
{
OUString sVal; bool bOK = ((rProp.Value >>= sVal) && !sVal.isEmpty());
DBG_ASSERT( bOK, "invalid type or value for ExportDirectoy" ); if (bOK)
rSet.Put( SfxStringItem( SID_EXPORTDIRECTORY, sVal ) );
} elseif (aName == sDocumentService)
{
OUString aVal; bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty()); if (bOK)
rSet.Put(SfxStringItem(SID_DOC_SERVICE, aVal));
} elseif (aName == sFilterProvider)
{
OUString aVal; bool bOK = ((rProp.Value >>= aVal) && !aVal.isEmpty()); if (bOK)
rSet.Put(SfxStringItem(SID_FILTER_PROVIDER, aVal));
} elseif (aName == sLockContentExtraction)
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockContentExtraction" ); if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_CONTENT_EXTRACTION, bVal ) );
} elseif (aName == sLockExport)
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockExport" ); if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_EXPORT, bVal ) );
} elseif (aName == sLockPrint)
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockPrint" ); if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_PRINT, bVal ) );
} elseif (aName == sLockSave)
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockSave" ); if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_SAVE, bVal ) );
} elseif (aName == sLockEditDoc)
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT( bOK, "invalid type for LockEditDoc" ); if (bOK)
rSet.Put( SfxBoolItem( SID_LOCK_EDITDOC, bVal ) );
} elseif (aName == sReplaceable)
{ bool bVal = false; bool bOK = (rProp.Value >>= bVal);
DBG_ASSERT(bOK, "invalid type for Replaceable"); if (bOK)
rSet.Put(SfxBoolItem(SID_REPLACEABLE, bVal));
} #ifdef DBG_UTIL else
--nFoundArgs; #endif
}
} // API to raise options dialog with a specified options ab page (#i83757#) else
{ // transform parameter "OptionsPageURL" of slot "OptionsTreeDialog" if ( "OptionsTreeDialog" == pSlot->aUnoName )
{ auto pProp = std::find_if(rArgs.begin(), rArgs.end(),
[](const PropertyValue& rProp) { return rProp.Name == "OptionsPageURL" || rProp.Name == "OptionsPageID"; }); if (pProp != rArgs.end())
{
OUString sURL;
sal_uInt16 nPageID; if ( pProp->Name == "OptionsPageURL" && (pProp->Value >>= sURL) )
rSet.Put( SfxStringItem( SID_OPTIONS_PAGEURL, sURL ) ); elseif ( pProp->Name == "OptionsPageID" && (pProp->Value >>= nPageID) )
rSet.Put( SfxUInt16Item( SID_OPTIONS_PAGEID, nPageID ) );
}
}
} #ifdef DBG_UTIL if ( nFoundArgs == nCount )
{ // except for the "special" slots: assure that every argument was convertible
SAL_INFO( "sfx.appl", "MacroPlayer: Some properties didn't match to any formal argument for slot: "<< pSlot->aUnoName );
} #endif
}
if ( nSlotId == SID_OPENURL )
nSlotId = SID_OPENDOC; if ( nSlotId == SID_SAVEASREMOTE )
nSlotId = SID_SAVEASDOC;
// find number of properties to avoid permanent reallocations in the sequence
sal_Int32 nProps=0;
#ifdef DBG_UTIL // trace number of items and compare with number of properties for debugging purposes
sal_Int32 nItems=0; #endif
const SfxType *pType = pSlot->GetType(); if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
{ // slot is a property
sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID(nSlotId); if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
{
sal_uInt16 nSubCount = pType->nAttribs; if ( nSubCount ) // it's a complex property, we want it split into simple types // so we expect to get as many items as we have (sub) members
nProps = nSubCount; else // simple property: we expect to get exactly one item
nProps++;
} else
{ // we will not rely on the "toggle" ability of some property slots
SAL_WARN( "sfx", "Processing property slot without argument: " << nSlotId );
}
#ifdef DBG_UTIL
nItems++; #endif
} else
{ // slot is a method bool bIsMediaDescriptor = isMediaDescriptor( nSlotId );
sal_uInt16 nFormalArgs = bIsMediaDescriptor ? nMediaArgsCount : pSlot->GetFormalArgumentCount(); for ( sal_uInt16 nArg=0; nArg<nFormalArgs; ++nArg )
{ // check every formal argument of the method const SfxFormalArgument &rArg = bIsMediaDescriptor ? aFormalArgs[nArg] : pSlot->GetFormalArgument( nArg );
sal_uInt16 nWhich = rSet.GetPool()->GetWhichIDFromSlotID( rArg.nSlotId ); if ( rSet.GetItemState( nWhich ) == SfxItemState::SET ) //???
{
sal_uInt16 nSubCount = rArg.pType->nAttribs; if ( nSubCount ) // argument has a complex type, we want it split into simple types // so for this argument we expect to get as many items as we have (sub) members
nProps += nSubCount; else // argument of simple type: we expect to get exactly one item for it
nProps++; #ifdef DBG_UTIL
nItems++; #endif
}
}
// special treatment for slots that are *not* meant to be recorded as slots (except SaveAs/To) if ( bIsMediaDescriptor )
{
sal_Int32 nAdditional=0; if ( rSet.GetItemState( SID_PROGRESS_STATUSBAR_CONTROL ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_INTERACTIONHANDLER ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOC_SALVAGE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_PATH ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_FILE_DIALOG ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DENY_LIST ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_CONTENT ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_INPUTSTREAM ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_STREAM ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_OUTPUTSTREAM ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_TEMPLATE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_OPEN_NEW_VIEW ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_FAIL_ON_WARNING ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_VIEW_ID ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_VIEW_DATA ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_FILTER_DATA ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_PLUGIN_MODE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOC_READONLY ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DDE_RECONNECT_ONLOAD ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOC_STARTPRESENTATION ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_SELECTION ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_CONTENTTYPE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_POSTDATA ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_FILLFRAME ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_CHARSET ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_TARGETNAME ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_TEMPLATE_NAME ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_TEMPLATE_REGIONNAME ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_HIDDEN ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_MINIMIZED ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_PREVIEW ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_VIEWONLY ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_EDITDOC ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_SILENT ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_JUMPMARK ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOCUMENT ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_MACROEXECMODE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_UPDATEDOCMODE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_REPAIRPACKAGE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOCINFO_TITLE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_COMPONENTDATA ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_COMPONENTCONTEXT ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOC_BASEURL ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOC_HIERARCHICALNAME ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_COPY_STREAM_IF_POSSIBLE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_NOAUTOSAVE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_ENCRYPTIONDATA ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_EXPORTDIRECTORY ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_DOC_SERVICE ) == SfxItemState::SET )
nAdditional++; if (rSet.HasItem(SID_FILTER_PROVIDER))
++nAdditional; if ( rSet.GetItemState( SID_CONVERT_IMAGES ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_LOCK_CONTENT_EXTRACTION ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_LOCK_EXPORT ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_LOCK_PRINT ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_LOCK_SAVE ) == SfxItemState::SET )
nAdditional++; if ( rSet.GetItemState( SID_LOCK_EDITDOC ) == SfxItemState::SET )
nAdditional++; if (rSet.GetItemState(SID_REPLACEABLE) == SfxItemState::SET)
nAdditional++;
#ifdef DBG_UTIL // now check the itemset: is there any item that is not convertible using the list of formal arguments // or the table of additional items?! if ( rSet.Count() != nItems )
{ // detect unknown item and present error message for ( autoconst & rPair : rSet.GetRanges() )
{
sal_uInt16 nStartWhich = rPair.first;
sal_uInt16 nEndWhich = rPair.second; for(sal_uInt16 nId = nStartWhich; nId <= nEndWhich; ++nId)
{ if ( rSet.GetItemState(nId) < SfxItemState::SET ) //??? // not really set continue;
if ( !pSlot->IsMode(SfxSlotMode::METHOD) && nId == rSet.GetPool()->GetWhichIDFromSlotID( pSlot->GetSlotId() ) ) continue;
if ( bIsMediaDescriptor )
{ if ( nId == SID_DOCFRAME ) continue; if ( nId == SID_PROGRESS_STATUSBAR_CONTROL ) continue; if ( nId == SID_INTERACTIONHANDLER ) continue; if ( nId == SID_VIEW_DATA ) continue; if ( nId == SID_FILTER_DATA ) continue; if ( nId == SID_DOCUMENT ) continue; if ( nId == SID_CONTENT ) continue; if ( nId == SID_INPUTSTREAM ) continue; if ( nId == SID_STREAM ) continue; if ( nId == SID_OUTPUTSTREAM ) continue; if ( nId == SID_POSTDATA ) continue; if ( nId == SID_FILLFRAME ) continue; if ( nId == SID_TEMPLATE ) continue; if ( nId == SID_OPEN_NEW_VIEW ) continue; if ( nId == SID_VIEW_ID ) continue; if ( nId == SID_PLUGIN_MODE ) continue; if ( nId == SID_DOC_READONLY ) continue; if ( nId == SID_DOC_STARTPRESENTATION ) continue; if ( nId == SID_SELECTION ) continue; if ( nId == SID_HIDDEN ) continue; if ( nId == SID_MINIMIZED ) continue; if ( nId == SID_SILENT ) continue; if ( nId == SID_PREVIEW ) continue; if ( nId == SID_VIEWONLY ) continue; if ( nId == SID_EDITDOC ) continue; if ( nId == SID_TARGETNAME ) continue; if ( nId == SID_DOC_SALVAGE ) continue; if ( nId == SID_PATH ) continue; if ( nId == SID_FILE_DIALOG ) continue; if ( nId == SID_DENY_LIST ) continue; if ( nId == SID_CONTENTTYPE ) continue; if ( nId == SID_TEMPLATE_NAME ) continue; if ( nId == SID_TEMPLATE_REGIONNAME ) continue; if ( nId == SID_JUMPMARK ) continue; if ( nId == SID_CHARSET ) continue; if ( nId == SID_MACROEXECMODE ) continue; if ( nId == SID_UPDATEDOCMODE ) continue; if ( nId == SID_REPAIRPACKAGE ) continue; if ( nId == SID_DOCINFO_TITLE ) continue; if ( nId == SID_COMPONENTDATA ) continue; if ( nId == SID_COMPONENTCONTEXT ) continue; if ( nId == SID_DOC_BASEURL ) continue; if ( nId == SID_DOC_HIERARCHICALNAME ) continue; if ( nId == SID_COPY_STREAM_IF_POSSIBLE ) continue; if ( nId == SID_NOAUTOSAVE ) continue; if ( nId == SID_ENCRYPTIONDATA ) continue; if ( nId == SID_DOC_SERVICE ) continue; if (nId == SID_FILTER_PROVIDER) continue; if ( nId == SID_CONVERT_IMAGES ) continue;
// used only internally if ( nId == SID_SAVETO ) continue; if ( nId == SID_SAVEACOPYITEM ) continue; if ( nId == SID_MODIFYPASSWORDINFO ) continue; if ( nId == SID_SUGGESTEDSAVEASDIR ) continue; if ( nId == SID_SUGGESTEDSAVEASNAME ) continue; if ( nId == SID_EXPORTDIRECTORY ) continue; if ( nId == SID_LOCK_CONTENT_EXTRACTION ) continue; if ( nId == SID_LOCK_EXPORT ) continue; if ( nId == SID_LOCK_PRINT ) continue; if ( nId == SID_LOCK_SAVE ) continue; if ( nId == SID_LOCK_EDITDOC ) continue; if (nId == SID_REPLACEABLE) continue;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.