LCOV - code coverage report
Current view: top level - libreoffice/sdext/source/minimizer - optimizationstats.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 26 0.0 %
Date: 2012-12-27 Functions: 0 6 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             : 
      21             : #include "optimizationstats.hxx"
      22             : #include <com/sun/star/awt/Size.hpp>
      23             : #include <com/sun/star/drawing/XShapes.hpp>
      24             : #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
      25             : #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
      26             : 
      27             : 
      28             : using namespace ::rtl;
      29             : using namespace ::com::sun::star;
      30             : using namespace ::com::sun::star::uno;
      31             : using namespace ::com::sun::star::frame;
      32             : using namespace ::com::sun::star::drawing;
      33             : using namespace ::com::sun::star::beans;
      34             : 
      35             : // -----------------------------------------------------------------------------
      36             : 
      37           0 : OptimizationStats::OptimizationStats()
      38             : {
      39           0 : }
      40             : 
      41             : // -----------------------------------------------------------------------------
      42             : 
      43           0 : void OptimizationStats::SetStatusValue( const PPPOptimizerTokenEnum eStat, const uno::Any& rStatValue )
      44             : {
      45           0 :     maStats[ eStat ] = rStatValue;
      46           0 : }
      47             : 
      48             : // -----------------------------------------------------------------------------
      49             : 
      50           0 : const uno::Any* OptimizationStats::GetStatusValue( const PPPOptimizerTokenEnum eStat ) const
      51             : {
      52           0 :     std::map< PPPOptimizerTokenEnum, uno::Any, Compare >::const_iterator aIter( maStats.find( eStat ) );
      53           0 :     return aIter != maStats.end() ? &((*aIter).second) : NULL;
      54             : }
      55             : 
      56             : // -----------------------------------------------------------------------------
      57             : 
      58           0 : com::sun::star::beans::PropertyValues OptimizationStats::GetStatusSequence()
      59             : {
      60           0 :     int i = 0;
      61           0 :     uno::Sequence< PropertyValue > aStatsSequence( maStats.size() );
      62           0 :     std::map< PPPOptimizerTokenEnum, uno::Any, Compare >::iterator aIter( maStats.begin() );
      63           0 :     while( aIter != maStats.end() )
      64             :     {
      65           0 :         aStatsSequence[ i ].Name = TKGet( (*aIter).first );
      66           0 :         aStatsSequence[ i++ ].Value <<= (*aIter++).second;
      67             :     }
      68           0 :     return aStatsSequence;
      69             : }
      70             : 
      71             : // -----------------------------------------------------------------------------
      72             : 
      73           0 : void OptimizationStats::InitializeStatusValues( const uno::Sequence< PropertyValue >& rOptimizationStats )
      74             : {
      75           0 :     for( int i = 0; i < rOptimizationStats.getLength(); i++ )
      76           0 :         rOptimizationStats[ i ].Value >>= maStats[ TKGet( rOptimizationStats[ i ].Name ) ];
      77           0 : }
      78             : 
      79             : // -----------------------------------------------------------------------------
      80             : 
      81           0 : void OptimizationStats::InitializeStatusValuesFromDocument( Reference< XModel > rxModel )
      82             : {
      83             :     try
      84             :     {
      85           0 :         Reference< XDrawPagesSupplier > xDrawPagesSupplier( rxModel, UNO_QUERY_THROW );
      86           0 :         Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
      87           0 :         SetStatusValue( TK_Pages, Any( awt::Size( 0, xDrawPages->getCount() ) ) );
      88             :     }
      89           0 :     catch ( Exception& )
      90             :     {
      91             :     }
      92           0 : }
      93             : 
      94             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10