configurationaccess.hxx (e4a7f284) | configurationaccess.hxx (880c69c6) |
---|---|
1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 26 unchanged lines hidden (view full) --- 35#include <com/sun/star/lang/XMultiServiceFactory.hpp> 36#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT 37#include <com/sun/star/uno/XComponentContext.hpp> 38#endif 39#include <com/sun/star/container/XNameAccess.hpp> 40#include <com/sun/star/container/XNameReplace.hpp> 41#include <map> 42 | 1/************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance --- 26 unchanged lines hidden (view full) --- 35#include <com/sun/star/lang/XMultiServiceFactory.hpp> 36#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT 37#include <com/sun/star/uno/XComponentContext.hpp> 38#endif 39#include <com/sun/star/container/XNameAccess.hpp> 40#include <com/sun/star/container/XNameReplace.hpp> 41#include <map> 42 |
43 | |
44struct OptimizerSettings 45{ 46 rtl::OUString maName; 47 sal_Bool mbJPEGCompression; 48 sal_Int32 mnJPEGQuality; 49 sal_Bool mbRemoveCropArea; 50 sal_Int32 mnImageResolution; 51 sal_Bool mbEmbedLinkedGraphics; --- 30 unchanged lines hidden (view full) --- 82 83 sal_Bool operator==( const OptimizerSettings& rOptimizerSettings ) const; 84 85}; 86class ConfigurationAccess 87{ 88 public : 89 | 43struct OptimizerSettings 44{ 45 rtl::OUString maName; 46 sal_Bool mbJPEGCompression; 47 sal_Int32 mnJPEGQuality; 48 sal_Bool mbRemoveCropArea; 49 sal_Int32 mnImageResolution; 50 sal_Bool mbEmbedLinkedGraphics; --- 30 unchanged lines hidden (view full) --- 81 82 sal_Bool operator==( const OptimizerSettings& rOptimizerSettings ) const; 83 84}; 85class ConfigurationAccess 86{ 87 public : 88 |
90 ConfigurationAccess( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext, | 89 ConfigurationAccess( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rXFactory, |
91 OptimizerSettings* pDefaultSettings = NULL ); 92 ~ConfigurationAccess(); 93 void SaveConfiguration(); 94 | 90 OptimizerSettings* pDefaultSettings = NULL ); 91 ~ConfigurationAccess(); 92 void SaveConfiguration(); 93 |
95 static rtl::OUString getString( sal_Int32 nResId ); | 94 rtl::OUString getPath( const PPPOptimizerTokenEnum ); 95 rtl::OUString getString( const PPPOptimizerTokenEnum ) const; |
96 97 // access to current OptimizerSettings (stored in the first entry of maSettings) 98 com::sun::star::uno::Any GetConfigProperty( const PPPOptimizerTokenEnum ) const; 99 void SetConfigProperty( const PPPOptimizerTokenEnum, const com::sun::star::uno::Any& aValue ); 100 101 sal_Bool GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Bool bDefault ) const; 102 sal_Int16 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int16 nDefault ) const; 103 sal_Int32 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int32 nDefault ) const; 104 105 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetConfigurationSequence(); 106 107 // getting access to the OptimizerSettings list 108 std::vector< OptimizerSettings >& GetOptimizerSettings() { return maSettings; }; 109 std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName( const rtl::OUString& rName ); 110 111 private : 112 | 96 97 // access to current OptimizerSettings (stored in the first entry of maSettings) 98 com::sun::star::uno::Any GetConfigProperty( const PPPOptimizerTokenEnum ) const; 99 void SetConfigProperty( const PPPOptimizerTokenEnum, const com::sun::star::uno::Any& aValue ); 100 101 sal_Bool GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Bool bDefault ) const; 102 sal_Int16 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int16 nDefault ) const; 103 sal_Int32 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int32 nDefault ) const; 104 105 com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > GetConfigurationSequence(); 106 107 // getting access to the OptimizerSettings list 108 std::vector< OptimizerSettings >& GetOptimizerSettings() { return maSettings; }; 109 std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName( const rtl::OUString& rName ); 110 111 private : 112 |
113 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; | 113 struct Compare 114 { 115 bool operator()( const PPPOptimizerTokenEnum s1, const PPPOptimizerTokenEnum s2 ) const 116 { 117 return s1 < s2; 118 } 119 }; 120 std::map < PPPOptimizerTokenEnum, rtl::OUString, Compare > maStrings; 121 |
114 std::vector< OptimizerSettings > maSettings; 115 std::vector< OptimizerSettings > maInitialSettings; 116 | 122 std::vector< OptimizerSettings > maSettings; 123 std::vector< OptimizerSettings > maInitialSettings; 124 |
125 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF; 126 |
|
117 void LoadStrings(); 118 void LoadConfiguration(); 119 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > OpenConfiguration( bool bReadOnly ); 120 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > GetConfigurationNode( 121 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& xRoot, const rtl::OUString& sPathToNode ); 122}; 123 124#endif // _CONFIGURATION_ACCESS_HXX_ 125 | 127 void LoadStrings(); 128 void LoadConfiguration(); 129 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > OpenConfiguration( bool bReadOnly ); 130 com::sun::star::uno::Reference< com::sun::star::uno::XInterface > GetConfigurationNode( 131 const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& xRoot, const rtl::OUString& sPathToNode ); 132}; 133 134#endif // _CONFIGURATION_ACCESS_HXX_ 135 |