diff options
Diffstat (limited to 'extensions/source/preload')
-rw-r--r-- | extensions/source/preload/makefile.mk | 93 | ||||
-rw-r--r-- | extensions/source/preload/modulepreload.cxx | 32 | ||||
-rw-r--r-- | extensions/source/preload/oemwiz.cxx | 471 | ||||
-rw-r--r-- | extensions/source/preload/oemwiz.hxx | 156 | ||||
-rw-r--r-- | extensions/source/preload/preload.component | 34 | ||||
-rw-r--r-- | extensions/source/preload/preload.hrc | 58 | ||||
-rw-r--r-- | extensions/source/preload/preload.src | 290 | ||||
-rw-r--r-- | extensions/source/preload/preloadservices.cxx | 71 | ||||
-rw-r--r-- | extensions/source/preload/preloadservices.hxx | 55 | ||||
-rw-r--r-- | extensions/source/preload/services.cxx | 86 | ||||
-rw-r--r-- | extensions/source/preload/unoautopilot.hxx | 107 | ||||
-rw-r--r-- | extensions/source/preload/unoautopilot.inl | 133 |
12 files changed, 1586 insertions, 0 deletions
diff --git a/extensions/source/preload/makefile.mk b/extensions/source/preload/makefile.mk new file mode 100644 index 000000000000..8bd6226619bc --- /dev/null +++ b/extensions/source/preload/makefile.mk @@ -0,0 +1,93 @@ +#************************************************************************* +# +# 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=..$/.. +PRJINC=..$/inc + +PRJNAME=extensions +TARGET=preload +ENABLE_EXCEPTIONS=TRUE +VISIBILITY_HIDDEN=TRUE +USE_DEFFILE=TRUE + +# --- Settings ----------------------------------------------------- + +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- defines ------------------------------------------------------ + +CDEFS+=-DCOMPMOD_NAMESPACE=preload +CDEFS+=-DCOMPMOD_RESPREFIX=preload + +# --- Files -------------------------------------------------------- + +SLOFILES= $(SLO)$/services.obj\ + $(SLO)$/modulepreload.obj\ + $(SLO)$/preloadservices.obj\ + $(SLO)$/oemwiz.obj + +SRS1NAME=$(TARGET) +SRC1FILES= preload.src + +RESLIB1NAME=preload +RESLIB1IMAGES=$(PRJ)$/res +RESLIB1SRSFILES= $(SRS)$/preload.srs + +SHL1TARGET= $(TARGET)$(DLLPOSTFIX) +SHL1VERSIONMAP=$(SOLARENV)/src/component.map + +SHL1STDLIBS= \ + $(SFXLIB) \ + $(SVTOOLLIB)\ + $(VCLLIB) \ + $(SVLLIB) \ + $(TOOLSLIB) \ + $(UNOTOOLSLIB) \ + $(COMPHELPERLIB) \ + $(CPPUHELPERLIB) \ + $(CPPULIB) \ + $(SALLIB) + + +SHL1LIBS= $(SLB)$/$(TARGET).lib +SHL1IMPLIB= i$(TARGET) +SHL1DEPN= $(SHL1LIBS) +SHL1DEF= $(MISC)$/$(SHL1TARGET).def + +DEF1NAME= $(SHL1TARGET) + +# --- Targets ------------------------------------------------------ + +.INCLUDE : target.mk + + +ALLTAR : $(MISC)/preload.component + +$(MISC)/preload.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \ + preload.component + $(XSLTPROC) --nonet --stringparam uri \ + '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \ + $(SOLARENV)/bin/createcomponent.xslt preload.component diff --git a/extensions/source/preload/modulepreload.cxx b/extensions/source/preload/modulepreload.cxx new file mode 100644 index 000000000000..9f6d3d2b9e30 --- /dev/null +++ b/extensions/source/preload/modulepreload.cxx @@ -0,0 +1,32 @@ +/************************************************************************* + * + * 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_extensions.hxx" + +#include "componentmodule.cxx" + diff --git a/extensions/source/preload/oemwiz.cxx b/extensions/source/preload/oemwiz.cxx new file mode 100644 index 000000000000..a073e71c7c7c --- /dev/null +++ b/extensions/source/preload/oemwiz.cxx @@ -0,0 +1,471 @@ +/************************************************************************* + * + * 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_extensions.hxx" +#include "oemwiz.hxx" +#include "componentmodule.hxx" +#include <tools/debug.hxx> +#include <sfx2/docfile.hxx> +#include <svl/itemset.hxx> +#include <svl/itempool.hxx> +#include <vcl/msgbox.hxx> +#include <unotools/pathoptions.hxx> +#ifndef _EXTENSIONS_PRELOAD_PRELOAD_HRC_ +#include "preload.hrc" +#endif +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif +#include <sfx2/app.hxx> +#include <svtools/xtextedt.hxx> +#include "osl/diagnose.h" +#include "tools/urlobj.hxx" + +#include <sfx2/sfxdlg.hxx> +#include <sfx2/tabdlg.hxx> +#include <svx/dialogs.hrc> + +//......................................................................... +namespace preload +{ +//......................................................................... + + using namespace ::com::sun::star::uno; + using namespace ::com::sun::star::lang; + using namespace ::com::sun::star::beans; +//......................................................................... + + struct OEMPreloadDialog_Impl + { + SfxItemSet* pSet; + TabPage* pWelcomePage; + TabPage* pLicensePage; + TabPage* pUserDataPage; + + OEMPreloadDialog_Impl(OEMPreloadDialog* pDialog); + ~OEMPreloadDialog_Impl() + { + delete pWelcomePage; + delete pLicensePage; + delete pUserDataPage; + delete pSet; + } + void WriteUserData(); + }; +/* -----------------------------14.11.2001 11:33------------------------------ + + ---------------------------------------------------------------------------*/ + OEMPreloadDialog_Impl::OEMPreloadDialog_Impl(OEMPreloadDialog* pDialog) + { + SfxItemPool& rPool = SFX_APP()->GetPool(); + pSet = new SfxItemSet(rPool, SID_FIELD_GRABFOCUS, SID_FIELD_GRABFOCUS); + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + if ( pFact ) + { + CreateTabPage pFunc = pFact->GetTabPageCreatorFunc(RID_SFXPAGE_GENERAL); + pUserDataPage = (*pFunc)(pDialog, *pSet); + ((SfxTabPage*)pUserDataPage)->Reset(*pSet); + } + else + pUserDataPage = NULL; + pWelcomePage = new OEMWelcomeTabPage(pDialog); + pLicensePage = new OEMLicenseTabPage(pDialog); + } +/* -----------------------------14.11.2001 11:33------------------------------ + + ---------------------------------------------------------------------------*/ + void OEMPreloadDialog_Impl::WriteUserData() + { + if ( pUserDataPage ) + ((SfxTabPage*)pUserDataPage)->FillItemSet(*pSet); + } + +/* -----------------------------14.11.2001 11:33------------------------------ + + ---------------------------------------------------------------------------*/ + //===================================================================== + //= OEMPreloadDialog + //===================================================================== + //--------------------------------------------------------------------- + OEMPreloadDialog::OEMPreloadDialog( Window* _pParent, + const Reference< XPropertySet >& /*_rxObjectModel*/, const Reference< XMultiServiceFactory >& /*_rxORB*/ ) + :WizardDialog(_pParent, ModuleRes(RID_DLG_OEMWIZARD)/*, _rxObjectModel, _rxORB*/) + ,aPrevPB(this, ModuleRes(PB_PREV )) + ,aNextPB(this, ModuleRes(PB_NEXT )) + ,aCancelPB(this, ModuleRes(PB_CANCEL )) + ,aAcceptST(ModuleRes(ST_ACCEPT)) + ,aFinishST(ModuleRes(ST_FINISH)) + ,aLicense(ModuleRes(ST_LICENSE_AGREEMENT)) + ,aUserData(ModuleRes(ST_INSERT_USER_DATA)) + ,pImpl(new OEMPreloadDialog_Impl(this)) + { + FreeResource(); + aDlgTitle = GetText(); + aPrevPB.Enable(FALSE); + aNextST = aNextPB.GetText(); + aPrevPB.SetClickHdl(LINK(this, OEMPreloadDialog, NextPrevPageHdl)); + aNextPB.SetClickHdl(LINK(this, OEMPreloadDialog, NextPrevPageHdl)); + AddButton( &aPrevPB, WIZARDDIALOG_BUTTON_STDOFFSET_X ); + AddButton( &aNextPB, WIZARDDIALOG_BUTTON_STDOFFSET_X ); + AddButton( &aCancelPB, WIZARDDIALOG_BUTTON_STDOFFSET_X ); + + SetPrevButton(&aPrevPB); + SetNextButton(&aNextPB); + + AddPage( pImpl->pWelcomePage ); + AddPage( pImpl->pLicensePage ); + if ( pImpl->pUserDataPage ) + AddPage( pImpl->pUserDataPage ); + SetPage( OEM_WELCOME, pImpl->pWelcomePage ); + SetPage( OEM_LICENSE, pImpl->pLicensePage ); + if ( pImpl->pUserDataPage ) + SetPage( OEM_USERDATA, pImpl->pUserDataPage ); + ShowPage( OEM_WELCOME ); + } +/* -----------------------------14.11.2001 11:33------------------------------ + + ---------------------------------------------------------------------------*/ + OEMPreloadDialog::~OEMPreloadDialog( ) + { + delete pImpl; + } +/* -----------------------------14.11.2001 11:33------------------------------ + + ---------------------------------------------------------------------------*/ + IMPL_LINK(OEMPreloadDialog, NextPrevPageHdl, PushButton*, pButton) + { + if(pButton == &aPrevPB) + { + if(GetCurLevel()) + ShowPage(GetCurLevel() - 1); + } + else if(OEM_USERDATA > GetCurLevel()) + ShowPage(GetCurLevel() + 1); + else + { + pImpl->WriteUserData(); + Finnish(RET_OK); + } + + String sTitle(aDlgTitle); + + switch(GetCurLevel()) + { + case OEM_WELCOME: + aNextPB.SetText(aNextST); + aNextPB.Enable(TRUE); + break; + case OEM_LICENSE: + sTitle += aLicense; + aNextPB.SetText(aNextST); + aCancelPB.GrabFocus(); + break; + case OEM_USERDATA: + sTitle += aUserData; + aNextPB.SetText(aFinishST); + break; + } + SetText(sTitle); + aPrevPB.Enable(GetCurLevel() != OEM_WELCOME); + return 0; + } +/* -----------------------------14.11.2001 11:33------------------------------ + + ---------------------------------------------------------------------------*/ + sal_Bool OEMPreloadDialog::LoadFromLocalFile(const String& rFileName, String& rContent) + { + SvtPathOptions aPathOpt; + String sFileName = aPathOpt.GetUserConfigPath();//GetModulePath(); + INetURLObject aURLObject(sFileName); + OSL_ASSERT(aURLObject.getSegmentCount() >= 2); + aURLObject.removeSegment(); //remove '/config' + aURLObject.removeSegment(); //remove '/user' + sFileName = aURLObject.GetMainURL(INetURLObject::DECODE_TO_IURI); + sFileName += rFileName; + + SfxMedium aMedium( sFileName,STREAM_READ, TRUE ); + SvStream* pInStream = aMedium.GetInStream(); + if( !pInStream ) + return sal_False; + + pInStream->ReadCString( rContent, RTL_TEXTENCODING_UTF8 ); + + xub_StrLen nPos; + while ( ( nPos = rContent.Search( 12 )) != STRING_NOTFOUND ) + rContent.Erase( nPos, 1 ); + return sal_True; + } + + + void OEMPreloadDialog::SetCancelString( const String& rText ) + { + aCancelPB.SetText(rText); + } + +/* -----------------------------13.11.2001 12:29------------------------------ + + ---------------------------------------------------------------------------*/ + OEMWelcomeTabPage::OEMWelcomeTabPage(Window* pParent) : + TabPage(pParent, ModuleRes(RID_TP_WELCOME)), + aInfoFT(this, ModuleRes(FT_INFO)) + { + FreeResource(); + } +/* -----------------------------13.11.2001 12:30------------------------------ + + ---------------------------------------------------------------------------*/ + OEMWelcomeTabPage::~OEMWelcomeTabPage() + { + } +/* -----------------------------13.11.2001 12:29------------------------------ + + ---------------------------------------------------------------------------*/ + OEMLicenseTabPage::OEMLicenseTabPage(OEMPreloadDialog* pParent) : + TabPage(pParent, ModuleRes(RID_TP_LICENSE)), + aLicenseML(this, ModuleRes(ML_LICENSE)), + aInfo1FT(this, ModuleRes(FT_INFO1)), + aInfo2FT(this, ModuleRes(FT_INFO2)), + aInfo3FT(this, ModuleRes(FT_INFO3)), + aInfo2_1FT(this, ModuleRes(FT_INFO2_1)), + aInfo3_1FT(this, ModuleRes(FT_INFO3_1)), + aCBAccept(this, ModuleRes(CB_ACCEPT)), + aPBPageDown(this, ModuleRes(PB_PAGEDOWN)), + aArrow(this, ModuleRes(IMG_ARROW)), + aStrAccept( ModuleRes(LICENCE_ACCEPT) ), + aStrNotAccept( ModuleRes(LICENCE_NOTACCEPT) ), + bEndReached(FALSE), + pPreloadDialog(pParent) + { + FreeResource(); + + aLicenseML.SetEndReachedHdl( LINK(this, OEMLicenseTabPage, EndReachedHdl) ); + aLicenseML.SetScrolledHdl( LINK(this, OEMLicenseTabPage, ScrolledHdl) ); + + aPBPageDown.SetClickHdl( LINK(this, OEMLicenseTabPage, PageDownHdl) ); + aCBAccept.SetClickHdl( LINK(this, OEMLicenseTabPage, AcceptHdl) ); + + // We want a automatic repeating page down button + WinBits aStyle = aPBPageDown.GetStyle(); + aStyle |= WB_REPEAT; + aPBPageDown.SetStyle( aStyle ); + + aOldCancelText = pPreloadDialog->GetCancelString(); + pPreloadDialog->SetCancelString( aStrNotAccept ); + + String aText = aInfo2FT.GetText(); + aText.SearchAndReplaceAll( UniString::CreateFromAscii("%PAGEDOWN"), aPBPageDown.GetText() ); + aInfo2FT.SetText( aText ); + } +/* -----------------------------13.11.2001 12:30------------------------------ + + ---------------------------------------------------------------------------*/ + OEMLicenseTabPage::~OEMLicenseTabPage() + { + } +/* ---------------------------14.11.2001 11:24---------------------------- + + -----------------------------------------------------------------------*/ + void OEMLicenseTabPage::ActivatePage() + { + if(!aLicenseML.GetText().Len()) + { + aLicenseML.SetLeftMargin( 5 ); + String sLicense; +#ifdef UNX + OEMPreloadDialog::LoadFromLocalFile(String::CreateFromAscii("LICENSE"), sLicense); +#else + OEMPreloadDialog::LoadFromLocalFile(String::CreateFromAscii("license.txt"), sLicense); +#endif + aLicenseML.SetText( sLicense ); + } + + EnableControls(); + } + + //------------------------------------------------------------------------ + IMPL_LINK( OEMLicenseTabPage, AcceptHdl, CheckBox *, EMPTYARG ) + { + EnableControls(); + return 0; + } + + //------------------------------------------------------------------------ + IMPL_LINK( OEMLicenseTabPage, PageDownHdl, PushButton *, EMPTYARG ) + { + aLicenseML.ScrollDown( SCROLL_PAGEDOWN ); + return 0; + } + + //------------------------------------------------------------------------ + IMPL_LINK( OEMLicenseTabPage, EndReachedHdl, LicenceView *, EMPTYARG ) + { + bEndReached = TRUE; + + EnableControls(); + aCBAccept.GrabFocus(); + + return 0; + } + + //------------------------------------------------------------------------ + IMPL_LINK( OEMLicenseTabPage, ScrolledHdl, LicenceView *, EMPTYARG ) + { + EnableControls(); + + return 0; + } + + //------------------------------------------------------------------------ + void OEMLicenseTabPage::EnableControls() + { + if( !bEndReached && + ( aLicenseML.IsEndReached() || !aLicenseML.GetText().Len() ) ) + bEndReached = TRUE; + + if ( bEndReached ) + { + Point aPos( 0, aInfo3_1FT.GetPosPixel().Y() ); + aArrow.SetPosPixel( aPos ); + aCBAccept.Enable(); + } + else + { + Point aPos( 0, aInfo2_1FT.GetPosPixel().Y() ); + aArrow.SetPosPixel( aPos ); + aCBAccept.Disable(); + } + + if ( aLicenseML.IsEndReached() ) + aPBPageDown.Disable(); + else + aPBPageDown.Enable(); + + if ( aCBAccept.IsChecked() ) + { + PushButton *pNext = pPreloadDialog->GetNextButton(); + if ( ! pNext->IsEnabled() ) + { + pPreloadDialog->SetCancelString( aOldCancelText ); + pNext->Enable(TRUE); + } + } + else + { + PushButton *pNext = pPreloadDialog->GetNextButton(); + if ( pNext->IsEnabled() ) + { + pPreloadDialog->SetCancelString( aStrNotAccept ); + pNext->Enable(FALSE); + } + } + } + + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + //------------------------------------------------------------------------ + LicenceView::LicenceView( Window* pParent, const ResId& rResId ) + : MultiLineEdit( pParent, rResId ) + { + SetLeftMargin( 5 ); + + mbEndReached = IsEndReached(); + + StartListening( *GetTextEngine() ); + } + + //------------------------------------------------------------------------ + LicenceView::~LicenceView() + { + maEndReachedHdl = Link(); + maScrolledHdl = Link(); + + EndListeningAll(); + } + + //------------------------------------------------------------------------ + void LicenceView::ScrollDown( ScrollType eScroll ) + { + ScrollBar* pScroll = GetVScrollBar(); + + if ( pScroll ) + pScroll->DoScrollAction( eScroll ); + } + + //------------------------------------------------------------------------ + BOOL LicenceView::IsEndReached() const + { + BOOL bEndReached; + + ExtTextView* pView = GetTextView(); + ExtTextEngine* pEdit = GetTextEngine(); + ULONG nHeight = pEdit->GetTextHeight(); + Size aOutSize = pView->GetWindow()->GetOutputSizePixel(); + Point aBottom( 0, aOutSize.Height() ); + + if ( (ULONG) pView->GetDocPos( aBottom ).Y() >= nHeight - 1 ) + bEndReached = TRUE; + else + bEndReached = FALSE; + + return bEndReached; + } + + //------------------------------------------------------------------------ + void LicenceView::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) + { + if ( rHint.IsA( TYPE(TextHint) ) ) + { + BOOL bLastVal = EndReached(); + 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 preload +//......................................................................... + + diff --git a/extensions/source/preload/oemwiz.hxx b/extensions/source/preload/oemwiz.hxx new file mode 100644 index 000000000000..d6e8b9f276c6 --- /dev/null +++ b/extensions/source/preload/oemwiz.hxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_PRELOAD_OEMWIZ_HXX_ +#define _EXTENSIONS_PRELOAD_OEMWIZ_HXX_ + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <svtools/wizdlg.hxx> +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <vcl/tabpage.hxx> +#include <vcl/fixed.hxx> +#include <svtools/svmedit.hxx> +#include <svl/lstner.hxx> +#include <vcl/scrbar.hxx> + +//......................................................................... +namespace preload +{ + #define OEM_WELCOME 0 + #define OEM_LICENSE 1 + #define OEM_USERDATA 2 + +//......................................................................... + //===================================================================== + //= OEMPreloadDialog + //===================================================================== + struct OEMPreloadDialog_Impl; + class OEMPreloadDialog : public WizardDialog + { + PushButton aPrevPB; + PushButton aNextPB; + CancelButton aCancelPB; + + String aNextST; + String aAcceptST; + String aFinishST; + String aDlgTitle; + String aLicense; + String aUserData; + OEMPreloadDialog_Impl* pImpl; + + DECL_LINK(NextPrevPageHdl, PushButton*); + protected: + + public: + OEMPreloadDialog( + Window* _pParent, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxObjectModel, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB + ); + ~OEMPreloadDialog(); + + const String& GetAcceptString()const {return aAcceptST;} + const String GetCancelString() const {return aCancelPB.GetText();} + void SetCancelString( const String& rText ); + + static sal_Bool LoadFromLocalFile(const String& rFileName, String& rContent); + }; + class OEMWelcomeTabPage : public TabPage + { + FixedText aInfoFT; + public: + OEMWelcomeTabPage(Window* pParent); + ~OEMWelcomeTabPage(); + }; + class LicenceView : public MultiLineEdit, public SfxListener + { + BOOL mbEndReached; + Link maEndReachedHdl; + Link maScrolledHdl; + + public: + LicenceView( Window* pParent, const ResId& rResId ); + ~LicenceView(); + + void ScrollDown( ScrollType eScroll ); + + BOOL IsEndReached() const; + BOOL EndReached() const { return mbEndReached; } + void SetEndReached( 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; } + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + private: + using MultiLineEdit::Notify; + }; + class OEMLicenseTabPage : public TabPage + { + LicenceView aLicenseML; + FixedText aInfo1FT; + FixedText aInfo2FT; + FixedText aInfo3FT; + FixedText aInfo2_1FT; + FixedText aInfo3_1FT; + CheckBox aCBAccept; + PushButton aPBPageDown; + FixedImage aArrow; + String aStrAccept; + String aStrNotAccept; + String aOldCancelText; + BOOL bEndReached; + + OEMPreloadDialog* pPreloadDialog; + + void EnableControls(); + + DECL_LINK( AcceptHdl, CheckBox * ); + DECL_LINK( PageDownHdl, PushButton * ); + DECL_LINK( EndReachedHdl, LicenceView * ); + DECL_LINK( ScrolledHdl, LicenceView * ); + + public: + OEMLicenseTabPage(OEMPreloadDialog* pParent); + ~OEMLicenseTabPage(); + + virtual void ActivatePage(); + }; + +//......................................................................... +} // namespace preload +//......................................................................... + +#endif // _EXTENSIONS_PRELOAD_OEMWIZ_HXX_ + diff --git a/extensions/source/preload/preload.component b/extensions/source/preload/preload.component new file mode 100644 index 000000000000..56a8a0d7a0cf --- /dev/null +++ b/extensions/source/preload/preload.component @@ -0,0 +1,34 @@ +<?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" + xmlns="http://openoffice.org/2010/uno-components"> + <implementation name="org.openoffice.comp.preload.OEMPreloadWizard"> + <service name="org.openoffice.comp.preload.OEMPreloadWizard"/> + </implementation> +</component> diff --git a/extensions/source/preload/preload.hrc b/extensions/source/preload/preload.hrc new file mode 100644 index 000000000000..19cb8a15ac10 --- /dev/null +++ b/extensions/source/preload/preload.hrc @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_PRELOAD_PRELOAD_HRC_ +#define _EXTENSIONS_PRELOAD_PRELOAD_HRC_ + +#define RID_DLG_OEMWIZARD 1024 +#define RID_TP_LICENSE 1025 +#define RID_TP_WELCOME 1027 + + +#define PB_PREV 1 +#define PB_NEXT 2 +#define PB_CANCEL 3 + +#define ST_ACCEPT 5 +#define ST_FINISH 6 +#define FT_INFO 7 +#define ML_README 8 +#define FT_INFO1 9 +#define FT_INFO2 10 +#define ML_LICENSE 11 +#define ST_LICENSE_AGREEMENT 12 +#define ST_INSERT_USER_DATA 13 +#define IMG_ARROW 14 +#define FT_INFO2_1 15 +#define FT_INFO3_1 16 +#define FT_INFO3 17 +#define PB_PAGEDOWN 18 +#define CB_ACCEPT 19 +#define LICENCE_ACCEPT 20 +#define LICENCE_NOTACCEPT 21 + +#endif diff --git a/extensions/source/preload/preload.src b/extensions/source/preload/preload.src new file mode 100644 index 000000000000..2570d5ee81f0 --- /dev/null +++ b/extensions/source/preload/preload.src @@ -0,0 +1,290 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_PRELOAD_PRELOAD_HRC_ +#include "preload.hrc" +#endif + +ModalDialog RID_DLG_OEMWIZARD +{ + HelpID = "extensions:ModalDialog:RID_DLG_OEMWIZARD"; + Text = "%PRODUCTNAME %PRODUCTVERSION"; + + OutputSize = TRUE ; + SVLook = TRUE ; + Moveable = TRUE ; + Closeable = TRUE ; + Hide = TRUE; + PushButton PB_PREV + { + HelpID = "extensions:PushButton:RID_DLG_OEMWIZARD:PB_PREV"; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "<< Back" ; + }; + PushButton PB_NEXT + { + HelpID = "extensions:PushButton:RID_DLG_OEMWIZARD:PB_NEXT"; + Size = MAP_APPFONT ( 50 , 14 ) ; + Text [ en-US ] = "Next >>" ; + }; + CancelButton PB_CANCEL + { + Size = MAP_APPFONT ( 50 , 14 ) ; + }; + String ST_ACCEPT + { + Text [ en-US ] = "Accept"; + }; + String ST_FINISH + { + Text [ en-US ] = "Finish"; + }; + String ST_LICENSE_AGREEMENT + { + Text [ en-US ] = " - Software License Agreement"; + }; + + String ST_INSERT_USER_DATA + { + Text [ en-US ] = "- User Data"; + }; +}; +TabPage RID_TP_WELCOME +{ + HelpID = "extensions:TabPage:RID_TP_WELCOME"; +// HelpId = ; + OutputSize = TRUE ; + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Welcome"; + FixedText FT_INFO + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 174 ) ; + WordBreak = TRUE ; + Text [ en-US ] = "Welcome to %PRODUCTNAME %PRODUCTVERSION OEM\n\nTo start the %PRODUCTNAME %PRODUCTVERSION OEM, " + "please enter your personal data in the dialog following the license text. Important information is contained " + "in the readme files which are located in the %PRODUCTNAME product directory. Please read these files carefully. " + "You can also find detailed information at the Oracle website \n\n" + "http://www.oracle.com/us/products/applications/open-office."; + }; +}; + +#define LICENSE_DIALOG_WIDTH 260 +#define LICENSE_DIALOG_HEIGTH 185 +#define LICENSE_RIGHT_BORDER 7 +#define LICENSE_BOTTOM_BORDER 0 +#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 LICENCE_HEIGHT 102 +#define LICENSE_ROW_2 (LICENSE_ROW_1 + OFFSET + LICENCE_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 + OFFSET + FT_HEIGHT) + +/* +#define LICENSE_ROW_5 (LICENSE_DIALOG_HEIGTH - LICENSE_BOTTOM_BORDER - OFFSET - FT_HEIGHT) +#define LICENSE_ROW_4 (LICENSE_ROW_5 - OFFSET - FT_HEIGHT) +#define LICENSE_ROW_3 (LICENSE_ROW_4 - OFFSET - 3*FT_HEIGHT) +#define LICENSE_ROW_2 (LICENSE_ROW_3 - OFFSET - FT_HEIGHT) +#define LICENCE_HEIGHT (LICENSE_ROW_2-LICENSE_ROW_1-OFFSET) +*/ + + +#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) + + +TabPage RID_TP_LICENSE +{ + HelpID = "extensions:TabPage:RID_TP_LICENSE"; + OutputSize = TRUE ; + SVLook = TRUE ; + Hide = TRUE ; + Size = MAP_APPFONT ( LICENSE_DIALOG_WIDTH , LICENSE_DIALOG_HEIGTH ) ; + Text [ en-US ] = "License Agreement"; + + MultiLineEdit ML_LICENSE + { + HelpID = "extensions:MultiLineEdit:RID_TP_LICENSE:ML_LICENSE"; + PosSize = MAP_APPFONT ( LICENSE_COL_1 , LICENSE_ROW_1 , LICENSE_WIDTH , LICENCE_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" ; + File[ ar ] = "m_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 = "extensions:PushButton:RID_TP_LICENSE:PB_PAGEDOWN"; + TabStop = TRUE ; + Pos = MAP_APPFONT ( LICENSE_COL_4 , LICENSE_ROW_3 ) ; + Size = MAP_APPFONT ( PD_WIDTH , PB_HEIGHT ) ; + Text [ en-US ] = "Page 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." ; + }; + + CheckBox CB_ACCEPT + { + HelpID = "extensions:CheckBox:RID_TP_LICENSE:CB_ACCEPT"; + TabStop = TRUE ; + Pos = MAP_APPFONT ( LICENSE_COL_3, LICENSE_ROW_5 ) ; + Size = MAP_APPFONT ( COL3_WIDTH, FT_HEIGHT ) ; + Text [ en-US ] = "I accept the terms of the Agreement." ; + }; + + String LICENCE_ACCEPT + { + Text [ en-US ] = "~Accept" ; + }; + + String LICENCE_NOTACCEPT + { + Text [ en-US ] = "Decline" ; + }; + +}; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/extensions/source/preload/preloadservices.cxx b/extensions/source/preload/preloadservices.cxx new file mode 100644 index 000000000000..c309fb60cfe2 --- /dev/null +++ b/extensions/source/preload/preloadservices.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * 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_extensions.hxx" +#include "preloadservices.hxx" +#include "componentmodule.hxx" +#include "unoautopilot.hxx" +#include "oemwiz.hxx" + +// the registration methods +extern "C" void SAL_CALL createRegistryInfo_OEMPreloadDialog() +{ + static ::preload::OMultiInstanceAutoRegistration< + ::preload::OUnoAutoPilot< ::preload::OEMPreloadDialog, ::preload::OEMPreloadSI > + > aAutoRegistration; +} +static const char cServiceName[] = "org.openoffice.comp.preload.OEMPreloadWizard"; +//......................................................................... +namespace preload +{ +//......................................................................... + + using namespace ::com::sun::star::uno; + + //===================================================================== + //= OEMPreloadSI + //===================================================================== + //--------------------------------------------------------------------- + ::rtl::OUString OEMPreloadSI::getImplementationName() const + { + return ::rtl::OUString::createFromAscii(cServiceName); + } + + //--------------------------------------------------------------------- + Sequence< ::rtl::OUString > OEMPreloadSI::getServiceNames() const + { + Sequence< ::rtl::OUString > aReturn(1); + aReturn[0] = ::rtl::OUString::createFromAscii(cServiceName); + return aReturn; + } + + +//......................................................................... +} // namespace preload +//......................................................................... + diff --git a/extensions/source/preload/preloadservices.hxx b/extensions/source/preload/preloadservices.hxx new file mode 100644 index 000000000000..5676b7db543b --- /dev/null +++ b/extensions/source/preload/preloadservices.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_PRELOAD_PRELOADSERVICES_HXX_ +#define _EXTENSIONS_PRELOAD_PRELOADSERVICES_HXX_ + +#include <com/sun/star/uno/Sequence.hxx> +#include <rtl/ustring.hxx> + +//......................................................................... +namespace preload +{ +//......................................................................... + + //===================================================================== + //= OGroupBoxSI + //===================================================================== + /// service info for the OEM preload wizard + struct OEMPreloadSI + { + public: + ::rtl::OUString getImplementationName() const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > + getServiceNames() const; + }; +//......................................................................... +} // namespace preload +//......................................................................... + +#endif // _EXTENSIONS_PRELOAD_PRELOADSERVICES_HXX_ + diff --git a/extensions/source/preload/services.cxx b/extensions/source/preload/services.cxx new file mode 100644 index 000000000000..e063789e0f0c --- /dev/null +++ b/extensions/source/preload/services.cxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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_extensions.hxx" +#include "componentmodule.hxx" + +//--------------------------------------------------------------------------------------- + +using namespace ::rtl; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::registry; + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL createRegistryInfo_OEMPreloadDialog(); + +//--------------------------------------------------------------------------------------- + +extern "C" void SAL_CALL preload_initializeModule() +{ + static sal_Bool s_bInit = sal_False; + if (!s_bInit) + { + createRegistryInfo_OEMPreloadDialog(); + ::preload::OModule::setResourceFilePrefix("preload"); + s_bInit = sal_True; + } +} + +//--------------------------------------------------------------------------------------- + +extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL +component_getImplementationEnvironment( + const sal_Char **ppEnvTypeName, + uno_Environment ** /*ppEnv*/ + ) +{ + preload_initializeModule(); + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +//--------------------------------------------------------------------------------------- +extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( + const sal_Char* pImplementationName, + void* pServiceManager, + void* /*pRegistryKey*/) +{ + Reference< XInterface > xRet; + if (pServiceManager && pImplementationName) + { + xRet = ::preload::OModule::getComponentFactory( + ::rtl::OUString::createFromAscii(pImplementationName), + static_cast< XMultiServiceFactory* >(pServiceManager)); + } + + if (xRet.is()) + xRet->acquire(); + return xRet.get(); +}; + diff --git a/extensions/source/preload/unoautopilot.hxx b/extensions/source/preload/unoautopilot.hxx new file mode 100644 index 000000000000..e6175a3f522e --- /dev/null +++ b/extensions/source/preload/unoautopilot.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 _EXTENSIONS_PRELOAD_UNOAUTOPILOT_HXX_ +#define _EXTENSIONS_PRELOAD_UNOAUTOPILOT_HXX_ + +#include <svtools/genericunodialog.hxx> +#include <comphelper/proparrhlp.hxx> +#include "componentmodule.hxx" +#include <cppuhelper/typeprovider.hxx> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> + +//......................................................................... +namespace preload +{ +//......................................................................... + + //===================================================================== + //= IServiceInfo + //===================================================================== + /** interface for the SERVICEINFO template parameter of the OUnoAutoPilot class + */ + struct IServiceInfo + { + public: + ::rtl::OUString getImplementationName() const; + ::com::sun::star::uno::Sequence< ::rtl::OUString > + getServiceNames() const; + }; + + //===================================================================== + //= OUnoAutoPilot + //===================================================================== + typedef ::svt::OGenericUnoDialog OUnoAutoPilot_Base; + template <class TYPE, class SERVICEINFO> + class OUnoAutoPilot + :public OUnoAutoPilot_Base + ,public ::comphelper::OPropertyArrayUsageHelper< OUnoAutoPilot< TYPE, SERVICEINFO > > + ,public OModuleResourceClient + { + OUnoAutoPilot(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB); + + protected: + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + m_xObjectModel; + + public: + // XTypeProvider + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() throw(::com::sun::star::uno::RuntimeException); + virtual ::comphelper::StringSequence SAL_CALL getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo - static methods + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(void) throw( ::com::sun::star::uno::RuntimeException ); + static ::rtl::OUString getImplementationName_Static(void) throw( ::com::sun::star::uno::RuntimeException ); + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + SAL_CALL Create(const ::com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo> SAL_CALL getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException); + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + // OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const; + + protected: + // OGenericUnoDialog overridables + virtual Dialog* createDialog(Window* _pParent); + virtual void implInitialize(const com::sun::star::uno::Any& _rValue); + }; + +#include "unoautopilot.inl" + +//......................................................................... +} // namespace dbp +//......................................................................... + +#endif // _EXTENSIONS_PRELOAD_UNOAUTOPILOT_HXX_ + + diff --git a/extensions/source/preload/unoautopilot.inl b/extensions/source/preload/unoautopilot.inl new file mode 100644 index 000000000000..27acdd6864f3 --- /dev/null +++ b/extensions/source/preload/unoautopilot.inl @@ -0,0 +1,133 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +// no include protecttion +// this file is included from unoautopilot.hxx directly + +//using namespace ::com::sun::star::uno; +//using namespace ::com::sun::star::lang; +//using namespace ::com::sun::star::beans; +// +//===================================================================== +//= OUnoAutoPilot +//===================================================================== +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +OUnoAutoPilot<TYPE, SERVICEINFO>::OUnoAutoPilot(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB) + :OUnoAutoPilot_Base(_rxORB) +{ +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL OUnoAutoPilot<TYPE, SERVICEINFO>::getImplementationId( ) throw(::com::sun::star::uno::RuntimeException) +{ + static ::cppu::OImplementationId aId; + return aId.getImplementationId(); +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OUnoAutoPilot<TYPE, SERVICEINFO>::Create(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) +{ + return *(new OUnoAutoPilot<TYPE, SERVICEINFO>(_rxFactory)); +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::rtl::OUString SAL_CALL OUnoAutoPilot<TYPE, SERVICEINFO>::getImplementationName() throw(::com::sun::star::uno::RuntimeException) +{ + return getImplementationName_Static(); +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::rtl::OUString OUnoAutoPilot<TYPE, SERVICEINFO>::getImplementationName_Static() throw(::com::sun::star::uno::RuntimeException) +{ + return SERVICEINFO().getImplementationName(); +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::comphelper::StringSequence SAL_CALL OUnoAutoPilot<TYPE, SERVICEINFO>::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) +{ + return getSupportedServiceNames_Static(); +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::comphelper::StringSequence OUnoAutoPilot<TYPE, SERVICEINFO>::getSupportedServiceNames_Static() throw(::com::sun::star::uno::RuntimeException) +{ + return SERVICEINFO().getServiceNames(); +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OUnoAutoPilot<TYPE, SERVICEINFO>::getPropertySetInfo() throw(::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); + return xInfo; +} + +//--------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::cppu::IPropertyArrayHelper& OUnoAutoPilot<TYPE, SERVICEINFO>::getInfoHelper() +{ + return *const_cast<OUnoAutoPilot*>(this)->getArrayHelper(); +} + +//-------------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +::cppu::IPropertyArrayHelper* OUnoAutoPilot<TYPE, SERVICEINFO>::createArrayHelper( ) const +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > aProps; + describeProperties(aProps); + return new ::cppu::OPropertyArrayHelper(aProps); +} + +//-------------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +Dialog* OUnoAutoPilot<TYPE, SERVICEINFO>::createDialog(Window* _pParent) +{ + return new TYPE(_pParent, m_xObjectModel, m_aContext.getLegacyServiceFactory()); +} + +//-------------------------------------------------------------------------- +template <class TYPE, class SERVICEINFO> +void OUnoAutoPilot<TYPE, SERVICEINFO>::implInitialize(const com::sun::star::uno::Any& _rValue) +{ + ::com::sun::star::beans::PropertyValue aArgument; + if (_rValue >>= aArgument) + if (0 == aArgument.Name.compareToAscii("ObjectModel")) + { + aArgument.Value >>= m_xObjectModel; + return; + } + + OUnoAutoPilot_Base::implInitialize(_rValue); +} + |