2001-02-16 13:14:51 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
|
|
|
* $RCSfile: exp_share.hxx,v $
|
|
|
|
*
|
2001-05-04 12:17:40 +00:00
|
|
|
* $Revision: 1.9 $
|
2001-02-16 13:14:51 +00:00
|
|
|
*
|
2001-05-04 12:17:40 +00:00
|
|
|
* last change: $Author: dbo $ $Date: 2001-05-04 13:17:40 $
|
2001-02-16 13:14:51 +00:00
|
|
|
*
|
|
|
|
* The Contents of this file are made available subject to the terms of
|
|
|
|
* either of the following licenses
|
|
|
|
*
|
|
|
|
* - GNU Lesser General Public License Version 2.1
|
|
|
|
* - Sun Industry Standards Source License Version 1.1
|
|
|
|
*
|
|
|
|
* Sun Microsystems Inc., October, 2000
|
|
|
|
*
|
|
|
|
* GNU Lesser General Public License Version 2.1
|
|
|
|
* =============================================
|
|
|
|
* Copyright 2000 by Sun Microsystems, Inc.
|
|
|
|
* 901 San Antonio Road, Palo Alto, CA 94303, USA
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License version 2.1, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This library 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 for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
|
|
|
* MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Sun Industry Standards Source License Version 1.1
|
|
|
|
* =================================================
|
|
|
|
* The contents of this file are subject to the Sun Industry Standards
|
|
|
|
* Source License Version 1.1 (the "License"); You may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of the
|
|
|
|
* License at http://www.openoffice.org/license.html.
|
|
|
|
*
|
|
|
|
* Software provided under this License is provided on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
|
|
|
* WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
|
|
|
* MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
|
|
|
* See the License for the specific provisions governing your rights and
|
|
|
|
* obligations concerning the Software.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* Copyright: 2000 by Sun Microsystems, Inc.
|
|
|
|
*
|
|
|
|
* All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s): _______________________________________
|
|
|
|
*
|
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#include <hash_map>
|
|
|
|
|
|
|
|
#include <xmlscript/xmldlg_imexp.hxx>
|
2001-03-15 13:44:15 +00:00
|
|
|
#include <xmlscript/xml_helper.hxx>
|
2001-02-16 13:14:51 +00:00
|
|
|
|
|
|
|
#include <osl/diagnose.h>
|
|
|
|
|
|
|
|
#include <com/sun/star/xml/sax/XAttributeList.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertySet.hpp>
|
|
|
|
#include <com/sun/star/beans/XPropertyState.hpp>
|
|
|
|
#include <com/sun/star/awt/FontDescriptor.hpp>
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::std;
|
|
|
|
using namespace ::com::sun::star;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
|
|
|
|
namespace xmlscript
|
|
|
|
{
|
|
|
|
|
|
|
|
struct Style
|
|
|
|
{
|
|
|
|
sal_uInt32 _backgroundColor;
|
|
|
|
sal_uInt32 _textColor;
|
|
|
|
sal_Int16 _border;
|
|
|
|
awt::FontDescriptor _descr;
|
2001-05-04 12:17:40 +00:00
|
|
|
sal_uInt32 _fillColor;
|
|
|
|
|
2001-02-21 19:49:30 +00:00
|
|
|
short _all;
|
2001-02-16 13:14:51 +00:00
|
|
|
short _set;
|
|
|
|
|
|
|
|
OUString _id;
|
|
|
|
|
2001-03-15 13:44:15 +00:00
|
|
|
inline Style( short all_ ) SAL_THROW( () )
|
2001-02-21 19:49:30 +00:00
|
|
|
: _all( all_ )
|
|
|
|
, _set( 0 )
|
2001-02-16 13:14:51 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
Reference< xml::sax::XAttributeList > createElement();
|
|
|
|
};
|
|
|
|
class StyleBag
|
|
|
|
{
|
|
|
|
vector< Style * > _styles;
|
2001-03-15 13:44:15 +00:00
|
|
|
|
2001-02-16 13:14:51 +00:00
|
|
|
public:
|
2001-03-14 15:39:59 +00:00
|
|
|
~StyleBag() SAL_THROW( () );
|
2001-02-16 13:14:51 +00:00
|
|
|
|
2001-03-14 15:39:59 +00:00
|
|
|
OUString getStyleId( Style const & rStyle ) SAL_THROW( () );
|
2001-02-16 13:14:51 +00:00
|
|
|
|
|
|
|
void dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOut );
|
|
|
|
};
|
|
|
|
|
|
|
|
class ElementDescriptor
|
2001-03-15 13:44:15 +00:00
|
|
|
: public ::xmlscript::XMLElement
|
2001-02-16 13:14:51 +00:00
|
|
|
{
|
|
|
|
Reference< beans::XPropertySet > _xProps;
|
|
|
|
Reference< beans::XPropertyState > _xPropState;
|
|
|
|
|
|
|
|
public:
|
|
|
|
inline ElementDescriptor(
|
|
|
|
Reference< beans::XPropertySet > const & xProps,
|
|
|
|
Reference< beans::XPropertyState > const & xPropState,
|
|
|
|
OUString const & name )
|
2001-03-14 15:39:59 +00:00
|
|
|
SAL_THROW( () )
|
2001-03-15 13:44:15 +00:00
|
|
|
: XMLElement( name )
|
|
|
|
, _xProps( xProps )
|
2001-02-16 13:14:51 +00:00
|
|
|
, _xPropState( xPropState )
|
|
|
|
{}
|
|
|
|
inline ElementDescriptor(
|
|
|
|
OUString const & name )
|
2001-03-14 15:39:59 +00:00
|
|
|
SAL_THROW( () )
|
2001-03-15 13:44:15 +00:00
|
|
|
: XMLElement( name )
|
2001-02-16 13:14:51 +00:00
|
|
|
{}
|
2001-03-15 13:44:15 +00:00
|
|
|
|
2001-02-16 13:14:51 +00:00
|
|
|
//
|
|
|
|
Any readProp( OUString const & rPropName );
|
|
|
|
//
|
|
|
|
void readDefaults();
|
|
|
|
//
|
|
|
|
void readStringAttr( OUString const & rPropName, OUString const & rAttrName );
|
2001-02-21 19:49:30 +00:00
|
|
|
void readDoubleAttr( OUString const & rPropName, OUString const & rAttrName );
|
2001-02-16 13:14:51 +00:00
|
|
|
void readLongAttr( OUString const & rPropName, OUString const & rAttrName );
|
|
|
|
void readHexLongAttr( OUString const & rPropName, OUString const & rAttrName );
|
|
|
|
void readShortAttr( OUString const & rPropName, OUString const & rAttrName );
|
|
|
|
void readBoolAttr( OUString const & rPropName, OUString const & rAttrName );
|
2001-02-20 13:05:25 +00:00
|
|
|
void readAlignAttr( OUString const & rPropName, OUString const & rAttrName );
|
2001-02-21 19:49:30 +00:00
|
|
|
void readDateFormatAttr( OUString const & rPropName, OUString const & rAttrName );
|
|
|
|
void readTimeFormatAttr( OUString const & rPropName, OUString const & rAttrName );
|
2001-05-04 12:17:40 +00:00
|
|
|
void readOrientationAttr( OUString const & rPropName, OUString const & rAttrName );
|
2001-02-16 13:14:51 +00:00
|
|
|
//
|
2001-03-14 15:39:59 +00:00
|
|
|
inline void addBoolAttr( OUString const & rAttrName, sal_Bool bValue ) SAL_THROW( () );
|
2001-02-16 13:14:51 +00:00
|
|
|
|
2001-02-20 15:51:32 +00:00
|
|
|
//
|
2001-03-14 15:39:59 +00:00
|
|
|
void readEvents() SAL_THROW( (Exception) );
|
2001-02-16 13:14:51 +00:00
|
|
|
//
|
2001-04-04 13:35:09 +00:00
|
|
|
void readDialogModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
2001-03-14 15:39:59 +00:00
|
|
|
void readButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readEditModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readCheckBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readRadioButtonModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readComboBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readCurrencyFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readDateFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readFileControlModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readFixedTextModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readGroupBoxModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readImageControlModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
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 readTimeFieldModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
2001-05-04 08:14:58 +00:00
|
|
|
void readFixedLineModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readProgressBarModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
|
|
|
void readScrollBarModel( StyleBag * all_styles ) SAL_THROW( (Exception) );
|
2001-02-16 13:14:51 +00:00
|
|
|
};
|
|
|
|
//__________________________________________________________________________________________________
|
|
|
|
inline void ElementDescriptor::addBoolAttr( OUString const & rAttrName, sal_Bool bValue )
|
2001-03-14 15:39:59 +00:00
|
|
|
SAL_THROW( () )
|
2001-02-16 13:14:51 +00:00
|
|
|
{
|
2001-03-15 13:44:15 +00:00
|
|
|
addAttribute( rAttrName,
|
|
|
|
(bValue
|
|
|
|
? OUString( RTL_CONSTASCII_USTRINGPARAM("true") )
|
|
|
|
: OUString( RTL_CONSTASCII_USTRINGPARAM("false") )) );
|
2001-02-16 13:14:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//##################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
};
|