LCOV - code coverage report
Current view: top level - sw/source/ui/uno - SwXFilterOptions.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 73 2.7 %
Date: 2012-08-25 Functions: 1 15 6.7 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 84 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                 :            : #include <SwXFilterOptions.hxx>
      30                 :            : #include <shellio.hxx>
      31                 :            : #include <swdll.hxx>
      32                 :            : #include <unoprnms.hxx>
      33                 :            : #include <osl/mutex.hxx>
      34                 :            : #include <vcl/svapp.hxx>
      35                 :            : #include <vcl/msgbox.hxx>
      36                 :            : #include <com/sun/star/lang/XUnoTunnel.hpp>
      37                 :            : #include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
      38                 :            : #include <unotools/ucbstreamhelper.hxx>
      39                 :            : #include <unotxdoc.hxx>
      40                 :            : 
      41                 :            : #include "swabstdlg.hxx"
      42                 :            : #include "dialog.hrc"
      43                 :            : 
      44                 :            : using namespace ::com::sun::star;
      45                 :            : using namespace ::com::sun::star::ui::dialogs;
      46                 :            : using namespace ::com::sun::star::document;
      47                 :            : using namespace ::com::sun::star::lang;
      48                 :            : 
      49                 :            : #define SWFILTEROPTIONSOBJ_SERVICE      RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ui.dialogs.FilterOptionsDialog")
      50                 :            : #define SWFILTEROPTIONSOBJ_IMPLNAME     RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.Writer.FilterOptionsDialog")
      51                 :            : #define FILTER_OPTIONS_NAME             RTL_CONSTASCII_USTRINGPARAM("FilterOptions")
      52                 :            : 
      53                 :          0 : SwXFilterOptions::SwXFilterOptions() :
      54                 :          0 :     bExport( sal_False )
      55                 :            : {
      56                 :          0 : }
      57                 :            : 
      58                 :          0 : SwXFilterOptions::~SwXFilterOptions()
      59                 :            : {
      60         [ #  # ]:          0 : }
      61                 :            : 
      62                 :         74 : ::rtl::OUString  SwXFilterOptions::getImplementationName_Static()
      63                 :            : {
      64                 :         74 :     return ::rtl::OUString(SWFILTEROPTIONSOBJ_IMPLNAME);
      65                 :            : }
      66                 :            : 
      67                 :          0 : uno::Sequence< ::rtl::OUString> SwXFilterOptions::getSupportedServiceNames_Static()
      68                 :            : {
      69         [ #  # ]:          0 :     ::rtl::OUString sService(SWFILTEROPTIONSOBJ_SERVICE);
      70         [ #  # ]:          0 :     return uno::Sequence< ::rtl::OUString> (&sService, 1);
      71                 :            : }
      72                 :            : 
      73                 :          0 : uno::Sequence< beans::PropertyValue > SwXFilterOptions::getPropertyValues() throw (uno::RuntimeException)
      74                 :            : {
      75                 :          0 :     uno::Sequence<beans::PropertyValue> aRet(1);
      76         [ #  # ]:          0 :     beans::PropertyValue* pArray = aRet.getArray();
      77                 :            : 
      78         [ #  # ]:          0 :     pArray[0].Name = rtl::OUString( FILTER_OPTIONS_NAME );
      79         [ #  # ]:          0 :     pArray[0].Value <<= sFilterOptions;
      80                 :            : 
      81                 :          0 :     return aRet;
      82                 :            : }
      83                 :            : 
      84                 :          0 : void   SwXFilterOptions::setPropertyValues( const uno::Sequence<beans::PropertyValue >& aProps )
      85                 :            :     throw (beans::UnknownPropertyException, beans::PropertyVetoException,
      86                 :            :        IllegalArgumentException, WrappedTargetException, uno::RuntimeException)
      87                 :            : {
      88                 :          0 :     const beans::PropertyValue* pPropArray = aProps.getConstArray();
      89                 :          0 :     long nPropCount = aProps.getLength();
      90         [ #  # ]:          0 :     for (long i = 0; i < nPropCount; i++)
      91                 :            :     {
      92                 :          0 :         const beans::PropertyValue& rProp = pPropArray[i];
      93                 :          0 :         ::rtl::OUString aPropName = rProp.Name;
      94                 :            : 
      95 [ #  # ][ #  # ]:          0 :         if ( aPropName.equalsAscii( SW_PROP_NAME_STR(UNO_NAME_FILTER_NAME) ) )
      96                 :          0 :             rProp.Value >>= sFilterName;
      97 [ #  # ][ #  # ]:          0 :         else if ( aPropName == ::rtl::OUString(FILTER_OPTIONS_NAME) )
      98                 :          0 :             rProp.Value >>= sFilterOptions;
      99         [ #  # ]:          0 :         else if ( aPropName == "InputStream" )
     100         [ #  # ]:          0 :             rProp.Value >>= xInputStream;
     101                 :          0 :     }
     102                 :          0 : }
     103                 :            : 
     104                 :          0 : void   SwXFilterOptions::setTitle( const ::rtl::OUString& /*rTitle*/ )
     105                 :            :     throw (uno::RuntimeException)
     106                 :            : {
     107                 :          0 : }
     108                 :            : 
     109                 :          0 : sal_Int16 SwXFilterOptions::execute() throw (uno::RuntimeException)
     110                 :            : {
     111                 :          0 :     sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
     112                 :            : 
     113                 :          0 :     SvStream* pInStream = NULL;
     114         [ #  # ]:          0 :     if ( xInputStream.is() )
     115         [ #  # ]:          0 :         pInStream = utl::UcbStreamHelper::CreateStream( xInputStream );
     116                 :            : 
     117         [ #  # ]:          0 :     uno::Reference< XUnoTunnel > xTunnel(xModel, uno::UNO_QUERY);
     118                 :          0 :     SwDocShell* pDocShell = 0;
     119         [ #  # ]:          0 :     if(xTunnel.is())
     120                 :            :     {
     121                 :            :         SwXTextDocument* pXDoc = reinterpret_cast< SwXTextDocument * >(
     122 [ #  # ][ #  # ]:          0 :                 sal::static_int_cast< sal_IntPtr >(xTunnel->getSomething(SwXTextDocument::getUnoTunnelId())));
                 [ #  # ]
     123         [ #  # ]:          0 :         pDocShell = pXDoc ? pXDoc->GetDocShell() : 0;
     124                 :            :     }
     125         [ #  # ]:          0 :     if(pDocShell)
     126                 :            :     {
     127                 :            : 
     128         [ #  # ]:          0 :         SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
     129                 :            :         OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!");
     130                 :            : 
     131         [ #  # ]:          0 :         AbstractSwAsciiFilterDlg* pAsciiDlg = pFact->CreateSwAsciiFilterDlg( NULL, *pDocShell,pInStream,  DLG_ASCII_FILTER );
     132                 :            :         OSL_ENSURE(pAsciiDlg, "Dialogdiet fail!");
     133 [ #  # ][ #  # ]:          0 :         if(RET_OK == pAsciiDlg->Execute())
     134                 :            :         {
     135         [ #  # ]:          0 :             SwAsciiOptions aOptions;
     136         [ #  # ]:          0 :             pAsciiDlg->FillOptions( aOptions );
     137         [ #  # ]:          0 :             String sTmp;
     138         [ #  # ]:          0 :             aOptions.WriteUserData(sTmp);
     139         [ #  # ]:          0 :             sFilterOptions = sTmp;
     140 [ #  # ][ #  # ]:          0 :             nRet = ui::dialogs::ExecutableDialogResults::OK;
     141                 :            :         }
     142 [ #  # ][ #  # ]:          0 :         delete pAsciiDlg;
     143                 :            :     }
     144                 :            : 
     145 [ #  # ][ #  # ]:          0 :     delete pInStream;
     146                 :            : 
     147                 :          0 :     return nRet;
     148                 :            : }
     149                 :            : 
     150                 :          0 : void   SwXFilterOptions::setTargetDocument( const uno::Reference< XComponent >& xDoc )
     151                 :            :     throw (IllegalArgumentException, uno::RuntimeException)
     152                 :            : {
     153                 :          0 :     bExport = sal_False;
     154                 :          0 :     xModel = xDoc;
     155                 :          0 : }
     156                 :            : 
     157                 :          0 : void   SwXFilterOptions::setSourceDocument( const uno::Reference<XComponent >& xDoc )
     158                 :            :         throw (IllegalArgumentException,uno::RuntimeException)
     159                 :            : {
     160                 :          0 :     bExport = sal_True;
     161                 :          0 :     xModel = xDoc;
     162                 :          0 : }
     163                 :            : 
     164                 :          0 : ::rtl::OUString SwXFilterOptions::getImplementationName() throw(uno::RuntimeException)
     165                 :            : {
     166                 :          0 :     return ::rtl::OUString(SWFILTEROPTIONSOBJ_IMPLNAME);
     167                 :            : }
     168                 :            : 
     169                 :          0 : sal_Bool SwXFilterOptions::supportsService( const ::rtl::OUString& rServiceName )
     170                 :            :     throw(uno::RuntimeException)
     171                 :            : {
     172                 :          0 :     return rServiceName == ::rtl::OUString(SWFILTEROPTIONSOBJ_SERVICE);
     173                 :            : }
     174                 :            : 
     175                 :          0 : uno::Sequence< ::rtl::OUString > SwXFilterOptions::getSupportedServiceNames()
     176                 :            :                 throw(uno::RuntimeException)
     177                 :            : {
     178                 :          0 :     return SwXFilterOptions::getSupportedServiceNames_Static();
     179                 :            : }
     180                 :            : 
     181                 :          0 : uno::Reference<uno::XInterface> SAL_CALL SwXFilterOptions_createInstance(
     182                 :            :                         const uno::Reference<lang::XMultiServiceFactory>& )
     183                 :            : {
     184         [ #  # ]:          0 :     SolarMutexGuard aGuard;
     185         [ #  # ]:          0 :     SwGlobals::ensure();
     186 [ #  # ][ #  # ]:          0 :     return (::cppu::OWeakObject*) new SwXFilterOptions;
                 [ #  # ]
     187                 :            : }
     188                 :            : 
     189                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10