diff options
author | Mikhail Voytenko <mav@openoffice.org> | 2011-01-06 14:57:12 +0100 |
---|---|---|
committer | Mikhail Voytenko <mav@openoffice.org> | 2011-01-06 14:57:12 +0100 |
commit | 8ff51afa0dcd4e5e644e923131ee72435c80b57b (patch) | |
tree | d63f6b6e298485b5f29f60c7af25baca46f59375 /framework/source/helper | |
parent | fa1f3c352c6126b24ab5af87ea4ebea742c546c2 (diff) | |
parent | 794c821e4d48c34aa376cdc7b6ab2cb029d9574d (diff) |
removetooltypes01: rebase to DEV300_m96
Diffstat (limited to 'framework/source/helper')
-rw-r--r-- | framework/source/helper/acceleratorinfo.cxx | 71 | ||||
-rw-r--r-- | framework/source/helper/actiontriggerhelper.cxx | 408 | ||||
-rw-r--r-- | framework/source/helper/configimporter.cxx | 93 | ||||
-rwxr-xr-x[-rw-r--r--] | framework/source/helper/dockingareadefaultacceptor.cxx | 18 | ||||
-rw-r--r-- | framework/source/helper/imageproducer.cxx | 56 | ||||
-rw-r--r-- | framework/source/helper/makefile.mk | 69 | ||||
-rw-r--r-- | framework/source/helper/mischelper.cxx | 239 | ||||
-rw-r--r-- | framework/source/helper/networkdomain.cxx | 295 | ||||
-rwxr-xr-x[-rw-r--r--] | framework/source/helper/ocomponentaccess.cxx | 44 | ||||
-rwxr-xr-x[-rw-r--r--] | framework/source/helper/ocomponentenumeration.cxx | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | framework/source/helper/oframes.cxx | 56 | ||||
-rw-r--r-- | framework/source/helper/propertysetcontainer.cxx | 196 | ||||
-rw-r--r-- | framework/source/helper/shareablemutex.cxx | 81 | ||||
-rw-r--r-- | framework/source/helper/titlehelper.cxx | 760 | ||||
-rw-r--r-- | framework/source/helper/uiconfigelementwrapperbase.cxx | 571 | ||||
-rw-r--r-- | framework/source/helper/uielementwrapperbase.cxx | 282 |
16 files changed, 61 insertions, 3182 deletions
diff --git a/framework/source/helper/acceleratorinfo.cxx b/framework/source/helper/acceleratorinfo.cxx deleted file mode 100644 index 3db17cf1db89..000000000000 --- a/framework/source/helper/acceleratorinfo.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -#include <helper/acceleratorinfo.hxx> - -namespace framework -{ - -static pfunc_getCommandURLFromKeyCode _pGetCommandURLFromKeyCode = NULL; -static pfunc_getKeyCodeFromCommandURL _pGetKeyCodeFromCommandURL = NULL; - -pfunc_getCommandURLFromKeyCode SAL_CALL SetCommandURLFromKeyCode( pfunc_getCommandURLFromKeyCode pNewFunc ) -{ - pfunc_getCommandURLFromKeyCode pOldFunc = _pGetCommandURLFromKeyCode; - _pGetCommandURLFromKeyCode = pNewFunc; - - return pOldFunc; -} - -::rtl::OUString SAL_CALL GetCommandURLFromKeyCode( const KeyCode& aKeyCode ) -{ - if ( _pGetCommandURLFromKeyCode ) - return _pGetCommandURLFromKeyCode( aKeyCode ); - else - return rtl::OUString(); -} - -pfunc_getKeyCodeFromCommandURL SAL_CALL SetKeyCodeFromCommandURL( pfunc_getKeyCodeFromCommandURL pNewFunc ) -{ - pfunc_getKeyCodeFromCommandURL pOldFunc = _pGetKeyCodeFromCommandURL; - _pGetKeyCodeFromCommandURL = pNewFunc; - - return pOldFunc; -} - -KeyCode SAL_CALL GetKeyCodeFromCommandURL( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const rtl::OUString& aCommandURL ) -{ - if ( _pGetKeyCodeFromCommandURL ) - return _pGetKeyCodeFromCommandURL( rFrame, aCommandURL ); - else - return KeyCode(); -} - -} diff --git a/framework/source/helper/actiontriggerhelper.cxx b/framework/source/helper/actiontriggerhelper.cxx deleted file mode 100644 index 7524150655eb..000000000000 --- a/framework/source/helper/actiontriggerhelper.cxx +++ /dev/null @@ -1,408 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" -#include <helper/actiontriggerhelper.hxx> -#include <classes/actiontriggerseparatorpropertyset.hxx> -#include <classes/rootactiontriggercontainer.hxx> -#include <classes/imagewrapper.hxx> -#include <classes/addonsoptions.hxx> -#include <com/sun/star/lang/XServiceInfo.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/awt/XBitmap.hpp> -#include <vcl/svapp.hxx> -#include <vos/mutex.hxx> -#include <tools/stream.hxx> -#include <cppuhelper/weak.hxx> -#include <comphelper/processfactory.hxx> - - -const sal_uInt16 START_ITEMID = 1000; - -using namespace rtl; -using namespace vos; -using namespace com::sun::star::awt; -using namespace com::sun::star::uno; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; -using namespace com::sun::star::container; - -namespace framework -{ - -// ---------------------------------------------------------------------------- -// implementation helper ( menu => ActionTrigger ) -// ---------------------------------------------------------------------------- - -sal_Bool IsSeparator( Reference< XPropertySet > xPropertySet ) -{ - Reference< XServiceInfo > xServiceInfo( xPropertySet, UNO_QUERY ); - try - { - return xServiceInfo->supportsService( OUString( RTL_CONSTASCII_USTRINGPARAM( SERVICENAME_ACTIONTRIGGERSEPARATOR )) ); - } - catch ( Exception& ) - { - } - - return sal_False; -} - -void GetMenuItemAttributes( Reference< XPropertySet > xActionTriggerPropertySet, - OUString& aMenuLabel, - OUString& aCommandURL, - OUString& aHelpURL, - Reference< XBitmap >& xBitmap, - Reference< XIndexContainer >& xSubContainer ) -{ - Any a; - - try - { - // mandatory properties - a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" )) ); - a >>= aMenuLabel; - a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )) ); - a >>= aCommandURL; - a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Image" )) ); - a >>= xBitmap; - a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "SubContainer" )) ); - a >>= xSubContainer; - } - catch ( Exception& ) - { - } - - // optional properties - try - { - a = xActionTriggerPropertySet->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "HelpURL" )) ); - a >>= aHelpURL; - } - catch ( Exception& ) - { - } -} - -void InsertSubMenuItems( Menu* pSubMenu, sal_uInt16& nItemId, Reference< XIndexContainer > xActionTriggerContainer ) -{ - Reference< XIndexAccess > xIndexAccess( xActionTriggerContainer, UNO_QUERY ); - if ( xIndexAccess.is() ) - { - AddonsOptions aAddonOptions; - const StyleSettings& rSettings = Application::GetSettings().GetStyleSettings(); - sal_Bool bHiContrast = rSettings.GetHighContrastMode(); - - OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); - - for ( sal_Int32 i = 0; i < xIndexAccess->getCount(); i++ ) - { - try - { - Reference< XPropertySet > xPropSet; - if (( xIndexAccess->getByIndex( i ) >>= xPropSet ) && ( xPropSet.is() )) - { - if ( IsSeparator( xPropSet )) - { - // Separator - OGuard aGuard( Application::GetSolarMutex() ); - pSubMenu->InsertSeparator(); - } - else - { - // Menu item - OUString aLabel; - OUString aCommandURL; - OUString aHelpURL; - Reference< XBitmap > xBitmap; - Reference< XIndexContainer > xSubContainer; - sal_Bool bSpecialItemId = sal_False; - - sal_uInt16 nNewItemId = nItemId++; - GetMenuItemAttributes( xPropSet, aLabel, aCommandURL, aHelpURL, xBitmap, xSubContainer ); - - OGuard aGuard( Application::GetSolarMutex() ); - { - // insert new menu item - sal_Int32 nIndex = aCommandURL.indexOf( aSlotURL ); - if ( nIndex >= 0 ) - { - // Special code for our menu implementation: some menu items don't have a - // command url but uses the item id as a unqiue identifier. These entries - // got a special url during conversion from menu=>actiontriggercontainer. - // Now we have to extract this special url and set the correct item id!!! - bSpecialItemId = sal_True; - nNewItemId = (sal_uInt16)aCommandURL.copy( nIndex+aSlotURL.getLength() ).toInt32(); - pSubMenu->InsertItem( nNewItemId, aLabel ); - } - else - { - pSubMenu->InsertItem( nNewItemId, aLabel ); - pSubMenu->SetItemCommand( nNewItemId, aCommandURL ); - } - - // handle bitmap - if ( xBitmap.is() ) - { - sal_Bool bImageSet = sal_False; - - Reference< XUnoTunnel > xUnoTunnel( xBitmap, UNO_QUERY ); - if ( xUnoTunnel.is() ) - { - // Try to get implementation pointer through XUnoTunnel - sal_Int64 nPointer = xUnoTunnel->getSomething( ImageWrapper::GetUnoTunnelId() ); - if ( nPointer ) - { - // This is our own optimized implementation of menu images! - ImageWrapper* pImageWrapper = reinterpret_cast< ImageWrapper * >( nPointer ); - Image aMenuImage = pImageWrapper->GetImage(); - - if ( !!aMenuImage ) - pSubMenu->SetItemImage( nNewItemId, aMenuImage ); - - bImageSet = sal_True; - } - } - - if ( !bImageSet ) - { - // This is an unknown implementation of a XBitmap interface. We have to - // use a more time consuming way to build an Image! - Image aImage; - Bitmap aBitmap; - - Sequence< sal_Int8 > aDIBSeq; - { - aDIBSeq = xBitmap->getDIB(); - SvMemoryStream aMem( (void *)aDIBSeq.getConstArray(), aDIBSeq.getLength(), STREAM_READ ); - aMem >> aBitmap; - } - - aDIBSeq = xBitmap->getMaskDIB(); - if ( aDIBSeq.getLength() > 0 ) - { - Bitmap aMaskBitmap; - SvMemoryStream aMem( (void *)aDIBSeq.getConstArray(), aDIBSeq.getLength(), STREAM_READ ); - aMem >> aMaskBitmap; - aImage = Image( aBitmap, aMaskBitmap ); - } - else - aImage = Image( aBitmap ); - - if ( !!aImage ) - pSubMenu->SetItemImage( nNewItemId, aImage ); - } - } - else - { - // Support add-on images for context menu interceptors - Image aImage = aAddonOptions.GetImageFromURL( aCommandURL, sal_False, bHiContrast, sal_True ); - if ( !!aImage ) - pSubMenu->SetItemImage( nNewItemId, aImage ); - } - - if ( xSubContainer.is() ) - { - PopupMenu* pNewSubMenu = new PopupMenu; - - // Sub menu (recursive call CreateSubMenu ) - InsertSubMenuItems( pNewSubMenu, nItemId, xSubContainer ); - pSubMenu->SetPopupMenu( nNewItemId, pNewSubMenu ); - } - } - } - } - } - catch ( IndexOutOfBoundsException ) - { - return; - } - catch ( WrappedTargetException ) - { - return; - } - catch ( RuntimeException ) - { - return; - } - } - } -} - - -// ---------------------------------------------------------------------------- -// implementation helper ( ActionTrigger => menu ) -// ---------------------------------------------------------------------------- - -Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const Menu* pMenu, const Reference< XIndexContainer >& rActionTriggerContainer ) throw ( RuntimeException ) -{ - Reference< XPropertySet > xPropSet; - - Reference< XMultiServiceFactory > xMultiServiceFactory( rActionTriggerContainer, UNO_QUERY ); - if ( xMultiServiceFactory.is() ) - { - xPropSet = Reference< XPropertySet >( xMultiServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ActionTrigger" )) ), - UNO_QUERY ); - - Any a; - - try - { - // Retrieve the menu attributes and set them in our PropertySet - OUString aLabel = pMenu->GetItemText( nItemId ); - a <<= aLabel; - xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Text" )), a ); - - OUString aCommandURL = pMenu->GetItemCommand( nItemId ); - - if ( aCommandURL.getLength() == 0 ) - { - aCommandURL = OUString( RTL_CONSTASCII_USTRINGPARAM( "slot:" )); - aCommandURL += OUString::valueOf( (sal_Int32)nItemId ); - } - - a <<= aCommandURL; - xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "CommandURL" )), a ); - - Image aImage = pMenu->GetItemImage( nItemId ); - if ( !!aImage ) - { - // We use our own optimized XBitmap implementation - Reference< XBitmap > xBitmap( static_cast< cppu::OWeakObject* >( new ImageWrapper( aImage )), UNO_QUERY ); - a <<= xBitmap; - xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "Image" )), a ); - } - } - catch ( Exception& ) - { - } - } - - return xPropSet; -} - -Reference< XPropertySet > CreateActionTriggerSeparator( const Reference< XIndexContainer >& rActionTriggerContainer ) throw ( RuntimeException ) -{ - Reference< XMultiServiceFactory > xMultiServiceFactory( rActionTriggerContainer, UNO_QUERY ); - if ( xMultiServiceFactory.is() ) - { - return Reference< XPropertySet >( xMultiServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ActionTriggerSeparator" )) ), - UNO_QUERY ); - } - - return Reference< XPropertySet >(); -} - -Reference< XIndexContainer > CreateActionTriggerContainer( const Reference< XIndexContainer >& rActionTriggerContainer ) throw ( RuntimeException ) -{ - Reference< XMultiServiceFactory > xMultiServiceFactory( rActionTriggerContainer, UNO_QUERY ); - if ( xMultiServiceFactory.is() ) - { - return Reference< XIndexContainer >( xMultiServiceFactory->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ActionTriggerContainer" )) ), - UNO_QUERY ); - } - - return Reference< XIndexContainer >(); -} - -void FillActionTriggerContainerWithMenu( const Menu* pMenu, Reference< XIndexContainer >& rActionTriggerContainer ) -{ - OGuard aGuard( Application::GetSolarMutex() ); - - for ( sal_uInt16 nPos = 0; nPos < pMenu->GetItemCount(); nPos++ ) - { - sal_uInt16 nItemId = pMenu->GetItemId( nPos ); - MenuItemType nType = pMenu->GetItemType( nPos ); - - try - { - Any a; - Reference< XPropertySet > xPropSet; - - if ( nType == MENUITEM_SEPARATOR ) - { - xPropSet = CreateActionTriggerSeparator( rActionTriggerContainer ); - - a <<= xPropSet; - rActionTriggerContainer->insertByIndex( nPos, a ); - } - else - { - xPropSet = CreateActionTrigger( nItemId, pMenu, rActionTriggerContainer ); - - a <<= xPropSet; - rActionTriggerContainer->insertByIndex( nPos, a ); - - PopupMenu* pPopupMenu = pMenu->GetPopupMenu( nItemId ); - if ( pPopupMenu ) - { - // recursive call to build next sub menu - Reference< XIndexContainer > xSubContainer = CreateActionTriggerContainer( rActionTriggerContainer ); - - a <<= xSubContainer; - xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "SubContainer" )), a ); - FillActionTriggerContainerWithMenu( pPopupMenu, xSubContainer ); - } - } - } - catch ( Exception& ) - { - } - } -} - -void ActionTriggerHelper::CreateMenuFromActionTriggerContainer( - Menu* pNewMenu, - const Reference< XIndexContainer >& rActionTriggerContainer ) -{ - sal_uInt16 nItemId = START_ITEMID; - - if ( rActionTriggerContainer.is() ) - InsertSubMenuItems( pNewMenu, nItemId, rActionTriggerContainer ); -} - -void ActionTriggerHelper::FillActionTriggerContainerFromMenu( - Reference< XIndexContainer >& xActionTriggerContainer, - const Menu* pMenu ) -{ - FillActionTriggerContainerWithMenu( pMenu, xActionTriggerContainer ); -} - -Reference< XIndexContainer > ActionTriggerHelper::CreateActionTriggerContainerFromMenu( - // #110897# - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory, - const Menu* pMenu, - const ::rtl::OUString* pMenuIdentifier ) -{ - return new RootActionTriggerContainer( pMenu, pMenuIdentifier, xServiceFactory ); -} - -} diff --git a/framework/source/helper/configimporter.cxx b/framework/source/helper/configimporter.cxx deleted file mode 100644 index 6f2c402da1e8..000000000000 --- a/framework/source/helper/configimporter.cxx +++ /dev/null @@ -1,93 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -#include <helper/configimporter.hxx> -#include <xml/toolboxconfiguration.hxx> -#include <com/sun/star/embed/ElementModes.hpp> - -#include <rtl/ustrbuf.hxx> - -using namespace ::com::sun::star; - -namespace framework -{ - -sal_Bool UIConfigurationImporterOOo1x::ImportCustomToolbars( - const uno::Reference< ui::XUIConfigurationManager >& rContainerFactory, - uno::Sequence< uno::Reference< container::XIndexContainer > >& rSeqContainer, - const uno::Reference< lang::XMultiServiceFactory >& rServiceManager, - const uno::Reference< embed::XStorage >& rToolbarStorage ) -{ - const char USERDEFTOOLBOX[] = "userdeftoolbox0.xml"; - uno::Reference< lang::XMultiServiceFactory > rSrvMgr( rServiceManager ); - - sal_Bool bResult ( sal_False ); - if ( rToolbarStorage.is() && rContainerFactory.is() ) - { - try - { - for ( sal_uInt16 i = 1; i <= 4; i++ ) - { - rtl::OUStringBuffer aCustomTbxName( 20 ); - aCustomTbxName.appendAscii( USERDEFTOOLBOX ); - aCustomTbxName.setCharAt( 14, aCustomTbxName.charAt( 14 ) + i ); - - rtl::OUString aTbxStreamName( aCustomTbxName.makeStringAndClear() ); - uno::Reference< io::XStream > xStream = rToolbarStorage->openStreamElement( aTbxStreamName, embed::ElementModes::READ ); - if ( xStream.is() ) - { - uno::Reference< io::XInputStream > xInputStream = xStream->getInputStream(); - if ( xInputStream.is() ) - { - uno::Reference< container::XIndexContainer > xContainer = rContainerFactory->createSettings(); - if ( ToolBoxConfiguration::LoadToolBox( rSrvMgr, xInputStream, xContainer )) - { - sal_uInt32 nIndex = rSeqContainer.getLength(); - rSeqContainer.realloc( nIndex+1 ); - rSeqContainer[nIndex] = xContainer; - bResult = sal_True; - } - } - } - } - } - catch ( uno::RuntimeException& ) - { - throw; - } - catch ( uno::Exception& ) - { - } - } - - return bResult; -} - -} // namespace framework diff --git a/framework/source/helper/dockingareadefaultacceptor.cxx b/framework/source/helper/dockingareadefaultacceptor.cxx index 91cfc451fadd..2b199c03ba83 100644..100755 --- a/framework/source/helper/dockingareadefaultacceptor.cxx +++ b/framework/source/helper/dockingareadefaultacceptor.cxx @@ -76,7 +76,7 @@ using namespace ::rtl ; //***************************************************************************************************************** // constructor //***************************************************************************************************************** -DockingAreaDefaultAcceptor::DockingAreaDefaultAcceptor( const Reference< XFrame >& xOwner ) +DockingAreaDefaultAcceptor::DockingAreaDefaultAcceptor( const css::uno::Reference< XFrame >& xOwner ) // Init baseclasses first : ThreadHelpBase ( &Application::GetSolarMutex() ) // Init member @@ -100,8 +100,8 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL DockingAreaDefaultAcceptor::ge ResetableGuard aGuard( m_aLock ); // Try to "lock" the frame for access to taskscontainer. - Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); - Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); + css::uno::Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); return xContainerWindow; } @@ -112,13 +112,13 @@ sal_Bool SAL_CALL DockingAreaDefaultAcceptor::requestDockingAreaSpace( const css ResetableGuard aGuard( m_aLock ); // Try to "lock" the frame for access to taskscontainer. - Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); aGuard.unlock(); if ( xFrame.is() == sal_True ) { - Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); - Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() ); + css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); + css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() ); if (( xContainerWindow.is() == sal_True ) && ( xComponentWindow.is() == sal_True ) ) @@ -152,11 +152,11 @@ void SAL_CALL DockingAreaDefaultAcceptor::setDockingAreaSpace( const css::awt::R ResetableGuard aGuard( m_aLock ); // Try to "lock" the frame for access to taskscontainer. - Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFrame > xFrame( m_xOwner.get(), UNO_QUERY ); if ( xFrame.is() == sal_True ) { - Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); - Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() ); + css::uno::Reference< css::awt::XWindow > xContainerWindow( xFrame->getContainerWindow() ); + css::uno::Reference< css::awt::XWindow > xComponentWindow( xFrame->getComponentWindow() ); if (( xContainerWindow.is() == sal_True ) && ( xComponentWindow.is() == sal_True ) ) diff --git a/framework/source/helper/imageproducer.cxx b/framework/source/helper/imageproducer.cxx deleted file mode 100644 index 062ccc52bce1..000000000000 --- a/framework/source/helper/imageproducer.cxx +++ /dev/null @@ -1,56 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -#include <helper/imageproducer.hxx> - -namespace framework -{ - -static pfunc_getImage _pGetImageFunc = NULL; - -pfunc_getImage SAL_CALL SetImageProducer( pfunc_getImage pNewGetImageFunc ) -{ - pfunc_getImage pOldFunc = _pGetImageFunc; - _pGetImageFunc = pNewGetImageFunc; - - return pOldFunc; -} - - -Image SAL_CALL GetImageFromURL( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& aURL, sal_Bool bBig, sal_Bool bHiContrast ) -{ - if ( _pGetImageFunc ) - return _pGetImageFunc( rFrame, aURL, bBig, bHiContrast ); - else - return Image(); -} - -} - diff --git a/framework/source/helper/makefile.mk b/framework/source/helper/makefile.mk deleted file mode 100644 index ed54c381160c..000000000000 --- a/framework/source/helper/makefile.mk +++ /dev/null @@ -1,69 +0,0 @@ -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#************************************************************************* -PRJ=..$/.. - -PRJNAME= framework -TARGET= fwk_helper -USE_DEFFILE= TRUE -ENABLE_EXCEPTIONS= TRUE - -# --- Settings ----------------------------------------------------- - -.INCLUDE : settings.mk - -# --- defines ------------------------------------------------------ - -CDEFS+=-DCOMPMOD_NAMESPACE=framework - -# --- Generate ----------------------------------------------------- - -SLOFILES= $(SLO)$/ocomponentaccess.obj \ - $(SLO)$/ocomponentenumeration.obj \ - $(SLO)$/oframes.obj \ - $(SLO)$/statusindicatorfactory.obj \ - $(SLO)$/statusindicator.obj \ - $(SLO)$/imageproducer.obj \ - $(SLO)$/propertysetcontainer.obj \ - $(SLO)$/actiontriggerhelper.obj \ - $(SLO)$/persistentwindowstate.obj \ - $(SLO)$/networkdomain.obj \ - $(SLO)$/acceleratorinfo.obj \ - $(SLO)$/uielementwrapperbase.obj \ - $(SLO)$/dockingareadefaultacceptor.obj \ - $(SLO)$/uiconfigelementwrapperbase.obj \ - $(SLO)$/shareablemutex.obj \ - $(SLO)$/vclstatusindicator.obj \ - $(SLO)$/wakeupthread.obj \ - $(SLO)$/configimporter.obj \ - $(SLO)$/tagwindowasmodified.obj \ - $(SLO)$/titlebarupdate.obj \ - $(SLO)$/titlehelper.obj \ - $(SLO)$/mischelper.obj - -# --- Targets ------------------------------------------------------ - -.INCLUDE : target.mk diff --git a/framework/source/helper/mischelper.cxx b/framework/source/helper/mischelper.cxx deleted file mode 100644 index c7155edca7c6..000000000000 --- a/framework/source/helper/mischelper.cxx +++ /dev/null @@ -1,239 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/document/XDocumentLanguages.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> - -#include <tools/debug.hxx> -#include <vcl/settings.hxx> -#include <vcl/svapp.hxx> -#include <i18npool/mslangid.hxx> -#include <svtools/langtab.hxx> -#include <comphelper/processfactory.hxx> -#include <helper/mischelper.hxx> -#include <services.h> - - -using namespace ::com::sun::star; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::lang; - -using ::rtl::OUString; - - -namespace framework -{ - -uno::Reference< linguistic2::XLanguageGuessing > LanguageGuessingHelper::GetGuesser() const -{ - if (!m_xLanguageGuesser.is()) - { - try - { - m_xLanguageGuesser = uno::Reference< linguistic2::XLanguageGuessing >( - m_xServiceManager->createInstance( - rtl::OUString::createFromAscii( "com.sun.star.linguistic2.LanguageGuessing" ) ), - uno::UNO_QUERY ); - } - catch (uno::Exception &r) - { - (void) r; - DBG_ASSERT( 0, "failed to get language guessing component" ); - } - } - return m_xLanguageGuesser; -} - -//////////////////////////////////////////////////////////// - -::rtl::OUString RetrieveLabelFromCommand( - const ::rtl::OUString& aCmdURL, - const uno::Reference< lang::XMultiServiceFactory >& _xServiceFactory, - uno::Reference< container::XNameAccess >& _xUICommandLabels, - const uno::Reference< frame::XFrame >& _xFrame, - ::rtl::OUString& _rModuleIdentifier, - sal_Bool& _rIni, - const sal_Char* _pName) -{ - ::rtl::OUString aLabel; - - // Retrieve popup menu labels - if ( !_xUICommandLabels.is() ) - { - try - { - if ( !_rIni ) - { - _rIni = sal_True; - Reference< XModuleManager > xModuleManager( _xServiceFactory->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY_THROW ); - - try - { - _rModuleIdentifier = xModuleManager->identify( _xFrame ); - } - catch( Exception& ) - { - } - } - - Reference< XNameAccess > xNameAccess( _xServiceFactory->createInstance( SERVICENAME_UICOMMANDDESCRIPTION ), UNO_QUERY ); - if ( xNameAccess.is() ) - { - xNameAccess->getByName( _rModuleIdentifier ) >>= _xUICommandLabels; - } - } - catch ( Exception& ) - { - } - } - - if ( _xUICommandLabels.is() ) - { - try - { - if ( aCmdURL.getLength() > 0 ) - { - rtl::OUString aStr; - Sequence< PropertyValue > aPropSeq; - if ( _xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq ) - { - for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ ) - { - if ( aPropSeq[i].Name.equalsAscii( _pName/*"Label"*/ )) - { - aPropSeq[i].Value >>= aStr; - break; - } - } - } - aLabel = aStr; - } - } - catch ( com::sun::star::uno::Exception& ) - { - } - } - - return aLabel; -} - -//////////////////////////////////////////////////////////// - -void FillLangItems( std::set< OUString > &rLangItems, - const SvtLanguageTable & rLanguageTable, - const uno::Reference< frame::XFrame > & rxFrame, - const LanguageGuessingHelper & rLangGuessHelper, - sal_Int16 nScriptType, - const OUString & rCurLang, - const OUString & rKeyboardLang, - const OUString & rGuessedTextLang ) -{ - rLangItems.clear(); - - //1--add current language - if( rCurLang != OUString() && - LANGUAGE_DONTKNOW != rLanguageTable.GetType( rCurLang )) - rLangItems.insert( rCurLang ); - - //2--System - const AllSettings& rAllSettings = Application::GetSettings(); - LanguageType rSystemLanguage = rAllSettings.GetLanguage(); - if( rSystemLanguage != LANGUAGE_DONTKNOW ) - { - if ( IsScriptTypeMatchingToLanguage( nScriptType, rSystemLanguage )) - rLangItems.insert( OUString( rLanguageTable.GetString( rSystemLanguage )) ); - } - - //3--UI - LanguageType rUILanguage = rAllSettings.GetUILanguage(); - if( rUILanguage != LANGUAGE_DONTKNOW ) - { - if ( IsScriptTypeMatchingToLanguage( nScriptType, rUILanguage )) - rLangItems.insert( OUString( rLanguageTable.GetString( rUILanguage )) ); - } - - //4--guessed language - uno::Reference< linguistic2::XLanguageGuessing > xLangGuesser( rLangGuessHelper.GetGuesser() ); - if ( xLangGuesser.is() && rGuessedTextLang.getLength() > 0) - { - ::com::sun::star::lang::Locale aLocale(xLangGuesser->guessPrimaryLanguage( rGuessedTextLang, 0, rGuessedTextLang.getLength()) ); - LanguageType nLang = MsLangId::convertLocaleToLanguageWithFallback( aLocale ); - if (nLang != LANGUAGE_DONTKNOW && nLang != LANGUAGE_NONE && nLang != LANGUAGE_SYSTEM - && IsScriptTypeMatchingToLanguage( nScriptType, nLang )) - rLangItems.insert( rLanguageTable.GetString( nLang )); - } - - //5--keyboard language - if( rKeyboardLang != OUString()) - { - if ( IsScriptTypeMatchingToLanguage( nScriptType, rLanguageTable.GetType( rKeyboardLang ))) - rLangItems.insert( rKeyboardLang ); - } - - //6--all languages used in current document - Reference< com::sun::star::frame::XModel > xModel; - if ( rxFrame.is() ) - { - Reference< com::sun::star::frame::XController > xController( rxFrame->getController(), UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - Reference< document::XDocumentLanguages > xDocumentLanguages( xModel, UNO_QUERY ); - /*the description of nScriptType - LATIN : 0x001 - ASIAN : 0x002 - COMPLEX: 0x004 - */ - const sal_Int16 nMaxCount = 7; - if ( xDocumentLanguages.is() ) - { - Sequence< Locale > rLocales( xDocumentLanguages->getDocumentLanguages( nScriptType, nMaxCount )); - if ( rLocales.getLength() > 0 ) - { - for ( sal_uInt16 i = 0; i < rLocales.getLength(); ++i ) - { - if ( rLangItems.size() == static_cast< size_t >(nMaxCount) ) - break; - const Locale& rLocale=rLocales[i]; - if( IsScriptTypeMatchingToLanguage( nScriptType, rLanguageTable.GetType( rLocale.Language ))) - rLangItems.insert( OUString( rLocale.Language ) ); - } - } - } -} - -} // namespace framework - - diff --git a/framework/source/helper/networkdomain.cxx b/framework/source/helper/networkdomain.cxx deleted file mode 100644 index fcc966402944..000000000000 --- a/framework/source/helper/networkdomain.cxx +++ /dev/null @@ -1,295 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" -#include <helper/networkdomain.hxx> - -namespace framework -{ - -#ifdef WNT -//_________________________________________________________________________________________________________________ -// Windows -//_________________________________________________________________________________________________________________ - -#define UNICODE -#if defined _MSC_VER -#pragma warning(push, 1) -#endif -#include <windows.h> -#if defined _MSC_VER -#pragma warning(pop) -#endif - -//_________________________________________________________________________________________________________________ -// Win NT, Win 2000, Win XP -//_________________________________________________________________________________________________________________ - -static DWORD WINAPI GetUserDomainW_NT( LPWSTR lpBuffer, DWORD nSize ) -{ - return GetEnvironmentVariable( TEXT("USERDOMAIN"), lpBuffer, nSize ); -} - -//_________________________________________________________________________________________________________________ -// Win 9x,Win ME -//_________________________________________________________________________________________________________________ - -static DWORD WINAPI GetUserDomainW_WINDOWS( LPWSTR lpBuffer, DWORD nSize ) -{ - HKEY hkeyLogon; - HKEY hkeyWorkgroup; - DWORD dwResult = 0; - - - if ( ERROR_SUCCESS == RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("Network\\Logon"), - 0, KEY_READ, &hkeyLogon ) ) - { - DWORD dwLogon = 0; - DWORD dwLogonSize = sizeof(dwLogon); - RegQueryValueEx( hkeyLogon, TEXT("LMLogon"), 0, NULL, (LPBYTE)&dwLogon, &dwLogonSize ); - RegCloseKey( hkeyLogon ); - - if ( dwLogon ) - { - HKEY hkeyNetworkProvider; - - if ( ERROR_SUCCESS == RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Services\\MSNP32\\NetworkProvider"), - 0, KEY_READ, &hkeyNetworkProvider ) ) - { - DWORD dwBufferSize = nSize; - LONG lResult = RegQueryValueEx( hkeyNetworkProvider, TEXT("AuthenticatingAgent"), 0, NULL, (LPBYTE)lpBuffer, &dwBufferSize ); - - if ( ERROR_SUCCESS == lResult || ERROR_MORE_DATA == lResult ) - dwResult = dwBufferSize / sizeof(TCHAR); - - RegCloseKey( hkeyNetworkProvider ); - } - } - } - else if ( ERROR_SUCCESS == RegOpenKeyEx( - HKEY_LOCAL_MACHINE, - TEXT("SYSTEM\\CurrentControlSet\\Services\\VxD\\VNETSUP"), - 0, KEY_READ, &hkeyWorkgroup ) ) - { - DWORD dwBufferSize = nSize; - LONG lResult = RegQueryValueEx( hkeyWorkgroup, TEXT("Workgroup"), 0, NULL, (LPBYTE)lpBuffer, &dwBufferSize ); - - if ( ERROR_SUCCESS == lResult || ERROR_MORE_DATA == lResult ) - dwResult = dwBufferSize / sizeof(TCHAR); - - RegCloseKey( hkeyWorkgroup ); - } - - - return dwResult; -} - -static rtl::OUString GetUserDomain() -{ - sal_Unicode aBuffer[256]; - - long nVersion = GetVersion(); - DWORD nResult; - - if ( nVersion < 0 ) - nResult = GetUserDomainW_WINDOWS( reinterpret_cast<LPWSTR>(aBuffer), sizeof( aBuffer ) ); - else - nResult = GetUserDomainW_NT( reinterpret_cast<LPWSTR>(aBuffer), sizeof( aBuffer ) ); - - if ( nResult > 0 ) - return rtl::OUString( aBuffer ); - else - return rtl::OUString(); -} - -//_________________________________________________________________________________________________________________ -// Windows -//_________________________________________________________________________________________________________________ - -rtl::OUString NetworkDomain::GetYPDomainName() -{ - return ::rtl::OUString(); -} - -rtl::OUString NetworkDomain::GetNTDomainName() -{ - return GetUserDomain(); -} - -#elif defined( UNIX ) - -#include <rtl/ustring.h> -#include <stdlib.h> -#include <errno.h> -#include <osl/thread.h> - -//_________________________________________________________________________________________________________________ -// Unix -//_________________________________________________________________________________________________________________ - -#if defined( SOLARIS ) - -//_________________________________________________________________________________________________________________ -// Solaris -//_________________________________________________________________________________________________________________ - -#include <sys/systeminfo.h> -#include <sal/alloca.h> - -static rtl_uString *getDomainName() -{ - /* Initialize and assume failure */ - rtl_uString *ustrDomainName = NULL; - - char szBuffer[256]; - - long nCopied = sizeof(szBuffer); - char *pBuffer = szBuffer; - long nBufSize; - - do - { - nBufSize = nCopied; - nCopied = sysinfo( SI_SRPC_DOMAIN, pBuffer, nBufSize ); - - /* If nCopied is greater than buffersize we need to allocate - a buffer with suitable size */ - - if ( nCopied > nBufSize ) - pBuffer = (char *)alloca( nCopied ); - - } while ( nCopied > nBufSize ); - - if ( -1 != nCopied ) - { - rtl_string2UString( - &ustrDomainName, - pBuffer, - nCopied - 1, - osl_getThreadTextEncoding(), - OSTRING_TO_OUSTRING_CVTFLAGS ); - } - - return ustrDomainName; -} - -#elif defined( LINUX ) /* endif SOLARIS */ - -//_________________________________________________________________________________________________________________ -// Linux -//_________________________________________________________________________________________________________________ - -#include <unistd.h> -#include <string.h> - -static rtl_uString *getDomainName() -{ - /* Initialize and assume failure */ - rtl_uString *ustrDomainName = NULL; - - char *pBuffer; - int result; - size_t nBufSize = 0; - - do - { - nBufSize += 256; /* Increase buffer size by steps of 256 bytes */ - pBuffer = (char *)alloca( nBufSize ); - result = getdomainname( pBuffer, nBufSize ); - /* If buffersize in not large enough -1 is returned and errno - is set to EINVAL. This only applies to libc. With glibc the name - is truncated. */ - } while ( -1 == result && EINVAL == errno ); - - if ( 0 == result ) - { - rtl_string2UString( - &ustrDomainName, - pBuffer, - strlen( pBuffer ), - osl_getThreadTextEncoding(), - OSTRING_TO_OUSTRING_CVTFLAGS ); - } - - return ustrDomainName; -} - -#else /* LINUX */ - -//_________________________________________________________________________________________________________________ -// Other Unix -//_________________________________________________________________________________________________________________ - -static rtl_uString *getDomainName() -{ - return NULL; -} - -#endif - -//_________________________________________________________________________________________________________________ -// Unix -//_________________________________________________________________________________________________________________ - -rtl::OUString NetworkDomain::GetYPDomainName() -{ - rtl_uString* pResult = getDomainName(); - if ( pResult ) - return rtl::OUString( pResult ); - else - return rtl::OUString(); -} - -rtl::OUString NetworkDomain::GetNTDomainName() -{ - return ::rtl::OUString(); -} - -#else /* UNIX */ - -//_________________________________________________________________________________________________________________ -// Other operating systems (non-Windows and non-Unix) -//_________________________________________________________________________________________________________________ - -rtl::OUString NetworkDomain::GetYPDomainName() -{ - return rtl::OUString(); -} - -rtl::OUString NetworkDomain::GetNTDomainName() -{ - return rtl::OUString(); -} - -#endif - -} // namespace framework diff --git a/framework/source/helper/ocomponentaccess.cxx b/framework/source/helper/ocomponentaccess.cxx index ce25ac0796fc..4e64a38d6ca3 100644..100755 --- a/framework/source/helper/ocomponentaccess.cxx +++ b/framework/source/helper/ocomponentaccess.cxx @@ -77,7 +77,7 @@ using namespace ::rtl ; //***************************************************************************************************************** // constructor //***************************************************************************************************************** -OComponentAccess::OComponentAccess( const Reference< XDesktop >& xOwner ) +OComponentAccess::OComponentAccess( const css::uno::Reference< XDesktop >& xOwner ) // Init baseclasses first : ThreadHelpBase ( &Application::GetSolarMutex() ) // Init member @@ -97,27 +97,27 @@ OComponentAccess::~OComponentAccess() //***************************************************************************************************************** // XEnumerationAccess //***************************************************************************************************************** -Reference< XEnumeration > SAL_CALL OComponentAccess::createEnumeration() throw( RuntimeException ) +css::uno::Reference< XEnumeration > SAL_CALL OComponentAccess::createEnumeration() throw( RuntimeException ) { // Ready for multithreading ResetableGuard aGuard( m_aLock ); // Set default return value, if method failed. // If no desktop exist and there is no task container - return an empty enumeration! - Reference< XEnumeration > xReturn = Reference< XEnumeration >(); + css::uno::Reference< XEnumeration > xReturn = css::uno::Reference< XEnumeration >(); // Try to "lock" the desktop for access to task container. - Reference< XInterface > xLock = m_xOwner.get(); + css::uno::Reference< XInterface > xLock = m_xOwner.get(); if ( xLock.is() == sal_True ) { // Desktop exist => pointer to task container must be valid. // Initialize a new enumeration ... if some tasks and his components exist! // (OTasksEnumeration will make an assert, if we initialize the new instance without valid values!) - Sequence< Reference< XComponent > > seqComponents; - impl_collectAllChildComponents( Reference< XFramesSupplier >( xLock, UNO_QUERY ), seqComponents ); + Sequence< css::uno::Reference< XComponent > > seqComponents; + impl_collectAllChildComponents( css::uno::Reference< XFramesSupplier >( xLock, UNO_QUERY ), seqComponents ); OComponentEnumeration* pEnumeration = new OComponentEnumeration( seqComponents ); - xReturn = Reference< XEnumeration >( (OWeakObject*)pEnumeration, UNO_QUERY ); + xReturn = css::uno::Reference< XEnumeration >( (OWeakObject*)pEnumeration, UNO_QUERY ); } // Return result of this operation. @@ -131,7 +131,7 @@ Type SAL_CALL OComponentAccess::getElementType() throw( RuntimeException ) { // Elements in list an enumeration are components! // Return the uno-type of XComponent. - return ::getCppuType((const Reference< XComponent >*)NULL); + return ::getCppuType((const css::uno::Reference< XComponent >*)NULL); } //***************************************************************************************************************** @@ -146,7 +146,7 @@ sal_Bool SAL_CALL OComponentAccess::hasElements() throw( RuntimeException ) sal_Bool bReturn = sal_False; // Try to "lock" the desktop for access to task container. - Reference< XFramesSupplier > xLock( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFramesSupplier > xLock( m_xOwner.get(), UNO_QUERY ); if ( xLock.is() == sal_True ) { // Ask container of owner for existing elements. @@ -160,8 +160,8 @@ sal_Bool SAL_CALL OComponentAccess::hasElements() throw( RuntimeException ) //***************************************************************************************************************** // private method //***************************************************************************************************************** -void OComponentAccess::impl_collectAllChildComponents( const Reference< XFramesSupplier >& xNode , - Sequence< Reference< XComponent > >& seqComponents ) +void OComponentAccess::impl_collectAllChildComponents( const css::uno::Reference< XFramesSupplier >& xNode , + Sequence< css::uno::Reference< XComponent > >& seqComponents ) { // If valid node was given ... if( xNode.is() == sal_True ) @@ -173,13 +173,13 @@ void OComponentAccess::impl_collectAllChildComponents( const Reference< XFram sal_Int32 nComponentCount = seqComponents.getLength(); - const Reference< XFrames > xContainer = xNode->getFrames(); - const Sequence< Reference< XFrame > > seqFrames = xContainer->queryFrames( FrameSearchFlag::CHILDREN ); + const css::uno::Reference< XFrames > xContainer = xNode->getFrames(); + const Sequence< css::uno::Reference< XFrame > > seqFrames = xContainer->queryFrames( FrameSearchFlag::CHILDREN ); const sal_Int32 nFrameCount = seqFrames.getLength(); for( sal_Int32 nFrame=0; nFrame<nFrameCount; ++nFrame ) { - Reference< XComponent > xComponent = impl_getFrameComponent( seqFrames[nFrame] ); + css::uno::Reference< XComponent > xComponent = impl_getFrameComponent( seqFrames[nFrame] ); if( xComponent.is() == sal_True ) { nComponentCount++; @@ -194,30 +194,30 @@ void OComponentAccess::impl_collectAllChildComponents( const Reference< XFram //***************************************************************************************************************** // private method //***************************************************************************************************************** -Reference< XComponent > OComponentAccess::impl_getFrameComponent( const Reference< XFrame >& xFrame ) const +css::uno::Reference< XComponent > OComponentAccess::impl_getFrameComponent( const css::uno::Reference< XFrame >& xFrame ) const { // Set default return value, if method failed. - Reference< XComponent > xComponent = Reference< XComponent >(); + css::uno::Reference< XComponent > xComponent = css::uno::Reference< XComponent >(); // Does no controller exists? - Reference< XController > xController = xFrame->getController(); + css::uno::Reference< XController > xController = xFrame->getController(); if ( xController.is() == sal_False ) { // Controller not exist - use the VCL-component. - xComponent = Reference< XComponent >( xFrame->getComponentWindow(), UNO_QUERY ); + xComponent = css::uno::Reference< XComponent >( xFrame->getComponentWindow(), UNO_QUERY ); } else { // Does no model exists? - Reference< XModel > xModel( xController->getModel(), UNO_QUERY ); + css::uno::Reference< XModel > xModel( xController->getModel(), UNO_QUERY ); if ( xModel.is() == sal_True ) { // Model exist - use the model as component. - xComponent = Reference< XComponent >( xModel, UNO_QUERY ); + xComponent = css::uno::Reference< XComponent >( xModel, UNO_QUERY ); } else { // Model not exist - use the controller as component. - xComponent = Reference< XComponent >( xController, UNO_QUERY ); + xComponent = css::uno::Reference< XComponent >( xController, UNO_QUERY ); } } @@ -241,7 +241,7 @@ Reference< XComponent > OComponentAccess::impl_getFrameComponent( const Referenc #ifdef ENABLE_ASSERTIONS //***************************************************************************************************************** -sal_Bool OComponentAccess::impldbg_checkParameter_OComponentAccessCtor( const Reference< XDesktop >& xOwner ) +sal_Bool OComponentAccess::impldbg_checkParameter_OComponentAccessCtor( const css::uno::Reference< XDesktop >& xOwner ) { // Set default return value. sal_Bool bOK = sal_True; diff --git a/framework/source/helper/ocomponentenumeration.cxx b/framework/source/helper/ocomponentenumeration.cxx index 68237179d70d..9df43625a5a8 100644..100755 --- a/framework/source/helper/ocomponentenumeration.cxx +++ b/framework/source/helper/ocomponentenumeration.cxx @@ -74,7 +74,7 @@ using namespace ::rtl ; //***************************************************************************************************************** // constructor //***************************************************************************************************************** -OComponentEnumeration::OComponentEnumeration( const Sequence< Reference< XComponent > >& seqComponents ) +OComponentEnumeration::OComponentEnumeration( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) // Init baseclasses first // Attention: // Don't change order of initialization! @@ -200,7 +200,7 @@ void OComponentEnumeration::impl_resetObject() //***************************************************************************************************************** // An empty list is allowed ... hasMoreElements() will return false then! -sal_Bool OComponentEnumeration::impldbg_checkParameter_OComponentEnumerationCtor( const Sequence< Reference< XComponent > >& seqComponents ) +sal_Bool OComponentEnumeration::impldbg_checkParameter_OComponentEnumerationCtor( const Sequence< css::uno::Reference< XComponent > >& seqComponents ) { // Set default return value. sal_Bool bOK = sal_True; diff --git a/framework/source/helper/oframes.cxx b/framework/source/helper/oframes.cxx index 62f4b30de749..3034f7438cf6 100644..100755 --- a/framework/source/helper/oframes.cxx +++ b/framework/source/helper/oframes.cxx @@ -79,8 +79,8 @@ using namespace ::vos ; //***************************************************************************************************************** // constructor //***************************************************************************************************************** -OFrames::OFrames( const Reference< XMultiServiceFactory >& xFactory , - const Reference< XFrame >& xOwner , +OFrames::OFrames( const css::uno::Reference< XMultiServiceFactory >& xFactory , + const css::uno::Reference< XFrame >& xOwner , FrameContainer* pFrameContainer ) // Init baseclasses first : ThreadHelpBase ( &Application::GetSolarMutex() ) @@ -107,7 +107,7 @@ OFrames::~OFrames() //***************************************************************************************************************** // XFrames //***************************************************************************************************************** -void SAL_CALL OFrames::append( const Reference< XFrame >& xFrame ) throw( RuntimeException ) +void SAL_CALL OFrames::append( const css::uno::Reference< XFrame >& xFrame ) throw( RuntimeException ) { // Ready for multithreading ResetableGuard aGuard( m_aLock ); @@ -118,7 +118,7 @@ void SAL_CALL OFrames::append( const Reference< XFrame >& xFrame ) throw( Runtim // Do the follow only, if owner instance valid! // Lock owner for follow operations - make a "hard reference"! - Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); if ( xOwner.is() == sal_True ) { // Append frame to the end of the container ... @@ -133,7 +133,7 @@ void SAL_CALL OFrames::append( const Reference< XFrame >& xFrame ) throw( Runtim //***************************************************************************************************************** // XFrames //***************************************************************************************************************** -void SAL_CALL OFrames::remove( const Reference< XFrame >& xFrame ) throw( RuntimeException ) +void SAL_CALL OFrames::remove( const css::uno::Reference< XFrame >& xFrame ) throw( RuntimeException ) { // Ready for multithreading ResetableGuard aGuard( m_aLock ); @@ -144,7 +144,7 @@ void SAL_CALL OFrames::remove( const Reference< XFrame >& xFrame ) throw( Runtim // Do the follow only, if owner instance valid! // Lock owner for follow operations - make a "hard reference"! - Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFramesSupplier > xOwner( m_xOwner.get(), UNO_QUERY ); if ( xOwner.is() == sal_True ) { // Search frame and remove it from container ... @@ -160,7 +160,7 @@ void SAL_CALL OFrames::remove( const Reference< XFrame >& xFrame ) throw( Runtim //***************************************************************************************************************** // XFrames //***************************************************************************************************************** -Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearchFlags ) throw( RuntimeException ) +Sequence< css::uno::Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearchFlags ) throw( RuntimeException ) { // Ready for multithreading ResetableGuard aGuard( m_aLock ); @@ -170,11 +170,11 @@ Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearch LOG_ASSERT( impldbg_checkParameter_queryFrames( nSearchFlags ), "OFrames::queryFrames()\nInvalid parameter detected!\n" ) // Set default return value. (empty sequence) - Sequence< Reference< XFrame > > seqFrames; + Sequence< css::uno::Reference< XFrame > > seqFrames; // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! - Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); if ( xOwner.is() == sal_True ) { // Work only, if search was not started here ...! @@ -203,10 +203,10 @@ Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearch // Add parent to list ... if any exist! if( nSearchFlags & FrameSearchFlag::PARENT ) { - Reference< XFrame > xParent( xOwner->getCreator(), UNO_QUERY ); + css::uno::Reference< XFrame > xParent( xOwner->getCreator(), UNO_QUERY ); if( xParent.is() == sal_True ) { - Sequence< Reference< XFrame > > seqParent( 1 ); + Sequence< css::uno::Reference< XFrame > > seqParent( 1 ); seqParent[0] = xParent; impl_appendSequence( seqFrames, seqParent ); } @@ -216,7 +216,7 @@ Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearch // Add owner to list if SELF is searched. if( nSearchFlags & FrameSearchFlag::SELF ) { - Sequence< Reference< XFrame > > seqSelf( 1 ); + Sequence< css::uno::Reference< XFrame > > seqSelf( 1 ); seqSelf[0] = xOwner; impl_appendSequence( seqFrames, seqSelf ); } @@ -229,7 +229,7 @@ Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearch // Protect this instance against recursive calls from parents. m_bRecursiveSearchProtection = sal_True; // Ask parent of my owner for frames and append results to return list. - Reference< XFramesSupplier > xParent( xOwner->getCreator(), UNO_QUERY ); + css::uno::Reference< XFramesSupplier > xParent( xOwner->getCreator(), UNO_QUERY ); // If a parent exist ... if ( xParent.is() == sal_True ) { @@ -254,7 +254,7 @@ Sequence< Reference< XFrame > > SAL_CALL OFrames::queryFrames( sal_Int32 nSearch { // We don't must control this conversion. // We have done this at append()! - Reference< XFramesSupplier > xItem( (*m_pFrameContainer)[nIndex], UNO_QUERY ); + css::uno::Reference< XFramesSupplier > xItem( (*m_pFrameContainer)[nIndex], UNO_QUERY ); impl_appendSequence( seqFrames, xItem->getFrames()->queryFrames( nChildSearchFlags ) ); } } @@ -280,7 +280,7 @@ sal_Int32 SAL_CALL OFrames::getCount() throw( RuntimeException ) // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! - Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); if ( xOwner.is() == sal_True ) { // Set CURRENT size of container for return. @@ -311,7 +311,7 @@ Any SAL_CALL OFrames::getByIndex( sal_Int32 nIndex ) throw( IndexOutOfBoundsExce // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! - Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); if ( xOwner.is() == sal_True ) { // Get element form container. @@ -329,7 +329,7 @@ Any SAL_CALL OFrames::getByIndex( sal_Int32 nIndex ) throw( IndexOutOfBoundsExce Type SAL_CALL OFrames::getElementType() throw( RuntimeException ) { // This "container" support XFrame-interfaces only! - return ::getCppuType( (const Reference< XFrame >*)NULL ); + return ::getCppuType( (const css::uno::Reference< XFrame >*)NULL ); } //***************************************************************************************************************** @@ -344,7 +344,7 @@ sal_Bool SAL_CALL OFrames::hasElements() throw( RuntimeException ) sal_Bool bHasElements = sal_False; // Do the follow only, if owner instance valid. // Lock owner for follow operations - make a "hard reference"! - Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); + css::uno::Reference< XFrame > xOwner( m_xOwner.get(), UNO_QUERY ); if ( xOwner.is() == sal_True ) { // If some elements exist ... @@ -378,18 +378,18 @@ void OFrames::impl_resetObject() //***************************************************************************************************************** // private method //***************************************************************************************************************** -void OFrames::impl_appendSequence( Sequence< Reference< XFrame > >& seqDestination , - const Sequence< Reference< XFrame > >& seqSource ) +void OFrames::impl_appendSequence( Sequence< css::uno::Reference< XFrame > >& seqDestination , + const Sequence< css::uno::Reference< XFrame > >& seqSource ) { // Get some informations about the sequences. sal_Int32 nSourceCount = seqSource.getLength(); sal_Int32 nDestinationCount = seqDestination.getLength(); - const Reference< XFrame >* pSourceAccess = seqSource.getConstArray(); - Reference< XFrame >* pDestinationAccess = seqDestination.getArray(); + const css::uno::Reference< XFrame >* pSourceAccess = seqSource.getConstArray(); + css::uno::Reference< XFrame >* pDestinationAccess = seqDestination.getArray(); // Get memory for result list. - Sequence< Reference< XFrame > > seqResult ( nSourceCount + nDestinationCount ); - Reference< XFrame >* pResultAccess = seqResult.getArray(); + Sequence< css::uno::Reference< XFrame > > seqResult ( nSourceCount + nDestinationCount ); + css::uno::Reference< XFrame >* pResultAccess = seqResult.getArray(); sal_Int32 nResultPosition = 0; // Copy all items from first sequence. @@ -434,8 +434,8 @@ void OFrames::impl_appendSequence( Sequence< Reference< XFrame > >& // An instance of this class can only work with valid initialization. // We share the mutex with ouer owner class, need a valid factory to instanciate new services and // use the access to ouer owner for some operations. -sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const Reference< XMultiServiceFactory >& xFactory , - const Reference< XFrame >& xOwner , +sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const css::uno::Reference< XMultiServiceFactory >& xFactory , + const css::uno::Reference< XFrame >& xOwner , FrameContainer* pFrameContainer ) { // Set default return value. @@ -458,7 +458,7 @@ sal_Bool OFrames::impldbg_checkParameter_OFramesCtor( const Reference< XMult //***************************************************************************************************************** // Its only allowed to add valid references to container. // AND - alle frames must support XFrames-interface! -sal_Bool OFrames::impldbg_checkParameter_append( const Reference< XFrame >& xFrame ) +sal_Bool OFrames::impldbg_checkParameter_append( const css::uno::Reference< XFrame >& xFrame ) { // Set default return value. sal_Bool bOK = sal_True; @@ -477,7 +477,7 @@ sal_Bool OFrames::impldbg_checkParameter_append( const Reference< XFrame >& xFra //***************************************************************************************************************** // Its only allowed to add valid references to container... // ... => You can only delete valid references! -sal_Bool OFrames::impldbg_checkParameter_remove( const Reference< XFrame >& xFrame ) +sal_Bool OFrames::impldbg_checkParameter_remove( const css::uno::Reference< XFrame >& xFrame ) { // Set default return value. sal_Bool bOK = sal_True; diff --git a/framework/source/helper/propertysetcontainer.cxx b/framework/source/helper/propertysetcontainer.cxx deleted file mode 100644 index 0fe750f92fd9..000000000000 --- a/framework/source/helper/propertysetcontainer.cxx +++ /dev/null @@ -1,196 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" -#include <helper/propertysetcontainer.hxx> -#include <threadhelp/resetableguard.hxx> - -#include <vcl/svapp.hxx> - -#define WRONG_TYPE_EXCEPTION "Only XPropertSet allowed!" - -using namespace rtl; -using namespace vos; -using namespace cppu; -using namespace com::sun::star::uno; -using namespace com::sun::star::container; -using namespace com::sun::star::lang; -using namespace com::sun::star::beans; - -namespace framework -{ - -PropertySetContainer::PropertySetContainer( const Reference< XMultiServiceFactory >& ) - : ThreadHelpBase( &Application::GetSolarMutex() ) - , OWeakObject() - -{ -} - - -PropertySetContainer::~PropertySetContainer() -{ -} - - -// XInterface -void SAL_CALL PropertySetContainer::acquire() throw () -{ - OWeakObject::acquire(); -} - -void SAL_CALL PropertySetContainer::release() throw () -{ - OWeakObject::release(); -} - -Any SAL_CALL PropertySetContainer::queryInterface( const Type& rType ) -throw ( RuntimeException ) -{ - Any a = ::cppu::queryInterface( - rType , - SAL_STATIC_CAST( XIndexContainer*, this ), - SAL_STATIC_CAST( XIndexReplace*, this ), - SAL_STATIC_CAST( XIndexAccess*, this ), - SAL_STATIC_CAST( XElementAccess*, this ) ); - - if( a.hasValue() ) - { - return a; - } - - return OWeakObject::queryInterface( rType ); -} - -// XIndexContainer -void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) - throw ( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - ResetableGuard aGuard( m_aLock ); - - sal_Int32 nSize = m_aPropertySetVector.size(); - - if ( nSize >= Index ) - { - Reference< XPropertySet > aPropertySetElement; - - if ( Element >>= aPropertySetElement ) - { - if ( nSize == Index ) - m_aPropertySetVector.push_back( aPropertySetElement ); - else - { - PropertySetVector::iterator aIter = m_aPropertySetVector.begin(); - aIter += Index; - m_aPropertySetVector.insert( aIter, aPropertySetElement ); - } - } - else - { - throw IllegalArgumentException( - OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )), - (OWeakObject *)this, 2 ); - } - } - else - throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this ); -} - -void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 Index ) - throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - ResetableGuard aGuard( m_aLock ); - - if ( (sal_Int32)m_aPropertySetVector.size() > Index ) - { - PropertySetVector::iterator aIter = m_aPropertySetVector.begin(); - aIter += Index; - m_aPropertySetVector.erase( aIter ); - } - else - throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this ); -} - -// XIndexReplace -void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) - throw ( IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException) -{ - if ( (sal_Int32)m_aPropertySetVector.size() > Index ) - { - Reference< XPropertySet > aPropertySetElement; - - if ( Element >>= aPropertySetElement ) - { - m_aPropertySetVector[ Index ] = aPropertySetElement; - } - else - { - throw IllegalArgumentException( - OUString( RTL_CONSTASCII_USTRINGPARAM( WRONG_TYPE_EXCEPTION )), - (OWeakObject *)this, 2 ); - } - } - else - throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this ); -} - -// XIndexAccess -sal_Int32 SAL_CALL PropertySetContainer::getCount() - throw ( RuntimeException ) -{ - ResetableGuard aGuard( m_aLock ); - - return m_aPropertySetVector.size(); -} - -Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index ) - throw ( IndexOutOfBoundsException, WrappedTargetException, RuntimeException ) -{ - ResetableGuard aGuard( m_aLock ); - - if ( (sal_Int32)m_aPropertySetVector.size() > Index ) - { - Any a; - - a <<= m_aPropertySetVector[ Index ]; - return a; - } - else - throw IndexOutOfBoundsException( OUString(), (OWeakObject *)this ); -} - -// XElementAccess -sal_Bool SAL_CALL PropertySetContainer::hasElements() - throw (::com::sun::star::uno::RuntimeException) -{ - ResetableGuard aGuard( m_aLock ); - - return !( m_aPropertySetVector.empty() ); -} - -} diff --git a/framework/source/helper/shareablemutex.cxx b/framework/source/helper/shareablemutex.cxx deleted file mode 100644 index b173c6c34a4f..000000000000 --- a/framework/source/helper/shareablemutex.cxx +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" -#include <helper/shareablemutex.hxx> - -namespace framework -{ - -ShareableMutex::ShareableMutex() -{ - pMutexRef = new MutexRef; - pMutexRef->acquire(); -} - -ShareableMutex::ShareableMutex( const ShareableMutex& rShareableMutex ) -{ - pMutexRef = rShareableMutex.pMutexRef; - if ( pMutexRef ) - pMutexRef->acquire(); -} - -const ShareableMutex& ShareableMutex::operator=( const ShareableMutex& rShareableMutex ) -{ - if ( rShareableMutex.pMutexRef ) - rShareableMutex.pMutexRef->acquire(); - if ( pMutexRef ) - pMutexRef->release(); - pMutexRef = rShareableMutex.pMutexRef; - return *this; -} - -ShareableMutex::~ShareableMutex() -{ - if ( pMutexRef ) - pMutexRef->release(); -} - -void ShareableMutex::acquire() -{ - if ( pMutexRef ) - pMutexRef->m_oslMutex.acquire(); -} - -void ShareableMutex::release() -{ - if ( pMutexRef ) - pMutexRef->m_oslMutex.release(); -} - -::osl::Mutex& ShareableMutex::getShareableOslMutex() -{ - return pMutexRef->m_oslMutex; -} - -} diff --git a/framework/source/helper/titlehelper.cxx b/framework/source/helper/titlehelper.cxx deleted file mode 100644 index 1ca884c27ca7..000000000000 --- a/framework/source/helper/titlehelper.cxx +++ /dev/null @@ -1,760 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_______________________________________________ -// includes - -#include <helper/titlehelper.hxx> -#include <services.h> -#include <properties.h> - -#include <com/sun/star/frame/UntitledNumbersConst.hpp> -#include <com/sun/star/frame/XStorable.hpp> -#include <com/sun/star/frame/XModuleManager.hpp> -#include <com/sun/star/container/XNameAccess.hpp> -#include <com/sun/star/document/XEventBroadcaster.hpp> -#include <com/sun/star/beans/XMaterialHolder.hpp> - -#include <unotools/configmgr.hxx> -#include <unotools/bootstrap.hxx> -#include <comphelper/sequenceashashmap.hxx> -#include <rtl/ustrbuf.hxx> -#include <osl/mutex.hxx> -#include <tools/urlobj.hxx> - -//_______________________________________________ -// namespace - -namespace framework{ - -namespace css = ::com::sun::star; - -//_______________________________________________ -// definitions - -static const ::rtl::OUString ERRMSG_INVALID_COMPONENT_PARAM = ::rtl::OUString::createFromAscii("NULL as component reference not allowed."); -static const ::rtl::OUString ERRMSG_INVALID_NUMBER_PARAM = ::rtl::OUString::createFromAscii("Special valkud INVALID_NUMBER not allowed as input parameter."); - -//----------------------------------------------- -TitleHelper::TitleHelper(const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR) - : ::cppu::BaseMutex () - , m_xSMGR (xSMGR) - , m_xOwner () - , m_xUntitledNumbers() - , m_xSubTitle () - , m_bExternalTitle (sal_False) - , m_sTitle () - , m_nLeasedNumber (css::frame::UntitledNumbersConst::INVALID_NUMBER) - , m_aListener (m_aMutex) -{ -} - -//----------------------------------------------- -TitleHelper::~TitleHelper() -{ -} - -//----------------------------------------------- -void TitleHelper::setOwner(const css::uno::Reference< css::uno::XInterface >& xOwner) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - m_xOwner = xOwner; - - aLock.clear (); - // <- SYNCHRONIZED - - css::uno::Reference< css::frame::XModel > xModel(xOwner, css::uno::UNO_QUERY); - if (xModel.is ()) - { - impl_startListeningForModel (xModel); - return; - } - - css::uno::Reference< css::frame::XController > xController(xOwner, css::uno::UNO_QUERY); - if (xController.is ()) - { - impl_startListeningForController (xController); - return; - } - - css::uno::Reference< css::frame::XFrame > xFrame(xOwner, css::uno::UNO_QUERY); - if (xFrame.is ()) - { - impl_startListeningForFrame (xFrame); - return; - } -} - -//----------------------------------------------- -::rtl::OUString SAL_CALL TitleHelper::getTitle() - throw (css::uno::RuntimeException) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - // An external title will win always and disable all internal logic about - // creating/using a title value. - // Even an empty string will be accepted as valid title ! - if (m_bExternalTitle) - return m_sTitle; - - // Title seams to be up-to-date. Return it directly. - if (m_sTitle.getLength() > 0) - return m_sTitle; - - // Title seams to be unused till now ... do bootstraping - impl_updateTitle (); - - return m_sTitle; - - // <- SYNCHRONIZED -} - -//----------------------------------------------- -void TitleHelper::connectWithUntitledNumbers (const css::uno::Reference< css::frame::XUntitledNumbers >& xNumbers) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - m_xUntitledNumbers = xNumbers; - - // <- SYNCHRONIZED -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::setTitle(const ::rtl::OUString& sTitle) - throw (css::uno::RuntimeException) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - m_bExternalTitle = sal_True; - m_sTitle = sTitle; - - aLock.clear (); - // <- SYNCHRONIZED - - impl_sendTitleChangedEvent (); -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::addTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) - throw (css::uno::RuntimeException) -{ - // container is threadsafe by himself - m_aListener.addInterface( ::getCppuType( (const css::uno::Reference< css::frame::XTitleChangeListener >*)NULL ), xListener ); -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::removeTitleChangeListener(const css::uno::Reference< css::frame::XTitleChangeListener >& xListener) - throw (css::uno::RuntimeException) -{ - // container is threadsafe by himself - m_aListener.removeInterface( ::getCppuType( (const css::uno::Reference< css::frame::XTitleChangeListener >*)NULL ), xListener ); -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::titleChanged(const css::frame::TitleChangedEvent& aEvent) - throw (css::uno::RuntimeException) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::uno::Reference< css::frame::XTitle > xSubTitle(m_xSubTitle.get (), css::uno::UNO_QUERY); - - aLock.clear (); - // <- SYNCHRONIZED - - if (aEvent.Source != xSubTitle) - return; - - impl_updateTitle (); -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::notifyEvent(const css::document::EventObject& aEvent) - throw (css::uno::RuntimeException) -{ - if ( ! aEvent.EventName.equalsIgnoreAsciiCaseAscii ("OnSaveAsDone") - && ! aEvent.EventName.equalsIgnoreAsciiCaseAscii ("OnTitleChanged")) - return; - - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::uno::Reference< css::frame::XModel > xOwner(m_xOwner.get (), css::uno::UNO_QUERY); - - aLock.clear (); - // <- SYNCHRONIZED - - if ( - aEvent.Source != xOwner || - (aEvent.EventName.equalsIgnoreAsciiCaseAscii ("OnTitleChanged") && !xOwner.is()) - ) - { - return; - } - - impl_updateTitle (); -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::frameAction(const css::frame::FrameActionEvent& aEvent) - throw(css::uno::RuntimeException) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::uno::Reference< css::frame::XFrame > xOwner(m_xOwner.get (), css::uno::UNO_QUERY); - - aLock.clear (); - // <- SYNCHRONIZED - - if (aEvent.Source != xOwner) - return; - - // we are interested on events only, which must trigger a title bar update - // because component was changed. - if ( - (aEvent.Action == css::frame::FrameAction_COMPONENT_ATTACHED ) || - (aEvent.Action == css::frame::FrameAction_COMPONENT_REATTACHED) || - (aEvent.Action == css::frame::FrameAction_COMPONENT_DETACHING ) - ) - { - impl_updateListeningForFrame (xOwner); - impl_updateTitle (); - } -} - -//----------------------------------------------- -void SAL_CALL TitleHelper::disposing(const css::lang::EventObject& aEvent) - throw (css::uno::RuntimeException) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - css::uno::Reference< css::uno::XInterface > xOwner (m_xOwner.get() , css::uno::UNO_QUERY); - css::uno::Reference< css::frame::XUntitledNumbers > xNumbers (m_xUntitledNumbers.get(), css::uno::UNO_QUERY); - ::sal_Int32 nLeasedNumber = m_nLeasedNumber; - aLock.clear (); - // <- SYNCHRONIZED - - if ( ! xOwner.is ()) - return; - - if (xOwner != aEvent.Source) - return; - - if ( - (xNumbers.is () ) && - (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER) - ) - xNumbers->releaseNumber (nLeasedNumber); - - // SYNCHRONIZED -> - aLock.reset (); - - m_sTitle = ::rtl::OUString (); - m_nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER; - - aLock.clear (); - // <- SYNCHRONIZED - - impl_sendTitleChangedEvent (); -} - -//----------------------------------------------- -void TitleHelper::impl_sendTitleChangedEvent () -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::frame::TitleChangedEvent aEvent(m_xOwner.get (), m_sTitle); - - aLock.clear (); - // <- SYNCHRONIZED - - ::cppu::OInterfaceContainerHelper* pContainer = m_aListener.getContainer( ::getCppuType( ( const css::uno::Reference< css::frame::XTitleChangeListener >*) NULL ) ); - if ( ! pContainer) - return; - - ::cppu::OInterfaceIteratorHelper pIt( *pContainer ); - while ( pIt.hasMoreElements() ) - { - try - { - ((css::frame::XTitleChangeListener*)pIt.next())->titleChanged( aEvent ); - } - catch(const css::uno::Exception&) - { - pIt.remove(); - } - } -} - -//----------------------------------------------- -void TitleHelper::impl_updateTitle () -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::uno::Reference< css::frame::XModel > xModel (m_xOwner.get(), css::uno::UNO_QUERY); - css::uno::Reference< css::frame::XController > xController(m_xOwner.get(), css::uno::UNO_QUERY); - css::uno::Reference< css::frame::XFrame > xFrame (m_xOwner.get(), css::uno::UNO_QUERY); - - aLock.clear (); - // <- SYNCHRONIZED - - if (xModel.is ()) - { - impl_updateTitleForModel (xModel); - return; - } - - if (xController.is ()) - { - impl_updateTitleForController (xController); - return; - } - - if (xFrame.is ()) - { - impl_updateTitleForFrame (xFrame); - return; - } -} - -//----------------------------------------------- -void TitleHelper::impl_updateTitleForModel (const css::uno::Reference< css::frame::XModel >& xModel) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - // external title wont be updated internaly ! - // It has to be set from outside new. - if (m_bExternalTitle) - return; - - css::uno::Reference< css::uno::XInterface > xOwner (m_xOwner.get() , css::uno::UNO_QUERY); - css::uno::Reference< css::frame::XUntitledNumbers > xNumbers (m_xUntitledNumbers.get(), css::uno::UNO_QUERY); - ::sal_Int32 nLeasedNumber = m_nLeasedNumber; - - aLock.clear (); - // <- SYNCHRONIZED - - if ( - ( ! xOwner.is ()) || - ( ! xNumbers.is ()) || - ( ! xModel.is ()) - ) - return; - - ::rtl::OUString sTitle; - ::rtl::OUString sURL ; - - css::uno::Reference< css::frame::XStorable > xURLProvider(xModel , css::uno::UNO_QUERY); - if (xURLProvider.is()) - sURL = xURLProvider->getLocation (); - - if (sURL.getLength () > 0) - { - sTitle = impl_convertURL2Title(sURL); - if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER) - xNumbers->releaseNumber (nLeasedNumber); - nLeasedNumber = css::frame::UntitledNumbersConst::INVALID_NUMBER; - } - else - { - if (nLeasedNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER) - nLeasedNumber = xNumbers->leaseNumber (xOwner); - - ::rtl::OUStringBuffer sNewTitle(256); - sNewTitle.append (xNumbers->getUntitledPrefix ()); - if (nLeasedNumber != css::frame::UntitledNumbersConst::INVALID_NUMBER) - sNewTitle.append ((::sal_Int32)nLeasedNumber); - else - sNewTitle.appendAscii ("?"); - - sTitle = sNewTitle.makeStringAndClear (); - } - - // SYNCHRONIZED -> - aLock.reset (); - - // WORKAROUND: the notification is currently sent always, - // can be changed after shared mode is supported per UNO API - sal_Bool bChanged = sal_True; // (! m_sTitle.equals(sTitle)); - - m_sTitle = sTitle; - m_nLeasedNumber = nLeasedNumber; - - aLock.clear (); - // <- SYNCHRONIZED - - if (bChanged) - impl_sendTitleChangedEvent (); -} - -//----------------------------------------------- -void TitleHelper::impl_updateTitleForController (const css::uno::Reference< css::frame::XController >& xController) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - // external title wont be updated internaly ! - // It has to be set from outside new. - if (m_bExternalTitle) - return; - - css::uno::Reference< css::uno::XInterface > xOwner (m_xOwner.get() , css::uno::UNO_QUERY); - css::uno::Reference< css::frame::XUntitledNumbers > xNumbers (m_xUntitledNumbers.get(), css::uno::UNO_QUERY); - ::sal_Int32 nLeasedNumber = m_nLeasedNumber; - - aLock.clear (); - // <- SYNCHRONIZED - - if ( - ( ! xOwner.is ()) || - ( ! xNumbers.is ()) || - ( ! xController.is ()) - ) - return; - - ::rtl::OUStringBuffer sTitle(256); - - if (nLeasedNumber == css::frame::UntitledNumbersConst::INVALID_NUMBER) - nLeasedNumber = xNumbers->leaseNumber (xOwner); - - css::uno::Reference< css::frame::XTitle > xModelTitle(xController->getModel (), css::uno::UNO_QUERY); - if (!xModelTitle.is ()) - xModelTitle.set(xController, css::uno::UNO_QUERY); - if (xModelTitle.is ()) - { - sTitle.append (xModelTitle->getTitle ()); - if ( nLeasedNumber > 1 ) - { - sTitle.appendAscii (" : "); - sTitle.append ((::sal_Int32)nLeasedNumber); - } - } - else - { - sTitle.append (xNumbers->getUntitledPrefix ()); - if ( nLeasedNumber > 1 ) - { - sTitle.append ((::sal_Int32)nLeasedNumber ); - } - } - - // SYNCHRONIZED -> - aLock.reset (); - - ::rtl::OUString sNewTitle = sTitle.makeStringAndClear (); - sal_Bool bChanged = (! m_sTitle.equals(sNewTitle)); - m_sTitle = sNewTitle; - m_nLeasedNumber = nLeasedNumber; - - aLock.clear (); - // <- SYNCHRONIZED - - if (bChanged) - impl_sendTitleChangedEvent (); -} - -//----------------------------------------------- -void TitleHelper::impl_updateTitleForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame) -{ - if ( ! xFrame.is ()) - return; - - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - // external title wont be updated internaly ! - // It has to be set from outside new. - if (m_bExternalTitle) - return; - - aLock.clear (); - // <- SYNCHRONIZED - - css::uno::Reference< css::uno::XInterface > xComponent; - xComponent = xFrame->getController (); - if ( ! xComponent.is ()) - xComponent = xFrame->getComponentWindow (); - - ::rtl::OUStringBuffer sTitle (256); - - impl_appendComponentTitle (sTitle, xComponent); - impl_appendProductName (sTitle); - impl_appendModuleName (sTitle); - impl_appendProductExtension (sTitle); - //impl_appendEvalVersion (sTitle); - impl_appendDebugVersion (sTitle); - - // SYNCHRONIZED -> - aLock.reset (); - - ::rtl::OUString sNewTitle = sTitle.makeStringAndClear (); - sal_Bool bChanged = (! m_sTitle.equals(sNewTitle)); - m_sTitle = sNewTitle; - - aLock.clear (); - // <- SYNCHRONIZED - - if (bChanged) - impl_sendTitleChangedEvent (); -} - -//***************************************************************************************************************** -void TitleHelper::impl_appendComponentTitle ( ::rtl::OUStringBuffer& sTitle , - const css::uno::Reference< css::uno::XInterface >& xComponent) -{ - css::uno::Reference< css::frame::XTitle > xTitle(xComponent, css::uno::UNO_QUERY); - - // Note: Title has to be used (even if it's empty) if the right interface is supported. - if (xTitle.is ()) - sTitle.append (xTitle->getTitle ()); -} - -//***************************************************************************************************************** -void TitleHelper::impl_appendProductName (::rtl::OUStringBuffer& sTitle) -{ - ::rtl::OUString sProductName; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTNAME) >>= sProductName; - - if (sProductName.getLength ()) - { - if (sTitle.getLength() > 0) - sTitle.appendAscii (" - "); - - sTitle.append (sProductName); - } -} - -//***************************************************************************************************************** -void TitleHelper::impl_appendProductExtension (::rtl::OUStringBuffer& sTitle) -{ - ::rtl::OUString sProductExtension; - ::utl::ConfigManager::GetDirectConfigProperty(::utl::ConfigManager::PRODUCTEXTENSION) >>= sProductExtension; - - if (sProductExtension.getLength ()) - { - sTitle.appendAscii (" "); - sTitle.append (sProductExtension); - } -} - -//***************************************************************************************************************** -void TitleHelper::impl_appendModuleName (::rtl::OUStringBuffer& sTitle) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::uno::Reference< css::uno::XInterface > xOwner = m_xOwner.get(); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; - - aLock.clear (); - // <- SYNCHRONIZED - - try - { - css::uno::Reference< css::frame::XModuleManager > xModuleManager( - xSMGR->createInstance(SERVICENAME_MODULEMANAGER), - css::uno::UNO_QUERY_THROW); - - css::uno::Reference< css::container::XNameAccess > xConfig( - xModuleManager, - css::uno::UNO_QUERY_THROW); - - const ::rtl::OUString sID = xModuleManager->identify(xOwner); - ::comphelper::SequenceAsHashMap lProps = xConfig->getByName (sID); - const ::rtl::OUString sUIName = lProps.getUnpackedValueOrDefault (OFFICEFACTORY_PROPNAME_UINAME, ::rtl::OUString()); - - // An UIname property is an optional value ! - // So please add it to the title in case it does realy exists only. - if (sUIName.getLength() > 0) - { - sTitle.appendAscii (" " ); - sTitle.append (sUIName); - } - } - catch(const css::uno::Exception&) - {} -} - -//***************************************************************************************************************** -#ifdef DBG_UTIL -void TitleHelper::impl_appendDebugVersion (::rtl::OUStringBuffer& sTitle) -{ - ::rtl::OUString sDefault ; - ::rtl::OUString sVersion = ::utl::Bootstrap::getBuildIdData( sDefault ); - - sTitle.appendAscii (" [" ); - sTitle.append (sVersion); - sTitle.appendAscii ("]" ); -} -#else -void TitleHelper::impl_appendDebugVersion (::rtl::OUStringBuffer&) -{ -} -#endif - -//***************************************************************************************************************** -void TitleHelper::impl_appendEvalVersion (::rtl::OUStringBuffer& /*sTitle*/) -{ - // SYNCHRONIZED -> - // ::osl::ResettableMutexGuard aLock(m_aMutex); - // css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR ; - //aLock.clear (); - //// <- SYNCHRONIZED - - //css::uno::Reference< css::beans::XMaterialHolder > xHolder( - // xSMGR->createInstance(SERVICENAME_TABREG), - // css::uno::UNO_QUERY); - - // if ( ! xHolder.is()) - // return; - - // ::comphelper::SequenceAsHashMap aMaterial(xHolder->getMaterial()); - //const ::rtl::OUString sEvalTitle = aMaterial.getUnpackedValueOrDefault(TABREG_PROPNAME_TITLE, ::rtl::OUString()); - - //if (sEvalTitle.getLength()) - //{ - // sTitle.appendAscii (" " ); - // sTitle.append (sEvalTitle); - //} -} - -//----------------------------------------------- -void TitleHelper::impl_startListeningForModel (const css::uno::Reference< css::frame::XModel >& xModel) -{ - css::uno::Reference< css::document::XEventBroadcaster > xBroadcaster(xModel, css::uno::UNO_QUERY); - if ( ! xBroadcaster.is ()) - return; - - xBroadcaster->addEventListener (static_cast< css::document::XEventListener* >(this)); -} - -//----------------------------------------------- -void TitleHelper::impl_startListeningForController (const css::uno::Reference< css::frame::XController >& xController) -{ - css::uno::Reference< css::frame::XTitle > xSubTitle(xController->getModel (), css::uno::UNO_QUERY); - impl_setSubTitle (xSubTitle); -} - -//----------------------------------------------- -void TitleHelper::impl_startListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame) -{ - xFrame->addFrameActionListener(this ); - impl_updateListeningForFrame (xFrame); -} - -//----------------------------------------------- -void TitleHelper::impl_updateListeningForFrame (const css::uno::Reference< css::frame::XFrame >& xFrame) -{ - css::uno::Reference< css::frame::XTitle > xSubTitle(xFrame->getController (), css::uno::UNO_QUERY); - impl_setSubTitle (xSubTitle); -} - -//----------------------------------------------- -void TitleHelper::impl_setSubTitle (const css::uno::Reference< css::frame::XTitle >& xSubTitle) -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - // ignore duplicate calls. Makes outside using of this helper more easy :-) - css::uno::Reference< css::frame::XTitle > xOldSubTitle(m_xSubTitle.get(), css::uno::UNO_QUERY); - if (xOldSubTitle == xSubTitle) - return; - - m_xSubTitle = xSubTitle; - - aLock.clear (); - // <- SYNCHRONIZED - - css::uno::Reference< css::frame::XTitleChangeBroadcaster > xOldBroadcaster(xOldSubTitle , css::uno::UNO_QUERY ); - css::uno::Reference< css::frame::XTitleChangeBroadcaster > xNewBroadcaster(xSubTitle , css::uno::UNO_QUERY ); - css::uno::Reference< css::frame::XTitleChangeListener > xThis (static_cast< css::frame::XTitleChangeListener* >(this), css::uno::UNO_QUERY_THROW); - - if (xOldBroadcaster.is()) - xOldBroadcaster->removeTitleChangeListener (xThis); - - if (xNewBroadcaster.is()) - xNewBroadcaster->addTitleChangeListener (xThis); -} - -//----------------------------------------------- -::rtl::OUString TitleHelper::impl_getSubTitle () -{ - // SYNCHRONIZED -> - ::osl::ResettableMutexGuard aLock(m_aMutex); - - css::uno::Reference< css::frame::XTitle > xSubTitle(m_xSubTitle.get (), css::uno::UNO_QUERY); - - aLock.clear (); - // <- SYNCHRONIZED - - if (xSubTitle.is ()) - return xSubTitle->getTitle (); - - return ::rtl::OUString (); -} - -//----------------------------------------------- -::rtl::OUString TitleHelper::impl_convertURL2Title(const ::rtl::OUString& sURL) -{ - INetURLObject aURL (sURL); - ::rtl::OUString sTitle; - - if (aURL.GetProtocol() == INET_PROT_FILE) - { - if (aURL.HasMark()) - aURL = INetURLObject(aURL.GetURLNoMark()); - - sTitle = aURL.getName(INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::DECODE_WITH_CHARSET); - } - else - { - if (aURL.hasExtension(INetURLObject::LAST_SEGMENT)) - sTitle = aURL.getName(INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::DECODE_WITH_CHARSET); - - if ( ! sTitle.getLength() ) - sTitle = aURL.GetHostPort(INetURLObject::DECODE_WITH_CHARSET); - - if ( ! sTitle.getLength() ) - sTitle = aURL.GetURLNoPass(INetURLObject::DECODE_WITH_CHARSET); - } - - return sTitle; -} - -} // namespace framework diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx deleted file mode 100644 index 7c1a8c905588..000000000000 --- a/framework/source/helper/uiconfigelementwrapperbase.cxx +++ /dev/null @@ -1,571 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <helper/uiconfigelementwrapperbase.hxx> -#include <general.h> -#include <properties.h> -#include <threadhelp/resetableguard.hxx> -#include <uielement/constitemcontainer.hxx> -#include <uielement/rootitemcontainer.hxx> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/ui/XUIConfiguration.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ -#include <vcl/svapp.hxx> -#include <rtl/logfile.hxx> - -const int UIELEMENT_PROPHANDLE_CONFIGSOURCE = 1; -const int UIELEMENT_PROPHANDLE_FRAME = 2; -const int UIELEMENT_PROPHANDLE_PERSISTENT = 3; -const int UIELEMENT_PROPHANDLE_RESOURCEURL = 4; -const int UIELEMENT_PROPHANDLE_TYPE = 5; -const int UIELEMENT_PROPHANDLE_XMENUBAR = 6; -const int UIELEMENT_PROPHANDLE_CONFIGLISTENER = 7; -const int UIELEMENT_PROPHANDLE_NOCLOSE = 8; -const int UIELEMENT_PROPCOUNT = 8; -const rtl::OUString UIELEMENT_PROPNAME_CONFIGLISTENER( RTL_CONSTASCII_USTRINGPARAM( "ConfigListener" )); -const rtl::OUString UIELEMENT_PROPNAME_CONFIGSOURCE( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); -const rtl::OUString UIELEMENT_PROPNAME_FRAME( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); -const rtl::OUString UIELEMENT_PROPNAME_PERSISTENT( RTL_CONSTASCII_USTRINGPARAM( "Persistent" )); -const rtl::OUString UIELEMENT_PROPNAME_RESOURCEURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )); -const rtl::OUString UIELEMENT_PROPNAME_TYPE( RTL_CONSTASCII_USTRINGPARAM( "Type" )); -const rtl::OUString UIELEMENT_PROPNAME_XMENUBAR( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" )); -const rtl::OUString UIELEMENT_PROPNAME_NOCLOSE( RTL_CONSTASCII_USTRINGPARAM( "NoClose" )); - -using namespace rtl; -using namespace com::sun::star::beans; -using namespace com::sun::star::uno; -using namespace com::sun::star::frame; -using namespace com::sun::star::lang; -using namespace com::sun::star::container; -using namespace ::com::sun::star::ui; - -namespace framework -{ - -//***************************************************************************************************************** -// XInterface, XTypeProvider -//***************************************************************************************************************** -DEFINE_XINTERFACE_10 ( UIConfigElementWrapperBase , - OWeakObject , - DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIElement ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIElementSettings ), - DIRECT_INTERFACE( ::com::sun::star::beans::XMultiPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::lang::XInitialization ), - DIRECT_INTERFACE( ::com::sun::star::lang::XComponent ), - DIRECT_INTERFACE( ::com::sun::star::util::XUpdatable ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIConfigurationListener ) - ) - -DEFINE_XTYPEPROVIDER_10 ( UIConfigElementWrapperBase , - ::com::sun::star::lang::XTypeProvider , - ::com::sun::star::ui::XUIElement , - ::com::sun::star::ui::XUIElementSettings , - ::com::sun::star::beans::XMultiPropertySet , - ::com::sun::star::beans::XFastPropertySet , - ::com::sun::star::beans::XPropertySet , - ::com::sun::star::lang::XInitialization , - ::com::sun::star::lang::XComponent , - ::com::sun::star::util::XUpdatable , - ::com::sun::star::ui::XUIConfigurationListener - ) - -UIConfigElementWrapperBase::UIConfigElementWrapperBase( sal_Int16 nType,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _xServiceFactory ) - : ThreadHelpBase ( &Application::GetSolarMutex() ) - , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ) - , ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) - , ::cppu::OWeakObject ( ) - , m_nType ( nType ) - , m_bPersistent ( sal_True ) - , m_bInitialized ( sal_False ) - , m_bConfigListener ( sal_False ) - , m_bConfigListening ( sal_False ) - , m_bDisposed ( sal_False ) - , m_bNoClose ( sal_False ) - , m_xServiceFactory ( _xServiceFactory ) - , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) -{ -} - -UIConfigElementWrapperBase::~UIConfigElementWrapperBase() -{ -} - -// XComponent -void SAL_CALL UIConfigElementWrapperBase::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - // must be implemented by derived class - ResetableGuard aLock( m_aLock ); - m_bDisposed = sal_True; -} - -void SAL_CALL UIConfigElementWrapperBase::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener ); -} - -void SAL_CALL UIConfigElementWrapperBase::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), aListener ); -} - -// XEventListener -void SAL_CALL UIConfigElementWrapperBase::disposing( const EventObject& ) -throw( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - m_xConfigSource.clear(); -} - -void SAL_CALL UIConfigElementWrapperBase::initialize( const Sequence< Any >& aArguments ) -throw ( Exception, RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - if ( !m_bInitialized ) - { - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) - { - PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) - { - if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_CONFIGSOURCE )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGSOURCE, aPropValue.Value ); - else if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_FRAME )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_FRAME, aPropValue.Value ); - else if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_PERSISTENT )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_PERSISTENT, aPropValue.Value ); - else if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_RESOURCEURL )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_RESOURCEURL, aPropValue.Value ); - else if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_TYPE )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_TYPE, aPropValue.Value ); - else if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_CONFIGLISTENER )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_CONFIGLISTENER, aPropValue.Value ); - else if ( aPropValue.Name.equals( UIELEMENT_PROPNAME_NOCLOSE )) - setFastPropertyValue_NoBroadcast( UIELEMENT_PROPHANDLE_NOCLOSE, aPropValue.Value ); - } - } - - m_bInitialized = sal_True; - } -} - -// XUpdatable -void SAL_CALL UIConfigElementWrapperBase::update() throw (::com::sun::star::uno::RuntimeException) -{ - // can be implemented by derived class -} - -void SAL_CALL UIConfigElementWrapperBase::elementInserted( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException) -{ - // can be implemented by derived class -} - -void SAL_CALL UIConfigElementWrapperBase::elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException) -{ - // can be implemented by derived class -} - -void SAL_CALL UIConfigElementWrapperBase::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& ) throw (::com::sun::star::uno::RuntimeException) -{ - // can be implemented by derived class -} - -// XPropertySet helper -sal_Bool SAL_CALL UIConfigElementWrapperBase::convertFastPropertyValue( Any& aConvertedValue , - Any& aOldValue , - sal_Int32 nHandle , - const Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) -{ - // Initialize state with sal_False !!! - // (Handle can be invalid) - sal_Bool bReturn = sal_False; - - switch( nHandle ) - { - case UIELEMENT_PROPHANDLE_CONFIGLISTENER: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bConfigListener), - aValue, - aOldValue, - aConvertedValue); - break; - - case UIELEMENT_PROPHANDLE_CONFIGSOURCE: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_xConfigSource), - aValue, - aOldValue, - aConvertedValue); - break; - - case UIELEMENT_PROPHANDLE_FRAME: - { - Reference< XFrame > xFrame( m_xWeakFrame ); - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(xFrame), - aValue, - aOldValue, - aConvertedValue); - } - break; - - case UIELEMENT_PROPHANDLE_PERSISTENT: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bPersistent), - aValue, - aOldValue, - aConvertedValue); - break; - - case UIELEMENT_PROPHANDLE_RESOURCEURL: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_aResourceURL), - aValue, - aOldValue, - aConvertedValue); - break; - - case UIELEMENT_PROPHANDLE_TYPE : - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_nType), - aValue, - aOldValue, - aConvertedValue); - break; - - case UIELEMENT_PROPHANDLE_XMENUBAR : - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_xMenuBar), - aValue, - aOldValue, - aConvertedValue); - break; - - case UIELEMENT_PROPHANDLE_NOCLOSE: - bReturn = PropHelper::willPropertyBeChanged( - com::sun::star::uno::makeAny(m_bNoClose), - aValue, - aOldValue, - aConvertedValue); - break; - } - - // Return state of operation. - return bReturn ; -} - -void SAL_CALL UIConfigElementWrapperBase::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , - const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ) -{ - switch( nHandle ) - { - case UIELEMENT_PROPHANDLE_CONFIGLISTENER: - { - bool bBool( m_bConfigListener ); - aValue >>= bBool; - if ( m_bConfigListener != bBool ) - { - if ( m_bConfigListening ) - { - if ( m_xConfigSource.is() && !bBool ) - { - try - { - Reference< XUIConfiguration > xUIConfig( m_xConfigSource, UNO_QUERY ); - if ( xUIConfig.is() ) - { - xUIConfig->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); - m_bConfigListening = sal_False; - } - } - catch ( Exception& ) - { - } - } - } - else - { - if ( m_xConfigSource.is() && bBool ) - { - try - { - Reference< XUIConfiguration > xUIConfig( m_xConfigSource, UNO_QUERY ); - if ( xUIConfig.is() ) - { - xUIConfig->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); - m_bConfigListening = sal_True; - } - } - catch ( Exception& ) - { - } - } - } - - m_bConfigListener = bBool; - } - } - break; - case UIELEMENT_PROPHANDLE_CONFIGSOURCE: - aValue >>= m_xConfigSource; - break; - case UIELEMENT_PROPHANDLE_FRAME: - { - Reference< XFrame > xFrame; - - aValue >>= xFrame; - m_xWeakFrame = xFrame; - break; - } - case UIELEMENT_PROPHANDLE_PERSISTENT: - { - sal_Bool bBool( m_bPersistent ); - aValue >>= bBool; - m_bPersistent = bBool; - break; - } - case UIELEMENT_PROPHANDLE_RESOURCEURL: - aValue >>= m_aResourceURL; - break; - case UIELEMENT_PROPHANDLE_TYPE: - aValue >>= m_nType; - break; - case UIELEMENT_PROPHANDLE_XMENUBAR: - aValue >>= m_xMenuBar; - break; - case UIELEMENT_PROPHANDLE_NOCLOSE: - { - sal_Bool bBool( m_bNoClose ); - aValue >>= bBool; - m_bNoClose = bBool; - break; - } - } -} - -void SAL_CALL UIConfigElementWrapperBase::getFastPropertyValue( com::sun::star::uno::Any& aValue , - sal_Int32 nHandle ) const -{ - switch( nHandle ) - { - case UIELEMENT_PROPHANDLE_CONFIGLISTENER: - aValue <<= m_bConfigListener; - break; - case UIELEMENT_PROPHANDLE_CONFIGSOURCE: - aValue <<= m_xConfigSource; - break; - case UIELEMENT_PROPHANDLE_FRAME: - { - Reference< XFrame > xFrame( m_xWeakFrame ); - aValue <<= xFrame; - break; - } - case UIELEMENT_PROPHANDLE_PERSISTENT: - aValue <<= m_bPersistent; - break; - case UIELEMENT_PROPHANDLE_RESOURCEURL: - aValue <<= m_aResourceURL; - break; - case UIELEMENT_PROPHANDLE_TYPE: - aValue <<= m_nType; - break; - case UIELEMENT_PROPHANDLE_XMENUBAR: - aValue <<= m_xMenuBar; - break; - case UIELEMENT_PROPHANDLE_NOCLOSE: - aValue <<= m_bNoClose; - break; - } -} - -::cppu::IPropertyArrayHelper& SAL_CALL UIConfigElementWrapperBase::getInfoHelper() -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL! - static ::cppu::OPropertyArrayHelper* pInfoHelper = NULL; - - if( pInfoHelper == NULL ) - { - // Ready for multithreading - osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; - - // Control this pointer again, another instance can be faster then these! - if( pInfoHelper == NULL ) - { - // Define static member to give structure of properties to baseclass "OPropertySetHelper". - // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable. - // "sal_True" say: Table is sorted by name. - static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True ); - pInfoHelper = &aInfoHelper; - } - } - - return(*pInfoHelper); -} - -com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL UIConfigElementWrapperBase::getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pInfo is NULL - for the second call pInfo is different from NULL! - static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >* pInfo = NULL; - - if( pInfo == NULL ) - { - // Ready for multithreading - osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; - // Control this pointer again, another instance can be faster then these! - if( pInfo == NULL ) - { - // Create structure of propertysetinfo for baseclass "OPropertySetHelper". - // (Use method "getInfoHelper()".) - static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - pInfo = &xInfo; - } - } - - return (*pInfo); -} - -const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIConfigElementWrapperBase::impl_getStaticPropertyDescriptor() -{ - // Create a new static property array to initialize sequence! - // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! - // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! - // It's necessary for methods of OPropertySetHelper. - // ATTENTION: - // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - - static const com::sun::star::beans::Property pProperties[] = - { - com::sun::star::beans::Property( UIELEMENT_PROPNAME_CONFIGLISTENER, UIELEMENT_PROPHANDLE_CONFIGLISTENER , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_CONFIGSOURCE , UIELEMENT_PROPHANDLE_CONFIGSOURCE , ::getCppuType((const Reference< ::com::sun::star::ui::XUIConfigurationManager >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_FRAME , UIELEMENT_PROPHANDLE_FRAME , ::getCppuType((const Reference< com::sun::star::frame::XFrame >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_NOCLOSE , UIELEMENT_PROPHANDLE_NOCLOSE , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_PERSISTENT , UIELEMENT_PROPHANDLE_PERSISTENT , ::getCppuType((const sal_Bool*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_RESOURCEURL , UIELEMENT_PROPHANDLE_RESOURCEURL , ::getCppuType((const ::rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_TYPE , UIELEMENT_PROPHANDLE_TYPE , ::getCppuType((const ::rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_XMENUBAR , UIELEMENT_PROPHANDLE_XMENUBAR , ::getCppuType((const Reference< com::sun::star::awt::XMenuBar >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ) - }; - // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT ); - // Return static "PropertyDescriptor" - return lPropertyDescriptor; -} -void SAL_CALL UIConfigElementWrapperBase::setSettings( const Reference< XIndexAccess >& xSettings ) throw ( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - //if ( m_bDisposed ) - // throw DisposedException(); - - if ( xSettings.is() ) - { - // Create a copy of the data if the container is not const - Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY ); - if ( xReplace.is() ) - m_xConfigData = Reference< XIndexAccess >( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY ); - else - m_xConfigData = xSettings; - - if ( m_xConfigSource.is() && m_bPersistent ) - { - ::rtl::OUString aResourceURL( m_aResourceURL ); - Reference< XUIConfigurationManager > xUICfgMgr( m_xConfigSource ); - - aLock.unlock(); - - try - { - xUICfgMgr->replaceSettings( aResourceURL, m_xConfigData ); - } - catch( NoSuchElementException& ) - { - } - } - else if ( !m_bPersistent ) - { - // Transient menubar => Fill menubar with new data - impl_fillNewData(); - } - } -} -void UIConfigElementWrapperBase::impl_fillNewData() -{ -} -Reference< XIndexAccess > SAL_CALL UIConfigElementWrapperBase::getSettings( sal_Bool bWriteable ) throw ( RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - //if ( m_bDisposed ) - // throw DisposedException(); - - if ( bWriteable ) - return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY ); - - return m_xConfigData; -} - -Reference< XFrame > SAL_CALL UIConfigElementWrapperBase::getFrame() throw (RuntimeException) -{ - ResetableGuard aLock( m_aLock ); - Reference< XFrame > xFrame( m_xWeakFrame ); - return xFrame; -} - -::rtl::OUString SAL_CALL UIConfigElementWrapperBase::getResourceURL() throw (RuntimeException) -{ - ResetableGuard aLock( m_aLock ); - return m_aResourceURL; -} - -::sal_Int16 SAL_CALL UIConfigElementWrapperBase::getType() throw (RuntimeException) -{ - ResetableGuard aLock( m_aLock ); - return m_nType; -} - -} diff --git a/framework/source/helper/uielementwrapperbase.cxx b/framework/source/helper/uielementwrapperbase.cxx deleted file mode 100644 index ef5d01eb85b8..000000000000 --- a/framework/source/helper/uielementwrapperbase.cxx +++ /dev/null @@ -1,282 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_framework.hxx" - -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ -#include <helper/uielementwrapperbase.hxx> -#include <general.h> -#include <properties.h> -#include <threadhelp/resetableguard.hxx> - -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ -#include <com/sun/star/beans/PropertyAttribute.hpp> -#include <com/sun/star/beans/PropertyValue.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> - -//_________________________________________________________________________________________________________________ -// includes of other projects -//_________________________________________________________________________________________________________________ -#include <vcl/svapp.hxx> -#include <rtl/logfile.hxx> - -const int UIELEMENT_PROPHANDLE_RESOURCEURL = 1; -const int UIELEMENT_PROPHANDLE_TYPE = 2; -const int UIELEMENT_PROPHANDLE_FRAME = 3; -const int UIELEMENT_PROPCOUNT = 3; -const rtl::OUString UIELEMENT_PROPNAME_RESOURCEURL( RTL_CONSTASCII_USTRINGPARAM( "ResourceURL" )); -const rtl::OUString UIELEMENT_PROPNAME_TYPE( RTL_CONSTASCII_USTRINGPARAM( "Type" )); -const rtl::OUString UIELEMENT_PROPNAME_FRAME( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - -using namespace rtl; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::frame; - -namespace framework -{ - -//***************************************************************************************************************** -// XInterface, XTypeProvider -//***************************************************************************************************************** -DEFINE_XINTERFACE_8 ( UIElementWrapperBase , - OWeakObject , - DIRECT_INTERFACE( ::com::sun::star::lang::XTypeProvider ), - DIRECT_INTERFACE( ::com::sun::star::ui::XUIElement ), - DIRECT_INTERFACE( ::com::sun::star::beans::XMultiPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XFastPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::beans::XPropertySet ), - DIRECT_INTERFACE( ::com::sun::star::lang::XInitialization ), - DIRECT_INTERFACE( ::com::sun::star::util::XUpdatable ), - DIRECT_INTERFACE( ::com::sun::star::lang::XComponent ) - ) - -DEFINE_XTYPEPROVIDER_8 ( UIElementWrapperBase , - ::com::sun::star::lang::XTypeProvider , - ::com::sun::star::ui::XUIElement , - ::com::sun::star::beans::XMultiPropertySet , - ::com::sun::star::beans::XFastPropertySet , - ::com::sun::star::beans::XPropertySet , - ::com::sun::star::lang::XInitialization , - ::com::sun::star::util::XUpdatable , - ::com::sun::star::lang::XComponent - ) - -UIElementWrapperBase::UIElementWrapperBase( sal_Int16 nType ) - : ThreadHelpBase ( &Application::GetSolarMutex() ) - , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ) - , ::cppu::OPropertySetHelper ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) - , ::cppu::OWeakObject ( ) - , m_aListenerContainer ( m_aLock.getShareableOslMutex() ) - , m_nType ( nType ) - , m_bInitialized ( sal_False ) - , m_bDisposed ( sal_False ) -{ -} - -UIElementWrapperBase::~UIElementWrapperBase() -{ -} - -void SAL_CALL UIElementWrapperBase::dispose() throw (::com::sun::star::uno::RuntimeException) -{ - // must be implemented by derived class - ResetableGuard aLock( m_aLock ); - m_bDisposed = sal_True; -} - -void SAL_CALL UIElementWrapperBase::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.addInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener ); -} - -void SAL_CALL UIElementWrapperBase::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException) -{ - m_aListenerContainer.removeInterface( ::getCppuType( ( const css::uno::Reference< css::lang::XEventListener >* ) NULL ), xListener ); -} - -void SAL_CALL UIElementWrapperBase::initialize( const Sequence< Any >& aArguments ) -throw ( Exception, RuntimeException ) -{ - ResetableGuard aLock( m_aLock ); - - if ( !m_bInitialized ) - { - for ( sal_Int32 n = 0; n < aArguments.getLength(); n++ ) - { - PropertyValue aPropValue; - if ( aArguments[n] >>= aPropValue ) - { - if ( aPropValue.Name.equalsAscii( "ResourceURL" )) - aPropValue.Value >>= m_aResourceURL; - else if ( aPropValue.Name.equalsAscii( "Frame" )) - { - Reference< XFrame > xFrame; - aPropValue.Value >>= xFrame; - m_xWeakFrame = xFrame; - } - } - } - - m_bInitialized = sal_True; - } -} - -// XUIElement -::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > SAL_CALL UIElementWrapperBase::getFrame() throw (::com::sun::star::uno::RuntimeException) -{ - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > xFrame( m_xWeakFrame ); - return xFrame; -} - -::rtl::OUString SAL_CALL UIElementWrapperBase::getResourceURL() throw (::com::sun::star::uno::RuntimeException) -{ - return m_aResourceURL; -} - -::sal_Int16 SAL_CALL UIElementWrapperBase::getType() throw (::com::sun::star::uno::RuntimeException) -{ - return m_nType; -} - -// XUpdatable -void SAL_CALL UIElementWrapperBase::update() throw (::com::sun::star::uno::RuntimeException) -{ - // can be implemented by derived class -} - -// XPropertySet helper -sal_Bool SAL_CALL UIElementWrapperBase::convertFastPropertyValue( Any& /*aConvertedValue*/ , - Any& /*aOldValue*/ , - sal_Int32 /*nHandle*/ , - const Any& /*aValue*/ ) throw( com::sun::star::lang::IllegalArgumentException ) -{ - // Initialize state with sal_False !!! - // (Handle can be invalid) - return sal_False ; -} - -void SAL_CALL UIElementWrapperBase::setFastPropertyValue_NoBroadcast( sal_Int32 /*nHandle*/ , - const com::sun::star::uno::Any& /*aValue*/ ) throw( com::sun::star::uno::Exception ) -{ -} - -void SAL_CALL UIElementWrapperBase::getFastPropertyValue( com::sun::star::uno::Any& aValue , - sal_Int32 nHandle ) const -{ - switch( nHandle ) - { - case UIELEMENT_PROPHANDLE_RESOURCEURL: - aValue <<= m_aResourceURL; - break; - case UIELEMENT_PROPHANDLE_TYPE: - aValue <<= m_nType; - break; - case UIELEMENT_PROPHANDLE_FRAME: - Reference< XFrame > xFrame( m_xWeakFrame ); - aValue <<= xFrame; - break; - } -} - -::cppu::IPropertyArrayHelper& SAL_CALL UIElementWrapperBase::getInfoHelper() -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pInfoHelper is NULL - for the second call pInfoHelper is different from NULL! - static ::cppu::OPropertyArrayHelper* pInfoHelper = NULL; - - if( pInfoHelper == NULL ) - { - // Ready for multithreading - osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; - - // Control this pointer again, another instance can be faster then these! - if( pInfoHelper == NULL ) - { - // Define static member to give structure of properties to baseclass "OPropertySetHelper". - // "impl_getStaticPropertyDescriptor" is a non exported and static funtion, who will define a static propertytable. - // "sal_True" say: Table is sorted by name. - static ::cppu::OPropertyArrayHelper aInfoHelper( impl_getStaticPropertyDescriptor(), sal_True ); - pInfoHelper = &aInfoHelper; - } - } - - return(*pInfoHelper); -} - -com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL UIElementWrapperBase::getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException) -{ - // Optimize this method ! - // We initialize a static variable only one time. And we don't must use a mutex at every call! - // For the first call; pInfo is NULL - for the second call pInfo is different from NULL! - static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo >* pInfo = NULL; - - if( pInfo == NULL ) - { - // Ready for multithreading - osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; - // Control this pointer again, another instance can be faster then these! - if( pInfo == NULL ) - { - // Create structure of propertysetinfo for baseclass "OPropertySetHelper". - // (Use method "getInfoHelper()".) - static com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); - pInfo = &xInfo; - } - } - - return (*pInfo); -} - -const com::sun::star::uno::Sequence< com::sun::star::beans::Property > UIElementWrapperBase::impl_getStaticPropertyDescriptor() -{ - // Create a new static property array to initialize sequence! - // Table of all predefined properties of this class. Its used from OPropertySetHelper-class! - // Don't forget to change the defines (see begin of this file), if you add, change or delete a property in this list!!! - // It's necessary for methods of OPropertySetHelper. - // ATTENTION: - // YOU MUST SORT FOLLOW TABLE BY NAME ALPHABETICAL !!! - - static const com::sun::star::beans::Property pProperties[] = - { - com::sun::star::beans::Property( UIELEMENT_PROPNAME_FRAME , UIELEMENT_PROPHANDLE_FRAME , ::getCppuType((Reference< XFrame >*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_RESOURCEURL , UIELEMENT_PROPHANDLE_RESOURCEURL , ::getCppuType((sal_Int16*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ), - com::sun::star::beans::Property( UIELEMENT_PROPNAME_TYPE , UIELEMENT_PROPHANDLE_TYPE , ::getCppuType((const ::rtl::OUString*)NULL), com::sun::star::beans::PropertyAttribute::TRANSIENT | com::sun::star::beans::PropertyAttribute::READONLY ) - }; - // Use it to initialize sequence! - static const com::sun::star::uno::Sequence< com::sun::star::beans::Property > lPropertyDescriptor( pProperties, UIELEMENT_PROPCOUNT ); - // Return static "PropertyDescriptor" - return lPropertyDescriptor; -} - -} |