LCOV - code coverage report
Current view: top level - chart2/source/tools - MediaDescriptorHelper.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 119 119 100.0 %
Date: 2014-11-03 Functions: 2 2 100.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 "MediaDescriptorHelper.hxx"
      21             : 
      22             : using namespace ::com::sun::star;
      23             : 
      24             : namespace apphelper
      25             : {
      26             : 
      27             : const short FLAG_DEPRECATED =1;
      28             : const short FLAG_MODEL      =2;
      29             : 
      30             : #define WRITE_PROPERTY( MediaName, nFlags )             \
      31             : if(rProp.Name.equals(#MediaName)) \
      32             : {                                                       \
      33             :     if( rProp.Value >>= MediaName )                     \
      34             :         ISSET_##MediaName = true;                       \
      35             :     if((nFlags & FLAG_DEPRECATED) != 0)                 \
      36             :     {                                                   \
      37             :         m_aDeprecatedProperties[nDeprecatedCount]=rProp;\
      38             :         nDeprecatedCount++;                             \
      39             :     }                                                   \
      40             :     else                                                \
      41             :     {                                                   \
      42             :         m_aRegularProperties[nRegularCount]=rProp;      \
      43             :         nRegularCount++;                                \
      44             :         if((nFlags & FLAG_MODEL) != 0)                  \
      45             :         {                                               \
      46             :             m_aModelProperties[nModelCount]=rProp;      \
      47             :             nModelCount++;                              \
      48             :         }                                               \
      49             :     }                                                   \
      50             : }
      51             : 
      52        1604 : MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
      53        1604 :                         beans::PropertyValue > & rMediaDescriptor )
      54             : {
      55        1604 :     impl_init();
      56             : 
      57        1604 :     m_aRegularProperties.realloc(0);
      58        1604 :     m_aRegularProperties.realloc(rMediaDescriptor.getLength());
      59        1604 :     sal_Int32 nRegularCount = 0;
      60             : 
      61        1604 :     m_aDeprecatedProperties.realloc(0);
      62        1604 :     m_aDeprecatedProperties.realloc(rMediaDescriptor.getLength());
      63        1604 :     sal_Int32 nDeprecatedCount = 0;
      64             : 
      65        1604 :     m_aAdditionalProperties.realloc(0);
      66        1604 :     m_aAdditionalProperties.realloc(rMediaDescriptor.getLength());
      67        1604 :     sal_Int32 nAdditionalCount = 0;
      68             : 
      69        1604 :     m_aModelProperties.realloc(0);
      70        1604 :     m_aModelProperties.realloc(rMediaDescriptor.getLength());
      71        1604 :     sal_Int32 nModelCount = 0;
      72             : 
      73             :     //read given rMediaDescriptor and store in internal structures:
      74       12444 :     for( sal_Int32 i= rMediaDescriptor.getLength();i--;)
      75             :     {
      76        9236 :         const beans::PropertyValue& rProp = rMediaDescriptor[i];
      77        9236 :         WRITE_PROPERTY( AsTemplate, FLAG_MODEL )
      78        9224 :         else WRITE_PROPERTY( Author, FLAG_MODEL )
      79        9224 :         else WRITE_PROPERTY( CharacterSet, FLAG_MODEL )
      80        9224 :         else WRITE_PROPERTY( Comment, FLAG_MODEL )
      81        9224 :         else WRITE_PROPERTY( ComponentData, FLAG_MODEL )
      82        9224 :         else WRITE_PROPERTY( FileName, FLAG_DEPRECATED )
      83        9224 :         else WRITE_PROPERTY( FilterData, FLAG_MODEL )
      84        9224 :         else WRITE_PROPERTY( FilterName, FLAG_MODEL )
      85        7620 :         else WRITE_PROPERTY( FilterFlags, FLAG_DEPRECATED)
      86        7620 :         else WRITE_PROPERTY( FilterOptions, FLAG_MODEL )
      87        7620 :         else WRITE_PROPERTY( FrameName, FLAG_MODEL )
      88        7620 :         else WRITE_PROPERTY( Hidden, FLAG_MODEL )
      89        7620 :         else WRITE_PROPERTY( HierarchicalDocumentName, FLAG_MODEL )
      90        6052 :         else WRITE_PROPERTY( OutputStream, 0 )
      91        6052 :         else WRITE_PROPERTY( InputStream, 0 )
      92        6016 :         else WRITE_PROPERTY( InteractionHandler, 0 )
      93        5992 :         else WRITE_PROPERTY( JumpMark, 0 )
      94        5992 :         else WRITE_PROPERTY( MediaType, FLAG_MODEL )
      95        5992 :         else WRITE_PROPERTY( OpenFlags, FLAG_DEPRECATED )
      96        5992 :         else WRITE_PROPERTY( OpenNewView, 0 )
      97        5992 :         else WRITE_PROPERTY( Overwrite, FLAG_MODEL )
      98        5992 :         else WRITE_PROPERTY( Password, FLAG_MODEL )
      99        5992 :         else WRITE_PROPERTY( PosSize, 0 )
     100        5992 :         else WRITE_PROPERTY( PostData, 0 )
     101        5992 :         else WRITE_PROPERTY( PostString, FLAG_DEPRECATED )
     102        5992 :         else WRITE_PROPERTY( Preview, FLAG_MODEL )
     103        5992 :         else WRITE_PROPERTY( ReadOnly, 0 )
     104        5528 :         else WRITE_PROPERTY( Referer, FLAG_MODEL )
     105        5528 :         else WRITE_PROPERTY( SetEmbedded, 0 )
     106        5528 :         else WRITE_PROPERTY( Silent, 0 )
     107        5528 :         else WRITE_PROPERTY( StatusIndicator, 0 )
     108        5504 :         else WRITE_PROPERTY( Storage, FLAG_MODEL )
     109        3932 :         else WRITE_PROPERTY( Stream, FLAG_MODEL )
     110        3908 :         else WRITE_PROPERTY( TemplateName, FLAG_DEPRECATED )
     111        3908 :         else WRITE_PROPERTY( TemplateRegionName, FLAG_DEPRECATED )
     112        3908 :         else WRITE_PROPERTY( Unpacked, FLAG_MODEL )
     113        3908 :         else WRITE_PROPERTY( URL, FLAG_MODEL )
     114        3872 :         else WRITE_PROPERTY( Version, FLAG_MODEL )
     115        3872 :         else WRITE_PROPERTY( ViewData, FLAG_MODEL )
     116        3872 :         else WRITE_PROPERTY( ViewId, FLAG_MODEL )
     117        3872 :         else WRITE_PROPERTY( WinExtent, FLAG_DEPRECATED )
     118             :         else
     119             :         {
     120        3872 :             m_aAdditionalProperties[nAdditionalCount]=rProp;
     121        3872 :             nAdditionalCount++;
     122             :         }
     123             :     }
     124             : 
     125        1604 :     m_aRegularProperties.realloc(nRegularCount);
     126        1604 :     m_aDeprecatedProperties.realloc(nDeprecatedCount);
     127        1604 :     m_aAdditionalProperties.realloc(nAdditionalCount);
     128        1604 :     m_aModelProperties.realloc(nModelCount);
     129        1604 : }
     130             : 
     131        1604 : void MediaDescriptorHelper::impl_init()
     132             : {
     133        1604 :     AsTemplate = false;
     134        1604 :     ISSET_AsTemplate = false;
     135             : 
     136        1604 :     ISSET_Author = false;
     137        1604 :     ISSET_CharacterSet = false;
     138        1604 :     ISSET_Comment = false;
     139             : 
     140             : //  ::com::sun::star::uno::Any  ComponentData;
     141        1604 :     ISSET_ComponentData = false;
     142        1604 :     ISSET_FileName = false;
     143             : 
     144             : //  ::com::sun::star::uno::Any  FilterData;
     145        1604 :     ISSET_FilterData = false;
     146        1604 :     ISSET_FilterName = false;
     147        1604 :     ISSET_FilterFlags = false;
     148        1604 :     ISSET_FilterOptions = false;
     149        1604 :     ISSET_FrameName = false;
     150             : 
     151        1604 :     Hidden = false;
     152        1604 :     ISSET_Hidden = false;
     153        1604 :     ISSET_HierarchicalDocumentName = false;
     154        1604 :     ISSET_OutputStream = false;
     155        1604 :     ISSET_InputStream = false;
     156        1604 :     ISSET_InteractionHandler = false;
     157        1604 :     ISSET_JumpMark = false;
     158        1604 :     ISSET_MediaType = false;
     159        1604 :     ISSET_OpenFlags = false;
     160        1604 :     OpenNewView = false;
     161        1604 :     ISSET_OpenNewView = false;
     162        1604 :     Overwrite = false;
     163        1604 :     ISSET_Overwrite = false;
     164        1604 :     ISSET_Password = false;
     165             : 
     166             : //  ::com::sun::star::awt::Rectangle PosSize;
     167        1604 :     ISSET_PosSize = false;
     168             : 
     169             : //  ::com::sun::star::uno::Sequence< sal_Int8 > PostData;
     170        1604 :     ISSET_PostData = false;
     171        1604 :     ISSET_PostString = false;
     172        1604 :     Preview = false;
     173        1604 :     ISSET_Preview = false;
     174        1604 :     ReadOnly = false;
     175        1604 :     ISSET_ReadOnly = false;
     176        1604 :     ISSET_Referer = false;
     177        1604 :     ISSET_StatusIndicator = false;
     178        1604 :     Silent = false;
     179        1604 :     ISSET_Silent = false;
     180        1604 :     ISSET_TemplateName = false;
     181        1604 :     ISSET_TemplateRegionName = false;
     182        1604 :     Unpacked = false;
     183        1604 :     ISSET_Unpacked = false;
     184        1604 :     ISSET_URL = false;
     185        1604 :     Version = 0;
     186        1604 :     ISSET_Version = false;
     187             : 
     188             : //  ::com::sun::star::uno::Any ViewData;
     189        1604 :     ISSET_ViewData = false;
     190        1604 :     ViewId = 0;
     191        1604 :     ISSET_ViewId = false;
     192             : 
     193        1604 :     ISSET_WinExtent = false;
     194             : 
     195        1604 :     SetEmbedded = false;
     196        1604 :     ISSET_SetEmbedded = false;
     197             : 
     198        1604 :     ISSET_Storage = false;
     199        1604 :     ISSET_Stream = false;
     200        1604 : }
     201             : 
     202             : }
     203             : 
     204             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10