[Libreoffice-commits] core.git: 3 commits - framework/inc framework/source include/framework include/linguistic linguistic/source scripting/source sfx2/source
Noel Grandin
noelgrandin at gmail.com
Fri Apr 1 07:33:54 UTC 2016
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
framework/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
framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 6
framework/source/uiconfiguration/uiconfigurationmanager.cxx | 7
framework/source/uiconfiguration/windowstateconfiguration.cxx | 55 +++---
include/framework/configimporter.hxx | 3
include/framework/framelistanalyzer.hxx | 7
include/linguistic/misc.hxx | 2
include/linguistic/spelldta.hxx | 8
linguistic/source/convdiclist.cxx | 57 ++----
linguistic/source/dicimp.cxx | 87 ++--------
linguistic/source/dicimp.hxx | 5
linguistic/source/dlistimp.cxx | 21 +-
linguistic/source/lngsvcmgr.cxx | 2
linguistic/source/misc2.cxx | 21 +-
linguistic/source/spelldsp.cxx | 22 +-
linguistic/source/spelldta.cxx | 55 ++----
scripting/source/basprov/baslibnode.cxx | 10 -
scripting/source/provider/BrowseNodeFactoryImpl.cxx | 35 +---
scripting/source/provider/ProviderCache.cxx | 4
sfx2/source/doc/sfxbasemodel.cxx | 4
36 files changed, 240 insertions(+), 317 deletions(-)
New commits:
commit 3f7f497192deb486b1b959996c14f8f094146945
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Tue Feb 16 19:58:33 2016 +0200
sequence->vector in framework
Change-Id: I457c3da4f4a31f58d688dcd96a2ccfc36518490d
Reviewed-on: https://gerrit.libreoffice.org/23692
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/framework/inc/helper/ocomponentaccess.hxx b/framework/inc/helper/ocomponentaccess.hxx
index f499270..9f7c88d 100644
--- a/framework/inc/helper/ocomponentaccess.hxx
+++ b/framework/inc/helper/ocomponentaccess.hxx
@@ -33,6 +33,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/weakref.hxx>
+#include <vector>
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 e382537..8e0c144 100644
--- a/framework/inc/helper/ocomponentenumeration.hxx
+++ b/framework/inc/helper/ocomponentenumeration.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <cppuhelper/implbase.hxx>
+#include <vector>
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 d60256f..e49716b 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 89ebaa8..c4d515b 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 02f0dee..f2de647 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; i<c; ++i)
{
if (!fpf::closeIt(aCheck.m_lModelFrames[i], false))
diff --git a/framework/source/dispatch/startmoduledispatcher.cxx b/framework/source/dispatch/startmoduledispatcher.cxx
index ff9fdb6..e9f37e9 100644
--- a/framework/source/dispatch/startmoduledispatcher.cxx
+++ b/framework/source/dispatch/startmoduledispatcher.cxx
@@ -121,12 +121,9 @@ bool StartModuleDispatcher::implts_isBackingModePossible()
FrameListAnalyzer::E_HELP | FrameListAnalyzer::E_BACKINGCOMPONENT);
bool bIsPossible = false;
- ::sal_Int32 nVisibleFrames = aCheck.m_lOtherVisibleFrames.getLength ();
- if (
- ( ! aCheck.m_xBackingComponent.is ()) &&
- ( nVisibleFrames < 1 )
- )
+ if ( ! aCheck.m_xBackingComponent.is()
+ && aCheck.m_lOtherVisibleFrames.empty() )
{
bIsPossible = true;
}
diff --git a/framework/source/fwe/classes/framelistanalyzer.cxx b/framework/source/fwe/classes/framelistanalyzer.cxx
index 0feddc3..ed9d751 100644
--- a/framework/source/fwe/classes/framelistanalyzer.cxx
+++ b/framework/source/fwe/classes/framelistanalyzer.cxx
@@ -86,9 +86,9 @@ void FrameListAnalyzer::impl_analyze()
sal_Int32 nModelStep = 0;
sal_Int32 nCount = xFrameContainer->getCount();
- 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 e1306991..27c9849 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 68c7f58..6b13cec 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<OWeakObject*>(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 dce0ead..9f4768c 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 8980495..527c454 100644
--- a/framework/source/jobs/job.cxx
+++ b/framework/source/jobs/job.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
@@ -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 14f4ddc..c3b453d 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<nCount; ++i)
{
m_lArguments[i].Name = lArgumentNames[i];
@@ -222,7 +222,7 @@ void JobData::setEvent( const OUString& sEvent ,
@param lArguments
list of arguments, which should be set for this job
*/
-void JobData::setJobConfig( const css::uno::Sequence< css::beans::NamedValue >& 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<c; ++i)
{
@@ -505,32 +505,30 @@ bool JobData::hasCorrectContext(const OUString& rModuleIdent) const
return false;
}
-/**
- */
-css::uno::Sequence< OUString > 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/<event name>/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<c; ++s)
@@ -565,10 +562,10 @@ css::uno::Sequence< OUString > 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 e855de8..78e014c 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.getLength(); ++j)
+ for (size_t j=0; j<lJobs.size(); ++j)
{
/* SAFE { */
aReadLock.reset();
diff --git a/framework/source/jobs/jobexecutor.cxx b/framework/source/jobs/jobexecutor.cxx
index 05fd77d..f53c025 100644
--- a/framework/source/jobs/jobexecutor.cxx
+++ b/framework/source/jobs/jobexecutor.cxx
@@ -205,7 +205,7 @@ void SAL_CALL JobExecutor::trigger( const OUString& sEvent ) throw(css::uno::Run
{
SAL_INFO( "fwk", "JobExecutor::trigger()");
- css::uno::Sequence< OUString > 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<c; ++j)
+ size_t c = lJobs.size();
+ for (size_t j=0; j<c; ++j)
{
rtl::Reference<Job> pJob;
diff --git a/framework/source/jobs/jobresult.cxx b/framework/source/jobs/jobresult.cxx
index 0577182..01adf16 100644
--- a/framework/source/jobs/jobresult.cxx
+++ b/framework/source/jobs/jobresult.cxx
@@ -25,6 +25,7 @@
#include <rtl/ustrbuf.hxx>
#include <vcl/svapp.hxx>
#include <comphelper/sequenceashashmap.hxx>
+#include <comphelper/sequence.hxx>
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<css::beans::NamedValue> 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 1a29255..5ec8f6c 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 28a6830..00b2a74 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 15b26ba..6024678 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 1bcb6ce..80e66c3 100644
--- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx
@@ -42,6 +42,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
+#include <comphelper/sequence.hxx>
#include <vcl/svapp.hxx>
#include <rtl/ref.hxx>
#include <rtl/ustrbuf.hxx>
@@ -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 1fff2d3..06560ba 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 c35e8d6..3082464 100644
--- a/include/framework/configimporter.hxx
+++ b/include/framework/configimporter.hxx
@@ -27,6 +27,7 @@
#include <rtl/ustring.hxx>
#include <framework/fwedllapi.h>
+#include <vector>
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 cdceae2..a1f2501 100644
--- a/include/framework/framelistanalyzer.hxx
+++ b/include/framework/framelistanalyzer.hxx
@@ -23,6 +23,7 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <framework/fwedllapi.h>
+#include <vector>
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 878f9d7..8bb5c08 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 );
commit dba6451b2f25b3d8510e0a848977166ee5e6c8e3
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Thu Mar 10 09:22:48 2016 +0200
sequence->vector in scripting
Change-Id: I5efd5ed8755b6127f08f711b8b7337b87b89bbd4
Reviewed-on: https://gerrit.libreoffice.org/23700
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/scripting/source/basprov/baslibnode.cxx b/scripting/source/basprov/baslibnode.cxx
index aee5ae0..b39368e 100644
--- a/scripting/source/basprov/baslibnode.cxx
+++ b/scripting/source/basprov/baslibnode.cxx
@@ -20,6 +20,7 @@
#include "baslibnode.hxx"
#include "basmodnode.hxx"
#include <com/sun/star/script/browse/BrowseNodeTypes.hpp>
+#include <comphelper/sequence.hxx>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <basic/basmgr.hxx>
@@ -77,7 +78,7 @@ namespace basprov
{
SolarMutexGuard aGuard;
- Sequence< Reference< browse::XBrowseNode > > aChildNodes;
+ std::vector< Reference< browse::XBrowseNode > > aChildNodes;
if ( m_xLibContainer.is() && m_xLibContainer->hasByName( m_sLibName ) && !m_xLibContainer->isLibraryLoaded( m_sLibName ) )
m_xLibContainer->loadLibrary( m_sLibName );
@@ -90,19 +91,18 @@ namespace basprov
Sequence< OUString > aNames = m_xLibrary->getElementNames();
sal_Int32 nCount = aNames.getLength();
const OUString* pNames = aNames.getConstArray();
- aChildNodes.realloc( nCount );
- Reference< browse::XBrowseNode >* pChildNodes = aChildNodes.getArray();
+ aChildNodes.resize( nCount );
for ( sal_Int32 i = 0 ; i < nCount ; ++i )
{
SbModule* pModule = pBasic->FindModule( pNames[i] );
if ( pModule )
- pChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicModuleNodeImpl( m_xContext, m_sScriptingContext, pModule, m_bIsAppScript ) );
+ aChildNodes[i] = static_cast< browse::XBrowseNode* >( new BasicModuleNodeImpl( m_xContext, m_sScriptingContext, pModule, m_bIsAppScript ) );
}
}
}
- return aChildNodes;
+ return comphelper::containerToSequence(aChildNodes);
}
diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
index d637048..656690b 100644
--- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx
+++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx
@@ -55,14 +55,14 @@ class BrowseNodeAggregator :
{
private:
OUString m_Name;
- Sequence< Reference< browse::XBrowseNode > > m_Nodes;
+ std::vector< Reference< browse::XBrowseNode > > m_Nodes;
public:
explicit BrowseNodeAggregator( const Reference< browse::XBrowseNode >& node )
{
m_Name = node->getName();
- m_Nodes.realloc( 1 );
+ m_Nodes.resize( 1 );
m_Nodes[ 0 ] = node;
}
@@ -72,10 +72,7 @@ public:
void addBrowseNode( const Reference< browse::XBrowseNode>& node )
{
- sal_Int32 index = m_Nodes.getLength();
-
- m_Nodes.realloc( index + 1 );
- m_Nodes[ index ] = node;
+ m_Nodes.push_back( node );
}
virtual OUString
@@ -90,11 +87,11 @@ public:
throw ( RuntimeException, std::exception ) override
{
std::vector< Sequence< Reference < browse::XBrowseNode > > > seqs;
- seqs.reserve( m_Nodes.getLength() );
+ seqs.reserve( m_Nodes.size() );
sal_Int32 numChildren = 0;
- for ( sal_Int32 i = 0; i < m_Nodes.getLength(); i++ )
+ for ( size_t i = 0; i < m_Nodes.size(); i++ )
{
Sequence< Reference < browse::XBrowseNode > > children;
try
@@ -129,9 +126,9 @@ public:
hasChildNodes()
throw ( RuntimeException, std::exception ) override
{
- if ( m_Nodes.getLength() != 0 )
+ if ( !m_Nodes.empty() )
{
- for ( sal_Int32 i = 0 ; i < m_Nodes.getLength(); i++ )
+ for ( size_t i = 0 ; i < m_Nodes.size(); i++ )
{
try
{
@@ -294,7 +291,7 @@ private:
namespace
{
-Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx )
+std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx )
{
Sequence< OUString > openDocs =
MiscUtils::allOpenTDocUrls( xCtx );
@@ -303,7 +300,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
sal_Int32 initialSize = openDocs.getLength() + 2;
sal_Int32 mspIndex = 0;
- Sequence < Reference < browse::XBrowseNode > > locnBNs( initialSize );
+ std::vector< Reference < browse::XBrowseNode > > locnBNs( initialSize );
try
{
xFac = provider::theMasterScriptProviderFactory::get( xCtx );
@@ -317,7 +314,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
(void)e;
OSL_TRACE("Caught Exception %s",
OUStringToOString( e.Message , RTL_TEXTENCODING_ASCII_US ).pData->buffer );
- locnBNs.realloc( mspIndex );
+ locnBNs.resize( mspIndex );
return locnBNs;
}
@@ -350,7 +347,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
}
- Sequence < Reference < browse::XBrowseNode > > locnBNs_Return( mspIndex );
+ std::vector< Reference < browse::XBrowseNode > > locnBNs_Return( mspIndex );
for ( sal_Int32 j = 0; j < mspIndex; j++ )
locnBNs_Return[j] = locnBNs[j];
@@ -538,10 +535,10 @@ private:
public:
explicit DefaultRootBrowseNode( const Reference< XComponentContext >& xCtx )
{
- Sequence < Reference< browse::XBrowseNode > > nodes =
+ std::vector< Reference< browse::XBrowseNode > > nodes =
getAllBrowseNodes( xCtx );
- for ( sal_Int32 i=0; i<nodes.getLength(); i++ )
+ for ( size_t i=0; i<nodes.size(); i++ )
{
m_vNodes.push_back( new DefaultBrowseNode( xCtx, nodes[ i ] ) );
}
@@ -621,12 +618,12 @@ public:
throw ( RuntimeException, std::exception ) override
{
- Sequence < Reference < browse::XBrowseNode > > locnBNs = getAllBrowseNodes( m_xComponentContext );
+ std::vector< Reference < browse::XBrowseNode > > locnBNs = getAllBrowseNodes( m_xComponentContext );
Sequence< Reference< browse::XBrowseNode > > children(
- locnBNs.getLength() );
+ locnBNs.size() );
- for ( sal_Int32 j = 0; j < locnBNs.getLength(); j++ )
+ for ( size_t j = 0; j < locnBNs.size(); j++ )
{
children[j] = new LocationBrowseNode( locnBNs[j] );
}
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 854b823..34686b1 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -83,18 +83,18 @@ ProviderCache::getProvider( const OUString& providerName )
Sequence < Reference< provider::XScriptProvider > >
ProviderCache::getAllProviders() throw ( RuntimeException )
{
- Sequence < Reference< provider::XScriptProvider > > providers ( m_hProviderDetailsCache.size() );
// need to create providers that haven't been created already
// so check what providers exist and what ones don't
::osl::Guard< osl::Mutex > aGuard( m_mutex );
+ Sequence < Reference< provider::XScriptProvider > > providers ( m_hProviderDetailsCache.size() );
ProviderDetails_hash::iterator h_itEnd = m_hProviderDetailsCache.end();
ProviderDetails_hash::iterator h_it = m_hProviderDetailsCache.begin();
// should assert if size !> 0
if ( !m_hProviderDetailsCache.empty() )
{
sal_Int32 providerIndex = 0;
- sal_Int32 index = 0;
+ sal_Int32 index = 0;
for ( index = 0; h_it != h_itEnd; ++h_it, index++ )
{
Reference< provider::XScriptProvider > xScriptProvider = h_it->second.provider;
commit 46b4634de93bdda2a8427c6c545dc6160d5201d0
Author: Noel Grandin <noelgrandin at gmail.com>
Date: Tue Feb 23 19:41:53 2016 +0200
sequence->vector in linguistic
Change-Id: I28ed0b4bb2a140493fca693807011b91b3569986
Reviewed-on: https://gerrit.libreoffice.org/23695
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/linguistic/misc.hxx b/include/linguistic/misc.hxx
index 9e7cb3f..99dfd05 100644
--- a/include/linguistic/misc.hxx
+++ b/include/linguistic/misc.hxx
@@ -118,7 +118,7 @@ bool FileExists( const OUString &rURL );
OUString GetDictionaryWriteablePath();
-css::uno::Sequence< OUString > GetDictionaryPaths();
+std::vector< OUString > GetDictionaryPaths();
/// @returns an URL for a new and writable dictionary rDicName.
/// The URL will point to the path given by 'GetDictionaryWriteablePath'
diff --git a/include/linguistic/spelldta.hxx b/include/linguistic/spelldta.hxx
index 5475afc..2e3e6c0 100644
--- a/include/linguistic/spelldta.hxx
+++ b/include/linguistic/spelldta.hxx
@@ -37,14 +37,14 @@ namespace com { namespace sun { namespace star {
namespace linguistic
{
-css::uno::Sequence< OUString >
+std::vector< OUString >
MergeProposalSeqs(
- css::uno::Sequence< OUString > &rAlt1,
- css::uno::Sequence< OUString > &rAlt2,
+ std::vector< OUString > &rAlt1,
+ std::vector< OUString > &rAlt2,
bool bAllowDuplicates );
void SeqRemoveNegEntries(
- css::uno::Sequence< OUString > &rSeq,
+ std::vector< OUString > &rSeq,
css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &rxDicList,
sal_Int16 nLanguage );
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index a977062..de7160f 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -31,6 +31,7 @@
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <rtl/instance.hxx>
#include <tools/stream.hxx>
@@ -79,7 +80,7 @@ class ConvDicNameContainer :
public cppu::WeakImplHelper< css::container::XNameContainer >,
private boost::noncopyable
{
- uno::Sequence< uno::Reference< XConversionDictionary > > aConvDics;
+ std::vector< uno::Reference< XConversionDictionary > > aConvDics;
sal_Int32 GetIndexByName_Impl( const OUString& rName );
@@ -110,12 +111,12 @@ public:
// calls Flush for the dictionaries that support XFlushable
void FlushDics() const;
- sal_Int32 GetCount() const { return aConvDics.getLength(); }
+ sal_Int32 GetCount() const { return aConvDics.size(); }
uno::Reference< XConversionDictionary > GetByName( const OUString& rName );
- const uno::Reference< XConversionDictionary > GetByIndex( sal_Int32 nIdx )
+ const uno::Reference< XConversionDictionary >& GetByIndex( sal_Int32 nIdx )
{
- return aConvDics.getConstArray()[nIdx];
+ return aConvDics[nIdx];
}
};
@@ -129,11 +130,10 @@ ConvDicNameContainer::~ConvDicNameContainer()
void ConvDicNameContainer::FlushDics() const
{
- sal_Int32 nLen = aConvDics.getLength();
- const uno::Reference< XConversionDictionary > *pDic = aConvDics.getConstArray();
+ sal_Int32 nLen = aConvDics.size();
for (sal_Int32 i = 0; i < nLen; ++i)
{
- uno::Reference< util::XFlushable > xFlush( pDic[i] , UNO_QUERY );
+ uno::Reference< util::XFlushable > xFlush( aConvDics[i] , UNO_QUERY );
if (xFlush.is())
{
try
@@ -152,11 +152,10 @@ sal_Int32 ConvDicNameContainer::GetIndexByName_Impl(
const OUString& rName )
{
sal_Int32 nRes = -1;
- sal_Int32 nLen = aConvDics.getLength();
- const uno::Reference< XConversionDictionary > *pDic = aConvDics.getConstArray();
+ sal_Int32 nLen = aConvDics.size();
for (sal_Int32 i = 0; i < nLen && nRes == -1; ++i)
{
- if (rName == pDic[i]->getName())
+ if (rName == aConvDics[i]->getName())
nRes = i;
}
return nRes;
@@ -168,7 +167,7 @@ uno::Reference< XConversionDictionary > ConvDicNameContainer::GetByName(
uno::Reference< XConversionDictionary > xRes;
sal_Int32 nIdx = GetIndexByName_Impl( rName );
if ( nIdx != -1)
- xRes = aConvDics.getArray()[nIdx];
+ xRes = aConvDics[nIdx];
return xRes;
}
@@ -183,7 +182,7 @@ sal_Bool SAL_CALL ConvDicNameContainer::hasElements( )
throw (RuntimeException, std::exception)
{
MutexGuard aGuard( GetLinguMutex() );
- return aConvDics.getLength() > 0;
+ return !aConvDics.empty();
}
uno::Any SAL_CALL ConvDicNameContainer::getByName( const OUString& rName )
@@ -201,12 +200,11 @@ uno::Sequence< OUString > SAL_CALL ConvDicNameContainer::getElementNames( )
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int32 nLen = aConvDics.getLength();
+ sal_Int32 nLen = aConvDics.size();
uno::Sequence< OUString > aRes( nLen );
OUString *pName = aRes.getArray();
- const uno::Reference< XConversionDictionary > *pDic = aConvDics.getConstArray();
for (sal_Int32 i = 0; i < nLen; ++i)
- pName[i] = pDic[i]->getName();
+ pName[i] = aConvDics[i]->getName();
return aRes;
}
@@ -231,7 +229,7 @@ void SAL_CALL ConvDicNameContainer::replaceByName(
rElement >>= xNew;
if (!xNew.is() || xNew->getName() != rName)
throw IllegalArgumentException();
- aConvDics.getArray()[ nRplcIdx ] = xNew;
+ aConvDics[ nRplcIdx ] = xNew;
}
void SAL_CALL ConvDicNameContainer::insertByName(
@@ -248,9 +246,7 @@ void SAL_CALL ConvDicNameContainer::insertByName(
if (!xNew.is() || xNew->getName() != rName)
throw IllegalArgumentException();
- sal_Int32 nLen = aConvDics.getLength();
- aConvDics.realloc( nLen + 1 );
- aConvDics.getArray()[ nLen ] = xNew;
+ aConvDics.push_back(xNew);
}
void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
@@ -263,7 +259,7 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
throw NoSuchElementException();
// physically remove dictionary
- uno::Reference< XConversionDictionary > xDel = aConvDics.getArray()[nRplcIdx];
+ uno::Reference< XConversionDictionary > xDel = aConvDics[nRplcIdx];
OUString aName( xDel->getName() );
OUString aDicMainURL( GetConvDicMainURL( aName, GetDictionaryWriteablePath() ) );
INetURLObject aObj( aDicMainURL );
@@ -287,11 +283,7 @@ void SAL_CALL ConvDicNameContainer::removeByName( const OUString& rName )
}
}
- sal_Int32 nLen = aConvDics.getLength();
- uno::Reference< XConversionDictionary > *pDic = aConvDics.getArray();
- for (sal_Int32 i = nRplcIdx; i < nLen - 1; ++i)
- pDic[i] = pDic[i + 1];
- aConvDics.realloc( nLen - 1 );
+ aConvDics.erase(aConvDics.begin() + nRplcIdx);
}
void ConvDicNameContainer::AddConvDics(
@@ -482,9 +474,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int32 nCount = 0;
- uno::Sequence< OUString > aRes( 20 );
- OUString *pRes = aRes.getArray();
+ std::vector< OUString > aRes;
bool bSupported = false;
sal_Int32 nLen = GetNameContainer().GetCount();
@@ -503,14 +493,8 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
sal_Int32 nNewLen = aNewConv.getLength();
if (nNewLen > 0)
{
- if (nCount + nNewLen > aRes.getLength())
- {
- aRes.realloc( nCount + nNewLen + 20 );
- pRes = aRes.getArray();
- }
- const OUString *pNewConv = aNewConv.getConstArray();
for (sal_Int32 k = 0; k < nNewLen; ++k)
- pRes[nCount++] = pNewConv[k];
+ aRes.push_back(aNewConv[k]);
}
}
}
@@ -518,8 +502,7 @@ uno::Sequence< OUString > SAL_CALL ConvDicList::queryConversions(
if (!bSupported)
throw NoSupportException();
- aRes.realloc( nCount );
- return aRes;
+ return comphelper::containerToSequence(aRes);
}
sal_Int16 SAL_CALL ConvDicList::queryMaxCharCount(
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index 51bce42..c22894c 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -29,6 +29,7 @@
#include <tools/urlobj.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
+#include <comphelper/sequence.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
@@ -191,7 +192,6 @@ DictionaryNeo::DictionaryNeo(const OUString &rName,
eDicType (eType),
nLanguage (nLang)
{
- nCount = 0;
nDicVersion = DIC_VERSION_DONTKNOW;
bNeedEntries = true;
bIsModified = bIsActive = false;
@@ -274,7 +274,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
rtl_TextEncoding eEnc = osl_getThreadTextEncoding();
if (nDicVersion >= DIC_VERSION_6)
eEnc = RTL_TEXTENCODING_UTF8;
- nCount = 0;
+ aEntries.clear();
if (DIC_VERSION_6 == nDicVersion ||
DIC_VERSION_5 == nDicVersion ||
@@ -470,10 +470,9 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
pStream->WriteLine(OString("---"));
if (0 != (nErr = pStream->GetError()))
return nErr;
- const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
- for (sal_Int32 i = 0; i < nCount; i++)
+ for (size_t i = 0; i < aEntries.size(); i++)
{
- OString aOutStr = formatForSave(pEntry[i], eEnc);
+ OString aOutStr = formatForSave(aEntries[i], eEnc);
pStream->WriteLine (aOutStr);
if (0 != (nErr = pStream->GetError()))
break;
@@ -622,7 +621,6 @@ bool DictionaryNeo::seekEntry(const OUString &rWord,
MutexGuard aGuard( GetLinguMutex() );
- const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
sal_Int32 nUpperIdx = getCount(),
nMidIdx,
nLowerIdx = 0;
@@ -632,9 +630,9 @@ bool DictionaryNeo::seekEntry(const OUString &rWord,
while( nLowerIdx <= nUpperIdx )
{
nMidIdx = (nLowerIdx + nUpperIdx) / 2;
- DBG_ASSERT(pEntry[nMidIdx].is(), "lng : empty entry encountered");
+ DBG_ASSERT(aEntries[nMidIdx].is(), "lng : empty entry encountered");
- int nCmp = - cmpDicEntry( pEntry[nMidIdx]->getDictionaryWord(),
+ int nCmp = - cmpDicEntry( aEntries[nMidIdx]->getDictionaryWord(),
rWord, bSimilarOnly );
if(nCmp == 0)
{
@@ -660,13 +658,12 @@ bool DictionaryNeo::isSorted()
{
bool bRes = true;
- const uno::Reference< XDictionaryEntry > *pEntry = aEntries.getConstArray();
sal_Int32 nEntries = getCount();
sal_Int32 i;
for (i = 1; i < nEntries; i++)
{
- if (cmpDicEntry( pEntry[i-1]->getDictionaryWord(),
- pEntry[i]->getDictionaryWord() ) > 0)
+ if (cmpDicEntry( aEntries[i-1]->getDictionaryWord(),
+ aEntries[i]->getDictionaryWord() ) > 0)
{
bRes = false;
break;
@@ -704,20 +701,10 @@ bool DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry >& xDic
{
DBG_ASSERT(!bNeedEntries, "lng : entries still not loaded");
- if (nCount >= aEntries.getLength())
- aEntries.realloc( std::max(2 * nCount, nCount + 32) );
- uno::Reference< XDictionaryEntry > *pEntry = aEntries.getArray();
-
- // shift old entries right
- sal_Int32 i;
- for (i = nCount - 1; i >= nPos; i--)
- pEntry[ i+1 ] = pEntry[ i ];
// insert new entry at specified position
- pEntry[ nPos ] = xDicEntry;
+ aEntries.insert(aEntries.begin() + nPos, xDicEntry);
SAL_WARN_IF(!isSorted(), "linguistic", "dictionary entries unsorted");
- nCount++;
-
bIsModified = true;
bRes = true;
@@ -770,15 +757,14 @@ void SAL_CALL DictionaryNeo::setActive( sal_Bool bActivate )
// remove entries from memory if dictionary is deactivated
if (!bIsActive)
{
- bool bIsEmpty = nCount == 0;
+ bool bIsEmpty = aEntries.empty();
// save entries first if necessary
if (bIsModified && hasLocation() && !isReadonly())
{
store();
- aEntries.realloc( 0 );
- nCount = 0;
+ aEntries.clear();
bNeedEntries = !bIsEmpty;
}
DBG_ASSERT( !bIsModified || !hasLocation() || isReadonly(),
@@ -803,7 +789,7 @@ sal_Int32 SAL_CALL DictionaryNeo::getCount( )
if (bNeedEntries)
loadEntries( aMainURL );
- return nCount;
+ return (sal_Int32)aEntries.size();
}
Locale SAL_CALL DictionaryNeo::getLocale( )
@@ -838,10 +824,9 @@ uno::Reference< XDictionaryEntry > SAL_CALL DictionaryNeo::getEntry(
sal_Int32 nPos;
bool bFound = seekEntry( aWord, &nPos, true );
- DBG_ASSERT( nCount <= aEntries.getLength(), "lng : wrong number of entries");
- DBG_ASSERT(!bFound || nPos < nCount, "lng : index out of range");
+ DBG_ASSERT(!bFound || nPos < (sal_Int32)aEntries.size(), "lng : index out of range");
- return bFound ? aEntries.getConstArray()[ nPos ]
+ return bFound ? aEntries[ nPos ]
: uno::Reference< XDictionaryEntry >();
}
@@ -882,26 +867,6 @@ sal_Bool SAL_CALL
return bRes;
}
-static void lcl_SequenceRemoveElementAt(
- uno::Sequence< uno::Reference< XDictionaryEntry > >& rEntries, int nPos )
-{
- //TODO: helper for SequenceRemoveElementAt available?
- if(nPos >= rEntries.getLength())
- return;
- uno::Sequence< uno::Reference< XDictionaryEntry > > aTmp(rEntries.getLength() - 1);
- uno::Reference< XDictionaryEntry > * pOrig = rEntries.getArray();
- uno::Reference< XDictionaryEntry > * pTemp = aTmp.getArray();
- int nOffset = 0;
- for(int i = 0; i < aTmp.getLength(); i++)
- {
- if(nPos == i)
- nOffset++;
- pTemp[i] = pOrig[i + nOffset];
- }
-
- rEntries = aTmp;
-}
-
sal_Bool SAL_CALL DictionaryNeo::remove( const OUString& aWord )
throw(RuntimeException, std::exception)
{
@@ -916,22 +881,18 @@ sal_Bool SAL_CALL DictionaryNeo::remove( const OUString& aWord )
sal_Int32 nPos;
bool bFound = seekEntry( aWord, &nPos );
- DBG_ASSERT( nCount < aEntries.getLength(),
- "lng : wrong number of entries");
- DBG_ASSERT(!bFound || nPos < nCount, "lng : index out of range");
+ DBG_ASSERT(!bFound || nPos < (sal_Int32)aEntries.size(), "lng : index out of range");
// remove element if found
if (bFound)
{
// entry to be removed
uno::Reference< XDictionaryEntry >
- xDicEntry( aEntries.getConstArray()[ nPos ] );
+ xDicEntry( aEntries[ nPos ] );
DBG_ASSERT(xDicEntry.is(), "lng : dictionary entry is NULL");
- nCount--;
+ aEntries.erase(aEntries.begin() + nPos);
- //! the following call reduces the length of the sequence by 1 also
- lcl_SequenceRemoveElementAt( aEntries, nPos );
bRemoved = bIsModified = true;
launchEvent( DictionaryEventFlags::DEL_ENTRY, xDicEntry );
@@ -948,7 +909,7 @@ sal_Bool SAL_CALL DictionaryNeo::isFull( )
if (bNeedEntries)
loadEntries( aMainURL );
- return nCount >= DIC_MAX_ENTRIES;
+ return aEntries.size() >= DIC_MAX_ENTRIES;
}
uno::Sequence< uno::Reference< XDictionaryEntry > >
@@ -959,10 +920,7 @@ uno::Sequence< uno::Reference< XDictionaryEntry > >
if (bNeedEntries)
loadEntries( aMainURL );
- //! return sequence with length equal to the number of dictionary entries
- //! (internal used sequence may have additional unused elements.)
- return uno::Sequence< uno::Reference< XDictionaryEntry > >
- (aEntries.getConstArray(), nCount);
+ return comphelper::containerToSequence(aEntries);
}
@@ -971,12 +929,11 @@ void SAL_CALL DictionaryNeo::clear( )
{
MutexGuard aGuard( GetLinguMutex() );
- if (!bIsReadonly && nCount)
+ if (!bIsReadonly && !aEntries.empty())
{
- // release all references to old entries and provide space for new ones
- aEntries = uno::Sequence< uno::Reference< XDictionaryEntry > > ( 32 );
+ // release all references to old entries
+ aEntries.clear();
- nCount = 0;
bNeedEntries = false;
bIsModified = true;
diff --git a/linguistic/source/dicimp.hxx b/linguistic/source/dicimp.hxx
index 321a47b..e1bf146 100644
--- a/linguistic/source/dicimp.hxx
+++ b/linguistic/source/dicimp.hxx
@@ -43,13 +43,12 @@ class DictionaryNeo :
>
{
- ::comphelper::OInterfaceContainerHelper2 aDicEvtListeners;
- css::uno::Sequence< css::uno::Reference< css::linguistic2::XDictionaryEntry > >
+ ::comphelper::OInterfaceContainerHelper2 aDicEvtListeners;
+ std::vector< css::uno::Reference< css::linguistic2::XDictionaryEntry > >
aEntries;
OUString aDicName;
OUString aMainURL;
css::linguistic2::DictionaryType eDicType;
- sal_Int16 nCount;
sal_Int16 nLanguage;
sal_Int16 nDicVersion;
bool bNeedEntries;
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index 7aee242..d648583 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -65,8 +65,8 @@ class DicEvtListenerHelper :
XDictionaryEventListener
>
{
- comphelper::OInterfaceContainerHelper2 aDicListEvtListeners;
- uno::Sequence< DictionaryEvent > aCollectDicEvt;
+ comphelper::OInterfaceContainerHelper2 aDicListEvtListeners;
+ std::vector< DictionaryEvent > aCollectDicEvt;
uno::Reference< XDictionaryList > xMyDicList;
sal_Int16 nCondensedEvt;
@@ -198,9 +198,7 @@ void SAL_CALL DicEvtListenerHelper::processDictionaryEvent(
// update list of collected events if needs to be
if (nNumVerboseListeners > 0)
{
- sal_Int32 nColEvts = aCollectDicEvt.getLength();
- aCollectDicEvt.realloc( nColEvts + 1 );
- aCollectDicEvt.getArray()[ nColEvts ] = rDicEvent;
+ aCollectDicEvt.push_back(rDicEvent);
}
if (nNumCollectEvtListeners == 0 && nCondensedEvt != 0)
@@ -247,7 +245,7 @@ sal_Int16 DicEvtListenerHelper::FlushEvents()
// build DictionaryListEvent to pass on to listeners
uno::Sequence< DictionaryEvent > aDicEvents;
if (nNumVerboseListeners > 0)
- aDicEvents = aCollectDicEvt;
+ aDicEvents = comphelper::containerToSequence(aCollectDicEvt);
DictionaryListEvent aEvent( xMyDicList, nCondensedEvt, aDicEvents );
// pass on event
@@ -255,7 +253,7 @@ sal_Int16 DicEvtListenerHelper::FlushEvents()
// clear "list" of events
nCondensedEvt = 0;
- aCollectDicEvt.realloc( 0 );
+ aCollectDicEvt.clear();
}
return nNumCollectEvtListeners;
@@ -627,12 +625,11 @@ void DicList::_CreateDicList()
// look for dictionaries
const OUString aWriteablePath( GetDictionaryWriteablePath() );
- uno::Sequence< OUString > aPaths( GetDictionaryPaths() );
- const OUString *pPaths = aPaths.getConstArray();
- for (sal_Int32 i = 0; i < aPaths.getLength(); ++i)
+ std::vector< OUString > aPaths( GetDictionaryPaths() );
+ for (size_t i = 0; i < aPaths.size(); ++i)
{
- const bool bIsWriteablePath = (pPaths[i] == aWriteablePath);
- SearchForDictionaries( aDicList, pPaths[i], bIsWriteablePath );
+ const bool bIsWriteablePath = (aPaths[i] == aWriteablePath);
+ SearchForDictionaries( aDicList, aPaths[i], bIsWriteablePath );
}
// create IgnoreAllList dictionary with empty URL (non persistent)
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 643c5a6..d77a372 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -1613,7 +1613,7 @@ uno::Sequence< lang::Locale > SAL_CALL
}
static bool IsEqSvcList( const uno::Sequence< OUString > &rList1,
- const uno::Sequence< OUString > &rList2 )
+ const uno::Sequence< OUString > &rList2 )
{
// returns true iff both sequences are equal
diff --git a/linguistic/source/misc2.cxx b/linguistic/source/misc2.cxx
index c5f6a1f..bf99fdc 100644
--- a/linguistic/source/misc2.cxx
+++ b/linguistic/source/misc2.cxx
@@ -74,11 +74,11 @@ bool FileExists( const OUString &rMainURL )
return bExists;
}
-static uno::Sequence< OUString > GetMultiPaths_Impl(
+static std::vector< OUString > GetMultiPaths_Impl(
const OUString &rPathPrefix,
DictionaryPathFlags nPathFlags )
{
- uno::Sequence< OUString > aRes;
+ std::vector< OUString > aRes;
uno::Sequence< OUString > aInternalPaths;
uno::Sequence< OUString > aUserPaths;
OUString aWritablePath;
@@ -110,11 +110,10 @@ static uno::Sequence< OUString > GetMultiPaths_Impl(
sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
if (!aWritablePath.isEmpty())
++nMaxEntries;
- aRes.realloc( nMaxEntries );
- OUString *pRes = aRes.getArray();
+ aRes.resize( nMaxEntries );
sal_Int32 nCount = 0; // number of actually added entries
if ((nPathFlags & DictionaryPathFlags::WRITABLE) && !aWritablePath.isEmpty())
- pRes[ nCount++ ] = aWritablePath;
+ aRes[ nCount++ ] = aWritablePath;
for (int i = 0; i < 2; ++i)
{
const uno::Sequence< OUString > &rPathSeq = i == 0 ? aUserPaths : aInternalPaths;
@@ -124,10 +123,10 @@ static uno::Sequence< OUString > GetMultiPaths_Impl(
const bool bAddUser = &rPathSeq == &aUserPaths && (nPathFlags & DictionaryPathFlags::USER);
const bool bAddInternal = &rPathSeq == &aInternalPaths && (nPathFlags & DictionaryPathFlags::INTERNAL);
if ((bAddUser || bAddInternal) && !pPathSeq[k].isEmpty())
- pRes[ nCount++ ] = pPathSeq[k];
+ aRes[ nCount++ ] = pPathSeq[k];
}
}
- aRes.realloc( nCount );
+ aRes.resize( nCount );
}
return aRes;
@@ -135,15 +134,15 @@ static uno::Sequence< OUString > GetMultiPaths_Impl(
OUString GetDictionaryWriteablePath()
{
- uno::Sequence< OUString > aPaths( GetMultiPaths_Impl( "Dictionary", DictionaryPathFlags::WRITABLE ) );
- DBG_ASSERT( aPaths.getLength() == 1, "Dictionary_writable path corrupted?" );
+ std::vector< OUString > aPaths( GetMultiPaths_Impl( "Dictionary", DictionaryPathFlags::WRITABLE ) );
+ DBG_ASSERT( aPaths.size() == 1, "Dictionary_writable path corrupted?" );
OUString aRes;
- if (aPaths.getLength() > 0)
+ if (aPaths.size() > 0)
aRes = aPaths[0];
return aRes;
}
-uno::Sequence< OUString > GetDictionaryPaths()
+std::vector< OUString > GetDictionaryPaths()
{
return GetMultiPaths_Impl( "Dictionary", PATH_FLAG_ALL );
}
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 26010a1..e1d86ba 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -28,6 +28,7 @@
#include <cppuhelper/factory.hxx>
#include <unotools/localedatawrapper.hxx>
#include <comphelper/processfactory.hxx>
+#include <comphelper/sequence.hxx>
#include <tools/debug.hxx>
#include <svl/lngmisc.hxx>
#include <osl/mutex.hxx>
@@ -49,7 +50,7 @@ using namespace linguistic;
// ProposalList: list of proposals for misspelled words
-// The order of strings in the array should be left unchanged because the
+// The order of strings in the array should be left unchanged because the
// spellchecker should have put the more likely suggestions at the top.
// New entries will be added to the end but duplicates are to be avoided.
// Removing entries is done by assigning the empty string.
@@ -69,7 +70,7 @@ public:
void Append( const OUString &rNew );
void Append( const std::vector< OUString > &rNew );
void Append( const Sequence< OUString > &rNew );
- Sequence< OUString > GetSequence() const;
+ std::vector< OUString > GetVector() const;
};
@@ -134,19 +135,18 @@ size_t ProposalList::Count() const
return nRes;
}
-Sequence< OUString > ProposalList::GetSequence() const
+std::vector< OUString > ProposalList::GetVector() const
{
sal_Int32 nCount = Count();
sal_Int32 nIdx = 0;
- Sequence< OUString > aRes( nCount );
- OUString *pRes = aRes.getArray();
+ std::vector< OUString > aRes( nCount );
sal_Int32 nLen = aVec.size();
for (sal_Int32 i = 0; i < nLen; ++i)
{
const OUString &rText = aVec[i];
- DBG_ASSERT( nIdx < nCount, "index our of range" );
+ DBG_ASSERT( nIdx < nCount, "index out of range" );
if (nIdx < nCount && !rText.isEmpty())
- pRes[ nIdx++ ] = rText;
+ aRes[ nIdx++ ] = rText;
}
return aRes;
}
@@ -715,7 +715,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
std::vector< OUString > aDicListProps; // list of proposals from user-dictionaries
SearchSimilarText( aChkWord, nLanguage, xDList, aDicListProps );
aProposalList.Append( aDicListProps );
- Sequence< OUString > aProposals = aProposalList.GetSequence();
+ std::vector< OUString > aProposals = aProposalList.GetVector();
// remove entries listed in negative dictionaries
// (we don't want to display suggestions that will be regarded as misspelled later on)
@@ -725,7 +725,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
uno::Reference< linguistic2::XSetSpellAlternatives > xSetAlt( xRes, uno::UNO_QUERY );
if (xSetAlt.is())
{
- xSetAlt->setAlternatives( aProposals );
+ xSetAlt->setAlternatives( comphelper::containerToSequence(aProposals) );
xSetAlt->setFailureType( eFailureType );
}
else
@@ -734,12 +734,12 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
{
DBG_ASSERT( false, "XSetSpellAlternatives not implemented!" );
}
- else if (aProposals.getLength() > 0)
+ else if (!aProposals.empty())
{
// no xRes but Proposals found from the user-dictionaries.
// Thus we need to create an xRes...
xRes = new linguistic::SpellAlternatives( rWord, nLanguage,
- SpellFailure::IS_NEGATIVE_WORD, aProposals );
+ SpellFailure::IS_NEGATIVE_WORD, comphelper::containerToSequence(aProposals) );
}
}
}
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index 001fbe9..6a0a938 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -46,15 +46,14 @@ namespace linguistic
#define MAX_PROPOSALS 40
bool SeqHasEntry(
- const Sequence< OUString > &rSeq,
+ const std::vector< OUString > &rSeq,
const OUString &rTxt)
{
bool bRes = false;
- sal_Int32 nLen = rSeq.getLength();
- const OUString *pEntry = rSeq.getConstArray();
- for (sal_Int32 i = 0; i < nLen && !bRes; ++i)
+ sal_Int32 nLen = rSeq.size();
+ for (sal_Int32 i = 0; i < nLen && !bRes; ++i)
{
- if (rTxt == pEntry[i])
+ if (rTxt == rSeq[i])
bRes = true;
}
return bRes;
@@ -107,26 +106,25 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
}
-void SeqRemoveNegEntries( Sequence< OUString > &rSeq,
+void SeqRemoveNegEntries( std::vector< OUString > &rSeq,
Reference< XSearchableDictionaryList > &rxDicList,
sal_Int16 nLanguage )
{
bool bSthRemoved = false;
- sal_Int32 nLen = rSeq.getLength();
- OUString *pEntries = rSeq.getArray();
+ sal_Int32 nLen = rSeq.size();
for (sal_Int32 i = 0; i < nLen; ++i)
{
Reference< XDictionaryEntry > xNegEntry( SearchDicList( rxDicList,
- pEntries[i], nLanguage, false, true ) );
+ rSeq[i], nLanguage, false, true ) );
if (xNegEntry.is())
{
- pEntries[i].clear();
+ rSeq[i].clear();
bSthRemoved = true;
}
}
if (bSthRemoved)
{
- Sequence< OUString > aNew;
+ std::vector< OUString > aNew;
// merge sequence without duplicates and empty strings in new empty sequence
aNew = MergeProposalSeqs( aNew, rSeq, false );
rSeq = aNew;
@@ -134,42 +132,39 @@ void SeqRemoveNegEntries( Sequence< OUString > &rSeq,
}
-Sequence< OUString > MergeProposalSeqs(
- Sequence< OUString > &rAlt1,
- Sequence< OUString > &rAlt2,
+std::vector< OUString > MergeProposalSeqs(
+ std::vector< OUString > &rAlt1,
+ std::vector< OUString > &rAlt2,
bool bAllowDuplicates )
{
- Sequence< OUString > aMerged;
+ std::vector< OUString > aMerged;
- if (0 == rAlt1.getLength() && bAllowDuplicates)
+ if (rAlt1.empty() && bAllowDuplicates)
aMerged = rAlt2;
- else if (0 == rAlt2.getLength() && bAllowDuplicates)
+ else if (rAlt2.empty() && bAllowDuplicates)
aMerged = rAlt1;
else
{
- sal_Int32 nAltCount1 = rAlt1.getLength();
- const OUString *pAlt1 = rAlt1.getConstArray();
- sal_Int32 nAltCount2 = rAlt2.getLength();
- const OUString *pAlt2 = rAlt2.getConstArray();
+ size_t nAltCount1 = rAlt1.size();
+ size_t nAltCount2 = rAlt2.size();
- sal_Int32 nCountNew = std::min( nAltCount1 + nAltCount2, (sal_Int32) MAX_PROPOSALS );
- aMerged.realloc( nCountNew );
- OUString *pMerged = aMerged.getArray();
+ sal_Int32 nCountNew = std::min<sal_Int32>( nAltCount1 + nAltCount2, (sal_Int32) MAX_PROPOSALS );
+ aMerged.resize( nCountNew );
sal_Int32 nIndex = 0;
sal_Int32 i = 0;
for (int j = 0; j < 2; j++)
{
- sal_Int32 nCount = j == 0 ? nAltCount1 : nAltCount2;
- const OUString *pAlt = j == 0 ? pAlt1 : pAlt2;
+ sal_Int32 nCount = j == 0 ? nAltCount1 : nAltCount2;
+ std::vector< OUString >& rAlt = j == 0 ? rAlt1 : rAlt2;
for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++)
{
- if (!pAlt[i].isEmpty() &&
- (bAllowDuplicates || !SeqHasEntry(aMerged, pAlt[i] )))
- pMerged[ nIndex++ ] = pAlt[ i ];
+ if (!rAlt[i].isEmpty() &&
+ (bAllowDuplicates || !SeqHasEntry(aMerged, rAlt[i] )))
+ aMerged[ nIndex++ ] = rAlt[ i ];
}
}
- aMerged.realloc( nIndex );
+ aMerged.resize( nIndex );
}
return aMerged;
More information about the Libreoffice-commits
mailing list