diff options
Diffstat (limited to 'svtools')
-rw-r--r-- | svtools/Library_svt.mk | 1 | ||||
-rw-r--r-- | svtools/Package_inc.mk | 1 | ||||
-rw-r--r-- | svtools/inc/svtools/chartprettypainter.hxx | 67 | ||||
-rw-r--r-- | svtools/source/misc/chartprettypainter.cxx | 136 |
4 files changed, 0 insertions, 205 deletions
diff --git a/svtools/Library_svt.mk b/svtools/Library_svt.mk index c7dab0f17746..a5e43f8a210b 100644 --- a/svtools/Library_svt.mk +++ b/svtools/Library_svt.mk @@ -212,7 +212,6 @@ $(eval $(call gb_Library_add_exception_objects,svt,\ svtools/source/java/javacontext \ svtools/source/java/javainteractionhandler \ svtools/source/misc/acceleratorexecute \ - svtools/source/misc/chartprettypainter \ svtools/source/misc/cliplistener \ svtools/source/misc/dialogclosedlistener \ svtools/source/misc/dialogcontrolling \ diff --git a/svtools/Package_inc.mk b/svtools/Package_inc.mk index 4162e8f53fea..002d6aea695b 100644 --- a/svtools/Package_inc.mk +++ b/svtools/Package_inc.mk @@ -41,7 +41,6 @@ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/asynclink.hxx,svtools/ $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/brwbox.hxx,svtools/brwbox.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/brwhead.hxx,svtools/brwhead.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/calendar.hxx,svtools/calendar.hxx)) -$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/chartprettypainter.hxx,svtools/chartprettypainter.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/cliplistener.hxx,svtools/cliplistener.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/colctrl.hxx,svtools/colctrl.hxx)) $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/collatorres.hxx,svtools/collatorres.hxx)) diff --git a/svtools/inc/svtools/chartprettypainter.hxx b/svtools/inc/svtools/chartprettypainter.hxx index f565f634395f..e69de29bb2d1 100644 --- a/svtools/inc/svtools/chartprettypainter.hxx +++ b/svtools/inc/svtools/chartprettypainter.hxx @@ -1,67 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -#ifndef CHARTPRETTYPAINTER_HXX -#define CHARTPRETTYPAINTER_HXX - -#ifndef INCLUDED_SVTDLLAPI_H -#include "svtools/svtdllapi.h" -#endif - -//#include <svtools/embedhlp.hxx> -#include <vcl/outdev.hxx> -#include <com/sun/star/frame/XModel.hpp> -#include <com/sun/star/uno/Sequence.hxx> - -// predeclarations -namespace svt { class EmbeddedObjectRef; } - -/** use this class for a correct view representation of charts -see issues #i82893#, #i75867#: charts must be painted resolution dependent!! - -example usage when painting ole objects: -if( ChartPrettyPainter::IsChart(xObjRef) && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( pOutDev ) - && ChartPrettyPainter::DoPrettyPaintChart( get/loadChartModel(), pOutDev, rLogicObjectRect ) ) - return; -else - use any other painting method for charts or paint other ole objects - -this way of usage ensures that ole objects are only loaded if necessary -*/ - -class SVT_DLLPUBLIC ChartPrettyPainter -{ -public: - static bool IsChart( const svt::EmbeddedObjectRef& xObjRef ); - static bool ShouldPrettyPaintChartOnThisDevice( OutputDevice* pOutDev ); - static bool DoPrettyPaintChart( ::com::sun::star::uno::Reference< - ::com::sun::star::frame::XModel > xChartModel, - OutputDevice* pOutDev, const Rectangle& rLogicObjectRect ); - - ChartPrettyPainter(); - virtual ~ChartPrettyPainter(); - virtual bool DoPaint( OutputDevice* pOutDev, const Rectangle& rLogicObjectRect ) const; - static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); -}; - -#endif diff --git a/svtools/source/misc/chartprettypainter.cxx b/svtools/source/misc/chartprettypainter.cxx index 16d0c8360c40..e69de29bb2d1 100644 --- a/svtools/source/misc/chartprettypainter.cxx +++ b/svtools/source/misc/chartprettypainter.cxx @@ -1,136 +0,0 @@ -/************************************************************** - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - *************************************************************/ - - - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_svtools.hxx" - -#include <svtools/chartprettypainter.hxx> - -#include <tools/globname.hxx> -#include <sot/clsids.hxx> -// header for function rtl_createUuid -#include <rtl/uuid.h> -#include <vcl/pdfextoutdevdata.hxx> - -#include <com/sun/star/lang/XUnoTunnel.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <svtools/embedhlp.hxx> - -using namespace ::com::sun::star; - -ChartPrettyPainter::ChartPrettyPainter() -{ -} - -ChartPrettyPainter::~ChartPrettyPainter() -{ -} - -bool ChartPrettyPainter::DoPaint(OutputDevice* /*pOutDev*/, const Rectangle& /*rLogicObjectRect*/) const -{ - return false; -} - -//static -const uno::Sequence<sal_Int8>& ChartPrettyPainter::getUnoTunnelId() -{ - static uno::Sequence<sal_Int8> * pSeq = 0; - if( !pSeq ) - { - osl::Guard< osl::Mutex > aGuard( osl::Mutex::getGlobalMutex() ); - if( !pSeq ) - { - static uno::Sequence< sal_Int8 > aSeq( 16 ); - rtl_createUuid( (sal_uInt8*)aSeq.getArray(), 0, sal_True ); - pSeq = &aSeq; - } - } - return *pSeq; -} - -bool ChartPrettyPainter::IsChart( const svt::EmbeddedObjectRef& xObjRef ) -{ - if ( !xObjRef.is() ) - return false; - - SvGlobalName aObjClsId( xObjRef->getClassID() ); - if( - SvGlobalName(SO3_SCH_CLASSID_30) == aObjClsId - || SvGlobalName(SO3_SCH_CLASSID_40) == aObjClsId - || SvGlobalName(SO3_SCH_CLASSID_50) == aObjClsId - || SvGlobalName(SO3_SCH_CLASSID_60) == aObjClsId) - { - return true; - } - - return false; -} - -bool ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( OutputDevice* pOutDev ) -{ - if( !pOutDev ) - return false; - //at least the print preview in calc has a paint loop due to too much invalidate calls deep in sdr - //to avoid the paint loop we use the metafile replacement in this case instead of direct rendering - if( OUTDEV_WINDOW == pOutDev->GetOutDevType() ) - return false; - if( OUTDEV_PRINTER == pOutDev->GetOutDevType() ) - return true; - vcl::PDFExtOutDevData* pPDFData = PTR_CAST( vcl::PDFExtOutDevData, pOutDev->GetExtOutDevData() ); - if( pPDFData ) - return true; - return false; -} - -bool ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel > xChartModel, OutputDevice* pOutDev, const Rectangle& rLogicObjectRect ) -{ - //charts must be painted resolution dependent!! #i82893#, #i75867# - if( !xChartModel.is() || !ShouldPrettyPaintChartOnThisDevice( pOutDev ) ) - return false; - - try - { - uno::Reference< lang::XMultiServiceFactory > xFact( xChartModel, uno::UNO_QUERY ); - OSL_ENSURE( xFact.is(), "Chart cannot be painted pretty!\n" ); - if( xFact.is() ) - { - uno::Reference< lang::XUnoTunnel > xChartRenderer( xFact->createInstance( - ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart2.ChartRenderer" ) ) ), uno::UNO_QUERY ); - OSL_ENSURE( xChartRenderer.is(), "Chart cannot be painted pretty!\n" ); - if( xChartRenderer.is() ) - { - ChartPrettyPainter* pPrettyPainter = reinterpret_cast<ChartPrettyPainter*>( - xChartRenderer->getSomething( ChartPrettyPainter::getUnoTunnelId() )); - if( pPrettyPainter ) - return pPrettyPainter->DoPaint(pOutDev, rLogicObjectRect); - } - } - } - catch( uno::Exception& e ) - { - (void)e; - DBG_ERROR( "Chart cannot be painted pretty!" ); - } - return false; -} - |