summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-01-03 16:18:46 +0000
committerArmin Le Grand <alg@apache.org>2012-01-03 16:18:46 +0000
commitfb77d6d670d47ad442839290d80ede3bf69ddcf9 (patch)
tree4f52452e1d537851803afc623fcfcb5fac27847e
parent4909a0f6680e50456b2cf7af73dc7e1f804a8f72 (diff)
fix for #118525#: Using primitives for chart sub-geometry visualisation
-rwxr-xr-xchart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx7
-rw-r--r--chart2/source/controller/inc/ChartRenderer.hxx72
-rw-r--r--chart2/source/controller/main/ChartRenderer.cxx174
-rw-r--r--chart2/source/controller/main/makefile.mk1
-rw-r--r--chart2/source/inc/servicenames.hxx2
-rwxr-xr-xdrawinglayer/Library_drawinglayer.mk2
-rwxr-xr-xdrawinglayer/Package_inc.mk1
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx76
-rw-r--r--drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx39
-rw-r--r--drawinglayer/source/primitive2d/chartprimitive2d.cxx78
-rw-r--r--drawinglayer/source/primitive2d/sceneprimitive2d.cxx80
-rw-r--r--drawinglayer/source/processor2d/canvasprocessor.cxx22
-rw-r--r--drawinglayer/source/processor2d/helperchartrenderer.cxx151
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx21
-rw-r--r--drawinglayer/source/processor2d/vclpixelprocessor2d.cxx22
-rw-r--r--drawinglayer/source/processor3d/zbufferprocessor3d.cxx2
-rw-r--r--slideshow/source/engine/shapes/drawshape.cxx130
-rw-r--r--svtools/Library_svt.mk1
-rw-r--r--svtools/Package_inc.mk1
-rw-r--r--svtools/inc/svtools/chartprettypainter.hxx67
-rw-r--r--svtools/source/misc/chartprettypainter.cxx136
-rw-r--r--svx/Library_svxcore.mk1
-rw-r--r--svx/Package_inc.mk1
-rw-r--r--svx/inc/svx/charthelper.hxx (renamed from drawinglayer/source/processor2d/helperchartrenderer.hxx)47
-rw-r--r--svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx4
-rw-r--r--svx/source/sdr/contact/viewcontactofsdrole2obj.cxx72
-rw-r--r--svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx126
-rw-r--r--svx/source/svdraw/charthelper.cxx143
-rw-r--r--svx/source/svdraw/svdoole2.cxx4
-rw-r--r--sw/source/core/doc/notxtfrm.cxx312
-rwxr-xr-xsw/source/core/layout/paintfrm.cxx4
-rw-r--r--sw/source/core/unocore/unochart.cxx4
32 files changed, 534 insertions, 1269 deletions
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
index 38d44b050195..c138755767fa 100755
--- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -51,7 +51,6 @@
#include "AreaWrapper.hxx"
#include "WrappedAddInProperty.hxx"
#include "WrappedIgnoreProperty.hxx"
-#include "ChartRenderer.hxx"
#include <com/sun/star/chart2/XTitled.hpp>
#include <com/sun/star/chart2/data/XDataReceiver.hpp>
#include <com/sun/star/chart/ChartDataRowSource.hpp>
@@ -1362,12 +1361,6 @@ uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
bServiceFound = true;
}
- else if( aServiceSpecifier.equals( CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ) )
- {
- Reference< lang::XUnoTunnel > xChartRenderer( new ChartRenderer( m_spChart2ModelContact->getChartModel() ) );
- xResult.set( xChartRenderer );
- bServiceFound = true;
- }
else if( aServiceSpecifier.equals( C2U("com.sun.star.comp.chart2.DataSeriesWrapper") ) )
{
Reference< beans::XPropertySet > xDataSeries( new DataSeriesPointWrapper( m_spChart2ModelContact ) );
diff --git a/chart2/source/controller/inc/ChartRenderer.hxx b/chart2/source/controller/inc/ChartRenderer.hxx
deleted file mode 100644
index 6acd5c763789..000000000000
--- a/chart2/source/controller/inc/ChartRenderer.hxx
+++ /dev/null
@@ -1,72 +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 CHART_RENDERER_HXX
-#define CHART_RENDERER_HXX
-
-#include <svtools/chartprettypainter.hxx>
-#include "ServiceMacros.hxx"
-
-#include <cppuhelper/implbase2.hxx>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <cppuhelper/weakref.hxx>
-
-//.............................................................................
-namespace chart
-{
-//.............................................................................
-
-//#i82893#, #i75867#: charts must be painted resolution dependent!!
-class ChartRenderer : public ::cppu::WeakImplHelper2<
- ::com::sun::star::lang::XServiceInfo
- , ::com::sun::star::lang::XUnoTunnel
- >, public ChartPrettyPainter
-{
-public:
- ChartRenderer( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel );
- virtual ~ChartRenderer();
-
- // ___lang::XServiceInfo___
- APPHELPER_XSERVICEINFO_DECL()
-
- // ____ XUnoTunnel ___
- virtual ::sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aIdentifier )
- throw (::com::sun::star::uno::RuntimeException);
-
- // ____ ChartPrettyPainter ___
- virtual bool DoPaint(OutputDevice* pOutDev, const Rectangle& rLogicObjectRect) const;
-
-private:
- ChartRenderer();
- ChartRenderer( const ChartRenderer& );
-
- ::com::sun::star::uno::WeakReference< ::com::sun::star::frame::XModel > m_xChartModel;
-};
-
-//.............................................................................
-} // namespace chart
-//.............................................................................
-
-#endif
diff --git a/chart2/source/controller/main/ChartRenderer.cxx b/chart2/source/controller/main/ChartRenderer.cxx
deleted file mode 100644
index 2480d9d55e33..000000000000
--- a/chart2/source/controller/main/ChartRenderer.cxx
+++ /dev/null
@@ -1,174 +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_chart2.hxx"
-
-#include "ChartRenderer.hxx"
-#include "servicenames.hxx"
-#include "chartview/ExplicitValueProvider.hxx"
-#include "chartview/DrawModelWrapper.hxx"
-#include "DrawViewWrapper.hxx"
-#include "macros.hxx"
-#include "ChartModelHelper.hxx"
-#include <vcl/svapp.hxx>
-#include <vos/mutex.hxx>
-
-#include <com/sun/star/util/XUpdatable.hpp>
-
-//.............................................................................
-namespace chart
-{
-//.............................................................................
-
-using namespace ::com::sun::star;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::Sequence;
-using rtl::OUString;
-
-ChartRenderer::ChartRenderer( const Reference< frame::XModel >& xChartModel )
- : m_xChartModel( uno::WeakReference< frame::XModel >(xChartModel) )
-{
-}
-
-ChartRenderer::~ChartRenderer()
-{
-}
-
-// ____ ChartPrettyPainter ___
-bool ChartRenderer::DoPaint(OutputDevice* pOutDev, const Rectangle& rLogicObjectRect /*in given output dev map units*/ ) const
-{
- if(!pOutDev)
- return false;
-
- Reference<frame::XModel> xModel(m_xChartModel);
- uno::Reference< lang::XMultiServiceFactory > xFact( xModel, uno::UNO_QUERY );
- if( !xFact.is() )
- return false;
-
- //#i84323# ensure that the size the container has of the chart and size that chart has itself are the same
- //maybe remove this workaround somewhere in future again
- {
- if( MAP_100TH_MM == pOutDev->GetMapMode().GetMapUnit() )//no problem for writer in issue #i84323#; but writer uses twips instead of 100thmm which causes small differences in size always when converting to 100thmm and back
- {
- awt::Size aChartSize( ChartModelHelper::getPageSize(xModel) );
- awt::Size aContainerChartSize( rLogicObjectRect.GetWidth(), rLogicObjectRect.GetHeight() );
- if( aContainerChartSize.Width != aChartSize.Width
- || aContainerChartSize.Height != aChartSize.Height )
- {
- DBG_ERROR("chart size does not equal size assumed by the container");
- //correct the state here on the fly -> let the container size win
- ChartModelHelper::setPageSize( aContainerChartSize, xModel );
- }
- }
- }
-
- // get the chart view
- Reference< lang::XUnoTunnel > xChartView( xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
-
- try
- {
- //better performance for big data
- uno::Reference< beans::XPropertySet > xProp( xChartView, uno::UNO_QUERY );
- if( xProp.is() )
- {
- awt::Size aResolution(1000,1000);
- {
- ::vos::OGuard aGuard( Application::GetSolarMutex());
- Rectangle aPixelRect( pOutDev->LogicToPixel( rLogicObjectRect ) );
- aResolution.Width = aPixelRect.GetWidth();
- aResolution.Height = aPixelRect.GetHeight();
- }
- xProp->setPropertyValue( C2U("Resolution"), uno::makeAny( aResolution ));
- }
- //
-
- uno::Reference< util::XUpdatable > xUpdatable( xChartView, uno::UNO_QUERY );
- if( xUpdatable.is() )
- xUpdatable->update();
-
- ::vos::OGuard aGuard( Application::GetSolarMutex());
- ExplicitValueProvider* pProvider = ExplicitValueProvider::getExplicitValueProvider( xChartView );
- if( !pProvider )
- return false;
- ::boost::shared_ptr< DrawModelWrapper > pDrawModelWrapper = pProvider->getDrawModelWrapper();
- if( !pDrawModelWrapper.get() )
- return false;
- ::boost::shared_ptr< DrawViewWrapper > pDrawViewWrapper( new DrawViewWrapper(&pDrawModelWrapper->getSdrModel(),pOutDev,false) );
- pDrawViewWrapper->attachParentReferenceDevice( xModel );
-
- MapMode aOldMapMode( pOutDev->GetMapMode() );
- Point aOldOrigin( aOldMapMode.GetOrigin() );
- MapMode aMapMode( aOldMapMode );
- Point aOldOriginMM( OutputDevice::LogicToLogic( aOldOrigin, aOldMapMode.GetMapUnit(), MAP_100TH_MM ) );
- Point aObjectTopLeftMM( OutputDevice::LogicToLogic( rLogicObjectRect.TopLeft(), aOldMapMode.GetMapUnit(), MAP_100TH_MM ) );
- aMapMode.SetOrigin( aOldOriginMM + aObjectTopLeftMM );
- aMapMode.SetMapUnit( MAP_100TH_MM );
- pOutDev->SetMapMode(aMapMode);
-
- Rectangle aPaintRect( OutputDevice::LogicToLogic( rLogicObjectRect, aOldMapMode, aMapMode ) );
- pDrawViewWrapper->CompleteRedraw(pOutDev, Region(aPaintRect) );
-
- pOutDev->SetMapMode(aOldMapMode);
- }
- catch( uno::Exception & ex )
- {
- ASSERT_EXCEPTION( ex );
- }
- catch( ... )
- {
- }
-
- return true;
-}
-
-//-----------------------------------------------------------------
-// ____ XUnoTunnel ___
-::sal_Int64 SAL_CALL ChartRenderer::getSomething( const Sequence< ::sal_Int8 >& aIdentifier )
- throw( uno::RuntimeException)
-{
- if( aIdentifier.getLength() == 16 && 0 == rtl_compareMemory(
- ChartPrettyPainter::getUnoTunnelId().getConstArray(),
- aIdentifier.getConstArray(), 16 ) )
- {
- ChartPrettyPainter* pPaintableObject = this;
- return reinterpret_cast<sal_Int64>(pPaintableObject);
- }
- return 0;
-}
-
-//-----------------------------------------------------------------
-// lang::XServiceInfo
-
-APPHELPER_XSERVICEINFO_IMPL(ChartRenderer,CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME)
-
-Sequence< OUString > ChartRenderer::getSupportedServiceNames_Static()
-{
- Sequence< OUString > aSNS;
- return aSNS;
-}
-
-//.............................................................................
-} //namespace chart
-//.............................................................................
diff --git a/chart2/source/controller/main/makefile.mk b/chart2/source/controller/main/makefile.mk
index 557d6cf6216f..0a0ab95d86ec 100644
--- a/chart2/source/controller/main/makefile.mk
+++ b/chart2/source/controller/main/makefile.mk
@@ -55,7 +55,6 @@ SLOFILES = \
$(SLO)$/ChartController_Position.obj \
$(SLO)$/ChartController_Tools.obj \
$(SLO)$/ChartFrameloader.obj \
- $(SLO)$/ChartRenderer.obj \
$(SLO)$/CommandDispatchContainer.obj \
$(SLO)$/CommandDispatch.obj \
$(SLO)$/ControllerCommandDispatch.obj \
diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx
index 603b7d0bd370..1f1eafb72f13 100644
--- a/chart2/source/inc/servicenames.hxx
+++ b/chart2/source/inc/servicenames.hxx
@@ -56,8 +56,6 @@ namespace chart
#define CHART_ACCESSIBLE_TEXT_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.AccessibleTextComponent")
#define CHART_ACCESSIBLE_TEXT_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.accessibility.AccessibleTextComponent")
-#define CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartRenderer")
-
//.............................................................................
} //namespace chart
//.............................................................................
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk
index 3b2041fd5e6f..d9a40d42a13b 100755
--- a/drawinglayer/Library_drawinglayer.mk
+++ b/drawinglayer/Library_drawinglayer.mk
@@ -94,7 +94,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/primitive2d/backgroundcolorprimitive2d \
drawinglayer/source/primitive2d/bitmapprimitive2d \
drawinglayer/source/primitive2d/borderlineprimitive2d \
- drawinglayer/source/primitive2d/chartprimitive2d \
drawinglayer/source/primitive2d/controlprimitive2d \
drawinglayer/source/primitive2d/cropprimitive2d \
drawinglayer/source/primitive2d/discretebitmapprimitive2d \
@@ -164,7 +163,6 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\
drawinglayer/source/processor2d/vclhelperbitmaprender \
drawinglayer/source/processor2d/vclhelperbufferdevice \
drawinglayer/source/processor2d/vclprocessor2d \
- drawinglayer/source/processor2d/helperchartrenderer \
drawinglayer/source/processor2d/helperwrongspellrenderer \
drawinglayer/source/processor2d/vclpixelprocessor2d \
drawinglayer/source/processor2d/vclmetafileprocessor2d \
diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk
index 3be2c7ff9f00..e9d2a6969bd3 100755
--- a/drawinglayer/Package_inc.mk
+++ b/drawinglayer/Package_inc.mk
@@ -34,7 +34,6 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/baseprimitive2d.hxx,drawinglayer/primitive2d/baseprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/bitmapprimitive2d.hxx,drawinglayer/primitive2d/bitmapprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/borderlineprimitive2d.hxx,drawinglayer/primitive2d/borderlineprimitive2d.hxx))
-$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/chartprimitive2d.hxx,drawinglayer/primitive2d/chartprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/controlprimitive2d.hxx,drawinglayer/primitive2d/controlprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/cropprimitive2d.hxx,drawinglayer/primitive2d/cropprimitive2d.hxx))
$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/primitive2d/discretebitmapprimitive2d.hxx,drawinglayer/primitive2d/discretebitmapprimitive2d.hxx))
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
deleted file mode 100644
index 300fc33b189c..000000000000
--- a/drawinglayer/inc/drawinglayer/primitive2d/chartprimitive2d.hxx
+++ /dev/null
@@ -1,76 +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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CHARTPRIMITIVE2D_HXX
-#define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CHARTPRIMITIVE2D_HXX
-
-#include <drawinglayer/drawinglayerdllapi.h>
-#include <drawinglayer/primitive2d/groupprimitive2d.hxx>
-#include <com/sun/star/frame/XModel.hpp>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace primitive2d
- {
- /** ChartPrimitive2D class
-
- This is a helper primitive which decomposes to the ChartMetaFile
- visualisation. It is used to allow specific renderers to do something
- direct for visualising the chart.
- */
- class DRAWINGLAYER_DLLPUBLIC ChartPrimitive2D : public GroupPrimitive2D
- {
- private:
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > mxChartModel;
- basegfx::B2DHomMatrix maTransformation;
-
- public:
- ChartPrimitive2D(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxChartModel,
- const basegfx::B2DHomMatrix& rTransformation,
- const Primitive2DSequence& rChildren);
-
- /// data read access
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& getChartModel() const { return mxChartModel; }
- const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
-
- // compare operator
- virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
-
- // provide unique ID
- DeclPrimitrive2DIDBlock()
-
- virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
- };
- } // end of namespace primitive2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-
-#endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CHARTPRIMITIVE2D_HXX
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
index 4aacc64fba71..4a57ad4dcaaf 100644
--- a/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
+++ b/drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx
@@ -85,26 +85,25 @@
#define PRIMITIVE2D_ID_POLYPOLYGONHAIRLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 46)
#define PRIMITIVE2D_ID_EXECUTEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 47)
#define PRIMITIVE2D_ID_PAGEPREVIEWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 48)
-#define PRIMITIVE2D_ID_CHARTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49)
-#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
-#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
-#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
-#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
-#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
-#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
-#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
-#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
-#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
-#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
-#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
-#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
-#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
-#define PRIMITIVE2D_ID_SVGLINEARGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
-#define PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
-#define PRIMITIVE2D_ID_SVGLINEARATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 65)
-#define PRIMITIVE2D_ID_SVGRADIALATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66)
-#define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
-#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68)
+#define PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 49)
+#define PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 50)
+#define PRIMITIVE2D_ID_POLYPOLYGONMARKERPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 51)
+#define PRIMITIVE2D_ID_HITTESTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 52)
+#define PRIMITIVE2D_ID_INVERTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 53)
+#define PRIMITIVE2D_ID_DISCRETEBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 54)
+#define PRIMITIVE2D_ID_WALLPAPERBITMAPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 55)
+#define PRIMITIVE2D_ID_TEXTLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 56)
+#define PRIMITIVE2D_ID_TEXTCHARACTERSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 57)
+#define PRIMITIVE2D_ID_TEXTGEOMETRYSTRIKEOUTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 58)
+#define PRIMITIVE2D_ID_EPSPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 59)
+#define PRIMITIVE2D_ID_DISCRETESHADOWPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 60)
+#define PRIMITIVE2D_ID_HIDDENGEOMETRYPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 61)
+#define PRIMITIVE2D_ID_SVGLINEARGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 62)
+#define PRIMITIVE2D_ID_SVGRADIALGRADIENTPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 63)
+#define PRIMITIVE2D_ID_SVGLINEARATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 64)
+#define PRIMITIVE2D_ID_SVGRADIALATOMPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 65)
+#define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66)
+#define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67)
//////////////////////////////////////////////////////////////////////////////
diff --git a/drawinglayer/source/primitive2d/chartprimitive2d.cxx b/drawinglayer/source/primitive2d/chartprimitive2d.cxx
deleted file mode 100644
index 7281dbf4905f..000000000000
--- a/drawinglayer/source/primitive2d/chartprimitive2d.cxx
+++ /dev/null
@@ -1,78 +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_drawinglayer.hxx"
-
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-#include <basegfx/tools/canvastools.hxx>
-#include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-using namespace com::sun::star;
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- namespace primitive2d
- {
- ChartPrimitive2D::ChartPrimitive2D(
- const uno::Reference< frame::XModel >& rxChartModel,
- const basegfx::B2DHomMatrix& rTransformation,
- const Primitive2DSequence& rChildren)
- : GroupPrimitive2D(rChildren),
- mxChartModel(rxChartModel),
- maTransformation(rTransformation)
- {
- }
-
- bool ChartPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
- {
- if(GroupPrimitive2D::operator==(rPrimitive))
- {
- const ChartPrimitive2D& rCompare = static_cast< const ChartPrimitive2D& >(rPrimitive);
-
- return (getChartModel() == rCompare.getChartModel()
- && getTransformation() == rCompare.getTransformation());
- }
-
- return false;
- }
-
- // provide unique ID
- ImplPrimitrive2DIDBlock(ChartPrimitive2D, PRIMITIVE2D_ID_CHARTPRIMITIVE2D)
-
- basegfx::B2DRange ChartPrimitive2D::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
- {
- basegfx::B2DRange aRetval(0.0, 0.0, 1.0, 1.0);
- aRetval.transform(getTransformation());
- return aRetval;
- }
-
- } // end of namespace primitive2d
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
index 89c40feecfc7..60b0a9c2fc40 100644
--- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx
@@ -205,24 +205,84 @@ namespace drawinglayer
}
}
- // calculate logic render size in world coordinates for usage in renderer
- basegfx::B2DVector aLogicRenderSize(
- aDiscreteRange.getWidth() * fReduceFactor,
- aDiscreteRange.getHeight() * fReduceFactor);
- aLogicRenderSize *= rViewInformation.getInverseObjectToViewTransformation();
-
// determine the oversample value
static sal_uInt16 nDefaultOversampleValue(3);
const sal_uInt16 nOversampleValue(aDrawinglayerOpt.IsAntiAliasing() ? nDefaultOversampleValue : 0);
+ geometry::ViewInformation3D aViewInformation3D(getViewInformation3D());
+ {
+ // calculate a transformation from DiscreteRange to evtl. rotated/sheared content.
+ // Start with full transformation from object to discrete units
+ basegfx::B2DHomMatrix aObjToUnit(rViewInformation.getObjectToViewTransformation() * getObjectTransformation());
+
+ // bring to unit coordinates by applying inverse DiscreteRange
+ aObjToUnit.translate(-aDiscreteRange.getMinX(), -aDiscreteRange.getMinY());
+ aObjToUnit.scale(1.0 / aDiscreteRange.getWidth(), 1.0 / aDiscreteRange.getHeight());
+
+ // calculate transformed user coordinate system
+ const basegfx::B2DPoint aStandardNull(0.0, 0.0);
+ const basegfx::B2DPoint aUnitRangeTopLeft(aObjToUnit * aStandardNull);
+ const basegfx::B2DVector aStandardXAxis(1.0, 0.0);
+ const basegfx::B2DVector aUnitRangeXAxis(aObjToUnit * aStandardXAxis);
+ const basegfx::B2DVector aStandardYAxis(0.0, 1.0);
+ const basegfx::B2DVector aUnitRangeYAxis(aObjToUnit * aStandardYAxis);
+
+ if(!aUnitRangeTopLeft.equal(aStandardNull) || !aUnitRangeXAxis.equal(aStandardXAxis) || !aUnitRangeYAxis.equal(aStandardYAxis))
+ {
+ // build transformation from unit range to user coordinate system; the unit range
+ // X and Y axes are the column vectors, the null point is the offset
+ basegfx::B2DHomMatrix aUnitRangeToUser;
+
+ aUnitRangeToUser.set3x2(
+ aUnitRangeXAxis.getX(), aUnitRangeYAxis.getX(), aUnitRangeTopLeft.getX(),
+ aUnitRangeXAxis.getY(), aUnitRangeYAxis.getY(), aUnitRangeTopLeft.getY());
+
+ // decompose to allow to apply this to the 3D transformation
+ basegfx::B2DVector aScale, aTranslate;
+ double fRotate, fShearX;
+ aUnitRangeToUser.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // apply before DeviceToView and after Projection, 3D is in range [-1.0 .. 1.0] in X,Y and Z
+ // and not yet flipped in Y
+ basegfx::B3DHomMatrix aExtendedProjection(aViewInformation3D.getProjection());
+
+ // bring to unit coordiantes, flip Y, leave Z unchanged
+ aExtendedProjection.scale(0.5, -0.5, 1.0);
+ aExtendedProjection.translate(0.5, 0.5, 0.0);
+
+ // apply extra; Y is flipped now, go with positive shear and rotate values
+ aExtendedProjection.scale(aScale.getX(), aScale.getY(), 1.0);
+ aExtendedProjection.shearXZ(fShearX, 0.0);
+ aExtendedProjection.rotate(0.0, 0.0, fRotate);
+ aExtendedProjection.translate(aTranslate.getX(), aTranslate.getY(), 0.0);
+
+ // back to state after projection
+ aExtendedProjection.translate(-0.5, -0.5, 0.0);
+ aExtendedProjection.scale(2.0, -2.0, 1.0);
+
+ aViewInformation3D = geometry::ViewInformation3D(
+ aViewInformation3D.getObjectTransformation(),
+ aViewInformation3D.getOrientation(),
+ aExtendedProjection,
+ aViewInformation3D.getDeviceToView(),
+ aViewInformation3D.getViewTime(),
+ aViewInformation3D.getExtendedInformationSequence());
+ }
+ }
+
+ // calculate logic render size in world coordinates for usage in renderer
+ const basegfx::B2DHomMatrix aInverseOToV(rViewInformation.getInverseObjectToViewTransformation());
+ const double fLogicX((aInverseOToV * basegfx::B2DVector(aDiscreteRange.getWidth() * fReduceFactor, 0.0)).getLength());
+ const double fLogicY((aInverseOToV * basegfx::B2DVector(0.0, aDiscreteRange.getHeight() * fReduceFactor)).getLength());
+
// use default 3D primitive processor to create BitmapEx for aUnitVisiblePart and process
processor3d::ZBufferProcessor3D aZBufferProcessor3D(
- getViewInformation3D(),
+ aViewInformation3D,
rViewInformation,
getSdrSceneAttribute(),
getSdrLightingAttribute(),
- aLogicRenderSize.getX(),
- aLogicRenderSize.getY(),
+ fLogicX,
+ fLogicY,
aUnitVisibleRange,
nOversampleValue);
@@ -243,7 +303,7 @@ namespace drawinglayer
aNew2DTransform.set(1, 2, aVisibleDiscreteRange.getMinY());
// transform back to world coordinates for usage in primitive creation
- aNew2DTransform *= rViewInformation.getInverseObjectToViewTransformation();
+ aNew2DTransform *= aInverseOToV;
// create bitmap primitive and add
const Primitive2DReference xRef(new BitmapPrimitive2D(maOldRenderedBitmap, aNew2DTransform));
diff --git a/drawinglayer/source/processor2d/canvasprocessor.cxx b/drawinglayer/source/processor2d/canvasprocessor.cxx
index dd16a4d16e74..2390983402b0 100644
--- a/drawinglayer/source/processor2d/canvasprocessor.cxx
+++ b/drawinglayer/source/processor2d/canvasprocessor.cxx
@@ -61,8 +61,6 @@
#include <com/sun/star/rendering/TexturingMode.hpp>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <vclhelperbufferdevice.hxx>
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-#include <helperchartrenderer.hxx>
#include <drawinglayer/primitive2d/wrongspellprimitive2d.hxx>
#include <helperwrongspellrenderer.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
@@ -2091,26 +2089,6 @@ namespace drawinglayer
break;
}
- case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
- {
- // chart primitive in canvas renderer; restore original DrawMode during call
- // since the evtl. used ChartPrettyPainter will use the MapMode
- const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
- mpOutputDevice->Push(PUSH_MAPMODE);
- mpOutputDevice->SetMapMode(maOriginalMapMode);
-
- if(!renderChartPrimitive2D(
- rChartPrimitive,
- *mpOutputDevice,
- getViewInformation2D()))
- {
- // fallback to decomposition (MetaFile)
- process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
- }
-
- mpOutputDevice->Pop();
- break;
- }
case PRIMITIVE2D_ID_WRONGSPELLPRIMITIVE2D :
{
// wrong spell primitive. Handled directly here using VCL since VCL has a nice and
diff --git a/drawinglayer/source/processor2d/helperchartrenderer.cxx b/drawinglayer/source/processor2d/helperchartrenderer.cxx
deleted file mode 100644
index 5be488924124..000000000000
--- a/drawinglayer/source/processor2d/helperchartrenderer.cxx
+++ /dev/null
@@ -1,151 +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_drawinglayer.hxx"
-
-#include <helperchartrenderer.hxx>
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-#include <svtools/chartprettypainter.hxx>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <drawinglayer/geometry/viewinformation2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
-
-using namespace com::sun::star;
-
-//////////////////////////////////////////////////////////////////////////////
-
-namespace drawinglayer
-{
- bool renderChartPrimitive2D(
- const primitive2d::ChartPrimitive2D& rChartCandidate,
- OutputDevice& rOutputDevice,
- const geometry::ViewInformation2D& rViewInformation2D)
- {
- bool bChartRendered(false);
-
- // code from chart PrettyPrinter
- try
- {
- uno::Reference< lang::XMultiServiceFactory > xFact( rChartCandidate.getChartModel(), 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 )
- {
- // create logic object range; do NOT use ObjectTransformation for this
- // (rViewInformation2D.getObjectTransformation()), only the logic object
- // size is wanted
- basegfx::B2DRange aObjectRange(0.0, 0.0, 1.0, 1.0);
- aObjectRange.transform(rChartCandidate.getTransformation());
- const Rectangle aRectangle(
- (sal_Int32)aObjectRange.getMinX(), (sal_Int32)aObjectRange.getMinY(),
- (sal_Int32)aObjectRange.getMaxX(), (sal_Int32)aObjectRange.getMaxY());
-
- // #i101811#
- if(rViewInformation2D.getObjectTransformation().isIdentity())
- {
- // no embedding in another transfromation, just paint with existing
- // MapMode. This is just a shortcut; using the below code will also
- // work; it has just a neutral ObjectTransformation
- bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle);
- }
- else
- {
- // rViewInformation2D.getObjectTransformation() is used and
- // needs to be expressed in the MapMode for the PrettyPainter;
- // else it would call ChartModelHelper::setPageSize(...) with the
- // changed size what really will change the chart model and leads
- // to re-layouts and re-formattings
- const MapMode aOldMapMode(rOutputDevice.GetMapMode());
- basegfx::B2DVector aVTScale, aScale, aTranslate;
- double fRotate, fShearX;
-
- // get basic scaling with current MapMode (aVTScale), containing
- // mapping for set MapUnit (e.g. for 100th mm, the basic scale is
- // not 1.0, 1.0). This is needed since this scale is included in
- // the ObjectToView Transformation and needs to be removed (see
- // correction below) to re-create a MapMode
- rOutputDevice.SetMapMode(aOldMapMode.GetMapUnit());
- rOutputDevice.GetViewTransformation().decompose(aVTScale, aTranslate, fRotate, fShearX);
-
- // get complete ObjectToView Transformation scale and translate from current
- // transformation chain (combined view and object transform)
- rViewInformation2D.getObjectToViewTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
-
- // assert when shear and/or rotation is used
- OSL_ENSURE(basegfx::fTools::equalZero(fRotate), "Chart PrettyPrinting with unsupportable rotation (!)");
- OSL_ENSURE(basegfx::fTools::equalZero(fShearX), "Chart PrettyPrinting with unsupportable shear (!)");
-
- // clean scale and translate from basic scaling (DPI, etc...)
- // since this will implicitely be part of the to-be-created MapMode
- const basegfx::B2DTuple aBasicCleaner(
- basegfx::fTools::equalZero(aVTScale.getX()) ? 1.0 : 1.0 / aVTScale.getX(),
- basegfx::fTools::equalZero(aVTScale.getY()) ? 1.0 : 1.0 / aVTScale.getY());
- aScale *= aBasicCleaner;
- aTranslate *= aBasicCleaner;
-
- // for MapMode, take scale out of translation
- const basegfx::B2DTuple aScaleRemover(
- basegfx::fTools::equalZero(aScale.getX()) ? 1.0 : 1.0 / aScale.getX(),
- basegfx::fTools::equalZero(aScale.getY()) ? 1.0 : 1.0 / aScale.getY());
- aTranslate *= aScaleRemover;
-
- // build new MapMode
- const MapMode aNewMapMode(aOldMapMode.GetMapUnit(),
- Point(basegfx::fround(aTranslate.getX()), basegfx::fround(aTranslate.getY())),
- Fraction(aScale.getX()), Fraction(aScale.getY()));
-
- // use, paint, restore
- rOutputDevice.SetMapMode(aNewMapMode);
- bChartRendered = pPrettyPainter->DoPaint(&rOutputDevice, aRectangle);
- rOutputDevice.SetMapMode(aOldMapMode);
- }
- }
- }
- }
- }
- catch( uno::Exception& e )
- {
- (void)e;
- DBG_ERROR( "Chart cannot be painted pretty!" );
- }
-
- return bChartRendered;
- }
-} // end of namespace drawinglayer
-
-//////////////////////////////////////////////////////////////////////////////
-// eof
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 63dbabf2bce5..54cb95dc1672 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -59,7 +59,6 @@
#include <drawinglayer/primitive2d/graphicprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
-#include <helperchartrenderer.hxx>
#include <drawinglayer/primitive2d/epsprimitive2d.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
@@ -76,11 +75,6 @@
#include <com/sun/star/beans/XPropertySet.hpp>
//////////////////////////////////////////////////////////////////////////////
-// for current chart PrettyPrinting support
-
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-
-//////////////////////////////////////////////////////////////////////////////
// for StructureTagPrimitive support in sd's unomodel.cxx
#include <drawinglayer/primitive2d/structuretagprimitive2d.hxx>
@@ -1979,21 +1973,6 @@ namespace drawinglayer
RenderPointArrayPrimitive2D(static_cast< const primitive2d::PointArrayPrimitive2D& >(rCandidate));
break;
}
- case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
- {
- // ChartPrimitive2D
- const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
-
- if(!renderChartPrimitive2D(
- rChartPrimitive,
- *mpOutputDevice,
- getViewInformation2D()))
- {
- // fallback to decomposition (MetaFile)
- process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
- }
- break;
- }
case PRIMITIVE2D_ID_STRUCTURETAGPRIMITIVE2D :
{
// structured tag primitive
diff --git a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
index d71090ed7d5b..509c0762c6cf 100644
--- a/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclpixelprocessor2d.cxx
@@ -44,8 +44,6 @@
#include <com/sun/star/awt/XWindow2.hpp>
#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx>
#include <drawinglayer/primitive2d/pagepreviewprimitive2d.hxx>
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
-#include <helperchartrenderer.hxx>
#include <helperwrongspellrenderer.hxx>
#include <drawinglayer/primitive2d/fillhatchprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
@@ -447,26 +445,6 @@ namespace drawinglayer
break;
}
- case PRIMITIVE2D_ID_CHARTPRIMITIVE2D :
- {
- // chart primitive in pixel renderer; restore original DrawMode during call
- // since the evtl. used ChartPrettyPainter will use the MapMode
- const primitive2d::ChartPrimitive2D& rChartPrimitive = static_cast< const primitive2d::ChartPrimitive2D& >(rCandidate);
- mpOutputDevice->Push(PUSH_MAPMODE);
- mpOutputDevice->SetMapMode(maOriginalMapMode);
-
- if(!renderChartPrimitive2D(
- rChartPrimitive,
- *mpOutputDevice,
- getViewInformation2D()))
- {
- // fallback to decomposition (MetaFile)
- process(rChartPrimitive.get2DDecomposition(getViewInformation2D()));
- }
-
- mpOutputDevice->Pop();
- break;
- }
case PRIMITIVE2D_ID_FILLHATCHPRIMITIVE2D :
{
static bool bForceIgnoreHatchSmoothing(false);
diff --git a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
index 958ceed301b8..6f50e385ff10 100644
--- a/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
+++ b/drawinglayer/source/processor3d/zbufferprocessor3d.cxx
@@ -132,7 +132,7 @@ namespace
aRetval = BitmapEx(aContent, aAlpha);
// #i101811# set PrefMapMode and PrefSize at newly created Bitmap
- aRetval.SetPrefMapMode(MAP_100TH_MM);
+ aRetval.SetPrefMapMode(MAP_PIXEL);
aRetval.SetPrefSize(Size(nWidth, nHeight));
}
diff --git a/slideshow/source/engine/shapes/drawshape.cxx b/slideshow/source/engine/shapes/drawshape.cxx
index 056baab44f0a..92d1ce75c5a8 100644
--- a/slideshow/source/engine/shapes/drawshape.cxx
+++ b/slideshow/source/engine/shapes/drawshape.cxx
@@ -84,130 +84,6 @@ namespace slideshow
{
namespace internal
{
- //#i75867# poor quality of ole's alternative view with 3D scenes and zoomfactors besides 100%
- //metafiles are resolution dependent when bitmaps are contained with is the case for 3D scenes for example
- //in addition a chart has resolution dependent content as it might skip points that are not visible for a given resolution (this is done for performance reasons)
- bool local_getMetafileForChart( const uno::Reference< lang::XComponent >& xSource,
- const uno::Reference< drawing::XDrawPage >& xContainingPage,
- GDIMetaFile& rMtf )
- {
- //get the chart model
- uno::Reference< beans::XPropertySet > xPropSet( xSource, uno::UNO_QUERY );
- uno::Reference< frame::XModel > xChartModel;
- getPropertyValue( xChartModel, xPropSet, OUSTR("Model"));
- uno::Reference< lang::XMultiServiceFactory > xFact( xChartModel, uno::UNO_QUERY );
- OSL_ENSURE( xFact.is(), "Chart cannot be painted pretty!\n" );
- if(!xFact.is())
- return false;
-
- //get the chart view
- uno::Reference< datatransfer::XTransferable > xChartViewTransferable(
- xFact->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.chart2.ChartView" ) ) ), uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xChartViewProp( xChartViewTransferable, uno::UNO_QUERY );
- OSL_ENSURE( xChartViewProp.is(), "Chart cannot be painted pretty!\n" );
- if( !xChartViewProp.is() )
- return false;
-
- //estimate zoom and resolution (this is only a workaround, correct would be to know and use the exact zoom and resoltion during slideshow display)
- sal_Int32 nScaleXNumerator = 100;//zoom factor -> exact values are important for the quality of the created bitmap especially for 3D charts
- sal_Int32 nScaleYNumerator = 100;
- sal_Int32 nScaleXDenominator = 100;
- sal_Int32 nScaleYDenominator = 100;
- awt::Size aPixelPerChart( 1000, 1000 );//when data points happen to be on the same pixel as their predecessor no shape is created to safe performance
-
- Window* pActiveTopWindow( Application::GetActiveTopWindow() );
- WorkWindow* pWorkWindow( dynamic_cast<WorkWindow*>(pActiveTopWindow));
- if( pWorkWindow && pWorkWindow->IsPresentationMode() )
- {
- Size aPixScreenSize( pActiveTopWindow->GetOutputSizePixel() );
- aPixelPerChart = awt::Size( aPixScreenSize.getWidth(), aPixScreenSize.getHeight() );//this is still to much (but costs only seldom performance), correct would be pixel per chart object
-
- uno::Reference< beans::XPropertySet > xPageProp( xContainingPage, uno::UNO_QUERY );
- sal_Int32 nLogicPageWidth=1;
- sal_Int32 nLogicPageHeight=1;
- if( getPropertyValue( nLogicPageWidth, xPageProp, OUSTR("Width")) &&
- getPropertyValue( nLogicPageHeight, xPageProp, OUSTR("Height")) )
- {
- Size aLogicScreenSize( pActiveTopWindow->PixelToLogic( aPixScreenSize, MAP_100TH_MM ) );
- nScaleXNumerator = aLogicScreenSize.getWidth();
- nScaleYNumerator = aLogicScreenSize.getHeight();
- nScaleXDenominator = nLogicPageWidth;
- nScaleYDenominator = nLogicPageHeight;
- }
- }
- else
- {
- long nMaxPixWidth = 0;
- long nMaxPixHeight = 0;
- unsigned int nScreenCount( Application::GetScreenCount() );
- for( unsigned int nScreen=0; nScreen<nScreenCount; nScreen++ )
- {
- Rectangle aCurScreenRect( Application::GetScreenPosSizePixel( nScreen ) );
- if( aCurScreenRect.GetWidth() > nMaxPixWidth )
- nMaxPixWidth = aCurScreenRect.GetWidth();
- if( aCurScreenRect.GetHeight() > nMaxPixHeight )
- nMaxPixHeight = aCurScreenRect.GetHeight();
- }
- if(nMaxPixWidth>1 && nMaxPixHeight>1)
- aPixelPerChart = awt::Size( nMaxPixWidth, nMaxPixHeight );//this is still to much (but costs only seldom performance), correct would be pixel per chart object
- }
-
- try
- {
- uno::Sequence< beans::PropertyValue > aZoomFactors(4);
- aZoomFactors[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleXNumerator") );
- aZoomFactors[0].Value = uno::makeAny( nScaleXNumerator );
- aZoomFactors[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleXDenominator") );
- aZoomFactors[1].Value = uno::makeAny( nScaleXDenominator );
- aZoomFactors[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleYNumerator") );
- aZoomFactors[2].Value = uno::makeAny( nScaleYNumerator );
- aZoomFactors[3].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleYDenominator") );
- aZoomFactors[3].Value = uno::makeAny( nScaleYDenominator );
-
- xChartViewProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ZoomFactors") ), uno::makeAny( aZoomFactors ));
- xChartViewProp->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Resolution") ), uno::makeAny( aPixelPerChart ));
- }
- catch (uno::Exception &)
- {
- OSL_ENSURE( false, rtl::OUStringToOString(
- comphelper::anyToString(
- cppu::getCaughtException() ),
- RTL_TEXTENCODING_UTF8 ).getStr() );
- }
-
- //get a metafile from the prepared chart view
- datatransfer::DataFlavor aDataFlavor(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"") ),
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "GDIMetaFile" ) ),
- ::getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
- uno::Any aData( xChartViewTransferable->getTransferData( aDataFlavor ) );
- uno::Sequence< sal_Int8 > aSeq;
- if( aData >>= aSeq )
- {
- ::std::auto_ptr< SvMemoryStream > pSrcStm( new SvMemoryStream( (char*) aSeq.getConstArray(), aSeq.getLength(), STREAM_WRITE | STREAM_TRUNC ) );
- *(pSrcStm.get() ) >> rMtf;
- return true;
- }
- return false;
- }
-
- //same as getMetafile with an exception for charts
- //for charts a metafile with a higher resolution is created, because charts have resolution dependent content
- bool local_getMetaFile_WithSpecialChartHandling( const uno::Reference< lang::XComponent >& xSource,
- const uno::Reference< drawing::XDrawPage >& xContainingPage,
- GDIMetaFile& rMtf,
- int mtfLoadFlags,
- const uno::Reference< uno::XComponentContext >& rxContext )
- {
- uno::Reference<beans::XPropertySet> xProp( xSource, uno::UNO_QUERY );
- rtl::OUString sCLSID;
- getPropertyValue( sCLSID, xProp, OUSTR("CLSID"));
- if( sCLSID.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("12DCAE26-281F-416F-a234-c3086127382e")) && local_getMetafileForChart( xSource, xContainingPage, rMtf ) )
- return true;
- return getMetaFile( xSource, xContainingPage, rMtf, mtfLoadFlags, rxContext );
- }
-
-
//////////////////////////////////////////////////////////////////////
//
// Private methods
@@ -221,7 +97,7 @@ namespace slideshow
// reload with added flags:
mpCurrMtf.reset( new GDIMetaFile );
mnCurrMtfLoadFlags |= MTF_LOAD_SCROLL_TEXT_MTF;
- local_getMetaFile_WithSpecialChartHandling(
+ getMetaFile(
uno::Reference<lang::XComponent>(mxShape, uno::UNO_QUERY),
mxPage, *mpCurrMtf, mnCurrMtfLoadFlags,
mxComponentContext );
@@ -291,7 +167,7 @@ namespace slideshow
// subsetting information!
mpCurrMtf.reset( new GDIMetaFile );
mnCurrMtfLoadFlags |= MTF_LOAD_VERBOSE_COMMENTS;
- local_getMetaFile_WithSpecialChartHandling(
+ getMetaFile(
uno::Reference<lang::XComponent>(mxShape, uno::UNO_QUERY),
mxPage, *mpCurrMtf, mnCurrMtfLoadFlags,
mxComponentContext );
@@ -582,7 +458,7 @@ namespace slideshow
// must NOT be called from within initializer list, uses
// state from mnCurrMtfLoadFlags!
mpCurrMtf.reset( new GDIMetaFile );
- local_getMetaFile_WithSpecialChartHandling(
+ getMetaFile(
uno::Reference<lang::XComponent>(xShape, uno::UNO_QUERY),
xContainingPage, *mpCurrMtf, mnCurrMtfLoadFlags,
mxComponentContext );
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;
-}
-
diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk
index dd31e6b4bdd1..1d370019154e 100644
--- a/svx/Library_svxcore.mk
+++ b/svx/Library_svxcore.mk
@@ -298,6 +298,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\
svx/source/sdr/properties/connectorproperties \
svx/source/sdr/properties/e3dcompoundproperties \
svx/source/sdr/properties/oleproperties \
+ svx/source/svdraw/charthelper \
svx/source/svdraw/clonelist \
svx/source/svdraw/gradtrns \
svx/source/svdraw/polypolygoneditor \
diff --git a/svx/Package_inc.mk b/svx/Package_inc.mk
index 81066e9c7bff..256cc29e13d4 100644
--- a/svx/Package_inc.mk
+++ b/svx/Package_inc.mk
@@ -27,6 +27,7 @@
$(eval $(call gb_Package_Package,svx_inc,$(SRCDIR)/svx/inc))
+$(eval $(call gb_Package_add_file,svx_inc,inc/svx/charthelper.hxx,svx/charthelper.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sxsoitm.hxx,svx/sxsoitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/sdshtitm.hxx,svx/sdshtitm.hxx))
$(eval $(call gb_Package_add_file,svx_inc,inc/svx/polysc3d.hxx,svx/polysc3d.hxx))
diff --git a/drawinglayer/source/processor2d/helperchartrenderer.hxx b/svx/inc/svx/charthelper.hxx
index 13d768a2a1ad..4a0ac0d5eb95 100644
--- a/drawinglayer/source/processor2d/helperchartrenderer.hxx
+++ b/svx/inc/svx/charthelper.hxx
@@ -19,38 +19,37 @@
*
*************************************************************/
+#ifndef CHARTHELPER_HXX
+#define CHARTHELPER_HXX
-
-#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERCHARTRENDER_HXX
-#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERCHARTRENDER_HXX
-
-#include <sal/types.h>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <svx/svxdllapi.h>
+#include <drawinglayer/primitive2d/baseprimitive2d.hxx>
//////////////////////////////////////////////////////////////////////////////
-// predefines
-
-class OutputDevice;
+// predeclarations
-namespace drawinglayer { namespace primitive2d { class ChartPrimitive2D; }}
-namespace drawinglayer { namespace geometry { class ViewInformation2D; }}
+namespace svt { class EmbeddedObjectRef; }
//////////////////////////////////////////////////////////////////////////////
-// support chart PrettyPrinter usage from primitives
-namespace drawinglayer
+class SVX_DLLPUBLIC ChartHelper
{
- // #i101811#
- // Added current ViewInformation2D to take evtl. changed
- // ObjectTransformation into account
- bool renderChartPrimitive2D(
- const primitive2d::ChartPrimitive2D& rChartCandidate,
- OutputDevice& rOutputDevice,
- const geometry::ViewInformation2D& rViewInformation2D);
-
-} // end of namespace drawinglayer
+public:
+ // test if given reference is a chart
+ static bool IsChart(const svt::EmbeddedObjectRef& xObjRef);
+
+ // try to access rXModel in case of a chart to to get the chart content
+ // as sequence of primitives. Return range of primitives (chart size) in rRange;
+ // it will be used to embed the chart to the SdrObject transformation. This
+ // allows to define possible distances between chart and SDrObject bounds here
+ static drawinglayer::primitive2d::Primitive2DSequence tryToGetChartContentAsPrimitive2DSequence(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rXModel,
+ basegfx::B2DRange& rRange);
+};
//////////////////////////////////////////////////////////////////////////////
-#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_HELPERCHARTRENDER_HXX
-
-// eof
+#endif //CHARTHELPER_HXX
diff --git a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
index b0ecfabea799..c6e56507cebe 100644
--- a/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
+++ b/svx/inc/svx/sdr/contact/viewcontactofsdrole2obj.hxx
@@ -25,6 +25,7 @@
#define _SDR_CONTACT_VIEWCONTACTOFSDROLE2OBJ_HXX
#include <svx/sdr/contact/viewcontactofsdrrectobj.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
//////////////////////////////////////////////////////////////////////////////
// predeclarations
@@ -52,6 +53,9 @@ namespace sdr
return (SdrOle2Obj&)GetSdrObject();
}
+ /// helper to create transformation from SdrObject
+ basegfx::B2DHomMatrix createObjectTransform() const;
+
// basic constructor, used from SdrObject.
ViewContactOfSdrOle2Obj(SdrOle2Obj& rOle2Obj);
virtual ~ViewContactOfSdrOle2Obj();
diff --git a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
index 3c9d96413c70..c1018c24db13 100644
--- a/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrole2obj.cxx
@@ -38,6 +38,8 @@
#include <vcl/svapp.hxx>
#include <svx/sdr/primitive2d/sdrolecontentprimitive2d.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
+#include <drawinglayer/primitive2d/transformprimitive2d.hxx>
+#include <svx/charthelper.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -64,8 +66,7 @@ namespace sdr
{
}
- drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters(
- bool bHighContrast) const
+ basegfx::B2DHomMatrix ViewContactOfSdrOle2Obj::createObjectTransform() const
{
// take unrotated snap rect (direct model data) for position and size
const Rectangle& rRectangle = GetOle2Obj().GetGeoRect();
@@ -75,9 +76,19 @@ namespace sdr
const GeoStat& rGeoStat(GetOle2Obj().GetGeoStat());
const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
const double fRotate(rGeoStat.nDrehWink ? (36000 - rGeoStat.nDrehWink) * F_PI18000 : 0.0);
- const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
- aObjectRange.getWidth(), aObjectRange.getHeight(), fShearX, fRotate,
- aObjectRange.getMinX(), aObjectRange.getMinY()));
+
+ return basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
+ aObjectRange.getWidth(), aObjectRange.getHeight(),
+ fShearX,
+ fRotate,
+ aObjectRange.getMinX(), aObjectRange.getMinY());
+ }
+
+ drawinglayer::primitive2d::Primitive2DSequence ViewContactOfSdrOle2Obj::createPrimitive2DSequenceWithParameters(
+ bool bHighContrast) const
+ {
+ // get object transformation
+ const basegfx::B2DHomMatrix aObjectMatrix(createObjectTransform());
// Prepare attribute settings, will be used soon anyways
const SfxItemSet& rItemSet = GetOle2Obj().GetMergedItemSet();
@@ -85,13 +96,44 @@ namespace sdr
drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
rItemSet,
GetOle2Obj().getText(0)));
-
- // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
- // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
- // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
- // It will also take care of HighContrast and ScaleContent
- const drawinglayer::primitive2d::Primitive2DReference xOleContent(
- new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
+ drawinglayer::primitive2d::Primitive2DReference xContent;
+
+ if(GetOle2Obj().IsChart())
+ {
+ // try to get chart primitives and chart range directly from xChartModel
+ basegfx::B2DRange aChartContentRange;
+ const drawinglayer::primitive2d::Primitive2DSequence aChartSequence(
+ ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
+ GetOle2Obj().getXModel(),
+ aChartContentRange));
+ const double fWidth(aChartContentRange.getWidth());
+ const double fHeight(aChartContentRange.getHeight());
+
+ if(aChartSequence.hasElements()
+ && basegfx::fTools::more(fWidth, 0.0)
+ && basegfx::fTools::more(fHeight, 0.0))
+ {
+ // create embedding transformation
+ basegfx::B2DHomMatrix aEmbed(
+ basegfx::tools::createTranslateB2DHomMatrix(
+ -aChartContentRange.getMinX(),
+ -aChartContentRange.getMinY()));
+
+ aEmbed.scale(1.0 / fWidth, 1.0 / fHeight);
+ aEmbed = aObjectMatrix * aEmbed;
+ xContent = new drawinglayer::primitive2d::TransformPrimitive2D(
+ aEmbed,
+ aChartSequence);
+ }
+ }
+
+ if(!xContent.is())
+ {
+ // #i102063# embed OLE content in an own primitive; this will be able to decompose accessing
+ // the weak SdrOle2 reference and will also implement getB2DRange() for fast BoundRect
+ // calculations without OLE Graphic access (which may trigger e.g. chart recalculation).
+ // It will also take care of HighContrast and ScaleContent
+ xContent = new drawinglayer::primitive2d::SdrOleContentPrimitive2D(
GetOle2Obj(),
aObjectMatrix,
@@ -99,15 +141,15 @@ namespace sdr
// content change in the primitive later
GetOle2Obj().getEmbeddedObjectRef().getGraphicVersion(),
- bHighContrast));
+ bHighContrast);
+ }
// create primitive. Use Ole2 primitive here. Prepare attribute settings, will
// be used soon anyways. Always create primitives to allow the decomposition of
// SdrOle2Primitive2D to create needed invisible elements for HitTest and/or BoundRect
- const drawinglayer::primitive2d::Primitive2DSequence xOLEContent(&xOleContent, 1);
const drawinglayer::primitive2d::Primitive2DReference xReference(
new drawinglayer::primitive2d::SdrOle2Primitive2D(
- xOLEContent,
+ drawinglayer::primitive2d::Primitive2DSequence(&xContent, 1),
aObjectMatrix,
aAttribute));
diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
index f3dba79597d1..2c21c50dc3e4 100644
--- a/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
+++ b/svx/source/sdr/contact/viewobjectcontactofsdrole2obj.cxx
@@ -30,12 +30,12 @@
#include <svx/svdoole2.hxx>
#include <svx/sdr/contact/objectcontact.hxx>
#include <svx/svdview.hxx>
-#include <drawinglayer/primitive2d/chartprimitive2d.hxx>
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/EmbedStates.hpp>
#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
//////////////////////////////////////////////////////////////////////////////
@@ -70,7 +70,6 @@ namespace sdr
const bool bIsOutplaceActive(nState == embed::EmbedStates::ACTIVE);
const bool bIsInplaceActive((nState == embed::EmbedStates::INPLACE_ACTIVE) || (nState == embed::EmbedStates::UI_ACTIVE));
- const bool bIsChart(rSdrOle2.IsChart());
bool bDone(false);
if(!bDone && bIsInplaceActive)
@@ -85,122 +84,49 @@ namespace sdr
if( !bDone )
{
- const Rectangle& rObjectRectangle(rSdrOle2.GetGeoRect());
- const basegfx::B2DRange aObjectRange(rObjectRectangle.Left(), rObjectRectangle.Top(), rObjectRectangle.Right(), rObjectRectangle.Bottom());
-
- // create object transform
- basegfx::B2DHomMatrix aObjectTransform;
- aObjectTransform.set(0, 0, aObjectRange.getWidth());
- aObjectTransform.set(1, 1, aObjectRange.getHeight());
- aObjectTransform.set(0, 2, aObjectRange.getMinX());
- aObjectTransform.set(1, 2, aObjectRange.getMinY());
-
- if(bIsChart)
+ //old stuff that should be reworked
{
- //charts must be painted resolution dependent!! #i82893#, #i75867#
-
- // for chart, to not lose the current better quality visualisation which
- // uses a direct paint, use a primtive wrapper for that exceptional case. The renderers
- // will then ATM paint it to an OutputDevice directly.
- // In later versions this should be replaced by getting the Primitive2DSequnce from
- // the chart and using it.
- // to be able to render something in non-VCL using renderers, the wrapper is a
- // GroupPrimitive2D which automatically decomposes to the already created Metafile
- // content.
- // For being completely compatible, ATM Window and VDEV PrettyPrinting is suppressed.
- // It works in the VCL renderers, though. So for activating again with VCL primitive
- // renderers, change conditions here.
-
- // determine if embedding and PrettyPrinting shall be done at all
- uno::Reference< frame::XModel > xChartModel;
- bool bDoChartPrettyPrinting(true);
-
- // the original ChartPrettyPainter does not do it for Window
- if(bDoChartPrettyPrinting && GetObjectContact().isOutputToWindow())
+ //if no replacement image is available load the OLE object
+// if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925#
+// {
+// // try to create embedded object
+// rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already
+// }
+ const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
+ if(xObjRef.is())
{
- bDoChartPrettyPrinting = false;
- }
+ const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect()));
- // the original ChartPrettyPainter does not do it for VDEV
- if(bDoChartPrettyPrinting && GetObjectContact().isOutputToVirtualDevice())
- {
- if(GetObjectContact().isOutputToPDFFile())
- {
- // #i97982#
- // For PDF files, allow PrettyPrinting
- }
- else
+ // this hack (to change model data during PAINT argh(!)) should be reworked
+ if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE))
{
- bDoChartPrettyPrinting = false;
+ const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true);
}
- }
-
- // the chart model is needed. Check if it's available
- if(bDoChartPrettyPrinting)
- {
- // get chart model
- xChartModel = rSdrOle2.getXModel();
- if(!xChartModel.is())
+ SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
+ if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
{
- bDoChartPrettyPrinting = false;
+ // connect plugin object
+ pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
}
}
+ }//end old stuff to rework
- if(bDoChartPrettyPrinting)
- {
- // embed MetaFile data in a specialized Wrapper Primitive which holds also the ChartModel needed
- // for PrettyPrinting
- const drawinglayer::primitive2d::Primitive2DReference xReference(new drawinglayer::primitive2d::ChartPrimitive2D(
- xChartModel, aObjectTransform, xRetval));
- xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
- bDone = true;
- }
- }
-
- if( !bDone )
- {
- //old stuff that should be reworked
- {
- //if no replacement image is available load the OLE object
- if(!rSdrOle2.GetGraphic()) //try to fetch the metafile - this can lead to the actual creation of the metafile what can be extremely expensive (e.g. for big charts)!!! #i101925#
- {
- // try to create embedded object
- rSdrOle2.GetObjRef(); //this loads the OLE object if it is not loaded already
- }
- const svt::EmbeddedObjectRef& xObjRef = rSdrOle2.getEmbeddedObjectRef();
- if(xObjRef.is())
- {
- const sal_Int64 nMiscStatus(xObjRef->getStatus(rSdrOle2.GetAspect()));
-
- // this hack (to change model data during PAINT argh(!)) should be reworked
- if(!rSdrOle2.IsResizeProtect() && (nMiscStatus & embed::EmbedMisc::EMBED_NEVERRESIZE))
- {
- const_cast< SdrOle2Obj* >(&rSdrOle2)->SetResizeProtect(true);
- }
-
- SdrPageView* pPageView = GetObjectContact().TryToGetSdrPageView();
- if(pPageView && (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
- {
- // connect plugin object
- pPageView->GetView().DoConnect(const_cast< SdrOle2Obj* >(&rSdrOle2));
- }
- }
- }//end old stuff to rework
-
- // create OLE primitive stuff directly at VC with HC as parameter
- const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
- xRetval = rVC.createPrimitive2DSequenceWithParameters(GetObjectContact().isDrawModeHighContrast());
- }
+ // create OLE primitive stuff directly at VC with HC as parameter
+ const ViewContactOfSdrOle2Obj& rVC = static_cast< const ViewContactOfSdrOle2Obj& >(GetViewContact());
+ xRetval = rVC.createPrimitive2DSequenceWithParameters(GetObjectContact().isDrawModeHighContrast());
if(bIsOutplaceActive)
{
// do not shade when printing or PDF exporting
if(!GetObjectContact().isOutputToPrinter() && !GetObjectContact().isOutputToRecordingMetaFile())
{
+ // get object transformation
+ const basegfx::B2DHomMatrix aObjectMatrix(static_cast< ViewContactOfSdrOle2Obj& >(GetViewContact()).createObjectTransform());
+
// shade the representation if the object is activated outplace
basegfx::B2DPolygon aObjectOutline(basegfx::tools::createUnitPolygon());
- aObjectOutline.transform(aObjectTransform);
+ aObjectOutline.transform(aObjectMatrix);
// Use a FillHatchPrimitive2D with necessary attributes
const drawinglayer::attribute::FillHatchAttribute aFillHatch(
diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx
new file mode 100644
index 000000000000..550960659ecf
--- /dev/null
+++ b/svx/source/svdraw/charthelper.cxx
@@ -0,0 +1,143 @@
+/**************************************************************
+ *
+ * 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_svx.hxx"
+
+#include <svx/charthelper.hxx>
+#include <svtools/embedhlp.hxx>
+#include <tools/globname.hxx>
+#include <sot/clsids.hxx>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/util/XUpdatable.hpp>
+#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp>
+#include <drawinglayer/geometry/viewinformation2d.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;
+
+//////////////////////////////////////////////////////////////////////////////
+
+bool ChartHelper::IsChart(const svt::EmbeddedObjectRef& xObjRef)
+{
+ if(!xObjRef.is())
+ {
+ return false;
+ }
+
+ const 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;
+}
+
+drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
+ const uno::Reference< ::frame::XModel >& rXModel,
+ basegfx::B2DRange& rRange)
+{
+ drawinglayer::primitive2d::Primitive2DSequence aRetval;
+
+ if(rXModel.is())
+ {
+ try
+ {
+ const uno::Reference< lang::XMultiServiceFactory > xChartFact(rXModel, uno::UNO_QUERY_THROW);
+ const uno::Reference< lang::XUnoTunnel > xChartView(xChartFact->createInstance(::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartView")), uno::UNO_QUERY_THROW);
+ const uno::Reference< util::XUpdatable > xUpdatable(xChartView, uno::UNO_QUERY_THROW);
+
+ if(xUpdatable.is())
+ {
+ xUpdatable->update();
+
+ const uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier(rXModel, uno::UNO_QUERY_THROW);
+ const uno::Reference< container::XIndexAccess > xShapeAccess(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY_THROW);
+
+ if(xShapeAccess.is() && xShapeAccess->getCount())
+ {
+ const sal_Int32 nShapeCount(xShapeAccess->getCount());
+ const uno::Reference< lang::XMultiServiceFactory > xMgr(::comphelper::getProcessServiceFactory());
+ const uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory(
+ xMgr->createInstance(
+ String(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.graphic.PrimitiveFactory2D" ))),
+ uno::UNO_QUERY);
+
+ if(xPrimitiveFactory.is())
+ {
+ const uno::Sequence< beans::PropertyValue > aParams;
+ uno::Reference< drawing::XShape > xShape;
+
+ for(sal_Int32 a(0); a < nShapeCount; a++)
+ {
+ xShapeAccess->getByIndex(a) >>= xShape;
+
+ if(xShape.is())
+ {
+ const drawinglayer::primitive2d::Primitive2DSequence aNew(
+ xPrimitiveFactory->createPrimitivesFromXShape(
+ xShape,
+ aParams));
+
+ drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
+ aRetval,
+ aNew);
+ }
+ }
+ }
+ }
+ }
+ }
+ catch(uno::Exception&)
+ {
+ OSL_ENSURE(false, "Unexpected exception!");
+ }
+
+ if(aRetval.hasElements())
+ {
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
+
+ rRange = drawinglayer::primitive2d::getB2DRangeFromPrimitive2DSequence(aRetval, aViewInformation2D);
+ }
+ }
+
+ return aRetval;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+// eof
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index 392e76b73496..f022c107375d 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -78,7 +78,7 @@
#include <svx/svdetc.hxx>
#include <svx/svdview.hxx>
#include "unomlstr.hxx"
-#include <svtools/chartprettypainter.hxx>
+#include <svx/charthelper.hxx>
#include <svx/sdr/contact/viewcontactofsdrole2obj.hxx>
#include <svx/svdograf.hxx>
#include <svx/sdr/properties/oleproperties.hxx>
@@ -2185,7 +2185,7 @@ sal_Bool SdrOle2Obj::IsChart() const
{
if ( !m_bTypeAsked )
{
- m_bChart = ChartPrettyPainter::IsChart(xObjRef);
+ m_bChart = ChartHelper::IsChart(xObjRef);
m_bTypeAsked = true;
}
return m_bChart;
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 01bdd1a04cfa..0ea9d1769b52 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -73,7 +73,7 @@
#include <com/sun/star/embed/EmbedStates.hpp>
#include <svtools/embedhlp.hxx>
-#include <svtools/chartprettypainter.hxx>
+#include <svx/charthelper.hxx>
// --> OD 2009-03-05 #i99665#
#include <dview.hxx>
// <--
@@ -817,6 +817,92 @@ void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, Out
}
}
+bool paintUsingPrimitivesHelper(
+ OutputDevice& rOutputDevice,
+ const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
+ const basegfx::B2DRange& rSourceRange,
+ const basegfx::B2DRange& rTargetRange,
+ const sal_Int32 nLeftCrop = 0,
+ const sal_Int32 nTopCrop = 0,
+ const sal_Int32 nRightCrop = 0,
+ const sal_Int32 nBottomCrop = 0,
+ const bool bMirrorX = false,
+ const bool bMirrorY = false)
+{
+ const double fSourceWidth(rSourceRange.getWidth());
+ const double fSourceHeight(rSourceRange.getHeight());
+
+ if(rSequence.hasElements() && !basegfx::fTools::equalZero(fSourceWidth) && !basegfx::fTools::equalZero(fSourceHeight))
+ {
+ // copy target range and apply evtl. cropping
+ basegfx::B2DRange aTargetRange(rTargetRange);
+
+ if(nLeftCrop || nTopCrop || nRightCrop || nBottomCrop)
+ {
+ // calculate original TargetRange
+ const double fFactor100thmmToTwips(72.0 / 127.0);
+
+ aTargetRange = basegfx::B2DRange(
+ aTargetRange.getMinX() - (nLeftCrop * fFactor100thmmToTwips),
+ aTargetRange.getMinY() - (nTopCrop * fFactor100thmmToTwips),
+ aTargetRange.getMaxX() + (nRightCrop * fFactor100thmmToTwips),
+ aTargetRange.getMaxY() + (nBottomCrop * fFactor100thmmToTwips));
+ }
+
+ const double fTargetWidth(aTargetRange.getWidth());
+ const double fTargetHeight(aTargetRange.getHeight());
+
+ if(!basegfx::fTools::equalZero(fTargetWidth) && !basegfx::fTools::equalZero(fTargetHeight))
+ {
+ // map graphic range to target range. This will automatically include
+ // tme mapping from Svg 1/100th mm content to twips since the target
+ // range is twips already
+ basegfx::B2DHomMatrix aMappingTransform(
+ basegfx::tools::createTranslateB2DHomMatrix(
+ -rSourceRange.getMinX(),
+ -rSourceRange.getMinY()));
+
+ aMappingTransform.scale(fTargetWidth / fSourceWidth, fTargetHeight / fSourceHeight);
+ aMappingTransform.translate(aTargetRange.getMinX(), aTargetRange.getMinY());
+
+ // apply mirrorings
+ if(bMirrorX || bMirrorY)
+ {
+ aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY());
+ aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorX ? -1.0 : 1.0);
+ aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY());
+ }
+
+ // Fill ViewInformation. Use MappingTransform here, so there is no need to
+ // embed the primitives to it. Use original TargetRange here so there is also
+ // no need to embed the primitives to a MaskPrimitive for cropping. This works
+ // only in this case where the graphic object cannot be rotated, though.
+ const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
+ aMappingTransform,
+ rOutputDevice.GetViewTransformation(),
+ aTargetRange,
+ 0,
+ 0.0,
+ uno::Sequence< beans::PropertyValue >());
+
+ // get a primitive processor for rendering
+ drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = sdr::contact::createBaseProcessor2DFromOutputDevice(
+ rOutputDevice,
+ aViewInformation2D);
+
+ if(pProcessor2D)
+ {
+ // render and cleanup
+ pProcessor2D->process(rSequence);
+ delete pProcessor2D;
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
// Ausgabe der Grafik. Hier wird entweder eine QuickDraw-Bmp oder
// eine Grafik vorausgesetzt. Ist nichts davon vorhanden, wird
// eine Ersatzdarstellung ausgegeben.
@@ -834,7 +920,7 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
const sal_Bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
pOut->GetConnectMetaFile();
- const bool bIsChart = pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() );
+ const bool bIsChart = pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() );
/// OD 25.09.2002 #99739# - calculate aligned rectangle from parameter <rGrfArea>.
/// Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
@@ -953,86 +1039,24 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if(rSvgDataPtr.get())
{
// Graphic is Svg and can be painted as primitives (vector graphic)
- const basegfx::B2DRange& rRange = rSvgDataPtr->getRange();
- const double fWidth(rRange.getWidth());
- const double fHeight(rRange.getHeight());
- const drawinglayer::primitive2d::Primitive2DSequence& rSequence = rSvgDataPtr->getPrimitive2DSequence();
-
- if(rSequence.hasElements() && !basegfx::fTools::equalZero(fWidth) && !basegfx::fTools::equalZero(fHeight))
- {
- // get target range
- const basegfx::B2DRange aTargetRange(
- aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
- aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
-
- // prepare evtl. cropped range
- basegfx::B2DRange aCroppedTargetRange(aTargetRange);
-
- if(aGrfAttr.IsCropped())
- {
- // calculate original TargetRange
- const double fFactor100thmmToTwips(72.0 / 127.0);
-
- aCroppedTargetRange = basegfx::B2DRange(
- aTargetRange.getMinX() - (aGrfAttr.GetLeftCrop() * fFactor100thmmToTwips),
- aTargetRange.getMinY() - (aGrfAttr.GetTopCrop() * fFactor100thmmToTwips),
- aTargetRange.getMaxX() + (aGrfAttr.GetRightCrop() * fFactor100thmmToTwips),
- aTargetRange.getMaxY() + (aGrfAttr.GetBottomCrop() * fFactor100thmmToTwips));
- }
-
- const double fTargetWidth(aCroppedTargetRange.getWidth());
- const double fTargetHeight(aCroppedTargetRange.getHeight());
-
- if(!basegfx::fTools::equalZero(fTargetWidth) && !basegfx::fTools::equalZero(fTargetHeight))
- {
- // map graphic range to target range. This will automatically include
- // tme mapping from Svg 1/100th mm content to twips since the target
- // range is twips already
- basegfx::B2DHomMatrix aMappingTransform(
- basegfx::tools::createTranslateB2DHomMatrix(
- -rRange.getMinX(),
- -rRange.getMinY()));
-
- aMappingTransform.scale(fTargetWidth / fWidth, fTargetHeight / fHeight);
- aMappingTransform.translate(aCroppedTargetRange.getMinX(), aCroppedTargetRange.getMinY());
-
- // check for and apply mirrorings
- const bool bMirrorHor(aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ);
- const bool bMirrorVer(aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT);
-
- if(bMirrorHor || bMirrorVer)
- {
- aMappingTransform.translate(-aCroppedTargetRange.getCenterX(), -aCroppedTargetRange.getCenterY());
- aMappingTransform.scale(bMirrorHor ? -1.0 : 1.0, bMirrorVer ? -1.0 : 1.0);
- aMappingTransform.translate(aCroppedTargetRange.getCenterX(), aCroppedTargetRange.getCenterY());
- }
-
- // Fill ViewInformation. Use MappingTransform here, so there is no need to
- // embed the primitives to it. Use original TargetRange here so there is also
- // no need to embed the primitives to a MaskPrimitive for cropping. This works
- // only in this case where the graphic object cannot be rotated, though.
- const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
- aMappingTransform,
- pOut->GetViewTransformation(),
- aTargetRange,
- 0,
- 0.0,
- com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >());
-
- // get a primitive processor for rendering
- drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = sdr::contact::createBaseProcessor2DFromOutputDevice(
- *pOut,
- aViewInformation2D);
-
- if(pProcessor2D)
- {
- // render and cleanup
- pProcessor2D->process(rSequence);
- delete pProcessor2D;
- bDone = true;
- }
- }
- }
+ const basegfx::B2DRange aTargetRange(
+ aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
+ aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
+ const bool bCropped(aGrfAttr.IsCropped());
+ const bool bMirrorHor(aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ);
+ const bool bMirrorVer(aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT);
+
+ bDone = paintUsingPrimitivesHelper(
+ *pOut,
+ rSvgDataPtr->getPrimitive2DSequence(),
+ rSvgDataPtr->getRange(),
+ aTargetRange,
+ bCropped ? aGrfAttr.GetLeftCrop() : 0,
+ bCropped ? aGrfAttr.GetTopCrop() : 0,
+ bCropped ? aGrfAttr.GetRightCrop() : 0,
+ bCropped ? aGrfAttr.GetBottomCrop() : 0,
+ aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ,
+ aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT);
}
if(!bDone)
@@ -1073,22 +1097,13 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
if( bForceSwap )
pGrfNd->SwapOut();
}
- else if( bIsChart
- //charts must be painted resolution dependent!! #i82893#, #i75867#
- && ChartPrettyPainter::ShouldPrettyPaintChartOnThisDevice( pOut )
- && svt::EmbeddedObjectRef::TryRunningState( pOLENd->GetOLEObj().GetOleRef() )
- && ChartPrettyPainter::DoPrettyPaintChart( uno::Reference< frame::XModel >(
- pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY), pOut, aAlignedGrfArea.SVRect() ) )
- {
- (void)(0);//all was done in if statement
- }
- else if( pOLENd )
+ else // bIsChart || pOLENd
{
// --> OD 2009-03-05 #i99665#
// Adjust AntiAliasing mode at output device for chart OLE
const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
if ( pOLENd->IsChart() &&
- pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ pShell->Imp()->GetDrawView()->IsAntiAliasing() )
{
const sal_uInt16 nAntialiasingForChartOLE =
nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE;
@@ -1096,59 +1111,92 @@ void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) cons
}
// <--
- Point aPosition(aAlignedGrfArea.Pos());
- Size aSize(aAlignedGrfArea.SSize());
+ bool bDone(false);
- // Im BrowseModus gibt es nicht unbedingt einen Drucker und
- // damit kein JobSetup, also legen wir eines an ...
- const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup();
- sal_Bool bDummyJobSetup = 0 == pJobSetup;
- if( bDummyJobSetup )
- pJobSetup = new JobSetup();
+ if(bIsChart)
+ {
+ const uno::Reference< frame::XModel > aXModel(pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY);
- // #i42323#
- // The reason for #114233# is gone, so i remove it again
- //TODO/LATER: is it a problem that the JopSetup isn't used?
- //xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
+ if(aXModel.is())
+ {
+ basegfx::B2DRange aSourceRange;
- // get hi-contrast image, but never for printing
- Graphic* pGraphic = NULL;
- if (pOut && !bPrn && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- pGraphic = pOLENd->GetHCGraphic();
+ const drawinglayer::primitive2d::Primitive2DSequence aSequence(
+ ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
+ aXModel,
+ aSourceRange));
- // when it is not possible to get HC-representation, the original image should be used
- if ( !pGraphic )
- pGraphic = pOLENd->GetGraphic();
+ if(aSequence.hasElements() && !aSourceRange.isEmpty())
+ {
+ const basegfx::B2DRange aTargetRange(
+ aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
+ aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
+
+ bDone = paintUsingPrimitivesHelper(
+ *pOut,
+ aSequence,
+ aSourceRange,
+ aTargetRange);
+ }
+ }
+ }
- if ( pGraphic && pGraphic->GetType() != GRAPHIC_NONE )
+ if(!bDone && pOLENd)
{
- pGraphic->Draw( pOut, aPosition, aSize );
-
- // shade the representation if the object is activated outplace
- uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
- if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
+ Point aPosition(aAlignedGrfArea.Pos());
+ Size aSize(aAlignedGrfArea.SSize());
+
+ // Im BrowseModus gibt es nicht unbedingt einen Drucker und
+ // damit kein JobSetup, also legen wir eines an ...
+ const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup();
+ sal_Bool bDummyJobSetup = 0 == pJobSetup;
+ if( bDummyJobSetup )
+ pJobSetup = new JobSetup();
+
+ // #i42323#
+ // The reason for #114233# is gone, so i remove it again
+ //TODO/LATER: is it a problem that the JopSetup isn't used?
+ //xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
+
+ // get hi-contrast image, but never for printing
+ Graphic* pGraphic = NULL;
+ if (pOut && !bPrn && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ pGraphic = pOLENd->GetHCGraphic();
+
+ // when it is not possible to get HC-representation, the original image should be used
+ if ( !pGraphic )
+ pGraphic = pOLENd->GetGraphic();
+
+ if ( pGraphic && pGraphic->GetType() != GRAPHIC_NONE )
{
- ::svt::EmbeddedObjectRef::DrawShading( Rectangle( aPosition, aSize ), pOut );
+ pGraphic->Draw( pOut, aPosition, aSize );
+
+ // shade the representation if the object is activated outplace
+ uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
+ if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
+ {
+ ::svt::EmbeddedObjectRef::DrawShading( Rectangle( aPosition, aSize ), pOut );
+ }
}
- }
- else
- ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
+ else
+ ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
- if( bDummyJobSetup )
- delete pJobSetup; // ... und raeumen wieder auf.
+ if( bDummyJobSetup )
+ delete pJobSetup; // ... und raeumen wieder auf.
- sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
- if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
- nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
- {
- const SwFlyFrm *pFly = FindFlyFrm();
- ASSERT( pFly, "OLE not in FlyFrm" );
- ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
+ sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
+ if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
+ nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
+ {
+ const SwFlyFrm *pFly = FindFlyFrm();
+ ASSERT( pFly, "OLE not in FlyFrm" );
+ ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
+ }
}
// --> OD 2009-03-05 #i99665#
if ( pOLENd->IsChart() &&
- pShell->Imp()->GetDrawView()->IsAntiAliasing() )
+ pShell->Imp()->GetDrawView()->IsAntiAliasing() )
{
pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
}
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 63326b442ed2..24967847c168 100755
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -90,7 +90,7 @@
// <--
#include <ndole.hxx>
-#include <svtools/chartprettypainter.hxx>
+#include <svx/charthelper.hxx>
#include <PostItMgr.hxx>
#include <tools/color.hxx>
#include <vcl/svapp.hxx>
@@ -3546,7 +3546,7 @@ void SwFlyFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
if( pNoTNd )
{
SwOLENode* pOLENd = const_cast<SwOLENode*>(pNoTNd->GetOLENode());
- if( pOLENd && ChartPrettyPainter::IsChart( pOLENd->GetOLEObj().GetObject() ) )
+ if( pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() ) )
bIsChart = true;
}
}
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 8dae2f641da0..6a352f8b50f6 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -34,7 +34,7 @@
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
#include <svl/zforlist.hxx> // SvNumberFormatter
-#include <svtools/chartprettypainter.hxx>
+#include <svx/charthelper.hxx>
#include <tools/link.hxx>
@@ -99,7 +99,7 @@ void SwChartHelper::DoUpdateAllCharts( SwDoc* pDoc )
{
aIdx++;
if (0 != ( pONd = aIdx.GetNode().GetOLENode() ) &&
- ChartPrettyPainter::IsChart( pONd->GetOLEObj().GetObject() ) )
+ ChartHelper::IsChart( pONd->GetOLEObj().GetObject() ) )
{
// Load the object and set modified