LibreOffice Module sdext (master) 1
configurationaccess.hxx
Go to the documentation of this file.
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/uno/Any.h>
26#include <com/sun/star/uno/Reference.h>
27#include <com/sun/star/uno/XInterface.hpp>
28#include <com/sun/star/beans/PropertyValue.hpp>
29#include <com/sun/star/uno/XComponentContext.hpp>
30#include <com/sun/star/container/XNameAccess.hpp>
31#include <com/sun/star/container/XNameReplace.hpp>
32#include <map>
33
35{
36 OUString maName;
38 sal_Int32 mnJPEGQuality;
49 OUString maSaveAsURL;
50 OUString maFilterName;
53
55 mbJPEGCompression( false ),
56 mnJPEGQuality( 90 ),
57 mbRemoveCropArea( false ),
59 mbEmbedLinkedGraphics( false ),
60 mbOLEOptimization( false ),
63 mbDeleteHiddenSlides( false ),
64 mbDeleteNotesPages( false ),
65 mbSaveAs( true ),
66 mbOpenNewDocument( true ),
68
69 void LoadSettingsFromConfiguration( const css::uno::Reference< css::container::XNameAccess >& rSettings );
70 void SaveSettingsToConfiguration( const css::uno::Reference< css::container::XNameReplace >& rSettings );
71
72 bool operator==( const OptimizerSettings& rOptimizerSettings ) const;
73
74};
76{
77 public:
78
79 explicit ConfigurationAccess( const css::uno::Reference< css::uno::XComponentContext >& rXFactory );
81 void SaveConfiguration();
82
83 OUString getString( const PPPOptimizerTokenEnum ) const;
84
85 // access to current OptimizerSettings (stored in the first entry of maSettings)
86 css::uno::Any GetConfigProperty( const PPPOptimizerTokenEnum ) const;
87 void SetConfigProperty( const PPPOptimizerTokenEnum, const css::uno::Any& aValue );
88
89 bool GetConfigProperty( const PPPOptimizerTokenEnum, const bool bDefault ) const;
90 sal_Int16 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int16 nDefault ) const;
91 sal_Int32 GetConfigProperty( const PPPOptimizerTokenEnum, const sal_Int32 nDefault ) const;
92
93 css::uno::Sequence< css::beans::PropertyValue > GetConfigurationSequence();
94
95 // getting access to the OptimizerSettings list
96 std::vector< OptimizerSettings >& GetOptimizerSettings() { return maSettings; };
97 std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName( const OUString& rName );
98
99 private:
100
101 std::map < PPPOptimizerTokenEnum, OUString > maStrings;
102
103 std::vector< OptimizerSettings > maSettings;
104
105 css::uno::Reference< css::uno::XComponentContext > mxContext;
106
107 void LoadStrings();
108 void LoadConfiguration();
109 css::uno::Reference< css::uno::XInterface > OpenConfiguration( bool bReadOnly );
110 static css::uno::Reference< css::uno::XInterface > GetConfigurationNode(
111 const css::uno::Reference< css::uno::XInterface >& xRoot, const OUString& sPathToNode );
112};
113
114#endif // INCLUDED_SDEXT_SOURCE_MINIMIZER_CONFIGURATIONACCESS_HXX
115
116/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::uno::XInterface > OpenConfiguration(bool bReadOnly)
static css::uno::Reference< css::uno::XInterface > GetConfigurationNode(const css::uno::Reference< css::uno::XInterface > &xRoot, const OUString &sPathToNode)
std::vector< OptimizerSettings > & GetOptimizerSettings()
OUString getString(const PPPOptimizerTokenEnum) const
css::uno::Sequence< css::beans::PropertyValue > GetConfigurationSequence()
std::vector< OptimizerSettings > maSettings
ConfigurationAccess(const css::uno::Reference< css::uno::XComponentContext > &rXFactory)
void SetConfigProperty(const PPPOptimizerTokenEnum, const css::uno::Any &aValue)
css::uno::Any GetConfigProperty(const PPPOptimizerTokenEnum) const
std::vector< OptimizerSettings >::iterator GetOptimizerSettingsByName(const OUString &rName)
css::uno::Reference< css::uno::XComponentContext > mxContext
std::map< PPPOptimizerTokenEnum, OUString > maStrings
PPPOptimizerTokenEnum
void LoadSettingsFromConfiguration(const css::uno::Reference< css::container::XNameAccess > &rSettings)
bool operator==(const OptimizerSettings &rOptimizerSettings) const
void SaveSettingsToConfiguration(const css::uno::Reference< css::container::XNameReplace > &rSettings)