LCOV - code coverage report
Current view: top level - libreoffice/writerfilter/source/dmapper - FFDataHandler.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 29 71 40.8 %
Date: 2012-12-17 Functions: 9 17 52.9 %
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             : #include "FFDataHandler.hxx"
      20             : 
      21             : #include <ooxml/resourceids.hxx>
      22             : #include "dmapperLoggers.hxx"
      23             : 
      24             : namespace writerfilter {
      25             : namespace dmapper {
      26             : 
      27             : /************************
      28             :  * class: FFDataHandler *
      29             :  ************************/
      30             : 
      31          14 : FFDataHandler::FFDataHandler() :
      32             : LoggedProperties(dmapper_logger, "FFDataHandler"),
      33             : m_nCheckboxHeight(0),
      34             : m_bCheckboxAutoHeight(false),
      35             : m_nCheckboxChecked(-1),
      36          14 : m_nCheckboxDefault(-1)
      37             : {
      38          14 : }
      39             : 
      40             : 
      41          28 : FFDataHandler::~FFDataHandler()
      42             : {
      43          28 : }
      44             : 
      45           2 : const OUString & FFDataHandler::getName() const
      46             : {
      47           2 :     return m_sName;
      48             : }
      49             : 
      50           0 : const OUString & FFDataHandler::getHelpText() const
      51             : {
      52           0 :     return m_sHelpText;
      53             : }
      54             : 
      55           0 : const OUString & FFDataHandler::getStatusText() const
      56             : {
      57           0 :     return m_sStatusText;
      58             : }
      59             : 
      60           0 : sal_uInt32 FFDataHandler::getCheckboxHeight() const
      61             : {
      62           0 :     return m_nCheckboxHeight;
      63             : }
      64             : 
      65           0 : bool FFDataHandler::getCheckboxAutoHeight() const
      66             : {
      67           0 :     return m_bCheckboxAutoHeight;
      68             : }
      69             : 
      70           2 : bool FFDataHandler::getCheckboxChecked() const
      71             : {
      72           2 :     if (m_nCheckboxChecked != -1)
      73           0 :         return m_nCheckboxChecked;
      74           2 :     else if (m_nCheckboxDefault != -1)
      75           2 :         return m_nCheckboxDefault;
      76             :     else
      77           0 :         return false;
      78             : }
      79             : 
      80           0 : const OUString & FFDataHandler::getDropDownResult() const
      81             : {
      82           0 :     return m_sDropDownResult;
      83             : }
      84             : 
      85           0 : const FFDataHandler::DropDownEntries_t & FFDataHandler::getDropDownEntries() const
      86             : {
      87           0 :     return m_DropDownEntries;
      88             : }
      89             : 
      90           0 : const OUString & FFDataHandler::getTextDefault() const
      91             : {
      92           0 :     return m_sTextDefault;
      93             : }
      94             : 
      95          12 : void FFDataHandler::lcl_sprm(Sprm & r_Sprm)
      96             : {
      97          12 :     switch(r_Sprm.getId())
      98             :     {
      99             :     case NS_ooxml::LN_CT_FFData_name:
     100             :         {
     101           2 :             m_sName = r_Sprm.getValue()->getString();
     102             :         }
     103           2 :         break;
     104             :     case NS_ooxml::LN_CT_FFData_helpText:
     105             :         {
     106           0 :             resolveSprm(r_Sprm);
     107             :         }
     108           0 :         break;
     109             :     case NS_ooxml::LN_CT_FFData_statusText:
     110             :         {
     111           0 :             resolveSprm(r_Sprm);
     112             :         }
     113           0 :         break;
     114             :     case NS_ooxml::LN_CT_FFCheckBox_size:
     115             :         {
     116           0 :             m_nCheckboxHeight = r_Sprm.getValue()->getInt();
     117             :         }
     118           0 :         break;
     119             :     case NS_ooxml::LN_CT_FFCheckBox_sizeAuto:
     120             :         {
     121           2 :             m_bCheckboxAutoHeight = r_Sprm.getValue()->getInt();
     122             :         }
     123           2 :         break;
     124             :     case NS_ooxml::LN_CT_FFCheckBox_checked:
     125             :         {
     126           0 :             m_nCheckboxChecked = r_Sprm.getValue()->getInt();
     127             :         }
     128           0 :         break;
     129             :     case NS_ooxml::LN_CT_FFCheckBox_default:
     130             :         {
     131           2 :             m_nCheckboxDefault = r_Sprm.getValue()->getInt();
     132             :         }
     133           2 :         break;
     134             :     case NS_ooxml::LN_CT_FFData_checkBox:
     135             :         {
     136           2 :             resolveSprm(r_Sprm);
     137             :         }
     138           2 :         break;
     139             :     case NS_ooxml::LN_CT_FFDDList_result:
     140             :         {
     141           0 :             m_sDropDownResult = r_Sprm.getValue()->getString();
     142             :         }
     143           0 :         break;
     144             :     case NS_ooxml::LN_CT_FFDDList_listEntry:
     145             :         {
     146           0 :             m_DropDownEntries.push_back(r_Sprm.getValue()->getString());
     147             :         }
     148           0 :         break;
     149             :     case NS_ooxml::LN_CT_FFData_ddList:
     150             :         {
     151           0 :             resolveSprm(r_Sprm);
     152             :         }
     153           0 :         break;
     154             :     case NS_ooxml::LN_CT_FFTextInput_default:
     155             :         {
     156           0 :             m_sTextDefault = r_Sprm.getValue()->getString();
     157             :         }
     158           0 :         break;
     159             :     case NS_ooxml::LN_CT_FFData_textInput:
     160             :         {
     161           0 :             resolveSprm(r_Sprm);
     162             :         }
     163           0 :         break;
     164             :     default:
     165             : #ifdef DEBUG_DOMAINMAPPER
     166             :         dmapper_logger->element("unhandled");
     167             : #endif
     168           4 :         break;
     169             :     }
     170          12 : }
     171             : 
     172           2 : void FFDataHandler::resolveSprm(Sprm & r_Sprm)
     173             : {
     174           2 :     writerfilter::Reference<Properties>::Pointer_t pProperties = r_Sprm.getProps();
     175           2 :     if( pProperties.get())
     176           2 :         pProperties->resolve(*this);
     177           2 : }
     178             : 
     179           0 : void FFDataHandler::lcl_attribute(Id name, Value & val)
     180             : {
     181           0 :     switch (name)
     182             :     {
     183             :     case NS_ooxml::LN_CT_FFHelpText_val:
     184             :         {
     185           0 :             m_sHelpText = val.getString();
     186             :         }
     187           0 :         break;
     188             :     case NS_ooxml::LN_CT_FFStatusText_val:
     189             :         {
     190           0 :             m_sStatusText = val.getString();
     191             :         }
     192           0 :         break;
     193             :     default:
     194             : #ifdef DEBUG_DOMAINMAPPER
     195             :         dmapper_logger->element("unhandled");
     196             : #endif
     197           0 :         break;
     198             :     }
     199           0 : }
     200             : 
     201          30 : }}
     202             : 
     203             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10