[Libreoffice-commits] .: sw/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Jan 16 07:25:58 PST 2013


 sw/source/core/unocore/unoport.cxx     |   21 ++-------------------
 sw/source/core/unocore/unoportenum.cxx |    4 ++--
 sw/source/core/unocore/unosett.cxx     |   18 +++++++-----------
 sw/source/core/unocore/unosrch.cxx     |    5 ++---
 sw/source/core/unocore/unostyle.cxx    |   23 ++++-------------------
 sw/source/core/unocore/unotbl.cxx      |   25 ++++++++-----------------
 6 files changed, 25 insertions(+), 71 deletions(-)

New commits:
commit 1ca295eb999fa08fbf0d211f1a464544532a253d
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jan 16 16:04:48 2013 +0100

    sw: start using cppu::supportsService in unocore
    
    Change-Id: Ifa2154af314af98c7c81781f8cbd47ba1e48f730

diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 75f7a3e..56dfe2f 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -42,10 +42,10 @@
 #include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
 #include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 
 using namespace ::com::sun::star;
-using ::rtl::OUString;
 
 /******************************************************************
  * SwXTextPortion
@@ -918,24 +918,7 @@ throw( uno::RuntimeException )
 
 sal_Bool SwXTextPortion::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    SolarMutexGuard aGuard;
-    SwUnoCrsr* pUnoCrsr = GetCursor();
-    if(!pUnoCrsr)
-        throw uno::RuntimeException();
-
-    sal_Bool bRet = sal_False;
-    if(!rServiceName.compareToAscii("com.sun.star.text.TextPortion") ||
-            !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties") ||
-            !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian") ||
-            !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex") ||
-            !rServiceName.compareToAscii("com.sun.star.style.ParagraphProperties") ||
-            !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesAsian") ||
-            !rServiceName.compareToAscii("com.sun.star.style.ParagraphPropertiesComplex"))
-    {
-        bRet = sal_True;
-    }
-
-    return bRet;
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXTextPortion::getSupportedServiceNames()
diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx
index 8794d5c..b1eff9d 100644
--- a/sw/source/core/unocore/unoportenum.cxx
+++ b/sw/source/core/unocore/unoportenum.cxx
@@ -51,6 +51,7 @@
 #include <osl/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <set>
 #include <boost/shared_ptr.hpp>
 #include <boost/bind.hpp>
@@ -61,7 +62,6 @@
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::text;
-using ::rtl::OUString;
 using namespace ::std;
 
 typedef ::std::pair< TextRangeList_t * const, SwTxtAttr const * const > PortionList_t;
@@ -226,7 +226,7 @@ sal_Bool
 SwXTextPortionEnumeration::supportsService(const OUString& rServiceName)
 throw( RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.TextPortionEnumeration";
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXTextPortionEnumeration::getSupportedServiceNames()
diff --git a/sw/source/core/unocore/unosett.cxx b/sw/source/core/unocore/unosett.cxx
index 55b2d45..d142975 100644
--- a/sw/source/core/unocore/unosett.cxx
+++ b/sw/source/core/unocore/unosett.cxx
@@ -65,9 +65,9 @@
 #include <com/sun/star/text/LabelFollow.hpp>
 #include <numrule.hxx>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <paratr.hxx>
 
-using ::rtl::OUString;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::lang;
@@ -75,8 +75,6 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::text;
 using namespace ::com::sun::star::style;
 
-using rtl::OUString;
-
 struct PropValData
 {
     uno::Any        aVal;
@@ -294,7 +292,7 @@ OUString SwXFootnoteProperties::getImplementationName(void) throw( RuntimeExcept
 
 sal_Bool SwXFootnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.FootnoteSettings";
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXFootnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
@@ -604,7 +602,7 @@ OUString SwXEndnoteProperties::getImplementationName(void) throw( RuntimeExcepti
 
 sal_Bool SwXEndnoteProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.FootnoteSettings";
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXEndnoteProperties::getSupportedServiceNames(void) throw( RuntimeException )
@@ -835,7 +833,7 @@ OUString SwXLineNumberingProperties::getImplementationName(void) throw( RuntimeE
 
 sal_Bool SwXLineNumberingProperties::supportsService(const OUString& rServiceName) throw( RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.LineNumberingProperties";
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXLineNumberingProperties::getSupportedServiceNames(void) throw( RuntimeException )
@@ -1148,7 +1146,7 @@ OUString SwXNumberingRules::getImplementationName(void) throw( RuntimeException
 
 sal_Bool SwXNumberingRules::supportsService(const OUString& rServiceName) throw( RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.NumberingRules";
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXNumberingRules::getSupportedServiceNames(void) throw( RuntimeException )
@@ -2335,9 +2333,7 @@ OUString SwXChapterNumbering::getImplementationName(void) throw( RuntimeExceptio
 
 sal_Bool SwXChapterNumbering::supportsService(const OUString& rServiceName) throw( RuntimeException )
 {
-    String sServiceName(rServiceName);
-    return sServiceName.EqualsAscii("com.sun.star.text.ChapterNumbering") ||
-            sServiceName.EqualsAscii("com.sun.star.text.NumberingRules");
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXChapterNumbering::getSupportedServiceNames(void) throw( RuntimeException )
@@ -2368,7 +2364,7 @@ OUString SwXTextColumns::getImplementationName(void) throw( RuntimeException )
 
 sal_Bool SwXTextColumns::supportsService(const OUString& rServiceName) throw( RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.TextColumns";
+    return cppu::supportsService(this, rServiceName);
 }
 
 Sequence< OUString > SwXTextColumns::getSupportedServiceNames(void) throw( RuntimeException )
diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx
index 88824db..0c929cb 100644
--- a/sw/source/core/unocore/unosrch.cxx
+++ b/sw/source/core/unocore/unosrch.cxx
@@ -33,9 +33,9 @@
 #include <com/sun/star/i18n/TransliterationModules.hpp>
 #include <com/sun/star/beans/PropertyAttribute.hpp>
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::com::sun::star;
-using ::rtl::OUString;
 
 class SwSearchProperties_Impl
 {
@@ -692,8 +692,7 @@ OUString SwXTextSearch::getImplementationName(void) throw( uno::RuntimeException
 
 sal_Bool SwXTextSearch::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.util.SearchDescriptor" ||
-            rServiceName == "com.sun.star.util.ReplaceDescriptor";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXTextSearch::getSupportedServiceNames(void) throw( uno::RuntimeException )
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 7dc7524..28f3b9c 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -68,6 +68,7 @@
 #include <numrule.hxx>
 
 #include <comphelper/servicehelper.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <boost/shared_ptr.hpp>
 
@@ -104,7 +105,6 @@ const IStyleAccess::SwAutoStyleFamily aAutoStyleByIndex[] =
 };
 
 using namespace ::com::sun::star;
-using ::rtl::OUString;
 
 //convert FN_... to RES_ in header and footer itemset
 static sal_uInt16 lcl_ConvertFNToRES(sal_uInt16 nFNId)
@@ -193,7 +193,7 @@ OUString SwXStyleFamilies::getImplementationName(void) throw( uno::RuntimeExcept
 
 sal_Bool SwXStyleFamilies::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.style.StyleFamilies";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXStyleFamilies::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -442,7 +442,7 @@ OUString SwXStyleFamily::getImplementationName(void) throw( uno::RuntimeExceptio
 
 sal_Bool SwXStyleFamily::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.style.StyleFamily";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXStyleFamily::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -1192,22 +1192,7 @@ OUString SwXStyle::getImplementationName(void) throw( uno::RuntimeException )
 
 sal_Bool SwXStyle::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    sal_Bool bRet = rServiceName == "com.sun.star.style.Style";
-    if(!bRet && SFX_STYLE_FAMILY_CHAR == eFamily)
-        bRet = !rServiceName.compareToAscii("com.sun.star.style.CharacterStyle")||
-               !rServiceName.compareToAscii("com.sun.star.style.CharacterProperties")||
-               !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesAsian")||
-               !rServiceName.compareToAscii("com.sun.star.style.CharacterPropertiesComplex");
-    if(!bRet && SFX_STYLE_FAMILY_PARA == eFamily)
-        bRet = (rServiceName == "com.sun.star.style.ParagraphStyle")||
-               (rServiceName == "com.sun.star.style.ParagraphProperties") ||
-               (rServiceName == "com.sun.star.style.ParagraphPropertiesAsian") ||
-               (rServiceName == "com.sun.star.style.ParagraphPropertiesComplex");
-    if(!bRet && SFX_STYLE_FAMILY_PAGE == eFamily)
-        bRet = (rServiceName == "com.sun.star.style.PageStyle")||
-               (rServiceName == "com.sun.star.style.PageProperties");
-
-    return  bRet;
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXStyle::getSupportedServiceNames(void) throw( uno::RuntimeException )
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 1c70a02..a642ece 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -96,9 +96,9 @@
 #include <switerator.hxx>
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/string.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 using namespace ::com::sun::star;
-using ::rtl::OUString;
 using ::editeng::SvxBorderLine;
 
 // from swtable.cxx
@@ -1253,8 +1253,7 @@ OUString SwXCell::getImplementationName(void) throw( uno::RuntimeException )
 
 sal_Bool SwXCell::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    String sServiceName(rServiceName);
-    return sServiceName.EqualsAscii("com.sun.star.text.CellProperties");
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXCell::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -1275,7 +1274,7 @@ OUString SwXTextTableRow::getImplementationName(void) throw( uno::RuntimeExcepti
 
 sal_Bool SwXTextTableRow::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.TextTableRow";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXTextTableRow::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -1462,7 +1461,7 @@ OUString SwXTextTableCursor::getImplementationName(void) throw( uno::RuntimeExce
 
 sal_Bool SwXTextTableCursor::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.TextTableCursor";
+    return cppu::supportsService(this, rServiceName);
 }
 
 IMPLEMENT_FORWARD_XINTERFACE2(SwXTextTableCursor,SwXTextTableCursor_Base,OTextCursorHelper)
@@ -3613,11 +3612,7 @@ OUString SAL_CALL SwXTextTable::getImplementationName(void) throw( uno::RuntimeE
 
 sal_Bool SwXTextTable::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    String sServiceName(rServiceName);
-    return (sServiceName.EqualsAscii("com.sun.star.document.LinkTarget")  ||
-            sServiceName.EqualsAscii("com.sun.star.text.TextTable")  ||
-            sServiceName.EqualsAscii("com.sun.star.text.TextContent") ||
-            sServiceName.EqualsAscii("com.sun.star.text.TextSortable"));
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXTextTable::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -3662,11 +3657,7 @@ OUString SwXCellRange::getImplementationName(void) throw( uno::RuntimeException
 
 sal_Bool SwXCellRange::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return
-        rServiceName == "com.sun.star.text.CellRange" || rServiceName == "com.sun.star.style.CharacterProperties"
-     || rServiceName == "com.sun.star.style.CharacterPropertiesAsian" || rServiceName == "com.sun.star.style.CharacterPropertiesComplex"
-     || rServiceName == "com.sun.star.style.ParagraphProperties" || rServiceName == "com.sun.star.style.ParagraphPropertiesAsian"
-     || rServiceName == "com.sun.star.style.ParagraphPropertiesComplex";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXCellRange::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -4622,7 +4613,7 @@ OUString SwXTableRows::getImplementationName(void) throw( uno::RuntimeException
 
 sal_Bool SwXTableRows::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.TableRows";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXTableRows::getSupportedServiceNames(void) throw( uno::RuntimeException )
@@ -4838,7 +4829,7 @@ OUString SwXTableColumns::getImplementationName(void) throw( uno::RuntimeExcepti
 
 sal_Bool SwXTableColumns::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
 {
-    return rServiceName == "com.sun.star.text.TableColumns";
+    return cppu::supportsService(this, rServiceName);
 }
 
 uno::Sequence< OUString > SwXTableColumns::getSupportedServiceNames(void) throw( uno::RuntimeException )


More information about the Libreoffice-commits mailing list