2010-10-14 08:27:31 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
* 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/.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
* This file incorporates work covered by the following license notice:
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
re-base on ALv2 code. Includes (at least) relevant parts of:
linecap: Reintegrating finished LineCap feature
Patch contributed by Regina Henschel
http://svn.apache.org/viewvc?view=revision&revision=1232507
Patches contributed by Sven Jacobi
impress212: #i81610# fixed animation export
http://svn.apache.org/viewvc?view=revision&revision=1167620
impress212: drawinglayer gbuild environment changes
http://svn.apache.org/viewvc?view=revision&revision=1167627
http://svn.apache.org/viewvc?view=revision&revision=1167628
impress212: DffPropSet -> minor code improvements, removing table
http://svn.apache.org/viewvc?view=revision&revision=1167634
impress212: #158494# fixed excel import (text rotation)
http://svn.apache.org/viewvc?view=revision&revision=1167638
Patches contributed by Armin Le Grand
Svg: Reintegrated Svg replacement from /branches/alg/svgreplavement
http://svn.apache.org/viewvc?view=revision&revision=1220836
#118728# changed indentifying definitions for Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1229961
#118838# LineGeometry creation for complicated cases optimized to
create single Polygons
http://svn.apache.org/viewvc?view=revision&revision=1236232
#119176# corrected file type detection for SVG for svg files
without xml header
http://svn.apache.org/viewvc?view=revision&revision=1309445
#118728# Extended Svg file detection
http://svn.apache.org/viewvc?view=revision&revision=1230531
#118529# solve break converters and convert commands for OLEs and images
http://svn.apache.org/viewvc?view=revision&revision=1186168
svg: added WaE changes from branch svgreplacement to trunc
http://svn.apache.org/viewvc?view=revision&revision=1222974
svg: corrected missing member initialization
http://svn.apache.org/viewvc?view=revision&revision=1226134
fix for #118525#: Using primitives for chart sub-geometry visualisation
http://svn.apache.org/viewvc?view=revision&revision=1226879
#118898# Adapted ImpGraphic::ImplGetBitmap to correctly convert
metafiles to bitmapEx ...
http://svn.apache.org/viewvc?view=revision&revision=1293316
fix for #118525#: removed no longer used variable maOriginalMapMode, one
more exception eliminated
http://svn.apache.org/viewvc?view=revision&revision=1227097
#16758# Added buffering to the VDev usages of the VclProcessor2D derivates...
http://svn.apache.org/viewvc?view=revision&revision=1229521
#116758# Secured VDev buffer device to Vcl deinit
http://svn.apache.org/viewvc?view=revision&revision=1230574
#116758# added remembering allocated VDevs for VDevBuffer to be able to also
delete these when vcl goes down; it should never happen, but You never know
http://svn.apache.org/viewvc?view=revision&revision=1230927
#118730# Changed SvgClipPathNode to use MaskPrimitive2D for primitive
representation instead of TransparencePrimitive2D
http://svn.apache.org/viewvc?view=revision&revision=1231198
#118822# secured 3D geometry creation (slices) by subdividing the 2D
source polyPolygon early
http://svn.apache.org/viewvc?view=revision&revision=1234749
#118829# enhanced Svg gradient quality, obstacles avoided
http://svn.apache.org/viewvc?view=revision&revision=1235361
#118834# Unified usage of TextBreakupHelper as single tooling class
for i18n text primitive breakup
http://svn.apache.org/viewvc?view=revision&revision=1236110
#118853# added square pixel size limit to conversion of
TransparencePrimitive2D to Metafile action
http://svn.apache.org/viewvc?view=revision&revision=1237656
#118824# coreccted mirroring and boundrect when the graphicmanager
is used for bitmap output
http://svn.apache.org/viewvc?view=revision&revision=1240097
#115092# Corrected VclProcessor2D::RenderPolygonStrokePrimitive2D for
various optimization scenarios
http://svn.apache.org/viewvc?view=revision&revision=1241434
#118783# Corrected errors in ID strings, corrected Svg line/fill export,
corrected polygon close state
http://svn.apache.org/viewvc?view=revision&revision=1232006
#118796# corrected null-pointer usage in SVG text exporter
http://svn.apache.org/viewvc?view=revision&revision=1240262
#118729# Use GraphicStreamUrl and GraphicUrl to allow multi image
import with linked graphics, too
http://svn.apache.org/viewvc?view=revision&revision=1229962
#118898# corrected error in GDIMetaFile::GetBoundRect in handling
MetaFloatTransparentAction
http://svn.apache.org/viewvc?view=revision&revision=1293349
#118855# Corrected handling of possibly created empty clipRegions
after PolyPolygon clipping
http://svn.apache.org/viewvc?view=revision&revision=1237725
#115962# Better (but not yet optimal, see comments in task) handling
of MetaFloatTransparentAction in PDF export
http://svn.apache.org/viewvc?view=revision&revision=1241078
IP clearance: #118466# This patch removes librsvg, libcroco, libgsf, ...
http://svn.apache.org/viewvc?view=revision&revision=1200879
118779# Added svg content streaming in/out to ImpGraphic stream operators
http://svn.apache.org/viewvc?view=revision&revision=1231908
linecap: correctons for WaE and mac drawing
http://svn.apache.org/viewvc?view=revision&revision=1232793
svg: uses current system Dpi for Svg replacement image creation
http://svn.apache.org/viewvc?view=revision&revision=1233948
Patches contributed by Mathias Bauer (and others)
gnumake4 work variously
http://svn.apache.org/viewvc?view=revision&revision=1394326
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1394326
Remove duplicate header includes.
cws mba34issues01: #i117720#: convert assertion into warning
http://svn.apache.org/viewvc?view=revision&revision=1172352
118485 - Styles for OLEs are not saved. Submitted by Armin Le Grand.
http://svn.apache.org/viewvc?view=revision&revision=1182166
cws mba34issues01: #i117714#: remove assertion
http://svn.apache.org/viewvc?view=revision&revision=1172357
Patch contributed by Jurgen Schmidt
add some additional checks to ensure proper reading operations
http://svn.apache.org/viewvc?view=revision&revision=1209022
mostly prefer our stream / bounds checking work.
Patches contributed by Herbert Duerr
#i118816# add clarifying comment regarding Font::*Color*() methods
http://svn.apache.org/viewvc?view=revision&revision=1233833
extend macro->string handling for empty strings
http://svn.apache.org/viewvc?view=revision&revision=1175801
avoid magic constants for SALCOLOR_NONE
http://svn.apache.org/viewvc?view=revision&revision=1177543
initialize slant properly in ImplFontMetricData constructor (author=iorsh)
http://svn.apache.org/viewvc?view=revision&revision=1177551
#i118675# make check for extension updates more stable
http://svn.apache.org/viewvc?view=revision&revision=1214797
#a118617# remove VBasicEventListener.dll binary
There are no known users depending on its CLSID
http://svn.apache.org/viewvc?view=revision&revision=1203697
Patches contributed by Ariel Constenla-Haile
Fix build breaker on Linux/gcc
http://svn.apache.org/viewvc?view=revision&revision=1221104
Fix crash when trying to instantiate css.graphic.GraphicRasterizer_RSVG
http://svn.apache.org/viewvc?view=revision&revision=1215559
Patches contributed by Oliver-Rainer Wittmann
sw34bf06: #i117962# - method <SwFlyFrm::IsPaint(..)> - consider
instances of <SwFlyDrawObj>
http://svn.apache.org/viewvc?view=revision&revision=1172120
sw34bf06: #i117783# - Writer's implementation of XPagePrintable -
apply print settings to new printing routines
http://svn.apache.org/viewvc?view=revision&revision=1172115
gnumake4 work variously from Hans-Joachim Lankenau
http://svn.apache.org/viewvc?view=revision&revision=1397315
http://svn.apache.org/viewvc?view=revision&revision=1396797
http://svn.apache.org/viewvc?view=revision&revision=1396782
http://svn.apache.org/viewvc?view=revision&revision=1394707
plus some amount of re-splitting of legacy headers.
Patch contributed by Pavel Janik
WaE: Remove unused variables.
http://svn.apache.org/viewvc?view=revision&revision=1230697
Patches contributed by Takashi Ono
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
mingwport35: i#117795: MinGW port fix for vcl2gnumake
http://svn.apache.org/viewvc?view=revision&revision=1172091
Patch contributed by Christian Lippka
impress212: #i98044# re enable Text menu for outline and title shapes
http://svn.apache.org/viewvc?view=revision&revision=1167639
Patch contributed by Andre Fischer
118674: Made category B code optional and disabled by default.
http://svn.apache.org/viewvc?view=revision&revision=1215131
118881: Ignore empty paragraphs after bullets.
http://svn.apache.org/viewvc?view=revision&revision=1296205
Patches contributed by Philipp Lohmann
ooo340fixes: #i117780# use rtl allocator
http://svn.apache.org/viewvc?view=revision&revision=1172087
ooo34gsl02: #i117807# fix an off by one error (index actually
inside the pfb section header)
http://svn.apache.org/viewvc?view=revision&revision=1167576
various cleanups, related compilation fixes, warning cleanups, re-working
of obsolete stl template pieces to use boost instead, changed string
classes, re-adapt KDE about data, about dialog, fixing warnings,
and other fixes & improvements.
Disable svg import / render for about/ branding code-paths for now.
Restore full icon theme set.
Remove OS/2 conditionals and sources.
Remove conflicting gtk/full-screen monitors support.
Retain existing svg rasterizer files - temporarily disabled.
Standardize stringificaiton and fixup dllpostfix issues.
Rename SvgGradientHelper::== to equalTo to avoid overloading issues.
Use the flat GdiPlus API for LineCaps calls.
2012-10-09 12:22:23 +01:00
|
|
|
* 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 .
|
|
|
|
*/
|
2006-09-17 11:09:54 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
#include <functional>
|
|
|
|
#include <algorithm>
|
|
|
|
#include <utility>
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
2011-01-24 16:34:14 +01:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
#include <basegfx/polygon/b2dpolygon.hxx>
|
|
|
|
#include <basegfx/polygon/b2dpolygontools.hxx>
|
2011-01-24 16:34:14 +01:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
#include <tools/debug.hxx>
|
2011-01-24 16:34:14 +01:00
|
|
|
|
2007-06-27 19:22:34 +00:00
|
|
|
#include <vcl/virdev.hxx>
|
|
|
|
#include <vcl/metaact.hxx>
|
|
|
|
#include <vcl/gdimtf.hxx>
|
|
|
|
#include <vcl/print.hxx>
|
|
|
|
#include <vcl/svapp.hxx>
|
|
|
|
#include <vcl/bmpacc.hxx>
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2011-01-24 16:34:14 +01:00
|
|
|
#include <print.h>
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
#include "pdfwriter_impl.hxx"
|
|
|
|
|
2001-05-21 10:00:36 +00:00
|
|
|
#define MAX_TILE_WIDTH 1024
|
|
|
|
#define MAX_TILE_HEIGHT 1024
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
typedef ::std::pair< MetaAction*, int > Component; // MetaAction plus index in metafile
|
|
|
|
|
|
|
|
typedef ::std::list< Component > ComponentList;
|
|
|
|
|
|
|
|
// List of (intersecting) actions, plus overall bounds
|
|
|
|
struct ConnectedComponents
|
|
|
|
{
|
|
|
|
ConnectedComponents() :
|
|
|
|
aComponentList(),
|
|
|
|
aBounds(),
|
|
|
|
aBgColor(COL_WHITE),
|
|
|
|
bIsSpecial(false),
|
|
|
|
bIsFullyTransparent(false)
|
|
|
|
{}
|
|
|
|
|
|
|
|
ComponentList aComponentList;
|
|
|
|
Rectangle aBounds;
|
|
|
|
Color aBgColor;
|
|
|
|
bool bIsSpecial;
|
|
|
|
bool bIsFullyTransparent;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef ::std::list< ConnectedComponents > ConnectedComponentsList;
|
|
|
|
|
|
|
|
/** #i10613# Extracted from Printer::GetPreparedMetaFile. Returns true
|
|
|
|
if given action requires special handling (usually because of
|
|
|
|
transparency)
|
|
|
|
*/
|
2003-03-27 16:59:30 +00:00
|
|
|
static bool ImplIsActionSpecial( const MetaAction& rAct )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-04-24 13:56:59 +00:00
|
|
|
switch( rAct.GetType() )
|
|
|
|
{
|
|
|
|
case META_TRANSPARENT_ACTION:
|
|
|
|
return true;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
2003-04-24 13:56:59 +00:00
|
|
|
case META_FLOATTRANSPARENT_ACTION:
|
|
|
|
return true;
|
|
|
|
|
|
|
|
case META_BMPEX_ACTION:
|
2008-10-01 13:31:44 +00:00
|
|
|
return static_cast<const MetaBmpExAction&>(rAct).GetBitmapEx().IsTransparent();
|
2003-04-24 13:56:59 +00:00
|
|
|
|
|
|
|
case META_BMPEXSCALE_ACTION:
|
2008-10-01 13:31:44 +00:00
|
|
|
return static_cast<const MetaBmpExScaleAction&>(rAct).GetBitmapEx().IsTransparent();
|
2003-04-24 13:56:59 +00:00
|
|
|
|
|
|
|
case META_BMPEXSCALEPART_ACTION:
|
2008-10-01 13:31:44 +00:00
|
|
|
return static_cast<const MetaBmpExScalePartAction&>(rAct).GetBitmapEx().IsTransparent();
|
2003-04-24 13:56:59 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
/** Check whether rCurrRect rectangle fully covers io_rPrevRect - if
|
|
|
|
yes, return true and update o_rBgColor
|
|
|
|
*/
|
|
|
|
static bool checkRect( Rectangle& io_rPrevRect,
|
|
|
|
Color& o_rBgColor,
|
|
|
|
const Rectangle& rCurrRect,
|
|
|
|
OutputDevice& rMapModeVDev )
|
2003-04-24 13:56:59 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
// shape needs to fully cover previous content, and have uniform
|
|
|
|
// color
|
|
|
|
const bool bRet(
|
|
|
|
rMapModeVDev.LogicToPixel(rCurrRect).IsInside(io_rPrevRect) &&
|
|
|
|
rMapModeVDev.IsFillColor() );
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
if( bRet )
|
|
|
|
{
|
|
|
|
io_rPrevRect = rCurrRect;
|
|
|
|
o_rBgColor = rMapModeVDev.GetFillColor();
|
2003-04-24 13:56:59 +00:00
|
|
|
}
|
2008-10-01 13:31:44 +00:00
|
|
|
|
|
|
|
return bRet;
|
2003-04-24 13:56:59 +00:00
|
|
|
}
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
/** #107169# Convert BitmapEx to Bitmap with appropriately blended
|
|
|
|
color. Convert MetaTransparentAction to plain polygon,
|
|
|
|
appropriately colored
|
|
|
|
|
|
|
|
@param o_rMtf
|
|
|
|
Add converted actions to this metafile
|
|
|
|
*/
|
|
|
|
static void ImplConvertTransparentAction( GDIMetaFile& o_rMtf,
|
|
|
|
const MetaAction& rAct,
|
|
|
|
const OutputDevice& rStateOutDev,
|
|
|
|
Color aBgColor )
|
2003-04-24 13:56:59 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
if( rAct.GetType() == META_TRANSPARENT_ACTION )
|
2003-04-24 13:56:59 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
const MetaTransparentAction* pTransAct = static_cast<const MetaTransparentAction*>(&rAct);
|
2010-09-29 15:46:40 +08:00
|
|
|
sal_uInt16 nTransparency( pTransAct->GetTransparence() );
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
// #i10613# Respect transparency for draw color
|
|
|
|
if( nTransparency )
|
|
|
|
{
|
|
|
|
o_rMtf.AddAction( new MetaPushAction( PUSH_LINECOLOR|PUSH_FILLCOLOR ) );
|
|
|
|
|
|
|
|
// assume white background for alpha blending
|
|
|
|
Color aLineColor( rStateOutDev.GetLineColor() );
|
2010-09-29 15:46:40 +08:00
|
|
|
aLineColor.SetRed( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetRed()) / 100L ) );
|
|
|
|
aLineColor.SetGreen( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetGreen()) / 100L ) );
|
|
|
|
aLineColor.SetBlue( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aLineColor.GetBlue()) / 100L ) );
|
|
|
|
o_rMtf.AddAction( new MetaLineColorAction(aLineColor, sal_True) );
|
2008-10-01 13:31:44 +00:00
|
|
|
|
|
|
|
Color aFillColor( rStateOutDev.GetFillColor() );
|
2010-09-29 15:46:40 +08:00
|
|
|
aFillColor.SetRed( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetRed()) / 100L ) );
|
|
|
|
aFillColor.SetGreen( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetGreen()) / 100L ) );
|
|
|
|
aFillColor.SetBlue( static_cast<sal_uInt8>( (255L*nTransparency + (100L - nTransparency)*aFillColor.GetBlue()) / 100L ) );
|
|
|
|
o_rMtf.AddAction( new MetaFillColorAction(aFillColor, sal_True) );
|
2008-10-01 13:31:44 +00:00
|
|
|
}
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
o_rMtf.AddAction( new MetaPolyPolygonAction(pTransAct->GetPolyPolygon()) );
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
if( nTransparency )
|
|
|
|
o_rMtf.AddAction( new MetaPopAction() );
|
2003-04-24 13:56:59 +00:00
|
|
|
}
|
2008-10-01 13:31:44 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
BitmapEx aBmpEx;
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
switch( rAct.GetType() )
|
|
|
|
{
|
|
|
|
case META_BMPEX_ACTION:
|
|
|
|
aBmpEx = static_cast<const MetaBmpExAction&>(rAct).GetBitmapEx();
|
|
|
|
break;
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
case META_BMPEXSCALE_ACTION:
|
|
|
|
aBmpEx = static_cast<const MetaBmpExScaleAction&>(rAct).GetBitmapEx();
|
|
|
|
break;
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
case META_BMPEXSCALEPART_ACTION:
|
|
|
|
aBmpEx = static_cast<const MetaBmpExScaleAction&>(rAct).GetBitmapEx();
|
|
|
|
break;
|
2003-05-28 11:31:24 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
case META_TRANSPARENT_ACTION:
|
2003-05-28 11:31:24 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
default:
|
2011-03-01 19:08:19 +01:00
|
|
|
OSL_FAIL("Printer::GetPreparedMetafile impossible state reached");
|
2008-10-01 13:31:44 +00:00
|
|
|
break;
|
|
|
|
}
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
Bitmap aBmp( aBmpEx.GetBitmap() );
|
|
|
|
if( !aBmpEx.IsAlpha() )
|
|
|
|
{
|
|
|
|
// blend with mask
|
|
|
|
BitmapReadAccess* pRA = aBmp.AcquireReadAccess();
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
if( !pRA )
|
|
|
|
return; // what else should I do?
|
2003-04-24 13:56:59 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
Color aActualColor( aBgColor );
|
|
|
|
|
|
|
|
if( pRA->HasPalette() )
|
|
|
|
aActualColor = pRA->GetBestPaletteColor( aBgColor ).operator Color();
|
|
|
|
|
|
|
|
aBmp.ReleaseAccess(pRA);
|
|
|
|
|
|
|
|
// did we get true white?
|
|
|
|
if( aActualColor.GetColorError( aBgColor ) )
|
|
|
|
{
|
|
|
|
// no, create truecolor bitmap, then
|
|
|
|
aBmp.Convert( BMP_CONVERSION_24BIT );
|
|
|
|
|
|
|
|
// fill masked out areas white
|
|
|
|
aBmp.Replace( aBmpEx.GetMask(), aBgColor );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// fill masked out areas white
|
|
|
|
aBmp.Replace( aBmpEx.GetMask(), aActualColor );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// blend with alpha channel
|
|
|
|
aBmp.Convert( BMP_CONVERSION_24BIT );
|
|
|
|
aBmp.Blend(aBmpEx.GetAlpha(),aBgColor);
|
|
|
|
}
|
|
|
|
|
|
|
|
// add corresponding action
|
|
|
|
switch( rAct.GetType() )
|
|
|
|
{
|
|
|
|
case META_BMPEX_ACTION:
|
|
|
|
o_rMtf.AddAction( new MetaBmpAction(
|
|
|
|
static_cast<const MetaBmpExAction&>(rAct).GetPoint(),
|
|
|
|
aBmp ));
|
|
|
|
break;
|
|
|
|
case META_BMPEXSCALE_ACTION:
|
|
|
|
o_rMtf.AddAction( new MetaBmpScaleAction(
|
|
|
|
static_cast<const MetaBmpExScaleAction&>(rAct).GetPoint(),
|
|
|
|
static_cast<const MetaBmpExScaleAction&>(rAct).GetSize(),
|
|
|
|
aBmp ));
|
|
|
|
break;
|
|
|
|
case META_BMPEXSCALEPART_ACTION:
|
|
|
|
o_rMtf.AddAction( new MetaBmpScalePartAction(
|
|
|
|
static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestPoint(),
|
|
|
|
static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestSize(),
|
|
|
|
static_cast<const MetaBmpExScalePartAction&>(rAct).GetSrcPoint(),
|
|
|
|
static_cast<const MetaBmpExScalePartAction&>(rAct).GetSrcSize(),
|
|
|
|
aBmp ));
|
|
|
|
break;
|
|
|
|
default:
|
2011-03-01 19:08:19 +01:00
|
|
|
OSL_FAIL("Unexpected case");
|
2008-10-01 13:31:44 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// #i10613# Extracted from ImplCheckRect::ImplCreate
|
|
|
|
// Returns true, if given action creates visible (i.e. non-transparent) output
|
|
|
|
static bool ImplIsNotTransparent( const MetaAction& rAct, const OutputDevice& rOut )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
const bool bLineTransparency( rOut.IsLineColor() ? rOut.GetLineColor().GetTransparency() == 255 : true );
|
|
|
|
const bool bFillTransparency( rOut.IsFillColor() ? rOut.GetFillColor().GetTransparency() == 255 : true );
|
2003-03-27 16:59:30 +00:00
|
|
|
bool bRet( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
switch( rAct.GetType() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_POINT_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_LINE_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_RECT_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_ROUNDRECT_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_ELLIPSE_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_ARC_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_PIE_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_CHORD_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_POLYLINE_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_POLYGON_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_POLYPOLYGON_ACTION:
|
2001-05-08 15:53:22 +00:00
|
|
|
if( !bLineTransparency || !bFillTransparency )
|
2003-03-27 16:59:30 +00:00
|
|
|
bRet = true;
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_TEXT_ACTION:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const MetaTextAction& rTextAct = static_cast<const MetaTextAction&>(rAct);
|
|
|
|
const XubString aString( rTextAct.GetText(), rTextAct.GetIndex(), rTextAct.GetLen() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if( aString.Len() )
|
|
|
|
bRet = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_TEXTARRAY_ACTION:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const MetaTextArrayAction& rTextAct = static_cast<const MetaTextArrayAction&>(rAct);
|
|
|
|
const XubString aString( rTextAct.GetText(), rTextAct.GetIndex(), rTextAct.GetLen() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if( aString.Len() )
|
|
|
|
bRet = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_PIXEL_ACTION:
|
|
|
|
case META_BMP_ACTION:
|
|
|
|
case META_BMPSCALE_ACTION:
|
|
|
|
case META_BMPSCALEPART_ACTION:
|
|
|
|
case META_BMPEX_ACTION:
|
|
|
|
case META_BMPEXSCALE_ACTION:
|
|
|
|
case META_BMPEXSCALEPART_ACTION:
|
|
|
|
case META_MASK_ACTION:
|
|
|
|
case META_MASKSCALE_ACTION:
|
|
|
|
case META_MASKSCALEPART_ACTION:
|
|
|
|
case META_GRADIENT_ACTION:
|
|
|
|
case META_GRADIENTEX_ACTION:
|
|
|
|
case META_HATCH_ACTION:
|
|
|
|
case META_WALLPAPER_ACTION:
|
|
|
|
case META_TRANSPARENT_ACTION:
|
|
|
|
case META_FLOATTRANSPARENT_ACTION:
|
|
|
|
case META_EPS_ACTION:
|
|
|
|
case META_TEXTRECT_ACTION:
|
|
|
|
case META_STRETCHTEXT_ACTION:
|
|
|
|
case META_TEXTLINE_ACTION:
|
|
|
|
// all other actions: generate non-transparent output
|
|
|
|
bRet = true;
|
|
|
|
break;
|
2001-03-20 15:52:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
return bRet;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// #i10613# Extracted from ImplCheckRect::ImplCreate
|
|
|
|
static Rectangle ImplCalcActionBounds( const MetaAction& rAct, const OutputDevice& rOut )
|
|
|
|
{
|
|
|
|
Rectangle aActionBounds;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
switch( rAct.GetType() )
|
|
|
|
{
|
|
|
|
case META_PIXEL_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaPixelAction&>(rAct).GetPoint(), Size( 1, 1 ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_POINT_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaPointAction&>(rAct).GetPoint(), Size( 1, 1 ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_LINE_ACTION:
|
2010-10-12 17:52:43 +02:00
|
|
|
{
|
|
|
|
const MetaLineAction& rMetaLineAction = static_cast<const MetaLineAction&>(rAct);
|
|
|
|
aActionBounds = Rectangle( rMetaLineAction.GetStartPoint(), rMetaLineAction.GetEndPoint() );
|
2010-11-12 16:14:48 +01:00
|
|
|
aActionBounds.Justify();
|
2010-10-12 17:52:43 +02:00
|
|
|
const long nLineWidth(rMetaLineAction.GetLineInfo().GetWidth());
|
|
|
|
if(nLineWidth)
|
|
|
|
{
|
|
|
|
const long nHalfLineWidth((nLineWidth + 1) / 2);
|
|
|
|
aActionBounds.Left() -= nHalfLineWidth;
|
|
|
|
aActionBounds.Top() -= nHalfLineWidth;
|
|
|
|
aActionBounds.Right() += nHalfLineWidth;
|
|
|
|
aActionBounds.Bottom() += nHalfLineWidth;
|
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
break;
|
2010-10-12 17:52:43 +02:00
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
case META_RECT_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaRectAction&>(rAct).GetRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_ROUNDRECT_ACTION:
|
|
|
|
aActionBounds = Polygon( static_cast<const MetaRoundRectAction&>(rAct).GetRect(),
|
|
|
|
static_cast<const MetaRoundRectAction&>(rAct).GetHorzRound(),
|
|
|
|
static_cast<const MetaRoundRectAction&>(rAct).GetVertRound() ).GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_ELLIPSE_ACTION:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const Rectangle& rRect = static_cast<const MetaEllipseAction&>(rAct).GetRect();
|
|
|
|
aActionBounds = Polygon( rRect.Center(),
|
|
|
|
rRect.GetWidth() >> 1,
|
|
|
|
rRect.GetHeight() >> 1 ).GetBoundRect();
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_ARC_ACTION:
|
|
|
|
aActionBounds = Polygon( static_cast<const MetaArcAction&>(rAct).GetRect(),
|
|
|
|
static_cast<const MetaArcAction&>(rAct).GetStartPoint(),
|
|
|
|
static_cast<const MetaArcAction&>(rAct).GetEndPoint(), POLY_ARC ).GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_PIE_ACTION:
|
|
|
|
aActionBounds = Polygon( static_cast<const MetaPieAction&>(rAct).GetRect(),
|
|
|
|
static_cast<const MetaPieAction&>(rAct).GetStartPoint(),
|
|
|
|
static_cast<const MetaPieAction&>(rAct).GetEndPoint(), POLY_PIE ).GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_CHORD_ACTION:
|
|
|
|
aActionBounds = Polygon( static_cast<const MetaChordAction&>(rAct).GetRect(),
|
|
|
|
static_cast<const MetaChordAction&>(rAct).GetStartPoint(),
|
|
|
|
static_cast<const MetaChordAction&>(rAct).GetEndPoint(), POLY_CHORD ).GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_POLYLINE_ACTION:
|
2010-10-12 17:52:43 +02:00
|
|
|
{
|
|
|
|
const MetaPolyLineAction& rMetaPolyLineAction = static_cast<const MetaPolyLineAction&>(rAct);
|
|
|
|
aActionBounds = rMetaPolyLineAction.GetPolygon().GetBoundRect();
|
|
|
|
const long nLineWidth(rMetaPolyLineAction.GetLineInfo().GetWidth());
|
|
|
|
if(nLineWidth)
|
|
|
|
{
|
|
|
|
const long nHalfLineWidth((nLineWidth + 1) / 2);
|
|
|
|
aActionBounds.Left() -= nHalfLineWidth;
|
|
|
|
aActionBounds.Top() -= nHalfLineWidth;
|
|
|
|
aActionBounds.Right() += nHalfLineWidth;
|
|
|
|
aActionBounds.Bottom() += nHalfLineWidth;
|
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
break;
|
2010-10-12 17:52:43 +02:00
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
case META_POLYGON_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaPolygonAction&>(rAct).GetPolygon().GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_POLYPOLYGON_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaPolyPolygonAction&>(rAct).GetPolyPolygon().GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BMP_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaBmpAction&>(rAct).GetPoint(),
|
|
|
|
rOut.PixelToLogic( static_cast<const MetaBmpAction&>(rAct).GetBitmap().GetSizePixel() ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BMPSCALE_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaBmpScaleAction&>(rAct).GetPoint(),
|
|
|
|
static_cast<const MetaBmpScaleAction&>(rAct).GetSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BMPSCALEPART_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaBmpScalePartAction&>(rAct).GetDestPoint(),
|
|
|
|
static_cast<const MetaBmpScalePartAction&>(rAct).GetDestSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BMPEX_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaBmpExAction&>(rAct).GetPoint(),
|
|
|
|
rOut.PixelToLogic( static_cast<const MetaBmpExAction&>(rAct).GetBitmapEx().GetSizePixel() ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BMPEXSCALE_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaBmpExScaleAction&>(rAct).GetPoint(),
|
|
|
|
static_cast<const MetaBmpExScaleAction&>(rAct).GetSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_BMPEXSCALEPART_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestPoint(),
|
|
|
|
static_cast<const MetaBmpExScalePartAction&>(rAct).GetDestSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_MASK_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaMaskAction&>(rAct).GetPoint(),
|
|
|
|
rOut.PixelToLogic( static_cast<const MetaMaskAction&>(rAct).GetBitmap().GetSizePixel() ) );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_MASKSCALE_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaMaskScaleAction&>(rAct).GetPoint(),
|
|
|
|
static_cast<const MetaMaskScaleAction&>(rAct).GetSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_MASKSCALEPART_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaMaskScalePartAction&>(rAct).GetDestPoint(),
|
|
|
|
static_cast<const MetaMaskScalePartAction&>(rAct).GetDestSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRADIENT_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaGradientAction&>(rAct).GetRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_GRADIENTEX_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaGradientExAction&>(rAct).GetPolyPolygon().GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_HATCH_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaHatchAction&>(rAct).GetPolyPolygon().GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_WALLPAPER_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaWallpaperAction&>(rAct).GetRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_TRANSPARENT_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaTransparentAction&>(rAct).GetPolyPolygon().GetBoundRect();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_FLOATTRANSPARENT_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaFloatTransparentAction&>(rAct).GetPoint(),
|
|
|
|
static_cast<const MetaFloatTransparentAction&>(rAct).GetSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_EPS_ACTION:
|
|
|
|
aActionBounds = Rectangle( static_cast<const MetaEPSAction&>(rAct).GetPoint(),
|
|
|
|
static_cast<const MetaEPSAction&>(rAct).GetSize() );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case META_TEXT_ACTION:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const MetaTextAction& rTextAct = static_cast<const MetaTextAction&>(rAct);
|
|
|
|
const XubString aString( rTextAct.GetText(), rTextAct.GetIndex(), rTextAct.GetLen() );
|
2002-12-10 16:28:12 +00:00
|
|
|
|
|
|
|
if( aString.Len() )
|
2002-02-26 14:57:28 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const Point aPtLog( rTextAct.GetPoint() );
|
2002-12-10 16:28:12 +00:00
|
|
|
|
|
|
|
// #105987# Use API method instead of Impl* methods
|
2003-03-27 16:59:30 +00:00
|
|
|
// #107490# Set base parameter equal to index parameter
|
|
|
|
rOut.GetTextBoundRect( aActionBounds, rTextAct.GetText(), rTextAct.GetIndex(),
|
|
|
|
rTextAct.GetIndex(), rTextAct.GetLen() );
|
|
|
|
aActionBounds.Move( aPtLog.X(), aPtLog.Y() );
|
2002-12-10 16:28:12 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_TEXTARRAY_ACTION:
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
const MetaTextArrayAction& rTextAct = static_cast<const MetaTextArrayAction&>(rAct);
|
|
|
|
const XubString aString( rTextAct.GetText(), rTextAct.GetIndex(), rTextAct.GetLen() );
|
|
|
|
const long nLen = aString.Len();
|
2001-05-21 15:19:00 +00:00
|
|
|
|
|
|
|
if( nLen )
|
|
|
|
{
|
2002-12-10 16:28:12 +00:00
|
|
|
// #105987# ImplLayout takes everything in logical coordinates
|
2003-03-27 16:59:30 +00:00
|
|
|
SalLayout* pSalLayout = rOut.ImplLayout( rTextAct.GetText(), rTextAct.GetIndex(),
|
|
|
|
rTextAct.GetLen(), rTextAct.GetPoint(),
|
|
|
|
0, rTextAct.GetDXArray() );
|
2002-02-26 14:57:28 +00:00
|
|
|
if( pSalLayout )
|
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
Rectangle aBoundRect( const_cast<OutputDevice&>(rOut).ImplGetTextBoundRect( *pSalLayout ) );
|
|
|
|
aActionBounds = rOut.PixelToLogic( aBoundRect );
|
2002-02-26 14:57:28 +00:00
|
|
|
pSalLayout->Release();
|
|
|
|
}
|
2001-05-21 15:19:00 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_TEXTRECT_ACTION:
|
|
|
|
aActionBounds = static_cast<const MetaTextRectAction&>(rAct).GetRect();
|
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
case META_STRETCHTEXT_ACTION:
|
2003-12-01 08:54:48 +00:00
|
|
|
{
|
|
|
|
const MetaStretchTextAction& rTextAct = static_cast<const MetaStretchTextAction&>(rAct);
|
|
|
|
const XubString aString( rTextAct.GetText(), rTextAct.GetIndex(), rTextAct.GetLen() );
|
|
|
|
const long nLen = aString.Len();
|
|
|
|
|
|
|
|
// #i16195# Literate copy from TextArray action, the
|
|
|
|
// semantics for the ImplLayout call are copied from the
|
|
|
|
// OutDev::DrawStretchText() code. Unfortunately, also in
|
|
|
|
// this case, public outdev methods such as GetTextWidth()
|
|
|
|
// don't provide enough info.
|
|
|
|
if( nLen )
|
|
|
|
{
|
|
|
|
// #105987# ImplLayout takes everything in logical coordinates
|
|
|
|
SalLayout* pSalLayout = rOut.ImplLayout( rTextAct.GetText(), rTextAct.GetIndex(),
|
|
|
|
rTextAct.GetLen(), rTextAct.GetPoint(),
|
|
|
|
rTextAct.GetWidth() );
|
|
|
|
if( pSalLayout )
|
|
|
|
{
|
|
|
|
Rectangle aBoundRect( const_cast<OutputDevice&>(rOut).ImplGetTextBoundRect( *pSalLayout ) );
|
|
|
|
aActionBounds = rOut.PixelToLogic( aBoundRect );
|
|
|
|
pSalLayout->Release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
case META_TEXTLINE_ACTION:
|
2011-03-01 19:08:19 +01:00
|
|
|
OSL_FAIL("META_TEXTLINE_ACTION not supported");
|
2011-02-04 14:49:25 +01:00
|
|
|
break;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
default:
|
2003-03-27 16:59:30 +00:00
|
|
|
break;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if( !aActionBounds.IsEmpty() )
|
|
|
|
return rOut.LogicToPixel( aActionBounds );
|
2000-09-18 16:07:07 +00:00
|
|
|
else
|
2003-03-27 16:59:30 +00:00
|
|
|
return Rectangle();
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
static bool ImplIsActionHandlingTransparency( const MetaAction& rAct )
|
|
|
|
{
|
|
|
|
// META_FLOATTRANSPARENT_ACTION can contain a whole metafile,
|
|
|
|
// which is to be rendered with the given transparent gradient. We
|
|
|
|
// currently cannot emulate transparent painting on a white
|
|
|
|
// background reliably.
|
|
|
|
|
2003-04-24 13:56:59 +00:00
|
|
|
// the remainder can handle printing itself correctly on a uniform
|
|
|
|
// white background.
|
|
|
|
switch( rAct.GetType() )
|
|
|
|
{
|
|
|
|
case META_TRANSPARENT_ACTION:
|
|
|
|
case META_BMPEX_ACTION:
|
|
|
|
case META_BMPEXSCALE_ACTION:
|
|
|
|
case META_BMPEXSCALEPART_ACTION:
|
|
|
|
return true;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
2003-04-24 13:56:59 +00:00
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
bool OutputDevice::RemoveTransparenciesFromMetaFile( const GDIMetaFile& rInMtf, GDIMetaFile& rOutMtf,
|
|
|
|
long nMaxBmpDPIX, long nMaxBmpDPIY,
|
|
|
|
bool bReduceTransparency, bool bTransparencyAutoMode,
|
2009-09-14 16:02:43 +00:00
|
|
|
bool bDownsampleBitmaps,
|
|
|
|
const Color& rBackground
|
|
|
|
)
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
MetaAction* pCurrAct;
|
|
|
|
bool bTransparent( false );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
rOutMtf.Clear();
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
if( ! bReduceTransparency || bTransparencyAutoMode )
|
2001-05-07 09:35:52 +00:00
|
|
|
{
|
|
|
|
// watch for transparent drawing actions
|
2003-03-27 16:59:30 +00:00
|
|
|
for( pCurrAct = ( (GDIMetaFile&) rInMtf ).FirstAction();
|
|
|
|
pCurrAct && !bTransparent;
|
|
|
|
pCurrAct = ( (GDIMetaFile&) rInMtf ).NextAction() )
|
2001-05-07 09:35:52 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
// #i10613# Extracted "specialness" predicate into extra method
|
2003-04-24 13:56:59 +00:00
|
|
|
|
|
|
|
// #107169# Also examine metafiles with masked bitmaps in
|
|
|
|
// detail. Further down, this is optimized in such a way
|
|
|
|
// that there's no unnecessary painting of masked bitmaps
|
|
|
|
// (which are _always_ subdivided into rectangular regions
|
|
|
|
// of uniform opacity): if a masked bitmap is printed over
|
|
|
|
// empty background, we convert to a plain bitmap with
|
|
|
|
// white background.
|
2008-10-01 13:31:44 +00:00
|
|
|
if( ImplIsActionSpecial( *pCurrAct ) )
|
2003-04-24 13:56:59 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
bTransparent = true;
|
2003-04-24 13:56:59 +00:00
|
|
|
}
|
2001-05-07 09:35:52 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// #i10613# Determine set of connected components containing transparent objects. These are
|
|
|
|
// then processed as bitmaps, the original actions are removed from the metafile.
|
|
|
|
if( !bTransparent )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
// nothing transparent -> just copy
|
|
|
|
rOutMtf = rInMtf;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// #i10613#
|
|
|
|
// This works as follows: we want a number of distinct sets of
|
|
|
|
// connected components, where each set contains metafile
|
|
|
|
// actions that are intersecting (note: there are possibly
|
|
|
|
// more actions contained as are directly intersecting,
|
|
|
|
// because we can only produce rectangular bitmaps later
|
|
|
|
// on. Thus, each set of connected components is the smallest
|
|
|
|
// enclosing, axis-aligned rectangle that completely bounds a
|
|
|
|
// number of intersecting metafile actions, plus any action
|
|
|
|
// that would otherwise be cut in two). Therefore, we
|
|
|
|
// iteratively add metafile actions from the original metafile
|
|
|
|
// to this connected components list (aCCList), by checking
|
|
|
|
// each element's bounding box against intersection with the
|
|
|
|
// metaaction at hand.
|
|
|
|
// All those intersecting elements are removed from aCCList
|
|
|
|
// and collected in a temporary list (aCCMergeList). After all
|
|
|
|
// elements have been checked, the aCCMergeList elements are
|
|
|
|
// merged with the metaaction at hand into one resulting
|
|
|
|
// connected component, with one big bounding box, and
|
|
|
|
// inserted into aCCList again.
|
|
|
|
// The time complexity of this algorithm is O(n^3), where n is
|
|
|
|
// the number of metafile actions, and it finds all distinct
|
|
|
|
// regions of rectangle-bounded connected components. This
|
|
|
|
// algorithm was designed by AF.
|
|
|
|
//
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
//
|
|
|
|
// STAGE 1: Detect background
|
|
|
|
// ==========================
|
|
|
|
//
|
|
|
|
|
|
|
|
// Receives uniform background content, and is _not_ merged
|
|
|
|
// nor checked for intersection against other aCCList elements
|
|
|
|
ConnectedComponents aBackgroundComponent;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// create an OutputDevice to record mapmode changes and the like
|
|
|
|
VirtualDevice aMapModeVDev;
|
|
|
|
aMapModeVDev.mnDPIX = mnDPIX;
|
|
|
|
aMapModeVDev.mnDPIY = mnDPIY;
|
2010-09-29 15:46:40 +08:00
|
|
|
aMapModeVDev.EnableOutput(sal_False);
|
2003-03-27 16:59:30 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
int nLastBgAction, nActionNum;
|
|
|
|
|
|
|
|
// weed out page-filling background objects (if they are
|
|
|
|
// uniformly coloured). Keeping them outside the other
|
|
|
|
// connected components often prevents whole-page bitmap
|
|
|
|
// generation.
|
|
|
|
bool bStillBackground=true; // true until first non-bg action
|
|
|
|
nActionNum=0; nLastBgAction=-1;
|
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction();
|
2009-09-14 16:02:43 +00:00
|
|
|
if( rBackground != Color( COL_TRANSPARENT ) )
|
|
|
|
{
|
|
|
|
aBackgroundComponent.aBgColor = rBackground;
|
|
|
|
if( meOutDevType == OUTDEV_PRINTER )
|
|
|
|
{
|
|
|
|
Printer* pThis = dynamic_cast<Printer*>(this);
|
|
|
|
Point aPageOffset = pThis->GetPageOffsetPixel();
|
|
|
|
aPageOffset = Point( 0, 0 ) - aPageOffset;
|
|
|
|
Size aSize = pThis->GetPaperSizePixel();
|
|
|
|
aBackgroundComponent.aBounds = Rectangle( aPageOffset, aSize );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
aBackgroundComponent.aBounds = Rectangle( Point( 0, 0 ), GetOutputSizePixel() );
|
|
|
|
}
|
2008-10-01 13:31:44 +00:00
|
|
|
while( pCurrAct && bStillBackground )
|
|
|
|
{
|
|
|
|
switch( pCurrAct->GetType() )
|
|
|
|
{
|
|
|
|
case META_RECT_ACTION:
|
|
|
|
{
|
|
|
|
if( !checkRect(
|
|
|
|
aBackgroundComponent.aBounds,
|
|
|
|
aBackgroundComponent.aBgColor,
|
|
|
|
static_cast<const MetaRectAction*>(pCurrAct)->GetRect(),
|
|
|
|
aMapModeVDev) )
|
|
|
|
bStillBackground=false; // incomplete occlusion of background
|
|
|
|
else
|
|
|
|
nLastBgAction=nActionNum; // this _is_ background
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case META_POLYGON_ACTION:
|
|
|
|
{
|
|
|
|
const Polygon aPoly(
|
|
|
|
static_cast<const MetaPolygonAction*>(pCurrAct)->GetPolygon());
|
|
|
|
if( !basegfx::tools::isRectangle(
|
|
|
|
aPoly.getB2DPolygon()) ||
|
|
|
|
!checkRect(
|
|
|
|
aBackgroundComponent.aBounds,
|
|
|
|
aBackgroundComponent.aBgColor,
|
|
|
|
aPoly.GetBoundRect(),
|
|
|
|
aMapModeVDev) )
|
|
|
|
bStillBackground=false; // incomplete occlusion of background
|
|
|
|
else
|
|
|
|
nLastBgAction=nActionNum; // this _is_ background
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case META_POLYPOLYGON_ACTION:
|
|
|
|
{
|
|
|
|
const PolyPolygon aPoly(
|
|
|
|
static_cast<const MetaPolyPolygonAction*>(pCurrAct)->GetPolyPolygon());
|
|
|
|
if( aPoly.Count() != 1 ||
|
|
|
|
!basegfx::tools::isRectangle(
|
|
|
|
aPoly[0].getB2DPolygon()) ||
|
|
|
|
!checkRect(
|
|
|
|
aBackgroundComponent.aBounds,
|
|
|
|
aBackgroundComponent.aBgColor,
|
|
|
|
aPoly.GetBoundRect(),
|
|
|
|
aMapModeVDev) )
|
|
|
|
bStillBackground=false; // incomplete occlusion of background
|
|
|
|
else
|
|
|
|
nLastBgAction=nActionNum; // this _is_ background
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case META_WALLPAPER_ACTION:
|
|
|
|
{
|
|
|
|
if( !checkRect(
|
|
|
|
aBackgroundComponent.aBounds,
|
|
|
|
aBackgroundComponent.aBgColor,
|
|
|
|
static_cast<const MetaWallpaperAction*>(pCurrAct)->GetRect(),
|
|
|
|
aMapModeVDev) )
|
|
|
|
bStillBackground=false; // incomplete occlusion of background
|
|
|
|
else
|
|
|
|
nLastBgAction=nActionNum; // this _is_ background
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
if( ImplIsNotTransparent( *pCurrAct,
|
|
|
|
aMapModeVDev ) )
|
|
|
|
bStillBackground=false; // non-transparent action, possibly
|
|
|
|
// not uniform
|
|
|
|
else
|
|
|
|
// extend current bounds (next uniform action
|
|
|
|
// needs to fully cover this area)
|
|
|
|
aBackgroundComponent.aBounds.Union(
|
|
|
|
ImplCalcActionBounds(*pCurrAct, aMapModeVDev) );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// execute action to get correct MapModes etc.
|
|
|
|
pCurrAct->Execute( &aMapModeVDev );
|
|
|
|
|
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction();
|
|
|
|
++nActionNum;
|
|
|
|
}
|
|
|
|
|
2010-11-26 17:12:39 +01:00
|
|
|
// clean up aMapModeVDev
|
|
|
|
sal_uInt32 nCount = aMapModeVDev.GetGCStackDepth();
|
|
|
|
while( nCount-- )
|
|
|
|
aMapModeVDev.Pop();
|
2008-10-01 13:31:44 +00:00
|
|
|
|
2010-11-26 17:12:39 +01:00
|
|
|
ConnectedComponentsList aCCList; // list containing distinct sets of connected components as elements.
|
2008-10-01 13:31:44 +00:00
|
|
|
|
|
|
|
// fast-forward until one after the last background action
|
|
|
|
// (need to reconstruct map mode vdev state)
|
|
|
|
nActionNum=0;
|
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction();
|
|
|
|
while( pCurrAct && nActionNum<=nLastBgAction )
|
|
|
|
{
|
|
|
|
// up to and including last ink-generating background
|
|
|
|
// action go to background component
|
|
|
|
aBackgroundComponent.aComponentList.push_back(
|
|
|
|
::std::make_pair(
|
|
|
|
pCurrAct, nActionNum) );
|
|
|
|
|
|
|
|
// execute action to get correct MapModes etc.
|
2010-11-26 17:12:39 +01:00
|
|
|
pCurrAct->Execute( &aMapModeVDev );
|
2008-10-01 13:31:44 +00:00
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction();
|
|
|
|
++nActionNum;
|
|
|
|
}
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
//
|
2008-10-01 13:31:44 +00:00
|
|
|
// STAGE 2: Generate connected components list
|
2003-03-27 16:59:30 +00:00
|
|
|
// ===========================================
|
|
|
|
//
|
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
// iterate over all actions (start where background action
|
|
|
|
// search left off)
|
|
|
|
for( ;
|
2003-03-27 16:59:30 +00:00
|
|
|
pCurrAct;
|
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
// execute action to get correct MapModes etc.
|
2010-11-26 17:12:39 +01:00
|
|
|
pCurrAct->Execute( &aMapModeVDev );
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// cache bounds of current action
|
2010-11-26 17:12:39 +01:00
|
|
|
const Rectangle aBBCurrAct( ImplCalcActionBounds(*pCurrAct, aMapModeVDev) );
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// accumulate collected bounds here, initialize with current action
|
|
|
|
Rectangle aTotalBounds( aBBCurrAct ); // thus,
|
|
|
|
// aTotalComponents.aBounds
|
|
|
|
// is
|
|
|
|
// empty
|
|
|
|
// for
|
|
|
|
// non-output-generating
|
|
|
|
// actions
|
|
|
|
bool bTreatSpecial( false );
|
|
|
|
ConnectedComponents aTotalComponents;
|
|
|
|
|
|
|
|
//
|
2008-10-01 13:31:44 +00:00
|
|
|
// STAGE 2.1: Search for intersecting cc entries
|
2003-03-27 16:59:30 +00:00
|
|
|
// =============================================
|
|
|
|
//
|
|
|
|
|
|
|
|
// if aBBCurrAct is empty, it will intersect with no
|
2009-09-14 16:02:43 +00:00
|
|
|
// aCCList member. Thus, we can save the check.
|
2003-03-27 16:59:30 +00:00
|
|
|
// Furthermore, this ensures that non-output-generating
|
|
|
|
// actions get their own aCCList entry, which is necessary
|
2008-10-01 13:31:44 +00:00
|
|
|
// when copying them to the output metafile (see stage 4
|
2003-03-27 16:59:30 +00:00
|
|
|
// below).
|
2003-05-16 13:24:58 +00:00
|
|
|
|
|
|
|
// #107169# Wholly transparent objects need
|
|
|
|
// not be considered for connected components,
|
|
|
|
// too. Just put each of them into a separate
|
|
|
|
// component.
|
2010-11-26 17:12:39 +01:00
|
|
|
aTotalComponents.bIsFullyTransparent = !ImplIsNotTransparent(*pCurrAct, aMapModeVDev);
|
2003-05-16 13:24:58 +00:00
|
|
|
|
|
|
|
if( !aBBCurrAct.IsEmpty() &&
|
|
|
|
!aTotalComponents.bIsFullyTransparent )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
if( !aBackgroundComponent.aComponentList.empty() &&
|
|
|
|
!aBackgroundComponent.aBounds.IsInside(aTotalBounds) )
|
|
|
|
{
|
|
|
|
// it seems the background is not large enough. to
|
|
|
|
// be on the safe side, combine with this component.
|
|
|
|
aTotalBounds.Union( aBackgroundComponent.aBounds );
|
|
|
|
|
|
|
|
// extract all aCurr actions to aTotalComponents
|
|
|
|
aTotalComponents.aComponentList.splice( aTotalComponents.aComponentList.end(),
|
|
|
|
aBackgroundComponent.aComponentList );
|
|
|
|
|
|
|
|
if( aBackgroundComponent.bIsSpecial )
|
|
|
|
bTreatSpecial = true;
|
|
|
|
}
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
ConnectedComponentsList::iterator aCurrCC;
|
|
|
|
const ConnectedComponentsList::iterator aLastCC( aCCList.end() );
|
|
|
|
bool bSomeComponentsChanged;
|
|
|
|
|
|
|
|
// now, this is unfortunate: since changing anyone of
|
|
|
|
// the aCCList elements (e.g. by merging or addition
|
|
|
|
// of an action) might generate new intersection with
|
|
|
|
// other aCCList elements, have to repeat the whole
|
|
|
|
// element scanning, until nothing changes anymore.
|
|
|
|
// Thus, this loop here makes us O(n^3) in the worst
|
|
|
|
// case.
|
|
|
|
do
|
|
|
|
{
|
|
|
|
// only loop here if 'intersects' branch below was hit
|
|
|
|
bSomeComponentsChanged = false;
|
|
|
|
|
|
|
|
// iterate over all current members of aCCList
|
|
|
|
for( aCurrCC=aCCList.begin(); aCurrCC != aLastCC; )
|
|
|
|
{
|
|
|
|
// first check if current element's bounds are
|
|
|
|
// empty. This ensures that empty actions are not
|
|
|
|
// merged into one component, as a matter of fact,
|
|
|
|
// they have no position.
|
2003-05-16 13:24:58 +00:00
|
|
|
|
|
|
|
// #107169# Wholly transparent objects need
|
|
|
|
// not be considered for connected components,
|
|
|
|
// too. Just put each of them into a separate
|
|
|
|
// component.
|
2003-03-27 16:59:30 +00:00
|
|
|
if( !aCurrCC->aBounds.IsEmpty() &&
|
2003-05-16 13:24:58 +00:00
|
|
|
!aCurrCC->bIsFullyTransparent &&
|
2003-03-27 16:59:30 +00:00
|
|
|
aCurrCC->aBounds.IsOver( aTotalBounds ) )
|
|
|
|
{
|
|
|
|
// union the intersecting aCCList element into aTotalComponents
|
|
|
|
|
|
|
|
// calc union bounding box
|
|
|
|
aTotalBounds.Union( aCurrCC->aBounds );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// extract all aCurr actions to aTotalComponents
|
|
|
|
aTotalComponents.aComponentList.splice( aTotalComponents.aComponentList.end(),
|
|
|
|
aCurrCC->aComponentList );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if( aCurrCC->bIsSpecial )
|
|
|
|
bTreatSpecial = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// remove and delete aCurrCC element from list (we've now merged its content)
|
|
|
|
aCurrCC = aCCList.erase( aCurrCC );
|
|
|
|
|
|
|
|
// at least one component changed, need to rescan everything
|
|
|
|
bSomeComponentsChanged = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
++aCurrCC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
while( bSomeComponentsChanged );
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
2008-10-01 13:31:44 +00:00
|
|
|
// STAGE 2.2: Determine special state for cc element
|
2003-03-27 16:59:30 +00:00
|
|
|
// =================================================
|
|
|
|
//
|
|
|
|
|
|
|
|
// now test whether the whole connected component must be
|
|
|
|
// treated specially (i.e. rendered as a bitmap): if the
|
|
|
|
// added action is the very first action, or all actions
|
|
|
|
// before it are completely transparent, the connected
|
|
|
|
// component need not be treated specially, not even if
|
|
|
|
// the added action contains transparency. This is because
|
|
|
|
// painting of transparent objects on _white background_
|
|
|
|
// works without alpha compositing (you just calculate the
|
|
|
|
// color). Note that for the test "all objects before me
|
|
|
|
// are transparent" no sorting is necessary, since the
|
|
|
|
// added metaaction pCurrAct is always in the order the
|
|
|
|
// metafile is painted. Generally, the order of the
|
|
|
|
// metaactions in the ConnectedComponents are not
|
|
|
|
// guaranteed to be the same as in the metafile.
|
|
|
|
if( bTreatSpecial )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
// prev component(s) special -> this one, too
|
|
|
|
aTotalComponents.bIsSpecial = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
else if( !ImplIsActionSpecial( *pCurrAct ) )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
// added action and none of prev components special ->
|
|
|
|
// this one normal, too
|
|
|
|
aTotalComponents.bIsSpecial = false;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
else
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
// added action is special and none of prev components
|
|
|
|
// special -> do the detailed tests
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// can the action handle transparency correctly
|
|
|
|
// (i.e. when painted on white background, does the
|
|
|
|
// action still look correct)?
|
|
|
|
if( !ImplIsActionHandlingTransparency( *pCurrAct ) )
|
|
|
|
{
|
|
|
|
// no, action cannot handle its transparency on
|
|
|
|
// a printer device, render to bitmap
|
|
|
|
aTotalComponents.bIsSpecial = true;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
else
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
|
|
|
// yes, action can handle its transparency, so
|
|
|
|
// check whether we're on white background
|
|
|
|
if( aTotalComponents.aComponentList.empty() )
|
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
// nothing between pCurrAct and page
|
2003-03-27 16:59:30 +00:00
|
|
|
// background -> don't be special
|
|
|
|
aTotalComponents.bIsSpecial = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-05-16 13:24:58 +00:00
|
|
|
// #107169# Fixes abnove now ensure that _no_
|
|
|
|
// object in the list is fully transparent. Thus,
|
|
|
|
// if the component list is not empty above, we
|
|
|
|
// must assume that we have to treat this
|
|
|
|
// component special.
|
|
|
|
|
|
|
|
// there are non-transparent objects between
|
|
|
|
// pCurrAct and the empty sheet of paper -> be
|
|
|
|
// special, then
|
|
|
|
aTotalComponents.bIsSpecial = true;
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2003-05-16 13:24:58 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
//
|
2008-10-01 13:31:44 +00:00
|
|
|
// STAGE 2.3: Add newly generated CC list element
|
2003-03-27 16:59:30 +00:00
|
|
|
// ==============================================
|
|
|
|
//
|
2001-05-21 15:19:00 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// set new bounds and add action to list
|
|
|
|
aTotalComponents.aBounds = aTotalBounds;
|
2008-10-01 13:31:44 +00:00
|
|
|
aTotalComponents.aComponentList.push_back(
|
|
|
|
::std::make_pair(
|
|
|
|
pCurrAct, nActionNum) );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// add aTotalComponents as a new entry to aCCList
|
|
|
|
aCCList.push_back( aTotalComponents );
|
2001-05-21 15:19:00 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
DBG_ASSERT( !aTotalComponents.aComponentList.empty(),
|
|
|
|
"Printer::GetPreparedMetaFile empty component" );
|
|
|
|
DBG_ASSERT( !aTotalComponents.aBounds.IsEmpty() ||
|
|
|
|
(aTotalComponents.aBounds.IsEmpty() && aTotalComponents.aComponentList.size() == 1),
|
|
|
|
"Printer::GetPreparedMetaFile non-output generating actions must be solitary");
|
2003-05-16 13:24:58 +00:00
|
|
|
DBG_ASSERT( !aTotalComponents.bIsFullyTransparent ||
|
|
|
|
(aTotalComponents.bIsFullyTransparent && aTotalComponents.aComponentList.size() == 1),
|
|
|
|
"Printer::GetPreparedMetaFile fully transparent actions must be solitary");
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// well now, we've got the list of disjunct connected
|
|
|
|
// components. Now we've got to create a map, which contains
|
|
|
|
// the corresponding aCCList element for every
|
|
|
|
// metaaction. Later on, we always process the complete
|
|
|
|
// metafile for each bitmap to be generated, but switch on
|
|
|
|
// output only for actions contained in the then current
|
|
|
|
// aCCList element. This ensures correct mapmode and attribute
|
|
|
|
// settings for all cases.
|
|
|
|
|
|
|
|
// maps mtf actions to CC list entries
|
2011-05-10 06:32:19 -07:00
|
|
|
::std::vector< const ConnectedComponents* > aCCList_MemberMap( rInMtf.GetActionSize() );
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// iterate over all aCCList members and their contained metaactions
|
|
|
|
ConnectedComponentsList::iterator aCurr( aCCList.begin() );
|
|
|
|
const ConnectedComponentsList::iterator aLast( aCCList.end() );
|
|
|
|
for( ; aCurr != aLast; ++aCurr )
|
2001-05-07 09:35:52 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
ComponentList::iterator aCurrentAction( aCurr->aComponentList.begin() );
|
|
|
|
const ComponentList::iterator aLastAction( aCurr->aComponentList.end() );
|
|
|
|
for( ; aCurrentAction != aLastAction; ++aCurrentAction )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
|
|
|
// set pointer to aCCList element for corresponding index
|
2008-10-01 13:31:44 +00:00
|
|
|
aCCList_MemberMap[ aCurrentAction->second ] = &(*aCurr);
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
2001-05-07 09:35:52 +00:00
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
//
|
2008-10-01 13:31:44 +00:00
|
|
|
// STAGE 3.1: Output background mtf actions (if there are any)
|
|
|
|
// ===========================================================
|
|
|
|
//
|
|
|
|
|
|
|
|
ComponentList::iterator aCurrAct( aBackgroundComponent.aComponentList.begin() );
|
|
|
|
const ComponentList::iterator aLastAct( aBackgroundComponent.aComponentList.end() );
|
|
|
|
for( ; aCurrAct != aLastAct; ++aCurrAct )
|
|
|
|
{
|
|
|
|
// simply add this action (above, we inserted the actions
|
|
|
|
// starting at index 0 up to and including nLastBgAction)
|
|
|
|
rOutMtf.AddAction( ( aCurrAct->first->Duplicate(), aCurrAct->first ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// STAGE 3.2: Generate banded bitmaps for special regions
|
2003-03-27 16:59:30 +00:00
|
|
|
// ====================================================
|
|
|
|
//
|
|
|
|
|
2009-09-12 11:22:22 +00:00
|
|
|
Point aPageOffset;
|
2008-10-01 13:31:44 +00:00
|
|
|
Size aTmpSize( GetOutputSizePixel() );
|
|
|
|
if( mpPDFWriter )
|
|
|
|
{
|
|
|
|
aTmpSize = mpPDFWriter->getCurPageSize();
|
|
|
|
aTmpSize = LogicToPixel( aTmpSize, MapMode( MAP_POINT ) );
|
|
|
|
|
|
|
|
// also add error code to PDFWriter
|
|
|
|
mpPDFWriter->insertError( vcl::PDFWriter::Warning_Transparency_Converted );
|
|
|
|
}
|
2009-09-12 11:22:22 +00:00
|
|
|
else if( meOutDevType == OUTDEV_PRINTER )
|
|
|
|
{
|
|
|
|
Printer* pThis = dynamic_cast<Printer*>(this);
|
|
|
|
aPageOffset = pThis->GetPageOffsetPixel();
|
|
|
|
aPageOffset = Point( 0, 0 ) - aPageOffset;
|
|
|
|
aTmpSize = pThis->GetPaperSizePixel();
|
|
|
|
}
|
|
|
|
const Rectangle aOutputRect( aPageOffset, aTmpSize );
|
2008-10-01 13:31:44 +00:00
|
|
|
bool bTiling = dynamic_cast<Printer*>(this) != NULL;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// iterate over all aCCList members and generate bitmaps for the special ones
|
|
|
|
for( aCurr = aCCList.begin(); aCurr != aLast; ++aCurr )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
if( aCurr->bIsSpecial )
|
2001-05-07 09:35:52 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
Rectangle aBoundRect( aCurr->aBounds );
|
|
|
|
aBoundRect.Intersection( aOutputRect );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
const double fBmpArea( (double) aBoundRect.GetWidth() * aBoundRect.GetHeight() );
|
|
|
|
const double fOutArea( (double) aOutputRect.GetWidth() * aOutputRect.GetHeight() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// check if output doesn't exceed given size
|
2008-10-01 13:31:44 +00:00
|
|
|
if( bReduceTransparency && bTransparencyAutoMode && ( fBmpArea > ( 0.25 * fOutArea ) ) )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
|
|
|
// output normally. Therefore, we simply clear the
|
|
|
|
// special attribute, as everything non-special is
|
|
|
|
// copied to rOutMtf further below.
|
|
|
|
aCurr->bIsSpecial = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// create new bitmap action first
|
|
|
|
if( aBoundRect.GetWidth() && aBoundRect.GetHeight() )
|
|
|
|
{
|
|
|
|
Point aDstPtPix( aBoundRect.TopLeft() );
|
|
|
|
Size aDstSzPix;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
VirtualDevice aMapVDev; // here, we record only mapmode information
|
2010-09-29 15:46:40 +08:00
|
|
|
aMapVDev.EnableOutput(sal_False);
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
VirtualDevice aPaintVDev; // into this one, we render.
|
2011-04-05 13:24:02 +02:00
|
|
|
aPaintVDev.SetBackground( aBackgroundComponent.aBgColor );
|
2001-05-21 10:00:36 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
rOutMtf.AddAction( new MetaPushAction( PUSH_MAPMODE ) );
|
|
|
|
rOutMtf.AddAction( new MetaMapModeAction() );
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
aPaintVDev.SetDrawMode( GetDrawMode() );
|
2001-05-07 09:35:52 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
while( aDstPtPix.Y() <= aBoundRect.Bottom() )
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
aDstPtPix.X() = aBoundRect.Left();
|
2008-10-01 13:31:44 +00:00
|
|
|
aDstSzPix = bTiling ? Size( MAX_TILE_WIDTH, MAX_TILE_HEIGHT ) : aBoundRect.GetSize();
|
2001-05-07 09:35:52 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if( ( aDstPtPix.Y() + aDstSzPix.Height() - 1L ) > aBoundRect.Bottom() )
|
|
|
|
aDstSzPix.Height() = aBoundRect.Bottom() - aDstPtPix.Y() + 1L;
|
2001-05-07 09:35:52 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
while( aDstPtPix.X() <= aBoundRect.Right() )
|
2001-05-07 09:35:52 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
if( ( aDstPtPix.X() + aDstSzPix.Width() - 1L ) > aBoundRect.Right() )
|
|
|
|
aDstSzPix.Width() = aBoundRect.Right() - aDstPtPix.X() + 1L;
|
2001-05-21 10:00:36 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
if( !Rectangle( aDstPtPix, aDstSzPix ).Intersection( aBoundRect ).IsEmpty() &&
|
|
|
|
aPaintVDev.SetOutputSizePixel( aDstSzPix ) )
|
2001-05-21 10:00:36 +00:00
|
|
|
{
|
2003-03-27 16:59:30 +00:00
|
|
|
aPaintVDev.Push();
|
|
|
|
aMapVDev.Push();
|
|
|
|
|
|
|
|
aMapVDev.mnDPIX = aPaintVDev.mnDPIX = mnDPIX;
|
|
|
|
aMapVDev.mnDPIY = aPaintVDev.mnDPIY = mnDPIY;
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
aPaintVDev.EnableOutput(sal_False);
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// iterate over all actions
|
|
|
|
for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0;
|
|
|
|
pCurrAct;
|
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum )
|
|
|
|
{
|
|
|
|
// enable output only for
|
|
|
|
// actions that are members of
|
|
|
|
// the current aCCList element
|
|
|
|
// (aCurr)
|
|
|
|
if( aCCList_MemberMap[nActionNum] == &(*aCurr) )
|
2010-09-29 15:46:40 +08:00
|
|
|
aPaintVDev.EnableOutput(sal_True);
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
// but process every action
|
2010-09-29 15:46:40 +08:00
|
|
|
const sal_uInt16 nType( pCurrAct->GetType() );
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
if( META_MAPMODE_ACTION == nType )
|
|
|
|
{
|
|
|
|
pCurrAct->Execute( &aMapVDev );
|
|
|
|
|
|
|
|
MapMode aMtfMap( aMapVDev.GetMapMode() );
|
|
|
|
const Point aNewOrg( aMapVDev.PixelToLogic( aDstPtPix ) );
|
|
|
|
|
|
|
|
aMtfMap.SetOrigin( Point( -aNewOrg.X(), -aNewOrg.Y() ) );
|
|
|
|
aPaintVDev.SetMapMode( aMtfMap );
|
|
|
|
}
|
|
|
|
else if( ( META_PUSH_ACTION == nType ) || ( META_POP_ACTION ) == nType )
|
|
|
|
{
|
|
|
|
pCurrAct->Execute( &aMapVDev );
|
|
|
|
pCurrAct->Execute( &aPaintVDev );
|
|
|
|
}
|
|
|
|
else if( META_GRADIENT_ACTION == nType )
|
|
|
|
{
|
|
|
|
MetaGradientAction* pGradientAction = static_cast<MetaGradientAction*>(pCurrAct);
|
2008-10-01 13:31:44 +00:00
|
|
|
Printer* pPrinter = dynamic_cast< Printer* >(this);
|
|
|
|
if( pPrinter )
|
|
|
|
pPrinter->DrawGradientEx( &aPaintVDev, pGradientAction->GetRect(), pGradientAction->GetGradient() );
|
|
|
|
else
|
|
|
|
DrawGradient( pGradientAction->GetRect(), pGradientAction->GetGradient() );
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
pCurrAct->Execute( &aPaintVDev );
|
|
|
|
}
|
|
|
|
|
2009-09-12 11:22:22 +00:00
|
|
|
if( !( nActionNum % 8 ) )
|
2003-03-27 16:59:30 +00:00
|
|
|
Application::Reschedule();
|
|
|
|
}
|
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
const sal_Bool bOldMap = mbMap;
|
|
|
|
mbMap = aPaintVDev.mbMap = sal_False;
|
2003-03-27 16:59:30 +00:00
|
|
|
|
|
|
|
Bitmap aBandBmp( aPaintVDev.GetBitmap( Point(), aDstSzPix ) );
|
|
|
|
|
|
|
|
// scale down bitmap, if requested
|
2008-10-01 13:31:44 +00:00
|
|
|
if( bDownsampleBitmaps )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
aBandBmp = GetDownsampledBitmap( aDstSzPix,
|
|
|
|
Point(), aBandBmp.GetSizePixel(),
|
|
|
|
aBandBmp, nMaxBmpDPIX, nMaxBmpDPIY );
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_BEGIN" ) );
|
|
|
|
rOutMtf.AddAction( new MetaBmpScaleAction( aDstPtPix, aDstSzPix, aBandBmp ) );
|
|
|
|
rOutMtf.AddAction( new MetaCommentAction( "PRNSPOOL_TRANSPARENTBITMAP_END" ) );
|
2001-05-21 10:00:36 +00:00
|
|
|
|
2010-09-29 15:46:40 +08:00
|
|
|
aPaintVDev.mbMap = sal_True;
|
2003-03-27 16:59:30 +00:00
|
|
|
mbMap = bOldMap;
|
|
|
|
aMapVDev.Pop();
|
|
|
|
aPaintVDev.Pop();
|
2001-05-21 10:00:36 +00:00
|
|
|
}
|
2001-05-07 09:35:52 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// overlapping bands to avoid missing lines (e.g. PostScript)
|
|
|
|
aDstPtPix.X() += aDstSzPix.Width();
|
2001-05-21 10:00:36 +00:00
|
|
|
}
|
2001-05-07 09:35:52 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// overlapping bands to avoid missing lines (e.g. PostScript)
|
|
|
|
aDstPtPix.Y() += aDstSzPix.Height();
|
2001-05-21 10:00:36 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
rOutMtf.AddAction( new MetaPopAction() );
|
2001-05-07 09:35:52 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2010-11-26 17:12:39 +01:00
|
|
|
// clean up aMapModeVDev
|
|
|
|
nCount = aMapModeVDev.GetGCStackDepth();
|
|
|
|
while( nCount-- )
|
|
|
|
aMapModeVDev.Pop();
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
//
|
2008-10-01 13:31:44 +00:00
|
|
|
// STAGE 4: Copy actions to output metafile
|
2003-03-27 16:59:30 +00:00
|
|
|
// ========================================
|
|
|
|
//
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// iterate over all actions and duplicate the ones not in a
|
|
|
|
// special aCCList member into rOutMtf
|
|
|
|
for( pCurrAct=const_cast<GDIMetaFile&>(rInMtf).FirstAction(), nActionNum=0;
|
|
|
|
pCurrAct;
|
|
|
|
pCurrAct=const_cast<GDIMetaFile&>(rInMtf).NextAction(), ++nActionNum )
|
|
|
|
{
|
2003-05-16 13:24:58 +00:00
|
|
|
const ConnectedComponents* pCurrAssociatedComponent = aCCList_MemberMap[nActionNum];
|
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
// NOTE: This relies on the fact that map-mode or draw
|
|
|
|
// mode changing actions are solitary aCCList elements and
|
2008-10-01 13:31:44 +00:00
|
|
|
// have empty bounding boxes, see comment on stage 2.1
|
2003-03-27 16:59:30 +00:00
|
|
|
// above
|
2003-05-16 13:24:58 +00:00
|
|
|
if( pCurrAssociatedComponent &&
|
|
|
|
(pCurrAssociatedComponent->aBounds.IsEmpty() ||
|
|
|
|
!pCurrAssociatedComponent->bIsSpecial) )
|
2003-03-27 16:59:30 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
// #107169# Treat transparent bitmaps special, if they
|
|
|
|
// are the first (or sole) action in their bounds
|
2003-05-16 13:24:58 +00:00
|
|
|
// list. Note that we previously ensured that no
|
|
|
|
// fully-transparent objects are before us here.
|
2008-10-01 13:31:44 +00:00
|
|
|
if( ImplIsActionHandlingTransparency( *pCurrAct ) &&
|
2003-05-16 13:24:58 +00:00
|
|
|
pCurrAssociatedComponent->aComponentList.begin()->first == pCurrAct )
|
2003-04-24 13:56:59 +00:00
|
|
|
{
|
2008-10-01 13:31:44 +00:00
|
|
|
// convert actions, where masked-out parts are of
|
|
|
|
// given background color
|
|
|
|
ImplConvertTransparentAction(rOutMtf,
|
|
|
|
*pCurrAct,
|
2010-11-26 17:12:39 +01:00
|
|
|
aMapModeVDev,
|
2008-10-01 13:31:44 +00:00
|
|
|
aBackgroundComponent.aBgColor);
|
2003-04-24 13:56:59 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
// simply add this action
|
|
|
|
rOutMtf.AddAction( ( pCurrAct->Duplicate(), pCurrAct ) );
|
|
|
|
}
|
2008-10-01 13:31:44 +00:00
|
|
|
|
2010-11-26 17:12:39 +01:00
|
|
|
pCurrAct->Execute(&aMapModeVDev);
|
2003-03-27 16:59:30 +00:00
|
|
|
}
|
2001-05-07 09:35:52 +00:00
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2003-03-27 16:59:30 +00:00
|
|
|
rOutMtf.SetPrefMapMode( rInMtf.GetPrefMapMode() );
|
|
|
|
rOutMtf.SetPrefSize( rInMtf.GetPrefSize() );
|
2013-05-04 02:26:49 +02:00
|
|
|
|
|
|
|
#if OSL_DEBUG_LEVEL > 1
|
|
|
|
// iterate over all aCCList members and generate rectangles for the bounding boxes
|
|
|
|
rOutMtf.AddAction( new MetaFillColorAction( COL_WHITE, false ) );
|
|
|
|
for( aCurr = aCCList.begin(); aCurr != aLast; ++aCurr )
|
|
|
|
{
|
|
|
|
if( aCurr->bIsSpecial )
|
|
|
|
rOutMtf.AddAction( new MetaLineColorAction( COL_RED, true) );
|
|
|
|
else
|
|
|
|
rOutMtf.AddAction( new MetaLineColorAction( COL_BLUE, true) );
|
|
|
|
|
|
|
|
rOutMtf.AddAction( new MetaRectAction( aMapModeVDev.PixelToLogic( aCurr->aBounds ) ) );
|
|
|
|
}
|
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2008-10-01 13:31:44 +00:00
|
|
|
return bTransparent;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
2001-05-07 09:35:52 +00:00
|
|
|
|
2008-10-01 13:31:44 +00:00
|
|
|
Bitmap OutputDevice::GetDownsampledBitmap( const Size& rDstSz,
|
|
|
|
const Point& rSrcPt, const Size& rSrcSz,
|
|
|
|
const Bitmap& rBmp, long nMaxBmpDPIX, long nMaxBmpDPIY )
|
2001-05-07 09:35:52 +00:00
|
|
|
{
|
|
|
|
Bitmap aBmp( rBmp );
|
|
|
|
|
|
|
|
if( !aBmp.IsEmpty() )
|
|
|
|
{
|
2001-05-08 15:53:22 +00:00
|
|
|
Point aPoint;
|
2001-05-08 06:46:35 +00:00
|
|
|
const Rectangle aBmpRect( aPoint, aBmp.GetSizePixel() );
|
2001-05-07 09:35:52 +00:00
|
|
|
Rectangle aSrcRect( rSrcPt, rSrcSz );
|
|
|
|
|
2013-03-03 17:11:39 +01:00
|
|
|
// do cropping if necessary
|
2001-05-07 09:35:52 +00:00
|
|
|
if( aSrcRect.Intersection( aBmpRect ) != aBmpRect )
|
|
|
|
{
|
|
|
|
if( !aSrcRect.IsEmpty() )
|
|
|
|
aBmp.Crop( aSrcRect );
|
|
|
|
else
|
|
|
|
aBmp.SetEmpty();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !aBmp.IsEmpty() )
|
|
|
|
{
|
2013-03-03 17:11:39 +01:00
|
|
|
// do downsampling if necessary
|
2002-09-17 12:45:03 +00:00
|
|
|
Size aDstSizeTwip( PixelToLogic( LogicToPixel( rDstSz ), MAP_TWIP ) );
|
|
|
|
|
|
|
|
// #103209# Normalize size (mirroring has to happen outside of this method)
|
|
|
|
aDstSizeTwip = Size( labs(aDstSizeTwip.Width()), labs(aDstSizeTwip.Height()) );
|
|
|
|
|
2001-05-07 09:35:52 +00:00
|
|
|
const Size aBmpSize( aBmp.GetSizePixel() );
|
|
|
|
const double fBmpPixelX = aBmpSize.Width();
|
|
|
|
const double fBmpPixelY = aBmpSize.Height();
|
|
|
|
const double fMaxPixelX = aDstSizeTwip.Width() * nMaxBmpDPIX / 1440.0;
|
|
|
|
const double fMaxPixelY = aDstSizeTwip.Height() * nMaxBmpDPIY / 1440.0;
|
|
|
|
|
|
|
|
// check, if the bitmap DPI exceeds the maximum DPI (allow 4 pixel rounding tolerance)
|
|
|
|
if( ( ( fBmpPixelX > ( fMaxPixelX + 4 ) ) ||
|
|
|
|
( fBmpPixelY > ( fMaxPixelY + 4 ) ) ) &&
|
|
|
|
( fBmpPixelY > 0.0 ) && ( fMaxPixelY > 0.0 ) )
|
|
|
|
{
|
|
|
|
// do scaling
|
|
|
|
Size aNewBmpSize;
|
|
|
|
const double fBmpWH = fBmpPixelX / fBmpPixelY;
|
|
|
|
const double fMaxWH = fMaxPixelX / fMaxPixelY;
|
|
|
|
|
|
|
|
if( fBmpWH < fMaxWH )
|
|
|
|
{
|
|
|
|
aNewBmpSize.Width() = FRound( fMaxPixelY * fBmpWH );
|
|
|
|
aNewBmpSize.Height() = FRound( fMaxPixelY );
|
|
|
|
}
|
|
|
|
else if( fBmpWH > 0.0 )
|
|
|
|
{
|
|
|
|
aNewBmpSize.Width() = FRound( fMaxPixelX );
|
|
|
|
aNewBmpSize.Height() = FRound( fMaxPixelX / fBmpWH);
|
|
|
|
}
|
|
|
|
|
|
|
|
if( aNewBmpSize.Width() && aNewBmpSize.Height() )
|
|
|
|
aBmp.Scale( aNewBmpSize );
|
|
|
|
else
|
|
|
|
aBmp.SetEmpty();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return aBmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void Printer::DrawGradientEx( OutputDevice* pOut, const Rectangle& rRect, const Gradient& rGradient )
|
|
|
|
{
|
|
|
|
const PrinterOptions& rPrinterOptions = GetPrinterOptions();
|
|
|
|
|
|
|
|
if( rPrinterOptions.IsReduceGradients() )
|
|
|
|
{
|
|
|
|
if( PRINTER_GRADIENT_STRIPES == rPrinterOptions.GetReducedGradientMode() )
|
|
|
|
{
|
|
|
|
if( !rGradient.GetSteps() || ( rGradient.GetSteps() > rPrinterOptions.GetReducedGradientStepCount() ) )
|
|
|
|
{
|
|
|
|
Gradient aNewGradient( rGradient );
|
|
|
|
|
|
|
|
aNewGradient.SetSteps( rPrinterOptions.GetReducedGradientStepCount() );
|
|
|
|
pOut->DrawGradient( rRect, aNewGradient );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pOut->DrawGradient( rRect, rGradient );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
const Color& rStartColor = rGradient.GetStartColor();
|
|
|
|
const Color& rEndColor = rGradient.GetEndColor();
|
|
|
|
const long nR = ( ( (long) rStartColor.GetRed() * rGradient.GetStartIntensity() ) / 100L +
|
|
|
|
( (long) rEndColor.GetRed() * rGradient.GetEndIntensity() ) / 100L ) >> 1;
|
|
|
|
const long nG = ( ( (long) rStartColor.GetGreen() * rGradient.GetStartIntensity() ) / 100L +
|
|
|
|
( (long) rEndColor.GetGreen() * rGradient.GetEndIntensity() ) / 100L ) >> 1;
|
|
|
|
const long nB = ( ( (long) rStartColor.GetBlue() * rGradient.GetStartIntensity() ) / 100L +
|
|
|
|
( (long) rEndColor.GetBlue() * rGradient.GetEndIntensity() ) / 100L ) >> 1;
|
2010-09-29 15:46:40 +08:00
|
|
|
const Color aColor( (sal_uInt8) nR, (sal_uInt8) nG, (sal_uInt8) nB );
|
2001-05-07 09:35:52 +00:00
|
|
|
|
|
|
|
pOut->Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
|
|
|
|
pOut->SetLineColor( aColor );
|
|
|
|
pOut->SetFillColor( aColor );
|
|
|
|
pOut->DrawRect( rRect );
|
|
|
|
pOut->Pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pOut->DrawGradient( rRect, rGradient );
|
|
|
|
}
|
|
|
|
|
2010-10-14 08:27:31 +02:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|