forms/source/richtext/parametrizedattributedispatcher.cxx |    6 
 include/sfx2/sfxuno.hxx                                   |    8 
 sd/source/filter/grf/sdgrffilter.cxx                      |   34 --
 sfx2/source/appl/appopen.cxx                              |   26 -
 sfx2/source/appl/appserv.cxx                              |    4 
 sfx2/source/appl/appuno.cxx                               |  217 ++++----------
 sfx2/source/control/request.cxx                           |    4 
 sfx2/source/control/statcach.cxx                          |    2 
 sfx2/source/doc/docfile.cxx                               |    8 
 sfx2/source/doc/guisaveas.cxx                             |    4 
 sfx2/source/doc/objmisc.cxx                               |    5 
 sfx2/source/doc/objserv.cxx                               |    4 
 sfx2/source/doc/objstor.cxx                               |   70 ----
 sfx2/source/doc/objxtor.cxx                               |    5 
 sfx2/source/doc/sfxbasemodel.cxx                          |   51 +--
 sfx2/source/view/frame2.cxx                               |   15 
 sfx2/source/view/viewfrm.cxx                              |   10 
 sfx2/source/view/viewprn.cxx                              |   59 +--
 svx/source/form/fmtextcontrolshell.cxx                    |   10 
 19 files changed, 174 insertions(+), 368 deletions(-)

New commits:
commit e8d73d53073f1d953c3498bf0ee2bfef996eb4b0
Author:     Mike Kaganski <[email protected]>
AuthorDate: Wed Dec 3 10:45:35 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sat Dec 6 16:45:05 2025 +0100

    Let TransformItems return comphelper::SequenceAsHashMap
    
    Simplifies its usage in all places where the result needs to be
    modified.
    
    Change-Id: I37f8d99827e0f1cb2b6e4f4f7735e26fb87f6703
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195162
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>

diff --git a/forms/source/richtext/parametrizedattributedispatcher.cxx 
b/forms/source/richtext/parametrizedattributedispatcher.cxx
index a86441cd87dd..3cd8bf2a83b2 100644
--- a/forms/source/richtext/parametrizedattributedispatcher.cxx
+++ b/forms/source/richtext/parametrizedattributedispatcher.cxx
@@ -75,13 +75,13 @@ namespace frm
             return;
 
         SfxItemSet aEmptySet(getEditView()->GetEmptyItemSet());
-        Sequence< PropertyValue > aUnoStateDescription;
+        comphelper::SequenceAsHashMap aUnoStateDescription;
         if ( _rState.getItem() )
         {
             aEmptySet.Put( *_rState.getItem() );
             SfxSlotId nSlotId = aEmptySet.GetPool()->GetSlotId( 
_rState.getItem()->Which() );
-            TransformItems( nSlotId, aEmptySet, aUnoStateDescription );
-            _rEvent.State <<= aUnoStateDescription;
+            aUnoStateDescription = TransformItems(nSlotId, aEmptySet);
+            _rEvent.State <<= 
aUnoStateDescription.getAsConstPropertyValueList();
         }
         else
             OAttributeDispatcher::fillFeatureEventFromAttributeState( _rEvent, 
_rState );
diff --git a/include/sfx2/sfxuno.hxx b/include/sfx2/sfxuno.hxx
index 22c7e53666f3..5a48ba10169b 100644
--- a/include/sfx2/sfxuno.hxx
+++ b/include/sfx2/sfxuno.hxx
@@ -22,6 +22,8 @@
 #include <sal/config.h>
 #include <sfx2/dllapi.h>
 
+#include <comphelper/sequenceashashmap.hxx>
+
 namespace com::sun::star::beans { struct NamedValue; }
 namespace com::sun::star::beans { struct PropertyValue; }
 namespace com::sun::star::uno { template <class E> class Sequence; }
@@ -35,10 +37,8 @@ SFX2_DLLPUBLIC void TransformParameters(            
sal_uInt16
                                     SfxAllItemSet&                             
         aSet        ,
                             const   SfxSlot*                                   
         pSlot = nullptr   );
 
-SFX2_DLLPUBLIC void TransformItems(         sal_uInt16                         
         nSlotId     ,
-                            const   SfxItemSet&                                
         aSet        ,
-                                    css::uno::Sequence< 
css::beans::PropertyValue >&    seqArgs     ,
-                            const   SfxSlot*                            pSlot 
= nullptr   );
+SFX2_DLLPUBLIC comphelper::SequenceAsHashMap
+TransformItems(sal_uInt16 nSlotId, const SfxItemSet& aSet, const SfxSlot* 
pSlot = nullptr);
 
 bool GetEncryptionData_Impl( const SfxItemSet* pSet, css::uno::Sequence< 
css::beans::NamedValue >& aEncryptionData );
 
diff --git a/sd/source/filter/grf/sdgrffilter.cxx 
b/sd/source/filter/grf/sdgrffilter.cxx
index f261efa17d27..a16e58b6fc82 100644
--- a/sd/source/filter/grf/sdgrffilter.cxx
+++ b/sd/source/filter/grf/sdgrffilter.cxx
@@ -260,38 +260,16 @@ bool SdGRFFilter::Export()
                 {
                     rtl::Reference< SdGRFFilter_ImplInteractionHdl > 
xInteractionHandler;
 
-                    beans::PropertyValues aArgs;
-                    TransformItems( SID_SAVEASDOC, rSet, aArgs );
+                    comphelper::SequenceAsHashMap aArgs = 
TransformItems(SID_SAVEASDOC, rSet);
 
                     static constexpr OUString sFilterName( u"FilterName"_ustr 
);
                     OUString sShortName( 
rGraphicFilter.GetExportFormatShortName( nFilter ) );
 
-                    bool    bFilterNameFound = false;
-                    for ( auto& rArg : asNonConstRange(aArgs) )
+                    aArgs[sFilterName] <<= sShortName;
+                    if (auto xHdl = 
aArgs.getValue(u"InteractionHandler"_ustr).query<task::XInteractionHandler>())
                     {
-                        OUString& rStr = rArg.Name;
-                        if ( rStr == sFilterName )
-                        {
-                            bFilterNameFound = true;
-                            rArg.Value <<= sShortName;
-                        }
-                        else if ( rStr == "InteractionHandler" )
-                        {
-                            uno::Reference< task::XInteractionHandler > xHdl;
-                            if ( rArg.Value >>= xHdl )
-                            {
-                                xInteractionHandler = new 
SdGRFFilter_ImplInteractionHdl( xHdl );
-                                rArg.Value <<= uno::Reference< 
task::XInteractionHandler >(xInteractionHandler);
-                            }
-                        }
-                    }
-                    if ( !bFilterNameFound )
-                    {
-                        sal_Int32 nCount = aArgs.getLength();
-                        aArgs.realloc( nCount + 1 );
-                        auto pArgs = aArgs.getArray();
-                        pArgs[ nCount ].Name = sFilterName;
-                        pArgs[ nCount ].Value <<= sShortName;
+                        xInteractionHandler = new 
SdGRFFilter_ImplInteractionHdl(xHdl);
+                        aArgs[u"InteractionHandler"_ustr] <<= 
uno::Reference<task::XInteractionHandler>(xInteractionHandler);
                     }
 
                     // take selection if needed
@@ -310,7 +288,7 @@ bool SdGRFFilter::Export()
                         }
                     }
                     xExporter->setSourceDocument( xSource );
-                    bRet = xExporter->filter( aArgs );
+                    bRet = 
xExporter->filter(aArgs.getAsConstPropertyValueList());
                     if ( !bRet && xInteractionHandler.is() )
                         SdGRFFilter::HandleGraphicFilterError(
                             xInteractionHandler->GetErrorCode(),
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 508a703f0ff1..03e7e92c384f 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -401,14 +401,9 @@ ErrCodeMsg SfxApplication::LoadTemplate( 
SfxObjectShellLock& xDoc, const OUStrin
         std::unique_ptr<SfxItemSet> pNew = 
xDoc->GetMedium()->GetItemSet().Clone();
         pNew->ClearItem( SID_PROGRESS_STATUSBAR_CONTROL );
         pNew->ClearItem( SID_FILTER_NAME );
-        css::uno::Sequence< css::beans::PropertyValue > aArgs;
-        TransformItems( SID_OPENDOC, *pNew, aArgs );
-        sal_Int32 nLength = aArgs.getLength();
-        aArgs.realloc( nLength + 1 );
-        auto pArgs = aArgs.getArray();
-        pArgs[nLength].Name = "Title";
-        pArgs[nLength].Value <<= xDoc->GetTitle( SFX_TITLE_DETECT );
-        xModel->attachResource( OUString(), aArgs );
+        comphelper::SequenceAsHashMap aArgs = TransformItems(SID_OPENDOC, 
*pNew);
+        aArgs[u"Title"_ustr] <<= xDoc->GetTitle(SFX_TITLE_DETECT);
+        xModel->attachResource(OUString(), 
aArgs.getAsConstPropertyValueList());
     }
 
     return xDoc->GetErrorCode();
@@ -1072,18 +1067,11 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq 
)
     }
 
     // convert items to properties for framework API calls
-    Sequence < PropertyValue > aArgs;
-    TransformItems( SID_OPENDOC, *rReq.GetArgs(), aArgs );
+    comphelper::SequenceAsHashMap aArgs = TransformItems(SID_OPENDOC, 
*rReq.GetArgs());
     // Any Referer (that was relevant in the above call to
     // SvtSecurityOptions::isSecureMacroUri) is no longer relevant, assuming
     // this "open" request is initiated directly by the user:
-    auto pArg = std::find_if(std::cbegin(aArgs), std::cend(aArgs),
-        [](const PropertyValue& rArg) { return rArg.Name == "Referer"; });
-    if (pArg != std::cend(aArgs))
-    {
-        auto nIndex = static_cast<sal_Int32>(std::distance(std::cbegin(aArgs), 
pArg));
-        comphelper::removeElementAt(aArgs, nIndex);
-    }
+    aArgs.erase(u"Referer"_ustr);
 
     // TODO/LATER: either remove LinkItem or create an asynchronous process 
for it
     if( bHidden || pLinkItem || rReq.IsSynchronCall() )
@@ -1094,7 +1082,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
 
         try
         {
-            xComp = ::comphelper::SynchronousDispatch::dispatch( xTargetFrame, 
aFileName, aTarget, aArgs );
+            xComp = comphelper::SynchronousDispatch::dispatch(xTargetFrame, 
aFileName, aTarget, aArgs.getAsConstPropertyValueList());
         }
         catch(const RuntimeException&)
         {
@@ -1121,7 +1109,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
         Reference < XDispatchProvider > xProv( xTargetFrame, UNO_QUERY );
         Reference < XDispatch > xDisp = xProv.is() ? xProv->queryDispatch( 
aURL, aTarget, FrameSearchFlag::ALL ) : Reference < XDispatch >();
         if ( xDisp.is() )
-            xDisp->dispatch( aURL, aArgs );
+            xDisp->dispatch(aURL, aArgs.getAsConstPropertyValueList());
     }
 
     if ( xController.is() )
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 2d2205c67b39..0dd18d34cc2c 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -2021,7 +2021,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
             Reference< frame::XDispatchHelper > xHelper( 
frame::DispatchHelper::create(xContext) );
             Sequence < beans::PropertyValue > aSeq;
             if ( rReq.GetArgs() )
-                TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
+                aSeq = TransformItems(rReq.GetSlot(), 
*rReq.GetArgs()).getAsConstPropertyValueList();
             Any aResult = xHelper->executeDispatch( xProv, aCmd, OUString(), 
0, aSeq );
             frame::DispatchResultEvent aEvent;
             bool bSuccess = (aResult >>= aEvent) &&
@@ -2041,7 +2041,7 @@ void SfxApplication::OfaExec_Impl( SfxRequest& rReq )
             Reference< frame::XDispatchHelper > xHelper( 
frame::DispatchHelper::create(xContext) );
             Sequence < beans::PropertyValue > aSeq;
             if ( rReq.GetArgs() )
-                TransformItems( rReq.GetSlot(), *rReq.GetArgs(), aSeq );
+                aSeq = TransformItems(rReq.GetSlot(), 
*rReq.GetArgs()).getAsConstPropertyValueList();
             Any aResult = xHelper->executeDispatch( xProv, aCmd, OUString(), 
0, aSeq );
             frame::DispatchResultEvent aEvent;
             bool bSuccess = (aResult >>= aEvent) &&
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 8e11aeace279..58b8fbd5b20a 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -907,13 +907,14 @@ void TransformParameters( sal_uInt16 nSlotId, const 
uno::Sequence<beans::Propert
 #endif
 }
 
-void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, 
uno::Sequence<beans::PropertyValue>& rArgs, const SfxSlot* pSlot )
+comphelper::SequenceAsHashMap TransformItems(sal_uInt16 nSlotId, const 
SfxItemSet& rSet,
+                                             const SfxSlot* pSlot)
 {
     if ( !pSlot )
         pSlot = SFX_SLOTPOOL().GetSlot( nSlotId );
 
     if ( !pSlot)
-        return;
+        return {};
 
     if ( nSlotId == SID_OPENURL )
         nSlotId = SID_OPENDOC;
@@ -1283,13 +1284,11 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
 #endif
 
     if ( !nProps )
-        return;
+        return {};
 
     // convert every item into a property
-    uno::Sequence<beans::PropertyValue> aSequ(nProps);
-    beans::PropertyValue *pValue = aSequ.getArray();
+    comphelper::SequenceAsHashMap aSequ;
 
-    sal_Int32 nActProp=0;
     if ( !pSlot->IsMode(SfxSlotMode::METHOD) )
     {
         // slot is a property
@@ -1301,8 +1300,7 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
             sal_uInt16 nSubCount = pType->nAttribs;
             if ( !nSubCount )
             {
-                pValue[nActProp].Name = pSlot->aUnoName;
-                if ( !pItem->QueryValue( pValue[nActProp].Value ) )
+                if (!pItem->QueryValue(aSequ[pSlot->aUnoName]))
                 {
                     SAL_WARN( "sfx", "Item not convertible: " << nSlotId );
                 }
@@ -1317,10 +1315,8 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
                         nSubId |= CONVERT_TWIPS;
 
                     DBG_ASSERT(( pType->getAttrib(n-1).nAID ) <= 127, "Member 
ID out of range" );
-                    pValue[nActProp].Name = pSlot->aUnoName +
-                        "." +
-                        pType->getAttrib(n-1).aName;
-                    if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId 
) )
+                    if (!pItem->QueryValue(
+                            aSequ[pSlot->aUnoName + "." + pType->getAttrib(n - 
1).aName], nSubId))
                     {
                         SAL_WARN( "sfx", "Sub item " << 
pType->getAttrib(n-1).nAID
                                     << " not convertible in slot: " << nSlotId 
);
@@ -1329,8 +1325,7 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
             }
         }
 
-        rArgs = std::move(aSequ);
-        return;
+        return aSequ;
     }
 
     // slot is a method
@@ -1346,8 +1341,7 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
             sal_uInt16 nSubCount = rArg.pType->nAttribs;
             if ( !nSubCount )
             {
-                pValue[nActProp].Name = rArg.aName;
-                if ( !pItem->QueryValue( pValue[nActProp++].Value ) )
+                if (!pItem->QueryValue(aSequ[rArg.aName]))
                 {
                     SAL_WARN( "sfx", "Item not convertible: " << rArg.nSlotId 
);
                 }
@@ -1362,10 +1356,8 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
                         nSubId |= CONVERT_TWIPS;
 
                     DBG_ASSERT((rArg.pType->getAttrib(n-1).nAID) <= 127, 
"Member ID out of range" );
-                    pValue[nActProp].Name = rArg.aName +
-                        "." +
-                        rArg.pType->getAttrib(n-1).aName ;
-                    if ( !pItem->QueryValue( pValue[nActProp++].Value, nSubId 
) )
+                    if (!pItem->QueryValue(
+                            aSequ[rArg.aName + "." + rArg.pType->getAttrib(n - 
1).aName], nSubId))
                     {
                         SAL_WARN( "sfx", "Sub item "
                                     << rArg.pType->getAttrib(n-1).nAID
@@ -1384,319 +1376,258 @@ void TransformItems( sal_uInt16 nSlotId, const 
SfxItemSet& rSet, uno::Sequence<b
     {
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( 
SID_COMPONENTDATA, false) )
         {
-            pValue[nActProp].Name = sComponentData;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sComponentData] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( 
SID_COMPONENTCONTEXT, false) )
         {
-            pValue[nActProp].Name = sComponentContext;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sComponentContext] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( 
SID_PROGRESS_STATUSBAR_CONTROL, false) )
         {
-            pValue[nActProp].Name = sStatusInd;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sStatusInd] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( 
SID_INTERACTIONHANDLER, false) )
         {
-            pValue[nActProp].Name = sInteractionHdl;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sInteractionHdl] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_VIEW_DATA, 
false) )
         {
-            pValue[nActProp].Name = sViewData;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sViewData] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_FILTER_DATA, 
false) )
         {
-            pValue[nActProp].Name = sFilterData;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sFilterData] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_DOCUMENT, 
false) )
         {
-            pValue[nActProp].Name = sModel;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sModel] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_CONTENT, 
false) )
         {
-            pValue[nActProp].Name = sUCBContent;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sUCBContent] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_INPUTSTREAM, 
false) )
         {
-            pValue[nActProp].Name = sInputStream;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sInputStream] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_STREAM, 
false) )
         {
-            pValue[nActProp].Name = sStream;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sStream] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_OUTPUTSTREAM, 
false) )
         {
-            pValue[nActProp].Name = sOutputStream;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sOutputStream] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( SID_POSTDATA, 
false) )
         {
-            pValue[nActProp].Name = sPostData;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sPostData] = pItem->GetValue();
         }
         if ( const SfxPoolItem *pItem = nullptr; SfxItemState::SET == 
rSet.GetItemState( SID_FILLFRAME, false, &pItem) )
         {
-            pValue[nActProp].Name = sFrame;
             if ( auto pUsrAnyItem = dynamic_cast< const SfxUnoAnyItem *>( 
pItem ) )
             {
                 OSL_FAIL( "TransformItems: transporting an XFrame via an 
SfxUnoAnyItem is not deprecated!" );
-                pValue[nActProp++].Value = pUsrAnyItem->GetValue();
+                aSequ[sFrame] = pUsrAnyItem->GetValue();
             }
             else if ( auto pUnoFrameItem = dynamic_cast< const SfxUnoFrameItem 
*>( pItem ) )
-                pValue[nActProp++].Value <<= pUnoFrameItem->GetFrame();
+                aSequ[sFrame] <<= pUnoFrameItem->GetFrame();
             else
                 OSL_FAIL( "TransformItems: invalid item type for 
SID_FILLFRAME!" );
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_TEMPLATE, 
false) )
         {
-            pValue[nActProp].Name = sAsTemplate;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sAsTemplate] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_OPEN_NEW_VIEW, 
false) )
         {
-            pValue[nActProp].Name = sOpenNewView;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sOpenNewView] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( 
SID_FAIL_ON_WARNING, false) )
         {
-            pValue[nActProp].Name = sFailOnWarning;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sFailOnWarning] <<= pItem->GetValue();
         }
         if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_VIEW_ID, 
false) )
         {
-            pValue[nActProp].Name = sViewId;
-            pValue[nActProp++].Value <<= 
static_cast<sal_Int16>(pItem->GetValue());
+            aSequ[sViewId] <<= static_cast<sal_Int16>(pItem->GetValue());
         }
         if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( SID_PLUGIN_MODE, 
false) )
         {
-            pValue[nActProp].Name = sPluginMode;
-            pValue[nActProp++].Value <<= 
static_cast<sal_Int16>(pItem->GetValue());
+            aSequ[sPluginMode] <<= static_cast<sal_Int16>(pItem->GetValue());
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_DOC_READONLY, 
false) )
         {
-            pValue[nActProp].Name = sReadOnly;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sReadOnly] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( 
SID_DDE_RECONNECT_ONLOAD, false) )
         {
-            pValue[nActProp].Name = sDdeReconnect;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sDdeReconnect] <<= pItem->GetValue();
         }
         if (const SfxUInt16Item* pItem = 
rSet.GetItemIfSet(SID_DOC_STARTPRESENTATION, false))
         {
-            pValue[nActProp].Name = sStartPresentation;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sStartPresentation] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SELECTION, 
false) )
         {
-            pValue[nActProp].Name = sSelectionOnly;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sSelectionOnly] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_HIDDEN, false) )
         {
-            pValue[nActProp].Name = sHidden;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sHidden] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_MINIMIZED, 
false) )
         {
-            pValue[nActProp].Name = sMinimized;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sMinimized] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_SILENT, false) )
         {
-            pValue[nActProp].Name = sSilent;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sSilent] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_PREVIEW, false) 
)
         {
-            pValue[nActProp].Name = sPreview;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sPreview] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_VIEWONLY, 
false) )
         {
-            pValue[nActProp].Name = sViewOnly;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sViewOnly] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_EDITDOC, false) 
)
         {
-            pValue[nActProp].Name = sDontEdit;
-            pValue[nActProp++].Value <<= !pItem->GetValue();
+            aSequ[sDontEdit] <<= !pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_FILE_DIALOG, 
false) )
         {
-            pValue[nActProp].Name = sUseSystemDialog;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sUseSystemDialog] <<= pItem->GetValue();
         }
         if ( const SfxStringListItem *pItem = rSet.GetItemIfSet( 
SID_DENY_LIST, false) )
         {
-            pValue[nActProp].Name = sDenyList;
-
             css::uno::Sequence< OUString > aList;
             pItem->GetStringList( aList );
-            pValue[nActProp++].Value <<= aList ;
+            aSequ[sDenyList] <<= aList;
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_TARGETNAME, 
false) )
         {
-            pValue[nActProp].Name = sFrameName;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sFrameName] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SALVAGE, 
false) )
         {
-            pValue[nActProp].Name = sSalvagedFile;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sSalvagedFile] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_PATH, false) )
         {
-            pValue[nActProp].Name = sFolderName;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sFolderName] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CONTENTTYPE, 
false) )
         {
-            pValue[nActProp].Name = sMediaType;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sMediaType] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_TEMPLATE_NAME, false) )
         {
-            pValue[nActProp].Name = sTemplateName;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sTemplateName] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_TEMPLATE_REGIONNAME, false) )
         {
-            pValue[nActProp].Name = sTemplateRegionName;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sTemplateRegionName] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_JUMPMARK, 
false) )
         {
-            pValue[nActProp].Name = sJumpMark;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sJumpMark] <<= pItem->GetValue();
         }
 
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_CHARSET, 
false) )
         {
-            pValue[nActProp].Name = sCharacterSet;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sCharacterSet] <<= pItem->GetValue();
         }
         if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( 
SID_MACROEXECMODE, false) )
         {
-            pValue[nActProp].Name = sMacroExecMode;
-            pValue[nActProp++].Value <<= 
static_cast<sal_Int16>(pItem->GetValue());
+            aSequ[sMacroExecMode] <<= 
static_cast<sal_Int16>(pItem->GetValue());
         }
         if ( const SfxUInt16Item *pItem = rSet.GetItemIfSet( 
SID_UPDATEDOCMODE, false) )
         {
-            pValue[nActProp].Name = sUpdateDocMode;
-            pValue[nActProp++].Value <<= 
static_cast<sal_Int16>(pItem->GetValue());
+            aSequ[sUpdateDocMode] <<= 
static_cast<sal_Int16>(pItem->GetValue());
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_REPAIRPACKAGE, 
false) )
         {
-            pValue[nActProp].Name = sRepairPackage;
-            pValue[nActProp++].Value <<= pItem->GetValue() ;
+            aSequ[sRepairPackage] <<= pItem->GetValue() ;
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_DOCINFO_TITLE, false) )
         {
-            pValue[nActProp].Name = sDocumentTitle;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sDocumentTitle] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_BASEURL, 
false) )
         {
-            pValue[nActProp].Name = sDocumentBaseURL;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sDocumentBaseURL] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_DOC_HIERARCHICALNAME, false) )
         {
-            pValue[nActProp].Name = sHierarchicalDocumentName;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sHierarchicalDocumentName] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( 
SID_COPY_STREAM_IF_POSSIBLE, false) )
         {
-            pValue[nActProp].Name = sCopyStreamIfPossible;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sCopyStreamIfPossible] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_NOAUTOSAVE, 
false) )
         {
-            pValue[nActProp].Name = sNoAutoSave;
-            pValue[nActProp++].Value <<= pItem->GetValue() ;
+            aSequ[sNoAutoSave] <<= pItem->GetValue() ;
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( 
SID_MODIFYPASSWORDINFO, false) )
         {
-            pValue[nActProp].Name = sModifyPasswordInfo;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sModifyPasswordInfo] = pItem->GetValue();
         }
         if ( const SfxUnoAnyItem *pItem = rSet.GetItemIfSet( 
SID_ENCRYPTIONDATA, false) )
         {
-            pValue[nActProp].Name = sEncryptionData;
-            pValue[nActProp++].Value = pItem->GetValue();
+            aSequ[sEncryptionData] = pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_SUGGESTEDSAVEASDIR, false) )
         {
-            pValue[nActProp].Name = sSuggestedSaveAsDir;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sSuggestedSaveAsDir] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_SUGGESTEDSAVEASNAME, false) )
         {
-            pValue[nActProp].Name = sSuggestedSaveAsName;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sSuggestedSaveAsName] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( 
SID_EXPORTDIRECTORY, false) )
         {
-            pValue[nActProp].Name = sExportDirectory;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sExportDirectory] <<= pItem->GetValue();
         }
         if ( const SfxStringItem *pItem = rSet.GetItemIfSet( SID_DOC_SERVICE, 
false) )
         {
-            pValue[nActProp].Name = sDocumentService;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sDocumentService] <<= pItem->GetValue();
         }
         if (const SfxStringItem *pItem = 
rSet.GetItemIfSet(SID_FILTER_PROVIDER))
         {
-            pValue[nActProp].Name = sFilterProvider;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sFilterProvider] <<= pItem->GetValue();
         }
         if (const SfxStringItem *pItem = rSet.GetItemIfSet(SID_CONVERT_IMAGES))
         {
-            pValue[nActProp].Name = sImageFilter;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sImageFilter] <<= pItem->GetValue();
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( 
SID_LOCK_CONTENT_EXTRACTION, false) )
         {
-            pValue[nActProp].Name = sLockContentExtraction;
-            pValue[nActProp++].Value <<= pItem->GetValue() ;
+            aSequ[sLockContentExtraction] <<= pItem->GetValue() ;
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EXPORT, 
false) )
         {
-            pValue[nActProp].Name = sLockExport;
-            pValue[nActProp++].Value <<= pItem->GetValue() ;
+            aSequ[sLockExport] <<= pItem->GetValue() ;
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_PRINT, 
false) )
         {
-            pValue[nActProp].Name = sLockPrint;
-            pValue[nActProp++].Value <<= pItem->GetValue() ;
+            aSequ[sLockPrint] <<= pItem->GetValue() ;
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_SAVE, 
false) )
         {
-            pValue[nActProp].Name = sLockSave;
-            pValue[nActProp++].Value <<= pItem->GetValue() ;
+            aSequ[sLockSave] <<= pItem->GetValue() ;
         }
         if ( const SfxBoolItem *pItem = rSet.GetItemIfSet( SID_LOCK_EDITDOC, 
false) )
         {
-            pValue[nActProp].Name = sLockEditDoc;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sLockEditDoc] <<= pItem->GetValue();
         }
         if (const SfxBoolItem *pItem = rSet.GetItemIfSet(SID_REPLACEABLE, 
false))
         {
-            pValue[nActProp].Name = sReplaceable;
-            pValue[nActProp++].Value <<= pItem->GetValue();
+            aSequ[sReplaceable] <<= pItem->GetValue();
         }
     }
 
-    rArgs = std::move(aSequ);
+    return aSequ;
 }
 
 void SAL_CALL FilterOptionsContinuation::setFilterOptions(
diff --git a/sfx2/source/control/request.cxx b/sfx2/source/control/request.cxx
index 58dabbbaa536..7abcd34c1479 100644
--- a/sfx2/source/control/request.cxx
+++ b/sfx2/source/control/request.cxx
@@ -598,7 +598,7 @@ void SfxRequest::Done_Impl
         uno::Sequence < beans::PropertyValue > aSeq;
 
         if ( bItemStateSet && SfxItemState::SET == eState )
-            TransformItems( pImpl->pSlot->GetSlotId(), *pSet, aSeq, 
pImpl->pSlot );
+            aSeq = TransformItems(pImpl->pSlot->GetSlotId(), *pSet, 
pImpl->pSlot).getAsConstPropertyValueList();
 
         pImpl->Record( aSeq );
     }
@@ -608,7 +608,7 @@ void SfxRequest::Done_Impl
     {
         uno::Sequence < beans::PropertyValue > aSeq;
         if ( pSet )
-            TransformItems( pImpl->pSlot->GetSlotId(), *pSet, aSeq, 
pImpl->pSlot );
+            aSeq = TransformItems(pImpl->pSlot->GetSlotId(), *pSet, 
pImpl->pSlot).getAsConstPropertyValueList();
         pImpl->Record( aSeq );
     }
 
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index 34c2709af855..1299f0a7094f 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -498,7 +498,7 @@ sal_Int16 SfxStateCache::Dispatch( const SfxItemSet* pSet, 
bool bForceSynchron )
     {
         uno::Sequence < beans::PropertyValue > aArgs;
         if (pSet)
-            TransformItems( nId, *pSet, aArgs );
+            aArgs = TransformItems(nId, *pSet).getAsConstPropertyValueList();
 
         eRet = mxDispatch->Dispatch( aArgs, bForceSynchron );
     }
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 089f249dfc6d..30a556090044 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -2931,9 +2931,7 @@ void SfxMedium::GetLockingStream_Impl()
         return;
 
     // open the original document
-    uno::Sequence< beans::PropertyValue > xProps;
-    TransformItems( SID_OPENDOC, GetItemSet(), xProps );
-    utl::MediaDescriptor aMedium( xProps );
+    utl::MediaDescriptor aMedium(TransformItems(SID_OPENDOC, 
GetItemSet()).getAsConstPropertyValueList());
 
     aMedium.addInputStreamOwnLock();
 
@@ -2984,7 +2982,6 @@ void SfxMedium::GetMedium_Impl()
     }
     else
     {
-        uno::Sequence < beans::PropertyValue > xProps;
         OUString aFileName;
         if (!pImpl->m_aName.isEmpty())
         {
@@ -3018,8 +3015,7 @@ void SfxMedium::GetMedium_Impl()
         }
         else
         {
-            TransformItems( SID_OPENDOC, GetItemSet(), xProps );
-            utl::MediaDescriptor aMedium( xProps );
+            utl::MediaDescriptor aMedium(TransformItems(SID_OPENDOC, 
GetItemSet()).getAsConstPropertyValueList());
 
             if ( pImpl->m_xLockingStream.is() && !bFromTempFile )
             {
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 9580778b3456..55798c19af1a 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1132,9 +1132,7 @@ bool ModelData_Impl::OutputFileDialog( sal_Int16 
nStoreMode,
     m_bSignWithDefaultSignature = (pSignWithDefaultKey && 
pSignWithDefaultKey->GetValue());
     pDialogParams->ClearItem( SID_GPGSIGN );
 
-    uno::Sequence< beans::PropertyValue > aPropsFromDialog;
-    TransformItems( nSlotID, *pDialogParams, aPropsFromDialog );
-    GetMediaDescr() << aPropsFromDialog;
+    GetMediaDescr() = TransformItems(nSlotID, *pDialogParams);
 
     // get the path from the dialog
     INetURLObject aURL( pFileDlg->GetPath() );
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index ca56f3b25bee..3659b5880f6c 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1125,9 +1125,8 @@ void SfxObjectShell::InitOwnModel_Impl()
         SfxItemSet& rSet = GetMedium()->GetItemSet();
         if ( !GetMedium()->IsReadOnly() )
             rSet.ClearItem( SID_INPUTSTREAM );
-        uno::Sequence< beans::PropertyValue > aArgs;
-        TransformItems( SID_OPENDOC, rSet, aArgs );
-        xModel->attachResource( GetMedium()->GetOrigURL(), aArgs );
+        comphelper::SequenceAsHashMap aArgs = TransformItems(SID_OPENDOC, 
rSet);
+        xModel->attachResource(GetMedium()->GetOrigURL(), 
aArgs.getAsConstPropertyValueList());
         impl_addToModelCollection(xModel);
     }
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index d8cc78e8122a..1bc51ff7b971 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1117,9 +1117,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
 
                 uno::Sequence< beans::PropertyValue > aDispatchArgs;
                 if ( rReq.GetArgs() )
-                    TransformItems( nId,
-                                    *rReq.GetArgs(),
-                                     aDispatchArgs );
+                    aDispatchArgs = TransformItems(nId, 
*rReq.GetArgs()).getAsConstPropertyValueList();
 
                 bool bForceSaveAs = nId == SID_SAVEDOC && IsReadOnlyMedium();
 
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 5fcc7a09790e..76eaf27b73ef 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -508,14 +508,9 @@ bool SfxObjectShell::DoInitNew()
         if ( xModel.is() )
         {
             SfxItemSet &rSet = GetMedium()->GetItemSet();
-            uno::Sequence< beans::PropertyValue > aArgs;
-            TransformItems( SID_OPENDOC, rSet, aArgs );
-            sal_Int32 nLength = aArgs.getLength();
-            aArgs.realloc( nLength + 1 );
-            auto pArgs = aArgs.getArray();
-            pArgs[nLength].Name = "Title";
-            pArgs[nLength].Value <<= GetTitle( SFX_TITLE_DETECT );
-            xModel->attachResource( OUString(), aArgs );
+            comphelper::SequenceAsHashMap aArgs = TransformItems(SID_OPENDOC, 
rSet);
+            aArgs[u"Title"_ustr] <<= GetTitle(SFX_TITLE_DETECT);
+            xModel->attachResource(OUString(), 
aArgs.getAsConstPropertyValueList());
             if (!comphelper::IsFuzzing())
                 impl_addToModelCollection(xModel);
         }
@@ -1240,8 +1235,7 @@ ErrCode SfxObjectShell::HandleFilter( SfxMedium* pMedium, 
SfxObjectShell const *
                                 if ( rSet.GetItemState( SID_FILTER_NAME ) < 
SfxItemState::SET )
                                     rSet.Put( SfxStringItem( SID_FILTER_NAME, 
pFilter->GetName() ) );
 
-                                Sequence< PropertyValue > rProperties;
-                                TransformItems( SID_OPENDOC, rSet, rProperties 
);
+                                Sequence<PropertyValue> rProperties = 
TransformItems(SID_OPENDOC, rSet).getAsConstPropertyValueList();
                                 rtl::Reference<RequestFilterOptions> 
pFORequest = new RequestFilterOptions( pDoc->GetModel(), rProperties );
 
                                 rHandler->handle( pFORequest );
@@ -2480,11 +2474,10 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* 
pNewMed, bool bRegisterRecent )
             if ( xModel.is() )
             {
                 const OUString& aURL {pNewMed->GetOrigURL()};
-                uno::Sequence< beans::PropertyValue > aMediaDescr;
-                TransformItems( SID_OPENDOC, pNewMed->GetItemSet(), 
aMediaDescr );
+                comphelper::SequenceAsHashMap aMediaDescr = 
TransformItems(SID_OPENDOC, pNewMed->GetItemSet());
                 try
                 {
-                    xModel->attachResource( aURL, aMediaDescr );
+                    xModel->attachResource(aURL, 
aMediaDescr.getAsConstPropertyValueList());
                 }
                 catch( uno::Exception& )
                 {}
@@ -2639,56 +2632,25 @@ bool SfxObjectShell::ImportFrom(SfxMedium& rMedium,
             uno::Reference< document::XImporter > xImporter( xLoader, 
uno::UNO_QUERY_THROW );
             xImporter->setTargetDocument( xComp );
 
-            uno::Sequence < beans::PropertyValue > lDescriptor;
             rMedium.GetItemSet().Put( SfxStringItem( SID_FILE_NAME, 
rMedium.GetName() ) );
-            TransformItems( SID_OPENDOC, rMedium.GetItemSet(), lDescriptor );
+            comphelper::SequenceAsHashMap aArgs = TransformItems(SID_OPENDOC, 
rMedium.GetItemSet());
 
-            css::uno::Sequence < css::beans::PropertyValue > aArgs ( 
lDescriptor.getLength() );
-            css::beans::PropertyValue * pNewValue = aArgs.getArray();
-            const css::beans::PropertyValue * pOldValue = 
lDescriptor.getConstArray();
             static constexpr OUString sInputStream ( u"InputStream"_ustr  );
 
-            bool bHasInputStream = false;
-            bool bHasBaseURL = false;
-            sal_Int32 nEnd = lDescriptor.getLength();
+            if (!aArgs.contains(sInputStream))
+                aArgs[sInputStream] <<= css::uno::Reference < 
css::io::XInputStream > ( new utl::OSeekableInputStreamWrapper ( 
*rMedium.GetInStream() ) );
 
-            for ( sal_Int32 i = 0; i < nEnd; i++ )
-            {
-                pNewValue[i] = pOldValue[i];
-                if ( pOldValue [i].Name == sInputStream )
-                    bHasInputStream = true;
-                else if ( pOldValue[i].Name == "DocumentBaseURL" )
-                    bHasBaseURL = true;
-            }
-
-            if ( !bHasInputStream )
-            {
-                aArgs.realloc ( ++nEnd );
-                auto pArgs = aArgs.getArray();
-                pArgs[nEnd-1].Name = sInputStream;
-                pArgs[nEnd-1].Value <<= css::uno::Reference < 
css::io::XInputStream > ( new utl::OSeekableInputStreamWrapper ( 
*rMedium.GetInStream() ) );
-            }
-
-            if ( !bHasBaseURL )
-            {
-                aArgs.realloc ( ++nEnd );
-                auto pArgs = aArgs.getArray();
-                pArgs[nEnd-1].Name = "DocumentBaseURL";
-                pArgs[nEnd-1].Value <<= rMedium.GetBaseURL();
-            }
+            if (!aArgs.contains(u"DocumentBaseURL"_ustr))
+                aArgs[u"DocumentBaseURL"_ustr] <<= rMedium.GetBaseURL();
 
             if (xInsertPosition.is()) {
-                aArgs.realloc( nEnd += 2 );
-                auto pArgs = aArgs.getArray();
-                pArgs[nEnd-2].Name = "InsertMode";
-                pArgs[nEnd-2].Value <<= true;
-                pArgs[nEnd-1].Name = "TextInsertModeRange";
-                pArgs[nEnd-1].Value <<= xInsertPosition;
+                aArgs[u"InsertMode"_ustr] <<= true;
+                aArgs[u"TextInsertModeRange"_ustr] <<= xInsertPosition;
             }
 
             // #i119492# During loading, some OLE objects like chart will be 
set
             // modified flag, so needs to reset the flag to false after loading
-            bool bRtn = xLoader->filter(aArgs);
+            bool bRtn = xLoader->filter(aArgs.getAsConstPropertyValueList());
             const uno::Sequence < OUString > aNames = 
GetEmbeddedObjectContainer().GetObjectNames();
             for ( const auto& rName : aNames )
             {
@@ -2820,12 +2782,10 @@ bool SfxObjectShell::ExportTo( SfxMedium& rMedium )
         uno::Reference< document::XFilter > xFilter( xExporter, 
uno::UNO_QUERY_THROW );
         xExporter->setSourceDocument( xComp );
 
-        css::uno::Sequence < css::beans::PropertyValue > aOldArgs;
         SfxItemSet& rItems = rMedium.GetItemSet();
-        TransformItems( SID_SAVEASDOC, rItems, aOldArgs );
 
         // put in the REAL file name, and copy all PropertyValues
-        comphelper::SequenceAsHashMap aNewArgs(aOldArgs);
+        comphelper::SequenceAsHashMap aNewArgs = TransformItems(SID_SAVEASDOC, 
rItems);
         comphelper::SequenceAsHashMap aMediumArgs(rMedium.GetArgs());
 
         if (aNewArgs.contains(u"FileName"_ustr))
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 71b372ca4b5e..f5a54ee8ddfa 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -1048,8 +1048,7 @@ SfxObjectShell* SfxObjectShell::CreateObject( const 
OUString& rServiceName, SfxO
 
 Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const 
SfxItemSet& rSet )
 {
-    uno::Sequence < beans::PropertyValue > aProps;
-    TransformItems( SID_OPENDOC, rSet, aProps );
+    comphelper::SequenceAsHashMap aProps = TransformItems(SID_OPENDOC, rSet);
     const SfxStringItem* pFileNameItem = 
rSet.GetItem<SfxStringItem>(SID_FILE_NAME, false);
     const SfxStringItem* pTargetItem = 
rSet.GetItem<SfxStringItem>(SID_TARGETNAME, false);
     OUString aURL;
@@ -1065,7 +1064,7 @@ Reference<lang::XComponent> 
SfxObjectShell::CreateAndLoadComponent( const SfxIte
     Reference <lang::XComponent> xComp;
     try
     {
-        xComp = xLoader->loadComponentFromURL(aURL, aTarget, 0, aProps);
+        xComp = xLoader->loadComponentFromURL(aURL, aTarget, 0, 
aProps.getAsConstPropertyValueList());
     }
     catch (const uno::Exception&)
     {
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 671ddf6c2180..1cac84790f4f 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1006,19 +1006,15 @@ Sequence< beans::PropertyValue > SAL_CALL 
SfxBaseModel::getArgs2(const Sequence<
 
     if ( m_pData->m_pObjectShell.is() )
     {
-        Sequence< beans::PropertyValue > seqArgsNew;
-        Sequence< beans::PropertyValue > seqArgsOld;
         SfxAllItemSet aSet( m_pData->m_pObjectShell->GetPool() );
 
         // we need to know which properties are supported by the transformer
         // hopefully it is a temporary solution, I guess nonconvertable 
properties
         // should not be supported so then there will be only ItemSet from 
medium
 
-        TransformItems( SID_OPENDOC, 
m_pData->m_pObjectShell->GetMedium()->GetItemSet(), seqArgsNew );
+        comphelper::SequenceAsHashMap seqArgsNew = TransformItems(SID_OPENDOC, 
m_pData->m_pObjectShell->GetMedium()->GetItemSet());
         TransformParameters( SID_OPENDOC, m_pData->m_seqArguments, aSet );
-        TransformItems( SID_OPENDOC, aSet, seqArgsOld );
-
-        sal_Int32 nNewLength = seqArgsNew.getLength();
+        comphelper::SequenceAsHashMap seqArgsOld = TransformItems(SID_OPENDOC, 
aSet);
 
         if (requestedArgs.empty() || requestedArgs.count(u"WinExtent"))
         {
@@ -1036,20 +1032,14 @@ Sequence< beans::PropertyValue > SAL_CALL 
SfxBaseModel::getArgs2(const Sequence<
                 o3tl::narrowing<int>(aTmpRect.IsHeightEmpty() ? aTmpRect.Top() 
: aTmpRect.Bottom())
             };
 
-            seqArgsNew.realloc( ++nNewLength );
-            auto pseqArgsNew = seqArgsNew.getArray();
-            pseqArgsNew[ nNewLength - 1 ].Name = "WinExtent";
-            pseqArgsNew[ nNewLength - 1 ].Value <<= aRectSeq;
+            seqArgsNew[u"WinExtent"_ustr] <<= aRectSeq;
         }
 
         if (requestedArgs.empty() || requestedArgs.count(u"PreusedFilterName"))
         {
             if ( !m_pData->m_aPreusedFilterName.isEmpty() )
             {
-                seqArgsNew.realloc( ++nNewLength );
-                auto pseqArgsNew = seqArgsNew.getArray();
-                pseqArgsNew[ nNewLength - 1 ].Name = "PreusedFilterName";
-                pseqArgsNew[ nNewLength - 1 ].Value <<= 
m_pData->m_aPreusedFilterName;
+                seqArgsNew[u"PreusedFilterName"_ustr] <<= 
m_pData->m_aPreusedFilterName;
             }
         }
 
@@ -1068,10 +1058,7 @@ Sequence< beans::PropertyValue > SAL_CALL 
SfxBaseModel::getArgs2(const Sequence<
                     o3tl::narrowing<int>(aBorder.Bottom())
                 };
 
-                seqArgsNew.realloc( ++nNewLength );
-                auto pseqArgsNew = seqArgsNew.getArray();
-                pseqArgsNew[ nNewLength - 1 ].Name = "DocumentBorder";
-                pseqArgsNew[ nNewLength - 1 ].Value <<= aBorderSeq;
+                seqArgsNew[u"DocumentBorder"_ustr] <<= aBorderSeq;
             }
         }
 
@@ -1083,15 +1070,12 @@ Sequence< beans::PropertyValue > SAL_CALL 
SfxBaseModel::getArgs2(const Sequence<
 
             for (const auto& rOrg : m_pData->m_seqArguments)
             {
-                auto bNew = std::none_of(std::cbegin(seqArgsOld), 
std::cend(seqArgsOld),
-                    [&rOrg](const beans::PropertyValue& rOld){ return 
rOld.Name == rOrg.Name; });
-                if ( bNew )
+                if (!seqArgsOld.contains(rOrg.Name))
                 {
                     // the entity with this name should be new for seqArgsNew
                     // since it is not supported by transformer
 
-                    seqArgsNew.realloc( ++nNewLength );
-                    seqArgsNew.getArray()[ nNewLength - 1 ] = rOrg;
+                    seqArgsNew[rOrg.Name] = rOrg.Value;
 
                     aFinalCache.realloc( ++nFinalLength );
                     aFinalCache.getArray()[ nFinalLength - 1 ] = rOrg;
@@ -1101,7 +1085,7 @@ Sequence< beans::PropertyValue > SAL_CALL 
SfxBaseModel::getArgs2(const Sequence<
             m_pData->m_seqArguments = std::move(aFinalCache);
         }
 
-        return seqArgsNew;
+        return seqArgsNew.getAsConstPropertyValueList();
     }
 
     return m_pData->m_seqArguments;
@@ -1788,9 +1772,8 @@ void SAL_CALL SfxBaseModel::storeAsURL( const   OUString& 
                  rURL
         impl_store(rURL, rArgs, false);
     }
 
-    Sequence< beans::PropertyValue > aSequence ;
-    TransformItems( SID_OPENDOC, 
m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aSequence );
-    attachResource( rURL, aSequence );
+    comphelper::SequenceAsHashMap aSequence = TransformItems(SID_OPENDOC, 
m_pData->m_pObjectShell->GetMedium()->GetItemSet());
+    attachResource(rURL, aSequence.getAsConstPropertyValueList());
 
     loadCmisProperties( );
 
@@ -2672,9 +2655,8 @@ void SAL_CALL SfxBaseModel::checkOut(  )
         m_pData->m_pObjectShell->GetMedium( )->SetName( sURL );
         m_pData->m_pObjectShell->GetMedium( )->GetMedium_Impl( );
         m_pData->m_xDocumentProperties->setTitle( getTitle( ) );
-        Sequence< beans::PropertyValue > aSequence ;
-        TransformItems( SID_OPENDOC, pMedium->GetItemSet(), aSequence );
-        attachResource( sURL, aSequence );
+        comphelper::SequenceAsHashMap aSequence = TransformItems(SID_OPENDOC, 
pMedium->GetItemSet());
+        attachResource(sURL, aSequence.getAsConstPropertyValueList());
 
         // Reload the CMIS properties
         loadCmisProperties( );
@@ -2738,9 +2720,8 @@ void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, 
const OUString& rMessage
         if ( sName != sNewName )
         {
             m_pData->m_xDocumentProperties->setTitle( getTitle( ) );
-            Sequence< beans::PropertyValue > aSequence ;
-            TransformItems( SID_OPENDOC, pMedium->GetItemSet(), aSequence );
-            attachResource( sNewName, aSequence );
+            comphelper::SequenceAsHashMap aSequence = 
TransformItems(SID_OPENDOC, pMedium->GetItemSet());
+            attachResource(sNewName, aSequence.getAsConstPropertyValueList());
 
             // Reload the CMIS properties
             loadCmisProperties( );
@@ -2982,8 +2963,8 @@ void SfxBaseModel::Notify(          SfxBroadcaster& rBC   
  ,
         {
             m_pData->m_sURL = m_pData->m_pObjectShell->GetMedium()->GetName();
 
-            Sequence< beans::PropertyValue > aArgs;
-            TransformItems( SID_SAVEASDOC, 
m_pData->m_pObjectShell->GetMedium()->GetItemSet(), aArgs );
+            Sequence<beans::PropertyValue> aArgs
+                = TransformItems(SID_SAVEASDOC, 
m_pData->m_pObjectShell->GetMedium()->GetItemSet()).getAsConstPropertyValueList();
             addTitle_Impl( aArgs, m_pData->m_pObjectShell->GetTitle() );
             attachResource( m_pData->m_pObjectShell->GetMedium()->GetName(), 
aArgs );
         }
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index 78f897dd2373..62f8da42f865 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -237,16 +237,11 @@ SfxFrame* SfxFrame::CreateHidden( SfxObjectShell const & 
rDoc, vcl::Window& rWin
             xFrame->activate();
 
         // create load arguments
-        Sequence< PropertyValue > aLoadArgs;
-        TransformItems( SID_OPENDOC, rDoc.GetMedium()->GetItemSet(), aLoadArgs 
);
-
-        ::comphelper::NamedValueCollection aArgs( aLoadArgs );
-        aArgs.put( u"Model"_ustr, rDoc.GetModel() );
-        aArgs.put( u"Hidden"_ustr, true );
+        comphelper::SequenceAsHashMap aArgs = TransformItems(SID_OPENDOC, 
rDoc.GetMedium()->GetItemSet());
+        aArgs[u"Model"_ustr] <<= rDoc.GetModel();
+        aArgs[u"Hidden"_ustr] <<= true;
         if ( nViewId != SFX_INTERFACE_NONE )
-            aArgs.put( u"ViewId"_ustr, static_cast<sal_uInt16>(nViewId) );
-
-        aLoadArgs = aArgs.getPropertyValues();
+            aArgs[u"ViewId"_ustr] <<= static_cast<sal_uInt16>(nViewId);
 
         // load the doc into that frame
         Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW );
@@ -254,7 +249,7 @@ SfxFrame* SfxFrame::CreateHidden( SfxObjectShell const & 
rDoc, vcl::Window& rWin
             u"private:object"_ustr,
             u"_self"_ustr,
             0,
-            aLoadArgs
+            aArgs.getAsConstPropertyValueList()
         );
 
         for (   pFrame = SfxFrame::GetFirst();
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 977c2e928f43..83c18f7a58da 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -804,12 +804,11 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                 if ( xOldObj->IsModifyPasswordEntered() )
                     xNewObj->SetModifyPasswordEntered();
 
-                uno::Sequence < beans::PropertyValue > aLoadArgs;
-                TransformItems( SID_OPENDOC, *pNewSet, aLoadArgs );
+                comphelper::SequenceAsHashMap aLoadArgs = 
TransformItems(SID_OPENDOC, *pNewSet);
                 try
                 {
                     uno::Reference < frame::XLoadable > xLoad( 
xNewObj->GetModel(), uno::UNO_QUERY );
-                    xLoad->load( aLoadArgs );
+                    xLoad->load(aLoadArgs.getAsConstPropertyValueList());
                 }
                 catch ( uno::Exception& )
                 {
@@ -853,7 +852,7 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
                     // the Reload and Silent items were only temporary, remove 
them
                     xNewObj->GetMedium()->GetItemSet().ClearItem( SID_RELOAD );
                     xNewObj->GetMedium()->GetItemSet().ClearItem( SID_SILENT );
-                    TransformItems( SID_OPENDOC, 
xNewObj->GetMedium()->GetItemSet(), aLoadArgs );
+                    aLoadArgs = TransformItems(SID_OPENDOC, 
xNewObj->GetMedium()->GetItemSet());
 
                     UpdateDocument_Impl();
 
@@ -872,9 +871,10 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
 
                     try
                     {
+                        const auto aArgs = 
aLoadArgs.getAsConstPropertyValueList();
                         for (auto const& viewFrame : aViewFrames)
                         {
-                            LoadViewIntoFrame_Impl( *xNewObj, viewFrame.first, 
aLoadArgs, viewFrame.second, false );
+                            LoadViewIntoFrame_Impl(*xNewObj, viewFrame.first, 
aArgs, viewFrame.second, false);
                         }
                         aViewFrames.clear();
                     }
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index a49a4d9d90c7..884e1bec9364 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -696,7 +696,7 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
             if ( pSelectItem && rReq.GetArgs()->Count() == 1 )
                 bIsAPI = false;
 
-            uno::Sequence < beans::PropertyValue > aProps;
+            comphelper::SequenceAsHashMap aProps;
             if ( bIsAPI )
             {
                 // supported properties:
@@ -711,41 +711,28 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
                 // bool Collate
                 // bool Silent
 
-                // the TransformItems function overwrite aProps
-                TransformItems( nId, *rReq.GetArgs(), aProps, 
GetInterface()->GetSlot(nId) );
+                aProps = TransformItems(nId, *rReq.GetArgs(), 
GetInterface()->GetSlot(nId));
 
-                for ( auto& rProp : asNonConstRange(aProps) )
+                if (aProps.contains(u"Copies"_ustr))
                 {
-                    if ( rProp.Name == "Copies" )
-                    {
-                        rProp.Name = "CopyCount";
-                    }
-                    else if ( rProp.Name == "RangeText" )
-                    {
-                        rProp.Name = "Pages";
-                    }
-                    else if ( rProp.Name == "Asynchron" )
-                    {
-                        rProp.Name = "Wait";
-                        bool bAsynchron = false;
-                        rProp.Value >>= bAsynchron;
-                        rProp.Value <<= !bAsynchron;
-                    }
-                    else if ( rProp.Name == "Silent" )
-                    {
-                        rProp.Name = "MonitorVisible";
-                        bool bPrintSilent = false;
-                        rProp.Value >>= bPrintSilent;
-                        rProp.Value <<= !bPrintSilent;
-                    }
+                    aProps[u"CopyCount"_ustr] = aProps[u"Copies"_ustr];
+                }
+
+                if (aProps.contains(u"RangeText"_ustr))
+                {
+                    aProps[u"Pages"_ustr] = aProps[u"RangeText"_ustr];
+                }
+
+                if (aProps.contains(u"Asynchron"_ustr))
+                {
+                    aProps[u"Wait"_ustr] <<= 
!aProps.getUnpackedValueOrDefault(u"Asynchron"_ustr, false);
                 }
-            }
 
-            // we will add the "PrintSelectionOnly" or "HideHelpButton" 
properties
-            // we have to increase the capacity of aProps
-            sal_Int32 nLen = aProps.getLength();
-            aProps.realloc( nLen + 1 );
-            auto pProps = aProps.getArray();
+                if (aProps.contains(u"Silent"_ustr))
+                {
+                    aProps[u"MonitorVisible"_ustr] <<= 
!aProps.getUnpackedValueOrDefault(u"Silent"_ustr, false);
+                }
+            }
 
             // HACK: writer sets the SID_SELECTION item when printing directly 
and expects
             // to get only the selection document in that case (see 
getSelectionObject)
@@ -754,17 +741,15 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
             // it would be better if writer handled this internally
             if( nId == SID_PRINTDOCDIRECT )
             {
-                pProps[nLen].Name = "PrintSelectionOnly";
-                pProps[nLen].Value <<= bSelection;
+                aProps[u"PrintSelectionOnly"_ustr] <<= bSelection;
             }
             else // if nId == SID_PRINTDOC ; nothing to do with the previous 
HACK
             {
                 // should the printer selection and properties dialogue 
display an help button
-                pProps[nLen].Name = "HideHelpButton";
-                pProps[nLen].Value <<= bPrintOnHelp;
+                aProps[u"HideHelpButton"_ustr] <<= bPrintOnHelp;
             }
 
-            ExecPrint( aProps, bIsAPI, (nId == SID_PRINTDOCDIRECT) );
+            ExecPrint(aProps.getAsConstPropertyValueList(), bIsAPI, (nId == 
SID_PRINTDOCDIRECT));
 
             // FIXME: Recording
             rReq.Done();
diff --git a/svx/source/form/fmtextcontrolshell.cxx 
b/svx/source/form/fmtextcontrolshell.cxx
index b006a3faacd6..7877e460ad2c 100644
--- a/svx/source/form/fmtextcontrolshell.cxx
+++ b/svx/source/form/fmtextcontrolshell.cxx
@@ -668,11 +668,10 @@ namespace svx
 
                     if ( bFound )
                     {
-                        Sequence< PropertyValue > aArgs;
                         // temporarily put the modified item into a "clean" 
set,
                         // and let TransformItems calc the respective UNO 
parameters
                         xPureItems->Put( *pModifiedItem );
-                        TransformItems( nSlotForItemSet, *xPureItems, aArgs );
+                        Sequence<PropertyValue> aArgs = 
TransformItems(nSlotForItemSet, *xPureItems).getAsConstPropertyValueList();
                         xPureItems->ClearItem( nWhich );
 
                         if  (   ( nSlotForItemSet == 
SID_ATTR_PARA_HANGPUNCTUATION )
@@ -850,9 +849,8 @@ namespace svx
                     }
                 }
 
-                Sequence< PropertyValue > aArguments;
-                TransformItems( nSlot, aToggled, aArguments );
-                aFeaturePos->second->dispatch( aArguments );
+                comphelper::SequenceAsHashMap aArguments = 
TransformItems(nSlot, aToggled);
+                
aFeaturePos->second->dispatch(aArguments.getAsConstPropertyValueList());
             }
             break;
 
@@ -868,7 +866,7 @@ namespace svx
                 const SfxItemSet* pArgs = _rReq.GetArgs();
                 Sequence< PropertyValue > aArgs;
                 if ( pArgs )
-                    TransformItems( nSlot, *pArgs, aArgs );
+                    aArgs = TransformItems(nSlot, 
*pArgs).getAsConstPropertyValueList();
                 aFeaturePos->second->dispatch( aArgs );
             }
             break;

Reply via email to