office-gobmx/configmgr/source/inc/options.hxx

110 lines
3.5 KiB
C++
Raw Normal View History

2000-11-13 06:14:49 -06:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-11-13 06:14:49 -06:00
*
* Copyright 2008 by Sun Microsystems, Inc.
2000-11-13 06:14:49 -06:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-11-13 06:14:49 -06:00
*
* $RCSfile: options.hxx,v $
* $Revision: 1.22 $
2000-11-13 06:14:49 -06:00
*
* This file is part of OpenOffice.org.
2000-11-13 06:14:49 -06:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2000-11-13 06:14:49 -06:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2000-11-13 06:14:49 -06:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2000-11-13 06:14:49 -06:00
*
************************************************************************/
#ifndef CONFIGMGR_MISC_OPTIONS_HXX_
#define CONFIGMGR_MISC_OPTIONS_HXX_
#include "requestoptions.hxx"
#include <com/sun/star/uno/Any.hxx>
2000-11-30 02:01:47 -06:00
#include <com/sun/star/uno/Reference.hxx>
#include "utility.hxx"
2000-11-30 02:01:47 -06:00
#include <vos/ref.hxx>
2000-11-13 06:14:49 -06:00
namespace configmgr
{
namespace css = ::com::sun::star;
/**
class OOptions is created one time per Configuration[update]Access
all important options should stored in this class.
The object will be forwarded to all other objects so we only
2000-11-13 06:14:49 -06:00
need to extend this classobject and all other class can work with
the new options or important options etc.
*/
class OOptions : public configmgr::SimpleReferenceObject
2000-11-13 06:14:49 -06:00
{
RequestOptions m_aRequestOptions; // current options to use
2000-11-13 06:14:49 -06:00
public:
typedef RequestOptions::Locale Locale;
typedef RequestOptions::LocaleString LocaleString;
typedef RequestOptions::Entity Entity;
OOptions()
: m_aRequestOptions()
{}
2000-11-30 02:01:47 -06:00
explicit
OOptions(const RequestOptions& _aDefaultOptions)
: m_aRequestOptions(_aDefaultOptions)
{
}
OOptions(const OOptions& _aOtherOptions)
: configmgr::SimpleReferenceObject()
, m_aRequestOptions(_aOtherOptions.m_aRequestOptions)
{
}
2000-11-30 02:01:47 -06:00
bool isForSessionUser() const { return ! m_aRequestOptions.hasEntity(); }
2000-11-30 02:01:47 -06:00
LocaleString getLocale() const { return m_aRequestOptions.getLocale(); }
Entity getUser() const { return m_aRequestOptions.getEntity(); }
RequestOptions const & getRequestOptions() const
{ return m_aRequestOptions; }
void setUser(const Entity & _rUser)
{ m_aRequestOptions.setEntity(_rUser); }
void setLocale(const Locale & _rLocale)
{ m_aRequestOptions.setLocale(_rLocale); }
void setMultiLocaleMode()
{ m_aRequestOptions.setAllLocales(); }
void enableAsync(bool _bEnable)
{ m_aRequestOptions.enableAsync(_bEnable); }
};
typedef vos::ORef<OOptions> OptionsRef;
2000-11-30 02:01:47 -06:00
struct ltOptions
{
lessRequestOptions ltData;
bool operator()(OptionsRef const &o1, OptionsRef const &o2) const
{
return ltData(o1->getRequestOptions(),o2->getRequestOptions());
}
2000-11-13 06:14:49 -06:00
};
} // namespace
#endif