diff options
-rw-r--r-- | framework/Library_fwl.mk | 1 | ||||
-rw-r--r-- | framework/inc/classes/resource.hrc | 16 | ||||
-rw-r--r-- | framework/inc/services.h | 2 | ||||
-rw-r--r-- | framework/inc/services/license.hxx | 83 | ||||
-rw-r--r-- | framework/inc/services/licensedlg.hxx | 97 | ||||
-rw-r--r-- | framework/source/classes/resource.src | 149 | ||||
-rw-r--r-- | framework/source/register/registertemp.cxx | 2 | ||||
-rw-r--r-- | framework/source/services/license.cxx | 529 | ||||
-rw-r--r-- | framework/util/fwl.component | 3 |
9 files changed, 0 insertions, 882 deletions
diff --git a/framework/Library_fwl.mk b/framework/Library_fwl.mk index fe8744981c6a..a2b2b539d4a1 100644 --- a/framework/Library_fwl.mk +++ b/framework/Library_fwl.mk @@ -58,7 +58,6 @@ $(eval $(call gb_Library_add_exception_objects,fwl,\ framework/source/recording/dispatchrecordersupplier \ framework/source/register/registertemp \ framework/source/services/dispatchhelper \ - framework/source/services/license \ framework/source/services/mediatypedetectionhelper \ framework/source/services/uriabbreviation \ framework/source/uielement/fontmenucontroller \ diff --git a/framework/inc/classes/resource.hrc b/framework/inc/classes/resource.hrc index 673e90dcaaed..9c02511bc3cd 100644 --- a/framework/inc/classes/resource.hrc +++ b/framework/inc/classes/resource.hrc @@ -60,22 +60,6 @@ #define MENUITEM_TOOLBAR_LOCKTOOLBARPOSITION 5 #define MENUITEM_TOOLBAR_CLOSE 6 -// License Dialog -#define DLG_LICENSE (RID_FWK_DIALOG_START+256) -#define ML_LICENSE (RID_FWK_DIALOG_START+11) -#define FT_INFO1 (RID_FWK_DIALOG_START+12) -#define FT_INFO2 (RID_FWK_DIALOG_START+13) -#define FT_INFO3 (RID_FWK_DIALOG_START+14) -#define FT_INFO2_1 (RID_FWK_DIALOG_START+15) -#define FT_INFO3_1 (RID_FWK_DIALOG_START+16) -#define FL_DIVIDE (RID_FWK_DIALOG_START+17) -#define PB_PAGEDOWN (RID_FWK_DIALOG_START+18) -#define IMG_ARROW (RID_FWK_DIALOG_START+19) -#define LICENSE_ACCEPT (RID_FWK_DIALOG_START+20) -#define LICENSE_NOTACCEPT (RID_FWK_DIALOG_START+21) -#define PB_DECLINE (RID_FWK_DIALOG_START+22) -#define PB_ACCEPT (RID_FWK_DIALOG_START+23) - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/services.h b/framework/inc/services.h index 2ae3e0161bc8..f7ccaadefcde 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -39,7 +39,6 @@ namespace framework{ #define SERVICENAME_MENUBARFACTORY DECLARE_ASCII("com.sun.star.ui.UIElementFactory" ) #define SERVICENAME_TOOLBARFACTORY DECLARE_ASCII("com.sun.star.ui.ToolBarFactory" ) #define SERVICENAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.ToolbarControllerFactory" ) -#define SERVICENAME_LICENSE SERVICENAME_JOB #define SERVICENAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.ui.StatusBarFactory" ) #define SERVICENAME_STATUSBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.frame.StatusbarControllerFactory" ) #define SERVICENAME_STATUSBARCONTROLLER DECLARE_ASCII("com.sun.star.frame.StatusbarController" ) @@ -86,7 +85,6 @@ namespace framework{ #define IMPLEMENTATIONNAME_ADDONSTOOLBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.AddonsToolBarFactory" ) #define IMPLEMENTATIONNAME_TOOLBARSMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.ToolBarsMenuController" ) #define IMPLEMENTATIONNAME_TOOLBARCONTROLLERFACTORY DECLARE_ASCII("com.sun.star.comp.framework.ToolBarControllerFactory" ) -#define IMPLEMENTATIONNAME_LICENSE DECLARE_ASCII("com.sun.star.comp.framework.License" ) #define IMPLEMENTATIONNAME_AUTORECOVERY DECLARE_ASCII("com.sun.star.comp.framework.AutoRecovery" ) #define IMPLEMENTATIONNAME_RECENTFILESMENUCONTROLLER DECLARE_ASCII("com.sun.star.comp.framework.RecentFilesMenuController" ) #define IMPLEMENTATIONNAME_STATUSBARFACTORY DECLARE_ASCII("com.sun.star.comp.framework.StatusBarFactory" ) diff --git a/framework/inc/services/license.hxx b/framework/inc/services/license.hxx deleted file mode 100644 index b83838769694..000000000000 --- a/framework/inc/services/license.hxx +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_LICENSE_HXX -#define INCLUDED_FRAMEWORK_INC_SERVICES_LICENSE_HXX - -/** Attention: stl headers must(!) be included at first. Otherwise it can make trouble - with solaris headers ... -*/ -#include <vector> - -#include <threadhelp/threadhelpbase.hxx> -#include <threadhelp/resetableguard.hxx> -#include <threadhelp/writeguard.hxx> -#include <threadhelp/readguard.hxx> -#include <macros/generic.hxx> -#include <macros/xinterface.hxx> -#include <macros/xtypeprovider.hxx> -#include <macros/xserviceinfo.hxx> -#include <properties.h> -#include <stdtypes.h> -#include <uielement/menubarmanager.hxx> - -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/lang/XTypeProvider.hpp> -#include <com/sun/star/task/XJob.hpp> -#include <com/sun/star/util/XCloseable.hpp> -#include <com/sun/star/util/CloseVetoException.hpp> - -#include <cppuhelper/implbase3.hxx> -#include <cppuhelper/propshlp.hxx> - -namespace framework -{ - class License : // base classes - // Order is necessary for right initialization! - private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. - public cppu::WeakImplHelper3< - css::lang::XServiceInfo, - css::task::XJob, - css::util::XCloseable> // => XWeak, XInterface - { - private: - css::uno::Reference< css::uno::XComponentContext > m_xContext; - sal_Bool m_bTerminate; - public: - License( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >& rxContext ); - virtual ~License(); - - /** declaration of XInterface, XTypeProvider, XServiceInfo */ - DECLARE_XSERVICEINFO - - virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence<css::beans::NamedValue>& args) - throw( css::lang::IllegalArgumentException, css::uno::Exception, std::exception); - - virtual void SAL_CALL close(sal_Bool bDeliverOwnership) throw (css::util::CloseVetoException, std::exception); - - virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener >& aListener) throw (css::uno::RuntimeException, std::exception); - virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener >& aListener) throw (css::uno::RuntimeException, std::exception); - -}; - -} // namespace framework - -#endif // INCLUDED_FRAMEWORK_INC_SERVICES_LICENSE_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/services/licensedlg.hxx b/framework/inc/services/licensedlg.hxx deleted file mode 100644 index ccd5bb4a5159..000000000000 --- a/framework/inc/services/licensedlg.hxx +++ /dev/null @@ -1,97 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_FRAMEWORK_INC_SERVICES_LICENSEDLG_HXX -#define INCLUDED_FRAMEWORK_INC_SERVICES_LICENSEDLG_HXX - -#include <sal/types.h> -#include <rtl/string.hxx> -#include <rtl/ustring.hxx> -#include <rtl/ustrbuf.hxx> -#include <tools/resmgr.hxx> -#include <vcl/button.hxx> -#include <vcl/edit.hxx> -#include <vcl/fixed.hxx> -#include <vcl/dialog.hxx> -#include <vcl/scrbar.hxx> -#include <svtools/svmedit.hxx> -#include <svl/lstner.hxx> - -namespace framework { - -class LicenseView : public MultiLineEdit, public SfxListener -{ - sal_Bool mbEndReached; - Link maEndReachedHdl; - Link maScrolledHdl; - -public: - LicenseView( Window* pParent, const ResId& rResId ); - ~LicenseView(); - - void ScrollDown( ScrollType eScroll ); - - sal_Bool IsEndReached() const; - sal_Bool EndReached() const { return mbEndReached; } - void SetEndReached( sal_Bool bEnd ) { mbEndReached = bEnd; } - - void SetEndReachedHdl( const Link& rHdl ) { maEndReachedHdl = rHdl; } - const Link& GetAutocompleteHdl() const { return maEndReachedHdl; } - - void SetScrolledHdl( const Link& rHdl ) { maScrolledHdl = rHdl; } - const Link& GetScrolledHdl() const { return maScrolledHdl; } - - using MultiLineEdit::Notify; - virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); -}; - -class LicenseDialog : public ModalDialog -{ - LicenseView aLicenseML; - FixedText aInfo1FT; - FixedText aInfo2FT; - FixedText aInfo3FT; - FixedText aInfo2_1FT; - FixedText aInfo3_1FT; - FixedLine aFixedLine; - PushButton aPBPageDown; - PushButton aPBDecline; - PushButton aPBAccept; - FixedImage aArrow; - OUString aStrAccept; - OUString aStrNotAccept; - OUString aOldCancelText; - sal_Bool bEndReached; - - void EnableControls(); - - DECL_LINK(PageDownHdl, void *); - DECL_LINK(EndReachedHdl, void *); - DECL_LINK(ScrolledHdl, void *); - DECL_LINK(AcceptBtnHdl, void *); - DECL_LINK(DeclineBtnHdl, void *); - - public: - LicenseDialog(const OUString& aLicense, ResMgr *pResMgr); - virtual ~LicenseDialog(); - -}; -} -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/source/classes/resource.src b/framework/source/classes/resource.src index 54e3cc42396d..1f4f5df0a911 100644 --- a/framework/source/classes/resource.src +++ b/framework/source/classes/resource.src @@ -119,155 +119,6 @@ String STR_TOOLBAR_TITLE_ADDON Text [ en-US ] = "Add-On %num%"; }; -// *********************************************************************** -// License Dialog -// *********************************************************************** -#define LICENSE_DIALOG_WIDTH 260 -#define LICENSE_RIGHT_BORDER 7 -#define LICENSE_ROW_1 (7) -#define LICENSE_COL_1 (7) - -#define OFFSET 2 -#define COL2_WIDTH 10 -#define OFFSET_IMG 10 -#define FT_HEIGHT 8 -#define PB_HEIGHT 14 -#define PD_WIDTH 40 - -#define LICENSE_HEIGHT 102 -#define LICENSE_ROW_2 (LICENSE_ROW_1 + OFFSET + LICENSE_HEIGHT) -#define LICENSE_ROW_3 (LICENSE_ROW_2 + OFFSET + FT_HEIGHT) -#define LICENSE_ROW_4 (LICENSE_ROW_3 + OFFSET + 3*FT_HEIGHT ) -#define LICENSE_ROW_5 (LICENSE_ROW_4 + FT_HEIGHT+ OFFSET ) -#define LICENSE_ROW_6 (LICENSE_ROW_5 + 2*OFFSET ) - -#define LICENSE_DIALOG_HEIGHT (LICENSE_ROW_6 + + PB_HEIGHT + 7) - -#define LICENSE_COL_2 (LICENSE_COL_1 + OFFSET_IMG) -#define LICENSE_COL_3 (LICENSE_COL_2 + COL2_WIDTH +1) -#define LICENSE_COL_4 (LICENSE_DIALOG_WIDTH - LICENSE_RIGHT_BORDER - PD_WIDTH) - -#define LICENSE_WIDTH (LICENSE_DIALOG_WIDTH - LICENSE_RIGHT_BORDER - LICENSE_ROW_1) -#define COL3_WIDTH (LICENSE_COL_4 - LICENSE_COL_3) - - -ModalDialog DLG_LICENSE -{ - HelpId = HID_LICENSEDIALOG; - Moveable = TRUE ; - Closeable = TRUE ; - OutputSize = TRUE ; - SVLook = TRUE ; - Hide = TRUE ; - Size = MAP_APPFONT ( LICENSE_DIALOG_WIDTH , LICENSE_DIALOG_HEIGHT ) ; - Text [ en-US ] = "License Agreement"; - - MultiLineEdit ML_LICENSE - { - HelpID = "framework:MultiLineEdit:DLG_LICENSE:ML_LICENSE"; - PosSize = MAP_APPFONT ( LICENSE_COL_1 , LICENSE_ROW_1 , LICENSE_WIDTH , LICENSE_HEIGHT ) ; - Border = TRUE ; - VScroll = TRUE ; - ReadOnly = TRUE ; - }; - - FixedText FT_INFO1 - { - WordBreak = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_1 , LICENSE_ROW_2 ) ; - Size = MAP_APPFONT ( LICENSE_WIDTH , FT_HEIGHT ) ; - Text [ en-US ] = "Please follow these steps to proceed with the installation:" ; - }; - - FixedImage IMG_ARROW - { - Pos = MAP_APPFONT ( LICENSE_COL_1 , LICENSE_ROW_3 ) ; - Size = MAP_PIXEL ( 16 , 16 ) ; - Fixed = Image - { - ImageBitmap = Bitmap - { - File = "arrow.bmp" ; - }; - MaskColor = Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - }; - }; - - FixedText FT_INFO2_1 - { - WordBreak = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_2 , LICENSE_ROW_3 ) ; - Size = MAP_APPFONT ( COL2_WIDTH , FT_HEIGHT ) ; - Text [ en-US ] = "1." ; - }; - - FixedText FT_INFO2 - { - WordBreak = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_3 , LICENSE_ROW_3 ) ; - Size = MAP_APPFONT ( COL3_WIDTH, 3*FT_HEIGHT ) ; - Text [ en-US ] = "View the complete License Agreement. Please use the scroll bar or the '%PAGEDOWN' button in this dialog to view the entire license text." ; - }; - - PushButton PB_PAGEDOWN - { - HelpID = "framework:PushButton:DLG_LICENSE:PB_PAGEDOWN"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_4 , LICENSE_ROW_3 ) ; - Size = MAP_APPFONT ( PD_WIDTH , PB_HEIGHT ) ; - Text [ en-US ] = "Scroll Down" ; - }; - - FixedText FT_INFO3_1 - { - WordBreak = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_2 , LICENSE_ROW_4 ) ; - Size = MAP_APPFONT ( COL2_WIDTH, FT_HEIGHT ) ; - Text [ en-US ] = "2." ; - }; - - FixedText FT_INFO3 - { - WordBreak = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_3, LICENSE_ROW_4 ) ; - Size = MAP_APPFONT ( COL3_WIDTH, FT_HEIGHT ) ; - Text [ en-US ] = "Accept the License Agreement." ; - }; - - String LICENSE_ACCEPT - { - Text [ en-US ] = "~Accept" ; - }; - - String LICENSE_NOTACCEPT - { - Text [ en-US ] = "Decline" ; - }; - - FixedLine FL_DIVIDE - { - Pos = MAP_APPFONT ( LICENSE_COL_1, LICENSE_ROW_5 ) ; - Size = MAP_APPFONT ( LICENSE_WIDTH, 1 ) ; - }; - - PushButton PB_ACCEPT - { - HelpID = "framework:PushButton:DLG_LICENSE:PB_ACCEPT"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_4 - PD_WIDTH - OFFSET_IMG , LICENSE_ROW_6 ) ; - Size = MAP_APPFONT ( PD_WIDTH , PB_HEIGHT ) ; - }; - - PushButton PB_DECLINE - { - HelpID = "framework:PushButton:DLG_LICENSE:PB_DECLINE"; - TabStop = TRUE ; - Pos = MAP_APPFONT ( LICENSE_COL_4 , LICENSE_ROW_6 ) ; - Size = MAP_APPFONT ( PD_WIDTH , PB_HEIGHT ) ; - }; - -}; - String STR_FULL_DISC_RETRY_BUTTON { Text [ en-US ] = "Retry" ; diff --git a/framework/source/register/registertemp.cxx b/framework/source/register/registertemp.cxx index 703e79ef8f98..e02195c253f0 100644 --- a/framework/source/register/registertemp.cxx +++ b/framework/source/register/registertemp.cxx @@ -40,7 +40,6 @@ #include <services/dispatchhelper.hxx> #include <recording/dispatchrecorder.hxx> #include <recording/dispatchrecordersupplier.hxx> -#include <services/license.hxx> #include <services/uriabbreviation.hxx> #include <uielement/fontmenucontroller.hxx> #include <uielement/fontsizemenucontroller.hxx> @@ -55,7 +54,6 @@ COMPONENTGETFACTORY ( fwl, IFFACTORY( ::framework::MediaTypeDetectionHelper ) IFFACTORY( ::framework::MailToDispatcher ) else IFFACTORY( ::framework::ServiceHandler ) else - IFFACTORY( ::framework::License ) else IFFACTORY( ::framework::PopupMenuDispatcher ) else IFFACTORY( ::framework::DispatchHelper ) else IFFACTORY( ::framework::DispatchRecorder ) else diff --git a/framework/source/services/license.cxx b/framework/source/services/license.cxx deleted file mode 100644 index bcde6a97300f..000000000000 --- a/framework/source/services/license.cxx +++ /dev/null @@ -1,529 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 . - */ - -#include <config_folders.h> - -#include <services/license.hxx> -#include <threadhelp/resetableguard.hxx> -#include <services.h> - -// local header for UI implementation -#include "services/licensedlg.hxx" -#include "classes/resource.hrc" - -#include <com/sun/star/frame/XDesktop.hpp> -#include <com/sun/star/lang/XInitialization.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/configuration/theDefaultProvider.hpp> -#include <com/sun/star/uno/Any.hxx> -#include <com/sun/star/util/XChangesBatch.hpp> -#include <com/sun/star/office/Quickstart.hpp> -#include <com/sun/star/beans/NamedValue.hpp> -#include <com/sun/star/lang/XComponent.hpp> - -#include <rtl/ustrbuf.hxx> -#include <rtl/strbuf.hxx> -#include <rtl/ustring.hxx> -#include <rtl/string.hxx> -#include <unotools/bootstrap.hxx> -#include <osl/file.hxx> -#include <vcl/xtextedt.hxx> -#include <vcl/svapp.hxx> -#include <vcl/settings.hxx> -#include <comphelper/processfactory.hxx> -#include <tools/date.hxx> -#include <tools/time.hxx> -#include <tools/datetime.hxx> -#include <osl/time.h> - -#include <boost/scoped_ptr.hpp> - -namespace framework{ -using namespace utl; -using namespace ::osl ; -using namespace ::cppu ; -using namespace ::com::sun::star::uno ; -using namespace ::com::sun::star::beans ; -using namespace ::com::sun::star::configuration ; -using namespace ::com::sun::star::lang ; -using namespace ::com::sun::star::util ; -using namespace ::com::sun::star::frame ; - -using ::Date; -using ::Time; -using ::DateTime; - -// license file name -static const char *szLicensePath = "/" LIBO_SHARE_FOLDER "/readme"; -#ifdef UNX -static const char *szUNXLicenseName = "/LICENSE"; -static const char *szUNXLicenseExt = ""; -#elif defined(WNT) -static const char *szWNTLicenseName = "/license"; -static const char *szWNTLicenseExt = ".txt"; -#endif - - -// constructor - -License::License( const Reference< XComponentContext >& rxContext ) - // Init baseclasses first - // Attention: - // Don't change order of initialization! - // ThreadHelpBase is a struct with a mutex as member. We can't use a mutex as member, while - // we must garant right initialization and a valid value of this! First initialize - // baseclasses and then members. And we need the mutex for other baseclasses !!! - : ThreadHelpBase ( &Application::GetSolarMutex() ) - // Init member - , m_xContext ( rxContext ) - , m_bTerminate ( sal_False ) -{ -} - - -// destructor - -License::~License() -{ -} - - -// XInterface, XTypeProvider, XServiceInfo - - -DEFINE_XSERVICEINFO_MULTISERVICE_2 ( License, - OWeakObject , - SERVICENAME_LICENSE , - IMPLEMENTATIONNAME_LICENSE - ) - -DEFINE_INIT_SERVICE ( License, - { - } - ) - - - -static DateTime _oslDateTimeToDateTime(const oslDateTime& aDateTime) -{ - return DateTime( - Date(aDateTime.Day, aDateTime.Month, aDateTime.Year), - Time(aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds)); -} - -static OUString _makeDateTimeString (const DateTime& aDateTime, sal_Bool bUTC = sal_False) -{ - OStringBuffer aDateTimeString; - aDateTimeString.append((sal_Int32)aDateTime.GetYear()); - aDateTimeString.append("-"); - if (aDateTime.GetMonth()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetMonth()); - aDateTimeString.append("-"); - if (aDateTime.GetDay()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetDay()); - aDateTimeString.append("T"); - if (aDateTime.GetHour()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetHour()); - aDateTimeString.append(":"); - if (aDateTime.GetMin()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetMin()); - aDateTimeString.append(":"); - if (aDateTime.GetSec()<10) aDateTimeString.append("0"); - aDateTimeString.append((sal_Int32)aDateTime.GetSec()); - if (bUTC) aDateTimeString.append("Z"); - - return OStringToOUString(aDateTimeString.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); -} - -static sal_Bool _parseDateTime(const OUString& aString, DateTime& aDateTime) -{ - // take apart a canonical literal xsd:dateTime string - //CCYY-MM-DDThh:mm:ss(Z) - - OUString aDateTimeString = aString.trim(); - - // check length - if (aDateTimeString.getLength() < 19 || aDateTimeString.getLength() > 20) - return sal_False; - - sal_Int32 nDateLength = 10; - sal_Int32 nTimeLength = 8; - - OUString aUTCString("Z"); - - OUString aDateString = aDateTimeString.copy(0, nDateLength); - OUString aTimeString = aDateTimeString.copy(nDateLength+1, nTimeLength); - - sal_Int32 nIndex = 0; - sal_Int32 nYear = aDateString.getToken(0, '-', nIndex).toInt32(); - sal_Int32 nMonth = aDateString.getToken(0, '-', nIndex).toInt32(); - sal_Int32 nDay = aDateString.getToken(0, '-', nIndex).toInt32(); - nIndex = 0; - sal_Int32 nHour = aTimeString.getToken(0, ':', nIndex).toInt32(); - sal_Int32 nMinute = aTimeString.getToken(0, ':', nIndex).toInt32(); - sal_Int32 nSecond = aTimeString.getToken(0, ':', nIndex).toInt32(); - - Date tmpDate((sal_uInt16)nDay, (sal_uInt16)nMonth, (sal_uInt16)nYear); - Time tmpTime(nHour, nMinute, nSecond); - DateTime tmpDateTime(tmpDate, tmpTime); - if (aString.indexOf(aUTCString) < 0) - tmpDateTime.ConvertToUTC(); - - aDateTime = tmpDateTime; - return sal_True; -} - -static OUString _getCurrentDateString() -{ - return _makeDateTimeString(DateTime( DateTime::SYSTEM)); -} - -// execution of license check... -css::uno::Any SAL_CALL License::execute(const css::uno::Sequence< css::beans::NamedValue >& ) - throw( css::lang::IllegalArgumentException, css::uno::Exception, std::exception) -{ - // return value - Any aRet; aRet <<= sal_False; - - try - { - OUString aBaseInstallPath; - Bootstrap::PathStatus aBaseLocateResult = - Bootstrap::locateBaseInstallation(aBaseInstallPath); - if (aBaseLocateResult != Bootstrap::PATH_EXISTS) - { - aRet <<= sal_False; - return aRet; - } - - // determine the filename of the license to show - OUString aLangString( Application::GetSettings().GetUILanguageTag().getBcp47()); -#if defined(WNT) - OUString aLicensePath = - aBaseInstallPath + OUString::createFromAscii(szLicensePath) - + OUString::createFromAscii(szWNTLicenseName) - + "_" - + aLangString - + OUString::createFromAscii(szWNTLicenseExt); -#else - OUString aLicensePath = - aBaseInstallPath + OUString::createFromAscii(szLicensePath) - + OUString::createFromAscii(szUNXLicenseName) - + "_" - + aLangString - + OUString::createFromAscii(szUNXLicenseExt); -#endif - // check if we need to show the license at all - // open org.openoffice.Setup/Office/ooLicenseAcceptDate - OUString sAccessSrvc("com.sun.star.configuration.ConfigurationUpdateAccess"); - - // get configuration provider - Reference< XMultiServiceFactory > theConfigProvider = theDefaultProvider::get( m_xContext ); - Sequence< Any > theArgs(1); - NamedValue v; - v.Name = "NodePath"; - v.Value <<= OUString("org.openoffice.Setup/Office"); - theArgs[0] <<= v; - Reference< XPropertySet > pset = Reference< XPropertySet >( - theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); - - // if we find a date there, compare it to baseinstall license date - OUString aAcceptDate; - if (pset->getPropertyValue("ooLicenseAcceptDate") >>= aAcceptDate) - { - // get LicenseFileDate from base install - OUString aLicenseURL = aLicensePath; - DirectoryItem aDirItem; - if (DirectoryItem::get(aLicenseURL, aDirItem) != FileBase::E_None) - return makeAny(sal_False); - FileStatus aStatus(osl_FileStatus_Mask_All); - if (aDirItem.getFileStatus(aStatus) != FileBase::E_None) - return makeAny(sal_False); - TimeValue aTimeVal = aStatus.getModifyTime(); - oslDateTime aDateTimeVal; - if (!osl_getDateTimeFromTimeValue(&aTimeVal, &aDateTimeVal)) - return makeAny(sal_False); - - // compare dates - DateTime aLicenseDateTime = _oslDateTimeToDateTime(aDateTimeVal); - DateTime aAcceptDateTime( DateTime::EMPTY); - if (!_parseDateTime(aAcceptDate, aAcceptDateTime)) - return makeAny(sal_False); - - if ( aAcceptDateTime > aLicenseDateTime ) - return makeAny(sal_True); - } - // prepare to show - // display license dialog - LanguageTag aLanguageTag( Application::GetSettings().GetUILanguageTag()); - boost::scoped_ptr<ResMgr> pResMgr( ResMgr::SearchCreateResMgr("fwe", aLanguageTag)); - boost::scoped_ptr<LicenseDialog> pDialog(new LicenseDialog(aLicensePath, pResMgr.get())); - sal_Bool bAgreed = (pDialog->Execute() == 1); - - if (bAgreed) { - - // write org.openoffice.Setup/ooLicenseAcceptDate - aAcceptDate = _getCurrentDateString(); - pset->setPropertyValue("ooLicenseAcceptDate", makeAny(aAcceptDate)); - Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); - - // enable quickstarter - - Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); - css::office::Quickstart::createAutoStart(xContext, true/*Quickstart*/, true/*Autostart*/); - - aRet <<= sal_True; - } - else - { - aRet <<= sal_False; - } - } - catch (const RuntimeException&) - { - // license could not be verified - aRet <<= sal_False; - } - return aRet; -} - -void SAL_CALL License::close(sal_Bool /*bDeliverOwnership*/) throw (css::util::CloseVetoException, std::exception) -{ - if (!m_bTerminate) - throw CloseVetoException(); -} -void SAL_CALL License::addCloseListener(const css::uno::Reference< css::util::XCloseListener >&) - throw (css::uno::RuntimeException, std::exception) -{ -} -void SAL_CALL License::removeCloseListener(const css::uno::Reference< css::util::XCloseListener >&) - throw (css::uno::RuntimeException, std::exception) -{ -} - - - -// License Dialog - - -LicenseDialog::LicenseDialog(const OUString & aLicensePath, ResMgr *pResMgr) : - ModalDialog(NULL, ResId(DLG_LICENSE, *pResMgr)), - aLicenseML(this, ResId(ML_LICENSE, *pResMgr)), - aInfo1FT(this, ResId(FT_INFO1, *pResMgr)), - aInfo2FT(this, ResId(FT_INFO2, *pResMgr)), - aInfo3FT(this, ResId(FT_INFO3, *pResMgr)), - aInfo2_1FT(this, ResId(FT_INFO2_1, *pResMgr)), - aInfo3_1FT(this, ResId(FT_INFO3_1, *pResMgr)), - aFixedLine(this, ResId(FL_DIVIDE, *pResMgr)), - aPBPageDown(this, ResId(PB_PAGEDOWN, *pResMgr)), - aPBDecline( this, ResId(PB_DECLINE, *pResMgr) ), - aPBAccept( this, ResId(PB_ACCEPT, *pResMgr) ), - aArrow(this, ResId(IMG_ARROW, *pResMgr)), - aStrAccept( ResId(LICENSE_ACCEPT, *pResMgr) ), - aStrNotAccept( ResId(LICENSE_NOTACCEPT, *pResMgr) ), - bEndReached(sal_False) -{ - FreeResource(); - - aLicenseML.SetEndReachedHdl( LINK(this, LicenseDialog, EndReachedHdl) ); - aLicenseML.SetScrolledHdl( LINK(this, LicenseDialog, ScrolledHdl) ); - - aPBPageDown.SetClickHdl( LINK(this, LicenseDialog, PageDownHdl) ); - aPBDecline.SetClickHdl( LINK(this, LicenseDialog, DeclineBtnHdl) ); - aPBAccept.SetClickHdl( LINK(this, LicenseDialog, AcceptBtnHdl) ); - - // We want a automatic repeating page down button - WinBits aStyle = aPBPageDown.GetStyle(); - aStyle |= WB_REPEAT; - aPBPageDown.SetStyle( aStyle ); - - OUString aText = aInfo2FT.GetText(); - aText = aText.replaceAll( "%PAGEDOWN", aPBPageDown.GetText() ); - aInfo2FT.SetText( aText ); - - aPBDecline.SetText( aStrNotAccept ); - aPBAccept.SetText( aStrAccept ); - - aPBAccept.Disable(); - - // load license text - File aLicenseFile(aLicensePath); - if ( aLicenseFile.open(osl_File_OpenFlag_Read) == FileBase::E_None) - { - DirectoryItem d; - DirectoryItem::get(aLicensePath, d); - FileStatus fs(osl_FileStatus_Mask_FileSize); - d.getFileStatus(fs); - sal_uInt64 nBytesRead = 0; - sal_uInt64 nPosition = 0; - sal_uInt32 nBytes = (sal_uInt32)fs.getFileSize(); - sal_Char *pBuffer = new sal_Char[nBytes]; - while (aLicenseFile.read(pBuffer+nPosition, nBytes-nPosition, nBytesRead) == FileBase::E_None - && nPosition + nBytesRead < nBytes) - { - nPosition += nBytesRead; - } - OUString aLicenseString(pBuffer, nBytes, RTL_TEXTENCODING_UTF8, - OSTRING_TO_OUSTRING_CVTFLAGS | RTL_TEXTTOUNICODE_FLAGS_GLOBAL_SIGNATURE); - delete[] pBuffer; - aLicenseML.SetText(aLicenseString); - } - -} - -LicenseDialog::~LicenseDialog() -{ -} - -IMPL_LINK_NOARG(LicenseDialog, PageDownHdl) -{ - aLicenseML.ScrollDown( SCROLL_PAGEDOWN ); - return 0; -} - -IMPL_LINK_NOARG(LicenseDialog, EndReachedHdl) -{ - bEndReached = sal_True; - - EnableControls(); - - return 0; -} - -IMPL_LINK_NOARG(LicenseDialog, ScrolledHdl) -{ - EnableControls(); - - return 0; -} - -IMPL_LINK_NOARG(LicenseDialog, DeclineBtnHdl) -{ - EndDialog(0); - return 0; -} -IMPL_LINK_NOARG(LicenseDialog, AcceptBtnHdl) -{ - EndDialog(1); - return 0; -} - - -void LicenseDialog::EnableControls() -{ - if( !bEndReached && - ( aLicenseML.IsEndReached() || aLicenseML.GetText().isEmpty() ) ) - bEndReached = sal_True; - - if ( bEndReached ) - { - Point aPos( aInfo1FT.GetPosPixel().X(), - aInfo3_1FT.GetPosPixel().Y() ); - aArrow.SetPosPixel( aPos ); - aPBAccept.Enable(); - } - else - { - Point aPos( aInfo1FT.GetPosPixel().X(), - aInfo2_1FT.GetPosPixel().Y() ); - aArrow.SetPosPixel( aPos ); - aPBAccept.Disable(); - } - - if ( aLicenseML.IsEndReached() ) - aPBPageDown.Disable(); - else - aPBPageDown.Enable(); - -} - - -LicenseView::LicenseView( Window* pParent, const ResId& rResId ) - : MultiLineEdit( pParent, rResId ) -{ - SetLeftMargin( 5 ); - - mbEndReached = IsEndReached(); - - StartListening( *GetTextEngine() ); -} - -LicenseView::~LicenseView() -{ - maEndReachedHdl = Link(); - maScrolledHdl = Link(); - - EndListeningAll(); -} - -void LicenseView::ScrollDown( ScrollType eScroll ) -{ - ScrollBar* pScroll = GetVScrollBar(); - - if ( pScroll ) - pScroll->DoScrollAction( eScroll ); -} - -sal_Bool LicenseView::IsEndReached() const -{ - sal_Bool bEndReached; - - ExtTextView* pView = GetTextView(); - ExtTextEngine* pEdit = GetTextEngine(); - sal_uLong nHeight = pEdit->GetTextHeight(); - Size aOutSize = pView->GetWindow()->GetOutputSizePixel(); - Point aBottom( 0, aOutSize.Height() ); - - if ( (sal_uLong) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 ) - bEndReached = sal_True; - else - bEndReached = sal_False; - - return bEndReached; -} - -void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint ) -{ - if ( rHint.IsA( TYPE(TextHint) ) ) - { - sal_Bool bLastVal = EndReached(); - sal_uLong nId = ((const TextHint&)rHint).GetId(); - - if ( nId == TEXT_HINT_PARAINSERTED ) - { - if ( bLastVal ) - mbEndReached = IsEndReached(); - } - else if ( nId == TEXT_HINT_VIEWSCROLLED ) - { - if ( ! mbEndReached ) - mbEndReached = IsEndReached(); - maScrolledHdl.Call( this ); - } - - if ( EndReached() && !bLastVal ) - { - maEndReachedHdl.Call( this ); - } - } -} - -} // namespace framework - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/util/fwl.component b/framework/util/fwl.component index 9583b17f070c..b0350833c2da 100644 --- a/framework/util/fwl.component +++ b/framework/util/fwl.component @@ -40,9 +40,6 @@ <implementation name="com.sun.star.comp.framework.HeaderMenuController"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> - <implementation name="com.sun.star.comp.framework.License"> - <service name="com.sun.star.task.Job"/> - </implementation> <implementation name="com.sun.star.comp.framework.MacrosMenuController"> <service name="com.sun.star.frame.PopupMenuController"/> </implementation> |