diff options
-rw-r--r-- | offapi/UnoApi_offapi.mk | 1 | ||||
-rw-r--r-- | offapi/com/sun/star/graphic/PrimitiveFactory2D.idl | 37 | ||||
-rw-r--r-- | svtools/source/filter/exportdialog.cxx | 54 | ||||
-rw-r--r-- | svx/source/svdraw/charthelper.cxx | 41 |
4 files changed, 82 insertions, 51 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index ed4a01f35061..0860f7d682d7 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2622,6 +2622,7 @@ $(eval $(call gb_ZipUnoApi_add_idlfiles,offapi,offapi/com/sun/star/geometry,\ $(eval $(call gb_ZipUnoApi_add_idlfiles,offapi,offapi/com/sun/star/graphic,\ GraphicColorMode \ GraphicType \ + PrimitiveFactory2D \ SvgTools \ XGraphic \ XGraphicObject \ diff --git a/offapi/com/sun/star/graphic/PrimitiveFactory2D.idl b/offapi/com/sun/star/graphic/PrimitiveFactory2D.idl new file mode 100644 index 000000000000..21042cca4740 --- /dev/null +++ b/offapi/com/sun/star/graphic/PrimitiveFactory2D.idl @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * 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 . + */ +#ifndef __com_sun_star_graphic_PrimitiveFactory2D_idl__ +#define __com_sun_star_graphic_PrimitiveFactory2D_idl__ + +#include <com/sun/star/graphic/XPrimitiveFactory2D.idl> + +module com { module sun { module star { module graphic { + +/** + @since LibreOffice 4.1 + */ +service PrimitiveFactory2D : XPrimitiveFactory2D; + +}; }; }; }; + +////////////////////////////////////////////////////////////////////////////// + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/filter/exportdialog.cxx b/svtools/source/filter/exportdialog.cxx index b3b81b4bbb49..384057d10e7b 100644 --- a/svtools/source/filter/exportdialog.cxx +++ b/svtools/source/filter/exportdialog.cxx @@ -34,7 +34,7 @@ #include <com/sun/star/frame/XController.hpp> #include <com/sun/star/drawing/XDrawView.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/graphic/XPrimitiveFactory2D.hpp> +#include <com/sun/star/graphic/PrimitiveFactory2D.hpp> #include <com/sun/star/geometry/AffineMatrix2D.hpp> #include <com/sun/star/document/XExporter.hpp> #include <com/sun/star/document/XFilter.hpp> @@ -45,6 +45,7 @@ #include <vcl/graph.hxx> #include <rtl/ustrbuf.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> +#include <comphelper/processfactory.hxx> #include "exportdialog.hxx" #define FORMAT_UNKNOWN 0 @@ -357,35 +358,32 @@ awt::Size ExportDialog::GetOriginalSize() } else { - uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory( - mxMgr->createInstance(OUString("com.sun.star.comp.graphic.PrimitiveFactory2D")), uno::UNO_QUERY); - if ( xPrimitiveFactory.is() ) + uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory = graphic::PrimitiveFactory2D::create( comphelper::getComponentContext(mxMgr) ); + + basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() ); + com::sun::star::geometry::AffineMatrix2D aTransformation; + aTransformation.m00 = aViewTransformation.get(0,0); + aTransformation.m01 = aViewTransformation.get(0,1); + aTransformation.m02 = aViewTransformation.get(0,2); + aTransformation.m10 = aViewTransformation.get(1,0); + aTransformation.m11 = aViewTransformation.get(1,1); + aTransformation.m12 = aViewTransformation.get(1,2); + + const OUString sViewTransformation( "ViewTransformation" ); + uno::Sequence< beans::PropertyValue > aViewInformation( 1 ); + aViewInformation[ 0 ].Value <<= aTransformation; + aViewInformation[ 0 ].Name = sViewTransformation; + + if ( mxShape.is() ) + aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation ); + else if ( mxShapes.is() ) { - basegfx::B2DHomMatrix aViewTransformation( Application::GetDefaultDevice()->GetViewTransformation() ); - com::sun::star::geometry::AffineMatrix2D aTransformation; - aTransformation.m00 = aViewTransformation.get(0,0); - aTransformation.m01 = aViewTransformation.get(0,1); - aTransformation.m02 = aViewTransformation.get(0,2); - aTransformation.m10 = aViewTransformation.get(1,0); - aTransformation.m11 = aViewTransformation.get(1,1); - aTransformation.m12 = aViewTransformation.get(1,2); - - const OUString sViewTransformation( "ViewTransformation" ); - uno::Sequence< beans::PropertyValue > aViewInformation( 1 ); - aViewInformation[ 0 ].Value <<= aTransformation; - aViewInformation[ 0 ].Name = sViewTransformation; - - if ( mxShape.is() ) - aShapesRange = GetShapeRangeForXShape( mxShape, xPrimitiveFactory, aViewInformation ); - else if ( mxShapes.is() ) + const sal_Int32 nCount = mxShapes->getCount(); + for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) { - const sal_Int32 nCount = mxShapes->getCount(); - for( sal_Int32 nIndex = 0; nIndex < nCount; nIndex++ ) - { - uno::Reference< drawing::XShape > xShape; - mxShapes->getByIndex( nIndex ) >>= xShape; - aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) ); - } + uno::Reference< drawing::XShape > xShape; + mxShapes->getByIndex( nIndex ) >>= xShape; + aShapesRange.expand( GetShapeRangeForXShape( xShape, xPrimitiveFactory, aViewInformation ) ); } } } diff --git a/svx/source/svdraw/charthelper.cxx b/svx/source/svdraw/charthelper.cxx index cc87019a7a5c..fa7ea9b597c8 100644 --- a/svx/source/svdraw/charthelper.cxx +++ b/svx/source/svdraw/charthelper.cxx @@ -26,7 +26,7 @@ #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 <com/sun/star/graphic/PrimitiveFactory2D.hpp> #include <drawinglayer/geometry/viewinformation2d.hxx> //// header for function rtl_createUuid @@ -87,32 +87,27 @@ drawinglayer::primitive2d::Primitive2DSequence ChartHelper::tryToGetChartContent 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); + const uno::Reference< uno::XComponentContext > xContext(::comphelper::getProcessComponentContext()); + const uno::Reference< graphic::XPrimitiveFactory2D > xPrimitiveFactory = + graphic::PrimitiveFactory2D::create( xContext ); - if(xPrimitiveFactory.is()) + const uno::Sequence< beans::PropertyValue > aParams; + uno::Reference< drawing::XShape > xShape; + + for(sal_Int32 a(0); a < nShapeCount; a++) { - const uno::Sequence< beans::PropertyValue > aParams; - uno::Reference< drawing::XShape > xShape; + xShapeAccess->getByIndex(a) >>= xShape; - for(sal_Int32 a(0); a < nShapeCount; a++) + if(xShape.is()) { - xShapeAccess->getByIndex(a) >>= xShape; - - if(xShape.is()) - { - const drawinglayer::primitive2d::Primitive2DSequence aNew( - xPrimitiveFactory->createPrimitivesFromXShape( - xShape, - aParams)); - - drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( - aRetval, - aNew); - } + const drawinglayer::primitive2d::Primitive2DSequence aNew( + xPrimitiveFactory->createPrimitivesFromXShape( + xShape, + aParams)); + + drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence( + aRetval, + aNew); } } } |