diff options
164 files changed, 14302 insertions, 11736 deletions
diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index 3ce0d4de865a..ebeedc92839d 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -101,10 +101,12 @@ static bool makeCanonicalFileURL( rtl::OUString & rURL ) OfficeInstallationDirectories::OfficeInstallationDirectories( const uno::Reference< uno::XComponentContext > & xCtx ) -: m_aOfficeDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(baseinsturl)" ) ), +: m_aOfficeBrandDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(brandbaseurl)" ) ), + m_aOfficeBaseDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(baseinsturl)" ) ), m_aUserDirMacro( RTL_CONSTASCII_USTRINGPARAM( "$(userdataurl)" ) ), m_xCtx( xCtx ), - m_pOfficeDir( 0 ), + m_pOfficeBrandDir( 0 ), + m_pOfficeBaseDir( 0 ), m_pUserDir( 0 ) { } @@ -113,6 +115,9 @@ OfficeInstallationDirectories::OfficeInstallationDirectories( // virtual OfficeInstallationDirectories::~OfficeInstallationDirectories() { + delete m_pOfficeBrandDir; + delete m_pOfficeBaseDir; + delete m_pUserDir; } //========================================================================= @@ -124,9 +129,8 @@ rtl::OUString SAL_CALL OfficeInstallationDirectories::getOfficeInstallationDirectoryURL() throw ( uno::RuntimeException ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); - return rtl::OUString( *m_pOfficeDir ); + return rtl::OUString( *m_pOfficeBrandDir ); } //========================================================================= @@ -135,7 +139,6 @@ rtl::OUString SAL_CALL OfficeInstallationDirectories::getOfficeUserDataDirectoryURL() throw ( uno::RuntimeException ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); return rtl::OUString( *m_pUserDir ); } @@ -149,29 +152,39 @@ OfficeInstallationDirectories::makeRelocatableURL( const rtl::OUString& URL ) { if ( URL.getLength() > 0 ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); rtl::OUString aCanonicalURL( URL ); makeCanonicalFileURL( aCanonicalURL ); - sal_Int32 nIndex = aCanonicalURL.indexOf( *m_pOfficeDir ); + sal_Int32 nIndex = aCanonicalURL.indexOf( *m_pOfficeBrandDir ); if ( nIndex != -1 ) { return rtl::OUString( URL.replaceAt( nIndex, - m_pOfficeDir->getLength(), - m_aOfficeDirMacro ) ); + m_pOfficeBrandDir->getLength(), + m_aOfficeBrandDirMacro ) ); } else { - nIndex = aCanonicalURL.indexOf( *m_pUserDir ); + nIndex = aCanonicalURL.indexOf( *m_pOfficeBaseDir ); if ( nIndex != -1 ) { return rtl::OUString( URL.replaceAt( nIndex, - m_pUserDir->getLength(), - m_aUserDirMacro ) ); + m_pOfficeBaseDir->getLength(), + m_aOfficeBaseDirMacro ) ); + } + else + { + nIndex = aCanonicalURL.indexOf( *m_pUserDir ); + if ( nIndex != -1 ) + { + return rtl::OUString( + URL.replaceAt( nIndex, + m_pUserDir->getLength(), + m_aUserDirMacro ) ); + } } } } @@ -186,29 +199,40 @@ OfficeInstallationDirectories::makeAbsoluteURL( const rtl::OUString& URL ) { if ( URL.getLength() > 0 ) { - sal_Int32 nIndex = URL.indexOf( m_aOfficeDirMacro ); + sal_Int32 nIndex = URL.indexOf( m_aOfficeBrandDirMacro ); if ( nIndex != -1 ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); return rtl::OUString( URL.replaceAt( nIndex, - m_aOfficeDirMacro.getLength(), - *m_pOfficeDir ) ); + m_aOfficeBrandDirMacro.getLength(), + *m_pOfficeBrandDir ) ); } else { - nIndex = URL.indexOf( m_aUserDirMacro ); + nIndex = URL.indexOf( m_aOfficeBaseDirMacro ); if ( nIndex != -1 ) { - // late init m_pOfficeDir and m_pUserDir initDirs(); return rtl::OUString( URL.replaceAt( nIndex, - m_aUserDirMacro.getLength(), - *m_pUserDir ) ); + m_aOfficeBaseDirMacro.getLength(), + *m_pOfficeBaseDir ) ); + } + else + { + nIndex = URL.indexOf( m_aUserDirMacro ); + if ( nIndex != -1 ) + { + initDirs(); + + return rtl::OUString( + URL.replaceAt( nIndex, + m_aUserDirMacro.getLength(), + *m_pUserDir ) ); + } } } } @@ -300,13 +324,14 @@ OfficeInstallationDirectories::Create( void OfficeInstallationDirectories::initDirs() { - if ( m_pOfficeDir == 0 ) + if ( m_pOfficeBrandDir == 0 ) { osl::MutexGuard aGuard( m_aMutex ); - if ( m_pOfficeDir == 0 ) + if ( m_pOfficeBrandDir == 0 ) { - m_pOfficeDir = new rtl::OUString; - m_pUserDir = new rtl::OUString; + m_pOfficeBrandDir = new rtl::OUString; + m_pOfficeBaseDir = new rtl::OUString; + m_pUserDir = new rtl::OUString; uno::Reference< util::XMacroExpander > xExpander; @@ -320,15 +345,24 @@ void OfficeInstallationDirectories::initDirs() if ( xExpander.is() ) { - *m_pOfficeDir = + *m_pOfficeBrandDir = + xExpander->expandMacros( + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "$BRAND_BASE_DIR" ) ) ); + + OSL_ENSURE( m_pOfficeBrandDir->getLength() > 0, + "Unable to obtain office brand installation directory!" ); + + makeCanonicalFileURL( *m_pOfficeBrandDir ); + + *m_pOfficeBaseDir = xExpander->expandMacros( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":BaseInstallation}" ) ) ); - OSL_ENSURE( m_pOfficeDir->getLength() > 0, - "Unable to obtain office installation directory!" ); + OSL_ENSURE( m_pOfficeBaseDir->getLength() > 0, + "Unable to obtain office base installation directory!" ); - makeCanonicalFileURL( *m_pOfficeDir ); + makeCanonicalFileURL( *m_pOfficeBaseDir ); *m_pUserDir = xExpander->expandMacros( @@ -336,7 +370,7 @@ void OfficeInstallationDirectories::initDirs() "${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE( "bootstrap" ) ":UserInstallation}" ) ) ); OSL_ENSURE( m_pUserDir->getLength() > 0, - "Unable to obtain office user data directory!" ); + "Unable to obtain office user data directory!" ); makeCanonicalFileURL( *m_pUserDir ); } diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx index 2ffb3582718a..9c56f7ce80fd 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.hxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.hxx @@ -94,11 +94,13 @@ public: private: void initDirs(); - rtl::OUString m_aOfficeDirMacro; + rtl::OUString m_aOfficeBrandDirMacro; + rtl::OUString m_aOfficeBaseDirMacro; rtl::OUString m_aUserDirMacro; com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xCtx; - rtl::OUString * m_pOfficeDir; + rtl::OUString * m_pOfficeBrandDir; + rtl::OUString * m_pOfficeBaseDir; rtl::OUString * m_pUserDir; }; diff --git a/configure.in b/configure.in index 0eeb5b8482a1..3a54a2b59ebd 100644 --- a/configure.in +++ b/configure.in @@ -4964,7 +4964,7 @@ AC_MSG_CHECKING([which neon to use]) if test -n "$with_system_neon" -o -n "$with_system_libs" && \ test "$with_system_neon" != "no"; then AC_MSG_RESULT([external]) - PKG_CHECK_MODULES(NEON, neon >= 0.24.0, , AC_MSG_ERROR([you need neon >= 0.24.x for system-neon])) + PKG_CHECK_MODULES(NEON, neon >= 0.26.0, , AC_MSG_ERROR([you need neon >= 0.26.x for system-neon])) NEON_VERSION="`$PKG_CONFIG --modversion neon | $SED 's/\.//g'`" NEON_CFLAGS="$NEON_CFLAGS -DSYSTEM_NEON -DUSE_DAV_LOCKS=1" SYSTEM_NEON=YES diff --git a/cppuhelper/source/gcc3.map b/cppuhelper/source/gcc3.map index eef6053b7595..7017d274c95d 100644 --- a/cppuhelper/source/gcc3.map +++ b/cppuhelper/source/gcc3.map @@ -385,7 +385,6 @@ UDK_3.6 { # OOo 3.3 UDK_3.7 { # OOo 3.4 global: - _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueElRKN3com3sun4star3uno3AnyE; - _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueEiRKN3com3sun4star3uno3AnyE; + _ZN4cppu18OPropertySetHelper29setDependentFastPropertyValueE?RKN3com3sun4star3uno3AnyE; } UDK_3.6; diff --git a/framework/inc/helper/ilayoutnotifications.hxx b/framework/inc/helper/ilayoutnotifications.hxx new file mode 100755 index 000000000000..db63ea15c7b4 --- /dev/null +++ b/framework/inc/helper/ilayoutnotifications.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ + +namespace framework +{ + +class ILayoutNotifications +{ + public: + enum Hint + { + HINT_NOT_SPECIFIED, + HINT_TOOLBARSPACE_HAS_CHANGED, + HINT_COUNT + }; + + virtual void requestLayout( Hint eHint = HINT_NOT_SPECIFIED ) = 0; +}; + +} + +#endif // __FRAMEWORK_LAYOUTMANAGER_ILAYOUTNOTIFICATIONS_HXX_ diff --git a/framework/inc/services.h b/framework/inc/services.h index 9c19f8b6251e..bdd6221eff9c 100644 --- a/framework/inc/services.h +++ b/framework/inc/services.h @@ -125,6 +125,8 @@ namespace framework{ #define SERVICENAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.ui.dialogs.TabContainerWindow" ) #define SERVICENAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.ui.WindowContentFactoryManager" ) #define SERVICENAME_DISPLAYACCESS DECLARE_ASCII("com.sun.star.awt.DisplayAccess" ) +#define SERVICENAME_PANELFACTORY DECLARE_ASCII("com.sun.star.ui.PanelFactory" ) +#define SERVICENAME_MODELWINSERVICE DECLARE_ASCII("com.sun.star.ui.ModelWinService" ) //_________________________________________________________________________________________________________________ // used implementationnames by framework @@ -211,6 +213,8 @@ namespace framework{ #define IMPLEMENTATIONNAME_IMAGEMANAGER DECLARE_ASCII("com.sun.star.comp.framework.ImageManager" ) #define IMPLEMENTATIONNAME_TABWINDOWSERVICE DECLARE_ASCII("com.sun.star.comp.framework.TabWindowService" ) #define IMPLEMENTATIONNAME_WINDOWCONTENTFACTORYMANAGER DECLARE_ASCII("com.sun.star.comp.framework.WindowContentFactoryManager" ) +#define IMPLEMENTATIONNAME_PANELFACTORY DECLARE_ASCII("com.sun.star.comp.framework.PanelFactory" ) +#define IMPLEMENTATIONNAME_MODELWINSERVICE DECLARE_ASCII("com.sun.star.comp.framework.ModelWinService" ) } // namespace framework diff --git a/framework/inc/services/layoutmanager.hxx b/framework/inc/services/layoutmanager.hxx index 2ccba9e7ffde..6b0135a39e10 100644 --- a/framework/inc/services/layoutmanager.hxx +++ b/framework/inc/services/layoutmanager.hxx @@ -6,6 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -50,6 +53,9 @@ #include <uielement/menubarmanager.hxx> #include <uiconfiguration/windowstateconfiguration.hxx> #include <classes/addonsoptions.hxx> +#include <uielement/panelwindow.hxx> +#include <uielement/uielement.hxx> +#include <helper/ilayoutnotifications.hxx> //_________________________________________________________________________________________________________________ // interface includes @@ -76,7 +82,7 @@ // other includes //_________________________________________________________________________________________________________________ #include <cppuhelper/propshlp.hxx> -#include <cppuhelper/implbase9.hxx> +#include <cppuhelper/implbase8.hxx> #include <cppuhelper/interfacecontainer.hxx> #include <comphelper/propertycontainer.hxx> #include <vcl/wintypes.hxx> @@ -87,14 +93,15 @@ class MenuBar; namespace framework { + class ToolbarLayoutManager; + class PanelManager; class GlobalSettings; - typedef ::cppu::WeakImplHelper9 < ::com::sun::star::lang::XServiceInfo + typedef ::cppu::WeakImplHelper8 < ::com::sun::star::lang::XServiceInfo , ::com::sun::star::frame::XLayoutManager , ::com::sun::star::awt::XWindowListener , ::com::sun::star::frame::XFrameActionListener , ::com::sun::star::ui::XUIConfigurationListener , ::com::sun::star::frame::XInplaceLayout - , ::com::sun::star::awt::XDockableWindowListener , ::com::sun::star::frame::XMenuBarMergingAcceptor , ::com::sun::star::frame::XLayoutManagerEventBroadcaster > LayoutManager_Base; @@ -104,6 +111,7 @@ namespace framework // Order is neccessary for right initialization! private ThreadHelpBase , // Struct for right initalization of mutex member! Must be first of baseclasses. public ::cppu::OBroadcastHelper , + public ILayoutNotifications , public LayoutManager_PBase { public: @@ -121,7 +129,7 @@ namespace framework // XLayoutManager //--------------------------------------------------------------------------------------------------------- virtual void SAL_CALL attachFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& Frame ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL reset( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::awt::Rectangle SAL_CALL getCurrentDockingArea( ) throw (::com::sun::star::uno::RuntimeException); virtual ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > SAL_CALL getDockingAreaAcceptor() throw (::com::sun::star::uno::RuntimeException); virtual void SAL_CALL setDockingAreaAcceptor( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor >& xDockingAreaAcceptor ) throw (::com::sun::star::uno::RuntimeException); @@ -192,17 +200,6 @@ namespace framework virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); //--------------------------------------------------------------------------------------------------------- - // XDockableWindowListener - //--------------------------------------------------------------------------------------------------------- - virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); - virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); - virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException); - - //--------------------------------------------------------------------------------------------------------- // XLayoutManagerEventBroadcaster //--------------------------------------------------------------------------------------------------------- virtual void SAL_CALL addLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& aLayoutManagerListener ) throw (::com::sun::star::uno::RuntimeException); @@ -211,196 +208,64 @@ namespace framework DECL_LINK( MenuBarClose, MenuBar * ); DECL_LINK( WindowEventListener, VclSimpleEvent* ); - struct DockedData - { - DockedData() : m_aPos( LONG_MAX, LONG_MAX ), - m_nDockedArea( ::com::sun::star::ui::DockingArea_DOCKINGAREA_TOP ), - m_bLocked( sal_False ) {} - - Point m_aPos; - Size m_aSize; - sal_Int16 m_nDockedArea; - sal_Bool m_bLocked; - }; - struct FloatingData - { - FloatingData() : m_aPos( LONG_MAX, LONG_MAX ), - m_nLines( 1 ), - m_bIsHorizontal( sal_True ) {} - - Point m_aPos; - Size m_aSize; - sal_Int16 m_nLines; - sal_Bool m_bIsHorizontal; - }; - struct SingleRowColumnWindowData - { - SingleRowColumnWindowData() : nVarSize( 0 ), nStaticSize( 0 ), nSpace( 0 ) {} - - std::vector< rtl::OUString > aUIElementNames; - std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aRowColumnWindows; - std::vector< ::com::sun::star::awt::Rectangle > aRowColumnWindowSizes; - std::vector< sal_Int32 > aRowColumnSpace; - ::com::sun::star::awt::Rectangle aRowColumnRect; - sal_Int32 nVarSize; - sal_Int32 nStaticSize; - sal_Int32 nSpace; - sal_Int32 nRowColumn; - }; + //--------------------------------------------------------------------------------------------------------- + // ILayoutNotifications + //--------------------------------------------------------------------------------------------------------- + virtual void requestLayout( Hint eHint ); protected: DECL_LINK( AsyncLayoutHdl, Timer * ); private: - enum DockingOperation - { - DOCKOP_BEFORE_COLROW, - DOCKOP_ON_COLROW, - DOCKOP_AFTER_COLROW - }; - struct UIElement - { - UIElement() : m_bFloating( sal_False ), - m_bVisible( sal_True ), - m_bUserActive( sal_False ), - m_bCreateNewRowCol0( sal_False ), - m_bDeactiveHide( sal_False ), - m_bMasterHide( sal_False ), - m_bContextSensitive( sal_False ), - m_bContextActive( sal_True ), - m_bNoClose( sal_False ), - m_bSoftClose( sal_False ), - m_bStateRead( sal_False ), - m_nStyle( BUTTON_SYMBOL ) - {} - - UIElement( const rtl::OUString& rName, - const rtl::OUString& rType, - const com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& rUIElement, - sal_Bool bFloating = sal_False - ) : m_aType( rType ), - m_aName( rName ), - m_xUIElement( rUIElement ), - m_bFloating( bFloating ), - m_bVisible( sal_True ), - m_bUserActive( sal_False ), - m_bCreateNewRowCol0( sal_False ), - m_bDeactiveHide( sal_False ), - m_bMasterHide( sal_False ), - m_bContextSensitive( sal_False ), - m_bContextActive( sal_True ), - m_bNoClose( sal_False ), - m_bSoftClose( sal_False ), - m_bStateRead( sal_False ), - m_nStyle( BUTTON_SYMBOL ) {} - - bool operator< ( const UIElement& aUIElement ) const; - UIElement& operator=( const UIElement& rUIElement ); - - rtl::OUString m_aType; - rtl::OUString m_aName; - rtl::OUString m_aUIName; - com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xUIElement; - sal_Bool m_bFloating, - m_bVisible, - m_bUserActive, - m_bCreateNewRowCol0, - m_bDeactiveHide, - m_bMasterHide, - m_bContextSensitive, - m_bContextActive; - sal_Bool m_bNoClose, - m_bSoftClose, - m_bStateRead; - sal_Int16 m_nStyle; - DockedData m_aDockedData; - FloatingData m_aFloatingData; - }; - - typedef std::vector< UIElement > UIElementVector; - //--------------------------------------------------------------------------------------------------------- // helper //--------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------- - // helper + // menu bar //--------------------------------------------------------------------------------------------------------- void impl_clearUpMenuBar(); void implts_reset( sal_Bool bAttach ); + void implts_setMenuBarCloser(sal_Bool bCloserState); void implts_updateMenuBarClose(); sal_Bool implts_resetMenuBar(); + //--------------------------------------------------------------------------------------------------------- + // locking + //--------------------------------------------------------------------------------------------------------- void implts_lock(); sal_Bool implts_unlock(); - sal_Bool implts_findElement( const rtl::OUString& aName, rtl::OUString& aElementType, rtl::OUString& aElementName, ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xSettings ); - sal_Bool implts_findElement( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xUIElement, UIElement& aElementData ); - sal_Bool implts_findElement( const rtl::OUString& aName, UIElement& aElementData ); + //--------------------------------------------------------------------------------------------------------- + // query + //--------------------------------------------------------------------------------------------------------- + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_findElement( const rtl::OUString& aName ); UIElement& impl_findElement( const rtl::OUString& aName ); - sal_Bool implts_insertUIElement( const UIElement& rUIElement ); - void implts_refreshContextToolbarsVisibility(); void implts_writeNewStateData( const rtl::OUString aName, const ::com::sun::star::uno::Reference< com::sun::star::awt::XWindow >& xWindow ); sal_Bool implts_readWindowStateData( const rtl::OUString& rName, UIElement& rElementData ); void implts_writeWindowStateData( const rtl::OUString& rName, const UIElement& rElementData ); void implts_setElementData( UIElement& rUIElement, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow >& rDockWindow ); void implts_sortUIElements(); void implts_destroyElements(); - void implts_destroyDockingAreaWindows(); - void implts_createAddonsToolBars(); - void implts_createCustomToolBars(); - void implts_createNonContextSensitiveToolBars(); - void implts_createCustomToolBars( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& aCustomTbxSeq ); - void implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle ); void implts_toggleFloatingUIElementsVisibility( sal_Bool bActive ); void implts_reparentChildWindows(); + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_createDockingWindow( const ::rtl::OUString& aElementName ); sal_Bool implts_isEmbeddedLayoutManager() const; sal_Int16 implts_getCurrentSymbolsSize(); sal_Int16 implts_getCurrentSymbolsStyle(); - ::com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const ::com::sun::star::uno::Reference< com::sun::star::awt::XWindowPeer >& rParent ); ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > implts_createElement( const rtl::OUString& aName ); - rtl::OUString implts_generateGenericAddonToolbarTitle( sal_Int32 nNumber ) const; - - // docking methods - ::Rectangle implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset ); - void implts_calcDockingPosSize( UIElement& aUIElement, DockingOperation& eDockOperation, ::Rectangle& rTrackingRect, const Point& rMousePos ); - DockingOperation implts_determineDockingOperation( ::com::sun::star::ui::DockingArea DockingArea, const ::Rectangle& rRowColRect, const Point& rMousePos ); - ::Rectangle implts_getWindowRectFromRowColumn( ::com::sun::star::ui::DockingArea DockingArea, const SingleRowColumnWindowData& rRowColumnWindowData, const ::Point& rMousePos, const rtl::OUString& rExcludeElementName ); - ::Rectangle implts_determineFrontDockingRect( ::com::sun::star::ui::DockingArea eDockingArea, - sal_Int32 nRowCol, - const ::Rectangle& rDockedElementRect, - const ::rtl::OUString& rMovedElementName, - const ::Rectangle& rMovedElementRect ); - void implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockingArea, - sal_Int32 nOffset, - SingleRowColumnWindowData& rRowColumnWindowData, - const ::Size& rContainerSize ); - ::Rectangle implts_calcTrackingAndElementRect( ::com::sun::star::ui::DockingArea eDockingArea, - sal_Int32 nRowCol, - UIElement& rUIElement, - const ::Rectangle& rTrackingRect, - const ::Rectangle& rRowColumnRect, - const ::Size& rContainerWinSize ); - void implts_renumberRowColumnData( ::com::sun::star::ui::DockingArea eDockingArea, DockingOperation eDockingOperation, const UIElement& rUIElement ); // layouting methods - sal_Bool implts_compareRectangles( const ::com::sun::star::awt::Rectangle& rRect1, const ::com::sun::star::awt::Rectangle& rRect2 ); sal_Bool implts_resizeContainerWindow( const ::com::sun::star::awt::Size& rContainerSize, const ::com::sun::star::awt::Point& rComponentPos ); ::Size implts_getTopBottomDockingAreaSizes(); ::Size implts_getContainerWindowOutputSize(); - ::com::sun::star::awt::Rectangle implts_getDockingAreaWindowSizes(); - void implts_getDockingAreaElementInfos( ::com::sun::star::ui::DockingArea DockingArea, std::vector< SingleRowColumnWindowData >& rRowColumnsWindowData ); - void implts_getDockingAreaElementInfoOnSingleRowCol( ::com::sun::star::ui::DockingArea, - sal_Int32 nRowCol, - SingleRowColumnWindowData& rRowColumnWindowData ); - ::Point implts_findNextCascadeFloatingPos(); - void implts_findNextDockingPos( ::com::sun::star::ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ); + + void implts_setDockingAreaWindowSizes( const css::awt::Rectangle& rBorderSpace ); ::com::sun::star::awt::Rectangle implts_calcDockingAreaSizes(); - void implts_setDockingAreaWindowSizes( const com::sun::star::awt::Rectangle& rBorderSpace ); sal_Bool implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ); - void implts_doLayout_notify( sal_Bool bOuterResize ); + void implts_doLayout_notify( sal_Bool bOuterResize ); // internal methods to control status/progress bar ::Size implts_getStatusBarSize(); @@ -415,6 +280,7 @@ namespace framework sal_Bool implts_showProgressBar(); sal_Bool implts_hideProgressBar(); void implts_backupProgressBarWrapper(); + void implts_setOffset( const sal_Int32 nBottomOffset ); void implts_setInplaceMenuBar( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMergedMenuBar ) @@ -425,12 +291,7 @@ namespace framework void implts_setVisibleState( sal_Bool bShow ); void implts_updateUIElementsVisibleState( sal_Bool bShow ); void implts_setCurrentUIVisibility( sal_Bool bShow ); - sal_Bool impl_parseResourceURL( const rtl::OUString aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ); - void implts_notifyListeners( short nEvent, ::com::sun::star::uno::Any aInfoParam ); -#ifdef DBG_UTIL - void implts_checkElementContainer(); -#endif DECL_LINK( OptionsChanged, void* ); DECL_LINK( SettingsChanged, void* ); @@ -459,9 +320,7 @@ namespace framework css::uno::WeakReference< css::frame::XModel > m_xModel; css::uno::Reference< css::awt::XWindow > m_xContainerWindow; css::uno::Reference< css::awt::XTopWindow2 > m_xContainerTopWindow; - css::uno::Reference< css::awt::XWindow > m_xDockAreaWindows[DOCKINGAREAS_COUNT]; sal_Int32 m_nLockCount; - UIElementVector m_aUIElements; bool m_bActive; bool m_bInplaceMenuSet; bool m_bDockingInProgress; @@ -476,11 +335,9 @@ namespace framework bool m_bHideCurrentUI; bool m_bGlobalSettings; bool m_bPreserveContentSize; - DockingOperation m_eDockOperation; - UIElement m_aDockUIElement; + bool m_bMenuBarCloser; css::awt::Rectangle m_aDockingArea; css::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > m_xDockingAreaAcceptor; - Point m_aStartDockMousePos; css::uno::Reference< ::com::sun::star::lang::XComponent > m_xInplaceMenuBar; MenuBarManager* m_pInplaceMenuBar; css::uno::Reference< ::com::sun::star::ui::XUIElement > m_xMenuBar; @@ -489,14 +346,10 @@ namespace framework com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xProgressBarBackup; css::uno::Reference< ::com::sun::star::frame::XModuleManager > m_xModuleManager; css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; - bool m_bMenuBarCloser; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowStateSupplier; GlobalSettings* m_pGlobalSettings; rtl::OUString m_aModuleIdentifier; - rtl::OUString m_aCustomTbxPrefix; - rtl::OUString m_aFullCustomTbxPrefix; - rtl::OUString m_aFullAddonTbxPrefix; rtl::OUString m_aStatusBarAlias; rtl::OUString m_aProgressBarAlias; rtl::OUString m_aPropDocked; @@ -509,12 +362,13 @@ namespace framework rtl::OUString m_aPropStyle; rtl::OUString m_aPropLocked; rtl::OUString m_aCustomizeCmd; - AddonsOptions* m_pAddonOptions; - SvtMiscOptions* m_pMiscOptions; sal_Int16 m_eSymbolsSize; sal_Int16 m_eSymbolsStyle; - Timer m_aAsyncLayoutTimer; + Timer m_aAsyncLayoutTimer; ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; // container for ALL Listener + PanelManager* m_pPanelManager; + ToolbarLayoutManager* m_pToolbarManager; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener > m_xToolbarManager; }; } // namespace framework diff --git a/framework/inc/services/modelwinservice.hxx b/framework/inc/services/modelwinservice.hxx new file mode 100755 index 000000000000..7e07fcb0cd37 --- /dev/null +++ b/framework/inc/services/modelwinservice.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: urltransformer.hxx,v $ + * $Revision: 1.8 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_ +#define __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/awt/XControlModel.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <cppuhelper/weak.hxx> +#include <vcl/window.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +class IModelWin +{ + public: + virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel ) = 0; + virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow ) = 0; +}; + +class ModelWinService : public css::lang::XTypeProvider + , public css::lang::XServiceInfo + , public css::container::XNameAccess + , public IModelWin + , public ::cppu::OWeakObject +{ + public: + ModelWinService(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + virtual ~ModelWinService(); + + //--------------------------------------------------------------------------------------------------------- + // XInterface, XTypeProvider, XServiceInfo + //--------------------------------------------------------------------------------------------------------- + + FWK_DECLARE_XINTERFACE + FWK_DECLARE_XTYPEPROVIDER + DECLARE_XSERVICEINFO + + //--------------------------------------------------------------------------------------------------------- + // IModelWin + //--------------------------------------------------------------------------------------------------------- + virtual void registerModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow, const css::uno::Reference< css::awt::XControlModel >& rModel ); + virtual void deregisterModelForXWindow( const css::uno::Reference< css::awt::XWindow >& rWindow ); + + //--------------------------------------------------------------------------------------------------------- + // XNameAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Any SAL_CALL getByName( const ::rtl::OUString& sName ) throw( css::container::NoSuchElementException , + css::lang::WrappedTargetException , + css::uno::RuntimeException ); + virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& sName ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XElementAccess + //--------------------------------------------------------------------------------------------------------- + virtual css::uno::Type SAL_CALL getElementType() throw( css::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements() throw( css::uno::RuntimeException ); + + private: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager; +}; + +} + +#endif // __FRAMEWORK_SERVICES_MODELWINSERVICE_HXX_ diff --git a/framework/inc/uielement/panelwindow.hxx b/framework/inc/uielement/panelwindow.hxx new file mode 100755 index 000000000000..e1b8ae2abcc7 --- /dev/null +++ b/framework/inc/uielement/panelwindow.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_PANELWINDOW_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_PANELWINDOW_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <vcl/dockwin.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class PanelWindow : public DockingWindow +{ + public: + PanelWindow( Window* pParent, WinBits nWinBits =0); + virtual ~PanelWindow(); + + const ::rtl::OUString& getResourceURL() const; + void setResourceURL(const ::rtl::OUString& rResourceURL); + Window* getContentWindow() const; + void setContentWindow( Window* pContentWindow ); + + virtual void Command ( const CommandEvent& rCEvt ); + virtual void StateChanged( StateChangedType nType ); + virtual void DataChanged( const DataChangedEvent& rDCEvt ); + virtual void Resize(); + + // Provide additional handlers to support external implementations + void SetCommandHdl( const Link& aLink ) { m_aCommandHandler = aLink; } + const Link& GetCommandHdl() const { return m_aCommandHandler; } + void SetStateChangedHdl( const Link& aLink ) { m_aStateChangedHandler = aLink; } + const Link& GetStateChangedHdl() const { return m_aStateChangedHandler; } + void SetDataChangedHdl( const Link& aLink ) { m_aDataChangedHandler = aLink; } + const Link& GetDataChangedHdl() { return m_aDataChangedHandler; } + + private: + ::rtl::OUString m_aResourceURL; + Link m_aCommandHandler; + Link m_aStateChangedHandler; + Link m_aDataChangedHandler; + Window* m_pContentWindow; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_PANELWINDOW_HXX_ diff --git a/framework/inc/uielement/panelwrapper.hxx b/framework/inc/uielement/panelwrapper.hxx new file mode 100755 index 000000000000..348fd679db9f --- /dev/null +++ b/framework/inc/uielement/panelwrapper.hxx @@ -0,0 +1,68 @@ + + +#ifndef __FRAMEWORK_UIELEMENT_PANELWRAPPER_HXX_ +#define __FRAMEWORK_UIELEMENT_PANELWRAPPER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <helper/uielementwrapperbase.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class PanelWrapper : public UIElementWrapperBase +{ + public: + PanelWrapper( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& xServiceManager ); + virtual ~PanelWrapper(); + + // XInterface + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XUIElement + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getRealInterface() throw (::com::sun::star::uno::RuntimeException); + + // XUpdatable + virtual void SAL_CALL update() throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + using cppu::OPropertySetHelper::disposing; + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException); + + //------------------------------------------------------------------------------------------------------------- + // protected methods + //------------------------------------------------------------------------------------------------------------- + protected: + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ); + + private: + com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + com::sun::star::uno::Reference< com::sun::star::awt::XWindow > m_xPanelWindow; + bool m_bNoClose; +}; + +} + +#endif // __FRAMEWORK_UIELEMENT_PANELWRAPPER_HXX_ diff --git a/framework/inc/uielement/uielement.hxx b/framework/inc/uielement/uielement.hxx new file mode 100755 index 000000000000..b4ad9e2cbb6d --- /dev/null +++ b/framework/inc/uielement/uielement.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_UIELEMENT_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_UIELEMENT_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/ui/DockingArea.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <rtl/ustring.hxx> +#include <vcl/toolbox.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +struct DockedData +{ + DockedData() : m_aPos( LONG_MAX, LONG_MAX ), + m_nDockedArea( ::com::sun::star::ui::DockingArea_DOCKINGAREA_TOP ), + m_bLocked( false ) {} + + Point m_aPos; + Size m_aSize; + sal_Int16 m_nDockedArea; + bool m_bLocked; +}; + +struct FloatingData +{ + FloatingData() : m_aPos( LONG_MAX, LONG_MAX ), + m_nLines( 1 ), + m_bIsHorizontal( true ) {} + + Point m_aPos; + Size m_aSize; + sal_Int16 m_nLines; + bool m_bIsHorizontal; +}; + +struct UIElement +{ + UIElement() : m_bFloating( false ), + m_bVisible( true ), + m_bUserActive( false ), + m_bCreateNewRowCol0( false ), + m_bDeactiveHide( false ), + m_bMasterHide( false ), + m_bContextSensitive( false ), + m_bContextActive( true ), + m_bNoClose( false ), + m_bSoftClose( false ), + m_bStateRead( false ), + m_nStyle( BUTTON_SYMBOL ) + {} + + UIElement( const rtl::OUString& rName, + const rtl::OUString& rType, + const com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& rUIElement, + bool bFloating = false + ) : m_aType( rType ), + m_aName( rName ), + m_xUIElement( rUIElement ), + m_bFloating( bFloating ), + m_bVisible( true ), + m_bUserActive( false ), + m_bCreateNewRowCol0( false ), + m_bDeactiveHide( false ), + m_bMasterHide( false ), + m_bContextSensitive( false ), + m_bContextActive( true ), + m_bNoClose( false ), + m_bSoftClose( false ), + m_bStateRead( false ), + m_nStyle( BUTTON_SYMBOL ) {} + + bool operator< ( const UIElement& aUIElement ) const; + UIElement& operator=( const UIElement& rUIElement ); + + rtl::OUString m_aType; + rtl::OUString m_aName; + rtl::OUString m_aUIName; + com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > m_xUIElement; + bool m_bFloating, + m_bVisible, + m_bUserActive, + m_bCreateNewRowCol0, + m_bDeactiveHide, + m_bMasterHide, + m_bContextSensitive, + m_bContextActive; + bool m_bNoClose, + m_bSoftClose, + m_bStateRead; + sal_Int16 m_nStyle; + DockedData m_aDockedData; + FloatingData m_aFloatingData; +}; + +typedef std::vector< UIElement > UIElementVector; + +} // namespace framework + +#endif // __FRAMEWORK_LAYOUTMANAGER_UIELEMENT_HXX_ diff --git a/framework/source/layoutmanager/helpers.cxx b/framework/source/layoutmanager/helpers.cxx new file mode 100755 index 000000000000..0e6dff554daa --- /dev/null +++ b/framework/source/layoutmanager/helpers.cxx @@ -0,0 +1,415 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +// my own includes +#include "helpers.hxx" +#include <threadhelp/resetableguard.hxx> +#include <services.h> + +// interface includes +#include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/XTopWindow.hpp> +#include <com/sun/star/frame/XDispatchHelper.hpp> +#include <com/sun/star/awt/XDockableWindow.hpp> +#include <com/sun/star/awt/XDockableWindowListener.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/ui/XUIElement.hpp> + +// other includes +#include <comphelper/mediadescriptor.hxx> +#include <vcl/svapp.hxx> +#include <vos/mutex.hxx> +#include <toolkit/unohlp.hxx> + +// namespace +using namespace com::sun::star; + +namespace framework +{ + +bool hasEmptySize( const:: Size& aSize ) +{ + return ( aSize.Width() == 0 ) && ( aSize.Height() == 0 ); +} + +bool hasDefaultPosValue( const ::Point& aPos ) +{ + return (( aPos.X() == SAL_MAX_INT32 ) || ( aPos.Y() == SAL_MAX_INT32 )); +} + +bool isDefaultPos( const ::com::sun::star::awt::Point& aPos ) +{ + return (( aPos.X == SAL_MAX_INT32 ) && ( aPos.Y == SAL_MAX_INT32 )); +} + +bool isDefaultPos( const ::Point& aPos ) +{ + return (( aPos.X() == SAL_MAX_INT32 ) && ( aPos.Y() == SAL_MAX_INT32 )); +} + +bool isReverseOrderDockingArea( const sal_Int32 nDockArea ) +{ + ui::DockingArea eDockArea = static_cast< ui::DockingArea >( nDockArea ); + return (( eDockArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) || + ( eDockArea == ui::DockingArea_DOCKINGAREA_RIGHT )); +} + +bool isToolboxHorizontalAligned( ToolBox* pToolBox ) +{ + if ( pToolBox ) + return (( pToolBox->GetAlign() == WINDOWALIGN_TOP ) || ( pToolBox->GetAlign() == WINDOWALIGN_BOTTOM )); + return false; +} + +bool isHorizontalDockingArea( const ui::DockingArea& nDockingArea ) +{ + return (( nDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) || + ( nDockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM )); +} + +bool isHorizontalDockingArea( const sal_Int32 nDockArea ) +{ + return isHorizontalDockingArea(static_cast< ui::DockingArea >( nDockArea )); +} + +::rtl::OUString retrieveToolbarNameFromHelpURL( Window* pWindow ) +{ + ::rtl::OUString aToolbarName; + + if ( pWindow->GetType() == WINDOW_TOOLBOX ) + { + ToolBox* pToolBox = dynamic_cast<ToolBox *>( pWindow ); + if ( pToolBox ) + { + aToolbarName = rtl::OStringToOUString( pToolBox->GetHelpId(), RTL_TEXTENCODING_UTF8 ); + sal_Int32 i = aToolbarName.lastIndexOf( ':' ); + if (( aToolbarName.getLength() > 0 ) && ( i > 0 ) && (( i+ 1 ) < aToolbarName.getLength() )) + aToolbarName = aToolbarName.copy( i+1 ); // Remove ".HelpId:" protocol from toolbar name + else + aToolbarName = ::rtl::OUString(); + } + } + return aToolbarName; +} + +ToolBox* getToolboxPtr( Window* pWindow ) +{ + ToolBox* pToolbox(NULL); + if ( pWindow->GetType() == WINDOW_TOOLBOX ) + pToolbox = dynamic_cast<ToolBox*>( pWindow ); + return pToolbox; +} + +Window* getWindowFromXUIElement( const uno::Reference< ui::XUIElement >& xUIElement ) +{ + vos::OGuard aGuard( Application::GetSolarMutex() ); + uno::Reference< awt::XWindow > xWindow; + if ( xUIElement.is() ) + xWindow = uno::Reference< awt::XWindow >( xUIElement->getRealInterface(), uno::UNO_QUERY ); + return VCLUnoHelper::GetWindow( xWindow ); +} + +SystemWindow* getTopSystemWindow( const uno::Reference< awt::XWindow >& xWindow ) +{ + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + while ( pWindow && !pWindow->IsSystemWindow() ) + pWindow = pWindow->GetParent(); + + if ( pWindow ) + return (SystemWindow *)pWindow; + else + return 0; +} + +void setZeroRectangle( ::Rectangle& rRect ) +{ + rRect.setX(0); + rRect.setY(0); + rRect.setWidth(0); + rRect.setHeight(0); +} + +// ATTENTION! +// This value is directly copied from the sfx2 project. +// You have to change BOTH values, see sfx2/inc/sfx2/sfxsids.hrc (SID_DOCKWIN_START) +static const sal_Int32 DOCKWIN_ID_BASE = 9800; + +bool lcl_checkUIElement(const uno::Reference< ui::XUIElement >& xUIElement, awt::Rectangle& _rPosSize, uno::Reference< awt::XWindow >& _xWindow) +{ + bool bRet = xUIElement.is(); + if ( bRet ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + _xWindow.set( xUIElement->getRealInterface(), uno::UNO_QUERY ); + _rPosSize = _xWindow->getPosSize(); + + Window* pWindow = VCLUnoHelper::GetWindow( _xWindow ); + if ( pWindow->GetType() == WINDOW_TOOLBOX ) + { + ::Size aSize = ((ToolBox*)pWindow)->CalcWindowSizePixel( 1 ); + _rPosSize.Width = aSize.Width(); + _rPosSize.Height = aSize.Height(); + } + } // if ( xUIElement.is() ) + return bRet; +} + +uno::Reference< awt::XWindowPeer > createToolkitWindow( const uno::Reference< lang::XMultiServiceFactory >& rFactory, const uno::Reference< awt::XWindowPeer >& rParent, const char* pService ) +{ + const rtl::OUString aAWTToolkit( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" )); + + uno::Reference< awt::XWindowPeer > xPeer; + if ( rFactory.is() ) + { + uno::Reference< awt::XToolkit > xToolkit( rFactory->createInstance( aAWTToolkit ), uno::UNO_QUERY_THROW ); + if ( xToolkit.is() ) + { + // describe window properties. + css::awt::WindowDescriptor aDescriptor; + aDescriptor.Type = awt::WindowClass_SIMPLE; + aDescriptor.WindowServiceName = ::rtl::OUString::createFromAscii( pService ); + aDescriptor.ParentIndex = -1; + aDescriptor.Parent = uno::Reference< awt::XWindowPeer >( rParent, uno::UNO_QUERY ); + aDescriptor.Bounds = awt::Rectangle(0,0,0,0); + aDescriptor.WindowAttributes = 0; + + // create a awt window + xPeer = xToolkit->createWindow( aDescriptor ); + } + } + + return xPeer; +} + +// convert alignment constant to vcl's WindowAlign type +WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ) +{ + if ( aAlignment == ui::DockingArea_DOCKINGAREA_LEFT ) + return WINDOWALIGN_LEFT; + else if ( aAlignment == ui::DockingArea_DOCKINGAREA_RIGHT ) + return WINDOWALIGN_RIGHT; + else if ( aAlignment == ui::DockingArea_DOCKINGAREA_TOP ) + return WINDOWALIGN_TOP; + else + return WINDOWALIGN_BOTTOM; +} + +::rtl::OUString getElementTypeFromResourceURL( const ::rtl::OUString& aResourceURL ) +{ + ::rtl::OUString aType; + + ::rtl::OUString aUIResourceURL( UIRESOURCE_URL ); + if ( aResourceURL.indexOf( aUIResourceURL ) == 0 ) + { + sal_Int32 nIndex = 0; + ::rtl::OUString aPathPart = aResourceURL.copy( aUIResourceURL.getLength() ); + ::rtl::OUString aUIResource = aPathPart.getToken( 0, (sal_Unicode)'/', nIndex ); + + return aPathPart.getToken( 0, (sal_Unicode)'/', nIndex ); + } + + return aType; +} + +void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ) +{ + ::rtl::OUString aUIResourceURL( UIRESOURCE_URL ); + if ( aResourceURL.indexOf( aUIResourceURL ) == 0 ) + { + sal_Int32 nIndex = 0; + ::rtl::OUString aPathPart = aResourceURL.copy( aUIResourceURL.getLength() ); + ::rtl::OUString aUIResource = aPathPart.getToken( 0, (sal_Unicode)'/', nIndex ); + + aElementType = aPathPart.getToken( 0, (sal_Unicode)'/', nIndex ); + aElementName = aPathPart.getToken( 0, (sal_Unicode)'/', nIndex ); + } +} + +::com::sun::star::awt::Rectangle putRectangleValueToAWT( const ::Rectangle& rRect ) +{ + css::awt::Rectangle aRect; + aRect.X = rRect.Left(); + aRect.Y = rRect.Top(); + aRect.Width = rRect.Right(); + aRect.Height = rRect.Bottom(); + + return aRect; +} + +::Rectangle putAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ) +{ + ::Rectangle aRect; + aRect.Left() = rRect.X; + aRect.Top() = rRect.Y; + aRect.Right() = rRect.Width; + aRect.Bottom() = rRect.Height; + + return aRect; +} + +css::awt::Rectangle convertRectangleToAWT( const ::Rectangle& rRect ) +{ + css::awt::Rectangle aRect; + aRect.X = rRect.Left(); + aRect.Y = rRect.Top(); + aRect.Width = rRect.GetWidth(); + aRect.Height = rRect.GetHeight(); + return aRect; +} + +::Rectangle convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ) +{ + ::Rectangle aRect; + aRect.Left() = rRect.X; + aRect.Top() = rRect.Y; + aRect.Right() = rRect.X + rRect.Width; + aRect.Bottom() = rRect.Y + rRect.Height; + + return aRect; +} + +bool equalRectangles( const css::awt::Rectangle& rRect1, + const css::awt::Rectangle& rRect2 ) +{ + return (( rRect1.X == rRect2.X ) && + ( rRect1.Y == rRect2.Y ) && + ( rRect1.Width == rRect2.Width ) && + ( rRect1.Height == rRect2.Height )); +} + +uno::Reference< frame::XModel > impl_getModelFromFrame( const uno::Reference< frame::XFrame >& rFrame ) +{ + // Query for the model to get check the context information + uno::Reference< frame::XModel > xModel; + if ( rFrame.is() ) + { + uno::Reference< frame::XController > xController( rFrame->getController(), uno::UNO_QUERY ); + if ( xController.is() ) + xModel = xController->getModel(); + } + + return xModel; +} + +sal_Bool implts_isPreviewModel( const uno::Reference< frame::XModel >& xModel ) +{ + if ( xModel.is() ) + { + ::comphelper::MediaDescriptor aDesc( xModel->getArgs() ); + return aDesc.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_PREVIEW(), (sal_Bool)sal_False); + } + else + return sal_False; +} + +sal_Bool implts_isFrameOrWindowTop( const uno::Reference< frame::XFrame >& xFrame ) +{ + if (xFrame->isTop()) + return sal_True; + + uno::Reference< awt::XTopWindow > xWindowCheck(xFrame->getContainerWindow(), uno::UNO_QUERY); // dont use _THROW here ... its a check only + if (xWindowCheck.is()) + { + // --> PB 2007-06-18 #i76867# top and system window is required. + ::vos::OGuard aSolarLock(&Application::GetSolarMutex()); + uno::Reference< awt::XWindow > xWindow( xWindowCheck, uno::UNO_QUERY ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + return ( pWindow && pWindow->IsSystemWindow() ); + // <-- + } + + return sal_False; +} + +void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMGR, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ) +{ + const ::rtl::OUString aDockWinPrefixCommand( RTL_CONSTASCII_USTRINGPARAM( "DockingWindow" )); + css::uno::WeakReference< css::frame::XDispatchHelper > xDispatchHelper; + + sal_Int32 nID = rDockingWindowName.toInt32(); + sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; + + css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY); + if ( nIndex >= 0 && xProvider.is() ) + { + ::rtl::OUString aDockWinCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:" )); + ::rtl::OUString aDockWinArgName( aDockWinPrefixCommand ); + + aDockWinArgName += ::rtl::OUString::valueOf( nIndex ); + + css::uno::Sequence< css::beans::PropertyValue > aArgs(1); + aArgs[0].Name = aDockWinArgName; + aArgs[0].Value = css::uno::makeAny( bVisible ); + + css::uno::Reference< css::frame::XDispatchHelper > xDispatcher( xDispatchHelper ); + if ( !xDispatcher.is()) + { + xDispatcher = css::uno::Reference< css::frame::XDispatchHelper >( + rSMGR->createInstance(SERVICENAME_DISPATCHHELPER), css::uno::UNO_QUERY_THROW); + } + + aDockWinCommand = aDockWinCommand + aDockWinArgName; + xDispatcher->executeDispatch( + xProvider, + aDockWinCommand, + ::rtl::OUString::createFromAscii("_self"), + 0, + aArgs); + } +} + +void impl_addWindowListeners( + const css::uno::Reference< css::uno::XInterface >& xThis, + const css::uno::Reference< css::ui::XUIElement >& xUIElement ) +{ + css::uno::Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY ); + css::uno::Reference< css::awt::XDockableWindow > xDockWindow( xUIElement->getRealInterface(), css::uno::UNO_QUERY ); + if ( xDockWindow.is() && xWindow.is() ) + { + try + { + xDockWindow->addDockableWindowListener( + css::uno::Reference< css::awt::XDockableWindowListener >( + xThis, css::uno::UNO_QUERY )); + xWindow->addWindowListener( + css::uno::Reference< css::awt::XWindowListener >( + xThis, css::uno::UNO_QUERY )); + xDockWindow->enableDocking( sal_True ); + } + catch ( css::uno::Exception& ) + { + } + } +} + +} // namespace framework diff --git a/framework/source/layoutmanager/helpers.hxx b/framework/source/layoutmanager/helpers.hxx new file mode 100755 index 000000000000..d4e9ce313d0e --- /dev/null +++ b/framework/source/layoutmanager/helpers.hxx @@ -0,0 +1,95 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_ + +// my own includes +#include <macros/generic.hxx> +#include <stdtypes.h> +#include <properties.h> + +// interface includes +#include <com/sun/star/awt/XWindowPeer.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/frame/XFrame.hpp> +#include <com/sun/star/ui/XUIElement.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/Point.hpp> + +// other includes +#include <vcl/window.hxx> +#include <vcl/toolbox.hxx> + +#define UIRESOURCE_PROTOCO_ASCII "private:" +#define UIRESOURCE_RESOURCE_ASCII "resource" +#define UIRESOURCE_URL_ASCII "private:resource" +#define UIRESOURCE_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCE_URL_ASCII )) +#define UIRESOURCETYPE_TOOLBAR "toolbar" +#define UIRESOURCETYPE_STATUSBAR "statusbar" +#define UIRESOURCETYPE_MENUBAR "menubar" + +namespace framework +{ + +bool hasEmptySize( const:: Size& aSize ); +bool hasDefaultPosValue( const ::Point& aPos ); +bool isDefaultPos( const ::com::sun::star::awt::Point& aPos ); +bool isDefaultPos( const ::Point& aPos ); +bool isToolboxHorizontalAligned( ToolBox* pToolBox ); +bool isReverseOrderDockingArea( const sal_Int32 nDockArea ); +bool isHorizontalDockingArea( const sal_Int32 nDockArea ); +bool isHorizontalDockingArea( const ::com::sun::star::ui::DockingArea& nDockArea ); +::rtl::OUString retrieveToolbarNameFromHelpURL( Window* pWindow ); +ToolBox* getToolboxPtr( Window* pWindow ); +Window* getWindowFromXUIElement( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement ); +SystemWindow* getTopSystemWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xWindow ); +bool equalRectangles( const css::awt::Rectangle& rRect1, const css::awt::Rectangle& rRect2 ); +void setZeroRectangle( ::Rectangle& rRect ); +bool lcl_checkUIElement(const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement,::com::sun::star::awt::Rectangle& _rPosSize, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& _xWindow); +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > createToolkitWindow( const css::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rFactory, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent, const char* pService ); +WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ); +::rtl::OUString getElementTypeFromResourceURL( const ::rtl::OUString& aResourceURL ); +void parseResourceURL( const rtl::OUString& aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ); +::Rectangle putAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ); +::com::sun::star::awt::Rectangle putRectangleValueToAWT( const ::Rectangle& rRect ); +::com::sun::star::awt::Rectangle convertRectangleToAWT( const ::Rectangle& rRect ); +::Rectangle convertAWTToRectangle( const ::com::sun::star::awt::Rectangle& rRect ); +::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > impl_getModelFromFrame( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); +sal_Bool implts_isPreviewModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); +sal_Bool implts_isFrameOrWindowTop( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame ); +void impl_setDockingWindowVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& rSMGR, const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ); +void impl_addWindowListeners( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xThis, const ::com::sun::star::uno::Reference< css::ui::XUIElement >& xUIElement ); +::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > implts_createToolkitWindow( const css::uno::Reference< ::com::sun::star::awt::XToolkit >& rToolkit, const css::uno::Reference< ::com::sun::star::awt::XWindowPeer >& rParent ); + +} + +#endif // __FRAMEWORK_LAYOUTMANAGER_HELPERS_HXX_ diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 4dcf9f047488..e5bf08cf0300 100644..100755 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -6,6 +6,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: layoutmanager.cxx,v $ + * $Revision: 1.72 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -28,34 +31,23 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_framework.hxx" -//_________________________________________________________________________________________________________________ -// my own includes -//_________________________________________________________________________________________________________________ - -// #include <math.h> - -#ifndef _FRAMEWORK_SERVICES_LAYOUTMANAGER_HXX_ +// my own includes #include <services/layoutmanager.hxx> -#endif +#include <helpers.hxx> +#include <panelmanager.hxx> #include <threadhelp/resetableguard.hxx> #include <services.h> - #include <classes/sfxhelperfunctions.hxx> #include <uielement/menubarwrapper.hxx> -#include <classes/addonsoptions.hxx> #include <uiconfiguration/windowstateconfiguration.hxx> #include <classes/fwkresid.hxx> - -#ifndef __FRAMEWORK_CLASSES_RESOURCE_HRC_ #include <classes/resource.hrc> -#endif #include <toolkit/helper/convert.hxx> #include <uielement/progressbarwrapper.hxx> #include <uiconfiguration/globalsettings.hxx> +#include <toolbarlayoutmanager.hxx> -//_________________________________________________________________________________________________________________ -// interface includes -//_________________________________________________________________________________________________________________ +// interface includes #include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/frame/XModel.hpp> @@ -69,21 +61,17 @@ #include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/awt/XDevice.hpp> #include <com/sun/star/awt/XSystemDependentWindowPeer.hpp> -#include <com/sun/star/awt/XTopWindow.hpp> #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp> #include <com/sun/star/ui/UIElementType.hpp> #include <com/sun/star/container/XNameReplace.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/ui/XUIFunctionListener.hpp> #include <com/sun/star/frame/LayoutManagerEvents.hpp> #include <com/sun/star/frame/XDispatchProvider.hpp> #include <com/sun/star/frame/XDispatchHelper.hpp> #include <com/sun/star/lang/DisposedException.hpp> -//_________________________________________________________________________________________________________________ -// other includes -//_________________________________________________________________________________________________________________ +// other includes #include <svtools/imgdef.hxx> #include <tools/diagnose_ex.h> #include <vcl/window.hxx> @@ -102,348 +90,101 @@ #include <algorithm> #include <boost/bind.hpp> -// ______________________________________________ -// using namespace +// using namespace using namespace ::com::sun::star; -using namespace com::sun::star::uno; -using namespace com::sun::star::beans; -using namespace com::sun::star::util; -using namespace com::sun::star::lang; -using namespace com::sun::star::container; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::beans; +using namespace ::com::sun::star::util; +using namespace ::com::sun::star::lang; +using namespace ::com::sun::star::container; using namespace ::com::sun::star::ui; -using namespace com::sun::star::frame; using namespace ::com::sun::star::frame; -#define UIRESOURCE_PROTOCO_ASCII "private:" -#define UIRESOURCE_RESOURCE_ASCII "resource" -#define UIRESOURCE_URL_ASCII "private:resource" -#define UIRESOURCE_URL rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCE_URL_ASCII )) // ATTENTION! // This value is directly copied from the sfx2 project. // You have to change BOTH values, see sfx2/inc/sfx2/sfxsids.hrc (SID_DOCKWIN_START) static const sal_Int32 DOCKWIN_ID_BASE = 9800; -bool lcl_checkUIElement(const Reference< XUIElement >& xUIElement,css::awt::Rectangle& _rPosSize,Reference< css::awt::XWindow >& _xWindow) -{ - bool bRet = xUIElement.is(); - if ( bRet ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - _xWindow.set( xUIElement->getRealInterface(), UNO_QUERY ); - _rPosSize = _xWindow->getPosSize(); - - Window* pWindow = VCLUnoHelper::GetWindow( _xWindow ); - if ( pWindow->GetType() == WINDOW_TOOLBOX ) - { - ::Size aSize = ((ToolBox*)pWindow)->CalcWindowSizePixel( 1 ); - _rPosSize.Width = aSize.Width(); - _rPosSize.Height = aSize.Height(); - } - } // if ( xUIElement.is() ) - return bRet; -} - -// convert alignment constant to vcl's WindowAlign type -static WindowAlign ImplConvertAlignment( sal_Int16 aAlignment ) -{ - if ( aAlignment == DockingArea_DOCKINGAREA_LEFT ) - return WINDOWALIGN_LEFT; - else if ( aAlignment == DockingArea_DOCKINGAREA_RIGHT ) - return WINDOWALIGN_RIGHT; - else if ( aAlignment == DockingArea_DOCKINGAREA_TOP ) - return WINDOWALIGN_TOP; - else - return WINDOWALIGN_BOTTOM; -} - -//_________________________________________________________________________________________________________________ -// Namespace -//_________________________________________________________________________________________________________________ -// - namespace framework { -struct UIElementVisibility -{ - rtl::OUString aName; - bool bVisible; -}; - -bool LayoutManager::UIElement::operator< ( const LayoutManager::UIElement& aUIElement ) const -{ - if ( !m_xUIElement.is() && aUIElement.m_xUIElement.is() ) - return false; - else if ( m_xUIElement.is() && !aUIElement.m_xUIElement.is() ) - return true; - else if ( !m_bVisible && aUIElement.m_bVisible ) - return false; - else if ( m_bVisible && !aUIElement.m_bVisible ) - return true; - else if ( !m_bFloating && aUIElement.m_bFloating ) - return true; - else if ( m_bFloating && !aUIElement.m_bFloating ) - return false; - else - { - if ( m_bFloating ) - { - bool bEqual = ( m_aFloatingData.m_aPos.Y() == aUIElement.m_aFloatingData.m_aPos.Y() ); - if ( bEqual ) - return ( m_aFloatingData.m_aPos.X() < aUIElement.m_aFloatingData.m_aPos.X() ); - else - return ( m_aFloatingData.m_aPos.Y() < aUIElement.m_aFloatingData.m_aPos.Y() ); - } - else - { - if ( m_aDockedData.m_nDockedArea < aUIElement.m_aDockedData.m_nDockedArea ) - return true; - else if ( m_aDockedData.m_nDockedArea > aUIElement.m_aDockedData.m_nDockedArea ) - return false; - else - { - if ( m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_TOP || - m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_BOTTOM ) - { - if ( !( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ) ) - return ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() ); - else - { - bool bEqual = ( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ); - if ( bEqual ) - { - return m_bUserActive && !aUIElement.m_bUserActive; - } - else - return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() ); - } - } - else - { - if ( !( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ) ) - return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() ); - else - { - bool bEqual = ( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ); - if ( bEqual ) - { - return m_bUserActive && !aUIElement.m_bUserActive; - } - else - return ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() ); - } - } - } - } - } -} - -LayoutManager::UIElement& LayoutManager::UIElement::operator= ( const LayoutManager::UIElement& rUIElement ) -{ - if (this == &rUIElement) { return *this; } - m_aType = rUIElement.m_aType; - m_aName = rUIElement.m_aName; - m_aUIName = rUIElement.m_aUIName; - m_xUIElement = rUIElement.m_xUIElement; - m_bFloating = rUIElement.m_bFloating; - m_bVisible = rUIElement.m_bVisible; - m_bUserActive = rUIElement.m_bUserActive; - m_bCreateNewRowCol0 = rUIElement.m_bCreateNewRowCol0; - m_bDeactiveHide = rUIElement.m_bDeactiveHide; - m_bMasterHide = rUIElement.m_bMasterHide; - m_bContextSensitive = rUIElement.m_bContextSensitive; - m_bContextActive = rUIElement.m_bContextActive; - m_bNoClose = rUIElement.m_bNoClose; - m_bSoftClose = rUIElement.m_bSoftClose; - m_bStateRead = rUIElement.m_bStateRead; - m_nStyle = rUIElement.m_nStyle; - m_aDockedData = rUIElement.m_aDockedData; - m_aFloatingData = rUIElement.m_aFloatingData; - return *this; -} - -static Reference< XModel > impl_getModelFromFrame( const Reference< XFrame >& rFrame ) -{ - // Query for the model to get check the context information - Reference< XModel > xModel; - if ( rFrame.is() ) - { - Reference< XController > xController( rFrame->getController(), UNO_QUERY ); - if ( xController.is() ) - xModel = xController->getModel(); - } - - return xModel; -} - -static sal_Bool implts_isPreviewModel( const Reference< XModel >& xModel ) -{ - if ( xModel.is() ) - { - ::comphelper::MediaDescriptor aDesc( xModel->getArgs() ); - return aDesc.getUnpackedValueOrDefault(::comphelper::MediaDescriptor::PROP_PREVIEW(), (sal_Bool)sal_False); - } - else - return sal_False; -} - -static sal_Bool implts_isFrameOrWindowTop( const css::uno::Reference< css::frame::XFrame >& xFrame ) -{ - if (xFrame->isTop()) - return sal_True; - - css::uno::Reference< css::awt::XTopWindow > xWindowCheck(xFrame->getContainerWindow(), css::uno::UNO_QUERY); // dont use _THROW here ... its a check only - if (xWindowCheck.is()) - { - // --> PB 2007-06-18 #i76867# top and system window is required. - ::vos::OGuard aSolarLock(&Application::GetSolarMutex()); - css::uno::Reference< css::awt::XWindow > xWindow( xWindowCheck, UNO_QUERY ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - return ( pWindow && pWindow->IsSystemWindow() ); - // <-- - } - - return sal_False; -} - -static void impl_setDockingWindowVisibility( const css::uno::Reference< css::lang::XMultiServiceFactory>& rSMGR, const css::uno::Reference< css::frame::XFrame >& rFrame, const ::rtl::OUString& rDockingWindowName, bool bVisible ) -{ - const ::rtl::OUString aDockWinPrefixCommand( RTL_CONSTASCII_USTRINGPARAM( "DockingWindow" )); - css::uno::WeakReference< css::frame::XDispatchHelper > xDispatchHelper; - - sal_Int32 nID = rDockingWindowName.toInt32(); - sal_Int32 nIndex = nID - DOCKWIN_ID_BASE; - - css::uno::Reference< css::frame::XDispatchProvider > xProvider(rFrame, css::uno::UNO_QUERY); - if ( nIndex >= 0 && xProvider.is() ) - { - ::rtl::OUString aDockWinCommand( RTL_CONSTASCII_USTRINGPARAM( ".uno:" )); - ::rtl::OUString aDockWinArgName( aDockWinPrefixCommand ); - - aDockWinArgName += ::rtl::OUString::valueOf( nIndex ); - - css::uno::Sequence< css::beans::PropertyValue > aArgs(1); - aArgs[0].Name = aDockWinArgName; - aArgs[0].Value = css::uno::makeAny( bVisible ); - - css::uno::Reference< css::frame::XDispatchHelper > xDispatcher( xDispatchHelper ); - if ( !xDispatcher.is()) - { - xDispatcher = css::uno::Reference< css::frame::XDispatchHelper >( - rSMGR->createInstance(SERVICENAME_DISPATCHHELPER), css::uno::UNO_QUERY_THROW); - } - - aDockWinCommand = aDockWinCommand + aDockWinArgName; - xDispatcher->executeDispatch( - xProvider, - aDockWinCommand, - ::rtl::OUString::createFromAscii("_self"), - 0, - aArgs); - } -} - -//***************************************************************************************************************** -// XInterface, XTypeProvider, XServiceInfo -//***************************************************************************************************************** IMPLEMENT_FORWARD_XTYPEPROVIDER2( LayoutManager, LayoutManager_Base, LayoutManager_PBase ) IMPLEMENT_FORWARD_XINTERFACE2( LayoutManager, LayoutManager_Base, LayoutManager_PBase ) - -DEFINE_XSERVICEINFO_MULTISERVICE ( LayoutManager , - ::cppu::OWeakObject , - SERVICENAME_LAYOUTMANAGER , - IMPLEMENTATIONNAME_LAYOUTMANAGER - ) - -DEFINE_INIT_SERVICE ( LayoutManager, {} ) - - -LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceManager ) - : LayoutManager_Base ( ) - , ThreadHelpBase ( &Application::GetSolarMutex() ) - , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex() ) - , LayoutManager_PBase ( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) - , m_xSMGR( xServiceManager ) - , m_xURLTransformer( xServiceManager->createInstance( SERVICENAME_URLTRANSFORMER ), UNO_QUERY ) - , m_xDisplayAccess( xServiceManager->createInstance( SERVICENAME_DISPLAYACCESS ), UNO_QUERY ) - , m_nLockCount( 0 ) - , m_bActive( sal_False ) - , m_bInplaceMenuSet( sal_False ) - , m_bDockingInProgress( sal_False ) - , m_bMenuVisible( sal_True ) - , m_bComponentAttached( sal_False ) - , m_bDoLayout( sal_False ) - , m_bVisible( sal_True ) - , m_bParentWindowVisible( sal_False ) - , m_bMustDoLayout( sal_True ) - , m_bAutomaticToolbars( sal_True ) - , m_bStoreWindowState( sal_False ) - , m_bHideCurrentUI( false ) - , m_bGlobalSettings( sal_False ) - , m_bPreserveContentSize( false ) - , m_eDockOperation( DOCKOP_ON_COLROW ) - , m_pInplaceMenuBar( NULL ) - , m_xModuleManager( Reference< XModuleManager >( - xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) - , m_xUIElementFactoryManager( Reference< ::com::sun::star::ui::XUIElementFactory >( +DEFINE_XSERVICEINFO_MULTISERVICE( LayoutManager, ::cppu::OWeakObject, SERVICENAME_LAYOUTMANAGER, IMPLEMENTATIONNAME_LAYOUTMANAGER) +DEFINE_INIT_SERVICE( LayoutManager, {} ) + +LayoutManager::LayoutManager( const Reference< XMultiServiceFactory >& xServiceManager ) : LayoutManager_Base() + , ThreadHelpBase( &Application::GetSolarMutex()) + , ::cppu::OBroadcastHelperVar< ::cppu::OMultiTypeInterfaceContainerHelper, ::cppu::OMultiTypeInterfaceContainerHelper::keyType >( m_aLock.getShareableOslMutex()) + , LayoutManager_PBase( *(static_cast< ::cppu::OBroadcastHelper* >(this)) ) + , m_xSMGR( xServiceManager ) + , m_xURLTransformer( xServiceManager->createInstance( SERVICENAME_URLTRANSFORMER ), UNO_QUERY ) + , m_xDisplayAccess( xServiceManager->createInstance( SERVICENAME_DISPLAYACCESS ), UNO_QUERY ) + , m_nLockCount( 0 ) + , m_bActive( false ) + , m_bInplaceMenuSet( false ) + , m_bDockingInProgress( false ) + , m_bMenuVisible( true ) + , m_bComponentAttached( false ) + , m_bDoLayout( false ) + , m_bVisible( true ) + , m_bParentWindowVisible( false ) + , m_bMustDoLayout( true ) + , m_bAutomaticToolbars( true ) + , m_bStoreWindowState( false ) + , m_bHideCurrentUI( false ) + , m_bGlobalSettings( false ) + , m_bPreserveContentSize( false ) + , m_bMenuBarCloser( false ) + , m_pInplaceMenuBar( NULL ) + , m_xModuleManager( Reference< XModuleManager >( xServiceManager->createInstance( SERVICENAME_MODULEMANAGER ), UNO_QUERY )) + , m_xUIElementFactoryManager( Reference< ui::XUIElementFactory >( xServiceManager->createInstance( SERVICENAME_UIELEMENTFACTORYMANAGER ), UNO_QUERY )) - , m_bMenuBarCloser( sal_False ) - , m_xPersistentWindowStateSupplier( Reference< XNameAccess >( + , m_xPersistentWindowStateSupplier( Reference< XNameAccess >( xServiceManager->createInstance( SERVICENAME_WINDOWSTATECONFIGURATION ), UNO_QUERY )) - , m_pGlobalSettings( 0 ) - , m_aCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "custom_" )) - , m_aFullCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/custom_" )) - , m_aFullAddonTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )) - , m_aStatusBarAlias( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )) - , m_aProgressBarAlias( RTL_CONSTASCII_USTRINGPARAM( "private:resource/progressbar/progressbar" )) - , m_aPropDocked( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_DOCKED )) - , m_aPropVisible( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_VISIBLE )) - , m_aPropDockingArea( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_DOCKINGAREA )) - , m_aPropDockPos( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_DOCKPOS )) - , m_aPropPos( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_POS )) - , m_aPropSize( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_SIZE )) - , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_UINAME )) - , m_aPropStyle( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_STYLE )) - , m_aPropLocked( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_LOCKED )) - , m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" )) - , m_pAddonOptions( 0 ) - , m_aListenerContainer( m_aLock.getShareableOslMutex() ) + , m_pGlobalSettings( 0 ) + , m_aStatusBarAlias( RTL_CONSTASCII_USTRINGPARAM( "private:resource/statusbar/statusbar" )) + , m_aProgressBarAlias( RTL_CONSTASCII_USTRINGPARAM( "private:resource/progressbar/progressbar" )) + , m_aPropDocked( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_DOCKED )) + , m_aPropVisible( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_VISIBLE )) + , m_aPropDockingArea( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_DOCKINGAREA )) + , m_aPropDockPos( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_DOCKPOS )) + , m_aPropPos( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_POS )) + , m_aPropSize( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_SIZE )) + , m_aPropUIName( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_UINAME )) + , m_aPropStyle( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_STYLE )) + , m_aPropLocked( RTL_CONSTASCII_USTRINGPARAM( WINDOWSTATE_PROPERTY_LOCKED )) + , m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" )) + , m_aListenerContainer( m_aLock.getShareableOslMutex() ) + , m_pPanelManager( 0 ) + , m_pToolbarManager( 0 ) { // Initialize statusbar member + const sal_Bool bRefreshVisibility = sal_False; m_aStatusBarElement.m_aType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "statusbar" )); m_aStatusBarElement.m_aName = m_aStatusBarAlias; - m_pMiscOptions = new SvtMiscOptions(); + m_pToolbarManager = new ToolbarLayoutManager( xServiceManager, m_xUIElementFactoryManager, this ); + m_xToolbarManager = uno::Reference< ui::XUIConfigurationListener >( static_cast< OWeakObject* >( m_pToolbarManager ), uno::UNO_QUERY ); - m_pMiscOptions->AddListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); Application::AddEventListener( LINK( this, LayoutManager, SettingsChanged ) ); - m_eSymbolsSize = m_pMiscOptions->GetSymbolsSize(); - m_eSymbolsStyle = m_pMiscOptions->GetCurrentSymbolsStyle(); m_aAsyncLayoutTimer.SetTimeout( 50 ); m_aAsyncLayoutTimer.SetTimeoutHdl( LINK( this, LayoutManager, AsyncLayoutHdl ) ); - registerProperty( LAYOUTMANAGER_PROPNAME_AUTOMATICTOOLBARS, LAYOUTMANAGER_PROPHANDLE_AUTOMATICTOOLBARS, css::beans::PropertyAttribute::TRANSIENT, &m_bAutomaticToolbars, ::getCppuType( &m_bAutomaticToolbars ) ); - registerProperty( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, css::beans::PropertyAttribute::TRANSIENT, &m_bHideCurrentUI, ::getCppuType( &m_bHideCurrentUI ) ); - registerProperty( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, css::beans::PropertyAttribute::TRANSIENT | css::beans::PropertyAttribute::READONLY, &m_nLockCount, getCppuType( &m_nLockCount ) ); - registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, css::beans::PropertyAttribute::TRANSIENT, &m_bMenuBarCloser, ::getCppuType( &m_bMenuBarCloser ) ); - const sal_Bool bRefreshVisibility = sal_False; - registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, css::beans::PropertyAttribute::TRANSIENT, ::getCppuType( &bRefreshVisibility ), &bRefreshVisibility ); - registerProperty( LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE, LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, css::beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, ::getCppuType( &m_bPreserveContentSize ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_HIDECURRENTUI, LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI, beans::PropertyAttribute::TRANSIENT, &m_bHideCurrentUI, ::getCppuType( &m_bHideCurrentUI ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_LOCKCOUNT, LAYOUTMANAGER_PROPHANDLE_LOCKCOUNT, beans::PropertyAttribute::TRANSIENT | beans::PropertyAttribute::READONLY, &m_nLockCount, getCppuType( &m_nLockCount ) ); + registerProperty( LAYOUTMANAGER_PROPNAME_MENUBARCLOSER, LAYOUTMANAGER_PROPHANDLE_MENUBARCLOSER, beans::PropertyAttribute::TRANSIENT, &m_bMenuBarCloser, ::getCppuType( &m_bMenuBarCloser ) ); + registerPropertyNoMember( LAYOUTMANAGER_PROPNAME_REFRESHVISIBILITY, LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY, beans::PropertyAttribute::TRANSIENT, ::getCppuType( &bRefreshVisibility ), &bRefreshVisibility ); + registerProperty( LAYOUTMANAGER_PROPNAME_PRESERVE_CONTENT_SIZE, LAYOUTMANAGER_PROPHANDLE_PRESERVE_CONTENT_SIZE, beans::PropertyAttribute::TRANSIENT, &m_bPreserveContentSize, ::getCppuType( &m_bPreserveContentSize ) ); } LayoutManager::~LayoutManager() { Application::RemoveEventListener( LINK( this, LayoutManager, SettingsChanged ) ); - if ( m_pMiscOptions ) - { - m_pMiscOptions->RemoveListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); - delete m_pMiscOptions; - m_pMiscOptions = 0; - } m_aAsyncLayoutTimer.Stop(); } @@ -457,18 +198,15 @@ void LayoutManager::impl_clearUpMenuBar() { vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - - if ( pWindow ) + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) { MenuBar* pSetMenuBar = 0; if ( m_xInplaceMenuBar.is() ) pSetMenuBar = (MenuBar *)m_pInplaceMenuBar->GetMenuBar(); else { - Reference< css::awt::XMenuBar > xMenuBar; + Reference< awt::XMenuBar > xMenuBar; Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY ); if ( xPropSet.is() ) @@ -477,12 +215,8 @@ void LayoutManager::impl_clearUpMenuBar() { xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" ))) >>= xMenuBar; } - catch ( com::sun::star::beans::UnknownPropertyException ) - { - } - catch ( com::sun::star::lang::WrappedTargetException ) - { - } + catch ( beans::UnknownPropertyException ) {} + catch ( lang::WrappedTargetException ) {} } VCLXMenu* pAwtMenuBar = VCLXMenu::GetImplementation( xMenuBar ); @@ -490,9 +224,9 @@ void LayoutManager::impl_clearUpMenuBar() pSetMenuBar = (MenuBar*)pAwtMenuBar->GetMenu(); } - MenuBar* pTopMenuBar = ((SystemWindow *)pWindow)->GetMenuBar(); + MenuBar* pTopMenuBar = pSysWindow->GetMenuBar(); if ( pSetMenuBar == pTopMenuBar ) - ((SystemWindow *)pWindow)->SetMenuBar( 0 ); + pSysWindow->SetMenuBar( 0 ); } } @@ -511,45 +245,17 @@ void LayoutManager::impl_clearUpMenuBar() implts_unlock(); } -sal_Bool LayoutManager::impl_parseResourceURL( const rtl::OUString aResourceURL, rtl::OUString& aElementType, rtl::OUString& aElementName ) -{ - URL aURL; - sal_Int32 nIndex = 0; - - aURL.Complete = aResourceURL; - m_xURLTransformer->parseStrict( aURL ); - - ::rtl::OUString aUIResource = aURL.Path.getToken( 0, (sal_Unicode)'/', nIndex ); - - if (( aURL.Protocol.equalsIgnoreAsciiCaseAscii( UIRESOURCE_PROTOCO_ASCII )) && - ( aUIResource.equalsIgnoreAsciiCaseAscii( UIRESOURCE_RESOURCE_ASCII ))) - { - aElementType = aURL.Path.getToken( 0, (sal_Unicode)'/', nIndex ); - aElementName = aURL.Path.getToken( 0, (sal_Unicode)'/', nIndex ); - return sal_True; - } - - return sal_False; -} - void LayoutManager::implts_lock() { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); ++m_nLockCount; - aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } sal_Bool LayoutManager::implts_unlock() { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - --m_nLockCount; - if ( m_nLockCount < 0 ) - m_nLockCount = 0; + m_nLockCount = std::max( --m_nLockCount, static_cast<sal_Int32>(0) ); return ( m_nLockCount == 0 ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } void LayoutManager::implts_reset( sal_Bool bAttached ) @@ -557,18 +263,16 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); Reference< XFrame > xFrame = m_xFrame; - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); - Reference< css::awt::XWindow > xTopDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; - Reference< css::awt::XWindow > xLeftDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT]; - Reference< css::awt::XWindow > xRightDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT]; - Reference< css::awt::XWindow > xBottomDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM]; + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); Reference< XUIConfiguration > xModuleCfgMgr( m_xModuleCfgMgr, UNO_QUERY ); Reference< XUIConfiguration > xDocCfgMgr( m_xDocCfgMgr, UNO_QUERY ); Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); Reference< XMultiServiceFactory > xServiceManager( m_xSMGR ); Reference< XNameAccess > xPersistentWindowStateSupplier( m_xPersistentWindowStateSupplier ); + Reference< awt::XWindowListener > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); ::rtl::OUString aModuleIdentifier( m_aModuleIdentifier ); - sal_Bool bAutomaticToolbars( m_bAutomaticToolbars ); + bool bAutomaticToolbars( m_bAutomaticToolbars ); aReadLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -584,9 +288,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) { aModuleIdentifier = m_xModuleManager->identify( Reference< XInterface >( xFrame, UNO_QUERY ) ); } - catch( Exception& ) - { - } + catch( Exception& ) {} if ( aModuleIdentifier.getLength() && aOldModuleIdentifier != aModuleIdentifier ) { @@ -602,9 +304,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) // Remove listener to old module ui configuration manager xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } try @@ -614,9 +314,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) if ( xModuleCfgMgr.is() ) xModuleCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} try { @@ -624,12 +322,8 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) if ( xPersistentWindowStateSupplier.is() ) xPersistentWindowStateSupplier->getByName( aModuleIdentifier ) >>= xPersistentWindowState; } - catch ( NoSuchElementException& ) - { - } - catch ( WrappedTargetException& ) - { - } + catch ( NoSuchElementException& ) {} + catch ( WrappedTargetException& ) {} } xModel = impl_getModelFromFrame( xFrame ); @@ -645,9 +339,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) // Remove listener to old ui configuration manager xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } try @@ -656,9 +348,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) if ( xDocCfgMgr.is() ) xDocCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } } } @@ -672,9 +362,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } if ( xDocCfgMgr.is() ) @@ -684,9 +372,7 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } // Release references to our configuration managers as we currently don't have @@ -697,47 +383,39 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) aModuleIdentifier = ::rtl::OUString(); } + Reference< XUIConfigurationManager > xModCfgMgr( xModuleCfgMgr, UNO_QUERY ); + Reference< XUIConfigurationManager > xDokCfgMgr( xDocCfgMgr, UNO_QUERY ); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_xModel = xModel; - m_aDockingArea = css::awt::Rectangle(); + m_aDockingArea = awt::Rectangle(); m_bComponentAttached = bAttached; m_aModuleIdentifier = aModuleIdentifier; - m_xModuleCfgMgr = Reference< XUIConfigurationManager >( xModuleCfgMgr, UNO_QUERY ); - m_xDocCfgMgr = Reference< XUIConfigurationManager >( xDocCfgMgr, UNO_QUERY ); + m_xModuleCfgMgr = xModCfgMgr; + m_xDocCfgMgr = xDokCfgMgr; m_xPersistentWindowState = xPersistentWindowState; m_aStatusBarElement.m_bStateRead = sal_False; // reset state to read data again! aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - if ( bAttached ) + // reset/notify toolbar layout manager + if ( pToolbarManager ) { - // reset docking area windows back to zero size - try + if ( bAttached ) { - if ( xTopDockingWindow.is() ) - xTopDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - if ( xLeftDockingWindow.is() ) - xLeftDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - if ( xRightDockingWindow.is() ) - xRightDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - if ( xBottomDockingWindow.is() ) - xBottomDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); + pToolbarManager->attach( xFrame, xModCfgMgr, xDokCfgMgr, xPersistentWindowState ); + uno::Reference< awt::XWindowPeer > xParent( xContainerWindow, UNO_QUERY ); + pToolbarManager->setParentWindow( xParent ); + if ( bAutomaticToolbars ) + pToolbarManager->createStaticToolbars(); } - catch ( Exception& ) - { - } - - if ( bAutomaticToolbars ) + else { - implts_createCustomToolBars(); - implts_createAddonsToolBars(); - implts_createNonContextSensitiveToolBars(); + pToolbarManager->reset(); + implts_destroyElements(); } - implts_sortUIElements(); } - else - implts_destroyElements(); } implts_unlock(); @@ -745,15 +423,12 @@ void LayoutManager::implts_reset( sal_Bool bAttached ) sal_Bool LayoutManager::implts_isEmbeddedLayoutManager() const { - // check if this layout manager is currently using the embedded feature - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); Reference< XFrame > xFrame = m_xFrame; - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - Reference< css::awt::XWindow > xFrameContainerWindow = xFrame->getContainerWindow(); + Reference< awt::XWindow > xFrameContainerWindow = xFrame->getContainerWindow(); if ( xFrameContainerWindow == xContainerWindow ) return sal_False; else @@ -762,20 +437,13 @@ sal_Bool LayoutManager::implts_isEmbeddedLayoutManager() const void LayoutManager::implts_destroyElements() { - UIElementVector aUIElementVector; - WriteGuard aWriteLock( m_aLock ); - aUIElementVector = m_aUIElements; - m_aUIElements.clear(); + uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; aWriteLock.unlock(); - UIElementVector::iterator pIter; - for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) - { - Reference< XComponent > xComponent( pIter->m_xUIElement, UNO_QUERY ); - if ( xComponent.is() ) - xComponent->dispose(); - } + if ( pToolbarManager ) + pToolbarManager->destroyToolbars(); implts_destroyStatusBar(); @@ -784,592 +452,49 @@ void LayoutManager::implts_destroyElements() aWriteLock.unlock(); } -void LayoutManager::implts_destroyDockingAreaWindows() -{ - std::vector< Reference< css::awt::XWindow > > oldDockingAreaWindows; - - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - WriteGuard aWriteLock( m_aLock ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP] ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM] ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT] ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT] ); - - m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP].clear(); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM].clear(); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT].clear(); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT].clear(); - aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - - const sal_uInt32 nCount = oldDockingAreaWindows.size(); - for ( sal_uInt32 i=0; i < nCount; i++ ) - { - if ( oldDockingAreaWindows[i].is() ) - { - try - { - oldDockingAreaWindows[i]->dispose(); - } - catch ( Exception& ) - { - } - } - } -} - -void LayoutManager::implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle ) -{ - if ( aTbxResName.getLength() > 0 ) - { - createElement( aTbxResName ); - if ( aTitle ) - { - Reference< XUIElement > xUIElement = getElement( aTbxResName ); - if ( xUIElement.is() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - pWindow->SetText( aTitle ); - } - } - } -} - -void LayoutManager::implts_createCustomToolBars( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& aTbxSeqSeq ) -{ - const Sequence< PropertyValue >* pTbxSeq = aTbxSeqSeq.getConstArray(); - for ( sal_Int32 i = 0; i < aTbxSeqSeq.getLength(); i++ ) - { - const Sequence< PropertyValue >& rTbxSeq = pTbxSeq[i]; - ::rtl::OUString aTbxResName; - ::rtl::OUString aTbxTitle; - for ( sal_Int32 j = 0; j < rTbxSeq.getLength(); j++ ) - { - if ( rTbxSeq[j].Name.equalsAscii( "ResourceURL" )) - rTbxSeq[j].Value >>= aTbxResName; - else if ( rTbxSeq[j].Name.equalsAscii( "UIName" )) - rTbxSeq[j].Value >>= aTbxTitle; - } - - // Only create custom toolbars. Their name have to start with "custom_"! - if ( aTbxResName.getLength() > 0 && aTbxResName.indexOf( m_aCustomTbxPrefix ) != -1 ) - implts_createCustomToolBar( aTbxResName, aTbxTitle ); - } -} - -void LayoutManager::implts_createCustomToolBars() -{ - ReadGuard aReadLock( m_aLock ); - if ( !m_bComponentAttached ) - return; - - Reference< XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); - Reference< XFrame > xFrame( m_xFrame ); - Reference< XModel > xModel; - Reference< XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr, UNO_QUERY ); - Reference< XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr, UNO_QUERY ); - aReadLock.unlock(); - - if ( xFrame.is() ) - { - xModel = impl_getModelFromFrame( xFrame ); - if ( implts_isPreviewModel( xModel )) - return; // no custom toolbars for preview frame! - - Sequence< Sequence< PropertyValue > > aTbxSeq; - if ( xDocCfgMgr.is() ) - { - aTbxSeq = xDocCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR ); - implts_createCustomToolBars( aTbxSeq ); // first create all document based toolbars - } - if ( xModuleCfgMgr.is() ) - { - aTbxSeq = xModuleCfgMgr->getUIElementsInfo( UIElementType::TOOLBAR ); - implts_createCustomToolBars( aTbxSeq ); // second create module based toolbars - } - } -} - -rtl::OUString LayoutManager::implts_generateGenericAddonToolbarTitle( sal_Int32 nNumber ) const -{ - String aAddonGenericTitle; - - aAddonGenericTitle = String( FwkResId( STR_TOOLBAR_TITLE_ADDON )); - const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); - - String aNumStr = rI18nHelper.GetNum( nNumber, 0, FALSE, FALSE ); - aAddonGenericTitle.SearchAndReplaceAscii( "%num%", aNumStr ); - - return rtl::OUString( aAddonGenericTitle ); -} - -void LayoutManager::implts_createAddonsToolBars() -{ - WriteGuard aWriteLock( m_aLock ); - if ( !m_bComponentAttached ) - return; - - Reference< XModel > xModel; - Reference< XFrame > xFrame( m_xFrame ); - if ( !xFrame.is() ) - return; - - if ( !m_pAddonOptions ) - m_pAddonOptions = new AddonsOptions; - - Reference< XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); - aWriteLock.unlock(); - - xModel = impl_getModelFromFrame( xFrame ); - if ( implts_isPreviewModel( xModel )) - return; // no addon toolbars for preview frame! - - UIElementVector aUIElementVector; - Sequence< Sequence< PropertyValue > > aAddonToolBarData; - Reference< XUIElement > xUIElement; - - sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); - ::rtl::OUString aAddonsToolBarStaticName( m_aFullAddonTbxPrefix ); - ::rtl::OUString aElementType( RTL_CONSTASCII_USTRINGPARAM( "toolbar" )); - - Sequence< PropertyValue > aPropSeq( 2 ); - aPropSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); - aPropSeq[0].Value <<= xFrame; - aPropSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationData" )); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - ::rtl::OUString aAddonToolBarName( aAddonsToolBarStaticName + m_pAddonOptions->GetAddonsToolbarResourceName(i) ); - aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i ); - aPropSeq[1].Value <<= aAddonToolBarData; - - aWriteLock.lock(); - UIElement aElement = impl_findElement( aAddonToolBarName ); - aWriteLock.unlock(); - - // #i79828 - // It's now possible that we are called more than once. Be sure to not create - // add-on toolbars more than once! - if ( aElement.m_xUIElement.is() ) - continue; - - try - { - xUIElement = xUIElementFactory->createUIElement( aAddonToolBarName, aPropSeq ); - if ( xUIElement.is() ) - { - Reference< css::awt::XDockableWindow > xDockWindow( xUIElement->getRealInterface(), UNO_QUERY ); - if ( xDockWindow.is() ) - { - try - { - xDockWindow->addDockableWindowListener( Reference< css::awt::XDockableWindowListener >( static_cast< OWeakObject * >( this ), UNO_QUERY )); - xDockWindow->enableDocking( sal_True ); - Reference< css::awt::XWindow > xWindow( xDockWindow, UNO_QUERY ); - if ( xWindow.is() ) - xWindow->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject * >( this ), UNO_QUERY )); - } - catch ( Exception& ) - { - } - } - - ::rtl::OUString aGenericAddonTitle = implts_generateGenericAddonToolbarTitle( i+1 ); - - if ( aElement.m_aName.getLength() > 0 ) - { - // Reuse a local entry so we are able to use the latest - // UI changes for this document. - implts_setElementData( aElement, xDockWindow ); - aElement.m_xUIElement = xUIElement; - if ( aElement.m_aUIName.getLength() == 0 ) - { - aElement.m_aUIName = aGenericAddonTitle; - implts_writeWindowStateData( aElement.m_aName, aElement ); - } - } - else - { - // Create new UI element and try to read its state data - UIElement aNewToolbar( aAddonToolBarName, aElementType, xUIElement ); - aNewToolbar.m_bFloating = sal_True; - implts_readWindowStateData( aAddonToolBarName, aNewToolbar ); - implts_setElementData( aNewToolbar, xDockWindow ); - if ( aNewToolbar.m_aUIName.getLength() == 0 ) - { - aNewToolbar.m_aUIName = aGenericAddonTitle; - implts_writeWindowStateData( aNewToolbar.m_aName, aNewToolbar ); - } - implts_insertUIElement( aNewToolbar ); - } - - Reference< css::awt::XWindow > xWindow( xDockWindow, UNO_QUERY ); - if ( xWindow.is() ) - { - // Set generic title for add-on toolbar - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow->GetText().Len() == 0 ) - pWindow->SetText( aGenericAddonTitle ); - if ( pWindow->GetType() == WINDOW_TOOLBOX ) - { - ToolBox* pToolbar = (ToolBox *)pWindow; - pToolbar->SetMenuType(); - } - } - } - } - catch ( NoSuchElementException& ) - { - } - catch ( IllegalArgumentException& ) - { - } - } -} - -void LayoutManager::implts_createNonContextSensitiveToolBars() -{ - ReadGuard aReadLock( m_aLock ); - - if ( !m_xPersistentWindowState.is() || - !m_xFrame.is() || - !m_bComponentAttached ) - return; - - Reference< XFrame > xFrame( m_xFrame ); - - Reference< XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); - Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); - aReadLock.unlock(); - - if ( implts_isPreviewModel( impl_getModelFromFrame( xFrame ))) - return; - - std::vector< rtl::OUString > aMakeVisibleToolbars; - - try - { - Sequence< rtl::OUString > aToolbarNames = xPersistentWindowState->getElementNames(); - - if ( aToolbarNames.getLength() > 0 ) - { - rtl::OUString aElementType; - rtl::OUString aElementName; - rtl::OUString aName; - - Reference< ::com::sun::star::ui::XUIElement > xUIElement; - aMakeVisibleToolbars.reserve(aToolbarNames.getLength()); - WriteGuard aWriteLock( m_aLock ); - - const rtl::OUString* pTbNames = aToolbarNames.getConstArray(); - for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ ) - { - aName = pTbNames[i]; - if ( impl_parseResourceURL( aName, aElementType, aElementName )) - { - // Check that we only create: - // - Toolbars (the statusbar is also member of the persistent window state) - // - Not custom toolbars, there are created with their own method (implts_createCustomToolbars) - if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ) && - aElementName.indexOf( m_aCustomTbxPrefix ) == -1 ) - { - UIElement aNewToolbar( aName, aElementType, xUIElement ); - bool bFound = implts_findElement( aName, aNewToolbar ); - if ( !bFound ) - implts_readWindowStateData( aName, aNewToolbar ); - - if ( aNewToolbar.m_bVisible && - !aNewToolbar.m_bContextSensitive ) - { - if ( !bFound ) - implts_insertUIElement( aNewToolbar ); - aMakeVisibleToolbars.push_back( aName ); - } - } - } - } - } - } - catch ( RuntimeException& e ) - { - throw e; - } - catch ( Exception& ) - { - } - - if ( !aMakeVisibleToolbars.empty() ) - { - implts_lock(); - ::std::for_each( aMakeVisibleToolbars.begin(), aMakeVisibleToolbars.end(),::boost::bind( &LayoutManager::requestElement, this,_1 )); - implts_unlock(); - } -} - void LayoutManager::implts_toggleFloatingUIElementsVisibility( sal_Bool bActive ) { - WriteGuard aWriteLock( m_aLock ); - UIElementVector::iterator pIter; - - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_xUIElement.is() ) - { - Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XWindow > xWindow( xDockWindow, UNO_QUERY ); - if ( xDockWindow.is() && xWindow.is() ) - { - sal_Bool bVisible( sal_True ); - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - bVisible = pWindow->IsVisible(); - - if ( xDockWindow->isFloating() ) - { - if ( bActive ) - { - if ( !bVisible && pIter->m_bDeactiveHide ) - { - pIter->m_bDeactiveHide = sal_False; - // we need VCL here to pass special flags to Show() - if( pWindow ) - pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - //xWindow->setVisible( sal_True ); - } - } - else - { - if ( bVisible ) - { - pIter->m_bDeactiveHide = sal_True; - xWindow->setVisible( sal_False ); - } - } - } - } - } - } -} - -sal_Bool LayoutManager::implts_findElement( const rtl::OUString& aName, rtl::OUString& aElementType, rtl::OUString& aElementName, Reference< XUIElement >& xUIElement ) -{ - if ( impl_parseResourceURL( aName, aElementType, aElementName )) - { - if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) - { - ReadGuard aReadLock( m_aLock ); - xUIElement = m_xMenuBar; - return sal_True; - } - else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || - ( m_aStatusBarElement.m_aName == aName )) - { - ReadGuard aReadLock( m_aLock ); - xUIElement = m_aStatusBarElement.m_xUIElement; - return sal_True; - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) - { - ReadGuard aReadLock( m_aLock ); - xUIElement = m_aProgressBarElement.m_xUIElement; - return sal_True; - } - else - { - UIElementVector::const_iterator pIter; - - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName ) - { - xUIElement = pIter->m_xUIElement; - return sal_True; - } - } - } - } - - return sal_False; -} - -sal_Bool LayoutManager::implts_findElement( const Reference< XInterface >& xUIElement, UIElement& aElementData ) -{ - UIElementVector::const_iterator pIter; - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_xUIElement.is() ) - { - Reference< XInterface > xIfac( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - if ( xIfac == xUIElement ) - { - aElementData = *pIter; - return sal_True; - } - } - } + uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - return sal_False; + if ( pToolbarManager ) + pToolbarManager->setFloatingToolbarsVisibility( bActive ); } -sal_Bool LayoutManager::implts_findElement( const rtl::OUString& aName, UIElement& aElementData ) +uno::Reference< ui::XUIElement > LayoutManager::implts_findElement( const rtl::OUString& aName ) { - UIElementVector::const_iterator pIter; + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName ) - { - aElementData = *pIter; - return sal_True; - } - } + parseResourceURL( aName, aElementType, aElementName ); + if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) + return m_xMenuBar; + else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || ( m_aStatusBarElement.m_aName == aName )) + return m_aStatusBarElement.m_xUIElement; + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) + return m_aProgressBarElement.m_xUIElement; - return sal_False; + return uno::Reference< ui::XUIElement >(); } -LayoutManager::UIElement& LayoutManager::impl_findElement( const rtl::OUString& aName ) +UIElement& LayoutManager::impl_findElement( const rtl::OUString& aName ) { static UIElement aEmptyElement; - UIElementVector::iterator pIter; + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName ) - return *pIter; - } + parseResourceURL( aName, aElementType, aElementName ); + if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || ( m_aStatusBarElement.m_aName == aName )) + return m_aStatusBarElement; + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) + return m_aProgressBarElement; return aEmptyElement; } -sal_Bool LayoutManager::implts_insertUIElement( const UIElement& rUIElement ) -{ - UIElement aTempData; - bool bFound = implts_findElement( rUIElement.m_aName, aTempData ); - -#ifdef DBG_UTIL - if ( bFound ) - { - char aBuffer[256]; - const sal_Int32 MAX_NAME_LENGTH = 128; - ::rtl::OString aName = ::rtl::OUStringToOString( rUIElement.m_aName, RTL_TEXTENCODING_ASCII_US ); - aName = aName.copy( ::std::min( MAX_NAME_LENGTH, aName.getLength() )); - sprintf( aBuffer, "Try to insert an already existing user interface element (%s) into the list\n", aName.getStr() ); - DBG_ASSERT( bFound, aBuffer ); - } -#endif - - bool bResult( false ); - if ( !bFound ) - { - WriteGuard aWriteLock( m_aLock ); - m_aUIElements.push_back( rUIElement ); - bResult = true; - } - return bResult; -} - -void LayoutManager::implts_writeNewStateData( const rtl::OUString aName, const Reference< css::awt::XWindow >& xWindow ) -{ - css::awt::Rectangle aPos; - css::awt::Size aSize; - sal_Bool bVisible( sal_False ); - sal_Bool bFloating( sal_True ); - - if ( xWindow.is() ) - { - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xDockWindow.is() ) - bFloating = xDockWindow->isFloating(); - - Reference< css::awt::XWindow2 > xWindow2( xWindow, UNO_QUERY ); - if( xWindow2.is() ) - { - aPos = xWindow2->getPosSize(); - aSize = xWindow2->getOutputSize(); // always use output size for consistency - bVisible = xWindow2->isVisible(); - } - } - - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = impl_findElement( aName ); - if ( rUIElement.m_xUIElement.is() && xWindow.is() ) - { - rUIElement.m_bVisible = bVisible; - rUIElement.m_bFloating = bFloating; - if ( bFloating ) - { - rUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); - rUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); - } - } - - implts_writeWindowStateData( aName, rUIElement ); - - aWriteLock.unlock(); -} - -void LayoutManager::implts_refreshContextToolbarsVisibility() -{ - std::vector< UIElementVisibility > aToolbarVisibleVector; - - ReadGuard aReadLock( m_aLock ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - if ( !m_bVisible || !m_bAutomaticToolbars ) - return; - - UIElementVisibility aUIElementVisible; - - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aType.equalsAsciiL( "toolbar", 7 )) - { - aUIElementVisible.aName = pIter->m_aName; - aUIElementVisible.bVisible = pIter->m_bVisible; - aToolbarVisibleVector.push_back( aUIElementVisible ); - } - } - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - aReadLock.unlock(); - - UIElement aUIElement; - const sal_uInt32 nCount = aToolbarVisibleVector.size(); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - UIElementVisibility& rToolbar = aToolbarVisibleVector[i]; - - sal_Bool bVisible = rToolbar.bVisible; - if ( implts_readWindowStateData( rToolbar.aName, aUIElement ) && - aUIElement.m_bVisible != bVisible ) - { - WriteGuard aWriteLock( m_aLock ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - UIElement& rUIElement = impl_findElement( rToolbar.aName ); - - if ( rUIElement.m_aName == rToolbar.aName ) - rUIElement.m_bVisible = aUIElement.m_bVisible; - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - aWriteLock.unlock(); - } - } -} - sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, UIElement& rElementData ) { sal_Bool bGetSettingsState( sal_False ); @@ -1411,13 +536,13 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, } else if ( aWindowState[n].Name == m_aPropDockingArea ) { - ::com::sun::star::ui::DockingArea eDockingArea; + ui::DockingArea eDockingArea; if ( aWindowState[n].Value >>= eDockingArea ) rElementData.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); } else if ( aWindowState[n].Name == m_aPropDockPos ) { - css::awt::Point aPoint; + awt::Point aPoint; if ( aWindowState[n].Value >>= aPoint ) { rElementData.m_aDockedData.m_aPos.X() = aPoint.X; @@ -1426,7 +551,7 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, } else if ( aWindowState[n].Name == m_aPropPos ) { - css::awt::Point aPoint; + awt::Point aPoint; if ( aWindowState[n].Value >>= aPoint ) { rElementData.m_aFloatingData.m_aPos.X() = aPoint.X; @@ -1435,7 +560,7 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, } else if ( aWindowState[n].Name == m_aPropSize ) { - css::awt::Size aSize; + awt::Size aSize; if ( aWindowState[n].Value >>= aSize ) { rElementData.m_aFloatingData.m_aSize.Width() = aSize.Width; @@ -1487,7 +612,7 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, m_bGlobalSettings = sal_True; aWriteLock2.unlock(); - css::uno::Any aValue; + uno::Any aValue; sal_Bool bValue = sal_Bool(); if ( pGlobalSettings->GetStateInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR, GlobalSettings::STATEINFO_LOCKED, @@ -1505,9 +630,7 @@ sal_Bool LayoutManager::implts_readWindowStateData( const rtl::OUString& aName, return sal_True; } - catch ( NoSuchElementException& ) - { - } + catch ( NoSuchElementException& ) {} } return sal_False; @@ -1531,14 +654,12 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con // Check persistent flag of the user interface element xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ))) >>= bPersistent; } - catch ( com::sun::star::beans::UnknownPropertyException ) + catch ( beans::UnknownPropertyException ) { // Non-configurable elements should at least store their dimension/position bPersistent = sal_True; } - catch ( com::sun::star::lang::WrappedTargetException ) - { - } + catch ( lang::WrappedTargetException ) {} } if ( bPersistent && xPersistentWindowState.is() ) @@ -1547,49 +668,47 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con { Sequence< PropertyValue > aWindowState( 8 ); - aWindowState[0].Name = m_aPropDocked; - aWindowState[0].Value = makeAny( sal_Bool( !rElementData.m_bFloating )); - aWindowState[1].Name = m_aPropVisible; - aWindowState[1].Value = makeAny( sal_Bool( rElementData.m_bVisible )); + aWindowState[0].Name = m_aPropDocked; + aWindowState[0].Value = makeAny( sal_Bool( !rElementData.m_bFloating )); + aWindowState[1].Name = m_aPropVisible; + aWindowState[1].Value = makeAny( sal_Bool( rElementData.m_bVisible )); - aWindowState[2].Name = m_aPropDockingArea; - aWindowState[2].Value = makeAny( static_cast< DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) ); + aWindowState[2].Name = m_aPropDockingArea; + aWindowState[2].Value = makeAny( static_cast< DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) ); - css::awt::Point aPos; + awt::Point aPos; aPos.X = rElementData.m_aDockedData.m_aPos.X(); aPos.Y = rElementData.m_aDockedData.m_aPos.Y(); - aWindowState[3].Name = m_aPropDockPos; - aWindowState[3].Value <<= aPos; + aWindowState[3].Name = m_aPropDockPos; + aWindowState[3].Value <<= aPos; aPos.X = rElementData.m_aFloatingData.m_aPos.X(); aPos.Y = rElementData.m_aFloatingData.m_aPos.Y(); - aWindowState[4].Name = m_aPropPos; - aWindowState[4].Value <<= aPos; + aWindowState[4].Name = m_aPropPos; + aWindowState[4].Value <<= aPos; - css::awt::Size aSize; + awt::Size aSize; aSize.Width = rElementData.m_aFloatingData.m_aSize.Width(); aSize.Height = rElementData.m_aFloatingData.m_aSize.Height(); - aWindowState[5].Name = m_aPropSize; - aWindowState[5].Value <<= aSize; - aWindowState[6].Name = m_aPropUIName; - aWindowState[6].Value = makeAny( rElementData.m_aUIName ); - aWindowState[7].Name = m_aPropLocked; - aWindowState[7].Value = makeAny( rElementData.m_aDockedData.m_bLocked ); + aWindowState[5].Name = m_aPropSize; + aWindowState[5].Value <<= aSize; + aWindowState[6].Name = m_aPropUIName; + aWindowState[6].Value = makeAny( rElementData.m_aUIName ); + aWindowState[7].Name = m_aPropLocked; + aWindowState[7].Value = makeAny( rElementData.m_aDockedData.m_bLocked ); if ( xPersistentWindowState->hasByName( aName )) { - Reference< XNameReplace > xReplace( xPersistentWindowState, UNO_QUERY ); + Reference< XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY ); xReplace->replaceByName( aName, makeAny( aWindowState )); } else { - Reference< XNameContainer > xInsert( xPersistentWindowState, UNO_QUERY ); + Reference< XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY ); xInsert->insertByName( aName, makeAny( aWindowState )); } } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } // Reset flag @@ -1598,1450 +717,23 @@ void LayoutManager::implts_writeWindowStateData( const rtl::OUString& aName, con aWriteLock.unlock(); } -void LayoutManager::implts_setElementData( UIElement& rElement, const Reference< css::awt::XDockableWindow >& rDockWindow ) -{ - ReadGuard aReadLock( m_aLock ); - sal_Bool bShowElement( rElement.m_bVisible && !rElement.m_bMasterHide && m_bParentWindowVisible ); - aReadLock.unlock(); - - Reference< css::awt::XDockableWindow > xDockWindow( rDockWindow ); - Reference< css::awt::XWindow2 > xWindow( xDockWindow, UNO_QUERY ); - - Window* pWindow( 0 ); - ToolBox* pToolBox( 0 ); - - if ( xDockWindow.is() && xWindow.is() ) - { - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - { - String aText = pWindow->GetText(); - if ( aText.Len() == 0 ) - pWindow->SetText( rElement.m_aUIName ); - if ( rElement.m_bNoClose ) - pWindow->SetStyle( pWindow->GetStyle() & ~WB_CLOSEABLE ); - if ( pWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = (ToolBox *)pWindow; - } - if ( pToolBox ) - { - if (( rElement.m_nStyle < 0 ) || - ( rElement.m_nStyle > BUTTON_SYMBOLTEXT )) - rElement.m_nStyle = BUTTON_SYMBOL; - pToolBox->SetButtonType( (ButtonType)rElement.m_nStyle ); - if ( rElement.m_bNoClose ) - pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE ); - } - } - - if ( rElement.m_bFloating ) - { - if ( pWindow ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - String aText = pWindow->GetText(); - if ( aText.Len() == 0 ) - pWindow->SetText( rElement.m_aUIName ); - } - - ::Point aPos( rElement.m_aFloatingData.m_aPos.X(), - rElement.m_aFloatingData.m_aPos.Y() ); - sal_Bool bWriteData( sal_False ); - sal_Bool bUndefPos = ( rElement.m_aFloatingData.m_aPos.X() == SAL_MAX_INT32 || - rElement.m_aFloatingData.m_aPos.Y() == SAL_MAX_INT32 ); - sal_Bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width() != 0 && - rElement.m_aFloatingData.m_aSize.Height() != 0 ); - xDockWindow->setFloatingMode( sal_True ); - if ( bUndefPos ) - { - aPos = implts_findNextCascadeFloatingPos(); - rElement.m_aFloatingData.m_aPos = aPos; // set new cascaded position - bWriteData = sal_True; - } - - if( bSetSize ) - xWindow->setOutputSize( AWTSize( rElement.m_aFloatingData.m_aSize ) ); - else - { - if( pToolBox ) - { - // set an optimal initial floating size - vos::OGuard aGuard( Application::GetSolarMutex() ); - ::Size aSize( pToolBox->CalcFloatingWindowSizePixel() ); - pToolBox->SetOutputSizePixel( aSize ); - } - } - - // #i60882# IMPORTANT: Set position after size as it is - // possible that we position some part of the toolbar - // outside of the desktop. A default constructed toolbar - // always has one line. Now VCL automatically - // position the toolbar back into the desktop. Therefore - // we resize the toolbar with the new (wrong) position. - // To fix this problem we have to set the size BEFORE the - // position. - xWindow->setPosSize( aPos.X(), aPos.Y(), 0, 0, - css::awt::PosSize::POS ); - - if ( bWriteData ) - implts_writeWindowStateData( rElement.m_aName, rElement ); - if ( bShowElement && pWindow ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pWindow->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - } - } - else - { - ::Point aDockPos; - ::Point aPixelPos; - sal_Bool bSetSize( sal_False ); - ::Size aSize; - - if ( pToolBox ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pToolBox->SetAlign( ImplConvertAlignment(rElement.m_aDockedData.m_nDockedArea ) ); - pToolBox->SetLineCount( 1 ); - if ( rElement.m_aDockedData.m_bLocked ) - xDockWindow->lock(); - aSize = pToolBox->CalcWindowSizePixel(); - bSetSize = sal_True; - - if (( rElement.m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) && - ( rElement.m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 )) - { - implts_findNextDockingPos( (DockingArea)rElement.m_aDockedData.m_nDockedArea, - aSize, - aDockPos, - aPixelPos ); - rElement.m_aDockedData.m_aPos = aDockPos; - } - } - - xWindow->setPosSize( aPixelPos.X(), - aPixelPos.Y(), - 0, 0, - css::awt::PosSize::POS ); - if( bSetSize ) - xWindow->setOutputSize( AWTSize( aSize) ); - - if ( bShowElement && pWindow ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pWindow->Show( sal_True ); - } - } - } -} - -::Point LayoutManager::implts_findNextCascadeFloatingPos() -{ - const sal_Int32 nHotZoneX = 50; - const sal_Int32 nHotZoneY = 50; - const sal_Int32 nCascadeIndentX = 15; - const sal_Int32 nCascadeIndentY = 15; - - ReadGuard aReadLock( m_aLock ); - Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - Reference< css::awt::XWindow > xTopDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; - Reference< css::awt::XWindow > xLeftDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT]; - aReadLock.unlock(); - - ::Point aStartPos( nCascadeIndentX, nCascadeIndentY ); - ::Point aCurrPos( aStartPos ); - css::awt::Rectangle aRect; - - Window* pContainerWindow( 0 ); - if ( xContainerWindow.is() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - if ( pContainerWindow ) - aStartPos = pContainerWindow->OutputToScreenPixel( aStartPos ); - } - - // Determine size of top and left docking area - css::awt::Rectangle aTopRect = xTopDockingWindow->getPosSize(); - css::awt::Rectangle aLeftRect = xLeftDockingWindow->getPosSize(); - - aStartPos.X() += aLeftRect.Width + nCascadeIndentX; - aStartPos.Y() += aTopRect.Height + nCascadeIndentY; - aCurrPos = aStartPos; - - // Try to find a cascaded position for the new floating window - UIElementVector::const_iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_xUIElement.is() ) - { - Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XWindow > xWindow( xDockWindow, UNO_QUERY ); - if ( xDockWindow.is() && xDockWindow->isFloating() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->IsVisible() ) - { - css::awt::Rectangle aFloatRect = xWindow->getPosSize(); - if ((( aFloatRect.X - nHotZoneX ) <= aCurrPos.X() ) && - ( aFloatRect.X >= aCurrPos.X() ) && - (( aFloatRect.Y - nHotZoneY ) <= aCurrPos.Y() ) && - ( aFloatRect.Y >= aCurrPos.Y() )) - { - aCurrPos.X() = aFloatRect.X + nCascadeIndentX; - aCurrPos.Y() = aFloatRect.Y + nCascadeIndentY; - } - } - } - } - } - - return aCurrPos; -} - -void LayoutManager::implts_findNextDockingPos( DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ) -{ - ReadGuard aReadLock( m_aLock ); - Reference< css::awt::XWindow > xDockingWindow = m_xDockAreaWindows[DockingArea]; - ::Size aDockingWinSize; - Window* pDockingWindow( 0 ); - aReadLock.unlock(); - - if (( DockingArea < DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea > DockingArea_DOCKINGAREA_RIGHT )) - DockingArea = DockingArea_DOCKINGAREA_TOP; - - { - // Retrieve output size from container Window - vos::OGuard aGuard( Application::GetSolarMutex() ); - pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ); - if ( pDockingWindow ) - aDockingWinSize = pDockingWindow->GetOutputSizePixel(); - } - - sal_Int32 nFreeRowColPixelPos( 0 ); - sal_Int32 nMaxSpace( 0 ); - sal_Int32 nNeededSpace( 0 ); - sal_Int32 nTopDockingAreaSize( 0 ); - - if (( DockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - nMaxSpace = aDockingWinSize.Width(); - nNeededSpace = aUIElementSize.Width(); - } - else - { - nMaxSpace = aDockingWinSize.Height(); - nNeededSpace = aUIElementSize.Height(); - nTopDockingAreaSize = implts_getTopBottomDockingAreaSizes().Width(); - } - - std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; - - implts_getDockingAreaElementInfos( DockingArea, aRowColumnsWindowData ); - sal_Int32 nPixelPos( 0 ); - const sal_uInt32 nCount = aRowColumnsWindowData.size(); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - SingleRowColumnWindowData& rRowColumnWindowData = aRowColumnsWindowData[i]; - - if (( DockingArea == DockingArea_DOCKINGAREA_BOTTOM ) || - ( DockingArea == DockingArea_DOCKINGAREA_RIGHT )) - nPixelPos += rRowColumnWindowData.nStaticSize; - - if ((( nMaxSpace - rRowColumnWindowData.nVarSize ) >= nNeededSpace ) || - ( rRowColumnWindowData.nSpace >= nNeededSpace )) - { - // Check current row where we can find the needed space - sal_Int32 nCurrPos( 0 ); - const sal_uInt32 nWindowSizesCount = rRowColumnWindowData.aRowColumnWindowSizes.size(); - for ( sal_uInt32 j = 0; j < nWindowSizesCount; j++ ) - { - css::awt::Rectangle rRect = rRowColumnWindowData.aRowColumnWindowSizes[j]; - sal_Int32& rSpace = rRowColumnWindowData.aRowColumnSpace[j]; - if (( DockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - if ( rSpace >= nNeededSpace ) - { - rVirtualPos = ::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); - if ( DockingArea == DockingArea_DOCKINGAREA_TOP ) - rPixelPos = ::Point( nCurrPos, nPixelPos ); - else - rPixelPos = ::Point( nCurrPos, aDockingWinSize.Height() - nPixelPos ); - return; - } - nCurrPos = rRect.X + rRect.Width; - } - else - { - if ( rSpace >= nNeededSpace ) - { - rVirtualPos = ::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); - if ( DockingArea == DockingArea_DOCKINGAREA_LEFT ) - rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos ); - else - rPixelPos = ::Point( aDockingWinSize.Width() - nPixelPos , nTopDockingAreaSize + nCurrPos ); - return; - } - nCurrPos = rRect.Y + rRect.Height; - } - } - - if (( nCurrPos + nNeededSpace ) <= nMaxSpace ) - { - if (( DockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - rVirtualPos = ::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); - if ( DockingArea == DockingArea_DOCKINGAREA_TOP ) - rPixelPos = ::Point( nCurrPos, nPixelPos ); - else - rPixelPos = ::Point( nCurrPos, aDockingWinSize.Height() - nPixelPos ); - return; - } - else - { - rVirtualPos = ::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); - if ( DockingArea == DockingArea_DOCKINGAREA_LEFT ) - rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos ); - else - rPixelPos = ::Point( aDockingWinSize.Width() - nPixelPos , nTopDockingAreaSize + nCurrPos ); - return; - } - } - } - - if (( DockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea == DockingArea_DOCKINGAREA_LEFT )) - nPixelPos += rRowColumnWindowData.nStaticSize; - } - - sal_Int32 nNextFreeRowCol( 0 ); - sal_Int32 nRowColumnsCount = aRowColumnsWindowData.size(); - if ( nRowColumnsCount > 0 ) - nNextFreeRowCol = aRowColumnsWindowData[nRowColumnsCount-1].nRowColumn+1; - else - nNextFreeRowCol = 0; - - if ( nNextFreeRowCol == 0 ) - { - if ( DockingArea == DockingArea_DOCKINGAREA_BOTTOM ) - nFreeRowColPixelPos = aDockingWinSize.Height() - aUIElementSize.Height(); - else if ( DockingArea == DockingArea_DOCKINGAREA_RIGHT ) - nFreeRowColPixelPos = aDockingWinSize.Width() - aUIElementSize.Width(); - } - - if (( DockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - rVirtualPos = ::Point( 0, nNextFreeRowCol ); - if ( DockingArea == DockingArea_DOCKINGAREA_TOP ) - rPixelPos = ::Point( 0, nFreeRowColPixelPos ); - else - rPixelPos = ::Point( 0, aDockingWinSize.Height() - nFreeRowColPixelPos ); - } - else - { - rVirtualPos = ::Point( nNextFreeRowCol, 0 ); - rPixelPos = ::Point( aDockingWinSize.Width() - nFreeRowColPixelPos, 0 ); - } -} - ::Size LayoutManager::implts_getContainerWindowOutputSize() { - ReadGuard aReadLock( m_aLock ); - Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - ::Size aContainerWinSize; + ::Size aContainerWinSize; Window* pContainerWindow( 0 ); - aReadLock.unlock(); // Retrieve output size from container Window vos::OGuard aGuard( Application::GetSolarMutex() ); - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); if ( pContainerWindow ) - return pContainerWindow->GetOutputSizePixel(); - else - return ::Size(); -} - -void LayoutManager::implts_sortUIElements() -{ - WriteGuard aWriteLock( m_aLock ); - UIElementVector::iterator pIterStart = m_aUIElements.begin(); - UIElementVector::iterator pIterEnd = m_aUIElements.end(); - - std::stable_sort( pIterStart, pIterEnd ); // first created element should first - - // We have to reset our temporary flags. - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - // why check, just set it to false - //if ( pIter->m_bUserActive ) - pIter->m_bUserActive = sal_False; - } - -#ifdef DBG_UTIL - implts_checkElementContainer(); -#endif - aWriteLock.unlock(); -} - -void LayoutManager::implts_getDockingAreaElementInfos( DockingArea eDockingArea, std::vector< SingleRowColumnWindowData >& rRowColumnsWindowData ) -{ - std::vector< UIElement > aWindowVector; - - if (( eDockingArea < DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea > DockingArea_DOCKINGAREA_RIGHT )) - eDockingArea = DockingArea_DOCKINGAREA_TOP; - - Reference< css::awt::XWindow > xDockAreaWindow; - - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - ReadGuard aReadLock( m_aLock ); - aWindowVector.reserve(m_aUIElements.size()); - xDockAreaWindow = m_xDockAreaWindows[eDockingArea]; - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea && pIter->m_bVisible && !pIter->m_bFloating ) - { - Reference< XUIElement > xUIElement( pIter->m_xUIElement ); - if ( xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xDockWindow.is() ) - { - // docked windows - aWindowVector.push_back( *pIter ); - } - } - } - } - aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - - rRowColumnsWindowData.clear(); - - // Collect data from windows that are on the same row/column - sal_Int32 j; - sal_Int32 nIndex( 0 ); - sal_Int32 nLastPos( 0 ); - sal_Int32 nCurrPos( -1 ); - sal_Int32 nLastRowColPixelPos( 0 ); - css::awt::Rectangle aDockAreaRect; - - if ( xDockAreaWindow.is() ) - aDockAreaRect = xDockAreaWindow->getPosSize(); - - if ( eDockingArea == DockingArea_DOCKINGAREA_TOP ) - nLastRowColPixelPos = 0; - else if ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM ) - nLastRowColPixelPos = aDockAreaRect.Height; - else if ( eDockingArea == DockingArea_DOCKINGAREA_LEFT ) - nLastRowColPixelPos = 0; - else - nLastRowColPixelPos = aDockAreaRect.Width; - - const sal_uInt32 nCount = aWindowVector.size(); - for ( j = 0; j < sal_Int32( nCount); j++ ) - { - const UIElement& rElement = aWindowVector[j]; - Reference< css::awt::XWindow > xWindow; - Reference< XUIElement > xUIElement( rElement.m_xUIElement ); - css::awt::Rectangle aPosSize; - if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) ) - continue; - if (( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - if ( nCurrPos == -1 ) - { - nCurrPos = rElement.m_aDockedData.m_aPos.Y(); - nLastPos = 0; - - SingleRowColumnWindowData aRowColumnWindowData; - aRowColumnWindowData.nRowColumn = nCurrPos; - rRowColumnsWindowData.push_back( aRowColumnWindowData ); - } - - sal_Int32 nSpace( 0 ); - if ( rElement.m_aDockedData.m_aPos.Y() != nCurrPos ) - { - if ( eDockingArea == DockingArea_DOCKINGAREA_TOP ) - nLastRowColPixelPos += rRowColumnsWindowData[nIndex].nStaticSize; - else - nLastRowColPixelPos -= rRowColumnsWindowData[nIndex].nStaticSize; - ++nIndex; - nLastPos = 0; - nCurrPos = rElement.m_aDockedData.m_aPos.Y(); - SingleRowColumnWindowData aRowColumnWindowData; - aRowColumnWindowData.nRowColumn = nCurrPos; - rRowColumnsWindowData.push_back( aRowColumnWindowData ); - } - - // Calc space before an element and store it - nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos ); - if ( rElement.m_aDockedData.m_aPos.X() >= nLastPos ) - { - rRowColumnsWindowData[nIndex].nSpace += nSpace; - nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; - } - else - { - nSpace = 0; - nLastPos += aPosSize.Width; - } - rRowColumnsWindowData[nIndex].aRowColumnSpace.push_back( nSpace ); - - rRowColumnsWindowData[nIndex].aRowColumnWindows.push_back( xWindow ); - rRowColumnsWindowData[nIndex].aUIElementNames.push_back( rElement.m_aName ); - rRowColumnsWindowData[nIndex].aRowColumnWindowSizes.push_back( - css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), - rElement.m_aDockedData.m_aPos.Y(), - aPosSize.Width, - aPosSize.Height )); - if ( rRowColumnsWindowData[nIndex].nStaticSize < aPosSize.Height ) - rRowColumnsWindowData[nIndex].nStaticSize = aPosSize.Height; - if ( eDockingArea == DockingArea_DOCKINGAREA_TOP ) - rRowColumnsWindowData[nIndex].aRowColumnRect = css::awt::Rectangle( 0, nLastRowColPixelPos, - aDockAreaRect.Width, aPosSize.Height ); - else - rRowColumnsWindowData[nIndex].aRowColumnRect = css::awt::Rectangle( 0, ( nLastRowColPixelPos - aPosSize.Height ), - aDockAreaRect.Width, aPosSize.Height ); - rRowColumnsWindowData[nIndex].nVarSize += aPosSize.Width + nSpace; - } - else - { - if ( nCurrPos == -1 ) - { - nCurrPos = rElement.m_aDockedData.m_aPos.X(); - nLastPos = 0; - - SingleRowColumnWindowData aRowColumnWindowData; - aRowColumnWindowData.nRowColumn = nCurrPos; - rRowColumnsWindowData.push_back( aRowColumnWindowData ); - } - - sal_Int32 nSpace( 0 ); - if ( rElement.m_aDockedData.m_aPos.X() != nCurrPos ) - { - if ( eDockingArea == DockingArea_DOCKINGAREA_LEFT ) - nLastRowColPixelPos += rRowColumnsWindowData[nIndex].nStaticSize; - else - nLastRowColPixelPos -= rRowColumnsWindowData[nIndex].nStaticSize; - ++nIndex; - nLastPos = 0; - nCurrPos = rElement.m_aDockedData.m_aPos.X(); - SingleRowColumnWindowData aRowColumnWindowData; - aRowColumnWindowData.nRowColumn = nCurrPos; - rRowColumnsWindowData.push_back( aRowColumnWindowData ); - } - - // Calc space before an element and store it - nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos ); - if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos ) - { - rRowColumnsWindowData[nIndex].nSpace += nSpace; - nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; - } - else - { - nSpace = 0; - nLastPos += aPosSize.Height; - } - rRowColumnsWindowData[nIndex].aRowColumnSpace.push_back( nSpace ); - - rRowColumnsWindowData[nIndex].aRowColumnWindows.push_back( xWindow ); - rRowColumnsWindowData[nIndex].aUIElementNames.push_back( rElement.m_aName ); - rRowColumnsWindowData[nIndex].aRowColumnWindowSizes.push_back( - css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), - rElement.m_aDockedData.m_aPos.Y(), - aPosSize.Width, - aPosSize.Height )); - if ( rRowColumnsWindowData[nIndex].nStaticSize < aPosSize.Width ) - rRowColumnsWindowData[nIndex].nStaticSize = aPosSize.Width; - if ( eDockingArea == DockingArea_DOCKINGAREA_LEFT ) - rRowColumnsWindowData[nIndex].aRowColumnRect = css::awt::Rectangle( nLastRowColPixelPos, 0, - aPosSize.Width, aDockAreaRect.Height ); - else - rRowColumnsWindowData[nIndex].aRowColumnRect = css::awt::Rectangle( ( nLastRowColPixelPos - aPosSize.Width ), 0, - aPosSize.Width, aDockAreaRect.Height ); - rRowColumnsWindowData[nIndex].nVarSize += aPosSize.Height + nSpace; - } - } -} - -void LayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( DockingArea eDockingArea, sal_Int32 nRowCol, SingleRowColumnWindowData& rRowColumnWindowData ) -{ - std::vector< UIElement > aWindowVector; - - if (( eDockingArea < DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea > DockingArea_DOCKINGAREA_RIGHT )) - eDockingArea = DockingArea_DOCKINGAREA_TOP; - - sal_Bool bHorzDockArea = (( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )); - - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - ReadGuard aReadLock( m_aLock ); - UIElementVector::iterator pIter; - UIElementVector::iterator pEnd = m_aUIElements.end(); - for ( pIter = m_aUIElements.begin(); pIter != pEnd; pIter++ ) - { - if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea ) - { - sal_Bool bSameRowCol = bHorzDockArea ? - ( pIter->m_aDockedData.m_aPos.Y() == nRowCol ) : - ( pIter->m_aDockedData.m_aPos.X() == nRowCol ); - Reference< XUIElement > xUIElement( pIter->m_xUIElement ); - - if ( bSameRowCol && xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - if ( xWindow.is() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( pWindow && pIter->m_bVisible && xDockWindow.is() && !pIter->m_bFloating ) - { - // docked windows - aWindowVector.push_back( *pIter ); - } - } - } - } - } - aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - - // Initialize structure - rRowColumnWindowData.aUIElementNames.clear(); - rRowColumnWindowData.aRowColumnWindows.clear(); - rRowColumnWindowData.aRowColumnWindowSizes.clear(); - rRowColumnWindowData.aRowColumnSpace.clear(); - rRowColumnWindowData.nVarSize = 0; - rRowColumnWindowData.nStaticSize = 0; - rRowColumnWindowData.nSpace = 0; - rRowColumnWindowData.nRowColumn = nRowCol; - - // Collect data from windows that are on the same row/column - sal_Int32 j; - sal_Int32 nLastPos( 0 ); - - const sal_uInt32 nCount = aWindowVector.size(); - for ( j = 0; j < sal_Int32( nCount); j++ ) - { - const UIElement& rElement = aWindowVector[j]; - Reference< css::awt::XWindow > xWindow; - Reference< XUIElement > xUIElement( rElement.m_xUIElement ); - css::awt::Rectangle aPosSize; - if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) ) - continue; - - sal_Int32 nSpace; - if (( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos ); - - // Calc space before an element and store it - if ( rElement.m_aDockedData.m_aPos.X() > nLastPos ) - rRowColumnWindowData.nSpace += nSpace; - else - nSpace = 0; - - nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; - - - rRowColumnWindowData.aRowColumnWindowSizes.push_back( - css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), - rElement.m_aDockedData.m_aPos.Y(), - aPosSize.Width, - aPosSize.Height )); - if ( rRowColumnWindowData.nStaticSize < aPosSize.Height ) - rRowColumnWindowData.nStaticSize = aPosSize.Height; - rRowColumnWindowData.nVarSize += aPosSize.Width; - } - else - { - // Calc space before an element and store it - nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos ); - if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos ) - rRowColumnWindowData.nSpace += nSpace; - else - nSpace = 0; - - nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; - - rRowColumnWindowData.aRowColumnWindowSizes.push_back( - css::awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), - rElement.m_aDockedData.m_aPos.Y(), - aPosSize.Width, - aPosSize.Height )); - if ( rRowColumnWindowData.nStaticSize < aPosSize.Width ) - rRowColumnWindowData.nStaticSize = aPosSize.Width; - rRowColumnWindowData.nVarSize += aPosSize.Height; - } - - rRowColumnWindowData.aUIElementNames.push_back( rElement.m_aName ); - rRowColumnWindowData.aRowColumnWindows.push_back( xWindow ); - rRowColumnWindowData.aRowColumnSpace.push_back( nSpace ); - rRowColumnWindowData.nVarSize += nSpace; - } -} - -::Rectangle LayoutManager::implts_determineFrontDockingRect( - DockingArea eDockingArea, - sal_Int32 nRowCol, - const ::Rectangle& rDockedElementRect, - const ::rtl::OUString& rMovedElementName, - const ::Rectangle& rMovedElementRect ) -{ - SingleRowColumnWindowData aRowColumnWindowData; - - sal_Bool bHorzDockArea = (( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )); - - implts_getDockingAreaElementInfoOnSingleRowCol( eDockingArea, nRowCol, aRowColumnWindowData ); - if ( aRowColumnWindowData.aRowColumnWindows.empty() ) - return rMovedElementRect; - else - { - sal_Int32 nSpace( 0 ); - ::Rectangle aFrontDockingRect( rMovedElementRect ); - const sal_uInt32 nCount = aRowColumnWindowData.aRowColumnWindows.size(); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - if ( bHorzDockArea ) - { - if ( aRowColumnWindowData.aRowColumnWindowSizes[i].X >= rDockedElementRect.Left() ) - { - nSpace += aRowColumnWindowData.aRowColumnSpace[i]; - break; - } - else if ( aRowColumnWindowData.aUIElementNames[i] == rMovedElementName ) - nSpace += aRowColumnWindowData.aRowColumnWindowSizes[i].Width + - aRowColumnWindowData.aRowColumnSpace[i]; - else - nSpace = 0; - } - else - { - if ( aRowColumnWindowData.aRowColumnWindowSizes[i].Y >= rDockedElementRect.Top() ) - { - nSpace += aRowColumnWindowData.aRowColumnSpace[i]; - break; - } - else if ( aRowColumnWindowData.aUIElementNames[i] == rMovedElementName ) - nSpace += aRowColumnWindowData.aRowColumnWindowSizes[i].Height + - aRowColumnWindowData.aRowColumnSpace[i]; - else - nSpace = 0; - } - } - - if ( nSpace > 0 ) - { - sal_Int32 nMove = std::min( nSpace, static_cast<sal_Int32>(aFrontDockingRect.getWidth()) ); - if ( bHorzDockArea ) - aFrontDockingRect.Move( -nMove, 0 ); - else - aFrontDockingRect.Move( 0, -nMove ); - } - - return aFrontDockingRect; - } -} - -::Rectangle LayoutManager::implts_getWindowRectFromRowColumn( - ::com::sun::star::ui::DockingArea DockingArea, - const SingleRowColumnWindowData& rRowColumnWindowData, - const ::Point& rMousePos, - const rtl::OUString& rExcludeElementName ) -{ - ::Rectangle aWinRect; - - if (( DockingArea < DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea > DockingArea_DOCKINGAREA_RIGHT )) - DockingArea = DockingArea_DOCKINGAREA_TOP; - - if ( rRowColumnWindowData.aRowColumnWindows.empty() ) - return aWinRect; - else - { - ReadGuard aReadLock( m_aLock ); - Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - Reference< css::awt::XWindow > xDockingAreaWindow = m_xDockAreaWindows[DockingArea]; - aReadLock.unlock(); - - // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect - vos::OGuard aGuard( Application::GetSolarMutex() ); - - // Retrieve output size from container Window - Window* pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow )); - Window* pDockingAreaWindow( VCLUnoHelper::GetWindow( xDockingAreaWindow )); - if ( pDockingAreaWindow && pContainerWindow ) - { - const sal_uInt32 nCount = rRowColumnWindowData.aRowColumnWindows.size(); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - css::awt::Rectangle aWindowRect = rRowColumnWindowData.aRowColumnWindows[i]->getPosSize(); - ::Rectangle aRect( aWindowRect.X, aWindowRect.Y, aWindowRect.X+aWindowRect.Width, aWindowRect.Y+aWindowRect.Height ); - aRect.SetPos( pContainerWindow->ScreenToOutputPixel( pDockingAreaWindow->OutputToScreenPixel( aRect.TopLeft() ))); - if ( aRect.IsInside( rMousePos )) - { - // Check if we have found the excluded element. If yes, we have to provide an empty rectangle. - // We prevent that a toolbar cannot be moved when the mouse pointer is inside its own rectangle! - if ( rExcludeElementName != rRowColumnWindowData.aUIElementNames[i] ) - return aRect; - else - break; - } - } - } - } - - return aWinRect; -} - -framework::LayoutManager::DockingOperation -LayoutManager::implts_determineDockingOperation( - ::com::sun::star::ui::DockingArea DockingArea, - const ::Rectangle& rRowColRect, - const Point& rMousePos ) -{ - const sal_Int32 nHorzVerticalRegionSize = 6; - const sal_Int32 nHorzVerticalMoveRegion = 4; - - if ( rRowColRect.IsInside( rMousePos )) - { - if (( DockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( DockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - sal_Int32 nRegion = rRowColRect.getHeight() / nHorzVerticalRegionSize; - sal_Int32 nPosY = rRowColRect.Top() + nRegion; - - if ( rMousePos.Y() < nPosY ) - return ( DockingArea == DockingArea_DOCKINGAREA_TOP ) ? DOCKOP_BEFORE_COLROW : DOCKOP_AFTER_COLROW; - else if ( rMousePos.Y() < ( nPosY + nRegion*nHorzVerticalMoveRegion )) - return DOCKOP_ON_COLROW; - else - return ( DockingArea == DockingArea_DOCKINGAREA_TOP ) ? DOCKOP_AFTER_COLROW : DOCKOP_BEFORE_COLROW; - } - else - { - sal_Int32 nRegion = rRowColRect.getWidth() / nHorzVerticalRegionSize; - sal_Int32 nPosX = rRowColRect.Left() + nRegion; - - if ( rMousePos.X() < nPosX ) - return ( DockingArea == DockingArea_DOCKINGAREA_LEFT ) ? DOCKOP_BEFORE_COLROW : DOCKOP_AFTER_COLROW; - else if ( rMousePos.X() < ( nPosX + nRegion*nHorzVerticalMoveRegion )) - return DOCKOP_ON_COLROW; - else - return ( DockingArea == DockingArea_DOCKINGAREA_LEFT ) ? DOCKOP_AFTER_COLROW : DOCKOP_BEFORE_COLROW; - } - } - else - return DOCKOP_ON_COLROW; -} - -::Rectangle LayoutManager::implts_calcTrackingAndElementRect( - ::com::sun::star::ui::DockingArea eDockingArea, - sal_Int32 nRowCol, - UIElement& rUIElement, - const ::Rectangle& rTrackingRect, - const ::Rectangle& rRowColumnRect, - const ::Size& rContainerWinSize ) -{ - sal_Bool bHorizontalDockArea( ( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )); - - sal_Int32 nTopDockingAreaSize( implts_getTopBottomDockingAreaSizes().Width() ); - sal_Int32 nBottomDockingAreaSize( implts_getTopBottomDockingAreaSizes().Height() ); - - ::Size aStatusBarSize( implts_getStatusBarSize() ); - sal_Int32 nMaxLeftRightDockAreaSize = rContainerWinSize.Height() - - nTopDockingAreaSize - - nBottomDockingAreaSize - - aStatusBarSize.Height(); - - ::Rectangle aTrackingRect( rTrackingRect ); - if ( bHorizontalDockArea ) - { - sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 ))); - if (( nPosX + rTrackingRect.getWidth()) > rContainerWinSize.Width() ) - nPosX = std::min( nPosX, - std::max( sal_Int32( rContainerWinSize.Width() - rTrackingRect.getWidth() ), - sal_Int32( 0 ))); - - sal_Int32 nSize = std::min( rContainerWinSize.Width(), rTrackingRect.getWidth() ); - - aTrackingRect.SetPos( ::Point( nPosX, rRowColumnRect.Top() )); - aTrackingRect.setWidth( nSize ); - aTrackingRect.setHeight( rRowColumnRect.getHeight() ); - - // Set virtual position - rUIElement.m_aDockedData.m_aPos.X() = nPosX; - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; - } - else - { - sal_Int32 nMaxDockingAreaHeight = std::max( sal_Int32( 0 ), - sal_Int32( nMaxLeftRightDockAreaSize )); - - sal_Int32 nPosY( std::max( sal_Int32( aTrackingRect.Top()), sal_Int32( nTopDockingAreaSize ))); - if (( nPosY + aTrackingRect.getHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight )) - nPosY = std::min( nPosY, - std::max( sal_Int32( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() )), - sal_Int32( nTopDockingAreaSize ))); - - sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) ); - - aTrackingRect.SetPos( ::Point( rRowColumnRect.Left(), nPosY )); - aTrackingRect.setWidth( rRowColumnRect.getWidth() ); - aTrackingRect.setHeight( nSize ); - - ReadGuard aReadLock( m_aLock ); - Reference< css::awt::XWindow > xDockingAreaWindow = m_xDockAreaWindows[eDockingArea]; - Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - aReadLock.unlock(); - - sal_Int32 nDockPosY( 0 ); - Window* pDockingAreaWindow( 0 ); - Window* pContainerWindow( 0 ); - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( - pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y(); - } - - // Set virtual position - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - rUIElement.m_aDockedData.m_aPos.Y() = nDockPosY; - } - - return aTrackingRect; -} - -void implts_setTrackingRect( DockingArea eDockingArea, const Point& rMousePos, ::Rectangle& rTrackingRect ) -{ - sal_Bool bHorizontalDockArea( ( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )); - - ::Point aPoint = rTrackingRect.TopLeft(); - if ( bHorizontalDockArea ) - aPoint.X() = rMousePos.X(); - else - aPoint.Y() = rMousePos.Y(); - rTrackingRect.SetPos( aPoint ); -} - -void LayoutManager::implts_calcDockingPosSize( - UIElement& rUIElement, - DockingOperation& rDockingOperation, - ::Rectangle& rTrackingRect, - const Point& rMousePos ) -{ - ReadGuard aReadLock( m_aLock ); - Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; - ::Size aContainerWinSize; - Window* pContainerWindow( 0 ); - aReadLock.unlock(); - - { - // Retrieve output size from container Window - vos::OGuard aGuard( Application::GetSolarMutex() ); - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); aContainerWinSize = pContainerWindow->GetOutputSizePixel(); - } - - if ( !rUIElement.m_xUIElement.is() ) - { - rTrackingRect = ::Rectangle(); - return; - } - - Window* pDockWindow( 0 ); - Window* pDockingAreaWindow( 0 ); - ToolBox* pToolBox( 0 ); - Reference< css::awt::XWindow > xWindow( rUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XWindow > xDockingAreaWindow; - ::Rectangle aTrackingRect( rTrackingRect ); - ::com::sun::star::ui::DockingArea eDockedArea( (::com::sun::star::ui::DockingArea)rUIElement.m_aDockedData.m_nDockedArea ); - sal_Int32 nTopDockingAreaSize( implts_getTopBottomDockingAreaSizes().Width() ); - sal_Int32 nBottomDockingAreaSize( implts_getTopBottomDockingAreaSizes().Height() ); - sal_Bool bHorizontalDockArea( ( eDockedArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockedArea == DockingArea_DOCKINGAREA_BOTTOM )); - ::Size aStatusBarSize( implts_getStatusBarSize() ); - sal_Int32 nMaxLeftRightDockAreaSize = aContainerWinSize.Height() - - nTopDockingAreaSize - - nBottomDockingAreaSize - - aStatusBarSize.Height(); - ::Rectangle aDockingAreaRect; - - aReadLock.lock(); - xDockingAreaWindow = m_xDockAreaWindows[eDockedArea]; - aReadLock.unlock(); - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); - pDockWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = (ToolBox *)pDockWindow; - - aDockingAreaRect = ::Rectangle( pDockingAreaWindow->GetPosPixel(), pDockingAreaWindow->GetSizePixel() ); - if ( pToolBox ) - { - // docked toolbars always have one line - ::Size aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( sal_Int16( eDockedArea )) ); - aTrackingRect.SetSize( ::Size( aSize.Width(), aSize.Height() )); - } - } - - // default docking operation, dock on the given row/column - sal_Bool bOpOutsideOfDockingArea( !aDockingAreaRect.IsInside( rMousePos )); - std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; - - rDockingOperation = DOCKOP_ON_COLROW; - implts_getDockingAreaElementInfos( eDockedArea, aRowColumnsWindowData ); - - // determine current first row/column and last row/column - sal_Int32 nMaxRowCol( -1 ); - sal_Int32 nMinRowCol( SAL_MAX_INT32 ); - const sal_uInt32 nCount = aRowColumnsWindowData.size(); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - if ( aRowColumnsWindowData[i].nRowColumn > nMaxRowCol ) - nMaxRowCol = aRowColumnsWindowData[i].nRowColumn; - if ( aRowColumnsWindowData[i].nRowColumn < nMinRowCol ) - nMinRowCol = aRowColumnsWindowData[i].nRowColumn; - } - - if ( !bOpOutsideOfDockingArea ) - { - // docking inside our docking area - sal_Int32 nIndex( -1 ); - sal_Int32 nRowCol( -1 ); - ::Rectangle aWindowRect; - ::Rectangle aRowColumnRect; - - const sal_uInt32 nWindowDataCount = aRowColumnsWindowData.size(); - for ( sal_uInt32 i = 0; i < nWindowDataCount; i++ ) - { - ::Rectangle aRect( aRowColumnsWindowData[i].aRowColumnRect.X, - aRowColumnsWindowData[i].aRowColumnRect.Y, - aRowColumnsWindowData[i].aRowColumnRect.X + aRowColumnsWindowData[i].aRowColumnRect.Width, - aRowColumnsWindowData[i].aRowColumnRect.Y + aRowColumnsWindowData[i].aRowColumnRect.Height ); - - { - // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect - vos::OGuard aGuard( Application::GetSolarMutex() ); - aRect.SetPos( pContainerWindow->ScreenToOutputPixel( pDockingAreaWindow->OutputToScreenPixel( aRect.TopLeft() ))); - } - - sal_Bool bIsInsideRowCol( aRect.IsInside( rMousePos ) ); - if ( bIsInsideRowCol ) - { - nIndex = i; - nRowCol = aRowColumnsWindowData[i].nRowColumn; - rDockingOperation = implts_determineDockingOperation( eDockedArea, aRect, rMousePos ); - aWindowRect = implts_getWindowRectFromRowColumn( eDockedArea, aRowColumnsWindowData[i], rMousePos, rUIElement.m_aName ); - aRowColumnRect = aRect; - break; - } - } - - OSL_ENSURE( ( nIndex >= 0 ) && ( nRowCol >= 0 ), "Impossible case - no row/column found but mouse pointer is inside our docking area" ); - if (( nIndex >= 0 ) && ( nRowCol >= 0 )) - { - if ( rDockingOperation == DOCKOP_ON_COLROW ) - { - if ( !aWindowRect.IsEmpty()) - { - // Tracking rect is on a row/column and mouse is over a docked toolbar. - // Determine if the tracking rect must be located before/after the docked toolbar. - - ::Rectangle aUIElementRect( aWindowRect ); - sal_Int32 nMiddle( bHorizontalDockArea ? ( aWindowRect.Left() + aWindowRect.getWidth() / 2 ) : - ( aWindowRect.Top() + aWindowRect.getHeight() / 2 )); - sal_Bool bInsertBefore( bHorizontalDockArea ? ( rMousePos.X() < nMiddle ) : ( rMousePos.Y() < nMiddle )); - if ( bInsertBefore ) - { - if ( bHorizontalDockArea ) - { - sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( aContainerWinSize.Width() - aWindowRect.Left() ), - sal_Int32( aTrackingRect.getWidth() ))); - if ( nSize == 0 ) - nSize = aWindowRect.getWidth(); - - aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() )); - aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect,rUIElement.m_aName, aUIElementRect ); - - // Set virtual position - rUIElement.m_aDockedData.m_aPos.X() = aWindowRect.Left(); - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; - } - else - { - sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( - nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.Top() ), - sal_Int32( aTrackingRect.getHeight() ))); - if ( nSize == 0 ) - nSize = aWindowRect.getHeight(); - - aUIElementRect.SetSize( ::Size( aWindowRect.getWidth(), nSize )); - aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect, rUIElement.m_aName, aUIElementRect ); - - // Set virtual position - sal_Int32 nPosY = pDockingAreaWindow->ScreenToOutputPixel( - pContainerWindow->OutputToScreenPixel( aWindowRect.TopLeft() )).Y(); - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - rUIElement.m_aDockedData.m_aPos.Y() = nPosY; - } - - rTrackingRect = aWindowRect; - return; - } - else - { - if ( bHorizontalDockArea ) - { - sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32(( aContainerWinSize.Width() ) - aWindowRect.Right() ), - sal_Int32( aTrackingRect.getWidth() ))); - if ( nSize == 0 ) - { - aUIElementRect.SetPos( ::Point( aContainerWinSize.Width() - aTrackingRect.getWidth(), aWindowRect.Top() )); - aUIElementRect.SetSize( ::Size( aTrackingRect.getWidth(), aWindowRect.getHeight() )); - rUIElement.m_aDockedData.m_aPos.X() = aUIElementRect.Left(); - } - else - { - aUIElementRect.SetPos( ::Point( aWindowRect.Right(), aWindowRect.Top() )); - aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() )); - rUIElement.m_aDockedData.m_aPos.X() = aWindowRect.Right(); - } - - // Set virtual position - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; - } - else - { - sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.Bottom() ), - sal_Int32( aTrackingRect.getHeight() ))); - aUIElementRect.SetPos( ::Point( aWindowRect.Left(), aWindowRect.Bottom() )); - aUIElementRect.SetSize( ::Size( aWindowRect.getWidth(), nSize )); - - // Set virtual position - sal_Int32 nPosY( 0 ); - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - nPosY = pDockingAreaWindow->ScreenToOutputPixel( - pContainerWindow->OutputToScreenPixel( aWindowRect.BottomRight() )).Y(); - } - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - rUIElement.m_aDockedData.m_aPos.Y() = nPosY; - } - - rTrackingRect = aUIElementRect; - return; - } - } - else - { - implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect ); - rTrackingRect = implts_calcTrackingAndElementRect( - eDockedArea, nRowCol, rUIElement, - aTrackingRect, aRowColumnRect, aContainerWinSize ); - return; - } - } - else - { - if ((( nRowCol == nMinRowCol ) && ( rDockingOperation == DOCKOP_BEFORE_COLROW )) || - (( nRowCol == nMaxRowCol ) && ( rDockingOperation == DOCKOP_AFTER_COLROW ))) - bOpOutsideOfDockingArea = sal_True; - else - { - // handle docking before/after a row - implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect ); - rTrackingRect = implts_calcTrackingAndElementRect( - eDockedArea, nRowCol, rUIElement, - aTrackingRect, aRowColumnRect, aContainerWinSize ); - - sal_Int32 nOffsetX( 0 ); - sal_Int32 nOffsetY( 0 ); - if ( bHorizontalDockArea ) - nOffsetY = sal_Int32( floor( aRowColumnRect.getHeight() / 2 + 0.5 )); - else - nOffsetX = sal_Int32( floor( aRowColumnRect.getWidth() / 2 + 0.5 )); - - if ( rDockingOperation == DOCKOP_BEFORE_COLROW ) - { - if (( eDockedArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockedArea == DockingArea_DOCKINGAREA_LEFT )) - { - // Docking before/after means move track rectangle half column/row. - // As left and top are ordered 0...n instead of right and bottom - // which uses n...0, we have to use negative values for top/left. - nOffsetX *= -1; - nOffsetY *= -1; - } - } - else - { - if (( eDockedArea == DockingArea_DOCKINGAREA_BOTTOM ) || - ( eDockedArea == DockingArea_DOCKINGAREA_RIGHT )) - { - // Docking before/after means move track rectangle half column/row. - // As left and top are ordered 0...n instead of right and bottom - // which uses n...0, we have to use negative values for top/left. - nOffsetX *= -1; - nOffsetY *= -1; - } - nRowCol++; - } - - if ( bHorizontalDockArea ) - rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; - else - rUIElement.m_aDockedData.m_aPos.X() = nRowCol; - - rTrackingRect.Move( nOffsetX, nOffsetY ); - rTrackingRect.SetSize( aTrackingRect.GetSize() ); - } - } - } - } - - // Docking outside of our docking window area => - // Users want to dock before/after first/last docked element or to an empty docking area - if ( bOpOutsideOfDockingArea ) - { - // set correct size for docking - implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect ); - rTrackingRect = aTrackingRect; - - if ( bHorizontalDockArea ) - { - sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 ))); - if (( nPosX + rTrackingRect.getWidth()) > aContainerWinSize.Width() ) - nPosX = std::min( nPosX, - std::max( sal_Int32( aContainerWinSize.Width() - rTrackingRect.getWidth() ), - sal_Int32( 0 ))); - - sal_Int32 nSize = std::min( aContainerWinSize.Width(), rTrackingRect.getWidth() ); - sal_Int32 nDockHeight = std::max( static_cast<sal_Int32>(aDockingAreaRect.getHeight()), sal_Int32( 0 )); - if ( nDockHeight == 0 ) - { - sal_Int32 nPosY( std::max( aDockingAreaRect.Top(), aDockingAreaRect.Bottom() )); - if ( eDockedArea == DockingArea_DOCKINGAREA_BOTTOM ) - nPosY -= rTrackingRect.getHeight(); - rTrackingRect.SetPos( Point( nPosX, nPosY )); - rUIElement.m_aDockedData.m_aPos.Y() = 0; - } - else if ( rMousePos.Y() < ( aDockingAreaRect.Top() + ( nDockHeight / 2 ))) - { - rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Top() - rTrackingRect.getHeight() )); - if ( eDockedArea == DockingArea_DOCKINGAREA_TOP ) - rUIElement.m_aDockedData.m_aPos.Y() = 0; - else - rUIElement.m_aDockedData.m_aPos.Y() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; - rDockingOperation = DOCKOP_BEFORE_COLROW; - } - else - { - rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Bottom() )); - if ( eDockedArea == DockingArea_DOCKINGAREA_TOP ) - rUIElement.m_aDockedData.m_aPos.Y() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; - else - rUIElement.m_aDockedData.m_aPos.Y() = 0; - rDockingOperation = DOCKOP_AFTER_COLROW; - } - rTrackingRect.setWidth( nSize ); - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - nPosX = pDockingAreaWindow->ScreenToOutputPixel( - pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).X(); - } - rUIElement.m_aDockedData.m_aPos.X() = nPosX; - } - else - { - sal_Int32 nMaxDockingAreaHeight = std::max( sal_Int32( 0 ), - sal_Int32( nMaxLeftRightDockAreaSize )); - - sal_Int32 nPosY( std::max( sal_Int32( aTrackingRect.Top()), sal_Int32( nTopDockingAreaSize ))); - if (( nPosY + aTrackingRect.getHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight )) - nPosY = std::min( nPosY, - std::max( sal_Int32( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() )), - sal_Int32( nTopDockingAreaSize ))); - - sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) ); - sal_Int32 nDockWidth = std::max( static_cast<sal_Int32>(aDockingAreaRect.getWidth()), sal_Int32( 0 )); - if ( nDockWidth == 0 ) - { - sal_Int32 nPosX( std::max( aDockingAreaRect.Left(), aDockingAreaRect.Right() )); - if ( eDockedArea == DockingArea_DOCKINGAREA_RIGHT ) - nPosX -= rTrackingRect.getWidth(); - rTrackingRect.SetPos( Point( nPosX, nPosY )); - rUIElement.m_aDockedData.m_aPos.X() = 0; - } - else if ( rMousePos.X() < ( aDockingAreaRect.Left() + ( nDockWidth / 2 ))) - { - rTrackingRect.SetPos( Point( aDockingAreaRect.Left() - rTrackingRect.getWidth(), nPosY )); - if ( eDockedArea == DockingArea_DOCKINGAREA_LEFT ) - rUIElement.m_aDockedData.m_aPos.X() = 0; - else - rUIElement.m_aDockedData.m_aPos.X() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; - rDockingOperation = DOCKOP_BEFORE_COLROW; - } - else - { - rTrackingRect.SetPos( Point( aDockingAreaRect.Right(), nPosY )); - if ( eDockedArea == DockingArea_DOCKINGAREA_LEFT ) - rUIElement.m_aDockedData.m_aPos.X() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; - else - rUIElement.m_aDockedData.m_aPos.X() = 0; - rDockingOperation = DOCKOP_AFTER_COLROW; - } - rTrackingRect.setHeight( nSize ); - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - nPosY = pDockingAreaWindow->ScreenToOutputPixel( - pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).Y(); - } - rUIElement.m_aDockedData.m_aPos.Y() = nPosY; - } - } -} - -void LayoutManager::implts_renumberRowColumnData( - ::com::sun::star::ui::DockingArea eDockingArea, - DockingOperation /*eDockingOperation*/, - const UIElement& rUIElement ) -{ - ReadGuard aReadLock( m_aLock ); - Reference< XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); - aReadLock.unlock(); - - sal_Bool bHorzDockingArea(( eDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM )); - sal_Int32 nRowCol( bHorzDockingArea ? rUIElement.m_aDockedData.m_aPos.Y() : - rUIElement.m_aDockedData.m_aPos.X() ); - - WriteGuard aWriteLock( m_aLock ); - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if (( pIter->m_aDockedData.m_nDockedArea == sal_Int16( eDockingArea )) && - ( pIter->m_aName != rUIElement.m_aName )) - { - // Don't change toolbars without a valid docking position! - if (( pIter->m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) && - ( pIter->m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 )) - continue; - - sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? - pIter->m_aDockedData.m_aPos.Y() : pIter->m_aDockedData.m_aPos.X(); - if ( nWindowRowCol >= nRowCol ) - { - if ( bHorzDockingArea ) - pIter->m_aDockedData.m_aPos.Y() += 1; - else - pIter->m_aDockedData.m_aPos.X() += 1; - } - } - } - aWriteLock.unlock(); - - // We have to change the persistent window state part - if ( xPersistentWindowState.is() ) - { - try - { - Sequence< rtl::OUString > aWindowElements = xPersistentWindowState->getElementNames(); - for ( sal_Int32 i = 0; i < aWindowElements.getLength(); i++ ) - { - if ( rUIElement.m_aName != aWindowElements[i] ) - { - try - { - Sequence< PropertyValue > aPropValueSeq; - css::awt::Point aDockedPos; - DockingArea nDockedArea( DockingArea_DOCKINGAREA_DEFAULT ); - - xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq; - for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ ) - { - if ( aPropValueSeq[j].Name == m_aPropDockingArea ) - aPropValueSeq[j].Value >>= nDockedArea; - else if ( aPropValueSeq[j].Name == m_aPropDockPos ) - aPropValueSeq[j].Value >>= aDockedPos; - } - - // Don't change toolbars without a valid docking position! - if (( aDockedPos.X == SAL_MAX_INT32 ) && ( aDockedPos.Y == SAL_MAX_INT32 )) - continue; - - sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? aDockedPos.Y : aDockedPos.X; - if (( nDockedArea == eDockingArea ) && ( nWindowRowCol >= nRowCol )) - { - if ( bHorzDockingArea ) - aDockedPos.Y += 1; - else - aDockedPos.X += 1; - - Reference< XNameReplace > xReplace( xPersistentWindowState, UNO_QUERY ); - xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq )); - } - } - catch ( Exception& ) - { - } - } - } - } - catch ( Exception& ) - { - } - } -} -::Size LayoutManager::implts_getTopBottomDockingAreaSizes() -{ - ::Size aSize; - Reference< css::awt::XWindow > xTopDockingAreaWindow; - Reference< css::awt::XWindow > xBottomDockingAreaWindow; - - ReadGuard aReadLock( m_aLock ); - xTopDockingAreaWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; - xBottomDockingAreaWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM]; - aReadLock.unlock(); - - if ( xTopDockingAreaWindow.is() ) - aSize.Width() = xTopDockingAreaWindow->getPosSize().Height; - if ( xBottomDockingAreaWindow.is() ) - aSize.Height() = xBottomDockingAreaWindow->getPosSize().Height; - - return aSize; + return aContainerWinSize; } Reference< XUIElement > LayoutManager::implts_createElement( const rtl::OUString& aName ) { - Reference< ::com::sun::star::ui::XUIElement > xUIElement; + Reference< ui::XUIElement > xUIElement; ReadGuard aReadLock( m_aLock ); Sequence< PropertyValue > aPropSeq( 2 ); @@ -3054,121 +746,39 @@ Reference< XUIElement > LayoutManager::implts_createElement( const rtl::OUString { xUIElement = m_xUIElementFactoryManager->createUIElement( aName, aPropSeq ); } - catch ( NoSuchElementException& ) - { - } - catch ( IllegalArgumentException& ) - { - } + catch ( NoSuchElementException& ) {} + catch ( IllegalArgumentException& ) {} return xUIElement; } -Reference< css::awt::XWindowPeer > LayoutManager::implts_createToolkitWindow( const Reference< css::awt::XWindowPeer >& rParent ) -{ - Reference< css::awt::XWindowPeer > xPeer; - css::uno::Reference< css::awt::XToolkit > xToolkit( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), css::uno::UNO_QUERY ); - if ( xToolkit.is() ) - { - // describe window properties. - css::awt::WindowDescriptor aDescriptor; - aDescriptor.Type = css::awt::WindowClass_SIMPLE ; - aDescriptor.WindowServiceName = DECLARE_ASCII("dockingarea") ; - aDescriptor.ParentIndex = -1 ; - aDescriptor.Parent = css::uno::Reference< css::awt::XWindowPeer >( rParent, UNO_QUERY ) ; - aDescriptor.Bounds = css::awt::Rectangle(0,0,0,0) ; - aDescriptor.WindowAttributes = 0 ; - - // create a docking area window - xPeer = xToolkit->createWindow( aDescriptor ); - } - - return xPeer; -} - void LayoutManager::implts_setVisibleState( sal_Bool bShow ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - pIter->m_bMasterHide = !bShow; m_aStatusBarElement.m_bMasterHide = !bShow; aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ implts_updateUIElementsVisibleState( bShow ); - //implts_doLayout( sal_False ); } void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible ) { // notify listeners - css::uno::Any a; + uno::Any a; if ( bSetVisible ) - implts_notifyListeners( css::frame::LayoutManagerEvents::VISIBLE, a ); + implts_notifyListeners( frame::LayoutManagerEvents::VISIBLE, a ); else - implts_notifyListeners( css::frame::LayoutManagerEvents::INVISIBLE, a ); - std::vector< Reference< css::awt::XWindow > > aWinVector; - sal_Bool bOld; - - { - WriteGuard aWriteLock( m_aLock ); - m_bDoLayout = sal_True; - bOld = m_bDoLayout; - } - - ReadGuard aReadLock( m_aLock ); - aWinVector.reserve(m_aUIElements.size()); - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - if ( xWindow.is() ) - { - if ( bSetVisible ) - { - if ( pIter->m_bVisible && !pIter->m_bMasterHide ) - aWinVector.push_back( xWindow ); - } - else - aWinVector.push_back( xWindow ); - } - } - } - - aReadLock.unlock(); + implts_notifyListeners( frame::LayoutManagerEvents::INVISIBLE, a ); + std::vector< Reference< awt::XWindow > > aWinVector; - try - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - const sal_uInt32 nCount = aWinVector.size(); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - Reference< css::awt::XWindow > xWindow( aWinVector[i] ); - if ( xWindow.is() ) - { - // we need VCL here to pass special flags to Show() - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if( pWindow ) - pWindow->Show( bSetVisible, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - } - } - } - catch ( DisposedException& ) - { - } - - // Hide/show menubar according to bSetVisible - aReadLock.lock(); - Reference< XUIElement > xMenuBar( m_xMenuBar, UNO_QUERY ); - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); - Reference< XComponent > xInplaceMenuBar( m_xInplaceMenuBar ); - MenuBarManager* pInplaceMenuBar( m_pInplaceMenuBar ); - aReadLock.unlock(); + WriteGuard aWriteLock( m_aLock ); + Reference< XUIElement > xMenuBar( m_xMenuBar, UNO_QUERY ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< XComponent > xInplaceMenuBar( m_xInplaceMenuBar ); + MenuBarManager* pInplaceMenuBar( m_pInplaceMenuBar ); + aWriteLock.unlock(); + bool bMustDoLayout(false); if (( xMenuBar.is() || xInplaceMenuBar.is() ) && xContainerWindow.is() ) { vos::OGuard aGuard( Application::GetSolarMutex() ); @@ -3182,103 +792,59 @@ void LayoutManager::implts_updateUIElementsVisibleState( sal_Bool bSetVisible ) pMenuBar = (MenuBar *)pMenuBarWrapper->GetMenuBarManager()->GetMenuBar(); } - Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - - if ( pWindow ) + SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow ); + if ( pSysWindow ) { - SystemWindow* pSysWindow = (SystemWindow *)pWindow; if ( bSetVisible ) pSysWindow->SetMenuBar( pMenuBar ); else pSysWindow->SetMenuBar( 0 ); + bMustDoLayout = true; } } // Hide/show the statusbar according to bSetVisible if ( bSetVisible ) - implts_showStatusBar(); + bMustDoLayout = !implts_showStatusBar(); else - implts_hideStatusBar(); + bMustDoLayout = !implts_hideStatusBar(); - if ( !bOld ) - { - WriteGuard aWriteLock( m_aLock ); - m_bDoLayout = sal_False; - } + aWriteLock.lock(); + uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); + aWriteLock.unlock(); - if ( bSetVisible ) + if ( pToolbarManager ) { - implts_createNonContextSensitiveToolBars(); - implts_doLayout_notify( sal_False ); + pToolbarManager->setVisible( bSetVisible ); + bMustDoLayout = pToolbarManager->isLayoutDirty(); } - else - { - // Set docking area window size to zero - ReadGuard aReadLock2( m_aLock ); - Reference< css::awt::XWindow > xTopDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; - Reference< css::awt::XWindow > xLeftDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT]; - Reference< css::awt::XWindow > xRightDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT]; - Reference< css::awt::XWindow > xBottomDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM]; - aReadLock2.unlock(); - try - { - if ( xTopDockingWindow.is() ) - xTopDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - if ( xLeftDockingWindow.is() ) - xLeftDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - if ( xRightDockingWindow.is() ) - xRightDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - if ( xBottomDockingWindow.is() ) - xBottomDockingWindow->setPosSize( 0, 0, 0, 0, css::awt::PosSize::POSSIZE ); - - WriteGuard aWriteLock( m_aLock ); - m_aDockingArea = css::awt::Rectangle(); - m_bMustDoLayout = sal_True; - aWriteLock.unlock(); - } - catch ( Exception& ) - { - } - } + if ( bMustDoLayout ) + implts_doLayout_notify( sal_False ); } void LayoutManager::implts_setCurrentUIVisibility( sal_Bool bShow ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( !bShow && pIter->m_bVisible && pIter->m_xUIElement.is() ) - pIter->m_bMasterHide = true; - else if ( bShow && pIter->m_bMasterHide ) - pIter->m_bMasterHide = false; - } - if ( !bShow && m_aStatusBarElement.m_bVisible && m_aStatusBarElement.m_xUIElement.is() ) m_aStatusBarElement.m_bMasterHide = true; else if ( bShow && m_aStatusBarElement.m_bVisible ) m_aStatusBarElement.m_bMasterHide = false; aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ implts_updateUIElementsVisibleState( bShow ); } void LayoutManager::implts_destroyStatusBar() { - Reference< XComponent > xCompStatusBar; + Reference< XComponent > xCompStatusBar; - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_aStatusBarElement.m_aName = rtl::OUString(); xCompStatusBar = Reference< XComponent >( m_aStatusBarElement.m_xUIElement, UNO_QUERY ); m_aStatusBarElement.m_xUIElement.clear(); aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( xCompStatusBar.is() ) xCompStatusBar->dispose(); @@ -3288,7 +854,6 @@ void LayoutManager::implts_destroyStatusBar() void LayoutManager::implts_createStatusBar( const rtl::OUString& aStatusBarName ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); if ( !m_aStatusBarElement.m_xUIElement.is() ) { @@ -3296,14 +861,13 @@ void LayoutManager::implts_createStatusBar( const rtl::OUString& aStatusBarName m_aStatusBarElement.m_aName = aStatusBarName; m_aStatusBarElement.m_xUIElement = implts_createElement( aStatusBarName ); } + aWriteLock.unlock(); implts_createProgressBar(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } void LayoutManager::implts_readStatusBarState( const rtl::OUString& rStatusBarName ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); if ( !m_aStatusBarElement.m_bStateRead ) { @@ -3311,17 +875,15 @@ void LayoutManager::implts_readStatusBarState( const rtl::OUString& rStatusBarNa if ( implts_readWindowStateData( rStatusBarName, m_aStatusBarElement )) m_aStatusBarElement.m_bStateRead = sal_True; } - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } void LayoutManager::implts_createProgressBar() { - Reference< XUIElement > xStatusBar; + Reference< XUIElement > xStatusBar; Reference< XUIElement > xProgressBar; Reference< XUIElement > xProgressBarBackup; - Reference< css::awt::XWindow > xContainerWindow; + Reference< awt::XWindow > xContainerWindow; - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); xStatusBar = Reference< XUIElement >( m_aStatusBarElement.m_xUIElement, UNO_QUERY ); xProgressBar = Reference< XUIElement >( m_aProgressBarElement.m_xUIElement, UNO_QUERY ); @@ -3329,7 +891,6 @@ void LayoutManager::implts_createProgressBar() m_xProgressBarBackup.clear(); xContainerWindow = m_xContainerWindow; aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ sal_Bool bRecycled = xProgressBarBackup.is(); ProgressBarWrapper* pWrapper = 0; @@ -3342,14 +903,14 @@ void LayoutManager::implts_createProgressBar() if ( xStatusBar.is() ) { - Reference< css::awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); + Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); pWrapper->setStatusBar( xWindow ); } else { - Reference< css::awt::XWindow > xStatusBarWindow = pWrapper->getStatusBar(); + Reference< awt::XWindow > xStatusBarWindow = pWrapper->getStatusBar(); - vos::OGuard aGuard( Application::GetSolarMutex() ); + vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pStatusBarWnd = VCLUnoHelper::GetWindow( xStatusBarWindow ); if ( !pStatusBarWnd ) { @@ -3357,7 +918,7 @@ void LayoutManager::implts_createProgressBar() if ( pWindow ) { StatusBar* pStatusBar = new StatusBar( pWindow, WinBits( WB_LEFT | WB_3DLOOK ) ); - Reference< css::awt::XWindow > xStatusBarWindow2( VCLUnoHelper::GetInterface( pStatusBar )); + Reference< awt::XWindow > xStatusBarWindow2( VCLUnoHelper::GetInterface( pStatusBar )); pWrapper->setStatusBar( xStatusBarWindow2, sal_True ); } } @@ -3394,7 +955,7 @@ void LayoutManager::implts_backupProgressBarWrapper() { ProgressBarWrapper* pWrapper = (ProgressBarWrapper*)m_xProgressBarBackup.get(); if ( pWrapper ) - pWrapper->setStatusBar( Reference< css::awt::XWindow >(), sal_False ); + pWrapper->setStatusBar( Reference< awt::XWindow >(), sal_False ); } // prevent us from dispose() the m_aProgressBarElement.m_xUIElement inside implts_reset() @@ -3415,9 +976,9 @@ void LayoutManager::implts_destroyProgressBar() void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Size& rSize ) { - Reference< XUIElement > xStatusBar; + Reference< XUIElement > xStatusBar; Reference< XUIElement > xProgressBar; - Reference< css::awt::XWindow > xContainerWindow; + Reference< awt::XWindow > xContainerWindow; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); @@ -3425,9 +986,9 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz xProgressBar = Reference< XUIElement >( m_aProgressBarElement.m_xUIElement, UNO_QUERY ); xContainerWindow = m_xContainerWindow; - Reference< css::awt::XWindow > xWindow; + Reference< awt::XWindow > xWindow; if ( xStatusBar.is() ) - xWindow = Reference< css::awt::XWindow >( xStatusBar->getRealInterface(), UNO_QUERY ); + xWindow = Reference< awt::XWindow >( xStatusBar->getRealInterface(), UNO_QUERY ); else if ( xProgressBar.is() ) { ProgressBarWrapper* pWrapper = (ProgressBarWrapper*)xProgressBar.get(); @@ -3439,7 +1000,7 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz if ( xWindow.is() ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pParentWindow = VCLUnoHelper::GetWindow( xContainerWindow ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pParentWindow && ( pWindow && pWindow->GetType() == WINDOW_STATUSBAR )) @@ -3454,9 +1015,9 @@ void LayoutManager::implts_setStatusBarPosSize( const ::Point& rPos, const ::Siz sal_Bool LayoutManager::implts_showProgressBar() { - Reference< XUIElement > xStatusBar; + Reference< XUIElement > xStatusBar; Reference< XUIElement > xProgressBar; - Reference< css::awt::XWindow > xWindow; + Reference< awt::XWindow > xWindow; /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); @@ -3469,7 +1030,7 @@ sal_Bool LayoutManager::implts_showProgressBar() { if ( xStatusBar.is() && !m_aStatusBarElement.m_bMasterHide ) { - xWindow = Reference< css::awt::XWindow >( xStatusBar->getRealInterface(), UNO_QUERY ); + xWindow = Reference< awt::XWindow >( xStatusBar->getRealInterface(), UNO_QUERY ); } else if ( xProgressBar.is() ) { @@ -3479,6 +1040,7 @@ sal_Bool LayoutManager::implts_showProgressBar() } } aWriteLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); @@ -3486,6 +1048,7 @@ sal_Bool LayoutManager::implts_showProgressBar() { if ( !pWindow->IsVisible() ) { + implts_setOffset( pWindow->GetSizePixel().Height() ); pWindow->Show(); implts_doLayout_notify( sal_False ); } @@ -3498,7 +1061,7 @@ sal_Bool LayoutManager::implts_showProgressBar() sal_Bool LayoutManager::implts_hideProgressBar() { Reference< XUIElement > xProgressBar; - Reference< css::awt::XWindow > xWindow; + Reference< awt::XWindow > xWindow; sal_Bool bHideStatusBar( sal_False ); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -3508,25 +1071,26 @@ sal_Bool LayoutManager::implts_hideProgressBar() sal_Bool bInternalStatusBar( sal_False ); if ( xProgressBar.is() ) { - Reference< css::awt::XWindow > xStatusBar; + Reference< awt::XWindow > xStatusBar; ProgressBarWrapper* pWrapper = (ProgressBarWrapper*)xProgressBar.get(); if ( pWrapper ) xWindow = pWrapper->getStatusBar(); - Reference< css::ui::XUIElement > xStatusBarElement = m_aStatusBarElement.m_xUIElement; + Reference< ui::XUIElement > xStatusBarElement = m_aStatusBarElement.m_xUIElement; if ( xStatusBarElement.is() ) - xStatusBar = Reference< css::awt::XWindow >( xStatusBarElement->getRealInterface(), UNO_QUERY ); + xStatusBar = Reference< awt::XWindow >( xStatusBarElement->getRealInterface(), UNO_QUERY ); bInternalStatusBar = xStatusBar != xWindow; } m_aProgressBarElement.m_bVisible = sal_False; implts_readStatusBarState( m_aStatusBarAlias ); bHideStatusBar = !m_aStatusBarElement.m_bVisible; aWriteLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->IsVisible() && - ( bHideStatusBar || bInternalStatusBar )) + if ( pWindow && pWindow->IsVisible() && ( bHideStatusBar || bInternalStatusBar )) { + implts_setOffset( 0 ); pWindow->Hide(); implts_doLayout_notify( sal_False ); return sal_True; @@ -3537,23 +1101,23 @@ sal_Bool LayoutManager::implts_hideProgressBar() sal_Bool LayoutManager::implts_showStatusBar( sal_Bool bStoreState ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - Reference< css::ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement; + Reference< ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement; if ( bStoreState ) m_aStatusBarElement.m_bVisible = sal_True; aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( xStatusBar.is() ) { - Reference< css::awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); + Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); - vos::OGuard aGuard( Application::GetSolarMutex() ); + vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && !pWindow->IsVisible() ) { + implts_setOffset( pWindow->GetSizePixel().Height() ); pWindow->Show(); + implts_doLayout_notify( sal_False ); return sal_True; } } @@ -3563,23 +1127,23 @@ sal_Bool LayoutManager::implts_showStatusBar( sal_Bool bStoreState ) sal_Bool LayoutManager::implts_hideStatusBar( sal_Bool bStoreState ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - Reference< css::ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement; + Reference< ui::XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement; if ( bStoreState ) m_aStatusBarElement.m_bVisible = sal_False; aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( xStatusBar.is() ) { - Reference< css::awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); + Reference< awt::XWindow > xWindow( xStatusBar->getRealInterface(), UNO_QUERY ); - vos::OGuard aGuard( Application::GetSolarMutex() ); + vos::OGuard aGuard( Application::GetSolarMutex() ); Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pWindow && pWindow->IsVisible() ) { + implts_setOffset( 0 ); pWindow->Hide(); + implts_doLayout_notify( sal_False ); return sal_True; } } @@ -3587,14 +1151,26 @@ sal_Bool LayoutManager::implts_hideStatusBar( sal_Bool bStoreState ) return sal_False; } +void LayoutManager::implts_setOffset( const sal_Int32 nBottomOffset ) +{ + ::Rectangle aOffsetRect; + setZeroRectangle( aOffsetRect ); + aOffsetRect.setHeight( nBottomOffset ); + + // make sure that the toolbar manager refernence/pointer is valid + uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager ); + if ( xThis.is() ) + m_pToolbarManager->setDockingAreaOffsets( aOffsetRect ); +} + void LayoutManager::implts_setInplaceMenuBar( const Reference< XIndexAccess >& xMergedMenuBar ) -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - if ( !m_bInplaceMenuSet ) - { + if ( !m_bInplaceMenuSet ) + { vos::OGuard aGuard( Application::GetSolarMutex() ); // Reset old inplace menubar! @@ -3604,8 +1180,7 @@ throw (::com::sun::star::uno::RuntimeException) m_xInplaceMenuBar.clear(); m_bInplaceMenuSet = sal_False; - if ( m_xFrame.is() && - m_xContainerWindow.is() ) + if ( m_xFrame.is() && m_xContainerWindow.is() ) { rtl::OUString aModuleIdentifier; Reference< XDispatchProvider > xDispatchProvider; @@ -3614,50 +1189,40 @@ throw (::com::sun::star::uno::RuntimeException) m_pInplaceMenuBar = new MenuBarManager( m_xSMGR, m_xFrame, m_xURLTransformer,xDispatchProvider, aModuleIdentifier, pMenuBar, sal_True, sal_True ); m_pInplaceMenuBar->SetItemContainer( xMergedMenuBar ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) + pSysWindow->SetMenuBar( pMenuBar ); - if ( pWindow ) - { - SystemWindow* pSysWindow = (SystemWindow *)pWindow; - pSysWindow->SetMenuBar( pMenuBar ); - } - - m_bInplaceMenuSet = sal_True; + m_bInplaceMenuSet = sal_True; m_xInplaceMenuBar = Reference< XComponent >( (OWeakObject *)m_pInplaceMenuBar, UNO_QUERY ); } aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + implts_updateMenuBarClose(); } - } void LayoutManager::implts_resetInplaceMenuBar() -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_bInplaceMenuSet = sal_False; // if ( m_xMenuBar.is() && if ( m_xContainerWindow.is() ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); + vos::OGuard aGuard( Application::GetSolarMutex() ); MenuBarWrapper* pMenuBarWrapper = SAL_STATIC_CAST( MenuBarWrapper*, m_xMenuBar.get() ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - - if ( pWindow ) + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) { - SystemWindow* pSysWindow = (SystemWindow *)pWindow; if ( pMenuBarWrapper ) - pSysWindow->SetMenuBar( (MenuBar *)pMenuBarWrapper->GetMenuBarManager()->GetMenuBar() ); - else - pSysWindow->SetMenuBar( 0 ); + pSysWindow->SetMenuBar( (MenuBar *)pMenuBarWrapper->GetMenuBarManager()->GetMenuBar() ); + else + pSysWindow->SetMenuBar( 0 ); } } @@ -3666,21 +1231,14 @@ throw (::com::sun::star::uno::RuntimeException) if ( m_xInplaceMenuBar.is() ) m_xInplaceMenuBar->dispose(); m_xInplaceMenuBar.clear(); - - aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } void SAL_CALL LayoutManager::attachFrame( const Reference< XFrame >& xFrame ) -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_xFrame = xFrame; - aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - // if ( xFrame.is() ) - // xFrame->getContainerWindow()->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } void SAL_CALL LayoutManager::reset() @@ -3688,7 +1246,6 @@ throw (RuntimeException) { sal_Bool bComponentAttached( sal_False ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); bComponentAttached = m_bComponentAttached; aReadLock.unlock(); @@ -3697,13 +1254,13 @@ throw (RuntimeException) } void SAL_CALL LayoutManager::setInplaceMenuBar( sal_Int64 ) -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { OSL_ENSURE( sal_False, "This method is obsolete and should not be used!\n" ); } void SAL_CALL LayoutManager::resetInplaceMenuBar() -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { OSL_ENSURE( sal_False, "This method is obsolete and should not be used!\n" ); } @@ -3713,45 +1270,42 @@ throw (::com::sun::star::uno::RuntimeException) //--------------------------------------------------------------------------------------------------------- sal_Bool SAL_CALL LayoutManager::setMergedMenuBar( const Reference< XIndexAccess >& xMergedMenuBar ) -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { implts_setInplaceMenuBar( xMergedMenuBar ); - css::uno::Any a; - implts_notifyListeners( css::frame::LayoutManagerEvents::MERGEDMENUBAR, a ); + uno::Any a; + implts_notifyListeners( frame::LayoutManagerEvents::MERGEDMENUBAR, a ); return sal_True; } void SAL_CALL LayoutManager::removeMergedMenuBar() -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { implts_resetInplaceMenuBar(); } -::com::sun::star::awt::Rectangle SAL_CALL LayoutManager::getCurrentDockingArea() +awt::Rectangle SAL_CALL LayoutManager::getCurrentDockingArea() throw ( RuntimeException ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); return m_aDockingArea; } Reference< XDockingAreaAcceptor > SAL_CALL LayoutManager::getDockingAreaAcceptor() -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); return m_xDockingAreaAcceptor; } -void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ::com::sun::star::ui::XDockingAreaAcceptor >& xDockingAreaAcceptor ) +void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDockingAreaAcceptor >& xDockingAreaAcceptor ) throw ( RuntimeException ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - if (( m_xDockingAreaAcceptor == xDockingAreaAcceptor ) || - !m_xFrame.is() ) + if (( m_xDockingAreaAcceptor == xDockingAreaAcceptor ) || !m_xFrame.is() ) return; // IMPORTANT: Be sure to stop layout timer if don't have a docking area acceptor! @@ -3759,7 +1313,10 @@ throw ( RuntimeException ) m_aAsyncLayoutTimer.Stop(); sal_Bool bAutomaticToolbars( m_bAutomaticToolbars ); - std::vector< Reference< css::awt::XWindow > > oldDockingAreaWindows; + std::vector< Reference< awt::XWindow > > oldDockingAreaWindows; + + uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; if ( !xDockingAreaAcceptor.is() ) m_aAsyncLayoutTimer.Stop(); @@ -3767,45 +1324,31 @@ throw ( RuntimeException ) // Remove listener from old docking area acceptor if ( m_xDockingAreaAcceptor.is() ) { - Reference< css::awt::XWindow > xWindow( m_xDockingAreaAcceptor->getContainerWindow() ); + Reference< awt::XWindow > xWindow( m_xDockingAreaAcceptor->getContainerWindow() ); if ( xWindow.is() && ( m_xFrame->getContainerWindow() != m_xContainerWindow || !xDockingAreaAcceptor.is() ) ) - xWindow->removeWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject * >( this ), UNO_QUERY )); + xWindow->removeWindowListener( Reference< awt::XWindowListener >( static_cast< OWeakObject * >( this ), UNO_QUERY )); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP] ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM] ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT] ); - oldDockingAreaWindows.push_back( m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT] ); - - m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP].clear(); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM].clear(); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT].clear(); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT].clear(); - m_aDockingArea = css::awt::Rectangle(); + m_aDockingArea = awt::Rectangle(); + if ( pToolbarManager ) + pToolbarManager->resetDockingArea(); Window* pContainerWindow = VCLUnoHelper::GetWindow( xWindow ); if ( pContainerWindow ) pContainerWindow->RemoveChildEventListener( LINK( this, LayoutManager, WindowEventListener ) ); } - // Set new docking area acceptor and add ourself as window listener on the container window. - // Create our docking area windows which are parents for all docked windows. - css::uno::Reference< css::awt::XWindow > xTopDockWindow; - css::uno::Reference< css::awt::XWindow > xBottomDockWindow; - css::uno::Reference< css::awt::XWindow > xLeftDockWindow; - css::uno::Reference< css::awt::XWindow > xRightDockWindow; - - Reference< ::com::sun::star::ui::XDockingAreaAcceptor > xOldDockingAreaAcceptor( m_xDockingAreaAcceptor ); + Reference< ui::XDockingAreaAcceptor > xOldDockingAreaAcceptor( m_xDockingAreaAcceptor ); m_xDockingAreaAcceptor = xDockingAreaAcceptor; if ( m_xDockingAreaAcceptor.is() ) { - m_aDockingArea = css::awt::Rectangle(); + m_aDockingArea = awt::Rectangle(); m_xContainerWindow = m_xDockingAreaAcceptor->getContainerWindow(); m_xContainerTopWindow.set( m_xContainerWindow, UNO_QUERY ); - m_xContainerWindow->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xContainerWindow->addWindowListener( Reference< awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); // we always must keep a connection to the window of our frame for resize events if ( m_xContainerWindow != m_xFrame->getContainerWindow() ) - m_xFrame->getContainerWindow()->addWindowListener( Reference< css::awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xFrame->getContainerWindow()->addWindowListener( Reference< awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); // #i37884# set initial visibility state - in the plugin case the container window is already shown // and we get no notification anymore @@ -3816,32 +1359,15 @@ throw ( RuntimeException ) m_bParentWindowVisible = pContainerWindow->IsVisible(); } - css::uno::Reference< css::awt::XWindowPeer > xParent( m_xContainerWindow, UNO_QUERY ); - xTopDockWindow = Reference< css::awt::XWindow >( implts_createToolkitWindow( xParent ), UNO_QUERY ); - xBottomDockWindow = Reference< css::awt::XWindow >( implts_createToolkitWindow( xParent ), UNO_QUERY ); - xLeftDockWindow = Reference< css::awt::XWindow >( implts_createToolkitWindow( xParent ), UNO_QUERY ); - xRightDockWindow = Reference< css::awt::XWindow >( implts_createToolkitWindow( xParent ), UNO_QUERY ); - m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP] = xTopDockWindow; - m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow; - m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT] = xLeftDockWindow; - m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT] = xRightDockWindow; + uno::Reference< awt::XWindowPeer > xParent( m_xContainerWindow, UNO_QUERY ); } aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( xDockingAreaAcceptor.is() ) { vos::OGuard aGuard( Application::GetSolarMutex() ); - ::DockingAreaWindow* pWindow; - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_TOP ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_BOTTOM ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_LEFT ); - pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ) ); - if( pWindow ) pWindow->SetAlign( WINDOWALIGN_RIGHT ); // Add layout manager as listener to get notifications about toolbar button activties Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); @@ -3856,23 +1382,8 @@ throw ( RuntimeException ) if ( !oldDockingAreaWindows.empty() ) { - const sal_uInt32 nCount = oldDockingAreaWindows.size(); - for ( sal_uInt32 i = 0; i < nCount; ++i ) - { - if ( oldDockingAreaWindows[i].is() ) - { - try - { - oldDockingAreaWindows[i]->dispose(); - } - catch ( Exception& ) - { - } - } - } - // Reset docking area size for our old docking area acceptor - css::awt::Rectangle aEmptyRect; + awt::Rectangle aEmptyRect; xOldDockingAreaAcceptor->setDockingAreaSpace( aEmptyRect ); } @@ -3880,201 +1391,77 @@ throw ( RuntimeException ) { if ( bAutomaticToolbars ) { - implts_createAddonsToolBars(); // create addon toolbars - implts_createCustomToolBars(); // create custom toolbars - implts_createNonContextSensitiveToolBars(); + lock(); + pToolbarManager->createStaticToolbars(); + unlock(); } - implts_sortUIElements(); implts_doLayout( sal_True, sal_False ); } } void LayoutManager::implts_reparentChildWindows() { - UIElementVector aUIElementVector; - UIElement aStatusBarElement; - css::uno::Reference< css::awt::XWindow > xTopDockWindow; - css::uno::Reference< css::awt::XWindow > xBottomDockWindow; - css::uno::Reference< css::awt::XWindow > xLeftDockWindow; - css::uno::Reference< css::awt::XWindow > xRightDockWindow; - css::uno::Reference< css::awt::XWindow > xContainerWindow; - css::uno::Reference< css::awt::XWindow > xStatusBarWindow; - WriteGuard aWriteLock( m_aLock ); - aUIElementVector = m_aUIElements; - xTopDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; - xBottomDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM]; - xLeftDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT]; - xRightDockWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT]; - xContainerWindow = m_xContainerWindow; - aStatusBarElement = m_aStatusBarElement; + UIElement aStatusBarElement = m_aStatusBarElement; + uno::Reference< awt::XWindow > xContainerWindow = m_xContainerWindow; aWriteLock.unlock(); + uno::Reference< awt::XWindow > xStatusBarWindow; if ( aStatusBarElement.m_xUIElement.is() ) { try { - xStatusBarWindow = Reference< css::awt::XWindow >( - aStatusBarElement.m_xUIElement->getRealInterface(), - UNO_QUERY ); - } - catch ( RuntimeException& ) - { - throw; - } - catch ( Exception& ) - { + xStatusBarWindow = Reference< awt::XWindow >( aStatusBarElement.m_xUIElement->getRealInterface(), UNO_QUERY ); } + catch ( RuntimeException& ) { throw; } + catch ( Exception& ) {} } - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - Window* pTopDockWindow = VCLUnoHelper::GetWindow( xTopDockWindow ); - Window* pBottomDockWindow = VCLUnoHelper::GetWindow( xBottomDockWindow ); - Window* pLeftDockWindow = VCLUnoHelper::GetWindow( xLeftDockWindow ); - Window* pRightDockWindow = VCLUnoHelper::GetWindow( xRightDockWindow ); - if ( pContainerWindow ) + if ( xStatusBarWindow.is() ) { - UIElementVector::iterator pIter; - for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) - { - Reference< XUIElement > xUIElement( pIter->m_xUIElement ); - if ( xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow; - try - { - // We have to retreive the window reference with try/catch as it is - // possible that all elements has been disposed! - xWindow = Reference< css::awt::XWindow >( xUIElement->getRealInterface(), UNO_QUERY ); - } - catch ( RuntimeException& ) - { - throw; - } - catch ( Exception& ) - { - } + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + Window* pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow ); + if ( pWindow && pContainerWindow ) + pWindow->SetParent( pContainerWindow ); + } - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - { - // Reparent our child windows acording to their current state. - if ( pIter->m_bFloating ) - pWindow->SetParent( pContainerWindow ); - else - { - if ( pIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_TOP ) - pWindow->SetParent( pTopDockWindow ); - else if ( pIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_BOTTOM ) - pWindow->SetParent( pBottomDockWindow ); - else if ( pIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_LEFT ) - pWindow->SetParent( pLeftDockWindow ); - else - pWindow->SetParent( pRightDockWindow ); - } - } - } - } + implts_resetMenuBar(); - if ( xStatusBarWindow.is() ) - { - Window* pWindow = VCLUnoHelper::GetWindow( xStatusBarWindow ); - if ( pWindow ) - pWindow->SetParent( pContainerWindow ); - } + aWriteLock.lock(); + uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + if ( pToolbarManager ) + pToolbarManager->setParentWindow( uno::Reference< awt::XWindowPeer >( xContainerWindow, uno::UNO_QUERY )); + aWriteLock.unlock(); +} - implts_resetMenuBar(); - } +uno::Reference< ui::XUIElement > LayoutManager::implts_createDockingWindow( const ::rtl::OUString& aElementName ) +{ + Reference< XUIElement > xUIElement = implts_createElement( aElementName ); + return xUIElement; } IMPL_LINK( LayoutManager, WindowEventListener, VclSimpleEvent*, pEvent ) { - // To enable toolbar controllers to change their image when a sub-toolbar function - // is activated, we need this mechanism. We have NO connection between these toolbars - // anymore! + long nResult( 1 ); + if ( pEvent && pEvent->ISA( VclWindowEvent )) { - if ( pEvent->GetId() == VCLEVENT_TOOLBOX_SELECT ) - { - Window* pWindow( ((VclWindowEvent*)pEvent)->GetWindow() ); - ToolBox* pToolBox( 0 ); - rtl::OUString aToolbarName; - rtl::OUString aCommand; - - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - { - pToolBox = (ToolBox *)pWindow; - aToolbarName = rtl::OStringToOUString( pToolBox->GetHelpId(), RTL_TEXTENCODING_UTF8 ); - sal_Int32 i = aToolbarName.lastIndexOf( ':' ); - if (( aToolbarName.getLength() > 0 ) && - ( i > 0 ) && (( i+ 1 ) < aToolbarName.getLength() )) - { - // Remove ".HelpId:" protocol from toolbar name - aToolbarName = aToolbarName.copy( i+1 ); - - USHORT nId = pToolBox->GetCurItemId(); - if ( nId > 0 ) - aCommand = pToolBox->GetItemCommand( nId ); - } - } - - if (( aToolbarName.getLength() > 0 ) && ( aCommand.getLength() > 0 )) - { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - ReadGuard aReadLock( m_aLock ); - std::vector< css::uno::Reference< css::ui::XUIFunctionListener > > aListenerArray; - UIElementVector::iterator pIter; - - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aType.equalsAscii( "toolbar" ) && - pIter->m_xUIElement.is() ) - { - css::uno::Reference< css::ui::XUIFunctionListener > xListener( pIter->m_xUIElement, UNO_QUERY ); - if ( xListener.is() ) - aListenerArray.push_back( xListener ); - } - } - aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - - const sal_uInt32 nCount = aListenerArray.size(); - for ( sal_uInt32 i = 0; i < nCount; ++i ) - { - try - { - aListenerArray[i]->functionExecute( aToolbarName, aCommand ); - } - catch ( RuntimeException& e ) - { - throw e; - } - catch ( Exception& ) {} - } - } - } - else if ( pEvent->GetId() == VCLEVENT_TOOLBOX_FORMATCHANGED ) + Window* pWindow = static_cast< VclWindowEvent* >(pEvent)->GetWindow(); + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); + uno::Reference< ui::XUIConfigurationListener > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); + aReadLock.unlock(); - Window* pWindow( ((VclWindowEvent*)pEvent)->GetWindow() ); - ToolBox* pToolBox( 0 ); - rtl::OUString aToolbarName; - - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - { - pToolBox = (ToolBox *)pWindow; - aToolbarName = rtl::OStringToOUString( pToolBox->GetHelpId(), RTL_TEXTENCODING_UTF8 ); - if (( aToolbarName.getLength() > 0 ) && ( m_nLockCount == 0 )) - m_aAsyncLayoutTimer.Start(); - } - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( pToolbarManager ) + nResult = pToolbarManager->childWindowEvent( pEvent ); } } - return 1; + return nResult; } void SAL_CALL LayoutManager::createElement( const ::rtl::OUString& aName ) @@ -4082,13 +1469,11 @@ throw (RuntimeException) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::createElement" ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); Reference< XFrame > xFrame = m_xFrame; Reference< XURLTransformer > xURLTransformer = m_xURLTransformer; sal_Bool bInPlaceMenu = m_bInplaceMenuSet; aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( !xFrame.is() ) return; @@ -4098,105 +1483,35 @@ throw (RuntimeException) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - sal_Bool bFound( sal_False ); - sal_Bool bNotify( sal_False ); - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - Reference< ::com::sun::star::ui::XUIElement > xUIElement; + bool bMustBeLayouted( false ); + bool bNotify( false ); - implts_findElement( aName, aElementType, aElementName, xUIElement ); - bFound = xUIElement.is(); - - if ( /*xFrame.is() && */m_xContainerWindow.is() && !implts_isPreviewModel( xModel ) ) // no bars on preview mode + if ( m_xContainerWindow.is() && !implts_isPreviewModel( xModel ) ) // no UI elements on preview frames { - if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) - { - if ( !bFound ) - { - SvtCommandOptions aCmdOptions; - - xUIElement = implts_createElement( aName ); - sal_Bool bVisible( sal_False ); - if ( xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xUIElement->getRealInterface(), UNO_QUERY ); - if ( xDockWindow.is() && xWindow.is() ) - { - try - { - xDockWindow->addDockableWindowListener( Reference< css::awt::XDockableWindowListener >( - static_cast< OWeakObject * >( this ), UNO_QUERY )); - xWindow->addWindowListener( Reference< css::awt::XWindowListener >( - static_cast< OWeakObject * >( this ), UNO_QUERY )); - xDockWindow->enableDocking( sal_True ); - } - catch ( Exception& ) - { - } - } - - UIElement& rElement = impl_findElement( aName ); - if ( rElement.m_aName.getLength() > 0 ) - { - // Reuse a local entry so we are able to use the latest - // UI changes for this document. - implts_setElementData( rElement, xDockWindow ); - rElement.m_xUIElement = xUIElement; - bVisible = rElement.m_bVisible; - } - else - { - // Create new UI element and try to read its state data - UIElement aNewToolbar( aName, aElementType, xUIElement ); - implts_readWindowStateData( aName, aNewToolbar ); - implts_setElementData( aNewToolbar, xDockWindow ); - implts_insertUIElement( aNewToolbar ); - bVisible = aNewToolbar.m_bVisible; - } - - // set toolbar menu style according to customize command state - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - { - ToolBox* pToolbar = (ToolBox *)pWindow; - USHORT nMenuType = pToolbar->GetMenuType(); - if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, m_aCustomizeCmd )) - pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE ); - else - pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE ); - } - } - aWriteLock.unlock(); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; - implts_sortUIElements(); + parseResourceURL( aName, aElementType, aElementName ); - if ( bVisible ) - { - doLayout(); - bNotify = sal_True; - } - } + if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ) && m_pToolbarManager != NULL ) + { + bNotify = m_pToolbarManager->createToolbar( aName ); + bMustBeLayouted = m_pToolbarManager->isLayoutDirty(); } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" )) + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - if ( aElementName.equalsIgnoreAsciiCaseAscii( "menubar" ) && !bInPlaceMenu ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - // PB 2004-12-15 #i38743# don't create a menubar if frame isn't top - if ( !m_xMenuBar.is() && implts_isFrameOrWindowTop(xFrame) ) - m_xMenuBar = implts_createElement( aName ); - - if ( m_xMenuBar.is() && implts_isFrameOrWindowTop(xFrame) ) + // PB 2004-12-15 #i38743# don't create a menubar if frame isn't top + if ( !bInPlaceMenu && !m_xMenuBar.is() && implts_isFrameOrWindowTop( xFrame )) + { + m_xMenuBar = implts_createElement( aName ); + if ( m_xMenuBar.is() ) { - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); + vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( pWindow ) + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) { - SystemWindow* pSysWindow = (SystemWindow *)pWindow; - Reference< css::awt::XMenuBar > xMenuBar; + Reference< awt::XMenuBar > xMenuBar; Reference< XPropertySet > xPropSet( m_xMenuBar, UNO_QUERY ); if ( xPropSet.is() ) @@ -4205,12 +1520,8 @@ throw (RuntimeException) { xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "XMenuBar" ))) >>= xMenuBar; } - catch ( com::sun::star::beans::UnknownPropertyException ) - { - } - catch ( com::sun::star::lang::WrappedTargetException ) - { - } + catch ( beans::UnknownPropertyException ) {} + catch ( lang::WrappedTargetException ) {} } if ( xMenuBar.is() ) @@ -4224,9 +1535,7 @@ throw (RuntimeException) pSysWindow->SetMenuBar( pMenuBar ); pMenuBar->SetDisplayable( m_bMenuVisible ); if ( m_bMenuVisible ) - { bNotify = sal_True; - } implts_updateMenuBarClose(); } } @@ -4241,27 +1550,35 @@ throw (RuntimeException) implts_createStatusBar( aName ); bNotify = sal_True; } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - implts_isFrameOrWindowTop(xFrame) ) + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ) && implts_isFrameOrWindowTop(xFrame) ) { implts_createProgressBar(); bNotify = sal_True; } else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) { - aWriteLock.unlock(); + // Add layout manager as listener for docking and other window events + uno::Reference< uno::XInterface > xThis( static_cast< OWeakObject* >(this), uno::UNO_QUERY ); + uno::Reference< ui::XUIElement > xUIElement( implts_createDockingWindow( aName )); + + if ( xUIElement.is() ) + { + impl_addWindowListeners( xThis, xUIElement ); + m_pPanelManager->addDockingWindow( aName, xUIElement ); + } // The docking window is created by a factory method located in the sfx2 library. - CreateDockingWindow( xFrame, aElementName ); +// CreateDockingWindow( xFrame, aElementName ); } } - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + if ( bMustBeLayouted ) + implts_doLayout_notify( sal_True ); + if ( bNotify ) { // UI element is invisible - provide information to listeners - implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( aName ) ); + implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( aName ) ); } } @@ -4273,112 +1590,54 @@ throw (RuntimeException) /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - sal_Bool bMustLayouted( sal_False ); - sal_Bool bMustBeDestroyed( sal_False ); - sal_Bool bMustBeSorted( sal_False ); - sal_Bool bNotify( sal_False ); - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; + bool bMustBeLayouted( sal_False ); + bool bMustBeDestroyed( sal_False ); + bool bNotify( sal_False ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; Reference< XComponent > xComponent; - if ( impl_parseResourceURL( aName, aElementType, aElementName )) + parseResourceURL( aName, aElementType, aElementName ); + + if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) - { - if ( !m_bInplaceMenuSet ) - { - impl_clearUpMenuBar(); - m_xMenuBar.clear(); - bNotify = sal_True; - } - } - else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || - ( m_aStatusBarElement.m_aName == aName )) - { - aWriteLock.unlock(); - implts_destroyStatusBar(); - bMustLayouted = sal_True; - bNotify = sal_True; - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ) ) - { - aWriteLock.unlock(); - implts_createProgressBar(); - bMustLayouted = sal_True; - bNotify = sal_True; - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) + if ( !m_bInplaceMenuSet ) { - UIElementVector::iterator pIter; - - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName ) - { - xComponent.set( pIter->m_xUIElement, UNO_QUERY ); - Reference< XUIElement > xUIElement( pIter->m_xUIElement ); - if ( xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - - rtl::OUString aAddonTbResourceName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )); - if ( aName.indexOf( aAddonTbResourceName ) != 0 ) - { - try - { - if ( xWindow.is() ) - xWindow->removeWindowListener( Reference< css::awt::XWindowListener >( - static_cast< OWeakObject * >( this ), UNO_QUERY )); - } - catch( Exception& ) - { - } - - try - { - if ( xDockWindow.is() ) - xDockWindow->removeDockableWindowListener( Reference< css::awt::XDockableWindowListener >( - static_cast< OWeakObject * >( this ), UNO_QUERY )); - } - catch ( Exception& ) - { - } - - bMustBeDestroyed = sal_True; - } - else - { - pIter->m_bVisible = sal_False; - xWindow->setVisible( sal_False ); - bNotify = sal_True; - } - - if ( !xDockWindow->isFloating() ) - bMustLayouted = sal_True; - if ( bMustBeDestroyed ) - pIter->m_xUIElement.clear(); - - bMustBeSorted = sal_True; - } - - break; - } - } + impl_clearUpMenuBar(); + m_xMenuBar.clear(); + bNotify = true; } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) - { - css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR ); - aWriteLock.unlock(); + } + else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || + ( m_aStatusBarElement.m_aName == aName )) + { + aWriteLock.unlock(); + implts_destroyStatusBar(); + bMustBeLayouted = true; + bNotify = true; + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) + { + aWriteLock.unlock(); + implts_createProgressBar(); + bMustBeLayouted = true; + bNotify = sal_True; + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ) && m_pToolbarManager != NULL ) + { + aWriteLock.unlock(); + bNotify = m_pToolbarManager->destroyToolbar( aName ); + bMustBeLayouted = m_pToolbarManager->isLayoutDirty(); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) + { + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); + aWriteLock.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); - bMustLayouted = sal_False; - bNotify = sal_False; - } + impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); + bMustBeLayouted = false; + bNotify = false; } aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -4387,173 +1646,91 @@ throw (RuntimeException) { if ( xComponent.is() ) xComponent->dispose(); - bNotify = sal_True; + bNotify = true; } - if ( bMustBeSorted ) - { - implts_sortUIElements(); - if ( bMustLayouted ) - doLayout(); - } + if ( bMustBeLayouted ) + doLayout(); if ( bNotify ) - { - // UI element is invisible - provide information to listeners - implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::makeAny( aName ) ); - } + implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::makeAny( aName ) ); } -::sal_Bool SAL_CALL LayoutManager::requestElement( const ::rtl::OUString& ResourceURL ) -throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL LayoutManager::requestElement( const ::rtl::OUString& rResourceURL ) +throw (uno::RuntimeException) { - RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::requestElement" ); + bool bResult( false ); + bool bNotify( false ); + bool bDoLayout( false ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - UIElementVector::iterator pIter; - sal_Bool bResult( sal_False ); - sal_Bool bNotify( sal_False ); + parseResourceURL( rResourceURL, aElementType, aElementName ); WriteGuard aWriteLock( m_aLock ); - if ( impl_parseResourceURL( ResourceURL, aElementType, aElementName )) - { - ::rtl::OString aResName = rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US ); - RTL_LOGFILE_CONTEXT_TRACE1( aLog, "framework (cd100003) Element %s", aResName.getStr() ); - if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || - ( m_aStatusBarElement.m_aName == ResourceURL )) - { - implts_readStatusBarState( ResourceURL ); - if ( m_aStatusBarElement.m_bVisible && !m_aStatusBarElement.m_bMasterHide ) - { - createElement( ResourceURL ); + ::rtl::OString aResName = rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "framework (cd100003) Element %s requested.", aResName.getStr() ); - // There are some situation where we are not able to create an element. - // Therefore we have to check the reference before further action. - // See #i70019# - css::uno::Reference< css::ui::XUIElement > xUIElement( m_aStatusBarElement.m_xUIElement ); - if ( xUIElement.is() ) - { - // we need VCL here to pass special flags to Show() - vos::OGuard aGuard( Application::GetSolarMutex() ); - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - { - pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - doLayout(); - bResult = sal_True; - bNotify = sal_True; - } - } - } - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ) ) + if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || ( m_aStatusBarElement.m_aName == rResourceURL )) + { + implts_readStatusBarState( rResourceURL ); + if ( m_aStatusBarElement.m_bVisible && !m_aStatusBarElement.m_bMasterHide ) { aWriteLock.unlock(); - implts_showProgressBar(); - doLayout(); - bResult = sal_True; - bNotify = sal_True; - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) - { - if ( m_bVisible ) - { - bool bFound( false ); - bool bShowElement( false ); - - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == ResourceURL ) - { - bFound = sal_True; - bShowElement = ( pIter->m_bVisible && !pIter->m_bMasterHide && m_bParentWindowVisible ); - - Reference< css::awt::XWindow2 > xContainerWindow( m_xContainerWindow, UNO_QUERY ); - if ( xContainerWindow.is() && pIter->m_bFloating ) - bShowElement = ( bShowElement && xContainerWindow->isActive() ); - - if ( pIter->m_xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - - if ( xDockWindow.is() && xDockWindow->isFloating() ) - bShowElement = ( bShowElement && xContainerWindow->isActive() ); + createElement( rResourceURL ); - if ( xDockWindow.is() && bShowElement ) - { - pIter->m_bVisible = sal_True; - aWriteLock.unlock(); - - // we need VCL here to pass special flags to Show() - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if( pWindow && !pWindow->IsReallyVisible() ) - { - pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - implts_writeNewStateData( ResourceURL, xWindow ); - - if ( xDockWindow.is() && !xDockWindow->isFloating() ) - doLayout(); - bResult = sal_True; - bNotify = sal_True; - } - - bResult = sal_False; - } - } // if ( pIter->m_xUIElement.is() ) - break; - } - } - - // Create toolbar on demand when it's visible - if ( !bResult ) + // There are some situation where we are not able to create an element. + // Therefore we have to check the reference before further action. + // See #i70019# + uno::Reference< ui::XUIElement > xUIElement( m_aStatusBarElement.m_xUIElement ); + if ( xUIElement.is() ) + { + // we need VCL here to pass special flags to Show() + vos::OGuard aGuard( Application::GetSolarMutex() ); + Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) { - Reference< ::com::sun::star::ui::XUIElement > xUIElement; - if ( !bFound ) - { - UIElement aNewToolbar( aElementName, aElementType, xUIElement ); - aNewToolbar.m_aName = ResourceURL; - implts_readWindowStateData( ResourceURL, aNewToolbar ); - implts_insertUIElement( aNewToolbar ); - aWriteLock.unlock(); - - implts_sortUIElements(); - if ( aNewToolbar.m_bVisible ) - createElement( ResourceURL ); - bResult = sal_True; - bNotify = sal_True; - } - else if ( bShowElement ) - { - aWriteLock.unlock(); - - createElement( ResourceURL ); - bResult = sal_True; - bNotify = sal_True; - } + pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + bResult = true; + bNotify = true; + bDoLayout = true; } } } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ) ) + { + aWriteLock.unlock(); + implts_showProgressBar(); + bResult = true; + bNotify = true; + bDoLayout = true; + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR ) && m_bVisible ) + { + bool bComponentAttached( m_aModuleIdentifier.getLength() > 0 ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aWriteLock.unlock(); + + if ( pToolbarManager && bComponentAttached ) { - css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); - aWriteLock.unlock(); + bNotify = pToolbarManager->requestToolbar( rResourceURL ); + bDoLayout = true; + } + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) + { + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + aWriteLock.unlock(); - CreateDockingWindow( xFrame, aElementName ); - } + CreateDockingWindow( xFrame, aElementName ); } if ( bNotify ) - { - // UI element is visible - provide information to listeners - implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( ResourceURL ) ); - } + implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( rResourceURL ) ); return bResult; } @@ -4561,50 +1738,54 @@ throw (::com::sun::star::uno::RuntimeException) Reference< XUIElement > SAL_CALL LayoutManager::getElement( const ::rtl::OUString& aName ) throw (RuntimeException) { - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - Reference< XUIElement > xElement; + Reference< XUIElement > xUIElement = implts_findElement( aName ); + if ( !xUIElement.is() ) + { + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); + aReadLock.unlock(); - implts_findElement( aName, aElementType, aElementName, xElement ); - return xElement; + if ( pToolbarManager ) + xUIElement = pToolbarManager->getToolbar( aName ); + } + + return xUIElement; } -Sequence< Reference< ::com::sun::star::ui::XUIElement > > SAL_CALL LayoutManager::getElements() -throw (::com::sun::star::uno::RuntimeException) +Sequence< Reference< ui::XUIElement > > SAL_CALL LayoutManager::getElements() +throw (uno::RuntimeException) { - ReadGuard aReadLock( m_aLock ); + ReadGuard aReadLock( m_aLock ); + uno::Reference< ui::XUIElement > xMenuBar( m_xMenuBar ); + uno::Reference< ui::XUIElement > xStatusBar( m_aStatusBarElement.m_xUIElement ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); + aReadLock.unlock(); - sal_Bool bMenuBar( sal_False ); - sal_Bool bStatusBar( sal_False ); - sal_Int32 nSize = m_aUIElements.size(); + Sequence< Reference< ui::XUIElement > > aSeq; + if ( pToolbarManager ) + aSeq = pToolbarManager->getToolbars(); - if ( m_xMenuBar.is() ) + sal_Int32 nSize = aSeq.getLength(); + sal_Int32 nMenuBarIndex(-1); + sal_Int32 nStatusBarIndex(-1); + if ( xMenuBar.is() ) { + nMenuBarIndex = nSize; ++nSize; - bMenuBar = sal_True; } - if ( m_aStatusBarElement.m_xUIElement.is() ) + if ( xStatusBar.is() ) { + nStatusBarIndex = nSize; ++nSize; - bStatusBar = sal_True; } - Sequence< Reference< ::com::sun::star::ui::XUIElement > > aSeq( nSize ); - - sal_Int32 nIndex = 0; - UIElementVector::const_iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_xUIElement.is() ) - aSeq[nIndex++] = pIter->m_xUIElement; - } - if ( bMenuBar ) - aSeq[nIndex++] = m_xMenuBar; - if ( bStatusBar ) - aSeq[nIndex++] = m_aStatusBarElement.m_xUIElement; - - // Resize sequence as we now know our correct size - aSeq.realloc( nIndex ); + aSeq.realloc(nSize); + if ( nMenuBarIndex >= 0 ) + aSeq[nMenuBarIndex] = xMenuBar; + if ( nStatusBarIndex >= 0 ) + aSeq[nStatusBarIndex] = xStatusBar; return aSeq; } @@ -4614,115 +1795,80 @@ throw (RuntimeException) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::showElement" ); - sal_Bool bResult( sal_False ); - sal_Bool bNotify( sal_False ); - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; + bool bResult( false ); + bool bNotify( false ); + bool bMustLayout( false ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + + parseResourceURL( aName, aElementType, aElementName ); - if ( impl_parseResourceURL( aName, aElementType, aElementName )) + ::rtl::OString aResName = rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "framework (cd100003) Element %s", aResName.getStr() ); + + if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - ::rtl::OString aResName = rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US ); - RTL_LOGFILE_CONTEXT_TRACE1( aLog, "framework (cd100003) Element %s", aResName.getStr() ); + WriteGuard aWriteLock( m_aLock ); + m_bMenuVisible = sal_True; + aWriteLock.unlock(); - if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) + bResult = implts_resetMenuBar(); + bNotify = bResult; + } + else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || ( m_aStatusBarElement.m_aName == aName )) + { + WriteGuard aWriteLock( m_aLock ); + if ( m_aStatusBarElement.m_xUIElement.is() && !m_aStatusBarElement.m_bMasterHide && + implts_showStatusBar( sal_True )) { - WriteGuard aWriteLock( m_aLock ); - m_bMenuVisible = sal_True; aWriteLock.unlock(); - bResult = implts_resetMenuBar(); - bNotify = bResult; - } - else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || - ( m_aStatusBarElement.m_aName == aName )) - { - WriteGuard aWriteLock( m_aLock ); - if ( m_aStatusBarElement.m_xUIElement.is() && - !m_aStatusBarElement.m_bMasterHide ) - { - if ( implts_showStatusBar( sal_True )) - { - implts_writeWindowStateData( m_aStatusBarAlias, m_aStatusBarElement ); - doLayout(); - bResult = sal_True; - bNotify = sal_True; - } - } - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) - { - bNotify = bResult = implts_showProgressBar(); - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) - { - UIElementVector::iterator pIter; - - WriteGuard aWriteLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName && pIter->m_xUIElement.is() ) - { - UIElement aUIElement = *pIter; - Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - - sal_Bool bShowElement( !pIter->m_bMasterHide && m_bParentWindowVisible ); - - pIter->m_bVisible = sal_True; - aWriteLock.unlock(); - - implts_writeWindowStateData( aUIElement.m_aName, aUIElement ); - implts_sortUIElements(); - - if ( xDockWindow.is() && bShowElement ) - { - // we need VCL here to pass special flags to Show() - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if( pWindow ) - { - pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); - bNotify = sal_True; - } - implts_writeNewStateData( aName, xWindow ); - - if ( xDockWindow.is() && !xDockWindow->isFloating() ) - doLayout(); - - bResult = sal_True; - } // if ( xDockWindow.is() && bShowElement ) - break; - } - } + implts_writeWindowStateData( m_aStatusBarAlias, m_aStatusBarElement ); + bMustLayout = true; + bResult = true; + bNotify = true; } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) - { - ReadGuard aReadGuard( m_aLock ); - css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR ); - aReadGuard.unlock(); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) + { + bNotify = bResult = implts_showProgressBar(); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) + { + ReadGuard aReadLock( m_aLock ); + uno::Reference< awt::XWindowListener > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, true ); - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolpanel" )) + if ( pToolbarManager ) { - ReadGuard aReadGuard( m_aLock ); - css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); - aReadGuard.unlock(); - - ActivateToolPanel( m_xFrame, aName ); + bNotify = pToolbarManager->showToolbar( aName ); + bMustLayout = pToolbarManager->isLayoutDirty(); } } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) + { + ReadGuard aReadGuard( m_aLock ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); + aReadGuard.unlock(); - if ( bNotify ) + impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, true ); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolpanel" )) { - // UI element is visible - provide information to listeners - implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( aName ) ); + ReadGuard aReadGuard( m_aLock ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + aReadGuard.unlock(); + ActivateToolPanel( m_xFrame, aName ); } + if ( bMustLayout ) + doLayout(); + + if ( bNotify ) + implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_VISIBLE, uno::makeAny( aName ) ); + return bResult; } @@ -4731,479 +1877,240 @@ throw (RuntimeException) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::hideElement" ); + bool bResult( false ); + bool bNotify( false ); + bool bMustLayout( false ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; - sal_Bool bResult( sal_False ); - sal_Bool bNotify( sal_False ); - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; + parseResourceURL( aName, aElementType, aElementName ); + ::rtl::OString aResName = rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US ); + RTL_LOGFILE_CONTEXT_TRACE1( aLog, "framework (cd100003) Element %s", aResName.getStr() ); - if ( impl_parseResourceURL( aName, aElementType, aElementName )) + if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - ::rtl::OString aResName = rtl::OUStringToOString( aElementName, RTL_TEXTENCODING_ASCII_US ); - RTL_LOGFILE_CONTEXT_TRACE1( aLog, "framework (cd100003) Element %s", aResName.getStr() ); + WriteGuard aWriteLock( m_aLock ); - if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) + if ( m_xContainerWindow.is() ) { - WriteGuard aWriteLock( m_aLock ); + m_bMenuVisible = sal_False; - if ( m_xContainerWindow.is() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - - m_bMenuVisible = sal_False; - if ( pWindow ) - { - MenuBar* pMenuBar = ((SystemWindow *)pWindow)->GetMenuBar(); - if ( pMenuBar ) - { - pMenuBar->SetDisplayable( sal_False ); - bResult = sal_True; - bNotify = sal_True; - } - } - } - } - else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || - ( m_aStatusBarElement.m_aName == aName )) - { - WriteGuard aWriteLock( m_aLock ); - if ( m_aStatusBarElement.m_xUIElement.is() && - !m_aStatusBarElement.m_bMasterHide ) + vos::OGuard aGuard( Application::GetSolarMutex() ); + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) { - if ( implts_hideStatusBar( sal_True )) + MenuBar* pMenuBar = pSysWindow->GetMenuBar(); + if ( pMenuBar ) { - implts_writeWindowStateData( m_aStatusBarAlias, m_aStatusBarElement ); - doLayout(); - bNotify = sal_True; - bResult = sal_True; + pMenuBar->SetDisplayable( sal_False ); + bResult = true; + bNotify = true; } } } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) + } + else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || ( m_aStatusBarElement.m_aName == aName )) + { + WriteGuard aWriteLock( m_aLock ); + if ( m_aStatusBarElement.m_xUIElement.is() && !m_aStatusBarElement.m_bMasterHide && + implts_hideStatusBar( sal_True )) { - bResult = bNotify = implts_hideProgressBar(); + implts_writeWindowStateData( m_aStatusBarAlias, m_aStatusBarElement ); + bMustLayout = sal_True; + bNotify = sal_True; + bResult = sal_True; } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) - { - UIElementVector::iterator pIter; - - WriteGuard aWriteLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aName == aName && pIter->m_xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - - if ( xDockWindow.is() ) - { - pIter->m_bVisible = sal_False; - aWriteLock.unlock(); - - xWindow->setVisible( sal_False ); - implts_writeNewStateData( aName, xWindow ); - - if ( xDockWindow.is() && !xDockWindow->isFloating() ) - doLayout(); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" )) + { + bResult = bNotify = implts_hideProgressBar(); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) + { + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - bResult = sal_True; - bNotify = sal_True; - } // if ( xDockWindow.is() ) - break; - } - } - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) - { - ReadGuard aReadGuard( m_aLock ); - css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR( m_xSMGR ); - aReadGuard.unlock(); + bNotify = pToolbarManager->hideToolbar( aName ); + bMustLayout = pToolbarManager->isLayoutDirty(); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) + { + ReadGuard aReadGuard( m_aLock ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + uno::Reference< lang::XMultiServiceFactory > xSMGR( m_xSMGR ); + aReadGuard.unlock(); - impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); - } + impl_setDockingWindowVisibility( xSMGR, xFrame, aElementName, false ); } + if ( bMustLayout ) + doLayout(); + if ( bNotify ) - { - // UI element is visible - provide information to listeners - implts_notifyListeners( css::frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::makeAny( aName ) ); - } + implts_notifyListeners( frame::LayoutManagerEvents::UIELEMENT_INVISIBLE, uno::makeAny( aName ) ); return sal_False; } -sal_Bool SAL_CALL LayoutManager::dockWindow( const ::rtl::OUString& aName, DockingArea DockingArea, const css::awt::Point& Pos ) +sal_Bool SAL_CALL LayoutManager::dockWindow( const ::rtl::OUString& aName, DockingArea DockingArea, const awt::Point& Pos ) throw (RuntimeException) { - UIElement aUIElement; + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; - if ( implts_findElement( aName, aUIElement ) && aUIElement.m_xUIElement.is() ) + parseResourceURL( aName, aElementType, aElementName ); + if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xDockWindow.is() ) - { - if ( DockingArea != DockingArea_DOCKINGAREA_DEFAULT ) - aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( DockingArea ); - - if (( Pos.X != SAL_MAX_INT32 ) && ( Pos.Y != SAL_MAX_INT32 )) - aUIElement.m_aDockedData.m_aPos = ::Point( Pos.X, Pos.Y ); - - if ( !xDockWindow->isFloating() ) - { - Window* pWindow( 0 ); - ToolBox* pToolBox( 0 ); - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - { - pToolBox = (ToolBox *)pWindow; - - // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a - // horizontal to a vertical docking area! - pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea )); - } - } - - if (( aUIElement.m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) || - ( aUIElement.m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 )) - { - // Docking on its default position without a preset position - - // we have to find a good place for it. - ::Size aSize; - - vos::OGuard aGuard( Application::GetSolarMutex() ); - { - if ( pToolBox ) - aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) ); - else - aSize = pWindow->GetSizePixel(); - } - - ::Point aPixelPos; - ::Point aDockPos; - implts_findNextDockingPos( (::com::sun::star::ui::DockingArea)aUIElement.m_aDockedData.m_nDockedArea, - aSize, - aDockPos, - aPixelPos ); - aUIElement.m_aDockedData.m_aPos = aDockPos; - } - } - - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName ); - if ( rUIElement.m_aName == aName ) - { - rUIElement.m_aDockedData.m_nDockedArea = aUIElement.m_aDockedData.m_nDockedArea; - rUIElement.m_aDockedData.m_aPos = aUIElement.m_aDockedData.m_aPos; - } - aWriteLock.unlock(); - - if ( xDockWindow->isFloating() ) - { - // Will call toggle floating mode which will do the rest! - xWindow->setVisible( sal_False ); - xDockWindow->setFloatingMode( sal_False ); - xWindow->setVisible( sal_True ); - } - else - { - implts_writeWindowStateData( aName, aUIElement ); - implts_sortUIElements(); - - if ( aUIElement.m_bVisible ) - doLayout(); - } + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - return sal_True; - } - } - catch ( DisposedException& ) + if ( pToolbarManager ) { + pToolbarManager->dockToolbar( aName, DockingArea, Pos ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } - return sal_False; } -::sal_Bool SAL_CALL LayoutManager::dockAllWindows( ::sal_Int16 nElementType ) throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL LayoutManager::dockAllWindows( ::sal_Int16 /*nElementType*/ ) throw (uno::RuntimeException) { - if ( nElementType == UIElementType::TOOLBAR ) - { - std::vector< rtl::OUString > aToolBarNameVector; - - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - - { - ReadGuard aReadLock( m_aLock ); - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_aType.equalsAscii( "toolbar" ) && - pIter->m_xUIElement.is() && - pIter->m_bFloating && - pIter->m_bVisible ) - aToolBarNameVector.push_back( pIter->m_aName ); - } - } + ReadGuard aReadLock( m_aLock ); + bool bResult( false ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - const sal_uInt32 nCount = aToolBarNameVector.size(); - for ( sal_uInt32 i = 0; i < nCount; ++i ) - { - ::com::sun::star::awt::Point aPoint; - aPoint.X = aPoint.Y = SAL_MAX_INT32; - dockWindow( aToolBarNameVector[i], DockingArea_DOCKINGAREA_DEFAULT, aPoint ); - } + if ( pToolbarManager ) + { + bResult = pToolbarManager->dockAllToolbars(); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } - - return sal_False; + return bResult; } sal_Bool SAL_CALL LayoutManager::floatWindow( const ::rtl::OUString& aName ) throw (RuntimeException) { - UIElement aUIElement; - - if ( implts_findElement( aName, aUIElement )) + bool bResult( false ); + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( aUIElement.m_xUIElement.is() ) + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xWindow.is() && xDockWindow.is() ) - { - if ( !xDockWindow->isFloating() ) - { - xDockWindow->setFloatingMode( sal_True ); - return sal_True; - } - } - } - catch ( DisposedException& ) - { - } + bResult = pToolbarManager->floatToolbar( aName ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } - - return sal_False; + return bResult; } -::sal_Bool SAL_CALL LayoutManager::lockWindow( const ::rtl::OUString& ResourceURL ) -throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL LayoutManager::lockWindow( const ::rtl::OUString& aName ) +throw (uno::RuntimeException) { - UIElement aUIElement; - - if ( implts_findElement( ResourceURL, aUIElement )) + bool bResult( false ); + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( aUIElement.m_xUIElement.is() ) + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && - pWindow->IsVisible() && - xDockWindow.is() && - !xDockWindow->isFloating() ) - { - aUIElement.m_aDockedData.m_bLocked = sal_True; - implts_writeWindowStateData( ResourceURL, aUIElement ); - xDockWindow->lock(); - - // Write back lock state - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName ); - if ( rUIElement.m_aName == aUIElement.m_aName ) - rUIElement.m_aDockedData.m_bLocked = aUIElement.m_aDockedData.m_bLocked; - aWriteLock.unlock(); - - doLayout(); - return sal_True; - } - } - catch ( DisposedException& ) - { - } + bResult = pToolbarManager->lockToolbar( aName ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } - - return sal_False; + return bResult; } -::sal_Bool SAL_CALL LayoutManager::unlockWindow( const ::rtl::OUString& ResourceURL ) -throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL LayoutManager::unlockWindow( const ::rtl::OUString& aName ) +throw (uno::RuntimeException) { - UIElement aUIElement; - - if ( implts_findElement( ResourceURL, aUIElement )) + bool bResult( false ); + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( aUIElement.m_xUIElement.is() ) + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && - pWindow->IsVisible() && - xDockWindow.is() && - !xDockWindow->isFloating() ) - { - aUIElement.m_aDockedData.m_bLocked = sal_False; - implts_writeWindowStateData( ResourceURL, aUIElement ); - xDockWindow->unlock(); - - // Write back lock state - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName ); - if ( rUIElement.m_aName == aUIElement.m_aName ) - rUIElement.m_aDockedData.m_bLocked = aUIElement.m_aDockedData.m_bLocked; - aWriteLock.unlock(); - - doLayout(); - return sal_True; - } - } - catch ( DisposedException& ) - { - } + bResult = pToolbarManager->unlockToolbar( aName ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } - - return sal_False; + return bResult; } -void SAL_CALL LayoutManager::setElementSize( const ::rtl::OUString& aName, const css::awt::Size& aSize ) +void SAL_CALL LayoutManager::setElementSize( const ::rtl::OUString& aName, const awt::Size& aSize ) throw (RuntimeException) { - UIElement aUIElement; - - if ( implts_findElement( aName, aUIElement )) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( aUIElement.m_xUIElement.is() ) - { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XWindow2 > xWindow2( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xThis( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - if ( xWindow.is() && xWindow2.is() && xDockWindow.is() ) - { - if ( aUIElement.m_bFloating ) - { - xWindow2->setOutputSize( aSize ); - implts_writeNewStateData( aName, xWindow ); - } - } - } - catch ( DisposedException& ) - { - } + if ( pToolbarManager ) + { + pToolbarManager->setToolbarSize( aName, aSize ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } } -void SAL_CALL LayoutManager::setElementPos( const ::rtl::OUString& aName, const css::awt::Point& aPos ) +void SAL_CALL LayoutManager::setElementPos( const ::rtl::OUString& aName, const awt::Point& aPos ) throw (RuntimeException) { - UIElement aUIElement; - - if ( implts_findElement( aName, aUIElement ) && aUIElement.m_xUIElement.is() ) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); + ReadGuard aReadLock( m_aLock ); + uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); + aReadLock.unlock(); - if ( xWindow.is() && xDockWindow.is() ) - { - if ( aUIElement.m_bFloating ) - { - xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, css::awt::PosSize::POS ); - implts_writeNewStateData( aName, xWindow ); - } - else - { - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName ); - if ( rUIElement.m_aName == aName ) - rUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y ); - aWriteLock.unlock(); - - aUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y ); - implts_writeWindowStateData( aName, aUIElement ); - implts_sortUIElements(); - - if ( aUIElement.m_bVisible ) - doLayout(); - } - } - } - catch ( DisposedException& ) + if ( pToolbarManager ) { + pToolbarManager->setToolbarPos( aName, aPos ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } } -void SAL_CALL LayoutManager::setElementPosSize( const ::rtl::OUString& aName, const css::awt::Point& aPos, const css::awt::Size& aSize ) +void SAL_CALL LayoutManager::setElementPosSize( const ::rtl::OUString& aName, const awt::Point& aPos, const awt::Size& aSize ) throw (RuntimeException) { - UIElement aUIElement; - - if ( implts_findElement( aName, aUIElement )) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( aUIElement.m_xUIElement.is() ) - { - try - { - Reference< css::awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XWindow2 > xWindow2( aUIElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - - if ( xWindow.is() && xWindow2.is() && xDockWindow.is() ) - { - if ( aUIElement.m_bFloating ) - { - xWindow2->setPosSize( aPos.X, aPos.Y, 0, 0, css::awt::PosSize::POS ); - xWindow2->setOutputSize( aSize ); - implts_writeNewStateData( aName, xWindow ); - } - else - { - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = LayoutManager::impl_findElement( aUIElement.m_aName ); - if ( rUIElement.m_aName == aName ) - rUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y ); - aWriteLock.unlock(); - - aUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y ); - implts_writeWindowStateData( aName, rUIElement ); - implts_sortUIElements(); + ReadGuard aReadLock( m_aLock ); + uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager( m_pToolbarManager ); + aReadLock.unlock(); - if ( aUIElement.m_bVisible ) - doLayout(); - } - } - } - catch ( DisposedException& ) - { - } + if ( pToolbarManager ) + { + pToolbarManager->setToolbarPosSize( aName, aPos, aSize ); + if ( pToolbarManager->isLayoutDirty() ) + doLayout(); } } } @@ -5214,84 +2121,66 @@ throw (RuntimeException) ::rtl::OUString aElementType; ::rtl::OUString aElementName; - if ( impl_parseResourceURL( aName, aElementType, aElementName )) + parseResourceURL( aName, aElementType, aElementName ); + if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) { - if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) + ReadGuard aReadLock( m_aLock ); + if ( m_xContainerWindow.is() ) { - ReadGuard aReadLock( m_aLock ); - if ( m_xContainerWindow.is() ) - { - aReadLock.unlock(); - - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); + aReadLock.unlock(); - if ( pWindow ) - { - MenuBar* pMenuBar = ((SystemWindow *)pWindow)->GetMenuBar(); - if ( pMenuBar && pMenuBar->IsDisplayable() ) - return sal_True; - } - else - { - aReadLock.lock(); - return m_bMenuVisible; - } + vos::OGuard aGuard( Application::GetSolarMutex() ); + SystemWindow* pSysWindow = getTopSystemWindow( m_xContainerWindow ); + if ( pSysWindow ) + { + MenuBar* pMenuBar = pSysWindow->GetMenuBar(); + if ( pMenuBar && pMenuBar->IsDisplayable() ) + return sal_True; } - } - else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || - ( m_aStatusBarElement.m_aName == aName )) - { - if ( m_aStatusBarElement.m_xUIElement.is() ) + else { - Reference< css::awt::XWindow > xWindow( - m_aStatusBarElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - if ( xWindow.is() ) - { - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->IsVisible() ) - return sal_True; - else - return sal_False; - } + aReadLock.lock(); + return m_bMenuVisible; } } - else if (( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ))) - { - if ( m_aProgressBarElement.m_xUIElement.is() ) - return m_aProgressBarElement.m_bVisible; - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) + } + else if (( aElementType.equalsIgnoreAsciiCaseAscii( "statusbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "statusbar" )) || ( m_aStatusBarElement.m_aName == aName )) + { + if ( m_aStatusBarElement.m_xUIElement.is() ) { - UIElementVector::const_iterator pIter; - - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + Reference< awt::XWindow > xWindow( m_aStatusBarElement.m_xUIElement->getRealInterface(), UNO_QUERY ); + if ( xWindow.is() ) { - if ( pIter->m_aName == aName && pIter->m_xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - if ( xWindow.is() ) - { - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - return pWindow && pWindow->IsVisible(); - } - } + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->IsVisible() ) + return sal_True; + else + return sal_False; } } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) - { - ReadGuard aReadGuard( m_aLock ); - css::uno::Reference< css::frame::XFrame > xFrame( m_xFrame ); - aReadGuard.unlock(); + } + else if (( aElementType.equalsIgnoreAsciiCaseAscii( "progressbar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "progressbar" ))) + { + if ( m_aProgressBarElement.m_xUIElement.is() ) + return m_aProgressBarElement.m_bVisible; + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) + { + ReadGuard aReadLock( m_aLock ); + uno::Reference< frame::XLayoutManager > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - return IsDockingWindowVisible( xFrame, aElementName ); - } + if ( pToolbarManager ) + return pToolbarManager->isToolbarVisible( aName ); + } + else if ( aElementType.equalsIgnoreAsciiCaseAscii( "dockingwindow" )) + { + ReadGuard aReadGuard( m_aLock ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + aReadGuard.unlock(); + + return IsDockingWindowVisible( xFrame, aElementName ); } return sal_False; @@ -5300,16 +2189,15 @@ throw (RuntimeException) sal_Bool SAL_CALL LayoutManager::isElementFloating( const ::rtl::OUString& aName ) throw (RuntimeException) { - UIElementVector::const_iterator pIter; - - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( pIter->m_aName == aName && pIter->m_xUIElement.is() ) - { - Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - return xDockWindow.is() && xDockWindow->isFloating(); - } + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) + return pToolbarManager->isToolbarFloating( aName ); } return sal_False; @@ -5318,93 +2206,69 @@ throw (RuntimeException) sal_Bool SAL_CALL LayoutManager::isElementDocked( const ::rtl::OUString& aName ) throw (RuntimeException) { - UIElementVector::const_iterator pIter; - - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if ( pIter->m_aName == aName && pIter->m_xUIElement.is() ) - { - Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - return xDockWindow.is() && !xDockWindow->isFloating(); - } + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) + return pToolbarManager->isToolbarDocked( aName ); } return sal_False; } -::sal_Bool SAL_CALL LayoutManager::isElementLocked( const ::rtl::OUString& ResourceURL ) -throw (::com::sun::star::uno::RuntimeException) +::sal_Bool SAL_CALL LayoutManager::isElementLocked( const ::rtl::OUString& aName ) +throw (uno::RuntimeException) { - UIElementVector::const_iterator pIter; - - ReadGuard aReadLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - if (( pIter->m_aName == ResourceURL ) && ( pIter->m_xUIElement.is() )) - { - Reference< css::awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), UNO_QUERY ); - return xDockWindow.is() && !xDockWindow->isLocked(); - } + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) + return pToolbarManager->isToolbarLocked( aName ); } return sal_False; } -css::awt::Size SAL_CALL LayoutManager::getElementSize( const ::rtl::OUString& aName ) +awt::Size SAL_CALL LayoutManager::getElementSize( const ::rtl::OUString& aName ) throw (RuntimeException) { - ReadGuard aReadLock( m_aLock ); - UIElement aElementData; - if ( implts_findElement( aName,aElementData ) && aElementData.m_xUIElement.is() ) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - Reference< css::awt::XWindow > xWindow( aElementData.m_xUIElement->getRealInterface(), UNO_QUERY ); - if ( xWindow.is() ) - { - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - { - ::Size aSize = pWindow->GetSizePixel(); - css::awt::Size aElementSize; - aElementSize.Width = aSize.Width(); - aElementSize.Height = aSize.Height(); - return aElementSize; - } // if ( pWindow ) - } + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); + + if ( pToolbarManager ) + return pToolbarManager->getToolbarSize( aName ); } - return css::awt::Size(); + + return awt::Size(); } -css::awt::Point SAL_CALL LayoutManager::getElementPos( const ::rtl::OUString& aName ) +awt::Point SAL_CALL LayoutManager::getElementPos( const ::rtl::OUString& aName ) throw (RuntimeException) { - ReadGuard aReadLock( m_aLock ); - UIElement aElementData; - if ( implts_findElement( aName,aElementData ) && aElementData.m_xUIElement.is() ) + if ( getElementTypeFromResourceURL( aName ).equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - Reference< css::awt::XWindow > xWindow( aElementData.m_xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xDockWindow.is() ) - { - css::awt::Point aPos; - if ( aElementData.m_bFloating ) - { - css::awt::Rectangle aRect = xWindow->getPosSize(); - aPos.X = aRect.X; - aPos.Y = aRect.Y; - } - else - { - ::Point aVirtualPos = aElementData.m_aDockedData.m_aPos; - aPos.X = aVirtualPos.X(); - aPos.Y = aVirtualPos.Y(); - } + ReadGuard aReadLock( m_aLock ); + uno::Reference< uno::XInterface > xToolbarManager( m_xToolbarManager, uno::UNO_QUERY ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - return aPos; - } + if ( pToolbarManager ) + return pToolbarManager->getToolbarPos( aName ); } - return css::awt::Point(); + return awt::Point(); } void SAL_CALL LayoutManager::lock() @@ -5426,7 +2290,7 @@ throw (RuntimeException) #endif Any a( nLockCount ); - implts_notifyListeners( css::frame::LayoutManagerEvents::LOCK, a ); + implts_notifyListeners( frame::LayoutManagerEvents::LOCK, a ); } void SAL_CALL LayoutManager::unlock() @@ -5449,15 +2313,15 @@ throw (RuntimeException) // conform to documentation: unlock with lock count == 0 means force a layout WriteGuard aWriteLock( m_aLock ); - if ( bDoLayout ) - m_aAsyncLayoutTimer.Stop(); - aWriteLock.unlock(); + if ( bDoLayout ) + m_aAsyncLayoutTimer.Stop(); + aWriteLock.unlock(); Any a( nLockCount ); - implts_notifyListeners( css::frame::LayoutManagerEvents::UNLOCK, a ); + implts_notifyListeners( frame::LayoutManagerEvents::UNLOCK, a ); if ( bDoLayout ) - implts_doLayout_notify( sal_True ); + implts_doLayout_notify( sal_True ); } void SAL_CALL LayoutManager::doLayout() @@ -5466,62 +2330,61 @@ throw (RuntimeException) implts_doLayout_notify( sal_True ); } +//--------------------------------------------------------------------------------------------------------- +// ILayoutNotifications +//--------------------------------------------------------------------------------------------------------- +void LayoutManager::requestLayout( Hint eHint ) +{ + if ( eHint == HINT_TOOLBARSPACE_HAS_CHANGED ) + doLayout(); +} + void LayoutManager::implts_doLayout_notify( sal_Bool bOuterResize ) { - sal_Bool bLayouted = implts_doLayout( sal_False, bOuterResize ); + bool bLayouted = implts_doLayout( false, bOuterResize ); if ( bLayouted ) - implts_notifyListeners( css::frame::LayoutManagerEvents::LAYOUT, Any() ); + implts_notifyListeners( frame::LayoutManagerEvents::LAYOUT, Any() ); } sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_Bool bOuterResize ) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::implts_doLayout" ); - sal_Bool bNoLock( sal_False ); - css::awt::Rectangle aCurrBorderSpace; - Reference< css::awt::XWindow > xContainerWindow; - Reference< css::awt::XTopWindow2 > xContainerTopWindow; - Reference< css::awt::XWindow > xComponentWindow; - Reference< XDockingAreaAcceptor > xDockingAreaAcceptor; - bool bPreserveContentSize( false ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); - sal_Bool bMustDoLayout( m_bMustDoLayout ); - if ( !m_bParentWindowVisible ) + if ( !m_xFrame.is() || !m_bParentWindowVisible ) return sal_False; - bNoLock = ( m_nLockCount == 0 ); - xContainerWindow = m_xContainerWindow; - xContainerTopWindow = m_xContainerTopWindow; - xComponentWindow = m_xFrame->getComponentWindow(); - xDockingAreaAcceptor = m_xDockingAreaAcceptor; - aCurrBorderSpace = m_aDockingArea; - bPreserveContentSize = m_bPreserveContentSize; + bool bPreserveContentSize( m_bPreserveContentSize ); + bool bMustDoLayout( m_bMustDoLayout ); + bool bNoLock = ( m_nLockCount == 0 ); + awt::Rectangle aCurrBorderSpace( m_aDockingArea ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< awt::XTopWindow2 > xContainerTopWindow( m_xContainerTopWindow ); + Reference< awt::XWindow > xComponentWindow( m_xFrame->getComponentWindow() ); + Reference< XDockingAreaAcceptor > xDockingAreaAcceptor( m_xDockingAreaAcceptor ); aReadLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ sal_Bool bLayouted( sal_False ); - if ( bNoLock && - xDockingAreaAcceptor.is() && - xContainerWindow.is() && - xComponentWindow.is() ) + if ( bNoLock && xDockingAreaAcceptor.is() && xContainerWindow.is() && xComponentWindow.is() ) { bLayouted = sal_True; - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteGuard( m_aLock ); m_bDoLayout = sal_True; aWriteGuard.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - css::awt::Rectangle aBorderSpace = implts_calcDockingAreaSizes(); - sal_Bool bGotRequestedBorderSpace( sal_True ); - sal_Bool bEqual = implts_compareRectangles( aBorderSpace, aCurrBorderSpace ); + awt::Rectangle aDockSpace( implts_calcDockingAreaSizes() ); + awt::Rectangle aBorderSpace( aDockSpace ); + sal_Bool bGotRequestedBorderSpace( sal_True ); + + // We have to add the height of a possible status bar + aBorderSpace.Height += implts_getStatusBarSize().Height(); - if ( !bEqual || bForceRequestBorderSpace || bMustDoLayout ) + if ( !equalRectangles( aBorderSpace, aCurrBorderSpace ) || bForceRequestBorderSpace || bMustDoLayout ) { // we always resize the content window (instead of the complete container window) if we're not set up // to (attempt to) preserve the content window's size @@ -5534,7 +2397,7 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_ // if the component window does not have a size (yet), then we can't use it to calc the container // window size - css::awt::Rectangle aComponentRect = xComponentWindow->getPosSize(); + awt::Rectangle aComponentRect = xComponentWindow->getPosSize(); if ( bOuterResize && ( aComponentRect.Width == 0 ) && ( aComponentRect.Height == 0 ) ) bOuterResize = sal_False; @@ -5553,52 +2416,34 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_ // if we did not do an container window resize, or it failed, then use the DockingAcceptor as usual if ( !bGotRequestedBorderSpace ) - { bGotRequestedBorderSpace = xDockingAreaAcceptor->requestDockingAreaSpace( aBorderSpace ); - if ( bGotRequestedBorderSpace ) - xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace ); - } if ( bGotRequestedBorderSpace ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ aWriteGuard.lock(); m_aDockingArea = aBorderSpace; m_bMustDoLayout = sal_False; aWriteGuard.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } } if ( bGotRequestedBorderSpace ) { - ::Size aContainerSize; - ::Size aStatusBarSize; + ::Size aContainerSize; + ::Size aStatusBarSize; - aStatusBarSize = implts_getStatusBarSize(); - aBorderSpace.Height -= aStatusBarSize.Height(); - implts_setDockingAreaWindowSizes( aBorderSpace ); + // Interim solution to let the layout method within the + // toolbar layout manager. + implts_setOffset( implts_getStatusBarSize().Height() ); + m_pToolbarManager->setDockingArea( aDockSpace ); // Subtract status bar size from our container output size. Docking area windows // don't contain the status bar! + aStatusBarSize = implts_getStatusBarSize(); aContainerSize = implts_getContainerWindowOutputSize(); aContainerSize.Height() -= aStatusBarSize.Height(); - // Retrieve row/column dependent data from all docked user-interface elements - for ( sal_Int32 i = 0; i < DOCKINGAREAS_COUNT; i++ ) - { - std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; - - implts_getDockingAreaElementInfos( (DockingArea)i, aRowColumnsWindowData ); - - sal_Int32 nOffset( 0 ); - const sal_uInt32 nCount = aRowColumnsWindowData.size(); - for ( sal_uInt32 j = 0; j < nCount; ++j ) - { - implts_calcWindowPosSizeOnSingleRowColumn( i, nOffset, aRowColumnsWindowData[j], aContainerSize ); - nOffset += aRowColumnsWindowData[j].nStaticSize; - } - } + m_pToolbarManager->doLayout(aContainerSize); // Position the status bar if ( aStatusBarSize.Height() > 0 ) @@ -5607,37 +2452,26 @@ sal_Bool LayoutManager::implts_doLayout( sal_Bool bForceRequestBorderSpace, sal_ ::Size( aContainerSize.Width(),aStatusBarSize.Height() )); } - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + xDockingAreaAcceptor->setDockingAreaSpace( aBorderSpace ); + aWriteGuard.lock(); m_bDoLayout = sal_False; aWriteGuard.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ } } return bLayouted; } -sal_Bool LayoutManager::implts_compareRectangles( const css::awt::Rectangle& rRect1, - const css::awt::Rectangle& rRect2 ) -{ - return (( rRect1.X == rRect2.X ) && - ( rRect1.Y == rRect2.Y ) && - ( rRect1.Width == rRect2.Width ) && - ( rRect1.Height == rRect2.Height )); -} - sal_Bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContainerSize, const awt::Point& rComponentPos ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); Reference< awt::XWindow > xContainerWindow = m_xContainerWindow; Reference< awt::XTopWindow2 > xContainerTopWindow = m_xContainerTopWindow; Reference< awt::XWindow > xComponentWindow = m_xFrame->getComponentWindow(); Reference< container::XIndexAccess > xDisplayAccess = m_xDisplayAccess; aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ // calculate the maximum size we have for the container window awt::Rectangle aWorkArea; @@ -5652,34 +2486,30 @@ sal_Bool LayoutManager::implts_resizeContainerWindow( const awt::Size& rContaine DBG_UNHANDLED_EXCEPTION(); } - if ( ( aWorkArea.Width > 0 ) && ( aWorkArea.Height > 0 ) ) + if (( aWorkArea.Width > 0 ) && ( aWorkArea.Height > 0 )) { - if ( ( rContainerSize.Width > aWorkArea.Width ) - || ( rContainerSize.Height > aWorkArea.Height ) - ) + if (( rContainerSize.Width > aWorkArea.Width ) || ( rContainerSize.Height > aWorkArea.Height )) return sal_False; // Strictly, this is not correct. If we have a multi-screen display (css.awt.DisplayAccess.MultiDisplay == true), // the the "effective work area" would be much larger than the work area of a single display, since we could in theory // position the container window across multiple screens. - // However, this should suffice as a heuristics here ... (nobody really wants to check whethere the different screens are + // However, this should suffice as a heuristics here ... (nobody really wants to check whether the different screens are // stacked horizontally or vertically, whether their work areas can really be combined, or are separated by non-work-areas, // and the like ... right?) } // resize our container window - xContainerWindow->setPosSize( 0, 0, rContainerSize.Width, rContainerSize.Height, css::awt::PosSize::SIZE ); + xContainerWindow->setPosSize( 0, 0, rContainerSize.Width, rContainerSize.Height, awt::PosSize::SIZE ); // position the component window - xComponentWindow->setPosSize( rComponentPos.X, rComponentPos.Y, 0, 0, css::awt::PosSize::POS ); + xComponentWindow->setPosSize( rComponentPos.X, rComponentPos.Y, 0, 0, awt::PosSize::POS ); return sal_True; } void SAL_CALL LayoutManager::setVisible( sal_Bool bVisible ) -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { - sal_Bool bWasVisible( sal_True ); - WriteGuard aWriteLock( m_aLock ); - bWasVisible = m_bVisible; + sal_Bool bWasVisible( m_bVisible ); m_bVisible = bVisible; aWriteLock.unlock(); @@ -5688,226 +2518,24 @@ throw (::com::sun::star::uno::RuntimeException) } sal_Bool SAL_CALL LayoutManager::isVisible() -throw (::com::sun::star::uno::RuntimeException) +throw (uno::RuntimeException) { ReadGuard aReadLock( m_aLock ); return m_bVisible; } -void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockingArea, - sal_Int32 nOffset, - SingleRowColumnWindowData& rRowColumnWindowData, - const ::Size& rContainerSize ) -{ - sal_Int32 nDiff( 0 ); - sal_Int32 nRCSpace( rRowColumnWindowData.nSpace ); - sal_Int32 nTopDockingAreaSize; - sal_Int32 nBottomDockingAreaSize; - sal_Int32 nContainerClientSize; - - if ( rRowColumnWindowData.aRowColumnWindows.empty() ) - return; - - if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - nContainerClientSize = rContainerSize.Width(); - nDiff = nContainerClientSize - rRowColumnWindowData.nVarSize; - } - else - { - nTopDockingAreaSize = implts_getTopBottomDockingAreaSizes().Width(); - nBottomDockingAreaSize = implts_getTopBottomDockingAreaSizes().Height(); - nContainerClientSize = ( rContainerSize.Height() - nTopDockingAreaSize - nBottomDockingAreaSize ); - nDiff = nContainerClientSize - rRowColumnWindowData.nVarSize; - } - - const sal_uInt32 nCount = rRowColumnWindowData.aRowColumnWindowSizes.size(); - if (( nDiff < 0 ) && ( nRCSpace > 0 )) - { - // First we try to reduce the size of blank space before/behind docked windows - sal_Int32 i = nCount - 1; - while ( i >= 0 ) - { - sal_Int32 nSpace = rRowColumnWindowData.aRowColumnSpace[i]; - if ( nSpace >= -nDiff ) - { - - if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - // Try to move this and all user elements behind with the calculated difference - for ( sal_uInt32 j = i; j < nCount ; j++ ) - rRowColumnWindowData.aRowColumnWindowSizes[j].X += nDiff; - } - else - { - // Try to move this and all user elements behind with the calculated difference - for ( sal_uInt32 j = i; j < nCount ; j++ ) - rRowColumnWindowData.aRowColumnWindowSizes[j].Y += nDiff; - } - nDiff = 0; - - break; - } - else if ( nSpace > 0 ) - { - if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - // Try to move this and all user elements behind with the calculated difference - for ( sal_uInt32 j = i; j < nCount; j++ ) - rRowColumnWindowData.aRowColumnWindowSizes[j].X -= nSpace; - } - else - { - // Try to move this and all user elements behind with the calculated difference - for ( sal_uInt32 j = i; j < nCount; j++ ) - rRowColumnWindowData.aRowColumnWindowSizes[j].Y -= nSpace; - } - nDiff += nSpace; - } - --i; - } - } - - // Check if we have to reduce further - if ( nDiff < 0 ) - { - // Now we have to reduce the size of certain docked windows - sal_Int32 i = sal_Int32( nCount - 1 ); - while ( i >= 0 ) - { - css::awt::Rectangle& rWinRect = rRowColumnWindowData.aRowColumnWindowSizes[i]; - ::Size aMinSize; - - vos::OGuard aGuard( Application::GetSolarMutex() ); - { - Reference< css::awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i]; - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - aMinSize = ((ToolBox *)pWindow)->CalcMinimumWindowSizePixel(); - } - - if (( aMinSize.Width() > 0 ) && ( aMinSize.Height() > 0 )) - { - if (( nDockingArea == DockingArea_DOCKINGAREA_TOP ) || - ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - sal_Int32 nMaxReducation = ( rWinRect.Width - aMinSize.Width() ); - if ( nMaxReducation >= -nDiff ) - { - rWinRect.Width = rWinRect.Width + nDiff; - nDiff = 0; - } - else - { - rWinRect.Width = aMinSize.Width(); - nDiff += nMaxReducation; - } - - // Try to move this and all user elements behind with the calculated difference - for ( sal_uInt32 j = i; j < nCount; j++ ) - rRowColumnWindowData.aRowColumnWindowSizes[j].X += nDiff; - } - else - { - sal_Int32 nMaxReducation = ( rWinRect.Height - aMinSize.Height() ); - if ( nMaxReducation >= -nDiff ) - { - rWinRect.Height = rWinRect.Height + nDiff; - nDiff = 0; - } - else - { - rWinRect.Height = aMinSize.Height(); - nDiff += nMaxReducation; - } - - // Try to move this and all user elements behind with the calculated difference - for ( sal_uInt32 j = i; j < nCount; j++ ) - rRowColumnWindowData.aRowColumnWindowSizes[j].Y += nDiff; - } - } - - if ( nDiff >= 0 ) - break; - - --i; - } - } - - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - ReadGuard aReadLock( m_aLock ); - Window* pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] ); - aReadLock.unlock(); - - sal_Int32 nCurrPos( 0 ); - sal_Int32 nStartOffset( 0 ); - - if ( nDockingArea == DockingArea_DOCKINGAREA_RIGHT ) - nStartOffset = pDockAreaWindow->GetSizePixel().Width() - rRowColumnWindowData.nStaticSize; - else if ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM ) - nStartOffset = pDockAreaWindow->GetSizePixel().Height() - rRowColumnWindowData.nStaticSize; - - vos::OGuard aGuard( Application::GetSolarMutex() ); - for ( sal_uInt32 i = 0; i < nCount; i++ ) - { - Reference< css::awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i]; - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - Window* pOldParentWindow = pWindow->GetParent(); - - if ( pDockAreaWindow != pOldParentWindow ) - pWindow->SetParent( pDockAreaWindow ); - - css::awt::Rectangle aWinRect = rRowColumnWindowData.aRowColumnWindowSizes[i]; - if ( nDockingArea == DockingArea_DOCKINGAREA_TOP ) - { - if ( aWinRect.X < nCurrPos ) - aWinRect.X = nCurrPos; - pWindow->SetPosSizePixel( ::Point( aWinRect.X, nOffset ), - ::Size( aWinRect.Width, rRowColumnWindowData.nStaticSize )); - nCurrPos += ( aWinRect.X - nCurrPos ) + aWinRect.Width; - } - else if ( nDockingArea == DockingArea_DOCKINGAREA_BOTTOM ) - { - if ( aWinRect.X < nCurrPos ) - aWinRect.X = nCurrPos; - pWindow->SetPosSizePixel( ::Point( aWinRect.X, nStartOffset - nOffset ), - ::Size( aWinRect.Width, rRowColumnWindowData.nStaticSize )); - nCurrPos += ( aWinRect.X - nCurrPos ) + aWinRect.Width; - } - else if ( nDockingArea == DockingArea_DOCKINGAREA_LEFT ) - { - if ( aWinRect.Y < nCurrPos ) - aWinRect.Y = nCurrPos; - pWindow->SetPosSizePixel( ::Point( nOffset, aWinRect.Y ), - ::Size( rRowColumnWindowData.nStaticSize, aWinRect.Height )); - nCurrPos += ( aWinRect.Y - nCurrPos ) + aWinRect.Height; - } - else if ( nDockingArea == DockingArea_DOCKINGAREA_RIGHT ) - { - if ( aWinRect.Y < nCurrPos ) - aWinRect.Y = nCurrPos; - pWindow->SetPosSizePixel( ::Point( nStartOffset - nOffset, aWinRect.Y ), - ::Size( rRowColumnWindowData.nStaticSize, aWinRect.Height )); - nCurrPos += ( aWinRect.Y - nCurrPos ) + aWinRect.Height; - } - } -} - ::Size LayoutManager::implts_getStatusBarSize() { ReadGuard aReadLock( m_aLock ); - sal_Bool bStatusBarVisible( isElementVisible( m_aStatusBarAlias )); - sal_Bool bProgressBarVisible( isElementVisible( m_aProgressBarAlias )); - sal_Bool bVisible = m_bVisible; - Reference< XUIElement > xStatusBar = m_aStatusBarElement.m_xUIElement; - Reference< XUIElement > xProgressBar = m_aProgressBarElement.m_xUIElement; + bool bStatusBarVisible( isElementVisible( m_aStatusBarAlias )); + bool bProgressBarVisible( isElementVisible( m_aProgressBarAlias )); + bool bVisible( m_bVisible ); + Reference< XUIElement > xStatusBar( m_aStatusBarElement.m_xUIElement ); + Reference< XUIElement > xProgressBar( m_aProgressBarElement.m_xUIElement ); - Reference< css::awt::XWindow > xWindow; + Reference< awt::XWindow > xWindow; if ( bStatusBarVisible && bVisible && xStatusBar.is() ) - xWindow = Reference< css::awt::XWindow >( xStatusBar->getRealInterface(), UNO_QUERY ); + xWindow = Reference< awt::XWindow >( xStatusBar->getRealInterface(), UNO_QUERY ); else if ( xProgressBar.is() && !xStatusBar.is() && bProgressBarVisible ) { ProgressBarWrapper* pWrapper = (ProgressBarWrapper*)xProgressBar.get(); @@ -5918,194 +2546,40 @@ void LayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockin if ( xWindow.is() ) { - css::awt::Rectangle aPosSize = xWindow->getPosSize(); + awt::Rectangle aPosSize = xWindow->getPosSize(); return ::Size( aPosSize.Width, aPosSize.Height ); } else return ::Size(); } -css::awt::Rectangle LayoutManager::implts_calcDockingAreaSizes() +awt::Rectangle LayoutManager::implts_calcDockingAreaSizes() { - Reference< css::awt::XWindow > xContainerWindow; - Reference< XDockingAreaAcceptor > xDockingAreaAcceptor; - ReadGuard aReadLock( m_aLock ); - xContainerWindow = m_xContainerWindow; - xDockingAreaAcceptor = m_xDockingAreaAcceptor; - UIElementVector aWindowVector( m_aUIElements ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< XDockingAreaAcceptor > xDockingAreaAcceptor( m_xDockingAreaAcceptor ); aReadLock.unlock(); - css::awt::Rectangle aBorderSpace; + awt::Rectangle aBorderSpace; if ( xDockingAreaAcceptor.is() && xContainerWindow.is() ) - { - sal_Int32 nCurrRowColumn( 0 ); - sal_Int32 nCurrPos( 0 ); - sal_Int32 nCurrDockingArea( DockingArea_DOCKINGAREA_TOP ); - std::vector< sal_Int32 > aRowColumnSizes[DOCKINGAREAS_COUNT]; - UIElementVector::const_iterator pConstIter; - - aRowColumnSizes[nCurrDockingArea].clear(); - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); - - for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); pConstIter++ ) - { - Reference< XUIElement > xUIElement( pConstIter->m_xUIElement, UNO_QUERY ); - if ( xUIElement.is() ) - { - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xWindow.is() && xDockWindow.is() ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->IsVisible() && !xDockWindow->isFloating() ) - { - css::awt::Rectangle aPosSize = xWindow->getPosSize(); - if ( pConstIter->m_aDockedData.m_nDockedArea != nCurrDockingArea ) - { - nCurrDockingArea = pConstIter->m_aDockedData.m_nDockedArea; - nCurrRowColumn = 0; - nCurrPos = 0; - aRowColumnSizes[nCurrDockingArea].clear(); - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); - } - - if ( pConstIter->m_aDockedData.m_nDockedArea == nCurrDockingArea ) - { - if (( pConstIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_TOP ) || - ( pConstIter->m_aDockedData.m_nDockedArea == DockingArea_DOCKINGAREA_BOTTOM )) - { - if ( pConstIter->m_aDockedData.m_aPos.Y() > nCurrPos ) - { - ++nCurrRowColumn; - nCurrPos = pConstIter->m_aDockedData.m_aPos.Y(); - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); - } - - if ( aPosSize.Height > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] ) - aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Height; - } - else - { - if ( pConstIter->m_aDockedData.m_aPos.X() > nCurrPos ) - { - ++nCurrRowColumn; - nCurrPos = pConstIter->m_aDockedData.m_aPos.X(); - aRowColumnSizes[nCurrDockingArea].push_back( 0 ); - } - - if ( aPosSize.Width > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] ) - aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Width; - } - } - } - } - } - } - - // Sum up max heights from every row/column - if ( !aWindowVector.empty() ) - { - for ( sal_Int32 i = 0; i <= DockingArea_DOCKINGAREA_RIGHT; i++ ) - { - sal_Int32 nSize( 0 ); - const sal_uInt32 nCount = aRowColumnSizes[i].size(); - for ( sal_uInt32 j = 0; j < nCount; j++ ) - nSize += aRowColumnSizes[i][j]; - - if ( i == DockingArea_DOCKINGAREA_TOP ) - aBorderSpace.Y = nSize; - else if ( i == DockingArea_DOCKINGAREA_BOTTOM ) - aBorderSpace.Height = nSize; - else if ( i == DockingArea_DOCKINGAREA_LEFT ) - aBorderSpace.X = nSize; - else - aBorderSpace.Width = nSize; - } - } - - // We have to add the height of a possible status bar - aBorderSpace.Height += implts_getStatusBarSize().Height(); - } + aBorderSpace = m_pToolbarManager->getDockingArea(); return aBorderSpace; } -void LayoutManager::implts_setDockingAreaWindowSizes( const css::awt::Rectangle& rBorderSpace ) +void LayoutManager::implts_setDockingAreaWindowSizes( const awt::Rectangle& /*rBorderSpace*/ ) { - Reference< css::awt::XWindow > xContainerWindow; - ReadGuard aReadLock( m_aLock ); - xContainerWindow = m_xContainerWindow; + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); aReadLock.unlock(); - css::uno::Reference< css::awt::XDevice > xDevice( xContainerWindow, css::uno::UNO_QUERY ); + uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY ); // Convert relativ size to output size. - css::awt::Rectangle aRectangle = xContainerWindow->getPosSize(); - css::awt::DeviceInfo aInfo = xDevice->getInfo(); - css::awt::Size aContainerClientSize = css::awt::Size( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset , - aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); - ::Size aStatusBarSize = implts_getStatusBarSize(); - - sal_Int32 nLeftRightDockingAreaHeight( aContainerClientSize.Height ); - if ( rBorderSpace.Y >= 0 ) - { - // Top docking area window - aReadLock.lock(); - Reference< css::awt::XWindow > xDockAreaWindow( m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP] ); - aReadLock.unlock(); - - xDockAreaWindow->setPosSize( 0, 0, aContainerClientSize.Width, rBorderSpace.Y, css::awt::PosSize::POSSIZE ); - xDockAreaWindow->setVisible( sal_True ); - nLeftRightDockingAreaHeight -= rBorderSpace.Y; - } - - if ( rBorderSpace.Height >= 0 ) - { - // Bottom docking area window - sal_Int32 nBottomPos = std::max( sal_Int32( aContainerClientSize.Height - rBorderSpace.Height - aStatusBarSize.Height() ), sal_Int32( 0 )); - sal_Int32 nHeight = ( nBottomPos == 0 ) ? 0 : rBorderSpace.Height; - - aReadLock.lock(); - Reference< css::awt::XWindow > xDockAreaWindow( m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM] ); - aReadLock.unlock(); - - xDockAreaWindow->setPosSize( 0, nBottomPos, aContainerClientSize.Width, nHeight, css::awt::PosSize::POSSIZE ); - xDockAreaWindow->setVisible( sal_True ); - nLeftRightDockingAreaHeight -= nHeight; - } - - nLeftRightDockingAreaHeight -= aStatusBarSize.Height(); - if ( rBorderSpace.X >= 0 || nLeftRightDockingAreaHeight > 0 ) - { - // Left docking area window - aReadLock.lock(); - Reference< css::awt::XWindow > xDockAreaWindow( m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT] ); - aReadLock.unlock(); - - // We also have to change our right docking area window if the top or bottom area has changed. They have a higher priority! - sal_Int32 nHeight = std::max( sal_Int32( 0 ), sal_Int32( nLeftRightDockingAreaHeight )); - - xDockAreaWindow->setPosSize( 0, rBorderSpace.Y, rBorderSpace.X, nHeight, css::awt::PosSize::POSSIZE ); - xDockAreaWindow->setVisible( sal_True ); - } - if ( rBorderSpace.Width >= 0 || nLeftRightDockingAreaHeight > 0 ) - { - // Right docking area window - aReadLock.lock(); - Reference< css::awt::XWindow > xDockAreaWindow( m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT] ); - aReadLock.unlock(); - - // We also have to change our right docking area window if the top or bottom area has changed. They have a higher priority! - sal_Int32 nLeftPos = std::max( sal_Int32( 0 ), sal_Int32( aContainerClientSize.Width - rBorderSpace.Width )); - sal_Int32 nHeight = std::max( sal_Int32( 0 ), sal_Int32( nLeftRightDockingAreaHeight )); - sal_Int32 nWidth = ( nLeftPos == 0 ) ? 0 : rBorderSpace.Width; - - xDockAreaWindow->setPosSize( nLeftPos, rBorderSpace.Y, nWidth, nHeight, css::awt::PosSize::POSSIZE ); - xDockAreaWindow->setVisible( sal_True ); - } + awt::Rectangle aRectangle = xContainerWindow->getPosSize(); + awt::DeviceInfo aInfo = xDevice->getInfo(); + awt::Size aContainerClientSize = awt::Size( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset, + aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); + ::Size aStatusBarSize = implts_getStatusBarSize(); // Position the status bar if ( aStatusBarSize.Height() > 0 ) @@ -6116,41 +2590,28 @@ void LayoutManager::implts_setDockingAreaWindowSizes( const css::awt::Rectangle& } //--------------------------------------------------------------------------------------------------------- -// XMenuCloser +// XMenuCloser //--------------------------------------------------------------------------------------------------------- void LayoutManager::implts_updateMenuBarClose() { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); - sal_Bool bShowCloser = m_bMenuBarCloser; - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); + bool bShowCloser( m_bMenuBarCloser ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); aWriteLock.unlock(); if ( xContainerWindow.is() ) { - vos::OGuard aGuard( Application::GetSolarMutex() ); - - Window* pWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); + vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( pWindow ) + SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow ); + if ( pSysWindow ) { - SystemWindow* pSysWindow = (SystemWindow *)pWindow; MenuBar* pMenuBar = pSysWindow->GetMenuBar(); if ( pMenuBar ) { // TODO remove link on FALSE ?! - if ( bShowCloser ) - { - pMenuBar->ShowCloser( TRUE ); - pMenuBar->SetCloserHdl( LINK( this, LayoutManager, MenuBarClose )); - } - else - { - pMenuBar->ShowCloser( FALSE ); - pMenuBar->SetCloserHdl( LINK( this, LayoutManager, MenuBarClose )); - } + pMenuBar->ShowCloser( bShowCloser ); + pMenuBar->SetCloserHdl( LINK( this, LayoutManager, MenuBarClose )); } } } @@ -6161,14 +2622,14 @@ sal_Bool LayoutManager::implts_resetMenuBar() /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); sal_Bool bMenuVisible( m_bMenuVisible ); - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); MenuBar* pSetMenuBar = 0; if ( m_xInplaceMenuBar.is() ) pSetMenuBar = (MenuBar *)m_pInplaceMenuBar->GetMenuBar(); else { - MenuBarWrapper* pMenuBarWrapper = SAL_STATIC_CAST( MenuBarWrapper*, m_xMenuBar.get() ); + MenuBarWrapper* pMenuBarWrapper = static_cast< MenuBarWrapper* >( m_xMenuBar.get() ); if ( pMenuBarWrapper ) pSetMenuBar = (MenuBar *)pMenuBarWrapper->GetMenuBarManager()->GetMenuBar(); } @@ -6176,13 +2637,10 @@ sal_Bool LayoutManager::implts_resetMenuBar() /* SAFE AREA ----------------------------------------------------------------------------------------------- */ vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); - - if ( pWindow && bMenuVisible && pSetMenuBar ) + SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow ); + if ( pSysWindow && bMenuVisible && pSetMenuBar ) { - ((SystemWindow *)pWindow)->SetMenuBar( pSetMenuBar ); + pSysWindow->SetMenuBar( pSetMenuBar ); pSetMenuBar->SetDisplayable( sal_True ); return sal_True; } @@ -6190,726 +2648,62 @@ sal_Bool LayoutManager::implts_resetMenuBar() return sal_False; } -sal_Int16 LayoutManager::implts_getCurrentSymbolsSize() -{ - sal_Int16 eOptSymbolsSize( 0 ); - - { - ReadGuard aReadLock( m_aLock ); - vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( m_pMiscOptions ) - eOptSymbolsSize = m_pMiscOptions->GetCurrentSymbolsSize(); - } - - return eOptSymbolsSize; -} - -sal_Int16 LayoutManager::implts_getCurrentSymbolsStyle() +void LayoutManager::implts_setMenuBarCloser(sal_Bool bCloserState) { - sal_Int16 eOptSymbolsStyle( 0 ); - - { - ReadGuard aReadLock( m_aLock ); - vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( m_pMiscOptions ) - eOptSymbolsStyle = m_pMiscOptions->GetCurrentSymbolsStyle(); - } + WriteGuard aWriteLock( m_aLock ); + m_bMenuBarCloser = bCloserState; + aWriteLock.unlock(); - return eOptSymbolsStyle; + implts_updateMenuBarClose(); } IMPL_LINK( LayoutManager, MenuBarClose, MenuBar *, EMPTYARG ) { ReadGuard aReadLock( m_aLock ); - css::uno::Reference< css::frame::XDispatchProvider > xProvider(m_xFrame, css::uno::UNO_QUERY); - css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = m_xSMGR; + uno::Reference< frame::XDispatchProvider > xProvider(m_xFrame, uno::UNO_QUERY); + uno::Reference< lang::XMultiServiceFactory > xSMGR = m_xSMGR; aReadLock.unlock(); - if (! xProvider.is()) + if ( !xProvider.is()) return 0; - css::uno::Reference< css::frame::XDispatchHelper > xDispatcher( - xSMGR->createInstance(SERVICENAME_DISPATCHHELPER), css::uno::UNO_QUERY_THROW); + uno::Reference< frame::XDispatchHelper > xDispatcher( + xSMGR->createInstance(SERVICENAME_DISPATCHHELPER), uno::UNO_QUERY_THROW); xDispatcher->executeDispatch( xProvider, ::rtl::OUString::createFromAscii(".uno:CloseWin"), ::rtl::OUString::createFromAscii("_self"), 0, - css::uno::Sequence< css::beans::PropertyValue >()); + uno::Sequence< beans::PropertyValue >()); return 0; } -IMPL_LINK( LayoutManager, OptionsChanged, void*, EMPTYARG ) -{ - sal_Int16 eSymbolsSize( implts_getCurrentSymbolsSize() ); - sal_Int16 eSymbolsStyle( implts_getCurrentSymbolsStyle() ); - - ReadGuard aReadLock( m_aLock ); - sal_Int16 eOldSymbolsSize = m_eSymbolsSize; - sal_Int16 eOldSymbolsStyle = m_eSymbolsStyle; - aReadLock.unlock(); - - if ( eSymbolsSize != eOldSymbolsSize || eSymbolsStyle != eOldSymbolsStyle ) - { - WriteGuard aWriteLock( m_aLock ); - m_eSymbolsSize = eSymbolsSize; - m_eSymbolsStyle = eSymbolsStyle; - aWriteLock.unlock(); - - std::vector< Reference< XUpdatable > > aToolBarVector; - - aReadLock.lock(); - { - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - if ( pIter->m_xUIElement.is() ) - aToolBarVector.push_back( Reference< XUpdatable >( pIter->m_xUIElement, UNO_QUERY )); - } - } - aReadLock.unlock(); - - lock(); - { - std::vector< Reference< XUpdatable > >::iterator pIter; - for ( pIter = aToolBarVector.begin(); pIter != aToolBarVector.end(); pIter++ ) - { - if ( (*pIter).is() ) - (*pIter)->update(); - } - } - unlock(); - doLayout(); - } - - return 1; -} - IMPL_LINK( LayoutManager, SettingsChanged, void*, EMPTYARG ) { return 1; } //--------------------------------------------------------------------------------------------------------- -// XDockableWindowListener -//--------------------------------------------------------------------------------------------------------- -void SAL_CALL LayoutManager::startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException) -{ - sal_Bool bWinFound( sal_False ); - UIElement aUIElement; - - ReadGuard aReadGuard( m_aLock ); - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); - Reference< css::awt::XWindow2 > xWindow( e.Source, UNO_QUERY ); - aReadGuard.unlock(); - - Window* pContainerWindow( 0 ); - Window* pWindow( 0 ); - ::Point aMousePos; - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); - aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y )); - } - - bWinFound = implts_findElement( e.Source, aUIElement ); - - if ( bWinFound && xWindow.is() ) - { - css::awt::Rectangle aRect; - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xDockWindow->isFloating() ) - { - css::awt::Rectangle aPos = xWindow->getPosSize(); - css::awt::Size aSize = xWindow->getOutputSize(); - - aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); - aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); - - vos::OGuard aGuard( Application::GetSolarMutex() ); - pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - { - ToolBox* pToolBox = (ToolBox *)pWindow; - aUIElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); - aUIElement.m_aFloatingData.m_bIsHorizontal = (( pToolBox->GetAlign() == WINDOWALIGN_TOP ) || - ( pToolBox->GetAlign() == WINDOWALIGN_BOTTOM )); - } - } - } - - WriteGuard aWriteLock( m_aLock ); - m_bDockingInProgress = bWinFound; - m_aDockUIElement = aUIElement; - m_aDockUIElement.m_bUserActive = sal_True; - m_aStartDockMousePos = aMousePos; - aWriteLock.unlock(); -} - -::Rectangle LayoutManager::implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset ) -{ - ::Rectangle aRect( rRect ); - - aRect.Left() -= nHotZoneOffset; - aRect.Top() -= nHotZoneOffset; - aRect.Right() += nHotZoneOffset; - aRect.Bottom() += nHotZoneOffset; - return aRect; -} - -css::awt::DockingData SAL_CALL LayoutManager::docking( const ::com::sun::star::awt::DockingEvent& e ) -throw (::com::sun::star::uno::RuntimeException) -{ - const sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25; - const sal_Int32 MAGNETIC_DISTANCE_DOCK = 20; - - css::awt::DockingData aDockingData; - Reference< css::awt::XDockableWindow > xDockWindow( e.Source, UNO_QUERY ); - Reference< css::awt::XWindow > xWindow( e.Source, UNO_QUERY ); - Reference< css::awt::XWindow > xTopDockingWindow; - Reference< css::awt::XWindow > xLeftDockingWindow; - Reference< css::awt::XWindow > xRightDockingWindow; - Reference< css::awt::XWindow > xBottomDockingWindow; - Reference< css::awt::XWindow > xContainerWindow; - UIElement aUIDockingElement; - DockingOperation eDockingOperation( DOCKOP_ON_COLROW ); - ::Size aStatusBarSize; - - aDockingData.TrackingRectangle = e.TrackingRectangle; - sal_Bool bDockingInProgress; - - { - ReadGuard aReadLock( m_aLock ); - bDockingInProgress = m_bDockingInProgress; - if ( bDockingInProgress ) - { - xContainerWindow = m_xContainerWindow; - xTopDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_TOP]; - xLeftDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_LEFT]; - xRightDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_RIGHT]; - xBottomDockingWindow = m_xDockAreaWindows[DockingArea_DOCKINGAREA_BOTTOM]; - aUIDockingElement = m_aDockUIElement; - aStatusBarSize = implts_getStatusBarSize(); - } - } - - if ( bDockingInProgress && - xDockWindow.is() && - xWindow.is() ) - { - try - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - - sal_Int16 eDockingArea( -1 ); // none - sal_Int32 nMagneticZone( aUIDockingElement.m_bFloating ? MAGNETIC_DISTANCE_DOCK : MAGNETIC_DISTANCE_UNDOCK ); - css::awt::Rectangle aNewTrackingRect; - ::Rectangle aTrackingRect( e.TrackingRectangle.X, - e.TrackingRectangle.Y, - ( e.TrackingRectangle.X + e.TrackingRectangle.Width ), - ( e.TrackingRectangle.Y + e.TrackingRectangle.Height )); - - css::awt::Rectangle aTmpRect = xTopDockingWindow->getPosSize(); - ::Rectangle aTopDockRect( aTmpRect.X, aTmpRect.Y, aTmpRect.Width, aTmpRect.Height ); - ::Rectangle aHotZoneTopDockRect( implts_calcHotZoneRect( aTopDockRect, nMagneticZone )); - - aTmpRect = xBottomDockingWindow->getPosSize(); - ::Rectangle aBottomDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width), ( aTmpRect.Y + aTmpRect.Height )); - ::Rectangle aHotZoneBottomDockRect( implts_calcHotZoneRect( aBottomDockRect, nMagneticZone )); - - aTmpRect = xLeftDockingWindow->getPosSize(); - ::Rectangle aLeftDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height )); - ::Rectangle aHotZoneLeftDockRect( implts_calcHotZoneRect( aLeftDockRect, nMagneticZone )); - - aTmpRect = xRightDockingWindow->getPosSize(); - ::Rectangle aRightDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height )); - ::Rectangle aHotZoneRightDockRect( implts_calcHotZoneRect( aRightDockRect, nMagneticZone )); - - Window* pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow ) ); - Window* pDockingAreaWindow( 0 ); - ::Point aMousePos( pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ))); - - if ( aHotZoneTopDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_TOP; - else if ( aHotZoneBottomDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_BOTTOM; - else if ( aHotZoneLeftDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_LEFT; - else if ( aHotZoneRightDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_RIGHT; - - // Higher priority for movements inside the real docking area - if ( aTopDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_TOP; - else if ( aBottomDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_BOTTOM; - else if ( aLeftDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_LEFT; - else if ( aRightDockRect.IsInside( aMousePos )) - eDockingArea = DockingArea_DOCKINGAREA_RIGHT; - - // Determine if we have a toolbar and set alignment according to the docking area! - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - ToolBox* pToolBox = 0; - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = (ToolBox *)pWindow; - - if ( eDockingArea != -1 ) - { - if ( eDockingArea == DockingArea_DOCKINGAREA_TOP ) - { - aUIDockingElement.m_aDockedData.m_nDockedArea = DockingArea_DOCKINGAREA_TOP; - aUIDockingElement.m_bFloating = sal_False; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xTopDockingWindow ); - } - else if ( eDockingArea == DockingArea_DOCKINGAREA_BOTTOM ) - { - aUIDockingElement.m_aDockedData.m_nDockedArea = DockingArea_DOCKINGAREA_BOTTOM; - aUIDockingElement.m_bFloating = sal_False; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xBottomDockingWindow ); - } - else if ( eDockingArea == DockingArea_DOCKINGAREA_LEFT ) - { - aUIDockingElement.m_aDockedData.m_nDockedArea = DockingArea_DOCKINGAREA_LEFT; - aUIDockingElement.m_bFloating = sal_False; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xLeftDockingWindow ); - } - else if ( eDockingArea == DockingArea_DOCKINGAREA_RIGHT ) - { - aUIDockingElement.m_aDockedData.m_nDockedArea = DockingArea_DOCKINGAREA_RIGHT; - aUIDockingElement.m_bFloating = sal_False; - pDockingAreaWindow = VCLUnoHelper::GetWindow( xRightDockingWindow ); - } - - ::Point aOutputPos = pContainerWindow->ScreenToOutputPixel( aTrackingRect.TopLeft() ); - aTrackingRect.SetPos( aOutputPos ); - - ::Rectangle aNewDockingRect( aTrackingRect ); - implts_calcDockingPosSize( aUIDockingElement, eDockingOperation, aNewDockingRect, aMousePos ); - - ::Point aScreenPos = pContainerWindow->OutputToScreenPixel( aNewDockingRect.TopLeft() ); - aNewTrackingRect = css::awt::Rectangle( aScreenPos.X(), - aScreenPos.Y(), - aNewDockingRect.getWidth(), - aNewDockingRect.getHeight() ); - aDockingData.TrackingRectangle = aNewTrackingRect; - } - else if ( pToolBox && bDockingInProgress ) - { - sal_Bool bIsHorizontal = (( pToolBox->GetAlign() == WINDOWALIGN_TOP ) || - ( pToolBox->GetAlign() == WINDOWALIGN_BOTTOM )); - ::Size aFloatSize = aUIDockingElement.m_aFloatingData.m_aSize; - if ( aFloatSize.Width() > 0 && aFloatSize.Height() > 0 ) - { - aUIDockingElement.m_aFloatingData.m_aPos = pContainerWindow->ScreenToOutputPixel( - ::Point( e.MousePos.X, e.MousePos.Y )); - aDockingData.TrackingRectangle.Height = aFloatSize.Height(); - aDockingData.TrackingRectangle.Width = aFloatSize.Width(); - } - else - { - aFloatSize = pToolBox->CalcWindowSizePixel(); - if ( !bIsHorizontal ) - { - // Floating toolbars are always horizontal aligned! We have to swap - // width/height if we have a vertical aligned toolbar. - sal_Int32 nTemp = aFloatSize.Height(); - aFloatSize.Height() = aFloatSize.Width(); - aFloatSize.Width() = nTemp; - } - - aDockingData.TrackingRectangle.Height = aFloatSize.Height(); - aDockingData.TrackingRectangle.Width = aFloatSize.Width(); - - // For the first time we don't have any data about the floating size of a toolbar. - // We calculate it and store it for later use. - aUIDockingElement.m_aFloatingData.m_aPos = pContainerWindow->ScreenToOutputPixel( - ::Point( e.MousePos.X, e.MousePos.Y )); - aUIDockingElement.m_aFloatingData.m_aSize = aFloatSize; - aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); - aUIDockingElement.m_aFloatingData.m_bIsHorizontal = (( pToolBox->GetAlign() == WINDOWALIGN_TOP ) || - ( pToolBox->GetAlign() == WINDOWALIGN_BOTTOM )); - } - aDockingData.TrackingRectangle.X = e.MousePos.X; - aDockingData.TrackingRectangle.Y = e.MousePos.Y; - } - - aDockingData.bFloating = ( eDockingArea == -1 ); - - // Write current data to the member docking progress data - WriteGuard aWriteLock( m_aLock ); - m_aDockUIElement.m_bFloating = aDockingData.bFloating; - if ( !aDockingData.bFloating ) - { - m_aDockUIElement.m_aDockedData = aUIDockingElement.m_aDockedData; - m_eDockOperation = eDockingOperation; - } - else - m_aDockUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData; - aWriteLock.unlock(); - } - catch ( Exception& ) - { - } - } - - return aDockingData; -} - -void SAL_CALL LayoutManager::endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) -throw (::com::sun::star::uno::RuntimeException) -{ - sal_Bool bDockingInProgress( sal_False ); - sal_Bool bStartDockFloated( sal_False ); - sal_Bool bFloating( sal_False ); - UIElement aUIDockingElement; - - WriteGuard aWriteLock( m_aLock ); - bDockingInProgress = m_bDockingInProgress; - aUIDockingElement = m_aDockUIElement; - bFloating = aUIDockingElement.m_bFloating; - - UIElement& rUIElement = impl_findElement( aUIDockingElement.m_aName ); - if ( rUIElement.m_aName == aUIDockingElement.m_aName ) - { - if ( aUIDockingElement.m_bFloating ) - { - // Write last position into position data - Reference< css::awt::XWindow > xWindow( aUIDockingElement.m_xUIElement->getRealInterface(), UNO_QUERY ); - rUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData; - css::awt::Rectangle aTmpRect = xWindow->getPosSize(); - rUIElement.m_aFloatingData.m_aPos = ::Point( aTmpRect.X, aTmpRect.Y ); - // make changes also for our local data as we use it to make data persistent - aUIDockingElement.m_aFloatingData = rUIElement.m_aFloatingData; - } - else - { - rUIElement.m_aDockedData = aUIDockingElement.m_aDockedData; - rUIElement.m_aFloatingData.m_aSize = aUIDockingElement.m_aFloatingData.m_aSize; - - if ( m_eDockOperation != DOCKOP_ON_COLROW ) - { - // we have to renumber our row/column data to insert a new row/column - implts_renumberRowColumnData( (::com::sun::star::ui::DockingArea)aUIDockingElement.m_aDockedData.m_nDockedArea, - m_eDockOperation, - aUIDockingElement ); - } - } - - bStartDockFloated = rUIElement.m_bFloating; - rUIElement.m_bFloating = m_aDockUIElement.m_bFloating; - rUIElement.m_bUserActive = sal_True; - } - - // reset member for next docking operation - m_aDockUIElement.m_xUIElement.clear(); - m_eDockOperation = DOCKOP_ON_COLROW; - aWriteLock.unlock(); - - implts_writeWindowStateData( aUIDockingElement.m_aName, aUIDockingElement ); - - if ( bDockingInProgress ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( Reference< css::awt::XWindow >( e.Source, UNO_QUERY )); - ToolBox* pToolBox = 0; - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = (ToolBox *)pWindow; - - if ( pToolBox ) - { - if( e.bFloating ) - { - if ( aUIDockingElement.m_aFloatingData.m_bIsHorizontal ) - pToolBox->SetAlign( WINDOWALIGN_TOP ); - else - pToolBox->SetAlign( WINDOWALIGN_LEFT ); - } - else - { - ::Size aSize; - - pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) ); - - // Docked toolbars have always one line - aSize = pToolBox->CalcWindowSizePixel( 1 ); - - // Lock layouting updates as our listener would be called due to SetSizePixel - pToolBox->SetOutputSizePixel( aSize ); - } - } - } - - aWriteLock.lock(); - m_bDockingInProgress = sal_False; - aWriteLock.unlock(); - - implts_sortUIElements(); - if ( !bStartDockFloated || !bFloating ) - { - // Optimization: Don't layout if we started floating and now floating again. - // This would not change anything for the docked user-interface elements. - doLayout(); - } -} - -sal_Bool SAL_CALL LayoutManager::prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) -throw (::com::sun::star::uno::RuntimeException) -{ - sal_Bool bDockingInProgress( sal_False ); - - ReadGuard aReadLock( m_aLock ); - bDockingInProgress = m_bDockingInProgress; - aReadLock.unlock(); - - UIElement aUIDockingElement; - sal_Bool bWinFound( implts_findElement( e.Source, aUIDockingElement ) ); - Reference< css::awt::XWindow > xWindow( e.Source, UNO_QUERY ); - - if ( bWinFound && xWindow.is() ) - { - if ( !bDockingInProgress ) - { - css::awt::Rectangle aRect; - Reference< css::awt::XDockableWindow > xDockWindow( xWindow, UNO_QUERY ); - if ( xDockWindow->isFloating() ) - { - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - { - if ( pWindow->GetType() == WINDOW_TOOLBOX ) - { - ToolBox* pToolBox = (ToolBox *)pWindow; - aUIDockingElement.m_aFloatingData.m_aPos = pToolBox->GetPosPixel(); - aUIDockingElement.m_aFloatingData.m_aSize = pToolBox->GetOutputSizePixel(); - aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); - aUIDockingElement.m_aFloatingData.m_bIsHorizontal = (( pToolBox->GetAlign() == WINDOWALIGN_TOP ) || - ( pToolBox->GetAlign() == WINDOWALIGN_BOTTOM )); - } - } - } - - WriteGuard aWriteLock( m_aLock ); - UIElement& rUIElement = LayoutManager::impl_findElement( aUIDockingElement.m_aName ); - if ( rUIElement.m_aName == aUIDockingElement.m_aName ) - rUIElement = aUIDockingElement; - aWriteLock.unlock(); - } - } - } - - return sal_True; -} - -void SAL_CALL LayoutManager::toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) -throw (::com::sun::star::uno::RuntimeException) -{ - sal_Bool bDockingInProgress( sal_False ); - UIElement aUIDockingElement; - - ReadGuard aReadLock( m_aLock ); - bDockingInProgress = m_bDockingInProgress; - if ( bDockingInProgress ) - aUIDockingElement = m_aDockUIElement; - aReadLock.unlock(); - - Window* pWindow( 0 ); - ToolBox* pToolBox( 0 ); - Reference< css::awt::XWindow2 > xWindow; - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - xWindow = Reference< css::awt::XWindow2 >( e.Source, UNO_QUERY ); - pWindow = VCLUnoHelper::GetWindow( xWindow ); - - if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) - pToolBox = (ToolBox *)pWindow; - } - - if ( !bDockingInProgress ) - { - sal_Bool bWinFound( implts_findElement( e.Source, aUIDockingElement ) ); - if ( bWinFound && xWindow.is() ) - { - aUIDockingElement.m_bFloating = !aUIDockingElement.m_bFloating; - aUIDockingElement.m_bUserActive = sal_True; - - WriteGuard aWriteLock( m_aLock ); - m_bDoLayout = sal_True; - aWriteLock.unlock(); - - if ( aUIDockingElement.m_bFloating ) - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( pToolBox ) - { - pToolBox->SetLineCount( aUIDockingElement.m_aFloatingData.m_nLines ); - if ( aUIDockingElement.m_aFloatingData.m_bIsHorizontal ) - pToolBox->SetAlign( WINDOWALIGN_TOP ); - else - pToolBox->SetAlign( WINDOWALIGN_LEFT ); - } - - sal_Bool bUndefPos = ( aUIDockingElement.m_aFloatingData.m_aPos.X() == SAL_MAX_INT32 || - aUIDockingElement.m_aFloatingData.m_aPos.Y() == SAL_MAX_INT32 ); - sal_Bool bSetSize = ( aUIDockingElement.m_aFloatingData.m_aSize.Width() != 0 && - aUIDockingElement.m_aFloatingData.m_aSize.Height() != 0 ); - - if ( bUndefPos ) - aUIDockingElement.m_aFloatingData.m_aPos = implts_findNextCascadeFloatingPos(); - - if ( !bSetSize ) - { - if ( pToolBox ) - aUIDockingElement.m_aFloatingData.m_aSize = pToolBox->CalcFloatingWindowSizePixel(); - else - aUIDockingElement.m_aFloatingData.m_aSize = pWindow->GetOutputSizePixel(); - } - - xWindow->setPosSize( aUIDockingElement.m_aFloatingData.m_aPos.X(), - aUIDockingElement.m_aFloatingData.m_aPos.Y(), - 0, 0, css::awt::PosSize::POS ); - xWindow->setOutputSize( AWTSize( aUIDockingElement.m_aFloatingData.m_aSize ) ); - } - else - { - if (( aUIDockingElement.m_aDockedData.m_aPos.X() == SAL_MAX_INT32 ) && - ( aUIDockingElement.m_aDockedData.m_aPos.Y() == SAL_MAX_INT32 )) - { - // Docking on its default position without a preset position - - // we have to find a good place for it. - ::Point aPixelPos; - ::Point aDockPos; - ::Size aSize; - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( pToolBox ) - aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea ) ); - else - aSize = pWindow->GetSizePixel(); - } - - implts_findNextDockingPos( (::com::sun::star::ui::DockingArea)aUIDockingElement.m_aDockedData.m_nDockedArea, - aSize, - aDockPos, - aPixelPos ); - aUIDockingElement.m_aDockedData.m_aPos = aDockPos; - } - - vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( pToolBox ) - { - pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) ); - ::Size aSize = pToolBox->CalcWindowSizePixel( 1 ); - css::awt::Rectangle aRect = xWindow->getPosSize(); - xWindow->setPosSize( aRect.X, aRect.Y, 0, 0, css::awt::PosSize::POS ); - xWindow->setOutputSize( AWTSize( aSize ) ); - } - } - - aWriteLock.lock(); - m_bDoLayout = sal_False; - UIElement& rUIElement = LayoutManager::impl_findElement( aUIDockingElement.m_aName ); - if ( rUIElement.m_aName == aUIDockingElement.m_aName ) - rUIElement = aUIDockingElement; - aWriteLock.unlock(); - - implts_writeWindowStateData( aUIDockingElement.m_aName, aUIDockingElement ); - - implts_sortUIElements(); - doLayout(); - } - } - else - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - if ( pToolBox ) - { - if ( aUIDockingElement.m_bFloating ) - { - if ( aUIDockingElement.m_aFloatingData.m_bIsHorizontal ) - pToolBox->SetAlign( WINDOWALIGN_TOP ); - else - pToolBox->SetAlign( WINDOWALIGN_LEFT ); - } - else - { - pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) ); - } - } - } -} - -void SAL_CALL LayoutManager::closed( const ::com::sun::star::lang::EventObject& e ) -throw (::com::sun::star::uno::RuntimeException) -{ - rtl::OUString aName; - UIElement aUIElement; - UIElementVector::iterator pIter; - - WriteGuard aWriteLock( m_aLock ); - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - { - Reference< XUIElement > xUIElement( pIter->m_xUIElement ); - if ( xUIElement.is() ) - { - Reference< XInterface > xIfac( xUIElement->getRealInterface(), UNO_QUERY ); - if ( xIfac == e.Source ) - { - aName = pIter->m_aName; - - // user closes a toolbar => - // context sensitive toolbar: only destroy toolbar and store state. - // context sensitive toolbar: make it invisible, store state and destroy it. - if ( !pIter->m_bContextSensitive ) - pIter->m_bVisible = sal_False; - - aUIElement = *pIter; - break; - } - } - } - aWriteLock.unlock(); - - - // destroy element - if ( aName.getLength() > 0 ) - { - implts_writeWindowStateData( aName, aUIElement ); - destroyElement( aName ); - } -} - -void SAL_CALL LayoutManager::endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& ) -throw (::com::sun::star::uno::RuntimeException) -{ - -} - -//--------------------------------------------------------------------------------------------------------- // XLayoutManagerEventBroadcaster //--------------------------------------------------------------------------------------------------------- -void SAL_CALL LayoutManager::addLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& xListener ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL LayoutManager::addLayoutManagerEventListener( const uno::Reference< frame::XLayoutManagerListener >& xListener ) +throw (uno::RuntimeException) { - m_aListenerContainer.addInterface( ::getCppuType( (const css::uno::Reference< css::frame::XLayoutManagerListener >*)NULL ), xListener ); + m_aListenerContainer.addInterface( ::getCppuType( (const uno::Reference< frame::XLayoutManagerListener >*)NULL ), xListener ); } -void SAL_CALL LayoutManager::removeLayoutManagerEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManagerListener >& xListener ) -throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL LayoutManager::removeLayoutManagerEventListener( const uno::Reference< frame::XLayoutManagerListener >& xListener ) +throw (uno::RuntimeException) { - m_aListenerContainer.removeInterface( ::getCppuType( (const css::uno::Reference< css::frame::XLayoutManagerListener >*)NULL ), xListener ); + m_aListenerContainer.removeInterface( ::getCppuType( (const uno::Reference< frame::XLayoutManagerListener >*)NULL ), xListener ); } -void LayoutManager::implts_notifyListeners( short nEvent, ::com::sun::star::uno::Any aInfoParam ) +void LayoutManager::implts_notifyListeners( short nEvent, uno::Any aInfoParam ) { - css::lang::EventObject aSource (static_cast< ::cppu::OWeakObject*>(this)); - ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const css::uno::Reference< css::frame::XLayoutManagerListener >*) NULL ) ); + lang::EventObject aSource( static_cast< ::cppu::OWeakObject*>(this) ); + ::cppu::OInterfaceContainerHelper* pContainer = m_aListenerContainer.getContainer( ::getCppuType( ( const uno::Reference< frame::XLayoutManagerListener >*) NULL ) ); if (pContainer!=NULL) { ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); @@ -6917,9 +2711,9 @@ void LayoutManager::implts_notifyListeners( short nEvent, ::com::sun::star::uno: { try { - ((css::frame::XLayoutManagerListener*)pIterator.next())->layoutEvent( aSource, nEvent, aInfoParam ); + ((frame::XLayoutManagerListener*)pIterator.next())->layoutEvent( aSource, nEvent, aInfoParam ); } - catch( css::uno::RuntimeException& ) + catch( uno::RuntimeException& ) { pIterator.remove(); } @@ -6928,10 +2722,10 @@ void LayoutManager::implts_notifyListeners( short nEvent, ::com::sun::star::uno: } //--------------------------------------------------------------------------------------------------------- -// XWindowListener +// XWindowListener //--------------------------------------------------------------------------------------------------------- -void SAL_CALL LayoutManager::windowResized( const css::awt::WindowEvent& aEvent ) -throw( css::uno::RuntimeException ) +void SAL_CALL LayoutManager::windowResized( const awt::WindowEvent& aEvent ) +throw( uno::RuntimeException ) { /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); @@ -6940,9 +2734,9 @@ throw( css::uno::RuntimeException ) return; // Request to set docking area space again. - css::awt::Rectangle aDockingArea( m_aDockingArea ); + awt::Rectangle aDockingArea( m_aDockingArea ); Reference< XDockingAreaAcceptor > xDockingAreaAcceptor( m_xDockingAreaAcceptor ); - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); Reference< XInterface > xIfac( xContainerWindow, UNO_QUERY ); if ( xIfac == aEvent.Source && m_bVisible ) @@ -6964,105 +2758,65 @@ throw( css::uno::RuntimeException ) { // the container window of my DockingAreaAcceptor is not the same as of my frame // I still have to resize my frames' window as nobody else will do it - Reference< css::awt::XWindow > xComponentWindow( m_xFrame->getComponentWindow() ); + Reference< awt::XWindow > xComponentWindow( m_xFrame->getComponentWindow() ); if( xComponentWindow.is() == sal_True ) { - css::uno::Reference< css::awt::XDevice > xDevice( m_xFrame->getContainerWindow(), css::uno::UNO_QUERY ); + uno::Reference< awt::XDevice > xDevice( m_xFrame->getContainerWindow(), uno::UNO_QUERY ); // Convert relativ size to output size. - css::awt::Rectangle aRectangle = m_xFrame->getContainerWindow()->getPosSize(); - css::awt::DeviceInfo aInfo = xDevice->getInfo(); - css::awt::Size aSize ( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset , - aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); + awt::Rectangle aRectangle = m_xFrame->getContainerWindow()->getPosSize(); + awt::DeviceInfo aInfo = xDevice->getInfo(); + awt::Size aSize( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset , + aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); // Resize our component window. - xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, css::awt::PosSize::POSSIZE ); - } - } - else - { - // resize event for one of the UIElements - sal_Bool bLocked( m_bDockingInProgress ); - sal_Bool bDoLayout( m_bDoLayout ); - aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - - if ( !bLocked && !bDoLayout ) - { - // Do not do anything if we are in the middle of a docking process. This would interfere all other - // operations. We will store the new position and size in the docking handlers. - // Do not do anything if we are in the middle of our layouting process. We will adapt the position - // and size of the user interface elements. - UIElement aUIElement; - if ( implts_findElement( aEvent.Source, aUIElement )) - { - if ( aUIElement.m_bFloating ) - implts_writeNewStateData( aUIElement.m_aName, - Reference< css::awt::XWindow >( aEvent.Source, UNO_QUERY )); - else - doLayout(); - } + xComponentWindow->setPosSize( 0, 0, aSize.Width, aSize.Height, awt::PosSize::POSSIZE ); } } } -void SAL_CALL LayoutManager::windowMoved( const css::awt::WindowEvent& ) throw( css::uno::RuntimeException ) +void SAL_CALL LayoutManager::windowMoved( const awt::WindowEvent& ) throw( uno::RuntimeException ) { } -void SAL_CALL LayoutManager::windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) +void SAL_CALL LayoutManager::windowShown( const lang::EventObject& aEvent ) throw( uno::RuntimeException ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); - - // Request to set docking area space again. - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); - bool bParentWindowVisible( m_bParentWindowVisible ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); + bool bParentWindowVisible( m_bParentWindowVisible ); aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ Reference< XInterface > xIfac( xContainerWindow, UNO_QUERY ); if ( xIfac == aEvent.Source ) { bool bSetVisible = false; - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_bParentWindowVisible = true; bSetVisible = ( m_bParentWindowVisible != bParentWindowVisible ); aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( bSetVisible ) - { implts_updateUIElementsVisibleState( sal_True ); - //implts_doLayout( sal_False ); - } } } -void SAL_CALL LayoutManager::windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ) +void SAL_CALL LayoutManager::windowHidden( const lang::EventObject& aEvent ) throw( uno::RuntimeException ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); - - // Request to set docking area space again. - Reference< css::awt::XWindow > xContainerWindow( m_xContainerWindow ); - bool bParentWindowVisible( m_bParentWindowVisible ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); + bool bParentWindowVisible( m_bParentWindowVisible ); aReadLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ Reference< XInterface > xIfac( xContainerWindow, UNO_QUERY ); if ( xIfac == aEvent.Source ) { bool bSetInvisible = false; - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_bParentWindowVisible = false; bSetInvisible = ( m_bParentWindowVisible != bParentWindowVisible ); aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ if ( bSetInvisible ) implts_updateUIElementsVisibleState( sal_False ); @@ -7071,17 +2825,14 @@ void SAL_CALL LayoutManager::windowHidden( const css::lang::EventObject& aEvent IMPL_LINK( LayoutManager, AsyncLayoutHdl, Timer *, EMPTYARG ) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ ReadGuard aReadLock( m_aLock ); - - // Request to set docking area space again. m_aAsyncLayoutTimer.Stop(); if( !m_xContainerWindow.is() ) return 0; - css::awt::Rectangle aDockingArea( m_aDockingArea ); - ::Size aStatusBarSize( implts_getStatusBarSize() ); + awt::Rectangle aDockingArea( m_aDockingArea ); + ::Size aStatusBarSize( implts_getStatusBarSize() ); // Subtract status bar height aDockingArea.Height -= aStatusBarSize.Height(); @@ -7093,78 +2844,42 @@ IMPL_LINK( LayoutManager, AsyncLayoutHdl, Timer *, EMPTYARG ) return 0; } -#ifdef DBG_UTIL -void LayoutManager::implts_checkElementContainer() -{ -#ifdef DBG_UTIL - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - ReadGuard aReadLock( m_aLock ); - - BaseHash< sal_Int32 > aUIElementHash; - - UIElementVector::iterator pIter; - for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) - aUIElementHash[pIter->m_aName]++; - - - BaseHash< sal_Int32 >::const_iterator pCheckIter = aUIElementHash.begin(); - for ( ; pCheckIter != aUIElementHash.end(); pCheckIter++ ) - { - if ( pCheckIter->second > 1 ) - { - ::rtl::OString aName = ::rtl::OUStringToOString( pCheckIter->first, RTL_TEXTENCODING_ASCII_US ); - DBG_ASSERT( "More than one element (%s) with the same name found!", aName.getStr() ); - } - } // for ( ; pCheckIter != aUIElementHash.end(); pCheckIter++ ) -#endif -} -#endif - //--------------------------------------------------------------------------------------------------------- -// XFrameActionListener +// XFrameActionListener //--------------------------------------------------------------------------------------------------------- void SAL_CALL LayoutManager::frameAction( const FrameActionEvent& aEvent ) throw ( RuntimeException ) { - if (( aEvent.Action == FrameAction_COMPONENT_ATTACHED ) || - ( aEvent.Action == FrameAction_COMPONENT_REATTACHED )) + if (( aEvent.Action == FrameAction_COMPONENT_ATTACHED ) || ( aEvent.Action == FrameAction_COMPONENT_REATTACHED )) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::frameAction (COMPONENT_ATTACHED|REATTACHED)" ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_bComponentAttached = sal_True; m_bMustDoLayout = sal_True; aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ implts_reset( sal_True ); implts_doLayout( sal_True, sal_False ); implts_doLayout( sal_True, sal_True ); } - else if (( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ) || - ( aEvent.Action == FrameAction_FRAME_UI_DEACTIVATING )) + else if (( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ) || ( aEvent.Action == FrameAction_FRAME_UI_DEACTIVATING )) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::frameAction (FRAME_UI_ACTIVATED|DEACTIVATING)" ); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ WriteGuard aWriteLock( m_aLock ); m_bActive = ( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ); aWriteLock.unlock(); - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ implts_toggleFloatingUIElementsVisibility( aEvent.Action == FrameAction_FRAME_UI_ACTIVATED ); -// doLayout(); } else if ( aEvent.Action == FrameAction_COMPONENT_DETACHING ) { RTL_LOGFILE_CONTEXT( aLog, "framework (cd100003) ::LayoutManager::frameAction (COMPONENT_DETACHING)" ); - // SAFE AREA ----------------------------------------------------------------------------------------------- WriteGuard aWriteLock( m_aLock ); m_bComponentAttached = sal_False; aWriteLock.unlock(); - // SAFE AREA ----------------------------------------------------------------------------------------------- implts_reset( sal_False ); } @@ -7172,7 +2887,7 @@ throw ( RuntimeException ) // ______________________________________________ -void SAL_CALL LayoutManager::disposing( const css::lang::EventObject& rEvent ) +void SAL_CALL LayoutManager::disposing( const lang::EventObject& rEvent ) throw( RuntimeException ) { sal_Bool bDisposeAndClear( sal_False ); @@ -7182,23 +2897,11 @@ throw( RuntimeException ) if ( rEvent.Source == Reference< XInterface >( m_xFrame, UNO_QUERY )) { - // Our frame gets disposed, release all our references that depends on a working - // frame reference. + // Our frame gets disposed, release all our references that depends on a working frame reference. Application::RemoveEventListener( LINK( this, LayoutManager, SettingsChanged ) ); - if ( m_pMiscOptions ) - { - m_pMiscOptions->RemoveListenerLink( LINK( this, LayoutManager, OptionsChanged ) ); - delete m_pMiscOptions; - m_pMiscOptions = 0; - } - - delete m_pAddonOptions; - m_pAddonOptions = 0; // destroy all elements, it's possible that dettaching is NOT called! implts_destroyElements(); - - m_aUIElements.clear(); impl_clearUpMenuBar(); m_xMenuBar.clear(); if ( m_xInplaceMenuBar.is() ) @@ -7209,7 +2912,10 @@ throw( RuntimeException ) m_xInplaceMenuBar.clear(); m_xContainerWindow.clear(); m_xContainerTopWindow.clear(); - implts_destroyDockingAreaWindows(); + + // forward disposing call to toolbar manager + if ( m_pToolbarManager != NULL ) + m_pToolbarManager->disposing(rEvent); if ( m_xModuleCfgMgr.is() ) { @@ -7219,9 +2925,7 @@ throw( RuntimeException ) xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } if ( m_xDocCfgMgr.is() ) @@ -7232,9 +2936,7 @@ throw( RuntimeException ) xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); } - catch ( Exception& ) - { - } + catch ( Exception& ) {} } m_xDocCfgMgr.clear(); @@ -7242,14 +2944,20 @@ throw( RuntimeException ) m_xFrame.clear(); delete m_pGlobalSettings; m_pGlobalSettings = 0; - m_xDockingAreaAcceptor = Reference< ::com::sun::star::ui::XDockingAreaAcceptor >(); + m_xDockingAreaAcceptor = Reference< ui::XDockingAreaAcceptor >(); bDisposeAndClear = sal_True; } else if ( rEvent.Source == Reference< XInterface >( m_xContainerWindow, UNO_QUERY )) { // Our container window gets disposed. Remove all user interface elements. - m_aUIElements.clear(); + uno::Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + if ( pToolbarManager ) + { + uno::Reference< awt::XWindowPeer > aEmptyWindowPeer; + pToolbarManager->setParentWindow( aEmptyWindowPeer ); + } impl_clearUpMenuBar(); m_xMenuBar.clear(); if ( m_xInplaceMenuBar.is() ) @@ -7262,13 +2970,9 @@ throw( RuntimeException ) m_xContainerTopWindow.clear(); } else if ( rEvent.Source == Reference< XInterface >( m_xDocCfgMgr, UNO_QUERY )) - { m_xDocCfgMgr.clear(); - } else if ( rEvent.Source == Reference< XInterface >( m_xModuleCfgMgr , UNO_QUERY )) - { m_xModuleCfgMgr.clear(); - } aWriteLock.unlock(); /* SAFE AREA ----------------------------------------------------------------------------------------------- */ @@ -7277,208 +2981,207 @@ throw( RuntimeException ) if ( bDisposeAndClear ) { // Send message to all listener and forget her references. - css::uno::Reference< css::frame::XLayoutManager > xThis( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); - css::lang::EventObject aEvent( xThis ); + uno::Reference< frame::XLayoutManager > xThis( static_cast< ::cppu::OWeakObject* >(this), uno::UNO_QUERY ); + lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); } } -void SAL_CALL LayoutManager::elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL LayoutManager::elementInserted( const ui::ConfigurationEvent& Event ) throw (uno::RuntimeException) { ReadGuard aReadLock( m_aLock ); + Reference< XFrame > xFrame( m_xFrame ); + Reference< ui::XUIConfigurationListener > xUICfgListener( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - Reference< XUIElement > xElement; - Reference< XFrame > xFrame( m_xFrame ); - - if ( m_xFrame.is() ) + if ( xFrame.is() ) { - implts_findElement( Event.ResourceURL, aElementType, aElementName, xElement ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + bool bRefreshLayout(false); - Reference< XUIElementSettings > xElementSettings( xElement, UNO_QUERY ); - if ( xElementSettings.is() ) + parseResourceURL( Event.ResourceURL, aElementType, aElementName ); + if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); - Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY ); - if ( xPropSet.is() ) + if ( xUICfgListener.is() ) { - if ( Event.Source == Reference< XInterface >( m_xDocCfgMgr, UNO_QUERY )) - xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xDocCfgMgr )); + xUICfgListener->elementInserted( Event ); + bRefreshLayout = pToolbarManager->isLayoutDirty(); } - xElementSettings->updateSettings(); } - else + else if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_MENUBAR )) { - if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ) && - ( aElementName.indexOf( m_aCustomTbxPrefix ) != -1 )) + Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL ); + Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); + if ( xElementSettings.is() ) { - // custom toolbar must be directly created, shown and layouted! - createElement( Event.ResourceURL ); - Reference< XUIElement > xUIElement = getElement( Event.ResourceURL ); - if ( xUIElement.is() ) + ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); + uno::Reference< XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); + if ( xPropSet.is() ) { - Reference< XUIConfigurationManager > xCfgMgr; - Reference< XPropertySet > xPropSet; - ::rtl::OUString aUIName; - - try - { - xCfgMgr = Reference< XUIConfigurationManager >( Event.Source, UNO_QUERY ); - xPropSet = Reference< XPropertySet >( xCfgMgr->getSettings( Event.ResourceURL, sal_False ), UNO_QUERY ); - - if ( xPropSet.is() ) - xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= aUIName; - } - catch ( com::sun::star::container::NoSuchElementException& ) - { - } - catch ( com::sun::star::beans::UnknownPropertyException& ) - { - } - catch ( com::sun::star::lang::WrappedTargetException& ) - { - } - - { - vos::OGuard aGuard( Application::GetSolarMutex() ); - Reference< css::awt::XWindow > xWindow( xUIElement->getRealInterface(), UNO_QUERY ); - Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); - if ( pWindow ) - pWindow->SetText( aUIName ); - } - - showElement( Event.ResourceURL ); + if ( Event.Source == uno::Reference< uno::XInterface >( m_xDocCfgMgr, uno::UNO_QUERY )) + xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xDocCfgMgr )); } + xElementSettings->updateSettings(); } } + + if ( bRefreshLayout ) + doLayout(); } } -void SAL_CALL LayoutManager::elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL LayoutManager::elementRemoved( const ui::ConfigurationEvent& Event ) throw (uno::RuntimeException) { - /* SAFE AREA ----------------------------------------------------------------------------------------------- */ - WriteGuard aWriteLock( m_aLock ); - - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - Reference< XUIElement > xUIElement; - Reference< XFrame > xFrame( m_xFrame ); + ReadGuard aReadLock( m_aLock ); + Reference< frame::XFrame > xFrame( m_xFrame ); + Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + Reference< awt::XWindow > xContainerWindow( m_xContainerWindow ); + Reference< ui::XUIElement > xMenuBar( m_xMenuBar ); + Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr ); + Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - if ( m_xFrame.is() ) + if ( xFrame.is() ) { - implts_findElement( Event.ResourceURL, aElementType, aElementName, xUIElement ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + bool bRefreshLayout(false); - Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); - if ( xElementSettings.is() ) + parseResourceURL( Event.ResourceURL, aElementType, aElementName ); + if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - bool bNoSettings( false ); - ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); - Reference< XInterface > xElementCfgMgr; - Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY ); + if ( xToolbarManager.is() ) + { + xToolbarManager->elementRemoved( Event ); + bRefreshLayout = pToolbarManager->isLayoutDirty(); + } + } + else + { + Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL ); + Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); + if ( xElementSettings.is() ) + { + bool bNoSettings( false ); + ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); + Reference< XInterface > xElementCfgMgr; + Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY ); - if ( xPropSet.is() ) - xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; + if ( xPropSet.is() ) + xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; - if ( !xElementCfgMgr.is() ) - return; + if ( !xElementCfgMgr.is() ) + return; - // Check if the same UI configuration manager has changed => check further - if ( Event.Source == xElementCfgMgr ) - { - // Same UI configuration manager where our element has its settings - if ( Event.Source == Reference< XInterface >( m_xDocCfgMgr, UNO_QUERY )) + // Check if the same UI configuration manager has changed => check further + if ( Event.Source == xElementCfgMgr ) { - // document settings removed - if ( m_xModuleCfgMgr->hasSettings( Event.ResourceURL )) + // Same UI configuration manager where our element has its settings + if ( Event.Source == Reference< XInterface >( xDocCfgMgr, UNO_QUERY )) { - xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xModuleCfgMgr )); - xElementSettings->updateSettings(); - return; + // document settings removed + if ( xModuleCfgMgr->hasSettings( Event.ResourceURL )) + { + xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xModuleCfgMgr )); + xElementSettings->updateSettings(); + return; + } } - } - bNoSettings = true; - } + bNoSettings = true; + } - // No settings anymore, element must be destroyed - if ( m_xContainerWindow.is() && bNoSettings ) - { - if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && - aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) + // No settings anymore, element must be destroyed + if ( xContainerWindow.is() && bNoSettings ) { - Window* pWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); - while ( pWindow && !pWindow->IsSystemWindow() ) - pWindow = pWindow->GetParent(); + if ( aElementType.equalsIgnoreAsciiCaseAscii( "menubar" ) && aElementName.equalsIgnoreAsciiCaseAscii( "menubar" )) + { + SystemWindow* pSysWindow = getTopSystemWindow( xContainerWindow ); + if ( pSysWindow && !m_bInplaceMenuSet ) + pSysWindow->SetMenuBar( 0 ); - if ( pWindow && !m_bInplaceMenuSet ) - ((SystemWindow *)pWindow)->SetMenuBar( 0 ); + Reference< XComponent > xComp( xMenuBar, UNO_QUERY ); + if ( xComp.is() ) + xComp->dispose(); - Reference< XComponent > xComp( m_xMenuBar, UNO_QUERY ); - if ( xComp.is() ) - xComp->dispose(); - m_xMenuBar.clear(); - } - else if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) - { - destroyElement( Event.ResourceURL ); + WriteGuard aWriteLock( m_aLock ); + m_xMenuBar.clear(); + } } } } + + if ( bRefreshLayout ) + doLayout(); } } -void SAL_CALL LayoutManager::elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException) +void SAL_CALL LayoutManager::elementReplaced( const ui::ConfigurationEvent& Event ) throw (uno::RuntimeException) { ReadGuard aReadLock( m_aLock ); + Reference< XFrame > xFrame( m_xFrame ); + Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + aReadLock.unlock(); - ::rtl::OUString aElementType; - ::rtl::OUString aElementName; - Reference< XUIElement > xUIElement; - Reference< XFrame > xFrame( m_xFrame ); - - if ( m_xFrame.is() ) + if ( xFrame.is() ) { - implts_findElement( Event.ResourceURL, aElementType, aElementName, xUIElement ); + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + bool bRefreshLayout(false); - Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); - if ( xElementSettings.is() ) + parseResourceURL( Event.ResourceURL, aElementType, aElementName ); + if ( aElementType.equalsIgnoreAsciiCaseAscii( UIRESOURCETYPE_TOOLBAR )) { - ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); - Reference< XInterface > xElementCfgMgr; - Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY ); + if ( xToolbarManager.is() ) + { + xToolbarManager->elementReplaced( Event ); + bRefreshLayout = pToolbarManager->isLayoutDirty(); + } + } + else + { + Reference< XUIElement > xUIElement = implts_findElement( Event.ResourceURL ); + Reference< XUIElementSettings > xElementSettings( xUIElement, UNO_QUERY ); + if ( xElementSettings.is() ) + { + ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); + Reference< XInterface > xElementCfgMgr; + Reference< XPropertySet > xPropSet( xElementSettings, UNO_QUERY ); - if ( xPropSet.is() ) - xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; + if ( xPropSet.is() ) + xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; - if ( !xElementCfgMgr.is() ) - return; + if ( !xElementCfgMgr.is() ) + return; - // Check if the same UI configuration manager has changed => update settings - if ( Event.Source == xElementCfgMgr ) - { - xElementSettings->updateSettings(); - if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" )) - doLayout(); + // Check if the same UI configuration manager has changed => update settings + if ( Event.Source == xElementCfgMgr ) + xElementSettings->updateSettings(); } } + + if ( bRefreshLayout ) + doLayout(); } } //--------------------------------------------------------------------------------------------------------- -// OPropertySetHelper +// OPropertySetHelper //--------------------------------------------------------------------------------------------------------- -// XPropertySet helper -sal_Bool SAL_CALL LayoutManager::convertFastPropertyValue( Any& aConvertedValue , - Any& aOldValue , - sal_Int32 nHandle , - const Any& aValue ) throw( com::sun::star::lang::IllegalArgumentException ) +sal_Bool SAL_CALL LayoutManager::convertFastPropertyValue( Any& aConvertedValue, + Any& aOldValue, + sal_Int32 nHandle, + const Any& aValue ) throw( lang::IllegalArgumentException ) { return LayoutManager_PBase::convertFastPropertyValue( aConvertedValue, aOldValue, nHandle, aValue ); } -void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle , - const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ) +void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, + const uno::Any& aValue ) throw( uno::Exception ) { if ( nHandle != LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY ) LayoutManager_PBase::setFastPropertyValue_NoBroadcast( nHandle, aValue ); @@ -7491,40 +3194,43 @@ void SAL_CALL LayoutManager::setFastPropertyValue_NoBroadcast( sal_Int32 case LAYOUTMANAGER_PROPHANDLE_REFRESHVISIBILITY: { - sal_Bool bValue = sal_Bool(); + sal_Bool bValue(sal_False); if (( aValue >>= bValue ) && bValue ) - implts_refreshContextToolbarsVisibility(); + { + ReadGuard aReadLock( m_aLock ); + Reference< ui::XUIConfigurationListener > xToolbarManager( m_xToolbarManager ); + ToolbarLayoutManager* pToolbarManager = m_pToolbarManager; + bool bAutomaticToolbars( m_bAutomaticToolbars ); + aReadLock.unlock(); + + if ( pToolbarManager ) + pToolbarManager->refreshToolbarsVisibility( bAutomaticToolbars ); + } break; } case LAYOUTMANAGER_PROPHANDLE_HIDECURRENTUI: implts_setCurrentUIVisibility( !m_bHideCurrentUI ); break; + default: break; } } -void SAL_CALL LayoutManager::getFastPropertyValue( com::sun::star::uno::Any& aValue , - sal_Int32 nHandle ) const +void SAL_CALL LayoutManager::getFastPropertyValue( uno::Any& aValue, sal_Int32 nHandle ) const { LayoutManager_PBase::getFastPropertyValue( aValue, nHandle ); } ::cppu::IPropertyArrayHelper& SAL_CALL LayoutManager::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". uno::Sequence< beans::Property > aProperties; describeProperties( aProperties ); static ::cppu::OPropertyArrayHelper aInfoHelper( aProperties, sal_True ); @@ -7535,23 +3241,17 @@ void SAL_CALL LayoutManager::getFastPropertyValue( com::sun::star::uno::Any& aVa return(*pInfoHelper); } -com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException) +uno::Reference< beans::XPropertySetInfo > SAL_CALL LayoutManager::getPropertySetInfo() throw (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; + static uno::Reference< 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() ) ); + static uno::Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) ); pInfo = &xInfo; } } @@ -7560,4 +3260,3 @@ com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > SAL_CA } } // namespace framework - diff --git a/framework/source/layoutmanager/makefile.mk b/framework/source/layoutmanager/makefile.mk index 70215a36578d..7ce19a71f2f9 100644 --- a/framework/source/layoutmanager/makefile.mk +++ b/framework/source/layoutmanager/makefile.mk @@ -2,10 +2,14 @@ # # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # -# Copyright 2000, 2010 Oracle and/or its affiliates. +# Copyright 2008 by Sun Microsystems, Inc. # # OpenOffice.org - a multi-platform office productivity suite # +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.5 $ +# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,12 +39,15 @@ ENABLE_EXCEPTIONS= TRUE .INCLUDE : settings.mk -VISIBILITY_HIDDEN = TRUE - # --- Generate ----------------------------------------------------- SLOFILES= \ - $(SLO)$/layoutmanager.obj + $(SLO)$/panelmanager.obj \ + $(SLO)$/layoutmanager.obj \ + $(SLO)$/panel.obj \ + $(SLO)$/helpers.obj \ + $(SLO)$/uielement.obj \ + $(SLO)$/toolbarlayoutmanager.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/layoutmanager/panel.cxx b/framework/source/layoutmanager/panel.cxx new file mode 100755 index 000000000000..69f6ad0f51d9 --- /dev/null +++ b/framework/source/layoutmanager/panel.cxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include "panel.hxx" +#include "helpers.hxx" + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <vos/mutex.hxx> +#include <vcl/svapp.hxx> +#include <toolkit/unohlp.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +using namespace ::com::sun::star; + +namespace framework +{ + +Panel::Panel( + const uno::Reference< lang::XMultiServiceFactory >& rSMGR, + const uno::Reference< awt::XWindow >& rParent, + PanelPosition nPanel ) : + m_xSMGR(rSMGR), m_nPanelPosition(nPanel) +{ + uno::Reference< awt::XWindowPeer > xWindowPeer( rParent, uno::UNO_QUERY ); + m_xPanelWindow = uno::Reference< awt::XWindow >( createToolkitWindow( rSMGR, xWindowPeer, "splitwindow" ), uno::UNO_QUERY ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + SplitWindow* pSplitWindow = dynamic_cast< SplitWindow* >( VCLUnoHelper::GetWindow( m_xPanelWindow )); + + if ( pSplitWindow ) + { + // Set alignment + if (nPanel == PANEL_TOP) + pSplitWindow->SetAlign( WINDOWALIGN_TOP ); + else if (nPanel == PANEL_BOTTOM) + pSplitWindow->SetAlign( WINDOWALIGN_BOTTOM ); + else if (nPanel == PANEL_LEFT) + pSplitWindow->SetAlign( WINDOWALIGN_LEFT ); + else + pSplitWindow->SetAlign( WINDOWALIGN_RIGHT ); + } +} + +Panel::~Panel() +{ +} + +} // namespace framework diff --git a/framework/source/layoutmanager/panel.hxx b/framework/source/layoutmanager/panel.hxx new file mode 100755 index 000000000000..e183c97ed5da --- /dev/null +++ b/framework/source/layoutmanager/panel.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_PANEL_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_PANEL_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <macros/generic.hxx> +#include <stdtypes.h> +#include <properties.h> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <vcl/window.hxx> +#include <vcl/splitwin.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +enum PanelPosition +{ + PANEL_TOP, + PANEL_LEFT, + PANEL_RIGHT, + PANEL_BOTTOM, + PANEL_COUNT +}; + +class Panel +{ + public: + Panel( const css::uno::Reference< css::lang::XMultiServiceFactory >& rSMGR, + const css::uno::Reference< css::awt::XWindow >& rParent, + PanelPosition nPanel ); + virtual ~Panel(); + + private: + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::awt::XWindow > m_xPanelWindow; + PanelPosition m_nPanelPosition; +}; + +} + +#endif // __FRAMEWORK_LAYOUTMANAGER_PANEL_HXX_ diff --git a/framework/source/layoutmanager/panelmanager.cxx b/framework/source/layoutmanager/panelmanager.cxx new file mode 100755 index 000000000000..4fd0a733b5a7 --- /dev/null +++ b/framework/source/layoutmanager/panelmanager.cxx @@ -0,0 +1,183 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include "panelmanager.hxx" +#include "services.h" +#include "services/modelwinservice.hxx" + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <vcl/svapp.hxx> +#include <toolkit/unohlp.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +using namespace ::com::sun::star; + +namespace framework +{ + +//_________________________________________________________________________________________________________________ +// non exported definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + + +PanelManager::PanelManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMGR, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ) : + m_xSMGR( rSMGR ), + m_xFrame( rFrame ) +{ + m_aPanels[PANEL_TOP] = 0; + m_aPanels[PANEL_BOTTOM] = 0; + m_aPanels[PANEL_LEFT] = 0; + m_aPanels[PANEL_RIGHT] = 0; +} + +PanelManager::~PanelManager() +{ +} + +//--------------------------------------------------------------------------------------------------------- +// Creation and layouting +//--------------------------------------------------------------------------------------------------------- +bool PanelManager::createPanels() +{ + if ( m_xFrame.is() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + uno::Reference< awt::XWindow > xWindow( m_xFrame->getContainerWindow(), uno::UNO_QUERY ); + if ( xWindow.is() ) + { + // destroy old panel windows + delete m_aPanels[PANEL_TOP ]; + delete m_aPanels[PANEL_BOTTOM]; + delete m_aPanels[PANEL_LEFT ]; + delete m_aPanels[PANEL_RIGHT ]; + + m_aPanels[PANEL_TOP ] = new Panel( m_xSMGR, xWindow, PANEL_TOP ); + m_aPanels[PANEL_BOTTOM] = new Panel( m_xSMGR, xWindow, PANEL_BOTTOM ); + m_aPanels[PANEL_LEFT ] = new Panel( m_xSMGR, xWindow, PANEL_LEFT ); + m_aPanels[PANEL_RIGHT ] = new Panel( m_xSMGR, xWindow, PANEL_RIGHT ); + return true; + } + } + + return false; +} + +awt::Rectangle PanelManager::getPreferredSize() const +{ + return awt::Rectangle(); +} + +void PanelManager::layoutPanels( const awt::Rectangle /*newSize*/ ) +{ +} + +//--------------------------------------------------------------------------------------------------------- +// Panel functions +//--------------------------------------------------------------------------------------------------------- +UIElement* PanelManager::findDockingWindow( const ::rtl::OUString& /*rResourceName*/ ) +{ + return NULL; +} + +bool PanelManager::addDockingWindow( const ::rtl::OUString& /*rResourceName*/, const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& /*xUIElement*/ ) +{ + return false; +} + +bool PanelManager::destroyDockingWindow( const ::rtl::OUString& /*rResourceName*/ ) +{ + return false; +} + +//--------------------------------------------------------------------------------------------------------- +// XDockableWindowListener +//--------------------------------------------------------------------------------------------------------- +void SAL_CALL PanelManager::startDocking( const awt::DockingEvent& ) +throw (uno::RuntimeException) +{ +} + +awt::DockingData SAL_CALL PanelManager::docking( const awt::DockingEvent& ) +throw (uno::RuntimeException) +{ + return awt::DockingData(); +} + +void SAL_CALL PanelManager::endDocking( const awt::EndDockingEvent& ) +throw (uno::RuntimeException) +{ +} + +sal_Bool SAL_CALL PanelManager::prepareToggleFloatingMode( const lang::EventObject& ) +throw (uno::RuntimeException) +{ + return false; +} + +void SAL_CALL PanelManager::toggleFloatingMode( const lang::EventObject& ) +throw (uno::RuntimeException) +{ +} + +void SAL_CALL PanelManager::closed( const lang::EventObject& ) +throw (uno::RuntimeException) +{ +} + +void SAL_CALL PanelManager::endPopupMode( const awt::EndPopupModeEvent& ) +throw (uno::RuntimeException) +{ +} + +} // namespace framework diff --git a/framework/source/layoutmanager/panelmanager.hxx b/framework/source/layoutmanager/panelmanager.hxx new file mode 100755 index 000000000000..fd3e892414fa --- /dev/null +++ b/framework/source/layoutmanager/panelmanager.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_ + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <threadhelp/threadhelpbase.hxx> +#include <macros/generic.hxx> +#include <macros/debug.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <general.h> +#include <stdtypes.h> +#include "panel.hxx" +#include <uielement/uielement.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/awt/XWindow.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/awt/XDockableWindowListener.hpp> +#include <com/sun/star/frame/XFrame.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <cppuhelper/weak.hxx> +#include <vcl/window.hxx> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework +{ + +class PanelManager : private ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses. +{ + public: + PanelManager( + const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rSMGR, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame ); + virtual ~PanelManager(); + + bool createPanels(); + ::com::sun::star::awt::Rectangle getPreferredSize() const; + void layoutPanels( const ::com::sun::star::awt::Rectangle newSize ); + + UIElement* findDockingWindow( const ::rtl::OUString& rResourceName ); + bool addDockingWindow( const ::rtl::OUString& rResourceName, const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& xUIElement ); + bool destroyDockingWindow( const ::rtl::OUString& rResourceName ); + + //--------------------------------------------------------------------------------------------------------- + // XDockableWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + private: + Panel* m_aPanels[PANEL_COUNT]; + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::frame::XFrame > m_xFrame; +}; + +} // namespace framework + +#endif // __FRAMEWORK_LAYOUTMANAGER_PANELMANAGER_HXX_ diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx new file mode 100755 index 000000000000..559e7707ac36 --- /dev/null +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -0,0 +1,4305 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.cxx,v $ + * $Revision: 1.72 $ + * + * 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 <toolbarlayoutmanager.hxx> +#include <helpers.hxx> +#include <services.h> +#include <classes/resource.hrc> +#include <classes/fwkresid.hxx> +#include <uiconfiguration/windowstateconfiguration.hxx> + +// interface includes +#include <com/sun/star/awt/PosSize.hpp> +#include <com/sun/star/ui/UIElementType.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/ui/XUIElementSettings.hpp> +#include <com/sun/star/ui/XUIFunctionListener.hpp> + +// other includes +#include <unotools/cmdoptions.hxx> +#include <toolkit/unohlp.hxx> +#include <toolkit/helper/convert.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <vcl/i18nhelp.hxx> +#include <vcl/dockingarea.hxx> +#include <boost/bind.hpp> + +using namespace ::com::sun::star; + +namespace framework +{ + +ToolbarLayoutManager::ToolbarLayoutManager( + const uno::Reference< lang::XMultiServiceFactory >& xSMGR, + const uno::Reference< ui::XUIElementFactory >& xUIElementFactory, + ILayoutNotifications* pParentLayouter ) + : ThreadHelpBase( &Application::GetSolarMutex() ), + m_xSMGR( xSMGR ), + m_xUIElementFactoryManager( xUIElementFactory ), + m_pParentLayouter( pParentLayouter ), + m_eDockOperation( DOCKOP_ON_COLROW ), + m_pAddonOptions( 0 ), + m_pGlobalSettings( 0 ), + m_bComponentAttached( false ), + m_bMustLayout( false ), + m_bLayoutDirty( false ), + m_bStoreWindowState( false ), + m_bGlobalSettings( false ), + m_bDockingInProgress( false ), + m_bVisible( true ), + m_bLayoutInProgress( false ), + m_bToolbarCreation( false ), + m_aFullAddonTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )), + m_aCustomTbxPrefix( RTL_CONSTASCII_USTRINGPARAM( "custom_" )), + m_aCustomizeCmd( RTL_CONSTASCII_USTRINGPARAM( "ConfigureDialog" )), + m_aToolbarTypeString( RTL_CONSTASCII_USTRINGPARAM( UIRESOURCETYPE_TOOLBAR )) +{ + // initialize rectangles to zero values + setZeroRectangle( m_aDockingAreaOffsets ); + setZeroRectangle( m_aDockingArea ); + + // create toolkit object + m_xToolkit = uno::Reference< awt::XToolkit >( m_xSMGR->createInstance( SERVICENAME_VCLTOOLKIT ), uno::UNO_QUERY ); +} + +ToolbarLayoutManager::~ToolbarLayoutManager() +{ +} + +//--------------------------------------------------------------------------------------------------------- +// XInterface +//--------------------------------------------------------------------------------------------------------- +void SAL_CALL ToolbarLayoutManager::acquire() throw() +{ + OWeakObject::acquire(); +} + +void SAL_CALL ToolbarLayoutManager::release() throw() +{ + OWeakObject::release(); +} + +uno::Any SAL_CALL ToolbarLayoutManager::queryInterface( const uno::Type & rType ) throw( uno::RuntimeException ) +{ + uno::Any a = ::cppu::queryInterface( rType, + SAL_STATIC_CAST( awt::XDockableWindowListener*, this ), + SAL_STATIC_CAST( ui::XUIConfigurationListener*, this ), + SAL_STATIC_CAST( awt::XWindowListener*, this )); + + if ( a.hasValue() ) + return a; + + return OWeakObject::queryInterface( rType ); +} + +void SAL_CALL ToolbarLayoutManager::disposing( const lang::EventObject& aEvent ) throw( uno::RuntimeException ) +{ + if ( aEvent.Source == m_xFrame ) + { + // Reset all internal references + reset(); + implts_destroyDockingAreaWindows(); + } +} + +awt::Rectangle ToolbarLayoutManager::getDockingArea() +{ + WriteGuard aWriteLock( m_aLock ); + Rectangle aNewDockingArea( m_aDockingArea ); + aWriteLock.unlock(); + + if ( isLayoutDirty() ) + aNewDockingArea = implts_calcDockingArea(); + + aWriteLock.lock(); + m_aDockingArea = aNewDockingArea; + aWriteLock.unlock(); + + return putRectangleValueToAWT(aNewDockingArea); +} + +void ToolbarLayoutManager::setDockingArea( const awt::Rectangle& rDockingArea ) +{ + WriteGuard aWriteLock( m_aLock ); + m_aDockingArea = putAWTToRectangle( rDockingArea ); + m_bLayoutDirty = true; + aWriteLock.unlock(); +} + +void ToolbarLayoutManager::implts_setDockingAreaWindowSizes( const awt::Rectangle& rBorderSpace ) +{ + ReadGuard aReadLock( m_aLock ); + Rectangle aDockOffsets = m_aDockingAreaOffsets; + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + uno::Reference< awt::XWindow > xTopDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xBottomDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + uno::Reference< awt::XWindow > xLeftDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockAreaWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + aReadLock.unlock(); + + uno::Reference< awt::XDevice > xDevice( xContainerWindow, uno::UNO_QUERY ); + + // Convert relativ size to output size. + awt::Rectangle aRectangle = xContainerWindow->getPosSize(); + awt::DeviceInfo aInfo = xDevice->getInfo(); + awt::Size aContainerClientSize = awt::Size( aRectangle.Width - aInfo.LeftInset - aInfo.RightInset , + aRectangle.Height - aInfo.TopInset - aInfo.BottomInset ); + long aStatusBarHeight = aDockOffsets.GetHeight(); + + sal_Int32 nLeftRightDockingAreaHeight( aContainerClientSize.Height ); + if ( rBorderSpace.Y >= 0 ) + { + // Top docking area window + xTopDockAreaWindow->setPosSize( 0, 0, aContainerClientSize.Width, rBorderSpace.Y, awt::PosSize::POSSIZE ); + xTopDockAreaWindow->setVisible( sal_True ); + nLeftRightDockingAreaHeight -= rBorderSpace.Y; + } + + if ( rBorderSpace.Height >= 0 ) + { + // Bottom docking area window + sal_Int32 nBottomPos = std::max( sal_Int32( aContainerClientSize.Height - rBorderSpace.Height - aStatusBarHeight ), sal_Int32( 0 )); + sal_Int32 nHeight = ( nBottomPos == 0 ) ? 0 : rBorderSpace.Height; + + xBottomDockAreaWindow->setPosSize( 0, nBottomPos, aContainerClientSize.Width, nHeight, awt::PosSize::POSSIZE ); + xBottomDockAreaWindow->setVisible( sal_True ); + nLeftRightDockingAreaHeight -= nHeight; + } + + nLeftRightDockingAreaHeight -= aStatusBarHeight; + if ( rBorderSpace.X >= 0 || nLeftRightDockingAreaHeight > 0 ) + { + // Left docking area window + // We also have to change our right docking area window if the top or bottom area has changed. They have a higher priority! + sal_Int32 nHeight = std::max( sal_Int32( 0 ), sal_Int32( nLeftRightDockingAreaHeight )); + + xLeftDockAreaWindow->setPosSize( 0, rBorderSpace.Y, rBorderSpace.X, nHeight, awt::PosSize::POSSIZE ); + xLeftDockAreaWindow->setVisible( sal_True ); + } + if ( rBorderSpace.Width >= 0 || nLeftRightDockingAreaHeight > 0 ) + { + // Right docking area window + // We also have to change our right docking area window if the top or bottom area has changed. They have a higher priority! + sal_Int32 nLeftPos = std::max( sal_Int32( 0 ), sal_Int32( aContainerClientSize.Width - rBorderSpace.Width )); + sal_Int32 nHeight = std::max( sal_Int32( 0 ), sal_Int32( nLeftRightDockingAreaHeight )); + sal_Int32 nWidth = ( nLeftPos == 0 ) ? 0 : rBorderSpace.Width; + + xRightDockAreaWindow->setPosSize( nLeftPos, rBorderSpace.Y, nWidth, nHeight, awt::PosSize::POSSIZE ); + xRightDockAreaWindow->setVisible( sal_True ); + } +} + +bool ToolbarLayoutManager::isLayoutDirty() +{ + return m_bLayoutDirty; +} + +void ToolbarLayoutManager::doLayout(const ::Size& aContainerSize) +{ + WriteGuard aWriteLock( m_aLock ); + bool bLayoutInProgress( m_bLayoutInProgress ); + m_bLayoutInProgress = true; + awt::Rectangle aDockingArea = putRectangleValueToAWT( m_aDockingArea ); + aWriteLock.unlock(); + + if ( bLayoutInProgress ) + return; + + // Retrieve row/column dependent data from all docked user-interface elements + for ( sal_Int32 i = 0; i < DOCKINGAREAS_COUNT; i++ ) + { + bool bReverse( isReverseOrderDockingArea( i )); + std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; + + implts_getDockingAreaElementInfos( (ui::DockingArea)i, aRowColumnsWindowData ); + + sal_Int32 nOffset( 0 ); + const sal_uInt32 nCount = aRowColumnsWindowData.size(); + for ( sal_uInt32 j = 0; j < nCount; ++j ) + { + sal_uInt32 nIndex = bReverse ? nCount-j-1 : j; + implts_calcWindowPosSizeOnSingleRowColumn( i, nOffset, aRowColumnsWindowData[nIndex], aContainerSize ); + nOffset += aRowColumnsWindowData[j].nStaticSize; + } + } + + implts_setDockingAreaWindowSizes( aDockingArea ); + + aWriteLock.lock(); + m_bLayoutDirty = false; + m_bLayoutInProgress = false; + aWriteLock.unlock(); +} + +bool ToolbarLayoutManager::implts_isParentWindowVisible() const +{ + ReadGuard aReadLock( m_aLock ); + bool bVisible( false ); + if ( m_xContainerWindow.is() ) + bVisible = m_xContainerWindow->isVisible(); + + return bVisible; +} + +Rectangle ToolbarLayoutManager::implts_calcDockingArea() +{ + ReadGuard aReadLock( m_aLock ); + UIElementVector aWindowVector( m_aUIElements ); + aReadLock.unlock(); + + Rectangle aBorderSpace; + sal_Int32 nCurrRowColumn( 0 ); + sal_Int32 nCurrPos( 0 ); + sal_Int32 nCurrDockingArea( ui::DockingArea_DOCKINGAREA_TOP ); + std::vector< sal_Int32 > aRowColumnSizes[DOCKINGAREAS_COUNT]; + UIElementVector::const_iterator pConstIter; + + // initialize rectangle with zero values! + aBorderSpace.setWidth(0); + aBorderSpace.setHeight(0); + + aRowColumnSizes[nCurrDockingArea].clear(); + aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + + for ( pConstIter = aWindowVector.begin(); pConstIter != aWindowVector.end(); pConstIter++ ) + { + uno::Reference< ui::XUIElement > xUIElement( pConstIter->m_xUIElement, uno::UNO_QUERY ); + if ( xUIElement.is() ) + { + uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xWindow.is() && xDockWindow.is() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && !xDockWindow->isFloating() && pConstIter->m_bVisible ) + { + awt::Rectangle aPosSize = xWindow->getPosSize(); + if ( pConstIter->m_aDockedData.m_nDockedArea != nCurrDockingArea ) + { + nCurrDockingArea = pConstIter->m_aDockedData.m_nDockedArea; + nCurrRowColumn = 0; + nCurrPos = 0; + aRowColumnSizes[nCurrDockingArea].clear(); + aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + } + + if ( pConstIter->m_aDockedData.m_nDockedArea == nCurrDockingArea ) + { + if ( isHorizontalDockingArea( pConstIter->m_aDockedData.m_nDockedArea )) + { + if ( pConstIter->m_aDockedData.m_aPos.Y() > nCurrPos ) + { + ++nCurrRowColumn; + nCurrPos = pConstIter->m_aDockedData.m_aPos.Y(); + aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + } + + if ( aPosSize.Height > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] ) + aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Height; + } + else + { + if ( pConstIter->m_aDockedData.m_aPos.X() > nCurrPos ) + { + ++nCurrRowColumn; + nCurrPos = pConstIter->m_aDockedData.m_aPos.X(); + aRowColumnSizes[nCurrDockingArea].push_back( 0 ); + } + + if ( aPosSize.Width > aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] ) + aRowColumnSizes[nCurrDockingArea][nCurrRowColumn] = aPosSize.Width; + } + } + } + } + } + } + + // Sum up max heights from every row/column + if ( !aWindowVector.empty() ) + { + for ( sal_Int32 i = 0; i <= ui::DockingArea_DOCKINGAREA_RIGHT; i++ ) + { + sal_Int32 nSize( 0 ); + const sal_uInt32 nCount = aRowColumnSizes[i].size(); + for ( sal_uInt32 j = 0; j < nCount; j++ ) + nSize += aRowColumnSizes[i][j]; + + if ( i == ui::DockingArea_DOCKINGAREA_TOP ) + aBorderSpace.Top() = nSize; + else if ( i == ui::DockingArea_DOCKINGAREA_BOTTOM ) + aBorderSpace.Bottom() = nSize; + else if ( i == ui::DockingArea_DOCKINGAREA_LEFT ) + aBorderSpace.Left() = nSize; + else + aBorderSpace.Right() = nSize; + } + } + + return aBorderSpace; +} + +void ToolbarLayoutManager::reset() +{ + WriteGuard aWriteLock( m_aLock ); + uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr ); + uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr ); + m_xModuleCfgMgr.clear(); + m_xDocCfgMgr.clear(); + m_bComponentAttached = false; + aWriteLock.unlock(); + + destroyToolbars(); + resetDockingArea(); +} + +void ToolbarLayoutManager::attach( + const uno::Reference< frame::XFrame >& xFrame, + const uno::Reference< ui::XUIConfigurationManager >& xModuleCfgMgr, + const uno::Reference< ui::XUIConfigurationManager >& xDocCfgMgr, + const uno::Reference< container::XNameAccess >& xPersistentWindowState ) +{ + // reset toolbar manager if we lose our current frame + if ( m_xFrame.is() && m_xFrame != xFrame ) + reset(); + + WriteGuard aWriteLock( m_aLock ); + m_xFrame = xFrame; + m_xModuleCfgMgr = xModuleCfgMgr; + m_xDocCfgMgr = xDocCfgMgr; + m_xPersistentWindowState = xPersistentWindowState; + m_bComponentAttached = true; +} + +void ToolbarLayoutManager::createStaticToolbars() +{ + resetDockingArea(); + implts_createCustomToolBars(); + implts_createAddonsToolBars(); + implts_createNonContextSensitiveToolBars(); + implts_sortUIElements(); +} + +bool ToolbarLayoutManager::requestToolbar( const ::rtl::OUString& rResourceURL ) +{ + bool bNotify( false ); + bool bMustCallCreate( false ); + uno::Reference< ui::XUIElement > xUIElement; + + UIElement aRequestedToolbar = impl_findToolbar( rResourceURL ); + if ( aRequestedToolbar.m_aName != rResourceURL ) + { + bMustCallCreate = true; + aRequestedToolbar.m_aName = rResourceURL; + aRequestedToolbar.m_aType = m_aToolbarTypeString; + aRequestedToolbar.m_xUIElement = xUIElement; + implts_readWindowStateData( rResourceURL, aRequestedToolbar ); + } + + xUIElement = aRequestedToolbar.m_xUIElement; + if ( !xUIElement.is() ) + bMustCallCreate = true; + + bool bCreateOrShowToolbar( aRequestedToolbar.m_bVisible & !aRequestedToolbar.m_bMasterHide ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY ); + if ( xContainerWindow.is() && aRequestedToolbar.m_bFloating ) + bCreateOrShowToolbar &= bool( xContainerWindow->isActive()); + + if ( bCreateOrShowToolbar ) + bNotify = ( bMustCallCreate ) ? createToolbar( rResourceURL ) : showToolbar( rResourceURL ); + + return bNotify; +} + +bool ToolbarLayoutManager::createToolbar( const ::rtl::OUString& rResourceURL ) +{ + bool bNotify( false ); + uno::Reference< ui::XUIElement > xUITempElement; + + implts_createToolBar( rResourceURL, bNotify, xUITempElement ); + return bNotify; +} + +bool ToolbarLayoutManager::destroyToolbar( const ::rtl::OUString& rResourceURL ) +{ + const rtl::OUString aAddonTbResourceName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/addon_" )); + + UIElementVector::iterator pIter; + uno::Reference< lang::XComponent > xComponent; + + bool bNotify( false ); + bool bMustBeSorted( false ); + bool bMustLayouted( false ); + bool bMustBeDestroyed( rResourceURL.indexOf( aAddonTbResourceName ) != 0 ); + + WriteGuard aWriteLock( m_aLock ); + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_aName == rResourceURL ) + { + xComponent.set( pIter->m_xUIElement, uno::UNO_QUERY ); + if ( bMustBeDestroyed ) + pIter->m_xUIElement.clear(); + else + pIter->m_bVisible = false; + break; + } + } + aWriteLock.unlock(); + + uno::Reference< ui::XUIElement > xUIElement( xComponent, uno::UNO_QUERY ); + if ( xUIElement.is() ) + { + uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + + if ( bMustBeDestroyed ) + { + try + { + if ( xWindow.is() ) + xWindow->removeWindowListener( uno::Reference< awt::XWindowListener >( + static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + } + catch( uno::Exception& ) {} + + try + { + if ( xDockWindow.is() ) + xDockWindow->removeDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( + static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + } + catch ( uno::Exception& ) {} + } + else + { + if ( xWindow.is() ) + xWindow->setVisible( sal_False ); + bNotify = true; + } + + if ( !xDockWindow->isFloating() ) + bMustLayouted = true; + bMustBeSorted = true; + } + + if ( bMustBeDestroyed ) + { + if ( xComponent.is() ) + xComponent->dispose(); + bNotify = true; + } + + if ( bMustLayouted ) + implts_setLayoutDirty(); + + if ( bMustBeSorted ) + implts_sortUIElements(); + + return bNotify; +} + +void ToolbarLayoutManager::destroyToolbars() +{ + UIElementVector aUIElementVector; + implts_getUIElementVectorCopy( aUIElementVector ); + + WriteGuard aWriteLock( m_aLock ); + m_aUIElements.clear(); + m_bLayoutDirty = true; + aWriteLock.unlock(); + + UIElementVector::iterator pIter; + for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) + { + uno::Reference< lang::XComponent > xComponent( pIter->m_xUIElement, uno::UNO_QUERY ); + if ( xComponent.is() ) + xComponent->dispose(); + } +} + +bool ToolbarLayoutManager::showToolbar( const ::rtl::OUString& rResourceURL ) +{ + UIElement aUIElement = implts_findToolbar( rResourceURL ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = getWindowFromXUIElement( aUIElement.m_xUIElement ); + if ( pWindow ) + { + if ( !aUIElement.m_bFloating ) + implts_setLayoutDirty(); + else + pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + + aUIElement.m_bVisible = true; + implts_writeWindowStateData( aUIElement ); + implts_setToolbar( aUIElement ); + return true; + } + + return false; +} + +bool ToolbarLayoutManager::hideToolbar( const ::rtl::OUString& rResourceURL ) +{ + UIElement aUIElement = implts_findToolbar( rResourceURL ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = getWindowFromXUIElement( aUIElement.m_xUIElement ); + if ( pWindow ) + { + pWindow->Show( FALSE ); + if ( !aUIElement.m_bFloating ) + implts_setLayoutDirty(); + + aUIElement.m_bVisible = false; + implts_writeWindowStateData( aUIElement ); + implts_setToolbar( aUIElement ); + return true; + } + + return false; +} + +void ToolbarLayoutManager::refreshToolbarsVisibility( bool bAutomaticToolbars ) +{ + UIElementVector aUIElementVector; + + ReadGuard aReadLock( m_aLock ); + bool bVisible( m_bVisible ); + aReadLock.unlock(); + + if ( !bVisible || !bAutomaticToolbars ) + return; + + implts_getUIElementVectorCopy( aUIElementVector ); + + UIElement aUIElement; + vos::OGuard aGuard( Application::GetSolarMutex() ); + UIElementVector::iterator pIter; + for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) + { + if ( implts_readWindowStateData( pIter->m_aName, aUIElement ) && + ( pIter->m_bVisible != aUIElement.m_bVisible ) && !pIter->m_bMasterHide ) + { + WriteGuard aWriteLock( m_aLock ); + UIElement& rUIElement = impl_findToolbar( pIter->m_aName ); + if ( rUIElement.m_aName == pIter->m_aName ) + { + rUIElement.m_bVisible = aUIElement.m_bVisible; + implts_setLayoutDirty(); + } + } + } +} + +void ToolbarLayoutManager::setFloatingToolbarsVisibility( bool bVisible ) +{ + UIElementVector aUIElementVector; + implts_getUIElementVectorCopy( aUIElementVector ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + UIElementVector::iterator pIter; + for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) + { + Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement ); + if ( pWindow && pIter->m_bFloating ) + { + if ( bVisible ) + { + if ( pIter->m_bVisible && !pIter->m_bMasterHide ) + pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + } + else + pWindow->Show( FALSE ); + } + } +} + +void ToolbarLayoutManager::setVisible( bool bVisible ) +{ + UIElementVector aUIElementVector; + implts_getUIElementVectorCopy( aUIElementVector ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + UIElementVector::iterator pIter; + for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) + { + pIter->m_bMasterHide = !bVisible; + Window* pWindow = getWindowFromXUIElement( pIter->m_xUIElement ); + if ( pWindow ) + { + bool bSetVisible( pIter->m_bVisible & bVisible ); + if ( !bSetVisible ) + pWindow->Hide(); + else + { + if ( pIter->m_bFloating ) + pWindow->Show(true, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + else + implts_setLayoutDirty(); + } + } + } + + if ( !bVisible ) + resetDockingArea(); +} + +bool ToolbarLayoutManager::dockToolbar( const ::rtl::OUString& rResourceURL, ui::DockingArea eDockingArea, const awt::Point& aPos ) +{ + UIElement aUIElement = implts_findToolbar( rResourceURL ); + + if ( aUIElement.m_xUIElement.is() ) + { + try + { + uno::Reference< awt::XWindow > xWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xDockWindow.is() ) + { + if ( eDockingArea != ui::DockingArea_DOCKINGAREA_DEFAULT ) + aUIElement.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); + + if ( !isDefaultPos( aPos )) + aUIElement.m_aDockedData.m_aPos = ::Point( aPos.X, aPos.Y ); + + if ( !xDockWindow->isFloating() ) + { + Window* pWindow( 0 ); + ToolBox* pToolBox( 0 ); + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + { + pToolBox = (ToolBox *)pWindow; + + // We have to set the alignment of the toolbox. It's possible that the toolbox is moved from a + // horizontal to a vertical docking area! + pToolBox->SetAlign( ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea )); + } + } + + if ( hasDefaultPosValue( aUIElement.m_aDockedData.m_aPos )) + { + // Docking on its default position without a preset position - + // we have to find a good place for it. + ::Size aSize; + + vos::OGuard aGuard( Application::GetSolarMutex() ); + { + if ( pToolBox ) + aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIElement.m_aDockedData.m_nDockedArea ) ); + else + aSize = pWindow->GetSizePixel(); + } + + ::Point aPixelPos; + ::Point aDockPos; + implts_findNextDockingPos((ui::DockingArea)aUIElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos ); + aUIElement.m_aDockedData.m_aPos = aDockPos; + } + } + + implts_setToolbar( aUIElement ); + + if ( xDockWindow->isFloating() ) + { + // ATTENTION: This will call toggleFloatingMode() via notifications which + // sets the floating member of the UIElement correctly! + xDockWindow->setFloatingMode( sal_False ); + } + else + { + implts_writeWindowStateData( aUIElement ); + implts_sortUIElements(); + + if ( aUIElement.m_bVisible ) + implts_setLayoutDirty(); + } + return true; + } + } + catch ( lang::DisposedException& ) {} + } + + return false; +} + +bool ToolbarLayoutManager::dockAllToolbars() +{ + std::vector< ::rtl::OUString > aToolBarNameVector; + + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + + ReadGuard aReadLock( m_aLock ); + UIElementVector::iterator pIter; + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_aType.equalsAscii( "toolbar" ) && pIter->m_xUIElement.is() && + pIter->m_bFloating && pIter->m_bVisible ) + aToolBarNameVector.push_back( pIter->m_aName ); + } + aReadLock.unlock(); + + bool bResult(true); + const sal_uInt32 nCount = aToolBarNameVector.size(); + for ( sal_uInt32 i = 0; i < nCount; ++i ) + { + awt::Point aPoint; + aPoint.X = aPoint.Y = SAL_MAX_INT32; + bResult &= dockToolbar( aToolBarNameVector[i], ui::DockingArea_DOCKINGAREA_DEFAULT, aPoint ); + } + + return bResult; +} + +long ToolbarLayoutManager::childWindowEvent( VclSimpleEvent* pEvent ) +{ + // To enable toolbar controllers to change their image when a sub-toolbar function + // is activated, we need this mechanism. We have NO connection between these toolbars + // anymore! + if ( pEvent && pEvent->ISA( VclWindowEvent )) + { + if ( pEvent->GetId() == VCLEVENT_TOOLBOX_SELECT ) + { + ::rtl::OUString aToolbarName; + ::rtl::OUString aCommand; + ToolBox* pToolBox = getToolboxPtr( ((VclWindowEvent*)pEvent)->GetWindow() ); + + if ( pToolBox ) + { + aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox ); + USHORT nId = pToolBox->GetCurItemId(); + if ( nId > 0 ) + aCommand = pToolBox->GetItemCommand( nId ); + } + + if (( aToolbarName.getLength() > 0 ) && ( aCommand.getLength() > 0 )) + { + ReadGuard aReadLock( m_aLock ); + ::std::vector< uno::Reference< ui::XUIFunctionListener > > aListenerArray; + UIElementVector::iterator pIter; + + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_xUIElement.is() ) + { + uno::Reference< ui::XUIFunctionListener > xListener( pIter->m_xUIElement, uno::UNO_QUERY ); + if ( xListener.is() ) + aListenerArray.push_back( xListener ); + } + } + aReadLock.unlock(); + + const sal_uInt32 nCount = aListenerArray.size(); + for ( sal_uInt32 i = 0; i < nCount; ++i ) + { + try { aListenerArray[i]->functionExecute( aToolbarName, aCommand ); } + catch ( uno::RuntimeException& ) { throw; } + catch ( uno::Exception& ) {} + } + } + } + else if ( pEvent->GetId() == VCLEVENT_TOOLBOX_FORMATCHANGED ) + { + if ( !implts_isToolbarCreationActive() ) + { + ToolBox* pToolBox = getToolboxPtr( ((VclWindowEvent*)pEvent)->GetWindow() ); + if ( pToolBox ) + { + ::rtl::OUString aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox ); + if ( aToolbarName.getLength() > 0 ) + { + ::rtl::OUStringBuffer aBuf(100); + aBuf.appendAscii( "private:resource/toolbar/" ); + aBuf.append( aToolbarName ); + + UIElement aToolbar = implts_findToolbar( aBuf.makeStringAndClear() ); + if ( aToolbar.m_xUIElement.is() && !aToolbar.m_bFloating ) + { + implts_setLayoutDirty(); + m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED ); + } + } + } + } + } + } + + return 1; +} + +void ToolbarLayoutManager::resetDockingArea() +{ + ReadGuard aReadLock( m_aLock ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + aReadLock.unlock(); + + if ( xTopDockingWindow.is() ) + xTopDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE ); + if ( xLeftDockingWindow.is() ) + xLeftDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE ); + if ( xRightDockingWindow.is() ) + xRightDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE ); + if ( xBottomDockingWindow.is() ) + xBottomDockingWindow->setPosSize( 0, 0, 0, 0, awt::PosSize::POSSIZE ); +} + +void ToolbarLayoutManager::setParentWindow( + const uno::Reference< awt::XWindowPeer >& xParentWindow ) +{ + static const char DOCKINGAREASTRING[] = "dockingarea"; + + uno::Reference< awt::XWindow > xTopDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xLeftDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xRightDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xBottomDockWindow = uno::Reference< awt::XWindow >( createToolkitWindow( m_xSMGR, xParentWindow, DOCKINGAREASTRING ), uno::UNO_QUERY ); + + WriteGuard aWriteLock( m_aLock ); + m_xContainerWindow = uno::Reference< awt::XWindow2 >( xParentWindow, uno::UNO_QUERY ); + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] = xTopDockWindow; + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] = xLeftDockWindow; + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] = xRightDockWindow; + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] = xBottomDockWindow; + aWriteLock.unlock(); + + if ( xParentWindow.is() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + ::DockingAreaWindow* pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xTopDockWindow ) ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_TOP ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xBottomDockWindow ) ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_BOTTOM ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xLeftDockWindow ) ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_LEFT ); + pWindow = dynamic_cast< ::DockingAreaWindow* >(VCLUnoHelper::GetWindow( xRightDockWindow ) ); + if( pWindow ) pWindow->SetAlign( WINDOWALIGN_RIGHT ); + implts_reparentToolbars(); + } + else + { + destroyToolbars(); + resetDockingArea(); + } +} + +void ToolbarLayoutManager::setDockingAreaOffsets( const ::Rectangle aOffsets ) +{ + WriteGuard aWriteLock( m_aLock ); + m_aDockingAreaOffsets = aOffsets; + m_bLayoutDirty = true; +} + +rtl::OUString ToolbarLayoutManager::implts_generateGenericAddonToolbarTitle( sal_Int32 nNumber ) const +{ + String aAddonGenericTitle; + + aAddonGenericTitle = String( FwkResId( STR_TOOLBAR_TITLE_ADDON )); + const vcl::I18nHelper& rI18nHelper = Application::GetSettings().GetUILocaleI18nHelper(); + + String aNumStr = rI18nHelper.GetNum( nNumber, 0, FALSE, FALSE ); + aAddonGenericTitle.SearchAndReplaceAscii( "%num%", aNumStr ); + + return rtl::OUString( aAddonGenericTitle ); +} + +void ToolbarLayoutManager::implts_createAddonsToolBars() +{ + WriteGuard aWriteLock( m_aLock ); + if ( !m_pAddonOptions ) + m_pAddonOptions = new AddonsOptions; + + uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + aWriteLock.unlock(); + + uno::Reference< frame::XModel > xModel( impl_getModelFromFrame( xFrame )); + if ( implts_isPreviewModel( xModel )) + return; // no addon toolbars for preview frame! + + UIElementVector aUIElementVector; + uno::Sequence< uno::Sequence< beans::PropertyValue > > aAddonToolBarData; + uno::Reference< ui::XUIElement > xUIElement; + + sal_uInt32 nCount = m_pAddonOptions->GetAddonsToolBarCount(); + ::rtl::OUString aAddonsToolBarStaticName( m_aFullAddonTbxPrefix ); + ::rtl::OUString aElementType( RTL_CONSTASCII_USTRINGPARAM( "toolbar" )); + + uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); + aPropSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropSeq[0].Value <<= xFrame; + aPropSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationData" )); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + ::rtl::OUString aAddonToolBarName( aAddonsToolBarStaticName + m_pAddonOptions->GetAddonsToolbarResourceName(i) ); + aAddonToolBarData = m_pAddonOptions->GetAddonsToolBarPart( i ); + aPropSeq[1].Value <<= aAddonToolBarData; + + UIElement aElement = implts_findToolbar( aAddonToolBarName ); + + // #i79828 + // It's now possible that we are called more than once. Be sure to not create + // add-on toolbars more than once! + if ( aElement.m_xUIElement.is() ) + continue; + + try + { + xUIElement = xUIElementFactory->createUIElement( aAddonToolBarName, aPropSeq ); + if ( xUIElement.is() ) + { + uno::Reference< awt::XDockableWindow > xDockWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xDockWindow.is() ) + { + try + { + xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xDockWindow->enableDocking( sal_True ); + uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY ); + if ( xWindow.is() ) + xWindow->addWindowListener( uno::Reference< awt::XWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + } + catch ( uno::Exception& ) {} + } + + ::rtl::OUString aGenericAddonTitle = implts_generateGenericAddonToolbarTitle( i+1 ); + + if ( aElement.m_aName.getLength() > 0 ) + { + // Reuse a local entry so we are able to use the latest + // UI changes for this document. + implts_setElementData( aElement, xDockWindow ); + aElement.m_xUIElement = xUIElement; + if ( aElement.m_aUIName.getLength() == 0 ) + { + aElement.m_aUIName = aGenericAddonTitle; + implts_writeWindowStateData( aElement ); + } + } + else + { + // Create new UI element and try to read its state data + UIElement aNewToolbar( aAddonToolBarName, aElementType, xUIElement ); + aNewToolbar.m_bFloating = true; + implts_readWindowStateData( aAddonToolBarName, aNewToolbar ); + implts_setElementData( aNewToolbar, xDockWindow ); + if ( aNewToolbar.m_aUIName.getLength() == 0 ) + { + aNewToolbar.m_aUIName = aGenericAddonTitle; + implts_writeWindowStateData( aNewToolbar ); + } + implts_insertToolbar( aNewToolbar ); + } + + uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY ); + if ( xWindow.is() ) + { + // Set generic title for add-on toolbar + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow->GetText().Len() == 0 ) + pWindow->SetText( aGenericAddonTitle ); + if ( pWindow->GetType() == WINDOW_TOOLBOX ) + { + ToolBox* pToolbar = (ToolBox *)pWindow; + pToolbar->SetMenuType(); + } + } + } + } + catch ( container::NoSuchElementException& ) {} + catch ( lang::IllegalArgumentException& ) {} + } +} + +void ToolbarLayoutManager::implts_createCustomToolBars() +{ + ReadGuard aReadLock( m_aLock ); + if ( !m_bComponentAttached ) + return; + + uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + uno::Reference< frame::XModel > xModel; + uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr, uno::UNO_QUERY ); + uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr, uno::UNO_QUERY ); + aReadLock.unlock(); + + if ( xFrame.is() ) + { + xModel = impl_getModelFromFrame( xFrame ); + if ( implts_isPreviewModel( xModel )) + return; // no custom toolbars for preview frame! + + uno::Sequence< uno::Sequence< beans::PropertyValue > > aTbxSeq; + if ( xDocCfgMgr.is() ) + { + aTbxSeq = xDocCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR ); + implts_createCustomToolBars( aTbxSeq ); // first create all document based toolbars + } + if ( xModuleCfgMgr.is() ) + { + aTbxSeq = xModuleCfgMgr->getUIElementsInfo( ui::UIElementType::TOOLBAR ); + implts_createCustomToolBars( aTbxSeq ); // second create module based toolbars + } + } +} + +void ToolbarLayoutManager::implts_createNonContextSensitiveToolBars() +{ + ReadGuard aReadLock( m_aLock ); + + if ( !m_xPersistentWindowState.is() || !m_xFrame.is() || !m_bComponentAttached ) + return; + + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); + uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); + aReadLock.unlock(); + + if ( implts_isPreviewModel( impl_getModelFromFrame( xFrame ))) + return; + + std::vector< rtl::OUString > aMakeVisibleToolbars; + + try + { + uno::Sequence< ::rtl::OUString > aToolbarNames = xPersistentWindowState->getElementNames(); + + if ( aToolbarNames.getLength() > 0 ) + { + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + ::rtl::OUString aName; + + uno::Reference< ui::XUIElement > xUIElement; + aMakeVisibleToolbars.reserve(aToolbarNames.getLength()); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + WriteGuard aWriteLock( m_aLock ); + + const rtl::OUString* pTbNames = aToolbarNames.getConstArray(); + for ( sal_Int32 i = 0; i < aToolbarNames.getLength(); i++ ) + { + aName = pTbNames[i]; + parseResourceURL( aName, aElementType, aElementName ); + + // Check that we only create: + // - Toolbars (the statusbar is also member of the persistent window state) + // - Not custom toolbars, there are created with their own method (implts_createCustomToolbars) + if ( aElementType.equalsIgnoreAsciiCaseAscii( "toolbar" ) && aElementName.indexOf( m_aCustomTbxPrefix ) == -1 ) + { + UIElement aNewToolbar = implts_findToolbar( aName ); + bool bFound = ( aNewToolbar.m_aName == aName ); + if ( !bFound ) + implts_readWindowStateData( aName, aNewToolbar ); + + if ( aNewToolbar.m_bVisible && !aNewToolbar.m_bContextSensitive ) + { + if ( !bFound ) + implts_insertToolbar( aNewToolbar ); + aMakeVisibleToolbars.push_back( aName ); + } + } + } + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + } + } + catch ( uno::RuntimeException& ) { throw; } + catch ( uno::Exception& ) {} + + if ( !aMakeVisibleToolbars.empty() ) + ::std::for_each( aMakeVisibleToolbars.begin(), aMakeVisibleToolbars.end(),::boost::bind( &ToolbarLayoutManager::requestToolbar, this,_1 )); +} + +void ToolbarLayoutManager::implts_createCustomToolBars( const uno::Sequence< uno::Sequence< beans::PropertyValue > >& aTbxSeqSeq ) +{ + const uno::Sequence< beans::PropertyValue >* pTbxSeq = aTbxSeqSeq.getConstArray(); + for ( sal_Int32 i = 0; i < aTbxSeqSeq.getLength(); i++ ) + { + const uno::Sequence< beans::PropertyValue >& rTbxSeq = pTbxSeq[i]; + ::rtl::OUString aTbxResName; + ::rtl::OUString aTbxTitle; + for ( sal_Int32 j = 0; j < rTbxSeq.getLength(); j++ ) + { + if ( rTbxSeq[j].Name.equalsAscii( "ResourceURL" )) + rTbxSeq[j].Value >>= aTbxResName; + else if ( rTbxSeq[j].Name.equalsAscii( "UIName" )) + rTbxSeq[j].Value >>= aTbxTitle; + } + + // Only create custom toolbars. Their name have to start with "custom_"! + if ( aTbxResName.getLength() > 0 && aTbxResName.indexOf( m_aCustomTbxPrefix ) != -1 ) + implts_createCustomToolBar( aTbxResName, aTbxTitle ); + } +} + +void ToolbarLayoutManager::implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle ) +{ + if ( aTbxResName.getLength() > 0 ) + { + bool bNotify( false ); + uno::Reference< ui::XUIElement > xUIElement; + implts_createToolBar( aTbxResName, bNotify, xUIElement ); + + if ( aTitle && xUIElement.is() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + + Window* pWindow = getWindowFromXUIElement( xUIElement ); + if ( pWindow ) + pWindow->SetText( aTitle ); + } + } +} + +void ToolbarLayoutManager::implts_reparentToolbars() +{ + WriteGuard aWriteLock( m_aLock ); + UIElementVector aUIElementVector = m_aUIElements; + Window* pContainerWindow = VCLUnoHelper::GetWindow( m_xContainerWindow ); + Window* pTopDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + Window* pBottomDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + Window* pLeftDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + Window* pRightDockWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + aWriteLock.unlock(); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pContainerWindow ) + { + UIElementVector::iterator pIter; + for ( pIter = aUIElementVector.begin(); pIter != aUIElementVector.end(); pIter++ ) + { + uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement ); + if ( xUIElement.is() ) + { + uno::Reference< awt::XWindow > xWindow; + try + { + // We have to retreive the window reference with try/catch as it is + // possible that all elements have been disposed! + xWindow = uno::Reference< awt::XWindow >( xUIElement->getRealInterface(), uno::UNO_QUERY ); + } + catch ( uno::RuntimeException& ) { throw; } + catch ( uno::Exception& ) {} + + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) + { + // Reparent our child windows acording to their current state. + if ( pIter->m_bFloating ) + pWindow->SetParent( pContainerWindow ); + else + { + if ( pIter->m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) + pWindow->SetParent( pTopDockWindow ); + else if ( pIter->m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) + pWindow->SetParent( pBottomDockWindow ); + else if ( pIter->m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_LEFT ) + pWindow->SetParent( pLeftDockWindow ); + else + pWindow->SetParent( pRightDockWindow ); + } + } + } + } + } +} + +void ToolbarLayoutManager::implts_setToolbarCreation( bool bStart ) +{ + WriteGuard aWriteLock( m_aLock ); + m_bToolbarCreation = bStart; +} + +bool ToolbarLayoutManager::implts_isToolbarCreationActive() +{ + ReadGuard aReadLock( m_aLock ); + return m_bToolbarCreation; +} + +void ToolbarLayoutManager::implts_createToolBar( const ::rtl::OUString& aName, bool& bNotify, uno::Reference< ui::XUIElement >& rUIElement ) +{ + ReadGuard aReadLock( m_aLock ); + uno::Reference< frame::XFrame > xFrame( m_xFrame ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + aReadLock.unlock(); + + bNotify = false; + + if ( !xFrame.is() || !xContainerWindow.is() ) + return; + + UIElement aToolbarElement = implts_findToolbar( aName ); + if ( !aToolbarElement.m_xUIElement.is() ) + { + uno::Reference< ui::XUIElement > xUIElement = implts_createElement( aName ); + + bool bVisible( false ); + bool bFloating( false ); + if ( xUIElement.is() ) + { + rUIElement = xUIElement; + + uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xDockWindow.is() && xWindow.is() ) + { + try + { + xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( + static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xWindow->addWindowListener( uno::Reference< awt::XWindowListener >( + static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xDockWindow->enableDocking( sal_True ); + } + catch ( uno::Exception& ) {} + } + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + WriteGuard aWriteLock( m_aLock ); + + UIElement& rElement = impl_findToolbar( aName ); + if ( rElement.m_aName.getLength() > 0 ) + { + // Reuse a local entry so we are able to use the latest + // UI changes for this document. + implts_setElementData( rElement, xDockWindow ); + rElement.m_xUIElement = xUIElement; + bVisible = rElement.m_bVisible; + bFloating = rElement.m_bFloating; + } + else + { + // Create new UI element and try to read its state data + UIElement aNewToolbar( aName, m_aToolbarTypeString, xUIElement ); + implts_readWindowStateData( aName, aNewToolbar ); + implts_setElementData( aNewToolbar, xDockWindow ); + implts_insertToolbar( aNewToolbar ); + bVisible = aNewToolbar.m_bVisible; + bFloating = rElement.m_bFloating; + } + aWriteLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + // set toolbar menu style according to customize command state + SvtCommandOptions aCmdOptions; + + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + { + ToolBox* pToolbar = (ToolBox *)pWindow; + USHORT nMenuType = pToolbar->GetMenuType(); + if ( aCmdOptions.Lookup( SvtCommandOptions::CMDOPTION_DISABLED, m_aCustomizeCmd )) + pToolbar->SetMenuType( nMenuType & ~TOOLBOX_MENUTYPE_CUSTOMIZE ); + else + pToolbar->SetMenuType( nMenuType | TOOLBOX_MENUTYPE_CUSTOMIZE ); + } + bNotify = true; + + implts_sortUIElements(); + + if ( bVisible && !bFloating ) + implts_setLayoutDirty(); + } + } +} + +uno::Reference< ui::XUIElement > ToolbarLayoutManager::implts_createElement( const ::rtl::OUString& aName ) +{ + uno::Reference< ui::XUIElement > xUIElement; + + ReadGuard aReadLock( m_aLock ); + uno::Sequence< beans::PropertyValue > aPropSeq( 2 ); + aPropSeq[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Frame" )); + aPropSeq[0].Value <<= m_xFrame; + aPropSeq[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" )); + aPropSeq[1].Value <<= true; + uno::Reference< ui::XUIElementFactory > xUIElementFactory( m_xUIElementFactoryManager ); + aReadLock.unlock(); + + implts_setToolbarCreation( true ); + try + { + if ( xUIElementFactory.is() ) + xUIElement = xUIElementFactory->createUIElement( aName, aPropSeq ); + } + catch ( container::NoSuchElementException& ) {} + catch ( lang::IllegalArgumentException& ) {} + implts_setToolbarCreation( false ); + + return xUIElement; +} + +void ToolbarLayoutManager::implts_setElementData( UIElement& rElement, const uno::Reference< awt::XDockableWindow >& rDockWindow ) +{ + ReadGuard aReadLock( m_aLock ); + bool bShowElement( rElement.m_bVisible && !rElement.m_bMasterHide && implts_isParentWindowVisible() ); + aReadLock.unlock(); + + uno::Reference< awt::XDockableWindow > xDockWindow( rDockWindow ); + uno::Reference< awt::XWindow2 > xWindow( xDockWindow, uno::UNO_QUERY ); + + Window* pWindow( 0 ); + ToolBox* pToolBox( 0 ); + + if ( xDockWindow.is() && xWindow.is() ) + { + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow ) + { + String aText = pWindow->GetText(); + if ( aText.Len() == 0 ) + pWindow->SetText( rElement.m_aUIName ); + if ( rElement.m_bNoClose ) + pWindow->SetStyle( pWindow->GetStyle() & ~WB_CLOSEABLE ); + if ( pWindow->GetType() == WINDOW_TOOLBOX ) + pToolBox = (ToolBox *)pWindow; + } + if ( pToolBox ) + { + if (( rElement.m_nStyle < 0 ) || ( rElement.m_nStyle > BUTTON_SYMBOLTEXT )) + rElement.m_nStyle = BUTTON_SYMBOL; + pToolBox->SetButtonType( (ButtonType)rElement.m_nStyle ); + if ( rElement.m_bNoClose ) + pToolBox->SetFloatStyle( pToolBox->GetFloatStyle() & ~WB_CLOSEABLE ); + } + } + + if ( rElement.m_bFloating ) + { + if ( pWindow ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + String aText = pWindow->GetText(); + if ( aText.Len() == 0 ) + pWindow->SetText( rElement.m_aUIName ); + } + + ::Point aPos( rElement.m_aFloatingData.m_aPos.X(), + rElement.m_aFloatingData.m_aPos.Y() ); + bool bWriteData( false ); + bool bUndefPos = hasDefaultPosValue( rElement.m_aFloatingData.m_aPos ); + bool bSetSize = ( rElement.m_aFloatingData.m_aSize.Width() != 0 && + rElement.m_aFloatingData.m_aSize.Height() != 0 ); + xDockWindow->setFloatingMode( sal_True ); + if ( bUndefPos ) + { + aPos = implts_findNextCascadeFloatingPos(); + rElement.m_aFloatingData.m_aPos = aPos; // set new cascaded position + bWriteData = true; + } + + if( bSetSize ) + xWindow->setOutputSize( AWTSize( rElement.m_aFloatingData.m_aSize ) ); + else + { + if( pToolBox ) + { + // set an optimal initial floating size + vos::OGuard aGuard( Application::GetSolarMutex() ); + ::Size aSize( pToolBox->CalcFloatingWindowSizePixel() ); + pToolBox->SetOutputSizePixel( aSize ); + } + } + + // #i60882# IMPORTANT: Set position after size as it is + // possible that we position some part of the toolbar + // outside of the desktop. A default constructed toolbar + // always has one line. Now VCL automatically + // position the toolbar back into the desktop. Therefore + // we resize the toolbar with the new (wrong) position. + // To fix this problem we have to set the size BEFORE the + // position. + xWindow->setPosSize( aPos.X(), aPos.Y(), 0, 0, awt::PosSize::POS ); + + if ( bWriteData ) + implts_writeWindowStateData( rElement ); + if ( bShowElement && pWindow ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pWindow->Show( sal_True, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + } + } + else + { + bool bSetSize( false ); + ::Point aDockPos; + ::Point aPixelPos; + ::Size aSize; + + if ( pToolBox ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pToolBox->SetAlign( ImplConvertAlignment(rElement.m_aDockedData.m_nDockedArea ) ); + pToolBox->SetLineCount( 1 ); + xDockWindow->setFloatingMode( sal_False ); + if ( rElement.m_aDockedData.m_bLocked ) + xDockWindow->lock(); + aSize = pToolBox->CalcWindowSizePixel(); + bSetSize = true; + + if ( isDefaultPos( rElement.m_aDockedData.m_aPos )) + { + implts_findNextDockingPos( (ui::DockingArea)rElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos ); + rElement.m_aDockedData.m_aPos = aDockPos; + } + } + + xWindow->setPosSize( aPixelPos.X(), aPixelPos.Y(), 0, 0, awt::PosSize::POS ); + if( bSetSize ) + xWindow->setOutputSize( AWTSize( aSize) ); + + if ( pWindow ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( !bShowElement ) + pWindow->Hide(); + } + } + } +} + +void ToolbarLayoutManager::implts_destroyDockingAreaWindows() +{ + WriteGuard aWriteLock( m_aLock ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP].clear(); + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT].clear(); + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT].clear(); + m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM].clear(); + aWriteLock.unlock(); + + // destroy windows + xTopDockingWindow->dispose(); + xLeftDockingWindow->dispose(); + xRightDockingWindow->dispose(); + xBottomDockingWindow->dispose(); +} + +//--------------------------------------------------------------------------------------------------------- +// persistence methods +//--------------------------------------------------------------------------------------------------------- + +sal_Bool ToolbarLayoutManager::implts_readWindowStateData( const rtl::OUString& aName, UIElement& rElementData ) +{ + WriteGuard aWriteLock( m_aLock ); + uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); + bool bGetSettingsState( false ); + aWriteLock.unlock(); + + if ( xPersistentWindowState.is() ) + { + aWriteLock.lock(); + bool bGlobalSettings( m_bGlobalSettings ); + GlobalSettings* pGlobalSettings( 0 ); + if ( m_pGlobalSettings == 0 ) + { + m_pGlobalSettings = new GlobalSettings( m_xSMGR ); + bGetSettingsState = true; + } + pGlobalSettings = m_pGlobalSettings; + aWriteLock.unlock(); + + try + { + uno::Sequence< beans::PropertyValue > aWindowState; + if ( xPersistentWindowState->getByName( aName ) >>= aWindowState ) + { + sal_Bool bValue( sal_False ); + for ( sal_Int32 n = 0; n < aWindowState.getLength(); n++ ) + { + if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKED )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_bFloating = !bValue; + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_VISIBLE )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_bVisible = bValue; + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA )) + { + ui::DockingArea eDockingArea; + if ( aWindowState[n].Value >>= eDockingArea ) + rElementData.m_aDockedData.m_nDockedArea = sal_Int16( eDockingArea ); + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKPOS )) + { + awt::Point aPoint; + if ( aWindowState[n].Value >>= aPoint ) + { + rElementData.m_aDockedData.m_aPos.X() = aPoint.X; + rElementData.m_aDockedData.m_aPos.Y() = aPoint.Y; + } + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_POS )) + { + awt::Point aPoint; + if ( aWindowState[n].Value >>= aPoint ) + { + rElementData.m_aFloatingData.m_aPos.X() = aPoint.X; + rElementData.m_aFloatingData.m_aPos.Y() = aPoint.Y; + } + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_SIZE )) + { + awt::Size aSize; + if ( aWindowState[n].Value >>= aSize ) + { + rElementData.m_aFloatingData.m_aSize.Width() = aSize.Width; + rElementData.m_aFloatingData.m_aSize.Height() = aSize.Height; + } + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_UINAME )) + aWindowState[n].Value >>= rElementData.m_aUIName; + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_STYLE )) + { + sal_Int32 nStyle = 0; + if ( aWindowState[n].Value >>= nStyle ) + rElementData.m_nStyle = sal_Int16( nStyle ); + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_LOCKED )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_aDockedData.m_bLocked = bValue; + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_CONTEXT )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_bContextSensitive = bValue; + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_NOCLOSE )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_bNoClose = bValue; + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_CONTEXTACTIVE )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_bContextActive = bValue; + } + else if ( aWindowState[n].Name.equalsAscii( WINDOWSTATE_PROPERTY_SOFTCLOSE )) + { + if ( aWindowState[n].Value >>= bValue ) + rElementData.m_bSoftClose = bValue; + } + } + } + + // oversteer values with global settings + if ( pGlobalSettings && ( bGetSettingsState || bGlobalSettings )) + { + if ( pGlobalSettings->HasStatesInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR )) + { + WriteGuard aWriteLock2( m_aLock ); + m_bGlobalSettings = true; + aWriteLock2.unlock(); + + uno::Any aValue; + sal_Bool bValue = sal_Bool(); + if ( pGlobalSettings->GetStateInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR, + GlobalSettings::STATEINFO_LOCKED, + aValue )) + aValue >>= rElementData.m_aDockedData.m_bLocked; + if ( pGlobalSettings->GetStateInfo( GlobalSettings::UIELEMENT_TYPE_TOOLBAR, + GlobalSettings::STATEINFO_DOCKED, + aValue )) + { + if ( aValue >>= bValue ) + rElementData.m_bFloating = !bValue; + } + } + } + + return sal_True; + } + catch ( container::NoSuchElementException& ) {} + } + + return sal_False; +} + +void ToolbarLayoutManager::implts_writeWindowStateData( const UIElement& rElementData ) +{ + WriteGuard aWriteLock( m_aLock ); + uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); + m_bStoreWindowState = true; // set flag to determine that we triggered the notification + aWriteLock.unlock(); + + bool bPersistent( sal_False ); + uno::Reference< beans::XPropertySet > xPropSet( rElementData.m_xUIElement, uno::UNO_QUERY ); + if ( xPropSet.is() ) + { + try + { + // Check persistent flag of the user interface element + xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Persistent" ))) >>= bPersistent; + } + catch ( beans::UnknownPropertyException ) + { + bPersistent = true; // Non-configurable elements should at least store their dimension/position + } + catch ( lang::WrappedTargetException ) {} + } + + if ( bPersistent && xPersistentWindowState.is() ) + { + try + { + uno::Sequence< beans::PropertyValue > aWindowState( 8 ); + + aWindowState[0].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKED ); + aWindowState[0].Value = ::uno::makeAny( sal_Bool( !rElementData.m_bFloating )); + aWindowState[1].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_VISIBLE ); + aWindowState[1].Value = uno::makeAny( sal_Bool( rElementData.m_bVisible )); + aWindowState[2].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA ); + aWindowState[2].Value = uno::makeAny( static_cast< ui::DockingArea >( rElementData.m_aDockedData.m_nDockedArea ) ); + + awt::Point aPos; + aPos.X = rElementData.m_aDockedData.m_aPos.X(); + aPos.Y = rElementData.m_aDockedData.m_aPos.Y(); + aWindowState[3].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_DOCKPOS ); + aWindowState[3].Value <<= aPos; + + aPos.X = rElementData.m_aFloatingData.m_aPos.X(); + aPos.Y = rElementData.m_aFloatingData.m_aPos.Y(); + aWindowState[4].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_POS ); + aWindowState[4].Value <<= aPos; + + awt::Size aSize; + aSize.Width = rElementData.m_aFloatingData.m_aSize.Width(); + aSize.Height = rElementData.m_aFloatingData.m_aSize.Height(); + aWindowState[5].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_SIZE ); + aWindowState[5].Value <<= aSize; + aWindowState[6].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_UINAME ); + aWindowState[6].Value = uno::makeAny( rElementData.m_aUIName ); + aWindowState[7].Name = ::rtl::OUString::createFromAscii( WINDOWSTATE_PROPERTY_LOCKED ); + aWindowState[7].Value = uno::makeAny( rElementData.m_aDockedData.m_bLocked ); + + ::rtl::OUString aName = rElementData.m_aName; + if ( xPersistentWindowState->hasByName( aName )) + { + uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY ); + xReplace->replaceByName( aName, uno::makeAny( aWindowState )); + } + else + { + uno::Reference< container::XNameContainer > xInsert( xPersistentWindowState, uno::UNO_QUERY ); + xInsert->insertByName( aName, uno::makeAny( aWindowState )); + } + } + catch ( uno::Exception& ) {} + } + + // Reset flag + aWriteLock.lock(); + m_bStoreWindowState = false; + aWriteLock.unlock(); +} + +void ToolbarLayoutManager::implts_writeNewWindowStateData( const rtl::OUString aName, const uno::Reference< awt::XWindow >& xWindow ) +{ + bool bVisible( false ); + bool bFloating( true ); + awt::Rectangle aPos; + awt::Size aSize; + + if ( xWindow.is() ) + { + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xDockWindow.is() ) + bFloating = xDockWindow->isFloating(); + + uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY ); + if( xWindow2.is() ) + { + aPos = xWindow2->getPosSize(); + aSize = xWindow2->getOutputSize(); // always use output size for consistency + bVisible = xWindow2->isVisible(); + } + + WriteGuard aWriteLock( m_aLock ); + UIElement& rUIElement = impl_findToolbar( aName ); + if ( rUIElement.m_xUIElement.is() ) + { + rUIElement.m_bVisible = bVisible; + rUIElement.m_bFloating = bFloating; + if ( bFloating ) + { + rUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); + rUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + } + } + implts_writeWindowStateData( rUIElement ); + aWriteLock.unlock(); + } +} + +/****************************************************************************** + LOOKUP PART FOR TOOLBARS +******************************************************************************/ + +UIElement& ToolbarLayoutManager::impl_findToolbar( const rtl::OUString& aName ) +{ + static UIElement aEmptyElement; + UIElementVector::iterator pIter; + + ReadGuard aReadLock( m_aLock ); + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_aName == aName ) + return *pIter; + } + + return aEmptyElement; +} + +UIElement ToolbarLayoutManager::implts_findToolbar( const rtl::OUString& aName ) +{ + ReadGuard aReadLock( m_aLock ); + UIElement aElement = impl_findToolbar( aName ); + aReadLock.unlock(); + + return aElement; +} + +UIElement ToolbarLayoutManager::implts_findToolbar( const uno::Reference< uno::XInterface >& xToolbar ) +{ + UIElement aToolbar; + UIElementVector::const_iterator pIter; + + ReadGuard aReadLock( m_aLock ); + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_xUIElement.is() ) + { + uno::Reference< uno::XInterface > xIfac( pIter->m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xIfac == xToolbar ) + { + aToolbar = *pIter; + break; + } + } + } + + return aToolbar; +} + +uno::Reference< awt::XWindow > ToolbarLayoutManager::implts_getXWindow( const ::rtl::OUString& aName ) +{ + UIElementVector::iterator pIter; + uno::Reference< awt::XWindow > xWindow; + + ReadGuard aReadLock( m_aLock ); + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_aName == aName && pIter->m_xUIElement.is() ) + { + xWindow = uno::Reference< awt::XWindow >( pIter->m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + break; + } + } + + return xWindow; +} + +Window* ToolbarLayoutManager::implts_getWindow( const ::rtl::OUString& aName ) +{ + uno::Reference< awt::XWindow > xWindow = implts_getXWindow( aName ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + + return pWindow; +} + +bool ToolbarLayoutManager::implts_insertToolbar( const UIElement& rUIElement ) +{ + UIElement aTempData; + bool bFound( false ); + bool bResult( false ); + + aTempData = implts_findToolbar( rUIElement.m_aName ); + if ( aTempData.m_aName == rUIElement.m_aName ) + bFound = true; + + if ( !bFound ) + { + WriteGuard aWriteLock( m_aLock ); + m_aUIElements.push_back( rUIElement ); + bResult = true; + } + + return bResult; +} + +void ToolbarLayoutManager::implts_setToolbar( const UIElement& rUIElement ) +{ + WriteGuard aWriteLock( m_aLock ); + UIElement& rData = impl_findToolbar( rUIElement.m_aName ); + if ( rData.m_aName == rUIElement.m_aName ) + rData = rUIElement; + else + m_aUIElements.push_back( rUIElement ); +} + +/****************************************************************************** + LAYOUT CODE PART FOR TOOLBARS +******************************************************************************/ + +::Point ToolbarLayoutManager::implts_findNextCascadeFloatingPos() +{ + const sal_Int32 nHotZoneX = 50; + const sal_Int32 nHotZoneY = 50; + const sal_Int32 nCascadeIndentX = 15; + const sal_Int32 nCascadeIndentY = 15; + + ReadGuard aReadLock( m_aLock ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + aReadLock.unlock(); + + ::Point aStartPos( nCascadeIndentX, nCascadeIndentY ); + ::Point aCurrPos( aStartPos ); + awt::Rectangle aRect; + + Window* pContainerWindow( 0 ); + if ( xContainerWindow.is() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + if ( pContainerWindow ) + aStartPos = pContainerWindow->OutputToScreenPixel( aStartPos ); + } + + // Determine size of top and left docking area + awt::Rectangle aTopRect( xTopDockingWindow->getPosSize() ); + awt::Rectangle aLeftRect( xLeftDockingWindow->getPosSize() ); + + aStartPos.X() += aLeftRect.Width + nCascadeIndentX; + aStartPos.Y() += aTopRect.Height + nCascadeIndentY; + aCurrPos = aStartPos; + + // Try to find a cascaded position for the new floating window + UIElementVector::const_iterator pIter; + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_xUIElement.is() ) + { + uno::Reference< awt::XDockableWindow > xDockWindow( pIter->m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY ); + if ( xDockWindow.is() && xDockWindow->isFloating() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->IsVisible() ) + { + awt::Rectangle aFloatRect = xWindow->getPosSize(); + if ((( aFloatRect.X - nHotZoneX ) <= aCurrPos.X() ) && + ( aFloatRect.X >= aCurrPos.X() ) && + (( aFloatRect.Y - nHotZoneY ) <= aCurrPos.Y() ) && + ( aFloatRect.Y >= aCurrPos.Y() )) + { + aCurrPos.X() = aFloatRect.X + nCascadeIndentX; + aCurrPos.Y() = aFloatRect.Y + nCascadeIndentY; + } + } + } + } + } + + return aCurrPos; +} + +void ToolbarLayoutManager::implts_sortUIElements() +{ + WriteGuard aWriteLock( m_aLock ); + UIElementVector::iterator pIterStart = m_aUIElements.begin(); + UIElementVector::iterator pIterEnd = m_aUIElements.end(); + + std::stable_sort( pIterStart, pIterEnd ); // first created element should first + + // We have to reset our temporary flags. + UIElementVector::iterator pIter; + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + pIter->m_bUserActive = sal_False; + aWriteLock.unlock(); +} + +void ToolbarLayoutManager::implts_getUIElementVectorCopy( UIElementVector& rCopy ) +{ + ReadGuard aReadLock( m_aLock ); + rCopy = m_aUIElements; +} + +::Size ToolbarLayoutManager::implts_getTopBottomDockingAreaSizes() +{ + ::Size aSize; + uno::Reference< awt::XWindow > xTopDockingAreaWindow; + uno::Reference< awt::XWindow > xBottomDockingAreaWindow; + + ReadGuard aReadLock( m_aLock ); + xTopDockingAreaWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP]; + xBottomDockingAreaWindow = m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM]; + aReadLock.unlock(); + + if ( xTopDockingAreaWindow.is() ) + aSize.Width() = xTopDockingAreaWindow->getPosSize().Height; + if ( xBottomDockingAreaWindow.is() ) + aSize.Height() = xBottomDockingAreaWindow->getPosSize().Height; + + return aSize; +} + +void ToolbarLayoutManager::implts_getDockingAreaElementInfos( ui::DockingArea eDockingArea, std::vector< SingleRowColumnWindowData >& rRowColumnsWindowData ) +{ + std::vector< UIElement > aWindowVector; + + if (( eDockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( eDockingArea > ui::DockingArea_DOCKINGAREA_RIGHT )) + eDockingArea = ui::DockingArea_DOCKINGAREA_TOP; + + uno::Reference< awt::XWindow > xDockAreaWindow; + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + ReadGuard aReadLock( m_aLock ); + aWindowVector.reserve(m_aUIElements.size()); + xDockAreaWindow = m_xDockAreaWindows[eDockingArea]; + UIElementVector::iterator pIter; + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea && pIter->m_bVisible && !pIter->m_bFloating ) + { + uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement ); + if ( xUIElement.is() ) + { + uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xDockWindow.is() ) + { + // docked windows + aWindowVector.push_back( *pIter ); + } + } + } + } + aReadLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + rRowColumnsWindowData.clear(); + + // Collect data from windows that are on the same row/column + sal_Int32 j; + sal_Int32 nIndex( 0 ); + sal_Int32 nLastPos( 0 ); + sal_Int32 nCurrPos( -1 ); + sal_Int32 nLastRowColPixelPos( 0 ); + awt::Rectangle aDockAreaRect; + + if ( xDockAreaWindow.is() ) + aDockAreaRect = xDockAreaWindow->getPosSize(); + + if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + nLastRowColPixelPos = 0; + else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) + nLastRowColPixelPos = aDockAreaRect.Height; + else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) + nLastRowColPixelPos = 0; + else + nLastRowColPixelPos = aDockAreaRect.Width; + + const sal_uInt32 nCount = aWindowVector.size(); + for ( j = 0; j < sal_Int32( nCount); j++ ) + { + const UIElement& rElement = aWindowVector[j]; + uno::Reference< awt::XWindow > xWindow; + uno::Reference< ui::XUIElement > xUIElement( rElement.m_xUIElement ); + awt::Rectangle aPosSize; + + if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) ) + continue; + if ( isHorizontalDockingArea( eDockingArea )) + { + if ( nCurrPos == -1 ) + { + nCurrPos = rElement.m_aDockedData.m_aPos.Y(); + nLastPos = 0; + + SingleRowColumnWindowData aRowColumnWindowData; + aRowColumnWindowData.nRowColumn = nCurrPos; + rRowColumnsWindowData.push_back( aRowColumnWindowData ); + } + + sal_Int32 nSpace( 0 ); + if ( rElement.m_aDockedData.m_aPos.Y() != nCurrPos ) + { + if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + nLastRowColPixelPos += rRowColumnsWindowData[nIndex].nStaticSize; + else + nLastRowColPixelPos -= rRowColumnsWindowData[nIndex].nStaticSize; + ++nIndex; + nLastPos = 0; + nCurrPos = rElement.m_aDockedData.m_aPos.Y(); + SingleRowColumnWindowData aRowColumnWindowData; + aRowColumnWindowData.nRowColumn = nCurrPos; + rRowColumnsWindowData.push_back( aRowColumnWindowData ); + } + + // Calc space before an element and store it + nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos ); + if ( rElement.m_aDockedData.m_aPos.X() >= nLastPos ) + { + rRowColumnsWindowData[nIndex].nSpace += nSpace; + nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; + } + else + { + nSpace = 0; + nLastPos += aPosSize.Width; + } + rRowColumnsWindowData[nIndex].aRowColumnSpace.push_back( nSpace ); + + rRowColumnsWindowData[nIndex].aRowColumnWindows.push_back( xWindow ); + rRowColumnsWindowData[nIndex].aUIElementNames.push_back( rElement.m_aName ); + rRowColumnsWindowData[nIndex].aRowColumnWindowSizes.push_back( + awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), + rElement.m_aDockedData.m_aPos.Y(), + aPosSize.Width, + aPosSize.Height )); + if ( rRowColumnsWindowData[nIndex].nStaticSize < aPosSize.Height ) + rRowColumnsWindowData[nIndex].nStaticSize = aPosSize.Height; + if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + rRowColumnsWindowData[nIndex].aRowColumnRect = awt::Rectangle( 0, nLastRowColPixelPos, + aDockAreaRect.Width, aPosSize.Height ); + else + rRowColumnsWindowData[nIndex].aRowColumnRect = awt::Rectangle( 0, ( nLastRowColPixelPos - aPosSize.Height ), + aDockAreaRect.Width, aPosSize.Height ); + rRowColumnsWindowData[nIndex].nVarSize += aPosSize.Width + nSpace; + } + else + { + if ( nCurrPos == -1 ) + { + nCurrPos = rElement.m_aDockedData.m_aPos.X(); + nLastPos = 0; + + SingleRowColumnWindowData aRowColumnWindowData; + aRowColumnWindowData.nRowColumn = nCurrPos; + rRowColumnsWindowData.push_back( aRowColumnWindowData ); + } + + sal_Int32 nSpace( 0 ); + if ( rElement.m_aDockedData.m_aPos.X() != nCurrPos ) + { + if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) + nLastRowColPixelPos += rRowColumnsWindowData[nIndex].nStaticSize; + else + nLastRowColPixelPos -= rRowColumnsWindowData[nIndex].nStaticSize; + ++nIndex; + nLastPos = 0; + nCurrPos = rElement.m_aDockedData.m_aPos.X(); + SingleRowColumnWindowData aRowColumnWindowData; + aRowColumnWindowData.nRowColumn = nCurrPos; + rRowColumnsWindowData.push_back( aRowColumnWindowData ); + } + + // Calc space before an element and store it + nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos ); + if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos ) + { + rRowColumnsWindowData[nIndex].nSpace += nSpace; + nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; + } + else + { + nSpace = 0; + nLastPos += aPosSize.Height; + } + rRowColumnsWindowData[nIndex].aRowColumnSpace.push_back( nSpace ); + + rRowColumnsWindowData[nIndex].aRowColumnWindows.push_back( xWindow ); + rRowColumnsWindowData[nIndex].aUIElementNames.push_back( rElement.m_aName ); + rRowColumnsWindowData[nIndex].aRowColumnWindowSizes.push_back( + awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), + rElement.m_aDockedData.m_aPos.Y(), + aPosSize.Width, + aPosSize.Height )); + if ( rRowColumnsWindowData[nIndex].nStaticSize < aPosSize.Width ) + rRowColumnsWindowData[nIndex].nStaticSize = aPosSize.Width; + if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) + rRowColumnsWindowData[nIndex].aRowColumnRect = awt::Rectangle( nLastRowColPixelPos, 0, + aPosSize.Width, aDockAreaRect.Height ); + else + rRowColumnsWindowData[nIndex].aRowColumnRect = awt::Rectangle( ( nLastRowColPixelPos - aPosSize.Width ), 0, + aPosSize.Width, aDockAreaRect.Height ); + rRowColumnsWindowData[nIndex].nVarSize += aPosSize.Height + nSpace; + } + } +} + +void ToolbarLayoutManager::implts_getDockingAreaElementInfoOnSingleRowCol( ui::DockingArea eDockingArea, sal_Int32 nRowCol, SingleRowColumnWindowData& rRowColumnWindowData ) +{ + std::vector< UIElement > aWindowVector; + + if (( eDockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( eDockingArea > ui::DockingArea_DOCKINGAREA_RIGHT )) + eDockingArea = ui::DockingArea_DOCKINGAREA_TOP; + + bool bHorzDockArea = isHorizontalDockingArea( eDockingArea ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + ReadGuard aReadLock( m_aLock ); + UIElementVector::iterator pIter; + UIElementVector::iterator pEnd = m_aUIElements.end(); + for ( pIter = m_aUIElements.begin(); pIter != pEnd; pIter++ ) + { + if ( pIter->m_aDockedData.m_nDockedArea == eDockingArea ) + { + bool bSameRowCol = bHorzDockArea ? ( pIter->m_aDockedData.m_aPos.Y() == nRowCol ) : ( pIter->m_aDockedData.m_aPos.X() == nRowCol ); + uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement ); + + if ( bSameRowCol && xUIElement.is() ) + { + uno::Reference< awt::XWindow > xWindow( xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xWindow.is() ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( pWindow && pIter->m_bVisible && xDockWindow.is() && !pIter->m_bFloating ) + aWindowVector.push_back( *pIter ); // docked windows + } + } + } + } + aReadLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + // Initialize structure + rRowColumnWindowData.aUIElementNames.clear(); + rRowColumnWindowData.aRowColumnWindows.clear(); + rRowColumnWindowData.aRowColumnWindowSizes.clear(); + rRowColumnWindowData.aRowColumnSpace.clear(); + rRowColumnWindowData.nVarSize = 0; + rRowColumnWindowData.nStaticSize = 0; + rRowColumnWindowData.nSpace = 0; + rRowColumnWindowData.nRowColumn = nRowCol; + + // Collect data from windows that are on the same row/column + sal_Int32 j; + sal_Int32 nLastPos( 0 ); + + const sal_uInt32 nCount = aWindowVector.size(); + for ( j = 0; j < sal_Int32( nCount); j++ ) + { + const UIElement& rElement = aWindowVector[j]; + uno::Reference< awt::XWindow > xWindow; + uno::Reference< ui::XUIElement > xUIElement( rElement.m_xUIElement ); + awt::Rectangle aPosSize; + if ( !lcl_checkUIElement(xUIElement,aPosSize,xWindow) ) + continue; + + sal_Int32 nSpace; + if ( isHorizontalDockingArea( eDockingArea )) + { + nSpace = ( rElement.m_aDockedData.m_aPos.X() - nLastPos ); + + // Calc space before an element and store it + if ( rElement.m_aDockedData.m_aPos.X() > nLastPos ) + rRowColumnWindowData.nSpace += nSpace; + else + nSpace = 0; + + nLastPos = rElement.m_aDockedData.m_aPos.X() + aPosSize.Width; + + + rRowColumnWindowData.aRowColumnWindowSizes.push_back( + awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), rElement.m_aDockedData.m_aPos.Y(), + aPosSize.Width, aPosSize.Height )); + if ( rRowColumnWindowData.nStaticSize < aPosSize.Height ) + rRowColumnWindowData.nStaticSize = aPosSize.Height; + rRowColumnWindowData.nVarSize += aPosSize.Width; + } + else + { + // Calc space before an element and store it + nSpace = ( rElement.m_aDockedData.m_aPos.Y() - nLastPos ); + if ( rElement.m_aDockedData.m_aPos.Y() > nLastPos ) + rRowColumnWindowData.nSpace += nSpace; + else + nSpace = 0; + + nLastPos = rElement.m_aDockedData.m_aPos.Y() + aPosSize.Height; + + rRowColumnWindowData.aRowColumnWindowSizes.push_back( + awt::Rectangle( rElement.m_aDockedData.m_aPos.X(), rElement.m_aDockedData.m_aPos.Y(), + aPosSize.Width, aPosSize.Height )); + if ( rRowColumnWindowData.nStaticSize < aPosSize.Width ) + rRowColumnWindowData.nStaticSize = aPosSize.Width; + rRowColumnWindowData.nVarSize += aPosSize.Height; + } + + rRowColumnWindowData.aUIElementNames.push_back( rElement.m_aName ); + rRowColumnWindowData.aRowColumnWindows.push_back( xWindow ); + rRowColumnWindowData.aRowColumnSpace.push_back( nSpace ); + rRowColumnWindowData.nVarSize += nSpace; + } +} + +::Rectangle ToolbarLayoutManager::implts_getWindowRectFromRowColumn( + ui::DockingArea DockingArea, + const SingleRowColumnWindowData& rRowColumnWindowData, + const ::Point& rMousePos, + const rtl::OUString& rExcludeElementName ) +{ + ::Rectangle aWinRect; + + if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT )) + DockingArea = ui::DockingArea_DOCKINGAREA_TOP; + + if ( rRowColumnWindowData.aRowColumnWindows.empty() ) + return aWinRect; + else + { + ReadGuard aReadLock( m_aLock ); + Window* pContainerWindow( VCLUnoHelper::GetWindow( m_xContainerWindow )); + Window* pDockingAreaWindow( VCLUnoHelper::GetWindow( m_xDockAreaWindows[DockingArea] )); + aReadLock.unlock(); + + // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect + vos::OGuard aGuard( Application::GetSolarMutex() ); + + // Retrieve output size from container Window + if ( pDockingAreaWindow && pContainerWindow ) + { + const sal_uInt32 nCount = rRowColumnWindowData.aRowColumnWindows.size(); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + awt::Rectangle aWindowRect = rRowColumnWindowData.aRowColumnWindows[i]->getPosSize(); + ::Rectangle aRect( aWindowRect.X, aWindowRect.Y, aWindowRect.X+aWindowRect.Width, aWindowRect.Y+aWindowRect.Height ); + aRect.SetPos( pContainerWindow->ScreenToOutputPixel( pDockingAreaWindow->OutputToScreenPixel( aRect.TopLeft() ))); + if ( aRect.IsInside( rMousePos )) + { + // Check if we have found the excluded element. If yes, we have to provide an empty rectangle. + // We prevent that a toolbar cannot be moved when the mouse pointer is inside its own rectangle! + if ( rExcludeElementName != rRowColumnWindowData.aUIElementNames[i] ) + return aRect; + else + break; + } + } + } + } + + return aWinRect; +} + +::Rectangle ToolbarLayoutManager::implts_determineFrontDockingRect( + ui::DockingArea eDockingArea, + sal_Int32 nRowCol, + const ::Rectangle& rDockedElementRect, + const ::rtl::OUString& rMovedElementName, + const ::Rectangle& rMovedElementRect ) +{ + SingleRowColumnWindowData aRowColumnWindowData; + + sal_Bool bHorzDockArea( isHorizontalDockingArea( eDockingArea )); + implts_getDockingAreaElementInfoOnSingleRowCol( eDockingArea, nRowCol, aRowColumnWindowData ); + if ( aRowColumnWindowData.aRowColumnWindows.empty() ) + return rMovedElementRect; + else + { + sal_Int32 nSpace( 0 ); + ::Rectangle aFrontDockingRect( rMovedElementRect ); + const sal_uInt32 nCount = aRowColumnWindowData.aRowColumnWindows.size(); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + if ( bHorzDockArea ) + { + if ( aRowColumnWindowData.aRowColumnWindowSizes[i].X >= rDockedElementRect.Left() ) + { + nSpace += aRowColumnWindowData.aRowColumnSpace[i]; + break; + } + else if ( aRowColumnWindowData.aUIElementNames[i] == rMovedElementName ) + nSpace += aRowColumnWindowData.aRowColumnWindowSizes[i].Width + + aRowColumnWindowData.aRowColumnSpace[i]; + else + nSpace = 0; + } + else + { + if ( aRowColumnWindowData.aRowColumnWindowSizes[i].Y >= rDockedElementRect.Top() ) + { + nSpace += aRowColumnWindowData.aRowColumnSpace[i]; + break; + } + else if ( aRowColumnWindowData.aUIElementNames[i] == rMovedElementName ) + nSpace += aRowColumnWindowData.aRowColumnWindowSizes[i].Height + + aRowColumnWindowData.aRowColumnSpace[i]; + else + nSpace = 0; + } + } + + if ( nSpace > 0 ) + { + sal_Int32 nMove = std::min( nSpace, static_cast<sal_Int32>(aFrontDockingRect.getWidth()) ); + if ( bHorzDockArea ) + aFrontDockingRect.Move( -nMove, 0 ); + else + aFrontDockingRect.Move( 0, -nMove ); + } + + return aFrontDockingRect; + } +} + +void ToolbarLayoutManager::implts_findNextDockingPos( ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ) +{ + ReadGuard aReadLock( m_aLock ); + uno::Reference< awt::XWindow > xDockingWindow( m_xDockAreaWindows[DockingArea] ); + ::Size aDockingWinSize; + Window* pDockingWindow( 0 ); + aReadLock.unlock(); + + if (( DockingArea < ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea > ui::DockingArea_DOCKINGAREA_RIGHT )) + DockingArea = ui::DockingArea_DOCKINGAREA_TOP; + + { + // Retrieve output size from container Window + vos::OGuard aGuard( Application::GetSolarMutex() ); + pDockingWindow = VCLUnoHelper::GetWindow( xDockingWindow ); + if ( pDockingWindow ) + aDockingWinSize = pDockingWindow->GetOutputSizePixel(); + } + + sal_Int32 nFreeRowColPixelPos( 0 ); + sal_Int32 nMaxSpace( 0 ); + sal_Int32 nNeededSpace( 0 ); + sal_Int32 nTopDockingAreaSize( 0 ); + + if ( isHorizontalDockingArea( DockingArea )) + { + nMaxSpace = aDockingWinSize.Width(); + nNeededSpace = aUIElementSize.Width(); + } + else + { + nMaxSpace = aDockingWinSize.Height(); + nNeededSpace = aUIElementSize.Height(); + nTopDockingAreaSize = implts_getTopBottomDockingAreaSizes().Width(); + } + + std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; + + implts_getDockingAreaElementInfos( DockingArea, aRowColumnsWindowData ); + sal_Int32 nPixelPos( 0 ); + const sal_uInt32 nCount = aRowColumnsWindowData.size(); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + SingleRowColumnWindowData& rRowColumnWindowData = aRowColumnsWindowData[i]; + + if (( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) || + ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT )) + nPixelPos += rRowColumnWindowData.nStaticSize; + + if ((( nMaxSpace - rRowColumnWindowData.nVarSize ) >= nNeededSpace ) || + ( rRowColumnWindowData.nSpace >= nNeededSpace )) + { + // Check current row where we can find the needed space + sal_Int32 nCurrPos( 0 ); + const sal_uInt32 nWindowSizesCount = rRowColumnWindowData.aRowColumnWindowSizes.size(); + for ( sal_uInt32 j = 0; j < nWindowSizesCount; j++ ) + { + awt::Rectangle rRect = rRowColumnWindowData.aRowColumnWindowSizes[j]; + sal_Int32& rSpace = rRowColumnWindowData.aRowColumnSpace[j]; + if ( isHorizontalDockingArea( DockingArea )) + { + if ( rSpace >= nNeededSpace ) + { + rVirtualPos = ::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); + if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + rPixelPos = ::Point( nCurrPos, nPixelPos ); + else + rPixelPos = ::Point( nCurrPos, aDockingWinSize.Height() - nPixelPos ); + return; + } + nCurrPos = rRect.X + rRect.Width; + } + else + { + if ( rSpace >= nNeededSpace ) + { + rVirtualPos = ::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); + if ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) + rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos ); + else + rPixelPos = ::Point( aDockingWinSize.Width() - nPixelPos , nTopDockingAreaSize + nCurrPos ); + return; + } + nCurrPos = rRect.Y + rRect.Height; + } + } + + if (( nCurrPos + nNeededSpace ) <= nMaxSpace ) + { + if ( isHorizontalDockingArea( DockingArea )) + { + rVirtualPos = ::Point( nCurrPos, rRowColumnWindowData.nRowColumn ); + if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + rPixelPos = ::Point( nCurrPos, nPixelPos ); + else + rPixelPos = ::Point( nCurrPos, aDockingWinSize.Height() - nPixelPos ); + return; + } + else + { + rVirtualPos = ::Point( rRowColumnWindowData.nRowColumn, nCurrPos ); + if ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) + rPixelPos = ::Point( nPixelPos, nTopDockingAreaSize + nCurrPos ); + else + rPixelPos = ::Point( aDockingWinSize.Width() - nPixelPos , nTopDockingAreaSize + nCurrPos ); + return; + } + } + } + + if (( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) || ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT )) + nPixelPos += rRowColumnWindowData.nStaticSize; + } + + sal_Int32 nNextFreeRowCol( 0 ); + sal_Int32 nRowColumnsCount = aRowColumnsWindowData.size(); + if ( nRowColumnsCount > 0 ) + nNextFreeRowCol = aRowColumnsWindowData[nRowColumnsCount-1].nRowColumn+1; + else + nNextFreeRowCol = 0; + + if ( nNextFreeRowCol == 0 ) + { + if ( DockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) + nFreeRowColPixelPos = aDockingWinSize.Height() - aUIElementSize.Height(); + else if ( DockingArea == ui::DockingArea_DOCKINGAREA_RIGHT ) + nFreeRowColPixelPos = aDockingWinSize.Width() - aUIElementSize.Width(); + } + + if ( isHorizontalDockingArea( DockingArea )) + { + rVirtualPos = ::Point( 0, nNextFreeRowCol ); + if ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + rPixelPos = ::Point( 0, nFreeRowColPixelPos ); + else + rPixelPos = ::Point( 0, aDockingWinSize.Height() - nFreeRowColPixelPos ); + } + else + { + rVirtualPos = ::Point( nNextFreeRowCol, 0 ); + rPixelPos = ::Point( aDockingWinSize.Width() - nFreeRowColPixelPos, 0 ); + } +} + +void ToolbarLayoutManager::implts_calcWindowPosSizeOnSingleRowColumn( + sal_Int32 nDockingArea, + sal_Int32 nOffset, + SingleRowColumnWindowData& rRowColumnWindowData, + const ::Size& rContainerSize ) +{ + sal_Int32 nDiff(0); + sal_Int32 nRCSpace( rRowColumnWindowData.nSpace ); + sal_Int32 nTopDockingAreaSize(0); + sal_Int32 nBottomDockingAreaSize(0); + sal_Int32 nContainerClientSize(0); + + if ( rRowColumnWindowData.aRowColumnWindows.empty() ) + return; + + if ( isHorizontalDockingArea( nDockingArea )) + { + nContainerClientSize = rContainerSize.Width(); + nDiff = nContainerClientSize - rRowColumnWindowData.nVarSize; + } + else + { + nTopDockingAreaSize = implts_getTopBottomDockingAreaSizes().Width(); + nBottomDockingAreaSize = implts_getTopBottomDockingAreaSizes().Height(); + nContainerClientSize = ( rContainerSize.Height() - nTopDockingAreaSize - nBottomDockingAreaSize ); + nDiff = nContainerClientSize - rRowColumnWindowData.nVarSize; + } + + const sal_uInt32 nCount = rRowColumnWindowData.aRowColumnWindowSizes.size(); + if (( nDiff < 0 ) && ( nRCSpace > 0 )) + { + // First we try to reduce the size of blank space before/behind docked windows + sal_Int32 i = nCount - 1; + while ( i >= 0 ) + { + sal_Int32 nSpace = rRowColumnWindowData.aRowColumnSpace[i]; + if ( nSpace >= -nDiff ) + { + if ( isHorizontalDockingArea( nDockingArea )) + { + // Try to move this and all user elements behind with the calculated difference + for ( sal_uInt32 j = i; j < nCount ; j++ ) + rRowColumnWindowData.aRowColumnWindowSizes[j].X += nDiff; + } + else + { + // Try to move this and all user elements behind with the calculated difference + for ( sal_uInt32 j = i; j < nCount ; j++ ) + rRowColumnWindowData.aRowColumnWindowSizes[j].Y += nDiff; + } + nDiff = 0; + + break; + } + else if ( nSpace > 0 ) + { + if ( isHorizontalDockingArea( nDockingArea )) + { + // Try to move this and all user elements behind with the calculated difference + for ( sal_uInt32 j = i; j < nCount; j++ ) + rRowColumnWindowData.aRowColumnWindowSizes[j].X -= nSpace; + } + else + { + // Try to move this and all user elements behind with the calculated difference + for ( sal_uInt32 j = i; j < nCount; j++ ) + rRowColumnWindowData.aRowColumnWindowSizes[j].Y -= nSpace; + } + nDiff += nSpace; + } + --i; + } + } + + // Check if we have to reduce further + if ( nDiff < 0 ) + { + // Now we have to reduce the size of certain docked windows + sal_Int32 i = sal_Int32( nCount - 1 ); + while ( i >= 0 ) + { + awt::Rectangle& rWinRect = rRowColumnWindowData.aRowColumnWindowSizes[i]; + ::Size aMinSize; + + vos::OGuard aGuard( Application::GetSolarMutex() ); + { + uno::Reference< awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i]; + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + aMinSize = ((ToolBox *)pWindow)->CalcMinimumWindowSizePixel(); + } + + if (( aMinSize.Width() > 0 ) && ( aMinSize.Height() > 0 )) + { + if ( isHorizontalDockingArea( nDockingArea )) + { + sal_Int32 nMaxReducation = ( rWinRect.Width - aMinSize.Width() ); + if ( nMaxReducation >= -nDiff ) + { + rWinRect.Width = rWinRect.Width + nDiff; + nDiff = 0; + } + else + { + rWinRect.Width = aMinSize.Width(); + nDiff += nMaxReducation; + } + + // Try to move this and all user elements behind with the calculated difference + for ( sal_uInt32 j = i; j < nCount; j++ ) + rRowColumnWindowData.aRowColumnWindowSizes[j].X += nDiff; + } + else + { + sal_Int32 nMaxReducation = ( rWinRect.Height - aMinSize.Height() ); + if ( nMaxReducation >= -nDiff ) + { + rWinRect.Height = rWinRect.Height + nDiff; + nDiff = 0; + } + else + { + rWinRect.Height = aMinSize.Height(); + nDiff += nMaxReducation; + } + + // Try to move this and all user elements behind with the calculated difference + for ( sal_uInt32 j = i; j < nCount; j++ ) + rRowColumnWindowData.aRowColumnWindowSizes[j].Y += nDiff; + } + } + + if ( nDiff >= 0 ) + break; + + --i; + } + } + + ReadGuard aReadLock( m_aLock ); + Window* pDockAreaWindow = VCLUnoHelper::GetWindow( m_xDockAreaWindows[nDockingArea] ); + aReadLock.unlock(); + + sal_Int32 nCurrPos( 0 ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + uno::Reference< awt::XWindow > xWindow = rRowColumnWindowData.aRowColumnWindows[i]; + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + Window* pOldParentWindow = pWindow->GetParent(); + + if ( pDockAreaWindow != pOldParentWindow ) + pWindow->SetParent( pDockAreaWindow ); + + awt::Rectangle aWinRect = rRowColumnWindowData.aRowColumnWindowSizes[i]; + if ( isHorizontalDockingArea( nDockingArea )) + { + if ( aWinRect.X < nCurrPos ) + aWinRect.X = nCurrPos; + pWindow->SetPosSizePixel( ::Point( aWinRect.X, nOffset ), ::Size( aWinRect.Width, rRowColumnWindowData.nStaticSize )); + pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + nCurrPos += ( aWinRect.X - nCurrPos ) + aWinRect.Width; + } + else + { + if ( aWinRect.Y < nCurrPos ) + aWinRect.Y = nCurrPos; + pWindow->SetPosSizePixel( ::Point( nOffset, aWinRect.Y ), ::Size( rRowColumnWindowData.nStaticSize, aWinRect.Height )); + pWindow->Show( TRUE, SHOW_NOFOCUSCHANGE | SHOW_NOACTIVATE ); + nCurrPos += ( aWinRect.Y - nCurrPos ) + aWinRect.Height; + } + } +} + +void ToolbarLayoutManager::implts_setLayoutDirty() +{ + WriteGuard aWriteLock( m_aLock ); + m_bLayoutDirty = true; +} + +void ToolbarLayoutManager::implts_setLayoutInProgress( bool bInProgress ) +{ + WriteGuard aWriteLock( m_aLock ); + m_bLayoutInProgress = bInProgress; +} + +::Rectangle ToolbarLayoutManager::implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset ) +{ + ::Rectangle aRect( rRect ); + + aRect.Left() -= nHotZoneOffset; + aRect.Top() -= nHotZoneOffset; + aRect.Right() += nHotZoneOffset; + aRect.Bottom() += nHotZoneOffset; + + return aRect; +} + +void ToolbarLayoutManager::implts_calcDockingPosSize( + UIElement& rUIElement, + DockingOperation& rDockingOperation, + ::Rectangle& rTrackingRect, + const Point& rMousePos ) +{ + ReadGuard aReadLock( m_aLock ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + ::Size aContainerWinSize; + Window* pContainerWindow( 0 ); + ::Rectangle aDockingAreaOffsets( m_aDockingAreaOffsets ); + aReadLock.unlock(); + + if ( !rUIElement.m_xUIElement.is() ) + { + rTrackingRect = ::Rectangle(); + return; + } + + { + // Retrieve output size from container Window + vos::OGuard aGuard( Application::GetSolarMutex() ); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + aContainerWinSize = pContainerWindow->GetOutputSizePixel(); + } + + Window* pDockWindow( 0 ); + Window* pDockingAreaWindow( 0 ); + ToolBox* pToolBox( 0 ); + uno::Reference< awt::XWindow > xWindow( rUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xDockingAreaWindow; + ::Rectangle aTrackingRect( rTrackingRect ); + ui::DockingArea eDockedArea( (ui::DockingArea)rUIElement.m_aDockedData.m_nDockedArea ); + sal_Int32 nTopDockingAreaSize( implts_getTopBottomDockingAreaSizes().Width() ); + sal_Int32 nBottomDockingAreaSize( implts_getTopBottomDockingAreaSizes().Height() ); + bool bHorizontalDockArea(( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) || + ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM )); + sal_Int32 nMaxLeftRightDockAreaSize = aContainerWinSize.Height() - + nTopDockingAreaSize - + nBottomDockingAreaSize - + aDockingAreaOffsets.Top() - + aDockingAreaOffsets.Bottom(); + ::Rectangle aDockingAreaRect; + + aReadLock.lock(); + xDockingAreaWindow = m_xDockAreaWindows[eDockedArea]; + aReadLock.unlock(); + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); + pDockWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pDockWindow && pDockWindow->GetType() == WINDOW_TOOLBOX ) + pToolBox = (ToolBox *)pDockWindow; + + aDockingAreaRect = ::Rectangle( pDockingAreaWindow->GetPosPixel(), pDockingAreaWindow->GetSizePixel() ); + if ( pToolBox ) + { + // docked toolbars always have one line + ::Size aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( sal_Int16( eDockedArea )) ); + aTrackingRect.SetSize( ::Size( aSize.Width(), aSize.Height() )); + } + } + + // default docking operation, dock on the given row/column + bool bOpOutsideOfDockingArea( !aDockingAreaRect.IsInside( rMousePos )); + std::vector< SingleRowColumnWindowData > aRowColumnsWindowData; + + rDockingOperation = DOCKOP_ON_COLROW; + implts_getDockingAreaElementInfos( eDockedArea, aRowColumnsWindowData ); + + // determine current first row/column and last row/column + sal_Int32 nMaxRowCol( -1 ); + sal_Int32 nMinRowCol( SAL_MAX_INT32 ); + const sal_uInt32 nCount = aRowColumnsWindowData.size(); + for ( sal_uInt32 i = 0; i < nCount; i++ ) + { + if ( aRowColumnsWindowData[i].nRowColumn > nMaxRowCol ) + nMaxRowCol = aRowColumnsWindowData[i].nRowColumn; + if ( aRowColumnsWindowData[i].nRowColumn < nMinRowCol ) + nMinRowCol = aRowColumnsWindowData[i].nRowColumn; + } + + if ( !bOpOutsideOfDockingArea ) + { + // docking inside our docking area + sal_Int32 nIndex( -1 ); + sal_Int32 nRowCol( -1 ); + ::Rectangle aWindowRect; + ::Rectangle aRowColumnRect; + + const sal_uInt32 nWindowDataCount = aRowColumnsWindowData.size(); + for ( sal_uInt32 i = 0; i < nWindowDataCount; i++ ) + { + ::Rectangle aRect( aRowColumnsWindowData[i].aRowColumnRect.X, + aRowColumnsWindowData[i].aRowColumnRect.Y, + aRowColumnsWindowData[i].aRowColumnRect.X + aRowColumnsWindowData[i].aRowColumnRect.Width, + aRowColumnsWindowData[i].aRowColumnRect.Y + aRowColumnsWindowData[i].aRowColumnRect.Height ); + + { + // Calc correct position of the column/row rectangle to be able to compare it with mouse pos/tracking rect + vos::OGuard aGuard( Application::GetSolarMutex() ); + aRect.SetPos( pContainerWindow->ScreenToOutputPixel( pDockingAreaWindow->OutputToScreenPixel( aRect.TopLeft() ))); + } + + bool bIsInsideRowCol( aRect.IsInside( rMousePos ) ); + if ( bIsInsideRowCol ) + { + nIndex = i; + nRowCol = aRowColumnsWindowData[i].nRowColumn; + rDockingOperation = implts_determineDockingOperation( eDockedArea, aRect, rMousePos ); + aWindowRect = implts_getWindowRectFromRowColumn( eDockedArea, aRowColumnsWindowData[i], rMousePos, rUIElement.m_aName ); + aRowColumnRect = aRect; + break; + } + } + + OSL_ENSURE( ( nIndex >= 0 ) && ( nRowCol >= 0 ), "Impossible case - no row/column found but mouse pointer is inside our docking area" ); + if (( nIndex >= 0 ) && ( nRowCol >= 0 )) + { + if ( rDockingOperation == DOCKOP_ON_COLROW ) + { + if ( !aWindowRect.IsEmpty()) + { + // Tracking rect is on a row/column and mouse is over a docked toolbar. + // Determine if the tracking rect must be located before/after the docked toolbar. + + ::Rectangle aUIElementRect( aWindowRect ); + sal_Int32 nMiddle( bHorizontalDockArea ? ( aWindowRect.Left() + aWindowRect.getWidth() / 2 ) : + ( aWindowRect.Top() + aWindowRect.getHeight() / 2 )); + sal_Bool bInsertBefore( bHorizontalDockArea ? ( rMousePos.X() < nMiddle ) : ( rMousePos.Y() < nMiddle )); + if ( bInsertBefore ) + { + if ( bHorizontalDockArea ) + { + sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( aContainerWinSize.Width() - aWindowRect.Left() ), + sal_Int32( aTrackingRect.getWidth() ))); + if ( nSize == 0 ) + nSize = aWindowRect.getWidth(); + + aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() )); + aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect,rUIElement.m_aName, aUIElementRect ); + + // Set virtual position + rUIElement.m_aDockedData.m_aPos.X() = aWindowRect.Left(); + rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + } + else + { + sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( + nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.Top() ), + sal_Int32( aTrackingRect.getHeight() ))); + if ( nSize == 0 ) + nSize = aWindowRect.getHeight(); + + aUIElementRect.SetSize( ::Size( aWindowRect.getWidth(), nSize )); + aWindowRect = implts_determineFrontDockingRect( eDockedArea, nRowCol, aWindowRect, rUIElement.m_aName, aUIElementRect ); + + // Set virtual position + sal_Int32 nPosY = pDockingAreaWindow->ScreenToOutputPixel( + pContainerWindow->OutputToScreenPixel( aWindowRect.TopLeft() )).Y(); + rUIElement.m_aDockedData.m_aPos.X() = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y() = nPosY; + } + + rTrackingRect = aWindowRect; + return; + } + else + { + if ( bHorizontalDockArea ) + { + sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32(( aContainerWinSize.Width() ) - aWindowRect.Right() ), + sal_Int32( aTrackingRect.getWidth() ))); + if ( nSize == 0 ) + { + aUIElementRect.SetPos( ::Point( aContainerWinSize.Width() - aTrackingRect.getWidth(), aWindowRect.Top() )); + aUIElementRect.SetSize( ::Size( aTrackingRect.getWidth(), aWindowRect.getHeight() )); + rUIElement.m_aDockedData.m_aPos.X() = aUIElementRect.Left(); + } + else + { + aUIElementRect.SetPos( ::Point( aWindowRect.Right(), aWindowRect.Top() )); + aUIElementRect.SetSize( ::Size( nSize, aWindowRect.getHeight() )); + rUIElement.m_aDockedData.m_aPos.X() = aWindowRect.Right(); + } + + // Set virtual position + rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + } + else + { + sal_Int32 nSize = ::std::max( sal_Int32( 0 ), std::min( sal_Int32( nTopDockingAreaSize + nMaxLeftRightDockAreaSize - aWindowRect.Bottom() ), + sal_Int32( aTrackingRect.getHeight() ))); + aUIElementRect.SetPos( ::Point( aWindowRect.Left(), aWindowRect.Bottom() )); + aUIElementRect.SetSize( ::Size( aWindowRect.getWidth(), nSize )); + + // Set virtual position + sal_Int32 nPosY( 0 ); + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + nPosY = pDockingAreaWindow->ScreenToOutputPixel( + pContainerWindow->OutputToScreenPixel( aWindowRect.BottomRight() )).Y(); + } + rUIElement.m_aDockedData.m_aPos.X() = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y() = nPosY; + } + + rTrackingRect = aUIElementRect; + return; + } + } + else + { + implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect ); + rTrackingRect = implts_calcTrackingAndElementRect( + eDockedArea, nRowCol, rUIElement, + aTrackingRect, aRowColumnRect, aContainerWinSize ); + return; + } + } + else + { + if ((( nRowCol == nMinRowCol ) && ( rDockingOperation == DOCKOP_BEFORE_COLROW )) || + (( nRowCol == nMaxRowCol ) && ( rDockingOperation == DOCKOP_AFTER_COLROW ))) + bOpOutsideOfDockingArea = true; + else + { + // handle docking before/after a row + implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect ); + rTrackingRect = implts_calcTrackingAndElementRect( + eDockedArea, nRowCol, rUIElement, + aTrackingRect, aRowColumnRect, aContainerWinSize ); + + sal_Int32 nOffsetX( 0 ); + sal_Int32 nOffsetY( 0 ); + if ( bHorizontalDockArea ) + nOffsetY = sal_Int32( floor( aRowColumnRect.getHeight() / 2 + 0.5 )); + else + nOffsetX = sal_Int32( floor( aRowColumnRect.getWidth() / 2 + 0.5 )); + + if ( rDockingOperation == DOCKOP_BEFORE_COLROW ) + { + if (( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) || ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT )) + { + // Docking before/after means move track rectangle half column/row. + // As left and top are ordered 0...n instead of right and bottom + // which uses n...0, we have to use negative values for top/left. + nOffsetX *= -1; + nOffsetY *= -1; + } + } + else + { + if (( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) || ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT )) + { + // Docking before/after means move track rectangle half column/row. + // As left and top are ordered 0...n instead of right and bottom + // which uses n...0, we have to use negative values for top/left. + nOffsetX *= -1; + nOffsetY *= -1; + } + nRowCol++; + } + + if ( bHorizontalDockArea ) + rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + else + rUIElement.m_aDockedData.m_aPos.X() = nRowCol; + + rTrackingRect.Move( nOffsetX, nOffsetY ); + rTrackingRect.SetSize( aTrackingRect.GetSize() ); + } + } + } + } + + // Docking outside of our docking window area => + // Users want to dock before/after first/last docked element or to an empty docking area + if ( bOpOutsideOfDockingArea ) + { + // set correct size for docking + implts_setTrackingRect( eDockedArea, rMousePos, aTrackingRect ); + rTrackingRect = aTrackingRect; + + if ( bHorizontalDockArea ) + { + sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 ))); + if (( nPosX + rTrackingRect.getWidth()) > aContainerWinSize.Width() ) + nPosX = std::min( nPosX, + std::max( sal_Int32( aContainerWinSize.Width() - rTrackingRect.getWidth() ), + sal_Int32( 0 ))); + + sal_Int32 nSize = std::min( aContainerWinSize.Width(), rTrackingRect.getWidth() ); + sal_Int32 nDockHeight = std::max( static_cast<sal_Int32>(aDockingAreaRect.getHeight()), sal_Int32( 0 )); + if ( nDockHeight == 0 ) + { + sal_Int32 nPosY( std::max( aDockingAreaRect.Top(), aDockingAreaRect.Bottom() )); + if ( eDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) + nPosY -= rTrackingRect.getHeight(); + rTrackingRect.SetPos( Point( nPosX, nPosY )); + rUIElement.m_aDockedData.m_aPos.Y() = 0; + } + else if ( rMousePos.Y() < ( aDockingAreaRect.Top() + ( nDockHeight / 2 ))) + { + rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Top() - rTrackingRect.getHeight() )); + if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) + rUIElement.m_aDockedData.m_aPos.Y() = 0; + else + rUIElement.m_aDockedData.m_aPos.Y() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + rDockingOperation = DOCKOP_BEFORE_COLROW; + } + else + { + rTrackingRect.SetPos( Point( nPosX, aDockingAreaRect.Bottom() )); + if ( eDockedArea == ui::DockingArea_DOCKINGAREA_TOP ) + rUIElement.m_aDockedData.m_aPos.Y() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + else + rUIElement.m_aDockedData.m_aPos.Y() = 0; + rDockingOperation = DOCKOP_AFTER_COLROW; + } + rTrackingRect.setWidth( nSize ); + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + nPosX = pDockingAreaWindow->ScreenToOutputPixel( + pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).X(); + } + rUIElement.m_aDockedData.m_aPos.X() = nPosX; + } + else + { + sal_Int32 nMaxDockingAreaHeight = std::max( sal_Int32( 0 ), sal_Int32( nMaxLeftRightDockAreaSize )); + sal_Int32 nPosY( std::max( sal_Int32( aTrackingRect.Top()), sal_Int32( nTopDockingAreaSize ))); + if (( nPosY + aTrackingRect.getHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight )) + nPosY = std::min( nPosY, + std::max( sal_Int32( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() )), + sal_Int32( nTopDockingAreaSize ))); + + sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) ); + sal_Int32 nDockWidth = std::max( static_cast<sal_Int32>(aDockingAreaRect.getWidth()), sal_Int32( 0 )); + if ( nDockWidth == 0 ) + { + sal_Int32 nPosX( std::max( aDockingAreaRect.Left(), aDockingAreaRect.Right() )); + if ( eDockedArea == ui::DockingArea_DOCKINGAREA_RIGHT ) + nPosX -= rTrackingRect.getWidth(); + rTrackingRect.SetPos( Point( nPosX, nPosY )); + rUIElement.m_aDockedData.m_aPos.X() = 0; + } + else if ( rMousePos.X() < ( aDockingAreaRect.Left() + ( nDockWidth / 2 ))) + { + rTrackingRect.SetPos( Point( aDockingAreaRect.Left() - rTrackingRect.getWidth(), nPosY )); + if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT ) + rUIElement.m_aDockedData.m_aPos.X() = 0; + else + rUIElement.m_aDockedData.m_aPos.X() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + rDockingOperation = DOCKOP_BEFORE_COLROW; + } + else + { + rTrackingRect.SetPos( Point( aDockingAreaRect.Right(), nPosY )); + if ( eDockedArea == ui::DockingArea_DOCKINGAREA_LEFT ) + rUIElement.m_aDockedData.m_aPos.X() = ( nMaxRowCol >= 0 ) ? nMaxRowCol+1 : 0; + else + rUIElement.m_aDockedData.m_aPos.X() = 0; + rDockingOperation = DOCKOP_AFTER_COLROW; + } + rTrackingRect.setHeight( nSize ); + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + nPosY = pDockingAreaWindow->ScreenToOutputPixel( + pContainerWindow->OutputToScreenPixel( rTrackingRect.TopLeft() )).Y(); + } + rUIElement.m_aDockedData.m_aPos.Y() = nPosY; + } + } +} + +framework::ToolbarLayoutManager::DockingOperation ToolbarLayoutManager::implts_determineDockingOperation( + ui::DockingArea DockingArea, + const ::Rectangle& rRowColRect, + const Point& rMousePos ) +{ + const sal_Int32 nHorzVerticalRegionSize = 6; + const sal_Int32 nHorzVerticalMoveRegion = 4; + + if ( rRowColRect.IsInside( rMousePos )) + { + if ( isHorizontalDockingArea( DockingArea )) + { + sal_Int32 nRegion = rRowColRect.getHeight() / nHorzVerticalRegionSize; + sal_Int32 nPosY = rRowColRect.Top() + nRegion; + + if ( rMousePos.Y() < nPosY ) + return ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) ? DOCKOP_BEFORE_COLROW : DOCKOP_AFTER_COLROW; + else if ( rMousePos.Y() < ( nPosY + nRegion*nHorzVerticalMoveRegion )) + return DOCKOP_ON_COLROW; + else + return ( DockingArea == ui::DockingArea_DOCKINGAREA_TOP ) ? DOCKOP_AFTER_COLROW : DOCKOP_BEFORE_COLROW; + } + else + { + sal_Int32 nRegion = rRowColRect.getWidth() / nHorzVerticalRegionSize; + sal_Int32 nPosX = rRowColRect.Left() + nRegion; + + if ( rMousePos.X() < nPosX ) + return ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) ? DOCKOP_BEFORE_COLROW : DOCKOP_AFTER_COLROW; + else if ( rMousePos.X() < ( nPosX + nRegion*nHorzVerticalMoveRegion )) + return DOCKOP_ON_COLROW; + else + return ( DockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) ? DOCKOP_AFTER_COLROW : DOCKOP_BEFORE_COLROW; + } + } + else + return DOCKOP_ON_COLROW; +} + +::Rectangle ToolbarLayoutManager::implts_calcTrackingAndElementRect( + ui::DockingArea eDockingArea, + sal_Int32 nRowCol, + UIElement& rUIElement, + const ::Rectangle& rTrackingRect, + const ::Rectangle& rRowColumnRect, + const ::Size& rContainerWinSize ) +{ + ReadGuard aReadGuard( m_aLock ); + ::Rectangle aDockingAreaOffsets( m_aDockingAreaOffsets ); + aReadGuard.unlock(); + + bool bHorizontalDockArea( isHorizontalDockingArea( eDockingArea )); + sal_Int32 nTopDockingAreaSize( implts_getTopBottomDockingAreaSizes().Width() ); + sal_Int32 nBottomDockingAreaSize( implts_getTopBottomDockingAreaSizes().Height() ); + + sal_Int32 nMaxLeftRightDockAreaSize = rContainerWinSize.Height() - + nTopDockingAreaSize - + nBottomDockingAreaSize - + aDockingAreaOffsets.Top() - + aDockingAreaOffsets.Bottom(); + + ::Rectangle aTrackingRect( rTrackingRect ); + if ( bHorizontalDockArea ) + { + sal_Int32 nPosX( std::max( sal_Int32( rTrackingRect.Left()), sal_Int32( 0 ))); + if (( nPosX + rTrackingRect.getWidth()) > rContainerWinSize.Width() ) + nPosX = std::min( nPosX, + std::max( sal_Int32( rContainerWinSize.Width() - rTrackingRect.getWidth() ), + sal_Int32( 0 ))); + + sal_Int32 nSize = std::min( rContainerWinSize.Width(), rTrackingRect.getWidth() ); + + aTrackingRect.SetPos( ::Point( nPosX, rRowColumnRect.Top() )); + aTrackingRect.setWidth( nSize ); + aTrackingRect.setHeight( rRowColumnRect.getHeight() ); + + // Set virtual position + rUIElement.m_aDockedData.m_aPos.X() = nPosX; + rUIElement.m_aDockedData.m_aPos.Y() = nRowCol; + } + else + { + sal_Int32 nMaxDockingAreaHeight = std::max( sal_Int32( 0 ), + sal_Int32( nMaxLeftRightDockAreaSize )); + + sal_Int32 nPosY( std::max( sal_Int32( aTrackingRect.Top()), sal_Int32( nTopDockingAreaSize ))); + if (( nPosY + aTrackingRect.getHeight()) > ( nTopDockingAreaSize + nMaxDockingAreaHeight )) + nPosY = std::min( nPosY, + std::max( sal_Int32( nTopDockingAreaSize + ( nMaxDockingAreaHeight - aTrackingRect.getHeight() )), + sal_Int32( nTopDockingAreaSize ))); + + sal_Int32 nSize = std::min( nMaxDockingAreaHeight, static_cast<sal_Int32>(aTrackingRect.getHeight()) ); + + aTrackingRect.SetPos( ::Point( rRowColumnRect.Left(), nPosY )); + aTrackingRect.setWidth( rRowColumnRect.getWidth() ); + aTrackingRect.setHeight( nSize ); + + aReadGuard.lock(); + uno::Reference< awt::XWindow > xDockingAreaWindow( m_xDockAreaWindows[eDockingArea] ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + aReadGuard.unlock(); + + sal_Int32 nDockPosY( 0 ); + Window* pDockingAreaWindow( 0 ); + Window* pContainerWindow( 0 ); + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pDockingAreaWindow = VCLUnoHelper::GetWindow( xDockingAreaWindow ); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + nDockPosY = pDockingAreaWindow->ScreenToOutputPixel( pContainerWindow->OutputToScreenPixel( ::Point( 0, nPosY ))).Y(); + } + + // Set virtual position + rUIElement.m_aDockedData.m_aPos.X() = nRowCol; + rUIElement.m_aDockedData.m_aPos.Y() = nDockPosY; + } + + return aTrackingRect; +} + +void ToolbarLayoutManager::implts_setTrackingRect( ui::DockingArea eDockingArea, const ::Point& rMousePos, ::Rectangle& rTrackingRect ) +{ + ::Point aPoint( rTrackingRect.TopLeft()); + if ( isHorizontalDockingArea( eDockingArea )) + aPoint.X() = rMousePos.X(); + else + aPoint.Y() = rMousePos.Y(); + rTrackingRect.SetPos( aPoint ); +} + +void ToolbarLayoutManager::implts_renumberRowColumnData( + ui::DockingArea eDockingArea, + DockingOperation /*eDockingOperation*/, + const UIElement& rUIElement ) +{ + ReadGuard aReadLock( m_aLock ); + uno::Reference< container::XNameAccess > xPersistentWindowState( m_xPersistentWindowState ); + aReadLock.unlock(); + + bool bHorzDockingArea( isHorizontalDockingArea( eDockingArea )); + sal_Int32 nRowCol( bHorzDockingArea ? rUIElement.m_aDockedData.m_aPos.Y() : rUIElement.m_aDockedData.m_aPos.X() ); + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + WriteGuard aWriteLock( m_aLock ); + UIElementVector::iterator pIter; + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if (( pIter->m_aDockedData.m_nDockedArea == sal_Int16( eDockingArea )) && ( pIter->m_aName != rUIElement.m_aName )) + { + // Don't change toolbars without a valid docking position! + if ( isDefaultPos( pIter->m_aDockedData.m_aPos )) + continue; + + sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? pIter->m_aDockedData.m_aPos.Y() : pIter->m_aDockedData.m_aPos.X(); + if ( nWindowRowCol >= nRowCol ) + { + if ( bHorzDockingArea ) + pIter->m_aDockedData.m_aPos.Y() += 1; + else + pIter->m_aDockedData.m_aPos.X() += 1; + } + } + } + aWriteLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + // We have to change the persistent window state part + if ( xPersistentWindowState.is() ) + { + try + { + uno::Sequence< ::rtl::OUString > aWindowElements = xPersistentWindowState->getElementNames(); + for ( sal_Int32 i = 0; i < aWindowElements.getLength(); i++ ) + { + if ( rUIElement.m_aName != aWindowElements[i] ) + { + try + { + uno::Sequence< beans::PropertyValue > aPropValueSeq; + awt::Point aDockedPos; + ui::DockingArea nDockedArea( ui::DockingArea_DOCKINGAREA_DEFAULT ); + + xPersistentWindowState->getByName( aWindowElements[i] ) >>= aPropValueSeq; + for ( sal_Int32 j = 0; j < aPropValueSeq.getLength(); j++ ) + { + if ( aPropValueSeq[j].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKINGAREA )) + aPropValueSeq[j].Value >>= nDockedArea; + else if ( aPropValueSeq[j].Name.equalsAscii( WINDOWSTATE_PROPERTY_DOCKPOS )) + aPropValueSeq[j].Value >>= aDockedPos; + } + + // Don't change toolbars without a valid docking position! + if ( isDefaultPos( aDockedPos )) + continue; + + sal_Int32 nWindowRowCol = ( bHorzDockingArea ) ? aDockedPos.Y : aDockedPos.X; + if (( nDockedArea == eDockingArea ) && ( nWindowRowCol >= nRowCol )) + { + if ( bHorzDockingArea ) + aDockedPos.Y += 1; + else + aDockedPos.X += 1; + + uno::Reference< container::XNameReplace > xReplace( xPersistentWindowState, uno::UNO_QUERY ); + xReplace->replaceByName( aWindowElements[i], makeAny( aPropValueSeq )); + } + } + catch ( uno::Exception& ) {} + } + } + } + catch ( uno::Exception& ) {} + } +} + +//--------------------------------------------------------------------------------------------------------- +// XWindowListener +//--------------------------------------------------------------------------------------------------------- +void SAL_CALL ToolbarLayoutManager::windowResized( const awt::WindowEvent& aEvent ) +throw( uno::RuntimeException ) +{ + WriteGuard aWriteLock( m_aLock ); + bool bLocked( m_bDockingInProgress ); + bool bLayoutInProgress( m_bLayoutInProgress ); + aWriteLock.unlock(); + + // Do not do anything if we are in the middle of a docking process. This would interfere all other + // operations. We will store the new position and size in the docking handlers. + // Do not do anything if we are in the middle of our layouting process. We will adapt the position + // and size of the user interface elements. + if ( !bLocked && !bLayoutInProgress ) + { + bool bNotify( false ); + uno::Reference< awt::XWindow > xWindow( aEvent.Source, uno::UNO_QUERY ); + + UIElement aUIElement = implts_findToolbar( aEvent.Source ); + if ( aUIElement.m_xUIElement.is() ) + { + if ( aUIElement.m_bFloating ) + { + uno::Reference< awt::XWindow2 > xWindow2( xWindow, uno::UNO_QUERY ); + + if( xWindow2.is() ) + { + awt::Rectangle aPos = xWindow2->getPosSize(); + awt::Size aSize = xWindow2->getOutputSize(); // always use output size for consistency + bool bVisible = xWindow2->isVisible(); + + // update element data + aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); + aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + aUIElement.m_bVisible = bVisible; + } + + implts_writeWindowStateData( aUIElement ); + } + else + { + implts_setLayoutDirty(); + bNotify = true; + } + } + + if ( bNotify ) + m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED ); + } +} + +void SAL_CALL ToolbarLayoutManager::windowMoved( const awt::WindowEvent& /*aEvent*/ ) +throw( uno::RuntimeException ) +{ +} + +void SAL_CALL ToolbarLayoutManager::windowShown( const lang::EventObject& /*aEvent*/ ) +throw( uno::RuntimeException ) +{ +} + +void SAL_CALL ToolbarLayoutManager::windowHidden( const lang::EventObject& /*aEvent*/ ) +throw( uno::RuntimeException ) +{ +} + +//--------------------------------------------------------------------------------------------------------- +// XDockableWindowListener +//--------------------------------------------------------------------------------------------------------- +void SAL_CALL ToolbarLayoutManager::startDocking( const awt::DockingEvent& e ) +throw (uno::RuntimeException) +{ + bool bWinFound( false ); + + ReadGuard aReadGuard( m_aLock ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + uno::Reference< awt::XWindow2 > xWindow( e.Source, uno::UNO_QUERY ); + aReadGuard.unlock(); + + Window* pContainerWindow( 0 ); + Window* pWindow( 0 ); + ::Point aMousePos; + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); + aMousePos = pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y )); + } + + UIElement aUIElement = implts_findToolbar( e.Source ); + + if ( aUIElement.m_xUIElement.is() && xWindow.is() ) + { + awt::Rectangle aRect; + + bWinFound = true; + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xDockWindow->isFloating() ) + { + awt::Rectangle aPos = xWindow->getPosSize(); + awt::Size aSize = xWindow->getOutputSize(); + + aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); + aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + { + ToolBox* pToolBox = (ToolBox *)pWindow; + aUIElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); + aUIElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); + } + } + } + + WriteGuard aWriteLock( m_aLock ); + m_bDockingInProgress = bWinFound; + m_aDockUIElement = aUIElement; + m_aDockUIElement.m_bUserActive = true; + m_aStartDockMousePos = aMousePos; + aWriteLock.unlock(); +} + +awt::DockingData SAL_CALL ToolbarLayoutManager::docking( const awt::DockingEvent& e ) +throw (uno::RuntimeException) +{ + const sal_Int32 MAGNETIC_DISTANCE_UNDOCK = 25; + const sal_Int32 MAGNETIC_DISTANCE_DOCK = 20; + + ReadGuard aReadLock( m_aLock ); + awt::DockingData aDockingData; + uno::Reference< awt::XDockableWindow > xDockWindow( e.Source, uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY ); + uno::Reference< awt::XWindow > xTopDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_TOP] ); + uno::Reference< awt::XWindow > xLeftDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_LEFT] ); + uno::Reference< awt::XWindow > xRightDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_RIGHT] ); + uno::Reference< awt::XWindow > xBottomDockingWindow( m_xDockAreaWindows[ui::DockingArea_DOCKINGAREA_BOTTOM] ); + uno::Reference< awt::XWindow2 > xContainerWindow( m_xContainerWindow ); + UIElement aUIDockingElement( m_aDockUIElement ); + DockingOperation eDockingOperation( DOCKOP_ON_COLROW ); + bool bDockingInProgress( m_bDockingInProgress ); + aReadLock.unlock(); + + if ( bDockingInProgress ) + aDockingData.TrackingRectangle = e.TrackingRectangle; + + if ( bDockingInProgress && xDockWindow.is() && xWindow.is() ) + { + try + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + + sal_Int16 eDockingArea( -1 ); // none + sal_Int32 nMagneticZone( aUIDockingElement.m_bFloating ? MAGNETIC_DISTANCE_DOCK : MAGNETIC_DISTANCE_UNDOCK ); + awt::Rectangle aNewTrackingRect; + ::Rectangle aTrackingRect( e.TrackingRectangle.X, e.TrackingRectangle.Y, + ( e.TrackingRectangle.X + e.TrackingRectangle.Width ), + ( e.TrackingRectangle.Y + e.TrackingRectangle.Height )); + + awt::Rectangle aTmpRect = xTopDockingWindow->getPosSize(); + ::Rectangle aTopDockRect( aTmpRect.X, aTmpRect.Y, aTmpRect.Width, aTmpRect.Height ); + ::Rectangle aHotZoneTopDockRect( implts_calcHotZoneRect( aTopDockRect, nMagneticZone )); + + aTmpRect = xBottomDockingWindow->getPosSize(); + ::Rectangle aBottomDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width), ( aTmpRect.Y + aTmpRect.Height )); + ::Rectangle aHotZoneBottomDockRect( implts_calcHotZoneRect( aBottomDockRect, nMagneticZone )); + + aTmpRect = xLeftDockingWindow->getPosSize(); + ::Rectangle aLeftDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height )); + ::Rectangle aHotZoneLeftDockRect( implts_calcHotZoneRect( aLeftDockRect, nMagneticZone )); + + aTmpRect = xRightDockingWindow->getPosSize(); + ::Rectangle aRightDockRect( aTmpRect.X, aTmpRect.Y, ( aTmpRect.X + aTmpRect.Width ), ( aTmpRect.Y + aTmpRect.Height )); + ::Rectangle aHotZoneRightDockRect( implts_calcHotZoneRect( aRightDockRect, nMagneticZone )); + + Window* pContainerWindow( VCLUnoHelper::GetWindow( xContainerWindow ) ); + Window* pDockingAreaWindow( 0 ); + ::Point aMousePos( pContainerWindow->ScreenToOutputPixel( ::Point( e.MousePos.X, e.MousePos.Y ))); + + if ( aHotZoneTopDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_TOP; + else if ( aHotZoneBottomDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_BOTTOM; + else if ( aHotZoneLeftDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_LEFT; + else if ( aHotZoneRightDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_RIGHT; + + // Higher priority for movements inside the real docking area + if ( aTopDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_TOP; + else if ( aBottomDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_BOTTOM; + else if ( aLeftDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_LEFT; + else if ( aRightDockRect.IsInside( aMousePos )) + eDockingArea = ui::DockingArea_DOCKINGAREA_RIGHT; + + // Determine if we have a toolbar and set alignment according to the docking area! + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + ToolBox* pToolBox = 0; + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + pToolBox = (ToolBox *)pWindow; + + if ( eDockingArea != -1 ) + { + if ( eDockingArea == ui::DockingArea_DOCKINGAREA_TOP ) + { + aUIDockingElement.m_aDockedData.m_nDockedArea = ui::DockingArea_DOCKINGAREA_TOP; + aUIDockingElement.m_bFloating = false; + pDockingAreaWindow = VCLUnoHelper::GetWindow( xTopDockingWindow ); + } + else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) + { + aUIDockingElement.m_aDockedData.m_nDockedArea = ui::DockingArea_DOCKINGAREA_BOTTOM; + aUIDockingElement.m_bFloating = false; + pDockingAreaWindow = VCLUnoHelper::GetWindow( xBottomDockingWindow ); + } + else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_LEFT ) + { + aUIDockingElement.m_aDockedData.m_nDockedArea = ui::DockingArea_DOCKINGAREA_LEFT; + aUIDockingElement.m_bFloating = false; + pDockingAreaWindow = VCLUnoHelper::GetWindow( xLeftDockingWindow ); + } + else if ( eDockingArea == ui::DockingArea_DOCKINGAREA_RIGHT ) + { + aUIDockingElement.m_aDockedData.m_nDockedArea = ui::DockingArea_DOCKINGAREA_RIGHT; + aUIDockingElement.m_bFloating = false; + pDockingAreaWindow = VCLUnoHelper::GetWindow( xRightDockingWindow ); + } + + ::Point aOutputPos = pContainerWindow->ScreenToOutputPixel( aTrackingRect.TopLeft() ); + aTrackingRect.SetPos( aOutputPos ); + + ::Rectangle aNewDockingRect( aTrackingRect ); + implts_calcDockingPosSize( aUIDockingElement, eDockingOperation, aNewDockingRect, aMousePos ); + + ::Point aScreenPos = pContainerWindow->OutputToScreenPixel( aNewDockingRect.TopLeft() ); + aNewTrackingRect = awt::Rectangle( aScreenPos.X(), aScreenPos.Y(), + aNewDockingRect.getWidth(), aNewDockingRect.getHeight() ); + aDockingData.TrackingRectangle = aNewTrackingRect; + } + else if ( pToolBox && bDockingInProgress ) + { + bool bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); + ::Size aFloatSize = aUIDockingElement.m_aFloatingData.m_aSize; + if ( aFloatSize.Width() > 0 && aFloatSize.Height() > 0 ) + { + aUIDockingElement.m_aFloatingData.m_aPos = pContainerWindow->ScreenToOutputPixel( + ::Point( e.MousePos.X, e.MousePos.Y )); + aDockingData.TrackingRectangle.Height = aFloatSize.Height(); + aDockingData.TrackingRectangle.Width = aFloatSize.Width(); + } + else + { + aFloatSize = pToolBox->CalcWindowSizePixel(); + if ( !bIsHorizontal ) + { + // Floating toolbars are always horizontal aligned! We have to swap + // width/height if we have a vertical aligned toolbar. + sal_Int32 nTemp = aFloatSize.Height(); + aFloatSize.Height() = aFloatSize.Width(); + aFloatSize.Width() = nTemp; + } + + aDockingData.TrackingRectangle.Height = aFloatSize.Height(); + aDockingData.TrackingRectangle.Width = aFloatSize.Width(); + + // For the first time we don't have any data about the floating size of a toolbar. + // We calculate it and store it for later use. + aUIDockingElement.m_aFloatingData.m_aPos = pContainerWindow->ScreenToOutputPixel(::Point( e.MousePos.X, e.MousePos.Y )); + aUIDockingElement.m_aFloatingData.m_aSize = aFloatSize; + aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); + aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); + } + aDockingData.TrackingRectangle.X = e.MousePos.X; + aDockingData.TrackingRectangle.Y = e.MousePos.Y; + } + + aDockingData.bFloating = ( eDockingArea == -1 ); + + // Write current data to the member docking progress data + WriteGuard aWriteLock( m_aLock ); + m_aDockUIElement.m_bFloating = aDockingData.bFloating; + if ( !aDockingData.bFloating ) + { + m_aDockUIElement.m_aDockedData = aUIDockingElement.m_aDockedData; + m_eDockOperation = eDockingOperation; + } + else + m_aDockUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData; + aWriteLock.unlock(); + } + catch ( uno::Exception& ) {} + } + + return aDockingData; +} + +void SAL_CALL ToolbarLayoutManager::endDocking( const awt::EndDockingEvent& e ) +throw (uno::RuntimeException) +{ + bool bDockingInProgress( false ); + bool bStartDockFloated( false ); + bool bFloating( false ); + UIElement aUIDockingElement; + + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + WriteGuard aWriteLock( m_aLock ); + bDockingInProgress = m_bDockingInProgress; + aUIDockingElement = m_aDockUIElement; + bFloating = aUIDockingElement.m_bFloating; + + UIElement& rUIElement = impl_findToolbar( aUIDockingElement.m_aName ); + if ( rUIElement.m_aName == aUIDockingElement.m_aName ) + { + if ( aUIDockingElement.m_bFloating ) + { + // Write last position into position data + uno::Reference< awt::XWindow > xWindow( aUIDockingElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + rUIElement.m_aFloatingData = aUIDockingElement.m_aFloatingData; + awt::Rectangle aTmpRect = xWindow->getPosSize(); + rUIElement.m_aFloatingData.m_aPos = ::Point( aTmpRect.X, aTmpRect.Y ); + // make changes also for our local data as we use it to make data persistent + aUIDockingElement.m_aFloatingData = rUIElement.m_aFloatingData; + } + else + { + rUIElement.m_aDockedData = aUIDockingElement.m_aDockedData; + rUIElement.m_aFloatingData.m_aSize = aUIDockingElement.m_aFloatingData.m_aSize; + + if ( m_eDockOperation != DOCKOP_ON_COLROW ) + { + // we have to renumber our row/column data to insert a new row/column + implts_renumberRowColumnData((ui::DockingArea)aUIDockingElement.m_aDockedData.m_nDockedArea, m_eDockOperation, aUIDockingElement ); + } + } + + bStartDockFloated = rUIElement.m_bFloating; + rUIElement.m_bFloating = m_aDockUIElement.m_bFloating; + rUIElement.m_bUserActive = true; + } + + // reset member for next docking operation + m_aDockUIElement.m_xUIElement.clear(); + m_eDockOperation = DOCKOP_ON_COLROW; + aWriteLock.unlock(); + /* SAFE AREA ----------------------------------------------------------------------------------------------- */ + + implts_writeWindowStateData( aUIDockingElement ); + + if ( bDockingInProgress ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( uno::Reference< awt::XWindow >( e.Source, uno::UNO_QUERY )); + ToolBox* pToolBox = 0; + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + pToolBox = (ToolBox *)pWindow; + + if ( pToolBox ) + { + if( e.bFloating ) + { + if ( aUIDockingElement.m_aFloatingData.m_bIsHorizontal ) + pToolBox->SetAlign( WINDOWALIGN_TOP ); + else + pToolBox->SetAlign( WINDOWALIGN_LEFT ); + } + else + { + ::Size aSize; + + pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) ); + + // Docked toolbars have always one line + aSize = pToolBox->CalcWindowSizePixel( 1 ); + + // Lock layouting updates as our listener would be called due to SetSizePixel + pToolBox->SetOutputSizePixel( aSize ); + } + } + } + + implts_sortUIElements(); + + aWriteLock.lock(); + m_bDockingInProgress = sal_False; + m_bLayoutDirty = !bStartDockFloated || !bFloating; + bool bNotify = m_bLayoutDirty; + aWriteLock.unlock(); + + if ( bNotify ) + m_pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED ); +} + +sal_Bool SAL_CALL ToolbarLayoutManager::prepareToggleFloatingMode( const lang::EventObject& e ) +throw (uno::RuntimeException) +{ + ReadGuard aReadLock( m_aLock ); + bool bDockingInProgress = m_bDockingInProgress; + aReadLock.unlock(); + + UIElement aUIDockingElement = implts_findToolbar( e.Source ); + bool bWinFound( aUIDockingElement.m_aName.getLength() > 0 ); + uno::Reference< awt::XWindow > xWindow( e.Source, uno::UNO_QUERY ); + + if ( bWinFound && xWindow.is() ) + { + if ( !bDockingInProgress ) + { + awt::Rectangle aRect; + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + if ( xDockWindow->isFloating() ) + { + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( xWindow ); + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + { + ToolBox* pToolBox = static_cast< ToolBox *>( pWindow ); + aUIDockingElement.m_aFloatingData.m_aPos = pToolBox->GetPosPixel(); + aUIDockingElement.m_aFloatingData.m_aSize = pToolBox->GetOutputSizePixel(); + aUIDockingElement.m_aFloatingData.m_nLines = pToolBox->GetFloatingLines(); + aUIDockingElement.m_aFloatingData.m_bIsHorizontal = isToolboxHorizontalAligned( pToolBox ); + } + } + + UIElement aUIElement = implts_findToolbar( aUIDockingElement.m_aName ); + if ( aUIElement.m_aName == aUIDockingElement.m_aName ) + implts_setToolbar( aUIDockingElement ); + } + } + } + + return sal_True; +} + +void SAL_CALL ToolbarLayoutManager::toggleFloatingMode( const lang::EventObject& e ) +throw (uno::RuntimeException) +{ + UIElement aUIDockingElement; + + ReadGuard aReadLock( m_aLock ); + bool bDockingInProgress( m_bDockingInProgress ); + if ( bDockingInProgress ) + aUIDockingElement = m_aDockUIElement; + aReadLock.unlock(); + + Window* pWindow( 0 ); + ToolBox* pToolBox( 0 ); + uno::Reference< awt::XWindow2 > xWindow; + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + xWindow = uno::Reference< awt::XWindow2 >( e.Source, uno::UNO_QUERY ); + pWindow = VCLUnoHelper::GetWindow( xWindow ); + + if ( pWindow && pWindow->GetType() == WINDOW_TOOLBOX ) + pToolBox = (ToolBox *)pWindow; + } + + if ( !bDockingInProgress ) + { + aUIDockingElement = implts_findToolbar( e.Source ); + bool bWinFound = ( aUIDockingElement.m_aName.getLength() > 0 ); + + if ( bWinFound && xWindow.is() ) + { + aUIDockingElement.m_bFloating = !aUIDockingElement.m_bFloating; + aUIDockingElement.m_bUserActive = true; + + implts_setLayoutInProgress( true ); + if ( aUIDockingElement.m_bFloating ) + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pToolBox ) + { + pToolBox->SetLineCount( aUIDockingElement.m_aFloatingData.m_nLines ); + if ( aUIDockingElement.m_aFloatingData.m_bIsHorizontal ) + pToolBox->SetAlign( WINDOWALIGN_TOP ); + else + pToolBox->SetAlign( WINDOWALIGN_LEFT ); + } + + bool bUndefPos = hasDefaultPosValue( aUIDockingElement.m_aFloatingData.m_aPos ); + bool bSetSize = !hasEmptySize( aUIDockingElement.m_aFloatingData.m_aSize ); + + if ( bUndefPos ) + aUIDockingElement.m_aFloatingData.m_aPos = implts_findNextCascadeFloatingPos(); + + if ( !bSetSize ) + { + if ( pToolBox ) + aUIDockingElement.m_aFloatingData.m_aSize = pToolBox->CalcFloatingWindowSizePixel(); + else + aUIDockingElement.m_aFloatingData.m_aSize = pWindow->GetOutputSizePixel(); + } + + xWindow->setPosSize( aUIDockingElement.m_aFloatingData.m_aPos.X(), + aUIDockingElement.m_aFloatingData.m_aPos.Y(), + 0, 0, awt::PosSize::POS ); + xWindow->setOutputSize( AWTSize( aUIDockingElement.m_aFloatingData.m_aSize ) ); + } + else + { + if ( isDefaultPos( aUIDockingElement.m_aDockedData.m_aPos )) + { + // Docking on its default position without a preset position - + // we have to find a good place for it. + ::Point aPixelPos; + ::Point aDockPos; + ::Size aSize; + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pToolBox ) + aSize = pToolBox->CalcWindowSizePixel( 1, ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea ) ); + else + aSize = pWindow->GetSizePixel(); + } + + implts_findNextDockingPos((ui::DockingArea)aUIDockingElement.m_aDockedData.m_nDockedArea, aSize, aDockPos, aPixelPos ); + aUIDockingElement.m_aDockedData.m_aPos = aDockPos; + } + + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pToolBox ) + { + pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) ); + ::Size aSize = pToolBox->CalcWindowSizePixel( 1 ); + awt::Rectangle aRect = xWindow->getPosSize(); + xWindow->setPosSize( aRect.X, aRect.Y, 0, 0, awt::PosSize::POS ); + xWindow->setOutputSize( AWTSize( aSize ) ); + } + } + + implts_setLayoutInProgress( false ); + implts_setToolbar( aUIDockingElement ); + implts_writeWindowStateData( aUIDockingElement ); + implts_sortUIElements(); + implts_setLayoutDirty(); + + aReadLock.lock(); + ILayoutNotifications* pParentLayouter( m_pParentLayouter ); + aReadLock.unlock(); + + if ( pParentLayouter ) + pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED ); + } + } + else + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pToolBox ) + { + if ( aUIDockingElement.m_bFloating ) + { + if ( aUIDockingElement.m_aFloatingData.m_bIsHorizontal ) + pToolBox->SetAlign( WINDOWALIGN_TOP ); + else + pToolBox->SetAlign( WINDOWALIGN_LEFT ); + } + else + pToolBox->SetAlign( ImplConvertAlignment( aUIDockingElement.m_aDockedData.m_nDockedArea) ); + } + } +} + +void SAL_CALL ToolbarLayoutManager::closed( const lang::EventObject& e ) +throw (uno::RuntimeException) +{ + rtl::OUString aName; + UIElement aUIElement; + UIElementVector::iterator pIter; + + WriteGuard aWriteLock( m_aLock ); + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + uno::Reference< ui::XUIElement > xUIElement( pIter->m_xUIElement ); + if ( xUIElement.is() ) + { + uno::Reference< uno::XInterface > xIfac( xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xIfac == e.Source ) + { + aName = pIter->m_aName; + + // user closes a toolbar => + // context sensitive toolbar: only destroy toolbar and store state. + // context sensitive toolbar: make it invisible, store state and destroy it. + if ( !pIter->m_bContextSensitive ) + pIter->m_bVisible = sal_False; + + aUIElement = *pIter; + break; + } + } + } + aWriteLock.unlock(); + + // destroy element + if ( aName.getLength() > 0 ) + { + implts_writeWindowStateData( aUIElement ); + destroyToolbar( aName ); + } +} + +void SAL_CALL ToolbarLayoutManager::endPopupMode( const awt::EndPopupModeEvent& /*e*/ ) +throw (uno::RuntimeException) +{ +} + +//--------------------------------------------------------------------------------------------------------- +// XUIConfigurationListener +//--------------------------------------------------------------------------------------------------------- +void SAL_CALL ToolbarLayoutManager::elementInserted( const ui::ConfigurationEvent& rEvent ) +throw (uno::RuntimeException) +{ + UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL ); + + uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY ); + if ( xElementSettings.is() ) + { + ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); + uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); + if ( xPropSet.is() ) + { + if ( rEvent.Source == uno::Reference< uno::XInterface >( m_xDocCfgMgr, uno::UNO_QUERY )) + xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( m_xDocCfgMgr )); + } + xElementSettings->updateSettings(); + } + else + { + ::rtl::OUString aElementType; + ::rtl::OUString aElementName; + parseResourceURL( rEvent.ResourceURL, aElementType, aElementName ); + if ( aElementName.indexOf( m_aCustomTbxPrefix ) != -1 ) + { + // custom toolbar must be directly created, shown and layouted! + createToolbar( rEvent.ResourceURL ); + uno::Reference< ui::XUIElement > xUIElement = getToolbar( rEvent.ResourceURL ); + if ( xUIElement.is() ) + { + ::rtl::OUString aUIName; + uno::Reference< ui::XUIConfigurationManager > xCfgMgr; + uno::Reference< beans::XPropertySet > xPropSet; + + try + { + xCfgMgr = uno::Reference< ui::XUIConfigurationManager >( rEvent.Source, uno::UNO_QUERY ); + xPropSet = uno::Reference< beans::XPropertySet >( xCfgMgr->getSettings( rEvent.ResourceURL, sal_False ), uno::UNO_QUERY ); + + if ( xPropSet.is() ) + xPropSet->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UIName" ))) >>= aUIName; + } + catch ( container::NoSuchElementException& ) {} + catch ( beans::UnknownPropertyException& ) {} + catch ( lang::WrappedTargetException& ) {} + + { + vos::OGuard aGuard( Application::GetSolarMutex() ); + Window* pWindow = getWindowFromXUIElement( xUIElement ); + if ( pWindow ) + pWindow->SetText( aUIName ); + } + + showToolbar( rEvent.ResourceURL ); + } + } + } +} + +void SAL_CALL ToolbarLayoutManager::elementRemoved( const ui::ConfigurationEvent& rEvent ) +throw (uno::RuntimeException) +{ + ReadGuard aReadLock( m_aLock ); + uno::Reference< awt::XWindow > xContainerWindow( m_xContainerWindow, uno::UNO_QUERY ); + uno::Reference< ui::XUIConfigurationManager > xModuleCfgMgr( m_xModuleCfgMgr ); + uno::Reference< ui::XUIConfigurationManager > xDocCfgMgr( m_xDocCfgMgr ); + aReadLock.unlock(); + + UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL ); + uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY ); + if ( xElementSettings.is() ) + { + bool bNoSettings( false ); + ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); + uno::Reference< uno::XInterface > xElementCfgMgr; + uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); + + if ( xPropSet.is() ) + xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; + + if ( !xElementCfgMgr.is() ) + return; + + // Check if the same UI configuration manager has changed => check further + if ( rEvent.Source == xElementCfgMgr ) + { + // Same UI configuration manager where our element has its settings + if ( rEvent.Source == uno::Reference< uno::XInterface >( xDocCfgMgr, uno::UNO_QUERY )) + { + // document settings removed + if ( xModuleCfgMgr->hasSettings( rEvent.ResourceURL )) + { + xPropSet->setPropertyValue( aConfigSourcePropName, makeAny( xModuleCfgMgr )); + xElementSettings->updateSettings(); + return; + } + } + + bNoSettings = true; + } + + // No settings anymore, element must be destroyed + if ( xContainerWindow.is() && bNoSettings ) + destroyToolbar( rEvent.ResourceURL ); + } +} + +void SAL_CALL ToolbarLayoutManager::elementReplaced( const ui::ConfigurationEvent& rEvent ) +throw (uno::RuntimeException) +{ + UIElement aUIElement = implts_findToolbar( rEvent.ResourceURL ); + + uno::Reference< ui::XUIElementSettings > xElementSettings( aUIElement.m_xUIElement, uno::UNO_QUERY ); + if ( xElementSettings.is() ) + { + ::rtl::OUString aConfigSourcePropName( RTL_CONSTASCII_USTRINGPARAM( "ConfigurationSource" )); + uno::Reference< uno::XInterface > xElementCfgMgr; + uno::Reference< beans::XPropertySet > xPropSet( xElementSettings, uno::UNO_QUERY ); + + if ( xPropSet.is() ) + xPropSet->getPropertyValue( aConfigSourcePropName ) >>= xElementCfgMgr; + + if ( !xElementCfgMgr.is() ) + return; + + // Check if the same UI configuration manager has changed => update settings + if ( rEvent.Source == xElementCfgMgr ) + { + xElementSettings->updateSettings(); + + WriteGuard aWriteLock( m_aLock ); + bool bNotify = !aUIElement.m_bFloating; + m_bLayoutDirty = bNotify; + ILayoutNotifications* pParentLayouter( m_pParentLayouter ); + aWriteLock.unlock(); + + if ( bNotify && pParentLayouter ) + pParentLayouter->requestLayout( ILayoutNotifications::HINT_TOOLBARSPACE_HAS_CHANGED ); + } + } +} + +uno::Reference< ui::XUIElement > ToolbarLayoutManager::getToolbar( const ::rtl::OUString& aName ) +{ + return implts_findToolbar( aName ).m_xUIElement; +} + +uno::Sequence< uno::Reference< ui::XUIElement > > ToolbarLayoutManager::getToolbars() +{ + uno::Sequence< uno::Reference< ui::XUIElement > > aSeq; + + ReadGuard aReadLock( m_aLock ); + if ( m_aUIElements.size() > 0 ) + { + sal_uInt32 nCount(0); + UIElementVector::iterator pIter; + for ( pIter = m_aUIElements.begin(); pIter != m_aUIElements.end(); pIter++ ) + { + if ( pIter->m_xUIElement.is() ) + { + ++nCount; + aSeq.realloc( nCount ); + aSeq[nCount-1] = pIter->m_xUIElement; + } + } + } + + return aSeq; +} + +bool ToolbarLayoutManager::floatToolbar( const ::rtl::OUString& rResourceURL ) +{ + UIElement aUIElement = implts_findToolbar( rResourceURL ); + if ( aUIElement.m_xUIElement.is() ) + { + try + { + uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xDockWindow.is() && !xDockWindow->isFloating() ) + { + aUIElement.m_bFloating = true; + implts_writeWindowStateData( aUIElement ); + xDockWindow->setFloatingMode( true ); + + implts_setLayoutDirty(); + implts_setToolbar( aUIElement ); + return true; + } + } + catch ( lang::DisposedException& ) {} + } + + return false; +} + +bool ToolbarLayoutManager::lockToolbar( const ::rtl::OUString& rResourceURL ) +{ + UIElement aUIElement = implts_findToolbar( rResourceURL ); + if ( aUIElement.m_xUIElement.is() ) + { + try + { + uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xDockWindow.is() && !xDockWindow->isFloating() && !xDockWindow->isLocked() ) + { + aUIElement.m_aDockedData.m_bLocked = true; + implts_writeWindowStateData( aUIElement ); + xDockWindow->lock(); + + implts_setLayoutDirty(); + implts_setToolbar( aUIElement ); + return true; + } + } + catch ( lang::DisposedException& ) {} + } + + return false; +} + +bool ToolbarLayoutManager::unlockToolbar( const ::rtl::OUString& rResourceURL ) +{ + UIElement aUIElement = implts_findToolbar( rResourceURL ); + if ( aUIElement.m_xUIElement.is() ) + { + try + { + uno::Reference< awt::XDockableWindow > xDockWindow( aUIElement.m_xUIElement->getRealInterface(), uno::UNO_QUERY ); + if ( xDockWindow.is() && !xDockWindow->isFloating() && xDockWindow->isLocked() ) + { + aUIElement.m_aDockedData.m_bLocked = false; + implts_writeWindowStateData( aUIElement ); + xDockWindow->unlock(); + + implts_setLayoutDirty(); + implts_setToolbar( aUIElement ); + return true; + } + } + catch ( lang::DisposedException& ) {} + } + + return false; +} + +bool ToolbarLayoutManager::isToolbarVisible( const ::rtl::OUString& rResourceURL ) +{ + uno::Reference< awt::XWindow2 > xWindow2( implts_getXWindow( rResourceURL ), uno::UNO_QUERY ); + return ( xWindow2.is() && xWindow2->isVisible() ); +} + +bool ToolbarLayoutManager::isToolbarFloating( const ::rtl::OUString& rResourceURL ) +{ + uno::Reference< awt::XDockableWindow > xDockWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY ); + return ( xDockWindow.is() && xDockWindow->isFloating() ); +} + +bool ToolbarLayoutManager::isToolbarDocked( const ::rtl::OUString& rResourceURL ) +{ + return !isToolbarFloating( rResourceURL ); +} + +bool ToolbarLayoutManager::isToolbarLocked( const ::rtl::OUString& rResourceURL ) +{ + uno::Reference< awt::XDockableWindow > xDockWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY ); + return ( xDockWindow.is() && xDockWindow->isLocked() ); +} + +awt::Size ToolbarLayoutManager::getToolbarSize( const ::rtl::OUString& rResourceURL ) +{ + Window* pWindow = implts_getWindow( rResourceURL ); + + vos::OGuard aGuard( Application::GetSolarMutex() ); + if ( pWindow ) + { + ::Size aSize = pWindow->GetSizePixel(); + awt::Size aWinSize; + aWinSize.Width = aSize.Width(); + aWinSize.Height = aSize.Height(); + return aWinSize; + } + + return awt::Size(); +} + +awt::Point ToolbarLayoutManager::getToolbarPos( const ::rtl::OUString& rResourceURL ) +{ + awt::Point aPos; + UIElement aUIElement = implts_findToolbar( rResourceURL ); + + uno::Reference< awt::XWindow > xWindow( implts_getXWindow( rResourceURL )); + if ( xWindow.is() ) + { + if ( aUIElement.m_bFloating ) + { + awt::Rectangle aRect = xWindow->getPosSize(); + aPos.X = aRect.X; + aPos.Y = aRect.Y; + } + else + { + ::Point aVirtualPos = aUIElement.m_aDockedData.m_aPos; + aPos.X = aVirtualPos.X(); + aPos.Y = aVirtualPos.Y(); + } + } + + return aPos; +} + +void ToolbarLayoutManager::setToolbarSize( const ::rtl::OUString& rResourceURL, const awt::Size& aSize ) +{ + uno::Reference< awt::XWindow2 > xWindow( implts_getXWindow( rResourceURL ), uno::UNO_QUERY ); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + UIElement aUIElement = implts_findToolbar( rResourceURL ); + + if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() ) + { + xWindow->setOutputSize( aSize ); + aUIElement.m_aFloatingData.m_aSize = ::Size( aSize.Width, aSize.Height ); + implts_setToolbar( aUIElement ); + implts_writeWindowStateData( aUIElement ); + implts_sortUIElements(); + } +} + +void ToolbarLayoutManager::setToolbarPos( const ::rtl::OUString& rResourceURL, const awt::Point& aPos ) +{ + uno::Reference< awt::XWindow > xWindow( implts_getXWindow( rResourceURL )); + uno::Reference< awt::XDockableWindow > xDockWindow( xWindow, uno::UNO_QUERY ); + UIElement aUIElement = implts_findToolbar( rResourceURL ); + + if ( xWindow.is() && xDockWindow.is() && xDockWindow->isFloating() ) + { + xWindow->setPosSize( aPos.X, aPos.Y, 0, 0, awt::PosSize::POS ); + aUIElement.m_aFloatingData.m_aPos = ::Point( aPos.X, aPos.Y ); + implts_setToolbar( aUIElement ); + implts_writeWindowStateData( aUIElement ); + implts_sortUIElements(); + } +} + +void ToolbarLayoutManager::setToolbarPosSize( const ::rtl::OUString& rResourceURL, const awt::Point& aPos, const awt::Size& aSize ) +{ + setToolbarPos( rResourceURL, aPos ); + setToolbarSize( rResourceURL, aSize ); +} + +} // namespace framework diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.hxx b/framework/source/layoutmanager/toolbarlayoutmanager.hxx new file mode 100755 index 000000000000..baf6f088cc2e --- /dev/null +++ b/framework/source/layoutmanager/toolbarlayoutmanager.hxx @@ -0,0 +1,344 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef __FRAMEWORK_LAYOUTMANAGER_TOOLBARLAYOUTMANAGER_HXX_ +#define __FRAMEWORK_LAYOUTMANAGER_TOOLBARLAYOUTMANAGER_HXX_ + +/** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble + with solaris headers ... +*/ +#include <vector> + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ +#include <threadhelp/threadhelpbase.hxx> +#include <threadhelp/resetableguard.hxx> +#include <threadhelp/writeguard.hxx> +#include <threadhelp/readguard.hxx> +#include <macros/generic.hxx> +#include <macros/xinterface.hxx> +#include <macros/xtypeprovider.hxx> +#include <macros/xserviceinfo.hxx> +#include <stdtypes.h> +#include <properties.h> +#include <stdtypes.h> +#include <uiconfiguration/globalsettings.hxx> +#include <uiconfiguration/windowstateconfiguration.hxx> +#include <classes/addonsoptions.hxx> +#include <uielement/uielement.hxx> +#include <helper/ilayoutnotifications.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/frame/XLayoutManager.hpp> +#include <com/sun/star/ui/XUIConfigurationManager.hpp> +#include <com/sun/star/ui/XUIConfiguration.hpp> +#include <com/sun/star/frame/XModuleManager.hpp> +#include <com/sun/star/frame/XFrameActionListener.hpp> +#include <com/sun/star/awt/XWindowListener.hpp> +#include <com/sun/star/util/XURLTransformer.hpp> +#include <com/sun/star/ui/XUIElementFactory.hpp> +#include <com/sun/star/ui/DockingArea.hpp> +#include <com/sun/star/awt/XTopWindow2.hpp> +#include <com/sun/star/awt/XWindow2.hpp> +#include <com/sun/star/awt/XDockableWindow.hpp> +#include <com/sun/star/awt/XDockableWindowListener.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <cppuhelper/implbase3.hxx> + + +namespace framework +{ + +class ToolbarLayoutManager : public ::cppu::WeakImplHelper3< ::com::sun::star::awt::XDockableWindowListener, + ::com::sun::star::ui::XUIConfigurationListener, + ::com::sun::star::awt::XWindowListener >, + private ThreadHelpBase // Struct for right initalization of mutex member! Must be first of baseclasses. +{ + public: + enum { DOCKINGAREAS_COUNT = 4 }; + + ToolbarLayoutManager( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xSMGR, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElementFactory >& xUIElementFactory, + ILayoutNotifications* pParentLayouter ); + virtual ~ToolbarLayoutManager(); + + void reset(); + void attach( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >& xModuleCfgMgr, + const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager >& xDocCfgMgr, + const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& xPersistentWindowState ); + + void setParentWindow( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParentWindow ); + void setDockingAreaOffsets( const ::Rectangle aOffsets ); + + void resetDockingArea(); + + ::com::sun::star::awt::Rectangle getDockingArea(); + void setDockingArea( const ::com::sun::star::awt::Rectangle& rDockingArea ); + + // layouting + bool isLayoutDirty(); + void doLayout(const ::Size& aContainerSize); + + // creation/destruction + void createStaticToolbars(); + void destroyToolbars(); + + bool requestToolbar( const ::rtl::OUString& rResourceURL ); + bool createToolbar( const ::rtl::OUString& rResourceURL ); + bool destroyToolbar( const ::rtl::OUString& rResourceURL ); + + // visibility + bool showToolbar( const ::rtl::OUString& rResourceURL ); + bool hideToolbar( const ::rtl::OUString& rResourceURL ); + + void refreshToolbarsVisibility( bool bAutomaticToolbars ); + void setFloatingToolbarsVisibility( bool bVisible ); + void setVisible(bool bVisible); + bool isVisible() { return m_bVisible; } + + // docking and further functions + bool dockToolbar( const ::rtl::OUString& rResourceURL, ::com::sun::star::ui::DockingArea eDockingArea, const ::com::sun::star::awt::Point& aPos ); + bool dockAllToolbars(); + bool floatToolbar( const ::rtl::OUString& rResoureURL ); + bool lockToolbar( const ::rtl::OUString& rResourceURL ); + bool unlockToolbar( const ::rtl::OUString& rResourceURL ); + void setToolbarPos( const ::rtl::OUString& rResourceURL, const ::com::sun::star::awt::Point& aPos ); + void setToolbarSize( const ::rtl::OUString& rResourceURL, const ::com::sun::star::awt::Size& aSize ); + void setToolbarPosSize( const ::rtl::OUString& rResourceURL, const ::com::sun::star::awt::Point& aPos, const ::com::sun::star::awt::Size& aSize ); + bool isToolbarVisible( const ::rtl::OUString& rResourceURL ); + bool isToolbarFloating( const ::rtl::OUString& rResourceURL ); + bool isToolbarDocked( const ::rtl::OUString& rResourceURL ); + bool isToolbarLocked( const ::rtl::OUString& rResourceURL ); + ::com::sun::star::awt::Point getToolbarPos( const ::rtl::OUString& rResourceURL ); + ::com::sun::star::awt::Size getToolbarSize( const ::rtl::OUString& rResourceURL ); + ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > getToolbar( const ::rtl::OUString& aName ); + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement > > getToolbars(); + + // child window notifications + long childWindowEvent( VclSimpleEvent* pEvent ); + + //--------------------------------------------------------------------------------------------------------- + // XInterface + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw( ::com::sun::star::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XEventListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL windowResized( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowShown( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + virtual void SAL_CALL windowHidden( const css::lang::EventObject& aEvent ) throw( css::uno::RuntimeException ); + + //--------------------------------------------------------------------------------------------------------- + // XDockableWindowListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL startDocking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::DockingData SAL_CALL docking( const ::com::sun::star::awt::DockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endDocking( const ::com::sun::star::awt::EndDockingEvent& e ) throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL prepareToggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL toggleFloatingMode( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL closed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL endPopupMode( const ::com::sun::star::awt::EndPopupModeEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + //--------------------------------------------------------------------------------------------------------- + // XUIConfigurationListener + //--------------------------------------------------------------------------------------------------------- + virtual void SAL_CALL elementInserted( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementRemoved( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL elementReplaced( const ::com::sun::star::ui::ConfigurationEvent& Event ) throw (::com::sun::star::uno::RuntimeException); + + private: + enum DockingOperation + { + DOCKOP_BEFORE_COLROW, + DOCKOP_ON_COLROW, + DOCKOP_AFTER_COLROW + }; + + typedef std::vector< UIElement > UIElementVector; + struct SingleRowColumnWindowData + { + SingleRowColumnWindowData() : nVarSize( 0 ), nStaticSize( 0 ), nSpace( 0 ) {} + + std::vector< rtl::OUString > aUIElementNames; + std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > > aRowColumnWindows; + std::vector< ::com::sun::star::awt::Rectangle > aRowColumnWindowSizes; + std::vector< sal_Int32 > aRowColumnSpace; + ::com::sun::star::awt::Rectangle aRowColumnRect; + sal_Int32 nVarSize; + sal_Int32 nStaticSize; + sal_Int32 nSpace; + sal_Int32 nRowColumn; + }; + + //--------------------------------------------------------------------------------------------------------- + // internal helper methods + //--------------------------------------------------------------------------------------------------------- + bool implts_isParentWindowVisible() const; + ::Rectangle implts_calcDockingArea(); + void implts_sortUIElements(); + void implts_reparentToolbars(); + rtl::OUString implts_generateGenericAddonToolbarTitle( sal_Int32 nNumber ) const; + void implts_setElementData( UIElement& rUIElement, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XDockableWindow >& rDockWindow ); + void implts_destroyDockingAreaWindows(); + + //--------------------------------------------------------------------------------------------------------- + // layout methods + //--------------------------------------------------------------------------------------------------------- + void implts_setDockingAreaWindowSizes( const ::com::sun::star::awt::Rectangle& rBorderSpace ); + ::Point implts_findNextCascadeFloatingPos(); + void implts_renumberRowColumnData( ::com::sun::star::ui::DockingArea eDockingArea, DockingOperation eDockingOperation, const UIElement& rUIElement ); + void implts_calcWindowPosSizeOnSingleRowColumn( sal_Int32 nDockingArea, + sal_Int32 nOffset, + SingleRowColumnWindowData& rRowColumnWindowData, + const ::Size& rContainerSize ); + void implts_setLayoutDirty(); + void implts_setLayoutInProgress( bool bInProgress = true ); + bool implts_isLayoutInProgress() const { return m_bLayoutInProgress; } + + //--------------------------------------------------------------------------------------------------------- + // lookup/container methods + //--------------------------------------------------------------------------------------------------------- + UIElement implts_findToolbar( const rtl::OUString& aName ); + UIElement implts_findToolbar( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xToolbar ); + UIElement& impl_findToolbar( const rtl::OUString& aName ); + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > implts_getXWindow( const ::rtl::OUString& aName ); + Window* implts_getWindow( const ::rtl::OUString& aName ); + bool implts_insertToolbar( const UIElement& rUIElement ); + void implts_setToolbar( const UIElement& rUIElement ); + ::Size implts_getTopBottomDockingAreaSizes(); + void implts_getUIElementVectorCopy( UIElementVector& rCopy ); + + //--------------------------------------------------------------------------------------------------------- + // internal docking methods + //--------------------------------------------------------------------------------------------------------- + ::Rectangle implts_calcHotZoneRect( const ::Rectangle& rRect, sal_Int32 nHotZoneOffset ); + void implts_calcDockingPosSize( UIElement& aUIElement, DockingOperation& eDockOperation, ::Rectangle& rTrackingRect, const Point& rMousePos ); + DockingOperation implts_determineDockingOperation( ::com::sun::star::ui::DockingArea DockingArea, const ::Rectangle& rRowColRect, const Point& rMousePos ); + ::Rectangle implts_getWindowRectFromRowColumn( ::com::sun::star::ui::DockingArea DockingArea, const SingleRowColumnWindowData& rRowColumnWindowData, const ::Point& rMousePos, const rtl::OUString& rExcludeElementName ); + ::Rectangle implts_determineFrontDockingRect( ::com::sun::star::ui::DockingArea eDockingArea, + sal_Int32 nRowCol, + const ::Rectangle& rDockedElementRect, + const ::rtl::OUString& rMovedElementName, + const ::Rectangle& rMovedElementRect ); + ::Rectangle implts_calcTrackingAndElementRect( ::com::sun::star::ui::DockingArea eDockingArea, + sal_Int32 nRowCol, + UIElement& rUIElement, + const ::Rectangle& rTrackingRect, + const ::Rectangle& rRowColumnRect, + const ::Size& rContainerWinSize ); + + void implts_getDockingAreaElementInfos( ::com::sun::star::ui::DockingArea DockingArea, std::vector< SingleRowColumnWindowData >& rRowColumnsWindowData ); + void implts_getDockingAreaElementInfoOnSingleRowCol( ::com::sun::star::ui::DockingArea, sal_Int32 nRowCol, SingleRowColumnWindowData& rRowColumnWindowData ); + void implts_findNextDockingPos( ::com::sun::star::ui::DockingArea DockingArea, const ::Size& aUIElementSize, ::Point& rVirtualPos, ::Point& rPixelPos ); + void implts_setTrackingRect( ::com::sun::star::ui::DockingArea eDockingArea, const ::Point& rMousePos, ::Rectangle& rTrackingRect ); + + //--------------------------------------------------------------------------------------------------------- + // creation methods + //--------------------------------------------------------------------------------------------------------- + void implts_createAddonsToolBars(); + void implts_createCustomToolBars(); + void implts_createNonContextSensitiveToolBars(); + void implts_createCustomToolBars( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > >& aCustomTbxSeq ); + void implts_createCustomToolBar( const rtl::OUString& aTbxResName, const rtl::OUString& aTitle ); + void implts_createToolBar( const ::rtl::OUString& aName, bool& bNotify, ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIElement >& rUIElement ); + css::uno::Reference< css::ui::XUIElement > implts_createElement( const ::rtl::OUString& aName ); + void implts_setToolbarCreation( bool bStart = true ); + bool implts_isToolbarCreationActive(); + + //--------------------------------------------------------------------------------------------------------- + // persistence methods + //--------------------------------------------------------------------------------------------------------- + sal_Bool implts_readWindowStateData( const rtl::OUString& aName, UIElement& rElementData ); + void implts_writeWindowStateData( const UIElement& rElementData ); + void implts_writeNewWindowStateData( const rtl::OUString aName, const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow >& xWindow ); + + //--------------------------------------------------------------------------------------------------------- + // members + //--------------------------------------------------------------------------------------------------------- + css::uno::Reference< css::lang::XMultiServiceFactory > m_xSMGR; + css::uno::Reference< css::frame::XFrame > m_xFrame; + css::uno::Reference< css::awt::XWindow2 > m_xContainerWindow; + css::uno::Reference< css::awt::XWindow > m_xDockAreaWindows[DOCKINGAREAS_COUNT]; + css::uno::Reference< ::com::sun::star::ui::XUIElementFactory > m_xUIElementFactoryManager; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xModuleCfgMgr; + css::uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > m_xDocCfgMgr; + css::uno::Reference< ::com::sun::star::awt::XToolkit > m_xToolkit; + css::uno::Reference< ::com::sun::star::container::XNameAccess > m_xPersistentWindowState; + ILayoutNotifications* m_pParentLayouter; + + UIElementVector m_aUIElements; + UIElement m_aDockUIElement; + Point m_aStartDockMousePos; + Rectangle m_aDockingArea; + Rectangle m_aDockingAreaOffsets; + DockingOperation m_eDockOperation; + + AddonsOptions* m_pAddonOptions; + GlobalSettings* m_pGlobalSettings; + + bool m_bComponentAttached; + bool m_bMustLayout; + bool m_bLayoutDirty; + bool m_bStoreWindowState; + bool m_bGlobalSettings; + bool m_bDockingInProgress; + bool m_bVisible; + bool m_bLayoutInProgress; + bool m_bToolbarCreation; + + ::rtl::OUString m_aFullAddonTbxPrefix; + ::rtl::OUString m_aCustomTbxPrefix; + ::rtl::OUString m_aCustomizeCmd; + ::rtl::OUString m_aToolbarTypeString; + ::rtl::OUString m_aModuleIdentifier; +}; + +} // namespace framework + +#endif // __FRAMEWORK_LAYOUTMANAGER_TOOLBARLAYOUTMANAGER_HXX_ diff --git a/framework/source/layoutmanager/uielement.cxx b/framework/source/layoutmanager/uielement.cxx new file mode 100755 index 000000000000..dda5aa352a08 --- /dev/null +++ b/framework/source/layoutmanager/uielement.cxx @@ -0,0 +1,156 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: layoutmanager.hxx,v $ + * $Revision: 1.34 $ + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <uielement/uielement.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/ui/DockingArea.hpp> + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +using namespace ::com::sun::star; + +namespace framework +{ + + bool UIElement::operator< ( const ::framework::UIElement& aUIElement ) const +{ + if ( !m_xUIElement.is() && aUIElement.m_xUIElement.is() ) + return false; + else if ( m_xUIElement.is() && !aUIElement.m_xUIElement.is() ) + return true; + else if ( !m_bVisible && aUIElement.m_bVisible ) + return false; + else if ( m_bVisible && !aUIElement.m_bVisible ) + return true; + else if ( !m_bFloating && aUIElement.m_bFloating ) + return true; + else if ( m_bFloating && !aUIElement.m_bFloating ) + return false; + else + { + if ( m_bFloating ) + { + bool bEqual = ( m_aFloatingData.m_aPos.Y() == aUIElement.m_aFloatingData.m_aPos.Y() ); + if ( bEqual ) + return ( m_aFloatingData.m_aPos.X() < aUIElement.m_aFloatingData.m_aPos.X() ); + else + return ( m_aFloatingData.m_aPos.Y() < aUIElement.m_aFloatingData.m_aPos.Y() ); + } + else + { + if ( m_aDockedData.m_nDockedArea < aUIElement.m_aDockedData.m_nDockedArea ) + return true; + else if ( m_aDockedData.m_nDockedArea > aUIElement.m_aDockedData.m_nDockedArea ) + return false; + else + { + if ( m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_TOP || + m_aDockedData.m_nDockedArea == ui::DockingArea_DOCKINGAREA_BOTTOM ) + { + if ( !( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ) ) + return ( m_aDockedData.m_aPos.Y() < aUIElement.m_aDockedData.m_aPos.Y() ); + else + { + bool bEqual = ( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ); + if ( bEqual ) + { + if ( m_bUserActive && !aUIElement.m_bUserActive ) + return sal_True; + else if ( !m_bUserActive && aUIElement.m_bUserActive ) + return sal_False; + else + return sal_False; + } + else + return ( m_aDockedData.m_aPos.X() <= aUIElement.m_aDockedData.m_aPos.X() ); + } + } + else + { + if ( !( m_aDockedData.m_aPos.X() == aUIElement.m_aDockedData.m_aPos.X() ) ) + return ( m_aDockedData.m_aPos.X() < aUIElement.m_aDockedData.m_aPos.X() ); + else + { + bool bEqual = ( m_aDockedData.m_aPos.Y() == aUIElement.m_aDockedData.m_aPos.Y() ); + if ( bEqual ) + { + if ( m_bUserActive && !aUIElement.m_bUserActive ) + return sal_True; + else if ( !m_bUserActive && aUIElement.m_bUserActive ) + return sal_False; + else + return sal_False; + } + else + return ( m_aDockedData.m_aPos.Y() <= aUIElement.m_aDockedData.m_aPos.Y() ); + } + } + } + } + } +} + +UIElement& UIElement::operator= ( const UIElement& rUIElement ) +{ + m_aType = rUIElement.m_aType; + m_aName = rUIElement.m_aName; + m_aUIName = rUIElement.m_aUIName; + m_xUIElement = rUIElement.m_xUIElement; + m_bFloating = rUIElement.m_bFloating; + m_bVisible = rUIElement.m_bVisible; + m_bUserActive = rUIElement.m_bUserActive; + m_bCreateNewRowCol0 = rUIElement.m_bCreateNewRowCol0; + m_bDeactiveHide = rUIElement.m_bDeactiveHide; + m_bMasterHide = rUIElement.m_bMasterHide; + m_bContextSensitive = rUIElement.m_bContextSensitive; + m_bContextActive = rUIElement.m_bContextActive; + m_bNoClose = rUIElement.m_bNoClose; + m_bSoftClose = rUIElement.m_bSoftClose; + m_bStateRead = rUIElement.m_bStateRead; + m_nStyle = rUIElement.m_nStyle; + m_aDockedData = rUIElement.m_aDockedData; + m_aFloatingData = rUIElement.m_aFloatingData; + return *this; +} + +} // namespace framework diff --git a/framework/source/services/makefile.mk b/framework/source/services/makefile.mk index 2978d9aacf5e..eaeaae1f8a82 100644 --- a/framework/source/services/makefile.mk +++ b/framework/source/services/makefile.mk @@ -53,7 +53,8 @@ SLOFILES=\ $(SLO)$/sessionlistener.obj \ $(SLO)$/taskcreatorsrv.obj \ $(SLO)$/uriabbreviation.obj \ - $(SLO)$/tabwindowservice.obj + $(SLO)$/tabwindowservice.obj \ + $(SLO)$/modelwinservice.obj SRS1NAME=$(TARGET) SRC1FILES= fwk_services.src diff --git a/framework/source/services/modelwinservice.cxx b/framework/source/services/modelwinservice.cxx new file mode 100755 index 000000000000..d50fe7dcc653 --- /dev/null +++ b/framework/source/services/modelwinservice.cxx @@ -0,0 +1,279 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: urltransformer.cxx,v $ + * $Revision: 1.17 $ + * + * 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 "services.h" +#include "services/modelwinservice.hxx" + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/awt/XControlModel.hpp> + +using namespace ::com::sun::star; + +//_________________________________________________________________________________________________________________ +// namespace +//_________________________________________________________________________________________________________________ + +namespace framework{ + +//_________________________________________________________________________________________________________________ +// non exported definitions +//_________________________________________________________________________________________________________________ + +//_________________________________________________________________________________________________________________ +// declarations +//_________________________________________________________________________________________________________________ + +class Impl_ModelWinService +{ + public: + ~Impl_ModelWinService(); + + static Impl_ModelWinService* getSingleInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + uno::Any getByName( const ::rtl::OUString& sName ) + throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ); + + uno::Sequence< ::rtl::OUString > getElementNames() + throw( uno::RuntimeException ); + + sal_Bool hasByName( const ::rtl::OUString& sName ) + throw( uno::RuntimeException ); + + uno::Type getElementType() + throw( css::uno::RuntimeException ); + + sal_Bool hasElements() + throw( css::uno::RuntimeException ); + + void registerModelForXWindow( const uno::Reference< awt::XWindow >& rWindow, const uno::Reference< awt::XControlModel >& rModel ); + + void deregisterModelForXWindow( const uno::Reference< awt::XWindow >& rWindow ); + + private: + typedef BaseHash< uno::WeakReference< awt::XControlModel > > ModelWinMap; + + Impl_ModelWinService(); + Impl_ModelWinService( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ); + + static Impl_ModelWinService* m_pModelWinService; + + ::com::sun::star::uno::WeakReference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager; + ModelWinMap m_aModelMap; +}; + +Impl_ModelWinService* Impl_ModelWinService::m_pModelWinService = 0; + +Impl_ModelWinService* Impl_ModelWinService::getSingleInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ) +{ + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + if ( !m_pModelWinService ) + m_pModelWinService = new Impl_ModelWinService( rServiceManager ); + return m_pModelWinService; +} + +Impl_ModelWinService::Impl_ModelWinService( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager ) : + m_xServiceManager( rServiceManager ) +{ +} + +Impl_ModelWinService::Impl_ModelWinService() +{ +} + +Impl_ModelWinService::~Impl_ModelWinService() +{ +} + +void Impl_ModelWinService::registerModelForXWindow( const uno::Reference< awt::XWindow >& rWindow, const uno::Reference< awt::XControlModel >& rModel ) +{ + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + + ::rtl::OUString sName = rtl::OUString::valueOf( reinterpret_cast< sal_Int64 >((void*)rWindow.get())); + ModelWinMap::iterator pIter = m_aModelMap.find( sName ); + if ( pIter != m_aModelMap.end() ) + pIter->second = rModel; + else + m_aModelMap[sName] = rModel; +} + +void Impl_ModelWinService::deregisterModelForXWindow( const uno::Reference< awt::XWindow >& /*rWindow*/ ) +{ +} + +uno::Any Impl_ModelWinService::getByName( const ::rtl::OUString& sName ) +throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) +{ + uno::Any aAny; + + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + ModelWinMap::iterator pIter = m_aModelMap.find( sName ); + if ( pIter != m_aModelMap.end()) + { + uno::Reference< awt::XControlModel > xModel( pIter->second ); + aAny = uno::makeAny(xModel); + } + + return aAny; +} + +uno::Sequence< ::rtl::OUString > Impl_ModelWinService::getElementNames() +throw( uno::RuntimeException ) +{ + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + uno::Sequence< ::rtl::OUString > aResult( m_aModelMap.size() ); + + sal_Int32 i = 0; + ModelWinMap::const_iterator pIter = m_aModelMap.begin(); + while ( pIter != m_aModelMap.end()) + aResult[i++] = pIter->first; + + return aResult; +} + +sal_Bool Impl_ModelWinService::hasByName( const ::rtl::OUString& sName ) +throw( uno::RuntimeException ) +{ + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + ModelWinMap::iterator pIter = m_aModelMap.find( sName ); + if ( pIter != m_aModelMap.end()) + return true; + else + return false; +} + +uno::Type Impl_ModelWinService::getElementType() +throw( css::uno::RuntimeException ) +{ + return ::getCppuType(( const uno::Reference< awt::XControlModel >*)NULL ); +} + +sal_Bool Impl_ModelWinService::hasElements() +throw( css::uno::RuntimeException ) +{ + osl::MutexGuard aGuard( osl::Mutex::getGlobalMutex() ) ; + return (m_aModelMap.size() > 0); +} + +//***************************************************************************************************************** +// css::uno::XInterface, XTypeProvider, XServiceInfo +//***************************************************************************************************************** + +DEFINE_XINTERFACE_4 ( ModelWinService , + OWeakObject , + DIRECT_INTERFACE(css::lang::XTypeProvider ), + DIRECT_INTERFACE(css::lang::XServiceInfo ), + DIRECT_INTERFACE(css::container::XNameAccess ), + DIRECT_INTERFACE(css::container::XElementAccess ) + ) + +DEFINE_XTYPEPROVIDER_4 ( ModelWinService , + css::lang::XTypeProvider , + css::lang::XServiceInfo , + css::container::XNameAccess , + css::container::XElementAccess + ) + +DEFINE_XSERVICEINFO_MULTISERVICE ( ModelWinService , + OWeakObject , + SERVICENAME_MODELWINSERVICE , + IMPLEMENTATIONNAME_MODELWINSERVICE + ) + +DEFINE_INIT_SERVICE ( ModelWinService, + { + } + ) + +//***************************************************************************************************************** +// constructor +//***************************************************************************************************************** +ModelWinService::ModelWinService(const uno::Reference< lang::XMultiServiceFactory >& rServiceManager ) : + m_xServiceManager( rServiceManager ) +{ +} + +ModelWinService::~ModelWinService() +{ +} + +void ModelWinService::registerModelForXWindow( const uno::Reference< awt::XWindow >& rWindow, const uno::Reference< awt::XControlModel >& rModel ) +{ + Impl_ModelWinService::getSingleInstance(m_xServiceManager)->registerModelForXWindow( rWindow, rModel ); +} + +void ModelWinService::deregisterModelForXWindow( const uno::Reference< awt::XWindow >& rWindow ) +{ + Impl_ModelWinService::getSingleInstance(m_xServiceManager)->deregisterModelForXWindow( rWindow ); +} + +uno::Any SAL_CALL ModelWinService::getByName( const ::rtl::OUString& sName ) +throw( container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException ) +{ + return Impl_ModelWinService::getSingleInstance(m_xServiceManager)->getByName( sName ); +} + +uno::Sequence< ::rtl::OUString > SAL_CALL ModelWinService::getElementNames() +throw( uno::RuntimeException ) +{ + return Impl_ModelWinService::getSingleInstance(m_xServiceManager)->getElementNames( ); +} + +sal_Bool SAL_CALL ModelWinService::hasByName( const ::rtl::OUString& sName ) +throw( uno::RuntimeException ) +{ + return Impl_ModelWinService::getSingleInstance(m_xServiceManager)->hasByName( sName ); +} + +//--------------------------------------------------------------------------------------------------------- +// XElementAccess +//--------------------------------------------------------------------------------------------------------- +uno::Type SAL_CALL ModelWinService::getElementType() +throw( uno::RuntimeException ) +{ + return ::getCppuType( (const uno::Reference< awt::XControlModel > *)NULL ); +} + +sal_Bool SAL_CALL ModelWinService::hasElements() +throw( uno::RuntimeException ) +{ + return Impl_ModelWinService::getSingleInstance(m_xServiceManager)->hasElements(); +} + +} diff --git a/framework/source/uielement/makefile.mk b/framework/source/uielement/makefile.mk index b74adb1e176f..0acfa6b662a5 100644 --- a/framework/source/uielement/makefile.mk +++ b/framework/source/uielement/makefile.mk @@ -81,6 +81,8 @@ SLOFILES= \ $(SLO)$/toolbarwrapper.obj \ $(SLO)$/popupmenucontroller.obj \ $(SLO)$/uicommanddescription.obj \ + $(SLO)$/panelwrapper.obj \ + $(SLO)$/panelwindow.obj # --- Targets ------------------------------------------------------ diff --git a/framework/source/uielement/panelwindow.cxx b/framework/source/uielement/panelwindow.cxx new file mode 100755 index 000000000000..c8729dbb028d --- /dev/null +++ b/framework/source/uielement/panelwindow.cxx @@ -0,0 +1,77 @@ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" + +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <uielement/panelwindow.hxx> + +namespace framework +{ + +PanelWindow::PanelWindow( Window* pParent, WinBits nWinBits ) : + DockingWindow( pParent, nWinBits ) +{ +} + +PanelWindow::~PanelWindow() +{ +} + +const ::rtl::OUString& PanelWindow::getResourceURL() const +{ + return m_aResourceURL; +} + +void PanelWindow::setResourceURL(const ::rtl::OUString& rResourceURL) +{ + m_aResourceURL = rResourceURL; +} + +Window* PanelWindow::getContentWindow() const +{ + return m_pContentWindow; +} + +void PanelWindow::setContentWindow( Window* pContentWindow ) +{ + m_pContentWindow = pContentWindow; + if ( m_pContentWindow != NULL ) + { + m_pContentWindow->SetParent(this); + m_pContentWindow->SetSizePixel( GetOutputSizePixel() ); + m_pContentWindow->Show(); + } +} + +void PanelWindow::Command( const CommandEvent& rCEvt ) +{ + if ( m_aCommandHandler.IsSet() ) + m_aCommandHandler.Call( (void *)( &rCEvt )); + DockingWindow::Command( rCEvt ); +} + +void PanelWindow::StateChanged( StateChangedType nType ) +{ + DockingWindow::StateChanged( nType ); + if ( m_aStateChangedHandler.IsSet() ) + m_aStateChangedHandler.Call( &nType ); +} + +void PanelWindow::DataChanged( const DataChangedEvent& rDCEvt ) +{ + DockingWindow::DataChanged( rDCEvt ); + if ( m_aDataChangedHandler.IsSet() ) + m_aDataChangedHandler.Call( (void*)&rDCEvt ); +} + +void PanelWindow::Resize() +{ + DockingWindow::Resize(); + if ( m_pContentWindow ) + m_pContentWindow->SetSizePixel( GetOutputSizePixel() ); +} + +} diff --git a/framework/source/uielement/panelwrapper.cxx b/framework/source/uielement/panelwrapper.cxx new file mode 100755 index 000000000000..91bc6fa9dac8 --- /dev/null +++ b/framework/source/uielement/panelwrapper.cxx @@ -0,0 +1,227 @@ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_framework.hxx" +//_________________________________________________________________________________________________________________ +// my own includes +//_________________________________________________________________________________________________________________ + +#include <services.h> +#include <uielement/panelwrapper.hxx> +#include <threadhelp/resetableguard.hxx> +#include <helper/actiontriggerhelper.hxx> +#include <uielement/constitemcontainer.hxx> +#include <uielement/rootitemcontainer.hxx> +#include <uielement/panelwindow.hxx> +#include <services/modelwinservice.hxx> + +//_________________________________________________________________________________________________________________ +// interface includes +//_________________________________________________________________________________________________________________ + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/awt/XSystemDependentMenuPeer.hpp> +#include <com/sun/star/awt/XMenuBar.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/ui/UIElementType.hpp> + +//_________________________________________________________________________________________________________________ +// other includes +//_________________________________________________________________________________________________________________ + +#include <toolkit/unohlp.hxx> +#include <toolkit/awt/vclxwindow.hxx> +#include <comphelper/processfactory.hxx> +#include <svtools/miscopt.hxx> +#include <vcl/svapp.hxx> +#include <rtl/logfile.hxx> + +using namespace com::sun::star; +using namespace com::sun::star::uno; +using namespace com::sun::star::beans; +using namespace com::sun::star::frame; +using namespace com::sun::star::lang; +using namespace com::sun::star::container; +using namespace com::sun::star::awt; +using namespace ::com::sun::star::ui; + +namespace framework +{ + +PanelWrapper::PanelWrapper( const Reference< XMultiServiceFactory >& xServiceManager ) : + UIElementWrapperBase( UIElementType::DOCKINGWINDOW ), + m_xServiceManager( xServiceManager ), + m_bNoClose(false) +{ +} + +PanelWrapper::~PanelWrapper() +{ +} + +// XInterface +void SAL_CALL PanelWrapper::acquire() throw() +{ + UIElementWrapperBase::acquire(); +} + +void SAL_CALL PanelWrapper::release() throw() +{ + UIElementWrapperBase::release(); +} + +uno::Any SAL_CALL PanelWrapper::queryInterface( const uno::Type & rType ) +throw( ::com::sun::star::uno::RuntimeException ) +{ + return UIElementWrapperBase::queryInterface( rType ); +} + +// XComponent +void SAL_CALL PanelWrapper::dispose() throw ( RuntimeException ) +{ + Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XMultiServiceFactory > xSMGR( m_xServiceManager ); + Reference< XWindow > xWindow; + + { + ResetableGuard aLock( m_aLock ); + if ( m_bDisposed ) + return; + xSMGR = m_xServiceManager; + } + + com::sun::star::lang::EventObject aEvent( xThis ); + m_aListenerContainer.disposeAndClear( aEvent ); + + rtl::OUString aModelWinService( SERVICENAME_MODELWINSERVICE ); + Reference< XNameAccess > xNameAccess( xSMGR->createInstance( aModelWinService ), UNO_QUERY ); + if ( xNameAccess.is() ) + { + ModelWinService* pService = dynamic_cast< ModelWinService* >( xNameAccess.get() ); + if ( pService != 0 ) + { + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + PanelWindow* pPanelWindow = dynamic_cast< PanelWindow* >( m_xPanelWindow.get() ); + if ( pPanelWindow != NULL ) + { + xWindow = VCLUnoHelper::GetInterface( pPanelWindow->getContentWindow() ); + pService->deregisterModelForXWindow( xWindow ); + } + } + } + + ResetableGuard aLock( m_aLock ); + m_xPanelWindow.clear(); + m_bDisposed = sal_True; +} + +// XInitialization +void SAL_CALL PanelWrapper::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException ) +{ + ResetableGuard aLock( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); + + if ( !m_bInitialized ) + { + UIElementWrapperBase::initialize( aArguments ); + + sal_Bool bPopupMode( sal_False ); + Reference< XWindow > xContentWindow; + for ( sal_Int32 i = 0; i < aArguments.getLength(); i++ ) + { + PropertyValue aPropValue; + if ( aArguments[i] >>= aPropValue ) + { + if ( aPropValue.Name.equalsAsciiL( "PopupMode", 9 )) + aPropValue.Value >>= bPopupMode; + else if ( aPropValue.Name.equalsAsciiL( "ContentWindow", 13 )) + aPropValue.Value >>= xContentWindow; + } + } + + Reference< XFrame > xFrame( m_xWeakFrame ); + if ( xFrame.is() ) + { + PanelWindow* pPanelWindow(0); + Window* pContentWindow(0); + { + vos::OGuard aSolarMutexGuard( Application::GetSolarMutex() ); + Window* pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() ); + pContentWindow = VCLUnoHelper::GetWindow( xContentWindow ); + if ( pWindow ) + { + ULONG nStyles = WB_LINESPACING | WB_BORDER | WB_SCROLL | WB_MOVEABLE | WB_3DLOOK | WB_DOCKABLE | WB_SIZEABLE | WB_CLOSEABLE; + + pPanelWindow = new PanelWindow( pWindow, nStyles ); + m_xPanelWindow = VCLUnoHelper::GetInterface( pPanelWindow ); + pPanelWindow->setResourceURL( m_aResourceURL ); + pPanelWindow->setContentWindow( pContentWindow ); + } + } + + try + { + } + catch ( NoSuchElementException& ) + { + } + } + } +} + +// XEventListener +void SAL_CALL PanelWrapper::disposing( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException) +{ + // nothing todo +} + +// XUpdatable +void SAL_CALL PanelWrapper::update() throw (::com::sun::star::uno::RuntimeException) +{ + ResetableGuard aLock( m_aLock ); + + if ( m_bDisposed ) + throw DisposedException(); +} + +// XUIElement interface +Reference< XInterface > SAL_CALL PanelWrapper::getRealInterface( ) throw (::com::sun::star::uno::RuntimeException) +{ + ResetableGuard aLock( m_aLock ); + return m_xPanelWindow; +} + +void SAL_CALL PanelWrapper::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const com::sun::star::uno::Any& aValue ) throw( com::sun::star::uno::Exception ) +{ + ResetableGuard aLock( m_aLock ); + sal_Bool bNoClose( m_bNoClose ); + aLock.unlock(); + + UIElementWrapperBase::setFastPropertyValue_NoBroadcast( nHandle, aValue ); + + aLock.lock(); + + sal_Bool bNewNoClose( m_bNoClose ); + if ( m_xPanelWindow.is() && !m_bDisposed && ( bNewNoClose != bNoClose )) + { + PanelWindow* pPanelWindow = dynamic_cast< PanelWindow* >( VCLUnoHelper::GetWindow( m_xPanelWindow ) ); + if ( pPanelWindow ) + { + if ( bNewNoClose ) + { + pPanelWindow->SetStyle( pPanelWindow->GetStyle() & ~WB_CLOSEABLE ); + pPanelWindow->SetFloatStyle( pPanelWindow->GetFloatStyle() & ~WB_CLOSEABLE ); + } + else + { + pPanelWindow->SetStyle( pPanelWindow->GetStyle() | WB_CLOSEABLE ); + pPanelWindow->SetFloatStyle( pPanelWindow->GetFloatStyle() | WB_CLOSEABLE ); + } + } + } +} + +} // namespace framework diff --git a/framework/util/makefile.mk b/framework/util/makefile.mk index a3f14341d3f3..698ba37d5d3d 100644 --- a/framework/util/makefile.mk +++ b/framework/util/makefile.mk @@ -336,8 +336,14 @@ SHL4OBJS= \ $(SLO)$/windowcommanddispatch.obj \ $(SLO)$/windowstateconfiguration.obj \ $(SLO)$/windowcontentfactorymanager.obj \ - $(SLO)$/startmoduledispatcher.obj - + $(SLO)$/startmoduledispatcher.obj \ + $(SLO)$/modelwinservice.obj \ + $(SLO)$/panelmanager.obj \ + $(SLO)$/panel.obj \ + $(SLO)$/helpers.obj \ + $(SLO)$/uielement.obj \ + $(SLO)$/toolbarlayoutmanager.obj + SHL4STDLIBS= \ $(FWILIB) \ $(FWELIB) \ diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/AppSearc.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/AppSearc.idt index 9bb051e56492..3968375a8815 100644 --- a/instsetoo_native/inc_openoffice/windows/msi_templates/AppSearc.idt +++ b/instsetoo_native/inc_openoffice/windows/msi_templates/AppSearc.idt @@ -2,4 +2,6 @@ Property Signature_ s72 s72 AppSearch Property Signature_ INSTALLLOCATION installuser +INSTALLLOCATION installuser_ INSTALLLOCATION installmachine +INSTALLLOCATION installmachine_ diff --git a/instsetoo_native/inc_openoffice/windows/msi_templates/RegLocat.idt b/instsetoo_native/inc_openoffice/windows/msi_templates/RegLocat.idt index 2fb2d2963727..661b9a4be210 100644 --- a/instsetoo_native/inc_openoffice/windows/msi_templates/RegLocat.idt +++ b/instsetoo_native/inc_openoffice/windows/msi_templates/RegLocat.idt @@ -1,5 +1,7 @@ Signature_ Root Key Name Type s72 i2 s255 S255 I2 RegLocator Signature_ -installuser 1 Software\OpenOffice.org\LAYERNAMETEMPLATE\[DEFINEDPRODUCT]\[BRANDPACKAGEVERSION] INSTALLLOCATION 2 -installmachine 2 Software\OpenOffice.org\LAYERNAMETEMPLATE\[DEFINEDPRODUCT]\[BRANDPACKAGEVERSION] INSTALLLOCATION 2 +installuser 1 Software\OpenOffice.org\Layers\[DEFINEDPRODUCT]\[BRANDPACKAGEVERSION] INSTALLLOCATION 2 +installuser_ 1 Software\OpenOffice.org\Layers_\[DEFINEDPRODUCT]\[BRANDPACKAGEVERSION] INSTALLLOCATION 2 +installmachine 2 Software\OpenOffice.org\Layers\[DEFINEDPRODUCT]\[BRANDPACKAGEVERSION] INSTALLLOCATION 2 +installmachine_ 2 Software\OpenOffice.org\Layers_\[DEFINEDPRODUCT]\[BRANDPACKAGEVERSION] INSTALLLOCATION 2 diff --git a/instsetoo_native/inc_sdkoo/windows/msi_templates/AppSearc.idt b/instsetoo_native/inc_sdkoo/windows/msi_templates/AppSearc.idt index 41ff1521764a..9a3dac51143c 100644 --- a/instsetoo_native/inc_sdkoo/windows/msi_templates/AppSearc.idt +++ b/instsetoo_native/inc_sdkoo/windows/msi_templates/AppSearc.idt @@ -2,4 +2,6 @@ Property Signature_ s72 s72 AppSearch Property Signature_ INSTALLLOCATION basisinstalluser +INSTALLLOCATION basisinstalluser_ INSTALLLOCATION basisinstallmachine +INSTALLLOCATION basisinstallmachine_ diff --git a/instsetoo_native/inc_sdkoo/windows/msi_templates/RegLocat.idt b/instsetoo_native/inc_sdkoo/windows/msi_templates/RegLocat.idt index 5121f7870124..072fdcf6c291 100644 --- a/instsetoo_native/inc_sdkoo/windows/msi_templates/RegLocat.idt +++ b/instsetoo_native/inc_sdkoo/windows/msi_templates/RegLocat.idt @@ -1,5 +1,7 @@ Signature_ Root Key Name Type s72 i2 s255 S255 I2 RegLocator Signature_ -basisinstalluser 1 Software\OpenOffice.org\LAYERNAMETEMPLATE\Basis\[OOOBASEVERSION] BASISINSTALLLOCATION 2 -basisinstallmachine 2 Software\OpenOffice.org\LAYERNAMETEMPLATE\Basis\[OOOBASEVERSION] BASISINSTALLLOCATION 2 +basisinstalluser 1 Software\OpenOffice.org\Layers\Basis\[OOOBASEVERSION] BASISINSTALLLOCATION 2 +basisinstalluser_ 1 Software\OpenOffice.org\Layers_\Basis\[OOOBASEVERSION] BASISINSTALLLOCATION 2 +basisinstallmachine 2 Software\OpenOffice.org\Layers\Basis\[OOOBASEVERSION] BASISINSTALLLOCATION 2 +basisinstallmachine_ 2 Software\OpenOffice.org\Layers_\Basis\[OOOBASEVERSION] BASISINSTALLLOCATION 2 diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx index 8e6976c0efd1..4e3a4cedbe6f 100644 --- a/l10ntools/source/help/HelpLinker.cxx +++ b/l10ntools/source/help/HelpLinker.cxx @@ -46,17 +46,16 @@ #define DBHELP_ONLY - class IndexerPreProcessor { private: - std::string m_aModuleName; - fs::path m_fsIndexBaseDir; - fs::path m_fsCaptionFilesDirName; - fs::path m_fsContentFilesDirName; + std::string m_aModuleName; + fs::path m_fsIndexBaseDir; + fs::path m_fsCaptionFilesDirName; + fs::path m_fsContentFilesDirName; - xsltStylesheetPtr m_xsltStylesheetPtrCaption; - xsltStylesheetPtr m_xsltStylesheetPtrContent; + xsltStylesheetPtr m_xsltStylesheetPtrCaption; + xsltStylesheetPtr m_xsltStylesheetPtrContent; public: IndexerPreProcessor( const std::string& aModuleName, const fs::path& fsIndexBaseDir, @@ -245,7 +244,6 @@ class HelpLinker { public: void main(std::vector<std::string> &args, -// std::string* pExtensionPath = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) std::string* pExtensionPath = NULL, std::string* pDestination = NULL, const rtl::OUString* pOfficeHelpPath = NULL ) @@ -667,8 +665,8 @@ void HelpLinker::link() throw( HelpProcessingException ) if( !bExtensionMode ) std::cout << std::endl; - } // try - catch( HelpProcessingException& ) + } // try + catch( const HelpProcessingException& ) { // catch HelpProcessingException to avoid locking data bases #ifndef DBHELP_ONLY @@ -1039,7 +1037,6 @@ void HelpLinker::main( std::vector<std::string> &args, aStrStream << "language missing" << std::endl; throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() ); } - link(); } @@ -1102,7 +1099,7 @@ HelpProcessingErrorInfo& HelpProcessingErrorInfo::operator=( const struct HelpPr // Returns true in case of success, false in case of error HELPLINKER_DLLPUBLIC bool compileExtensionHelp ( - const rtl::OUString& aOfficeHelpPath, + const rtl::OUString& aOfficeHelpPath, const rtl::OUString& aExtensionName, const rtl::OUString& aExtensionLanguageRoot, sal_Int32 nXhpFileCount, const rtl::OUString* pXhpFiles, @@ -1112,31 +1109,20 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp { bool bSuccess = true; - sal_Int32 argc = nXhpFileCount + 3; - const char** argv = new const char*[argc]; - argv[0] = ""; - argv[1] = "-mod"; + std::vector<std::string> args; + args.reserve(nXhpFileCount + 2); + args.push_back(std::string("-mod")); rtl::OString aOExtensionName = rtl::OUStringToOString( aExtensionName, fs::getThreadTextEncoding() ); - argv[2] = aOExtensionName.getStr(); + args.push_back(std::string(aOExtensionName.getStr())); for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) { rtl::OUString aXhpFile = pXhpFiles[iXhp]; rtl::OString aOXhpFile = rtl::OUStringToOString( aXhpFile, fs::getThreadTextEncoding() ); - char* pArgStr = new char[aOXhpFile.getLength() + 1]; - strcpy( pArgStr, aOXhpFile.getStr() ); - argv[iXhp + 3] = pArgStr; + args.push_back(std::string(aOXhpFile.getStr())); } - std::vector<std::string> args; - for( sal_Int32 i = 1; i < argc; ++i ) - args.push_back(std::string( argv[i]) ); - - for( sal_Int32 iXhp = 0 ; iXhp < nXhpFileCount ; ++iXhp ) - delete[] argv[iXhp + 3]; - delete[] argv; - rtl::OString aOExtensionLanguageRoot = rtl::OUStringToOString( aExtensionLanguageRoot, fs::getThreadTextEncoding() ); const char* pExtensionPath = aOExtensionLanguageRoot.getStr(); std::string aStdStrExtensionPath = pExtensionPath; @@ -1206,6 +1192,3 @@ HELPLINKER_DLLPUBLIC bool compileExtensionHelp return bSuccess; } -// vnd.sun.star.help://swriter/52821?Language=en-US&System=UNIX -/* vi:set tabstop=4 shiftwidth=4 expandtab: */ - diff --git a/offapi/com/sun/star/formula/FormulaProperties.idl b/offapi/com/sun/star/formula/FormulaProperties.idl index d6f0f6bfeb28..4e03ff36c3a5 100644 --- a/offapi/com/sun/star/formula/FormulaProperties.idl +++ b/offapi/com/sun/star/formula/FormulaProperties.idl @@ -338,6 +338,14 @@ published service FormulaProperties /** contains the metric value of the right margin of the formula. */ [property] short RightMargin; + + //------------------------------------------------------------------------- + + /** contains the baselines offset in respect to the top of the formula rectangle + + @since OOo 3.4 + */ + [property, optional] short BaseLine; }; //============================================================================= diff --git a/offapi/com/sun/star/text/DocumentSettings.idl b/offapi/com/sun/star/text/DocumentSettings.idl index 3ab98fdd2ddc..19c4d75997cb 100644 --- a/offapi/com/sun/star/text/DocumentSettings.idl +++ b/offapi/com/sun/star/text/DocumentSettings.idl @@ -195,10 +195,20 @@ published service DocumentSettings */ [optional, property] boolean ConsiderTextWrapOnObjPos; + // ------------------------------------------------------------ + /** specifies if Math objects should automatically vertically aligned to + match the baseline of the surrounding text. + + <p>If activated formula object that are anchored 'As Character' will be + vertically aligned to have their baseline match with the one from the text.</p> + + @since OOo 3.4 + */ + [optional, property] boolean MathBaselineAlignment; }; //============================================================================= }; }; }; }; -#endif +#endif
\ No newline at end of file diff --git a/offapi/com/sun/star/text/TextMarkupType.idl b/offapi/com/sun/star/text/TextMarkupType.idl index 5137d47d217f..f5ea4e59f1ec 100644 --- a/offapi/com/sun/star/text/TextMarkupType.idl +++ b/offapi/com/sun/star/text/TextMarkupType.idl @@ -44,27 +44,32 @@ module com { module sun { module star { module text { constants TextMarkupType { - /// Markup originates from spell checking. + /** Markup originates from spell checking. + */ const long SPELLCHECK = 1; - /// Markup originates from proofreading - /// @since OOo 3.0.1 + /** Markup originates from proofreading + @since OOo 3.0.1 + */ const long PROOFREADING = 2; - /// Markup originates from smart tag checking. + /** Markup originates from smart tag checking. + */ const long SMARTTAG = 3; - /// Markup originates from proofreading - /// An inivisible markup used to identify sentence boundaries. - /// @since OOo 3.0.1 + /** Markup originates from proofreading + An inivisible markup type used in proofreading API calls. + @since OOo 3.0.1 + */ const long SENTENCE = 4; - /// Markups originates from change tracking. - /// @since OOo 3.3 + /** Markups originates from change tracking. + @since OOo 3.3 + */ const long TRACK_CHANGE_INSERTION = 5; const long TRACK_CHANGE_DELETION = 6; const long TRACK_CHANGE_FORMATCHANGE = 7; }; }; }; }; }; -#endif +#endif
\ No newline at end of file diff --git a/offapi/com/sun/star/ui/UIElementType.idl b/offapi/com/sun/star/ui/UIElementType.idl index f87d91ca6243..0b4301f54f2a 100644 --- a/offapi/com/sun/star/ui/UIElementType.idl +++ b/offapi/com/sun/star/ui/UIElementType.idl @@ -2,10 +2,13 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2000, 2010 Oracle and/or its affiliates. + * Copyright 2008 by Sun Microsystems, Inc. * * OpenOffice.org - a multi-platform office productivity suite * + * $RCSfile: UIElementType.idl,v $ + * $Revision: 1.4 $ + * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -78,6 +81,11 @@ constants UIElementType const short TOOLPANEL = 7; //------------------------------------------------------------------------- + /** specifies a window that can be docked. + */ + const short DOCKINGWINDOW = 7; + + //------------------------------------------------------------------------- /** specifies the number of constants. */ const short COUNT = 8; diff --git a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl index 3c127fa701d2..2a79d6affd48 100644 --- a/offapi/com/sun/star/util/OfficeInstallationDirectories.idl +++ b/offapi/com/sun/star/util/OfficeInstallationDirectories.idl @@ -52,7 +52,7 @@ module com { module sun { module star { module util { @since OOo 2.0.0 */ -service OfficeInstallationDirectories +published service OfficeInstallationDirectories { /** provides access to the current office installation directories (office base installation and user data). @@ -67,7 +67,7 @@ service OfficeInstallationDirectories @see OfficeInstallationDirectories */ -singleton theOfficeInstallationDirectories +published singleton theOfficeInstallationDirectories { service com::sun::star::util::OfficeInstallationDirectories; }; diff --git a/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl b/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl index c70fde8867e5..d79d0cffc79f 100644 --- a/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl +++ b/offapi/com/sun/star/util/XOfficeInstallationDirectories.idl @@ -47,7 +47,7 @@ module com { module sun { module star { module util { @since OOo 2.0.0 */ -interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface +published interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface { //------------------------------------------------------------------------ /** returns the absolute URL containing the directory of the current office @@ -61,7 +61,8 @@ interface XOfficeInstallationDirectories : com::sun::star::uno::XInterface //------------------------------------------------------------------------ /** returns the absolute URL containing the directory where the current - office installation expects its user data (e.g. "file:///home/kso".) + office installation expects its user data (e.g. + "file:///home/kso/.openoffice.org".) @returns the absolute URL containing the directory of the current office diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs index 4a3c2c02c396..ea806e58f320 100644 --- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs @@ -1512,6 +1512,15 @@ <info> <desc>Contains miscellaneous settings.</desc> </info> + <prop oor:name="IsAlignMathObjectsToBaseline" oor:type="xs:boolean"> + <!-- UIHints: none yet --> + <info> + <author>TL</author> + <desc>Automatically align the baseline of Math objects with the baseline of the surrounding text.</desc> + <label>Align Math objects</label> + </info> + <value>true</value> + </prop> <prop oor:name="MeasureUnit" oor:type="xs:int"> <!-- OldPath: Writer/Layout --> <!-- OldLocation: Soffice.cfg --> diff --git a/officecfg/registry/schema/org/openoffice/Office/WriterWeb.xcs b/officecfg/registry/schema/org/openoffice/Office/WriterWeb.xcs index 8738d9db2112..b92e4684c842 100644 --- a/officecfg/registry/schema/org/openoffice/Office/WriterWeb.xcs +++ b/officecfg/registry/schema/org/openoffice/Office/WriterWeb.xcs @@ -418,6 +418,15 @@ <info> <desc>Contains miscellaneous settings.</desc> </info> + <prop oor:name="IsAlignMathObjectsToBaseline" oor:type="xs:boolean"> + <!-- UIHints: none yet --> + <info> + <author>TL</author> + <desc>Automatically align the baseline of Math objects with the baseline of the surrounding text.</desc> + <label>Align Math objects</label> + </info> + <value>true</value> + </prop> <prop oor:name="MeasureUnit" oor:type="xs:int"> <!-- OldPath: HTML_Editor/Layout/Window --> <!-- OldLocation: Soffice.cfg --> diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index 148cc367534c..e8b58b0f71d3 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -505,7 +505,7 @@ double ScDocument::RoundValueAsShown( double fVal, ULONG nFormat ) && nType != NUMBERFORMAT_TIME && nType != NUMBERFORMAT_DATETIME ) { short nPrecision; - if ( nFormat ) + if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0) { nPrecision = (short)GetFormatTable()->GetFormatPrecision( nFormat ); switch ( nType ) @@ -524,7 +524,12 @@ double ScDocument::RoundValueAsShown( double fVal, ULONG nFormat ) } } else + { nPrecision = (short)GetDocOptions().GetStdPrecision(); + // #i115512# no rounding for automatic decimals + if (nPrecision == static_cast<short>(SvNumberFormatter::UNLIMITED_PRECISION)) + return fVal; + } double fRound = ::rtl::math::round( fVal, nPrecision ); if ( ::rtl::math::approxEqual( fVal, fRound ) ) return fVal; // durch Rundung hoechstens Fehler diff --git a/sc/source/core/data/dptablecache.cxx b/sc/source/core/data/dptablecache.cxx index 8f25b70e41b6..8d2a5ec070f5 100755..100644 --- a/sc/source/core/data/dptablecache.cxx +++ b/sc/source/core/data/dptablecache.cxx @@ -201,8 +201,11 @@ ScDPItemData::ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nD ScBaseCell* pCell = pDoc->GetCell( aPos ); if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() ) + { SetString ( aDocStr ); //[SODC_19347] add liyi //bErr = TRUE; //[SODC_19347] del liyi + mbFlag |= MK_ERR; + } else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) ) { double fVal = pDoc->GetValue(ScAddress(nCol, nRow, nDocTab)); @@ -672,8 +675,15 @@ bool ScDPTableDataCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam, BOO { ScQueryEntry& rEntry = rParam.GetEntry(i); // we can only handle one single direct query - SCROW nId = GetItemDataId( (SCCOL)rEntry.nField, nRow, FALSE ); - const ScDPItemData* pCellData = GetItemDataById( (SCCOL)rEntry.nField, nId); + // #i115431# nField in QueryParam is the sheet column, not the field within the source range + SCCOL nQueryCol = (SCCOL)rEntry.nField; + if ( nQueryCol < rParam.nCol1 ) + nQueryCol = rParam.nCol1; + if ( nQueryCol > rParam.nCol2 ) + nQueryCol = rParam.nCol2; + SCCOL nSourceField = nQueryCol - rParam.nCol1; + SCROW nId = GetItemDataId( nSourceField, nRow, FALSE ); + const ScDPItemData* pCellData = GetItemDataById( nSourceField, nId ); BOOL bOk = FALSE; BOOL bTestEqual = FALSE; diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 61289cc7f931..b0df298315bf 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -529,9 +529,18 @@ void ScDrawStringsVars::SetTextToWidthOrHash( ScBaseCell* pCell, long nWidth ) // must be a value or formula cell. return; - if (eType == CELLTYPE_FORMULA && !static_cast<ScFormulaCell*>(pCell)->IsValue()) + if (eType == CELLTYPE_FORMULA) + { + ScFormulaCell* pFCell = static_cast<ScFormulaCell*>(pCell); + if (pFCell->GetErrCode() != 0) + { + SetHashText(); // If the error string doesn't fit, always use "###" + return; + } // If it's formula, the result must be a value. - return; + if (!pFCell->IsValue()) + return; + } ULONG nFormat = GetValueFormat(); if ((nFormat % SV_COUNTRY_LANGUAGE_OFFSET) != 0) diff --git a/scp2/source/binfilter/module_binfilter.scp b/scp2/source/binfilter/module_binfilter.scp index ca3c94b759e0..4857ecf3804b 100644 --- a/scp2/source/binfilter/module_binfilter.scp +++ b/scp2/source/binfilter/module_binfilter.scp @@ -60,7 +60,7 @@ Module gid_Module_Langpack_Binfilter_Template ParentID = gid_Module_Optional_Binfilter; Name = "gid_Module_Langpack_Binfilter_Template"; Description = "gid_Module_Langpack_Binfilter_Template"; - Default = NO; + Default = YES; Styles = (TEMPLATEMODULE); Files = (gid_File_Res_Bf_Sch, gid_File_Res_Bf_Svx, diff --git a/scp2/source/templates/module_langpack_binfilter.sct b/scp2/source/templates/module_langpack_binfilter.sct index 72c209228849..ffcabf0cf587 100644 --- a/scp2/source/templates/module_langpack_binfilter.sct +++ b/scp2/source/templates/module_langpack_binfilter.sct @@ -28,7 +28,7 @@ Module gid_Module_Langpack_Binfilter_<LANGUAGE_> ParentID = gid_Module_Langpack_Root_<LANGUAGE_>; Sortkey = "900"; - Default = NO; + Default = YES; Language = "<LANGUAGE>"; Assigns = gid_Module_Langpack_Binfilter_Template; Name = "gid_Module_Langpack_Binfilter_<LANGUAGE_>"; diff --git a/sfx2/inc/sfx2/ipclient.hxx b/sfx2/inc/sfx2/ipclient.hxx index e0708f1f061d..960c6629b8d2 100644 --- a/sfx2/inc/sfx2/ipclient.hxx +++ b/sfx2/inc/sfx2/ipclient.hxx @@ -101,6 +101,7 @@ public: // used in Writer // Rectangle PixelObjVisAreaToLogic( const Rectangle & rObjRect ) const; // Rectangle LogicObjAreaToPixel( const Rectangle & rRect ) const; + virtual void FormatChanged(); // object format was changed (used for StarMath formulas aligning) }; #endif diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc index 895748db6c20..b5dd2623ae35 100644 --- a/sfx2/inc/sfx2/sfxsids.hrc +++ b/sfx2/inc/sfx2/sfxsids.hrc @@ -193,7 +193,7 @@ #define SID_EXPLORER_FILEPROPS_END (SID_SFX_START + 1399) #define ID_FILETP_START SID_EXPLORER_FILEPROPS_START -#define ID_FILETP_READONLY (ID_FILETP_START + 0) +#define ID_FILETP_READONLY (ID_FILETP_START + 0) #define ID_FILETP_TITLE (ID_FILETP_START + 1) #define SID_EXPLORER_PROPS_START (SID_SFX_START + 1410) @@ -227,9 +227,9 @@ #define SID_OFFICE_PLK (SID_SFX_START + 1601) #define SID_OFFICE_PALK (SID_SFX_START + 1604) #define SID_CHECK_KEY (SID_SFX_START + 1605) -#define SID_OFFICE_PRIVATE_USE (SID_SFX_START + 1606) -#define SID_OFFICE_COMMERCIAL_USE (SID_SFX_START + 1607) -#define SID_OFFICE_CUSTOMERNUMBER (SID_SFX_START + 1608) +#define SID_OFFICE_PRIVATE_USE (SID_SFX_START + 1606) +#define SID_OFFICE_COMMERCIAL_USE (SID_SFX_START + 1607) +#define SID_OFFICE_CUSTOMERNUMBER (SID_SFX_START + 1608) #define SID_OFFICE_INVALIDATE_TITLE (SID_SFX_START + 1609) #define SID_OFFICE_CHECK_PLZ (SID_SFX_START + 1610) #define SID_INTERNET_SEARCH (SID_SFX_START + 1611) @@ -242,11 +242,11 @@ #define SID_NEW_MSG_PARENT (SID_SFX_START + 1622) -#define SID_PGP_ENCODE (SID_SFX_START + 1625) -#define SID_PGP_DECODE (SID_SFX_START + 1626) -#define SID_TIPWINDOW (SID_SFX_START + 1632) +#define SID_PGP_ENCODE (SID_SFX_START + 1625) +#define SID_PGP_DECODE (SID_SFX_START + 1626) +#define SID_TIPWINDOW (SID_SFX_START + 1632) #define SID_CHARSET (SID_SFX_START + 1633) -#define SID_OVERWRITE (SID_SFX_START + 1634) +#define SID_OVERWRITE (SID_SFX_START + 1634) #define SID_RENAME (SID_SFX_START + 1653) #define SID_PARTWIN (SID_SFX_START + 1640) #define SID_CRASH (SID_SFX_START + 1645) @@ -277,7 +277,7 @@ #define SID_SHOW_IME_STATUS_WINDOW (SID_SFX_START + 1680) #define SID_UPDATE_CONFIG (SID_SFX_START + 1681) #define SID_VIEWONLY (SID_SFX_START + 1682) -#define SID_REPAIRPACKAGE (SID_SFX_START + 1683) +#define SID_REPAIRPACKAGE (SID_SFX_START + 1683) #define SID_ADDONHELP (SID_SFX_START + 1684) #define SID_OBJECTSHELL (SID_SFX_START + 1685) #define SID_MINIMIZED (SID_SFX_START + 1687) @@ -311,7 +311,9 @@ #define SID_DEFAULTFILENAME (SID_SFX_START + 1717) #define SID_MODIFYPASSWORDINFO (SID_SFX_START + 1718) #define SID_RECOMMENDREADONLY (SID_SFX_START + 1719) -#define SID_SFX_free_START (SID_SFX_START + 1720) +#define SID_SUGGESTEDSAVEASDIR (SID_SFX_START + 1720) +#define SID_SUGGESTEDSAVEASNAME (SID_SFX_START + 1721) +#define SID_SFX_free_START (SID_SFX_START + 1722) #define SID_SFX_free_END (SID_SFX_START + 3999) #define SID_OPEN_NEW_VIEW (SID_SFX_START + 520) @@ -494,7 +496,7 @@ #define SID_PASTE (SID_SFX_START + 712) // steht unter diesem Wert in chaos/cntids.hrc!!! -//#define SID_DELETE (SID_SFX_START + 713) +//#define SID_DELETE (SID_SFX_START + 713) #define SID_BACKSPACE (SID_SFX_START + 714) #define SID_FORMATPAINTBRUSH (SID_SFX_START + 715) @@ -658,7 +660,7 @@ #define SID_OPT_HELP_PATH (SID_SFX_START + 1560) #define SID_OPT_BOOKMARKS_PATH (SID_SFX_START + 1561) #define SID_OPT_GALLERY_PATH (SID_SFX_START + 1562) -#define SID_OPT_NEWDOC_PATH (SID_SFX_START + 1563) +#define SID_OPT_NEWDOC_PATH (SID_SFX_START + 1563) #define SID_OPT_AGENTS_PATH (SID_SFX_START + 1564) #define SID_OPT_AUTOPILOT_PATH (SID_SFX_START + 1565) #define SID_OPT_EXPLORER_PATH (SID_SFX_START + 1566) @@ -752,9 +754,9 @@ #define SID_ATTR_AUTOHELPAGENT (SID_OPTIONS_START + 67) #define SID_AUTOHELPAGENT_RESET (SID_OPTIONS_START + 68) #define SID_HELPAGENT_TIMEOUT (SID_OPTIONS_START + 93) -#define SID_ATTR_WELCOMESCREEN (SID_OPTIONS_START + 81) +#define SID_ATTR_WELCOMESCREEN (SID_OPTIONS_START + 81) #define SID_WELCOMESCREEN_RESET (SID_OPTIONS_START + 82) -#define SID_RESTORE_EXPAND_STATE (SID_OPTIONS_START + 83) +#define SID_RESTORE_EXPAND_STATE (SID_OPTIONS_START + 83) #define SID_ATTR_QUICKLAUNCHER (SID_OPTIONS_START + 74) #define SID_ATTR_YEAR2000 (SID_OPTIONS_START + 87) #define SID_ATTR_ALLOWFOLDERWEBVIEW (SID_OPTIONS_START + 92) @@ -826,7 +828,7 @@ #define SID_INET_CHANNELS_ONOFF (SID_OPTIONS_START + 64) -#define SID_INET_COOKIESHANDLE (SID_OPTIONS_START + 69) +#define SID_INET_COOKIESHANDLE (SID_OPTIONS_START + 69) #define SID_INET_CACHEJS (SID_OPTIONS_START + 70) #define SID_INET_CACHEEXPIRED (SID_OPTIONS_START + 71) diff --git a/sfx2/qa/cppunit/makefile.mk b/sfx2/qa/cppunit/makefile.mk index dce0b86a0619..b53a04ec43f9 100644 --- a/sfx2/qa/cppunit/makefile.mk +++ b/sfx2/qa/cppunit/makefile.mk @@ -25,6 +25,10 @@ # #************************************************************************* +.IF "$(OOO_SUBSEQUENT_TESTS)" == "" +nothing .PHONY: +.ELSE + PRJ=../.. PRJNAME=sfx2 TARGET=qa_cppunit @@ -79,3 +83,4 @@ SLOFILES= \ .INCLUDE : target.mk .INCLUDE : _cppunit.mk +.END diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index 7056cc48a704..5347aec0e99f 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -165,7 +165,7 @@ static char const sDontEdit[] = "DontEdit"; static char const sSilent[] = "Silent"; static char const sJumpMark[] = "JumpMark"; static char const sFileName[] = "FileName"; -static char const sSalvageURL[] = "SalvagedFile"; +static char const sSalvagedFile[] = "SalvagedFile"; static char const sStatusInd[] = "StatusIndicator"; static char const sModel[] = "Model"; static char const sFrame[] = "Frame"; @@ -191,6 +191,8 @@ static char const sUseSystemDialog[] = "UseSystemDialog"; static char const sStandardDir[] = "StandardDir"; static char const sBlackList[] = "BlackList"; static char const sModifyPasswordInfo[] = "ModifyPasswordInfo"; +static char const sSuggestedSaveAsDir[] = "SuggestedSaveAsDir"; +static char const sSuggestedSaveAsName[] = "SuggestedSaveAsName"; void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& rArgs, SfxAllItemSet& rSet, const SfxSlot* pSlot ) { @@ -685,7 +687,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ::rtl::OUString sVal; sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); - DBG_ASSERT( bOK, "invalid type or value for StanadardDir" ); + DBG_ASSERT( bOK, "invalid type or value for StandardDir" ); if (bOK) rSet.Put( SfxStringItem( SID_STANDARD_DIR, sVal ) ); } @@ -709,11 +711,11 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque if (bOK) rSet.Put( SfxStringItem( SID_FILE_NAME, sVal ) ); } - else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvageURL)) ) + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSalvagedFile)) ) { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); - DBG_ASSERT( bOK, "invalid type or value for SalvageURL" ); + DBG_ASSERT( bOK, "invalid type or value for SalvagedFile" ); if (bOK) rSet.Put( SfxStringItem( SID_DOC_SALVAGE, sVal ) ); } @@ -721,7 +723,7 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { ::rtl::OUString sVal; sal_Bool bOK = (rProp.Value >>= sVal); - DBG_ASSERT( bOK, "invalid type or value for SalvageURL" ); + DBG_ASSERT( bOK, "invalid type or value for FolderName" ); if (bOK) rSet.Put( SfxStringItem( SID_PATH, sVal ) ); } @@ -850,6 +852,22 @@ void TransformParameters( sal_uInt16 nSlotId, const ::com::sun::star::uno::Seque { rSet.Put( SfxUnoAnyItem( SID_MODIFYPASSWORDINFO, rProp.Value ) ); } + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsDir)) ) + { + ::rtl::OUString sVal; + sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); + DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsDir" ); + if (bOK) + rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASDIR, sVal ) ); + } + else if ( aName.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM(sSuggestedSaveAsName)) ) + { + ::rtl::OUString sVal; + sal_Bool bOK = ((rProp.Value >>= sVal) && sVal.getLength()); + DBG_ASSERT( bOK, "invalid type or value for SuggestedSaveAsName" ); + if (bOK) + rSet.Put( SfxStringItem( SID_SUGGESTEDSAVEASNAME, sVal ) ); + } #ifdef DBG_UTIL else --nFoundArgs; @@ -1064,6 +1082,10 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta nAdditional++; if ( rSet.GetItemState( SID_MODIFYPASSWORDINFO ) == SFX_ITEM_SET ) nAdditional++; + if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR ) == SFX_ITEM_SET ) + nAdditional++; + if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME ) == SFX_ITEM_SET ) + nAdditional++; // consider additional arguments nProps += nAdditional; @@ -1205,6 +1227,10 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta continue; if ( nId == SID_MODIFYPASSWORDINFO ) continue; + if ( nId == SID_SUGGESTEDSAVEASDIR ) + continue; + if ( nId == SID_SUGGESTEDSAVEASNAME ) + continue; } ByteString aDbg( "Unknown item detected: "); @@ -1489,7 +1515,7 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta } if ( rSet.GetItemState( SID_DOC_SALVAGE, sal_False, &pItem ) == SFX_ITEM_SET ) { - pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvageURL)); + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSalvagedFile)); pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); } if ( rSet.GetItemState( SID_PATH, sal_False, &pItem ) == SFX_ITEM_SET ) @@ -1568,6 +1594,16 @@ void TransformItems( sal_uInt16 nSlotId, const SfxItemSet& rSet, ::com::sun::sta pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sModifyPasswordInfo)); pValue[nActProp++].Value = ( ((SfxUnoAnyItem*)pItem)->GetValue() ); } + if ( rSet.GetItemState( SID_SUGGESTEDSAVEASDIR, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsDir)); + pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); + } + if ( rSet.GetItemState( SID_SUGGESTEDSAVEASNAME, sal_False, &pItem ) == SFX_ITEM_SET ) + { + pValue[nActProp].Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sSuggestedSaveAsName)); + pValue[nActProp++].Value <<= ( ::rtl::OUString(((SfxStringItem*)pItem)->GetValue()) ); + } } } @@ -1873,8 +1909,8 @@ ErrCode SfxMacroLoader::loadMacro( const ::rtl::OUString& rURL, com::sun::star:: } if ( pSh && pSh->GetModel().is() ) - // remove flag for modal mode - pSh->SetMacroMode_Impl( FALSE ); + // remove flag for modal mode + pSh->SetMacroMode_Impl( FALSE ); } else nErr = ERRCODE_BASIC_PROC_UNDEFINED; @@ -2216,18 +2252,18 @@ RequestFilterOptions::RequestFilterOptions( ::com::sun::star::uno::Reference< :: ::rtl::OUString temp; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; ::com::sun::star::document::FilterOptionsRequest aOptionsRequest( temp, - temp2, + temp2, rModel, rProperties ); - m_aRequest <<= aOptionsRequest; + m_aRequest <<= aOptionsRequest; - m_pAbort = new ContinuationAbort; - m_pOptions = new FilterOptionsContinuation; + m_pAbort = new ContinuationAbort; + m_pOptions = new FilterOptionsContinuation; - m_lContinuations.realloc( 2 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); - m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions ); + m_lContinuations.realloc( 2 ); + m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); + m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pOptions ); } ::com::sun::star::uno::Any SAL_CALL RequestFilterOptions::getRequest() @@ -2250,17 +2286,17 @@ RequestPackageReparation::RequestPackageReparation( ::rtl::OUString aName ) ::rtl::OUString temp; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp, - temp2, - aName ); + temp2, + aName ); - m_aRequest <<= aBrokenPackageRequest; + m_aRequest <<= aBrokenPackageRequest; - m_pApprove = new ContinuationApprove; - m_pDisapprove = new ContinuationDisapprove; + m_pApprove = new ContinuationApprove; + m_pDisapprove = new ContinuationDisapprove; - m_lContinuations.realloc( 2 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove ); - m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove ); + m_lContinuations.realloc( 2 ); + m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pApprove ); + m_lContinuations[1] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pDisapprove ); } /*uno::*/Any SAL_CALL RequestPackageReparation::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) @@ -2303,15 +2339,15 @@ NotifyBrokenPackage::NotifyBrokenPackage( ::rtl::OUString aName ) ::rtl::OUString temp; ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > temp2; ::com::sun::star::document::BrokenPackageRequest aBrokenPackageRequest( temp, - temp2, - aName ); + temp2, + aName ); - m_aRequest <<= aBrokenPackageRequest; + m_aRequest <<= aBrokenPackageRequest; - m_pAbort = new ContinuationAbort; + m_pAbort = new ContinuationAbort; - m_lContinuations.realloc( 1 ); - m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); + m_lContinuations.realloc( 1 ); + m_lContinuations[0] = ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionContinuation >( m_pAbort ); } /*uno::*/Any SAL_CALL NotifyBrokenPackage::queryInterface( const /*uno::*/Type& rType ) throw (RuntimeException) diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index 328d88d8b2b9..997cb584f83d 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -220,6 +220,7 @@ void SAL_CALL SfxInPlaceClient_Impl::notifyEvent( const document::EventObject& a if ( m_pClient && aEvent.EventName.equalsAscii("OnVisAreaChanged") && m_nAspect != embed::Aspects::MSOLE_ICON ) { + m_pClient->FormatChanged(); // for Writer when format of the object is changed with the area m_pClient->ViewChanged(); m_pClient->Invalidate(); } @@ -1082,6 +1083,11 @@ void SfxInPlaceClient::MakeVisible() // dummy implementation } +void SfxInPlaceClient::FormatChanged() +{ + // dummy implementation +} + void SfxInPlaceClient::DeactivateObject() { if ( GetObject().is() ) diff --git a/sfx2/workben/custompanel/makefile.mk b/sfx2/workben/custompanel/makefile.mk index 1eb20ceed35d..2a4704af499a 100644 --- a/sfx2/workben/custompanel/makefile.mk +++ b/sfx2/workben/custompanel/makefile.mk @@ -67,7 +67,7 @@ SHL1STDLIBS= \ $(SALHELPERLIB) \ $(CPPUHELPERLIB) -SHL1VERSIONMAP=$(SOLARSRC)/solenv/src/component.map +SHL1VERSIONMAP=$(SOLARSRC)/solenv/src/reg-component.map SHL1LIBS= $(LIB1TARGET) SHL1DEF= $(MISC)/$(SHL1TARGET).def SHL1RPATH= OXT diff --git a/solenv/bin/cws.pl b/solenv/bin/cws.pl index 439ce02e2742..bf9ce9508d38 100644 --- a/solenv/bin/cws.pl +++ b/solenv/bin/cws.pl @@ -74,8 +74,8 @@ my @valid_commands = ( my %valid_options_hash = ( 'help' => ['help'], 'create' => ['help', 'milestone', 'migration', 'hg'], - 'fetch' => ['help', 'milestone', 'childworkspace','platforms','quiet', - 'onlysolver'], + 'fetch' => ['help', 'milestone', 'childworkspace','platforms','noautocommon', + 'quiet', 'onlysolver'], 'query' => ['help', 'milestone','masterworkspace','childworkspace'], 'task' => ['help'], 'setcurrent' => ['help', 'milestone'], @@ -120,6 +120,7 @@ sub parse_command_line 'profile', 'commit|C', 'platforms|p=s', + 'noautocommon|x=s', 'onlysolver|o', 'quiet|q', 'help|h' @@ -445,7 +446,7 @@ sub hg_clone_cws_or_milestone require LWP::Simple; my $content = LWP::Simple::get($cws_remote_source); my $pattern = "<title>cws/". $cws->child(); - if ( $content =~ /$pattern/ ) { + if ( $content && $content =~ /$pattern/ ) { $pull_from_remote = 1; } else { @@ -1457,21 +1458,28 @@ sub do_help print STDERR "fetch: fetch a milestone or CWS\n"; print STDERR "usage: fetch [-q] [-p platforms] [-o] <-m milestone> <workspace>\n"; print STDERR "usage: fetch [-q] [-p platforms] [-o] <-c cws> <workspace>\n"; + print STDERR "usage: fetch [-q] [-x platforms] [-o] <-m milestone> <workspace>\n"; + print STDERR "usage: fetch [-q] [-x platforms] [-o] <-c cws> <workspace>\n"; print STDERR "usage: fetch [-q] <-m milestone> <workspace>\n"; print STDERR "usage: fetch [-q] <-c cws> <workspace>\n"; - print STDERR "\t-m milestone: Checkout milestone <milestone> to workspace <workspace>\n"; - print STDERR "\t Use 'latest' for the for lastest published milestone on the current master\n"; - print STDERR "\t For cross master checkouts use the form <MWS>:<milestone>\n"; - print STDERR "\t--milestone milestone: Same as -m milestone\n"; - print STDERR "\t-c childworkspace: Checkout CWS <childworkspace> to workspace <workspace>\n"; - print STDERR "\t--child childworkspace: Same as -c childworkspace\n"; - print STDERR "\t-p platform: Copy one or more prebuilt platforms 'platform'. \n"; - print STDERR "\t Separate multiple platforms with commas.\n"; - print STDERR "\t--platforms platform: Same as -p\n"; - print STDERR "\t-o Omit checkout of sources, copy only solver. \n"; - print STDERR "\t--onlysolver: Same as -o\n"; - print STDERR "\t-q Silence some of the output of the command.\n"; - print STDERR "\t--quiet: Same as -q\n"; + print STDERR "\t-m milestone: Checkout milestone <milestone> to workspace <workspace>\n"; + print STDERR "\t Use 'latest' for the for lastest published milestone on the current master\n"; + print STDERR "\t For cross master checkouts use the form <MWS>:<milestone>\n"; + print STDERR "\t--milestone milestone: Same as -m milestone\n"; + print STDERR "\t-c childworkspace: Checkout CWS <childworkspace> to workspace <workspace>\n"; + print STDERR "\t--child childworkspace: Same as -c childworkspace\n"; + print STDERR "\t-p platform: Copy one or more prebuilt platforms 'platform'. \n"; + print STDERR "\t Separate multiple platforms with commas.\n"; + print STDERR "\t Automatically adds 'common[.pro]' as required.\n"; + print STDERR "\t--platforms platform: Same as -p\n"; + print STDERR "\t-x platform: Copy one or more prebuilt platforms 'platform'. \n"; + print STDERR "\t Separate multiple platforms with commas.\n"; + print STDERR "\t Does not automatically adds 'common[.pro]'.\n"; + print STDERR "\t--noautocommon platform: Same as -x\n"; + print STDERR "\t-o: Omit checkout of sources, copy only solver. \n"; + print STDERR "\t--onlysolver: Same as -o\n"; + print STDERR "\t-q: Silence some of the output of the command.\n"; + print STDERR "\t--quiet: Same as -q\n"; } elsif ($arg eq 'setcurrent') { print STDERR "setcurrent: Set the current milestone for the CWS (only hg based CWSs)\n"; @@ -1576,6 +1584,7 @@ sub do_fetch my $milestone_opt = $options_ref->{'milestone'}; my $child = $options_ref->{'childworkspace'}; my $platforms = $options_ref->{'platforms'}; + my $noautocommon = $options_ref->{'noautocommon'}; my $quiet = $options_ref->{'quiet'} ? 1 : 0 ; my $switch = $options_ref->{'switch'} ? 1 : 0 ; my $onlysolver = $options_ref->{'onlysolver'} ? 1 : 0 ; @@ -1590,8 +1599,13 @@ sub do_fetch do_help(['fetch']); } - if ( $onlysolver && !defined($platforms) ) { - print_error("Option '-o' is Only usuable combination with option '-p'.", 0); + if ( defined($platforms) && defined($noautocommon) ) { + print_error("Options -p and -x are mutally exclusive", 0); + do_help(['fetch']); + } + + if ( $onlysolver && !(defined($platforms) || defined($noautocommon)) ) { + print_error("Option '-o' is Only usuable combination with option '-p' or '-x'.", 0); do_help(['fetch']); } @@ -1634,42 +1648,47 @@ sub do_fetch # Check early for platforms so we can bail out before anything time consuming is done # in case of a missing platform my @platforms; - if ( defined($platforms) ) { + if ( defined($platforms) || defined($noautocommon) ) { use Archive::Zip; # warn early if module is missing if ( !defined($prebuild_dir ) ) { print_error("PREBUILD_BINARIES not configured, can't find platform solvers", 99); } $prebuild_dir = "$prebuild_dir/$masterws"; - @platforms = split(/,/, $platforms); + if ( defined($platforms) ) { + @platforms = split(/,/, $platforms); - my $added_product = 0; - my $added_nonproduct = 0; - foreach(@platforms) { - if ( $_ eq 'common.pro' ) { - $added_product = 1; - print_warning("'$_' is added automatically to the platform list, don't specify it explicit"); - } - if ( $_ eq 'common' ) { - $added_nonproduct = 1; - print_warning("'$_' is added automatically to the platform list, don't specify it explicit"); - } - } - - # add common.pro/common to platform list - if ( $so_svn_server ) { - my $product = 0; - my $nonproduct = 0; + my $added_product = 0; + my $added_nonproduct = 0; foreach(@platforms) { - if ( /\.pro$/ ) { - $product = 1; + if ( $_ eq 'common.pro' ) { + $added_product = 1; + print_warning("'$_' is added automatically to the platform list, don't specify it explicit"); } - else { - $nonproduct = 1; + if ( $_ eq 'common' ) { + $added_nonproduct = 1; + print_warning("'$_' is added automatically to the platform list, don't specify it explicit"); } } - unshift(@platforms, 'common.pro') if ($product && !$added_product); - unshift(@platforms, 'common') if ($nonproduct && !$added_nonproduct); + + # add common.pro/common to platform list + if ( $so_svn_server ) { + my $product = 0; + my $nonproduct = 0; + foreach(@platforms) { + if ( /\.pro$/ ) { + $product = 1; + } + else { + $nonproduct = 1; + } + } + unshift(@platforms, 'common.pro') if ($product && !$added_product); + unshift(@platforms, 'common') if ($nonproduct && !$added_nonproduct); + } + } + else { + @platforms = split(/,/, $noautocommon); } foreach(@platforms) { @@ -1733,7 +1752,7 @@ sub do_fetch } } - if ( defined($platforms) ) { + if ( defined($platforms) || defined($noautocommon) ) { if ( !-d $workspace ) { if ( !mkdir($workspace) ) { print_error("Can't create directory '$workspace': $!.", 8); diff --git a/solenv/inc/minor.mk b/solenv/inc/minor.mk index 4d5665886448..2716c19b5268 100644 --- a/solenv/inc/minor.mk +++ b/solenv/inc/minor.mk @@ -1,5 +1,5 @@ RSCVERSION=300 -RSCREVISION=300m93(Build:9544) -BUILD=9544 -LAST_MINOR=m93 +RSCREVISION=300m94(Build:9547) +BUILD=9547 +LAST_MINOR=m94 SOURCEVERSION=DEV300 diff --git a/solenv/inc/postset.mk b/solenv/inc/postset.mk index f16ccb554fc5..888098fde3df 100644 --- a/solenv/inc/postset.mk +++ b/solenv/inc/postset.mk @@ -32,7 +32,9 @@ defaultlangiso=en-US # Complete list of all supported ISO codes completelangiso=af \ ar \ +as \ as-IN \ +ast \ be-BY \ bo \ bg \ @@ -44,6 +46,7 @@ bn-IN \ bs \ by \ ca \ +ca-XV \ cs \ cy \ da \ @@ -67,6 +70,7 @@ gl \ gu \ gu-IN \ he \ +hi \ hi-IN \ hr \ hu \ @@ -76,6 +80,7 @@ ja \ kid \ ky \ ka \ +kab \ kk \ km \ kn \ @@ -91,7 +96,9 @@ mk \ mn \ mni \ ms \ +ml \ ml-IN \ +mr \ mr-IN \ my \ ne \ @@ -100,19 +107,26 @@ nl \ nn \ nr \ ns \ +nso \ om \ +oms \ oc \ +or \ or-IN \ pap \ +pa \ pa-IN \ pl \ ps \ pt \ pt-BR \ +gug \ +pyg \ ro \ ru \ rw \ sat \ +sa \ sa-IN \ si \ sc \ @@ -121,22 +135,27 @@ sq \ sk \ sl \ sh \ +son \ sr \ ss \ st \ sv \ sw \ sw-TZ \ +te \ te-IN \ +ti \ ti-ER \ ta \ ta-IN \ +tlh \ th \ tn \ tr \ ts \ tg \ ug \ +ur \ ur-IN \ uk \ uz \ diff --git a/starmath/inc/node.hxx b/starmath/inc/node.hxx index 92c9d4621292..e2a21238064d 100644 --- a/starmath/inc/node.hxx +++ b/starmath/inc/node.hxx @@ -180,6 +180,10 @@ public: const SmNode * FindTokenAt(USHORT nRow, USHORT nCol) const; const SmNode * FindRectClosestTo(const Point &rPoint) const; + + // --> 4.7.2010 #i972# + virtual long GetFormulaBaseline() const; + // <-- }; @@ -456,6 +460,9 @@ public: class SmTableNode : public SmStructureNode { + // --> 4.7.2010 #i972# + long nFormulaBaseline; + // <-- public: SmTableNode(const SmToken &rNodeToken) : SmStructureNode(NTABLE, rNodeToken) @@ -465,6 +472,7 @@ public: virtual SmNode * GetLeftMost(); virtual void Arrange(const OutputDevice &rDev, const SmFormat &rFormat); + virtual long GetFormulaBaseline() const; }; diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index ab1382b97879..243e16fb6504 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -38,6 +38,8 @@ #include <comphelper/storagehelper.hxx> #include <rtl/logfile.hxx> #include <rtl/ustring.hxx> +#include <unotools/eventcfg.hxx> +#include <sfx2/event.hxx> #include <sfx2/app.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/docfile.hxx> @@ -180,7 +182,14 @@ void SmDocShell::SetText(const String& rBuffer) { pViewSh->GetViewFrame()->GetBindings().Invalidate(SID_TEXT); if ( SFX_CREATE_MODE_EMBEDDED == GetCreateMode() ) + { + // have SwOleClient::FormatChanged() to align the modified formula properly + // even if the vis area does not change (e.g. when formula text changes from + // "{a over b + c} over d" to "d over {a over b + c}" + SFX_APP()->NotifyEvent(SfxEventHint( SFX_EVENT_VISAREACHANGED, GlobalEventConfig::GetEventName(STR_EVENT_VISAREACHANGED), this)); + Repaint(); + } else pViewSh->GetGraphicWindow().Invalidate(); } diff --git a/starmath/source/node.cxx b/starmath/source/node.cxx index d8e2586e151e..b1d7d9e69210 100755 --- a/starmath/source/node.cxx +++ b/starmath/source/node.cxx @@ -573,6 +573,13 @@ const SmNode * SmNode::FindNodeWithAccessibleIndex(xub_StrLen nAccIdx) const return pResult; } + +long SmNode::GetFormulaBaseline() const +{ + DBG_ASSERT( 0, "This dummy implementation should not have been called." ); + return 0; +} + /////////////////////////////////////////////////////////////////////////// SmStructureNode::SmStructureNode( const SmStructureNode &rNode ) : @@ -763,7 +770,7 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) } Point aPos; - SmRect::operator = (SmRect(nMaxWidth, 0)); + SmRect::operator = (SmRect(nMaxWidth, 1)); for (i = 0; i < nSize; i++) { if (NULL != (pNode = GetSubNode(i))) { const SmRect &rNodeRect = pNode->GetRect(); @@ -779,6 +786,22 @@ void SmTableNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) ExtendBy(rNodeRect, nSize > 1 ? RCP_NONE : RCP_ARG); } } + // --> 4.7.2010 #i972# + if (HasBaseline()) + nFormulaBaseline = GetBaseline(); + else + { + SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE); + aTmpDev.SetFont(GetFont()); + + SmRect aRect = (SmRect(aTmpDev, &rFormat, C2S("a"), + GetFont().GetBorderWidth())); + nFormulaBaseline = GetAlignM(); + // move from middle position by constant - distance + // between middle and baseline for single letter + nFormulaBaseline += aRect.GetBaseline() - aRect.GetAlignM(); + } + // <-- } @@ -788,6 +811,12 @@ SmNode * SmTableNode::GetLeftMost() } +long SmTableNode::GetFormulaBaseline() const +{ + return nFormulaBaseline; +} + + /**************************************************************************/ @@ -818,20 +847,21 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) SmTmpDevice aTmpDev ((OutputDevice &) rDev, TRUE); aTmpDev.SetFont(GetFont()); - // provide an empty rectangle with alignment parameters for the "current" - // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the - // same sub-/supscript positions.) - //! be sure to use a character that has explicitly defined HiAttribut - //! line in rect.cxx such as 'a' in order to make 'vec a' look same to - //! 'vec {a}'. - SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"), - GetFont().GetBorderWidth())); - // make sure that the rectangle occupies (almost) no space - SetWidth(1); - SetItalicSpaces(0, 0); - if (nSize < 1) + { + // provide an empty rectangle with alignment parameters for the "current" + // font (in order to make "a^1 {}_2^3 a_4" work correct, that is, have the + // same sub-/supscript positions.) + //! be sure to use a character that has explicitly defined HiAttribut + //! line in rect.cxx such as 'a' in order to make 'vec a' look same to + //! 'vec {a}'. + SmRect::operator = (SmRect(aTmpDev, &rFormat, C2S("a"), + GetFont().GetBorderWidth())); + // make sure that the rectangle occupies (almost) no space + SetWidth(1); + SetItalicSpaces(0, 0); return; + } // make distance depend on font size long nDist = (rFormat.GetDistance(DIS_HORIZONTAL) * GetFont().GetSize().Height()) / 100L; @@ -839,14 +869,17 @@ void SmLineNode::Arrange(const OutputDevice &rDev, const SmFormat &rFormat) nDist = 0; Point aPos; - for (i = 0; i < nSize; i++) + // copy the first node into LineNode and extend by the others + if (NULL != (pNode = GetSubNode(0))) + SmRect::operator = (pNode->GetRect()); + + for (i = 1; i < nSize; i++) if (NULL != (pNode = GetSubNode(i))) { aPos = pNode->AlignTo(*this, RP_RIGHT, RHA_CENTER, RVA_BASELINE); - // no horizontal space before first node - if (i) - aPos.X() += nDist; + // add horizontal space to the left for each but the first sub node + aPos.X() += nDist; pNode->MoveTo(aPos); ExtendBy( *pNode, RCP_XOR ); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index cd3e4b714469..108cb9c69e4a 100755 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -238,7 +238,8 @@ enum SmModelPropertyHandles // --> PB 2004-08-25 #i33095# Security Options HANDLE_LOAD_READONLY, // <-- - HANDLE_DIALOG_LIBRARIES // #i73329# + HANDLE_DIALOG_LIBRARIES, // #i73329# + HANDLE_BASELINE // 3.7.2010 #i972# }; PropertySetInfo * lcl_createModelPropertyInfo () @@ -310,6 +311,9 @@ PropertySetInfo * lcl_createModelPropertyInfo () // --> PB 2004-08-25 #i33095# Security Options { RTL_CONSTASCII_STRINGPARAM( "LoadReadonly" ), HANDLE_LOAD_READONLY, &::getBooleanCppuType(), PROPERTY_NONE, 0 }, // <-- + // --> 3.7.2010 #i972# + { RTL_CONSTASCII_STRINGPARAM( "BaseLine"), HANDLE_BASELINE, &::getCppuType((const sal_Int16*)0), PROPERTY_NONE, 0}, + // <-- { NULL, 0, 0, NULL, 0, 0 } }; PropertySetInfo *pInfo = new PropertySetInfo ( aModelPropertyInfoMap ); @@ -955,6 +959,21 @@ void SmModel::_getPropertyValues( const PropertyMapEntry **ppEntries, Any *pValu break; } // <-- + // --> 3.7.2010 #i972# + case HANDLE_BASELINE: + { + if ( !pDocSh->pTree ) + pDocSh->Parse(); + if ( pDocSh->pTree ) + { + if ( !pDocSh->IsFormulaArranged() ) + pDocSh->ArrangeFormula(); + + *pValue <<= static_cast<sal_Int32>( pDocSh->pTree->GetFormulaBaseline() ); + } + } + break; + // <-- } } } diff --git a/svtools/source/control/inettbc.cxx b/svtools/source/control/inettbc.cxx index 6781efc070fe..4aaa55409266 100644..100755 --- a/svtools/source/control/inettbc.cxx +++ b/svtools/source/control/inettbc.cxx @@ -41,10 +41,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/sdbc/XResultSet.hpp> #include <com/sun/star/sdbc/XRow.hpp> - -#ifndef _COM_SUN_STAR_TASK_XINTERACTIONHANDLER_HDL_ -#include <com/sun/star/task/XInteractionHandler.hdl> -#endif +#include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/ucb/NumberedSortingInfo.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XProgressHandler.hpp> @@ -165,7 +162,7 @@ SvtMatchContext_Impl::SvtMatchContext_Impl( SvtURLBox* pBoxP, const String& rText ) : aLink( STATIC_LINK( this, SvtMatchContext_Impl, Select_Impl ) ) , aBaseURL( pBoxP->aBaseURL ) - , aText( rText ) + , aText( rText ) , pBox( pBoxP ) , bStop( FALSE ) , bOnlyDirectories( pBoxP->bOnlyDirectories ) @@ -426,7 +423,7 @@ void SvtMatchContext_Impl::ReadFolder( const String& rURL, uno::Reference< XDynamicResultSet > xDynResultSet; ResultSetInclude eInclude = INCLUDE_FOLDERS_AND_DOCUMENTS; if ( bOnlyDirectories ) - eInclude = INCLUDE_FOLDERS_ONLY; + eInclude = INCLUDE_FOLDERS_ONLY; xDynResultSet = aCnt.createDynamicCursor( aProps, eInclude ); @@ -654,7 +651,7 @@ void SvtMatchContext_Impl::run() { // if text input is a directory, it must be part of the match list! Until then it is scanned if ( UCBContentHelper::IsFolder( aMainURL ) && aURLObject.hasFinalSlash() ) - Insert( aText, aMatch ); + Insert( aText, aMatch ); else // otherwise the parent folder will be taken aURLObject.removeSegment(); @@ -684,6 +681,7 @@ void SvtMatchContext_Impl::run() aCurObj.SetURL( *aPickList.GetObject( nPos ) ); aCurObj.SetSmartURL( aCurObj.GetURLNoPass()); aCurMainURL = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); + if( eProt != INET_PROT_NOT_VALID && aCurObj.GetProtocol() != eProt ) continue; @@ -708,7 +706,7 @@ void SvtMatchContext_Impl::run() { // try if text matches the scheme String aScheme( INetURLObject::GetScheme( aCurObj.GetProtocol() ) ); - if ( aText.CompareTo( aScheme, aText.Len() ) == COMPARE_EQUAL && aText.Len() < aScheme.Len() ) + if ( aText.CompareIgnoreCaseToAscii( aScheme, aText.Len() ) == COMPARE_EQUAL && aText.Len() < aScheme.Len() ) { if( bFull ) aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -727,7 +725,7 @@ void SvtMatchContext_Impl::run() aCurString.Erase( 0, aScheme.Len() ); } - if( aText.CompareTo( aCurString, aText.Len() )== COMPARE_EQUAL ) + if( aText.CompareIgnoreCaseToAscii( aCurString, aText.Len() )== COMPARE_EQUAL ) { if( bFull ) aMatch = aCurObj.GetMainURL( INetURLObject::NO_DECODE ); @@ -858,6 +856,7 @@ SvtURLBox::SvtURLBox( Window* pParent, const ResId& _rResId, INetProtocol eSmart void SvtURLBox::ImplInit() { pImp = new SvtURLBox_Impl(); + SetHelpId( ".uno:OpenURL" ); EnableAutocomplete( FALSE ); @@ -1314,7 +1313,7 @@ sal_Bool SvtURLBox_Impl::TildeParsing( return sal_False; // no such user #else pPasswd = getpwnam( OUStringToOString( OUString( aUserName ), RTL_TEXTENCODING_ASCII_US ).getStr() ); - if( pPasswd ) + if( pPasswd ) aParseTilde = String::CreateFromAscii( pPasswd->pw_dir ); else return sal_False; // no such user diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index 6be53158ddc8..25b1c57f9a0b 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -89,7 +89,8 @@ namespace com { namespace sun { namespace star { namespace i18n { struct Forbidd GLOBAL_DOCUMENT_SAVE_LINKS, LABEL_DOCUMENT, PURGE_OLE, - KERN_ASIAN_PUNCTUATION + KERN_ASIAN_PUNCTUATION, + MATH_BASELINE_ALIGNMENT }; public: @@ -209,4 +210,4 @@ protected: virtual ~IDocumentSettingAccess() {}; }; - #endif // IDOCUMENTSETTINGACCESS_HXX_INCLUDED +#endif // IDOCUMENTSETTINGACCESS_HXX_INCLUDED diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index e0667dc17c99..ac4222ab1ce9 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -908,6 +908,9 @@ Achtung: Ab sofort sind in diesem File keine C++-Kommentare (//) mehr #define FN_UNO_META (FN_EXTRA2 + 112) #define FN_UNO_NESTED_TEXT_CONTENT (FN_EXTRA2 + 113) +// #i972: bool items to be passed to SwFrmPage for evaluation +#define FN_OLE_IS_MATH (FN_EXTRA2 + 114) +#define FN_MATH_BASELINE_ALIGNMENT (FN_EXTRA2 + 115) /*-------------------------------------------------------------------- Bereich: Hilfe --------------------------------------------------------------------*/ diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 874004826379..736fbb70a3b5 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -588,6 +588,7 @@ private: bool mbUseFormerTextWrapping : 1; // FME 2005-05-11 #108724# bool mbConsiderWrapOnObjPos : 1; // OD 2004-05-05 #i28701# // TRUE: object positioning algorithm has consider the wrapping style of // the floating screen objects as given by its attribute 'WrapInfluenceOnObjPos' + bool mbMathBaselineAlignment : 1; // TL 2010-10-29 #i972# // non-ui-compatibility flags: bool mbOldNumbering : 1; // HBRINKM #111955# diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 216f902e4b6c..873b28225204 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -29,6 +29,7 @@ #include <com/sun/star/text/RelOrientation.hpp> #include <com/sun/star/embed/XClassifiedObject.hpp> +#include <com/sun/star/embed/XEmbeddedObject.hpp> #include <svx/svdobj.hxx> #include "swdllapi.h" @@ -435,6 +436,9 @@ public: void SetFlyName( const String& rName ); const String& GetFlyName() const; + // get reference to OLE object (if there is one) for selected FlyFrame + const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef() const; + // erezeuge eindeutige Namen fuer Rahmen String GetUniqueGrfName() const; String GetUniqueOLEName() const; @@ -550,6 +554,15 @@ public: BOOL ReplaceSdrObj( const String& rGrfName, const String& rFltName, const Graphic* pGrf = 0 ); + // --> #i972# + // for starmath formulas anchored 'as char' it alignes it baseline to baseline + // changing the previous vertical orientation + void AlignFormulaToBaseline( const ::com::sun::star::uno::Reference < ::com::sun::star::embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly = 0 ); + + // aligns all formulas with anchor 'as char' to baseline + void AlignAllFormulasToBaseline(); + // <-- + //------------------------------------------ //Auskunft ueber naechstliegenden Inhalt zum uebergebenen Point diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx index 388607d4f0e0..4829775cf0fb 100644 --- a/sw/inc/frmfmt.hxx +++ b/sw/inc/frmfmt.hxx @@ -32,6 +32,7 @@ // <-- #include <cppuhelper/weakref.hxx> +#include <tools/gen.hxx> #include <format.hxx> @@ -153,6 +154,12 @@ class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt { friend class SwDoc; + // #i972: + // it stores the previous position of Prt rectangle from RequestObjectResize + // so it can be used to move frames of non-resizable objects to align them correctly + // when they get borders (this is done in SwWrtShell::CalcAndGetScale) + Point m_aLastFlyFrmPrtRectPos; + //Beide nicht vorhanden. SwFlyFrmFmt( const SwFlyFrmFmt &rCpy ); SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy ); @@ -219,6 +226,9 @@ public: */ sal_Bool IsBackgroundBrushInherited() const; + const Point & GetLastFlyFrmPrtRectPos() const { return m_aLastFlyFrmPrtRectPos; } + void SetLastFlyFrmPrtRectPos( const Point &rPoint ) { m_aLastFlyFrmPrtRectPos = rPoint; } + DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt) }; diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx index 631dd88f78c5..e439109ff866 100644 --- a/sw/inc/ndole.hxx +++ b/sw/inc/ndole.hxx @@ -67,7 +67,7 @@ public: String GetDescription(); #ifndef _FESHVIEW_ONLY_INLINE_NEEDED - com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef(); + const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef(); svt::EmbeddedObjectRef& GetObject(); const String& GetCurrentPersistName() const { return aName; } BOOL IsOleRef() const; //Damit das Objekt nicht unnoetig geladen werden muss. @@ -168,4 +168,3 @@ inline const SwOLENode *SwNode::GetOLENode() const } #endif // _NDOLE_HXX - diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index d2b4c1f5c1a1..351d3bdf76f4 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -494,5 +494,5 @@ public: virtual CreateTabPage GetTabPageCreatorFunc( USHORT nId ) = 0; virtual GetTabPageRanges GetTabPageRangesFunc( USHORT nId ) = 0; }; -#endif +#endif diff --git a/sw/inc/swcli.hxx b/sw/inc/swcli.hxx index 518d7885422c..113a63cc6d7c 100644 --- a/sw/inc/swcli.hxx +++ b/sw/inc/swcli.hxx @@ -53,6 +53,8 @@ public: void SetInDoVerb( BOOL bFlag ) { bInDoVerb = bFlag; } BOOL IsCheckForOLEInCaption() const { return bOldCheckForOLEInCaption; } + + virtual void FormatChanged(); }; #endif diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 68b390ae42b1..9b835a1a4b05 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -206,6 +206,7 @@ bool SwDoc::get(/*[in]*/ DocumentSettingId id) const case PURGE_OLE: return mbPurgeOLE; case KERN_ASIAN_PUNCTUATION: return mbKernAsianPunctuation; case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: return mbDoNotResetParaAttrsForNumFont; + case MATH_BASELINE_ALIGNMENT: return mbMathBaselineAlignment; default: ASSERT(false, "Invalid setting id"); } @@ -304,7 +305,7 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case UNIX_FORCE_ZERO_EXT_LEADING: mbUnixForceZeroExtLeading = value; break; - case PROTECT_FORM: + case PROTECT_FORM: mbProtectForm = value; break; @@ -345,6 +346,9 @@ void SwDoc::set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) case DO_NOT_RESET_PARA_ATTRS_FOR_NUM_FONT: mbDoNotResetParaAttrsForNumFont = value; break; + case MATH_BASELINE_ALIGNMENT: + mbMathBaselineAlignment = value; + break; default: ASSERT(false, "Invalid setting id"); } diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index ebd93bbfd692..484b5119d9e5 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -366,6 +366,7 @@ SwDoc::SwDoc() : mbUseFormerObjectPos = aOptions.IsUseObjectPositioning(); mbUseFormerTextWrapping = aOptions.IsUseOurTextWrapping(); mbConsiderWrapOnObjPos = aOptions.IsConsiderWrappingStyle(); + mbMathBaselineAlignment = false; // default for *old* documents is 'off' mbAddFlyOffsets = false; // hidden mbOldNumbering = false; // hidden mbUseHiResolutionVirtualDevice = true; // hidden diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index f7242d1d8132..441b474c6b27 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -32,6 +32,7 @@ #include <editeng/protitem.hxx> #include <svx/svdpagv.hxx> #include <svx/fmmodel.hxx> +#include <sot/exchange.hxx> #include "swtypes.hxx" #include "pagefrm.hxx" @@ -991,6 +992,14 @@ void SwDrawView::CheckPossibilities() bSzProtect |= ( embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ) ) ? TRUE : FALSE; // <-- + + // #i972: protect position if it is a Math object anchored 'as char' and baseline alignment is activated + SwDoc* pDoc = Imp().GetShell()->GetDoc(); + const bool bProtectMathPos = SotExchange::IsMath( xObj->getClassID() ) + && FLY_AS_CHAR == pFly->GetFmt()->GetAnchor().GetAnchorId() + && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + if (bProtectMathPos) + bMoveProtect = true; } } } @@ -1112,4 +1121,3 @@ const SdrMarkList& SwDrawView::GetMarkedObjectList() const - diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 0dc721a62f12..e4d4f2e9b399 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <hintids.hxx> #include <svl/itemiter.hxx> #include <svtools/imapobj.hxx> @@ -69,10 +70,15 @@ #include <fldbas.hxx> #include <fmtfld.hxx> #include <swundo.hxx> +#include <frame.hxx> +#include <notxtfrm.hxx> // --> OD 2006-03-06 #125892# #include <HandleAnchorNodeChg.hxx> // <-- #include <frmatr.hxx> +// --> 3.7.2010 #i972# +#include <ndole.hxx> +// <-- // --> OD 2009-12-29 #i89920# #include <fmtsrnd.hxx> #include <editeng/opaqitem.hxx> @@ -1522,6 +1528,12 @@ Size SwFEShell::RequestObjectResize( const SwRect &rRect, const uno::Reference < pFly->ChgRelPos( aTmp ); } } + + SwFlyFrmFmt *pFlyFrmFmt = pFly->GetFmt(); + ASSERT( pFlyFrmFmt, "fly frame format missing!" ); + if ( pFlyFrmFmt ) + pFlyFrmFmt->SetLastFlyFrmPrtRectPos( pFly->Prt().Pos() ); //stores the value of last Prt rect + EndAllAction(); return aResult; @@ -1587,6 +1599,20 @@ const String& SwFEShell::GetFlyName() const } +const uno::Reference < embed::XEmbeddedObject > SwFEShell::GetOleRef() const +{ + uno::Reference < embed::XEmbeddedObject > xObj; + SwFlyFrm * pFly = FindFlyFrm(); + if (pFly && pFly->Lower() && pFly->Lower()->IsNoTxtFrm()) + { + SwOLENode *pNd = ((SwNoTxtFrm*)pFly->Lower())->GetNode()->GetOLENode(); + if (pNd) + xObj = pNd->GetOLEObj().GetOleRef(); + } + return xObj; +} + + String SwFEShell::GetUniqueGrfName() const { return GetDoc()->GetUniqueGrfName(); @@ -2153,4 +2179,93 @@ void SwFEShell::SetObjDescription( const String& rDescription ) } } } -// <-- + + +void SwFEShell::AlignFormulaToBaseline( const uno::Reference < embed::XEmbeddedObject >& xObj, SwFlyFrm * pFly ) +{ +#if OSL_DEBUG_LEVEL > 1 + SvGlobalName aCLSID( xObj->getClassID() ); + const bool bStarMath = ( SotExchange::IsMath( aCLSID ) != 0 ); + ASSERT( bStarMath, "AlignFormulaToBaseline should only be called for Math objects" ); + + if ( !bStarMath ) + return; +#endif + + if (!pFly) + pFly = FindFlyFrm( xObj ); + ASSERT( pFly , "No fly frame!" ); + SwFrmFmt * pFrmFmt = pFly ? pFly->GetFmt() : 0; + + // baseline to baseline alignment should only be applied to formulas anchored as char + if ( pFly && pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() ) + { + // get baseline from Math object + uno::Any aBaseline; + if( svt::EmbeddedObjectRef::TryRunningState( xObj ) ) + { + uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY ); + if ( xSet.is() ) + { + try + { + aBaseline = xSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BaseLine") ) ); + } + catch ( uno::Exception& ) + { + ASSERT( FALSE , "Baseline could not be retrieved from Starmath!" ); + } + } + } + + sal_Int32 nBaseline = ::comphelper::getINT32(aBaseline); + const MapMode aSourceMapMode( MAP_100TH_MM ); + const MapMode aTargetMapMode( MAP_TWIP ); + nBaseline = OutputDevice::LogicToLogic( nBaseline, aSourceMapMode.GetMapUnit(), aTargetMapMode.GetMapUnit() ); + + ASSERT( nBaseline > 0, "Wrong value of Baseline while retrieving from Starmath!" ); + //nBaseline must be moved by aPrt position + const SwFlyFrmFmt *pFlyFrmFmt = pFly->GetFmt(); + ASSERT( pFlyFrmFmt, "fly frame format missing!" ); + if ( pFlyFrmFmt ) + nBaseline += pFlyFrmFmt->GetLastFlyFrmPrtRectPos().Y(); + + const SwFmtVertOrient &rVert = pFrmFmt->GetVertOrient(); + SwFmtVertOrient aVert( rVert ); + aVert.SetPos( -nBaseline ); + aVert.SetVertOrient( com::sun::star::text::VertOrientation::NONE ); + + pFrmFmt->LockModify(); + pFrmFmt->SetFmtAttr( aVert ); + pFrmFmt->UnlockModify(); + pFly->InvalidatePos(); + } +} + + +void SwFEShell::AlignAllFormulasToBaseline() +{ + StartAllAction(); + + SwStartNode *pStNd; + SwNodeIndex aIdx( *GetNodes().GetEndOfAutotext().StartOfSectionNode(), 1 ); + while ( 0 != (pStNd = aIdx.GetNode().GetStartNode()) ) + { + ++aIdx; + SwOLENode *pOleNode = dynamic_cast< SwOLENode * >( &aIdx.GetNode() ); + if ( pOleNode ) + { + const uno::Reference < embed::XEmbeddedObject > & xObj( pOleNode->GetOLEObj().GetOleRef() ); + if (xObj.is()) + { + SvGlobalName aCLSID( xObj->getClassID() ); + if ( SotExchange::IsMath( aCLSID ) ) + AlignFormulaToBaseline( xObj ); + } + } + + aIdx.Assign( *pStNd->EndOfSectionNode(), + 1 ); + } + + EndAllAction(); +} diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index f334ddcaee2f..17628252b5e3 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -27,7 +27,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/embed/EmbedMisc.hpp> + #include "hintids.hxx" #include <svx/sdrobjectfilter.hxx> @@ -48,9 +50,9 @@ #include <svx/svdpage.hxx> #include <svx/svdpagv.hxx> -#ifndef _POOLFMT_HRC +#include <IDocumentSettingAccess.hxx> +#include <cmdid.h> #include <poolfmt.hrc> // fuer InitFldTypes -#endif #include <frmfmt.hxx> #include <frmatr.hxx> #include <fmtfsize.hxx> @@ -2573,26 +2575,32 @@ BYTE SwFEShell::IsSelObjProtected( USHORT eType ) const nChk |= ( pObj->IsMoveProtect() ? FLYPROTECT_POS : 0 ) | ( pObj->IsResizeProtect()? FLYPROTECT_SIZE : 0 ); - if( FLYPROTECT_CONTENT & eType && pObj->ISA(SwVirtFlyDrawObj) ) + if( pObj->ISA(SwVirtFlyDrawObj) ) { SwFlyFrm *pFly = ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm(); - if ( pFly->GetFmt()->GetProtect().IsCntntProtected() ) + if ( (FLYPROTECT_CONTENT & eType) && pFly->GetFmt()->GetProtect().IsCntntProtected() ) nChk |= FLYPROTECT_CONTENT; if ( pFly->Lower() && pFly->Lower()->IsNoTxtFrm() ) { SwOLENode *pNd = ((SwCntntFrm*)pFly->Lower())->GetNode()->GetOLENode(); - if ( pNd ) + uno::Reference < embed::XEmbeddedObject > xObj( pNd ? pNd->GetOLEObj().GetOleRef() : 0 ); + if ( xObj.is() ) { - uno::Reference < embed::XEmbeddedObject > xObj = pNd->GetOLEObj().GetOleRef(); - // TODO/LATER: use correct aspect - if ( xObj.is() && - embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ) ) + const bool bNeverResize = (embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT )); + if ( (FLYPROTECT_CONTENT & eType) && bNeverResize ) { nChk |= FLYPROTECT_SIZE; nChk |= FLYPROTECT_FIXED; } + + // set FLYPROTECT_POS if it is a Math object anchored 'as char' and baseline alignment is activated + const bool bProtectMathPos = SotExchange::IsMath( xObj->getClassID() ) + && FLY_AS_CHAR == pFly->GetFmt()->GetAnchor().GetAnchorId() + && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + if ((FLYPROTECT_POS & eType) && bProtectMathPos) + nChk |= FLYPROTECT_POS; } } } diff --git a/sw/source/core/inc/flyfrm.hxx b/sw/source/core/inc/flyfrm.hxx index 8e84ecf3c976..83cc6a4c93e9 100644 --- a/sw/source/core/inc/flyfrm.hxx +++ b/sw/source/core/inc/flyfrm.hxx @@ -28,9 +28,9 @@ #define SW_FLYFRM_HXX #include "layfrm.hxx" +#include "frmfmt.hxx" class SwPageFrm; -class SwFlyFrmFmt; class SwFmtFrmSize; struct SwCrsrMoveState; class SwBorderAttrs; @@ -284,5 +284,11 @@ public: @author OD */ virtual bool IsFormatPossible() const; + + // overwriting "SwFrmFmt *SwLayoutFrm::GetFmt" to provide the correct derived return type. + // (This is in order to skip on the otherwise necessary casting of the result to + // 'SwFlyFrmFmt *' after calls to this function. The casting is now done in this function.) + virtual const SwFlyFrmFmt *GetFmt() const; + virtual SwFlyFrmFmt *GetFmt(); }; #endif diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index d48bbf3f3e42..f1366dd0a11b 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -124,9 +124,9 @@ public: // <-- BOOL IsAnLower( const SwFrm * ) const; - const SwFrmFmt *GetFmt() const { return (const SwFrmFmt*)GetDep(); } - SwFrmFmt *GetFmt() { return (SwFrmFmt*)GetDep(); } - void SetFrmFmt( SwFrmFmt* ); + virtual const SwFrmFmt *GetFmt() const; + virtual SwFrmFmt *GetFmt(); + void SetFrmFmt( SwFrmFmt* ); //Verschieben der Ftns aller Lower - ab dem StartCntnt. //TRUE wenn mindestens eine Ftn verschoben wurde. diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index d69df532682f..d71db56cf10f 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -1273,6 +1273,7 @@ void SwFlyFrm::ChgRelPos( const Point &rNewPos ) aHori.SetPos( nTmpX ); aSet.Put( aHori ); } + SetCurrRelPos( rNewPos ); pFmt->GetDoc()->SetAttr( aSet, *pFmt ); } } @@ -2851,3 +2852,14 @@ bool SwFlyFrm::IsFormatPossible() const return SwAnchoredObject::IsFormatPossible() && !IsLocked() && !IsColLocked(); } + +const SwFlyFrmFmt * SwFlyFrm::GetFmt() const +{ + return static_cast< const SwFlyFrmFmt * >( GetDep() ); +} + +SwFlyFrmFmt * SwFlyFrm::GetFmt() +{ + return static_cast< SwFlyFrmFmt * >( GetDep() ); +} + diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx index 61fb9163c6f1..99f9ed7e30ba 100644 --- a/sw/source/core/layout/flyincnt.cxx +++ b/sw/source/core/layout/flyincnt.cxx @@ -358,3 +358,4 @@ void SwFlyInCntFrm::MakeAll() } Unlock(); } + diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 9b3ff15666f9..c0cef39294b8 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -414,6 +414,19 @@ SwFrm::~SwFrm() #endif } +/*************************************************************************/ + +const SwFrmFmt * SwLayoutFrm::GetFmt() const +{ + return static_cast< const SwFlyFrmFmt * >( GetDep() ); +} + +SwFrmFmt * SwLayoutFrm::GetFmt() +{ + return static_cast< SwFlyFrmFmt * >( GetDep() ); +} + + /************************************************************************* |* |* SwLayoutFrm::SetFrmFmt() diff --git a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx index c5a51970f066..7c8118dbe3e2 100644 --- a/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/ascharanchoredobjectposition.cxx @@ -455,3 +455,4 @@ sal_uInt8 SwAsCharAnchoredObjectPosition::GetLineAlignment() const { return mnLineAlignment; } + diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 881402efbfb2..1cd0fdd02830 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -781,7 +781,7 @@ BOOL SwOLEObj::IsOleRef() const return xOLERef.is(); } -uno::Reference < embed::XEmbeddedObject > SwOLEObj::GetOleRef() +const uno::Reference < embed::XEmbeddedObject > SwOLEObj::GetOleRef() { if( !xOLERef.is() ) { @@ -1016,3 +1016,4 @@ void SwOLELRUCache::RemoveObj( SwOLEObj& rObj ) if( !Count() ) DELETEZ( pOLELRU_Cache ); } + diff --git a/sw/source/ui/app/appopt.cxx b/sw/source/ui/app/appopt.cxx index c6e2527ba0c8..a1e6cef80cd1 100644 --- a/sw/source/ui/app/appopt.cxx +++ b/sw/source/ui/app/appopt.cxx @@ -27,19 +27,15 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <hintids.hxx> -#ifndef _CMDID_H -#include <cmdid.h> // Funktion-Ids -#endif - -#include <com/sun/star/i18n/ScriptType.hpp> #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> -#ifndef _MSGBOX_HXX //autogen +#include <com/sun/star/i18n/ScriptType.hpp> + +#include <hintids.hxx> +#include <cmdid.h> // Funktion-Ids #include <vcl/msgbox.hxx> -#endif #include <svl/eitem.hxx> #include <sfx2/request.hxx> #include <sfx2/app.hxx> @@ -47,9 +43,7 @@ #include <svx/htmlmode.hxx> #include <sfx2/bindings.hxx> #include <editeng/brshitem.hxx> -#ifndef _SVX_TSTPITEM_HXX //autogen #include <editeng/tstpitem.hxx> -#endif #include <svx/optgrid.hxx> #include <svx/svxdlg.hxx> #include <svx/dialogs.hrc> @@ -59,37 +53,25 @@ #include <optcomp.hxx> #include <edtwin.hxx> #include <swmodule.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif +#include <doc.hxx> #include <wrtsh.hxx> -#ifndef IDOCUMENTDEVICEACCESS_HXX_INCLUDED #include <IDocumentDeviceAccess.hxx> -#endif #include <uitool.hxx> #include <initui.hxx> // fuer ::GetGlossaries() #include <fldbas.hxx> //fuer UpdateFields -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif #include <cfgitems.hxx> #include <prtopt.hxx> -#ifndef _PVIEW_HXX #include <pview.hxx> -#endif #include <usrpref.hxx> -#ifndef _MODCFG_HXX #include <modcfg.hxx> -#endif #include <glosdoc.hxx> #include <uiitems.hxx> #include <editeng/langitem.hxx> #include <unotools/lingucfg.hxx> #include <editeng/unolingu.hxx> - -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif #include <globals.h> // globale Konstanten z.B. #include <svl/slstitm.hxx> #include "swabstdlg.hxx" @@ -334,8 +316,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) /*--------------------------------------------------------------------- Seite Dokumentansicht auswerten -----------------------------------------------------------------------*/ - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_DOCDISP, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_DOCDISP, FALSE, &pItem )) { const SwDocDisplayItem* pDocDispItem = (const SwDocDisplayItem*)pItem; @@ -364,23 +345,20 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) Elemente - Item auswerten -----------------------------------------------------------------------*/ - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_ELEM, FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ELEM, FALSE, &pItem ) ) { const SwElemItem* pElemItem = (const SwElemItem*)pItem; pElemItem->FillViewOptions( aViewOpt ); } - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_METRIC, FALSE, &pItem ) ) { SFX_APP()->SetOptions(rSet); const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem; ::SetDfltMetric((FieldUnit)pMetricItem->GetValue(), !bTextDialog); } - if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(FN_HSCROLL_METRIC, FALSE, &pItem ) ) { const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem; FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue(); @@ -389,8 +367,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) pAppView->ChangeTabMetric(eUnit); } - if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(FN_VSCROLL_METRIC, FALSE, &pItem ) ) { const SfxUInt16Item* pMetricItem = (const SfxUInt16Item*)pItem; FieldUnit eUnit = (FieldUnit)pMetricItem->GetValue(); @@ -399,8 +376,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) pAppView->ChangeVLinealMetric(eUnit); } - if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, - FALSE, &pItem ) ) + if( SFX_ITEM_SET == rSet.GetItemState(SID_ATTR_DEFTABSTOP, FALSE, &pItem ) ) { USHORT nTabDist = ((const SfxUInt16Item*)pItem)->GetValue(); pPref->SetDefTab(nTabDist); @@ -427,8 +403,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) Seite Rastereinstellungen auswerten ----------------------------------------------------------------------*/ - if( SFX_ITEM_SET == rSet.GetItemState( - SID_ATTR_GRID_OPTIONS, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRID_OPTIONS, FALSE, &pItem )) { const SvxGridItem* pGridItem = (const SvxGridItem*)pItem; @@ -458,8 +433,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) // Writer Drucker Zusatzeinstellungen auswerten //---------------------------------------------------------------------------- - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_ADDPRINTER, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_ADDPRINTER, FALSE, &pItem )) { SwPrintOptions* pOpt = GetPrtOptions(!bTextDialog); if (pOpt) @@ -473,16 +447,25 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) } - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) { ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt ); if(pBindings) pBindings->Invalidate(FN_SHADOWCURSOR); } - if( SFX_ITEM_SET == rSet.GetItemState( - FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) + if( pAppView ) + { + SwWrtShell &rWrtSh = pAppView->GetWrtShell(); + const bool bAlignFormulas = rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + pPref->SetAlignMathObjectsToBaseline( bAlignFormulas ); + + // don't align formulas in documents that are currently loading + if (bAlignFormulas && !rWrtSh.GetDoc()->IsInReading()) + rWrtSh.AlignAllFormulasToBaseline(); + } + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) { aViewOpt.SetCursorInProtectedArea(((const SfxBoolItem*)pItem)->GetValue()); } @@ -510,8 +493,7 @@ void SwModule::ApplyItemSet( USHORT nId, const SfxItemSet& rSet ) } #endif // dann an der akt. View und Shell die entsp. Elemente setzen - ApplyUsrPref( aViewOpt, pAppView, - bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); + ApplyUsrPref( aViewOpt, pAppView, bTextDialog? VIEWOPT_DEST_TEXT : VIEWOPT_DEST_WEB); } /* -----------------12.02.99 12:28------------------- * @@ -609,6 +591,15 @@ SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemS if ( fnCreatePage ) pRet = (*fnCreatePage)( pParent, rSet ); } + if (pRet && (nId == RID_SW_TP_OPTSHDWCRSR || nId == RID_SW_TP_HTML_OPTSHDWCRSR)) + { + SwView* pCurrView = GetView(); + if(pCurrView) + { + aSet.Put( SwWrtShellItem( SID_WRT_SHELL, pCurrView->GetWrtShellPtr() ) ); + pRet->PageCreated(aSet); + } + } } break; #ifdef DBG_UTIL @@ -653,5 +644,3 @@ SfxTabPage* SwModule::CreateTabPage( USHORT nId, Window* pParent, const SfxItemS return pRet; } - - diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index c201109ca1cb..98fe7316ecd5 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -336,6 +336,12 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) pColl->SetFmtAttr( aFontHeight ); } } + + // the default for documents created via 'File/New' should be 'on' + // (old documents, where this property was not yet implemented, will get the + // value 'false' in the SwDoc c-tor) + pDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, + SW_MOD()->GetUsrPref( bWeb )->IsAlignMathObjectsToBaseline() ); } /* #106748# If the default frame direction of a document is RTL @@ -823,4 +829,3 @@ void SwDocShell::SubInitNew() IDocumentDeviceAccess* SwDocShell::getIDocumentDeviceAccess() { return pDoc; } const IDocumentSettingAccess* SwDocShell::getIDocumentSettingAccess() const { return pDoc; } IDocumentChartDataProviderAccess* SwDocShell::getIDocumentChartDataProviderAccess() { return pDoc; } - diff --git a/sw/source/ui/config/cfgitems.cxx b/sw/source/ui/config/cfgitems.cxx index 3a462ce452b2..8652970d588f 100644 --- a/sw/source/ui/config/cfgitems.cxx +++ b/sw/source/ui/config/cfgitems.cxx @@ -458,4 +458,3 @@ int SwTestItem::operator==( const SfxPoolItem& rAttr ) const #endif - diff --git a/sw/source/ui/config/makefile.mk b/sw/source/ui/config/makefile.mk index 4b8ed01ca90e..c093b18ce036 100644 --- a/sw/source/ui/config/makefile.mk +++ b/sw/source/ui/config/makefile.mk @@ -83,5 +83,4 @@ LIB1OBJFILES = \ # --- Targets ------------------------------------------------------- -.INCLUDE : target.mk - +.INCLUDE : target.mk
\ No newline at end of file diff --git a/sw/source/ui/config/optdlg.hrc b/sw/source/ui/config/optdlg.hrc index 4162b656d7e5..5d93219fed98 100644 --- a/sw/source/ui/config/optdlg.hrc +++ b/sw/source/ui/config/optdlg.hrc @@ -30,7 +30,7 @@ #define FL_NOPRINT 2 #define FL_WINDOW 3 -#define CB_GRF 1 +#define CB_GRF 1 #define CB_TBL 2 #define CB_DRWFAST 3 #define CB_FIELD 4 @@ -39,10 +39,10 @@ #define CB_SPACE 7 #define CB_HSPACE 8 #define CB_SHYPH 9 -#define CB_FLD_HIDDEN 10 +#define CB_FLD_HIDDEN 10 #define CB_BREAK 11 #define CB_ANY_RULER 12 -#define CB_CROSS 14 +#define CB_CROSS 14 #define CB_HSCROLL 15 #define CB_VSCROLL 16 #define CB_HRULER 17 @@ -50,7 +50,7 @@ #define FL_LINE 22 #define CB_POSTIT 23 #define CB_VRULER_RIGHT 24 -#define CB_BIGHANDLE 25 +#define CB_BIGHANDLE 25 #define FL_SETTINGS 26 #define LB_METRIC 27 @@ -191,7 +191,7 @@ #define FL_TABLE_SEPARATOR 139 #define CB_PROSPECT_RTL 140 -#define FL_SHDWCRSFLAG 1 +#define FL_SHDWCRSFLAG 1 #define CB_SHDWCRSONOFF 2 #define FL_SHDWCRSMODE 3 #define FT_SHDWCRSFILLMODE 4 @@ -201,5 +201,8 @@ #define RB_SHDWCRSFILLSPACE 8 #define CB_ALLOW_IN_PROT 12 #define FL_CRSR_OPT 13 -#define FL_SEPARATOR_SHDW 14 +#define FL_SEPARATOR_SHDW 14 +#define FL_LAYOUT_OPTIONS 15 +#define CB_MATH_BASELINE_ALIGNMENT 16 + diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src index b54cd0d16b4e..0f0eddc5d9ed 100644 --- a/sw/source/ui/config/optdlg.src +++ b/sw/source/ui/config/optdlg.src @@ -1021,6 +1021,18 @@ TabPage TP_OPTSHDWCRSR Group = TRUE ; Text [ en-US ] = "Enable"; }; + FixedLine FL_LAYOUT_OPTIONS + { + Pos = MAP_APPFONT ( 6 , 133 ) ; + Size = MAP_APPFONT ( 118 , 8 ) ; + Text [ en-US ] = "Layout assistance"; + }; + CheckBox CB_MATH_BASELINE_ALIGNMENT + { + Pos = MAP_APPFONT ( 12 , 144 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "Math baseline alignment"; + }; }; diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 81448870d925..6e6ed773a33d 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -32,22 +32,15 @@ #undef SW_DLLIMPLEMENTATION #endif -#include <hintids.hxx> -#include <cmdid.h> -#include <vcl/svapp.hxx> +#ifndef _SVSTDARR_HXX #define _SVSTDARR_STRINGSDTOR #include <svl/svstdarr.hxx> -#include <svl/cjkoptions.hxx> -#include <svtools/ctrltool.hxx> -#include <svl/eitem.hxx> -#include <svx/htmlmode.hxx> -#include <sfx2/printer.hxx> -#include <sfx2/bindings.hxx> -#include <svx/xtable.hxx> -#include <editeng/fhgtitem.hxx> -#include <editeng/fontitem.hxx> -#include <editeng/langitem.hxx> -#include <svx/dlgutil.hxx> +#endif + +#include <optpage.hxx> +#include <doc.hxx> +#include <hintids.hxx> +#include <cmdid.h> #include <fmtcol.hxx> #include <charatr.hxx> #include <swtypes.hxx> @@ -57,11 +50,10 @@ #include <swmodule.hxx> #include <wrtsh.hxx> #include <uitool.hxx> -#include <cfgitems.hxx> //Items fuer Sw-Seiten +#include <cfgitems.hxx> #include <poolfmt.hxx> #include <uiitems.hxx> #include <initui.hxx> -#include <optpage.hxx> #include <printdata.hxx> #include <modcfg.hxx> #include <srcview.hxx> @@ -71,13 +63,26 @@ #include <config.hrc> #include <redlopt.hrc> #include <optdlg.hrc> -#include <svx/strarray.hxx> -#include <svl/slstitm.hxx> -#include <sfx2/request.hxx> #include <swwrtshitem.hxx> +#include <unomid.h> + +#include <editeng/fhgtitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/langitem.hxx> +#include <sfx2/request.hxx> +#include <sfx2/printer.hxx> +#include <sfx2/bindings.hxx> +#include <svl/slstitm.hxx> #include <svl/ctloptions.hxx> +#include <svl/eitem.hxx> +#include <svl/cjkoptions.hxx> +#include <svtools/ctrltool.hxx> +#include <svx/htmlmode.hxx> +#include <svx/xtable.hxx> +#include <svx/dlgutil.hxx> +#include <svx/strarray.hxx> +#include <vcl/svapp.hxx> -#include <unomid.h> using namespace ::com::sun::star; @@ -1488,6 +1493,7 @@ IMPL_LINK(SwTableOptionsTabPage, CheckBoxHdl, CheckBox*, EMPTYARG) aRepeatHeaderCB.Enable(aHeaderCB.IsChecked()); return 0; } + void SwTableOptionsTabPage::PageCreated (SfxAllItemSet aSet) { SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False); @@ -1525,15 +1531,17 @@ SwShdwCrsrOptionsTabPage::SwShdwCrsrOptionsTabPage( Window* pParent, aFillTabRB( this, SW_RES( RB_SHDWCRSFILLTAB )), aFillSpaceRB( this, SW_RES( RB_SHDWCRSFILLSPACE )), aCrsrOptFL ( this, SW_RES( FL_CRSR_OPT)), - aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )) + aCrsrInProtCB( this, SW_RES( CB_ALLOW_IN_PROT )), + m_aLayoutOptionsFL( this, SW_RES( FL_LAYOUT_OPTIONS ) ), + m_aMathBaselineAlignmentCB( this, SW_RES( CB_MATH_BASELINE_ALIGNMENT ) ), + m_pWrtShell( NULL ) { FreeResource(); const SfxPoolItem* pItem = 0; - SwShadowCursorItem aOpt; + SwShadowCursorItem aOpt; if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) aOpt = *(SwShadowCursorItem*)pItem; - aOnOffCB.Check( aOpt.IsOn() ); BYTE eMode = aOpt.GetMode(); @@ -1578,6 +1586,15 @@ SfxTabPage* SwShdwCrsrOptionsTabPage::Create( Window* pParent, const SfxItemSet& return new SwShdwCrsrOptionsTabPage( pParent, rSet ); } + +void SwShdwCrsrOptionsTabPage::PageCreated( SfxAllItemSet aSet ) +{ + SFX_ITEMSET_ARG (&aSet,pWrtSh,SwWrtShellItem,SID_WRT_SHELL,sal_False); + if (pWrtSh) + SetWrtShell(pWrtSh->GetValue()); +} + + BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) { SwShadowCursorItem aOpt; @@ -1603,6 +1620,10 @@ BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) bRet = TRUE; } + m_pWrtShell->GetDoc()->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, + m_aMathBaselineAlignmentCB.IsChecked() ); + bRet |= m_aMathBaselineAlignmentCB.IsChecked() != m_aMathBaselineAlignmentCB.GetSavedValue(); + if( aCrsrInProtCB.IsChecked() != aCrsrInProtCB.GetSavedValue()) { rSet.Put(SfxBoolItem(FN_PARAM_CRSR_IN_PROTECTED, aCrsrInProtCB.IsChecked())); @@ -1636,11 +1657,10 @@ BOOL SwShdwCrsrOptionsTabPage::FillItemSet( SfxItemSet& rSet ) void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) { const SfxPoolItem* pItem = 0; - SwShadowCursorItem aOpt; + SwShadowCursorItem aOpt; if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, FALSE, &pItem )) aOpt = *(SwShadowCursorItem*)pItem; - aOnOffCB.Check( aOpt.IsOn() ); BYTE eMode = aOpt.GetMode(); @@ -1649,6 +1669,9 @@ void SwShdwCrsrOptionsTabPage::Reset( const SfxItemSet& rSet ) aFillTabRB.Check( FILL_TAB == eMode ); aFillSpaceRB.Check( FILL_SPACE == eMode ); + m_aMathBaselineAlignmentCB.Check( m_pWrtShell->GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ); + m_aMathBaselineAlignmentCB.SaveValue(); + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_CRSR_IN_PROTECTED, FALSE, &pItem )) aCrsrInProtCB.Check(((const SfxBoolItem*)pItem)->GetValue()); aCrsrInProtCB.SaveValue(); @@ -2593,4 +2616,3 @@ IMPL_LINK_INLINE_END( SwTestTabPage, AutoClickHdl, CheckBox *, EMPTYARG ) #endif - diff --git a/sw/source/ui/config/usrpref.cxx b/sw/source/ui/config/usrpref.cxx index 85d3886fc79f..8d79abfb6244 100644 --- a/sw/source/ui/config/usrpref.cxx +++ b/sw/source/ui/config/usrpref.cxx @@ -245,27 +245,29 @@ Sequence<OUString> SwLayoutViewConfig::GetPropertyNames() { static const char* aPropNames[] = { - "Line/Guide", // 0 - "Line/SimpleControlPoint", // 1 - "Line/LargeControlPoint", // 2 - "Window/HorizontalScroll", // 3 - "Window/VerticalScroll", // 4 - "Window/ShowRulers", // 5 - "Window/HorizontalRuler", // 6 - "Window/VerticalRuler", // 7 - "Window/HorizontalRulerUnit", // 8 - "Window/VerticalRulerUnit", // 9 - "Window/SmoothScroll", //10 - "Zoom/Value", //11 - "Zoom/Type", //12 - "Other/MeasureUnit", //13 - "Other/TabStop", //14 - "Window/IsVerticalRulerRight", //15 - "ViewLayout/Columns", //16 - "ViewLayout/BookMode", //17 - "Other/IsSquaredPageMode" //18 + "Line/Guide", // 0 + "Line/SimpleControlPoint", // 1 + "Line/LargeControlPoint", // 2 + "Window/HorizontalScroll", // 3 + "Window/VerticalScroll", // 4 + "Window/ShowRulers", // 5 + "Window/HorizontalRuler", // 6 + "Window/VerticalRuler", // 7 + "Window/HorizontalRulerUnit", // 8 + "Window/VerticalRulerUnit", // 9 + "Window/SmoothScroll", //10 + "Zoom/Value", //11 + "Zoom/Type", //12 + "Other/IsAlignMathObjectsToBaseline", //13 + "Other/MeasureUnit", //14 + // below properties are not available in WriterWeb + "Other/TabStop", //15 + "Window/IsVerticalRulerRight", //16 + "ViewLayout/Columns", //17 + "ViewLayout/BookMode", //18 + "Other/IsSquaredPageMode" //19 }; - const int nCount = bWeb ? 14 : 19; + const int nCount = bWeb ? 15 : 20; Sequence<OUString> aNames(nCount); OUString* pNames = aNames.getArray(); for(int i = 0; i < nCount; i++) @@ -302,39 +304,38 @@ void SwLayoutViewConfig::Commit() for(int nProp = 0; nProp < aNames.getLength(); nProp++) { - sal_Bool bSet; + Any &rVal = pValues[nProp]; switch(nProp) { - case 0: bSet = rParent.IsCrossHair(); break;// "Line/Guide", - case 1: bSet = rParent.IsSolidMarkHdl(); break;// "Line/SimpleControlPoint", - case 2: bSet = rParent.IsBigMarkHdl(); break;// "Line/LargeControlPoint", - case 3: bSet = rParent.IsViewHScrollBar(); break;// "Window/HorizontalScroll", - case 4: bSet = rParent.IsViewVScrollBar(); break;// "Window/VerticalScroll", - case 5: bSet = rParent.IsViewAnyRuler(); break; // "Window/ShowRulers" + case 0: rVal <<= (sal_Bool) rParent.IsCrossHair(); break; // "Line/Guide", + case 1: rVal <<= (sal_Bool) rParent.IsSolidMarkHdl(); break; // "Line/SimpleControlPoint", + case 2: rVal <<= (sal_Bool) rParent.IsBigMarkHdl(); break; // "Line/LargeControlPoint", + case 3: rVal <<= (sal_Bool) rParent.IsViewHScrollBar(); break; // "Window/HorizontalScroll", + case 4: rVal <<= (sal_Bool) rParent.IsViewVScrollBar(); break; // "Window/VerticalScroll", + case 5: rVal <<= (sal_Bool) rParent.IsViewAnyRuler(); break; // "Window/ShowRulers" // #i14593# use IsView*Ruler(TRUE) instead of IsView*Ruler() // this preserves the single ruler states even if "Window/ShowRulers" is off - case 6: bSet = rParent.IsViewHRuler(TRUE); break;// "Window/HorizontalRuler", - case 7: bSet = rParent.IsViewVRuler(TRUE); break;// "Window/VerticalRuler", + case 6: rVal <<= (sal_Bool) rParent.IsViewHRuler(TRUE); break; // "Window/HorizontalRuler", + case 7: rVal <<= (sal_Bool) rParent.IsViewVRuler(TRUE); break; // "Window/VerticalRuler", case 8: if(rParent.bIsHScrollMetricSet) - pValues[nProp] <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit" + rVal <<= (sal_Int32)rParent.eHScrollMetric; // "Window/HorizontalRulerUnit" break; case 9: if(rParent.bIsVScrollMetricSet) - pValues[nProp] <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit" + rVal <<= (sal_Int32)rParent.eVScrollMetric; // "Window/VerticalRulerUnit" break; - case 10: bSet = rParent.IsSmoothScroll(); break;// "Window/SmoothScroll", - case 11: pValues[nProp] <<= (sal_Int32)rParent.GetZoom(); break;// "Zoom/Value", - case 12: pValues[nProp] <<= (sal_Int32)rParent.GetZoomType(); break;// "Zoom/Type", - case 13: pValues[nProp] <<= (sal_Int32)rParent.GetMetric(); break;// "Other/MeasureUnit", - case 14: pValues[nProp] <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop", - case 15: bSet = rParent.IsVRulerRight(); break;// "Window/IsVerticalRulerRight", - case 16: pValues[nProp] <<= (sal_Int32)rParent.GetViewLayoutColumns(); break;// "ViewLayout/Columns", - case 17: bSet = rParent.IsViewLayoutBookMode(); break;// "ViewLayout/BookMode", - case 18: bSet = rParent.IsSquaredPageMode(); break;// "Other/IsSquaredPageMode", + case 10: rVal <<= (sal_Bool) rParent.IsSmoothScroll(); break; // "Window/SmoothScroll", + case 11: rVal <<= (sal_Int32)rParent.GetZoom(); break; // "Zoom/Value", + case 12: rVal <<= (sal_Int32)rParent.GetZoomType(); break; // "Zoom/Type", + case 13: rVal <<= (sal_Bool) rParent.IsAlignMathObjectsToBaseline(); break; // "Other/IsAlignMathObjectsToBaseline" + case 14: rVal <<= (sal_Int32)rParent.GetMetric(); break; // "Other/MeasureUnit", + case 15: rVal <<= static_cast<sal_Int32>(TWIP_TO_MM100(rParent.GetDefTab())); break;// "Other/TabStop", + case 16: rVal <<= (sal_Bool) rParent.IsVRulerRight(); break; // "Window/IsVerticalRulerRight", + case 17: rVal <<= (sal_Int32)rParent.GetViewLayoutColumns(); break; // "ViewLayout/Columns", + case 18: rVal <<= (sal_Bool) rParent.IsViewLayoutBookMode(); break; // "ViewLayout/BookMode", + case 19: rVal <<= (sal_Bool) rParent.IsSquaredPageMode(); break; // "Other/IsSquaredPageMode", } - if(nProp < 8 || nProp == 10 || nProp == 15 || nProp == 17 || nProp == 18 ) - pValues[nProp].setValue(&bSet, ::getBooleanCppuType()); } PutProperties(aNames, aValues); } @@ -353,7 +354,11 @@ void SwLayoutViewConfig::Load() { if(pValues[nProp].hasValue()) { - sal_Bool bSet = nProp < 8 || nProp == 10 || nProp == 17 || nProp == 18 ? *(sal_Bool*)pValues[nProp].getValue() : sal_False; + sal_Int32 nInt32Val = 0; + sal_Bool bSet = sal_False; + pValues[nProp] >>= nInt32Val; + pValues[nProp] >>= bSet; + switch(nProp) { case 0: rParent.SetCrossHair(bSet); break;// "Line/Guide", @@ -367,58 +372,25 @@ void SwLayoutViewConfig::Load() case 8: { rParent.bIsHScrollMetricSet = sal_True; - sal_Int32 nUnit = 0; - pValues[nProp] >>= nUnit; - rParent.eHScrollMetric = ((FieldUnit)nUnit); // "Window/HorizontalRulerUnit" + rParent.eHScrollMetric = ((FieldUnit)nInt32Val); // "Window/HorizontalRulerUnit" } break; case 9: { rParent.bIsVScrollMetricSet = sal_True; - sal_Int32 nUnit = 0; - pValues[nProp] >>= nUnit; - rParent.eVScrollMetric = ((FieldUnit)nUnit); // "Window/VerticalRulerUnit" + rParent.eVScrollMetric = ((FieldUnit)nInt32Val); // "Window/VerticalRulerUnit" } break; case 10: rParent.SetSmoothScroll(bSet); break;// "Window/SmoothScroll", - case 11: - { - sal_Int32 nVal = 0; - pValues[nProp] >>= nVal; - rParent.SetZoom( static_cast< USHORT >(nVal) ); - } - break;// "Zoom/Value", - case 12: - { - sal_Int32 nVal = 0; - pValues[nProp] >>= nVal; - rParent.SetZoomType( static_cast< SvxZoomType >(nVal) ); - } - break;// "Zoom/Type", - case 13: - { - sal_Int32 nUnit = 0; - pValues[nProp] >>= nUnit; - rParent.SetMetric((FieldUnit)nUnit, TRUE); - } - break;// "Other/MeasureUnit", - case 14: - { - sal_Int32 nTab = 0; - pValues[nProp] >>= nTab; - rParent.SetDefTab(MM100_TO_TWIP(nTab), TRUE); - } - break;// "Other/TabStop", - case 15: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", - case 16: - { - sal_Int32 nColumns = 0; - pValues[nProp] >>= nColumns; - rParent.SetViewLayoutColumns( static_cast<USHORT>(nColumns) ); - } - break;// "ViewLayout/Columns", - case 17: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", - case 18: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode", + case 11: rParent.SetZoom( static_cast< USHORT >(nInt32Val) ); break;// "Zoom/Value", + case 12: rParent.SetZoomType( static_cast< SvxZoomType >(nInt32Val) ); break;// "Zoom/Type", + case 13: rParent.SetAlignMathObjectsToBaseline(bSet); break;// "Other/IsAlignMathObjectsToBaseline" + case 14: rParent.SetMetric((FieldUnit)nInt32Val, TRUE); break;// "Other/MeasureUnit", + case 15: rParent.SetDefTab(MM100_TO_TWIP(nInt32Val), TRUE); break;// "Other/TabStop", + case 16: rParent.SetVRulerRight(bSet); break;// "Window/IsVerticalRulerRight", + case 17: rParent.SetViewLayoutColumns( static_cast<USHORT>(nInt32Val) ); break;// "ViewLayout/Columns", + case 18: rParent.SetViewLayoutBookMode(bSet); break;// "ViewLayout/BookMode", + case 19: rParent.SetDefaultPageMode(bSet,TRUE); break;// "Other/IsSquaredPageMode", } } } diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 26a86ec2cbfa..c8c19d5bcc0b 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -582,5 +582,3 @@ struct SwDialogsResMgr }; #endif - - diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx index 740d31c5e88c..54078db0f9a7 100644 --- a/sw/source/ui/frmdlg/frmdlg.cxx +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -93,6 +93,7 @@ SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, aTmp += *pStr; aTmp += ')'; } + AddTabPage(TP_FRM_STD, SwFrmPage::Create, 0); AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create, 0); AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0); @@ -217,3 +218,4 @@ void SwFrmDlg::PageCreated( USHORT nId, SfxTabPage &rPage ) break; } } + diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 49bd1b2a0c7e..c1747efaa962 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -677,7 +677,10 @@ SwFrmPage::SwFrmPage ( Window *pParent, const SfxItemSet &rSet ) : nOldV(text::VertOrientation::TOP), nOldVRel(text::RelOrientation::PRINT_AREA), pVMap( 0 ), - pHMap( 0 ) + pHMap( 0 ), + m_bAllowVertPositioning( true ), + m_bIsMathOLE( false ), + m_bIsMathBaselineAlignment( true ) { FreeResource(); SetExchangeSupport(); @@ -782,9 +785,17 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) SetMetric( aAtHorzPosED, aMetric ); SetMetric( aAtVertPosED, aMetric ); + const SfxPoolItem* pItem = NULL; const SwFmtAnchor& rAnchor = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR); + if (SFX_ITEM_SET == rSet.GetItemState(FN_OLE_IS_MATH, FALSE, &pItem)) + m_bIsMathOLE = ((const SfxBoolItem*)pItem)->GetValue(); + if (SFX_ITEM_SET == rSet.GetItemState(FN_MATH_BASELINE_ALIGNMENT, FALSE, &pItem)) + m_bIsMathBaselineAlignment = ((const SfxBoolItem*)pItem)->GetValue(); + EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment + && FLY_AS_CHAR == rAnchor.GetAnchorId()) ); + if (bFormat) { // Bei Formaten keine Ankerbearbeitung @@ -812,7 +823,6 @@ void SwFrmPage::Reset( const SfxItemSet &rSet ) if ( nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE ) { ASSERT(pSh , "shell not found"); - const SfxPoolItem* pItem; //OS: nur fuer die Variante Einfuegen/Grafik/Eigenschaften if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_GRF_REALSIZE, FALSE, &pItem)) aGrfSize = ((const SvxSizeItem*)pItem)->GetSize(); @@ -1280,8 +1290,8 @@ void SwFrmPage::InitPos(RndStdIds eId, if ( nY != LONG_MAX ) aAtVertPosED.SetValue( aAtVertPosED.Normalize(nY), FUNIT_TWIP ); } - aAtVertPosFT.Enable( bEnable ); - aAtVertPosED.Enable( bEnable ); + aAtVertPosFT.Enable( bEnable && m_bAllowVertPositioning ); + aAtVertPosED.Enable( bEnable && m_bAllowVertPositioning ); UpdateExample(); } @@ -1488,8 +1498,10 @@ ULONG SwFrmPage::FillRelLB( const FrmMap* _pMap, } } - _rLB.Enable(_rLB.GetEntryCount() != 0); - _rFT.Enable(_rLB.GetEntryCount() != 0); + const bool bEnable = _rLB.GetEntryCount() != 0 + && (&_rLB != &aVertRelationLB || m_bAllowVertPositioning); + _rLB.Enable( bEnable ); + _rFT.Enable( bEnable ); RelHdl(&_rLB); @@ -1850,6 +1862,10 @@ IMPL_LINK( SwFrmPage, AnchorTypeHdl, RadioButton *, EMPTYARG ) PosHdl(&aHorizontalDLB); PosHdl(&aVerticalDLB); } + + EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment + && FLY_AS_CHAR == eId) ); + return 0; } @@ -1875,7 +1891,7 @@ IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB ) } else { - BOOL bEnable = text::VertOrientation::NONE == nAlign; + BOOL bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning; aAtVertPosED.Enable( bEnable ); aAtVertPosFT.Enable( bEnable ); } @@ -2304,6 +2320,19 @@ void SwFrmPage::SetFormatUsed(BOOL bFmt) } } + +void SwFrmPage::EnableVerticalPositioning( bool bEnable ) +{ + m_bAllowVertPositioning = bEnable; + aVerticalFT.Enable( bEnable ); + aVerticalDLB.Enable( bEnable ); + aAtVertPosFT.Enable( bEnable ); + aAtVertPosED.Enable( bEnable ); + aVertRelationFT.Enable( bEnable ); + aVertRelationLB.Enable( bEnable ); +} + + /*-------------------------------------------------------------------- Beschreibung: --------------------------------------------------------------------*/ @@ -3246,4 +3275,3 @@ IMPL_LINK(SwFrmAddPage, ChainModifyHdl, ListBox*, pBox) } return 0; } - diff --git a/sw/source/ui/inc/frmdlg.hxx b/sw/source/ui/inc/frmdlg.hxx index 5776cc9f3dd8..decce61e2606 100644 --- a/sw/source/ui/inc/frmdlg.hxx +++ b/sw/source/ui/inc/frmdlg.hxx @@ -41,6 +41,7 @@ class SwFrmDlg : public SfxTabDialog BOOL m_bFormat; BOOL m_bNew; BOOL m_bHTMLMode; + bool m_bEnableVertPos; const SfxItemSet& m_rSet; USHORT m_nDlgType; SwWrtShell* m_pWrtShell; diff --git a/sw/source/ui/inc/frmpage.hxx b/sw/source/ui/inc/frmpage.hxx index 219f6c37a308..979f5cf12dd6 100644 --- a/sw/source/ui/inc/frmpage.hxx +++ b/sw/source/ui/inc/frmpage.hxx @@ -28,27 +28,17 @@ #ifndef _FRMPAGE_HXX #define _FRMPAGE_HXX -#ifndef _FIXED_HXX //autogen #include <vcl/fixed.hxx> -#endif -#ifndef _BUTTON_HXX //autogen #include <vcl/button.hxx> -#endif -#ifndef _LSTBOX_HXX //autogen #include <vcl/lstbox.hxx> -#endif -#ifndef _FIELD_HXX //autogen #include <vcl/field.hxx> -#endif #include <sfx2/tabdlg.hxx> #include <svx/swframeposstrings.hxx> #include <swtypes.hxx> #include <bmpwin.hxx> #include <svx/swframeexample.hxx> #include <prcntfld.hxx> -#ifndef _GLOBALS_HRC #include <globals.hrc> -#endif namespace sfx2{class FileDialogHelper;} @@ -142,6 +132,10 @@ class SwFrmPage: public SfxTabPage FrmMap* pVMap; FrmMap* pHMap; + bool m_bAllowVertPositioning; + bool m_bIsMathOLE; + bool m_bIsMathBaselineAlignment; + virtual void ActivatePage(const SfxItemSet& rSet); virtual int DeactivatePage(SfxItemSet *pSet); @@ -205,6 +199,7 @@ public: void SetFormatUsed(BOOL bFmt); void SetFrmType(USHORT nType) { nDlgType = nType; } inline BOOL IsInGraficMode( void ) { return nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE; } + void EnableVerticalPositioning( bool bEnable ); }; class SwGrfExtPage: public SfxTabPage diff --git a/sw/source/ui/inc/optpage.hxx b/sw/source/ui/inc/optpage.hxx index d05e68588b2d..61b8056aa309 100644 --- a/sw/source/ui/inc/optpage.hxx +++ b/sw/source/ui/inc/optpage.hxx @@ -353,6 +353,12 @@ class SwShdwCrsrOptionsTabPage : public SfxTabPage FixedLine aCrsrOptFL; CheckBox aCrsrInProtCB; + FixedLine m_aLayoutOptionsFL; + CheckBox m_aMathBaselineAlignmentCB; + + SwWrtShell * m_pWrtShell; + + SwShdwCrsrOptionsTabPage( Window* pParent, const SfxItemSet& rSet ); ~SwShdwCrsrOptionsTabPage(); @@ -362,6 +368,9 @@ public: virtual BOOL FillItemSet( SfxItemSet& rSet ); virtual void Reset( const SfxItemSet& rSet ); + + void SetWrtShell( SwWrtShell * pSh ) { m_pWrtShell = pSh; } + virtual void PageCreated( SfxAllItemSet aSet ); }; /*----------------------------------------------------------------------- @@ -498,5 +507,3 @@ private: }; #endif //PRODUCT #endif - - diff --git a/sw/source/ui/inc/usrpref.hxx b/sw/source/ui/inc/usrpref.hxx index 7864bf135934..0758f89af8bf 100644 --- a/sw/source/ui/inc/usrpref.hxx +++ b/sw/source/ui/inc/usrpref.hxx @@ -147,6 +147,8 @@ class SwMasterUsrPref : public SwViewOption sal_Int32 nDefTab; //default tab stop distance sal_Bool bIsSquaredPageMode; //default page mode for text grid + sal_Bool bIsAlignMathObjectsToBaseline; + SwContentViewConfig aContentConfig; SwLayoutViewConfig aLayoutConfig; SwGridConfig aGridConfig; @@ -271,6 +273,13 @@ public: aLayoutConfig.SetModified(); } + sal_Bool IsAlignMathObjectsToBaseline() const { return bIsAlignMathObjectsToBaseline; } + void SetAlignMathObjectsToBaseline( sal_Bool bVal, sal_Bool bNoModify = sal_False ) + { + bIsAlignMathObjectsToBaseline = bVal; + if(!bNoModify) + aLayoutConfig.SetModified(); + } }; #endif diff --git a/sw/source/ui/shells/basesh.cxx b/sw/source/ui/shells/basesh.cxx index 0500b4a88310..15c97f67c847 100644 --- a/sw/source/ui/shells/basesh.cxx +++ b/sw/source/ui/shells/basesh.cxx @@ -1080,6 +1080,14 @@ void SwBaseShell::Execute(SfxRequest &rReq) rSh.SetFlyFrmAttr(aSet); } + // if new anchor is 'as char' and it is a Math object and the usual + // pre-conditions are met then align the formula to the baseline of the text + const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); + const bool bDoMathBaselineAlignment = xObj.is() && SotExchange::IsMath( xObj->getClassID() ) + && FLY_AS_CHAR == eSet && rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + if (bDoMathBaselineAlignment) + rSh.AlignFormulaToBaseline( xObj ); + USHORT nHtmlMode = ::GetHtmlMode(GetView().GetDocShell()); if( nHtmlMode ) { diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx index 5d972af52f72..d8f6afd98347 100644 --- a/sw/source/ui/shells/frmsh.cxx +++ b/sw/source/ui/shells/frmsh.cxx @@ -52,7 +52,7 @@ #include <vcl/msgbox.hxx> // <-- - +#include <doc.hxx> #include <fmturl.hxx> #include <fmtclds.hxx> #include <fmtcnct.hxx> @@ -78,6 +78,7 @@ #include <helpid.h> #include <cmdid.h> +#include <cfgitems.hxx> #include <globals.hrc> #include <popup.hrc> #include <shells.hrc> @@ -408,14 +409,13 @@ void SwFrameShell::Execute(SfxRequest &rReq) SID_HTML_MODE, SID_HTML_MODE, FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, FN_PARAM_CHAIN_PREVIOUS, FN_PARAM_CHAIN_NEXT, + FN_OLE_IS_MATH, FN_OLE_IS_MATH, + FN_MATH_BASELINE_ALIGNMENT, FN_MATH_BASELINE_ALIGNMENT, 0); const SwViewOption* pVOpt = rSh.GetViewOptions(); if(nSel & nsSelectionType::SEL_OLE) - { - aSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, - pVOpt->IsKeepRatio())); - } + aSet.Put( SfxBoolItem(FN_KEEP_ASPECT_RATIO, pVOpt->IsKeepRatio()) ); aSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); aSet.Put(SfxStringItem(FN_SET_FRM_NAME, rSh.GetFlyName())); if( nSel & nsSelectionType::SEL_OLE ) @@ -446,6 +446,12 @@ void SwFrameShell::Execute(SfxRequest &rReq) if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff) rSize.SetHeight(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Height()); + // disable vertical positioning for Math Objects anchored 'as char' if baseline alignment is activated + aSet.Put( SfxBoolItem( FN_MATH_BASELINE_ALIGNMENT, + rSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) ); + const uno::Reference < embed::XEmbeddedObject > xObj( rSh.GetOleRef() ); + aSet.Put( SfxBoolItem( FN_OLE_IS_MATH, xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) ); + UINT16 nDefPage = 0; if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, FALSE, &pItem) == SFX_ITEM_SET) nDefPage = ((SfxUInt16Item *)pItem)->GetValue(); @@ -1146,3 +1152,4 @@ void SwFrameShell::StateInsert(SfxItemSet &rSet) if ((nSel & nsSelectionType::SEL_GRF) || (nSel & nsSelectionType::SEL_OLE)) rSet.DisableItem(FN_INSERT_FRAME); } + diff --git a/sw/source/ui/uiview/swcli.cxx b/sw/source/ui/uiview/swcli.cxx index 6da603c893b3..4265f3cf8cd0 100644 --- a/sw/source/ui/uiview/swcli.cxx +++ b/sw/source/ui/uiview/swcli.cxx @@ -27,16 +27,17 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" -#include <com/sun/star/embed/NoVisualAreaSizeException.hpp> +#include <com/sun/star/embed/NoVisualAreaSizeException.hpp> #include <wrtsh.hxx> +#include <doc.hxx> #include <swtypes.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <edtwin.hxx> #include <swcli.hxx> +#include <cmdid.h> +#include <cfgitems.hxx> #include <toolkit/helper/vclunohelper.hxx> @@ -169,3 +170,18 @@ void SwOleClient::MakeVisible() const SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell(); rSh.MakeObjVisible( GetObject() ); } + +// --> #i972# +void SwOleClient::FormatChanged() +{ + const uno::Reference < embed::XEmbeddedObject >& xObj( GetObject() ); + SwView * pView = dynamic_cast< SwView * >( GetViewShell() ); + if ( pView && xObj.is() && SotExchange::IsMath( xObj->getClassID() ) ) + { + SwWrtShell & rWrtSh = pView->GetWrtShell(); + if (rWrtSh.GetDoc()->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT )) + rWrtSh.AlignFormulaToBaseline( xObj ); + } +} +// <-- + diff --git a/sw/source/ui/uno/SwXDocumentSettings.cxx b/sw/source/ui/uno/SwXDocumentSettings.cxx index a3ef96d1a613..9b847644234f 100755..100644 --- a/sw/source/ui/uno/SwXDocumentSettings.cxx +++ b/sw/source/ui/uno/SwXDocumentSettings.cxx @@ -123,7 +123,8 @@ enum SwDocumentSettingsPropertyHandles // --> OD 2008-06-05 #i89181# HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, // <-- - HANDLE_MODIFYPASSWORDINFO + HANDLE_MODIFYPASSWORDINFO, + HANDLE_MATH_BASELINE_ALIGNMENT }; MasterPropertySetInfo * lcl_createSettingsInfo() @@ -178,6 +179,7 @@ MasterPropertySetInfo * lcl_createSettingsInfo() // --> OD 2008-06-05 #i89181# { RTL_CONSTASCII_STRINGPARAM("TabAtLeftIndentForParagraphsInList"), HANDLE_TAB_AT_LEFT_INDENT_FOR_PARA_IN_LIST, CPPUTYPE_BOOLEAN, 0, 0}, { RTL_CONSTASCII_STRINGPARAM("ModifyPasswordInfo"), HANDLE_MODIFYPASSWORDINFO, CPPUTYPE_PROPERTYVALUE, 0, 0}, + { RTL_CONSTASCII_STRINGPARAM("MathBaselineAlignment"), HANDLE_MATH_BASELINE_ALIGNMENT, CPPUTYPE_BOOLEAN, 0, 0}, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -686,6 +688,12 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf uno::Reference< uno::XInterface >() ); } break; + case HANDLE_MATH_BASELINE_ALIGNMENT: + { + sal_Bool bTmp = *(sal_Bool*)rValue.getValue(); + mpDoc->set( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT, bTmp ); + } + break; default: throw UnknownPropertyException(); } @@ -1018,6 +1026,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf rValue <<= mpDocSh->GetModifyPasswordInfo(); } break; + case HANDLE_MATH_BASELINE_ALIGNMENT: + { + sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ); + rValue.setValue( &bTmp, ::getBooleanCppuType() ); + } + break; default: throw UnknownPropertyException(); diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index 64199404687c..919ebbe079ba 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -27,6 +27,7 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" + #include <com/sun/star/container/XChild.hpp> #include <com/sun/star/embed/XVisualObject.hpp> #include <com/sun/star/embed/EmbedMisc.hpp> @@ -42,9 +43,7 @@ #include <svx/svdview.hxx> #include <sot/factory.hxx> #include <svl/itemiter.hxx> -#ifndef _SOUND_HXX //autogen #include <vcl/sound.hxx> -#endif #include <tools/bigint.hxx> #include <sot/storage.hxx> #include <svtools/insdlg.hxx> @@ -60,28 +59,21 @@ #include <vcl/graph.hxx> #include <sfx2/printer.hxx> #include <unotools/charclass.hxx> - #include <comphelper/storagehelper.hxx> #include <svx/svxdlg.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> +#include <frmfmt.hxx> #include <fmtftn.hxx> #include <fmtpdsc.hxx> -#ifndef _WDOCSH_HXX #include <wdocsh.hxx> -#endif -#ifndef _BASESH_HXX #include <basesh.hxx> -#endif #include <swmodule.hxx> #include <wrtsh.hxx> -#ifndef _VIEW_HXX #include <view.hxx> -#endif #include <uitool.hxx> -#ifndef _CMDID_H #include <cmdid.h> -#endif +#include <cfgitems.hxx> #include <pagedesc.hxx> #include <frmmgr.hxx> #include <shellio.hxx> @@ -89,9 +81,7 @@ #include <swundo.hxx> // fuer Undo-Ids #include <swcli.hxx> #include <poolfmt.hxx> -#ifndef _WVIEW_HXX #include <wview.hxx> -#endif #include <edtwin.hxx> #include <fmtcol.hxx> #include <swtable.hxx> @@ -100,15 +90,12 @@ #include <swdtflvr.hxx> #include <crsskip.hxx> #include <doc.hxx> -#ifndef _WRTSH_HRC #include <wrtsh.hrc> -#endif #include <SwStyleNameMapper.hxx> #include <sfx2/request.hxx> #include <paratr.hxx> #include <ndtxt.hxx> #include <editeng/acorrcfg.hxx> -//#include <svx/acorrcfg.hxx> #include <IMark.hxx> // -> #111827# @@ -609,6 +596,11 @@ BOOL SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrmFm aFrmMgr.SetSize( aSz ); SwFlyFrmFmt *pFmt = SwFEShell::InsertObject( xRef, &aFrmMgr.GetAttrSet() ); + // --> #i972# + if ( bStarMath && pDoc->get( IDocumentSettingAccess::MATH_BASELINE_ALIGNMENT ) ) + AlignFormulaToBaseline( xRef.GetObject() ); + // <-- + if (pFlyFrmFmt) *pFlyFrmFmt = pFmt; @@ -769,6 +761,8 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, if ( (embed::EmbedMisc::EMBED_ACTIVATEIMMEDIATELY & nMisc) || bLinkingChart // TODO/LATER: ResizeOnPrinterChange //|| SVOBJ_MISCSTATUS_RESIZEONPRINTERCHANGE & xObj->GetMiscStatus() + || nMisc & embed::EmbedMisc::EMBED_NEVERRESIZE // non-resizable objects need to be + // set the size back by this method ) { pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xObj ); @@ -879,6 +873,17 @@ void SwWrtShell::CalcAndSetScale( svt::EmbeddedObjectRef& xObj, if ( bUseObjectSize ) { + // --> this moves non-resizable object so that when adding borders the baseline remains the same + const SwFlyFrmFmt *pFlyFrmFmt = dynamic_cast< const SwFlyFrmFmt * >( GetFlyFrmFmt() ); + ASSERT( pFlyFrmFmt, "Could not find fly frame." ); + if ( pFlyFrmFmt ) + { + const Point &rPoint = pFlyFrmFmt->GetLastFlyFrmPrtRectPos(); + SwRect aRect( pFlyPrtRect ? *pFlyPrtRect + : GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, 0, xObj.GetObject() )); + aArea += rPoint - aRect.Pos(); // adjust area by diff of printing area position in order to keep baseline alignment correct. + } + // <-- aArea.Width ( _aVisArea.Width() ); aArea.Height( _aVisArea.Height() ); RequestObjectResize( aArea, xObj.GetObject() ); @@ -1864,3 +1869,4 @@ String SwWrtShell::GetSelDescr() const return aResult; } + diff --git a/testautomation/graphics/optional/d_export_graphic_a.bas b/testautomation/graphics/optional/d_export_graphic_a.bas index b5968240e024..45b5ef107409 100755 --- a/testautomation/graphics/optional/d_export_graphic_a.bas +++ b/testautomation/graphics/optional/d_export_graphic_a.bas @@ -51,16 +51,16 @@ sub main endif Call sFileExport 'OBSERVE - This line must run before the following testcases! - Call tEPS '///+- Encapsulated PostScript ///' - Call tPCT '///+- Mac Pict ///' - Call tPBM '///+- Portable Bitmap ///' - Call tPGM '///+- Portable Graymap ///' - Call tPPM '///+- Portable Pixelmap ///' - Call tRAS '///+- Sun Raster Image ///' - Call tTIFF '///+- Tagged Image File Format ///' - Call tXPM '///+- X PixMap ///' - Call tGIF '///+- Graphics Interchange Format ///' - Call tJPEG '///+- Joint Photographic Experts Group ///' + Call tEPS 'Encapsulated PostScript + Call tPCT 'Mac Pict + Call tPBM 'Portable Bitmap + Call tPGM 'Portable Graymap + Call tPPM 'Portable Pixelmap + Call tRAS 'Sun Raster Image + Call tTIFF 'Tagged Image File Format + Call tXPM 'X PixMap + Call tGIF 'Graphics Interchange Format + Call tJPEG 'Joint Photographic Experts Group Call hStatusOut end sub diff --git a/testautomation/graphics/optional/d_export_graphic_b.bas b/testautomation/graphics/optional/d_export_graphic_b.bas index 97560705afc4..f1a4d783ef62 100755 --- a/testautomation/graphics/optional/d_export_graphic_b.bas +++ b/testautomation/graphics/optional/d_export_graphic_b.bas @@ -50,16 +50,16 @@ sub main endif Call sFileExport 'OBSERVE - This line must run before the following testcases! - Call tPNG '///+- Portable Network Graphic ///' - Call tSVM '///+- StarView Metafile ///' - Call tPDF '///+- Portable Document Format ///' - Call tPDF_Creator '///+- test if the right creator is set in the PDF document - Call tSVG '///+- Scalable Vector Graphics ///' - Call tBMP '///+- Windows Bitmap ///' - Call tEMF '///+- Enhanced Metafile ///' - Call tMET '///+- OS/2 Metafile ///' - Call tSWF '///+- Macromedia Flash (SWF) (.swf) ///' - Call tWMF '///+- Windows Metafile ///' + Call tPNG 'Portable Network Graphic + Call tSVM 'StarView Metafile + Call tPDF 'Portable Document Format + Call tPDF_Creator 'test if the right creator is set in the PDF document + Call tSVG 'Scalable Vector Graphics + Call tBMP 'Windows Bitmap + Call tEMF 'Enhanced Metafile + Call tMET 'OS/2 Metafile + Call tSWF 'Macromedia Flash (SWF) (.swf) + Call tWMF 'Windows Metafile Call hStatusOut end sub diff --git a/testautomation/graphics/optional/export_graphic_a.bas b/testautomation/graphics/optional/export_graphic_a.bas index 9dee4114b37f..1bd3149cf650 100755 --- a/testautomation/graphics/optional/export_graphic_a.bas +++ b/testautomation/graphics/optional/export_graphic_a.bas @@ -50,16 +50,16 @@ sub main endif Call sFileExport 'OBSERVE - This line must run before the following testcases! - Call tEPS '///+- Encapsulated PostScript ///' - Call tPCT '///+- Mac Pict ///' - Call tPBM '///+- Portable Bitmap ///' - Call tPGM '///+- Portable Graymap ///' - Call tPPM '///+- Portable Pixelmap ///' - Call tRAS '///+- Sun Raster Image ///' - Call tTIFF '///+- Tagged Image File Format ///' - Call tXPM '///+- X PixMap ///' - Call tGIF '///+- Graphics Interchange Format ///' - Call tJPEG '///+- Joint Photographic Experts Group ///' + Call tEPS 'Encapsulated PostScript + Call tPCT 'Mac Pict + Call tPBM 'Portable Bitmap + Call tPGM 'Portable Graymap + Call tPPM 'Portable Pixelmap + Call tRAS 'Sun Raster Image + Call tTIFF 'Tagged Image File Format + Call tXPM 'X PixMap + Call tGIF 'Graphics Interchange Format + Call tJPEG 'Joint Photographic Experts Group Call hStatusOut end sub diff --git a/testautomation/graphics/optional/export_graphic_b.bas b/testautomation/graphics/optional/export_graphic_b.bas index 9502b5005625..0abe27eb7579 100755 --- a/testautomation/graphics/optional/export_graphic_b.bas +++ b/testautomation/graphics/optional/export_graphic_b.bas @@ -50,16 +50,16 @@ sub main endif Call sFileExport 'OBSERVE - This line must run before the following testcases! - Call tPDF '///+- Portable Document Format ///' - Call tPDF_Creator '///+- test if the right creator is set in the PDF document - Call tSVG '///+- Scalable Vector Graphics ///' - Call tSVM '///+- StarView Metafile ///' - Call tBMP '///+- Windows Bitmap ///' - Call tEMF '///+- Enhanced Metafile ///' - Call tPNG '///+- Portable Network Graphic ///' - Call tMET '///+- OS/2 Metafile ///' - Call tWMF '///+- Windows Metafile ///' - Call tSWF '///+- Macromedia Flash (SWF) (.swf) ///' + Call tPDF ' Portable Document Format + Call tPDF_Creator 'test if the right creator is set in the PDF document + Call tSVG 'Scalable Vector Graphics + Call tSVM 'StarView Metafile + Call tBMP 'Windows Bitmap + Call tEMF 'Enhanced Metafile + Call tPNG 'Portable Network Graphic + Call tMET 'OS/2 Metafile + Call tWMF 'Windows Metafile + Call tSWF 'Macromedia Flash (SWF) (.swf) Call hStatusOut end sub diff --git a/testautomation/graphics/optional/i_slideshow.bas b/testautomation/graphics/optional/i_slideshow.bas index 8a9062c87c05..e52427f1402a 100755 --- a/testautomation/graphics/optional/i_slideshow.bas +++ b/testautomation/graphics/optional/i_slideshow.bas @@ -52,7 +52,7 @@ sub main warnlog "Add 'slide' to FILE /input/impress/locale_1.txt (take string from below)!!!" endif - '/// LOCALE Slide - 2 ///' + printlog "LOCALE Slide - 2" S1 = glLocale (2) + " 1" S2 = glLocale (2) + " 2" S3 = glLocale (2) + " 3" diff --git a/testautomation/graphics/optional/includes/global/export_graphic_2.inc b/testautomation/graphics/optional/includes/global/export_graphic_2.inc index 1e9d6e04f631..71986e9b94d7 100644 --- a/testautomation/graphics/optional/includes/global/export_graphic_2.inc +++ b/testautomation/graphics/optional/includes/global/export_graphic_2.inc @@ -254,171 +254,127 @@ testcase tPDF dim iFileSize(12) as long dim i as integer - '/// Export the file 12 times: ///' - '///+ every compression level (3) and every range (3), check if button in toolbar uses last settings (6) (-> 12) ///' + printlog "Export the file 12 times: " + printlog "every compression level (3) and every range (3), check if button in toolbar uses last settings (6) (-> 12) " hFileOpen (ConvertPath ( gTesttoolPath + "graphics\required\input\graphicexport_pdf."+ExtensionString )) sleep (10) '--------------------------------------------------------------------------------------------------------------------------------------------------------- - '###### all / Screen optimized ###### - '/// File->Export as PDF document printlog "File->Export as PDF document" - '///+ range = All printlog " range = All" - '///+ compression = Screen optimized printlog " compression = Screen optimized" - kontext "Standardbar" checkexppdfwaitmax10sec - '--------------------------------------------------------- Output the first file --------------------------------------------------------------- + printlog "------------------- Output the first file ---------------------" hExportAsPDFmulti (3, TRUE, OutputGrafikTBO + 1, TRUE, FALSE, 1, 1) - '/// Export using Button in toolbar printlog "Export using Button in toolbar" - '///+ use the settings from the export before printlog " use the settings from the export before" - kontext "Standardbar" checkexppdfwaitmax10sec - '------------------------------------------------------- Output the second file ------------------------------------------------------------- + printlog "--------------------- Output the second file -------------------" hExportAsPDFmulti (1, TRUE, OutputGrafikTBO + 2, TRUE, FALSE, 1, 1) ' button in toolbar -> last settings have to be used - '###### range / Screen optimized ###### - '/// File->Export as PDF document + printlog "File->Export as PDF document" - '///+ range = Range printlog " range = Range" - '///+ compression = Screen optimized printlog " compression = Screen optimized" - kontext "Standardbar" checkexppdfwaitmax10sec - '--------------------------------------------------------- Output the third file --------------------------------------------------------------- + printlog "---------------- Output the third file --------------------" hExportAsPDFmulti (3, TRUE, OutputGrafikTBO + 3, TRUE, FALSE, 2, 1, "2") - '/// Export using Button in toolbar printlog "Export using Button in toolbar" - '///+ use the settings from the export before printlog " use the settings from the export before" - kontext "Standardbar" checkexppdfwaitmax10sec - '--------------------------------------------------------- Output the fourth file ------------------------------------------------------------- + printlog "---------------------- Output the fourth file -----------------" hExportAsPDFmulti (1, TRUE, OutputGrafikTBO + 4, TRUE, FALSE, 2, 1) ' button in toolbar -> last settings have to be used - '###### all / Print optimized ###### - '/// File->Export as PDF document printlog "File->Export as PDF document" - '///+ range = all printlog " range = all" - '///+ compression = Print optimized printlog " compression = Print optimized" - kontext "Standardbar" checkexppdfwaitmax10sec - '------------------------------------------------------------ Output the fifth file -------------------------------------------------------------- + printlog "----------------------------- Output the fifth file ------------" hExportAsPDFmulti (3, TRUE, OutputGrafikTBO + 5, TRUE, FALSE, 1, 2) - '/// Export using Button in toolbar printlog "Export using Button in toolbar" - '///+ use the settings from the export before printlog " use the settings from the export before" - kontext "Standardbar" checkexppdfwaitmax10sec - '----------------------------------------------------------- Output the sixth file --------------------------------------------------------------- + printlog "---------------------- Output the sixth file -------------------" hExportAsPDFmulti (1, TRUE, OutputGrafikTBO + 6, TRUE, FALSE, 1, 2) ' button in toolbar -> last settings have to be used - '###### range / Print optimized ###### - '/// File->Export as PDF document printlog "File->Export as PDF document" - '///+ range = Range printlog " range = Range" - '///+ compression = Screen optimized printlog " compression = Screen optimized" - kontext "Standardbar" checkexppdfwaitmax10sec - '--------------------------------------------------------- Output the seventh file ------------------------------------------------------------- + printlog "------------------ Output the seventh file ---------------------" hExportAsPDFmulti (3, TRUE, OutputGrafikTBO + 7, TRUE, FALSE, 2, 2, "2") - '/// Export using Button in toolbar printlog "Export using Button in toolbar" -' '///+ use the settings from the export before printlog " use the settings from the export before" - kontext "Standardbar" checkexppdfwaitmax10sec - '------------------------------------------------------------ Output the eight file ---------------------------------------------------------------- + printlog "---------------------- Output the eight file -------------------" hExportAsPDFmulti (1, TRUE, OutputGrafikTBO + 8, TRUE, FALSE, 2, 2) ' button in toolbar -> last settings have to be used - '###### all / Press optimized ###### - '/// File->Export as PDF document ///' - printlog "File->Export as PDF document ///'" - '///+ range = all + printlog "File->Export as PDF document" printlog " range = all" - '///+ compression = Press optimized printlog " compression = Press optimized" - kontext "Standardbar" checkexppdfwaitmax10sec - '------------------------------------------------------------ Output the ninth file ---------------------------------------------------------------- + printlog "------------------- Output the ninth file ----------------------" hExportAsPDFmulti (3, TRUE, OutputGrafikTBO + 9, TRUE, FALSE, 1, 3) - '/// Export using Button in toolbar - '///+ use the settings from the export before - + printlog "Export using Button in toolbar" + printlog "use the settings from the export before" kontext "Standardbar" checkexppdfwaitmax10sec - '------------------------------------------------------------ Output the tenth file ---------------------------------------------------------------- + printlog "------------------------- Output the tenth file ----------------" hExportAsPDFmulti (1, TRUE, OutputGrafikTBO + 10, TRUE, FALSE, 1, 3) ' button in toolbar -> last settings have to be used - '###### range / Press optimized ###### - '/// File->Export as PDF document ///' - printlog "File->Export as PDF document ///'" - '///+ range = all + printlog "File->Export as PDF document" printlog " range = all" - '///+ compression = Press optimized printlog " compression = Press optimized" - kontext "Standardbar" checkexppdfwaitmax10sec - '----------------------------------------------------------- Output the eleventh file ------------------------------------------------------------- + printlog "----------------- Output the eleventh file ---------------------" hExportAsPDFmulti (3, TRUE, OutputGrafikTBO + 11, TRUE, FALSE, 2, 3, "2") - '/// Export using Button in toolbar - '///+ use the settings from the export before - + printlog "Export using Button in toolbar" + printlog "use the settings from the export before" kontext "Standardbar" checkexppdfwaitmax10sec - '------------------------------------------------------------- Output the twelfth file -------------------------------------------------------------- + printlog "------------------ Output the twelfth file ---------------------" hExportAsPDFmulti (1, TRUE, OutputGrafikTBO + 12, TRUE, FALSE, 2, 3) ' button in toolbar -> last settings have to be used - kontext "Standardbar" checkexppdfwaitmax10sec - '----------------------------------------------------------------------------------------------------------------------------------------------------------------- + '--------------------------------------------------------------------------- for i=1 to 12 sPath = OutputGrafikTBO @@ -427,12 +383,12 @@ testcase tPDF Printlog (" - " + i + ": " + " " + iFileSize(i) + " " + sPath if (dir(sPath) <> "") then sleep(1) - '/// the first line has to be '%PDF-1.4' ///' + printlog " the first line has to be %PDF-1.4" sTemp = fGetFileText(sPath, 8) if (sTemp <> "%PDF-1.4") then Warnlog "File doesn't start with '%PDF-1.4' it is: '" + sTemp + "'" endif - '/// the last line has to be '%%EOF' ///' + printlog "the last line has to be '%%EOF' " sTemp = left(fGetFileText(sPath, -6),5) if (sTemp <> "%%EOF") then Warnlog "File doesn't end with '%%EOF' it is: '" + sTemp + "'" @@ -442,25 +398,21 @@ testcase tPDF endif next i - ' Check if the file size is the same when exporting via toolbar and file/export - ' if the size different then the options are not used when exporting via the toolbar + printlog "Check if the file size is the same when exporting via toolbar and file/export" + printlog "if the size is different then the options are not used when exporting via the toolbar" if (iFileSize(1) <> iFileSize(2)) then qaerrorlog "i100919: pdf export: different file size when exporting with file/export or button" 'Warnlog ("Diffrence in filesize for file 1 and 2") endif - ' print optimized if (iFileSize(5) <> iFileSize(6)) then qaerrorlog "i100919: pdf export: different file size when exporting with file/export or button" 'Warnlog ("Difference in filesize for file 5 and 6") endif - ' press optimized if (iFileSize(9) <> iFileSize(10)) then qaerrorlog "i100919: pdf export: different file size when exporting with file/export or button" 'Warnlog ("Difference in filesize for file 9 and 10") endif - - if (iFileSize(1) > iFileSize(5)) then qaerrorlog "i100919: pdf export: different file size when exporting with file/export or button" 'Warnlog ("Filesize for file 1 is greater then for file 5. The compression level doesn't work.") @@ -1357,31 +1309,31 @@ endcase 'tWMF '------------------------------------------------------------------------- function fGetFileText (sFilename as string, iCount as long) as string -'/// This function is for getting the first or last n characters of a file -'///+<u>Input</u>:<ul><li>filename</li><li>number</li></ul>If the number greater 0 then get n characters from start. -'///+A number smaller 0 get from end of file. -'///+<u>Output</u>:<ul><li>string with <b><i>n</i></b> characters</li></ul> - - dim iFile as integer ' filehandle - dim iTem as integer ' get 2 bytes of the file - dim iTemByte(2) as integer ' move 1 byte from iTem in each item - dim sTemp as string ' string of file - dim iSize as long ' size in bytes of file - dim i as long ' runner :-) - - iFile = FreeFile -' Printlog "FreeFile: " + iFile - if (dir (sFilename) <> "") then -' Printlog "FileLen: " + FileLen(sFile) - Open sFilename For binary access read shared As #iFile -' Printlog "Loc: " + Loc(#iFile) ' LONG! where am i in the file? - - iSize = Lof(#iFile) ' get size in bytes of file - if (iSize > 65530) then '65536 = 64kB - 'Warnlog "fGetFileText: file '" + sFilename + "' might get problems on reading it? size is > 65530 Byte: '" + iSize + "'" - else -' printlog "iSize: " + iSize - endif + printlog "This function is for getting the first or last n characters of a file" + printlog "Input:filename number If the number greater 0 then get n characters from start." + printlog "number smaller 0 get from end of file." + printlog "Output:string with characters" + + dim iFile as integer ' filehandle + dim iTem as integer ' get 2 bytes of the file + dim iTemByte(2) as integer ' move 1 byte from iTem in each item + dim sTemp as string ' string of file + dim iSize as long ' size in bytes of file + dim i as long ' runner :-) + + iFile = FreeFile + Printlog "FreeFile: " + iFile + if (dir (sFilename) <> "") then + Printlog "FileLen: " + FileLen(sFile) + Open sFilename For binary access read shared As #iFile + Printlog "Loc: " + Loc(#iFile) ' LONG! where am i in the file? + + iSize = Lof(#iFile) ' get size in bytes of file + if (iSize > 65530) then '65536 = 64kB + 'Warnlog "fGetFileText: file '" + sFilename + "' might get problems on reading it? size is > 65530 Byte: '" + iSize + "'" + else + printlog "iSize: " + iSize + endif sTemp = "" if (iCount >= 0) then ' get bytes from file start @@ -1406,7 +1358,7 @@ function fGetFileText (sFilename as string, iCount as long) as string sTemp = chr(iTemByte(1)) + chr(iTemByte(2)) + sTemp ' put them together endif endif -' printlog "'"+left(sTemp,iSize)+"'" ' gotcha! + printlog "'"+left(sTemp,iSize)+"'" ' gotcha! if (iSize-(Abs(iCount)) >= 0) then fGetFileText = left(sTemp,Abs(iCount)) diff --git a/testautomation/graphics/optional/includes/global/g_area.inc b/testautomation/graphics/optional/includes/global/g_area.inc index 758044290d45..eb53faaa9bb3 100644 --- a/testautomation/graphics/optional/includes/global/g_area.inc +++ b/testautomation/graphics/optional/includes/global/g_area.inc @@ -39,341 +39,378 @@ testcase tiFormatArea Dim Zaehler dim Entf$ - hNewDocument '/// New impress document ///' - hRechteckErstellen (20,20,60,60) '/// create rectangle ///' - Printlog " - Change Format" '/// change format for the rectangle ///' - FormatArea - Kontext - active.SetPage TabArea - Kontext "TabArea" - FillOptions.Select 5 '/// apply bitmap as texture ///' - BitmapList.Select 3 '/// Select "Water" ///' - Tile.Check '/// tile bitmap ///' - Kontext - active.SetPage TabSchatten - kontext "TabSchatten" - Anzeigen.Check '/// apply shadow ///' - Entfernung.SetText "30" '/// set angle to 30���///' - Entf$=Entfernung.GetText '/// change distance ///' - Farbe.Select 15 '/// select color 15///' - TabSchatten.OK '/// close dialog ///' - Sleep 3 + printlog "New impress document " + hNewDocument + printlog "create rectangle " + hRechteckErstellen (20,20,60,60) + Printlog " - Change Format" + printlog "change format for the rectangle " + FormatArea + Kontext + active.SetPage TabArea + Kontext "TabArea" + printlog "apply bitmap as texture " + FillOptions.Select 5 + printlog "Select Water " + BitmapList.Select 3 + printlog "tile bitmap " + Tile.Check + Kontext + active.SetPage TabSchatten + kontext "TabSchatten" + printlog "apply shadow " + Anzeigen.Check + printlog "set angle to 30���" + Entfernung.SetText "30" + printlog "change distance " + Entf$=Entfernung.GetText + printlog "select color 15" + Farbe.Select 15 + printlog "close dialog " + TabSchatten.OK + Sleep 3 - Printlog " - Test various formats" - FormatArea '/// Format area, check if changes are saved for this object ///' - Kontext - active.SetPage TabArea - Kontext "TabArea" - if NOT FillOptions.GetSelIndex = 5 then - Warnlog "Bitmap is not checked" - else - if BitmapList.GetSelIndex <> 3 then Warnlog "Wrong bitmap used. "+ BitmapAuswahl.GetSelIndex - if NOT Tile.IsChecked then Warnlog "Tile is not checked" -' if Original.IsChecked then Warnlog "Original is not checked" -' if NOT Relativ.IsChecked then Warnlog "Relative is not checked" -' if Breite.GetText <> "90 %" then Warnlog "Width is not 90%, it is: "+Breite.GetText -' if XOffset.GetText <> "30 %" then Warnlog "XOffset is not 30%, it is: "+XOffset.GetText -' if NOT Zeile.IsChecked then Warnlog "Line is not checked" -' if Verschiebung.GetText <> "20 %" then Warnlog "Displace is not 20%, it is: " + Verschiebung.GetText - Kontext - active.SetPage TabSchatten - kontext "TabSchatten" - if NOT Anzeigen.IsChecked then - Warnlog "Show shadows is not checked" - else - if Entfernung.GetText <> Entf$ then Warnlog "Distance is not " + Entf$ + " it is: "+ Entfernung.GetText - if Farbe.GetSelIndex <> 15 then Warnlog "Wrong color for shadow. It is: "+ Farbe.GetSelIndex - end if - end if + Printlog " - Test various formats" + printlog "Format area, check if changes are saved for this object " + FormatArea + Kontext + active.SetPage TabArea + Kontext "TabArea" + if NOT FillOptions.GetSelIndex = 5 then + Warnlog "Bitmap is not checked" + else + if BitmapList.GetSelIndex <> 3 then Warnlog "Wrong bitmap used. "+ BitmapAuswahl.GetSelIndex + if NOT Tile.IsChecked then Warnlog "Tile is not checked" + ' if Original.IsChecked then Warnlog "Original is not checked" + ' if NOT Relativ.IsChecked then Warnlog "Relative is not checked" + ' if Breite.GetText <> "90 %" then Warnlog "Width is not 90%, it is: "+Breite.GetText + ' if XOffset.GetText <> "30 %" then Warnlog "XOffset is not 30%, it is: "+XOffset.GetText + ' if NOT Zeile.IsChecked then Warnlog "Line is not checked" + ' if Verschiebung.GetText <> "20 %" then Warnlog "Displace is not 20%, it is: " + Verschiebung.GetText + Kontext + active.SetPage TabSchatten + kontext "TabSchatten" + if NOT Anzeigen.IsChecked then + Warnlog "Show shadows is not checked" + else + if Entfernung.GetText <> Entf$ then Warnlog "Distance is not " + Entf$ + " it is: "+ Entfernung.GetText + if Farbe.GetSelIndex <> 15 then Warnlog "Wrong color for shadow. It is: "+ Farbe.GetSelIndex + end if + end if TabSchatten.Cancel - - hCloseDocument '/// close document ///' + printlog "close document " + hCloseDocument endcase 'tiFormatArea '-------------------------------------------------------- testcase tdFormatArea1 -Dim i -Dim j -Dim k -Dim m -Dim n -Dim Winkel_1 as string -Dim ZaehlerFarbe -Dim ZaehlerVerlauf -Dim ZaehlerSchraffur -Dim ZaehlerBitmap -Dim ColorName$ + Dim i + Dim j + Dim k + Dim m + Dim n + Dim Winkel_1 as string + Dim ZaehlerFarbe + Dim ZaehlerVerlauf + Dim ZaehlerSchraffur + Dim ZaehlerBitmap + Dim ColorName$ ColorName$ = "Bullshit" - dim Zaehler as integer + dim Zaehler as integer - Call hNewDocument '/// new document ///' - sleep 3 - Call hRechteckErstellen (30,30,70,70) '/// create rectangle ///' - sleep 2 - FormatArea '/// format area ///' - Kontext - Active.SetPage TabArea - Kontext "TabArea" - FillOptions.Select 1 '/// Select no fill ///' - sleep 2 - TabArea.OK - sleep 1 - FormatArea - Kontext - Active.SetPage TabArea - Kontext "TabArea" - sleep 1 '/// control if changes are still there after closing and reopening dialog ///' - FillOptions.Select 3'/// check gradient and select 1 ///' - ZaehlerVerlauf = GradientList.GetItemCount - for j = 1 To 2 - GradientList.Select j - TabArea.OK - FormatArea - Kontext - Active.SetPage TabArea - Kontext "TabArea" - PrintLog GradientList.GetSelText - next j - FillOptions.Select 4 '/// select hatching, control after closing and reopening dialog if changes are recognized ///' - HatchingList.GetItemCount - ZaehlerSchraffur = HatchingList.GetItemCount - for k=1 to 2'ZaehlerSchraffur - HatchingList.Select k - TabArea.OK - FormatArea - Kontext - Active.SetPage TabArea - Kontext "TabArea" - PrintLog HatchingList.GetSelText + printlog "new document " + Call hNewDocument + sleep 3 + printlog "create rectangle " + Call hRechteckErstellen (30,30,70,70) + sleep 2 + printlog "format area " + FormatArea + Kontext + Active.SetPage TabArea + Kontext "TabArea" + printlog "Select no fill " + FillOptions.Select 1 + sleep 2 + TabArea.OK + sleep 1 + FormatArea + Kontext + Active.SetPage TabArea + Kontext "TabArea" + sleep 1 + printlog "control if changes are still there after closing and reopening dialog " + printlog "check gradient and select 1 " + FillOptions.Select 3' + ZaehlerVerlauf = GradientList.GetItemCount + for j = 1 To 2 + GradientList.Select j + TabArea.OK + FormatArea + Kontext + Active.SetPage TabArea + Kontext "TabArea" + PrintLog GradientList.GetSelText + next j + printlog "select hatching, control after closing and reopening dialog if changes are recognized " + FillOptions.Select 4 + HatchingList.GetItemCount + ZaehlerSchraffur = HatchingList.GetItemCount + for k=1 to 2'ZaehlerSchraffur + HatchingList.Select k + TabArea.OK + FormatArea + Kontext + Active.SetPage TabArea + Kontext "TabArea" + PrintLog HatchingList.GetSelText next k - FillOptions.Select 5 '/// check bitmap, control if changes are permanent after closing and reopening dialog ///' - BitmapList.GetItemCount - ZaehlerBitmap = BitmapList.GetItemCount - for n=1 to ZaehlerBitmap - BitmapList.Select n - TabArea.OK - FormatArea - sleep 1 - Kontext - Active.SetPage TabArea - Kontext "TabArea" - PrintLog BitmapList.GetSelText - next n + printlog "check bitmap, control if changes are permanent after closing and reopening dialog " + FillOptions.Select 5 + BitmapList.GetItemCount + ZaehlerBitmap = BitmapList.GetItemCount + for n=1 to ZaehlerBitmap + BitmapList.Select n + TabArea.OK + FormatArea + sleep 1 + Kontext + Active.SetPage TabArea + Kontext "TabArea" + PrintLog BitmapList.GetSelText + next n - if Tile.IsChecked = False Then Tile.Check '/// check tile ///' -' if Anpassen.IsEnabled = False Then PrintLog " Option Tile activated" -' if Anpassen.IsEnabled = True Then WarnLog " Option Tile not activated" -' if Relativ.IsChecked = False Then -' SetClipboard Breite.GetText -' Relativ.Check -' If Breite.GetText = GetClipboardText Then -' WarnLog " Relative isnt working" -' else -' PrintLog " Relative works" -' end if -' end if -' -' if Kacheln.IsChecked = True Then Kacheln.UnCheck -' Anpassen.Check -' if Relativ.IsEnabled = True Then WarnLog " Option Anpassen konnte nicht aktiviert werden" -' if not Relativ.IsEnabled Then PrintLog " Option Anpassen funktioniert" -' Anpassen.Uncheck -' Original.Check -' if Breite.IsEnabled And Hoehe.IsEnabled = True Then WarnLog " Button Original funktioniert nicht" -' if Breite.IsEnabled And Hoehe.IsEnabled = False Then PrintLog " Button Original funktioniert" -' Kacheln.Check -' setClipboard XOffset.GetText -' XOffset.More 3 -' if XOffset.GetText <> GetClipboardText Then PrintLog " Position XOffset funktioniert" -' if XOffset.GetText = GetClipboardText Then WarnLog " Position XOffset funktioniert nicht" -' SetClipboard YOffset.GetText -' YOffset.More 5 -' if YOffset.GetText <> GetClipboardText Then PrintLog " Position YOffset funktioniert" -' if YOffset.GetText = GetClipboardText Then WarnLog " Position YOffset funktioniert nicht" -' PrintLog " TabArea fertig" - Kontext - Active.SetPage TabSchatten - Kontext "TabSchatten" - sleep 1 - if Anzeigen.IsChecked = True Then Anzeigen.UnCheck '/// uncheck shadow ///' - sleep 1 - if Entfernung.IsEnabled = False Then '/// check if shadow related controls are disabled with no shadow ///' - PrintLog " Show shadow works" - else - WarnLog " Show shadow does not work" - end if + printlog "check tile " + if Tile.IsChecked = False Then Tile.Check + ' if Anpassen.IsEnabled = False Then PrintLog " Option Tile activated" + ' if Anpassen.IsEnabled = True Then WarnLog " Option Tile not activated" + ' if Relativ.IsChecked = False Then + ' SetClipboard Breite.GetText + ' Relativ.Check + ' If Breite.GetText = GetClipboardText Then + ' WarnLog " Relative isnt working" + ' else + ' PrintLog " Relative works" + ' end if + ' end if + ' + ' if Kacheln.IsChecked = True Then Kacheln.UnCheck + ' Anpassen.Check + ' if Relativ.IsEnabled = True Then WarnLog " Option Anpassen konnte nicht aktiviert werden" + ' if not Relativ.IsEnabled Then PrintLog " Option Anpassen funktioniert" + ' Anpassen.Uncheck + ' Original.Check + ' if Breite.IsEnabled And Hoehe.IsEnabled = True Then WarnLog " Button Original funktioniert nicht" + ' if Breite.IsEnabled And Hoehe.IsEnabled = False Then PrintLog " Button Original funktioniert" + ' Kacheln.Check + ' setClipboard XOffset.GetText + ' XOffset.More 3 + ' if XOffset.GetText <> GetClipboardText Then PrintLog " Position XOffset funktioniert" + ' if XOffset.GetText = GetClipboardText Then WarnLog " Position XOffset funktioniert nicht" + ' SetClipboard YOffset.GetText + ' YOffset.More 5 + ' if YOffset.GetText <> GetClipboardText Then PrintLog " Position YOffset funktioniert" + ' if YOffset.GetText = GetClipboardText Then WarnLog " Position YOffset funktioniert nicht" + ' PrintLog " TabArea fertig" + Kontext + Active.SetPage TabSchatten + Kontext "TabSchatten" + sleep 1 + printlog "uncheck shadow " + if Anzeigen.IsChecked = True Then Anzeigen.UnCheck + sleep 1 + printlog "check if shadow related controls are disabled with no shadow " + if Entfernung.IsEnabled = False Then + PrintLog " Show shadow works" + else + WarnLog " Show shadow does not work" + end if - Anzeigen.Check '/// check shadow ///' - SetClipboard Entfernung.GetText '/// change distance ///' - Entfernung.More 4 - if GetClipboardText = Entfernung.GetText Then - WarnLog " Distance does not work" - else - PrintLog " Distance does work" - end if - Farbe.Select 5 '/// change shadow color ///' + printlog "check shadow " + Anzeigen.Check + printlog "change distance " + SetClipboard Entfernung.GetText + Entfernung.More 4 + if GetClipboardText = Entfernung.GetText Then + WarnLog " Distance does not work" + else + PrintLog " Distance does work" + end if + printlog "change shadow color " + Farbe.Select 5 - Kontext - Active.SetPage TabFarben - Kontext "TabFarben" - Farbe.Select 24 - sleep 1 - Farbe.Select 18 - sleep 1 - Farbe.Select 7 - Farbname.SetText "Bullshit" '/// change color ///' - Aendern.Click - sleep 1 - TabFarben.OK - FormatArea - Kontext - Active.SetPage TabArea - Kontext "TabArea" - FillOptions.Select 2 - if ColourList.GetSelText = "Bullshit" Then - PrintLog " Color selection changed " - else - WarnLog " Color selection not changed" - end if - Kontext - Active.SetPage TabFarben - Kontext "TabFarben" - Farbmodell.Select 1 + Kontext + Active.SetPage TabFarben + Kontext "TabFarben" + Farbe.Select 24 + sleep 1 + Farbe.Select 18 + sleep 1 + Farbe.Select 7 + printlog "change color " + Farbname.SetText "Bullshit" + Aendern.Click + sleep 1 + TabFarben.OK + FormatArea + Kontext + Active.SetPage TabArea + Kontext "TabArea" + FillOptions.Select 2 + if ColourList.GetSelText = "Bullshit" Then + PrintLog " Color selection changed " + else + WarnLog " Color selection not changed" + end if + Kontext + Active.SetPage TabFarben + Kontext "TabFarben" + Farbmodell.Select 1 - Kontext - Active.SetPage TabFarben '/// test RGB color model ///' - Kontext "TabFarben" - Farbmodell.Select 1 '/// switch to RGB values ///' ' 33:RVB,CMJN - printlog " Selected colourmodel RGB?: "+Farbmodell.GetSelText - if left(Farbmodell.GetSelText,1) <> "R" then warnlog "not RGB selected ? :-(" - try - R.SetText "50" - G.SetText "10" - B.SetText "90" - catch - warnlog "RGB text fields are not enabled :-(" - endcatch - Aendern.Click - TabFarben.OK - Kontext "DocumentDraw" - FormatArea - Kontext - Active.SetPage TabFarben - Kontext "TabFarben" - if (R.GetText = "50" And G.GetText = "10" And B.GetText = "90") Then - PrintLog "Changes in RGB done" - else - WarnLog " Chancges in RGB values not recognized, instead of R=50 , G=10 und B=90 it is " +R.GetText + " " + G.GetText + " " + B.GetText - end if - Farbe.Select 10 - FarbName.SetText "Brighter" '/// add a color ///' - Hinzufuegen.Click - Farbe.Select "Brighter" - Loeschen.Click '/// delete color ///' - Kontext "Active" - Active.Yes - Kontext - Active.SetPage TabFarben - Kontext "TabFarben" - Bearbeiten.Click '/// edit color ///' - Kontext "FarbeDlg" - FarbeDlg.OK - sleep 2 - Kontext - Active.SetPage TabFarben - Kontext "TabFarben" - TabFarben.OK - FormatArea - Kontext - Active.SetPage TabFarben - Kontext "TabFarben" - TabFarben.OK + Kontext + printlog "test RGB color model " + Active.SetPage TabFarben + Kontext "TabFarben" + printlog "switch to RGB values " ' 33:RVB,CMJN + Farbmodell.Select 1 + printlog " Selected colourmodel RGB?: "+Farbmodell.GetSelText + if left(Farbmodell.GetSelText,1) <> "R" then warnlog "not RGB selected ? :-(" + try + R.SetText "50" + G.SetText "10" + B.SetText "90" + catch + warnlog "RGB text fields are not enabled :-(" + endcatch + Aendern.Click + TabFarben.OK + Kontext "DocumentDraw" + FormatArea + Kontext + Active.SetPage TabFarben + Kontext "TabFarben" + if (R.GetText = "50" And G.GetText = "10" And B.GetText = "90") Then + PrintLog "Changes in RGB done" + else + WarnLog " Chancges in RGB values not recognized, instead of R=50 , G=10 und B=90 it is " +R.GetText + " " + G.GetText + " " + B.GetText + end if + Farbe.Select 10 - FormatArea - Kontext - Active.SetPage TabFarbverlaeufe - Kontext "TabFarbverlaeufe" - TabFarbverlaeufe.OK - sleep 2 + FarbName.SetText "Brighter" + printlog "add a color " + Hinzufuegen.Click + Farbe.Select "Brighter" + printlog "delete color " + Loeschen.Click + Kontext "Active" + Active.Yes + Kontext + Active.SetPage TabFarben + Kontext "TabFarben" + printlog "edit color " + Bearbeiten.Click + Kontext "FarbeDlg" + FarbeDlg.OK + sleep 2 + Kontext + Active.SetPage TabFarben + Kontext "TabFarben" + TabFarben.OK + FormatArea + Kontext + Active.SetPage TabFarben + Kontext "TabFarben" + TabFarben.OK + + FormatArea + Kontext + Active.SetPage TabFarbverlaeufe + Kontext "TabFarbverlaeufe" + TabFarbverlaeufe.OK + sleep 2 -FormatArea - sleep 2 - Kontext - Active.SetPage TabTransparenz - Kontext "TabTransparenz" - KeineTransparenz.Check '/// check if controls are disabled if transparence is disabled ///' + FormatArea + sleep 2 + Kontext + Active.SetPage TabTransparenz + Kontext "TabTransparenz" + printlog "check if controls are disabled if transparence is disabled " + KeineTransparenz.Check Printlog "- No transparency is checked, all controls should be disabled." - if MFLinTransparenz.IsEnabled Then Warnlog "- Transparency enabled" - if TransparenzverlaufTyp.IsEnabled Then Warnlog "- Graidient enabled" - if MFZentrumX.IsEnabled Then Warnlog "- Center X enabled" - if MFZentrumY.IsEnabled Then Warnlog "- Center Y enabled" - if MFWinkel.IsEnabled Then Warnlog "- Angle enabled" - if MFRand.IsEnabled Then Warnlog "- Border enabled" - if MFStartwert.IsEnabled Then Warnlog "- Start value enabled" - if MFEndwert.IsEnabled Then Warnlog "- End value enabled" + if MFLinTransparenz.IsEnabled Then Warnlog "- Transparency enabled" + if TransparenzverlaufTyp.IsEnabled Then Warnlog "- Graidient enabled" + if MFZentrumX.IsEnabled Then Warnlog "- Center X enabled" + if MFZentrumY.IsEnabled Then Warnlog "- Center Y enabled" + if MFWinkel.IsEnabled Then Warnlog "- Angle enabled" + if MFRand.IsEnabled Then Warnlog "- Border enabled" + if MFStartwert.IsEnabled Then Warnlog "- Start value enabled" + if MFEndwert.IsEnabled Then Warnlog "- End value enabled" - LineareTransparenz.Check '/// check linear tranparency ///' - Printlog "- Set transparency to linear, all controls should be enabled now" '/// control if related controls are now enabled ///' - sleep 1 - MFLinTransparenz.ToMax '/// change values of controls ///' - if MFLinTransparenz.GetText <>"100%" Then Warnlog "- Maximum value not correct" - MFLinTransparenz.ToMin - if MFLinTransparenz.GetText <>"0%" Then Warnlog "- Minimum value not correct" - if TransparenzverlaufTyp.IsEnabled Then Warnlog "- Gradient enabled" - if MFZentrumX.IsEnabled Then Warnlog "- Centrum X enabled" - if MFZentrumY.IsEnabled Then Warnlog "- Centrum Y enabled" - if MFWinkel.IsEnabled Then Warnlog "- Angle enabled" - if MFRand.IsEnabled Then Warnlog "- Border enabled" - if MFStartwert.IsEnabled Then Warnlog "- Start value enabled" - if MFEndwert.IsEnabled Then Warnlog "- End value enabled" + printlog "check linear tranparency " + LineareTransparenz.Check + Printlog "- Set transparency to linear, all controls should be enabled now" + sleep 1 + printlog "change values of controls " + MFLinTransparenz.ToMax + if MFLinTransparenz.GetText <>"100%" Then Warnlog "- Maximum value not correct" + MFLinTransparenz.ToMin + if MFLinTransparenz.GetText <>"0%" Then Warnlog "- Minimum value not correct" + if TransparenzverlaufTyp.IsEnabled Then Warnlog "- Gradient enabled" + if MFZentrumX.IsEnabled Then Warnlog "- Centrum X enabled" + if MFZentrumY.IsEnabled Then Warnlog "- Centrum Y enabled" + if MFWinkel.IsEnabled Then Warnlog "- Angle enabled" + if MFRand.IsEnabled Then Warnlog "- Border enabled" + if MFStartwert.IsEnabled Then Warnlog "- Start value enabled" + if MFEndwert.IsEnabled Then Warnlog "- End value enabled" - Transparenzverlauf.Check + Transparenzverlauf.Check Printlog "- Gradient for transprency enabled" - if MFLinTransparenz.IsEnabled = "false" Then Warnlog "- Transparency disabled" - if TransparenzverlaufTyp.IsEnabled = "false" Then Warnlog "- Gradient disabled" - if MFZentrumX.IsEnabled = "false" Then Warnlog "- Center X disabled" - if MFZentrumY.IsEnabled = "false" Then Warnlog "- Center Y disabled" - if MFWinkel.IsEnabled = "false" Then Warnlog "- Anlge disabled" - if MFRand.IsEnabled = "false" Then Warnlog "- Border disabled" - if MFStartwert.IsEnabled = "false" Then Warnlog "- Start value disabled" - if MFEndwert.IsEnabled = "false" Then Warnlog "- End value disabled" + if MFLinTransparenz.IsEnabled = "false" Then Warnlog "- Transparency disabled" + if TransparenzverlaufTyp.IsEnabled = "false" Then Warnlog "- Gradient disabled" + if MFZentrumX.IsEnabled = "false" Then Warnlog "- Center X disabled" + if MFZentrumY.IsEnabled = "false" Then Warnlog "- Center Y disabled" + if MFWinkel.IsEnabled = "false" Then Warnlog "- Anlge disabled" + if MFRand.IsEnabled = "false" Then Warnlog "- Border disabled" + if MFStartwert.IsEnabled = "false" Then Warnlog "- Start value disabled" + if MFEndwert.IsEnabled = "false" Then Warnlog "- End value disabled" Printlog "- Check if changed values are saved" - Zaehler=TransparenzverlaufTyp.GetItemCount - for i=1 to Zaehler - TransparenzverlaufTyp.Select i - SetClipboard Transparenzverlauftyp.GetSelText - TabTransparenz.OK - sleep 2 + Zaehler=TransparenzverlaufTyp.GetItemCount + for i=1 to Zaehler + TransparenzverlaufTyp.Select i + SetClipboard Transparenzverlauftyp.GetSelText + TabTransparenz.OK + sleep 2 + FormatArea + sleep 1 + Kontext + printlog "check if values are saved after closing and reopening dialog " + Active.SetPage TabTransparenz + Kontext "TabTransparenz" + if not Transparenzverlauftyp.GetSelIndex = i Then Warnlog "- Values are not correct for gradient transparency" + next i + TransparenzverlaufTyp.Select 2 + if MFZentrumX.IsEnabled Then Warnlog "- Center X should not be enabled" + if MFZentrumY.IsEnabled Then Warnlog "- Center Y should not be enabled" + MFWinkel.SetText "45" + Winkel_1 = MFWinkel.GetText + TabTransparenz.OK + sleep 2 FormatArea - sleep 1 - Kontext - Active.SetPage TabTransparenz '/// check if values are saved after closing and reopening dialog ///' - Kontext "TabTransparenz" - if not Transparenzverlauftyp.GetSelIndex = i Then Warnlog "- Values are not correct for gradient transparency" - next i - TransparenzverlaufTyp.Select 2 - if MFZentrumX.IsEnabled Then Warnlog "- Center X should not be enabled" - if MFZentrumY.IsEnabled Then Warnlog "- Center Y should not be enabled" - MFWinkel.SetText "45" - Winkel_1 = MFWinkel.GetText - TabTransparenz.OK - sleep 2 - FormatArea - sleep 2 - Kontext - Active.SetPage TabTransparenz - Kontext "TabTransparenz" + sleep 2 + Kontext + Active.SetPage TabTransparenz + Kontext "TabTransparenz" if TransparenzverlaufTyp.GetSelIndex <>2 Then - Warnlog "- Second menu-item is not choosen" + Warnlog "- Second menu-item is not choosen" end if TransparenzverlaufTyp.Select 3 - if MFWinkel.GetText <> Winkel_1 then Warnlog "- The inserted value is not accepted" - if MFWinkel.GetText <> Winkel_1 Then TransparenzverlaufTyp.Select 3 - if MFWinkel.IsEnabled Then Warnlog " - Angle should not be active when Radial is choosen" + if MFWinkel.GetText <> Winkel_1 then Warnlog "- The inserted value is not accepted" + if MFWinkel.GetText <> Winkel_1 Then TransparenzverlaufTyp.Select 3 + if MFWinkel.IsEnabled Then Warnlog " - Angle should not be active when Radial is choosen" sleep 1 MFZentrumX.SetText "30" MFZentrumY.SetText "30" @@ -384,8 +421,8 @@ FormatArea Kontext Active.SetPage TabTransparenz Kontext "TabTransparenz" - if MFZentrumX.GetText <> "30%" Then Warnlog "- Setted value for Center X is not applied." - if MFZentrumY.GetText <> "30%" Then Warnlog "- Setted value for Center Y is not applied." + if MFZentrumX.GetText <> "30%" Then Warnlog "- Setted value for Center X is not applied." + if MFZentrumY.GetText <> "30%" Then Warnlog "- Setted value for Center Y is not applied." MFRand.SetText "10" MFStartwert.SetText "20" MFEndwert.SetText "30" @@ -396,12 +433,13 @@ FormatArea Kontext Active.SetPage TabTransparenz Kontext "TabTransparenz" - if MFRand.GetText <> "10%" Then Warnlog "- Border-value was not set." - if MFEndwert.GetText <> "30%" Then Warnlog "- End-value was not set." - if MFStartwert.GetText <> "20%" Then Warnlog "- Start-value was not set." + if MFRand.GetText <> "10%" Then Warnlog "- Border-value was not set." + if MFEndwert.GetText <> "30%" Then Warnlog "- End-value was not set." + if MFStartwert.GetText <> "20%" Then Warnlog "- Start-value was not set." TabTransparenz.OK - Call hCloseDocument '/// close document ///' + printlog "close document " + Call hCloseDocument endcase 'tdFormatArea1 diff --git a/testautomation/graphics/optional/includes/global/g_arrangealign.inc b/testautomation/graphics/optional/includes/global/g_arrangealign.inc index 48c6599efa72..29557214638b 100644 --- a/testautomation/graphics/optional/includes/global/g_arrangealign.inc +++ b/testautomation/graphics/optional/includes/global/g_arrangealign.inc @@ -32,12 +32,22 @@ '\****************************************************************************** testcase tiDatei_Fuer_Anordnen_Erstellen - dim sTemp as string - dim i as integer - dim zaehler as integer - '/// This function creates the document, that will be used as reference and working object inthe following cases :-) ///' - '///'Dim Datei ' somewhere global :-) defined in calling sub! :sub im_107c_ /// - call hNewDocument + dim sTemp as string + dim i as integer + dim zaehler as integer + '/// This function creates the document, that will be used as reference and working object inthe following cases :-) ///' + '///'Dim Datei ' somewhere global :-) defined in calling sub! :sub im_107c_ /// + call hNewDocument + if gApplication = "DRAW" then + kontext "DocumentDraw" + DocumentDraw.UseMenu + else + kontext "DocumentImpress" + DocumentImpress.UseMenu + end if + + hMenuSelectNr(4) + hMenuSelectNr(13) call sSelectEmptyLayout '/// new document ///' if Dir(Datei)<>"" then app.Kill(Datei) ' kill old file for Zaehler = 1 to 3 '/// create 3 overlapping objects ///' diff --git a/testautomation/graphics/optional/includes/global/g_autocorrection.inc b/testautomation/graphics/optional/includes/global/g_autocorrection.inc index 731c9e0ed21f..42e3bc745ab4 100644 --- a/testautomation/graphics/optional/includes/global/g_autocorrection.inc +++ b/testautomation/graphics/optional/includes/global/g_autocorrection.inc @@ -38,13 +38,6 @@ '* '\******************************************************************* -' Tools->Autocorrect... -' Replace; Exceptions; Options; Custom Quotes -' these are Language -' dependant in the -' listbox above!! -' box only enabled, if the both tabpages are selected ... - testcase tToolsAutocorrectReplace dim i as integer @@ -76,7 +69,9 @@ testcase tToolsAutocorrectReplace TabErsetzung.OK hCloseDocument -endcase +endcase 'tToolsAutocorrectReplace + +'------------------------------------------------------------------------------- testcase tToolsAutocorrectExceptions dim i as integer @@ -119,9 +114,10 @@ testcase tToolsAutocorrectExceptions TabAusnahmen.OK hCloseDocument -endcase +endcase 'tToolsAutocorrectExceptions '------------------------------------------------------------------------------- + testcase tToolsAutocorrectCustomQuotes(bSimple as boolean) ' bSinple = true: use simple quotes ;; else Double Quotes @@ -151,8 +147,6 @@ testcase tToolsAutocorrectCustomQuotes(bSimple as boolean) warnlog "The language-file was not found or accessible! The test ends." goto endsub endif - - 'HDE has same problems in w_106a.inc ;-) !!! migrate ?!?! ///' Call hNewDocument hFileOpen sFileName @@ -381,7 +375,7 @@ testcase tToolsAutocorrectCustomQuotes(bSimple as boolean) sleep 1 hCloseDocument -endcase +endcase 'tToolsAutocorrectCustomQuotes '------------------------------------------------------------------------------- testcase tToolsAutocorrectOption @@ -455,6 +449,6 @@ testcase tToolsAutocorrectOption hCloseDocument sleep 1 -endcase +endcase 'tToolsAutocorrectOption -'------------------------------------------------------------------------------- +'-------------------------------------------------------------------------------
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_character.inc b/testautomation/graphics/optional/includes/global/g_character.inc index a9d578665c5a..8d58263c74d4 100644 --- a/testautomation/graphics/optional/includes/global/g_character.inc +++ b/testautomation/graphics/optional/includes/global/g_character.inc @@ -42,44 +42,46 @@ testcase tFormatCharacter dim sTemp as string dim iTemp as integer - '/// open application ///' + printlog "open application " Call hNewDocument sleep 1 - '/// create a textframe with content ///' + printlog "create a textframe with content " hTextrahmenErstellen ("This is a check, a check, a check.",10,10,60,30) - '/// type with keys [strg]+[home] [shift]+[end] to select the inserted text ///' + printlog "type with keys [strg]+[home] [shift]+[end] to select the inserted text " hTypeKeys "<MOD1 HOME><shift end>" sleep 1 - '/// Format->Character ///' + printlog "Format->Character " FormatCharacter - sleep 1 - '/// switch to tabpage 'Font' ///' - Kontext - Messagebox.SetPage TabFont - Kontext "TabFont" - sleep 1 - - '/// switch to tabpage 'Font Effects' ///' - Kontext - Messagebox.SetPage TabFontEffects - kontext "TabFontEffects" - sleep 1 - - '/// switch to tabpage 'Position' ///' - Kontext - Messagebox.SetPage TabFontPosition - Kontext "TabFontPosition" - sleep 1 - - '/// close dialog 'Character' with 'OK' ///' - TabFontPosition.OK - '/// close application ///' + sleep 1 + printlog "switch to tabpage 'Font' " + Kontext + Messagebox.SetPage TabFont + Kontext "TabFont" + sleep 1 + + printlog "switch to tabpage 'Font Effects' " + Kontext + Messagebox.SetPage TabFontEffects + kontext "TabFontEffects" + sleep 1 + + printlog "switch to tabpage 'Position' " + Kontext + Messagebox.SetPage TabFontPosition + Kontext "TabFontPosition" + sleep 1 + + printlog "close dialog 'Character' with 'OK' " + TabFontPosition.OK + printlog "close application " Call hCloseDocument endcase 'tFormatCharacter + '--------------------------------------------------------- + testcase tDialogCharacter Dim i as integer @@ -101,11 +103,13 @@ testcase tDialogCharacter ToolsOptions hToolsOptions ( "LanguageSettings", "Languages" ) - if Aktivieren.IsChecked then '/// Check in what state Asian support is ///' + printlog "Check in what state Asian support is " + if Aktivieren.IsChecked then Asiansupportsetting = TRUE else + printlog "Activate if not already activated " Asiansupportsetting = FALSE - Aktivieren.Check '/// Activate if not already activated ///' + Aktivieren.Check end if Kontext "ExtrasOptionenDlg" @@ -118,8 +122,8 @@ testcase tDialogCharacter FormatCharacter sleep 1 - Kontext '"Active" ' insert this, perhaps another - Active.SetPage TabFont ' tabpage is active at open + Kontext '"Active" + Active.SetPage TabFont Kontext "TabFont" CountOfThem = FontWest.GetItemCount for y = 1 to CountOfThem @@ -275,12 +279,14 @@ testcase tDialogCharacter next y Kontext - Active.SetPage TabFontPosition '/// Changes the active tab to "Position" + printlog "Changes the active tab to Position" + Active.SetPage TabFontPosition Kontext "TabFontPosition" printlog "TabFontPosition" SuperScript.Check Super.Check - RelativeFontSize.ToMin '/// Testing the "Relative Font Size"-Listbox + printlog "Testing the Relative Font Size-Listbox" + RelativeFontSize.ToMin ThisIsMyTextFromControl = RelativeFontSize.GetText ' printlog "The Relative Font Size minimum is: " & ThisIsMyTextFromControl for y = 1 to 99 @@ -290,7 +296,8 @@ testcase tDialogCharacter next y Automatic.Check - ScaleWith.ToMin '/// Testing the "Scale With"-Listbox + printlog "Testing the Scale With-Listbox" + ScaleWith.ToMin ThisIsMyTextFromControl = ScaleWith.GetText printlog "ScaleWith minimum is:" & ThisIsMyTextFromControl ' ScaleWith.TypeKeys "<TAB>" @@ -303,8 +310,10 @@ testcase tDialogCharacter Normal.Check Subscript.Check - RelativeFontSize.ToMin '/// Testing the "Reliative Font Size"-Listbox again but this time - ThisIsMyTextFromControl = RelativeFontSize.GetText '/// with "Subscript" and "Normal" Checked + printlog "Testing the Reliative Font Size-Listbox again but this time" + RelativeFontSize.ToMin + printlog "with Subscript and Normal Checked" + ThisIsMyTextFromControl = RelativeFontSize.GetText printlog "The Relative Font Size minimum is: " & ThisIsMyTextFromControl for y = 1 to 99 RelativeFontSize.TypeKeys "<UP>" @@ -314,7 +323,8 @@ testcase tDialogCharacter Automatic.Check - ScaleWith.ToMin '/// Testing the "ScaleWith"-Listbox + printlog "Testing the ScaleWith-Listbox" + ScaleWith.ToMin ThisIsMyTextFromControl = ScaleWith.GetText printlog "The ScaleWith Size is: " & ThisIsMyTextFromControl for y = 1 to 100 @@ -323,13 +333,15 @@ testcase tDialogCharacter ' printlog "The ScaleWith Size is: " & ThisIsMyTextFromControl next y - ThisIsMyTextFromControl = Spacing.GetSelText '/// Testing the "Spacing"-ListBox + printlog "Testing the Spacing-ListBox" + ThisIsMyTextFromControl = Spacing.GetSelText printlog "The Spacing is first: " & ThisIsMyTextFromControl for y = 2 to 3 Spacing.Select y ThisIsMyTextFromControl = Spacing.GetSelText printlog "The Spacing is: " & ThisIsMyTextFromControl - ThisIsMyTextFromControl = SpacingBy.GetText '/// Testing the "Spacing By"-Scrollbox + printlog "Testing the Spacing By-Scrollbox" + ThisIsMyTextFromControl = SpacingBy.GetText ' printlog "The SpacingBy Size minimum is: " & ThisIsMyTextFromControl SpacingBy.ToMin for z = 1 to 4 @@ -347,7 +359,8 @@ testcase tDialogCharacter kontext ToolsOptions hToolsOptions ( "LanguageSettings", "Languages" ) - Aktivieren.UnCheck '/// Deactivate if not already deactivated ///' + printlog "Deactivate if not already deactivated " + Aktivieren.UnCheck Printlog "Reseted the Asiansupport-value to it's original state" Kontext "ExtrasOptionenDlg" @@ -385,41 +398,41 @@ testcase tSetFormatCharacter end if sFile = convertPath(gTesttoolpath + "graphics\required\input\spellb_" + iSprache + "."+ExtensionString) - '/// create document, if it doesn't exist, else skip this case :-) ///' + printlog "create document, if it doesn't exist, else skip this case :-) " if (dir(sFile)="") then - '/// open application ///' + printlog "open application " Call hNewDocument - '/// activate all languages in options ///' - '///+ Tools->Options ///' + printlog "activate all languages in options " + '///+ Tools->Options " ToolsOptions - '///+ select tabpage 'Languages' from set 'Language Settings' ///' + '///+ select tabpage 'Languages' from set 'Language Settings' " hToolsOptions("LANGUAGESETTINGS","Languages") kontext "TabSprachen" - '///+ save state and check checkbox 'Asian languages support' ///' - '/// if the language is Asian, skip this part ///' + '///+ save state and check checkbox 'Asian languages support' " + printlog "if the language is Asian, skip this part " printlog "iSprache = " + iSprache if bAsianLan = FALSE then bAsian = Aktivieren.isEnabled Aktivieren.check endif - '///+ save state and check checkbox 'Complex text layout (CTL) support' ///' + '///+ save state and check checkbox 'Complex text layout (CTL) support' " bComplex = ComplexScriptEnabled.isEnabled ComplexScriptEnabled.check - '///+ close dialog 'Options' with OK ///' + '///+ close dialog 'Options' with OK " Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK - '/// get count of languages ///' - '///+ Format->Character ///' + printlog "get count of languages " + '///+ Format->Character " FormatCharacter sleep 1 Kontext - '///+ switch to tabpage 'Font' ///' + '///+ switch to tabpage 'Font' " Messagebox.SetPage TabFont kontext "TabFont" sleep 1 - '///+ get count of languages for Western/Asian/CTL fonts ///' + '///+ get count of languages for Western/Asian/CTL fonts " iWest = LanguageWest.getItemCount iAsian = LanguageEast.getItemCount iComplex = LanguageCTL.getItemCount @@ -456,39 +469,39 @@ testcase tSetFormatCharacter Printlog "CTL font languages count : " + iComplex endif endif - '///+ close dialog 'Character' with OK ///' + printlog "close dialog 'Character' with OK " TabFont.Ok WL_SD_TextEinfuegenDraw gMouseMove ( 1, 1, 100, 100 ) - '///+ print the language counts into the first line of the document ///' + printlog "print the language counts into the first line of the document " hTypeKeys(" "+iWest+" "+iAsian+" "+iComplex+"<return>") - '/// set all languages to '[None]' ///' - '///+ Format->Character ///' + printlog "set all languages to '[None]' " + printlog "Format->Character " FormatCharacter kontext "TabFont" - '///+ select '[None]' (should be the first entry in every listbox) ///' + printlog "select '[None]' (should be the first entry in every listbox) " LanguageWest.select 1 LanguageEast.select 1 LanguageCTL.select 1 - '///+ close dialog 'Character' with OK ///' + printlog "close dialog 'Character' with OK " TabFont.Ok - '/// print one line with language formated text for every language ///' + printlog "print one line with language formated text for every language " for i = 1 to iWest - '///+ Format->Character ///' + printlog "Format->Character " FormatCharacter kontext "TabFont" - '///+ select the next language ///' + printlog "select the next language " LanguageWest.select i sTemp = LanguageWest.getItemText (i) ListAppend(sLanguage(), sTemp) - '///+ close dialog 'Character' with OK ///' + printlog "close dialog 'Character' with OK " TabFont.Ok - '///+ type [return][number of language in list][Tab][Language name][Tab] ///' + printlog "type [return][number of language in list][Tab][Language name][Tab] " hTypeKeys(""+i+"<tab>"+sTemp+"<tab><return>") next i @@ -528,7 +541,7 @@ testcase tSetFormatCharacter hTypeKeys(""+i+"<tab>"+sTemp+"<tab><return>") next i - '/// save the created document & the languages list if they don't exists ///' + printlog "save the created document & the languages list if they don't exists " hFileSaveAs (sFile) qaErrorLog "Created file. Please check it and then commit it! " + sTemp sTemp = convertPath(gTesttoolpath + "graphics\required\input\spellb_" + iSprache + ".txt") @@ -536,29 +549,29 @@ testcase tSetFormatCharacter ListWrite(sLanguage(), sTemp,"utf8") endif - '/// restore the options ///' - '///+ Tools->Options ///' + printlog "restore the options " + printlog "Tools->Options " ToolsOptions - '///+ select tabpage 'Languages' from set 'Language Settings' ///' + printlog "select tabpage 'Languages' from set 'Language Settings' " hToolsOptions("LANGUAGESETTINGS","Languages") kontext "TabSprachen" - '///+ restore state of checkbox 'Asian languages support' ///' - '/// if the language is Asian, skip this part ///' + printlog "restore state of checkbox 'Asian languages support' " + printlog "if the language is Asian, skip this part " if bAsianLan = FALSE then if (bAsian <> TRUE) then Aktivieren.UNcheck endif endif - '///+ restore state of checkbox 'Complex text layout (CTL) support' ///' + printlog "restore state of checkbox 'Complex text layout (CTL) support' " if (bComplex <> TRUE) then ComplexScriptEnabled.UNcheck endif - '///+ close dialog 'Options' with OK ///' + printlog "close dialog 'Options' with OK " Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK - '/// close application ///' + printlog "close application " Call hCloseDocument endif @@ -586,29 +599,29 @@ testcase tGetFormatCharacter ExtensionString = "odg" end if - '/// open the english document with all languages ///' + printlog "open the english document with all languages " hDateiOeffnen (convertPath(gTesttoolpath + "graphics\required\input\spellb_" + iSprache + "."+ExtensionString) ListRead(sLanguageR(), convertPath(gTesttoolpath + "graphics\required\input\spellb_1.txt"),"utf8") - '/// activate all languages in options ///' - '///+ Tools->Options ///' + printlog "activate all languages in options " + printlog " Tools->Options " ToolsOptions - '///+ select tabpage 'Languages' from set 'Language Settings' ///' + printlog "select tabpage 'Languages' from set 'Language Settings' " hToolsOptions("LANGUAGESETTINGS","Languages") kontext "TabSprachen" - '///+ save state and check checkbox 'Asian languages support' ///' + printlog "save state and check checkbox 'Asian languages support' " bAsian = Aktivieren.isEnabled Aktivieren.check - '///+ save state and check checkbox 'Complex text layout (CTL) support' ///' + printlog "save state and check checkbox 'Complex text layout (CTL) support' " bComplex = ComplexScriptEnabled.isEnabled ComplexScriptEnabled.check - '///+ close dialog 'Options' with OK ///' + printlog "close dialog 'Options' with OK " Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK sleep (1) - '/// get count of languages ///' + printlog "get count of languages " hTypeKeys("<tab><f2>") - '///+ first how many are in the reference document (printed in the first line)///' + printlog "first how many are in the reference document (printed in the first line)" hTypeKeys("<mod1 home><shift end>") sleep (1) editcopy @@ -619,15 +632,15 @@ testcase tGetFormatCharacter iAsian(1) = mid(sTemp, iTemp+1, iTemp-i) iComplex(1) = right(sTemp, Len(sTemp) - i) sleep (1) - '///+ Format->Character ///' + printlog "Format->Character " FormatCharacter sleep 1 Kontext - '///+ switch to tabpage 'Font' ///' + printlog "switch to tabpage 'Font' " Messagebox.SetPage TabFont kontext "TabFont" sleep 1 - '///+ get count of languages for Western/Asian/CTL fonts ///' + printlog "get count of languages for Western/Asian/CTL fonts " iWest(2) = LanguageWest.getItemCount iAsian(2) = LanguageEast.getItemCount iComplex(2) = LanguageCTL.getItemCount @@ -646,10 +659,10 @@ testcase tGetFormatCharacter else Printlog "CTL font languages count : " + iComplex(2) endif - '///+ close dialog 'Character' with OK ///' + printlog "close dialog 'Character' with OK " TabFont.Ok - '/// write the language for every line in the current language ///' + printlog "write the language for every line in the current language " hTypeKeys("<mod1 home><down><home>") for i = 1 to iWest(2) FormatCharacter @@ -659,7 +672,7 @@ testcase tGetFormatCharacter sTemp = LanguageWest.getSelText ListAppend(sLanguage(), sTemp) TabFont.Ok - '///+ type [end][number of language in list][Tab][Language name][down][home] ///' + printlog "type [end][number of language in list][Tab][Language name][down][home] " hTypeKeys("<end>"+iTemp+"<tab>"+sTemp+"<down><home>") next i @@ -685,7 +698,7 @@ testcase tGetFormatCharacter hTypeKeys("<end>"+iTemp+"<tab>"+sTemp+"<down><home>") next i - '/// save the created document & the languages list ///' + printlog "save the created document & the languages list " sTemp = convertPath(gOfficePath + "user\work\spellb_" + iSprache) hFileSaveAsKill (sTemp) sTemp = convertPath(gOfficePath + "user\work\spellb_" + iSprache + ".txt") @@ -709,6 +722,6 @@ testcase tGetFormatCharacter endif next i - '/// close application ///' + printlog "close application " Call hCloseDocument endcase 'tGetFormatCharacter diff --git a/testautomation/graphics/optional/includes/global/g_clipboard.inc b/testautomation/graphics/optional/includes/global/g_clipboard.inc index e2ee473df88f..70b387581329 100644 --- a/testautomation/graphics/optional/includes/global/g_clipboard.inc +++ b/testautomation/graphics/optional/includes/global/g_clipboard.inc @@ -46,7 +46,7 @@ testcase tiEditUndo dim sTestfile as string dim sLocaltestfile as string - if ( gApplication = "IMPRESS" ) then + if (gApplication = "IMPRESS") then ExtensionString = "odp" else ExtensionString = "odg" @@ -70,6 +70,7 @@ testcase tiEditUndo Kontext "TabPositionAndSize" printlog "defining variable for original position of object" Ueber_Text_1=PositionX.GetText + printlog "Position X is: " & Ueber_Text_1 printlog "Canceling dialog." TabPositionAndSize.Cancel sleep 2 @@ -95,13 +96,15 @@ testcase tiEditUndo Kontext Messagebox.SetPage TabPositionAndSize Kontext "TabPositionAndSize" - if PositionX=0 Then Warnlog "Command was not completely executed, and it could not be undone." + printlog "Position X is: " & PositionX.GetText + if (PositionX.GetText)=0 Then Warnlog "Command was not completely executed, and it could not be undone." TabPositionAndSize.Cancel sleep 2 gMouseClick 60,60 sleep 1 + printlog "Edit Undo for BringBackward" - EditUndo + EditUndo Sleep 2 gMouseClick 60,60 sleep 1 @@ -113,7 +116,7 @@ testcase tiEditUndo Kontext "Toolbar" Auswahl.Click printlog "Again checking position using Position and Size dialog" - ContextPositionAndSize + ContextPositionAndSize kontext Messagebox.SetPage TabPositionAndSize kontext "TabPositionAndSize" @@ -135,7 +138,10 @@ testcase tiEditUndo endif Call hCloseDocument -endcase + printlog "Close document" + Call hCloseDocument + +endcase 'tiEditUndo '------------------------------------------------------------------------------- testcase tiEditRedo @@ -150,8 +156,9 @@ testcase tiEditRedo end if Datei$ = gTesttoolPath + "graphics\required\input\leer."+ExtensionString - - hFileOpen ConvertPath (Datei$) '/// Open test document (leer.od?) ///' + + printlog "Open test document (leer.od?)" + hFileOpen ConvertPath (Datei$) sleep 3 ' check if the document is writable if fIsDocumentWritable = false then @@ -176,7 +183,8 @@ testcase tiEditRedo sleep 1 hTypeKeys "<TAB>" sleep 1 - ContextArrangeBringBackward '/// move object behind other object ///' + printlog "move object behind other object" + ContextArrangeBringBackward sleep 1 gMouseClick 60,60 sleep 1 @@ -185,25 +193,29 @@ testcase tiEditRedo ContextPositionAndSize sleep 1 Kontext - Messagebox.SetPage TabPositionAndSize '/// checking new position values ///' + printlog "checking new position values" + Messagebox.SetPage TabPositionAndSize Kontext "TabPositionAndSize" if PositionX.GetText = Ueber_Text_1 Then Warnlog " Nothing changed, so nothing can be undone" TabPositionAndSize.Cancel sleep 1 gMouseClick 60,60 - EditUndo '/// Edit Undo///' + printlog "Edit Undo" + EditUndo sleep 1 hTypeKeys "<TAB>" sleep 1 ContextPositionAndSize sleep 1 kontext - Messagebox.SetPage TabPositionAndSize '/// checking again position ///' + printlog "checking again position" + Messagebox.SetPage TabPositionAndSize kontext "TabPositionAndSize" if PositionX.GetText <> Ueber_Text_1 Then Warnlog " Undo didn't worked, so repeat last action wont work either" TabPositionAndSize.Cancel sleep 2 - EditRedo '/// Edit Redo ///' + printlog "Edit Redo" + EditRedo sleep 2 gMouseClick 60,60 sleep 2 @@ -214,16 +226,18 @@ testcase tiEditRedo kontext Messagebox.SetPage TabPositionAndSize kontext "TabPositionAndSize" - if PositionX.GetText <> Ueber_Text_1 then '/// checking position ///' + printlog "checking position" + if PositionX.GetText <> Ueber_Text_1 then printlog "Action Undo repeated" else warnlog "Action Undo not repeated" end if TabPositionAndSize.OK sleep 1 - call hCloseDocument '/// close document ///' + printlog "close document" + call hCloseDocument sleep 1 -endcase +endcase 'tiEditRedo '------------------------------------------------------------------------------- testcase tiEditClipboard @@ -231,61 +245,63 @@ testcase tiEditClipboard Dim Ueber_Text_4 as string dim sTemp as string - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout sleep 1 SetClipboard "" - '/// Create rectangle ///' + printlog "Create rectangle" Call hRechteckErstellen ( 65, 65, 80, 80 ) sleep 1 - '///+ RightClick onto rectangle///' + printlog "RightClick onto rectangle" gMouseClick 70,70 sleep 1 - Ueber_Text_4 = fGetPositionX() '/// Get values for position variables ///' + printlog "Get values for position variables" + Ueber_Text_4 = fGetPositionX() Sleep 1 - '/// <b> Edit->Copy </b> ///' + printlog "<b> Edit->Copy </b>" EditCopy - '///+ Type Key [Deletee] ///' + '///+ Type Key [Deletee]" hTypeKeys "<DELETE>" - '///+ <i> Edit->Paste </i> ///' + '///+ <i> Edit->Paste </i>" EditPaste sleep 1 - '///+ Edit->Select All ///' + '///+ Edit->Select All" EditSelectAll sTemp = fGetPositionX() - if LiberalMeasurement(sTemp, Ueber_Text_4) then '/// TabPositionAndSize: comparing position with original position ///' + printlog "TabPositionAndSize: comparing position with original position" + if LiberalMeasurement(sTemp, Ueber_Text_4) then printlog "OK EditCopy and EditPaste" else warnlog "- Edit paste did not work; is: '" + sTemp + "' ; should: '" + Ueber_Text_4 + "'" end if sleep 1 - '/// Type Keys [escape], + EditSelectAll (to deselect object and to select again) ///' + printlog "Type Keys [escape], + EditSelectAll (to deselect object and to select again)" hTypeKeys "<escape>" EditSelectAll sleep 2 - '/// <b> Edit->Cut </b>///' + printlog "<b> Edit->Cut" EditCut sleep 1 hTypeKeys "<TAB>" try - '///+ - Format->Position And Size -> HAS TO FAIL / IS NOT AVAILABLE !!! '///' + printlog "Format->Position And Size -> HAS TO FAIL / IS NOT AVAILABLE !!! " ContextPositionAndSize kontext - '///+ - select TabPage 'Position And Size' ///' + printlog "select TabPage 'Position And Size'" Messagebox.SetPage TabPositionAndSize Kontext "TabPositionAndSize" if TabPositionAndSize.NOTexists then warnlog "TabPositionAndSize isn't up ?!!" endif - '///+ - Ok dialog 'Position And Size' ///' + printlog "Ok dialog 'Position And Size'" TabPositionAndSize.Ok warnlog "TabPositionAndSize IS up :-( Doesn't have to be, because object should be deleted !!!" catch Printlog " - There is no object in the document anymore :-)" endcatch sleep 1 - '///+ <i> Edit->Paste </i> ///' + printlog "Edit->Paste" EditPaste sleep 2 sTemp = fGetPositionX() @@ -295,9 +311,9 @@ testcase tiEditClipboard warnlog "- Edit paste did not work; is: '" + sTemp + "' ; should: '" + Ueber_Text_4 + "'" end if sleep 3 - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiEditClipboard '------------------------------------------------------------------------------- testcase tiEditPasteSpecial_HTML @@ -305,7 +321,8 @@ testcase tiEditPasteSpecial_HTML dim Zaehler as integer Kontext "Standardbar" sleep 1 - Call hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\frame1.htm") '/// Load html document ///' + printlog "Load html document" + Call hFileOpen ConvertPath (gTesttoolPath + "graphics\required\input\frame1.htm") sleep 5 autoexecute=false Kontext "DocumentWriter" @@ -314,49 +331,61 @@ testcase tiEditPasteSpecial_HTML autoexecute=true EditSelectAll sleep 3 - EditCopy '/// Copy selection ///' + printlog "Copy selection" + EditCopy Sleep 2 - FileClose '/// Close document ///' + printlog "Close document" + FileClose sleep 3 - Call hNewDocument '/// Create new Impress document ///' + printlog "Create new Impress document" + Call hNewDocument sleep 1 - EditPasteSpecial '/// Edit paste special ///' + printlog "Edit paste special" + EditPasteSpecial sleep 1 Kontext "InhaltEinfuegen" For Zaehler = 1 to Auswahl.GetItemCount Auswahl.select Zaehler printlog Zaehler, ". Selection = ", Auswahl.GetSelText next Zaehler - - if Auswahl.GetItemCount <> 4 then '/// Controlling number of possible formats ///' + + printlog "Controlling number of possible formats" + if Auswahl.GetItemCount <> 4 then warnlog "formats for inserting Html <> 4" else printlog "OK 4 formats for HTML-Document" end if sleep 3 - InhaltEinfuegen.OK '/// Paste clipboard content ///' + printlog "Paste clipboard content" + InhaltEinfuegen.OK sleep 3 try - EditCopy '/// Copy object back into clipboard ///' + printlog "Copy object back into clipboard" + EditCopy catch Warnlog "- Nothing inserted into document" endcatch sleep 3 - Call hCloseDocument '/// Close document ///' + printlog "Close document" + Call hCloseDocument sleep 3 -endcase +endcase 'tiEditPasteSpecial_HTML '------------------------------------------------------------------------------- testcase tdEditPasteSpecial_Text printlog "Insert Text" - call hNewDocument '/// new document ///' - SetClipboard "I am a cool test-text in the Clipboard" '/// put text into clipboard ///' - EditPasteSpecial '/// edit paste special ///' + printlog "new document " + call hNewDocument + printlog "put text into clipboard" + SetClipboard "I am a cool test-text in the Clipboard" + printlog "edit paste special" + EditPasteSpecial sleep 1 Kontext "InhaltEinfuegen" - Auswahl.Select 1 '/// select list entree 1 ///' + printlog "select list entree 1" + Auswahl.Select 1 printlog "Selection = ", Auswahl.GetSelText sleep 1 if Auswahl.GetItemCount <> 1 then @@ -364,53 +393,64 @@ testcase tdEditPasteSpecial_Text else printlog "Format Text OK" end if - InhaltEinfuegen.OK '/// close dialog ///' + printlog "close dialog" + InhaltEinfuegen.OK sleep 1 - - Call hCloseDocument '/// close document ///' -endcase + + printlog "close document" + Call hCloseDocument +endcase 'tdEditPasteSpecial_Text '------------------------------------------------------------------------------- testcase tdEditPasteSpecial_Graphic dim Zaehler as integer - - call hNewDocument '/// ^new document ///' + + printlog "new document " + call hNewDocument printlog "Insert graphic file" - InsertGraphicsFromFile '/// insert graphic (sample.bmp)///' + InsertGraphicsFromFile Kontext "GrafikEinfuegenDlg" - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") - Oeffnen.Click + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") + Oeffnen.Click sleep 1 - EditSelectAll '/// select graphic ///' - EditCut '/// cut graphic ///' - EditPasteSpecial '/// edit paste special ///' + printlog "select graphic" + EditSelectAll + printlog "cut graphic" + EditCut + printlog "edit paste special" + EditPasteSpecial sleep 1 Kontext "InhaltEinfuegen" - For Zaehler = 1 to Auswahl.GetItemCount '/// get item count for Auswahl ///' + printlog "get item count for Auswahl" + For Zaehler = 1 to Auswahl.GetItemCount Auswahl.select Zaehler printlog Zaehler, ". Selection = ", Auswahl.GetSelText next Zaehler - - if Auswahl.GetItemCount <> 4 then '/// check if item count = 4 ///' + + printlog "check if item count = 4" + if Auswahl.GetItemCount <> 4 then warnlog "Format for insert graphic files should be 4, but is: " + Auswahl.GetItemCount else printlog "There are " + Auswahl.GetItemCount + " formats for graphic files" end if - InhaltEinfuegen.OK '/// insert graphic from clipboard ///' + printlog "insert graphic from clipboard" + InhaltEinfuegen.OK gMouseClick 90,90 sleep 1 - Call hCloseDocument '/// close document ///' -endcase + printlog "close document " + Call hCloseDocument +endcase 'tdEditPasteSpecial_Graphic '------------------------------------------------------------------------------- testcase tdEditPasteSpecial_Circle - dim Zaehler as integer - call hNewDocument '/// new document ///' + dim Zaehler as integer + printlog "new document " + call hNewDocument sleep 5 - printlog "Insert circle" '/// create circle ///' + printlog "Insert circle" Kontext "Toolbar" Ellipsen.Click sleep 3 @@ -418,28 +458,36 @@ testcase tdEditPasteSpecial_Circle sleep 1 hTypeKeys "<escape>" sleep 2 - EditSelectAll '/// select circle ///' + printlog "select circle" + EditSelectAll sleep 5 - EditCut '/// cut circle ///' + printlog "cut circle" + EditCut sleep 1 - EditPasteSpecial '/// edit paste special ///' + printlog "edit paste special" + EditPasteSpecial sleep 1 Kontext "InhaltEinfuegen" - if EinfuegenAls.IsVisible Then EinfuegenAls.Check '/// check "EinfuegenAls" ///' - For Zaehler = 1 to Auswahl.GetItemCount '/// get item count for Auswahl ///' + printlog "check Insert as.." + if EinfuegenAls.IsVisible Then EinfuegenAls.Check + printlog "get item count for Auswahl" + For Zaehler = 1 to Auswahl.GetItemCount Auswahl.select Zaehler printlog Zaehler, ". Selection = ", Auswahl.GetSelText next Zaehler - if Auswahl.GetItemCount <> 4 then '/// check if item count = 4 ///' + printlog "check if item count = 4" + if Auswahl.GetItemCount <> 4 then warnlog "Number of possible formats <> 4" else printlog "There are 4 formats for circle" end if sleep 1 - InhaltEinfuegen.OK '/// paste circle ///' + printlog "paste circle" + InhaltEinfuegen.OK sleep 1 - Call hCloseDocument '/// close document ///' -endcase + printlog "close document " + Call hCloseDocument +endcase 'tdEditPasteSpecial_Circle '------------------------------------------------------------------------------- testcase tiEditPasteSpecial @@ -447,8 +495,8 @@ testcase tiEditPasteSpecial dim i as integer dim x as integer ' warnlog "TODOTBO: from draw, impress, math..." - '/// go into writer, type a text, select all, Edit->Cut, close writer ///' - '/// go into application to test, insert every format you can get from Edit->Paste->Special :-) ///' + printlog "go into writer, type a text, select all, Edit->Cut, close writer" + printlog "go into application to test, insert every format you can get from Edit->Paste->Special :-)" gApplication = "WRITER" call hNewDocument kontext "DocumentWriter" @@ -459,28 +507,29 @@ testcase tiEditPasteSpecial call hNewDocument sleep 1 - Printlog " get count of possibilities: " - EditPasteSpecial - sleep 1 - Kontext "InhaltEinfuegen" - x = Auswahl.GetItemCount - for i = 1 to x - printlog " - " + i + " - " + Auswahl.GetItemText (i) - next i - InhaltEinfuegen.Cancel + Printlog " get count of possibilities: " + EditPasteSpecial + sleep 1 + Kontext "InhaltEinfuegen" + x = Auswahl.GetItemCount + for i = 1 to x + printlog " - " + i + " - " + Auswahl.GetItemText (i) + next i + InhaltEinfuegen.Cancel - Printlog " insert every possibility" - for i = 1 to x - Printlog " - processing number: "+i - EditPasteSpecial - sleep 1 - Kontext "InhaltEinfuegen" - Auswahl.Select i - sleep 1 - InhaltEinfuegen.OK - sleep 1 - next i - Call hCloseDocument '/// close document ///' -endcase + Printlog " insert every possibility" + for i = 1 to x + Printlog " - processing number: "+i + EditPasteSpecial + sleep 1 + Kontext "InhaltEinfuegen" + Auswahl.Select i + sleep 1 + InhaltEinfuegen.OK + sleep 1 + next i + printlog "close document" + Call hCloseDocument +endcase 'tiEditPasteSpecial '------------------------------------------------------------------------------- diff --git a/testautomation/graphics/optional/includes/global/g_clipexport3.inc b/testautomation/graphics/optional/includes/global/g_clipexport3.inc index 63eb77cd6134..d43cbacb02ec 100644 --- a/testautomation/graphics/optional/includes/global/g_clipexport3.inc +++ b/testautomation/graphics/optional/includes/global/g_clipexport3.inc @@ -48,7 +48,7 @@ Sub Get_Position_Size_Attributes - Printlog " Get_Position_Size_Attributes Starts" + Printlog "Get_Position_Size_Attributes Starts" FormatPositionAndSize @@ -63,7 +63,7 @@ Sub Get_Position_Size_Attributes End Select sleep 1 - ' /// Size-values ///' + printlog "Size-values" PositionWidth = Width.GetText PositionHeight = Height.GetText @@ -86,7 +86,7 @@ Sub Get_Position_Size_Attributes sleep 3 Printlog " Get_Position_Size_Attributes Ends" -end sub +end sub 'Get_Position_Size_Attributes '------------------------------------------------------------------------------- sub Get_Colour_Attributes @@ -100,7 +100,7 @@ sub Get_Colour_Attributes Kontext "TabArea" - ' /// Area ///' + printlog "Area" FillOptions.Select 2 if FillOptions.GetSelIndex <> 2 then Errorlog "Couldnt click on 'Color' in FormatArea" AreaColourListValue = ColourList.GetSelText @@ -273,7 +273,7 @@ sub Get_Colour_Attributes TabArea.Cancel printlog " Get_Colour_Attributes ends" -end sub +end sub 'Get_Colour_Attributes '------------------------------------------------------------------------------- sub Check_Position_Size_Attributes @@ -355,7 +355,7 @@ sub Check_Position_Size_Attributes sleep 3 printlog " Check_Position_Size_Attributes Ends" -end sub +end sub 'Check_Position_Size_Attributes '---------------------------------------------------------------------------------------------------- sub Check_Text_Formatting @@ -412,8 +412,10 @@ sub Check_Text_Formatting SetKontextApplication printlog " Check_Text_Formatting Ends" -end suB - '---------------------------------------------------------------------------------------------------- +end sub 'Check_Text_Formatting + +'------------------------------------------------------------------------------- + sub Check_Colors_Borders_Attributes printlog " Check_Colors_Borders_Attributes Starts" @@ -425,7 +427,7 @@ sub Check_Colors_Borders_Attributes Active.setpage TabArea Kontext "TabArea" - ' /// Area ///' + printlog "Area" FillOptions.Select 2 if FillOptions.GetSelIndex <> 2 then Errorlog "Couldnt click on 'Color' in FormatArea" @@ -608,7 +610,7 @@ sub Check_Colors_Borders_Attributes Printlog "End of one application" -end sub +end sub 'Check_Colors_Borders_Attributes '---------------------------------- Set the Kontext to the current Application ----------------------------------' sub SetKontextApplication @@ -633,7 +635,7 @@ sub SetKontextApplication end select sleep 1 -end sub +end sub 'SetKontextApplication '------------------------- Part with "create new windows" --------------------- sub New_Draw @@ -644,7 +646,7 @@ sub New_Draw Call hNewDocument SetKontextApplication -end sub +end sub 'New_Draw '------------------------------------------------------------------------------- sub New_Impress @@ -656,7 +658,7 @@ sub New_Impress Call hNewDocument SetKontextApplication -end sub +end sub 'New_Impress '------------------------------------------------------------------------------- sub New_Calc @@ -668,7 +670,7 @@ sub New_Calc Call hNewDocument SetKontextApplication -end sub +end sub 'New_Calc '------------------------------------------------------------------------------- sub New_Writer @@ -680,7 +682,7 @@ sub New_Writer Call hNewDocument SetKontextApplication -end sub +end sub 'New_Writer '------------------------------------------------------------------------------- testcase Choose_Toapplication @@ -709,6 +711,6 @@ testcase Choose_Toapplication Call hNewDocument SetKontextApplication -endcase +endcase 'Choose_Toapplication '-------------------------------------------------------------------------------------------------------- diff --git a/testautomation/graphics/optional/includes/global/g_crossfading.inc b/testautomation/graphics/optional/includes/global/g_crossfading.inc index 0d7142b9ae46..e9df826aaff9 100644 --- a/testautomation/graphics/optional/includes/global/g_crossfading.inc +++ b/testautomation/graphics/optional/includes/global/g_crossfading.inc @@ -43,39 +43,47 @@ testcase tCrossfading dim CounterForX as integer dim anothercounter as integer + printlog "New Impress document" Call hNewDocument - Call sSelectEmptyLayout '/// New Impress document ///' + Call sSelectEmptyLayout gMouseClick 50,50 - sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + sleep 1 + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// create rectangle ///' - sleep 1 - EditSelectAll '/// Select all ///' - sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + sleep 1 + printlog "Select all" + EditSelectAll + sleep 1 + printlog "Choose Edit / CrossFading" + EditCrossFading kontext "Ueberblenden" - X = Schritte.GetText ' /// Get counter-value and save it in X ///' + printlog "Get counter-value and save it in X" + X = Schritte.GetText printlog "Steps before we start the test: " + X printlog "Schritte.GetText= " + Schritte.GetText Schritte.ToMin if Schritte.GetText <> "1" then qaerrorlog "Could not change the step-number to 1." - - for I = 2 to 10 ' /// How many steps do you want? ///' + printlog "How many steps do you want?" + for I = 2 to 10 Schritte.More 1 if Schritte.GetText <> I then qaerrorlog "Could not change the step-number to" + I Ueberblenden.OK sleep 1 try - FormatUngroupDraw '/// open context menu and ungroup objects ///' + printlog "open context menu and ungroup objects" + FormatUngroupDraw catch qaerrorlog "Could not ungroup objects" endcatch sleep 1 - hTypeKeys "<TAB>" '/// Should make the first object active ///' + printlog "Should make the first object active" + hTypeKeys "<TAB>" - '/// Get position and dimensions of elements ///' + printlog "Get position and dimensions of elements" try ContextPositionAndSize catch @@ -88,62 +96,76 @@ testcase tCrossfading if TabPositionAndSize.exists (5) then CounterForX=0 CheckX=0 - FirstX=PositionX.GetText '/// Tet Dimensions of first object ///' + printlog "Tet Dimensions of first object" + FirstX=PositionX.GetText TabPositionAndSize.OK else qaerrorlog "Couldn't switch tab page :-( " endif + printlog "How many objects we have on the screen" + anothercounter = I+2 -anothercounter = I+2 '/// How many objects we have on the screen ///' - - for Y = 1 to anothercounter '/// How many times we should step to (hopefully) get back to the first one ///' + printlog "How many times we should step to (hopefully) get back to the first one" + for Y = 1 to anothercounter if Y > anothercounter then warnlog "Too many steps, something is wrong." try - hTypeKeys "<TAB>" '/// Step to the next object ///' + printlog "Step to the next object" + hTypeKeys "<TAB>" catch errolog "Could not step to the next object" endcatch ' Printlog "- Get position and dimensions of elements" - ContextPositionAndSize '/// Open Position and Size for this object ///' + printlog "Open Position and Size for this object" + ContextPositionAndSize sleep 1 Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" - CheckX=PositionX.GetText '/// Get Position X for this object ///' + printlog "Get Position X for this object" + CheckX=PositionX.GetText sleep 1 TabPositionAndSize.OK Kontext "DocumentDraw" - CounterForX=CounterForX+1 '/// Up one on the object-counter ///' - if CheckX=FirstX then '/// Check if Position is the same as the first one ///' + printlog "Up one on the object-counter" + CounterForX=CounterForX+1 + printlog "Check if Position is the same as the first one" + if CheckX=FirstX then if anothercounter = CounterForX then printlog "The first box is at: " + CheckX + " And we're now at " + FirstX + " = Correct steps between the objects, everything's fine." - printlog "We should have " + Y + " objects to go through." '/// Just here for debugging. - FHA -' printlog "anothercounter= " + anothercounter '/// Just here for debugging. - FHA + printlog "We should have " + Y + " objects to go through." printlog "Number of objects: " + anothercounter printlog "" endif - next Y '/// End or go on with the checking-loop ///' - - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' + printlog "End or go on with the checking-loop" + next Y + printlog "Select all" + EditSelectAll + printlog "Delete all" + EditDelete sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Create rectangle" +Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// Create rectangle ///' + printlog "Create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) sleep 1 - EditSelectAll '/// Select all ///' + printlog "Select all" + EditSelectAll sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' - sleep 2 - kontext "Ueberblenden" + printlog "Choose Edit / CrossFading" + EditCrossFading + sleep 2 + kontext "Ueberblenden" next I - '/// And now we're gonna check if we can separate the object into it's parts ///' - '/// And check if the numbers of steps / objects is correct ///' + printlog "And now we're gonna check if we can separate the object into it's parts" + printlog "And check if the numbers of steps / objects is correct" - Schritte.ToMin '/// Select minimum value for number of steps ///' + printlog "Select minimum value for number of steps" + Schritte.ToMin for Z = 1 to X -1 - Schritte.More '/// Raise the value for number of steps with one ///' + printlog "Raise the value for number of steps with one" + Schritte.More next Z printlog "Value has been restored to: " + Schritte.GetText printlog "X is now: " + X @@ -151,101 +173,149 @@ anothercounter = I+2 '/// How many objects we have on the screen ///' Ueberblenden.OK sleep 1 Kontext "DocumentDraw" - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' + printlog "Select all" + EditSelectAll + printlog "Delete all" + EditDelete sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// Create second rectangle ///' - EditSelectAll '/// Select all ///' + printlog "Create second rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + printlog "Select all" + EditSelectAll sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "Choose Edit / CrossFading" + EditCrossFading Kontext "Ueberblenden" if Attributierung.IsChecked = TRUE then qaerrorlog "Attributierung / was NOT unchecked." - GleicheOrientierung.UnCheck '/// Uncheck "same orienation" ///' -???? - Ueberblenden.OK '/// Close CrossFading-window with "OK" ///' + printlog "Uncheck same orienation" + GleicheOrientierung.UnCheck + printlog "Close CrossFading-window with OK" + Ueberblenden.OK sleep 1 Kontext "DocumentDraw" - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' + printlog "Select all" + EditSelectAll + printlog "Delete all" + EditDelete sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// create rectangle ///' - EditSelectAll '/// Select all ///' + printlog "create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + printlog "Select all" + EditSelectAll sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "Choose Edit / CrossFading" + EditCrossFading Kontext "Ueberblenden" if GleicheOrientierung.IsChecked = TRUE then qaerrorlog "GleicheOrientierung / was NOT unchecked." - Attributierung.Check '/// Check "Attributing" ///' - ??? - Ueberblenden.OK '/// Close CrossFading-window with "OK" ///' + printlog "Check Attributing" + Attributierung.Check + printlog "Close CrossFading-window with OK" + Ueberblenden.OK sleep 1 Kontext "DocumentDraw" - EditSelectAll '/// Select all ///' + printlog "Select all" + EditSelectAll sleep 1 - EditDelete '/// Delete all ///' + printlog "Delete all" + EditDelete sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// Create second rectangle ///' - EditSelectAll '/// Select all ///' + printlog "Create second rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + printlog "Select all" + EditSelectAll sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "Choose Edit / CrossFading" + EditCrossFading Kontext "Ueberblenden" if Attributierung.IsChecked = FALSE then qaerrorlog "Attributierung / was NOT checked again." - GleicheOrientierung.UnCheck '/// Check "same orientation" ///' -???? + printlog "Check same orientation" + GleicheOrientierung.UnCheck Ueberblenden.OK sleep 1 Kontext "DocumentDraw" - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' + printlog "Select all" + printlog "Delete all" + EditSelectAll + EditDelete sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// create rectangle ///' - EditSelectAll '/// Select all ///' + printlog "create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + printlog "Select all" + EditSelectAll sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "Choose Edit / CrossFading" + EditCrossFading Kontext "Ueberblenden" - if GleicheOrientierung.IsChecked = TRUE then qaerrorlog "GleicheOrientierung / was NOT checked again." - GleicheOrientierung.Check '/// Check "same orientation" ///' -???? - Ueberblenden.OK '/// Close CrossFading-window with "OK" ///' + if GleicheOrientierung.IsChecked = TRUE then qaerrorlog "GleicheOrientierung / was NOT checked again." + printlog "Check same orientation" + GleicheOrientierung.Check + printlog "Close CrossFading-window with OK" + Ueberblenden.OK sleep 1 Kontext "DocumentDraw" - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Select all" + EditSelectAll + printlog "Delete all" + EditDelete + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// create rectangle ///' - EditSelectAll '/// Select all ///' + printlog "create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + printlog "Select all" + EditSelectAll sleep 1 - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "Choose Edit / CrossFading" + EditCrossFading Kontext "Ueberblenden" if GleicheOrientierung.IsChecked = FALSE then qaerrorlog "GleicheOrientierung / was NOT checked again." - GleicheOrientierung.Check '/// Check "same orientation" ///' -???? - Ueberblenden.OK '/// Close CrossFading-window with "OK" ///' + printlog "Check same orientation" + GleicheOrientierung.Check + printlog "Close CrossFading-window with OK" + Ueberblenden.OK sleep 1 - - Kontext "DocumentDraw" '/// EditCrossFading should not be enabled if more than two objects is selected. ///' - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' + + printlog "EditCrossFading should not be enabled if more than two objects is selected." + Kontext "DocumentDraw" + printlog "Select all" + EditSelectAll + printlog "Delete all" + EditDelete sleep 1 - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' + printlog "Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) gMouseClick 90,90 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// Create second rectangle ///' + printlog "Create second rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) gMouseClick 90,90 - Call hRechteckErstellen ( 20, 20, 50, 50 ) '/// Create third rectangle ///' + printlog "Create third rectangle" + Call hRechteckErstellen ( 20, 20, 50, 50 ) sleep 1 - EditSelectAll '/// Select all ///' + printlog "Select all" + EditSelectAll sleep 1 try - EditCrossFading '/// Choose Edit / CrossFading ///' + printlog "Choose Edit / CrossFading" + EditCrossFading sleep 2 If active = "Ueberblenden" then qaerrorlog "CrossFading should NOT be selectable since more than two objects is selected." kontext "Ueberblenden" - Ueberblenden.CANCEL '/// Close CrossFading-window with "CANCEL" ///' + printlog "Close CrossFading-window with CANCEL" + Ueberblenden.CANCEL endif sleep 2 Kontext "DocumentDraw" @@ -254,14 +324,17 @@ anothercounter = I+2 '/// How many objects we have on the screen ///' endcatch try - EditSelectAll '/// Select all ///' - EditDelete '/// Delete all ///' + EditSelectAll + EditSelectAll + printlog "Delete all" + EditDelete catch warnlog "Could not select and delete all objects." endcatch printlog "End of test" - Call hCloseDocument '/// Close document ///' + printlog "Close document" + Call hCloseDocument -endcase 'tCrossfading +endcase 'tCrossfading
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_demoguide.inc b/testautomation/graphics/optional/includes/global/g_demoguide.inc index cb0a428d2f59..0860e8cb942a 100644 --- a/testautomation/graphics/optional/includes/global/g_demoguide.inc +++ b/testautomation/graphics/optional/includes/global/g_demoguide.inc @@ -41,12 +41,10 @@ testcase t_Introduction gApplication = "IMPRESS" - '///Open new presentation printlog "Open new presentation" Call hNewDocument Call sSelectEmptyLayout - '///Open the Gallery printlog "Open the Gallery" ToolsGallery Sleep (1) @@ -55,7 +53,6 @@ testcase t_Introduction ToolsGallery end if - '///Choose computer theme and insert the third image printlog "Choose an item from the gallery" Gallerys.Select(2) View.TypeKeys "<HOME><RIGHT><RIGHT>" @@ -65,7 +62,7 @@ testcase t_Introduction sleep 2 MenuSelect(MenuGetItemID(1)) 'Copy sleep 2 - '///+ - Check that we really got a copy of the object ///' + printlog "Check that we really got a copy of the object " kontext "DocumentImpress" DocumentImpress.OpenContextMenu(true) sleep 2 @@ -93,15 +90,16 @@ testcase t_Introduction catch Warnlog "Insert graphic doesn't work" endcatch - - '///Resize object + sleep 5 + printlog "Resize object" Kontext "DocumentImpress" gMouseClick (10, 10) sleep 1 EditSelectAll sleep 1 - ContextPositionAndSize '/// Format-position and size + printlog "Format-position and size" + ContextPositionAndSize Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" @@ -111,7 +109,6 @@ testcase t_Introduction Width.SetText CStr((CInt(Width.GetText)) * 2) TabPositionAndSize.OK - '///Break object printlog "Break object" Kontext "DocumentImpress" gMouseClick (10, 10) @@ -120,7 +117,6 @@ testcase t_Introduction sleep 1 hOpenContextMenu '(when the object is marked) hMenuSelectNr(13) - '/// Select part of object and make it black printlog "Select part of object and make it black" DocumentImpress.TypeKeys "<SHIFT TAB>" FormatArea @@ -131,14 +127,12 @@ testcase t_Introduction ColourList.Select 1 TabArea.OK - '///Group the objects printlog "Group the object" kontext "DocumentImpress" DocumentImpress.TypeKeys "<MOD1 A>" hOpenContextMenu '(when the object is marked) hMenuSelectNr(12) - '///Add Layout "Title Only" Printlog "Add Layout" kontext "Tasks" if (NOT Tasks.exists) then @@ -146,19 +140,18 @@ testcase t_Introduction ViewTaskPane endif - ' enable all items in the task pane. - ' may be one item is not enabled due to a previous testrun + printlog "enable all items in the task pane" + printlog "may be one item is not enabled due to a previous testrun" dim i as integer for i = 1 to 5 printlog i View.OpenMenu if ( MenuIsItemChecked(MenuGetItemID(i)) ) then - ' do nothing the item is allready displayed + printlog "ok" else MenuSelect(MenuGetItemId(4)) endif hMenuSelectNr(0) - 'sleep(1) next View.OpenMenu @@ -170,10 +163,8 @@ testcase t_Introduction View.OpenMenu MenuSelect(MenuGetItemId(5)) - LayoutsPreview.TypeKeys "<HOME> <DOWN> <DOWN> <RETURN>" sleep (5) - '///Add a background Printlog "Add background" Kontext "Tasks" @@ -193,7 +184,6 @@ testcase t_Introduction Tasks.TypeKeys "<MOD1 HOME>",true AvailableForUsePreview.TypeKeys "<HOME> <RIGHT> <RETURN>" sleep (5) - '///Add a transition effect Printlog "Add a transition effect" Kontext "Tasks" sleep(5) @@ -206,33 +196,33 @@ testcase t_Introduction View.OpenMenu MenuSelect(MenuGetItemID(4)) - TransitionSound.GetItemCount 'needed for select + TransitionSound.GetItemCount Sleep 1 TransitionSound.Select 4 - '///Close the document Printlog "Close the document" Call hCloseDocument endcase 't_Introduction + '-------------------------------------------------------------------- + testcase t_Interoperability Dim sTemplatename as string gApplication = "IMPRESS" - '///Open PowerPoint presentation printlog "Open PowerPoint presentation" hFileOpenLocally( gTesttoolPath + "graphics/required/input/dotNetOverview.ppt" ) - 'Save the name of the origin background (taken from last slide) + printlog "Save the name of the origin background (taken from last slide)" Kontext "DocumentImpress" DocumentImpress.TypeKeys "<END>" sleep (4) sTemplatename = DocumentImpress.StatusGetText (6) - printlog " Background = " & sTemplatename 'Debugcode - + printlog "Background = " & sTemplatename 'Debugcode + printlog "Choose a masterpage from right pane" Kontext "Tasks" @@ -250,15 +240,14 @@ testcase t_Interoperability Kontext "AvailableForUsePreview" AvailableForUsePreview.TypeKeys "<HOME> <RIGHT> <RETURN>" sleep (10) - printlog " Verify that the background has changed" + printlog "Verify that the background has changed" Kontext "DocumentImpress" - printlog " Background is " & DocumentImpress.StatusGetText (6) 'Debugcode + printlog "Background is " & DocumentImpress.StatusGetText (6) 'Debugcode if DocumentImpress.StatusGetText (6) = sTemplatename then warnlog "The background is not changed" else printlog " Background has been changed" endif - '///Switch back to original background printlog "Switch back to original background" Kontext "Tasks" Kontext "AvailableForUsePreview" @@ -270,7 +259,6 @@ testcase t_Interoperability else warnlog "The background is " & DocumentImpress.StatusGetText (6) & " but should be: " & sTemplatename endif - '///Resort slides printlog "Resort slides" Kontext "DocumentImpress" Kontext "Slides" @@ -289,7 +277,7 @@ testcase t_Interoperability Printlog " Verify that the slide was moved correctly" Kontext "Slides" sleep (5) - + SlidesControl.TypeKeys "<SHIFT F10>" if hMenuFindSelect(27268, true, 3) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." @@ -300,12 +288,11 @@ testcase t_Interoperability if NameField.GetText <> ".NET Enterprise Federation" then Warnlog "Wrong slide found! Expected no 3, but found " + NameField.GetText + "." else - Printlog " The slide was correctly moved" + Printlog "The slide was correctly moved" endif NameDlgPage.OK sleep 1 - '///Switch views printlog "Switch views" ViewWorkspaceOutlineView sleep (2) @@ -315,8 +302,8 @@ testcase t_Interoperability DocumentImpressOutlineView.TypeKeys "<Mod1 C>" sleep (5) if getclipboard() <> ".NET Enterprise Federation" then - warnlog " Wrong selection in outlineview. Should be '.NET Enterprise', but is '" & getclipboard() +"'." - else printlog " Switching to Outlineview was successfull" + warnlog "Wrong selection in outlineview. Should be '.NET Enterprise', but is '" & getclipboard() +"'." + else printlog "Switching to Outlineview was successfull" endif catch warnlog "Switching to Outlineview was not successfull" @@ -331,7 +318,7 @@ testcase t_Interoperability MenuSelect(MenuGetItemID(3)) 'Open Contextmenu Line Kontext "TabLinie" TabLinie.Cancel - printlog " Switching to Notesview was successfull" + printlog "Switching to Notesview was successfull" catch warnlog "Switching to Notesview was not successfull" endcatch @@ -340,7 +327,7 @@ testcase t_Interoperability try Kontext "DocumentImpressHandoutView" DocumentImpressHandoutView.TypeKeys "<TAB>" - printlog " Switching to Handoutview was successfull" + printlog "Switching to Handoutview was successfull" catch warnlog "Switching to Handoutview was not successfull" endcatch @@ -350,7 +337,7 @@ testcase t_Interoperability try Kontext "Slides" SlidesControl.TypeKeys "<TAB>" - printlog " Switching to Slideview was successfull" + printlog "Switching to Slideview was successfull" catch warnlog "Switching to Slideview was not successfull" endcatch @@ -360,12 +347,11 @@ testcase t_Interoperability try Kontext "DocumentImpress" DocumentImpress.TypeKeys "<TAB>" - printlog " Switching back to Drawingview was successfull" + printlog "Switching back to Drawingview was successfull" catch warnlog "Switching to Drawingview was not successfull" endcatch - '///Travel through the presentation by left pane printlog "Travel through the presentation by left pane to slide 7" Kontext "DocumentImpress" DocumentImpress.TypeKeys "<HOME><PAGEDOWN><PAGEDOWN><PAGEDOWN><PAGEDOWN><PAGEDOWN><PAGEDOWN><PAGEDOWN>" @@ -416,18 +402,16 @@ testcase t_DrawingEngine gApplication = "DRAW" - '///Open a drawing printlog "Open a drawing" hFileOpen (Convertpath (gTesttoolPath + "graphics/required/input/Blueprint.odg")) Call fMakeDocumentWritable - '///Select grouped object and enter group printlog "Select group" Kontext "DocumentDraw" DocumentDraw.TypeKeys "<TAB><TAB>" sleep (5) - printlog " Save position of group" + printlog "Save position of group" ContextPositionAndSize 'Format-position and size Kontext Active.SetPage TabPositionAndSize @@ -440,7 +424,6 @@ testcase t_DrawingEngine FormatEditGroupDraw sleep 1 - '///Select and move single object printlog "Select and move single object" printlog " Select object" Kontext "DocumentDraw" @@ -452,48 +435,46 @@ testcase t_DrawingEngine kontext "NameDlgObject" if NameField.GetText <> "Chair" then Warnlog "Wrong object selected!" - else Printlog " The correct object is selected" + else Printlog "The correct object is selected" endif NameDlgObject.OK sleep 1 - printlog " Save position of group" - ContextPositionAndSize 'Format-position and size + printlog "Save position of group" + ContextPositionAndSize Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" sObjectPosition = PositionY.GetText - printlog " - ObjectPosition is " & sObjectPosition + printlog "ObjectPosition is " & sObjectPosition TabPositionAndSize.OK - printlog " Move object" + printlog "Move object" Kontext "DocumentDraw" DocumentDraw.TypeKeys "<UP><UP><UP>" sleep (5) - printlog " Verify that the object was moved" - ContextPositionAndSize '/// Format-position and size + printlog "Verify that the object was moved" + ContextPositionAndSize Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" if PositionY.GetText <> sObjectPosition then - printlog " Single object was moved" + printlog "Single object was moved" else warnlog "The object has not been moved" endif TabPositionAndSize.OK - printlog " Exit group" + printlog "Exit group" FormatExitGroupDraw Printlog "Verify that the group is still on position" - printlog " Verify position" ContextPositionAndSize 'Format-position and size Kontext Active.SetPage TabPositionAndSize Kontext "TabPositionAndSize" if PositionY.GetText = sGroupPosition then - printlog " Group is still on position" + printlog "Group is still on position" else warnlog "Group has moved from " & sGroupPosition & " to " & PositionY.GetText endif TabPositionAndSize.OK - '///Close document printlog "Close document" Call hCloseDocument -endcase 't_DrawingEngine +endcase 't_DrawingEngine
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_edit.inc b/testautomation/graphics/optional/includes/global/g_edit.inc index fdff948d0bfb..59cf4e3a404a 100644 --- a/testautomation/graphics/optional/includes/global/g_edit.inc +++ b/testautomation/graphics/optional/includes/global/g_edit.inc @@ -43,32 +43,41 @@ ' Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") testcase tEditDuplicate - dim Ueber_Text_1 - dim Zaehler - Call hNewDocument '/// New Impress document ///' - Call hRechteckErstellen ( 5, 5, 20, 30 ) '/// Create rectangle ///' - EditSelectAll '/// Select rectangle ///' - EditDuplicate '/// Edit-duplicate ///' - Kontext "Duplizieren" - Ueber_Text_1 = AnzahlAnKopien.GetText - AnzahlAnKopien.SetText "50" '/// Set number of copies to 50 ///' - Duplizieren.Cancel '/// Cancel Edit Duplicate ///' - sleep 1 - For Zaehler = 1 to 8 - EditDuplicate '/// Edit Duplicate ///' - sleep 1 - Kontext "Duplizieren" - AnzahlAnKopien.SetText "30" '/// Number of copies = 30 ///' + dim Ueber_Text_1 + dim Zaehler - Select Case Zaehler '/// Setting values for axis and angles ///' - Case 1: XAchse.SetText "0,0" + printlog " New Impress document" + Call hNewDocument + printlog " Create rectangle" + Call hRechteckErstellen ( 5, 5, 20, 30 ) + printlog " Select rectangle" + EditSelectAll + printlog " Edit-duplicate" + EditDuplicate + Kontext "Duplizieren" + Ueber_Text_1 = AnzahlAnKopien.GetText + printlog " Set number of copies to 50" + AnzahlAnKopien.SetText "50" + printlog " Cancel Edit Duplicate" + Duplizieren.Cancel + sleep 1 + For Zaehler = 1 to 8 + printlog " Edit Duplicate" + EditDuplicate + sleep 1 + Kontext "Duplizieren" + printlog " Number of copies = 30" + AnzahlAnKopien.SetText "30" + printlog " Setting values for axis and angles" + Select Case Zaehler + Case 1: XAchse.SetText "0,0" YAchse.SetText "0,45" Hoehe.SetText "-0,1" Breite.SetText "-0,1" Drehwinkel.SetText "3" Anfang.Select Int((Anfang.GetItemCount * Rnd)+1) - Case 2,6: XAchse.SetText "0,6" + Case 2,6: XAchse.SetText "0,6" YAchse.SetText "0,0" Hoehe.SetText "0,15" Breite.SetText "0,01" @@ -78,26 +87,28 @@ testcase tEditDuplicate Hoehe.SetText "-0,1" Breite.SetText "0,06" Drehwinkel.SetText "11" - Case 4,8: XAchse.SetText "-0,6" + Case 4,8: XAchse.SetText "-0,6" YAchse.SetText "0,0" Hoehe.SetText "0,05" Breite.SetText "-0,08" Drehwinkel.SetText "347" - Case 5: XAchse.SetText "0,1" + Case 5: XAchse.SetText "0,1" YAchse.SetText "0,48" Hoehe.SetText "-0,05" Breite.SetText "-0,05" Drehwinkel.SetText "355" - End Select - Ende.Select Int((Ende.GetItemCount * Rnd)+1) - Duplizieren.OK '/// Execute Duplicate ///' - sleep 1 - Next Zaehler - sleep 2 - Call hCloseDocument '/// Close document ///' + End Select + Ende.Select Int((Ende.GetItemCount * Rnd)+1) + printlog " Execute Duplicate" + Duplizieren.OK + sleep 1 + Next Zaehler + sleep 2 + printlog " Close document" + Call hCloseDocument endcase 'tEditDuplicate -'--------------------------------------------------------- +'------------------------------------------------------------------------------- testcase tEditFields Call hNewDocument @@ -148,68 +159,85 @@ endcase 'tEditFields '-------------------------------------------------------- testcase tEditDeleteSlide - dim Ueber_Text_1 as string - dim Ueber_Text_2 as string - dim Ueber_Text_3 as string - Call hNewDocument '/// New impress document ///' - sleep 3 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// create rectangle ///' - sleep 1 - ContextPositionAndSize '/// open Position and Size dialog ///' - kontext - Messagebox.SetPage TabPositionAndSize - kontext "TabPositionAndSize" - Ueber_Text_1 = PositionX.GetText '/// get position values for rectangle ///' - TabPositionAndSize.OK - InsertSlide '/// insert slide ///' - sleep 2 - hTypekeys "<Pagedown>" - sleep 2 - Call hRechteckErstellen ( 40, 40, 60, 60 ) '/// create rectangle ///' - sleep 1 - EditDeleteSlide '/// Delete slide ///' - sleep 1 - Ueber_Text_2 = "OK Page was closed" - Ueber_Text_3 = "Page was not closed" - call Position_Vergleichen (Ueber_Text_1,Ueber_Text_2,Ueber_Text_3) '/// compare position of rectange ///' - sleep 1 - Call hCloseDocument '/// close document ///' + dim Ueber_Text_1 as string + dim Ueber_Text_2 as string + dim Ueber_Text_3 as string + + printlog " New impress document" + Call hNewDocument + sleep 3 + printlog " create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + sleep 1 + printlog " open Position and Size dialog" + ContextPositionAndSize + kontext + Messagebox.SetPage TabPositionAndSize + kontext "TabPositionAndSize" + printlog " get position values for rectangle" + Ueber_Text_1 = PositionX.GetText + TabPositionAndSize.OK + printlog " insert slide" + InsertSlide + sleep 2 + hTypekeys "<Pagedown>" + sleep 2 + printlog " create rectangle" + Call hRechteckErstellen ( 40, 40, 60, 60 ) + sleep 1 + printlog " Delete slide" + EditDeleteSlide + sleep 1 + Ueber_Text_2 = "OK Page was closed" + Ueber_Text_3 = "Page was not closed" + printlog " compare position of rectange" + call Position_Vergleichen (Ueber_Text_1,Ueber_Text_2,Ueber_Text_3) + sleep 1 + printlog " close document" + Call hCloseDocument endcase 'tEditDeleteSlide '-------------------------------------------------------- testcase tEditLinks - Call hNewDocument '/// New document ///' - InsertGraphicsFromFile '/// insert graphic (sample.bmp) ///' - Kontext "GrafikEinfuegenDlg" - Link.Check '/// check link ///' - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") - Oeffnen.Click - sleep 3 - EditLinksDraw '/// edit links ///' - Kontext "VerknuepfungenBearbeiten" - Aktualisieren.Click '/// refresh ///' - sleep 1 - 'Aendern 'kann man noch den Dialog aufrufen... - Loesen.Click - sleep 1 - Kontext - Messagebox.Yes - VerknuepfungenBearbeiten.Close '/// close dialog ///' - sleep 1 - try - EditLinksDraw '/// check if last changes remain in the dialog ///' + printlog " New document" + Call hNewDocument + printlog " insert graphic (sample.bmp)" + InsertGraphicsFromFile + Kontext "GrafikEinfuegenDlg" + printlog " check link" + Link.Check + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") + Oeffnen.Click + sleep 3 + printlog " edit links" + EditLinksDraw Kontext "VerknuepfungenBearbeiten" + printlog " refresh" + Aktualisieren.Click + sleep 1 Loesen.Click sleep 1 Kontext Messagebox.Yes + printlog " close dialog" VerknuepfungenBearbeiten.Close - warnlog "Break link does not work" + sleep 1 + try + printlog " check if last changes remain in the dialog" + EditLinksDraw + Kontext "VerknuepfungenBearbeiten" + Loesen.Click + sleep 1 + Kontext + Messagebox.Yes + VerknuepfungenBearbeiten.Close + warnlog "Break link does not work" catch - printlog "OK Link broken" + printlog "OK Link broken" endcatch - Call hCloseDocument '/// close document ///' + printlog " close document" + Call hCloseDocument endcase 'tEditLinks '--------------------------------------------------------- @@ -218,77 +246,87 @@ testcase tdEditDeleteLayer dim Ueber_Text_1 as string dim Ueber_Text_2 as string dim Ueber_Text_3 as string - Call hNewDocument '/// new document ///' - sleep 2 - Call hRechteckErstellen ( 30, 30, 70, 70 ) '/// create rectangle ///' - sleep 1 -'/// View->Layer ///' - ViewLayer - ContextPositionAndSize '/// get position values for rectangle ///' - kontext - active.SetPage TabPositionAndSize - kontext "TabPositionAndSize" - Ueber_Text_1 = PositionX.GetText - TabPositionAndSize.OK - InsertLayer '/// insert layer ///' - Kontext "EbeneEinfuegenDlg" - EbeneEinfuegenDlg.OK - Call hRechteckErstellen ( 10, 40, 90, 60 ) '/// create rectangle on created layer ///' - sleep 1 - EditDeleteLayer '/// delete layer ///' - sleep 1 - Kontext - Active.Yes - sleep 1 - Ueber_Text_2 = "OK Layer was deleted" '/// compare position of selected rectangle with position of created rectangle in deteted layer ///' - Ueber_Text_3 = "Layer was not deleted" - Call Position_Vergleichen (Ueber_Text_1,Ueber_Text_2,Ueber_Text_3) - sleep 1 - Call hCloseDocument '/// close document ///' + + printlog " new document" + Call hNewDocument + sleep 2 + printlog " create rectangle" + Call hRechteckErstellen ( 30, 30, 70, 70 ) + sleep 1 + printlog " View->Layer" + ViewLayer + printlog " get position values for rectangle" + ContextPositionAndSize + kontext + active.SetPage TabPositionAndSize + kontext "TabPositionAndSize" + Ueber_Text_1 = PositionX.GetText + TabPositionAndSize.OK + printlog " insert layer" + InsertLayer + Kontext "EbeneEinfuegenDlg" + EbeneEinfuegenDlg.OK + printlog " create rectangle on created layer" + Call hRechteckErstellen ( 10, 40, 90, 60 ) + sleep 1 + printlog " delete layer" + EditDeleteLayer + sleep 1 + Kontext + Active.Yes + sleep 1 + Ueber_Text_2 = "OK Layer was deleted" + Ueber_Text_3 = "Layer was not deleted" + printlog " compare position of selected rectangle with position of created rectangle in deteted layer" + Call Position_Vergleichen (Ueber_Text_1,Ueber_Text_2,Ueber_Text_3) + sleep 1 + printlog " close document" + Call hCloseDocument endcase 'tdEditDeleteLayer '-------------------------------------------------------- testcase tEditObjectEdit - Dim Schrieb as string - - Schrieb = gOLEWriter - if Schrieb = "" then - warnlog " the OLE is not defined :-((( gOLEWriter: " + iSprache - else + Dim Schrieb as string - Call hNewDocument - call sSelectEmptyLayout - sleep 1 '/// new document ///' - InsertObjectOLEObject '/// insert writer ole object ///' - Kontext "OLEObjektEinfuegen" - sleep 3 - if ObjektTyp.GetItemCount = 0 Then - Warnlog "- No available Ole-entry in the list, maybe an error in the Install.ini?" - sleep 1 - OleObjektEinfuegen.Cancel - sleep 1 - else - - ObjektTyp.Select Schrieb - sleep 1 - OLEObjektEinfuegen.OK - sleep 3 ' Changed from Sleep 1 to Sleep 3 - gMouseMove 10,10,90,90 - sleep 1 - EditSelectAll + Schrieb = gOLEWriter + if Schrieb = "" then + warnlog " the OLE is not defined :-((( gOLEWriter: " + iSprache + else + printlog " new document" + Call hNewDocument + call sSelectEmptyLayout + sleep 1 + printlog " insert writer ole object" + InsertObjectOLEObject + Kontext "OLEObjektEinfuegen" + sleep 3 + if ObjektTyp.GetItemCount = 0 Then + Warnlog "- No available Ole-entry in the list, maybe an error in the Install.ini?" + sleep 1 + OleObjektEinfuegen.Cancel + sleep 1 + else + ObjektTyp.Select Schrieb + sleep 1 + OLEObjektEinfuegen.OK + sleep 3 + gMouseMove 10,10,90,90 + sleep 1 + EditSelectAll - try - EditObjectEdit 'keine ID '/// try edit-objects ///' - sleep 2 - catch - Warnlog "- The EditObjectEdit did not work" - endcatch + try + EditObjectEdit + sleep 2 + catch + Warnlog "- The EditObjectEdit did not work" + endcatch - gMouseClick 90,90 + gMouseClick 90,90 end if - sleep 1 - Call hCloseDocument '/// close document ///' - endif -endcase 'tEditObjectEdit + sleep 1 + printlog " close document" + Call hCloseDocument + endif +endcase 'tEditObjectEdit
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_find_replace.inc b/testautomation/graphics/optional/includes/global/g_find_replace.inc index b96099be71ab..3b9fc48ae10f 100644 --- a/testautomation/graphics/optional/includes/global/g_find_replace.inc +++ b/testautomation/graphics/optional/includes/global/g_find_replace.inc @@ -36,21 +36,21 @@ '* '\********************************************************************************** testcase tiEditSearchAndReplace + printlog "This test tests the 'Search and Replace' -dialogue." qaerrorlog "#i115121# Find and replace: wrong replacement" goto endsub - '/// This test tests the 'Search and Replace' -dialogue. ///' Dim sFile 'as string Dim sExpression(2) as string ' Expression to look for: ... Replace with dim sExt as string - Select Case Ucase(gApplication) - case "DRAW" : sExt = ".odg" - case "IMPRESS" : sExt = ".odp" - end select + Select Case Ucase(gApplication) + case "DRAW" : sExt = ".odg" + case "IMPRESS" : sExt = ".odp" + end select - 'First we need some errornes words to replace. (sExpression) - 'sExpression(1) has to be 3 times in the document - select case iSprache + printlog "First we need some errornes words to replace. (sExpression)" + printlog "sExpression(1) has to be 3 times in the document" + select case iSprache case 01 : sExpression(1) = "Alle" : sExpression(2) = "Allz" case 03 : sExpression(1) = "empreza" : sExpression(2) = "Emperor" ' Portuguese case 07 : qaerrorlog "No files for Russian yet, will use english instead." @@ -93,9 +93,9 @@ testcase tiEditSearchAndReplace else Call hFileOpen (gTesttoolpath + "graphics\required\input\recht_"+iSprache+sExt) endif - ' check if the document is writable + printlog "check if the document is writable" if fIsDocumentWritable = false then - ' make the document writable and check if it's succesfull + printlog "make the document writable and check if it's succesfull" if fMakeDocumentWritable = false then warnlog "The document can't be make writeable. Test stopped." goto endsub @@ -110,24 +110,28 @@ testcase tiEditSearchAndReplace Messagebox.OK end if sleep 2 - hTypeKeys "<MOD1 HOME>" '/// Select the text ///' + printlog "Select the text" + hTypeKeys "<MOD1 HOME>" - '/// Edit-Find & Replace I///' + printlog "Edit-Find & Replace" EditSearchAndReplace sleep 1 Kontext "FindAndReplace" - '/// Clap the 'more options'-part open ///' + printlog "Clap the 'more options'-part open" More.Click - '/// verify, that search is done without 'similarity search' !!! ///' + printlog "verify, that search is done without 'similarity search' !!!" if SimilaritySearch.IsChecked = TRUE then SimilaritySearch.UnCheck warnlog "'Similar search' checkbox was enabled! It shouldn't be the default!" end if - SearchFor.SetText sExpression(1) '/// set Search text ///' - ReplaceWith.SetText sExpression(2) '/// set Replace text///' + printlog "set Search text" + SearchFor.SetText sExpression(1) + printlog "set Replace text" + ReplaceWith.SetText sExpression(2) - '/// Word has to be there ONLY three times ///' - SearchNow.Click '/// 1st search for text ///' + printlog "Word has to be there ONLY three times" + printlog "1st search for text" + SearchNow.Click Kontext "Messagebox" if Messagebox.Exists(2) then Printlog Messagebox.GetText @@ -136,7 +140,8 @@ testcase tiEditSearchAndReplace sleep 1 Kontext "FindAndReplace" - SearchNow.Click '/// 2nd search for text ///' + printlog "2nd search for text" + SearchNow.Click Kontext "Messagebox" if Messagebox.Exists(2) then Printlog Messagebox.GetText @@ -145,7 +150,8 @@ testcase tiEditSearchAndReplace sleep 1 Kontext "FindAndReplace" - SearchNow.Click '/// 3th search for text///' + printlog "3th search for text" + SearchNow.Click Kontext "Messagebox" if Messagebox.Exists(2) then Printlog Messagebox.GetText @@ -153,15 +159,16 @@ testcase tiEditSearchAndReplace end if sleep 1 Kontext "FindAndReplace" - - SearchNow.Click '/// 4th search for text; but it is no more available!///' + printlog "4th search for text; but it is no more available!" + SearchNow.Click sleep 2 kontext "Messagebox" if Messagebox.Exists Then Printlog "- The word was found 3 times: '" + messagebox.gettext + "'" Messagebox.OK else - SearchNow.Click '/// 5th search for word 1///' + printlog "5th search for word 1" + SearchNow.Click kontext if Messagebox.Exists (5) Then Printlog "?: "+Messagebox.gettext @@ -171,7 +178,7 @@ testcase tiEditSearchAndReplace Warnlog "- No MsgBox appeared: 'changed'" end if - '/// Replace all ///' + printlog "Replace all" Kontext "FindAndReplace" sleep 1 ReplaceAll.Click @@ -185,7 +192,8 @@ testcase tiEditSearchAndReplace end if Kontext "FindAndReplace" sleep 2 - SearchNow.Click '/// Search for word 1 to check if all words are replaced ///' + printlog "Search for word 1 to check if all words are replaced" + SearchNow.Click Kontext "Messagebox" if Not Messagebox.Exists then Warnlog " Not all words are replaced (Replace All)" @@ -197,17 +205,20 @@ testcase tiEditSearchAndReplace FindAndReplace.Close sleep 3 - '/// Edit-Find & Replace II ///' + printlog "Edit-Find & Replace II" gMouseClick 50,50 sleep 1 hTypeKeys "<MOD1 HOME>" EditSearchAndReplace sleep 1 Kontext "FindAndReplace" - SearchFor.SetText sExpression(2) '/// Search for word 2 ///' - ReplaceWith.SetText sExpression(1) '/// Replace with word 1 ///' + printlog "Search for word 2" + SearchFor.SetText sExpression(2) + printlog "Replace with word 1" + ReplaceWith.SetText sExpression(1) - ReplaceBtn.Click '/// Replace 1 ///' + printlog "Replace 1" + ReplaceBtn.Click Kontext "Messagebox" if Messagebox.Exists(4) Then Kontext "Messagebox" @@ -219,7 +230,8 @@ testcase tiEditSearchAndReplace Kontext "FindAndReplace" sleep 1 - SearchNow.Click '/// 2nd search for word 2 ///' + printlog "2nd search for word 2" + SearchNow.Click Kontext "Messagebox" if Messagebox.Exists(2) Then Warnlog " All words got replaced, but only the 1st should have been" @@ -230,7 +242,7 @@ testcase tiEditSearchAndReplace Printlog " Word replaced" end if - '/// Replace all ///' + printlog "Replace all" Kontext "FindAndReplace" ReplaceAll.Click kontext "Messagebox" @@ -240,7 +252,7 @@ testcase tiEditSearchAndReplace Printlog "- No messagebox after replace all" end if - '/// Search for word 2 to check if all are replaced ///' + printlog "Search for word 2 to check if all are replaced" Kontext "FindAndReplace" SearchNow.Click kontext "Messagebox" @@ -255,21 +267,23 @@ testcase tiEditSearchAndReplace More.Click FindAndReplace.Close sleep 2 - '/// Close document ///' + printlog "Close document" Call hCloseDocument endcase 'tiEditSearchAndReplace + '-------------------------------------------------------- + testcase tiEditSearchAndReplaceBUGS -'/// inspired by bugs: 101974, 101975, 101976 ///' +printlog "inspired by bugs: 101974, 101975, 101976" dim i as integer dim bTemp as boolean - '/// open application ///' + printlog "open application" Call hNewDocument sleep 3 - '/// Edit->Search and Replace ///' + printlog "Edit->Search and Replace" EditSearchAndReplace Kontext "FindAndReplace" if FindAndReplace.Exists (5) then @@ -278,7 +292,7 @@ testcase tiEditSearchAndReplaceBUGS Warnlog "Dialog for Search&Replace could NOT be opened :-(" endif - '/// for al 5 views in 'View->Workspace->...' do: ///' + printlog "for al 5 views in 'View->Workspace->...' do: " for i = 1 to 6 Printlog "- " + i + " View->Workspace->... ------------------------------------------------------" try @@ -317,7 +331,7 @@ testcase tiEditSearchAndReplaceBUGS endcatch sleep 5 Kontext "FindAndReplace" - '///+ if not already open, open. edit->search and replace ///' + printlog "if not already open, open. edit->search and replace" if (FindAndReplace.exists <> TRUE) then try EditSearchAndReplace @@ -332,13 +346,13 @@ testcase tiEditSearchAndReplaceBUGS endif else Kontext "FindAndReplace" - '///+ set text to look for to "a" ///' + printlog "set text to look for to a" SearchFor.SetText "a" - Printlog "'///+ click button 'find' ///'" + Printlog " click button 'find'" SearchNow.Click sleep 5 kontext - '///+ if active exists 'wrap/not found...' say OK ///' + printlog "if active exists 'wrap/not found...' say OK" if active.exists(5) then Printlog "Active: '" + active.GetText + "'" try @@ -359,7 +373,7 @@ testcase tiEditSearchAndReplaceBUGS next i Kontext "FindAndReplace" FindAndReplace.cancel - '/// close application ///' + printlog "close application" Call hCloseDocument endcase 'tiEditSearchAndReplaceBUGS diff --git a/testautomation/graphics/optional/includes/global/g_format.inc b/testautomation/graphics/optional/includes/global/g_format.inc index 8cf37d5432a3..dbd8d6fe8a43 100644 --- a/testautomation/graphics/optional/includes/global/g_format.inc +++ b/testautomation/graphics/optional/includes/global/g_format.inc @@ -365,8 +365,9 @@ testcase tdFormatConnector WaitSlot (1000) hTypeKeys "<SHIFT F10>" 'OpenContextMenu(true) - sleep (3) + sleep (2) hMenuSelectNr(2) ' Connector + sleep (1) Kontext "Verbinder" Typ.Select 2 ' the one with 2 from 3 posibilities to set a value... Sleep (1) diff --git a/testautomation/graphics/optional/includes/global/g_group.inc b/testautomation/graphics/optional/includes/global/g_group.inc index a11b809355ce..7784303e207a 100644 --- a/testautomation/graphics/optional/includes/global/g_group.inc +++ b/testautomation/graphics/optional/includes/global/g_group.inc @@ -34,74 +34,87 @@ '\******************************************************************** testcase tiGruppierung - Dim PosX 'Variable fuer PositionX + Dim PosX 'Variable for PositionX + printlog "new document" Call hNewDocument - Call sSelectEmptyLayout '/// new document ///' - sleep 3 - Kontext "DocumentImpress" - sleep 2 - hRechteckErstellen (20,20,40,40) '/// create rectangle ///' - sleep 1 - hRechteckErstellen (60,60,70,10) '/// create 2nd rectangle ///' - sleep 1 - hRechteckErstellen (50,90,70,40) '/// create 3rd rectangle ///' - sleep 1 + printlog "Select empty layout" + Call sSelectEmptyLayout + sleep 3 + Kontext "DocumentImpress" + sleep 2 + printlog "create rectangle " + hRechteckErstellen (20,20,40,40) + sleep 1 + printlog "create 2nd rectangle" + hRechteckErstellen (60,60,70,10) + sleep 1 + printlog "create 3rd rectangle" + hRechteckErstellen (50,90,70,40) + sleep 1 Printlog "- Created 3 rectangles for group testing" - gMouseClick (50,50) '/// Put the mouse-marker in the middle of the screen ///' - EditSelectAll '/// select all rectangles ///' - if (gApplication = "DRAW") then - hOpenContextMenu + printlog "Put the mouse-marker in the middle of the screen" + gMouseClick (50,50) + printlog "select all rectangles" + EditSelectAll + if (gApplication = "DRAW") then + hOpenContextMenu sleep(2) - hMenuSelectNr(12) ' Select "Group" + printlog "Select Group" + hMenuSelectNr(12) sleep(2) - else - FormatGroupDraw '/// open context menue and group rectangles ///' - endif - sleep 1 + else + printlog "open context menue and group rectangles" + FormatGroupDraw + endif + sleep 1 Printlog "- Get position and dimensions of elements" - ContextPositionAndSize '/// get dimensions of group ///' - sleep 1 - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - sleep 1 - PosX=PositionX.GetText - TabPositionAndSize.OK - sleep 1 - Kontext "DocumentImpress" - gMouseClick 35,35 - sleep 1 - hTypeKeys "<F3>" '/// entering group using key "F3" ///' - sleep 3 - try - EditCut '/// cut rectangle out of document ///' - sleep 1 - Warnlog "- Entering the group, no object within the group should have been selected" - catch - Printlog "- entered group, nothing selected" - endcatch - gMouseClick (35,35) - gMouseMove (30,30,60,60) - sleep 1 - Printlog "- Exit group" -' DocumentImpress.OpenContextMenu '/// leave group, compare dimensions ///' -' sleep 1 -' hMenuSelectNr (13) - hTypeKeys "<mod1 F3>" '/// exit group using key "strg F3" ///' - ' would be better to call the slot TBO! - ContextPositionAndSize - sleep 1 - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - sleep 1 - if PosX = PositionX.GetText then - Warnlog "- No change in position for X axis, even we changed position of 1 object within the group" - TabPositionAndSize.OK - else - Printlog "- Moving within the group works" - TabPositionAndSize.OK - end if - Call hCloseDocument '/// close document ///' -endcase + ContextPositionAndSize + sleep 1 + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + sleep 1 + PosX=PositionX.GetText + TabPositionAndSize.OK + sleep 1 + Kontext "DocumentImpress" + gMouseClick 35,35 + sleep 1 + printlog "entering group using key F3" + hTypeKeys "<F3>" + sleep 3 + try + printlog "cut rectangle out of document" + EditCut + sleep 1 + Warnlog "- Entering the group, no object within the group should have been selected" + catch + Printlog "- entered group, nothing selected" + endcatch + gMouseClick (35,35) + gMouseMove (30,30,60,60) + sleep 1 + printlog "leave group, compare dimensions" + ' DocumentImpress.OpenContextMenu + ' sleep 1 + ' hMenuSelectNr (13) + printlog "exit group using key strg F3" + hTypeKeys "<mod1 F3>" + ' would be better to call the slot TBO! + ContextPositionAndSize + sleep 1 + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + sleep 1 + if PosX = PositionX.GetText then + Warnlog "- No change in position for X axis, even we changed position of 1 object within the group" + TabPositionAndSize.OK + else + Printlog "- Moving within the group works" + TabPositionAndSize.OK + end if + printlog "close document " + Call hCloseDocument +endcase
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_imagemap.inc b/testautomation/graphics/optional/includes/global/g_imagemap.inc index de53fdb6f647..5883bbc8d4ac 100644 --- a/testautomation/graphics/optional/includes/global/g_imagemap.inc +++ b/testautomation/graphics/optional/includes/global/g_imagemap.inc @@ -35,12 +35,15 @@ '\************************************************************************************* testcase tEditImageMap - Call hNewDocument '/// new document ///' - EditImageMap '/// edit image map ///' + printlog "new document" + Call hNewDocument + printlog "edit image map" + EditImageMap Kontext "ImageMapEditor" sleep 1 - if ImageMapEditor.Exists (2) then '/// test dialog controls ///' + if ImageMapEditor.Exists (2) then printlog "ImageMap editor exists" + printlog "test dialog controls" DialogTest ( ImageMapEditor ) try ImageMapEditor.Close @@ -60,52 +63,60 @@ testcase tEditImageMap Printlog "ImageMap closed using the edit-menu entry" endcatch end if - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument endcase 'tEditImageMap -'------------------------------------------------------------------------------------------------------------------------------------ + +'------------------------------------------------------------------------------- + testcase tEditImageMapProperties qaerrorlog "test not yet ready." goto endsub - Call hNewDocument '/// new document ///' - InsertGraphicsFromFile '/// Insert a graphic and select it ///' + printlog "new document" + Call hNewDocument + printlog "Insert a graphic and select it" + InsertGraphicsFromFile sleep (1) Kontext "GrafikEinfuegenDlg" - sleep (2) - Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\SaveAsPicture\SaveAsPicture.pcx") - sleep (2) - Oeffnen.Click - sleep (2) - EditImageMap '/// Open the image map dialog ///' - Kontext "ImageMapEditor" - sleep (1) - if ImageMapEditor.Exists (2) then '/// test dialog controls ///' - printlog "ImageMap editor exists" - else - warnlog "Something is wrong, the Imagemap didn't show up." - end if - - Ellipse.Click '/// Insert an 'image map' object ///' - Dokument.MouseDown 50,50 - Dokument.MouseMove 50,50,10,10 - Dokument.MouseUp 10,10 - - Eigenschaften.Click '/// Click on the properties icon to open up the properties for the Object ///' - kontext "ImageMapHyperlink" - sleep (1) - if ImageMapHyperlink.Exists (2) then - printlog "ImageMapHyperlink (properties) editor exists" - else - warnlog "Something is wrong, the ImageMapHyperlink (properties) didn't show up." - end if + sleep (2) + Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\SaveAsPicture\SaveAsPicture.pcx") + sleep (2) + Oeffnen.Click + sleep (2) + printlog "Open the image map dialog" + EditImageMap + Kontext "ImageMapEditor" + sleep (1) + if ImageMapEditor.Exists (2) then + printlog "ImageMap editor exists" + else + warnlog "Something is wrong, the Imagemap didn't show up." + end if + printlog "Insert an 'image map' object" + Ellipse.Click + Dokument.MouseDown 50,50 + Dokument.MouseMove 50,50,10,10 + Dokument.MouseUp 10,10 - URL.SetText "http://www.cnn.com" '/// Write some text in each field ///' - Frame.SetText "http://www.framed.com" - Objectname.SetText "This is a strange name: Huckillerry Bohaahw" - Alternativetext.SetText "Alternative, the only way to fly..." - Description.SetText "Just a Foney-text... or whatever it's called." - ImageMapHyperlink.Ok '/// Close the Properties-Dialogue with "Ok" ///' + printlog "Click on the properties icon to open up the properties for the Object" + Eigenschaften.Click + kontext "ImageMapHyperlink" + sleep (1) + if ImageMapHyperlink.Exists (2) then + printlog "ImageMapHyperlink (properties) editor exists" + else + warnlog "Something is wrong, the ImageMapHyperlink (properties) didn't show up." + end if + printlog "Write some text in each field" + URL.SetText "http://www.cnn.com" + Frame.SetText "http://www.framed.com" + Objectname.SetText "This is a strange name: Huckillerry Bohaahw" + Alternativetext.SetText "Alternative, the only way to fly..." + Description.SetText "Just a Foney-text... or whatever it's called." + printlog "Close the Properties-Dialogue with Ok" + ImageMapHyperlink.Ok kontext "ImageMapEditor" Zuweisen.Click sleep (1) @@ -117,7 +128,8 @@ testcase tEditImageMapProperties kontext "DocumentImpress" end if - EditImageMap '/// Check if what we wrote in the Properites-Dialogue still is visible." + EditImageMap + printlog "Check if what we wrote in the Properites-Dialogue still is visible." Kontext "ImageMapEditor" sleep (1) if ImageMapEditor.Exists (2) then @@ -128,32 +140,33 @@ testcase tEditImageMapProperties Dokument.TypeKeys "<TAB>" sleep (1) + printlog "Click on the properties icon to open up the properties for the Object" + Eigenschaften.Click + kontext "ImageMapHyperlink" + sleep (1) + if ImageMapHyperlink.Exists (2) then + printlog "ImageMapHyperlink (properties) editor exists" + else + warnlog "Something is wrong, the ImageMapHyperlink (properties) didn't show up." + end if - Eigenschaften.Click '/// Click on the properties icon to open up the properties for the Object ///' - kontext "ImageMapHyperlink" - sleep (1) - if ImageMapHyperlink.Exists (2) then - printlog "ImageMapHyperlink (properties) editor exists" - else - warnlog "Something is wrong, the ImageMapHyperlink (properties) didn't show up." - end if - - '/// Check if the entries we set before has remained the same, with one exception: cnn.com should now have a slash after it. ///' - if URL.GetText <> "http://www.cnn.com/" then warnlog "URL should have been: http://www.cnn.com/ . But was " + URL.GetText + printlog "Check if the entries we set before has remained the same, with one exception: cnn.com should now have a slash after it. " + if URL.GetText <> "http://www.cnn.com/" then warnlog "URL should have been: http://www.cnn.com/ . But was " + URL.GetText ' if Frame.GetSelText <> "http://www.framed.com" then warnlog "Frame should have been: http://www.framed.com. But was " + Frame.GetSelText - if Objectname.GetText <> "This is a strange name: Huckillerry Bohaahw" then warnlog "Objectname. should have been: This is a strange name: Huckillerry Bohaahw. But was " + Objectname.GetText - if Alternativetext.GetText <> "Alternative, the only way to fly..." then warnlog "Alternativetext should have been: . But was " + Alternativetext.GetText - if Description.GetText <> "Just a Foney-text... or whatever it's called." then warnlog "Description. should have been: . But was " + Description.GetText - ImageMapHyperlink.Ok '/// Close the Properties-Dialogue ///' - sleep (1) + if Objectname.GetText <> "This is a strange name: Huckillerry Bohaahw" then warnlog "Objectname. should have been: This is a strange name: Huckillerry Bohaahw. But was " + Objectname.GetText + if Alternativetext.GetText <> "Alternative, the only way to fly..." then warnlog "Alternativetext should have been: . But was " + Alternativetext.GetText + if Description.GetText <> "Just a Foney-text... or whatever it's called." then warnlog "Description. should have been: . But was " + Description.GetText + printlog "Close the Properties-Dialogue" + ImageMapHyperlink.Ok + sleep (1) kontext "ImageMapEditor" Zuweisen.Click sleep (1) ImageMapEditor.Close sleep (1) - - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument endcase 'tEditImageMapProperties '------------------------------------------------------------------------------------------------------------------------------------ diff --git a/testautomation/graphics/optional/includes/global/g_load_save.inc b/testautomation/graphics/optional/includes/global/g_load_save.inc index 8d64e158eb2a..d0d51e8337c7 100644 --- a/testautomation/graphics/optional/includes/global/g_load_save.inc +++ b/testautomation/graphics/optional/includes/global/g_load_save.inc @@ -45,76 +45,79 @@ ' #1 tSaveLoadLayoutSpreadsheet '\************************************************************************************* testcase tFileOpenSaveEtc - Dim Dokument$ - Dim Dokument2$ + Dim Dokument$ + Dim Dokument2$ Dokument$ = ConvertPath ( gOfficePath + "user\work\test1") Dokument2$ = ConvertPath ( gOfficePath + "user\work\test1_2") - if (gApplication = "IMPRESS") then + if (gApplication = "IMPRESS") then ExtensionString = "odp" else ExtensionString = "odg" end if - '/// delete previous created documents: 'user\\work\\test1*.od?' ///' + printlog "delete previous created documents: 'user\\work\\test1*.od?'" if Dir (Dokument$ + ".odp") <> "" then kill (Dokument$ + ".odp") if Dir (Dokument2$ + ".odg") <> "" then kill (Dokument2$ + ".odg") - '/// open application ///' + printlog "open application" hNewDocument gMouseclick 90,90 - '/// create a textframe with content ///' + printlog "create a textframe with content" Call hTextrahmenErstellen ( "This is a test",20,20,40,30 ) - '/// save file as 'test1' ///' + printlog "save file as 'test1'" hFileSaveAsKill (Dokument$ + "." + ExtensionString) Sleep 10 - '/// close Document ///' + printlog "close Document" hCloseDocument - printlog "- Document Saved and Closed" + printlog "Document Saved and Closed" - '/// load document 'test1' ///' + printlog "load document 'test1'" hFileOpen (Dokument$ + "." + ExtensionString) - Sleep 10 - '/// close Document ///' - hCloseDocument - printlog "- document Loaded and closed" - Sleep 10 - '/// load document 'test1' ///' - hFileOpen (Dokument$ + "." + ExtensionString) - ' check if the document is writable - if fIsDocumentWritable = false then - ' make the document writable and check if it's succesfull - if fMakeDocumentWritable = false then - warnlog "The document can't be make writeable. Test stopped." - goto endsub - endif - endif - Sleep 10 - gMouseclick 90,90 - '/// create another textbox with content ///' - Call hTextrahmenerstellen ( "Change",60,60,80,80 ) - '/// File->Close needn't work, just say CANCEL to the question about saving changes! ///' - FileClose - Kontext ' message about 'something changed should i [overwrite discard cancel]?' - if Messagebox.exists (5) then + Sleep 10 + printlog "close Document" + hCloseDocument + printlog "- document Loaded and closed" + Sleep 10 + printlog "load document 'test1'" + hFileOpen (Dokument$ + "." + ExtensionString) + printlog "check if the document is writable" + if fIsDocumentWritable = false then + printlog "make the document writable and check if it's succesfull" + if fMakeDocumentWritable = false then + warnlog "The document can't be make writeable. Test stopped." + goto endsub + endif + endif + Sleep 10 + gMouseclick 90,90 + printlog "create another textbox with content" + Call hTextrahmenerstellen ( "Change",60,60,80,80 ) + printlog "File->Close needn't work, just say CANCEL to the question about saving changes!" + FileClose + Kontext + printlog "message about 'something changed should i [overwrite discard cancel]?'" + if Messagebox.exists (5) then printlog "2:"+messagebox.gettext Messagebox.Cancel - else + else Warnlog "Mesagebox is missing :-(" - endif - printlog "- Document loaded, changed and closed discarding all changes" + endif + printlog "Document loaded, changed and closed discarding all changes" - printlog "- Last version" - try - FileReload '/// File Reload ///' + printlog "Last version" + try + printlog "File Reload" + FileReload + catch + kontext "DocumentImpress" + try + printlog "File Reload" + FileReload catch - kontext "documentimpress" - try - FileReload '/// File Reload ///' - catch - warnlog "Damn reload ?? Why ? BREAKPOINT! File reload doesn't work. Create new object and try again :-(" + warnlog "BREAKPOINT! File reload doesn't work. Create new object and try again :-(" endcatch endcatch Kontext @@ -128,22 +131,24 @@ testcase tFileOpenSaveEtc if GetClipboardText = "Change" then Warnlog "- Last version not loaded. Changes in the document still in." printlog "- Change document, save it under different name" Kontext "DocumentImpress" - Call hTextrahmenErstellen ("Change2",10,10,50,20 ) '/// new textbox ///' + printlog "new textbox" + Call hTextrahmenErstellen ("Change2",10,10,50,20 ) gMouseclick 90,90 sleep 1 - FileSaveAs - Kontext "SpeichernDlg" - Dateiname.SetText Dokument2$ - Speichern.Click - kontext "AlienWarning" - if AlienWarning.exists(5) then - warnlog "#i41983# Alien Warning on export not allowed" - AlienWarning.OK - endif - Kontext "Messagebox" - if Messagebox.Exists(2) then Messagebox.Yes + FileSaveAs + Kontext "SpeichernDlg" + Dateiname.SetText Dokument2$ + Speichern.Click + kontext "AlienWarning" + if AlienWarning.exists(5) then + warnlog "#i41983# Alien Warning on export not allowed" + AlienWarning.OK + endif + Kontext "Messagebox" + if Messagebox.Exists(2) then Messagebox.Yes Sleep 3 - FileClose '/// Close document ///' + printlog "Close document" + FileClose sleep 10 Kontext "Messagebox" if Messagebox.Exists Then @@ -152,42 +157,42 @@ testcase tFileOpenSaveEtc end if sleep 2 printlog "- Loading write protected file" - FileOpen '/// Open write protected file ///' + FileOpen + printlog "Open write protected file" Kontext "OeffnenDlg" Dateiname.SetText (Dokument2$ + "." + ExtensionString) NurLesen.Check Oeffnen.Click - Sleep 10 - ' check if the document is writable - try - Call hTextrahmenErstellen ( "Hello",85,85,95,95 ) '/// attempt to create a textbox ///' - hTypeKeys "<SHIFT LEFT>",5 - hTypeKeys "<MOD1 C>" - sleep 1 - if GetClipboardText = "Hello" then Warnlog "Write protected document could be edited" + Sleep 10 + printlog "check if the document is writable" + try + printlog "attempt to create a textbox" + Call hTextrahmenErstellen ( "Hello",85,85,95,95 ) + hTypeKeys "<SHIFT LEFT>",5 + hTypeKeys "<MOD1 C>" + sleep 1 + if GetClipboardText = "Hello" then Warnlog "Write protected document could be edited" catch - Printlog "- Write protected document could not be edited" + Printlog "- Write protected document could not be edited" endcatch sleep 5 - FileClose '/// Close document ///' + printlog "Close document" + FileClose endcase 'tFileOpenSaveEtc -'-------------------------------------------------------- +'------------------------------------------------------------------------------- testcase tFileProperties qaerrorlog "#i88163#, File/properties/user defined fields get mixed up." goto endsub Call hNewDocument Call hTextrahmenErstellen ("This is a document to test the Menupoint in File/Properties",30,30,60,40) - if (gApplication = "IMPRESS") then ExtensionString = "odp" else ExtensionString = "odg" end if - FileProperties - Kontext active.SetPage TabDokumentinfo Kontext "TabDokumentinfo" @@ -212,9 +217,7 @@ testcase tFileProperties RefreshThisDocument.Check TabInternet.OK - hFileSaveAsKill ConvertPath (gOfficePath + "user\work\eigen." & ExtensionString) - FileClose Kontext "Active" if Active.Exists(2) then Active.Yes @@ -223,45 +226,45 @@ testcase tFileProperties Sleep 2 hFileOpen ConvertPath (gOfficePath + "user\work\eigen." + ExtensionString) - ' check if the document is writable + printlog "check if the document is writable" if fIsDocumentWritable = false then - ' make the document writable and check if it's succesfull + printlog "make the document writable and check if it's succesfull" if fMakeDocumentWritable = false then warnlog "The document can't be make writeable. Test stopped." goto endsub endif endif - FileProperties - Kontext - active.SetPage TabDokumentinfo - Kontext "TabDokumentinfo" - if Titel.GetText <> "Properties" then Warnlog "Description / Titel is wrong" - if Thema.GetText <> "Documentproperties" then Warnlog "Description / Thema is wrong" - if Schluesselworte.GetText <> "None" then Warnlog "Description / Keywords is wrong" - - qaerrorlog "#i95523#" - 'Kontext - 'active.SetPage TabBenutzer - 'Kontext "TabBenutzer" - 'if Info2.GetText <> "Thorsten Peters" then Warnlog "User Defined / Info2 is wrong" - - 'Infofelder.Click - 'sleep 2 - 'Kontext "InfonamenBearbeiten" - 'if Namen2.GetText <> "Name" then Warnlog "Edit Field Names / Info2 is wrong" - 'InfonamenBearbeiten.OK - - Kontext - active.SetPage TabInternet - Kontext "TabInternet" - if RefreshThisDocument.IsChecked = FALSE then Warnlog "Internet / 'Refresh this document' is not checked" - - TabInternet.Close - - Call hCloseDocument -endcase - -'******************************************************************************************** + FileProperties + Kontext + active.SetPage TabDokumentinfo + Kontext "TabDokumentinfo" + if Titel.GetText <> "Properties" then Warnlog "Description / Titel is wrong" + if Thema.GetText <> "Documentproperties" then Warnlog "Description / Thema is wrong" + if Schluesselworte.GetText <> "None" then Warnlog "Description / Keywords is wrong" + + qaerrorlog "#i95523#" + 'Kontext + 'active.SetPage TabBenutzer + 'Kontext "TabBenutzer" + 'if Info2.GetText <> "Thorsten Peters" then Warnlog "User Defined / Info2 is wrong" + + 'Infofelder.Click + 'sleep 2 + 'Kontext "InfonamenBearbeiten" + 'if Namen2.GetText <> "Name" then Warnlog "Edit Field Names / Info2 is wrong" + 'InfonamenBearbeiten.OK + + Kontext + active.SetPage TabInternet + Kontext "TabInternet" + if RefreshThisDocument.IsChecked = FALSE then Warnlog "Internet / 'Refresh this document' is not checked" + + TabInternet.Close + + Call hCloseDocument +endcase 'tFileProperties + +'------------------------------------------------------------------------------- testcase tFilePassword52 Dim Datei$ @@ -271,7 +274,6 @@ testcase tFilePassword52 dim sExt() as string sExt = array("d","a") - ' passwo52.sd d-preas a-draw for i = 0 to 1 Datei$ = ConvertPath ( gTesttoolPath + "graphics\required\input\passwo52.sd"+sExt(i) ) hFileOpen(Datei$) @@ -290,9 +292,9 @@ testcase tFilePassword52 endif hCloseDocument next i -endcase +endcase 'tFilePassword52 -'******************************************************************************************** +'------------------------------------------------------------------------------- testcase tFileOpenImport dim q as integer @@ -324,28 +326,28 @@ testcase tFileOpenImport if (gApplication="DRAW") then Call hCloseDocument endif -endcase +endcase 'tFileOpenImport -'******************************************************************************************** +'------------------------------------------------------------------------------- testcase tTestDXF255CharBug -'/// tries to load a DXF-document which has a string-leght of 255 characters. ///' -dim q as integer - call hNewDocument - InsertGraphicsFromFile '/// insert graphic ///' - sleep 1 - kontext "Active" - sleep 1 + printlog "tries to load a DXF-document which has a string-leght of 255 characters." + dim q as integer + call hNewDocument + printlog "insert graphic " + InsertGraphicsFromFile + sleep 1 + kontext "Active" + sleep 1 if Active.Exists Then - Active.OK + Active.OK end if sleep 1 - Kontext "GrafikEinfuegenDlg" - sleep 2 - '/// Dateiname.SetText (ConvertPath (gTesttoolpath + "graphics\required\input\255chars.dxf")) ///' - Dateiname.SetText (ConvertPath (gTesttoolpath + "graphics\required\input\255chars.dxf")) - Oeffnen.Click - Sleep 2 + Kontext "GrafikEinfuegenDlg" + sleep 2 + Dateiname.SetText (ConvertPath (gTesttoolpath + "graphics\required\input\255chars.dxf")) + Oeffnen.Click + Sleep 2 if gApplication = "DRAW" then Kontext "Documentdraw" @@ -375,7 +377,7 @@ dim q as integer Call hCloseDocument endcase 'tTestDXF255CharBug -'******************************************************************************************** +'------------------------------------------------------------------------------- testcase tDeletedTemplate dim i as integer @@ -395,35 +397,35 @@ testcase tDeletedTemplate - '/// delete previous created documents: 'user\\work\\test*.odp' ///' + printlog "delete previous created documents: 'user\\work\\test*.odp'" if Dir (Dokument1$) <> "" then kill Dokument1$ if Dir (Dokument2$) <> "" then kill Dokument2$ - '/// open application ///' + printlog "open application" hNewDocument gMouseclick 90,90 - '/// create a textframe with content ///' + printlog "create a textframe with content" Call hTextrahmenErstellen ( "This is the first file",20,20,40,30 ) - '/// save file as 'test1.odp' ///' + printlog "save file as 'test1.odp'" hFileSaveAsKill (Dokument1$) Sleep 10 - '/// close Document ///' + printlog "close Document" hCloseDocument printlog "- Document 'test1.odp' Saved and Closed" - '/// open application again ///' + printlog "open application again" hNewDocument gMouseclick 90,90 - '/// create another textframe with content ///' + printlog "create another textframe with content" Call hTextrahmenErstellen ( "This is the second file",20,20,40,30 ) - '/// save file as 'test2.odp' ///' + printlog "save file as 'test2.odp'" hFileSaveAsKill (Dokument2$) Sleep 10 - '/// close Document ///' + printlog "close Document" hCloseDocument printlog "- Document 'test2.odp' Saved and Closed" - '/// Delete the first file ///' + printlog "Delete the first file" try kill Dokument1$ Printlog " Correctly deleted the file: " + Dokument1$ @@ -431,28 +433,29 @@ testcase tDeletedTemplate warnlog "Could not delete the file: " + Dokument1$ endcatch - '/// File => New => Presentation ///' - FileAutopilotPresentation '/// new document-autopilot ///' - Kontext "AutopilotPraesentation1" - sleep 5 - Existingpresentation.Check - sleep 5 - kontext "active" - if active.exists then - SavedActiveMessage = Active.GetText - QaErrorLog "Message: " + SavedActiveMessage - active.ok - Kontext "AutopilotPraesentation1" - if Existinglist.GetSelText = "test1.odp" then - warnlog " The deleted File was found. Messagebox said: " + SavedActiveMessage - endif - SavedActiveMessage = "" - endif - Kontext "AutopilotPraesentation1" - Existinglist.TypeKeys "<HOME>" - sleep 5 - found = false - for i = 1 to Existinglist.GetItemCount + printlog "File => New => Presentation" + printlog "new document-autopilot" + FileAutopilotPresentation + Kontext "AutopilotPraesentation1" + sleep 5 + Existingpresentation.Check + sleep 5 + kontext "active" + if active.exists then + SavedActiveMessage = Active.GetText + QaErrorLog "Message: " + SavedActiveMessage + active.ok + Kontext "AutopilotPraesentation1" + if Existinglist.GetSelText = "test1.odp" then + warnlog " The deleted File was found. Messagebox said: " + SavedActiveMessage + endif + SavedActiveMessage = "" + endif + Kontext "AutopilotPraesentation1" + Existinglist.TypeKeys "<HOME>" + sleep 5 + found = false + for i = 1 to Existinglist.GetItemCount kontext "active" if active.exists then SavedActiveMessage = Active.GetText @@ -473,7 +476,7 @@ testcase tDeletedTemplate if found = true then warnlog " An error-message showed up. Eventually a result of '138498'" AutopilotPraesentation1.Cancel Sleep 2 - '/// Delete the second file ///' + printlog "Delete the second file" try kill Dokument2$ Printlog " Correctly deleted the file: " + Dokument2$ @@ -482,7 +485,7 @@ testcase tDeletedTemplate endcatch endcase 'tDeletedTemplate -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutEmpty Dim NewFileDir as String @@ -492,7 +495,6 @@ testcase tSaveLoadLayoutEmpty printlog " Will try to create the directory: " + NewFileDir app.mkdir NewFileDir - gApplication = "IMPRESS" Call hNewDocument @@ -510,13 +512,12 @@ testcase tSaveLoadLayoutEmpty sleep (5) call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below. - - printlog " Will try to delete the directory: " + NewFileDir + printlog "Will try to delete the directory: " + NewFileDir app.rmDir NewFileDir endcase 'tSaveLoadLayoutEmpty -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutOLE qaerrorlog "not yet ready" @@ -525,7 +526,7 @@ testcase tSaveLoadLayoutOLE NewFileDir = ConvertPath (gOfficePath + "user\work\LayoutTest\") - printlog " Will try to create the directory: " + NewFileDir + printlog "Will try to create the directory: " + NewFileDir app.mkdir NewFileDir @@ -563,12 +564,12 @@ testcase tSaveLoadLayoutOLE call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below. - printlog " Will try to delete the directory: " + NewFileDir + printlog "Will try to delete the directory: " + NewFileDir app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir endcase 'tSaveLoadLayoutOLE -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutText qaerrorlog "not yet ready" @@ -580,7 +581,6 @@ testcase tSaveLoadLayoutText printlog " Will try to create the directory: " + NewFileDir app.mkdir NewFileDir - gApplication = "IMPRESS" Call hNewDocument @@ -601,17 +601,16 @@ testcase tSaveLoadLayoutText hTypeKeys ("<TAB><TAB><TAB>") hTypeKeys ("<Return>") hTypeKeys ("<ESCAPE>") - ' LayoutsPreview.TypeKeys "<RETURN>" sleep (5) call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below. - printlog " Will try to delete the directory: " + NewFileDir + printlog "Will try to delete the directory: " + NewFileDir app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir endcase 'tSaveLoadLayoutText -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutOutline qaerrorlog "not yet ready" @@ -623,7 +622,6 @@ testcase tSaveLoadLayoutOutline printlog " Will try to create the directory: " + NewFileDir app.mkdir NewFileDir - gApplication = "IMPRESS" Call hNewDocument @@ -653,7 +651,7 @@ testcase tSaveLoadLayoutOutline endcase 'tSaveLoadLayoutOutline -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutPicture qaerrorlog "not yet ready" @@ -665,7 +663,6 @@ testcase tSaveLoadLayoutPicture printlog " Will try to create the directory: " + NewFileDir app.mkdir NewFileDir - gApplication = "IMPRESS" Call hNewDocument @@ -695,7 +692,7 @@ testcase tSaveLoadLayoutPicture endcase 'tSaveLoadLayoutPicture -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutChart qaerrorlog "not yet ready" @@ -707,7 +704,6 @@ testcase tSaveLoadLayoutChart printlog " Will try to create the directory: " + NewFileDir app.mkdir NewFileDir - gApplication = "IMPRESS" Call hNewDocument @@ -737,7 +733,7 @@ testcase tSaveLoadLayoutChart endcase 'tSaveLoadLayoutChart -'**************************************************************************************************** +'------------------------------------------------------------------------------- testcase tSaveLoadLayoutSpreadsheet qaerrorlog "not yet ready" @@ -749,7 +745,6 @@ testcase tSaveLoadLayoutSpreadsheet printlog " Will try to create the directory: " + NewFileDir app.mkdir NewFileDir - gApplication = "IMPRESS" Call hNewDocument @@ -774,10 +769,10 @@ testcase tSaveLoadLayoutSpreadsheet call fSaveLoadAllFormats (NewFileDir) 'Runs the Function below. - printlog " Will try to delete the directory: " + NewFileDir + printlog "Will try to delete the directory: " + NewFileDir app.rmDir ConvertPath (gOfficePath + "user\work\LayoutTest\")' NewFileDir endcase 'tSaveLoadLayoutSpreadsheet -'**************************************************************************************************** +'------------------------------------------------------------------------------- diff --git a/testautomation/graphics/optional/includes/global/g_mediaplayer.inc b/testautomation/graphics/optional/includes/global/g_mediaplayer.inc index 5961a2132467..f78cdf816815 100644 --- a/testautomation/graphics/optional/includes/global/g_mediaplayer.inc +++ b/testautomation/graphics/optional/includes/global/g_mediaplayer.inc @@ -47,37 +47,39 @@ testcase g_mediaplayer goto endsub endif Datei$ = ConvertPath (convertPath (gTesttoolPath + "graphics\required\input\29secsound.wav")) - '/// Open New Document ///' + printlog "Open New Document" Call hNewDocument sleep 2 - '/// Check if the Media Player already exists - if so - close it ///' + printlog "Check if the Media Player already exists - if so - close it" kontext "mPlayer" - if mPlayer.exists then ' Close the MediaPlayer - warnlog "The MediaPlayer was visible since some earlier test. Plese notify FHA." + printlog "Close the MediaPlayer if it is open already" + if mPlayer.exists then + warnlog "The MediaPlayer was visible since some earlier test." ToolsMediaPlayer printlog "Closed the Media Player" endif - '/// Tools - MediaPlayer ///' + printlog "Tools - MediaPlayer" ToolsMediaPlayer sleep 2 - '/// Open file ///' 'a bigger / longer one + printlog "Open file" kontext "mPlayer" if mPlayer.exists then printlog "The MediaPlayer was open." else - warnlog "Tools - MediaPlayer didnt work. The MediaPlayer wasnt visible. Aborting test." - Call hCloseDocument '/// Close document ///' - goto endsub + warnlog "Tools - MediaPlayer didnt work. The MediaPlayer wasnt visible. Aborting test." + printlog "Close document" + Call hCloseDocument + goto endsub endif Mopen.Click kontext "OeffnenDlg" Pfad.SetText Datei$ Oeffnen.Click - '/// This test wont work correctly under Solaris and Linux, ///' - '/// unless some optional Media-libraries are installed. ///' - '/// Therefore we warn the tester about it if we cannot open the file. ///' + printlog "This test wont work correctly under Solaris and Linux," + printlog "unless some optional Media-libraries are installed." + printlog "Therefore we warn the tester about it if we cannot open the file." iWaitIndex = 0 do while OeffnenDlg.Exists AND iWaitIndex < 10 @@ -90,7 +92,8 @@ testcase g_mediaplayer Active.OK kontext "Mplayer" ToolsMediaPlayer - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument goto endsub else kontext "Mplayer" @@ -99,7 +102,7 @@ testcase g_mediaplayer timevalue1 = mTimeedit.GetText - '/// Stop ///' + printlog "Stop" sleep 2 mStop.Click printlog "Just pressed stop." @@ -109,17 +112,18 @@ testcase g_mediaplayer timevalue3 = mTimeedit.GetText printlog "The time was: " + mTimeedit.GetText if timevalue1 = timevalue2 AND timevalue2 = timevalue3 then - if gtSYSName <> "WinXP" then '("Solaris x86" OR "Linux" OR "Solaris") then - warnlog "The sound doesnt seem to be played at all. And since the test is run on a platform which needs extra libraries, the test ends now." - kontext "Mplayer" - if Mplayer.Exists(3) then - ToolsMediaPlayer - endif - Call hCloseDocument '/// close document ///' - goto endsub - else - warnlog "The sound doesnt seem to be played at all, but I will continue the test. The platform was: " + gtSYSName - endif + if gtSYSName <> "WinXP" then '("Solaris x86" OR "Linux" OR "Solaris") then + warnlog "The sound doesnt seem to be played at all. And since the test is run on a platform which needs extra libraries, the test ends now." + kontext "Mplayer" + if Mplayer.Exists(3) then + ToolsMediaPlayer + endif + printlog "close document" + Call hCloseDocument + goto endsub + else + warnlog "The sound doesnt seem to be played at all, but I will continue the test. The platform was: " + gtSYSName + endif else if timevalue1 <> timevalue2 AND timevalue2 = timevalue3 then Printlog "the stop-button seemed to work. Good." @@ -127,7 +131,7 @@ testcase g_mediaplayer warnlog "Very strange. The first value was: " + timevalue1 + ". Second: " + timevalue2 + ". Third: " + timevalue3 endif endif - '/// Play ///' + printlog "Play" ' Save value timevalue1 = mTimeedit.GetText ' Press 'Play' @@ -141,7 +145,7 @@ testcase g_mediaplayer Printlog "the play-button seemed to work. Good." endif - '/// Pause ///' + printlog "Pause" mPlay.Click sleep 10 mPause.Click @@ -156,19 +160,23 @@ testcase g_mediaplayer Printlog "the pause-button seemed to work. Good." endif - '/// Time ///' - mStop.Click 'to get to the beginning. - sleep 1 'And make sure it's really the beginning. + printlog "Time" + printlog " Click Stop to get to the beginning." + mStop.Click + sleep 1 + printlog "And make sure it's really the beginning." timevalue1 = mTimeedit.GetText if timevalue1 <> "00:00:00 / 00:00:29" then warnlog "Expected the time to go back to 00:00:00, but was " + timevalue1 + " instead." - mStop.Click 'to make another try to get to the beginning again. + printlog "to make another try to get to the beginning again." + mStop.Click ' else printlog "Sound stopped, time-value set to 00:00:00." endif printlog "We press 'Play'" - mPlay.Click 'to get it running + printlog "Click play to get it running" + mPlay.Click sleep 5 timefound = 0 @@ -192,41 +200,34 @@ testcase g_mediaplayer warnlog "Either the time didnt change, or the test-computer is too fast." endif - '-Repeat - 'Plays the file repeatedly. - '/// Loop ///' + printlog "Loop" mLoop.Click - '/// Volume ///' - 'mVolume. 'Click - '-Volume slider - 'Adjusts the volume. + printlog "Volume" - '/// Mute ///' + printlog "Mute" mMute.Click sleep 1 mMute.Click - '-Mute - 'Turns sound off and on. - '/// Time-slider ///' + printlog "Time-slider" ' mTimeslider. 'Click '-Position slider 'Moves to a different position in the file. - '/// Scroll-whatever ///' + printlog "Scroll-whatever" 'mZoomlistbox. '-Zoom 'Adjusts the size of the movie playback. - '/// Apply ///' + printlog "Apply" mInsert.Click sleep 10 - '/// Close the MediaPlayer via Tools - MediaPlayer ///' + printlog "Close the MediaPlayer via Tools - MediaPlayer" ToolsMediaPlayer - '/// Check if there is an object available. ///' + printlog "Check if there is an object available." if (gApplication = "IMPRESS") then kontext "DocumentImpress" else @@ -242,15 +243,15 @@ testcase g_mediaplayer Kontext "TabPositionAndSize" if Width.Exists then Printlog "Position and Size came up, object inserted correctly." - '/// Close dialog TabPositionAndSize with 'OK' ///' + printlog "Close dialog TabPositionAndSize with 'OK'" TabPositionAndSize.OK else Warnlog "Position And Size didn't come up, was there no sound-object inserted?" endif sleep 2 - '/// close document ///' - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument else qaerrorLog "#74350# - Different strings in g_mediaplayer under Italian." endif -endcase +endcase
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/global/g_shaddow.inc b/testautomation/graphics/optional/includes/global/g_shaddow.inc index 1dfd01f305aa..7732cc5bc7e8 100644 --- a/testautomation/graphics/optional/includes/global/g_shaddow.inc +++ b/testautomation/graphics/optional/includes/global/g_shaddow.inc @@ -54,19 +54,19 @@ testcase tiShaddow dim linewidth as string dim cornerstyletype as string - '/// Set the file-extension we'll be using when opening the saved file ///' + printlog "Set the file-extension we'll be using when opening the saved file " if (gApplication = "IMPRESS") then ExtensionString = "odp" else ExtensionString = "odg" end if - '/// Open application ///' + printlog "Open application " Call hNewDocument Call sSelectEmptyLayout sleep 1 - '/// Import picture ///' + printlog "Import picture " InsertGraphicsFromFile sleep 3 kontext "Active" @@ -81,10 +81,10 @@ testcase tiShaddow Oeffnen.Click printlog "Inserted file" sleep 2 - '/// Select all ///' + printlog "Select all" EditSelectAll sleep 3 - '/// Check values and save them ///' + printlog "Check values and save them" FormatPositionAndSize kontext active.SetPage TabPositionAndSize @@ -92,11 +92,11 @@ testcase tiShaddow ImageWidth = Width.GetText ImageHeight = Height.GetText printlog "Got values from position and size" - '/// Check the "Protect Size"-button. And close dialogue. ///' + printlog "Check the Protect Size-button. And close dialogue. " ProtectSize.Check TabPositionAndSize.Ok - '/// Add Shaddow via Toolbar-Button ///' + printlog "Add Shaddow via Toolbar-Button " Kontext "GraphicObjectbar" if GraphicObjectbar.Exists = FALSE then ViewToolbarsPicture @@ -106,21 +106,21 @@ testcase tiShaddow end if sleep 1 - '/// click button 'Shadow' ///' - Schatten.Click -' '/// Check and save Shaddow-values via context-menu ///' - EditSelectAll - hOpenContextMenu - sleep(2) - if hMenuFindSelect(10142, true, 4) = false then + printlog "click button 'Shadow'" + Schatten.Click + printlog " Check and save Shaddow-values via context-menu " + EditSelectAll + hOpenContextMenu + sleep(2) + if hMenuFindSelect(10142, true, 4) = false then Warnlog "Context-Menu-entry `Area` was not found. Therefore the test ends." Call hCloseDocument Goto Endsub - endif - '/// Select Contextmenu entry "Area" ///' - sleep(2) + endif + printlog " Select Contextmenu entry Area " + sleep(2) kontext "TabArea" - '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue + printlog "Switch to Shaddow-tabpage, do some changes, save them, close dialogue" Kontext active.SetPage TabSchatten kontext "TabSchatten" @@ -131,20 +131,20 @@ testcase tiShaddow Warnlog "'Use Shadow' doesn't exist or isn't visible." endif - '/// Change Distance and Transparency-values ///' - Entfernung.More ',2 - Transparenz.More ',2 - shadowdistancevalue = Entfernung.GetText - shadowcolorvalue = Farbe.GetSelText - shadowtransparencyvalue = Transparenz.GetText - printlog "Got values from TabArea" - TabSchatten.Ok + printlog "Change Distance and Transparency-values " + Entfernung.More ',2 + Transparenz.More ',2 + shadowdistancevalue = Entfernung.GetText + shadowcolorvalue = Farbe.GetSelText + shadowtransparencyvalue = Transparenz.GetText + printlog "Got values from TabArea" + TabSchatten.Ok - '/// Check if it's the same when going over FormatArea ///' + printlog "Check if it's the same when going over FormatArea " FormatArea sleep 1 kontext "TabArea" - '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue ///' + printlog "Switch to Shaddow-tabpage, do some changes, save them, close dialogue " Kontext active.SetPage TabSchatten kontext "TabSchatten" @@ -165,23 +165,23 @@ testcase tiShaddow endif TabSchatten.Ok - '/// Add Cornerstyle via FormatLine ///' - FormatLine - Kontext - Messagebox.SetPage TabLinie - kontext "TabLinie" - Stil.Select 2 ' Select Continuously. - linetype = Stil.GetItemText - Farbe.Select 2 ' Select Blue - linecolour = Farbe.GetItemText - Breite.More 3 ' Set Width to 3 - linewidth = Breite.Gettext - CornerStyle.Select 4 ' Select number four: Beveled - cornerstyletype = CornerStyle.GetSelText - printlog "Cornerstyle is: " + CornerStyle.GetSelText '+ cornerstyletype + printlog "Add Cornerstyle via FormatLine " + FormatLine + Kontext + Messagebox.SetPage TabLinie + kontext "TabLinie" + Stil.Select 2 ' Select Continuously. + linetype = Stil.GetItemText + Farbe.Select 2 ' Select Blue + linecolour = Farbe.GetItemText + Breite.More 3 ' Set Width to 3 + linewidth = Breite.Gettext + CornerStyle.Select 4 ' Select number four: Beveled + cornerstyletype = CornerStyle.GetSelText + printlog "Cornerstyle is: " + CornerStyle.GetSelText '+ cornerstyletype TabLinie.ok - '/// Check values via PositionAndSize via the Contextmenu ///' + printlog "Check values via PositionAndSize via the Contextmenu " hOpenContextmenu sleep(2) if hMenuFindSelect(10087, true, 1) = false then @@ -189,35 +189,35 @@ testcase tiShaddow Call hCloseDocument Goto Endsub endif - 'Select "Position and Size" - sleep(2) - Kontext - Active.SetPage TabPositionAndSize - Kontext "TabPositionAndSize" - if ImageWidth <> Width.GetText then warnlog "Position X differs. Should be: " + ImageWidth + " But is: " + Width.GetText - if ImageHeight <> Height.GetText then warnlog "Position Y differs. Should be: " + ImageHeight + " But is: " + Height.GetText + printlog "Select Position and Size" + sleep(2) + Kontext + Active.SetPage TabPositionAndSize + Kontext "TabPositionAndSize" + if ImageWidth <> Width.GetText then warnlog "Position X differs. Should be: " + ImageWidth + " But is: " + Width.GetText + if ImageHeight <> Height.GetText then warnlog "Position Y differs. Should be: " + ImageHeight + " But is: " + Height.GetText TabPositionAndSize.OK - '/// Check Cornerstyle via FormatLine ///' - FormatLine - Kontext - Messagebox.SetPage TabLinie - kontext "TabLinie" - if linetype <> Stil.GetItemText then warnlog "Linetype should be: " + linetype + " But is: " + Stil.GetItemText - if linecolour <> Farbe.GetItemText then warnlog "Linecolour should be: " + linetype + " But is: " + Farbe.GetItemText - if linewidth <> Breite.GetText then warnlog "Linewidth should be: " + linewidth + " But is: " + Breite.GetText - if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText - TabLinie.ok - - '/// Check if the Shaddow-button is activated ///' - Kontext "GraphicObjectbar" - if Schatten.GetState(2) <> 1 then - warnlog "Shaddow-button shouldnt have been checked" - endif + printlog "Check Cornerstyle via FormatLine " + FormatLine + Kontext + Messagebox.SetPage TabLinie + kontext "TabLinie" + if linetype <> Stil.GetItemText then warnlog "Linetype should be: " + linetype + " But is: " + Stil.GetItemText + if linecolour <> Farbe.GetItemText then warnlog "Linecolour should be: " + linetype + " But is: " + Farbe.GetItemText + if linewidth <> Breite.GetText then warnlog "Linewidth should be: " + linewidth + " But is: " + Breite.GetText + if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText + TabLinie.ok + + printlog "Check if the Shaddow-button is activated " + Kontext "GraphicObjectbar" + if Schatten.GetState(2) <> 1 then + warnlog "Shaddow-button shouldnt have been checked" + endif - '/// Save the file. Then close the office and reload the file ///' + printlog "Save the file. Then close the office and reload the file " sFileName = ( ConvertPath(gOfficePath + "user\work\shaddow-test")) - '/// File-Save As with filter as: "user\temp\shaddow-test" ///' + printlog "File-Save As with filter as: user\temp\shaddow-test " try FileSaveAs Kontext "SpeichernDlg" @@ -233,12 +233,12 @@ testcase tiShaddow warnlog "Error when saving file." endcatch - '/// Close the office-session ///' + printlog "Close the office-session " FileClose Kontext "Messagebox" if Messagebox.Exists(2) then Messagebox.Yes Sleep 3 - '/// Open the saved file ///' + printlog "Open the saved file " try hFileOpen sFileName + "." + ExtensionString Sleep 3 @@ -247,11 +247,11 @@ testcase tiShaddow warnlog "Error when opening file." endcatch - '/// Select all ///' + printlog "Select all " EditSelectAll sleep 2 - '/// Check if the Shaddow-button still is activated ///' + printlog "Check if the Shaddow-button still is activated " kontext "GraphicObjectbar" if schatten.Getstate(2) <> 1 then warnlog "The Shadow-button should be activated" @@ -259,7 +259,7 @@ testcase tiShaddow Printlog "Shaddowbutton activated, good." endif - '/// Check the attributes for the picture ///' + printlog "Check the attributes for the picture " hOpenContextmenu sleep(2) if hMenuFindSelect(10087, true, 1) = false then @@ -267,7 +267,7 @@ testcase tiShaddow Call hCloseDocument Goto Endsub endif - 'Select "Position and Size" + printlog "Position and Size" sleep(2) Kontext Active.SetPage TabPositionAndSize @@ -279,7 +279,7 @@ testcase tiShaddow FormatArea sleep 1 kontext "TabArea" - '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue ///' + printlog "Switch to Shaddow-tabpage, do some changes, save them, close dialogue " Kontext active.SetPage TabSchatten kontext "TabSchatten" @@ -293,7 +293,7 @@ testcase tiShaddow if shadowcolorvalue <> Farbe.GetSelText then warnlog "Color value changed. Should be: " + shadowcolorvalue + ". But is: " + Farbe.gettext if shadowtransparencyvalue <> Transparenz.GetText then warnlog "Transparency value changed. Should be: " + shadowtransparencyvalue + ". But is: " + Transparenz.gettext - '/// Check Transparency ///' + printlog "Check Transparency" Kontext Active.SetPage TabTransparenz kontext "TabTransparenz" @@ -306,7 +306,7 @@ testcase tiShaddow kontext "TabSchatten" TabSchatten.Ok - '/// Check Cornerstyle via FormatLine ///' + printlog "Check Cornerstyle via FormatLine " FormatLine Kontext Messagebox.SetPage TabLinie @@ -317,7 +317,7 @@ testcase tiShaddow if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText TabLinie.ok - '/// If Impress: Save as Powerpoint-file. If Draw: Save as usual Draw-file. ///' + printlog "If Impress: Save as Powerpoint-file. If Draw: Save as usual Draw-file. " if (gApplication = "IMPRESS") then ExtensionString = "ppt" else @@ -344,19 +344,19 @@ testcase tiShaddow printlog "Saved as: " + sFileName Sleep 3 - '/// Close the office and reload the file ///' + printlog "Close the office and reload the file" FileClose Kontext "Messagebox" if Messagebox.Exists(2) then Messagebox.Yes Sleep 3 - '/// Open the saved file ///' + printlog " Open the saved file " hFileOpen (sFileName + "." + ExtensionString) printlog "File opened: " + sFileName + "." + ExtensionString Sleep 3 - '/// Select all ///' + printlog "Select all" EditSelectAll - '/// Check the attributes for the picture ///' + printlog "Check the attributes for the picture" hOpenContextmenu sleep(2) if hMenuFindSelect(10087, true, 1) = false then @@ -364,7 +364,7 @@ testcase tiShaddow Call hCloseDocument Goto Endsub endif - 'Select "Position and Size" + printlog "Select Position and Size" sleep(2) Kontext Active.SetPage TabPositionAndSize @@ -373,7 +373,7 @@ testcase tiShaddow if ImageHeight <> Height.GetText then warnlog "Position X differs. Should be: " + ImageHeight + " But is: " + Height.GetText TabPositionAndSize.OK - '/// Check if transparency has disappeared and if the cornerstyle has changed ///' + printlog "Check if transparency has disappeared and if the cornerstyle has changed" FormatArea Kontext Messagebox.SetPage TabTransparenz @@ -402,7 +402,7 @@ testcase tiShaddow TabTransparenz.Cancel - '/// Check Cornerstyle via FormatLine ///' + printlog "Check Cornerstyle via FormatLine " FormatLine Kontext Messagebox.SetPage TabLinie @@ -413,7 +413,7 @@ testcase tiShaddow if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText TabLinie.ok - '/// Remove the Shaddow, Transparency and Cornerstyle ///' + printlog "Remove the Shaddow, Transparency and Cornerstyle" FormatArea Kontext Messagebox.SetPage TabTransparenz @@ -421,14 +421,14 @@ testcase tiShaddow KeineTransparenz.Check sleep 1 kontext "TabArea" - '/// Switch to Shaddow-tabpage, do some changes, save them, close dialogue ///' + printlog "Switch to Shaddow-tabpage, do some changes, save them, close dialogue" Kontext active.SetPage TabSchatten kontext "TabSchatten" Anzeigen.UnCheck TabSchatten.Ok - '/// If Impress: Save as Powerpoint-file. If Draw: Save as usual Draw-file. ///' + printlog "If Impress: Save as Powerpoint-file. If Draw: Save as usual Draw-file." if (gApplication = "IMPRESS") then ExtensionString = "ppt" else @@ -454,19 +454,19 @@ testcase tiShaddow printlog "Saved as: " + sFileName Sleep 3 - '/// Close the office-session ///' + printlog "Close the office-session" FileClose Kontext "Messagebox" if Messagebox.Exists(2) then Messagebox.Yes Sleep 3 - '/// Open the saved file ///' + printlog "Open the saved file" hFileOpen (sFileName + "." + ExtensionString) printlog "File opened: " + sFileName + "." + ExtensionString Sleep 3 - '/// Select all ///' + printlog "Select all" EditSelectAll - '/// Check the attributes for the picture ///' + printlog "Check the attributes for the picture" hOpenContextmenu sleep(2) if hMenuFindSelect(10087, true, 1) = false then @@ -474,7 +474,7 @@ testcase tiShaddow Call hCloseDocument Goto Endsub endif - 'Select "Position and Size" + printlog "Select Position and Size" sleep(2) Kontext Active.SetPage TabPositionAndSize @@ -483,7 +483,7 @@ testcase tiShaddow if ImageHeight <> Height.GetText then warnlog "Position X differs. Should be: " + ImageHeight + " But is: " + Height.GetText TabPositionAndSize.OK - '/// Check if transparency has disappeared ///' + printlog "Check if transparency has disappeared " FormatArea Kontext Messagebox.SetPage TabTransparenz @@ -495,7 +495,7 @@ testcase tiShaddow end if TabTransparenz.Cancel - '/// Check if the cornerstyle has changed via FormatLine ///' + printlog "Check if the cornerstyle has changed via FormatLine " FormatLine Kontext Messagebox.SetPage TabLinie @@ -506,7 +506,7 @@ testcase tiShaddow if cornerstyletype <> CornerStyle.GetSelText then warnlog "CornerStyle should be: " + cornerstyletype + " But is: " + CornerStyle.GetSelText 'ItemText TabLinie.ok - '/// Close application ///' + printlog "Close application" Call hCloseDocument Printlog "Finished Shaddow-test for " + gApplication diff --git a/testautomation/graphics/optional/includes/global/g_spellcheck.inc b/testautomation/graphics/optional/includes/global/g_spellcheck.inc index e1f02de039cc..bd9cf36bb814 100644 --- a/testautomation/graphics/optional/includes/global/g_spellcheck.inc +++ b/testautomation/graphics/optional/includes/global/g_spellcheck.inc @@ -100,6 +100,133 @@ testcase tiToolsSpellcheckCheck_AlwaysIgnore kill (convertPath(gOfficePath+"user/work/"+"recht_"+iSprache+sExt)) endcase 'tiToolsSpellcheckCorrect +'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ +testcase tiToolsSpellcheckError + if iSprache = 48 then + qaerrorlog "This test is not adapted for polish, 48." + got endsub + endif + Dim Fehler$ + Dim Sprachenname$ + Dim Dummy$ + Dim FehlerText$ + Dim i as integer + + printlog "New document" + Call hNewDocument + printlog "Selecting language case: " & iSprache + select case iSprache + case 01 : FehlerText$ = "Thatt is a failure test." : Fehler$ = "Thatt" : Sprachenname$ = "English (US)" + case 34 : FehlerText$ = "Ezte es un chico muy importante." : Fehler$ = "Ezte" : Sprachenname$ = "Niederlaendisch" + case 33 : FehlerText$ = "Ler nous faut donc un de temps pour examiner." : Fehler$ = "Ler" : Sprachenname$ = "Franzoesisch" + case 36 : FehlerText$ = "Boszniai americkai kontingens háromnegyedesek – mintegy négyezer katona – magyarországi telepítése egy éven belül megtörténhet" : Fehler$ = "tellepítésel" : Sprachenname$ = "Ungarisch" + case 39 : FehlerText$ = "Ringrarziamo per l'interessa mostrato a collaborare con la firma." : Fehler$ = "Ringrarziamo" : Sprachenname$ = "Italienisch" + case 46 : FehlerText$ = "Detd varierar vad som behandlas och ur vilket perspektiv." : Fehler$ = "Detd" : Sprachenname$ = "Schwedisch" + case 49 : FehlerText$ = "Diees ist ein Fehler." : Fehler$ = "Diees" : Sprachenname$ = "Deutsch" + case 50 : FehlerText$ = "Toje napaka, ker manjka presledek." : Fehler$ = "Toje" : Sprachenname$ = "Slovenš�?ina" + case 55 : FehlerText$ = "Eesta poderia ser a resposta para suas preces?": Fehler$ = "Eesta" : Sprachenname$ = "Portugiesisch" + case else : + if bAsianLan then + printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-) using english" + FehlerText$ = "Thatt is a failure test." + Fehler$ = "Thatt" + Sprachenname$ = "English (US)" + call hSetSpellHypLanguage + else + Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" + end if + end select + printlog "Error Text taken for testing is: " & FehlerText$ + sleep 2 + + printlog "Delete ignore word list" + if (not wIgnorierenlisteLoeschen) then + qaErrorLog "Can't get into Dictionary lists" + goto endsub + end if + printlog "Setting doc language to english" + ToolsOptions + Kontext "ExtrasOptionenDlg" + hToolsOptions("LANGUAGESETTINGS","Languages") + Westlich.Select 34 + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + printlog "Create 1 textbox with 1 spelling error (test replace always)" + hTextrahmenErstellen (FehlerText$,30,30,90,40) + + hTypeKeys "<HOME>" + printlog "Call 'Tools->Spellcheck->Check'" + ToolsSpellcheck + printlog "Spellcheck dialog has to come up, wrong word is selected." + Kontext "Spellcheck" + if Spellcheck.Exists then + printlog "There has to be at least ONE suggestion." + if (Suggestions.GetItemCount < 1) then + printlog "If no suggestion avilable:" + warnlog " - no suggestion for the language: "+DictionaryLanguage.GetSelIndex+" '"+DictionaryLanguage.GetSelText+"' , press check button..." + printlog "+ press button 'Check word'" + Pruefen.click + if (Suggestions.GetItemCount < 1) then + warnlog " STILL no suggestions :-( errors will follow " + else + printlog " - now suggestion for the language: "+DictionaryLanguage.GetSelIndex+" '"+DictionaryLanguage.GetSelText+"'" + Suggestions.GetItemCount + end if + end if + Dummy$=Suggestions.GetItemText (1) + printlog "Select first spellcheck suggestion (click it!)." + Suggestions.Select (1) + printlog "Check if textfield 'word' has changed to selected word." + if (Suggestions.GetSelText <> Dummy$) Then + Warnlog "Suggestion not used" + else + Printlog "Suggestion is used" + end if + sleep 1 + kontext "Spellcheck" + printlog "click button 'Always replace'" + ChangeAll.Click + printlog "spellcheck dialog has to disappear and" + printlog "There has to come up only one active: 'Spellcheck of entire document has been completed [OK]'" + Kontext "Active" + if Active.Exists(5) then + Printlog "Message: Spellchecking has finished?: '" + active.gettext + "'" + Active.OK + else + Printlog "'Change All' seems to have worked correctly." + Kontext "Spellcheck" + Spellcheck.Close + Kontext "Active" + if active.exists(5) then + Printlog "Spellcheck dialog closed'" + active.gettext + "'" + Active.OK + else + Printlog "Spellcheck dialog closed'" + end if + end if + else + Warnlog " Error not recognized by the Spellchecker" + if active.exists(5) then + Kontext "Active" + printlog "Message: spellchecking has finished?: '" + active.gettext + "'" + Active.OK + end if + end if + + printlog "Close dialog 'Edit Custom Dictionary'." + BenutzerwoerterbuchBearbeiten.Close + Kontext "ExtrasOptionenDlg" + printlog "Close the Option dialog." + ExtrasOptionenDlg.OK + + printlog "Close document" + Call hCloseDocument + + ' remove the word again from the dictionary + delete_word_from_dictionary(sWrongWord,"IgnoreAllList") + + kill (convertPath(gOfficePath+"user/work/"+"recht_"+iSprache+sExt)) +endcase 'tiToolsSpellcheckCorrect + '------------------------------------------------------------------------------- testcase tiToolsSpellcheckCheck_Change diff --git a/testautomation/graphics/optional/includes/global/g_stylist.inc b/testautomation/graphics/optional/includes/global/g_stylist.inc index f09e6c0fd433..71d05f7d704c 100644 --- a/testautomation/graphics/optional/includes/global/g_stylist.inc +++ b/testautomation/graphics/optional/includes/global/g_stylist.inc @@ -38,17 +38,18 @@ testcase tFormatStylistFlyer Dim ySize% printlog " - Format/Stylist : using all possible things to manipulate the flyer" - '/// open application ///' + printlog "open application" Call hNewDocument Kontext "Gestalter" - '/// Check if stylist is there. Expected: not there ///' + printlog "Check if stylist is there. Expected: not there" if Gestalter.NotExists = false Then - qaErrorLog " - Expected Stylist to be closed; But is Open. Check tests." + qaErrorLog "Expected Stylist to be closed; But is Open. Check tests." else if lcase(gPlatform) = "osx" then hTypekeys "<mod1 t>" else - hTypekeys "<F11>" '/// open stylist by pressing key [F11] ///' + printlog "open stylist by pressing key [F11]" + hTypekeys "<F11>" end if sleep 1 end if @@ -57,51 +58,51 @@ testcase tFormatStylistFlyer Warnlog " No stylist popped up using F11; opening now via slotID" FormatStylist end if - '///+ save stylist position and size ///' + printlog "save stylist position and size" xPos% = Gestalter.GetPosX yPos% = Gestalter.GetPosY xSize% = Gestalter.GetSizeX ySize% = Gestalter.GetSizeY - '///+ if Stylist is docked; undock ///' + printlog " if Stylist is docked; undock" if Gestalter.IsDocked then Gestalter.UnDock - printlog " - '///move stylist ///" - '///+ move stylist to 10,10 ///' + printlog " move stylist" + printlog "move stylist to 10,10" Gestalter.Move 10, 10 Sleep 1 - '///+ move stylist to 300,400 ///' + printlog "move stylist to 300,400" Gestalter.Move 300, 400 Sleep 1 - '///+ move stylist to 590,790 ///' + printlog "move stylist to 590,790" Gestalter.Move 590, 790 Sleep 1 - '///+ move stylist back to saved start position ///' + printlog " move stylist back to saved start position" Gestalter.Move xPos%, yPos% Sleep 1 - printlog " - '///size stylist ///" - '///+ change size to 200,200 ///' + printlog "size stylist" + printlog "change size to 200,200" Gestalter.Size 200, 200 Sleep 1 - '///+ change size to 300,400 ///' + printlog "change size to 300,400" Gestalter.Size 300, 400 Sleep 1 - '///+ change size to 150,250 ///' + printlog "change size to 150,250" Gestalter.Size 150, 250 Sleep 1 - '///+ change size back to saved size ///' + printlog "change size back to saved size" Gestalter.Size xSize%, ySize% Sleep 1 - printlog " - Close stylist reopen stylist, check if appearence is same as before" - '/// save stylist position and size ///' + printlog "Close stylist reopen stylist, check if appearence is same as before" + printlog "save stylist position and size" xPos% = Gestalter.GetPosX yPos% = Gestalter.GetPosY xSize% = Gestalter.GetSizeX ySize% = Gestalter.GetSizeY - '/// close stylist Format->Stylist ///' + printlog "close stylist Format->Stylist" FormatStylist Sleep 1 - '/// open stylist Format->Stylist ///' + printlog "open stylist Format->Stylist" FormatStylist sleep (1) if xPos% <> Gestalter.GetPosX then Warnlog "The x-Pos. has changed : Should be -> '"+ xPos% + "' Is -> '"+ Gestalter.GetPosX +"'." @@ -110,29 +111,29 @@ testcase tFormatStylistFlyer if ySize% <> Gestalter.GetSizeY then Warnlog "The y-Size has changed : Should be -> '"+ ySize% + "' Is -> '"+ Gestalter.GetSizeY +"'." printlog " - dock stylist" - '/// dock stylist ///' + printlog "dock stylist" Gestalter.Dock Sleep 1 if (NOT Gestalter.IsDocked) then warnlog " stylist not docked but should" endif - '/// UNdock stylist ///' + printlog "UNdock stylist" if (Gestalter.IsDocked) Then Gestalter.UnDock endif Sleep 1 printlog " - maximize/minimize stylist" - '/// minimize stylist ///' + printlog "minimize stylist" Gestalter.Minimize Sleep 1 - '/// maximize stylist ///' + printlog "maximize stylist" Gestalter.Maximize Sleep 1 if (NOT Gestalter.IsMax) then warnlog " The stylist did not return to maximized state" endif - '/// close stylist ///' + printlog "close stylist" Gestalter.Close Call hCloseDocument diff --git a/testautomation/graphics/optional/includes/global/g_tables.inc b/testautomation/graphics/optional/includes/global/g_tables.inc index 410ed8ca0fc6..10774ab43d76 100644 --- a/testautomation/graphics/optional/includes/global/g_tables.inc +++ b/testautomation/graphics/optional/includes/global/g_tables.inc @@ -44,10 +44,12 @@ testcase tiInsertTableUsingMenu Call hNewDocument printlog "Switching between Draw/Impress" if ( gApplication = "IMPRESS" ) then + Kontext "Document Impress" DocumentImpress.UseMenu hMenuSelectNr(4) hMenuSelectNr(14) else + Kontext "Document Draw" DocumentDraw.UseMenu hMenuSelectNr(4) hMenuSelectNr(11) @@ -208,9 +210,11 @@ testcase tiTableObjectBar printlog "Switching between Draw/Impress" if ( gApplication = "IMPRESS" ) then DocumentImpress.UseMenu + Kontext "Document Impress" hMenuSelectNr(4) hMenuSelectNr(14) else + Kontext "Document Draw" DocumentDraw.UseMenu hMenuSelectNr(4) hMenuSelectNr(11) diff --git a/testautomation/graphics/optional/includes/global/g_tools.inc b/testautomation/graphics/optional/includes/global/g_tools.inc index 7b9ce82860d2..9faee3508c1b 100644 --- a/testautomation/graphics/optional/includes/global/g_tools.inc +++ b/testautomation/graphics/optional/includes/global/g_tools.inc @@ -92,8 +92,7 @@ testcase tiToolsThesaurus case 90 : Printlog "- No Thesaurus available !" goto endsub - case else - if bAsianLan then + case else : if bAsianLan then hSetSpellHypLanguage sWord = "Hello" else @@ -152,7 +151,7 @@ testcase tiToolsThesaurus endif if ( ReplaceWith.getText() <> sAlternativeText ) then - warnlog "the text is no transfered to the ReplaceWith field. " +"ReplaceWith = " + ReplaceWith.getText() + ", Alternative = " + sAlternativeText + warnlog "the text is no transfered to the ReplaceWith field. " + "ReplaceWith = " + ReplaceWith.getText() + ", Alternative = " + sAlternativeText else printlog "the text is transfered to the ReplaceWith field." endif @@ -162,9 +161,9 @@ testcase tiToolsThesaurus endif Thesaurus.OK - if( gApplication = "DRAW" ) then + if(gApplication = "DRAW") then Kontext "Draw" - elseif( gApplication = "IMPRESS") then + elseif(gApplication = "IMPRESS") then Kontext "Impress" else ' fallback warnlog "gApplication is wrong" @@ -186,7 +185,7 @@ testcase tiToolsThesaurus Call hCloseDocument -endcase +endcase 'tiToolsThesaurus '------------------------------------------------------------------------------- testcase tiToolsThesaurusWithoutText @@ -209,7 +208,7 @@ testcase tiToolsThesaurusWithoutText Call hCloseDocument -endcase +endcase 'tiToolsThesaurusWithoutText '------------------------------------------------------------------------------- testcase tiToolsThesaurusContextMenu @@ -266,8 +265,7 @@ testcase tiToolsThesaurusContextMenu case 90 : Printlog "- No Thesaurus available !" goto endsub - case else - if bAsianLan then + case else : if bAsianLan then hSetSpellHypLanguage sWord = "Hello" else @@ -306,62 +304,64 @@ testcase tiToolsThesaurusContextMenu call hCloseDocument -endcase +endcase 'tiToolsThesaurusContextMenu '------------------------------------------------------------------------------- testcase tiToolsHyphenation1 - printlog " - Hyphenation without any text" - Call hNewDocument '/// New impress document ///' - sleep 3 - ToolsLanguageHyphenationDraw '/// Try with empty document ///' - Kontext "Hyphenation" + printlog " - Hyphenation without any text" + printlog "New impress document " + Call hNewDocument + sleep 3 + ToolsLanguageHyphenationDraw + Kontext "Hyphenation" + printlog "Try with empty document" if Hyphenation.Exists(1) = True Then Warnlog " - Dialog ist da" Hyphenation.Cancel else Printlog " - Hyphenation activated" end if - ' Kontext "DocumentImpress" - printlog " - Hyphenation with text, but without any possibility to break words" - select case iSprache - case 01 : hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) '/// Create text without a pssibility to split words///' - case 03 : hTextrahmenErstellen ("Compare a tradu" + Chr(231) + Chr(227) + "o com o original",10,10,40,40) - case 07 : qaerrorlog "- No Hypenation for Russian available" - Call hCloseDocument '/// Close document ///' - goto endsub - case 31 : hTextrahmenErstellen ("Het is mijn bedoeling om voor en hulpmiddel.",10,10,40,40) - case 33 : hTextrahmenErstellen ("Merci beaucoup pout votre candidature du 13/11/97.",10,10,40,40) - case 34 : hTextrahmenErstellen ("This ist a text with no spliting words",10,10,40,40) - case 36 : hTextrahmenErstellen ("Semmi karhozattyoc nincz most azoknac, a kic az Iesus Christusban be oltattac",10,10,40,40) - case 39 : hTextrahmenErstellen ("Il documento 'Senza nome 1' stato modififcato",10,10,40,40) - case 45 : hTextrahmenErstellen ("at du har nok i dit hvis du",10,10,40,40 ) - case 46 : hTextrahmenErstellen ("Detta är en text utan delade ord",10,10,40,40) - case 48 : hTextrahmenErstellen (" Jeoli jednak zechcesz",10,10,40,40) - case 49 : hTextrahmenErstellen ("Dies ist ein Text ohne eine Moeglichkeit Woerter zu trennen",10,10,40,40) - case 50 : hTextrahmenErstellen ("Zato ves �?as iš�?emo nove �?lane: sodelujte",10,10,40,40) - case 55 : hTextrahmenErstellen ("a Sun tentou adquirir a Apple",10,10,40,40) - case else - if bAsianLan then - printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)" - printlog " :-) will use English instead" - hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) - else - Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" - endif - end select - hTypeKeys "<Home>" - ToolsLanguageHyphenationDraw '/// Try ///' - Kontext "Hyphenation" - if Hyphenation.Exists =True Then - Warnlog "Dialog exists" - Hyphenation.Cancel - else - Kontext "Active" - if Active.Exists then Active.OK - end if - - Call hCloseDocument '/// Close document ///' - +' Kontext "DocumentImpress" + printlog " - Hyphenation with text, but without any possibility to break words" + select case iSprache + case 01 : hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) + case 03 : hTextrahmenErstellen ("Compare a tradu" + Chr(231) + Chr(227) + "o com o original",10,10,40,40) + case 07 : qaerrorlog "- No Hypenation for Russian available" + printlog "Close document" + Call hCloseDocument + goto endsub + case 31 : hTextrahmenErstellen ("Het is mijn bedoeling om voor en hulpmiddel.",10,10,40,40) + case 33 : hTextrahmenErstellen ("Merci beaucoup pout votre candidature du 13/11/97.",10,10,40,40) + case 34 : hTextrahmenErstellen ("This ist a text with no spliting words",10,10,40,40) + case 36 : hTextrahmenErstellen ("Semmi karhozattyoc nincz most azoknac, a kic az Iesus Christusban be oltattac",10,10,40,40) + case 39 : hTextrahmenErstellen ("Il documento 'Senza nome 1' stato modififcato",10,10,40,40) + case 45 : hTextrahmenErstellen ("at du har nok i dit hvis du",10,10,40,40 ) + case 46 : hTextrahmenErstellen ("Detta är en text utan delade ord",10,10,40,40) + case 48 : hTextrahmenErstellen (" Jeoli jednak zechcesz",10,10,40,40) + case 49 : hTextrahmenErstellen ("Dies ist ein Text ohne eine Moeglichkeit Woerter zu trennen",10,10,40,40) + case 50 : hTextrahmenErstellen ("Zato ves �?as iš�?emo nove �?lane: sodelujte",10,10,40,40) + case 55 : hTextrahmenErstellen ("a Sun tentou adquirir a Apple",10,10,40,40) + case else : if bAsianLan then + printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)" + printlog " :-) will use English instead" + hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) + else + Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" + endif + end select + hTypeKeys "<Home>" + ToolsLanguageHyphenationDraw + Kontext "Hyphenation" + if Hyphenation.Exists =True Then + Warnlog "Dialog exists" + Hyphenation.Cancel + else + Kontext "Active" + if Active.Exists then Active.OK + end if + printlog "Close document " + Call hCloseDocument + endcase 'tiToolsHyphenation1 '------------------------------------------------------------------------------- @@ -381,55 +381,61 @@ testcase tiToolsHyphenation2 if ((not bAsianLan) AND (iSprache <> 07)) then sFile = gTesttoolpath + "graphics\required\input\silben_"+iSprache+sExt - hFileOpenLocally( sFile ) + Call hFileOpenLocally( sFile ) endif - select case iSprache '/// Open prepared document ///' - case 01 :DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34) - case 07 : qaerrorlog "- No Hypenation for Russian available" - goto endsub - case 31 :DasWort = "siteit" : DasWort2 = "iteit" : DasWort3 = "teit" : DasWort4 = "eit" - case 33 :DasWort = "ture" : DasWort2 = "ure" : DasWort3 = "re" : DasWort4 = "e" - case 34 :DasWort = "chvo" : DasWort2 = "hvo" : DasWort3 = "vo" : DasWort4 = "o" - case 36 :DasWort = "zatnal" : DasWort2 = "atnal" : DasWort3 = "tnal" : DasWort4 = "nal" - case 39 :DasWort = "sentu" : DasWort2 = "entu" : DasWort3 = "ntu" : DasWort4 = "tu" - case 46 :DasWort = "niska" : DasWort2 = "iska" : DasWort3 = "ska" : DasWort4 = "ka" - case 48 :DasWort = "nie" : DasWort2 = "ie" : DasWort3 = "e" - case 49 :DasWort = "nung" : DasWort2 = "ung" : DasWort3 = "ng" : DasWort4 = "g" - case 50 :DasWort = "nica" : DasWort2 = "ica" : DasWort3 = "ca" : DasWort4 = "a" - case 55 :DasWort = "gia" : DasWort2 = "ia" : DasWort3 = "a" : DasWort4 = "ogia" - case else - if bAsianLan then - printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)" - printlog " :-) will use English instead" - hFileOpenLocally( gTesttoolpath + "graphics\required\input\silben_"+"1"+sExt ) - DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34) - else - Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here and create file: "+sFile - hNewDocument - endif - end select - - printlog " - Test hyphenation" - EditSelectAll '/// Press CTRL + A to select all ///' - '/// press return to go into the edit mode ///' - hTypeKeys "<Return>" + select case iSprache + case 01 :DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34) + case 07 : qaerrorlog "- No Hypenation for Russian available" + goto endsub + case 31 :DasWort = "siteit" : DasWort2 = "iteit" : DasWort3 = "teit" : DasWort4 = "eit" + case 33 :DasWort = "ture" : DasWort2 = "ure" : DasWort3 = "re" : DasWort4 = "e" + case 34 :DasWort = "chvo" : DasWort2 = "hvo" : DasWort3 = "vo" : DasWort4 = "o" + case 36 :DasWort = "zatnal" : DasWort2 = "atnal" : DasWort3 = "tnal" : DasWort4 = "nal" + case 39 :DasWort = "sentu" : DasWort2 = "entu" : DasWort3 = "ntu" : DasWort4 = "tu" + case 46 :DasWort = "niska" : DasWort2 = "iska" : DasWort3 = "ska" : DasWort4 = "ka" + case 48 :DasWort = "nie" : DasWort2 = "ie" : DasWort3 = "e" + case 49 :DasWort = "nung" : DasWort2 = "ung" : DasWort3 = "ng" : DasWort4 = "g" + case 50 :DasWort = "nica" : DasWort2 = "ica" : DasWort3 = "ca" : DasWort4 = "a" + case 55 :DasWort = "gia" : DasWort2 = "ia" : DasWort3 = "a" : DasWort4 = "ogia" + case else : if bAsianLan then + printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)" + printlog " :-) will use English instead" + printlog "Open prepared document" + Call hFileOpen (gTesttoolpath + "graphics\required\input\silben_"+"1"+sExt) + DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34) + else + Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here and create file: "+sFile + hNewDocument + endif + end select + + printlog "Test hyphenation" +printlog "Press CTRL + A to select all" + EditSelectAll + printlog "press return to go into the edit mode" + hTypeKeys "<Return>" + + sleep 1 + ' WA for draw, or smth else: get text part before hyphenation: + if iSprache = "1" OR bAsianLan = TRUE then + printlog "Select part of text and compare it with original text at this place" + hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT RIGHT>" + else + hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" + endif + EditCopy + sDraw = GetClipboardText() + printlog "Select whole text" + EditSelectAll + printlog "Run Hyphenation" + ToolsLanguageHyphenationDraw + gMouseClick 50,50 + printlog "Select part of text and compare it with original text at this place" + hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" + sleep 3 + EditCopy - sleep 1 - ' WA for draw, or smth else: get text part before hyphenation: - if iSprache = "1" OR bAsianLan = TRUE then - hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT RIGHT>" '/// Select part of text and compare it with original text at this place ///' - else - hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" - endif - EditCopy - sDraw = GetClipboardText() - EditSelectAll '/// Select whole text ///' - ToolsLanguageHyphenationDraw '/// Run Hyphenation ///' - gMouseClick 50,50 - hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" '/// Select part of text and compare it with original text at this place ///' - sleep 3 - EditCopy printlog GetClipboardText select case GetClipboardText case DasWort : printlog " - Hyphenation worked" @@ -444,9 +450,10 @@ testcase tiToolsHyphenation2 Warnlog " - Hyphenation did not work" Printlog "Expected: '"+DasWort+"'; or something different than: '"+sDraw+"'; But what we got was: '"+GetClipboardText+"'" end if - sleep 1 - Call hCloseDocument '/// Close document ///' - + sleep 1 + printlog "Close document" + Call hCloseDocument + endcase 'tiToolsHyphenation2 '------------------------------------------------------------------------------- @@ -462,7 +469,7 @@ testcase tToolsMacro ToolsMacro Kontext "Makro" - '/// to get the count of all macros, the list needs to get elapsed-all ///' + printlog "to get the count of all macros, the list needs to get elapsed-all" for j = 1 to 2 Zaehler=MakroAus.GetItemCount MakroAus.typeKeys "<end>" diff --git a/testautomation/graphics/optional/includes/global/g_tools.inc.orig b/testautomation/graphics/optional/includes/global/g_tools.inc.orig deleted file mode 100644 index 9dc207b481b9..000000000000 --- a/testautomation/graphics/optional/includes/global/g_tools.inc.orig +++ /dev/null @@ -1,586 +0,0 @@ -'encoding UTF-8 Do not remove or change this line! -'************************************************************************** -' 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. -' -'/************************************************************************ -'* -'* Owner : wolfram.garten@oracle.com -'* -'* short description : will be moved to autocorrection.bas/inc -'* -'\************************************************************************************* -' sFile = gTesttoolpath + "graphics\required\input\silben_"+iSprache+sExt - -'------------------------------------------------------------------------------- -testcase tiToolsThesaurus - - Dim sWord as string - Dim sChangedWord as string - Dim sReplaceWord as string - Dim sAlternativeText as string - Dim sExt as string - Dim ZaehlerBedeutung - dim sWorkFile as string - - 'for normal text, the thesaurus is enabled, - 'if the format->character->language of the word has a thesaurus - 'unfortunately in textboxes this doesn't work, you can give the word a langauge, - 'but this is been ignored by our thesaurus - 'so especially for asian languages you have to set a default language in the options, - 'to be able to use the thesaurus there - fallback to englisch, - 'because there is no thesaurus for cjk languages - - 'As long as OOo has no modules for that, disabled - if gOOO = True then - printlog "No spellchecking in OOo" - goto endsub - endif - - 'First we make sure we test a language where Thesaurus - select case iSprache - case 01 : sWord = "Hello" - case 03 : sWord = "Alo" - case 07 : printlog "- No Thesaur for Russian available" - goto endsub - case 30 : Printlog "- No Thesaurus available !" - goto endsub - case 31 : sWord = "Guiten" - case 33 : sWord = "Bonjour" - case 34 : sWord = "Hola" - case 35 : Printlog "- No Thesaurus available !" - goto endsub - case 36 : Printlog "- No Thesaurus available !" - goto endsub - case 37 : Printlog "- No Thesaurus available !" - goto endsub - case 39 : sWord = "Ciao" - case 42 : Printlog "- No Thesaurus available !" - goto endsub - case 45 : sWord = "Hej" - case 46 : sWord = "Välkommen" - case 47 : Printlog "- No Thesaurus available !" - goto endsub - case 48 : Printlog "- No Thesaurus in Polish!" - goto endsub - case 49 : sWord = "Hallo" - case 50 : sWord = "Prosojnica" - case 51 : Printlog "- No Thesaurus available !" - goto endsub - case 55 : Printlog "- No Thesaurus in Brazilian!" - goto endsub - case 90 : Printlog "- No Thesaurus available !" - goto endsub - - case else : if bAsianLan then - hSetSpellHypLanguage - sWord = "Hello" - else - Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" - sWord = "Hello" - endif - end select - - PrintLog "Thesaurus with 1 word: " + sWord - - if( gApplication = "DRAW" ) then - sExt = ".odg" - elseif( gApplication = "IMPRESS" ) then - sExt = ".odp" - endif - - sWorkFile = gTesttoolPath & "graphics\required\input\recht_" & iSprache & sExt - hFileDelete( sWorkFile ) - - Call hFileOpenLocally( sWorkFile ) - Call hTextrahmenErstellen (sWord,20,20,50,30) - sleep 1 - - printlog "select the word" - hTypeKeys "<Home><SHIFT END>" - - try - ExtrasThesaurusDraw - catch - warnlog "No Thesaurus available." - hCloseDocument() - goto endsub - endcatch - - Kontext "Thesaurus" - if Thesaurus.Exists(3) then - - if CurrentWord.GetSelText <> sWord Then - WarnLog "marked word should be:" + sWord + " but it is:" + CurrentWord.GetSelText - else - PrintLog "Marked word is correctly changed" - endif - - if Alternatives.GetItemCount = 0 Then - warnlog "There are no alternative for this word" - sleep 1 - else - printlog "select the first alternative" - Alternatives.Select 1 - - printlog "check if the selected alternative apprear in the ReplaceWith field." - - sAlternativeText = Alternatives.getSeltext(1,3) - 'remove the part in the () if there is any - if( Instr(sAlternativeText, "(") <> 0 ) then - sAlternativeText = left(sAlternativeText, Instr(sAlternativeText, "(") - 2 ) - endif - - if ( ReplaceWith.getText() <> sAlternativeText ) then - warnlog "the text is no transfered to the ReplaceWith field. " +_ - "ReplaceWith = " + ReplaceWith.getText() + ", Alternative = " + sAlternativeText - else - printlog "the text is transfered to the ReplaceWith field." - endif - - sReplaceWord = ReplaceWith.getText() - sleep 1 - endif - Thesaurus.OK - - if( gApplication = "DRAW" ) then - Kontext "Draw" - elseif( gApplication = "IMPRESS") then - Kontext "Impress" - else ' fallback - warnlog "gApplication is wrong" - goto endsub - endif - - hTypeKeys "<Home><SHIFT END>" - EditCopy - sChangedWord = getClipboard() - printlog "sChangedWord = " + sChangedWord - if(sChangedWord <> sReplaceWord) then - warnlog "the text was not replaced" - else - printlog "the text was successfull replaced" - endif - else - warnlog "thesaurus didn't come up." - end if - - Call hCloseDocument - -endcase -'------------------------------------------------------------------------------- -testcase tiToolsThesaurusWithoutText - - printlog "Thesaurus without any word in the document" - Call hNewDocument - try - ExtrasThesaurusDraw - catch - printlog "the Thesaurus is correctly not available" - call hCloseDocument - goto endsub - endcatch - - WarnLog "If no word is in the document, Thesaurus shouldn't be available" - Kontext "Thesaurus" - if Thesaurus.Exists then - Thesaurus.Cancel - endif - - Call hCloseDocument - - -endcase -'------------------------------------------------------------------------------- -testcase tiToolsThesaurusContextMenu - - Dim sWord as string - Dim sExt as string - Dim iItemCount as Integer - - 'for normal text, the thesaurus is enabled, - 'if the format->character->language of the word has a thesaurus - 'unfortunately in textboxes this doesn't work, you can give the word a langauge, - 'but this is been ignored by our thesaurus - 'so especially for asian languages you have to set a default language in the options, - 'to be able to use the thesaurus there - fallback to englisch, - 'because there is no thesaurus for cjk languages - - 'As long as OOo has no modules for that, disabled - if gOOO = True then - printlog "No spellchecking in OOo" - goto endsub - endif - - 'First we make sure we test a language where Thesaurus - select case iSprache - case 01 : sWord = "Hello" - case 03 : sWord = "Alo" - case 07 : printlog "- No Thesaur for Russian available" - goto endsub - case 30 : Printlog "- No Thesaurus available !" - goto endsub - case 31 : sWord = "Guiten" - case 33 : sWord = "Bonjour" - case 34 : sWord = "Hola" - case 35 : Printlog "- No Thesaurus available !" - goto endsub - case 36 : Printlog "- No Thesaurus available !" - goto endsub - case 37 : Printlog "- No Thesaurus available !" - goto endsub - case 39 : sWord = "Ciao" - case 42 : Printlog "- No Thesaurus available !" - goto endsub - case 45 : sWord = "Hej" - case 46 : sWord = "Välkommen" - case 47 : Printlog "- No Thesaurus available !" - goto endsub - case 48 : Printlog "- No Thesaurus in Polish!" - goto endsub - case 49 : sWord = "Hallo" - case 50 : sWord = "Prosojnica" - case 51 : Printlog "- No Thesaurus available !" - goto endsub - case 55 : Printlog "- No Thesaurus in Brazilian!" - goto endsub - case 90 : Printlog "- No Thesaurus available !" - goto endsub - - case else : if bAsianLan then - hSetSpellHypLanguage - sWord = "Hello" - else - Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" - sWord = "Hello" - endif - end select - - PrintLog "Thesaurus with 1 word: " + sWord - - if( gApplication = "DRAW" ) then - sExt = ".odg" - Kontext "DrawDocument" - elseif( gApplication = "IMPRESS" ) then - sExt = ".odp" - Kontext "ImpressDocument" - endif - - hFileOpenLocally(gTesttoolpath + "graphics\required\input\recht_" + iSprache + sExt) - Call hTextrahmenErstellen (sWord,20,20,50,30) - sleep 1 - - printlog "select the word" - hTypeKeys "<Home><SHIFT END>" - - hOpenContextMenu - - hMenuSelectNr(14) ' the synonyms - iItemCount = hMenuItemGetCount - printlog iItemCount - if(iItemCount <= 2 ) then ' none and Thesaurus item - warnlog "There should be a synonymus display for the word '" + sWord + "' but it isn't." - endif - - hMenuSelectNr(iItemCount) ' the last item - - Kontext "Thesaurus" - if Thesaurus.Exists(5) then - printlog "Thesaurus dialog appear from the context menu" - Thesaurus.Cancel - else - warnlog "the thesaurus dialog does not appear fro mthe context menu of a selected word" - endif - - call hCloseDocument - -endcase -'------------------------------------------------------------------------------- -testcase tiToolsHyphenation1 - - printlog " - Hyphenation without any text" - Call hNewDocument '/// New impress document ///' - sleep 3 - ToolsLanguageHyphenationDraw '/// Try with empty document ///' - Kontext "Hyphenation" - if Hyphenation.Exists(1) = True Then - Warnlog " - Dialog ist da" - Hyphenation.Cancel - else - Printlog " - Hyphenation activated" - end if -' Kontext "DocumentImpress" - printlog " - Hyphenation with text, but without any possibility to break words" - select case iSprache - case 01 : hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) '/// Create text without a pssibility to split words///' - case 03 : hTextrahmenErstellen ("Compare a tradu" + Chr(231) + Chr(227) + "o com o original",10,10,40,40) - case 07 : qaerrorlog "- No Hypenation for Russian available" - Call hCloseDocument '/// Close document ///' - goto endsub - case 31 : hTextrahmenErstellen ("Het is mijn bedoeling om voor en hulpmiddel.",10,10,40,40) - case 33 : hTextrahmenErstellen ("Merci beaucoup pout votre candidature du 13/11/97.",10,10,40,40) - case 34 : hTextrahmenErstellen ("This ist a text with no spliting words",10,10,40,40) - case 36 : hTextrahmenErstellen ("Semmi karhozattyoc nincz most azoknac, a kic az Iesus Christusban be oltattac",10,10,40,40) - case 39 : hTextrahmenErstellen ("Il documento 'Senza nome 1' stato modififcato",10,10,40,40) - case 45 : hTextrahmenErstellen ("at du har nok i dit hvis du",10,10,40,40 ) - case 46 : hTextrahmenErstellen ("Detta är en text utan delade ord",10,10,40,40) - case 48 : hTextrahmenErstellen (" Jeoli jednak zechcesz",10,10,40,40) - case 49 : hTextrahmenErstellen ("Dies ist ein Text ohne eine Moeglichkeit Woerter zu trennen",10,10,40,40) - case 50 : hTextrahmenErstellen ("Zato ves čas iščemo nove člane: sodelujte",10,10,40,40) - case 55 : hTextrahmenErstellen ("a Sun tentou adquirir a Apple",10,10,40,40) - case else : if bAsianLan then - printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)" - printlog " :-) will use English instead" - hTextrahmenErstellen ("This ist a text with no split words",10,10,40,40) - else - Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here" - endif - end select - hTypeKeys "<Home>" - ToolsLanguageHyphenationDraw '/// Try ///' - Kontext "Hyphenation" - if Hyphenation.Exists =True Then - Warnlog "Dialog exists" - Hyphenation.Cancel - else - Kontext "Active" - if Active.Exists then Active.OK - end if - - Call hCloseDocument '/// Close document ///' - -endcase 'tiToolsHyphenation1 - -'------------------------------------------------------------------------------- -testcase tiToolsHyphenation2 - - dim iWaitIndex as integer - dim sExt as string - Dim i : Dim DasWort2 : Dim DasWort3 : Dim DasWort4 : Dim DasWort5 : Dim DasWort6 : Dim DasWort7 - Dim DasWort as string - dim sDraw as string - dim sFile as string - PrintLog "- Tools/Hyphenation2" - Select Case gApplication - case "DRAW" : sExt = ".odg" - case "IMPRESS" : sExt = ".odp" - end select - - if ((not bAsianLan) AND (iSprache <> 07)) then - sFile = gTesttoolpath + "graphics\required\input\silben_"+iSprache+sExt - hFileOpenLocally( sFile ) - endif - - select case iSprache '/// Open prepared document ///' - case 01 :DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34) - case 07 : qaerrorlog "- No Hypenation for Russian available" - goto endsub - case 31 :DasWort = "siteit" : DasWort2 = "iteit" : DasWort3 = "teit" : DasWort4 = "eit" - case 33 :DasWort = "ture" : DasWort2 = "ure" : DasWort3 = "re" : DasWort4 = "e" - case 34 :DasWort = "chvo" : DasWort2 = "hvo" : DasWort3 = "vo" : DasWort4 = "o" - case 36 :DasWort = "zatnal" : DasWort2 = "atnal" : DasWort3 = "tnal" : DasWort4 = "nal" - case 39 :DasWort = "sentu" : DasWort2 = "entu" : DasWort3 = "ntu" : DasWort4 = "tu" - case 46 :DasWort = "niska" : DasWort2 = "iska" : DasWort3 = "ska" : DasWort4 = "ka" - case 48 :DasWort = "nie" : DasWort2 = "ie" : DasWort3 = "e" - case 49 :DasWort = "nung" : DasWort2 = "ung" : DasWort3 = "ng" : DasWort4 = "g" - case 50 :DasWort = "nica" : DasWort2 = "ica" : DasWort3 = "ca" : DasWort4 = "a" - case 55 :DasWort = "gia" : DasWort2 = "ia" : DasWort3 = "a" : DasWort4 = "ogia" - case else : if bAsianLan then - printlog "For the language " + iSprache +" nothing is prepared yet, but is AsianLan, so OK :-)" - printlog " :-) will use English instead" - hFileOpenLocally( gTesttoolpath + "graphics\required\input\silben_"+"1"+sExt ) - DasWort = "ation" : DasWort2 = "tion" : DasWort3 = "ion" : DasWort4 = "on" '+Chr(34) - else - Warnlog "For the language " + iSprache +" nothing is prepared yet: insert text here and create file: "+sFile - hNewDocument - endif - end select - - printlog " - Test hyphenation" - EditSelectAll '/// Press CTRL + A to select all ///' - '/// press return to go into the edit mode ///' - hTypeKeys "<Return>" - - sleep 1 - ' WA for draw, or smth else: get text part before hyphenation: - if iSprache = "1" OR bAsianLan = TRUE then - hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT RIGHT>" '/// Select part of text and compare it with original text at this place ///' - else - hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" - endif - EditCopy - sDraw = GetClipboardText() - EditSelectAll '/// Select whole text ///' - ToolsLanguageHyphenationDraw '/// Run Hyphenation ///' - gMouseClick 50,50 - hTypeKeys "<MOD1 END><HOME><MOD1 SHIFT RIGHT>" '/// Select part of text and compare it with original text at this place ///' - sleep 3 - EditCopy -printlog GetClipboardText - select case GetClipboardText - case DasWort : printlog " - Hyphenation worked" - case DasWort2 : printlog " - Hyphenation worked" - case DasWort3 : printlog " - Hyphenation worked" - case DasWort4 : printlog " - Hyphenation worked" - case else : warnlog " - Hyphenation didnt work" - end select - if GetClipboardText <> sDraw then - Printlog " - WA draw hyphenation did work :-)" - else - Warnlog " - Hyphenation did not work" - Printlog "Expected: '"+DasWort+"'; or something different than: '"+sDraw+"'; But what we got was: '"+GetClipboardText+"'" - end if - sleep 1 - Call hCloseDocument '/// Close document ///' - -endcase 'tiToolsHyphenation2 - -'------------------------------------------------------------------------------- -testcase tToolsMacro - - Dim i as integer - Dim j as integer - Dim Zaehler as integer - Dim ZaehlerListe as integer - - Call hNewDocument - - ToolsMacro - Kontext "Makro" - - '/// to get the count of all macros, the list needs to get elapsed-all ///' - for j = 1 to 2 - Zaehler=MakroAus.GetItemCount - MakroAus.typeKeys "<end>" - for i = 1 to Zaehler - MakroAus.typeKeys "<+><up>" - next i - next j - Zaehler=MakroAus.GetItemCount - for i= 1 to Zaehler - printlog "Starting Macro: (" + i + "/"+ Zaehler + ")" - MakroAus.Select i - if Makroname.GetText = "" Then - try - Ausfuehren.Click - Aufzeichnen.Click - Zuordnen.Click - Bearbeiten.Click - Warnlog " - Controls should not be visible" - catch - Printlog " Contrls invisible because no macro choosen" - endcatch - else - SetClipboard = Makroname.GetText - ZaehlerListe=MakroListe.GetItemCount - for j=2 to ZaehlerListe - Makroliste.Select j - if Makroname.GetText<>GetClipboardText Then - Printlog " Selection got used" - else - Warnlog " - Selection not right, it should be: " + Makroliste.GetSelText + " but it is: " + GetClipboardText - end if - next j - end if - next i - - Printlog " run macros" - MakroAus.Select 6 '3 - Ausfuehren.Click - sleep 10 - if Makro.Exists Then - Warnlog " - Macro not executed" - else - Printlog " Macro executed" - ToolsMacro - Kontext "Makro" - end if - - Zuordnen.Click - Kontext - Active.SetPage TabCustomizeMenu - Kontext "TabCustomizeMenu" - If TabCustomizeMenu.Exists Then - Printlog " Assign macro works" - TabCustomizeMenu.Cancel - sleep 3 - Kontext "Makro" - else - Warnlog " - Assigning macro does not work" - end if - - Bearbeiten.Click - try - sleep 1 ' this sleep is necessary. it takes some time, until focuse switched to basic window! - ViewNavigator - kontext "NavigatorDraw" - if NavigatorDraw.exists (5) then - Warnlog " - Edit macro does not work" - ViewNavigator - endif - catch - hCloseDocument - Kontext "DocumentDraw" - ToolsMacro - Kontext "Makro" - Printlog " Edit macro works" - endcatch - - MakroAus.typeKeys "<end>" - Zaehler = Makroliste.GetItemCount - Neu.Click ' same as delete - kontext "NeuesModul" - Modulname.SetText "NewMarco" - NeuesModul.OK - ToolsMacro - Kontext "Makro" - if (Makroliste.GetItemCount = (Zaehler+1)) Then - Printlog " New macro works" - else - Warnlog " - Macro wasn't created" - end if - - if (Makroliste.GetItemCount <> Makroliste.getSelIndex) Then - Warnlog " created Macro not selected" - Makroaus.Select(Makroaus.GetItemCount) - end if - sleep 1 - Loeschen.Click - sleep 1 - Kontext "Active" - printlog Active.getText - Active.Yes - sleep 2 - Kontext "Makro" - if (Makroliste.GetItemCount = 0) Then - Printlog " Delete macro works" - else - Warnlog " - Macro wasn't deleted" - end if - sleep 2 - makro.close - 'TODO: organizer testing! - Call hCloseDocument - Call hCloseDocument - -endcase 'tToolsMacro diff --git a/testautomation/graphics/optional/includes/global/g_zoom.inc b/testautomation/graphics/optional/includes/global/g_zoom.inc index c82b6743966a..90741015aafd 100644 --- a/testautomation/graphics/optional/includes/global/g_zoom.inc +++ b/testautomation/graphics/optional/includes/global/g_zoom.inc @@ -49,20 +49,22 @@ testcase tViewZoom Datei$ = ConvertPath (gOfficePath + "user\work\test." & ExtensionString) Printlog "- View-Zoom testing" - if dir(Datei$) <> "" then app.Kill(Datei$) ' to avoid the anoying overwrite warnlog :-) - Call hNewDocument '/// new document ///' + printlog "to avoid the anoying overwrite warnlog :-)" + if dir(Datei$) <> "" then app.Kill(Datei$) + printlog "new document" +Call hNewDocument ViewZoom Kontext "Massstab" - Vergroesserung100.Check '/// set zoom to 50% ///' + Vergroesserung100.Check Massstab.OK - '/// create a number of rectangles with different color properties ///' + printlog "create a number of rectangles with different color properties" Kontext "SD_Farbleiste" sleep 1 if SD_Farbleiste.Exists then Printlog "- Color toolbar will be disabled now" ViewToolbarsColorBar end if - '/// All rectangles are created with same dimensions but using different zoom settings ///' + printlog "All rectangles are created with same dimensions but using different zoom settings" For Zaehler = 1 to 9 Position1 = 5 * Zaehler - 3 Position2 = 105 - 5 * Zaehler @@ -77,9 +79,11 @@ testcase tViewZoom gMouseClick 50,0 Next Zaehler sleep 2 - hFileSaveAs (Datei$) '/// save document ///' + printlog "save document" + hFileSaveAs (Datei$) sleep 3 - for Zaehler = 1 to 6 '/// changing zoom settings and checking functionality with controlling the color of the selected rectangle ///' + printlog "changing zoom settings and checking functionality with controlling the color of the selected rectangle" + for Zaehler = 1 to 6 ViewZoom Kontext "Massstab" VergroesserungStufenlos.check @@ -103,18 +107,14 @@ testcase tViewZoom Case 6: VergroesserungStufenlos.check Stufenlos.Settext "200" - 'Case 2: Vergroesserung50.check - 'Case 3: Vergroesserung75.check - 'Case 4: Vergroesserung100.check - 'Case 5: Vergroesserung150.check - 'Case 6: Vergroesserung200.check End Select Massstab.OK sleep 1 Kontext "DocumentImpress" - gMouseClick 15,15 'hier soll die Maus ein Rechteck treffen; - 'die Farbe des Rechtecks sagt uns dann, ob - FormatArea 'richtig vergroessert oder verkleinert wurde. + printlog "Mouseclick should hit a rectangle. Color tells us then if it was zoomed correctly." + gMouseClick 15,15 + + FormatArea sleep 1 Kontext Active.SetPage TabFarben @@ -128,6 +128,6 @@ testcase tViewZoom 'Optimal.push 'Seitenbreite.push sleep 2 - - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument endcase diff --git a/testautomation/graphics/optional/includes/impress/i_animation.inc b/testautomation/graphics/optional/includes/impress/i_animation.inc index 8ee7777e5994..ac1c07ed817e 100644 --- a/testautomation/graphics/optional/includes/impress/i_animation.inc +++ b/testautomation/graphics/optional/includes/impress/i_animation.inc @@ -37,151 +37,178 @@ ' Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\grafix3.ras") testcase tExtrasAnimation + + Dim i + Dim Zaehler + Dim ZaehlerAnpassung + + Printlog "- Tools/Animation" - Dim i - Call hNewDocument - Call sSelectEmptyLayout '/// New impress document ///' - sleep 2 - InsertGraphicsFromFile '/// insert graphic file (sample.bmp) ///' - sleep 1 - Kontext "GrafikEinfuegenDlg" - sleep 2 + printlog "New impress document " + Call hNewDocument + Call sSelectEmptyLayout + sleep 2 + printlog "insert graphic file (sample.bmp) " + InsertGraphicsFromFile + sleep 1 + Kontext "GrafikEinfuegenDlg" + sleep 2 Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") sleep 2 Oeffnen.Click sleep 2 - Kontext "DocumentImpress" - DocumentImpress.MouseDoubleClick 90,90 '/// Deselect graphic ///' - sleep 1 - InsertGraphicsFromFile - sleep 2 - Kontext "GrafikEinfuegenDlg" - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\grafix3.ras") - sleep 2 - Oeffnen.Click - sleep 2 - Opl_SD_EffekteZulassen - Kontext "Animation" - - for i=1 to 10 - BildAufnehmen.Click '/// add selected picture 10 times into the animation ///' - next i - sleep 1 - if AnzahlBilder.GetText <> "10" Then '/// compare frame number in animation dialog ///' - WarnLog " - Adding graphics did not work" - else - PrintLog " Pictures added" - end if - - if AlleAufnehmen.IsEnabled Then WarnLog " - Add all should not be enabled, there is only 1 graphic selected" '/// test if Add all is eneabled (shouldn't be because of only 1 object selected) ///' - Kontext "DocumentImpress" - EditSelectAll '/// Select both pictures ///' - - Kontext "Animation" - - for i=1 to 5 - AlleAufnehmen.Click '/// Add all (5 times) ///' - next i - sleep 1 - if AnzahlBilder.GetText <> "20" Then '/// check if number of frames is now 20 ///' - WarnLog " - Adding pics did not work" - else - PrintLog " All pics added" - end if - - ErstesBild.Click '/// Click First Picture ///' - - if AnzahlBilder.GetText <> "1" Then '/// Control if we are at frame 1 ///' - WarnLog " - Jump back to start did not work" - else - PrintLog " Jumped back to first picture" - end if - - LetztesBild.Click '/// Go to last picture ///' - - if AnzahlBilder.GetText <> "20" Then '/// Control frame number ///' - WarnLog " - Jump to end did not work" - else - PrintLog " Jump to end did work" - end if - - Abspielen.Click '/// Play animation ///' - sleep 3 - Kontext "DocumentImpress" - EditSelectAll '/// Select all in document ///' - DocumentImpress.TypeKeys "<DELETE>" '/// Delete content ///' - - Kontext "Animation" - Erstellen.Click '/// /Create animation //' - sleep 10 - - Kontext "DocumentImpress" - try - EditCopy '/// Try to copy ccreated animation into clipboard ///' - PrintLog " animation created" - catch - WarnLog " - Animation not created" - endcatch - - Kontext "Animation" - - if AnimationsgruppeGruppenobjekt.IsChecked=True Then - try - AnzeigedauerProBild.SetText "1" '/// Try setting duration per frame ///' - WarnLog " - Edit field should be disabled" - catch - PrintLog " Edit field not enabled because groupobject status is = " + AnimationsgruppeGruppenobjekt.IsChecked - endcatch - end if - - - AnimationsgruppeBitmapobjekt.Check '/// check animation group object ///' - - AnzeigedauerProBild.SetText "3" '/// Set duration per frame to 3///' - SetClipboard AnzeigedauerProBild.GetText - AnzeigedauerProBild.More '/// Raise value for duration ///' - if AnzeigedauerProBild.GetText <> GetClipboardText Then - PrintLog " Time per pic could be edited" - else - WarnLog " - Time per pic could be edited" - end if - - Dim Zaehler - Zaehler = AnzahlDurchlaeufe.GetItemCount - for i=1 to Zaehler '/// Change number of plays ///' - AnzahlDurchlaeufe.Select i - next i - PrintLog " Number of loops checked" - - - Dim ZaehlerAnpassung - ZaehlerAnpassung=Anpassung.GetItemCount '/// change ZaehlerAnpassung ///' - for i=1 to ZaehlerAnpassung - Anpassung.Select i - next i - PrintLog " Loop count changed" - - BildLoeschen.Click '/// Delete 1 frame ///' - if AnzahlBilder = "20" Then - WarnLog " - Delete pictures from animation did not work" - else - PrintLog " Picture No20 deleted" - end if - - AlleLoeschen.Click '/// Delete all frames ///' - Kontext "Active" - Active.Yes - sleep 3 - - Kontext "Animation" - if Abspielen.IsEnabled=true Then - WarnLog " - Not all pics could be deleted" - else - PrintLog " all pics deleted" - end if - sleep 2 - Animation.Close - sleep 2 - Call hCloseDocument '/// close document///' + Kontext "DocumentImpress" + printlog "Deselect graphic " + DocumentImpress.MouseDoubleClick 90,90 + sleep 1 + InsertGraphicsFromFile + sleep 2 + Kontext "GrafikEinfuegenDlg" + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\grafix3.ras") + sleep 2 + Oeffnen.Click + sleep 2 + Opl_SD_EffekteZulassen + Kontext "Animation" + + printlog "add selected picture 10 times into the animation " + for i=1 to 10 + BildAufnehmen.Click + next i + sleep 1 + printlog "compare frame number in animation dialog " + if AnzahlBilder.GetText <> "10" Then + WarnLog " - Adding graphics did not work" + else + printlog "Pictures added" + end if + + printlog "test if Add all is eneabled (shouldn't be because of only 1 object selected) " + if AlleAufnehmen.IsEnabled Then WarnLog " - Add all should not be enabled, there is only 1 graphic selected" + Kontext "DocumentImpress" + printlog "Select both pictures " + EditSelectAll + Kontext "Animation" + printlog "Add all (5 times) " + for i=1 to 5 + AlleAufnehmen.Click + next i + sleep 1 + printlog "check if number of frames is now 20 " + if AnzahlBilder.GetText <> "20" Then + WarnLog " - Adding pics did not work" + else + printlog "All pics added" + end if + + printlog "Click First Picture " + ErstesBild.Click + + printlog "Control if we are at frame 1 " + if AnzahlBilder.GetText <> "1" Then + WarnLog " - Jump back to start did not work" + else + printlog "Jumped back to first picture" + end if + + printlog "Go to last picture " + LetztesBild.Click + + printlog "Control frame number " + if AnzahlBilder.GetText <> "20" Then + WarnLog " - Jump to end did not work" + else + printlog "Jump to end did work" + end if + + printlog "Play animation " + Abspielen.Click + sleep 3 + Kontext "DocumentImpress" + printlog "Select all in document " + EditSelectAll + printlog "Delete content " + DocumentImpress.TypeKeys "<DELETE>" + + Kontext "Animation" + printlog "Create animation" + Erstellen.Click + sleep 10 + + Kontext "DocumentImpress" + try + printlog "Try to copy ccreated animation into clipboard " + EditCopy + printlog "animation created" + catch + WarnLog " - Animation not created" + endcatch + + Kontext "Animation" + + if AnimationsgruppeGruppenobjekt.IsChecked=True Then + try + printlog "Try setting duration per frame " + AnzeigedauerProBild.SetText "1" + WarnLog " - Edit field should be disabled" + catch + printlog "Edit field not enabled because groupobject status is = " + AnimationsgruppeGruppenobjekt.IsChecked + endcatch + end if + + + printlog "check animation group object " + AnimationsgruppeBitmapobjekt.Check + + printlog "Set duration per frame to 3" + AnzeigedauerProBild.SetText "3" + SetClipboard AnzeigedauerProBild.GetText + printlog "Raise value for duration " + AnzeigedauerProBild.More + if AnzeigedauerProBild.GetText <> GetClipboardText Then + printlog "Time per pic could be edited" + else + WarnLog " - Time per pic could be edited" + end if + + Zaehler = AnzahlDurchlaeufe.GetItemCount + printlog "Change number of plays " + for i=1 to Zaehler + AnzahlDurchlaeufe.Select i + next i + printlog "Number of loops checked" + + printlog "change ZaehlerAnpassung " + ZaehlerAnpassung=Anpassung.GetItemCount + for i=1 to ZaehlerAnpassung + Anpassung.Select i + next i + printlog "Loop count changed" + + printlog "Delete 1 frame " + BildLoeschen.Click + if AnzahlBilder = "20" Then + WarnLog " - Delete pictures from animation did not work" + else + printlog "Picture No20 deleted" + end if + + printlog "Delete all frames " + AlleLoeschen.Click + Kontext "Active" + Active.Yes + sleep 3 + + Kontext "Animation" + if Abspielen.IsEnabled=true Then + WarnLog " - Not all pics could be deleted" + else + printlog "all pics deleted" + end if + sleep 2 + Animation.Close + sleep 2 + printlog "close document" + Call hCloseDocument endcase diff --git a/testautomation/graphics/optional/includes/impress/i_pengine.inc b/testautomation/graphics/optional/includes/impress/i_pengine.inc index 4f19f254b055..aed79a6ce827 100644 --- a/testautomation/graphics/optional/includes/impress/i_pengine.inc +++ b/testautomation/graphics/optional/includes/impress/i_pengine.inc @@ -36,26 +36,24 @@ '\******************************************************************* testcase tiPenginefast -' dim i,t,q as integer -' dim e as string - dim sFileName as string + ' dim i,t,q as integer + ' dim e as string + dim sFileName as string -'/// the Presentation-Engine consists of showing the presentation, with all it's effects. ///' - -'/// Create a new presentation. ///' + printlog "the Presentation-Engine consists of showing the presentation, with all it's effects." + printlog "Create a new presentation." Call hNewDocument sleep 1 + printlog "Open the test-file." + Call hDateiOeffnen (gTesttoolpath + "graphics\required\input\allshapes.odp") - '/// Open the test-file. ///' - Call hDateiOeffnen (gTesttoolpath + "graphics\required\input\allshapes.odp") 'effects.odp") - - '/// Start the slideshow. ///' + printlog "Start the slideshow." CALL hTypeKeys "<F5>" sleep (5) kontext "DocumentPresentation" DocumentPresentation.TypeKeys "<SPACE>" - '/// Wait for the presentation to reach a certain moment. ///' + printlog "Wait for the presentation to reach a certain moment." sleep (10) DocumentPresentation.TypeKeys "<SPACE>" sleep (7) @@ -63,7 +61,7 @@ testcase tiPenginefast sleep (7) DocumentPresentation.TypeKeys "<SPACE>" sleep (7) - '/// Press "Space" again, to continue with slide two. ///' + printlog "Press "Space" again, to continue with slide two." DocumentPresentation.TypeKeys "<SPACE>" sleep (7) DocumentPresentation.TypeKeys "<SPACE>" @@ -72,19 +70,18 @@ testcase tiPenginefast sleep (7) DocumentPresentation.TypeKeys "<SPACE>" sleep (7) - '/// And press "Space" again, to exit the presentation-mode. ///' + printlog "And press "Space" again, to exit the presentation-mode." DocumentPresentation.TypeKeys "<SPACE>" - FileClose Call hNewDocument sleep 1 - '/// Open the test-file. ///' + printlog "Open the test-file." Call hDateiOeffnen (gTesttoolpath + "graphics\required\input\effects.odp") - '/// Start the slideshow. ///' + printlog "Start the slideshow." CALL hTypeKeys "<F5>" sleep (200) - '/// Press "Space" again, to continue with slide two. ///' + printlog "Press Space again, to continue with slide two." kontext "DocumentPresentation" DocumentPresentation.TypeKeys "<SPACE>" sleep (40) @@ -126,93 +123,94 @@ testcase tiPenginefast kontext "DocumentImpress" end if -'/// Insert a new slide. ///' -' InsertSlide -' sleep 2 -' hTypekeys "<Pagedown>" -' sleep 2 - -'/// Menu: Slideshow: Check every menu-item. ///' - -'Exists: -' #1 tSlideShowSlideShow -' #1 tSlideShowRehearseTimings -' #1 tSlideShowSlideShowSettings -' #1 tSlideShowCustomSlideShow -' #1 tSlideShowSlideTransition -' #1 tSlideShowShowHideSlide - -' Slideshow menu 1 - Slide show -' Slideshow menu 2 - Slide show settings -' Slideshow menu 3 - Rehearse timings -' Slideshow menu 4 - Interaction -' Slideshow menu 6 - Slide Transition -' Slideshow menu 7 - Show / Hide slide -' Slideshow menu 8 - Custom Slide show - - -'Printlog " Here starts the test " - -'Presentation - Start / Stop. Different ways to do it. -'Presentation - Effects. -'LeftWindow - -'/// Slideshow Settings: Range: test all three alternatives. ///' -'/// Test if the Slideshow-types (Default, Window, Auto) works. ///' -'/// Check if the checkboxes works. ///' -'/// Close dialogue. ///' -'/// Add an object. ///' -'/// Custom Animation: Add an Animation to the object. ///' -'/// Run the slideshow. ///' - -'/// Change to the next effect and continue through every animation in ///' -'/// Entrance, Emphasis, Exit and Motion Paths. ///' -'/// While testing - test the speed-choices for every kind of animation. ///' -'/// Check if the "Change" and "Remove"-buttons. ///' -'/// Check the Start, "Direction" and "Speed" variables. ///' -'/// Add two effects to one object and change the order. ///' -'/// Try the Play and "Slide Show"-button. ///' -'/// Try the Automatic preview-button. ///' - -'/// Slidetransition. ///' -'/// Go through every kind of effect, speed, and sound. ///' -'/// Check loop until next sound. ///' -'/// Check the Advance slide with mouseclick-function. ///' -'/// Check the "Apply to all slides", "Play", and "Slide Show"-buttons. ///' -'/// Check Automatic preview. ///' - -'/// Some effects doesnt have a right / left orientation. Test these. ///' -'/// Possibility: check random effects and see if something hangs. ///' - -'/// Load/Save-test: Does the settings last? ///' - -'/// Are two different objects dependant or independent from each other? ///' - -'/// Close Application ///' + printlog "Insert a new slide." + ' InsertSlide + ' sleep 2 + ' hTypekeys "<Pagedown>" + ' sleep 2 + + printlog "Menu: Slideshow: Check every menu-item." + + 'Exists: + ' #1 tSlideShowSlideShow + ' #1 tSlideShowRehearseTimings + ' #1 tSlideShowSlideShowSettings + ' #1 tSlideShowCustomSlideShow + ' #1 tSlideShowSlideTransition + ' #1 tSlideShowShowHideSlide + + ' Slideshow menu 1 - Slide show + ' Slideshow menu 2 - Slide show settings + ' Slideshow menu 3 - Rehearse timings + ' Slideshow menu 4 - Interaction + ' Slideshow menu 6 - Slide Transition + ' Slideshow menu 7 - Show / Hide slide + ' Slideshow menu 8 - Custom Slide show + + + 'Printlog " Here starts the test " + + 'Presentation - Start / Stop. Different ways to do it. + 'Presentation - Effects. + 'LeftWindow + + printlog "Slideshow Settings: Range: test all three alternatives." + printlog "Test if the Slideshow-types (Default, Window, Auto) works." + printlog "Check if the checkboxes works." + printlog "Close dialogue." + printlog "Add an object." + printlog "Custom Animation: Add an Animation to the object." + printlog "Run the slideshow." + + printlog "Change to the next effect and continue through every animation in" + printlog "Entrance, Emphasis, Exit and Motion Paths." + printlog "While testing - test the speed-choices for every kind of animation." + printlog "Check if the "Change" and "Remove"-buttons." + printlog "Check the Start, "Direction" and "Speed" variables." + printlog "Add two effects to one object and change the order." + printlog "Try the Play and "Slide Show"-button." + printlog "Try the Automatic preview-button." + + printlog "Slidetransition." + printlog "Go through every kind of effect, speed, and sound." + printlog "Check loop until next sound." + printlog "Check the Advance slide with mouseclick-function." + printlog "Check the "Apply to all slides", "Play", and "Slide Show"-buttons." + printlog "Check Automatic preview." + + printlog "Some effects doesnt have a right / left orientation. Test these." + printlog "Possibility: check random effects and see if something hangs." + + printlog "Load/Save-test: Does the settings last?" + + printlog "Are two different objects dependant or independent from each other?" + + printlog "Close Application" Call hCloseDocument Printlog "Finished Optional-test for Presentation-Engine" -endcase +endcase 'tiPenginefast +'------------------------------------------------------------------------------- testcase tSlideShowInteraction - Dim Datei$ - Dim i as integer - Dim Zaehler as integer - dim b115364 as boolean + Dim Datei$ + Dim i as integer + Dim Zaehler as integer + dim b115364 as boolean - Datei$ =ConvertPath (gOfficePath + "user\work\interac.sxi") + Datei$ =ConvertPath (gOfficePath + "user\work\interac.sxi") -' '/// save file as presentation with name '"user\\work\\diashow.sxi")' ///' +' printlog "save file as presentation with name '"user\\work\\diashow.sxi")'" ' hFileSaveAsWithFilterKill ( sFile , gImpressFilter, FALSE ) ' Printlog "saved presetation: '" + sFile + "'" - '/// open application ///' + printlog "open application" Call hNewDocument sleep 5 - setStartCurrentPage(FALSE) '/// Set "start with current page to OFF ///' + setStartCurrentPage(FALSE) printlog "Set "start with current page to OFF" - '/// call 'Insert->Slide' three times and name the slides 2, 3, 4 and create a rectangle on it ///' - '///+ we now have 4 slides ?! :-) ///' + printlog "call 'Insert->Slide' three times and name the slides 2, 3, 4 and create a rectangle on it " + '///+ we now have 4 slides ?! :-)" for i = 2 to 4 InsertSlide sleep 2 @@ -222,7 +220,7 @@ testcase tSlideShowInteraction sleep 2 next i - '/// check state of navigator ! expected: closed -> open navigator ///' + printlog "check state of navigator ! expected: closed -> open navigator" Kontext "Navigator" if Navigator.exists then warnlog "Navigator: already open :-(" @@ -232,194 +230,194 @@ testcase tSlideShowInteraction endif sleep 3 - '/// Slide Show->Interaction ///' - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - if AktionBeiMausklick.GetItemCount = 13 Then - Printlog "- List is complete" - else - Warnlog "- Number of possible actions is wrong. It should be: 13, but it is: " + AktionBeiMausklick.GetItemCount - end if - sleep 1 - - AktionBeiMausklick.Select 1 'Keine Aktion bei Mausclick - Printlog (AktionBeiMausklick.GetSelText + " chosen") - If Durchsuchen.IsVisible then Warnlog "- Control should be invisible because AktionBeiMausklick = " + AktionBeiMausKlick.GetSelText - sleep 1 - - Kontext "TabInteraktion" - AktionBeiMausklick.Select 2 'Sprung zur vorhergehenden Seite - Printlog (AktionBeiMausklick.GetSelText + " chosen") - if Durchsuchen.IsVisible Then Warnlog "- Control should be invisible, beacause Action = " + AktionBeiMausKlick.GetSelText - TabInteraktion.OK - sleep 2 - Kontext "DocumentImpress" - gMouseClick 90,90 - sleep 1 - gMouseClick 50,50 + printlog "Slide Show->Interaction" + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + if AktionBeiMausklick.GetItemCount = 13 Then + Printlog "- List is complete" + else + Warnlog "- Number of possible actions is wrong. It should be: 13, but it is: " + AktionBeiMausklick.GetItemCount + end if + sleep 1 + + AktionBeiMausklick.Select 1 'Keine Aktion bei Mausclick + Printlog (AktionBeiMausklick.GetSelText + " chosen") + If Durchsuchen.IsVisible then Warnlog "- Control should be invisible because AktionBeiMausklick = " + AktionBeiMausKlick.GetSelText + sleep 1 + + Kontext "TabInteraktion" + AktionBeiMausklick.Select 2 'Sprung zur vorhergehenden Seite + Printlog (AktionBeiMausklick.GetSelText + " chosen") + if Durchsuchen.IsVisible Then Warnlog "- Control should be invisible, beacause Action = " + AktionBeiMausKlick.GetSelText + TabInteraktion.OK + sleep 2 + Kontext "DocumentImpress" + gMouseClick 90,90 + sleep 1 + gMouseClick 50,50 sleep 2 - Kontext "NavigatorDraw" - sleep 2 - if Not Liste.GetSelIndex = 3 Then - Warnlog "- jumped to wrong slide" - else - Printlog "- jumped to correct slide" - end if - sleep 1 + Kontext "NavigatorDraw" + sleep 2 + if Not Liste.GetSelIndex = 3 Then + Warnlog "- jumped to wrong slide" + else + Printlog "- jumped to correct slide" + end if + sleep 1 - Kontext "DocumentImpress" - EditSelectAll - sleep 1 + Kontext "DocumentImpress" + EditSelectAll + sleep 1 - SlideShowInteraction - sleep 2 - Kontext "TabInteraktion" - AktionBeiMausklick.select 3 'Sprung zur naechsten Seite - Printlog (AktionBeiMausKlick.GetSelText + " chosen") - TabInteraktion.OK - sleep 1 + SlideShowInteraction + sleep 2 + Kontext "TabInteraktion" + AktionBeiMausklick.select 3 'Sprung zur naechsten Seite + Printlog (AktionBeiMausKlick.GetSelText + " chosen") + TabInteraktion.OK + sleep 1 Kontext "DocumentImpress" gMouseClick 90,90 sleep 2 gMouseClick 50,50 Kontext "NavigatorDraw" - if Liste.GetSelIndex <> 4 Then - Warnlog "- Jumped to wrong slide" - else - Printlog " Jumped to correct slide" - end if - sleep 1 - kontext "DocumentImpress" - EditSelectAll - sleep 1 - - SlideShowInteraction - sleep 1 - Kontext "TabInteraktion" - AktionBeiMausklick.select 4 'Sprung zur ersten Seite - Printlog AktionBeiMausKlick.GetSelText - sleep 1 - TabInteraktion.OK - sleep 1 - Kontext "DocumentImpress" - gMouseClick 90,90 - gMouseClick 50,50 - Kontext "NavigatorDraw" - if Liste.GetSelIndex <> 1 Then Warnlog "- jumped to wrong slide" - Letzte.Click 'Liste.Select 4 - Kontext "DocumentImpress" - EditSelectAll - sleep 2 + if Liste.GetSelIndex <> 4 Then + Warnlog "- Jumped to wrong slide" + else + Printlog " Jumped to correct slide" + end if + sleep 1 + kontext "DocumentImpress" + EditSelectAll + sleep 1 + + SlideShowInteraction + sleep 1 + Kontext "TabInteraktion" + AktionBeiMausklick.select 4 'Sprung zur ersten Seite + Printlog AktionBeiMausKlick.GetSelText + sleep 1 + TabInteraktion.OK + sleep 1 + Kontext "DocumentImpress" + gMouseClick 90,90 + gMouseClick 50,50 + Kontext "NavigatorDraw" + if Liste.GetSelIndex <> 1 Then Warnlog "- jumped to wrong slide" + Letzte.Click 'Liste.Select 4 + Kontext "DocumentImpress" + EditSelectAll + sleep 2 try SlideShowInteraction catch warnlog "SlideshowInteraction diasabled :-(" endcatch - Kontext "TabInteraktion" - AktionBeiMausklick.select 5 'Sprung zur letzten Seite - printlog AktionBeiMausKlick.GetSelText - TabInteraktion.OK - sleep 1 - Kontext "NavigatorDraw" - if Not Liste.GetSelIndex = 1 Then Warnlog "- jumped to wrong slide" + Kontext "TabInteraktion" + AktionBeiMausklick.select 5 'Sprung zur letzten Seite + printlog AktionBeiMausKlick.GetSelText + TabInteraktion.OK + sleep 1 + Kontext "NavigatorDraw" + if Not Liste.GetSelIndex = 1 Then Warnlog "- jumped to wrong slide" - kontext "DocumentImpress" - Call hRechteckErstellen 20,20,50,50 - sleep 1 - EditSelectAll - sleep 1 + kontext "DocumentImpress" + Call hRechteckErstellen 20,20,50,50 + sleep 1 + EditSelectAll + sleep 1 try FormatGroupGroup catch warnlog "GROUP?" endcatch - sleep 1 - - SlideShowInteraction - Kontext "TabInteraktion" - AktionBeiMausklick.select 6 'Sprung zu Seite oder Objekt - printlog AktionBeiMausKlick.GetSelText - sleep 2 - if Not ListeSprungZuSeiteObjekt.IsVisible Then Warnlog " list seems to be invisible" - Seite.SetText S2 - Suchen.Click - if ListeSprungZuSeiteObjekt.GetSelIndex <> 3 Then Warnlog " Search does not work" - printlog ListeSprungZuSeiteObjekt.GetSelIndex - TabInteraktion.OK - sleep 1 + sleep 1 - Kontext "DocumentImpress" - gMouseClick 90,90 - gMouseClick 25,25, - sleep 2 - Kontext "NavigatorDraw" - if Liste.GetSelIndex <> 2 Then Warnlog "- Jumped to wrong destination" - printlog Liste.GetSelIndex - Liste.Select 4 - Kontext "DocumentImpress" - EditSelectAll - sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + AktionBeiMausklick.select 6 'Sprung zu Seite oder Objekt + printlog AktionBeiMausKlick.GetSelText + sleep 2 + if Not ListeSprungZuSeiteObjekt.IsVisible Then Warnlog " list seems to be invisible" + Seite.SetText S2 + Suchen.Click + if ListeSprungZuSeiteObjekt.GetSelIndex <> 3 Then Warnlog " Search does not work" + printlog ListeSprungZuSeiteObjekt.GetSelIndex + TabInteraktion.OK + sleep 1 - Kontext "DocumentImpress" - EditSelectAll + Kontext "DocumentImpress" + gMouseClick 90,90 + gMouseClick 25,25, + sleep 2 + Kontext "NavigatorDraw" + if Liste.GetSelIndex <> 2 Then Warnlog "- Jumped to wrong destination" + printlog Liste.GetSelIndex + Liste.Select 4 + Kontext "DocumentImpress" + EditSelectAll + sleep 1 + + Kontext "DocumentImpress" + EditSelectAll + sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + AktionBeiMausKlick.Select 7 'Sprung zu Dokument + Printlog AktionBeiMausKlick.GetSelText + " chosen" + try + Durchsuchen.Click sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - AktionBeiMausKlick.Select 7 'Sprung zu Dokument - Printlog AktionBeiMausKlick.GetSelText + " chosen" - try - Durchsuchen.Click - sleep 1 - Kontext "OeffnenDlg" - sleep 1 - Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\recht_49.sxi") - Oeffnen.Click - sleep 10 - ' check if the document is writable - if fIsDocumentWritable = false then - ' make the document writable and check if it's succesfull - if fMakeDocumentWritable = false then - warnlog "The document can't be make writeable. Test stopped." - goto endsub - endif - endif - catch - Warnlog "- Search button could not be accessed" - endcatch - sleep 1 - Kontext "TabInteraktion" - sleep 1 - TabInteraktion.OK - sleep 3 - Kontext "DocumentImpress" - DocumentImpress.MouseDown 90,90 - DocumentImpress.MouseUp 90,90 - sleep 2 - Kontext "DocumentImpress" - DocumentImpress.Mousedown 30,30 - kontext - b115364 = false - if messagebox.exists then - printlog "baeh: '" + messagebox.gettext + "'" - try - messagebox.ok ' was default in so7 - catch - warnlog "behaviour changed #115364# mother document gets closed :-(" - if fileExists(ConvertPath (gOfficePath + "user\work\bug115364.sxi")) then - kill ConvertPath (gOfficePath + "user\work\bug115364.sxi") - endif - messagebox.yes ' don't save changes, before going on! - b115364 = true - kontext "SpeichernDlg" - Dateiname.setText ConvertPath (gOfficePath + "user\work\bug115364.sxi") - Speichern.click - sleep 10 - endcatch + Kontext "OeffnenDlg" + sleep 1 + Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\recht_49.sxi") + Oeffnen.Click + sleep 10 + ' check if the document is writable + if fIsDocumentWritable = false then + ' make the document writable and check if it's succesfull + if fMakeDocumentWritable = false then + warnlog "The document can't be make writeable. Test stopped." + goto endsub + endif + endif + catch + Warnlog "- Search button could not be accessed" + endcatch + sleep 1 + Kontext "TabInteraktion" + sleep 1 + TabInteraktion.OK + sleep 3 + Kontext "DocumentImpress" + DocumentImpress.MouseDown 90,90 + DocumentImpress.MouseUp 90,90 + sleep 2 + Kontext "DocumentImpress" + DocumentImpress.Mousedown 30,30 + kontext + b115364 = false + if messagebox.exists then + printlog "baeh: '" + messagebox.gettext + "'" + try + messagebox.ok ' was default in so7 + catch + warnlog "behaviour changed #115364# mother document gets closed :-(" + if fileExists(ConvertPath (gOfficePath + "user\work\bug115364.sxi")) then + kill ConvertPath (gOfficePath + "user\work\bug115364.sxi") + endif + messagebox.yes ' don't save changes, before going on! + b115364 = true + kontext "SpeichernDlg" + Dateiname.setText ConvertPath (gOfficePath + "user\work\bug115364.sxi") + Speichern.click + sleep 10 + endcatch else printlog "OK :-)" endif @@ -444,207 +442,207 @@ testcase tSlideShowInteraction endif sleep 5 - Kontext "NavigatorDraw" - sleep 1 - Naechste.click + Kontext "NavigatorDraw" + sleep 1 + Naechste.click - Kontext "DocumentImpress" - EditSelectAll - sleep 1 - - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - AktionBeiMausKlick.Select 9 - Printlog AktionBeiMausKlick.GetSelText + " chosen" - sleep 1 - Tabinteraktion.OK - sleep 2 + Kontext "DocumentImpress" + EditSelectAll + sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - if not AktionBeiMausKlick.GetSelIndex = 9 Then Warnlog "- Not the right action chosen" - sleep 1 - AktionBeiMausKlick.Select 9 'Klang abspielen - Printlog AktionBeiMausKlick.GetSelText + "- chosen" - sleep 1 - Tabinteraktion.OK - sleep 2 - Kontext "NavigatorDraw" - sleep 1 - Liste.Select 2 - Kontext "DocumentImpress" - EditSelectAll - sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - Durchsuchen.Click - sleep 1 - Kontext "OeffnenDlg" - sleep 1 - Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\blip.wav") - sleep 1 - Oeffnen.Click - sleep 1 - Kontext "Active" - if Active.Exists Then - Warnlog Active.GetText + " Gallery might be empty" - Active.OK - sleep 1 - Kontext "OeffnenDlg" - OeffnenDlg.Cancel - sleep 1 - end if - Kontext "TabInteraktion" - SetClipboard Klangwahl.GetText - TabInteraktion.OK - sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - if Klangwahl.GetText <> GetClipboardText then Warnlog "- Not the right sound chosen" - TabInteraktion.OK - sleep 1 - InsertGraphicsFromFile - sleep 1 - Kontext "GrafikeinfuegenDlg" - sleep 1 - if Verknuepfen.IsChecked then Verknuepfen.UnCheck - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") - Oeffnen.Click - sleep 3 - Kontext "NavigatorDraw" - sleep 1 - Liste.Select 4 - sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - AktionBeiMausKlick.Select 11 'Objektaktion ausfuehren - Printlog AktionBeiMausKlick.GetSelText + " chosen" - sleep 1 - Zaehler=Effekt.GetItemCount - for i=1 to Zaehler - Effekt.Select i - Printlog Effekt.GetSelText + " chosen" - if i=1 Then - if Langsam.IsEnabled Then Warnlog "- Control should not be enabled, because no effect chosen" - if Mittel.IsEnabled Then Warnlog "- Control should not be enabled, because no effect chosen" - if Schnell.IsEnabled Then Warnlog "- Control should not be enabled, because no effect chosen" - end if - sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + AktionBeiMausKlick.Select 9 + Printlog AktionBeiMausKlick.GetSelText + " chosen" + sleep 1 + Tabinteraktion.OK + sleep 2 - TabInteraktion.OK - sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - next i - TabInteraktion.OK - sleep 1 - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - AktionBeiMausKlick.Select 10 'Objekt ausblenden - Printlog AktionBeiMausKlick.GetSelText + " chosen" - ListeObjektAktion.Select 1 - sleep 1 - TabInteraktion.OK - sleep 1 - gMouseClick 90,90 - sleep 1 - gMouseClick 55,55 - sleep 1 - Kontext "DocumentImage" - - SlideShowInteraction - Kontext "TabInteraktion" - sleep 1 - AktionBeiMausKlick.Select 13 'Makro - Printlog AktionBeiMausKlick.GetSelText + " chosen" - sleep 2 - Durchsuchen.Click - sleep 5 - Kontext "Makro" - sleep 5 - Makro.Cancel - sleep 2 - Kontext "TabInteraktion" - sleep 1 - TabInteraktion.OK - sleep 3 - - SlideShowInteraction - Kontext "TabInteraktion" - sleep 2 - if not AktionBeiMausKlick.GetSelIndex = 12 Then Warnlog "- Wrong action used" - sleep 1 - AktionBeiMausKlick.Select 14 'Praesentation beenden - Printlog AktionBeiMausKlick.GetSelText - Tabinteraktion.OK - sleep 1 - - SlideShowPresentationSettings - Kontext "Bildschirmpraesentation" - if not Fenster.IsChecked Then Fenster.Check - BildschirmPraesentation.OK - sleep 2 - Kontext "DocumentImpress" - DocumentImpress.TypeKeys "<MOD1 F2>" - sleep 5 - Kontext "DocumentPresentation" - sleep 2 - DocumentPresentation.MouseDown 50,50 - DocumentPresentation.MouseUp 50,50 - sleep 5 - try - Kontext "DocumentImpress" - EditSelectAll - Printlog "- Slideshow ended at right point" - catch - Warnlog "- Program is still in slideshow mode" - Kontext "DocumentPresentation" - DocumentPresentation.TypeKeys "<ESCAPE>" - endcatch + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + if not AktionBeiMausKlick.GetSelIndex = 9 Then Warnlog "- Not the right action chosen" + sleep 1 + AktionBeiMausKlick.Select 9 'Klang abspielen + Printlog AktionBeiMausKlick.GetSelText + "- chosen" + sleep 1 + Tabinteraktion.OK + sleep 2 + Kontext "NavigatorDraw" + sleep 1 + Liste.Select 2 + Kontext "DocumentImpress" + EditSelectAll + sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + Durchsuchen.Click + sleep 1 + Kontext "OeffnenDlg" + sleep 1 + Dateiname.SetText ConvertPath (gTesttoolPath + "graphics\required\input\blip.wav") + sleep 1 + Oeffnen.Click + sleep 1 + Kontext "Active" + if Active.Exists Then + Warnlog Active.GetText + " Gallery might be empty" + Active.OK + sleep 1 + Kontext "OeffnenDlg" + OeffnenDlg.Cancel + sleep 1 + end if + Kontext "TabInteraktion" + SetClipboard Klangwahl.GetText + TabInteraktion.OK + sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + if Klangwahl.GetText <> GetClipboardText then Warnlog "- Not the right sound chosen" + TabInteraktion.OK + sleep 1 + InsertGraphicsFromFile + sleep 1 + Kontext "GrafikeinfuegenDlg" + sleep 1 + if Verknuepfen.IsChecked then Verknuepfen.UnCheck + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") + Oeffnen.Click + sleep 3 + Kontext "NavigatorDraw" + sleep 1 + Liste.Select 4 + sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + AktionBeiMausKlick.Select 11 'Objektaktion ausfuehren + Printlog AktionBeiMausKlick.GetSelText + " chosen" + sleep 1 + Zaehler=Effekt.GetItemCount + for i=1 to Zaehler + Effekt.Select i + Printlog Effekt.GetSelText + " chosen" + if i=1 Then + if Langsam.IsEnabled Then Warnlog "- Control should not be enabled, because no effect chosen" + if Mittel.IsEnabled Then Warnlog "- Control should not be enabled, because no effect chosen" + if Schnell.IsEnabled Then Warnlog "- Control should not be enabled, because no effect chosen" + end if + sleep 1 - Kontext "DocumentImpress" - DocumentImpress.TypeKeys "<SHIFT MOD1 F5>" - sleep 3 - setStartCurrentPage(TRUE) '/// Set "start with current page to ON = Default ///' - Call hCloseDocument -endcase + TabInteraktion.OK + sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + next i + TabInteraktion.OK + sleep 1 + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + AktionBeiMausKlick.Select 10 'Objekt ausblenden + Printlog AktionBeiMausKlick.GetSelText + " chosen" + ListeObjektAktion.Select 1 + sleep 1 + TabInteraktion.OK + sleep 1 + gMouseClick 90,90 + sleep 1 + gMouseClick 55,55 + sleep 1 + Kontext "DocumentImage" -' Slideshow menu 5 - Custom Animation + SlideShowInteraction + Kontext "TabInteraktion" + sleep 1 + AktionBeiMausKlick.Select 13 'Makro + Printlog AktionBeiMausKlick.GetSelText + " chosen" + sleep 2 + Durchsuchen.Click + sleep 5 + Kontext "Makro" + sleep 5 + Makro.Cancel + sleep 2 + Kontext "TabInteraktion" + sleep 1 + TabInteraktion.OK + sleep 3 + + SlideShowInteraction + Kontext "TabInteraktion" + sleep 2 + if not AktionBeiMausKlick.GetSelIndex = 12 Then Warnlog "- Wrong action used" + sleep 1 + AktionBeiMausKlick.Select 14 'Praesentation beenden + Printlog AktionBeiMausKlick.GetSelText + Tabinteraktion.OK + sleep 1 + + SlideShowPresentationSettings + Kontext "Bildschirmpraesentation" + if not Fenster.IsChecked Then Fenster.Check + BildschirmPraesentation.OK + sleep 2 + Kontext "DocumentImpress" + DocumentImpress.TypeKeys "<MOD1 F2>" + sleep 5 + Kontext "DocumentPresentation" + sleep 2 + DocumentPresentation.MouseDown 50,50 + DocumentPresentation.MouseUp 50,50 + sleep 5 + try + Kontext "DocumentImpress" + EditSelectAll + Printlog "- Slideshow ended at right point" + catch + Warnlog "- Program is still in slideshow mode" + Kontext "DocumentPresentation" + DocumentPresentation.TypeKeys "<ESCAPE>" + endcatch + + Kontext "DocumentImpress" + DocumentImpress.TypeKeys "<SHIFT MOD1 F5>" + sleep 3 + setStartCurrentPage(TRUE) printlog "Set "start with current page to ON = Default" + Call hCloseDocument +endcase 'tSlideShowInteraction + +'------------------------------------------------------------------------------- testcase tSlideShowCustomAnimation dim bError as boolean - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create textbox with text ///' + printlog "create textbox with text" Call hTextrahmenErstellen ("Test text to test text effects", 10, 10, 20, 40 ) - '/// Slide Show->Custom Animation... ///' + printlog "Slide Show->Custom Animation..." SlideShowCustomAnimation Kontext "Tasks" - '/// click button 'Add...' ///' + printlog "click button 'Add...'" EffectAdd.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if TabEntrance.exists(5) then DialogTest(TabEntrance) - '/// select in the listbox 'Effects' the second entry ///' + printlog "select in the listbox 'Effects' the second entry" Effects.select(2) Speed.getItemCount AutomaticPreview.unCheck sleep 1 AutomaticPreview.Check kontext - '/// Switch to TabPage: Emphasis ///' + printlog "Switch to TabPage: Emphasis" active.setPage(TabEmphasis) kontext "TabEmphasis" if TabEmphasis.exists(5) then @@ -654,7 +652,7 @@ testcase tSlideShowCustomAnimation warnlog "Impress:Tasks Pane:Custom Animation:TabEmphasis tabPage doesn't work." endif kontext - '/// Switch to TabPage: Exit ///' + printlog "Switch to TabPage: Exit" active.setPage(TabExit) kontext "TabExit" if TabExit.exists(5) then @@ -664,7 +662,7 @@ testcase tSlideShowCustomAnimation warnlog "Impress:Tasks Pane:Custom Animation:TabExit tabPage doesn't work." endif kontext - '/// Switch to TabPage: Motion Paths ///' + printlog "Switch to TabPage: Motion Paths" active.setPage(TabMotionPaths) kontext "TabMotionPaths" if TabMotionPaths.exists(5) then @@ -674,7 +672,7 @@ testcase tSlideShowCustomAnimation bError = true warnlog "Impress:Tasks Pane:Custom Animation:TabMotionPaths tabPage doesn't work." endif - '/// Close dialog 'Custom Animation' with 'OK' ///' + printlog "Close dialog 'Custom Animation' with 'OK'" TabMotionPaths.OK bError = false else @@ -683,11 +681,11 @@ testcase tSlideShowCustomAnimation endif Kontext "Tasks" if (NOT bError) then - '/// click button 'Change...' ///' + printlog "click button 'Change...'" EffectChange.click - '/// Dialog 'Custom Animation' comes up ///' + printlog "Dialog 'Custom Animation' comes up" kontext - '/// Switch to TabPage: Entrance ///' + printlog "Switch to TabPage: Entrance" active.setPage(TabEntrance) kontext "TabEntrance" if (NOT TabEntrance.exists(5)) then @@ -699,14 +697,14 @@ testcase tSlideShowCustomAnimation if EffectProperty.isEnabled then EffectProperty.getItemCount endif - '/// CLick on button '...' (Options) ///' + printlog "CLick on button '...' (Options)" EffectOptions.click kontext "TabEffect" if TabEffect.exists(5) then dialogTest(TabEffect) Sound.getItemCount AfterAnimation.getItemCount - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext active.setPage TabTiming kontext "TabTiming" @@ -723,7 +721,7 @@ testcase tSlideShowCustomAnimation else warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work." endif - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext active.setPage TabTextAnimation kontext "TabTextAnimation" @@ -753,10 +751,9 @@ testcase tSlideShowCustomAnimation endif kontext "Tasks" EffectAutomaticPreview.isChecked - '/// click button 'Remove' ///' + printlog "click button 'Remove'" EffectRemove.click endif - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase - +endcase
\ No newline at end of file diff --git a/testautomation/graphics/optional/includes/impress/i_slidecopy.inc b/testautomation/graphics/optional/includes/impress/i_slidecopy.inc index 92283b35a369..61249353c9d1 100644 --- a/testautomation/graphics/optional/includes/impress/i_slidecopy.inc +++ b/testautomation/graphics/optional/includes/impress/i_slidecopy.inc @@ -169,7 +169,7 @@ testcase tiSlideCopyNewPresentation kontext "DocumentImpress" hMouseClick DocumentImpress, 90, 90 '---------------------------------------------------------------------------3 - '/// Copy the slide to the clipboard ///' + printlog "Copy the slide to the clipboard" kontext "Slides" SlidesControl.TypeKeys "<PAGEUP>" sleep (1) @@ -182,16 +182,16 @@ testcase tiSlideCopyNewPresentation Call hCloseDocument Goto Endsub endif - '/// Close the presentation-window ///' + printlog "Close the presentation-window" Call hCloseDocument - '/// Open a new presentation ///' + printlog "Open a new presentation" Call hNewDocument - '/// Paste the slide from the clipboard ///' + printlog "Paste the slide from the clipboard!" kontext "Slides" hUseAsyncSlot( "EditPaste" ) - '/// Delete the first slide ///' + printlog "Delete the first slide" hUseAsyncSlot( "EditDeleteSlide" ) - '/// Check if all three objects exists, and has the right values ///' + printlog "Check if all three objects exists, and has the right values" kontext "DocumentImpress" hTypeKeys "<ESCAPE>" hTypeKeys "<TAB>", 1 'Select the first object. @@ -263,7 +263,7 @@ testcase tiSlideCopyNewPresentation Warnlog "Wrong object or object-name! The name found was: " + value13 endif - '/// Close the bars we opened before. ///' + printlog "Close the bars we opened before." kontext "Connectorsbar" if Connectorsbar.Exists then Connectorsbar.Close kontext "SymbolShapes" @@ -271,7 +271,7 @@ testcase tiSlideCopyNewPresentation kontext "StarShapes" if StarShapes.Exists then StarShapes.Close - '/// Close Presentation. End testcase ///' + printlog "Close Presentation. End testcase" Call hCloseDocument endcase 'tiSlideCopyNewPresentation @@ -531,17 +531,17 @@ testcase tiSlideCopyPasteSpecial Dim value1 as string Dim value2 as string Dim value3 as string - '/// Copies slide, and pastes it with "Paste Special", ///' - '/// just to see if the office can handle it ///' - '/// Make new presentation ///' + printlog "Copies slide, and pastes it with Paste Special" + printlog "just to see if the office can handle it" + printlog "Make new presentation" Call hNewDocument - '/// Insert three objects: Connector, Door-plate, and Smiley ///' + printlog "Insert three objects: Connector, Door-plate, and Smiley" - '1 Insert Connector. + printlog "Insert Connector" kontext "Toolbar" sleep 1 try - Verbinder.TearOff ' insert connector + Verbinder.TearOff catch warnlog "bug for GH from FHA; .tearoff doesnt tell success" endcatch @@ -556,11 +556,11 @@ testcase tiSlideCopyPasteSpecial kontext "DocumentImpress" hMouseClick DocumentImpress, 90, 90 - '2 Insert Door-plate. + printlog "Insert Door-plate" kontext "Toolbar" sleep 1 try - StarShapes.TearOff ' insert connector + StarShapes.TearOff catch warnlog "bug for GH from FHA; .tearoff doesnt tell success" endcatch @@ -575,11 +575,11 @@ testcase tiSlideCopyPasteSpecial kontext "DocumentImpress" hMouseClick DocumentImpress, 90, 90 - '3 Insert Smiley. + printlog "Insert Smiley" kontext "Toolbar" sleep 1 try - SymbolShapes.TearOff ' insert connector + SymbolShapes.TearOff catch warnlog "bug for GH from FHA; .tearoff doesnt tell success" endcatch @@ -591,7 +591,7 @@ testcase tiSlideCopyPasteSpecial gMouseMove (70,70,89,89) gMouseUp (89,89) - '/// Copy the slide to the clipboard ///' + printlog "Copy the slide to the clipboard" kontext "Slides" SlidesControl.TypeKeys "<PAGEUP>" SlidesControl.TypeKeys "<SHIFT F10>" @@ -603,12 +603,12 @@ testcase tiSlideCopyPasteSpecial Goto Endsub endif - '/// Try to paste special. And check that the office still stays alive ///' + printlog "Try to paste special. And check that the office still stays alive" EditPasteSpecial kontext "InhaltEinfuegen" InhaltEinfuegen.OK - '/// Close the bars we opened before. ///' + printlog "Close the bars we opened before" kontext "Connectorsbar" if Connectorsbar.Exists then Connectorsbar.Close kontext "SymbolShapes" @@ -618,12 +618,13 @@ testcase tiSlideCopyPasteSpecial sleep 1 kontext "DocumentImpress" - '/// Close Presentation. End testcase ///' + printlog "Close Presentation. End testcase" Call hCloseDocument endcase 'tiSlideCopyPasteSpecial '----------------------------------------------------------------------- + testcase tiSlideCopyInSlideSorter qaerrorlog "#i58418#: Pasting in slide sorter sets slide to wrong position" goto endsub @@ -631,10 +632,10 @@ testcase tiSlideCopyInSlideSorter Dim value1 as string Dim value2 as string Dim value3 as string - '/// Copies slides within the slidesorter, and makes sure they are pasted on the correct position ///' - '/// Make new presentation ///' + printlog "Copies slides within the slidesorter, and makes sure they are pasted on the correct position" + printlog "Make new presentation" Call hNewDocument - '/// Insert an object: Connector, on the first slide ///' + printlog "Insert an object: Connector, on the first slide" kontext "Toolbar" sleep 1 try @@ -653,12 +654,9 @@ testcase tiSlideCopyInSlideSorter gMouseMove (10,10,30,30) gMouseUp (30,30) Printlog " Inserted a Connector-object." - 'Rename object hTypeKeys "<ESCAPE>" hTypeKeys "<TAB>", 1 DocumentImpress.TypeKeys "<SHIFT F10>" - - 'Rename if hMenuFindSelect(27027, true, 14) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -668,15 +666,14 @@ testcase tiSlideCopyInSlideSorter NameField.SetText "First" NameDlgObject.OK sleep 1 - Printlog " Renamed a the object to 'First'" + Printlog "Renamed a the object to 'First'" sleep 3 - '/// Rename slide to "1" ///' + printlog "Rename slide to 1" kontext "Slides" SlidesControl.TypeKeys "<PAGEUP>" SlidesControl.TypeKeys "<SHIFT F10>" sleep 3 - 'Rename if hMenuFindSelect(27268, true, 2) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -687,25 +684,24 @@ testcase tiSlideCopyInSlideSorter NameField.SetText "1" NameDlgPage.OK sleep 1 - Printlog " Renamed the Slide to '1'" + Printlog "Renamed the Slide to '1'" kontext "DocumentImpress" hMouseClick DocumentImpress, 90, 90 sleep 3 - '/// Insert a new slide ///' + printlog "Insert a new slide" kontext "Slides" SlidesControl.TypeKeys "<TAB><PAGEDOWN>" SlidesControl.OpenContextMenu sleep 3 - 'Insert slide if hMenuFindSelect(27014, true, 1) = false then Warnlog "Context-Menu-entry `Insert slide` was not found. Therefore the test ends." Call hCloseDocument Goto Endsub endif - Printlog " Inserted a new slide." - '/// Insert an object: Door-plate, on the second slide ///' + Printlog "Inserted a new slide." + printlog "Insert an object: Door-plate, on the second slide" kontext "Toolbar" sleep 1 try @@ -721,13 +717,10 @@ testcase tiSlideCopyInSlideSorter gMouseDown (40,40) gMouseMove (40,40,60,60) gMouseUp (60,60) - Printlog " Inserted a Door-Plate-object." - + Printlog "Inserted a Door-Plate-object." hTypeKeys "<ESCAPE>" hTypeKeys "<TAB>", 2 hTypeKeys "<SHIFT F10>" - - ' Rename if hMenuFindSelect(27027, true, 15) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -738,16 +731,15 @@ testcase tiSlideCopyInSlideSorter NameField.SetText "Second" NameDlgObject.OK sleep 1 - Printlog " Renamed a the object to 'Second'" + Printlog "Renamed a the object to 'Second'" kontext "DocumentImpress" hMouseClick DocumentImpress, 90, 90 sleep 2 - '/// Rename slide to "2" ///' + printlog "Rename slide to 2" kontext "Slides" SlidesControl.OpenContextMenu sleep 3 - ' Rename if hMenuFindSelect(27268, true, 3) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -759,20 +751,18 @@ testcase tiSlideCopyInSlideSorter sleep 1 Printlog " Renamed the slide '2'" - '/// Insert a new slide ///' + printlog "Insert a new slide" kontext "Slides" Slidescontrol.TypeKeys "<PAGEDOWN>", 2 Slidescontrol.TypeKeys "<SHIFT F10>" sleep 3 - 'Insert slide if hMenuFindSelect(27014, true, 1) = false then Warnlog "Context-Menu-entry `Insert slide` was not found. Therefore the test ends." Call hCloseDocument Goto Endsub endif - Printlog " Inserted a new slide." - - '/// Insert an object: Smiley, on the second slide ///' + Printlog "Inserted a new slide." + printlog "Insert an object: Smiley, on the second slide" kontext "Toolbar" sleep 1 try @@ -788,13 +778,9 @@ testcase tiSlideCopyInSlideSorter gMouseMove (70,70,89,89) gMouseUp (89,89) Printlog " Inserted a Smiley-object." - - 'Rename object hTypeKeys "<ESCAPE>" hTypeKeys "<TAB>", 2 hTypeKeys "<SHIFT F10>" - - 'Choose rename. if hMenuFindSelect(27027, true, 15) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -804,13 +790,11 @@ testcase tiSlideCopyInSlideSorter NameField.SetText "Third" NameDlgObject.OK Printlog " Renamed a the object to 'Third'" - - '/// Rename slide to "3" ///' + printlog "Rename slide to 3" kontext "Slides" Slidescontrol.TypeKeys "<PAGEDOWN>", 2 SlidesControl.OpenContextMenu sleep 3 - ' Rename if hMenuFindSelect(27268, true, 3) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -823,7 +807,7 @@ testcase tiSlideCopyInSlideSorter sleep 1 Printlog " Renamed the slide '3'" - '/// Close the bars we opened before. ///' + printlog "Close the bars we opened before." kontext "Connectorsbar" if Connectorsbar.Exists then Connectorsbar.Close kontext "SymbolShapes" @@ -831,47 +815,46 @@ testcase tiSlideCopyInSlideSorter kontext "StarShapes" if StarShapes.Exists then StarShapes.Close - '/// Change to Slidesorter ///' + printlog "Change to Slidesorter" kontext "DocumentImpress" ViewSlideSorter - '/// Now we have changed view to the slidesorter ///' + printlog "Now we have changed view to the slidesorter" kontext "Slides" - Printlog " Changed view to 'SlideSorter'" - '/// Make sure the last slide is selcted ///' + Printlog "Changed view to 'SlideSorter'" + printlog "Make sure the last slide is selcted" SlidesControl.TypeKeys "<TAB>" SlidesControl.TypeKeys "<PAGEDOWN>", 3 - '/// Cut the last slide ///' + printlog "Cut the last slide" SlidesControl.TypeKeys "<MOD1 X>" - '/// Make sure the first slide is selected ///' + printlog "Make sure the first slide is selected" SlidesControl.TypeKeys "<TAB>" SlidesControl.TypeKeys "<PAGEUP>", 2 sleep 1 - '/// Paste the Slide ///' + printlog "Paste the Slide" kontext "Slides" SlidesControl.TypeKeys "<MOD1 V>" - '/// choose "Before" as specification for where + printlog "choose Before as specification for where" Kontext "InsertPaste" if InsertPaste.Exists(3) then Before.Check InsertPaste.OK Printlog " Pasted slide 'Before'" else - warnlog " Problem when copying/pasting slide." + warnlog "Problem when copying/pasting slide." endif - '/// Check where the slide ended up ///' + printlog "Check where the slide ended up" kontext "Slides" SlidesControl.TypeKeys "<TAB>" SlidesControl.TypeKeys "<PAGEUP>", 3 'to get to the first slide SlidesControl.TypeKeys "<SHIFT F10>" sleep 3 - ' Rename if hMenuFindSelect(27268, true, 3) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -888,12 +871,14 @@ testcase tiSlideCopyInSlideSorter sleep 1 kontext "Slides" - '/// Choose the slide in the middle (named "1") ///' + printlog "Choose the slide in the middle (named 1)" SlidesControl.TypeKeys "<TAB>" - SlidesControl.TypeKeys "<PAGEDOWN>", 3 'to get to the last slide - SlidesControl.TypeKeys "<PAGEUP>" 'to go back one step + printlog "to get to the last slide" + SlidesControl.TypeKeys "<PAGEDOWN>", 3 + printlog "to go back one step" + SlidesControl.TypeKeys "<PAGEUP>" SlidesControl.OpenContextMenu (true) - ' Check the name of that slide (via Rename) + printlog "Check the name of that slide (via Rename)" if hMenuFindSelect(27268, true, 3) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -910,7 +895,7 @@ testcase tiSlideCopyInSlideSorter sleep 1 kontext "Slides" - '/// Cut the slide ///' + printlog "Cut the slide" SlidesControl.TypeKeys "<SHIFT F10>" sleep 3 if hMenuFindSelect(5710, true, 10) = false then @@ -919,18 +904,18 @@ testcase tiSlideCopyInSlideSorter Goto Endsub endif - '/// Make sure we have selected the last slide ///' + printlog "Make sure we have selected the last slide" SlidesControl.TypeKeys "<TAB>" SlidesControl.TypeKeys "<PAGEDOWN>", 2 - '/// Place the mousepointer to the left of the first slide ///' + printlog "Place the mousepointer to the left of the first slide" sleep 1 kontext "Slides" SlidesControl.MouseMove 2, 3 SlidesControl.OpenContextMenu true sleep 3 - '/// Paste the Slide ///' + printlog "Paste the Slide" if hMenuFindSelect(5712, true, 12) = false then Warnlog "Context-Menu-entry `Paste` were not found. Therefore the test ends." Call hCloseDocument @@ -938,7 +923,7 @@ testcase tiSlideCopyInSlideSorter endif sleep 1 - '/// Choose "After" as specification for where ///' + printlog "Choose After as specification for where" Kontext "InsertPaste" if InsertPaste.Exists(3) then After.Check @@ -948,13 +933,15 @@ testcase tiSlideCopyInSlideSorter warnlog " Problem when copying/pasting slide." endif - '/// Check where the slide ended up. Should have showed up at the last position ///' + printlog "Check where the slide ended up. Should have showed up at the last position" kontext "Slides" SlidesControl.TypeKeys "<TAB>" - SlidesControl.TypeKeys "<PAGEDOWN>", 3 'to get to the last slide - SlidesControl.TypeKeys "<SHIFT F10>" '= open context menu + printlog "to get to the last slide" + SlidesControl.TypeKeys "<PAGEDOWN>", 3 + printlog "open context menu" + SlidesControl.TypeKeys "<SHIFT F10>" sleep 3 - ' Rename + printlog "Rename" if hMenuFindSelect(27268, true, 3) = false then Warnlog "Context-Menu-entry `Rename` was not found. Therefore the test ends." Call hCloseDocument @@ -970,10 +957,8 @@ testcase tiSlideCopyInSlideSorter NameDlgPage.OK sleep 1 - '/// Close Presentation. End testcase ///' + printlog "Close Presentation. End testcase" Call hCloseDocument endcase 'tiSlideCopyInSlideSorter '------------------------------------------------------------------------ - -'TODO FHA - Check the objects after pasting them. diff --git a/testautomation/graphics/optional/includes/impress/i_stylist.inc b/testautomation/graphics/optional/includes/impress/i_stylist.inc index 7efe28089365..1ef1773a5c55 100644 --- a/testautomation/graphics/optional/includes/impress/i_stylist.inc +++ b/testautomation/graphics/optional/includes/impress/i_stylist.inc @@ -29,15 +29,10 @@ '* '* short description : '* -'******************************************************************* -'* -' #1 tFormatStylistBackground -' #1 fGetSetPageBackground -'* '\******************************************************************* testcase tFormatStylistBackground -'/// special test for BUG # 96364 "Background style looses functionality over PPT Ex/import" ///' + printlog " special test for BUG # 96364 Background style looses functionality over PPT Ex/import" dim sFilter (50) as string dim sFileList (30) as string dim i as integer @@ -59,7 +54,7 @@ testcase tFormatStylistBackground goto endsub endif - '/// if not exists : gOfficePath + '\\user\\impress\\optional\\', create it ///' + printlog " if not exists : gOfficePath + '\\user\\impress\\optional\\', create it" if app.dir (ConvertPath ( gOfficePath + "user/work/impress") ) = "" then app.mkdir ConvertPath ( gOfficePath + "user/work/impress") endif @@ -67,23 +62,23 @@ testcase tFormatStylistBackground app.mkdir ConvertPath ( gOfficePath + "user/work/impress/optional") endif - '/// open application ///' + printlog " open application" Call hNewDocument iColor = 10 - '/// change background color via stylist ///' + printlog " change background color via stylist" if (iColor <> fGetSetPageBackground (iColor,0)) then warnlog "Stylist background was not changed as expected :-( "+iColor endif - '/// check if it is the same in Format -> Page ///' + printlog " check if it is the same in Format -> Page" if fGetSetPageBackground (0,1) <> iColor then warnlog " First stage error! Difference between stylist and menu entry :-( "+iColor endif - '/// save this in 3 formats: ///' - '///+ - StarImpress 5.0 ///' - '///+ - StarOffice 6.0 Presentation ///' - '///+ - Microsoft PowerPoint 97/2000/XP ///' + printlog " save this in 3 formats:" + printlog "+ - StarImpress 5.0" + printlog "+ - StarOffice 6.0 Presentation" + printlog "+ - Microsoft PowerPoint 97/2000/XP" FileSaveAs sleep 2 Kontext "SpeichernDlg" @@ -110,14 +105,14 @@ testcase tFormatStylistBackground printlog " saved with filter ("+i+"/3): "+ sFilter(i) next i - '/// close impress ///' + printlog "close impress" FileClose sleep 1 - kontext ' active about information loss ? + kontext if active.exists (5) then active.yes sleep 10 - '/// open just saved files ///' + printlog " open just saved files" sFileName = ConvertPath ( gOfficePath + "user/work/impress/optional/" ) GetFileList ( sFileName, "isty_*", sFileList() ) @@ -127,23 +122,23 @@ testcase tFormatStylistBackground hFileOpen ( sFileList(i) ) Sleep 5 If hIsNamedDocLoaded (sFileList(i)) Then - printlog " used filter: " + hGetUsedFilter() + printlog "used filter: " + hGetUsedFilter() else warnlog "document didn't get loaded" endif sleep 5 - '/// check if stylist, menue and prediction are as expected ///' + printlog " check if stylist, menue and prediction are as expected" iColor = 10 if ((fGetSetPageBackground (0,0) <> iColor) OR (fGetSetPageBackground (0,1) <> iColor)) then warnlog "Background was not as expected on loading :-( "+iColor endif iColor = 20 - '/// change background in stylist ///' + printlog " change background in stylist" if (fGetSetPageBackground (iColor,0) <> iColor) then warnlog "Stylist background was not changed as expected :-( "+iColor endif sleep 1 - '/// check if background is same in format menu ///' + printlog " check if background is same in format menu" if (fGetSetPageBackground (0,1) <> iColor) then warnlog "Format menu background is wrong :-( "+iColor endif @@ -151,7 +146,7 @@ testcase tFormatStylistBackground hCloseDocument sleep 2 next i -endcase +endcase 'tFormatStylistBackground '------------------------------------------------------------------------------ diff --git a/testautomation/graphics/optional/includes/impress/i_view.inc b/testautomation/graphics/optional/includes/impress/i_view.inc index e82ec2ec38a3..214676c3b1a0 100644 --- a/testautomation/graphics/optional/includes/impress/i_view.inc +++ b/testautomation/graphics/optional/includes/impress/i_view.inc @@ -41,31 +41,35 @@ testcase tAnsichtHintergrundNotizen Printlog "- View background notes" - Call hNewDocument '/// new document ///' + printlog "new document" + Call hNewDocument try - ViewNotes '/// view background notes ///' + printlog "view background notes" + ViewNotes sleep 3 catch Warnlog "View-Notes could not be accessed" endcatch ViewWorkspaceDrawingView sleep 1 - Call hCloseDocument '/// close document ///' + printlog "close document" + Call hCloseDocument sleep 1 -endcase +endcase 'tAnsichtHintergrundNotizen '------------------------------------------------------------------------------- testcase tViewWorkspaceHandoutView Printlog "- View background handout" - Call hNewDocument '/// new document ///' + printlog "new document" + Call hNewDocument sleep 2 Kontext "DocumentImpress" DocumentImpress.UseMenu hMenuSelectNr (5) hMenuSelectNr (13) Printlog " ViewWorkspaceHandoutView" - ViewWorkspaceHandoutView '/// view background handout ///' + ViewWorkspaceHandoutView sleep 2 Kontext "Tasks" sleep 2 @@ -75,9 +79,11 @@ testcase tViewWorkspaceHandoutView Printlog " ViewWorkspaceHandoutView works" end if Printlog "ViewWorkspaceHandoutView closed" - ViewWorkspaceDrawingView '/// back to view background drawing ///' - Call hCloseDocument '/// close document ///' -endcase + printlog "back to view background drawing" + ViewWorkspaceDrawingView + printlog "close document" + Call hCloseDocument +endcase 'tViewWorkspaceHandoutView '------------------------------------------------------------------------------- @@ -87,67 +93,67 @@ testcase tViewWorkspaceOutlineView dim sFile as string dim i as integer - '/// load a document with heading styles in writer and use the function 'writer:'File->Send->Outline to presentation' to get it into the presentation ///' + printlog "load a document with heading styles in writer and use the function 'writer:'File->Send->Outline to presentation' to get it into the presentation" ' all 'heading 1' are new slides - '/// document used : "graphics\\required\\input\\outlinefromwriter.sxw" -> you get into writer ///' + printlog "document used : graphics\\required\\input\\outlinefromwriter.sxw -> you get into writer" sFile = ConvertPath (gTesttoolPath + "graphics\required\input\outlinefromwriter.sxw") hDateiOeffnen (sFile) sleep 10 - '///+ with 'File->Send->Outline to presentation' you get into impress ///' + printlog "with 'File->Send->Outline to presentation' you get into impress" FileSendOutlineToPresentation sleep 10 - Printlog "'/// View->Workspace->Outline View ///'" + Printlog "printlog View->Workspace->Outline View" ViewWorkspaceOutlineView sleep 1 - '/// go to the line with the 'I' (via 'search & replace' function) ///' + printlog "go to the line with the 'I' (via 'search & replace' function)" hTypeKeys "<STRG HOME>" EditSelectAll hFindeImDokument ("I") - '///<b> expected level/style: 'Outline 8' </b>///' - '/// get last character from selected style in stylist (expect a number of the outline(heading level) ///' + printlog "expected level/style: 'Outline 8'" + printlog "get last character from selected style in stylist (expect a number of the outline(heading level)" fGetPresentationStyle ("8") - '/// type keys [home] [tab] to go one level down ///' + printlog "type keys [home] [tab] to go one level down" Kontext "DocumentImpressOutlineView" DocumentImpressOutlineView.TypeKeys "<Home><Tab>" - '///<b> expected level/style: 'Outline 9' </b>///' + printlog "expected level/style: 'Outline 9'" fGetPresentationStyle ("9") Kontext "DocumentImpressOutlineView" - '/// Edit - "Select All" to go select the whole text ///' + printlog "Edit - Select All to go select the whole text" EditSelectAll - '/// type keys [shift]+[tab] eight times, to get all lines to the highest, except the one with the 'I' ///' + printlog "type keys [shift]+[tab] eight times, to get all lines to the highest, except the one with the 'I'" DocumentImpressOutlineView.TypeKeys ("<Shift Tab>", 8) hPrepareSearchBUG hTypeKeys "<STRG HOME>" EditSelectAll hFindeImDokument ("I") - '///<b> expected level/style: 'Outline 1' </b>///' + printlog "expected level/style: 'Outline 1" fGetPresentationStyle ("1") - '/// type keys [shift]+[tab] to get the last line to the highest level, too ///' + printlog "type keys [shift]+[tab] to get the last line to the highest level, too" Kontext "DocumentImpressOutlineView" DocumentImpressOutlineView.TypeKeys ("<Shift Tab>", 1) - '///<b> expected level/style: 'Title' </b>///' + printlog "expected level/style: 'Title'" fGetPresentationStyle (0) Kontext "DocumentImpressOutlineView" DocumentImpressOutlineView.TypeKeys ("<escape>", 1) - Printlog "'///<b> call 'Edit->Undo' nine times </b>///'" + Printlog "call 'Edit->Undo' nine times" for i = 1 to 9 editundo next i hPrepareSearchBUG hFindeImDokument ("I") - '///<b> expected level/style: 'Outline 9' </b>///' + printlog "expected level/style: 'Outline 9'" fGetPresentationStyle (9) - Printlog "'///<b> call 'Edit->Redo' nine times </b>///'" + Printlog "call 'Edit->Redo' nine times " for i = 1 to 9 editredo next i @@ -162,10 +168,10 @@ hPrepareSearchBUG hTypeKeys "<STRG HOME>" EditSelectAll hFindeImDokument ("I") - '///<b> expected level/style: 'Title' </b>///' + printlog "expected level/style: 'Title'" fGetPresentationStyle (0) - Printlog "'///<b> call 'Edit->Undo' nine times </b>///'" + Printlog "call 'Edit->Undo' nine times" for i = 1 to 9 editundo next i @@ -174,13 +180,13 @@ hPrepareSearchBUG hTypeKeys "<STRG HOME>" EditSelectAll hFindeImDokument ("I") - '///<b> expected level/style: 'Outline 9' </b>///' + printlog "expected level/style: 'Outline 9" fGetPresentationStyle (9) - '/// type keys [strg]+[A] ///' + printlog "type keys [strg]+[A]" Kontext "DocumentImpressOutlineView" EditSelectAll - '/// type keys [strg]+[X] ///' + printlog "type keys [strg]+[X]" DocumentImpressOutlineView.TypeKeys "<mod1 X>" kontext @@ -191,17 +197,17 @@ hPrepareSearchBUG Warnlog "messagebox missing ! (about deleting pages with graphic objects:)" endif - '/// 'Edit->Undo' ///' + printlog "'Edit->Undo'" editundo - '/// 'Edit->Redo' ///' + printlog "'Edit->Redo'" editredo - '/// 'Edit->Undo' ///' + printlog "'Edit->Undo'" editundo - '/// type keys [strg]+[A] ///' + printlog "type keys [strg]+[A]" Kontext "DocumentImpressOutlineView" EditSelectAll - '/// type keys [strg]+[X] ///' + printlog "type keys [strg]+[X]" DocumentImpressOutlineView.TypeKeys "<mod1 X>" kontext @@ -212,23 +218,23 @@ hPrepareSearchBUG Warnlog "messagebox missing ! (about deleting pages with graphic objects:)" endif - '/// type keys [strg]+[V] ///' + printlog "type keys [strg]+[V]" Kontext "DocumentImpressOutlineView" DocumentImpressOutlineView.TypeKeys "<mod1 V>" - '/// 'Edit->Undo' ///' + printlog "'Edit->Undo'" editundo - '/// 'Edit->Redo' ///' + printlog "'Edit->Redo'" editredo - '/// type keys [strg]+[End] ///' + printlog "type keys [strg]+[End]" Kontext "DocumentImpressOutlineView" DocumentImpressOutlineView.TypeKeys "<mod1 End>" - '/// type keys [strg]+[V] ///' + printlog "type keys [strg]+[V]" DocumentImpressOutlineView.TypeKeys "<mod1 V>" - '/// type keys [strg]+[A] ///' + printlog "type keys [strg]+[A]" EditSelectAll - '/// type keys [delete] ///' + printlog "type keys [delete]" DocumentImpressOutlineView.TypeKeys "<delete>" kontext @@ -240,7 +246,7 @@ hPrepareSearchBUG Warnlog "messagebox missing ! (about deleting pages with graphic objects:)" endif - '/// type keys [strg]+[A] ///' + printlog "type keys [strg]+[A]" Kontext "DocumentImpressOutlineView" EditSelectAll try @@ -250,7 +256,7 @@ hPrepareSearchBUG Warnlog "error 4711 TBO :-(" endcatch - '/// type keys [delete] ///' + printlog "type keys [delete]" Kontext "DocumentImpressOutlineView" DocumentImpressOutlineView.TypeKeys "<delete>" @@ -273,44 +279,50 @@ hPrepareSearchBUG endcatch ViewWorkspaceDrawingView - Call hCloseDocument '/// close document ///' - Call hCloseDocument '/// close document ///' -endcase + printlog "close document" + Call hCloseDocument +endcase 'tViewWorkspaceOutlineView '------------------------------------------------------------------------------- testcase tViewWorkspaceDrawingView Printlog "- View/Background-drawing" - Call hNewDocument '/// new document ///' + printlog "new document" + Call hNewDocument sleep 2 - ViewDrawing '/// view background drawing ///' + printlog "view background drawing" + ViewDrawing try - hRechteckErstellen ( 20,20,40,40 ) '/// create rectangle ///' + printlog "create rectangle" + hRechteckErstellen ( 20,20,40,40 ) sleep 1 Printlog " - rectangle created" catch Warnlog " Rectangle could not be created" endcatch - Call hCloseDocument '/// close document ///' -endcase + printlog "close document" + Call hCloseDocument +endcase 'tViewWorkspaceDrawingView '------------------------------------------------------------------------------- testcase tAnsichtEbene - printLog "- View/Layer" '/// view layer ///' - - - FileAutopilotPresentation '/// new document-autopilot ///' + printLog "- View/Layer" + + printlog "new document-autopilot" + FileAutopilotPresentation Kontext "AutopilotPraesentation1" sleep 5 AutopilotPraesentation1.Ok sleep 2 sleep 2 - ViewSlide '/// back to view slide ///' + printlog "back to view slide" + ViewSlide Sleep 2 - - Call hCloseDocument '/// close document ///' -endcase + printlog "close document" + Call hCloseDocument + +endcase 'tAnsichtEbene '------------------------------------------------------------------------------- diff --git a/testautomation/graphics/optional/includes/impress/options.inc b/testautomation/graphics/optional/includes/impress/options.inc index cfce04e68805..d67eaea8d195 100644 --- a/testautomation/graphics/optional/includes/impress/options.inc +++ b/testautomation/graphics/optional/includes/impress/options.inc @@ -41,8 +41,7 @@ function tiPEngineOptionsTest dim lala, optsound, os, oa, odc, ota, ets, etspeed, etrep, etshap, etgt as integer Kontext "Tasks" -' if (NOT bError) then - '/// CLick on button '...' (Options) ///' + printlog "CLick on button '...' (Options)" EffectOptions.Click kontext "TabEffect" if TabEffect.Exists(5) then @@ -56,13 +55,6 @@ function tiPEngineOptionsTest kontext "TabEffect" else kontext "TabEffect" -' if play.isEnabled then -' try -' play.click -' catch -' warnlog Sound.GetSelText + " wasn't played correctly." -' endcatch -' endif endif next os if AfterAnimation.isEnabled AND AfterAnimation.isVisible then @@ -89,7 +81,7 @@ function tiPEngineOptionsTest for ota = 1 to TextAnimation.GetItemCount TextAnimation.Select ota next ota - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext Active.SetPage TabTiming kontext "TabTiming" @@ -130,7 +122,7 @@ function tiPEngineOptionsTest else warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work." endif - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext active.setPage TabTextAnimation kontext "TabTextAnimation" @@ -163,9 +155,9 @@ function tiPEngineOptionsTest warnlog "Impress:Tasks Pane:Custom Animation:... button didn't work." endif Kontext "Tasks" -end function - +end function 'tiPEngineOptionsTest +'------------------------------------------------------------------------------- function optionstest2 dim filedialogue as boolean @@ -188,7 +180,7 @@ function optionstest2 else Warnlog "DelayBetweenCharacters should have been enabled" endif - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext Active.SetPage TabTiming kontext "TabTiming" @@ -234,7 +226,7 @@ function optionstest2 else warnlog "Impress:Tasks Pane:Custom Animation:Effect Options: Timing TabPage didn't work." endif - '/// switch to TabPage 'Timing' ///' + printlog "switch to TabPage 'Timing'" Kontext active.setPage TabTextAnimation kontext "TabTextAnimation" @@ -267,4 +259,4 @@ function optionstest2 warnlog "Impress:Tasks Pane:Custom Animation:... button didn't work." endif Kontext "Tasks" -end function +end function 'optionstest2
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/global/id_001.inc b/testautomation/graphics/required/includes/global/id_001.inc index 5e2b4912f6e7..fee150c8381a 100644 --- a/testautomation/graphics/required/includes/global/id_001.inc +++ b/testautomation/graphics/required/includes/global/id_001.inc @@ -82,9 +82,9 @@ testcase tiFileSaveAs sFilter (0) = 0 ' initalize ;-)... printlog " used document: graphics\required\input\tbo_alf_.od?" - sFileName = "graphics\required\input\tbo_alf_." + ExtensionString ' this is the file with all features + sFileName = "graphics\required\input\tbo_alf_." + ExtensionString printlog "FileName is " + sFileName - sFile = "isas_" ' this is the filename of the export files + sFile = "isas_" sPath = ConvertPath ( gOfficePath + "user/work/graphics/required/"+gApplication+"\"+ gPlatform) ' this is the export path printlog "sPath is " + sPath if dir (sPath) = "" then @@ -92,7 +92,7 @@ testcase tiFileSaveAs end if printlog " deleting all files in output directory: \\user\\work\\graphics\\required\\gApplication gPlatform isas_*" - if gSamePC = TRUE then ' delete export directory + if gSamePC = TRUE then GetFileList ( sPath, sFile+"*", Exlist() ) if KillFileList ( Exlist() ) <> TRUE then Warnlog "Couldn't delete all Files in Output-Export-Directory, the followings are still there:" @@ -107,7 +107,7 @@ testcase tiFileSaveAs WaitSlot (3000) printlog "running 5 times save as with different Filters" - for i = 1 to 6 'run it 5 times + for i = 1 to 6 printlog "calling Save as Dialog" FileSaveAs WaitSlot (2000) diff --git a/testautomation/graphics/required/includes/global/id_004.inc b/testautomation/graphics/required/includes/global/id_004.inc index 42b0170fe6ef..a14912c6f141 100644 --- a/testautomation/graphics/required/includes/global/id_004.inc +++ b/testautomation/graphics/required/includes/global/id_004.inc @@ -307,11 +307,11 @@ testcase tiInsertChart InsertChart WaitSlot (2000) Kontext "Messagebox" - if Messagebox.Exists then - Warnlog Messagebox.GetText - Messagebox.OK - sleep 1 - end if + if Messagebox.Exists then + Warnlog Messagebox.GetText + Messagebox.OK + sleep 1 + end if gMouseClick 1,1 sleep 2 printlog "close application " @@ -360,17 +360,17 @@ testcase tiInsertSpreadsheet InsertSpreadsheetDraw WaitSlot (2000) Kontext "Messagebox" - if Messagebox.Exists (5) then - Warnlog Messagebox.GetText - Messagebox.OK - end if - sleep 2 - printlog "click somewhere out of the object, to deselect it " - gMouseClick 1,1 - sleep 1 - printlog "select and delete object with keys: <Tab><Delete> " - hTypekeys "<Tab><Delete>" - sleep 2 + if Messagebox.Exists (5) then + Warnlog Messagebox.GetText + Messagebox.OK + end if + sleep 2 + printlog "click somewhere out of the object, to deselect it " + gMouseClick 1,1 + sleep 1 + printlog "select and delete object with keys: <Tab><Delete> " + hTypekeys "<Tab><Delete>" + sleep 2 printlog "close application " Call hCloseDocument diff --git a/testautomation/graphics/required/includes/global/id_005.inc b/testautomation/graphics/required/includes/global/id_005.inc index 6ec5a5988235..cba38479f34b 100644 --- a/testautomation/graphics/required/includes/global/id_005.inc +++ b/testautomation/graphics/required/includes/global/id_005.inc @@ -54,7 +54,7 @@ sub id_005 call tiFormatFontwork call tiFormatGroup printlog " format->group is also modify->group " - ' tiFormatLayer ' not in impress + end sub '------------------------------------------------------------------------------ testcase tiFormatDefault diff --git a/testautomation/graphics/required/includes/global/id_006.inc b/testautomation/graphics/required/includes/global/id_006.inc index ccdfc5eb3e69..1b3a8b3c39a9 100644 --- a/testautomation/graphics/required/includes/global/id_006.inc +++ b/testautomation/graphics/required/includes/global/id_006.inc @@ -43,19 +43,21 @@ sub id_Tools call tiToolsEyedropper call tToolsOptionsTest ' global one end sub + '------------------------------------------------------------------------------- + testcase tiToolsSpellchecking if not gOOO then ' Spellcheck doesn't work in OOo builds. - '/// open application ///' + printlog "open application" Call hNewDocument - WaitSlot (2000) 'sleep 2 - '/// call subroutine 'hSetSpellHypLanguage' for setting the default language in th eoptions, to enable it for languages, which don't provide a dictionary (usually asian ones) ///' + WaitSlot (2000) + printlog " call subroutine 'hSetSpellHypLanguage' for setting the default language in th eoptions, to enable it for languages, which don't provide a dictionary (usually asian ones)" call hSetSpellHypLanguage - '/// create textframe with content ///' + printlog "create textframe with content" Call hTextrahmenErstellen ("Whaaaat", 10, 10, 30, 40) sleep 1 - '/// Tools->Spellcheck->Check ///' + printlog "Tools->Spellcheck->Check" ToolsSpellCheck WaitSlot (1000) 'sleep 1 Kontext "MessageBox" @@ -67,14 +69,14 @@ testcase tiToolsSpellchecking Kontext "Rechtschreibung" if Rechtschreibung.exists then Call DialogTest ( Rechtschreibung ) - '/// close dialog 'Spellcheck' ///' + printlog "close dialog 'Spellcheck'" Rechtschreibung.Close else warnlog " Spellcheck dialog didn't came up :-(" end if end if sleep 1 - '/// say OK to messagebox about 'Spellcheck has been completed' ///' + printlog "say OK to messagebox about 'Spellcheck has been completed'" Kontext "Messagebox" if Messagebox.exists (5) then warnlog "Shouldn't be any messagebox after pressing close in spellchecker" @@ -82,26 +84,30 @@ testcase tiToolsSpellchecking sleep (2) Kontext end if - '/// close application ///' + printlog "close application" Call hCloseDocument else goto endsub endif -endcase +endcase 'tiToolsSpellchecking + '------------------------------------------------------------------------------- + testcase tiToolsSpellcheckingAutomatic - '/// open application ///' + printlog "open application" Call hNewDocument - '/// Tools->Spellcheck->AutoSpellcheck ///' + printlog "Tools->Spellcheck->AutoSpellchec" ToolsSpellcheckAutoSpellcheck - '/// create textframe with text ///' + printlog " create textframe with text " Call hTextrahmenErstellen ("What", 10, 10, 30, 40) sleep 2 - '/// Tools->Spellcheck->AutoSpellcheck ///' + printlog "Tools->Spellcheck->AutoSpellcheck " ToolsSpellcheckAutoSpellcheck - '/// close application ///' + printlog "close application " Call hCloseDocument -endcase +endcase 'tiToolsSpellcheckingAutomatic + '------------------------------------------------------------------------------- + testcase tiToolsThesaurus Dim sWord as string Dim sExt as string @@ -164,9 +170,7 @@ testcase tiToolsThesaurus sWord = "Hello" endif end select - PrintLog "Thesaurus with 1 word: " + sWord - if( gApplication = "DRAW" ) then sExt = ".odg" elseif( Ucase(gApplication) = "IMPRESS" ) then @@ -176,7 +180,6 @@ testcase tiToolsThesaurus hFileOpenLocally( gTesttoolpath + "graphics\required\input\recht_" + iSprache + sExt) Call hTextrahmenErstellen (sWord,20,20,50,30) sleep 1 - printlog "select the word" hTypeKeys "<Home><SHIFT END>" @@ -195,132 +198,138 @@ testcase tiToolsThesaurus warnlog "the thesaurus does not appear" end if Call hCloseDocument -endcase +endcase 'tiToolsThesaurus + '------------------------------------------------------------------------------- + testcase tiToolsHyphenation - '/// open application ///' + printlog "open application " Call hNewDocument - '/// Tools->Hyphenation ///' + printlog "Tools->Hyphenation " ToolsLanguageHyphenationDraw - WaitSlot (2000) 'sleep 2 - '/// Tools->Hyphenation ///' + WaitSlot (2000) + printlog "Tools->Hyphenation " ToolsLanguageHyphenationDraw - '/// close application ///' + printlog "close application " Call hCloseDocument -endcase +endcase 'tiToolsHyphenation + '------------------------------------------------------------------------------- + testcase tiToolsAutoCorrect dim iLanguage as integer ' for resetting the language - '/// open application ///' + printlog "open application " Call hNewDocument - WaitSlot (1000) 'sleep 1 - '/// Tools->Autocorrect ///' + WaitSlot (1000) + printlog "Tools->Autocorrect " ToolsAutocorrect - WaitSlot (2000) 'sleep 1 + WaitSlot (2000) Kontext - '/// select tabpage 'Replace' ///' + printlog "select tabpage 'Replace' " Messagebox.SetPage TabErsetzung Kontext "TabErsetzung" - Call DialogTest ( TabErsetzung ) - '/// remember the language, that is selected in the 'Replacements and exceptions for Language' Listbox ///' - iLanguage = WelcheSprache.GetSelIndex - '///+ change the language to the 1st from the top ///' - WelcheSprache.Select 1 ' select language with empty list - '///+ type something into the field 'replace' ///' - Kuerzel.SetText "a" - '///+ type something into the field 'with' ///' - ErsetzenDurch.SetText "b" - '///+ click button 'new' ///' - Neu.Click - sleep 1 - '///+ click button 'delete' ///' + Call DialogTest ( TabErsetzung ) + printlog "remember the language, that is selected in the 'Replacements and exceptions for Language' Listbox " + iLanguage = WelcheSprache.GetSelIndex + printlog "+ change the language to the 1st from the top " + WelcheSprache.Select 1 ' select language with empty list + printlog "+ type something into the field 'replace' " + Kuerzel.SetText "a" + printlog "+ type something into the field 'with' " + ErsetzenDurch.SetText "b" + printlog "+ click button 'new' " + Neu.Click + sleep 1 + printlog "+ click button 'delete' " + Loeschen.Click + sleep 1 + try + printlog "+ click button 'delete' again " Loeschen.Click - sleep 1 - try - '///+ click button 'delete' again ///' - Loeschen.Click - catch - printlog "ok was CRASH before" '# - endcatch - '///+ if nothing happens it is ok, was a Crash before :-( ///' - '///+ restore cthe remembered language ///' - WelcheSprache.select (iLanguage) - Kontext - '/// select tabpage 'Exception' ///' - Messagebox.SetPage TabAusnahmen - Kontext "TabAusnahmen" - Call DialogTest ( TabAusnahmen ) - '/// type something into the field 'Abbreviations' ///' - Abkuerzungen.settext "Lala" - '///+ click button 'new' in 'Abbreviations' ///' - AbkuerzungenNeu.click - '///+ click button 'delete' in 'Abbreviations' ///' - AbkuerzungenLoeschen.click - '/// type something into the field 'Word with TWo INitial CApitals' ///' - Woerter.settext "LALA" - '///+ check the checkbox 'AutoInclude' in 'Word with TWo INitial CApitals' ///' - WoerterAutomatisch.Check - '///+ click button 'new' in 'Word with TWo INitial CApitals' ///' - WoerterNeu.click - '///+ click button 'delete' in 'Word with TWo INitial CApitals' ///' - WoerterLoeschen.click - '///+ UNcheck the checkbox 'AutoInclude' in 'Word with TWo INitial CApitals' ///' - WoerterAutomatisch.UnCheck - Kontext - '/// select tabpage 'Options' ///' - Messagebox.SetPage TabOptionen - Kontext "TabOptionen" - Call DialogTest ( TabOptionen ) - Kontext - '/// select tabpage 'Custom Quotes' ///' - Messagebox.SetPage TabLocalizedOptions - Kontext "TabLocalizedOptions" ' 1a - '/// in the part of 'single quotes': ///' - '///+ check 'replace' ///' - '///+ click 'start quote' ///' - SingleQuotesReplace.Check - SingleQuotesStart.Click - Kontext "Sonderzeichen" - Call DialogTest ( Sonderzeichen, 1 ) - '///+ cancel dialog 'start quote' ///' - Sonderzeichen.Cancel - Kontext "TabLocalizedOptions" ' 1b - '///+ click 'end quote' ///' - SingleQuotesEnd.Click - Kontext "Sonderzeichen" - Call DialogTest ( Sonderzeichen, 2 ) - '///+ cancel dialog 'end quote' ///' - Sonderzeichen.Cancel - Kontext "TabLocalizedOptions" ' 1s - '///+ click button 'default' ///' - SingleQuotesDefault.Click - - Kontext "TabLocalizedOptions" ' 2a - '/// in the part of 'double quotes': ///' - '///+ click 'start quote' ///' - DoubleQuotesStart.Click - Kontext "Sonderzeichen" - Call DialogTest ( Sonderzeichen, 3 ) - '///+ cancel dialog 'start quote' ///' - Sonderzeichen.Cancel - Kontext "TabLocalizedOptions" ' 2b - '///+ click 'end quote' ///' - DoubleQuotesEnd.Click - Kontext "Sonderzeichen" - Call DialogTest ( Sonderzeichen, 4 ) - '///+ cancel dialog 'end quote' ///' - Sonderzeichen.Cancel - Kontext "TabLocalizedOptions" ' 2s - '///+ click button 'default' ///' - DoubleQuotesDefault.Click - '///+ UNcheck 'replace' ///' - SingleQuotesReplace.UnCheck - '/// cancel dialog 'AtorCorrect' ///' - TabLocalizedOptions.cancel - '/// close application ///' + catch + printlog "ok was CRASH before" + endcatch + printlog "+ if nothing happens it is ok, was a Crash before :-( " + printlog "+ restore cthe remembered language " + WelcheSprache.select (iLanguage) + Kontext + printlog "select tabpage 'Exception' " + Messagebox.SetPage TabAusnahmen + Kontext "TabAusnahmen" + Call DialogTest ( TabAusnahmen ) + printlog "type something into the field 'Abbreviations' " + Abkuerzungen.settext "Lala" + printlog "+ click button 'new' in 'Abbreviations' " + AbkuerzungenNeu.click + printlog "+ click button 'delete' in 'Abbreviations' " + AbkuerzungenLoeschen.click + printlog "type something into the field 'Word with TWo INitial CApitals' " + Woerter.settext "LALA" + printlog "+ check the checkbox 'AutoInclude' in 'Word with TWo INitial CApitals' " + WoerterAutomatisch.Check + printlog "+ click button 'new' in 'Word with TWo INitial CApitals' " + WoerterNeu.click + printlog "+ click button 'delete' in 'Word with TWo INitial CApitals' " + WoerterLoeschen.click + printlog "+ UNcheck the checkbox 'AutoInclude' in 'Word with TWo INitial CApitals' " + WoerterAutomatisch.UnCheck + Kontext + printlog "select tabpage 'Options' " + Messagebox.SetPage TabOptionen + Kontext "TabOptionen" + Call DialogTest ( TabOptionen ) + Kontext + printlog "select tabpage 'Custom Quotes' " + Messagebox.SetPage TabLocalizedOptions + Kontext "TabLocalizedOptions" ' 1a + printlog "in the part of 'single quotes': " + printlog "+ check 'replace' " + printlog "+ click 'start quote' " + SingleQuotesReplace.Check + SingleQuotesStart.Click + Kontext "Sonderzeichen" + Call DialogTest ( Sonderzeichen, 1 ) + printlog "+ cancel dialog 'start quote' " + Sonderzeichen.Cancel + Kontext "TabLocalizedOptions" ' 1b + printlog "+ click 'end quote' " + SingleQuotesEnd.Click + Kontext "Sonderzeichen" + Call DialogTest ( Sonderzeichen, 2 ) + printlog "+ cancel dialog 'end quote' " + Sonderzeichen.Cancel + Kontext "TabLocalizedOptions" ' 1s + printlog "+ click button 'default' " + SingleQuotesDefault.Click + + Kontext "TabLocalizedOptions" ' 2a + printlog " in the part of 'double quotes': " + printlog "+ click 'start quote' " + DoubleQuotesStart.Click + Kontext "Sonderzeichen" + Call DialogTest ( Sonderzeichen, 3 ) + printlog "+ cancel dialog 'start quote' " + Sonderzeichen.Cancel + Kontext "TabLocalizedOptions" ' 2b + printlog "+ click 'end quote' " + DoubleQuotesEnd.Click + Kontext "Sonderzeichen" + Call DialogTest ( Sonderzeichen, 4 ) + printlog "+ cancel dialog 'end quote' " + Sonderzeichen.Cancel + Kontext "TabLocalizedOptions" ' 2s + printlog "+ click button 'default' " + DoubleQuotesDefault.Click + printlog "+ UNcheck 'replace' " + SingleQuotesReplace.UnCheck + printlog " cancel dialog 'AtorCorrect' " + TabLocalizedOptions.cancel + printlog " close application " Call hCloseDocument -endcase + +endcase 'tiToolsAutoCorrect '------------------------------------------------------------------------------- + testcase tChineseTranslation qaerrorlog( "#i89634# - Chinese Translation dialog does not close" ) @@ -335,139 +344,143 @@ testcase tChineseTranslation sFileName = "graphics\required\input\tchinese.odg" end if - '/// Open application ///' + printlog "Open application " Call hNewDocument - WaitSlot (2000) 'sleep 1 - '/// Save old state and Activate Support for Asian language ///' + WaitSlot (2000) + printlog "Save old state and Activate Support for Asian language " bSavedAsianSupport = ActiveDeactivateAsianSupport(TRUE) - '/// Open Document ///' + printlog "Open Document " Call hFileOpen ( ConvertPath(gTesttoolPath + sFileName) ) - '/// If write-protected - open as Temp-file ///' + printlog "If write-protected - open as Temp-file " sleep (2) Kontext "Standardbar" - if Bearbeiten.GetState(2) <> 1 then - Bearbeiten.Click '0 = not pressed. 1 = pressed. - Kontext - if Active.Exists(1) then - Active.Yes - else - warnlog "No messagebox after making document editable? - Test canceled here" - goto endsub - end if + if Bearbeiten.GetState(2) <> 1 then + Bearbeiten.Click '0 = not pressed. 1 = pressed. + Kontext + if Active.Exists(1) then + Active.Yes + else + warnlog "No messagebox after making document editable? - Test canceled here" + goto endsub end if + end if if uCase(gApplication) = "IMPRESS" then Kontext "DocumentImpress" else Kontext "DocumentDraw" end if - '/// Select all, Press RETURN to enter text in Editmode ///' - '/// Move marker to top of the text, go two steps right, mark two characters ///' + printlog "Select all, Press RETURN to enter text in Editmode " + printlog "Move marker to top of the text, go two steps right, mark two characters " EditSelectAll hTypeKeys "<RETURN>" hTypeKeys "<MOD1 HOME><RIGHT><RIGHT><SHIFT RIGHT RIGHT>" - '/// Open Chinesetranslation ///' + printlog "Open Chinesetranslation " ToolsChineseTranslation WaitSlot (2000) 'sleep 1 kontext "ChineseTranslation" - '/// Check if everything is there ///' - Call DialogTest ( ChineseTranslation ) - '/// Click on EditTerms ///' - EditTerms.Click - kontext "ChineseDictionary" - '/// Check if everything is there ///' - Call DialogTest ( ChineseDictionary ) - '/// Close dialog 'ChineseDictionary' with 'OK' ///' - ChineseDictionary.Ok + printlog " Check if everything is there " + Call DialogTest ( ChineseTranslation ) + printlog " Click on EditTerms " + EditTerms.Click + kontext "ChineseDictionary" + printlog " Check if everything is there " + Call DialogTest ( ChineseDictionary ) + printlog " Close dialog 'ChineseDictionary' with 'OK' " + ChineseDictionary.Ok kontext "ChineseTranslation" - '/// Close dialog 'Chinese' with 'OK' ///' - ChineseTranslation.OK + printlog " Close dialog 'Chinese' with 'OK' " + ChineseTranslation.OK kontext - '/// if messagebox exist, say OK; ('Spellcheck completed' or 'Word not found') ///' - if Messagebox.exists (5) then - printlog "Messagebox: "+Messagebox.gettext+"'" - Messagebox.ok - end if - '/// Restore old state for Asian language ///' + printlog " if messagebox exist, say OK; ('Spellcheck completed' or 'Word not found') " + if Messagebox.exists (5) then + printlog "Messagebox: "+Messagebox.gettext+"'" + Messagebox.ok + end if + printlog " Restore old state for Asian language " ActiveDeactivateAsianSupport(bSavedAsianSupport) - '/// Close application ///' + printlog " Close application " Call hCloseDocument -endcase + +endcase 'tChineseTranslation '------------------------------------------------------------------------------- + testcase tiToolsMacro - '/// open application ///' + printlog "open application " Call hNewDocument WaitSlot (2000) 'sleep 2 - '/// Tools->Macro ///' + printlog "Tools->Macro " ToolsMacro Kontext "Makro" - Call DialogTest ( Makro ) - '/// click button 'organizer...' ///' - Verwalten.Click - + Call DialogTest ( Makro ) + printlog "click button 'organizer...' " + Verwalten.Click Kontext - '/// switch to tabpage 'Modules' ///' - Messagebox.SetPage TabModule - Kontext "TabModule" - Call DialogTest ( TabModule ) - + printlog "switch to tabpage 'Modules' " + Messagebox.SetPage TabModule + Kontext "TabModule" + Call DialogTest ( TabModule ) Kontext - '/// switch to tabpage 'Libraries' ///' - Messagebox.SetPage TabBibliotheken - Kontext "TabBibliotheken" - Call DialogTest ( TabBibliotheken ) - '/// click lbutton 'append' ///' - Hinzufuegen.Click - Kontext "Messagebox" - if Messagebox.Exists (5) then - if Messagebox.GetRT = 304 then - Warnlog Messagebox.Gettext - Messagebox.Ok - end if - end if - Kontext "OeffnenDlg" - '/// cancel dialog 'append libraries' ///' - OeffnenDlg.Cancel - Kontext "TabBibliotheken" - '/// click button 'new' ///' - Neu.Click - kontext "NeueBibliothek" - sleep 1 'Bibliotheksname - '/// cancel dialog 'new library' ///' - NeueBibliothek.cancel - Kontext "TabBibliotheken" - '/// close dialog 'macro organizer' ///' - TabBibliotheken.Close + printlog "switch to tabpage 'Libraries' " + Messagebox.SetPage TabBibliotheken + Kontext "TabBibliotheken" + Call DialogTest ( TabBibliotheken ) + printlog "click lbutton 'append' " + Hinzufuegen.Click + Kontext "Messagebox" + if Messagebox.Exists (5) then + if Messagebox.GetRT = 304 then + Warnlog Messagebox.Gettext + Messagebox.Ok + end if + end if + Kontext "OeffnenDlg" + printlog "cancel dialog 'append libraries' " + OeffnenDlg.Cancel + Kontext "TabBibliotheken" + printlog "click button 'new' " + Neu.Click + kontext "NeueBibliothek" + sleep 1 'Bibliotheksname + printlog "cancel dialog 'new library' " + NeueBibliothek.cancel + Kontext "TabBibliotheken" + printlog "close dialog 'macro organizer' " + TabBibliotheken.Close Kontext "Makro" - '/// close dialog 'macro' ///' - Makro.Cancel - '/// close application ///' + printlog "close dialog 'macro' " + Makro.Cancel + printlog "close application " Call hCloseDocument -endcase +endcase 'tiToolsMacro + '------------------------------------------------------------------------------- + testcase tiToolsGallery - '/// open application ///' + printlog "open application " Call hNewDocument - '/// Tools->Gallery ///' + printlog "Tools->Gallery " ToolsGallery WaitSlot (2000) 'sleep 1 - '/// Tools->Gallery ///' + printlog "Tools->Gallery " ToolsGallery - '/// close application ///' + printlog "close application " Call hCloseDocument -endcase +endcase'tiToolsGallery + '------------------------------------------------------------------------------- + testcase tiToolsEyedropper - '/// open application ///' + printlog "open application " Call hNewDocument - '/// Tools->Eyedropper ///' + printlog "Tools->Eyedropper " ToolsEyedropper Kontext "Pipette" Call DialogTest (Pipette) - '/// close dialog 'Eyedropper' ///' + printlog "close dialog 'Eyedropper' " Pipette.Close sleep 1 - '/// close application ///' + printlog "close application " Call hCloseDocument -endcase +endcase 'tiToolsEyedropper diff --git a/testautomation/graphics/required/includes/global/id_007.inc b/testautomation/graphics/required/includes/global/id_007.inc index 29791d4b716f..81c265bca515 100644 --- a/testautomation/graphics/required/includes/global/id_007.inc +++ b/testautomation/graphics/required/includes/global/id_007.inc @@ -34,7 +34,6 @@ sub id_007 printLog Chr(13) + "--------- id_007 ----------" - ' in imp available via context menu, in draw via modify menu call tdModifyFlipVertikal call tdModifyFlipHorizontal @@ -56,487 +55,460 @@ sub id_007 call tdModifyCombineSplit end sub '------------------------------------------------------------------------------- -testcase tdModifyFlipVertikal - '/// open application ///' +testcase tdModifyFlipVertikal + printlog "open application" Call hNewDocument ' imp: contextmenue same SID! sleep 1 - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) try - '/// imp: Kontextmenu: Flip->Vertically ///' - '///+ Modify->Flip->Vertically ///' + printlog "imp: Kontextmenu: Flip->Vertically" ContextFlipVerticalDraw Printlog "- Flip-vertical is working" catch Warnlog "- Flip-Vertical does not work" endcatch sleep 1 - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyFlipVertikal '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyFlipHorizontal - '/// open application ///' + printlog "open application" Call hNewDocument ' imp: contextmenue same SID! WaitSlot (1000) - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) try - '/// imp: Kontextmenu: Flip->Horizontally ///' - '///+ Modify->Flip->Horizontally ///' + printlog "imp: Kontextmenu: Flip->Horizontally" ContextFlipHorizontalDraw Printlog "- Flip-horizontal is working" catch Warnlog "- Flip-horizontal does not work" endcatch sleep 1 - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyFlipHorizontal '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertIntoCurve - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) - '/// Modify->Convert->To Curve ///' - '///+ Modify->Convert->To Curve ///' + printlog "Modify->Convert->To Curve" ContextConvertIntoCurve WaitSlot (2000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertIntoCurve '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertIntoPolygon dim iWaitIndex as integer - '/// open application ///' - Call hNewDocument ' imp: contextmenue same SID! + + printlog "open application" + Call hNewDocument InsertGraphicsFromFile Kontext "GrafikEinfuegenDlg" - '/// Check if the dialogue is there. If not - wait for maximum 10 seconds) - iWaitIndex = 0 - do while NOT GrafikEinfuegenDlg.Exists AND iWaitIndex < 10 - sleep(1) - iWaitIndex = iWaitIndex + 1 - loop - if NOT GrafikEinfuegenDlg.Exists AND iWaitIndex = 10 then - warnlog "Dialogue Insert Graphics didnt work. Ending testcase." - Call hCloseDocument - goto endsub - end if - '/// insert graphic: "global\input\graf_inp\enter.bmp" ///' - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") - Oeffnen.Click - sleep 3 - '/// Modify->Convert->To Polygon ///' - '/// Modify->Convert->To Polygon ///' - ContextConvertIntoPolygon - Kontext "InPolygonUmwandeln" - Call DialogTest (InPolygonUmwandeln) - '/// check checkbox: 'Fill holes' ///' - LoecherFuellen.Check - '/// click more in number field: 'Number of colors' ///' - Farbanzahl.More - '/// click more in number field: 'Point reductionn' ///' - Punktreduktion.More - '/// click more in number field: 'Tile size' ///' - Kachelgroesse.More - '/// click button 'Preview' ///' - Vorschau.Click - sleep 10 - '/// cancel dialog 'Convert to Polygon' ///' - InPolygonUmwandeln.Cancel - sleep (2) - '/// close application ///' + printlog "Check if the dialogue is there. If not - wait for maximum 10 seconds)" + iWaitIndex = 0 + do while NOT GrafikEinfuegenDlg.Exists AND iWaitIndex < 10 + sleep(1) + iWaitIndex = iWaitIndex + 1 + loop + if NOT GrafikEinfuegenDlg.Exists AND iWaitIndex = 10 then + warnlog "Dialogue Insert Graphics didnt work. Ending testcase." + Call hCloseDocument + goto endsub + end if + printlog "insert graphic: global\input\graf_inp\enter.bmp" + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\enter.bmp") + Oeffnen.Click + sleep 3 + printlog "Modify->Convert->To Polygon" + ContextConvertIntoPolygon + Kontext "InPolygonUmwandeln" + Call DialogTest (InPolygonUmwandeln) + printlog "check checkbox: 'Fill holes'" + LoecherFuellen.Check + printlog "click more in number field: 'Number of colors'" + Farbanzahl.More + printlog "click more in number field: 'Point reductionn'" + Punktreduktion.More + printlog "click more in number field: 'Tile size'" + Kachelgroesse.More + printlog "click button 'Preview'" + Vorschau.Click + sleep 10 + printlog "cancel dialog 'Convert to Polygon'" + InPolygonUmwandeln.Cancel + sleep (2) + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertIntoPolygon '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertIntoContour - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) - '/// Modify->Convert->To Contour ///' - '/// Modify->Convert->To Contour ///' + printlog "Modify->Convert->To Contour" ContextConvertIntoContour WaitSlot (1000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertIntoContour '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertInto3D - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) - '/// Modify->Convert->To 3D ///' - '/// Modify->Convert->To 3D ///' + printlog "Modify->Convert->To 3D" ContextConvertInto3D WaitSlot (1000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertInto3D '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertIntoRotationObject - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (1000) - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen (20,20,50,50) sleep 2 - '/// Modify->Convert->To 3D Rotation Object ///' - '/// Modify->Convert->To 3D Rotation Object ///' + printlog "Modify->Convert->To 3D Rotation Object" ContextConvertInto3DRotationObject WaitSlot (1000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertIntoRotationObject '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertIntoBitmap - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (3000) InsertGraphicsFromFile WaitSlot (3000) Kontext "GrafikEinfuegenDlg" - sleep 2 - '/// insert graphic: "global\input\graf_inp\columbia.dxf" ///' - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\columbia.dxf") - sleep 2 - Oeffnen.Click - sleep 2 - try - '/// Modify->Convert->To Bitmap ///' - ContextConvertIntoBitmap - Printlog "- Convert into bitmap is working" - catch - Warnlog "- Convert into bitmap does not work" - endcatch - '/// close application ///' + sleep 2 + printlog "insert graphic: global\input\graf_inp\columbia.dxf" + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\columbia.dxf") + sleep 2 + Oeffnen.Click + sleep 2 + try + printlog "Modify->Convert->To Bitmap" + ContextConvertIntoBitmap + Printlog "- Convert into bitmap is working" + catch + Warnlog "- Convert into bitmap does not work" + endcatch +printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertIntoBitmap '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextConvertIntoMetaFile - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (3000) InsertGraphicsFromFile WaitSlot (1000) kontext "Messagebox" - if Messagebox.Exists (5) Then Messagebox.OK - sleep 1 - Kontext "GrafikEinfuegenDlg" - '/// insert graphic: "global\input\graf_inp\desp.bmp" ///' - sleep 2 - Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\desp.bmp") - sleep 2 - Preview.Click - sleep 3 - Oeffnen.Click - sleep 5 - try - '/// Modify->Convert->To Metafile ///' - '/// Modify->Convert->To Metafile ///' - ContextConvertIntoMetafile - Printlog "- convert into meta file does work" - catch - Warnlog "- convert into meta file does not work" - endcatch - '/// close application ///' + if Messagebox.Exists (5) Then Messagebox.OK + sleep 1 + Kontext "GrafikEinfuegenDlg" + printlog "insert graphic: global\input\graf_inp\desp.bmp" + sleep 2 + Dateiname.SetText ConvertPath (gTesttoolPath + "global\input\graf_inp\desp.bmp") + sleep 2 + Preview.Click + sleep 3 + Oeffnen.Click + sleep 5 + try + printlog "Modify->Convert->To Metafile" + printlog "Modify->Convert->To Metafile" + ContextConvertIntoMetafile + Printlog "- convert into meta file does work" + catch + Warnlog "- convert into meta file does not work" + endcatch + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextConvertIntoMetaFile '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyArrange - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen ( 10, 10, 20, 40 ) hTypeKeys("<escape>") Call hRechteckErstellen ( 30, 30, 50, 60 ) - '/// Modify->Arrange->Bring to Front ///' - '///+ Modify->Arrange->Bring to Front ///' + printlog "Modify->Arrange->Bring to Front" FormatArrangeBringToFront WaitSlot (1000) - '/// Modify->Arrange->Bring Forward ///' - '///+ Modify->Arrange->Bring Forward ///' + printlog "Modify->Arrange->Bring Forward" ContextArrangeBringForward WaitSlot (1000) - '/// Modify->Arrange->Send Backward ///' - '///+ Modify->Arrange->Send Backward ///' + printlog "Modify->Arrange->Send Backward" ContextArrangeBringBackward WaitSlot (1000) - '/// Modify->Arrange->Send to Back ///' - '///+ Modify->Arrange->Send to Back ///' + printlog "Modify->Arrange->Send to Back" FormatArrangeSendToBack WaitSlot (1000) - '/// Edit->Select All ///' + printlog "Edit->Select All" EditSelectAll - '/// Modify->Arrange->Reverse ///' - '///+ Modify->Arrange->Reverse ///' + printlog "Modify->Arrange->Reverse" ContextArrangeReverse WaitSlot (1000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyArrange '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyArrangeObjects - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (1000) - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen ( 20, 20, 30, 50 ) hTypeKeys("<escape>") Call hRechteckErstellen ( 30,30,50,50 ) - '/// Modify->Arrange->In Front of Object ///' - '///+ Modify->Arrange->In Front of Object ///' + printlog "Modify->Arrange->In Front of Object" ContextArrangeInFrontOfObject - '/// click on the upper left rectangle ///' + printlog "click on the upper left rectangle" gMouseClick 11,11 - '/// Modify->Arrange->Behind Object ///' - '///+ Modify->Arrange->Behind Object ///' + printlog "Modify->Arrange->Behind Object" ContextArrangeBehindObject - '/// click on the lower right rectangle ///' + printlog "click on the lower right rectangle" gMouseClick 45,45 sleep 1 - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyArrangeObjects '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyAlignment - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (1000) - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 20, 20, 30, 50 ) - '/// Modify->Alignment->Left ///' - '///+ Modify->Alignment->Left ///' + printlog "Modify->Alignment->Left" ContextAlignmentLeft WaitSlot (1000) - '/// Modify->Alignment->Centered ///' - '///+ Modify->Alignment->Centered ///' + printlog "Modify->Alignment->Centered" ContextAlignmentCentered WaitSlot (1000) - '/// Modify->Alignment->Right ///' - '///+ Modify->Alignment->Right ///' + printlog "Modify->Alignment->Right" ContextAlignmentRight WaitSlot (1000) - '/// Modify->Alignment->Top ///' - '///+ Modify->Alignment->Top ///' + printlog "Modify->Alignment->Top" ContextAlignmentTop WaitSlot (1000) - '/// Modify->Alignment->Center ///' - '///+ Modify->Alignment->Center ///' + printlog "Modify->Alignment->Center" ContextAlignmentBottom WaitSlot (1000) - '/// Modify->Alignment->Bottom ///' - '///+ Modify->Alignment->Bottom ///' + printlog "Modify->Alignment->Bottom" ContextAlignmentCenter WaitSlot (1000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyAlignment '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextDistribution - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (3000) - '/// create 3 rectangles ///' + printlog "create 3 rectangles" Call sSelectEmptyLayout Call hRechteckErstellen (20,20,30,30) Call hRechteckErstellen (40,40,50,50) Call hRechteckErstellen (60,60,70,70) sleep 1 - '/// select all with keyboard: <STRG>+ <A> ///' + printlog "select all with keyboard: <STRG>+ <A>" EditSelectAll sleep 1 - '/// Modify->Distibution... ///' - '///+ Modify->Distibution... ///' + printlog "Modify->Distibution..." ContextDistribution Kontext "VerteilenDlg" - sleep 1 - Call DialogTest (VerteilenDlg) - sleep 1 - '/// check radiobutton horizontal 'Left' ///' - Links.Check - '///+ check radiobutton 'Center' ///' - MitteHorizontal.Check - '///+ check radiobutton 'spacing' ///' - AbstandHorizontal.Check - '///+ check radiobutton 'right' ///' - Rechts.Check - '///+ check radiobutton 'none' ///' - KeineHorizontal.Check - '/// check radiobutton vertical 'top' ///' - Oben.Check - '///+ check radiobutton 'center' ///' - MitteVertikal.Check - '///+ check radiobutton 'spacing' ///' - AbstandVertikal.Check - '///+ check radiobutton 'bottom' ///' - Unten.Check - '///+ check radiobutton 'none' ///' - KeineVertikal.Check - '/// cancel dialog 'Distribution' ///' - VerteilenDlg.Cancel - sleep 2 - '/// close application ///' + sleep 1 + Call DialogTest (VerteilenDlg) + sleep 1 + printlog "check radiobutton horizontal 'Left'" + Links.Check + printlog "check radiobutton 'Center'" + MitteHorizontal.Check + printlog "check radiobutton 'spacing'" + AbstandHorizontal.Check + printlog "check radiobutton 'right'" + Rechts.Check + printlog "check radiobutton 'none'" + KeineHorizontal.Check + printlog "check radiobutton vertical 'top'" + Oben.Check + printlog "check radiobutton 'center'" + MitteVertikal.Check + printlog "check radiobutton 'spacing'" + AbstandVertikal.Check + printlog "check radiobutton 'bottom'" + Unten.Check + printlog "check radiobutton 'none'" + KeineVertikal.Check + printlog "cancel dialog 'Distribution'" + VerteilenDlg.Cancel + sleep 2 + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextDistribution '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextDescriptionObject - '/// Open application ///' + printlog "Open application" Call hNewDocument WaitSlot (1000) - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) ContextDescriptionObject Kontext "DescriptionObject" - Call DialogTest (DescriptionObject) - '/// Cancel dialog 'DescriptionObject' ///' - DescriptionObject.Cancel - '/// Close application ///' + Call DialogTest (DescriptionObject) + printlog "Cancel dialog 'DescriptionObject'" + DescriptionObject.Cancel + printlog "Close application" Call hCloseDocument -endcase +endcase 'tdContextDescriptionObject '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdContextNameObject - '/// open application ///' + printlog "open application" Call hNewDocument WaitSlot (1000) - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen ( 20, 20, 30, 50 ) hTypeKeys("<escape>") Call hRechteckErstellen ( 30, 40, 50, 60 ) sleep 1 - '/// select both by spanning a selection with the mouse ///' + printlog "select both by spanning a selection with the mouse" gMouseMove 1,1,70,70 sleep 1 - '/// Modify->Group ///' - '///+ Modify->Group ///' + printlog "Modify->Group" FormatGroupGroup WaitSlot (1000) - '/// Modify->Name Object ///' - '///+ Modify->Name Object ///' + printlog "Modify->Name Object" ContextNameObject Kontext "NameDlgObject" - Call DialogTest (NameDlgObject) - '/// cancel dialog 'name' ///' - NameDlgObject.Cancel - '/// Modify->UnGroup ///' - '///+ Modify->UnGroup ///' - FormatUngroupDraw - '/// close application ///' + Call DialogTest (NameDlgObject) + printlog "cancel dialog 'name'" + NameDlgObject.Cancel + printlog "Modify->UnGroup" + FormatUngroupDraw + printlog "close application" Call hCloseDocument -endcase +endcase 'tdContextNameObject '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyConnectBreak - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout sleep 1 - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen (10,10,30,30) Call hRechteckErstellen (35,35,50,50) sleep 1 - '/// Edit->Select All ///' + printlog "Edit->Select All" EditSelectAll - '/// Modify->Connect ///' - '///+ Modify->Connect ///' + printlog "Modify->Connect" ContextConnect sleep 1 try - '/// Modify->Break ///' - '///+ Modify->Break ///' + printlog "Modify->Break" ContextBreak catch - Warnlog "- Modify-Break does not work" + Warnlog "- Modify-Break does not work" endcatch sleep 1 - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyConnectBreak '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyShapes - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout sleep 1 - '/// create two rectangles ///' + printlog "create two rectangles" gMouseClick 50,50 Call hRechteckErstellen (30,30,50,50) Call hRechteckErstellen (60,60,80,80) sleep 1 - '/// Edit->Select All ///' + printlog "Edit->Select All" EditSelectAll sleep 1 try - '/// Modify->Shapes->Merge ///' - '///+ Modify->Shapes->Merge ///' - ModifyShapesMerge ' 1 + printlog "Modify->Shapes->Merge" + ModifyShapesMerge ' 1 WaitSlot (1000) 'sleep 1 - Printlog "- Modify-Shape merge is working" + Printlog "- Modify-Shape merge is working" catch - Warnlog "- Modify-shape merge is not working" + Warnlog "- Modify-shape merge is not working" endcatch - '/// select all and delete it ///' + printlog "select all and delete it" EditSelectAll sleep 1 hTypeKeys "<DELETE>" sleep 1 - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen (30,30,50,50) Call hRechteckErstellen (60,60,80,80) sleep 1 - '/// Edit->Select All ///' + printlog "Edit->Select All" EditSelectAll sleep 1 try - '/// Modify->Shapes->Substract ///' - '///+ Modify->Shapes->Substract ///' - ModifyShapesSubstract ' 2 - Printlog "- Modify-shape-substract is working" + printlog "Modify->Shapes->Substract" + ModifyShapesSubstract ' 2 + Printlog "- Modify-shape-substract is working" catch - Warnlog "- Modify-shape substract is not working" + Warnlog "- Modify-shape substract is not working" endcatch sleep 1 - '/// select all and delete it ///' + printlog "select all and delete it" EditSelectAll sleep 1 hTypeKeys "<DELETE>" sleep 1 - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen (30,30,50,50) sleep 1 Call hRechteckErstellen (60,60,80,80) @@ -544,45 +516,42 @@ testcase tdModifyShapes EditSelectall sleep 1 try - '/// Modify->Shapes->Intersect ///' - '///+ Modify->Shapes->Intersect ///' - ModifyShapesIntersect ' 3 - Printlog "- Modify-shape intersect is working" + printlog "Modify->Shapes->Intersect" + ModifyShapesIntersect ' 3 + Printlog "- Modify-shape intersect is working" catch - Warnlog "- Modify-Shape intersect is not working" + Warnlog "- Modify-Shape intersect is not working" endcatch - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyShapes '------------------------------------------------------------------------------------------------------------------------------------------------ testcase tdModifyCombineSplit - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout sleep 1 - '/// create two rectangles ///' + printlog "create two rectangles" Call hRechteckErstellen (30,30,50,50) Call hRechteckErstellen (60,60,80,80) sleep 1 - '/// Edit->Select All ///' + printlog "Edit->Select All" EditSelectAll sleep 1 try - '/// Modify->Shapes->Combine ///' - '///+ Modify->Shapes->Combine ///' - ContextCombine - Printlog "- Modify combine is working" - '/// Modify->Shapes->Split ///' - '///+ Modify->Shapes->Split ///' - ContextSplit - Printlog "- Modify-split is working" + printlog "Modify->Shapes->Combine" + ContextCombine + Printlog "- Modify combine is working" + printlog "Modify->Shapes->Split" + ContextSplit + Printlog "- Modify-split is working" catch - Warnlog "- Modify-combine and split are not working" + Warnlog "- Modify-combine and split are not working" endcatch - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tdModifyCombineSplit -'------------------------------------------------------------------------------------------------------------------------------------------------ +'------------------------------------------------------------------------------------------------------------------------------------------------
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/global/id_008.inc b/testautomation/graphics/required/includes/global/id_008.inc index 8848c7337dac..f88174929c1f 100644 --- a/testautomation/graphics/required/includes/global/id_008.inc +++ b/testautomation/graphics/required/includes/global/id_008.inc @@ -41,43 +41,44 @@ end sub '------------------------------------------------------------------------------- testcase tiWindowNewWindow - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) - '/// Window->New Window ///' + printlog "Window->New Window" WindowNewWindow WaitSlot (2000) - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiWindowNewWindow + +'------------------------------------------------------------------------------- testcase tidWindow123 goto endsub '' testing TBO: 29.03.2002 dim iMenues as integer - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create rectangle ///' + printlog "create rectangle" Call hRechteckErstellen ( 10, 10, 20, 40 ) Kontext "DocumentImpress" - DocumentImpress.UseMenu - iMenues = MenuGetItemCount - warnlog "---- Number of Main menus: " & iMenues - MenuSelect(Menugetitemid(8)) - sleep 1 - iMenues = MenuGetItemCount - printlog "---- Number of Main menus: " & iMenues - ' MenuSelect(Menugetitemid(14)) - sleep 1 - i=1 - printlog "count: " + i + "; of submenu: " + MenuGetItemCount + "; SID: " + MenuGetItemId (i) + "; Text: " + MenuGetItemText (Menugetitemid(i)) + "; Command: " + MenuGetItemCommand(Menugetitemid(i)) + "; Seperator?: " + MenuIsSeperator(i) + "; Enabled: " + MenuIsItemEnabled(Menugetitemid(i)) + "; Checked: " + MenuIsItemChecked(Menugetitemid(i)) + ";" - i=2 - printlog "count: " + i + "; of submenu: " + MenuGetItemCount + "; SID: " + MenuGetItemId (i) + "; Text: " + MenuGetItemText (Menugetitemid(i)) + "; Command: " + MenuGetItemCommand(Menugetitemid(i)) + "; Seperator?: " + MenuIsSeperator(i) + "; Enabled: " + MenuIsItemEnabled(Menugetitemid(i)) + "; Checked: " + MenuIsItemChecked(Menugetitemid(i)) + ";" - warnlog "Dynamic entries not accessible ? :-(((((" - ' i=3 - ' printlog "count: " + i + "; of submenue: " + MenuGetItemCount + "; SID: " + MenuGetItemId (i) + "; Text: " + MenuGetItemText (Menugetitemid(i)) + "; Command: " + MenuGetItemCommand(Menugetitemid(i)) + "; Seperator?: " + MenuIsSeperator(i) + "; Enabled: " + MenuIsItemEnabled(Menugetitemid(i)) + "; Checked: " + MenuIsItemChecked(Menugetitemid(i)) + ";" - '/// close application ///' + DocumentImpress.UseMenu + iMenues = MenuGetItemCount + warnlog "---- Number of Main menus: " & iMenues + MenuSelect(Menugetitemid(8)) + sleep 1 + iMenues = MenuGetItemCount + printlog "---- Number of Main menus: " & iMenues + ' MenuSelect(Menugetitemid(14)) + sleep 1 + i=1 + printlog "count: " + i + "; of submenu: " + MenuGetItemCount + "; SID: " + MenuGetItemId (i) + "; Text: " + MenuGetItemText (Menugetitemid(i)) + "; Command: " + MenuGetItemCommand(Menugetitemid(i)) + "; Seperator?: " + MenuIsSeperator(i) + "; Enabled: " + MenuIsItemEnabled(Menugetitemid(i)) + "; Checked: " + MenuIsItemChecked(Menugetitemid(i)) + ";" + i=2 + printlog "count: " + i + "; of submenu: " + MenuGetItemCount + "; SID: " + MenuGetItemId (i) + "; Text: " + MenuGetItemText (Menugetitemid(i)) + "; Command: " + MenuGetItemCommand(Menugetitemid(i)) + "; Seperator?: " + MenuIsSeperator(i) + "; Enabled: " + MenuIsItemEnabled(Menugetitemid(i)) + "; Checked: " + MenuIsItemChecked(Menugetitemid(i)) + ";" + warnlog "Dynamic entries not accessible ? :-(((((" + ' i=3 + ' printlog "count: " + i + "; of submenue: " + MenuGetItemCount + "; SID: " + MenuGetItemId (i) + "; Text: " + MenuGetItemText (Menugetitemid(i)) + "; Command: " + MenuGetItemCommand(Menugetitemid(i)) + "; Seperator?: " + MenuIsSeperator(i) + "; Enabled: " + MenuIsItemEnabled(Menugetitemid(i)) + "; Checked: " + MenuIsItemChecked(Menugetitemid(i)) + ";" + printlog "close application" Call hCloseDocument -endcase - +endcase 'tidWindow123
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/global/id_009.inc b/testautomation/graphics/required/includes/global/id_009.inc index d03d99b6050c..3680dfafbc4f 100644 --- a/testautomation/graphics/required/includes/global/id_009.inc +++ b/testautomation/graphics/required/includes/global/id_009.inc @@ -43,252 +43,238 @@ sub id_009 end sub '------------------------------------------------------------------------------ -testcase tmHelpHelpAgent +testcase tmHelpHelpAgent Call hNewDocument - hTBOtypeInDoc - HelpHelpAgent ' it's just a switch sleep 2 HelpHelpAgent - Call hCloseDocument -endcase +endcase 'tmHelpHelpAgent -'...---....---.-.-.-.-.....---......--.-.-.-.....----..-........................---....... +'------------------------------------------------------------------------------ testcase tmHelpTips Call hNewDocument hTBOtypeInDoc - HelpTips Sleep 2 HelpTips - Call hCloseDocument -endcase +endcase 'tmHelpTips -'...---....---.-.-.-.-.....---......--.-.-.-.....----..-........................---....... +'------------------------------------------------------------------------------ testcase tmHelpExtendedTips Call hNewDocument hTBOtypeInDoc - HelpEntendedHelp Sleep (2) HelpEntendedHelp - Call hCloseDocument -endcase +endcase 'tmHelpExtendedTips -'...---....---.-.-.-.-.....---......--.-.-.-.....----..-........................---....... +'------------------------------------------------------------------------------ testcase tmHelpAboutStarOffice Call hNewDocument hTBOtypeInDoc - HelpAboutStarOffice Kontext "UeberStarMath" DialogTest (UeberStarMath) UeberStarMath.OK - Call hCloseDocument -endcase +endcase 'tmHelpAboutStarOffice -'...---....---.-.-.-.-.....---......--.-.-.-.....----..-........................---....... +'------------------------------------------------------------------------------ testcase tmHelpContents - goto endsub '"#i84486# - tmHelpContents outcommented due to crash." - dim i as integer + dim i as integer - '/// open application ///' - Call hNewDocument - '/// Help->Contents ///' - HelpContents - sleep(8) - kontext "StarOfficeHelp" - if Not StarOfficeHelp.Exists then - Warnlog "Help is not up!" - else - '/// get the number of entries in the listbox 'select Help modul' ///' - Printlog "HelpAbout: '" + HelpAbout.GetItemCount +"'" - '################ left half ################ - '/// on the left half of the dialog: ///' - '///+ change to the tabpage 'Contents' ///' - TabControl.SetPage ContentPage - '///+ get the number of entries in the listbox 'MAin help themes' ///' - Printlog "SearchContent: '" + SearchContent.GetItemCount + "'" - '///+ change to the tabpage 'Index' ///' - TabControl.SetPage IndexPage - '///+ get the number of entries in the listbox 'Search term' ///' - Printlog "SearchIndex: '" + SearchIndex.GetItemCount + "'" - sleep 5 - '///+ click on button 'Display' ///' - DisplayIndex.Click - sleep 5 - '///+ change to the tabpage 'Find' ///' - TabControl.SetPage FindPage - '///+ get the number of entries in the listbox 'Search term' ///' - Printlog "SearchFind: '" + SearchFind.GetItemCount + "'" - '/// If the Search-Text-Field is empty - Check that the Find-button is deactivated ///' - if SearchFind.GetSelText = "" then - if FindButton.IsEnabled then - warnlog " The Find-Button should have been inactive, but was active." - endif - else - warnlog " The Search-Text-Field shouldn't contain any text. But contained: " + SearchFind.GetSelText - endif - '/// Insert some irrelevant text to get 0 results from the search. ///' - SearchFind.SetText "Doobbidedooo" - '///+ click on button 'Find' ///' - FindButton.Click - kontext - '///+ Messagebox comes up about: 'No topics found.' say OK ///' - if (active.exists (2) )then - Printlog "active came up: '" + active.gettext + "'" - active.ok + printlog "open application" + Call hNewDocument + printlog "Help->Contents" + HelpContents + sleep(8) + kontext "StarOfficeHelp" + if Not StarOfficeHelp.Exists then + Warnlog "Help is not up!" + else + printlog "get the number of entries in the listbox 'select Help modul'" + Printlog "HelpAbout: '" + HelpAbout.GetItemCount +"'" + printlog "on the left half of the dialog:" + printlog "change to the tabpage 'Contents'" + TabControl.SetPage ContentPage + printlog "get the number of entries in the listbox 'MAin help themes'" + Printlog "SearchContent: '" + SearchContent.GetItemCount + "'" + printlog "change to the tabpage 'Index'" + TabControl.SetPage IndexPage + printlog "get the number of entries in the listbox 'Search term'" + Printlog "SearchIndex: '" + SearchIndex.GetItemCount + "'" + sleep 5 + printlog "click on button 'Display'" + DisplayIndex.Click + sleep 5 + printlog "change to the tabpage 'Find'" + TabControl.SetPage FindPage + printlog "get the number of entries in the listbox 'Search term'" + Printlog "SearchFind: '" + SearchFind.GetItemCount + "'" + printlog "If the Search-Text-Field is empty - Check that the Find-button is deactivated" + if SearchFind.GetSelText = "" then + if FindButton.IsEnabled then + warnlog " The Find-Button should have been inactive, but was active." endif - kontext "StarOfficeHelp" - '///+ check checkbox 'Complete words only' ///' - FindFullWords.Check - '///+ check checkbox 'Find in headings only' ///' - FindInHeadingsOnly.Check - '///+ get the number of entries in the listbox 'List of headings' ///' - Printlog "Result: '" + Result.GetItemCount + "'" - '///+ click on button 'Display' ///' - DisplayFind.Click - '///+ change to the tabpage 'Bookmarks' ///' - TabControl.SetPage BookmarksPage - '///+ get the number of entries in the listbox 'Bookmark list' ///' - Printlog "Bookmarks: '" + Bookmarks.GetItemCount + "'" - '///+ click on button 'Display' ///' - DisplayBookmarks.Click - '################ right half ################ - '/// on the right half of teh dialog: ///' - '################ toolbar ################ - Kontext "TB_Help" - '///+ click on button 'Hide/Show Navigation Pane' ///' - Index.Click + else + warnlog " The Search-Text-Field shouldn't contain any text. But contained: " + SearchFind.GetSelText + endif + printlog "Insert some irrelevant text to get 0 results from the search." + SearchFind.SetText "Doobbidedooo" + printlog "click on button 'Find'" + FindButton.Click + kontext + printlog "Messagebox comes up about: 'No topics found.' say OK" + if (active.exists (2) )then + Printlog "active came up: '" + active.gettext + "'" + active.ok + endif + kontext "StarOfficeHelp" + printlog "check checkbox 'Complete words only' " + FindFullWords.Check + printlog "check checkbox 'Find in headings only' " + FindInHeadingsOnly.Check + printlog "get the number of entries in the listbox 'List of headings'" + Printlog "Result: '" + Result.GetItemCount + "'" + printlog "click on button 'Display'" + DisplayFind.Click + printlog "change to the tabpage 'Bookmarks'" + TabControl.SetPage BookmarksPage + printlog "get the number of entries in the listbox 'Bookmark list'" + Printlog "Bookmarks: '" + Bookmarks.GetItemCount + "'" + printlog "click on button 'Display'" + DisplayBookmarks.Click + printlog "on the right half of teh dialog:" + Kontext "TB_Help" + printlog "click on button 'Hide/Show Navigation Pane'" + Index.Click + sleep 1 + printlog "click on button 'Hide/Show Navigation Pane'" + Index.Click + sleep 1 + printlog "click on button 'First Page'" + GoToStart.Click + sleep 1 + printlog "click on button 'Previous Page'" + Backward.Click + sleep 1 + printlog "click on button 'Next Page'" + Forward.Click + sleep 1 + printlog "click on button 'Print ...'" + PrintButton.Click + sleep (1) + kontext "Active" + if Active.Exists( 2 ) then + qaerrorlog "No default printer defined: " & Active.GetText + Active.Ok + end if + kontext "Printing" + if Printing.Exists( 2 ) then + printlog "In the dialog 'Print' press the button 'Cancel'" + Printing.cancel + else + warnlog "the Print-Dialogue didnt appear." + end if + Kontext "TB_Help" + printlog "click on button 'Add to Bookmarks ...'" + sleep 1 + SetBookmarks.Click + sleep 1 + Kontext "AddBookmark" + printlog "on the dialog 'Add to Bookmarks ...' get the text from the editfield 'Bookmark' and press button 'Cancel'" + Printlog "Bookmarkname: '" + Bookmarkname.GetText + "'" + AddBookmark.Cancel + sleep 1 + '################ help display ################ + kontext "HelpContent" + printlog "open the Context Menu of the Frame 'Help Content' and count the entries" + HelpContent.OpenContextMenu + sleep 1 + Printlog " i: " + hMenuItemGetCount + hMenuClose() + '################ right scroolbar ################ + kontext "HelpContent" + printlog "click on button 'Previous Page'" + if HelpContentUP.IsVisible then + HelpContentUP.Click sleep 1 - '///+ click on button 'Hide/Show Navigation Pane' ///' - Index.Click - sleep 1 - '///+ click on button 'First Page' ///' - GoToStart.Click - sleep 1 - '///+ click on button 'Previous Page' ///' - Backward.Click - sleep 1 - '///+ click on button 'Next Page' ///' - Forward.Click - sleep 1 - '///+ click on button 'Print ...' ///' - PrintButton.Click - sleep (1) - - kontext "Active" - if Active.Exists( 2 ) then - qaerrorlog "No default printer defined: " & Active.GetText - Active.Ok - end if - - kontext "Printing" - if Printing.Exists( 2 ) then - '/// In the dialog 'Print' press the button 'Cancel' ///' - Printing.cancel - else - warnlog "the Print-Dialogue didnt appear." - end if - Kontext "TB_Help" - '///+ click on button 'Add to Bookmarks ...' ///' - sleep 1 - SetBookmarks.Click - sleep 1 - Kontext "AddBookmark" - '///+ on the dialog 'Add to Bookmarks ...' get the text from the editfield 'Bookmark' and press button 'Cancel' ///' - Printlog "Bookmarkname: '" + Bookmarkname.GetText + "'" - AddBookmark.Cancel - sleep 1 - '################ help display ################ - kontext "HelpContent" - '///+ open the Context Menu of the Frame 'Help Content' and count the entries ///' - HelpContent.OpenContextMenu - - sleep 1 - Printlog " i: " + hMenuItemGetCount - hMenuClose() - '################ right scroolbar ################ - kontext "HelpContent" - '///+ click on button 'Previous Page' ///' - if HelpContentUP.IsVisible then - HelpContentUP.Click - sleep 1 - endif - '///+ click on button 'Navigation' ///' - if HelpContentNAVIGATION.IsVisible then - HelpContentNAVIGATION.Click - sleep 1 - endif - kontext "NavigationsFenster" - '/// on the toolbox 'Navigation' press the window close button 'X' ///' - NavigationsFenster.Close - sleep 1 - kontext "HelpContent" - '///+ click on button 'Next Page' ///' - if HelpContentDOWN.IsVisible then - HelpContentDOWN.Click - sleep 1 - endif - kontext "StarOfficeHelp" - '/// close the help with the keys [strg]+[F4] ///' - Printlog "trying to close the help now" - try - StarOfficeHelp.TypeKeys "<Mod1 F4>" ' strg F4 supported since bug #103586# - catch - Warnlog "failed to close the help window :-(" - endcatch - kontext "StarOfficeHelp" - if StarOfficeHelp.Exists then - warnlog "Help still up!" - endif - endif - '/// close application ///' - Call hCloseDocument -endcase + endif + printlog "click on button 'Navigation'" + if HelpContentNAVIGATION.IsVisible then + HelpContentNAVIGATION.Click + sleep 1 + endif + kontext "NavigationsFenster" + printlog "on the toolbox 'Navigation' press the window close button 'X'" + NavigationsFenster.Close + sleep 1 + kontext "HelpContent" + printlog "click on button 'Next Page'" + if HelpContentDOWN.IsVisible then + HelpContentDOWN.Click + sleep 1 + endif + kontext "StarOfficeHelp" + printlog "close the help with the keys [strg]+[F4]" + Printlog "trying to close the help now" + try + StarOfficeHelp.TypeKeys "<Mod1 F4>" ' strg F4 supported since bug #103586# + catch + Warnlog "failed to close the help window :-(" + endcatch + kontext "StarOfficeHelp" + if StarOfficeHelp.Exists then + warnlog "Help still up!" + endif + endif + printlog "close application" + Call hCloseDocument +endcase 'tmHelpContents -'...---....---.-.-.-.-.....---......--.-.-.-.....----..-........................---....... +'------------------------------------------------------------------------------ testcase tCheckIfTheHelpExists - '/// open application ///' - Call hNewDocument - '/// Bring up the help-window ///' - HelpContents - kontext "HelpContent" - sleep (5) - '/// Press "CTRL A" and "CTRL C" to select all and then copy it. ///' - HelpContent.TypeKeys "<MOD1 A>" - sleep (1) - HelpContent.TypeKeys "<MOD1 C>" - '/// If the clipboard now is empty, then nothing were copied, which means we have a bug. ///' - if GetClipBoard = "" then - Warnlog " No content in the Help-Content -view." - else - Printlog " The Help-Content -view contained content. Good." - endif - kontext "StarOfficeHelp" - '/// Press "CTRL F4" to close the help-window. ///' - try - StarOfficeHelp.TypeKeys "<MOD1 F4>" - catch - Warnlog " Failed to close the help window :-(" - endcatch - kontext "StarOfficeHelp" - if StarOfficeHelp.Exists then - warnlog "Help was still visible!" - endif - '/// And a dot into the main window. Making sure kontext and focus is right. ///' - hTypeKeys "." - '/// Close Application ///' - Call hCloseDocument + printlog "open application" + Call hNewDocument + printlog "Bring up the help-window" + HelpContents + kontext "HelpContent" + sleep (5) + printlog "Press CTRL A and CTRL C to select all and then copy it." + HelpContent.TypeKeys "<MOD1 A>" + sleep (1) + HelpContent.TypeKeys "<MOD1 C>" + printlog "If the clipboard now is empty, then nothing were copied, which means we have a bug." + if GetClipBoard = "" then + Warnlog "No content in the Help-Content -view." + else + Printlog "The Help-Content -view contained content. Good." + endif + kontext "StarOfficeHelp" + printlog "Press CTRL F4 to close the help-window." + try + StarOfficeHelp.TypeKeys "<MOD1 F4>" + catch + Warnlog " Failed to close the help window :-(" + endcatch + kontext "StarOfficeHelp" + if StarOfficeHelp.Exists then + warnlog "Help was still visible!" + endif + printlog "And a dot into the main window. Making sure kontext and focus is right." + hTypeKeys "." + printlog "Close Application" + Call hCloseDocument endcase 'tCheckIfTheHelpExists + +'------------------------------------------------------------------------------
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/global/id_011.inc b/testautomation/graphics/required/includes/global/id_011.inc index 186c5e1b51ef..f9ad3f46378b 100644 --- a/testautomation/graphics/required/includes/global/id_011.inc +++ b/testautomation/graphics/required/includes/global/id_011.inc @@ -42,279 +42,271 @@ sub id_011 end sub '------------------------------------------------------------------------------- -testcase tiTextToolbar +testcase tiTextToolbar Dim iWaitIndex as integer Dim Zufall as integer Dim i as integer - '/// open application ///' + printlog "open application" Call hNewDocument Call sSelectEmptyLayout - - '/// create a textframe with text ///' + printlog "create a textframe with text" hTextrahmenErstellen ("This is a Text, which will be formatted in several ways", 20,20,40,80) - '/// The 'Object Toolbar' now changes ///' + printlog "The 'Object Toolbar' now changes" sleep 2 - '/// select of the text with <STRG> + <A> ///' + printlog "select of the text with <STRG> + <A>" EditSelectAll sleep 2 - '/// Call the textobjectbar from the View-Toolbars-menu ///' + printlog "Call the textobjectbar from the View-Toolbars-menu" Kontext "TextObjectbar" - if TextObjectbar.Exists <> TRUE then 'isVisible - ViewToolbarsTextFormatting - end if - WaitSlot (3000) 'sleep (3) + if TextObjectbar.Exists <> TRUE then 'isVisible + ViewToolbarsTextFormatting + end if + WaitSlot (3000) 'sleep (3) Kontext "TextObjectbar" - Printlog "- choose random font" - randomize - Zufall=((2*Rnd)+1) ' wird nicht auf den verfuegbaren bereich getreckt :-( TODO TBO! - Schriftart.GetItemcount - Schriftart.GetSelText - Schriftart.Select (Zufall) - '/// select any font you like in the listbox 'Font' on 'Object Toolbar' ///' - Printlog Schriftart.GetSelText + " chosen" - + Printlog "- choose random font" + randomize + Zufall=((2*Rnd)+1) ' wird nicht auf den verfuegbaren bereich getreckt :-( TODO TBO! + Schriftart.GetItemcount + Schriftart.GetSelText + Schriftart.Select (Zufall) + printlog "select any font you like in the listbox 'Font' on 'Object Toolbar'" + Printlog Schriftart.GetSelText + " chosen" Kontext "TextObjectbar" - sleep 2 - Printlog "- Change size of font" - '/// select any font you like in the listbox 'Size' on 'Object Toolbar' ///' - Schriftgroesse.Select (Zufall) - Printlog Schriftgroesse.GetSelText + " chosen" - + sleep 2 + Printlog "- Change size of font" + printlog "select any font you like in the listbox 'Size' on 'Object Toolbar'" + Schriftgroesse.Select (Zufall) + Printlog Schriftgroesse.GetSelText + " chosen" Kontext "TextObjectbar" - Printlog "- Font attribute bold" - '/// click button 'Bold' ///' - Fett.Click - sleep 2 - + Printlog "- Font attribute bold" + printlog "click button 'Bold'" + Fett.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Font attribute cursive" - '/// click button 'Italic' ///' - Kursiv.Click - sleep 2 - + Printlog "- Font attribute cursive" + printlog "click button 'Italic'" + Kursiv.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Font attribute cursiv" - '/// click button 'Underline' ///' - Unterstrichen.Click - sleep 2 - + Printlog "- Font attribute cursiv" + printlog "click button 'Underline'" + Unterstrichen.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- font attribute color" - '/// click button 'Font Color' and tearoff the box ///' - sleep 3 - FontColorGraphics.TearOff - Kontext "TB_Farbe" - TB_Farbe.Move 20, 20 - Sleep 2 - '/// double click in the middle of the box ///' - TB_Farbe.MouseDoubleClick 50, 50 - Sleep 2 - '/// close box 'Font Color' ///' - TB_Farbe.Close + Printlog "- font attribute color" + printlog "click button 'Font Color' and tearoff the box" + sleep 3 + FontColorGraphics.TearOff + Kontext "TB_Farbe" + TB_Farbe.Move 20, 20 + Sleep 2 + printlog "double click in the middle of the box" + TB_Farbe.MouseDoubleClick 50, 50 + Sleep 2 + printlog "close box 'Font Color'" + TB_Farbe.Close Kontext "TextObjectbar" - Printlog "- Allign text left" - '/// click button 'Left' ///' - Linksbuendig.Click - sleep 2 + Printlog "- Allign text left" + printlog "click button 'Left'" + Linksbuendig.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Allign text centered" - '/// click button 'Centered' ///' - Zentriert.Click - sleep 2 + Printlog "- Allign text centered" + printlog "click button 'Centered'" + Zentriert.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- align text to right" - '/// click button 'Right' ///' - Rechtsbuendig.Click - sleep 2 + Printlog "- align text to right" + printlog "click button 'Right'" + Rechtsbuendig.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Justified" - '/// click button 'Justified' ///' - Blocksatz.Click - sleep 2 + Printlog "- Justified" + printlog "click button 'Justified'" + Blocksatz.Click + sleep 2 Kontext "TextObjectbar" - if TextObjectbar.isEnabled <> TRUE then - warnlog "Couldn't access TextObjectbar - known bug with bars - FHA" - ViewToolbarsTextFormatting - end if - WaitSlot (2000) 'sleep 2 - Printlog "- Raising Font spacing" - '/// click button 'Increase Spacing' ///' - + if TextObjectbar.isEnabled <> TRUE then + warnlog "Couldn't access TextObjectbar - known bug with bars - FHA" + ViewToolbarsTextFormatting + end if + WaitSlot (2000) 'sleep 2 + Printlog "- Raising Font spacing" + printlog "click button 'Increase Spacing'" kontext "TextObjectbar" - sleep 1 - '/// Check if the bar is there. If not - wait for maximum 10 seconds) - iWaitIndex = 0 - do while NOT TextObjectbar.isEnabled AND iWaitIndex < 10 - sleep(1) - iWaitIndex = iWaitIndex + 1 - loop - if NOT TextObjectbar.isEnabled AND iWaitIndex = 10 then - warnlog "Dialogue TextObjectbar didnt work. Ending testcase." - Call hCloseDocument - goto endsub - end if - '/// Activate the Font spacing-buttons ///' - TextObjectbar.OpenContextMenu - sleep 2 - hMenuselectNr (1) - sleep 2 - hMenuItemCheck (13) - sleep 2 - TextObjectbar.OpenContextMenu - sleep 2 - hMenuselectNr (1) - sleep 2 - hMenuItemCheck (14) - sleep 2 - ZeilenabstandErhoehen.Click - sleep 2 - + sleep 1 + printlog "Check if the bar is there. If not - wait for maximum 10 seconds)" + iWaitIndex = 0 + do while NOT TextObjectbar.isEnabled AND iWaitIndex < 10 + sleep(1) + iWaitIndex = iWaitIndex + 1 + loop + if NOT TextObjectbar.isEnabled AND iWaitIndex = 10 then + warnlog "Dialogue TextObjectbar didnt work. Ending testcase." + Call hCloseDocument + goto endsub + end if + printlog "Activate the Font spacing-buttons" + TextObjectbar.OpenContextMenu + sleep 2 + hMenuselectNr (1) + sleep 2 + hMenuItemCheck (13) + sleep 2 + TextObjectbar.OpenContextMenu + sleep 2 + hMenuselectNr (1) + sleep 2 + hMenuItemCheck (14) + sleep 2 + ZeilenabstandErhoehen.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Decrease Spacing" - '/// click button 'Decrease Spacing' ///' - ZeilenabstandVerringern.Click - sleep 2 + Printlog "- Decrease Spacing" + printlog "click button 'Decrease Spacing'" + ZeilenabstandVerringern.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Numbering and Bullets" - sleep 2 - '/// click button 'Bullets On/Off' ///' - BulletsOnOff.Click - sleep 2 - '/// click button 'Bullets On/Off' ///' - BulletsOnOff.Click - '----------------------------------------------------------------------- + Printlog "- Numbering and Bullets" + sleep 2 + printlog "click button 'Bullets On/Off'" + BulletsOnOff.Click + sleep 2 + printlog "click button 'Bullets On/Off'" + BulletsOnOff.Click + '----------------------------------------------------------------------- Kontext "TextObjectBar" - Printlog "- Increase Font /Reduce Font" - sleep 2 - printlog "- Click on Increase Font" - IncreaseFont.Click - sleep 2 - printlog "- Click on Reduce Font" - ReduceFont.Click - '----------------------------------------------------------------------- + Printlog "- Increase Font /Reduce Font" + sleep 2 + printlog "- Click on Increase Font" + IncreaseFont.Click + sleep 2 + printlog "- Click on Reduce Font" + ReduceFont.Click + '----------------------------------------------------------------------- Kontext "TextObjectbar" - Printlog "- Text direction from left to right" - sleep 2 - Printlog "- click button 'Text direction from left to right'" - try - TextdirectionLeftToRight.Click - printlog "hor does work :-)" - if (gAsianSup = FALSE) then - warnlog " this doesn't have to work if asian lang support is disabled :-)" - end if - catch - if (gAsianSup = TRUE) then - warnlog "hor does NOT work :-(" - end if - endcatch - Printlog "- click button 'Text direction from top to bottom" - try - TextdirectionTopToBottom.Click - printlog "ver does work :-)" - if (gAsianSup = FALSE) then - warnlog " this doesnt have to work if asian lang support is disabled :-)" - end if - catch - if (gAsianSup = TRUE) then - warnlog "ver does NOT work :-( , AsianLanguage support is enabled !" - end if - endcatch + Printlog "- Text direction from left to right" + sleep 2 + Printlog "- click button 'Text direction from left to right'" + try + TextdirectionLeftToRight.Click + printlog "hor does work :-)" + if (gAsianSup = FALSE) then + warnlog " this doesn't have to work if asian lang support is disabled :-)" + end if + catch + if (gAsianSup = TRUE) then + warnlog "hor does NOT work :-(" + end if + endcatch + Printlog "- click button 'Text direction from top to bottom" + try + TextdirectionTopToBottom.Click + printlog "ver does work :-)" + if (gAsianSup = FALSE) then + warnlog " this doesnt have to work if asian lang support is disabled :-)" + end if + catch + if (gAsianSup = TRUE) then + warnlog "ver does NOT work :-( , AsianLanguage support is enabled !" + end if + endcatch Printlog "- open character dialog" Kontext "TextObjectbar" - sleep 2 - '/// click button 'Character' ///' - Zeichenformat.Click - sleep 2 - Kontext - Active.SetPage TabFont - Kontext "TabFont" - sleep 2 - if TabFont.Exists Then - '/// close dialog 'character' ///' - TabFont.Cancel - Printlog "- Tabfont exists" - else - Warnlog "- No dialog exists " - end if + sleep 2 + printlog "click button 'Character'" + Zeichenformat.Click + sleep 2 + Kontext + Active.SetPage TabFont + Kontext "TabFont" + sleep 2 + if TabFont.Exists Then + printlog "close dialog 'character'" + TabFont.Cancel + Printlog "- Tabfont exists" + else + Warnlog "- No dialog exists " + end if Kontext "TextObjectbar" - sleep 2 - Printlog "- call properties for paragraph using text object toolbar" - '/// click button 'Paragraph' ///' - Absatzformat.Click - sleep 2 - Kontext - Active.SetPage TabTabulator - Kontext "TabTabulator" - if TabTabulator.Exists Then - Printlog "- TabTabulator exists" - '/// close dialog 'Paragraph' ///' - TabTabulator.Cancel - else - Warnlog "- TabTabulator does not exist" - end if + sleep 2 + Printlog "- call properties for paragraph using text object toolbar" + printlog "click button 'Paragraph'" + Absatzformat.Click + sleep 2 + Kontext + Active.SetPage TabTabulator + Kontext "TabTabulator" + if TabTabulator.Exists Then + Printlog "- TabTabulator exists" + printlog "close dialog 'Paragraph'" + TabTabulator.Cancel + else + Warnlog "- TabTabulator does not exist" + end if if (UCase(gApplication)) = "IMPRESS" then ' IMPRESS only - '/// if the Application is Impress: ///' + printlog "if the Application is Impress:" Kontext "TextObjectbar" - '/// click button 'Numbering Symbols' ///' - OutlineBullet.Click - kontext - if active.exists (5) then - messagebox.SetPage TabOptionenNumerierung - kontext "TabOptionenNumerierung" - '/// cancel dialog 'Numbering/Bullets' ///' - if (TabOptionenNumerierung.exists (5) ) then - Printlog "Numbering/Bullets window came up :-)" - sleep 2 - TabOptionenNumerierung.cancel - else - warnlog "no Numbering/Bullets window came up :-(" - end if + printlog "click button 'Numbering Symbols'" + OutlineBullet.Click + kontext + if active.exists (5) then + messagebox.SetPage TabOptionenNumerierung + kontext "TabOptionenNumerierung" + printlog "cancel dialog 'Numbering/Bullets'" + if (TabOptionenNumerierung.exists (5) ) then + Printlog "Numbering/Bullets window came up :-)" sleep 2 - else - warnlog "no Numbering/Bullets window came up :-( 2" - end if + TabOptionenNumerierung.cancel + else + warnlog "no Numbering/Bullets window came up :-(" + end if + sleep 2 + else + warnlog "no Numbering/Bullets window came up :-( 2" + end if - Printlog "-change order of outline points" - sleep 3 - '/// View->Master View->Outline View ///' - ViewWorkspaceOutlineView - WaitSlot (2000) 'sleep (3) - Kontext "DocumentImpressOutlineView" - sleep 1 - '/// type something ///' - DocumentImpressOutlineView.TypeKeys "Bla bla bla <RETURN><TAB>bla bla bla bla bla <MOD1 SHIFT LEFT>" - sleep 1 - Kontext "TextObjectbar" - '/// click button 'Promote' ///' - HierachieRunter.Click - sleep 1 - Printlog "- Move back down" - '/// click button 'Denote' ///' - HierachieHoch.Click - sleep 1 - '/// click button 'Denote' ///' - HierachieHoch.Click - sleep 1 - Printlog "- Move paragraph up" - '/// click button 'Move Up', twice to get two slides ///' - AbsatzHoch.Click - sleep 1 - Printlog "- move paragraph back down and switch to drawing view" - '/// click button 'Move Down' ///' - AbsatzRunter.Click - sleep 1 + Printlog "-change order of outline points" + sleep 3 + printlog "View->Master View->Outline View" + ViewWorkspaceOutlineView + WaitSlot (2000) 'sleep (3) + Kontext "DocumentImpressOutlineView" + sleep 1 + printlog "type something" + DocumentImpressOutlineView.TypeKeys "Bla bla bla <RETURN><TAB>bla bla bla bla bla <MOD1 SHIFT LEFT>" + sleep 1 + Kontext "TextObjectbar" + printlog "click button 'Promote'" + HierachieRunter.Click + sleep 1 + Printlog "- Move back down" + printlog "click button 'Denote'" + HierachieHoch.Click + sleep 1 + printlog "click button 'Denote'" + HierachieHoch.Click + sleep 1 + Printlog "- Move paragraph up" + printlog "click button 'Move Up', twice to get two slides" + AbsatzHoch.Click + sleep 1 + Printlog "- move paragraph back down and switch to drawing view" + printlog "click button 'Move Down'" + AbsatzRunter.Click + sleep 1 Kontext "Vorschau" if Vorschau.Exists then @@ -324,80 +316,79 @@ testcase tiTextToolbar else ' DRAW only Kontext "TextObjectbar" - Printlog "- Double" - '/// click button 'Double' ///' - LineSpacing2.Click - sleep 2 + Printlog "- Double" + printlog "click button 'Double'" + LineSpacing2.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- 1.5 lines" - '/// click button '1.5 lines' ///' - LineSpacing15.Click - sleep 2 + Printlog "- 1.5 lines" + printlog "click button '1.5 lines'" + LineSpacing15.Click + sleep 2 Kontext "TextObjectbar" - Printlog "- Single" - '/// click button 'Single' ///' - LineSpacing1.Click - sleep 2 + Printlog "- Single" + printlog "click button 'Single'" + LineSpacing1.Click + sleep 2 end if - '/// Check if the bar is there. If not - wait for maximum 10 seconds) + printlog "Check if the bar is there. If not - wait for maximum 10 seconds)" iWaitIndex = 0 Kontext "TextObjectbar" - do while TextObjectbar.isEnabled = FALSE AND iWaitIndex < 10 - sleep(1) - iWaitIndex = iWaitIndex + 1 - loop - if TextObjectbar.isEnabled = FALSE AND iWaitIndex = 10 then - warnlog "Dialogue TextObjectbar didnt work. Ending testcase." - Call hCloseDocument - goto endsub - end if - '/// Reset the original value of the Font spacing-buttons ///' - sleep 2 + do while TextObjectbar.isEnabled = FALSE AND iWaitIndex < 10 + sleep(1) + iWaitIndex = iWaitIndex + 1 + loop + if TextObjectbar.isEnabled = FALSE AND iWaitIndex = 10 then + warnlog "Dialogue TextObjectbar didnt work. Ending testcase." + Call hCloseDocument + goto endsub + end if + printlog "Reset the original value of the Font spacing-buttons" + sleep 2 Kontext "TextObjectbar" - TextObjectbar.OpenContextMenu - sleep 2 - hMenuselectNr (1) - sleep 2 - hMenuItemUnCheck (13) - sleep 2 - TextObjectbar.OpenContextMenu - sleep 2 - hMenuselectNr (1) - sleep 2 - hMenuItemUnCheck (14) - sleep 2 - '/// Close the TextFormatting Toolbar ///' - ViewToolbarsTextFormatting - WaitSlot (2000) 'sleep 1 - '/// Clear the document from content ///' + TextObjectbar.OpenContextMenu + sleep 2 + hMenuselectNr (1) + sleep 2 + hMenuItemUnCheck (13) + sleep 2 + TextObjectbar.OpenContextMenu + sleep 2 + hMenuselectNr (1) + sleep 2 + hMenuItemUnCheck (14) + sleep 2 + printlog "Close the TextFormatting Toolbar" + ViewToolbarsTextFormatting + WaitSlot (2000) 'sleep 1 + printlog "Clear the document from content" if (gApplication = "IMPRESS") then Kontext "DocumentImpressOutlineView" - DocumentImpressOutlineView.TypeKeys "<ESCAPE>" - EditSelectAll - DocumentImpressOutlineView.TypeKeys "<DELETE>" - sleep (3) - ViewWorkspaceDrawingView + DocumentImpressOutlineView.TypeKeys "<ESCAPE>" + EditSelectAll + DocumentImpressOutlineView.TypeKeys "<DELETE>" + sleep (3) + ViewWorkspaceDrawingView Kontext "DocumentImpress" - WaitSlot (2000) 'sleep 1 - DocumentImpress.TypeKeys "<ESCAPE>" - EditSelectAll - DocumentImpress.TypeKeys "<DELETE>" + WaitSlot (2000) 'sleep 1 + DocumentImpress.TypeKeys "<ESCAPE>" + EditSelectAll + DocumentImpress.TypeKeys "<DELETE>" else Kontext "DocumentDraw" - DocumentDraw.TypeKeys "<ESCAPE>" - EditSelectAll - DocumentDraw.TypeKeys "<DELETE>" + DocumentDraw.TypeKeys "<ESCAPE>" + EditSelectAll + DocumentDraw.TypeKeys "<DELETE>" end if Printlog "Test ended." - - '/// close application ///' + printlog "close application" Call hCloseDocument -endcase +endcase 'tiTextToolbar -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' +'-------------------------------------------------------------------------------' testcase tiDrawObjectBar Dim a as string @@ -405,764 +396,755 @@ testcase tiDrawObjectBar Dim i as integer Dim x as integer - '/// open application ///' + printlog "open application" Call hNewDocument - - '/// create rectangle to test the part for draw objects ///' + printlog "create rectangle to test the part for draw objects" Call hRechteckErstellen (20,20,70,70) sleep 1 - '--------------------------- format line ------------------------ Printlog "- call format line using graphic object toolbar" Kontext "DrawingObjectbar" - '/// Check if the Graphic-Toolbar is there. Which it should be. ///' - '/// If it's not - then we call it from the View-Toolbars ///' - if DrawingObjectbar.Exists = FALSE then - ViewToolbarsGraphic - end if - if DrawingObjectbar.Exists = FALSE then - warnlog "Drawing-Objectbar should have been opened, but wasnt" - ViewToolbarsGraphic - end if - - sleep 3 - '/// click button 'line' on 'Object Toolbar' ///' - Linie.Click - sleep 2 - Kontext - Active.SetPage TabLinie - Kontext "TabLinie" - if TabLinie.Exists Then - '/// cancel dialog 'line' ///' - TabLinie.Cancel - Printlog "- TabLinie exists " - else - Warnlog "- TabLinie does not exist" - end if + printlog "Check if the Graphic-Toolbar is there. Which it should be." + printlog "If it's not - then we call it from the View-Toolbars" + if DrawingObjectbar.Exists = FALSE then + ViewToolbarsGraphic + end if + if DrawingObjectbar.Exists = FALSE then + warnlog "Drawing-Objectbar should have been opened, but wasnt" + ViewToolbarsGraphic + end if + sleep 3 + printlog "click button 'line' on 'Object Toolbar'" + Linie.Click + sleep 2 + Kontext + Active.SetPage TabLinie + Kontext "TabLinie" + if TabLinie.Exists Then + printlog "cancel dialog 'line'" + TabLinie.Cancel + Printlog "- TabLinie exists " + else + Warnlog "- TabLinie does not exist" + end if '--------------------------- Linienendenstil -------------------- Printlog "- Style of line ends" Kontext "DrawingObjectbar" - sleep 1 - '/// click button 'Arrow Style' and tearoff the box ///' - Linienendenstil.TearOff - sleep 2 - Kontext "Linienenden" - if Linienenden.Exists Then - Printlog "- dialog exists" - '/// close toolbox 'arrowheads' ///' - Linienenden.Close - else - Warnlog "- Arrowheads does not exist" - end if + sleep 1 + printlog "click button 'Arrow Style' and tearoff the box" + Linienendenstil.TearOff + sleep 2 + Kontext "Linienenden" + if Linienenden.Exists Then + Printlog "- dialog exists" + printlog "close toolbox 'arrowheads'" + Linienenden.Close + else + Warnlog "- Arrowheads does not exist" + end if '--------------------------- Linienstil ------------------------- Printlog "- choose style of lines using graphic object toolbar" Kontext "DrawingObjectbar" - sleep 1 - '/// select 2nd entry from the top in listbox 'Line Style' ///' - Linienstil.Select 2 - Printlog Linienstil.GetSelText + " chosen" - '/// select last entry in listbox 'Line Style' ///' - Linienstil.Select Linienstil.GetItemCount - Printlog Linienstil.GetSelText + " chosen" - sleep 2 + sleep 1 + printlog "select 2nd entry from the top in listbox 'Line Style'" + Linienstil.Select 2 + Printlog Linienstil.GetSelText + " chosen" + printlog "select last entry in listbox 'Line Style'" + Linienstil.Select Linienstil.GetItemCount + Printlog Linienstil.GetSelText + " chosen" + sleep 2 '--------------------------- Linienbreite------------------------ Printlog "- check style of lines using graphic object toolbar" Kontext "DrawingObjectbar" - sleep 1 - a = Linienbreite.GetText - SetClipboard a - sleep 1 - '/// set 'Line Width' to "0,5" ///' - Linienbreite.SetText "0,5" - sleep 2 - '/// check if the value is accepted or not ///' - if Linienbreite.GetText = a Then - Warnlog "- changes in edit field did not happen; is: '"+Linienbreite.GetText+"', should be : '"+"0,5"+"'" - else - Printlog "- Width of lines changed" - end if + sleep 1 + a = Linienbreite.GetText + SetClipboard a + sleep 1 + printlog "set 'Line Width' to 0,5" + Linienbreite.SetText "0,5" + sleep 2 + printlog "check if the value is accepted or not" + if Linienbreite.GetText = a Then + Warnlog "- changes in edit field did not happen; is: '"+Linienbreite.GetText+"', should be : '"+"0,5"+"'" + else + Printlog "- Width of lines changed" + end if '--------------------------- Linienfarbe ------------------------ Printlog "- change line color" Kontext "DrawingObjectbar" - sleep 1 - Zaehler = Linienfarbe.GetItemCount - randomize - i = Int(Zaehler*Rnd+1) - '/// select some entry in the listbox 'Line Color' ///' - Linienfarbe.Select i - Printlog Linienfarbe.GetSelText + " chosen" + sleep 1 + Zaehler = Linienfarbe.GetItemCount + randomize + i = Int(Zaehler*Rnd+1) + printlog "select some entry in the listbox 'Line Color'" + Linienfarbe.Select i + Printlog Linienfarbe.GetSelText + " chosen" '--------------------------- Flaechenformatierung --------------- Printlog "- Call Format area using graphic object toolbar" Kontext "DrawingObjectbar" - sleep 1 - '/// click button 'Area' ///' - try - Flaeche.Click - catch - printlog "clicking on area took ages :-(" - endcatch - sleep 5 - Kontext - Active.SetPage TabArea - Kontext "TabArea" - if TabArea.Exists Then - Printlog "- TabArea exists " - '/// cancel dialog 'Area' ///' - TabArea.Cancel - else - Warnlog "- TabArea does not exist" - end if + sleep 1 + printlog "click button 'Area'" + try + Flaeche.Click + catch + printlog "clicking on area took ages :-(" + endcatch + sleep 5 + Kontext + Active.SetPage TabArea + Kontext "TabArea" + if TabArea.Exists Then + Printlog "- TabArea exists " + printlog "cancel dialog 'Area'" + TabArea.Cancel + else + Warnlog "- TabArea does not exist" + end if '--- sleep 1 Kontext "DrawingObjectbar" + sleep 1 + x = AreaStyle.GetItemCount + i = 1 + for i = i to x + AreaStyle.Select i + Printlog "Area Style: (" + i + "/" + x + ") - " + AreaStyle.GetSelText sleep 1 - x = AreaStyle.GetItemCount - i = 1 - for i = i to x - AreaStyle.Select i - Printlog "Area Style: (" + i + "/" + x + ") - " + AreaStyle.GetSelText - sleep 1 - '/// for every item in the listbox 'Area Style' select the last item in the listbox 'Area Filling' ///' - if AreaStyle.GetSelIndex > 1 then - Printlog " Area Filling " + AreaFilling.GetSelIndex + " - " + AreaFilling.GetItemCount - if (i <> 1) AND (AreaFilling.GetItemCount <> 0) then - if (AreaFilling.GetSelIndex = 0) AND (AreaFilling.GetItemCount > 0) then - printlog "default item is 0 => means nothing; NO BUG! 100909" - end if - AreaFilling.Select (AreaFilling.GetItemCount) - Printlog " Selected: " + AreaFilling.GetSelIndex + " - " + AreaFilling.GetSelText + printlog "for every item in the listbox 'Area Style' select the last item in the listbox 'Area Filling'" + if AreaStyle.GetSelIndex > 1 then + Printlog " Area Filling " + AreaFilling.GetSelIndex + " - " + AreaFilling.GetItemCount + if (i <> 1) AND (AreaFilling.GetItemCount <> 0) then + if (AreaFilling.GetSelIndex = 0) AND (AreaFilling.GetItemCount > 0) then + printlog "default item is 0 => means nothing; NO BUG! 100909" end if + AreaFilling.Select (AreaFilling.GetItemCount) + Printlog " Selected: " + AreaFilling.GetSelIndex + " - " + AreaFilling.GetSelText end if - next i + end if + next i '---------------------------- Schatten -------------------------- Printlog "- Assign shadow using graphic object toolbar" Kontext "DrawingObjectbar" - sleep 1 - '/// click button 'Shadow' ///' - Schatten.Click - sleep 1 - Printlog "- shadow assigned" + sleep 1 + printlog "click button 'Shadow'" + Schatten.Click + sleep 1 + Printlog "- shadow assigned" '---------------------------- Praesentationsflyer --------------- - '/// if Application is Impress: ///' - if (UCase(gApplication)) = "IMPRESS" then ' IMPRESS only - Printlog "- Call presentation flyer" - Kontext "CommonTaskbar" ' first check , if presentation flyer is up! if not -> make it up :-) - '///+ if 'Presentation Box' is not visible, click button 'Presentation Box on/off' ///' - if CommonTaskbar.Exists Then - printlog "- flyer is already visible :-)" - else - printlog "- flyer wasn't visible :-( -will be now!" - Kontext "DrawingObjectbar" - sleep 1 - ViewToolbarsPresentation ' put it up again! - end if - end if - '/// Make sure the Graphics-Toolbar is visible ///' - if ((UCase(gApplication)) = "IMPRESS") then ' IMPRESS only + printlog "if Application is Impress:" + if (UCase(gApplication)) = "IMPRESS" then ' IMPRESS only + Printlog "- Call presentation flyer" + Kontext "CommonTaskbar" ' first check , if presentation flyer is up! if not -> make it up :-) + printlog "if 'Presentation Box' is not visible, click button 'Presentation Box on/off'" + if CommonTaskbar.Exists Then + printlog "- flyer is already visible :-)" + else + printlog "- flyer wasn't visible :-( -will be now!" Kontext "DrawingObjectbar" - if DrawingObjectbar.isVisible = FALSE then - ViewToolbarsGraphic - end if + sleep 1 + ViewToolbarsPresentation ' put it up again! end if - '/// close application ///' + end if + printlog "Make sure the Graphics-Toolbar is visible" + if ((UCase(gApplication)) = "IMPRESS") then ' IMPRESS only + Kontext "DrawingObjectbar" + if DrawingObjectbar.isVisible = FALSE then + ViewToolbarsGraphic + end if + end if + printlog "close application" Call hCloseDocument -endcase +endcase 'tiDrawObjectBar -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' +'------------------------------------------------------------------------------' testcase tiGraphicsObjectBar dim i as integer - '/// open application ///' + printlog "open application" Call hNewDocument - '/// insert a graphic "global\input\graf_inp\desp.bmp" ///' + printlog "insert a graphic global\input\graf_inp\desp.bmp" hGrafikeinfuegen ConvertPath (gTesttoolPath + "global\input\graf_inp\desp.bmp") + sleep 1 + Kontext "GraphicObjectbar" + if GraphicObjectbar.Exists = FALSE then + ViewToolbarsPicture + end if + sleep 1 + printlog "click button 'Filter' and tearoff the box in the Objectbar" + Filter.TearOff + sleep 1 + Kontext "GraphicFilterBar" + sleep 1 + Printlog "invert" + printlog "click button 'Invert' in window 'Filters'" + Invert.Click + sleep 3 + Printlog "smooth" + printlog "click button 'Smooth' in window 'Filters'" + Smooth.Click + sleep 3 + Printlog "sharpen" + printlog "click button 'Sharpen' in window 'Filters'" + Sharpen.Click + sleep 3 + Printlog "remove noise" + printlog "click button 'RemoveNoise' in window 'Filters'" + Remove.Click + sleep 3 + Printlog "solarization" + printlog "click button 'Solarization' in window 'Filters'" + Solarization.Click + sleep 3 + Kontext "Solarization" + if Solarization.exists (5) then sleep 1 - Kontext "GraphicObjectbar" - if GraphicObjectbar.Exists = FALSE then - ViewToolbarsPicture - end if - sleep 1 - '/// click button 'Filter' and tearoff the box in the Objectbar///' - Filter.TearOff - sleep 1 - Kontext "GraphicFilterBar" - sleep 1 - Printlog "invert" - '/// click button 'Invert' in window 'Filters' ///' - Invert.Click - sleep 3 - Printlog "smooth" - '/// click button 'Smooth' in window 'Filters' ///' - Smooth.Click - sleep 3 - Printlog "sharpen" - '/// click button 'Sharpen' in window 'Filters' ///' - Sharpen.Click - sleep 3 - Printlog "remove noise" - '/// click button 'RemoveNoise' in window 'Filters' ///' - Remove.Click - sleep 3 - Printlog "solarization" - '/// click button 'Solarization' in window 'Filters' ///' - Solarization.Click - sleep 3 - Kontext "Solarization" - if Solarization.exists (5) then - sleep 1 - Call Dialogtest ( Solarization ) - sleep 1 - '/// press 'more' and 'less' in field 'Trashold Value' on dialog 'Solarization' ///' - Value.More - Value.Less - '/// check checkbox 'Invert' on dialog 'Solarization' ///' - Invert.Check - '/// close dialog 'Solarization' with OK ///' - Solarization.OK - else - warnlog "solarization didn't came up :-(" - end if - sleep 1 - Kontext "GraphicFilterBar" - sleep 1 - Printlog "aging" - '/// click button 'Aging' in window 'Filters' ///' - Aging.Click - Kontext "Aging" - sleep 1 - Call Dialogtest ( Aging ) - '/// press 'more' and 'less' in field 'Aging degree' on dialog 'Aging' ///' - AgingDegree.More - AgingDegree.Less - sleep 1 - '/// close dialog 'Aging' with OK ///' - Aging.OK - sleep 1 - Kontext "GraphicFilterBar" - sleep 1 - Printlog "poster" - '/// click button 'Posterize' in window 'Filters' ///' - Posterize.Click - sleep 1 - Kontext "Posterize" - sleep 1 - Call Dialogtest ( Posterize ) - '/// press 'more' and 'less' in field 'Aging degree' on dialog 'Posterize' ///' - PosterColors.More - PosterColors.Less - sleep 1 - '/// close dialog 'Posterize' with OK ///' - Posterize.OK - sleep 2 - kontext "GraphicFilterBar" - sleep 1 - Printlog "pop" - '/// click button 'PopArt' in window 'Filters' ///' - Art.Click - sleep 3 - Printlog "charcoal" - '/// click button 'CharcoalSketch' in window 'Filters' ///' - CharcoalSketch.Click - sleep 3 - Printlog "relief" - '/// click button 'Relief' in window 'Filters' ///' - Relief.Click - Kontext "Relief" - sleep 1 - Call Dialogtest ( Relief ) - LightSource.TypeKeys "<left><up>" - '/// close dialog 'Relief' with OK ///' - Relief.OK - sleep 3 - Kontext "GraphicFilterBar" - Printlog "mos" - '/// click button 'Mosaic' in window 'Filters' ///' - Mosaic.Click - sleep 1 - Kontext "Mosaic" - sleep 1 - Call Dialogtest ( Mosaic ) - '/// press 'more' and 'less' in field 'Width' on dialog 'Mosaic' ///' - Width.More - Width.Less - '/// press 'more' and 'less' in field 'Height' on dialog 'Mosaic' ///' - Height.More - Height.Less - '/// check checkbox 'Enhance Edges' on dialog 'Mosaic' ///' - EnhanceEdges.Check - '/// close dialog 'Mosaic' with OK ///' - Mosaic.OK - sleep 3 - Kontext "GraphicFilterBar" - '/// close dialog 'Filters' ///' - GraphicFilterBar.Close - - Kontext "GraphicObjectbar" - if GraphicObjectbar.Exists = FALSE then ViewToolbarsPicture - sleep 1 - '/// select every entry in the listbox 'Graphics mode' ///' - for i = 1 to Grafikmodus.GetItemCount - Grafikmodus.select i - sleep 1 - next i - - '/// Click on the icon for 'ColorSettings' to open the colorbar ///' - ColorSettings.Click - Kontext "ColorBar" - sleep (2) - - '/// press 'more' and 'less' in field 'Red' on colorbar ///' - try - Rotanteil.More - Rotanteil.Less - catch - warnlog "not working from testtool redvalue "+ rotanteil.GetRT - endcatch - '/// press 'more' and 'less' in field 'Green' on colorbar ///' - try - Gruenanteil.More - Gruenanteil.Less - catch - warnlog "not working from testtool Greenvalue." - endcatch - '/// press 'more' and 'less' in field 'Blue' on colorbar ///' - try - Blauanteil.More - Blauanteil.Less - catch - warnlog "not working from testtool Bluevalue." - endcatch - '/// press 'more' and 'less' in field 'Brightness' on colorbar ///' - try - Helligkeit.More - Helligkeit.Less - catch - warnlog "not working from testtool Brightness." - endcatch - '/// press 'more' and 'less' in field 'Contrast' on colorbar ///' - try - Kontrast.More - Kontrast.Less - catch - warnlog "not working from testtool Contrast." - endcatch - '/// press 'more' and 'less' in field 'Gamma' on colorbar ///' - try - Gamma.More - Gamma.Less - catch - warnlog "not working from testtool Gamma." - endcatch - - ColorBar.Close - Kontext "GraphicObjectbar" - - '/// press 'more' and 'less' in field 'Transparency' on objectbar ///' - try - Transparenz.More - Transparenz.Less - catch - warnlog "Not working from testtool Transparency." - endcatch - - '/// press button 'Crop' on objectbar ///' - Crop.click - '/// Opening Dialog via Slot - FormatCropPicture - - kontext "TabZuschneiden" - '/// check radiobutton 'Keep scale' on dialog 'Crop' ///' - GroesseBeibehalten.Check - '/// check radiobutton 'Keep Image Size' on dialog 'Crop' ///' - MassstabBeibehalten.Check - '/// press 'more' and 'less' in field 'Left' in section 'Crop' on dialog 'Crop' ///' - Links.More - Links.Less - '/// press 'more' and 'less' in field 'Right' in section 'Crop' on dialog 'Crop' ///' - Rechts.More - Rechts.Less - '/// press 'more' and 'less' in field 'Top' in section 'Crop' on dialog 'Crop' ///' - Oben.More - Oben.Less - '/// press 'more' and 'less' in field 'Bottom' in section 'Crop' on dialog 'Crop' ///' - Unten.More - Unten.Less - '/// press 'more' and 'less' in field 'Width' in section 'Scale' on dialog 'Crop' ///' - MassstabBreite.More - MassstabBreite.Less - '/// press 'more' and 'less' in field 'Height' in section 'Scale' on dialog 'Crop' ///' - MassstabHoehe.More - MassstabHoehe.Less - '/// press 'more' and 'less' in field 'Width' in section 'Image size' on dialog 'Crop' ///' - GroesseBreite.More - GroesseBreite.Less - '/// press 'more' and 'less' in field 'Height' in section 'Image size' on dialog 'Crop' ///' - GroesseHoehe.More - GroesseHoehe.Less - '/// click button 'Original Size' on dialog 'Crop' ///' - Originalgroesse.Click - '/// cancel dialog 'Crop' ///' - TabZuschneiden.Cancel + Call Dialogtest ( Solarization ) + sleep 1 + printlog " press 'more' and 'less' in field 'Trashold Value' on dialog 'Solarization'" + Value.More + Value.Less + printlog "check checkbox 'Invert' on dialog 'Solarization'" + Invert.Check + printlog "close dialog 'Solarization' with OK" + Solarization.OK + else + warnlog "solarization didn't came up :-(" + end if + sleep 1 + Kontext "GraphicFilterBar" + sleep 1 + Printlog "aging" + printlog "click button 'Aging' in window 'Filters'" + Aging.Click + Kontext "Aging" + sleep 1 + Call Dialogtest ( Aging ) + printlog " press 'more' and 'less' in field 'Aging degree' on dialog 'Aging'" + AgingDegree.More + AgingDegree.Less + sleep 1 + printlog "close dialog 'Aging' with OK" + Aging.OK + sleep 1 + Kontext "GraphicFilterBar" + sleep 1 + Printlog "poster" + printlog "click button 'Posterize' in window 'Filters'" + Posterize.Click + sleep 1 + Kontext "Posterize" + sleep 1 + Call Dialogtest ( Posterize ) + printlog " press 'more' and 'less' in field 'Aging degree' on dialog 'Posterize'" + PosterColors.More + PosterColors.Less + sleep 1 + printlog "close dialog 'Posterize' with OK" + Posterize.OK + sleep 2 + kontext "GraphicFilterBar" + sleep 1 + Printlog "pop" + printlog "click button 'PopArt' in window 'Filters'" + Art.Click + sleep 3 + Printlog "charcoal" + printlog "click button 'CharcoalSketch' in window 'Filters'" + CharcoalSketch.Click + sleep 3 + Printlog "relief" + printlog "click button 'Relief' in window 'Filters'" + Relief.Click + Kontext "Relief" + sleep 1 + Call Dialogtest ( Relief ) + LightSource.TypeKeys "<left><up>" + printlog "close dialog 'Relief' with OK" + Relief.OK + sleep 3 + Kontext "GraphicFilterBar" + Printlog "mos" + printlog "click button 'Mosaic' in window 'Filters'" + Mosaic.Click + sleep 1 + Kontext "Mosaic" + sleep 1 + Call Dialogtest ( Mosaic ) + printlog " press 'more' and 'less' in field 'Width' on dialog 'Mosaic'" + Width.More + Width.Less + printlog " press 'more' and 'less' in field 'Height' on dialog 'Mosaic'" + Height.More + Height.Less + printlog " check checkbox 'Enhance Edges' on dialog 'Mosaic'" + EnhanceEdges.Check + printlog "close dialog 'Mosaic' with OK" + Mosaic.OK + sleep 3 + Kontext "GraphicFilterBar" + printlog "close dialog 'Filters'" + GraphicFilterBar.Close + + Kontext "GraphicObjectbar" + if GraphicObjectbar.Exists = FALSE then ViewToolbarsPicture + sleep 1 + printlog "select every entry in the listbox 'Graphics mode'" + for i = 1 to Grafikmodus.GetItemCount + Grafikmodus.select i + sleep 1 + next i - '/// close application ///' + printlog " Click on the icon for 'ColorSettings' to open the colorbar" + ColorSettings.Click + Kontext "ColorBar" + sleep (2) + printlog " press 'more' and 'less' in field 'Red' on colorbar" + try + Rotanteil.More + Rotanteil.Less + catch + warnlog "not working from testtool redvalue "+ rotanteil.GetRT + endcatch + printlog " press 'more' and 'less' in field 'Green' on colorbar" + try + Gruenanteil.More + Gruenanteil.Less + catch + warnlog "not working from testtool Greenvalue." + endcatch + printlog " press 'more' and 'less' in field 'Blue' on colorbar" + try + Blauanteil.More + Blauanteil.Less + catch + warnlog "not working from testtool Bluevalue." + endcatch + printlog " press 'more' and 'less' in field 'Brightness' on colorbar" + try + Helligkeit.More + Helligkeit.Less + catch + warnlog "not working from testtool Brightness." + endcatch + printlog " press 'more' and 'less' in field 'Contrast' on colorbar" + try + Kontrast.More + Kontrast.Less + catch + warnlog "not working from testtool Contrast." + endcatch + printlog " press 'more' and 'less' in field 'Gamma' on colorbar" + try + Gamma.More + Gamma.Less + catch + warnlog "not working from testtool Gamma." + endcatch + + ColorBar.Close + Kontext "GraphicObjectbar" + + printlog " press 'more' and 'less' in field 'Transparency' on objectbar" + try + Transparenz.More + Transparenz.Less + catch + warnlog "Not working from testtool Transparency." + endcatch + + printlog "press button 'Crop' on objectbar" + Crop.click + printlog "Opening Dialog via Slot" + FormatCropPicture + + kontext "TabZuschneiden" + printlog " check radiobutton 'Keep scale' on dialog 'Crop'" + GroesseBeibehalten.Check + printlog " check radiobutton 'Keep Image Size' on dialog 'Crop'" + MassstabBeibehalten.Check + printlog " press 'more' and 'less' in field 'Left' in section 'Crop' on dialog 'Crop'" + Links.More + Links.Less + printlog " press 'more' and 'less' in field 'Right' in section 'Crop' on dialog 'Crop'" + Rechts.More + Rechts.Less + printlog " press 'more' and 'less' in field 'Top' in section 'Crop' on dialog 'Crop'" + Oben.More + Oben.Less + printlog " press 'more' and 'less' in field 'Bottom' in section 'Crop' on dialog 'Crop'" + Unten.More + Unten.Less + printlog " press 'more' and 'less' in field 'Width' in section 'Scale' on dialog 'Crop'" + MassstabBreite.More + MassstabBreite.Less + printlog " press 'more' and 'less' in field 'Height' in section 'Scale' on dialog 'Crop'" + MassstabHoehe.More + MassstabHoehe.Less + printlog " press 'more' and 'less' in field 'Width' in section 'Image size' on dialog 'Crop'" + GroesseBreite.More + GroesseBreite.Less + printlog " press 'more' and 'less' in field 'Height' in section 'Image size' on dialog 'Crop'" + GroesseHoehe.More + GroesseHoehe.Less + printlog " click button 'Original Size' on dialog 'Crop'" + Originalgroesse.Click + printlog "cancel dialog 'Crop'" + TabZuschneiden.Cancel + + printlog "close application" Call hCloseDocument -endcase +endcase 'tiGraphicsObjectBar -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' +'-------------------------------------------------------------------------------' testcase tiGluepointToolbar - '/// open application ///' + printlog "open application" Call hNewDocument - '/// create 2 rectangles ///' + printlog "create 2 rectangles" Call hRechteckErstellen 20,20,40,40 Call hRechteckErstellen 60,60,80,80 sleep 2 - '/// View->Toolbars->Option Bar ///' + printlog "View->Toolbars->Option Bar" ViewToolbarsOptionbar - '/// at the bottom of the office has a toolbar to appear ///' + printlog "at the bottom of the office has a toolbar to appear" sleep 2 Kontext "Optionsbar" + if Optionsbar.Exists = False Then + ViewToolbarsOptionbar + Kontext "Optionsbar" if Optionsbar.Exists = False Then - ViewToolbarsOptionbar - Kontext "Optionsbar" - if Optionsbar.Exists = False Then - warnlog "Can't open Optionsbar." - end if + warnlog "Can't open Optionsbar." end if + end if + sleep 2 + Kontext "Toolbar" + sleep 1 + printlog "click button 'Connector' on Toolbar" + Verbinder.Click + printlog "make a line with the mouse" + gMouseMove 30,30,70,70 + sleep 3 + Kontext "Toolbar" + GluePoints.Click + sleep 1 + printlog "open Glue Points Toolbar" + Kontext "Gluepointsobjectbar" + if Gluepointsobjectbar.Exists = False Then + ViewToolbarsGluepoints + end if + sleep 3 + '-------------------------------------- Klebepunkt einfuegen ---- + try + printlog "click button 'Insert Glue Point' on Objecttoolbar" + PunkteEinfuegen.Click sleep 2 - Kontext "Toolbar" - sleep 1 - '/// click button 'Connector' on Toolbar ///' - Verbinder.Click - '/// make a line with the mouse ///' - gMouseMove 30,30,70,70 - sleep 3 - Kontext "Toolbar" - GluePoints.Click - sleep 1 - '/// open Glue Points Toolbar ///' - Kontext "Gluepointsobjectbar" - if Gluepointsobjectbar.Exists = False Then - ViewToolbarsGluepoints - end if - sleep 3 - '-------------------------------------- Klebepunkt einfuegen ---- - try - '/// click button 'Insert Glue Point' on Objecttoolbar ///' - PunkteEinfuegen.Click - sleep 2 - '/// click 2 times onto the created line ///' - gMouseClick 25,30 - sleep 1 - gMouseclick 25,30 - Printlog "- insert gluepoint works" - catch - Warnlog "- gluepoint could not be insert. Following errors might have their reason here" - endcatch - sleep 3 - Kontext "Gluepointsobjectbar" - - '-------------------------------------- Links ------------------- - try - '/// click button 'Exit Direction Left' on Objecttoolbar ///' - Links.Click - Printlog "- gluepoint left works" - catch - Warnlog "- gluepoint left does not work" - endcatch - sleep 1 - '-------------------------------------- Rechts ------------------ - try - '/// click button 'Exit Direction Right' on Objecttoolbar ///' - Rechts.Click - Printlog "- gluepoint right works" - catch - Warnlog "- gluepoint right does not work" - endcatch - sleep 1 - '-------------------------------------- Oben -------------------- - try - '/// click button 'Exit Direction Top' on Objecttoolbar ///' - Oben.Click - Printlog "- gluepoint top works" - catch - Warnlog "- gluepoint top does not work" - endcatch - sleep 1 - '-------------------------------------- Unten ------------------- - try - '/// click button 'Exit Direction Bottom' on Objecttoolbar ///' - Unten.Click - Printlog "- gluepoint bottom works" - catch - Warnlog "- gluepoint bottom does not work" - endcatch - sleep 1 - '---------------------- Position an Objekt anpassen ------------- - try - '/// click button 'Glue Point Relative' on Objecttoolbar ///' - PositionAnObjektAnpassen.Click - Printlog "- align position to object works" - gMouseClick 25,30 ' if you don't click onto an existing point, the state changes back :-[ - catch - Warnlog "- align position to object does not work" - endcatch - Kontext "Gluepointsobjectbar" - sleep 1 - '------------------------------------- Horizontal links --------- - if PositionAnObjektAnpassen.exists then printlog "PositionAnObjektAnpassen = Exists" - if PositionAnObjektAnpassen.GetState(2) <> 0 then PositionAnObjektAnpassen.Click ' make unpressed! - '0 = not pressed. 1 = pressed. - sleep 2 - try - Kontext "Gluepointsobjectbar" - '/// click button 'Glue Point Horizontal Left' on Objecttoolbar ///' - HorizontalLinks.Click - Printlog "- align horizontal left works" - catch - Warnlog "- align horizontal left does not work" - PositionAnObjektAnpassen.Click ' that's the middle button, it has to be UP/not activated! - for i = 1 to Gluepointsobjectbar.GetItemCount - if (Gluepointsobjectbar.GetState ( i, 0 ) <> 0 ) then ' is no seperator - printlog "----------------------------------------------------------------------" - printlog "helpid : " + Gluepointsobjectbar.Getstate ( i, 0 ) + " number in row: " + i - printlog "itemtype: " + Gluepointsobjectbar.GetState ( i, 1 ) - printlog "state : " + Gluepointsobjectbar.GetState ( i, 2 ) - printlog "----------------------------------------------------------------------" - end if - next i - endcatch - sleep 2 - '------------------------------------- Horizontal rechts -------- - try - '/// click button 'Glue Point Horizontal Right' on Objecttoolbar ///' - HorizontalRechts.Click - Printlog "- Align horizontal right does work" - catch - Warnlog "- Align horizontal right does notwork" - endcatch - sleep 1 - '------------------------------------- Horizontal zentriert ----- - try - '/// click button 'Glue Point Horizontal Center' on Objecttoolbar ///' - HorizontalZentriert.Click - Printlog "- align horizontal center does work" - catch - Warnlog "- align horizontal center does work" - endcatch - sleep 1 - '------------------------------------- Vertikal oben ------------ - try - '/// click button 'Glue Point Vertical Top' on Objecttoolbar ///' - VertikalOben.Click - sleep 1 - Printlog "- Align vertical top does work" - catch - Warnlog "- Align vertical top does not work" - endcatch - '------------------------------------- Vertikal unten ----------- - try - '/// click button 'Glue Point Vertical Bottom' on Objecttoolbar ///' - VertikalUnten.Click - sleep 1 - printlog "- Align vertical bottom does work" - catch - Warnlog "- Align vertical bottom does not work" - endcatch - '------------------------------------- Vertikal zentriert ------- - try - '/// click button 'Glue Point Vertical Center' on Objecttoolbar ///' - VertikalZentriert.Click - sleep 1 - Printlog "- Align vertical center does work" - catch - Warnlog "- Align vertical center does not work" - endcatch - - Printlog "- End of testing gluepoints" - - '/// Close the Option Bar via View->Toolbars->Option Bar ///' + printlog "click 2 times onto the created line" + gMouseClick 25,30 + sleep 1 + gMouseclick 25,30 + Printlog "- insert gluepoint works" + catch + Warnlog "- gluepoint could not be insert. Following errors might have their reason here" + endcatch + sleep 3 + Kontext "Gluepointsobjectbar" + + '-------------------------------------- Links ------------------- + try + printlog "click button 'Exit Direction Left' on Objecttoolbar" + Links.Click + Printlog "- gluepoint left works" + catch + Warnlog "- gluepoint left does not work" + endcatch + sleep 1 + '-------------------------------------- Rechts ------------------ + try + printlog "click button 'Exit Direction Right' on Objecttoolbar" + Rechts.Click + Printlog "- gluepoint right works" + catch + Warnlog "- gluepoint right does not work" + endcatch + sleep 1 + '-------------------------------------- Oben -------------------- + try + printlog "click button 'Exit Direction Top' on Objecttoolbar" + Oben.Click + Printlog "- gluepoint top works" + catch + Warnlog "- gluepoint top does not work" + endcatch + sleep 1 + '-------------------------------------- Unten ------------------- + try + printlog "click button 'Exit Direction Bottom' on Objecttoolbar" + Unten.Click + Printlog "- gluepoint bottom works" + catch + Warnlog "- gluepoint bottom does not work" + endcatch + sleep 1 + '---------------------- Position an Objekt anpassen ------------- + try + printlog "click button 'Glue Point Relative' on Objecttoolbar" + PositionAnObjektAnpassen.Click + Printlog "- align position to object works" + gMouseClick 25,30 ' if you don't click onto an existing point, the state changes back :-[ + catch + Warnlog "- align position to object does not work" + endcatch + Kontext "Gluepointsobjectbar" + sleep 1 + '------------------------------------- Horizontal links --------- + if PositionAnObjektAnpassen.exists then printlog "PositionAnObjektAnpassen = Exists" + if PositionAnObjektAnpassen.GetState(2) <> 0 then PositionAnObjektAnpassen.Click ' make unpressed! + '0 = not pressed. 1 = pressed. + sleep 2 + try + Kontext "Gluepointsobjectbar" + printlog "click button 'Glue Point Horizontal Left' on Objecttoolbar" + HorizontalLinks.Click + Printlog "- align horizontal left works" + catch + Warnlog "- align horizontal left does not work" + PositionAnObjektAnpassen.Click ' that's the middle button, it has to be UP/not activated! + for i = 1 to Gluepointsobjectbar.GetItemCount + if (Gluepointsobjectbar.GetState ( i, 0 ) <> 0 ) then ' is no seperator + printlog "----------------------------------------------------------------------" + printlog "helpid : " + Gluepointsobjectbar.Getstate ( i, 0 ) + " number in row: " + i + printlog "itemtype: " + Gluepointsobjectbar.GetState ( i, 1 ) + printlog "state : " + Gluepointsobjectbar.GetState ( i, 2 ) + printlog "----------------------------------------------------------------------" + end if + next i + endcatch + sleep 2 + '------------------------------------- Horizontal rechts -------- + try + printlog "click button 'Glue Point Horizontal Right' on Objecttoolbar" + HorizontalRechts.Click + Printlog "- Align horizontal right does work" + catch + Warnlog "- Align horizontal right does notwork" + endcatch + sleep 1 + '------------------------------------- Horizontal zentriert ----- + try + printlog "click button 'Glue Point Horizontal Center' on Objecttoolbar" + HorizontalZentriert.Click + Printlog "- align horizontal center does work" + catch + Warnlog "- align horizontal center does work" + endcatch + sleep 1 + '------------------------------------- Vertikal oben ------------ + try + printlog "click button 'Glue Point Vertical Top' on Objecttoolbar" + VertikalOben.Click + sleep 1 + Printlog "- Align vertical top does work" + catch + Warnlog "- Align vertical top does not work" + endcatch + '------------------------------------- Vertikal unten ----------- + try + printlog "click button 'Glue Point Vertical Bottom' on Objecttoolbar" + VertikalUnten.Click + sleep 1 + printlog "- Align vertical bottom does work" + catch + Warnlog "- Align vertical bottom does not work" + endcatch + '------------------------------------- Vertikal zentriert ------- + try + printlog "click button 'Glue Point Vertical Center' on Objecttoolbar" + VertikalZentriert.Click + sleep 1 + Printlog "- Align vertical center does work" + catch + Warnlog "- Align vertical center does not work" + endcatch + Printlog "- End of testing gluepoints" + printlog "Close the Option Bar via View->Toolbars->Option Bar" ViewToolbarsOptionbar sleep 2 Kontext "Optionsbar" - if Optionsbar.Exists = True Then - warnlog "Couldnt close Optionsbar." - end if - '/// close application ///' + if Optionsbar.Exists = True Then + warnlog "Couldnt close Optionsbar." + end if + printlog "close application" Call hCloseDocument -endcase +endcase 'tiGluepointToolbar -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' +'----------------------------------------------------------------------------' testcase tdBezierToolbar - '/// Open the Application ///' + printlog "Open the Application" Call hNewDocument - - '/// Create a rectangle. ///' + printlog "Create a rectangle." Call hRechteckErstellen ( 10, 10, 30, 40 ) sleep (1) - - '/// Convert the recttangle to an 'Polygon-object' via the context-menu for the object ///' + printlog "Convert the recttangle to an 'Polygon-object' via the context-menu for the object" Call hOpenContextMenu - Call hMenuSelectNr (11) '/// Convert to ///' - Call hMenuSelectNr (2) '/// Polygon-object ///' + printlog "Convert to" + Call hMenuSelectNr (11) + printlog "Polygon-object" + Call hMenuSelectNr (2) sleep (1) - - '/// In the context-menu, select 'Edit Points" ///' + printlog "In the context-menu, select 'Edit Points" Call hOpenContextMenu - Call hMenuSelectNr (5) '/// Select entry nr 5 (Edit Points) ///' + printlog "Select entry nr 5 (Edit Points)" + Call hMenuSelectNr (5) sleep (2) - Kontext "Bezierobjectbar" + if Bezierobjectbar.Exists <> TRUE then + ViewToolbarsBezier + Sleep (2) if Bezierobjectbar.Exists <> TRUE then - ViewToolbarsBezier - Sleep (2) - if Bezierobjectbar.Exists <> TRUE then - warnlog "Bezierobjectbar did not show up. Check why." - end if + warnlog "Bezierobjectbar did not show up. Check why." end if + end if '----------------------------------- Punkte verschieben ------------------------------------ - '/// Select a part of the object with the keyboard ///' - hTypeKeys "<MOD1 TAB>", 4 '/// Selects the fourth vector. ///' - hTypeKeys "<RIGHT>", 40 '/// Moves the selected vector 40 steps. ///' + printlog "Select a part of the object with the keyboard" + printlog "Selects the fourth vector." + hTypeKeys "<MOD1 TAB>", 4 + printlog "Moves the selected vector 40 steps." + hTypeKeys "<RIGHT>", 40 - '/// The 'Object Toolbar' now changes ///' + printlog "The 'Object Toolbar' now changes" Kontext "Bezierobjectbar" - if Bezierobjectbar.Exists <> TRUE then - ViewToolbarsBezier - Sleep 2 - end if - if Bezierobjectbar.Exists <> TRUE then - Warnlog "The Bezier-Objectbar should have been opened, but wasnt." - ViewToolbarsBezier - Sleep 2 - end if + if Bezierobjectbar.Exists <> TRUE then + ViewToolbarsBezier + Sleep 2 + end if + if Bezierobjectbar.Exists <> TRUE then + Warnlog "The Bezier-Objectbar should have been opened, but wasnt." + ViewToolbarsBezier + Sleep 2 + end if Kontext "Bezierobjectbar" - sleep 1 - Printlog "- Move points" - '/// click button 'Move points' on 'Object Toolbar' ///' - Verschieben.Click - sleep 2 - - hTypeKeys "<MOD1 TAB>" - hTypeKeys "<MOD1 SHIFT SPACE>" '/// Marks the selected vector. ///' - hTypeKeys "<RIGHT>", 20 '/// Moves the vector 20 with "arrow right", twenty times. ///' - - Printlog "- Insert points" - '/// Click button 'Insert points' on 'Object Toolbar' ///' + sleep 1 + Printlog "- Move points" + printlog "click button 'Move points' on 'Object Toolbar'" + Verschieben.Click + sleep 2 + hTypeKeys "<MOD1 TAB>" + printlog "Marks the selected vector." + hTypeKeys "<MOD1 SHIFT SPACE>" + printlog "Moves the vector 20 with arrow right, twenty times." + hTypeKeys "<RIGHT>", 20 + + Printlog "- Insert points" + printlog "Click button 'Insert points' on 'Object Toolbar'" Kontext "Bezierobjectbar" - Einfuegen.Click - sleep 2 - Bezierobjectbar.Move 20, 20 - sleep (1) - Printlog "- Delete points" - - '/// Select another part of the object with spanning a selection with the mouse ///' - gMouseMove 25,25,45,45 - - hTypeKeys "<MOD1 TAB>", 2 '/// Select the second next vector. ///' - hTypeKeys "<MOD1 SHIFT SPACE>" '/// Mark the selected vector. ///' - hTypeKeys "<MOD1 TAB><SHIFT SPACE>" '/// Select and mark the next vector. ///' + Einfuegen.Click + sleep 2 + Bezierobjectbar.Move 20, 20 + sleep (1) + Printlog "- Delete points" + printlog "Select another part of the object with spanning a selection with the mouse" + gMouseMove 25,25,45,45 + printlog "Select the second next vector." + hTypeKeys "<MOD1 TAB>", 2 + printlog "Mark the selected vector." + hTypeKeys "<MOD1 SHIFT SPACE>" + printlog "Select and mark the next vector." + hTypeKeys "<MOD1 TAB><SHIFT SPACE>" - sleep 2 + sleep 2 Kontext "Bezierobjectbar" - sleep 2 - Printlog "- Convert into curve" - '/// click button 'convert to curve' on 'Object Toolbar' ///' - InKurve.Click - sleep 2 - Printlog "- Place edge point" - '/// click button 'corner point' on 'Object Toolbar' ///' - Ecke.Click - sleep 2 - Printlog "- Smooth transition" - '/// click button 'smooth transition' on 'Object Toolbar' ///' - Glatt.Click - sleep 2 - Printlog "- Symetric transition" - '/// click button 'symmetric transition' on 'Object Toolbar' ///' - Symmetrisch.Click - sleep 2 - - '/// Click button 'Eliminate points' on 'Object Toolbar' ///' + sleep 2 + Printlog "- Convert into curve" + printlog "click button 'convert to curve' on 'Object Toolbar'" + InKurve.Click + sleep 2 + Printlog "- Place edge point" + printlog "click button 'corner point' on 'Object Toolbar'" + Ecke.Click + sleep 2 + Printlog "- Smooth transition" + printlog "click button 'smooth transition' on 'Object Toolbar'" + Glatt.Click + sleep 2 + Printlog "- Symetric transition" + printlog "click button 'symmetric transition' on 'Object Toolbar'" + Symmetrisch.Click + sleep 2 + + printlog "Click button 'Eliminate points' on 'Object Toolbar'" Kontext "Bezierobjectbar" - PunkteReduzieren.Click - sleep 2 - - '/// Mark another point ///' - hTypeKeys "<MOD1 TAB>" - hTypeKeys "<MOD1 SHIFT SPACE>" + PunkteReduzieren.Click + sleep 2 - '/// click button 'split curve' on 'Object Toolbar' ///' + printlog "Mark another point" + hTypeKeys "<MOD1 TAB>" + hTypeKeys "<MOD1 SHIFT SPACE>" + + printlog "click button 'split curve' on 'Object Toolbar'" Kontext "Bezierobjectbar" - try - Auftrennen.Click - catch - Warnlog "- 'Break' could not be executed" - endcatch - sleep 2 + try + Auftrennen.Click + catch + Warnlog "- 'Break' could not be executed" + endcatch + sleep 2 - '/// Mark all points ///' - hTypeKeys "<MOD1 TAB>" - hTypeKeys "<MOD1 A>" + printlog "Mark all points" + hTypeKeys "<MOD1 TAB>" + hTypeKeys "<MOD1 A>" - Printlog "- Close bezier" + Printlog "- Close bezier" Kontext "Bezierobjectbar" + try + printlog "click button 'close bezier' on 'Object Toolbar'" + Schliessen.Click + catch + InKurve.Click + sleep 2 try - '/// click button 'close bezier' on 'Object Toolbar' ///' Schliessen.Click catch - InKurve.Click - sleep 2 - try - Schliessen.Click - catch - warnlog "Couldn't push button :-( can't reproduce it now, mostly seen on linux, if i loop this test, it happens only 1/5 of the time ... :-)" - endcatch + warnlog "Couldn't push button :-( can't reproduce it now, mostly seen on linux, if i loop this test, it happens only 1/5 of the time ... :-)" endcatch - sleep 2 + endcatch + sleep 2 - '/// Mark all points ///' - hTypeKeys "<MOD1 TAB>" - hTypeKeys "<MOD1 A>" + printlog "Mark all points" + hTypeKeys "<MOD1 TAB>" + hTypeKeys "<MOD1 A>" - '/// Click button 'Delete points' on 'Object Toolbar' ///' + printlog "Click button 'Delete points' on 'Object Toolbar'" Kontext "Bezierobjectbar" - Printlog "- Break curve" - if ( hClickButton( Loeschen ) = -1 ) then - warnlog( "Unable to click button <Loeschen>" ) - endif - 'try - ' Loeschen.Click - ' sleep 2 - 'catch - ' warnlog "Delete didn't work... why?" - 'endcatch + Printlog "- Break curve" + if ( hClickButton( Loeschen ) = -1 ) then + warnlog( "Unable to click button <Loeschen>" ) + endif - '/// Uncheck on the symbol 'Curve' on the toolbar 'Main Toolbar' ///' + printlog "Uncheck on the symbol 'Curve' on the toolbar 'Main Toolbar'" Kontext "Toolbar" - sleep 2 - Toolbar.OpenContextMenu ' Enable forms button in menuebar - sleep 2 - hMenuselectNr (1) - sleep 2 - hMenuItemUnCheck (7) - sleep 2 - '/// Close application ///' + sleep 2 + Toolbar.OpenContextMenu ' Enable forms button in menuebar + sleep 2 + hMenuselectNr (1) + sleep 2 + hMenuItemUnCheck (7) + sleep 2 + printlog "Close application" Call hCloseDocument -endcase +endcase 'tdBezierToolbar -'------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------' +'------------------------------------------------------------------------------
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/global/id_opt_1.inc b/testautomation/graphics/required/includes/global/id_opt_1.inc index 7ca61a8774b5..dcb6c38795bb 100644 --- a/testautomation/graphics/required/includes/global/id_opt_1.inc +++ b/testautomation/graphics/required/includes/global/id_opt_1.inc @@ -32,162 +32,164 @@ '\****************************************************************************** testcase tToolsOptionsDrawGeneral (sApplication as string) - dim irgendwas(9) as boolean - dim iMasseinheit as integer - dim sTabAbstand as string - dim iZeichnungsmasstab as integer - dim sTemp as string - dim iTemp as integer - dim sTemp2 as string - dim iTemp2 as integer - dim sMeasUnit as string - - hNewDocument - - printlog "save states" - ToolsOptions - hToolsOptions (sApplication,"General") - - irgendwas(1) = Schnellbearbeitung.IsChecked - irgendwas(2) = TextbereichSelektierbar.IsChecked - - irgendwas(3) = CacheFuerHintergrund.IsChecked - irgendwas(4) = KopieBeimVerschieben.IsChecked - irgendwas(5) = ObjekteImmerVerschiebbar.IsChecked - - if (gApplication = "DRAW") then - irgendwas(6) = SetzenAufKreis.IsChecked ' DRAW - iZeichnungsmasstab = Zeichnungsmasstab.GetSelIndex ' DRAW - else ' IMPRESS - irgendwas(7) = MitAutopilotStarten.IsChecked - irgendwas(8) = MitAktuellerSeite.IsChecked - irgendwas(9) = AlleAbsatzabstaendeAddieren.IsChecked - endif - - iMasseinheit = Masseinheit.GetSelIndex - sTabAbstand = Tabulatorabstand.GetText - - printlog "all states inverting" + dim irgendwas(9) as boolean + dim iMasseinheit as integer + dim sTabAbstand as string + dim iZeichnungsmasstab as integer + dim sTemp as string + dim iTemp as integer + dim sTemp2 as string + dim iTemp2 as integer + dim sMeasUnit as string - if irgendwas(1) Then Schnellbearbeitung.UnCheck Else Schnellbearbeitung.Check - if irgendwas(2) Then TextbereichSelektierbar.UnCheck Else TextbereichSelektierbar.Check - - if irgendwas(3) Then CacheFuerHintergrund.UnCheck Else CacheFuerHintergrund.Check - if irgendwas(4) Then KopieBeimVerschieben.UnCheck Else KopieBeimVerschieben.Check - if irgendwas(5) Then ObjekteImmerVerschiebbar.UnCheck Else ObjekteImmerVerschiebbar.Check - - Tabulatorabstand.ToMax - sTemp = Tabulatorabstand.GetText - Tabulatorabstand.More + hNewDocument - if (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE) Then Warnlog "Something wrong, please check!" - Tabulatorabstand.SetText (sTabAbstand) + printlog "save states" + ToolsOptions + hToolsOptions (sApplication,"General") - if (gApplication = "DRAW") then - If ( Zeichnungsmasstab.GetItemCount <> iZeichnungsmasstab ) Then Zeichnungsmasstab.Select (Zeichnungsmasstab.GetItemCount) _ - Else Zeichnungsmasstab.Select (1) - iTemp2 = Zeichnungsmasstab.GetSelIndex - if irgendwas(6) Then SetzenAufKreis.UnCheck Else SetzenAufKreis.Check - else ' IMPRESS - if irgendwas(7) Then MitAutopilotStarten.UnCheck Else MitAutopilotStarten.Check - if irgendwas(8) Then MitAktuellerSeite.UnCheck Else MitAktuellerSeite.Check - if irgendwas(9) Then AlleAbsatzabstaendeAddieren.UnCheck Else AlleAbsatzabstaendeAddieren.Check - endif + irgendwas(1) = Schnellbearbeitung.IsChecked + irgendwas(2) = TextbereichSelektierbar.IsChecked - printlog "<Meas.Unit> interacts with <Tap stops> and vice versa" + irgendwas(3) = CacheFuerHintergrund.IsChecked + irgendwas(4) = KopieBeimVerschieben.IsChecked + irgendwas(5) = ObjekteImmerVerschiebbar.IsChecked - If ( Masseinheit.GetItemCount <> iMasseinheit ) Then Masseinheit.Select (Masseinheit.GetItemCount) _ - Else Masseinheit.Select (1) - iTemp = Masseinheit.GetSelIndex + if (gApplication = "DRAW") then + irgendwas(6) = SetzenAufKreis.IsChecked ' DRAW + iZeichnungsmasstab = Zeichnungsmasstab.GetSelIndex ' DRAW + else ' IMPRESS + irgendwas(7) = MitAutopilotStarten.IsChecked + irgendwas(8) = MitAktuellerSeite.IsChecked + irgendwas(9) = AlleAbsatzabstaendeAddieren.IsChecked + endif - sTemp = Tabulatorabstand.GetText - Tabulatorabstand.ToMax - If ( Tabulatorabstand.GetText = sTemp ) Then Tabulatorabstand.ToMin - sTemp = Tabulatorabstand.GetText + iMasseinheit = Masseinheit.GetSelIndex + sTabAbstand = Tabulatorabstand.GetText - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + printlog "all states inverting" - printlog "Office quit - start" + if irgendwas(1) Then Schnellbearbeitung.UnCheck Else Schnellbearbeitung.Check + if irgendwas(2) Then TextbereichSelektierbar.UnCheck Else TextbereichSelektierbar.Check - ExitRestartTheOffice - printlog "opening new doc to get the Options" - Call hNewDocument - printlog "checking states" - ToolsOptions - hToolsOptions (sApplication,"General") + if irgendwas(3) Then CacheFuerHintergrund.UnCheck Else CacheFuerHintergrund.Check + if irgendwas(4) Then KopieBeimVerschieben.UnCheck Else KopieBeimVerschieben.Check + if irgendwas(5) Then ObjekteImmerVerschiebbar.UnCheck Else ObjekteImmerVerschiebbar.Check - If ( irgendwas(1) = Schnellbearbeitung.IsChecked ) Then WarnLog "Allow Quick Editing state changed" - If ( irgendwas(2) = TextbereichSelektierbar.IsChecked ) Then WarnLog "Only Text Area Selectable state changed" + Tabulatorabstand.ToMax + sTemp = Tabulatorabstand.GetText + Tabulatorabstand.More - If ( irgendwas(3) = CacheFuerHintergrund.IsChecked ) Then WarnLog "Use Background Cache state changed" - If ( irgendwas(4) = KopieBeimVerschieben.IsChecked ) Then WarnLog "Copy When Moving state changed" - If ( irgendwas(5) = ObjekteImmerVerschiebbar.IsChecked ) Then WarnLog "Objects Always Movable state changed" + if (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE) Then Warnlog "Something wrong, please check!" + Tabulatorabstand.SetText (sTabAbstand) - if (gApplication = "DRAW") then + if (gApplication = "DRAW") then + If ( Zeichnungsmasstab.GetItemCount <> iZeichnungsmasstab ) Then + Zeichnungsmasstab.Select (Zeichnungsmasstab.GetItemCount) _ + Else Zeichnungsmasstab.Select (1) + iTemp2 = Zeichnungsmasstab.GetSelIndex + if irgendwas(6) Then SetzenAufKreis.UnCheck Else SetzenAufKreis.Check + endif + else ' IMPRESS + if irgendwas(7) Then MitAutopilotStarten.UnCheck Else MitAutopilotStarten.Check + if irgendwas(8) Then MitAktuellerSeite.UnCheck Else MitAktuellerSeite.Check + if irgendwas(9) Then AlleAbsatzabstaendeAddieren.UnCheck Else AlleAbsatzabstaendeAddieren.Check + endif + + printlog "<Meas.Unit> interacts with <Tap stops> and vice versa" + + If ( Masseinheit.GetItemCount <> iMasseinheit ) Then Masseinheit.Select (Masseinheit.GetItemCount) _ + Else Masseinheit.Select (1) + iTemp = Masseinheit.GetSelIndex + + sTemp = Tabulatorabstand.GetText + Tabulatorabstand.ToMax + If ( Tabulatorabstand.GetText = sTemp ) Then Tabulatorabstand.ToMin + sTemp = Tabulatorabstand.GetText + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + printlog "Office quit - start" + + ExitRestartTheOffice + printlog "opening new doc to get the Options" + Call hNewDocument + printlog "checking states" + ToolsOptions + hToolsOptions (sApplication,"General") + + If ( irgendwas(1) = Schnellbearbeitung.IsChecked ) Then WarnLog "Allow Quick Editing state changed" + If ( irgendwas(2) = TextbereichSelektierbar.IsChecked ) Then WarnLog "Only Text Area Selectable state changed" + + If ( irgendwas(3) = CacheFuerHintergrund.IsChecked ) Then WarnLog "Use Background Cache state changed" + If ( irgendwas(4) = KopieBeimVerschieben.IsChecked ) Then WarnLog "Copy When Moving state changed" + If ( irgendwas(5) = ObjekteImmerVerschiebbar.IsChecked ) Then WarnLog "Objects Always Movable state changed" + + if (gApplication = "DRAW") then If ( Zeichnungsmasstab.GetSelIndex <> iTemp2 ) Then WarnLog "Drawing Scale state changed BUG #97391 is:"+Zeichnungsmasstab.GetSelIndex+"; should: "+iTemp2 If ( irgendwas(6) = SetzenAufKreis.IsChecked ) Then WarnLog "'Do not disort objects in curve' state changed" - else ' IMPRESS + else ' IMPRESS if ( irgendwas(7) = MitAutopilotStarten.IsChecked ) Then WarnLog "'Start with AutoPilot' state changed." -' + ' if ( irgendwas(8) = MitAktuellerSeite.IsChecked ) Then WarnLog "'Always with current page' changed" if ( irgendwas(9) = AlleAbsatzabstaendeAddieren.IsChecked ) Then WarnLog "'Add spacing between paragraphs in the current document' changed" - endif - - If ( Masseinheit.GetSelIndex <> iTemp ) Then WarnLog "Unit of Measurement state changed" - If (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE ) Then WarnLog "Tab stops state changed - watch BugID: 82744 for Status" - - printlog "all UnCheck -> o" - - Schnellbearbeitung.UnCheck - TextbereichSelektierbar.UnCheck - - CacheFuerHintergrund.UnCheck - KopieBeimVerschieben.UnCheck - ObjekteImmerVerschiebbar.UnCheck - - if (gApplication = "DRAW") then - Zeichnungsmasstab.Select (1) - SetzenAufKreis.UnCheck - else ' IMPRESS - MitAutopilotStarten.UnCheck - MitAktuellerSeite.UnCheck - AlleAbsatzabstaendeAddieren.UnCheck - endif - - Masseinheit.Select (1) - Tabulatorabstand.ToMin - sTemp = Tabulatorabstand.GetText - printlog " More test " - Tabulatorabstand.More - if ( sTemp = Tabulatorabstand.GetText ) Then WarnLog "Tab Stops More-Button not working; stemp1: "+sTemp + " =? (2) " +Tabulatorabstand.GetText - sTemp = Tabulatorabstand.GetText - - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - - printlog "check if all UnChecked" - ToolsOptions - hToolsOptions (sApplication,"General") - - If Schnellbearbeitung.IsChecked Then WarnLog "Allow Quick Editing x" - If TextbereichSelektierbar.IsChecked Then WarnLog "Only Text Area Selectable x" - - If CacheFuerHintergrund.IsChecked Then WarnLog "Use Background Cache x" - If KopieBeimVerschieben.IsChecked Then WarnLog "Copy When Moving x" - If ObjekteImmerVerschiebbar.IsChecked Then WarnLog "Objects Always Movable x" - - if (gApplication = "DRAW") then - If ( Zeichnungsmasstab.GetSelIndex <> 1 ) Then WarnLog "'Drawing Scale' is not item 1" - If SetzenAufKreis.IsChecked Then WarnLog "'Do not disort objects in curve' x" - else ' IMPRESS - if MitAutopilotStarten.IsChecked Then WarnLog "Start with AutoPilot x" - if MitAktuellerSeite.IsChecked Then WarnLog "'Always with current page' x" - if AlleAbsatzabstaendeAddieren.IsChecked Then WarnLog "'Add spacing between paragraphs in the current document' x" - endif - - If ( Masseinheit.GetSelIndex <> 1 ) Then WarnLog "Unit of Measurement is not item 1" - If (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE ) Then WarnLog "Tab stops is not min. is: " +Tabulatorabstand.GetText + " should: " +sTemp + endif + + If ( Masseinheit.GetSelIndex <> iTemp ) Then WarnLog "Unit of Measurement state changed" + If (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE ) Then WarnLog "Tab stops state changed - watch BugID: 82744 for Status" + + printlog "all UnCheck -> o" + + Schnellbearbeitung.UnCheck + TextbereichSelektierbar.UnCheck + + CacheFuerHintergrund.UnCheck + KopieBeimVerschieben.UnCheck + ObjekteImmerVerschiebbar.UnCheck + + if (gApplication = "DRAW") then + Zeichnungsmasstab.Select (1) + SetzenAufKreis.UnCheck + else ' IMPRESS + MitAutopilotStarten.UnCheck + MitAktuellerSeite.UnCheck + AlleAbsatzabstaendeAddieren.UnCheck + endif + + Masseinheit.Select (1) + Tabulatorabstand.ToMin + sTemp = Tabulatorabstand.GetText + printlog " More test " + Tabulatorabstand.More + if ( sTemp = Tabulatorabstand.GetText ) Then WarnLog "Tab Stops More-Button not working; stemp1: "+sTemp + " =? (2) " +Tabulatorabstand.GetText + sTemp = Tabulatorabstand.GetText + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + + printlog "check if all UnChecked" + ToolsOptions + hToolsOptions (sApplication,"General") + + If Schnellbearbeitung.IsChecked Then WarnLog "Allow Quick Editing x" + If TextbereichSelektierbar.IsChecked Then WarnLog "Only Text Area Selectable x" + + If CacheFuerHintergrund.IsChecked Then WarnLog "Use Background Cache x" + If KopieBeimVerschieben.IsChecked Then WarnLog "Copy When Moving x" + If ObjekteImmerVerschiebbar.IsChecked Then WarnLog "Objects Always Movable x" + + if (gApplication = "DRAW") then + If ( Zeichnungsmasstab.GetSelIndex <> 1 ) Then WarnLog "'Drawing Scale' is not item 1" + If SetzenAufKreis.IsChecked Then WarnLog "'Do not disort objects in curve' x" + else ' IMPRESS + if MitAutopilotStarten.IsChecked Then WarnLog "Start with AutoPilot x" + if MitAktuellerSeite.IsChecked Then WarnLog "'Always with current page' x" + if AlleAbsatzabstaendeAddieren.IsChecked Then WarnLog "'Add spacing between paragraphs in the current document' x" + endif + + If ( Masseinheit.GetSelIndex <> 1 ) Then WarnLog "Unit of Measurement is not item 1" + If (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE ) Then WarnLog "Tab stops is not min. is: " +Tabulatorabstand.GetText + " should: " +sTemp Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK @@ -198,56 +200,51 @@ testcase tToolsOptionsDrawGeneral (sApplication as string) hNewDocument printlog "set Default Tab Stop to 2,5cm" - ToolsOptions - hToolsOptions (sApplication,"General") - Masseinheit.Select (2) ' cm - sMeasUnit = GetMeasUnit(Tabulatorabstand.GetText) -' printlog "before " + Tabulatorabstand.GetText - Tabulatorabstand.SetText ("2" + GetDecimalSeperator(Tabulatorabstand.GetText) + "50"+ sMeasUnit) -' printlog "after " + Tabulatorabstand.GetText -' printlog "seperator: " + GetDecimalSeperator(Tabulatorabstand.GetText) -' printlog "generated string: " + "2" + GetDecimalSeperator(Tabulatorabstand.GetText) + "50cm" + ToolsOptions + hToolsOptions (sApplication,"General") + Masseinheit.Select (2) ' cm + sMeasUnit = GetMeasUnit(Tabulatorabstand.GetText) + ' printlog "before " + Tabulatorabstand.GetText + Tabulatorabstand.SetText ("2" + GetDecimalSeperator(Tabulatorabstand.GetText) + "50"+ sMeasUnit) + ' printlog "after " + Tabulatorabstand.GetText + ' printlog "seperator: " + GetDecimalSeperator(Tabulatorabstand.GetText) + ' printlog "generated string: " + "2" + GetDecimalSeperator(Tabulatorabstand.GetText) + "50cm" Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK printlog "creating document with tabstops and save it" - if (gApplication = "DRAW") then - kontext "Toolbar" - Textfield.Click - kontext "DocumentDraw" - hMouseClick DocumentDraw,50,50 - else - kontext "Toolbar" - Textfield.Click - kontext "DocumentImpress" - hMouseClick DocumentImpress,20,50 - endif - hTypeKeys "a<Tab>b<Tab>c<Tab>d<Tab>e<Tab>f<Tab>g<Tab>h<Tab>i<Tab>j" - - + if (gApplication = "DRAW") then + kontext "Toolbar" + Textfield.Click + kontext "DocumentDraw" + hMouseClick DocumentDraw,50,50 + else + kontext "Toolbar" + Textfield.Click + kontext "DocumentImpress" + hMouseClick DocumentImpress,20,50 + endif + hTypeKeys "a<Tab>b<Tab>c<Tab>d<Tab>e<Tab>f<Tab>g<Tab>h<Tab>i<Tab>j" if ( gApplication = "IMPRESS" ) then ExtensionString = "odp" else ExtensionString = "odg" end if - hFileSaveAsKill (gOfficePath + "user\work\tab25cm." & ExtensionString ) - - hCloseDocument - sleep (2) - + hCloseDocument + sleep (2) printlog "change tab stops" - hNewDocument + hNewDocument printlog "Changed the Default Tab Stop to 2,9cm" - ToolsOptions - hToolsOptions (sApplication,"General") - Masseinheit.Select (2) ' cm -' printlog "before " + Tabulatorabstand.GetText - Tabulatorabstand.SetText ("2" + GetDecimalSeperator(Tabulatorabstand.GetText) + "90"+sMeasUnit ) -' printlog "after " + Tabulatorabstand.GetText - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - sleep (2) + ToolsOptions + hToolsOptions (sApplication,"General") + Masseinheit.Select (2) ' cm + ' printlog "before " + Tabulatorabstand.GetText + Tabulatorabstand.SetText ("2" + GetDecimalSeperator(Tabulatorabstand.GetText) + "90"+sMeasUnit ) + ' printlog "after " + Tabulatorabstand.GetText + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + sleep (2) @@ -271,98 +268,98 @@ testcase tToolsOptionsDrawGeneral (sApplication as string) hCloseDocument '--------------------------------------------------------------------------------- - Printlog ("'/// - all Check -> x ///") + Printlog ("all Check -> x") - printlog "Click in the open impress document to get the focus back to the document" - printlog "Otherwise it sometimes happend that the Tools/Option dialog doesn't display the correct applications" - hNewDocument - if ( sApplication = "IMPRESS") then + printlog "Click in the open impress document to get the focus back to the document" + printlog "Otherwise it sometimes happend that the Tools/Option dialog doesn't display the correct applications" + hNewDocument + if ( sApplication = "IMPRESS") then Kontext "DocumentImpress" - DocumentImpress.MouseDown(50,50) - DocumentImpress.MouseUp(50,50) - else + DocumentImpress.MouseDown(50,50) + DocumentImpress.MouseUp(50,50) + else Kontext "DocumentDraw" - DocumentDraw.MouseDown(50,50) - DocumentDraw.MouseUp(50,50) - endif + DocumentDraw.MouseDown(50,50) + DocumentDraw.MouseUp(50,50) + endif - ToolsOptions - hToolsOptions (sApplication,"General") - kontext "TabSonstigesDraw" - Schnellbearbeitung.Check - TextbereichSelektierbar.Check + ToolsOptions + hToolsOptions (sApplication,"General") + kontext "TabSonstigesDraw" + Schnellbearbeitung.Check + TextbereichSelektierbar.Check - CacheFuerHintergrund.Check - KopieBeimVerschieben.Check - ObjekteImmerVerschiebbar.Check + CacheFuerHintergrund.Check + KopieBeimVerschieben.Check + ObjekteImmerVerschiebbar.Check - if (gApplication = "DRAW") then + if (gApplication = "DRAW") then Zeichnungsmasstab.Select (2) itemp2 = Zeichnungsmasstab.GetSelIndex SetzenAufKreis.Check - else ' IMPRESS -' MitAutopilotStarten.Check + else ' IMPRESS + ' MitAutopilotStarten.Check MitAktuellerSeite.Check AlleAbsatzabstaendeAddieren.Check - endif + endif - Masseinheit.Select (2) - itemp = Masseinheit.GetSelIndex - sTemp = "3" + GetDecimalSeperator(Tabulatorabstand.GetText) + "21"+sMeasUnit - Tabulatorabstand.SetText (sTemp) + Masseinheit.Select (2) + itemp = Masseinheit.GetSelIndex + sTemp = "3" + GetDecimalSeperator(Tabulatorabstand.GetText) + "21"+sMeasUnit + Tabulatorabstand.SetText (sTemp) - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - printlog ("'/// - check if all Checked ///") - ToolsOptions - hToolsOptions (sApplication,"General") + printlog ("check if all Checked") + ToolsOptions + hToolsOptions (sApplication,"General") - If True <> Schnellbearbeitung.IsChecked Then WarnLog "Allow Quick Editing o" - If True <> TextbereichSelektierbar.IsChecked Then WarnLog "Only Text Area Selectable o" + If True <> Schnellbearbeitung.IsChecked Then WarnLog "Allow Quick Editing o" + If True <> TextbereichSelektierbar.IsChecked Then WarnLog "Only Text Area Selectable o" - If True <> CacheFuerHintergrund.IsChecked Then WarnLog "Use Background Cache o i26631" - If True <> KopieBeimVerschieben.IsChecked Then WarnLog "Copy When Moving o" - If True <> ObjekteImmerVerschiebbar.IsChecked Then WarnLog "Objects Always Movable o" + If True <> CacheFuerHintergrund.IsChecked Then WarnLog "Use Background Cache o i26631" + If True <> KopieBeimVerschieben.IsChecked Then WarnLog "Copy When Moving o" + If True <> ObjekteImmerVerschiebbar.IsChecked Then WarnLog "Objects Always Movable o" - if (gApplication = "DRAW") then - If ( Zeichnungsmasstab.GetSelIndex <> iTemp2 ) Then WarnLog "Drawing Scale is not item " + iTemp2 + " it's: " + Zeichnungsmasstab.GetSelIndex - If True <> SetzenAufKreis.IsChecked Then WarnLog "'Do not disort objects in curve' o" - else ' IMPRESS -' If True <> MitAutopilotStarten.IsChecked Then WarnLog "Start with AutoPilot o" - If True <> MitAktuellerSeite.IsChecked Then WarnLog "'Always with current page' o" - If True <> AlleAbsatzabstaendeAddieren.IsChecked Then WarnLog "'Add spacing between paragraphs in the current document' o" - endif + if (gApplication = "DRAW") then + If ( Zeichnungsmasstab.GetSelIndex <> iTemp2 ) Then WarnLog "Drawing Scale is not item " + iTemp2 + " it's: " + Zeichnungsmasstab.GetSelIndex + If True <> SetzenAufKreis.IsChecked Then WarnLog "'Do not disort objects in curve' o" + else ' IMPRESS + ' If True <> MitAutopilotStarten.IsChecked Then WarnLog "Start with AutoPilot o" + If True <> MitAktuellerSeite.IsChecked Then WarnLog "'Always with current page' o" + If True <> AlleAbsatzabstaendeAddieren.IsChecked Then WarnLog "'Add spacing between paragraphs in the current document' o" + endif - If ( Masseinheit.GetSelIndex <> iTemp ) Then WarnLog "Masseinheit is not item " + iTemp + " it's: " + Masseinheit.GetSelIndex - If (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE ) Then WarnLog "Tab stops is not " + sTemp + " it's: " + Tabulatorabstand.GetText + If ( Masseinheit.GetSelIndex <> iTemp ) Then WarnLog "Masseinheit is not item " + iTemp + " it's: " + Masseinheit.GetSelIndex + If (LiberalMeasurement (sTemp,Tabulatorabstand.GetText) <> TRUE ) Then WarnLog "Tab stops is not " + sTemp + " it's: " + Tabulatorabstand.GetText - printlog "restore states" + printlog "restore states" - If ( irgendwas(1) = TRUE ) Then Schnellbearbeitung.Check Else Schnellbearbeitung.UnCheck - If ( irgendwas(2) = TRUE ) Then TextbereichSelektierbar.Check Else TextbereichSelektierbar.UnCheck + If ( irgendwas(1) = TRUE ) Then Schnellbearbeitung.Check Else Schnellbearbeitung.UnCheck + If ( irgendwas(2) = TRUE ) Then TextbereichSelektierbar.Check Else TextbereichSelektierbar.UnCheck - If ( irgendwas(3) = TRUE ) Then CacheFuerHintergrund.Check Else CacheFuerHintergrund.UnCheck - If ( irgendwas(4) = TRUE ) Then KopieBeimVerschieben.Check Else KopieBeimVerschieben.UnCheck - If ( irgendwas(5) = TRUE ) Then ObjekteImmerVerschiebbar.Check Else ObjekteImmerVerschiebbar.UnCheck + If ( irgendwas(3) = TRUE ) Then CacheFuerHintergrund.Check Else CacheFuerHintergrund.UnCheck + If ( irgendwas(4) = TRUE ) Then KopieBeimVerschieben.Check Else KopieBeimVerschieben.UnCheck + If ( irgendwas(5) = TRUE ) Then ObjekteImmerVerschiebbar.Check Else ObjekteImmerVerschiebbar.UnCheck - if (gApplication = "DRAW") then - Zeichnungsmasstab.Select (iZeichnungsmasstab) - If ( irgendwas(6) = TRUE ) Then SetzenAufKreis.Check Else SetzenAufKreis.UnCheck - else ' IMPRESS - if ( irgendwas(7) = TRUE ) Then MitAutopilotStarten.Check Else MitAutopilotStarten.UnCheck - if ( irgendwas(8) = TRUE ) Then MitAktuellerSeite.Check Else MitAktuellerSeite.UnCheck - if ( irgendwas(9) = TRUE ) Then AlleAbsatzabstaendeAddieren.Check Else AlleAbsatzabstaendeAddieren.UnCheck - endif + if (gApplication = "DRAW") then + Zeichnungsmasstab.Select (iZeichnungsmasstab) + If ( irgendwas(6) = TRUE ) Then SetzenAufKreis.Check Else SetzenAufKreis.UnCheck + else ' IMPRESS + if ( irgendwas(7) = TRUE ) Then MitAutopilotStarten.Check Else MitAutopilotStarten.UnCheck + if ( irgendwas(8) = TRUE ) Then MitAktuellerSeite.Check Else MitAktuellerSeite.UnCheck + if ( irgendwas(9) = TRUE ) Then AlleAbsatzabstaendeAddieren.Check Else AlleAbsatzabstaendeAddieren.UnCheck + endif - Masseinheit.Select (iMasseinheit) 'sw:ListBox:TP_LAYOUT_O - Tabulatorabstand.SetText (sTabAbstand) ' sw:MetricField:TP_LAYOUT_OPT:MF_TAB + Masseinheit.Select (iMasseinheit) 'sw:ListBox:TP_LAYOUT_O + Tabulatorabstand.SetText (sTabAbstand) ' sw:MetricField:TP_LAYOUT_OPT:MF_TAB - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - hCloseDocument + hCloseDocument endcase 'tToolsOptionsDrawGeneral '------------------------------------------------------------------------------ @@ -406,143 +403,143 @@ testcase tToolsOptionsDrawView (sApplication as string) printlog "all UnCheck -> o" - LinealeSichtbar.UnCheck - HilfslinienBeimBewegen.UnCheck - KontrolpunkteImBezierEditor.UnCheck - KonturFuerIndividuelleObjekte.UnCheck + LinealeSichtbar.UnCheck + HilfslinienBeimBewegen.UnCheck + KontrolpunkteImBezierEditor.UnCheck + KonturFuerIndividuelleObjekte.UnCheck - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - printlog "check if all UnChecked" - ToolsOptions - hToolsOptions (sApplication,"View") + printlog "check if all UnChecked" + ToolsOptions + hToolsOptions (sApplication,"View") - If LinealeSichtbar.IsChecked Then WarnLog "Rulers Visible x" - If HilfslinienBeimBewegen.IsChecked Then WarnLog "Guides When Moving x" - If KontrolpunkteImBezierEditor.IsChecked Then WarnLog "'All Control Points In B�zier Editor' x" - If KonturFuerIndividuelleObjekte.IsChecked Then WarnLog "'Contour of Each Individual Object' x" + If LinealeSichtbar.IsChecked Then WarnLog "Rulers Visible x" + If HilfslinienBeimBewegen.IsChecked Then WarnLog "Guides When Moving x" + If KontrolpunkteImBezierEditor.IsChecked Then WarnLog "'All Control Points In B�zier Editor' x" + If KonturFuerIndividuelleObjekte.IsChecked Then WarnLog "'Contour of Each Individual Object' x" - Printlog "all Check -> x" + Printlog "all Check -> x" - LinealeSichtbar.Check - HilfslinienBeimBewegen.Check - KontrolpunkteImBezierEditor.Check - KonturFuerIndividuelleObjekte.Check + LinealeSichtbar.Check + HilfslinienBeimBewegen.Check + KontrolpunkteImBezierEditor.Check + KonturFuerIndividuelleObjekte.Check - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - printlog "check if all Checked" - ToolsOptions - hToolsOptions (sApplication,"View") + printlog "check if all Checked" + ToolsOptions + hToolsOptions (sApplication,"View") - If True <> LinealeSichtbar.IsChecked Then WarnLog "Rulers Visible o" - If True <> HilfslinienBeimBewegen.IsChecked Then WarnLog "Guides When Moving o" - If True <> KontrolpunkteImBezierEditor.IsChecked Then WarnLog "'All Control Points In B�zier Editor' o" - If True <> KonturFuerIndividuelleObjekte.IsChecked Then WarnLog "'Contour of Each Individual Object' o" + If True <> LinealeSichtbar.IsChecked Then WarnLog "Rulers Visible o" + If True <> HilfslinienBeimBewegen.IsChecked Then WarnLog "Guides When Moving o" + If True <> KontrolpunkteImBezierEditor.IsChecked Then WarnLog "'All Control Points In B�zier Editor' o" + If True <> KonturFuerIndividuelleObjekte.IsChecked Then WarnLog "'Contour of Each Individual Object' o" - printlog "restore states" + printlog "restore states" - If ( irgendwas(1) = TRUE ) Then LinealeSichtbar.Check Else LinealeSichtbar.UnCheck - If ( irgendwas(2) = TRUE ) Then HilfslinienBeimBewegen.Check Else HilfslinienBeimBewegen.UnCheck - If ( irgendwas(3) = TRUE ) Then KontrolpunkteImBezierEditor.Check Else KontrolpunkteImBezierEditor.UnCheck - If ( irgendwas(4) = TRUE ) Then KonturFuerIndividuelleObjekte.Check Else KonturFuerIndividuelleObjekte.UnCheck + If ( irgendwas(1) = TRUE ) Then LinealeSichtbar.Check Else LinealeSichtbar.UnCheck + If ( irgendwas(2) = TRUE ) Then HilfslinienBeimBewegen.Check Else HilfslinienBeimBewegen.UnCheck + If ( irgendwas(3) = TRUE ) Then KontrolpunkteImBezierEditor.Check Else KontrolpunkteImBezierEditor.UnCheck + If ( irgendwas(4) = TRUE ) Then KonturFuerIndividuelleObjekte.Check Else KonturFuerIndividuelleObjekte.UnCheck - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - hCloseDocument + hCloseDocument endcase 'tToolsOptionsDrawView '-------------------------------------------------------------------------------- testcase tToolsOptionsDrawGrid (sApplication as string) - dim irgendwas(10) as boolean - dim sMetricField(7) as string ' MetricField - dim sTempMetricField(7) as string - dim iTry as integer ' some increment variable + dim irgendwas(10) as boolean + dim sMetricField(7) as string ' MetricField + dim sTempMetricField(7) as string + dim iTry as integer ' some increment variable - if ( gApplication = "IMPRESS" ) then + if ( gApplication = "IMPRESS" ) then ExtensionString = "odp" else ExtensionString = "odg" end if - hNewDocument - - printlog "save states" - ToolsOptions - hToolsOptions (sApplication,"Grid") - - irgendwas(1) = FangrasterBenutzen.IsChecked - irgendwas(2) = RasterSichtbar.IsChecked - - irgendwas(3) = AchsenSynchronisieren.IsChecked - - irgendwas(4) = AnFanglinien.IsChecked - irgendwas(5) = AnSeitenraendern.IsChecked - irgendwas(6) = AmObjektrahmen.IsChecked - irgendwas(7) = AnObjektpunkten.IsChecked - - irgendwas(8) = BeimErzeugenUndBewegen.IsChecked - irgendwas(9) = LaengereKantenlaenge.IsChecked - irgendwas(10)= BeimDrehen.IsChecked - if BeimDrehen.IsChecked then sMetricField(7) = Winkel.getText - - sMetricField(1) = RasterAufloesungXAchse.GetText - sMetricField(2) = RasterAufloesungYAchse.GetText - sMetricField(3) = RasterUnterteilungXAchse.GetText - sMetricField(4) = RasterUnterteilungYAchse.GetText - sMetricField(5) = FangenFangbereich.GetText - sMetricField(6) = Punktreduktion.GetText - - printlog "all states inverting" - - if irgendwas(1) Then FangrasterBenutzen.UnCheck Else FangrasterBenutzen.Check - if irgendwas(2) Then RasterSichtbar.UnCheck Else RasterSichtbar.Check - -' if irgendwas(3) Then AchsenSynchronisieren.UnCheck Else AchsenSynchronisieren.Check - ' this CheckBox interacts with the MetricBoxes: - AchsenSynchronisieren.UnCheck - - if irgendwas(4) Then AnFanglinien.UnCheck Else AnFanglinien.Check - if irgendwas(5) Then AnSeitenraendern.UnCheck Else AnSeitenraendern.Check - if irgendwas(6) Then AmObjektrahmen.UnCheck Else AmObjektrahmen.Check - if irgendwas(7) Then AnObjektpunkten.UnCheck Else AnObjektpunkten.Check - - if irgendwas(8) Then BeimErzeugenUndBewegen.UnCheck Else BeimErzeugenUndBewegen.Check - if irgendwas(9) Then LaengereKantenlaenge.UnCheck Else LaengereKantenlaenge.Check - if irgendwas(10)Then BeimDrehen.UnCheck Else BeimDrehen.Check - - sTempMetricField(1) = RasterAufloesungXAchse.GetText - sTempMetricField(2) = RasterAufloesungYAchse.GetText - sTempMetricField(3) = RasterUnterteilungXAchse.GetText - sTempMetricField(4) = RasterUnterteilungYAchse.GetText - sTempMetricField(5) = FangenFangbereich.GetText - sTempMetricField(6) = Punktreduktion.GetText - RasterAufloesungXAchse.ToMax - RasterAufloesungYAchse.ToMin - RasterUnterteilungXAchse.ToMin - RasterUnterteilungYAchse.ToMax - FangenFangbereich.ToMin - Punktreduktion.ToMax - If ( RasterAufloesungXAchse.GetText = sTempMetricField(1) ) Then RasterAufloesungXAchse.ToMin - If ( RasterAufloesungYAchse.GetText = sTempMetricField(2) ) Then RasterAufloesungYAchse.ToMax - If ( RasterUnterteilungXAchse.GetText = sTempMetricField(3) ) Then RasterUnterteilungXAchse.ToMax - If ( RasterUnterteilungYAchse.GetText = sTempMetricField(4) ) Then RasterUnterteilungYAchse.ToMin - If ( FangenFangbereich.GetText = sTempMetricField(5) ) Then FangenFangbereich.ToMax - If ( Punktreduktion.GetText = sTempMetricField(6) ) Then Punktreduktion.ToMin - RasterAufloesungXAchse.More ' because it must greater than the.min value for the subdivisions if they are .tomax! - RasterAufloesungXAchse.More - RasterAufloesungYAchse.More - RasterAufloesungYAchse.More - sTempMetricField(1) = RasterAufloesungXAchse.GetText - sTempMetricField(2) = RasterAufloesungYAchse.GetText - sTempMetricField(3) = RasterUnterteilungXAchse.GetText - sTempMetricField(4) = RasterUnterteilungYAchse.GetText - sTempMetricField(5) = FangenFangbereich.GetText - sTempMetricField(6) = Punktreduktion.GetText + hNewDocument + + printlog "save states" + ToolsOptions + hToolsOptions (sApplication,"Grid") + + irgendwas(1) = FangrasterBenutzen.IsChecked + irgendwas(2) = RasterSichtbar.IsChecked + + irgendwas(3) = AchsenSynchronisieren.IsChecked + + irgendwas(4) = AnFanglinien.IsChecked + irgendwas(5) = AnSeitenraendern.IsChecked + irgendwas(6) = AmObjektrahmen.IsChecked + irgendwas(7) = AnObjektpunkten.IsChecked + + irgendwas(8) = BeimErzeugenUndBewegen.IsChecked + irgendwas(9) = LaengereKantenlaenge.IsChecked + irgendwas(10)= BeimDrehen.IsChecked + if BeimDrehen.IsChecked then sMetricField(7) = Winkel.getText + + sMetricField(1) = RasterAufloesungXAchse.GetText + sMetricField(2) = RasterAufloesungYAchse.GetText + sMetricField(3) = RasterUnterteilungXAchse.GetText + sMetricField(4) = RasterUnterteilungYAchse.GetText + sMetricField(5) = FangenFangbereich.GetText + sMetricField(6) = Punktreduktion.GetText + + printlog "all states inverting" + + if irgendwas(1) Then FangrasterBenutzen.UnCheck Else FangrasterBenutzen.Check + if irgendwas(2) Then RasterSichtbar.UnCheck Else RasterSichtbar.Check + + ' if irgendwas(3) Then AchsenSynchronisieren.UnCheck Else AchsenSynchronisieren.Check + ' this CheckBox interacts with the MetricBoxes: + AchsenSynchronisieren.UnCheck + + if irgendwas(4) Then AnFanglinien.UnCheck Else AnFanglinien.Check + if irgendwas(5) Then AnSeitenraendern.UnCheck Else AnSeitenraendern.Check + if irgendwas(6) Then AmObjektrahmen.UnCheck Else AmObjektrahmen.Check + if irgendwas(7) Then AnObjektpunkten.UnCheck Else AnObjektpunkten.Check + + if irgendwas(8) Then BeimErzeugenUndBewegen.UnCheck Else BeimErzeugenUndBewegen.Check + if irgendwas(9) Then LaengereKantenlaenge.UnCheck Else LaengereKantenlaenge.Check + if irgendwas(10)Then BeimDrehen.UnCheck Else BeimDrehen.Check + + sTempMetricField(1) = RasterAufloesungXAchse.GetText + sTempMetricField(2) = RasterAufloesungYAchse.GetText + sTempMetricField(3) = RasterUnterteilungXAchse.GetText + sTempMetricField(4) = RasterUnterteilungYAchse.GetText + sTempMetricField(5) = FangenFangbereich.GetText + sTempMetricField(6) = Punktreduktion.GetText + RasterAufloesungXAchse.ToMax + RasterAufloesungYAchse.ToMin + RasterUnterteilungXAchse.ToMin + RasterUnterteilungYAchse.ToMax + FangenFangbereich.ToMin + Punktreduktion.ToMax + If ( RasterAufloesungXAchse.GetText = sTempMetricField(1) ) Then RasterAufloesungXAchse.ToMin + If ( RasterAufloesungYAchse.GetText = sTempMetricField(2) ) Then RasterAufloesungYAchse.ToMax + If ( RasterUnterteilungXAchse.GetText = sTempMetricField(3) ) Then RasterUnterteilungXAchse.ToMax + If ( RasterUnterteilungYAchse.GetText = sTempMetricField(4) ) Then RasterUnterteilungYAchse.ToMin + If ( FangenFangbereich.GetText = sTempMetricField(5) ) Then FangenFangbereich.ToMax + If ( Punktreduktion.GetText = sTempMetricField(6) ) Then Punktreduktion.ToMin + RasterAufloesungXAchse.More ' because it must greater than the.min value for the subdivisions if they are .tomax! + RasterAufloesungXAchse.More + RasterAufloesungYAchse.More + RasterAufloesungYAchse.More + sTempMetricField(1) = RasterAufloesungXAchse.GetText + sTempMetricField(2) = RasterAufloesungYAchse.GetText + sTempMetricField(3) = RasterUnterteilungXAchse.GetText + sTempMetricField(4) = RasterUnterteilungYAchse.GetText + sTempMetricField(5) = FangenFangbereich.GetText + sTempMetricField(6) = Punktreduktion.GetText Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK @@ -557,205 +554,203 @@ testcase tToolsOptionsDrawGrid (sApplication as string) ToolsOptions hToolsOptions (sApplication,"Grid") - If ( irgendwas(1) = FangrasterBenutzen.IsChecked ) Then WarnLog "Snap to Grid state changed" - If ( irgendwas(2) = RasterSichtbar.IsChecked ) Then WarnLog "Visible Grid state changed" - -' If ( irgendwas(3) = AchsenSynchronisieren.IsChecked ) Then WarnLog "Synchronize Axes state changed" - if ( AchsenSynchronisieren.IsChecked = TRUE ) Then WarnLog "Synchronize Axes state changed" - - If ( irgendwas(4) = AnFanglinien.IsChecked ) Then WarnLog "To snap lines state changed" - If ( irgendwas(5) = AnSeitenraendern.IsChecked ) Then WarnLog "To the page margins state changed" - If ( irgendwas(6) = AmObjektrahmen.IsChecked ) Then WarnLog "To object frame state changed" - If ( irgendwas(7) = AnObjektpunkten.IsChecked ) Then WarnLog "To object points state changed" - - If ( irgendwas(8) = BeimErzeugenUndBewegen.IsChecked ) Then WarnLog "When creating or moving objects state changed" - If ( irgendwas(9) = LaengereKantenlaenge.IsChecked ) Then WarnLog "Extend Edges state changed" - If ( irgendwas(10)= BeimDrehen.IsChecked ) Then WarnLog "When Rotating state changed" - - If ( RasterAufloesungXAchse.GetText <> sTempMetricField(1) ) Then WarnLog "GridResolutionXAxel state changed" - If ( RasterAufloesungYAchse.GetText <> sTempMetricField(2) ) Then WarnLog "GridResolutionYAxel state changed" - If ( RasterUnterteilungXAchse.GetText <> sTempMetricField(3) ) Then WarnLog "GridSubdivisionXAxel state changed is: "+RasterUnterteilungXAchse.GetText+"; should: "+sTempMetricField(3) - If ( RasterUnterteilungYAchse.GetText <> sTempMetricField(4) ) Then WarnLog "GridSubdivisionYAxel state changed is: "+RasterUnterteilungYAchse.GetText+"; should: "+sTempMetricField(4) - If ( FangenFangbereich.GetText <> sTempMetricField(5) ) Then WarnLog "SnapSnap range state changed" - If ( Punktreduktion.GetText <> sTempMetricField(6) ) Then WarnLog "Pointreduction state changed" - - printlog "all UnCheck -> o" - - FangrasterBenutzen.UnCheck - RasterSichtbar.UnCheck - - AchsenSynchronisieren.UnCheck - - AnFanglinien.UnCheck - AnSeitenraendern.UnCheck - AmObjektrahmen.UnCheck - AnObjektpunkten.UnCheck - - BeimErzeugenUndBewegen.UnCheck - LaengereKantenlaenge.UnCheck - BeimDrehen.UnCheck - - RasterAufloesungXAchse.ToMin - RasterAufloesungYAchse.ToMin - RasterUnterteilungXAchse.ToMin - RasterUnterteilungYAchse.ToMin - FangenFangbereich.ToMin - Punktreduktion.ToMin - sTempMetricField(1) = RasterAufloesungXAchse.GetText - sTempMetricField(2) = RasterAufloesungYAchse.GetText - sTempMetricField(3) = RasterUnterteilungXAchse.GetText - sTempMetricField(4) = RasterUnterteilungYAchse.GetText - sTempMetricField(5) = FangenFangbereich.GetText - sTempMetricField(6) = Punktreduktion.GetText - printlog "More test" - RasterAufloesungXAchse.More - RasterAufloesungYAchse.More - RasterUnterteilungXAchse.More - RasterUnterteilungYAchse.More - FangenFangbereich.More - Punktreduktion.More - if ( sTempMetricField(1) = RasterAufloesungXAchse.GetText ) Then WarnLog "GridResolutionXAxel More-Button not working" - if ( sTempMetricField(2) = RasterAufloesungYAchse.GetText ) Then WarnLog "GridResolutionYAxel More-Button not working" - if ( sTempMetricField(3) = RasterUnterteilungXAchse.GetText ) Then WarnLog "GridSubdivisionXAxel More-Button not working" - if ( sTempMetricField(4) = RasterUnterteilungYAchse.GetText ) Then WarnLog "GridSubdivisionYAxel More-Button not working" - if ( sTempMetricField(5) = FangenFangbereich.GetText ) Then WarnLog "Snap Snap Range More-Button not working" - if ( sTempMetricField(6) = Punktreduktion.GetText ) Then WarnLog "Pointreduction More-Button not working is: "+Punktreduktion.GetText - sTempMetricField(1) = RasterAufloesungXAchse.GetText - sTempMetricField(2) = RasterAufloesungYAchse.GetText - sTempMetricField(3) = RasterUnterteilungXAchse.GetText - sTempMetricField(4) = RasterUnterteilungYAchse.GetText - sTempMetricField(5) = FangenFangbereich.GetText - sTempMetricField(6) = Punktreduktion.GetText + If ( irgendwas(1) = FangrasterBenutzen.IsChecked ) Then WarnLog "Snap to Grid state changed" + If ( irgendwas(2) = RasterSichtbar.IsChecked ) Then WarnLog "Visible Grid state changed" - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + ' If ( irgendwas(3) = AchsenSynchronisieren.IsChecked ) Then WarnLog "Synchronize Axes state changed" + if ( AchsenSynchronisieren.IsChecked = TRUE ) Then WarnLog "Synchronize Axes state changed" + + If ( irgendwas(4) = AnFanglinien.IsChecked ) Then WarnLog "To snap lines state changed" + If ( irgendwas(5) = AnSeitenraendern.IsChecked ) Then WarnLog "To the page margins state changed" + If ( irgendwas(6) = AmObjektrahmen.IsChecked ) Then WarnLog "To object frame state changed" + If ( irgendwas(7) = AnObjektpunkten.IsChecked ) Then WarnLog "To object points state changed" + + If ( irgendwas(8) = BeimErzeugenUndBewegen.IsChecked ) Then WarnLog "When creating or moving objects state changed" + If ( irgendwas(9) = LaengereKantenlaenge.IsChecked ) Then WarnLog "Extend Edges state changed" + If ( irgendwas(10)= BeimDrehen.IsChecked ) Then WarnLog "When Rotating state changed" + + If ( RasterAufloesungXAchse.GetText <> sTempMetricField(1) ) Then WarnLog "GridResolutionXAxel state changed" + If ( RasterAufloesungYAchse.GetText <> sTempMetricField(2) ) Then WarnLog "GridResolutionYAxel state changed" + If ( RasterUnterteilungXAchse.GetText <> sTempMetricField(3) ) Then WarnLog "GridSubdivisionXAxel state changed is: "+RasterUnterteilungXAchse.GetText+"; should: "+sTempMetricField(3) + If ( RasterUnterteilungYAchse.GetText <> sTempMetricField(4) ) Then WarnLog "GridSubdivisionYAxel state changed is: "+RasterUnterteilungYAchse.GetText+"; should: "+sTempMetricField(4) + If ( FangenFangbereich.GetText <> sTempMetricField(5) ) Then WarnLog "SnapSnap range state changed" + If ( Punktreduktion.GetText <> sTempMetricField(6) ) Then WarnLog "Pointreduction state changed" + + printlog "all UnCheck -> o" + + FangrasterBenutzen.UnCheck + RasterSichtbar.UnCheck + + AchsenSynchronisieren.UnCheck + + AnFanglinien.UnCheck + AnSeitenraendern.UnCheck + AmObjektrahmen.UnCheck + AnObjektpunkten.UnCheck + + BeimErzeugenUndBewegen.UnCheck + LaengereKantenlaenge.UnCheck + BeimDrehen.UnCheck + + RasterAufloesungXAchse.ToMin + RasterAufloesungYAchse.ToMin + RasterUnterteilungXAchse.ToMin + RasterUnterteilungYAchse.ToMin + FangenFangbereich.ToMin + Punktreduktion.ToMin + sTempMetricField(1) = RasterAufloesungXAchse.GetText + sTempMetricField(2) = RasterAufloesungYAchse.GetText + sTempMetricField(3) = RasterUnterteilungXAchse.GetText + sTempMetricField(4) = RasterUnterteilungYAchse.GetText + sTempMetricField(5) = FangenFangbereich.GetText + sTempMetricField(6) = Punktreduktion.GetText + printlog "More test" + RasterAufloesungXAchse.More + RasterAufloesungYAchse.More + RasterUnterteilungXAchse.More + RasterUnterteilungYAchse.More + FangenFangbereich.More + Punktreduktion.More + if ( sTempMetricField(1) = RasterAufloesungXAchse.GetText ) Then WarnLog "GridResolutionXAxel More-Button not working" + if ( sTempMetricField(2) = RasterAufloesungYAchse.GetText ) Then WarnLog "GridResolutionYAxel More-Button not working" + if ( sTempMetricField(3) = RasterUnterteilungXAchse.GetText ) Then WarnLog "GridSubdivisionXAxel More-Button not working" + if ( sTempMetricField(4) = RasterUnterteilungYAchse.GetText ) Then WarnLog "GridSubdivisionYAxel More-Button not working" + if ( sTempMetricField(5) = FangenFangbereich.GetText ) Then WarnLog "Snap Snap Range More-Button not working" + if ( sTempMetricField(6) = Punktreduktion.GetText ) Then WarnLog "Pointreduction More-Button not working is: "+Punktreduktion.GetText + sTempMetricField(1) = RasterAufloesungXAchse.GetText + sTempMetricField(2) = RasterAufloesungYAchse.GetText + sTempMetricField(3) = RasterUnterteilungXAchse.GetText + sTempMetricField(4) = RasterUnterteilungYAchse.GetText + sTempMetricField(5) = FangenFangbereich.GetText + sTempMetricField(6) = Punktreduktion.GetText + + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - printlog "check if all UnChecked" - ToolsOptions - hToolsOptions (sApplication,"Grid") + printlog "check if all UnChecked" + ToolsOptions + hToolsOptions (sApplication,"Grid") - If FangrasterBenutzen.IsChecked Then WarnLog "Snap to Grid x" - If RasterSichtbar.IsChecked Then WarnLog "Visible Grid x" + If FangrasterBenutzen.IsChecked Then WarnLog "Snap to Grid x" + If RasterSichtbar.IsChecked Then WarnLog "Visible Grid x" - If AchsenSynchronisieren.IsChecked Then WarnLog "Synchronize Axes x" + If AchsenSynchronisieren.IsChecked Then WarnLog "Synchronize Axes x" - If AnFanglinien.IsChecked Then WarnLog "To Snap Lines x" - If AnSeitenraendern.IsChecked Then WarnLog "To The Page Margins x" - If AmObjektrahmen.IsChecked Then WarnLog "To Object Frame x" - If AnObjektpunkten.IsChecked Then WarnLog "To Object Points x" + If AnFanglinien.IsChecked Then WarnLog "To Snap Lines x" + If AnSeitenraendern.IsChecked Then WarnLog "To The Page Margins x" + If AmObjektrahmen.IsChecked Then WarnLog "To Object Frame x" + If AnObjektpunkten.IsChecked Then WarnLog "To Object Points x" - If BeimErzeugenUndBewegen.IsChecked Then WarnLog "When Creating or Moving Objects x" - If LaengereKantenlaenge.IsChecked Then WarnLog "Extend Edges x" - If BeimDrehen.IsChecked Then WarnLog "When Rotating x" + If BeimErzeugenUndBewegen.IsChecked Then WarnLog "When Creating or Moving Objects x" + If LaengereKantenlaenge.IsChecked Then WarnLog "Extend Edges x" + If BeimDrehen.IsChecked Then WarnLog "When Rotating x" - If ( RasterAufloesungXAchse.GetText <> sTempMetricField(1) ) Then WarnLog "GridResolutionXAxel is not min." - If ( RasterAufloesungYAchse.GetText <> sTempMetricField(2) ) Then WarnLog "GridResolutionYAxel is not min." - If ( RasterUnterteilungXAchse.GetText <> sTempMetricField(3) ) Then WarnLog "GridSubdivisionXAxel is not min." - If ( RasterUnterteilungYAchse.GetText <> sTempMetricField(4) ) Then WarnLog "GridSubdivisionYAxel is not min." - If ( FangenFangbereich.GetText <> sTempMetricField(5) ) Then WarnLog "Snap Snap Range is not min." - If ( Punktreduktion.GetText <> sTempMetricField(6) ) Then WarnLog "Point Reduction is not min." + If ( RasterAufloesungXAchse.GetText <> sTempMetricField(1) ) Then WarnLog "GridResolutionXAxel is not min." + If ( RasterAufloesungYAchse.GetText <> sTempMetricField(2) ) Then WarnLog "GridResolutionYAxel is not min." + If ( RasterUnterteilungXAchse.GetText <> sTempMetricField(3) ) Then WarnLog "GridSubdivisionXAxel is not min." + If ( RasterUnterteilungYAchse.GetText <> sTempMetricField(4) ) Then WarnLog "GridSubdivisionYAxel is not min." + If ( FangenFangbereich.GetText <> sTempMetricField(5) ) Then WarnLog "Snap Snap Range is not min." + If ( Punktreduktion.GetText <> sTempMetricField(6) ) Then WarnLog "Point Reduction is not min." - Printlog "all Check -> x" + Printlog "all Check -> x" - FangrasterBenutzen.Check - RasterSichtbar.Check + FangrasterBenutzen.Check + RasterSichtbar.Check - AchsenSynchronisieren.Check + AchsenSynchronisieren.Check printlog "Synchronize axes check" - RasterAufloesungXAchse.ToMax - sleep 1 - sTempMetricField(1) = RasterAufloesungXAchse.GetText - if RasterAufloesungYAchse.GetText <> sTempMetricField(1) then Warnlog "Y-axis res. differs from X-axis" - RasterUnterteilungXAchse.ToMax - sleep 1 - sTempMetricField(3) = RasterUnterteilungXAchse.GetText - if RasterUnterteilungYAchse.GetText <> sTempMetricField(3) then Warnlog "Y-axis sub. differs from X-axis" -'-------------------------------------------- - sTempMetricField(2) = RasterAufloesungYAchse.GetText - sTempMetricField(4) = RasterUnterteilungYAchse.GetText - - FangenFangbereich.Less - Punktreduktion.Less - sTempMetricField(5) = FangenFangbereich.GetText - sTempMetricField(6) = Punktreduktion.GetText - - AnFanglinien.Check - AnSeitenraendern.Check - AmObjektrahmen.Check - AnObjektpunkten.Check - - BeimErzeugenUndBewegen.Check - LaengereKantenlaenge.Check - BeimDrehen.Check - Winkel.ToMax - sTempMetricField(7) = Winkel.GetText + RasterAufloesungXAchse.ToMax + sleep 1 + sTempMetricField(1) = RasterAufloesungXAchse.GetText + if RasterAufloesungYAchse.GetText <> sTempMetricField(1) then Warnlog "Y-axis res. differs from X-axis" + RasterUnterteilungXAchse.ToMax + sleep 1 + sTempMetricField(3) = RasterUnterteilungXAchse.GetText + if RasterUnterteilungYAchse.GetText <> sTempMetricField(3) then Warnlog "Y-axis sub. differs from X-axis" + '-------------------------------------------- + sTempMetricField(2) = RasterAufloesungYAchse.GetText + sTempMetricField(4) = RasterUnterteilungYAchse.GetText + + FangenFangbereich.Less + Punktreduktion.Less + sTempMetricField(5) = FangenFangbereich.GetText + sTempMetricField(6) = Punktreduktion.GetText + + AnFanglinien.Check + AnSeitenraendern.Check + AmObjektrahmen.Check + AnObjektpunkten.Check + + BeimErzeugenUndBewegen.Check + LaengereKantenlaenge.Check + BeimDrehen.Check + Winkel.ToMax + sTempMetricField(7) = Winkel.GetText - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - printlog "check if all Checked" - ToolsOptions - hToolsOptions (sApplication,"Grid") + printlog "check if all Checked" + ToolsOptions + hToolsOptions (sApplication,"Grid") - If True <> FangrasterBenutzen.IsChecked Then WarnLog "Snap to Grid o" - If True <> RasterSichtbar.IsChecked Then WarnLog "Visible Grid o" + If True <> FangrasterBenutzen.IsChecked Then WarnLog "Snap to Grid o" + If True <> RasterSichtbar.IsChecked Then WarnLog "Visible Grid o" - If True <> AchsenSynchronisieren.IsChecked Then WarnLog "Synchronize Axes o" + If True <> AchsenSynchronisieren.IsChecked Then WarnLog "Synchronize Axes o" - If True <> AnFanglinien.IsChecked Then WarnLog "to snap lines o" - If True <> AnSeitenraendern.IsChecked Then WarnLog "to the page margins o" - If True <> AmObjektrahmen.IsChecked Then WarnLog "to object frame o" - If True <> AnObjektpunkten.IsChecked Then WarnLog "To object points o" + If True <> AnFanglinien.IsChecked Then WarnLog "to snap lines o" + If True <> AnSeitenraendern.IsChecked Then WarnLog "to the page margins o" + If True <> AmObjektrahmen.IsChecked Then WarnLog "to object frame o" + If True <> AnObjektpunkten.IsChecked Then WarnLog "To object points o" - If True <> BeimErzeugenUndBewegen.IsChecked Then WarnLog "When creating or moving objects o" - If True <> LaengereKantenlaenge.IsChecked Then WarnLog "Extend Edges o" - If True <> BeimDrehen.IsChecked Then WarnLog "When Rotating o" - If ( Winkel.GetText <> sTempMetricField(7) ) Then WarnLog "Angle is not max." + If True <> BeimErzeugenUndBewegen.IsChecked Then WarnLog "When creating or moving objects o" + If True <> LaengereKantenlaenge.IsChecked Then WarnLog "Extend Edges o" + If True <> BeimDrehen.IsChecked Then WarnLog "When Rotating o" + If ( Winkel.GetText <> sTempMetricField(7) ) Then WarnLog "Angle is not max." - If ( RasterAufloesungXAchse.GetText <> sTempMetricField(1) ) Then WarnLog "GridResolutionXAxel is not max.Bug 54934 in 01:" - If ( RasterAufloesungYAchse.GetText <> sTempMetricField(2) ) Then WarnLog "GridResolutionYAxel is not max." - If ( RasterUnterteilungXAchse.GetText <> sTempMetricField(3) ) Then WarnLog "GridSubdivisionXAxel is not max." - If ( RasterUnterteilungYAchse.GetText <> sTempMetricField(4) ) Then WarnLog "GridSubdivisionYAxel is not max." - If ( FangenFangbereich.GetText <> sTempMetricField(5) ) Then WarnLog "Snap Snap Range is not max." - If ( Punktreduktion.GetText <> sTempMetricField(6) ) Then WarnLog "Pointreduction is not max." + If ( RasterAufloesungXAchse.GetText <> sTempMetricField(1) ) Then WarnLog "GridResolutionXAxel is not max.Bug 54934 in 01:" + If ( RasterAufloesungYAchse.GetText <> sTempMetricField(2) ) Then WarnLog "GridResolutionYAxel is not max." + If ( RasterUnterteilungXAchse.GetText <> sTempMetricField(3) ) Then WarnLog "GridSubdivisionXAxel is not max." + If ( RasterUnterteilungYAchse.GetText <> sTempMetricField(4) ) Then WarnLog "GridSubdivisionYAxel is not max." + If ( FangenFangbereich.GetText <> sTempMetricField(5) ) Then WarnLog "Snap Snap Range is not max." + If ( Punktreduktion.GetText <> sTempMetricField(6) ) Then WarnLog "Pointreduction is not max." - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK '------------------------------------------------------------------------------- printlog "Function Test: Grid Resolution" - printlog "gTesttoolPath + graphics\required\input\gridtst.od?" - - if ( gApplication = "IMPRESS" ) then + printlog "gTesttoolPath + graphics\required\input\gridtst.od?" + if ( gApplication = "IMPRESS" ) then ExtensionString = "odp" else ExtensionString = "odg" end if - - Call hFileOpen ( gTesttoolPath + "graphics\required\input\gridtst."+ExtensionString, False ) - sleep 5 - printlog "If write-protected - open as Temp-file" - Kontext "Standardbar" - if Bearbeiten.GetState(2) <> 1 then + Call hFileOpen ( gTesttoolPath + "graphics\required\input\gridtst."+ExtensionString, False ) + sleep 5 + printlog "If write-protected - open as Temp-file" + Kontext "Standardbar" + if Bearbeiten.GetState(2) <> 1 then Bearbeiten.Click '0 = not pressed. 1 = pressed. Kontext if Active.Exists() then - Active.Yes + Active.Yes else warnlog "No messagebox after making document editable? - Test canceled here" goto endsub endif - endif - sleep (8) - if uCase(gApplication) = "IMPRESS" then + endif + sleep (8) + if uCase(gApplication) = "IMPRESS" then Kontext "DocumentImpress" - else + else Kontext "DocumentDraw" - endif - printlog "select grafik element" - for iTry = 1 to 20 + endif + printlog "select grafik element" + for iTry = 1 to 20 try EditSelectAll printlog "EditSelectAll ready after " & iTry/10 & " seconds" @@ -769,21 +764,21 @@ testcase tToolsOptionsDrawGrid (sApplication as string) ContextPositionAndSize Kontext active.setpage TabPositionAndSize - Kontext "TabPositionAndSize" - sleep 1 - if ( StrToDouble (PositionX.GetText) <> 0 ) Then WarnLog "HorizontalBy wrong presupposition != 0" - if ( StrToDouble (Positiony.GetText) <> 0 ) Then WarnLog "VerticalBy wrong presupposition != 0" - TabPositionAndSize.Cancel - sleep (3) - - printlog "move grafik with <Alt> + <up/down>" + Kontext "TabPositionAndSize" + sleep 1 + if ( StrToDouble (PositionX.GetText) <> 0 ) Then WarnLog "HorizontalBy wrong presupposition != 0" + if ( StrToDouble (Positiony.GetText) <> 0 ) Then WarnLog "VerticalBy wrong presupposition != 0" + TabPositionAndSize.Cancel + sleep (3) + + printlog "move grafik with <Alt> + <up/down>" printlog "resulting step = defined for accessability <> one pixel with cursor traveling" - hTypeKeys "<Mod2 Down>" + hTypeKeys "<Mod2 Down>" sleep (3) - hTypeKeys "<Mod2 Right>" + hTypeKeys "<Mod2 Right>" - printlog "check if @ (1,1) Current-Measure-Unit :-)" - for iTry = 1 to 20 + printlog "check if @ (1,1) Current-Measure-Unit :-)" + for iTry = 1 to 20 try EditSelectAll printlog "EditSelectAll ready after " & iTry/10 & " seconds" @@ -792,18 +787,18 @@ testcase tToolsOptionsDrawGrid (sApplication as string) wait( 100 ) endcatch next iTry - try + try ContextPositionAndSize - catch + catch printlog "Why is format position and size not enabled ? Wrong focus?" - endcatch + endcatch Kontext active.setpage TabPositionAndSize - Kontext "TabPositionAndSize" - Printlog "X difference is: '"+StrToDouble (PositionX.GetText)+"'; "+PositionX.GetText - Printlog "Y difference is: '"+StrToDouble (PositionY.GetText)+"'; "+PositionY.GetText - TabPositionAndSize.Cancel -' sleep (3) + Kontext "TabPositionAndSize" + Printlog "X difference is: '"+StrToDouble (PositionX.GetText)+"'; "+PositionX.GetText + Printlog "Y difference is: '"+StrToDouble (PositionY.GetText)+"'; "+PositionY.GetText + TabPositionAndSize.Cancel + ' sleep (3) hCloseDocument @@ -813,27 +808,27 @@ testcase tToolsOptionsDrawGrid (sApplication as string) ToolsOptions hToolsOptions (sApplication,"Grid") - If ( irgendwas(2) = TRUE ) Then FangrasterBenutzen.Check Else FangrasterBenutzen.UnCheck - If ( irgendwas(3) = TRUE ) Then RasterSichtbar.Check Else RasterSichtbar.UnCheck - - If ( irgendwas(4) = TRUE ) Then AchsenSynchronisieren.Check Else AchsenSynchronisieren.UnCheck - - If ( irgendwas(5) = TRUE ) Then AnFanglinien.Check Else AnFanglinien.UnCheck - If ( irgendwas(6) = TRUE ) Then AnSeitenraendern.Check Else AnSeitenraendern.UnCheck - If ( irgendwas(7) = TRUE ) Then AmObjektrahmen.Check Else AmObjektrahmen.UnCheck - If ( irgendwas(8) = TRUE ) Then AnObjektpunkten.Check Else AnObjektpunkten.UnCheck - - If ( irgendwas(6) = TRUE ) Then BeimErzeugenUndBewegen.Check Else BeimErzeugenUndBewegen.UnCheck - If ( irgendwas(7) = TRUE ) Then LaengereKantenlaenge.Check Else LaengereKantenlaenge.UnCheck - If ( irgendwas(8) = TRUE ) Then BeimDrehen.Check Else BeimDrehen.UnCheck - if BeimDrehen.IsChecked then Winkel.SetText (sMetricField(7)) - - RasterAufloesungXAchse.SetText (sMetricField(1)) - RasterAufloesungYAchse.SetText (sMetricField(2)) - RasterUnterteilungXAchse.SetText (sMetricField(3)) - RasterUnterteilungYAchse.SetText (sMetricField(4)) - FangenFangbereich.SetText (sMetricField(5)) - Punktreduktion.SetText (sMetricField(6)) + If ( irgendwas(2) = TRUE ) Then FangrasterBenutzen.Check Else FangrasterBenutzen.UnCheck + If ( irgendwas(3) = TRUE ) Then RasterSichtbar.Check Else RasterSichtbar.UnCheck + + If ( irgendwas(4) = TRUE ) Then AchsenSynchronisieren.Check Else AchsenSynchronisieren.UnCheck + + If ( irgendwas(5) = TRUE ) Then AnFanglinien.Check Else AnFanglinien.UnCheck + If ( irgendwas(6) = TRUE ) Then AnSeitenraendern.Check Else AnSeitenraendern.UnCheck + If ( irgendwas(7) = TRUE ) Then AmObjektrahmen.Check Else AmObjektrahmen.UnCheck + If ( irgendwas(8) = TRUE ) Then AnObjektpunkten.Check Else AnObjektpunkten.UnCheck + + If ( irgendwas(6) = TRUE ) Then BeimErzeugenUndBewegen.Check Else BeimErzeugenUndBewegen.UnCheck + If ( irgendwas(7) = TRUE ) Then LaengereKantenlaenge.Check Else LaengereKantenlaenge.UnCheck + If ( irgendwas(8) = TRUE ) Then BeimDrehen.Check Else BeimDrehen.UnCheck + if BeimDrehen.IsChecked then Winkel.SetText (sMetricField(7)) + + RasterAufloesungXAchse.SetText (sMetricField(1)) + RasterAufloesungYAchse.SetText (sMetricField(2)) + RasterUnterteilungXAchse.SetText (sMetricField(3)) + RasterUnterteilungYAchse.SetText (sMetricField(4)) + FangenFangbereich.SetText (sMetricField(5)) + Punktreduktion.SetText (sMetricField(6)) Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK @@ -845,58 +840,58 @@ endcase 'tToolsOptionsDrawGrid testcase tToolsOptionsDrawPrint (sApplication as string) - dim irgendwas(11) as boolean - dim bRadioBut(7) as boolean ' RadioButtons - dim bTempRadioBut(7) as boolean - dim iShouldHaveBeenAMultiListBox as integer + dim irgendwas(11) as boolean + dim bRadioBut(7) as boolean ' RadioButtons + dim bTempRadioBut(7) as boolean + dim iShouldHaveBeenAMultiListBox as integer - hNewDocument + hNewDocument - printlog "save states" - ToolsOptions - hToolsOptions (sApplication,"Print") + printlog "save states" + ToolsOptions + hToolsOptions (sApplication,"Print") - Standard.Check - irgendwas(1) = Seitenname.IsChecked - irgendwas(2) = Datum.IsChecked - irgendwas(3) = Zeit.IsChecked - irgendwas(4) = AusgeblendeteSeitenDrucken.IsChecked + Standard.Check + irgendwas(1) = Seitenname.IsChecked + irgendwas(2) = Datum.IsChecked + irgendwas(3) = Zeit.IsChecked + irgendwas(4) = AusgeblendeteSeitenDrucken.IsChecked - Prospekt.Check - irgendwas(5) = Vorderseite.IsChecked - irgendwas(6) = Rueckseite.IsChecked + Prospekt.Check + irgendwas(5) = Vorderseite.IsChecked + irgendwas(6) = Rueckseite.IsChecked - irgendwas(7) = AusDruckereinstellung.IsChecked + irgendwas(7) = AusDruckereinstellung.IsChecked - bRadioBut(1) = StandardAusgabe.IsChecked - bRadioBut(2) = Graustufen.IsChecked - bRadioBut(3) = SchwarzWeiss.IsChecked - bRadioBut(4) = Standard.IsChecked - bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked - bRadioBut(6) = SeitenKacheln.IsChecked + bRadioBut(1) = StandardAusgabe.IsChecked + bRadioBut(2) = Graustufen.IsChecked + bRadioBut(3) = SchwarzWeiss.IsChecked + bRadioBut(4) = Standard.IsChecked + bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked + bRadioBut(6) = SeitenKacheln.IsChecked - printlog "all states inverting" + printlog "all states inverting" - Standard.Check - if irgendwas(1) Then Seitenname.UnCheck Else Seitenname.Check - if irgendwas(2) Then Datum.UnCheck Else Datum.Check - if irgendwas(3) Then Zeit.UnCheck Else Zeit.Check - if irgendwas(4) Then AusgeblendeteSeitenDrucken.UnCheck Else AusgeblendeteSeitenDrucken.Check + Standard.Check + if irgendwas(1) Then Seitenname.UnCheck Else Seitenname.Check + if irgendwas(2) Then Datum.UnCheck Else Datum.Check + if irgendwas(3) Then Zeit.UnCheck Else Zeit.Check + if irgendwas(4) Then AusgeblendeteSeitenDrucken.UnCheck Else AusgeblendeteSeitenDrucken.Check - Prospekt.Check - if irgendwas(5) Then Vorderseite.UnCheck Else Vorderseite.Check - if irgendwas(6) Then Rueckseite.UnCheck Else Rueckseite.Check + Prospekt.Check + if irgendwas(5) Then Vorderseite.UnCheck Else Vorderseite.Check + if irgendwas(6) Then Rueckseite.UnCheck Else Rueckseite.Check - if irgendwas(7) Then AusDruckereinstellung.UnCheck Else AusDruckereinstellung.Check + if irgendwas(7) Then AusDruckereinstellung.UnCheck Else AusDruckereinstellung.Check - if (StandardAusgabe.IsChecked = True) Then Graustufen.Check Else StandardAusgabe.Check - bTempRadioBut(1) = StandardAusgabe.IsChecked - bTempRadioBut(2) = Graustufen.IsChecked - bTempRadioBut(3) = SchwarzWeiss.IsChecked - if (Standard.IsChecked = True) Then AnSeitengroesseAnpassen.Check Else Standard.Check - bRadioBut(4) = Standard.IsChecked - bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked - bRadioBut(6) = SeitenKacheln.IsChecked + if (StandardAusgabe.IsChecked = True) Then Graustufen.Check Else StandardAusgabe.Check + bTempRadioBut(1) = StandardAusgabe.IsChecked + bTempRadioBut(2) = Graustufen.IsChecked + bTempRadioBut(3) = SchwarzWeiss.IsChecked + if (Standard.IsChecked = True) Then AnSeitengroesseAnpassen.Check Else Standard.Check + bRadioBut(4) = Standard.IsChecked + bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked + bRadioBut(6) = SeitenKacheln.IsChecked Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK @@ -910,145 +905,137 @@ testcase tToolsOptionsDrawPrint (sApplication as string) ToolsOptions hToolsOptions (sApplication,"Print") - Standard.Check - If ( irgendwas(1) = Seitenname.IsChecked ) Then WarnLog "Pagename state changed" - If ( irgendwas(2) = Datum.IsChecked ) Then WarnLog "Date state changed" - If ( irgendwas(3) = Zeit.IsChecked ) Then WarnLog "Time state changed" - If ( irgendwas(4) = AusgeblendeteSeitenDrucken.IsChecked ) Then WarnLog "Hidden Pages state changed" + Standard.Check + If ( irgendwas(1) = Seitenname.IsChecked ) Then WarnLog "Pagename state changed" + If ( irgendwas(2) = Datum.IsChecked ) Then WarnLog "Date state changed" + If ( irgendwas(3) = Zeit.IsChecked ) Then WarnLog "Time state changed" + If ( irgendwas(4) = AusgeblendeteSeitenDrucken.IsChecked ) Then WarnLog "Hidden Pages state changed" - Prospekt.Check - If ( irgendwas(5) = Vorderseite.IsChecked ) Then WarnLog "Brochure Front state changed" - If ( irgendwas(6) = Rueckseite.IsChecked ) Then WarnLog "Brochure Back state changed" + Prospekt.Check + If ( irgendwas(5) = Vorderseite.IsChecked ) Then WarnLog "Brochure Front state changed" + If ( irgendwas(6) = Rueckseite.IsChecked ) Then WarnLog "Brochure Back state changed" - If ( irgendwas(7) = AusDruckereinstellung.IsChecked ) Then WarnLog "Paper Tray From Printer Settings state changed" + If ( irgendwas(7) = AusDruckereinstellung.IsChecked ) Then WarnLog "Paper Tray From Printer Settings state changed" - If ( bTempRadioBut(1) <> StandardAusgabe.IsChecked ) Then WarnLog "Quality Default state changed" - If ( bTempRadioBut(2) <> Graustufen.IsChecked ) Then WarnLog "Quality Grayscale state changed" - If ( bTempRadioBut(3) <> SchwarzWeiss.IsChecked ) Then WarnLog "Quality Black & White state changed" - If ( bTempRadioBut(4) <> Standard.IsChecked ) Then WarnLog "Page Options Default state changed" - If ( bTempRadioBut(5) <> AnSeitengroesseAnpassen.IsChecked ) Then WarnLog "Page Options Fit to Page state changed" - If ( bTempRadioBut(6) <> SeitenKacheln.IsChecked ) Then WarnLog "Page Options Tile Pages state changed" + If ( bTempRadioBut(1) <> StandardAusgabe.IsChecked ) Then WarnLog "Quality Default state changed" + If ( bTempRadioBut(2) <> Graustufen.IsChecked ) Then WarnLog "Quality Grayscale state changed" + If ( bTempRadioBut(3) <> SchwarzWeiss.IsChecked ) Then WarnLog "Quality Black & White state changed" + If ( bTempRadioBut(4) <> Standard.IsChecked ) Then WarnLog "Page Options Default state changed" + If ( bTempRadioBut(5) <> AnSeitengroesseAnpassen.IsChecked ) Then WarnLog "Page Options Fit to Page state changed" + If ( bTempRadioBut(6) <> SeitenKacheln.IsChecked ) Then WarnLog "Page Options Tile Pages state changed" printlog "all UnCheck -> o" - Standard.Check - Seitenname.UnCheck - Datum.UnCheck - Zeit.UnCheck - AusgeblendeteSeitenDrucken.UnCheck - - Prospekt.Check - Vorderseite.UnCheck - Rueckseite.UnCheck - - AusDruckereinstellung.UnCheck - - if (Graustufen.IsChecked = True) Then SchwarzWeiss.Check Else Graustufen.Check - bTempRadioBut(1) = StandardAusgabe.IsChecked - bTempRadioBut(2) = Graustufen.IsChecked - bTempRadioBut(3) = SchwarzWeiss.IsChecked - if (AnSeitengroesseAnpassen.IsChecked = True) Then SeitenKacheln.Check Else AnSeitengroesseAnpassen.Check - bRadioBut(4) = Standard.IsChecked - bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked - bRadioBut(6) = SeitenKacheln.IsChecked - - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK - - printlog "check if all UnChecked" - ToolsOptions - hToolsOptions (sApplication,"Print") - - Standard.Check - If Seitenname.IsChecked Then WarnLog "Print: Page Name x" - If Datum.IsChecked Then WarnLog "Print: Date x" - If Zeit.IsChecked Then WarnLog "Print: Time x" - If AusgeblendeteSeitenDrucken.IsChecked Then WarnLog "Print: Hidden Pages x" - - Prospekt.Check - If Vorderseite.IsChecked Then WarnLog "Page options: Brochure: Front x" - If Rueckseite.IsChecked Then WarnLog "Page options: Brochure: Back x" + Standard.Check + Seitenname.UnCheck + Datum.UnCheck + Zeit.UnCheck + AusgeblendeteSeitenDrucken.UnCheck - If AusDruckereinstellung.IsChecked Then WarnLog "Page options: Paper tray from printer settings x" + Prospekt.Check + Vorderseite.UnCheck + Rueckseite.UnCheck - If ( bTempRadioBut(1) <> StandardAusgabe.IsChecked) Then WarnLog "Quality: Default state changed" - If ( bTempRadioBut(2) <> Graustufen.IsChecked ) Then WarnLog "Quality: Grayscale state changed" - If ( bTempRadioBut(3) <> SchwarzWeiss.IsChecked ) Then WarnLog "Quality: Black & White state changed" - If ( bTempRadioBut(4) <> Standard.IsChecked ) Then WarnLog "Page options: Default state changed" - If ( bTempRadioBut(5) <> AnSeitengroesseAnpassen.IsChecked ) Then WarnLog "Page options: Fit to page state changed" - If ( bTempRadioBut(6) <> SeitenKacheln.IsChecked ) Then WarnLog "Page options: Tile Pages state changed" + AusDruckereinstellung.UnCheck - Printlog "all Check -> x" + if (Graustufen.IsChecked = True) Then SchwarzWeiss.Check Else Graustufen.Check + bTempRadioBut(1) = StandardAusgabe.IsChecked + bTempRadioBut(2) = Graustufen.IsChecked + bTempRadioBut(3) = SchwarzWeiss.IsChecked + if (AnSeitengroesseAnpassen.IsChecked = True) Then SeitenKacheln.Check Else AnSeitengroesseAnpassen.Check + bRadioBut(4) = Standard.IsChecked + bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked + bRadioBut(6) = SeitenKacheln.IsChecked - Standard.Check - Seitenname.Check - Datum.Check - Zeit.Check - AusgeblendeteSeitenDrucken.Check - - Prospekt.Check - Vorderseite.Check - Rueckseite.Check - - AusDruckereinstellung.Check + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - if (SchwarzWeiss.IsChecked = True) Then StandardAusgabe.Check Else SchwarzWeiss.Check - bTempRadioBut(1) = StandardAusgabe.IsChecked - bTempRadioBut(2) = Graustufen.IsChecked - bTempRadioBut(3) = SchwarzWeiss.IsChecked - if (SeitenKacheln.IsChecked = True) Then Standard.Check Else SeitenKacheln.Check - bRadioBut(4) = Standard.IsChecked - bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked - bRadioBut(6) = SeitenKacheln.IsChecked + printlog "check if all UnChecked" + ToolsOptions + hToolsOptions (sApplication,"Print") - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + Standard.Check + If Seitenname.IsChecked Then WarnLog "Print: Page Name x" + If Datum.IsChecked Then WarnLog "Print: Date x" + If Zeit.IsChecked Then WarnLog "Print: Time x" + If AusgeblendeteSeitenDrucken.IsChecked Then WarnLog "Print: Hidden Pages x" + Prospekt.Check + If Vorderseite.IsChecked Then WarnLog "Page options: Brochure: Front x" + If Rueckseite.IsChecked Then WarnLog "Page options: Brochure: Back x" + If AusDruckereinstellung.IsChecked Then WarnLog "Page options: Paper tray from printer settings x" + If ( bTempRadioBut(1) <> StandardAusgabe.IsChecked) Then WarnLog "Quality: Default state changed" + If ( bTempRadioBut(2) <> Graustufen.IsChecked ) Then WarnLog "Quality: Grayscale state changed" + If ( bTempRadioBut(3) <> SchwarzWeiss.IsChecked ) Then WarnLog "Quality: Black & White state changed" + If ( bTempRadioBut(4) <> Standard.IsChecked ) Then WarnLog "Page options: Default state changed" + If ( bTempRadioBut(5) <> AnSeitengroesseAnpassen.IsChecked ) Then WarnLog "Page options: Fit to page state changed" + If ( bTempRadioBut(6) <> SeitenKacheln.IsChecked ) Then WarnLog "Page options: Tile Pages state changed" + + Printlog "all Check -> x" + Standard.Check + Seitenname.Check + Datum.Check + Zeit.Check + AusgeblendeteSeitenDrucken.Check + Prospekt.Check + Vorderseite.Check + Rueckseite.Check + AusDruckereinstellung.Check + if (SchwarzWeiss.IsChecked = True) Then StandardAusgabe.Check Else SchwarzWeiss.Check + bTempRadioBut(1) = StandardAusgabe.IsChecked + bTempRadioBut(2) = Graustufen.IsChecked + bTempRadioBut(3) = SchwarzWeiss.IsChecked + if (SeitenKacheln.IsChecked = True) Then Standard.Check Else SeitenKacheln.Check + bRadioBut(4) = Standard.IsChecked + bRadioBut(5) = AnSeitengroesseAnpassen.IsChecked + bRadioBut(6) = SeitenKacheln.IsChecked - printlog "check if all Checked" - ToolsOptions - hToolsOptions (sApplication,"Print") + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK - Standard.Check - If True <> Seitenname.IsChecked Then WarnLog "Print: Page name o" - If True <> Datum.IsChecked Then WarnLog "Print: Date o" - If True <> Zeit.IsChecked Then WarnLog "Print: Time o" - If True <> AusgeblendeteSeitenDrucken.IsChecked Then WarnLog "Print: Hidden pages o" + printlog "check if all Checked" + ToolsOptions + hToolsOptions (sApplication,"Print") - Prospekt.Check - If True <> Vorderseite.IsChecked Then WarnLog "Page options: Brochure: Front o" - If True <> Rueckseite.IsChecked Then WarnLog "Page options: Brochure: Back o" + Standard.Check + If True <> Seitenname.IsChecked Then WarnLog "Print: Page name o" + If True <> Datum.IsChecked Then WarnLog "Print: Date o" + If True <> Zeit.IsChecked Then WarnLog "Print: Time o" + If True <> AusgeblendeteSeitenDrucken.IsChecked Then WarnLog "Print: Hidden pages o" - If True <> AusDruckereinstellung.IsChecked Then WarnLog "Page options: Paper tray from printer settings o" + Prospekt.Check + If True <> Vorderseite.IsChecked Then WarnLog "Page options: Brochure: Front o" + If True <> Rueckseite.IsChecked Then WarnLog "Page options: Brochure: Back o" - If ( bTempRadioBut(1) <> StandardAusgabe.IsChecked) Then WarnLog "Quality: Default state changed" - If ( bTempRadioBut(2) <> Graustufen.IsChecked ) Then WarnLog "Quality: Grayscale state changed" - If ( bTempRadioBut(3) <> SchwarzWeiss.IsChecked ) Then WarnLog "Quality: Black & White state changed" - If ( bTempRadioBut(4) <> Standard.IsChecked ) Then WarnLog "Page options: Default state changed" - If ( bTempRadioBut(5) <> AnSeitengroesseAnpassen.IsChecked ) Then WarnLog "Page options: Fit to page state changed" - If ( bTempRadioBut(6) <> SeitenKacheln.IsChecked ) Then WarnLog "Page options: Tile pages state changed" + If True <> AusDruckereinstellung.IsChecked Then WarnLog "Page options: Paper tray from printer settings o" - printlog "restore states" + If ( bTempRadioBut(1) <> StandardAusgabe.IsChecked) Then WarnLog "Quality: Default state changed" + If ( bTempRadioBut(2) <> Graustufen.IsChecked ) Then WarnLog "Quality: Grayscale state changed" + If ( bTempRadioBut(3) <> SchwarzWeiss.IsChecked ) Then WarnLog "Quality: Black & White state changed" + If ( bTempRadioBut(4) <> Standard.IsChecked ) Then WarnLog "Page options: Default state changed" + If ( bTempRadioBut(5) <> AnSeitengroesseAnpassen.IsChecked ) Then WarnLog "Page options: Fit to page state changed" + If ( bTempRadioBut(6) <> SeitenKacheln.IsChecked ) Then WarnLog "Page options: Tile pages state changed" - Standard.Check - If ( irgendwas(1) = TRUE ) Then Seitenname.Check Else Seitenname.UnCheck - If ( irgendwas(2) = TRUE ) Then Datum.Check Else Datum.UnCheck - If ( irgendwas(3) = TRUE ) Then Zeit.Check Else Zeit.UnCheck - If ( irgendwas(4) = TRUE ) Then AusgeblendeteSeitenDrucken.Check Else AusgeblendeteSeitenDrucken.UnCheck + printlog "restore states" - Prospekt.Check - If ( irgendwas(5) = TRUE ) Then Vorderseite.Check Else Vorderseite.UnCheck - If ( irgendwas(6) = TRUE ) Then Rueckseite.Check Else Rueckseite.UnCheck + Standard.Check + If ( irgendwas(1) = TRUE ) Then Seitenname.Check Else Seitenname.UnCheck + If ( irgendwas(2) = TRUE ) Then Datum.Check Else Datum.UnCheck + If ( irgendwas(3) = TRUE ) Then Zeit.Check Else Zeit.UnCheck + If ( irgendwas(4) = TRUE ) Then AusgeblendeteSeitenDrucken.Check Else AusgeblendeteSeitenDrucken.UnCheck - If ( irgendwas(7) = TRUE ) Then AusDruckereinstellung.Check Else AusDruckereinstellung.UnCheck + Prospekt.Check + If ( irgendwas(5) = TRUE ) Then Vorderseite.Check Else Vorderseite.UnCheck + If ( irgendwas(6) = TRUE ) Then Rueckseite.Check Else Rueckseite.UnCheck - If ( bRadioBut(1) = TRUE ) Then StandardAusgabe.Check - If ( bRadioBut(2) = TRUE ) Then Graustufen.Check - If ( bRadioBut(3) = TRUE ) Then SchwarzWeiss.Check - Standard.Check + If ( irgendwas(7) = TRUE ) Then AusDruckereinstellung.Check Else AusDruckereinstellung.UnCheck - Kontext "ExtrasOptionenDlg" - ExtrasOptionenDlg.OK + If ( bRadioBut(1) = TRUE ) Then StandardAusgabe.Check + If ( bRadioBut(2) = TRUE ) Then Graustufen.Check + If ( bRadioBut(3) = TRUE ) Then SchwarzWeiss.Check + Standard.Check - hCloseDocument -endcase 'tToolsOptionsDrawPrint + Kontext "ExtrasOptionenDlg" + ExtrasOptionenDlg.OK + hCloseDocument +endcase 'tToolsOptionsDrawPrint
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/global/id_opt_2.inc b/testautomation/graphics/required/includes/global/id_opt_2.inc index 8d38b2b9dc92..0d2f050f4916 100644 --- a/testautomation/graphics/required/includes/global/id_opt_2.inc +++ b/testautomation/graphics/required/includes/global/id_opt_2.inc @@ -37,15 +37,15 @@ testcase tToolsOptionsMeasurementUnit (sApplication as string) dim iCount2 as integer dim sUnitOptions as string dim sUnitDialog as string - + hNewDocument - sleep 1 + sleep 1 ToolsOptions hToolsOptions (sApplication,"General") iCount2 = Masseinheit.GetSelIndex printlog "current measurement unit is: " & iCount2 iCount = Masseinheit.GetItemCount - + Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK printlog "----------------------" @@ -56,14 +56,11 @@ testcase tToolsOptionsMeasurementUnit (sApplication as string) for i=1 to iCount ToolsOptions hToolsOptions (sApplication,"General") - Masseinheit.select i sUnitOptions = GetMeasUnit(Tabulatorabstand.getText) ' (1) printlog "(" + i + "/" + iCount + "): '" + Masseinheit.getSelText + "' - " + sUnitOptions + " (1)" - Kontext "ExtrasOptionenDlg" ExtrasOptionenDlg.OK - Format3D_Effects Kontext "Drei_D_Effekte" Geometrie.Click @@ -74,7 +71,6 @@ testcase tToolsOptionsMeasurementUnit (sApplication as string) printlog "Measurement Unit is same for Options:'" + sUnitOptions + "' and Depth:'" + getMeasUnit(Tiefe.getText) + "' (3)" endif Drei_D_Effekte.close - FormatParagraph Kontext Messagebox.SetPage TabEinzuegeUndAbstaende @@ -86,9 +82,8 @@ testcase tToolsOptionsMeasurementUnit (sApplication as string) printlog "Measurement Unit is same for Options:'" + sUnitOptions + "' and Vonlinks:'" + getMeasUnit(Vonlinks.getText) + "' Paragraph" endif TabEinzuegeUndAbstaende.cancel - next i - + printlog "Setting back measurement to " & iCount2 ToolsOptions hToolsOptions (sApplication,"General") @@ -97,4 +92,4 @@ testcase tToolsOptionsMeasurementUnit (sApplication as string) ExtrasOptionenDlg.OK hCloseDocument -endcase 'tToolsOptionsMeasurementUnit +endcase 'tToolsOptionsMeasurementUnit
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/impress/im_003_.inc b/testautomation/graphics/required/includes/impress/im_003_.inc index 2674433034b9..4cdd6a595cc6 100644 --- a/testautomation/graphics/required/includes/impress/im_003_.inc +++ b/testautomation/graphics/required/includes/impress/im_003_.inc @@ -130,7 +130,9 @@ testcase tiViewPanes hMenuSelectNr (4) endcase 'tiViewPanes + '--------------------------------------------------------- + testcase tiViewMasterView printlog "open application" Call hNewDocument @@ -150,7 +152,9 @@ testcase tiViewMasterView printlog "close application " Call hCloseDocument endcase 'tiViewMasterView + '--------------------------------------------------------- + testcase tiViewSlideMaster printlog "open application with : File->Autopilot->Presentation; OK; OK " @@ -187,7 +191,9 @@ testcase tiViewSlideMaster Call hCloseDocument endcase 'tiViewSlideMaster + '-------------------------------------------------------- + testcase tiViewToolbar_1 const DEFAULT_DELAY = 3 @@ -198,7 +204,6 @@ testcase tiViewToolbar_1 dim i as integer TestFile = ConvertPath (gTesttoolPath + "global\input\graf_inp\desp.bmp") - printlog "open application " Call hNewDocument @@ -209,10 +214,8 @@ testcase tiViewToolbar_1 hUseAsyncSlot( "EditSelectAll" ) Kontext "DocumentImpress" DocumentImpress.typeKeys("<DELETE>",true) - printlog "Insert->Graphic... : global\input\graf_inp\desp.bmp " hUseAsyncSlot( "InsertGraphicsFromFile" ) - Kontext "GrafikEinfuegenDlg" if ( GrafikEinfuegenDlg.exists( DEFAULT_DELAY ) ) then Dateiname.SetText( TestFile ) @@ -259,4 +262,4 @@ testcase tiViewToolbar_1 printlog "close application " Call hCloseDocument -endcase 'tiViewToolbar_1 +endcase 'tiViewToolbar_1
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/impress/im_005_.inc b/testautomation/graphics/required/includes/impress/im_005_.inc index 146d37c0f669..f0703913e068 100644 --- a/testautomation/graphics/required/includes/impress/im_005_.inc +++ b/testautomation/graphics/required/includes/impress/im_005_.inc @@ -43,20 +43,16 @@ testcase tiFormatModifyLayout printlog "open application " Call hNewDocument - printlog( "Format/Page" ) FormatPage - Kontext "SeitenLayout" if ( SeitenLayout.exists( 2 ) ) then DialogTest ( SeitenLayout ) - printlog "cancel dialog 'Page Setup' " hCloseDialog( SeitenLayout, "Cancel" ) else warnlog( "Dialog <SeitenLayout> did not open" ) endif - printlog "close application" Call hCloseDocument diff --git a/testautomation/graphics/required/includes/impress/im_007_.inc b/testautomation/graphics/required/includes/impress/im_007_.inc index 68d271e30d7f..3d6fcbb3f4f5 100644 --- a/testautomation/graphics/required/includes/impress/im_007_.inc +++ b/testautomation/graphics/required/includes/impress/im_007_.inc @@ -95,9 +95,10 @@ testcase tSlideShowSlideShow endcatch printlog "close application " Call hCloseDocument - endcase 'tSlideShowSlideShow + '------------------------------------------------------------------------------- + testcase tSlideShowRehearseTimings goto endsub @@ -139,11 +140,11 @@ testcase tSlideShowRehearseTimings sleep 3 printlog "close application " Call hCloseDocument - endcase 'tSlideShowRehearseTimings + '------------------------------------------------------------------------------- -testcase tSlideShowSlideShowSettings +testcase tSlideShowSlideShowSettings printlog "open application " Call hNewDocument sleep 2 @@ -270,11 +271,11 @@ testcase tSlideShowCustomSlideShow endif printlog "close application " Call hCloseDocument - endcase 'tSlideShowCustomSlideShow + '------------------------------------------------------------------------------ -testcase tSlideShowSlideTransition +testcase tSlideShowSlideTransition dim i as integer dim a as integer dim iCount as integer @@ -326,7 +327,7 @@ testcase tSlideShowSlideTransition if (OeffnenDlg.exists (5)) then printlog "Read all entries in Listbox 'File type' " for i = 1 to Dateityp.getItemCount - printlog "" + i + ":" + Dateityp.getItemText(i) + printlog i + ":" + Dateityp.getItemText(i) next i printlog "cancel dialog 'Open' " OeffnenDlg.cancel @@ -375,7 +376,9 @@ testcase tSlideShowSlideTransition Call hCloseDocument endcase 'tSlideShowSlideTransition + '------------------------------------------------------------------------------- + testcase tSlideShowShowHideSlide printlog "open application " @@ -392,7 +395,9 @@ testcase tSlideShowShowHideSlide SlideShowShowSlide printlog "close application " Call hCloseDocument -endcase +endcase 'tSlideShowShowHideSlide + +'------------------------------------------------------------------------------- testcase tSlideShowAnimation printlog "open application " @@ -478,9 +483,10 @@ testcase tSlideShowAnimation Call hCloseDocument endcase 'tSlideShowShowHideSlide + '------------------------------------------------------------------------------- -testcase tSlideShowCustomAnimation +testcase tSlideShowCustomAnimation dim bError as boolean printlog "open application" @@ -641,7 +647,9 @@ testcase tSlideShowCustomAnimation Call hCloseDocument endcase 'tSlideShowCustomAnimation + '------------------------------------------------------------------------------- + testcase tSlideShowInteraction printlog "open application " @@ -732,4 +740,4 @@ testcase tSlideShowInteraction printlog "close application " Call hCloseDocument -endcase 'tSlideShowInteraction +endcase 'tSlideShowInteraction
\ No newline at end of file diff --git a/testautomation/graphics/required/includes/impress/im_011_.inc b/testautomation/graphics/required/includes/impress/im_011_.inc index 2c505f5facc2..28e58ee2e6e7 100644 --- a/testautomation/graphics/required/includes/impress/im_011_.inc +++ b/testautomation/graphics/required/includes/impress/im_011_.inc @@ -177,4 +177,4 @@ testcase tiDiaLeiste Call hCloseDocument sleep 2 -endcase 'tiDiaLeiste +endcase 'tiDiaLeiste
\ No newline at end of file diff --git a/testautomation/graphics/tools/makeLokaleTxt.bas b/testautomation/graphics/tools/makeLokaleTxt.bas index 687822938dd7..59e66af87ff6 100755 --- a/testautomation/graphics/tools/makeLokaleTxt.bas +++ b/testautomation/graphics/tools/makeLokaleTxt.bas @@ -31,9 +31,9 @@ '* '\****************************************************************** -'/// run this script, if you are testing a new language. ///' -'/// it will add all relevant strings to the file qatesttool/graphics/tools/locale_1.txt ///' -'/// you just have to make sure, that every language only appears once in the file! ///' +printlog "Run this script, if you are testing a new language." +printlog "it will add all relevant strings to the file qatesttool/graphics/tools/locale_1.txt " +printlog "you just have to make sure, that every language only appears once in the file! " public glLocale (15*20) as string public S1 as string @@ -54,13 +54,6 @@ sub main warnlog "Locales file doesn't exist: '" + gTesttoolPath + "graphics\tools\locale_1.txt'" endif - 'Handouts - 'Slide - 'Default - 'English (USA) - 'Background - 'German (Germany) - printlog "Current saved strings are: " printlog "O 1: " + glLocale (1) 'Handouts ' im_103.inc::tViewWorkspaceHandoutView printlog "O 2: " + glLocale (2) 'Slide ' impress/slideshow.inc:: @@ -69,7 +62,7 @@ sub main printlog "O 5: " + glLocale (5) 'Background printlog "O 6: " + glLocale (6) 'German (Germany) - '/// LOCALE Slide - 2 ///' + printlog "LOCALE Slide - 2 " S1 = glLocale (2) + " 1" S2 = glLocale (2) + " 2" S3 = glLocale (2) + " 3" @@ -83,14 +76,15 @@ sub main ' hMenuSelectNr(3) ' hMenuSelectNr(11) ' printlog hMenuItemGetText (4) - ' ViewWorkspaceHandoutView '/// view background handout ///' + ' printlog "view background handout" + ' ViewWorkspaceHandoutView ' sleep 2 ' FormatPage sleep 2 glLocale (1) = "Dummy" 'Seitenname.GetText Printlog "L1: '" + glLocale (1) + "'" '3 Seitenlayout.Close - ' ViewWorkspaceDrawingView '/// back to view background drawing ///' + ' ViewWorkspaceDrawingView '(2)tSlideShowInteraction/fGetSlideName Kontext "Navigator" diff --git a/ucb/source/ucp/webdav/LinkSequence.cxx b/ucb/source/ucp/webdav/LinkSequence.cxx index 39d8d9cecc38..31ec14ba0adf 100644 --- a/ucb/source/ucp/webdav/LinkSequence.cxx +++ b/ucb/source/ucp/webdav/LinkSequence.cxx @@ -168,11 +168,7 @@ bool LinkSequence::createFromXML( const rtl::OString & rInData, rInData.getStr() + nStart, nEnd - nStart + TOKEN_LENGTH ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/LockEntrySequence.cxx b/ucb/source/ucp/webdav/LockEntrySequence.cxx index 762170e7e057..1e577a47981b 100644 --- a/ucb/source/ucp/webdav/LockEntrySequence.cxx +++ b/ucb/source/ucp/webdav/LockEntrySequence.cxx @@ -215,11 +215,7 @@ bool LockEntrySequence::createFromXML( const rtl::OString & rInData, rInData.getStr() + nStart, nEnd - nStart + TOKEN_LENGTH ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/LockSequence.cxx b/ucb/source/ucp/webdav/LockSequence.cxx index cd5f12708d58..f95badaf19d2 100644 --- a/ucb/source/ucp/webdav/LockSequence.cxx +++ b/ucb/source/ucp/webdav/LockSequence.cxx @@ -35,6 +35,8 @@ using namespace webdav_ucp; using namespace com::sun::star; +#define BEEHIVE_BUGS_WORKAROUND + ////////////////////////////////////////////////////////////////////////// struct LockSequenceParseContext @@ -128,7 +130,11 @@ extern "C" int LockSequence_startelement_callback( extern "C" int LockSequence_chardata_callback( void *userdata, int state, +#ifdef BEEHIVE_BUGS_WORKAROUND + const char *buf1, +#else const char *buf, +#endif size_t len ) { LockSequenceParseContext * pCtx @@ -136,6 +142,15 @@ extern "C" int LockSequence_chardata_callback( if ( !pCtx->pLock ) pCtx->pLock = new ucb::Lock; +#ifdef BEEHIVE_BUGS_WORKAROUND + // Beehive sends XML values containing trailing newlines. + if ( buf1[ len - 1 ] == 0x0a ) + len--; + + char * buf = new char[ len + 1 ](); + strncpy( buf, buf1, len ); +#endif + switch ( state ) { case STATE_DEPTH: @@ -207,7 +222,7 @@ extern "C" int LockSequence_chardata_callback( pCtx->pLock->Timeout = sal_Int64( -1 ); pCtx->hasTimeout = true; OSL_ENSURE( sal_False, - "LockSequence_chardata_callback - Unknown timeout!" ); + "LockSequence_chardata_callback - Unknown timeout!" ); } break; @@ -223,6 +238,11 @@ extern "C" int LockSequence_chardata_callback( } } + +#ifdef BEEHIVE_BUGS_WORKAROUND + delete [] buf; +#endif + return 0; // zero to continue, non-zero to abort parsing } @@ -323,11 +343,7 @@ bool LockSequence::createFromXML( const rtl::OString & rInData, rInData.getStr() + nStart, nEnd - nStart + TOKEN_LENGTH ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/NeonHeadRequest.cxx b/ucb/source/ucp/webdav/NeonHeadRequest.cxx index 2880a86a727d..1e5294882a03 100644 --- a/ucb/source/ucp/webdav/NeonHeadRequest.cxx +++ b/ucb/source/ucp/webdav/NeonHeadRequest.cxx @@ -37,16 +37,15 @@ using namespace com::sun::star; namespace { -#if NEON_VERSION >= 0x0250 -void process_headers(ne_request *req, - DAVResource &rResource, - const std::vector< ::rtl::OUString > &rHeaderNames) +void process_headers( ne_request * req, + DAVResource & rResource, + const std::vector< ::rtl::OUString > & rHeaderNames ) { - void *cursor = NULL; - const char *name, *value; + void * cursor = NULL; + const char * name, *value; - while ((cursor = ne_response_header_iterate(req, cursor, - &name, &value)) != NULL) { + while ( ( cursor = ne_response_header_iterate( req, cursor, + &name, &value ) ) != NULL ) { rtl::OUString aHeaderName( rtl::OUString::createFromAscii( name ) ); rtl::OUString aHeaderValue( rtl::OUString::createFromAscii( value ) ); @@ -86,69 +85,6 @@ void process_headers(ne_request *req, } } } -#else -struct NeonHeadRequestContext -{ - DAVResource * pResource; - const std::vector< ::rtl::OUString > * pHeaderNames; - - NeonHeadRequestContext( DAVResource * p, - const std::vector< ::rtl::OUString > * pHeaders ) - : pResource( p ), pHeaderNames( pHeaders ) {} -}; - -extern "C" void NHR_ResponseHeaderCatcher( void * userdata, - const char * value ) -{ - rtl::OUString aHeader( rtl::OUString::createFromAscii( value ) ); - sal_Int32 nPos = aHeader.indexOf( ':' ); - - if ( nPos != -1 ) - { - rtl::OUString aHeaderName( aHeader.copy( 0, nPos ) ); - - NeonHeadRequestContext * pCtx - = static_cast< NeonHeadRequestContext * >( userdata ); - - // Note: Empty vector means that all headers are requested. - bool bIncludeIt = ( pCtx->pHeaderNames->size() == 0 ); - - if ( !bIncludeIt ) - { - // Check whether this header was requested. - std::vector< ::rtl::OUString >::const_iterator it( - pCtx->pHeaderNames->begin() ); - const std::vector< ::rtl::OUString >::const_iterator end( - pCtx->pHeaderNames->end() ); - - while ( it != end ) - { - if ( (*it) == aHeaderName ) - break; - - ++it; - } - - if ( it != end ) - bIncludeIt = true; - } - - if ( bIncludeIt ) - { - // Create & set the PropertyValue - DAVPropertyValue thePropertyValue; - thePropertyValue.Name = aHeaderName; - thePropertyValue.IsCaseSensitive = false; - - if ( nPos < aHeader.getLength() ) - thePropertyValue.Value <<= aHeader.copy( nPos + 1 ).trim(); - - // Add the newly created PropertyValue - pCtx->pResource->properties.push_back( thePropertyValue ); - } - } -} -#endif } // namespace @@ -156,7 +92,7 @@ extern "C" void NHR_ResponseHeaderCatcher( void * userdata, // Constructor // ------------------------------------------------------------------- -NeonHeadRequest::NeonHeadRequest( HttpSession* inSession, +NeonHeadRequest::NeonHeadRequest( HttpSession * inSession, const rtl::OUString & inPath, const std::vector< ::rtl::OUString > & inHeaderNames, @@ -174,16 +110,9 @@ NeonHeadRequest::NeonHeadRequest( HttpSession* inSession, inPath, RTL_TEXTENCODING_UTF8 ) ); -#if NEON_VERSION < 0x0250 - NeonHeadRequestContext aCtx( &ioResource, &inHeaderNames ); - ne_add_response_header_catcher( req, NHR_ResponseHeaderCatcher, &aCtx ); -#endif - nError = ne_request_dispatch( req ); -#if NEON_VERSION >= 0x0250 - process_headers(req, ioResource, inHeaderNames); -#endif + process_headers( req, ioResource, inHeaderNames ); if ( nError == NE_OK && ne_get_status( req )->klass != 2 ) nError = NE_ERROR; diff --git a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx index 85b5ea0393e0..f794516d20aa 100644 --- a/ucb/source/ucp/webdav/NeonPropFindRequest.cxx +++ b/ucb/source/ucp/webdav/NeonPropFindRequest.cxx @@ -191,22 +191,13 @@ extern "C" int NPFR_propfind_iter( void* userdata, // ------------------------------------------------------------------- extern "C" void NPFR_propfind_results( void* userdata, -#if NEON_VERSION >= 0x0260 const ne_uri* uri, -#else - const char* href, -#endif const NeonPropFindResultSet* set ) { // @@@ href is not the uri! DAVResource ctor wants uri! -#if NEON_VERSION >= 0x0260 DAVResource theResource( OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); -#else - DAVResource theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); -#endif ne_propset_iterate( set, NPFR_propfind_iter, &theResource ); @@ -233,22 +224,13 @@ extern "C" int NPFR_propnames_iter( void* userdata, // ------------------------------------------------------------------- extern "C" void NPFR_propnames_results( void* userdata, -#if NEON_VERSION >= 0x0260 const ne_uri* uri, -#else - const char* href, -#endif const NeonPropFindResultSet* results ) { // @@@ href is not the uri! DAVResourceInfo ctor wants uri! // Create entry for the resource. -#if NEON_VERSION >= 0x0260 DAVResourceInfo theResource( OStringToOUString( uri->path, RTL_TEXTENCODING_UTF8 ) ); -#else - DAVResourceInfo theResource( - OStringToOUString( href, RTL_TEXTENCODING_UTF8 ) ); -#endif // Fill entry. ne_propset_iterate( results, NPFR_propnames_iter, &theResource ); diff --git a/ucb/source/ucp/webdav/NeonSession.cxx b/ucb/source/ucp/webdav/NeonSession.cxx index 254fae546940..dca92a040af0 100644 --- a/ucb/source/ucp/webdav/NeonSession.cxx +++ b/ucb/source/ucp/webdav/NeonSession.cxx @@ -184,11 +184,7 @@ struct NeonRequestContext // A simple Neon response_block_reader for use with an XInputStream // ------------------------------------------------------------------- -#if NEON_VERSION >= 0x0250 extern "C" int NeonSession_ResponseBlockReader(void * inUserData, -#else -extern "C" void NeonSession_ResponseBlockReader(void * inUserData, -#endif const char * inBuf, size_t inLen ) { @@ -204,9 +200,7 @@ extern "C" void NeonSession_ResponseBlockReader(void * inUserData, if ( xInputStream.is() ) xInputStream->AddToStream( inBuf, inLen ); } -#if NEON_VERSION >= 0x0250 return 0; -#endif } // ------------------------------------------------------------------- @@ -214,11 +208,7 @@ extern "C" void NeonSession_ResponseBlockReader(void * inUserData, // A simple Neon response_block_reader for use with an XOutputStream // ------------------------------------------------------------------- -#if NEON_VERSION >= 0x0250 extern "C" int NeonSession_ResponseBlockWriter( void * inUserData, -#else -extern "C" void NeonSession_ResponseBlockWriter( void * inUserData, -#endif const char * inBuf, size_t inLen ) { @@ -236,9 +226,7 @@ extern "C" void NeonSession_ResponseBlockWriter( void * inUserData, xOutputStream->writeBytes( aSeq ); } } -#if NEON_VERSION >= 0x0250 return 0; -#endif } // ------------------------------------------------------------------- @@ -1926,17 +1914,11 @@ int NeonSession::GET( ne_session * sess, void *cursor = NULL; const char *name, *value; -#if NEON_VERSION < 0x0250 - if ( getheaders ) - ne_add_response_header_catcher( - req, runResponseHeaderHandler, userdata ); -#endif ne_decompress * dc = ne_decompress_reader( req, ne_accept_2xx, reader, userdata ); ret = ne_request_dispatch( req ); -#if NEON_VERSION >= 0x0250 if ( getheaders ) { while ( ( cursor = ne_response_header_iterate( @@ -1948,7 +1930,7 @@ int NeonSession::GET( ne_session * sess, runResponseHeaderHandler(userdata, buffer); } } -#endif + if ( ret == NE_OK && ne_get_status( req )->klass != 2 ) ret = NE_ERROR; diff --git a/ucb/source/ucp/webdav/NeonUri.cxx b/ucb/source/ucp/webdav/NeonUri.cxx index 774faa06b9dd..27f24c631161 100644 --- a/ucb/source/ucp/webdav/NeonUri.cxx +++ b/ucb/source/ucp/webdav/NeonUri.cxx @@ -59,36 +59,24 @@ using namespace webdav_ucp; namespace { const ne_uri g_sUriDefaultsHTTP = { "http", -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, DEFAULT_HTTP_PORT, -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, NULL }; const ne_uri g_sUriDefaultsHTTPS = { "https", -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, DEFAULT_HTTPS_PORT, -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, NULL }; const ne_uri g_sUriDefaultsFTP = { "ftp", -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, DEFAULT_FTP_PORT, -#if NEON_VERSION >= 0x0260 NULL, -#endif NULL, NULL }; } // namespace @@ -174,11 +162,7 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri ) pUri->scheme ? pUri->scheme : pUriDefs->scheme, RTL_TEXTENCODING_UTF8 ); mUserInfo = rtl::OStringToOUString( -#if NEON_VERSION >= 0x0260 pUri->userinfo ? pUri->userinfo : pUriDefs->userinfo, -#else - pUri->authinfo ? pUri->authinfo : pUriDefs->authinfo, -#endif RTL_TEXTENCODING_UTF8 ); mHostName = rtl::OStringToOUString( pUri->host ? pUri->host : pUriDefs->host, @@ -188,7 +172,6 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri ) pUri->path ? pUri->path : pUriDefs->path, RTL_TEXTENCODING_UTF8 ); -#if NEON_VERSION >= 0x0260 if ( pUri->query ) { mPath += rtl::OUString::createFromAscii( "?" ); @@ -202,7 +185,6 @@ void NeonUri::init( const rtl::OString & rUri, const ne_uri * pUri ) mPath += rtl::OStringToOUString( pUri->fragment, RTL_TEXTENCODING_UTF8 ); } -#endif } // ------------------------------------------------------------------- diff --git a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx index 1ce4c70e6b21..42f30c665b61 100644 --- a/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav/UCBDeadPropertyValue.cxx @@ -373,11 +373,7 @@ bool UCBDeadPropertyValue::createFromXML( const rtl::OString & rInData, ne_xml_parse( parser, rInData.getStr(), rInData.getLength() ); -#if NEON_VERSION >= 0x0250 success = !ne_xml_failed( parser ); -#else - success = !!ne_xml_valid( parser ); -#endif ne_xml_destroy( parser ); diff --git a/ucb/source/ucp/webdav/webdavcontent.cxx b/ucb/source/ucp/webdav/webdavcontent.cxx index 26b2a044e7b6..c58ba207199f 100644 --- a/ucb/source/ucp/webdav/webdavcontent.cxx +++ b/ucb/source/ucp/webdav/webdavcontent.cxx @@ -1183,7 +1183,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( std::auto_ptr< ContentProperties > xProps; std::auto_ptr< ContentProperties > xCachedProps; std::auto_ptr< DAVResourceAccess > xResAccess; - rtl::OUString aEscapedTitle; + rtl::OUString aUnescapedTitle; bool bHasAll = false; uno::Reference< lang::XMultiServiceFactory > xSMgr; uno::Reference< ucb::XContentIdentifier > xIdentifier; @@ -1192,7 +1192,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( { osl::Guard< osl::Mutex > aGuard( m_aMutex ); - aEscapedTitle = NeonUri::unescape( m_aEscapedTitle ); + aUnescapedTitle = NeonUri::unescape( m_aEscapedTitle ); xSMgr.set( m_xSMgr ); xIdentifier.set( m_xIdentifier ); xProvider.set( m_xProvider.get() ); @@ -1365,7 +1365,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( if ( m_eResourceType == NON_DAV ) xProps->addProperties( aMissingProps, ContentProperties( - aEscapedTitle, + aUnescapedTitle, false ) ); } catch ( DAVException const & e ) @@ -1386,32 +1386,33 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // might trigger HTTP redirect. // Therefore, title must be updated here. NeonUri aUri( xResAccess->getURL() ); - aEscapedTitle = aUri.GetPathBaseName(); + aUnescapedTitle = aUri.GetPathBaseNameUnescaped(); - if ( UNKNOWN == rType ) + if ( rType == UNKNOWN ) { - xProps.reset( new ContentProperties( aEscapedTitle ) ); + xProps.reset( new ContentProperties( aUnescapedTitle ) ); } // For DAV resources we only know the Title, for non-DAV // resources we additionally know that it is a document. - if ( DAV == rType ) + + if ( rType == DAV ) { //xProps.reset( - // new ContentProperties( aEscapedTitle ) ); + // new ContentProperties( aUnescapedTitle ) ); xProps->addProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), - uno::makeAny( aEscapedTitle ), + uno::makeAny( aUnescapedTitle ), true ); } else { if ( !xProps.get() ) - xProps.reset( new ContentProperties( aEscapedTitle, false ) ); + xProps.reset( new ContentProperties( aUnescapedTitle, false ) ); else xProps->addProperty( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Title" ) ), - uno::makeAny( aEscapedTitle ), + uno::makeAny( aUnescapedTitle ), true ); xProps->addProperty( @@ -1429,7 +1430,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( // No server access for just created (not yet committed) objects. // Only a minimal set of properties supported at this stage. if (m_bTransient) - xProps.reset( new ContentProperties( aEscapedTitle, + xProps.reset( new ContentProperties( aUnescapedTitle, m_bCollection ) ); } @@ -1480,7 +1481,7 @@ uno::Reference< sdbc::XRow > Content::getPropertyValues( m_xCachedProps->addProperties( *xProps.get() ); m_xResAccess.reset( new DAVResourceAccess( *xResAccess.get() ) ); - m_aEscapedTitle = aEscapedTitle; + m_aEscapedTitle = NeonUri::escapeSegment( aUnescapedTitle ); } return xResultRow; @@ -2947,6 +2948,20 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) // Map DAVException... uno::Any aException; + rtl::OUString aURL; + if ( m_bTransient ) + { + aURL = getParentURL(); + if ( aURL.lastIndexOf( '/' ) != ( aURL.getLength() - 1 ) ) + aURL += rtl::OUString::createFromAscii( "/" ); + + aURL += m_aEscapedTitle; + } + else + { + aURL = m_xIdentifier->getContentIdentifier(); + } + switch ( e.getStatus() ) { case SC_NOT_FOUND: @@ -2954,7 +2969,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= beans::PropertyValue( rtl::OUString::createFromAscii("Uri"), -1, - uno::makeAny(m_xIdentifier->getContentIdentifier()), + uno::makeAny(aURL), beans::PropertyState_DIRECT_VALUE); aException <<= @@ -3044,14 +3059,14 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Locked!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier(), - sal_True ); + aURL, + sal_False ); // not SelfOwned #else { uno::Sequence< uno::Any > aArgs( 1 ); aArgs[ 0 ] <<= beans::PropertyValue( rtl::OUString::createFromAscii("Uri"), -1, - uno::makeAny(m_xIdentifier->getContentIdentifier()), + uno::makeAny(aURL), beans::PropertyState_DIRECT_VALUE); aException <<= @@ -3071,8 +3086,8 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Locked (self)!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier(), - sal_True ); + aURL, + sal_True ); // SelfOwned break; case DAVException::DAV_NOT_LOCKED: @@ -3081,7 +3096,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Not locked!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier() ); + aURL ); break; case DAVException::DAV_LOCK_EXPIRED: @@ -3090,7 +3105,7 @@ uno::Any Content::MapDAVException( const DAVException & e, sal_Bool bWrite ) rtl::OUString::createFromAscii( "Lock expired!" ), static_cast< cppu::OWeakObject * >( this ), task::InteractionClassification_ERROR, - m_xIdentifier->getContentIdentifier() ); + aURL ); break; default: diff --git a/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx b/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx index 7f3da27ece7c..8ab8ead7cffb 100644 --- a/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx +++ b/ucbhelper/inc/ucbhelper/simplenameclashresolverequest.hxx @@ -37,7 +37,7 @@ namespace ucbhelper { /** * This class implements a simple name clash resolve interaction request. * Instances can be passed directly to XInteractionHandler::handle(...). Each - * instance contains an NameClashResolveRequest and two interaction + * instance contains a NameClashResolveRequest and two interaction * continuations: "Abort" and "SupplyName". Another continuation * ("ReplaceExistingData") may be supplied optionally. * @@ -56,11 +56,11 @@ public: * * @param rTargetFolderURL contains the URL of the folder that contains * the clashing resource. - * @param rClashingName contains the clashing name, + * @param rClashingName contains the clashing name. * @param rProposedNewName contains a proposal for the new name or is * empty. - * @param bSupportsOverwriteData indictes whether an - * InteractioneplaceExistingData continuation shall be supplied + * @param bSupportsOverwriteData indicates whether an + * InteractionReplaceExistingData continuation shall be supplied * with the interaction request. */ SimpleNameClashResolveRequest( const rtl::OUString & rTargetFolderURL, diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx index 8505472e1b1f..d6fc260f558b 100644 --- a/ucbhelper/source/client/proxydecider.cxx +++ b/ucbhelper/source/client/proxydecider.cxx @@ -51,13 +51,15 @@ using namespace com::sun::star; using namespace ucbhelper; -#define CONFIG_ROOT_KEY "org.openoffice.Inet/Settings" -#define PROXY_TYPE_KEY "ooInetProxyType" -#define NO_PROXY_LIST_KEY "ooInetNoProxy" -#define HTTP_PROXY_NAME_KEY "ooInetHTTPProxyName" -#define HTTP_PROXY_PORT_KEY "ooInetHTTPProxyPort" -#define FTP_PROXY_NAME_KEY "ooInetFTPProxyName" -#define FTP_PROXY_PORT_KEY "ooInetFTPProxyPort" +#define CONFIG_ROOT_KEY "org.openoffice.Inet/Settings" +#define PROXY_TYPE_KEY "ooInetProxyType" +#define NO_PROXY_LIST_KEY "ooInetNoProxy" +#define HTTP_PROXY_NAME_KEY "ooInetHTTPProxyName" +#define HTTP_PROXY_PORT_KEY "ooInetHTTPProxyPort" +#define HTTPS_PROXY_NAME_KEY "ooInetHTTPSProxyName" +#define HTTPS_PROXY_PORT_KEY "ooInetHTTPSProxyPort" +#define FTP_PROXY_NAME_KEY "ooInetFTPProxyName" +#define FTP_PROXY_PORT_KEY "ooInetFTPProxyPort" //========================================================================= namespace ucbhelper @@ -132,6 +134,7 @@ class InternetProxyDecider_Impl : { mutable osl::Mutex m_aMutex; InternetProxyServer m_aHttpProxy; + InternetProxyServer m_aHttpsProxy; InternetProxyServer m_aFtpProxy; const InternetProxyServer m_aEmptyProxy; sal_Int32 m_nProxyType; @@ -246,6 +249,63 @@ bool WildCard::Matches( const rtl::OUString& rString ) const } //========================================================================= +bool getConfigStringValue( + const uno::Reference< container::XNameAccess > & xNameAccess, + const char * key, + rtl::OUString & value ) +{ + try + { + if ( !( xNameAccess->getByName( rtl::OUString::createFromAscii( key ) ) + >>= value ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - " + "Error getting config item value!" ); + return false; + } + } + catch ( lang::WrappedTargetException const & ) + { + return false; + } + catch ( container::NoSuchElementException const & ) + { + return false; + } + return true; +} + +//========================================================================= +bool getConfigInt32Value( + const uno::Reference< container::XNameAccess > & xNameAccess, + const char * key, + sal_Int32 & value ) +{ + try + { + uno::Any aValue = xNameAccess->getByName( + rtl::OUString::createFromAscii( key ) ); + if ( aValue.hasValue() && !( aValue >>= value ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - " + "Error getting config item value!" ); + return false; + } + } + catch ( lang::WrappedTargetException const & ) + { + return false; + } + catch ( container::NoSuchElementException const & ) + { + return false; + } + return true; +} + +//========================================================================= //========================================================================= // // InternetProxyDecider_Impl Implementation. @@ -291,127 +351,43 @@ InternetProxyDecider_Impl::InternetProxyDecider_Impl( if ( xNameAccess.is() ) { - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - PROXY_TYPE_KEY ) ) >>= m_nProxyType ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + // *** Proxy type *** + getConfigInt32Value( + xNameAccess, PROXY_TYPE_KEY, m_nProxyType ); + // *** No proxy list *** rtl::OUString aNoProxyList; - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - NO_PROXY_LIST_KEY ) ) >>= aNoProxyList ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } - + getConfigStringValue( + xNameAccess, NO_PROXY_LIST_KEY, aNoProxyList ); setNoProxyList( aNoProxyList ); - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - HTTP_PROXY_NAME_KEY ) ) - >>= m_aHttpProxy.aName ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + // *** HTTP *** + getConfigStringValue( + xNameAccess, HTTP_PROXY_NAME_KEY, m_aHttpProxy.aName ); m_aHttpProxy.nPort = -1; - try - { - uno::Any aValue = xNameAccess->getByName( - rtl::OUString::createFromAscii( - HTTP_PROXY_PORT_KEY ) ); - if ( aValue.hasValue() && - !( aValue >>= m_aHttpProxy.nPort ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } - + getConfigInt32Value( + xNameAccess, HTTP_PROXY_PORT_KEY, m_aHttpProxy.nPort ); if ( m_aHttpProxy.nPort == -1 ) m_aHttpProxy.nPort = 80; // standard HTTP port. - try - { - if ( !( xNameAccess->getByName( - rtl::OUString::createFromAscii( - FTP_PROXY_NAME_KEY ) ) - >>= m_aFtpProxy.aName ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + // *** HTTPS *** + getConfigStringValue( + xNameAccess, HTTPS_PROXY_NAME_KEY, m_aHttpsProxy.aName ); + + m_aHttpsProxy.nPort = -1; + getConfigInt32Value( + xNameAccess, HTTPS_PROXY_PORT_KEY, m_aHttpsProxy.nPort ); + if ( m_aHttpsProxy.nPort == -1 ) + m_aHttpsProxy.nPort = 443; // standard HTTPS port. + + // *** FTP *** + getConfigStringValue( + xNameAccess, FTP_PROXY_NAME_KEY, m_aFtpProxy.aName ); m_aFtpProxy.nPort = -1; - try - { - uno::Any aValue = xNameAccess->getByName( - rtl::OUString::createFromAscii( - FTP_PROXY_PORT_KEY ) ); - if ( aValue.hasValue() && - !( aValue >>= m_aFtpProxy.nPort ) ) - { - OSL_ENSURE( sal_False, - "InternetProxyDecider - " - "Error getting config item value!" ); - } - } - catch ( lang::WrappedTargetException const & ) - { - } - catch ( container::NoSuchElementException const & ) - { - } + getConfigInt32Value( + xNameAccess, FTP_PROXY_PORT_KEY, m_aFtpProxy.nPort ); } // Register as listener for config changes. @@ -588,6 +564,12 @@ const InternetProxyServer & InternetProxyDecider_Impl::getProxy( if ( m_aFtpProxy.aName.getLength() > 0 && m_aFtpProxy.nPort >= 0 ) return m_aFtpProxy; } + else if ( rProtocol.toAsciiLowerCase() + .equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "https" ) ) ) + { + if ( m_aHttpsProxy.aName.getLength() ) + return m_aHttpsProxy; + } else if ( m_aHttpProxy.aName.getLength() ) { // All other protocols use the HTTP proxy. @@ -662,6 +644,29 @@ void SAL_CALL InternetProxyDecider_Impl::changesOccurred( m_aHttpProxy.nPort = 80; // standard HTTP port. } else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( + HTTPS_PROXY_NAME_KEY ) ) ) + { + if ( !( rElem.Element >>= m_aHttpsProxy.aName ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - changesOccurred - " + "Error getting config item value!" ); + } + } + else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( + HTTPS_PROXY_PORT_KEY ) ) ) + { + if ( !( rElem.Element >>= m_aHttpsProxy.nPort ) ) + { + OSL_ENSURE( sal_False, + "InternetProxyDecider - changesOccurred - " + "Error getting config item value!" ); + } + + if ( m_aHttpsProxy.nPort == -1 ) + m_aHttpsProxy.nPort = 443; // standard HTTPS port. + } + else if ( aKey.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( FTP_PROXY_NAME_KEY ) ) ) { if ( !( rElem.Element >>= m_aFtpProxy.aName ) ) diff --git a/uui/source/sslwarndlg.src b/uui/source/sslwarndlg.src index b1fe7f54c020..cbcdeef3a8b1 100644 --- a/uui/source/sslwarndlg.src +++ b/uui/source/sslwarndlg.src @@ -41,7 +41,6 @@ ModalDialog DLG_UUI_SSLWARN Moveable = TRUE ; OutputSize = TRUE ; SVLook = TRUE ; - Pos = MAP_APPFONT( 221, 158 ); Size = MAP_APPFONT( DLG_WIDTH, DLG_HEIGHT ); Text [ en-US ] = "Security Warning: "; diff --git a/vcl/aqua/source/app/vclnsapp.mm b/vcl/aqua/source/app/vclnsapp.mm index ff2b4226bfa0..06af0358c52b 100755 --- a/vcl/aqua/source/app/vclnsapp.mm +++ b/vcl/aqua/source/app/vclnsapp.mm @@ -39,6 +39,8 @@ #include "vcl/cmdevt.hxx" #include "rtl/ustrbuf.hxx" +#include "vcl/impimagetree.hxx" + #include "premac.h" #import "Carbon/Carbon.h" #import "apple_remote/RemoteControl.h" @@ -418,6 +420,7 @@ #else // the clean version follows return pSalData->maFrames.front()->CallCallback( SALEVENT_SHUTDOWN, NULL ) ? NSTerminateCancel : NSTerminateNow; #endif + ImplImageTreeSingletonRef()->shutDown(); return NSTerminateNow; } diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index a011e4ee4a92..847a8d7a299a 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -2495,6 +2495,9 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, const bool bDashUsed(LINE_DASH == aInfo.GetStyle()); const bool bLineWidthUsed(aInfo.GetWidth() > 1); + if ( mbInitLineColor ) + ImplInitLineColor(); + if(bDashUsed || bLineWidthUsed) { basegfx::B2DPolygon aLinePolygon; @@ -2505,9 +2508,6 @@ void OutputDevice::DrawLine( const Point& rStartPt, const Point& rEndPt, } else { - if ( mbInitLineColor ) - ImplInitLineColor(); - mpGraphics->DrawLine( aStartPt.X(), aStartPt.Y(), aEndPt.X(), aEndPt.Y(), this ); } diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index b073e1e28d40..a26806ce6c24 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -1926,7 +1926,35 @@ void SdXMLConnectorShapeContext::StartElement(const uno::Reference< xml::sax::XA SetLayer(); if ( maPath.hasValue() ) - xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath ); + { + // --> OD #i115492# + // Ignore svg:d attribute for text documents created by OpenOffice.org + // versions before OOo 3.3, because these OOo versions are storing + // svg:d values not using the correct unit. + bool bApplySVGD( true ); + if ( uno::Reference< text::XTextDocument >(GetImport().GetModel(), uno::UNO_QUERY).is() ) + { + sal_Int32 nUPD( 0 ); + sal_Int32 nBuild( 0 ); + const bool bBuildIdFound = GetImport().getBuildIds( nUPD, nBuild ); + if ( GetImport().IsTextDocInOOoFileFormat() || + ( bBuildIdFound && + ( ( nUPD == 641 ) || ( nUPD == 645 ) || // prior OOo 2.0 + ( nUPD == 680 ) || // OOo 2.x + ( nUPD == 300 ) || // OOo 3.0 - OOo 3.0.1 + ( nUPD == 310 ) || // OOo 3.1 - OOo 3.1.1 + ( nUPD == 320 ) ) ) ) // OOo 3.2 - OOo 3.2.1 + { + bApplySVGD = false; + } + } + + if ( bApplySVGD ) + { + xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("PolyPolygonBezier") ), maPath ); + } + // <-- + } SdXMLShapeContext::StartElement(xAttrList); } |