summaryrefslogtreecommitdiff
path: root/xmloff/source/style
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
commitfd069bee7e57ad529c3c0974559fd2d84ec3151a (patch)
treeef2eddeefb786feaf966d6a1c0c291872c0ae420 /xmloff/source/style
parent04c1c754ab9d0ad07f2c5362d46597d13efe75c2 (diff)
initial import
Diffstat (limited to 'xmloff/source/style')
-rw-r--r--xmloff/source/style/DashStyle.cxx367
-rw-r--r--xmloff/source/style/EnumPropertyHdl.cxx146
-rw-r--r--xmloff/source/style/FillStyleContext.cxx305
-rw-r--r--xmloff/source/style/FillStyleContext.hxx187
-rw-r--r--xmloff/source/style/GradientStyle.cxx370
-rw-r--r--xmloff/source/style/HatchStyle.cxx291
-rw-r--r--xmloff/source/style/ImageStyle.cxx269
-rw-r--r--xmloff/source/style/MarkerStyle.cxx255
-rw-r--r--xmloff/source/style/NamedBoolPropertyHdl.cxx129
-rw-r--r--xmloff/source/style/TransGradientStyle.cxx355
-rw-r--r--xmloff/source/style/XMLClipPropertyHandler.cxx179
-rw-r--r--xmloff/source/style/XMLElementPropertyContext.cxx94
-rw-r--r--xmloff/source/style/adjushdl.cxx187
-rw-r--r--xmloff/source/style/adjushdl.hxx93
-rw-r--r--xmloff/source/style/backhdl.cxx340
-rw-r--r--xmloff/source/style/backhdl.hxx94
-rw-r--r--xmloff/source/style/bordrhdl.cxx499
-rw-r--r--xmloff/source/style/bordrhdl.hxx91
-rw-r--r--xmloff/source/style/breakhdl.cxx229
-rw-r--r--xmloff/source/style/breakhdl.hxx93
-rw-r--r--xmloff/source/style/cdouthdl.cxx138
-rw-r--r--xmloff/source/style/cdouthdl.hxx81
-rw-r--r--xmloff/source/style/chrhghdl.cxx173
-rw-r--r--xmloff/source/style/chrhghdl.hxx91
-rw-r--r--xmloff/source/style/chrlohdl.cxx193
-rw-r--r--xmloff/source/style/chrlohdl.hxx95
-rw-r--r--xmloff/source/style/csmaphdl.cxx178
-rw-r--r--xmloff/source/style/csmaphdl.hxx90
-rw-r--r--xmloff/source/style/escphdl.cxx216
-rw-r--r--xmloff/source/style/escphdl.hxx91
-rw-r--r--xmloff/source/style/fonthdl.cxx354
-rw-r--r--xmloff/source/style/fonthdl.hxx118
-rw-r--r--xmloff/source/style/impastp1.cxx149
-rw-r--r--xmloff/source/style/impastp2.cxx98
-rw-r--r--xmloff/source/style/impastp3.cxx180
-rw-r--r--xmloff/source/style/impastp4.cxx360
-rw-r--r--xmloff/source/style/impastpl.hxx251
-rw-r--r--xmloff/source/style/kernihdl.cxx132
-rw-r--r--xmloff/source/style/kernihdl.hxx81
-rw-r--r--xmloff/source/style/lspachdl.cxx245
-rw-r--r--xmloff/source/style/lspachdl.hxx100
-rw-r--r--xmloff/source/style/makefile.mk207
-rw-r--r--xmloff/source/style/numehelp.cxx306
-rw-r--r--xmloff/source/style/opaquhdl.cxx124
-rw-r--r--xmloff/source/style/opaquhdl.hxx81
-rw-r--r--xmloff/source/style/postuhdl.cxx147
-rw-r--r--xmloff/source/style/postuhdl.hxx81
-rw-r--r--xmloff/source/style/prhdlfac.cxx341
-rw-r--r--xmloff/source/style/prstylei.cxx317
-rw-r--r--xmloff/source/style/shadwhdl.cxx220
-rw-r--r--xmloff/source/style/shadwhdl.hxx81
-rw-r--r--xmloff/source/style/shdwdhdl.cxx124
-rw-r--r--xmloff/source/style/shdwdhdl.hxx81
-rw-r--r--xmloff/source/style/styleexp.cxx440
-rw-r--r--xmloff/source/style/tabsthdl.cxx129
-rw-r--r--xmloff/source/style/tabsthdl.hxx84
-rw-r--r--xmloff/source/style/undlihdl.cxx151
-rw-r--r--xmloff/source/style/undlihdl.hxx81
-rw-r--r--xmloff/source/style/uniref.cxx74
-rw-r--r--xmloff/source/style/weighhdl.cxx231
-rw-r--r--xmloff/source/style/weighhdl.hxx82
-rw-r--r--xmloff/source/style/xmlaustp.cxx164
-rw-r--r--xmloff/source/style/xmlbahdl.cxx486
-rw-r--r--xmloff/source/style/xmlbahdl.hxx183
-rw-r--r--xmloff/source/style/xmlexppr.cxx356
-rw-r--r--xmloff/source/style/xmlimppr.cxx259
-rw-r--r--xmloff/source/style/xmlnume.cxx794
-rw-r--r--xmloff/source/style/xmlnumfe.cxx1218
-rw-r--r--xmloff/source/style/xmlnumfi.cxx1365
-rw-r--r--xmloff/source/style/xmlnumi.cxx1126
-rw-r--r--xmloff/source/style/xmlprcon.cxx128
-rw-r--r--xmloff/source/style/xmlprhdl.cxx78
-rw-r--r--xmloff/source/style/xmlprmap.cxx444
-rw-r--r--xmloff/source/style/xmlstyle.cxx963
-rw-r--r--xmloff/source/style/xmltabe.cxx250
-rw-r--r--xmloff/source/style/xmltabi.cxx319
76 files changed, 19502 insertions, 0 deletions
diff --git a/xmloff/source/style/DashStyle.cxx b/xmloff/source/style/DashStyle.cxx
new file mode 100644
index 000000000000..95bb1f24bdca
--- /dev/null
+++ b/xmloff/source/style/DashStyle.cxx
@@ -0,0 +1,367 @@
+/*************************************************************************
+ *
+ * $RCSfile: DashStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_DASHSTYLE_HXX
+#include "DashStyle.hxx"
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include"attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include"xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include"xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include<rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+/*
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_GRADIENT_NAME,
+ XML_TOK_GRADIENT_STYLE,
+ XML_TOK_GRADIENT_CX,
+ XML_TOK_GRADIENT_CY,
+ XML_TOK_GRADIENT_STARTCOLOR,
+ XML_TOK_GRADIENT_ENDCOLOR,
+ XML_TOK_GRADIENT_STARTINT,
+ XML_TOK_GRADIENT_ENDINT,
+ XML_TOK_GRADIENT_ANGEL,
+ XML_TOK_GRADIENT_BORDER,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aGradientAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, sXML_name, XML_TOK_GRADIENT_NAME },
+ { XML_NAMESPACE_DRAW, sXML_style, XML_TOK_GRADIENT_STYLE },
+ { XML_NAMESPACE_DRAW, sXML_cx, XML_TOK_GRADIENT_CX },
+ { XML_NAMESPACE_DRAW, sXML_cy, XML_TOK_GRADIENT_CY },
+ { XML_NAMESPACE_DRAW, sXML_start_color, XML_TOK_GRADIENT_STARTCOLOR },
+ { XML_NAMESPACE_DRAW, sXML_end_color, XML_TOK_GRADIENT_ENDCOLOR },
+ { XML_NAMESPACE_DRAW, sXML_start_intensity, XML_TOK_GRADIENT_STARTINT },
+ { XML_NAMESPACE_DRAW, sXML_end_intensity, XML_TOK_GRADIENT_ENDINT },
+ { XML_NAMESPACE_DRAW, sXML_gradient_angel, XML_TOK_GRADIENT_ANGEL },
+ { XML_NAMESPACE_DRAW, sXML_gradient_border, XML_TOK_GRADIENT_BORDER },
+ XML_TOKEN_MAP_END
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_GradientStyle_Enum[] =
+{
+ { sXML_gradientstyle_linear, awt::GradientStyle_LINEAR },
+ { sXML_gradientstyle_axial, awt::GradientStyle_AXIAL },
+ { sXML_gradientstyle_radial, awt::GradientStyle_RADIAL },
+ { sXML_gradientstyle_ellipsoid, awt::GradientStyle_ELLIPTICAL },
+ { sXML_gradientstyle_square, awt::GradientStyle_SQUARE },
+ { sXML_gradientstyle_rectangular, awt::GradientStyle_RECT },
+ { 0, 0 }
+};
+*/
+XMLDashStyle::XMLDashStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > * _pHandler,
+ const SvXMLNamespaceMap& _rNamespaceMap, const SvXMLUnitConverter& _rUnitConverter )
+: mpHandler ( _pHandler ),
+ mrNamespaceMap ( _rNamespaceMap ),
+ mrUnitConverter( _rUnitConverter ),
+ mpAttrList ( NULL )
+{
+}
+
+XMLDashStyle::~XMLDashStyle()
+{
+}
+
+void XMLDashStyle::AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, const OUString& rStrValue )
+{
+ const OUString aStrName( OUString::createFromAscii( pName ) );
+ const OUString aStrCDATA( OUString::createFromAscii( sXML_CDATA ) );
+
+ mpAttrList->AddAttribute( mrNamespaceMap.GetQNameByKey( nPrefix, aStrName ), aStrCDATA, rStrValue );
+}
+
+sal_Bool XMLDashStyle::exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue )
+{
+ return ImpExportXML( *mpHandler, mrNamespaceMap, mrUnitConverter, rStrName, rValue );
+}
+
+sal_Bool XMLDashStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName )
+{
+ return ImpImportXML( mrUnitConverter, xAttrList, rValue, rStrName );
+}
+
+sal_Bool XMLDashStyle::ImpExportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLNamespaceMap& rNamespaceMap, const SvXMLUnitConverter& rUnitConverter,
+ const OUString& rStrName, const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+/*
+ awt::Gradient aGradient;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aGradient )
+ {
+ mpAttrList = new SvXMLAttributeList(); // Do NOT delete me !!
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( mpAttrList );
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ OUString aStrName( rStrName );
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_name, aStrName );
+
+ // Style
+ if( !rUnitConverter.convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ return sal_False;
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_style, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
+ {
+ rUnitConverter.convertPercent( aOut, aGradient.XOffset );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_cx, aStrValue );
+
+ rUnitConverter.convertPercent( aOut, aGradient.YOffset );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_cy, aStrValue );
+ }
+
+ Color aColor;
+
+ // Color start
+ aColor.SetColor( aGradient.StartColor );
+ rUnitConverter.convertColor( aOut, aColor );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_start_color, aStrValue );
+
+ // Color end
+ aColor.SetColor( aGradient.EndColor );
+ rUnitConverter.convertColor( aOut, aColor );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_end_color, aStrValue );
+
+ // Intensity start
+ rUnitConverter.convertPercent( aOut, aGradient.StartIntensity );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_start_intensity, aStrValue );
+
+ // Intensity end
+ rUnitConverter.convertPercent( aOut, aGradient.EndIntensity );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_end_intensity, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ rUnitConverter.convertNumber( aOut, sal_Int32( aGradient.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_gradient_angel, aStrValue );
+ }
+
+ // Border
+ rUnitConverter.convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_gradient_border, aStrValue );
+
+ // Do Write
+ OUString aStrTmp( RTL_CONSTASCII_USTRINGPARAM( sXML_stroke_dasharray ) );
+ rHandler->startElement( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_SVG, aStrTmp ),
+ xAttrList );
+ rHandler->endElement( OUString::createFromAscii( sXML_gradient ) );
+ }
+ }
+*/
+ return bRet;
+}
+
+sal_Bool XMLDashStyle::ImpImportXML( const SvXMLUnitConverter& rUnitConverter,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+/*
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasStartColor = sal_False;
+ sal_Bool bHasEndColor = sal_False;
+
+ awt::Gradient aGradient;
+ aGradient.XOffset = 0;
+ aGradient.YOffset = 0;
+ aGradient.StartIntensity = 100;
+ aGradient.EndIntensity = 100;
+ aGradient.Angle = 0;
+ aGradient.Border = 0;
+
+ SvXMLTokenMap aTokenMap( aGradientAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = mrNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nTmpValue;
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_GRADIENT_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_GRADIENT_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( rUnitConverter.convertEnum( eValue, rStrValue, pXML_GradientStyle_Enum ) )
+ {
+ aGradient.Style = (awt::GradientStyle) eValue;
+ bHasStyle = sal_True;
+ }
+ }
+ break;
+ case XML_TOK_GRADIENT_CX:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.XOffset = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_CY:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.YOffset = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_STARTCOLOR:
+ {
+ Color aColor;
+ if( bHasStartColor = rUnitConverter.convertColor( aColor, rStrValue ) )
+ aGradient.StartColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_ENDCOLOR:
+ {
+ Color aColor;
+ if( bHasStartColor = rUnitConverter.convertColor( aColor, rStrValue ) )
+ aGradient.EndColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_STARTINT:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.StartIntensity = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_ENDINT:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.EndIntensity = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_ANGEL:
+ {
+ sal_Int32 nValue;
+ rUnitConverter.convertNumber( nValue, rStrValue, 0, 360 );
+ aGradient.Angle = sal_Int16( nValue );
+ }
+ break;
+ case XML_TOK_GRADIENT_BORDER:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.Border = nTmpValue;
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import gradient style" )
+ }
+ }
+
+ rValue <<= aGradient;
+
+ bRet = bHasName && bHasStyle && bHasStartColor && bHasEndColor;
+*/
+ return bRet;
+}
diff --git a/xmloff/source/style/EnumPropertyHdl.cxx b/xmloff/source/style/EnumPropertyHdl.cxx
new file mode 100644
index 000000000000..e1f38153c169
--- /dev/null
+++ b/xmloff/source/style/EnumPropertyHdl.cxx
@@ -0,0 +1,146 @@
+/*************************************************************************
+ *
+ * $RCSfile: EnumPropertyHdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_ENUMPROPERTYHANDLER_HXX
+#include <EnumPropertyHdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+/*
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#ifndef _INC_LIMITS
+#include <limits.h>
+#endif
+
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+*/
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEnumPropertyHdl
+//
+
+XMLEnumPropertyHdl::~XMLEnumPropertyHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLEnumPropertyHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ USHORT nValue = 0;
+
+ if( SvXMLUnitConverter::convertEnum( nValue, rStrImpValue, mpEnumMap ) )
+ {
+ rValue = ::cppu::int2enum( nValue, mrType );
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLEnumPropertyHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Int32 nValue;
+ if(!(rValue >>= nValue ))
+ if(!::cppu::enum2int(nValue, rValue) )
+ return sal_False;
+
+ OUStringBuffer aOut;
+
+ if(!SvXMLUnitConverter::convertEnum( aOut, nValue, mpEnumMap ))
+ return sal_False;
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx
new file mode 100644
index 000000000000..735bfc2245f1
--- /dev/null
+++ b/xmloff/source/style/FillStyleContext.cxx
@@ -0,0 +1,305 @@
+/*************************************************************************
+ *
+ * $RCSfile: FillStyleContext.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+
+#ifndef _XMLOFF_FILLSTYLECONTEXTS_HXX_
+#include "FillStyleContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_GRADIENTSTYLE_HXX
+#include "GradientStyle.hxx"
+#endif
+#ifndef _XMLOFF_HATCHSTYLE_HXX
+#include "HatchStyle.hxx"
+#endif
+#ifndef _XMLOFF_IMAGESTYLE_HXX
+#include "ImageStyle.hxx"
+#endif
+#ifndef _XMLOFF_TRANSGRADIENTSTYLE_HXX
+#include "TransGradientStyle.hxx"
+#endif
+#ifndef _XMLOFF_MARKERSTYLE_HXX
+#include "MarkerStyle.hxx"
+#endif
+#ifndef _XMLOFF_DASHSTYLE_HXX
+#include "DashStyle.hxx"
+#endif
+
+#ifndef _XMLOFF_FAMILIES_HXX_
+#include "families.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLGradientStyleContext, SvXMLStyleContext );
+
+XMLGradientStyleContext::XMLGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // set Family
+// SetFamily( XML_STYLE_FAMILY_FILLSTYLE_GRADIENT_ID );
+
+ // start import
+ XMLGradientStyle aGradientStyle( NULL, GetImport().GetNamespaceMap(), GetImport().GetMM100UnitConverter() );
+ aGradientStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLGradientStyleContext::~XMLGradientStyleContext()
+{
+}
+
+void XMLGradientStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xGradient( GetImport().GetGradientHelper() );
+
+ try
+ {
+ if(xGradient.is())
+ xGradient->insertByName( maStrName, maAny );
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLHatchStyleContext, SvXMLStyleContext );
+
+XMLHatchStyleContext::XMLHatchStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLHatchStyle aHatchStyle( NULL, GetImport().GetNamespaceMap(), GetImport().GetMM100UnitConverter() );
+ aHatchStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLHatchStyleContext::~XMLHatchStyleContext()
+{
+}
+
+void XMLHatchStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xHatch( GetImport().GetHatchHelper() );
+
+ try
+ {
+ if(xHatch.is())
+ xHatch->insertByName( maStrName, maAny );
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLBitmapStyleContext, SvXMLStyleContext );
+
+XMLBitmapStyleContext::XMLBitmapStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLImageStyle aBitmapStyle( NULL, GetImport().GetNamespaceMap(), GetImport().GetMM100UnitConverter() );
+ aBitmapStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLBitmapStyleContext::~XMLBitmapStyleContext()
+{
+}
+
+void XMLBitmapStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xBitmap( GetImport().GetBitmapHelper() );
+
+ try
+ {
+ if(xBitmap.is())
+ xBitmap->insertByName( maStrName, maAny );
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLTransGradientStyleContext, SvXMLStyleContext );
+
+XMLTransGradientStyleContext::XMLTransGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLTransGradientStyle aTransGradientStyle( NULL, GetImport().GetNamespaceMap(), GetImport().GetMM100UnitConverter() );
+ aTransGradientStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLTransGradientStyleContext::~XMLTransGradientStyleContext()
+{
+}
+
+void XMLTransGradientStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xTransGradient( GetImport().GetTransGradientHelper() );
+
+ try
+ {
+ if(xTransGradient.is())
+ xTransGradient->insertByName( maStrName, maAny );
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLMarkerStyleContext, SvXMLStyleContext );
+
+XMLMarkerStyleContext::XMLMarkerStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLMarkerStyle aMarkerStyle( NULL, GetImport().GetNamespaceMap(), GetImport().GetMM100UnitConverter() );
+ aMarkerStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLMarkerStyleContext::~XMLMarkerStyleContext()
+{
+}
+
+void XMLMarkerStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xMarker( GetImport().GetMarkerHelper() );
+
+ try
+ {
+ if(xMarker.is())
+ xMarker->insertByName( maStrName, maAny );
+ }
+ catch( container::ElementExistException& )
+ {}
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//////////////////////////////////////////////////////////////////////////////
+
+TYPEINIT1( XMLDashStyleContext, SvXMLStyleContext );
+
+XMLDashStyleContext::XMLDashStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList)
+: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList)
+{
+ // start import
+ XMLDashStyle aDashStyle( NULL, GetImport().GetNamespaceMap(), GetImport().GetMM100UnitConverter() );
+ aDashStyle.importXML( xAttrList, maAny, maStrName );
+}
+
+XMLDashStyleContext::~XMLDashStyleContext()
+{
+}
+
+void XMLDashStyleContext::EndElement()
+{
+ uno::Reference< container::XNameContainer > xDashes( GetImport().GetDashHelper() );
+
+ try
+ {
+ if(xDashes.is())
+ xDashes->insertByName( maStrName, maAny );
+ }
+ catch( container::ElementExistException& )
+ {}
+}
diff --git a/xmloff/source/style/FillStyleContext.hxx b/xmloff/source/style/FillStyleContext.hxx
new file mode 100644
index 000000000000..7039bded0697
--- /dev/null
+++ b/xmloff/source/style/FillStyleContext.hxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: FillStyleContext.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_FILLSTYLECONTEXTS_HXX_
+#define _XMLOFF_FILLSTYLECONTEXTS_HXX_
+
+#ifndef _XMLOFF_XMLSTYLE_HXX //autogen
+#include <xmlstyle.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:gardient context
+
+class XMLGradientStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLGradientStyleContext();
+
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:hatch context
+
+class XMLHatchStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLHatchStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLHatchStyleContext();
+
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:fill-image context
+
+class XMLBitmapStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLBitmapStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLBitmapStyleContext();
+
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:transparency context
+
+class XMLTransGradientStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLTransGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLTransGradientStyleContext();
+
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:marker context
+
+class XMLMarkerStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLMarkerStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLMarkerStyleContext();
+
+ virtual void EndElement();
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// draw:marker context
+
+class XMLDashStyleContext: public SvXMLStyleContext
+{
+private:
+ ::com::sun::star::uno::Any maAny;
+ rtl::OUString maStrName;
+
+public:
+ TYPEINFO();
+
+ XMLDashStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName,
+ const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
+ virtual ~XMLDashStyleContext();
+
+ virtual void EndElement();
+};
+
+#endif // _XMLOFF_FILLSTYLECONTEXTS_HXX_
diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx
new file mode 100644
index 000000000000..2591cf8868bc
--- /dev/null
+++ b/xmloff/source/style/GradientStyle.cxx
@@ -0,0 +1,370 @@
+/*************************************************************************
+ *
+ * $RCSfile: GradientStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_GRADIENTSTYLE_HXX
+#include "GradientStyle.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include<com/sun/star/awt/Gradient.hpp>
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include"attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include"xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include"xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include<rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_GRADIENT_NAME,
+ XML_TOK_GRADIENT_STYLE,
+ XML_TOK_GRADIENT_CX,
+ XML_TOK_GRADIENT_CY,
+ XML_TOK_GRADIENT_STARTCOLOR,
+ XML_TOK_GRADIENT_ENDCOLOR,
+ XML_TOK_GRADIENT_STARTINT,
+ XML_TOK_GRADIENT_ENDINT,
+ XML_TOK_GRADIENT_ANGEL,
+ XML_TOK_GRADIENT_BORDER,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aGradientAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, sXML_name, XML_TOK_GRADIENT_NAME },
+ { XML_NAMESPACE_DRAW, sXML_style, XML_TOK_GRADIENT_STYLE },
+ { XML_NAMESPACE_DRAW, sXML_cx, XML_TOK_GRADIENT_CX },
+ { XML_NAMESPACE_DRAW, sXML_cy, XML_TOK_GRADIENT_CY },
+ { XML_NAMESPACE_DRAW, sXML_start_color, XML_TOK_GRADIENT_STARTCOLOR },
+ { XML_NAMESPACE_DRAW, sXML_end_color, XML_TOK_GRADIENT_ENDCOLOR },
+ { XML_NAMESPACE_DRAW, sXML_start_intensity, XML_TOK_GRADIENT_STARTINT },
+ { XML_NAMESPACE_DRAW, sXML_end_intensity, XML_TOK_GRADIENT_ENDINT },
+ { XML_NAMESPACE_DRAW, sXML_gradient_angel, XML_TOK_GRADIENT_ANGEL },
+ { XML_NAMESPACE_DRAW, sXML_gradient_border, XML_TOK_GRADIENT_BORDER },
+ XML_TOKEN_MAP_END
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_GradientStyle_Enum[] =
+{
+ { sXML_gradientstyle_linear, awt::GradientStyle_LINEAR },
+ { sXML_gradientstyle_axial, awt::GradientStyle_AXIAL },
+ { sXML_gradientstyle_radial, awt::GradientStyle_RADIAL },
+ { sXML_gradientstyle_ellipsoid, awt::GradientStyle_ELLIPTICAL },
+ { sXML_gradientstyle_square, awt::GradientStyle_SQUARE },
+ { sXML_gradientstyle_rectangular, awt::GradientStyle_RECT },
+ { 0, 0 }
+};
+
+XMLGradientStyle::XMLGradientStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > * _pHandler,
+ const SvXMLNamespaceMap& _rNamespaceMap, const SvXMLUnitConverter& _rUnitConverter )
+: mpHandler ( _pHandler ),
+ mrNamespaceMap ( _rNamespaceMap ),
+ mrUnitConverter( _rUnitConverter ),
+ mpAttrList ( NULL )
+{
+}
+
+XMLGradientStyle::~XMLGradientStyle()
+{
+}
+
+void XMLGradientStyle::AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, const OUString& rStrValue )
+{
+ const OUString aStrName( OUString::createFromAscii( pName ) );
+ const OUString aStrCDATA( OUString::createFromAscii( sXML_CDATA ) );
+
+ mpAttrList->AddAttribute( mrNamespaceMap.GetQNameByKey( nPrefix, aStrName ), aStrCDATA, rStrValue );
+}
+
+sal_Bool XMLGradientStyle::exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue )
+{
+ return ImpExportXML( *mpHandler, mrNamespaceMap, mrUnitConverter, rStrName, rValue );
+}
+
+sal_Bool XMLGradientStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName )
+{
+ return ImpImportXML( mrUnitConverter, xAttrList, rValue, rStrName );
+}
+
+sal_Bool XMLGradientStyle::ImpExportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLNamespaceMap& rNamespaceMap, const SvXMLUnitConverter& rUnitConverter,
+ const OUString& rStrName, const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ awt::Gradient aGradient;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aGradient )
+ {
+ mpAttrList = new SvXMLAttributeList(); // Do NOT delete me !!
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( mpAttrList );
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ OUString aStrName( rStrName );
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_name, aStrName );
+
+ // Style
+ if( !rUnitConverter.convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ return sal_False;
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_style, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
+ {
+ rUnitConverter.convertPercent( aOut, aGradient.XOffset );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_cx, aStrValue );
+
+ rUnitConverter.convertPercent( aOut, aGradient.YOffset );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_cy, aStrValue );
+ }
+
+ Color aColor;
+
+ // Color start
+ aColor.SetColor( aGradient.StartColor );
+ rUnitConverter.convertColor( aOut, aColor );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_start_color, aStrValue );
+
+ // Color end
+ aColor.SetColor( aGradient.EndColor );
+ rUnitConverter.convertColor( aOut, aColor );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_end_color, aStrValue );
+
+ // Intensity start
+ rUnitConverter.convertPercent( aOut, aGradient.StartIntensity );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_start_intensity, aStrValue );
+
+ // Intensity end
+ rUnitConverter.convertPercent( aOut, aGradient.EndIntensity );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_end_intensity, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ rUnitConverter.convertNumber( aOut, sal_Int32( aGradient.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_gradient_angel, aStrValue );
+ }
+
+ // Border
+ rUnitConverter.convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_gradient_border, aStrValue );
+
+ // Do Write
+ OUString aStrTmp( RTL_CONSTASCII_USTRINGPARAM( sXML_gradient ) );
+ rHandler->startElement( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_DRAW, aStrTmp ),
+ xAttrList );
+ rHandler->endElement( OUString::createFromAscii( sXML_gradient ) );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLGradientStyle::ImpImportXML( const SvXMLUnitConverter& rUnitConverter,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasStartColor = sal_False;
+ sal_Bool bHasEndColor = sal_False;
+
+ awt::Gradient aGradient;
+ aGradient.XOffset = 0;
+ aGradient.YOffset = 0;
+ aGradient.StartIntensity = 100;
+ aGradient.EndIntensity = 100;
+ aGradient.Angle = 0;
+ aGradient.Border = 0;
+
+ SvXMLTokenMap aTokenMap( aGradientAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = mrNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nTmpValue;
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_GRADIENT_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_GRADIENT_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( rUnitConverter.convertEnum( eValue, rStrValue, pXML_GradientStyle_Enum ) )
+ {
+ aGradient.Style = (awt::GradientStyle) eValue;
+ bHasStyle = sal_True;
+ }
+ }
+ break;
+ case XML_TOK_GRADIENT_CX:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.XOffset = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_CY:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.YOffset = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_STARTCOLOR:
+ {
+ Color aColor;
+ if( bHasStartColor = rUnitConverter.convertColor( aColor, rStrValue ) )
+ aGradient.StartColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_ENDCOLOR:
+ {
+ Color aColor;
+ if( bHasStartColor = rUnitConverter.convertColor( aColor, rStrValue ) )
+ aGradient.EndColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_STARTINT:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.StartIntensity = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_ENDINT:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.EndIntensity = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_ANGEL:
+ {
+ sal_Int32 nValue;
+ rUnitConverter.convertNumber( nValue, rStrValue, 0, 360 );
+ aGradient.Angle = sal_Int16( nValue );
+ }
+ break;
+ case XML_TOK_GRADIENT_BORDER:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.Border = nTmpValue;
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import gradient style" )
+ ;
+ }
+ }
+
+ rValue <<= aGradient;
+
+ bRet = bHasName && bHasStyle && bHasStartColor && bHasEndColor;
+
+ return bRet;
+}
diff --git a/xmloff/source/style/HatchStyle.cxx b/xmloff/source/style/HatchStyle.cxx
new file mode 100644
index 000000000000..f3b9440f9a24
--- /dev/null
+++ b/xmloff/source/style/HatchStyle.cxx
@@ -0,0 +1,291 @@
+/*************************************************************************
+ *
+ * $RCSfile: HatchStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_HATCHSTYLE_HXX
+#include "HatchStyle.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_DRAWING_HATCH_HPP_
+#include <com/sun/star/drawing/Hatch.hpp>
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include"attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include"xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include"xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include<rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_HATCH_NAME,
+ XML_TOK_HATCH_STYLE,
+ XML_TOK_HATCH_COLOR,
+ XML_TOK_HATCH_DISTANCE,
+ XML_TOK_HATCH_ROTATION,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aHatchAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, sXML_name, XML_TOK_HATCH_NAME },
+ { XML_NAMESPACE_DRAW, sXML_style, XML_TOK_HATCH_STYLE },
+ { XML_NAMESPACE_DRAW, sXML_color, XML_TOK_HATCH_COLOR },
+ { XML_NAMESPACE_DRAW, sXML_hatch_distance, XML_TOK_HATCH_DISTANCE },
+ { XML_NAMESPACE_DRAW, sXML_rotation, XML_TOK_HATCH_ROTATION },
+ XML_TOKEN_MAP_END
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_HatchStyle_Enum[] =
+{
+ { sXML_hatchstyle_single, drawing::HatchStyle_SINGLE },
+ { sXML_hatchstyle_double, drawing::HatchStyle_DOUBLE },
+ { sXML_hatchstyle_triple, drawing::HatchStyle_TRIPLE },
+ { 0, 0 }
+};
+
+XMLHatchStyle::XMLHatchStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & _rHandler,
+ const SvXMLNamespaceMap& _rNamespaceMap, const SvXMLUnitConverter& _rUnitConverter )
+: rHandler ( _rHandler ),
+ mrNamespaceMap ( _rNamespaceMap ),
+ rUnitConverter( _rUnitConverter ),
+ pAttrList ( NULL )
+{
+}
+
+XMLHatchStyle::~XMLHatchStyle()
+{
+}
+
+void XMLHatchStyle::AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, const ::rtl::OUString& rStrValue )
+{
+ const ::rtl::OUString aStrName( ::rtl::OUString::createFromAscii( pName ) );
+ const ::rtl::OUString aStrCDATA( ::rtl::OUString::createFromAscii( sXML_CDATA ) );
+
+ pAttrList->AddAttribute( mrNamespaceMap.GetQNameByKey( nPrefix, aStrName ), aStrCDATA, rStrValue );
+}
+
+sal_Bool XMLHatchStyle::exportXML( const ::rtl::OUString& rStrName, const ::com::sun::star::uno::Any& rValue )
+{
+ return ImpExportXML( rHandler, mrNamespaceMap, rUnitConverter, rStrName, rValue );
+}
+
+sal_Bool XMLHatchStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName )
+{
+ return ImpImportXML( rUnitConverter, xAttrList, rValue, rStrName );
+}
+
+
+sal_Bool XMLHatchStyle::ImpExportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLNamespaceMap& rNamespaceMap, const SvXMLUnitConverter& rUnitConverter,
+ const ::rtl::OUString& rStrName, const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ drawing::Hatch aHatch;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aHatch )
+ {
+ pAttrList = new SvXMLAttributeList(); // Do NOT delete me !!
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( pAttrList );
+
+ ::rtl::OUString aStrValue;
+ ::rtl::OUStringBuffer aOut;
+
+ // Name
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_name, rStrName );
+
+ // Style
+ if( !rUnitConverter.convertEnum( aOut, aHatch.Style, pXML_HatchStyle_Enum ) )
+ return sal_False;
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_style, aStrValue );
+
+ // Color
+ rUnitConverter.convertColor( aOut, Color( aHatch.Color ) );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_color, aStrValue );
+
+ // Distance
+ rUnitConverter.convertMeasure( aOut, aHatch.Distance );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_hatch_distance, aStrValue );
+
+ // Angle
+ rUnitConverter.convertNumber( aOut, sal_Int32( aHatch.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_rotation, aStrValue );
+
+ // Do Write
+ rHandler->startElement( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_DRAW, ::rtl::OUString::createFromAscii(sXML_hatch) ),
+ xAttrList );
+ rHandler->endElement( ::rtl::OUString::createFromAscii( sXML_gradient ) );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLHatchStyle::ImpImportXML( const SvXMLUnitConverter& rUnitConverter,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasColor = sal_False;
+ sal_Bool bHasDist = sal_False;
+
+ drawing::Hatch aHatch;
+ aHatch.Style = drawing::HatchStyle_SINGLE;
+ aHatch.Color = 0;
+ aHatch.Distance = 0;
+ aHatch.Angle = 0;
+
+ SvXMLTokenMap aTokenMap( aHatchAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = mrNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_HATCH_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_HATCH_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( bHasStyle = rUnitConverter.convertEnum( eValue, rStrValue, pXML_HatchStyle_Enum ) )
+ aHatch.Style = (drawing::HatchStyle) eValue;
+ }
+ break;
+ case XML_TOK_HATCH_COLOR:
+ {
+ Color aColor;
+ if( bHasColor = rUnitConverter.convertColor( aColor, rStrValue ) )
+ aHatch.Color = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_HATCH_DISTANCE:
+ bHasDist = rUnitConverter.convertMeasure( (sal_Int32&)aHatch.Distance, rStrValue );
+ break;
+ case XML_TOK_HATCH_ROTATION:
+ {
+ sal_Int32 nValue;
+ rUnitConverter.convertNumber( nValue, rStrValue, 0, 360 );
+ aHatch.Angle = sal_Int16( nValue );
+ }
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import hatch style" )
+ ;
+ }
+ }
+
+ rValue <<= aHatch;
+
+ bRet = bHasName && bHasStyle && bHasColor && bHasDist;
+
+ return bRet;
+}
diff --git a/xmloff/source/style/ImageStyle.cxx b/xmloff/source/style/ImageStyle.cxx
new file mode 100644
index 000000000000..91eaf993405b
--- /dev/null
+++ b/xmloff/source/style/ImageStyle.cxx
@@ -0,0 +1,269 @@
+/*************************************************************************
+ *
+ * $RCSfile: ImageStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_IMAGESTYLE_HXX
+#include "ImageStyle.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
+#include <com/sun/star/awt/XBitmap.hpp>
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include"attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include"xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include"xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include<rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_IMAGE_NAME,
+ XML_TOK_IMAGE_URL,
+ XML_TOK_IMAGE_TYPE,
+ XML_TOK_IMAGE_SHOW,
+ XML_TOK_IMAGE_ACTUATE,
+ /* XML_TOK_IMAGE_SIZEW,
+ XML_TOK_IMAGE_SIZEH,*/
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aHatchAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, sXML_name, XML_TOK_IMAGE_NAME },
+ { XML_NAMESPACE_XLINK, sXML_href, XML_TOK_IMAGE_URL },
+ { XML_NAMESPACE_XLINK, sXML_type, XML_TOK_IMAGE_TYPE },
+ { XML_NAMESPACE_XLINK, sXML_show, XML_TOK_IMAGE_SHOW },
+ { XML_NAMESPACE_XLINK, sXML_actuate, XML_TOK_IMAGE_ACTUATE },
+ /*{ XML_NAMESPACE_XLINK, sXML_href, XML_TOK_IMAGE_URL },
+ { XML_NAMESPACE_XLINK, sXML_href, XML_TOK_IMAGE_URL },*/
+ XML_TOKEN_MAP_END
+};
+
+XMLImageStyle::XMLImageStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & _rHandler,
+ const SvXMLNamespaceMap& _rNamespaceMap, const SvXMLUnitConverter& _rUnitConverter )
+: rHandler ( _rHandler ),
+ mrNamespaceMap ( _rNamespaceMap ),
+ rUnitConverter( _rUnitConverter ),
+ pAttrList ( NULL )
+{
+}
+
+XMLImageStyle::~XMLImageStyle()
+{
+}
+
+void XMLImageStyle::AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, const OUString& aStrValue )
+{
+ const OUString aStrName( OUString::createFromAscii( pName ) );
+ const OUString aStrCDATA( OUString::createFromAscii( sXML_CDATA ) );
+
+ pAttrList->AddAttribute( mrNamespaceMap.GetQNameByKey( nPrefix, aStrName ), aStrCDATA, aStrValue );
+}
+
+sal_Bool XMLImageStyle::exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue )
+{
+ return ImpExportXML( rHandler, mrNamespaceMap, rUnitConverter, rStrName, rValue );
+}
+
+sal_Bool XMLImageStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName )
+{
+ return ImpImportXML( rUnitConverter, xAttrList, rValue, rStrName );
+}
+
+sal_Bool XMLImageStyle::ImpExportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLNamespaceMap& rNamespaceMap, const SvXMLUnitConverter& rUnitConverter,
+ const OUString& rStrName, const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+
+ OUString aURL;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aURL )
+ {
+ pAttrList = new SvXMLAttributeList(); // Do NOT delete me !!
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( pAttrList );
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_name, rStrName );
+
+ // uri
+ AddAttribute( XML_NAMESPACE_XLINK, sXML_href, aURL );
+ AddAttribute( XML_NAMESPACE_XLINK, sXML_type, OUString::createFromAscii(sXML_simple) );
+ AddAttribute( XML_NAMESPACE_XLINK, sXML_show, OUString::createFromAscii(sXML_parsed) );
+ AddAttribute( XML_NAMESPACE_XLINK, sXML_actuate, OUString::createFromAscii(sXML_auto) );
+
+/*
+ // size
+ awt::Size aSize = xBitmap->getSize();
+
+ rUnitConverter.convertNumber( aOut, aSize.Width );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_SVG, sXML_width, aStrValue );
+
+ rUnitConverter.convertNumber( aOut, aSize.Height );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_SVG, sXML_height, aStrValue );
+*/
+
+ // Do Write
+ rHandler->startElement( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_DRAW, OUString::createFromAscii(sXML_fill_image) ),
+ xAttrList );
+ rHandler->endElement( OUString::createFromAscii( sXML_fill_image ) );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLImageStyle::ImpImportXML( const SvXMLUnitConverter& rUnitConverter,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bHasHRef = sal_False;
+ sal_Bool bHasName = sal_False;
+
+ OUString aStrURL;
+
+ SvXMLTokenMap aTokenMap( aHatchAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = mrNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_IMAGE_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_IMAGE_URL:
+ {
+ aStrURL = rStrValue;
+ bHasHRef = sal_True;
+ }
+ break;
+ case XML_TOK_IMAGE_TYPE:
+ // ignore
+ break;
+ case XML_TOK_IMAGE_SHOW:
+ // ignore
+ break;
+ case XML_TOK_IMAGE_ACTUATE:
+ // ignore
+ break;
+ default:
+ DBG_WARNING( "Unknown token at import fill bitmap style" )
+ ;
+ }
+ }
+
+ rValue <<= aStrURL;
+
+ bRet = bHasName && bHasHRef;
+
+ return bRet;
+}
diff --git a/xmloff/source/style/MarkerStyle.cxx b/xmloff/source/style/MarkerStyle.cxx
new file mode 100644
index 000000000000..3a7e7ae4286a
--- /dev/null
+++ b/xmloff/source/style/MarkerStyle.cxx
@@ -0,0 +1,255 @@
+/*************************************************************************
+ *
+ * $RCSfile: MarkerStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_MARKERSTYLE_HXX
+#include "MarkerStyle.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_DRAWING_POINTSEQUENCE_HPP_
+#include <com/sun/star/drawing/PointSequence.hpp>
+#endif
+
+#ifndef _XEXPTRANSFORM_HXX
+#include "xexptran.hxx"
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include"attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include"xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include"xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include<rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+XMLMarkerStyle::XMLMarkerStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & _rHandler,
+ const SvXMLNamespaceMap& _rNamespaceMap, const SvXMLUnitConverter& _rUnitConverter )
+: rHandler ( _rHandler ),
+ mrNamespaceMap ( _rNamespaceMap ),
+ rUnitConverter( _rUnitConverter ),
+ pAttrList ( NULL )
+{
+}
+
+XMLMarkerStyle::~XMLMarkerStyle()
+{
+}
+
+void XMLMarkerStyle::AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, const OUString& rStrValue )
+{
+ const OUString aStrName( OUString::createFromAscii( pName ) );
+ const OUString aStrCDATA( OUString::createFromAscii( sXML_CDATA ) );
+
+ pAttrList->AddAttribute( mrNamespaceMap.GetQNameByKey( nPrefix, aStrName ), aStrCDATA, rStrValue );
+}
+
+sal_Bool XMLMarkerStyle::exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue )
+{
+ return ImpExportXML( rHandler, mrNamespaceMap, rUnitConverter, rStrName, rValue );
+}
+
+sal_Bool XMLMarkerStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName )
+{
+ return ImpImportXML( rUnitConverter, xAttrList, rValue, rStrName );
+}
+
+sal_Bool XMLMarkerStyle::ImpExportXML( const uno::Reference< xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLNamespaceMap& rNamespaceMap, const SvXMLUnitConverter& rUnitConverter,
+ const OUString& rStrName, const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ drawing::PointSequence aPointSequence;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aPointSequence )
+ {
+ pAttrList = new SvXMLAttributeList(); // Do NOT delete me !!
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( pAttrList );
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ /////////////////
+ // Name
+ OUString aStrName( rStrName );
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_name, aStrName );
+
+ /////////////////
+ // Viewbox (viewBox="0 0 1500 1000")
+ const awt::Point *pPoints = aPointSequence.getConstArray();
+ sal_Int32 nPointCount = aPointSequence.getLength();
+ sal_Int32 nMinX = 0, nMaxX = 0, nMinY = 0, nMaxY = 0;
+
+ for( sal_Int32 i = 0; i<nPointCount; i++ )
+ {
+ const awt::Point aPoint = pPoints[i];
+
+ if( aPoint.X < nMinX )
+ nMinX = aPoint.X;
+ if( aPoint.X > nMaxX )
+ nMaxX = aPoint.X;
+ if( aPoint.Y < nMinY )
+ nMinY = aPoint.Y;
+ if( aPoint.Y > nMaxY )
+ nMaxY = aPoint.Y;
+ }
+
+ sal_Int32 nDifX = nMaxX - nMinX;
+ sal_Int32 nDifY = nMaxY - nMinY;
+ nDifX = nDifX >= 0 ? nDifX : -nDifX;
+ nDifY = nDifY >= 0 ? nDifY : -nDifY;
+
+ SdXMLImExViewBox aViewBox( 0, 0, nDifX, nDifY );
+ AddAttribute( XML_NAMESPACE_SVG, sXML_viewBox, aViewBox.GetExportString( rUnitConverter ) );
+
+ /////////////////
+ // Pathdata
+ SdXMLImExPointsElement aPoints( &aPointSequence, aViewBox, awt::Point( 0, 0 ),
+ awt::Size( aViewBox.GetWidth(), aViewBox.GetHeight() ),
+ rUnitConverter );
+
+ AddAttribute( XML_NAMESPACE_SVG, sXML_d, aPoints.GetExportString() );
+
+ /////////////////
+ // Do Write
+ OUString aStrTmp( RTL_CONSTASCII_USTRINGPARAM( sXML_marker ) );
+ rHandler->startElement( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_DRAW, aStrTmp ),
+ xAttrList );
+ rHandler->endElement( OUString::createFromAscii( sXML_marker ) );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLMarkerStyle::ImpImportXML( const SvXMLUnitConverter& rUnitConverter,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bHasViewBox = sal_False;
+ sal_Bool bHasPathData = sal_False;
+
+ SdXMLImExViewBox* pViewBox = NULL;
+
+ drawing::PointSequence aPointSequence;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i = 0; i < nAttrCount; i++ )
+ {
+ OUString aStrFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ mrNamespaceMap.GetKeyByAttrName( aStrFullAttrName, &aStrAttrName );
+ OUString aStrValue = xAttrList->getValueByIndex( i );
+
+ if( aStrAttrName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( sXML_name ) ) == 0 )
+ {
+ rStrName = aStrValue;
+
+ } else if( aStrAttrName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( sXML_viewBox ) ) == 0 )
+ {
+ pViewBox = new SdXMLImExViewBox( aStrValue, rUnitConverter );
+ bHasViewBox = sal_True;
+
+ } else if( bHasViewBox && aStrAttrName.compareToAscii( RTL_CONSTASCII_STRINGPARAM( sXML_d ) ) == 0 )
+ {
+ SdXMLImExPointsElement aPoints( aStrValue, *pViewBox, awt::Point( 0, 0 ),
+ awt::Size( pViewBox->GetWidth(), pViewBox->GetHeight() ),
+ rUnitConverter );
+ const drawing::PointSequenceSequence& rSequence = aPoints.GetPointSequenceSequence();
+ const drawing::PointSequence *pSequences = rSequence.getConstArray();
+
+ aPointSequence = drawing::PointSequence( pSequences[0] );
+ }
+ }
+
+ if( pViewBox )
+ delete pViewBox;
+
+ rValue <<= aPointSequence;
+
+ bRet = bHasViewBox && bHasPathData;
+
+ return bRet;
+}
diff --git a/xmloff/source/style/NamedBoolPropertyHdl.cxx b/xmloff/source/style/NamedBoolPropertyHdl.cxx
new file mode 100644
index 000000000000..a7c65f9488c3
--- /dev/null
+++ b/xmloff/source/style/NamedBoolPropertyHdl.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: NamedBoolPropertyHdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX
+#include <NamedBoolPropertyHdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _CPPUHELPER_EXTRACT_HXX_
+#include <cppuhelper/extract.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNamedBoolPropertyHdl
+//
+
+XMLNamedBoolPropertyHdl::~XMLNamedBoolPropertyHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLNamedBoolPropertyHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ if( rStrImpValue == maTrueStr )
+ {
+ rValue = ::cppu::bool2any( sal_True );
+ return sal_True;
+ }
+
+ if( rStrImpValue == maFalseStr )
+ {
+ rValue = ::cppu::bool2any( sal_False );
+ return sal_True;
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLNamedBoolPropertyHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ if( ::cppu::any2bool( rValue ) )
+ {
+ rStrExpValue = maTrueStr;
+ }
+ else
+ {
+ rStrExpValue = maFalseStr;
+ }
+
+ return sal_True;
+}
+
diff --git a/xmloff/source/style/TransGradientStyle.cxx b/xmloff/source/style/TransGradientStyle.cxx
new file mode 100644
index 000000000000..941466bda860
--- /dev/null
+++ b/xmloff/source/style/TransGradientStyle.cxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * $RCSfile: TransGradientStyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_TRANSGRADIENTSTYLE_HXX
+#include "TransGradientStyle.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_GRADIENT_HPP_
+#include<com/sun/star/awt/Gradient.hpp>
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include"attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include"xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include"xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include<rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include<rtl/ustring>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_GRADIENT_NAME,
+ XML_TOK_GRADIENT_STYLE,
+ XML_TOK_GRADIENT_CX,
+ XML_TOK_GRADIENT_CY,
+ XML_TOK_GRADIENT_START,
+ XML_TOK_GRADIENT_END,
+ XML_TOK_GRADIENT_ANGEL,
+ XML_TOK_GRADIENT_BORDER,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aTrGradientAttrTokenMap[] =
+{
+ { XML_NAMESPACE_DRAW, sXML_name, XML_TOK_GRADIENT_NAME },
+ { XML_NAMESPACE_DRAW, sXML_style, XML_TOK_GRADIENT_STYLE },
+ { XML_NAMESPACE_DRAW, sXML_cx, XML_TOK_GRADIENT_CX },
+ { XML_NAMESPACE_DRAW, sXML_cy, XML_TOK_GRADIENT_CY },
+ { XML_NAMESPACE_DRAW, sXML_start_transparency, XML_TOK_GRADIENT_START },
+ { XML_NAMESPACE_DRAW, sXML_end_transparency, XML_TOK_GRADIENT_END },
+ { XML_NAMESPACE_DRAW, sXML_gradient_angel, XML_TOK_GRADIENT_ANGEL },
+ { XML_NAMESPACE_DRAW, sXML_gradient_border, XML_TOK_GRADIENT_BORDER },
+ XML_TOKEN_MAP_END
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_GradientStyle_Enum[] =
+{
+ { sXML_gradientstyle_linear, awt::GradientStyle_LINEAR },
+ { sXML_gradientstyle_axial, awt::GradientStyle_AXIAL },
+ { sXML_gradientstyle_radial, awt::GradientStyle_RADIAL },
+ { sXML_gradientstyle_ellipsoid, awt::GradientStyle_ELLIPTICAL },
+ { sXML_gradientstyle_square, awt::GradientStyle_SQUARE },
+ { sXML_gradientstyle_rectangular, awt::GradientStyle_RECT },
+ { 0, 0 }
+};
+
+XMLTransGradientStyle::XMLTransGradientStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & _rHandler,
+ const SvXMLNamespaceMap& _rNamespaceMap, const SvXMLUnitConverter& _rUnitConverter )
+: rHandler ( _rHandler ),
+ mrNamespaceMap ( _rNamespaceMap ),
+ rUnitConverter( _rUnitConverter ),
+ pAttrList ( NULL )
+{
+}
+
+XMLTransGradientStyle::~XMLTransGradientStyle()
+{
+}
+
+void XMLTransGradientStyle::AddAttribute( sal_uInt16 nPrefix, const sal_Char *pName, const OUString& rStrValue )
+{
+ const OUString aStrName( OUString::createFromAscii( pName ) );
+ const OUString aStrCDATA( OUString::createFromAscii( sXML_CDATA ) );
+
+ pAttrList->AddAttribute( mrNamespaceMap.GetQNameByKey( nPrefix, aStrName ), aStrCDATA, rStrValue );
+}
+
+sal_Bool XMLTransGradientStyle::exportXML( const OUString& rStrName, const ::com::sun::star::uno::Any& rValue )
+{
+ return ImpExportXML( rHandler, mrNamespaceMap, rUnitConverter, rStrName, rValue );
+}
+
+sal_Bool XMLTransGradientStyle::importXML( const uno::Reference< xml::sax::XAttributeList >& xAttrList, uno::Any& rValue, OUString& rStrName )
+{
+ return ImpImportXML( rUnitConverter, xAttrList, rValue, rStrName );
+}
+
+sal_Bool XMLTransGradientStyle::ImpExportXML( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLNamespaceMap& rNamespaceMap, const SvXMLUnitConverter& rUnitConverter,
+ const OUString& rStrName, const uno::Any& rValue )
+{
+ sal_Bool bRet = sal_False;
+ awt::Gradient aGradient;
+
+ if( rStrName.getLength() )
+ {
+ if( rValue >>= aGradient )
+ {
+ pAttrList = new SvXMLAttributeList();
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( pAttrList );
+
+ OUString aStrValue;
+ OUStringBuffer aOut;
+
+ // Name
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_name, rStrName );
+
+ // Style
+ if( !rUnitConverter.convertEnum( aOut, aGradient.Style, pXML_GradientStyle_Enum ) )
+ return sal_False;
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_style, aStrValue );
+
+ // Center x/y
+ if( aGradient.Style != awt::GradientStyle_LINEAR &&
+ aGradient.Style != awt::GradientStyle_AXIAL )
+ {
+ rUnitConverter.convertPercent( aOut, aGradient.XOffset );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_cx, aStrValue );
+
+ rUnitConverter.convertPercent( aOut, aGradient.YOffset );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_cy, aStrValue );
+ }
+
+
+ Color aColor;
+
+ // Transparency start
+ aColor.SetColor( aGradient.StartColor );
+ sal_Int32 aStartValue = (sal_Int32)(((aColor.GetRed() + 1) * 100) / 255);
+ rUnitConverter.convertPercent( aOut, aStartValue );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_start_transparency, aStrValue );
+
+ // Transparency end
+ aColor.SetColor( aGradient.EndColor );
+ sal_Int32 aEndValue = (sal_Int32)(((aColor.GetRed() + 1) * 100) / 255);
+ rUnitConverter.convertPercent( aOut, aEndValue );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_end_transparency, aStrValue );
+
+ // Angle
+ if( aGradient.Style != awt::GradientStyle_RADIAL )
+ {
+ rUnitConverter.convertNumber( aOut, sal_Int32( aGradient.Angle ) );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_gradient_angel, aStrValue );
+ }
+
+ // Border
+ rUnitConverter.convertPercent( aOut, aGradient.Border );
+ aStrValue = aOut.makeStringAndClear();
+ AddAttribute( XML_NAMESPACE_DRAW, sXML_gradient_border, aStrValue );
+
+ // Do Write
+ rHandler->startElement( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_DRAW, OUString::createFromAscii(sXML_transparency) ),
+ xAttrList );
+ rHandler->endElement( OUString::createFromAscii( sXML_gradient ) );
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLTransGradientStyle::ImpImportXML( const SvXMLUnitConverter& rUnitConverter,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ uno::Any& rValue, OUString& rStrName )
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bHasName = sal_False;
+ sal_Bool bHasStyle = sal_False;
+
+ awt::Gradient aGradient;
+ aGradient.XOffset = 0;
+ aGradient.YOffset = 0;
+ aGradient.StartIntensity = 100;
+ aGradient.EndIntensity = 100;
+ aGradient.Angle = 0;
+ aGradient.Border = 0;
+
+ SvXMLTokenMap aTokenMap( aTrGradientAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rFullAttrName = xAttrList->getNameByIndex( i );
+ OUString aStrAttrName;
+ sal_uInt16 nPrefix = mrNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName );
+ const OUString& rStrValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nTmpValue;
+
+ switch( aTokenMap.Get( nPrefix, aStrAttrName ) )
+ {
+ case XML_TOK_GRADIENT_NAME:
+ {
+ rStrName = rStrValue;
+ bHasName = sal_True;
+ }
+ break;
+ case XML_TOK_GRADIENT_STYLE:
+ {
+ sal_uInt16 eValue;
+ if( rUnitConverter.convertEnum( eValue, rStrValue, pXML_GradientStyle_Enum ) )
+ {
+ aGradient.Style = (awt::GradientStyle) eValue;
+ bHasStyle = sal_True;
+ }
+ }
+ break;
+ case XML_TOK_GRADIENT_CX:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.XOffset = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_CY:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.YOffset = nTmpValue;
+ break;
+ case XML_TOK_GRADIENT_START:
+ {
+ sal_Int32 aStartTransparency;
+ rUnitConverter.convertPercent( aStartTransparency, rStrValue );
+
+ aStartTransparency = ( aStartTransparency * 255 ) / 100;
+
+ Color aColor(aStartTransparency, aStartTransparency, aStartTransparency );
+ aGradient.StartColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_END:
+ {
+ sal_Int32 aEndTransparency;
+ rUnitConverter.convertPercent( aEndTransparency, rStrValue );
+
+ aEndTransparency = ( aEndTransparency * 255 ) / 100;
+
+ Color aColor( aEndTransparency, aEndTransparency, aEndTransparency );
+ aGradient.EndColor = (sal_Int32)( aColor.GetColor() );
+ }
+ break;
+ case XML_TOK_GRADIENT_ANGEL:
+ {
+ sal_Int32 nValue;
+ rUnitConverter.convertNumber( nValue, rStrValue, 0, 360 );
+ aGradient.Angle = sal_Int16( nValue );
+ }
+ break;
+ case XML_TOK_GRADIENT_BORDER:
+ rUnitConverter.convertPercent( nTmpValue, rStrValue );
+ aGradient.Border = nTmpValue;
+ break;
+
+ default:
+ DBG_WARNING( "Unknown token at import transparency gradient style" )
+ ;
+ }
+ }
+
+ rValue <<= aGradient;
+
+ bRet = bHasName && bHasStyle;
+
+ return bRet;
+}
diff --git a/xmloff/source/style/XMLClipPropertyHandler.cxx b/xmloff/source/style/XMLClipPropertyHandler.cxx
new file mode 100644
index 000000000000..f085e3cb6213
--- /dev/null
+++ b/xmloff/source/style/XMLClipPropertyHandler.cxx
@@ -0,0 +1,179 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLClipPropertyHandler.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLCLIPPROPERTYHANDLER_HXX
+#include "XMLClipPropertyHandler.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_GRAPHICCROP_HPP_
+#include <com/sun/star/text/GraphicCrop.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include <xmlkywd.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::text;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+XMLClipPropertyHandler::~XMLClipPropertyHandler()
+{
+ // nothing to do
+}
+
+sal_Bool XMLClipPropertyHandler::equals(
+ const Any& r1,
+ const Any& r2 ) const
+{
+ GraphicCrop aCrop1, aCrop2;
+ r1 >>= aCrop1;
+ r2 >>= aCrop2;
+
+ return aCrop1.Top == aCrop2.Top &&
+ aCrop1.Bottom == aCrop2.Bottom &&
+ aCrop1.Left == aCrop2.Left &&
+ aCrop1.Right == aCrop2.Right;
+}
+
+sal_Bool XMLClipPropertyHandler::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nLen = rStrImpValue.getLength();
+ if( nLen > 6 &&
+ 0 == rStrImpValue.compareToAscii( sXML_rect, 4 ) &&
+ rStrImpValue[4] == '(' &&
+ rStrImpValue[nLen-1] == ')' )
+ {
+ GraphicCrop aCrop;
+ OUString sTmp( rStrImpValue.copy( 5, nLen-6 ) );
+ SvXMLTokenEnumerator aTokenEnum( sTmp );
+
+ sal_uInt16 nPos = 0;
+ OUString aToken;
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ sal_Int32 nVal = 0;
+ if( aToken.compareToAscii( sXML_auto ) != 0 &&
+ !rUnitConverter.convertMeasure( nVal, aToken ) )
+ break;
+
+ switch( nPos )
+ {
+ case 0: aCrop.Top = nVal; break;
+ case 1: aCrop.Right = nVal; break;
+ case 2: aCrop.Bottom = nVal; break;
+ case 3: aCrop.Left = nVal; break;
+ }
+ nPos++;
+ }
+
+ bRet = (4 == nPos );
+ if( bRet )
+ rValue <<= aCrop;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLClipPropertyHandler::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut(30);
+ GraphicCrop aCrop;
+
+ if( rValue >>= aCrop )
+ {
+ aOut.appendAscii( sXML_rect );
+ aOut.append( (sal_Unicode)'(' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Top );
+ aOut.append( (sal_Unicode)' ' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Right );
+ aOut.append( (sal_Unicode)' ' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Bottom );
+ aOut.append( (sal_Unicode)' ' );
+ rUnitConverter.convertMeasure( aOut, aCrop.Left );
+ aOut.append( (sal_Unicode)')' );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
diff --git a/xmloff/source/style/XMLElementPropertyContext.cxx b/xmloff/source/style/XMLElementPropertyContext.cxx
new file mode 100644
index 000000000000..5ec0060b320f
--- /dev/null
+++ b/xmloff/source/style/XMLElementPropertyContext.cxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: XMLElementPropertyContext.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_XMLELEMENTPROPERTYCONTEXT_HXX
+#include "XMLElementPropertyContext.hxx"
+#endif
+
+using namespace ::rtl;
+
+
+TYPEINIT1( XMLElementPropertyContext , SvXMLImportContext );
+
+XMLElementPropertyContext::XMLElementPropertyContext (
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ aProp( rProp ),
+ rProperties( rProps ),
+ bInsert( sal_False )
+{
+}
+
+XMLElementPropertyContext::~XMLElementPropertyContext()
+{
+}
+
+void XMLElementPropertyContext::EndElement( )
+{
+ if( bInsert )
+ rProperties.push_back( aProp );
+}
+
+
diff --git a/xmloff/source/style/adjushdl.cxx b/xmloff/source/style/adjushdl.cxx
new file mode 100644
index 000000000000..36b1539a4594
--- /dev/null
+++ b/xmloff/source/style/adjushdl.cxx
@@ -0,0 +1,187 @@
+/*************************************************************************
+ *
+ * $RCSfile: adjushdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+#include <adjushdl.hxx>
+#endif
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_DRAWING_TEXTADJUST_HPP_
+#include <com/sun/star/drawing/TextAdjust.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::rtl;
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Para_Adjust_Enum[] =
+{
+ { sXML_start, drawing::TextAdjust_LEFT },
+ { sXML_end, drawing::TextAdjust_RIGHT },
+ { sXML_center, drawing::TextAdjust_CENTER },
+ { sXML_justify, drawing::TextAdjust_BLOCK },
+ { sXML_justified, drawing::TextAdjust_BLOCK }, // obsolete
+ { 0, 0 }
+};
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Para_Align_Last_Enum[] =
+{
+ { sXML_start, drawing::TextAdjust_LEFT },
+ { sXML_center, drawing::TextAdjust_CENTER },
+ { sXML_justify, drawing::TextAdjust_BLOCK },
+ { sXML_justified, drawing::TextAdjust_BLOCK }, // obsolete
+ { 0, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLParaAdjustPropHdl
+//
+
+XMLParaAdjustPropHdl::~XMLParaAdjustPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLParaAdjustPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 eAdjust;
+
+ if( ( bRet = rUnitConverter.convertEnum( eAdjust, rStrImpValue, pXML_Para_Adjust_Enum ) ) )
+ rValue <<= (sal_Int16)eAdjust;
+
+ return bRet;
+}
+
+sal_Bool XMLParaAdjustPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+ sal_Int16 nVal;
+
+ rValue >>= nVal;
+
+ sal_Bool bRet = rUnitConverter.convertEnum( aOut, nVal, pXML_Para_Adjust_Enum, sXML_start );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLLastLineAdjustPropHdl
+//
+
+XMLLastLineAdjustPropHdl::~XMLLastLineAdjustPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLastLineAdjustPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 eAdjust;
+
+ if( ( bRet = rUnitConverter.convertEnum( eAdjust, rStrImpValue, pXML_Para_Align_Last_Enum ) ) )
+ rValue <<= (sal_Int16)eAdjust;
+
+ return bRet;
+}
+
+sal_Bool XMLLastLineAdjustPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+ sal_Int16 nVal;
+ sal_Bool bRet = sal_False;
+
+ rValue >>= nVal;
+
+ if( nVal != drawing::TextAdjust_LEFT )
+ bRet = rUnitConverter.convertEnum( aOut, nVal, pXML_Para_Align_Last_Enum, sXML_start );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
diff --git a/xmloff/source/style/adjushdl.hxx b/xmloff/source/style/adjushdl.hxx
new file mode 100644
index 000000000000..e8d6a83de3e6
--- /dev/null
+++ b/xmloff/source/style/adjushdl.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: adjushdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLParaAdjustPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLParaAdjustPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLLastLineAdjustPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLastLineAdjustPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
diff --git a/xmloff/source/style/backhdl.cxx b/xmloff/source/style/backhdl.cxx
new file mode 100644
index 000000000000..1c8fe737061e
--- /dev/null
+++ b/xmloff/source/style/backhdl.cxx
@@ -0,0 +1,340 @@
+/*************************************************************************
+ *
+ * $RCSfile: backhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
+#include <backhdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvXMLEnumMapEntry psXML_BrushHorizontalPos[] =
+{
+ { sXML_left, style::GraphicLocation_LEFT_MIDDLE },
+ { sXML_right, style::GraphicLocation_RIGHT_MIDDLE },
+ { 0, 0 }
+};
+
+SvXMLEnumMapEntry psXML_BrushVerticalPos[] =
+{
+ { sXML_top, style::GraphicLocation_MIDDLE_TOP },
+ { sXML_bottom, style::GraphicLocation_MIDDLE_BOTTOM },
+ { 0, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLBackGraphicPositionPropHdl
+//
+
+XMLBackGraphicPositionPropHdl::~XMLBackGraphicPositionPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLBackGraphicPositionPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter )
+{
+ sal_Bool bRet = sal_True;
+ style::GraphicLocation ePos = style::GraphicLocation_NONE, eTmp;
+ sal_uInt16 nTmp;
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ OUString aToken;
+ sal_Bool bHori = sal_False, bVert = sal_False;
+
+ while( bRet && aTokenEnum.getNextToken( aToken ) )
+ {
+ if( bHori && bVert )
+ {
+ bRet = sal_False;
+ }
+ else if( -1 != aToken.indexOf( sal_Unicode('%') ) )
+ {
+ long nPrc = 50;
+ if( rUnitConverter.convertPercent( nPrc, aToken ) )
+ {
+ if( !bHori )
+ {
+ ePos = nPrc < 25 ? style::GraphicLocation_LEFT_TOP :
+ (nPrc < 75 ? style::GraphicLocation_MIDDLE_MIDDLE :
+ style::GraphicLocation_RIGHT_BOTTOM);
+ bHori = sal_True;
+ }
+ else
+ {
+ eTmp = nPrc < 25 ? style::GraphicLocation_LEFT_TOP:
+ (nPrc < 75 ? style::GraphicLocation_LEFT_MIDDLE :
+ style::GraphicLocation_LEFT_BOTTOM);
+ MergeXMLVertPos( ePos, eTmp );
+ bVert = sal_True;
+ }
+ }
+ else
+ {
+ // wrong percentage
+ bRet = sal_False;
+ }
+ }
+ else if( aToken.compareToAscii( sXML_center ) )
+ {
+ if( bHori )
+ MergeXMLVertPos( ePos, style::GraphicLocation_MIDDLE_MIDDLE );
+ else if ( bVert )
+ MergeXMLHoriPos( ePos, style::GraphicLocation_MIDDLE_MIDDLE );
+ else
+ ePos = style::GraphicLocation_MIDDLE_MIDDLE;
+ }
+ else if( rUnitConverter.convertEnum( nTmp, aToken, psXML_BrushHorizontalPos ) )
+ {
+ if( bVert )
+ MergeXMLHoriPos( ePos, (style::GraphicLocation)nTmp );
+ else if( !bHori )
+ ePos = (style::GraphicLocation)nTmp;
+ else
+ bRet = sal_False;
+
+ bHori = sal_True;
+ }
+ else if( rUnitConverter.convertEnum( nTmp, aToken, psXML_BrushVerticalPos ) )
+ {
+ if( bHori )
+ MergeXMLVertPos( ePos, (style::GraphicLocation)nTmp );
+ else if( !bVert )
+ ePos = (style::GraphicLocation)nTmp;
+ else
+ bRet = sal_False;
+ bVert = sal_True;
+ }
+ else
+ {
+ bRet = sal_False;
+ }
+ }
+
+ bRet &= style::GraphicLocation_NONE != ePos;
+ if( bRet )
+ rValue <<= (style::GraphicLocation)(sal_uInt16)ePos;
+
+ return bRet;
+}
+
+sal_Bool XMLBackGraphicPositionPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_True;
+ OUStringBuffer aOut;
+
+ style::GraphicLocation eLocation;
+ if( !( rValue >>= eLocation ) )
+ {
+ sal_Int32 nValue;
+ if( rValue >>= nValue )
+ eLocation = (style::GraphicLocation)nValue;
+ else
+ bRet = sal_False;
+ }
+
+ if( bRet )
+ {
+ bRet = sal_False;
+
+ switch( eLocation )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_RIGHT_TOP:
+ aOut.appendAscii( sXML_top );
+ bRet = sal_True;
+ break;
+ case style::GraphicLocation_LEFT_MIDDLE:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ aOut.appendAscii( sXML_center );
+ bRet = sal_True;
+ break;
+ case style::GraphicLocation_LEFT_BOTTOM:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ aOut.appendAscii( sXML_bottom );
+ bRet = sal_True;
+ break;
+ }
+
+ if( bRet )
+ {
+ aOut.append( sal_Unicode( ' ' ) );
+
+ switch( eLocation )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_LEFT_BOTTOM:
+ case style::GraphicLocation_LEFT_MIDDLE:
+ aOut.appendAscii( sXML_left );
+ break;
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ aOut.appendAscii( sXML_center );
+ break;
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ case style::GraphicLocation_RIGHT_TOP:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ aOut.appendAscii( sXML_right );
+ break;
+ }
+ }
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+void XMLBackGraphicPositionPropHdl::MergeXMLVertPos( style::GraphicLocation& ePos, style::GraphicLocation eVert )
+{
+ switch( ePos )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_LEFT_MIDDLE:
+ case style::GraphicLocation_LEFT_BOTTOM:
+ ePos = style::GraphicLocation_MIDDLE_TOP==eVert ?
+ style::GraphicLocation_LEFT_TOP :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eVert ?
+ style::GraphicLocation_LEFT_MIDDLE :
+ style::GraphicLocation_LEFT_BOTTOM);
+ ePos = eVert;
+ break;
+
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ ePos = eVert;
+ break;
+
+ case style::GraphicLocation_RIGHT_TOP:
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ ePos = style::GraphicLocation_MIDDLE_TOP==eVert ?
+ style::GraphicLocation_RIGHT_TOP :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eVert ?
+ style::GraphicLocation_RIGHT_MIDDLE :
+ style::GraphicLocation_RIGHT_BOTTOM);
+ break;
+ }
+}
+
+void XMLBackGraphicPositionPropHdl::MergeXMLHoriPos( style::GraphicLocation& ePos, style::GraphicLocation eHori )
+{
+ DBG_ASSERT( style::GraphicLocation_LEFT_MIDDLE==eHori || style::GraphicLocation_MIDDLE_MIDDLE==eHori || style::GraphicLocation_RIGHT_MIDDLE==eHori,
+ "lcl_frmitems_MergeXMLHoriPos: vertical pos must be middle" );
+
+ switch( ePos )
+ {
+ case style::GraphicLocation_LEFT_TOP:
+ case style::GraphicLocation_MIDDLE_TOP:
+ case style::GraphicLocation_RIGHT_TOP:
+ ePos = style::GraphicLocation_LEFT_MIDDLE==eHori ?
+ style::GraphicLocation_LEFT_TOP :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eHori ?
+ style::GraphicLocation_MIDDLE_TOP :
+ style::GraphicLocation_RIGHT_TOP);
+ break;
+
+ case style::GraphicLocation_LEFT_MIDDLE:
+ case style::GraphicLocation_MIDDLE_MIDDLE:
+ case style::GraphicLocation_RIGHT_MIDDLE:
+ ePos = eHori;
+ break;
+
+ case style::GraphicLocation_LEFT_BOTTOM:
+ case style::GraphicLocation_MIDDLE_BOTTOM:
+ case style::GraphicLocation_RIGHT_BOTTOM:
+ ePos = style::GraphicLocation_LEFT_MIDDLE==eHori ?
+ style::GraphicLocation_LEFT_BOTTOM :
+ (style::GraphicLocation_MIDDLE_MIDDLE==eHori ?
+ style::GraphicLocation_MIDDLE_BOTTOM :
+ style::GraphicLocation_RIGHT_BOTTOM);
+ break;
+ }
+}
+
diff --git a/xmloff/source/style/backhdl.hxx b/xmloff/source/style/backhdl.hxx
new file mode 100644
index 000000000000..293867c22068
--- /dev/null
+++ b/xmloff/source/style/backhdl.hxx
@@ -0,0 +1,94 @@
+/*************************************************************************
+ *
+ * $RCSfile: backhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_GRAPHICLOCATION_HPP_
+#include <com/sun/star/style/GraphicLocation.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_GRAPHICLOCATION_HPP_
+#include <com/sun/star/style/GraphicLocation.hpp>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLBackGraphicPositionPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBackGraphicPositionPropHdl();
+
+ /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter );
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+
+private:
+ void MergeXMLHoriPos( ::com::sun::star::style::GraphicLocation& ePos, ::com::sun::star::style::GraphicLocation eHori );
+ void MergeXMLVertPos( ::com::sun::star::style::GraphicLocation& ePos, ::com::sun::star::style::GraphicLocation eVert );
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BRUSHTYPES_HXX
diff --git a/xmloff/source/style/bordrhdl.cxx b/xmloff/source/style/bordrhdl.cxx
new file mode 100644
index 000000000000..99e5dda6511e
--- /dev/null
+++ b/xmloff/source/style/bordrhdl.cxx
@@ -0,0 +1,499 @@
+/*************************************************************************
+ *
+ * $RCSfile: bordrhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BORDERTYPES_HXX
+#include <bordrhdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_
+#include <com/sun/star/table/BorderLine.hpp>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// copied from svx/boxitem.hxx
+#define DEF_LINE_WIDTH_0 1
+#define DEF_LINE_WIDTH_1 35
+#define DEF_LINE_WIDTH_2 88
+#define DEF_LINE_WIDTH_3 141
+#define DEF_LINE_WIDTH_4 176
+
+#define DEF_MAX_LINE_WIDHT DEF_LINE_WIDTH_4
+#define DEF_MAX_LINE_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE0_OUT DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE0_IN DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE0_DIST DEF_LINE_WIDTH_1
+
+#define DEF_DOUBLE_LINE1_OUT DEF_LINE_WIDTH_1
+#define DEF_DOUBLE_LINE1_IN DEF_LINE_WIDTH_1
+#define DEF_DOUBLE_LINE1_DIST DEF_LINE_WIDTH_1
+
+#define DEF_DOUBLE_LINE2_OUT DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE2_IN DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE2_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE3_OUT DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE3_IN DEF_LINE_WIDTH_1
+#define DEF_DOUBLE_LINE3_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE4_OUT DEF_LINE_WIDTH_1
+#define DEF_DOUBLE_LINE4_IN DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE4_DIST DEF_LINE_WIDTH_1
+
+#define DEF_DOUBLE_LINE5_OUT DEF_LINE_WIDTH_3
+#define DEF_DOUBLE_LINE5_IN DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE5_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE6_OUT DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE6_IN DEF_LINE_WIDTH_3
+#define DEF_DOUBLE_LINE6_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE7_OUT DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE7_IN DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE7_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE8_OUT DEF_LINE_WIDTH_1
+#define DEF_DOUBLE_LINE8_IN DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE8_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE9_OUT DEF_LINE_WIDTH_2
+#define DEF_DOUBLE_LINE9_IN DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE9_DIST DEF_LINE_WIDTH_2
+
+#define DEF_DOUBLE_LINE10_OUT DEF_LINE_WIDTH_3
+#define DEF_DOUBLE_LINE10_IN DEF_LINE_WIDTH_0
+#define DEF_DOUBLE_LINE10_DIST DEF_LINE_WIDTH_2
+
+// finished copy
+
+#define SVX_XML_BORDER_STYLE_NONE 0
+#define SVX_XML_BORDER_STYLE_SOLID 1
+#define SVX_XML_BORDER_STYLE_DOUBLE 2
+
+#define SVX_XML_BORDER_WIDTH_THIN 0
+#define SVX_XML_BORDER_WIDTH_MIDDLE 1
+#define SVX_XML_BORDER_WIDTH_THICK 2
+
+SvXMLEnumMapEntry psXML_BorderStyles[] =
+{
+ { sXML_none, SVX_XML_BORDER_STYLE_NONE },
+ { sXML_hidden, SVX_XML_BORDER_STYLE_NONE },
+ { sXML_solid, SVX_XML_BORDER_STYLE_SOLID },
+ { sXML_double, SVX_XML_BORDER_STYLE_DOUBLE },
+ { sXML_dotted, SVX_XML_BORDER_STYLE_SOLID },
+ { sXML_dashed, SVX_XML_BORDER_STYLE_SOLID },
+ { sXML_groove, SVX_XML_BORDER_STYLE_SOLID },
+ { sXML_ridge, SVX_XML_BORDER_STYLE_SOLID },
+ { sXML_inset, SVX_XML_BORDER_STYLE_SOLID },
+ { sXML_outset, SVX_XML_BORDER_STYLE_SOLID },
+ { 0, 0 }
+};
+
+SvXMLEnumMapEntry psXML_NamedBorderWidths[] =
+{
+ { sXML_thin, SVX_XML_BORDER_WIDTH_THIN },
+ { sXML_middle, SVX_XML_BORDER_WIDTH_MIDDLE },
+ { sXML_thick, SVX_XML_BORDER_WIDTH_THICK },
+ { 0, 0 }
+};
+// mapping tables to map external xml input to intarnal box line widths
+
+// Ein Eintrag besteht aus vier USHORTs. Der erste ist die Gesamtbreite,
+// die anderen sind die 3 Einzelbreiten
+
+#define SBORDER_ENTRY( n ) \
+ DEF_LINE_WIDTH_##n, DEF_LINE_WIDTH_##n, 0, 0
+
+#define DBORDER_ENTRY( n ) \
+ DEF_DOUBLE_LINE##n##_OUT + DEF_DOUBLE_LINE##n##_IN + \
+ DEF_DOUBLE_LINE##n##_DIST, \
+ DEF_DOUBLE_LINE##n##_OUT, \
+ DEF_DOUBLE_LINE##n##_IN, \
+ DEF_DOUBLE_LINE##n##_DIST
+
+#define TDBORDER_ENTRY( n ) \
+ DEF_DOUBLE_LINE##n##_OUT, \
+ DEF_DOUBLE_LINE##n##_OUT, \
+ DEF_DOUBLE_LINE##n##_IN, \
+ DEF_DOUBLE_LINE##n##_DIST
+
+
+static sal_uInt16 __READONLY_DATA aSBorderWidths[] =
+{
+ SBORDER_ENTRY( 0 ), SBORDER_ENTRY( 1 ), SBORDER_ENTRY( 2 ),
+ SBORDER_ENTRY( 3 ), SBORDER_ENTRY( 4 )
+};
+
+static sal_uInt16 __READONLY_DATA aDBorderWidths[] =
+{
+ DBORDER_ENTRY( 0 ),
+ DBORDER_ENTRY( 7 ),
+ DBORDER_ENTRY( 1 ),
+ DBORDER_ENTRY( 8 ),
+ DBORDER_ENTRY( 4 ),
+ DBORDER_ENTRY( 9 ),
+ DBORDER_ENTRY( 3 ),
+ DBORDER_ENTRY( 10 ),
+ DBORDER_ENTRY( 2 ),
+ DBORDER_ENTRY( 6 ),
+ DBORDER_ENTRY( 5 )
+};
+
+void lcl_frmitems_setXMLBorderWidth( table::BorderLine &rBorderLine,
+ sal_uInt16 nWidth, sal_Bool bDouble )
+{
+#ifdef XML_CHECK_UI_CONTSTRAINS
+ const sal_uInt16 *aWidths;
+ sal_uInt16 nSize;
+ if( !bDouble )
+ {
+ aWidths = aSBorderWidths;
+ nSize = sizeof( aSBorderWidths );
+ }
+ else
+ {
+ aWidths = aDBorderWidths;
+ nSize = sizeof( aDBorderWidths );
+ }
+
+ sal_uInt16 i = (nSize / sizeof(sal_uInt16)) - 4;
+ while( i>0 &&
+ nWidth <= ((aWidths[i] + aWidths[i-4]) / 2) )
+ {
+ i -= 4;
+ }
+
+ rBorderLine.OuterLineWidth = aWidths[i+1];
+ rBorderLine.InnerLineWidth = aWidths[i+2];
+ rBorderLine.LineDistance = aWidths[i+3];
+#else
+ if( bDouble )
+ {
+ const sal_uInt16 *aWidths = aDBorderWidths;
+ sal_uInt16 nSize = sizeof( aDBorderWidths );
+ sal_uInt16 i = (nSize / sizeof(sal_uInt16)) - 4;
+ while( i>0 &&
+ nWidth <= ((aWidths[i] + aWidths[i-4]) / 2) )
+ {
+ i -= 4;
+ }
+
+ rBorderLine.OuterLineWidth = aWidths[i+1];
+ rBorderLine.InnerLineWidth = aWidths[i+2];
+ rBorderLine.LineDistance = aWidths[i+3];
+ }
+ else
+ {
+ rBorderLine.OuterLineWidth = 0 == nWidth ? DEF_LINE_WIDTH_0 : nWidth;
+ rBorderLine.InnerLineWidth = 0;
+ rBorderLine.LineDistance = 0;
+
+ }
+#endif
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLBorderWidthHdl::~XMLBorderWidthHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBorderWidthHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+
+ sal_Int32 nInWidth, nDistance, nOutWidth;
+
+ OUString aToken;
+ if( !aTokenEnum.getNextToken( aToken ) )
+ return sal_False;
+
+ if( !rUnitConverter.convertMeasure( nInWidth, aToken, 0, 500 ) )
+ return sal_False;
+
+ if( !aTokenEnum.getNextToken( aToken ) )
+ return sal_False;
+
+ if( !rUnitConverter.convertMeasure( nDistance, aToken, 0, 500 ) )
+ return sal_False;
+
+ if( !aTokenEnum.getNextToken( aToken ) )
+ return sal_False;
+
+ if( !rUnitConverter.convertMeasure( nOutWidth, aToken, 0, 500 ) )
+ return sal_False;
+
+#ifdef XML_CHECK_UI_CONSTRAINS
+ sal_uInt16 nSize = sizeof( aDBorderWidths );
+ for( sal_uInt16 i=0; i < nSize; i += 4 )
+ {
+ if( aDBorderWidths[i+1] == nOutWidth &&
+ aDBorderWidths[i+2] == nInWidth &&
+ aDBorderWidths[i+3] == nDistance )
+ break;
+ }
+
+ sal_uInt16 nWidth = i < nSize ? 0 : nOutWidth + nInWidth + nDistance;
+#endif
+
+ table::BorderLine aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ aBorderLine.Color = 0;
+
+ aBorderLine.InnerLineWidth = nInWidth;
+ aBorderLine.OuterLineWidth = nOutWidth;
+ aBorderLine.LineDistance = nDistance;
+
+ rValue <<= aBorderLine;
+ return sal_True;
+}
+
+sal_Bool XMLBorderWidthHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ table::BorderLine aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ return sal_False;
+
+ if( aBorderLine.LineDistance == 0 && aBorderLine.InnerLineWidth == 0)
+ return sal_False;
+
+ rUnitConverter.convertMeasure( aOut, aBorderLine.InnerLineWidth );
+ aOut.append( sal_Unicode( ' ' ) );
+ rUnitConverter.convertMeasure( aOut, aBorderLine.LineDistance );
+ aOut.append( sal_Unicode( ' ' ) );
+ rUnitConverter.convertMeasure( aOut, aBorderLine.OuterLineWidth );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLBorderHdl::~XMLBorderHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBorderHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUString aToken;
+ SvXMLTokenEnumerator aTokens( rStrImpValue );
+
+ sal_Bool bHasStyle = sal_False;
+ sal_Bool bHasWidth = sal_False;
+ sal_Bool bHasColor = sal_False;
+
+ sal_uInt16 nStyle = USHRT_MAX;
+ sal_uInt16 nWidth = 0;
+ sal_uInt16 nNamedWidth = USHRT_MAX;
+ Color aColor;
+
+ long nTemp;
+ while( aTokens.getNextToken( aToken ) && aToken.getLength() != 0 )
+ {
+ if( !bHasWidth &&
+ rUnitConverter.convertEnum( nNamedWidth, aToken,
+ psXML_NamedBorderWidths ) )
+ {
+ bHasWidth = sal_True;
+ }
+ else if( !bHasStyle &&
+ rUnitConverter.convertEnum( nStyle, aToken,
+ psXML_BorderStyles ) )
+ {
+ bHasStyle = sal_True;
+ }
+ else if( !bHasColor && rUnitConverter.convertColor( aColor, aToken ) )
+ {
+ bHasColor = sal_True;
+ }
+ else if( !bHasWidth &&
+ rUnitConverter.convertMeasure( nTemp, aToken, 0,
+ USHRT_MAX ) )
+ {
+ nWidth = (sal_uInt16)nTemp;
+ bHasWidth = sal_True;
+ }
+ else
+ {
+ // missformed
+ return sal_False;
+ }
+ }
+
+ // if there is no line and no style and no with, there will never be a line
+ if( !(bHasStyle && bHasWidth) )
+ return sal_False;
+
+ table::BorderLine aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ {
+ aBorderLine.Color = 0;
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = 0;
+ aBorderLine.LineDistance = 0;
+ }
+
+ // first of all, delete an empty line
+ sal_Bool bDouble = SVX_XML_BORDER_STYLE_DOUBLE == nStyle;
+ if( (bHasStyle && SVX_XML_BORDER_STYLE_NONE == nStyle) ||
+ (bHasWidth && USHRT_MAX == nNamedWidth && 0 == nWidth) )
+ {
+ aBorderLine.InnerLineWidth = 0;
+ aBorderLine.OuterLineWidth = 0;
+ aBorderLine.LineDistance = 0;
+ }
+ else if( bHasWidth )
+ {
+ if( USHRT_MAX != nNamedWidth )
+ {
+ const sal_uInt16 *aWidths = bDouble ? aDBorderWidths
+ : aSBorderWidths;
+ sal_uInt16 nNWidth = nNamedWidth * 4;
+ aBorderLine.OuterLineWidth = aWidths[nNWidth+1];
+ aBorderLine.InnerLineWidth = aWidths[nNWidth+2];
+ aBorderLine.LineDistance = aWidths[nNWidth+3];
+ }
+ else
+ {
+ lcl_frmitems_setXMLBorderWidth( aBorderLine, nWidth, bDouble );
+ }
+ }
+ else
+ {
+ lcl_frmitems_setXMLBorderWidth( aBorderLine, 0, bDouble );
+ }
+
+ // set color
+ if( bHasColor )
+ aBorderLine.Color = (sal_Int32)aColor.GetRGBColor();
+
+ rValue <<= aBorderLine;
+ return sal_True;
+}
+
+sal_Bool XMLBorderHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ table::BorderLine aBorderLine;
+ if(!(rValue >>= aBorderLine))
+ return sal_False;
+
+ sal_Int32 nWidth = aBorderLine.OuterLineWidth;
+ const sal_uInt16 nDistance = aBorderLine.LineDistance;
+ if( 0 != nDistance )
+ {
+ nWidth += nDistance;
+ nWidth += aBorderLine.InnerLineWidth;
+ }
+
+ if( nWidth == 0 )
+ return sal_False;
+
+ char *pStyle = (0 == nDistance) ? sXML_solid : sXML_double;
+
+ rUnitConverter.convertMeasure( aOut, nWidth );
+
+ aOut.append( sal_Unicode( ' ' ) );
+
+ aOut.appendAscii( pStyle );
+
+ aOut.append( sal_Unicode( ' ' ) );
+
+ rUnitConverter.convertColor( aOut, aBorderLine.Color );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
diff --git a/xmloff/source/style/bordrhdl.hxx b/xmloff/source/style/bordrhdl.hxx
new file mode 100644
index 000000000000..068df62f9ad3
--- /dev/null
+++ b/xmloff/source/style/bordrhdl.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: bordrhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BORDERTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BORDERTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLBorderWidthHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBorderWidthHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLBorderHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBorderHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+
diff --git a/xmloff/source/style/breakhdl.cxx b/xmloff/source/style/breakhdl.cxx
new file mode 100644
index 000000000000..a7a365c228eb
--- /dev/null
+++ b/xmloff/source/style/breakhdl.cxx
@@ -0,0 +1,229 @@
+/*************************************************************************
+ *
+ * $RCSfile: breakhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+#include <breakhdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_BREAKTYPE_HPP_
+#include <com/sun/star/style/BreakType.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvXMLEnumMapEntry psXML_BreakTypes[] =
+{
+ { sXML_auto, 0 },
+ { sXML_column, 1 },
+ { sXML_page, 2 },
+ { sXML_even_page, 2 },
+ { sXML_odd_page, 2 },
+ { 0, 0}
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtBreakBeforePropHdl
+//
+
+XMLFmtBreakBeforePropHdl::~XMLFmtBreakBeforePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFmtBreakBeforePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ style::BreakType eBreak = style::BreakType_NONE;
+ sal_uInt16 nEnum;
+
+ if( ( bRet = rUnitConverter.convertEnum( nEnum, rStrImpValue, psXML_BreakTypes ) ) )
+ {
+ if( nEnum != 0 )
+ eBreak = ( nEnum == 1 ) ? style::BreakType_COLUMN_BEFORE : style::BreakType_PAGE_BEFORE;
+
+ rValue <<= eBreak;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFmtBreakBeforePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ style::BreakType eBreak;
+
+ if( !( rValue >>= eBreak ) )
+ {
+ sal_Int32 nValue;
+ if( !( rValue >>= nValue ) )
+ return sal_False;
+
+ eBreak = (style::BreakType) nValue;
+ }
+
+ sal_uInt16 nEnum = 0;
+ switch( eBreak )
+ {
+ case style::BreakType_COLUMN_BEFORE:
+ nEnum = 1;
+ break;
+ case style::BreakType_PAGE_BEFORE:
+ nEnum = 2;
+ break;
+ case style::BreakType_NONE:
+ nEnum = 0;
+ break;
+ default:
+ return sal_False;
+ }
+
+ OUStringBuffer aOut;
+ sal_Bool bOk = rUnitConverter.convertEnum( aOut, nEnum, psXML_BreakTypes );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtBreakBeforePropHdl
+//
+
+XMLFmtBreakAfterPropHdl::~XMLFmtBreakAfterPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFmtBreakAfterPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ style::BreakType eBreak = style::BreakType_NONE;
+ sal_uInt16 nEnum;
+
+ if( ( bRet = rUnitConverter.convertEnum( nEnum, rStrImpValue, psXML_BreakTypes ) ) )
+ {
+ if( nEnum != 0 )
+ eBreak = ( nEnum == 1 ) ? style::BreakType_COLUMN_AFTER : style::BreakType_PAGE_AFTER;
+
+ rValue <<= eBreak;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFmtBreakAfterPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ style::BreakType eBreak;
+
+ if( !( rValue >>= eBreak ) )
+ {
+ sal_Int32 nValue;
+ if( !( rValue >>= nValue ) )
+ return sal_False;
+
+ eBreak = (style::BreakType) nValue;
+ }
+
+ sal_uInt16 nEnum = 0;
+ switch( eBreak )
+ {
+ case style::BreakType_COLUMN_AFTER:
+ nEnum = 1;
+ break;
+ case style::BreakType_PAGE_AFTER:
+ nEnum = 2;
+ break;
+ case style::BreakType_NONE:
+ nEnum = 0;
+ break;
+ default:
+ return sal_False;
+ }
+
+ OUStringBuffer aOut;
+ sal_Bool bOk = rUnitConverter.convertEnum( aOut, nEnum, psXML_BreakTypes );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
diff --git a/xmloff/source/style/breakhdl.hxx b/xmloff/source/style/breakhdl.hxx
new file mode 100644
index 000000000000..3015e149a377
--- /dev/null
+++ b/xmloff/source/style/breakhdl.hxx
@@ -0,0 +1,93 @@
+/*************************************************************************
+ *
+ * $RCSfile: breakhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFmtBreakBeforePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFmtBreakBeforePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFmtBreakAfterPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFmtBreakAfterPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
diff --git a/xmloff/source/style/cdouthdl.cxx b/xmloff/source/style/cdouthdl.cxx
new file mode 100644
index 000000000000..ee31909b7071
--- /dev/null
+++ b/xmloff/source/style/cdouthdl.cxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * $RCSfile: cdouthdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+#include <cdouthdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvXMLEnumMapEntry pXML_Crossedout_Enum[] =
+{
+ { sXML_crossedout_none, STRIKEOUT_NONE },
+ { sXML_crossedout_single, STRIKEOUT_SINGLE },
+ { sXML_crossedout_double, STRIKEOUT_DOUBLE },
+ { sXML_crossedout_thick, STRIKEOUT_BOLD },
+ { sXML_crossedout_slash, STRIKEOUT_SLASH },
+ { sXML_crossedout_cross, STRIKEOUT_X }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPosturePropHdl
+//
+
+XMLCrossedOutPropHdl::~XMLCrossedOutPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCrossedOutPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 eCross;
+
+ if( ( bRet = rUnitConverter.convertEnum( eCross, rStrImpValue, pXML_Crossedout_Enum ) ) )
+ rValue <<= (sal_Int16)eCross;
+
+ return bRet;
+}
+
+sal_Bool XMLCrossedOutPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue;
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ if( ( bRet = rUnitConverter.convertEnum( aOut, (sal_uInt16)nValue, pXML_Crossedout_Enum ) ) )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
diff --git a/xmloff/source/style/cdouthdl.hxx b/xmloff/source/style/cdouthdl.hxx
new file mode 100644
index 000000000000..fd673765be4f
--- /dev/null
+++ b/xmloff/source/style/cdouthdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: cdouthdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCrossedOutPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCrossedOutPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
diff --git a/xmloff/source/style/chrhghdl.cxx b/xmloff/source/style/chrhghdl.cxx
new file mode 100644
index 000000000000..c8c75d054140
--- /dev/null
+++ b/xmloff/source/style/chrhghdl.cxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * $RCSfile: chrhghdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+#include <chrhghdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLCharHeightHdl::~XMLCharHeightHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharHeightHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Int32 nAbs = 0;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) == -1 )
+ {
+ if( SvXMLUnitConverter::convertMeasure( nAbs, rStrImpValue, MAP_POINT ) )
+ {
+ rValue <<= (float)nAbs;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLCharHeightHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ float nAbs = 0;
+ if( rValue >>= nAbs )
+ {
+ SvXMLUnitConverter::convertMeasure( aOut, nAbs, MAP_POINT, MAP_POINT );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLCharHeightPropHdl::~XMLCharHeightPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharHeightPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Int32 nPrc = 100;
+
+ if( rStrImpValue.indexOf( sal_Unicode('%') ) != -1 )
+ {
+ if( rUnitConverter.convertPercent( nPrc, rStrImpValue ) )
+ {
+ rValue <<= nPrc;
+ return sal_True;
+ }
+ }
+
+ return sal_False;
+}
+
+sal_Bool XMLCharHeightPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut( rStrExpValue );
+
+ sal_Int32 nValue;
+ if( rValue >>= nValue )
+ {
+ rUnitConverter.convertPercent( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
diff --git a/xmloff/source/style/chrhghdl.hxx b/xmloff/source/style/chrhghdl.hxx
new file mode 100644
index 000000000000..203ad88d00e3
--- /dev/null
+++ b/xmloff/source/style/chrhghdl.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: chrhghdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCharHeightHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharHeightHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCharHeightPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharHeightPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+
diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx
new file mode 100644
index 000000000000..cec236f28779
--- /dev/null
+++ b/xmloff/source/style/chrlohdl.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * $RCSfile: chrlohdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+#include <chrlohdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_
+#include <com/sun/star/lang/Locale.hpp>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLCharLanguageHdl::~XMLCharLanguageHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharLanguageHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
+{
+ sal_Bool bRet = sal_False;
+ lang::Locale aLocale1, aLocale2;
+
+ if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
+ bRet = ( aLocale1.Language == aLocale2.Language );
+
+ return bRet;
+}
+
+sal_Bool XMLCharLanguageHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ lang::Locale aLocale;
+
+ rValue >>= aLocale;
+
+ if( rStrImpValue.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_none ) ) != 0 )
+ aLocale.Language = rStrImpValue;
+
+ rValue <<= aLocale;
+ return sal_True;
+}
+
+sal_Bool XMLCharLanguageHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ lang::Locale aLocale;
+ if(!(rValue >>= aLocale))
+ return sal_False;
+
+ rStrExpValue = aLocale.Language;
+
+ if( !rStrExpValue.getLength() )
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_none ) );
+
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLCharCountryHdl::~XMLCharCountryHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCharCountryHdl::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
+{
+ sal_Bool bRet = sal_False;
+ lang::Locale aLocale1, aLocale2;
+
+ if( ( r1 >>= aLocale1 ) && ( r2 >>= aLocale2 ) )
+ bRet = ( aLocale1.Country == aLocale2.Country );
+
+ return bRet;
+}
+
+sal_Bool XMLCharCountryHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ lang::Locale aLocale;
+
+ rValue >>= aLocale;
+
+ if( rStrImpValue.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_none ) ) != 0 )
+ aLocale.Country = rStrImpValue;
+
+ rValue <<= aLocale;
+ return sal_True;
+}
+
+sal_Bool XMLCharCountryHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ lang::Locale aLocale;
+ if(!(rValue >>= aLocale))
+ return sal_False;
+
+ rStrExpValue = aLocale.Country;
+
+ if( !rStrExpValue.getLength() )
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_none ) );
+
+ return sal_True;
+}
diff --git a/xmloff/source/style/chrlohdl.hxx b/xmloff/source/style/chrlohdl.hxx
new file mode 100644
index 000000000000..1600e1d29c4a
--- /dev/null
+++ b/xmloff/source/style/chrlohdl.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * $RCSfile: chrlohdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCharLanguageHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharLanguageHdl();
+
+ virtual sal_Bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCharCountryHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCharCountryHdl();
+
+ virtual sal_Bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+
diff --git a/xmloff/source/style/csmaphdl.cxx b/xmloff/source/style/csmaphdl.cxx
new file mode 100644
index 000000000000..d75cd9b796f6
--- /dev/null
+++ b/xmloff/source/style/csmaphdl.cxx
@@ -0,0 +1,178 @@
+/*************************************************************************
+ *
+ * $RCSfile: csmaphdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+#include <csmaphdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_CASEMAP_HPP_
+#include <com/sun/star/style/CaseMap.hpp>
+#endif
+
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+static SvXMLEnumMapEntry pXML_Casemap_Enum[] =
+{
+ { sXML_none, style::CaseMap::NONE },
+ { sXML_casemap_lowercase, style::CaseMap::LOWERCASE },
+ { sXML_casemap_uppercase, style::CaseMap::UPPERCASE },
+ { sXML_casemap_capitalize, style::CaseMap::TITLE },
+ { 0,0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPosturePropHdl
+//
+
+XMLCaseMapPropHdl::~XMLCaseMapPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCaseMapPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nVal;
+
+ if( ( bRet = rUnitConverter.convertEnum( nVal, rStrImpValue, pXML_Casemap_Enum ) ) )
+ rValue <<= nVal;
+
+ return bRet;
+}
+
+sal_Bool XMLCaseMapPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nValue;
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ if( ( bRet = rUnitConverter.convertEnum( aOut, nValue, pXML_Casemap_Enum ) ) )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLCaseMapVariantHdl
+//
+
+XMLCaseMapVariantHdl::~XMLCaseMapVariantHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLCaseMapVariantHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ if( !rStrImpValue.compareToAscii( sXML_casemap_small_caps ) )
+ return sal_False;
+
+ rValue <<= (sal_Int16)style::CaseMap::SMALLCAPS;
+ return sal_True;
+}
+
+sal_Bool XMLCaseMapVariantHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_uInt16 nValue;
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ switch( nValue )
+ {
+ case style::CaseMap::NONE:
+ aOut.appendAscii( sXML_casemap_normal );
+ break;
+ case style::CaseMap::SMALLCAPS:
+ aOut.appendAscii( sXML_casemap_small_caps );
+ break;
+ }
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength();
+}
diff --git a/xmloff/source/style/csmaphdl.hxx b/xmloff/source/style/csmaphdl.hxx
new file mode 100644
index 000000000000..481fd91b1619
--- /dev/null
+++ b/xmloff/source/style/csmaphdl.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * $RCSfile: csmaphdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLCaseMapPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCaseMapPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLCaseMapVariantHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLCaseMapVariantHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
diff --git a/xmloff/source/style/escphdl.cxx b/xmloff/source/style/escphdl.cxx
new file mode 100644
index 000000000000..08b5f41acb47
--- /dev/null
+++ b/xmloff/source/style/escphdl.cxx
@@ -0,0 +1,216 @@
+/*************************************************************************
+ *
+ * $RCSfile: escphdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+#include <escphdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLEscapementPropHdl::~XMLEscapementPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLEscapementPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nVal;
+
+ SvXMLTokenEnumerator aTokens( rStrImpValue );
+
+ OUString aToken;
+ if( ! aTokens.getNextToken( aToken ) )
+ return sal_False;
+
+ if( aToken.compareToAscii( sXML_escapement_sub ) )
+ {
+ nVal = DFLT_ESC_AUTO_SUB;
+ }
+ else if( aToken.compareToAscii( sXML_escapement_super ) )
+ {
+ nVal = DFLT_ESC_AUTO_SUPER;
+ }
+ else
+ {
+ sal_Int32 nNewEsc;
+ if( !rUnitConverter.convertPercent( nNewEsc, aToken ) )
+ return sal_False;
+
+ nVal = (sal_Int16) nNewEsc;
+ }
+
+ rValue <<= nVal;
+ return sal_True;
+}
+
+sal_Bool XMLEscapementPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ if( nValue == DFLT_ESC_AUTO_SUPER )
+ {
+ aOut.appendAscii( sXML_escapement_super );
+ }
+ else if( nValue == DFLT_ESC_AUTO_SUB )
+ {
+ aOut.appendAscii( sXML_escapement_sub );
+ }
+ else
+ {
+ rUnitConverter.convertPercent( aOut, nValue );
+ }
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return sal_True;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementHeightPropHdl
+//
+
+XMLEscapementHeightPropHdl::~XMLEscapementHeightPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLEscapementHeightPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ if( !rStrImpValue.compareToAscii( sXML_casemap_small_caps ) )
+ return sal_False;
+
+ SvXMLTokenEnumerator aTokens( rStrImpValue );
+
+ OUString aToken;
+ if( ! aTokens.getNextToken( aToken ) )
+ return sal_False;
+
+ sal_Int8 nProp;
+ if( aTokens.getNextToken( aToken ) )
+ {
+ sal_Int32 nNewProp;
+ if( !rUnitConverter.convertPercent( nNewProp, aToken ) )
+ return sal_False;
+ nProp = (sal_Int8)nNewProp;
+ }
+ else
+ {
+ nProp = (sal_Int8) DFLT_ESC_PROP;
+ }
+
+ rValue <<= nProp;
+ return sal_True;
+}
+
+sal_Bool XMLEscapementHeightPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut( rStrExpValue );
+
+ sal_Int32 nValue;
+ if( rValue >>= nValue )
+ {
+ if( rStrExpValue.getLength() )
+ aOut.append( sal_Unicode(' '));
+
+ rUnitConverter.convertPercent( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength();
+}
diff --git a/xmloff/source/style/escphdl.hxx b/xmloff/source/style/escphdl.hxx
new file mode 100644
index 000000000000..8a4b03f41dfb
--- /dev/null
+++ b/xmloff/source/style/escphdl.hxx
@@ -0,0 +1,91 @@
+/*************************************************************************
+ *
+ * $RCSfile: escphdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLEscapementPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLEscapementPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLEscapementHeightPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLEscapementHeightPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+
diff --git a/xmloff/source/style/fonthdl.cxx b/xmloff/source/style/fonthdl.cxx
new file mode 100644
index 000000000000..56ac0f9dd3d4
--- /dev/null
+++ b/xmloff/source/style/fonthdl.cxx
@@ -0,0 +1,354 @@
+/*************************************************************************
+ *
+ * $RCSfile: fonthdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#include <fonthdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+static SvXMLEnumMapEntry __READONLY_DATA aFontFamilyGenericMapping[] =
+{
+ { sXML_decorative, FAMILY_DECORATIVE },
+
+ { sXML_modern, FAMILY_MODERN },
+ { sXML_roman, FAMILY_ROMAN },
+ { sXML_script, FAMILY_SCRIPT },
+ { sXML_swiss, FAMILY_SWISS },
+ { sXML_system, FAMILY_SYSTEM },
+ { 0, 0 }
+};
+
+static SvXMLEnumMapEntry __READONLY_DATA aFontPitchMapping[] =
+{
+ { sXML_fixed, PITCH_FIXED },
+ { sXML_variable, PITCH_VARIABLE },
+ { 0, 0 }
+};
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontFamilyNamePropHdl
+//
+
+XMLFontFamilyNamePropHdl::~XMLFontFamilyNamePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontFamilyNamePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ String sValue;
+ sal_Int32 nPos = 0;
+
+ do
+ {
+ sal_Int32 nFirst = nPos;
+ nPos = SvXMLUnitConverter::indexOfComma( rStrImpValue, nPos );
+ sal_Int32 nLast = (-1 == nPos ? rStrImpValue.getLength() : nPos);
+ if( nLast > 0 )
+ nLast--;
+
+ // skip trailing blanks
+ while( sal_Unicode(' ') == rStrImpValue[nLast] && nLast > nFirst )
+ nLast--;
+
+ // skip leading blanks
+ while( sal_Unicode(' ') == rStrImpValue[nFirst] && nFirst <= nLast )
+ nFirst++;
+
+ // remove quotes
+ sal_Unicode c = rStrImpValue[nFirst];
+ if( nFirst < nLast && (sal_Unicode('\'') == c || sal_Unicode('\"') == c) && rStrImpValue[nLast] == c )
+ {
+ nFirst++;
+ nLast--;
+ }
+
+ if( nFirst <= nLast )
+ {
+ if( sValue.Len() != 0 )
+ sValue += sal_Unicode(';');
+
+ OUString sTemp = rStrImpValue.copy( nFirst, nLast-nFirst+1 );
+ sValue += sTemp.getStr();
+ }
+
+ if( -1 != nPos )
+ nPos++;
+ }
+ while( -1 != nPos );
+
+ if( sValue.Len() )
+ {
+ rValue <<= OUString(sValue.GetBuffer());
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFontFamilyNamePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUString aStrFamilyName;
+
+ if( rValue >>= aStrFamilyName )
+ {
+ OUStringBuffer sValue( aStrFamilyName.getLength() + 2L );
+ sal_Int32 nPos = 0L;
+ do
+ {
+ sal_Int32 nFirst = nPos;
+ nPos = aStrFamilyName.indexOf( sal_Unicode(';'), nPos );
+ sal_Int32 nLast = (-1L == nPos ? aStrFamilyName.getLength() : nPos);
+ if( nLast > 0L )
+ nLast--;
+
+ // skip trailing blanks
+ while( sal_Unicode(' ') == aStrFamilyName[nLast] && nLast > nFirst )
+ nLast--;
+
+ // skip leading blanks
+ while( sal_Unicode(' ') == aStrFamilyName[nFirst] && nFirst <= nLast )
+ nFirst++;
+
+ if( nFirst <= nLast )
+ {
+ if( sValue.getLength() != 0L )
+ {
+ sValue.append( sal_Unicode( ',' ) );
+ sValue.append( sal_Unicode( ' ' ));
+ }
+ sal_Int32 nLen = nLast-nFirst+1L;
+ OUString sFamily( aStrFamilyName.copy( nFirst, nLen ) );
+ sal_Bool bQuote = sal_False;
+ for( sal_Int32 i=0; i < nLen; i++ )
+ {
+ sal_Unicode c = sFamily[i];
+ if( sal_Unicode(' ') == c || sal_Unicode(',') == c )
+ {
+ bQuote = sal_True;
+ break;
+ }
+ }
+ if( bQuote )
+ sValue.append( sal_Unicode('\'') );
+ sValue.append( sFamily );
+ if( bQuote )
+ sValue.append( sal_Unicode('\'') );
+ }
+
+ if( -1L != nPos )
+ nPos++;
+ }
+ while( -1L != nPos );
+
+ rStrExpValue = sValue.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontFamilyPropHdl
+//
+
+XMLFontFamilyPropHdl::~XMLFontFamilyPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontFamilyPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 eNewFamily;
+
+ if( ( bRet = rUnitConverter.convertEnum( eNewFamily, rStrImpValue, aFontFamilyGenericMapping ) ) )
+ rValue <<= eNewFamily;
+
+ return bRet;
+}
+
+sal_Bool XMLFontFamilyPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+
+ sal_Int16 nFamily;
+ if( rValue >>= nFamily )
+ {
+ FontFamily eFamily = (FontFamily)nFamily;
+ if( eFamily != FAMILY_DONTKNOW )
+ bRet = rUnitConverter.convertEnum( aOut, eFamily, aFontFamilyGenericMapping );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontEncodingPropHdl
+//
+
+XMLFontEncodingPropHdl::~XMLFontEncodingPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontEncodingPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_True;
+
+ if( rStrImpValue.compareToAscii( sXML_x_symbol ) )
+ rValue <<= (sal_Int16) RTL_TEXTENCODING_SYMBOL;
+
+ return bRet;
+}
+
+sal_Bool XMLFontEncodingPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Int16 nSet;
+
+ if( rValue >>= nSet )
+ {
+ if( (rtl_TextEncoding)nSet == RTL_TEXTENCODING_SYMBOL )
+ {
+ aOut.appendAscii( sXML_x_symbol );
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontPitchPropHdl
+//
+
+XMLFontPitchPropHdl::~XMLFontPitchPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontPitchPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ USHORT eNewPitch;
+
+ if( ( bRet = rUnitConverter.convertEnum( eNewPitch, rStrImpValue, aFontPitchMapping ) ) )
+ rValue <<= (sal_Int16)eNewPitch;
+
+ return bRet;
+}
+
+sal_Bool XMLFontPitchPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nPitch;
+ OUStringBuffer aOut;
+
+ FontPitch ePitch;
+ if( rValue >>= nPitch )
+ ePitch = (FontPitch)nPitch;
+
+ if( PITCH_DONTKNOW != ePitch )
+ {
+ bRet = rUnitConverter.convertEnum( aOut, ePitch, aFontPitchMapping, sXML_fixed );
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
diff --git a/xmloff/source/style/fonthdl.hxx b/xmloff/source/style/fonthdl.hxx
new file mode 100644
index 000000000000..b1350fc8f019
--- /dev/null
+++ b/xmloff/source/style/fonthdl.hxx
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * $RCSfile: fonthdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:04 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontFamilyNamePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontFamilyNamePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontFamilyPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontFamilyPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontEncodingPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontEncodingPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontPitchPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontPitchPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+#endif // _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
diff --git a/xmloff/source/style/impastp1.cxx b/xmloff/source/style/impastp1.cxx
new file mode 100644
index 000000000000..e7fd7758104b
--- /dev/null
+++ b/xmloff/source/style/impastp1.cxx
@@ -0,0 +1,149 @@
+/*************************************************************************
+ *
+ * $RCSfile: impastp1.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLASTPL_IMPL_HXX
+#include "impastpl.hxx"
+#endif
+
+using namespace rtl;
+
+//#############################################################################
+//
+// Class XMLFamilyData_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor/dtor class XMLFamilyData_Impl
+//
+
+XMLFamilyData_Impl::XMLFamilyData_Impl(
+ sal_Int32 nFamily,
+ const ::rtl::OUString& rStrName,
+ const UniReference < XMLPropertySetMapper > &rMapper,
+ const OUString& rStrPrefix )
+ : mnFamily( nFamily ), maStrFamilyName( rStrName), mxMapper( rMapper ), maStrPrefix( rStrPrefix ),
+ mnCount( 0 ), mnName( 0 )
+{
+ mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
+ mpNameList = new SvXMLAutoStylePoolNamesP_Impl( 5, 5 );
+}
+
+XMLFamilyData_Impl::~XMLFamilyData_Impl()
+{
+ if( mpParentList ) delete mpParentList;
+ if( mpNameList ) delete mpNameList;
+}
+
+void XMLFamilyData_Impl::ClearEntries()
+{
+ if( mpParentList )
+ delete mpParentList;
+ mpParentList = new SvXMLAutoStylePoolParentsP_Impl( 5, 5 );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// friendfunction of class XMLFamilyData_Impl for sorting listelements
+//
+
+int XMLFamilyDataSort_Impl( const XMLFamilyData_Impl& r1, const XMLFamilyData_Impl& r2 )
+{
+ int nRet = 0;
+
+ if( r1.mnFamily != r2.mnFamily )
+ nRet = ( r1.mnFamily > r2.mnFamily ? 1 : -1 );
+
+ return nRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementation of sorted list of XMLFamilyData_Impl - elements
+//
+
+IMPL_CONTAINER_SORT( XMLFamilyDataList_Impl, XMLFamilyData_Impl, XMLFamilyDataSort_Impl )
+
+//#############################################################################
+//
+// Sorted list of OUString - elements
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Sort-function for OUString-list
+//
+
+int SvXMLAutoStylePoolNamesPCmp_Impl( const OUString& r1,
+ const OUString& r2 )
+{
+ return (int)r1.compareTo( r2 );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementation of sorted OUString-list
+//
+
+IMPL_CONTAINER_SORT( SvXMLAutoStylePoolNamesP_Impl,
+ OUString,
+ SvXMLAutoStylePoolNamesPCmp_Impl )
+
diff --git a/xmloff/source/style/impastp2.cxx b/xmloff/source/style/impastp2.cxx
new file mode 100644
index 000000000000..5dd7af33a033
--- /dev/null
+++ b/xmloff/source/style/impastp2.cxx
@@ -0,0 +1,98 @@
+/*************************************************************************
+ *
+ * $RCSfile: impastp2.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLASTPL_IMPL_HXX
+#include "impastpl.hxx"
+#endif
+
+using namespace std;
+using namespace rtl;
+
+//#############################################################################
+//
+// Class SvXMLAutoStylePoolProperties_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor class SvXMLAutoStylePoolProperties_Impl
+//
+
+SvXMLAutoStylePoolPropertiesP_Impl::SvXMLAutoStylePoolPropertiesP_Impl( XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties )
+: maProperties( rProperties ),
+ mnPos ( pFamilyData->mnCount )
+{
+ // create a name that hasn't been used before. The created name has not
+ // to be added to the array, because it will never tried again
+ OUStringBuffer sBuffer( 7 );
+ do
+ {
+ pFamilyData->mnName++;
+ sBuffer.append( pFamilyData->maStrPrefix );
+ sBuffer.append( OUString::valueOf( (sal_Int32)pFamilyData->mnName ) );
+ msName = sBuffer.makeStringAndClear();
+ }
+ while( pFamilyData->mpNameList->Seek_Entry( &msName, 0 ) );
+}
diff --git a/xmloff/source/style/impastp3.cxx b/xmloff/source/style/impastp3.cxx
new file mode 100644
index 000000000000..d59656120926
--- /dev/null
+++ b/xmloff/source/style/impastp3.cxx
@@ -0,0 +1,180 @@
+/*************************************************************************
+ *
+ * $RCSfile: impastp3.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLASTPL_IMPL_HXX
+#include "impastpl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
+#include "xmlprmap.hxx"
+#endif
+
+using namespace std;
+using namespace rtl;
+
+//#############################################################################
+//
+// Class SvXMLAutoStylePoolParent_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// dtor class SvXMLAutoStylePoolParent_Impl
+//
+
+SvXMLAutoStylePoolParentP_Impl::~SvXMLAutoStylePoolParentP_Impl()
+{
+ while( maPropertiesList.Count() )
+ delete maPropertiesList.Remove( maPropertiesList.Count() -1 );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list
+// if not added, yet.
+//
+
+sal_Bool SvXMLAutoStylePoolParentP_Impl::Add( XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties, OUString& rName )
+{
+ sal_Bool bAdded = sal_False;
+
+ sal_Int32 nProperties = rProperties.size();
+ sal_uInt32 nCount = maPropertiesList.Count();
+ SvXMLAutoStylePoolPropertiesP_Impl *pProperties = 0;
+ for( sal_uInt32 i=0; i < nCount; i++ )
+ {
+ SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList.GetObject( i );
+ if( nProperties > pIS->GetProperties().size() )
+ {
+ continue;
+ }
+ else if( nProperties < pIS->GetProperties().size() )
+ {
+ break;
+ }
+ else if( pFamilyData->mxMapper->Equals( pIS->GetProperties(), rProperties ) )
+ {
+ pProperties = pIS;
+ break;
+ }
+ }
+
+ if( !pProperties )
+ {
+ pProperties = new SvXMLAutoStylePoolPropertiesP_Impl( pFamilyData, rProperties );
+ maPropertiesList.Insert( pProperties, i );
+ bAdded = sal_True;
+ }
+
+ rName = pProperties->GetName();
+
+ return bAdded;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list
+//
+
+OUString SvXMLAutoStylePoolParentP_Impl::Find( const XMLFamilyData_Impl* pFamilyData, const vector< XMLPropertyState >& rProperties ) const
+{
+ OUString sName;
+ sal_uInt16 nItems = rProperties.size();
+ sal_uInt32 nCount = maPropertiesList.Count();
+ for( sal_uInt32 i=0; i < nCount; i++ )
+ {
+ SvXMLAutoStylePoolPropertiesP_Impl *pIS = maPropertiesList.GetObject( i );
+ if( nItems > pIS->GetProperties().size() )
+ {
+ continue;
+ }
+ else if( nItems < pIS->GetProperties().size() )
+ {
+ break;
+ }
+ else if( pFamilyData->mxMapper->Equals( pIS->GetProperties(), rProperties ) )
+ {
+ sName = pIS->GetName();
+ break;
+ }
+ }
+
+ return sName;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Sort-function for sorted list of SvXMLAutoStylePoolParent_Impl-elements
+//
+
+int SvXMLAutoStylePoolParentPCmp_Impl( const SvXMLAutoStylePoolParentP_Impl& r1,
+ const SvXMLAutoStylePoolParentP_Impl& r2)
+{
+ return (int)r1.GetParent().compareTo( r2.GetParent() );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementation of sorted list of SvXMLAutoStylePoolParent_Impl-elements
+//
+
+IMPL_CONTAINER_SORT( SvXMLAutoStylePoolParentsP_Impl,
+ SvXMLAutoStylePoolParentP_Impl,
+ SvXMLAutoStylePoolParentPCmp_Impl )
diff --git a/xmloff/source/style/impastp4.cxx b/xmloff/source/style/impastp4.cxx
new file mode 100644
index 000000000000..ba345daf302c
--- /dev/null
+++ b/xmloff/source/style/impastp4.cxx
@@ -0,0 +1,360 @@
+/*************************************************************************
+ *
+ * $RCSfile: impastp4.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLASTPLP_HXX
+#include "xmlaustp.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include "attrlist.hxx"
+#endif
+#ifndef _XMLOFF_XMLASTPL_IMPL_HXX
+#include "impastpl.hxx"
+#endif
+#ifndef _XMLOFF_XMLEXPPR_HXX
+#include "xmlexppr.hxx"
+#endif
+
+using namespace ::std;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//#############################################################################
+//
+// Class SvXMLAutoStylePool_Impl
+//
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor/dtor class SvXMLAutoStylePool_Impl
+//
+
+SvXMLAutoStylePoolP_Impl::SvXMLAutoStylePoolP_Impl()
+: msCDATA( OUString::createFromAscii( sXML_CDATA ) ),
+ msWS( OUString::createFromAscii( sXML_WS ) ),
+ maFamilyList( 5, 5 )
+{
+ mpAttrList = new SvXMLAttributeList();
+ mxAttrList = mpAttrList;
+}
+
+SvXMLAutoStylePoolP_Impl::~SvXMLAutoStylePoolP_Impl()
+{
+ XMLFamilyData_Impl* pData = NULL;
+ while( ( pData = maFamilyList.Remove( ULONG(0) ) ) )
+ delete pData;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds stylefamily-informations to sorted list
+//
+
+void SvXMLAutoStylePoolP_Impl::AddFamily(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ const UniReference < XMLPropertySetMapper > & rMapper,
+ const OUString& rStrPrefix )
+{
+ // store family in a list if not already stored
+ sal_uInt32 nPos;
+ XMLFamilyData_Impl *pFamily = new XMLFamilyData_Impl( nFamily, rStrName, rMapper, rStrPrefix );
+ if( !maFamilyList.Seek_Entry( pFamily, &nPos ) )
+ maFamilyList.Insert( pFamily );
+ else
+ delete pFamily;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a name to list
+//
+
+void SvXMLAutoStylePoolP_Impl::RegisterName( sal_Int32 nFamily, const OUString& rName )
+{
+ SvXMLAutoStylePoolNamesP_Impl *pNames = 0;
+
+ sal_uInt32 nPos;
+ XMLFamilyData_Impl aTmp( nFamily );
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ pNames = maFamilyList.GetObject( nPos )->mpNameList;
+
+ DBG_ASSERT( pNames,
+ "SvXMLAutoStylePool_Impl::RegisterName: unknown family" );
+ if( pNames )
+ {
+ OUString *pName = new OUString( rName );
+ if( !pNames->Insert( pName ) )
+ delete pName;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Adds a array of XMLPropertyState ( vector< XMLPropertyState > ) to list
+// if not added, yet.
+//
+
+OUString SvXMLAutoStylePoolP_Impl::Add( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties )
+{
+ OUString sName;
+ sal_uInt32 nPos;
+
+ XMLFamilyData_Impl *pFamily = 0;
+ XMLFamilyData_Impl aTmp( nFamily );
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Add: unknown family" );
+ if( pFamily )
+ {
+ SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
+ SvXMLAutoStylePoolParentP_Impl *pParent = 0;
+
+ SvXMLAutoStylePoolParentsP_Impl *pParents = pFamily->mpParentList;
+ if( pParents->Seek_Entry( &aTmp, &nPos ) )
+ {
+ pParent = pParents->GetObject( nPos );
+ }
+ else
+ {
+ pParent = new SvXMLAutoStylePoolParentP_Impl( rParent );
+ pParents->Insert( pParent );
+ }
+
+ if( pParent->Add( pFamily, rProperties, sName ) )
+ pFamily->mnCount++;
+ }
+
+ return sName;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Search for a array of XMLPropertyState ( vector< XMLPropertyState > ) in list
+//
+
+OUString SvXMLAutoStylePoolP_Impl::Find( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties ) const
+{
+ OUString sName;
+
+ sal_uInt32 nPos;
+ XMLFamilyData_Impl aTmp( nFamily );
+ XMLFamilyData_Impl *pFamily = 0;
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ }
+
+ DBG_ASSERT( pFamily, "SvXMLAutoStylePool_Impl::Find: unknown family" );
+
+ if( pFamily )
+ {
+ SvXMLAutoStylePoolParentP_Impl aTmp( rParent );
+
+ const SvXMLAutoStylePoolParentsP_Impl* pParents =
+ pFamily->mpParentList;
+ if( pParents->Seek_Entry( &aTmp, &nPos ) )
+ sName = pParents->GetObject( nPos )->Find( pFamily, rProperties );
+ }
+
+ return sName;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// export
+//
+
+void SvXMLAutoStylePoolP_Impl::exportXML(
+ sal_Int32 nFamily,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const SvXMLAutoStylePoolP *pAntiImpl) const
+{
+ sal_uInt32 nCount = 0;
+
+ // Get list of parents for current family (nFamily)
+ sal_uInt32 nPos;
+ XMLFamilyData_Impl aTmp( nFamily );
+ XMLFamilyData_Impl *pFamily = 0;
+ if( maFamilyList.Seek_Entry( &aTmp, &nPos ) )
+ {
+ pFamily = maFamilyList.GetObject( nPos );
+ nCount = pFamily->mnCount;
+ }
+
+ DBG_ASSERT( pFamily,
+ "SvXMLAutoStylePool_Impl::exportXML: unknown family" );
+ if( pFamily && nCount > 0 )
+ {
+ /////////////////////////////////////////////////////////////////////////////////////
+ // create, initialize and fill helper-structure (SvXMLAutoStylePoolProperties_Impl)
+ // wich contains a parent-name and a SvXMLAutoStylePoolProperties_Impl
+ //
+ const SvXMLAutoStylePoolParentsP_Impl *pParents =
+ pFamily->mpParentList;
+
+ SvXMLAutoStylePoolPExport_Impl* aExpStyles =
+ new SvXMLAutoStylePoolPExport_Impl[nCount];
+
+ sal_uInt32 i;
+ for( i=0; i < nCount; i++ )
+ {
+ aExpStyles[i].mpParent = 0;
+ aExpStyles[i].mpProperties = 0;
+ }
+
+ sal_uInt32 nParents = pParents->Count();
+ for( i=0; i < nParents; i++ )
+ {
+ const SvXMLAutoStylePoolParentP_Impl* pParent =
+ pParents->GetObject( i );
+ sal_uInt32 nProperties = pParent->GetPropertiesList().Count();
+ for( sal_uInt32 j=0; j < nProperties; j++ )
+ {
+ const SvXMLAutoStylePoolPropertiesP_Impl *pProperties =
+ pParent->GetPropertiesList().GetObject( j );
+ sal_uInt32 nPos = pProperties->GetPos();
+ DBG_ASSERT( nPos < nCount,
+ "SvXMLAutoStylePool_Impl::exportXML: wrong position" );
+ if( nPos < nCount )
+ {
+ DBG_ASSERT( !aExpStyles[nPos].mpProperties,
+ "SvXMLAutoStylePool_Impl::exportXML: double position" );
+ aExpStyles[nPos].mpProperties = pProperties;
+ aExpStyles[nPos].mpParent = &pParent->GetParent();
+ }
+ }
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+ //
+ // create string to export for each XML-style. That means for each property-list
+ //
+ OUString aStrFamilyName = pFamily->maStrFamilyName;
+
+ for( i=0; i<nCount; i++ )
+ {
+ DBG_ASSERT( aExpStyles[i].mpProperties,
+ "SvXMLAutoStylePool_Impl::exportXML: empty position" );
+
+ if( aExpStyles[i].mpProperties )
+ {
+ OUString sName( rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii(sXML_name) ) );
+ mpAttrList->AddAttribute( sName, msCDATA, aExpStyles[i].mpProperties->GetName() );
+
+ sName = rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii(sXML_family) );
+ mpAttrList->AddAttribute( sName, msCDATA, aStrFamilyName );
+
+ if( aExpStyles[i].mpParent->getLength() )
+ {
+ sName = rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii(sXML_parent_style_name) );
+ mpAttrList->AddAttribute( sName, msCDATA, *aExpStyles[i].mpParent );
+ }
+ sName = rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii(sXML_style) );
+
+ pAntiImpl->exportStyleAttributes( *mpAttrList, nFamily,
+ aExpStyles[i].mpProperties->GetProperties(),
+ rPropExp,
+ rUnitConverter, rNamespaceMap );
+
+ rHandler->ignorableWhitespace( msWS );
+ rHandler->startElement( sName, mxAttrList );
+ mpAttrList->Clear();
+
+ rPropExp.exportXML( rHandler, aExpStyles[i].mpProperties->GetProperties(), rUnitConverter,
+ rNamespaceMap, XML_EXPORT_FLAG_IGN_WS );
+
+ rHandler->ignorableWhitespace( msWS );
+ rHandler->endElement( sName );
+ }
+ }
+
+ delete aExpStyles;
+ }
+}
+
+void SvXMLAutoStylePoolP_Impl::ClearEntries()
+{
+ for(sal_uInt32 a = 0L; a < maFamilyList.Count(); a++)
+ maFamilyList[a]->ClearEntries();
+}
diff --git a/xmloff/source/style/impastpl.hxx b/xmloff/source/style/impastpl.hxx
new file mode 100644
index 000000000000..4ad4321a6e01
--- /dev/null
+++ b/xmloff/source/style/impastpl.hxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: impastpl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLASTPL_IMPL_HXX
+#define _XMLOFF_XMLASTPL_IMPL_HXX
+
+#ifndef _SAL_TYPES_H_
+#include <sal/types.h>
+#endif
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _CNTRSRT_HXX
+#include <svtools/cntnrsrt.hxx>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef __SGI_STL_VECTOR
+#include <stl/vector>
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+
+#ifndef _XMLOFF_PROPMAPPINGTYPES_HXX
+#include <maptype.hxx>
+#endif
+#ifndef _XMLOFF_XMLEXPPR_HXX
+#include <xmlexppr.hxx>
+#endif
+
+class XMLPropertySetMapper;
+class SvXMLAutoStylePoolP;
+class SvXMLAutoStylePoolParentsP_Impl;
+class SvXMLAutoStylePoolNamesP_Impl;
+class SvXMLAttributeList;
+class SvXMLExportPropertyMapper;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementationclass for stylefamily-information
+//
+
+class XMLFamilyData_Impl
+{
+public:
+ sal_uInt32 mnFamily;
+ ::rtl::OUString maStrFamilyName;
+ UniReference < XMLPropertySetMapper > mxMapper;
+
+ SvXMLAutoStylePoolParentsP_Impl* mpParentList;
+ SvXMLAutoStylePoolNamesP_Impl* mpNameList;
+ sal_uInt32 mnCount;
+ sal_uInt32 mnName;
+ ::rtl::OUString maStrPrefix;
+
+public:
+ XMLFamilyData_Impl( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference < XMLPropertySetMapper > & rMapper,
+ const ::rtl::OUString& rStrPrefix );
+ XMLFamilyData_Impl( sal_Int32 nFamily )
+ : mnFamily( nFamily ), mpParentList( NULL ),
+ mpNameList( NULL ), mnCount( 0 ), mnName( 0 )
+ {}
+ ~XMLFamilyData_Impl();
+
+ friend int XMLFamilyDataSort_Impl( const XMLFamilyData_Impl& r1, const XMLFamilyData_Impl& r2 );
+
+ void ClearEntries();
+};
+
+DECLARE_CONTAINER_SORT( XMLFamilyDataList_Impl, XMLFamilyData_Impl )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+//
+//
+
+DECLARE_CONTAINER_SORT_DEL( SvXMLAutoStylePoolNamesP_Impl,
+ ::rtl::OUString )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Properties of a pool
+//
+
+class SvXMLAutoStylePoolPropertiesP_Impl
+{
+ ::rtl::OUString msName;
+ ::std::vector< XMLPropertyState > maProperties;
+ sal_uInt32 mnPos;
+
+public:
+
+ SvXMLAutoStylePoolPropertiesP_Impl( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties );
+
+ ~SvXMLAutoStylePoolPropertiesP_Impl()
+ {
+ }
+
+ const ::rtl::OUString& GetName() const { return msName; }
+ const ::std::vector< XMLPropertyState >& GetProperties() const { return maProperties; }
+ sal_uInt32 GetPos() const { return mnPos; }
+};
+
+typedef SvXMLAutoStylePoolPropertiesP_Impl *SvXMLAutoStylePoolPropertiesPPtr;
+DECLARE_LIST( SvXMLAutoStylePoolPropertiesPList_Impl, SvXMLAutoStylePoolPropertiesPPtr )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Parents of AutoStylePool's
+//
+
+class SvXMLAutoStylePoolParentP_Impl
+{
+ ::rtl::OUString msParent;
+ SvXMLAutoStylePoolPropertiesPList_Impl maPropertiesList;
+
+public:
+
+ SvXMLAutoStylePoolParentP_Impl( const ::rtl::OUString & rParent ) :
+ msParent( rParent )
+ {
+ }
+
+ ~SvXMLAutoStylePoolParentP_Impl();
+
+ sal_Bool Add( XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties, ::rtl::OUString& rName );
+
+ ::rtl::OUString Find( const XMLFamilyData_Impl* pFamilyData, const ::std::vector< XMLPropertyState >& rProperties ) const;
+
+ const ::rtl::OUString& GetParent() const { return msParent; }
+
+ const SvXMLAutoStylePoolPropertiesPList_Impl& GetPropertiesList() const
+ {
+ return maPropertiesList;
+ }
+};
+
+DECLARE_CONTAINER_SORT_DEL( SvXMLAutoStylePoolParentsP_Impl,
+ SvXMLAutoStylePoolParentP_Impl )
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Implementationclass of SvXMLAutoStylePool
+//
+
+class SvXMLAutoStylePoolP_Impl
+{
+ const ::rtl::OUString msCDATA;
+ const ::rtl::OUString msWS;
+ SvXMLAttributeList* mpAttrList;
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > mxAttrList;
+
+ XMLFamilyDataList_Impl maFamilyList;
+
+public:
+
+ SvXMLAutoStylePoolP_Impl();
+ ~SvXMLAutoStylePoolP_Impl();
+
+ void AddFamily( sal_Int32 nFamily, const ::rtl::OUString& rStrName,
+ const UniReference < XMLPropertySetMapper > & rMapper,
+ const ::rtl::OUString& rStrPrefix );
+
+ void RegisterName( sal_Int32 nFamily, const ::rtl::OUString& rName );
+
+ ::rtl::OUString Add( sal_Int32 nFamily, const ::rtl::OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties );
+ ::rtl::OUString Find( sal_Int32 nFamily, const ::rtl::OUString& rParent,
+ const ::std::vector< XMLPropertyState >& rProperties ) const;
+
+ void exportXML( sal_Int32 nFamily,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const SvXMLAutoStylePoolP *pAntiImpl) const;
+
+ void ClearEntries();
+};
+
+struct SvXMLAutoStylePoolPExport_Impl
+{
+ const ::rtl::OUString *mpParent;
+ const SvXMLAutoStylePoolPropertiesP_Impl *mpProperties;
+};
+
+#endif
diff --git a/xmloff/source/style/kernihdl.cxx b/xmloff/source/style/kernihdl.cxx
new file mode 100644
index 000000000000..0df5af987f59
--- /dev/null
+++ b/xmloff/source/style/kernihdl.cxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: kernihdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+#include "kernihdl.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+// --
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include <xmlkywd.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLKerningPropHdl
+//
+
+XMLKerningPropHdl::~XMLKerningPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLKerningPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Int32 nKerning = 0;
+
+ if( !rStrImpValue.compareToAscii( sXML_kerning_normal ) )
+ {
+ bRet = rUnitConverter.convertMeasure( nKerning, rStrImpValue );
+ }
+
+ rValue <<= nKerning;
+
+ return bRet;
+}
+
+sal_Bool XMLKerningPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int16 nValue;
+
+ if( rValue >>= nValue )
+ {
+ OUStringBuffer aOut;
+
+ if( nValue == 0 )
+ aOut.appendAscii( sXML_kerning_normal );
+ else
+ rUnitConverter.convertMeasure( aOut, nValue );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
diff --git a/xmloff/source/style/kernihdl.hxx b/xmloff/source/style/kernihdl.hxx
new file mode 100644
index 000000000000..1478d542870c
--- /dev/null
+++ b/xmloff/source/style/kernihdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: kernihdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLKerningPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLKerningPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
diff --git a/xmloff/source/style/lspachdl.cxx b/xmloff/source/style/lspachdl.cxx
new file mode 100644
index 000000000000..b9b73876430f
--- /dev/null
+++ b/xmloff/source/style/lspachdl.cxx
@@ -0,0 +1,245 @@
+/*************************************************************************
+ *
+ * $RCSfile: lspachdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_PROPERTYHANDLER_LINESPACETYPES_HXX
+#include <lspachdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_LINESPACING_HPP_
+#include <com/sun/star/style/LineSpacing.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_LINESPACINGMODE_HPP_
+#include <com/sun/star/style/LineSpacingMode.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// this is a copy of defines in svx/inc/escpitem.hxx
+#define DFLT_ESC_PROP 58
+#define DFLT_ESC_AUTO_SUPER 101
+#define DFLT_ESC_AUTO_SUB -101
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLEscapementPropHdl
+//
+
+XMLLineHeightHdl::~XMLLineHeightHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLineHeightHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ style::LineSpacing aLSp;
+ sal_Int32 nTemp = 0;
+
+ if( -1 != rStrImpValue.indexOf( sal_Unicode( '%' ) ) )
+ {
+ aLSp.Mode = style::LineSpacingMode::PROP;
+ if(!rUnitConverter.convertPercent( nTemp, rStrImpValue ))
+ return sal_False;
+ aLSp.Height = nTemp;
+ }
+ else if( rStrImpValue.compareToAscii( sXML_casemap_normal ) )
+ {
+ aLSp.Mode = style::LineSpacingMode::PROP;
+ aLSp.Height = 100;
+ }
+ else
+ {
+ aLSp.Mode = style::LineSpacingMode::FIX;
+ if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff ))
+ return sal_False;
+ aLSp.Height = nTemp;
+ }
+
+ rValue <<= aLSp;
+ return sal_True;
+}
+
+sal_Bool XMLLineHeightHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ style::LineSpacing aLSp;
+ if(!(rValue >>= aLSp))
+ return sal_False;
+
+ if( style::LineSpacingMode::PROP != aLSp.Mode && style::LineSpacingMode::FIX != aLSp.Mode )
+ return sal_False;
+
+ if( style::LineSpacingMode::PROP == aLSp.Mode )
+ {
+ rUnitConverter.convertPercent( aOut, aLSp.Height );
+ }
+ else
+ {
+ rUnitConverter.convertMeasure( aOut, aLSp.Height );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLLineHeightAtLeastHdl
+//
+
+XMLLineHeightAtLeastHdl::~XMLLineHeightAtLeastHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLineHeightAtLeastHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ style::LineSpacing aLSp;
+
+ sal_Int32 nTemp;
+ aLSp.Mode = style::LineSpacingMode::MINIMUM;
+ if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff ))
+ return sal_False;
+ aLSp.Height = nTemp;
+
+ rValue <<= aLSp;
+ return sal_True;
+}
+
+sal_Bool XMLLineHeightAtLeastHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ style::LineSpacing aLSp;
+ if(!(rValue >>= aLSp))
+ return sal_False;
+
+ if( style::LineSpacingMode::MINIMUM != aLSp.Mode )
+ return sal_False;
+
+ rUnitConverter.convertMeasure( aOut, aLSp.Height );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLLineSpacingHdl
+//
+
+XMLLineSpacingHdl::~XMLLineSpacingHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLLineSpacingHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ style::LineSpacing aLSp;
+ sal_Int32 nTemp;
+
+ aLSp.Mode = style::LineSpacingMode::LEADING;
+ if(!rUnitConverter.convertMeasure( nTemp, rStrImpValue, 0x0000, 0xffff ))
+ return sal_False;
+ aLSp.Height = nTemp;
+
+ rValue <<= aLSp;
+ return sal_True;
+}
+
+sal_Bool XMLLineSpacingHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ OUStringBuffer aOut;
+
+ style::LineSpacing aLSp;
+ if(!(rValue >>= aLSp))
+ return sal_False;
+
+ if( style::LineSpacingMode::LEADING != aLSp.Mode )
+ return sal_False;
+
+ rUnitConverter.convertMeasure( aOut, aLSp.Height );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ return rStrExpValue.getLength() != 0;
+}
diff --git a/xmloff/source/style/lspachdl.hxx b/xmloff/source/style/lspachdl.hxx
new file mode 100644
index 000000000000..14ad1b51190e
--- /dev/null
+++ b/xmloff/source/style/lspachdl.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * $RCSfile: lspachdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_LINESPACETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_LINESPACETYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLLineHeightHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLineHeightHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLLineHeightAtLeastHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLineHeightAtLeastHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+class XMLLineSpacingHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLLineSpacingHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+
diff --git a/xmloff/source/style/makefile.mk b/xmloff/source/style/makefile.mk
new file mode 100644
index 000000000000..f7e10f4fee05
--- /dev/null
+++ b/xmloff/source/style/makefile.mk
@@ -0,0 +1,207 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+#
+# 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): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=xmloff
+TARGET=style
+AUTOSEG=true
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+CXXFILES = \
+ xmlastpl.cxx \
+ xmlexpit.cxx \
+ xmlimpit.cxx \
+ xmlitem.cxx \
+ xmlitmpr.cxx \
+ xmlnumfe.cxx \
+ xmlnumfi.cxx \
+ xmlstyle.cxx \
+ xmltabi.cxx \
+ xmlnumi.cxx \
+ xmlnume.cxx \
+ xmltabe.cxx \
+ xmlaustp.cxx \
+ impastp1.cxx \
+ impastp2.cxx \
+ impastp3.cxx \
+ impastp4.cxx \
+ xmlprmap.cxx \
+ xmlexppr.cxx \
+ xmlimppr.cxx \
+ xmlprcon.cxx \
+ prhdlfac.cxx \
+ xmlprhdl.cxx \
+ xmlbahdl.cxx \
+ uniref.cxx \
+ shadwhdl.cxx \
+ splithdl.cxx \
+ shdwdhdl.cxx \
+ kernihdl.cxx \
+ opaquhdl.cxx \
+ adjushdl.cxx \
+ backhdl.cxx \
+ breakhdl.cxx \
+ cdouthdl.cxx \
+ csmaphdl.cxx \
+ fonthdl.cxx \
+ postuhdl.cxx \
+ tabsthdl.cxx \
+ undlihdl.cxx \
+ weighhdl.cxx \
+ prstylei.cxx \
+ styleexp.cxx \
+ escphdl.cxx \
+ chrhghdl.cxx \
+ chrlohdl.cxx \
+ lspachdl.cxx \
+ bordrhdl.cxx \
+ EnumPropertyHdl.cxx \
+ NamedBoolPropertyHdl.cxx \
+ bordrhdl.cxx \
+ numehelp.cxx \
+ FillStyleContext.cxx \
+ GradientStyle.cxx \
+ HatchStyle.cxx \
+ ImageStyle.cxx \
+ TransGradientStyle.cxx \
+ MarkerStyle.cxx \
+ DashStyle.cxx \
+ XMLElementPropertyContext.cxx \
+ XMLEnumPropertyHandler.cxx \
+ XMLClipPropertyHandler.cxx
+
+
+SLOFILES = \
+ $(SLO)$/xmlastpl.obj \
+ $(SLO)$/xmlexpit.obj \
+ $(SLO)$/xmlimpit.obj \
+ $(SLO)$/xmlitem.obj \
+ $(SLO)$/xmlitmpr.obj \
+ $(SLO)$/xmlnumfe.obj \
+ $(SLO)$/xmlnumfi.obj \
+ $(SLO)$/xmlstyle.obj \
+ $(SLO)$/xmltabi.obj \
+ $(SLO)$/xmlnumi.obj \
+ $(SLO)$/xmlnume.obj \
+ $(SLO)$/xmltabe.obj \
+ $(SLO)$/xmlaustp.obj \
+ $(SLO)$/impastp1.obj \
+ $(SLO)$/impastp2.obj \
+ $(SLO)$/impastp3.obj \
+ $(SLO)$/impastp4.obj \
+ $(SLO)$/xmlprmap.obj \
+ $(SLO)$/xmlexppr.obj \
+ $(SLO)$/xmlimppr.obj \
+ $(SLO)$/xmlprcon.obj \
+ $(SLO)$/prhdlfac.obj \
+ $(SLO)$/xmlprhdl.obj \
+ $(SLO)$/xmlbahdl.obj \
+ $(SLO)$/uniref.obj \
+ $(SLO)$/shadwhdl.obj \
+ $(SLO)$/splithdl.obj \
+ $(SLO)$/shdwdhdl.obj \
+ $(SLO)$/kernihdl.obj \
+ $(SLO)$/opaquhdl.obj \
+ $(SLO)$/adjushdl.obj \
+ $(SLO)$/backhdl.obj \
+ $(SLO)$/breakhdl.obj \
+ $(SLO)$/cdouthdl.obj \
+ $(SLO)$/csmaphdl.obj \
+ $(SLO)$/fonthdl.obj \
+ $(SLO)$/postuhdl.obj \
+ $(SLO)$/tabsthdl.obj \
+ $(SLO)$/undlihdl.obj \
+ $(SLO)$/weighhdl.obj \
+ $(SLO)$/prstylei.obj \
+ $(SLO)$/styleexp.obj \
+ $(SLO)$/escphdl.obj \
+ $(SLO)$/chrhghdl.obj \
+ $(SLO)$/chrlohdl.obj \
+ $(SLO)$/lspachdl.obj \
+ $(SLO)$/bordrhdl.obj \
+ $(SLO)$/EnumPropertyHdl.obj \
+ $(SLO)$/NamedBoolPropertyHdl.obj \
+ $(SLO)$/numehelp.obj \
+ $(SLO)$/FillStyleContext.obj \
+ $(SLO)$/GradientStyle.obj \
+ $(SLO)$/HatchStyle.obj \
+ $(SLO)$/ImageStyle.obj \
+ $(SLO)$/TransGradientStyle.obj \
+ $(SLO)$/MarkerStyle.obj \
+ $(SLO)$/DashStyle.obj \
+ $(SLO)$/XMLElementPropertyContext.obj \
+ $(SLO)$/XMLEnumPropertyHandler.obj \
+ $(SLO)$/XMLClipPropertyHandler.obj
+
+# --- Tagets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/xmloff/source/style/numehelp.cxx b/xmloff/source/style/numehelp.cxx
new file mode 100644
index 000000000000..27f9609026b1
--- /dev/null
+++ b/xmloff/source/style/numehelp.cxx
@@ -0,0 +1,306 @@
+/*************************************************************************
+ *
+ * $RCSfile: numehelp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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 "numehelp.hxx"
+
+#include "nmspmap.hxx"
+#include "xmlnmspe.hxx"
+#include "xmlkywd.hxx"
+#include "xmluconv.hxx"
+
+#ifndef _XMLOFF_XMLEXP_HXX
+#include "xmlexp.hxx"
+#endif
+#ifndef _COM_SUN_STAR_UNO_REFERENCE_H_
+#include <com/sun/star/uno/Reference.h>
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+#ifndef _TOOLS_INTN_HXX
+#include <tools/intn.hxx>
+#endif
+#ifndef _ZFORLIST_HXX
+#include <svtools/zforlist.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UTIL_NUMBERFORMAT_HPP_
+#include <com/sun/star/util/NumberFormat.hpp>
+#endif
+#ifndef _TOOLS_SOLMATH_HXX
+#include <tools/solmath.hxx>
+#endif
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+using namespace com::sun::star;
+
+#define XML_TYPE "Type"
+#define XML_CURRENCYSYMBOL "CurrencySymbol"
+#define XML_CURRENCYEXTENSION "CurrencyExtension"
+#define XML_STANDARDFORMAT "StandardFormat"
+
+sal_Bool XMLNumberFormatAttributesExportHelper::GetCurrencySymbol(const sal_Int32 nNumberFormat, rtl::OUString& sCurrencySymbol,
+ uno::Reference <util::XNumberFormatsSupplier>& xNumberFormatsSupplier)
+{
+ if (xNumberFormatsSupplier.is())
+ {
+ uno::Reference <util::XNumberFormats> xNumberFormats = xNumberFormatsSupplier->getNumberFormats();
+ if (xNumberFormats.is())
+ {
+ uno::Reference <beans::XPropertySet> xNumberPropertySet = xNumberFormats->getByKey(nNumberFormat);
+ uno::Any aCurrencySymbol = xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYSYMBOL)));
+ uno::Any aCurrencyExtension = xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_CURRENCYEXTENSION)));
+ if ( aCurrencySymbol >>= sCurrencySymbol)
+ {
+ rtl::OUString sCurrencyExtension;
+ if ( aCurrencyExtension >>= sCurrencyExtension)
+ {
+ if ( sCurrencyExtension.getLength() != 0 )
+ {
+ International IntTest((sCurrencyExtension.toInt32(16) * -1));
+ sCurrencySymbol = rtl::OUString(IntTest.GetCurrBankSymbol());
+ return sal_True;
+ }
+ else
+ {
+ if ( sCurrencySymbol.getLength() == 1 && sCurrencySymbol.toChar() == NfCurrencyEntry::GetEuroSymbol() )
+ sCurrencySymbol = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("EUR"));
+ return sal_True;
+ }
+ }
+ else
+ return sal_True;
+ }
+ }
+ }
+ return sal_False;
+}
+
+
+sal_Int16 XMLNumberFormatAttributesExportHelper::GetCellType(const sal_Int32 nNumberFormat, sal_Bool& bIsStandard,
+ uno::Reference <util::XNumberFormatsSupplier>& xNumberFormatsSupplier)
+{
+ if (xNumberFormatsSupplier.is())
+ {
+ uno::Reference <util::XNumberFormats> xNumberFormats = xNumberFormatsSupplier->getNumberFormats();
+ if (xNumberFormats.is())
+ {
+ uno::Reference <beans::XPropertySet> xNumberPropertySet = xNumberFormats->getByKey(nNumberFormat);
+ uno::Any aIsStandardFormat = xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STANDARDFORMAT)));
+ aIsStandardFormat >>= bIsStandard;
+ uno::Any aNumberFormat = xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_TYPE)));
+ sal_Int16 nNumberFormat;
+ if ( aNumberFormat >>= nNumberFormat )
+ {
+ return nNumberFormat;
+ }
+ }
+ }
+ return 0;
+}
+
+void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const sal_Int32 nNumberFormat, const double& fValue, sal_uInt16 nNamespace, sal_Bool bExportValue)
+{
+ sal_Bool bIsStandard;
+ sal_Int16 nTypeKey = GetCellType(nNumberFormat, bIsStandard, rXMLExport.GetNumberFormatsSupplier());
+ sal_Bool bWasSetTypeAttribute = sal_False;
+ switch(nTypeKey & ~util::NumberFormat::DEFINED)
+ {
+ case util::NumberFormat::NUMBER:
+ case util::NumberFormat::SCIENTIFIC:
+ case util::NumberFormat::FRACTION:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_float);
+ bWasSetTypeAttribute = sal_True;
+ }
+ } // No Break
+ case util::NumberFormat::PERCENT:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_percentage);
+ bWasSetTypeAttribute = sal_True;
+ }
+ } // No Break
+ case util::NumberFormat::CURRENCY:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_currency);
+ rtl::OUString sCurrencySymbol;
+ if ( GetCurrencySymbol(nNumberFormat, sCurrencySymbol, rXMLExport.GetNumberFormatsSupplier()))
+ {
+ if (sCurrencySymbol.getLength() > 0)
+ rXMLExport.AddAttribute(nNamespace, sXML_currency, sCurrencySymbol);
+ }
+ bWasSetTypeAttribute = sal_True;
+ }
+
+ if (bExportValue)
+ {
+ String sValue;
+ SolarMath::DoubleToString(sValue, fValue, 'A', INT_MAX, '.', sal_True);
+ rXMLExport.AddAttribute(nNamespace, sXML_value, sValue);
+ }
+ }
+ break;
+ case util::NumberFormat::DATE:
+ case util::NumberFormat::DATETIME:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_date);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ if ( rXMLExport.GetMM100UnitConverter().setNullDate(rXMLExport.GetModel()) )
+ {
+ rtl::OUStringBuffer sBuffer;
+ rXMLExport.GetMM100UnitConverter().convertDateTime(sBuffer, fValue);
+ rtl::OUString sOUValue = sBuffer.makeStringAndClear();
+ rXMLExport.AddAttribute(nNamespace, sXML_date_value, sOUValue);
+ }
+ }
+ }
+ break;
+ case util::NumberFormat::TIME:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_time);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ rtl::OUStringBuffer sBuffer;
+ rXMLExport.GetMM100UnitConverter().convertTime(sBuffer, fValue);
+ rtl::OUString sOUValue = sBuffer.makeStringAndClear();
+ rXMLExport.AddAttribute(nNamespace, sXML_time_value, sOUValue);
+ }
+ }
+ break;
+ case util::NumberFormat::LOGICAL:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_boolean);
+ bWasSetTypeAttribute = sal_True;
+ }
+ if (bExportValue)
+ {
+ rtl::OUString sOUValue;
+ double fTempValue = fValue;
+ if (SolarMath::ApproxEqual( fTempValue, 1.0 ))
+ {
+ sOUValue = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_true));
+ }
+ else
+ {
+ if (SolarMath::ApproxEqual( fValue, 0.0 ))
+ {
+ sOUValue = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_false));
+ }
+ else
+ {
+ String sValue;
+ SolarMath::DoubleToString(sValue, fTempValue, 'A', INT_MAX, '.', sal_True);
+ sOUValue = sValue;
+ }
+ }
+ rXMLExport.AddAttribute(nNamespace, sXML_boolean_value, sOUValue);
+ }
+ }
+ break;
+ case util::NumberFormat::TEXT:
+ {
+ if (!bWasSetTypeAttribute)
+ {
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_float);
+ bWasSetTypeAttribute = sal_True;
+ if (bExportValue)
+ {
+ String sValue;
+ SolarMath::DoubleToString(sValue, fValue, 'A', INT_MAX, '.', sal_True);
+ rXMLExport.AddAttribute(nNamespace, sXML_value, sValue);
+ }
+ }
+ }
+ break;
+ }
+
+}
+
+void XMLNumberFormatAttributesExportHelper::SetNumberFormatAttributes(SvXMLExport& rXMLExport,
+ const rtl::OUString& sValue, const rtl::OUString& sCharacters, sal_uInt16 nNamespace, sal_Bool bExportValue)
+{
+ rXMLExport.AddAttributeASCII(nNamespace, sXML_value_type, sXML_string);
+ if (bExportValue)
+ {
+ if (sValue != sCharacters)
+ rXMLExport.AddAttribute(nNamespace, sXML_string_value, sValue);
+ }
+}
+
diff --git a/xmloff/source/style/opaquhdl.cxx b/xmloff/source/style/opaquhdl.cxx
new file mode 100644
index 000000000000..4b4b47647be6
--- /dev/null
+++ b/xmloff/source/style/opaquhdl.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: opaquhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
+#include "opaquhdl.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+// --
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include <xmlkywd.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLOpaquePropHdl
+//
+
+XMLOpaquePropHdl::~XMLOpaquePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLOpaquePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_True;
+
+ sal_Bool bValue = rStrImpValue.compareToAscii( sXML_opaque_foreground );
+ rValue <<= sal_Bool(bValue);
+ bRet = sal_True;
+
+ return bRet;
+}
+
+sal_Bool XMLOpaquePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bValue;
+
+ if (rValue >>= bValue)
+ {
+ if( bValue )
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_opaque_foreground ) );
+ else
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_opaque_background ) );
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
diff --git a/xmloff/source/style/opaquhdl.hxx b/xmloff/source/style/opaquhdl.hxx
new file mode 100644
index 000000000000..845819a17f77
--- /dev/null
+++ b/xmloff/source/style/opaquhdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: opaquhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLOpaquePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLOpaquePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_OPAQUETYPES_HXX
diff --git a/xmloff/source/style/postuhdl.cxx b/xmloff/source/style/postuhdl.cxx
new file mode 100644
index 000000000000..70930fa1ee8e
--- /dev/null
+++ b/xmloff/source/style/postuhdl.cxx
@@ -0,0 +1,147 @@
+/*************************************************************************
+ *
+ * $RCSfile: postuhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+#include <postuhdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_FONTSLANT_HPP_
+#include <com/sun/star/awt/FontSlant.hpp>
+#endif
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvXMLEnumMapEntry __READONLY_DATA aPostureGenericMapping[] =
+{
+ { sXML_posture_normal, ITALIC_NONE },
+ { sXML_posture_italic, ITALIC_NORMAL },
+ { sXML_posture_oblique, ITALIC_OBLIQUE },
+ { 0, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPosturePropHdl
+//
+
+XMLPosturePropHdl::~XMLPosturePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLPosturePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 ePosture;
+
+ if( ( bRet = rUnitConverter.convertEnum( ePosture, rStrImpValue, aPostureGenericMapping ) ) )
+ rValue <<= (awt::FontSlant)ePosture;
+
+ return bRet;
+}
+
+sal_Bool XMLPosturePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ awt::FontSlant eSlant;
+
+ if( !( rValue >>= eSlant ) )
+ {
+ sal_Int32 nValue;
+
+ if( !( rValue >>= nValue ) )
+ return sal_False;
+
+ eSlant = (awt::FontSlant)nValue;
+ }
+
+ if( ( bRet = rUnitConverter.convertEnum( aOut, (sal_Int32)eSlant, aPostureGenericMapping ) ) )
+ rStrExpValue = aOut.makeStringAndClear();
+
+ return bRet;
+}
+
diff --git a/xmloff/source/style/postuhdl.hxx b/xmloff/source/style/postuhdl.hxx
new file mode 100644
index 000000000000..63147d67ff6b
--- /dev/null
+++ b/xmloff/source/style/postuhdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: postuhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLPosturePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLPosturePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx
new file mode 100644
index 000000000000..8b156302b8b8
--- /dev/null
+++ b/xmloff/source/style/prhdlfac.cxx
@@ -0,0 +1,341 @@
+/*************************************************************************
+ *
+ * $RCSfile: prhdlfac.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLERFACTORY_HXX
+#include <prhdlfac.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTYPES_HXX
+#include "xmltypes.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+#include "xmlbahdl.hxx"
+#endif
+
+#ifndef _XMLOFF_NAMEDBOOLPROPERTYHANDLER_HXX
+#include "NamedBoolPropertyHdl.hxx"
+#endif
+
+#ifndef _XMLOFF_PROPERTYHANDLER_CROSSEDOUTTYPES_HXX
+#include "cdouthdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_CASEMAPTYPES_HXX
+#include "csmaphdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#include "fonthdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_KERNINGTYPES_HXX
+#include "kernihdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_POSTURETYPES_HXX
+#include <postuhdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_SHADOWTYPES_HXX
+#include "shadwhdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+#include "shdwdhdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+#include "undlihdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+#include "weighhdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_FMTSPLITTYPES_HXX
+#include "splithdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_BREAKTYPES_HXX
+#include "breakhdl.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_ADJUSTTYPES_HXX
+#include <adjushdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_ESCAPETYPES_HXX
+#include <escphdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_CHARHEIGHTTYPES_HXX
+#include <chrhghdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_CHARLOCALETYPES_HXX
+#include <chrlohdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_LINESPACETYPES_HXX
+#include <lspachdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_BORDERTYPES_HXX
+#include <bordrhdl.hxx>
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+#include <tabsthdl.hxx>
+#endif
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Dtor
+//
+XMLPropertyHandlerFactory::~XMLPropertyHandlerFactory()
+{
+ for( CacheMap::iterator pPos = maHandlerCache.begin(); pPos != maHandlerCache.end(); pPos++ )
+ delete pPos->second;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Interface
+//
+const XMLPropertyHandler* XMLPropertyHandlerFactory::GetPropertyHandler( sal_Int32 nType ) const
+{
+ DBG_ASSERT( (nType & ~((sal_uInt32)MID_FLAG_MASK)) == 0,
+ "GetPropertyHandler called with flags in type" );
+ return GetBasicHandler( nType );
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Helper-methods to create and cache PropertyHandler
+//
+XMLPropertyHandler* XMLPropertyHandlerFactory::GetHdlCache( sal_Int32 nType ) const
+{
+ XMLPropertyHandler* pRet = NULL;
+
+ if( maHandlerCache.find( nType ) != maHandlerCache.end() )
+ pRet = maHandlerCache.find( nType )->second;
+
+ return pRet;
+}
+
+void XMLPropertyHandlerFactory::PutHdlCache( sal_Int32 nType, const XMLPropertyHandler* pHdl ) const
+{
+ // Don't be wondered about the following construct. The sense is to be able to provide a const-
+ // method as class-interface.
+ ((XMLPropertyHandlerFactory*)this)->maHandlerCache[ nType ] = (XMLPropertyHandler*)pHdl;
+}
+
+const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 nType ) const
+{
+ XMLPropertyHandler* pPropHdl = GetHdlCache( nType );
+
+ if( !pPropHdl )
+ {
+ switch( nType )
+ {
+ case XML_TYPE_BOOL :
+ pPropHdl = new XMLBoolPropHdl;
+ break;
+ case XML_TYPE_MEASURE :
+ pPropHdl = new XMLMeasurePropHdl( 4 );
+ break;
+ case XML_TYPE_MEASURE8 :
+ pPropHdl = new XMLMeasurePropHdl( 1 );
+ break;
+ case XML_TYPE_MEASURE16:
+ pPropHdl = new XMLMeasurePropHdl( 2 );
+ break;
+ case XML_TYPE_PERCENT :
+ pPropHdl = new XMLPercentPropHdl( 4 );
+ break;
+ case XML_TYPE_PERCENT8 :
+ pPropHdl = new XMLPercentPropHdl( 1 );
+ break;
+ case XML_TYPE_PERCENT16 :
+ pPropHdl = new XMLPercentPropHdl( 2 );
+ break;
+ case XML_TYPE_STRING :
+ pPropHdl = new XMLStringPropHdl;
+ break;
+ case XML_TYPE_COLOR :
+ pPropHdl = new XMLColorPropHdl;
+ break;
+ case XML_TYPE_NUMBER :
+ pPropHdl = new XMLNumberPropHdl( 4 );
+ break;
+ case XML_TYPE_NUMBER8 :
+ pPropHdl = new XMLNumberPropHdl( 1 );
+ break;
+ case XML_TYPE_NUMBER16:
+ pPropHdl = new XMLNumberPropHdl( 2 );
+ break;
+ case XML_TYPE_NUMBER_NONE :
+ pPropHdl = new XMLNumberNonePropHdl;
+ break;
+ case XML_TYPE_DOUBLE :
+ pPropHdl = new XMLDoublePropHdl;
+ break;
+ case XML_TYPE_NBOOL :
+ pPropHdl = new XMLNBoolPropHdl;
+ break;
+
+ case XML_TYPE_TEXT_CROSSEDOUT:
+ pPropHdl = new XMLCrossedOutPropHdl ;
+ break;
+ case XML_TYPE_TEXT_BOOLCROSSEDOUT:
+ {
+ ::rtl::OUString aStrTrueString( RTL_CONSTASCII_USTRINGPARAM( sXML_crossedout_single ) );
+ ::rtl::OUString aStrFalseString( RTL_CONSTASCII_USTRINGPARAM( sXML_crossedout_none ) );
+ pPropHdl = new XMLNamedBoolPropertyHdl( aStrTrueString, aStrFalseString );
+ }
+ break;
+ case XML_TYPE_TEXT_ESCAPEMENT:
+ pPropHdl = new XMLEscapementPropHdl;
+ break;
+ case XML_TYPE_TEXT_ESCAPEMENT_HEIGHT:
+ pPropHdl = new XMLEscapementHeightPropHdl;
+ break;
+ case XML_TYPE_TEXT_CASEMAP:
+ pPropHdl = new XMLCaseMapPropHdl;
+ break;
+ case XML_TYPE_TEXT_CASEMAP_VAR:
+ pPropHdl = new XMLCaseMapVariantHdl;
+ break;
+ case XML_TYPE_TEXT_FONTFAMILYNAME:
+ pPropHdl = new XMLFontFamilyNamePropHdl;
+ break;
+ case XML_TYPE_TEXT_FONTFAMILY:
+ pPropHdl = new XMLFontFamilyPropHdl;
+ break;
+ case XML_TYPE_TEXT_FONTENCODING:
+ pPropHdl = new XMLFontEncodingPropHdl;
+ break;
+ case XML_TYPE_TEXT_FONTPITCH:
+ pPropHdl = new XMLFontPitchPropHdl;
+ break;
+ case XML_TYPE_TEXT_KERNING:
+ pPropHdl = new XMLKerningPropHdl;
+ break;
+ case XML_TYPE_TEXT_POSTURE:
+ pPropHdl = new XMLPosturePropHdl;
+ break;
+ case XML_TYPE_TEXT_SHADOWED:
+ pPropHdl = new XMLShadowedPropHdl;
+ break;
+ case XML_TYPE_TEXT_UNDERLINE:
+ pPropHdl = new XMLUnderlinePropHdl;
+ break;
+ case XML_TYPE_TEXT_WEIGHT:
+ pPropHdl = new XMLFontWeightPropHdl;
+ break;
+ case XML_TYPE_TEXT_SPLIT:
+ pPropHdl = new XMLFmtSplitPropHdl;
+ break;
+ case XML_TYPE_TEXT_BREAKBEFORE:
+ pPropHdl = new XMLFmtBreakBeforePropHdl;
+ break;
+ case XML_TYPE_TEXT_BREAKAFTER:
+ pPropHdl = new XMLFmtBreakAfterPropHdl;
+ break;
+ case XML_TYPE_TEXT_SHADOW:
+ pPropHdl = new XMLShadowPropHdl;
+ break;
+ case XML_TYPE_TEXT_ADJUST:
+ pPropHdl = new XMLParaAdjustPropHdl;
+ break;
+ case XML_TYPE_TEXT_ADJUSTLAST:
+ pPropHdl = new XMLLastLineAdjustPropHdl;
+ break;
+ case XML_TYPE_CHAR_HEIGHT:
+ pPropHdl = new XMLCharHeightHdl;
+ break;
+ case XML_TYPE_CHAR_HEIGHT_PROP:
+ pPropHdl = new XMLCharHeightPropHdl;
+ break;
+ case XML_TYPE_CHAR_LANGUAGE:
+ pPropHdl = new XMLCharLanguageHdl;
+ break;
+ case XML_TYPE_CHAR_COUNTRY:
+ pPropHdl = new XMLCharCountryHdl;
+ break;
+ case XML_TYPE_LINE_SPACE_FIXED:
+ pPropHdl = new XMLLineHeightHdl;
+ break;
+ case XML_TYPE_LINE_SPACE_MINIMUM:
+ pPropHdl = new XMLLineHeightAtLeastHdl;
+ break;
+ case XML_TYPE_LINE_SPACE_DISTANCE:
+ pPropHdl = new XMLLineSpacingHdl;
+ break;
+ case XML_TYPE_BORDER_WIDTH:
+ pPropHdl = new XMLBorderWidthHdl;
+ break;
+ case XML_TYPE_BORDER:
+ pPropHdl = new XMLBorderHdl;
+ break;
+ case XML_TYPE_TEXT_TABSTOP:
+ pPropHdl = new XMLTabStopPropHdl;
+ break;
+ }
+
+ if( pPropHdl )
+ PutHdlCache( nType, pPropHdl );
+ }
+
+ return pPropHdl;
+}
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
new file mode 100644
index 000000000000..668d309ea7b9
--- /dev/null
+++ b/xmloff/source/style/prstylei.cxx
@@ -0,0 +1,317 @@
+/*************************************************************************
+ *
+ * $RCSfile: prstylei.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_XMLPROPERTYSETCONTEXT_HXX
+#include "xmlprcon.hxx"
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
+#include <com/sun/star/style/XStyle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _XMLOFF_PRSTYLEI_HXX
+#include "prstylei.hxx"
+#endif
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include "attrlist.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+
+
+void XMLPropStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ if( XML_NAMESPACE_STYLE == nPrefixKey &&
+ rLocalName.compareToAscii( sXML_family ) == 0 )
+ {
+ SetFamily( ((SvXMLStylesContext *)&xStyles)->GetFamily( rValue ) );
+ }
+ else
+ {
+ SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+TYPEINIT1( XMLPropStyleContext, SvXMLStyleContext );
+
+XMLPropStyleContext::XMLPropStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx, const OUString& rLName,
+ const Reference< XAttributeList > & xAttrList,
+ SvXMLStylesContext& rStyles ) :
+ SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList ),
+ xStyles( &rStyles ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) )
+{
+}
+
+XMLPropStyleContext::~XMLPropStyleContext()
+{
+}
+
+SvXMLImportContext *XMLPropStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ rLocalName.compareToAscii( sXML_properties ) == 0 )
+ {
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&xStyles)->GetImportPropertyMapper(
+ GetFamily() );
+ if( xImpPrMap.is() )
+ pContext = new SvXMLPropertySetContext( GetImport(), nPrefix,
+ rLocalName, xAttrList,
+ aProperties,
+ xImpPrMap );
+ }
+
+ if( !pContext )
+ pContext = SvXMLStyleContext::CreateChildContext( nPrefix, rLocalName,
+ xAttrList );
+
+ return pContext;
+}
+
+void XMLPropStyleContext::FillPropertySet(
+ const Reference< XPropertySet > & rPropSet )
+{
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&xStyles)->GetImportPropertyMapper(
+ GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xImpPrMap->getPropertySetMapper()->FillPropertySet( aProperties,
+ rPropSet );
+}
+
+Reference < XStyle > XMLPropStyleContext::Create()
+{
+ Reference < XStyle > xNewStyle;
+
+ OUString sServiceName(
+ ((SvXMLStylesContext *)&xStyles)->GetServiceName( GetFamily() ) );
+ if( sServiceName.getLength() )
+ {
+ Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
+ UNO_QUERY );
+ if( xFactory.is() )
+ {
+ Reference < XInterface > xIfc =
+ xFactory->createInstance( sServiceName );
+ if( xIfc.is() )
+ xNewStyle = Reference < XStyle >( xIfc, UNO_QUERY );
+ }
+ }
+
+ return xNewStyle;
+}
+
+void XMLPropStyleContext::CreateAndInsert( sal_Bool bOverwrite )
+{
+ const OUString& rName = GetName();
+ if( 0 == rName.getLength() )
+ return;
+
+ Reference < XNameContainer > xFamilies =
+ ((SvXMLStylesContext *)&xStyles)->GetStylesContainer( GetFamily() );
+ if( !xFamilies.is() )
+ return;
+
+ sal_Bool bNew = sal_False;
+ if( xFamilies->hasByName( rName ) )
+ {
+ Any aAny = xFamilies->getByName( rName );
+ aAny >>= xStyle;
+ }
+ else
+ {
+ xStyle = Create();
+ if( !xStyle.is() )
+ return;
+
+ Any aAny;
+ aAny <<= xStyle;
+ xFamilies->insertByName( rName, aAny );
+ bNew = sal_True;
+ }
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( sIsPhysical );
+ bNew = !*(sal_Bool *)aAny.getValue();
+ }
+
+ if( bOverwrite || bNew )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+
+ UniReference < XMLPropertySetMapper > xPrMap;
+ UniReference < SvXMLImportPropertyMapper > xImpPrMap =
+ ((SvXMLStylesContext *)&xStyles)->GetImportPropertyMapper(
+ GetFamily() );
+ DBG_ASSERT( xImpPrMap.is(), "There is the import prop mapper" );
+ if( xImpPrMap.is() )
+ xPrMap = xImpPrMap->getPropertySetMapper();
+ if( xPrMap.is() )
+ {
+ sal_Int32 nCount = xPrMap->GetEntryCount();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ const OUString& rName = xPrMap->GetEntryAPIName( i );
+ if( xPropSetInfo->hasPropertyByName( rName ) &&
+ PropertyState_DIRECT_VALUE ==
+ xPropState->getPropertyState( rName ) )
+ {
+ xPropState->setPropertyToDefault( rName );
+ }
+ }
+ }
+
+ FillPropertySet( xPropSet );
+ }
+ else
+ {
+ SetValid( sal_False );
+ }
+}
+
+void XMLPropStyleContext::Finish( sal_Bool bOverwrite )
+{
+ if( xStyle.is() )
+ {
+ // The families cintaner must exist
+ Reference < XNameContainer > xFamilies =
+ ((SvXMLStylesContext *)&xStyles)->GetStylesContainer( GetFamily() );
+ DBG_ASSERT( xFamilies.is(), "Families lost" );
+ if( !xFamilies.is() )
+ return;
+
+ // connect parent
+ OUString sParent( GetParent() );
+ if( sParent.getLength() && !xFamilies->hasByName( sParent ) )
+ sParent = OUString();
+
+ if( sParent != xStyle->getParentStyle() )
+ xStyle->setParentStyle( sParent );
+
+ // connect follow
+ OUString sFollow( GetFollow() );
+ if( !sFollow.getLength() || !xFamilies->hasByName( sFollow ) )
+ sFollow = xStyle->getName();
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( sFollowStyle );
+ OUString sCurrFollow;
+ aAny >>= sCurrFollow;
+ if( sCurrFollow != sFollow )
+ {
+ aAny <<= sFollow;
+ xPropSet->setPropertyValue( sFollowStyle, aAny );
+ }
+ }
+ }
+}
+
+
diff --git a/xmloff/source/style/shadwhdl.cxx b/xmloff/source/style/shadwhdl.cxx
new file mode 100644
index 000000000000..6f6414384969
--- /dev/null
+++ b/xmloff/source/style/shadwhdl.cxx
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * $RCSfile: shadwhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_SHADOWTYPES_HXX
+#include "shadwhdl.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+// --
+
+#ifndef _COM_SUN_STAR_TABLE_SHADOWFORMAT_HPP_
+#include <com/sun/star/table/ShadowFormat.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include <xmlkywd.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+XMLShadowPropHdl::~XMLShadowPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLShadowPropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ table::ShadowFormat aShadow;
+ aShadow.Location = table::ShadowLocation_BOTTOM_RIGHT;
+
+ sal_Bool bColorFound = sal_False;
+ sal_Bool bOffsetFound = sal_False;
+ SvXMLTokenEnumerator aTokenEnum( rStrImpValue );
+ Color aColor( 128,128, 128 );
+ OUString aToken;
+
+ while( aTokenEnum.getNextToken( aToken ) )
+ {
+ if( aToken.compareToAscii( sXML_none ) == 0 )
+ {
+ aShadow.Location = table::ShadowLocation_NONE;
+ bRet = sal_True;
+ break;
+ }
+ else if( !bColorFound && aToken.compareToAscii( "#", 1 ) == 0 )
+ {
+ bRet = rUnitConverter.convertColor( aColor, aToken );
+ if( !bRet )
+ return sal_False;
+
+ bColorFound = sal_True;
+ }
+ else if( !bOffsetFound )
+ {
+ sal_Int32 nX = 0, nY = 0;
+
+ bRet = rUnitConverter.convertMeasure( nX, aToken );
+ if( bRet && aTokenEnum.getNextToken( aToken ) )
+ bRet = rUnitConverter.convertMeasure( nY, aToken );
+
+ if( bRet )
+ {
+ if( nX < 0 )
+ {
+ if( nY < 0 )
+ aShadow.Location = table::ShadowLocation_TOP_LEFT;
+ else
+ aShadow.Location = table::ShadowLocation_BOTTOM_LEFT;
+ }
+ else
+ {
+ if( nY < 0 )
+ aShadow.Location = table::ShadowLocation_TOP_RIGHT;
+ else
+ aShadow.Location = table::ShadowLocation_BOTTOM_RIGHT;
+ }
+
+ if( nX < 0 ) nX *= -1;
+ if( nY < 0 ) nY *= -1;
+
+ aShadow.ShadowWidth = (nX + nY) >> 1;
+ }
+ }
+ }
+
+ if( bRet && ( bColorFound || bOffsetFound ) )
+ {
+ aShadow.IsTransparent = aColor.GetTransparency() > 0;
+ aShadow.Color = aColor.GetColor();
+ bRet = sal_True;
+ }
+
+ rValue <<= aShadow;
+
+ return bRet;
+}
+
+sal_Bool XMLShadowPropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ table::ShadowFormat aShadow;
+
+ if( rValue >>= aShadow )
+ {
+ sal_Int32 nX = 1, nY = 1;
+
+ switch( aShadow.Location )
+ {
+ case table::ShadowLocation_TOP_LEFT:
+ nX = -1;
+ nY = -1;
+ break;
+ case table::ShadowLocation_TOP_RIGHT:
+ nY = -1;
+ break;
+ case table::ShadowLocation_BOTTOM_LEFT:
+ nX = -1;
+ break;
+ case table::ShadowLocation_BOTTOM_RIGHT:
+ break;
+ case table::ShadowLocation_NONE:
+ default:
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_none ) );
+ return sal_True;
+ }
+
+ nX *= aShadow.ShadowWidth;
+ nY *= aShadow.ShadowWidth;
+
+ rUnitConverter.convertColor( aOut, aShadow.Color );
+
+ aOut.append( sal_Unicode(' ') );
+ rUnitConverter.convertMeasure( aOut, nX );
+ aOut.append( sal_Unicode(' ') );
+ rUnitConverter.convertMeasure( aOut, nY );
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
diff --git a/xmloff/source/style/shadwhdl.hxx b/xmloff/source/style/shadwhdl.hxx
new file mode 100644
index 000000000000..48843a417d00
--- /dev/null
+++ b/xmloff/source/style/shadwhdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: shadwhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_SHADOWTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_SHADOWTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLShadowPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLShadowPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
diff --git a/xmloff/source/style/shdwdhdl.cxx b/xmloff/source/style/shdwdhdl.cxx
new file mode 100644
index 000000000000..5dccfe18436d
--- /dev/null
+++ b/xmloff/source/style/shdwdhdl.cxx
@@ -0,0 +1,124 @@
+/*************************************************************************
+ *
+ * $RCSfile: shdwdhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+#include "shdwdhdl.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+// --
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include <xmlkywd.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtSplitPropHdl
+//
+
+XMLShadowedPropHdl::~XMLShadowedPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLShadowedPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bValue = rStrImpValue.compareToAscii( sXML_none ) != 0;
+ rValue <<= sal_Bool(bValue);
+ bRet = sal_True;
+
+ return bRet;
+}
+
+sal_Bool XMLShadowedPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Bool bValue;
+
+ if (rValue >>= bValue)
+ {
+ if( bValue )
+ {
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( "1pt 1pt" ) );
+ }
+ else
+ {
+ rStrExpValue = OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_none ) );
+ }
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
diff --git a/xmloff/source/style/shdwdhdl.hxx b/xmloff/source/style/shdwdhdl.hxx
new file mode 100644
index 000000000000..25009f6b8a9f
--- /dev/null
+++ b/xmloff/source/style/shdwdhdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: shdwdhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLShadowedPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLShadowedPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_SHADOWEDTYPES_HXX
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
new file mode 100644
index 000000000000..e19453eddbe5
--- /dev/null
+++ b/xmloff/source/style/styleexp.cxx
@@ -0,0 +1,440 @@
+/*************************************************************************
+ *
+ * $RCSfile: styleexp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SVSTDARR_STRINGSSORTDTOR_DECL
+#define _SVSTDARR_STRINGSSORTDTOR
+#include <svtools/svstdarr.hxx>
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_XMLITMAP_HXX
+//#include "xmlitmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include "attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
+#include "xmlprmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLEXPPR_HXX
+#include "xmlexppr.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XMODEL_HPP_
+#include <com/sun/star/frame/XModel.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
+#include <com/sun/star/style/XStyle.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLASTPLP_HXX
+#include "xmlaustp.hxx"
+#endif
+#ifndef _XMLOFF_STYLEEXP_HXX
+#include "styleexp.hxx"
+#endif
+#ifndef _XMLOFF_XMLEXP_HXX
+#include "xmlexp.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+//using namespace ::com::sun::star::text;
+
+XMLStyleExport::XMLStyleExport(
+ SvXMLExport& rExp,
+ const ::rtl::OUString& rPoolStyleName,
+ SvXMLAutoStylePoolP *pAutoStyleP ) :
+ rExport( rExp ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sFollowStyle( RTL_CONSTASCII_USTRINGPARAM( "FollowStyle" ) ),
+ sNumberingStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyleName" ) ),
+ sIsAutoUpdate( RTL_CONSTASCII_USTRINGPARAM( "IsAutoUpdate" ) ),
+ sPoolStyleName( rPoolStyleName ),
+ pAutoStylePool( pAutoStyleP )
+{
+}
+
+XMLStyleExport::~XMLStyleExport()
+{
+}
+
+void XMLStyleExport::exportStyleAttributes( const Reference< XStyle >& rStyle )
+{
+}
+
+void XMLStyleExport::exportStyleContent( const Reference< XStyle >& rStyle )
+{
+}
+
+sal_Bool XMLStyleExport::exportStyle(
+ const Reference< XStyle >& rStyle,
+ const sal_Char *pXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ const OUString* pPrefix)
+{
+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+
+ Any aAny;
+
+ // Don't export styles that aren't existing really. This may be the
+ // case for StarOffice Writer's pool styles.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsPhysical );
+ if( !*(sal_Bool *)aAny.getValue() )
+ return sal_False;
+ }
+
+ // <style:style ...>
+ GetExport().CheckAttrList();
+
+ // style:name="..."
+ OUString sName;
+
+ if(pPrefix)
+ sName = *pPrefix;
+ sName += rStyle->getName();
+
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_name, sName );
+
+ // style:family="..."
+ if( pXMLFamily )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_family,
+ pXMLFamily );
+
+ // style:parent-style-name="..."
+ OUString sParentString(rStyle->getParentStyle());
+ OUString sParent;
+
+ if(sParentString.getLength())
+ {
+ if(pPrefix)
+ sParent = *pPrefix;
+ sParent += sParentString;
+ }
+ else
+ sParent = sPoolStyleName;
+
+ if( sParent.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_parent_style_name,
+ sParent );
+
+ // style:next-style-name="..." (paragraph styles only)
+ if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ {
+ aAny = xPropSet->getPropertyValue( sFollowStyle );
+ OUString sNextName;
+ aAny >>= sNextName;
+ if( sName != sNextName )
+ {
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_next_style_name,
+ sNextName );
+ }
+ }
+
+ // style:auto-update="..." (SW only)
+ if( xPropSetInfo->hasPropertyByName( sIsAutoUpdate ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsAutoUpdate );
+ if( *(sal_Bool *)aAny.getValue() )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_auto_update,
+ sXML_true );
+ }
+
+ // style:list-style-name="..." (SW paragarph styles only)
+ if( xPropSetInfo->hasPropertyByName( sNumberingStyleName ) )
+ {
+ Reference< XPropertyState > xPropState( xPropSet, uno::UNO_QUERY );
+ if( PropertyState_DIRECT_VALUE ==
+ xPropState->getPropertyState( sNumberingStyleName ) )
+ {
+ aAny = xPropSet->getPropertyValue( sNumberingStyleName );
+ if( aAny.hasValue() )
+ {
+ OUString sListName;
+ aAny >>= sListName;
+ if( sListName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_list_style_name,
+ sListName );
+ }
+ }
+ }
+
+ // style:pool-id="..." is not required any longer since we use
+ // english style names only
+ exportStyleAttributes( rStyle );
+
+ // TODO: style:help-file-name="..." and style:help-id="..." can neither
+ // be modified by UI nor by API and that for, have not to be exported
+ // currently.
+
+ {
+ // <style:style>
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE, sXML_style,
+ sal_True, sal_True );
+ // <style:properties>
+ ::std::vector< XMLPropertyState > xPropStates =
+ rPropMapper->getPropertySetMapper()->Filter( xPropSet );
+ rPropMapper->exportXML( GetExport().GetDocHandler(), xPropStates,
+ GetExport().GetMM100UnitConverter(),
+ GetExport().GetNamespaceMap(),
+ XML_EXPORT_FLAG_IGN_WS );
+ exportStyleContent( rStyle );
+ }
+ return sal_True;
+}
+
+void XMLStyleExport::exportStyleFamily(
+ const sal_Char *pFamily,
+ const sal_Char *pXMLFamily,
+ const UniReference < XMLPropertySetMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
+{
+ const OUString sFamily(OUString::createFromAscii(pFamily ));
+ UniReference < SvXMLExportPropertyMapper > xExpPropMapper =
+ new SvXMLExportPropertyMapper( rPropMapper );
+ exportStyleFamily( sFamily, pXMLFamily, xExpPropMapper, bUsed, nFamily,
+ pPrefix);
+}
+
+void XMLStyleExport::exportStyleFamily(
+ const OUString& rFamily, const sal_Char *pXMLFamily,
+ const UniReference < XMLPropertySetMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
+{
+ UniReference < SvXMLExportPropertyMapper > xExpPropMapper =
+ new SvXMLExportPropertyMapper( rPropMapper );
+ exportStyleFamily( rFamily, pXMLFamily, xExpPropMapper, bUsed, nFamily,
+ pPrefix);
+}
+
+void XMLStyleExport::exportStyleFamily(
+ const sal_Char *pFamily,
+ const sal_Char *pXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
+{
+ const OUString sFamily(OUString::createFromAscii(pFamily ));
+ exportStyleFamily( sFamily, pXMLFamily, rPropMapper, bUsed, nFamily,
+ pPrefix);
+}
+
+void XMLStyleExport::exportStyleFamily(
+ const OUString& rFamily, const sal_Char *pXMLFamily,
+ const UniReference < SvXMLExportPropertyMapper >& rPropMapper,
+ sal_Bool bUsed, sal_uInt16 nFamily, const OUString* pPrefix)
+{
+ DBG_ASSERT( GetExport().GetModel().is(), "There is the model?" );
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(),
+ UNO_QUERY );
+ Reference< XNameContainer > xStyleCont;
+
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ if( xFamilies->hasByName( rFamily ) )
+ xFamilies->getByName( rFamily ) >>= xStyleCont;
+
+ if( !xStyleCont.is() )
+ return;
+
+ Reference< XIndexAccess > xStyles( xStyleCont, UNO_QUERY );
+ const sal_Int32 nStyles = xStyles->getCount();
+
+ // If next styles are supported and used styles should be exported only,
+ // the next style may be unused but has to be exported, too. In this case
+ // the names of all exported styles are remembered.
+ SvStringsSortDtor *pExportedStyles = 0;
+ sal_Bool bFirstStyle = sal_True;
+
+ for( sal_Int32 i=0; i < nStyles; i++ )
+ {
+ Reference< XStyle > xStyle;
+ xStyles->getByIndex( i ) >>= xStyle;
+
+ DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+ if( xStyle.is() )
+ {
+ if( !bUsed || xStyle->isInUse() )
+ {
+ BOOL bExported = exportStyle( xStyle, pXMLFamily, rPropMapper, pPrefix );
+ if( bUsed && bFirstStyle && bExported )
+ {
+ // If this is the first style, find out wether next styles
+ // are supported.
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+
+ if( xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ pExportedStyles = new SvStringsSortDtor;
+ bFirstStyle = sal_False;
+ }
+
+ if( pExportedStyles && bExported )
+ {
+ // If next styles are supported, remember this style's name.
+ String *pTmp = new String( xStyle->getName() );
+ if( !pExportedStyles->Insert( pTmp ) )
+ delete pTmp;
+ }
+ }
+
+ // if an auto style pool is given, remember this style's name as a
+ // style name that must not be used by automatic styles.
+ if( pAutoStylePool )
+ pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
+ }
+ }
+
+ if( pExportedStyles )
+ {
+ // if next styles are supported, export all next styles that are
+ // unused and that for, haven't been exported in the first loop.
+ for( i=0; i < nStyles; i++ )
+ {
+ Reference< XStyle > xStyle;
+ xStyles->getByIndex( i ) >>= xStyle;
+
+ DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+ if( xStyle.is() )
+ {
+ Reference< XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo( xPropSet->getPropertySetInfo() );
+
+ // styles that aren't existing realy are ignored.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ Any aAny( xPropSet->getPropertyValue( sIsPhysical ) );
+ if( !*(sal_Bool *)aAny.getValue() )
+ continue;
+ }
+
+ if( !xStyle->isInUse() )
+ continue;
+
+ if( !xPropSetInfo->hasPropertyByName( sFollowStyle ) )
+ {
+ DBG_ASSERT( 0==sFollowStyle.getLength(),
+ "no follow style???" );
+ continue;
+ }
+
+ OUString sNextName;
+ xPropSet->getPropertyValue( sFollowStyle ) >>= sNextName;
+ String sTmp( sNextName );
+ // if the next style hasn't been exported by now, export it now
+ // and remember its name.
+ if( xStyle->getName() != sNextName &&
+ !pExportedStyles->Seek_Entry( &sTmp ) )
+ {
+ xStyleCont->getByName( sNextName ) >>= xStyle;
+ DBG_ASSERT( xStyle.is(), "Style not found for export!" );
+
+ if( xStyle.is() && exportStyle( xStyle, pXMLFamily, rPropMapper, pPrefix ) )
+ pExportedStyles->Insert( new String( sTmp ) );
+ }
+ }
+ }
+ }
+
+ delete pExportedStyles;
+}
+
+
diff --git a/xmloff/source/style/tabsthdl.cxx b/xmloff/source/style/tabsthdl.cxx
new file mode 100644
index 000000000000..21c064319c89
--- /dev/null
+++ b/xmloff/source/style/tabsthdl.cxx
@@ -0,0 +1,129 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabsthdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+#include <tabsthdl.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_TABSTOP_HPP_
+#include <com/sun/star/style/TabStop.hpp>
+#endif
+
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFontFamilyNamePropHdl
+//
+
+XMLTabStopPropHdl::~XMLTabStopPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLTabStopPropHdl::equals( const uno::Any& r1, const uno::Any& r2 ) const
+{
+ sal_Bool bEqual = sal_False;
+
+ uno::Sequence< style::TabStop> aSeq1;
+ if( r1 >>= aSeq1 )
+ {
+ uno::Sequence< style::TabStop> aSeq2;
+ if( r2 >>= aSeq2 )
+ {
+ if( aSeq1.getLength() == aSeq2.getLength() )
+ {
+ const style::TabStop* pTabs1 = aSeq1.getConstArray();
+ const style::TabStop* pTabs2 = aSeq2.getConstArray();
+
+ int i=0;
+ bEqual = sal_True;
+
+ do
+ {
+ bEqual = ( pTabs1[i].Position == pTabs2[i].Position &&
+ pTabs1[i].Alignment == pTabs2[i].Alignment &&
+ pTabs1[i].DecimalChar == pTabs2[i].DecimalChar &&
+ pTabs1[i].FillChar == pTabs2[i].FillChar );
+ i++;
+
+ } while( bEqual && i < aSeq1.getLength() );
+ }
+ }
+ }
+
+ return bEqual;
+}
+
+sal_Bool XMLTabStopPropHdl::importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ return sal_False;
+}
+
+sal_Bool XMLTabStopPropHdl::exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ return sal_False;
+}
+
diff --git a/xmloff/source/style/tabsthdl.hxx b/xmloff/source/style/tabsthdl.hxx
new file mode 100644
index 000000000000..d70698743c67
--- /dev/null
+++ b/xmloff/source/style/tabsthdl.hxx
@@ -0,0 +1,84 @@
+/*************************************************************************
+ *
+ * $RCSfile: tabsthdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLTabStopPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLTabStopPropHdl();
+
+ virtual sal_Bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
+
+ /// TabStops will be imported/exported as XML-Elements. So the Import/Export-work must be done at another place.
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_TABSTOPTYPES_HXX
diff --git a/xmloff/source/style/undlihdl.cxx b/xmloff/source/style/undlihdl.cxx
new file mode 100644
index 000000000000..66391d07d2c5
--- /dev/null
+++ b/xmloff/source/style/undlihdl.cxx
@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * $RCSfile: undlihdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+#include <undlihdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLEMENT_HXX
+#include "xmlelement.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvXMLEnumMapEntry __READONLY_DATA pXML_Underline_Enum[] =
+{
+ { sXML_underline_none, UNDERLINE_NONE },
+ { sXML_underline_single, UNDERLINE_SINGLE },
+ { sXML_underline_double, UNDERLINE_DOUBLE },
+ { sXML_underline_dotted, UNDERLINE_DOTTED },
+ { sXML_underline_dash, UNDERLINE_DASH },
+ { sXML_underline_long_dash, UNDERLINE_LONGDASH },
+ { sXML_underline_dot_dash, UNDERLINE_DASHDOT },
+ { sXML_underline_dot_dot_dash, UNDERLINE_DASHDOTDOT },
+ { sXML_underline_wave, UNDERLINE_WAVE },
+ { sXML_underline_bold, UNDERLINE_BOLD },
+ { sXML_underline_bold_dotted, UNDERLINE_BOLDDOTTED },
+ { sXML_underline_bold_dash, UNDERLINE_BOLDDASH },
+ { sXML_underline_bold_long_dash, UNDERLINE_BOLDLONGDASH },
+ { sXML_underline_bold_dot_dash, UNDERLINE_BOLDDASHDOT },
+ { sXML_underline_bold_dot_dot_dash, UNDERLINE_BOLDDASHDOTDOT },
+ { sXML_underline_bold_wave, UNDERLINE_BOLDWAVE },
+ { sXML_underline_double_wave, UNDERLINE_DOUBLEWAVE },
+ { sXML_underline_small_wave, UNDERLINE_SMALLWAVE },
+ { 0, 0 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPosturePropHdl
+//
+
+XMLUnderlinePropHdl::~XMLUnderlinePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLUnderlinePropHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 eUnderline;
+
+ if( ( bRet = rUnitConverter.convertEnum( eUnderline, rStrImpValue, pXML_Underline_Enum ) ) )
+ rValue <<= eUnderline;
+
+ return bRet;
+}
+
+sal_Bool XMLUnderlinePropHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( rValue >>= nValue )
+ {
+ if( ( bRet = rUnitConverter.convertEnum( aOut, nValue, pXML_Underline_Enum ) ) )
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
diff --git a/xmloff/source/style/undlihdl.hxx b/xmloff/source/style/undlihdl.hxx
new file mode 100644
index 000000000000..a1e8a85b3452
--- /dev/null
+++ b/xmloff/source/style/undlihdl.hxx
@@ -0,0 +1,81 @@
+/*************************************************************************
+ *
+ * $RCSfile: undlihdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLUnderlinePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLUnderlinePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+#endif // _XMLOFF_PROPERTYHANDLER_UNDERLINETYPES_HXX
diff --git a/xmloff/source/style/uniref.cxx b/xmloff/source/style/uniref.cxx
new file mode 100644
index 000000000000..664adce30ec7
--- /dev/null
+++ b/xmloff/source/style/uniref.cxx
@@ -0,0 +1,74 @@
+/*************************************************************************
+ *
+ * $RCSfile: uniref.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _UNIVERSALL_REFERENCE_HXX
+#include "uniref.hxx"
+#endif
+
+UniRefBase::~UniRefBase()
+{
+}
+
+void UniRefBase::release()
+{
+ if( !osl_decrementInterlockedCount( &m_refCount ) )
+ delete this;
+}
diff --git a/xmloff/source/style/weighhdl.cxx b/xmloff/source/style/weighhdl.cxx
new file mode 100644
index 000000000000..58b3cc3c25c0
--- /dev/null
+++ b/xmloff/source/style/weighhdl.cxx
@@ -0,0 +1,231 @@
+/*************************************************************************
+ *
+ * $RCSfile: weighhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+#include <weighhdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+#ifndef _SOLAR_H
+#include <tools/solar.h>
+#endif
+
+#ifndef _INC_LIMITS
+#include <limits.h>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _RTL_USTRING_
+#include <rtl/ustring>
+#endif
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+struct FontWeightMapper
+{
+ FontWeight eWeight;
+ USHORT nValue;
+};
+
+FontWeightMapper const aFontWeightMap[] =
+{
+ { WEIGHT_DONTKNOW, 0 },
+ { WEIGHT_THIN, 100 },
+ { WEIGHT_ULTRALIGHT, 150 },
+ { WEIGHT_LIGHT, 250 },
+ { WEIGHT_SEMILIGHT, 350 },
+ { WEIGHT_NORMAL, 400 },
+ { WEIGHT_MEDIUM, 450 },
+ { WEIGHT_SEMIBOLD, 600 },
+ { WEIGHT_BOLD, 700 },
+ { WEIGHT_ULTRABOLD, 800 },
+ { WEIGHT_BLACK, 900 },
+ { (FontWeight)USHRT_MAX, 1000 }
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLFmtBreakBeforePropHdl
+//
+
+XMLFontWeightPropHdl::~XMLFontWeightPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLFontWeightPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_uInt16 nWeight = 0;
+
+ if( rStrImpValue.compareToAscii( sXML_weight_normal ) == 0 )
+ {
+ nWeight = 400;
+ bRet = sal_True;
+ }
+ else if( rStrImpValue.compareToAscii( sXML_weight_bold ) == 0 )
+ {
+ nWeight = 700;
+ bRet = sal_True;
+ }
+ else
+ {
+ sal_Int32 nTemp;
+ if( ( bRet = rUnitConverter.convertNumber( nTemp, rStrImpValue, 100, 900 ) ) )
+ nWeight = nTemp;
+ }
+
+ if( bRet )
+ {
+ bRet = sal_False;
+
+ for( int i = 0; aFontWeightMap[i].eWeight != USHRT_MAX; i++ )
+ {
+ if( (nWeight >= aFontWeightMap[i].nValue) && (nWeight <= aFontWeightMap[i+1].nValue) )
+ {
+ sal_uInt16 nDiff1 = nWeight - aFontWeightMap[i].nValue;
+ sal_uInt16 nDiff2 = aFontWeightMap[i+1].nValue - nWeight;
+
+ if( nDiff1 < nDiff2 )
+ rValue <<= (float)( VCLUnoHelper::ConvertFontWeight( aFontWeightMap[i].eWeight ) );
+ else
+ rValue <<= (float)( VCLUnoHelper::ConvertFontWeight( aFontWeightMap[i+1].eWeight ) );
+
+ bRet = sal_True;
+ break;
+ }
+ }
+ }
+
+ return bRet;
+}
+
+sal_Bool XMLFontWeightPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ FontWeight eWeight;
+
+ float fValue;
+ if( !( rValue >>= fValue ) )
+ {
+ sal_Int32 nValue;
+ if( rValue >>= nValue )
+ {
+ fValue = (float)nValue;
+ bRet = sal_True;
+ }
+ }
+ else
+ bRet = sal_True;
+
+ eWeight = VCLUnoHelper::ConvertFontWeight( fValue );
+
+ if( bRet )
+ {
+ sal_uInt16 nWeight = 0;
+
+ for( int i = 0; aFontWeightMap[i].eWeight != -1; i++ )
+ {
+ if( aFontWeightMap[i].eWeight == eWeight )
+ {
+ nWeight = aFontWeightMap[i].nValue;
+ break;
+ }
+ }
+
+ OUStringBuffer aOut;
+
+ if( 400 == nWeight )
+ aOut.appendAscii( sXML_weight_normal );
+ else if( 700 == nWeight )
+ aOut.appendAscii( sXML_weight_bold );
+ else
+ rUnitConverter.convertNumber( aOut, (sal_Int32)nWeight );
+
+ rStrExpValue = aOut.makeStringAndClear();
+ }
+
+ return bRet;
+}
+
diff --git a/xmloff/source/style/weighhdl.hxx b/xmloff/source/style/weighhdl.hxx
new file mode 100644
index 000000000000..45bbcb585ba5
--- /dev/null
+++ b/xmloff/source/style/weighhdl.hxx
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * $RCSfile: weighhdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type:
+*/
+class XMLFontWeightPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLFontWeightPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+
+#endif // _XMLOFF_PROPERTYHANDLER_FONTWEIGHTTYPES_HXX
diff --git a/xmloff/source/style/xmlaustp.cxx b/xmloff/source/style/xmlaustp.cxx
new file mode 100644
index 000000000000..e1451c95fae1
--- /dev/null
+++ b/xmloff/source/style/xmlaustp.cxx
@@ -0,0 +1,164 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlaustp.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _XMLOFF_XMLASTPL_IMPL_HXX
+#include "impastpl.hxx"
+#endif
+#ifndef _XMLOFF_XMLASTPLP_HXX
+#include "xmlaustp.hxx"
+#endif
+
+using namespace ::std;
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+void SvXMLAutoStylePoolP::exportStyleAttributes(
+ SvXMLAttributeList& rAttrList,
+ sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+}
+
+SvXMLAutoStylePoolP::SvXMLAutoStylePoolP()
+{
+ pImpl = new SvXMLAutoStylePoolP_Impl;
+}
+
+SvXMLAutoStylePoolP::~SvXMLAutoStylePoolP()
+{
+ delete pImpl;
+}
+
+// TODO: romove this
+void SvXMLAutoStylePoolP::AddFamily(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ XMLPropertySetMapper* pMapper,
+ OUString aStrPrefix )
+{
+ UniReference <XMLPropertySetMapper> xTmp = pMapper;
+ AddFamily( nFamily, rStrName, xTmp, aStrPrefix );
+}
+
+void SvXMLAutoStylePoolP::AddFamily(
+ sal_Int32 nFamily,
+ const OUString& rStrName,
+ const UniReference < XMLPropertySetMapper > & rMapper,
+ const OUString& rStrPrefix )
+{
+ pImpl->AddFamily( nFamily, rStrName, rMapper, rStrPrefix );
+}
+
+void SvXMLAutoStylePoolP::RegisterName( sal_Int32 nFamily,
+ const OUString& rName )
+{
+ pImpl->RegisterName( nFamily, rName );
+}
+
+OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties )
+{
+ OUString sEmpty;
+ return pImpl->Add( nFamily, sEmpty, rProperties );
+}
+
+OUString SvXMLAutoStylePoolP::Add( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties )
+{
+ return pImpl->Add( nFamily, rParent, rProperties );
+}
+
+OUString SvXMLAutoStylePoolP::Find( sal_Int32 nFamily,
+ const vector< XMLPropertyState >& rProperties ) const
+{
+ OUString sEmpty;
+ return pImpl->Find( nFamily, sEmpty, rProperties );
+}
+
+OUString SvXMLAutoStylePoolP::Find( sal_Int32 nFamily,
+ const OUString& rParent,
+ const vector< XMLPropertyState >& rProperties ) const
+{
+ return pImpl->Find( nFamily, rParent, rProperties );
+}
+
+void SvXMLAutoStylePoolP::exportXML( sal_Int32 nFamily,
+ const SvXMLExportPropertyMapper& rPropExp,
+ const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap) const
+{
+ pImpl->exportXML( nFamily, rPropExp, rHandler, rUnitConverter,
+ rNamespaceMap, this);
+}
+
+void SvXMLAutoStylePoolP::ClearEntries()
+{
+ pImpl->ClearEntries();
+}
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
new file mode 100644
index 000000000000..c157e464cbb3
--- /dev/null
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -0,0 +1,486 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlbahdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+#include <xmlbahdl.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#include "xmlkywd.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+
+
+void lcl_xmloff_setAny( Any& rValue, sal_Int32 nValue, sal_Int8 nBytes )
+{
+ switch( nBytes )
+ {
+ case 1:
+ if( nValue < SCHAR_MIN )
+ nValue = SCHAR_MIN;
+ else if( nValue > SCHAR_MAX )
+ nValue = SCHAR_MAX;
+ rValue <<= (sal_Int8)nValue;
+ break;
+ case 2:
+ if( nValue < SHRT_MIN )
+ nValue = SHRT_MIN;
+ else if( nValue > SHRT_MAX )
+ nValue = SHRT_MAX;
+ rValue <<= (sal_Int16)nValue;
+ break;
+ case 4:
+ rValue <<= nValue;
+ break;
+ }
+}
+
+sal_Bool lcl_xmloff_getAny( const Any& rValue, sal_Int32& nValue,
+ sal_Int8 nBytes )
+{
+ sal_Bool bRet = sal_False;
+
+ switch( nBytes )
+ {
+ case 1:
+ {
+ sal_Int8 nValue8;
+ bRet = rValue >>= nValue8;
+ nValue = nValue8;
+ }
+ break;
+ case 2:
+ {
+ sal_Int16 nValue16;
+ bRet = rValue >>= nValue16;
+ nValue = nValue16;
+ }
+ break;
+ case 4:
+ bRet = rValue >>= nValue;
+ break;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNumberPropHdl
+//
+
+XMLNumberPropHdl::~XMLNumberPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNumberPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue;
+ bRet = rUnitConverter.convertNumber( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLNumberPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ rUnitConverter.convertNumber( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// class XMLNumberNonePropHdl
+//
+
+XMLNumberNonePropHdl::~XMLNumberNonePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNumberNonePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue;
+ if( rStrImpValue.compareToAscii( sXML_no_limit ) == 0 )
+ {
+ nValue = 0;
+ bRet = sal_True;
+ }
+ else
+ {
+ bRet = rUnitConverter.convertNumber( nValue, rStrImpValue );
+ }
+ rValue <<= nValue;
+
+ return bRet;
+}
+
+sal_Bool XMLNumberNonePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+
+ if( rValue >>= nValue )
+ {
+ OUStringBuffer aOut;
+
+ if( nValue == 0 )
+ {
+ aOut.appendAscii( sXML_no_limit );
+ }
+ else
+ {
+ rUnitConverter.convertNumber( aOut, nValue );
+ }
+
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLMeasurePropHdl
+//
+
+XMLMeasurePropHdl::~XMLMeasurePropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLMeasurePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue;
+ bRet = rUnitConverter.convertMeasure( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLMeasurePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ rUnitConverter.convertMeasure( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLBoolPropHdl
+//
+
+XMLBoolPropHdl::~XMLBoolPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLBoolPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bValue;
+ bRet = rUnitConverter.convertBool( bValue, rStrImpValue );
+ rValue <<= sal_Bool(bValue);
+
+ return bRet;
+}
+
+sal_Bool XMLBoolPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Bool bValue;
+
+ if (rValue >>= bValue)
+ {
+ rUnitConverter.convertBool( aOut, bValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLNBoolPropHdl
+//
+
+XMLNBoolPropHdl::~XMLNBoolPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLNBoolPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Bool bValue;
+ bRet = rUnitConverter.convertBool( bValue, rStrImpValue );
+ rValue <<= sal_Bool(!bValue);
+
+ return bRet;
+}
+
+sal_Bool XMLNBoolPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ OUStringBuffer aOut;
+ sal_Bool bValue;
+
+ if (rValue >>= bValue)
+ {
+ rUnitConverter.convertBool( aOut, !bValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLPercentPropHdl
+//
+
+XMLPercentPropHdl::~XMLPercentPropHdl()
+{
+ // nothing to do
+}
+
+sal_Bool XMLPercentPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ sal_Int32 nValue;
+ bRet = rUnitConverter.convertPercent( nValue, rStrImpValue );
+ lcl_xmloff_setAny( rValue, nValue, nBytes );
+
+ return bRet;
+}
+
+sal_Bool XMLPercentPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ sal_Int32 nValue;
+ OUStringBuffer aOut;
+
+ if( lcl_xmloff_getAny( rValue, nValue, nBytes ) )
+ {
+ rUnitConverter.convertPercent( aOut, nValue );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLColorPropHdl
+//
+
+XMLColorPropHdl::~XMLColorPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLColorPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ Color aColor;
+
+ bRet = rUnitConverter.convertColor( aColor, rStrImpValue );
+ rValue <<= (sal_Int32)( aColor.GetColor() );
+
+ return bRet;
+}
+
+sal_Bool XMLColorPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+ Color aColor;
+ sal_Int32 nColor;
+
+ if( rValue >>= nColor )
+ {
+ aColor.SetColor( nColor );
+
+ OUStringBuffer aOut;
+ rUnitConverter.convertColor( aOut, aColor );
+ rStrExpValue = aOut.makeStringAndClear();
+
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLStringPropHdl
+//
+
+XMLStringPropHdl::~XMLStringPropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLStringPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ rValue <<= rStrImpValue;
+ bRet = sal_True;
+
+ return bRet;
+}
+
+sal_Bool XMLStringPropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ if( rValue >>= rStrExpValue )
+ bRet = sal_True;
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// class XMLDoublePropHdl
+//
+
+XMLDoublePropHdl::~XMLDoublePropHdl()
+{
+ // Nothing to do
+}
+
+sal_Bool XMLDoublePropHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ double fDblValue;
+ sal_Bool bRet = rUnitConverter.convertNumber( fDblValue, rStrImpValue );
+ rValue <<= fDblValue;
+ return bRet;
+}
+
+sal_Bool XMLDoublePropHdl::exportXML( OUString& rStrExpValue, const Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ double fValue;
+
+ if( rValue >>= fValue )
+ {
+ OUStringBuffer aOut;
+ rUnitConverter.convertNumber( aOut, fValue );
+ rStrExpValue = aOut.makeStringAndClear();
+ bRet = sal_True;
+ }
+
+ return bRet;
+}
+
diff --git a/xmloff/source/style/xmlbahdl.hxx b/xmloff/source/style/xmlbahdl.hxx
new file mode 100644
index 000000000000..7edb77573dbd
--- /dev/null
+++ b/xmloff/source/style/xmlbahdl.hxx
@@ -0,0 +1,183 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlbahdl.hxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+#define _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
+*/
+class XMLNumberPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+
+public:
+ XMLNumberPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLNumberPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
+*/
+class XMLNumberNonePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLNumberNonePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
+*/
+class XMLMeasurePropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLMeasurePropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLMeasurePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
+*/
+class XMLPercentPropHdl : public XMLPropertyHandler
+{
+ sal_Int8 nBytes;
+public:
+ XMLPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
+ virtual ~XMLPercentPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_BOOL
+*/
+class XMLBoolPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLBoolPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_COLOR
+*/
+class XMLColorPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLColorPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_STRING
+*/
+class XMLStringPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLStringPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
+*/
+class XMLDoublePropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLDoublePropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+
+/**
+ PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
+*/
+class XMLNBoolPropHdl : public XMLPropertyHandler
+{
+public:
+ virtual ~XMLNBoolPropHdl();
+
+ virtual sal_Bool importXML( const ::rtl::OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+ virtual sal_Bool exportXML( ::rtl::OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
+};
+#endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
diff --git a/xmloff/source/style/xmlexppr.cxx b/xmloff/source/style/xmlexppr.cxx
new file mode 100644
index 000000000000..f53110e014eb
--- /dev/null
+++ b/xmloff/source/style/xmlexppr.cxx
@@ -0,0 +1,356 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlexppr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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 "xmlexppr.hxx"
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_ATTRLIST_HXX
+#include "attrlist.hxx"
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLCNITM_HXX
+#include "xmlcnitm.hxx"
+#endif
+
+#ifndef _SVSTDARR_USHORTS
+#define _SVSTDARR_USHORTS
+#include <svtools/svstdarr.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ctor/dtor , class SvXMLExportPropertyMapper
+//
+
+SvXMLExportPropertyMapper::SvXMLExportPropertyMapper( const UniReference< XMLPropertySetMapper >& rMapper )
+: maPropMapper( rMapper )
+{
+}
+
+SvXMLExportPropertyMapper::~SvXMLExportPropertyMapper()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// public methods
+//
+
+/** fills the given attribute list with the items in the given set */
+void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags /* = 0 */ ) const
+{
+ _exportXML( rAttrList, rProperties, rUnitConverter, rNamespaceMap, nFlags, 0 );
+}
+
+
+void SvXMLExportPropertyMapper::exportXML( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags ) const
+{
+ if( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0 )
+ _exportXML( rAttrList, rProperty, rUnitConverter, rNamespaceMap, nFlags); //, 0 );
+}
+
+void SvXMLExportPropertyMapper::exportXML( const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags ) const
+{
+ SvXMLAttributeList *pAttrList = new SvXMLAttributeList();
+ uno::Reference< ::com::sun::star::xml::sax::XAttributeList > xAttrList( pAttrList );
+
+ SvUShorts aIndexArray;
+
+ _exportXML( *pAttrList, rProperties, rUnitConverter, rNamespaceMap, nFlags, &aIndexArray );
+
+ if( pAttrList->getLength() > 0L || (nFlags & XML_EXPORT_FLAG_EMPTY) != 0 || aIndexArray.Count() != 0 )
+ {
+ if( (nFlags & XML_EXPORT_FLAG_IGN_WS) != 0 )
+ {
+ OUString sWS( OUString::createFromAscii(sXML_WS) );
+ rHandler->ignorableWhitespace( sWS );
+ }
+
+ OUString sLName( OUString::createFromAscii(sXML_properties) );
+ OUString sName = rNamespaceMap.GetQNameByKey( XML_NAMESPACE_STYLE, sLName );
+ rHandler->startElement( sName, xAttrList );
+
+ exportElementItems( rHandler, rUnitConverter, rNamespaceMap, rProperties, nFlags, aIndexArray );
+
+ rHandler->endElement( sName );
+ }
+}
+
+/** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
+void SvXMLExportPropertyMapper::handleSpecialItem( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+ // const SfxItemSet* pSet /* = NULL */ ) const Do we need this any more ?
+{
+ DBG_ERROR( "special item not handled in xml export" );
+}
+
+/** this method is called for every item that has the MID_FLAG_NO_ITEM_EXPORT flag set */
+void SvXMLExportPropertyMapper::handleNoItem( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+ // const SfxItemSet& rSet ) const Do we need this any more ?
+{
+ DBG_ERROR( "no item not handled in xml export" );
+}
+
+/** this method is called for every item that has the MID_FLAG_ELEMENT_EXPORT flag set */
+void SvXMLExportPropertyMapper::handleElementItem( const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ // const SfxItemSet& rSet, Do we need this any more ?
+ sal_uInt16 nFlags ) const
+{
+ DBG_ERROR( "element item not handled in xml export" );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// protected methods
+//
+
+/** fills the given attribute list with the items in the given set */
+void SvXMLExportPropertyMapper::_exportXML( SvXMLAttributeList& rAttrList,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags,
+ SvUShorts* pIndexArray ) const
+{
+ const sal_uInt16 nCount = rProperties.size();
+ sal_uInt16 nIndex = 0;
+
+ while( nIndex < nCount )
+ {
+ if( rProperties[nIndex].mnIndex >= 0 ) // valid entry?
+ {
+ // we have a valid map entry here, so lets use it...
+ if( ( maPropMapper->GetEntryFlags( rProperties[nIndex].mnIndex ) & MID_FLAG_NO_ITEM_EXPORT ) == 0 )
+ {
+ if( ( maPropMapper->GetEntryFlags( rProperties[nIndex].mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT ) != 0 )
+ {
+ // element items do not add any properties,
+ // we export it later
+ if( pIndexArray )
+ pIndexArray->Insert( nIndex, pIndexArray->Count() );
+ }
+ else
+ {
+ exportXML( rAttrList, rProperties[nIndex], rUnitConverter, rNamespaceMap, nFlags );// , &rSet ); I think we do not need the total vector of XMLPropertyState in the called method
+ }
+ }
+ else
+ {
+ handleNoItem( rAttrList, rProperties[nIndex], rUnitConverter, rNamespaceMap ); //, rSet ); Must we transfer the total set any more ?
+ }
+ }
+
+ nIndex++;
+ }
+}
+
+void SvXMLExportPropertyMapper::_exportXML( SvXMLAttributeList& rAttrList,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ sal_uInt16 nFlags ) const
+{
+ OUString sCDATA( OUString::createFromAscii( sXML_CDATA ) );
+
+ if ( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) & MID_FLAG_SPECIAL_ITEM_EXPORT ) != 0 )
+ {
+ /* Currently, we have nothing like a SvXMLAttrContainerItem, since we use properties instead of poolitems
+
+ if( rItem.ISA( SvXMLAttrContainerItem ) )
+ {
+ SvXMLNamespaceMap *pNewNamespaceMap = 0;
+ const SvXMLNamespaceMap *pNamespaceMap = &rNamespaceMap;
+
+ const SvXMLAttrContainerItem *pUnknown = PTR_CAST( SvXMLAttrContainerItem, &rItem );
+
+ sal_uInt16 nCount = pUnknown->GetAttrCount();
+ OUStringBuffer sName;
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ OUString sPrefix( pUnknown->GetAttrPrefix( i ) );
+ if( sPrefix.getLength() )
+ {
+ OUString sNamespace( pUnknown->GetAttrNamespace( i ) );
+
+ // if the prefix isn't defined yet or has another meaning,
+ // we have to redefine it now.
+ sal_uInt16 nIdx = pNamespaceMap->GetIndexByPrefix( sPrefix );
+ if( USHRT_MAX == nIdx ||
+ pNamespaceMap->GetNameByIndex( nIdx ) != sNamespace )
+ {
+ if( !pNewNamespaceMap )
+ {
+ pNewNamespaceMap =
+ new SvXMLNamespaceMap( rNamespaceMap );
+ pNamespaceMap = pNewNamespaceMap;
+ }
+ pNewNamespaceMap->Add( sPrefix, sNamespace );
+
+ sName.appendAscii( sXML_xmlns );
+ sName.append( sal_Unicode(':') );
+ sName.append( sPrefix );
+ rAttrList.AddAttribute( sName.makeStringAndClear(), sCDATA,
+ sNamespace );
+ }
+
+ sName.append( sPrefix );
+ sName.append( sal_Unicode(':') );
+ }
+
+ sName.append( pUnknown->GetAttrLName( i ) );
+ rAttrList.AddAttribute( sName.makeStringAndClear(), sCDATA,
+ pUnknown->GetAttrValue(i) );
+ }
+
+ delete pNewNamespaceMap;
+ }
+ else
+ */
+ {
+ handleSpecialItem( rAttrList, rProperty /*rEntry, rItem*/, rUnitConverter, rNamespaceMap ); //, pSet ); Must we transfer the total set any more ?
+ }
+ }
+ else if ( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT ) == 0 )
+ {
+ OUString aValue;
+ const OUString sName( rNamespaceMap.GetQNameByKey( maPropMapper->GetEntryNameSpace( rProperty.mnIndex ),
+ maPropMapper->GetEntryXMLName( rProperty.mnIndex ) ) );
+
+ sal_Bool bRemove = sal_False;
+ if( ( maPropMapper->GetEntryFlags( rProperty.mnIndex ) & MID_FLAG_MERGE_ATTRIBUTE ) != 0 )
+ {
+ aValue = rAttrList.getValueByName( sName );
+ bRemove = aValue.getLength() != 0;
+ }
+
+ if( maPropMapper->exportXML( aValue, rProperty, rUnitConverter ) ) //rEntry.nMemberId & MID_FLAG_MASK, rUnitConverter ) )
+ {
+ if( bRemove )
+ rAttrList.RemoveAttribute( sName );
+ rAttrList.AddAttribute( sName, sCDATA, aValue );
+ }
+ }
+}
+
+void SvXMLExportPropertyMapper::exportElementItems( const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap,
+ const ::std::vector< XMLPropertyState >& rProperties,
+ sal_uInt16 nFlags,
+ const SvUShorts& rIndexArray ) const
+{
+ const sal_uInt16 nCount = rIndexArray.Count();
+
+ sal_Bool bItemsExported = sal_False;
+ OUString sWS( OUString::createFromAscii(sXML_WS) );
+ for( sal_uInt16 nIndex = 0; nIndex < nCount; nIndex++ )
+ {
+ const sal_uInt16 nElement = rIndexArray.GetObject( nIndex );
+
+ DBG_ASSERT( 0 != ( maPropMapper->GetEntryFlags( rProperties[nElement].mnIndex ) & MID_FLAG_ELEMENT_ITEM_EXPORT), "wrong mid flag!" );
+
+ rHandler->ignorableWhitespace( sWS );
+ handleElementItem( rHandler, rProperties[nElement] /**pEntry, *pItem*/, rUnitConverter, rNamespaceMap /*, rSet*/, nFlags);
+ bItemsExported = sal_True;
+ }
+
+ if( bItemsExported )
+ rHandler->ignorableWhitespace( sWS );
+}
+
+/** returns the item with the givin WhichId from the given ItemSet if its
+ set or its default item if its not set and the XML_EXPORT_FLAG_DEEP
+ is set in the flags
+*/
diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx
new file mode 100644
index 000000000000..f0dceb4cfdc0
--- /dev/null
+++ b/xmloff/source/style/xmlimppr.cxx
@@ -0,0 +1,259 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlimppr.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+
+#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
+#include "xmlprmap.hxx"
+#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLCNITM_HXX
+#include "xmlcnitm.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMPPR_HXX
+#include "xmlimppr.hxx"
+#endif
+
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace ::rtl;
+using namespace ::std;
+
+SvXMLImportPropertyMapper::SvXMLImportPropertyMapper(
+ const UniReference< XMLPropertySetMapper >& rMapper ) :
+ maPropMapper ( rMapper )
+{
+}
+
+SvXMLImportPropertyMapper::~SvXMLImportPropertyMapper()
+{
+}
+
+/** fills the given itemset with the attributes in the given list */
+void SvXMLImportPropertyMapper::importXML(
+ vector< XMLPropertyState >& rProperties,
+ Reference< XAttributeList > xAttrList,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+ INT16 nAttr = xAttrList->getLength();
+
+// SvXMLAttrContainerItem *pUnknownItem = 0;
+
+ for( INT16 i=0; i < nAttr; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName, aPrefix, aNamespace;
+ USHORT nPrefix = rNamespaceMap.GetKeyByAttrName( rAttrName, &aPrefix,
+ &aLocalName, &aNamespace );
+
+ if( XML_NAMESPACE_XMLNS == nPrefix )
+ continue;
+
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nIndex = -1; // index of actual property map entry
+ sal_uInt32 nFlags = 0; // flags of actual property map entry
+ do
+ {
+ // find an entry for this attribute
+ nIndex = maPropMapper->GetEntryIndex( nPrefix, aLocalName, nIndex );
+
+ if( nIndex > -1 )
+ {
+ // create a XMLPropertyState with an empty value
+
+ nFlags = maPropMapper->GetEntryFlags( nIndex );
+ if( ( nFlags & (MID_FLAG_NO_ITEM_IMPORT |
+ MID_FLAG_ELEMENT_ITEM_IMPORT) ) == 0 )
+ {
+ XMLPropertyState aNewProperty( nIndex );
+ sal_Int32 nReference = -1;
+
+ // if this is a multi attribute check if another attribute already set
+ // this any. If so use this as a initial value
+ if( ( nFlags & MID_FLAG_MERGE_PROPERTY ) != 0 )
+ {
+ const OUString aAPIName( maPropMapper->GetEntryAPIName( nIndex ) );
+ const sal_Int32 nSize = rProperties.size();
+ for( nReference = 0; nReference < nSize; nReference++ )
+ {
+ if( (nIndex != nReference) && (maPropMapper->GetEntryAPIName( rProperties[nReference].mnIndex ) == aAPIName ))
+ {
+ aNewProperty = rProperties[nReference];
+ aNewProperty.mnIndex = nIndex;
+ break;
+ }
+ }
+
+ if( nReference == nSize )
+ nReference = -1;
+ }
+
+ sal_Bool bSet = sal_False;
+ if( ( nFlags & MID_FLAG_SPECIAL_ITEM_IMPORT ) == 0 )
+ {
+ // let the XMLPropertySetMapper decide how to import the value
+ bSet = maPropMapper->importXML( rValue, aNewProperty,
+ rUnitConverter );
+ }
+ else
+ {
+ bSet = handleSpecialItem( aNewProperty, rProperties,
+ rValue, rUnitConverter,
+ rNamespaceMap );
+ }
+ // store the property in the given vector
+ if( bSet )
+ {
+ if( nReference == -1 )
+ rProperties.push_back( aNewProperty );
+ else
+ rProperties[nReference] = aNewProperty;
+ }
+ }
+ else
+ handleNoItem( nIndex, rProperties, rValue, rUnitConverter,
+ rNamespaceMap );
+ }
+ else
+ {
+ /*
+ if( USHRT_MAX != mnUnknownWhich &&
+ // TODO: PI
+ (XML_NAMESPACE_NONE == nPrefix ||
+ XML_NAMESPACE_UNKNOWN == nPrefix) )
+ {
+ if( !pUnknownItem )
+ {
+ const SfxPoolItem* pItem = 0;
+ if( SFX_ITEM_SET == rSet.GetItemState( mnUnknownWhich, TRUE,
+ &pItem ) )
+ {
+ SfxPoolItem *pNew = pItem->Clone();
+ pUnknownItem = PTR_CAST( SvXMLAttrContainerItem, pNew );
+ DBG_ASSERT( pUnknownItem,
+ "SvXMLAttrContainerItem expected" );
+ if( !pUnknownItem )
+ delete pNew;
+ }
+ else
+ {
+ pUnknownItem = new SvXMLAttrContainerItem( mnUnknownWhich );
+ }
+ }
+ if( pUnknownItem )
+ {
+ if( XML_NAMESPACE_NONE == nPrefix )
+ pUnknownItem->AddAttr( aLocalName, rValue );
+ else
+ pUnknownItem->AddAttr( aPrefix, aNamespace, aLocalName,
+ rValue );
+ }
+ }
+ */
+ }
+ }
+ while( ( nIndex >= 0 ) && (( nFlags & MID_FLAG_MULTI_PROPERTY ) != 0 ) );
+ }
+
+/*
+ if( pUnknownItem )
+ {
+ rSet.Put( *pUnknownItem );
+ delete pUnknownItem;
+ }
+*/
+
+ finished( rProperties );
+}
+
+/** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_IMPORT flag set */
+BOOL SvXMLImportPropertyMapper::handleSpecialItem(
+ XMLPropertyState& rProperty,
+ vector< XMLPropertyState >& rProperties,
+ const OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap ) const
+{
+ DBG_ERROR( "unsuported special item in xml import" );
+ return FALSE;
+}
+
+/** this method is called for every item that has the MID_FLAG_NO_ITEM_IMPORT flag set */
+BOOL SvXMLImportPropertyMapper::handleNoItem(
+ sal_Int32 nIndex,
+ vector< XMLPropertyState >& rProperties,
+ const OUString& rValue,
+ const SvXMLUnitConverter& rUnitConverter,
+ const SvXMLNamespaceMap& rNamespaceMap) const
+{
+ DBG_ERROR( "unsuported no item in xml import" );
+ return FALSE;
+}
+
+void SvXMLImportPropertyMapper::finished(
+ vector< XMLPropertyState >& rProperties ) const
+{
+ // nothing to do here
+}
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
new file mode 100644
index 000000000000..a9dbec395c85
--- /dev/null
+++ b/xmloff/source/style/xmlnume.cxx
@@ -0,0 +1,794 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlnume.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:05 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#include "fonthdl.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_NUMBERINGTYPE_HPP_
+#include <com/sun/star/style/NumberingType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
+#include <com/sun/star/style/XStyle.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XINDEXREPLACE_HPP_
+#include <com/sun/star/container/XIndexReplace.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XBITMAP_HPP_
+#include <com/sun/star/awt/XBitmap.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HPP_
+#include <com/sun/star/text/HoriOrientation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_VERTORIENTATION_HPP_
+#include <com/sun/star/text/VertOrientation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_XCHAPTERNUMBERINGSUPPLIER_HPP_
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLTEXTLISTAUTOSTYLEPOOL_HXX
+#include "XMLTextListAutoStylePool.hxx"
+#endif
+#ifndef _XMLOFF_XMLNUME_HXX
+#include "xmlnume.hxx"
+#endif
+#ifndef _XMLOFF_XMLEXP_HXX
+#include "xmlexp.hxx"
+#endif
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::beans;
+
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] = "SymbolTextDistance";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PARENT_NUMBERING[] = "ParentNumbering";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] = "CharStyleName";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_CHAR[] = "BulletChar";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_BITMAP[] = "GraphicBitmap";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] = "GraphicSize";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_VERT_ORIENT[] = "VertOrient";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] =
+ "FirstLineOffset";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
+
+void SvxXMLNumRuleExport::exportLevelStyles( const uno::Reference< ::com::sun::star::container::XIndexReplace > & xNumRule,
+ sal_Bool bOutline )
+{
+ sal_Int32 nCount = xNumRule ->getCount();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ uno::Any aEntry( xNumRule->getByIndex( i ) );
+ uno::Sequence<beans::PropertyValue> aSeq;
+ if( aEntry >>= aSeq )
+ {
+ exportLevelStyle( i, aSeq, bOutline );
+ }
+ }
+}
+
+void SvxXMLNumRuleExport::exportLevelStyle( INT32 nLevel,
+ const uno::Sequence<beans::PropertyValue>& rProps,
+ BOOL bOutline )
+{
+ sal_Int16 eType = NumberingType::CHAR_SPECIAL;
+
+ sal_Int16 eAdjust = HoriOrientation::LEFT;
+ OUString sPrefix, sSuffix;
+ OUString sTextStyleName;
+ sal_Int32 nSpaceBefore = 0, nMinLabelWidth = 0, nMinLabelDist = 0;
+
+ sal_Int16 nStartValue = 1, nDisplayLevels = 1;
+
+ sal_Unicode cBullet = 0xf095;
+ OUString sBulletFontName, sBulletFontStyleName ;
+ sal_Int16 eBulletFontFamily = FAMILY_DONTKNOW;
+ sal_Int16 eBulletFontPitch = PITCH_DONTKNOW;
+ rtl_TextEncoding eBulletFontEncoding = RTL_TEXTENCODING_DONTKNOW;
+
+ OUString sImageURL;
+ uno::Reference< ::com::sun::star::awt::XBitmap > xBitmap;
+ sal_Int32 nImageWidth = 0, nImageHeight = 0;
+ sal_Int16 eImageVertOrient = VertOrientation::LINE_CENTER;
+
+ sal_Int32 nCount = rProps.getLength();
+ const beans::PropertyValue* pPropArray = rProps.getConstArray();
+ for( sal_Int32 i=0; i<nCount; i++ )
+ {
+ const beans::PropertyValue& rProp = pPropArray[i];
+
+ if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_NUMBERINGTYPE, sizeof(XML_UNO_NAME_NRULE_NUMBERINGTYPE) ) )
+ {
+ sal_Int16 nType;
+ rProp.Value >>= nType;
+ if( nType >= NumberingType::CHARS_UPPER_LETTER &&
+ nType <= NumberingType::CHARS_LOWER_LETTER_N )
+ {
+ eType = nType;
+ }
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_PREFIX, sizeof(XML_UNO_NAME_NRULE_PREFIX) ) )
+ {
+ rProp.Value >>= sPrefix;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_SUFFIX, sizeof(XML_UNO_NAME_NRULE_SUFFIX) ) )
+ {
+ rProp.Value >>= sSuffix;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_BULLET_CHAR, sizeof(XML_UNO_NAME_NRULE_BULLET_CHAR) ) )
+ {
+ OUString sValue;
+ rProp.Value >>= sValue;
+ if( sValue.getLength() > 0 )
+ cBullet = (sal_Unicode)sValue[0];
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_ADJUST, sizeof(XML_UNO_NAME_NRULE_ADJUST) ) )
+ {
+ sal_Int16 nValue;
+ rProp.Value >>= nValue;
+ eAdjust = nValue;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_BULLET_FONT, sizeof(XML_UNO_NAME_NRULE_BULLET_FONT) ) )
+ {
+ awt::FontDescriptor rFDesc;
+ if( rProp.Value >>= rFDesc )
+ {
+ sBulletFontName = rFDesc.Name;
+ sBulletFontStyleName = rFDesc.StyleName;
+ eBulletFontFamily = (sal_Int16)rFDesc.Family;
+ eBulletFontPitch = (sal_Int16)rFDesc.Pitch;
+ eBulletFontEncoding = (rtl_TextEncoding)rFDesc.CharSet;
+ }
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_GRAPHICURL, sizeof(XML_UNO_NAME_NRULE_GRAPHICURL) ) )
+ {
+ rProp.Value >>= sImageURL;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_GRAPHIC_BITMAP, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_BITMAP) ) )
+ {
+ rProp.Value >>= xBitmap;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_START_WITH, sizeof(XML_UNO_NAME_NRULE_START_WITH) ) )
+ {
+ rProp.Value >>= nStartValue;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_LEFT_MARGIN, sizeof(XML_UNO_NAME_NRULE_LEFT_MARGIN) ) )
+ {
+ rProp.Value >>= nSpaceBefore;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET, sizeof(XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET) ) )
+ {
+ rProp.Value >>= nMinLabelWidth;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE, sizeof(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE) ) )
+ {
+ rProp.Value >>= nMinLabelDist;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_PARENT_NUMBERING, sizeof(XML_UNO_NAME_NRULE_PARENT_NUMBERING) ) )
+ {
+ rProp.Value >>= nDisplayLevels;
+ if( nDisplayLevels > nLevel+1 )
+ nDisplayLevels = nLevel+1;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME, sizeof(XML_UNO_NAME_NRULE_CHAR_STYLE_NAME) ) )
+ {
+ rProp.Value >>= sTextStyleName;
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_GRAPHIC_SIZE, sizeof(XML_UNO_NAME_NRULE_GRAPHIC_SIZE) ) )
+ {
+ awt::Size aSize;
+ if( rProp.Value >>= aSize )
+ {
+ nImageWidth = aSize.Width;
+ nImageHeight = aSize.Height;
+ }
+ }
+ else if( 0 == rProp.Name.compareToAscii( XML_UNO_NAME_NRULE_VERT_ORIENT, sizeof(XML_UNO_NAME_NRULE_VERT_ORIENT) ) )
+ {
+ sal_Int16 nValue;
+ rProp.Value >>= nValue;
+ eImageVertOrient = nValue;
+ }
+ }
+
+ if( bOutline && (NumberingType::CHAR_SPECIAL == eType ||
+ NumberingType::BITMAP == eType) )
+ {
+ DBG_ASSERT( !bOutline,
+ "SvxXMLNumRuleExport::exportLevelStyle: invalid style for outline" );
+ return;
+ }
+
+ GetExport().CheckAttrList();
+
+ // text:level
+ OUStringBuffer sTmp;
+ sTmp.append( nLevel+1L );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_level, sTmp.makeStringAndClear() );
+ if( sTextStyleName.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_style_name, sTextStyleName );
+ if( sPrefix.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_num_prefix, sPrefix );
+ if( sSuffix.getLength() > 0 )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_num_suffix, sSuffix );
+
+ const sal_Char *pElem = sXML_list_level_style_number;
+ if( NumberingType::CHAR_SPECIAL == eType )
+ {
+ // <text:list-level-style-bullet>
+ pElem = sXML_list_level_style_bullet;
+
+ // text:bullet-char="..."
+ sTmp.append( cBullet );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_bullet_char,
+ sTmp.makeStringAndClear() );
+ }
+ else if( NumberingType::BITMAP == eType )
+ {
+ // <text:list-level-style-image>
+
+ pElem = sXML_list_level_style_image;
+
+
+ if( sImageURL.getLength() )
+ {
+ String sURL( sImageURL );
+ INetURLObject::AbsToRel( sURL );
+ sImageURL = sURL;
+ GetExport().AddAttribute( XML_NAMESPACE_XLINK, sXML_href, sImageURL );
+
+ GetExport().AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_type, sXML_simple );
+ GetExport().AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_show, sXML_embed );
+ GetExport().AddAttributeASCII( XML_NAMESPACE_XLINK, sXML_actuate, sXML_onLoad );
+ }
+ else
+ {
+ DBG_ASSERT( !xBitmap.is(),
+ "embedded images are not supported by now" );
+ }
+ }
+ else
+ {
+ // <text:list-level-style-number> or <text:outline-level-style>
+ if( bOutline )
+ pElem = sXML_outline_level_style;
+ else
+ pElem = sXML_list_level_style_number;
+
+ const char *pNumFormat = GetNumFormatValue( eType );
+ if( pNumFormat )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_num_format,
+ pNumFormat );
+ const char *pNumLetterSync = GetNumLetterSync( eType );
+ if( pNumLetterSync )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_num_letter_sync,
+ pNumLetterSync );
+
+ if( nStartValue > 1 )
+ {
+ sTmp.append( (sal_Int32)nStartValue );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_start_value,
+ sTmp.makeStringAndClear() );
+ }
+ if( nDisplayLevels > 1 && NumberingType::NUMBER_NONE != eType )
+ {
+ sTmp.append( (sal_Int32)nDisplayLevels );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_display_levels,
+ sTmp.makeStringAndClear() );
+ }
+ }
+
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, pElem,
+ sal_True, sal_True );
+
+ nSpaceBefore += nMinLabelWidth;
+ nMinLabelWidth = -nMinLabelWidth;
+ OUStringBuffer sBuffer;
+ if( nSpaceBefore > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nSpaceBefore );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_space_before,
+ sBuffer.makeStringAndClear() );
+ }
+ if( nMinLabelWidth != 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_min_label_width,
+ sBuffer.makeStringAndClear() );
+ }
+ if( nMinLabelDist > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nMinLabelDist );
+ GetExport().AddAttribute( XML_NAMESPACE_TEXT, sXML_min_label_distance,
+ sBuffer.makeStringAndClear() );
+ }
+ if( HoriOrientation::LEFT != eAdjust )
+ {
+ const char *pValue = 0;
+ switch( eAdjust )
+ {
+ case HoriOrientation::RIGHT: pValue = sXML_end; break;
+ case HoriOrientation::CENTER: pValue = sXML_center; break;
+ }
+ if( pValue )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_FO, sXML_text_align, pValue );
+ }
+
+ if( NumberingType::CHAR_SPECIAL == eType )
+ {
+ if( sBulletFontName.getLength() )
+ {
+ Any aAny;
+ OUString sTmp;
+
+ const SvXMLUnitConverter& rUnitConv =
+ GetExport().GetMM100UnitConverter();
+ XMLFontFamilyNamePropHdl aFamilyNameHdl;
+ aAny <<= sBulletFontName;
+ if( aFamilyNameHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_FO,
+ sXML_font_family, sTmp );
+
+ if( sBulletFontStyleName.getLength() )
+ GetExport().AddAttribute( XML_NAMESPACE_FO,
+ sXML_font_style_name,
+ sBulletFontStyleName );
+
+ XMLFontFamilyPropHdl aFamilyHdl;
+ aAny <<= (sal_Int16)eBulletFontFamily;
+ if( aFamilyHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ sXML_font_family_generic, sTmp );
+
+ XMLFontPitchPropHdl aPitchHdl;
+ aAny <<= (sal_Int16)eBulletFontPitch;
+ if( aPitchHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ sXML_font_pitch, sTmp );
+
+ XMLFontEncodingPropHdl aEncHdl;
+ aAny <<= (sal_Int16)eBulletFontEncoding;
+ if( aEncHdl.exportXML( sTmp, aAny, rUnitConv ) )
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE,
+ sXML_font_charset, sTmp );
+ }
+ }
+ else if( NumberingType::BITMAP == eType )
+ {
+ const char *pValue = 0;
+ switch( eImageVertOrient )
+ {
+ case VertOrientation::BOTTOM: // yes, its OK: BOTTOM means that the baseline
+ // hits the frame at its topmost position
+ case VertOrientation::LINE_TOP:
+ case VertOrientation::CHAR_TOP:
+ pValue = sXML_top;
+ break;
+ case VertOrientation::CENTER:
+ case VertOrientation::LINE_CENTER:
+ case VertOrientation::CHAR_CENTER:
+ pValue = sXML_middle;
+ break;
+ case VertOrientation::TOP: // yes, its OK: TOP means that the baseline
+ // hits the frame at its bottommost position
+ case VertOrientation::LINE_BOTTOM:
+ case VertOrientation::CHAR_BOTTOM:
+ pValue = sXML_bottom;
+ break;
+ }
+ if( pValue )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_vertical_pos, pValue );
+
+ pValue = 0;
+ switch( eImageVertOrient )
+ {
+ case VertOrientation::TOP:
+ case VertOrientation::CENTER:
+ case VertOrientation::BOTTOM:
+ pValue = sXML_baseline;
+ break;
+ case VertOrientation::LINE_TOP:
+ case VertOrientation::LINE_CENTER:
+ case VertOrientation::LINE_BOTTOM:
+ pValue = sXML_line;
+ break;
+ case VertOrientation::CHAR_TOP:
+ case VertOrientation::CHAR_CENTER:
+ case VertOrientation::CHAR_BOTTOM:
+ pValue = sXML_char;
+ break;
+ }
+ if( pValue )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_STYLE, sXML_vertical_rel, pValue );
+
+ if( nImageWidth > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageWidth );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_width,
+ sBuffer.makeStringAndClear() );
+ }
+
+ if( nImageHeight > 0 )
+ {
+ GetExport().GetMM100UnitConverter().convertMeasure( sBuffer, nImageHeight );
+ GetExport().AddAttribute( XML_NAMESPACE_FO, sXML_height,
+ sBuffer.makeStringAndClear() );
+ }
+ }
+
+ if( GetExport().GetAttrList().getLength() > 0 )
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_STYLE,
+ sXML_properties, sal_True, sal_True );
+ }
+ }
+}
+
+
+uno::Reference< ::com::sun::star::container::XIndexReplace > SvxXMLNumRuleExport::GetUNONumRule() const
+{
+ return uno::Reference< ::com::sun::star::container::XIndexReplace > ();
+}
+
+void SvxXMLNumRuleExport::AddListStyleAttributes()
+{
+}
+
+
+SvxXMLNumRuleExport::SvxXMLNumRuleExport( SvXMLExport& rExp ) :
+ rExport( rExp ),
+ sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) )
+{
+}
+
+SvxXMLNumRuleExport::~SvxXMLNumRuleExport()
+{
+}
+
+void SvxXMLNumRuleExport::Export( const OUString& rName,
+ sal_Bool bContNumbering )
+{
+ GetExport().CheckAttrList();
+
+ // style:name="..."
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_name, rName );
+
+ // text:consecutive-numbering="..."
+ if( bContNumbering )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_TEXT, sXML_consecutive_numbering,
+ sXML_true );
+
+ // other application specific attributes
+ AddListStyleAttributes();
+
+ OUString sElem = GetExport().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TEXT,
+ OUString::createFromAscii(sXML_list_style) );
+ GetExport().GetDocHandler()->ignorableWhitespace( sWS );
+ GetExport().GetDocHandler()->startElement( sElem, GetExport().GetXAttrList() );
+ GetExport().ClearAttrList();
+
+ uno::Reference< ::com::sun::star::container::XIndexReplace > xNumRule = GetUNONumRule();
+ if( xNumRule.is() )
+ exportLevelStyles( xNumRule );
+
+ GetExport().GetDocHandler()->ignorableWhitespace( sWS );
+ GetExport().GetDocHandler()->endElement( sElem );
+}
+
+void SvxXMLNumRuleExport::ExportOutline()
+{
+ GetExport().CheckAttrList();
+
+ OUString sElem = GetExport().GetNamespaceMap().GetQNameByKey( XML_NAMESPACE_TEXT,
+ OUString::createFromAscii(sXML_outline_style) );
+ GetExport().GetDocHandler()->ignorableWhitespace( sWS );
+ GetExport().GetDocHandler()->startElement( sElem, GetExport().GetXAttrList() );
+
+ uno::Reference< ::com::sun::star::container::XIndexReplace > xNumRule = GetUNONumRule();
+ if( xNumRule.is() )
+ exportLevelStyles( xNumRule, sal_True );
+
+ GetExport().GetDocHandler()->ignorableWhitespace( sWS );
+ GetExport().GetDocHandler()->endElement( sElem );
+}
+
+void SvxXMLNumRuleExport::exportNumberingRule(
+ const OUString& rName,
+ const Reference< XIndexReplace >& rNumRule )
+{
+ Reference< XPropertySet > xPropSet( rNumRule, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo;
+ if( xPropSet.is() )
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ GetExport().CheckAttrList();
+
+ // style:name="..."
+ GetExport().AddAttribute( XML_NAMESPACE_STYLE, sXML_name, rName );
+
+ // text:consecutive-numbering="..."
+ sal_Bool bContNumbering = sal_False;
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
+ {
+ Any aAny( xPropSet->getPropertyValue( sIsContinuousNumbering ) );
+ bContNumbering = *(sal_Bool *)aAny.getValue();
+ }
+ if( bContNumbering )
+ GetExport().AddAttributeASCII( XML_NAMESPACE_TEXT,
+ sXML_consecutive_numbering, sXML_true );
+
+ // other application specific attributes
+ AddListStyleAttributes();
+
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT, sXML_list_style ,
+ sal_True, sal_True );
+ exportLevelStyles( rNumRule );
+ }
+}
+
+sal_Bool SvxXMLNumRuleExport::exportStyle( const Reference< XStyle >& rStyle )
+{
+ Reference< XPropertySet > xPropSet( rStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo();
+
+ Any aAny;
+
+ // Don't export styles that aren't existing really. This may be the
+ // case for StarOffice Writer's pool styles.
+ if( xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ aAny = xPropSet->getPropertyValue( sIsPhysical );
+ if( !*(sal_Bool *)aAny.getValue() )
+ return sal_False;
+ }
+
+ aAny = xPropSet->getPropertyValue( sNumberingRules );
+ Reference<XIndexReplace> xNumRule;
+ aAny >>= xNumRule;
+
+ OUString sName = rStyle->getName();
+
+ exportNumberingRule( sName, xNumRule );
+
+ return sal_True;
+}
+
+void SvxXMLNumRuleExport::exportOutline()
+{
+ Reference< XChapterNumberingSupplier > xCNSupplier( GetExport().GetModel(),
+ UNO_QUERY );
+ DBG_ASSERT( xCNSupplier.is(), "no chapter numbering supplier" );
+
+ if( xCNSupplier.is() )
+ {
+ Reference< XIndexReplace > xNumRule( xCNSupplier->getChapterNumberingRules() );
+ DBG_ASSERT( xNumRule.is(), "no chapter numbering rules" );
+
+ if( xNumRule.is() )
+ {
+ SvXMLElementExport aElem( GetExport(), XML_NAMESPACE_TEXT,
+ sXML_outline_style, sal_True, sal_True );
+ exportLevelStyles( xNumRule, sal_True );
+ }
+ }
+}
+
+void SvxXMLNumRuleExport::exportStyles( sal_Bool bUsed,
+ XMLTextListAutoStylePool *pPool )
+{
+ exportOutline();
+
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetExport().GetModel(), UNO_QUERY );
+ DBG_ASSERT( xFamiliesSupp.is(), "No XStyleFamiliesSupplier from XModel for export!" );
+ if( xFamiliesSupp.is() )
+ {
+ Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
+ DBG_ASSERT( xFamiliesSupp.is(), "getStyleFamilies() from XModel failed for export!" );
+
+ if( xFamilies.is() )
+ {
+ const OUString aNumberStyleName( RTL_CONSTASCII_USTRINGPARAM( "NumberingStyles" ));
+
+ Reference< XIndexAccess > xStyles;
+ if( xFamilies->hasByName( aNumberStyleName ) )
+ {
+ xFamilies->getByName( aNumberStyleName ) >>= xStyles;
+
+ DBG_ASSERT( xStyles.is(), "Style not found for export!" );
+
+ if( xStyles.is() )
+ {
+ const sal_Int32 nStyles = xStyles->getCount();
+
+ for( sal_Int32 i=0; i < nStyles; i++ )
+ {
+ Reference< XStyle > xStyle;
+ xStyles->getByIndex( i ) >>= xStyle;
+
+ if( !bUsed || xStyle->isInUse() )
+ {
+ exportStyle( xStyle );
+ if( pPool )
+ pPool->RegisterName( xStyle->getName() );
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+const sal_Char *SvxXMLNumRuleExport::GetNumFormatValue( sal_Int16 eNumType )
+{
+ const sal_Char *pFormat = 0;
+ switch( eNumType )
+ {
+ case NumberingType::CHARS_UPPER_LETTER: pFormat = sXML_A; break;
+ case NumberingType::CHARS_LOWER_LETTER: pFormat = sXML_a; break;
+ case NumberingType::ROMAN_UPPER: pFormat = sXML_I; break;
+ case NumberingType::ROMAN_LOWER: pFormat = sXML_i; break;
+ case NumberingType::ARABIC: pFormat = sXML_1; break;
+ case NumberingType::CHARS_UPPER_LETTER_N: pFormat = sXML_A; break;
+ case NumberingType::CHARS_LOWER_LETTER_N: pFormat = sXML_a; break;
+ case NumberingType::NUMBER_NONE: pFormat = sXML__empty; break;
+
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::PAGE_DESCRIPTOR:
+ case NumberingType::BITMAP:
+ DBG_ASSERT( pFormat, "invalid number format" );
+ break;
+ }
+
+ return pFormat;
+}
+
+const sal_Char *SvxXMLNumRuleExport::GetNumLetterSync( sal_Int16 eNumType )
+{
+ const sal_Char *pSync = 0;
+ switch( eNumType )
+ {
+ case NumberingType::CHARS_UPPER_LETTER:
+ case NumberingType::CHARS_LOWER_LETTER:
+ case NumberingType::ROMAN_UPPER:
+ case NumberingType::ROMAN_LOWER:
+ case NumberingType::ARABIC:
+ case NumberingType::NUMBER_NONE:
+ // default
+ // pSync = sXML_false;
+ break;
+
+ case NumberingType::CHARS_UPPER_LETTER_N:
+ case NumberingType::CHARS_LOWER_LETTER_N:
+ pSync = sXML_true;
+ break;
+
+ case NumberingType::CHAR_SPECIAL:
+ case NumberingType::PAGE_DESCRIPTOR:
+ case NumberingType::BITMAP:
+ DBG_ASSERT( pSync, "invalid number format" );
+ break;
+ }
+
+ return pSync;
+}
+
diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx
new file mode 100644
index 000000000000..32773a74c57a
--- /dev/null
+++ b/xmloff/source/style/xmlnumfe.cxx
@@ -0,0 +1,1218 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlnumfe.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _SVSTDARR_ULONGS
+#define _ZFORLIST_DECLARE_TABLE
+
+#include <svtools/svstdarr.hxx>
+#include <svtools/zforlist.hxx>
+#include <svtools/zformat.hxx>
+#include <svtools/numuno.hxx>
+#include <tools/isolang.hxx>
+#include <tools/debug.hxx>
+#include <tools/solmath.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include "xmlnumfe.hxx"
+#include "xmlnmspe.hxx"
+#include "xmlkywd.hxx"
+#include "xmluconv.hxx"
+#include "attrlist.hxx"
+#include "nmspmap.hxx"
+#include "families.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//-------------------------------------------------------------------------
+
+//! enum Sc_SymbolType is in source/numbers/zforscan.hxx
+
+#define XMLNUM_SYMBOLTYPE_STRING (-1)
+#define XMLNUM_SYMBOLTYPE_DEL (-2)
+#define XMLNUM_SYMBOLTYPE_BLANK (-3)
+#define XMLNUM_SYMBOLTYPE_STAR (-4)
+#define XMLNUM_SYMBOLTYPE_DIGIT (-5)
+#define XMLNUM_SYMBOLTYPE_DECSEP (-6)
+#define XMLNUM_SYMBOLTYPE_THSEP (-7)
+#define XMLNUM_SYMBOLTYPE_EXP (-8)
+#define XMLNUM_SYMBOLTYPE_FRAC (-9)
+#define XMLNUM_SYMBOLTYPE_EMPTY (-10)
+#define XMLNUM_SYMBOLTYPE_FRACBLANK (-11)
+#define XMLNUM_SYMBOLTYPE_COMMENT (-12)
+#define XMLNUM_SYMBOLTYPE_CURRENCY (-13)
+#define XMLNUM_SYMBOLTYPE_CURRDEL (-14)
+#define XMLNUM_SYMBOLTYPE_CURREXT (-15)
+
+//-------------------------------------------------------------------------
+
+// 4th condition for text formats doesn't work
+//#define XMLNUM_MAX_PARTS 4
+#define XMLNUM_MAX_PARTS 3
+
+//-------------------------------------------------------------------------
+
+class SvXMLNumUsedList_Impl
+{
+ SvULongs aUsed;
+ SvULongs aWasUsed;
+
+public:
+ SvXMLNumUsedList_Impl();
+ ~SvXMLNumUsedList_Impl();
+
+ void SetUsed( sal_uInt32 nKey );
+ sal_Bool IsUsed( sal_uInt32 nKey ) const;
+ sal_Bool IsWasUsed( sal_uInt32 nKey ) const;
+ void Export();
+};
+
+//-------------------------------------------------------------------------
+
+//
+//! SvXMLNumUsedList_Impl should be optimized!
+//
+
+SvXMLNumUsedList_Impl::SvXMLNumUsedList_Impl()
+{
+}
+
+SvXMLNumUsedList_Impl::~SvXMLNumUsedList_Impl()
+{
+}
+
+void SvXMLNumUsedList_Impl::SetUsed( sal_uInt32 nKey )
+{
+ if ( !IsUsed( nKey ) && !IsWasUsed(nKey) )
+ aUsed.Insert( nKey, aUsed.Count() );
+}
+
+sal_Bool SvXMLNumUsedList_Impl::IsUsed( sal_uInt32 nKey ) const
+{
+ sal_uInt16 nCount = aUsed.Count();
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ if ( aUsed[i] == nKey )
+ return sal_True;
+
+ return sal_False;
+}
+
+sal_Bool SvXMLNumUsedList_Impl::IsWasUsed( sal_uInt32 nKey ) const
+{
+ sal_uInt16 nCount = aWasUsed.Count();
+ for ( sal_uInt16 i = 0; i < nCount; i++ )
+ if ( aWasUsed[i] == nKey )
+ return sal_True;
+
+ return sal_False;
+}
+
+void SvXMLNumUsedList_Impl::Export()
+{
+ sal_uInt16 nCount = aUsed.Count();
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ aWasUsed.Insert( aUsed[i], aWasUsed.Count());
+ aUsed.Remove(0, nCount);
+}
+
+//-------------------------------------------------------------------------
+
+SvXMLNumFmtExport::SvXMLNumFmtExport(
+ const uno::Reference< xml::sax::XDocumentHandler >& rHdl,
+ const uno::Reference< util::XNumberFormatsSupplier >& rSupp ) :
+ xHandler( rHdl ),
+ pFormatter( NULL ),
+ pNamespaceMap( NULL ),
+ sCDATA( OUString::createFromAscii( sXML_CDATA ) ),
+ sWS( OUString::createFromAscii( sXML_WS ) )
+{
+ // supplier must be SvNumberFormatsSupplierObj
+ SvNumberFormatsSupplierObj* pObj =
+ SvNumberFormatsSupplierObj::getImplementation( rSupp );
+ if (pObj)
+ pFormatter = pObj->GetNumberFormatter();
+
+ pAttrList = new SvXMLAttributeList;
+ xAttrList = pAttrList;
+
+ pUsedList = new SvXMLNumUsedList_Impl;
+}
+
+SvXMLNumFmtExport::~SvXMLNumFmtExport()
+{
+ delete pUsedList;
+}
+
+//-------------------------------------------------------------------------
+
+//
+// helper methods
+//
+
+OUString lcl_CreateStyleName( sal_Int32 nKey, sal_Int32 nPart, sal_Bool bDefPart )
+{
+ OUStringBuffer aFmtName( 10L );
+ aFmtName.append( (sal_Unicode)'N' );
+ aFmtName.append( nKey );
+ if (!bDefPart)
+ {
+ aFmtName.append( (sal_Unicode)'P' );
+ aFmtName.append( nPart );
+ }
+ return aFmtName.makeStringAndClear();
+}
+
+void SvXMLNumFmtExport::AddTextualAttr_Impl( sal_Bool bText )
+{
+ if ( bText ) // non-textual
+ {
+ OUString sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_textual ) );
+ OUString sAttrValue = OUString::createFromAscii( sXML_true );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+}
+
+void SvXMLNumFmtExport::AddStyleAttr_Impl( sal_Bool bLong )
+{
+ if ( bLong ) // short is default
+ {
+ OUString sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_style ) );
+ OUString sAttrValue = OUString::createFromAscii( sXML_long );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+}
+
+void SvXMLNumFmtExport::AddLanguageAttr_Impl( sal_Int32 nLang )
+{
+ if ( nLang != LANGUAGE_SYSTEM )
+ {
+ String aLangStr, aCountryStr;
+ ConvertLanguageToIsoNames( nLang, aLangStr, aCountryStr );
+
+ OUString sAttrName, sAttrValue;
+ if (aLangStr.Len())
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER, OUString::createFromAscii(sXML_language) );
+ sAttrValue = aLangStr;
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+ if (aCountryStr.Len())
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER, OUString::createFromAscii(sXML_country) );
+ sAttrValue = aCountryStr;
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// methods to write individual elements within a format
+//
+
+void SvXMLNumFmtExport::WriteColorElement_Impl( const Color& rColor )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_STYLE,
+ OUString::createFromAscii( sXML_properties ) );
+
+ OUString sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_FO,
+ OUString::createFromAscii(sXML_color) );
+ OUStringBuffer aColStr( 7 );
+ SvXMLUnitConverter::convertColor( aColStr, rColor );
+ OUString sAttrValue = aColStr.makeStringAndClear();
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteTextElement_Impl( const OUString& rString )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_text ) );
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->characters( rString );
+ xHandler->endElement( sElem );
+}
+
+void SvXMLNumFmtExport::WriteCurrencyElement_Impl( const OUString& rString,
+ const OUString& rExt )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_currency_symbol ) );
+
+ if ( rExt.getLength() )
+ {
+ sal_Int32 nLang = rExt.toInt32(16); // hex
+ if ( nLang < 0 ) // extension string may contain "-" separator
+ nLang = -nLang;
+ AddLanguageAttr_Impl( nLang ); // adds to pAttrList
+ }
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->characters( rString );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteBooleanElement_Impl()
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_boolean ) );
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+}
+
+void SvXMLNumFmtExport::WriteTextContentElement_Impl()
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_text_content ) );
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+}
+
+// date elements
+
+void SvXMLNumFmtExport::WriteDayElement_Impl( sal_Bool bLong )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_day ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteMonthElement_Impl( sal_Bool bLong, sal_Bool bText )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_month ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+ AddTextualAttr_Impl( bText ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteYearElement_Impl( sal_Bool bLong )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_year ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteDayOfWeekElement_Impl( sal_Bool bLong )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_day_of_week ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteWeekElement_Impl()
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_week_of_year ) );
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+}
+
+void SvXMLNumFmtExport::WriteQuarterElement_Impl( sal_Bool bLong )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_quarter ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+// time elements
+
+void SvXMLNumFmtExport::WriteHoursElement_Impl( sal_Bool bLong )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_hours ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteMinutesElement_Impl( sal_Bool bLong )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_minutes ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteSecondsElement_Impl( sal_Bool bLong, sal_uInt16 nDecimals )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_seconds ) );
+
+ AddStyleAttr_Impl( bLong ); // adds to pAttrList
+ if ( nDecimals > 0 )
+ {
+ OUString sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_decimal_places ) );
+ OUString sAttrValue = OUString::valueOf( (sal_Int32) nDecimals );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteAMPMElement_Impl()
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_am_pm ) );
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+}
+
+// numbers
+
+void SvXMLNumFmtExport::WriteNumberElement_Impl(
+ sal_Int32 nDecimals, sal_Int32 nInteger,
+ const OUString& rDashStr, sal_Bool bGrouping )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_number ) );
+ OUString sAttrName, sAttrValue;
+
+ // decimals
+ if ( nDecimals >= 0 ) // negative = automatic
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_decimal_places ) );
+ sAttrValue = OUString::valueOf( nDecimals );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // integer digits
+ if ( nInteger >= 0 ) // negative = automatic
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_min_integer_digits ) );
+ sAttrValue = OUString::valueOf( nInteger );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // decimal replacement (dashes)
+ if ( rDashStr.getLength() )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_decimal_replacement ) );
+ sAttrValue = rDashStr;
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // (automatic) grouping separator
+ if ( bGrouping )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_grouping ) );
+ sAttrValue = OUString::createFromAscii(sXML_true);
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteScientificElement_Impl(
+ sal_Int32 nDecimals, sal_Int32 nInteger,
+ sal_Bool bGrouping, sal_Int32 nExp )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_scientific_number ) );
+ OUString sAttrName, sAttrValue;
+
+ // decimals
+ if ( nDecimals >= 0 ) // negative = automatic
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_decimal_places ) );
+ sAttrValue = OUString::valueOf( nDecimals );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // integer digits
+ if ( nInteger >= 0 ) // negative = automatic
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_min_integer_digits ) );
+ sAttrValue = OUString::valueOf( nInteger );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // (automatic) grouping separator
+ if ( bGrouping )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_grouping ) );
+ sAttrValue = OUString::createFromAscii(sXML_true);
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // exponent digits
+ if ( nExp >= 0 )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_min_exponent_digits ) );
+ sAttrValue = OUString::valueOf( nExp );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+ pAttrList->Clear();
+}
+
+void SvXMLNumFmtExport::WriteFractionElement_Impl(
+ sal_Int32 nInteger, sal_Bool bGrouping,
+ sal_Int32 nNumerator, sal_Int32 nDenominator )
+{
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_fraction ) );
+ OUString sAttrName, sAttrValue;
+
+ // integer digits
+ if ( nInteger >= 0 ) // negative = default (no integer part)
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_min_integer_digits ) );
+ sAttrValue = OUString::valueOf( nInteger );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // (automatic) grouping separator
+ if ( bGrouping )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_grouping ) );
+ sAttrValue = OUString::createFromAscii(sXML_true);
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // numerator digits
+ if ( nNumerator >= 0 )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_min_numerator_digits ) );
+ sAttrValue = OUString::valueOf( nNumerator );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // denominator digits
+ if ( nDenominator >= 0 )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_min_denominator_digits ) );
+ sAttrValue = OUString::valueOf( nDenominator );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+ pAttrList->Clear();
+}
+
+// mapping (condition)
+
+void SvXMLNumFmtExport::WriteMapElement_Impl( sal_Int32 nOp, double fLimit,
+ sal_Int32 nKey, sal_Int32 nPart )
+{
+ if ( nOp != NUMBERFORMAT_OP_NO )
+ {
+ // style namespace
+
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_STYLE,
+ OUString::createFromAscii( sXML_map ) );
+ OUString sAttrName, sAttrValue;
+
+ OUStringBuffer aCondStr( 20L );
+ aCondStr.appendAscii( "value()" ); //! define constant
+ switch ( nOp )
+ {
+ case NUMBERFORMAT_OP_EQ: aCondStr.append( (sal_Unicode) '=' ); break;
+ case NUMBERFORMAT_OP_NE: aCondStr.appendAscii( "<>" ); break;
+ case NUMBERFORMAT_OP_LT: aCondStr.append( (sal_Unicode) '<' ); break;
+ case NUMBERFORMAT_OP_LE: aCondStr.appendAscii( "<=" ); break;
+ case NUMBERFORMAT_OP_GT: aCondStr.append( (sal_Unicode) '>' ); break;
+ case NUMBERFORMAT_OP_GE: aCondStr.appendAscii( ">=" ); break;
+ default:
+ DBG_ERROR("unknown operator");
+ }
+ String aValStr;
+ SolarMath::DoubleToString( aValStr, fLimit, 'A', INT_MAX, '.', TRUE );
+ aCondStr.append( aValStr );
+
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_STYLE,
+ OUString::createFromAscii( sXML_condition ) );
+ sAttrValue = aCondStr.makeStringAndClear();
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_STYLE,
+ OUString::createFromAscii( sXML_apply_style_name ) );
+ sAttrValue = lcl_CreateStyleName( nKey, nPart, sal_False );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ xHandler->endElement( sElem );
+ pAttrList->Clear();
+ }
+}
+
+//-------------------------------------------------------------------------
+// for old (automatic) currency formats: parse currency symbol from text
+
+xub_StrLen lcl_FindSymbol( const String& sUpperStr, const String& sCurString )
+{
+ // search for currency symbol
+ // Quoting as in ImpSvNumberformatScan::Symbol_Division
+
+ xub_StrLen nCPos = 0;
+ while (nCPos != STRING_NOTFOUND)
+ {
+ nCPos = sUpperStr.Search( sCurString, nCPos );
+ if (nCPos != STRING_NOTFOUND)
+ {
+ // in Quotes?
+ xub_StrLen nQ = SvNumberformat::GetQuoteEnd( sUpperStr, nCPos );
+ if ( nQ == STRING_NOTFOUND )
+ {
+ // dm can be escaped as "dm or \d
+ sal_Unicode c;
+ if ( nCPos == 0 ||
+ ((c = sUpperStr.GetChar(xub_StrLen(nCPos-1))) != '"'
+ && c != '\\') )
+ {
+ return nCPos; // found
+ }
+ else
+ nCPos++; // continue
+ }
+ else
+ nCPos = nQ + 1; // continue after quote end
+ }
+ }
+ return STRING_NOTFOUND; // not found
+}
+
+void SvXMLNumFmtExport::WriteTextWithCurrency_Impl( const OUString& rString,
+ const International& rIntl )
+{
+ String sCurString = rIntl.GetCurrSymbol();
+ String sUpperStr = rIntl.Upper(rString);
+ xub_StrLen nPos = lcl_FindSymbol( sUpperStr, sCurString );
+ if ( nPos != STRING_NOTFOUND )
+ {
+ sal_Int32 nLength = rString.getLength();
+ sal_Int32 nCurLen = sCurString.Len();
+ sal_Int32 nCont = nPos + nCurLen;
+
+ // text before currency symbol
+ if ( nPos > 0 )
+ WriteTextElement_Impl( rString.copy( 0, nPos ) );
+
+ // currency symbol (empty string -> default)
+ OUString sEmpty;
+ WriteCurrencyElement_Impl( sEmpty, sEmpty );
+
+ // text after currency symbol
+ if ( nCont < nLength )
+ WriteTextElement_Impl( rString.copy( nCont, nLength-nCont ) );
+ }
+ else
+ WriteTextElement_Impl( rString ); // simple text
+}
+
+//-------------------------------------------------------------------------
+
+//
+// export one part (condition)
+//
+
+void SvXMLNumFmtExport::ExportPart_Impl( SvNumberformat& rFormat, sal_uInt32 nKey,
+ sal_uInt16 nPart, sal_Bool bDefPart )
+{
+ //! for the default part, pass the coditions from the other parts!
+
+ //
+ // element name
+ //
+
+ NfIndexTableOffset eBuiltIn = pFormatter->GetIndexTableOffset( nKey );
+ short nFmtType = rFormat.GetType() & ~NUMBERFORMAT_DEFINED;
+ OUString sType;
+ switch ( nFmtType )
+ {
+//! case 0: // may occur in imported documents (?)
+ case NUMBERFORMAT_NUMBER:
+ case NUMBERFORMAT_SCIENTIFIC:
+ case NUMBERFORMAT_FRACTION:
+ sType = OUString::createFromAscii(sXML_number_style);
+ break;
+ case NUMBERFORMAT_PERCENT:
+ sType = OUString::createFromAscii(sXML_percentage_style);
+ break;
+ case NUMBERFORMAT_CURRENCY:
+ sType = OUString::createFromAscii(sXML_currency_style);
+ break;
+ case NUMBERFORMAT_DATE:
+ case NUMBERFORMAT_DATETIME:
+ sType = OUString::createFromAscii(sXML_date_style);
+ break;
+ case NUMBERFORMAT_TIME:
+ sType = OUString::createFromAscii(sXML_time_style);
+ break;
+ case NUMBERFORMAT_TEXT:
+ sType = OUString::createFromAscii(sXML_text_style);
+ break;
+ case NUMBERFORMAT_LOGICAL:
+ sType = OUString::createFromAscii(sXML_boolean_style);
+ break;
+ }
+ if (!sType.getLength())
+ {
+ DBG_ERROR("unknown format type");
+ return;
+ }
+ OUString sElem = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER, sType );
+ OUString sAttrName, sAttrValue;
+ sal_Bool bUserDef = ( ( rFormat.GetType() & NUMBERFORMAT_DEFINED ) != 0 );
+
+ //! get FormatInfo from each part separately
+
+ sal_Bool bThousand = sal_False;
+ sal_Bool bRed = sal_False;
+ sal_uInt16 nPrecision = 0;
+ sal_uInt16 nLeading = 0;
+ rFormat.GetFormatSpecialInfo( bThousand, bRed, nPrecision, nLeading);
+
+ //
+ // common attributes for format
+ //
+
+ // format name (generated from key) - style namespace
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii(sXML_name) );
+ sAttrValue = lcl_CreateStyleName( nKey, nPart, bDefPart );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_STYLE, OUString(RTL_CONSTASCII_USTRINGPARAM(sXML_family)));
+ sAttrValue = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_DATA_STYLE_NAME));
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+
+ // language / country
+ LanguageType nLang = rFormat.GetLanguage();
+ AddLanguageAttr_Impl( nLang ); // adds to pAttrList
+
+ // title (comment)
+ // titles for builtin formats are not written
+ sAttrValue = rFormat.GetComment();
+ if ( sAttrValue.getLength() && bUserDef && bDefPart )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER, OUString::createFromAscii(sXML_title) );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // automatic ordering for currency and date formats
+ // only used for some built-in formats
+ BOOL bAutoOrder = ( eBuiltIn == NF_CURRENCY_1000INT || eBuiltIn == NF_CURRENCY_1000DEC2 ||
+ eBuiltIn == NF_CURRENCY_1000INT_RED || eBuiltIn == NF_CURRENCY_1000DEC2_RED ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_DASHED ||
+ eBuiltIn == NF_DATE_SYSTEM_SHORT || eBuiltIn == NF_DATE_SYSTEM_LONG ||
+ eBuiltIn == NF_DATE_SYS_MMYY || eBuiltIn == NF_DATE_SYS_DDMMM ||
+ eBuiltIn == NF_DATE_SYS_DDMMYYYY || eBuiltIn == NF_DATE_SYS_DDMMYY ||
+ eBuiltIn == NF_DATE_SYS_DMMMYY || eBuiltIn == NF_DATE_SYS_DMMMYYYY ||
+ eBuiltIn == NF_DATE_SYS_DMMMMYYYY || eBuiltIn == NF_DATE_SYS_NNDMMMYY ||
+ eBuiltIn == NF_DATE_SYS_NNDMMMMYYYY || eBuiltIn == NF_DATE_SYS_NNNNDMMMMYYYY );
+ if ( bAutoOrder )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_automatic_order ) );
+ sAttrValue = OUString::createFromAscii( sXML_true );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // format source (for date and time formats)
+ // only used for some built-in formats
+ BOOL bSystemDate = ( eBuiltIn == NF_DATE_SYSTEM_SHORT ||
+ eBuiltIn == NF_DATE_SYSTEM_LONG ||
+ eBuiltIn == NF_DATETIME_SYSTEM_SHORT_HHMM );
+ BOOL bLongSysDate = ( eBuiltIn == NF_DATE_SYSTEM_LONG );
+ if ( bSystemDate )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_format_source ) );
+ sAttrValue = OUString::createFromAscii( sXML_language );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ // overflow for time formats as in [hh]:mm
+ // controlled by bThousand from number format info
+ // default for truncate-on-overflow is true
+ if ( nFmtType == NUMBERFORMAT_TIME && bThousand )
+ {
+ sAttrName = pNamespaceMap->GetQNameByKey( XML_NAMESPACE_NUMBER,
+ OUString::createFromAscii( sXML_truncate_on_overflow ) );
+ sAttrValue = OUString::createFromAscii( sXML_false );
+ pAttrList->AddAttribute( sAttrName, sCDATA, sAttrValue );
+ }
+
+ xHandler->ignorableWhitespace( sWS );
+ xHandler->startElement( sElem, xAttrList );
+ pAttrList->Clear();
+
+ //
+ // color (properties element)
+ //
+
+ const Color* pCol = rFormat.GetColor( nPart );
+ if (pCol)
+ WriteColorElement_Impl(*pCol);
+
+ //
+ // format elements
+ //
+
+ if ( eBuiltIn == NF_NUMBER_STANDARD )
+ {
+ // default number format contains just one number element
+ WriteNumberElement_Impl( -1, 1, OUString(), sal_False );
+ }
+ else if ( eBuiltIn == NF_BOOLEAN )
+ {
+ // boolean format contains just one boolean element
+ WriteBooleanElement_Impl();
+ }
+ else
+ {
+ // first loop to collect attributes
+
+ sal_Bool bDecDashes = sal_False;
+ sal_Bool bExpFound = sal_False;
+ sal_Bool bCurrFound = sal_False;
+ sal_Int32 nExpDigits = 0;
+ OUString sCurrExt;
+ sal_uInt16 nPos = 0;
+ sal_Bool bEnd = sal_False;
+ while (!bEnd)
+ {
+ short nElemType = rFormat.GetNumForType( nPart, nPos, sal_False );
+ const XubString* pElemStr = rFormat.GetNumForString( nPart, nPos, sal_False );
+
+ switch ( nElemType )
+ {
+ case 0:
+ bEnd = sal_True; // end of format reached
+ break;
+ case XMLNUM_SYMBOLTYPE_DIGIT:
+ if ( bExpFound && pElemStr )
+ nExpDigits += pElemStr->Len();
+ else if ( !bDecDashes && pElemStr && pElemStr->GetChar(0) == '-' )
+ bDecDashes = TRUE;
+ break;
+ case XMLNUM_SYMBOLTYPE_EXP:
+ bExpFound = TRUE; // following digits are exponent digits
+ break;
+ case XMLNUM_SYMBOLTYPE_CURRENCY:
+ bCurrFound = TRUE;
+ break;
+ case XMLNUM_SYMBOLTYPE_CURREXT:
+ if (pElemStr)
+ sCurrExt = *pElemStr;
+ break;
+ }
+ ++nPos;
+ }
+
+ // second loop to write elements
+
+ sal_Bool bNumWritten = sal_False;
+ short nPrevType = 0;
+ nPos = 0;
+ bEnd = sal_False;
+ while (!bEnd)
+ {
+ short nElemType = rFormat.GetNumForType( nPart, nPos, sal_False );
+ const XubString* pElemStr = rFormat.GetNumForString( nPart, nPos, sal_False );
+
+ switch ( nElemType )
+ {
+ case 0:
+ bEnd = sal_True; // end of format reached
+ break;
+ case XMLNUM_SYMBOLTYPE_STRING:
+ if (pElemStr)
+ {
+ if ( ( nPrevType == NF_KEY_S || nPrevType == NF_KEY_SS ) &&
+ ( pElemStr->EqualsAscii( "," ) || pElemStr->EqualsAscii( "." ) ) &&
+ nPrecision > 0 )
+ {
+ // decimal separator after seconds is implied by
+ // "decimal-places" attribute and must not be written
+ // as text element
+ //! difference between '.' and ',' is lost here
+ }
+ else if ( nFmtType == NUMBERFORMAT_CURRENCY && !bCurrFound )
+ {
+ // automatic currency symbol is implemented as part of
+ // normal text -> search for the symbol
+ International aIntl( nLang );
+ WriteTextWithCurrency_Impl( *pElemStr, aIntl );
+ }
+ else
+ WriteTextElement_Impl( *pElemStr );
+ }
+ break;
+ case NF_KEY_CCC:
+ //! must be different from short automatic format
+ //! but should still be empty (meaning automatic)
+ // pElemStr is "CCC"
+ if (pElemStr)
+ WriteCurrencyElement_Impl( *pElemStr, OUString() );
+ break;
+ case XMLNUM_SYMBOLTYPE_CURRENCY:
+ if (pElemStr)
+ WriteCurrencyElement_Impl( *pElemStr, sCurrExt );
+ break;
+ case XMLNUM_SYMBOLTYPE_DIGIT:
+ if (!bNumWritten) // write number part
+ {
+ switch ( nFmtType )
+ {
+ case NUMBERFORMAT_NUMBER:
+ case NUMBERFORMAT_CURRENCY:
+ case NUMBERFORMAT_PERCENT:
+ {
+ // decimals
+ // only some built-in formats have automatic decimals
+ sal_Int32 nDecimals = nPrecision; // from GetFormatSpecialInfo
+ if ( eBuiltIn == NF_NUMBER_STANDARD ||
+ eBuiltIn == NF_CURRENCY_1000DEC2 ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_RED ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_CCC ||
+ eBuiltIn == NF_CURRENCY_1000DEC2_DASHED )
+ nDecimals = -1;
+
+ // integer digits
+ // only one built-in format has automatic integer digits
+ sal_Int32 nInteger = nLeading;
+ if ( eBuiltIn == NF_NUMBER_SYSTEM )
+ nInteger = -1;
+
+ // string for decimal replacement
+ // has to be taken from nPrecision
+ // (positive number even for automatic decimals)
+ String sDashStr;
+ if ( bDecDashes && nPrecision > 0 )
+ sDashStr.Fill( nPrecision, '-' );
+
+ WriteNumberElement_Impl( nDecimals, nInteger, sDashStr, bThousand );
+ }
+ break;
+ case NUMBERFORMAT_SCIENTIFIC:
+ WriteScientificElement_Impl( nPrecision, nLeading, bThousand, nExpDigits );
+ break;
+ case NUMBERFORMAT_FRACTION:
+ WriteFractionElement_Impl( nLeading, bThousand, nPrecision, nPrecision );
+ break;
+ }
+
+ bNumWritten = sal_True;
+ }
+ break;
+ case XMLNUM_SYMBOLTYPE_DEL:
+ if ( pElemStr && *pElemStr == XubString('@') )
+ WriteTextContentElement_Impl();
+ break;
+
+ // date elements:
+
+ case NF_KEY_T:
+ case NF_KEY_TT:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_TT );
+ WriteDayElement_Impl( bSystemDate ? bLongSysDate : bLong );
+ }
+ break;
+ case NF_KEY_TTT:
+ case NF_KEY_TTTT:
+ case NF_KEY_NN:
+ case NF_KEY_NNN:
+ case NF_KEY_NNNN:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_NNN || nElemType == NF_KEY_NNNN ||
+ nElemType == NF_KEY_TTTT );
+ WriteDayOfWeekElement_Impl( bSystemDate ? bLongSysDate : bLong );
+ if ( nElemType == NF_KEY_NNNN )
+ {
+ // write additional text element for separator
+ International aIntl( nLang );
+ WriteTextElement_Impl( aIntl.GetLongDateDayOfWeekSep() );
+ }
+ }
+ break;
+ case NF_KEY_M:
+ case NF_KEY_MM:
+ case NF_KEY_MMM:
+ case NF_KEY_MMMM:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_MM || nElemType == NF_KEY_MMMM );
+ sal_Bool bText = ( nElemType == NF_KEY_MMM || nElemType == NF_KEY_MMMM );
+ WriteMonthElement_Impl( ( bSystemDate ? bLongSysDate : bLong ), bText );
+ }
+ break;
+ case NF_KEY_JJ:
+ case NF_KEY_JJJJ:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_JJJJ );
+ WriteYearElement_Impl( bSystemDate ? bLongSysDate : bLong );
+ }
+ break;
+ case NF_KEY_Q:
+ case NF_KEY_QQ:
+ {
+ sal_Bool bLong = ( nElemType == NF_KEY_QQ );
+ WriteQuarterElement_Impl( bSystemDate ? bLongSysDate : bLong );
+ }
+ break;
+ case NF_KEY_WW:
+ WriteWeekElement_Impl();
+ break;
+
+ // time elements (bSystemDate is not used):
+
+ case NF_KEY_H:
+ case NF_KEY_HH:
+ WriteHoursElement_Impl( nElemType == NF_KEY_HH );
+ break;
+ case NF_KEY_MI:
+ case NF_KEY_MMI:
+ WriteMinutesElement_Impl( nElemType == NF_KEY_MMI );
+ break;
+ case NF_KEY_S:
+ case NF_KEY_SS:
+ WriteSecondsElement_Impl( ( nElemType == NF_KEY_SS ), nPrecision );
+ break;
+ case NF_KEY_AMPM:
+ case NF_KEY_AP:
+ WriteAMPMElement_Impl(); // short/long?
+ break;
+ }
+ nPrevType = nElemType;
+ ++nPos;
+ }
+ }
+
+ //
+ // mapping (conditions) must be last elements
+ //
+
+ SvNumberformatLimitOps eOp1, eOp2;
+ double fLimit1, fLimit2;
+ rFormat.GetConditions( eOp1, fLimit1, eOp2, fLimit2 );
+ if (bDefPart)
+ {
+ WriteMapElement_Impl( eOp1, fLimit1, nKey, 0 );
+ WriteMapElement_Impl( eOp2, fLimit2, nKey, 1 );
+ }
+
+ xHandler->endElement( sElem );
+}
+
+//-------------------------------------------------------------------------
+
+//
+// export one format
+//
+
+void SvXMLNumFmtExport::ExportFormat_Impl( SvNumberformat& rFormat, sal_uInt32 nKey )
+{
+ sal_uInt16 nUsedParts = 0;
+ sal_uInt16 nPart;
+ for (nPart=0; nPart<XMLNUM_MAX_PARTS; nPart++)
+ if (rFormat.GetNumForType( nPart, 0, sal_False ) != 0)
+ nUsedParts = nPart+1;
+
+ for (nPart=0; nPart<nUsedParts; nPart++)
+ {
+ sal_Bool bDefault = ( nPart+1 == nUsedParts ); // last = default
+ ExportPart_Impl( rFormat, nKey, nPart, bDefault );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// export method called by application
+//
+
+void SvXMLNumFmtExport::Export( const SvXMLNamespaceMap& rNamespaceMap, sal_Bool bIsAutoStyle )
+{
+ if ( !pFormatter )
+ return; // no formatter -> no entries
+
+ pNamespaceMap = &rNamespaceMap;
+
+ SvUShorts aLanguages;
+ pFormatter->GetUsedLanguages( aLanguages );
+ sal_uInt16 nLangCount = aLanguages.Count();
+ for (sal_uInt16 nLangPos=0; nLangPos<nLangCount; nLangPos++)
+ {
+ LanguageType nLang = aLanguages[nLangPos];
+
+ sal_uInt32 nStandard;
+ SvNumberFormatTable& rTable = pFormatter->GetEntryTable(
+ NUMBERFORMAT_ALL, nStandard, nLang );
+ SvNumberformat* pFormat = rTable.First();
+ while (pFormat)
+ {
+ sal_uInt32 nKey = rTable.GetCurKey();
+ if ( (!bIsAutoStyle &&( pFormat->GetType() & NUMBERFORMAT_DEFINED )) ||
+ pUsedList->IsUsed( nKey ) )
+ {
+ // user-defined and used formats are exported
+ ExportFormat_Impl( *pFormat, nKey );
+ // if it is a user-defined Format it will be added else nothing will hapen
+ pUsedList->SetUsed(nKey);
+ }
+
+ pFormat = rTable.Next();
+ }
+ }
+ pUsedList->Export();
+
+ pNamespaceMap = NULL;
+}
+
+OUString SvXMLNumFmtExport::GetStyleName( sal_uInt32 nKey )
+{
+ DBG_ASSERT(pUsedList->IsUsed(nKey) || pUsedList->IsWasUsed(nKey), "There is no written Data-Style");
+ return lcl_CreateStyleName( nKey, 0, sal_True );
+}
+
+void SvXMLNumFmtExport::SetUsed( sal_uInt32 nKey )
+{
+ pUsedList->SetUsed( nKey );
+}
+
+
diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx
new file mode 100644
index 000000000000..0371a7674bec
--- /dev/null
+++ b/xmloff/source/style/xmlnumfi.cxx
@@ -0,0 +1,1365 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlnumfi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#define _ZFORLIST_DECLARE_TABLE
+
+#include <svtools/zforlist.hxx>
+#include <svtools/zformat.hxx>
+#include <svtools/numuno.hxx>
+#include <tools/isolang.hxx>
+#include <tools/debug.hxx>
+#include <rtl/ustrbuf.hxx>
+
+#include "xmlnumfi.hxx"
+#include "xmltkmap.hxx"
+#include "xmlkywd.hxx"
+#include "xmlnmspe.hxx"
+#include "xmlictxt.hxx"
+#include "xmlimp.hxx"
+#include "xmluconv.hxx"
+#include "nmspmap.hxx"
+#include "families.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+//-------------------------------------------------------------------------
+
+struct SvXMLNumFmtEntry
+{
+ rtl::OUString aName;
+ sal_uInt32 nKey;
+ sal_Bool bVolatile;
+
+ SvXMLNumFmtEntry( const rtl::OUString& rN, sal_uInt32 nK, sal_Bool bV ) :
+ aName(rN), nKey(nK), bVolatile(bV) {}
+};
+
+typedef SvXMLNumFmtEntry* SvXMLNumFmtEntryPtr;
+SV_DECL_PTRARR_DEL( SvXMLNumFmtEntryArr, SvXMLNumFmtEntryPtr, 4, 4 );
+
+//-------------------------------------------------------------------------
+
+class SvXMLNumImpData
+{
+ SvNumberFormatter* pFormatter;
+ SvXMLTokenMap* pStylesElemTokenMap;
+ SvXMLTokenMap* pStyleElemTokenMap;
+ SvXMLTokenMap* pStyleAttrTokenMap;
+ SvXMLTokenMap* pStyleElemAttrTokenMap;
+ International* pInternational;
+ SvXMLNumFmtEntryArr aNameEntries;
+
+public:
+ SvXMLNumImpData( SvNumberFormatter* pFmt );
+ ~SvXMLNumImpData();
+
+ SvNumberFormatter* GetNumberFormatter() const { return pFormatter; }
+ const SvXMLTokenMap& GetStylesElemTokenMap();
+ const SvXMLTokenMap& GetStyleElemTokenMap();
+ const SvXMLTokenMap& GetStyleAttrTokenMap();
+ const SvXMLTokenMap& GetStyleElemAttrTokenMap();
+ const International& GetInternational( LanguageType nLang );
+ sal_uInt32 GetKeyForName( const rtl::OUString& rName );
+ void AddKey( sal_uInt32 nKey, const rtl::OUString& rName );
+};
+
+
+struct SvXMLNumberInfo
+{
+ sal_Int32 nDecimals;
+ sal_Int32 nInteger;
+ sal_Int32 nExpDigits;
+ sal_Int32 nNumerDigits;
+ sal_Int32 nDenomDigits;
+ sal_Bool bGrouping;
+ sal_Bool bDecReplace;
+
+ SvXMLNumberInfo()
+ {
+ nDecimals = nInteger = nExpDigits = nNumerDigits = nDenomDigits = -1;
+ bGrouping = bDecReplace = sal_False;
+ }
+};
+
+class SvXMLNumFmtElementContext : public SvXMLImportContext
+{
+ SvXMLNumFormatContext& rParent;
+ sal_uInt16 nType;
+ rtl::OUStringBuffer aContent;
+ SvXMLNumberInfo aNumInfo;
+ LanguageType nElementLang;
+ sal_Bool bLong;
+ sal_Bool bTextual;
+
+public:
+ SvXMLNumFmtElementContext( SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext, sal_uInt16 nNewType,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtElementContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+};
+
+
+class SvXMLNumFmtMapContext : public SvXMLImportContext
+{
+ SvXMLNumFormatContext& rParent;
+ rtl::OUString sCondition;
+ rtl::OUString sName;
+
+public:
+ SvXMLNumFmtMapContext( SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtMapContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+};
+
+
+class SvXMLNumFmtPropContext : public SvXMLImportContext
+{
+ SvXMLNumFormatContext& rParent;
+ Color aColor;
+ sal_Bool bColSet;
+
+public:
+ SvXMLNumFmtPropContext( SvXMLImport& rImport, USHORT nPrfx,
+ const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual ~SvXMLNumFmtPropContext();
+
+ virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
+ const rtl::OUString& rLocalName,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XAttributeList>& xAttrList );
+ virtual void Characters( const rtl::OUString& rChars );
+ virtual void EndElement();
+};
+
+
+//-------------------------------------------------------------------------
+
+enum SvXMLStylesTokens
+{
+ XML_TOK_STYLES_NUMBER_STYLE,
+ XML_TOK_STYLES_CURRENCY_STYLE,
+ XML_TOK_STYLES_PERCENTAGE_STYLE,
+ XML_TOK_STYLES_DATE_STYLE,
+ XML_TOK_STYLES_TIME_STYLE,
+ XML_TOK_STYLES_BOOLEAN_STYLE,
+ XML_TOK_STYLES_TEXT_STYLE
+};
+
+enum SvXMLStyleTokens
+{
+ XML_TOK_STYLE_TEXT,
+ XML_TOK_STYLE_NUMBER,
+ XML_TOK_STYLE_SCIENTIFIC_NUMBER,
+ XML_TOK_STYLE_FRACTION,
+ XML_TOK_STYLE_CURRENCY_SYMBOL,
+ XML_TOK_STYLE_DAY,
+ XML_TOK_STYLE_MONTH,
+ XML_TOK_STYLE_YEAR,
+ XML_TOK_STYLE_DAY_OF_WEEK,
+ XML_TOK_STYLE_WEEK_OF_YEAR,
+ XML_TOK_STYLE_QUARTER,
+ XML_TOK_STYLE_HOURS,
+ XML_TOK_STYLE_AM_PM,
+ XML_TOK_STYLE_MINUTES,
+ XML_TOK_STYLE_SECONDS,
+ XML_TOK_STYLE_BOOLEAN,
+ XML_TOK_STYLE_TEXT_CONTENT,
+ XML_TOK_STYLE_PROPERTIES,
+ XML_TOK_STYLE_MAP
+};
+
+enum SvXMLStyleAttrTokens
+{
+ XML_TOK_STYLE_ATTR_NAME,
+ XML_TOK_STYLE_ATTR_LANGUAGE,
+ XML_TOK_STYLE_ATTR_COUNTRY,
+ XML_TOK_STYLE_ATTR_TITLE,
+ XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER,
+ XML_TOK_STYLE_ATTR_FORMAT_SOURCE,
+ XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW,
+ XML_TOK_STYLE_ATTR_VOLATILE
+};
+
+enum SvXMLStyleElemAttrTokens
+{
+ XML_TOK_ELEM_ATTR_DECIMAL_PLACES,
+ XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS,
+ XML_TOK_ELEM_ATTR_GROUPING,
+ XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT,
+ XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS,
+ XML_TOK_ELEM_ATTR_MIN_NUMERATOR_DIGITS,
+ XML_TOK_ELEM_ATTR_MIN_DENOMINATOR_DIGITS,
+ XML_TOK_ELEM_ATTR_LANGUAGE,
+ XML_TOK_ELEM_ATTR_COUNTRY,
+ XML_TOK_ELEM_ATTR_STYLE,
+ XML_TOK_ELEM_ATTR_TEXTUAL
+};
+
+//-------------------------------------------------------------------------
+
+//
+// standard colors
+//
+
+#define XML_NUMF_COLORCOUNT 10
+
+static ColorData aNumFmtStdColors[XML_NUMF_COLORCOUNT] =
+{
+ COL_BLACK,
+ COL_LIGHTBLUE,
+ COL_LIGHTGREEN,
+ COL_LIGHTCYAN,
+ COL_LIGHTRED,
+ COL_LIGHTMAGENTA,
+ COL_BROWN,
+ COL_GRAY,
+ COL_YELLOW,
+ COL_WHITE
+};
+
+//
+// token maps
+//
+
+static __FAR_DATA SvXMLTokenMapEntry aStylesElemMap[] =
+{
+ // style elements
+ { XML_NAMESPACE_NUMBER, sXML_number_style, XML_TOK_STYLES_NUMBER_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_currency_style, XML_TOK_STYLES_CURRENCY_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_percentage_style, XML_TOK_STYLES_PERCENTAGE_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_date_style, XML_TOK_STYLES_DATE_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_time_style, XML_TOK_STYLES_TIME_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_boolean_style, XML_TOK_STYLES_BOOLEAN_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_text_style, XML_TOK_STYLES_TEXT_STYLE },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aStyleElemMap[] =
+{
+ // elements in a style
+ { XML_NAMESPACE_NUMBER, sXML_text, XML_TOK_STYLE_TEXT },
+ { XML_NAMESPACE_NUMBER, sXML_number, XML_TOK_STYLE_NUMBER },
+ { XML_NAMESPACE_NUMBER, sXML_scientific_number, XML_TOK_STYLE_SCIENTIFIC_NUMBER },
+ { XML_NAMESPACE_NUMBER, sXML_fraction, XML_TOK_STYLE_FRACTION },
+ { XML_NAMESPACE_NUMBER, sXML_currency_symbol, XML_TOK_STYLE_CURRENCY_SYMBOL },
+ { XML_NAMESPACE_NUMBER, sXML_day, XML_TOK_STYLE_DAY },
+ { XML_NAMESPACE_NUMBER, sXML_month, XML_TOK_STYLE_MONTH },
+ { XML_NAMESPACE_NUMBER, sXML_year, XML_TOK_STYLE_YEAR },
+ { XML_NAMESPACE_NUMBER, sXML_day_of_week, XML_TOK_STYLE_DAY_OF_WEEK },
+ { XML_NAMESPACE_NUMBER, sXML_week_of_year, XML_TOK_STYLE_WEEK_OF_YEAR },
+ { XML_NAMESPACE_NUMBER, sXML_quarter, XML_TOK_STYLE_QUARTER },
+ { XML_NAMESPACE_NUMBER, sXML_hours, XML_TOK_STYLE_HOURS },
+ { XML_NAMESPACE_NUMBER, sXML_am_pm, XML_TOK_STYLE_AM_PM },
+ { XML_NAMESPACE_NUMBER, sXML_minutes, XML_TOK_STYLE_MINUTES },
+ { XML_NAMESPACE_NUMBER, sXML_seconds, XML_TOK_STYLE_SECONDS },
+ { XML_NAMESPACE_NUMBER, sXML_boolean, XML_TOK_STYLE_BOOLEAN },
+ { XML_NAMESPACE_NUMBER, sXML_text_content, XML_TOK_STYLE_TEXT_CONTENT },
+ { XML_NAMESPACE_STYLE, sXML_properties, XML_TOK_STYLE_PROPERTIES },
+ { XML_NAMESPACE_STYLE, sXML_map, XML_TOK_STYLE_MAP },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aStyleAttrMap[] =
+{
+ // attributes for a style
+ { XML_NAMESPACE_STYLE, sXML_name, XML_TOK_STYLE_ATTR_NAME },
+ { XML_NAMESPACE_NUMBER, sXML_language, XML_TOK_STYLE_ATTR_LANGUAGE },
+ { XML_NAMESPACE_NUMBER, sXML_country, XML_TOK_STYLE_ATTR_COUNTRY },
+ { XML_NAMESPACE_NUMBER, sXML_title, XML_TOK_STYLE_ATTR_TITLE },
+ { XML_NAMESPACE_NUMBER, sXML_automatic_order, XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER },
+ { XML_NAMESPACE_NUMBER, sXML_format_source, XML_TOK_STYLE_ATTR_FORMAT_SOURCE },
+ { XML_NAMESPACE_NUMBER, sXML_truncate_on_overflow, XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW },
+ { XML_NAMESPACE_STYLE, sXML_volatile, XML_TOK_STYLE_ATTR_VOLATILE },
+ XML_TOKEN_MAP_END
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aStyleElemAttrMap[] =
+{
+ // attributes for an element within a style
+ { XML_NAMESPACE_NUMBER, sXML_decimal_places, XML_TOK_ELEM_ATTR_DECIMAL_PLACES },
+ { XML_NAMESPACE_NUMBER, sXML_min_integer_digits, XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS },
+ { XML_NAMESPACE_NUMBER, sXML_grouping, XML_TOK_ELEM_ATTR_GROUPING },
+ { XML_NAMESPACE_NUMBER, sXML_decimal_replacement, XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT },
+ { XML_NAMESPACE_NUMBER, sXML_min_exponent_digits, XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS },
+ { XML_NAMESPACE_NUMBER, sXML_min_numerator_digits, XML_TOK_ELEM_ATTR_MIN_NUMERATOR_DIGITS },
+ { XML_NAMESPACE_NUMBER, sXML_min_denominator_digits, XML_TOK_ELEM_ATTR_MIN_DENOMINATOR_DIGITS },
+ { XML_NAMESPACE_NUMBER, sXML_language, XML_TOK_ELEM_ATTR_LANGUAGE },
+ { XML_NAMESPACE_NUMBER, sXML_country, XML_TOK_ELEM_ATTR_COUNTRY },
+ { XML_NAMESPACE_NUMBER, sXML_style, XML_TOK_ELEM_ATTR_STYLE },
+ { XML_NAMESPACE_NUMBER, sXML_textual, XML_TOK_ELEM_ATTR_TEXTUAL },
+ XML_TOKEN_MAP_END
+};
+
+// maps for SvXMLUnitConverter::convertEnum
+
+static __FAR_DATA SvXMLEnumMapEntry aStyleValueMap[] =
+{
+ { sXML_short, sal_False },
+ { sXML_long, sal_True },
+ { 0, 0 }
+};
+
+static __FAR_DATA SvXMLEnumMapEntry aFormatSourceMap[] =
+{
+ { sXML_fixed, sal_False },
+ { sXML_language, sal_True },
+ { 0, 0 }
+};
+
+//-------------------------------------------------------------------------
+
+SV_IMPL_PTRARR( SvXMLNumFmtEntryArr, SvXMLNumFmtEntryPtr );
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumImpData
+//
+
+SvXMLNumImpData::SvXMLNumImpData( SvNumberFormatter* pFmt ) :
+ pFormatter(pFmt),
+ pStylesElemTokenMap(NULL),
+ pStyleElemTokenMap(NULL),
+ pStyleAttrTokenMap(NULL),
+ pStyleElemAttrTokenMap(NULL),
+ pInternational(NULL)
+{
+}
+
+SvXMLNumImpData::~SvXMLNumImpData()
+{
+ delete pStylesElemTokenMap;
+ delete pStyleElemTokenMap;
+ delete pStyleAttrTokenMap;
+ delete pStyleElemAttrTokenMap;
+ delete pInternational;
+}
+
+sal_uInt32 SvXMLNumImpData::GetKeyForName( const rtl::OUString& rName )
+{
+ USHORT nCount = aNameEntries.Count();
+ for (USHORT i=0; i<nCount; i++)
+ {
+ const SvXMLNumFmtEntry* pObj = aNameEntries[i];
+ if ( pObj->aName == rName )
+ return pObj->nKey; // found
+ }
+ return NUMBERFORMAT_ENTRY_NOT_FOUND;
+}
+
+void SvXMLNumImpData::AddKey( sal_uInt32 nKey, const rtl::OUString& rName )
+{
+ sal_Bool bVolatile = sal_False;
+ SvXMLNumFmtEntry* pObj = new SvXMLNumFmtEntry( rName, nKey, bVolatile );
+ aNameEntries.Insert( pObj, aNameEntries.Count() );
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStylesElemTokenMap()
+{
+ if( !pStylesElemTokenMap )
+ pStylesElemTokenMap = new SvXMLTokenMap( aStylesElemMap );
+ return *pStylesElemTokenMap;
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemTokenMap()
+{
+ if( !pStyleElemTokenMap )
+ pStyleElemTokenMap = new SvXMLTokenMap( aStyleElemMap );
+ return *pStyleElemTokenMap;
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStyleAttrTokenMap()
+{
+ if( !pStyleAttrTokenMap )
+ pStyleAttrTokenMap = new SvXMLTokenMap( aStyleAttrMap );
+ return *pStyleAttrTokenMap;
+}
+
+const SvXMLTokenMap& SvXMLNumImpData::GetStyleElemAttrTokenMap()
+{
+ if( !pStyleElemAttrTokenMap )
+ pStyleElemAttrTokenMap = new SvXMLTokenMap( aStyleElemAttrMap );
+ return *pStyleElemAttrTokenMap;
+}
+
+const International& SvXMLNumImpData::GetInternational( LanguageType nLang )
+{
+ if ( !pInternational || pInternational->GetLanguage() != nLang )
+ {
+ delete pInternational;
+ pInternational = new International( nLang );
+ }
+ return *pInternational;
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtMapContext
+//
+
+SvXMLNumFmtMapContext::SvXMLNumFmtMapContext( SvXMLImport& rImport,
+ USHORT nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_STYLE )
+ {
+ if ( aLocalName.compareToAscii(sXML_condition) == 0 )
+ sCondition = sValue;
+ else if ( aLocalName.compareToAscii(sXML_apply_style_name) == 0 )
+ sName = sValue;
+ }
+ }
+}
+
+SvXMLNumFmtMapContext::~SvXMLNumFmtMapContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtMapContext::CreateChildContext(
+ USHORT nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ // no elements supported - use default context
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtMapContext::Characters( const rtl::OUString& rChars )
+{
+}
+
+void SvXMLNumFmtMapContext::EndElement()
+{
+ rParent.AddCondition( sCondition, sName );
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtPropContext
+//
+
+SvXMLNumFmtPropContext::SvXMLNumFmtPropContext( SvXMLImport& rImport,
+ USHORT nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext ),
+ bColSet( sal_False )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+ if ( nPrefix == XML_NAMESPACE_FO && aLocalName.compareToAscii(sXML_color) == 0 )
+ bColSet = SvXMLUnitConverter::convertColor( aColor, sValue );
+ }
+}
+
+SvXMLNumFmtPropContext::~SvXMLNumFmtPropContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtPropContext::CreateChildContext(
+ USHORT nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ // no elements supported - use default context
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtPropContext::Characters( const rtl::OUString& rChars )
+{
+}
+
+void SvXMLNumFmtPropContext::EndElement()
+{
+ if (bColSet)
+ rParent.AddColor( aColor );
+}
+
+//-------------------------------------------------------------------------
+
+sal_Bool lcl_ValidChar( sal_Unicode cChar, sal_uInt16 nFormatType )
+{
+ // see ImpSvNumberformatScan::Next_Symbol
+ if ( cChar == ' ' ||
+ cChar == '-' ||
+ cChar == '/' ||
+ cChar == '.' ||
+ cChar == ',' ||
+ cChar == ':' ||
+ cChar == '\'' )
+ return sal_True; // for all format types
+
+ // percent sign must be used without quotes for percentage styles only
+ if ( nFormatType == XML_TOK_STYLES_PERCENTAGE_STYLE && cChar == '%' )
+ return sal_True;
+
+ return sal_False;
+}
+
+//
+// SvXMLNumFmtElementContext
+//
+
+SvXMLNumFmtElementContext::SvXMLNumFmtElementContext( SvXMLImport& rImport,
+ USHORT nPrfx, const rtl::OUString& rLName,
+ SvXMLNumFormatContext& rParentContext, sal_uInt16 nNewType,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rParent( rParentContext ),
+ nType( nNewType ),
+ nElementLang( LANGUAGE_SYSTEM ),
+ bLong( FALSE ),
+ bTextual( FALSE )
+{
+ OUString sLanguage, sCountry;
+ sal_Int32 nAttrVal;
+ sal_Bool bAttrBool;
+ sal_uInt16 nAttrEnum;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ const SvXMLTokenMap& rTokenMap = rParent.GetData()->GetStyleElemAttrTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, aLocalName );
+
+ switch (nToken)
+ {
+ case XML_TOK_ELEM_ATTR_DECIMAL_PLACES:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nDecimals = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_INTEGER_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nInteger = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_GROUPING:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ aNumInfo.bGrouping = bAttrBool;
+ break;
+ case XML_TOK_ELEM_ATTR_DECIMAL_REPLACEMENT:
+ if ( sValue.getLength() > 0 )
+ aNumInfo.bDecReplace = sal_True; // only a default string is supported
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_EXPONENT_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nExpDigits = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_NUMERATOR_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nNumerDigits = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_MIN_DENOMINATOR_DIGITS:
+ if ( SvXMLUnitConverter::convertNumber( nAttrVal, sValue, 0 ) )
+ aNumInfo.nDenomDigits = nAttrVal;
+ break;
+ case XML_TOK_ELEM_ATTR_LANGUAGE:
+ sLanguage = sValue;
+ break;
+ case XML_TOK_ELEM_ATTR_COUNTRY:
+ sCountry = sValue;
+ break;
+ case XML_TOK_ELEM_ATTR_STYLE:
+ if ( SvXMLUnitConverter::convertEnum( nAttrEnum, sValue, aStyleValueMap ) )
+ bLong = (sal_Bool) nAttrEnum;
+ break;
+ case XML_TOK_ELEM_ATTR_TEXTUAL:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bTextual = bAttrBool;
+ break;
+ }
+ }
+
+ if ( sLanguage.getLength() || sCountry.getLength() )
+ {
+ nElementLang = ConvertIsoNamesToLanguage( sLanguage, sCountry );
+ if ( nElementLang == LANGUAGE_DONTKNOW )
+ nElementLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
+ }
+}
+
+SvXMLNumFmtElementContext::~SvXMLNumFmtElementContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFmtElementContext::CreateChildContext(
+ USHORT nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ // no elements supported - use default context
+ return new SvXMLImportContext( GetImport(), nPrfx, rLName );
+}
+
+void SvXMLNumFmtElementContext::Characters( const rtl::OUString& rChars )
+{
+ aContent.append( rChars );
+}
+
+void SvXMLNumFmtElementContext::EndElement()
+{
+ sal_Bool bEffLong = bLong;
+ switch (nType)
+ {
+ case XML_TOK_STYLE_TEXT:
+ if ( rParent.HasLongDoW() &&
+ rParent.GetInternational().GetLongDateDayOfWeekSep() ==
+ String( aContent.getStr() ) )
+ {
+ // skip separator constant after long day of week
+ // (NF_KEY_NNNN contains the separator)
+
+ //!aContent.setLength(0); //! doesn't work, #76293#
+ aContent = OUStringBuffer();
+
+ rParent.SetHasLongDoW( sal_False ); // only once
+ }
+ if ( aContent.getLength() )
+ {
+ if ( ( aContent.getLength() == 1 &&
+ lcl_ValidChar( aContent.charAt(0), rParent.GetType() ) ) ||
+ ( aContent.getLength() == 2 &&
+ lcl_ValidChar( aContent.charAt(0), rParent.GetType() ) &&
+ aContent.charAt(1) == ' ' ) )
+ {
+ // don't quote single separator characters like space or percent,
+ // or separator characters followed by space (used in date formats)
+ }
+ else
+ {
+ // quote string literals
+ //! escape quotes in string
+ aContent.insert( 0, (sal_Unicode) '"' );
+ aContent.append( (sal_Unicode) '"' );
+ }
+ rParent.AddToCode( aContent.makeStringAndClear() );
+ }
+ break;
+
+ case XML_TOK_STYLE_NUMBER:
+ rParent.AddNumber( aNumInfo );
+ break;
+
+ case XML_TOK_STYLE_CURRENCY_SYMBOL:
+ rParent.AddCurrency( aContent.makeStringAndClear(), nElementLang );
+ break;
+
+ case XML_TOK_STYLE_TEXT_CONTENT:
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'@') );
+ break;
+ case XML_TOK_STYLE_BOOLEAN:
+ // ignored - only default boolean format is supported
+ break;
+
+ case XML_TOK_STYLE_DAY:
+ if ( rParent.IsFromSystem() )
+ bEffLong = bLong ? rParent.GetInternational().IsLongDateDayLeadingZero() :
+ rParent.GetInternational().IsDateDayLeadingZero();
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_TT : NF_KEY_T );
+ break;
+ case XML_TOK_STYLE_MONTH:
+ if ( rParent.IsFromSystem() )
+ {
+ if (bLong)
+ {
+ MonthFormat eMonth = rParent.GetInternational().GetLongDateMonthFormat();
+ bEffLong = ( eMonth == MONTH_ZERO || eMonth == MONTH_LONG );
+ bTextual = ( eMonth == MONTH_SHORT || eMonth == MONTH_LONG );
+ }
+ else
+ bEffLong = rParent.GetInternational().IsDateMonthLeadingZero();
+ }
+ rParent.AddNfKeyword( bTextual ? ( bEffLong ? NF_KEY_MMMM : NF_KEY_MMM ) :
+ ( bEffLong ? NF_KEY_MM : NF_KEY_M ) );
+ break;
+ case XML_TOK_STYLE_YEAR:
+ if ( rParent.IsFromSystem() )
+ bEffLong = bLong ? rParent.GetInternational().IsLongDateCentury() :
+ rParent.GetInternational().IsDateCentury();
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_JJJJ : NF_KEY_JJ );
+ break;
+ case XML_TOK_STYLE_DAY_OF_WEEK:
+ if ( rParent.IsFromSystem() && bLong )
+ bEffLong = ( rParent.GetInternational().GetLongDateDayOfWeekFormat() == DAYOFWEEK_LONG );
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_NNNN : NF_KEY_NN );
+ break;
+ case XML_TOK_STYLE_WEEK_OF_YEAR:
+ rParent.AddNfKeyword( NF_KEY_WW );
+ break;
+ case XML_TOK_STYLE_QUARTER:
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_QQ : NF_KEY_Q );
+ break;
+ case XML_TOK_STYLE_HOURS:
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_HH : NF_KEY_H );
+ break;
+ case XML_TOK_STYLE_AM_PM:
+ //! short/long?
+ rParent.AddNfKeyword( NF_KEY_AMPM );
+ break;
+ case XML_TOK_STYLE_MINUTES:
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_MMI : NF_KEY_MI );
+ break;
+ case XML_TOK_STYLE_SECONDS:
+ rParent.AddNfKeyword( bEffLong ? NF_KEY_SS : NF_KEY_S );
+ if ( aNumInfo.nDecimals > 0 )
+ {
+ // manually add the decimal places
+ rParent.AddToCode( OUString::valueOf(
+ rParent.GetInternational().GetNumDecimalSep() ) );
+ for (sal_Int32 i=0; i<aNumInfo.nDecimals; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'0') );
+ }
+ break;
+
+ case XML_TOK_STYLE_FRACTION:
+ {
+ aNumInfo.nDecimals = 0;
+ rParent.AddNumber( aNumInfo ); // number without decimals
+
+ //! build string and add at once
+
+ sal_Int32 i;
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)' ') );
+ for (i=0; i<aNumInfo.nNumerDigits; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'?') );
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'/') );
+ for (i=0; i<aNumInfo.nDenomDigits; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'?') );
+ }
+ break;
+
+ case XML_TOK_STYLE_SCIENTIFIC_NUMBER:
+ {
+ rParent.AddNumber( aNumInfo ); // simple number
+
+ rParent.AddToCode( OUString::createFromAscii( "E+" ) );
+ for (sal_Int32 i=0; i<aNumInfo.nExpDigits; i++)
+ rParent.AddToCode( OUString::valueOf((sal_Unicode)'0') );
+ }
+ break;
+
+ default:
+ DBG_ERROR("invalid element ID");
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFormatContext
+//
+
+SvXMLNumFormatContext::SvXMLNumFormatContext( SvXMLImport& rImport,
+ USHORT nPrfx, const rtl::OUString& rLName,
+ SvXMLNumImpData* pNewData, sal_uInt16 nNewType,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles ) :
+ SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList ),
+ pData( pNewData ),
+ nType( nNewType ),
+ nFormatLang( LANGUAGE_SYSTEM ),
+ bAutoOrder( FALSE ),
+ bFromSystem( FALSE ),
+ bTruncate( TRUE ),
+ bAutoDec( FALSE ),
+ bAutoInt( FALSE ),
+ bHasExtraText( FALSE ),
+ bHasLongDoW( FALSE ),
+ bHasDateTime( FALSE ),
+ bHasMap( sal_False ),
+ pStyles( &rStyles ),
+ nKey(-1)
+{
+ OUString sLanguage, sCountry;
+ sal_Bool bAttrBool;
+ sal_uInt16 nAttrEnum;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ OUString sAttrName = xAttrList->getNameByIndex( i );
+ OUString sValue = xAttrList->getValueByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
+
+ const SvXMLTokenMap& rTokenMap = pData->GetStyleAttrTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, aLocalName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLE_ATTR_NAME:
+// aName = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_LANGUAGE:
+ sLanguage = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_COUNTRY:
+ sCountry = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_TITLE:
+ sFormatTitle = sValue;
+ break;
+ case XML_TOK_STYLE_ATTR_AUTOMATIC_ORDER:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bAutoOrder = bAttrBool;
+ break;
+ case XML_TOK_STYLE_ATTR_FORMAT_SOURCE:
+ if ( SvXMLUnitConverter::convertEnum( nAttrEnum, sValue, aFormatSourceMap ) )
+ bFromSystem = (sal_Bool) nAttrEnum;
+ break;
+ case XML_TOK_STYLE_ATTR_TRUNCATE_ON_OVERFLOW:
+ if ( SvXMLUnitConverter::convertBool( bAttrBool, sValue ) )
+ bTruncate = bAttrBool;
+ break;
+ case XML_TOK_STYLE_ATTR_VOLATILE:
+ //! ...
+ break;
+ }
+ }
+
+ if ( sLanguage.getLength() || sCountry.getLength() )
+ {
+ nFormatLang = ConvertIsoNamesToLanguage( sLanguage, sCountry );
+ if ( nFormatLang == LANGUAGE_DONTKNOW )
+ nFormatLang = LANGUAGE_SYSTEM; //! error handling for invalid locales?
+ }
+}
+
+SvXMLNumFormatContext::~SvXMLNumFormatContext()
+{
+}
+
+SvXMLImportContext* SvXMLNumFormatContext::CreateChildContext(
+ USHORT nPrfx, const rtl::OUString& rLName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList )
+{
+ SvXMLImportContext* pContext = NULL;
+
+ const SvXMLTokenMap& rTokenMap = pData->GetStyleElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrfx, rLName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLE_TEXT:
+ case XML_TOK_STYLE_NUMBER:
+ case XML_TOK_STYLE_SCIENTIFIC_NUMBER:
+ case XML_TOK_STYLE_FRACTION:
+ case XML_TOK_STYLE_CURRENCY_SYMBOL:
+ case XML_TOK_STYLE_DAY:
+ case XML_TOK_STYLE_MONTH:
+ case XML_TOK_STYLE_YEAR:
+ case XML_TOK_STYLE_DAY_OF_WEEK:
+ case XML_TOK_STYLE_WEEK_OF_YEAR:
+ case XML_TOK_STYLE_QUARTER:
+ case XML_TOK_STYLE_HOURS:
+ case XML_TOK_STYLE_AM_PM:
+ case XML_TOK_STYLE_MINUTES:
+ case XML_TOK_STYLE_SECONDS:
+ case XML_TOK_STYLE_BOOLEAN:
+ case XML_TOK_STYLE_TEXT_CONTENT:
+ pContext = new SvXMLNumFmtElementContext( GetImport(), nPrfx, rLName,
+ *this, nToken, xAttrList );
+ break;
+
+ case XML_TOK_STYLE_PROPERTIES:
+ pContext = new SvXMLNumFmtPropContext( GetImport(), nPrfx, rLName,
+ *this, xAttrList );
+ break;
+ case XML_TOK_STYLE_MAP:
+ {
+ bHasMap = sal_True;
+ pContext = new SvXMLNumFmtMapContext( GetImport(), nPrfx, rLName,
+ *this, xAttrList );
+ }
+ break;
+ }
+
+ if( !pContext )
+ pContext = new SvXMLImportContext( GetImport(), nPrfx, rLName );
+ return pContext;
+}
+
+sal_Int32 SvXMLNumFormatContext::GetKey()
+{
+ if (nKey > -1)
+ return nKey;
+ else
+ {
+ CreateAndInsert(sal_True);
+ return nKey;
+ }
+}
+
+void SvXMLNumFormatContext::CreateAndInsert(sal_Bool bOverwrite)
+{
+ if (!(nKey > -1))
+ {
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ {
+ DBG_ERROR("no number formatter");
+ return;
+ }
+
+ sal_uInt32 nIndex = NUMBERFORMAT_ENTRY_NOT_FOUND;
+
+ if (bHasMap)
+ {
+ SvXMLNumFormatContext* pStyle = (SvXMLNumFormatContext *)pStyles->FindStyleChildContext(
+ XML_STYLE_FAMILY_DATA_STYLE, sMapName, sal_False);
+ if (pStyle)
+ {
+ if ((pStyle->GetKey() > -1))
+ AddCondition();
+ }
+ }
+ aFormatCode.insert( 0, aConditions.makeStringAndClear() );
+ OUString sFormat = aFormatCode.makeStringAndClear();
+
+ // test special cases
+
+ if ( bAutoDec ) // automatic decimal places
+ {
+ if ( nType == XML_TOK_STYLES_NUMBER_STYLE && !bHasExtraText )
+ nIndex = pFormatter->GetStandardIndex( nFormatLang );
+ }
+ if ( bAutoInt ) // automatic integer digits
+ {
+ //! only if two decimal places was set?
+
+ if ( nType == XML_TOK_STYLES_NUMBER_STYLE && !bHasExtraText )
+ nIndex = pFormatter->GetFormatIndex( NF_NUMBER_SYSTEM, nFormatLang );
+ }
+
+ // boolean is always the builtin boolean format
+ // (no other boolean formats are implemented)
+ if ( nType == XML_TOK_STYLES_BOOLEAN_STYLE )
+ nIndex = pFormatter->GetFormatIndex( NF_BOOLEAN, nFormatLang );
+
+ if ( nIndex == NUMBERFORMAT_ENTRY_NOT_FOUND && sFormat.getLength() )
+ {
+ // insert by format string
+
+ String aFormatStr( sFormat );
+ nIndex = pFormatter->GetEntryKey( aFormatStr, nFormatLang );
+ if ( nIndex == NUMBERFORMAT_ENTRY_NOT_FOUND )
+ {
+ xub_StrLen nErrPos = 0;
+ short nType = 0;
+ sal_Bool bOk = pFormatter->PutEntry( aFormatStr, nErrPos, nType, nIndex, nFormatLang );
+ if (!bOk)
+ nIndex = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ }
+ }
+
+ if ( nIndex != NUMBERFORMAT_ENTRY_NOT_FOUND && !bFromSystem )
+ {
+ // instead of automatic date format, use fixed formats if bFromSystem is not set
+ //! prevent use of automatic formats in other cases, force user-defined format?
+
+ NfIndexTableOffset eOffset = pFormatter->GetIndexTableOffset( nIndex );
+ if ( eOffset == NF_DATE_SYSTEM_SHORT )
+ {
+ const International& rInt = pData->GetInternational( nFormatLang );
+ if ( rInt.IsDateDayLeadingZero() && rInt.IsDateMonthLeadingZero() )
+ {
+ if ( rInt.IsDateCentury() )
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYYYY, nFormatLang );
+ else
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_SYS_DDMMYY, nFormatLang );
+ }
+ }
+ else if ( eOffset == NF_DATE_SYSTEM_LONG )
+ {
+ const International& rInt = pData->GetInternational( nFormatLang );
+ if ( !rInt.IsLongDateDayLeadingZero() )
+ {
+ sal_Bool bCentury = rInt.IsLongDateCentury();
+ MonthFormat eMonth = rInt.GetLongDateMonthFormat();
+ if ( eMonth == MONTH_LONG && bCentury )
+ {
+ if ( rInt.GetLongDateDayOfWeekFormat() == DAYOFWEEK_LONG )
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_SYS_NNNNDMMMMYYYY, nFormatLang );
+ else
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_SYS_NNDMMMMYYYY, nFormatLang );
+ }
+ else if ( eMonth == MONTH_SHORT && !bCentury )
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_SYS_NNDMMMYY, nFormatLang );
+ }
+ }
+ }
+
+ if ( nIndex != NUMBERFORMAT_ENTRY_NOT_FOUND && !bAutoOrder )
+ {
+ // use fixed-order formats instead of SYS... if bAutoOrder is false
+
+ NfIndexTableOffset eOffset = pFormatter->GetIndexTableOffset( nIndex );
+ if ( eOffset == NF_DATE_SYS_DMMMYYYY )
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_DMMMYYYY, nFormatLang );
+ else if ( eOffset == NF_DATE_SYS_DMMMMYYYY )
+ nIndex = pFormatter->GetFormatIndex( NF_DATE_DIN_DMMMMYYYY, nFormatLang );
+ }
+
+ pData->AddKey( nIndex, GetName() );
+ nKey = nIndex;
+
+ #if 0
+ ByteString aByte( String(sFormatName), gsl_getSystemTextEncoding() );
+ aByte.Append( " | " );
+ aByte.Append(ByteString( String(sFormat), gsl_getSystemTextEncoding() ));
+ aByte.Append( " | " );
+ aByte.Append(ByteString::CreateFromInt32( nIndex ));
+
+ // DBG_ERROR(aByte.GetBuffer());
+ int xxx=42;
+ #endif
+ }
+}
+
+void SvXMLNumFormatContext::Finish( sal_Bool bOverwrite )
+{
+ SvXMLStyleContext::Finish( bOverwrite );
+// AddCondition();
+}
+
+const International& SvXMLNumFormatContext::GetInternational() const
+{
+ return pData->GetInternational( nFormatLang );
+}
+
+void SvXMLNumFormatContext::AddToCode( const rtl::OUString& rString )
+{
+ aFormatCode.append( rString );
+ bHasExtraText = sal_True;
+}
+
+void SvXMLNumFormatContext::AddNumber( const SvXMLNumberInfo& rInfo )
+{
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return;
+
+ // store special conditions
+ bAutoDec = ( rInfo.nDecimals < 0 );
+ bAutoInt = ( rInfo.nInteger < 0 );
+
+ sal_uInt16 nPrec = 0;
+ sal_uInt16 nLeading = 0;
+ if ( rInfo.nDecimals >= 0 ) // < 0 : Default
+ nPrec = (sal_uInt16) rInfo.nDecimals;
+ if ( rInfo.nInteger >= 0 ) // < 0 : Default
+ nLeading = (sal_uInt16) rInfo.nInteger;
+
+ if ( bAutoDec )
+ {
+ // use language defaults for other than builtin formats
+
+ const International& rInt = pData->GetInternational( nFormatLang );
+
+ if ( nType == XML_TOK_STYLES_CURRENCY_STYLE )
+ nPrec = rInt.GetCurrDigits();
+ else
+ nPrec = rInt.GetNumDigits();
+ }
+ if ( bAutoInt )
+ {
+ //!...
+ }
+
+ sal_uInt16 nGenPrec = nPrec;
+ if ( rInfo.bDecReplace )
+ nGenPrec = 0; // generate format without decimals...
+
+ String aNumStr;
+ sal_uInt32 nStdIndex = pFormatter->GetStandardIndex( nFormatLang );
+ pFormatter->GenerateFormat( aNumStr, nStdIndex, nFormatLang,
+ rInfo.bGrouping, sal_False, nGenPrec, nLeading );
+
+ aFormatCode.append( aNumStr );
+
+ if ( rInfo.bDecReplace && nPrec ) // add decimal replacement (dashes)
+ {
+ aFormatCode.append( pData->GetInternational( nFormatLang ).GetNumDecimalSep() );
+ for ( sal_uInt16 i=0; i<nPrec; i++)
+ aFormatCode.append( (sal_Unicode)'-' );
+ }
+}
+
+void SvXMLNumFormatContext::AddCurrency( const rtl::OUString& rContent, LanguageType nLang )
+{
+ sal_Bool bAutomatic = sal_False;
+ OUString aSymbol = rContent;
+ if ( aSymbol.getLength() == 0 )
+ {
+ // get currency symbol for language
+ aSymbol = pData->GetInternational( nFormatLang ).GetCurrSymbol();
+ bAutomatic = sal_True;
+ }
+ else if ( nLang == LANGUAGE_SYSTEM && aSymbol.compareToAscii("CCC") == 0 )
+ {
+ // "CCC" is used for automatic long symbol
+ bAutomatic = sal_True;
+ }
+
+ if (!bAutomatic)
+ aFormatCode.appendAscii( "[$" ); // intro for "new" currency symbols
+
+ aFormatCode.append( aSymbol );
+
+ if (!bAutomatic)
+ {
+ if ( nLang != LANGUAGE_SYSTEM )
+ {
+ // '-' sign and language code in hex:
+ aFormatCode.append( (sal_Unicode) '-' );
+ //aFormatCode.append( OUString::valueOf( (sal_Int32)nLang, 16 ) );
+ aFormatCode.append( (sal_Int32)nLang, 16 );
+ }
+
+ aFormatCode.append( (sal_Unicode) ']' ); // end of "new" currency symbol
+ }
+}
+
+void SvXMLNumFormatContext::AddNfKeyword( sal_uInt16 nIndex )
+{
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return;
+
+ if ( nIndex == NF_KEY_NNNN )
+ bHasLongDoW = sal_True; // to remove string constant with separator
+
+ String sKeyword = pFormatter->GetKeyword( nFormatLang, nIndex );
+
+ if ( nIndex == NF_KEY_H || nIndex == NF_KEY_HH ||
+ nIndex == NF_KEY_MI || nIndex == NF_KEY_MMI ||
+ nIndex == NF_KEY_S || nIndex == NF_KEY_SS )
+ {
+ if ( !bTruncate && !bHasDateTime )
+ {
+ // with truncate-on-overflow = false, add "[]" to first time part
+
+ sKeyword.Insert( (sal_Unicode) '[', 0 );
+ sKeyword.Append( (sal_Unicode) ']' );
+ }
+ bHasDateTime = sal_True;
+ }
+
+ aFormatCode.append( sKeyword );
+}
+
+void SvXMLNumFormatContext::AddCondition( )
+{
+ rtl::OUString rApplyName = sMapName;
+ rtl::OUString rCondition = sCondition;
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ sal_uInt32 nKey = pData->GetKeyForName( rApplyName );
+ OUString sValue = OUString::createFromAscii( "value()" ); //! define constant
+ sal_Int32 nValLen = sValue.getLength();
+
+ if ( pFormatter && nKey != NUMBERFORMAT_ENTRY_NOT_FOUND &&
+ rCondition.copy( 0, nValLen ) == sValue )
+ {
+ //! test for valid conditions
+ //! test for default conditions
+
+ OUString sRealCond = rCondition.copy( nValLen, rCondition.getLength() - nValLen );
+ sal_Bool bDefaultCond = sal_False;
+
+ //! collect all conditions first and adjust default to >=0, >0 or <0 depending on count
+ //! allow blanks in conditions
+ sal_Bool bFirstCond = ( aConditions.getLength() == 0 );
+ if ( bFirstCond && sRealCond.compareToAscii( ">=0" ) == 0 )
+ bDefaultCond = sal_True;
+
+ if (!bDefaultCond)
+ {
+ aConditions.append( (sal_Unicode) '[' );
+ aConditions.append( sRealCond );
+ aConditions.append( (sal_Unicode) ']' );
+ }
+
+ const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
+ if ( pFormat )
+ aConditions.append( OUString( pFormat->GetFormatstring() ) );
+
+ aConditions.append( (sal_Unicode) ';' );
+ }
+}
+
+void SvXMLNumFormatContext::AddColor( const Color& rColor )
+{
+ SvNumberFormatter* pFormatter = pData->GetNumberFormatter();
+ if (!pFormatter)
+ return;
+
+ OUStringBuffer aColName;
+ for ( sal_uInt16 i=0; i<XML_NUMF_COLORCOUNT; i++ )
+ if ( rColor == aNumFmtStdColors[i] )
+ {
+ aColName = OUString( pFormatter->GetKeyword( nFormatLang, NF_KEY_FIRSTCOLOR + i ) );
+ break;
+ }
+
+ if ( aColName.getLength() )
+ {
+ aColName.insert( 0, (sal_Unicode) '[' );
+ aColName.append( (sal_Unicode) ']' );
+ aFormatCode.insert( 0, aColName.makeStringAndClear() );
+ }
+}
+
+//-------------------------------------------------------------------------
+
+//
+// SvXMLNumFmtHelper
+//
+
+SvXMLNumFmtHelper::SvXMLNumFmtHelper(
+ const uno::Reference<util::XNumberFormatsSupplier>& rSupp )
+{
+ SvNumberFormatter* pFormatter = NULL;
+ SvNumberFormatsSupplierObj* pObj =
+ SvNumberFormatsSupplierObj::getImplementation( rSupp );
+ if (pObj)
+ pFormatter = pObj->GetNumberFormatter();
+
+ pData = new SvXMLNumImpData( pFormatter );
+}
+
+SvXMLNumFmtHelper::~SvXMLNumFmtHelper()
+{
+ delete pData;
+}
+
+SvXMLStyleContext* SvXMLNumFmtHelper::CreateChildContext( SvXMLImport& rImport,
+ USHORT nPrefix, const OUString& rLocalName,
+ const uno::Reference<xml::sax::XAttributeList>& xAttrList,
+ SvXMLStylesContext& rStyles )
+{
+ SvXMLStyleContext* pContext = NULL;
+
+ const SvXMLTokenMap& rTokenMap = pData->GetStylesElemTokenMap();
+ sal_uInt16 nToken = rTokenMap.Get( nPrefix, rLocalName );
+ switch (nToken)
+ {
+ case XML_TOK_STYLES_NUMBER_STYLE:
+ case XML_TOK_STYLES_CURRENCY_STYLE:
+ case XML_TOK_STYLES_PERCENTAGE_STYLE:
+ case XML_TOK_STYLES_DATE_STYLE:
+ case XML_TOK_STYLES_TIME_STYLE:
+ case XML_TOK_STYLES_BOOLEAN_STYLE:
+ case XML_TOK_STYLES_TEXT_STYLE:
+ pContext = new SvXMLNumFormatContext( rImport, nPrefix, rLocalName,
+ pData, nToken, xAttrList, rStyles );
+ break;
+ }
+
+ // return NULL if not a data style, caller must handle other elements
+ return pContext;
+}
+
+/*sal_uInt32 SvXMLNumFmtHelper::GetKeyForName( const rtl::OUString& rName )
+{
+ return pData->GetKeyForName( rName );
+}*/
+
+
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
new file mode 100644
index 000000000000..aef7ca424405
--- /dev/null
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -0,0 +1,1126 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlnumi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _VCL_VCLENUM_HXX
+#include <vcl/vclenum.hxx>
+#endif
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#include "xmltkmap.hxx"
+#include "nmspmap.hxx"
+#include "xmlnmspe.hxx"
+#include "xmlimp.hxx"
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYVALUE_HPP_
+#include <com/sun/star/beans/PropertyValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_SIZE_HPP_
+#include <com/sun/star/awt/Size.hpp>
+#endif
+#ifndef _COM_SUN_STAR_AWT_FONTDESCRIPTOR_HPP_
+#include <com/sun/star/awt/FontDescriptor.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_HORIORIENTATION_HPP_
+#include <com/sun/star/text/HoriOrientation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_TEXT_VERTORIENTATION_HPP_
+#include <com/sun/star/text/VertOrientation.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XMULTISERVICEFACTORY_HPP_
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLE_HPP_
+#include <com/sun/star/style/XStyle.hpp>
+#endif
+
+#include "xmlkywd.hxx"
+#include "i18nmap.hxx"
+#include "xmluconv.hxx"
+#ifndef _XMLOFF_PROPERTYHANDLER_FONTTYPES_HXX
+#include "fonthdl.hxx"
+#endif
+#ifndef _XMLOFF_FAMILIES_HXX
+#include "families.hxx"
+#endif
+
+
+#include "xmlnumi.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::style;
+using namespace ::com::sun::star::text;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::frame;
+
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE[] =
+ "SymbolTextDistance";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PARENT_NUMBERING[] =
+ "ParentNumbering";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_CHAR_STYLE_NAME[] =
+ "CharStyleName";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_CHAR[] ="BulletChar";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHIC_SIZE[] =
+ "GraphicSize";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_VERT_ORIENT[] ="VertOrient";
+
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_NUMBERINGTYPE[] = "NumberingType";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_PREFIX[] = "Prefix";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_SUFFIX[] = "Suffix";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_ADJUST[] = "Adjust";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_LEFT_MARGIN[] = "LeftMargin";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET[] =
+ "FirstLineOffset";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_BULLET_FONT[] = "BulletFont";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_GRAPHICURL[] = "GraphicURL";
+static sal_Char __READONLY_DATA XML_UNO_NAME_NRULE_START_WITH[] = "StartWith";
+
+// ---------------------------------------------------------------------
+
+class SvxXMLListLevelStyleContext_Impl;
+
+class SvxXMLListLevelStyleAttrContext_Impl : public SvXMLImportContext
+{
+ SvxXMLListLevelStyleContext_Impl& rListLevel;
+
+public:
+
+ SvxXMLListLevelStyleAttrContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList >& xAttrList,
+ SvxXMLListLevelStyleContext_Impl& rLLevel );
+ virtual ~SvxXMLListLevelStyleAttrContext_Impl();
+};
+
+// ---------------------------------------------------------------------
+
+enum SvxXMLTextListLevelStyleAttrTokens
+{
+ XML_TOK_TEXT_LEVEL_ATTR_LEVEL,
+ XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME,
+ XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR,
+ XML_TOK_TEXT_LEVEL_ATTR_HREF,
+ XML_TOK_TEXT_LEVEL_ATTR_TYPE,
+ XML_TOK_TEXT_LEVEL_ATTR_SHOW,
+ XML_TOK_TEXT_LEVEL_ATTR_ACTUATE,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX,
+ XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC,
+ XML_TOK_TEXT_LEVEL_ATTR_START_VALUE,
+ XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS,
+
+ XML_TOK_TEXT_LEVEL_ATTR_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aLevelAttrTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, sXML_level, XML_TOK_TEXT_LEVEL_ATTR_LEVEL },
+ { XML_NAMESPACE_TEXT, sXML_style_name, XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME },
+ { XML_NAMESPACE_TEXT, sXML_bullet_char, XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR },
+ { XML_NAMESPACE_XLINK, sXML_href, XML_TOK_TEXT_LEVEL_ATTR_HREF },
+ { XML_NAMESPACE_XLINK, sXML_type, XML_TOK_TEXT_LEVEL_ATTR_TYPE },
+ { XML_NAMESPACE_XLINK, sXML_show, XML_TOK_TEXT_LEVEL_ATTR_SHOW },
+ { XML_NAMESPACE_XLINK, sXML_actuate, XML_TOK_TEXT_LEVEL_ATTR_ACTUATE },
+
+ { XML_NAMESPACE_STYLE, sXML_num_format, XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT },
+ { XML_NAMESPACE_STYLE, sXML_num_prefix, XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX },
+ { XML_NAMESPACE_STYLE, sXML_num_suffix, XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX },
+ { XML_NAMESPACE_STYLE, sXML_num_letter_sync, XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC },
+ { XML_NAMESPACE_TEXT, sXML_start_value, XML_TOK_TEXT_LEVEL_ATTR_START_VALUE },
+ { XML_NAMESPACE_TEXT, sXML_display_levels, XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS },
+
+ XML_TOKEN_MAP_END
+};
+
+class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext
+{
+ friend class SvxXMLListLevelStyleAttrContext_Impl;
+
+ OUString sPrefix;
+ OUString sSuffix;
+ OUString sTextStyleName;
+ OUString sNumFormat;
+ OUString sNumLetterSync;
+ OUString sBulletFontName;
+ OUString sBulletFontStyleName;
+ OUString sImageURL;
+
+ sal_Int32 nLevel;
+ sal_Int32 nSpaceBefore;
+ sal_Int32 nMinLabelWidth;
+ sal_Int32 nMinLabelDist;
+ sal_Int32 nImageWidth;
+ sal_Int32 nImageHeight;
+ sal_Int16 nNumStartValue;
+ sal_Int16 nNumDisplayLevels;
+
+ sal_Int16 eAdjust;
+ sal_Int16 eBulletFontFamily;
+ sal_Int16 eBulletFontPitch;
+ rtl_TextEncoding eBulletFontEncoding;
+ sal_Int16 eImageVertOrient;
+
+ sal_Unicode cBullet;
+
+ sal_Bool bBullet : 1;
+ sal_Bool bImage : 1;
+ sal_Bool bNum : 1;
+
+ void SetSpaceBefore( sal_Int32 nSet ) { nSpaceBefore = nSet; }
+ void SetMinLabelWidth( sal_Int32 nSet ) { nMinLabelWidth = nSet; }
+ void SetMinLabelDist( sal_Int32 nSet ) { nMinLabelDist = nSet; }
+ void SetAdjust( sal_Int16 eSet ) { eAdjust = eSet; }
+
+ void SetBulletFontName( const OUString& rSet ) { sBulletFontName = rSet; }
+ void SetBulletFontStyleName( const OUString& rSet )
+ { sBulletFontStyleName = rSet; }
+ void SetBulletFontFamily( sal_Int16 eSet ) { eBulletFontFamily = eSet; }
+ void SetBulletFontPitch( sal_Int16 eSet ) { eBulletFontPitch = eSet; }
+ void SetBulletFontEncoding( rtl_TextEncoding eSet )
+ { eBulletFontEncoding = eSet; }
+
+ void SetImageWidth( sal_Int32 nSet ) { nImageWidth = nSet; }
+ void SetImageHeight( sal_Int32 nSet ) { nImageHeight = nSet; }
+ void SetImageVertOrient( sal_Int16 eSet )
+ { eImageVertOrient = eSet; }
+
+public:
+
+ SvxXMLListLevelStyleContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+ virtual ~SvxXMLListLevelStyleContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList );
+
+ sal_Int32 GetLevel() const { return nLevel; }
+ Sequence<beans::PropertyValue> GetProperties(
+ const SvI18NMap *pI18NMap=0 ) const;
+};
+
+SvxXMLListLevelStyleContext_Impl::SvxXMLListLevelStyleContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList ) :
+
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ sNumFormat( OUString::createFromAscii( "1" ) ),
+ nLevel( -1L ),
+ nSpaceBefore( 0L ),
+ nMinLabelWidth( 0L ),
+ nMinLabelDist( 0L ),
+ nImageWidth( 0L ),
+ nImageHeight( 0L ),
+ nNumStartValue( 1 ),
+ nNumDisplayLevels( 1 ),
+ eAdjust( HoriOrientation::LEFT ),
+ eBulletFontFamily( FAMILY_DONTKNOW ),
+ eBulletFontPitch( PITCH_DONTKNOW ),
+ eBulletFontEncoding( RTL_TEXTENCODING_DONTKNOW ),
+ cBullet( 0 ),
+ bNum( sal_False ),
+ bBullet( sal_False ),
+ bImage( sal_False )
+{
+ if( rLName.compareToAscii( sXML_list_level_style_number ) == 0 ||
+ rLName.compareToAscii( sXML_outline_level_style ) == 0 )
+ bNum = sal_True;
+ else if( rLName.compareToAscii( sXML_list_level_style_bullet ) == 0 )
+ bBullet = sal_True;
+ else if( rLName.compareToAscii( sXML_list_level_style_image ) == 0 )
+ bImage = sal_True;
+
+ SvXMLTokenMap aTokenMap( aLevelAttrTokenMap );
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TEXT_LEVEL_ATTR_LEVEL:
+ nLevel = rValue.toInt32();
+ if( nLevel >= 1L )
+ nLevel--;
+ else
+ nLevel = 0L;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_STYLE_NAME:
+ sTextStyleName = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_BULLET_CHAR:
+ if( rValue.getLength() > 0 )
+ cBullet = rValue[0];
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_HREF:
+ if( bImage )
+ sImageURL = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_TYPE:
+ case XML_TOK_TEXT_LEVEL_ATTR_SHOW:
+ case XML_TOK_TEXT_LEVEL_ATTR_ACTUATE:
+ // This properties will be ignored
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_FORMAT:
+ if( bNum )
+ sNumFormat = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_PREFIX:
+ sPrefix = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_SUFFIX:
+ sSuffix = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_NUM_LETTER_SYNC:
+ if( bNum )
+ sNumLetterSync = rValue;
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_START_VALUE:
+ if( bNum )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ nNumStartValue =
+ (nTmp < 1L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
+ : (sal_Int16)nTmp );
+ }
+ break;
+ case XML_TOK_TEXT_LEVEL_ATTR_DISPLAY_LEVELS:
+ if( bNum )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ nNumDisplayLevels =
+ (nTmp < 1L) ? 1 : ( (nTmp>SHRT_MAX) ? SHRT_MAX
+ : (sal_Int16)nTmp );
+ }
+ break;
+ }
+ }
+}
+
+SvxXMLListLevelStyleContext_Impl::~SvxXMLListLevelStyleContext_Impl()
+{
+}
+
+SvXMLImportContext *SvxXMLListLevelStyleContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix, const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext;
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ rLocalName.compareToAscii( sXML_properties ) == 0 )
+ {
+ pContext = new SvxXMLListLevelStyleAttrContext_Impl( GetImport(),
+ nPrefix,
+ rLocalName,
+ xAttrList,
+ *this );
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties(
+ const SvI18NMap *pI18NMap ) const
+{
+ sal_Int16 eType;
+
+ sal_Int32 nCount = 0L;
+ if( bBullet && 0 != cBullet )
+ {
+ eType = NumberingType::CHAR_SPECIAL;
+ nCount = 10L;
+ }
+ if( bImage && sImageURL.getLength() > 0L &&
+ nImageWidth > 0L && nImageHeight > 0L )
+ {
+ eType = NumberingType::BITMAP;
+ nCount = 11L;
+ }
+ if( bNum )
+ {
+ eType = SvxXMLListStyleContext::GetNumType( sNumFormat, sNumLetterSync,
+ NumberingType::ARABIC, sal_True );
+ nCount = 10L;
+ }
+
+ Sequence<beans::PropertyValue> aPropSeq( nCount );
+ if( nCount > 0 )
+ {
+ beans::PropertyValue *pProps = aPropSeq.getArray();
+ sal_Int32 nPos = 0L;
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_NUMBERINGTYPE );
+ pProps[nPos++].Value <<= (sal_Int16)eType ;
+
+ pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_PREFIX );
+ pProps[nPos++].Value <<= sPrefix;
+
+ pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_SUFFIX );
+ pProps[nPos++].Value <<= sSuffix;
+
+ pProps[nPos].Name = OUString::createFromAscii( XML_UNO_NAME_NRULE_ADJUST );
+ pProps[nPos++].Value <<= eAdjust;
+
+ sal_Int32 nLeftMargin = nSpaceBefore + nMinLabelWidth;
+ if( nLeftMargin < 0 )
+ nLeftMargin = 0;
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_LEFT_MARGIN );
+ pProps[nPos++].Value <<= (sal_Int32)nLeftMargin;
+
+ sal_Int32 nFirstLineOffset =
+ nMinLabelWidth <= nLeftMargin ? -nMinLabelWidth : -nLeftMargin;
+
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_FIRST_LINE_OFFSET );
+ pProps[nPos++].Value <<= (sal_Int32)nFirstLineOffset;
+
+ pProps[nPos].Name =
+ OUString::createFromAscii(XML_UNO_NAME_NRULE_SYMBOL_TEXT_DISTANCE);
+ pProps[nPos++].Value <<= (sal_Int16)nMinLabelDist;
+
+ OUString sStyleName = sTextStyleName;
+ if( sStyleName.getLength() && pI18NMap )
+ sStyleName = pI18NMap->Get( SFX_STYLE_FAMILY_CHAR, sStyleName );
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME );
+ pProps[nPos++].Value <<= sTextStyleName;
+
+ if( bBullet )
+ {
+ OUStringBuffer sTmp(1);
+ sTmp.append( cBullet );
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_CHAR );
+ pProps[nPos++].Value <<= sTmp.makeStringAndClear();
+
+ awt::FontDescriptor aFDesc;
+ aFDesc.Name = sBulletFontName;
+ if( sBulletFontName.getLength() )
+ {
+ aFDesc.StyleName = sBulletFontStyleName;
+ aFDesc.Family = eBulletFontFamily;
+ aFDesc.Pitch = eBulletFontPitch;
+ aFDesc.CharSet = eBulletFontEncoding;
+ aFDesc.Weight = WEIGHT_DONTKNOW;
+ //aFDesc.Transparant = sal_True;
+ }
+
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_FONT );
+ pProps[nPos++].Value <<= aFDesc;
+ }
+
+ if( bImage )
+ {
+ String sURL( sImageURL );
+ INetURLObject::RelToAbs( sURL );
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_GRAPHICURL );
+ pProps[nPos++].Value <<= OUString(sURL);
+
+ awt::Size aSize( nImageWidth, nImageHeight );
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_GRAPHIC_SIZE );
+ pProps[nPos++].Value <<= aSize;
+
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_VERT_ORIENT );
+ pProps[nPos++].Value <<= (sal_Int16)eImageVertOrient;
+ }
+
+ if( bNum )
+ {
+ pProps[nPos].Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_START_WITH );
+ pProps[nPos++].Value <<= (sal_Int16)nNumStartValue;
+
+ pProps[nPos].Name =
+ OUString::createFromAscii(XML_UNO_NAME_NRULE_PARENT_NUMBERING);
+ pProps[nPos++].Value <<= (sal_Int16)nNumDisplayLevels;
+ }
+ DBG_ASSERT( nPos == nCount, "array under/overflow" );
+ }
+
+ return aPropSeq;
+}
+
+// ---------------------------------------------------------------------
+
+enum SvxXMLStyleAttributesAttrTokens
+{
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT,
+
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aStyleAttributesAttrTokenMap[] =
+{
+ { XML_NAMESPACE_TEXT, sXML_space_before,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE },
+ { XML_NAMESPACE_TEXT, sXML_min_label_width,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH },
+ { XML_NAMESPACE_TEXT, sXML_min_label_distance,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST },
+ { XML_NAMESPACE_FO, sXML_text_align,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN },
+ { XML_NAMESPACE_FO, sXML_font_family,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY },
+ { XML_NAMESPACE_STYLE, sXML_font_family_generic,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC },
+ { XML_NAMESPACE_STYLE, sXML_font_style_name,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME },
+ { XML_NAMESPACE_STYLE, sXML_font_pitch,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH },
+ { XML_NAMESPACE_STYLE, sXML_font_charset,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET },
+ { XML_NAMESPACE_STYLE, sXML_vertical_pos,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS },
+ { XML_NAMESPACE_STYLE, sXML_vertical_rel,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL },
+ { XML_NAMESPACE_FO, sXML_width,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH },
+ { XML_NAMESPACE_FO, sXML_height,
+ XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT },
+
+ XML_TOKEN_MAP_END
+};
+SvxXMLListLevelStyleAttrContext_Impl::SvxXMLListLevelStyleAttrContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ SvxXMLListLevelStyleContext_Impl& rLLevel ) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ rListLevel( rLLevel )
+{
+ SvXMLTokenMap aTokenMap( aStyleAttributesAttrTokenMap );
+ SvXMLUnitConverter aUnitConv( MAP_100TH_MM, MAP_100TH_MM);
+
+ OUString sFontFamily, sFontStyleName, sFontFamilyGeneric,
+ sFontPitch, sFontCharset;
+ OUString sVerticalPos, sVerticalRel;
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_SPACE_BEFORE:
+ if( aUnitConv.convertMeasure( nVal, rValue, 0, USHRT_MAX ) )
+ rListLevel.SetSpaceBefore( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_WIDTH:
+ if( aUnitConv.convertMeasure( nVal, rValue, 0, SHRT_MAX ) )
+ rListLevel.SetMinLabelWidth( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_MIN_LABEL_DIST:
+ if( aUnitConv.convertMeasure( nVal, rValue, 0, USHRT_MAX ) )
+ rListLevel.SetMinLabelDist( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_TEXT_ALIGN:
+ if( rValue.getLength() )
+ {
+ sal_Int16 eAdjust = HoriOrientation::LEFT;
+ if( rValue.compareToAscii( sXML_center ) == 0 )
+ eAdjust = HoriOrientation::CENTER;
+ else if( rValue.compareToAscii( sXML_end ) == 0 )
+ eAdjust = HoriOrientation::RIGHT;
+ rListLevel.SetAdjust( eAdjust );
+ }
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY:
+ sFontFamily = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_FAMILY_GENERIC:
+ sFontFamilyGeneric = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_STYLENAME:
+ sFontStyleName = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_PITCH:
+ sFontPitch = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_FONT_CHARSET:
+ sFontCharset = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_POS:
+ sVerticalPos = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_VERTICAL_REL:
+ sVerticalRel = rValue;
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_WIDTH:
+ if( aUnitConv.convertMeasure( nVal, rValue, 0, LONG_MAX ) )
+ rListLevel.SetImageWidth( nVal );
+ break;
+ case XML_TOK_STYLE_ATTRIBUTES_ATTR_HEIGHT:
+ if( aUnitConv.convertMeasure( nVal, rValue, 0, LONG_MAX ) )
+ rListLevel.SetImageHeight( nVal );
+ break;
+ }
+ }
+
+ if( sFontFamily.getLength() )
+ {
+ String sEmpty;
+ Any aAny;
+
+ XMLFontFamilyNamePropHdl aFamilyNameHdl;
+ if( aFamilyNameHdl.importXML( sFontFamily, aAny, aUnitConv ) )
+ {
+ OUString sTmp;
+ aAny >>= sTmp;
+ rListLevel.SetBulletFontName( sTmp);
+ }
+
+ XMLFontFamilyPropHdl aFamilyHdl;
+ if( sFontFamilyGeneric.getLength() &&
+ aFamilyHdl.importXML( sFontFamilyGeneric, aAny, aUnitConv ) )
+ {
+ sal_Int16 nTmp;
+ aAny >>= nTmp;
+ rListLevel.SetBulletFontFamily( nTmp );
+ }
+
+ if( sFontStyleName.getLength() )
+ rListLevel.SetBulletFontStyleName( sFontStyleName );
+
+ XMLFontPitchPropHdl aPitchHdl;
+ if( sFontPitch.getLength() &&
+ aPitchHdl.importXML( sFontPitch, aAny, aUnitConv ) )
+ {
+ sal_Int16 nTmp;
+ aAny >>= nTmp;
+ rListLevel.SetBulletFontPitch( nTmp );
+ }
+
+ XMLFontEncodingPropHdl aEncHdl;
+ if( sFontCharset.getLength() &&
+ aEncHdl.importXML( sFontCharset, aAny, aUnitConv ) )
+ {
+ sal_Int16 nTmp;
+ aAny >>= nTmp;
+ rListLevel.SetBulletFontEncoding( nTmp );
+ }
+ }
+
+ sal_Int16 eVertOrient = VertOrientation::LINE_CENTER;
+ if( sVerticalPos.getLength() )
+ {
+ if( sVerticalPos.compareToAscii( sXML_top ) == 0 )
+ eVertOrient = VertOrientation::LINE_TOP;
+ else if( sVerticalPos.compareToAscii( sXML_bottom ) == 0 )
+ eVertOrient = VertOrientation::LINE_BOTTOM;
+ }
+ if( sVerticalRel.getLength() )
+ {
+ if( sVerticalRel.compareToAscii( sXML_baseline ) == 0 )
+ {
+ // TOP and BOTTOM are exchanged for a baseline relation
+ switch( eVertOrient )
+ {
+ case VertOrientation::LINE_TOP:
+ eVertOrient = VertOrientation::BOTTOM;
+ break;
+ case VertOrientation::LINE_CENTER:
+ eVertOrient = VertOrientation::CENTER;
+ break;
+ case VertOrientation::LINE_BOTTOM:
+ eVertOrient = VertOrientation::TOP;
+ break;
+ }
+ }
+ else if( sVerticalRel.compareToAscii( sXML_char ) == 0 )
+ {
+ switch( eVertOrient )
+ {
+ case VertOrientation::LINE_TOP:
+ eVertOrient = VertOrientation::CHAR_TOP;
+ break;
+ case VertOrientation::LINE_CENTER:
+ eVertOrient = VertOrientation::CHAR_CENTER;
+ break;
+ case VertOrientation::LINE_BOTTOM:
+ eVertOrient = VertOrientation::CHAR_BOTTOM;
+ break;
+ }
+ }
+ }
+ rListLevel.SetImageVertOrient( eVertOrient );
+}
+
+SvxXMLListLevelStyleAttrContext_Impl::~SvxXMLListLevelStyleAttrContext_Impl()
+{
+}
+
+// ---------------------------------------------------------------------
+
+typedef SvxXMLListLevelStyleContext_Impl *SvxXMLListLevelStyleContext_ImplPtr;
+SV_DECL_PTRARR( SvxXMLListStyle_Impl, SvxXMLListLevelStyleContext_ImplPtr,
+ 10, 5 )
+
+void SvxXMLListStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ if( XML_NAMESPACE_TEXT == nPrefixKey &&
+ rLocalName.compareToAscii( sXML_consecutive_numbering ) == 0 )
+ {
+ bConsecutive = rValue.compareToAscii( sXML_true ) == 0;
+ }
+ else
+ {
+ SvXMLStyleContext::SetAttribute( nPrefixKey, rLocalName, rValue );
+ }
+}
+
+
+SvxXMLListStyleContext::SvxXMLListStyleContext( SvXMLImport& rImport,
+ sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const Reference< xml::sax::XAttributeList > & xAttrList,
+ sal_Bool bOutl ) :
+ SvXMLStyleContext( rImport, nPrfx, rLName, xAttrList ),
+ pLevelStyles( 0 ),
+ nLevels( 0 ),
+ bConsecutive( sal_False ),
+ bOutline( bOutl ),
+ sIsPhysical( RTL_CONSTASCII_USTRINGPARAM( "IsPhysical" ) ),
+ sNumberingRules( RTL_CONSTASCII_USTRINGPARAM( "NumberingRules" ) ),
+ sName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ),
+ sIsContinuousNumbering( RTL_CONSTASCII_USTRINGPARAM( "IsContinuousNumbering" ) )
+{
+ SetFamily( bOutline ? XML_STYLE_FAMILY_TEXT_OUTLINE :
+ XML_STYLE_FAMILY_TEXT_LIST );
+}
+
+SvxXMLListStyleContext::~SvxXMLListStyleContext()
+{
+ if( pLevelStyles )
+ {
+ while( pLevelStyles->Count() )
+ {
+ sal_uInt16 n = pLevelStyles->Count() - 1;
+ SvxXMLListLevelStyleContext_Impl *pStyle = (*pLevelStyles)[n];
+ pLevelStyles->Remove( n, 1 );
+ pStyle->ReleaseRef();
+ }
+ }
+
+ delete pLevelStyles;
+}
+
+TYPEINIT1( SvxXMLListStyleContext, SvXMLStyleContext );
+
+SvXMLImportContext *SvxXMLListStyleContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_TEXT == nPrefix &&
+ ( bOutline
+ ? rLocalName.compareToAscii( sXML_outline_level_style ) == 0
+ : ( rLocalName.compareToAscii(sXML_list_level_style_number) == 0 ||
+ rLocalName.compareToAscii(sXML_list_level_style_bullet) == 0 ||
+ rLocalName.compareToAscii(sXML_list_level_style_image) == 0) ) )
+ {
+ SvxXMLListLevelStyleContext_Impl *pLevelStyle =
+ new SvxXMLListLevelStyleContext_Impl( GetImport(), nPrefix,
+ rLocalName, xAttrList );
+ if( !pLevelStyles )
+ pLevelStyles = new SvxXMLListStyle_Impl;
+ pLevelStyles->Insert( pLevelStyle, pLevelStyles->Count() );
+ pLevelStyle->AddRef();
+
+ pContext = pLevelStyle;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SvxXMLListStyleContext::FillUnoNumRule(
+ const Reference< container::XIndexReplace > & rNumRule,
+ const SvI18NMap *pI18NMap ) const
+{
+ if( pLevelStyles )
+ {
+ sal_uInt16 nCount = pLevelStyles->Count();
+ sal_Int32 nLevels = rNumRule->getCount();
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ const SvxXMLListLevelStyleContext_Impl *pLevelStyle =
+ (*pLevelStyles)[i];
+ sal_Int32 nLevel = pLevelStyle->GetLevel();
+ if( nLevel >= 0 && nLevel < nLevels )
+ {
+ Sequence<beans::PropertyValue> aProps =
+ pLevelStyle->GetProperties( pI18NMap );
+ Any aAny;
+ aAny <<= aProps;
+ rNumRule->replaceByIndex( nLevel, aAny );
+ }
+ }
+ }
+
+ Reference < XPropertySet > xPropSet( rNumRule, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo;
+ if (xPropSet.is())
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+ if( xPropSetInfo.is() &&
+ xPropSetInfo->hasPropertyByName( sIsContinuousNumbering ) )
+ {
+ Any aAny;
+ sal_Bool bTmp = bConsecutive;
+ aAny.setValue( &bTmp, ::getBooleanCppuType() );
+ xPropSet->setPropertyValue( sIsContinuousNumbering, aAny );
+ }
+}
+
+void SvxXMLListStyleContext::CreateAndInsertLate( sal_Bool bOverwrite )
+{
+ if( bOutline )
+ {
+ if( bOverwrite )
+ {
+ const Reference< XIndexReplace >& rNumRule =
+ GetImport().GetTextImport()->GetChapterNumbering();
+ if( rNumRule.is() )
+ FillUnoNumRule( rNumRule, 0 );
+ }
+ }
+ else
+ {
+ Reference < XStyle > xStyle;
+ const OUString& rName = GetName();
+ if( 0 == rName.getLength() )
+ {
+ SetValid( sal_False );
+ return;
+ }
+
+ const Reference < XNameContainer >& rNumStyles =
+ GetImport().GetTextImport()->GetNumberingStyles();
+ if( !rNumStyles.is() )
+ {
+ SetValid( sal_False );
+ return;
+ }
+
+ sal_Bool bNew = sal_False;
+ if( rNumStyles->hasByName( rName ) )
+ {
+ Any aAny = rNumStyles->getByName( rName );
+ aAny >>= xStyle;
+ }
+ else
+ {
+ Reference< XMultiServiceFactory > xFactory( GetImport().GetModel(),
+ UNO_QUERY );
+ DBG_ASSERT( xFactory.is(), "no factory" );
+ if( !xFactory.is() )
+ return;
+
+ Reference < XInterface > xIfc = xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.NumberingStyle")) );
+ if( !xIfc.is() )
+ return;
+ Reference < XStyle > xTmp( xIfc, UNO_QUERY );
+ xStyle = xTmp;
+ if( !xStyle.is() )
+ return;
+
+ Any aAny;
+ aAny <<= xStyle;
+ rNumStyles->insertByName( rName, aAny );
+ bNew = sal_True;
+ }
+
+ Reference < XPropertySet > xPropSet( xStyle, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo =
+ xPropSet->getPropertySetInfo();
+ if( !bNew && xPropSetInfo->hasPropertyByName( sIsPhysical ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( sIsPhysical );
+ bNew = !*(sal_Bool *)aAny.getValue();
+ }
+
+ // for styles the real name is the style name
+ sRealName = rName;
+
+ Any aAny = xPropSet->getPropertyValue( sNumberingRules );
+ Reference<XIndexReplace> xNumRule;
+ aAny >>= xNumRule;
+ nLevels = xNumRule->getCount();
+ if( bOverwrite || bNew )
+ {
+ FillUnoNumRule( xNumRule, 0 );
+ aAny <<= xNumRule;
+ xPropSet->setPropertyValue( sNumberingRules, aAny );
+ }
+ else
+ {
+ SetValid( sal_False );
+ }
+
+ SetNew( bNew );
+ }
+}
+
+void SvxXMLListStyleContext::CreateAndInsertAuto() const
+{
+ DBG_ASSERT( !bOutline, "Outlines cannot be inserted here" );
+ DBG_ASSERT( !bUsed, "Numbering Rule is existing already" );
+
+ const OUString& rName = GetName();
+ if( bOutline || bUsed || 0 == rName.getLength() )
+ {
+ ((SvxXMLListStyleContext *)this)->SetValid( sal_False );
+ return;
+ }
+
+ Reference<XIndexReplace> xNumRule = CreateNumRule(
+ ((SvxXMLListStyleContext *)this)->sRealName, GetImport().GetModel() );
+ DBG_ASSERT( sRealName.getLength(), "no internal name" );
+ ((SvxXMLListStyleContext *)this)->nLevels = xNumRule->getCount();
+
+ FillUnoNumRule( xNumRule, 0 );
+}
+
+Reference < XIndexReplace > SvxXMLListStyleContext::CreateNumRule(
+ OUString& rRealName,
+ const Reference < XModel > & rModel )
+{
+ Reference<XIndexReplace> xNumRule;
+
+ Reference< XMultiServiceFactory > xFactory( rModel, UNO_QUERY );
+ DBG_ASSERT( xFactory.is(), "no factory" );
+ if( !xFactory.is() )
+ return xNumRule;
+
+ Reference < XInterface > xIfc = xFactory->createInstance(OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.NumberingRule")) );
+ if( !xIfc.is() )
+ return xNumRule;
+
+ xNumRule = Reference<XIndexReplace>( xIfc, UNO_QUERY );
+ DBG_ASSERT( xNumRule.is(), "go no numbering rule" );
+ if( !xNumRule.is() )
+ return xNumRule;
+
+ Reference < XPropertySet > xPropSet( xNumRule, UNO_QUERY );
+ Reference< XPropertySetInfo > xPropSetInfo;
+ if (xPropSet.is())
+ xPropSetInfo = xPropSet->getPropertySetInfo();
+ const OUString sName( RTL_CONSTASCII_USTRINGPARAM( "Name" ) );
+ if( xPropSetInfo.is() && xPropSetInfo->hasPropertyByName( sName ) )
+ {
+ Any aAny = xPropSet->getPropertyValue( sName );
+ aAny >>= rRealName;
+ }
+
+ return xNumRule;
+}
+
+void SvxXMLListStyleContext::SetDefaultStyle(
+ const Reference < XIndexReplace > & rNumRule,
+ sal_Int16 nLevel,
+ sal_Bool bOrdered )
+{
+ Sequence<beans::PropertyValue> aPropSeq( bOrdered ? 1 : 4 );
+ beans::PropertyValue *pProps = aPropSeq.getArray();
+
+ pProps->Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_NUMBERINGTYPE );
+ (pProps++)->Value <<= (sal_Int16)(bOrdered ? NumberingType::ARABIC
+ : NumberingType::CHAR_SPECIAL );
+ if( !bOrdered )
+ {
+ // TODO: Bullet-Font
+ //aNumFmt.SetBulletFont( &SwNumRule::GetDefBulletFont() );
+ awt::FontDescriptor aFDesc;
+ aFDesc.Name = OUString(
+#if defined UNX
+ RTL_CONSTASCII_USTRINGPARAM( "starbats" )
+#else
+ RTL_CONSTASCII_USTRINGPARAM( "StarBats" )
+#endif
+ );
+ aFDesc.Family = FAMILY_DONTKNOW ;
+ aFDesc.Pitch = PITCH_DONTKNOW ;
+ aFDesc.CharSet = RTL_TEXTENCODING_SYMBOL ;
+ aFDesc.Weight = WEIGHT_DONTKNOW;
+ //aFDesc.Transparant = sal_True;
+ pProps->Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_FONT );
+ (pProps++)->Value <<= aFDesc;
+
+ OUStringBuffer sTmp(1);
+ sTmp.append( (sal_Unicode)(0xF000 + 149) );
+ pProps->Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_BULLET_CHAR );
+ (pProps++)->Value <<= sTmp.makeStringAndClear();
+ pProps->Name =
+ OUString::createFromAscii( XML_UNO_NAME_NRULE_CHAR_STYLE_NAME );
+ (pProps++)->Value <<=
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Numbering Symbols" ) );
+ }
+
+ Any aAny;
+ aAny <<= aPropSeq;
+ rNumRule->replaceByIndex( nLevel, aAny );
+}
+
+sal_Int16 SvxXMLListStyleContext::GetNumType( const OUString& rNumFmt,
+ const OUString& rLetterSync,
+ sal_Int16 eDflt,
+ sal_Bool bNumberNone )
+{
+ sal_Int16 eValue = eDflt;
+ sal_Int32 nLen = rNumFmt.getLength();
+
+ if( 1 == nLen )
+ {
+ switch( rNumFmt[0] )
+ {
+ case sal_Unicode('1'): eValue = NumberingType::ARABIC; break;
+ case sal_Unicode('a'): eValue = NumberingType::CHARS_LOWER_LETTER; break;
+ case sal_Unicode('A'): eValue = NumberingType::CHARS_UPPER_LETTER; break;
+ case sal_Unicode('i'): eValue = NumberingType::ROMAN_LOWER; break;
+ case sal_Unicode('I'): eValue = NumberingType::ROMAN_UPPER; break;
+ }
+ if( rLetterSync.compareToAscii( sXML_true ) == 0 )
+ {
+ switch(eValue )
+ {
+ case NumberingType::CHARS_LOWER_LETTER:
+ eValue = NumberingType::CHARS_LOWER_LETTER_N;
+ break;
+ case NumberingType::CHARS_UPPER_LETTER:
+ eValue = NumberingType::CHARS_UPPER_LETTER_N;
+ break;
+ }
+ }
+ }
+ else if( 0 == nLen )
+ {
+ if( bNumberNone )
+ eValue = NumberingType::NUMBER_NONE;
+ }
+
+ return eValue;
+}
+
+
diff --git a/xmloff/source/style/xmlprcon.cxx b/xmloff/source/style/xmlprcon.cxx
new file mode 100644
index 000000000000..22603d56b684
--- /dev/null
+++ b/xmloff/source/style/xmlprcon.cxx
@@ -0,0 +1,128 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlprcon.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+
+#ifndef _XMLOFF_XMLPROPERTYSETCONTEXT_HXX
+#include "xmlprcon.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::std;
+
+SvXMLPropertySetContext::SvXMLPropertySetContext( SvXMLImport& rImp, USHORT nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ vector< XMLPropertyState > &rProps,
+ const UniReference < SvXMLImportPropertyMapper > &rMap ):
+ SvXMLImportContext( rImp, nPrfx, rLName ),
+ rProperties( rProps ),
+ xMapper ( rMap )
+
+{
+ xMapper->importXML( rProperties, xAttrList,
+ GetImport().GetMM100UnitConverter(),
+ GetImport().GetNamespaceMap() );
+}
+
+SvXMLPropertySetContext::~SvXMLPropertySetContext()
+{
+}
+
+SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( USHORT nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList )
+{
+ UniReference< XMLPropertySetMapper > aSetMapper( xMapper->getPropertySetMapper() );
+ sal_Int32 nEntryIndex = aSetMapper->GetEntryIndex( nPrefix, rLocalName );
+
+ if( ( nEntryIndex != -1 ) &&
+ ( 0 != ( aSetMapper->GetEntryFlags( nEntryIndex ) & MID_FLAG_ELEMENT_ITEM_IMPORT ) ) )
+ {
+ XMLPropertyState aProp( nEntryIndex ); // See comment in the body of CreateChildContext
+ return CreateChildContext( nPrefix, rLocalName, xAttrList,
+ rProperties, aProp /*rItemSet, *pEntry*/ );
+ }
+ else
+ {
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+}
+
+/** This method is called from this instance implementation of
+ CreateChildContext if the element matches an entry in the
+ SvXMLImportItemMapper with the mid flag MID_FLAG_ELEMENT
+*/
+SvXMLImportContext *SvXMLPropertySetContext::CreateChildContext( USHORT nPrefix,
+ const NAMESPACE_RTL(OUString)& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList >& xAttrList,
+ ::std::vector< XMLPropertyState > &rProperties,
+ const XMLPropertyState& rProp ) // instead of a SvXMLItemMapEntry I use now a XMLPropertyState. Is that reasonable, I'm not sure ????
+ //const SvXMLItemMapEntry& rEntry,
+{
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+
diff --git a/xmloff/source/style/xmlprhdl.cxx b/xmloff/source/style/xmlprhdl.cxx
new file mode 100644
index 000000000000..7d4fbe4afe5c
--- /dev/null
+++ b/xmloff/source/style/xmlprhdl.cxx
@@ -0,0 +1,78 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlprhdl.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include <xmlprhdl.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+XMLPropertyHandler::~XMLPropertyHandler()
+{
+ // does nothing
+}
+
+sal_Bool XMLPropertyHandler::equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const
+{
+ return (r1 == r2);
+}
diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx
new file mode 100644
index 000000000000..93e30269b000
--- /dev/null
+++ b/xmloff/source/style/xmlprmap.cxx
@@ -0,0 +1,444 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlprmap.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+
+#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX
+#include "xmlprhdl.hxx"
+#endif
+
+#ifndef _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
+#include "xmlbahdl.hxx"
+#endif
+
+#ifndef _XMLOFF_PROPERTYSETMAPPER_HXX
+#include "xmlprmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLTYPES_HXX
+#include "xmltypes.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
+#include <com/sun/star/beans/XPropertySet.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSTATE_HPP_
+#include <com/sun/star/beans/XPropertyState.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_UNO_ANY_HXX_
+#include <com/sun/star/uno/Any.hxx>
+#endif
+
+using namespace ::std;
+using namespace ::rtl;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::beans;
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Ctor
+//
+XMLPropertySetMapper::XMLPropertySetMapper(
+ const XMLPropertyMapEntry* pEntries,
+ const UniReference< XMLPropertyHandlerFactory >& rFactory )
+: mpEntries ( pEntries ),
+ mnEntryCount ( 0 ),
+ maHdlFactory ( rFactory )
+{
+ if( mpEntries )
+ {
+ const XMLPropertyMapEntry* pIter = mpEntries;
+
+ // count entries
+ while( pIter->msApiName ) // the last element of the array contains { NULL, ??, ?? }
+ {
+ mnEntryCount++;
+ pIter++;
+ }
+
+ // fill Sequence of XML-names and PropertyHandler
+ maXMLNames.realloc( mnEntryCount );
+ maApiNames.realloc( mnEntryCount );
+ pIter = mpEntries;
+ for( sal_Int32 i=0; i < mnEntryCount; i++ )
+ {
+ // create XML-name
+ maXMLNames[ i ] = OUString::createFromAscii( pIter->msXMLName );
+ maApiNames[ i ] = OUString::createFromAscii( pIter->msApiName );
+
+ // create PropertyHandler for property
+ const XMLPropertyHandler* pHdl =
+ maHdlFactory->GetPropertyHandler(
+ pIter->mnType & MID_FLAG_MASK );
+
+ DBG_ASSERT( pHdl, "Unknown XML property type handler!" );
+ maPropertyHandler.push_back( pHdl );
+
+ pIter++;
+ }
+ }
+}
+
+XMLPropertySetMapper::~XMLPropertySetMapper()
+{
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Take all properties of the XPropertySet which are also found in the
+// XMLPropertyMapEntry-array and which are not set to their default-value,
+// if a state is available.
+//
+// After that I call the method 'ContextFilter'.
+//
+vector< XMLPropertyState > XMLPropertySetMapper::Filter(
+ const Reference< XPropertySet > xPropSet ) const
+{
+ vector< XMLPropertyState > aPropStateArray;
+
+ // Retrieve XPropertySetInfo and XPropertyState
+ Reference< XPropertySetInfo > xInfo( xPropSet->getPropertySetInfo() );
+ Reference< XPropertyState > xPropState( xPropSet, UNO_QUERY );
+
+ if( mpEntries && xInfo.is() )
+ {
+ const XMLPropertyMapEntry* pIter = mpEntries;
+ sal_Int32 nIndex=0;
+
+ sal_Int32 nCount = 0;
+ while( (pIter++)->msApiName )
+ nCount++;
+ pIter = mpEntries;
+
+
+ if( xPropState.is() )
+ {
+ Sequence<OUString> aApiNames( nCount );
+ Sequence<sal_uInt32> aIndexes( nCount );
+ OUString *pNames = aApiNames.getArray();
+ sal_uInt32 *pIndexes = aIndexes.getArray();
+ nCount = 0;
+ while( pIter->msApiName ) // the last element of the array contains { NULL, ??, ?? }
+ {
+ // Does the PropertySet contain name of mpEntries-array ?
+ if( xInfo->hasPropertyByName( maApiNames[ nIndex ] ) )
+ {
+ pNames[nCount] = maApiNames[ nIndex ];
+ pIndexes[nCount] = nIndex;
+ nCount++;
+ }
+
+ nIndex++;
+ pIter++;
+ }
+
+ aApiNames.realloc( nCount );
+ aIndexes.realloc( nCount );
+
+ Sequence < PropertyState > aStates = xPropState->getPropertyStates( aApiNames );
+
+ const PropertyState *pStates = aStates.getArray();
+ for( sal_Int32 i = 0; i < nCount; i++ )
+ {
+ if( pStates[i] == PropertyState_DIRECT_VALUE )
+ {
+ // The value is stored in the PropertySet itself, add to list.
+ XMLPropertyState aNewProperty( pIndexes[i],
+ xPropSet->getPropertyValue(
+ aApiNames[i] ) );
+ aPropStateArray.push_back( aNewProperty );
+ }
+ }
+ }
+ else
+ {
+ while( pIter->msApiName ) // the last element of the array contains { NULL, ??, ?? }
+ {
+ // Does the PropertySet contain name of mpEntries-array ?
+ if( xInfo->hasPropertyByName( maApiNames[ nIndex ] ) )
+ {
+ // If there isn't a XPropertyState we can't filter by its state
+ if( !xPropState.is() || xPropState->getPropertyState( maApiNames[ nIndex ] ) == PropertyState_DIRECT_VALUE )
+ {
+ // The value is stored in the PropertySet itself, add to list.
+ XMLPropertyState aNewProperty( nIndex,
+ xPropSet->getPropertyValue(
+ maApiNames[ nIndex ] ) );
+ aPropStateArray.push_back( aNewProperty );
+ }
+ }
+
+ nIndex++;
+ pIter++;
+ }
+ }
+
+ // Call centext-filter
+ ContextFilter( aPropStateArray, xPropSet );
+ }
+
+ return aPropStateArray;
+}
+
+void XMLPropertySetMapper::ContextFilter(
+ vector< XMLPropertyState >& rProperties,
+ Reference< XPropertySet > rPropSet ) const
+{
+ // Derived class could implement this.
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Compares two Sequences of XMLPropertyState:
+// 1.Number of elements equal ?
+// 2.Index of each element equal ? (So I know whether the propertynames are the same)
+// 3.Value of each element equal ?
+//
+sal_Bool XMLPropertySetMapper::Equals(
+ const vector< XMLPropertyState >& aProperties1,
+ const vector< XMLPropertyState >& aProperties2 ) const
+{
+ sal_Bool bRet = sal_True;
+ sal_Int32 nCount = aProperties1.size();
+
+ if( nCount == aProperties2.size() )
+ {
+ sal_Int32 nIndex = 0;
+ while( bRet && nIndex < nCount )
+ {
+ const XMLPropertyState& rProp1 = aProperties1[ nIndex ];
+ const XMLPropertyState& rProp2 = aProperties2[ nIndex ];
+
+ // Compare index. If equal, compare value
+ if( rProp1.mnIndex == rProp2.mnIndex )
+ {
+ if( rProp1.mnIndex != -1 )
+ {
+ // Now compare values
+ if( ( mpEntries[rProp1.mnIndex].mnType &
+ XML_TYPE_BUILDIN_CMP ) != 0 )
+ // simple type ( binary compare )
+ bRet = ( rProp1.maValue == rProp2.maValue );
+ else
+ // complex type ( ask for compare-function )
+ bRet = maPropertyHandler[ rProp1.mnIndex ]->equals(
+ rProp1.maValue, rProp2.maValue );
+ }
+ }
+ else
+ bRet = sal_False;
+
+ nIndex++;
+ }
+ }
+ else
+ bRet = sal_False;
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Retrieves a PropertyHandler for that property wich placed at nIndex in
+// the XMLPropertyMapEntry-array
+//
+const XMLPropertyHandler* XMLPropertySetMapper::GetPropertyHandler(
+ sal_Int32 nIndex ) const
+{
+ nIndex &= MID_FLAG_MASK;
+
+ const XMLPropertyHandler* pRet = NULL;
+
+ if( maPropertyHandler.size() > nIndex )
+ pRet = (const XMLPropertyHandler*)maPropertyHandler[ nIndex ];
+
+ return pRet;
+}
+
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Export a Property
+//
+sal_Bool XMLPropertySetMapper::exportXML(
+ OUString& rStrExpValue,
+ const XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ const XMLPropertyHandler* pHdl = GetPropertyHandler( rProperty.mnIndex );
+
+ DBG_ASSERT( pHdl, "Unknown XML Type!" );
+ if( pHdl )
+ bRet = pHdl->exportXML( rStrExpValue, rProperty.maValue,
+ rUnitConverter );
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Import a Property
+//
+sal_Bool XMLPropertySetMapper::importXML(
+ const OUString& rStrImpValue,
+ XMLPropertyState& rProperty,
+ const SvXMLUnitConverter& rUnitConverter ) const
+{
+ sal_Bool bRet = sal_False;
+
+ const XMLPropertyHandler* pHdl = GetPropertyHandler( rProperty.mnIndex );
+
+ if( pHdl )
+ bRet = pHdl->importXML( rStrImpValue, rProperty.maValue,
+ rUnitConverter );
+
+ return bRet;
+}
+
+///////////////////////////////////////////////////////////////////////////
+//
+// Search for the given name and the namespace in the list and return
+// the index of the entry
+// If there is no matching entry the method returns -1
+//
+const sal_Int32 XMLPropertySetMapper::GetEntryIndex(
+ sal_uInt16 nNamespace,
+ const OUString& rStrName,
+ sal_Int32 nStartAt /* = -1 */ ) const
+{
+ sal_Int32 nEntries = maXMLNames.getLength();
+ sal_Int32 nIndex= nStartAt == - 1? 0 : nStartAt+1;
+ BOOL bFound = FALSE;
+
+ do
+ {
+ if( mpEntries[nIndex].mnNameSpace == nNamespace &&
+ rStrName.equals( maXMLNames[nIndex] ))
+ bFound = TRUE;
+ else
+ nIndex++;
+
+ } while( nIndex<nEntries && !bFound );
+
+ if( !bFound )
+ nIndex = -1;
+
+ return nIndex;
+}
+
+sal_Bool XMLPropertySetMapper::FillPropertySet(
+ const vector< XMLPropertyState >& aProperties,
+ const Reference<
+ XPropertySet > rPropSet ) const
+{
+ sal_Bool bSet = sal_False;
+ Reference< XPropertySetInfo > xInfo = rPropSet->getPropertySetInfo();
+
+ sal_Int32 nCount = aProperties.size();
+ for( sal_Int32 i=0; i < nCount; i++ )
+ {
+ const XMLPropertyState& rProp = aProperties[i];
+ sal_Int32 nIdx = rProp.mnIndex;
+ if( -1 == nIdx )
+ continue;
+ const OUString& rPropName = maApiNames[nIdx];
+ if( xInfo->hasPropertyByName( rPropName ) )
+ {
+ try
+ {
+ rPropSet->setPropertyValue( rPropName, rProp.maValue );
+ bSet = sal_True;
+ }
+ catch(...)
+ {
+ }
+ }
+ }
+
+ return bSet;
+}
+
+/** searches for an entry that matches the given api name, namespace and local name or -1 if nothing found */
+sal_Int32 XMLPropertySetMapper::FindEntryIndex( sal_Char* sApiName, sal_uInt16 nNameSpace, sal_Char* sXMLName ) const
+{
+ const XMLPropertyMapEntry* pEntries = mpEntries;
+ sal_Int32 nIndex = 0;
+
+ while( pEntries && pEntries->msApiName )
+ {
+ if( pEntries->mnNameSpace == nNameSpace &&
+ (strcmp( pEntries->msApiName, sApiName ) == 0) &&
+ (strcmp( pEntries->msXMLName, sXMLName ) == 0))
+ return nIndex;
+
+ nIndex++;
+ pEntries++;
+ }
+
+ return -1;
+}
diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx
new file mode 100644
index 000000000000..d0ecf55fff63
--- /dev/null
+++ b/xmloff/source/style/xmlstyle.cxx
@@ -0,0 +1,963 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmlstyle.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_XML_SAX_SAXPARSEEXCEPTION_HPP_
+#include <com/sun/star/xml/sax/SAXParseException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XEXTENDEDDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_SAXEXCEPTION_HPP_
+#include <com/sun/star/xml/sax/SAXException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XDOCUMENTHANDLER_HPP_
+#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XATTRIBUTELIST_HPP_
+#include <com/sun/star/xml/sax/XAttributeList.hpp>
+#endif
+#ifndef _COM_SUN_STAR_XML_SAX_XLOCATOR_HPP_
+#include <com/sun/star/xml/sax/XLocator.hpp>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
+#include <com/sun/star/container/XNameContainer.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_XSTYLEFAMILIESSUPPLIER_HPP_
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#endif
+
+#ifndef _TOOLS_DEBUG_HXX //autogen wg. DBG_ASSERT
+#include <tools/debug.hxx>
+#endif
+#ifndef _LIST_HXX
+#include <tools/list.hxx>
+#endif
+#ifndef _URLOBJ_HXX
+#include <tools/urlobj.hxx>
+#endif
+
+#ifndef _CNTRSRT_HXX
+#include <svtools/cntnrsrt.hxx>
+#endif
+#ifndef _SFXITEMSET_HXX //autogen wg. SfxItemSet
+#include <svtools/itemset.hxx>
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLITEM_HXX
+#include "xmlitem.hxx"
+#endif
+#ifndef _XMLOFF_FAMILIES_HXX
+#include "families.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLITMAP_HXX
+#include "xmlitmap.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+#ifndef _XMLOFF_XMLNUMI_HXX
+#include "xmlnumi.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLIMPPR_HXX
+#include "xmlimppr.hxx"
+#endif
+#ifndef _XMLOFF_XMLSTYLE_HXX
+#include "xmlstyle.hxx"
+#endif
+#ifndef _XMLOFF_TXTSTYLI_HXX
+#include "txtstyli.hxx"
+#endif
+#ifndef _XMLOFF_TXTPRMAP_HXX
+#include "txtprmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNUMFI_HXX
+#include "xmlnumfi.hxx"
+#endif
+#ifndef _XMLOFF_XMLCHARTSTYLECONTEXT_HXX_
+#include "XMLChartStyleContext.hxx"
+#endif
+#ifndef _XMLOFF_CHARTPROPERTYSETMAPPER_HXX_
+#include "XMLChartPropertySetMapper.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLSHAPESTYLECONTEXT_HXX
+#include "XMLShapeStyleContext.hxx"
+#endif
+
+#ifndef _XMLOFF_FILLSTYLECONTEXTS_HXX_
+#include "FillStyleContext.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLFOOTNOTECONFIGURATIONIMPORTCONTEXT_HXX
+#include "XMLFootnoteConfigurationImportContext.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::container;
+using namespace ::com::sun::star::style;
+
+// ---------------------------------------------------------------------
+
+static __FAR_DATA SvXMLTokenMapEntry aStyleStylesElemTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, sXML_style, XML_TOK_STYLE_STYLE },
+ { XML_NAMESPACE_TEXT, sXML_list_style, XML_TOK_TEXT_LIST_STYLE },
+ { XML_NAMESPACE_TEXT, sXML_outline_style, XML_TOK_TEXT_OUTLINE },
+ { XML_NAMESPACE_DRAW, sXML_gradient, XML_TOK_STYLES_GRADIENTSTYLES },
+ { XML_NAMESPACE_DRAW, sXML_hatch, XML_TOK_STYLES_HATCHSTYLES },
+ { XML_NAMESPACE_DRAW, sXML_fill_image, XML_TOK_STYLES_BITMAPSTYLES },
+ { XML_NAMESPACE_DRAW, sXML_transparency, XML_TOK_STYLES_TRANSGRADIENTSTYLES },
+ { XML_NAMESPACE_DRAW, sXML_marker, XML_TOK_STYLES_MARKERSTYLES },
+ { XML_NAMESPACE_TEXT, sXML_footnotes_configuration,
+ XML_TOK_TEXT_FOOTNOTE_CONFIG },
+ { XML_NAMESPACE_TEXT, sXML_endnotes_configuration,
+ XML_TOK_TEXT_ENDNOTE_CONFIG },
+ XML_TOKEN_MAP_END
+};
+
+const SvXMLTokenMap& SvXMLStylesContext::GetStyleStylesElemTokenMap()
+{
+ if( !pStyleStylesElemTokenMap )
+ pStyleStylesElemTokenMap =
+ new SvXMLTokenMap( aStyleStylesElemTokenMap );
+
+ return *pStyleStylesElemTokenMap;
+}
+
+// ---------------------------------------------------------------------
+
+void SvXMLStyleContext::SetAttribute( sal_uInt16 nPrefixKey,
+ const OUString& rLocalName,
+ const OUString& rValue )
+{
+ // TODO: use a map here
+ if( XML_NAMESPACE_STYLE == nPrefixKey )
+ {
+ if( rLocalName.compareToAscii( sXML_family ) == 0L )
+ {
+ if( rValue.compareToAscii( sXML_paragraph ) == 0L )
+ nFamily = (sal_uInt16)SFX_STYLE_FAMILY_PARA;
+ else if( rValue.compareToAscii( sXML_text ) == 0L )
+ nFamily = (sal_uInt16)SFX_STYLE_FAMILY_CHAR;
+ }
+ else if( rLocalName.compareToAscii( sXML_name ) == 0L )
+ {
+ aName = rValue;
+ }
+ else if( rLocalName.compareToAscii( sXML_parent_style_name ) == 0L )
+ {
+ aParent = rValue;
+ }
+ else if( rLocalName.compareToAscii( sXML_next_style_name ) == 0L )
+ {
+ aFollow = rValue;
+ }
+ else if( rLocalName.compareToAscii( sXML_help_file_name ) == 0L )
+ {
+ aHelpFile = rValue;
+ }
+ else if( rLocalName.compareToAscii( sXML_help_id ) == 0L )
+ {
+ sal_Int32 nTmp = rValue.toInt32();
+ nHelpId =
+ (nTmp < 0L) ? 0U : ( (nTmp > USHRT_MAX) ? USHRT_MAX
+ : (sal_uInt16)nTmp );
+ }
+ }
+}
+
+TYPEINIT1( SvXMLStyleContext, SvXMLImportContext );
+
+SvXMLStyleContext::SvXMLStyleContext( SvXMLImport& rImp, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList >& ) :
+ SvXMLImportContext( rImp, nPrfx, rLName ),
+ nHelpId( UCHAR_MAX ),
+ nFamily( 0 ),
+ nSubFamily( 0U ),
+ bValid( sal_True ),
+ bNew( sal_True )
+{
+}
+
+SvXMLStyleContext::~SvXMLStyleContext()
+{
+}
+
+SvXMLImportContext *SvXMLStyleContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );;
+}
+
+void SvXMLStyleContext::StartElement( const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName, &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ SetAttribute( nPrefix, aLocalName, rValue );
+ }
+}
+
+void SvXMLStyleContext::CreateAndInsert( sal_Bool bOverwrite )
+{
+}
+
+void SvXMLStyleContext::CreateAndInsertLate( sal_Bool bOverwrite )
+{
+}
+
+void SvXMLStyleContext::Finish( sal_Bool bOverwrite )
+{
+}
+
+// ---------------------------------------------------------------------
+
+class SvXMLStyleIndex_Impl
+{
+ OUString sName;
+ sal_uInt16 nFamily;
+ sal_uInt16 nSubFamily;
+ const SvXMLStyleContext *pStyle;
+
+public:
+
+ SvXMLStyleIndex_Impl( sal_uInt16 nFam, sal_uInt16 nSubFam,
+ const OUString& rName ) :
+ sName( rName ),
+ nFamily( nFam ),
+ nSubFamily( nSubFam ),
+ pStyle ( 0 )
+ {
+ }
+
+ SvXMLStyleIndex_Impl( const SvXMLStyleContext *pStl ) :
+ sName( pStl->GetName() ),
+ nFamily( pStl->GetFamily() ),
+ nSubFamily( pStl->GetSubFamily() ),
+ pStyle ( pStl )
+ {
+ }
+
+ const OUString& GetName() const { return sName; }
+ sal_uInt16 GetFamily() const { return nFamily; }
+ sal_uInt16 GetSubFamily() const { return nSubFamily; }
+ const SvXMLStyleContext *GetStyle() const { return pStyle; }
+};
+
+int SvXMLStyleIndexCmp_Impl( const SvXMLStyleIndex_Impl& r1,
+ const SvXMLStyleIndex_Impl& r2 )
+{
+ int nRet;
+ if( (sal_uInt16)r1.GetFamily() < (sal_uInt16)r2.GetFamily() )
+ nRet = -1;
+ else if( (sal_uInt16)r1.GetFamily() > (sal_uInt16)r2.GetFamily() )
+ nRet = 1;
+ else if( r1.GetSubFamily() < r2.GetSubFamily() )
+ nRet = -1;
+ else if( r1.GetSubFamily() > r2.GetSubFamily() )
+ nRet = 1;
+ else
+ nRet = (int)r1.GetName().compareTo( r2.GetName() );
+
+ return nRet;
+}
+
+// ---------------------------------------------------------------------
+
+typedef SvXMLStyleContext *SvXMLStyleContextPtr;
+DECLARE_LIST( SvXMLStyleContexts_Impl, SvXMLStyleContextPtr )
+
+DECLARE_CONTAINER_SORT( SvXMLStyleIndices_Impl, SvXMLStyleIndex_Impl )
+IMPL_CONTAINER_SORT( SvXMLStyleIndices_Impl, SvXMLStyleIndex_Impl,
+ SvXMLStyleIndexCmp_Impl )
+
+
+class SvXMLStylesContext_Impl
+{
+ SvXMLStyleContexts_Impl aStyles;
+ SvXMLStyleIndices_Impl *pIndices;
+
+ OUString sId;
+ OUString sParentHRef;
+
+#ifndef PRODUCT
+ sal_uInt32 nIndexCreated;
+#endif
+
+ void FlushIndex() { delete pIndices; pIndices = 0; }
+
+public:
+ SvXMLStylesContext_Impl();
+ ~SvXMLStylesContext_Impl();
+
+ sal_uInt32 GetStyleCount() const { return aStyles.Count(); }
+
+ const SvXMLStyleContext *GetStyle( sal_uInt32 i ) const
+ {
+ return i < aStyles.Count() ? aStyles.GetObject(i) : 0;
+ }
+
+ SvXMLStyleContext *GetStyle( sal_uInt32 i )
+ {
+ FlushIndex();
+ return i < aStyles.Count() ? aStyles.GetObject(i) : 0;
+ }
+
+ inline void AddStyle( SvXMLStyleContext *pStyle );
+
+ const SvXMLStyleContext *FindStyleChildContext( sal_uInt16 nFamily,
+ sal_uInt16 nSubFamily,
+ const OUString& rName,
+ sal_Bool bCreateIndex ) const;
+
+ void SetId( const OUString& rId ) { sId = rId; }
+ const OUString& GetId() { return sId; }
+
+ void SetParentHRef( const OUString& rHRef ) { sParentHRef = rHRef; }
+ const OUString& GetParentHRef() { return sParentHRef; }
+};
+
+SvXMLStylesContext_Impl::SvXMLStylesContext_Impl() :
+#ifndef PRODUCT
+ nIndexCreated( 0 ),
+#endif
+ aStyles( 20, 5 ),
+ pIndices( 0 )
+{}
+
+SvXMLStylesContext_Impl::~SvXMLStylesContext_Impl()
+{
+ delete pIndices;
+
+ while( aStyles.Count() )
+ {
+ SvXMLStyleContext *pStyle = aStyles.GetObject(0);
+ aStyles.Remove( 0UL );
+ pStyle->ReleaseRef();
+ }
+}
+
+inline void SvXMLStylesContext_Impl::AddStyle( SvXMLStyleContext *pStyle )
+{
+ aStyles.Insert( pStyle, aStyles.Count() );
+ pStyle->AddRef();
+
+ FlushIndex();
+}
+
+const SvXMLStyleContext *SvXMLStylesContext_Impl::FindStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nSubFamily,
+ const OUString& rName,
+ sal_Bool bCreateIndex ) const
+{
+ const SvXMLStyleContext *pStyle = 0;
+
+ if( !pIndices && bCreateIndex && aStyles.Count() > 0 )
+ {
+#ifndef PRODUCT
+ DBG_ASSERT( 0==nIndexCreated,
+ "Performance warning: sdbcx::Index created multiple times" );
+#endif
+ ((SvXMLStylesContext_Impl *)this)->pIndices =
+ new SvXMLStyleIndices_Impl( aStyles.Count(), 5 );
+ for( sal_uInt32 i=0; i < aStyles.Count(); i++ )
+ pIndices->Insert( new SvXMLStyleIndex_Impl( aStyles.GetObject(i)) );
+#ifndef PRODUCT
+ ((SvXMLStylesContext_Impl *)this)->nIndexCreated++;
+#endif
+ }
+
+ if( pIndices )
+ {
+ SvXMLStyleIndex_Impl aIndex( nFamily, nSubFamily, rName );
+ sal_uInt32 nPos = 0;
+ if( pIndices->Seek_Entry( &aIndex, &nPos ) )
+ pStyle = pIndices->GetObject( nPos )->GetStyle();
+ }
+ else
+ {
+ for( sal_uInt32 i=0; !pStyle && i < aStyles.Count(); i++ )
+ {
+ const SvXMLStyleContext *pS = aStyles.GetObject( i );
+ if( pS->GetFamily() == nFamily &&
+ pS->GetSubFamily() == nSubFamily &&
+ pS->GetName() == rName )
+ pStyle = pS;
+ }
+ }
+
+ return pStyle;
+}
+
+// ---------------------------------------------------------------------
+
+TYPEINIT1( SvXMLStylesContext, SvXMLImportContext );
+
+sal_uInt32 SvXMLStylesContext::GetStyleCount() const
+{
+ return pImpl->GetStyleCount();
+}
+
+SvXMLStyleContext *SvXMLStylesContext::GetStyle( sal_uInt32 i )
+{
+ return pImpl->GetStyle( i );
+}
+
+const SvXMLStyleContext *SvXMLStylesContext::GetStyle( sal_uInt32 i ) const
+{
+ return pImpl->GetStyle( i );
+}
+
+SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext *pStyle = NULL;
+
+ if(GetImport().GetDataStylesImport())
+ {
+ pStyle = GetImport().GetDataStylesImport()->CreateChildContext(GetImport(), nPrefix,
+ rLocalName, xAttrList, *this);
+ }
+
+ if (!pStyle)
+ {
+ const SvXMLTokenMap& rTokenMap = GetStyleStylesElemTokenMap();
+ switch( rTokenMap.Get( nPrefix, rLocalName ) )
+ {
+ case XML_TOK_STYLE_STYLE:
+ {
+ sal_uInt16 nFamily = 0;
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ aLocalName.compareToAscii( sXML_family ) == 0L )
+ {
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+ nFamily = GetFamily( rValue );
+ break;
+ }
+ }
+ pStyle = CreateStyleStyleChildContext( nFamily, nPrefix,
+ rLocalName, xAttrList );
+ }
+ break;
+ case XML_TOK_TEXT_LIST_STYLE:
+ pStyle = new SvxXMLListStyleContext( GetImport(), nPrefix,
+ rLocalName, xAttrList );
+ break;
+ case XML_TOK_TEXT_OUTLINE:
+ pStyle = new SvxXMLListStyleContext( GetImport(), nPrefix,
+ rLocalName, xAttrList, sal_True );
+ break;
+ case XML_TOK_TEXT_FOOTNOTE_CONFIG:
+ pStyle = new XMLFootnoteConfigurationImportContext(GetImport(),
+ nPrefix,
+ rLocalName,
+ xAttrList,
+ sal_False);
+ break;
+ case XML_TOK_TEXT_ENDNOTE_CONFIG:
+ pStyle = new XMLFootnoteConfigurationImportContext(GetImport(),
+ nPrefix,
+ rLocalName,
+ xAttrList,
+ sal_True);
+ break;
+ //
+ // FillStyles
+ //
+ case XML_TOK_STYLES_GRADIENTSTYLES:
+ {
+ pStyle = new XMLGradientStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_HATCHSTYLES:
+ {
+ pStyle = new XMLHatchStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_BITMAPSTYLES:
+ {
+ pStyle = new XMLBitmapStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_TRANSGRADIENTSTYLES:
+ {
+ pStyle = new XMLTransGradientStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ case XML_TOK_STYLES_MARKERSTYLES:
+ {
+ pStyle = new XMLMarkerStyleContext( GetImport(), nPrefix, rLocalName, xAttrList );
+ break;
+ }
+ }
+ }
+
+ return pStyle;
+}
+
+SvXMLStyleContext *SvXMLStylesContext::CreateStyleStyleChildContext(
+ sal_uInt16 nFamily, sal_uInt16 nPrefix, const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLStyleContext *pStyle = 0;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ pStyle = new XMLTextStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this );
+ break;
+ case XML_STYLE_FAMILY_SCH_CHART_ID:
+ pStyle = new XMLChartStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this );
+ break;
+ case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
+ case XML_STYLE_FAMILY_SD_PRESENTATION_ID:
+ case XML_STYLE_FAMILY_SD_POOL_ID:
+ case XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID:
+ pStyle = new XMLShapeStyleContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, *this, nFamily );
+ break;
+ }
+
+ return pStyle;
+}
+
+sal_Bool SvXMLStylesContext::InsertStyleFamily( sal_uInt16 ) const
+{
+ return sal_True;
+}
+
+sal_uInt16 SvXMLStylesContext::GetFamily(
+ const ::rtl::OUString& rValue ) const
+{
+ sal_uInt16 nFamily = 0U;
+ if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_paragraph )))
+ {
+ nFamily = XML_STYLE_FAMILY_TEXT_PARAGRAPH;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_text )))
+ {
+ nFamily = XML_STYLE_FAMILY_TEXT_TEXT;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(sXML_data_style)))
+ {
+ nFamily = XML_STYLE_FAMILY_DATA_STYLE;
+ }
+ else if( 0 == rValue.compareToAscii( RTL_CONSTASCII_STRINGPARAM( sXML_table )))
+ {
+ if( RTL_CONSTASCII_LENGTH( sXML_table ) == rValue.getLength() )
+ nFamily = XML_STYLE_FAMILY_TABLE_TABLE;
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_table_column )))
+ nFamily = XML_STYLE_FAMILY_TABLE_COLUMN;
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_table_row )))
+ nFamily = XML_STYLE_FAMILY_TABLE_ROW;
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_table_cell )))
+ nFamily = XML_STYLE_FAMILY_TABLE_CELL;
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( sXML_table_page )))
+ nFamily = XML_STYLE_FAMILY_TABLE_PAGE_STYLES;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_GRAPHICS_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_PRESENTATION_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_POOL_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_POOL_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)))
+ {
+ nFamily = XML_STYLE_FAMILY_SD_DRAWINGPAGE_ID;
+ }
+ else if( rValue.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( XML_STYLE_FAMILY_SCH_CHART_NAME )))
+ {
+ nFamily = XML_STYLE_FAMILY_SCH_CHART_ID;
+ }
+
+ return nFamily;
+}
+
+UniReference < SvXMLImportPropertyMapper > SvXMLStylesContext::GetImportPropertyMapper(
+ sal_uInt16 nFamily ) const
+{
+ UniReference < SvXMLImportPropertyMapper > xMapper;
+
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ if( !xParaImpPropMapper.is() )
+ {
+ SvXMLStylesContext * pThis = (SvXMLStylesContext *)this;
+ pThis->xParaImpPropMapper =
+ pThis->GetImport().GetTextImport()
+ ->GetParaImportPropertySetMapper();
+ }
+ xMapper = xParaImpPropMapper;
+ break;
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ if( !xTextImpPropMapper.is() )
+ {
+ SvXMLStylesContext * pThis = (SvXMLStylesContext *)this;
+ pThis->xTextImpPropMapper =
+ pThis->GetImport().GetTextImport()
+ ->GetTextImportPropertySetMapper();
+ }
+ xMapper = xTextImpPropMapper;
+ break;
+
+ case XML_STYLE_FAMILY_SD_GRAPHICS_ID:
+ case XML_STYLE_FAMILY_SD_PRESENTATION_ID:
+ case XML_STYLE_FAMILY_SD_POOL_ID:
+ if(!xShapeImpPropMapper.is())
+ {
+ UniReference< XMLShapeImportHelper > aImpHelper = ((SvXMLImport&)GetImport()).GetShapeImport();
+ ((SvXMLStylesContext*)this)->xShapeImpPropMapper =
+ new SvXMLImportPropertyMapper(aImpHelper->GetPropertySetMapper());
+ }
+ xMapper = xShapeImpPropMapper;
+ break;
+ case XML_STYLE_FAMILY_SCH_CHART_ID:
+ if( ! xChartImpPropMapper.is() )
+ {
+ XMLPropertySetMapper *pPropMapper = new XMLChartPropertySetMapper();
+ xChartImpPropMapper = new XMLChartImportPropertyMapper( pPropMapper );
+ }
+ xMapper = xChartImpPropMapper;
+ break;
+ }
+
+ return xMapper;
+}
+
+Reference < XNameContainer > SvXMLStylesContext::GetStylesContainer(
+ sal_uInt16 nFamily ) const
+{
+ Reference < XNameContainer > xStyles;
+ OUString sName;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ if( xParaStyles.is() )
+ xStyles = xParaStyles;
+ else
+ sName =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "ParagraphStyles" ) );
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ if( xTextStyles.is() )
+ xStyles = xTextStyles;
+ else
+ sName =
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "CharacterStyles" ) );
+ break;
+ }
+ if( !xStyles.is() && sName.getLength() )
+ {
+ Reference< XStyleFamiliesSupplier > xFamiliesSupp(
+ GetImport().GetModel(), UNO_QUERY );
+ Reference< XNameAccess > xFamilies = xFamiliesSupp->getStyleFamilies();
+ Any aAny = xFamilies->getByName( sName );
+
+ xStyles = *(Reference<XNameContainer>*)aAny.getValue();
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ ((SvXMLStylesContext *)this)->xParaStyles = xStyles;
+ break;
+
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ ((SvXMLStylesContext *)this)->xTextStyles = xStyles;
+ break;
+ }
+ }
+
+ return xStyles;
+}
+
+OUString SvXMLStylesContext::GetServiceName( sal_uInt16 nFamily ) const
+{
+ String sServiceName;
+ switch( nFamily )
+ {
+ case XML_STYLE_FAMILY_TEXT_PARAGRAPH:
+ sServiceName = sParaStyleServiceName;
+ break;
+ case XML_STYLE_FAMILY_TEXT_TEXT:
+ sServiceName = sTextStyleServiceName;
+ break;
+ }
+
+ return sServiceName;
+}
+
+
+SvXMLStylesContext::SvXMLStylesContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList) :
+ SvXMLImportContext( rImport, nPrfx, rLName ),
+ pImpl( new SvXMLStylesContext_Impl ),
+ pStyleStylesElemTokenMap( 0 ),
+ sParaStyleServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.ParagraphStyle" ) ),
+ sTextStyleServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.style.CharacterStyle" ) )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_NONE == nPrefix &&
+ aLocalName.compareToAscii( sXML_id ) == 0L )
+ {
+ pImpl->SetId( xAttrList->getValueByIndex( i ) );
+ }
+ }
+}
+
+
+SvXMLStylesContext::~SvXMLStylesContext()
+{
+ delete pStyleStylesElemTokenMap;
+ delete pImpl;
+}
+
+SvXMLImportContext *SvXMLStylesContext::CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_OFFICE == nPrefix &&
+ rLocalName.compareToAscii( sXML_use_styles ) == 0L )
+ {
+ OUString sHRef;
+ pContext = new SvXMLUseStylesContext( GetImport(), nPrefix, rLocalName,
+ xAttrList, sHRef );
+ pImpl->SetParentHRef( sHRef );
+ }
+ else
+ {
+ SvXMLStyleContext *pStyle =
+ CreateStyleChildContext( nPrefix, rLocalName, xAttrList );
+// DBG_ASSERT( pStyle->GetFamily(), "Style without a family" );
+ if( pStyle )
+ {
+ pImpl->AddStyle( pStyle );
+ pContext = pStyle;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix,
+ rLocalName );
+ }
+ }
+
+ return pContext;
+}
+
+void SvXMLStylesContext::EndElement()
+{
+}
+
+void SvXMLStylesContext::AddStyle(SvXMLStyleContext& rNew)
+{
+ pImpl->AddStyle( &rNew );
+}
+
+void SvXMLStylesContext::CopyStylesToDoc( sal_Bool bOverwrite )
+{
+ // pass 1: create text, paragraph and frame styles
+ sal_uInt16 nCount = GetStyleCount();
+ for( sal_uInt16 i=0; i<nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle )
+ continue;
+
+ if( InsertStyleFamily( pStyle->GetFamily() ) )
+ pStyle->CreateAndInsert( bOverwrite );
+ }
+
+ // pass 2: create list styles (they require char styles)
+ for( i=0; i<nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle )
+ continue;
+
+ if( InsertStyleFamily( pStyle->GetFamily() ) )
+ pStyle->CreateAndInsertLate( bOverwrite );
+ }
+
+ // pass3: finish creation of styles
+ for( i=0; i<nCount; i++ )
+ {
+ SvXMLStyleContext *pStyle = GetStyle( i );
+ if( !pStyle || !pStyle->IsValid() )
+ continue;
+
+ if( InsertStyleFamily( pStyle->GetFamily() ) )
+ pStyle->Finish( bOverwrite );
+ }
+}
+
+
+const OUString& SvXMLStylesContext::GetId() const
+{
+ return pImpl->GetId();
+}
+
+const OUString& SvXMLStylesContext::GetParentHRef() const
+{
+ return pImpl->GetParentHRef();
+}
+
+const SvXMLStyleContext *SvXMLStylesContext::FindStyleChildContext(
+ sal_uInt16 nFamily,
+ sal_uInt16 nSubFamily,
+ const OUString& rName,
+ sal_Bool bCreateIndex ) const
+{
+ return pImpl->FindStyleChildContext( nFamily, nSubFamily,rName,
+ bCreateIndex );
+}
+
+// ---------------------------------------------------------------------
+
+SvXMLUseStylesContext::SvXMLUseStylesContext(
+ SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList,
+ OUString& rHRef ) :
+ SvXMLImportContext( rImp, nPrfx, rLName )
+{
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ if( XML_NAMESPACE_XLINK == nPrefix &&
+ aLocalName.compareToAscii( sXML_href ) == 0L )
+ {
+ rHRef = xAttrList->getValueByIndex( i );
+ // TODO: Hack!
+ if( rImp.GetLocator().is() )
+ {
+ // RelToAbs leaves "#foo" util::URL's untouched
+ INetURLObject aBaseURL( rImp.GetLocator()->getSystemId() );
+ INetURLObject aURL;
+ if( aBaseURL.GetNewAbsURL( rHRef, &aURL ) )
+ rHRef = aURL.GetMainURL();
+ }
+ }
+ }
+}
+
+SvXMLUseStylesContext::~SvXMLUseStylesContext()
+{
+}
+
+
diff --git a/xmloff/source/style/xmltabe.cxx b/xmloff/source/style/xmltabe.cxx
new file mode 100644
index 000000000000..1de5287c8a34
--- /dev/null
+++ b/xmloff/source/style/xmltabe.cxx
@@ -0,0 +1,250 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmltabe.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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 <tools/debug.hxx>
+
+#ifndef _COM_SUN_STAR_STYLE_TABSTOP_HPP_
+#include <com/sun/star/style/TabStop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_STYLE_TABALIGN_HPP_
+#include <com/sun/star/style/TabAlign.hpp>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_XMLITMAP_HXX
+#include "xmlitmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+#ifndef _XMLOFF_XMLEXPIT_HXX
+#include "xmlexpit.hxx"
+#endif
+
+#ifndef _XMLOFF_XMLTABE_HXX
+#include "xmltabe.hxx"
+#endif
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+SvXMLEnumMapEntry psXML_tabstop_style[] =
+{
+ { "left", style::TabAlign_LEFT },
+ { "center", style::TabAlign_CENTER },
+ { "right", style::TabAlign_RIGHT },
+ { "char", style::TabAlign_DECIMAL },
+ { "????", style::TabAlign_DEFAULT }, // ?????????????????????????????????????
+ { 0, 0 }
+};
+
+void SvxXMLTabStopExport::exportTabStop( const ::com::sun::star::style::TabStop* pTabStop )
+{
+ CheckAttrList();
+
+ // text:level
+ OUStringBuffer sBuffer;
+
+ // position attribute
+ mrUnitConv.convertMeasure( sBuffer, pTabStop->Position );
+ AddAttribute( XML_NAMESPACE_STYLE, sXML_tabstop_position,
+ sBuffer.makeStringAndClear() );
+
+ // type attribute
+ if( style::TabAlign_LEFT != pTabStop->Alignment )
+ {
+ mrUnitConv.convertEnum( sBuffer, pTabStop->Alignment,
+ psXML_tabstop_style );
+ AddAttribute( XML_NAMESPACE_STYLE, sXML_tabstop_type,
+ sBuffer.makeStringAndClear() );
+ }
+
+ // char
+ if( style::TabAlign_DECIMAL == pTabStop->Alignment )
+ {
+ sBuffer.append( pTabStop->DecimalChar );
+ AddAttribute( XML_NAMESPACE_STYLE, sXML_tabstop_char,
+ sBuffer.makeStringAndClear() );
+ }
+
+ // leader-char
+ if( ' ' != pTabStop->FillChar )
+ {
+ sBuffer.append( pTabStop->FillChar );
+ AddAttribute( XML_NAMESPACE_STYLE, sXML_tabstop_leader,
+ sBuffer.makeStringAndClear() );
+ }
+
+ OUString sElem = GetQNameByKey( XML_NAMESPACE_STYLE, OUString::createFromAscii(sXML_tabstop_tab_stop) );
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->startElement( sElem, mxAttrList );
+ ClearAttrList();
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->endElement( sElem );
+}
+
+OUString SvxXMLTabStopExport::GetQNameByKey( sal_uInt16 nKey,
+ const OUString& rLocalName ) const
+{
+ DBG_ASSERT( mpNamespaceMap,
+ "SvxXMLTabStopExport::GetQNameByKey: namespace map is missing" );
+ if( mpNamespaceMap )
+ return mpNamespaceMap->GetQNameByKey( nKey, rLocalName );
+ else
+ return rLocalName;
+}
+
+void SvxXMLTabStopExport::ClearAttrList()
+{
+ mpAttrList->Clear();
+}
+
+#ifndef PRODUCT
+void SvxXMLTabStopExport::CheckAttrList()
+{
+ DBG_ASSERT( !mpAttrList->getLength(),
+ "SvxXMLTabStopExport::CheckAttrList: list is not empty" );
+}
+#endif
+
+void SvxXMLTabStopExport::AddAttribute( sal_uInt16 nPrefixKey, const char *pName,
+ const OUString& rValue )
+{
+ OUString sName( OUString::createFromAscii( pName ) );
+
+ mpAttrList->AddAttribute( GetQNameByKey( nPrefixKey, sName ),
+ msCDATA, rValue );
+}
+
+SvxXMLTabStopExport::SvxXMLTabStopExport( const uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
+ const SvXMLUnitConverter& rUnitConverter )
+: msCDATA( OUString::createFromAscii( sXML_CDATA ) ),
+ msWS( OUString::createFromAscii( sXML_WS ) ),
+ mpNamespaceMap( 0 ),
+ mrUnitConv( rUnitConverter ),
+ mpAttrList( new SvXMLAttributeList )
+{
+ mxHandler = rHandler;
+ mxAttrList = mpAttrList;
+}
+
+SvxXMLTabStopExport::~SvxXMLTabStopExport()
+{
+}
+
+void SvxXMLTabStopExport::Export( const uno::Any& rAny,
+ const SvXMLNamespaceMap& rNamespaceMap )
+{
+ mpNamespaceMap = &rNamespaceMap;
+
+ CheckAttrList();
+
+
+ uno::Sequence< ::com::sun::star::style::TabStop> aSeq;
+ if(!(rAny >>= aSeq))
+ {
+ DBG_ERROR( "SvxXMLTabStopExport needs a Sequence ::com::sun::star::style::TabStop>" );
+ }
+ else
+ {
+ const ::com::sun::star::style::TabStop* pTabs = aSeq.getConstArray();
+ const sal_uInt16 nTabs = aSeq.getLength();
+
+ // ignore default tab stop here
+ if( 1 == nTabs && style::TabAlign_DEFAULT == pTabs[0].Alignment )
+ return;
+
+ OUString sElem = GetQNameByKey( XML_NAMESPACE_STYLE,
+ OUString::createFromAscii(sXML_tabstop_tab_stops) );
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->startElement( sElem, mxAttrList );
+ ClearAttrList();
+
+ for( sal_uInt16 nIndex = 0; nIndex < nTabs; nIndex++ )
+ {
+ DBG_ASSERT( style::TabAlign_DEFAULT == pTabs[nIndex].Alignment ||
+ nIndex == 0 ||
+ style::TabAlign_DEFAULT != pTabs[nIndex-1].Alignment,
+ "tab default distance unexpected" );
+ if( style::TabAlign_DEFAULT != pTabs[nIndex].Alignment )
+ exportTabStop( &(pTabs[nIndex]) );
+ }
+
+ mxHandler->ignorableWhitespace( msWS );
+ mxHandler->endElement( sElem );
+ }
+
+ mpNamespaceMap = 0;
+}
+
+
diff --git a/xmloff/source/style/xmltabi.cxx b/xmloff/source/style/xmltabi.cxx
new file mode 100644
index 000000000000..f695e39a3dae
--- /dev/null
+++ b/xmloff/source/style/xmltabi.cxx
@@ -0,0 +1,319 @@
+/*************************************************************************
+ *
+ * $RCSfile: xmltabi.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 17:07:06 $
+ *
+ * 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): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _COM_SUN_STAR_STYLE_TABALIGN_HPP_
+#include <com/sun/star/style/TabAlign.hpp>
+#endif
+
+#ifndef _RTL_USTRBUF_HXX_
+#include <rtl/ustrbuf.hxx>
+#endif
+
+#ifndef _XMLOFF_XMLTKMAP_HXX
+#include "xmltkmap.hxx"
+#endif
+#ifndef _XMLOFF_NMSPMAP_HXX
+#include "nmspmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLNMSPE_HXX
+#include "xmlnmspe.hxx"
+#endif
+#ifndef _XMLOFF_XMLIMP_HXX
+#include "xmlimp.hxx"
+#endif
+
+#ifndef _COM_SUN_STAR_STYLE_TABSTOP_HPP_
+#include <com/sun/star/style/TabStop.hpp>
+#endif
+
+#ifndef _XMLOFF_XMLKYWD_HXX
+#include "xmlkywd.hxx"
+#endif
+#ifndef _XMLOFF_I18NMAP_HXX
+#include "i18nmap.hxx"
+#endif
+#ifndef _XMLOFF_XMLUCONV_HXX
+#include "xmluconv.hxx"
+#endif
+
+#include "xmltabi.hxx"
+
+using namespace ::rtl;
+using namespace ::com::sun::star;
+
+// ---
+
+enum SvXMLTokenMapAttrs
+{
+ XML_TOK_TABSTOP_POSITION,
+ XML_TOK_TABSTOP_TYPE,
+ XML_TOK_TABSTOP_CHAR,
+ XML_TOK_TABSTOP_LEADER,
+ XML_TOK_TABSTOP_END=XML_TOK_UNKNOWN
+};
+
+static __FAR_DATA SvXMLTokenMapEntry aTabsAttributesAttrTokenMap[] =
+{
+ { XML_NAMESPACE_STYLE, sXML_tabstop_position, XML_TOK_TABSTOP_POSITION },
+ { XML_NAMESPACE_STYLE, sXML_tabstop_type, XML_TOK_TABSTOP_TYPE },
+ { XML_NAMESPACE_STYLE, sXML_tabstop_char, XML_TOK_TABSTOP_CHAR },
+ { XML_NAMESPACE_STYLE, sXML_tabstop_leader, XML_TOK_TABSTOP_LEADER },
+ XML_TOKEN_MAP_END
+};
+
+// ---
+
+class SvxXMLTabStopContext_Impl : public SvXMLImportContext
+{
+private:
+ style::TabStop aTabStop;
+
+public:
+ TYPEINFO();
+
+ SvxXMLTabStopContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+
+ virtual ~SvxXMLTabStopContext_Impl();
+
+ virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList );
+
+ const style::TabStop& getTabStop() const { return aTabStop; }
+};
+
+TYPEINIT1( SvxXMLTabStopContext_Impl, SvXMLImportContext );
+
+SvxXMLTabStopContext_Impl::SvxXMLTabStopContext_Impl(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+: SvXMLImportContext( rImport, nPrfx, rLName )
+{
+ aTabStop.Position = 0;
+ aTabStop.Alignment = style::TabAlign_LEFT;
+ aTabStop.DecimalChar = sal_Unicode( ',' );
+ aTabStop.FillChar = sal_Unicode( ' ' );
+
+ SvXMLTokenMap aTokenMap( aTabsAttributesAttrTokenMap );
+
+ sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
+ for( sal_Int16 i=0; i < nAttrCount; i++ )
+ {
+ const OUString& rAttrName = xAttrList->getNameByIndex( i );
+ OUString aLocalName;
+ sal_uInt16 nPrefix =
+ GetImport().GetNamespaceMap().GetKeyByAttrName( rAttrName,
+ &aLocalName );
+ const OUString& rValue = xAttrList->getValueByIndex( i );
+
+ sal_Int32 nVal;
+ switch( aTokenMap.Get( nPrefix, aLocalName ) )
+ {
+ case XML_TOK_TABSTOP_POSITION:
+ if( GetImport().GetMM100UnitConverter().convertMeasure( nVal,
+ rValue ) )
+ aTabStop.Position = nVal;
+ break;
+ case XML_TOK_TABSTOP_TYPE:
+ if( 0 == rValue.compareToAscii( sXML_left, sizeof( sXML_left ) ) )
+ {
+ aTabStop.Alignment = style::TabAlign_LEFT;
+ }
+ else if( 0 == rValue.compareToAscii( sXML_right, sizeof( sXML_right ) ) )
+ {
+ aTabStop.Alignment = style::TabAlign_RIGHT;
+ }
+ else if( 0 == rValue.compareToAscii( sXML_center, sizeof( sXML_center ) ) )
+ {
+ aTabStop.Alignment = style::TabAlign_CENTER;
+ }
+ else if( 0 == rValue.compareToAscii( sXML_char, sizeof( sXML_char ) ) )
+ {
+ aTabStop.Alignment = style::TabAlign_DECIMAL;
+ }
+ break;
+ case XML_TOK_TABSTOP_CHAR:
+ if( 0 != rValue.getLength() )
+ aTabStop.DecimalChar = rValue[0];
+ break;
+ case XML_TOK_TABSTOP_LEADER:
+ if( 0 != rValue.getLength() )
+ aTabStop.FillChar = rValue[0];
+ break;
+ }
+ }
+}
+
+SvxXMLTabStopContext_Impl::~SvxXMLTabStopContext_Impl()
+{
+}
+
+SvXMLImportContext *SvxXMLTabStopContext_Impl::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ return new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+}
+
+
+
+
+typedef SvxXMLTabStopContext_Impl *SvxXMLTabStopContext_Impl_ImplPtr;
+SV_DECL_PTRARR( SvxXMLTabStopArray_Impl, SvxXMLTabStopContext_Impl_ImplPtr, 20, 5 )
+
+
+// ---
+
+TYPEINIT1( SvxXMLTabStopImportContext, XMLElementPropertyContext );
+
+SvxXMLTabStopImportContext::SvxXMLTabStopImportContext(
+ SvXMLImport& rImport, sal_uInt16 nPrfx,
+ const OUString& rLName,
+ const XMLPropertyState& rProp,
+ ::std::vector< XMLPropertyState > &rProps )
+: XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ),
+ mpTabStops( NULL )
+{
+}
+
+SvxXMLTabStopImportContext::~SvxXMLTabStopImportContext()
+{
+ if( mpTabStops )
+ {
+ sal_uInt16 nCount = mpTabStops->Count();
+ while( nCount )
+ {
+ nCount--;
+ SvxXMLTabStopContext_Impl *pTabStop = (*mpTabStops)[nCount];
+ mpTabStops->Remove( nCount, 1 );
+ pTabStop->ReleaseRef();
+ }
+ }
+
+ delete mpTabStops;
+}
+
+SvXMLImportContext *SvxXMLTabStopImportContext::CreateChildContext(
+ sal_uInt16 nPrefix,
+ const OUString& rLocalName,
+ const uno::Reference< xml::sax::XAttributeList > & xAttrList )
+{
+ SvXMLImportContext *pContext = 0;
+
+ if( XML_NAMESPACE_STYLE == nPrefix &&
+ 0 == rLocalName.compareToAscii( sXML_tabstop_tab_stop , sizeof( sXML_tabstop_tab_stop ) ) )
+ {
+ // create new tabstop import context
+ SvxXMLTabStopContext_Impl *pTabStopContext =
+ new SvxXMLTabStopContext_Impl( GetImport(), nPrefix, rLocalName,
+ xAttrList );
+
+ // add new tabstop to array of tabstops
+ if( !mpTabStops )
+ mpTabStops = new SvxXMLTabStopArray_Impl;
+
+ mpTabStops->Insert( pTabStopContext, mpTabStops->Count() );
+ pTabStopContext->AddRef();
+
+ pContext = pTabStopContext;
+ }
+ else
+ {
+ pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
+ }
+
+ return pContext;
+}
+
+void SvxXMLTabStopImportContext::EndElement( )
+{
+ if( mpTabStops )
+ {
+ sal_uInt16 nCount = mpTabStops->Count();
+
+ uno::Sequence< style::TabStop> aSeq( nCount );
+ style::TabStop* pTabStops = aSeq.getArray();
+ for( sal_uInt16 i=0; i < nCount; i++ )
+ {
+ SvxXMLTabStopContext_Impl *pTabStopContext = (*mpTabStops)[i];
+ *pTabStops++ = pTabStopContext->getTabStop();
+ }
+
+ aProp.maValue <<= aSeq;
+ }
+ else
+ {
+ aProp.maValue.clear();
+ }
+
+ SetInsert( sal_True );
+ XMLElementPropertyContext::EndElement();
+
+
+}
+
+
+
+