summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorAriel Constenla-Haile <arielch@apache.org>2012-12-24 08:07:25 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-07-11 13:16:58 +0100
commit805c6101b3427cc98b53f1c48f22f705206c384d (patch)
tree6319897b3ee481a664bd0ce3e38b55ad333f56e7 /toolkit
parent5dd1b3da57862a6577717544dde56482add89170 (diff)
Resolves: #i121544# - Clean-up MessageBox API
(cherry picked from commit 27cfcb1e9d103b3e49c1263b1fa59fee8b187b21) Conflicts: desktop/test/deployment/active/active_native.cxx desktop/test/deployment/passive/Dispatch.java desktop/test/deployment/passive/passive_native.cxx odk/examples/DevelopersGuide/Charts/SelectionChangeListener.java odk/examples/DevelopersGuide/GUI/MessageBox.java odk/examples/cpp/complextoolbarcontrols/MyProtocolHandler.cxx odk/examples/java/Inspector/Inspector.java offapi/com/sun/star/awt/MessageBoxButtons.idl offapi/com/sun/star/awt/MessageBoxResults.idl offapi/com/sun/star/awt/XMessageBox.idl offapi/com/sun/star/awt/XMessageBoxFactory.idl offapi/com/sun/star/awt/makefile.mk offapi/type_reference/types.rdb sdext/source/minimizer/unodialog.cxx toolkit/inc/toolkit/awt/vclxtoolkit.hxx toolkit/source/awt/vclxtoolkit.cxx toolkit/source/layout/core/root.cxx Change-Id: I170b494fb96362bb25ba8d0f2518d4e46934dd67 Related: #i121544# - Clean-up MessageBox API (post fix) (cherry picked from commit c9f7a06e7798bcd5253844c49d210ea9345bd4b8) Conflicts: sw/inc/pch/precompiled_sw.hxx Change-Id: Ib8b1e7aaac769feff5206fcdd238c487a6130dd1 Related: #i121544# - Fix header guards Found by: Tsutomu Uchino (cherry picked from commit 82194a19ff4f29c8451c8e6ab6fe4f1b9d08df27) Conflicts: offapi/com/sun/star/awt/MessageBoxType.idl Change-Id: Ide8ba697fbc80395d2f30a068a0820a6afa3332f
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/source/awt/vclxtoolkit.cxx48
1 files changed, 45 insertions, 3 deletions
diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index afe3eb1a3f8f..881e41b8022f 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -366,6 +366,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
// ----------------------------------------------------
@@ -1214,8 +1255,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 OUString& aType,
+ ::com::sun::star::awt::MessageBoxType eType,
::sal_Int32 aButtons,
const OUString& aTitle,
const OUString& aMessage ) throw (::com::sun::star::uno::RuntimeException)
@@ -1256,11 +1296,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 );