LCOV - code coverage report
Current view: top level - starmath/source - config.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 17 47 36.2 %
Date: 2014-11-03 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          24 : SmConfig::SmConfig()
      40             : {
      41          24 : }
      42             : 
      43             : 
      44           8 : SmConfig::~SmConfig()
      45             : {
      46           8 : }
      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, true, &pItem) == SfxItemState::SET)
      56           0 :     {   nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
      57           0 :         SetPrintSize( (SmPrintSize) nU16 );
      58             :     }
      59           0 :     if (rSet.GetItemState(SID_PRINTZOOM, true, &pItem) == SfxItemState::SET)
      60           0 :     {   nU16 = ((const SfxUInt16Item *) pItem)->GetValue();
      61           0 :         SetPrintZoomFactor( nU16 );
      62             :     }
      63           0 :     if (rSet.GetItemState(SID_PRINTTITLE, true, &pItem) == SfxItemState::SET)
      64           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      65           0 :         SetPrintTitle( bVal );
      66             :     }
      67           0 :     if (rSet.GetItemState(SID_PRINTTEXT, true, &pItem) == SfxItemState::SET)
      68           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      69           0 :         SetPrintFormulaText( bVal );
      70             :     }
      71           0 :     if (rSet.GetItemState(SID_PRINTFRAME, true, &pItem) == SfxItemState::SET)
      72           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      73           0 :         SetPrintFrame( bVal );
      74             :     }
      75           0 :     if (rSet.GetItemState(SID_AUTOREDRAW, true, &pItem) == SfxItemState::SET)
      76           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      77           0 :         SetAutoRedraw( bVal );
      78             :     }
      79           0 :     if (rSet.GetItemState(SID_NO_RIGHT_SPACES, true, &pItem) == SfxItemState::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, true, &pItem) == SfxItemState::SET)
      90           0 :     {   bVal = ((const SfxBoolItem *) pItem)->GetValue();
      91           0 :         SetSaveOnlyUsedSymbols( bVal );
      92             :     }
      93             : 
      94           0 :     SaveOther();
      95           0 : }
      96             : 
      97             : 
      98          42 : void SmConfig::ConfigToItemSet(SfxItemSet &rSet) const
      99             : {
     100          42 :     const SfxItemPool *pPool = rSet.GetPool();
     101             : 
     102          42 :     rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTSIZE),
     103          84 :                            (sal_uInt16) GetPrintSize()));
     104          42 :     rSet.Put(SfxUInt16Item(pPool->GetWhich(SID_PRINTZOOM),
     105          84 :                            (sal_uInt16) GetPrintZoomFactor()));
     106             : 
     107          42 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTITLE), IsPrintTitle()));
     108          42 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTTEXT),  IsPrintFormulaText()));
     109          42 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_PRINTFRAME), IsPrintFrame()));
     110          42 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_AUTOREDRAW), IsAutoRedraw()));
     111          42 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_NO_RIGHT_SPACES), IsIgnoreSpacesRight()));
     112          42 :     rSet.Put(SfxBoolItem(pPool->GetWhich(SID_SAVE_ONLY_USED_SYMBOLS), IsSaveOnlyUsedSymbols()));
     113         114 : }
     114             : 
     115             : 
     116             : 
     117             : 
     118             : 
     119             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10