LCOV - code coverage report
Current view: top level - sdext/source/minimizer - configurationaccess.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 7 0.0 %
Date: 2014-11-03 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             : #ifndef INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
      21             : #define INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
      22             : 
      23             : #include <vector>
      24             : #include "pppoptimizertoken.hxx"
      25             : #include <com/sun/star/awt/Size.hpp>
      26             : #include <com/sun/star/uno/Any.h>
      27             : #include <com/sun/star/uno/Reference.h>
      28             : #include <com/sun/star/uno/XInterface.hpp>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <com/sun/star/beans/XPropertyAccess.hpp>
      31             : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      32             : #include <com/sun/star/uno/XComponentContext.hpp>
      33             : #include <com/sun/star/container/XNameAccess.hpp>
      34             : #include <com/sun/star/container/XNameReplace.hpp>
      35             : #include <map>
      36             : 
      37           0 : struct OptimizerSettings
      38             : {
      39             :     OUString   maName;
      40             :     bool        mbJPEGCompression;
      41             :     sal_Int32       mnJPEGQuality;
      42             :     bool        mbRemoveCropArea;
      43             :     sal_Int32       mnImageResolution;
      44             :     bool        mbEmbedLinkedGraphics;
      45             :     bool        mbOLEOptimization;
      46             :     sal_Int16       mnOLEOptimizationType;
      47             :     bool        mbDeleteUnusedMasterPages;
      48             :     bool        mbDeleteHiddenSlides;
      49             :     bool        mbDeleteNotesPages;
      50             :     OUString   maCustomShowName;
      51             :     bool        mbSaveAs;
      52             :     OUString   maSaveAsURL;
      53             :     OUString   maFilterName;
      54             :     bool        mbOpenNewDocument;
      55             :     sal_Int64       mnEstimatedFileSize;
      56             : 
      57           0 :     OptimizerSettings() :
      58             :         mbJPEGCompression( false ),
      59             :         mnJPEGQuality( 90 ),
      60             :         mbRemoveCropArea( false ),
      61             :         mnImageResolution( 0 ),
      62             :         mbEmbedLinkedGraphics( false ),
      63             :         mbOLEOptimization( false ),
      64             :         mnOLEOptimizationType( 0 ),
      65             :         mbDeleteUnusedMasterPages( false ),
      66             :         mbDeleteHiddenSlides( false ),
      67             :         mbDeleteNotesPages( false ),
      68             :         mbSaveAs( true ),
      69             :         mbOpenNewDocument( true ),
      70           0 :         mnEstimatedFileSize( 0 ){};
      71           0 :         ~OptimizerSettings(){};
      72             : 
      73             :         void LoadSettingsFromConfiguration( const css::uno::Reference< css::container::XNameAccess >& rSettings );
      74             :         void SaveSettingsToConfiguration( const css::uno::Reference< css::container::XNameReplace >& rSettings );
      75             : 
      76             :         bool operator==( const OptimizerSettings& rOptimizerSettings ) const;
      77             : 
      78             : };
      79             : class ConfigurationAccess
      80             : {
      81             :     public :
      82             : 
      83             :         ConfigurationAccess( const css::uno::Reference< css::uno::XComponentContext >& rXFactory,
      84             :                                 OptimizerSettings* pDefaultSettings = NULL );
      85             :         ~ConfigurationAccess();
      86             :         void SaveConfiguration();
      87             : 
      88             :         OUString getString( const PPPOptimizerTokenEnum ) const;
      89             : 
      90             :         // access to current OptimizerSettings (stored in the first entry of maSettings)
      91             :         css::uno::Any GetConfigProperty( const PPPOptimizerTokenEnum ) const;
      92             :         void SetConfigProperty( const PPPOptimizerTokenEnum, const css::uno::Any& aValue );
      93             : 
      94             :         bool GetConfigProperty( const PPPOptimizerTokenEnum, const bool bDefault ) const;
      95             :         sal_Int16 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int16 nDefault ) const;
      96             :         sal_Int32 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int32 nDefault ) const;
      97             : 
      98             :         css::uno::Sequence< css::beans::PropertyValue > GetConfigurationSequence();
      99             : 
     100             :         // getting access to the OptimizerSettings list
     101           0 :         std::vector< OptimizerSettings >& GetOptimizerSettings() { return maSettings; };
     102             :         std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName( const OUString& rName );
     103             : 
     104             :     private :
     105             : 
     106             :         struct Compare
     107             :         {
     108           0 :             bool operator()( const PPPOptimizerTokenEnum s1, const PPPOptimizerTokenEnum s2 ) const
     109             :             {
     110           0 :                 return s1 < s2;
     111             :             }
     112             :         };
     113             :         std::map < PPPOptimizerTokenEnum, OUString, Compare > maStrings;
     114             : 
     115             :         std::vector< OptimizerSettings > maSettings;
     116             :         std::vector< OptimizerSettings > maInitialSettings;
     117             : 
     118             :         css::uno::Reference< css::uno::XComponentContext > mxContext;
     119             : 
     120             :         void LoadStrings();
     121             :         void LoadConfiguration();
     122             :         css::uno::Reference< css::uno::XInterface > OpenConfiguration( bool bReadOnly );
     123             :         css::uno::Reference< css::uno::XInterface > GetConfigurationNode(
     124             :             const css::uno::Reference< css::uno::XInterface >& xRoot, const OUString& sPathToNode );
     125             : };
     126             : 
     127             : #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10