LCOV - code coverage report
Current view: top level - filter/source/xsltdialog - xmlfiltertabpagebasic.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 58 0.0 %
Date: 2012-08-25 Functions: 0 6 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 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 <rtl/ustrbuf.hxx>
      30                 :            : 
      31                 :            : #include "xmlfilterdialogstrings.hrc"
      32                 :            : #include "xmlfiltertabpagebasic.hxx"
      33                 :            : #include "xmlfiltertabpagebasic.hrc"
      34                 :            : #include "xmlfiltersettingsdialog.hxx"
      35                 :            : #include "xmlfilterhelpids.hrc"
      36                 :            : 
      37                 :            : using ::rtl::OUString;
      38                 :          0 : XMLFilterTabPageBasic::XMLFilterTabPageBasic( Window* pParent, ResMgr& rResMgr ) :
      39                 :            :     TabPage( pParent, ResId( RID_XML_FILTER_TABPAGE_BASIC, rResMgr ) ),
      40                 :            :     maFTFilterName( this, ResId( FT_XML_FILTER_NAME, rResMgr ) ),
      41                 :            :     maEDFilterName( this, ResId( ED_XML_FILTER_NAME, rResMgr ) ),
      42                 :            :     maFTApplication( this, ResId( FT_XML_APPLICATION, rResMgr ) ),
      43                 :            :     maCBApplication( this, ResId( CB_XML_APPLICATION, rResMgr ) ),
      44                 :            :     maFTInterfaceName( this, ResId( FT_XML_INTERFACE_NAME, rResMgr ) ),
      45                 :            :     maEDInterfaceName( this, ResId( ED_XML_INTERFACE_NAME, rResMgr ) ),
      46                 :            :     maFTExtension( this, ResId( FT_XML_EXTENSION, rResMgr ) ),
      47                 :            :     maEDExtension( this, ResId( ED_XML_EXTENSION, rResMgr ) ),
      48                 :            :     maFTDescription( this, ResId( FT_XML_DESCRIPTION, rResMgr ) ),
      49                 :          0 :     maEDDescription( this, ResId( ED_XML_DESCRIPTION, rResMgr ) )
      50                 :            : {
      51                 :          0 :     maCBApplication.SetHelpId( HID_XML_FILTER_APPLICATION );
      52                 :          0 :     maEDDescription.SetHelpId( HID_XML_FILTER_DESCRIPTION );
      53                 :            : 
      54                 :          0 :     FreeResource();
      55                 :            : 
      56                 :          0 :     std::vector< application_info_impl* >& rInfos = getApplicationInfos();
      57                 :          0 :     std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
      58                 :          0 :     while( aIter != rInfos.end() )
      59                 :            :     {
      60                 :          0 :         XubString aEntry( (*aIter++)->maDocumentUIName );
      61                 :          0 :         maCBApplication.InsertEntry( aEntry );
      62                 :          0 :     }
      63                 :          0 : }
      64                 :            : 
      65                 :          0 : XMLFilterTabPageBasic::~XMLFilterTabPageBasic()
      66                 :            : {
      67                 :          0 : }
      68                 :            : 
      69                 :          0 : static OUString checkExtensions( const String& rExtensions )
      70                 :            : {
      71                 :          0 :     const sal_Unicode* pSource = rExtensions.GetBuffer();
      72                 :          0 :     sal_Int32 nCount = rExtensions.Len();
      73                 :            : 
      74                 :          0 :     String aRet;
      75                 :          0 :     while( nCount-- )
      76                 :            :     {
      77                 :          0 :         switch(*pSource)
      78                 :            :         {
      79                 :            :         case sal_Unicode(','):
      80                 :          0 :             aRet += sal_Unicode(';');
      81                 :          0 :             break;
      82                 :            :         case sal_Unicode('.'):
      83                 :            :         case sal_Unicode('*'):
      84                 :          0 :             break;
      85                 :            :         default:
      86                 :          0 :             aRet += *pSource;
      87                 :            :         }
      88                 :            : 
      89                 :          0 :         pSource++;
      90                 :            :     }
      91                 :            : 
      92                 :          0 :     return aRet;
      93                 :            : }
      94                 :            : 
      95                 :          0 : bool XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo )
      96                 :            : {
      97                 :          0 :     if( pInfo )
      98                 :            :     {
      99                 :          0 :         if( maEDFilterName.GetText().Len() )
     100                 :          0 :             pInfo->maFilterName = maEDFilterName.GetText();
     101                 :            : 
     102                 :          0 :         if( maCBApplication.GetText().Len() )
     103                 :          0 :             pInfo->maDocumentService = maCBApplication.GetText();
     104                 :            : 
     105                 :          0 :         if( maEDInterfaceName.GetText().Len() )
     106                 :          0 :             pInfo->maInterfaceName = maEDInterfaceName.GetText();
     107                 :            : 
     108                 :          0 :         if( maEDExtension.GetText().Len() )
     109                 :          0 :             pInfo->maExtension = checkExtensions( maEDExtension.GetText() );
     110                 :            : 
     111                 :          0 :         pInfo->maComment = string_encode( maEDDescription.GetText() );
     112                 :            : 
     113                 :          0 :         if( !pInfo->maDocumentService.isEmpty() )
     114                 :            :         {
     115                 :          0 :             std::vector< application_info_impl* >& rInfos = getApplicationInfos();
     116                 :          0 :             std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
     117                 :          0 :             while( aIter != rInfos.end() )
     118                 :            :             {
     119                 :          0 :                 if( pInfo->maDocumentService == (*aIter)->maDocumentUIName )
     120                 :            :                 {
     121                 :          0 :                     pInfo->maDocumentService = (*aIter)->maDocumentService;
     122                 :          0 :                     pInfo->maExportService = (*aIter)->maXMLExporter;
     123                 :          0 :                     pInfo->maImportService = (*aIter)->maXMLImporter;
     124                 :          0 :                     break;
     125                 :            :                 }
     126                 :          0 :                 ++aIter;
     127                 :            :             }
     128                 :            :         }
     129                 :            :     }
     130                 :            : 
     131                 :          0 :     return true;
     132                 :            : }
     133                 :            : 
     134                 :          0 : void XMLFilterTabPageBasic::SetInfo(const filter_info_impl* pInfo)
     135                 :            : {
     136                 :          0 :     if( pInfo )
     137                 :            :     {
     138                 :          0 :         maEDFilterName.SetText( string_decode(pInfo->maFilterName) );
     139                 :            :         /*
     140                 :            :         if( pInfo->maDocumentService.getLength() )
     141                 :            :             maCBApplication.SetText( getApplicationUIName( pInfo->maDocumentService ) );
     142                 :            :         */
     143                 :          0 :         if( !pInfo->maExportService.isEmpty() )
     144                 :          0 :             maCBApplication.SetText( getApplicationUIName( pInfo->maExportService ) );
     145                 :            :         else
     146                 :          0 :             maCBApplication.SetText( getApplicationUIName( pInfo->maImportService ) );
     147                 :          0 :         maEDInterfaceName.SetText( string_decode(pInfo->maInterfaceName) );
     148                 :          0 :         maEDExtension.SetText( pInfo->maExtension );
     149                 :          0 :         maEDDescription.SetText( string_decode( pInfo->maComment ) );
     150                 :            :     }
     151                 :          0 : }
     152                 :            : 
     153                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10