LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/starmath/source - config.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 17 47 36.2 %
Date: 2013-07-09 Functions: 6 7 85.7 %
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 <svl/itemset.hxx>
      21             : #include <svl/hint.hxx>
      22             : #include <svl/smplhint.hxx>
      23             : #include <unotools/pathoptions.hxx>
      24             : #include <sfx2/sfxsids.hrc>
      25             : #include <svl/eitem.hxx>
      26             : #include <svl/itempool.hxx>
      27             : #include <svl/stritem.hxx>
      28             : #include <svl/intitem.hxx>
      29             : #include <tools/stream.hxx>
      30             : 
      31             : 
      32             : #include "config.hxx"
      33             : #include "format.hxx"
      34             : #include "smmod.hxx"
      35             : #include "starmath.hrc"
      36             : 
      37             : /////////////////////////////////////////////////////////////////
      38             : 
      39           7 : SmConfig::SmConfig()
      40             : {
      41           7 : }
      42             : 
      43             : 
      44           4 : SmConfig::~SmConfig()
      45             : {
      46           4 : }
      47             : 
      48             : 
      49           0 : void SmConfig::ItemSetToConfig(const SfxItemSet &rSet)
      50             : {
      51           0 :     const SfxPoolItem *pItem     = NULL;
      52             : 
      53             :     sal_uInt16 nU16;
      54             :     bool bVal;
      55           0 :     if (rSet.GetItemState(SID_PRINTSIZE, sal_True, &pItem) == SFX_ITEM_SET)
      56           0 :     {   nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
      57           0 :         SetPrintSize( (SmPrintSize) nU16 );
      58             :     }
      59           0 :     if (rSet.GetItemState(SID_PRINTZOOM, sal_True, &pItem) == SFX_ITEM_SET)
      60           0 :     {   nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
      61           0 :         SetPrintZoomFactor( nU16 );
      62             :     }
      63           0 :     if (rSet.GetItemState(SID_PRINTTITLE, sal_True, &pItem) == SFX_ITEM_SET)
      64           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      65           0 :         SetPrintTitle( bVal );
      66             :     }
      67           0 :     if (rSet.GetItemState(SID_PRINTTEXT, sal_True, &pItem) == SFX_ITEM_SET)
      68           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      69           0 :         SetPrintFormulaText( bVal );
      70             :     }
      71           0 :     if (rSet.GetItemState(SID_PRINTFRAME, sal_True, &pItem) == SFX_ITEM_SET)
      72           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      73           0 :         SetPrintFrame( bVal );
      74             :     }
      75           0 :     if (rSet.GetItemState(SID_AUTOREDRAW, sal_True, &pItem) == SFX_ITEM_SET)
      76           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      77           0 :         SetAutoRedraw( bVal );
      78             :     }
      79           0 :     if (rSet.GetItemState(SID_NO_RIGHT_SPACES, sal_True, &pItem) == SFX_ITEM_SET)
      80           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      81           0 :         if (IsIgnoreSpacesRight() != bVal)
      82             :         {
      83           0 :             SetIgnoreSpacesRight( bVal );
      84             : 
      85             :             // reformat (displayed) formulas accordingly
      86           0 :             Broadcast(SfxSimpleHint(HINT_FORMATCHANGED));
      87             :         }
      88             :     }
      89           0 :     if (rSet.GetItemState(SID_SAVE_ONLY_USED_SYMBOLS, sal_True, &pItem) == SFX_ITEM_SET)
      90           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      91           0 :         SetSaveOnlyUsedSymbols( bVal );
      92             :     }
      93             : 
      94           0 :     SaveOther();
      95           0 : }
      96             : 
      97             : 
      98          21 : void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
      99             : {
     100          21 :     const SfxItemPool *pPool = rSet.GetPool();
     101             : 
     102          21 :     rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
     103          42 :                            (sal_uInt16) GetPrintSize()));
     104          21 :     rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
     105          42 :                            (sal_uInt16) GetPrintZoomFactor()));
     106             : 
     107          21 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
     108          21 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT),  IsPrintFormulaText()));
     109          21 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
     110          21 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
     111          21 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
     112          21 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), IsSaveOnlyUsedSymbols()));
     113          42 : }
     114             : 
     115             : 
     116             : /////////////////////////////////////////////////////////////////
     117             : 
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10