LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - datasettings.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 72 87 82.8 %
Date: 2015-06-13 12:38:46 Functions: 5 6 83.3 %
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 "datasettings.hxx"
      21             : #include "apitools.hxx"
      22             : #include "dbastrings.hrc"
      23             : #include <osl/diagnose.h>
      24             : #include <comphelper/property.hxx>
      25             : #include <comphelper/types.hxx>
      26             : #include <com/sun/star/beans/PropertyAttribute.hpp>
      27             : #include <vcl/svapp.hxx>
      28             : #include <com/sun/star/awt/FontWeight.hpp>
      29             : #include <com/sun/star/awt/FontEmphasisMark.hpp>
      30             : #include <com/sun/star/awt/FontRelief.hpp>
      31             : 
      32             : #include <com/sun/star/awt/FontWidth.hpp>
      33             : 
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::awt;
      36             : using namespace ::com::sun::star::lang;
      37             : using namespace ::com::sun::star::beans;
      38             : using namespace ::comphelper;
      39             : using namespace ::cppu;
      40             : 
      41             : namespace dbaccess
      42             : {
      43             : // ODataSettings
      44         132 : void ODataSettings::registerPropertiesFor(ODataSettings_Base* _pItem)
      45             : {
      46         132 :     if ( m_bQuery )
      47             :     {
      48             :         registerProperty(PROPERTY_HAVING_CLAUSE, PROPERTY_ID_HAVING_CLAUSE, PropertyAttribute::BOUND,
      49          42 :                     &_pItem->m_sHavingClause, cppu::UnoType<decltype(_pItem->m_sHavingClause)>::get());
      50             : 
      51             :         registerProperty(PROPERTY_GROUP_BY, PROPERTY_ID_GROUP_BY, PropertyAttribute::BOUND,
      52          42 :                     &_pItem->m_sGroupBy, cppu::UnoType<decltype(_pItem->m_sGroupBy)>::get());
      53             :     }
      54             : 
      55             :     registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
      56         132 :                     &_pItem->m_sFilter, cppu::UnoType<decltype(_pItem->m_sFilter)>::get());
      57             : 
      58             :     registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
      59         132 :                     &_pItem->m_sOrder, cppu::UnoType<decltype(_pItem->m_sOrder)>::get());
      60             : 
      61             :     registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
      62         132 :                     &_pItem->m_bApplyFilter, cppu::UnoType<bool>::get());
      63             : 
      64             :     registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
      65         132 :                     &_pItem->m_aFont, cppu::UnoType<decltype(_pItem->m_aFont)>::get());
      66             : 
      67             :     registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
      68         132 :                     &_pItem->m_aRowHeight, ::cppu::UnoType<sal_Int32>::get());
      69             : 
      70             :     registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
      71         132 :                     &_pItem->m_aTextColor, ::cppu::UnoType<sal_Int32>::get());
      72             : 
      73             :     registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
      74         132 :                     &_pItem->m_aTextLineColor, ::cppu::UnoType<sal_Int32>::get());
      75             : 
      76             :     registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
      77         132 :         &_pItem->m_nFontEmphasis, cppu::UnoType<decltype(_pItem->m_nFontEmphasis)>::get());
      78             : 
      79         132 :     registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,&_pItem->m_nFontRelief, cppu::UnoType<decltype(_pItem->m_nFontRelief)>::get());
      80             : 
      81         132 :     registerProperty(PROPERTY_FONTNAME,         PROPERTY_ID_FONTNAME,        PropertyAttribute::BOUND,&_pItem->m_aFont.Name,            cppu::UnoType<decltype(_pItem->m_aFont.Name)>::get());
      82         132 :     registerProperty(PROPERTY_FONTHEIGHT,       PROPERTY_ID_FONTHEIGHT,      PropertyAttribute::BOUND,&_pItem->m_aFont.Height,          cppu::UnoType<decltype(_pItem->m_aFont.Height)>::get());
      83         132 :     registerProperty(PROPERTY_FONTWIDTH,        PROPERTY_ID_FONTWIDTH,       PropertyAttribute::BOUND,&_pItem->m_aFont.Width,           cppu::UnoType<decltype(_pItem->m_aFont.Width)>::get());
      84         132 :     registerProperty(PROPERTY_FONTSTYLENAME,    PROPERTY_ID_FONTSTYLENAME,   PropertyAttribute::BOUND,&_pItem->m_aFont.StyleName,       cppu::UnoType<decltype(_pItem->m_aFont.StyleName)>::get());
      85         132 :     registerProperty(PROPERTY_FONTFAMILY,       PROPERTY_ID_FONTFAMILY,      PropertyAttribute::BOUND,&_pItem->m_aFont.Family,          cppu::UnoType<decltype(_pItem->m_aFont.Family)>::get());
      86         132 :     registerProperty(PROPERTY_FONTCHARSET,      PROPERTY_ID_FONTCHARSET,     PropertyAttribute::BOUND,&_pItem->m_aFont.CharSet,         cppu::UnoType<decltype(_pItem->m_aFont.CharSet)>::get());
      87         132 :     registerProperty(PROPERTY_FONTPITCH,        PROPERTY_ID_FONTPITCH,       PropertyAttribute::BOUND,&_pItem->m_aFont.Pitch,           cppu::UnoType<decltype(_pItem->m_aFont.Pitch)>::get());
      88         132 :     registerProperty(PROPERTY_FONTCHARWIDTH,    PROPERTY_ID_FONTCHARWIDTH,   PropertyAttribute::BOUND,&_pItem->m_aFont.CharacterWidth,  cppu::UnoType<decltype(_pItem->m_aFont.CharacterWidth)>::get());
      89         132 :     registerProperty(PROPERTY_FONTWEIGHT,       PROPERTY_ID_FONTWEIGHT,      PropertyAttribute::BOUND,&_pItem->m_aFont.Weight,          cppu::UnoType<decltype(_pItem->m_aFont.Weight)>::get());
      90         132 :     registerProperty(PROPERTY_FONTSLANT,        PROPERTY_ID_FONTSLANT,       PropertyAttribute::BOUND,&_pItem->m_aFont.Slant,           cppu::UnoType<decltype(_pItem->m_aFont.Slant)>::get());
      91         132 :     registerProperty(PROPERTY_FONTUNDERLINE,    PROPERTY_ID_FONTUNDERLINE,   PropertyAttribute::BOUND,&_pItem->m_aFont.Underline,       cppu::UnoType<decltype(_pItem->m_aFont.Underline)>::get());
      92         132 :     registerProperty(PROPERTY_FONTSTRIKEOUT,    PROPERTY_ID_FONTSTRIKEOUT,   PropertyAttribute::BOUND,&_pItem->m_aFont.Strikeout,       cppu::UnoType<decltype(_pItem->m_aFont.Strikeout)>::get());
      93         132 :     registerProperty(PROPERTY_FONTORIENTATION,  PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&_pItem->m_aFont.Orientation,     cppu::UnoType<decltype(_pItem->m_aFont.Orientation)>::get());
      94         132 :     registerProperty(PROPERTY_FONTKERNING,      PROPERTY_ID_FONTKERNING,     PropertyAttribute::BOUND,&_pItem->m_aFont.Kerning,         cppu::UnoType<decltype(_pItem->m_aFont.Kerning)>::get());
      95         132 :     registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&_pItem->m_aFont.WordLineMode,    cppu::UnoType<decltype(_pItem->m_aFont.WordLineMode)>::get());
      96         132 :     registerProperty(PROPERTY_FONTTYPE,         PROPERTY_ID_FONTTYPE,        PropertyAttribute::BOUND,&_pItem->m_aFont.Type,            cppu::UnoType<decltype(_pItem->m_aFont.Type)>::get());
      97         132 : }
      98             : 
      99         132 : ODataSettings::ODataSettings(OBroadcastHelper& _rBHelper,bool _bQuery)
     100             :     :OPropertyStateContainer(_rBHelper)
     101             :     ,ODataSettings_Base()
     102         132 :     ,m_bQuery(_bQuery)
     103             : {
     104         132 : }
     105             : 
     106         202 : ODataSettings_Base::ODataSettings_Base()
     107             :     :m_bApplyFilter(false)
     108             :     ,m_aFont(::comphelper::getDefaultFont())
     109             :     ,m_nFontEmphasis(::com::sun::star::awt::FontEmphasisMark::NONE)
     110         202 :     ,m_nFontRelief(::com::sun::star::awt::FontRelief::NONE)
     111             : {
     112         202 : }
     113             : 
     114           0 : ODataSettings_Base::ODataSettings_Base(const ODataSettings_Base& _rSource)
     115             :     :m_sFilter( _rSource.m_sFilter )
     116             :     ,m_sHavingClause( _rSource.m_sHavingClause )
     117             :     ,m_sGroupBy( _rSource.m_sGroupBy )
     118             :     ,m_sOrder( _rSource.m_sOrder )
     119             :     ,m_bApplyFilter( _rSource.m_bApplyFilter )
     120             :     ,m_aFont( _rSource.m_aFont )
     121             :     ,m_aRowHeight( _rSource.m_aRowHeight )
     122             :     ,m_aTextColor( _rSource.m_aTextColor )
     123             :     ,m_aTextLineColor( _rSource.m_aTextLineColor )
     124             :     ,m_nFontEmphasis( _rSource.m_nFontEmphasis )
     125           0 :     ,m_nFontRelief( _rSource.m_nFontRelief )
     126             : {
     127           0 : }
     128             : 
     129         202 : ODataSettings_Base::~ODataSettings_Base()
     130             : {
     131         202 : }
     132             : 
     133         108 : void ODataSettings::getPropertyDefaultByHandle( sal_Int32 _nHandle, Any& _rDefault ) const
     134             : {
     135         108 :     static ::com::sun::star::awt::FontDescriptor aFD = ::comphelper::getDefaultFont();
     136         108 :     switch( _nHandle )
     137             :     {
     138             :         case PROPERTY_ID_HAVING_CLAUSE:
     139             :         case PROPERTY_ID_GROUP_BY:
     140             :         case PROPERTY_ID_FILTER:
     141             :         case PROPERTY_ID_ORDER:
     142           0 :             _rDefault <<= OUString();
     143           0 :             break;
     144             :         case PROPERTY_ID_FONT:
     145           0 :             _rDefault <<= ::comphelper::getDefaultFont();
     146           0 :             break;
     147             :         case PROPERTY_ID_APPLYFILTER:
     148           0 :             _rDefault <<= sal_False;
     149           0 :             break;
     150             :         case PROPERTY_ID_TEXTRELIEF:
     151           6 :             _rDefault <<= ::com::sun::star::awt::FontRelief::NONE;
     152           6 :             break;
     153             :         case PROPERTY_ID_TEXTEMPHASIS:
     154           6 :             _rDefault <<= ::com::sun::star::awt::FontEmphasisMark::NONE;
     155           6 :             break;
     156             :         case PROPERTY_ID_FONTNAME:
     157           6 :             _rDefault <<= aFD.Name;
     158           6 :             break;
     159             :         case PROPERTY_ID_FONTHEIGHT:
     160           6 :             _rDefault <<= aFD.Height;
     161           6 :             break;
     162             :         case PROPERTY_ID_FONTWIDTH:
     163           6 :             _rDefault <<= aFD.Width;
     164           6 :             break;
     165             :         case PROPERTY_ID_FONTSTYLENAME:
     166           6 :             _rDefault <<= aFD.StyleName;
     167           6 :             break;
     168             :         case PROPERTY_ID_FONTFAMILY:
     169           6 :             _rDefault <<= aFD.Family;
     170           6 :             break;
     171             :         case PROPERTY_ID_FONTCHARSET:
     172           6 :             _rDefault <<= aFD.CharSet;
     173           6 :             break;
     174             :         case PROPERTY_ID_FONTPITCH:
     175           6 :             _rDefault <<= aFD.Pitch;
     176           6 :             break;
     177             :         case PROPERTY_ID_FONTCHARWIDTH:
     178           6 :             _rDefault <<= aFD.CharacterWidth;
     179           6 :             break;
     180             :         case PROPERTY_ID_FONTWEIGHT:
     181           6 :             _rDefault <<= aFD.Weight;
     182           6 :             break;
     183             :         case PROPERTY_ID_FONTSLANT:
     184           6 :             _rDefault <<= aFD.Slant;
     185           6 :             break;
     186             :         case PROPERTY_ID_FONTUNDERLINE:
     187           0 :             _rDefault <<= aFD.Underline;
     188           0 :             break;
     189             :         case PROPERTY_ID_FONTSTRIKEOUT:
     190           0 :             _rDefault <<= aFD.Strikeout;
     191           0 :             break;
     192             :         case PROPERTY_ID_FONTORIENTATION:
     193           6 :             _rDefault <<= aFD.Orientation;
     194           6 :             break;
     195             :         case PROPERTY_ID_FONTKERNING:
     196           6 :             _rDefault <<= aFD.Kerning;
     197           6 :             break;
     198             :         case PROPERTY_ID_FONTWORDLINEMODE:
     199           6 :             _rDefault <<= aFD.WordLineMode;
     200           6 :             break;
     201             :         case PROPERTY_ID_FONTTYPE:
     202           0 :             _rDefault <<= aFD.Type;
     203           0 :             break;
     204             :     }
     205         108 : }
     206             : 
     207             : }   // namespace dbaccess
     208             : 
     209             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11