diff options
-rw-r--r-- | filter/source/svg/svgreader.cxx | 24 | ||||
-rw-r--r-- | offapi/UnoApi_offapi.mk | 2 | ||||
-rw-r--r-- | svx/inc/svx/xflgrit.hxx | 5 | ||||
-rw-r--r-- | svx/source/xoutdev/xattr.cxx | 19 | ||||
-rw-r--r-- | xmloff/Library_xo.mk | 1 | ||||
-rw-r--r-- | xmloff/Package_inc.mk | 1 | ||||
-rw-r--r-- | xmloff/inc/xmloff/xmlstyle.hxx | 5 | ||||
-rw-r--r-- | xmloff/source/style/FillStyleContext.cxx | 151 | ||||
-rw-r--r-- | xmloff/source/style/FillStyleContext.hxx | 67 | ||||
-rw-r--r-- | xmloff/source/style/GradientStyle.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/style/xmlstyle.cxx | 5 |
11 files changed, 18 insertions, 274 deletions
diff --git a/filter/source/svg/svgreader.cxx b/filter/source/svg/svgreader.cxx index 51a0860c8bfb..5e9e994de348 100644 --- a/filter/source/svg/svgreader.cxx +++ b/filter/source/svg/svgreader.cxx @@ -179,6 +179,7 @@ struct AnnotatingVisitor case XML_LINEARGRADIENT: { const sal_Int32 nNumAttrs( xAttributes->getLength() ); + rtl::OUString sAttributeValue; maGradientVector.push_back(Gradient(Gradient::LINEAR)); // do we have a reference to a parent gradient? parse @@ -216,6 +217,7 @@ struct AnnotatingVisitor case XML_RADIALGRADIENT: { const sal_Int32 nNumAttrs( xAttributes->getLength() ); + rtl::OUString sAttributeValue; maGradientVector.push_back(Gradient(Gradient::RADIAL)); // do we have a reference to a parent gradient? parse @@ -253,6 +255,7 @@ struct AnnotatingVisitor case XML_STOP: { const sal_Int32 nNumAttrs( xAttributes->getLength() ); + rtl::OUString sAttributeValue; maGradientStopVector.push_back(GradientStop()); maGradientVector.back().maStops.push_back(maGradientStopVector.size()-1); for( sal_Int32 i=0; i<nNumAttrs; ++i ) @@ -515,8 +518,7 @@ struct AnnotatingVisitor double rRotate, rShearX; if( rState.maFillGradient.maTransform.decompose(rScale, rTranslate, rRotate, rShearX) ) xAttrs->AddAttribute( "draw:angle", - rtl::OUString::valueOf(rRotate*1800.0/M_PI + 900) ); - SAL_INFO("svg", "maStops " << rState.maFillGradient.maStops[0] << " " << rState.maFillGradient.maStops[1] ); + rtl::OUString::valueOf(rRotate*1800.0/M_PI ) ); xAttrs->AddAttribute( "draw:start-color", getOdfColor( maGradientStopVector[ @@ -811,11 +813,6 @@ struct AnnotatingVisitor const sal_Int32 nTokenId, const rtl::OUString& sValue ) { - rtl::OString aValueUtf8( sValue.getStr(), - sValue.getLength(), - RTL_TEXTENCODING_UTF8 ); - - SAL_INFO("svg", "nTokenId " << nTokenId); switch(nTokenId) { case XML_HREF: @@ -839,18 +836,7 @@ struct AnnotatingVisitor case XML_STYLE: parseStyle( sValue ); break; - case XML_STOP_COLOR: - parseColor( aValueUtf8.getStr(), io_rGradientStop.maStopColor ); - break; - case XML_STOP_OPACITY: - io_rGradientStop.maStopColor.a = sValue.toDouble(); - if (io_rGradientStop.maStopColor.a < 0) - io_rGradientStop.maStopColor.a = 0; - else if (io_rGradientStop.maStopColor.a > 1) - io_rGradientStop.maStopColor.a = 1; - break; default: - SAL_INFO("svg", "nTokenId unknown " << getTokenName(nTokenId)); break; } } @@ -1045,11 +1031,9 @@ struct AnnotatingVisitor parseTextAlign(maCurrState,aValueUtf8.getStr()); break; case XML_STOP_COLOR: - SAL_INFO("svg", "XML_STOP_COLOR1"); if( maGradientVector.empty() || maGradientVector.back().maStops.empty() ) break; - SAL_INFO("svg", "XML_STOP_COLOR2"); parseColor( aValueUtf8.getStr(), maGradientStopVector[ maGradientVector.back().maStops.back()].maStopColor ); diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 454b2978e6b8..56e5f4811ba8 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -1642,9 +1642,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/awt,\ FontWeight \ FontWidth \ Gradient \ - SvgGradient \ GradientStyle \ - GradientSpread \ ImageAlign \ ImagePosition \ ImageScaleMode \ diff --git a/svx/inc/svx/xflgrit.hxx b/svx/inc/svx/xflgrit.hxx index 62c04db4c78b..b4318cf1dc2c 100644 --- a/svx/inc/svx/xflgrit.hxx +++ b/svx/inc/svx/xflgrit.hxx @@ -23,7 +23,6 @@ #include <svx/xit.hxx> #include <svx/xgrad.hxx> #include "svx/svxdllapi.h" -#include <com/sun/star/awt/SvgGradient.hpp> class SdrModel; @@ -32,8 +31,8 @@ class SdrModel; //------------------------ class SVX_DLLPUBLIC XFillGradientItem : public NameOrIndex { - XGradient aGradient; - ::com::sun::star::awt::SvgGradient aSvgGradient; + XGradient aGradient; + public: TYPEINFO(); XFillGradientItem() : NameOrIndex(XATTR_FILLGRADIENT, -1) {} diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 097a34d49f9f..ce3f1de6c077 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -3443,7 +3443,6 @@ bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uI { if ( aPropSeq[n].Value >>= aGradient2 ) bGradient = true; - } } @@ -3484,19 +3483,11 @@ bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uI case MID_FILLGRADIENT: { ::com::sun::star::awt::Gradient aGradient2; - ::com::sun::star::awt::SvgGradient aSvgGradient2; - bool bIsSvgGradient(false); - - if( !(rVal >>= aGradient2) ) - { - if( !(rVal >>= aSvgGradient2) ) - return false; - bIsSvgGradient=true; - } + if(!(rVal >>= aGradient2)) + return false; XGradient aXGradient; - if ( !bIsSvgGradient ) { aXGradient.SetGradientStyle( (XGradientStyle) aGradient2.Style ); aXGradient.SetStartColor( aGradient2.StartColor ); aXGradient.SetEndColor( aGradient2.EndColor ); @@ -3507,11 +3498,7 @@ bool XFillGradientItem::PutValue( const ::com::sun::star::uno::Any& rVal, sal_uI aXGradient.SetStartIntens( aGradient2.StartIntensity ); aXGradient.SetEndIntens( aGradient2.EndIntensity ); aXGradient.SetSteps( aGradient2.StepCount ); - } - else { - aXGradient.SetStartColor( aSvgGradient2.StopColor[0] ); - aXGradient.SetEndColor( aSvgGradient2.StopColor[1] ); - } + SetGradientValue( aXGradient ); break; } diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 4b9e68dbaa77..b8164826f2df 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -196,7 +196,6 @@ $(eval $(call gb_Library_add_exception_objects,xo,\ xmloff/source/style/EnumPropertyHdl \ xmloff/source/style/FillStyleContext \ xmloff/source/style/GradientStyle \ - xmloff/source/style/SvgGradientStyle \ xmloff/source/style/HatchStyle \ xmloff/source/style/ImageStyle \ xmloff/source/style/MarkerStyle \ diff --git a/xmloff/Package_inc.mk b/xmloff/Package_inc.mk index dd324302bf81..9b3628b691db 100644 --- a/xmloff/Package_inc.mk +++ b/xmloff/Package_inc.mk @@ -22,7 +22,6 @@ $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/DashStyle.hxx,xmloff/Das $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/DocumentSettingsContext.hxx,xmloff/DocumentSettingsContext.hxx)) $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/EnumPropertyHdl.hxx,xmloff/EnumPropertyHdl.hxx)) $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/GradientStyle.hxx,xmloff/GradientStyle.hxx)) -$(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/SvgGradientStyle.hxx,xmloff/SvgGradientStyle.hxx)) $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/HatchStyle.hxx,xmloff/HatchStyle.hxx)) $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/ImageStyle.hxx,xmloff/ImageStyle.hxx)) $(eval $(call gb_Package_add_file,xmloff_inc,inc/xmloff/MarkerStyle.hxx,xmloff/MarkerStyle.hxx)) diff --git a/xmloff/inc/xmloff/xmlstyle.hxx b/xmloff/inc/xmloff/xmlstyle.hxx index 74c7b0223917..8296b24799a0 100644 --- a/xmloff/inc/xmloff/xmlstyle.hxx +++ b/xmloff/inc/xmloff/xmlstyle.hxx @@ -45,7 +45,6 @@ enum XMLStyleStylesElemTokens XML_TOK_TEXT_LIST_STYLE, XML_TOK_TEXT_OUTLINE, XML_TOK_STYLES_GRADIENTSTYLES, - XML_TOK_STYLES_LINEARGRADIENTSTYLES, XML_TOK_STYLES_HATCHSTYLES, XML_TOK_STYLES_BITMAPSTYLES, XML_TOK_STYLES_TRANSGRADIENTSTYLES, @@ -75,8 +74,8 @@ class XMLOFF_DLLPUBLIC SvXMLStyleContext : public SvXMLImportContext sal_Bool mbValid : 1; // Set this to false in CreateAndInsert // if the style shouldn't be processed - // by Finish() or is somehow invalid. - sal_Bool mbNew : 1; // Set this to false in CreateAndInsert + // by Finish() or si somehow invalid. + sal_Bool mbNew : 1; // Set this to false in CreateAnsInsert // if the style is already existing. sal_Bool mbDefaultStyle : 1; diff --git a/xmloff/source/style/FillStyleContext.cxx b/xmloff/source/style/FillStyleContext.cxx index 330573cf0ece..563da21714eb 100644 --- a/xmloff/source/style/FillStyleContext.cxx +++ b/xmloff/source/style/FillStyleContext.cxx @@ -18,11 +18,9 @@ */ #include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/awt/SvgGradient.hpp> #include "FillStyleContext.hxx" #include <xmloff/xmlimp.hxx> #include "xmloff/GradientStyle.hxx" -#include "xmloff/SvgGradientStyle.hxx" #include "xmloff/HatchStyle.hxx" #include "xmloff/ImageStyle.hxx" #include "TransGradientStyle.hxx" @@ -32,8 +30,6 @@ #include <xmloff/nmspmap.hxx> #include "xmloff/xmlnmspe.hxx" #include <xmloff/XMLBase64ImportContext.hxx> -#include <sax/tools/converter.hxx> -#include <comphelper/sequence.hxx> using namespace ::com::sun::star; using ::rtl::OUString; @@ -50,6 +46,7 @@ XMLGradientStyleContext::XMLGradientStyleContext( SvXMLImport& rImport, sal_uInt const uno::Reference< xml::sax::XAttributeList >& xAttrList) : SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList) { + // start import XMLGradientStyleImport aGradientStyle( GetImport() ); aGradientStyle.importXML( xAttrList, maAny, maStrName ); @@ -89,152 +86,6 @@ sal_Bool XMLGradientStyleContext::IsTransient() const ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// -TYPEINIT1( XMLLinearGradientStyleContext, SvXMLStyleContext ); - -XMLLinearGradientStyleContext::XMLLinearGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - const uno::Reference< xml::sax::XAttributeList >& xAttrList) -: SvXMLStyleContext(rImport, nPrfx, rLName, xAttrList) -{ - // start import - XMLSvgGradientStyleImport aGradientStyle( GetImport() ); - aGradientStyle.importXML( xAttrList, maAny, maStrName ); -} - -XMLLinearGradientStyleContext::~XMLLinearGradientStyleContext() -{ -} - - -SvXMLImportContext* XMLLinearGradientStyleContext::CreateChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) -{ - if( (XML_NAMESPACE_SVG == nPrefix) && xmloff::token::IsXMLToken( rLocalName, xmloff::token::XML_STOP ) ) - { - return new XMLSvgGradientStopImportContext(GetImport(), - nPrefix, rLocalName, - *this); - } - else - { - return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList ); - } -} - -void XMLLinearGradientStyleContext::EndElement() -{ - uno::Reference< container::XNameContainer > xGradient( GetImport().GetGradientHelper() ); - - try - { - if(xGradient.is()) - { - if( xGradient->hasByName( maStrName ) ) - { - xGradient->replaceByName( maStrName, maAny ); - } - else - { - xGradient->insertByName( maStrName, maAny ); - } - } - } - catch( container::ElementExistException& ) - {} -} - -sal_Bool XMLLinearGradientStyleContext::IsTransient() const -{ - return sal_True; -} - -void XMLLinearGradientStyleContext::SetGradientStop( ::com::sun::star::util::Color aColor, double aOffset) -{ - mStopColors.push_back( aColor ); - mStopOffsets.push_back( aOffset ); -} - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -TYPEINIT1( XMLSvgGradientStopImportContext, SvXMLImportContext ); - -XMLSvgGradientStopImportContext::XMLSvgGradientStopImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, - const OUString& rLName, - XMLLinearGradientStyleContext& rGradientStyle) - : SvXMLImportContext(rImport, nPrfx, rLName), - rGradientStyleContext(rGradientStyle) -{ -} - -XMLSvgGradientStopImportContext::~XMLSvgGradientStopImportContext() -{ -} - -void XMLSvgGradientStopImportContext::StartElement( - const uno::Reference<xml::sax::XAttributeList> & xAttrList) -{ - sal_Int16 nLength = xAttrList->getLength(); - ::util::Color aColor; - OUString colorString("black"); - double opacity = 1; - double offset=0; - double nTmp; - - for(sal_Int16 i=0; i<nLength; i++) - { - OUString sLocalName; - sal_uInt16 nPrefix = GetImport().GetNamespaceMap(). - GetKeyByAttrName( xAttrList->getNameByIndex(i), &sLocalName ); - - if ( nPrefix == XML_NAMESPACE_SVG ) - { - if ( xmloff::token::IsXMLToken(sLocalName, xmloff::token::XML_OFFSET) ) - { - SAL_INFO("svg", "offset " << sLocalName << " " << xAttrList->getValueByIndex(i)); - OUString value = xAttrList->getValueByIndex( i ); - // using convertDouble instead of convertPercent because the latter expects sal_Int32& as its first arg - if ((value.indexOf( "%" ) != -1) && ::sax::Converter::convertDouble( nTmp, value )) - { - SAL_INFO("svg", "offset converted " << nTmp/100); - offset = nTmp * 0.01; - } - else if ( ::sax::Converter::convertDouble( nTmp, value ) ) { - SAL_INFO("svg", "offset converted " << nTmp); - offset = nTmp; - } - else - { - SAL_WARN("svg", "Could not convert gradient offset " << value); - } - } - else if ( xmloff::token::IsXMLToken(sLocalName, xmloff::token::XML_STOPCOLOR) ) - { - colorString = xAttrList->getValueByIndex(i); - SAL_INFO("svg", "stop color " << sLocalName << " " << xAttrList->getValueByIndex(i)); - } - else if ( xmloff::token::IsXMLToken(sLocalName, xmloff::token::XML_STOPOPACITY) ) - { - SAL_INFO("svg", "stop opacity " << sLocalName << " " << xAttrList->getValueByIndex(i)); - ::sax::Converter::convertDouble( nTmp, xAttrList->getValueByIndex(i) ); - opacity = nTmp; - } - } - } - bool bColorSet; - bColorSet = ::sax::Converter::convertColor( aColor, colorString, opacity ); - rGradientStyleContext.SetGradientStop( aColor, offset ); -} - -void XMLSvgGradientStopImportContext::EndElement() -{ - // uno::Reference< container::XNameContainer > xGradient( GetImport().GetGradientHelper() ); - - SAL_INFO("svgb", "EndElement"); -} - -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - TYPEINIT1( XMLHatchStyleContext, SvXMLStyleContext ); XMLHatchStyleContext::XMLHatchStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, diff --git a/xmloff/source/style/FillStyleContext.hxx b/xmloff/source/style/FillStyleContext.hxx index f90c100e3017..b8d1d795864b 100644 --- a/xmloff/source/style/FillStyleContext.hxx +++ b/xmloff/source/style/FillStyleContext.hxx @@ -21,12 +21,11 @@ #define _XMLOFF_FILLSTYLECONTEXTS_HXX_ #include <com/sun/star/io/XOutputStream.hpp> -#include <com/sun/star/util/Color.hpp> #include <xmloff/xmlstyle.hxx> -#include <rtl/ustring.hxx> +#include<rtl/ustring.hxx> ////////////////////////////////////////////////////////////////////////////// -// draw:gradient context +// draw:gardient context class XMLGradientStyleContext: public SvXMLStyleContext { @@ -47,68 +46,6 @@ public: }; ////////////////////////////////////////////////////////////////////////////// -// svg:linearGradient context -class XMLLinearGradientStyleContext: public SvXMLStyleContext -{ -private: - ::com::sun::star::uno::Any maAny; - rtl::OUString maStrName; - ::std::vector< ::com::sun::star::util::Color > mStopColors; - ::std::vector< double > mStopOffsets; - -public: - TYPEINFO(); - - XMLLinearGradientStyleContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLName, - const com::sun::star::uno::Reference< - com::sun::star::xml::sax::XAttributeList> & xAttrList ); - virtual ~XMLLinearGradientStyleContext(); - - virtual void EndElement(); - - virtual sal_Bool IsTransient() const; - - void SetGradientStop( ::com::sun::star::util::Color aColor, double aOffset); - -protected: - virtual SvXMLImportContext *CreateChildContext( - sal_uInt16 nPrefix, - const ::rtl::OUString& rLocalName, - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList> & xAttrList ); -}; - -////////////////////////////////////////////////////////////////////////////// -// import svg:stop elements -class XMLSvgGradientStopImportContext : public SvXMLImportContext -{ - XMLLinearGradientStyleContext& rGradientStyleContext; - -private: - ::com::sun::star::uno::Any maAny; - -public: - - TYPEINFO(); - - XMLSvgGradientStopImportContext( - SvXMLImport& rImport, - sal_uInt16 nPrfx, - const ::rtl::OUString& rLocalName, - XMLLinearGradientStyleContext& rGradientStyle); - - ~XMLSvgGradientStopImportContext(); - -protected: - - virtual void StartElement( - const ::com::sun::star::uno::Reference< - ::com::sun::star::xml::sax::XAttributeList> & xAttrList); - - virtual void EndElement(); -}; - -////////////////////////////////////////////////////////////////////////////// // draw:hatch context class XMLHatchStyleContext: public SvXMLStyleContext diff --git a/xmloff/source/style/GradientStyle.cxx b/xmloff/source/style/GradientStyle.cxx index 0be3650be642..eb432e7dba01 100644 --- a/xmloff/source/style/GradientStyle.cxx +++ b/xmloff/source/style/GradientStyle.cxx @@ -90,8 +90,6 @@ sal_Bool XMLGradientStyleImport::importXML( uno::Any& rValue, OUString& rStrName ) { - SAL_INFO ("svg", "importXML"); - sal_Bool bRet = sal_False; sal_Bool bHasName = sal_False; sal_Bool bHasStyle = sal_False; @@ -109,7 +107,7 @@ sal_Bool XMLGradientStyleImport::importXML( { static SvXMLTokenMapEntry aGradientAttrTokenMap[] = - { +{ { XML_NAMESPACE_DRAW, XML_NAME, XML_TOK_GRADIENT_NAME }, { XML_NAMESPACE_DRAW, XML_DISPLAY_NAME, XML_TOK_GRADIENT_DISPLAY_NAME }, { XML_NAMESPACE_DRAW, XML_STYLE, XML_TOK_GRADIENT_STYLE }, @@ -128,14 +126,13 @@ sal_Bool XMLGradientStyleImport::importXML( SvXMLNamespaceMap& rNamespaceMap = rImport.GetNamespaceMap(); sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; - SAL_INFO ("svg", "nAttrCount " << nAttrCount); for( sal_Int16 i=0; i < nAttrCount; i++ ) { const OUString& rFullAttrName = xAttrList->getNameByIndex( i ); OUString aStrAttrName; sal_uInt16 nPrefix = rNamespaceMap.GetKeyByAttrName( rFullAttrName, &aStrAttrName ); const OUString& rStrValue = xAttrList->getValueByIndex( i ); - SAL_INFO ("svg", "FullAttrName: " << rFullAttrName << " rStrValue: " << rStrValue << " aStrAttrName: " << aStrAttrName); + sal_Int32 nTmpValue; switch( aTokenMap.Get( nPrefix, aStrAttrName ) ) @@ -202,8 +199,8 @@ sal_Bool XMLGradientStyleImport::importXML( break; default: - SAL_INFO("svg", "Unknown token at import gradient style"); - DBG_WARNING( "Unknown token at import gradient style" ); + DBG_WARNING( "Unknown token at import gradient style" ) + ; } } @@ -245,7 +242,6 @@ sal_Bool XMLGradientStyleExport::exportXML( sal_Bool bRet = sal_False; awt::Gradient aGradient; - if( !rStrName.isEmpty() ) { if( rValue >>= aGradient ) diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index da698c0aa557..b69f3f6b97f6 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -490,11 +490,6 @@ SvXMLStyleContext *SvXMLStylesContext::CreateStyleChildContext( sal_uInt16 p_nPr pStyle = new XMLGradientStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList ); break; } - case XML_TOK_STYLES_LINEARGRADIENTSTYLES: - { - pStyle = new XMLLinearGradientStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList ); - break; - } case XML_TOK_STYLES_HATCHSTYLES: { pStyle = new XMLHatchStyleContext( GetImport(), p_nPrefix, rLocalName, xAttrList ); |