summaryrefslogtreecommitdiff
path: root/svtools/source/productregistration
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2005-04-27 10:14:42 +0000
committerOliver Bolte <obo@openoffice.org>2005-04-27 10:14:42 +0000
commit2c322e4aaec4dac3cb66267d032009bb6fa69c45 (patch)
treee781898fe584dd554664c087dd6db7072cd811fd /svtools/source/productregistration
parent607084467351805c01db4cf15875427dc1b019e2 (diff)
INTEGRATION: CWS mhu07 (1.1.2); FILE ADDED
2005/04/26 13:02:10 mhu 1.1.2.1: #i48107# Moved from svtools/source/dialogs/
Diffstat (limited to 'svtools/source/productregistration')
-rw-r--r--svtools/source/productregistration/registrationdlg.cxx212
-rw-r--r--svtools/source/productregistration/registrationdlg.hrc97
2 files changed, 309 insertions, 0 deletions
diff --git a/svtools/source/productregistration/registrationdlg.cxx b/svtools/source/productregistration/registrationdlg.cxx
new file mode 100644
index 000000000000..7244eab192ba
--- /dev/null
+++ b/svtools/source/productregistration/registrationdlg.cxx
@@ -0,0 +1,212 @@
+/*************************************************************************
+ *
+ * $RCSfile: registrationdlg.cxx,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obo $ $Date: 2005-04-27 11:14:32 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef SVTOOLS_REGISTRATIONDLG_HXX
+#include "registrationdlg.hxx"
+#endif
+
+#if 0 /* @@@ */
+#ifndef _SVTOOLS_SVTDATA_HXX
+#include "svtdata.hxx"
+#endif
+#ifndef _SVTOOLS_HRC
+#include "svtools.hrc"
+#endif
+#endif /* @@@ */
+
+#ifndef SVTOOLS_REGISTRATIONDLG_HRC
+#include "registrationdlg.hrc"
+#endif
+
+#ifndef _SV_MSGBOX_HXX
+#include <vcl/msgbox.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+//........................................................................
+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_aLogo ( this, ResId( FI_LOGO ) )
+ ,m_aIntro ( this, ResId( FT_INTRO ) )
+ ,m_aNow ( this, ResId( RB_NOW ) )
+ ,m_aLater ( this, ResId( RB_LATER ) )
+ ,m_aNever ( this, ResId( RB_NEVER ) )
+ ,m_aAlreadyDone ( this, ResId( RB_DONE ) )
+ ,m_aSeparator ( this, ResId( FL_SEPARATOR ) )
+ ,m_aOK ( this, ResId( BTN_OK ) )
+ ,m_aHelp ( this, ResId( BTN_HELP ) )
+ ,m_eResponse ( urRegisterLater )
+ {
+ 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 ) );
+ m_aIntro.SetText( sCompleteIntro );
+ }
+
+ FreeResource();
+
+ m_aNow.Check( 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
+ {
+ DBG_ERROR( "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
+//........................................................................
+
+
diff --git a/svtools/source/productregistration/registrationdlg.hrc b/svtools/source/productregistration/registrationdlg.hrc
new file mode 100644
index 000000000000..5ec89157f587
--- /dev/null
+++ b/svtools/source/productregistration/registrationdlg.hrc
@@ -0,0 +1,97 @@
+/*************************************************************************
+ *
+ * $RCSfile: registrationdlg.hrc,v $
+ *
+ * $Revision: 1.2 $
+ *
+ * last change: $Author: obo $ $Date: 2005-04-27 11:14:42 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 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
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc..
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#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
+
+/*************************************************************************
+ * history:
+ * $Log: not supported by cvs2svn $
+ * Revision 1.1.2.1 2005/04/26 13:02:10 mhu
+ * #i48107# Moved from svtools/source/dialogs/
+ *
+ * Revision 1.2 2003/06/10 14:36:12 vg
+ * INTEGRATION: CWS vcl11 (1.1.234); FILE MERGED
+ * 2003/06/03 07:02:51 fs 1.1.234.1: #110024# split up the explanatory into two parts
+ *
+ * Revision 1.1.234.1 2003/06/03 07:02:51 fs
+ * #110024# split up the explanatory into two parts
+ *
+ * Revision 1.1 2001/12/20 13:14:07 fs
+ * initial checkin - product registration dialog
+ *
+ *
+ * Revision 1.0 19.12.01 17:05:54 fs
+ ************************************************************************/
+