2000-11-13 06:14:49 -06:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 06:55:47 -05:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-11-13 06:14:49 -06:00
|
|
|
*
|
2008-04-11 06:55:47 -05:00
|
|
|
* Copyright 2008 by Sun Microsystems, Inc.
|
2000-11-13 06:14:49 -06:00
|
|
|
*
|
2008-04-11 06:55:47 -05:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-11-13 06:14:49 -06:00
|
|
|
*
|
2008-04-11 06:55:47 -05:00
|
|
|
* $RCSfile: options.hxx,v $
|
|
|
|
* $Revision: 1.22 $
|
2000-11-13 06:14:49 -06:00
|
|
|
*
|
2008-04-11 06:55:47 -05:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-11-13 06:14:49 -06:00
|
|
|
*
|
2008-04-11 06:55:47 -05: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
|
|
|
*
|
2008-04-11 06:55:47 -05: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
|
|
|
*
|
2008-04-11 06:55:47 -05: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_
|
|
|
|
|
2002-03-15 04:40:17 -06:00
|
|
|
#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>
|
2007-11-23 07:22:26 -06:00
|
|
|
#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.
|
2002-03-15 04:40:17 -06:00
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2007-11-23 07:22:26 -06:00
|
|
|
class OOptions : public configmgr::SimpleReferenceObject
|
2000-11-13 06:14:49 -06:00
|
|
|
{
|
2002-03-15 04:40:17 -06:00
|
|
|
RequestOptions m_aRequestOptions; // current options to use
|
|
|
|
|
2000-11-13 06:14:49 -06:00
|
|
|
public:
|
2002-03-15 04:40:17 -06:00
|
|
|
typedef RequestOptions::Locale Locale;
|
2004-01-20 09:25:59 -06:00
|
|
|
typedef RequestOptions::LocaleString LocaleString;
|
2002-03-15 04:40:17 -06:00
|
|
|
typedef RequestOptions::Entity Entity;
|
|
|
|
|
2002-03-28 02:01:57 -06:00
|
|
|
OOptions()
|
|
|
|
: m_aRequestOptions()
|
2000-12-19 04:14:08 -06:00
|
|
|
{}
|
2000-11-30 02:01:47 -06:00
|
|
|
|
2002-03-15 04:40:17 -06:00
|
|
|
explicit
|
2002-03-28 02:01:57 -06:00
|
|
|
OOptions(const RequestOptions& _aDefaultOptions)
|
2003-03-19 09:20:19 -06:00
|
|
|
: m_aRequestOptions(_aDefaultOptions)
|
2002-03-15 04:40:17 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2003-03-19 09:20:19 -06:00
|
|
|
OOptions(const OOptions& _aOtherOptions)
|
2007-11-23 07:22:26 -06:00
|
|
|
: configmgr::SimpleReferenceObject()
|
2006-06-19 17:24:15 -05:00
|
|
|
, m_aRequestOptions(_aOtherOptions.m_aRequestOptions)
|
2000-12-19 04:14:08 -06:00
|
|
|
{
|
|
|
|
}
|
2000-11-30 02:01:47 -06:00
|
|
|
|
2002-03-15 04:40:17 -06:00
|
|
|
bool isForSessionUser() const { return ! m_aRequestOptions.hasEntity(); }
|
2000-11-30 02:01:47 -06:00
|
|
|
|
2004-01-20 09:25:59 -06:00
|
|
|
LocaleString getLocale() const { return m_aRequestOptions.getLocale(); }
|
|
|
|
Entity getUser() const { return m_aRequestOptions.getEntity(); }
|
2001-09-25 10:05:21 -05:00
|
|
|
|
2002-03-15 04:40:17 -06:00
|
|
|
RequestOptions const & getRequestOptions() const
|
|
|
|
{ return m_aRequestOptions; }
|
2000-12-04 12:47:18 -06:00
|
|
|
|
2002-03-15 04:40:17 -06:00
|
|
|
void setUser(const Entity & _rUser)
|
|
|
|
{ m_aRequestOptions.setEntity(_rUser); }
|
2000-12-19 04:14:08 -06:00
|
|
|
|
2002-03-15 04:40:17 -06:00
|
|
|
void setLocale(const Locale & _rLocale)
|
|
|
|
{ m_aRequestOptions.setLocale(_rLocale); }
|
|
|
|
|
|
|
|
void setMultiLocaleMode()
|
|
|
|
{ m_aRequestOptions.setAllLocales(); }
|
|
|
|
|
2003-03-19 09:20:19 -06:00
|
|
|
void enableAsync(bool _bEnable)
|
|
|
|
{ m_aRequestOptions.enableAsync(_bEnable); }
|
2000-12-04 12:47:18 -06:00
|
|
|
};
|
2002-03-15 04:40:17 -06:00
|
|
|
typedef vos::ORef<OOptions> OptionsRef;
|
2000-11-30 02:01:47 -06:00
|
|
|
|
2000-12-04 12:47:18 -06:00
|
|
|
struct ltOptions
|
|
|
|
{
|
2002-03-15 04:40:17 -06:00
|
|
|
lessRequestOptions ltData;
|
|
|
|
bool operator()(OptionsRef const &o1, OptionsRef const &o2) const
|
2000-12-04 12:47:18 -06:00
|
|
|
{
|
2002-03-15 04:40:17 -06:00
|
|
|
return ltData(o1->getRequestOptions(),o2->getRequestOptions());
|
2000-12-04 12:47:18 -06:00
|
|
|
}
|
2000-11-13 06:14:49 -06:00
|
|
|
};
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
#endif
|