LCOV - code coverage report
Current view: top level - filter/source/xsltdialog - xmlfiltertabpagebasic.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 70 1.4 %
Date: 2015-06-13 12:38:46 Functions: 2 9 22.2 %
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 "xmlfiltersettingsdialog.hxx"
      25             : 
      26           0 : XMLFilterTabPageBasic::XMLFilterTabPageBasic(vcl::Window* pParent)
      27           0 :     : TabPage(pParent, "XmlFilterTabPageGeneral", "filter/ui/xmlfiltertabpagegeneral.ui")
      28             : {
      29           0 :     get(m_pEDFilterName,   "filtername");
      30           0 :     get(m_pCBApplication,  "application");
      31           0 :     get(m_pEDInterfaceName,"interfacename");
      32           0 :     get(m_pEDExtension,    "extension");
      33           0 :     get(m_pEDDescription,  "description");
      34           0 :     m_pEDDescription->set_height_request(m_pEDDescription->GetTextHeight() * 4);
      35             : 
      36           0 :     std::vector< application_info_impl* >& rInfos = getApplicationInfos();
      37           0 :     std::vector< application_info_impl* >::iterator aIter( rInfos.begin() );
      38           0 :     while( aIter != rInfos.end() )
      39             :     {
      40           0 :         OUString aEntry( (*aIter++)->maDocumentUIName );
      41           0 :         m_pCBApplication->InsertEntry( aEntry );
      42           0 :     }
      43           0 : }
      44             : 
      45           0 : XMLFilterTabPageBasic::~XMLFilterTabPageBasic()
      46             : {
      47           0 :     disposeOnce();
      48           0 : }
      49             : 
      50           0 : void XMLFilterTabPageBasic::dispose()
      51             : {
      52           0 :     m_pEDFilterName.clear();
      53           0 :     m_pCBApplication.clear();
      54           0 :     m_pEDInterfaceName.clear();
      55           0 :     m_pEDExtension.clear();
      56           0 :     m_pEDDescription.clear();
      57           0 :     TabPage::dispose();
      58           0 : }
      59             : 
      60           0 : static OUString checkExtensions( const OUString& rExtensions )
      61             : {
      62           0 :     const sal_Unicode* pSource = rExtensions.getStr();
      63           0 :     sal_Int32 nCount = rExtensions.getLength();
      64             : 
      65           0 :     OUString aRet;
      66           0 :     while( nCount-- )
      67             :     {
      68           0 :         switch(*pSource)
      69             :         {
      70             :         case sal_Unicode(','):
      71           0 :             aRet += ";";
      72           0 :             break;
      73             :         case sal_Unicode('.'):
      74             :         case sal_Unicode('*'):
      75           0 :             break;
      76             :         default:
      77           0 :             aRet += OUString( *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( !m_pEDFilterName->GetText().isEmpty() )
      91           0 :             pInfo->maFilterName = m_pEDFilterName->GetText();
      92             : 
      93           0 :         if( !m_pCBApplication->GetText().isEmpty() )
      94           0 :             pInfo->maDocumentService = m_pCBApplication->GetText();
      95             : 
      96           0 :         if( !m_pEDInterfaceName->GetText().isEmpty() )
      97           0 :             pInfo->maInterfaceName = m_pEDInterfaceName->GetText();
      98             : 
      99           0 :         if( !m_pEDExtension->GetText().isEmpty() )
     100           0 :             pInfo->maExtension = checkExtensions( m_pEDExtension->GetText() );
     101             : 
     102           0 :         pInfo->maComment = string_encode( m_pEDDescription->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 :         m_pEDFilterName->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 :             m_pCBApplication->SetText( getApplicationUIName( pInfo->maExportService ) );
     136             :         else
     137           0 :             m_pCBApplication->SetText( getApplicationUIName( pInfo->maImportService ) );
     138           0 :         m_pEDInterfaceName->SetText( string_decode(pInfo->maInterfaceName) );
     139           0 :         m_pEDExtension->SetText( pInfo->maExtension );
     140           0 :         m_pEDDescription->SetText( string_decode( pInfo->maComment ) );
     141             :     }
     142           3 : }
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11