summaryrefslogtreecommitdiff
path: root/sd/source/ui/unoidl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-10-29 10:02:01 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-10-30 23:13:41 +0200
commit94f34c57be79187c7108eea845e1303ddc6319e5 (patch)
treeddf02496de0ce17308246d0a54c8678fa5e76e9e /sd/source/ui/unoidl
parent2afbef0037f022a59ed1198f1f84e454d070df92 (diff)
Prepare for removal of non-const operator[] from Sequence in sd
Change-Id: I82dc012188f846161beeb54901c2f5d298e5c3b7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124385 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sd/source/ui/unoidl')
-rw-r--r--sd/source/ui/unoidl/SdUnoSlideView.cxx3
-rw-r--r--sd/source/ui/unoidl/UnoDocumentSettings.cxx8
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx119
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx2
4 files changed, 63 insertions, 69 deletions
diff --git a/sd/source/ui/unoidl/SdUnoSlideView.cxx b/sd/source/ui/unoidl/SdUnoSlideView.cxx
index 1055d51b1cc3..c30962ed766b 100644
--- a/sd/source/ui/unoidl/SdUnoSlideView.cxx
+++ b/sd/source/ui/unoidl/SdUnoSlideView.cxx
@@ -90,11 +90,12 @@ Any SAL_CALL SdUnoSlideView::getSelection()
mrSlideSorter.GetController().GetPageSelector().GetSelectedPageCount());
Sequence<Reference<XInterface> > aPages(nSelectedPageCount);
+ auto aPagesRange = asNonConstRange(aPages);
int nIndex = 0;
while (aSelectedPages.HasMoreElements() && nIndex<nSelectedPageCount)
{
slidesorter::model::SharedPageDescriptor pDescriptor (aSelectedPages.GetNextElement());
- aPages[nIndex++] = pDescriptor->GetPage()->getUnoPage();
+ aPagesRange[nIndex++] = pDescriptor->GetPage()->getUnoPage();
}
aResult <<= aPages;
diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
index 16d6557bca14..ec168b7e42d6 100644
--- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx
+++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx
@@ -314,12 +314,13 @@ uno::Sequence<beans::PropertyValue>
const uno::Sequence<beans::PropertyValue>& aConfigProps )
{
uno::Sequence<beans::PropertyValue> aRet( aConfigProps.getLength() );
+ auto aRetRange = asNonConstRange(aRet);
int nRet = 0;
for( const auto& rConfigProp : aConfigProps )
{
XPropertyListType t = getTypeOfName( rConfigProp.Name );
if (t == XPropertyListType::Unknown)
- aRet[nRet++] = rConfigProp;
+ aRetRange[nRet++] = rConfigProp;
else
{
OUString aURL;
@@ -357,11 +358,12 @@ uno::Sequence<beans::PropertyValue>
if( !xSubStorage.is() )
return aRet;
+ auto aRetRange = asNonConstRange(aRet);
// now populate it
for( sal_Int32 i = 0; i < aConfigProps.getLength(); i++ )
{
XPropertyListType t = getTypeOfName( aConfigProps[i].Name );
- aRet[i] = aConfigProps[i];
+ aRetRange[i] = aConfigProps[i];
if (t != XPropertyListType::Unknown) {
const XPropertyListRef& pList = pDoc->GetPropertyList( t );
if( !pList.is() || !pList->IsEmbedInDocument() )
@@ -375,7 +377,7 @@ uno::Sequence<beans::PropertyValue>
if( pList->SaveTo( xSubStorage, aName, &aResult ) )
{
OUString aRealPath = "Settings/" + aResult;
- aRet[i].Value <<= aRealPath;
+ aRetRange[i].Value <<= aRealPath;
}
}
}
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index a7d1e8568168..c629f2ca87d0 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -33,6 +33,7 @@
#include <officecfg/Office/Common.hxx>
#include <comphelper/lok.hxx>
+#include <comphelper/propertyvalue.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -1093,60 +1094,52 @@ uno::Sequence< OUString > SAL_CALL SdXImpressDocument::getAvailableServiceNames(
const uno::Sequence< OUString > aSNS_ORG( SvxFmMSFactory::getAvailableServiceNames() );
- uno::Sequence< OUString > aSNS( mbImpressDoc ? 36 : 19 );
-
- sal_uInt16 i(0);
-
- aSNS[i++] = "com.sun.star.drawing.DashTable";
- aSNS[i++] = "com.sun.star.drawing.GradientTable";
- aSNS[i++] = "com.sun.star.drawing.HatchTable";
- aSNS[i++] = "com.sun.star.drawing.BitmapTable";
- aSNS[i++] = "com.sun.star.drawing.TransparencyGradientTable";
- aSNS[i++] = "com.sun.star.drawing.MarkerTable";
- aSNS[i++] = "com.sun.star.text.NumberingRules";
- aSNS[i++] = "com.sun.star.drawing.Background";
- aSNS[i++] = "com.sun.star.document.Settings";
- aSNS[i++] = sUNO_Service_ImageMapRectangleObject;
- aSNS[i++] = sUNO_Service_ImageMapCircleObject;
- aSNS[i++] = sUNO_Service_ImageMapPolygonObject;
- aSNS[i++] = "com.sun.star.xml.NamespaceMap";
-
- // Support creation of GraphicStorageHandler and EmbeddedObjectResolver
- aSNS[i++] = "com.sun.star.document.ExportGraphicStorageHandler";
- aSNS[i++] = "com.sun.star.document.ImportGraphicStorageHandler";
- aSNS[i++] = "com.sun.star.document.ExportEmbeddedObjectResolver";
- aSNS[i++] = "com.sun.star.document.ImportEmbeddedObjectResolver";
- aSNS[i++] = "com.sun.star.drawing.TableShape";
+ uno::Sequence< OUString > aSNS_Common{ "com.sun.star.drawing.DashTable",
+ "com.sun.star.drawing.GradientTable",
+ "com.sun.star.drawing.HatchTable",
+ "com.sun.star.drawing.BitmapTable",
+ "com.sun.star.drawing.TransparencyGradientTable",
+ "com.sun.star.drawing.MarkerTable",
+ "com.sun.star.text.NumberingRules",
+ "com.sun.star.drawing.Background",
+ "com.sun.star.document.Settings",
+ sUNO_Service_ImageMapRectangleObject,
+ sUNO_Service_ImageMapCircleObject,
+ sUNO_Service_ImageMapPolygonObject,
+ "com.sun.star.xml.NamespaceMap",
+
+ // Support creation of GraphicStorageHandler and EmbeddedObjectResolver
+ "com.sun.star.document.ExportGraphicStorageHandler",
+ "com.sun.star.document.ImportGraphicStorageHandler",
+ "com.sun.star.document.ExportEmbeddedObjectResolver",
+ "com.sun.star.document.ImportEmbeddedObjectResolver",
+ "com.sun.star.drawing.TableShape" };
+
+ uno::Sequence< OUString > aSNS_Specific;
if(mbImpressDoc)
- {
- aSNS[i++] = "com.sun.star.presentation.TitleTextShape";
- aSNS[i++] = "com.sun.star.presentation.OutlinerShape";
- aSNS[i++] = "com.sun.star.presentation.SubtitleShape";
- aSNS[i++] = "com.sun.star.presentation.GraphicObjectShape";
- aSNS[i++] = "com.sun.star.presentation.ChartShape";
- aSNS[i++] = "com.sun.star.presentation.PageShape";
- aSNS[i++] = "com.sun.star.presentation.OLE2Shape";
- aSNS[i++] = "com.sun.star.presentation.TableShape";
- aSNS[i++] = "com.sun.star.presentation.OrgChartShape";
- aSNS[i++] = "com.sun.star.presentation.NotesShape";
- aSNS[i++] = "com.sun.star.presentation.HandoutShape";
- aSNS[i++] = "com.sun.star.presentation.DocumentSettings";
- aSNS[i++] = "com.sun.star.presentation.FooterShape";
- aSNS[i++] = "com.sun.star.presentation.HeaderShape";
- aSNS[i++] = "com.sun.star.presentation.SlideNumberShape";
- aSNS[i++] = "com.sun.star.presentation.DateTimeShape";
- aSNS[i++] = "com.sun.star.presentation.CalcShape";
- aSNS[i++] = "com.sun.star.presentation.MediaShape";
- }
+ aSNS_Specific = { "com.sun.star.presentation.TitleTextShape",
+ "com.sun.star.presentation.OutlinerShape",
+ "com.sun.star.presentation.SubtitleShape",
+ "com.sun.star.presentation.GraphicObjectShape",
+ "com.sun.star.presentation.ChartShape",
+ "com.sun.star.presentation.PageShape",
+ "com.sun.star.presentation.OLE2Shape",
+ "com.sun.star.presentation.TableShape",
+ "com.sun.star.presentation.OrgChartShape",
+ "com.sun.star.presentation.NotesShape",
+ "com.sun.star.presentation.HandoutShape",
+ "com.sun.star.presentation.DocumentSettings",
+ "com.sun.star.presentation.FooterShape",
+ "com.sun.star.presentation.HeaderShape",
+ "com.sun.star.presentation.SlideNumberShape",
+ "com.sun.star.presentation.DateTimeShape",
+ "com.sun.star.presentation.CalcShape",
+ "com.sun.star.presentation.MediaShape" };
else
- {
- aSNS[i++] = "com.sun.star.drawing.DocumentSettings";
- }
+ aSNS_Specific = { "com.sun.star.drawing.DocumentSettings" };
- DBG_ASSERT( i == aSNS.getLength(), "Sequence overrun!" );
-
- return comphelper::concatSequences( aSNS_ORG, aSNS );
+ return comphelper::concatSequences( aSNS_ORG, aSNS_Common, aSNS_Specific );
}
// lang::XServiceInfo
@@ -1346,25 +1339,26 @@ uno::Any SAL_CALL SdXImpressDocument::getPropertyValue( const OUString& Property
sal_uInt32 nItems = rPool.GetItemCount2( nWhichId );
aSeq.realloc( aSeq.getLength() + nItems*5 + 5 );
+ auto pSeq = aSeq.getArray();
for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nWhichId))
{
const SvxFontItem *pFont = static_cast<const SvxFontItem *>(pItem);
- aSeq[nSeqIndex++] <<= pFont->GetFamilyName();
- aSeq[nSeqIndex++] <<= pFont->GetStyleName();
- aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily());
- aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch());
- aSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet());
+ pSeq[nSeqIndex++] <<= pFont->GetFamilyName();
+ pSeq[nSeqIndex++] <<= pFont->GetStyleName();
+ pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetFamily());
+ pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetPitch());
+ pSeq[nSeqIndex++] <<= sal_Int16(pFont->GetCharSet());
}
const SvxFontItem& rFont = static_cast<const SvxFontItem&>(rPool.GetDefaultItem( nWhichId ));
- aSeq[nSeqIndex++] <<= rFont.GetFamilyName();
- aSeq[nSeqIndex++] <<= rFont.GetStyleName();
- aSeq[nSeqIndex++] <<= sal_Int16(rFont.GetFamily());
- aSeq[nSeqIndex++] <<= sal_Int16(rFont.GetPitch());
- aSeq[nSeqIndex++] <<= sal_Int16(rFont.GetCharSet());
+ pSeq[nSeqIndex++] <<= rFont.GetFamilyName();
+ pSeq[nSeqIndex++] <<= rFont.GetStyleName();
+ pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetFamily());
+ pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetPitch());
+ pSeq[nSeqIndex++] <<= sal_Int16(rFont.GetCharSet());
}
@@ -1478,10 +1472,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer(
const ::tools::Rectangle aVisArea( mpDocShell->GetVisArea( embed::Aspects::MSOLE_DOCPRINT ) );
aPageSize = awt::Size( aVisArea.GetWidth(), aVisArea.GetHeight() );
}
- aRenderer.realloc( 1 );
-
- aRenderer[ 0 ].Name = "PageSize" ;
- aRenderer[ 0 ].Value <<= aPageSize;
+ aRenderer = { comphelper::makePropertyValue("PageSize", aPageSize) };
}
return aRenderer;
}
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 4e4a07c1389c..d17345234e56 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -324,7 +324,7 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
aTypes = mpShape->_getTypes();
sal_uInt32 nCount = aTypes.getLength();
aTypes.realloc( nCount+1 );
- aTypes[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
+ aTypes.getArray()[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
gImplTypesCache.insert(std::make_pair(nObjId, aTypes));
}