fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sdext / source / minimizer / configurationaccess.hxx
blobd8f6c01d814861360efcf8fd663c286ac7fc946a
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
21 #define INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
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>
37 struct OptimizerSettings
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;
57 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 mnEstimatedFileSize( 0 ){};
71 ~OptimizerSettings(){};
73 void LoadSettingsFromConfiguration( const css::uno::Reference< css::container::XNameAccess >& rSettings );
74 void SaveSettingsToConfiguration( const css::uno::Reference< css::container::XNameReplace >& rSettings );
76 bool operator==( const OptimizerSettings& rOptimizerSettings ) const;
79 class ConfigurationAccess
81 public :
83 ConfigurationAccess( const css::uno::Reference< css::uno::XComponentContext >& rXFactory,
84 OptimizerSettings* pDefaultSettings = NULL );
85 ~ConfigurationAccess();
86 void SaveConfiguration();
88 OUString getString( const PPPOptimizerTokenEnum ) const;
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 );
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;
98 css::uno::Sequence< css::beans::PropertyValue > GetConfigurationSequence();
100 // getting access to the OptimizerSettings list
101 std::vector< OptimizerSettings >& GetOptimizerSettings() { return maSettings; };
102 std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName( const OUString& rName );
104 private :
106 struct Compare
108 bool operator()( const PPPOptimizerTokenEnum s1, const PPPOptimizerTokenEnum s2 ) const
110 return s1 < s2;
113 std::map < PPPOptimizerTokenEnum, OUString, Compare > maStrings;
115 std::vector< OptimizerSettings > maSettings;
116 std::vector< OptimizerSettings > maInitialSettings;
118 css::uno::Reference< css::uno::XComponentContext > mxContext;
120 void LoadStrings();
121 void LoadConfiguration();
122 css::uno::Reference< css::uno::XInterface > OpenConfiguration( bool bReadOnly );
123 static css::uno::Reference< css::uno::XInterface > GetConfigurationNode(
124 const css::uno::Reference< css::uno::XInterface >& xRoot, const OUString& sPathToNode );
127 #endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */