summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmlscript/dtd/dialog.dtd48
-rw-r--r--xmlscript/inc/xmlscript/xmldlg_imexp.hxx16
-rw-r--r--xmlscript/source/xmldlg_imexp/exp_share.hxx8
-rw-r--r--xmlscript/source/xmldlg_imexp/imp_share.hxx42
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx24
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx84
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx46
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx186
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx9
-rw-r--r--xmlscript/test/imexp.cxx130
-rw-r--r--xmlscript/test/makefile.mk16
-rw-r--r--xmlscript/test/test.xml5
12 files changed, 477 insertions, 137 deletions
diff --git a/xmlscript/dtd/dialog.dtd b/xmlscript/dtd/dialog.dtd
index 01aa6f0d1fcf..e7431af6d400 100644
--- a/xmlscript/dtd/dialog.dtd
+++ b/xmlscript/dtd/dialog.dtd
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
- $Id: dialog.dtd,v 1.17 2001-08-16 14:11:24 dbo Exp $
+ $Id: dialog.dtd,v 1.18 2001-09-19 08:46:32 dbo Exp $
The Contents of this file are made available subject to the terms of
either of the following licenses
@@ -73,9 +73,9 @@
">
<!ENTITY % event "(script:event|
- script:listener-event|
- dlg:event
- )">
+ script:listener-event|
+ dlg:event
+ )">
<!ENTITY % control "(dlg:bulletinboard|
dlg:button|
@@ -93,6 +93,7 @@
dlg:numericfield|
dlg:currencyfield|
dlg:patternfield|
+ dlg:formattedfield|
dlg:fixedline|
dlg:progressmeter|
dlg:scrollbar
@@ -142,18 +143,18 @@
<!ELEMENT script:event EMPTY>
<!ATTLIST script:event script:location CDATA #IMPLIED
- script:language CDATA #REQUIRED
- script:macro-name CDATA #REQUIRED
+ script:language CDATA #REQUIRED
+ script:macro-name CDATA #REQUIRED
script:event-name CDATA #REQUIRED
- >
+ >
<!ELEMENT script:listener-event EMPTY>
<!ATTLIST script:listener-event script:location CDATA #IMPLIED
- script:language CDATA #REQUIRED
- script:macro-name CDATA #REQUIRED
- script:listener-type CDATA #REQUIRED
- script:listener-method CDATA #REQUIRED
- script:listener-param CDATA #IMPLIED
- >
+ script:language CDATA #REQUIRED
+ script:macro-name CDATA #REQUIRED
+ script:listener-type CDATA #REQUIRED
+ script:listener-method CDATA #REQUIRED
+ script:listener-param CDATA #IMPLIED
+ >
<!-- deprecated -->
<!ELEMENT dlg:event EMPTY>
<!ATTLIST dlg:event dlg:listener-type CDATA #REQUIRED
@@ -227,7 +228,7 @@
<!ELEMENT dlg:text ((%event;)*)>
<!ATTLIST dlg:text %default-attributes;
- dlg:align (left|center|right|none) #IMPLIED
+ dlg:align (left|center|right) #IMPLIED
dlg:multiline %boolean; #IMPLIED
dlg:value CDATA #IMPLIED
>
@@ -235,7 +236,7 @@
<!ELEMENT dlg:textfield ((%event;)*)>
<!ATTLIST dlg:textfield %default-attributes;
dlg:tabstop %boolean; #IMPLIED
- dlg:align (left|center|right|none) #IMPLIED
+ dlg:align (left|center|right) #IMPLIED
dlg:readonly %boolean; #IMPLIED
dlg:echochar CDATA #IMPLIED
dlg:hard-linebreaks %boolean; #IMPLIED
@@ -320,6 +321,23 @@
dlg:literal-mask CDATA #IMPLIED
>
+<!ELEMENT dlg:formattedfield ((%event;)*)>
+<!ATTLIST dlg:formattedfield %default-attributes;
+ dlg:tabstop %boolean; #IMPLIED
+ dlg:readonly %boolean; #IMPLIED
+ dlg:align (left|center|right) #IMPLIED
+ dlg:format-code CDATA #REQUIRED
+ dlg:format-locale CDATA #REQUIRED
+ dlg:strict-format %boolean; #IMPLIED
+ dlg:value-default CDATA #IMPLIED
+ dlg:value-max %numeric; #IMPLIED
+ dlg:value-min %numeric; #IMPLIED
+ dlg:value %numeric; #IMPLIED
+ dlg:maxlength %numeric; #IMPLIED
+ dlg:spin %boolean; #IMPLIED
+ dlg:text CDATA #IMPLIED
+ >
+
<!ELEMENT dlg:fixedline ((%event;)*)>
<!ATTLIST dlg:fixedline %default-attributes;
dlg:align (horizontal|vertical) #IMPLIED
diff --git a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
index c3bab32c2b4e..e5053e1b54eb 100644
--- a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
+++ b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_imexp.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: dbo $ $Date: 2001-08-07 10:55:46 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:32 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -70,6 +70,9 @@
#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HXX_
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#endif
+#ifndef _COM_SUN_STAR_UNO_XCOMPONENTCONTEXT_HXX_
+#include <com/sun/star/uno/XComponentContext.hpp>
+#endif
#ifndef _XMLSCRIPT_XMLNS_H_
#include <xmlscript/xmlns.h>
@@ -87,7 +90,8 @@ void SAL_CALL exportDialogModel(
//==================================================================================================
::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler >
SAL_CALL importDialogModel(
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel )
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext )
SAL_THROW( (::com::sun::star::uno::Exception) );
// additional functions for convenience
@@ -95,12 +99,14 @@ SAL_CALL importDialogModel(
//==================================================================================================
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >
SAL_CALL exportDialogModel(
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel )
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext )
SAL_THROW( (::com::sun::star::uno::Exception) );
//==================================================================================================
void SAL_CALL importDialogModel(
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInput,
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel )
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > const & xDialogModel,
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext )
SAL_THROW( (::com::sun::star::uno::Exception) );
};
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index 2f5d6e473a39..ba8b64bd3e9a 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: exp_share.hxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: dbo $ $Date: 2001-08-24 11:16:39 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -150,6 +150,9 @@ public:
void readOrientationAttr( OUString const & rPropName, OUString const & rAttrName );
//
inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ) SAL_THROW( () );
+ void addNumberFormatAttr(
+ Reference< beans::XPropertySet > const & xFormatProperties,
+ OUString const & rAttrName );
//
void readEvents() SAL_THROW( (Exception) );
@@ -169,6 +172,7 @@ public:
void readListBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
void readNumericFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
void readPatternFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
+ void readFormattedFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
void readTimeFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
void readFixedLineModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
void readProgressBarModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index e71dc14c9d1a..a8bdf09b7a93 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: imp_share.hxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: dbo $ $Date: 2001-08-24 11:16:40 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,7 +66,10 @@
#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -156,6 +159,8 @@ struct DialogImport
{
friend class ImportContext;
+ Reference< XComponentContext > _xContext;
+
vector< OUString > _styleNames;
vector< Reference< xml::XImportContext > > _styles;
@@ -163,6 +168,7 @@ struct DialogImport
Reference< lang::XMultiServiceFactory > _xDialogModelFactory;
public:
+
void addStyle(
OUString const & rStyleId,
Reference< xml::XImportContext > const & xStyle )
@@ -171,11 +177,17 @@ public:
OUString const & rStyleId ) const
SAL_THROW( () );
- inline DialogImport( Reference< container::XNameContainer > const & xDialogModel )
+ inline Reference< XComponentContext > getComponentContext() SAL_THROW( () )
+ { return _xContext; }
+
+ inline DialogImport(
+ Reference< XComponentContext > const & xContext,
+ Reference< container::XNameContainer > const & xDialogModel )
SAL_THROW( () )
- : _xDialogModel( xDialogModel )
+ : _xContext( xContext )
+ , _xDialogModel( xDialogModel )
, _xDialogModelFactory( xDialogModel, UNO_QUERY )
- { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() ); }
+ { OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() && _xContext.is() ); }
virtual ~DialogImport()
SAL_THROW( () );
@@ -792,6 +804,26 @@ public:
{}
};
//==================================================================================================
+class FormattedFieldElement
+ : public ControlElement
+{
+public:
+ virtual Reference< xml::XImportContext > SAL_CALL createChildContext(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::sax2::XExtendedAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (xml::sax::SAXException, RuntimeException);
+
+ inline FormattedFieldElement(
+ OUString const & rLocalName,
+ Reference< xml::sax2::XExtendedAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+//==================================================================================================
class FixedLineElement
: public ControlElement
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
index 1d114bd611f6..0498395f4600 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_addfunc.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dbo $ $Date: 2001-03-28 10:50:36 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -100,10 +100,11 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream()
//==================================================================================================
Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
- Reference< container::XNameContainer > const & xDialogModel )
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< XComponentContext > const & xContext )
SAL_THROW( (Exception) )
{
- Reference< lang::XMultiServiceFactory > xSMgr( ::comphelper::getProcessServiceFactory() );
+ Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
if (! xSMgr.is())
{
throw RuntimeException(
@@ -111,8 +112,8 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
Reference< XInterface >() );
}
- Reference< xml::sax::XExtendedDocumentHandler > xHandler( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ) ), UNO_QUERY );
+ Reference< xml::sax::XExtendedDocumentHandler > xHandler( xSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Writer") ), xContext ), UNO_QUERY );
OSL_ASSERT( xHandler.is() );
if (! xHandler.is())
{
@@ -133,10 +134,11 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
//==================================================================================================
void SAL_CALL importDialogModel(
Reference< io::XInputStream > xInput,
- Reference< container::XNameContainer > const & xDialogModel )
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< XComponentContext > const & xContext )
SAL_THROW( (Exception) )
{
- Reference< lang::XMultiServiceFactory > xSMgr( ::comphelper::getProcessServiceFactory() );
+ Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
if (! xSMgr.is())
{
throw RuntimeException(
@@ -144,8 +146,8 @@ void SAL_CALL importDialogModel(
Reference< XInterface >() );
}
- Reference< xml::sax::XParser > xParser( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ) ), UNO_QUERY );
+ Reference< xml::sax::XParser > xParser( xSMgr->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.sax.Parser") ), xContext ), UNO_QUERY );
OSL_ASSERT( xParser.is() );
if (! xParser.is())
{
@@ -155,7 +157,7 @@ void SAL_CALL importDialogModel(
}
// error handler, entity resolver omitted for this helper function
- xParser->setDocumentHandler( importDialogModel( xDialogModel ) );
+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
xml::sax::InputSource source;
source.aInputStream = xInput;
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index f5a2c779f963..93e244d6a91e 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_expmodels.cxx,v $
*
- * $Revision: 1.14 $
+ * $Revision: 1.15 $
*
- * last change: $Author: dbo $ $Date: 2001-08-24 11:16:40 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -60,6 +60,9 @@
************************************************************************/
#include "exp_share.hxx"
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+
namespace xmlscript
{
@@ -172,8 +175,8 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Dropdown") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
@@ -409,8 +412,8 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":hscroll") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("VScroll") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":vscroll") ) );
- readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
@@ -683,6 +686,75 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
+void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x2 | 0x4 | 0x8 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Border") ) ) >>= aStyle._border)
+ aStyle._set |= 0x4;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FontDescriptor") ) ) >>= aStyle._descr)
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":text") ) );
+ readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
+
+ Any a( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ) ) );
+ switch (a.getValueTypeClass())
+ {
+ case TypeClass_DOUBLE:
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
+ OUString::valueOf( *(double const *)a.getValue() ) );
+ break;
+ case TypeClass_STRING:
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-default") ),
+ *(OUString const *)a.getValue() );
+ break;
+ }
+ readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+ readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+
+ // format spec
+ sal_Int32 nKey;
+ Reference< util::XNumberFormatsSupplier > xSupplier;
+ OSL_VERIFY( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ) ) >>= nKey );
+ OSL_VERIFY( _xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ) ) >>= xSupplier );
+ addNumberFormatAttr(
+ xSupplier->getNumberFormats()->getByKey( nKey ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+
+ readEvents();
+}
+//__________________________________________________________________________________________________
void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 43bec4363167..c0faa9aa48e0 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_export.cxx,v $
*
- * $Revision: 1.24 $
+ * $Revision: 1.25 $
*
- * last change: $Author: dbo $ $Date: 2001-08-24 11:16:40 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,6 +76,8 @@
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/Locale.hpp>
+#include <com/sun/star/util/NumberFormat.hpp>
namespace xmlscript
@@ -449,6 +451,38 @@ Reference< xml::sax::XAttributeList > Style::createElement()
//##################################################################################################
//__________________________________________________________________________________________________
+void ElementDescriptor::addNumberFormatAttr(
+ Reference< beans::XPropertySet > const & xFormatProperties,
+ OUString const & rAttrName )
+{
+ Reference< beans::XPropertyState > xState( xFormatProperties, UNO_QUERY );
+ OUString sFormat;
+ lang::Locale locale;
+ OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatString") ) ) >>= sFormat );
+ OSL_VERIFY( xFormatProperties->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Locale") ) ) >>= locale );
+
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-code") ),
+ sFormat );
+
+ // format-locale
+ OUStringBuffer buf( 48 );
+ buf.append( locale.Language );
+ if (locale.Country.getLength())
+ {
+ buf.append( (sal_Unicode)';' );
+ buf.append( locale.Country );
+ if (locale.Variant.getLength())
+ {
+ buf.append( (sal_Unicode)';' );
+ buf.append( locale.Variant );
+ }
+ }
+ addAttribute(
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":format-locale") ),
+ buf.makeStringAndClear() );
+}
+//__________________________________________________________________________________________________
Any ElementDescriptor::readProp( OUString const & rPropName )
{
if (beans::PropertyState_DEFAULT_VALUE != _xPropState->getPropertyState( rPropName ))
@@ -1146,6 +1180,14 @@ void SAL_CALL exportDialogModel(
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
pElem->readPatternFieldModel( &all_styles );
}
+ else if (rControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ))
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":formattedfield") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readFormattedFieldModel( &all_styles );
+ }
else if (rControlType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ))
{
pElem = new ElementDescriptor(
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index 0638024d3b82..773d114986fa 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_impmodels.cxx,v $
*
- * $Revision: 1.20 $
+ * $Revision: 1.21 $
*
- * last change: $Author: dbo $ $Date: 2001-08-24 11:16:40 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -61,6 +61,7 @@
#include "imp_share.hxx"
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/util/XNumberFormatter.hpp>
using namespace ::rtl;
@@ -301,6 +302,172 @@ void PatternFieldElement::endElement()
//##################################################################################################
+// formattedfield
+//__________________________________________________________________________________________________
+Reference< xml::XImportContext > FormattedFieldElement::createChildContext(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::sax2::XExtendedAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void FormattedFieldElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) );
+
+ Reference< xml::XImportContext > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importBorderStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ }
+
+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("strict-format") ),
+ _xAttributes );
+ ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-min") ),
+ _xAttributes );
+ ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
+ _xAttributes );
+ ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
+ _xAttributes );
+ ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxlength") ),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("spin") ),
+ _xAttributes );
+
+ OUString sDefault( _xAttributes->getValueByUidName(
+ XMLNS_DIALOGS_UID, OUString( RTL_CONSTASCII_USTRINGPARAM("value-default") ) ) );
+ if (sDefault.getLength())
+ {
+ double d = sDefault.toDouble();
+ if (d != 0.0 ||
+ sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0") ) ||
+ sDefault.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("0.0") ))
+ {
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
+ makeAny( d ) );
+ }
+ else // treat as string
+ {
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ),
+ makeAny( sDefault ) );
+ }
+ }
+
+ // format spec
+ try
+ {
+ OUString sFormat( _xAttributes->getValueByUidName(
+ XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("format-code") ) ) );
+ if (! sFormat.getLength())
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("missing format-code attribute!") ),
+ Reference< XInterface >(), Any() );
+ }
+ OUString sLocale( _xAttributes->getValueByUidName(
+ XMLNS_DIALOGS_UID,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("format-locale") ) ) );
+ if (! sLocale.getLength())
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("missing format-locale attribute!") ),
+ Reference< XInterface >(), Any() );
+ }
+
+ // split locale
+ lang::Locale locale;
+ sal_Int32 semi0 = sLocale.indexOf( ';' );
+ if (semi0 < 0) // no semi at all, just try language
+ {
+ locale.Language = sLocale;
+ }
+ else
+ {
+ sal_Int32 semi1 = sLocale.indexOf( ';', semi0 +1 );
+ if (semi1 > semi0) // language;country;variant
+ {
+ locale.Language = sLocale.copy( 0, semi0 );
+ locale.Country = sLocale.copy( semi0 +1, semi1 - semi0 -1 );
+ locale.Variant = sLocale.copy( semi1 +1 );
+ }
+ else // try language;country
+ {
+ locale.Language = sLocale.copy( 0, semi0 );
+ locale.Country = sLocale.copy( semi0 +1 );
+ }
+ }
+
+ Reference< XComponentContext > xContext( _pImport->getComponentContext() );
+// Reference< util::XNumberFormatter > xFormatter( xContext->getServiceManager()->createInstanceWithContext(
+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatter") ), xContext ), UNO_QUERY );
+// OSL_ASSERT( xFormatter.is() );
+// Reference< util::XNumberFormatsSupplier > xSupplier( xFormatter->getNumberFormatsSupplier() );
+ Reference< util::XNumberFormatsSupplier > xSupplier( xContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.util.NumberFormatsSupplier") ), xContext ), UNO_QUERY );
+
+ Reference< util::XNumberFormats > xFormats( xSupplier->getNumberFormats() );
+ sal_Int32 nKey = xFormats->addNew( sFormat, locale );
+
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
+ makeAny( xSupplier ) );
+ ctx.getControlModel()->setPropertyValue(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ),
+ makeAny( nKey ) );
+ }
+ catch (util::MalformedNumberFormatException & exc)
+ {
+ OSL_ENSURE( 0, "### util::MalformedNumberFormatException occured!" );
+ // rethrow
+ throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
+ }
+
+ ctx.importEvents( _events );
+}
+
+//##################################################################################################
+
// timefield
//__________________________________________________________________________________________________
Reference< xml::XImportContext > TimeFieldElement::createChildContext(
@@ -1443,31 +1610,36 @@ Reference< xml::XImportContext > BulletinBoardElement::createChildContext(
{
return new FileControlElement( rLocalName, xAttributes, this, _pImport );
}
- // currency-field
+ // currencyfield
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("currencyfield") ))
{
return new CurrencyFieldElement( rLocalName, xAttributes, this, _pImport );
}
- // date-field
+ // datefield
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("datefield") ))
{
return new DateFieldElement( rLocalName, xAttributes, this, _pImport );
}
- // date-field
+ // datefield
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("numericfield") ))
{
return new NumericFieldElement( rLocalName, xAttributes, this, _pImport );
}
- // time-field
+ // timefield
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("timefield") ))
{
return new TimeFieldElement( rLocalName, xAttributes, this, _pImport );
}
- // pattern-field
+ // patternfield
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("patternfield") ))
{
return new PatternFieldElement( rLocalName, xAttributes, this, _pImport );
}
+ // formattedfield
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("formattedfield") ))
+ {
+ return new FormattedFieldElement( rLocalName, xAttributes, this, _pImport );
+ }
// fixedline
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("fixedline") ))
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index 743564f63e58..2f843c64d5c4 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: xmldlg_import.cxx,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: dbo $ $Date: 2001-08-24 11:16:40 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:33 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1301,7 +1301,8 @@ Reference< xml::XImportContext > DialogImport::getStyle(
//==================================================================================================
Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
- Reference< container::XNameContainer > const & xDialogModel )
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< XComponentContext > const & xContext )
SAL_THROW( (Exception) )
{
NameSpaceUid arNamespaceUids[] = {
@@ -1316,7 +1317,7 @@ Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
return ::xmlscript::createDocumentHandler(
arNamespaceUids, sizeof(arNamespaceUids) / sizeof(NameSpaceUid),
-1 /* unknown namespace id */,
- static_cast< xml::XImporter * >( new DialogImport( xDialogModel ) ) );
+ static_cast< xml::XImporter * >( new DialogImport( xContext, xDialogModel ) ) );
}
}
diff --git a/xmlscript/test/imexp.cxx b/xmlscript/test/imexp.cxx
index e1c056786659..985534ecb5d5 100644
--- a/xmlscript/test/imexp.cxx
+++ b/xmlscript/test/imexp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: imexp.cxx,v $
*
- * $Revision: 1.13 $
+ * $Revision: 1.14 $
*
- * last change: $Author: dbo $ $Date: 2001-08-07 10:55:47 $
+ * last change: $Author: dbo $ $Date: 2001-09-19 08:46:35 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,6 +62,8 @@
#include <stdio.h>
#include <rtl/memory.h>
+#include <rtl/ustrbuf.hxx>
+
#include <xmlscript/xmldlg_imexp.hxx>
#include <xmlscript/xml_helper.hxx>
@@ -99,7 +101,40 @@ using namespace ::com::sun::star::uno;
-Reference< lang::XMultiServiceFactory > createApplicationServiceManager()
+static void reg(
+ Reference< registry::XImplementationRegistration > const & xReg,
+ char const * lib,
+ bool upd = false )
+{
+ OUStringBuffer buf( 32 );
+#ifndef SAL_W32
+ buf.appendAsciiL( RTL_CONSTASCII_STRINGPARAM("lib") );
+#endif
+ buf.appendAscii( lib );
+
+ if (upd)
+ {
+ buf.append( (sal_Int32)SUPD );
+#ifdef SAL_W32
+ buf.appendAscii( "mi" );
+#endif
+#ifdef SOLARIS
+ buf.appendAscii( "ss" );
+#else
+ buf.appendAscii( "li" );
+#endif
+ }
+#ifndef SAL_W32
+ buf.appendAscii( ".so" );
+#endif
+
+ xReg->registerImplementation(
+ OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
+ buf.makeStringAndClear(), Reference< registry::XSimpleRegistry >() );
+}
+
+
+Reference< XComponentContext > createInitialComponentContext()
{
Reference< XComponentContext > xContext;
@@ -154,50 +189,10 @@ Reference< lang::XMultiServiceFactory > createApplicationServiceManager()
xContext->getServiceManager()->createInstanceWithContext(
OUString::createFromAscii( "com.sun.star.registry.ImplementationRegistration" ), xContext ), UNO_QUERY );
-#ifdef SAL_W32
- OUString aDllName = OUString::createFromAscii( "sax.dll" );
-#else
- OUString aDllName = OUString::createFromAscii( "libsax.so" );
-#endif
- xReg->registerImplementation(
- OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
- aDllName, Reference< registry::XSimpleRegistry > () );
-#ifdef SAL_W32
- aDllName = OUString::createFromAscii( "tk" );
- aDllName += OUString::valueOf( (sal_Int32)SUPD );
- aDllName += OUString::createFromAscii( "mi.dll" );
-#else
- aDllName = OUString::createFromAscii( "libtk" );
- aDllName += OUString::valueOf( (sal_Int32)SUPD );
- aDllName += OUString::createFromAscii( ".so" );
-#endif
- xReg->registerImplementation(
- OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
- aDllName, Reference< registry::XSimpleRegistry > () );
-#ifdef SAL_W32
- aDllName = OUString::createFromAscii( "svt" );
- aDllName += OUString::valueOf( (sal_Int32)SUPD );
- aDllName += OUString::createFromAscii( "mi.dll" );
-#else
- aDllName = OUString::createFromAscii( "libsvt" );
- aDllName += OUString::valueOf( (sal_Int32)SUPD );
- aDllName += OUString::createFromAscii( ".so" );
-#endif
- xReg->registerImplementation(
- OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
- aDllName, Reference< registry::XSimpleRegistry > () );
-#ifdef SAL_W32
- aDllName = OUString::createFromAscii( "i18n" );
- aDllName += OUString::valueOf( (sal_Int32)SUPD );
- aDllName += OUString::createFromAscii( "mi.dll" );
-#else
- aDllName = OUString::createFromAscii( "libi18n" );
- aDllName += OUString::valueOf( (sal_Int32)SUPD );
- aDllName += OUString::createFromAscii( ".so" );
-#endif
- xReg->registerImplementation(
- OUString::createFromAscii( "com.sun.star.loader.SharedLibrary" ),
- aDllName, Reference< registry::XSimpleRegistry > () );
+ reg( xReg, "sax" );
+ reg( xReg, "tk", true );
+ reg( xReg, "svt", true );
+ reg( xReg, "i18n", true );
}
}
@@ -207,14 +202,15 @@ Reference< lang::XMultiServiceFactory > createApplicationServiceManager()
OSL_ENSURE( 0, aStr.getStr() );
}
- return Reference< lang::XMultiServiceFactory >( xContext->getServiceManager(), UNO_QUERY );
+ return xContext;
}
// -----------------------------------------------------------------------
Reference< container::XNameContainer > importFile(
- char const * fname )
+ char const * fname,
+ Reference< XComponentContext > const & xContext )
{
// create the input stream
FILE *f = ::fopen( fname, "rb" );
@@ -228,10 +224,9 @@ Reference< container::XNameContainer > importFile(
::fread( bytes.getArray(), nLength, 1, f );
::fclose( f );
- Reference< lang::XMultiServiceFactory > xSMgr( ::comphelper::getProcessServiceFactory() );
- Reference< container::XNameContainer > xModel( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
- ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), xModel );
+ Reference< container::XNameContainer > xModel( xContext->getServiceManager()->createInstanceWithContext(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ), xContext ), UNO_QUERY );
+ ::xmlscript::importDialogModel( ::xmlscript::createInputStream( bytes ), xModel, xContext );
return xModel;
}
@@ -244,9 +239,10 @@ Reference< container::XNameContainer > importFile(
void exportToFile(
char const * fname,
- Reference< container::XNameContainer > const & xModel )
+ Reference< container::XNameContainer > const & xModel,
+ Reference< XComponentContext > const & xContext )
{
- Reference< io::XInputStreamProvider > xProvider( ::xmlscript::exportDialogModel( xModel ) );
+ Reference< io::XInputStreamProvider > xProvider( ::xmlscript::exportDialogModel( xModel, xContext ) );
Reference< io::XInputStream > xStream( xProvider->createInputStream() );
Sequence< sal_Int8 > bytes;
@@ -290,7 +286,8 @@ void MyApp::Main()
return;
}
- Reference< lang::XMultiServiceFactory > xMSF = createApplicationServiceManager();
+ Reference< XComponentContext > xContext( createInitialComponentContext() );
+ Reference< lang::XMultiServiceFactory > xMSF( xContext->getServiceManager(), UNO_QUERY );
try
{
@@ -301,7 +298,7 @@ void MyApp::Main()
// import dialogs
OString aParam1( OUStringToOString( OUString( GetCommandLineParam( 0 ) ), RTL_TEXTENCODING_ASCII_US ) );
- Reference< container::XNameContainer > xModel( importFile( aParam1.getStr() ) );
+ Reference< container::XNameContainer > xModel( importFile( aParam1.getStr(), xContext ) );
OSL_ASSERT( xModel.is() );
Reference< awt::XControl > xDlg( xMSF->createInstance(
@@ -315,7 +312,7 @@ void MyApp::Main()
{
// write modified dialogs
OString aParam2( OUStringToOString( OUString( GetCommandLineParam( 1 ) ), RTL_TEXTENCODING_ASCII_US ) );
- exportToFile( aParam2.getStr(), xModel );
+ exportToFile( aParam2.getStr(), xModel, xContext );
}
}
catch (xml::sax::SAXException & rExc)
@@ -335,21 +332,10 @@ void MyApp::Main()
OSL_ENSURE( 0, aStr.getStr() );
}
- // dispose component context
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- if (xProps.is())
+ Reference< lang::XComponent > xComp( xContext, UNO_QUERY );
+ if (xComp.is())
{
- try
- {
- Reference< lang::XComponent > xComp;
- if (xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xComp)
- {
- xComp->dispose();
- }
- }
- catch (beans::UnknownPropertyException &)
- {
- }
+ xComp->dispose();
}
}
diff --git a/xmlscript/test/makefile.mk b/xmlscript/test/makefile.mk
index 00efcebf8cbd..42a37ae55129 100644
--- a/xmlscript/test/makefile.mk
+++ b/xmlscript/test/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.3 $
+# $Revision: 1.4 $
#
-# last change: $Author: dbo $ $Date: 2001-03-06 09:39:55 $
+# last change: $Author: dbo $ $Date: 2001-09-19 08:46:35 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -109,13 +109,13 @@ APP1DEF= $(MISC)$/imexp.def
$(MISC)$/imexp.def: makefile.mk
echo NAME imexp >$@
- echo DESCRIPTION 'XML dialogs im-/ exporter' >>$@
+ echo DESCRIPTION 'XML dialog im-/ exporter' >>$@
echo EXETYPE WINDOWS >>$@
- echo STUB 'winSTUB.EXE' >>$@
+ echo STUB 'winSTUB.EXE' >>$@
echo PROTMODE >>$@
- echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
- echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
- echo HEAPSIZE 8192 >>$@
- echo STACKSIZE 32768 >>$@
+ echo CODE PRELOAD MOVEABLE DISCARDABLE >>$@
+ echo DATA PRELOAD MOVEABLE MULTIPLE >>$@
+ echo HEAPSIZE 8192 >>$@
+ echo STACKSIZE 32768 >>$@
.ENDIF
diff --git a/xmlscript/test/test.xml b/xmlscript/test/test.xml
index fd5ce8350c51..29bfd306cd6f 100644
--- a/xmlscript/test/test.xml
+++ b/xmlscript/test/test.xml
@@ -93,6 +93,11 @@
<fixedline style-id="bla3" id="fixedline1" left="20" top="660" width="150" height="20" value="FixedLineLabel" align="horizontal"/>
<progressmeter style-id="no_border" id="progress1" left="200" top="660" width="80" height="20" align="horizontal" value="50" value-min="0" value-max="80"/>
<scrollbar style-id="dialog" id="scrollbar1" left="300" top="660" width="80" height="20" align="horizontal" curpos="50" maxpos="200" increment="1" pageincrement="10"/>
+
+ <formattedfield style-id="dialog" id="ffield0" left="20" top="110" width="80" height="20" align="center" text="first ffield"
+ dlg:format-code="[$$-409]#.##0,00;[ROT]-[$$-409]#.##0,00" dlg:format-locale="de" dlg:value-max="750" dlg:value-min="0" dlg:value="2" spin="true"/>
+ <formattedfield style-id="dialog" id="ffield1" left="250" top="110" width="80" height="20" align="center" text="second ffield"
+ dlg:format-code="[$$-409]#.##0,00;[ROT]-[$$-409]#.##0,00" dlg:format-locale="de;DE;WIN" dlg:value-max="750" dlg:value-min="0" dlg:value="4" spin="true"/>
</dlg:bulletinboard>
</window>