LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - morphdlg.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 52 0.0 %
Date: 2015-06-13 12:38:46 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 "morphdlg.hxx"
      21             : 
      22             : #include "strings.hrc"
      23             : #include "sdresid.hxx"
      24             : #include "sdmod.hxx"
      25             : #include "sdiocmpt.hxx"
      26             : #include <svx/xfillit0.hxx>
      27             : #include <svx/xlineit0.hxx>
      28             : #include <svx/xenum.hxx>
      29             : #include <svx/svdobj.hxx>
      30             : #include <svl/itemset.hxx>
      31             : #include <svl/itempool.hxx>
      32             : #include <com/sun/star/drawing/LineStyle.hpp>
      33             : 
      34             : using namespace com::sun::star;
      35             : 
      36             : namespace sd {
      37             : 
      38           0 : MorphDlg::MorphDlg( vcl::Window* pParent, const SdrObject* pObj1, const SdrObject* pObj2 )
      39             :     : ModalDialog(pParent, "CrossFadeDialog",
      40           0 :         "modules/sdraw/ui/crossfadedialog.ui")
      41             : {
      42           0 :     get(m_pMtfSteps, "increments");
      43           0 :     get(m_pCbxAttributes, "attributes");
      44           0 :     get(m_pCbxOrientation, "orientation");
      45             : 
      46           0 :     LoadSettings();
      47             : 
      48           0 :     SfxItemPool & pPool = pObj1->GetObjectItemPool();
      49           0 :     SfxItemSet      aSet1( pPool );
      50           0 :     SfxItemSet      aSet2( pPool );
      51             : 
      52           0 :     aSet1.Put(pObj1->GetMergedItemSet());
      53           0 :     aSet2.Put(pObj2->GetMergedItemSet());
      54             : 
      55           0 :     const drawing::LineStyle eLineStyle1 = static_cast<const XLineStyleItem&>( aSet1.Get( XATTR_LINESTYLE ) ).GetValue();
      56           0 :     const drawing::LineStyle eLineStyle2 = static_cast<const XLineStyleItem&>( aSet2.Get( XATTR_LINESTYLE ) ).GetValue();
      57           0 :     const drawing::FillStyle eFillStyle1 = static_cast<const XFillStyleItem&>( aSet1.Get( XATTR_FILLSTYLE ) ).GetValue();
      58           0 :     const drawing::FillStyle eFillStyle2 = static_cast<const XFillStyleItem&>( aSet2.Get( XATTR_FILLSTYLE ) ).GetValue();
      59             : 
      60           0 :     if ( ( ( eLineStyle1 == drawing::LineStyle_NONE ) || ( eLineStyle2 == drawing::LineStyle_NONE ) ) &&
      61           0 :          ( ( eFillStyle1 != drawing::FillStyle_SOLID ) || ( eFillStyle2 != drawing::FillStyle_SOLID ) ) )
      62             :     {
      63           0 :         m_pCbxAttributes->Disable();
      64           0 :     }
      65           0 : }
      66             : 
      67           0 : MorphDlg::~MorphDlg()
      68             : {
      69           0 :     disposeOnce();
      70           0 : }
      71             : 
      72           0 : void MorphDlg::dispose()
      73             : {
      74           0 :     m_pMtfSteps.clear();
      75           0 :     m_pCbxAttributes.clear();
      76           0 :     m_pCbxOrientation.clear();
      77           0 :     ModalDialog::dispose();
      78           0 : }
      79             : 
      80           0 : void MorphDlg::LoadSettings()
      81             : {
      82           0 :     tools::SvRef<SotStorageStream>  xIStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
      83           0 :                                SD_OPTION_LOAD ) );
      84             :     sal_uInt16              nSteps;
      85             :     bool                bOrient, bAttrib;
      86             : 
      87           0 :     if( xIStm.Is() )
      88             :     {
      89           0 :         SdIOCompat aCompat( *xIStm, StreamMode::READ );
      90             : 
      91           0 :         xIStm->ReadUInt16( nSteps ).ReadCharAsBool( bOrient ).ReadCharAsBool( bAttrib );
      92             :     }
      93             :     else
      94             :     {
      95           0 :         nSteps = 16;
      96           0 :         bOrient = bAttrib = true;
      97             :     }
      98             : 
      99           0 :     m_pMtfSteps->SetValue( nSteps );
     100           0 :     m_pCbxOrientation->Check( bOrient );
     101           0 :     m_pCbxAttributes->Check( bAttrib );
     102           0 : }
     103             : 
     104           0 : void MorphDlg::SaveSettings() const
     105             : {
     106           0 :     tools::SvRef<SotStorageStream> xOStm( SD_MOD()->GetOptionStream( OUString(SD_OPTION_MORPHING) ,
     107           0 :                                SD_OPTION_STORE ) );
     108             : 
     109           0 :     if( xOStm.Is() )
     110             :     {
     111           0 :         SdIOCompat aCompat( *xOStm, StreamMode::WRITE, 1 );
     112             : 
     113           0 :         xOStm->WriteUInt16( m_pMtfSteps->GetValue() )
     114           0 :               .WriteBool( m_pCbxOrientation->IsChecked() )
     115           0 :               .WriteBool( m_pCbxAttributes->IsChecked() );
     116           0 :     }
     117           0 : }
     118             : 
     119           0 : } // end of namespace sd
     120             : 
     121             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11