LCOV - code coverage report
Current view: top level - filter/source/svg - impsvgdialog.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 66 1.5 %
Date: 2015-06-13 12:38:46 Functions: 2 10 20.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             : 
      21             : #include "impsvgdialog.hxx"
      22             : #include <cstdio>
      23             : 
      24             : using namespace com::sun::star::uno;
      25             : using namespace com::sun::star::beans;
      26             : 
      27           0 : inline sal_Int32 implMap( vcl::Window& /*rWnd*/, sal_Int32 nVal )
      28             : {
      29             :     //return( rWnd.LogicToLogic( Size( nVal, nVal ) ).Height(), MAP_APPFONT, MAP_APPFONT );
      30           0 :     return( nVal << 1 );
      31             : }
      32             : 
      33             : 
      34             : // - ImpSVGDialog -
      35             : 
      36             : 
      37           0 : ImpSVGDialog::ImpSVGDialog( vcl::Window* pParent, Sequence< PropertyValue >& rFilterData ) :
      38             :     ModalDialog( pParent ),
      39             :     maFI( VclPtr<FixedLine>::Create(this) ),
      40             :     maCBTinyProfile( VclPtr<CheckBox>::Create(this) ),
      41             :     maCBEmbedFonts( VclPtr<CheckBox>::Create(this) ),
      42             :     maCBUseNativeDecoration( VclPtr<CheckBox>::Create(this) ),
      43             :     maBTOK( VclPtr<OKButton>::Create(this, WB_DEF_OK) ),
      44             :     maBTCancel( VclPtr<CancelButton>::Create(this) ),
      45             :     maBTHelp( VclPtr<HelpButton>::Create(this) ),
      46             :     maConfigItem( SVG_EXPORTFILTER_CONFIGPATH, &rFilterData ),
      47           0 :     mbOldNativeDecoration( false )
      48             : {
      49           0 :     SetText( "SVG Export Options" );
      50           0 :     SetOutputSizePixel( Size( implMap( *this, 177 ), implMap( *this, 77 ) ) );
      51             : 
      52           0 :     maFI->SetText( "Export" );
      53           0 :     maFI->SetPosSizePixel( Point( implMap( *this, 6 ), implMap( *this, 3 ) ),
      54           0 :                                  Size( implMap( *this, 165 ), implMap( *this, 8 ) ) );
      55             : 
      56           0 :     maCBTinyProfile->SetText( "Use SVG Tiny profile" );
      57           0 :     maCBTinyProfile->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 14 ) ),
      58           0 :                                      Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
      59             : 
      60           0 :     maCBEmbedFonts->SetText( "Embed fonts" );
      61           0 :     maCBEmbedFonts->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 27 ) ),
      62           0 :                                     Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
      63             : 
      64           0 :     maCBUseNativeDecoration->SetText( "Use SVG native text decoration" );
      65           0 :     maCBUseNativeDecoration->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 41 ) ),
      66           0 :                                              Size( implMap( *this, 142 ), implMap( *this, 10 ) ) );
      67             : 
      68           0 :     maCBTinyProfile->Check( maConfigItem.ReadBool( OUString( SVG_PROP_TINYPROFILE ), false ) );
      69           0 :     maCBEmbedFonts->Check( maConfigItem.ReadBool( OUString( SVG_PROP_EMBEDFONTS ), true ) );
      70           0 :     maCBUseNativeDecoration->Check( maConfigItem.ReadBool( OUString( SVG_PROP_NATIVEDECORATION ), true ) );
      71             : 
      72           0 :     maBTOK->SetPosSizePixel( Point( implMap( *this, 12 ), implMap( *this, 57 ) ),
      73           0 :                             Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
      74           0 :     maBTCancel->SetPosSizePixel( Point( implMap( *this, 65 ), implMap( *this, 57 ) ),
      75           0 :                                 Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
      76           0 :     maBTHelp->SetPosSizePixel( Point( implMap( *this, 121 ), implMap( *this, 57 ) ),
      77           0 :                               Size( implMap( *this, 50 ), implMap( *this, 14 ) ) );
      78             : 
      79           0 :     maCBTinyProfile->SetToggleHdl( LINK( this, ImpSVGDialog, OnToggleCheckbox ) );
      80           0 :     OnToggleCheckbox( maCBTinyProfile.get() );
      81             : 
      82           0 :     maFI->Show();
      83             : 
      84           0 :     maCBTinyProfile->Show();
      85           0 :     maCBEmbedFonts->Show();
      86           0 :     maCBUseNativeDecoration->Show();
      87             : 
      88           0 :     maBTOK->Show();
      89           0 :     maBTCancel->Show();
      90           0 :     maBTHelp->Show();
      91           0 : }
      92             : 
      93             : 
      94             : 
      95           0 : ImpSVGDialog::~ImpSVGDialog()
      96             : {
      97           0 :     disposeOnce();
      98           0 : }
      99             : 
     100           0 : void ImpSVGDialog::dispose()
     101             : {
     102           0 :     maFI.disposeAndClear();
     103           0 :     maCBTinyProfile.disposeAndClear();
     104           0 :     maCBEmbedFonts.disposeAndClear();
     105           0 :     maCBUseNativeDecoration.disposeAndClear();
     106           0 :     maBTOK.disposeAndClear();
     107           0 :     maBTCancel.disposeAndClear();
     108           0 :     maBTHelp.disposeAndClear();
     109           0 :     maConfigItem.WriteModifiedConfig();
     110           0 :     ModalDialog::dispose();
     111           0 : }
     112             : 
     113             : 
     114             : 
     115           0 : Sequence< PropertyValue > ImpSVGDialog::GetFilterData()
     116             : {
     117           0 :     maConfigItem.WriteBool( OUString( SVG_PROP_TINYPROFILE ), maCBTinyProfile->IsChecked() );
     118           0 :     maConfigItem.WriteBool( OUString( SVG_PROP_EMBEDFONTS ), maCBEmbedFonts->IsChecked() );
     119           0 :     maConfigItem.WriteBool( OUString( SVG_PROP_NATIVEDECORATION ), maCBUseNativeDecoration->IsChecked() );
     120             : 
     121           0 :     return( maConfigItem.GetFilterData() );
     122             : }
     123             : 
     124             : 
     125             : 
     126           0 : IMPL_LINK( ImpSVGDialog, OnToggleCheckbox, CheckBox*, pBox )
     127             : {
     128           0 :     if( pBox == maCBTinyProfile.get() )
     129             :     {
     130           0 :         if( pBox->IsChecked() )
     131             :         {
     132           0 :             mbOldNativeDecoration = maCBUseNativeDecoration->IsChecked();
     133             : 
     134           0 :             maCBUseNativeDecoration->Check( false );
     135           0 :             maCBUseNativeDecoration->Disable();
     136             :         }
     137             :         else
     138             :         {
     139           0 :             maCBUseNativeDecoration->Enable();
     140           0 :             maCBUseNativeDecoration->Check( mbOldNativeDecoration );
     141             :         }
     142             :     }
     143             : 
     144           0 :     return 0;
     145           9 : }
     146             : 
     147             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11