Update ooo320-m1
[ooovba.git] / configmgr / source / inc / options.hxx
blob6ec446df7e77b658c8646eda0d6ce82ddde633e6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: options.hxx,v $
10 * $Revision: 1.22 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef CONFIGMGR_MISC_OPTIONS_HXX_
32 #define CONFIGMGR_MISC_OPTIONS_HXX_
34 #include "requestoptions.hxx"
35 #include <com/sun/star/uno/Any.hxx>
36 #include <com/sun/star/uno/Reference.hxx>
37 #include "utility.hxx"
38 #include <salhelper/simplereferenceobject.hxx>
39 #include <vos/ref.hxx>
41 namespace configmgr
43 namespace css = ::com::sun::star;
45 /**
46 class OOptions is created one time per Configuration[update]Access
47 all important options should stored in this class.
48 The object will be forwarded to all other objects so we only
49 need to extend this classobject and all other class can work with
50 the new options or important options etc.
53 class OOptions : public salhelper::SimpleReferenceObject
55 RequestOptions m_aRequestOptions; // current options to use
57 public:
58 OOptions()
59 : m_aRequestOptions()
62 explicit
63 OOptions(const RequestOptions& _aDefaultOptions)
64 : m_aRequestOptions(_aDefaultOptions)
68 OOptions(const OOptions& _aOtherOptions)
69 : SimpleReferenceObject()
70 , m_aRequestOptions(_aOtherOptions.m_aRequestOptions)
74 bool isForSessionUser() const { return ! m_aRequestOptions.hasEntity(); }
76 rtl::OUString getLocale() const { return m_aRequestOptions.getLocale(); }
77 rtl::OUString getUser() const { return m_aRequestOptions.getEntity(); }
79 RequestOptions const & getRequestOptions() const
80 { return m_aRequestOptions; }
82 void setUser(const rtl::OUString & _rUser)
83 { m_aRequestOptions.setEntity(_rUser); }
85 void setLocale(const com::sun::star::lang::Locale & _rLocale)
86 { m_aRequestOptions.setLocale(_rLocale); }
88 void setMultiLocaleMode()
89 { m_aRequestOptions.setAllLocales(); }
91 void enableAsync(bool _bEnable)
92 { m_aRequestOptions.enableAsync(_bEnable); }
95 struct ltOptions
97 lessRequestOptions ltData;
98 bool operator()(vos::ORef<OOptions> const &o1, vos::ORef<OOptions> const &o2) const
100 return ltData(o1->getRequestOptions(),o2->getRequestOptions());
103 } // namespace
105 #endif