diff options
Diffstat (limited to 'framework/inc/services')
24 files changed, 7958 insertions, 0 deletions
diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx new file mode 100644 index 000000000000..8f6c62a2f39e --- /dev/null +++ b/framework/inc/services/autorecovery.hxx @@ -0,0 +1,1013 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: autorecovery.hxx,v $ + * $Revision: 1.15 $ + * + * 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 __FRAMEWORK_SERVICES_AUTORECOVERY_HXX_ +#define __FRAMEWORK_SERVICES_AUTORECOVERY_HXX_ + +//_______________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/document/XEventListener.hpp> +#include <com/sun/star/document/XEventBroadcaster.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/util/XChangesListener.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/util/XModifyListener.hpp> + +//_______________________________________________ +// other includes +#include <comphelper/mediadescriptor.hxx> +#include <vcl/timer.hxx> +#include <vcl/evntpost.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/weak.hxx> + +//_______________________________________________ +// definition + +#ifndef css +namespace css = ::com::sun::star; +#endif + +namespace framework +{ + +//--------------------------------------- +/** @short hold all needed informations for an asynchronous dispatch alive. + + @descr Because some operations are forced to be executed asynchronously + (e.g. requested by our CreashSave/Recovery dialog) ... we must make sure + that these informations wont be set as "normal" members of our AtoRecovery + instance. Otherwise they can disturb our normal AutoSave-timer handling. + e.g. it can be unclear then, which progress has to be used for storing documents ... + */ +struct DispatchParams +{ + public: + DispatchParams(); + DispatchParams(const ::comphelper::SequenceAsHashMap& lArgs , + const css::uno::Reference< css::uno::XInterface >& xOwner); + DispatchParams(const DispatchParams& rCopy); + ~DispatchParams(); + + DispatchParams& operator=(const DispatchParams& rCopy); + void forget(); + + public: + + //--------------------------------------- + /** @short can be set from outside and is provided to + our internal started operations. + + @descr Normaly we use the normal status indicator + of the document windows to show a progress. + But in case we are used by any special UI, + it can provide its own status indicator object + to us - so we use it instead of the normal one. + */ + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + //--------------------------------------- + /** TODO document me */ + ::rtl::OUString m_sSavePath; + + //--------------------------------------- + /** @short define the current cache entry, which should be used for current + backup or cleanUp operation ... which is may be done asynchronous */ + sal_Int32 m_nWorkingEntryID; + + //--------------------------------------- + /** @short used for asyncoperations, to prevent us from dying. + + @descr If our dispatch() method was forced to start the + internal operation asynchronous ... we send an event + to start and return immediatly. But we must be shure that + our instance live if the event callback reach us. + So we hold an uno reference to ourself. + */ + css::uno::Reference< css::uno::XInterface > m_xHoldRefForAsyncOpAlive; +}; + +//_______________________________________________ +/** + implements the functionality of AutoSave and AutoRecovery + of documents - including features of an EmergencySave in + case a GPF occures. + */ +class AutoRecovery : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::frame::XDispatch + , public css::document::XEventListener // => css.lang.XEventListener + , public css::util::XChangesListener // => css.lang.XEventListener + , public css::util::XModifyListener // => css.lang.XEventListener + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OBroadcastHelper + , public ::cppu::OPropertySetHelper // => XPropertySet, XFastPropertySet, XMultiPropertySet + , public ::cppu::OWeakObject +{ + //___________________________________________ + // types + + public: + + /** These values are used as flags and represent the current state of a document. + Every state of the life time of a document has to be recognized here. + + @attention Do not change (means reorganize) already used numbers. + There exists some code inside SVX, which uses the same numbers, + to analyze such document states. + Not the best design ... but may be it will be changed later .-) + */ + enum EDocStates + { + /* TEMP STATES */ + + /// default state, if a document was new created or loaded + E_UNKNOWN = 0, + /// modified against the original file + E_MODIFIED = 1, + /** We differe between the states: "modified in general" and "modified after last AutoSave". + The first state will be interesting in case the crashed document will be restored. Then we have + set the right modify state after loading the document. But the second state let us optimize the + AutoSave itself. see member ListenForModify too ... + */ + E_MODIFIED_SINCE_LAST_AUTOSAVE = 1024, + /// an active document can be postponed to be saved later. + E_POSTPONED = 2, + /// was already handled during one AutoSave/Recovery session. + E_HANDLED = 4, + /** an action was started (saving/loading) ... Can be interesting later if the process may be was interrupted by an exception. */ + E_TRY_SAVE = 8, + E_TRY_LOAD_BACKUP = 16, + E_TRY_LOAD_ORIGINAL = 32, + + /* FINAL STATES */ + + /// the Auto/Emergency saved document isnt useable any longer + E_DAMAGED = 64, + /// the Auto/Emergency saved document isnt realy up-to-date (some changes can be missing) + E_INCOMPLETE = 128, + /// the Auto/Emergency saved document was processed successfully + E_SUCCEDED = 512 + }; + + /** @short indicates the results of a FAILURE_SAFE operation + + @descr We must know, which reason was the real one in case + we couldnt copy a "failure document" to a user specified path. + We must know, if we can forget our cache entry or not. + */ + enum EFailureSafeResult + { + E_COPIED, + E_ORIGINAL_FILE_MISSING, + E_WRONG_TARGET_PATH + }; + + // TODO document me + enum ETimerType + { + /** the timer shouldnt be used next time */ + E_DONT_START_TIMER, + /** timer (was/must be) started with normal AutoSaveTimeIntervall */ + E_NORMAL_AUTOSAVE_INTERVALL, + /** timer must be started with special short time intervall, + to poll for an user idle period */ + E_POLL_FOR_USER_IDLE, + /** timer mst be started with a very(!) short time intervall, + to poll for the end of an user action, which does not allow saving documents in general */ + E_POLL_TILL_AUTOSAVE_IS_ALLOWED, + /** dont start the timer - but calls the same action then before immediatly again! */ + E_CALL_ME_BACK + }; + + // TODO document me ... flag field + // Emergency_Save and Recovery overwrites Auto_Save! + enum EJob + { + E_NO_JOB = 0, + E_AUTO_SAVE = 1, + E_EMERGENCY_SAVE = 2, + E_RECOVERY = 4, + E_ENTRY_BACKUP = 8, + E_ENTRY_CLEANUP = 16, + E_PREPARE_EMERGENCY_SAVE = 32, + E_SESSION_SAVE = 64, + E_SESSION_RESTORE = 128, + E_DISABLE_AUTORECOVERY = 256, + E_SET_AUTOSAVE_STATE = 512 + }; + + //--------------------------------------- + /** @short combine different informations about one office document. */ + struct TDocumentInfo + { + public: + + //------------------------------- + TDocumentInfo() + : DocumentState (E_UNKNOWN) + , UsedForSaving (sal_False) + , ListenForModify (sal_False) + , IgnoreClosing (sal_False) + , ID (-1 ) + {} + + //------------------------------- + /** @short points to the document. */ + css::uno::Reference< css::frame::XModel > Document; + + //------------------------------- + /** @short knows, if the document is realy modified since the last autosave, + or was postponed, because it was an active one etcpp... + + @descr Because we have no CHANGE TRACKING mechanism, based on office document, + we implements it by ourself. We listen for MODIFIED events + of each document and update this state flag here. + + Further we postpone saving of active documents, e.g. if the user + works currently on it. We wait for an idle period then ... + */ + sal_Int32 DocumentState; + + //------------------------------- + /** Because our applications not ready for concurrent save requests at the same time, + we have supress our own AutoSave for the moment, a document will be already saved + by others. + */ + sal_Bool UsedForSaving; + + //------------------------------- + /** For every user action, which modifies a document (e.g. key input) we get + a notification as XModifyListener. That seams to be a "performance issue" .-) + So we decided to listen for such modify events only for the time in which the document + was stored as temp. file and was not modified again by the user. + */ + sal_Bool ListenForModify; + + //------------------------------- + /** For SessionSave we must close all open documents by ourself. + But because we are listen for documents events, we get some ... + and deregister these documents from our configuration. + That's why we mark these documents as "Closed by ourself" so we can + ignore these "OnUnload" or disposing() events .-) + */ + sal_Bool IgnoreClosing; + + //------------------------------- + /** TODO: document me */ + ::rtl::OUString OrgURL; + ::rtl::OUString FactoryURL; + ::rtl::OUString TemplateURL; + + ::rtl::OUString OldTempURL; + ::rtl::OUString NewTempURL; + + ::rtl::OUString AppModule; // e.g. com.sun.star.text.TextDocument - used to identify app module + ::rtl::OUString RealFilter; // real filter, which was used at loading time + ::rtl::OUString DefaultFilter; // supports saving of the default format without loosing data + ::rtl::OUString Extension; // file extension of the default filter + ::rtl::OUString Title; // can be used as "DisplayName" on every recovery UI! + + sal_Int32 ID; + }; + + //--------------------------------------- + /** @short used to know every currently open document. */ + typedef ::std::vector< TDocumentInfo > TDocumentList; + + //___________________________________________ + // member + + private: + + //--------------------------------------- + /** @short the global uno service manager. + @descr Must be used to create own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //--------------------------------------- + /** @short points to the underlying recovery configuration. + @descr This instance does not cache - it calls directly the + configuration API! + */ + css::uno::Reference< css::container::XNameAccess > m_xRecoveryCFG; + + //--------------------------------------- + /** @short points to the used configuration package or.openoffice.Setup + @descr This instance does not cache - it calls directly the + configuration API! + */ + css::uno::Reference< css::container::XNameAccess > m_xModuleCFG; + + //--------------------------------------- + /** @short holds the global event broadcaster alive, + where we listen for new created documents. + */ + css::uno::Reference< css::document::XEventBroadcaster > m_xNewDocBroadcaster; + + //--------------------------------------- + /** @short because we stop/restart listening sometimes, it's a good idea to know + if we already registered as listener .-) + */ + sal_Bool m_bListenForDocEvents; + sal_Bool m_bListenForConfigChanges; + + //--------------------------------------- + /** @short specify the time intervall between two save actions. + @descr Time is measured in [min]. + */ + sal_Int32 m_nAutoSaveTimeIntervall; + + //--------------------------------------- + /** @short for an asynchronous operation we must know, if there is + at least one running job (may be asynchronous!). + */ + sal_Int32 m_eJob; + + //--------------------------------------- + /** @short the timer, which is used to be informed about the next + saving time ... + */ + Timer m_aTimer; + + //--------------------------------------- + /** @short make our dispatch asynchronous ... if required to do so! */ + ::vcl::EventPoster m_aAsyncDispatcher; + + //--------------------------------------- + /** @see DispatchParams + */ + DispatchParams m_aDispatchParams; + + //--------------------------------------- + /** @short indicates, which time period is currently used by the + internal timer. + */ + ETimerType m_eTimerType; + + //--------------------------------------- + /** @short this cache is used to hold all informations about + recovery/emergency save documents alive. + */ + TDocumentList m_lDocCache; + + //--------------------------------------- + // TODO document me + sal_Int32 m_nIdPool; + + //--------------------------------------- + /** @short contains all status listener registered at this instance. + */ + ListenerHash m_lListener; + + /** @descr This member is used to prevent us against re-entrance problems. + A mutex cant help to prevent us from concurrent using of members + inside the same thread. But e.g. our internaly used stl structures + are not threadsafe ... and furthermore they cant be used at the same time + for iteration and add/remove requests! + So we have to detect such states and ... show a warning. + May be there will be a better solution next time ... (copying the cache temp. + bevor using). + + And further it's not possible to use a simple boolean value here. + Because if more then one operation iterates over the same stl container ... + (only to modify it's elements but dont add new or removing existing ones!) + it should be possible doing so. But we must guarantee that the last operation reset + this lock ... not the first one ! So we use a "ref count" mechanism for that." + */ + sal_Int32 m_nDocCacheLock; + + /** @descr These members are used to check the minimum disc space, which must exists + to start the corresponding operation. + */ + sal_Int32 m_nMinSpaceDocSave; + sal_Int32 m_nMinSpaceConfigSave; + + //--------------------------------------- + /** @short special debug option to make testing faster. + + @descr We dont interpret the timer unit as [min] ... + we use [ms] instead of that. Further we dont + wait 10 s for user idle ... + */ + #if OSL_DEBUG_LEVEL > 1 + sal_Bool m_dbg_bMakeItFaster; + #endif + + //--------------------------------------- + // HACK ... TODO + css::uno::Reference< css::task::XStatusIndicator > m_xExternalProgress; + + //___________________________________________ + // interface + + public: + + AutoRecovery(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~AutoRecovery( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------- + // css.frame.XDispatch + virtual void SAL_CALL dispatch(const css::util::URL& aURL , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL addStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL removeStatusListener(const css::uno::Reference< css::frame::XStatusListener >& xListener, + const css::util::URL& aURL ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.document.XEventListener + /** @short informs about created/opened documents. + + @descr Every new opened/created document will be saved internaly + so it can be checked if its modified. This modified state + is used later to decide, if it must be saved or not. + + @param aEvent + points to the new created/opened document. + */ + virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.util.XChangesListener + virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent& aEvent) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.util.XModifyListener + virtual void SAL_CALL modified(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // css.lang.XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //___________________________________________ + // helper + + protected: + + //--------------------------------------- + // OPropertySetHelper + + virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& aConvertedValue, + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) + throw(css::lang::IllegalArgumentException); + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, + const css::uno::Any& aValue ) + throw(css::uno::Exception); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue(css::uno::Any& aValue , + sal_Int32 nHandle) const; + + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw(css::uno::RuntimeException); + //___________________________________________ + // helper + + private: + + //--------------------------------------- + /** @short open the underlying configuration. + + @descr This method must be called everytimes + a configuartion call is needed. Because + method works together with the member + m_xCFG, open it on demand and cache it + afterwards. + + @return [com.sun.star.container.XNameAccess] + the configuration object + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened successfully! + + @threadsafe + */ + css::uno::Reference< css::container::XNameAccess > implts_openConfig(); + + //--------------------------------------- + /** @short read the underlying configuration. + + @descr After that we know the initial state - means: + - if AutoSave was enabled by the user + - which time intervall has to be used + - which recovery entries may already exists + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened or readed successfully! + + @threadsafe + */ + void implts_readConfig(); + + //--------------------------------------- + /** @short read the underlying configuration... + + @descr ... but only keys related to the AutoSave mechanism. + Means: State and Timer intervall. + E.g. the recovery list isnt adressed here. + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened or readed successfully! + + @threadsafe + */ + void implts_readAutoSaveConfig(); + + //--------------------------------------- + // TODO document me + void implts_flushConfigItem(const AutoRecovery::TDocumentInfo& rInfo , + sal_Bool bRemoveIt = sal_False); + + //--------------------------------------- + // TODO document me + void implts_startListening(); + void implts_startModifyListeningOnDoc(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + // TODO document me + void implts_stopListening(); + void implts_stopModifyListeningOnDoc(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + /** @short stops and may be(!) restarts the timer. + + @descr A running timer is stopped everytimes here. + But starting depends from the different internal + timer variables (e.g. AutoSaveEnabled, AutoSaveTimeIntervall, + TimerType etcpp.) + + @throw [com.sun.star.uno.RuntimeException] + if timer could not be stopped or started! + + @threadsafe + */ + void implts_actualizeTimer(); + + //--------------------------------------- + /** @short stop the timer. + + @descr Double calls will be ignored - means we do + nothing here, if the timer is already disabled. + + @throw [com.sun.star.uno.RuntimeException] + if timer could not be stopped! + + @threadsafe + */ + void implts_stopTimer(); + + //--------------------------------------- + /** @short callback of our internal timer. + */ + DECL_LINK(implts_timerExpired, void*); + + //--------------------------------------- + /** @short makes our dispatch() method asynchronous! + */ + DECL_LINK(implts_asyncDispatch, void*); + + //--------------------------------------- + /** @short implements the dispatch real. */ + void implts_dispatch(const DispatchParams& aParams); + + //--------------------------------------- + /** @short validate new detected document and add it into the internal + document list. + + @descr This method should be called only, if its clear that a new + document was opened/created during office runtime. + This method checks, if its a top level document (means not an embedded one). + Only such top level documents can be recognized by this auto save mechanism. + + @param xDocument + the new document, which should be checked and registered. + + @threadsafe + */ + void implts_registerDocument(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + /** @short remove the specified document from our internal document list. + + @param xDocument + the new document, which should be deregistered. + + @param bStopListening + FALSE: must be used in case this method is called withion disposing() of the document, + where it make no sense to deregister our listener. The container dies ... + TRUE : must be used in case this method is used on "dergistration" of this document, where + we must deregister our listener .-) + + @threadsafe + */ + void implts_deregisterDocument(const css::uno::Reference< css::frame::XModel >& xDocument , + sal_Bool bStopListening = sal_True); + + //--------------------------------------- + // TODO document me + void implts_markDocumentModifiedAgainstLastBackup(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + // TODO document me + void implts_actualizeModifiedState(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + // TODO document me + void implts_updateDocumentUsedForSavingState(const css::uno::Reference< css::frame::XModel >& xDocument , + sal_Bool bSaveInProgress); + + //--------------------------------------- + // TODO document me + void implts_markDocumentAsSaved(const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + /** @short search a document inside given list. + + @param rList + reference to a vector, which can contain such + document. + + @param xDocument + the document, which should be located inside the + given list. + + @return [TDocumentList::iterator] + which points to the located document. + If document does not exists - its set to + rList.end()! + */ + static TDocumentList::iterator impl_searchDocument( AutoRecovery::TDocumentList& rList , + const css::uno::Reference< css::frame::XModel >& xDocument); + + //--------------------------------------- + /** TODO document me */ + void implts_changeAllDocVisibility(sal_Bool bVisible); + void implts_prepareSessionShutdown(); + + //--------------------------------------- + /** @short save all current opened documents to a specific + backup directory. + + @descr Only realy changed documents will be saved here. + + Further this method returns a suggestion, if and how it should + be called again. May be some documents was not saved yet + and must wait for an user idle period ... + + @param bAllowUserIdleLoop + Because this method is used for different uses cases, it must + know, which actions are allowed or not. + AUTO_SAVE => + If a document is the most active one, saving it + will be postponed if there exists other unsaved + documents. This feature was implemented, because + we dont wish to disturb the user on it's work. + ... bAllowUserIdleLoop should be set to TRUE + EMERGENCY_SAVE / SESSION_SAVE => + Here we must finish our work ASAP! It's not allowed + to postpone any document. + ... bAllowUserIdleLoop must(!) be set to FALSE + + @param pParams + sometimes this method is required inside an external dispatch request. + The it contains some special environment variables, which overwrites + our normal environment. + AutoSave => pParams == 0 + SessionSave/CrashSave => pParams != 0 + + @return A suggestion, how the timer (if its not already disabled!) + should be restarted to full fill the requirements. + + @threadsafe + */ + AutoRecovery::ETimerType implts_saveDocs( sal_Bool bAllowUserIdleLoop, + sal_Bool bRemoveLockFiles, + const DispatchParams* pParams = 0); + + //--------------------------------------- + /** @short save one of the current documents to a specific + backup directory. + + @descr It: + - defines a new(!) unique temp file name + - save the new temp file + - remove the old temp file + - patch the given info struct + - and return errors. + + It does not: + - patch the configuration. + + Note further: It paches the info struct + more then ones. E.g. the new temp URL is set + before the file is saved. And the old URL is removed + only if removing oft he old file was successfully. + If this method returns without an exception - everything + was OK. Otherwhise the info struct can be analyzed to + get more information, e.g. when the problem occures. + + @param sBackupPath + the base path for saving such temp files. + + @param rInfo + points to an informations structure, where + e.g. the document, its modified state, the count + of autosave-retries etcpp. exists. + Its used also to return the new temp file name + and some other state values! + + @threadsafe + */ + void implts_saveOneDoc(const ::rtl::OUString& sBackupPath , + AutoRecovery::TDocumentInfo& rInfo , + const css::uno::Reference< css::task::XStatusIndicator >& xExternalProgress); + + //--------------------------------------- + /** @short recovery all documents, which was saved during + a crash before. + + @return A suggestion, how this method must be called back! + + @threadsafe + */ + AutoRecovery::ETimerType implts_openDocs(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_openOneDoc(const ::rtl::OUString& sURL , + ::comphelper::MediaDescriptor& lDescriptor, + AutoRecovery::TDocumentInfo& rInfo ); + + //--------------------------------------- + // TODO document me + void implts_generateNewTempURL(const ::rtl::OUString& sBackupPath , + ::comphelper::MediaDescriptor& rMediaDescriptor, + AutoRecovery::TDocumentInfo& rInfo ); + + //--------------------------------------- + /** @short notifies all interested listener about the current state + of the currently running operation. + + @descr We support different set's of functions. AUTO_SAVE, EMERGENCY_SAVE, + AUTO_RECOVERY, FAILURE_SAVE ... etcpp. + Listener can register itself for any type of supported + functionality ... but not for document URL's in special. + + @param eJob + is used to know, which set of listener we must notify. + + @param aEvent + describe the event more in detail. + + @threadsafe + */ + void implts_informListener( sal_Int32 eJob , + const css::frame::FeatureStateEvent& aEvent); + + //--------------------------------------- + /** short create a feature event struct, which can be send + to any interested listener. + + @param eJob + describe the current running operation + AUTOSAVE, EMERGENCYSAVE, RECOVERY + + @param sEventType + describe the type of this event + START, STOP, UPDATE + + @param pInfo + if sOperation is an update, this parameter must be different from NULL + and is used to send informations regarding the current handled document. + + @return [css::frame::FeatureStateEvent] + the event structure for sending. + */ + static css::frame::FeatureStateEvent implst_createFeatureStateEvent( sal_Int32 eJob , + const ::rtl::OUString& sEventType, + AutoRecovery::TDocumentInfo* pInfo ); + + //--------------------------------------- + + // TODO document me + void implts_resetHandleStates(sal_Bool bLoadCache); + + //--------------------------------------- + // TODO document me + void implts_specifyDefaultFilterAndExtension(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + // TODO document me + void implts_specifyAppModuleAndFactoryURL(AutoRecovery::TDocumentInfo& rInfo); + + //--------------------------------------- + // TODO document me + void implts_prepareEmergencySave(); + + //--------------------------------------- + // TODO document me + void implts_doEmergencySave(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doRecovery(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doSessionSave(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_doSessionRestore(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_backupWorkingEntry(const DispatchParams& aParams); + + //--------------------------------------- + // TODO document me + void implts_cleanUpWorkingEntry(const DispatchParams& aParams); + + //--------------------------------------- + /** try to make sure that all changed config items (not our used + config access only) will be flushed back to disc. + + E.g. our svtools::ConfigItems() has to be flushed explicitly .-( + + Note: This method cant fail. Flushing of config entries is an + optional feature. Errors can be ignored. + */ + void impl_flushALLConfigChanges(); + + //--------------------------------------- + // TODO document me + AutoRecovery::EFailureSafeResult implts_copyFile(const ::rtl::OUString& sSource , + const ::rtl::OUString& sTargetPath, + const ::rtl::OUString& sTargetName); + + //--------------------------------------- + /** @short converts m_eJob into a job description, which + can be used to inform an outside listener + about the current running operation + + @param eJob + describe the current running operation + AUTOSAVE, EMERGENCYSAVE, RECOVERY + + @return [string] + a suitable job description of form: + vnd.sun.star.autorecovery:/do... + */ + static ::rtl::OUString implst_getJobDescription(sal_Int32 eJob); + + //--------------------------------------- + /** @short mape the given URL to an internal int representation. + + @param aURL + the url, which describe the next starting or may be already running + operation. + + @return [long] + the internal int representation + see enum EJob + */ + static sal_Int32 implst_classifyJob(const css::util::URL& aURL); + + /// TODO + void implts_verifyCacheAgainstDesktopDocumentList(); + + /// TODO document me + sal_Bool impl_enoughDiscSpace(sal_Int32 nRequiredSpace); + + /// TODO document me + static void impl_showFullDiscError(); + + //--------------------------------------- + /** @short try to create/use a progress and set it inside the + environment. + + @descr The problem behind: There exists different use case of this method. + a) An external progress is provided by our CrashSave or Recovery dialog. + b) We must create our own progress e.g. for an AutoSave + c) Sometimes our application filters dont use the progress + provided by the MediaDescriptor. They uses the Frame everytime to create + it's own progress. So we implemented a HACK for these and now we set + an InterceptedProgress there for the time WE use this frame for loading/storing documents .-) + + @param xNewFrame + must be set only in case WE create a new frame (e.g. for loading documents + on session restore or recovery). Then search for a frame using rInfo.Document must + be supressed and xFrame must be preferred instead .-) + + @param rInfo + used e.g. to find the frame corresponding to a document. + This frame must be used to create a new progress e.g. for an AutoSave. + + @param rArgs + is used to set the new created progress as parameter on these set. + */ + void impl_establishProgress(const AutoRecovery::TDocumentInfo& rInfo , + ::comphelper::MediaDescriptor& rArgs , + const css::uno::Reference< css::frame::XFrame >& xNewFrame); + + void impl_forgetProgress(const AutoRecovery::TDocumentInfo& rInfo , + ::comphelper::MediaDescriptor& rArgs , + const css::uno::Reference< css::frame::XFrame >& xNewFrame); + + //--------------------------------------- + /** try to remove the specified file from disc. + + Every URL supported by our UCB component can be used here. + Further it doesnt matter if the file realy exists or not. + Because removing a non exsistent file will have the same + result at the end ... a non existing file .-) + + On the other side removing of files from disc is an optional + feature. If we are not able doing so ... its not a real problem. + Ok - users disc place will be samller then ... but we should produce + a crash during crash save because we cant delete a temporary file only ! + + @param sURL + the url of the file, which should be removed. + */ + static void st_impl_removeFile(const ::rtl::OUString& sURL); + + //--------------------------------------- + /** try to remove ".lock" file from disc if office will be terminated + not using the offical way .-) + + This method has to be handled "optional". So every error inside + has to be ignored ! This method CANT FAIL ... it can forget something only .-) + */ + static void st_impl_removeLockFile(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_AUTORECOVERY_HXX_ diff --git a/framework/inc/services/backingcomp.hxx b/framework/inc/services/backingcomp.hxx new file mode 100644 index 000000000000..49d669727472 --- /dev/null +++ b/framework/inc/services/backingcomp.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: backingcomp.hxx,v $ + * + * $Revision: 1.9 $ + * + * 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 __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_ +#define __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_ + +//__________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <general.h> +#include <stdtypes.h> + +//__________________________________________ +// interface includes +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XKeyListener.hpp> + +#ifndef _COM_SUN_STAR_FAME_XFRAME_HPP_ +#include <com/sun/star/frame/XFrame.hpp> +#endif + +#ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDROPTARGETELISTENER_HPP_ +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#endif +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//__________________________________________ +// other includes +#include <cppuhelper/weak.hxx> + +//__________________________________________ +// definition + +namespace framework +{ + +//__________________________________________ +/** + implements the backing component. + + This component is a special one, which doesn't provide a controller + nor a model. It supports the following features: + - Drag & Drop + - Key Accelerators + - Simple Menu + - Progress Bar + - Background + */ +class BackingComp : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XInitialization + , public css::frame::XController // => XComponent + , public css::awt::XKeyListener // => XEventListener + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //______________________________________ + // member + + private: + + /** the global uno service manager. + Must be used to create own needed services. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** reference to the component window. */ + css::uno::Reference< css::awt::XWindow > m_xWindow; + + /** the owner frame of this component. */ + css::uno::Reference< css::frame::XFrame > m_xFrame; + + /** helper for drag&drop. */ + css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > m_xDropTargetListener; + + //______________________________________ + // interface + + public: + + BackingComp( const css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR ); + virtual ~BackingComp( ); + + // XInterface + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) throw(css::uno::RuntimeException); + virtual void SAL_CALL acquire ( ) throw( ); + virtual void SAL_CALL release ( ) throw( ); + + // XTypeProvide + virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes () throw(css::uno::RuntimeException); + virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(css::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName ( ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService ( const ::rtl::OUString& sServiceName ) throw(css::uno::RuntimeException); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(css::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& lArgs ) throw(css::uno::Exception, css::uno::RuntimeException); + + // XController + virtual void SAL_CALL attachFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL attachModel ( const css::uno::Reference< css::frame::XModel >& xModel ) throw(css::uno::RuntimeException); + virtual sal_Bool SAL_CALL suspend ( sal_Bool bSuspend ) throw(css::uno::RuntimeException); + virtual css::uno::Any SAL_CALL getViewData ( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL restoreViewData( const css::uno::Any& aData ) throw(css::uno::RuntimeException); + virtual css::uno::Reference< css::frame::XModel > SAL_CALL getModel ( ) throw(css::uno::RuntimeException); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getFrame ( ) throw(css::uno::RuntimeException); + + // XKeyListener + virtual void SAL_CALL keyPressed ( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException); + virtual void SAL_CALL keyReleased( const css::awt::KeyEvent& aEvent ) throw(css::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw(css::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose ( ) throw(css::uno::RuntimeException); + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw(css::uno::RuntimeException); + + //______________________________________ + // helper + + public: + + static css::uno::Sequence< ::rtl::OUString > SAL_CALL impl_getStaticSupportedServiceNames( ); + static ::rtl::OUString SAL_CALL impl_getStaticImplementationName ( ); + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ) throw( css::uno::Exception ); + static css::uno::Reference< css::lang::XSingleServiceFactory > SAL_CALL impl_createFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_BACKINGCOMP_HXX_ diff --git a/framework/inc/services/contenthandlerfactory.hxx b/framework/inc/services/contenthandlerfactory.hxx new file mode 100644 index 000000000000..e66db2ce1723 --- /dev/null +++ b/framework/inc/services/contenthandlerfactory.hxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: contenthandlerfactory.hxx,v $ + * $Revision: 1.4 $ + * + * 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 __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/filtercache.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/container/ElementExistException.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short factory to create handler-objects + @descr These class can be used to create new handler for specified contents. + We use cached values of our configuration to lay down, which handler match + a given URL or handlername. (use service TypeDetection to do that) + With a detected type name you can search a registered handler and create it with these factory. + + @implements XInterface + XTypeProvider + XServiceInfo + XMultiServiceFactory + XNameContainer + XNameReplace + XNameAccess + XElementAccess + XFlushable + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ + +class ContentHandlerFactory : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::lang::XMultiServiceFactory , + public css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess + public css::util::XFlushable , + // base classes + // Order is neccessary for right initialization of it! + private ThreadHelpBase , + private TransactionBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + ContentHandlerFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~ContentHandlerFactory( ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XMultiServiceFactory + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance ( const ::rtl::OUString& sTypeName ) throw( css::uno::Exception , + css::uno::RuntimeException ); + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& lArguments ) throw( css::uno::Exception, css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames ( ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameContainer + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL insertByName( const ::rtl::OUString& sHandlerName , + const css::uno::Any& aHandlerProperties ) throw( css::lang::IllegalArgumentException , + css::container::ElementExistException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + virtual void SAL_CALL removeByName( const ::rtl::OUString& sHandlerName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameReplace + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL replaceByName( const ::rtl::OUString& sHandlerName , + const css::uno::Any& aHandlerProperties ) throw( css::lang::IllegalArgumentException , + css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Any SAL_CALL getByName ( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements () throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFlushable + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL flush ( ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL addFlushListener ( const css::uno::Reference< css::util::XFlushListener >& xListener ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) throw ( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool implcp_ContentHandlerFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool implcp_createInstanceWithArguments ( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& lArguments ); + static sal_Bool implcp_getByName ( const ::rtl::OUString& sName ); + static sal_Bool implcp_hasByName ( const ::rtl::OUString& sName ); + static sal_Bool implcp_removeByName ( const ::rtl::OUString& sHandlerName ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; + FilterCache m_aCache ; +// ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; + +}; // class ContentHandlerFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_CONTENTHANDLERFACTORY_HXX_ diff --git a/framework/inc/services/desktop.hxx b/framework/inc/services/desktop.hxx new file mode 100644 index 000000000000..92c575c7b5b5 --- /dev/null +++ b/framework/inc/services/desktop.hxx @@ -0,0 +1,517 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: desktop.hxx,v $ + * + * $Revision: 1.25 $ + * + * 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 __FRAMEWORK_SERVICES_DESKTOP_HXX_ +#define __FRAMEWORK_SERVICES_DESKTOP_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <helper/oframes.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/frame/XUntitledNumbers.hpp> + +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/frame/WindowArrange.hpp> +#include <com/sun/star/frame/TerminationVetoException.hpp> +#include <com/sun/star/frame/XTerminateListener.hpp> +#include <com/sun/star/frame/XWindowArranger.hpp> +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/FrameAction.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/frame/XTasksSupplier.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/task/XInteractionHandler.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <svtools/cmdoptions.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +#include <comphelper/numberedcollection.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +enum ELoadState +{ + E_NOTSET , + E_SUCCESSFUL , + E_FAILED , + E_INTERACTION +}; + +/*-************************************************************************************************************//** + @short implement the topframe of frame tree + @descr This is the root of the frame tree. The desktop has no window, is not visible but he is the logical + "masternode" to build the hierarchy. + + @implements XInterface + XTypeProvider + XServiceInfo + XDesktop + XComponentLoader + XTasksSupplier + XDispatchProvider + XFramesSupplier + XFrame + XComponent + XPropertySet + XFastPropertySet + XMultiPropertySet + XDispatchResultListener + XEventListener + XInteractionHandler + + @base ThreadHelpBase + TransactionBase + OBroadcastHelper + OPropertySetHelper + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ +class Desktop : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XDesktop , + public css::frame::XComponentLoader , + public css::frame::XTasksSupplier , + public css::frame::XDispatchProvider , + public css::frame::XDispatchProviderInterception, + public css::frame::XFramesSupplier , // => XFrame => XComponent + public css::frame::XDispatchResultListener , // => XEventListener + public css::task::XInteractionHandler , + public css::frame::XUntitledNumbers , + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , + private TransactionBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + // internal used types, const etcpp. + private: + + //--------------------------------------------------------------------- + /** used temporary to know which listener was already called or not. */ + typedef ::std::vector< css::uno::Reference< css::frame::XTerminateListener > > TTerminateListenerList; + + // public methods + public: + + // constructor / destructor + Desktop( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~Desktop( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------- + /** + @interface XDesktop + + @short try to shutdown these desktop environment. + + @descr Will try to close all frames. If at least one frame could + not be closed successfully termination will be stopped. + + Registered termination listener will be taken into account + also. As special feature some of our registered listener + are well known by it's UNO implementation name. They are handled + different to all other listener. + + Btw: Desktop.terminate() was designed in the past to be used + within an UI based envrionment. So it's allowed e.g. to + call XController.suspend() here. If UI isnt an option ... please + use XCloseable.close() at these desktop implementation. + ... if it will be supported in the future .-)) + + @seealso XTerminateListener + @seealso XTerminateListener2 + + @return true if all open frames could be closed and no listener throwed + a veto exception; false otherwise. + + @onerror False will be returned. + @threadsafe yes + */ + virtual ::sal_Bool SAL_CALL terminate() + throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------- + /** + @interface XDesktop + + @short add a listener for termination events + + @descr Additional to adding normal listener these method was implemented special. + Every listener will be asked for it's uno implementation name. + Some of them are well known ... and the corresponding listener wont be added + to the container of "normal listener". Those listener will be set as special + member. + see e.g. member m_xSfxTerminator + + @seealso terminate() + + @param xListener + the listener for registration. + + @threadsafe yes + */ + virtual void SAL_CALL addTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) + throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------- + /** + @interface XDesktop + + @short remove a listener from this container. + + @descr Additional to removing normal listener these method was implemented special. + Every listener will be asked for it's uno implementation name. + Some of them are well known ... and the corresponding listener was set as special member. + Now those special member will be reseted also. + see e.g. member m_xSfxTerminator + + @seealso terminate() + + @param xListener + the listener for deregistration. + + @threadsafe yes + */ + virtual void SAL_CALL removeTerminateListener( const css::uno::Reference< css::frame::XTerminateListener >& xListener ) + throw( css::uno::RuntimeException ); + + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getComponents ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL getCurrentComponent ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getCurrentFrame ( ) throw( css::uno::RuntimeException ); + + // XComponentLoader + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const ::rtl::OUString& sURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::io::IOException , + css::lang::IllegalArgumentException , + css::uno::RuntimeException ); + + // XTasksSupplier + virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTasks ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XTask > SAL_CALL getActiveTask ( ) throw( css::uno::RuntimeException ); + + // XDispatchProvider + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lQueries ) throw( css::uno::RuntimeException ); + + // XDispatchProviderInterception + virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) throw( css::uno::RuntimeException); + virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) throw( css::uno::RuntimeException); + + // XFramesSupplier + virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + // XFrame + // Attention: findFrame() is implemented only! Other methods make no sense for our desktop! + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) throw( css::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getName ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setName ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isTop ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL activate ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL deactivate ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isActive ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL contextChanged ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + + // XComponent + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL dispose ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + + // XDispatchResultListener + virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) throw( css::uno::RuntimeException ); + + // XEventListener + virtual void SAL_CALL disposing ( const css::lang::EventObject& aSource ) throw( css::uno::RuntimeException ); + + // XInteractionHandler + virtual void SAL_CALL handle ( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) throw( css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual ::sal_Int32 SAL_CALL leaseNumber( const css::uno::Reference< css::uno::XInterface >& xComponent ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumber( ::sal_Int32 nNumber ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual void SAL_CALL releaseNumberForComponent( const css::uno::Reference< css::uno::XInterface >& xComponent ) + throw (css::lang::IllegalArgumentException, + css::uno::RuntimeException ); + + // css.frame.XUntitledNumbers + virtual ::rtl::OUString SAL_CALL getUntitledPrefix() + throw (css::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::lang::IllegalArgumentException ); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::uno::Exception ); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue , + sal_Int32 nHandle ) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) throw (css::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + private: + + css::uno::Reference< css::lang::XComponent > impl_getFrameComponent ( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; + static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor( ); + + //--------------------------------------------------------------------- + /** calls queryTermination() on every registered termination listener. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + * + * @param [out] lCalledListener + * every called listener will be returned here. + * Those list will be used to informa all called listener + * about cancel this termination request. + * + * @param [out] bVeto + * will be true if at least one listener throwed a veto exception; + * false otherwise. + * + * @see impl_sendCancelTerminationEvent() + */ + void impl_sendQueryTerminationEvent(TTerminateListenerList& lCalledListener, + ::sal_Bool& bVeto ); + + //--------------------------------------------------------------------- + /** calls cancelTermination() on every termination listener + * where queryTermination() was called before. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + * + * @param [in] lCalledListener + * every listener in this list was called within its method + * queryTermination() before. + * + * @see impl_sendQueryTerminationEvent() + */ + void impl_sendCancelTerminationEvent(const TTerminateListenerList& lCalledListener); + + //--------------------------------------------------------------------- + /** calls notifyTermination() on every registered termination listener. + * + * Note: Only normal termination listener (registered in list m_aListenerContainer + * will be recognized here. Special listener like quick starter, pipe or others + * has to be handled explicitly ! + */ + void impl_sendNotifyTerminationEvent(); + + //--------------------------------------------------------------------- + /** try to close all open frames. + * + * Iterates over all child frames and try to close them. + * Given parameter bAllowUI enable/disable showing any UI + * (which mostly occure on calling XController->suspend()). + * + * These method doesnt stop if one frame could not be closed. + * It will ignore such frames and try all other ones. + * But it returns false in such case - true otherwise. + * + * @param bAllowUI + * enable/disable showing of UI. + * + * @return true if all frames could be closed; false otherwise. + */ + ::sal_Bool impl_closeFrames(::sal_Bool bAllowUI); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everytime!) + //------------------------------------------------------------------------------------------------------------- + #ifdef ENABLE_ASSERTIONS + private: + + static sal_Bool implcp_ctor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool implcp_addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + static sal_Bool implcp_removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + + sal_Bool m_bIsTerminated ; /// check flag to protect us against dispose before terminate! + /// see dispose() for further informations! + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everytime!) + //------------------------------------------------------------------------------------------------------------- + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has create this instance + FrameContainer m_aChildTaskContainer ; /// array of child tasks (childs of desktop are tasks; and tasks are also frames - But pure frames are not accepted!) + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; /// container for ALL Listener + css::uno::Reference< css::frame::XFrames > m_xFramesHelper ; /// helper for XFrames, XIndexAccess, XElementAccess and implementation of a childcontainer! + css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper ; /// helper to dispatch something for new tasks, created by "_blank"! + ELoadState m_eLoadState ; /// hold information about state of asynchron loading of component for loadComponentFromURL()! + css::uno::Reference< css::frame::XFrame > m_xLastFrame ; /// last target of "loadComponentFromURL()"! + css::uno::Any m_aInteractionRequest ; + sal_Bool m_bSuspendQuickstartVeto ; /// don't ask quickstart for a veto + SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file + ::rtl::OUString m_sName ; + ::rtl::OUString m_sTitle ; + css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier ; + + //--------------------------------------------------------------------- + /** special terminate listener to close pipe and block external requests + * during/after termination process is/was running + */ + css::uno::Reference< css::frame::XTerminateListener > m_xPipeTerminator; + + //--------------------------------------------------------------------- + /** special terminate listener shown inside system tray (quick starter) + * Will hinder the office on shutdown ... but wish to allow closing + * of open documents. And because thats different to a normal terminate listener + * it has to be handled special .-) + */ + css::uno::Reference< css::frame::XTerminateListener > m_xQuickLauncher; + + //--------------------------------------------------------------------- + /** special terminate listener which loads images asynchronous for current open documents. + * Because internaly it uses blocking system APIs ... it cant be guaranteed that + * running jobs can be cancelled successfully if the corressponding document will be closed ... + * it will not hinder those documents on closing. Instead it let all jobs running ... + * but at least on terminate we have to wait for all those blocked requests. + * So these implementation must be a special terminate listener too .-( + */ + css::uno::Reference< css::frame::XTerminateListener > m_xSWThreadManager; + + //--------------------------------------------------------------------- + /** special terminate listener shuting down the SfxApplication. + * Because these desktop instance closes documents and informs listener + * only ... it does not realy shutdown the whole application. + * + * Btw: That wouldnt be possible by design ... because Desktop.terminate() + * has to return a boolean value about success ... it cant realy shutdown the + * process .-) + * + * So we uses a trick: A special listener (exactly these one here) listen for notifyTermination() + * and shutdown the process asynchronous. But desktop has to make this special + * notification as realy last one ... Otherwhise it can happen that asynchronous + * shutdown will be faster then all other code around Desktop.terminate() .-)) + */ + css::uno::Reference< css::frame::XTerminateListener > m_xSfxTerminator; + + css::uno::Reference< css::frame::XUntitledNumbers > m_xTitleNumberGenerator; + +}; // class Desktop + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_DESKTOP_HXX_ diff --git a/framework/inc/services/detectorfactory.hxx b/framework/inc/services/detectorfactory.hxx new file mode 100644 index 000000000000..db51336632e1 --- /dev/null +++ b/framework/inc/services/detectorfactory.hxx @@ -0,0 +1,464 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: detectorfactory.hxx,v $ + * $Revision: 1.4 $ + * + * 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 __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_ + +//_______________________________________________ +// includes of own project + +#include <classes/filtercache.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_______________________________________________ +// includes of interfaces +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/container/ElementExistException.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +//_______________________________________________ +// includes of other projects +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/// @HTML +/** @short factory to create detect service objects and initialize it in the right way. + + @descr This class can be used to create new detect services for specified contents. + It uses cached values of the configuration to lay down, which detector match + a given name. Further this class provides full access to the configuration data + of such detect services and following implementations will support some special + query modes. + + @author as96863 + + @docdate 07.03.2003 by as96863 + + @todo <ul> + <li>implementation of query mode</li> + <li>simple restore mechanism of last consistent cache state, + if flush failed</li> + </ul> + */ +/// @NOHTML + +class DetectorFactory : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::lang::XMultiServiceFactory , + public css::container::XNameContainer , // => XNameReplace => XNameAccess => XElementAccess + public css::util::XFlushable , + // base classes + // Order is neccessary for right initialization of it! + private ThreadHelpBase , + public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + /** reference to the global uno service manager. + It will be used to create own needed services on demand. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** singleton, which contains all needed configuration data and provides + read/write access on it. */ + FilterCache m_aCache; + + /** contains all registered listener. */ + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + #ifdef ENABLE_AUTODOC_FIX + ; + #endif + + //--------------------------------------- + + /** @short initialize new instance of this class. + + @param xSMGR + reference to the global uno service manager, which created this new factory instance. + It must be used during runtime to create own needed services. + */ + + DetectorFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + + //--------------------------------------- + + /** @short release internal structures. + */ + + virtual ~DetectorFactory(); + + //--------------------------------------- + // XMultiServiceFactory + + /** @short create a new detect service and initialize it with it's own configuration data. + + @param sName + means the uno implementation name of a detect service. + + @exception com::sun::star::uno::Exception + if the requested service could not be created or initialized. + */ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& sName ) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //--------------------------------------- + // XMultiServiceFactory + + /** @short does the same as createInstance() method, but initialize created detect service with some + additional data. + + @param sName + means the uno implementation name of a detect service. + + @param lArguments + the optional arguments, which are passed to the created detect service against + it's own configuration data. + + @exception com::sun::star::uno::Exception + if the requested service could not be created or initialized. + */ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sName , + const css::uno::Sequence< css::uno::Any >& lArguments ) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //--------------------------------------- + // XMultiServiceFactory + + /** @short return list of all well know detect services, which can be created by this factory. + + @attention Because this service implements read/write access to the configuration too, + this list is dynamic. Means: in multithreaded environments some items of this + return list could be invalid next time! + + @return A list of all registered detect services. + */ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XNameContainer + + /** @short add new detect service entry to this container. + + @descr This will change all internal structures only! + Updating of the configuration layer and notify of all registered + listener will be done inside API call XFlushable::flush() on this + container. + + @param sName + means the uno implementation name of this new detect service entry. + + @param aPropertySet [sequence< com::sun::star::beans::PropertyValue >!] + describe this new entry. For a list of all supported properties + have a look on method >>getByName()<<. + Note: Missing values will be created with defaults! + + @exception com::sun::star::lang::IllegalArgumentException + if one of the incoming parameters seams to be invalid. + That doesn't include the check, if this item already exist! + + @exception com::sun::star::container::ElementExistException + if this item already exist inside this container. + + @exception com::sun::star::lang::WrappedTargetException + f creation of the internal structures failed. + */ + + virtual void SAL_CALL insertByName( const ::rtl::OUString& sName , + const css::uno::Any& aPropertySet ) + throw(css::lang::IllegalArgumentException , + css::container::ElementExistException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameContainer + + /** @short remove a detect service entry from this container. + + @descr This will change all internal structures only! + Updating of the configuration layer and notify of all registered + listener will be done inside API call XFlushable::flush() on this + container. + + @param sName + means the uno implementation name of a detect service entry. + + @exception com::sun::star::container::NoSuchElementException + if the requested item does not exist inside this container. + + @exception com::sun::star::lang::WrappedTargetException + if creation of the internal structures failed. + */ + + virtual void SAL_CALL removeByName( const ::rtl::OUString& sName ) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameReplace + + /** @short change a detect service entry inside this container. + + @descr This will change all internal structures only! + Updating of the configuration layer and notify of all registered + listener will be done inside API call XFlushable::flush() on this + container. + + @param sName + means the uno implementation name of a detect service entry. + + @param aPropertySet [sequence< com::sun::star::beans::PropertyValue >!] + describe the changes on this entry. For a list of all supported properties + have a look on method getByName(). + Note: Missing properties will be untouched. + + @exception com::sun::star::lang::IllegalArgumentException + if one of the incoming parameters seams to be invalid. + That doesn't include the check, if this item exist! + + @exception com::sun::star::container::NoSuchElementException + if the requested item does not exist inside this container. + + @exception com::sun::star::lang::WrappedTargetException + if updating of the internal structures failed. + */ + + virtual void SAL_CALL replaceByName( const ::rtl::OUString& sName , + const css::uno::Any& aPropertySet ) + throw(css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameAccess + + /// @HTML + /** @short return properties of queried detector item. + + @descr Use this method to get all informations about a detector item of this cache. + A sequence< com::sun::star::beans::PropertyValue > packed inside an Any will be returned. + Following properties are defined: + <table border=1> + <tr> + <td><b>Property</b></td> + <td><b>Value<b></td> + <td><b>Description<b></td> + </tr> + <tr> + <td>Name</td> + <td>[string]</td> + <td>the uno implementation name for this detect service</td> + </tr> + <tr> + <td>Types</td> + <td>[sequence< string >]</td> + <td>a list of all internbal type names, which this detect service is registered for</td> + </tr> + </table> + + @param sName + the uno implementation name the requested detector. + + @return A property set, which describe this detect service. + It uses a sequence< com::sun::star::beans::PropertyValue > internaly. + + @exception com::sun::star::container::NoSuchElementException + if the requested entry does not exist inside this container. + */ + /// @NOHTML + + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------- + // XNameAccess + + /** @short return list of all well know container entries available on this container. + + @attention Because this service implements read/write access to the configuration too, + this list is dynamic. Means: in multithreaded environments some items of this + return list could be invalid next time! + + @return A list of all well known container items. + */ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XNameAccess + + /** @short check if searched entry exist inside this container. + + @attention In multithreaded environments it's not guaranteed, that a + queried item exist next time realy! It can be deleted by + another thread ... + + @param sName + the name of the queried container entry. + + @return TRUE if the requested item exist; FALSE otherwise. + */ + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XElementAccess + + /** @short return the uno type, which is used for all container items. + + @return Type of sequence< com::sun::star::beans::PropertyValue > everytime - because it's fix. + */ + + virtual css::uno::Type SAL_CALL getElementType() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XElementAccess + + /** @short return fill state of this cache. + + @return TRUE if any item exist inside this conatiner; FALSE otherwhise. + */ + + virtual sal_Bool SAL_CALL hasElements() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XFlushable + + /** @short update the configuration layer and notify all registered listener. + + @descr All container interface methods update the internal structures of + this container only. But the underlying configuration layer and + may some possible other caches was not updated. + Calling of flush() will do that. + At the same time all currently registered flush listener will be informed, + so they can update her structures too. + Note: Before all these operations are started realy, all changes will be + verified and if neccessary some corrections will be done. + In case the cache will be invalid and could not be repaired an exception is thrown! + Normaly this container will not work correctly afterwards ... + + @exception com::sun::star::uno::RuntimeException + if the changes on this container was invald and could not be repaired. + */ + + virtual void SAL_CALL flush() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XFlushable + + /** @short register listener for container updates. + + @param xListener + reference to listener, which wish to be registered. + + @exception com::sun::star::uno::RuntimeException + if the given listener is an invalid reference. + Note: multiple calls of this method for the same listener won't be checked! + */ + + virtual void SAL_CALL addFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XFlushable + + /** @short deregister listener for container updates. + + @param xListener + reference to listener, which wish to be deregistered. + + @exception com::sun::star::uno::RuntimeException + if the given listener is an invalid reference. + Note: multiple calls of this method for the same listener won't be checked! + */ + + virtual void SAL_CALL removeFlushListener( const css::uno::Reference< css::util::XFlushListener >& xListener ) + throw(css::uno::RuntimeException); + +}; // class DetectorFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_DETECTORFACTORY_HXX_ diff --git a/framework/inc/services/dispatchhelper.hxx b/framework/inc/services/dispatchhelper.hxx new file mode 100644 index 000000000000..31304a212fd0 --- /dev/null +++ b/framework/inc/services/dispatchhelper.hxx @@ -0,0 +1,138 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: dispatchhelper.hxx,v $ + * $Revision: 1.5 $ + * + * 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 __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_ +#define __FRAMEWORK_SERVICES_DISPATCHHELPER_HXX_ + +//_______________________________________________ +// my own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/DispatchResultEvent.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/implbase3.hxx> +#include <osl/conditn.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/** + @short implements an easy way for dispatches + @descr Dispatches are splitted into different parts: + - parsing of the URL + - searching for a dispatcgh object + - dispatching of the URL + All these steps are done inside one method call here. +*/ + +class DispatchHelper : public ThreadHelpBase // must be the first base class! + ,public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::frame::XDispatchHelper,::com::sun::star::frame::XDispatchResultListener > +{ + + //------------------------------------------- + // member + + private: + + /** global uno service manager. + Can be used to create own needed services. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** used to wait for asynchronous listener callbacks. */ + ::osl::Condition m_aBlock; + + css::uno::Any m_aResult; + + css::uno::Reference< css::uno::XInterface > m_xBroadcaster; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + // ctor/dtor + + DispatchHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + virtual ~DispatchHelper( ); + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + + DECLARE_XSERVICEINFO + + //--------------------------------------- + // XDispatchHelper + virtual css::uno::Any SAL_CALL executeDispatch( + const css::uno::Reference< css::frame::XDispatchProvider >& xDispatchProvider , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XDispatchResultListener + virtual void SAL_CALL dispatchFinished( + const css::frame::DispatchResultEvent& aResult ) + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XEventListener + virtual void SAL_CALL disposing( + const css::lang::EventObject& aEvent ) + throw(css::uno::RuntimeException); +}; + +} + +#endif diff --git a/framework/inc/services/frame.hxx b/framework/inc/services/frame.hxx new file mode 100644 index 000000000000..32e83aed1974 --- /dev/null +++ b/framework/inc/services/frame.hxx @@ -0,0 +1,484 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: frame.hxx,v $ + * + * $Revision: 1.41.82.1 $ + * + * 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 __FRAMEWORK_SERVICES_FRAME_HXX_ +#define __FRAMEWORK_SERVICES_FRAME_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <classes/propertysethelper.hxx> +#include <threadhelp/resetableguard.hxx> +#include <threadhelp/writeguard.hxx> +#include <threadhelp/readguard.hxx> +#include <threadhelp/threadhelpbase.hxx> + +#ifndef __FRAMEWORK_THREADHELP_TRANSACTIONBASE_HXX_ +#include <threadhelp/transactionbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XDispatchInformationProvider.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProvider.hpp> +#include <com/sun/star/frame/XDispatchRecorderSupplier.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/awt/XTopWindowListener.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/awt/XFocusListener.hpp> +#include <com/sun/star/awt/FocusEvent.hpp> +#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <com/sun/star/document/XActionLockable.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <svtools/cmdoptions.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> +#include <rtl/string.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +// This enum can be used to set differnt active states of frames +enum EActiveState +{ + E_INACTIVE , // I'am not a member of active path in tree and i don't have the focus. + E_ACTIVE , // I'am in the middle of an active path in tree and i don't have the focus. + E_FOCUS // I have the focus now. I must a member of an active path! +}; + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements a normal frame of hierarchy + @descr An instance of these class can be a normal node in frame tree. A frame support influencing of his + subtree, find of subframes, activate- and deactivate-mechanism as well as + set/get of a frame window, component or controller. + + @attention This implementation supports three states: a)uninitialized, b)working, c)disposed + If you call wrong methods in modes a) or c) ... you will get some exceptions. + How you should work with this service: + i) create it by using "xServiceManager->createInstance(...)" + ii) call XInitialization::initialize() with a valid window reference or use createInstanceWithArguments() at i) + iii) works with object + iv) dispose object by calling XComponent::dispose() + After iv) all further requests are rejected by exceptions! (DisposedException) + + @base ThreadHelpBase + help to guarantee correct initialized lock member at startup + @base TransactionBase + help to implement unbreakable interface calls + @base OBroadcastHelper + OPropertySetHelper + implements the property set + @base OWeakObject + provides the refcount and XInterface, XWeak + + @devstatus ready to use + @threadsafe yes + @modified 04.10.2004 10:47, as96863 +*//*-*************************************************************************************************************/ +class Frame : // interfaces + public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::frame::XFramesSupplier , // => XFrame => XComponent + public css::frame::XDispatchProvider , + public css::frame::XDispatchProviderInterception , + public css::frame::XDispatchInformationProvider , + public css::task::XStatusIndicatorFactory , + public css::awt::XWindowListener , // => XEventListener + public css::awt::XTopWindowListener , + public css::awt::XFocusListener , + public css::document::XActionLockable , + public css::util::XCloseable , // => XCloseBroadcaster + public css::frame::XComponentLoader , + public css::frame::XTitle , + public css::frame::XTitleChangeBroadcaster , + // base classes + // Order is neccessary for right initialization of this class! + public ThreadHelpBase , + public TransactionBase , + public PropertySetHelper , // helper implements ThreadHelpbase, TransactionBase, XPropertySet, XPropertySetInfo + public ::cppu::OWeakObject // helper implements XInterface, XWeak +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + Frame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~Frame( ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XComponentLoader + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::lang::XComponent > SAL_CALL loadComponentFromURL ( const ::rtl::OUString& sURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags , + const css::uno::Sequence< css::beans::PropertyValue >& lArguments ) throw( css::io::IOException , + css::lang::IllegalArgumentException , + css::uno::RuntimeException ); + + + //--------------------------------------------------------------------------------------------------------- + // XFramesSupplier + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::frame::XFrames > SAL_CALL getFrames ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL getActiveFrame ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFrame + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL initialize ( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setCreator ( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator ( ) throw( css::uno::RuntimeException ); + virtual ::rtl::OUString SAL_CALL getName ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setName ( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame ( const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isTop ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL activate ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL deactivate ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL isActive ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL contextChanged ( ) throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL setComponent ( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow ( ) throw( css::uno::RuntimeException ); + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL dispose ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XStatusIndicatorFactory + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::task::XStatusIndicator > SAL_CALL createStatusIndicator ( ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProvider + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< + css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& lDescriptor ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProviderInterception + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL registerDispatchProviderInterceptor( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL releaseDispatchProviderInterceptor ( const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchInformationProvider + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Sequence< sal_Int16 > SAL_CALL getSupportedCommandGroups ( ) throw (css::uno::RuntimeException); + virtual css::uno::Sequence< css::frame::DispatchInformation > SAL_CALL getConfigurableDispatchInformation(sal_Int16 nCommandGroup) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + // Attention: windowResized() and windowShown() are implement only! All other are empty! + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowResized ( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowMoved ( const css::awt::WindowEvent& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowShown ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowHidden ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFocusListener + // Attention: focusLost() not implemented yet! + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL focusGained ( const css::awt::FocusEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL focusLost ( const css::awt::FocusEvent& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + // Attention: windowActivated(), windowDeactivated() and windowClosing() are implement only! All other are empty! + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowActivated ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowDeactivated ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowOpened ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowClosing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowClosed ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowMinimized ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + virtual void SAL_CALL windowNormalized ( const css::lang::EventObject& /*aEvent*/ ) throw( css::uno::RuntimeException ) {}; + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL disposing ( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XActionLockable + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL isActionLocked ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL addActionLock ( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL removeActionLock( ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL setActionLocks ( sal_Int16 nLock ) throw( css::uno::RuntimeException ); + virtual sal_Int16 SAL_CALL resetActionLocks( ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XCloseable + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL close( sal_Bool bDeliverOwnerShip ) throw( css::util::CloseVetoException, + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XCloseBroadcaster + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL addCloseListener ( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeCloseListener( const css::uno::Reference< css::util::XCloseListener >& xListener ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XTitle + //--------------------------------------------------------------------------------------------------------- + virtual ::rtl::OUString SAL_CALL getTitle( ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setTitle( const ::rtl::OUString& sTitle ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XTitleChangeBroadcaster + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL addTitleChangeListener ( const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeTitleChangeListener( const css::uno::Reference< css::frame::XTitleChangeListener >& xListenr ) throw (css::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // PropertySetHelper => XPropertySet, XPropertySetInfo + //--------------------------------------------------------------------------------------------------------- + private: + + void impl_initializePropInfo(); + + virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle , + const css::uno::Any& aValue ); + + virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short helper methods + @descr Follow methods are needed at different points of our code (more then ones!). + + @attention Threadsafe methods are signed by "implts_..."! + *//*-*****************************************************************************************************/ + + // threadsafe + void implts_sendFrameActionEvent ( const css::frame::FrameAction& aAction ); + void implts_resizeComponentWindow ( ); + void implts_setIconOnWindow ( ); + void implts_startWindowListening ( ); + void implts_stopWindowListening ( ); + void implts_saveWindowAttributes ( ); + void implts_checkSuicide ( ); + void implts_forgetSubFrames ( ); + DECL_LINK( implts_windowClosing, void* ); + css::uno::Reference< css::awt::XTopWindow > impl_searchTopWindow ( const css::uno::Reference< css::awt::XWindow >& xWindow ); + + // non threadsafe + void impl_checkMenuCloser ( ); + void impl_setCloser ( const css::uno::Reference< css::frame::XFrame >& xFrame , + sal_Bool bState ); + void impl_disposeContainerWindow ( css::uno::Reference< css::awt::XWindow >& xWindow ); + static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor( ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @attention This methods are static and can't use our member directly! It's better for threadsafe code... + because we call it with references or pointer to check variables ... and must make it safe + by himself! + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_True ,on invalid parameter + @return sal_False ,otherwise + + @onerror We return sal_True + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool implcp_ctor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool implcp_setActiveFrame ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static sal_Bool implcp_addFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ); + static sal_Bool implcp_removeFrameActionListener ( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ); + static sal_Bool implcp_addEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + static sal_Bool implcp_removeEventListener ( const css::uno::Reference< css::lang::XEventListener >& xListener ); + static sal_Bool implcp_windowResized ( const css::awt::WindowEvent& aEvent ); + static sal_Bool implcp_focusGained ( const css::awt::FocusEvent& aEvent ); + static sal_Bool implcp_windowActivated ( const css::lang::EventObject& aEvent ); + static sal_Bool implcp_windowDeactivated ( const css::lang::EventObject& aEvent ); + static sal_Bool implcp_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //************************************************************************************************************* + // variables + // -threadsafe by own read/write lock "m_aLock" + //************************************************************************************************************* + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has create this instance + css::uno::Reference< css::task::XStatusIndicatorFactory > m_xIndicatorFactoryHelper ; /// reference to factory helper to create status indicator objects + css::uno::WeakReference< css::task::XStatusIndicator > m_xIndicatorInterception ; /// points to an external set progress, which should be used instead of the internal one. + css::uno::Reference< css::frame::XDispatchProvider > m_xDispatchHelper ; /// helper for XDispatch/Provider and interception interfaces + css::uno::Reference< css::frame::XFrames > m_xFramesHelper ; /// helper for XFrames, XIndexAccess and XElementAccess interfaces + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer ; /// container for ALL Listener + css::uno::Reference< css::frame::XFramesSupplier > m_xParent ; /// parent of this frame + css::uno::Reference< css::awt::XWindow > m_xContainerWindow ; /// containerwindow of this frame for embedded components + css::uno::Reference< css::awt::XWindow > m_xComponentWindow ; /// window of the actual component + css::uno::Reference< css::frame::XController > m_xController ; /// controller of the actual frame + css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > m_xDropTargetListener ; /// listen to drag & drop + EActiveState m_eActiveState ; /// state, if i'am a member of active path in tree or i have the focus or ... + ::rtl::OUString m_sName ; /// name of this frame + sal_Bool m_bIsFrameTop ; /// frame has no parent or the parent is a taskor the desktop + sal_Bool m_bConnected ; /// due to FrameActionEvent + sal_Int16 m_nExternalLockCount ; + css::uno::Reference< css::frame::XDispatchRecorderSupplier > m_xDispatchRecorderSupplier ; /// is used for dispatch recording and will be set/get from outside. Frame provide it only! + SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file + sal_Bool m_bSelfClose ; /// in case of CloseVetoException on method close() wqs thrown by ourself - we must close ourself later if no internal processes are running + sal_Bool m_bIsHidden ; /// indicates, if this frame is used in hidden mode or not + static css::uno::WeakReference< css::frame::XFrame > m_xCloserFrame ; /// holds the only frame, which must show the special closer menu item (can be NULL!) + css::uno::Reference< ::com::sun::star::frame::XLayoutManager > m_xLayoutManager ; /// is used to layout the child windows of the frame. + css::uno::Reference< css::frame::XDispatchInformationProvider > m_xDispatchInfoHelper ; + css::uno::Reference< css::frame::XTitle > m_xTitleHelper ; + + protected: + + FrameContainer m_aChildFrameContainer ; /// array of child frames + + inline css::uno::Reference< css::lang::XMultiServiceFactory > impl_getFactory() + { + ReadGuard aReadLock( m_aLock ); + return m_xFactory; + } + + inline ::rtl::OUString impl_getName() + { + ReadGuard aReadLock( m_aLock ); + return m_sName; + } + + inline css::uno::Reference< css::awt::XWindow > impl_getContainerWindow() + { + ReadGuard aReadLock( m_aLock ); + return m_xContainerWindow; + } + + inline css::uno::Reference< css::frame::XDispatchProvider > impl_getDispatchHelper() + { + ReadGuard aReadLock( m_aLock ); + return m_xDispatchHelper; + } + + inline css::uno::Reference< css::frame::XFramesSupplier > impl_getParent() + { + ReadGuard aReadLock( m_aLock ); + return m_xParent; + } + +}; // class Frame + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_FRAME_HXX_ diff --git a/framework/inc/services/frameloaderfactory.hxx b/framework/inc/services/frameloaderfactory.hxx new file mode 100644 index 000000000000..5fa6ff348ffc --- /dev/null +++ b/framework/inc/services/frameloaderfactory.hxx @@ -0,0 +1,391 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: frameloaderfactory.hxx,v $ + * $Revision: 1.7 $ + * + * 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 __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ +#define __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/filtercache.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/WrappedTargetException.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/io/XInputStream.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase3.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct tIMPLExtractedArguments +{ + ::rtl::OUString sMimeType ; + sal_Int32 nFlags ; + ::rtl::OUString sFilterName ; + sal_Int32 nClipboardFormat ; + ::rtl::OUString sDetectService ; + css::uno::Reference< css::io::XInputStream > xInputStream ; + + sal_Int32 nValidMask ; +}; + +/*-************************************************************************************************************//** + @short factory to create frameloader-objects + @descr These class can be used to create new loader for specified contents. + We use cached values of the registry to lay down, wich frameloader match + a given URL or filtername. To do this, we use the XMultiServiceFactory-interface. + + @ATTENTION In a specialmode of these implementation we support a simple filterdetection. + But there is no special interface. You must call some existing methods in another context! + see createInstanceWithArguments() fo rfurther informations! + + @implements XInterface + XTypeProvider + XServiceInfo + XMultiServiceFactory + XNameAccess + XElementAccess + @base ThreadHelpBase + OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class FrameLoaderFactory : public ThreadHelpBase , // Struct for right initalization of mutex member! Mst first of baseclasses + public ::cppu::WeakImplHelper3< ::com::sun::star::lang::XServiceInfo,::com::sun::star::lang::XMultiServiceFactory,::com::sun::star::container::XNameAccess > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor + @descr Initialize a new instance and fill the registrycache with values. + To do this - xFactory must be valid! + + @seealso class RegistryCache + @seealso member m_aRegistryCache + + @param "xFactory", factory which has created us. + @return - + + @onerror An ASSERTION is thrown in debug version, if xFactory is invalid or cache can't filled. + *//*-*****************************************************************************************************/ + + FrameLoaderFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor to delete instance + @descr We use it to clear ouer cache. + + @seealso class RegistryCache + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~FrameLoaderFactory(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XMultiServiceFactory + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new frameloder (without arguments!) + @descr We search for an agreement between given type name and our cache-content. + If we found some information, we create the registered frameloader for these type. + Otherwise - we return NULL. + We search from begin to end of internal loader list! + + @seealso method impl_createFrameLoader() + @seealso method createInstanceWithArguments() + + @param "sTypeName", type name of a document to filter, open or save. + @return A reference to a new created frameloader. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& sTypeName ) throw( css::uno::Exception , + css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short create a new frameloder + @descr We search for an agreement between given type name and our cache-content. + If we found some information, we create the registered frameloader for these type. + Otherwise - we return NULL. + You can give us some optional arguments to influence our search! + + @seealso method impl_createFrameLoader() + @seealso method createInstance() + + @param "sTypeName", type name of a document to filter, open or save. + @param "seqArguments", list of optional arguments for initializing of new frameloader. + @return A reference to a new created frameloader. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& seqArguments) throw( css::uno::Exception , + css::uno::RuntimeException); + + /*-****************************************************************************************************//** + @short not supported + @descr Please use XNameAcces instead of these! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XNameAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return properties of registered frame loader specified by his implementation name + @descr Use these method to get all informations about our internal loader cache + and a special frame loader. + We return a Sequence< PropertyValue > in an Any packed as result. + + structure of return value: + [0].Name = "Types" + [0].Value = list of supported types of these loader as [sequence< oustring >] + + [1].Name = "UIName" + [1].Value = localized name of loader as [string] + + @seealso method getElementNames() + @seealso method hasByName() + + @param "sName", the name of searched frame loader (use getElementNames() to get it!) + @return A Sequence< PropertyValue > packed in an Any. + + @onerror If given name not exist a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short return list of all well known loader names from configuration + @descr Use these method to get all names of well known loader. + You can use it to get the properties of a loader by calling getByName()! + + @seealso method getByName() + @seealso method hasByName() + + @param - + @return A list of well known loader. Is static at runtime! + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short check if searched frame loader exist in configuration + @descr Normaly nobody need these method realy (use getElementNames() in combination with getByName()). + We guarantee correctness of these mechanism. There is no reason to check for existing elements then ... + but if you have an unknwon name and has no fun to search it in returned sequence ... + you can call these ... + + @seealso method getByName() + @seealso method getElementNames() + + @param "sName", implementation name of searched frame loader + @return sal_True if loader exist, sal_False otherwise. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short return the type of retrun value of method XNameAccess::getByName() + @descr In these implementation its a Sequence< PropertyValue > everytime! + + @seealso description of interface XNameAccess + + @param - + @return Type of Sequence< PropertyValue >. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short return state if informations about frame loader available + @descr If these method return false - no information could'nt read from configuration ... + I think nothing will work then. Normaly we return TRUE! + + @seealso class FilterCache! + + @param - + @return sal_True if information available, sal_False otherwise. + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short try to set configuration properties at created loader + @descr We support the old async. loader interface ( XFrameLoader ) and the new one XSynchronousFrameLoader. + The new one should implement a property set on which we can set his configuration values! + We try to cast given loader to these interface - if it's exist we set the values - otherwise not! + + @seealso service FrameLoader + @seealso service SynchronousFrameLoader + + @param "xLoader" loader with generic XInterface! (We don't know before which service type is used!) + @param "pLoaderInfo" configuration structure of these loader. + @return - + + @onerror No error should occure. + *//*-*****************************************************************************************************/ + + void impl_initializeLoader( css::uno::Reference< css::uno::XInterface >& xLoader, const Loader& pLoaderInfo ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False ,on invalid parameter + @return sal_True ,otherwise + + @onerror - + *//*-*****************************************************************************************************/ + + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_FrameLoaderFactory ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + static sal_Bool impldbg_checkParameter_createInstance ( const ::rtl::OUString& sTypeName ); + static sal_Bool impldbg_checkParameter_createInstanceWithArguments ( const ::rtl::OUString& sTypeName , + const css::uno::Sequence< css::uno::Any >& seqArguments); + static sal_Bool impldbg_checkParameter_getByName ( const ::rtl::OUString& sName ); + static sal_Bool impldbg_checkParameter_hasByName ( const ::rtl::OUString& sName ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // private variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; + FilterCache m_aCache ; + +}; // class FrameLoaderFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_FRAMELOADERFACTORY_HXX_ diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx new file mode 100644 index 000000000000..8c412e5d6237 --- /dev/null +++ b/framework/inc/services/layoutmanager.hxx @@ -0,0 +1,526 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * 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 __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ +#define __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#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 <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> +#include <uielement/menubarmanager.hxx> +#include <uiconfiguration/windowstateconfiguration.hxx> +#include <classes/addonsoptions.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/frame/XInplaceLayout.hpp> +#include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/XTopWindow2.hpp> +#include <com/sun/star/awt/XDockableWindow.hpp> +#include <com/sun/star/awt/XDockableWindowListener.hpp> +#include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp> +#include <com/sun/star/frame/XLayoutManagerEventBroadcaster.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/implbase9.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <comphelper/propertycontainer.hxx> +#include <vcl/wintypes.hxx> +#include <svtools/miscopt.hxx> +#include <vcl/toolbox.hxx> +#include <vcl/timer.hxx> + +class MenuBar; +namespace framework +{ + class GlobalSettings; + typedef ::cppu::WeakImplHelper9 < ::com::sun::star::lang::XServiceInfo + , ::com::sun::star::frame::XLayoutManager + , ::com::sun::star::awt::XWindowListener + , ::com::sun::star::frame::XFrameActionListener + , ::com::sun::star::ui::XUIConfigurationListener + , ::com::sun::star::frame::XInplaceLayout + , ::com::sun::star::awt::XDockableWindowListener + , ::com::sun::star::frame::XMenuBarMergingAcceptor + , ::com::sun::star::frame::XLayoutManagerEventBroadcaster + > LayoutManager_Base; + typedef ::comphelper::OPropertyContainer LayoutManager_PBase; + class LayoutManager : public LayoutManager_Base , + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OBroadcastHelper , + public LayoutManager_PBase + { + public: + enum { DOCKINGAREAS_COUNT = 4 }; + + LayoutManager( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMGR ); + virtual ~LayoutManager(); + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XLayoutManager + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& Frame ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Rectangle SAL_CALL getCurrentDockingArea( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > SAL_CALL getDockingAreaAcceptor() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDockingAreaAcceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor >& xDockingAreaAcceptor ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL createElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL destroyElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL requestElement( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > SAL_CALL getElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > > SAL_CALL getElements( ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL showElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hideElement( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL dockWindow( const ::rtl::OUString& aName, ::com::sun::star::ui::DockingArea DockingArea, const ::com::sun::star::awt::Point& Pos ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL dockAllWindows( ::sal_Int16 nElementType ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL floatWindow( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL lockWindow( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL unlockWindow( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setElementSize( const ::rtl::OUString& aName, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setElementPos( const ::rtl::OUString& aName, const ::com::sun::star::awt::Point& aPos ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setElementPosSize( const ::rtl::OUString& aName, const ::com::sun::star::awt::Point& aPos, const ::com::sun::star::awt::Size& aSize ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isElementVisible( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isElementFloating( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isElementDocked( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL isElementLocked( const ::rtl::OUString& ResourceURL ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getElementSize( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Point SAL_CALL getElementPos( const ::rtl::OUString& aName ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL lock( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unlock( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doLayout( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setVisible( sal_Bool bVisible ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isVisible() throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XInplaceLayout + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL setInplaceMenuBar( sal_Int64 pInplaceMenuBarPointer ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL resetInplaceMenuBar( ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XMenuBarMergingAcceptor + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL setMergedMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMergedMenuBar ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeMergedMenuBar( ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XFrameActionListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL frameAction( const css::frame::FrameActionEvent& aEvent ) throw ( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XUIConfigurationListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XDockableWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XLayoutManagerEventBroadcaster + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL addLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& aLayoutManagerListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& aLayoutManagerListener ) throw (::com::sun::star::uno::RuntimeException); + + DECL_LINK( MenuBarClose, MenuBar * ); + DECL_LINK( WindowEventListener, VclSimpleEvent* ); + + struct DockedData + { + DockedData() : m_aPos( LONG_MAX, LONG_MAX ), + m_nDockedArea( ::com::sun::star::ui::DockingArea_DOCKINGAREA_TOP ), + m_bLocked( sal_False ) {} + + Point m_aPos; + Size m_aSize; + sal_Int16 m_nDockedArea; + sal_Bool m_bLocked; + }; + struct FloatingData + { + FloatingData() : m_aPos( LONG_MAX, LONG_MAX ), + m_nLines( 1 ), + m_bIsHorizontal( sal_True ) {} + + Point m_aPos; + Size m_aSize; + sal_Int16 m_nLines; + sal_Bool m_bIsHorizontal; + }; + struct SingleRowColumnWindowData + { + SingleRowColumnWindowData() : nVarSize( 0 ), nStaticSize( 0 ), nSpace( 0 ) {} + + std::vector< rtl::OUString > aUIElementNames; + std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aRowColumnWindows; + std::vector< ::com::sun::star::awt::Rectangle > aRowColumnWindowSizes; + std::vector< sal_Int32 > aRowColumnSpace; + ::com::sun::star::awt::Rectangle aRowColumnRect; + sal_Int32 nVarSize; + sal_Int32 nStaticSize; + sal_Int32 nSpace; + sal_Int32 nRowColumn; + }; + + protected: + DECL_LINK( AsyncLayoutHdl, Timer * ); + + private: + enum DockingOperation + { + DOCKOP_BEFORE_COLROW, + DOCKOP_ON_COLROW, + DOCKOP_AFTER_COLROW + }; + struct UIElement + { + UIElement() : m_bFloating( sal_False ), + m_bVisible( sal_True ), + m_bUserActive( sal_False ), + m_bCreateNewRowCol0( sal_False ), + m_bDeactiveHide( sal_False ), + m_bMasterHide( sal_False ), + m_bContextSensitive( sal_False ), + m_bContextActive( sal_True ), + m_bNoClose( sal_False ), + m_bSoftClose( sal_False ), + m_bStateRead( sal_False ), + m_nStyle( BUTTON_SYMBOL ) + {} + + UIElement( const rtl::OUString& rName, + const rtl::OUString& rType, + const com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& rUIElement, + sal_Bool bFloating = sal_False + ) : m_aType( rType ), + m_aName( rName ), + m_xUIElement( rUIElement ), + m_bFloating( bFloating ), + m_bVisible( sal_True ), + m_bUserActive( sal_False ), + m_bCreateNewRowCol0( sal_False ), + m_bDeactiveHide( sal_False ), + m_bMasterHide( sal_False ), + m_bContextSensitive( sal_False ), + m_bContextActive( sal_True ), + m_bNoClose( sal_False ), + m_bSoftClose( sal_False ), + m_bStateRead( sal_False ), + m_nStyle( BUTTON_SYMBOL ) {} + + bool operator< ( const UIElement& aUIElement ) const; + UIElement& operator=( const UIElement& rUIElement ); + + rtl::OUString m_aType; + rtl::OUString m_aName; + rtl::OUString m_aUIName; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xUIElement; + sal_Bool m_bFloating, + m_bVisible, + m_bUserActive, + m_bCreateNewRowCol0, + m_bDeactiveHide, + m_bMasterHide, + m_bContextSensitive, + m_bContextActive; + sal_Bool m_bNoClose, + m_bSoftClose, + m_bStateRead; + sal_Int16 m_nStyle; + DockedData m_aDockedData; + FloatingData m_aFloatingData; + }; + + typedef std::vector< UIElement > UIElementVector; + + //--------------------------------------------------------------------------------------------------------- + // helper + //--------------------------------------------------------------------------------------------------------- + + //--------------------------------------------------------------------------------------------------------- + // helper + //--------------------------------------------------------------------------------------------------------- + void impl_clearUpMenuBar(); + void implts_reset( sal_Bool bAttach ); + void implts_setMenuBarCloser(sal_Bool bCloserState); + void implts_updateMenuBarClose(); + sal_Bool implts_resetMenuBar(); + + void implts_lock(); + sal_Bool implts_unlock(); + + sal_Bool implts_findElement( const rtl::OUString& aName, rtl::OUString& aElementType, rtl::OUString& aElementName, ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xSettings ); + sal_Bool implts_findElement( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xUIElement, UIElement& aElementData ); + sal_Bool implts_findElement( const rtl::OUString& aName, UIElement& aElementData ); + UIElement& impl_findElement( const rtl::OUString& aName ); + sal_Bool implts_insertUIElement( const UIElement& rUIElement ); + + void implts_refreshContextToolbarsVisibility(); + void implts_writeNewStateData( const rtl::OUString aName, const ::com::sun::star::uno::Reference< com::sun::star::awt::XWindow >& xWindow ); + sal_Bool implts_readWindowStateData( const rtl::OUString& rName, UIElement& rElementData ); + void implts_writeWindowStateData( const rtl::OUString& rName, const UIElement& rElementData ); + void implts_setElementData( UIElement& rUIElement, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow >& rDockWindow ); + void implts_sortUIElements(); + void implts_destroyElements(); + void implts_destroyDockingAreaWindows(); + void implts_createAddonsToolBars(); + void implts_createCustomToolBars(); + void implts_createNonContextSensitiveToolBars(); + void implts_createCustomToolBars( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& aCustomTbxSeq ); + void implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle ); + void implts_toggleFloatingUIElementsVisibility( sal_Bool bActive ); + void implts_reparentChildWindows(); + + sal_Bool implts_isEmbeddedLayoutManager() const; + sal_Int16 implts_getCurrentSymbolsSize(); + sal_Int16 implts_getCurrentSymbolsStyle(); + ::com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const ::com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >& rParent ); + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_createElement( const rtl::OUString& aName ); + rtl::OUString implts_generateGenericAddonToolbarTitle( sal_Int32 nNumber ) const; + + // docking methods + ::Rectangle implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset ); + void implts_calcDockingPosSize( UIElement& aUIElement, DockingOperation& eDockOperation, ::Rectangle& rTrackingRect, const Point& rMousePos ); + DockingOperation implts_determineDockingOperation( ::com::sun::star::ui::DockingArea DockingArea, const ::Rectangle& rRowColRect, const Point& rMousePos ); + ::Rectangle implts_getWindowRectFromRowColumn( ::com::sun::star::ui::DockingArea DockingArea, const SingleRowColumnWindowData& rRowColumnWindowData, const ::Point& rMousePos, const rtl::OUString& rExcludeElementName ); + ::Rectangle implts_determineFrontDockingRect( ::com::sun::star::ui::DockingArea eDockingArea, + sal_Int32 nRowCol, + const ::Rectangle& rDockedElementRect, + const ::rtl::OUString& rMovedElementName, + const ::Rectangle& rMovedElementRect ); + void implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockingArea, + sal_Int32 nOffset, + SingleRowColumnWindowData& rRowColumnWindowData, + const ::Size& rContainerSize ); + ::Rectangle implts_calcTrackingAndElementRect( ::com::sun::star::ui::DockingArea eDockingArea, + sal_Int32 nRowCol, + UIElement& rUIElement, + const ::Rectangle& rTrackingRect, + const ::Rectangle& rRowColumnRect, + const ::Size& rContainerWinSize ); + void implts_renumberRowColumnData( ::com::sun::star::ui::DockingArea eDockingArea, DockingOperation eDockingOperation, const UIElement& rUIElement ); + + // layouting methods + sal_Bool implts_compareRectangles( const ::com::sun::star::awt::Rectangle& rRect1, const ::com::sun::star::awt::Rectangle& rRect2 ); + sal_Bool implts_resizeContainerWindow( const ::com::sun::star::awt::Size& rContainerSize, const ::com::sun::star::awt::Point& rComponentPos ); + ::Size implts_getTopBottomDockingAreaSizes(); + ::Size implts_getContainerWindowOutputSize(); + ::com::sun::star::awt::Rectangle implts_getDockingAreaWindowSizes(); + void implts_getDockingAreaElementInfos( ::com::sun::star::ui::DockingArea DockingArea, std::vector< SingleRowColumnWindowData >& rRowColumnsWindowData ); + void implts_getDockingAreaElementInfoOnSingleRowCol( ::com::sun::star::ui::DockingArea, + sal_Int32 nRowCol, + SingleRowColumnWindowData& rRowColumnWindowData ); + ::Point implts_findNextCascadeFloatingPos(); + void implts_findNextDockingPos( ::com::sun::star::ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ); + ::com::sun::star::awt::Rectangle implts_calcDockingAreaSizes(); + void implts_setDockingAreaWindowSizes( const com::sun::star::awt::Rectangle& rBorderSpace ); + sal_Bool implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ); + void implts_doLayout_notify( sal_Bool bOuterResize ); + + // internal methods to control status/progress bar + ::Size implts_getStatusBarSize(); + void implts_destroyStatusBar(); + void implts_createStatusBar( const rtl::OUString& rStatusBarName ); + void implts_createProgressBar(); + void implts_destroyProgressBar(); + void implts_setStatusBarPosSize( const ::Point& rPos, const ::Size& rSize ); + sal_Bool implts_showStatusBar( sal_Bool bStoreState=sal_False ); + sal_Bool implts_hideStatusBar( sal_Bool bStoreState=sal_False ); + void implts_readStatusBarState( const rtl::OUString& rStatusBarName ); + sal_Bool implts_showProgressBar(); + sal_Bool implts_hideProgressBar(); + void implts_backupProgressBarWrapper(); + + void implts_setInplaceMenuBar( + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMergedMenuBar ) + throw (::com::sun::star::uno::RuntimeException); + void implts_resetInplaceMenuBar() + throw (::com::sun::star::uno::RuntimeException); + + void implts_setVisibleState( sal_Bool bShow ); + void implts_updateUIElementsVisibleState( sal_Bool bShow ); + void implts_setCurrentUIVisibility( sal_Bool bShow ); + sal_Bool impl_parseResourceURL( const rtl::OUString aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ); + + void implts_notifyListeners( short nEvent, ::com::sun::star::uno::Any aInfoParam ); +#ifdef DBG_UTIL + void implts_checkElementContainer(); +#endif + + DECL_LINK( OptionsChanged, void* ); + DECL_LINK( SettingsChanged, void* ); + + //--------------------------------------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------------------------------------- + virtual sal_Bool SAL_CALL convertFastPropertyValue ( com::sun::star::uno::Any& aConvertedValue , + com::sun::star::uno::Any& aOldValue , + sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( com::sun::star::uno::Any& aValue , + sal_Int32 nHandle ) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + virtual ::com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; /** reference to factory, which has created this instance. */ + css::uno::Reference< css::util::XURLTransformer > m_xURLTransformer; + css::uno::Reference< css::container::XIndexAccess > m_xDisplayAccess; + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; + css::uno::WeakReference< css::frame::XModel > m_xModel; + css::uno::Reference< css::awt::XWindow > m_xContainerWindow; + css::uno::Reference< css::awt::XTopWindow2 > m_xContainerTopWindow; + css::uno::Reference< css::awt::XWindow > m_xDockAreaWindows[DOCKINGAREAS_COUNT]; + sal_Int32 m_nLockCount; + UIElementVector m_aUIElements; + bool m_bActive; + bool m_bInplaceMenuSet; + bool m_bDockingInProgress; + bool m_bMenuVisible; + bool m_bComponentAttached; + bool m_bDoLayout; + bool m_bVisible; + bool m_bParentWindowVisible; + bool m_bMustDoLayout; + bool m_bAutomaticToolbars; + bool m_bStoreWindowState; + bool m_bHideCurrentUI; + bool m_bGlobalSettings; + bool m_bPreserveContentSize; + DockingOperation m_eDockOperation; + UIElement m_aDockUIElement; + css::awt::Rectangle m_aDockingArea; + css::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > m_xDockingAreaAcceptor; + Point m_aStartDockMousePos; + css::uno::Reference< ::com::sun::star::lang::XComponent > m_xInplaceMenuBar; + MenuBarManager* m_pInplaceMenuBar; + css::uno::Reference< ::com::sun::star::ui::XUIElement > m_xMenuBar; + UIElement m_aStatusBarElement; + UIElement m_aProgressBarElement; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xProgressBarBackup; + css::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; + css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; + bool m_bMenuBarCloser; + css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; + css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowStateSupplier; + GlobalSettings* m_pGlobalSettings; + rtl::OUString m_aModuleIdentifier; + rtl::OUString m_aCustomTbxPrefix; + rtl::OUString m_aFullCustomTbxPrefix; + rtl::OUString m_aFullAddonTbxPrefix; + rtl::OUString m_aStatusBarAlias; + rtl::OUString m_aProgressBarAlias; + rtl::OUString m_aPropDocked; + rtl::OUString m_aPropVisible; + rtl::OUString m_aPropDockingArea; + rtl::OUString m_aPropDockPos; + rtl::OUString m_aPropPos; + rtl::OUString m_aPropSize; + rtl::OUString m_aPropUIName; + rtl::OUString m_aPropStyle; + rtl::OUString m_aPropLocked; + rtl::OUString m_aCustomizeCmd; + AddonsOptions* m_pAddonOptions; + SvtMiscOptions* m_pMiscOptions; + sal_Int16 m_eSymbolsSize; + sal_Int16 m_eSymbolsStyle; + Timer m_aAsyncLayoutTimer; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener + }; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ diff --git a/framework/inc/services/license.hxx b/framework/inc/services/license.hxx new file mode 100644 index 000000000000..66810193f1b3 --- /dev/null +++ b/framework/inc/services/license.hxx @@ -0,0 +1,126 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: license.hxx,v $ + * $Revision: 1.5 $ + * + * 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 __FRAMEWORK_SERVICES_LICENSE_HXX_ +#define __FRAMEWORK_SERVICES_LICENSE_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#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 <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> +#include <uielement/menubarmanager.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#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> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +namespace framework +{ + class License : public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::task::XJob , + public css::util::XCloseable , + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject // => XWeak, XInterface + { + private: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; + sal_Bool m_bTerminate; + public: + License( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMGR ); + virtual ~License(); + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + +#if 0 + DECL_STATIC_LINK( License, Terminate, void* ); +#endif + + /* + XJob... + any execute([in] sequence< ::com::sun::star::beans::NamedValue > Arguments ) + raises( + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::Exception ); + */ + virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence<css::beans::NamedValue>& args) + throw( css::lang::IllegalArgumentException, css::uno::Exception); + + /* + XCLoseable + void close( [in] boolean DeliverOwnership ) raises(CloseVetoException ); + */ + virtual void SAL_CALL close(sal_Bool bDeliverOwnership) throw (css::util::CloseVetoException); + + /* + XCloseVroadcaster + [oneway] void addCloseListener([in] XCloseListenerListener ); + [oneway] void removeCloseListener([in] XCloseListenerListener ); + */ + virtual void SAL_CALL addCloseListener(const css::uno::Reference< css::util::XCloseListener >& aListener) throw (css::uno::RuntimeException); + virtual void SAL_CALL removeCloseListener(const css::uno::Reference< css::util::XCloseListener >& aListener) throw (css::uno::RuntimeException); + +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ diff --git a/framework/inc/services/licensedlg.hxx b/framework/inc/services/licensedlg.hxx new file mode 100644 index 000000000000..86e3f6c7fc57 --- /dev/null +++ b/framework/inc/services/licensedlg.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: licensedlg.hxx,v $ + * $Revision: 1.6 $ + * + * 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 __LICENSEDLG_HXX__ +#define __LICENSEDLG_HXX__ + +#include <sal/types.h> +#include <rtl/string.hxx> +#include <rtl/ustring.hxx> +#include <rtl/ustrbuf.hxx> +#include <tools/string.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 <svtools/lstner.hxx> + +namespace framework { + +class LicenseView : public MultiLineEdit, public SfxListener +{ + BOOL mbEndReached; + Link maEndReachedHdl; + Link maScrolledHdl; + +public: + LicenseView( Window* pParent, const ResId& rResId ); + ~LicenseView(); + + 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; } + + 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; + String aStrAccept; + String aStrNotAccept; + String aOldCancelText; + BOOL bEndReached; + + void EnableControls(); + + DECL_LINK( PageDownHdl, PushButton * ); + DECL_LINK( EndReachedHdl, LicenseView * ); + DECL_LINK( ScrolledHdl, LicenseView * ); + DECL_LINK( AcceptBtnHdl, PushButton * ); + DECL_LINK( DeclineBtnHdl, PushButton * ); + + public: + LicenseDialog(const rtl::OUString& aLicense, ResMgr *pResMgr); + virtual ~LicenseDialog(); + +}; +} +#endif diff --git a/framework/inc/services/logindialog.hrc b/framework/inc/services/logindialog.hrc new file mode 100644 index 000000000000..c0470da406bb --- /dev/null +++ b/framework/inc/services/logindialog.hrc @@ -0,0 +1,55 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: logindialog.hrc,v $ + * $Revision: 1.5 $ + * + * 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. + * + ************************************************************************/ +// windows / dialogs +#define RID_DLG_LOGIN 1000 + +// controls +#define RID_FI_HEADER 1 +#define RID_FT_LOGINTEXT 2 +#define RID_FT_USERNAME 3 +#define RID_FT_PASSWORD 4 +#define RID_FT_SERVER 5 +#define RID_ED_USERNAME 6 +#define RID_ED_PASSWORD 7 +#define RID_FL_SERVER 8 +#define RID_CB_SERVER 9 +#define RID_FL_PROXYSETTINGS 10 +#define RID_RB_NOPROXY 11 +#define RID_RB_USEBROWSERPROXY 12 +#define RID_RB_USECUSTOMPROXY 13 +#define RID_FT_SECURITYPROXY 15 +#define RID_FT_SECURITYPROXYHOST 16 +#define RID_ED_SECURITYPROXYHOST 17 +#define RID_FT_SECURITYPROXYPORT 18 +#define RID_ED_SECURITYPROXYPORT 19 +#define RID_FL_BUTTONS 20 +#define RID_PB_OK 21 +#define RID_PB_CANCEL 22 +#define RID_PB_ADDITIONALSETTINGS 23 diff --git a/framework/inc/services/logindialog.hxx b/framework/inc/services/logindialog.hxx new file mode 100644 index 000000000000..97404d8234f1 --- /dev/null +++ b/framework/inc/services/logindialog.hxx @@ -0,0 +1,893 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: logindialog.hxx,v $ + * $Revision: 1.14 $ + * + * 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 __FRAMEWORK_LOGINDIALOG_LOGINDIALOG_HXX_ +#define __FRAMEWORK_LOGINDIALOG_LOGINDIALOG_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_THREADHELPER_THREADHELPBASE_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +#include <services/logindialog.hrc> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/awt/XDialog.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include <com/sun/star/util/XFlushable.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <tools/config.hxx> +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> +#include <vcl/dialog.hxx> +#include <vcl/fixed.hxx> +#include <vcl/edit.hxx> +#include <vcl/combobox.hxx> + +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif + +#ifndef _SV_BUTTON_HXX +#include <vcl/button.hxx> +#endif +#include <vcl/morebtn.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +#define ANY ::com::sun::star::uno::Any +#define EXCEPTION ::com::sun::star::uno::Exception +#define ILLEGALARGUMENTEXCEPTION ::com::sun::star::lang::IllegalArgumentException +#define IPROPERTYARRAYHELPER ::cppu::IPropertyArrayHelper +#define OBROADCASTHELPER ::cppu::OBroadcastHelper +#define OPROPERTYSETHELPER ::cppu::OPropertySetHelper +#define OUSTRING ::rtl::OUString +#define OWEAKOBJECT ::cppu::OWeakObject +#define PROPERTY ::com::sun::star::beans::Property +#define REFERENCE ::com::sun::star::uno::Reference +#define RUNTIMEEXCEPTION ::com::sun::star::uno::RuntimeException +#define SEQUENCE ::com::sun::star::uno::Sequence +#define XDIALOG ::com::sun::star::awt::XDialog +#define XMULTISERVICEFACTORY ::com::sun::star::lang::XMultiServiceFactory +#define XPROPERTYSETINFO ::com::sun::star::beans::XPropertySetInfo +#define XSERVICEINFO ::com::sun::star::lang::XServiceInfo +#define XTYPEPROVIDER ::com::sun::star::lang::XTypeProvider +#define PROPERTYVALUE ::com::sun::star::beans::PropertyValue +#define LOCALE ::com::sun::star::lang::Locale +#define XFLUSHABLE ::com::sun::star::util::XFlushable +#define XFLUSHLISTENER ::com::sun::star::util::XFlushListener + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +#ifdef WNT + #define ININAME DECLARE_ASCII("login.ini") +#elif defined UNIX + #define ININAME DECLARE_ASCII("loginrc") +#else + #error "name of login profile unknown!" +#endif + +#define UNCPATHSEPERATOR sal_Unicode(0x002F) +#define MAX_SERVERHISTORY 10 + +// Use follow keys in follow order. +// [Global] +// UserName=as +// ActiveServer=2 +// ConnectionType=https +// Language=en-US +// UseProxy=[browser|custom|none] +// SecurityProxy=so-webcache:3128 +// dialog=[big|small] +// +// [DefaultPorts] +// https=8445 +// http=8090 +// +// [ServerHistory] +// Server_1=localhost +// Server_2=munch:7202 +// Server_3=www.xxx.com:8000 + +#define SECTION_GLOBAL "Global" +#define SECTION_DEFAULTPORTS "DefaultPorts" +#define SECTION_SERVERHISTORY "ServerHistory" + +#define SECTION_USERNAME SECTION_GLOBAL +#define SECTION_ACTIVESERVER SECTION_GLOBAL +#define SECTION_CONNECTIONTYPE SECTION_GLOBAL +#define SECTION_LANGUAGE SECTION_GLOBAL +#define SECTION_SECURITYPROXY SECTION_GLOBAL +#define SECTION_DIALOG SECTION_GLOBAL +#define SECTION_HTTP SECTION_DEFAULTPORTS +#define SECTION_HTTPS SECTION_DEFAULTPORTS +#define SECTION_SERVER_X SECTION_SERVERHISTORY + +#define KEY_USERNAME "UserName" +#define KEY_ACTIVESERVER "ActiveServer" +#define KEY_CONNECTIONTYPE "ConnectionType" +#define KEY_LANGUAGE "Language" +#define KEY_SERVER_X "Server_" +#define KEY_SECURITYPROXY "SecurityProxy" +#define KEY_USESECURITYPROXY "UseProxy" +#define KEY_DIALOG "dialog" +#define KEY_HTTP "http" +#define KEY_HTTPS "https" + +#define PROPERTYNAME_CONNECTIONTYPE DECLARE_ASCII("ConnectionType" ) +#define PROPERTYNAME_LANGUAGE DECLARE_ASCII("Language" ) +#define PROPERTYNAME_PARENTWINDOW DECLARE_ASCII("ParentWindow" ) +#define PROPERTYNAME_PASSWORD DECLARE_ASCII("Password" ) +#define PROPERTYNAME_SECURITYPROXY DECLARE_ASCII("SecurityProxy" ) +#define PROPERTYNAME_SERVER DECLARE_ASCII("Server" ) +#define PROPERTYNAME_SERVERHISTORY DECLARE_ASCII("ServerHistory" ) +#define PROPERTYNAME_USERNAME DECLARE_ASCII("UserName" ) +#define PROPERTYNAME_USEPROXY DECLARE_ASCII("UseProxy" ) +#define PROPERTYNAME_DIALOG DECLARE_ASCII("Dialog" ) +#define PROPERTYNAME_HTTP DECLARE_ASCII("http" ) +#define PROPERTYNAME_HTTPS DECLARE_ASCII("https" ) + +#define PROPERTYHANDLE_CONNECTIONTYPE 1 +#define PROPERTYHANDLE_LANGUAGE 2 +#define PROPERTYHANDLE_PARENTWINDOW 3 +#define PROPERTYHANDLE_PASSWORD 4 +#define PROPERTYHANDLE_SERVER 5 +#define PROPERTYHANDLE_SERVERHISTORY 6 +#define PROPERTYHANDLE_USERNAME 7 +#define PROPERTYHANDLE_SECURITYPROXY 8 +#define PROPERTYHANDLE_USEPROXY 9 +#define PROPERTYHANDLE_DIALOG 10 +#define PROPERTYHANDLE_HTTP 11 +#define PROPERTYHANDLE_HTTPS 12 + +#define PROPERTYCOUNT 12 + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct tIMPL_DialogData +{ + OUSTRING sUserName ; + OUSTRING sPassword ; + SEQUENCE< OUSTRING > seqServerList ; + sal_Int32 nActiveServer ; + OUSTRING sConnectionType ; + LOCALE aLanguage ; + sal_Int32 nPortHttp ; + sal_Int32 nPortHttps ; + ANY aParentWindow ; + OUSTRING sSecurityProxy ; + OUSTRING sUseProxy ; + OUSTRING sDialog ; + sal_Bool bProxyChanged ; + + // default ctor to initialize empty structure. + tIMPL_DialogData() + : sUserName ( OUSTRING() ) + , sPassword ( OUSTRING() ) + , seqServerList ( SEQUENCE< OUSTRING >() ) + , nActiveServer ( 1 ) + , sConnectionType ( OUSTRING() ) + , aLanguage ( OUSTRING(), OUSTRING(), OUSTRING() ) + , nPortHttp ( 0 ) + , nPortHttps ( 0 ) + , aParentWindow ( ) + , sSecurityProxy ( OUSTRING() ) + , sUseProxy ( OUSTRING() ) + , sDialog ( OUSTRING() ) + , bProxyChanged ( sal_False ) + { + } + + // copy ctor to initialize structure with values from another one. + tIMPL_DialogData( const tIMPL_DialogData& aCopyDataSet ) + : sUserName ( aCopyDataSet.sUserName ) + , sPassword ( aCopyDataSet.sPassword ) + , seqServerList ( aCopyDataSet.seqServerList ) + , nActiveServer ( aCopyDataSet.nActiveServer ) + , sConnectionType ( aCopyDataSet.sConnectionType ) + , aLanguage ( aCopyDataSet.aLanguage ) + , nPortHttp ( aCopyDataSet.nPortHttp ) + , nPortHttps ( aCopyDataSet.nPortHttps ) + , aParentWindow ( aCopyDataSet.aParentWindow ) + , sSecurityProxy ( aCopyDataSet.sSecurityProxy ) + , sUseProxy ( aCopyDataSet.sUseProxy ) + , sDialog ( aCopyDataSet.sDialog ) + , bProxyChanged ( aCopyDataSet.bProxyChanged ) + { + } + + // assignment operator to cop values from another struct to this one. + tIMPL_DialogData& operator=( const tIMPL_DialogData& aCopyDataSet ) + { + sUserName = aCopyDataSet.sUserName ; + sPassword = aCopyDataSet.sPassword ; + seqServerList = aCopyDataSet.seqServerList ; + nActiveServer = aCopyDataSet.nActiveServer ; + sConnectionType = aCopyDataSet.sConnectionType ; + aLanguage = aCopyDataSet.aLanguage ; + nPortHttp = aCopyDataSet.nPortHttp ; + nPortHttps = aCopyDataSet.nPortHttps ; + aParentWindow = aCopyDataSet.aParentWindow ; + sSecurityProxy = aCopyDataSet.sSecurityProxy ; + sUseProxy = aCopyDataSet.sUseProxy ; + sDialog = aCopyDataSet.sDialog ; + bProxyChanged = aCopyDataSet.bProxyChanged ; + return *this; + } +}; + +/*-************************************************************************************************************//** + @short implements an "private inline" dialog class used by follow class LoginDialog to show the dialog + @descr This is a VCL- modal dialog and not threadsafe! We use it as private definition in the context of login dialog only! + + @implements - + + @base ModalDialog +*//*-*************************************************************************************************************/ + +class cIMPL_Dialog : public ModalDialog +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + /*-****************************************************************************************************//** + @short default ctor + @descr This ctor initialize the dialog, load ressources but not set values on edits or check boxes! + These is implemented by setValues() on the same class. + You must give us a language identifier to describe which ressource should be used! + + @seealso method setValues() + + @param "aLanguage" , identifier to describe ressource language + @param "pParent" , parent window handle for dialog! If is it NULL -> no parent exist ... + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + cIMPL_Dialog( ::com::sun::star::lang::Locale aLocale, Window* pParent ); + + /*-****************************************************************************************************//** + @short default dtor + @descr This dtor deinitialize the dialog and free all used ressources. + But you can't get the values of the dialog. Use getValues() to do this. + + @seealso method getValues() + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + ~cIMPL_Dialog(); + + /*-****************************************************************************************************//** + @short set new values on dialog to show + @descr Use this to initialize the dialg with new values for showing before execute. + + @seealso method getValues() + + @param "aDataSet"; struct of variables to set it on dialog controls + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void setValues( const tIMPL_DialogData& aDataSet ); + + /*-****************************************************************************************************//** + @short get current values from dialog controls + @descr Use this if you will get all values of dialog after execute. + + @seealso method setValues() + + @param "aDataSet"; struct of variables filled by dialog + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + tIMPL_DialogData getValues(); + + /*-****************************************************************************************************/ + /* handler + */ + + DECL_LINK( ClickHdl, void* ); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + void setCustomSettings(); + + void showDialogExpanded(); + void showDialogCollapsed(); + + /*-****************************************************************************************************//** + @short get a host and port from a concated string form <host>:<port> + + @param "aProxyHostPort" ; a string with the following format <host>:<port> + @param "aHost" ; a host string + @param "aPort" ; a port string + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void getProxyHostPort( const OUSTRING& aProxyHostPort, OUSTRING& aHost, OUSTRING& aPort ); + + /*-****************************************************************************************************//** + @short get a ressource for given id from right ressource file + @descr This dialog need his own ressource. We can't use the global ressource manager! + We must use our own. + You must give us the ressource language. If no right ressource could be found - + any existing one is used automaticly! + + @seealso method setValues() + + @param "nId" ; id to convert it in right ressource id + @param "aLanguage" ; type of ressource language + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + static ResId impl_getResId( sal_uInt16 nId , + ::com::sun::star::lang::Locale aLocale ); + + //------------------------------------------------------------------------------------------------------------- + // private member + //------------------------------------------------------------------------------------------------------------- + + private: + + FixedImage m_imageHeader ; + FixedText m_textLoginText ; + FixedText m_textUserName ; + Edit m_editUserName ; + FixedText m_textPassword ; + Edit m_editPassword ; + FixedLine m_fixedLineServer ; + FixedText m_textServer ; + ComboBox m_comboServer ; + FixedLine m_fixedLineProxySettings ; + RadioButton m_radioNoProxy ; + RadioButton m_radioBrowserProxy ; + RadioButton m_radioCustomProxy ; + FixedText m_textSecurityProxy ; + FixedText m_textSecurityProxyHost ; + Edit m_editSecurityProxyHost ; + FixedText m_textSecurityProxyPort ; + Edit m_editSecurityProxyPort ; + FixedLine m_fixedLineButtons ; + OKButton m_buttonOK ; + CancelButton m_buttonCancel ; + PushButton m_buttonAdditionalSettings ; + Size m_expandedDialogSize ; + Size m_collapsedDialogSize ; + Point m_expOKButtonPos ; + Point m_expCancelButtonPos ; + Point m_expAdditionalButtonPos ; + Point m_colOKButtonPos ; + Point m_colCancelButtonPos ; + Point m_colAdditionalButtonPos ; + OUSTRING m_colButtonAddText ; + OUSTRING m_expButtonAddText ; + tIMPL_DialogData m_aDataSet ; +}; + +/*-************************************************************************************************************//** + @short + + @descr - + + @implements XInterface + XTypeProvider + XServiceInfo + XDialog + + @base ThreadHelpBase + OWeakObject +*//*-*************************************************************************************************************/ + +class LoginDialog : public XTYPEPROVIDER , + public XSERVICEINFO , + public XDIALOG , + public XFLUSHABLE , + private ThreadHelpBase , // Order of baseclasses is neccessary for right initialization! + public OBROADCASTHELPER , + public OPROPERTYSETHELPER , + public OWEAKOBJECT +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + LoginDialog( const REFERENCE< XMULTISERVICEFACTORY >& sFactory ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~LoginDialog(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XFlushable + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short write changed values to configuration + @descr Normaly the dialog returns with an OK or ERROR value. If OK occure - we flush data + auomaticly. But otherwise we do nothing. If user of this service wish to use property set + only without any UI(!) - he must call "flush()" explicitly to write data! + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL flush() throw( RUNTIMEEXCEPTION ); + virtual void SAL_CALL addFlushListener( const REFERENCE< XFLUSHLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + virtual void SAL_CALL removeFlushListener( const REFERENCE< XFLUSHLISTENER >& xListener ) throw( RUNTIMEEXCEPTION ); + + //--------------------------------------------------------------------------------------------------------- + // XDialog + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short set new title of dialog + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setTitle( const OUSTRING& sTitle ) throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short return the current title of this dialog + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual OUSTRING SAL_CALL getTitle() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short show the dialog and return user reaction + @descr If user close dialog with OK we return 1 else + user has cancelled this dialog and we return 0. + You can use this return value directly as boolean. + + @seealso - + + @param - + @return 1; if closed with OK + @return 0; if cancelled + + @onerror We return 0(FALSE). + *//*-*****************************************************************************************************/ + + virtual sal_Int16 SAL_CALL execute() throw( RUNTIMEEXCEPTION ); + + /*-****************************************************************************************************//** + @short not implemented yet! + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL endExecute() throw( RUNTIMEEXCEPTION ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //--------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to convert a property value + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + You must try to convert the value of given propertyhandle and + return results of this operation. This will be use to ask vetoable + listener. If no listener have a veto, we will change value realy! + ( in method setFastPropertyValue_NoBroadcast(...) ) + + @seealso class OPropertySetHelper + @seealso method setFastPropertyValue_NoBroadcast() + @seealso method impl_tryToChangeProperty() + + @param "aConvertedValue" new converted value of property + @param "aOldValue" old value of property + @param "nHandle" handle of property + @param "aValue" new value of property + @return sal_True if value will be changed, sal_FALSE otherway + + @onerror IllegalArgumentException, if you call this with an invalid argument + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL convertFastPropertyValue( ANY& aConvertedValue , + ANY& aOldValue , + sal_Int32 nHandle , + const ANY& aValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + /*-****************************************************************************************************//** + @short set value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + Handle and value are valid everyway! You must set the new value only. + After this, baseclass send messages to all listener automaticly. + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" new value of property + @return - + + @onerror An exception is thrown. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const ANY& aValue ) throw( EXCEPTION ); + + /*-****************************************************************************************************//** + @short get value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" current value of property + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL getFastPropertyValue( ANY& aValue , + sal_Int32 nHandle ) const; + + /*-****************************************************************************************************//** + @short return structure and information about transient properties + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param - + @return structure with property-informations + + @onerror - + *//*-*****************************************************************************************************/ + + virtual IPROPERTYARRAYHELPER& SAL_CALL getInfoHelper(); + + /*-****************************************************************************************************//** + @short return propertysetinfo + @descr You can call this method to get information about transient properties + of this object. + + @seealso OPropertySetHelper + @seealso XPropertySet + @seealso XMultiPropertySet + + @param - + @return reference to object with information [XPropertySetInfo] + + @onerror - + *//*-*****************************************************************************************************/ + + virtual REFERENCE< XPROPERTYSETINFO > SAL_CALL getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short return table of all supported properties + @descr We need this table to initialize our helper baseclass OPropertySetHelper + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + const SEQUENCE< PROPERTY > impl_getStaticPropertyDescriptor(); + + /*-****************************************************************************************************//** + @short helper method to check if a property will change his value + @descr Is neccessary for vetoable listener mechanism of OPropertySethelper. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + sal_Bool impl_tryToChangeProperty( const OUSTRING& sProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const SEQUENCE< OUSTRING >& seqProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const sal_Int32& nProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const LOCALE& aProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + sal_Bool impl_tryToChangeProperty( const ANY& aProperty , + const ANY& aValue , + ANY& aOldValue , + ANY& aConvertedValue ) throw( ILLEGALARGUMENTEXCEPTION ); + + /*-****************************************************************************************************//** + @short search and open profile + @descr This method search and open the ini file. It initialize some member too. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_openProfile(); + + /*-****************************************************************************************************//** + @short close profile and free some member + @descr This method close current opened ini file and deinitialize some member too. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_closeProfile(); + + /*-****************************************************************************************************//** + @short write profile and free some member + @descr This method writes current settings and deinitialize some member too. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + void impl_writeProfile(); + + /*-****************************************************************************************************//** + @short check current server history + @descr Our current server history implementation can handle 10 elements as maximum. + If more then 10 elements exist; old ones will be deleted. + + @seealso - + + @param "seqHistory"; current history + @return Sequence< OUString >; checked and repaired history + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_addServerToHistory( SEQUENCE< OUSTRING >& seqHistory , + sal_Int32& nActiveServer , + const OUSTRING& sServer ); + + /*-****************************************************************************************************//** + @short helper methods to read/write properties from/to ini file + @descr Using of Config-Class isn't easy everytime :-( + Thats the reason for these helper. State of operation isn't realy important .. + but we assert impossible cases or occured errors! + + @seealso - + + @param - + @return - + + @onerror Assertions are shown. + *//*-*****************************************************************************************************/ + + void impl_writeUserName ( const OUSTRING& sUserName ); + void impl_writeActiveServer ( sal_Int32 nActiveServer ); + void impl_writeServerHistory ( const SEQUENCE< OUSTRING >& lHistory ); + void impl_writeConnectionType ( const OUSTRING& sConnectionType ); + void impl_writeLanguage ( const LOCALE& aLanguage ); + void impl_writePortHttp ( sal_Int32 nPort ); + void impl_writePortHttps ( sal_Int32 nPort ); + void impl_writeSecurityProxy ( const OUSTRING& sSecurityProxy ); + void impl_writeUseProxy ( const OUSTRING& sUseProxy ); + void impl_writeDialog ( const OUSTRING& sDialog ); + + OUSTRING impl_readUserName ( ); + sal_Int32 impl_readActiveServer ( ); + SEQUENCE< OUSTRING > impl_readServerHistory ( ); + OUSTRING impl_readConnectionType ( ); + LOCALE impl_readLanguage ( ); + sal_Int32 impl_readPortHttp ( ); + sal_Int32 impl_readPortHttps ( ); + OUSTRING impl_readSecurityProxy ( ); + OUSTRING impl_readUseProxy ( ); + OUSTRING impl_readDialog ( ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + sal_Bool impldbg_checkParameter_LoginDialog ( const REFERENCE< XMULTISERVICEFACTORY >& xFactory ); + sal_Bool impldbg_checkParameter_setTitle ( const OUSTRING& sTitle ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + REFERENCE< XMULTISERVICEFACTORY > m_xFactory ; /// reference to factory, which has created this instance + OUSTRING m_sININame ; /// full qualified path to profile UNC-notation + Config* m_pINIManager ; /// manager for full access to ini file + sal_Bool m_bInExecuteMode ; /// protection against setting of properties during showing of dialog + cIMPL_Dialog* m_pDialog ; /// VCL dialog + tIMPL_DialogData m_aPropertySet ; + +}; // class LoginDialog + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_LOGINDIALOG_LOGINDIALOG_HXX_ diff --git a/framework/inc/services/mediatypedetectionhelper.hxx b/framework/inc/services/mediatypedetectionhelper.hxx new file mode 100644 index 000000000000..4c4ac90a9a2e --- /dev/null +++ b/framework/inc/services/mediatypedetectionhelper.hxx @@ -0,0 +1,154 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: mediatypedetectionhelper.hxx,v $ + * $Revision: 1.6 $ + * + * 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 __FRAMEWORK_SERVICES_MEDIATYPEDETECTIONHELPER_HXX_ +#define __FRAMEWORK_SERVICES_MEDIATYPEDETECTIONHELPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/util/XStringMapping.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +//_________________________________________________________________________________________________________________ +// namespaces +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short - + @descr - + + @implements XInterface + XTypeProvider + XServiceInfo + XStringMapping + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class MediaTypeDetectionHelper : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringMapping, css::lang::XServiceInfo> +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of this class with all needed informations for work. + + @seealso - + + @param "xFactory", reference to factory which has created ouer owner(!). We can use these to create new uno-services. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + MediaTypeDetectionHelper( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~MediaTypeDetectionHelper(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XStringMapping + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL mapStrings( css::uno::Sequence< ::rtl::OUString >& seqParameter ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // variables + // should be private every time + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory; /// reference to global servicemanager + +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_MEDIATYPEDETECTIONHELPER_HXX_ diff --git a/framework/inc/services/modulemanager.hxx b/framework/inc/services/modulemanager.hxx new file mode 100644 index 000000000000..6b98f5e2a527 --- /dev/null +++ b/framework/inc/services/modulemanager.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: modulemanager.hxx,v $ + * $Revision: 1.7 $ + * + * 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 __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ +#define __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ + +//_______________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <general.h> +#include <stdtypes.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XContainerQuery.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> + +//_______________________________________________ +// definition + +namespace framework +{ + +//_______________________________________________ +/** + implements the service com.sun.star.frame.ModuleManager + */ +class ModuleManager : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::frame::XModuleManager + , public css::container::XNameReplace // => XNameAccess, XElementAccess + , public css::container::XContainerQuery + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________________ + // member + + private: + + //--------------------------------------- + /** the global uno service manager. + Must be used to create own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //--------------------------------------- + /** points to the underlying configuration. + This ModuleManager does not cache - it calls directly the + configuration API! + */ + css::uno::Reference< css::container::XNameAccess > m_xCFG; + + //___________________________________________ + // interface + + public: + + ModuleManager(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~ModuleManager( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XModuleManager + virtual ::rtl::OUString SAL_CALL identify(const css::uno::Reference< css::uno::XInterface >& xModule) + throw(css::lang::IllegalArgumentException, + css::frame::UnknownModuleException, + css::uno::RuntimeException ); + + // XNameReplace + virtual void SAL_CALL replaceByName(const ::rtl::OUString& sName , + const css::uno::Any& aValue) + throw (css::lang::IllegalArgumentException , + css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName(const ::rtl::OUString& sName) + throw(css::container::NoSuchElementException, + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& sName) + throw(css::uno::RuntimeException); + + // XElementAccess + virtual css::uno::Type SAL_CALL getElementType() + throw(css::uno::RuntimeException); + + virtual sal_Bool SAL_CALL hasElements() + throw(css::uno::RuntimeException); + + // XContainerQuery + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByQuery(const ::rtl::OUString& sQuery) + throw(css::uno::RuntimeException); + + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createSubSetEnumerationByProperties(const css::uno::Sequence< css::beans::NamedValue >& lProperties) + throw(css::uno::RuntimeException); + //___________________________________________ + // helper + + private: + + //--------------------------------------- + /** @short open the underlying configuration. + + @descr This method must be called everytimes + a (reaonly!) configuration is needed. Because + method works together with the member + m_xCFG, open it on demand and cache it + afterwards. + + Note: A writable configuration access + must be created explicitly. Otherwise + we cant make sure that broken write requests + wont affect our read access ! + + @return [com.sun.star.container.XNameAccess] + the configuration object + + @throw [com.sun.star.uno.RuntimeException] + if config could not be opened successfully! + + @threadsafe + */ + css::uno::Reference< css::container::XNameAccess > implts_getConfig() + throw(css::uno::RuntimeException); + + //--------------------------------------- + /** @short makes the real identification of the module. + + @descr It checks for the optional but preferred interface + XModule first. If this module does not exists at the + given component it tries to use XServiceInfo instead. + + Note: This method try to locate a suitable module name. + Nothing else. Selecting the right component and throwing suitable + exceptions must be done outside. + + @see identify() + + @param xComponent + the module for identification. + + @return The identifier of the given module. + Can be empty if given component is not a real module ! + + @threadsafe + */ + ::rtl::OUString implts_identify(const css::uno::Reference< css::uno::XInterface >& xComponent); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_MODULEMANAGER_HXX_ diff --git a/framework/inc/services/pathsettings.hxx b/framework/inc/services/pathsettings.hxx new file mode 100644 index 000000000000..214351ca50bb --- /dev/null +++ b/framework/inc/services/pathsettings.hxx @@ -0,0 +1,298 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pathsettings.hxx,v $ + * $Revision: 1.9 $ + * + * 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 __FRAMEWORK_SERVICES_PATHSETTINGS_HXX_ +#define __FRAMEWORK_SERVICES_PATHSETTINGS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> +#include <com/sun/star/util/XChangesListener.hpp> +#include <com/sun/star/container/XNameAccess.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> +#include <unotools/configitem.hxx> +#include <comphelper/sequenceasvector.hxx> + +/* enable it if you whish to migrate old user settings (using the old cfg schema) on demand .... + disable it in case only the new schema must be used. + */ +#define MIGRATE_OLD_USER_PATHES + +namespace framework +{ + +class PathSettings : public css::lang::XTypeProvider , + public css::lang::XServiceInfo , + public css::util::XChangesListener , // => XEventListener + // base classes + // Order is neccessary for right initialization! + private ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , // => XPropertySet / XFastPropertySet / XMultiPropertySet + public ::cppu::OWeakObject // => XWeak, XInterface +{ + struct PathInfo + { + public: + + PathInfo() + : sPathName () + , lInternalPaths() + , lUserPaths () + , sWritePath () + , bIsSinglePath (sal_False) + , bIsReadonly (sal_False) + {} + + PathInfo(const PathInfo& rCopy) + { + takeOver(rCopy); + } + + void takeOver(const PathInfo& rCopy) + { + sPathName = rCopy.sPathName; + lInternalPaths = rCopy.lInternalPaths; + lUserPaths = rCopy.lUserPaths; + sWritePath = rCopy.sWritePath; + bIsSinglePath = rCopy.bIsSinglePath; + bIsReadonly = rCopy.bIsReadonly; + } + + /// an internal name describing this path + ::rtl::OUString sPathName; + + /// contains all paths, which are used internaly - but are not visible for the user. + OUStringList lInternalPaths; + + /// contains all paths configured by the user + OUStringList lUserPaths; + + /// this special path is used to generate feature depending content there + ::rtl::OUString sWritePath; + + /// indicates real single pathes, which uses WritePath property only + sal_Bool bIsSinglePath; + + /// simple handling of finalized/mandatory states ... => we know one state READONLY only .-) + sal_Bool bIsReadonly; + }; + + typedef BaseHash< PathSettings::PathInfo > PathHash; + + enum EChangeOp + { + E_UNDEFINED, + E_ADDED, + E_CHANGED, + E_REMOVED + }; + + // ______________________________________ + // member + + private: + + /** reference to factory, which has create this instance. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** list of all path variables and her corresponding values. */ + PathSettings::PathHash m_lPaths; + + /** describes all properties available on our interface. + Will be generated on demand based on our path list m_lPaths. */ + css::uno::Sequence< css::beans::Property > m_lPropDesc; + + /** helper needed to (re-)substitute all internal save path values. */ + css::uno::Reference< css::util::XStringSubstitution > m_xSubstitution; + + /** provides access to the old configuration schema (which will be migrated on demand). */ + css::uno::Reference< css::container::XNameAccess > m_xCfgOld; + + /** provides access to the new configuration schema. */ + css::uno::Reference< css::container::XNameAccess > m_xCfgNew; + + ::cppu::OPropertyArrayHelper* m_pPropHelp; + + ::sal_Bool m_bIgnoreEvents; + + // ___________________________________________ + // interface + + public: + + /** initialize a new instance of this class. + Attention: It's neccessary for right function of this class, that the order of base + classes is the right one. Because we transfer information from one base to another + during this ctor runs! */ + PathSettings(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + /** free all used ressources ... if it was not already done. */ + virtual ~PathSettings(); + + /** declaration of XInterface, XTypeProvider, XServiceInfo */ + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // css::util::XChangesListener + virtual void SAL_CALL changesOccurred(const css::util::ChangesEvent& aEvent) throw (css::uno::RuntimeException); + + // css::lang::XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aSource) + throw(css::uno::RuntimeException); + + using ::cppu::OPropertySetHelper::disposing; + + // ___________________________________________ + // helper + + private: + + /** read all configured paths and create all needed internal structures. */ + void impl_readAll(); + + /** read a path info using the old cfg schema. + This is needed for "migration on demand" reasons only. + Can be removed for next major release .-) */ + OUStringList impl_readOldFormat(const ::rtl::OUString& sPath); + + /** read a path info using the new cfg schema. */ + PathSettings::PathInfo impl_readNewFormat(const ::rtl::OUString& sPath); + + /** filter "real user defined paths" from the old configuration schema + and set it as UserPaths on the new schema. + Can be removed with new major release ... */ + #ifdef MIGRATE_OLD_USER_PATHES + void impl_mergeOldUserPaths( PathSettings::PathInfo& rPath, + const OUStringList& lOld ); + #endif + + /** reload one path directly from the new configuration schema (because + it was updated by any external code) */ + PathSettings::EChangeOp impl_updatePath(const ::rtl::OUString& sPath , + sal_Bool bNotifyListener); + + /** replace all might existing placeholder variables inside the given path ... + or check if the given path value uses paths, which can be replaced with predefined + placeholder variables ... + */ + void impl_subst( OUStringList& lVals , + const css::uno::Reference< css::util::XStringSubstitution >& xSubst , + sal_Bool bReSubst); + + void impl_subst(PathSettings::PathInfo& aPath , + sal_Bool bReSubst); + + + /** converts our new string list schema to the old ";" seperated schema ... */ + ::rtl::OUString impl_convertPath2OldStyle(const PathSettings::PathInfo& rPath ) const; + OUStringList impl_convertOldStyle2Path(const ::rtl::OUString& sOldStylePath) const; + + /** remove still known paths from the given lList argument. + So real user defined paths can be extracted from the list of + fix internal paths ! + */ + void impl_purgeKnownPaths(const PathSettings::PathInfo& rPath, + OUStringList& lList); + + /** rebuild the member m_lPropDesc using the path list m_lPaths. */ + void impl_rebuildPropertyDescriptor(); + + /** provides direct access to the list of path values + using it's internal property id. + */ + css::uno::Any impl_getPathValue( sal_Int32 nID ) const; + void impl_setPathValue( sal_Int32 nID , + const css::uno::Any& aVal); + + /** check the given handle and return the corresponding PathInfo reference. + These reference can be used then directly to manipulate these path. */ + PathSettings::PathInfo* impl_getPathAccess (sal_Int32 nHandle); + const PathSettings::PathInfo* impl_getPathAccessConst(sal_Int32 nHandle) const; + + /** it checks, if the given path value seams to be a valid URL or system path. */ + sal_Bool impl_isValidPath(const ::rtl::OUString& sPath) const; + sal_Bool impl_isValidPath(const OUStringList& lPath) const; + + void impl_storePath(const PathSettings::PathInfo& aPath); + + css::uno::Sequence< sal_Int32 > impl_mapPathName2IDList(const ::rtl::OUString& sPath); + + void impl_notifyPropListener( PathSettings::EChangeOp eOp , + const ::rtl::OUString& sPath , + const PathSettings::PathInfo* pPathOld, + const PathSettings::PathInfo* pPathNew); + + + // OPropertySetHelper + virtual sal_Bool SAL_CALL convertFastPropertyValue ( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) throw(css::lang::IllegalArgumentException); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) throw(css::uno::Exception); + using cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue ( css::uno::Any& aValue , + sal_Int32 nHandle ) const; + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper ( ); + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo ( ) throw(::com::sun::star::uno::RuntimeException); + + /** factory methods to guarantee right (but on demand) initialized members ... */ + css::uno::Reference< css::util::XStringSubstitution > fa_getSubstitution(); + css::uno::Reference< css::container::XNameAccess > fa_getCfgOld(); + css::uno::Reference< css::container::XNameAccess > fa_getCfgNew(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_PATHSETTINGS_HXX_ diff --git a/framework/inc/services/pluginframe.hxx b/framework/inc/services/pluginframe.hxx new file mode 100644 index 000000000000..46a90015a56e --- /dev/null +++ b/framework/inc/services/pluginframe.hxx @@ -0,0 +1,378 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: pluginframe.hxx,v $ + * $Revision: 1.10 $ + * + * 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 __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_ +#define __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/mozilla/XPluginInstance.hpp> +#include <com/sun/star/mozilla/XPluginInstancePeer.hpp> +#include <com/sun/star/mozilla/XPluginWindowPeer.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/frame/XDispatchResultListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/lang/EventObject.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#ifndef _VCL_ATOM_HXX +#include <vcl/threadex.hxx> +#endif +#include <svtools/cmdoptions.hxx> + + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements an special frame - a plugin frame + @descr - + + @implements XInitialization + XPluginInstance + XDispatchResultListener + @base Frame +*//*-*************************************************************************************************************/ + +class PlugInFrame : public css::lang::XInitialization , + public css::mozilla::XPluginInstance , + public css::frame::XDispatchResultListener , // => XEVENTLISTENER + public Frame // Order of baseclasses is neccessary for right initialization! +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor to create instance + @descr This constructor initialize a new instance of this class, + and will be set valid values on his member and baseclasses. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + PlugInFrame( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~PlugInFrame(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XInitialization + //--------------------------------------------------------------------------------------------------------- + + void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& seqArguments ) throw( css::uno::Exception , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XPluginInstance + //--------------------------------------------------------------------------------------------------------- + + void SAL_CALL start () throw( css::uno::RuntimeException ); + void SAL_CALL implcb_start () throw( css::uno::RuntimeException ); + void SAL_CALL stop () throw( css::uno::RuntimeException ); + void SAL_CALL implcb_stop () throw( css::uno::RuntimeException ); + void SAL_CALL destroy () throw( css::uno::RuntimeException ); + void SAL_CALL implcb_destroy() throw( css::uno::RuntimeException ); + void SAL_CALL createWindow ( const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ) throw( css::uno::RuntimeException ); + void SAL_CALL implcb_createWindow ( const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ) throw( css::uno::RuntimeException ); + void SAL_CALL newStream ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + void SAL_CALL implcb_newStream + ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + void SAL_CALL newURL ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + void SAL_CALL implcb_newURL ( const ::rtl::OUString& sMIMEDescription, + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Any& aSessionId ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL getHttpServerURL( ::rtl::OUString& sHost , + sal_uInt16& nPort , + ::rtl::OUString& sPrefix ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchProvider + //--------------------------------------------------------------------------------------------------------- + + virtual css::uno::Reference< css::frame::XDispatch > SAL_CALL queryDispatch( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName, + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + virtual css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL queryDispatches( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescripts ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDispatchResultListener + //--------------------------------------------------------------------------------------------------------- + + virtual void SAL_CALL dispatchFinished ( const css::frame::DispatchResultEvent& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + void impl_tryToLoadDocument(); + sal_Bool impl_registerRemoteFactories( const css::uno::Reference< css::lang::XMultiServiceFactory >& xRemoteServiceManager ); + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + static sal_Bool impldbg_checkParameter_initialize ( const css::uno::Sequence< css::uno::Any >& seqArguments ); + static sal_Bool impldbg_checkParameter_createWindow ( const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ); + static sal_Bool impldbg_checkParameter_newStream ( const ::rtl::OUString& sMIMEDescription , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream ); + static sal_Bool impldbg_checkParameter_newURL ( const ::rtl::OUString& sMIMEDescription , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter ); + static sal_Bool impldbg_checkParameter_getHttpServerURL ( ::rtl::OUString& sHost , + sal_uInt16& nPort , + ::rtl::OUString& sPrefix ); + static sal_Bool impldbg_checkParameter_queryDispatch ( const css::util::URL& aURL , + const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ); + static sal_Bool impldbg_checkParameter_queryDispatches ( const css::uno::Sequence< css::frame::DispatchDescriptor >& seqDescripts ); + static sal_Bool impldbg_checkParameter_statusChanged ( const css::frame::FeatureStateEvent& aEvent ); + static sal_Bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::mozilla::XPluginInstancePeer > m_xPlugInInstancePeer ; /// Reference to UNO interface of PlugIn dll for communication with browser + css::uno::Reference< css::mozilla::XPluginWindowPeer > m_xPlugInWindowPeer ; /// Reference to set child window at plugin window + css::uno::Sequence< css::beans::PropertyValue > m_seqProperties ; /// Sequence of properties as arguments for load document + css::util::URL m_aURL ; /// URL for document to load + sal_Bool m_bILoad ; /// PlugInFrame has a valid loader which load the document and wait for finished/cancelled + sal_Bool m_bIHaveDocument ; /// We have a document loaded successful. + css::uno::Reference< css::frame::XDispatchProvider > m_xPlugInDispatcher ; /// Dispatcher to forward dispatches to browser + static sal_Bool m_bRemoteFactoriesExist ; /// indicates, if remote factories was already registered (neccessary one times only!) + SvtCommandOptions m_aCommandOptions ; /// ref counted class to support disabling commands defined by configuration file + +}; // class PlugInFrame + +/*-************************************************************************************************************//** + @short used to forward all asynchronous calls which use VCL internal to the main thread + @descr We need this asynchronous mechanism to prevent us against dead locks. Sometimes our main thread + can call us for event handling like FOCUS, ACTIVATE and something else. But at the same time we will call + the main thread to CREATE A WINDOW, SET IT VISIBLE ... Then we have a problem. We must send us himself a event + to run our code synchronized with our main thread! + + @implements + @base - +*//*-*************************************************************************************************************/ + +enum eIMPL_PluginCommand +{ + START , + STOP , + CREATEWINDOW , + DESTROY , + NEWSTREAM , + NEWURL +}; + +class cIMPL_MainThreadExecutorRequest +{ + public: + cIMPL_MainThreadExecutorRequest( eIMPL_PluginCommand eCommand , + PlugInFrame* pPluginInstance ); + + cIMPL_MainThreadExecutorRequest( eIMPL_PluginCommand eCommand , + PlugInFrame* pPluginInstance , + const css::uno::Any& aPlatformWindowHandle , + sal_Bool bEmbedded ); + + cIMPL_MainThreadExecutorRequest( eIMPL_PluginCommand eCommand , + PlugInFrame* pPluginInstance , + const ::rtl::OUString& sMIMEDescription , + const ::rtl::OUString& sURL , + const ::rtl::OUString& sFilter , + const css::uno::Reference< css::io::XInputStream >& xStream , + const css::uno::Any& aSessionId ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual long doIt(); + + //------------------------------------------------------------------------------------------------------------- + // private variables + //------------------------------------------------------------------------------------------------------------- + private: + + eIMPL_PluginCommand m_eCommand ; /// switch to specify forward function + PlugInFrame* m_pPluginInstance ; /// instance wich has started this swicth mechanism and wish to called back from us + css::uno::Reference< css::uno::XInterface > m_xPluginInstance ; /// reference to our plugin frame to prevent that plugin frame dies before we call back + css::uno::Any m_aPlatformWindowHandle ; /// parameter for XPluginInstance->createWindow() + sal_Bool m_bEmbedded ; /// parameter for XPluginInstance->createWindow() + ::rtl::OUString m_sMIMEDescription ; /// parameter for XPluginInstance->newStream()/newURL() + ::rtl::OUString m_sURL ; /// parameter for XPluginInstance->newStream()/newURL() + ::rtl::OUString m_sFilter ; /// parameter for XPluginInstance->newStream()/newURL() + css::uno::Reference< css::io::XInputStream > m_xStream ; /// parameter for XPluginInstance->newStream()/newURL() + css::uno::Any m_aSessionId ; /// parameter for XPluginInstance->newStream()/newURL() +}; + +class cIMPL_MainThreadExecutor +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + static void execute( cIMPL_MainThreadExecutorRequest* pRequest ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + DECL_STATIC_LINK( cIMPL_MainThreadExecutor, worker, cIMPL_MainThreadExecutorRequest* ); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_PLUGINFRAME_HXX_ diff --git a/framework/inc/services/sessionlistener.hxx b/framework/inc/services/sessionlistener.hxx new file mode 100644 index 000000000000..cbb22a322d48 --- /dev/null +++ b/framework/inc/services/sessionlistener.hxx @@ -0,0 +1,175 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sessionlistener.hxx,v $ + * $Revision: 1.8 $ + * + * 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 __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_ +#define __FRAMEWORK_SERVICES_SESSIONLISTENER_HXX_ + +//_______________________________________________ +// my own includes + +#include <classes/filtercache.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XInitialization.hpp> + + +#include <com/sun/star/frame/XSessionManagerListener.hpp> +#include <com/sun/star/frame/XSessionManagerClient.hpp> +#include <com/sun/star/frame/XStatusListener.hpp> +#include <com/sun/star/frame/FeatureStateEvent.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Any.hxx> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <cppuhelper/interfacecontainer.h> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// exported const + +//_______________________________________________ +// exported definitions + +/// @HTML +/** @short implements flat/deep detection of file/stream formats and provides + further read/write access to the global office type configuration. + + @descr Using of this class makes it possible to get information about the + format type of a given URL or stream. The returned internal type name + can be used to get more informations about this format. Further this + class provides full access to the configuration data and following + implementations will support some special query modes. + + @author as96863 + + @docdate 10.03.2003 by as96863 + + @todo <ul> + <li>implementation of query mode</li> + <li>simple restore mechanism of last consistent cache state, + if flush failed</li> + </ul> + */ +/// @NOHTML + +class SessionListener : // interfaces + public css::lang::XTypeProvider, + public css::lang::XInitialization, + public css::frame::XSessionManagerListener, + public css::frame::XStatusListener, + public css::lang::XServiceInfo, + // baseclasses (order important for initialization!) + // Struct for right initalization of mutex member! Must be the first one of baseclasses! + private ThreadHelpBase, + public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + /** reference to the uno service manager, which created this service. + It can be used to create own needed helper services. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + css::uno::Reference< css::frame::XSessionManagerClient > m_rSessionManager; + + // restore handling + sal_Bool m_bRestored; + + public: + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + #ifdef ENABLE_AUTODOC_FIX + ; + #endif + + //--------------------------------------- + + /** @short initialize new instance of this class. + + @param xSMGR + reference to the global uno service manager, which created this new + factory instance. It must be used during runtime to create own + needed services. + */ + + SessionListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR ); + + virtual ~SessionListener(); + + virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject&) throw (css::uno::RuntimeException); + + + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& args) throw (css::uno::RuntimeException); + + // XSessionManagerListener + virtual void SAL_CALL doSave( sal_Bool bShutdown, sal_Bool bCancelable ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL approveInteraction( sal_Bool bInteractionGranted ) + throw (css::uno::RuntimeException); + virtual void SAL_CALL shutdownCanceled() + throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL doRestore() + throw (css::uno::RuntimeException); + + // XStatusListener + virtual void SAL_CALL statusChanged(const com::sun::star::frame::FeatureStateEvent& event) + throw (css::uno::RuntimeException); + + void doSaveImpl( sal_Bool bShutdown, sal_Bool bCancelable ) throw (css::uno::RuntimeException); +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TYPEDETECTION_HXX_ diff --git a/framework/inc/services/substitutepathvars.hxx b/framework/inc/services/substitutepathvars.hxx new file mode 100644 index 000000000000..a95e913695b0 --- /dev/null +++ b/framework/inc/services/substitutepathvars.hxx @@ -0,0 +1,308 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: substitutepathvars.hxx,v $ + * $Revision: 1.14 $ + * + * 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 __FRAMEWORK_SERVICES_SUBSTPATHVARS_HXX_ +#define __FRAMEWORK_SERVICES_SUBSTPATHVARS_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <list> +#include <hash_map> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/container/NoSuchElementException.hpp> +#include <com/sun/star/util/XStringSubstitution.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> +#include <rtl/ustring.hxx> +#include <unotools/configitem.hxx> +#include <tools/link.hxx> +#include <i18npool/lang.h> + +namespace framework +{ + +// Must be zero value based +enum EnvironmentType +{ + ET_HOST = 0 , + ET_YPDOMAIN , + ET_DNSDOMAIN , + ET_NTDOMAIN , + ET_OS , + ET_UNKNOWN , + ET_COUNT +}; + +// Must be zero value based +enum OperatingSystem +{ + OS_WINDOWS = 0, + OS_UNIX , + OS_SOLARIS , + OS_LINUX , + OS_UNKNOWN , + OS_COUNT +}; + +struct SubstituteRule +{ + SubstituteRule() {} + SubstituteRule( const rtl::OUString& aVarName, + const rtl::OUString& aValue, + const com::sun::star::uno::Any& aVal, + EnvironmentType aType ) : + aSubstVariable( aVarName ), aSubstValue( aValue ), aEnvValue( aVal ), aEnvType( aType ) {} + + rtl::OUString aSubstVariable; + rtl::OUString aSubstValue; + com::sun::star::uno::Any aEnvValue; + EnvironmentType aEnvType; +}; + +struct SubstitutePathNotify +{ + SubstitutePathNotify() {}; + const com::sun::star::uno::Sequence<rtl::OUString> aPropertyNames; +}; + +class SubstituteVariables : public ::std::hash_map< ::rtl::OUString, + SubstituteRule, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > +{ + public: + inline void free() + { + SubstituteVariables().swap( *this ); + } +}; + +typedef std::vector< SubstituteRule > SubstituteRuleVector; +class SubstitutePathVariables_Impl : public utl::ConfigItem +{ + public: + SubstitutePathVariables_Impl( const Link& aNotifyLink ); + virtual ~SubstitutePathVariables_Impl(); + + static OperatingSystem GetOperatingSystemFromString( const rtl::OUString& ); + static EnvironmentType GetEnvTypeFromString( const rtl::OUString& ); + + void GetSharePointsRules( SubstituteVariables& aSubstVarMap ); + + /** is called from the ConfigManager before application ends or from the + PropertyChangeListener if the sub tree broadcasts changes. */ + virtual void Notify( const com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); + + private: + // Wrapper methods for low-level functions + OperatingSystem GetOperatingSystem(); + const rtl::OUString& GetYPDomainName(); + const rtl::OUString& GetDNSDomainName(); + const rtl::OUString& GetNTDomainName(); + const rtl::OUString& GetHostName(); + + sal_Bool FilterRuleSet( const SubstituteRuleVector& aRuleSet, SubstituteRule& aActiveRule ); + + void ReadSharePointsFromConfiguration( com::sun::star::uno::Sequence< rtl::OUString >& aSharePointsSeq ); + void ReadSharePointRuleSetFromConfiguration( const rtl::OUString& aSharePointName, + const rtl::OUString& aSharePointNodeName, + SubstituteRuleVector& aRuleSet ); + + // Stored values for domains and host + sal_Bool m_bYPDomainRetrieved; + rtl::OUString m_aYPDomain; + sal_Bool m_bDNSDomainRetrieved; + rtl::OUString m_aDNSDomain; + sal_Bool m_bNTDomainRetrieved; + rtl::OUString m_aNTDomain; + sal_Bool m_bHostRetrieved; + rtl::OUString m_aHost; + sal_Bool m_bOSRetrieved; + OperatingSystem m_eOSType; + + Link m_aListenerNotify; + const rtl::OUString m_aSharePointsNodeName; + const rtl::OUString m_aDirPropertyName; + const rtl::OUString m_aEnvPropertyName; + const rtl::OUString m_aLevelSep; +}; + +enum PreDefVariable +{ + PREDEFVAR_INST, + PREDEFVAR_PROG, + PREDEFVAR_USER, + PREDEFVAR_WORK, + PREDEFVAR_HOME, + PREDEFVAR_TEMP, + PREDEFVAR_PATH, + PREDEFVAR_LANG, + PREDEFVAR_LANGID, + PREDEFVAR_VLANG, + PREDEFVAR_INSTPATH, + PREDEFVAR_PROGPATH, + PREDEFVAR_USERPATH, + PREDEFVAR_INSTURL, + PREDEFVAR_PROGURL, + PREDEFVAR_USERURL, + PREDEFVAR_WORKDIRURL, + // --> PB 2004-10-27 #i32656# - new variable of hierachy service + PREDEFVAR_BASEINSTURL, + PREDEFVAR_USERDATAURL, + // <-- + PREDEFVAR_BRANDBASEURL, + PREDEFVAR_COUNT +}; + +struct PredefinedPathVariables +{ + // Predefined variables supported by substitute variables + LanguageType m_eLanguageType; // Lanuage type of Office + rtl::OUString m_FixedVar[ PREDEFVAR_COUNT ]; // Variable value access by PreDefVariable + rtl::OUString m_FixedVarNames[ PREDEFVAR_COUNT ]; // Variable name access by PreDefVariable +}; + +struct ReSubstFixedVarOrder +{ + sal_Int32 nVarValueLength; + PreDefVariable eVariable; + + bool operator< ( const ReSubstFixedVarOrder& aFixedVarOrder ) const + { + // Reverse operator< to have high to low ordering + return ( nVarValueLength > aFixedVarOrder.nVarValueLength ); + } +}; + +struct ReSubstUserVarOrder +{ + sal_Int32 nVarValueLength; + rtl::OUString aVarName; + + bool operator< ( const ReSubstUserVarOrder& aUserVarOrder ) const + { + // Reverse operator< to have high to low ordering + return ( nVarValueLength > aUserVarOrder.nVarValueLength ); + } +}; + +typedef std::list< ReSubstFixedVarOrder > ReSubstFixedVarOrderVector; +typedef std::list< ReSubstUserVarOrder > ReSubstUserVarOrderVector; + +class SubstitutePathVariables : private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringSubstitution, css::lang::XServiceInfo> +{ + friend class SubstitutePathVariables_Impl; + + public: + SubstitutePathVariables( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~SubstitutePathVariables(); + + // XInterface, XTypeProvider, XServiceInfo + DECLARE_XSERVICEINFO + + // XStringSubstitution + virtual rtl::OUString SAL_CALL substituteVariables( const ::rtl::OUString& aText, sal_Bool bSubstRequired ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + virtual rtl::OUString SAL_CALL reSubstituteVariables( const ::rtl::OUString& aText ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSubstituteVariableValue( const ::rtl::OUString& variable ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + protected: + DECL_LINK( implts_ConfigurationNotify, SubstitutePathNotify* ); + + void SetPredefinedPathVariables( PredefinedPathVariables& ); + rtl::OUString ConvertOSLtoUCBURL( const rtl::OUString& aOSLCompliantURL ) const; + + // Special case (transient) values can change during runtime! + // Don't store them in the pre defined struct + rtl::OUString GetWorkPath() const; + rtl::OUString GetWorkVariableValue() const; + rtl::OUString GetPathVariableValue() const; + + rtl::OUString GetHomeVariableValue() const; + + // XStringSubstitution implementation methods + rtl::OUString impl_substituteVariable( const ::rtl::OUString& aText, sal_Bool bSustRequired ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + rtl::OUString impl_reSubstituteVariables( const ::rtl::OUString& aText ) + throw (::com::sun::star::uno::RuntimeException); + ::rtl::OUString impl_getSubstituteVariableValue( const ::rtl::OUString& variable ) + throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException); + + private: + class VarNameToIndexMap : public std::hash_map< ::rtl::OUString, + PreDefVariable, + OUStringHashCode, + ::std::equal_to< ::rtl::OUString > > + { + inline void free() + { + VarNameToIndexMap().swap( *this ); + } + }; + + // heavy used string + const rtl::OUString m_aVarStart; + const rtl::OUString m_aVarEnd; + + VarNameToIndexMap m_aPreDefVarMap; // Mapping from pre-def variable names to enum for array access + SubstituteVariables m_aSubstVarMap; // Active rule set map indexed by variable name! + PredefinedPathVariables m_aPreDefVars; // All predefined variables + SubstitutePathVariables_Impl m_aImpl; // Implementation class that access the configuration + ReSubstFixedVarOrderVector m_aReSubstFixedVarOrder; // To speed up resubstitution fixed variables (order for lookup) + ReSubstUserVarOrderVector m_aReSubstUserVarOrder; // To speed up resubstitution user variables + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; +}; + +} + +#endif // __FRAMEWORK_SERVICES_SUBSTPATHVARS_HXX_ diff --git a/framework/inc/services/tabwindowservice.hxx b/framework/inc/services/tabwindowservice.hxx new file mode 100644 index 000000000000..8423a01f1793 --- /dev/null +++ b/framework/inc/services/tabwindowservice.hxx @@ -0,0 +1,234 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: urltransformer.hxx,v $ + * $Revision: 1.8 $ + * + * 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 __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ +#define __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/fwktabwindow.hxx> +#include <classes/propertysethelper.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h>
+#include <stdtypes.h> +
+//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +
+#include <com/sun/star/awt/XSimpleTabController.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +
+#include <cppuhelper/weak.hxx> +#include <vcl/window.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +struct TTabPageInfo +{
+ public:
+ + TTabPageInfo()
+ : m_nIndex ( -1 )
+ , m_bCreated (sal_False)
+ , m_pPage ( NULL )
+ , m_lProperties ( )
+ {}
+
+ TTabPageInfo(::sal_Int32 nID)
+ : m_nIndex ( nID )
+ , m_bCreated (sal_False)
+ , m_pPage ( NULL )
+ , m_lProperties ( )
+ {}
+
+ public:
+ + ::sal_Int32 m_nIndex;
+ ::sal_Bool m_bCreated; + FwkTabPage* m_pPage; + css::uno::Sequence< css::beans::NamedValue > m_lProperties; +};
+
+typedef ::std::hash_map< ::sal_Int32 , + TTabPageInfo , + Int32HashCode , + ::std::equal_to< ::sal_Int32 > > TTabPageInfoHash; + +/*-************************************************************************************************************//** + @short implements a helper service providing a dockable tab control window +*//*-*************************************************************************************************************/ + +class TabWindowService : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::awt::XSimpleTabController + , public ThreadHelpBase + , public TransactionBase + , public PropertySetHelper
+ , public ::cppu::OWeakObject
+{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- +
+ TabWindowService( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + virtual ~TabWindowService(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XSimpleTabController + //--------------------------------------------------------------------------------------------------------- + + virtual sal_Int32 SAL_CALL insertTab() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual void SAL_CALL setTabProps( sal_Int32 nID, const css::uno::Sequence< css::beans::NamedValue >& aProperties ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL getTabProps( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual void SAL_CALL activateTab( sal_Int32 nID ) throw ( css::lang::IndexOutOfBoundsException, css::uno::RuntimeException ); + virtual sal_Int32 SAL_CALL getActiveTabID() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL addTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeTabListener( const css::uno::Reference< css::awt::XTabListener >& Listener ) throw ( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + + virtual void SAL_CALL dispose() throw ( css::uno::RuntimeException ); + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw ( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + void impl_initializePropInfo(); + virtual void SAL_CALL impl_setPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle , + const css::uno::Any& aValue ); + virtual css::uno::Any SAL_CALL impl_getPropertyValue(const ::rtl::OUString& sProperty, + sal_Int32 nHandle ); + + DECL_DLLPRIVATE_LINK( EventListener, VclSimpleEvent * ); + + void impl_checkTabIndex (::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
+ TTabPageInfoHash::iterator impl_getTabPageInfo(::sal_Int32 nID) throw (css::lang::IndexOutOfBoundsException);
+ FwkTabWindow* mem_TabWin (); +/* + ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); + static css::uno::Reference < css::beans::XPropertySetInfo > SAL_CALL + createPropertySetInfo( ::cppu::IPropertyArrayHelper& rProperties ) SAL_THROW( () ); +*/ + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + /// reference to factory, which has created this instance + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
+
+ /// the tab window as XWindow ( to hold window* alive !) + css::uno::Reference< css::awt::XWindow > m_xTabWin;
+
+ /// the VCL tab window
+ FwkTabWindow* m_pTabWin;
+
+ /// container of inserted tab pages
+ TTabPageInfoHash m_lTabPageInfos;
+
+ /// container of the added TabListener + ::cppu::OMultiTypeInterfaceContainerHelper m_lListener; +
+ /// counter of the tabpage indexes + ::sal_Int32 m_nPageIndexCounter;
+
+ /// index of the current active page + ::sal_Int32 m_nCurrentPageIndex; +
+ /// title of the tabcontrolled window + ::rtl::OUString m_sTitle; + +}; // class TabWindowService + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TABWINDOWSERVICE_HXX_ + diff --git a/framework/inc/services/task.hxx b/framework/inc/services/task.hxx new file mode 100644 index 000000000000..aefa858a83f5 --- /dev/null +++ b/framework/inc/services/task.hxx @@ -0,0 +1,613 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: task.hxx,v $ + * $Revision: 1.9 $ + * + * 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 __FRAMEWORK_SERVICES_TASK_HXX_ +#define __FRAMEWORK_SERVICES_TASK_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services/frame.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/propshlp.hxx> + +#include <tools/link.hxx> +#include <vcl/evntpost.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implements an special frame - a task frame + + @descr - + + @implements XTask + + @base Frame + OPropertySet +*//*-*************************************************************************************************************/ + +class Task : public css::frame::XTask , // => XFrame => XComponent + public Frame // Order of baseclasses is neccessary for right initialization! +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard constructor to create instance + + @descr This constructor initialize a new instance of this class, + and will be set valid values on his member and baseclasses. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + Task( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory ); + + /*-****************************************************************************************************//** + @short standard destructor + + @descr This method destruct an instance of this class and clear some member. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~Task(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XTask + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL close() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL tileWindows() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL arrangeWindowsVertical() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL arrangeWindowsHorizontal() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XComponent + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent. + XTask is derived from these classes to! The compiler don't know, which base is the right one. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL dispose() throw( css::uno::RuntimeException ) + { + Frame::dispose(); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::addEventListener( xListener ); + } + + /*-*******************************************************************************************************/ + virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::removeEventListener( xListener ); + } + + //--------------------------------------------------------------------------------------------------------- + // XFrame + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr We must overwrite this method, because baseclass Frame implements XFrame and XComponent. + XTask is derived from these classes to! The compiler don't know, which base is right. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL initialize( const css::uno::Reference< css::awt::XWindow >& xWindow ) throw( css::uno::RuntimeException ) + { + Frame::initialize( xWindow ); + } + + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() throw( css::uno::RuntimeException ) + { + return Frame::getContainerWindow(); + } + + virtual void SAL_CALL setCreator( const css::uno::Reference< css::frame::XFramesSupplier >& xCreator ) throw( css::uno::RuntimeException ) + { + Frame::setCreator( xCreator ); + } + + virtual css::uno::Reference< css::frame::XFramesSupplier > SAL_CALL getCreator() throw( css::uno::RuntimeException ) + { + return Frame::getCreator(); + } + + virtual ::rtl::OUString SAL_CALL getName() throw( css::uno::RuntimeException ) + { + return Frame::getName(); + } + + virtual void SAL_CALL setName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ) + { + Frame::setName( sName ); + } + + virtual sal_Bool SAL_CALL isTop() throw( css::uno::RuntimeException ) + { + return Frame::isTop(); + } + + virtual void SAL_CALL activate() throw( css::uno::RuntimeException ) + { + Frame::activate(); + } + + virtual void SAL_CALL deactivate() throw( css::uno::RuntimeException ) + { + Frame::deactivate(); + } + + virtual sal_Bool SAL_CALL isActive() throw( css::uno::RuntimeException ) + { + return Frame::isActive(); + } + + virtual sal_Bool SAL_CALL setComponent( const css::uno::Reference< css::awt::XWindow >& xComponentWindow , + const css::uno::Reference< css::frame::XController >& xController ) throw( css::uno::RuntimeException ) + { + return Frame::setComponent( xComponentWindow, xController ); + } + + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getComponentWindow() throw( css::uno::RuntimeException ) + { + return Frame::getComponentWindow(); + } + + virtual css::uno::Reference< css::frame::XController > SAL_CALL getController() throw( css::uno::RuntimeException ) + { + return Frame::getController(); + } + + virtual void SAL_CALL contextChanged() throw( css::uno::RuntimeException ) + { + Frame::contextChanged(); + } + + virtual void SAL_CALL addFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::addFrameActionListener( xListener ); + } + + virtual void SAL_CALL removeFrameActionListener( const css::uno::Reference< css::frame::XFrameActionListener >& xListener ) throw( css::uno::RuntimeException ) + { + Frame::removeFrameActionListener( xListener ); + } + + virtual css::uno::Reference< css::frame::XFrame > SAL_CALL findFrame( const ::rtl::OUString& sTargetFrameName , + sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XTopWindowListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowClosing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowActivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + + @descr - + + @seealso - + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL windowDeactivated( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + + @descr This object is forced to release all references to the interfaces given + by the parameter Source. + + @seealso - + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //--------------------------------------------------------------------------- + // OPropertySetHelper + //--------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short try to convert a property value + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + You must try to convert the value of given propertyhandle and + return results of this operation. This will be use to ask vetoable + listener. If no listener have a veto, we will change value realy! + ( in method setFastPropertyValue_NoBroadcast(...) ) + + @seealso OPropertySetHelper + @seealso setFastPropertyValue_NoBroadcast() + + @param "aConvertedValue" new converted value of property + @param "aOldValue" old value of property + @param "nHandle" handle of property + @param "aValue" new value of property + + @return sal_True if value will be changed, sal_FALSE otherway + + @onerror IllegalArgumentException, if you call this with an invalid argument + *//*-*****************************************************************************************************/ +/* + virtual sal_Bool SAL_CALL convertFastPropertyValue( css::uno::Any& aConvertedValue , + css::uno::Any& aOldValue , + sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::lang::IllegalArgumentException ); +*/ + /*-****************************************************************************************************//** + @short set value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + Handle and value are valid everyway! You must set the new value only. + After this, baseclass send messages to all listener automaticly. + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" new value of property + + @return - + + @onerror An exception is thrown. + *//*-*****************************************************************************************************/ +/* + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , + const css::uno::Any& aValue ) throw( css::uno::Exception ); +*/ + /*-****************************************************************************************************//** + @short get value of a transient property + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param "nHandle" handle of property to change + @param "aValue" current value of property + + @return - + + @onerror - + *//*-*****************************************************************************************************/ +/* + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& aValue , + sal_Int32 nHandle ) const; +*/ + /*-****************************************************************************************************//** + @short return structure and information about transient properties + @descr This method is calling from helperclass "OPropertySetHelper". + Don't use this directly! + + @seealso OPropertySetHelper + + @param - + + @return structure with property-informations + + @onerror - + *//*-*****************************************************************************************************/ +/* + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); +*/ + /*-****************************************************************************************************//** + @short return propertysetinfo + @descr You can call this method to get information about transient properties + of this object. + + @seealso OPropertySetHelper + @seealso XPropertySet + @seealso XMultiPropertySet + + @param - + + @return reference to object with information [XPropertySetInfo] + + @onerror - + *//*-*****************************************************************************************************/ +/* + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(); +*/ + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + DECL_LINK( Close_Impl, void* ); + +// void impl_SaveWindowAttributes(); + +/* sal_Bool impl_tryToChangeProperty( sal_Bool bProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + sal_Bool impl_tryToChangeProperty( const ::rtl::OUString& sProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + sal_Bool impl_tryToChangeProperty( const css::awt::Point& aProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + sal_Bool impl_tryToChangeProperty( const css::awt::Size& aProperty , + const css::uno::Any& aValue , + css::uno::Any& aOldValue , + css::uno::Any& aConvertedValue ) throw( css::lang::IllegalArgumentException ); + + static const css::uno::Sequence< css::beans::Property > impl_getStaticPropertyDescriptor(); +*/ + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short debug-method to check incoming parameter of some other mehods of this class + @descr The following methods are used to check parameters for other methods + of this class. The return value is used directly for an ASSERT(...). + + @seealso ASSERTs in implementation! + + @param references to checking variables + @return sal_False on invalid parameter<BR> + sal_True otherway + + @onerror - + *//*-*****************************************************************************************************/ + + #ifdef ENABLE_ASSERTIONS + + private: + + // Not used in the moment! + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + protected: + + // But some values are neede by derived classes! +// sal_Bool m_bIsPlugIn ; /// In objects of these class this member is set to FALSE. + /// But in derived class PlugInFrame it's overwrited with TRUE! + + private: + + // Properties + sal_Bool m_bIsAlwaysVisible ; + sal_Bool m_bIsFloating ; + css::awt::Point m_aPosition ; + css::awt::Size m_aSize ; + ::vcl::EventPoster m_aPoster ; + +}; // class Tasks + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_TASKS_HXX_ diff --git a/framework/inc/services/taskcreatorsrv.hxx b/framework/inc/services/taskcreatorsrv.hxx new file mode 100644 index 000000000000..a50fa108e00d --- /dev/null +++ b/framework/inc/services/taskcreatorsrv.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: taskcreatorsrv.hxx,v $ + * $Revision: 1.7 $ + * + * 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 __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_ +#define __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_ + +//_______________________________________________ +// own includes + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_______________________________________________ +// interface includes +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/lang/XSingleServiceFactory.hpp> +#include <com/sun/star/awt/Rectangle.hpp> + +//_______________________________________________ +// other includes +#include <cppuhelper/weak.hxx> +#include <comphelper/sequenceashashmap.hxx> + +//_______________________________________________ +// definition + +namespace framework +{ + +//_______________________________________________ +/** + * TODO document me + */ +class TaskCreatorService : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XSingleServiceFactory + // attention! Must be the first base class to guarentee right initialize lock ... + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //___________________________________________ + // types + + public: + + /// [XFrame] if it's set, it will be used as parent frame for the new created frame. + static const ::rtl::OUString ARGUMENT_PARENTFRAME; + + /** [OUString] if it's not a special name (beginning with "_" ... which are not allowed here!) + it will be set as the API name of the new created frame. + */ + static const ::rtl::OUString ARGUMENT_FRAMENAME; + + /// [sal_Bool] If its set to TRUE we will make the new created frame visible. + static const ::rtl::OUString ARGUMENT_MAKEVISIBLE; + + /** [sal_Bool] If not "ContainerWindow" property is set it force creation of a + top level window as new container window. + */ + static const ::rtl::OUString ARGUMENT_CREATETOPWINDOW; + + /// [Rectangle] Place the new created frame on this place and resize the container window. + static const ::rtl::OUString ARGUMENT_POSSIZE; + + /// [XWindow] an outside created window, used as container window of the new created frame. + static const ::rtl::OUString ARGUMENT_CONTAINERWINDOW; + + /** [sal_Bool] enable/disable special mode, where this frame will be part of + the persistent window state feature suitable for any office module window + */ + static const ::rtl::OUString ARGUMENT_SUPPORTPERSISTENTWINDOWSTATE; + + /** [sal_Bool] enable/disable special mode, where the title bar of our + the new created frame will be updated automaticly. + Default = ON ! + */ + static const ::rtl::OUString ARGUMENT_ENABLE_TITLEBARUPDATE; + //___________________________________________ + // member + + private: + + //--------------------------------------- + /** @short the global uno service manager. + @descr Must be used to create own needed services. + */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + //___________________________________________ + // interface + + public: + + TaskCreatorService(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~TaskCreatorService( ); + + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + // XSingleServiceFactory + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance() + throw(css::uno::Exception , + css::uno::RuntimeException); + + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + //___________________________________________ + // helper + + private: + + css::uno::Reference< css::awt::XWindow > implts_createContainerWindow( const css::uno::Reference< css::awt::XWindow >& xParentWindow , + const css::awt::Rectangle& aPosSize , + sal_Bool bTopWindow ); + + void implts_applyDocStyleToWindow(const css::uno::Reference< css::awt::XWindow >& xWindow) const; + + css::uno::Reference< css::frame::XFrame > implts_createFrame( const css::uno::Reference< css::frame::XFrame >& xParentFrame , + const css::uno::Reference< css::awt::XWindow >& xContainerWindow , + const ::rtl::OUString& sName ); + + void implts_establishWindowStateListener( const css::uno::Reference< css::frame::XFrame >& xFrame ); + void implts_establishTitleBarUpdate( const css::uno::Reference< css::frame::XFrame >& xFrame ); + + void implts_establishDocModifyListener( const css::uno::Reference< css::frame::XFrame >& xFrame ); + + ::rtl::OUString impl_filterNames( const ::rtl::OUString& sName ); +}; + +} // namespace framework + +#endif // __FRAMEWORK_SERVICES_TASKCREATORSRV_HXX_ diff --git a/framework/inc/services/uriabbreviation.hxx b/framework/inc/services/uriabbreviation.hxx new file mode 100644 index 000000000000..4ba644f1148e --- /dev/null +++ b/framework/inc/services/uriabbreviation.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: uriabbreviation.hxx,v $ + * $Revision: 1.3 $ + * + * 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 __FRAMEWORK_SERVICES_URIABBREVIATION_HXX_ +#define __FRAMEWORK_SERVICES_URIABBREVIATION_HXX_ + +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XStringAbbreviation.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <cppuhelper/implbase2.hxx> + +namespace framework +{ + +class UriAbbreviation: public ::cppu::WeakImplHelper2< ::com::sun::star::util::XStringAbbreviation, css::lang::XServiceInfo> +{ +public: + explicit UriAbbreviation(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context); + + DECLARE_XSERVICEINFO + + // ::com::sun::star::util::XStringAbbreviation: + virtual ::rtl::OUString SAL_CALL abbreviateString(const ::com::sun::star::uno::Reference< ::com::sun::star::util::XStringWidth > & xStringWidth, ::sal_Int32 nWidth, const ::rtl::OUString & aString) throw (::com::sun::star::uno::RuntimeException); + +private: + UriAbbreviation(UriAbbreviation &); // not defined + void operator =(UriAbbreviation &); // not defined + + virtual ~UriAbbreviation() {} + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; +}; + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_URIABBREVIATION_HXX_ diff --git a/framework/inc/services/urltransformer.hxx b/framework/inc/services/urltransformer.hxx new file mode 100644 index 000000000000..5c338085b4e8 --- /dev/null +++ b/framework/inc/services/urltransformer.hxx @@ -0,0 +1,226 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: urltransformer.hxx,v $ + * $Revision: 1.8 $ + * + * 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 __FRAMEWORK_SERVICES_URLTRANSFORMER_HXX_ +#define __FRAMEWORK_SERVICES_URLTRANSFORMER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#ifndef __FRAMEWORK_OMUTEXMEMBER_HXX_ +#include <threadhelp/threadhelpbase.hxx> +#endif +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/util/URL.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short + + @descr - + + @implements XInterface + XTypeProvider + XServiceInfo + XURLTransformer + + @base ThreadHelpBase + OWeakObject +*//*-*************************************************************************************************************/ + +class URLTransformer : public ::cppu::WeakImplHelper2< ::com::sun::star::util::XURLTransformer, css::lang::XServiceInfo> +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + URLTransformer( const css::uno::Reference< css::lang::XMultiServiceFactory >& sFactory ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~URLTransformer(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // XURLTransformer + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL parseStrict( css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL parseSmart( css::util::URL& aURL , + const ::rtl::OUString& sSmartProtocol ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL assemble( css::util::URL& aURL ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short - + @descr - + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ::rtl::OUString SAL_CALL getPresentation( const css::util::URL& aURL , + sal_Bool bWithPassword ) throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // debug methods + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to factory, which has created this instance + +}; // class URLTransformer + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_SERVICES_URLTRANSFORMER_HXX_ |