LCOV - code coverage report
Current view: top level - svtools/source/dialogs - colrdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 39 0.0 %
Date: 2012-08-25 Functions: 0 7 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 76 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/awt/XWindow.hpp>
      31                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      32                 :            : #include <com/sun/star/beans/XPropertyAccess.hpp>
      33                 :            : #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
      34                 :            : 
      35                 :            : #include <comphelper/processfactory.hxx>
      36                 :            : 
      37                 :            : #include <toolkit/helper/vclunohelper.hxx>
      38                 :            : 
      39                 :            : #include <svtools/colrdlg.hxx>
      40                 :            : 
      41                 :            : using rtl::OUString;
      42                 :            : using namespace ::com::sun::star::uno;
      43                 :            : using namespace ::com::sun::star::lang;
      44                 :            : using namespace ::com::sun::star::beans;
      45                 :            : using namespace ::com::sun::star::ui::dialogs;
      46                 :            : 
      47                 :            : // ---------------
      48                 :            : // - ColorDialog -
      49                 :            : // ---------------
      50                 :            : 
      51                 :          0 : SvColorDialog::SvColorDialog( Window* pWindow )
      52                 :            : : mpParent( pWindow )
      53                 :          0 : , meMode( svtools::ColorPickerMode_SELECT )
      54                 :            : {
      55                 :          0 : }
      56                 :            : 
      57                 :          0 : SvColorDialog::~SvColorDialog()
      58                 :            : {
      59         [ #  # ]:          0 : }
      60                 :            : 
      61                 :          0 : void SvColorDialog::SetColor( const Color& rColor )
      62                 :            : {
      63                 :          0 :     maColor = rColor;
      64                 :          0 : }
      65                 :            : 
      66                 :            : // -----------------------------------------------------------------------
      67                 :            : 
      68                 :          0 : const Color& SvColorDialog::GetColor() const
      69                 :            : {
      70                 :          0 :     return maColor;
      71                 :            : }
      72                 :            : 
      73                 :            : // -----------------------------------------------------------------------
      74                 :            : 
      75                 :          0 : void SvColorDialog::SetMode( sal_Int16 eMode )
      76                 :            : {
      77                 :          0 :     meMode = eMode;
      78                 :          0 : }
      79                 :            : 
      80                 :            : // -----------------------------------------------------------------------
      81                 :            : 
      82                 :          0 : short SvColorDialog::Execute()
      83                 :            : {
      84                 :          0 :     short ret = 0;
      85                 :            :     try
      86                 :            :     {
      87         [ #  # ]:          0 :         const OUString sColor( RTL_CONSTASCII_USTRINGPARAM( "Color" ) );
      88 [ #  # ][ #  # ]:          0 :         Reference< XMultiServiceFactory > xSMGR( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
      89                 :            : 
      90         [ #  # ]:          0 :         Reference< com::sun::star::awt::XWindow > xParent( VCLUnoHelper::GetInterface( mpParent ) );
      91                 :            : 
      92         [ #  # ]:          0 :         Sequence< Any > args(1);
      93 [ #  # ][ #  # ]:          0 :         args[0] = Any( xParent );
      94                 :            : 
      95 [ #  # ][ #  # ]:          0 :         Reference< XExecutableDialog > xDialog( xSMGR->createInstanceWithArguments(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.cui.ColorPicker")), args), UNO_QUERY_THROW );
         [ #  # ][ #  # ]
      96         [ #  # ]:          0 :         Reference< XPropertyAccess > xPropertyAccess( xDialog, UNO_QUERY_THROW );
      97                 :            : 
      98         [ #  # ]:          0 :         Sequence< PropertyValue > props( 2 );
      99         [ #  # ]:          0 :         props[0].Name = sColor;
     100 [ #  # ][ #  # ]:          0 :         props[0].Value <<= (sal_Int32) maColor.GetColor();
     101 [ #  # ][ #  # ]:          0 :         props[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Mode" ) );
     102 [ #  # ][ #  # ]:          0 :         props[1].Value <<= (sal_Int16) meMode;
     103                 :            : 
     104 [ #  # ][ #  # ]:          0 :         xPropertyAccess->setPropertyValues( props );
     105                 :            : 
     106 [ #  # ][ #  # ]:          0 :         ret = xDialog->execute();
     107                 :            : 
     108         [ #  # ]:          0 :         if( ret )
     109                 :            :         {
     110 [ #  # ][ #  # ]:          0 :             props = xPropertyAccess->getPropertyValues();
         [ #  # ][ #  # ]
     111         [ #  # ]:          0 :             for( sal_Int32 n = 0; n < props.getLength(); n++ )
     112                 :            :             {
     113 [ #  # ][ #  # ]:          0 :                 if( props[n].Name.equals( sColor ) )
     114                 :            :                 {
     115                 :          0 :                     sal_Int32 nColor = 0;
     116 [ #  # ][ #  # ]:          0 :                     if( props[n].Value >>= nColor )
     117                 :            :                     {
     118                 :          0 :                         maColor.SetColor( nColor );
     119                 :            :                     }
     120                 :            : 
     121                 :            :                 }
     122                 :            :             }
     123 [ #  # ][ #  # ]:          0 :         }
                 [ #  # ]
     124                 :            :     }
     125                 :          0 :     catch(Exception&)
     126                 :            :     {
     127                 :            :         OSL_ASSERT(false);
     128                 :            :     }
     129                 :            : 
     130                 :          0 :     return ret;
     131                 :            : }
     132                 :            : 
     133                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10