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

Generated by: LCOV version 1.10