Kaydet (Commit) b2d7ede9 authored tarafından Caolán McNamara's avatar Caolán McNamara

ditch product registration implementation

üst 64d9d21d
...@@ -214,7 +214,6 @@ $(eval $(call gb_Helper_register_libraries,UNOLIBS_OOO, \ ...@@ -214,7 +214,6 @@ $(eval $(call gb_Helper_register_libraries,UNOLIBS_OOO, \
nullcanvas \ nullcanvas \
OGLTrans \ OGLTrans \
passwordcontainer \ passwordcontainer \
productregistration \
simplecanvas \ simplecanvas \
slideshow \ slideshow \
vbaobj \ vbaobj \
......
...@@ -40,7 +40,6 @@ dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_exe ...@@ -40,7 +40,6 @@ dt desktop\source\deployment\registry\executable nmake - all dt_dp_registry_exe
dt desktop\scripts nmake - u dt_scripts dt_inc NULL dt desktop\scripts nmake - u dt_scripts dt_inc NULL
dt desktop\util nmake - all dt_util dt_app dt_pagein.u dt_spl dt_uwrapper.u dt_usplash.u dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_win32_quickstart_so.w dt_zipintro NULL dt desktop\util nmake - all dt_util dt_app dt_pagein.u dt_spl dt_uwrapper.u dt_usplash.u dt_wrapper.w dt_officeloader.w dt_officeloader_unx.u dt_migr dt_win32_quickstart_so.w dt_zipintro NULL
dt desktop\zipintro nmake - all dt_zipintro NULL dt desktop\zipintro nmake - all dt_zipintro NULL
dt desktop\registry\data\org\openoffice\Office nmake - all sn_regconfig NULL
dt desktop\qa\deployment_misc nmake - all sn_qa_deployment_misc dt_dp_misc dt_inc NULL dt desktop\qa\deployment_misc nmake - all sn_qa_deployment_misc dt_dp_misc dt_inc NULL
dt desktop\test\deployment\active nmake - all dt_test_deployment_active NULL dt desktop\test\deployment\active nmake - all dt_test_deployment_active NULL
dt desktop\test\deployment\boxt nmake - all dt_test_deployment_boxt NULL dt desktop\test\deployment\boxt nmake - all dt_test_deployment_boxt NULL
......
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************ -->
<oor:component-data oor:name="Jobs" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="Jobs">
<node oor:name="ProductRegistration" oor:op="replace">
<prop oor:name="Service">
<value>com.sun.star.comp.framework.DoRegistrationJob</value>
</prop>
<node oor:name="Arguments">
<prop oor:name="ProductName" oor:op="replace" oor:type="xs:string">
<value>${SERVICETAG_PRODUCTNAME}</value>
</prop>
<prop oor:name="ProductVersion" oor:op="replace" oor:type="xs:string">
<value>${SERVICETAG_PRODUCTVERSION}</value>
</prop>
<prop oor:name="ProductURN" oor:op="replace" oor:type="xs:string">
<value>${SERVICETAG_URN}</value>
</prop>
<prop oor:name="ProductSource" oor:op="replace" oor:type="xs:string">
<value>${SERVICETAG_SOURCE}</value>
</prop>
<prop oor:name="ProductParent" oor:op="replace" oor:type="xs:string">
<value>${SERVICETAG_PARENTNAME}</value>
</prop>
<prop oor:name="Vendor" oor:op="replace" oor:type="xs:string">
<value>Sun Microsystems, Inc.</value>
</prop>
<prop oor:name="RegistrationData" oor:op="replace" oor:type="xs:string">
<value>$(user)/registration.xml</value>
</prop>
<prop oor:name="RegistrationURL" oor:op="replace" oor:type="xs:string">
<value>${REGISTRATION_HOST}/register/${registry_urn}?product=${REGISTRATION_PRODUCT}&amp;locale=${locale}&amp;cid=${REGISTRATION_CID}</value>
</prop>
</node>
</node>
</node>
<node oor:name="Events">
<node oor:name="onRegisterNow" oor:op="fuse">
<node oor:name="JobList">
<node oor:name="ProductRegistration" oor:op="replace"/>
</node>
</node>
<node oor:name="onRegisterLater" oor:op="fuse">
<node oor:name="JobList">
<node oor:name="ProductRegistration" oor:op="replace"/>
</node>
</node>
</node>
</oor:component-data>
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# 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.
#
# 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).
#
# 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.
#
#*************************************************************************
PRJ=..$/..$/..$/..$/..
PRJNAME=setup_native
TARGET=data_registration
PACKAGE=org.openoffice.Office
ABSXCSROOT=$(SOLARXMLDIR)
XCSROOT=..
DTDDIR=$(ABSXCSROOT)
XSLDIR=$(ABSXCSROOT)$/processing
PROCESSOUT=$(MISC)$/$(TARGET)
PROCESSORDIR=$(SOLARBINDIR)
.INCLUDE : settings.mk
.IF "$(L10N_framework)"==""
# --- Files -------------------------------------------------------
.IF "$(BUILD_SPECIAL)"!=""
XCUFILES= \
Jobs.xcu
MODULEFILES=
LOCALIZEDFILES=
PACKAGEDIR=$(subst,.,$/ $(PACKAGE))
SPOOLDIR=$(MISC)$/registry$/spool
MYXCUFILES= \
$(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-registration.xcu
.ELSE # "$(BUILD_SPECIAL)"!=""
dummy:
@echo "Nothing to build"
.ENDIF # "$(BUILD_SPECIAL)"!=""
# --- Targets ------------------------------------------------------
.INCLUDE : target.mk
.ENDIF # L10N_framework
ALLTAR : $(MYXCUFILES)
$(SPOOLDIR)$/$(PACKAGEDIR)$/Jobs$/Jobs-registration.xcu : $(PROCESSOUT)$/registry$/data$/$/$(PACKAGEDIR)$/Jobs.xcu
@-$(MKDIRHIER) $(@:d)
@$(COPY) $< $@
...@@ -100,7 +100,6 @@ my_components = \ ...@@ -100,7 +100,6 @@ my_components = \
component/svl/source/passwordcontainer/passwordcontainer \ component/svl/source/passwordcontainer/passwordcontainer \
component/svl/util/svl \ component/svl/util/svl \
component/svtools/source/hatchwindow/hatchwindowfactory \ component/svtools/source/hatchwindow/hatchwindowfactory \
component/svtools/source/productregistration/productregistration.uno \
component/svtools/util/svt \ component/svtools/util/svt \
component/svx/util/svx \ component/svx/util/svx \
component/svx/util/svxcore \ component/svx/util/svxcore \
......
...@@ -207,7 +207,6 @@ pdfimport.uno.dll 0x0000000060bf0000 0x000a0000 ...@@ -207,7 +207,6 @@ pdfimport.uno.dll 0x0000000060bf0000 0x000a0000
placewaremi.dll 0x0000000060bd0000 0x00010000 placewaremi.dll 0x0000000060bd0000 0x00010000
plmi.dll 0x0000000060b90000 0x00030000 plmi.dll 0x0000000060b90000 0x00030000
pptimportermi.dll 0x0000000060b70000 0x00010000 pptimportermi.dll 0x0000000060b70000 0x00010000
productregistration.uno.dll 0x0000000060b20000 0x00010000
protocolhandlermi.dll 0x0000000060b00000 0x00010000 protocolhandlermi.dll 0x0000000060b00000 0x00010000
proxyfac.uno.dll 0x0000000060ae0000 0x00010000 proxyfac.uno.dll 0x0000000060ae0000 0x00010000
purpenvhelper3msc.dll 0x0000000060ac0000 0x00010000 purpenvhelper3msc.dll 0x0000000060ac0000 0x00010000
......
...@@ -1016,8 +1016,6 @@ STD_LIB_FILE(gid_File_Lib_DeploymentMisc, deploymentmisc) ...@@ -1016,8 +1016,6 @@ STD_LIB_FILE(gid_File_Lib_DeploymentMisc, deploymentmisc)
STD_LIB_FILE( gid_File_Lib_Pl , pl) STD_LIB_FILE( gid_File_Lib_Pl , pl)
#endif #endif
SPECIAL_COMPONENT_LIB_FILE( gid_File_Lib_Productregistration, productregistration.uno )
#if defined(UNX) && ! defined(QUARTZ) #if defined(UNX) && ! defined(QUARTZ)
File gid_File_Lib_Desktop_Detector File gid_File_Lib_Desktop_Detector
Name = LIBNAME(desktop_detector); Name = LIBNAME(desktop_detector);
......
...@@ -66,8 +66,6 @@ STD_RES_FILE( gid_File_Res_Pcr, pcr) ...@@ -66,8 +66,6 @@ STD_RES_FILE( gid_File_Res_Pcr, pcr)
STD_RES_FILE( gid_File_Res_Pdffilter, pdffilter) STD_RES_FILE( gid_File_Res_Pdffilter, pdffilter)
STD_RES_FILE( gid_File_Res_Productregistration, productregistration)
#ifdef UNX #ifdef UNX
STD_RES_FILE( gid_File_Res_San, san ) STD_RES_FILE( gid_File_Res_San, san )
......
...@@ -480,7 +480,6 @@ Module gid_Module_Root_Files_5 ...@@ -480,7 +480,6 @@ Module gid_Module_Root_Files_5
gid_File_Lib_Fsstorage, gid_File_Lib_Fsstorage,
gid_File_Lib_Hatchwindowfactory, gid_File_Lib_Hatchwindowfactory,
gid_File_Lib_Passwordcontainer, gid_File_Lib_Passwordcontainer,
gid_File_Lib_Productregistration,
gid_File_Lib_Svtmisc, gid_File_Lib_Svtmisc,
gid_File_Lib_Updchkui, gid_File_Lib_Updchkui,
gid_File_Lib_Updatefeed, gid_File_Lib_Updatefeed,
......
...@@ -75,7 +75,6 @@ Module gid_Module_Langpack_Resource_Template ...@@ -75,7 +75,6 @@ Module gid_Module_Langpack_Resource_Template
gid_File_Res_Pcr, gid_File_Res_Pcr,
gid_File_Res_Pdffilter, gid_File_Res_Pdffilter,
gid_File_Res_San, gid_File_Res_San,
gid_File_Res_Productregistration,
gid_File_Res_Sb, gid_File_Res_Sb,
gid_File_Res_Sd, gid_File_Res_Sd,
gid_File_Res_Sfx, gid_File_Res_Sfx,
......
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2011 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# 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.
#
# 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).
#
# 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.
#
#*************************************************************************
$(eval $(call gb_AllLangResTarget_AllLangResTarget,productregistration))
$(eval $(call gb_AllLangResTarget_set_reslocation,productregistration,svtools))
$(eval $(call gb_AllLangResTarget_add_srs,productregistration,\
svt/productregistration \
))
$(eval $(call gb_SrsTarget_SrsTarget,svt/productregistration))
$(eval $(call gb_SrsTarget_set_include,svt/productregistration,\
$$(INCLUDE) \
-I$(WORKDIR)/inc \
))
$(eval $(call gb_SrsTarget_add_files,svt/productregistration,\
svtools/source/productregistration/registrationdlg.src \
))
# vim: set noet sw=4 ts=4:
# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2011 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# 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.
#
# 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).
#
# 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.
#
#*************************************************************************
$(eval $(call gb_Library_Library,productregistration))
$(eval $(call gb_Library_set_componentfile,productregistration,svtools/source/productregistration/productregistration.uno))
$(eval $(call gb_Library_set_include,productregistration,\
$$(SOLARINC) \
-I$(WORKDIR)/inc/svtools \
-I$(WORKDIR)/inc/ \
-I$(realpath $(SRCDIR)/svtools/inc/pch) \
-I$(OUTDIR)/inc/ \
-I$(realpath $(SRCDIR)/svtools/inc) \
-I$(OUTDIR)/inc \
))
$(eval $(call gb_Library_add_api,productregistration,\
udkapi \
offapi \
))
$(eval $(call gb_Library_add_linked_libs,productregistration,\
cppu \
cppuhelper \
sal \
svl \
tk \
tl \
utl \
vcl \
$(gb_STDLIBS) \
))
$(eval $(call gb_Library_add_exception_objects,productregistration,\
svtools/source/productregistration/productregistration \
svtools/source/productregistration/registrationdlg \
))
# vim: set noet sw=4 ts=4:
...@@ -29,10 +29,8 @@ ...@@ -29,10 +29,8 @@
$(eval $(call gb_Module_Module,svtools)) $(eval $(call gb_Module_Module,svtools))
$(eval $(call gb_Module_add_targets,svtools,\ $(eval $(call gb_Module_add_targets,svtools,\
AllLangResTarget_productregistration \
AllLangResTarget_svt \ AllLangResTarget_svt \
Library_hatchwindowfactory \ Library_hatchwindowfactory \
Library_productregistration \
Library_svt \ Library_svt \
Package_inc \ Package_inc \
)) ))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include "productregistration.hxx"
#include "unotools/regoptions.hxx"
#include "registrationdlg.hxx"
#include <svtools/svtools.hrc>
#include "cppuhelper/factory.hxx"
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/system/XSystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/frame/DispatchResultState.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/beans/XMaterialHolder.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <toolkit/helper/vclunohelper.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
#include <osl/diagnose.h>
#include <algorithm>
#include <functional>
#include <memory>
#define PRODREG_IMPLNAME "com.sun.star.comp.setup.ProductRegistration"
#define PRODREG_SERVNAME "com.sun.star.setup.ProductRegistration"
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::registry;
using namespace ::com::sun::star::container;
using rtl::OUString;
//........................................................................
namespace svt
{
//........................................................................
using namespace ::com::sun::star::task;
using namespace ::com::sun::star::system;
using namespace ::com::sun::star::beans;
using namespace ::com::sun::star::frame;
using namespace ::com::sun::star::awt;
//-------------------------------------------------------------------
struct EqualsOUString : public ::std::unary_function< OUString, sal_Bool >
{
const OUString& m_rCompare;
EqualsOUString( const OUString& _rCompare ) : m_rCompare( _rCompare ) { }
sal_Bool operator() ( const OUString& _rCompare )
{
return m_rCompare.equals( _rCompare );
}
};
//====================================================================
//= OProductRegistration
//====================================================================
//--------------------------------------------------------------------
OProductRegistration::OProductRegistration( const Reference< XMultiServiceFactory >& _rxORB )
:m_xORB( _rxORB )
{
}
//--------------------------------------------------------------------
Reference< XInterface > OProductRegistration::Create( const Reference< XMultiServiceFactory >& _rxORB )
{
return static_cast< ::cppu::OWeakObject* >( new OProductRegistration( _rxORB ) );
}
//--------------------------------------------------------------------
OUString SAL_CALL OProductRegistration::getImplementationName_Static( )
{
return OUString(RTL_CONSTASCII_USTRINGPARAM( PRODREG_IMPLNAME ));
}
//--------------------------------------------------------------------
Sequence< OUString > SAL_CALL OProductRegistration::getSupportedServiceNames_Static( ) throw (RuntimeException)
{
Sequence< OUString > aServiceNames( 1 );
aServiceNames[ 0 ] = OUString(RTL_CONSTASCII_USTRINGPARAM( PRODREG_SERVNAME ));
return aServiceNames;
}
//--------------------------------------------------------------------
OUString SAL_CALL OProductRegistration::getImplementationName( ) throw (RuntimeException)
{
return getImplementationName_Static( );
}
//--------------------------------------------------------------------
sal_Bool SAL_CALL OProductRegistration::supportsService( const OUString& _rServiceName ) throw (RuntimeException)
{
Sequence< OUString > aServiceNames( getSupportedServiceNames( ) );
const OUString* pNames = aServiceNames.getConstArray( );
const OUString* pNamesEnd = aServiceNames.getConstArray( ) + aServiceNames.getLength();
const OUString* pFound = ::std::find_if(
pNames,
pNamesEnd,
EqualsOUString( _rServiceName )
);
return pFound != pNamesEnd;
}
//--------------------------------------------------------------------
Sequence< OUString > SAL_CALL OProductRegistration::getSupportedServiceNames( ) throw (RuntimeException)
{
return getSupportedServiceNames_Static( );
}
//--------------------------------------------------------------------
static Reference< XFrame > lcl_getActiveFrame( const Reference< XMultiServiceFactory >& xFactory )
{
try
{
Reference< XDesktop > xDesktop(
xFactory->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ),
UNO_QUERY_THROW );
Reference< XFrame > xFrame(xDesktop->getCurrentFrame());
if( ! xFrame.is() )
{
// Perhaps the frames collection of the desktop knows about an "active frame"?
Reference< XFramesSupplier > xFrames( xDesktop, UNO_QUERY_THROW );
xFrame = xFrames->getActiveFrame();
}
return xFrame;
}
catch(const Exception& )
{
OSL_FAIL( "lcl_getActiveFrame: caught an exception!" );
return Reference< XFrame >();
}
}
//--------------------------------------------------------------------
static Window* lcl_getPreferredDialogParent( const Reference< XFrame >& xFrame )
{
Window* pReturn = Application::GetDefDialogParent();
try
{
if ( xFrame.is() )
{
Reference< XWindow > xWindow = xFrame->getContainerWindow();
if ( xWindow.is() )
pReturn = VCLUnoHelper::GetWindow( xWindow );
}
}
catch( const Exception& )
{
OSL_FAIL( "lcl_getPreferredDialogParent: caught an exception!" );
}
return pReturn;
}
//--------------------------------------------------------------------
static bool lcl_isEvalVersion( const Reference< XMultiServiceFactory >& _rxORB )
{
bool bIsEvaluationVersion = false;
try
{
Reference < XMaterialHolder > xHolder(
_rxORB->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.tab.tabreg" ) ) ),
UNO_QUERY
);
if ( xHolder.is() )
{
Any aData = xHolder->getMaterial();
Sequence < NamedValue > aSeq;
if ( aData >>= aSeq )
{
// it's an evaluation version - a non-eval version wouldn't provide this "material"
bIsEvaluationVersion = true;
}
}
}
catch( const Exception& )
{
OSL_FAIL( "lcl_isEvalVersion: caught an exception!" );
}
return bIsEvaluationVersion;
}
//--------------------------------------------------------------------
static bool lcl_doNewStyleRegistration( const Reference< XMultiServiceFactory >& xFactory, bool online )
{
try
{
Reference< XMultiServiceFactory > xConfigProvider(
xFactory->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) )
),
UNO_QUERY_THROW
);
PropertyValue aNodePath;
aNodePath.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) );
aNodePath.Value = makeAny( OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.Office.Jobs/Events" ) ) );
Sequence< Any > lArguments(1);
lArguments[0] = makeAny( aNodePath );
Reference< XHierarchicalNameAccess > xNameAccess(
xConfigProvider->createInstanceWithArguments(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationAccess" ) ),
lArguments
),
UNO_QUERY_THROW
);
if( ! xNameAccess->hasByHierarchicalName( OUString( RTL_CONSTASCII_USTRINGPARAM( "onRegisterNow/JobList" ) ) ) )
return false;
Reference< XJobExecutor > xJobExecutor(
xFactory->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.JobExecutor" ) )
),
UNO_QUERY_THROW
);
xJobExecutor->trigger( online ? OUString( RTL_CONSTASCII_USTRINGPARAM( "onRegisterNow" ) ) :
OUString( RTL_CONSTASCII_USTRINGPARAM( "onRegisterLater" ) ) );
return true;
}
catch( const Exception& )
{
OSL_FAIL( "lcl_getOnlineRegistrationDispatch: caught an exception!" );
return false;
}
}
//--------------------------------------------------------------------
void SAL_CALL OProductRegistration::trigger( const OUString& _rEvent ) throw (RuntimeException)
{
bool registerOnline = false;
switch ( classify( _rEvent ) )
{
case etRegistrationRequired:
registerOnline = true;
break;
default:
break;
}
// prefer new style registration
if( ! lcl_doNewStyleRegistration(m_xORB, registerOnline ) && registerOnline )
doOnlineRegistration();
}
//--------------------------------------------------------------------
Any SAL_CALL OProductRegistration::execute( const Sequence< NamedValue >& ) throw (IllegalArgumentException, Exception, RuntimeException)
{
Any aReturn;
static sal_Bool bFirstEncounter( sal_True );
if ( bFirstEncounter )
{ // during this session, this event was never triggered before ....
bFirstEncounter = sal_False;
sal_Bool bDeactivateJob = sal_True;
// our config options
utl::RegOptions aRegOptions;
// check them for the permissions for the dialog
utl::RegOptions::DialogPermission ePermission( aRegOptions.getDialogPermission() );
if ( utl::RegOptions::dpDisabled != ePermission )
{ // the dialog is _not_ disabled
// for this session, I'm no interested in the dialog registration anymore
aRegOptions.markSessionDone( );
if ( ( utl::RegOptions::dpNotThisSession == ePermission ) // first trigger session not reached
|| ( utl::RegOptions::dpRemindLater == ePermission ) // or at a later reminder date
)
{ // the dialog should be executed during one of the next sessions
bDeactivateJob = sal_False;
}
else
{
// if we're here, the dialog should be executed during this session
OSL_ENSURE( utl::RegOptions::dpThisSession == ePermission, "OProductRegistration::execute: invalid permissions!" );
{
// this is some kind of HACK.
// This registration dialog is intended to appear very very early during the
// first office start after installation. Unfortunately, this is so early
// that even SFX is not yet loaded, thus the SfxHelp class is not yet available,
// thus, there is no help during the lifetime of the dialog.
// To fake this, we explicitly load the necessary services when the user
// really requests help herein.
Reference < XInitialization > xOfficeWrapper(
m_xORB->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.OfficeWrapper" ) )
),
UNO_QUERY
);
if ( xOfficeWrapper.is() )
xOfficeWrapper->initialize( Sequence < Any >() );
}
std::auto_ptr<ResMgr> pResMgr (ResMgr::CreateResMgr (
CREATEVERSIONRESMGR_NAME(productregistration)));
Reference< XFrame > xFrame = lcl_getActiveFrame( m_xORB );
// execute it
RegistrationDialog aDialog (
lcl_getPreferredDialogParent( xFrame ),
ResId( DLG_REGISTRATION_REQUEST, *pResMgr.get() ),
lcl_isEvalVersion( m_xORB ) );
aDialog.Execute();
bool registerOnline = false;
switch ( aDialog.getResponse() )
{
case RegistrationDialog::urRegisterNow:
registerOnline = true;
break;
case RegistrationDialog::urRegisterLater:
bDeactivateJob = sal_False;
// remind again in seven days from now on ...
aRegOptions.activateReminder( 7 );
break;
case RegistrationDialog::urRegisterNever:
case RegistrationDialog::urAlreadyRegistered:
// never register or already registered
// -> deactivate the job, and nothing else
break;
default:
OSL_FAIL( "OProductRegistration::execute: invalid response from the dialog!" );
}
// prefer new style registration
if( ! lcl_doNewStyleRegistration(m_xORB, registerOnline) && registerOnline )
doOnlineRegistration();
}
}
Sequence< NamedValue > aJobResponse( 1 );
aJobResponse[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "Deactivate" ));
aJobResponse[0].Value <<= bDeactivateJob;
aReturn <<= aJobResponse;
}
return aReturn;
}
//--------------------------------------------------------------------
void OProductRegistration::doOnlineRegistration( )
{
sal_Bool bSuccess = sal_False;
try
{
// create the Desktop component which can load components
Reference< XSystemShellExecute > xSystemShell(
m_xORB->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.system.SystemShellExecute" )) ),
UNO_QUERY
);
OSL_ENSURE( xSystemShell.is(), "OProductRegistration::doOnlineRegistration: invalid SystemExecute component!" );
// access the configuration to retrieve the URL we shall use for registration
utl::RegOptions aOptions;
OUString sRegistrationURL( aOptions.getRegistrationURL( ) );
OSL_ENSURE( sRegistrationURL.getLength(), "OProductRegistration::doOnlineRegistration: invalid URL found!" );
if ( xSystemShell.is() && sRegistrationURL.getLength() )
{
xSystemShell->execute( sRegistrationURL, OUString(), SystemShellExecuteFlags::DEFAULTS );
bSuccess = sal_True;
}
}
catch( const Exception& )
{
}
if ( !bSuccess )
{
std::auto_ptr<ResMgr> pResMgr (ResMgr::CreateResMgr (
CREATEVERSIONRESMGR_NAME(productregistration)));
ErrorBox aRegistrationError(
Application::GetDefDialogParent(),
ResId( ERRBOX_REG_NOSYSBROWSER, *pResMgr.get() ));
aRegistrationError.Execute();
// try again later
utl::RegOptions aRegOptions;
aRegOptions.activateReminder( 7 );
}
}
//--------------------------------------------------------------------
OProductRegistration::EventType OProductRegistration::classify( const OUString& _rEventDesc )
{
EventType eReturn = etUnknown;
if ( _rEventDesc.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("RegistrationRequired")) )
{
eReturn = etRegistrationRequired;
}
return eReturn;
}
//........................................................................
} // namespace svt
//........................................................................
extern "C"
{
SAL_DLLPUBLIC_EXPORT void * SAL_CALL productregistration_component_getFactory (
const sal_Char * pImplementationName, void * pServiceManager, void * /* pRegistryKey */)
{
void * pResult = 0;
if (pServiceManager)
{
Reference< XSingleServiceFactory > xFactory;
if (svt::OProductRegistration::getImplementationName_Static().compareToAscii (pImplementationName) == 0)
{
xFactory = cppu::createSingleFactory (
reinterpret_cast< XMultiServiceFactory* >(pServiceManager),
svt::OProductRegistration::getImplementationName_Static(),
svt::OProductRegistration::Create,
svt::OProductRegistration::getSupportedServiceNames_Static());
}
if (xFactory.is())
{
xFactory->acquire();
pResult = xFactory.get();
}
}
return pResult;
}
} // extern "C"
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef SVTOOLS_PRODUCTREGISTRATION_HXX
#define SVTOOLS_PRODUCTREGISTRATION_HXX
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/task/XJobExecutor.hpp>
#include <com/sun/star/task/XJob.hpp>
#include <cppuhelper/implbase3.hxx>
//........................................................................
namespace svt
{
//........................................................................
//====================================================================
//= OProductRegistration
//====================================================================
typedef ::cppu::WeakImplHelper3 < ::com::sun::star::lang::XServiceInfo
, ::com::sun::star::task::XJobExecutor
, ::com::sun::star::task::XJob
> OProductRegistration_Base;
class OProductRegistration : public OProductRegistration_Base
{
private:
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
m_xORB;
protected:
OProductRegistration( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
public:
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
Create( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
// XServiceInfo - static version
static ::rtl::OUString SAL_CALL getImplementationName_Static( );
static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames_Static( ) throw (::com::sun::star::uno::RuntimeException);
protected:
// XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException);
// XJobExecutor
virtual void SAL_CALL trigger( const ::rtl::OUString& sEvent ) throw (::com::sun::star::uno::RuntimeException);
// XJob
virtual ::com::sun::star::uno::Any SAL_CALL execute( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& _rArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
private:
// types of events which can be handled by this component
enum EventType
{
etRegistrationRequired,
etUnknown
};
// classifies a event
EventType classify( const ::rtl::OUString& _rEventDesc );
// do the online registration
void doOnlineRegistration( );
};
//........................................................................
} // namespace svt
//........................................................................
#endif // SVTOOLS_PRODUCTREGISTRATION_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
<?xml version="1.0" encoding="UTF-8"?>
<!--**********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
**********************************************************************-->
<component loader="com.sun.star.loader.SharedLibrary" prefix="productregistration"
xmlns="http://openoffice.org/2010/uno-components">
<implementation name="com.sun.star.comp.setup.ProductRegistration">
<service name="com.sun.star.setup.ProductRegistration"/>
</implementation>
</component>
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_svtools.hxx"
#include "registrationdlg.hxx"
#include "registrationdlg.hrc"
#include <vcl/msgbox.hxx>
#include <tools/debug.hxx>
//........................................................................
namespace svt
{
//........................................................................
static void lcl_moveControls( Control** _ppControls, sal_Int32 _nAmount )
{
if ( _ppControls )
while ( *_ppControls )
{
Point aPos = (*_ppControls)->GetPosPixel();
aPos.Y() += _nAmount;
(*_ppControls)->SetPosPixel( aPos );
++_ppControls;
}
}
//====================================================================
//= RegistrationDialog
//====================================================================
//--------------------------------------------------------------------
RegistrationDialog::RegistrationDialog( Window* _pWindow, const ResId& _rResId, bool _bEvalVersion )
:ModalDialog( _pWindow, _rResId )
,m_eResponse ( urRegisterLater )
,m_aLogo ( this, ResId( FI_LOGO, *_rResId.GetResMgr() ) )
,m_aIntro ( this, ResId( FT_INTRO, *_rResId.GetResMgr() ) )
,m_aNow ( this, ResId( RB_NOW, *_rResId.GetResMgr() ) )
,m_aLater ( this, ResId( RB_LATER, *_rResId.GetResMgr() ) )
,m_aNever ( this, ResId( RB_NEVER, *_rResId.GetResMgr() ) )
,m_aAlreadyDone ( this, ResId( RB_DONE, *_rResId.GetResMgr() ) )
,m_aSeparator ( this, ResId( FL_SEPARATOR, *_rResId.GetResMgr() ) )
,m_aOK ( this, ResId( BTN_OK, *_rResId.GetResMgr() ) )
,m_aHelp ( this, ResId( BTN_HELP, *_rResId.GetResMgr() ) )
{
if ( _bEvalVersion )
{ // if we're an eval version, we need to hide two of the options
m_aNever.Hide( );
m_aAlreadyDone.Hide( );
// make the explanatory text somewhat smaller
Size aIntroSize = m_aIntro.GetSizePixel();
aIntroSize.Height() = LogicToPixel( Size( 0, 18 ), MAP_APPFONT ).Height();
sal_Int32 nHeightDifference = m_aIntro.GetSizePixel().Height() - aIntroSize.Height();
m_aIntro.SetSizePixel( aIntroSize );
// resize the dialog, and move the controls below the ones we just hided
sal_Int32 nAlreadyDoneLower = m_aAlreadyDone.GetPosPixel().Y() + m_aAlreadyDone.GetSizePixel().Height();
sal_Int32 nLaterLower = m_aLater.GetPosPixel().Y() + m_aLater.GetSizePixel().Height();
sal_Int32 nDifference = nAlreadyDoneLower - nLaterLower;
sal_Int32 nOverallDifference = nDifference + nHeightDifference;
// move
Control* pVisibleRadios[] = { &m_aNow, &m_aLater, NULL };
lcl_moveControls( pVisibleRadios, -nHeightDifference );
Control* pControlsToMove[] = { &m_aSeparator, &m_aOK, &m_aHelp, NULL };
lcl_moveControls( pControlsToMove, -nOverallDifference );
// resize the dialog
Size aSize = GetSizePixel();
aSize.Height() -= nOverallDifference;
SetSizePixel( aSize );
}
else
{
// the explanatory text needs to be completed
String sCompleteIntro = m_aIntro.GetText( );
sCompleteIntro += String( ResId( STR_COMPLETE_INTRO, *_rResId.GetResMgr() ) );
m_aIntro.SetText( sCompleteIntro );
}
FreeResource();
m_aNow.Check( sal_True );
}
//--------------------------------------------------------------------
short RegistrationDialog::Execute()
{
short nResult = ModalDialog::Execute();
// as a default, assume that the user wants to be reminded
m_eResponse = urRegisterLater;
if ( RET_OK == nResult )
{
if ( m_aNow.IsChecked() )
m_eResponse = urRegisterNow;
else if ( m_aLater.IsChecked() )
m_eResponse = urRegisterLater;
else if ( m_aNever.IsChecked() )
m_eResponse = urRegisterNever;
else if ( m_aAlreadyDone.IsChecked() )
m_eResponse = urAlreadyRegistered;
#ifdef DBG_UTIL
else
{
OSL_FAIL( "RegistrationDialog::Execute: invalid dialog state!" );
}
#endif
}
return nResult;
}
//--------------------------------------------------------------------
long RegistrationDialog::PreNotify( NotifyEvent& rNEvt )
{
long nHandled;
if( rNEvt.GetType() == EVENT_KEYINPUT &&
rNEvt.GetKeyEvent()->GetCharCode() &&
rNEvt.GetKeyEvent()->GetKeyCode().GetCode() == KEY_ESCAPE)
{
EndDialog(RET_CANCEL);
nHandled = 1;
}
else
nHandled = ModalDialog::PreNotify( rNEvt );
return nHandled;
}
//........................................................................
} // namespace svt
//........................................................................
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef SVTOOLS_REGISTRATIONDLG_HRC
#define SVTOOLS_REGISTRATIONDLG_HRC
#define FI_LOGO 1
#define FT_INTRO 2
#define RB_NOW 3
#define RB_LATER 4
#define RB_NEVER 5
#define RB_DONE 6
#define FL_SEPARATOR 7
#define BTN_OK 8
#define BTN_HELP 9
#define STR_COMPLETE_INTRO 10
#endif // SVTOOLS_REGISTRATIONDLG_HRC
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef SVTOOLS_REGISTRATIONDLG_HXX
#define SVTOOLS_REGISTRATIONDLG_HXX
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
//........................................................................
namespace svt
{
//........................................................................
//====================================================================
//= RegistrationDialog
//====================================================================
class RegistrationDialog : public ModalDialog
{
public:
enum UserResponse
{
urRegisterNow,
urRegisterLater,
urRegisterNever,
urAlreadyRegistered
};
private:
UserResponse m_eResponse;
FixedImage m_aLogo;
FixedText m_aIntro;
RadioButton m_aNow;
RadioButton m_aLater;
RadioButton m_aNever;
RadioButton m_aAlreadyDone;
FixedLine m_aSeparator;
OKButton m_aOK;
HelpButton m_aHelp;
public:
RegistrationDialog( Window* _pWindow, const ResId& _rResId, bool _bEvalVersion );
virtual short Execute();
virtual long PreNotify( NotifyEvent& rNEvt );
inline UserResponse getResponse() const { return m_eResponse; }
};
//........................................................................
}// namespace svt
//........................................................................
#endif // SVTOOLS_REGISTRATIONDLG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#include "registrationdlg.hrc"
#include <svtools/svtools.hrc>
#include <svtools/helpid.hrc>
ModalDialog DLG_REGISTRATION_REQUEST
{
HelpID = HID_REGISTRATION_DIALOG;
Moveable = TRUE ;
Closeable = TRUE;
OutputSize = TRUE ;
Size = MAP_APPFONT ( 192 , 134 ) ;
Text [ en-US ] = "%PRODUCTNAME Registration";
FixedImage FI_LOGO
{
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 24 , 24 ) ;
Fixed = Image
{
ImageBitmap = Bitmap
{
File = "regkey.png" ;
};
MaskColor = Color { Red = 0x0000 ; Green = 0x0000 ; Blue = 0xFFFF ; };
};
};
FixedText FT_INTRO
{
Pos = MAP_APPFONT ( 33, 6 ) ;
Size = MAP_APPFONT ( 153 , 32 ) ;
WordBreak = TRUE;
Text [ en-US ] = "You now have the opportunity to register as a %PRODUCTNAME user." ;
};
String STR_COMPLETE_INTRO
{
Text [ en-US ] = " Registration is voluntary and is without obligation." ;
};
RadioButton RB_NOW
{
HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_NOW";
Pos = MAP_APPFONT ( 33 , 41 ) ;
Size = MAP_APPFONT ( 153 , 10 ) ;
Text [ en-US ] = "Register now" ;
};
RadioButton RB_LATER
{
HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_LATER";
Pos = MAP_APPFONT ( 33 , 54 ) ;
Size = MAP_APPFONT ( 153 , 10 ) ;
Text [ en-US ] = "Remind me to register later" ;
};
RadioButton RB_NEVER
{
HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_NEVER";
Pos = MAP_APPFONT ( 33 , 67 ) ;
Size = MAP_APPFONT ( 153 , 10 ) ;
Text [ en-US ] = "Never register" ;
};
RadioButton RB_DONE
{
HelpID = "svtools:RadioButton:DLG_REGISTRATION_REQUEST:RB_DONE";
Pos = MAP_APPFONT ( 33 , 80 ) ;
Size = MAP_APPFONT ( 153 , 20 ) ;
WordBreak = TRUE;
Text [ en-US ] = "Already registered as %PRODUCTNAME %PRODUCTVERSION user." ;
};
FixedLine FL_SEPARATOR
{
Pos = MAP_APPFONT ( 6, 107 ) ;
Size = MAP_APPFONT ( 180 , 1 ) ;
};
OKButton BTN_OK
{
Pos = MAP_APPFONT ( 80, 114 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
DefButton = TRUE;
};
HelpButton BTN_HELP
{
Pos = MAP_APPFONT ( 136, 114 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
};
};
ErrorBox ERRBOX_REG_NOSYSBROWSER
{
BUTTONS = WB_OK ;
DEFBUTTON = WB_DEF_OK ;
Message [ en-US ] = "An error occurred in starting the web browser.\nPlease check the %PRODUCTNAME and web browser settings.";
};
...@@ -598,7 +598,6 @@ ...@@ -598,7 +598,6 @@
../../svtools/source/filter.vcl/filter/dlgejpg.src ../../svtools/source/filter.vcl/filter/dlgejpg.src
../../svtools/source/filter.vcl/filter/strings.src ../../svtools/source/filter.vcl/filter/strings.src
../../svtools/source/Accessibility/accessiblelistboxentry.src ../../svtools/source/Accessibility/accessiblelistboxentry.src
../../svtools/source/productregistration/registrationdlg.src
../../svtools/source/plugapp/commtest.src ../../svtools/source/plugapp/commtest.src
../../svtools/source/plugapp/testtool.src ../../svtools/source/plugapp/testtool.src
../../fpicker/source/office/OfficeFilePicker.src ../../fpicker/source/office/OfficeFilePicker.src
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#ifndef VCL_WPROPSET_HXX
#define VCL_WPROPSET_HXX
#include "vcl/dllapi.h"
#include "tools/link.hxx"
#include "vcl/arrange.hxx"
#include "com/sun/star/beans/XPropertySet.hpp"
class VclWindowEvent;
namespace vcl
{
class WindowPropertySetData;
class WindowPropertySetListener;
class VCL_DLLPUBLIC WindowPropertySet
{
WindowPropertySetData* mpImpl;
void addWindowToSet( Window* );
void addLayoutToSet( const boost::shared_ptr<WindowArranger>& );
void setupProperties();
DECL_LINK( ChildEventListener, VclWindowEvent* );
void propertyChange( const com::sun::star::beans::PropertyChangeEvent& );
friend class vcl::WindowPropertySetListener;
public:
WindowPropertySet( Window* i_pTopWindow, bool i_bTakeOwnership );
~WindowPropertySet();
com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > getPropertySet() const;
};
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* 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.
*
* 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).
*
* 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.
*
************************************************************************/
#include "precompiled_vcl.hxx"
#include "vcl/wpropset.hxx"
#include "vcl/window.hxx"
#include "vcl/vclevent.hxx"
#include "svdata.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
#include "com/sun/star/beans/PropertyAttribute.hpp"
#include "com/sun/star/beans/XPropertySet.hpp"
#include "com/sun/star/beans/XPropertyContainer.hpp"
#include "com/sun/star/beans/XPropertyAccess.hpp"
#include "cppuhelper/basemutex.hxx"
#include "cppuhelper/compbase1.hxx"
#include <map>
using namespace vcl;
using namespace com::sun::star;
/*
TODO:
- release solarmutex during outside UNO calls
- in ChildEventListener protect against reentry by using PostUserEvent
*/
class vcl::WindowPropertySetListener :
public cppu::BaseMutex,
public cppu::WeakComponentImplHelper1< com::sun::star::beans::XPropertyChangeListener >,
private boost::noncopyable
{
WindowPropertySet* mpParent;
bool mbSuspended;
public:
WindowPropertySetListener( WindowPropertySet* pParent )
: cppu::WeakComponentImplHelper1< com::sun::star::beans::XPropertyChangeListener >( m_aMutex )
, mpParent( pParent )
, mbSuspended( false )
{}
virtual ~WindowPropertySetListener()
{
}
using cppu::WeakComponentImplHelperBase::disposing;
virtual void SAL_CALL disposing( const lang::EventObject& ) throw()
{
}
virtual void SAL_CALL propertyChange( const beans::PropertyChangeEvent& i_rEvent ) throw()
{
if( ! mbSuspended )
mpParent->propertyChange( i_rEvent );
}
void suspend( bool i_bSuspended )
{
mbSuspended = i_bSuspended;
}
};
class vcl::WindowPropertySetData
{
public:
struct PropertyMapEntry
{
Window* mpWindow;
boost::shared_ptr<WindowArranger> mpLayout;
uno::Sequence< beans::PropertyValue > maSavedValues;
PropertyMapEntry( Window* i_pWindow = NULL,
const boost::shared_ptr<WindowArranger>& i_pLayout = boost::shared_ptr<WindowArranger>() )
: mpWindow( i_pWindow )
, mpLayout( i_pLayout )
{}
uno::Sequence< beans::PropertyValue > getProperties() const
{
if( mpWindow )
return mpWindow->getProperties();
else if( mpLayout.get() )
return mpLayout->getProperties();
return uno::Sequence< beans::PropertyValue >();
}
void setProperties( const uno::Sequence< beans::PropertyValue >& i_rProps ) const
{
if( mpWindow )
mpWindow->setProperties( i_rProps );
else if( mpLayout.get() )
mpLayout->setProperties( i_rProps );
}
};
Window* mpTopWindow;
bool mbOwner;
std::map< rtl::OUString, PropertyMapEntry > maProperties;
uno::Reference< beans::XPropertySet > mxPropSet;
uno::Reference< beans::XPropertyAccess > mxPropSetAccess;
uno::Reference< beans::XPropertyChangeListener > mxListener;
vcl::WindowPropertySetListener* mpListener;
WindowPropertySetData()
: mpTopWindow( NULL )
, mbOwner( false )
, mpListener( NULL )
{}
~WindowPropertySetData()
{
// release layouters, possibly interface properties before destroying
// the involved parent to be on the safe side
maProperties.clear();
if( mbOwner )
delete mpTopWindow;
}
};
static rtl::OUString getIdentifiedPropertyName( const rtl::OUString& i_rIdentifier, const rtl::OUString& i_rName )
{
rtl::OUStringBuffer aBuf( i_rIdentifier.getLength() + 1 + i_rName.getLength() );
aBuf.append( i_rIdentifier );
aBuf.append( sal_Unicode( '#' ) );
aBuf.append( i_rName );
return aBuf.makeStringAndClear();
}
static void spliceIdentifiedPropertyName( const rtl::OUString& i_rIdentifiedPropName,
rtl::OUString& o_rIdentifier,
rtl::OUString& o_rPropName )
{
sal_Int32 nIndex = 0;
o_rIdentifier = i_rIdentifiedPropName.getToken( 0, sal_Unicode( '#' ), nIndex );
if( nIndex != -1 )
o_rPropName = i_rIdentifiedPropName.copy( nIndex );
else
o_rPropName = rtl::OUString();
}
WindowPropertySet::WindowPropertySet( Window* i_pTopWindow, bool i_bTakeOwnership )
: mpImpl( new vcl::WindowPropertySetData )
{
mpImpl->mpTopWindow = i_pTopWindow;
mpImpl->mbOwner = i_bTakeOwnership;
mpImpl->mpTopWindow->AddChildEventListener( LINK( this, WindowPropertySet, ChildEventListener ) );
mpImpl->mxPropSet = uno::Reference< beans::XPropertySet >(
ImplGetSVData()->maAppData.mxMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.PropertyBag" ) ) ),
uno::UNO_QUERY );
OSL_ENSURE( mpImpl->mxPropSet.is(), "could not create instance of com.sun.star.beans.PropertyBag" );
mpImpl->mxPropSetAccess = uno::Reference< beans::XPropertyAccess >( mpImpl->mxPropSet, uno::UNO_QUERY );
OSL_ENSURE( mpImpl->mxPropSet.is(), "could not query XPropertyAccess interface" );
if( ! mpImpl->mxPropSetAccess.is() )
mpImpl->mxPropSet.clear();
addWindowToSet( i_pTopWindow );
setupProperties();
if( mpImpl->mxPropSet.is() )
{
mpImpl->mxListener.set( mpImpl->mpListener = new WindowPropertySetListener( this ) );
}
}
WindowPropertySet::~WindowPropertySet()
{
mpImpl->mpTopWindow->RemoveChildEventListener( LINK( this, WindowPropertySet, ChildEventListener ) );
delete mpImpl;
mpImpl = NULL;
}
uno::Reference< beans::XPropertySet > WindowPropertySet::getPropertySet() const
{
return mpImpl->mxPropSet;
}
void WindowPropertySet::addLayoutToSet( const boost::shared_ptr< WindowArranger >& i_pLayout )
{
if( i_pLayout.get() )
{
if( i_pLayout->getIdentifier().getLength() )
{
WindowPropertySetData::PropertyMapEntry& rEntry = mpImpl->maProperties[ i_pLayout->getIdentifier() ];
OSL_ENSURE( rEntry.mpWindow == 0 && rEntry.mpLayout.get() == 0, "inserted layout has duplicate name" );
rEntry.mpWindow = NULL;
rEntry.mpLayout = i_pLayout;
rEntry.maSavedValues = i_pLayout->getProperties();
}
// insert child layouts
size_t nChildren = i_pLayout->countElements();
for( size_t i = 0; i < nChildren; i++ )
addLayoutToSet( i_pLayout->getChild( i ) );
}
}
void WindowPropertySet::addWindowToSet( Window* i_pWindow )
{
if( i_pWindow->getIdentifier().getLength() ) // no name, no properties
{
WindowPropertySetData::PropertyMapEntry& rEntry = mpImpl->maProperties[ i_pWindow->getIdentifier() ];
OSL_ENSURE( rEntry.mpWindow == 0 && rEntry.mpLayout.get() == 0, "inserted window has duplicate name" );
rEntry.mpWindow = i_pWindow;
rEntry.mpLayout.reset();
rEntry.maSavedValues = i_pWindow->getProperties();
}
addLayoutToSet( i_pWindow->getLayout() );
Window* pWin = i_pWindow->GetWindow( WINDOW_FIRSTCHILD );
while( pWin )
{
addWindowToSet( pWin );
pWin = pWin->GetWindow( WINDOW_NEXT );
}
}
void WindowPropertySet::setupProperties()
{
uno::Reference< beans::XPropertyContainer > xCont( mpImpl->mxPropSet, uno::UNO_QUERY );
OSL_ENSURE( xCont.is(), "could not get XPropertyContainer interface" );
if( ! xCont.is() )
return;
for( std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it
= mpImpl->maProperties.begin(); it != mpImpl->maProperties.end(); ++it )
{
uno::Sequence< beans::PropertyValue > aOutsideValues( it->second.maSavedValues );
beans::PropertyValue* pVal = aOutsideValues.getArray();
for( sal_Int32 i = 0; i < aOutsideValues.getLength(); i++ )
{
pVal[i].Name = getIdentifiedPropertyName( it->first, pVal[i].Name );
xCont->addProperty( pVal[i].Name,
beans::PropertyAttribute::BOUND | beans:: PropertyAttribute::CONSTRAINED,
pVal[i].Value
);
}
}
}
void WindowPropertySet::propertyChange( const beans::PropertyChangeEvent& i_rEvent )
{
rtl::OUString aIdentifier, aProperty;
spliceIdentifiedPropertyName( i_rEvent.PropertyName, aIdentifier, aProperty );
std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it =
mpImpl->maProperties.find( aIdentifier );
if( it != mpImpl->maProperties.end() )
{
uno::Sequence< beans::PropertyValue > aSet( 1 );
aSet[0].Name = aProperty;
aSet[0].Value = i_rEvent.NewValue;
it->second.setProperties( aSet );
}
}
IMPL_LINK( vcl::WindowPropertySet, ChildEventListener, VclWindowEvent*, pEvent )
{
// find window in our properties
std::map< rtl::OUString, WindowPropertySetData::PropertyMapEntry >::iterator it
= mpImpl->maProperties.find( pEvent->GetWindow()->getIdentifier() );
if( it != mpImpl->maProperties.end() ) // this is valid, some unnamed child may have sent an event
{
sal_uLong nId = pEvent->GetId();
// check if anything interesting happened
if(
// general windowy things
nId == VCLEVENT_WINDOW_SHOW ||
nId == VCLEVENT_WINDOW_HIDE ||
nId == VCLEVENT_WINDOW_ENABLED ||
nId == VCLEVENT_WINDOW_DISABLED ||
// button thingies
nId == VCLEVENT_BUTTON_CLICK ||
nId == VCLEVENT_PUSHBUTTON_TOGGLE ||
nId == VCLEVENT_RADIOBUTTON_TOGGLE ||
nId == VCLEVENT_CHECKBOX_TOGGLE ||
// listbox
nId == VCLEVENT_LISTBOX_SELECT ||
// edit
nId == VCLEVENT_EDIT_MODIFY
)
{
WindowPropertySetData::PropertyMapEntry& rEntry = it->second;
// collect changes
uno::Sequence< beans::PropertyValue > aNewProps( rEntry.getProperties() );
uno::Sequence< beans::PropertyValue > aNewPropsOut( aNewProps );
// translate to identified properties
beans::PropertyValue* pValues = aNewPropsOut.getArray();
for( sal_Int32 i = 0; i < aNewPropsOut.getLength(); i++ )
pValues[i].Name = getIdentifiedPropertyName( it->first, pValues[i].Name );
// broadcast changes
bool bWasVeto = false;
mpImpl->mpListener->suspend( true );
try
{
mpImpl->mxPropSetAccess->setPropertyValues( aNewPropsOut );
}
catch( beans::PropertyVetoException& )
{
bWasVeto = true;
}
mpImpl->mpListener->suspend( false );
if( ! bWasVeto ) // changes accepted ?
rEntry.maSavedValues = rEntry.getProperties();
else // no, reset
rEntry.setProperties( rEntry.maSavedValues );
}
}
return 0;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment