accessibility/inc/accessibility/helper/characterattributeshelper.hxx | 2 accessibility/source/helper/characterattributeshelper.cxx | 65 - canvas/source/vcl/textlayout.cxx | 6 chart2/source/controller/dialogs/res_DataLabel.cxx | 6 chart2/source/controller/dialogs/tp_SeriesToAxis.cxx | 8 chart2/source/tools/InternalDataProvider.cxx | 40 cui/source/tabpages/border.cxx | 3 dbaccess/source/ui/app/AppDetailPageHelper.cxx | 3 desktop/source/migration/migration.cxx | 403 +++------- desktop/source/migration/migration_impl.hxx | 2 extensions/source/propctrlr/eventhandler.cxx | 19 extensions/source/propctrlr/eventhandler.hxx | 4 filter/source/pdf/pdfexport.cxx | 9 filter/source/svg/svgexport.cxx | 10 filter/source/svg/svgfilter.cxx | 2 filter/source/svg/svgfilter.hxx | 4 forms/source/component/ListBox.cxx | 8 include/svl/ilstitem.hxx | 10 include/svx/SmartTagMgr.hxx | 2 include/vcl/throbber.hxx | 1 sc/source/ui/vba/vbachartobjects.cxx | 7 sc/source/ui/view/tabvwsh3.cxx | 2 svl/source/items/ilstitem.cxx | 24 svx/source/smarttags/SmartTagMgr.cxx | 8 sw/inc/crsrsh.hxx | 2 sw/source/core/crsr/crsrsh.cxx | 19 sw/source/uibase/shells/textsh1.cxx | 4 toolkit/source/awt/animatedimagespeer.cxx | 6 vcl/source/control/throbber.cxx | 10 29 files changed, 269 insertions(+), 420 deletions(-)
New commits: commit 93122eb06abf77252f01a8a255fc28348efca911 Author: Noel Grandin <[email protected]> Date: Thu Dec 3 12:49:56 2015 +0200 uno::Sequence->std::vector in vcl::Throbber Change-Id: I9240cd2240940e03e895a7544c9f51a29b048355 diff --git a/include/vcl/throbber.hxx b/include/vcl/throbber.hxx index 1701383..be9ee33 100644 --- a/include/vcl/throbber.hxx +++ b/include/vcl/throbber.hxx @@ -62,7 +62,6 @@ public: void stop(); bool isRunning() const; - void setImageList( const css::uno::Sequence< css::uno::Reference< css::graphic::XGraphic > >& ImageList ); void setImageList( ::std::vector< Image > const& i_images ); // default images diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index 14876ea..fa97076 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -244,12 +244,12 @@ namespace toolkit } // found a set? - Sequence< Reference< XGraphic > > aImages; + std::vector< Image > aImages; if ( ( nPreferredSet >= 0 ) && ( size_t( nPreferredSet ) < nImageSetCount ) ) { // => set the images ::std::vector< CachedImage > const& rImageSet( i_data.aCachedImageSets[ nPreferredSet ] ); - aImages.realloc( rImageSet.size() ); + aImages.resize( rImageSet.size() ); sal_Int32 imageIndex = 0; for ( ::std::vector< CachedImage >::const_iterator cachedImage = rImageSet.begin(); cachedImage != rImageSet.end(); @@ -257,7 +257,7 @@ namespace toolkit ) { lcl_ensureImage_throw( xGraphicProvider, isHighContrast, *cachedImage ); - aImages[ imageIndex ] = cachedImage->xGraphic; + aImages[ imageIndex ] = Image(cachedImage->xGraphic); } } pThrobber->setImageList( aImages ); diff --git a/vcl/source/control/throbber.cxx b/vcl/source/control/throbber.cxx index dc711c9..dff1a7c 100644 --- a/vcl/source/control/throbber.cxx +++ b/vcl/source/control/throbber.cxx @@ -192,16 +192,6 @@ void Throbber::setImageList( ::std::vector< Image > const& i_images ) SetImage( aInitialImage ); } -void Throbber::setImageList( const Sequence< Reference< XGraphic > >& rImageList ) -{ - ::std::vector< Image > aImages( rImageList.getLength() ); - for (sal_Int32 i = 0; i < rImageList.getLength(); ++i) - { - aImages[i] = Image(rImageList[i]); - } - setImageList( aImages ); -} - ::std::vector< OUString > Throbber::getDefaultImageURLs( const ImageSet i_imageSet ) { ::std::vector< OUString > aImageURLs; commit 2b17ec2175e288b92044092166d5b885978cecff Author: Noel Grandin <[email protected]> Date: Thu Dec 3 12:38:01 2015 +0200 uno:Sequence->std::vector in SmartTagMgr Change-Id: I163f7d6c0f30ac2929df1cae202e695d21bb49fc diff --git a/include/svx/SmartTagMgr.hxx b/include/svx/SmartTagMgr.hxx index 744ff9c..3a3b308 100644 --- a/include/svx/SmartTagMgr.hxx +++ b/include/svx/SmartTagMgr.hxx @@ -172,7 +172,7 @@ public: @param rActionIndicesSequence Output parameter */ - void GetActionSequences( css::uno::Sequence < OUString >& rSmartTagTypes, + void GetActionSequences( std::vector< OUString >& rSmartTagTypes, css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& rActionComponentsSequence, css::uno::Sequence < css::uno::Sequence< sal_Int32 > >& rActionIndicesSequence ) const; diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index 6c523cf..ee99934 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -152,14 +152,14 @@ void SmartTagMgr::RecognizeTextRange(const Reference< text::XTextRange>& xRange, typedef std::multimap < OUString, ActionReference >::const_iterator SmartTagMapIter; -void SmartTagMgr::GetActionSequences( Sequence < OUString >& rSmartTagTypes, +void SmartTagMgr::GetActionSequences( std::vector< OUString >& rSmartTagTypes, Sequence < Sequence< Reference< smarttags::XSmartTagAction > > >& rActionComponentsSequence, Sequence < Sequence< sal_Int32 > >& rActionIndicesSequence ) const { - rActionComponentsSequence.realloc( rSmartTagTypes.getLength() ); - rActionIndicesSequence.realloc( rSmartTagTypes.getLength() ); + rActionComponentsSequence.realloc( rSmartTagTypes.size() ); + rActionIndicesSequence.realloc( rSmartTagTypes.size() ); - for ( sal_Int32 j = 0; j < rSmartTagTypes.getLength(); ++j ) + for ( size_t j = 0; j < rSmartTagTypes.size(); ++j ) { const OUString& rSmartTagType = rSmartTagTypes[j]; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 13d8c0c..85f6625 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -772,7 +772,7 @@ public: void GetSmartTagRect( const Point& rPt, SwRect& rSelectRect ); // get smart tags at current cursor position - void GetSmartTagTerm( css::uno::Sequence< OUString >& rSmartTagTypes, + void GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes, css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps, css::uno::Reference<css::text::XTextRange>& rRange ) const; diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 22afa51..47b9085 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -3365,12 +3365,11 @@ void SwCursorShell::dumpAsXml(xmlTextWriterPtr pWriter) const xmlTextWriterEndElement(pWriter); } -static void lcl_FillRecognizerData( uno::Sequence< OUString >& rSmartTagTypes, +static void lcl_FillRecognizerData( std::vector< OUString >& rSmartTagTypes, uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps, const SwWrongList& rSmartTagList, sal_Int32 nCurrent ) { // Insert smart tag information - std::vector< OUString > aSmartTagTypes; std::vector< uno::Reference< container::XStringKeyMap > > aStringKeyMaps; for ( sal_uInt16 i = 0; i < rSmartTagList.Count(); ++i ) @@ -3383,24 +3382,18 @@ static void lcl_FillRecognizerData( uno::Sequence< OUString >& rSmartTagTypes, const SwWrongArea* pArea = rSmartTagList.GetElement( i ); if ( pArea ) { - aSmartTagTypes.push_back( pArea->maType ); + rSmartTagTypes.push_back( pArea->maType ); aStringKeyMaps.push_back( pArea->mxPropertyBag ); } } } - if ( !aSmartTagTypes.empty() ) + if ( !rSmartTagTypes.empty() ) { - rSmartTagTypes.realloc( aSmartTagTypes.size() ); - rStringKeyMaps.realloc( aSmartTagTypes.size() ); - - std::vector< OUString >::const_iterator aTypesIter = aSmartTagTypes.begin(); - sal_uInt16 i = 0; - for ( aTypesIter = aSmartTagTypes.begin(); aTypesIter != aSmartTagTypes.end(); ++aTypesIter ) - rSmartTagTypes[i++] = *aTypesIter; + rStringKeyMaps.realloc( rSmartTagTypes.size() ); std::vector< uno::Reference< container::XStringKeyMap > >::const_iterator aMapsIter = aStringKeyMaps.begin(); - i = 0; + sal_uInt16 i = 0; for ( aMapsIter = aStringKeyMaps.begin(); aMapsIter != aStringKeyMaps.end(); ++aMapsIter ) rStringKeyMaps[i++] = *aMapsIter; } @@ -3423,7 +3416,7 @@ static void lcl_FillTextRange( uno::Reference<text::XTextRange>& rRange, rRange = xRange; } -void SwCursorShell::GetSmartTagTerm( uno::Sequence< OUString >& rSmartTagTypes, +void SwCursorShell::GetSmartTagTerm( std::vector< OUString >& rSmartTagTypes, uno::Sequence< uno::Reference< container::XStringKeyMap > >& rStringKeyMaps, uno::Reference< text::XTextRange>& rRange ) const { diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 1961204..b768d05 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1780,13 +1780,13 @@ void SwTextShell::GetState( SfxItemSet &rSet ) break; case SID_OPEN_SMARTTAGMENU: { - uno::Sequence< OUString > aSmartTagTypes; + std::vector< OUString > aSmartTagTypes; uno::Sequence< uno::Reference< container::XStringKeyMap > > aStringKeyMaps; uno::Reference<text::XTextRange> xRange; rSh.GetSmartTagTerm( aSmartTagTypes, aStringKeyMaps, xRange ); - if ( xRange.is() && aSmartTagTypes.getLength() ) + if ( xRange.is() && !aSmartTagTypes.empty() ) { uno::Sequence < uno::Sequence< uno::Reference< smarttags::XSmartTagAction > > > aActionComponentsSequence; uno::Sequence < uno::Sequence< sal_Int32 > > aActionIndicesSequence; commit e6721d2d17f5f34dcac14c3379521bb7fb6b8c03 Author: Noel Grandin <[email protected]> Date: Thu Dec 3 12:03:14 2015 +0200 uno::Sequence->std::vector in SfxIntegerListItem Change-Id: Icdbb361feea2ebee74f9d0a906bdd3c2882443e8 diff --git a/chart2/source/controller/dialogs/res_DataLabel.cxx b/chart2/source/controller/dialogs/res_DataLabel.cxx index d6db8f8..5447040 100644 --- a/chart2/source/controller/dialogs/res_DataLabel.cxx +++ b/chart2/source/controller/dialogs/res_DataLabel.cxx @@ -133,13 +133,13 @@ DataLabelResources::DataLabelResources(VclBuilderContainer* pWindow, vcl::Window for( sal_Int32 nEnum=0; nEnum<m_pLB_LabelPlacement->GetEntryCount(); ++nEnum ) aPlacementToStringMap[nEnum] = m_pLB_LabelPlacement->GetEntry(static_cast<sal_uInt16>(nEnum)); - ::com::sun::star::uno::Sequence < sal_Int32 > aAvailabelPlacementList; + std::vector< sal_Int32 > aAvailabelPlacementList; const SfxPoolItem *pPoolItem = nullptr; if( rInAttrs.GetItemState(SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS, true, &pPoolItem) == SfxItemState::SET ) - aAvailabelPlacementList = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetConstSequence(); + aAvailabelPlacementList = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetList(); m_pLB_LabelPlacement->Clear(); - for( sal_Int32 nN=0; nN<aAvailabelPlacementList.getLength(); ++nN ) + for( size_t nN=0; nN<aAvailabelPlacementList.size(); ++nN ) { sal_uInt16 nListBoxPos = static_cast<sal_uInt16>( nN ); sal_Int32 nPlacement = aAvailabelPlacementList[nN]; diff --git a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx index 20617dd..f956ee6 100644 --- a/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx +++ b/chart2/source/controller/dialogs/tp_SeriesToAxis.cxx @@ -189,17 +189,17 @@ void SchOptionTabPage::Reset(const SfxItemSet* rInAttrs) //missing value treatment { - ::com::sun::star::uno::Sequence < sal_Int32 > aMissingValueTreatments; + std::vector< sal_Int32 > aMissingValueTreatments; if( rInAttrs->GetItemState(SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS, true, &pPoolItem) == SfxItemState::SET ) - aMissingValueTreatments =static_cast<const SfxIntegerListItem*>(pPoolItem)->GetConstSequence(); + aMissingValueTreatments = static_cast<const SfxIntegerListItem*>(pPoolItem)->GetList(); - if ( aMissingValueTreatments.getLength()>1 && rInAttrs->GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,true, &pPoolItem) == SfxItemState::SET) + if ( aMissingValueTreatments.size()>1 && rInAttrs->GetItemState(SCHATTR_MISSING_VALUE_TREATMENT,true, &pPoolItem) == SfxItemState::SET) { m_pRB_DontPaint->Enable(false); m_pRB_AssumeZero->Enable(false); m_pRB_ContinueLine->Enable(false); - for( sal_Int32 nN =0; nN<aMissingValueTreatments.getLength(); nN++ ) + for( sal_Int32 nN =0; nN<aMissingValueTreatments.size(); nN++ ) { sal_Int32 nVal = aMissingValueTreatments[nN]; if(nVal==::com::sun::star::chart::MissingValueTreatment::LEAVE_GAP) diff --git a/cui/source/tabpages/border.cxx b/cui/source/tabpages/border.cxx index 1c3f2a5..180fd28 100644 --- a/cui/source/tabpages/border.cxx +++ b/cui/source/tabpages/border.cxx @@ -162,8 +162,7 @@ SvxBorderTabPage::SvxBorderTabPage(vcl::Window* pParent, const SfxItemSet& rCore if (rCoreAttrs.HasItem(SID_ATTR_BORDER_STYLES, &pItem)) { const SfxIntegerListItem* p = static_cast<const SfxIntegerListItem*>(pItem); - std::vector<sal_Int32> aUsedStyles; - p->GetList(aUsedStyles); + std::vector<sal_Int32> aUsedStyles = p->GetList(); for (size_t i = 0, n = aUsedStyles.size(); i < n; ++i) maUsedBorderStyles.insert(static_cast<sal_Int16>(aUsedStyles[i])); } diff --git a/include/svl/ilstitem.hxx b/include/svl/ilstitem.hxx index bbcbe44..21156c8 100644 --- a/include/svl/ilstitem.hxx +++ b/include/svl/ilstitem.hxx @@ -27,7 +27,7 @@ class SVL_DLLPUBLIC SfxIntegerListItem : public SfxPoolItem { - css::uno::Sequence < sal_Int32 > m_aList; + std::vector < sal_Int32 > m_aList; public: static SfxPoolItem* CreateDefault(); @@ -37,12 +37,8 @@ public: SfxIntegerListItem( const SfxIntegerListItem& rItem ); virtual ~SfxIntegerListItem(); - css::uno::Sequence < sal_Int32 > GetSequence() - { return m_aList; } - css::uno::Sequence < sal_Int32 > GetConstSequence() const - { return (const_cast< SfxIntegerListItem * >(this))->GetSequence(); } - - void GetList( ::std::vector < sal_Int32 >& rList ) const; + std::vector< sal_Int32 >& GetList() { return m_aList; } + const std::vector< sal_Int32 >& GetList() const { return m_aList; } virtual bool operator==( const SfxPoolItem& ) const override; virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index 957fa3f..068b7fe 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -796,7 +796,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) ::std::vector < sal_Int32 > aIndexList; const SfxIntegerListItem* pItem = rReq.GetArg<SfxIntegerListItem>(SID_SELECT_TABLES); if ( pItem ) - pItem->GetList( aIndexList ); + aIndexList = pItem->GetList(); else { ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); diff --git a/svl/source/items/ilstitem.cxx b/svl/source/items/ilstitem.cxx index ca2acb7..c020901 100644 --- a/svl/source/items/ilstitem.cxx +++ b/svl/source/items/ilstitem.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <svl/ilstitem.hxx> @@ -33,24 +34,22 @@ SfxIntegerListItem::SfxIntegerListItem() SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const ::std::vector < sal_Int32 >& rList ) : SfxPoolItem( which ) + , m_aList( rList ) { - m_aList.realloc( rList.size() ); - for ( size_t n=0; n<rList.size(); ++n ) - m_aList[n] = rList[n]; } SfxIntegerListItem::SfxIntegerListItem( sal_uInt16 which, const css::uno::Sequence < sal_Int32 >& rList ) : SfxPoolItem( which ) { - m_aList.realloc( rList.getLength() ); + m_aList.resize( rList.getLength() ); for ( sal_Int32 n=0; n<rList.getLength(); ++n ) m_aList[n] = rList[n]; } SfxIntegerListItem::SfxIntegerListItem( const SfxIntegerListItem& rItem ) : SfxPoolItem( rItem ) + , m_aList( rItem.m_aList ) { - m_aList = rItem.m_aList; } SfxIntegerListItem::~SfxIntegerListItem() @@ -82,20 +81,17 @@ bool SfxIntegerListItem::PutValue ( const css::uno::Any& rVal, sal_uInt8 ) return true; } - return ( aNew >>= m_aList ); + css::uno::Sequence<sal_Int32> aTempSeq; + bool bRet = aNew >>= aTempSeq; + if (bRet) + m_aList = comphelper::sequenceToContainer<std::vector<sal_Int32>>(aTempSeq); + return bRet; } bool SfxIntegerListItem::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const { - rVal <<= m_aList; + rVal <<= comphelper::containerToSequence(m_aList); return true; } -void SfxIntegerListItem::GetList( ::std::vector< sal_Int32 >& rList ) const -{ - rList.reserve( m_aList.getLength() ); - for ( sal_Int32 n=0; n<m_aList.getLength(); ++n ) - rList.push_back( m_aList[n] ); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit ea297dd2020c03673745428381e8a2b11b83f23b Author: Noel Grandin <[email protected]> Date: Thu Dec 3 11:27:37 2015 +0200 use comphelper::containerToSequence() Change-Id: Ic4d3bcec7bda300bca6911a7472cafafdf12f5bd diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx index a777b25..af6a40e 100644 --- a/forms/source/component/ListBox.cxx +++ b/forms/source/component/ListBox.cxx @@ -44,6 +44,7 @@ #include <comphelper/numbers.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/listenernotification.hxx> +#include <comphelper/sequence.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/formattedcolumnvalue.hxx> #include <connectivity/dbconversion.hxx> @@ -1402,12 +1403,7 @@ namespace frm } // copy the indexes to the sequence - aSelectIndexes.realloc( aSelectionSet.size() ); - ::std::copy( - aSelectionSet.begin(), - aSelectionSet.end(), - aSelectIndexes.getArray() - ); + aSelectIndexes = comphelper::containerToSequence<sal_Int16>( aSelectionSet ); } break; diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index 0a9435d..abff0fa 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -30,6 +30,7 @@ #include "cellsuno.hxx" #include <vector> #include <basic/sberrors.hxx> +#include <comphelper/sequence.hxx> using namespace ::com::sun::star; using namespace ::ooo::vba; @@ -115,11 +116,7 @@ ScVbaChartObjects::getChartObjectNames() throw( css::script::BasicErrorException for (sal_Int32 n = 0; n < nChartNames; n++ ) aChartNamesVector.push_back(scurchartnames[n]); } - sChartNames.realloc( aChartNamesVector.size() ); - std::vector< OUString > ::const_iterator it = aChartNamesVector.begin(); - std::vector< OUString > ::const_iterator it_end = aChartNamesVector.end(); - for ( sal_Int32 index = 0 ; it != it_end; ++it, ++index ) - sChartNames[index] = *it; + sChartNames = comphelper::containerToSequence( aChartNamesVector ); } catch (uno::Exception& ) { commit 2a9adf0288048fdaad21a1d0ab32e1e86e9577ac Author: Noel Grandin <[email protected]> Date: Thu Dec 3 11:18:09 2015 +0200 uno::Sequence->std::vector Change-Id: Icbbf540e00be3baf222309a00b153cb34879dfd7 diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 93b4791..7634081 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -578,7 +578,7 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) if( xOStm.is() ) { - if( mSelectedPages.hasElements() && mMasterPageTargets.hasElements() ) + if( mSelectedPages.hasElements() && !mMasterPageTargets.empty() ) { Reference< XDocumentHandler > xDocHandler( implCreateExportDocumentHandler( xOStm ), UNO_QUERY ); @@ -599,7 +599,7 @@ bool SVGFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) implRegisterInterface( mSelectedPages[i] ); // create an id for each master page - for( sal_Int32 i = 0; i < mMasterPageTargets.getLength(); ++i ) + for( size_t i = 0; i < mMasterPageTargets.size(); ++i ) implRegisterInterface( mMasterPageTargets[i] ); try @@ -894,7 +894,7 @@ bool SVGFilter::implExportDocument() // #i124608# export a given object selection, so no MasterPage export at all if (!mbExportSelection) - implExportMasterPages( mMasterPageTargets, 0, mMasterPageTargets.getLength() - 1 ); + implExportMasterPages( mMasterPageTargets, 0, mMasterPageTargets.size() - 1 ); implExportDrawPages( mSelectedPages, 0, nLastPage ); if( !mbSinglePage ) @@ -1478,7 +1478,7 @@ bool SVGFilter::implGetPagePropSet( const Reference< XDrawPage > & rxPage ) -bool SVGFilter::implExportMasterPages( const SVGFilter::XDrawPageSequence & rxPages, +bool SVGFilter::implExportMasterPages( const std::vector< Reference< XDrawPage > > & rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ) { DBG_ASSERT( nFirstPage <= nLastPage, @@ -1896,7 +1896,7 @@ bool SVGFilter::implCreateObjects() sal_Int32 i, nCount; - for( i = 0, nCount = mMasterPageTargets.getLength(); i < nCount; ++i ) + for( i = 0, nCount = mMasterPageTargets.size(); i < nCount; ++i ) { const Reference< XDrawPage > & xMasterPage = mMasterPageTargets[i]; diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index 7fd4798..d7111e7 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -267,7 +267,7 @@ sal_Bool SAL_CALL SVGFilter::filter( const Sequence< PropertyValue >& rDescripto } } // Later we move them to a uno::Sequence so we can get them by index - mMasterPageTargets.realloc( aMasterPageTargetSet.size() ); + mMasterPageTargets.resize( aMasterPageTargetSet.size() ); ObjectSet::const_iterator aElem = aMasterPageTargetSet.begin(); for( sal_Int32 i = 0; aElem != aMasterPageTargetSet.end(); ++aElem, ++i) { diff --git a/filter/source/svg/svgfilter.hxx b/filter/source/svg/svgfilter.hxx index 5120cae..1651f09 100644 --- a/filter/source/svg/svgfilter.hxx +++ b/filter/source/svg/svgfilter.hxx @@ -242,7 +242,7 @@ private: Reference< XShapes > maShapeSelection; bool mbExportSelection; XDrawPageSequence mSelectedPages; - XDrawPageSequence mMasterPageTargets; + std::vector< Reference< XDrawPage > > mMasterPageTargets; Link<EditFieldInfo*,void> maOldFieldHdl; Link<EditFieldInfo*,void> maNewFieldHdl; @@ -263,7 +263,7 @@ private: bool implExportDocument(); bool implExportAnimations(); - bool implExportMasterPages( const XDrawPageSequence& rxPages, + bool implExportMasterPages( const std::vector< Reference< XDrawPage > >& rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ); bool implExportDrawPages( const XDrawPageSequence& rxPages, sal_Int32 nFirstPage, sal_Int32 nLastPage ); commit cccc9246bbfbaf70fe6946f9416c902af146110a Author: Noel Grandin <[email protected]> Date: Thu Dec 3 11:12:51 2015 +0200 use comphelper::containerToSequence Change-Id: Ibd3e5a2c465f74577f2acf93dc3558bca3a323fb diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index 3ad411e..458edd8 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -38,6 +38,7 @@ #include <vcl/graphicfilter.hxx> #include <vcl/settings.hxx> #include "svl/solar.hrc" +#include "comphelper/sequence.hxx" #include "comphelper/string.hxx" #include "comphelper/storagehelper.hxx" #include "unotools/streamwrap.hxx" @@ -1003,13 +1004,7 @@ void PDFExport::showErrors( const std::set< vcl::PDFWriter::ErrorCode >& rErrors if( ! rErrors.empty() && mxIH.is() ) { task::PDFExportException aExc; - aExc.ErrorCodes.realloc( sal_Int32(rErrors.size()) ); - sal_Int32 i = 0; - for( std::set< vcl::PDFWriter::ErrorCode >::const_iterator it = rErrors.begin(); - it != rErrors.end(); ++it, i++ ) - { - aExc.ErrorCodes.getArray()[i] = (sal_Int32)*it; - } + aExc.ErrorCodes = comphelper::containerToSequence<sal_Int32>( rErrors ); Reference< task::XInteractionRequest > xReq( new PDFErrorRequest( aExc ) ); mxIH->handle( xReq ); } commit 66068169220a9fc387e7002b69fc9e32b028cd8d Author: Noel Grandin <[email protected]> Date: Thu Dec 3 11:06:18 2015 +0200 uno::Sequence->std::vector, and fix method name Change-Id: Ie8df504e2ff29897527128ca634211d4e50c8810 diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index eea5124..7eac6de 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -715,27 +715,25 @@ namespace pcr m_bEventsMapInitialized = true; try { - Sequence< Type > aListeners; - impl_getCopmonentListenerTypes_nothrow( aListeners ); - sal_Int32 listenerCount = aListeners.getLength(); + std::vector< Type > aListeners; + impl_getComponentListenerTypes_nothrow( aListeners ); Property aCurrentProperty; OUString sListenerClassName; // loop through all listeners and all methods, and see which we can present at the UI - const Type* pListeners = aListeners.getConstArray(); - for ( sal_Int32 listener = 0; listener < listenerCount; ++listener, ++pListeners ) + for ( const Type& rListener : aListeners ) { aCurrentProperty = Property(); // the programmatic name of the listener, to be used as "property" name - sListenerClassName = pListeners->getTypeName(); + sListenerClassName = rListener.getTypeName(); OSL_ENSURE( !sListenerClassName.isEmpty(), "EventHandler::getSupportedProperties: strange - no listener name ..." ); if ( sListenerClassName.isEmpty() ) continue; // loop through all methods - Sequence< OUString > aMethods( comphelper::getEventMethodsForType( *pListeners ) ); + Sequence< OUString > aMethods( comphelper::getEventMethodsForType( rListener ) ); const OUString* pMethods = aMethods.getConstArray(); sal_uInt32 methodCount = aMethods.getLength(); @@ -969,9 +967,9 @@ namespace pcr } } - void EventHandler::impl_getCopmonentListenerTypes_nothrow( Sequence< Type >& _out_rTypes ) const + void EventHandler::impl_getComponentListenerTypes_nothrow( std::vector< Type >& _out_rTypes ) const { - _out_rTypes.realloc( 0 ); + _out_rTypes.clear(); try { // we use a set to avoid duplicates @@ -991,8 +989,7 @@ namespace pcr } // now that they're disambiguated, copy these types into our member - _out_rTypes.realloc( aListeners.size() ); - ::std::copy( aListeners.begin(), aListeners.end(), _out_rTypes.getArray() ); + std::copy(aListeners.begin(), aListeners.end(), std::back_inserter(_out_rTypes)); } catch( const Exception& ) { diff --git a/extensions/source/propctrlr/eventhandler.hxx b/extensions/source/propctrlr/eventhandler.hxx index e730a99..fb4e0be 100644 --- a/extensions/source/propctrlr/eventhandler.hxx +++ b/extensions/source/propctrlr/eventhandler.hxx @@ -175,8 +175,8 @@ namespace pcr @param _out_rTypes Takes, upon successful return, the types of possible listeners at the introspectee */ - void impl_getCopmonentListenerTypes_nothrow( - css::uno::Sequence< css::uno::Type >& _out_rTypes + void impl_getComponentListenerTypes_nothrow( + std::vector< css::uno::Type >& _out_rTypes ) const; /** returns a secondary component to be used for event inspection commit 591f138559d8de5de003e54f32bfecf12e17f0a6 Author: Noel Grandin <[email protected]> Date: Thu Dec 3 10:56:04 2015 +0200 uno::Sequence -> std::vector Change-Id: I8295505c4b83d23736c1da763eced7406b174409 diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index ce17708..7d321d5 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -72,7 +72,8 @@ using com::sun::star::uno::Exception; using namespace com::sun::star; -namespace desktop { +namespace desktop +{ static const char ITEM_DESCRIPTOR_COMMANDURL[] = "CommandURL"; static const char ITEM_DESCRIPTOR_CONTAINER[] = "ItemDescriptorContainer"; @@ -84,24 +85,18 @@ OUString retrieveLabelFromCommand(const OUString& sCommand, const OUString& sMod uno::Reference< container::XNameAccess > xUICommands; uno::Reference< container::XNameAccess > const xNameAccess( - frame::theUICommandDescription::get( - ::comphelper::getProcessComponentContext()) ); + frame::theUICommandDescription::get( + ::comphelper::getProcessComponentContext()) ); xNameAccess->getByName( sModuleIdentifier ) >>= xUICommands; - if (xUICommands.is()) - { - if ( !sCommand.isEmpty() ) - { + if (xUICommands.is()) { + if ( !sCommand.isEmpty() ) { OUString aStr; ::uno::Sequence< beans::PropertyValue > aPropSeq; - try - { + try { uno::Any a( xUICommands->getByName( sCommand )); - if ( a >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name == "Label" ) - { + if ( a >>= aPropSeq ) { + for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) { + if ( aPropSeq[i].Name == "Label" ) { aPropSeq[i].Value >>= aStr; break; } @@ -109,9 +104,7 @@ OUString retrieveLabelFromCommand(const OUString& sCommand, const OUString& sMod } sLabel = aStr; - } - catch (const container::NoSuchElementException&) - { + } catch (const container::NoSuchElementException&) { sLabel = sCommand; sal_Int32 nIndex = sLabel.indexOf(':'); if (nIndex>=0 && nIndex <= sLabel.getLength()-1) @@ -178,8 +171,8 @@ bool MigrationImpl::alreadyMigrated() // create migration stamp, and/or check its existence bool bRet = aFile.open (osl_File_OpenFlag_Write | osl_File_OpenFlag_Create | osl_File_OpenFlag_NoLock) == FileBase::E_EXIST; OSL_TRACE( "File '%s' exists? %d\n", - OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr(), - bRet ); + OUStringToOString(aStr, RTL_TEXTENCODING_ASCII_US).getStr(), + bRet ); return bRet; } @@ -213,12 +206,9 @@ void Migration::migrateSettingsIfNecessary() return; bool bResult = false; - try - { + try { bResult = aImpl.doMigration(); - } - catch (const Exception& e) - { + } catch (const Exception& e) { OString aMsg("doMigration() exception: "); aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); OSL_FAIL(aMsg.getStr()); @@ -242,8 +232,7 @@ bool MigrationImpl::doMigration() m_vrFileList = compileFileList(); bool result = false; - try - { + try { NewVersionUIInfo aNewVersionUIInfo; ::std::vector< MigrationModuleInfo > vModulesInfo = dectectUIChangesForAllModules(); aNewVersionUIInfo.init(vModulesInfo); @@ -252,8 +241,7 @@ bool MigrationImpl::doMigration() const OUString sMenubarResourceURL("private:resource/menubar/menubar"); const OUString sToolbarResourcePre("private:resource/toolbar/"); - for (size_t i=0; i<vModulesInfo.size(); ++i) - { + for (size_t i=0; i<vModulesInfo.size(); ++i) { OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName); if (sModuleIdentifier.isEmpty()) continue; @@ -268,16 +256,14 @@ bool MigrationImpl::doMigration() uno::Reference< embed::XStorage > xModules(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); uno::Reference< ui::XUIConfigurationManager2 > xOldCfgManager = ui::UIConfigurationManager::create(xContext); - if ( xModules.is() ) - { - xOldCfgManager->setStorage( xModules ); - xOldCfgManager->reload(); + if ( xModules.is() ) { + xOldCfgManager->setStorage( xModules ); + xOldCfgManager->reload(); } uno::Reference< ui::XUIConfigurationManager > xCfgManager = aNewVersionUIInfo.getConfigManager(vModulesInfo[i].sModuleShortName); - if (vModulesInfo[i].bHasMenubar) - { + if (vModulesInfo[i].bHasMenubar) { uno::Reference< container::XIndexContainer > xOldVersionMenuSettings(xOldCfgManager->getSettings(sMenubarResourceURL, sal_True), uno::UNO_QUERY); uno::Reference< container::XIndexContainer > xNewVersionMenuSettings = aNewVersionUIInfo.getNewMenubarSettings(vModulesInfo[i].sModuleShortName); OUString sParent; @@ -286,10 +272,8 @@ bool MigrationImpl::doMigration() } sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size(); - if (nToolbars >0) - { - for (sal_Int32 j=0; j<nToolbars; ++j) - { + if (nToolbars >0) { + for (sal_Int32 j=0; j<nToolbars; ++j) { OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; @@ -313,14 +297,12 @@ bool MigrationImpl::doMigration() refresh(); result = true; - } - catch (css::uno::Exception & e) - { + } catch (css::uno::Exception & e) { SAL_WARN( "desktop.migration", "ignored Exception \"" << e.Message - << "\" while migrating from version \"" << m_aInfo.productname - << "\" data \"" << m_aInfo.userdata << "\""); + << "\" while migrating from version \"" << m_aInfo.productname + << "\" data \"" << m_aInfo.userdata << "\""); } // prevent running the migration multiple times @@ -337,14 +319,11 @@ void MigrationImpl::refresh() void MigrationImpl::setMigrationCompleted() { - try - { + try { uno::Reference< XPropertySet > aPropertySet(getConfigAccess("org.openoffice.Setup/Office", true), uno::UNO_QUERY_THROW); aPropertySet->setPropertyValue("MigrationCompleted", uno::makeAny(sal_True)); uno::Reference< XChangesBatch >(aPropertySet, uno::UNO_QUERY_THROW)->commitChanges(); - } - catch (...) - { + } catch (...) { // fail silently } } @@ -357,15 +336,12 @@ bool MigrationImpl::checkMigrationCompleted() getConfigAccess("org.openoffice.Setup/Office"), uno::UNO_QUERY_THROW); aPropertySet->getPropertyValue("MigrationCompleted") >>= bMigrationCompleted; - if( !bMigrationCompleted && getenv("SAL_DISABLE_USERMIGRATION" ) ) - { + if( !bMigrationCompleted && getenv("SAL_DISABLE_USERMIGRATION" ) ) { // migration prevented - fake it's success setMigrationCompleted(); bMigrationCompleted = true; } - } - catch (const Exception&) - { + } catch (const Exception&) { // just return false... } OSL_TRACE( "Migration %s", bMigrationCompleted ? "already completed" : "not done" ); @@ -377,10 +353,8 @@ static void insertSorted(migrations_available& rAvailableMigrations, supported_m { bool bInserted( false ); migrations_available::iterator pIter = rAvailableMigrations.begin(); - while ( !bInserted && pIter != rAvailableMigrations.end()) - { - if ( pIter->nPriority < aSupportedMigration.nPriority ) - { + while ( !bInserted && pIter != rAvailableMigrations.end()) { + if ( pIter->nPriority < aSupportedMigration.nPriority ) { rAvailableMigrations.insert(pIter, aSupportedMigration ); bInserted = true; break; // i111193: insert invalidates iterator! @@ -400,8 +374,7 @@ bool MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigr const OUString aVersionIdentifiers( "VersionIdentifiers" ); const OUString aPriorityIdentifier( "Priority" ); - for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) - { + for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) { sal_Int32 nPriority( 0 ); uno::Sequence< OUString > seqVersions; uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW ); @@ -436,8 +409,7 @@ migrations_vr MigrationImpl::readMigrationSteps(const OUString& rMigrationName) uno::Reference< XNameAccess > tmpAccess2; uno::Sequence< OUString > tmpSeq; migrations_vr vrMigrations(new migrations_v); - for (sal_Int32 i = 0; i < seqMigrations.getLength(); i++) - { + for (sal_Int32 i = 0; i < seqMigrations.getLength(); i++) { // get current migration step theNameAccess->getByName(seqMigrations[i]) >>= tmpAccess; migration_step tmpStep; @@ -445,48 +417,40 @@ migrations_vr MigrationImpl::readMigrationSteps(const OUString& rMigrationName) // read included files from current step description OUString aSeqEntry; - if (tmpAccess->getByName("IncludedFiles") >>= tmpSeq) - { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - { + if (tmpAccess->getByName("IncludedFiles") >>= tmpSeq) { + for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) { aSeqEntry = tmpSeq[j]; tmpStep.includeFiles.push_back(aSeqEntry); } } // excluded files... - if (tmpAccess->getByName("ExcludedFiles") >>= tmpSeq) - { + if (tmpAccess->getByName("ExcludedFiles") >>= tmpSeq) { for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) tmpStep.excludeFiles.push_back(tmpSeq[j]); } // included nodes... - if (tmpAccess->getByName("IncludedNodes") >>= tmpSeq) - { + if (tmpAccess->getByName("IncludedNodes") >>= tmpSeq) { for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) tmpStep.includeConfig.push_back(tmpSeq[j]); } // excluded nodes... - if (tmpAccess->getByName("ExcludedNodes") >>= tmpSeq) - { + if (tmpAccess->getByName("ExcludedNodes") >>= tmpSeq) { for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) tmpStep.excludeConfig.push_back(tmpSeq[j]); } // included extensions... - if (tmpAccess->getByName("IncludedExtensions") >>= tmpSeq) - { + if (tmpAccess->getByName("IncludedExtensions") >>= tmpSeq) { for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) tmpStep.includeExtensions.push_back(tmpSeq[j]); } // excluded extensions... - if (tmpAccess->getByName("ExcludedExtensions") >>= tmpSeq) - { - for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) - { + if (tmpAccess->getByName("ExcludedExtensions") >>= tmpSeq) { + for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) { aSeqEntry = tmpSeq[j]; tmpStep.excludeExtensions.push_back(aSeqEntry); } @@ -503,8 +467,7 @@ migrations_vr MigrationImpl::readMigrationSteps(const OUString& rMigrationName) static FileBase::RC _checkAndCreateDirectory(INetURLObject& dirURL) { FileBase::RC result = Directory::create(dirURL.GetMainURL(INetURLObject::DECODE_TO_IURI)); - if (result == FileBase::E_NOENT) - { + if (result == FileBase::E_NOENT) { INetURLObject baseURL(dirURL); baseURL.removeSegment(); _checkAndCreateDirectory(baseURL); @@ -543,7 +506,7 @@ OUString MigrationImpl::preXDGConfigDir(const OUString& rConfigDir) // we have to add the '.' for the pre-XDG directory names aPreXDGConfigPath += "."; - return aPreXDGConfigPath; + return aPreXDGConfigPath; } #endif @@ -557,9 +520,8 @@ void MigrationImpl::setInstallInfoIfExist( osl::FileStatus stat(osl_FileStatus_Mask_Type); if (osl::DirectoryItem::get(url, item) == osl::FileBase::E_None - && item.getFileStatus(stat) == osl::FileBase::E_None - && stat.getFileType() == osl::FileStatus::Directory) - { + && item.getFileStatus(stat) == osl::FileBase::E_None + && stat.getFileType() == osl::FileStatus::Directory) { aInfo.userdata = url; aInfo.productname = rVersion; } @@ -579,12 +541,10 @@ install_info MigrationImpl::findInstallation(const strings_v& rVersions) install_info aInfo; strings_v::const_iterator i_ver = rVersions.begin(); - while (i_ver != rVersions.end()) - { + while (i_ver != rVersions.end()) { OUString aVersion, aProfileName; sal_Int32 nSeparatorIndex = (*i_ver).indexOf('='); - if ( nSeparatorIndex != -1 ) - { + if ( nSeparatorIndex != -1 ) { aVersion = (*i_ver).copy( 0, nSeparatorIndex ); aProfileName = (*i_ver).copy( nSeparatorIndex+1 ); } @@ -592,8 +552,7 @@ install_info MigrationImpl::findInstallation(const strings_v& rVersions) if ( !aVersion.isEmpty() && !aProfileName.isEmpty() && ( aInfo.userdata.isEmpty() || aProfileName.equalsIgnoreAsciiCase( - utl::ConfigManager::getProductName() ) ) ) - { + utl::ConfigManager::getProductName() ) ) ) { setInstallInfoIfExist(aInfo, aTopConfigDir + aProfileName, aVersion); #if defined UNX && ! defined MACOSX //try preXDG path if the new one does not exist @@ -613,11 +572,9 @@ sal_Int32 MigrationImpl::findPreferredMigrationProcess(const migrations_availabl sal_Int32 i( 0 ); migrations_available::const_iterator rIter = rAvailableMigrations.begin(); - while ( rIter != rAvailableMigrations.end() ) - { + while ( rIter != rAvailableMigrations.end() ) { install_info aInstallInfo = findInstallation(rIter->supported_versions); - if (!aInstallInfo.productname.isEmpty() ) - { + if (!aInstallInfo.productname.isEmpty() ) { m_aInfo = aInstallInfo; nIndex = i; break; @@ -640,8 +597,7 @@ strings_vr MigrationImpl::applyPatterns(const strings_v& vSet, const strings_v& strings_vr vrResult(new strings_v); strings_v::const_iterator i_set; strings_v::const_iterator i_pat = vPatterns.begin(); - while (i_pat != vPatterns.end()) - { + while (i_pat != vPatterns.end()) { // find matches for this pattern in input set // and copy them to the result SearchParam param(*i_pat, SearchParam::SRCH_REGEXP); @@ -649,8 +605,7 @@ strings_vr MigrationImpl::applyPatterns(const strings_v& vSet, const strings_v& i_set = vSet.begin(); sal_Int32 start = 0; sal_Int32 end = 0; - while (i_set != vSet.end()) - { + while (i_set != vSet.end()) { end = i_set->getLength(); if (ts.SearchForward(*i_set, &start, &end)) vrResult->push_back(*i_set); @@ -668,18 +623,15 @@ strings_vr MigrationImpl::getAllFiles(const OUString& baseURL) const // get sub dirs Directory dir(baseURL); - if (dir.open() == FileBase::E_None) - { + if (dir.open() == FileBase::E_None) { strings_v vSubDirs; strings_vr vrSubResult; // work through directory contents... DirectoryItem item; FileStatus fs(osl_FileStatus_Mask_Type | osl_FileStatus_Mask_FileURL); - while (dir.getNextItem(item) == FileBase::E_None) - { - if (item.getFileStatus(fs) == FileBase::E_None) - { + while (dir.getNextItem(item) == FileBase::E_None) { + if (item.getFileStatus(fs) == FileBase::E_None) { if (fs.getFileType() == FileStatus::Directory) vSubDirs.push_back(fs.getFileURL()); else @@ -689,8 +641,7 @@ strings_vr MigrationImpl::getAllFiles(const OUString& baseURL) const // recurse subfolders strings_v::const_iterator i = vSubDirs.begin(); - while (i != vSubDirs.end()) - { + while (i != vSubDirs.end()) { vrSubResult = getAllFiles(*i); vrResult->insert(vrResult->end(), vrSubResult->begin(), vrSubResult->end()); ++i; @@ -699,10 +650,12 @@ strings_vr MigrationImpl::getAllFiles(const OUString& baseURL) const return vrResult; } -namespace { +namespace +{ // removes elements of vector 2 in vector 1 -strings_v subtract(strings_v const & va, strings_v const & vb) { +strings_v subtract(strings_v const & va, strings_v const & vb) +{ strings_v a(va); std::sort(a.begin(), a.end()); strings_v::iterator ae(std::unique(a.begin(), a.end())); @@ -728,8 +681,7 @@ strings_vr MigrationImpl::compileFileList() // get a file list result for each migration step migrations_v::const_iterator i_migr = m_vrMigrations->begin(); - while (i_migr != m_vrMigrations->end()) - { + while (i_migr != m_vrMigrations->end()) { vrInclude = applyPatterns(*vrFiles, i_migr->includeFiles); vrExclude = applyPatterns(*vrFiles, i_migr->excludeFiles); strings_v sub(subtract(*vrInclude, *vrExclude)); @@ -739,7 +691,8 @@ strings_vr MigrationImpl::compileFileList() return vrResult; } -namespace { +namespace +{ struct componentParts { std::set< OUString > includedPaths; @@ -748,7 +701,8 @@ struct componentParts { typedef std::map< OUString, componentParts > Components; -bool getComponent(OUString const & path, OUString * component) { +bool getComponent(OUString const & path, OUString * component) +{ OSL_ASSERT(component != nullptr); if (path.isEmpty() || path[0] != '/') { OSL_TRACE( @@ -762,7 +716,8 @@ bool getComponent(OUString const & path, OUString * component) { return true; } -uno::Sequence< OUString > setToSeq(std::set< OUString > const & set) { +uno::Sequence< OUString > setToSeq(std::set< OUString > const & set) +{ std::set< OUString >::size_type n = set.size(); if (n > SAL_MAX_INT32) { throw std::bad_alloc(); @@ -770,8 +725,7 @@ uno::Sequence< OUString > setToSeq(std::set< OUString > const & set) { uno::Sequence< OUString > seq(static_cast< sal_Int32 >(n)); sal_Int32 i = 0; for (std::set< OUString >::const_iterator j(set.begin()); - j != set.end(); ++j) - { + j != set.end(); ++j) { seq[i++] = *j; } return seq; @@ -779,22 +733,20 @@ uno::Sequence< OUString > setToSeq(std::set< OUString > const & set) { } -void MigrationImpl::copyConfig() { +void MigrationImpl::copyConfig() +{ Components comps; for (migrations_v::const_iterator i(m_vrMigrations->begin()); - i != m_vrMigrations->end(); ++i) - { + i != m_vrMigrations->end(); ++i) { for (strings_v::const_iterator j(i->includeConfig.begin()); - j != i->includeConfig.end(); ++j) - { + j != i->includeConfig.end(); ++j) { OUString comp; if (getComponent(*j, &comp)) { comps[comp].includedPaths.insert(*j); } } for (strings_v::const_iterator j(i->excludeConfig.begin()); - j != i->excludeConfig.end(); ++j) - { + j != i->excludeConfig.end(); ++j) { OUString comp; if (getComponent(*j, &comp)) { comps[comp].excludedPaths.insert(*j); @@ -831,7 +783,7 @@ void MigrationImpl::copyConfig() { if (enc.isEmpty() && !seg.isEmpty()) { OSL_TRACE( ("configuration migration component %s ignored (cannot" - " be encoded as file path)"), + " be encoded as file path)"), OUStringToOString( i->first, RTL_TEXTENCODING_UTF8).getStr()); goto next; @@ -844,9 +796,9 @@ void MigrationImpl::copyConfig() { } configuration::Update::get( comphelper::getProcessComponentContext())-> - insertModificationXcuFile( - regFilePath, setToSeq(i->second.includedPaths), - setToSeq(i->second.excludedPaths)); + insertModificationXcuFile( + regFilePath, setToSeq(i->second.includedPaths), + setToSeq(i->second.excludedPaths)); } else { OSL_TRACE( ("configuration migration component %s ignored (only excludes," @@ -854,14 +806,15 @@ void MigrationImpl::copyConfig() { OUStringToOString( i->first, RTL_TEXTENCODING_UTF8).getStr()); } - next:; +next: + ; } } uno::Reference< XNameAccess > MigrationImpl::getConfigAccess(const sal_Char* pPath, bool bUpdate) { uno::Reference< XNameAccess > xNameAccess; - try{ + try { OUString sAccessSrvc; if (bUpdate) sAccessSrvc = "com.sun.star.configuration.ConfigurationUpdateAccess"; @@ -878,11 +831,9 @@ uno::Reference< XNameAccess > MigrationImpl::getConfigAccess(const sal_Char* pPa uno::Sequence< uno::Any > theArgs(1); theArgs[ 0 ] <<= sConfigURL; xNameAccess.set( - theConfigProvider->createInstanceWithArguments( + theConfigProvider->createInstanceWithArguments( sAccessSrvc, theArgs ), uno::UNO_QUERY_THROW ); - } - catch (const css::uno::Exception& e) - { + } catch (const css::uno::Exception& e) { SAL_WARN( "desktop.migration", "ignoring Exception \"" << e.Message << "\""); } @@ -897,14 +848,11 @@ void MigrationImpl::copyFiles() OUString userInstall; utl::Bootstrap::PathStatus aStatus; aStatus = utl::Bootstrap::locateUserInstallation(userInstall); - if (aStatus == utl::Bootstrap::PATH_EXISTS) - { - while (i_file != m_vrFileList->end()) - { + if (aStatus == utl::Bootstrap::PATH_EXISTS) { + while (i_file != m_vrFileList->end()) { // remove installation prefix from file localName = i_file->copy(m_aInfo.userdata.getLength()); - if (localName.endsWith( "/autocorr/acor_.dat")) - { + if (localName.endsWith( "/autocorr/acor_.dat")) { // Previous versions used an empty language tag for // LANGUAGE_DONTKNOW with the "[All]" autocorrection entry. // As of LibreOffice 4.0 it is 'und' for LANGUAGE_UNDETERMINED @@ -917,18 +865,15 @@ void MigrationImpl::copyFiles() aURL.removeSegment(); _checkAndCreateDirectory(aURL); FileBase::RC copyResult = File::copy(*i_file, destName); - if (copyResult != FileBase::E_None) - { + if (copyResult != FileBase::E_None) { OString msg("Cannot copy "); msg += OUStringToOString(*i_file, RTL_TEXTENCODING_UTF8) + " to " - + OUStringToOString(destName, RTL_TEXTENCODING_UTF8); + + OUStringToOString(destName, RTL_TEXTENCODING_UTF8); OSL_FAIL(msg.getStr()); } ++i_file; } - } - else - { + } else { OSL_FAIL("copyFiles: UserInstall does not exist"); } } @@ -938,9 +883,9 @@ void MigrationImpl::runServices() // Build argument array uno::Sequence< uno::Any > seqArguments(3); seqArguments[0] = uno::makeAny(NamedValue("Productname", - uno::makeAny(m_aInfo.productname))); + uno::makeAny(m_aInfo.productname))); seqArguments[1] = uno::makeAny(NamedValue("UserData", - uno::makeAny(m_aInfo.userdata))); + uno::makeAny(m_aInfo.userdata))); // create an instance of every migration service @@ -949,21 +894,18 @@ void MigrationImpl::runServices() uno::Reference< uno::XComponentContext > xContext(comphelper::getProcessComponentContext()); migrations_v::const_iterator i_mig = m_vrMigrations->begin(); - while (i_mig != m_vrMigrations->end()) - { - if( !i_mig->service.isEmpty()) - { + while (i_mig != m_vrMigrations->end()) { + if( !i_mig->service.isEmpty()) { - try - { + try { // set black list for extension migration uno::Sequence< OUString > seqExtBlackList; sal_uInt32 nSize = i_mig->excludeExtensions.size(); if ( nSize > 0 ) seqExtBlackList = comphelper::arrayToSequence< OUString >( - &i_mig->excludeExtensions[0], nSize ); + &i_mig->excludeExtensions[0], nSize ); seqArguments[2] = uno::makeAny(NamedValue("ExtensionBlackList", - uno::makeAny( seqExtBlackList ))); + uno::makeAny( seqExtBlackList ))); xMigrationJob.set( xContext->getServiceManager()->createInstanceWithArgumentsAndContext(i_mig->service, seqArguments, xContext), @@ -972,19 +914,15 @@ void MigrationImpl::runServices() xMigrationJob->execute(uno::Sequence< NamedValue >()); - } - catch (const Exception& e) - { + } catch (const Exception& e) { OString aMsg("Execution of migration service failed (Exception caught).\nService: "); aMsg += OUStringToOString(i_mig->service, RTL_TEXTENCODING_ASCII_US) + "\nMessage: "; aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); OSL_FAIL(aMsg.getStr()); - } - catch (...) - { + } catch (...) { OString aMsg("Execution of migration service failed (Exception caught).\nService: "); aMsg += OUStringToOString(i_mig->service, RTL_TEXTENCODING_ASCII_US) + - "\nNo message available"; + "\nNo message available"; OSL_FAIL(aMsg.getStr()); } @@ -1004,7 +942,7 @@ void MigrationImpl::runServices() lArgs[1] <<= embed::ElementModes::READ; uno::Reference< lang::XSingleServiceFactory > xStorageFactory( - embed::FileSystemStorageFactory::create(comphelper::getProcessComponentContext())); + embed::FileSystemStorageFactory::create(comphelper::getProcessComponentContext())); uno::Reference< embed::XStorage > xModules; xModules.set(xStorageFactory->createInstanceWithArguments(lArgs), uno::UNO_QUERY); @@ -1014,35 +952,29 @@ void MigrationImpl::runServices() uno::Reference< container::XNameAccess > xAccess(xModules, uno::UNO_QUERY); uno::Sequence< OUString > lNames = xAccess->getElementNames(); sal_Int32 nLength = lNames.getLength(); - for (sal_Int32 i=0; i<nLength; ++i) - { + for (sal_Int32 i=0; i<nLength; ++i) { OUString sModuleShortName = lNames[i]; uno::Reference< embed::XStorage > xModule = xModules->openStorageElement(sModuleShortName, embed::ElementModes::READ); - if (xModule.is()) - { + if (xModule.is()) { MigrationModuleInfo aModuleInfo; uno::Reference< embed::XStorage > xMenubar = xModule->openStorageElement(MENUBAR, embed::ElementModes::READ); - if (xMenubar.is()) - { + if (xMenubar.is()) { uno::Reference< container::XNameAccess > xNameAccess(xMenubar, uno::UNO_QUERY); - if (xNameAccess->getElementNames().getLength() > 0) - { + if (xNameAccess->getElementNames().getLength() > 0) { aModuleInfo.sModuleShortName = sModuleShortName; aModuleInfo.bHasMenubar = true; } } uno::Reference< embed::XStorage > xToolbar = xModule->openStorageElement(TOOLBAR, embed::ElementModes::READ); - if (xToolbar.is()) - { + if (xToolbar.is()) { const OUString RESOURCEURL_CUSTOM_ELEMENT("custom_"); sal_Int32 nCustomLen = 7; uno::Reference< container::XNameAccess > xNameAccess(xToolbar, uno::UNO_QUERY); ::uno::Sequence< OUString > lToolbars = xNameAccess->getElementNames(); - for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) - { + for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) { OUString sToolbarName = lToolbars[j]; if (sToolbarName.getLength()>=nCustomLen && sToolbarName.copy(0, nCustomLen).equals(RESOURCEURL_CUSTOM_ELEMENT)) @@ -1050,8 +982,7 @@ void MigrationImpl::runServices() aModuleInfo.sModuleShortName = sModuleShortName; sal_Int32 nIndex = sToolbarName.lastIndexOf('.'); - if (nIndex > 0) - { + if (nIndex > 0) { OUString sExtension(sToolbarName.copy(nIndex)); OUString sToolbarResourceName(sToolbarName.copy(0, nIndex)); if (!sToolbarResourceName.isEmpty() && sExtension == ".xml") @@ -1069,9 +1000,9 @@ void MigrationImpl::runServices() } void MigrationImpl::compareOldAndNewConfig(const OUString& sParent, - const uno::Reference< container::XIndexContainer >& xIndexOld, - const uno::Reference< container::XIndexContainer >& xIndexNew, - const OUString& sResourceURL) + const uno::Reference< container::XIndexContainer >& xIndexOld, + const uno::Reference< container::XIndexContainer >& xIndexNew, + const OUString& sResourceURL) { const OUString MENU_SEPARATOR(" | "); @@ -1081,13 +1012,10 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent, sal_Int32 nOldCount = xIndexOld->getCount(); sal_Int32 nNewCount = xIndexNew->getCount(); - for (int n=0; n<nOldCount; ++n) - { + for (int n=0; n<nOldCount; ++n) { MigrationItem aMigrationItem; - if (xIndexOld->getByIndex(n) >>= aProp) - { - for(int i=0; i<aProp.getLength(); ++i) - { + if (xIndexOld->getByIndex(n) >>= aProp) { + for(int i=0; i<aProp.getLength(); ++i) { if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) aProp[i].Value >>= aMigrationItem.m_sCommandURL; else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER ) @@ -1099,13 +1027,10 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent, } } - for (int n=0; n<nNewCount; ++n) - { + for (int n=0; n<nNewCount; ++n) { MigrationItem aMigrationItem; - if (xIndexNew->getByIndex(n) >>= aProp) - { - for(int i=0; i<aProp.getLength(); ++i) - { + if (xIndexNew->getByIndex(n) >>= aProp) { + for(int i=0; i<aProp.getLength(); ++i) { if ( aProp[i].Name == ITEM_DESCRIPTOR_COMMANDURL ) aProp[i].Value >>= aMigrationItem.m_sCommandURL; else if ( aProp[i].Name == ITEM_DESCRIPTOR_CONTAINER ) @@ -1120,29 +1045,22 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent, ::std::vector< MigrationItem >::iterator it; OUString sSibling; - for (it = vOldItems.begin(); it!=vOldItems.end(); ++it) - { + for (it = vOldItems.begin(); it!=vOldItems.end(); ++it) { ::std::vector< MigrationItem >::iterator pFound = ::std::find(vNewItems.begin(), vNewItems.end(), *it); - if (pFound != vNewItems.end() && it->m_xPopupMenu.is()) - { + if (pFound != vNewItems.end() && it->m_xPopupMenu.is()) { OUString sName; if (!sParent.isEmpty()) sName = sParent + MENU_SEPARATOR + it->m_sCommandURL; else sName = it->m_sCommandURL; compareOldAndNewConfig(sName, it->m_xPopupMenu, pFound->m_xPopupMenu, sResourceURL); - } - else if (pFound == vNewItems.end()) - { + } else if (pFound == vNewItems.end()) { MigrationItem aMigrationItem(sParent, sSibling, it->m_sCommandURL, it->m_xPopupMenu); - if (m_aOldVersionItemsHashMap.find(sResourceURL)==m_aOldVersionItemsHashMap.end()) - { + if (m_aOldVersionItemsHashMap.find(sResourceURL)==m_aOldVersionItemsHashMap.end()) { ::std::vector< MigrationItem > vMigrationItems; m_aOldVersionItemsHashMap.insert(MigrationHashMap::value_type(sResourceURL, vMigrationItems)); m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); - } - else - { + } else { if (::std::find(m_aOldVersionItemsHashMap[sResourceURL].begin(), m_aOldVersionItemsHashMap[sResourceURL].end(), aMigrationItem)==m_aOldVersionItemsHashMap[sResourceURL].end()) m_aOldVersionItemsHashMap[sResourceURL].push_back(aMigrationItem); } @@ -1153,38 +1071,34 @@ void MigrationImpl::compareOldAndNewConfig(const OUString& sParent, } void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurationManager >& xCfgManager, - const uno::Reference< container::XIndexContainer>& xIndexContainer, - const OUString& sModuleIdentifier, - const OUString& sResourceURL) + const uno::Reference< container::XIndexContainer>& xIndexContainer, + const OUString& sModuleIdentifier, + const OUString& sResourceURL) { MigrationHashMap::iterator pFound = m_aOldVersionItemsHashMap.find(sResourceURL); if (pFound==m_aOldVersionItemsHashMap.end()) return; ::std::vector< MigrationItem >::iterator it; - for (it=pFound->second.begin(); it!=pFound->second.end(); ++it) - { + for (it=pFound->second.begin(); it!=pFound->second.end(); ++it) { uno::Reference< container::XIndexContainer > xTemp = xIndexContainer; OUString sParentNodeName = it->m_sParentNodeName; sal_Int32 nIndex = 0; - do - { + do { OUString sToken = sParentNodeName.getToken(0, '|', nIndex).trim(); if (sToken.isEmpty()) break; sal_Int32 nCount = xTemp->getCount(); - for (sal_Int32 i=0; i<nCount; ++i) - { + for (sal_Int32 i=0; i<nCount; ++i) { OUString sCommandURL; OUString sLabel; uno::Reference< container::XIndexContainer > xChild; uno::Sequence< beans::PropertyValue > aPropSeq; xTemp->getByIndex(i) >>= aPropSeq; - for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j) - { + for (sal_Int32 j=0; j<aPropSeq.getLength(); ++j) { OUString sPropName = aPropSeq[j].Name; if ( sPropName == ITEM_DESCRIPTOR_COMMANDURL ) aPropSeq[j].Value >>= sCommandURL; @@ -1194,8 +1108,7 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat aPropSeq[j].Value >>= xChild; } - if (sCommandURL == sToken) - { + if (sCommandURL == sToken) { xTemp = xChild; break; } @@ -1203,8 +1116,7 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat } while (nIndex>=0); - if (nIndex == -1) - { + if (nIndex == -1) { uno::Sequence< beans::PropertyValue > aPropSeq(3); aPropSeq[0].Name = ITEM_DESCRIPTOR_COMMANDURL; @@ -1216,19 +1128,15 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat if (it->m_sPrevSibling.isEmpty()) xTemp->insertByIndex(0, uno::makeAny(aPropSeq)); - else - { + else { sal_Int32 nCount = xTemp->getCount(); sal_Int32 i = 0; - for (; i<nCount; ++i) - { + for (; i<nCount; ++i) { OUString sCmd; uno::Sequence< beans::PropertyValue > aTempPropSeq; xTemp->getByIndex(i) >>= aTempPropSeq; - for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j) - { - if ( aTempPropSeq[j].Name == ITEM_DESCRIPTOR_COMMANDURL ) - { + for (sal_Int32 j=0; j<aTempPropSeq.getLength(); ++j) { + if ( aTempPropSeq[j].Name == ITEM_DESCRIPTOR_COMMANDURL ) { aTempPropSeq[j].Value >>= sCmd; break; } @@ -1256,11 +1164,9 @@ uno::Reference< ui::XUIConfigurationManager > NewVersionUIInfo::getConfigManager { uno::Reference< ui::XUIConfigurationManager > xCfgManager; - for (sal_Int32 i=0; i<m_lCfgManagerSeq.getLength(); ++i) - { - if (m_lCfgManagerSeq[i].Name.equals(sModuleShortName)) - { - m_lCfgManagerSeq[i].Value >>= xCfgManager; + for ( const css::beans::PropertyValue& rProp : m_lCfgManagerSeq) { + if (rProp.Name.equals(sModuleShortName)) { + rProp.Value >>= xCfgManager; break; } } @@ -1272,10 +1178,8 @@ uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewMenubarSett { uno::Reference< container::XIndexContainer > xNewMenuSettings; - for (sal_Int32 i=0; i<m_lNewVersionMenubarSettingsSeq.getLength(); ++i) - { - if (m_lNewVersionMenubarSettingsSeq[i].Name.equals(sModuleShortName)) - { + for (sal_Int32 i=0; i<m_lNewVersionMenubarSettingsSeq.getLength(); ++i) { + if (m_lNewVersionMenubarSettingsSeq[i].Name.equals(sModuleShortName)) { m_lNewVersionMenubarSettingsSeq[i].Value >>= xNewMenuSettings; break; } @@ -1288,16 +1192,12 @@ uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewToolbarSett { uno::Reference< container::XIndexContainer > xNewToolbarSettings; - for (sal_Int32 i=0; i<m_lNewVersionToolbarSettingsSeq.getLength(); ++i) - { - if (m_lNewVersionToolbarSettingsSeq[i].Name.equals(sModuleShortName)) - { + for (sal_Int32 i=0; i<m_lNewVersionToolbarSettingsSeq.getLength(); ++i) { + if (m_lNewVersionToolbarSettingsSeq[i].Name.equals(sModuleShortName)) { uno::Sequence< beans::PropertyValue > lToolbarSettingsSeq; m_lNewVersionToolbarSettingsSeq[i].Value >>= lToolbarSettingsSeq; - for (sal_Int32 j=0; j<lToolbarSettingsSeq.getLength(); ++j) - { - if (lToolbarSettingsSeq[j].Name.equals(sToolbarName)) - { + for (sal_Int32 j=0; j<lToolbarSettingsSeq.getLength(); ++j) { + if (lToolbarSettingsSeq[j].Name.equals(sToolbarName)) { lToolbarSettingsSeq[j].Value >>= xNewToolbarSettings; break; } @@ -1312,7 +1212,7 @@ uno::Reference< container::XIndexContainer > NewVersionUIInfo::getNewToolbarSett void NewVersionUIInfo::init(const ::std::vector< MigrationModuleInfo >& vModulesInfo) { - m_lCfgManagerSeq.realloc(vModulesInfo.size()); + m_lCfgManagerSeq.resize(vModulesInfo.size()); m_lNewVersionMenubarSettingsSeq.realloc(vModulesInfo.size()); m_lNewVersionToolbarSettingsSeq.realloc(vModulesInfo.size()); @@ -1321,27 +1221,22 @@ void NewVersionUIInfo::init(const ::std::vector< MigrationModuleInfo >& vModules uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xModuleCfgSupplier = ui::theModuleUIConfigurationManagerSupplier::get( ::comphelper::getProcessComponentContext() ); - for (size_t i=0; i<vModulesInfo.size(); ++i) - { + for (size_t i=0; i<vModulesInfo.size(); ++i) { OUString sModuleIdentifier = mapModuleShortNameToIdentifier(vModulesInfo[i].sModuleShortName); - if (!sModuleIdentifier.isEmpty()) - { + if (!sModuleIdentifier.isEmpty()) { uno::Reference< ui::XUIConfigurationManager > xCfgManager = xModuleCfgSupplier->getUIConfigurationManager(sModuleIdentifier); m_lCfgManagerSeq[i].Name = vModulesInfo[i].sModuleShortName; m_lCfgManagerSeq[i].Value <<= xCfgManager; - if (vModulesInfo[i].bHasMenubar) - { + if (vModulesInfo[i].bHasMenubar) { m_lNewVersionMenubarSettingsSeq[i].Name = vModulesInfo[i].sModuleShortName; m_lNewVersionMenubarSettingsSeq[i].Value <<= xCfgManager->getSettings(sMenubarResourceURL, sal_True); } sal_Int32 nToolbars = vModulesInfo[i].m_vToolbars.size(); - if (nToolbars > 0) - { + if (nToolbars > 0) { uno::Sequence< beans::PropertyValue > lPropSeq(nToolbars); - for (sal_Int32 j=0; j<nToolbars; ++j) - { + for (sal_Int32 j=0; j<nToolbars; ++j) { OUString sToolbarName = vModulesInfo[i].m_vToolbars[j]; OUString sToolbarResourceURL = sToolbarResourcePre + sToolbarName; diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx index 9f35cae..983d6ac 100644 --- a/desktop/source/migration/migration_impl.hxx +++ b/desktop/source/migration/migration_impl.hxx @@ -164,7 +164,7 @@ public: private: - css::uno::Sequence< css::beans::PropertyValue > m_lCfgManagerSeq; + std::vector< css::beans::PropertyValue > m_lCfgManagerSeq; css::uno::Sequence< css::beans::PropertyValue > m_lNewVersionMenubarSettingsSeq; css::uno::Sequence< css::beans::PropertyValue > m_lNewVersionToolbarSettingsSeq; }; commit 7f8c4b8445b578ec26256efd6f96e5a5b8d81f2e Author: Noel Grandin <[email protected]> Date: Thu Dec 3 10:28:31 2015 +0200 Use comphelper::containerToSequence() Change-Id: I18d6ef04ff00f971a4c54ba259733c07501c6c1a diff --git a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx index 7ed84cb..3ed820b 100644 --- a/accessibility/inc/accessibility/helper/characterattributeshelper.hxx +++ b/accessibility/inc/accessibility/helper/characterattributeshelper.hxx @@ -43,7 +43,7 @@ public: CharacterAttributesHelper( const vcl::Font& rFont, sal_Int32 nBackColor, sal_Int32 nColor ); ~CharacterAttributesHelper(); - css::uno::Sequence< css::beans::PropertyValue > GetCharacterAttributes(); + std::vector< css::beans::PropertyValue > GetCharacterAttributes(); css::uno::Sequence< css::beans::PropertyValue > GetCharacterAttributes( const css::uno::Sequence< OUString >& aRequestedAttributes ); }; diff --git a/accessibility/source/helper/characterattributeshelper.cxx b/accessibility/source/helper/characterattributeshelper.cxx index cf8cf79..3f82d70 100644 --- a/accessibility/source/helper/characterattributeshelper.cxx +++ b/accessibility/source/helper/characterattributeshelper.cxx @@ -19,6 +19,7 @@ #include <accessibility/helper/characterattributeshelper.hxx> #include <tools/gen.hxx> +#include <comphelper/sequence.hxx> using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; @@ -48,57 +49,51 @@ CharacterAttributesHelper::~CharacterAttributesHelper() } -Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes() +std::vector< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes() { - Sequence< PropertyValue > aValues( m_aAttributeMap.size() ); - PropertyValue* pValues = aValues.getArray(); + std::vector< PropertyValue > aValues( m_aAttributeMap.size() ); - for ( AttributeMap::iterator aIt = m_aAttributeMap.begin(); aIt != m_aAttributeMap.end(); ++aIt, ++pValues ) + int i = 0; + for ( AttributeMap::iterator aIt = m_aAttributeMap.begin(); aIt != m_aAttributeMap.end(); ++aIt, ++i ) { - pValues->Name = aIt->first; - pValues->Handle = (sal_Int32) -1; - pValues->Value = aIt->second; - pValues->State = PropertyState_DIRECT_VALUE; + aValues[i].Name = aIt->first; + aValues[i].Handle = (sal_Int32) -1; + aValues[i].Value = aIt->second; + aValues[i].State = PropertyState_DIRECT_VALUE; } return aValues; } -Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes( const Sequence< OUString >& aRequestedAttributes ) +Sequence< PropertyValue > CharacterAttributesHelper::GetCharacterAttributes( const css::uno::Sequence< OUString >& aRequestedAttributes ) { - Sequence< PropertyValue > aValues; + if ( aRequestedAttributes.getLength() == 0 ) + return comphelper::containerToSequence(GetCharacterAttributes()); + + std::vector< PropertyValue > aValues; sal_Int32 nLength = aRequestedAttributes.getLength(); - if ( nLength != 0 ) + AttributeMap aAttributeMap; + + for ( sal_Int32 i = 0; i < nLength; ++i ) { - const OUString* pNames = aRequestedAttributes.getConstArray(); - AttributeMap aAttributeMap; - - for ( sal_Int32 i = 0; i < nLength; ++i ) - { - AttributeMap::iterator aFound = m_aAttributeMap.find( pNames[i] ); - if ( aFound != m_aAttributeMap.end() ) - aAttributeMap.insert( *aFound ); - } - - aValues.realloc( aAttributeMap.size() ); - PropertyValue* pValues = aValues.getArray(); - - for ( AttributeMap::iterator aIt = aAttributeMap.begin(); aIt != aAttributeMap.end(); ++aIt, ++pValues ) - { - pValues->Name = aIt->first; - pValues->Handle = (sal_Int32) -1; - pValues->Value = aIt->second; - pValues->State = PropertyState_DIRECT_VALUE; - } + AttributeMap::iterator aFound = m_aAttributeMap.find( aRequestedAttributes[i] ); + if ( aFound != m_aAttributeMap.end() ) + aAttributeMap.insert( *aFound ); } - else + + aValues.reserve( aAttributeMap.size() ); + + int i = 0; + for ( AttributeMap::iterator aIt = aAttributeMap.begin(); aIt != aAttributeMap.end(); ++aIt, ++i ) { - aValues = GetCharacterAttributes(); + aValues[i].Name = aIt->first; + aValues[i].Handle = (sal_Int32) -1; + aValues[i].Value = aIt->second; + aValues[i].State = PropertyState_DIRECT_VALUE; } - - return aValues; + return comphelper::containerToSequence(aValues); } diff --git a/canvas/source/vcl/textlayout.cxx b/canvas/source/vcl/textlayout.cxx index 13cf03c..982efe8 100644 --- a/canvas/source/vcl/textlayout.cxx +++ b/canvas/source/vcl/textlayout.cxx @@ -122,7 +122,7 @@ namespace vclcanvas ::std::unique_ptr< long []> aOffsets(new long[maLogicalAdvancements.getLength()]); setupTextOffsets(aOffsets.get(), maLogicalAdvancements, aViewState, aRenderState); - uno::Sequence< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence; + std::vector< uno::Reference< rendering::XPolyPolygon2D> > aOutlineSequence; ::basegfx::B2DPolyPolygonVector aOutlines; if (pVDev->GetTextOutlines( aOutlines, @@ -134,7 +134,7 @@ namespace vclcanvas 0, aOffsets.get())) { - aOutlineSequence.realloc(aOutlines.size()); + aOutlineSequence.reserve(aOutlines.size()); sal_Int32 nIndex (0); for (::basegfx::B2DPolyPolygonVector::const_iterator iOutline(aOutlines.begin()), @@ -148,7 +148,7 @@ namespace vclcanvas } } - return aOutlineSequence; + return comphelper::containerToSequence(aOutlineSequence); } uno::Sequence< geometry::RealRectangle2D > SAL_CALL TextLayout::queryInkMeasures( ) throw (uno::RuntimeException, std::exception) diff --git a/chart2/source/tools/InternalDataProvider.cxx b/chart2/source/tools/InternalDataProvider.cxx index 4f68d0b..6511a28 100644 --- a/chart2/source/tools/InternalDataProvider.cxx +++ b/chart2/source/tools/InternalDataProvider.cxx @@ -72,21 +72,23 @@ static const char lcl_aCompleteRange[] = "all"; typedef ::std::multimap< OUString, uno::WeakReference< chart2::data::XDataSequence > > lcl_tSequenceMap; -Sequence< OUString > lcl_AnyToStringSequence( const Sequence< uno::Any >& aAnySeq ) +std::vector< OUString > lcl_AnyToStringSequence( const std::vector< uno::Any >& aAnySeq ) { - Sequence< OUString > aResult; - aResult.realloc( aAnySeq.getLength() ); - transform( aAnySeq.getConstArray(), aAnySeq.getConstArray() + aAnySeq.getLength(), - aResult.getArray(), CommonFunctors::AnyToString() ); + std::vector< OUString > aResult; + aResult.resize( aAnySeq.size() ); + int i = 0; + for (const uno::Any& aAny : aAnySeq) + aResult[i++] = CommonFunctors::AnyToString()(aAny); return aResult; } -Sequence< uno::Any > lcl_StringToAnySequence( const Sequence< OUString >& aStringSeq ) +std::vector< uno::Any > lcl_StringToAnyVector( const css::uno::Sequence< OUString >& aStringSeq ) { - Sequence< uno::Any > aResult; - aResult.realloc( aStringSeq.getLength() ); - transform( aStringSeq.getConstArray(), aStringSeq.getConstArray() + aStringSeq.getLength(), - aResult.getArray(), CommonFunctors::makeAny< OUString >() ); + std::vector< uno::Any > aResult; + aResult.resize( aStringSeq.getLength() ); + int i = 0; + for (const OUString& aStr : aStringSeq) + aResult[i++] = CommonFunctors::makeAny<OUString>()(aStr); return aResult; } @@ -151,9 +153,9 @@ struct lcl_internalizeSeries : public ::std::unary_function< Reference< chart2:: if( xLabel.is() ) { if( m_bDataInColumns ) - m_rInternalData.setComplexColumnLabel( nNewIndex, ContainerHelper::SequenceToVector( lcl_StringToAnySequence( xLabel->getTextualData() ) ) ); + m_rInternalData.setComplexColumnLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) ); else - m_rInternalData.setComplexRowLabel( nNewIndex, ContainerHelper::SequenceToVector( lcl_StringToAnySequence( xLabel->getTextualData() ) ) ); + m_rInternalData.setComplexRowLabel( nNewIndex, lcl_StringToAnyVector( xLabel->getTextualData() ) ); if( m_bConnectToModel ) { Reference< chart2::data::XDataSequence > xNewLabel( @@ -1324,15 +1326,15 @@ vector< vector< Type > > lcl_convertSequenceSequenceToVectorVector( const Sequen return aRet; } -Sequence< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence( const vector< vector< uno::Any > >& rIn ) +std::vector< Sequence< OUString > > lcl_convertComplexAnyVectorToStringSequence( const vector< vector< uno::Any > >& rIn ) { - Sequence< Sequence< OUString > > aRet; + std::vector< Sequence< OUString > > aRet; sal_Int32 nOuterCount = rIn.size(); if( nOuterCount ) { - aRet.realloc(nOuterCount); + aRet.resize(nOuterCount); for( sal_Int32 nN=0; nN<nOuterCount; nN++) - aRet[nN]= lcl_AnyToStringSequence( comphelper::containerToSequence( rIn[nN] ) ); + aRet[nN] = comphelper::containerToSequence(lcl_AnyToStringSequence( rIn[nN] )); } return aRet; } @@ -1342,7 +1344,7 @@ vector< vector< uno::Any > > lcl_convertComplexStringSequenceToAnyVector( const vector< vector< uno::Any > > aRet; sal_Int32 nOuterCount = rIn.getLength(); for( sal_Int32 nN=0; nN<nOuterCount; nN++) - aRet.push_back( ContainerHelper::SequenceToVector( lcl_StringToAnySequence( rIn[nN] ) ) ); + aRet.push_back( lcl_StringToAnyVector( rIn[nN] ) ); return aRet; } @@ -1440,7 +1442,7 @@ void SAL_CALL InternalDataProvider::setAnyColumnDescriptions( const Sequence< Se // ____ XComplexDescriptionAccess ____ Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexRowDescriptions() throw (uno::RuntimeException, std::exception) { - return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexRowLabels() ); + return comphelper::containerToSequence(lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexRowLabels() )); } void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< Sequence< OUString > >& aRowDescriptions ) throw (uno::RuntimeException, std::exception) { @@ -1448,7 +1450,7 @@ void SAL_CALL InternalDataProvider::setComplexRowDescriptions( const Sequence< S } Sequence< Sequence< OUString > > SAL_CALL InternalDataProvider::getComplexColumnDescriptions() throw (uno::RuntimeException, std::exception) { - return lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexColumnLabels() ); + return comphelper::containerToSequence(lcl_convertComplexAnyVectorToStringSequence( m_aInternalData.getComplexColumnLabels() )); } void SAL_CALL InternalDataProvider::setComplexColumnDescriptions( const Sequence< Sequence< OUString > >& aColumnDescriptions ) throw (uno::RuntimeException, std::exception) { diff --git a/dbaccess/source/ui/app/AppDetailPageHelper.cxx b/dbaccess/source/ui/app/AppDetailPageHelper.cxx index c2b063f..3abd1f8 100644 --- a/dbaccess/source/ui/app/AppDetailPageHelper.cxx +++ b/dbaccess/source/ui/app/AppDetailPageHelper.cxx @@ -429,8 +429,7 @@ void OAppDetailPageHelper::describeCurrentSelectionForType( const ElementType _e pEntry = pList->NextSelected(pEntry); } - _out_rSelectedObjects.realloc( aSelected.size() ); - ::std::copy( aSelected.begin(), aSelected.end(), _out_rSelectedObjects.getArray() ); + _out_rSelectedObjects = comphelper::containerToSequence( aSelected ); } void OAppDetailPageHelper::selectElements(const Sequence< OUString>& _aNames) _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
