From 939c6ceda0fdedbaba3daab7869c6cf494224386 Mon Sep 17 00:00:00 2001 From: Michael Brauer Date: Thu, 10 May 2001 09:09:49 +0000 Subject: [PATCH] draw-aspect for ole objects --- xmloff/inc/xmlkywd.hxx | 6 +- xmloff/source/style/DrawAspectHdl.cxx | 162 ++++++++++++++++++++++++++ xmloff/source/style/DrawAspectHdl.hxx | 81 +++++++++++++ xmloff/source/style/makefile.mk | 10 +- xmloff/source/style/prhdlfac.cxx | 10 +- xmloff/source/text/txtprhdl.cxx | 6 +- xmloff/source/text/txtprmap.cxx | 6 +- 7 files changed, 268 insertions(+), 13 deletions(-) create mode 100644 xmloff/source/style/DrawAspectHdl.cxx create mode 100644 xmloff/source/style/DrawAspectHdl.hxx diff --git a/xmloff/inc/xmlkywd.hxx b/xmloff/inc/xmlkywd.hxx index c55edbc1f278..663297488cfc 100644 --- a/xmloff/inc/xmlkywd.hxx +++ b/xmloff/inc/xmlkywd.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlkywd.hxx,v $ * - * $Revision: 1.153 $ + * $Revision: 1.154 $ * - * last change: $Author: bm $ $Date: 2001-05-10 09:20:19 $ + * last change: $Author: mib $ $Date: 2001-05-10 10:05:16 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -891,6 +891,7 @@ XML_CONSTASCII_ACTION( sXML_hyphenation_ladder_count, "hyphenation-ladder-count" XML_CONSTASCII_ACTION( sXML_hyphenation_push_char_count, "hyphenation-push-char-count" ); XML_CONSTASCII_ACTION( sXML_hyphenation_remain_char_count, "hyphenation-remain-char-count" ); XML_CONSTASCII_ACTION( sXML_i, "i" ); +XML_CONSTASCII_ACTION( sXML_icon, "icon" ); XML_CONSTASCII_ACTION( sXML_id, "id" ); XML_CONSTASCII_ACTION( sXML_ident, "ident"); XML_CONSTASCII_ACTION( sXML_identifier, "identifier" ); @@ -1691,6 +1692,7 @@ XML_CONSTASCII_ACTION( sXML_textual, "textual" ); XML_CONSTASCII_ACTION( sXML_thick, "thick" ); XML_CONSTASCII_ACTION( sXML_thin, "thin" ); XML_CONSTASCII_ACTION( sXML_three_dimensional, "three-dimensional" ); +XML_CONSTASCII_ACTION( sXML_thumbnail, "thumbnail" ); XML_CONSTASCII_ACTION( sXML_tick_marks_major_inner, "tick-marks-major-inner" ); XML_CONSTASCII_ACTION( sXML_tick_marks_major_outer, "tick-marks-major-outer" ); XML_CONSTASCII_ACTION( sXML_tick_marks_minor_inner, "tick-marks-minor-inner" ); diff --git a/xmloff/source/style/DrawAspectHdl.cxx b/xmloff/source/style/DrawAspectHdl.cxx new file mode 100644 index 000000000000..d2d6a1d51c27 --- /dev/null +++ b/xmloff/source/style/DrawAspectHdl.cxx @@ -0,0 +1,162 @@ +/************************************************************************* + * + * $RCSfile: DrawAspectHdl.cxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2001-05-10 10:07:52 $ + * + * 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_UNO_ANY_HXX_ +#include +#endif + +#ifndef _RTL_USTRBUF_HXX_ +#include +#endif + +#ifndef _XMLOFF_XMLUCONV_HXX +#include "xmluconv.hxx" +#endif + +#ifndef _XMLOFF_XMLKYWD_HXX +#include +#endif + +#ifndef _XMLOFF_DRAWASPECTHDL_HXX +#include "DrawAspectHdl.hxx" +#endif + +using namespace ::rtl; +using namespace ::com::sun::star; + +/////////////////////////////////////////////////////////////////////////////// +// +// class XMLMeasurePropHdl +// + +SvXMLEnumMapEntry __READONLY_DATA pXML_DrawAspect_Enum[] = +{ + { sXML_content, 1 }, + { sXML_thumbnail, 2 }, + { sXML_icon, 4 }, + { sXML_print, 8 }, + { 0, 0 } +}; + +DrawAspectHdl::~DrawAspectHdl() +{ + // nothing to do +} + +sal_Bool DrawAspectHdl::importXML( const OUString& rStrImpValue, uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const +{ + sal_Int32 nAspect = 0; + + SvXMLTokenEnumerator aTokenEnum( rStrImpValue ); + OUString aToken; + while( aTokenEnum.getNextToken( aToken ) ) + { + sal_uInt16 nVal; + if( rUnitConverter.convertEnum( nVal, rStrImpValue, pXML_DrawAspect_Enum ) ) + { + nAspect = nAspect | (sal_Int32)nVal; + } + } + + rValue <<= nAspect; + + return nAspect != 0; +} + +sal_Bool DrawAspectHdl::exportXML( OUString& rStrExpValue, const uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const +{ + sal_Bool bRet = sal_False; + OUStringBuffer aOut; + + sal_Int32 nAspect; + if( rValue >>= nAspect ) + { + if( (nAspect & 1) != 0 ) + aOut.appendAscii( sXML_content ); + + if( (nAspect & 2) != 0 ) + { + if( aOut.getLength() ) + aOut.append( sal_Unicode(' ') ); + aOut.appendAscii( sXML_thumbnail ); + } + + if( (nAspect & 4) != 0 ) + { + if( aOut.getLength() ) + aOut.append( sal_Unicode(' ') ); + aOut.appendAscii( sXML_icon ); + } + + if( (nAspect & 8) != 0 ) + { + if( aOut.getLength() ) + aOut.append( sal_Unicode(' ') ); + aOut.appendAscii( sXML_print ); + } + + rStrExpValue = aOut.makeStringAndClear(); + + bRet = sal_True; + } + + return bRet; +} diff --git a/xmloff/source/style/DrawAspectHdl.hxx b/xmloff/source/style/DrawAspectHdl.hxx new file mode 100644 index 000000000000..0f5629bc2ce8 --- /dev/null +++ b/xmloff/source/style/DrawAspectHdl.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * $RCSfile: DrawAspectHdl.hxx,v $ + * + * $Revision: 1.1 $ + * + * last change: $Author: mib $ $Date: 2001-05-10 10:07:58 $ + * + * 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_DRAWASPECTHDL_HXX +#define _XMLOFF_DRAWASPECTHDL_HXX + +#ifndef _XMLOFF_PROPERTYHANDLERBASE_HXX +#include +#endif + +/** + PropertyHandler for the XML-data-type: +*/ +class DrawAspectHdl : public XMLPropertyHandler +{ +public: + virtual ~DrawAspectHdl(); + + 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_DRAWASPECTHDL_HXX diff --git a/xmloff/source/style/makefile.mk b/xmloff/source/style/makefile.mk index 479e5b5737fc..a1557415177e 100644 --- a/xmloff/source/style/makefile.mk +++ b/xmloff/source/style/makefile.mk @@ -2,9 +2,9 @@ # # $RCSfile: makefile.mk,v $ # -# $Revision: 1.17 $ +# $Revision: 1.18 $ # -# last change: $Author: cl $ $Date: 2001-04-30 09:01:06 $ +# last change: $Author: mib $ $Date: 2001-05-10 10:07:18 $ # # The Contents of this file are made available subject to the terms of # either of the following licenses @@ -161,7 +161,8 @@ CXXFILES = \ XMLBitmapLogicalSizePropertyHandler.cxx \ durationhdl.cxx \ VisAreaExport.cxx \ - VisAreaContext.cxx + VisAreaContext.cxx \ + DrawAspectHdl.cxx SLOFILES = \ @@ -248,7 +249,8 @@ SLOFILES = \ $(SLO)$/XMLBitmapLogicalSizePropertyHandler.obj \ $(SLO)$/durationhdl.obj \ $(SLO)$/VisAreaExport.obj \ - $(SLO)$/VisAreaContext.obj + $(SLO)$/VisAreaContext.obj \ + $(SLO)$/DrawAspectHdl.obj # --- Tagets ------------------------------------------------------- diff --git a/xmloff/source/style/prhdlfac.cxx b/xmloff/source/style/prhdlfac.cxx index e94d344c1dab..f0bb4c9f7dc4 100644 --- a/xmloff/source/style/prhdlfac.cxx +++ b/xmloff/source/style/prhdlfac.cxx @@ -2,9 +2,9 @@ * * $RCSfile: prhdlfac.cxx,v $ * - * $Revision: 1.13 $ + * $Revision: 1.14 $ * - * last change: $Author: cl $ $Date: 2001-04-30 09:01:06 $ + * last change: $Author: mib $ $Date: 2001-05-10 10:07:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,6 +155,9 @@ #ifndef _XMLOFF_XMLRECTANGLEMEMBERSHANDLER_HXX #include "XMLRectangleMembersHandler.hxx" #endif +#ifndef _XMLOFF_DRAWASPECTHDL_HXX +#include "DrawAspectHdl.hxx" +#endif using namespace ::com::sun::star; @@ -425,6 +428,9 @@ const XMLPropertyHandler* XMLPropertyHandlerFactory::GetBasicHandler( sal_Int32 aXML_HorizontalAdjust_Enum, ::getCppuType((const text::HorizontalAdjust*)0) ); break; + case XML_TYPE_TEXT_DRAW_ASPECT: + pPropHdl = new DrawAspectHdl; + break; } if( pPropHdl ) diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 16112015b622..e6501c1da398 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtprhdl.cxx,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: dvo $ $Date: 2001-04-27 10:55:29 $ + * last change: $Author: mib $ $Date: 2001-05-10 10:09:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -1412,8 +1412,10 @@ const XMLPropertyHandler *XMLTextPropertyHandlerFactory_Impl::GetPropertyHandler pHdl = new XMLNamedBoolPropertyHdl( OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_fixed ) ), OUString( RTL_CONSTASCII_USTRINGPARAM( sXML_line_height ) ) ); + break; case XML_TYPE_TEXT_VERTICAL_ALIGN: pHdl = new XMLConstantsPropertyHandler( pXML_VerticalAlign_Enum, 0 ); + break; } return pHdl; diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index ff5975768016..a8a74495370d 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -2,9 +2,9 @@ * * $RCSfile: txtprmap.cxx,v $ * - * $Revision: 1.47 $ + * $Revision: 1.48 $ * - * last change: $Author: mib $ $Date: 2001-05-04 09:50:32 $ + * last change: $Author: mib $ $Date: 2001-05-10 10:09:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -647,7 +647,7 @@ XMLPropertyMapEntry aXMLFramePropMap[] = M_E( "", DRAW, visible_area_top, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY, CTF_OLE_VIS_AREA_TOP ), M_E( "", DRAW, visible_area_width, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY, CTF_OLE_VIS_AREA_WIDTH ), M_E( "", DRAW, visible_area_height, XML_TYPE_MEASURE|MID_FLAG_NO_PROPERTY, CTF_OLE_VIS_AREA_HEIGHT ), - M_E( "", DRAW, draw_aspect, XML_TYPE_NUMBER16|MID_FLAG_NO_PROPERTY, CTF_OLE_DRAW_ASPECT ), + M_E( "", DRAW, draw_aspect, XML_TYPE_TEXT_DRAW_ASPECT|MID_FLAG_NO_PROPERTY, CTF_OLE_DRAW_ASPECT ), M_E( "UserDefinedAttributes", TEXT, xmlns, XML_TYPE_ATTRIBUTE_CONTAINER | MID_FLAG_SPECIAL_ITEM, 0 ), { 0, 0, 0, 0 }