LCOV - code coverage report
Current view: top level - chart2/source/tools - MediaDescriptorHelper.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 119 0.0 %
Date: 2014-04-14 Functions: 0 3 0.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 = sal_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           0 : MediaDescriptorHelper::MediaDescriptorHelper( const uno::Sequence<
      53           0 :                         beans::PropertyValue > & rMediaDescriptor )
      54             : {
      55           0 :     impl_init();
      56             : 
      57           0 :     m_aRegularProperties.realloc(0);
      58           0 :     m_aRegularProperties.realloc(rMediaDescriptor.getLength());
      59           0 :     sal_Int32 nRegularCount = 0;
      60             : 
      61           0 :     m_aDeprecatedProperties.realloc(0);
      62           0 :     m_aDeprecatedProperties.realloc(rMediaDescriptor.getLength());
      63           0 :     sal_Int32 nDeprecatedCount = 0;
      64             : 
      65           0 :     m_aAdditionalProperties.realloc(0);
      66           0 :     m_aAdditionalProperties.realloc(rMediaDescriptor.getLength());
      67           0 :     sal_Int32 nAdditionalCount = 0;
      68             : 
      69           0 :     m_aModelProperties.realloc(0);
      70           0 :     m_aModelProperties.realloc(rMediaDescriptor.getLength());
      71           0 :     sal_Int32 nModelCount = 0;
      72             : 
      73             :     //read given rMediaDescriptor and store in internal structures:
      74           0 :     for( sal_Int32 i= rMediaDescriptor.getLength();i--;)
      75             :     {
      76           0 :         const beans::PropertyValue& rProp = rMediaDescriptor[i];
      77           0 :         WRITE_PROPERTY( AsTemplate, FLAG_MODEL )
      78           0 :         else WRITE_PROPERTY( Author, FLAG_MODEL )
      79           0 :         else WRITE_PROPERTY( CharacterSet, FLAG_MODEL )
      80           0 :         else WRITE_PROPERTY( Comment, FLAG_MODEL )
      81           0 :         else WRITE_PROPERTY( ComponentData, FLAG_MODEL )
      82           0 :         else WRITE_PROPERTY( FileName, FLAG_DEPRECATED )
      83           0 :         else WRITE_PROPERTY( FilterData, FLAG_MODEL )
      84           0 :         else WRITE_PROPERTY( FilterName, FLAG_MODEL )
      85           0 :         else WRITE_PROPERTY( FilterFlags, FLAG_DEPRECATED)
      86           0 :         else WRITE_PROPERTY( FilterOptions, FLAG_MODEL )
      87           0 :         else WRITE_PROPERTY( FrameName, FLAG_MODEL )
      88           0 :         else WRITE_PROPERTY( Hidden, FLAG_MODEL )
      89           0 :         else WRITE_PROPERTY( HierarchicalDocumentName, FLAG_MODEL )
      90           0 :         else WRITE_PROPERTY( OutputStream, 0 )
      91           0 :         else WRITE_PROPERTY( InputStream, 0 )
      92           0 :         else WRITE_PROPERTY( InteractionHandler, 0 )
      93           0 :         else WRITE_PROPERTY( JumpMark, 0 )
      94           0 :         else WRITE_PROPERTY( MediaType, FLAG_MODEL )
      95           0 :         else WRITE_PROPERTY( OpenFlags, FLAG_DEPRECATED )
      96           0 :         else WRITE_PROPERTY( OpenNewView, 0 )
      97           0 :         else WRITE_PROPERTY( Overwrite, FLAG_MODEL )
      98           0 :         else WRITE_PROPERTY( Password, FLAG_MODEL )
      99           0 :         else WRITE_PROPERTY( PosSize, 0 )
     100           0 :         else WRITE_PROPERTY( PostData, 0 )
     101           0 :         else WRITE_PROPERTY( PostString, FLAG_DEPRECATED )
     102           0 :         else WRITE_PROPERTY( Preview, FLAG_MODEL )
     103           0 :         else WRITE_PROPERTY( ReadOnly, 0 )
     104           0 :         else WRITE_PROPERTY( Referer, FLAG_MODEL )
     105           0 :         else WRITE_PROPERTY( SetEmbedded, 0 )
     106           0 :         else WRITE_PROPERTY( Silent, 0 )
     107           0 :         else WRITE_PROPERTY( StatusIndicator, 0 )
     108           0 :         else WRITE_PROPERTY( Storage, FLAG_MODEL )
     109           0 :         else WRITE_PROPERTY( Stream, FLAG_MODEL )
     110           0 :         else WRITE_PROPERTY( TemplateName, FLAG_DEPRECATED )
     111           0 :         else WRITE_PROPERTY( TemplateRegionName, FLAG_DEPRECATED )
     112           0 :         else WRITE_PROPERTY( Unpacked, FLAG_MODEL )
     113           0 :         else WRITE_PROPERTY( URL, FLAG_MODEL )
     114           0 :         else WRITE_PROPERTY( Version, FLAG_MODEL )
     115           0 :         else WRITE_PROPERTY( ViewData, FLAG_MODEL )
     116           0 :         else WRITE_PROPERTY( ViewId, FLAG_MODEL )
     117           0 :         else WRITE_PROPERTY( WinExtent, FLAG_DEPRECATED )
     118             :         else
     119             :         {
     120           0 :             m_aAdditionalProperties[nAdditionalCount]=rProp;
     121           0 :             nAdditionalCount++;
     122             :         }
     123             :     }
     124             : 
     125           0 :     m_aRegularProperties.realloc(nRegularCount);
     126           0 :     m_aDeprecatedProperties.realloc(nDeprecatedCount);
     127           0 :     m_aAdditionalProperties.realloc(nAdditionalCount);
     128           0 :     m_aModelProperties.realloc(nModelCount);
     129           0 : }
     130             : 
     131           0 : void MediaDescriptorHelper::impl_init()
     132             : {
     133           0 :     AsTemplate = sal_False;
     134           0 :     ISSET_AsTemplate = sal_False;
     135             : 
     136           0 :     ISSET_Author = sal_False;
     137           0 :     ISSET_CharacterSet = sal_False;
     138           0 :     ISSET_Comment = sal_False;
     139             : 
     140             : //  ::com::sun::star::uno::Any  ComponentData;
     141           0 :     ISSET_ComponentData = sal_False;
     142           0 :     ISSET_FileName = sal_False;
     143             : 
     144             : //  ::com::sun::star::uno::Any  FilterData;
     145           0 :     ISSET_FilterData = sal_False;
     146           0 :     ISSET_FilterName = sal_False;
     147           0 :     ISSET_FilterFlags = sal_False;
     148           0 :     ISSET_FilterOptions = sal_False;
     149           0 :     ISSET_FrameName = sal_False;
     150             : 
     151           0 :     Hidden = sal_False;
     152           0 :     ISSET_Hidden = sal_False;
     153           0 :     ISSET_HierarchicalDocumentName = sal_False;
     154           0 :     ISSET_OutputStream = sal_False;
     155           0 :     ISSET_InputStream = sal_False;
     156           0 :     ISSET_InteractionHandler = sal_False;
     157           0 :     ISSET_JumpMark = sal_False;
     158           0 :     ISSET_MediaType = sal_False;
     159           0 :     ISSET_OpenFlags = sal_False;
     160           0 :     OpenNewView = sal_False;
     161           0 :     ISSET_OpenNewView = sal_False;
     162           0 :     Overwrite = sal_False;
     163           0 :     ISSET_Overwrite = sal_False;
     164           0 :     ISSET_Password = sal_False;
     165             : 
     166             : //  ::com::sun::star::awt::Rectangle PosSize;
     167           0 :     ISSET_PosSize = sal_False;
     168             : 
     169             : //  ::com::sun::star::uno::Sequence< sal_Int8 > PostData;
     170           0 :     ISSET_PostData = sal_False;
     171           0 :     ISSET_PostString = sal_False;
     172           0 :     Preview = sal_False;
     173           0 :     ISSET_Preview = sal_False;
     174           0 :     ReadOnly = sal_False;
     175           0 :     ISSET_ReadOnly = sal_False;
     176           0 :     ISSET_Referer = sal_False;
     177           0 :     ISSET_StatusIndicator = sal_False;
     178           0 :     Silent = sal_False;
     179           0 :     ISSET_Silent = sal_False;
     180           0 :     ISSET_TemplateName = sal_False;
     181           0 :     ISSET_TemplateRegionName = sal_False;
     182           0 :     Unpacked = sal_False;
     183           0 :     ISSET_Unpacked = sal_False;
     184           0 :     ISSET_URL = sal_False;
     185           0 :     Version = 0;
     186           0 :     ISSET_Version = sal_False;
     187             : 
     188             : //  ::com::sun::star::uno::Any ViewData;
     189           0 :     ISSET_ViewData = sal_False;
     190           0 :     ViewId = 0;
     191           0 :     ISSET_ViewId = sal_False;
     192             : 
     193           0 :     ISSET_WinExtent = sal_False;
     194             : 
     195           0 :     ISSET_Storage = sal_False;
     196           0 :     ISSET_Stream = sal_False;
     197           0 : }
     198             : 
     199           0 :     uno::Sequence< beans::PropertyValue > MediaDescriptorHelper
     200             : ::getReducedForModel()
     201             : {
     202           0 :     return m_aModelProperties;
     203             : }
     204             : }
     205             : 
     206             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10