diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-07-06 05:23:43 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-07-06 05:23:43 -0430 |
commit | 5eb74b1fcad83c605cc00e377460e0ae313d7277 (patch) | |
tree | dae1a098290f55460e0da0a024105c1e28e19410 /drawinglayer | |
parent | dafa1f576482bc7a0086c353ffff0dbd594a7915 (diff) | |
parent | fa99c1ea4f6d450cc12998d4513ed8cf77bafcc9 (diff) |
Merge branch 'feature/template-dialog'
Conflicts:
sfx2/Library_sfx.mk
sfx2/inc/sfx2/sfxcommands.h
sfx2/inc/sfx2/sfxsids.hrc
sfx2/source/appl/appserv.cxx
svtools/Library_svt.mk
Change-Id: I4305d81cb5fd6f5192a29f85835c78f31310b0d6
Diffstat (limited to 'drawinglayer')
6 files changed, 176 insertions, 11 deletions
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index cfbf6b010dd8..94ab023682ea 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -34,13 +34,12 @@ $(eval $(call gb_Library_set_include,drawinglayer,\ )) $(eval $(call gb_Library_add_defs,drawinglayer,\ - -DDRAWINGLAYER_DLLIMPLEMENTATION \ + -DDRAWINGLAYER_DLLIMPLEMENTATION \ )) $(eval $(call gb_Library_use_sdk_api,drawinglayer)) $(eval $(call gb_Library_use_libraries,drawinglayer,\ - avmedia \ basegfx \ canvastools \ comphelper \ @@ -155,6 +154,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/processor2d/helperwrongspellrenderer \ drawinglayer/source/processor2d/hittestprocessor2d \ drawinglayer/source/processor2d/linegeometryextractor2d \ + drawinglayer/source/processor2d/processorfromoutputdevice \ drawinglayer/source/processor2d/textaspolygonextractor2d \ drawinglayer/source/processor2d/vclhelperbitmaprender \ drawinglayer/source/processor2d/vclhelperbitmaptransform \ diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk index 246a91f309cd..4cc1d34c530d 100644 --- a/drawinglayer/Package_inc.mk +++ b/drawinglayer/Package_inc.mk @@ -123,6 +123,7 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/canvasprocessor.hxx,drawinglayer/processor2d/canvasprocessor.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/contourextractor2d.hxx,drawinglayer/processor2d/contourextractor2d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/hittestprocessor2d.hxx,drawinglayer/processor2d/hittestprocessor2d.hxx)) +$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/processorfromoutputdevice.hxx,drawinglayer/processor2d/processorfromoutputdevice.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/linegeometryextractor2d.hxx,drawinglayer/processor2d/linegeometryextractor2d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx,drawinglayer/processor2d/textaspolygonextractor2d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx,drawinglayer/processor2d/vclmetafileprocessor2d.hxx)) diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx index bc9dcb9a495e..a0309334d54b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -34,6 +34,7 @@ #include <drawinglayer/primitive2d/baseprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/color/bcolor.hxx> +#include <vcl/graph.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -65,6 +66,8 @@ namespace drawinglayer /// discrete border (in 'pixels') sal_uInt32 mnDiscreteBorder; + const Graphic maSnapshot; + protected: /// local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; @@ -75,7 +78,8 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const rtl::OUString& rURL, const basegfx::BColor& rBackgroundColor, - sal_uInt32 nDiscreteBorder); + sal_uInt32 nDiscreteBorder, + const Graphic &rSnapshot); /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } diff --git a/drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx b/drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx new file mode 100644 index 000000000000..d7f208d381b8 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PROCESSOR_FROM_OUTPUTDEVICE_HXX +#define _PROCESSOR_FROM_OUTPUTDEVICE_HXX + +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include "drawinglayer/drawinglayerdllapi.h" + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class OutputDevice; + +namespace drawinglayer { namespace processor2d { + class BaseProcessor2D; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + // create a mating VCL-Provessor for given OutputDevice. This includes + // looking for MetaFile-recording. The returned renderer changes owner, + // deletion is duty of the caller + DRAWINGLAYER_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D); + + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_PROCESSOR_FROM_OUTPUTDEVICE_HXX + +// eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index 2a3a851d77fc..fde1423f44f5 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -21,7 +21,6 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> -#include <avmedia/mediawindow.hxx> #include <svtools/grfmgr.hxx> #include <drawinglayer/primitive2d/graphicprimitive2d.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> @@ -48,12 +47,9 @@ namespace drawinglayer getBackgroundColor())); xRetval[0] = xRefBackground; - // try to get graphic snapshot - const Graphic aGraphic(avmedia::MediaWindow::grabFrame(getURL(), true)); - - if(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType()) + if(GRAPHIC_BITMAP == maSnapshot.GetType() || GRAPHIC_GDIMETAFILE == maSnapshot.GetType()) { - const GraphicObject aGraphicObject(aGraphic); + const GraphicObject aGraphicObject(maSnapshot); const GraphicAttr aGraphicAttr; xRetval.realloc(2); xRetval[0] = xRefBackground; @@ -101,12 +97,14 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const rtl::OUString& rURL, const basegfx::BColor& rBackgroundColor, - sal_uInt32 nDiscreteBorder) + sal_uInt32 nDiscreteBorder, + const Graphic &rSnapshot) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maURL(rURL), maBackgroundColor(rBackgroundColor), - mnDiscreteBorder(nDiscreteBorder) + mnDiscreteBorder(nDiscreteBorder), + maSnapshot(rSnapshot) { } diff --git a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx new file mode 100644 index 000000000000..58f269040b77 --- /dev/null +++ b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx @@ -0,0 +1,96 @@ +/* -*- 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 . + */ + + +#include <vcl/outdev.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/range/b2drange.hxx> +#include <vcl/gdimtf.hxx> +#include <basegfx/tools/canvastools.hxx> +#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> +#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx> +#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> +#include <drawinglayer/processor2d/canvasprocessor.hxx> +#include <vcl/window.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) + { + const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile(); + const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); + + if(bOutputToRecordingMetaFile) + { + // create MetaFile Vcl-Processor and process + return new drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev); + } + else + { +#ifdef WIN32 + // for a first AA incarnation VCL-PixelRenderer will be okay since + // simple (and fast) GDIPlus support over VCL will be used. + // Leaving the code below as a hint for what to do when we will + // use canvas renderers in the future + + //static SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + + //if(false && aSvtOptionsDrawinglayer.IsAntiAliasing()) + //{ + // // for WIN32 AA, create cairo canvas processor + // return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev); + //} + //else + //{ + // create Pixel Vcl-Processor + return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev); + //} +#else + static bool bTryTestCanvas(false); + + if(bTryTestCanvas) + { + // create test-cancas-Processor + return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev); + } + else + { + // create Pixel Vcl-Processor + return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev); + } +#endif + } + } + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |