LCOV - code coverage report
Current view: top level - libreoffice/vcl/source/components - stringmirror.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 34 0.0 %
Date: 2012-12-27 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "com/sun/star/lang/XServiceInfo.hpp"
      22             : #include "com/sun/star/util/XStringMapping.hpp"
      23             : 
      24             : #include "cppuhelper/implbase2.hxx"
      25             : #include "rtl/ustrbuf.hxx"
      26             : #include "vcl/svapp.hxx"
      27             : 
      28             : using ::rtl::OUString;
      29             : using namespace ::com::sun::star::uno;
      30             : using namespace ::com::sun::star::lang;
      31             : using namespace ::com::sun::star::util;
      32             : 
      33             : // -----------------------------------------------------------------------
      34             : 
      35             : namespace vcl
      36             : {
      37             : 
      38             : class StringMirror : public ::cppu::WeakAggImplHelper2< XStringMapping, XServiceInfo >
      39             : {
      40             : public:
      41           0 :     StringMirror()
      42           0 :     {}
      43             : 
      44           0 :     virtual ~StringMirror()
      45           0 :     {}
      46             : 
      47             :     // XServiceInfo
      48             :     virtual OUString SAL_CALL getImplementationName(  ) throw (RuntimeException);
      49             :     virtual ::sal_Bool SAL_CALL supportsService( const OUString& ) throw (RuntimeException);
      50             :     virtual Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (RuntimeException);
      51             : 
      52             :     // XStringMapping
      53           0 :     virtual sal_Bool SAL_CALL mapStrings( Sequence< OUString >& io_rStrings ) throw (RuntimeException)
      54             :     {
      55           0 :         sal_Int32 nItems = io_rStrings.getLength();
      56           0 :         for( sal_Int32 n = 0; n < nItems; n++ )
      57             :         {
      58           0 :             rtl::OUString& rStr( io_rStrings.getArray()[n] );
      59             : 
      60           0 :             sal_Int32 nLen = rStr.getLength();
      61           0 :             rtl::OUStringBuffer aMirror( nLen );
      62           0 :             for(sal_Int32 i = nLen - 1; i >= 0; i--)
      63             :             {
      64           0 :                 sal_Unicode cChar = rStr[ i ];
      65           0 :                 aMirror.append(sal_Unicode(GetMirroredChar(cChar)));
      66             :             }
      67           0 :             rStr = aMirror.makeStringAndClear();
      68           0 :         }
      69           0 :         return sal_True;
      70             :     }
      71             : };
      72             : 
      73           0 : Sequence< OUString > StringMirror_getSupportedServiceNames()
      74             : {
      75           0 :     static OUString aServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.StringMirror" ) );
      76           0 :     static Sequence< OUString > aServiceNames( &aServiceName, 1 );
      77           0 :     return aServiceNames;
      78             : }
      79             : 
      80           0 : OUString StringMirror_getImplementationName()
      81             : {
      82           0 :     return OUString( RTL_CONSTASCII_USTRINGPARAM( "vcl::StringMirror" ) );
      83             : }
      84             : 
      85           0 : Reference< XInterface > SAL_CALL StringMirror_createInstance( const Reference< XMultiServiceFactory >&  )
      86             : {
      87           0 :     return static_cast< ::cppu::OWeakObject * >( new StringMirror );
      88             : }
      89             : 
      90             : 
      91             : // XServiceInfo
      92           0 : OUString SAL_CALL StringMirror::getImplementationName() throw (RuntimeException)
      93             : {
      94           0 :     return StringMirror_getImplementationName();
      95             : }
      96             : 
      97           0 : sal_Bool SAL_CALL StringMirror::supportsService( const OUString& i_rServiceName ) throw (RuntimeException)
      98             : {
      99           0 :     Sequence< OUString > aSN( StringMirror_getSupportedServiceNames() );
     100           0 :     for( sal_Int32 nService = 0; nService < aSN.getLength(); nService++ )
     101             :     {
     102           0 :         if( aSN[nService] == i_rServiceName )
     103           0 :             return sal_True;
     104             :     }
     105           0 :     return sal_False;
     106             : }
     107             : 
     108           0 : Sequence< OUString > SAL_CALL StringMirror::getSupportedServiceNames() throw (RuntimeException)
     109             : {
     110           0 :     return StringMirror_getSupportedServiceNames();
     111             : }
     112             : 
     113             : } // namespace vcl
     114             : 
     115             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10