[Libreoffice-commits] core.git: sw/inc sw/source
Arkadiy Illarionov (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jun 24 19:37:38 UTC 2019
sw/inc/unobaseclass.hxx | 4 --
sw/source/core/unocore/unobkm.cxx | 15 +++--------
sw/source/core/unocore/unoftn.cxx | 18 ++++++++++++-
sw/source/core/unocore/unoidx.cxx | 26 ++-----------------
sw/source/core/unocore/unoobj.cxx | 26 +++++++------------
sw/source/core/unocore/unoobj2.cxx | 40 ++++++-----------------------
sw/source/core/unocore/unoparagraph.cxx | 26 +++++++------------
sw/source/core/unocore/unorefmk.cxx | 43 +++++++++-----------------------
sw/source/core/unocore/unosect.cxx | 15 +++--------
sw/source/core/unocore/unotext.cxx | 10 -------
10 files changed, 73 insertions(+), 150 deletions(-)
New commits:
commit c9a49cdaf0f9e17f0d899b9bc48d1ab51cc1d583
Author: Arkadiy Illarionov <qarkai at gmail.com>
AuthorDate: Sun Jun 23 00:10:00 2019 +0300
Commit: Arkadiy Illarionov <qarkai at gmail.com>
CommitDate: Mon Jun 24 21:36:32 2019 +0200
Drop sw::GetSupportedServiceNamesImpl
Use braced initializer lists and std::transform.
Change-Id: I5d1a57d766e39663a55f4921f486210d41fa917d
Reviewed-on: https://gerrit.libreoffice.org/74588
Tested-by: Jenkins
Reviewed-by: Arkadiy Illarionov <qarkai at gmail.com>
diff --git a/sw/inc/unobaseclass.hxx b/sw/inc/unobaseclass.hxx
index 2d93c7b5a2cf..674901c36a12 100644
--- a/sw/inc/unobaseclass.hxx
+++ b/sw/inc/unobaseclass.hxx
@@ -124,10 +124,6 @@ namespace sw {
return 0;
}
- css::uno::Sequence< OUString >
- GetSupportedServiceNamesImpl(
- size_t const nServices, char const*const pServices[]);
-
} // namespace sw
#endif // INCLUDED_SW_INC_UNOBASECLASS_HXX
diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx
index 0a53c27c4516..80d187be70a9 100644
--- a/sw/source/core/unocore/unobkm.cxx
+++ b/sw/source/core/unocore/unobkm.cxx
@@ -361,14 +361,6 @@ SwXBookmark::getImplementationName()
return OUString("SwXBookmark");
}
-static char const*const g_ServicesBookmark[] =
-{
- "com.sun.star.text.TextContent",
- "com.sun.star.text.Bookmark",
- "com.sun.star.document.LinkTarget",
-};
-static const size_t g_nServicesBookmark(SAL_N_ELEMENTS(g_ServicesBookmark));
-
sal_Bool SAL_CALL SwXBookmark::supportsService(const OUString& rServiceName)
{
return cppu::supportsService(this, rServiceName);
@@ -377,8 +369,11 @@ sal_Bool SAL_CALL SwXBookmark::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXBookmark::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesBookmark, g_ServicesBookmark);
+ return {
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.Bookmark",
+ "com.sun.star.document.LinkTarget"
+ };
}
// MetadatableMixin
diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx
index 0a8ae616032e..3318bcce85a0 100644
--- a/sw/source/core/unocore/unoftn.cxx
+++ b/sw/source/core/unocore/unoftn.cxx
@@ -47,6 +47,22 @@
using namespace ::com::sun::star;
+namespace {
+
+uno::Sequence< OUString >
+GetSupportedServiceNamesImpl(
+ size_t const nServices, char const*const pServices[])
+{
+ uno::Sequence< OUString > ret(static_cast<sal_Int32>(nServices));
+
+ std::transform(pServices, pServices + nServices, ret.begin(),
+ [](const char* pService) -> OUString { return OUString::createFromAscii(pService); });
+
+ return ret;
+}
+
+}
+
class SwXFootnote::Impl
: public SvtListener
{
@@ -199,7 +215,7 @@ uno::Sequence< OUString > SAL_CALL
SwXFootnote::getSupportedServiceNames()
{
SolarMutexGuard g;
- return ::sw::GetSupportedServiceNamesImpl(
+ return GetSupportedServiceNamesImpl(
(m_pImpl->m_bIsEndnote) ? g_nServicesEndnote : g_nServicesFootnote,
g_ServicesFootnote);
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index 6ac2e5f33232..f9bae53a53fc 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -2357,11 +2357,6 @@ SwXDocumentIndexes::getImplementationName()
return OUString("SwXDocumentIndexes");
}
-static char const*const g_ServicesDocumentIndexes[] =
-{
- "com.sun.star.text.DocumentIndexes",
-};
-
sal_Bool SAL_CALL SwXDocumentIndexes::supportsService(const OUString& rServiceName)
{
return cppu::supportsService(this, rServiceName);
@@ -2370,8 +2365,7 @@ sal_Bool SAL_CALL SwXDocumentIndexes::supportsService(const OUString& rServiceNa
uno::Sequence< OUString > SAL_CALL
SwXDocumentIndexes::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- SAL_N_ELEMENTS(g_ServicesDocumentIndexes), g_ServicesDocumentIndexes);
+ return { "com.sun.star.text.DocumentIndexes" };
}
sal_Int32 SAL_CALL
@@ -2542,11 +2536,6 @@ SwXDocumentIndex::StyleAccess_Impl::getImplementationName()
return OUString("SwXDocumentIndex::StyleAccess_Impl");
}
-static char const*const g_ServicesIndexStyleAccess[] =
-{
- "com.sun.star.text.DocumentIndexParagraphStyles",
-};
-
sal_Bool SAL_CALL
SwXDocumentIndex::StyleAccess_Impl::supportsService(const OUString& rServiceName)
{
@@ -2556,9 +2545,7 @@ SwXDocumentIndex::StyleAccess_Impl::supportsService(const OUString& rServiceName
uno::Sequence< OUString > SAL_CALL
SwXDocumentIndex::StyleAccess_Impl::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- SAL_N_ELEMENTS(g_ServicesIndexStyleAccess),
- g_ServicesIndexStyleAccess);
+ return { "com.sun.star.text.DocumentIndexParagraphStyles" };
}
void SAL_CALL
@@ -2662,11 +2649,6 @@ SwXDocumentIndex::TokenAccess_Impl::getImplementationName()
return OUString("SwXDocumentIndex::TokenAccess_Impl");
}
-static char const*const g_ServicesIndexTokenAccess[] =
-{
- "com.sun.star.text.DocumentIndexLevelFormat",
-};
-
sal_Bool SAL_CALL SwXDocumentIndex::TokenAccess_Impl::supportsService(
const OUString& rServiceName)
{
@@ -2676,9 +2658,7 @@ sal_Bool SAL_CALL SwXDocumentIndex::TokenAccess_Impl::supportsService(
uno::Sequence< OUString > SAL_CALL
SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- SAL_N_ELEMENTS(g_ServicesIndexTokenAccess),
- g_ServicesIndexTokenAccess);
+ return { "com.sun.star.text.DocumentIndexLevelFormat" };
}
struct TokenType_ {
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index bb3bf2d0f700..03699a2ee9d2 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -835,20 +835,6 @@ OUString SwXTextCursor::getImplementationName()
return OUString("SwXTextCursor");
}
-static char const*const g_ServicesTextCursor[] =
-{
- "com.sun.star.text.TextCursor",
- "com.sun.star.style.CharacterProperties",
- "com.sun.star.style.CharacterPropertiesAsian",
- "com.sun.star.style.CharacterPropertiesComplex",
- "com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.style.ParagraphPropertiesComplex",
- "com.sun.star.text.TextSortable",
-};
-
-static const size_t g_nServicesTextCursor(SAL_N_ELEMENTS(g_ServicesTextCursor));
-
sal_Bool SAL_CALL SwXTextCursor::supportsService(const OUString& rServiceName)
{
return cppu::supportsService(this, rServiceName);
@@ -857,8 +843,16 @@ sal_Bool SAL_CALL SwXTextCursor::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXTextCursor::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesTextCursor, g_ServicesTextCursor);
+ return {
+ "com.sun.star.text.TextCursor",
+ "com.sun.star.style.CharacterProperties",
+ "com.sun.star.style.CharacterPropertiesAsian",
+ "com.sun.star.style.CharacterPropertiesComplex",
+ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.style.ParagraphPropertiesComplex",
+ "com.sun.star.text.TextSortable"
+ };
}
namespace
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 553c8316fc72..ade11e8a1e0b 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -117,22 +117,6 @@ using namespace ::com::sun::star;
namespace sw {
-uno::Sequence< OUString >
-GetSupportedServiceNamesImpl(
- size_t const nServices, char const*const pServices[])
-{
- uno::Sequence< OUString > ret(nServices);
- for (size_t i = 0; i < nServices; ++i)
- {
- ret[i] = OUString::createFromAscii(pServices[i]);
- }
- return ret;
-}
-
-} // namespace sw
-
-namespace sw {
-
void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget)
{
rTarget = rSource;
@@ -882,19 +866,6 @@ SwXTextRange::getImplementationName()
return OUString("SwXTextRange");
}
-static char const*const g_ServicesTextRange[] =
-{
- "com.sun.star.text.TextRange",
- "com.sun.star.style.CharacterProperties",
- "com.sun.star.style.CharacterPropertiesAsian",
- "com.sun.star.style.CharacterPropertiesComplex",
- "com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.style.ParagraphPropertiesComplex",
-};
-
-static const size_t g_nServicesTextRange(SAL_N_ELEMENTS(g_ServicesTextRange));
-
sal_Bool SAL_CALL SwXTextRange::supportsService(const OUString& rServiceName)
{
return cppu::supportsService(this, rServiceName);
@@ -903,8 +874,15 @@ sal_Bool SAL_CALL SwXTextRange::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXTextRange::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesTextRange, g_ServicesTextRange);
+ return {
+ "com.sun.star.text.TextRange",
+ "com.sun.star.style.CharacterProperties",
+ "com.sun.star.style.CharacterPropertiesAsian",
+ "com.sun.star.style.CharacterPropertiesComplex",
+ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.style.ParagraphPropertiesComplex"
+ };
}
uno::Reference< text::XText > SAL_CALL
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index 2e1201675697..ce9a7d5ce5ff 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -303,20 +303,6 @@ SwXParagraph::getImplementationName()
return OUString("SwXParagraph");
}
-static char const*const g_ServicesParagraph[] =
-{
- "com.sun.star.text.TextContent",
- "com.sun.star.text.Paragraph",
- "com.sun.star.style.CharacterProperties",
- "com.sun.star.style.CharacterPropertiesAsian",
- "com.sun.star.style.CharacterPropertiesComplex",
- "com.sun.star.style.ParagraphProperties",
- "com.sun.star.style.ParagraphPropertiesAsian",
- "com.sun.star.style.ParagraphPropertiesComplex",
-};
-
-static const size_t g_nServicesParagraph(SAL_N_ELEMENTS(g_ServicesParagraph));
-
sal_Bool SAL_CALL
SwXParagraph::supportsService(const OUString& rServiceName)
{
@@ -326,8 +312,16 @@ SwXParagraph::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXParagraph::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesParagraph, g_ServicesParagraph);
+ return {
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.Paragraph",
+ "com.sun.star.style.CharacterProperties",
+ "com.sun.star.style.CharacterPropertiesAsian",
+ "com.sun.star.style.CharacterPropertiesComplex",
+ "com.sun.star.style.ParagraphProperties",
+ "com.sun.star.style.ParagraphPropertiesAsian",
+ "com.sun.star.style.ParagraphPropertiesComplex"
+ };
}
void
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index ac7d5d88f423..fe3b7f207bfb 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -172,14 +172,6 @@ OUString SAL_CALL SwXReferenceMark::getImplementationName()
return OUString("SwXReferenceMark");
}
-static char const*const g_ServicesReferenceMark[] =
-{
- "com.sun.star.text.TextContent",
- "com.sun.star.text.ReferenceMark",
-};
-
-static const size_t g_nServicesReferenceMark(SAL_N_ELEMENTS(g_ServicesReferenceMark));
-
sal_Bool SAL_CALL
SwXReferenceMark::supportsService(const OUString& rServiceName)
{
@@ -189,8 +181,10 @@ SwXReferenceMark::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXReferenceMark::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesReferenceMark, g_ServicesReferenceMark);
+ return {
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.ReferenceMark"
+ };
}
template<typename T> struct NotContainedIn
@@ -869,14 +863,6 @@ SwXMeta::getImplementationName()
return OUString("SwXMeta");
}
-static char const*const g_ServicesMeta[] =
-{
- "com.sun.star.text.TextContent",
- "com.sun.star.text.InContentMetadata",
-};
-
-static const size_t g_nServicesMeta(SAL_N_ELEMENTS(g_ServicesMeta));
-
sal_Bool SAL_CALL
SwXMeta::supportsService(const OUString& rServiceName)
{
@@ -886,7 +872,10 @@ SwXMeta::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXMeta::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(g_nServicesMeta, g_ServicesMeta);
+ return {
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.InContentMetadata"
+ };
}
// XComponent
@@ -1280,15 +1269,6 @@ SwXMetaField::getImplementationName()
return OUString("SwXMetaField");
}
-static char const*const g_ServicesMetaField[] =
-{
- "com.sun.star.text.TextContent",
- "com.sun.star.text.TextField",
- "com.sun.star.text.textfield.MetadataField",
-};
-
-static const size_t g_nServicesMetaField(SAL_N_ELEMENTS(g_ServicesMetaField));
-
sal_Bool SAL_CALL
SwXMetaField::supportsService(const OUString& rServiceName)
{
@@ -1298,8 +1278,11 @@ SwXMetaField::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXMetaField::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesMetaField, g_ServicesMetaField);
+ return {
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.TextField",
+ "com.sun.star.text.textfield.MetadataField"
+ };
}
// XComponent
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 44041c62a013..ca2c3968165c 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -1697,13 +1697,6 @@ SwXTextSection::getImplementationName()
return OUString("SwXTextSection");
}
-static char const*const g_ServicesTextSection[] =
-{
- "com.sun.star.text.TextContent",
- "com.sun.star.text.TextSection",
- "com.sun.star.document.LinkTarget",
-};
-
sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
{
return cppu::supportsService(this, rServiceName);
@@ -1712,9 +1705,11 @@ sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXTextSection::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- SAL_N_ELEMENTS(g_ServicesTextSection),
- g_ServicesTextSection);
+ return {
+ "com.sun.star.text.TextContent",
+ "com.sun.star.text.TextSection",
+ "com.sun.star.document.LinkTarget"
+ };
}
// MetadatableMixin
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index 727d6ec7aacf..204cf81cf677 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -2251,13 +2251,6 @@ SwXBodyText::getImplementationName()
return OUString("SwXBodyText");
}
-static char const*const g_ServicesBodyText[] =
-{
- "com.sun.star.text.Text",
-};
-
-static const size_t g_nServicesBodyText(SAL_N_ELEMENTS(g_ServicesBodyText));
-
sal_Bool SAL_CALL SwXBodyText::supportsService(const OUString& rServiceName)
{
return cppu::supportsService(this, rServiceName);
@@ -2266,8 +2259,7 @@ sal_Bool SAL_CALL SwXBodyText::supportsService(const OUString& rServiceName)
uno::Sequence< OUString > SAL_CALL
SwXBodyText::getSupportedServiceNames()
{
- return ::sw::GetSupportedServiceNamesImpl(
- g_nServicesBodyText, g_ServicesBodyText);
+ return { "com.sun.star.text.Text" };
}
uno::Any SAL_CALL
More information about the Libreoffice-commits
mailing list