diff options
Diffstat (limited to 'framework/inc/helper')
26 files changed, 4135 insertions, 0 deletions
diff --git a/framework/inc/helper/acceleratorinfo.hxx b/framework/inc/helper/acceleratorinfo.hxx new file mode 100644 index 000000000000..3ec78674d4e0 --- /dev/null +++ b/framework/inc/helper/acceleratorinfo.hxx @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_ACCELERATORINFO_HXX_ +#define __FRAMEWORK_HELPER_ACCELERATORINFO_HXX_ + +#include <com/sun/star/frame/XFrame.hpp> +#include <vcl/keycod.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +typedef ::rtl::OUString ( *pfunc_getCommandURLFromKeyCode)( const KeyCode& ); +typedef KeyCode ( *pfunc_getKeyCodeFromCommandURL )( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL ); + +pfunc_getCommandURLFromKeyCode SAL_CALL SetCommandURLFromKeyCode( pfunc_getCommandURLFromKeyCode ); +pfunc_getKeyCodeFromCommandURL SAL_CALL SetKeyCodeFromCommandURL( pfunc_getKeyCodeFromCommandURL ); + +::rtl::OUString SAL_CALL GetCommandURLFromKeyCode( const KeyCode& aKeyCode ); +KeyCode GetKeyCodeFromCommandURL( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& aCommandURL ); + +} + +#endif // __FRAMEWORK_HELPER_ACCELERATORINFO_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/actiontriggerhelper.hxx b/framework/inc/helper/actiontriggerhelper.hxx new file mode 100644 index 000000000000..2fc8835cf685 --- /dev/null +++ b/framework/inc/helper/actiontriggerhelper.hxx @@ -0,0 +1,81 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_ +#define __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_ + +#include <com/sun/star/container/XIndexContainer.hpp> + +// #110897# +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <vcl/menu.hxx> + + +namespace framework +{ + class ActionTriggerHelper + { + public: + // Fills the submitted menu with the structure contained in the second + // parameter rActionTriggerContainer + // @param pNewMenu = must be a valid and empty menu + // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContaienr" + static void + CreateMenuFromActionTriggerContainer( + Menu* pNewMenu, + const com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer ); + + // Creates a "com::sun::star::ui::ActionTriggerContainer" with the structure of the menu + // provided as a parameter. The implementation class stores the menu pointer + // to optimize the time of creation of a menu from a actiontrigger structure. + // IMPORTANT: The caller must ensure that the menu pointer is valid through the + // life time of the XIndexContainer object!!! + // + // @param pNewMenu = Must be a valid menu. Please be aware that this implementation is based on + // the above mentioned restriction!!! + + // #110897# + static com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer > CreateActionTriggerContainerFromMenu( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, + const Menu* pMenu, const ::rtl::OUString* pMenuIdentifier ); + + // Fills the submitted rActionTriggerContainer with the structure of the menu + // provided as the second parameter + // @param rActionTriggerContainer = must be an instance of service "com.sun.star.ui.ActionTriggerContainer" + // @param pNewMenu = must be a valid menu + static void + FillActionTriggerContainerFromMenu( + com::sun::star::uno::Reference< com::sun::star::container::XIndexContainer >& rActionTriggerContainer, + const Menu* pMenu ); + + }; +} + +#endif // __FRAMEWORK_HELPER_ACTIONTRIGGERHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/configimporter.hxx b/framework/inc/helper/configimporter.hxx new file mode 100644 index 000000000000..76d0011996e5 --- /dev/null +++ b/framework/inc/helper/configimporter.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_ +#define __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_ + +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +#include <rtl/ustring.hxx> + +namespace framework +{ + class UIConfigurationImporterOOo1x + { + public: + static sal_Bool ImportCustomToolbars( + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >& rContainerFactory, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > >& rSeqContainer, + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager, + const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& rToolbarStorage ); + }; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_CONFIGIMPORTER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/dockingareadefaultacceptor.hxx b/framework/inc/helper/dockingareadefaultacceptor.hxx new file mode 100644 index 000000000000..57c07bf018b5 --- /dev/null +++ b/framework/inc/helper/dockingareadefaultacceptor.hxx @@ -0,0 +1,114 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_DOCKINGAREADEFAULTACCEPTOR_HXX_ +#define __FRAMEWORK_HELPER_DOCKINGAREADEFAULTACCEPTOR_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/ui/XDockingAreaAcceptor.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ + + +class DockingAreaDefaultAcceptor : private ThreadHelpBase , + public ::cppu::WeakImplHelper1< ::com::sun::star::ui::XDockingAreaAcceptor > +{ + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A docking area acceptor + But we need a instance to create more then one enumerations to the same tasklist! + + @seealso class Desktop + @seealso class OTasksEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @param "pTasks" is a pointer to the taskcontainer of the desktop. We need it to create a new enumeration. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + DockingAreaDefaultAcceptor( const css::uno::Reference< css::frame::XFrame >& xOwner ); + virtual ~DockingAreaDefaultAcceptor(); + + //--------------------------------------------------------------------------------------------------------- + // XDockingAreaAcceptor + //--------------------------------------------------------------------------------------------------------- + + virtual css::uno::Reference< css::awt::XWindow > SAL_CALL getContainerWindow() throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL requestDockingAreaSpace( const css::awt::Rectangle& RequestedSpace ) throw (css::uno::RuntimeException); + virtual void SAL_CALL setDockingAreaSpace( const css::awt::Rectangle& BorderSpace ) throw (css::uno::RuntimeException); + + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XFrame > m_xOwner ; /// weak reference to our frame object! +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_DOCKINGAREADEFAULTACCEPTOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/fixeddocumentproperties.hxx b/framework/inc/helper/fixeddocumentproperties.hxx new file mode 100644 index 000000000000..ccf5932a3136 --- /dev/null +++ b/framework/inc/helper/fixeddocumentproperties.hxx @@ -0,0 +1,60 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#ifndef __FRAMEWORK_HELPER_FIXEDDOCUMENTPROPERTIES_HXX_ +#define __FRAMEWORK_HELPER_FIXEDDOCUMENTPROPERTIES_HXX_ + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/util/DateTime.hpp> + +namespace framework +{ + +struct FixedDocumentProperties +{ + // fixed Properties (sort by name and used by OPropertySetHelper) + ::rtl::OUString m_sAuthor ; /// Creator of this document + sal_Bool m_bAutoloadEnabled ; /// Automatic reload enabled/disabled ? + sal_Int32 m_nAutoloadSecs ; /// Time cycle for automatic reload + ::rtl::OUString m_sAutoloadURL ; /// URL for automatic reload + ::rtl::OUString m_sBlindCopiesTo ; /// Adress for BCC + ::rtl::OUString m_sCopiesTo ; /// Adress CC + com::sun::star::util::DateTime m_aCreationDate ; /// Time and date of document creation + ::rtl::OUString m_sDefaultTarget ; /// Name of default target + ::rtl::OUString m_sDescription ; /// Short description and comments + sal_Int16 m_nEditingCycles ; /// Document number + sal_Int32 m_nEditingDuration ; /// Duration since last edit + com::sun::star::uno::Sequence< sal_Int8 > m_seqExtraData ; /// Buffer of bytes for some extra data + ::rtl::OUString m_sInReplyTo ; /// Adress for reply to ... + sal_Bool m_bIsEncrypted ; /// Document is en/decrypted + ::rtl::OUString m_sKeywords ; /// Some keywords + ::rtl::OUString m_sMIMEType ; /// MIME-type of document + ::rtl::OUString m_sModifiedBy ; /// Name of user who has modified as last one + com::sun::star::util::DateTime m_aModifyDate ; /// Date and time of last modification + ::rtl::OUString m_sNewsgroups ; /// Document is a message of newsgroup + ::rtl::OUString m_sOriginal ; /// Message ID + sal_Bool m_bPortableGraphics ; /// Use of portable graphics + com::sun::star::util::DateTime m_aPrintDate ; /// Date and time of last print + ::rtl::OUString m_sPrintedBy ; /// Name of user who has printed as last one + sal_uInt16 m_nPriority ; /// Priority of message, if document a message! + sal_Bool m_bQueryTemplate ; /// Search for template ? + ::rtl::OUString m_sRecipient ; /// Name of recipient + ::rtl::OUString m_sReferences ; /// Some references to other things + ::rtl::OUString m_sReplyTo ; /// Adress to reply + sal_Bool m_bSaveGraphicsCompressed ; /// Compressed/non compressed graphics + sal_Bool m_bSaveOriginalGraphics ; /// Include graphics + sal_Bool m_bSaveVersionOnClose ; /// Save version on close of document ? + ::rtl::OUString m_sTemplate ; /// Name of template + sal_Bool m_bTemplateConfig ; /// Exist template config ? + com::sun::star::util::DateTime m_aTemplateDate ; /// Date and time of template + ::rtl::OUString m_sTemplateFileName ; /// File name of template + ::rtl::OUString m_sTheme ; /// Name of theme + ::rtl::OUString m_sTitle ; /// Title of document + sal_Bool m_bUserData ; /// Exist user data ? +}; + +} + +#endif // __FRAMEWORK_SERVICES_FIXEDDOCUMENTPROPERTIES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/imageproducer.hxx b/framework/inc/helper/imageproducer.hxx new file mode 100644 index 000000000000..4bf4fc6138b0 --- /dev/null +++ b/framework/inc/helper/imageproducer.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_ +#define __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <sal/types.h> +#include <com/sun/star/frame/XFrame.hpp> +#include <vcl/image.hxx> +#include <rtl/ustring.hxx> + +namespace framework +{ + +typedef Image ( *pfunc_getImage)( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); + +pfunc_getImage SAL_CALL SetImageProducer( pfunc_getImage pGetImageFunc ); + +Image SAL_CALL GetImageFromURL( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, BOOL bBig, BOOL bHiContrast ); + +} + +#endif // __FRAMEWORK_HELPER_IMAGEPRODUCER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/mischelper.hxx b/framework/inc/helper/mischelper.hxx new file mode 100644 index 000000000000..ceedf78b38aa --- /dev/null +++ b/framework/inc/helper/mischelper.hxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __MISC_HELPER_HXX_ +#define __MISC_HELPER_HXX_ + +#include <com/sun/star/linguistic2/XLanguageGuessing.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <i18npool/lang.h> +#include <svl/languageoptions.hxx> +#include <rtl/ustring.hxx> + +#include <set> + +class SvtLanguageTable; + + +// flags for script types in use within selection +#define LS_SCRIPT_LATIN 0x0001 +#define LS_SCRIPT_ASIAN 0x0002 +#define LS_SCRIPT_COMPLEX 0x0004 + + +namespace framework +{ + +// menu ids for language status bar control +enum LangMenuIDs +{ + MID_LANG_SEL_1 = 1, // need to start with 1 since xPopupMenu->execute will return 0 if the menu is cancelled + MID_LANG_SEL_2, + MID_LANG_SEL_3, + MID_LANG_SEL_4, + MID_LANG_SEL_5, + MID_LANG_SEL_6, + MID_LANG_SEL_7, + MID_LANG_SEL_8, + MID_LANG_SEL_9, + MID_LANG_SEL_NONE, + MID_LANG_SEL_RESET, + MID_LANG_SEL_MORE, + + MID_LANG_PARA_SEPERATOR, + MID_LANG_PARA_STRING, + + MID_LANG_PARA_1, + MID_LANG_PARA_2, + MID_LANG_PARA_3, + MID_LANG_PARA_4, + MID_LANG_PARA_5, + MID_LANG_PARA_6, + MID_LANG_PARA_7, + MID_LANG_PARA_8, + MID_LANG_PARA_9, + MID_LANG_PARA_NONE, + MID_LANG_PARA_RESET, + MID_LANG_PARA_MORE, +}; + + +inline bool IsScriptTypeMatchingToLanguage( sal_Int16 nScriptType, LanguageType nLang ) +{ + return 0 != (nScriptType & SvtLanguageOptions::GetScriptTypeOfLanguage( nLang )); +} + + +class LanguageGuessingHelper +{ + mutable ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > m_xLanguageGuesser; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + +public: + LanguageGuessingHelper(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceManager) : m_xServiceManager(_xServiceManager){} + + ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XLanguageGuessing > GetGuesser() const; +}; + +::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL + ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory + ,::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& _xUICommandLabels + ,const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& _xFrame + ,::rtl::OUString& _rModuleIdentifier + ,sal_Bool& _rIni + ,const sal_Char* _pName); + +void FillLangItems( std::set< ::rtl::OUString > &rLangItems, + const SvtLanguageTable &rLanguageTable, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > &rxFrame, + const LanguageGuessingHelper & rLangGuessHelper, + sal_Int16 nScriptType, + const ::rtl::OUString & rCurLang, + const ::rtl::OUString & rKeyboardLang, + const ::rtl::OUString & rGuessedTextLang ); + +} // namespace framework + +#endif // __MISC_HELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/networkdomain.hxx b/framework/inc/helper/networkdomain.hxx new file mode 100644 index 000000000000..72ecef853699 --- /dev/null +++ b/framework/inc/helper/networkdomain.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_NETWORKDOMAIN_HXX_ +#define __FRAMEWORK_HELPER_NETWORKDOMAIN_HXX_ + +#include <rtl/ustring.hxx> + +namespace framework +{ + +class NetworkDomain +{ + public: + static rtl::OUString GetNTDomainName(); + static rtl::OUString GetYPDomainName(); +}; + +} + +#endif // __FRAMEWORK_HELPER_NETWORKDOMAIN_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/ocomponentaccess.hxx b/framework/inc/helper/ocomponentaccess.hxx new file mode 100644 index 000000000000..523931d07b4a --- /dev/null +++ b/framework/inc/helper/ocomponentaccess.hxx @@ -0,0 +1,278 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_OCOMPONENTACCESS_HXX_ +#define __FRAMEWORK_HELPER_OCOMPONENTACCESS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/frame/XFramesSupplier.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XElementAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XDesktop.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XEnumerationAccess interface as helper to create many oneway enumeration of components + @descr We share mutex and framecontainer with ouer owner and have full access to his child tasks. + (Ouer owner can be the Desktop only!) We create oneway enumerations on demand. These "lists" + can be used for one time only. Step during the list from first to last element. + (The type of created enumerations is OComponentEnumeration.) + + @implements XInterface + XTypeProvider + XEnumerationAccess + XElementAccess + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class OComponentAccess : private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects! + public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumerationAccess > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A desktop will create an enumeration-access-object. An enumeration is a oneway-list and a + snapshot of the components of current tasks under the desktop. + But we need a instance to create more then one enumerations at different times! + + @seealso class Desktop + @seealso class OComponentEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OComponentAccess( const css::uno::Reference< css::frame::XDesktop >& xOwner ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumerationAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new enumeration of components + @descr You can call this method to get a new snapshot from all components of all tasks of the desktop as an enumeration. + + @seealso interface XEnumerationAccess + @seealso interface XEnumeration + @seealso class Desktop + + @param - + @return If the desktop and some components exist => a valid reference to an enumeration<BR> + An NULL-reference, other way. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get the type of elements in enumeration + @descr - + + @seealso interface XElementAccess + @seealso class OComponentEnumeration + + @param - + @return The uno-type XComponent. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get state of componentlist of enumeration. + @descr - + + @seealso interface XElementAccess + + @param - + @return sal_True ,if more then 0 elements exist. + @return sal_False ,otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + Don't use an instance of this class as normal member. Use it dynamicly with a pointer. + We hold a weakreference to ouer owner and not to ouer superclass! + Thats the reason for a protected dtor. + + @seealso class Desktop + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OComponentAccess(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short recursive method (!) to collect all components of all frames from the subtree of given node + @descr This is neccessary to create the enumeration. + + @seealso method createEnumeration + + @param "xNode" , root of subtree and start point of search + @param "seqComponents", result list of search. We cant use a return value, we search recursive + and must collect all informations. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_collectAllChildComponents( const css::uno::Reference< css::frame::XFramesSupplier >& xNode , + css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + + /*-****************************************************************************************************//** + @short get the component of a frame + @descr The component of a frame can be the window, the controller or the model. + + @seealso method createEnumeration + + @param "xFrame", frame which contains the component + @return A reference to the component of given frame. + + @onerror A null reference is returned. + *//*-*****************************************************************************************************/ + + css::uno::Reference< css::lang::XComponent > impl_getFrameComponent( const css::uno::Reference< css::frame::XFrame >& xFrame ) const; + + //------------------------------------------------------------------------------------------------------------- + // 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_OComponentAccessCtor( const css::uno::Reference< css::frame::XDesktop >& xOwner ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XDesktop > m_xOwner ; /// weak reference to the desktop object! + +}; // class OComponentAccess + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OCOMPONENTACCESS_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/ocomponentenumeration.hxx b/framework/inc/helper/ocomponentenumeration.hxx new file mode 100644 index 000000000000..dd352b625d9f --- /dev/null +++ b/framework/inc/helper/ocomponentenumeration.hxx @@ -0,0 +1,263 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_OCOMPONENTENUMERATION_HXX_ +#define __FRAMEWORK_HELPER_OCOMPONENTENUMERATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase2.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a helper for a oneway enumeration of components + @descr You can step during this list only for one time! Its a snapshot. + Don't forget to release the reference. You are the owner of an instance of this implementation. + You cant use this as a baseclass. Please use it as a dynamical object for return. + + @implements XInterface + XTypeProvider + XEventListener + XEnumeration + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use + @threadsafe yes +*//*-*************************************************************************************************************/ + +class OComponentEnumeration : public ThreadHelpBase , + public ::cppu::WeakImplHelper2< ::com::sun::star::container::XEnumeration,::com::sun::star::lang::XEventListener > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this enumeration + @descr An enumeration is a list with oneway-access! You can get every member only for one time. + This method allow to initialize this oneway list with values. + + @seealso - + + @param "seqComponents" is a sequence of interfaces, which are components. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OComponentEnumeration( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short last chance to release all references and free memory + @descr This method is called, if the enumeration is used completly and has no more elements. + Then we must destroy ouer list and release all references to other objects. + + @seealso interface XEventListener + + @param "aEvent" describe the source of this event. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumeration + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short check count of accessible elements of enumeration + @descr You can call this method to get information about accessible elements in future. + Elements you have already getted are not accessible! + + @seealso interface XEnumeration + + @param - + @return sal_True = if more elements accessible<BR> + sal_False = other way + + @onerror sal_False<BR> + (List is emtpy and there no accessible elements ...) + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasMoreElements() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short give the next element, if some exist + @descr If a call "hasMoreElements()" return true, you can get the next element of list. + + @seealso interface XEnumeration + + @param - + @return A Reference to a component, safed in an Any-structure. + + @onerror If end of enumeration is arrived or there are no elements in list => a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL nextElement() throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + We make it protected, because its not supported to use this class as normal instance! + You must create it dynamical in memory and use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OComponentEnumeration(); + + /*-****************************************************************************************************//** + @short reset instance to default values + + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // 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 ASSERT 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_OComponentEnumerationCtor ( const css::uno::Sequence< css::uno::Reference< css::lang::XComponent > >& seqComponents ); + static sal_Bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_uInt32 m_nPosition ; /// current position in enumeration + css::uno::Sequence< css::uno::Reference< css::lang::XComponent > > m_seqComponents ; /// list of current components + +}; // class OComponentEnumeration + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OCOMPONENTENUMERATION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/oframes.hxx b/framework/inc/helper/oframes.hxx new file mode 100644 index 000000000000..3cc3cb029e61 --- /dev/null +++ b/framework/inc/helper/oframes.hxx @@ -0,0 +1,358 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_OFRAMES_HXX_ +#define __FRAMEWORK_HELPER_OFRAMES_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrames.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XFrames, XIndexAccess and XElementAccess interfaces as helper for services + @descr Use this class as helper for these interfaces. We share mutex and framecontainer with ouer owner. + The framecontainer is a member of it from type "FrameContainer". That means; + we have the same information as ouer owner. In current implementation we use mutex and lock-mechanism + to prevent against compete access. In future we plan support of semaphore! + + @devstatus deprecated + @implements XInterface + XFrames + XIndexAccess + XElementAccess + @base OWeakObject + + @ATTENTION Don't use this class as direct member - use it dynamicly. Do not derive from this class. + We hold a weakreference to ouer owner not to ouer superclass. + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class OFrames : private ThreadHelpBase , // Must be the first of baseclasses - Is neccessary for right initialization of objects! + public ::cppu::WeakImplHelper1< ::com::sun::star::frame::XFrames > +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short standard ctor + @descr These initialize a new instance of this class with all needed informations for work. + We share framecontainer with owner implementation! It's a threadsafe container. + + @seealso - + + @param "xFactory" , reference to factory which has created ouer owner(!). We can use these to create new uno-services. + @param "xOwner" , reference to ouer owner. We hold a wekreference to prevent us against cross-references! + @param "pFrameContainer" , pointer to shared framecontainer of owner. It's valid only, if weakreference is valid! + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + OFrames( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwner , + FrameContainer* pFrameContainer ); + + //--------------------------------------------------------------------------------------------------------- + // XFrames + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short append frame to container + @descr We share the container with ouer owner. We can do this only, if no lock is set on container. + Valid references are accepted only! + + @seealso class FrameContainer + + @param "xFrame", reference to an existing frame to append. + @return - + + @onerror We do nothing in release or throw an assert in debug version. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL append( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short remove frame from container + @descr This is the companion to append(). We only accept valid references and don't work, if + a lock is set. + + @seealso class FrameContainer + + @param "xFrame", reference to an existing frame to remove. + @return - + + @onerror We do nothing in release or throw an assert in debug version. + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL remove( const css::uno::Reference< css::frame::XFrame >& xFrame ) throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short return list of all applicable frames for given flags + @descr Call these to get a list of all frames, which are match with given search flags. + + @seealso - + + @param "nSearchFlag", flags to search right frames. + @return A list of founded frames. + + @onerror An empty list is returned. + *//*-*****************************************************************************************************/ + + virtual css::uno::Sequence< css::uno::Reference< css::frame::XFrame > > SAL_CALL queryFrames( sal_Int32 nSearchFlags ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XIndexAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get count of all current frames in container + @descr This is the beginning of full index-access. With a count you can step over all items in container. + Next call shuoöd be getByIndex(). But these mechanism works only, if no lock in container is set! + + @seealso class FrameContainer + @seealso method getByIndex() + + @param - + @return Count of current items in container. + + @onerror If a lock is set, we return 0 for prevent further access! + *//*-*****************************************************************************************************/ + + virtual sal_Int32 SAL_CALL getCount() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get specified container item by index + @descr If you called getCount() successful - this method return the specified element as an Any. + You must observe the range from 0 to count-1! Otherwise an IndexOutOfBoundsException is thrown. + + @seealso class FrameContainer + @seealso method getCount() + + @param "nIndex", valid index to get container item. + @return A container item (specified by index) wrapped in an Any. + + @onerror If a lock is set, we return an empty Any! + @onerror If index out of range, an IndexOutOfBoundsException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) throw( css::lang::IndexOutOfBoundsException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get uno-type of all container items + @descr In current implementation type is fixed to XFrame! + (container-lock is ignored) + + @seealso - + + @param - + @return A uno-type descriptor. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get fill state of current container + @descr Call these to get information about, if items exist in container or not. + (container-lock is ignored) + + @seealso - + + @param - + @return sal_True, if container contains some items. + @return sal_False, otherwise. + + @onerror We return sal_False. + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + This method is protected, because its not allowed to use this class as a member! + You MUST use a dynamical instance (pointer). That's the reason for a protected dtor. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OFrames(); + + /*-****************************************************************************************************//** + @short reset instance to default values + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() (if it exist!) + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + /*-****************************************************************************************************//** + @short append one sequence to another + @descr There is no operation to add to sequences! Use this helper-method to do this. + + @seealso class Sequence + + @param "seqDestination", reference to sequence on which operation will append the other sequence. + @param "seqSource" , reference to sequence for append. + @return "seqDestination" is parameter AND return value at the same time. + + @onerror - + *//*-*****************************************************************************************************/ + + void impl_appendSequence( css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqDestination , + const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqSource ); + + //------------------------------------------------------------------------------------------------------------- + // 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_OFramesCtor ( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory , + const css::uno::Reference< css::frame::XFrame >& xOwner , + FrameContainer* pFrameContainer ); + static sal_Bool impldbg_checkParameter_append ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static sal_Bool impldbg_checkParameter_remove ( const css::uno::Reference< css::frame::XFrame >& xFrame ); + static sal_Bool impldbg_checkParameter_queryFrames ( sal_Int32 nSearchFlags ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory ; /// reference to global servicemanager + css::uno::WeakReference< css::frame::XFrame > m_xOwner ; /// reference to owner of this instance (Hold no hard reference!) + FrameContainer* m_pFrameContainer ; /// with owner shared list to hold all direct childs of an XFramesSupplier + sal_Bool m_bRecursiveSearchProtection ; /// flag to protect against recursive searches of frames at parents + +}; // class OFrames + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OFRAMES_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/otasksaccess.hxx b/framework/inc/helper/otasksaccess.hxx new file mode 100644 index 000000000000..12a631e859f0 --- /dev/null +++ b/framework/inc/helper/otasksaccess.hxx @@ -0,0 +1,257 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ +#define __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <classes/framecontainer.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XElementAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XDesktop.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement XEnumerationAccess interface as helper to create many oneway enumeration of tasks + @descr We share mutex and framecontainer with ouer owner and have full access to his child tasks. + (Ouer owner can be the Desktop only!) We create oneway enumerations on demand. These "lists" + can be used for one time only. Step during the list from first to last element. + (The type of created enumerations is OTasksEnumeration.) + + @implements XInterface + XEnumerationAccess + XElementAccess + + @base OWeakObject + + @devstatus deprecated +*//*-*************************************************************************************************************/ + +class OTasksAccess : public css::lang::XTypeProvider , + public css::container::XEnumerationAccess , // => XElementAccess + private ThreadHelpBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this instance + @descr A desktop will create an enumeration-access-object. An enumeration is a oneway-list and a + snapshot of the tasklist of current tasks of desktop. + But we need a instance to create more then one enumerations to the same tasklist! + + @seealso class Desktop + @seealso class OTasksEnumeration + + @param "xOwner" is a reference to ouer owner and must be the desktop! + @param "pTasks" is a pointer to the taskcontainer of the desktop. We need it to create a new enumeration. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OTasksAccess( const css::uno::Reference< css::frame::XDesktop >& xOwner , + FrameContainer* pTasks ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + //--------------------------------------------------------------------------------------------------------- + // XEnumerationAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short create a new enumeration of tasks + @descr You can call this method to get a new snapshot to all tasks of the desktop as an enumeration. + + @seealso interface XEnumerationAccess + @seealso interface XEnumeration + @seealso class Desktop + + @param - + @return If the desktop and some tasks exist => a valid reference to an enumeration<BR> + An NULL-reference, other way. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short get the type of elements in enumeration + @descr - + + @seealso interface XElementAccess + @seealso class TasksEnumeration + + @param - + @return The uno-type XTask. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short get state of tasklist of enumeration. + @descr - + + @seealso interface XElementAccess + + @param - + @return sal_True ,if more then 0 elements exist. + @return sal_False ,otherwise. + + @onerror - + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + Don't use an instance of this class as normal member. Use it dynamicly with a pointer. + We hold a weakreference to ouer owner and not to ouer superclass! + Thats the reason for a protected dtor. + + @seealso class Desktop + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OTasksAccess(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // 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_OTasksAccessCtor( const css::uno::Reference< css::frame::XDesktop >& xOwner , + FrameContainer* pTasks ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + css::uno::WeakReference< css::frame::XDesktop > m_xOwner ; /// weak reference to the desktop object! + FrameContainer* m_pTasks ; /// pointer to list of current tasks on desktop (is a member of class Desktop!) + /// This pointer is valid only, if weakreference can be locked. + +}; // class OTasksAccess + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OTASKSACCESS_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/otasksenumeration.hxx b/framework/inc/helper/otasksenumeration.hxx new file mode 100644 index 000000000000..7293ca0cd503 --- /dev/null +++ b/framework/inc/helper/otasksenumeration.hxx @@ -0,0 +1,273 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ +#define __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <general.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/frame/XTask.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// exported const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// exported definitions +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short implement a helper for a oneway enumeration of tasks + @descr You can step during this list only for one time! Its a snapshot. + Don't forget to release the reference. You are the owner of an instance of this implementation. + You cant use this as a baseclass. Please use it as a dynamical object for return. + + @implements XInterface + XTypeProvider + XEventListener + XEnumeration + + @base ThreadHelpBase + OWeakObject + + @devstatus ready to use +*//*-*************************************************************************************************************/ + +class OTasksEnumeration : public css::lang::XTypeProvider , + public css::lang::XEventListener , + public css::container::XEnumeration , + public ThreadHelpBase , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + + public: + + //--------------------------------------------------------------------------------------------------------- + // constructor / destructor + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short constructor to initialize this enumeration + @descr An enumeration is a list with oneway-access! You can get every member only for one time. + This method allow to initialize this oneway list with values. + + @seealso - + + @param "seqTasks" is a sequence of interfaces, which are tasks. + @return - + + @onerror Do nothing and reset this object to default with an empty list. + *//*-*****************************************************************************************************/ + + OTasksEnumeration( const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqTasks ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + + DECLARE_XINTERFACE + DECLARE_XTYPEPROVIDER + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short last chance to release all references and free memory + @descr This method is called, if the enumeration is used completly and has no more elements. + Then we must destroy ouer list and release all references to other objects. + + @seealso interface XEventListener + + @param "aEvent" describe the source of this event. + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEnumeration + //--------------------------------------------------------------------------------------------------------- + + /*-****************************************************************************************************//** + @short check count of accessible elements of enumeration + @descr You can call this method to get information about accessible elements in future. + Elements you have already getted are not accessible! + + @seealso interface XEnumeration + + @param - + @return sal_True = if more elements accessible<BR> + sal_False = other way + + @onerror sal_False<BR> + (List is emtpy and there no accessible elements ...) + *//*-*****************************************************************************************************/ + + virtual sal_Bool SAL_CALL hasMoreElements() throw( css::uno::RuntimeException ); + + /*-****************************************************************************************************//** + @short give the next element, if some exist + @descr If a call "hasMoreElements()" return true, you can get the next element of list. + + @seealso interface XEnumeration + + @param - + @return A Reference to a task, safed in an Any-structure. + + @onerror If end of enumeration is arrived or there are no elements in list => a NoSuchElementException is thrown. + *//*-*****************************************************************************************************/ + + virtual css::uno::Any SAL_CALL nextElement() throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + + protected: + + /*-****************************************************************************************************//** + @short standard destructor + @descr This method destruct an instance of this class and clear some member. + We make it protected, because its not supported to use this class as normal instance! + You must create it dynamical in memory and use a pointer. + + @seealso - + + @param - + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual ~OTasksEnumeration(); + + /*-****************************************************************************************************//** + @short reset instance to default values + + @descr There are two ways to delete an instance of this class.<BR> + 1) delete with destructor<BR> + 2) dispose from parent or factory ore ...<BR> + This method do the same for both ways! It free used memory and release references ... + + @seealso method dispose() + @seealso destructor ~TaskEnumeration() + + @param - + + @return - + + @onerror - + *//*-*****************************************************************************************************/ + + virtual void impl_resetObject(); + + //------------------------------------------------------------------------------------------------------------- + // private methods + //------------------------------------------------------------------------------------------------------------- + + private: + + //------------------------------------------------------------------------------------------------------------- + // 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 ASSERT 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_OTasksEnumerationCtor ( const css::uno::Sequence< css::uno::Reference< css::frame::XFrame > >& seqTasks ); + static sal_Bool impldbg_checkParameter_disposing ( const css::lang::EventObject& aEvent ); + + #endif // #ifdef ENABLE_ASSERTIONS + + //------------------------------------------------------------------------------------------------------------- + // variables + // (should be private everyway!) + //------------------------------------------------------------------------------------------------------------- + + private: + + sal_uInt32 m_nPosition ; /// current position in enumeration + css::uno::Sequence< css::uno::Reference< css::frame::XTask > > m_seqTasks ; /// list of current tasks + +}; // class OTasksEnumeration + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_OTASKSENUMERATION_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/persistentwindowstate.hxx b/framework/inc/helper/persistentwindowstate.hxx new file mode 100644 index 000000000000..e07187d79cf6 --- /dev/null +++ b/framework/inc/helper/persistentwindowstate.hxx @@ -0,0 +1,230 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_PERSISTENTWINDOWSTATE_HXX_ +#define __FRAMEWORK_HELPER_PERSISTENTWINDOWSTATE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.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/XFrame.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <unotools/moduleoptions.hxx> +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short listener for closing document frames to make her window state persistent + @descr It's a feature of our office. If a document window was created by ourself (and not from + any external process e.g. the office bean) we save and restore the window state of it + corresponding to the document service factory. That means: one instance of this class will be + a listener on one frame which container window was created by ourself. + We listen for frame action events and everytimes a component will deattached from a frame + we store its current position and size to the configuration. Everytimes a new component is + attached to a frame first time(!) we restore this informations again. + + @base ThreadHelpBase + guarantee right initialized lock member during startup of instances of this class. + + @base OWeakObject + implements ref counting for this class. + + @devstatus ready + @threadsafe yes + @modified 06.08.2004 08:41, as96863 +*//*-*************************************************************************************************************/ +class PersistentWindowState : // interfaces + public css::lang::XTypeProvider, + public css::lang::XInitialization, + public css::frame::XFrameActionListener, // => XEventListener + // baseclasses (order neccessary for right initialization!) + private ThreadHelpBase, + public ::cppu::OWeakObject +{ + //________________________________ + // member + + private: + + /// may we need an uno service manager to create own services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// reference to the frame which was created by the office himself + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + /// we call SetWindowState one times only for the same frame! + sal_Bool m_bWindowStateAlreadySet; + + //________________________________ + // interface + + public: + + //____________________________ + // ctor/dtor + PersistentWindowState(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~PersistentWindowState( ); + + //____________________________ + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //____________________________ + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //____________________________ + // XFrameActionListener + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //____________________________ + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //________________________________ + // helper + + private: + //____________________________ + /** @short identify the application module, which is used behind the component + of our frame. + + @param xSMGR + needed to create needed uno resources. + + @param xFrame + contains the component, wich must be identified. + + @return [string] + a module identifier for the current frame component. + */ + static ::rtl::OUString implst_identifyModule(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::frame::XFrame >& xFrame); + + //____________________________ + /** @short retrieve the window state from the configuration. + + @param xSMGR + needed to create the configuration access. + + @param sModuleName + identifies the application module, where the + information should be getted for. + + @return [string] + contains the information about position and size. + */ + static ::rtl::OUString implst_getWindowStateFromConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sModuleName); + + //____________________________ + /** @short retrieve the window state from the container window. + + @param xWindow + must point to the container window of the frame. + We use it VCL part here - because the toolkit doesnt + provide the right functionality! + + @return [string] + contains the information about position and size. + */ + static ::rtl::OUString implst_getWindowStateFromWindow(const css::uno::Reference< css::awt::XWindow >& xWindow); + + //____________________________ + /** @short restore the position and size on the container window. + + @param xSMGR + needed to create the configuration access. + + @param sModuleName + identifies the application module, where the + information should be setted on. + + @param sWindowState + contains the information about position and size. + */ + static void implst_setWindowStateOnConfig(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const ::rtl::OUString& sModuleName , + const ::rtl::OUString& sWindowState ); + + //____________________________ + /** @short restore the position and size on the container window. + + @param xWindow + must point to the container window of the frame. + We use it VCL part here - because the toolkit doesnt + provide the right functionality! + + @param sWindowState + contains the information about position and size. + */ + static void implst_setWindowStateOnWindow(const css::uno::Reference< css::awt::XWindow >& xWindow , + const ::rtl::OUString& sWindowState); + +}; // class PersistentWindowState + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_PERSISTENTWINDOWSTATE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/propertysetcontainer.hxx b/framework/inc/helper/propertysetcontainer.hxx new file mode 100644 index 000000000000..2bec443a131b --- /dev/null +++ b/framework/inc/helper/propertysetcontainer.hxx @@ -0,0 +1,100 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_ +#define __FRAMEWORK_HELPER_PROPERTYSETCONTAINER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> +#include <cppuhelper/weak.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <threadhelp/threadhelpbase.hxx> + +namespace framework +{ + +class PropertySetContainer : public com::sun::star::container::XIndexContainer , + public ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. + public ::cppu::OWeakObject +{ + public: + PropertySetContainer( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& ); + virtual ~PropertySetContainer(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XIndexContainer + virtual void SAL_CALL insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexReplace + virtual void SAL_CALL replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException) + { + return ::getCppuType((com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet >*)0); + } + + virtual sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + protected: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + + private: + typedef std::vector< com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > > PropertySetVector; + PropertySetVector m_aPropertySetVector; + +}; + +} + +#endif // __FRAMEWORK_CLASSES_PROPERTYSETCONTAINER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/shareablemutex.hxx b/framework/inc/helper/shareablemutex.hxx new file mode 100644 index 000000000000..b980be329e00 --- /dev/null +++ b/framework/inc/helper/shareablemutex.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_SHAREABLEMUTEX_HXX_ +#define __FRAMEWORK_HELPER_SHAREABLEMUTEX_HXX_ + +#include <osl/interlck.h> +#include <osl/mutex.hxx> + +namespace framework +{ + +class ShareableMutex +{ + public: + ShareableMutex(); + ShareableMutex( const ShareableMutex& rShareableMutex ); + const ShareableMutex& operator=( const ShareableMutex& rShareableMutex ); + + ~ShareableMutex(); + + void acquire(); + void release(); + ::osl::Mutex& getShareableOslMutex(); + + private: + struct MutexRef + { + MutexRef() : m_refCount(0) {} + void acquire() + { + osl_incrementInterlockedCount( &m_refCount ); + } + + void release() + { + if ( osl_decrementInterlockedCount( &m_refCount ) == 0 ) + delete this; + } + + oslInterlockedCount m_refCount; + osl::Mutex m_oslMutex; + }; + + MutexRef* pMutexRef; +}; + +class ShareGuard +{ + public: + ShareGuard( ShareableMutex& rShareMutex ) : + m_rShareMutex( rShareMutex ) + { + m_rShareMutex.acquire(); + } + + ~ShareGuard() + { + m_rShareMutex.release(); + } + + private: + ShareGuard(); + ShareGuard& operator=( const ShareGuard& ); + + ShareableMutex& m_rShareMutex; +}; + +} + +#endif // #ifndef __FRAMEWORK_HELPER_SHAREABLEMUTEX_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/statusindicator.hxx b/framework/inc/helper/statusindicator.hxx new file mode 100644 index 000000000000..2907c5f83b07 --- /dev/null +++ b/framework/inc/helper/statusindicator.hxx @@ -0,0 +1,145 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ +#define __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ + +//_______________________________________________ +// include files of own module + +#include <helper/statusindicatorfactory.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> + +//_______________________________________________ +// include UNO interfaces +#include <com/sun/star/task/XStatusIndicator.hpp> + +//_______________________________________________ +// include all others +#include <cppuhelper/weak.hxx> +#include <cppuhelper/weakref.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// definitions + +//_______________________________________________ +/** + @short implement a status indicator object + + @descr With this indicator you can show a message and a progress ... + but you share the output device with other indicator objects, + if this instances was created by the same factory. + Then the last created object has full access to device. + All others change her internal data structure only. + + All objects of this StatusIndicator class calls a c++ interface + on the StatusIndicatorFactory (where they was created). + The factory holds all data structures and paints the progress. + + @devstatus ready to use + @threadsafe yes +*/ +class StatusIndicator : public css::lang::XTypeProvider + , public css::task::XStatusIndicator + , private ThreadHelpBase // Order of baseclasses is neccessary for right initializaton! + , public ::cppu::OWeakObject // => XInterface +{ + //------------------------------------------- + // member + private: + + /** @short weak reference to our factory + @descr All our interface calls will be forwarded + to a suitable c++ interface on this factory. + But we dont hold our factory alive. They + correspond with e.g. with a Frame service and + will be owned by him. If the frame will be closed + he close our factory too ... + */ + css::uno::WeakReference< css::task::XStatusIndicatorFactory > m_xFactory; + + //------------------------------------------- + // c++ interface + public: + + //---------------------------------------- + /** @short initialize new instance of this class. + + @param pFactory + pointer to our factory + */ + StatusIndicator(StatusIndicatorFactory* pFactory); + + //---------------------------------------- + /** @short does nothing real .... + */ + virtual ~StatusIndicator(); + + //------------------------------------------- + // uno interface + public: + + //--------------------------------------- + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //--------------------------------------- + // XStatusIndicator + virtual void SAL_CALL start(const ::rtl::OUString& sText , + sal_Int32 nRange) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL end() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL reset() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setText(const ::rtl::OUString& sText) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setValue(sal_Int32 nValue) + throw(css::uno::RuntimeException); + +}; // class StatusIndicator + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_STATUSINDICATOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/statusindicatorfactory.hxx b/framework/inc/helper/statusindicatorfactory.hxx new file mode 100644 index 000000000000..627c56b94291 --- /dev/null +++ b/framework/inc/helper/statusindicatorfactory.hxx @@ -0,0 +1,342 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_STATUSINDICATORFACTORY_HXX_ +#define __FRAMEWORK_HELPER_STATUSINDICATORFACTORY_HXX_ + +// Attention: stl headers must(!) be included at first. Otherwhise it can make trouble +// with solaris headers ... +#include <vector> + +//_______________________________________________ +// include files of own module +#include <helper/wakeupthread.hxx> +#include <threadhelp/threadhelpbase.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> +#include <general.h> + +//_______________________________________________ +// include uno interfaces +#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/XEventListener.hpp> +#include <com/sun/star/task/XStatusIndicatorFactory.hpp> +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/lang/EventObject.hpp> +#include <com/sun/star/awt/WindowEvent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +#include <com/sun/star/util/XUpdatable.hpp> + +//_______________________________________________ +// include others +#include <vcl/status.hxx> +#include <cppuhelper/weak.hxx> +#include <osl/thread.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// definitions + +//=============================================== +/** + @descr This struct hold some informations about all currently running progress proccesses. + Because the can be used on a stack, we must cache her states but must paint only + the top most one. + */ +struct IndicatorInfo +{ + //------------------------------------------- + // member + public: + + /** @short points to the indicator child, where we hold its states + alive here. */ + css::uno::Reference< css::task::XStatusIndicator > m_xIndicator; + + /** @short the last set text for this indicator */ + ::rtl::OUString m_sText; + + /** @short the max range for this indicator. */ + sal_Int32 m_nRange; + + /** @short the last set value for this indicator */ + sal_Int32 m_nValue; + + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short initialize new instance of this class + + @param xIndicator + the new child indiactor of our factory. + + @param sText + its initial text. + + @param nRange + the max range for this indicator. + */ + IndicatorInfo(const css::uno::Reference< css::task::XStatusIndicator >& xIndicator, + const ::rtl::OUString& sText , + sal_Int32 nRange ) + { + m_xIndicator = xIndicator; + m_sText = sText ; + m_nRange = nRange ; + m_nValue = 0 ; + } + + //--------------------------------------- + /** @short Don't forget to free used references! + */ + ~IndicatorInfo() + { + m_xIndicator.clear(); + } + + //--------------------------------------------------------------------------------------------------------- + /** @short Used to locate an info struct inside a stl structure ... + + @descr The indicator object itself is used as key. Its values + are not interesting then. Because mor then one child + indicator can use the same values ... + */ + sal_Bool operator==(const css::uno::Reference< css::task::XStatusIndicator >& xIndicator) + { + return (m_xIndicator == xIndicator); + } +}; +/* + //--------------------------------------------------------------------------------------------------------- + // norm nValue to fit range of 0..100% + sal_Int32 calcPercentage() + { + return ::std::min( (( m_nValue * 100 )/ ::std::max( m_nRange, (sal_Int32)1 ) ), (sal_Int32)100 ); + } +*/ + +//=============================================== +/** @descr Define a lits of child indicator objects and her data. */ +typedef ::std::vector< IndicatorInfo > IndicatorStack; + +//=============================================== +/** @short implement a factory service to create new status indicator objects + + @descr Internaly it uses: + - a vcl based + - or an uno based and by the frame layouted + progress implementation. + + This factory create different indicators and control his access + to a shared output device! Only the last activated component + can write his state to this device. All other requests will be + cached only. + + @devstatus ready to use + @threadsafe yes + */ +class StatusIndicatorFactory : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::lang::XInitialization + , public css::task::XStatusIndicatorFactory + , public css::util::XUpdatable + , private ThreadHelpBase + , public ::cppu::OWeakObject // => XInterface +{ + //------------------------------------------- + // member + private: + + /** stack with all current indicator childs. */ + IndicatorStack m_aStack; + + /** uno service manager to create own needed uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** most active indicator child, which could work with our shared indicator window only. */ + css::uno::Reference< css::task::XStatusIndicator > m_xActiveChild; + + /** used to show the progress on the frame (layouted!) or + as a plugged vcl window. */ + css::uno::Reference< css::task::XStatusIndicator > m_xProgress; + + /** points to the frame, where we show the progress (in case + m_xProgress points to a frame progress. */ + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + /** points to an outside window, where we show the progress (in case + we are plugged into such window). */ + css::uno::WeakReference< css::awt::XWindow > m_xPluggWindow; + + /** Notify us if a fix time is over. We use it to implement an + intelligent "Reschedule" ... */ + WakeUpThread* m_pWakeUp; + + /** Our WakeUpThread calls us in our interface method "XUpdatable::update(). + There we set this member m_bAllowReschedule to TRUE. Next time if our impl_reschedule() + method is called, we know, that an Application::Reschedule() should be made. + Because the last made Reschedule can be was taken long time ago ... may be.*/ + sal_Bool m_bAllowReschedule; + + /** enable/disable automatic showing of our parent window. */ + sal_Bool m_bAllowParentShow; + + /** enable/disable rescheduling. Default=enabled*/ + sal_Bool m_bDisableReschedule; + + /** prevent recursive calling of Application::Reschedule(). */ + static sal_Int32 m_nInReschedule; + + /** time where there last start call was made. */ + sal_Int32 m_nStartTime; + + //------------------------------------------- + // interface + + public: + + //--------------------------------------- + // ctor + StatusIndicatorFactory(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------- + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //--------------------------------------- + // XStatusIndicatorFactory + virtual css::uno::Reference< css::task::XStatusIndicator > SAL_CALL createStatusIndicator() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // XUpdatable + virtual void SAL_CALL update() + throw(css::uno::RuntimeException); + + //--------------------------------------- + // similar (XStatusIndicator) + virtual void start(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + const ::rtl::OUString& sText , + sal_Int32 nRange); + + virtual void SAL_CALL reset(const css::uno::Reference< css::task::XStatusIndicator >& xChild); + + virtual void SAL_CALL end(const css::uno::Reference< css::task::XStatusIndicator >& xChild); + + virtual void SAL_CALL setText(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + const ::rtl::OUString& sText ); + + virtual void SAL_CALL setValue(const css::uno::Reference< css::task::XStatusIndicator >& xChild, + sal_Int32 nValue); + + //------------------------------------------- + // specials + + protected: + + virtual ~StatusIndicatorFactory(); + + //------------------------------------------- + // helper + private: + + /** @short show the parent window of this progress ... + if it's allowed to do so. + + + @descr By default we show the parent window automaticly + if this progress is used. + If that isn't a valid operation, the user of this + progress can suppress this feature by initializaing + us with a special parameter. + + @seealso initialize() + */ + void implts_makeParentVisibleIfAllowed(); + + /** @short creates a new internal used progress. + @descr This factory does not paint the progress itself. + It uses helper for that. They can be vcl based or + layouted by the frame and provided as an uno interface. + */ + void impl_createProgress(); + + /** @short shows the internal used progress. + @descr This factory does not paint the progress itself. + It uses helper for that. They can be vcl based or + layouted by the frame and provided as an uno interface. + */ + void impl_showProgress(); + + /** @short hides the internal used progress. + @descr This factory does not paint the progress itself. + It uses helper for that. They can be vcl based or + layouted by the frame and provided as an uno interface. + */ + void impl_hideProgress(); + + /** @short try to "share the current thread in an intelligent manner" :-) + + @param Overwrites our algorithm for Reschedule and force it to be shure + that our progress was painted right. + */ + void impl_reschedule(sal_Bool bForceUpdate); + + void impl_startWakeUpThread(); + void impl_stopWakeUpThread(); + +}; // class StatusIndicatorFactory + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_STATUSINDICATORFACTORY_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/tagwindowasmodified.hxx b/framework/inc/helper/tagwindowasmodified.hxx new file mode 100644 index 000000000000..f91ebe128510 --- /dev/null +++ b/framework/inc/helper/tagwindowasmodified.hxx @@ -0,0 +1,160 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_ +#define __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.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/XFrame.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <cppuhelper/weak.hxx> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short listen for modify events on model and tag frame container window so it can react accordingly + @descr Used e.g. by our MAC port where such state is shown seperately on some controls of the + title bar. + + @base ThreadHelpBase + guarantee right initialized lock member during startup of instances of this class. + + @base OWeakObject + implements ref counting for this class. + + @devstatus draft + @threadsafe yes + @modified as96863 +*//*-*************************************************************************************************************/ +class TagWindowAsModified : // interfaces + public css::lang::XTypeProvider, + public css::lang::XInitialization, + public css::frame::XFrameActionListener, // => XEventListener + public css::util::XModifyListener, // => XEventListener + // baseclasses (order neccessary for right initialization!) + private ThreadHelpBase, + public ::cppu::OWeakObject +{ + //________________________________ + // member + + private: + + /// may we need an uno service manager to create own services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// reference to the frame, where we listen for new loaded documents for updating our own xModel reference + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + /// reference to the frame container window, where we must set the tag + css::uno::WeakReference< css::awt::XWindow > m_xWindow; + + /// we list on the model for modify events + css::uno::WeakReference< css::frame::XModel > m_xModel; + + //________________________________ + // interface + + public: + + //____________________________ + // ctor/dtor + TagWindowAsModified(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~TagWindowAsModified( ); + + //____________________________ + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //____________________________ + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //____________________________ + // XModifyListener + virtual void SAL_CALL modified(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 + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + private: + + //____________________________ + // @todo document me + void impl_update(const css::uno::Reference< css::frame::XFrame >& xFrame); + +}; // class TagWindowAsModified + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_TAGWINDOWASMODIFIED_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/timerhelper.hxx b/framework/inc/helper/timerhelper.hxx new file mode 100644 index 000000000000..204dfb3428ea --- /dev/null +++ b/framework/inc/helper/timerhelper.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_TIMERHELPER_HXX_ +#define __FRAMEWORK_HELPER_TIMERHELPER_HXX_ + +#include <threadhelp/threadhelpbase.hxx> +#include <salhelper/timer.hxx> +#include <osl/mutex.hxx> + +//........................................................................ +namespace framework +{ +//........................................................................ + + //==================================================================== + //= ITimerListener + //==================================================================== + class ITimerListener + { + public: + virtual void timerExpired() = 0; + }; +//........................................................................ +} // namespace framework +//........................................................................ + +#endif // _FRAMEWORK_HELPER_TIMERHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/titlebarupdate.hxx b/framework/inc/helper/titlebarupdate.hxx new file mode 100644 index 000000000000..0542d0c1f21f --- /dev/null +++ b/framework/inc/helper/titlebarupdate.hxx @@ -0,0 +1,226 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_ +#define __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> + +#include <macros/debug.hxx> + +#include <macros/xinterface.hxx> + +#include <macros/xtypeprovider.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/XFrame.hpp> + +#include <com/sun/star/frame/XTitle.hpp> + +#include <com/sun/star/frame/XFrameActionListener.hpp> + +#include <com/sun/star/frame/XTitleChangeListener.hpp> + +#include <com/sun/star/lang/XEventListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <unotools/moduleoptions.hxx> + +#include <cppuhelper/weak.hxx> + +#include <rtl/ustrbuf.hxx> + +//_________________________________________________________________________________________________________________ +// const +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +/*-************************************************************************************************************//** + @short helps our frame on setting title/icon on the titlebar (including updates) + + @devstatus draft + @threadsafe yes +*//*-*************************************************************************************************************/ +class TitleBarUpdate : // interfaces + public css::lang::XTypeProvider + , public css::lang::XInitialization + , public css::frame::XTitleChangeListener // => XEventListener + , public css::frame::XFrameActionListener // => XEventListener + // baseclasses (order neccessary for right initialization!) + , private ThreadHelpBase + , public ::cppu::OWeakObject +{ + //________________________________ + // structs, types + + private: + + struct TModuleInfo + { + /// internal id of this module + ::rtl::OUString sID; + /// localized name for this module + ::rtl::OUString sUIName; + /// configured icon for this module + ::sal_Int32 nIcon; + }; + + //________________________________ + // member + + private: + + /// may we need an uno service manager to create own services + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /// reference to the frame which was created by the office himself + css::uno::WeakReference< css::frame::XFrame > m_xFrame; + + //________________________________ + // interface + + public: + + //____________________________ + // ctor/dtor + TitleBarUpdate(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + virtual ~TitleBarUpdate( ); + + //____________________________ + // XInterface, XTypeProvider + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + //____________________________ + // XInitialization + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any >& lArguments) + throw(css::uno::Exception , + css::uno::RuntimeException); + + //____________________________ + // XFrameActionListener + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //____________________________ + // XTitleChangeListener + virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent) + throw (css::uno::RuntimeException); + + //____________________________ + // XEventListener + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw(css::uno::RuntimeException); + + //________________________________ + // helper + + private: + + //____________________________ + /** @short identify the application module, which is used behind the component + of our frame. + + @param xFrame + contains the component, wich must be identified. + + @param rInfo + describe the module in its details. + Is set only if return value is true. + + @return [sal_Bool] + TRUE in casee module could be identified and all needed values could be read. + FALSE otherwise. + */ + ::sal_Bool implst_getModuleInfo(const css::uno::Reference< css::frame::XFrame >& xFrame, + TModuleInfo& rInfo ); + + //____________________________ + /** @short set a new icon and title on the title bar of our connected frame window. + + @descr It does not check if an update is realy needed. That has to be done outside. + It retrieves all needed informations and update the title bar - nothing less - + nothing more. + */ + void impl_forceUpdate(); + + //____________________________ + /** @short identify the current component (inside the connected frame) + and set the right module icon on the title bar. + + @param xFrame + the frame which contains the component and where the icon must be set + on the window title bar. + */ + void impl_updateIcon(const css::uno::Reference< css::frame::XFrame >& xFrame); + + //____________________________ + /** @short gets the current title from the frame and set it on the window. + + @param xFrame + the frame which contains the component and where the title must be set + on the window title bar. + */ + void impl_updateTitle(const css::uno::Reference< css::frame::XFrame >& xFrame); + + //Hook to set GNOME3/Windows 7 applicationID for toplevel frames + //http://msdn.microsoft.com/en-us/library/dd378459(v=VS.85).aspx + //http://live.gnome.org/GnomeShell/ApplicationBased + void impl_updateApplicationID(const css::uno::Reference< css::frame::XFrame >& xFrame); +}; // class TitleBarUpdate + +} // namespace framework + +#endif // #ifndef __FRAMEWORK_HELPER_TITLEBARUPDATE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/titlehelper.hxx b/framework/inc/helper/titlehelper.hxx new file mode 100644 index 000000000000..8832ea11002c --- /dev/null +++ b/framework/inc/helper/titlehelper.hxx @@ -0,0 +1,229 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _FRAMEWORK_TITLEHELPER_HXX_ +#define _FRAMEWORK_TITLEHELPER_HXX_ + +//_______________________________________________ +// includes + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/lang/IllegalArgumentException.hpp> +#include <com/sun/star/frame/XUntitledNumbers.hpp> +#include <com/sun/star/frame/XTitle.hpp> +#include <com/sun/star/frame/XTitleChangeBroadcaster.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/frame/XController.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/document/XEventListener.hpp> + +#include <cppuhelper/basemutex.hxx> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/interfacecontainer.hxx> + +#include <rtl/ustrbuf.hxx> + +#include <hash_map> + +//_______________________________________________ +// namespace + +namespace framework{ + +#ifdef css + #error "Ambigious namespace definition of css." +#else + #define css ::com::sun::star +#endif + +//_______________________________________________ +// definitions + +/** @short can be used as implementation helper of interface css.frame.XTitle + + @threadsafe + */ +class TitleHelper : private ::cppu::BaseMutex + , public ::cppu::WeakImplHelper5< css::frame::XTitle , + css::frame::XTitleChangeBroadcaster, + css::frame::XTitleChangeListener , + css::frame::XFrameActionListener , + css::document::XEventListener > +{ + //------------------------------------------- + // interface + public: + + //--------------------------------------- + /** @short lightweight constructor. + */ + TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR); + + //--------------------------------------- + /** @short free all internaly used resources. + */ + virtual ~TitleHelper(); + + //--------------------------------------- + /** set an outside component which uses this container and must be set + as source of all broadcasted messages, exceptions. + + It's holded weak only so we do not need any complex dispose sessions. + + Note: Passing NULL as parameter will be alloed. It will reset the internal + member reference only. + + @param xOwner + the new owner of this collection. + */ + void setOwner (const css::uno::Reference< css::uno::XInterface >& xOwner); + + //--------------------------------------- + /** set an outside component which provides the righht string and number for + an untitled component. + + It's holded weak only so we do not need any complex dispose sessions. + + Note: Passing NULL as parameter will be alloed. It will reset the internal + member reference only. + + @param xNumbers + the right numbered collection for this helper. + */ + void connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers); + + //--------------------------------------- + /** @see XTitle */ + virtual ::rtl::OUString SAL_CALL getTitle() + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitle */ + virtual void SAL_CALL setTitle(const ::rtl::OUString& sTitle) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitleChangeBroadcaster */ + virtual void SAL_CALL addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitleChangeBroadcaster */ + virtual void SAL_CALL removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see XTitleChangeListener */ + virtual void SAL_CALL titleChanged(const css::frame::TitleChangedEvent& aEvent) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see css.document.XEventListener */ + virtual void SAL_CALL notifyEvent(const css::document::EventObject& aEvent) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see css.lang.XEventListener */ + virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) + throw (css::uno::RuntimeException); + + //--------------------------------------- + /** @see css.frame.XFrameActionListener */ + virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent& aEvent) + throw(css::uno::RuntimeException); + + //------------------------------------------- + // internal + private: + + void impl_sendTitleChangedEvent (); + + void impl_updateTitle (); + void impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel); + void impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController); + void impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); + + void impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel); + void impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController); + void impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); + void impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame); + + void impl_appendComponentTitle ( ::rtl::OUStringBuffer& sTitle , + const css::uno::Reference< css::uno::XInterface >& xComponent); + void impl_appendProductName (::rtl::OUStringBuffer& sTitle); + void impl_appendProductExtension (::rtl::OUStringBuffer& sTitle); + void impl_appendModuleName (::rtl::OUStringBuffer& sTitle); + void impl_appendDebugVersion (::rtl::OUStringBuffer& sTitle); + + void impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle); + ::rtl::OUString impl_getSubTitle (); + + ::rtl::OUString impl_convertURL2Title(const ::rtl::OUString& sURL); + + //------------------------------------------- + // member + private: + + /** points to the global uno service manager. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** reference to the outside UNO class using this helper. */ + css::uno::WeakReference< css::uno::XInterface > m_xOwner; + + /** used to know how an "Untitled X" string can be created right :-) */ + css::uno::WeakReference< css::frame::XUntitledNumbers > m_xUntitledNumbers; + + /** provides parts of our own title and we listen there for changes too. */ + css::uno::WeakReference< css::frame::XTitle > m_xSubTitle; + + /** if it's set to TRUE the member m_sTitle has not to be changed internaly. + It was set from outside and so outside code has to make sure it will be + updated. + */ + ::sal_Bool m_bExternalTitle; + + /** the actual title value */ + ::rtl::OUString m_sTitle; + + /** knows the leased number which must be used for untitled components. */ + ::sal_Int32 m_nLeasedNumber; + + /** contains all title change listener */ + ::cppu::OMultiTypeInterfaceContainerHelper m_aListener; +}; + +#undef css + +} // namespace framework + +#endif // _FRAMEWORK_TITLEHELPER_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/uiconfigelementwrapperbase.hxx b/framework/inc/helper/uiconfigelementwrapperbase.hxx new file mode 100644 index 000000000000..64db92e84af0 --- /dev/null +++ b/framework/inc/helper/uiconfigelementwrapperbase.hxx @@ -0,0 +1,164 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_ +#define __FRAMEWORK_HELPER_UICONFIGELEMENTWRAPPERBASE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/XUIElementSettings.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfigurationListener.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/util/XUpdatable.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +namespace framework +{ + +class UIConfigElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIElement , + public ::com::sun::star::ui::XUIElementSettings , + public ::com::sun::star::lang::XInitialization , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::util::XUpdatable , + public ::com::sun::star::ui::XUIConfigurationListener , + protected ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory ); + virtual ~UIConfigElementWrapperBase(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElementSettings + virtual void SAL_CALL updateSettings() throw (::com::sun::star::uno::RuntimeException) = 0; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getSettings( sal_Bool bWriteable ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSettings( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& UISettings ) throw (::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::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); + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw(::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + // 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); + + virtual void impl_fillNewData(); + + static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + + sal_Int16 m_nType; + bool m_bPersistent : 1, + m_bInitialized : 1, + m_bConfigListener : 1, + m_bConfigListening : 1, + m_bDisposed : 1, + m_bNoClose : 1; + rtl::OUString m_aResourceURL; + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceFactory; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xConfigSource; + com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > m_xConfigData; + com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; + com::sun::star::uno::Reference< com::sun::star::awt::XMenuBar > m_xMenuBar; + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/uielementwrapperbase.hxx b/framework/inc/helper/uielementwrapperbase.hxx new file mode 100644 index 000000000000..5445128e70d8 --- /dev/null +++ b/framework/inc/helper/uielementwrapperbase.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ +#define __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/util/XUpdatable.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ +#include <rtl/ustring.hxx> +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +namespace framework +{ + +class UIElementWrapperBase : public ::com::sun::star::lang::XTypeProvider , + public ::com::sun::star::ui::XUIElement , + public ::com::sun::star::lang::XInitialization , + public ::com::sun::star::lang::XComponent , + public ::com::sun::star::util::XUpdatable , + protected ThreadHelpBase , + public ::cppu::OBroadcastHelper , + public ::cppu::OPropertySetHelper , + public ::cppu::OWeakObject +{ + //------------------------------------------------------------------------------------------------------------- + // public methods + //------------------------------------------------------------------------------------------------------------- + public: + UIElementWrapperBase( sal_Int16 nType ); + virtual ~UIElementWrapperBase(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider + //--------------------------------------------------------------------------------------------------------- + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException) = 0; + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL getFrame() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getResourceURL() throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int16 SAL_CALL getType() throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException) = 0; + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + + // 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); + + static const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property > impl_getStaticPropertyDescriptor(); + + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; /// container for ALL Listener + rtl::OUString m_aResourceURL; + com::sun::star::uno::WeakReference< com::sun::star::frame::XFrame > m_xWeakFrame; + sal_Int16 m_nType; + sal_Bool m_bInitialized : 1, + m_bDisposed; +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_UIELEMENTWRAPPERBASE_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/vclstatusindicator.hxx b/framework/inc/helper/vclstatusindicator.hxx new file mode 100644 index 000000000000..4c7580246e9b --- /dev/null +++ b/framework/inc/helper/vclstatusindicator.hxx @@ -0,0 +1,136 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ +#define __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ + +//----------------------------------------------- +// includes of own modules + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <general.h> + +//----------------------------------------------- +// includes of interfaces +#include <com/sun/star/task/XStatusIndicator.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/awt/XWindow.hpp> + +//----------------------------------------------- +// includes of external modules +#include <cppuhelper/weak.hxx> +#include <vcl/status.hxx> + +//----------------------------------------------- +// namespace + +namespace framework { + +//----------------------------------------------- +// declaration + +class VCLStatusIndicator : public css::task::XStatusIndicator + , private ThreadHelpBase // must be the first real base class! + , public ::cppu::OWeakObject +{ + //------------------------------------------- + // member + + private: + + /** can be used to create own needed uno resources. */ + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + + /** points to the parent window of this progress and + hold it alive. */ + css::uno::Reference< css::awt::XWindow > m_xParentWindow; + + /** shows the progress. + + @attention This member isnt synchronized using our own mutex! + Its guarded by the solarmutex only. Otherwhise + we have to lock two of them, which can force a deadlock ... + */ + StatusBar* m_pStatusBar; + + /** knows the current info text of the progress. */ + ::rtl::OUString m_sText; + + /** knows the current range of the progress. */ + sal_Int32 m_nRange; + + /** knows the current value of the progress. */ + sal_Int32 m_nValue; + + //------------------------------------------- + // interface + + public: + + FWK_DECLARE_XINTERFACE + + /// ctor + VCLStatusIndicator(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR , + const css::uno::Reference< css::awt::XWindow >& xParentWindow); + + /// dtor + virtual ~VCLStatusIndicator(); + + /// XStatusIndicator + virtual void SAL_CALL start(const ::rtl::OUString& sText , + sal_Int32 nRange) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL reset() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL end() + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setText(const ::rtl::OUString& sText) + throw(css::uno::RuntimeException); + + virtual void SAL_CALL setValue(sal_Int32 nValue) + throw(css::uno::RuntimeException); + + //------------------------------------------- + // helper + + private: + + static void impl_recalcLayout(Window* pStatusBar , + Window* pParentWindow); +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_VCLSTATUSINDICATOR_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/framework/inc/helper/wakeupthread.hxx b/framework/inc/helper/wakeupthread.hxx new file mode 100644 index 000000000000..6a7a6fd6e388 --- /dev/null +++ b/framework/inc/helper/wakeupthread.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_ +#define __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_ + +//_______________________________________________ +// include files of own module + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/debug.hxx> +#include <macros/generic.hxx> + +#include <general.h> + +//_______________________________________________ +// include UNO interfaces + +#include <com/sun/star/util/XUpdatable.hpp> + +//_______________________________________________ +// include all others +#include <cppuhelper/weakref.hxx> +#include <osl/thread.hxx> + +//_______________________________________________ +// namespace + +namespace framework{ + +//_______________________________________________ +// definitions + +//=============================================== +/** @short implements a "sleeping" thread, which try to sleep + without a using cpu consumption :-) */ +class WakeUpThread : public ThreadHelpBase + , public ::osl::Thread +{ + //------------------------------------------- + // member + private: + + /** @short this listener will be notified if this thread + waked up. */ + css::uno::WeakReference< css::util::XUpdatable > m_xListener; + + //------------------------------------------- + // interface + public: + + /** @short Register a new listener on this thread. + + @descr The listener is holded as a weak reference. + If the thread detects, that no listener exists ... + he will terminate itself. + */ + WakeUpThread(const css::uno::Reference< css::util::XUpdatable >& xListener); + + /** @descr The thread waits on a condition using a fix timeout value. + If the thread wakes up he notify the internal set listener. + The listener can use this "timeout" info for it's own purpose. + The thread itself will wait on the condition again. + */ + virtual void SAL_CALL run(); + + virtual void SAL_CALL onTerminated(); +}; + +} // namespace framework + +#endif // __FRAMEWORK_HELPER_WAKEUPTHREAD_HXX_ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |