[Libreoffice-commits] core.git: comphelper/Library_comphelper.mk comphelper/source editeng/source include/comphelper sd/source svx/source
Mike Kaganski (via logerrit)
logerrit at kemper.freedesktop.org
Sat Nov 16 13:08:28 UTC 2019
comphelper/Library_comphelper.mk | 1
comphelper/source/misc/serviceinfohelper.cxx | 42 -----------------------
editeng/source/uno/unotext.cxx | 9 ++--
editeng/source/uno/unotext2.cxx | 29 ++++++++-------
include/comphelper/OUStringLiteralList.hxx | 31 +++++++++++++++++
include/comphelper/serviceinfohelper.hxx | 48 --------------------------
sd/source/ui/unoidl/unoobj.cxx | 14 +++----
sd/source/ui/unoidl/unopage.cxx | 27 +++++++-------
svx/source/unodraw/unoshap3.cxx | 49 +++++++++++++--------------
9 files changed, 95 insertions(+), 155 deletions(-)
New commits:
commit 51eb969cb77f8b54681033f4959b15ce32116b56
Author: Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sat Nov 16 11:35:58 2019 +0200
Commit: Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Nov 16 14:07:45 2019 +0100
Replace comphelper::ServiceInfoHelper::addToSequence
Change-Id: I325e16fdf9bbbc6f2ba2d06c417da5eeb0d48023
Reviewed-on: https://gerrit.libreoffice.org/82975
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk
index 6539844d3cf2..e0bf1a8574f5 100644
--- a/comphelper/Library_comphelper.mk
+++ b/comphelper/Library_comphelper.mk
@@ -128,7 +128,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\
comphelper/source/misc/SelectionMultiplex \
comphelper/source/misc/sequenceashashmap \
comphelper/source/misc/servicedecl \
- comphelper/source/misc/serviceinfohelper \
comphelper/source/misc/sharedmutex \
comphelper/source/misc/simplefileaccessinteraction \
comphelper/source/misc/solarmutex \
diff --git a/comphelper/source/misc/serviceinfohelper.cxx b/comphelper/source/misc/serviceinfohelper.cxx
deleted file mode 100644
index 59cb0ea60b2d..000000000000
--- a/comphelper/source/misc/serviceinfohelper.cxx
+++ /dev/null
@@ -1,42 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#include <comphelper/serviceinfohelper.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace comphelper
-{
-
-/** this method adds a variable number of OUString to a given Sequence
- */
-void ServiceInfoHelper::addToSequence( css::uno::Sequence< OUString >& rSeq, std::initializer_list<OUString> services ) throw()
-{
- sal_uInt32 nCount = rSeq.getLength();
-
- rSeq.realloc( nCount + services.size() );
- OUString* pStrings = rSeq.getArray();
-
- for( auto const & s: services )
- pStrings[nCount++] = s;
-}
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 4796732b2c74..3abed7b474a5 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -45,8 +45,9 @@
#include <editeng/editeng.hxx>
#include <editeng/outliner.hxx>
#include <editeng/unoipset.hxx>
+#include <comphelper/OUStringLiteralList.hxx>
+#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
-#include <comphelper/serviceinfohelper.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <editeng/unonames.hxx>
@@ -2163,9 +2164,9 @@ uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames( )
uno::Sequence< OUString > SAL_CALL SvxUnoTextBase::getSupportedServiceNames_Static( )
{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames_Static() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.text.Text"} );
- return aSeq;
+ return comphelper::concatSequences(
+ SvxUnoTextRangeBase::getSupportedServiceNames_Static(),
+ comphelper::OUStringLiteralList({ "com.sun.star.text.Text" }));
}
namespace
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index ba9c66f3c37f..1dbf6cfafc42 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -24,7 +24,8 @@
#include <editeng/flditem.hxx>
#include <editeng/unofield.hxx>
#include <editeng/unotext.hxx>
-#include <comphelper/serviceinfohelper.hxx>
+#include <comphelper/OUStringLiteralList.hxx>
+#include <comphelper/sequence.hxx>
#include <cppuhelper/supportsservice.hxx>
using namespace ::cppu;
@@ -362,13 +363,13 @@ OUString SAL_CALL SvxUnoTextContent::getImplementationName()
uno::Sequence< OUString > SAL_CALL SvxUnoTextContent::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.text.TextContent",
- "com.sun.star.text.Paragraph"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxUnoTextRangeBase::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesComplex",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.Paragraph" }));
}
@@ -643,12 +644,12 @@ sal_Bool SAL_CALL SvxUnoTextCursor::supportsService( const OUString& ServiceName
uno::Sequence< OUString > SAL_CALL SvxUnoTextCursor::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxUnoTextRangeBase::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.text.TextCursor"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxUnoTextRangeBase::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesComplex",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.text.TextCursor" }));
}
diff --git a/include/comphelper/OUStringLiteralList.hxx b/include/comphelper/OUStringLiteralList.hxx
new file mode 100644
index 000000000000..8c149671ffdf
--- /dev/null
+++ b/include/comphelper/OUStringLiteralList.hxx
@@ -0,0 +1,31 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_COMPHELPER_OUSTRINGLITERALLIST_HXX
+#define INCLUDED_COMPHELPER_OUSTRINGLITERALLIST_HXX
+
+#include <sal/config.h>
+
+#include <initializer_list>
+#include <rtl/ustring.hxx>
+
+namespace comphelper
+{
+// Constructs std::initializer_list<OUStringLiteral> without explicit functional cast
+// to avoid [loplugin:redundantfcast] warnings
+inline const std::initializer_list<OUStringLiteral>&
+OUStringLiteralList(const std::initializer_list<OUStringLiteral>& list)
+{
+ return list;
+}
+}
+
+#endif // INCLUDED_COMPHELPER_OUSTRINGLITERALLIST_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/include/comphelper/serviceinfohelper.hxx b/include/comphelper/serviceinfohelper.hxx
deleted file mode 100644
index 8b3bb70750f5..000000000000
--- a/include/comphelper/serviceinfohelper.hxx
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef INCLUDED_COMPHELPER_SERVICEINFOHELPER_HXX
-#define INCLUDED_COMPHELPER_SERVICEINFOHELPER_HXX
-
-#include <sal/config.h>
-
-#include <initializer_list>
-#include <rtl/ustring.hxx>
-
-#include <comphelper/comphelperdllapi.h>
-
-namespace com { namespace sun { namespace star { namespace uno { template <class E> class Sequence; } } } }
-
-namespace comphelper {
-
-/** This class provides a basic helper for classes supporting the XServiceInfo Interface.
- *
- * You can use the static helper methods to combine your services with that of parent
- * or aggregated classes.
- */
-namespace ServiceInfoHelper
-{
- COMPHELPER_DLLPUBLIC void addToSequence( css::uno::Sequence< OUString >& rSeq, std::initializer_list<OUString> services ) throw();
-};
-
-}
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 6c728052b2cb..9bcc2126eedf 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -51,7 +51,7 @@
#include <svl/instrm.hxx>
#include <editeng/outlobj.hxx>
#include <Outliner.hxx>
-#include <comphelper/serviceinfohelper.hxx>
+#include <comphelper/sequence.hxx>
#include <svx/svdogrp.hxx>
#include <o3tl/typed_flags_set.hxx>
#include <vcl/svapp.hxx>
@@ -806,10 +806,8 @@ SdAnimationInfo* SdXShape::GetAnimationInfo( bool bCreate ) const
uno::Sequence< OUString > SAL_CALL SdXShape::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( mpShape->_getSupportedServiceNames() );
-
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.Shape",
- "com.sun.star.document.LinkTarget"} );
+ std::vector<OUStringLiteral> aAdd{ "com.sun.star.presentation.Shape",
+ "com.sun.star.document.LinkTarget" };
SdrObject* pObj = mpShape->GetSdrObject();
if(pObj && pObj->GetObjInventor() == SdrInventor::Default )
@@ -818,14 +816,14 @@ uno::Sequence< OUString > SAL_CALL SdXShape::getSupportedServiceNames()
switch( nInventor )
{
case OBJ_TITLETEXT:
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.TitleTextShape"} );
+ aAdd.emplace_back("com.sun.star.presentation.TitleTextShape");
break;
case OBJ_OUTLINETEXT:
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.OutlinerShape"} );
+ aAdd.emplace_back("com.sun.star.presentation.OutlinerShape");
break;
}
}
- return aSeq;
+ return comphelper::concatSequences(mpShape->_getSupportedServiceNames(), aAdd);
}
/** checks if this is a presentation object
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index ed2fadd7be78..244c27bce6a4 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -46,8 +46,9 @@
#include <drawdoc.hxx>
#include <svx/unoshape.hxx>
#include <svl/style.hxx>
-#include <comphelper/serviceinfohelper.hxx>
#include <comphelper/extract.hxx>
+#include <comphelper/OUStringLiteralList.hxx>
+#include <comphelper/sequence.hxx>
#include <svx/svditer.hxx>
#include <vcl/wmf.hxx>
#include <svx/svdoole2.hxx>
@@ -1482,11 +1483,11 @@ Reference< drawing::XShape > SdGenericDrawPage::CreateShape(SdrObject *pObj) co
// XServiceInfo
Sequence< OUString > SAL_CALL SdGenericDrawPage::getSupportedServiceNames()
{
- Sequence< OUString > aSeq( SvxFmDrawPage::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.GenericDrawPage",
- "com.sun.star.document.LinkTarget",
- "com.sun.star.document.LinkTargetSupplier"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxFmDrawPage::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.GenericDrawPage",
+ "com.sun.star.document.LinkTarget",
+ "com.sun.star.document.LinkTargetSupplier" }));
}
// XLinkTargetSupplier
@@ -2185,13 +2186,12 @@ Sequence< OUString > SAL_CALL SdDrawPage::getSupportedServiceNames()
throwIfDisposed();
- Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.DrawPage"} );
+ std::vector<OUStringLiteral> aAdd{ "com.sun.star.drawing.DrawPage" };
if( IsImpressDocument() )
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.DrawPage"} );
+ aAdd.emplace_back("com.sun.star.presentation.DrawPage");
- return aSeq;
+ return comphelper::concatSequences(SdGenericDrawPage::getSupportedServiceNames(), aAdd);
}
sal_Bool SAL_CALL SdDrawPage::supportsService( const OUString& ServiceName )
@@ -2705,13 +2705,12 @@ Sequence< OUString > SAL_CALL SdMasterPage::getSupportedServiceNames()
throwIfDisposed();
- Sequence< OUString > aSeq( SdGenericDrawPage::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.MasterPage"} );
+ std::vector<OUStringLiteral> aAdd{ "com.sun.star.drawing.MasterPage" };
if( SvxFmDrawPage::mpPage && static_cast<SdPage*>(SvxFmDrawPage::mpPage)->GetPageKind() == PageKind::Handout )
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.presentation.HandoutMasterPage"} );
+ aAdd.emplace_back("com.sun.star.presentation.HandoutMasterPage");
- return aSeq;
+ return comphelper::concatSequences(SdGenericDrawPage::getSupportedServiceNames(), aAdd);
}
sal_Bool SAL_CALL SdMasterPage::supportsService( const OUString& ServiceName )
diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx
index 39b04d480752..5aacef9bc2c7 100644
--- a/svx/source/unodraw/unoshap3.cxx
+++ b/svx/source/unodraw/unoshap3.cxx
@@ -24,7 +24,8 @@
#include <com/sun/star/drawing/CameraGeometry.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <vcl/svapp.hxx>
-#include <comphelper/serviceinfohelper.hxx>
+#include <comphelper/OUStringLiteralList.hxx>
+#include <comphelper/sequence.hxx>
#include <sal/log.hxx>
#include <svx/svdpool.hxx>
@@ -406,9 +407,9 @@ bool Svx3DSceneObject::getPropertyValueImpl(const OUString& rName, const SfxItem
// css::lang::XServiceInfo
uno::Sequence< OUString > SAL_CALL Svx3DSceneObject::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.Shape3DScene"} );
- return aSeq;
+ return comphelper::concatSequences(
+ SvxShape::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.Shape3DScene" }));
}
Svx3DCubeObject::Svx3DCubeObject(SdrObject* pObj)
@@ -526,10 +527,10 @@ bool Svx3DCubeObject::getPropertyValueImpl( const OUString& rName, const SfxItem
// css::lang::XServiceInfo
uno::Sequence< OUString > SAL_CALL Svx3DCubeObject::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.Shape3D",
- "com.sun.star.drawing.Shape3DCube"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxShape::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DCube" }));
}
Svx3DSphereObject::Svx3DSphereObject(SdrObject* pObj)
@@ -631,10 +632,10 @@ bool Svx3DSphereObject::getPropertyValueImpl( const OUString& rName, const SfxIt
// css::lang::XServiceInfo
uno::Sequence< OUString > SAL_CALL Svx3DSphereObject::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.Shape3D",
- "com.sun.star.drawing.Shape3DSphere"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxShape::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DSphere" }));
}
Svx3DLatheObject::Svx3DLatheObject(SdrObject* pObj)
@@ -811,10 +812,10 @@ bool Svx3DLatheObject::getPropertyValueImpl( const OUString& rName, const SfxIte
// css::lang::XServiceInfo
uno::Sequence< OUString > SAL_CALL Svx3DLatheObject::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.Shape3D",
- "com.sun.star.drawing.Shape3DLathe"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxShape::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DLathe" }));
}
Svx3DExtrudeObject::Svx3DExtrudeObject(SdrObject* pObj)
@@ -894,10 +895,10 @@ bool Svx3DExtrudeObject::getPropertyValueImpl( const OUString& rName, const SfxI
// css::lang::XServiceInfo
uno::Sequence< OUString > SAL_CALL Svx3DExtrudeObject::getSupportedServiceNames()
{
- uno::Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.Shape3D",
- "com.sun.star.drawing.Shape3DExtrude"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxShape::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DExtrude" }));
}
Svx3DPolygonObject::Svx3DPolygonObject(SdrObject* pObj)
@@ -1030,10 +1031,10 @@ bool Svx3DPolygonObject::getPropertyValueImpl( const OUString& rName, const SfxI
// css::lang::XServiceInfo
uno::Sequence< OUString > SAL_CALL Svx3DPolygonObject::getSupportedServiceNames()
{
- Sequence< OUString > aSeq( SvxShape::getSupportedServiceNames() );
- comphelper::ServiceInfoHelper::addToSequence( aSeq, {"com.sun.star.drawing.Shape3D",
- "com.sun.star.drawing.Shape3DPolygon"});
- return aSeq;
+ return comphelper::concatSequences(
+ SvxShape::getSupportedServiceNames(),
+ comphelper::OUStringLiteralList({ "com.sun.star.drawing.Shape3D",
+ "com.sun.star.drawing.Shape3DPolygon" }));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
More information about the Libreoffice-commits
mailing list