diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2007-01-18 13:58:10 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2007-01-18 13:58:10 +0000 |
commit | bf83fcb1037442fd33a43b0ea668a79f90020850 (patch) | |
tree | 366ee3fcb7b464ae12aa9ae8fb6d909ef1ea4afb /desktop/source/pkgchk/unopkg/unopkg_shared.h | |
parent | d7ed149fb6bf8837b5ed1cbe856826095bc00a4e (diff) |
INTEGRATION: CWS sb66 (1.1.2); FILE ADDED
2007/01/04 09:47:55 sb 1.1.2.1: #i69910# Moved here from ..
Diffstat (limited to 'desktop/source/pkgchk/unopkg/unopkg_shared.h')
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_shared.h | 159 |
1 files changed, 159 insertions, 0 deletions
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h new file mode 100644 index 000000000000..4c2e0f83ffb5 --- /dev/null +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -0,0 +1,159 @@ +/************************************************************************* + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: unopkg_shared.h,v $ + * + * $Revision: 1.2 $ + * + * last change: $Author: vg $ $Date: 2007-01-18 14:58:10 $ + * + * The Contents of this file are made available subject to + * the terms of GNU Lesser General Public License Version 2.1. + * + * + * GNU Lesser General Public License Version 2.1 + * ============================================= + * Copyright 2005 by Sun Microsystems, Inc. + * 901 San Antonio Road, Palo Alto, CA 94303, USA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License version 2.1, as published by the Free Software Foundation. + * + * This library 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 for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + * + ************************************************************************/ + +#include "dp_misc.h" +#include "com/sun/star/lang/XComponent.hpp" +#include "com/sun/star/uno/XComponentContext.hpp" +#include "com/sun/star/ucb/XCommandEnvironment.hpp" +#include "com/sun/star/deployment/XPackage.hpp" +#include "tools/resmgr.hxx" + + + +namespace css = ::com::sun::star; + +namespace unopkg { + +struct DeploymentResMgr : public rtl::StaticWithInit< ResMgr *, DeploymentResMgr > +{ + ResMgr * operator () () { + return ResMgr::CreateResMgr( "deployment" LIBRARY_SOLARUPD() ); + } +}; +// There is another gobal DeploymentGuiResMgr in the gui part of the Extension Manager. +//We need it here because we share a WarningBox resource (WARNINGBOX_CONCURRENTINSTANCE) +//the gui +struct DeploymentGuiResMgr : + public ::rtl::StaticWithInit< ResMgr *, DeploymentGuiResMgr > { + ResMgr * operator () () { + return ResMgr::CreateResMgr( "deploymentgui" LIBRARY_SOLARUPD() ); + } +}; + +struct OptionInfo +{ + char const * m_name; + sal_uInt32 m_name_length; + sal_Unicode m_short_option; + bool m_has_argument; +}; + +//============================================================================== +::rtl::OString toString( OptionInfo const * info ); + +//============================================================================== +OptionInfo const * getOptionInfo( + OptionInfo const * list, + ::rtl::OUString const & opt, sal_Unicode copt = '\0' ); + +//============================================================================== +bool isOption( OptionInfo const * option_info, sal_uInt32 * pIndex ); + +//============================================================================== +bool readArgument( + ::rtl::OUString * pValue, OptionInfo const * option_info, + sal_uInt32 * pIndex ); + +//============================================================================== +inline bool readOption( + bool * flag, OptionInfo const * option_info, sal_uInt32 * pIndex ) +{ + if (isOption( option_info, pIndex )) { + OSL_ASSERT( flag != 0 ); + *flag = true; + return true; + } + return false; +} + +//============================================================================== +::rtl::OUString const & getExecutableDir(); + +//============================================================================== +::rtl::OUString const & getProcessWorkingDir(); + +//============================================================================== +::rtl::OUString makeAbsoluteFileUrl( + ::rtl::OUString const & sys_path, ::rtl::OUString const & base_url, + bool throw_exc = true ); + +//############################################################################## + +//============================================================================== +class DisposeGuard +{ + css::uno::Reference<css::lang::XComponent> m_xComp; + +public: + inline DisposeGuard() {} + inline DisposeGuard( + css::uno::Reference<css::lang::XComponent> const & xComp ) + : m_xComp( xComp ) {} + + inline ~DisposeGuard() + { + if (m_xComp.is()) + m_xComp->dispose(); + } + + inline void reset( + css::uno::Reference<css::lang::XComponent> const & xComp ) + { + m_xComp = xComp; + } +}; + +//============================================================================== +css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv( + css::uno::Reference<css::uno::XComponentContext> const & xContext, + ::rtl::OUString const & logFile, + bool option_force_overwrite, + bool option_verbose); + +//============================================================================== +void printf_packages( + css::uno::Sequence< + css::uno::Reference<css::deployment::XPackage> > const & seq, + css::uno::Reference<css::ucb::XCommandEnvironment> const & xCmdEnv, + sal_Int32 level = 0 ); + +//############################################################################## + +//============================================================================== +css::uno::Reference<css::uno::XComponentContext> getUNO( + DisposeGuard & disposeGuard, bool verbose, bool bGui); + +} + |