Files
libreoffice/vcl/source/window/printdlg.cxx

1960 lines
68 KiB
C++
Raw Normal View History

/* -*- 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.
*
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/.
*
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:
*
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 .
*/
#include "printdlg.hxx"
#include "svdata.hxx"
#include "svids.hrc"
#include "jobset.h"
#include "vcl/print.hxx"
#include "vcl/dialog.hxx"
#include "vcl/button.hxx"
#include "vcl/wall.hxx"
2009-03-18 14:46:10 +00:00
#include "vcl/status.hxx"
2009-03-18 16:16:06 +00:00
#include "vcl/decoview.hxx"
2009-06-02 11:37:36 +00:00
#include "vcl/configsettings.hxx"
#include "vcl/help.hxx"
#include "vcl/decoview.hxx"
#include "vcl/layout.hxx"
2009-08-03 15:51:37 +00:00
#include "vcl/svapp.hxx"
#include "vcl/unohelp.hxx"
2009-06-10 12:10:29 +00:00
#include "unotools/localedatawrapper.hxx"
#include "rtl/strbuf.hxx"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/container/XNameAccess.hpp"
#include "com/sun/star/beans/PropertyValue.hpp"
#include "com/sun/star/awt/Size.hpp"
using namespace vcl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::container;
using namespace com::sun::star::beans;
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makePrintPreviewWindow(Window *pParent, VclBuilder::stringmap &)
{
return new PrintDialog::PrintPreviewWindow(pParent);
}
extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeShowNupOrderWindow(Window *pParent, VclBuilder::stringmap &)
{
return new PrintDialog::ShowNupOrderWindow(pParent);
}
PrintDialog::PrintPreviewWindow::PrintPreviewWindow( Window* i_pParent )
: Window( i_pParent, 0 )
2009-07-24 13:15:45 +00:00
, maOrigSize( 10, 10 )
, maPageVDev( *this )
, maToolTipString(VclResId( SV_PRINT_PRINTPREVIEW_TXT).toString())
, mbGreyscale( false )
, maHorzDim( this, WB_HORZ | WB_CENTER )
, maVertDim( this, WB_VERT | WB_VCENTER )
{
SetPaintTransparent( sal_True );
2009-07-24 13:15:45 +00:00
SetBackground();
2010-11-17 07:41:37 -08:00
maPageVDev.SetBackground( Color( COL_WHITE ) );
maHorzDim.Show();
maVertDim.Show();
maHorzDim.SetText( String( "2.0in" ) );
maVertDim.SetText( String( "2.0in" ) );
}
PrintDialog::PrintPreviewWindow::~PrintPreviewWindow()
{
}
void PrintDialog::PrintPreviewWindow::DataChanged( const DataChangedEvent& i_rDCEvt )
{
// react on settings changed
if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS )
{
2010-11-17 07:41:37 -08:00
maPageVDev.SetBackground( Color( COL_WHITE ) );
}
Window::DataChanged( i_rDCEvt );
}
2009-07-24 13:15:45 +00:00
void PrintDialog::PrintPreviewWindow::Resize()
{
2009-07-24 13:15:45 +00:00
Size aNewSize( GetSizePixel() );
long nTextHeight = maHorzDim.GetTextHeight();
2009-08-01 12:02:23 +00:00
// leave small space for decoration
aNewSize.Width() -= nTextHeight + 2;
aNewSize.Height() -= nTextHeight + 2;
2009-07-24 13:15:45 +00:00
Size aScaledSize;
double fScale = 1.0;
// #i106435# catch corner case of Size(0,0)
Size aOrigSize( maOrigSize );
if( aOrigSize.Width() < 1 )
aOrigSize.Width() = aNewSize.Width();
if( aOrigSize.Height() < 1 )
aOrigSize.Height() = aNewSize.Height();
if( aOrigSize.Width() > aOrigSize.Height() )
2009-07-24 13:15:45 +00:00
{
aScaledSize = Size( aNewSize.Width(), aNewSize.Width() * aOrigSize.Height() / aOrigSize.Width() );
2009-07-24 13:15:45 +00:00
if( aScaledSize.Height() > aNewSize.Height() )
fScale = double(aNewSize.Height())/double(aScaledSize.Height());
}
else
{
aScaledSize = Size( aNewSize.Height() * aOrigSize.Width() / aOrigSize.Height(), aNewSize.Height() );
2009-07-24 13:15:45 +00:00
if( aScaledSize.Width() > aNewSize.Width() )
fScale = double(aNewSize.Width())/double(aScaledSize.Width());
}
aScaledSize.Width() = long(aScaledSize.Width()*fScale);
aScaledSize.Height() = long(aScaledSize.Height()*fScale);
maPreviewSize = aScaledSize;
// #i104784# if we render the page too small then rounding issues result in
// layout artifacts looking really bad. So scale the page unto a device that is not
// full page size but not too small either. This also results in much better visual
// quality of the preview, e.g. when its height approaches the number of text lines
// find a good scaling factor
Size aPreviewMMSize( maPageVDev.PixelToLogic( aScaledSize, MapMode( MAP_100TH_MM ) ) );
double fZoom = double(maOrigSize.Height())/double(aPreviewMMSize.Height());
while( fZoom > 10 )
{
aScaledSize.Width() *= 2;
aScaledSize.Height() *= 2;
fZoom /= 2.0;
}
maPageVDev.SetOutputSizePixel( aScaledSize, sal_False );
// position dimension lines
Point aRef( nTextHeight + (aNewSize.Width() - maPreviewSize.Width())/2,
nTextHeight + (aNewSize.Height() - maPreviewSize.Height())/2 );
maHorzDim.SetPosSizePixel( Point( aRef.X(), aRef.Y() - nTextHeight ),
Size( maPreviewSize.Width(), nTextHeight ) );
maVertDim.SetPosSizePixel( Point( aRef.X() - nTextHeight, aRef.Y() ),
Size( nTextHeight, maPreviewSize.Height() ) );
2009-07-24 13:15:45 +00:00
}
2009-07-25 01:56:38 +00:00
void PrintDialog::PrintPreviewWindow::Paint( const Rectangle& )
2009-07-24 13:15:45 +00:00
{
long nTextHeight = maHorzDim.GetTextHeight();
2009-07-24 13:15:45 +00:00
Size aSize( GetSizePixel() );
Point aOffset( (aSize.Width() - maPreviewSize.Width() + nTextHeight) / 2 ,
(aSize.Height() - maPreviewSize.Height() + nTextHeight) / 2 );
if( !maReplacementString.isEmpty() )
2009-08-11 15:50:07 +00:00
{
// replacement is active
Push();
Font aFont( GetSettings().GetStyleSettings().GetLabelFont() );
SetZoomedPointFont( aFont );
Rectangle aTextRect( aOffset + Point( 2, 2 ),
Size( maPreviewSize.Width() - 4, maPreviewSize.Height() - 4 ) );
2009-08-11 15:50:07 +00:00
DrawText( aTextRect, maReplacementString,
TEXT_DRAW_CENTER | TEXT_DRAW_VCENTER | TEXT_DRAW_WORDBREAK | TEXT_DRAW_MULTILINE
);
Pop();
}
else
{
GDIMetaFile aMtf( maMtf );
2009-07-24 13:15:45 +00:00
const Size aVDevSize( maPageVDev.GetOutputSizePixel() );
const Size aLogicSize( maPageVDev.PixelToLogic( aVDevSize, MapMode( MAP_100TH_MM ) ) );
Size aOrigSize( maOrigSize );
if( aOrigSize.Width() < 1 )
aOrigSize.Width() = aLogicSize.Width();
if( aOrigSize.Height() < 1 )
aOrigSize.Height() = aLogicSize.Height();
double fScale = double(aLogicSize.Width())/double(aOrigSize.Width());
2009-07-24 13:15:45 +00:00
2009-08-11 15:50:07 +00:00
maPageVDev.Erase();
maPageVDev.Push();
maPageVDev.SetMapMode( MAP_100TH_MM );
sal_uLong nOldDrawMode = maPageVDev.GetDrawMode();
if( mbGreyscale )
maPageVDev.SetDrawMode( maPageVDev.GetDrawMode() |
( DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_GRAYTEXT |
DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT ) );
2009-08-11 15:50:07 +00:00
aMtf.WindStart();
aMtf.Scale( fScale, fScale );
aMtf.WindStart();
const sal_uInt16 nOriginalAA(maPageVDev.GetAntialiasing());
maPageVDev.SetAntialiasing(nOriginalAA | ANTIALIASING_ENABLE_B2DDRAW);
2009-08-11 15:50:07 +00:00
aMtf.Play( &maPageVDev, Point( 0, 0 ), aLogicSize );
maPageVDev.Pop();
2009-08-01 12:02:23 +00:00
maPageVDev.SetAntialiasing(nOriginalAA);
2009-08-11 15:50:07 +00:00
SetMapMode( MAP_PIXEL );
maPageVDev.SetMapMode( MAP_PIXEL );
// use lanzcos scaling
Bitmap aContent(maPageVDev.GetBitmap(Point(0, 0), aVDevSize));
aContent.Scale(maPreviewSize, BMP_SCALE_BEST);
DrawBitmap(aOffset, aContent);
maPageVDev.SetDrawMode( nOldDrawMode );
2009-08-11 15:50:07 +00:00
}
Rectangle aFrameRect( aOffset + Point( -1, -1 ),
Size( maPreviewSize.Width() + 2, maPreviewSize.Height() + 2 ) );
DecorationView aVw( this );
aVw.DrawFrame( aFrameRect, FRAME_DRAW_GROUP );
}
void PrintDialog::PrintPreviewWindow::Command( const CommandEvent& rEvt )
{
if( rEvt.GetCommand() == COMMAND_WHEEL )
{
const CommandWheelData* pWheelData = rEvt.GetWheelData();
PrintDialog* pDlg = dynamic_cast<PrintDialog*>(GetParent());
if( pDlg )
{
if( pWheelData->GetDelta() > 0 )
pDlg->previewForward();
else if( pWheelData->GetDelta() < 0 )
pDlg->previewBackward();
/*
else
huh ?
*/
}
}
}
2009-08-11 15:50:07 +00:00
void PrintDialog::PrintPreviewWindow::setPreview( const GDIMetaFile& i_rNewPreview,
const Size& i_rOrigSize,
const rtl::OUString& i_rPaperName,
2009-08-13 15:10:43 +00:00
const rtl::OUString& i_rReplacement,
sal_Int32 i_nDPIX,
sal_Int32 i_nDPIY,
bool i_bGreyscale
2009-08-11 15:50:07 +00:00
)
{
2009-09-08 15:20:56 +00:00
rtl::OUStringBuffer aBuf( 256 );
aBuf.append( maToolTipString );
SetQuickHelpText( aBuf.makeStringAndClear() );
maMtf = i_rNewPreview;
2009-07-24 13:15:45 +00:00
maOrigSize = i_rOrigSize;
2009-08-11 15:50:07 +00:00
maReplacementString = i_rReplacement;
mbGreyscale = i_bGreyscale;
2009-08-13 15:10:43 +00:00
maPageVDev.SetReferenceDevice( i_nDPIX, i_nDPIY );
maPageVDev.EnableOutput( sal_True );
// use correct measurements
const LocaleDataWrapper& rLocWrap( GetSettings().GetLocaleDataWrapper() );
MapUnit eUnit = MAP_MM;
int nDigits = 0;
if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US )
{
eUnit = MAP_100TH_INCH;
nDigits = 2;
}
Size aLogicPaperSize( LogicToLogic( i_rOrigSize, MapMode( MAP_100TH_MM ), MapMode( eUnit ) ) );
String aNumText( rLocWrap.getNum( aLogicPaperSize.Width(), nDigits ) );
aBuf.append( aNumText );
aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
if( !i_rPaperName.isEmpty() )
{
aBuf.appendAscii( " (" );
aBuf.append( i_rPaperName );
aBuf.append( sal_Unicode(')') );
}
maHorzDim.SetText( aBuf.makeStringAndClear() );
aNumText = rLocWrap.getNum( aLogicPaperSize.Height(), nDigits );
aBuf.append( aNumText );
aBuf.appendAscii( eUnit == MAP_MM ? "mm" : "in" );
maVertDim.SetText( aBuf.makeStringAndClear() );
2009-07-27 17:10:15 +00:00
Resize();
Invalidate();
}
2009-07-30 13:52:50 +00:00
PrintDialog::ShowNupOrderWindow::ShowNupOrderWindow( Window* i_pParent )
: Window( i_pParent, WB_NOBORDER )
2009-07-30 13:52:50 +00:00
, mnOrderMode( 0 )
, mnRows( 1 )
, mnColumns( 1 )
{
ImplInitSettings();
}
PrintDialog::ShowNupOrderWindow::~ShowNupOrderWindow()
{
}
void PrintDialog::ShowNupOrderWindow::ImplInitSettings()
{
SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFieldColor() ) );
}
Size PrintDialog::ShowNupOrderWindow::GetOptimalSize() const
{
return Size(70, 70);
}
2009-07-30 13:52:50 +00:00
void PrintDialog::ShowNupOrderWindow::Paint( const Rectangle& i_rRect )
{
Window::Paint( i_rRect );
SetMapMode( MAP_PIXEL );
SetTextColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
int nPages = mnRows * mnColumns;
Font aFont( GetSettings().GetStyleSettings().GetFieldFont() );
aFont.SetSize( Size( 0, 24 ) );
SetFont( aFont );
2009-07-30 18:05:46 +00:00
Size aSampleTextSize( GetTextWidth( rtl::OUString::valueOf( sal_Int32(nPages+1) ) ), GetTextHeight() );
2009-07-30 13:52:50 +00:00
Size aOutSize( GetOutputSizePixel() );
Size aSubSize( aOutSize.Width() / mnColumns, aOutSize.Height() / mnRows );
// calculate font size: shrink the sample text so it fits
2009-07-30 18:05:46 +00:00
double fX = double(aSubSize.Width())/double(aSampleTextSize.Width());
double fY = double(aSubSize.Height())/double(aSampleTextSize.Height());
2009-07-30 13:52:50 +00:00
double fScale = (fX < fY) ? fX : fY;
long nFontHeight = long(24.0*fScale) - 3;
if( nFontHeight < 5 )
nFontHeight = 5;
aFont.SetSize( Size( 0, nFontHeight ) );
SetFont( aFont );
long nTextHeight = GetTextHeight();
for( int i = 0; i < nPages; i++ )
{
rtl::OUString aPageText( rtl::OUString::valueOf( sal_Int32(i+1) ) );
int nX = 0, nY = 0;
switch( mnOrderMode )
{
case SV_PRINT_PRT_NUP_ORDER_LRTB:
2009-07-30 13:52:50 +00:00
nX = (i % mnColumns); nY = (i / mnColumns);
break;
case SV_PRINT_PRT_NUP_ORDER_TBLR:
2009-07-30 13:52:50 +00:00
nX = (i / mnRows); nY = (i % mnRows);
break;
case SV_PRINT_PRT_NUP_ORDER_RLTB:
nX = mnColumns - 1 - (i % mnColumns); nY = (i / mnColumns);
break;
case SV_PRINT_PRT_NUP_ORDER_TBRL:
nX = mnColumns - 1 - (i / mnRows); nY = (i % mnRows);
break;
2009-07-30 13:52:50 +00:00
}
Size aTextSize( GetTextWidth( aPageText ), nTextHeight );
int nDeltaX = (aSubSize.Width() - aTextSize.Width()) / 2;
int nDeltaY = (aSubSize.Height() - aTextSize.Height()) / 2;
DrawText( Point( nX * aSubSize.Width() + nDeltaX,
nY * aSubSize.Height() + nDeltaY ),
aPageText );
}
DecorationView aVw( this );
aVw.DrawFrame( Rectangle( Point( 0, 0), aOutSize ), FRAME_DRAW_GROUP );
2009-07-30 13:52:50 +00:00
}
PrintDialog::NUpTabPage::NUpTabPage( VclBuilder *pUIBuilder )
{
pUIBuilder->get(mpPagesBtn, "pagespersheetbtn");
pUIBuilder->get(mpBrochureBtn, "brochure");
pUIBuilder->get(mpPagesBoxTitleTxt, "pagespersheettxt");
pUIBuilder->get(mpNupPagesBox, "paperspersheetlb");
pUIBuilder->get(mpNupNumPagesTxt, "pagestxt");
pUIBuilder->get(mpNupColEdt, "pagecols");
pUIBuilder->get(mpNupTimesTxt, "by");
pUIBuilder->get(mpNupRowsEdt, "pagerows");
pUIBuilder->get(mpPageMarginTxt1, "pagemargintxt1");
pUIBuilder->get(mpPageMarginEdt, "pagemarginsb");
pUIBuilder->get(mpPageMarginTxt2, "pagemargintxt2");
pUIBuilder->get(mpSheetMarginTxt1, "sheetmargintxt1");
pUIBuilder->get(mpSheetMarginEdt, "sheetmarginsb");
pUIBuilder->get(mpSheetMarginTxt2, "sheetmargintxt2");
pUIBuilder->get(mpNupOrientationTxt, "orientationtxt");
pUIBuilder->get(mpNupOrientationBox, "orientationlb");
pUIBuilder->get(mpNupOrderTxt, "ordertxt");
pUIBuilder->get(mpNupOrderBox, "orderlb");
pUIBuilder->get(mpNupOrderWin, "orderpreview");
pUIBuilder->get(mpBorderCB, "bordercb");
}
void PrintDialog::NUpTabPage::enableNupControls( bool bEnable )
{
mpNupPagesBox->Enable( bEnable );
mpNupNumPagesTxt->Enable( bEnable );
mpNupColEdt->Enable( bEnable );
mpNupTimesTxt->Enable( bEnable );
mpNupRowsEdt->Enable( bEnable );
mpPageMarginTxt1->Enable( bEnable );
mpPageMarginEdt->Enable( bEnable );
mpPageMarginTxt2->Enable( bEnable );
mpSheetMarginTxt1->Enable( bEnable );
mpSheetMarginEdt->Enable( bEnable );
mpSheetMarginTxt2->Enable( bEnable );
mpNupOrientationTxt->Enable( bEnable );
mpNupOrientationBox->Enable( bEnable );
mpNupOrderTxt->Enable( bEnable );
mpNupOrderBox->Enable( bEnable );
mpNupOrderWin->Enable( bEnable );
mpBorderCB->Enable( bEnable );
}
2009-06-10 12:10:29 +00:00
void PrintDialog::NUpTabPage::showAdvancedControls( bool i_bShow )
{
mpNupNumPagesTxt->Show( i_bShow );
mpNupColEdt->Show( i_bShow );
mpNupTimesTxt->Show( i_bShow );
mpNupRowsEdt->Show( i_bShow );
mpPageMarginTxt1->Show( i_bShow );
mpPageMarginEdt->Show( i_bShow );
mpPageMarginTxt2->Show( i_bShow );
mpSheetMarginTxt1->Show( i_bShow );
mpSheetMarginEdt->Show( i_bShow );
mpSheetMarginTxt2->Show( i_bShow );
mpNupOrientationTxt->Show( i_bShow );
mpNupOrientationBox->Show( i_bShow );
}
void PrintDialog::NUpTabPage::initFromMultiPageSetup( const vcl::PrinterController::MultiPageSetup& i_rMPS )
{
mpNupOrderWin->Show();
mpPagesBtn->Check( sal_True );
mpBrochureBtn->Show( sal_False );
2009-07-30 13:52:50 +00:00
2009-06-10 12:10:29 +00:00
// setup field units for metric fields
const LocaleDataWrapper& rLocWrap( mpPageMarginEdt->GetLocaleDataWrapper() );
2009-06-10 12:10:29 +00:00
FieldUnit eUnit = FUNIT_MM;
sal_uInt16 nDigits = 0;
2009-06-10 12:10:29 +00:00
if( rLocWrap.getMeasurementSystemEnum() == MEASURE_US )
{
eUnit = FUNIT_INCH;
nDigits = 2;
}
// set units
mpPageMarginEdt->SetUnit( eUnit );
mpSheetMarginEdt->SetUnit( eUnit );
2009-06-10 12:10:29 +00:00
// set precision
mpPageMarginEdt->SetDecimalDigits( nDigits );
mpSheetMarginEdt->SetDecimalDigits( nDigits );
2009-08-01 15:16:11 +00:00
mpSheetMarginEdt->SetValue( mpSheetMarginEdt->Normalize( i_rMPS.nLeftMargin ), FUNIT_100TH_MM );
mpPageMarginEdt->SetValue( mpPageMarginEdt->Normalize( i_rMPS.nHorizontalSpacing ), FUNIT_100TH_MM );
mpBorderCB->Check( i_rMPS.bDrawBorder );
mpNupRowsEdt->SetValue( i_rMPS.nRows );
mpNupColEdt->SetValue( i_rMPS.nColumns );
mpNupOrderBox->SelectEntryPos( i_rMPS.nOrder );
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
if( i_rMPS.nRows != 1 || i_rMPS.nColumns != 1 )
{
mpNupPagesBox->SelectEntryPos( mpNupPagesBox->GetEntryCount()-1 );
showAdvancedControls( true );
mpNupOrderWin->setValues( i_rMPS.nOrder, i_rMPS.nColumns, i_rMPS.nRows );
}
2009-06-09 18:58:38 +00:00
}
void PrintDialog::NUpTabPage::readFromSettings()
2009-06-02 11:37:36 +00:00
{
}
void PrintDialog::NUpTabPage::storeToSettings()
2009-06-02 11:37:36 +00:00
{
}
PrintDialog::JobTabPage::JobTabPage( VclBuilder* pUIBuilder )
: maCollateImg( VclResId( SV_PRINT_COLLATE_IMG ) )
, maNoCollateImg( VclResId( SV_PRINT_NOCOLLATE_IMG ) )
, mnCollateUIMode( 0 )
{
pUIBuilder->get(mpPrinters, "printers");
mpPrinters->SetStyle(mpPrinters->GetStyle() | WB_SORT);
pUIBuilder->get(mpStatusTxt, "status");
pUIBuilder->get(mpLocationTxt, "location");
pUIBuilder->get(mpCommentTxt, "comment");
pUIBuilder->get(mpSetupButton, "setup");
pUIBuilder->get(mpCopySpacer, "copyspacer");
pUIBuilder->get(mpCopyCountField, "copycount");
pUIBuilder->get(mpCollateBox, "collate");
pUIBuilder->get(mpCollateImage, "collateimage");
pUIBuilder->get(mpReverseOrderBox, "reverseorder");
2009-07-22 17:16:34 +00:00
// HACK: this is not a dropdown box, but the dropdown line count
// sets the results of GetOptimalSize in a normal ListBox
mpPrinters->SetDropDownLineCount( 4 );
2009-07-22 17:16:34 +00:00
}
2009-06-02 11:37:36 +00:00
void PrintDialog::JobTabPage::readFromSettings()
{
SettingsConfigItem* pItem = SettingsConfigItem::get();
rtl::OUString aValue;
aValue = pItem->getValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "CollateBox" ) );
if( aValue.equalsIgnoreAsciiCase("alwaysoff") )
{
mnCollateUIMode = 1;
mpCollateBox->Check( sal_False );
mpCollateBox->Enable( sal_False );
}
else
{
mnCollateUIMode = 0;
aValue = pItem->getValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "Collate" ) );
mpCollateBox->Check( aValue.equalsIgnoreAsciiCase("true") );
}
2009-06-02 11:37:36 +00:00
}
void PrintDialog::JobTabPage::storeToSettings()
{
SettingsConfigItem* pItem = SettingsConfigItem::get();
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "CopyCount" ),
mpCopyCountField->GetText() );
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "Collate" ),
mpCollateBox->IsChecked() ? rtl::OUString("true") :
rtl::OUString("false") );
2009-07-22 17:16:34 +00:00
}
PrintDialog::OutputOptPage::OutputOptPage( VclBuilder *pUIBuilder )
2009-07-22 17:16:34 +00:00
{
pUIBuilder->get(mpToFileBox, "printtofile");
pUIBuilder->get(mpCollateSingleJobsBox, "singleprintjob");
2009-07-23 17:22:34 +00:00
}
2009-07-22 17:16:34 +00:00
void PrintDialog::OutputOptPage::readFromSettings()
{
SettingsConfigItem* pItem = SettingsConfigItem::get();
rtl::OUString aValue;
aValue = pItem->getValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "CollateSingleJobs" ) );
if ( aValue.equalsIgnoreAsciiCase("true") )
{
mpCollateSingleJobsBox->Check( sal_True );
}
else
{
mpCollateSingleJobsBox->Check( sal_False );
}
2009-07-22 17:16:34 +00:00
}
void PrintDialog::OutputOptPage::storeToSettings()
{
SettingsConfigItem* pItem = SettingsConfigItem::get();
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "ToFile" ),
mpToFileBox->IsChecked() ? rtl::OUString("true")
: rtl::OUString("false") );
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "CollateSingleJobs" ),
mpCollateSingleJobsBox->IsChecked() ? rtl::OUString("true") :
rtl::OUString("false") );
2009-07-22 17:16:34 +00:00
}
PrintDialog::PrintDialog( Window* i_pParent, const boost::shared_ptr<PrinterController>& i_rController )
: ModalDialog(i_pParent, "PrintDialog", "vcl/ui/printdialog.ui")
, mpCustomOptionsUIBuilder(NULL)
, maPController( i_rController )
, maNUpPage(m_pUIBuilder)
, maJobPage(m_pUIBuilder)
, maOptionsPage(m_pUIBuilder)
, maNoPageStr( VclResId( SV_PRINT_NOPAGES ).toString() )
, mnCurPage( 0 )
, mnCachedPages( 0 )
, maPrintToFileText( VclResId( SV_PRINT_TOFILE_TXT ).toString() )
, maDefPrtText( VclResId( SV_PRINT_DEFPRT_TXT ).toString() )
, mbShowLayoutPage( sal_True )
{
get(mpOKButton, "ok");
get(mpCancelButton, "cancel");
get(mpHelpButton, "help");
get(mpForwardBtn, "forward");
get(mpBackwardBtn, "backward");
get(mpNumPagesText, "totalnumpages");
get(mpPageEdit, "pageedit-nospin");
get(mpTabCtrl, "tabcontrol");
get(mpPreviewWindow, "preview");
2009-07-24 13:15:45 +00:00
// save printbutton text, gets exchanged occasionally with print to file
maPrintText = mpOKButton->GetText();
2009-07-24 13:15:45 +00:00
// setup preview controls
mpForwardBtn->SetStyle( mpForwardBtn->GetStyle() | WB_BEVELBUTTON );
mpBackwardBtn->SetStyle( mpBackwardBtn->GetStyle() | WB_BEVELBUTTON );
maPageStr = mpNumPagesText->GetText();
2009-07-24 13:15:45 +00:00
2009-07-30 15:11:07 +00:00
// init reverse print
maJobPage.mpReverseOrderBox->Check( maPController->getReversePrint() );
// fill printer listbox
const std::vector< rtl::OUString >& rQueues( Printer::GetPrinterQueues() );
for( std::vector< rtl::OUString >::const_iterator it = rQueues.begin();
it != rQueues.end(); ++it )
{
maJobPage.mpPrinters->InsertEntry( *it );
}
// select current printer
if( maJobPage.mpPrinters->GetEntryPos( maPController->getPrinter()->GetName() ) != LISTBOX_ENTRY_NOTFOUND )
{
maJobPage.mpPrinters->SelectEntry( maPController->getPrinter()->GetName() );
}
else
{
2009-06-02 11:37:36 +00:00
// fall back to last printer
SettingsConfigItem* pItem = SettingsConfigItem::get();
String aValue( pItem->getValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "LastPrinter" ) ) );
if( maJobPage.mpPrinters->GetEntryPos( aValue ) != LISTBOX_ENTRY_NOTFOUND )
2009-06-02 11:37:36 +00:00
{
maJobPage.mpPrinters->SelectEntry( aValue );
maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aValue ) ) );
2009-06-02 11:37:36 +00:00
}
else
{
// fall back to default printer
maJobPage.mpPrinters->SelectEntry( Printer::GetDefaultPrinterName() );
maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( Printer::GetDefaultPrinterName() ) ) );
2009-06-02 11:37:36 +00:00
}
}
// not printing to file
maPController->resetPrinterOptions( false );
// get the first page
preparePreview( true, true );
// update the text fields for the printer
updatePrinterText();
// set a select handler
maJobPage.mpPrinters->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
2009-03-28 08:52:14 +00:00
// setup sizes for N-Up
Size aNupSize( maPController->getPrinter()->PixelToLogic(
maPController->getPrinter()->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
if( maPController->getPrinter()->GetOrientation() == ORIENTATION_LANDSCAPE )
2009-03-28 08:52:14 +00:00
{
maNupLandscapeSize = aNupSize;
maNupPortraitSize = Size( aNupSize.Height(), aNupSize.Width() );
}
else
{
maNupPortraitSize = aNupSize;
maNupLandscapeSize = Size( aNupSize.Height(), aNupSize.Width() );
}
maNUpPage.initFromMultiPageSetup( maPController->getMultipage() );
2009-06-09 18:58:38 +00:00
// setup click handler on the various buttons
mpOKButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
2009-06-02 11:37:36 +00:00
#if OSL_DEBUG_LEVEL > 1
mpCancelButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
2009-06-02 11:37:36 +00:00
#endif
mpHelpButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
mpForwardBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
mpBackwardBtn->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maJobPage.mpCollateBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maJobPage.mpSetupButton->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.mpBorderCB->SetClickHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.mpToFileBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maJobPage.mpReverseOrderBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maOptionsPage.mpCollateSingleJobsBox->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maNUpPage.mpPagesBtn->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
// setup modify hdl
mpPageEdit->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
maJobPage.mpCopyCountField->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
maNUpPage.mpNupRowsEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
maNUpPage.mpNupColEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
maNUpPage.mpPageMarginEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
maNUpPage.mpSheetMarginEdt->SetModifyHdl( LINK( this, PrintDialog, ModifyHdl ) );
2009-07-27 17:10:15 +00:00
// setup select hdl
maNUpPage.mpNupPagesBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
maNUpPage.mpNupOrientationBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
maNUpPage.mpNupOrderBox->SetSelectHdl( LINK( this, PrintDialog, SelectHdl ) );
2009-07-24 13:15:45 +00:00
// setup optional UI options set by application
setupOptionalUI();
// set change handler for UI options
maPController->setOptionChangeHdl( LINK( this, PrintDialog, UIOptionsChanged ) );
// remove layout page if unwanted
if (!mbShowLayoutPage)
mpTabCtrl->RemovePage(mpTabCtrl->GetPageId(2));
// restore settings from last run
readFromSettings();
// setup dependencies
checkControlDependencies();
if ( maPController->getBoolProperty( rtl::OUString( "HideHelpButton" ), sal_False ) )
mpHelpButton->Hide();
// set initial focus to "Number of copies"
maJobPage.mpCopyCountField->GrabFocus();
maJobPage.mpCopyCountField->SetSelection( Selection(0, 0xFFFF) );
updateNupFromPages();
}
PrintDialog::~PrintDialog()
{
delete mpCustomOptionsUIBuilder;
2009-07-24 13:15:45 +00:00
}
2009-06-02 11:37:36 +00:00
void PrintDialog::readFromSettings()
{
maJobPage.readFromSettings();
maNUpPage.readFromSettings();
2009-07-22 17:16:34 +00:00
maOptionsPage.readFromSettings();
2009-06-02 11:37:36 +00:00
// read last selected tab page; if it exists, actiavte it
SettingsConfigItem* pItem = SettingsConfigItem::get();
rtl::OUString aValue = pItem->getValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "LastPage" ) );
sal_uInt16 nCount = mpTabCtrl->GetPageCount();
for( sal_uInt16 i = 0; i < nCount; i++ )
2009-06-02 11:37:36 +00:00
{
sal_uInt16 nPageId = mpTabCtrl->GetPageId( i );
if( aValue.equals( mpTabCtrl->GetPageText( nPageId ) ) )
2009-06-02 11:37:36 +00:00
{
mpTabCtrl->SelectTabPage( nPageId );
2009-06-02 11:37:36 +00:00
break;
}
}
mpOKButton->SetText( maOptionsPage.mpToFileBox->IsChecked() ? maPrintToFileText : maPrintText );
// persistent window state
rtl::OUString aWinState( pItem->getValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "WindowState" ) ) );
if( !aWinState.isEmpty() )
SetWindowState( rtl::OUStringToOString( aWinState, RTL_TEXTENCODING_UTF8 ) );
if( maOptionsPage.mpToFileBox->IsChecked() )
{
maPController->resetPrinterOptions( true );
preparePreview( true, true );
}
2009-06-02 11:37:36 +00:00
}
void PrintDialog::storeToSettings()
{
maJobPage.storeToSettings();
maNUpPage.storeToSettings();
2009-07-22 17:16:34 +00:00
maOptionsPage.storeToSettings();
2009-06-02 11:37:36 +00:00
// store last selected printer
SettingsConfigItem* pItem = SettingsConfigItem::get();
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "LastPrinter" ),
maJobPage.mpPrinters->GetSelectEntry() );
2009-06-02 11:37:36 +00:00
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "LastPage" ),
mpTabCtrl->GetPageText( mpTabCtrl->GetCurPageId() ) );
pItem->setValue( rtl::OUString( "PrintDialog" ),
rtl::OUString( "WindowState" ),
rtl::OStringToOUString( GetWindowState(), RTL_TEXTENCODING_UTF8 )
);
2009-06-02 11:37:36 +00:00
pItem->Commit();
}
bool PrintDialog::isPrintToFile()
{
return maOptionsPage.mpToFileBox->IsChecked();
}
bool PrintDialog::isCollate()
{
return maJobPage.mpCopyCountField->GetValue() > 1 ? maJobPage.mpCollateBox->IsChecked() : sal_False;
}
bool PrintDialog::isSingleJobs()
{
return maOptionsPage.mpCollateSingleJobsBox->IsChecked();
}
void setHelpId( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpIds, sal_Int32 i_nIndex )
2009-04-27 09:47:17 +00:00
{
if( i_nIndex >= 0 && i_nIndex < i_rHelpIds.getLength() )
i_pWindow->SetHelpId( rtl::OUStringToOString( i_rHelpIds.getConstArray()[i_nIndex], RTL_TEXTENCODING_UTF8 ) );
2009-04-27 09:47:17 +00:00
}
static void setHelpText( Window* i_pWindow, const Sequence< rtl::OUString >& i_rHelpTexts, sal_Int32 i_nIndex )
2009-04-27 16:11:03 +00:00
{
2010-02-22 15:37:49 +01:00
// without a help text set and the correct smartID,
// help texts will be retrieved from the online help system
2009-04-27 16:11:03 +00:00
if( i_nIndex >= 0 && i_nIndex < i_rHelpTexts.getLength() )
i_pWindow->SetHelpText( i_rHelpTexts.getConstArray()[i_nIndex] );
}
void PrintDialog::setupOptionalUI()
{
const Sequence< PropertyValue >& rOptions( maPController->getUIOptions() );
for( int i = 0; i < rOptions.getLength(); i++ )
{
if (rOptions[i].Name == "OptionsUIFile")
{
rtl::OUString sOptionsUIFile;
rOptions[i].Value >>= sOptionsUIFile;
Window *pCustom = get<Window>("customcontents");
delete mpCustomOptionsUIBuilder;
mpCustomOptionsUIBuilder = new VclBuilder(pCustom, getUIRootDir(), sOptionsUIFile);
Window *pWindow = mpCustomOptionsUIBuilder->get_widget_root();
pWindow->Show();
continue;
}
Sequence< beans::PropertyValue > aOptProp;
rOptions[i].Value >>= aOptProp;
// extract ui element
rtl::OUString aCtrlType;
rtl::OString aID;
rtl::OUString aText;
rtl::OUString aPropertyName;
Sequence< rtl::OUString > aChoices;
Sequence< sal_Bool > aChoicesDisabled;
2009-04-27 16:11:03 +00:00
Sequence< rtl::OUString > aHelpTexts;
Sequence< rtl::OUString > aIDs;
Sequence< rtl::OUString > aHelpIds;
2009-03-16 17:48:45 +00:00
sal_Int64 nMinValue = 0, nMaxValue = 0;
2009-07-22 17:16:34 +00:00
rtl::OUString aGroupingHint;
2009-05-27 17:40:24 +00:00
rtl::OUString aDependsOnName;
sal_Int32 nDependsOnValue = 0;
sal_Bool bUseDependencyRow = sal_False;
for( int n = 0; n < aOptProp.getLength(); n++ )
{
const beans::PropertyValue& rEntry( aOptProp[ n ] );
if ( rEntry.Name == "ID" )
{
rEntry.Value >>= aIDs;
aID = rtl::OUStringToOString(aIDs[0], RTL_TEXTENCODING_UTF8);
}
if ( rEntry.Name == "Text" )
{
rEntry.Value >>= aText;
}
else if ( rEntry.Name == "ControlType" )
{
rEntry.Value >>= aCtrlType;
}
else if ( rEntry.Name == "Choices" )
{
rEntry.Value >>= aChoices;
}
else if ( rEntry.Name == "ChoicesDisabled" )
{
rEntry.Value >>= aChoicesDisabled;
}
else if ( rEntry.Name == "Property" )
{
PropertyValue aVal;
rEntry.Value >>= aVal;
aPropertyName = aVal.Name;
}
else if ( rEntry.Name == "Enabled" )
{
sal_Bool bValue = sal_True;
rEntry.Value >>= bValue;
}
else if ( rEntry.Name == "GroupingHint" )
{
2009-07-22 17:16:34 +00:00
rEntry.Value >>= aGroupingHint;
}
else if ( rEntry.Name == "DependsOnName" )
{
2009-05-27 17:40:24 +00:00
rEntry.Value >>= aDependsOnName;
}
else if ( rEntry.Name == "DependsOnEntry" )
2009-05-27 17:40:24 +00:00
{
rEntry.Value >>= nDependsOnValue;
}
else if ( rEntry.Name == "AttachToDependency" )
2009-05-27 17:40:24 +00:00
{
rEntry.Value >>= bUseDependencyRow;
}
else if ( rEntry.Name == "MinValue" )
2009-03-16 17:48:45 +00:00
{
rEntry.Value >>= nMinValue;
}
else if ( rEntry.Name == "MaxValue" )
2009-03-16 17:48:45 +00:00
{
rEntry.Value >>= nMaxValue;
}
else if ( rEntry.Name == "HelpText" )
2009-04-27 16:11:03 +00:00
{
if( ! (rEntry.Value >>= aHelpTexts) )
{
rtl::OUString aHelpText;
if( (rEntry.Value >>= aHelpText) )
{
aHelpTexts.realloc( 1 );
*aHelpTexts.getArray() = aHelpText;
}
}
}
else if ( rEntry.Name == "HelpId" )
{
if( ! (rEntry.Value >>= aHelpIds ) )
{
rtl::OUString aHelpId;
if( (rEntry.Value >>= aHelpId) )
{
aHelpIds.realloc( 1 );
*aHelpIds.getArray() = aHelpId;
}
}
}
else if ( rEntry.Name == "HintNoLayoutPage" )
{
sal_Bool bNoLayoutPage = sal_False;
rEntry.Value >>= bNoLayoutPage;
mbShowLayoutPage = ! bNoLayoutPage;
}
}
if (aCtrlType == "Group" && !aID.isEmpty())
2009-07-28 19:01:04 +00:00
{
TabPage *pPage = get<TabPage>(aID);
if (!pPage && mpCustomOptionsUIBuilder)
pPage = mpCustomOptionsUIBuilder->get<TabPage>(aID);
sal_uInt16 nPageId = mpTabCtrl->GetPageId(*pPage);
2009-07-28 19:01:04 +00:00
mpTabCtrl->SetPageText(nPageId, aText);
2009-05-27 17:40:24 +00:00
// set help id
if (aHelpIds.getLength() > 0)
mpTabCtrl->SetHelpId(nPageId, rtl::OUStringToOString(aHelpIds.getConstArray()[0], RTL_TEXTENCODING_UTF8));
2009-05-27 17:40:24 +00:00
// set help text
if (aHelpTexts.getLength() > 0)
mpTabCtrl->SetHelpText(nPageId, aHelpTexts.getConstArray()[0]);
2009-05-27 17:40:24 +00:00
pPage->Show();
2009-05-27 17:40:24 +00:00
}
else if (aCtrlType == "Subgroup" && !aID.isEmpty())
{
Window *pFrame = get<Window>(aID);
if (!pFrame && mpCustomOptionsUIBuilder)
pFrame = mpCustomOptionsUIBuilder->get<Window>(aID);
pFrame->SetText(aText);
// set help id
setHelpId(pFrame, aHelpIds, 0);
// set help text
setHelpText(pFrame, aHelpTexts, 0);
2009-07-23 17:22:34 +00:00
pFrame->Show();
2009-05-27 17:40:24 +00:00
}
2009-08-01 15:16:11 +00:00
// EVIL
else if( aCtrlType == "Bool" && aGroupingHint == "LayoutPage" && aPropertyName == "PrintProspect" )
2009-08-01 15:16:11 +00:00
{
maNUpPage.mpBrochureBtn->SetText( aText );
maNUpPage.mpBrochureBtn->Show();
2009-08-01 15:16:11 +00:00
sal_Bool bVal = sal_False;
PropertyValue* pVal = maPController->getValue( aPropertyName );
if( pVal )
pVal->Value >>= bVal;
maNUpPage.mpBrochureBtn->Check( bVal );
maNUpPage.mpBrochureBtn->Enable( maPController->isUIOptionEnabled( aPropertyName ) && pVal != NULL );
maNUpPage.mpBrochureBtn->SetToggleHdl( LINK( this, PrintDialog, ClickHdl ) );
maPropertyToWindowMap[ aPropertyName ].push_back( maNUpPage.mpBrochureBtn );
maControlToPropertyMap[maNUpPage.mpBrochureBtn] = aPropertyName;
// set help id
setHelpId( maNUpPage.mpBrochureBtn, aHelpIds, 0 );
// set help text
setHelpText( maNUpPage.mpBrochureBtn, aHelpTexts, 0 );
}
else if (aCtrlType == "Bool")
{
// add a check box
CheckBox* pNewBox = get<CheckBox>(aID);
if (!pNewBox && mpCustomOptionsUIBuilder)
pNewBox = mpCustomOptionsUIBuilder->get<CheckBox>(aID);
2009-08-01 15:16:11 +00:00
pNewBox->SetText( aText );
pNewBox->Show();
2009-08-01 15:16:11 +00:00
sal_Bool bVal = sal_False;
PropertyValue* pVal = maPController->getValue( aPropertyName );
if( pVal )
pVal->Value >>= bVal;
pNewBox->Check( bVal );
pNewBox->SetToggleHdl( LINK( this, PrintDialog, UIOption_CheckHdl ) );
maPropertyToWindowMap[ aPropertyName ].push_back( pNewBox );
maControlToPropertyMap[pNewBox] = aPropertyName;
// set help id
setHelpId( pNewBox, aHelpIds, 0 );
// set help text
setHelpText( pNewBox, aHelpTexts, 0 );
2009-08-01 15:16:11 +00:00
}
else if (aCtrlType == "Radio")
2009-05-27 17:40:24 +00:00
{
sal_Int32 nCurHelpText = 0;
2009-05-27 17:40:24 +00:00
// iterate options
sal_Int32 nSelectVal = 0;
PropertyValue* pVal = maPController->getValue( aPropertyName );
if( pVal && pVal->Value.hasValue() )
pVal->Value >>= nSelectVal;
for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
{
aID = rtl::OUStringToOString(aIDs[m], RTL_TEXTENCODING_UTF8);
RadioButton* pBtn = get<RadioButton>(aID);
if (!pBtn && mpCustomOptionsUIBuilder)
pBtn = mpCustomOptionsUIBuilder->get<RadioButton>(aID);
pBtn->SetText( aChoices[m] );
pBtn->Check( m == nSelectVal );
pBtn->SetToggleHdl( LINK( this, PrintDialog, UIOption_RadioHdl ) );
if( aChoicesDisabled.getLength() > m && aChoicesDisabled[m] == sal_True )
pBtn->Enable( sal_False );
pBtn->Show();
maPropertyToWindowMap[ aPropertyName ].push_back( pBtn );
maControlToPropertyMap[pBtn] = aPropertyName;
maControlToNumValMap[pBtn] = m;
2009-04-27 09:47:17 +00:00
// set help id
setHelpId( pBtn, aHelpIds, nCurHelpText );
2009-04-27 16:11:03 +00:00
// set help text
setHelpText( pBtn, aHelpTexts, nCurHelpText );
nCurHelpText++;
}
}
else if ( aCtrlType == "List" )
{
ListBox* pList = get<ListBox>(aID);
if (!pList && mpCustomOptionsUIBuilder)
pList = mpCustomOptionsUIBuilder->get<ListBox>(aID);
// iterate options
for( sal_Int32 m = 0; m < aChoices.getLength(); m++ )
{
pList->InsertEntry( aChoices[m] );
}
sal_Int32 nSelectVal = 0;
PropertyValue* pVal = maPController->getValue( aPropertyName );
if( pVal && pVal->Value.hasValue() )
pVal->Value >>= nSelectVal;
pList->SelectEntryPos( static_cast<sal_uInt16>(nSelectVal) );
pList->SetSelectHdl( LINK( this, PrintDialog, UIOption_SelectHdl ) );
pList->SetDropDownLineCount( static_cast<sal_uInt16>(aChoices.getLength()) );
pList->Show();
2009-05-27 17:40:24 +00:00
// set help id
setHelpId( pList, aHelpIds, 0 );
// set help text
setHelpText( pList, aHelpTexts, 0 );
2009-04-27 09:47:17 +00:00
maPropertyToWindowMap[ aPropertyName ].push_back( pList );
maControlToPropertyMap[pList] = aPropertyName;
}
else if ( aCtrlType == "Range" )
{
NumericField* pField = get<NumericField>(aID);
if (!pField && mpCustomOptionsUIBuilder)
pField = mpCustomOptionsUIBuilder->get<NumericField>(aID);
2009-05-22 10:06:06 +00:00
// set min/max and current value
if( nMinValue != nMaxValue )
{
pField->SetMin( nMinValue );
pField->SetMax( nMaxValue );
}
sal_Int64 nCurVal = 0;
PropertyValue* pVal = maPController->getValue( aPropertyName );
if( pVal && pVal->Value.hasValue() )
pVal->Value >>= nCurVal;
pField->SetValue( nCurVal );
pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) );
pField->Show();
2009-03-16 17:48:45 +00:00
// set help id
setHelpId( pField, aHelpIds, 0 );
// set help text
setHelpText( pField, aHelpTexts, 0 );
2009-03-16 17:48:45 +00:00
maPropertyToWindowMap[ aPropertyName ].push_back( pField );
maControlToPropertyMap[pField] = aPropertyName;
}
else if (aCtrlType == "Edit")
{
Edit *pField = get<Edit>(aID);
if (!pField && mpCustomOptionsUIBuilder)
pField = mpCustomOptionsUIBuilder->get<Edit>(aID);
2009-05-22 10:06:06 +00:00
rtl::OUString aCurVal;
PropertyValue* pVal = maPController->getValue( aPropertyName );
if( pVal && pVal->Value.hasValue() )
pVal->Value >>= aCurVal;
pField->SetText( aCurVal );
pField->SetModifyHdl( LINK( this, PrintDialog, UIOption_ModifyHdl ) );
pField->Show();
2009-05-27 17:40:24 +00:00
// set help id
setHelpId( pField, aHelpIds, 0 );
// set help text
setHelpText( pField, aHelpTexts, 0 );
maPropertyToWindowMap[ aPropertyName ].push_back( pField );
maControlToPropertyMap[pField] = aPropertyName;
}
else
{
rtl::OStringBuffer sMessage;
sMessage.append("Unsupported UI option: \"");
sMessage.append(rtl::OUStringToOString(aCtrlType, RTL_TEXTENCODING_UTF8));
sMessage.append('"');
OSL_FAIL( sMessage.getStr() );
}
}
2009-03-26 18:54:45 +00:00
// #i106506# if no brochure button, then the singular Pages radio button
// makes no sense, so replace it by a FixedText label
if (!maNUpPage.mpBrochureBtn->IsVisible() && maNUpPage.mpPagesBtn->IsVisible())
{
maNUpPage.mpPagesBoxTitleTxt->SetText( maNUpPage.mpPagesBtn->GetText() );
maNUpPage.mpPagesBoxTitleTxt->Show( sal_True );
maNUpPage.mpPagesBtn->Show( sal_False );
}
// update enable states
checkOptionalControlDependencies();
Window *pPageRange = get<Window>("pagerange");
2009-07-28 19:01:04 +00:00
// print range not shown (currently math only) -> hide spacer line and reverse order
if (!pPageRange || !pPageRange->IsVisible())
2009-05-22 10:06:06 +00:00
{
maJobPage.mpCopySpacer->Show( sal_False );
maJobPage.mpReverseOrderBox->Show( sal_False );
2009-05-22 10:06:06 +00:00
}
if (!mpCustomOptionsUIBuilder)
mpTabCtrl->RemovePage(mpTabCtrl->GetPageId(1));
}
void PrintDialog::DataChanged( const DataChangedEvent& i_rDCEvt )
{
// react on settings changed
if( i_rDCEvt.GetType() == DATACHANGED_SETTINGS )
checkControlDependencies();
ModalDialog::DataChanged( i_rDCEvt );
}
void PrintDialog::checkControlDependencies()
{
if( maJobPage.mpCopyCountField->GetValue() > 1 )
maJobPage.mpCollateBox->Enable( maJobPage.mnCollateUIMode == 0 );
else
maJobPage.mpCollateBox->Enable( sal_False );
Image aImg( maJobPage.mpCollateBox->IsChecked() ? maJobPage.maCollateImg : maJobPage.maNoCollateImg );
Size aImgSize( aImg.GetSizePixel() );
// adjust size of image
maJobPage.mpCollateImage->SetSizePixel( aImgSize );
maJobPage.mpCollateImage->SetImage( aImg );
// enable setup button only for printers that can be setup
bool bHaveSetup = maPController->getPrinter()->HasSupport( SUPPORT_SETUPDIALOG );
maJobPage.mpSetupButton->Enable(bHaveSetup);
}
void PrintDialog::checkOptionalControlDependencies()
{
for( std::map< Window*, rtl::OUString >::iterator it = maControlToPropertyMap.begin();
it != maControlToPropertyMap.end(); ++it )
{
bool bShouldbeEnabled = maPController->isUIOptionEnabled( it->second );
if( ! bShouldbeEnabled )
{
// enable controls that are directly attached to a dependency anyway
// if the normally disabled controls get modified, change the dependency
// so the control would be enabled
// example: in print range "Print All" is selected, "Page Range" is then of course
// not selected and the Edit for the Page Range would be disabled
// as a convenience we should enable the Edit anyway and automatically select
// "Page Range" instead of "Print All" if the Edit gets modified
if( maReverseDependencySet.find( it->second ) != maReverseDependencySet.end() )
{
rtl::OUString aDep( maPController->getDependency( it->second ) );
// if the dependency is at least enabled, then enable this control anyway
if( !aDep.isEmpty() && maPController->isUIOptionEnabled( aDep ) )
bShouldbeEnabled = true;
}
}
if( bShouldbeEnabled && dynamic_cast<RadioButton*>(it->first) )
{
std::map< Window*, sal_Int32 >::const_iterator r_it = maControlToNumValMap.find( it->first );
if( r_it != maControlToNumValMap.end() )
{
bShouldbeEnabled = maPController->isUIChoiceEnabled( it->second, r_it->second );
}
}
bool bIsEnabled = it->first->IsEnabled();
// Enable does not do a change check first, so can be less cheap than expected
if( bShouldbeEnabled != bIsEnabled )
it->first->Enable( bShouldbeEnabled );
}
}
static rtl::OUString searchAndReplace( const rtl::OUString& i_rOrig, const char* i_pRepl, sal_Int32 i_nReplLen, const rtl::OUString& i_rRepl )
{
sal_Int32 nPos = i_rOrig.indexOfAsciiL( i_pRepl, i_nReplLen );
if( nPos != -1 )
{
rtl::OUStringBuffer aBuf( i_rOrig.getLength() );
aBuf.append( i_rOrig.getStr(), nPos );
aBuf.append( i_rRepl );
if( nPos + i_nReplLen < i_rOrig.getLength() )
aBuf.append( i_rOrig.getStr() + nPos + i_nReplLen );
return aBuf.makeStringAndClear();
}
return i_rOrig;
}
void PrintDialog::updatePrinterText()
{
2011-11-21 09:00:21 +01:00
const rtl::OUString aDefPrt( Printer::GetDefaultPrinterName() );
const QueueInfo* pInfo = Printer::GetQueueInfo( maJobPage.mpPrinters->GetSelectEntry(), true );
if( pInfo )
{
maJobPage.mpLocationTxt->SetText( pInfo->GetLocation() );
maJobPage.mpCommentTxt->SetText( pInfo->GetComment() );
2009-07-22 17:16:34 +00:00
// FIXME: status text
2009-08-26 15:46:13 +00:00
rtl::OUString aStatus;
if( aDefPrt == pInfo->GetPrinterName() )
aStatus = maDefPrtText;
maJobPage.mpStatusTxt->SetText( aStatus );
2009-07-22 17:16:34 +00:00
}
else
{
maJobPage.mpLocationTxt->SetText( String() );
maJobPage.mpCommentTxt->SetText( String() );
maJobPage.mpStatusTxt->SetText( String() );
}
}
2009-06-03 19:22:35 +00:00
void PrintDialog::setPreviewText( sal_Int32 )
{
2009-08-11 15:50:07 +00:00
rtl::OUString aNewText( searchAndReplace( maPageStr, "%n", 2, rtl::OUString::valueOf( mnCachedPages ) ) );
mpNumPagesText->SetText( aNewText );
}
2009-06-10 17:21:10 +00:00
void PrintDialog::preparePreview( bool i_bNewPage, bool i_bMayUseCache )
{
// page range may have changed depending on options
sal_Int32 nPages = maPController->getFilteredPageCount();
mnCachedPages = nPages;
if( mnCurPage >= nPages )
mnCurPage = nPages-1;
2009-03-26 18:00:43 +00:00
if( mnCurPage < 0 )
mnCurPage = 0;
setPreviewText( mnCurPage );
mpPageEdit->SetMin( 1 );
mpPageEdit->SetMax( nPages );
if( i_bNewPage )
{
const MapMode aMapMode( MAP_100TH_MM );
GDIMetaFile aMtf;
boost::shared_ptr<Printer> aPrt( maPController->getPrinter() );
2009-05-05 17:16:25 +00:00
if( nPages > 0 )
{
PrinterController::PageSize aPageSize =
maPController->getFilteredPageFile( mnCurPage, aMtf, i_bMayUseCache );
if( ! aPageSize.bFullPaper )
{
Point aOff( aPrt->PixelToLogic( aPrt->GetPageOffsetPixel(), aMapMode ) );
aMtf.Move( aOff.X(), aOff.Y() );
}
}
2009-08-12 16:37:34 +00:00
Size aCurPageSize = aPrt->PixelToLogic( aPrt->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) );
mpPreviewWindow->setPreview( aMtf, aCurPageSize,
aPrt->GetPaperName( false ),
nPages > 0 ? rtl::OUString() : maNoPageStr,
aPrt->ImplGetDPIX(), aPrt->ImplGetDPIY(),
aPrt->GetPrinterOptions().IsConvertToGreyscales()
2009-08-13 15:10:43 +00:00
);
mpForwardBtn->Enable( mnCurPage < nPages-1 );
mpBackwardBtn->Enable( mnCurPage != 0 );
mpPageEdit->Enable( nPages > 1 );
}
}
2009-07-27 17:10:15 +00:00
Size PrintDialog::getJobPageSize()
{
if( maFirstPageSize.Width() == 0 && maFirstPageSize.Height() == 0)
{
maFirstPageSize = maNupPortraitSize;
GDIMetaFile aMtf;
if( maPController->getPageCountProtected() > 0 )
{
PrinterController::PageSize aPageSize = maPController->getPageFile( 0, aMtf, true );
maFirstPageSize = aPageSize.aSize;
}
2009-07-27 17:10:15 +00:00
}
return maFirstPageSize;
}
2009-08-03 11:26:33 +00:00
void PrintDialog::updateNupFromPages()
{
long nPages = long(maNUpPage.mpNupPagesBox->GetEntryData(maNUpPage.mpNupPagesBox->GetSelectEntryPos()));
int nRows = int(maNUpPage.mpNupRowsEdt->GetValue());
int nCols = int(maNUpPage.mpNupColEdt->GetValue());
long nPageMargin = long(maNUpPage.mpPageMarginEdt->Denormalize(maNUpPage.mpPageMarginEdt->GetValue( FUNIT_100TH_MM )));
long nSheetMargin = long(maNUpPage.mpSheetMarginEdt->Denormalize(maNUpPage.mpSheetMarginEdt->GetValue( FUNIT_100TH_MM )));
2009-08-03 11:26:33 +00:00
bool bCustom = false;
if( nPages == 1 )
{
nRows = nCols = 1;
nSheetMargin = 0;
nPageMargin = 0;
2009-08-03 11:26:33 +00:00
}
else if( nPages == 2 || nPages == 4 || nPages == 6 || nPages == 9 || nPages == 16 )
{
Size aJobPageSize( getJobPageSize() );
bool bPortrait = aJobPageSize.Width() < aJobPageSize.Height();
if( nPages == 2 )
{
if( bPortrait )
nRows = 1, nCols = 2;
else
nRows = 2, nCols = 1;
}
else if( nPages == 4 )
nRows = nCols = 2;
else if( nPages == 6 )
{
if( bPortrait )
nRows = 2, nCols = 3;
else
nRows = 3, nCols = 2;
}
else if( nPages == 9 )
nRows = nCols = 3;
else if( nPages == 16 )
nRows = nCols = 4;
2009-08-25 08:52:05 +00:00
nPageMargin = 0;
nSheetMargin = 0;
2009-08-03 11:26:33 +00:00
}
else
bCustom = true;
2009-08-31 17:19:25 +00:00
if( nPages > 1 )
{
// set upper limits for margins based on job page size and rows/columns
Size aSize( getJobPageSize() );
// maximum sheet distance: 1/2 sheet
long nHorzMax = aSize.Width()/2;
long nVertMax = aSize.Height()/2;
if( nSheetMargin > nHorzMax )
nSheetMargin = nHorzMax;
if( nSheetMargin > nVertMax )
nSheetMargin = nVertMax;
maNUpPage.mpSheetMarginEdt->SetMax(
maNUpPage.mpSheetMarginEdt->Normalize(
2009-08-31 17:19:25 +00:00
nHorzMax > nVertMax ? nVertMax : nHorzMax ), FUNIT_100TH_MM );
// maximum page distance
nHorzMax = (aSize.Width() - 2*nSheetMargin);
if( nCols > 1 )
nHorzMax /= (nCols-1);
nVertMax = (aSize.Height() - 2*nSheetMargin);
if( nRows > 1 )
nHorzMax /= (nRows-1);
if( nPageMargin > nHorzMax )
nPageMargin = nHorzMax;
if( nPageMargin > nVertMax )
nPageMargin = nVertMax;
maNUpPage.mpPageMarginEdt->SetMax(
maNUpPage.mpSheetMarginEdt->Normalize(
2009-08-31 17:19:25 +00:00
nHorzMax > nVertMax ? nVertMax : nHorzMax ), FUNIT_100TH_MM );
}
maNUpPage.mpNupRowsEdt->SetValue( nRows );
maNUpPage.mpNupColEdt->SetValue( nCols );
maNUpPage.mpPageMarginEdt->SetValue( maNUpPage.mpPageMarginEdt->Normalize( nPageMargin ), FUNIT_100TH_MM );
maNUpPage.mpSheetMarginEdt->SetValue( maNUpPage.mpSheetMarginEdt->Normalize( nSheetMargin ), FUNIT_100TH_MM );
2009-08-03 11:26:33 +00:00
maNUpPage.showAdvancedControls( bCustom );
2009-08-03 11:26:33 +00:00
updateNup();
}
2009-03-28 08:52:14 +00:00
void PrintDialog::updateNup()
{
int nRows = int(maNUpPage.mpNupRowsEdt->GetValue());
int nCols = int(maNUpPage.mpNupColEdt->GetValue());
long nPageMargin = long(maNUpPage.mpPageMarginEdt->Denormalize(maNUpPage.mpPageMarginEdt->GetValue( FUNIT_100TH_MM )));
long nSheetMargin = long(maNUpPage.mpSheetMarginEdt->Denormalize(maNUpPage.mpSheetMarginEdt->GetValue( FUNIT_100TH_MM )));
2009-03-28 08:52:14 +00:00
PrinterController::MultiPageSetup aMPS;
2009-06-09 18:58:38 +00:00
aMPS.nRows = nRows;
aMPS.nColumns = nCols;
2009-07-27 17:10:15 +00:00
aMPS.nRepeat = 1;
aMPS.nLeftMargin =
aMPS.nTopMargin =
aMPS.nRightMargin =
aMPS.nBottomMargin = nSheetMargin;
2009-06-09 18:58:38 +00:00
2009-07-27 17:10:15 +00:00
aMPS.nHorizontalSpacing =
aMPS.nVerticalSpacing = nPageMargin;
2009-06-09 18:58:38 +00:00
aMPS.bDrawBorder = maNUpPage.mpBorderCB->IsChecked();
2009-06-09 18:58:38 +00:00
int nOrderMode = maNUpPage.mpNupOrderBox->GetSelectEntryPos();
if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_LRTB )
2009-07-30 13:52:50 +00:00
aMPS.nOrder = PrinterController::LRTB;
else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBLR )
2009-07-30 13:52:50 +00:00
aMPS.nOrder = PrinterController::TBLR;
else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_RLTB )
aMPS.nOrder = PrinterController::RLTB;
else if( nOrderMode == SV_PRINT_PRT_NUP_ORDER_TBRL )
aMPS.nOrder = PrinterController::TBRL;
2009-07-30 13:52:50 +00:00
int nOrientationMode = maNUpPage.mpNupOrientationBox->GetSelectEntryPos();
2009-07-27 17:10:15 +00:00
if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_LANDSCAPE )
aMPS.aPaperSize = maNupLandscapeSize;
else if( nOrientationMode == SV_PRINT_PRT_NUP_ORIENTATION_PORTRAIT )
aMPS.aPaperSize = maNupPortraitSize;
else // automatic mode
{
// get size of first real page to see if it is portrait or landscape
// we assume same page sizes for all the pages for this
Size aPageSize = getJobPageSize();
Size aMultiSize( aPageSize.Width() * nCols, aPageSize.Height() * nRows );
if( aMultiSize.Width() > aMultiSize.Height() ) // fits better on landscape
aMPS.aPaperSize = maNupLandscapeSize;
else
aMPS.aPaperSize = maNupPortraitSize;
}
maPController->setMultipage( aMPS );
2009-03-28 08:52:14 +00:00
maNUpPage.mpNupOrderWin->setValues( nOrderMode, nCols, nRows );
2009-07-30 13:52:50 +00:00
2009-06-10 17:21:10 +00:00
preparePreview( true, true );
2009-03-28 08:52:14 +00:00
}
IMPL_LINK( PrintDialog, SelectHdl, ListBox*, pBox )
{
if( pBox == maJobPage.mpPrinters )
{
String aNewPrinter( pBox->GetSelectEntry() );
// set new printer
maPController->setPrinter( boost::shared_ptr<Printer>( new Printer( aNewPrinter ) ) );
maPController->resetPrinterOptions( maOptionsPage.mpToFileBox->IsChecked() );
// update text fields
updatePrinterText();
preparePreview( true, false );
}
else if( pBox == maNUpPage.mpNupOrientationBox || pBox == maNUpPage.mpNupOrderBox )
2009-07-27 17:10:15 +00:00
{
updateNup();
}
else if( pBox == maNUpPage.mpNupPagesBox )
2009-07-27 17:10:15 +00:00
{
if( !maNUpPage.mpPagesBtn->IsChecked() )
maNUpPage.mpPagesBtn->Check();
2009-08-03 11:26:33 +00:00
updateNupFromPages();
2009-07-27 17:10:15 +00:00
}
return 0;
}
IMPL_LINK( PrintDialog, ClickHdl, Button*, pButton )
{
if( pButton == mpOKButton || pButton == mpCancelButton )
{
2009-06-02 11:37:36 +00:00
storeToSettings();
EndDialog( pButton == mpOKButton );
2009-06-02 11:37:36 +00:00
}
else if( pButton == mpHelpButton )
2009-08-03 15:51:37 +00:00
{
// start help system
Help* pHelp = Application::GetHelp();
if( pHelp )
{
pHelp->Start( rtl::OUString("vcl/ui/printdialog"), mpOKButton );
2009-08-03 15:51:37 +00:00
}
}
else if( pButton == mpForwardBtn )
{
previewForward();
}
else if( pButton == mpBackwardBtn )
{
previewBackward();
}
else if( pButton == maOptionsPage.mpToFileBox )
2009-07-24 13:15:45 +00:00
{
mpOKButton->SetText( maOptionsPage.mpToFileBox->IsChecked() ? maPrintToFileText : maPrintText );
maPController->resetPrinterOptions( maOptionsPage.mpToFileBox->IsChecked() );
preparePreview( true, true );
2009-07-24 13:15:45 +00:00
}
else if( pButton == maNUpPage.mpBrochureBtn )
2009-08-01 15:16:11 +00:00
{
PropertyValue* pVal = getValueForWindow( pButton );
if( pVal )
{
sal_Bool bVal = maNUpPage.mpBrochureBtn->IsChecked();
2009-08-01 15:16:11 +00:00
pVal->Value <<= bVal;
checkOptionalControlDependencies();
// update preview and page settings
preparePreview();
}
if( maNUpPage.mpBrochureBtn->IsChecked() )
2009-08-03 11:26:33 +00:00
{
maNUpPage.mpNupPagesBox->SelectEntryPos( 0 );
2009-08-03 11:26:33 +00:00
updateNupFromPages();
maNUpPage.showAdvancedControls( false );
2009-08-01 15:16:11 +00:00
maNUpPage.enableNupControls( false );
2009-08-03 11:26:33 +00:00
}
2009-08-01 15:16:11 +00:00
}
else if( pButton == maNUpPage.mpPagesBtn )
2009-08-01 15:16:11 +00:00
{
maNUpPage.enableNupControls( true );
2009-08-03 11:26:33 +00:00
updateNupFromPages();
2009-08-01 15:16:11 +00:00
}
else if( pButton == maJobPage.mpCollateBox )
2009-07-16 11:37:53 +00:00
{
maPController->setValue( rtl::OUString( "Collate" ),
2009-07-16 11:37:53 +00:00
makeAny( sal_Bool(isCollate()) ) );
2009-07-22 17:16:34 +00:00
checkControlDependencies();
2009-07-16 11:37:53 +00:00
}
else if( pButton == maJobPage.mpReverseOrderBox )
2009-07-30 15:11:07 +00:00
{
sal_Bool bChecked = maJobPage.mpReverseOrderBox->IsChecked();
2009-07-30 15:11:07 +00:00
maPController->setReversePrint( bChecked );
maPController->setValue( rtl::OUString( "PrintReverse" ),
2009-07-30 15:11:07 +00:00
makeAny( bChecked ) );
preparePreview( true, true );
}
else if( pButton == maNUpPage.mpBorderCB )
{
updateNup();
}
2009-06-02 11:37:36 +00:00
else
{
if( pButton == maJobPage.mpSetupButton )
2009-06-02 11:37:36 +00:00
{
maPController->setupPrinter( this );
preparePreview( true, true );
2009-06-02 11:37:36 +00:00
}
checkControlDependencies();
}
return 0;
}
2009-03-26 18:00:43 +00:00
IMPL_LINK( PrintDialog, ModifyHdl, Edit*, pEdit )
{
checkControlDependencies();
if( pEdit == maNUpPage.mpNupRowsEdt || pEdit == maNUpPage.mpNupColEdt ||
pEdit == maNUpPage.mpSheetMarginEdt || pEdit == maNUpPage.mpPageMarginEdt
2009-06-09 18:58:38 +00:00
)
2009-03-28 08:52:14 +00:00
{
2009-08-31 17:19:25 +00:00
updateNupFromPages();
2009-03-28 08:52:14 +00:00
}
else if( pEdit == mpPageEdit )
{
mnCurPage = sal_Int32( mpPageEdit->GetValue() - 1 );
2009-06-10 17:21:10 +00:00
preparePreview( true, true );
}
else if( pEdit == maJobPage.mpCopyCountField )
{
maPController->setValue( rtl::OUString( "CopyCount" ),
makeAny( sal_Int32(maJobPage.mpCopyCountField->GetValue()) ) );
maPController->setValue( rtl::OUString( "Collate" ),
2009-07-16 11:37:53 +00:00
makeAny( sal_Bool(isCollate()) ) );
}
return 0;
}
IMPL_LINK_NOARG(PrintDialog, UIOptionsChanged)
{
checkOptionalControlDependencies();
return 0;
}
PropertyValue* PrintDialog::getValueForWindow( Window* i_pWindow ) const
{
PropertyValue* pVal = NULL;
std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow );
if( it != maControlToPropertyMap.end() )
{
pVal = maPController->getValue( it->second );
DBG_ASSERT( pVal, "property value not found" );
}
else
{
2011-03-01 19:08:19 +01:00
OSL_FAIL( "changed control not in property map" );
}
return pVal;
}
void PrintDialog::updateWindowFromProperty( const rtl::OUString& i_rProperty )
{
beans::PropertyValue* pValue = maPController->getValue( i_rProperty );
std::map< rtl::OUString, std::vector< Window* > >::const_iterator it = maPropertyToWindowMap.find( i_rProperty );
if( pValue && it != maPropertyToWindowMap.end() )
{
const std::vector< Window* >& rWindows( it->second );
if( ! rWindows.empty() )
{
sal_Bool bVal = sal_False;
sal_Int32 nVal = -1;
if( pValue->Value >>= bVal )
{
// we should have a CheckBox for this one
CheckBox* pBox = dynamic_cast< CheckBox* >( rWindows.front() );
if( pBox )
{
pBox->Check( bVal );
}
else if ( i_rProperty == "PrintProspect" )
{
// EVIL special case
if( bVal )
maNUpPage.mpBrochureBtn->Check();
else
maNUpPage.mpPagesBtn->Check();
}
else
{
DBG_ASSERT( 0, "missing a checkbox" );
}
}
else if( pValue->Value >>= nVal )
{
// this could be a ListBox or a RadioButtonGroup
ListBox* pList = dynamic_cast< ListBox* >( rWindows.front() );
if( pList )
{
pList->SelectEntryPos( static_cast< sal_uInt16 >(nVal) );
}
else if( nVal >= 0 && nVal < sal_Int32(rWindows.size() ) )
{
RadioButton* pBtn = dynamic_cast< RadioButton* >( rWindows[nVal] );
DBG_ASSERT( pBtn, "unexpected control for property" );
if( pBtn )
pBtn->Check();
}
}
}
}
}
void PrintDialog::makeEnabled( Window* i_pWindow )
{
std::map< Window*, rtl::OUString >::const_iterator it = maControlToPropertyMap.find( i_pWindow );
if( it != maControlToPropertyMap.end() )
{
rtl::OUString aDependency( maPController->makeEnabled( it->second ) );
if( !aDependency.isEmpty() )
updateWindowFromProperty( aDependency );
}
}
IMPL_LINK( PrintDialog, UIOption_CheckHdl, CheckBox*, i_pBox )
{
PropertyValue* pVal = getValueForWindow( i_pBox );
if( pVal )
{
makeEnabled( i_pBox );
sal_Bool bVal = i_pBox->IsChecked();
pVal->Value <<= bVal;
checkOptionalControlDependencies();
// update preview and page settings
preparePreview();
}
return 0;
}
IMPL_LINK( PrintDialog, UIOption_RadioHdl, RadioButton*, i_pBtn )
{
// this handler gets called for all radiobuttons that get unchecked, too
// however we only want one notificaction for the new value (that is for
// the button that gets checked)
if( i_pBtn->IsChecked() )
{
PropertyValue* pVal = getValueForWindow( i_pBtn );
std::map< Window*, sal_Int32 >::const_iterator it = maControlToNumValMap.find( i_pBtn );
if( pVal && it != maControlToNumValMap.end() )
{
makeEnabled( i_pBtn );
sal_Int32 nVal = it->second;
pVal->Value <<= nVal;
checkOptionalControlDependencies();
// update preview and page settings
preparePreview();
}
}
return 0;
}
IMPL_LINK( PrintDialog, UIOption_SelectHdl, ListBox*, i_pBox )
{
PropertyValue* pVal = getValueForWindow( i_pBox );
if( pVal )
{
makeEnabled( i_pBox );
sal_Int32 nVal( i_pBox->GetSelectEntryPos() );
pVal->Value <<= nVal;
checkOptionalControlDependencies();
// update preview and page settings
preparePreview();
}
return 0;
}
2009-03-16 17:48:45 +00:00
IMPL_LINK( PrintDialog, UIOption_ModifyHdl, Edit*, i_pBox )
{
PropertyValue* pVal = getValueForWindow( i_pBox );
if( pVal )
{
makeEnabled( i_pBox );
2009-03-16 17:48:45 +00:00
NumericField* pNum = dynamic_cast<NumericField*>(i_pBox);
MetricField* pMetric = dynamic_cast<MetricField*>(i_pBox);
if( pNum )
{
sal_Int64 nVal = pNum->GetValue();
pVal->Value <<= nVal;
}
else if( pMetric )
{
sal_Int64 nVal = pMetric->GetValue();
pVal->Value <<= nVal;
}
else
{
rtl::OUString aVal( i_pBox->GetText() );
pVal->Value <<= aVal;
}
checkOptionalControlDependencies();
// update preview and page settings
preparePreview();
}
return 0;
}
void PrintDialog::Command( const CommandEvent& rEvt )
{
if( rEvt.GetCommand() == COMMAND_WHEEL )
{
const CommandWheelData* pWheelData = rEvt.GetWheelData();
if( pWheelData->GetDelta() > 0 )
previewForward();
else if( pWheelData->GetDelta() < 0 )
previewBackward();
}
}
2009-03-17 12:27:26 +00:00
void PrintDialog::Resize()
{
// maLayout.setManagedArea( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
// and do the preview; however the metafile does not need to be gotten anew
preparePreview( false );
Dialog::Resize();
2009-03-17 12:27:26 +00:00
}
2009-03-18 14:46:10 +00:00
void PrintDialog::previewForward()
{
mpPageEdit->Up();
}
void PrintDialog::previewBackward()
{
mpPageEdit->Down();
}
2009-03-18 14:46:10 +00:00
// -----------------------------------------------------------------------------
//
// PrintProgressDialog
//
// -----------------------------------------------------------------------------
PrintProgressDialog::PrintProgressDialog( Window* i_pParent, int i_nMax ) :
ModelessDialog( i_pParent, VclResId( SV_DLG_PRINT_PROGRESS ) ),
maText( this, VclResId( SV_PRINT_PROGRESS_TEXT ) ),
maButton( this, VclResId( SV_PRINT_PROGRESS_CANCEL ) ),
mbCanceled( false ),
mnCur( 0 ),
2009-03-18 16:16:06 +00:00
mnMax( i_nMax ),
mnProgressHeight( 15 ),
mbNativeProgress( false )
2009-03-18 14:46:10 +00:00
{
FreeResource();
2009-05-05 17:16:25 +00:00
if( mnMax < 1 )
mnMax = 1;
2009-03-18 14:46:10 +00:00
maStr = maText.GetText();
maButton.SetClickHdl( LINK( this, PrintProgressDialog, ClickHdl ) );
}
PrintProgressDialog::~PrintProgressDialog()
{
}
IMPL_LINK( PrintProgressDialog, ClickHdl, Button*, pButton )
{
if( pButton == &maButton )
mbCanceled = true;
return 0;
}
void PrintProgressDialog::implCalcProgressRect()
{
if( IsNativeControlSupported( CTRL_PROGRESS, PART_ENTIRE_CONTROL ) )
{
ImplControlValue aValue;
Rectangle aControlRegion( Point(), Size( 100, mnProgressHeight ) );
Rectangle aNativeControlRegion, aNativeContentRegion;
2009-03-18 14:46:10 +00:00
if( GetNativeControlRegion( CTRL_PROGRESS, PART_ENTIRE_CONTROL, aControlRegion,
CTRL_STATE_ENABLED, aValue, rtl::OUString(),
aNativeControlRegion, aNativeContentRegion ) )
{
mnProgressHeight = aNativeControlRegion.GetHeight();
2009-03-18 14:46:10 +00:00
}
2009-03-18 16:16:06 +00:00
mbNativeProgress = true;
2009-03-18 14:46:10 +00:00
}
maProgressRect = Rectangle( Point( 10, maText.GetPosPixel().Y() + maText.GetSizePixel().Height() + 8 ),
2009-03-18 16:16:06 +00:00
Size( GetSizePixel().Width() - 20, mnProgressHeight ) );
2009-03-18 14:46:10 +00:00
}
void PrintProgressDialog::setProgress( int i_nCurrent, int i_nMax )
{
2009-03-18 16:16:06 +00:00
if( maProgressRect.IsEmpty() )
implCalcProgressRect();
2009-03-18 14:46:10 +00:00
mnCur = i_nCurrent;
if( i_nMax != -1 )
mnMax = i_nMax;
2009-05-05 17:16:25 +00:00
if( mnMax < 1 )
mnMax = 1;
rtl::OUString aNewText( searchAndReplace( maStr, "%p", 2, rtl::OUString::valueOf( mnCur ) ) );
aNewText = searchAndReplace( aNewText, "%n", 2, rtl::OUString::valueOf( mnMax ) );
2009-03-18 14:46:10 +00:00
maText.SetText( aNewText );
// update progress
2009-03-18 18:04:53 +00:00
Invalidate( maProgressRect, INVALIDATE_UPDATE );
2009-03-18 14:46:10 +00:00
}
void PrintProgressDialog::tick()
{
if( mnCur < mnMax )
setProgress( ++mnCur );
}
void PrintProgressDialog::reset()
{
mbCanceled = false;
setProgress( 0 );
}
2009-03-18 14:52:24 +00:00
void PrintProgressDialog::Paint( const Rectangle& )
2009-03-18 14:46:10 +00:00
{
2009-05-05 17:16:25 +00:00
if( maProgressRect.IsEmpty() )
implCalcProgressRect();
2009-03-18 16:16:06 +00:00
Push( PUSH_LINECOLOR | PUSH_FILLCOLOR );
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
Color aPrgsColor = rStyleSettings.GetHighlightColor();
if ( aPrgsColor == rStyleSettings.GetFaceColor() )
aPrgsColor = rStyleSettings.GetDarkShadowColor();
SetLineColor();
SetFillColor( aPrgsColor );
2009-03-18 18:05:51 +00:00
const long nOffset = 3;
2009-03-18 16:16:06 +00:00
const long nWidth = 3*mnProgressHeight/2;
const long nFullWidth = nWidth + nOffset;
const long nMaxCount = maProgressRect.GetWidth() / nFullWidth;
2009-03-18 14:46:10 +00:00
DrawProgress( this, maProgressRect.TopLeft(),
2009-03-18 16:16:06 +00:00
nOffset,
nWidth,
mnProgressHeight,
static_cast<sal_uInt16>(0),
static_cast<sal_uInt16>(10000*mnCur/mnMax),
static_cast<sal_uInt16>(10000/nMaxCount),
2009-03-18 14:46:10 +00:00
maProgressRect
);
2009-03-18 16:16:06 +00:00
Pop();
2009-03-18 14:46:10 +00:00
2009-03-18 16:16:06 +00:00
if( ! mbNativeProgress )
{
DecorationView aDecoView( this );
Rectangle aFrameRect( maProgressRect );
aFrameRect.Left() -= nOffset;
aFrameRect.Right() += nOffset;
aFrameRect.Top() -= nOffset;
aFrameRect.Bottom() += nOffset;
aDecoView.DrawFrame( aFrameRect );
}
2009-03-18 14:46:10 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */