diff options
Diffstat (limited to 'toolkit/source/awt/vclxtoolkit.cxx')
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index 3618585f09de..b30ec2a39ae4 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -381,6 +381,47 @@ sal_uInt16 ImplGetComponentType( const String& rServiceName ) } +namespace +{ + struct MessageBoxTypeInfo + { + css::awt::MessageBoxType eType; + const sal_Char *pName; + sal_Int32 nLen; + }; + + static MessageBoxTypeInfo aMessageBoxTypeInfo[] = + { + { css::awt::MessageBoxType_MESSAGEBOX, RTL_CONSTASCII_STRINGPARAM("messbox") }, + { css::awt::MessageBoxType_INFOBOX, RTL_CONSTASCII_STRINGPARAM("infobox") }, + { css::awt::MessageBoxType_WARNINGBOX, RTL_CONSTASCII_STRINGPARAM("warningbox") }, + { css::awt::MessageBoxType_ERRORBOX, RTL_CONSTASCII_STRINGPARAM("errorbox") }, + { css::awt::MessageBoxType_QUERYBOX, RTL_CONSTASCII_STRINGPARAM("querybox") }, + { css::awt::MessageBoxType_MAKE_FIXED_SIZE, 0, 0 } + }; + + static bool lcl_convertMessageBoxType( + rtl::OUString &sType, + css::awt::MessageBoxType eType ) + { + const MessageBoxTypeInfo *pMap = aMessageBoxTypeInfo; + css::awt::MessageBoxType eVal = css::awt::MessageBoxType_MAKE_FIXED_SIZE; + + while ( pMap->pName ) + { + if ( pMap->eType == eType ) + { + eVal = eType; + sType = rtl::OUString( pMap->pName, pMap->nLen, RTL_TEXTENCODING_ASCII_US ); + break; + } + pMap++; + } + + return ( eVal != css::awt::MessageBoxType_MAKE_FIXED_SIZE ); + } +} + // ---------------------------------------------------- // class VCLXToolkit // ---------------------------------------------------- @@ -1225,8 +1266,7 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( // ::com::sun::star::awt::XMessageBoxFactory ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > SAL_CALL VCLXToolkit::createMessageBox( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& aParent, - const ::com::sun::star::awt::Rectangle& aPosSize, - const ::rtl::OUString& aType, + ::com::sun::star::awt::MessageBoxType eType, ::sal_Int32 aButtons, const ::rtl::OUString& aTitle, const ::rtl::OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException) @@ -1267,11 +1307,13 @@ css::uno::Reference< css::awt::XWindowPeer > VCLXToolkit::ImplCreateWindow( if ( sal_Int32( aButtons & 0xffff0000L ) == css::awt::MessageBoxButtons::DEFAULT_BUTTON_IGNORE ) nAddWinBits |= WB_DEF_IGNORE; + rtl::OUString aType; + lcl_convertMessageBoxType( aType, eType ); + aDescriptor.Type = css::awt::WindowClass_MODALTOP; aDescriptor.WindowServiceName = aType; aDescriptor.ParentIndex = -1; aDescriptor.Parent = aParent; - aDescriptor.Bounds = aPosSize; aDescriptor.WindowAttributes = nWindowAttributes; ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMessageBox > xMsgBox( ImplCreateWindow( aDescriptor, nAddWinBits ), css::uno::UNO_QUERY ); |