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

Generated by: LCOV version 1.10