Kaydet (Commit) 29953b0c authored tarafından Daniel Boelzle's avatar Daniel Boelzle

#91616# introduced PushButtonType

üst a75657d0
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Id: dialog.dtd,v 1.20 2001-10-16 13:59:35 dbo Exp $
$Id: dialog.dtd,v 1.21 2001-10-22 08:52:19 dbo Exp $
The Contents of this file are made available subject to the terms of
either of the following licenses
......@@ -175,6 +175,7 @@
dlg:value CDATA #IMPLIED
dlg:default %boolean; #IMPLIED
dlg:tabstop %boolean; #IMPLIED
dlg:button-type (standard|ok|cancel|help) #IMPLIED
>
<!ELEMENT dlg:checkbox ((%event;)*)>
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: exp_share.hxx,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
* last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -148,6 +148,7 @@ public:
void readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName );
void readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName );
void readOrientationAttr( OUString const & rPropName, OUString const & rAttrName );
void readButtonTypeAttr( OUString const & rPropName, OUString const & rAttrName );
//
inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ) SAL_THROW( () );
void addNumberFormatAttr(
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: imp_share.hxx,v $
*
* $Revision: 1.16 $
* $Revision: 1.17 $
*
* last change: $Author: dbo $ $Date: 2001-09-25 11:13:15 $
* last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -410,6 +410,9 @@ public:
bool importOrientationProperty(
OUString const & rPropName, OUString const & rAttrName,
Reference< xml::sax2::XExtendedAttributes > const & xAttributes );
bool importButtonTypeProperty(
OUString const & rPropName, OUString const & rAttrName,
Reference< xml::sax2::XExtendedAttributes > const & xAttributes );
};
//==================================================================================================
class ControlImportContext : public ImportContext
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_expmodels.cxx,v $
*
* $Revision: 1.17 $
* $Revision: 1.18 $
*
* last change: $Author: dbo $ $Date: 2001-10-15 13:51:53 $
* last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -92,6 +92,8 @@ void ElementDescriptor::readButtonModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":default") ) );
readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
readButtonTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":button-type") ) );
readEvents();
}
//__________________________________________________________________________________________________
......@@ -124,7 +126,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM("true") ) );
}
sal_Int16 nState;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
if (_xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
{
switch (nState)
{
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_export.cxx,v $
*
* $Revision: 1.25 $
* $Revision: 1.26 $
*
* last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
* last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -71,6 +71,7 @@
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontWidth.hpp>
#include <com/sun/star/awt/PushButtonType.hpp>
#include <com/sun/star/script/XScriptEventsSupplier.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
......@@ -675,6 +676,34 @@ void ElementDescriptor::readAlignAttr( OUString const & rPropName, OUString cons
}
}
//__________________________________________________________________________________________________
void ElementDescriptor::readButtonTypeAttr( OUString const & rPropName, OUString const & rAttrName )
{
if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
{
Any a( _xProps->getPropertyValue( rPropName ) );
if (a.getValueTypeClass() == TypeClass_SHORT)
{
switch (*(sal_Int16 const *)a.getValue())
{
case awt::PushButtonType_STANDARD:
addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("standard") ) );
break;
case awt::PushButtonType_OK:
addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("ok") ) );
break;
case awt::PushButtonType_CANCEL:
addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("cancel") ) );
break;
case awt::PushButtonType_HELP:
addAttribute( rAttrName, OUString( RTL_CONSTASCII_USTRINGPARAM("help") ) );
break;
default:
OSL_ENSURE( 0, "### illegal button-type value!" );
}
}
}
}
//__________________________________________________________________________________________________
void ElementDescriptor::readOrientationAttr( OUString const & rPropName, OUString const & rAttrName )
{
if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_impmodels.cxx,v $
*
* $Revision: 1.24 $
* $Revision: 1.25 $
*
* last change: $Author: dbo $ $Date: 2001-10-15 13:51:53 $
* last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -1528,6 +1528,9 @@ void ButtonElement::endElement()
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultButton") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("default") ),
_xAttributes );
ctx.importButtonTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("PushButtonType") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("button-type") ),
_xAttributes );
ctx.importEvents( _events );
}
......
......@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_import.cxx,v $
*
* $Revision: 1.20 $
* $Revision: 1.21 $
*
* last change: $Author: tbe $ $Date: 2001-09-28 14:56:15 $
* last change: $Author: dbo $ $Date: 2001-10-22 08:52:20 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
......@@ -77,6 +77,7 @@
#include <com/sun/star/awt/FontUnderline.hpp>
#include <com/sun/star/awt/FontWeight.hpp>
#include <com/sun/star/awt/FontWidth.hpp>
#include <com/sun/star/awt/PushButtonType.hpp>
#include <com/sun/star/script/XScriptEventsSupplier.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
......@@ -725,6 +726,43 @@ bool ImportContext::importAlignProperty(
return false;
}
//__________________________________________________________________________________________________
bool ImportContext::importButtonTypeProperty(
OUString const & rPropName, OUString const & rAttrName,
Reference< xml::sax2::XExtendedAttributes > const & xAttributes )
{
OUString buttonType( xAttributes->getValueByUidName( XMLNS_DIALOGS_UID, rAttrName ) );
if (buttonType.getLength())
{
sal_Int16 nButtonType;
if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("standard") ))
{
nButtonType = awt::PushButtonType_STANDARD;
}
else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("ok") ))
{
nButtonType = awt::PushButtonType_OK;
}
else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("cancel") ))
{
nButtonType = awt::PushButtonType_CANCEL;
}
else if (buttonType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("help") ))
{
nButtonType = awt::PushButtonType_HELP;
}
else
{
throw xml::sax::SAXException(
OUString( RTL_CONSTASCII_USTRINGPARAM("invalid button-type value!") ),
Reference< XInterface >(), Any() );
}
_xControlModel->setPropertyValue( rPropName, makeAny( nButtonType ) );
return true;
}
return false;
}
//__________________________________________________________________________________________________
bool ImportContext::importDateFormatProperty(
OUString const & rPropName, OUString const & rAttrName,
Reference< xml::sax2::XExtendedAttributes > const & xAttributes )
......
......@@ -25,7 +25,7 @@
<script:listener-event script:macro-name="ExecutingMacro" script:location="application" script:language="StarBasic" script:listener-type="com.sun.star.awt.XMouseListener" script:listener-method="mousePressed" script:listener-param="parameter0, so this will never ever be a script:event, but always a script:listener-event element!"/>
</button>
<button dlg:id="button3" ns:value="hallo2" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" xmlns:ns="http://openoffice.org/2000/dialog"/>
<button dlg:id="button3" ns:value="help button" dlg:left="250" ns:top="50" width="50" height="50" style-id="bla" button-type="help" xmlns:ns="http://openoffice.org/2000/dialog"/>
<checkbox id="check1" help-text="helphelphelp!!!" help-url="http://www.xml.org" value="checked" left="50" top="150" width="100" height="20" checked="true"/>
<checkbox id="check2" value="dontknow" left="50" top="170" width="100" height="20" tristate="true"/>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment