diff options
author | Daniel Vogelheim <dvo@openoffice.org> | 2002-08-29 16:47:23 +0000 |
---|---|---|
committer | Daniel Vogelheim <dvo@openoffice.org> | 2002-08-29 16:47:23 +0000 |
commit | 10841f8eecf9e7f8106b60ffe61657e3be7e9813 (patch) | |
tree | 4260f00cf52638a45d75763e4c0a29a76736ce9d /xmloff/source/style | |
parent | 0d9c09f5be04500a71a0e8624eb0c01f060a45c3 (diff) |
#99657# load/save background (color + image) transparancy
for Writer frames
Diffstat (limited to 'xmloff/source/style')
-rw-r--r-- | xmloff/source/style/PageMasterExportPropMapper.cxx | 6 | ||||
-rw-r--r-- | xmloff/source/style/PagePropertySetContext.cxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/XMLBackgroundImageContext.cxx | 25 | ||||
-rw-r--r-- | xmloff/source/style/XMLBackgroundImageExport.cxx | 20 |
4 files changed, 46 insertions, 10 deletions
diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index ae845f526bbf..9162749f1811 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PageMasterExportPropMapper.cxx,v $ * - * $Revision: 1.12 $ + * $Revision: 1.13 $ * - * last change: $Author: sab $ $Date: 2002-04-23 13:56:56 $ + * last change: $Author: dvo $ $Date: 2002-08-29 17:46:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -323,7 +323,7 @@ void XMLPageMasterExportPropMapper::handleElementItem( pFilter = &rFilter.maValue; } sal_uInt32 nPropIndex = rProperty.mnIndex; - pThis->aBackgroundImageExport.exportXML( rProperty.maValue, pPos, pFilter, + pThis->aBackgroundImageExport.exportXML( rProperty.maValue, pPos, pFilter, NULL, getPropertySetMapper()->GetEntryNameSpace( nPropIndex ), getPropertySetMapper()->GetEntryXMLName( nPropIndex ) ); } diff --git a/xmloff/source/style/PagePropertySetContext.cxx b/xmloff/source/style/PagePropertySetContext.cxx index afc4f8260f60..05ce56d3933f 100644 --- a/xmloff/source/style/PagePropertySetContext.cxx +++ b/xmloff/source/style/PagePropertySetContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: PagePropertySetContext.cxx,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: thb $ $Date: 2001-07-24 17:06:09 $ + * last change: $Author: dvo $ $Date: 2002-08-29 17:46:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -144,6 +144,7 @@ SvXMLImportContext *PagePropertySetContext::CreateChildContext( rProp, rProp.mnIndex-2, rProp.mnIndex-1, + -1, rProperties ); break; diff --git a/xmloff/source/style/XMLBackgroundImageContext.cxx b/xmloff/source/style/XMLBackgroundImageContext.cxx index b789edb16f17..a45b5285fefb 100644 --- a/xmloff/source/style/XMLBackgroundImageContext.cxx +++ b/xmloff/source/style/XMLBackgroundImageContext.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLBackgroundImageContext.cxx,v $ * - * $Revision: 1.8 $ + * $Revision: 1.9 $ * - * last change: $Author: bm $ $Date: 2001-08-14 08:58:16 $ + * last change: $Author: dvo $ $Date: 2002-08-29 17:46:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -109,6 +109,7 @@ enum SvXMLTokenMapAttrs XML_TOK_BGIMG_POSITION, XML_TOK_BGIMG_REPEAT, XML_TOK_BGIMG_FILTER, + XML_TOK_BGIMG_TRANSPARENCY, XML_TOK_NGIMG_END=XML_TOK_UNKNOWN }; @@ -121,6 +122,7 @@ static __FAR_DATA SvXMLTokenMapEntry aBGImgAttributesAttrTokenMap[] = { XML_NAMESPACE_STYLE, XML_POSITION, XML_TOK_BGIMG_POSITION }, { XML_NAMESPACE_STYLE, XML_REPEAT, XML_TOK_BGIMG_REPEAT }, { XML_NAMESPACE_STYLE, XML_FILTER_NAME, XML_TOK_BGIMG_FILTER }, + { XML_NAMESPACE_DRAW, XML_TRANSPARENCY,XML_TOK_BGIMG_TRANSPARENCY }, XML_TOKEN_MAP_END }; @@ -361,6 +363,17 @@ void XMLBackgroundImageContext::ProcessAttrs( case XML_TOK_BGIMG_FILTER: sFilter = rValue; break; + case XML_TOK_BGIMG_TRANSPARENCY: + { + sal_Int32 nTmp; + // convert from percent and clip + if( SvXMLUnitConverter::convertPercent( nTmp, rValue ) ) + { + if( (nTmp >= 0) && (nTmp <= 100) ) + nTransparency = static_cast<sal_Int8>( nTmp ); + } + } + break; } } @@ -373,10 +386,13 @@ XMLBackgroundImageContext::XMLBackgroundImageContext( const XMLPropertyState& rProp, sal_Int32 nPosIdx, sal_Int32 nFilterIdx, + sal_Int32 nTransparencyIdx, ::std::vector< XMLPropertyState > &rProps ) : XMLElementPropertyContext( rImport, nPrfx, rLName, rProp, rProps ), aPosProp( nPosIdx ), - aFilterProp( nFilterIdx ) + aFilterProp( nFilterIdx ), + aTransparencyProp( nTransparencyIdx ), + nTransparency( 0 ) { ProcessAttrs( xAttrList ); } @@ -431,6 +447,7 @@ void XMLBackgroundImageContext::EndElement() aProp.maValue <<= sURL; aPosProp.maValue <<= ePos; aFilterProp.maValue <<= sFilter; + aTransparencyProp.maValue <<= nTransparency; SetInsert( sal_True ); XMLElementPropertyContext::EndElement(); @@ -439,4 +456,6 @@ void XMLBackgroundImageContext::EndElement() rProperties.push_back( aPosProp ); if( -1 != aFilterProp.mnIndex ) rProperties.push_back( aFilterProp ); + if( -1 != aTransparencyProp.mnIndex ) + rProperties.push_back( aTransparencyProp ); } diff --git a/xmloff/source/style/XMLBackgroundImageExport.cxx b/xmloff/source/style/XMLBackgroundImageExport.cxx index dd361ba2f2a9..2d3a8e23460f 100644 --- a/xmloff/source/style/XMLBackgroundImageExport.cxx +++ b/xmloff/source/style/XMLBackgroundImageExport.cxx @@ -2,9 +2,9 @@ * * $RCSfile: XMLBackgroundImageExport.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: dvo $ $Date: 2001-06-29 21:07:17 $ + * last change: $Author: dvo $ $Date: 2002-08-29 17:46:18 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -78,6 +78,9 @@ #ifndef _XMLBACKGROUNDIMAGEEXPORT_HXX #include "XMLBackgroundImageExport.hxx" #endif +#ifndef _XMLOFF_XMLUCONV_HXX +#include "xmluconv.hxx" +#endif using namespace ::rtl; using namespace ::com::sun::star; @@ -97,6 +100,7 @@ XMLBackgroundImageExport::~XMLBackgroundImageExport() void XMLBackgroundImageExport::exportXML( const Any& rURL, const Any *pPos, const Any *pFilter, + const Any *pTransparency, sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName ) { @@ -185,6 +189,18 @@ void XMLBackgroundImageExport::exportXML( const Any& rURL, GetExport().AddAttribute( XML_NAMESPACE_STYLE, XML_FILTER_NAME, sFilter ); } + + if( pTransparency ) + { + sal_Int8 nTransparency; + if( (*pTransparency) >>= nTransparency ) + { + OUStringBuffer aOut; + SvXMLUnitConverter::convertPercent( aOut, nTransparency ); + GetExport().AddAttribute( XML_NAMESPACE_DRAW, XML_TRANSPARENCY, + aOut.makeStringAndClear() ); + } + } } { |