From 3f7f497192deb486b1b959996c14f8f094146945 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 16 Feb 2016 19:58:33 +0200 Subject: sequence->vector in framework Change-Id: I457c3da4f4a31f58d688dcd96a2ccfc36518490d Reviewed-on: https://gerrit.libreoffice.org/23692 Tested-by: Jenkins Reviewed-by: Noel Grandin --- framework/inc/helper/ocomponentaccess.hxx | 5 +- framework/inc/helper/ocomponentenumeration.hxx | 7 +-- framework/inc/jobs/jobdata.hxx | 10 ++-- framework/inc/jobs/jobresult.hxx | 6 +-- framework/source/dispatch/closedispatcher.cxx | 8 ++-- .../source/dispatch/startmoduledispatcher.cxx | 7 +-- framework/source/fwe/classes/framelistanalyzer.cxx | 12 ++--- framework/source/fwe/helper/configimporter.cxx | 6 +-- framework/source/helper/ocomponentaccess.cxx | 12 ++--- framework/source/helper/ocomponentenumeration.cxx | 6 +-- framework/source/jobs/job.cxx | 7 +-- framework/source/jobs/jobdata.cxx | 35 +++++++------- framework/source/jobs/jobdispatch.cxx | 4 +- framework/source/jobs/jobexecutor.cxx | 6 +-- framework/source/jobs/jobresult.cxx | 9 ++-- framework/source/loadenv/loadenv.cxx | 2 +- framework/source/services/frame.cxx | 4 +- .../moduleuiconfigurationmanager.cxx | 6 +-- .../uiconfiguration/uiconfigurationmanager.cxx | 7 +-- .../uiconfiguration/windowstateconfiguration.cxx | 55 +++++++++++----------- include/framework/configimporter.hxx | 3 +- include/framework/framelistanalyzer.hxx | 7 +-- sfx2/source/doc/sfxbasemodel.cxx | 4 +- 23 files changed, 112 insertions(+), 116 deletions(-) diff --git a/framework/inc/helper/ocomponentaccess.hxx b/framework/inc/helper/ocomponentaccess.hxx index f4992706c5d6..9f7c88d6e679 100644 --- a/framework/inc/helper/ocomponentaccess.hxx +++ b/framework/inc/helper/ocomponentaccess.hxx @@ -33,6 +33,7 @@ #include #include +#include namespace framework{ @@ -142,8 +143,8 @@ class OComponentAccess : public ::cppu::WeakImplHelper< css::container::XEnum and must collect all information. *//*-*****************************************************************************************************/ - void impl_collectAllChildComponents( const css::uno::Reference< css::frame::XFramesSupplier >& xNode , - css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + void impl_collectAllChildComponents( const css::uno::Reference< css::frame::XFramesSupplier >& xNode , + std::vector< css::uno::Reference< css::lang::XComponent > >& seqComponents ); /*-**************************************************************************************************** @short get the component of a frame diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx index e3825372eb76..8e0c144ff002 100644 --- a/framework/inc/helper/ocomponentenumeration.hxx +++ b/framework/inc/helper/ocomponentenumeration.hxx @@ -29,6 +29,7 @@ #include #include +#include namespace framework{ @@ -66,7 +67,7 @@ class OComponentEnumeration : public ::cppu::WeakImplHelper< css::container::X @onerror Do nothing and reset this object to default with an empty list. *//*-*****************************************************************************************************/ - OComponentEnumeration( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + OComponentEnumeration( const std::vector< css::uno::Reference< css::lang::XComponent > >& seqComponents ); // XEventListener @@ -160,8 +161,8 @@ class OComponentEnumeration : public ::cppu::WeakImplHelper< css::container::X private: - sal_uInt32 m_nPosition; /// current position in enumeration - css::uno::Sequence< css::uno::Reference< css::lang::XComponent > > m_seqComponents; /// list of current components + sal_uInt32 m_nPosition; /// current position in enumeration + std::vector< css::uno::Reference< css::lang::XComponent > > m_seqComponents; /// list of current components }; // class OComponentEnumeration diff --git a/framework/inc/jobs/jobdata.hxx b/framework/inc/jobs/jobdata.hxx index d60256fe6ae4..e49716b7e392 100644 --- a/framework/inc/jobs/jobdata.hxx +++ b/framework/inc/jobs/jobdata.hxx @@ -163,7 +163,7 @@ class JobData job specific configuration items ... unknown for us! It's readed from the configuration. Don't set it from outside! */ - css::uno::Sequence< css::beans::NamedValue > m_lArguments; + std::vector< css::beans::NamedValue > m_lArguments; /** after a job was successfully executed (by any outside code using our @@ -190,7 +190,7 @@ class JobData OUString getService () const; OUString getEvent () const; css::uno::Sequence< css::beans::NamedValue > getConfig () const; - css::uno::Sequence< css::beans::NamedValue > getJobConfig () const; + std::vector< css::beans::NamedValue > getJobConfig () const; bool hasConfig () const; bool hasCorrectContext ( const OUString& rModuleIdent ) const; @@ -200,12 +200,12 @@ class JobData void setService ( const OUString& sService ); void setEvent ( const OUString& sEvent , const OUString& sAlias ); - void setJobConfig ( const css::uno::Sequence< css::beans::NamedValue >& lArguments ); + void setJobConfig ( const std::vector< css::beans::NamedValue >& lArguments ); void setResult ( const JobResult& aResult ); void disableJob ( ); - static css::uno::Sequence< OUString > getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, - const OUString& sEvent ); + static std::vector< OUString > getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, + const OUString& sEvent ); static void appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const OUString& sEvent , diff --git a/framework/inc/jobs/jobresult.hxx b/framework/inc/jobs/jobresult.hxx index 89ebaa84520e..c4d515bd1c51 100644 --- a/framework/inc/jobs/jobresult.hxx +++ b/framework/inc/jobs/jobresult.hxx @@ -83,7 +83,7 @@ class JobResult write it to the configuration. But that's part of any user of us. We provide this information here only. */ - css::uno::Sequence< css::beans::NamedValue > m_lArguments; + std::vector< css::beans::NamedValue > m_lArguments; /** an executed job can force his deactivation @@ -112,8 +112,8 @@ class JobResult void operator=( const JobResult& rCopy ); bool existPart ( sal_uInt32 eParts ) const; - css::uno::Sequence< css::beans::NamedValue > getArguments ( ) const; - css::frame::DispatchResultEvent getDispatchResult( ) const; + std::vector< css::beans::NamedValue > getArguments ( ) const; + css::frame::DispatchResultEvent getDispatchResult( ) const; }; } // namespace framework diff --git a/framework/source/dispatch/closedispatcher.cxx b/framework/source/dispatch/closedispatcher.cxx index 02f0dee1dfa8..f2de64773fa6 100644 --- a/framework/source/dispatch/closedispatcher.cxx +++ b/framework/source/dispatch/closedispatcher.cxx @@ -322,7 +322,7 @@ IMPL_LINK_NOARG_TYPED(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) // c1) there is as minimum 1 frame open, which is visible and contains a document // different from our one. And its not the help! // => close our frame only - nothing else. - if (aCheck2.m_lOtherVisibleFrames.getLength()>0) + if (!aCheck2.m_lOtherVisibleFrames.empty()) bCloseFrame = true; else @@ -332,7 +332,7 @@ IMPL_LINK_NOARG_TYPED(CloseDispatcher, impl_asyncCallback, LinkParamNone*, void) // close the frame. if ( (!bCloseAllViewsToo ) && - (aCheck2.m_lModelFrames.getLength() > 0) + (!aCheck2.m_lModelFrames.empty()) ) bCloseFrame = true; @@ -443,8 +443,8 @@ bool CloseDispatcher::implts_prepareFrameForClosing(const css::uno::Reference< c css::uno::Reference< css::frame::XFramesSupplier > xDesktop( css::frame::Desktop::create( xContext ), css::uno::UNO_QUERY_THROW); FrameListAnalyzer aCheck(xDesktop, xFrame, FrameListAnalyzer::E_ALL); - sal_Int32 c = aCheck.m_lModelFrames.getLength(); - sal_Int32 i = 0; + size_t c = aCheck.m_lModelFrames.size(); + size_t i = 0; for (i=0; igetCount(); - m_lOtherVisibleFrames.realloc(nCount); - m_lOtherHiddenFrames.realloc(nCount); - m_lModelFrames.realloc(nCount); + m_lOtherVisibleFrames.resize(nCount); + m_lOtherHiddenFrames.resize(nCount); + m_lModelFrames.resize(nCount); // ask for the model of the given reference frame. // It must be compared with the model of every frame of the container @@ -258,9 +258,9 @@ void FrameListAnalyzer::impl_analyze() // Pack both lists by using the actual step positions. // All empty or ignorable items should exist at the end of these lists // behind the position pointers. So they will be removed by a reallocation. - m_lOtherVisibleFrames.realloc(nVisibleStep); - m_lOtherHiddenFrames.realloc(nHiddenStep); - m_lModelFrames.realloc(nModelStep); + m_lOtherVisibleFrames.resize(nVisibleStep); + m_lOtherHiddenFrames.resize(nHiddenStep); + m_lModelFrames.resize(nModelStep); } } // namespace framework diff --git a/framework/source/fwe/helper/configimporter.cxx b/framework/source/fwe/helper/configimporter.cxx index e1306991259d..27c98497550a 100644 --- a/framework/source/fwe/helper/configimporter.cxx +++ b/framework/source/fwe/helper/configimporter.cxx @@ -30,7 +30,7 @@ namespace framework bool UIConfigurationImporterOOo1x::ImportCustomToolbars( const uno::Reference< ui::XUIConfigurationManager2 >& rContainerFactory, - uno::Sequence< uno::Reference< container::XIndexContainer > >& rSeqContainer, + std::vector< uno::Reference< container::XIndexContainer > >& rSeqContainer, const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< embed::XStorage >& rToolbarStorage ) { @@ -57,9 +57,7 @@ bool UIConfigurationImporterOOo1x::ImportCustomToolbars( uno::Reference< container::XIndexContainer > xContainer = rContainerFactory->createSettings(); if ( ToolBoxConfiguration::LoadToolBox( rxContext, xInputStream, xContainer )) { - sal_uInt32 nIndex = rSeqContainer.getLength(); - rSeqContainer.realloc( nIndex+1 ); - rSeqContainer[nIndex] = xContainer; + rSeqContainer.push_back( xContainer ); bResult = true; } } diff --git a/framework/source/helper/ocomponentaccess.cxx b/framework/source/helper/ocomponentaccess.cxx index 68c7f58e05ff..6b13cecfe032 100644 --- a/framework/source/helper/ocomponentaccess.cxx +++ b/framework/source/helper/ocomponentaccess.cxx @@ -65,7 +65,7 @@ css::uno::Reference< XEnumeration > SAL_CALL OComponentAccess::createEnumeration // Initialize a new enumeration ... if some tasks and his components exist! // (OTasksEnumeration will make an assert, if we initialize the new instance without valid values!) - Sequence< css::uno::Reference< XComponent > > seqComponents; + std::vector< css::uno::Reference< XComponent > > seqComponents; impl_collectAllChildComponents( css::uno::Reference< XFramesSupplier >( xLock, UNO_QUERY ), seqComponents ); OComponentEnumeration* pEnumeration = new OComponentEnumeration( seqComponents ); xReturn.set( static_cast(pEnumeration), UNO_QUERY ); @@ -104,8 +104,8 @@ sal_Bool SAL_CALL OComponentAccess::hasElements() throw( RuntimeException, std:: } -void OComponentAccess::impl_collectAllChildComponents( const css::uno::Reference< XFramesSupplier >& xNode , - Sequence< css::uno::Reference< XComponent > >& seqComponents ) +void OComponentAccess::impl_collectAllChildComponents( const css::uno::Reference< XFramesSupplier >& xNode , + std::vector< css::uno::Reference< XComponent > >& seqComponents ) { // If valid node was given ... if( xNode.is() ) @@ -115,8 +115,6 @@ void OComponentAccess::impl_collectAllChildComponents( const css::uno::Refere // Get the container of current node, collect the components of existing child frames // and go down to next level in tree (recursive!). - sal_Int32 nComponentCount = seqComponents.getLength(); - const css::uno::Reference< XFrames > xContainer = xNode->getFrames(); const Sequence< css::uno::Reference< XFrame > > seqFrames = xContainer->queryFrames( FrameSearchFlag::CHILDREN ); @@ -126,9 +124,7 @@ void OComponentAccess::impl_collectAllChildComponents( const css::uno::Refere css::uno::Reference< XComponent > xComponent = impl_getFrameComponent( seqFrames[nFrame] ); if( xComponent.is() ) { - nComponentCount++; - seqComponents.realloc( nComponentCount ); - seqComponents[nComponentCount-1] = xComponent; + seqComponents.push_back( xComponent ); } } } diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx index dce0ead90d00..9f4768c26b2f 100644 --- a/framework/source/helper/ocomponentenumeration.cxx +++ b/framework/source/helper/ocomponentenumeration.cxx @@ -31,7 +31,7 @@ using namespace ::osl; // constructor -OComponentEnumeration::OComponentEnumeration( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) +OComponentEnumeration::OComponentEnumeration( const std::vector< css::uno::Reference< XComponent > >& seqComponents ) : m_nPosition ( 0 ) // 0 is the first position for a valid list and the right value for an invalid list to! , m_seqComponents ( seqComponents ) {} @@ -67,7 +67,7 @@ sal_Bool SAL_CALL OComponentEnumeration::hasMoreElements() throw( RuntimeExcepti // => The last one is getLength() - 1! // m_nPosition's current value is the position for the next element, which will be return, if user call "nextElement()" // => We have more elements if current position less then the length of the list! - return ( m_nPosition < (sal_uInt32)(m_seqComponents.getLength()) ); + return ( m_nPosition < (sal_uInt32)(m_seqComponents.size()) ); } // XEnumeration @@ -105,7 +105,7 @@ void OComponentEnumeration::impl_resetObject() // I can't say, which one is the first. Normally the disposing-call - but other way .... // Delete list of components. - m_seqComponents.realloc( 0 ); + m_seqComponents.clear(); // Reset position in list. // The list has no elements anymore. m_nPosition is normally the current position in list for nextElement! // But a position of 0 in a list of 0 items is an invalid state. This constellation can't work in future. diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 8980495651b2..527c4545c5da 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -364,7 +365,7 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c // Means: if this job has any configuration data. Note: only really // filled lists will be set to the return structure at the end of this method. css::uno::Sequence< css::beans::NamedValue > lConfigArgs; - css::uno::Sequence< css::beans::NamedValue > lJobConfigArgs; + std::vector< css::beans::NamedValue > lJobConfigArgs; if (eMode==JobData::E_ALIAS || eMode==JobData::E_EVENT) { lConfigArgs = m_aJobCfg.getConfig(); @@ -382,12 +383,12 @@ css::uno::Sequence< css::beans::NamedValue > Job::impl_generateJobArgs( /*IN*/ c lAllArgs[nLength].Name = "Config"; lAllArgs[nLength].Value <<= lConfigArgs; } - if (lJobConfigArgs.getLength()>0) + if (!lJobConfigArgs.empty()) { sal_Int32 nLength = lAllArgs.getLength(); lAllArgs.realloc(nLength+1); lAllArgs[nLength].Name = "JobConfig"; - lAllArgs[nLength].Value <<= lJobConfigArgs; + lAllArgs[nLength].Value <<= comphelper::containerToSequence(lJobConfigArgs); } if (lEnvArgs.getLength()>0) { diff --git a/framework/source/jobs/jobdata.cxx b/framework/source/jobs/jobdata.cxx index 14f4ddc6f6e1..c3b453d83691 100644 --- a/framework/source/jobs/jobdata.cxx +++ b/framework/source/jobs/jobdata.cxx @@ -151,7 +151,7 @@ void JobData::setAlias( const OUString& sAlias ) { css::uno::Sequence< OUString > lArgumentNames = xArgumentList->getElementNames(); sal_Int32 nCount = lArgumentNames.getLength(); - m_lArguments.realloc(nCount); + m_lArguments.resize(nCount); for (sal_Int32 i=0; i& lArguments ) +void JobData::setJobConfig( const std::vector< css::beans::NamedValue >& lArguments ) { SolarMutexGuard g; @@ -246,7 +246,7 @@ void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& css::uno::Reference< css::beans::XMultiHierarchicalPropertySet > xArgumentList(aConfig.cfg(), css::uno::UNO_QUERY); if (xArgumentList.is()) { - sal_Int32 nCount = m_lArguments.getLength(); + sal_Int32 nCount = m_lArguments.size(); css::uno::Sequence< OUString > lNames (nCount); css::uno::Sequence< css::uno::Any > lValues(nCount); @@ -350,7 +350,7 @@ OUString JobData::getEvent() const return m_sEvent; } -css::uno::Sequence< css::beans::NamedValue > JobData::getJobConfig() const +std::vector< css::beans::NamedValue > JobData::getJobConfig() const { SolarMutexGuard g; return m_lArguments; @@ -471,9 +471,9 @@ void JobData::appendEnabledJobsForEvent( const css::uno::Reference< css::uno::XC const OUString& sEvent , ::std::vector< JobData::TJob2DocEventBinding >& lJobs ) { - css::uno::Sequence< OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(rxContext, sEvent); - sal_Int32 c = lAdditionalJobs.getLength(); - sal_Int32 i = 0; + std::vector< OUString > lAdditionalJobs = JobData::getEnabledJobsForEvent(rxContext, sEvent); + sal_Int32 c = lAdditionalJobs.size(); + sal_Int32 i = 0; for (i=0; i JobData::getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, +std::vector< OUString > JobData::getEnabledJobsForEvent( const css::uno::Reference< css::uno::XComponentContext >& rxContext, const OUString& sEvent ) { // create a config access to "/org.openoffice.Office.Jobs/Events" ConfigAccess aConfig(rxContext, "/org.openoffice.Office.Jobs/Events"); aConfig.open(ConfigAccess::E_READONLY); if (aConfig.getMode()==ConfigAccess::E_CLOSED) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); css::uno::Reference< css::container::XHierarchicalNameAccess > xEventRegistry(aConfig.cfg(), css::uno::UNO_QUERY); if (!xEventRegistry.is()) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); // check if the given event exist inside list of registered ones OUString sPath(sEvent + "/JobList"); if (!xEventRegistry->hasByHierarchicalName(sPath)) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); // step to the job list, which is a child of the event node inside cfg // e.g. "/org.openoffice.Office.Jobs/Events//JobList" css::uno::Any aJobList = xEventRegistry->getByHierarchicalName(sPath); css::uno::Reference< css::container::XNameAccess > xJobList; if (!(aJobList >>= xJobList) || !xJobList.is()) - return css::uno::Sequence< OUString >(); + return std::vector< OUString >(); // get all alias names of jobs, which are part of this job list // But Some of them can be disabled by its time stamp values. @@ -541,8 +539,7 @@ css::uno::Sequence< OUString > JobData::getEnabledJobsForEvent( const css::uno:: OUString* pAllJobs = lAllJobs.getArray(); sal_Int32 c = lAllJobs.getLength(); - css::uno::Sequence< OUString > lEnabledJobs(c); - OUString* pEnabledJobs = lEnabledJobs.getArray(); + std::vector< OUString > lEnabledJobs(c); sal_Int32 d = 0; for (sal_Int32 s=0; s JobData::getEnabledJobsForEvent( const css::uno:: if (!isEnabled(sAdminTime, sUserTime)) continue; - pEnabledJobs[d] = pAllJobs[s]; + lEnabledJobs[d] = pAllJobs[s]; ++d; } - lEnabledJobs.realloc(d); + lEnabledJobs.resize(d); aConfig.close(); @@ -595,7 +592,7 @@ void JobData::impl_reset() m_sService.clear(); m_sContext.clear(); m_sEvent.clear(); - m_lArguments = css::uno::Sequence< css::beans::NamedValue >(); + m_lArguments.clear(); } } // namespace framework diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index e855de85d053..78e014c30c40 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -311,7 +311,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString& // filter disabled jobs using it's time stamp values. /* SAFE { */ SolarMutexResettableGuard aReadLock; - css::uno::Sequence< OUString > lJobs = JobData::getEnabledJobsForEvent(m_xContext, sEvent); + std::vector< OUString > lJobs = JobData::getEnabledJobsForEvent(m_xContext, sEvent); aReadLock.clear(); /* } SAFE */ @@ -323,7 +323,7 @@ void JobDispatch::impl_dispatchEvent( /*IN*/ const OUString& // It's not really an error, if no registered jobs could be located. // Step over all found jobs and execute it int nExecutedJobs=0; - for (int j=0; j lJobs; + std::vector< OUString > lJobs; /* SAFE */ { osl::MutexGuard g(rBHelper.rMutex); @@ -223,8 +223,8 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run } /* SAFE */ // step over all enabled jobs and execute it - sal_Int32 c = lJobs.getLength(); - for (sal_Int32 j=0; j pJob; diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx index 05771828692e..01adf16c9981 100644 --- a/framework/source/jobs/jobresult.cxx +++ b/framework/source/jobs/jobresult.cxx @@ -25,6 +25,7 @@ #include #include #include +#include namespace framework{ @@ -113,8 +114,10 @@ JobResult::JobResult( /*IN*/ const css::uno::Any& aResult ) pIt = aProtocol.find(JobConst::ANSWER_SAVE_ARGUMENTS()); if (pIt != aProtocol.end()) { - pIt->second >>= m_lArguments; - if (m_lArguments.getLength() > 0) + css::uno::Sequence aTmp; + pIt->second >>= aTmp; + comphelper::sequenceToContainer(m_lArguments, aTmp); + if (!m_lArguments.size()) m_eParts |= E_ARGUMENTS; } @@ -190,7 +193,7 @@ bool JobResult::existPart( sal_uInt32 eParts ) const @return It returns the state of the internal member without any checks! */ -css::uno::Sequence< css::beans::NamedValue > JobResult::getArguments() const +std::vector< css::beans::NamedValue > JobResult::getArguments() const { SolarMutexGuard g; return m_lArguments; diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index 1a29255b064f..5ec8f6c7a968 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -944,7 +944,7 @@ bool LoadEnv::impl_furtherDocsAllowed() FrameListAnalyzer::E_BACKINGCOMPONENT | FrameListAnalyzer::E_HIDDEN); - sal_Int32 nOpenDocuments = aAnalyzer.m_lOtherVisibleFrames.getLength(); + sal_Int32 nOpenDocuments = aAnalyzer.m_lOtherVisibleFrames.size(); bAllowed = (nOpenDocuments < nMaxOpenDocuments); } } diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 28a68305ee44..00b2a746106c 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -3170,7 +3170,7 @@ void Frame::impl_checkMenuCloser() // But we must check, if weself includes the help ... // Check aAnalyzer.m_bReferenceIsHelp! if ( - (aAnalyzer.m_lOtherVisibleFrames.getLength()==1) && + (aAnalyzer.m_lOtherVisibleFrames.size()==1) && ( (aAnalyzer.m_bReferenceIsHelp ) || (aAnalyzer.m_bReferenceIsHidden) @@ -3186,7 +3186,7 @@ void Frame::impl_checkMenuCloser() // There is no other frame ... means no other document frame. The help module // will be handled separately and must(!) be ignored here ... excepting weself includes the help. else if ( - (aAnalyzer.m_lOtherVisibleFrames.getLength()==0) && + (aAnalyzer.m_lOtherVisibleFrames.empty()) && (!aAnalyzer.m_bReferenceIsHelp ) && (!aAnalyzer.m_bReferenceIsHidden ) && (!aAnalyzer.m_bReferenceIsBacking ) diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 15b26bae1bfb..60246784be71 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -1104,7 +1104,7 @@ throw ( IllegalArgumentException, RuntimeException, std::exception ) if ( m_bDisposed ) throw DisposedException(); - Sequence< Sequence< PropertyValue > > aElementInfoSeq; + std::vector< Sequence< PropertyValue > > aElementInfoSeq; UIElementInfoHashMap aUIElementInfoCollection; if ( ElementType == css::ui::UIElementType::UNKNOWN ) @@ -1119,7 +1119,7 @@ throw ( IllegalArgumentException, RuntimeException, std::exception ) aUIElementInfo[0].Name = m_aPropResourceURL; aUIElementInfo[1].Name = m_aPropUIName; - aElementInfoSeq.realloc( aUIElementInfoCollection.size() ); + aElementInfoSeq.resize( aUIElementInfoCollection.size() ); UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin(); sal_Int32 n = 0; @@ -1131,7 +1131,7 @@ throw ( IllegalArgumentException, RuntimeException, std::exception ) ++pIter; } - return aElementInfoSeq; + return comphelper::containerToSequence(aElementInfoSeq); } Reference< XIndexContainer > SAL_CALL ModuleUIConfigurationManager::createSettings() throw (css::uno::RuntimeException, std::exception) diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 1bcb6ce67449..80e66c3e93f2 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -42,6 +42,7 @@ #include #include +#include #include #include #include @@ -864,7 +865,7 @@ throw ( IllegalArgumentException, RuntimeException, std::exception ) if ( m_bDisposed ) throw DisposedException(); - Sequence< Sequence< PropertyValue > > aElementInfoSeq; + std::vector< Sequence< PropertyValue > > aElementInfoSeq; UIElementInfoHashMap aUIElementInfoCollection; if ( ElementType == css::ui::UIElementType::UNKNOWN ) @@ -879,7 +880,7 @@ throw ( IllegalArgumentException, RuntimeException, std::exception ) aUIElementInfo[0].Name = m_aPropResourceURL; aUIElementInfo[1].Name = m_aPropUIName; - aElementInfoSeq.realloc( aUIElementInfoCollection.size() ); + aElementInfoSeq.resize( aUIElementInfoCollection.size() ); UIElementInfoHashMap::const_iterator pIter = aUIElementInfoCollection.begin(); sal_Int32 n = 0; @@ -891,7 +892,7 @@ throw ( IllegalArgumentException, RuntimeException, std::exception ) ++pIter; } - return aElementInfoSeq; + return comphelper::containerToSequence(aElementInfoSeq); } Reference< XIndexContainer > SAL_CALL UIConfigurationManager::createSettings() throw (css::uno::RuntimeException, std::exception) diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx index 1fff2d393937..06560ba1fe9a 100644 --- a/framework/source/uiconfiguration/windowstateconfiguration.cxx +++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx @@ -546,58 +546,58 @@ Any ConfigurationAccess_WindowState::impl_getSequenceFromStruct( const WindowSta { sal_Int32 i( 0 ); sal_Int32 nCount( m_aPropArray.size() ); - Sequence< PropertyValue > aPropSeq; + std::vector< PropertyValue > aPropVec; for ( i = 0; i < nCount; i++ ) { if ( rWinStateInfo.nMask & ( 1 << i )) { // put value into the return sequence - sal_Int32 nIndex( aPropSeq.getLength()); - aPropSeq.realloc( nIndex+1 ); - aPropSeq[nIndex].Name = m_aPropArray[i]; + PropertyValue pv; + pv.Name = m_aPropArray[i]; switch ( i ) { case PROPERTY_LOCKED: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bLocked ); break; + pv.Value = makeAny( rWinStateInfo.bLocked ); break; case PROPERTY_DOCKED: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bDocked ); break; + pv.Value = makeAny( rWinStateInfo.bDocked ); break; case PROPERTY_VISIBLE: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bVisible ); break; + pv.Value = makeAny( rWinStateInfo.bVisible ); break; case PROPERTY_CONTEXT: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bContext ); break; + pv.Value = makeAny( rWinStateInfo.bContext ); break; case PROPERTY_HIDEFROMMENU: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bHideFromMenu ); break; + pv.Value = makeAny( rWinStateInfo.bHideFromMenu ); break; case PROPERTY_NOCLOSE: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bNoClose ); break; + pv.Value = makeAny( rWinStateInfo.bNoClose ); break; case PROPERTY_SOFTCLOSE: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bSoftClose ); break; + pv.Value = makeAny( rWinStateInfo.bSoftClose ); break; case PROPERTY_CONTEXTACTIVE: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.bContextActive ); break; + pv.Value = makeAny( rWinStateInfo.bContextActive ); break; case PROPERTY_DOCKINGAREA: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockingArea ); break; + pv.Value = makeAny( rWinStateInfo.aDockingArea ); break; case PROPERTY_POS: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aPos ); break; + pv.Value = makeAny( rWinStateInfo.aPos ); break; case PROPERTY_SIZE: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aSize ); break; + pv.Value = makeAny( rWinStateInfo.aSize ); break; case PROPERTY_UINAME: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aUIName ); break; + pv.Value = makeAny( rWinStateInfo.aUIName ); break; case PROPERTY_INTERNALSTATE: - aPropSeq[nIndex].Value = makeAny( sal_Int32( rWinStateInfo.nInternalState )); break; + pv.Value = makeAny( sal_Int32( rWinStateInfo.nInternalState )); break; case PROPERTY_STYLE: - aPropSeq[nIndex].Value = makeAny( sal_Int16( rWinStateInfo.nStyle )); break; + pv.Value = makeAny( sal_Int16( rWinStateInfo.nStyle )); break; case PROPERTY_DOCKPOS: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockPos ); break; + pv.Value = makeAny( rWinStateInfo.aDockPos ); break; case PROPERTY_DOCKSIZE: - aPropSeq[nIndex].Value = makeAny( rWinStateInfo.aDockSize ); break; + pv.Value = makeAny( rWinStateInfo.aDockSize ); break; default: assert( false && "Wrong value for ConfigurationAccess_WindowState. Who has forgotten to add this new property!" ); } + aPropVec.push_back(pv); } } - return makeAny( aPropSeq ); + return makeAny( comphelper::containerToSequence(aPropVec) ); } Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OUString& rResourceURL, Reference< XNameAccess >& xNameAccess ) @@ -605,8 +605,7 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU sal_Int32 nMask( 0 ); sal_Int32 nCount( m_aPropArray.size() ); sal_Int32 i( 0 ); - sal_Int32 nIndex( 0 ); - Sequence< PropertyValue > aPropSeq; + std::vector< PropertyValue > aPropVec; WindowStateInfo aWindowStateInfo; for ( i = 0; i < nCount; i++ ) @@ -778,10 +777,10 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU if ( bAddToSeq ) { // put value into the return sequence - nIndex = aPropSeq.getLength(); - aPropSeq.realloc( nIndex+1 ); - aPropSeq[nIndex].Name = m_aPropArray[i]; - aPropSeq[nIndex].Value = a; + PropertyValue pv; + pv.Name = m_aPropArray[i]; + pv.Value = a; + aPropVec.push_back(pv); } } catch( const css::container::NoSuchElementException& ) @@ -794,7 +793,7 @@ Any ConfigurationAccess_WindowState::impl_insertCacheAndReturnSequence( const OU aWindowStateInfo.nMask = nMask; m_aResourceURLToInfoCache.insert( ResourceURLToInfoCache::value_type( rResourceURL, aWindowStateInfo )); - return makeAny( aPropSeq ); + return makeAny( comphelper::containerToSequence(aPropVec) ); } ConfigurationAccess_WindowState::WindowStateInfo& ConfigurationAccess_WindowState::impl_insertCacheAndReturnWinState( const OUString& rResourceURL, Reference< XNameAccess >& rNameAccess ) diff --git a/include/framework/configimporter.hxx b/include/framework/configimporter.hxx index c35e8d6428b5..3082464c28c2 100644 --- a/include/framework/configimporter.hxx +++ b/include/framework/configimporter.hxx @@ -27,6 +27,7 @@ #include #include +#include namespace framework { @@ -35,7 +36,7 @@ namespace framework public: static bool ImportCustomToolbars( const css::uno::Reference< css::ui::XUIConfigurationManager2 >& rContainerFactory, - css::uno::Sequence< css::uno::Reference< css::container::XIndexContainer > >& rSeqContainer, + std::vector< css::uno::Reference< css::container::XIndexContainer > >& rSeqContainer, const css::uno::Reference< css::uno::XComponentContext >& rxContext, const css::uno::Reference< css::embed::XStorage >& rToolbarStorage ); }; diff --git a/include/framework/framelistanalyzer.hxx b/include/framework/framelistanalyzer.hxx index cdceae22559b..a1f2501bc08c 100644 --- a/include/framework/framelistanalyzer.hxx +++ b/include/framework/framelistanalyzer.hxx @@ -23,6 +23,7 @@ #include #include +#include namespace framework{ @@ -73,19 +74,19 @@ class FWE_DLLPUBLIC FrameListAnalyzer /** contains all frames, which uses the same model like the reference frame. Will be filled only if m_eDetectMode has set the flag E_MODEL. The reference frame is never part of this list! */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lModelFrames; + std::vector< css::uno::Reference< css::frame::XFrame > > m_lModelFrames; /** contains all frames, which does not contain the same model like the reference frame. Filling of it can't be suppressed by m_eDetectMode. The reference frame is never part of this list! All frames inside this list are visible ones. */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames; + std::vector< css::uno::Reference< css::frame::XFrame > > m_lOtherVisibleFrames; /** contains all frames, which does not contain the same model like the reference frame. Filling of it can't be suppressed by m_eDetectMode. The reference frame is never part of this list! All frames inside this list are hidden ones. */ - css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames; + std::vector< css::uno::Reference< css::frame::XFrame > > m_lOtherHiddenFrames; /** points to the help frame. Will be set only, if any other frame (means different from the reference frame) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 878f9d75717e..8bb5c08de0a9 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3563,7 +3563,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage if ( xOOo1ConfigStorage.is() ) { Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); - Sequence< Reference< container::XIndexContainer > > rToolbars; + std::vector< Reference< container::XIndexContainer > > rToolbars; bool bImported = framework::UIConfigurationImporterOOo1x::ImportCustomToolbars( xNewUIConfMan, rToolbars, xContext, xOOo1ConfigStorage ); @@ -3573,7 +3573,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage OUString aNum( "private:resource/toolbar/custom_OOo1x_" ); OUString aTitle( "Toolbar " ); - for ( sal_Int32 i = 0; i < rToolbars.getLength(); i++ ) + for ( size_t i = 0; i < rToolbars.size(); i++ ) { OUString aCustomTbxName = aNum + OUString::number( i + 1 ); OUString aCustomTbxTitle = aTitle + OUString::number( i + 1 ); -- cgit