diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:51:11 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:51:11 +0200 |
commit | 200bc6c582d6cf2365001f27928c1e3d1f9c9845 (patch) | |
tree | 0f27abe75bc3603341aef715372676aee8d86835 /xmloff | |
parent | 01ea92166c12fe080575f8faba4162779fb46c28 (diff) | |
parent | 1b465fcc0f5f699308c6ee5113dde6b82842c3dd (diff) |
resyncing to master
Diffstat (limited to 'xmloff')
34 files changed, 191 insertions, 1256 deletions
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk index 1ded182ff63e..1e63c7ae463a 100644 --- a/xmloff/Library_xo.mk +++ b/xmloff/Library_xo.mk @@ -37,13 +37,17 @@ $(eval $(call gb_Library_set_include,xo,\ $$(SOLARINC) \ -I$(realpath $(SRCDIR)/xmloff/inc) \ -I$(realpath $(SRCDIR)/xmloff/inc/pch) \ - -I$(OUTDIR)/inc/offuh \ )) $(eval $(call gb_Library_add_defs,xo,\ -DXMLOFF_DLLIMPLEMENTATION \ )) +$(eval $(call gb_Library_add_api,xo,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,xo,\ basegfx \ comphelper \ diff --git a/xmloff/Library_xof.mk b/xmloff/Library_xof.mk index 2ed555d7ac41..1e15e558341f 100644 --- a/xmloff/Library_xof.mk +++ b/xmloff/Library_xof.mk @@ -33,7 +33,11 @@ $(eval $(call gb_Library_set_include,xof,\ -I$(realpath $(SRCDIR)/xmloff/inc/pch) \ -I$(realpath $(SRCDIR)/xmloff/inc) \ $$(INCLUDE) \ - -I$(OUTDIR)/inc/offuh \ +)) + +$(eval $(call gb_Library_add_api,xof,\ + udkapi \ + offapi \ )) $(eval $(call gb_Library_add_linked_libs,xof,\ diff --git a/xmloff/inc/xexptran.hxx b/xmloff/inc/xexptran.hxx index bd2c55d6557e..5fbd83500be6 100644 --- a/xmloff/inc/xexptran.hxx +++ b/xmloff/inc/xexptran.hxx @@ -30,11 +30,10 @@ #define _XEXPTRANSFORM_HXX #include <rtl/ustring.hxx> -#include <com/sun/star/drawing/PointSequenceSequence.hpp> +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> #include <com/sun/star/drawing/PointSequence.hpp> -#include <com/sun/star/awt/Size.hpp> -#include <com/sun/star/drawing/FlagSequenceSequence.hpp> #include <com/sun/star/drawing/FlagSequence.hpp> +#include <com/sun/star/awt/Size.hpp> #include <com/sun/star/drawing/HomogenMatrix.hpp> #include <tools/mapunit.hxx> @@ -173,8 +172,7 @@ class SdXMLImExSvgDElement sal_Int32 mnLastX; sal_Int32 mnLastY; - com::sun::star::drawing::PointSequenceSequence maPoly; - com::sun::star::drawing::FlagSequenceSequence maFlag; + com::sun::star::drawing::PolyPolygonBezierCoords maPoly; public: SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox); @@ -194,8 +192,8 @@ public: const rtl::OUString& GetExportString() const { return msString; } bool IsClosed() const { return mbIsClosed; } bool IsCurve() const { return mbIsCurve; } - const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly; } - const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maFlag; } + const com::sun::star::drawing::PointSequenceSequence& GetPointSequenceSequence() const { return maPoly.Coordinates; } + const com::sun::star::drawing::FlagSequenceSequence& GetFlagSequenceSequence() const { return maPoly.Flags; } }; diff --git a/xmloff/source/chart/MultiPropertySetHandler.hxx b/xmloff/source/chart/MultiPropertySetHandler.hxx index 160b9f218807..ab0ce3ae389d 100644 --- a/xmloff/source/chart/MultiPropertySetHandler.hxx +++ b/xmloff/source/chart/MultiPropertySetHandler.hxx @@ -246,7 +246,7 @@ sal_Bool MultiPropertySetHandler::MultiGet (const ::com::sun::star::uno::Se for (I=aPropertyList.begin(),i=0; I!=aPropertyList.end(); I++) I->second->SetValue (aValueList[i++]); } - catch (::com::sun::star::beans::UnknownPropertyException e) + catch (const ::com::sun::star::beans::UnknownPropertyException&) { return sal_False; } @@ -272,7 +272,7 @@ sal_Bool MultiPropertySetHandler::SingleGet (const ::com::sun::star::uno::Se for (I=aPropertyList.begin(),i=0; I!=aPropertyList.end(); I++) I->second->SetValue (xSingleSet->getPropertyValue (rNameList[i++])); } - catch (::com::sun::star::beans::UnknownPropertyException e) + catch (const ::com::sun::star::beans::UnknownPropertyException&) { return sal_False; } diff --git a/xmloff/source/chart/PropertyMaps.cxx b/xmloff/source/chart/PropertyMaps.cxx index 6cb029d9b1bf..f49e1b571fc6 100644 --- a/xmloff/source/chart/PropertyMaps.cxx +++ b/xmloff/source/chart/PropertyMaps.cxx @@ -275,7 +275,7 @@ void XMLChartExportPropertyMapper::ContextFilter( if( bAuto ) property->mnIndex = -1; } - catch( beans::UnknownPropertyException ) + catch(const beans::UnknownPropertyException&) { } } diff --git a/xmloff/source/chart/SchXMLChartContext.cxx b/xmloff/source/chart/SchXMLChartContext.cxx index ccce0fc6bb33..fd245ac20590 100644 --- a/xmloff/source/chart/SchXMLChartContext.cxx +++ b/xmloff/source/chart/SchXMLChartContext.cxx @@ -115,7 +115,7 @@ void lcl_MoveDataToCandleStickSeries( xSink->setData( aData ); } } - catch( uno::Exception & ) + catch(const uno::Exception&) { OSL_FAIL( "Exception caught while moving data to candlestick series" ); } @@ -173,7 +173,7 @@ void lcl_removeEmptyChartTypeGroups( const uno::Reference< chart2::XChartDocumen } } } - catch( uno::Exception & ex ) + catch(const uno::Exception& ex) { String aStr( ex.Message ); ByteString aBStr( aStr, RTL_TEXTENCODING_ASCII_US ); @@ -370,7 +370,7 @@ void SchXMLChartContext::StartElement( const uno::Reference< xml::sax::XAttribut maChartTypeServiceName = SchXMLTools::GetNewChartTypeName( aOldChartTypeName ); xDocProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RefreshAddInAllowed" )) , uno::makeAny( sal_False) ); } - catch( uno::Exception & ) + catch(const uno::Exception&) { OSL_FAIL( "Exception during import SchXMLChartContext::StartElement" ); } @@ -709,7 +709,7 @@ void SchXMLChartContext::EndElement() aAny <<= maMainTitle; xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny ); } - catch( beans::UnknownPropertyException ) + catch(const beans::UnknownPropertyException&) { OSL_FAIL( "Property String for Title not available" ); } @@ -726,7 +726,7 @@ void SchXMLChartContext::EndElement() aAny <<= maSubTitle; xTitleProp->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "String" )), aAny ); } - catch( beans::UnknownPropertyException ) + catch(const beans::UnknownPropertyException&) { OSL_FAIL( "Property String for Title not available" ); } @@ -826,7 +826,7 @@ void SchXMLChartContext::EndElement() // (analogously mbColHasLabels means we have "row-descriptions") lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans ); } - catch( uno::Exception & ) + catch(const uno::Exception&) { //try to fallback to internal data OSL_FAIL( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram try to fallback to internal data" ); @@ -842,7 +842,7 @@ void SchXMLChartContext::EndElement() { lcl_ApplyDataFromRectangularRangeToDiagram( xNewDoc, msChartAddress, meDataRowSource, mbRowHasLabels, mbColHasLabels, bHasOwnData, msColTrans, msRowTrans ); } - catch( uno::Exception & ) + catch(const uno::Exception&) { OSL_FAIL( "Exception during import SchXMLChartContext::lcl_ApplyDataFromRectangularRangeToDiagram fallback to internal data failed also" ); } @@ -994,7 +994,7 @@ void SchXMLChartContext::MergeSeriesForStockChart() xDSContainer->setDataSeries( aNewSeries ); } } - catch( uno::Exception & ) + catch(const uno::Exception&) { OSL_FAIL( "Exception while merging series for stock chart" ); } diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index f87160839d03..df497d08770c 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -563,30 +563,6 @@ sal_Int32 lcl_getSequenceLengthByRole( return 0; } -bool lcl_hasChartType( const Reference< chart2::XDiagram > & xDiagram, const OUString & rChartType ) -{ - try - { - Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx ) - { - Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes()); - for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx ) - { - if( aChartTypes[nCTIdx]->getChartType().equals( rChartType )) - return true; - } - } - } - catch( uno::Exception & ) - { - OSL_FAIL( "Exception while searching for chart type in diagram" ); - } - return false; -} - OUString lcl_flattenStringSequence( const Sequence< OUString > & rSequence ) { OUStringBuffer aResult; diff --git a/xmloff/source/chart/SchXMLLegendContext.cxx b/xmloff/source/chart/SchXMLLegendContext.cxx index c85353d7ca36..a1ce1484f8c0 100644 --- a/xmloff/source/chart/SchXMLLegendContext.cxx +++ b/xmloff/source/chart/SchXMLLegendContext.cxx @@ -116,7 +116,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu { xDocProp->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HasLegend" )), uno::makeAny( sal_True ) ); } - catch( beans::UnknownPropertyException ) + catch(const beans::UnknownPropertyException&) { OSL_TRACE( "Property HasLegend not found" ); } @@ -162,7 +162,7 @@ void SchXMLLegendContext::StartElement( const uno::Reference< xml::sax::XAttribu if( SchXMLEnumConverter::getLegendPositionConverter().importXML( aValue, aAny, GetImport().GetMM100UnitConverter() ) ) xLegendProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Alignment" )), aAny ); } - catch( beans::UnknownPropertyException ) + catch(const beans::UnknownPropertyException&) { OSL_TRACE( "Property Alignment (legend) not found" ); } diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index 0252117adf4e..55e5f3d9e358 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -76,71 +76,6 @@ const OUString lcl_aCategoriesRange( RTL_CONSTASCII_USTRINGPARAM("categories")); typedef ::std::multimap< ::rtl::OUString, ::rtl::OUString > lcl_tOriginalRangeToInternalRangeMap; -Sequence< OUString > lcl_getCategoriesFromTable( const SchXMLTable & rTable, bool bHasLabels ) -{ - sal_Int32 nNumRows( static_cast< sal_Int32 >( rTable.aData.size())); - OSL_ENSURE( static_cast< size_t >( nNumRows ) == rTable.aData.size(), "Table too big" ); - - sal_Int32 nOffset(bHasLabels ? 1 : 0); - Sequence< OUString > aResult( nNumRows - nOffset ); - sal_Int32 i=nOffset; - for( ; i<nNumRows; ++i ) - { - if( !rTable.aData[i].empty() && (rTable.aData[i].front().eType == SCH_CELL_TYPE_STRING )) - aResult[i - nOffset] = rTable.aData[i].front().aString; - } - return aResult; -} - -std::vector< Reference< chart2::XAxis > > lcl_getAxesHoldingCategoriesFromDiagram( - const Reference< chart2::XDiagram > & xDiagram ) -{ - std::vector< Reference< chart2::XAxis > > aRet; - - Reference< chart2::XAxis > xResult; - // return first x-axis as fall-back - Reference< chart2::XAxis > xFallBack; - try - { - Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( - xDiagram, uno::UNO_QUERY_THROW ); - Sequence< Reference< chart2::XCoordinateSystem > > aCooSysSeq( - xCooSysCnt->getCoordinateSystems()); - for( sal_Int32 i=0; i<aCooSysSeq.getLength(); ++i ) - { - Reference< chart2::XCoordinateSystem > xCooSys( aCooSysSeq[i] ); - OSL_ASSERT( xCooSys.is()); - for( sal_Int32 nN = xCooSys->getDimension(); nN--; ) - { - const sal_Int32 nMaximumScaleIndex = xCooSys->getMaximumAxisIndexByDimension(nN); - for(sal_Int32 nI=0; nI<=nMaximumScaleIndex; ++nI) - { - Reference< chart2::XAxis > xAxis = xCooSys->getAxisByDimension( nN,nI ); - OSL_ASSERT( xAxis.is()); - if( xAxis.is()) - { - chart2::ScaleData aScaleData = xAxis->getScaleData(); - if( aScaleData.Categories.is() || (aScaleData.AxisType == chart2::AxisType::CATEGORY) ) - { - aRet.push_back(xAxis); - } - if( (nN == 0) && !xFallBack.is()) - xFallBack.set( xAxis ); - } - } - } - } - } - catch( uno::Exception & ) - { - } - - if( aRet.empty()) - aRet.push_back(xFallBack); - - return aRet; -} - struct lcl_ApplyCellToData : public ::std::unary_function< SchXMLCell, void > { lcl_ApplyCellToData( Sequence< double > & rOutData ) : @@ -175,22 +110,6 @@ private: double m_fNaN; }; -Sequence< Sequence< double > > lcl_getSwappedArray( const Sequence< Sequence< double > > & rData ) -{ - sal_Int32 nOldOuterSize = rData.getLength(); - sal_Int32 nOldInnerSize = (nOldOuterSize == 0 ? 0 : rData[0].getLength()); - Sequence< Sequence< double > > aResult( nOldInnerSize ); - - for( sal_Int32 i=0; i<nOldInnerSize; ++i ) - aResult[i].realloc( nOldOuterSize ); - - for( sal_Int32 nOuter=0; nOuter<nOldOuterSize; ++nOuter ) - for( sal_Int32 nInner=0; nInner<nOldInnerSize; ++nInner ) - aResult[nInner][nOuter] = rData[nOuter][nInner]; - - return aResult; -} - void lcl_fillRangeMapping( const SchXMLTable & rTable, lcl_tOriginalRangeToInternalRangeMap & rOutRangeMap, diff --git a/xmloff/source/core/facreg.cxx b/xmloff/source/core/facreg.cxx index e50ecad6710d..3acd7223548c 100644 --- a/xmloff/source/core/facreg.cxx +++ b/xmloff/source/core/facreg.cxx @@ -164,11 +164,6 @@ extern "C" { #endif -XMLOFF_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - #define SINGLEFACTORY(classname)\ if( classname##_getImplementationName().equalsAsciiL( pImplName, nImplNameLen ) )\ {\ @@ -178,7 +173,7 @@ XMLOFF_DLLPUBLIC void SAL_CALL component_getImplementationEnvironment( const sal classname##_getSupportedServiceNames() );\ } -XMLOFF_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +XMLOFF_DLLPUBLIC void * SAL_CALL xo_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = 0; if( pServiceManager ) diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 2d407f41bfc3..3002548674df 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -736,7 +736,7 @@ void SAL_CALL SvXMLExport::setSourceDocument( const uno::Reference< lang::XCompo } } } - catch( com::sun::star::uno::Exception& ) + catch(const com::sun::star::uno::Exception&) { } } @@ -913,7 +913,7 @@ sal_Bool SAL_CALL SvXMLExport::filter( const uno::Sequence< beans::PropertyValue exportDoc( meClass ); } - catch( uno::Exception e ) + catch(const uno::Exception& e) { // We must catch exceptions, because according to the // API definition export must not throw one! @@ -1308,7 +1308,7 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) bOwnEmbeddedResolver = mxEmbeddedResolver.is(); } } - catch( com::sun::star::uno::Exception& ) + catch(const com::sun::star::uno::Exception&) { } } @@ -1360,7 +1360,7 @@ sal_uInt32 SvXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum eClass ) mxExtHandler = uno::Reference<xml::sax::XExtendedDocumentHandler>( mxHandler, UNO_QUERY ); } } - catch( com::sun::star::uno::Exception& ) + catch(const com::sun::star::uno::Exception&) { } } @@ -1621,14 +1621,16 @@ void SvXMLExport::_ExportStyles( sal_Bool ) aGradientStyle.exportXML( rStrName, aValue ); } - catch( container::NoSuchElementException& ) - {} + catch(const container::NoSuchElementException&) + { + } } } } } - catch( lang::ServiceNotRegisteredException& ) - {} + catch(const lang::ServiceNotRegisteredException&) + { + } // export (fill-)hatch-styles try @@ -1652,14 +1654,15 @@ void SvXMLExport::_ExportStyles( sal_Bool ) aHatchStyle.exportXML( rStrName, aValue ); } - catch( container::NoSuchElementException& ) + catch(const container::NoSuchElementException&) {} } } } } - catch( lang::ServiceNotRegisteredException& ) - {} + catch(const lang::ServiceNotRegisteredException&) + { + } // export (fill-)bitmap-styles try @@ -1683,14 +1686,16 @@ void SvXMLExport::_ExportStyles( sal_Bool ) aImageStyle.exportXML( rStrName, aValue, *this ); } - catch( container::NoSuchElementException& ) - {} + catch(const container::NoSuchElementException&) + { + } } } } } - catch( lang::ServiceNotRegisteredException& ) - {} + catch(const lang::ServiceNotRegisteredException&) + { + } // export transparency-gradient -styles try @@ -1714,14 +1719,16 @@ void SvXMLExport::_ExportStyles( sal_Bool ) aTransGradientstyle.exportXML( rStrName, aValue ); } - catch( container::NoSuchElementException& ) - {} + catch(const container::NoSuchElementException&) + { + } } } } } - catch( lang::ServiceNotRegisteredException& ) - {} + catch(const lang::ServiceNotRegisteredException&) + { + } // export marker-styles try @@ -1745,14 +1752,16 @@ void SvXMLExport::_ExportStyles( sal_Bool ) aMarkerStyle.exportXML( rStrName, aValue ); } - catch( container::NoSuchElementException& ) - {} + catch(const container::NoSuchElementException&) + { + } } } } } - catch( lang::ServiceNotRegisteredException& ) - {} + catch(const lang::ServiceNotRegisteredException&) + { + } // export dash-styles try @@ -1776,14 +1785,16 @@ void SvXMLExport::_ExportStyles( sal_Bool ) aDashStyle.exportXML( rStrName, aValue ); } - catch( container::NoSuchElementException& ) - {} + catch(const container::NoSuchElementException&) + { + } } } } } - catch( lang::ServiceNotRegisteredException& ) - {} + catch(const lang::ServiceNotRegisteredException&) + { + } } } @@ -2226,7 +2237,7 @@ OUString SvXMLExport::GetRelativeReference(const OUString& rValue) sValue = aTemp.smartRel2Abs(sValue, bWasAbsolute ).GetMainURL(INetURLObject::DECODE_TO_IURI); } } - catch( uno::Exception& ) + catch(const uno::Exception&) { } } @@ -2262,13 +2273,13 @@ void SvXMLExport::StartElement(const OUString& rName, mxHandler->ignorableWhitespace( msWS ); mxHandler->startElement( rName, GetXAttrList() ); } - catch ( SAXInvalidCharacterException& e ) + catch (const SAXInvalidCharacterException& e) { Sequence<OUString> aPars(1); aPars[0] = rName; SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL ); } - catch ( SAXException& e ) + catch (const SAXException& e) { Sequence<OUString> aPars(1); aPars[0] = rName; @@ -2288,13 +2299,13 @@ void SvXMLExport::Characters(const ::rtl::OUString& rChars) { mxHandler->characters(rChars); } - catch ( SAXInvalidCharacterException& e ) + catch (const SAXInvalidCharacterException& e) { Sequence<OUString> aPars(1); aPars[0] = rChars; SetError( XMLERROR_SAX|XMLERROR_FLAG_WARNING, aPars, e.Message, NULL ); } - catch ( SAXException& e ) + catch (const SAXException& e) { Sequence<OUString> aPars(1); aPars[0] = rChars; @@ -2336,7 +2347,7 @@ void SvXMLExport::EndElement(const OUString& rName, mxHandler->ignorableWhitespace( msWS ); mxHandler->endElement( rName ); } - catch ( SAXException& e ) + catch (const SAXException& e) { Sequence<OUString> aPars(1); aPars[0] = rName; @@ -2357,7 +2368,7 @@ void SvXMLExport::IgnorableWhitespace() { mxHandler->ignorableWhitespace( msWS ); } - catch ( SAXException& e ) + catch (const SAXException& e) { Sequence<OUString> aPars(0); SetError( XMLERROR_SAX|XMLERROR_FLAG_ERROR|XMLERROR_FLAG_SEVERE, diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx index 92d1b9a8e408..d92bb7cab331 100644 --- a/xmloff/source/draw/XMLImageMapContext.cxx +++ b/xmloff/source/draw/XMLImageMapContext.cxx @@ -667,7 +667,7 @@ XMLImageMapContext::XMLImageMapContext( if( xInfo.is() && xInfo->hasPropertyByName( sImageMap ) ) xPropertySet->getPropertyValue(sImageMap) >>= xImageMap; } - catch( com::sun::star::uno::Exception e ) + catch(const com::sun::star::uno::Exception& e) { uno::Sequence<OUString> aSeq(0); rImport.SetError( XMLERROR_FLAG_WARNING | XMLERROR_API, aSeq, e.Message, NULL ); diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx index 312b7d7ab5fc..d6b0eaf49215 100644 --- a/xmloff/source/draw/animexp.cxx +++ b/xmloff/source/draw/animexp.cxx @@ -300,13 +300,10 @@ void XMLAnimationsExporter::prepare( Reference< XShape > xShape, SvXMLExport& ) { Reference< XShape > xPath; xProps->getPropertyValue( mpImpl->msAnimPath ) >>= xPath; -// strip if( xPath.is() ) -// strip mrExport.getInterfaceToIdentifierMapper()->registerReference( xShape ); -// strip mpImpl->mxShapeExp->createShapeId( xPath ); } } } - catch( Exception e ) + catch(const Exception&) { OSL_FAIL("exception catched while collection animation information!"); } @@ -437,7 +434,7 @@ void XMLAnimationsExporter::collect( Reference< XShape > xShape, SvXMLExport& rE } } } - catch( Exception e ) + catch(const Exception&) { OSL_FAIL("exception catched while collection animation information!"); } diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx index d785725203fa..a9882591f69f 100644 --- a/xmloff/source/draw/animimp.cxx +++ b/xmloff/source/draw/animimp.cxx @@ -666,7 +666,7 @@ void XMLAnimationsEffectContext::EndElement() } } } - catch( Exception e ) + catch(const Exception&) { OSL_FAIL( "exception catched while importing animation information!" ); } diff --git a/xmloff/source/draw/sdxmlexp.cxx b/xmloff/source/draw/sdxmlexp.cxx index 29db93ca8226..6c4343eff192 100644 --- a/xmloff/source/draw/sdxmlexp.cxx +++ b/xmloff/source/draw/sdxmlexp.cxx @@ -1630,9 +1630,8 @@ HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( cons } } } - catch( Exception& e ) + catch(const Exception&) { - (void)e; OSL_FAIL( "SdXMLExport::ImpPrepDrawPageHeaderFooterDecls(), unexpected exception cought!" ); } @@ -1945,7 +1944,7 @@ void SdXMLExport::_ExportContent() AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST ); } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL(" no \"BookmarkURL\" property at page?" ); } @@ -2236,7 +2235,7 @@ void SdXMLExport::exportPresentationSettings() } } } - catch( uno::Exception ) + catch(const uno::Exception&) { OSL_FAIL( "uno::Exception while exporting <presentation:settings>" ); } @@ -2747,7 +2746,7 @@ OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPag } } } - catch( Exception& ) + catch(const Exception&) { } return sNavOrder.makeStringAndClear(); @@ -2772,7 +2771,7 @@ void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDraw } } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("SdXMLExport::collectAnnotationAutoStyles(), exception caught during export of annotation auto styles"); } @@ -2839,7 +2838,7 @@ void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) while( xAnnotationEnumeration->hasMoreElements() ); } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("SdXMLExport::exportAnnotations(), exception caught during export of annotations"); } diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 2d6f09187b6a..53f16c9a2efa 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -916,7 +916,7 @@ void SdXMLImport::SetViewSettings(const com::sun::star::uno::Sequence<com::sun:: { xPropSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), uno::makeAny( aVisArea ) ); } - catch( com::sun::star::uno::Exception /*e*/ ) + catch(const com::sun::star::uno::Exception&) { /* #i79978# since old documents may contain invalid view settings, this is nothing to worry the user about. uno::Sequence<OUString> aSeq(0); @@ -950,9 +950,8 @@ void SdXMLImport::SetConfigurationSettings(const com::sun::star::uno::Sequence<c if( xInfo->hasPropertyByName( rProperty ) ) xProps->setPropertyValue( rProperty, pValues->Value ); } - catch( uno::Exception& e ) + catch(const uno::Exception&) { - (void)e; OSL_TRACE( "#SdXMLImport::SetConfigurationSettings: Exception!" ); } diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx index c3f66197a403..1a76bb860a49 100644 --- a/xmloff/source/draw/shapeexport.cxx +++ b/xmloff/source/draw/shapeexport.cxx @@ -300,7 +300,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap aShapeInfo.mnFamily = XML_STYLE_FAMILY_SD_PRESENTATION_ID; } } - catch(beans::UnknownPropertyException aException) + catch(const beans::UnknownPropertyException&) { // Ignored. DBG_ASSERT(false, @@ -471,7 +471,7 @@ void XMLShapeExport::collectShapeAutoStyles(const uno::Reference< drawing::XShap uno::Reference< table::XColumnRowRange > xRange( xSet->getPropertyValue( msModel ), uno::UNO_QUERY_THROW ); GetShapeTableExport()->collectTableAutoStyles( xRange ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "XMLShapeExport::collectShapeAutoStyles(): exception caught while collection auto styles for a table!" ); } @@ -560,7 +560,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape } } } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL("XMLShapeExport::exportShape(): exception during hyperlink export"); } @@ -683,7 +683,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_LAYER, aLayerName ); } - catch( uno::Exception e ) + catch(const uno::Exception& e) { OSL_FAIL( "could not export layer name for shape!" ); } @@ -717,7 +717,7 @@ void XMLShapeExport::exportShape(const uno::Reference< drawing::XShape >& xShape if( eDisplayToken != XML_TOKEN_INVALID ) mrExport.AddAttribute(XML_NAMESPACE_DRAW_EXT, XML_DISPLAY, eDisplayToken ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "XMLShapeExport::exportShape(), exception caught!" ); } @@ -1156,7 +1156,7 @@ void XMLShapeExport::ImpCalcShapeType(const uno::Reference< drawing::XShape >& x } } } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "XMLShapeExport::ImpCalcShapeType(), expected ole shape to have the CLSID property?" ); } @@ -1260,7 +1260,7 @@ void XMLShapeExport::ExportGraphicDefaults() aStEx.exportStyleFamily("graphics", OUString(RTL_CONSTASCII_USTRINGPARAM(XML_STYLE_FAMILY_SD_GRAPHICS_NAME)), xPropertySetMapper, sal_False, XML_STYLE_FAMILY_SD_GRAPHICS_ID); } } - catch( lang::ServiceNotRegisteredException& ) + catch(const lang::ServiceNotRegisteredException&) { } } diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx index 0834ea1218ec..d0c7bc393214 100644 --- a/xmloff/source/draw/xexptran.cxx +++ b/xmloff/source/draw/xexptran.cxx @@ -37,6 +37,9 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/tuple/b3dtuple.hxx> #include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolypolygontools.hxx> +#include <basegfx/tools/unotools.hxx> #include <tools/string.hxx> using ::rtl::OUString; @@ -53,7 +56,19 @@ using namespace ::com::sun::star; // Predeclarations void Imp_SkipDouble(const OUString& rStr, sal_Int32& rPos, const sal_Int32 nLen); -void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection); +void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection) +{ + const sal_Int32 nLen1(FRound(aVec1.getLength())); + const sal_Int32 nLen2(FRound(aVec2.getLength())); + aVec1.normalize(); + aVec2.normalize(); + aVec1 += aVec2; + const sal_Int32 nLen3(FRound(aVec1.getLength() * ((nLen1 + nLen2) / 2.0))); + + bSameLength = (abs(nLen1 - nLen2) <= BORDER_INTEGERS_ARE_EQUAL); + bSameDirection = (nLen3 <= BORDER_INTEGERS_ARE_EQUAL); +} + ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -132,14 +147,6 @@ void Imp_SkipNumberAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos, Imp_SkipSpacesAndCommas(rStr, rPos, nLen); } -// #100617# Allow to skip doubles, too. -void Imp_SkipDoubleAndSpacesAndCommas(const OUString& rStr, sal_Int32& rPos, - const sal_Int32 nLen) -{ - Imp_SkipDouble(rStr, rPos, nLen); - Imp_SkipSpacesAndCommas(rStr, rPos, nLen); -} - void Imp_PutNumberChar(OUString& rStr, sal_Int32 nValue) { OUStringBuffer sStringBuffer; @@ -1520,8 +1527,7 @@ SdXMLImExSvgDElement::SdXMLImExSvgDElement(const SdXMLImExViewBox& rViewBox) mbIsCurve( false ), mnLastX( 0L ), mnLastY( 0L ), - maPoly( 0L ), - maFlag( 0L ) + maPoly() { } @@ -1583,6 +1589,8 @@ void SdXMLImExSvgDElement::AddPolygon( const awt::Size& rObjectSize, bool bClosed, bool bRelative) { + // Leaving the export stuff for the while, should eventually also + // consolidated with basegfx svg support DBG_ASSERT(pPoints, "Empty PointSequence handed over to SdXMLImExSvgDElement(!)"); sal_Int32 nCnt(pPoints->getLength()); @@ -2151,964 +2159,44 @@ void SdXMLImExSvgDElement::AddPolygon( } } -// #100617# Linear double reader -double Imp_ImportDoubleAndSpaces( - double fRetval, const OUString& rStr, sal_Int32& rPos, - const sal_Int32 nLen, const SvXMLUnitConverter& rConv) -{ - fRetval = Imp_GetDoubleChar(rStr, rPos, nLen, rConv, fRetval); - Imp_SkipSpacesAndCommas(rStr, rPos, nLen); - return fRetval; -} - -// #100617# Allow to read doubles, too. This will need to be changed to -// the usage of Imp_ImportDoubleAndSpaces(...). For now, this is sufficient -// since the interface cannot transport doubles. -sal_Int32 Imp_ImportNumberAndSpaces( - sal_Int32 nRetval, const OUString& rStr, sal_Int32& rPos, - const sal_Int32 nLen, const SvXMLUnitConverter& rConv) -{ - nRetval = FRound(Imp_ImportDoubleAndSpaces(double(nRetval), rStr, rPos, nLen, rConv)); - Imp_SkipSpacesAndCommas(rStr, rPos, nLen); - return nRetval; -} - -void Imp_PrepareCoorImport(sal_Int32& nX, sal_Int32& nY, - const awt::Point& rObjectPos, const awt::Size& rObjectSize, - const SdXMLImExViewBox& rViewBox, const bool bScale, const bool bTranslate) -{ - if(bTranslate) - { - nX -= rViewBox.GetX(); - nY -= rViewBox.GetY(); - } - - if(bScale && rViewBox.GetWidth() && rViewBox.GetHeight()) - { - nX = (nX * rObjectSize.Width) / rViewBox.GetWidth(); - nY = (nY * rObjectSize.Height) / rViewBox.GetHeight(); - } - - nX += rObjectPos.X; - nY += rObjectPos.Y; -} - -void Imp_AddExportPoints(sal_Int32 nX, sal_Int32 nY, - awt::Point* pPoints, drawing::PolygonFlags* pFlags, - const sal_Int32 nInnerIndex, - drawing::PolygonFlags eFlag) -{ - if(pPoints) - pPoints[nInnerIndex] = awt::Point( nX, nY ); - - if(pFlags) - pFlags[nInnerIndex] = eFlag; -} - -void Imp_CalcVectorValues(::basegfx::B2DVector& aVec1, ::basegfx::B2DVector& aVec2, bool& bSameLength, bool& bSameDirection) -{ - const sal_Int32 nLen1(FRound(aVec1.getLength())); - const sal_Int32 nLen2(FRound(aVec2.getLength())); - aVec1.normalize(); - aVec2.normalize(); - aVec1 += aVec2; - const sal_Int32 nLen3(FRound(aVec1.getLength() * ((nLen1 + nLen2) / 2.0))); - - bSameLength = (abs(nLen1 - nLen2) <= BORDER_INTEGERS_ARE_EQUAL); - bSameDirection = (nLen3 <= BORDER_INTEGERS_ARE_EQUAL); -} - -void Imp_CorrectPolygonFlag(const sal_uInt32 nInnerIndex, const awt::Point* const pInnerSequence, - drawing::PolygonFlags* const pInnerFlags, const sal_Int32 nX1, const sal_Int32 nY1) -{ - if(nInnerIndex) - { - const awt::Point aPPrev1 = pInnerSequence[nInnerIndex - 1]; - - if(nInnerIndex > 1) - { - const awt::Point aPPrev2 = pInnerSequence[nInnerIndex - 2]; - const drawing::PolygonFlags aFPrev2 = pInnerFlags[nInnerIndex - 2]; - ::basegfx::B2DVector aVec1(aPPrev2.X - aPPrev1.X, aPPrev2.Y - aPPrev1.Y); - ::basegfx::B2DVector aVec2(nX1 - aPPrev1.X, nY1 - aPPrev1.Y); - bool bSameLength(false); - bool bSameDirection(false); - - // get vector values - Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection); - - if(drawing::PolygonFlags_CONTROL == aFPrev2) - { - // point before is a control point - if(bSameDirection) - { - if(bSameLength) - { - // set to PolygonFlags_SYMMETRIC - pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC; - } - else - { - // set to PolygonFlags_SMOOTH - pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH; - } - } - else - { - // set to PolygonFlags_NORMAL - pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL; - } - } - else - { - // point before is a simple curve point - if(bSameDirection) - { - // set to PolygonFlags_SMOOTH - pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH; - } - else - { - // set to PolygonFlags_NORMAL - pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL; - } - } - } - else - { - // no point before starpoint, set type to PolygonFlags_NORMAL - pInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_NORMAL; - } - } -} - SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew, const SdXMLImExViewBox& rViewBox, const awt::Point& rObjectPos, const awt::Size& rObjectSize, - const SvXMLUnitConverter& rConv) + const SvXMLUnitConverter& /*rConv*/) : msString( rNew ), mrViewBox( rViewBox ), mbIsClosed( false ), mbIsCurve( false ), mnLastX( 0L ), mnLastY( 0L ), - maPoly( 0L ), - maFlag( 0L ) + maPoly() { // convert string to polygon - const OUString aStr(msString.getStr(), msString.getLength()); - const sal_Int32 nLen(aStr.getLength()); - sal_Int32 nPos(0); - sal_Int32 nNumPolys(0L); - bool bEllipticalArc(false); - - // object size and ViewBox size different? - bool bScale(rObjectSize.Width != mrViewBox.GetWidth() - || rObjectSize.Height != mrViewBox.GetHeight()); - bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L); + basegfx::B2DPolyPolygon aPoly; + basegfx::tools::importFromSvgD(aPoly,msString); - // first loop: count polys and get flags - Imp_SkipSpaces(aStr, nPos, nLen); + mbIsCurve = aPoly.areControlPointsUsed(); + mbIsClosed = aPoly.isClosed(); - while(nPos < nLen) - { - switch(aStr[nPos++]) - { - case 'Z' : - case 'z' : - { - break; - } - case 'M' : - case 'm' : - { - nNumPolys++; - break; - } - case 'S' : - case 's' : - case 'C' : - case 'c' : - case 'Q' : - case 'q' : - case 'T' : - case 't' : - { - mbIsCurve = true; - break; - } - case 'L' : - case 'l' : - case 'H' : - case 'h' : - case 'V' : - case 'v' : - { - // normal, interpreted values. All okay. - break; - } - case 'A' : - case 'a' : - { - // Not yet interpreted value. - bEllipticalArc = true; - break; - } - } - } - - DBG_ASSERT(!bEllipticalArc, "XMLIMP: non-interpreted tags in svg:d element!"); - (void)bEllipticalArc; - - if(nNumPolys) - { - // alloc arrays - maPoly.realloc(nNumPolys); - if(IsCurve()) - maFlag.realloc(nNumPolys); - - // get outer sequences - drawing::PointSequence* pOuterSequence = maPoly.getArray(); - drawing::FlagSequence* pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L; - - // prepare new loop, count - sal_uInt32 nPointCount(0L); - nPos = 0; - Imp_SkipSpaces(aStr, nPos, nLen); - - // #104076# reset closed flag for next to be started polygon - mbIsClosed = false; - - while(nPos < nLen) - { - switch(aStr[nPos]) - { - case 'z' : - case 'Z' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - // #104076# remember closed state of current polygon - mbIsClosed = true; - - break; - } - case 'm' : - case 'M' : - { - // new poly starts, end-process current poly - if(nPointCount) - { - // #104076# If this partial polygon is closed, use one more point - // to represent that - if(mbIsClosed) - { - nPointCount++; - } - - pOuterSequence->realloc(nPointCount); - pOuterSequence++; - - if(pOuterFlags) - { - pOuterFlags->realloc(nPointCount); - pOuterFlags++; - } - - // reset point count for next polygon - nPointCount = 0L; - } - - // #104076# reset closed flag for next to be started polygon - mbIsClosed = false; - - // NO break, continue in next case - } - case 'L' : - case 'l' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - nPointCount++; - } - break; - } - case 'H' : - case 'h' : - case 'V' : - case 'v' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - nPointCount++; - } - break; - } - case 'S' : - case 's' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - nPointCount += 3; - } - break; - } - case 'C' : - case 'c' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - nPointCount += 3; - } - break; - } - - // #100617# quadratic beziers, supported as cubic ones - case 'Q' : - case 'q' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - - // use three points since quadratic is imported as cubic - nPointCount += 3; - } - break; - } - - // #100617# relative quadratic beziers, supported as cubic ones - case 'T' : - case 't' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - - // use three points since quadratic is imported as cubic - nPointCount += 3; - } - break; - } - - // #100617# not yet supported: elliptical arc - case 'A' : - case 'a' : - { - OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!"); - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - } - break; - } - - default: - { - nPos++; - OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (unknown)!"); - break; - } - } - } - - // alloc last poly (when points used) - if(nPointCount) - { - // #104076# If this partial polygon is closed, use one more point - // to represent that - if(mbIsClosed) - { - nPointCount++; - } - - pOuterSequence->realloc(nPointCount); - pOuterSequence++; - - if(pOuterFlags) - { - pOuterFlags->realloc(nPointCount); - pOuterFlags++; - } - } - - // set pointers back - pOuterSequence = maPoly.getArray(); - pOuterFlags = (IsCurve()) ? maFlag.getArray() : 0L; - awt::Point* pNotSoInnerSequence = 0L; - drawing::PolygonFlags* pNotSoInnerFlags = 0L; - sal_uInt32 nInnerIndex(0L); - - // prepare new loop, read points - nPos = 0; - Imp_SkipSpaces(aStr, nPos, nLen); - - // #104076# reset closed flag for next to be started polygon - mbIsClosed = false; - - while(nPos < nLen) - { - bool bRelative(false); - - switch(aStr[nPos]) - { - case 'z' : - case 'Z' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - // #104076# remember closed state of current polygon - mbIsClosed = true; - - break; - } - - case 'm' : - { - bRelative = true; - } - case 'M' : - { - // #104076# end-process current poly - if(mbIsClosed) - { - if(pNotSoInnerSequence) - { - // closed: add first point again - sal_Int32 nX(pNotSoInnerSequence[0].X); - sal_Int32 nY(pNotSoInnerSequence[0].Y); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL); - } - - // reset closed flag for next to be started polygon - mbIsClosed = false; - } - - // next poly - pNotSoInnerSequence = pOuterSequence->getArray(); - pOuterSequence++; - - if(pOuterFlags) - { - pNotSoInnerFlags = pOuterFlags->getArray(); - pOuterFlags++; - } - - nInnerIndex = 0L; - - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - { - nX += mnLastX; - nY += mnLastY; - } - - // set last position - mnLastX = nX; - mnLastY = nY; - - // calc transform and add point and flag - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL); - } - break; - } - - case 'l' : - { - bRelative = true; - } - case 'L' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - { - nX += mnLastX; - nY += mnLastY; - } - - // set last position - mnLastX = nX; - mnLastY = nY; - - // calc transform and add point and flag - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL); - } - break; - } - - case 'h' : - { - bRelative = true; - } - case 'H' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(mnLastY); - - if(bRelative) - nX += mnLastX; - - // set last position - mnLastX = nX; - - // calc transform and add point and flag - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL); - } - break; - } - - case 'v' : - { - bRelative = true; - } - case 'V' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nX(mnLastX); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - nY += mnLastY; - - // set last position - mnLastY = nY; - - // calc transform and add point and flag - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL); - } - break; - } - - case 's' : - { - bRelative = true; - } - case 'S' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nX1; - sal_Int32 nY1; - sal_Int32 nX2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - { - nX2 += mnLastX; - nY2 += mnLastY; - nX += mnLastX; - nY += mnLastY; - } - - // set last position - mnLastX = nX; - mnLastY = nY; - - // calc transform for new points - Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - - // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC - // and the Point X1,Y1 can be constructed by mirroring the point before it. - nX1 = nX2; - nY1 = nY2; - if(nInnerIndex) - { - awt::Point aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1]; - - if(nInnerIndex > 1) - { - awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2]; - nX1 = aPPrev1.X -(aPPrev2.X - aPPrev1.X); - nY1 = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y); - } - - // set curve point to symmetric - pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SYMMETRIC; - } - - // add calculated control point - Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - - // add new points and set flags - Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH); - } - break; - } - - case 'c' : - { - bRelative = true; - } - case 'C' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nX1(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY1(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nX2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY2(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - { - nX1 += mnLastX; - nY1 += mnLastY; - nX2 += mnLastX; - nY2 += mnLastY; - nX += mnLastX; - nY += mnLastY; - } - - // set last position - mnLastX = nX; - mnLastY = nY; - - // calc transform for new points - Imp_PrepareCoorImport(nX1, nY1, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_PrepareCoorImport(nX2, nY2, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - - // correct polygon flag for previous point - Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1); - - // add new points and set flags - Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH); - } - break; - } - - // #100617# quadratic beziers are imported as cubic - case 'q' : - { - bRelative = true; - } - case 'Q' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nXX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nYY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - { - nXX += mnLastX; - nYY += mnLastY; - nX += mnLastX; - nY += mnLastY; - } - - // set last position - mnLastX = nX; - mnLastY = nY; - - // calc transform for new points - Imp_PrepareCoorImport(nXX, nYY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - - // calculate X1,X2 - awt::Point aPPrev1 = (nInnerIndex) ? pNotSoInnerSequence[nInnerIndex-1] : pNotSoInnerSequence[0]; - sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0); - sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0); - sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0); - sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0); - - // correct polygon flag for previous point - Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1); - - // add new points and set flags - Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH); - } - break; - } - - // #100617# relative quadratic beziers are imported as cubic - case 't' : - { - bRelative = true; - } - case 'T' : - { - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - sal_Int32 nXX; - sal_Int32 nYY; - sal_Int32 nX(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - sal_Int32 nY(Imp_ImportNumberAndSpaces(0, aStr, nPos, nLen, rConv)); - - if(bRelative) - { - nX += mnLastX; - nY += mnLastY; - } - - // set last position - mnLastX = nX; - mnLastY = nY; - - // calc transform for new points - Imp_PrepareCoorImport(nX, nY, rObjectPos, rObjectSize, mrViewBox, bScale, bTranslate); - - // one more thing is known: the previous real point is PolygonFlags_SYMMETRIC - // and the Point X1,Y1 can be constructed by mirroring the point before it. - nXX = nX; - nYY = nY; - awt::Point aPPrev1 = pNotSoInnerSequence[0]; - - if(nInnerIndex) - { - aPPrev1 = pNotSoInnerSequence[nInnerIndex - 1]; - - if(nInnerIndex > 1) - { - awt::Point aPPrev2 = pNotSoInnerSequence[nInnerIndex - 2]; - nXX = aPPrev1.X -(aPPrev2.X - aPPrev1.X); - nYY = aPPrev1.Y -(aPPrev2.Y - aPPrev1.Y); - } - - // set curve point to smooth here, since length - // is changed and thus only c1 can be used. - pNotSoInnerFlags[nInnerIndex - 1] = drawing::PolygonFlags_SMOOTH; - } - - // calculate X1,X2 - sal_Int32 nX1 = FRound((double)((nXX * 2) + aPPrev1.X) / 3.0); - sal_Int32 nY1 = FRound((double)((nYY * 2) + aPPrev1.Y) / 3.0); - sal_Int32 nX2 = FRound((double)((nXX * 2) + nX) / 3.0); - sal_Int32 nY2 = FRound((double)((nYY * 2) + nY) / 3.0); - - // correct polygon flag for previous point - Imp_CorrectPolygonFlag(nInnerIndex, pNotSoInnerSequence, pNotSoInnerFlags, nX1, nY1); - - // add new points and set flags - Imp_AddExportPoints(nX1, nY1, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX2, nY2, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_CONTROL); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_SMOOTH); - } - break; - } - - // #100617# not yet supported: elliptical arc - case 'A' : - case 'a' : - { - OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (elliptical arc)!"); - nPos++; - Imp_SkipSpaces(aStr, nPos, nLen); - - while(nPos < nLen && Imp_IsOnNumberChar(aStr, nPos)) - { - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipNumberAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - Imp_SkipDoubleAndSpacesAndCommas(aStr, nPos, nLen); - } - break; - } - - default: - { - nPos++; - OSL_FAIL("XMLIMP: non-interpreted tags in svg:d element (unknown)!"); - break; - } - } - } - - // #104076# end-process closed state of last poly - if(mbIsClosed) - { - if(pNotSoInnerSequence) - { - // closed: add first point again - sal_Int32 nX(pNotSoInnerSequence[0].X); - sal_Int32 nY(pNotSoInnerSequence[0].Y); - Imp_AddExportPoints(nX, nY, pNotSoInnerSequence, pNotSoInnerFlags, nInnerIndex++, drawing::PolygonFlags_NORMAL); - } - } - - // #87202# If it's a curve and it's closed the last point maybe too much - // and just exported since SVG does not allow special handling of same - // start and end point, remove this last point. - // Evtl. correct the last curve flags, too. - if(IsCurve() && IsClosed()) - { - // make one more loop over the PolyPolygon - pOuterSequence = maPoly.getArray(); - pOuterFlags = maFlag.getArray(); - sal_Int32 nOuterCnt(maPoly.getLength()); - - for(sal_Int32 a(0); a < nOuterCnt; a++) - { - // get Polygon pointers - awt::Point* pInnerSequence = pOuterSequence->getArray(); - drawing::PolygonFlags* pInnerFlags = pOuterFlags->getArray(); - sal_Int32 nInnerCnt(pOuterSequence->getLength()); - - while( nInnerCnt >= 2 - && ((pInnerSequence + (nInnerCnt - 2))->X == (pInnerSequence + (nInnerCnt - 1))->X) - && ((pInnerSequence + (nInnerCnt - 2))->Y == (pInnerSequence + (nInnerCnt - 1))->Y) - && drawing::PolygonFlags_CONTROL != *(pInnerFlags + (nInnerCnt - 2))) - { - // remove last point from array - pOuterSequence->realloc(nInnerCnt - 1); - pOuterFlags->realloc(nInnerCnt - 1); - - // get new pointers - pInnerSequence = pOuterSequence->getArray(); - pInnerFlags = pOuterFlags->getArray(); - nInnerCnt = pOuterSequence->getLength(); - } - - // now evtl. correct the last curve flags - if(nInnerCnt >= 4) - { - if( pInnerSequence->X == (pInnerSequence + (nInnerCnt - 1))->X - && pInnerSequence->Y == (pInnerSequence + (nInnerCnt - 1))->Y - && drawing::PolygonFlags_CONTROL == *(pInnerFlags + 1) - && drawing::PolygonFlags_CONTROL == *(pInnerFlags + (nInnerCnt - 2))) - { - awt::Point aPrev = *(pInnerSequence + (nInnerCnt - 2)); - awt::Point aCurr = *pInnerSequence; - awt::Point aNext = *(pInnerSequence + 1); - ::basegfx::B2DVector aVec1(aPrev.X - aCurr.X, aPrev.Y - aCurr.Y); - ::basegfx::B2DVector aVec2(aNext.X - aCurr.X, aNext.Y - aCurr.Y); - bool bSameLength(false); - bool bSameDirection(false); - - // get vector values - Imp_CalcVectorValues(aVec1, aVec2, bSameLength, bSameDirection); - - // set correct flag value - if(bSameDirection) - { - if(bSameLength) - { - // set to PolygonFlags_SYMMETRIC - *pInnerFlags = drawing::PolygonFlags_SYMMETRIC; - *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SYMMETRIC; - } - else - { - // set to PolygonFlags_SMOOTH - *pInnerFlags = drawing::PolygonFlags_SMOOTH; - *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_SMOOTH; - } - } - else - { - // set to PolygonFlags_NORMAL - *pInnerFlags = drawing::PolygonFlags_NORMAL; - *(pInnerFlags + (nInnerCnt - 1)) = drawing::PolygonFlags_NORMAL; - } - } - } - - // switch to next Polygon - pOuterSequence++; - pOuterFlags++; - } - } - } + // object size and ViewBox size different? + basegfx::B2DHomMatrix aTransform; + const bool bScale(rObjectSize.Width != mrViewBox.GetWidth() + || rObjectSize.Height != mrViewBox.GetHeight()); + const bool bTranslate(mrViewBox.GetX() != 0L || mrViewBox.GetY() != 0L); + + if( bTranslate ) + aTransform.translate( + -mrViewBox.GetX(), + -mrViewBox.GetY()); + if( bScale ) + aTransform.scale( + (mrViewBox.GetWidth() ? rObjectSize.Width / mrViewBox.GetWidth() : 0), + (mrViewBox.GetHeight() ? rObjectSize.Height / mrViewBox.GetHeight() : 0)); + aTransform.translate( rObjectPos.X, rObjectPos.Y ); + aPoly.transform(aTransform); + + basegfx::unotools::b2DPolyPolygonToPolyPolygonBezier(aPoly,maPoly); } // eof diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index 04d750776971..c6f66daed090 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -358,9 +358,8 @@ void SdXMLGenericPageContext::EndElement() } } } - catch( uno::Exception& e ) + catch(const uno::Exception&) { - (void)e; OSL_FAIL("xmloff::SdXMLGenericPageContext::EndElement(), unexpected exception cought!"); } } @@ -426,7 +425,7 @@ void SdXMLGenericPageContext::SetStyle( rtl::OUString& rStyleName ) } } } - catch( uno::Exception ) + catch(const uno::Exception&) { OSL_FAIL( "SdXMLGenericPageContext::SetStyle(): uno::Exception catched!" ); } @@ -641,7 +640,7 @@ void SdXMLGenericPageContext::SetNavigationOrder() Reference< XPropertySet > xSet( mxShapes, UNO_QUERY_THROW ); xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NavigationOrder" ) ), Any( Reference< XIndexAccess >( new NavigationOrderAccess( aShapes ) ) ) ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL("xmloff::SdXMLGenericPageContext::SetNavigationOrder(), unexpected exception cought while importing shape navigation order!"); } diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 2179fdc2922e..753aaaf612e1 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -335,7 +335,7 @@ void SdXMLShapeContext::addGluePoint( const uno::Reference< xml::sax::XAttribute sal_Int32 nInternalId = mxGluePoints->insert( uno::makeAny( aGluePoint ) ); GetImport().GetShapeImport()->addGluePointMapping( mxShape, nId, nInternalId ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "exception during setting of glue points!"); } @@ -414,7 +414,7 @@ void SdXMLShapeContext::EndElement() xSet->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) ), Any( ::com::sun::star::presentation::ClickAction_DOCUMENT ) ); } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::SdXMLShapeContext::EndElement(), exception caught while setting hyperlink!"); } @@ -458,7 +458,7 @@ void SdXMLShapeContext::AddShape(uno::Reference< drawing::XShape >& xShape) if( !mbPrintable ) xSet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Printable" ) ), uno::Any( sal_False ) ); } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL( "SdXMLShapeContext::AddShape(), exception caught!" ); } @@ -519,7 +519,7 @@ void SdXMLShapeContext::AddShape(const char* pServiceName ) if( xShape.is() ) AddShape( xShape ); } - catch( const uno::Exception& e ) + catch(const uno::Exception& e) { uno::Sequence<rtl::OUString> aSeq( 1 ); aSeq[0] = OUString::createFromAscii(pServiceName); @@ -686,7 +686,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) } } } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "could not find style for shape!" ); } @@ -701,7 +701,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) aAny <<= xStyle; xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Style")), aAny); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "could not find style for shape!" ); } @@ -736,7 +736,7 @@ void SdXMLShapeContext::SetStyle( bool bSupportsStyle /* = true */) } while(0); } - catch( uno::Exception& ) + catch(const uno::Exception&) { } } @@ -757,7 +757,7 @@ void SdXMLShapeContext::SetLayer() return; } } - catch( uno::Exception e ) + catch(const uno::Exception&) { } } @@ -786,7 +786,7 @@ void SdXMLShapeContext::SetThumbnail() xPropSet->setPropertyValue( sProperty, uno::makeAny( aInternalURL ) ); } } - catch( uno::Exception e ) + catch(const uno::Exception&) { } } @@ -989,7 +989,7 @@ void SdXMLRectShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib { xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "exception during setting of corner radius!"); } @@ -1642,7 +1642,7 @@ void SdXMLTextBoxShapeContext::StartElement(const uno::Reference< xml::sax::XAtt { xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "exception during setting of corner radius!"); } @@ -2242,7 +2242,7 @@ void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAtt { xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("CornerRadius")), uno::makeAny( mnRadius ) ); } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "exception during setting of corner radius!"); } @@ -2345,7 +2345,7 @@ void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno:: xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle")), Any( FillStyle_NONE ) ); xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("LineStyle")), Any( LineStyle_NONE ) ); } - catch( Exception& ) + catch(const Exception&) { } @@ -2364,7 +2364,7 @@ void SdXMLGraphicObjectShapeContext::StartElement( const ::com::sun::star::uno:: xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicURL") ), aAny ); xPropset->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny ); } - catch (lang::IllegalArgumentException const &) + catch (const lang::IllegalArgumentException&) { } } @@ -2409,7 +2409,7 @@ void SdXMLGraphicObjectShapeContext::EndElement() xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("GraphicStreamURL") ), aAny ); } } - catch (lang::IllegalArgumentException const &) + catch (const lang::IllegalArgumentException&) { } } @@ -3542,7 +3542,7 @@ void SdXMLCustomShapeContext::StartElement( const uno::Reference< xml::sax::XAtt } } } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "could not set enhanced customshape geometry" ); } @@ -3574,7 +3574,7 @@ void SdXMLCustomShapeContext::EndElement() xPropSet->setPropertyValue( sCustomShapeGeometry, aAny ); } } - catch( uno::Exception& ) + catch(const uno::Exception&) { OSL_FAIL( "could not set enhanced customshape geometry" ); } @@ -3685,7 +3685,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW ); xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "TableTemplate" ) ), Any( xTableStyle ) ); } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("SdXMLTableShapeContext::StartElement(), exception caught!"); } @@ -3698,7 +3698,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc const OUString sAPIPropertyName( OUString(pEntry->msApiName, pEntry->nApiNameLength, RTL_TEXTENCODING_ASCII_US ) ); xProps->setPropertyValue( sAPIPropertyName, Any( maTemplateStylesUsed[i] ) ); } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("SdXMLTableShapeContext::StartElement(), exception caught!"); } diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index 4e2024c3cf5e..a88952289658 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -147,9 +147,9 @@ lcl_initDocumentProperties(SvXMLImport & rImport, xDocProps->getAutoloadURL())); SvXMLMetaDocumentContext::setBuildId( xDocProps->getGenerator(), rImport.getImportInfo()); - } catch (uno::RuntimeException) { + } catch (const uno::RuntimeException&) { throw; - } catch (uno::Exception & e) { + } catch (const uno::Exception& e) { throw lang::WrappedTargetRuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SvXMLMetaDocumentContext::initDocumentProperties: " @@ -181,9 +181,9 @@ lcl_initGenerator(SvXMLImport & rImport, xPath->eval(xDoc.get(), expr), uno::UNO_SET_THROW); OUString const value(xObj->getString()); SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo()); - } catch (uno::RuntimeException) { + } catch (const uno::RuntimeException&) { throw; - } catch (uno::Exception & e) { + } catch (const uno::Exception& e) { throw lang::WrappedTargetRuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SvXMLMetaDocumentContext::initGenerator: exception")), @@ -312,7 +312,7 @@ void SvXMLMetaDocumentContext::setBuildId(::rtl::OUString const& i_rBuildId, con xImportInfo->setPropertyValue( aPropName, uno::makeAny( sBuildId ) ); } } - catch( uno::Exception& ) + catch(const uno::Exception&) { } } diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx index c0261eb0852c..8fe674fef735 100644 --- a/xmloff/source/style/prstylei.cxx +++ b/xmloff/source/style/prstylei.cxx @@ -370,7 +370,7 @@ void XMLPropStyleContext::Finish( sal_Bool bOverwrite ) { mxStyle->setParentStyle( sParent ); } - catch( uno::Exception e ) + catch(const uno::Exception& e) { // according to the API definition, I would expect a // container::NoSuchElementException. But it throws an diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx index 81b8dd3409e4..4c6375004063 100644 --- a/xmloff/source/style/styleexp.cxx +++ b/xmloff/source/style/styleexp.cxx @@ -422,7 +422,7 @@ void XMLStyleExport::exportStyleFamily( { xStyles->getByName( *pIter ) >>= xStyle; } - catch( lang::IndexOutOfBoundsException ) + catch(const lang::IndexOutOfBoundsException&) { // due to bugs in prior versions it is possible that // a binary file is missing some critical styles. diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index e53e321257af..a637fd263fb8 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -167,9 +167,8 @@ XMLTableExport::XMLTableExport(SvXMLExport& rExp, const rtl::Reference< SvXMLExp } } } - catch( Exception& e ) + catch(const Exception&) { - (void)e; } mxCellExportPropertySetMapper = xExportPropertyMapper; @@ -242,7 +241,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) pTableInfo->maColumnStyleMap[xKey] = sStyleName; } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::XMLTableExport::collectTableAutoStyles(), exception during column style collection!"); } @@ -310,12 +309,12 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) aStringStatistic.clear(); } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::XMLTableExport::collectTableAutoStyles(), exception during column style collection!"); } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::XMLTableExport::collectTableAutoStyles(), exception caught!"); } @@ -381,7 +380,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) } } } - catch( Exception ) + catch(const Exception&) { OSL_FAIL( "XMLTableExport::exportTable(), exception cought!" ); } @@ -446,7 +445,7 @@ static bool has_states( const std::vector< XMLPropertyState >& xPropStates ) } DBG_ASSERT( (nRowSpan >= 1) && (nColSpan >= 1), "xmloff::XMLTableExport::ExportCell(), illegal row or col span < 1?" ); } - catch ( Exception ) + catch (const Exception&) { OSL_FAIL( "exception while exporting a table cell" ); } @@ -569,7 +568,7 @@ void XMLTableExport::exportTableTemplates() SvXMLElementExport element( mrExport, XML_NAMESPACE_TABLE, pElements->meElement, sal_True, sal_True ); } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::XMLTableExport::exportTableTemplates(), exception caught!"); } @@ -577,12 +576,12 @@ void XMLTableExport::exportTableTemplates() pElements++; } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::XMLTableExport::exportTableDesigns(), exception caught while exporting a table design!"); } } - catch( Exception& ) + catch(const Exception&) { OSL_FAIL("xmloff::XMLTableExport::exportTableDesigns(), exception caught!"); } diff --git a/xmloff/source/text/XMLIndexTOCContext.cxx b/xmloff/source/text/XMLIndexTOCContext.cxx index c1285af4e751..4bc15ecebd86 100644 --- a/xmloff/source/text/XMLIndexTOCContext.cxx +++ b/xmloff/source/text/XMLIndexTOCContext.cxx @@ -224,7 +224,7 @@ void XMLIndexTOCContext::StartElement( GetImport().GetTextImport()->InsertTextContent( xTextContent); } - catch( IllegalArgumentException e ) + catch(const IllegalArgumentException& e) { // illegal argument? Then we can't accept indices here! Sequence<OUString> aSeq(1); diff --git a/xmloff/source/text/XMLRedlineExport.cxx b/xmloff/source/text/XMLRedlineExport.cxx index a0f2947434e8..209a51ffa015 100644 --- a/xmloff/source/text/XMLRedlineExport.cxx +++ b/xmloff/source/text/XMLRedlineExport.cxx @@ -571,7 +571,7 @@ void XMLRedlineExport::ExportStartOrEndRedline( { aAny = rPropSet->getPropertyValue(bStart ? sStartRedline : sEndRedline); } - catch( UnknownPropertyException e ) + catch(const UnknownPropertyException&) { // If we don't have the property, there's nothing to do. return; diff --git a/xmloff/source/text/txtfldi.cxx b/xmloff/source/text/txtfldi.cxx index af7677a2cdc6..19f0b8aa2fdc 100644 --- a/xmloff/source/text/txtfldi.cxx +++ b/xmloff/source/text/txtfldi.cxx @@ -280,7 +280,7 @@ void XMLTextFieldImportContext::EndElement() { rTextImportHelper.InsertTextContent(xTextContent); } - catch (lang::IllegalArgumentException e) + catch (const lang::IllegalArgumentException&) { // ignore } @@ -3174,7 +3174,7 @@ void XMLDdeFieldDeclImportContext::StartElement( } // else: ignore } - catch ( const Exception& ) + catch (const Exception&) { //ignore } @@ -3697,8 +3697,9 @@ SvXMLImportContext* XMLAnnotationImportContext::CreateChildContext( } } } - catch ( Exception& ) - {} + catch (const Exception&) + { + } if( !pContext ) pContext = new XMLStringBufferImportContext(GetImport(), nPrefix, rLocalName, aTextBuffer); @@ -3743,7 +3744,7 @@ void XMLAnnotationImportContext::EndElement() { GetImportHelper().InsertTextContent( xTextContent ); } - catch (lang::IllegalArgumentException) + catch (const lang::IllegalArgumentException&) { // ignore } diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx index e81610773293..a925649ba5f8 100644 --- a/xmloff/source/text/txtimp.cxx +++ b/xmloff/source/text/txtimp.cxx @@ -924,8 +924,9 @@ namespace { m_xOutParams->insertByName(pCurrent->first, pCurrent->second); } - catch(ElementExistException) - { } + catch(const ElementExistException&) + { + } } } } @@ -1632,7 +1633,7 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( xPropSet->setPropertyValue( s_NumberingRules, makeAny(xNewNumRules) ); } - catch( Exception e ) + catch(const Exception&) { ; // I would really like to use a warning here, // but I can't access the XMLErrorHandler from @@ -1799,9 +1800,8 @@ OUString XMLTextImportHelper::SetStyleAndAttrs( xCrsr->gotoRange( xRange->getEnd(), true ); xCrsr->setString( ::rtl::OUString() ); } - catch( const uno::Exception& rEx ) + catch(const uno::Exception&) { - (void)rEx; } } } diff --git a/xmloff/source/text/txtsecte.cxx b/xmloff/source/text/txtsecte.cxx index 201407e79371..fd5df175244e 100644 --- a/xmloff/source/text/txtsecte.cxx +++ b/xmloff/source/text/txtsecte.cxx @@ -75,19 +75,6 @@ using ::com::sun::star::container::XIndexReplace; using ::com::sun::star::container::XNamed; using ::com::sun::star::lang::XServiceInfo; -Reference<XText> lcl_findXText(const Reference<XTextSection>& rSect) -{ - Reference<XText> xText; - - Reference<XTextContent> xTextContent(rSect, UNO_QUERY); - if (xTextContent.is()) - { - xText.set(xTextContent->getAnchor()->getText()); - } - - return xText; -} - void XMLTextParagraphExport::exportListAndSectionChange( Reference<XTextSection> & rPrevSection, const Reference<XTextContent> & rNextSectionContent, diff --git a/xmloff/source/transform/XMLFilterRegistration.cxx b/xmloff/source/transform/XMLFilterRegistration.cxx index 4db6da9a91b5..fea750bcb76d 100644 --- a/xmloff/source/transform/XMLFilterRegistration.cxx +++ b/xmloff/source/transform/XMLFilterRegistration.cxx @@ -142,12 +142,7 @@ extern "C" { #endif -SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment( const sal_Char ** ppEnvTypeName, uno_Environment ** ) -{ - *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; -} - -SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) +SAL_DLLPUBLIC_EXPORT void* SAL_CALL xof_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) { void * pRet = NULL; if( pServiceManager ) @@ -183,7 +178,7 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char * pImpl } catch( uno::Exception& ) { - OSL_FAIL( "xof::component_getFactory: Exception!" ); + OSL_FAIL( "xof::xof_component_getFactory: Exception!" ); } } diff --git a/xmloff/source/transform/xof.component b/xmloff/source/transform/xof.component index 8f9c88f7fa0d..b5254b1c2b97 100755 --- a/xmloff/source/transform/xof.component +++ b/xmloff/source/transform/xof.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="xof" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="com.sun.star.comp.Calc.XMLContentImporter"> <service name="com.sun.star.comp.Calc.XMLContentImporter"/> diff --git a/xmloff/source/xforms/xformsapi.cxx b/xmloff/source/xforms/xformsapi.cxx index 4d23ba45d3d9..f47e7aaeab4f 100644 --- a/xmloff/source/xforms/xformsapi.cxx +++ b/xmloff/source/xforms/xformsapi.cxx @@ -85,11 +85,6 @@ Reference<XPropertySet> lcl_createXFormsModel() return lcl_createPropertySet( OUSTRING( "com.sun.star.xforms.Model" ) ); } -Reference<XPropertySet> lcl_createXFormsBinding() -{ - return lcl_createPropertySet( OUSTRING( "com.sun.star.xforms.Binding" ) ); -} - void lcl_addXFormsModel( const Reference<frame::XModel>& xDocument, const Reference<XPropertySet>& xModel ) @@ -196,32 +191,6 @@ void lcl_setValue( Reference<XPropertySet>& xPropertySet, xPropertySet->setPropertyValue( rName, rAny ); } - -Reference<XPropertySet> lcl_getXFormsModel( const Reference<frame::XModel>& xDoc ) -{ - Reference<XPropertySet> xRet; - try - { - Reference<XFormsSupplier> xSupplier( xDoc, UNO_QUERY ); - if( xSupplier.is() ) - { - Reference<XNameContainer> xForms = xSupplier->getXForms(); - if( xForms.is() ) - { - Sequence<OUString> aNames = xForms->getElementNames(); - if( aNames.getLength() > 0 ) - xRet.set( xForms->getByName( aNames[0] ), UNO_QUERY ); - } - } - } - catch( const Exception& ) - { - ; // no success! - } - - return xRet; -} - #define TOKEN_MAP_ENTRY(NAMESPACE,TOKEN) { XML_NAMESPACE_##NAMESPACE, xmloff::token::XML_##TOKEN, xmloff::token::XML_##TOKEN } static SvXMLTokenMapEntry aTypes[] = { diff --git a/xmloff/source/xforms/xformsapi.hxx b/xmloff/source/xforms/xformsapi.hxx index fc24b06248f3..bfe2fd51a7a0 100644 --- a/xmloff/source/xforms/xformsapi.hxx +++ b/xmloff/source/xforms/xformsapi.hxx @@ -49,8 +49,6 @@ class SvXMLNamespaceMap; com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_createXFormsModel(); -com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_createXFormsBinding(); - void lcl_addXFormsModel( const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xDocument, const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xModel ); @@ -73,9 +71,6 @@ void lcl_setValue( lcl_setValue( xPropSet, rName, com::sun::star::uno::makeAny( aValue ) ); } - -com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet> lcl_getXFormsModel( const com::sun::star::uno::Reference<com::sun::star::frame::XModel>& ); - sal_uInt16 lcl_getTypeClass( const com::sun::star::uno::Reference<com::sun::star::xforms::XDataTypeRepository>& xRepository, const SvXMLNamespaceMap& rNamespaceMap, diff --git a/xmloff/util/xo.component b/xmloff/util/xo.component index 7fe2119636d1..1bbba25d3e1d 100755 --- a/xmloff/util/xo.component +++ b/xmloff/util/xo.component @@ -26,7 +26,7 @@ * **********************************************************************--> -<component loader="com.sun.star.loader.SharedLibrary" +<component loader="com.sun.star.loader.SharedLibrary" prefix="xo" xmlns="http://openoffice.org/2010/uno-components"> <implementation name="SchXMLExport.Compact"> <service name="com.sun.star.comp.Chart.XMLExporter"/> |