summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-01-15 16:47:42 +0100
committerKurt Zenker <kz@openoffice.org>2010-01-15 16:47:42 +0100
commit5c2d284b0f9973aada365a8f464f1152671bd629 (patch)
tree50f8a36f48addc30ae78dda26e2a716c6066a7d6
parent9f8952a33f76546fb0e58d99a0cdd947ff397701 (diff)
parent9abb7d5fa33870b48d179582969dee5022f8ff70 (diff)
CWS-TOOLING: integrate CWS printerpullpages
Notes
split repo tag: impress_ooo/DEV300_m70
-rw-r--r--sd/source/ui/inc/DocumentRenderer.hxx85
-rw-r--r--sd/source/ui/inc/PrintManager.hxx213
-rw-r--r--sd/source/ui/inc/ViewShellBase.hxx7
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx4
-rw-r--r--sd/source/ui/view/DocumentRenderer.cxx2363
-rw-r--r--sd/source/ui/view/DocumentRenderer.hrc80
-rw-r--r--sd/source/ui/view/DocumentRenderer.src298
-rw-r--r--sd/source/ui/view/PrintManager.cxx1802
-rw-r--r--sd/source/ui/view/ViewShellBase.cxx193
-rw-r--r--sd/source/ui/view/makefile.mk8
-rw-r--r--sd/util/makefile.mk1
11 files changed, 2957 insertions, 2097 deletions
diff --git a/sd/source/ui/inc/DocumentRenderer.hxx b/sd/source/ui/inc/DocumentRenderer.hxx
new file mode 100644
index 000000000000..946ddccbac37
--- /dev/null
+++ b/sd/source/ui/inc/DocumentRenderer.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: BezierObjectBar.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef SD_DOCUMENT_RENDERER_HXX
+#define SD_DOCUMENT_RENDERER_HXX
+
+#include "ViewShellBase.hxx"
+
+#include <com/sun/star/view/XRenderable.hpp>
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <boost/scoped_ptr.hpp>
+
+namespace css = ::com::sun::star;
+
+namespace sd {
+
+namespace {
+ typedef ::cppu::WeakComponentImplHelper1 <
+ ::com::sun::star::view::XRenderable
+ > DocumentRendererInterfaceBase;
+}
+
+
+class DocumentRenderer
+ : protected ::cppu::BaseMutex,
+ public DocumentRendererInterfaceBase
+{
+public:
+ DocumentRenderer (ViewShellBase& rBase);
+ virtual ~DocumentRenderer (void);
+
+ // XRenderable
+ virtual sal_Int32 SAL_CALL getRendererCount (
+ const css::uno::Any& aSelection,
+ const css::uno::Sequence<css::beans::PropertyValue >& xOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual css::uno::Sequence<css::beans::PropertyValue> SAL_CALL getRenderer (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rxOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+ virtual void SAL_CALL render (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rxOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+
+private:
+ class Implementation;
+ ::boost::scoped_ptr<Implementation> mpImpl;
+};
+
+} // end of namespace sd
+
+#endif
diff --git a/sd/source/ui/inc/PrintManager.hxx b/sd/source/ui/inc/PrintManager.hxx
deleted file mode 100644
index 649057653249..000000000000
--- a/sd/source/ui/inc/PrintManager.hxx
+++ /dev/null
@@ -1,213 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: PrintManager.hxx,v $
- * $Revision: 1.10 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef SD_PRINT_MANAGER_HXX
-#define SD_PRINT_MANAGER_HXX
-
-#include "pres.hxx"
-#include <tools/solar.h>
-#include <tools/errcode.hxx>
-#include <sfx2/viewsh.hxx>
-
-class Font;
-class MultiSelection;
-class PrintDialog;
-class SdOptionsPrintItem;
-class SdPage;
-class String;
-class SfxItemSet;
-class SfxPrinter;
-class SfxProgress;
-class SfxTabPage;
-class Window;
-
-namespace sd {
-
-class DrawView;
-class View;
-class ViewShell;
-class ViewShellBase;
-
-/** Manage the printing of documents.
- This includes functions about asking the user for specific
- information what to print as well as high to medium level printing.
-*/
-class PrintManager
-{
-public:
- /* Create a new print manager for the given view shell.
- @param rViewShell
- The life time of that view shell has to exceed that of the
- print manager.
- */
- PrintManager (ViewShellBase& rViewShell);
- virtual ~PrintManager (void);
-
- /// Forwarded to the document shell.
- virtual SfxPrinter* GetPrinter (BOOL bCreate = FALSE);
- /// Forwarded to the main sub-shell.
- virtual USHORT SetPrinter (
- SfxPrinter* pNewPrinter,
- USHORT nDiffFlags = SFX_PRINTER_ALL, bool bIsAPI=false);
- /// Forwarded to the main sub-shell.
- virtual PrintDialog* CreatePrintDialog (::Window *pParent);
-
- /** Create an options tab page for the curren document.
- */
- virtual SfxTabPage* CreatePrintOptionsPage (
- ::Window *pParent,
- const SfxItemSet &rOptions);
-
- /** Print the document.
- @param pDialog
- The dialog specifies what to print.
- */
- virtual USHORT Print (SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pDialog);
-
- /** Show a dialog that allows the user to select the print range
- (among other things) before starting the actual printing.
- */
- virtual ErrCode DoPrint (
- SfxPrinter *pPrinter,
- PrintDialog *pPrintDialog,
- BOOL bSilent, BOOL bIsAPI );
-
- /** When called with <TRUE/> then printing is restricted to the
- selected pages. Otherwise all pages are printed. Note that
- you have to set the page range with a call to
- SetPrintingPageRange().
- */
- void RestrictPrintingToSelection (bool bFlag);
-
- /** Set the range of the pages to print. This is taken into
- account only after a previous call to
- RestrictPrintingToSelection() with <TRUE/> as argument.
- */
- void SetPrintingPageRange (const String& rsPageRange);
-
- USHORT SetPrinterOptDlg (
- SfxPrinter* pNewPrinter,
- USHORT nDiffFlags = SFX_PRINTER_ALL,
- BOOL _bShowDialog = TRUE);
-
- void PreparePrint (PrintDialog* pPrintDialog = 0);
-
-private:
- ViewShellBase& mrBase;
-
- bool mbPrintDirectSelected;
-
- String msPageRange;
-
- /// Copy constructor not supported.
- PrintManager (const PrintManager&);
-
- /// Assignment operator not supported.
- PrintManager& operator= (const PrintManager&);
-
- /** Make sure that the pages that are to be printed do fit to the
- printer pages. When the internal pages are larger then the printer
- pages and no method of resolution has yet been provided then a
- dialog is opened that asks for one. These methods are
- a) scale internal page down to the printer page,
- b) crop internal page
- c) print internal page on several printer pages.
- @param pPrinter
- The printer to print the pages on that are specified by the
- msPageRange member.
- @param bSilent
- This flag, when set, tells the method not to wait for user
- input, i.e. show a dialog.
- @return
- The returned flag indicates whether the method was successfull (<TRUE/>)
- or whether the printing has to be aborted (<FALSE/>). The later
- one is the case only when the dialog is shown and the user
- selects 'Cancel'.
- */
- bool FitPageToPrinterWithDialog (
- SfxPrinter *pPrinter,
- bool bSilent);
-
- class PrintInfo;
-
- /** Print outline pages.
- */
- void PrintOutline (
- PrintInfo& rInfo,
- USHORT nPage);
-
- /** Print handout pages.
- */
- void PrintHandout (
- PrintInfo& rInfo,
- USHORT nPage);
-
- /** Print slides or notes pages.
- */
- void PrintStdOrNotes (
- PrintInfo& rInfo,
- USHORT nPage,
- PageKind ePageKind,
- BOOL bPrintMarkedOnly);
-
- /** Print a part of the given page that is specified by the given page
- origin and the size of the printable area. This method is used
- primarily when the page to print is larger than the printable area
- and the page is printed in several parts.
- */
- void PrintPagePart (
- PrintInfo& rInfo,
- SdPage* pPage,
- DrawView& rPrintView,
- const Point& rPageOrigin,
- BOOL bPrintMarkedOnly,
- const String& rsPageString,
- const Point& rStringOffset);
-
- /** This method is similar to PrintPagePart() and should be unified with
- that.
- */
- void PrintPage(
- PrintInfo& rInfo,
- ::sd::View* pPrintView,
- SdPage* pPage,
- BOOL bPrintMarkedOnly);
-
- /** Return <TRUE/> when the document pages have the 'Screen' size. Only
- the first page of the document is used to determine the size.
- */
- bool IsScreenFormat (void);
-
- /** creates the needed shapes on the handout page for the given layout */
- void InitHandoutTemplate( PrintInfo& rInfo, USHORT nSlidesPerHandout, BOOL bHandoutHorizontal );
-};
-
-} // end of namespace sd
-
-#endif
diff --git a/sd/source/ui/inc/ViewShellBase.hxx b/sd/source/ui/inc/ViewShellBase.hxx
index 383bd12fcdb5..b316a1c014a3 100644
--- a/sd/source/ui/inc/ViewShellBase.hxx
+++ b/sd/source/ui/inc/ViewShellBase.hxx
@@ -136,6 +136,11 @@ public:
*/
virtual ErrCode DoVerb (long nVerb);
+ /** Return a new renderer that can be used for example for printing the
+ document.
+ */
+ virtual com::sun::star::uno::Reference<com::sun::star::view::XRenderable> GetRenderable (void);
+
/// Forwarded to the print manager.
virtual SfxPrinter* GetPrinter (BOOL bCreate = FALSE);
@@ -261,7 +266,7 @@ public:
/** returns the ui descriptive name for the given uno slot. The result is taken from the configuration
and not cached, so do not use it excessive (f.e. in status updates) */
- ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const;
+ ::rtl::OUString RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const;
protected:
osl::Mutex maMutex;
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 8906059e57cf..2e753fd859d1 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -122,8 +122,6 @@ using namespace ::com::sun::star;
extern uno::Reference< uno::XInterface > SdUnoCreatePool( SdDrawDocument* pDrawModel );
-///////////////////////////////////////////////////////////////////////
-
class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
public SfxListener
{
@@ -1516,7 +1514,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer(
sal_Bool bExportNotesPages = sal_False;
for( sal_Int32 nProperty = 0, nPropertyCount = rxOptions.getLength(); nProperty < nPropertyCount; ++nProperty )
{
- if( rxOptions[ nProperty ].Name == OUString( RTL_CONSTASCII_USTRINGPARAM( "ExportNotesPages" ) ) )
+ if( rxOptions[ nProperty ].Name.equalsAscii( "ExportNotesPages" ) )
rxOptions[ nProperty].Value >>= bExportNotesPages;
}
uno::Sequence< beans::PropertyValue > aRenderer;
diff --git a/sd/source/ui/view/DocumentRenderer.cxx b/sd/source/ui/view/DocumentRenderer.cxx
new file mode 100644
index 000000000000..6c0b7491bb5f
--- /dev/null
+++ b/sd/source/ui/view/DocumentRenderer.cxx
@@ -0,0 +1,2363 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: BezierObjectBar.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_sd.hxx"
+
+#include "DocumentRenderer.hxx"
+#include "DocumentRenderer.hrc"
+
+#include "drawdoc.hxx"
+#include "optsitem.hxx"
+#include "sdresid.hxx"
+#include "strings.hrc"
+#include "sdattr.hxx"
+#include "Window.hxx"
+#include "drawview.hxx"
+#include "DrawViewShell.hxx"
+#include "FrameView.hxx"
+#include "Outliner.hxx"
+#include "OutlineViewShell.hxx"
+
+#include <basegfx/polygon/b2dpolygon.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <sfx2/printer.hxx>
+#include <svx/editstat.hxx>
+#include <svx/outlobj.hxx>
+#include <svx/svdetc.hxx>
+#include <svx/svditer.hxx>
+#include <svx/svdopage.hxx>
+#include <svx/svdopath.hxx>
+#include <svx/xlnclit.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <tools/resary.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <vcl/msgbox.hxx>
+#include <unotools/moduleoptions.hxx>
+
+#include <vector>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using ::rtl::OUString;
+
+
+namespace sd {
+
+namespace {
+ OUString A2S (const char* pString)
+ {
+ return OUString::createFromAscii(pString);
+ }
+
+
+
+ /** Convenience class to extract values from the sequence of properties
+ given to one of the XRenderable methods.
+ */
+ class PrintOptions
+ {
+ public:
+ PrintOptions (
+ const vcl::PrinterOptionsHelper& rHelper,
+ const ::std::vector<sal_Int32>& rSlidesPerPage)
+ : mrProperties(rHelper),
+ maSlidesPerPage(rSlidesPerPage)
+ {
+ }
+
+ bool IsWarningOrientation (void) const
+ {
+ return GetBoolValue(NULL, true);
+ }
+
+ bool IsPrintPageName (void) const
+ {
+ return GetBoolValue("IsPrintName");
+ }
+
+ bool IsDate (void) const
+ {
+ return GetBoolValue("IsPrintDateTime");
+ }
+
+ bool IsTime (void) const
+ {
+ return GetBoolValue("IsPrintDateTime");
+ }
+
+ bool IsHiddenPages (void) const
+ {
+ return GetBoolValue("IsPrintHidden");
+ }
+
+ bool IsHandoutHorizontal (void) const
+ {
+ return GetBoolValue("SlidesPerPageOrder", sal_Int32(0), true);
+ }
+
+ sal_Int32 GetHandoutPageCount (void) const
+ {
+ sal_uInt32 nIndex = static_cast<sal_Int32>(mrProperties.getIntValue("SlidesPerPage", sal_Int32(4)));
+ if (nIndex<maSlidesPerPage.size())
+ return maSlidesPerPage[nIndex];
+ else if ( ! maSlidesPerPage.empty())
+ return maSlidesPerPage[0];
+ else
+ return 0;
+ }
+
+ bool IsDraw (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(0));
+ }
+
+ bool IsHandout (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(1));
+ }
+
+ bool IsNotes (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(2));
+ }
+
+ bool IsOutline (void) const
+ {
+ return GetBoolValue("PageContentType", sal_Int32(3));
+ }
+
+ ULONG GetOutputQuality (void) const
+ {
+ sal_Int32 nQuality = static_cast<sal_Int32>(mrProperties.getIntValue( "Quality", sal_Int32(0) ));
+ return nQuality;
+ }
+
+ bool IsPageSize (void) const
+ {
+ return GetBoolValue("PageOptions", sal_Int32(1));
+ }
+
+ bool IsTilePage (void) const
+ {
+ return GetBoolValue("PageOptions", sal_Int32(2)) || GetBoolValue("PageOptions", sal_Int32(3));
+ }
+
+ bool IsCutPage (void) const
+ {
+ return GetBoolValue("PageOptions", sal_Int32(0));
+ }
+
+ bool IsBooklet (void) const
+ {
+ return GetBoolValue("PrintProspect", false);
+ }
+
+ bool IsPrintExcluded (void) const
+ {
+ return (IsNotes() || IsDraw() || IsHandout()) && IsHiddenPages();
+ }
+
+ bool IsPrintFrontPage (void) const
+ {
+ sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 ));
+ return nInclude == 0 || nInclude == 1;
+ }
+
+ bool IsPrintBackPage (void) const
+ {
+ sal_Int32 nInclude = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintProspectInclude", 0 ));
+ return nInclude == 0 || nInclude == 2;
+ }
+
+ bool IsPaperBin (void) const
+ {
+ return GetBoolValue("PrintPaperFromSetup", false);
+ }
+
+ OUString GetPrinterSelection (void) const
+ {
+ sal_Int32 nContent = static_cast<sal_Int32>(mrProperties.getIntValue( "PrintContent", 0 ));
+ OUString sValue( A2S("all") );
+ if( nContent == 1 )
+ sValue = mrProperties.getStringValue( "PageRange", A2S( "all" ) );
+ else if( nContent == 2 )
+ sValue = A2S( "selection" );
+ return sValue;
+ }
+
+ private:
+ const vcl::PrinterOptionsHelper& mrProperties;
+ const ::std::vector<sal_Int32> maSlidesPerPage;
+
+ /** When the value of the property with name pName is a boolean then
+ return its value. When the property is unknown then
+ bDefaultValue is returned. Otherwise <FALSE/> is returned.
+ */
+ bool GetBoolValue (
+ const sal_Char* pName,
+ const bool bDefaultValue = false) const
+ {
+ sal_Bool bValue = mrProperties.getBoolValue( pName, bDefaultValue );
+ return bValue;
+ }
+
+ /** Return <TRUE/> when the value of the property with name pName is
+ a string and its value equals pValue. When the property is
+ unknown then bDefaultValue is returned. Otherwise <FALSE/> is
+ returned.
+ */
+ bool GetBoolValue (
+ const sal_Char* pName,
+ const sal_Char* pValue,
+ const bool bDefaultValue = false) const
+ {
+ OUString sValue( mrProperties.getStringValue( pName ) );
+ if (sValue.getLength())
+ return sValue.equalsAscii(pValue);
+ else
+ return bDefaultValue;
+ }
+
+ /** Return <TRUE/> when the value of the property with name pName is
+ an integer and its value is nTriggerValue. Otherwise <FALSE/> is
+ returned.
+ */
+ bool GetBoolValue (
+ const sal_Char* pName,
+ const sal_Int32 nTriggerValue) const
+ {
+ sal_Int32 nValue = static_cast<sal_Int32>(mrProperties.getIntValue( pName ));
+ return nValue == nTriggerValue;
+ }
+ };
+
+
+
+ /** This class is like MultiSelection but understands two special values.
+ "all" indicates that all pages are selected. "selection" indicates that no
+ pages but a set of shapes is selected.
+ */
+ class Selection
+ {
+ public:
+ Selection (const OUString& rsSelection, const SdPage* pCurrentPage)
+ : mbAreAllPagesSelected(rsSelection.equalsAscii("all")),
+ mbIsShapeSelection(rsSelection.equalsAscii("selection")),
+ mnCurrentPageIndex(pCurrentPage!=NULL ? (pCurrentPage->GetPageNum()-1)/2 : -1),
+ mpSelectedPages()
+ {
+ if ( ! (mbAreAllPagesSelected || mbIsShapeSelection))
+ mpSelectedPages.reset(new MultiSelection(rsSelection));
+ }
+
+ bool IsMarkedOnly (void) const
+ {
+ return mbIsShapeSelection;
+ }
+
+ /** Call with a 0 based page index.
+ */
+ bool IsSelected (const sal_Int32 nIndex) const
+ {
+ if (mbAreAllPagesSelected)
+ return true;
+ else if (mpSelectedPages)
+ return mpSelectedPages->IsSelected(nIndex+1);
+ else if (mbIsShapeSelection && nIndex==mnCurrentPageIndex)
+ return true;
+ else
+ return false;
+ }
+
+ private:
+ const bool mbAreAllPagesSelected;
+ const bool mbIsShapeSelection;
+ const sal_Int32 mnCurrentPageIndex;
+ ::boost::scoped_ptr<MultiSelection> mpSelectedPages;
+ };
+
+ /** A collection of values that helps to reduce the number of arguments
+ given to some functions. Note that not all values are set at the
+ same time.
+ */
+ class PrintInfo
+ {
+ public:
+ PrintInfo (
+ const Printer* pPrinter,
+ const OUString& rsPrinterSelection,
+ const ::boost::shared_ptr<ViewShell> pView)
+ : mpPrinter(pPrinter),
+ mnDrawMode(DRAWMODE_DEFAULT),
+ msTimeDate(),
+ msPageString(),
+ maPrintSize(0,0),
+ maPageSize(0,0),
+ meOrientation(ORIENTATION_PORTRAIT),
+ maMap(),
+ maSelection(rsPrinterSelection, pView ? pView->getCurrentPage() : NULL),
+ mbPrintMarkedOnly(maSelection.IsMarkedOnly())
+ {}
+
+ const Printer* mpPrinter;
+ ULONG mnDrawMode;
+ ::rtl::OUString msTimeDate;
+ ::rtl::OUString msPageString;
+ Size maPrintSize;
+ Size maPageSize;
+ Orientation meOrientation;
+ MapMode maMap;
+ const Selection maSelection;
+ bool mbPrintMarkedOnly;
+ };
+
+
+
+ /** Output one page of the document to the given printer. Note that
+ more than one document page may be output to one printer page.
+ */
+ void PrintPage (
+ Printer& rPrinter,
+ ::sd::View& rPrintView,
+ SdPage& rPage,
+ View* pView,
+ const bool bPrintMarkedOnly,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers)
+ {
+ rPrintView.ShowSdrPage(&rPage);
+
+ const MapMode aOriginalMapMode (rPrinter.GetMapMode());
+
+ // Set the visible layers
+ SdrPageView* pPageView = rPrintView.GetSdrPageView();
+ OSL_ASSERT(pPageView!=NULL);
+ pPageView->SetVisibleLayers(rVisibleLayers);
+ pPageView->SetPrintableLayers(rPrintableLayers);
+
+ if (pView!=NULL && bPrintMarkedOnly)
+ pView->DrawMarkedObj(rPrinter);
+ else
+ rPrintView.CompleteRedraw(&rPrinter, Rectangle(Point(0,0), rPage.GetSize()));
+
+ rPrinter.SetMapMode(aOriginalMapMode);
+
+ rPrintView.HideSdrPage();
+ }
+
+
+
+
+ /** Output a string (that typically is not part of a document page) to
+ the given printer.
+ */
+ void PrintMessage (
+ Printer& rPrinter,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset)
+ {
+ const Font aOriginalFont (rPrinter.OutputDevice::GetFont());
+ rPrinter.SetFont(Font(FAMILY_SWISS, Size(0, 423)));
+ rPrinter.DrawText(rPageStringOffset, rsPageString);
+ rPrinter.SetFont(aOriginalFont);
+ }
+
+
+
+
+ /** Read the resource file and process it into a sequence of properties
+ that can be passed to the printing dialog.
+ */
+ class DialogCreator : Resource
+ {
+ public:
+ DialogCreator (bool bImpress)
+ : Resource(SdResId(_STR_IMPRESS_PRINT_UI_OPTIONS))
+ , mbImpress(bImpress)
+ {
+ ProcessResource();
+ }
+
+ Sequence< beans::PropertyValue > GetDialogControls(void) const
+ {
+ if (maProperties.empty())
+ return Sequence< beans::PropertyValue >();
+ else
+ {
+ return Sequence<beans::PropertyValue>(
+ &maProperties.front(),
+ maProperties.size());
+ }
+ }
+
+ ::std::vector<sal_Int32> GetSlidesPerPage (void) const
+ {
+ return maSlidesPerPage;
+ }
+
+ private:
+ Any maDialog;
+ ::std::vector<beans::PropertyValue> maProperties;
+ ::std::vector<sal_Int32> maSlidesPerPage;
+ bool mbImpress;
+
+ void ProcessResource (void)
+ {
+ SvtModuleOptions aOpt;
+ String aAppGroupname( String( SdResId( _STR_IMPRESS_PRINT_UI_GROUP_NAME ) ) );
+ aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
+ aOpt.GetModuleName( mbImpress ? SvtModuleOptions::E_SIMPRESS : SvtModuleOptions::E_SDRAW ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getGroupControlOpt(
+ aAppGroupname,
+ rtl::OUString()
+ ) );
+
+ if( mbImpress )
+ {
+ vcl::PrinterOptionsHelper::UIControlOptions aPrintOpt;
+ aPrintOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PRINT_GROUP) ),
+ rtl::OUString(),
+ aPrintOpt )
+ );
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_CONTENT ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_CONTENT_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PageContentType" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_CONTENT_CHOICES),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) )
+ )
+ );
+
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aContentOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageContentType" ) ), 1 );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "SlidesPerPage" ) ),
+ GetSlidesPerPageSequence(),
+ 4,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ aContentOpt
+ )
+ );
+
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aSlidesPerPageOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "SlidesPerPage" ) ), -1, sal_True );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_ORDER ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_ORDER_CHOICES_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "SlidesPerPageOrder" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_ORDER_CHOICES),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ aSlidesPerPageOpt )
+ );
+ }
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_INCLUDE_CONTENT) ), rtl::OUString() ) );
+
+
+ if( mbImpress )
+ {
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_NAME) ),
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_NAME_HELP) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintName" ) ),
+ sal_False
+ )
+ );
+ }
+ else
+ {
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_DRAW_PRINT_UI_IS_PRINT_NAME) ),
+ String( SdResId(_STR_DRAW_PRINT_UI_IS_PRINT_NAME_HELP) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintName" ) ),
+ sal_False
+ )
+ );
+ }
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_DATE) ),
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_DATE_HELP) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintDateTime" ) ),
+ sal_False
+ )
+ );
+
+ if( mbImpress )
+ {
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN) ),
+ String( SdResId(_STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN_HELP) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "IsPrintHidden" ) ),
+ sal_False
+ )
+ );
+ }
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_QUALITY) ), rtl::OUString() ) );
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ rtl::OUString(),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_QUALITY_CHOICES_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Quality" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_QUALITY_CHOICES),
+ 0
+ )
+ );
+
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS) ), rtl::OUString() ) );
+
+ if( mbImpress )
+ {
+ // FIXME: additional dependency on PrintProspect = false
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aPageOptionsOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PageContentType" ) ), 0 );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ rtl::OUString(),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOptions" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
+ aPageOptionsOpt
+ )
+ );
+ }
+ else
+ {
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aPageOptionsOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), sal_False );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ rtl::OUString(),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PageOptions" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "Radio" ) ),
+ aPageOptionsOpt
+ )
+ );
+ }
+
+ vcl::PrinterOptionsHelper::UIControlOptions aBrochureOpt;
+ aBrochureOpt.maGroupHint = OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAGE_SIDES) ), rtl::OUString(),
+ aBrochureOpt ) );
+
+ // brochure printing
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_BROCHURE) ),
+ String( SdResId(_STR_IMPRESS_PRINT_UI_BROCHURE_HELP) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ),
+ sal_False,
+ aBrochureOpt
+ )
+ );
+
+ vcl::PrinterOptionsHelper::UIControlOptions
+ aIncludeOpt( OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), -1, sal_False );
+ aIncludeOpt.maGroupHint = OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST_HELP),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectInclude" ) ),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST),
+ 0,
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ aIncludeOpt
+ )
+ );
+
+ // paper tray (on options page)
+ vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
+ aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getBoolControlOpt(
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAPER_TRAY) ),
+ String( SdResId(_STR_IMPRESS_PRINT_UI_PAPER_TRAY_HELP) ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ),
+ sal_False,
+ aPaperTrayOpt
+ )
+ );
+ // print range selection
+ vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
+ aPrintRangeOpt.mbInternalOnly = sal_True;
+ aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getSubgroupControlOpt(
+ String( SdResId( _STR_IMPRESS_PRINT_UI_PAGE_RANGE ) ),
+ rtl::OUString(),
+ aPrintRangeOpt )
+ );
+
+ // create a choice for the content to create
+ rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
+ AddDialogControl( vcl::PrinterOptionsHelper::getChoiceControlOpt( rtl::OUString(),
+ CreateChoice(_STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE_HELP),
+ aPrintRangeName,
+ CreateChoice(mbImpress
+ ? _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE
+ : _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE),
+ 0 )
+ );
+ // create a an Edit dependent on "Pages" selected
+ vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True );
+ AddDialogControl( vcl::PrinterOptionsHelper::getEditControlOpt( rtl::OUString(),
+ rtl::OUString(),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ),
+ rtl::OUString(),
+ aPageRangeOpt )
+ );
+
+ FreeResource();
+ }
+
+ void AddDialogControl( const Any& i_rCtrl )
+ {
+ beans::PropertyValue aVal;
+ aVal.Value = i_rCtrl;
+ maProperties.push_back( aVal );
+ }
+
+ Sequence<rtl::OUString> CreateChoice (const USHORT nResourceId) const
+ {
+ SdResId aResourceId (nResourceId);
+ ResStringArray aChoiceStrings (aResourceId);
+
+ const sal_uInt32 nCount (aChoiceStrings.Count());
+ Sequence<rtl::OUString> aChoices (nCount);
+ for (sal_uInt32 nIndex=0; nIndex<nCount; ++nIndex)
+ aChoices[nIndex] = aChoiceStrings.GetString(nIndex);
+
+ return aChoices;
+ }
+
+ Sequence<rtl::OUString> GetSlidesPerPageSequence (void)
+ {
+ const Sequence<rtl::OUString> aChoice (
+ CreateChoice(_STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES));
+ maSlidesPerPage.clear();
+ for (sal_Int32 nIndex=0,nCount=aChoice.getLength(); nIndex<nCount; ++nIndex)
+ maSlidesPerPage.push_back(aChoice[nIndex].toInt32());
+ return aChoice;
+ }
+ };
+
+
+
+
+ /** The Prepare... methods of the DocumentRenderer::Implementation class
+ create a set of PrinterPage objects that contain all necessary
+ information to do the actual printing. There is one PrinterPage
+ object per printed page. Derived classes implement the actual, mode
+ specific printing.
+
+ This and all derived classes support the asynchronous printing
+ process by not storing pointers to any data with lifetime shorter
+ than the PrinterPage objects, i.e. slides, shapes, (one of) the
+ outliner (of the document).
+ */
+ class PrinterPage
+ {
+ public:
+ PrinterPage (
+ const PageKind ePageKind,
+ const MapMode& rMapMode,
+ const bool bPrintMarkedOnly,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const ULONG nDrawMode,
+ const Orientation eOrientation,
+ const USHORT nPaperTray)
+ : mePageKind(ePageKind),
+ maMap(rMapMode),
+ mbPrintMarkedOnly(bPrintMarkedOnly),
+ msPageString(rsPageString),
+ maPageStringOffset(rPageStringOffset),
+ mnDrawMode(nDrawMode),
+ meOrientation(eOrientation),
+ mnPaperTray(nPaperTray)
+ {
+ }
+
+ virtual ~PrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const = 0;
+
+ ULONG GetDrawMode (void) const { return mnDrawMode; }
+ Orientation GetOrientation (void) const { return meOrientation; }
+ USHORT GetPaperTray (void) const { return mnPaperTray; }
+
+ protected:
+ const PageKind mePageKind;
+ const MapMode maMap;
+ const bool mbPrintMarkedOnly;
+ const ::rtl::OUString msPageString;
+ const Point maPageStringOffset;
+ const ULONG mnDrawMode;
+ const Orientation meOrientation;
+ const USHORT mnPaperTray;
+ };
+
+
+
+
+ /** The RegularPrinterPage is used for printing one regular slide (no
+ notes, handout, or outline) to one printer page.
+ */
+ class RegularPrinterPage : public PrinterPage
+ {
+ public:
+ RegularPrinterPage (
+ const USHORT nPageIndex,
+ const PageKind ePageKind,
+ const MapMode& rMapMode,
+ const bool bPrintMarkedOnly,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const ULONG nDrawMode,
+ const Orientation eOrientation,
+ const USHORT nPaperTray)
+ : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mnPageIndex(nPageIndex)
+ {
+ }
+
+ virtual ~RegularPrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ SdPage* pPageToPrint = rDocument.GetSdPage(mnPageIndex, mePageKind);
+ rPrinter.SetMapMode(maMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+ }
+
+ private:
+ const USHORT mnPageIndex;
+ };
+
+
+
+
+ /** Print one slide multiple times on a printer page so that the whole
+ printer page is covered.
+ */
+ class TiledPrinterPage : public PrinterPage
+ {
+ public:
+ TiledPrinterPage (
+ const USHORT nPageIndex,
+ const PageKind ePageKind,
+ const sal_Int32 nGap,
+ const bool bPrintMarkedOnly,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const ULONG nDrawMode,
+ const Orientation eOrientation,
+ const USHORT nPaperTray)
+ : PrinterPage(ePageKind, MapMode(), bPrintMarkedOnly, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mnPageIndex(nPageIndex),
+ mnGap(nGap)
+ {
+ }
+
+ virtual ~TiledPrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ SdPage* pPageToPrint = rDocument.GetSdPage(mnPageIndex, mePageKind);
+ if (pPageToPrint==NULL)
+ return;
+ MapMode aMap (rPrinter.GetMapMode());
+
+ const Size aPageSize (pPageToPrint->GetSize());
+ const Size aPrintSize (rPrinter.GetOutputSize());
+
+ const sal_Int32 nPageWidth (aPageSize.Width() + mnGap
+ - pPageToPrint->GetLftBorder() - pPageToPrint->GetRgtBorder());
+ const sal_Int32 nPageHeight (aPageSize.Height() + mnGap
+ - pPageToPrint->GetUppBorder() - pPageToPrint->GetLwrBorder());
+ if (nPageWidth<=0 || nPageHeight<=0)
+ return;
+
+ // Print at least two rows and columns. More if the document
+ // page fits completely onto the printer page.
+ const sal_Int32 nColumnCount (::std::max(sal_Int32(2),
+ sal_Int32(aPrintSize.Width() / nPageWidth)));
+ const sal_Int32 nRowCount (::std::max(sal_Int32(2),
+ sal_Int32(aPrintSize.Height() / nPageHeight)));
+ Point aPrintOrigin;
+ for (sal_Int32 nRow=0; nRow<nRowCount; ++nRow)
+ for (sal_Int32 nColumn=0; nColumn<nColumnCount; ++nColumn)
+ {
+ aMap.SetOrigin(Point(nColumn*nPageWidth,nRow*nPageHeight));
+ rPrinter.SetMapMode(aMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ }
+
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+ }
+
+ private:
+ const USHORT mnPageIndex;
+ const sal_Int32 mnGap;
+ };
+
+ /** Print two slides to one printer page so that the resulting pages
+ form a booklet.
+ */
+ class BookletPrinterPage : public PrinterPage
+ {
+ public:
+ BookletPrinterPage (
+ const USHORT nFirstPageIndex,
+ const USHORT nSecondPageIndex,
+ const Point& rFirstOffset,
+ const Point& rSecondOffset,
+ const PageKind ePageKind,
+ const MapMode& rMapMode,
+ const bool bPrintMarkedOnly,
+ const ULONG nDrawMode,
+ const Orientation eOrientation,
+ const USHORT nPaperTray)
+ : PrinterPage(ePageKind, rMapMode, bPrintMarkedOnly, ::rtl::OUString(),
+ Point(), nDrawMode, eOrientation, nPaperTray),
+ mnFirstPageIndex(nFirstPageIndex),
+ mnSecondPageIndex(nSecondPageIndex),
+ maFirstOffset(rFirstOffset),
+ maSecondOffset(rSecondOffset)
+ {
+ }
+
+ virtual ~BookletPrinterPage (void) {}
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ MapMode aMap (maMap);
+ SdPage* pPageToPrint = rDocument.GetSdPage(mnFirstPageIndex, mePageKind);
+ if (pPageToPrint)
+ {
+ aMap.SetOrigin(maFirstOffset);
+ rPrinter.SetMapMode(aMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ }
+
+ pPageToPrint = rDocument.GetSdPage(mnSecondPageIndex, mePageKind);
+ if( pPageToPrint )
+ {
+ aMap.SetOrigin(maSecondOffset);
+ rPrinter.SetMapMode(aMap);
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ *pPageToPrint,
+ pView,
+ mbPrintMarkedOnly,
+ rVisibleLayers,
+ rPrintableLayers);
+ }
+ }
+
+ private:
+ const USHORT mnFirstPageIndex;
+ const USHORT mnSecondPageIndex;
+ const Point maFirstOffset;
+ const Point maSecondOffset;
+ };
+
+
+
+
+ /** One handout page displays one to nine slides.
+ */
+ class HandoutPrinterPage : public PrinterPage
+ {
+ public:
+ HandoutPrinterPage (
+ const USHORT nHandoutPageIndex,
+ const ::std::vector<USHORT>& rPageIndices,
+ const MapMode& rMapMode,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const ULONG nDrawMode,
+ const Orientation eOrientation,
+ const USHORT nPaperTray)
+ : PrinterPage(PK_HANDOUT, rMapMode, false, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mnHandoutPageIndex(nHandoutPageIndex),
+ maPageIndices(rPageIndices)
+ {
+ }
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ SdPage& rHandoutPage (*rDocument.GetSdPage(0, PK_HANDOUT));
+
+ // Collect the page objects of the handout master.
+ std::vector<SdrPageObj*> aHandoutPageObjects;
+ SdrObjListIter aShapeIter (rHandoutPage);
+ while (aShapeIter.IsMore())
+ {
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
+ if (pPageObj)
+ aHandoutPageObjects.push_back(pPageObj);
+ }
+ if (aHandoutPageObjects.empty())
+ return;
+
+ // Connect page objects with pages.
+ std::vector<SdrPageObj*>::iterator aPageObjIter (aHandoutPageObjects.begin());
+ for (std::vector<USHORT>::const_iterator
+ iPageIndex(maPageIndices.begin()),
+ iEnd(maPageIndices.end());
+ iPageIndex!=iEnd && aPageObjIter!=aHandoutPageObjects.end();
+ ++iPageIndex)
+ {
+ // Check if the page still exists.
+ if (*iPageIndex >= rDocument.GetSdPageCount(PK_STANDARD))
+ continue;
+
+ SdrPageObj* pPageObj = (*aPageObjIter++);
+ pPageObj->SetReferencedPage(rDocument.GetSdPage(*iPageIndex, PK_STANDARD));
+ }
+
+ // if there are more page objects than pages left, set the rest to invisible
+ int nHangoverCount = 0;
+ while (aPageObjIter != aHandoutPageObjects.end())
+ {
+ (*aPageObjIter++)->SetReferencedPage(0L);
+ nHangoverCount++;
+ }
+
+ // Hide outlines for objects that have pages attached.
+ if (nHangoverCount > 0)
+ {
+ int nSkip = aHandoutPageObjects.size() - nHangoverCount;
+ aShapeIter.Reset();
+ while (aShapeIter.IsMore())
+ {
+ SdrPathObj* pPathObj = dynamic_cast<SdrPathObj*>(aShapeIter.Next());
+ if (pPathObj)
+ {
+ if (nSkip > 0)
+ --nSkip;
+ else
+ pPathObj->SetMergedItem(XLineStyleItem(XLINE_NONE));
+ }
+ }
+ }
+
+ rViewShell.SetPrintedHandoutPageNum(mnHandoutPageIndex + 1);
+ MapMode aMap (rPrinter.GetMapMode());
+ rPrinter.SetMapMode(maMap);
+
+ PrintPage(
+ rPrinter,
+ rPrintView,
+ rHandoutPage,
+ pView,
+ false,
+ rVisibleLayers,
+ rPrintableLayers);
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+
+ rViewShell.SetPrintedHandoutPageNum(1);
+
+ // Restore outlines.
+ if (nHangoverCount > 0)
+ {
+ aShapeIter.Reset();
+ while (aShapeIter.IsMore())
+ {
+ SdrPathObj* pPathObj = dynamic_cast<SdrPathObj*>(aShapeIter.Next());
+ if (pPathObj != NULL)
+ pPathObj->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ }
+ }
+ }
+
+ private:
+ const USHORT mnHandoutPageIndex;
+ const ::std::vector<USHORT> maPageIndices;
+ };
+
+
+
+
+ /** The outline information (title, subtitle, outline objects) of the
+ document. There is no fixed mapping of slides to printer pages.
+ */
+ class OutlinerPrinterPage : public PrinterPage
+ {
+ public:
+ OutlinerPrinterPage (
+ OutlinerParaObject* pParaObject,
+ const MapMode& rMapMode,
+ const ::rtl::OUString& rsPageString,
+ const Point& rPageStringOffset,
+ const ULONG nDrawMode,
+ const Orientation eOrientation,
+ const USHORT nPaperTray)
+ : PrinterPage(PK_HANDOUT, rMapMode, false, rsPageString,
+ rPageStringOffset, nDrawMode, eOrientation, nPaperTray),
+ mpParaObject(pParaObject)
+ {
+ }
+
+ ~OutlinerPrinterPage (void)
+ {
+ mpParaObject.reset();
+ }
+
+ virtual void Print (
+ Printer& rPrinter,
+ SdDrawDocument& rDocument,
+ ViewShell& rViewShell,
+ View* pView,
+ DrawView& rPrintView,
+ const SetOfByte& rVisibleLayers,
+ const SetOfByte& rPrintableLayers) const
+ {
+ (void)rViewShell;
+ (void)pView;
+ (void)rPrintView;
+ (void)rVisibleLayers;
+ (void)rPrintableLayers;
+
+ // Set up the printer.
+ rPrinter.SetMapMode(maMap);
+
+ // Get and set up the outliner.
+ const Rectangle aOutRect (rPrinter.GetPageOffset(), rPrinter.GetOutputSize());
+ Outliner* pOutliner = rDocument.GetInternalOutliner();
+ const USHORT nSavedOutlMode (pOutliner->GetMode());
+ const BOOL bSavedUpdateMode (pOutliner->GetUpdateMode());
+ const Size aSavedPaperSize (pOutliner->GetPaperSize());
+
+ pOutliner->Init(OUTLINERMODE_OUTLINEVIEW);
+ pOutliner->SetPaperSize(aOutRect.GetSize());
+ pOutliner->SetUpdateMode(TRUE);
+ pOutliner->Clear();
+ pOutliner->SetText(*mpParaObject);
+
+ pOutliner->Draw(&rPrinter, aOutRect);
+
+ PrintMessage(
+ rPrinter,
+ msPageString,
+ maPageStringOffset);
+
+ // Restore outliner and printer.
+ pOutliner->Clear();
+ pOutliner->SetUpdateMode(bSavedUpdateMode);
+ pOutliner->SetPaperSize(aSavedPaperSize);
+ pOutliner->Init(nSavedOutlMode);
+ }
+
+ private:
+ ::boost::scoped_ptr<OutlinerParaObject> mpParaObject;
+ };
+}
+
+
+//===== DocumentRenderer::Implementation ======================================
+
+class DocumentRenderer::Implementation
+ : public SfxListener,
+ public vcl::PrinterOptionsHelper
+{
+public:
+ Implementation (ViewShellBase& rBase)
+ : mrBase(rBase),
+ mbIsDisposed(false),
+ mpPrinter(NULL),
+ mpOptions(),
+ maPrinterPages(),
+ mpPrintView(),
+ mbHasOrientationWarningBeenShown(false)
+ {
+ DialogCreator aCreator( mrBase.GetDocShell()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS );
+ m_aUIProperties = aCreator.GetDialogControls();
+ maSlidesPerPage = aCreator.GetSlidesPerPage();
+
+ StartListening(mrBase);
+ }
+
+
+
+
+ virtual ~Implementation (void)
+ {
+ EndListening(mrBase);
+ }
+
+
+
+
+ virtual void Notify (SfxBroadcaster& rBroadcaster, const SfxHint& rHint)
+ {
+ const SfxSimpleHint* pSimpleHint = dynamic_cast<const SfxSimpleHint*>(&rHint);
+ if (pSimpleHint != NULL
+ && pSimpleHint->GetId() == SFX_HINT_DYING
+ && &rBroadcaster == &static_cast<SfxBroadcaster&>(mrBase))
+ {
+ Dispose();
+ }
+ }
+
+
+
+ /** Process the sequence of properties given to one of the XRenderable
+ methods.
+ */
+ void ProcessProperties (const css::uno::Sequence<css::beans::PropertyValue >& rOptions)
+ {
+ OSL_ASSERT(!mbIsDisposed);
+ if (mbIsDisposed)
+ return;
+
+ bool bIsValueChanged = processProperties( rOptions );
+
+ // The RenderDevice property is handled specially: its value is
+ // stored in mpPrinter instead of being retrieved on demand.
+ Any aDev( getValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
+ Reference<awt::XDevice> xRenderDevice;
+
+ if (aDev >>= xRenderDevice)
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice);
+ OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
+ mpPrinter = dynamic_cast<Printer*>(pOut);
+ }
+
+ if (bIsValueChanged)
+ {
+ if ( ! mpOptions )
+ mpOptions.reset(new PrintOptions(*this, maSlidesPerPage));
+ PreparePages();
+ }
+ }
+
+
+
+ /** Return the number of pages that are to be printed.
+ */
+ sal_Int32 GetPrintPageCount (void)
+ {
+ OSL_ASSERT(!mbIsDisposed);
+ if (mbIsDisposed)
+ return 0;
+ else
+ return maPrinterPages.size();
+ }
+
+
+
+ /** Return a sequence of properties that can be returned by the
+ XRenderable::getRenderer() method.
+ */
+ css::uno::Sequence<css::beans::PropertyValue> GetProperties (
+ const css::uno::Sequence<css::beans::PropertyValue>& rOptions)
+ {
+ (void)rOptions;
+
+ css::uno::Sequence<css::beans::PropertyValue> aProperties (3);
+
+ aProperties[0].Name = A2S("ExtraPrintUIOptions");
+ aProperties[0].Value <<= m_aUIProperties;
+
+ aProperties[1].Name = A2S("PageSize");
+ aProperties[1].Value <<= maPrintSize;
+
+ // FIXME: is this always true ?
+ aProperties[2].Name = A2S("PageIncludesNonprintableArea");
+ aProperties[2].Value = makeAny( sal_True );
+
+ return aProperties;
+ }
+
+
+
+
+ /** Print one of the prepared pages.
+ */
+ void PrintPage (const sal_Int32 nIndex)
+ {
+ OSL_ASSERT(!mbIsDisposed);
+ if (mbIsDisposed)
+ return;
+
+ Printer& rPrinter (*mpPrinter);
+
+ ::boost::shared_ptr<ViewShell> pViewShell (mrBase.GetMainViewShell());
+ if ( ! pViewShell)
+ return;
+
+ SdDrawDocument* pDocument = pViewShell->GetDoc();
+ OSL_ASSERT(pDocument!=NULL);
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell(
+ ::boost::dynamic_pointer_cast<DrawViewShell>(mrBase.GetMainViewShell()));
+
+ if ( ! mpPrintView)
+ mpPrintView.reset(new DrawView(mrBase.GetDocShell(), &rPrinter, pDrawViewShell.get()));
+
+ if (nIndex<0 || sal::static_int_cast<sal_uInt32>(nIndex)>=maPrinterPages.size())
+ return;
+
+ const ::boost::shared_ptr<PrinterPage> pPage (maPrinterPages[nIndex]);
+ OSL_ASSERT(pPage);
+ if ( ! pPage)
+ return;
+
+ const Orientation eSavedOrientation (rPrinter.GetOrientation());
+ const ULONG nSavedDrawMode (rPrinter.GetDrawMode());
+ const MapMode aSavedMapMode (rPrinter.GetMapMode());
+ const USHORT nSavedPaperBin (rPrinter.GetPaperBin());
+
+
+ // Set page orientation.
+ if ( ! rPrinter.SetOrientation(pPage->GetOrientation()))
+ {
+ if ( ! mbHasOrientationWarningBeenShown
+ && mpOptions->IsWarningOrientation())
+ {
+ mbHasOrientationWarningBeenShown = true;
+ // Show warning that the orientation could not be set.
+ if (pViewShell)
+ {
+ WarningBox aWarnBox(
+ pViewShell->GetActiveWindow(),
+ (WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL),
+ String(SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
+ if (aWarnBox.Execute() != RET_OK)
+ return;
+ }
+ }
+ }
+
+ // Set the draw mode.
+ rPrinter.SetDrawMode(pPage->GetDrawMode());
+
+ // Set paper tray.
+ rPrinter.SetPaperBin(pPage->GetPaperTray());
+
+ // Print the actual page.
+ pPage->Print(
+ rPrinter,
+ *pDocument,
+ *pViewShell,
+ pDrawViewShell ? pDrawViewShell->GetView() : NULL,
+ *mpPrintView,
+ pViewShell->GetFrameView()->GetVisibleLayers(),
+ pViewShell->GetFrameView()->GetPrintableLayers());
+
+ rPrinter.SetOrientation(eSavedOrientation);
+ rPrinter.SetDrawMode(nSavedDrawMode);
+ rPrinter.SetMapMode(aSavedMapMode);
+ rPrinter.SetPaperBin(nSavedPaperBin);
+ }
+
+
+
+
+private:
+ ViewShellBase& mrBase;
+ bool mbIsDisposed;
+ Printer* mpPrinter;
+ ::boost::scoped_ptr<PrintOptions> mpOptions;
+ ::std::vector< ::boost::shared_ptr< ::sd::PrinterPage> > maPrinterPages;
+ ::boost::scoped_ptr<DrawView> mpPrintView;
+ bool mbHasOrientationWarningBeenShown;
+ ::std::vector<sal_Int32> maSlidesPerPage;
+ awt::Size maPrintSize;
+
+ void Dispose (void)
+ {
+ mbIsDisposed = true;
+ }
+
+
+
+ /** Determine and set the paper orientation.
+ */
+ bool SetupPaperOrientation (
+ const PageKind ePageKind,
+ PrintInfo& rInfo)
+ {
+ SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();
+ rInfo.meOrientation = ORIENTATION_PORTRAIT;
+
+ if( ! mpOptions->IsBooklet())
+ {
+ rInfo.meOrientation = pDocument->GetSdPage(0, ePageKind)->GetOrientation();
+ }
+ else if (rInfo.maPageSize.Width() < rInfo.maPageSize.Height())
+ rInfo.meOrientation = ORIENTATION_LANDSCAPE;
+
+ const Size aPaperSize (rInfo.mpPrinter->GetPaperSize());
+ if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE &&
+ (aPaperSize.Width() < aPaperSize.Height()))
+ ||
+ (rInfo.meOrientation == ORIENTATION_PORTRAIT &&
+ (aPaperSize.Width() > aPaperSize.Height()))
+ )
+ {
+ maPrintSize = awt::Size(aPaperSize.Height(), aPaperSize.Width());
+ // rInfo.maPrintSize = Size(rInfo.maPrintSize.Height(), rInfo.maPrintSize.Width());
+ }
+ else
+ {
+ maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height());
+ }
+
+ return true;
+ }
+
+
+
+ /** Top most method for preparing printer pages. In this and the other
+ Prepare... methods the various special cases are detected and
+ handled.
+ For every page that is to be printed (that may contain several
+ slides) one PrinterPage object is created and inserted into
+ maPrinterPages.
+ */
+ void PreparePages (void)
+ {
+ mpPrintView.reset();
+ maPrinterPages.clear();
+ mbHasOrientationWarningBeenShown = false;
+
+ ViewShell* pShell = mrBase.GetMainViewShell().get();
+
+ PrintInfo aInfo (mpPrinter, mpOptions->GetPrinterSelection(), mrBase.GetMainViewShell());
+
+ if (aInfo.mpPrinter!=NULL && pShell!=NULL)
+ {
+
+ MapMode aMap (aInfo.mpPrinter->GetMapMode());
+ aMap.SetMapUnit(MAP_100TH_MM);
+ aInfo.maMap = aMap;
+ mpPrinter->SetMapMode(aMap);
+
+ ::Outliner& rOutliner = mrBase.GetDocument()->GetDrawOutliner();
+ const ULONG nSavedControlWord (rOutliner.GetControlWord());
+ ULONG nCntrl = nSavedControlWord;
+ nCntrl &= ~EE_CNTRL_MARKFIELDS;
+ nCntrl &= ~EE_CNTRL_ONLINESPELLING;
+ rOutliner.SetControlWord( nCntrl );
+
+ // When in outline view then apply all pending changes to the model.
+ if (pShell->ISA(OutlineViewShell))
+ static_cast<OutlineViewShell*>(pShell)->PrepareClose (FALSE, FALSE);
+
+ // Collect some frequently used data.
+ if (mpOptions->IsDate())
+ {
+ aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getDate( Date() );
+ aInfo.msTimeDate += ::rtl::OUString((sal_Unicode)' ');
+ }
+
+ if (mpOptions->IsTime())
+ aInfo.msTimeDate += GetSdrGlobalData().GetLocaleData()->getTime( Time(), FALSE, FALSE );
+ aInfo.maPrintSize = aInfo.mpPrinter->GetOutputSize();
+ maPrintSize = awt::Size(
+ aInfo.mpPrinter->GetPaperSize().Width(),
+ aInfo.mpPrinter->GetPaperSize().Height());
+
+ switch (mpOptions->GetOutputQuality())
+ {
+ case 1:
+ aInfo.mnDrawMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL
+ | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP
+ | DRAWMODE_GRAYGRADIENT;
+ break;
+
+ case 2:
+ aInfo.mnDrawMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT
+ | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP
+ | DRAWMODE_WHITEGRADIENT;
+ break;
+
+ default:
+ aInfo.mnDrawMode = DRAWMODE_DEFAULT;
+ }
+
+ // check if selected range of pages contains transparent objects
+ /*
+ const bool bPrintPages (bPrintNotes || bPrintDraw || bPrintHandout);
+ const bool bContainsTransparency (bPrintPages && ContainsTransparency());
+ if (pPrinter->InitJob (mrBase.GetWindow(), !bIsAPI && bContainsTransparency))
+ */
+
+ if (mpOptions->IsDraw())
+ PrepareStdOrNotes(PK_STANDARD, aInfo);
+ if (mpOptions->IsNotes())
+ PrepareStdOrNotes(PK_NOTES, aInfo);
+ if (mpOptions->IsHandout())
+ {
+ InitHandoutTemplate();
+ PrepareHandout(aInfo);
+ }
+ if (mpOptions->IsOutline())
+ PrepareOutline(aInfo);
+
+ rOutliner.SetControlWord(nSavedControlWord);
+ }
+ }
+
+
+
+
+ /** Create the page objects of the handout template. When the actual
+ printing takes place then the page objects are assigned different
+ sets of slides for each printed page (see HandoutPrinterPage::Print).
+ */
+ void InitHandoutTemplate (void)
+ {
+ const sal_Int32 nSlidesPerHandout (mpOptions->GetHandoutPageCount());
+ const bool bHandoutHorizontal (mpOptions->IsHandoutHorizontal());
+
+ AutoLayout eLayout = AUTOLAYOUT_HANDOUT6;
+ switch (nSlidesPerHandout)
+ {
+ case 1: eLayout = AUTOLAYOUT_HANDOUT1; break;
+ case 2: eLayout = AUTOLAYOUT_HANDOUT2; break;
+ case 3: eLayout = AUTOLAYOUT_HANDOUT3; break;
+ case 4: eLayout = AUTOLAYOUT_HANDOUT4; break;
+ default:
+ case 6: eLayout = AUTOLAYOUT_HANDOUT6; break;
+ case 9: eLayout = AUTOLAYOUT_HANDOUT9; break;
+ }
+
+ if( !mrBase.GetDocument() )
+ return;
+
+ SdDrawDocument& rModel = *mrBase.GetDocument();
+
+ // first, prepare handout page (not handout master)
+
+ SdPage* pHandout = rModel.GetSdPage(0, PK_HANDOUT);
+ if( !pHandout )
+ return;
+
+ // delete all previous shapes from handout page
+ while( pHandout->GetObjCount() )
+ {
+ SdrObject* pObj = pHandout->NbcRemoveObject(0);
+ if( pObj )
+ SdrObject::Free( pObj );
+ }
+
+ const bool bDrawLines (eLayout == AUTOLAYOUT_HANDOUT3);
+
+ std::vector< Rectangle > aAreas;
+ SdPage::CalculateHandoutAreas( rModel, eLayout, bHandoutHorizontal, aAreas );
+
+ std::vector< Rectangle >::iterator iter( aAreas.begin() );
+ while( iter != aAreas.end() )
+ {
+ pHandout->NbcInsertObject( new SdrPageObj((*iter++)) );
+
+ if( bDrawLines && (iter != aAreas.end()) )
+ {
+ Rectangle aRect( (*iter++) );
+
+ basegfx::B2DPolygon aPoly;
+ aPoly.insert(0, basegfx::B2DPoint( aRect.Left(), aRect.Top() ) );
+ aPoly.insert(1, basegfx::B2DPoint( aRect.Right(), aRect.Top() ) );
+
+ basegfx::B2DHomMatrix aMatrix;
+ aMatrix.translate( 0.0, static_cast< double >( aRect.GetHeight() / 7 ) );
+
+ basegfx::B2DPolyPolygon aPathPoly;
+ for( sal_uInt16 nLine = 0; nLine < 7; nLine++ )
+ {
+ aPoly.transform( aMatrix );
+ aPathPoly.append( aPoly );
+ }
+
+ SdrPathObj* pPathObj = new SdrPathObj(OBJ_PATHLINE, aPathPoly );
+ pPathObj->SetMergedItem(XLineStyleItem(XLINE_SOLID));
+ pPathObj->SetMergedItem(XLineColorItem(String(), Color(COL_BLACK)));
+
+ pHandout->NbcInsertObject( pPathObj );
+ }
+ }
+ }
+
+
+
+
+ /** Detect whether any of the slides that are to be printed contains
+ partially transparent or translucent shapes.
+ */
+ bool ContainsTransparency (const PrintInfo& rInfo) const
+ {
+ // const bool bPrintExcluded (mpOptions->IsPrintExcluded());
+ bool bContainsTransparency = false;
+
+ for (USHORT
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ nIndex < nCount && !bContainsTransparency;
+ ++nIndex)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, PK_STANDARD, rInfo);
+ if (pPage == NULL)
+ continue;
+
+ bContainsTransparency = pPage->HasTransparentObjects();
+ if ( ! bContainsTransparency && pPage->TRG_HasMasterPage())
+ bContainsTransparency = pPage->TRG_GetMasterPage().HasTransparentObjects();
+ }
+
+ return bContainsTransparency;
+ }
+
+
+
+
+ /** Detect whether the specified slide is to be printed.
+ @return
+ When the slide is not to be printed then <NULL/> is returned.
+ Otherwise a pointer to the slide is returned.
+ */
+ SdPage* GetFilteredPage (
+ const sal_Int32 nPageIndex,
+ const PageKind ePageKind,
+ const PrintInfo& rInfo) const
+ {
+ OSL_ASSERT(mrBase.GetDocument() != NULL);
+ OSL_ASSERT(nPageIndex>=0);
+ if ( ! rInfo.maSelection.IsSelected(nPageIndex))
+ return NULL;
+ SdPage* pPage = mrBase.GetDocument()->GetSdPage(
+ sal::static_int_cast<USHORT>(nPageIndex),
+ ePageKind);
+ if (pPage == NULL)
+ return NULL;
+ if ( ! pPage->IsExcluded() || mpOptions->IsPrintExcluded())
+ return pPage;
+ else
+ return NULL;
+ }
+
+
+
+
+ /** Prepare the outline of the document for printing. There is no fixed
+ number of slides whose outline data is put onto one printer page.
+ If the current printer page has enough room for the outline of the
+ current slide then that is added. Otherwise a new printer page is
+ started.
+ */
+ void PrepareOutline (PrintInfo& rInfo)
+ {
+ MapMode aMap (rInfo.maMap);
+ Point aPageOfs (rInfo.mpPrinter->GetPageOffset() );
+ // aMap.SetOrigin(Point() - aPageOfs);
+ aMap.SetScaleX(Fraction(1,2));
+ aMap.SetScaleY(Fraction(1,2));
+ mpPrinter->SetMapMode(aMap);
+
+ Rectangle aOutRect(aPageOfs, rInfo.mpPrinter->GetOutputSize());
+ if( aOutRect.GetWidth() > aOutRect.GetHeight() )
+ {
+ Size aPaperSize( rInfo.mpPrinter->PixelToLogic( rInfo.mpPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
+ maPrintSize.Width = aPaperSize.Height();
+ maPrintSize.Height = aPaperSize.Width();
+ aOutRect = Rectangle( Point( aPageOfs.Y(), aPageOfs.X() ),
+ Size( aOutRect.GetHeight(), aOutRect.GetWidth() ) );
+ }
+
+ Link aOldLink;
+ Outliner* pOutliner = mrBase.GetDocument()->GetInternalOutliner();
+ pOutliner->Init(OUTLINERMODE_OUTLINEVIEW);
+ const USHORT nSavedOutlMode (pOutliner->GetMode());
+ const BOOL bSavedUpdateMode (pOutliner->GetUpdateMode());
+ const Size aSavedPaperSize (pOutliner->GetPaperSize());
+ const MapMode aSavedMapMode (pOutliner->GetRefMapMode());
+ pOutliner->SetPaperSize(aOutRect.GetSize());
+ pOutliner->SetUpdateMode(TRUE);
+
+ long nPageH = aOutRect.GetHeight();
+
+ for (USHORT
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ nIndex < nCount;
+ )
+ {
+ pOutliner->Clear();
+ pOutliner->SetFirstPageNumber(nIndex+1);
+
+ Paragraph* pPara = NULL;
+ sal_Int32 nH (0);
+ while (nH < nPageH && nIndex<nCount)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, PK_STANDARD, rInfo);
+ ++nIndex;
+ if (pPage == NULL)
+ continue;
+
+ SdrTextObj* pTextObj = NULL;
+ sal_uInt32 nObj (0);
+
+ while (pTextObj==NULL && nObj < pPage->GetObjCount())
+ {
+ SdrObject* pObj = pPage->GetObj(nObj++);
+ if (pObj->GetObjInventor() == SdrInventor
+ && pObj->GetObjIdentifier() == OBJ_TITLETEXT)
+ {
+ pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ }
+ }
+
+ pPara = pOutliner->GetParagraph(pOutliner->GetParagraphCount() - 1);
+
+ if (pTextObj!=NULL
+ && !pTextObj->IsEmptyPresObj()
+ && pTextObj->GetOutlinerParaObject())
+ {
+ pOutliner->AddText(*(pTextObj->GetOutlinerParaObject()));
+ }
+ else
+ pOutliner->Insert(String());
+
+ pTextObj = NULL;
+ nObj = 0;
+
+ while (pTextObj==NULL && nObj<pPage->GetObjCount())
+ {
+ SdrObject* pObj = pPage->GetObj(nObj++);
+ if (pObj->GetObjInventor() == SdrInventor
+ && pObj->GetObjIdentifier() == OBJ_OUTLINETEXT)
+ {
+ pTextObj = dynamic_cast<SdrTextObj*>(pObj);
+ }
+ }
+
+ bool bSubTitle (false);
+ if (!pTextObj)
+ {
+ bSubTitle = true;
+ pTextObj = dynamic_cast<SdrTextObj*>(pPage->GetPresObj(PRESOBJ_TEXT)); // Untertitel vorhanden?
+ }
+
+ ULONG nParaCount1 = pOutliner->GetParagraphCount();
+
+ if (pTextObj!=NULL
+ && !pTextObj->IsEmptyPresObj()
+ && pTextObj->GetOutlinerParaObject())
+ {
+ pOutliner->AddText(*(pTextObj->GetOutlinerParaObject()));
+ }
+
+ if (bSubTitle )
+ {
+ const sal_Int32 nParaCount2 (pOutliner->GetParagraphCount());
+ for (sal_Int32 nPara=nParaCount1; nPara<nParaCount2; ++nPara)
+ {
+ Paragraph* pP = pOutliner->GetParagraph(nPara);
+ if (pP!=NULL && pOutliner->GetDepth((USHORT)nPara) > 0)
+ pOutliner->SetDepth(pP, 0);
+ }
+ }
+
+ nH = pOutliner->GetTextHeight();
+ }
+
+ // Remove the last paragraph when that does not fit completely on
+ // the current page.
+ if (nH > nPageH && pPara!=NULL)
+ {
+ ULONG nCnt = pOutliner->GetAbsPos(
+ pOutliner->GetParagraph( pOutliner->GetParagraphCount() - 1 ) );
+ ULONG nParaPos = pOutliner->GetAbsPos( pPara );
+ nCnt -= nParaPos;
+ pPara = pOutliner->GetParagraph( ++nParaPos );
+ if ( nCnt && pPara )
+ {
+ pOutliner->Remove(pPara, nCnt);
+ --nIndex;
+ }
+ }
+
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new OutlinerPrinterPage(
+ pOutliner->CreateParaObject(),
+ aMap,
+ rInfo.msTimeDate,
+ aPageOfs,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ rInfo.mpPrinter->GetPaperBin())));
+ }
+
+ pOutliner->SetRefMapMode(aSavedMapMode);
+ pOutliner->SetUpdateMode(bSavedUpdateMode);
+ pOutliner->SetPaperSize(aSavedPaperSize);
+ pOutliner->Init(nSavedOutlMode);
+ }
+
+
+
+
+ /** Prepare handout pages for slides that are to be printed.
+ */
+ void PrepareHandout (PrintInfo& rInfo)
+ {
+ SdDrawDocument* pDocument = mrBase.GetDocument();
+ OSL_ASSERT(pDocument != NULL);
+ SdPage& rHandoutPage (*pDocument->GetSdPage(0, PK_HANDOUT));
+
+ const bool bScalePage (mpOptions->IsPageSize());
+
+ USHORT nPaperBin;
+ if ( ! mpOptions->IsPaperBin())
+ nPaperBin = rHandoutPage.GetPaperBin();
+ else
+ nPaperBin = rInfo.mpPrinter->GetPaperBin();
+
+ // Change orientation?
+ SdPage& rMaster (dynamic_cast<SdPage&>(rHandoutPage.TRG_GetMasterPage()));
+ rInfo.meOrientation = rMaster.GetOrientation();
+
+ const Size aPaperSize (rInfo.mpPrinter->GetPaperSize());
+ if( (rInfo.meOrientation == ORIENTATION_LANDSCAPE &&
+ (aPaperSize.Width() < aPaperSize.Height()))
+ ||
+ (rInfo.meOrientation == ORIENTATION_PORTRAIT &&
+ (aPaperSize.Width() > aPaperSize.Height()))
+ )
+ {
+ maPrintSize = awt::Size(aPaperSize.Height(), aPaperSize.Width());
+ }
+ else
+ {
+ maPrintSize = awt::Size(aPaperSize.Width(), aPaperSize.Height());
+ }
+
+ MapMode aMap (rInfo.maMap);
+ const Point aPageOfs (rInfo.mpPrinter->GetPageOffset());
+ //DrawView* pPrintView;
+
+ // aMap.SetOrigin(Point() - aPageOfs);
+
+ if ( bScalePage )
+ {
+ const Size aPageSize (rHandoutPage.GetSize());
+ const Size aPrintSize (rInfo.mpPrinter->GetOutputSize());
+
+ const double fHorz = (double) aPrintSize.Width() / aPageSize.Width();
+ const double fVert = (double) aPrintSize.Height() / aPageSize.Height();
+
+ Fraction aFract;
+ if ( fHorz < fVert )
+ aFract = Fraction(aPrintSize.Width(), aPageSize.Width());
+ else
+ aFract = Fraction(aPrintSize.Height(), aPageSize.Height());
+
+ aMap.SetScaleX(aFract);
+ aMap.SetScaleY(aFract);
+ aMap.SetOrigin(Point());
+ }
+
+ ::boost::shared_ptr<ViewShell> pViewShell (mrBase.GetMainViewShell());
+ pViewShell->WriteFrameViewData();
+
+ // Count page shapes.
+ sal_uInt32 nShapeCount (0);
+ SdrObjListIter aShapeIter (rHandoutPage);
+ while (aShapeIter.IsMore())
+ {
+ SdrPageObj* pPageObj = dynamic_cast<SdrPageObj*>(aShapeIter.Next());
+ if (pPageObj)
+ ++nShapeCount;
+ }
+
+ // Distribute pages to handout pages.
+ ::std::vector<USHORT> aPageIndices;
+ std::vector<SdPage*> aPagesVector;
+ for (USHORT
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD),
+ nHandoutPageIndex=0;
+ nIndex <= nCount;
+ ++nIndex)
+ {
+ if (nIndex < nCount)
+ {
+ if (GetFilteredPage(nIndex, PK_STANDARD, rInfo) == NULL)
+ continue;
+ aPageIndices.push_back(nIndex);
+ }
+
+ // Create a printer page when we have found one page for each
+ // placeholder or when this is the last (and special) loop.
+ if (aPageIndices.size() == nShapeCount
+ || nIndex==nCount)
+ {
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new HandoutPrinterPage(
+ nHandoutPageIndex++,
+ aPageIndices,
+ aMap,
+ rInfo.msTimeDate,
+ aPageOfs,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ aPageIndices.clear();
+ }
+ }
+ }
+
+
+
+
+ /** Prepare the notes pages or regular slides.
+ */
+ void PrepareStdOrNotes (
+ const PageKind ePageKind,
+ PrintInfo& rInfo)
+ {
+ OSL_ASSERT(rInfo.mpPrinter != NULL);
+
+ // Fill in page kind specific data.
+ SdDrawDocument* pDocument = mrBase.GetMainViewShell()->GetDoc();
+ if (pDocument->GetSdPageCount(ePageKind) == 0)
+ return;
+ SdPage* pRefPage = pDocument->GetSdPage(0, ePageKind);
+ rInfo.maPageSize = pRefPage->GetSize();
+
+ if ( ! SetupPaperOrientation(ePageKind, rInfo))
+ return;
+
+ MapMode aMap (rInfo.maMap);
+ // aMap.SetOrigin(Point() - rInfo.mpPrinter->GetPageOffset());
+ rInfo.maMap = aMap;
+
+ if (mpOptions->IsBooklet())
+ PrepareBooklet(ePageKind, rInfo);
+ else
+ PrepareRegularPages(ePageKind, rInfo);
+ }
+
+
+
+
+ /** Prepare slides in a non-booklet way: one slide per one to many
+ printer pages.
+ */
+ void PrepareRegularPages (
+ const PageKind ePageKind,
+ PrintInfo& rInfo)
+ {
+ ::boost::shared_ptr<ViewShell> pViewShell (mrBase.GetMainViewShell());
+ pViewShell->WriteFrameViewData();
+ Point aPtZero;
+
+ for (USHORT
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(PK_STANDARD);
+ nIndex < nCount;
+ ++nIndex)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, ePageKind, rInfo);
+ if (pPage == NULL)
+ continue;
+
+ MapMode aMap (rInfo.maMap);
+ // Kann sich die Seitengroesse geaendert haben?
+ const Size aPageSize = pPage->GetSize();
+
+ if (mpOptions->IsPageSize())
+ {
+ const double fHorz ((double) rInfo.maPrintSize.Width() / aPageSize.Width());
+ const double fVert ((double) rInfo.maPrintSize.Height() / aPageSize.Height());
+
+ Fraction aFract;
+ if (fHorz < fVert)
+ aFract = Fraction(rInfo.maPrintSize.Width(), aPageSize.Width());
+ else
+ aFract = Fraction(rInfo.maPrintSize.Height(), aPageSize.Height());
+
+ aMap.SetScaleX(aFract);
+ aMap.SetScaleY(aFract);
+ aMap.SetOrigin(Point());
+ }
+
+ if (mpOptions->IsPrintPageName())
+ {
+ rInfo.msPageString = pPage->GetName();
+ rInfo.msPageString += ::rtl::OUString(sal_Unicode(' '));
+ }
+ else
+ rInfo.msPageString = ::rtl::OUString();
+ rInfo.msPageString += rInfo.msTimeDate;
+
+ long aPageWidth = aPageSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder();
+ long aPageHeight = aPageSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder();
+ // Bugfix zu 44530:
+ // Falls implizit umgestellt wurde (Landscape/Portrait)
+ // wird dies beim Kacheln, bzw. aufteilen (Poster) beruecksichtigt
+ BOOL bSwitchPageSize = FALSE;
+ if( ( rInfo.maPrintSize.Width() > rInfo.maPrintSize.Height()
+ && aPageWidth < aPageHeight )
+ || ( rInfo.maPrintSize.Width() < rInfo.maPrintSize.Height()
+ && aPageWidth > aPageHeight ) )
+ {
+ bSwitchPageSize = TRUE;
+ const sal_Int32 nTmp (rInfo.maPrintSize.Width());
+ rInfo.maPrintSize.Width() = rInfo.maPrintSize.Height();
+ rInfo.maPrintSize.Height() = nTmp;
+ }
+
+ if (mpOptions->IsTilePage()
+ && aPageWidth < rInfo.maPrintSize.Width()
+ && aPageHeight < rInfo.maPrintSize.Height())
+ {
+ // Put multiple slides on one printer page.
+ PrepareTiledPage(nIndex, *pPage, ePageKind, rInfo);
+ }
+ else
+ {
+ rInfo.maMap = aMap;
+ PrepareScaledPage(nIndex, *pPage, ePageKind, rInfo);
+ }
+ }
+ }
+
+
+
+
+ /** Put two slides on one printer page.
+ */
+ void PrepareBooklet (
+ const PageKind ePageKind,
+ const PrintInfo& rInfo)
+ {
+ MapMode aStdMap (rInfo.maMap);
+ Point aOffset;
+ Size aPrintSize_2 (rInfo.maPrintSize);
+ Size aPageSize_2 (rInfo.maPageSize);
+
+ if (rInfo.meOrientation == ORIENTATION_LANDSCAPE)
+ aPrintSize_2.Width() >>= 1;
+ else
+ aPrintSize_2.Height() >>= 1;
+
+ const double fPageWH = (double) aPageSize_2.Width() / aPageSize_2.Height();
+ const double fPrintWH = (double) aPrintSize_2.Width() / aPrintSize_2.Height();
+
+ if( fPageWH < fPrintWH )
+ {
+ aPageSize_2.Width() = (long) ( aPrintSize_2.Height() * fPageWH );
+ aPageSize_2.Height()= aPrintSize_2.Height();
+ }
+ else
+ {
+ aPageSize_2.Width() = aPrintSize_2.Width();
+ aPageSize_2.Height() = (long) ( aPrintSize_2.Width() / fPageWH );
+ }
+
+ MapMode aMap (rInfo.maMap);
+ aMap.SetScaleX( Fraction( aPageSize_2.Width(), rInfo.maPageSize.Width() ) );
+ aMap.SetScaleY( Fraction( aPageSize_2.Height(), rInfo.maPageSize.Height() ) );
+
+ // calculate adjusted print size
+ const Size aAdjustedPrintSize (OutputDevice::LogicToLogic(
+ rInfo.maPrintSize,
+ aStdMap,
+ aMap));
+
+ if (rInfo.meOrientation == ORIENTATION_LANDSCAPE)
+ {
+ aOffset.X() = ( ( aAdjustedPrintSize.Width() >> 1 ) - rInfo.maPageSize.Width() ) >> 1;
+ aOffset.Y() = ( aAdjustedPrintSize.Height() - rInfo.maPageSize.Height() ) >> 1;
+ }
+ else
+ {
+ aOffset.X() = ( aAdjustedPrintSize.Width() - rInfo.maPageSize.Width() ) >> 1;
+ aOffset.Y() = ( ( aAdjustedPrintSize.Height() >> 1 ) - rInfo.maPageSize.Height() ) >> 1;
+ }
+
+ // create vector of pages to print
+ ::std::vector< USHORT > aPageVector;
+ for (USHORT
+ nIndex=0,
+ nCount=mrBase.GetDocument()->GetSdPageCount(ePageKind);
+ nIndex < nCount;
+ ++nIndex)
+ {
+ SdPage* pPage = GetFilteredPage(nIndex, ePageKind, rInfo);
+ if (pPage != NULL)
+ aPageVector.push_back(nIndex);
+ }
+
+ // create pairs of pages to print on each page
+ typedef ::std::vector< ::std::pair< USHORT, USHORT > > PairVector;
+ PairVector aPairVector;
+ if ( ! aPageVector.empty())
+ {
+ sal_uInt32 nFirstIndex = 0, nLastIndex = aPageVector.size() - 1;
+
+ if( aPageVector.size() & 1 )
+ aPairVector.push_back( ::std::make_pair( (USHORT) 65535, aPageVector[ nFirstIndex++ ] ) );
+ else
+ aPairVector.push_back( ::std::make_pair( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ) );
+
+ while( nFirstIndex < nLastIndex )
+ {
+ if( nFirstIndex & 1 )
+ aPairVector.push_back( ::std::make_pair( aPageVector[ nFirstIndex++ ], aPageVector[ nLastIndex-- ] ) );
+ else
+ aPairVector.push_back( ::std::make_pair( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ) );
+ }
+ }
+
+ for (sal_uInt32
+ nIndex=0,
+ nCount=aPairVector.size();
+ nIndex < nCount;
+ ++nIndex)
+ {
+ const bool bIsIndexOdd (nIndex & 1);
+ if ((!bIsIndexOdd && mpOptions->IsPrintFrontPage())
+ || (bIsIndexOdd && mpOptions->IsPrintBackPage()))
+ {
+ const ::std::pair<USHORT, USHORT> aPair (aPairVector[nIndex]);
+ Point aSecondOffset (aOffset);
+ if (rInfo.meOrientation == ORIENTATION_LANDSCAPE)
+ aSecondOffset.X() += aAdjustedPrintSize.Width() / 2;
+ else
+ aSecondOffset.Y() += aAdjustedPrintSize.Height() / 2;
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new BookletPrinterPage(
+ aPair.first,
+ aPair.second,
+ aOffset,
+ aSecondOffset,
+ ePageKind,
+ aMap,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ rInfo.mpPrinter->GetPaperBin())));
+
+ }
+ }
+ }
+
+
+
+
+ /** Print one slide multiple times on one printer page so that the whole
+ printer page is covered.
+ */
+ void PrepareTiledPage (
+ const sal_Int32 nPageIndex,
+ const SdPage& rPage,
+ const PageKind ePageKind,
+ const PrintInfo& rInfo)
+ {
+ USHORT nPaperBin;
+ if ( ! mpOptions->IsPaperBin())
+ nPaperBin = rPage.GetPaperBin();
+ else
+ nPaperBin = rInfo.mpPrinter->GetPaperBin();
+
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new TiledPrinterPage(
+ sal::static_int_cast<USHORT>(nPageIndex),
+ ePageKind,
+ 500,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.msPageString,
+ rInfo.mpPrinter->GetPageOffset(),
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ }
+
+
+
+ /** Print one standard slide or notes page on one to many printer
+ pages. More than on printer page is used when the slide is larger
+ than the printable area.
+ */
+ void PrepareScaledPage (
+ const sal_Int32 nPageIndex,
+ const SdPage& rPage,
+ const PageKind ePageKind,
+ const PrintInfo& rInfo)
+ {
+ const Point aPageOffset (rInfo.mpPrinter->GetPageOffset());
+
+ USHORT nPaperBin;
+ if ( ! mpOptions->IsPaperBin())
+ nPaperBin = rPage.GetPaperBin();
+ else
+ nPaperBin = rInfo.mpPrinter->GetPaperBin();
+
+ // For pages larger then the printable area there
+ // are three options:
+ // 1. Scale down to the page to the printable area.
+ // 2. Print only the upper left part of the page
+ // (without the unprintable borders).
+ // 3. Split the page into parts of the size of the
+ // printable area.
+ const bool bScalePage (mpOptions->IsPageSize());
+ const bool bCutPage (mpOptions->IsCutPage());
+ MapMode aMap (rInfo.maMap);
+ if (bScalePage || bCutPage)
+ {
+ // Handle 1 and 2.
+
+ // if CutPage is set then do not move it, otherwise move the
+ // scaled page to printable area
+ #if 0
+ if (bCutPage)
+ aMap.SetOrigin(Point(-aPageOffset.X(), -aPageOffset.Y()));
+ else
+ aMap.SetOrigin(Point(0,0));
+ #endif
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new RegularPrinterPage(
+ sal::static_int_cast<USHORT>(nPageIndex),
+ ePageKind,
+ aMap,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.msPageString,
+ aPageOffset,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ }
+ else
+ {
+ // Handle 3. Print parts of the page in the size of the
+ // printable area until the whole page is covered.
+
+ // keep the page content at its position if it fits, otherwise
+ // move it to the printable area
+ const long nPageWidth (
+ rInfo.maPageSize.Width() - rPage.GetLftBorder() - rPage.GetRgtBorder());
+ const long nPageHeight (
+ rInfo.maPageSize.Height() - rPage.GetUppBorder() - rPage.GetLwrBorder());
+ #if 0
+ Point aOrigin (
+ nPageWidth < rInfo.maPrintSize.Width() ? -aPageOffset.X() : 0,
+ nPageHeight < rInfo.maPrintSize.Height() ? -aPageOffset.Y() : 0);
+ #else
+ Point aOrigin ( 0, 0 );
+ #endif
+ for (Point aPageOrigin = aOrigin;
+ -aPageOrigin.Y()<nPageHeight;
+ aPageOrigin.Y() -= rInfo.maPrintSize.Height())
+ {
+ for (aPageOrigin.X()=aOrigin.X();
+ -aPageOrigin.X()<nPageWidth;
+ aPageOrigin.X() -= rInfo.maPrintSize.Width())
+ {
+ aMap.SetOrigin(aPageOrigin);
+ maPrinterPages.push_back(
+ ::boost::shared_ptr<PrinterPage>(
+ new RegularPrinterPage(
+ sal::static_int_cast<USHORT>(nPageIndex),
+ ePageKind,
+ aMap,
+ rInfo.mbPrintMarkedOnly,
+ rInfo.msPageString,
+ aPageOffset,
+ rInfo.mnDrawMode,
+ rInfo.meOrientation,
+ nPaperBin)));
+ }
+ }
+ }
+ }
+};
+
+
+
+
+//===== DocumentRenderer ======================================================
+
+DocumentRenderer::DocumentRenderer (ViewShellBase& rBase)
+ : DocumentRendererInterfaceBase(m_aMutex),
+ mpImpl(new Implementation(rBase))
+{
+}
+
+
+
+
+DocumentRenderer::~DocumentRenderer (void)
+{
+}
+
+
+
+
+//----- XRenderable -----------------------------------------------------------
+
+sal_Int32 SAL_CALL DocumentRenderer::getRendererCount (
+ const css::uno::Any& aSelection,
+ const css::uno::Sequence<css::beans::PropertyValue >& rOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ (void)aSelection;
+ mpImpl->ProcessProperties(rOptions);
+ return mpImpl->GetPrintPageCount();
+}
+
+
+
+
+Sequence<beans::PropertyValue> SAL_CALL DocumentRenderer::getRenderer (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ (void)nRenderer;
+ (void)rSelection;
+ mpImpl->ProcessProperties(rOptions);
+ return mpImpl->GetProperties(rOptions);
+}
+
+
+
+
+void SAL_CALL DocumentRenderer::render (
+ sal_Int32 nRenderer,
+ const css::uno::Any& rSelection,
+ const css::uno::Sequence<css::beans::PropertyValue>& rOptions)
+ throw (css::lang::IllegalArgumentException, css::uno::RuntimeException)
+{
+ (void)rSelection;
+ mpImpl->ProcessProperties(rOptions);
+ mpImpl->PrintPage(nRenderer);
+}
+
+
+
+} // end of namespace sd
diff --git a/sd/source/ui/view/DocumentRenderer.hrc b/sd/source/ui/view/DocumentRenderer.hrc
new file mode 100644
index 000000000000..64a1509d6926
--- /dev/null
+++ b/sd/source/ui/view/DocumentRenderer.hrc
@@ -0,0 +1,80 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: printdialog.hrc,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#define _STR_IMPRESS_PRINT_UI_OPTIONS 32001
+#define _STR_IMPRESS_PRINT_UI_GROUP_NAME 1
+#define _STR_IMPRESS_PRINT_UI_PRINT_CONTENT 2
+#define _STR_IMPRESS_PRINT_UI_PRINT_GROUP 3
+#define _STR_IMPRESS_PRINT_UI_CONTENT 4
+#define _STR_IMPRESS_PRINT_UI_CONTENT_HELP 5
+#define _STR_IMPRESS_PRINT_UI_CONTENT_CHOICES 6
+#define _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE 7
+#define _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES 8
+#define _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES_HELP 9
+#define _STR_IMPRESS_PRINT_UI_ORDER 10
+#define _STR_IMPRESS_PRINT_UI_ORDER_CHOICES 11
+#define _STR_IMPRESS_PRINT_UI_ORDER_CHOICES_HELP 12
+#define _STR_IMPRESS_PRINT_UI_INCLUDE_CONTENT 13
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_NAME 14
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_NAME_HELP 15
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_DATE 16
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_DATE_HELP 17
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_TIME 18
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_TIME_HELP 19
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN 20
+#define _STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN_HELP 21
+
+#define _STR_IMPRESS_PRINT_UI_OUTPUT_OPTIONS_GROUP 22
+#define _STR_IMPRESS_PRINT_UI_QUALITY 23
+#define _STR_IMPRESS_PRINT_UI_QUALITY_CHOICES 24
+#define _STR_IMPRESS_PRINT_UI_QUALITY_CHOICES_HELP 25
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS 26
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES 27
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW 28
+#define _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_HELP 29
+#define _STR_IMPRESS_PRINT_UI_BROCHURE 30
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_HELP 31
+#define _STR_IMPRESS_PRINT_UI_PAGE_SIDES 32
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE 33
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_HELP 34
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST 35
+#define _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST_HELP 36
+#define _STR_IMPRESS_PRINT_UI_PAPER_TRAY_GROUP 37
+#define _STR_IMPRESS_PRINT_UI_PAPER_TRAY 38
+#define _STR_IMPRESS_PRINT_UI_PAPER_TRAY_HELP 39
+
+#define _STR_IMPRESS_PRINT_UI_PAGE_RANGE 40
+#define _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE 41
+#define _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE_HELP 42
+#define _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE 43
+
+#define _STR_DRAW_PRINT_UI_IS_PRINT_NAME 44
+#define _STR_DRAW_PRINT_UI_IS_PRINT_NAME_HELP 45
+
diff --git a/sd/source/ui/view/DocumentRenderer.src b/sd/source/ui/view/DocumentRenderer.src
new file mode 100644
index 000000000000..c69a6ffe6469
--- /dev/null
+++ b/sd/source/ui/view/DocumentRenderer.src
@@ -0,0 +1,298 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: printdialog.src,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "app.hrc"
+#include "DocumentRenderer.hrc"
+
+Resource _STR_IMPRESS_PRINT_UI_OPTIONS
+{
+ String _STR_IMPRESS_PRINT_UI_GROUP_NAME
+ {
+ Text [en-US] = "%PRODUCTNAME %s";
+ };
+ String _STR_IMPRESS_PRINT_UI_PRINT_CONTENT
+ {
+ Text [ en-US ] = "Print content";
+ };
+ String _STR_IMPRESS_PRINT_UI_PRINT_GROUP
+ {
+ Text [ en-US ] = "Print";
+ };
+ String _STR_IMPRESS_PRINT_UI_CONTENT
+ {
+ Text [ en-US ] = "Document";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_CONTENT_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Select which parts of the document should be printed"; >;
+ < "Select which parts of the document should be printed"; >;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_CONTENT_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Slides" ; > ;
+ < "Handouts" ; > ;
+ < "Notes" ; > ;
+ < "Outline" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE
+ {
+ Text [ en-US ] = "Slides per page" ;
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "1" ; > ;
+ < "2" ; > ;
+ < "3" ; > ;
+ < "4" ; > ;
+ < "6" ; > ;
+ < "9" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_SLIDESPERPAGE_CHOICES_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Select how many slides to print per page." ; >;
+ < "Select how many slides to print per page." ; >;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_ORDER
+ {
+ Text [ en-US ] = "Order" ;
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_ORDER_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Left to right, then down" ; > ;
+ < "Top to bottom, then right" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_ORDER_CHOICES_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Specify how to arrange slides on the printed page." ; > ;
+ < "Arrange slides horizontally" ; > ;
+ < "Arrange slides vertically" ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_INCLUDE_CONTENT
+ {
+ Text [ en-US ] = "~Contents";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_NAME
+ {
+ Text [ en-US ] = "~Slide name";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_NAME_HELP
+ {
+ Text [ en-US ] = "Specifies whether to print the page name of a document.";
+ };
+ String _STR_DRAW_PRINT_UI_IS_PRINT_NAME
+ {
+ Text [ en-US ] = "P~age name";
+ };
+ String _STR_DRAW_PRINT_UI_IS_PRINT_NAME_HELP
+ {
+ Text [ en-US ] = "Specifies whether to print the page name of a document.";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_DATE
+ {
+ Text [ en-US ] = "~Date and time";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_DATE_HELP
+ {
+ Text [ en-US ] = "Specifies whether to print the current date and time.";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN
+ {
+ Text [ en-US ] = "Hidden pages";
+ };
+ String _STR_IMPRESS_PRINT_UI_IS_PRINT_HIDDEN_HELP
+ {
+ Text [ en-US ] = "Specifies whether to print the pages that are currently hidden from the application.";
+ };
+
+ String _STR_IMPRESS_PRINT_UI_OUTPUT_OPTIONS_GROUP
+ {
+ Text [ en-US ] = "Output options";
+ };
+ String _STR_IMPRESS_PRINT_UI_QUALITY
+ {
+ Text [ en-US ] = "Color";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_QUALITY_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Original colors" ; > ;
+ < "Grayscale" ; > ;
+ < "Black & White" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_QUALITY_CHOICES_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Specify how to treat colors in the printout."; >;
+ < "Specifies that you want to print in original colors." ; > ;
+ < "Specifies that you want to print colors as grayscale." ; > ;
+ < "Specifies that you want to print in black and white." ; > ;
+ };
+ };
+
+ String _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS
+ {
+ Text [ en-US ] = "~Size";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES
+ {
+ ItemList [ en-US ] =
+ {
+ < "Original size" ; > ;
+ < "Fit to printable page" ; > ;
+ < "Distribute on multiple paper sheets" ; > ;
+ < "Tile paper sheet with repeated slides" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_DRAW
+ {
+ ItemList [ en-US ] =
+ {
+ < "Original size" ; > ;
+ < "Fit to printable page" ; > ;
+ < "Distribute on multiple paper sheets" ; > ;
+ < "Tile paper sheet with repeated pages" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_OPTIONS_CHOICES_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Specify how to scale slides in the printout."; >;
+ < "Specifies that you do not want to further scale pages when printing." ; > ;
+ < "Specifies whether to scale down objects that are beyond the margins of the current printer so they fit on the paper in the printer." ; > ;
+ < "Specifies that pages are to be printed in tiled format. If the pages or slides are smaller than the paper, several pages or slides will be printed on one page of paper." ; > ;
+ };
+ };
+ String _STR_IMPRESS_PRINT_UI_BROCHURE
+ {
+ Text [en-US] = "Brochure";
+ };
+ String _STR_IMPRESS_PRINT_UI_BROCHURE_HELP
+ {
+ Text [en-US] = "Select the \"Brochure\" option to print the document in brochure format.";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAGE_SIDES
+ {
+ Text [ en-US ] = "Page sides";
+ };
+ String _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE
+ {
+ Text [ en-US ] = "Include";
+ };
+ String _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_HELP
+ {
+ Text [ en-US ] = "Select which pages of a brochure to print.";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST
+ {
+ ItemList [ en-US ] =
+ {
+ < "All pages" ; > ;
+ < "Front sides / right pages" ; > ;
+ < "Back sides / left pages" ; > ;
+ };
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_BROCHURE_INCLUDE_LIST_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Print all pages of a brochure." ; > ;
+ < "Print only front pages of a brochure." ; > ;
+ < "Print only back pages of a brochure." ; > ;
+ };
+ };
+
+ String _STR_IMPRESS_PRINT_UI_PAPER_TRAY_GROUP
+ {
+ Text [ en-US ] = "Paper tray";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAPER_TRAY
+ {
+ Text [ en-US ] = "~Use only paper tray from printer preferences";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAPER_TRAY_HELP
+ {
+ Text [ en-US ] = "Determines that the paper tray to be used is the one defined in the printer setup.";
+ };
+ String _STR_IMPRESS_PRINT_UI_PAGE_RANGE
+ {
+ Text [en-US] = "Print range";
+ };
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE
+ {
+ ItemList [ en-US ] =
+ {
+ < "~All slides"; >;
+ < "~Slides"; >;
+ < "Se~lection"; >;
+ };
+ };
+
+ StringArray _STR_IMPRESS_PRINT_UI_PAGE_RANGE_CHOICE_HELP
+ {
+ ItemList [ en-US ] =
+ {
+ < "Print the whole document."; >;
+ < "Print a specified range of the document."; >;
+ < "Print only the currently selected content."; >;
+ };
+ };
+
+ StringArray _STR_DRAW_PRINT_UI_PAGE_RANGE_CHOICE
+ {
+ ItemList [ en-US ] =
+ {
+ < "~All pages"; >;
+ < "Pa~ges"; >;
+ < "Se~lection"; >;
+ };
+ };
+};
diff --git a/sd/source/ui/view/PrintManager.cxx b/sd/source/ui/view/PrintManager.cxx
deleted file mode 100644
index 6d24fdf98e79..000000000000
--- a/sd/source/ui/view/PrintManager.cxx
+++ /dev/null
@@ -1,1802 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: PrintManager.cxx,v $
- * $Revision: 1.24.8.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_sd.hxx"
-
-#include <basegfx/polygon/b2dpolygon.hxx>
-#include <basegfx/polygon/b2dpolypolygon.hxx>
-#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <basegfx/matrix/b2dhommatrixtools.hxx>
-
-#include "PrintManager.hxx"
-
-#include <svx/editstat.hxx>
-#include "optsitem.hxx"
-#include "sdattr.hxx"
-#include "sdpage.hxx"
-#include "drawdoc.hxx"
-#include "drawview.hxx"
-#include "ViewShellBase.hxx"
-#include "DrawViewShell.hxx"
-#include "OutlineViewShell.hxx"
-#include "Outliner.hxx"
-#include "Window.hxx"
-#include "FrameView.hxx"
-#include <sfx2/progress.hxx>
-#include <svtools/printdlg.hxx>
-#include <tools/multisel.hxx>
-#include <unotools/misccfg.hxx>
-#include <unotools/localedatawrapper.hxx>
-#include <svx/prtqry.hxx>
-#include "WindowUpdater.hxx"
-#include <sfx2/printer.hxx>
-#include <svx/svdoutl.hxx>
-#include "sdresid.hxx"
-#include <svx/svdetc.hxx>
-#include <svx/svdopage.hxx>
-#include <svx/svdpagv.hxx>
-#include <svx/svditer.hxx>
-
-#include "strings.hrc"
-
-#include <svx/svdopath.hxx>
-#include "sdabstdlg.hxx"
-#include "printdlg.hrc"
-#include "prntopts.hrc"
-#include "app.hrc"
-#include <svl/intitem.hxx>
-#include <svx/paperinf.hxx>
-#include <svx/xlnclit.hxx>
-#include "printdialog.hxx"
-
-namespace sd {
-
-/** This simple container reduces the number of arguments that have to be
- passed around and makes it easier to modify the set of arguments.
-*/
-class PrintManager::PrintInfo
-{
-public:
- PrintInfo (
- ViewShell& rViewShell,
- SfxPrinter& rPrinter,
- SfxProgress& rProgress,
- const MultiSelection& rSelPages,
- const String& rTimeDateStr,
- const Font& rTimeDateFont,
- const SdOptionsPrintItem* pPrintOpts,
- USHORT nPageMax,
- USHORT nCopies,
- USHORT nProgressOffset,
- USHORT nTotal)
- : mrViewShell(rViewShell),
- mrPrinter(rPrinter),
- mrProgress(rProgress),
- mrSelPages(rSelPages),
- mrTimeDateStr(rTimeDateStr),
- mrTimeDateFont(rTimeDateFont),
- mpPrintOpts(pPrintOpts),
- mnPageMax(nPageMax),
- mnCopies(nCopies),
- mnProgressOffset(nProgressOffset),
- mnTotal(nTotal)
- {}
-
- ViewShell& mrViewShell;
- SfxPrinter& mrPrinter;
- SfxProgress& mrProgress;
- const MultiSelection& mrSelPages;
- const String& mrTimeDateStr;
- const Font& mrTimeDateFont;
- const SdOptionsPrintItem* mpPrintOpts;
- USHORT mnPageMax;
- USHORT mnCopies;
- USHORT mnProgressOffset;
- USHORT mnTotal;
-};
-
-
-PrintManager::PrintManager (ViewShellBase& rBase)
- : mrBase (rBase)
-{
-}
-
-
-
-
-PrintManager::~PrintManager (void)
-{
-}
-
-
-
-
-SfxPrinter* PrintManager::GetPrinter (BOOL bCreate)
-{
- return mrBase.GetDocShell()->GetPrinter (bCreate);
-}
-
-
-
-
-USHORT PrintManager::SetPrinter (
- SfxPrinter* pNewPrinter,
- USHORT nDiffFlags,bool bIsAPI)
-{
- return SetPrinterOptDlg (pNewPrinter,nDiffFlags,!bIsAPI);
-}
-
-
-
-
-USHORT PrintManager::SetPrinterOptDlg (
- SfxPrinter* pNewPrinter,
- USHORT nDiffFlags,
- BOOL _bShowDialog)
-{
- SfxPrinter* pOld = mrBase.GetDocShell()->GetPrinter( FALSE );
- if ( pOld && pOld->IsPrinting() )
- return SFX_PRINTERROR_BUSY;
-
- mrBase.GetDocShell()->SetPrinter(pNewPrinter);
-
- if ( (nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ||
- nDiffFlags & SFX_PRINTER_CHG_SIZE) && pNewPrinter )
- {
- MapMode aMap = pNewPrinter->GetMapMode();
- aMap.SetMapUnit(MAP_100TH_MM);
- MapMode aOldMap = pNewPrinter->GetMapMode();
- pNewPrinter->SetMapMode(aMap);
- Size aNewSize = pNewPrinter->GetOutputSize();
-
- BOOL bScaleAll = FALSE;
- if ( _bShowDialog )
- {
- WarningBox aWarnBox (
- mrBase.GetWindow(),
- (WinBits)(WB_YES_NO | WB_DEF_YES),
- String(SdResId(STR_SCALE_OBJS_TO_PAGE)));
- bScaleAll = (aWarnBox.Execute() == RET_YES);
- }
-
- ViewShell* pShell = mrBase.GetMainViewShell().get();
- if (pShell != NULL && pShell->ISA(DrawViewShell))
- {
- SdPage* pPage = mrBase.GetDocument()->GetSdPage(
- 0, PK_STANDARD );
- pShell->SetPageSizeAndBorder (
- static_cast<DrawViewShell*>(pShell)->GetPageKind(),
- aNewSize,
- -1,-1,-1,-1,
- bScaleAll,
- pNewPrinter->GetOrientation(),
- pPage->GetPaperBin(),
- pPage->IsBackgroundFullSize());
- }
-
- pNewPrinter->SetMapMode(aOldMap);
- }
-
- return 0;
-}
-
-
-
-
-PrintDialog* PrintManager::CreatePrintDialog (::Window *pParent)
-{
- const bool bImpress = mrBase.GetDocument()->GetDocumentType() == DOCUMENT_TYPE_IMPRESS;
-
- SdPrintDialog* pDlg = SdPrintDialog::Create(pParent,bImpress);
-
- ViewShell* pShell = mrBase.GetMainViewShell().get();
- if (pShell!=NULL && ! pShell->ISA(OutlineViewShell))
- {
-
- if (pShell->ISA(DrawViewShell))
- {
- pDlg->SetRangeText(UniString::CreateFromInt32(
- static_cast<DrawViewShell*>(pShell)->GetCurPageId()));
- }
- /* else if(pShell->ISA(::sd::slidesorter::SlideSorterViewShell))
- {
- String aStrRange(
- dynamic_cast<sd::slidesorter::SlideSorterViewShell*>(pShell)->GetPageRangeString());
- if( aStrRange.Len() )
- {
- pDlg->SetRangeText( aStrRange );
- // According #79749 always check PRINTDIALOG_ALL
- // pDlg->CheckRange( PRINTDIALOG_RANGE );
- }
- }
- */
- }
- else
- {
- String aStrRange(
- static_cast<OutlineViewShell*>(pShell)->GetPageRangeString());
- if( aStrRange.Len() )
- {
- pDlg->SetRangeText( aStrRange );
- // According #79749 always check PRINTDIALOG_ALL
- // pDlg->CheckRange( PRINTDIALOG_RANGE );
- }
- }
- pDlg->EnableRange( PRINTDIALOG_RANGE );
- pDlg->EnableRange( PRINTDIALOG_ALL );
- pDlg->EnableCollate();
-
- if (pShell->ISA(DrawViewShell) && pShell->GetView()->AreObjectsMarked())
- {
- pDlg->EnableRange( PRINTDIALOG_SELECTION );
- // According #79749 always check PRINTDIALOG_ALL
- // pDlg->CheckRange( PRINTDIALOG_SELECTION );
- }
-
- if( bImpress )
- {
- const SdOptionsPrintItem* pPrintOpts = 0;
-
- SfxPrinter* pPrinter = mrBase.GetPrinter(FALSE);
- if( pPrinter )
- {
- const SfxPoolItem* pPoolItem = 0;
- if(pPrinter->GetOptions().GetItemState(ATTR_OPTIONS_PRINT, FALSE, &pPoolItem ) == SFX_ITEM_SET )
- pPrintOpts = dynamic_cast< const SdOptionsPrintItem* >( pPoolItem );
- }
- pDlg->Init( pPrintOpts );
- }
-
- return pDlg;
-}
-
-SfxTabPage* PrintManager::CreatePrintOptionsPage( ::Window *pParent, const SfxItemSet &rOptions)
-{
- SfxTabPage* pPage = 0;
- DocumentType eDocType = mrBase.GetDocument()->GetDocumentType();
- SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
- ::CreateTabPage fnCreatePage = pFact ? pFact->GetSdPrintOptionsTabPageCreatorFunc() : 0;
- if( fnCreatePage )
- {
- pPage = (*fnCreatePage)( pParent, rOptions );
- if( eDocType == DOCUMENT_TYPE_DRAW )
- {
- SfxAllItemSet aSet(*(rOptions.GetPool()));
- aSet.Put (SfxUInt32Item(SID_SDMODE_FLAG,SD_DRAW_MODE));
- pPage->PageCreated(aSet);
- }
- }
- return pPage;
-}
-
-
-
-
-USHORT PrintManager::Print (SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pDlg)
-{
- SfxPrinter* pPrinter = mrBase.GetPrinter(TRUE);
- ViewShell* pShell = mrBase.GetMainViewShell().get();
-
- if (pPrinter!=NULL && pShell!=NULL)
- {
- const PrinterOptions aOldPrinterOptions( pPrinter->GetPrinterOptions() );
- MapMode aMap( pPrinter->GetMapMode() );
- const MapMode aOldMap( aMap );
- USHORT nOldPaperBin = pPrinter->GetPaperBin();
-
- aMap.SetMapUnit(MAP_100TH_MM);
- pPrinter->SetMapMode(aMap);
-
- ::Outliner& rOutliner = mrBase.GetDocument()->GetDrawOutliner();
- ULONG nOldCntrl = rOutliner.GetControlWord();
- ULONG nCntrl = nOldCntrl;
- nCntrl &= ~EE_CNTRL_MARKFIELDS;
- nCntrl &= ~EE_CNTRL_ONLINESPELLING;
- rOutliner.SetControlWord( nCntrl );
-
- // old place of FitPageToPrinterWithDialog().
- SdOptionsPrintItem* pPrintOpts = 0;
-
- const SfxPoolItem* pPoolItem = 0;
- if (pPrinter->GetOptions().GetItemState( ATTR_OPTIONS_PRINT, FALSE, &pPoolItem ) == SFX_ITEM_SET )
- pPrintOpts = dynamic_cast< SdOptionsPrintItem* >( const_cast< SfxPoolItem* >( pPoolItem ) ) ;
-
- if( dynamic_cast<SdPrintDialog*>(pDlg) && static_cast<SdPrintDialog*>(pDlg)->Fill( pPrintOpts ) )
- {
- SfxItemSet aNewOptions( pPrinter->GetOptions() );
- aNewOptions.Put( *pPrintOpts );
- pPrinter->SetOptions( aNewOptions );
- pPrintOpts = dynamic_cast< SdOptionsPrintItem* >( const_cast< SfxPoolItem* >( pPrinter->GetOptions().GetItem( ATTR_OPTIONS_PRINT ) ) );
- }
-
- // Wenn wir im Gliederungsmodus sind, muss das Model auf Stand gebracht werden
- if (pShell->ISA(OutlineViewShell))
- static_cast<OutlineViewShell*>(pShell)->PrepareClose (FALSE, FALSE);
-
- // Basisklasse rufen, um Basic anzusprechen
- mrBase.SfxViewShell::Print( rProgress, bIsAPI, pDlg );
-
- // Setzen des Textes des Druckmonitors
- rProgress.SetText( String( SdResId( STR_STATSTR_PRINT ) ) );
-
- PrintDialogRange eOption;
- MultiSelection aPrintSelection;
- String aTimeDateStr;
- Font aTimeDateFont(FAMILY_SWISS, Size(0, 423));
- PageKind ePageKind = PK_STANDARD;
- USHORT nPage, nPageMax;
- USHORT nTotal, nCopies;
- USHORT nPrintCount = 0;
- USHORT nProgressOffset = 0;
- USHORT nCollateCopies = 1;
- BOOL bPrintMarkedOnly = FALSE;
- BOOL bPrintOutline = FALSE;
- BOOL bPrintHandout = FALSE;
- BOOL bPrintDraw = FALSE;
- BOOL bPrintNotes = FALSE;
- BOOL bHandoutHorizontal = TRUE;
- USHORT nSlidesPerHandout = 6;
-
- Orientation eOldOrientation = pPrinter->GetOrientation();
-
- if( pPrintOpts )
- {
- ::utl::MiscCfg aMisc;
-
- if( pPrintOpts->GetOptionsPrint().IsDate() )
- {
- aTimeDateStr += GetSdrGlobalData().GetLocaleData()->getDate( Date() );
- aTimeDateStr += (sal_Unicode)' ';
- }
-
- if( pPrintOpts->GetOptionsPrint().IsTime() )
- aTimeDateStr += GetSdrGlobalData().GetLocaleData()->getTime( Time(), FALSE, FALSE );
-
- if( pPrintOpts->GetOptionsPrint().IsOutline() )
- bPrintOutline = TRUE;
-
- if( pPrintOpts->GetOptionsPrint().IsHandout() )
- {
- bPrintHandout = TRUE;
- bHandoutHorizontal = pPrintOpts->GetOptionsPrint().IsHandoutHorizontal();
- nSlidesPerHandout = pPrintOpts->GetOptionsPrint().GetHandoutPages();
- }
-
- if( pPrintOpts->GetOptionsPrint().IsDraw() )
- bPrintDraw = TRUE;
-
- if( pPrintOpts->GetOptionsPrint().IsNotes() )
- {
- bPrintNotes = TRUE;
- ePageKind = PK_NOTES;
- }
-
- pPrintOpts->GetOptionsPrint().SetWarningPrinter( aMisc.IsNotFoundWarning() );
- pPrintOpts->GetOptionsPrint().SetWarningSize( aMisc.IsPaperSizeWarning() );
- pPrintOpts->GetOptionsPrint().SetWarningOrientation( aMisc.IsPaperOrientationWarning() );
-
- UINT16 nQuality = pPrintOpts->GetOptionsPrint().GetOutputQuality();
- ULONG nMode = DRAWMODE_DEFAULT;
-
- if( nQuality == 1 )
- nMode = DRAWMODE_GRAYLINE | DRAWMODE_GRAYFILL | DRAWMODE_BLACKTEXT | DRAWMODE_GRAYBITMAP | DRAWMODE_GRAYGRADIENT;
- else if( nQuality == 2 )
- nMode = DRAWMODE_BLACKLINE | DRAWMODE_BLACKTEXT | DRAWMODE_WHITEFILL | DRAWMODE_GRAYBITMAP | DRAWMODE_WHITEGRADIENT;
-
- pPrinter->SetDrawMode( nMode );
- }
- else
- bPrintDraw = TRUE;
-
- if( pDlg )
- {
- eOption = pDlg->GetCheckedRange();
-
- if( eOption == PRINTDIALOG_SELECTION )
- bPrintMarkedOnly = TRUE;
- }
- else
- // Bei PrintDirect wird gesamtes Dokument gedruckt
- eOption = PRINTDIALOG_ALL;
-
- // #72527 If we are in PrintDirect and any objects
- // are selected, then a dialog (see ViewShell::DoPrint)
- // ask whether the total document should be printed
- // or only the selected objects. If only the selected
- // object, then the flag bPrintDirectSelected is TRUE
- if (mbPrintDirectSelected)
- {
- eOption = PRINTDIALOG_SELECTION;
- bPrintMarkedOnly = TRUE;
- }
-
- nPageMax = mrBase.GetDocument()->GetSdPageCount( ePageKind );
- aPrintSelection.SetTotalRange( Range( 1, nPageMax ) );
-
- switch( eOption )
- {
- case PRINTDIALOG_ALL:
- aPrintSelection.Select(Range(1, nPageMax));
- break;
-
- case PRINTDIALOG_RANGE:
- aPrintSelection = MultiSelection(pDlg->GetRangeText());
- break;
-
- default:
- {
- if (pShell->ISA(DrawViewShell))
- aPrintSelection.Select (
- static_cast<DrawViewShell*>(pShell)->GetCurPageId());
- else
- {
- if( msPageRange.Len() )
- aPrintSelection = MultiSelection( msPageRange );
- else
- aPrintSelection.Select(Range(1, nPageMax));
- }
- }
- break;
- }
-
- nPage = Min(nPageMax, (USHORT) aPrintSelection.FirstSelected());
-
- if ( nPage > 0 )
- nPage--;
-
- nPageMax = Min(nPageMax, (USHORT) aPrintSelection.LastSelected());
-
- if( bPrintOutline )
- nPrintCount++;
-
- if( bPrintHandout )
- nPrintCount++;
-
- if( bPrintDraw )
- nPrintCount++;
-
- if( bPrintNotes )
- nPrintCount++;
-
- nCopies = (pDlg ? pDlg->GetCopyCount() : 1);
-
- USHORT nSelectCount = (USHORT) aPrintSelection.GetSelectCount();
- nTotal = nSelectCount * nCopies * nPrintCount;
-
- if( pDlg && pDlg->IsCollateEnabled() && pDlg->IsCollateChecked() )
- nCollateCopies = nCopies;
-
- // check if selected range of pages contains transparent objects
- BOOL bContainsTransparency = FALSE;
- BOOL bPrintExcluded = TRUE;
-
- if( bPrintNotes || bPrintDraw || bPrintHandout )
- {
- if( pPrintOpts )
- bPrintExcluded = pPrintOpts->GetOptionsPrint().IsHiddenPages();
-
- for( USHORT j = nPage; ( j < nPageMax && !bContainsTransparency ); j++ )
- {
- if( aPrintSelection.IsSelected( j + 1 ) )
- {
- SdPage* pPage = mrBase.GetDocument()->GetSdPage(
- j, PK_STANDARD );
-
- if( pPage && ( !pPage->IsExcluded() || bPrintExcluded ) )
- {
- bContainsTransparency = (BOOL)pPage->HasTransparentObjects();
- if( !bContainsTransparency )
- {
- if(pPage->TRG_HasMasterPage())
- {
- bContainsTransparency = (BOOL)pPage->TRG_GetMasterPage().HasTransparentObjects();
- }
- }
- }
- }
- }
- }
-
- if (pPrinter->InitJob (mrBase.GetWindow(), !bIsAPI && bContainsTransparency))
- {
- PrintInfo aInfo(
- *pShell,
- *pPrinter,
- rProgress,
- aPrintSelection,
- aTimeDateStr,
- aTimeDateFont,
- pPrintOpts,
- nPageMax,
- nCollateCopies > 1 ? 1 : nCopies,
- nProgressOffset,
- nTotal);
-
- if( bPrintHandout )
- InitHandoutTemplate( aInfo, nSlidesPerHandout, bHandoutHorizontal );
-
- for( USHORT n = 1; n <= nCollateCopies; n++ )
- {
- if ( bPrintOutline )
- {
- // siehe unten in PrintOutline()
- pPrinter->SetPaperBin( nOldPaperBin );
-
- PrintOutline(aInfo, nPage);
- aInfo.mnProgressOffset += (nSelectCount * ( nCollateCopies > 1 ? 1 : nCopies));
- }
-
- if ( bPrintHandout )
- {
- PrintHandout(aInfo, nPage );
- aInfo.mnProgressOffset += (nSelectCount * ( nCollateCopies > 1 ? 1 : nCopies));
- }
- if( bPrintDraw )
- {
- PrintStdOrNotes(aInfo, nPage, PK_STANDARD, bPrintMarkedOnly);
- aInfo.mnProgressOffset += (nSelectCount * ( nCollateCopies > 1 ? 1 : nCopies));
- }
- if( bPrintNotes )
- {
- PrintStdOrNotes(aInfo, nPage, PK_NOTES, FALSE);
- aInfo.mnProgressOffset += (nSelectCount * ( nCollateCopies > 1 ? 1 : nCopies));
- }
-
- // When in duplex mode then add an empty page after printing
- // an odd number of pages. This is to avoid the first page
- // of the next run being printed on the backside of the
- // current page.
- if (nCollateCopies > 1
- && n<nCollateCopies
- && (pPrinter->GetCurPage()%2)==0
- && (pPrinter->GetDuplexMode()==DUPLEX_ON))
- {
- pPrinter->StartPage();
- pPrinter->EndPage();
- }
- }
- }
-
- pPrinter->SetOrientation( eOldOrientation );
- pPrinter->SetPrinterOptions( aOldPrinterOptions );
- pPrinter->SetMapMode( aOldMap );
-
- rOutliner.SetControlWord(nOldCntrl);
-
- // Druckerschach wieder zuruecksetzen
- pPrinter->SetPaperBin( nOldPaperBin );
- }
-
- return 0;
-
-}
-
-
-
-
-ErrCode PrintManager::DoPrint (
- SfxPrinter* pPrinter,
- PrintDialog* pPrintDialog,
- BOOL bSilent, BOOL bIsAPI )
-{
- ErrCode nResult = ERRCODE_NONE;
-
- do
- {
- ViewShell* pShell = mrBase.GetMainViewShell().get();
- if (pShell == NULL)
- break;
-
- if ( ! FitPageToPrinterWithDialog(pPrinter, bSilent))
- break;
-
- const SdrMarkList& rMarkList = pShell->GetView()->GetMarkedObjectList();
-
- // Retrieve the range of marked pages.
- String sNewPageRange (msPageRange);
-
- RestrictPrintingToSelection (FALSE);
-
- // #105477# Don't show query dialog if print dialog has been shown
- if ( !pPrintDialog
- && !bSilent && !bIsAPI
- && (rMarkList.GetMarkCount() || sNewPageRange.Len()) )
- {
- SvxPrtQryBox aQuery (mrBase.GetWindow());
-
- switch (aQuery.Execute())
- {
- case RET_CANCEL:
- nResult = ERRCODE_IO_ABORT;
- break;
-
- case RET_OK:
- RestrictPrintingToSelection (TRUE);
- SetPrintingPageRange (sNewPageRange);
- break;
- }
- }
-
- if (nResult == ERRCODE_NONE)
- {
- // Tell the printer which digit language to use.
- WindowUpdater* pWindowUpdater = pShell->GetWindowUpdater();
- if (pWindowUpdater != NULL)
- pWindowUpdater->Update (pPrinter, mrBase.GetDocument());
-
- // Forward the call to SfxViewShell::DoPrint() which
- // eventually calls Print() (after StartJob etc.)
- nResult = mrBase.SfxViewShell::DoPrint (
- pPrinter, pPrintDialog, bSilent, bIsAPI );
-
- RestrictPrintingToSelection (FALSE);
- }
- }
- while(false);
-
- return nResult;
-}
-
-
-
-
-void PrintManager::PreparePrint (PrintDialog* )
-{
- SfxPrinter* pPrinter = GetPrinter(TRUE);
-
- if (!pPrinter)
- return;
-
- const SfxItemSet& rOptions = pPrinter->GetOptions();
- SdOptionsPrintItem* pPrintOpts = NULL;
-
- if (rOptions.GetItemState( ATTR_OPTIONS_PRINT, FALSE,
- (const SfxPoolItem**) &pPrintOpts) != SFX_ITEM_SET)
- {
- pPrintOpts = NULL;
- }
-
- // Einstellungen der ersten zu druckenden Seite setzen
-
- if (pPrintOpts)
- {
- if ( pPrintOpts->GetOptionsPrint().IsHandout() )
- {
- // Handzettel
- SdPage* pPage = mrBase.GetDocument()->GetSdPage(0, PK_HANDOUT);
-
- // Papierschacht
- if (!pPrintOpts->GetOptionsPrint().IsPaperbin()) // Drucken NICHT aus Druckereinstellung
- {
- pPrinter->SetPaperBin(pPage->GetPaperBin());
- }
-
- pPrinter->SetOrientation(pPage->TRG_GetMasterPage().GetOrientation());
- }
- else if ( pPrintOpts->GetOptionsPrint().IsDraw() || pPrintOpts->GetOptionsPrint().IsNotes() )
- {
- // Standard- oder Notizseiten
- if( !pPrintOpts->GetOptionsPrint().IsPaperbin() ) // Drucken NICHT aus Druckereinstellung
- {
- PageKind ePageKind = PK_NOTES;
-
- if (pPrintOpts->GetOptionsPrint().IsDraw())
- {
- ePageKind = PK_STANDARD;
- }
-
- SdPage* pPage = mrBase.GetDocument()->GetSdPage(0, ePageKind);
- pPrinter->SetPaperBin(pPage->GetPaperBin());
-
- Orientation eOrientation = ORIENTATION_PORTRAIT;
-
- if ( !pPrintOpts->GetOptionsPrint().IsBooklet() )
- {
- eOrientation = pPage->GetOrientation();
- }
- else
- {
- Size aPageSize(pPage->GetSize());
-
- if( aPageSize.Width() < aPageSize.Height() )
- eOrientation = ORIENTATION_LANDSCAPE;
- }
-
- pPrinter->SetOrientation(eOrientation);
- }
- }
- }
-}
-
-
-
-
-void PrintManager::RestrictPrintingToSelection (bool bFlag)
-{
- mbPrintDirectSelected = bFlag ? TRUE : FALSE;
-}
-
-
-
-
-void PrintManager::SetPrintingPageRange (const String& rsPageRange)
-{
- msPageRange = rsPageRange;
-}
-
-
-
-
-bool PrintManager::FitPageToPrinterWithDialog (
- SfxPrinter* pPrinter,
- bool bSilent)
-{
- bool bContinuePrinting = true;
-
- if (pPrinter != NULL)
- {
- // Remember old printer values so that they can be restored when
- // printing is aborted by the user.
- const PrinterOptions aOldPrinterOptions (pPrinter->GetPrinterOptions());
- const MapMode aOldMap (pPrinter->GetMapMode());
-
- // Get values from the priner in order to decide whether to show a
- // dialog.
- const SfxItemSet& rOptions = pPrinter->GetOptions();
- SdOptionsPrintItem* pPrintOpts = NULL;
- BOOL bScalePage = TRUE;
- BOOL bTilePage = FALSE;
- BOOL bPrintBooklet = FALSE;
-
- if( rOptions.GetItemState( ATTR_OPTIONS_PRINT, FALSE, (const SfxPoolItem**) &pPrintOpts ) == SFX_ITEM_SET )
- {
- bScalePage = pPrintOpts->GetOptionsPrint().IsPagesize();
- bPrintBooklet = pPrintOpts->GetOptionsPrint().IsBooklet();
- pPrintOpts->GetOptionsPrint().SetCutPage( FALSE );
- }
- else
- pPrintOpts = NULL;
-
- SdPage* pPage = mrBase.GetDocument()->GetSdPage( 0, PK_STANDARD );
- Size aPageSize( pPage->GetSize() );
- Size aPrintSize( pPrinter->GetOutputSize() );
- long nPageWidth = aPageSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder();
- long nPageHeight = aPageSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder();
- long nPrintWidth = aPrintSize.Width();
- long nPrintHeight = aPrintSize.Height();
- USHORT nRet = RET_OK;
-
- // When necessary then show a dialog that asks the user how to fit
- // the pages to be printed to the (smaller) printer pages.
- if ( !bScalePage
- && !bTilePage
- && !bPrintBooklet
- && ( ( nPageWidth > nPrintWidth || nPageHeight > nPrintHeight )
- && ( nPageWidth > nPrintHeight || nPageHeight > nPrintWidth )
- )
- )
- {
- if (IsScreenFormat())
- {
- // For the screen format the page content is always scaled
- // to the printable area of the printer pages.
- pPrintOpts->GetOptionsPrint().SetPagesize();
- }
- else
- {
-
- SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
- AbstractSdPrintDlg* pDlg = pFact ? pFact->CreateSdPrintDlg(mrBase.GetWindow() ) : 0;
- // Do not show the dialog when the bSilent flag is set. We
- // do create the dialog anyway so that we can extract the
- // default method of mapping internal pages to printer pages
- // from it.
- if( ! bSilent && pDlg )
- nRet = pDlg->Execute();
- if( nRet == RET_OK )
- {
- switch (pDlg->GetAttr())
- {
- case 1:
- pPrintOpts->GetOptionsPrint().SetPagesize();
- break;
-
- case 2:
- // Tiling is the default behaviour in
- // ViewShell::PrintStdOrNotes(). The poperty of
- // pPrintOpts is ignored there so setting it
- // here may only lead to unwanted side effects.
- break;
-
- case 3:
- pPrintOpts->GetOptionsPrint().SetCutPage();
- break;
- }
- bContinuePrinting = true;
- }
- delete pDlg;
- }
- }
-
- // The user has pressed the 'Cancel' button. Restore the old values and
- // return a flag to tell the caller to abort printing.
- if( nRet == RET_CANCEL )
- {
- pPrinter->SetPrinterOptions( aOldPrinterOptions );
- pPrinter->SetMapMode( aOldMap );
- bContinuePrinting = false;
- }
- }
-
- return bContinuePrinting;
-}
-
-
-
-
-void PrintManager::PrintOutline (
- PrintInfo& rInfo,
- USHORT nPage)
-{
- // Papierschacht
- // Seiteneinstellungen koennen nicht fuer die Gliederung gemacht werden
- // (also auch nicht der Druckerschacht), deswegen wird der Druckerschacht
- // von der Seite PK_STANDARD genommen.
- /*
- if( pPrintOpts && !pPrintOpts->GetOptionsPrint().IsPaperbin() ) // Drucken NICHT aus Druckereinstellung
- {
- USHORT nPaperBin = GetDoc()->GetSdPage(nPage, PK_STANDARD)->GetPaperBin();
- rPrinter.SetPaperBin( nPaperBin );
- } */
- // Es wird jetzt (vorlaeufig ?) der Druckerschacht vom Drucker genommen
-
- const MapMode aOldMap( rInfo.mrPrinter.GetMapMode() );
- MapMode aMap( aOldMap );
- const Orientation eOldOrient = rInfo.mrPrinter.GetOrientation();
- Point aPageOfs( rInfo.mrPrinter.GetPageOffset() );
- Fraction aScale(1, 2);
- BOOL bPrintExcluded = TRUE;
-
- aMap.SetOrigin(Point() - aPageOfs);
- aMap.SetScaleX(aScale);
- aMap.SetScaleY(aScale);
- rInfo.mrPrinter.SetMapMode(aMap);
- rInfo.mrPrinter.SetOrientation(ORIENTATION_PORTRAIT);
-
- if ( rInfo.mpPrintOpts )
- bPrintExcluded = rInfo.mpPrintOpts->GetOptionsPrint().IsHiddenPages();
-
- Rectangle aOutRect(aPageOfs, rInfo.mrPrinter.GetOutputSize());
-
- Link aOldLink;
- Outliner* pOutliner = rInfo.mrViewShell.GetDoc()->GetInternalOutliner();
- pOutliner->Init( OUTLINERMODE_OUTLINEVIEW );
- USHORT nOutlMode = pOutliner->GetMode();
- BOOL bOldUpdateMode = pOutliner->GetUpdateMode();
-
- Size aPaperSize = pOutliner->GetPaperSize();
- pOutliner->SetPaperSize(aOutRect.GetSize());
- pOutliner->SetUpdateMode(TRUE);
-
- long nPageH = aOutRect.GetHeight();
-
- USHORT nPageCount = rInfo.mnProgressOffset;
-
- while ( nPage < rInfo.mnPageMax )
- {
- Paragraph* pPara = NULL;
- long nH = 0;
-
- pOutliner->Clear();
- pOutliner->SetFirstPageNumber(nPage+1);
-
- while ( nH < nPageH && nPage < rInfo.mnPageMax )
- {
- if ( rInfo.mrSelPages.IsSelected(nPage+1) )
- {
- //rProgress.SetState( nPageCount, nTotal );
- //rProgress.SetStateText( nPageCount, nPage+1, nTotal );
-
- String aTmp = UniString::CreateFromInt32( nPage+1 );
- aTmp += String( SdResId( STR_PRINT_OUTLINE ) );
- rInfo.mrProgress.SetStateText(nPageCount, aTmp, rInfo.mnTotal );
-
- nPageCount = nPageCount + rInfo.mnCopies;
-
- SdPage* pPage = (SdPage*)rInfo.mrViewShell.GetDoc()->GetSdPage(nPage, PK_STANDARD);
- SdrTextObj* pTextObj = NULL;
- ULONG nObj = 0;
-
- if ( !pPage->IsExcluded() || bPrintExcluded )
- {
- while ( !pTextObj && nObj < pPage->GetObjCount() )
- {
- SdrObject* pObj = pPage->GetObj(nObj++);
- if ( pObj->GetObjInventor() == SdrInventor &&
- pObj->GetObjIdentifier() == OBJ_TITLETEXT )
- pTextObj = (SdrTextObj*) pObj;
- }
-
- pPara = pOutliner->GetParagraph( pOutliner->GetParagraphCount() - 1 );
-
- if ( pTextObj && !pTextObj->IsEmptyPresObj() &&
- pTextObj->GetOutlinerParaObject() )
- pOutliner->AddText( *(pTextObj->GetOutlinerParaObject()) );
- else
- pOutliner->Insert(String());
-
- pTextObj = NULL;
- nObj = 0;
-
- while ( !pTextObj && nObj < pPage->GetObjCount() )
- {
- SdrObject* pObj = pPage->GetObj(nObj++);
- if ( pObj->GetObjInventor() == SdrInventor &&
- pObj->GetObjIdentifier() == OBJ_OUTLINETEXT )
- pTextObj = (SdrTextObj*) pObj;
- }
-
- BOOL bSubTitle = FALSE;
- if (!pTextObj)
- {
- bSubTitle = TRUE;
- pTextObj = (SdrTextObj*) pPage->GetPresObj(PRESOBJ_TEXT); // Untertitel vorhanden?
- }
-
- ULONG nParaCount1 = pOutliner->GetParagraphCount();
-
- if ( pTextObj && !pTextObj->IsEmptyPresObj() &&
- pTextObj->GetOutlinerParaObject() )
- pOutliner->AddText( *(pTextObj->GetOutlinerParaObject()) );
-
- if ( bSubTitle )
- {
- ULONG nParaCount2 = pOutliner->GetParagraphCount();
- for (ULONG nPara = nParaCount1; nPara < nParaCount2; nPara++)
- {
- Paragraph* pP = pOutliner->GetParagraph(nPara);
- if(pP && pOutliner->GetDepth( (USHORT) nPara ) > 0 )
- pOutliner->SetDepth(pP, 0);
- }
- }
-
- nH = pOutliner->GetTextHeight();
- }
- }
- nPage++;
- }
-
- if ( nH > nPageH && pPara )
- {
- ULONG nCnt = pOutliner->GetAbsPos( pOutliner->GetParagraph( pOutliner->GetParagraphCount() - 1 ) );
- ULONG nParaPos = pOutliner->GetAbsPos( pPara );
- nCnt -= nParaPos;
- pPara = pOutliner->GetParagraph( ++nParaPos );
- if ( nCnt && pPara )
- {
- pOutliner->Remove(pPara, nCnt);
- nPage--;
- }
- }
-
- rInfo.mrPrinter.StartPage();
- pOutliner->Draw(&rInfo.mrPrinter, aOutRect);
-
- if ( rInfo.mrTimeDateStr.Len() )
- {
- Font aOldFont = rInfo.mrPrinter.OutputDevice::GetFont();
- rInfo.mrPrinter.SetFont(rInfo.mrTimeDateFont);
- rInfo.mrPrinter.DrawText(aPageOfs, rInfo.mrTimeDateStr);
- rInfo.mrPrinter.SetFont(aOldFont);
- }
- rInfo.mrPrinter.EndPage();
- }
- pOutliner->SetUpdateMode(bOldUpdateMode);
- pOutliner->SetPaperSize(aPaperSize);
- pOutliner->Init( nOutlMode );
-
- rInfo.mrPrinter.SetOrientation(eOldOrient);
- rInfo.mrPrinter.SetMapMode( aOldMap );
-}
-
-
-
-
-void PrintManager::PrintHandout( PrintInfo& rInfo, USHORT nPage )
-{
- SdPage* pPage = rInfo.mrViewShell.GetDoc()->GetSdPage(0, PK_HANDOUT);
- SdPage& rMaster = (SdPage&)pPage->TRG_GetMasterPage();
- SdDrawDocument* pDocument = rInfo.mrViewShell.GetDoc();
-
- BOOL bScalePage = TRUE;
- if ( rInfo.mpPrintOpts )
- {
- bScalePage = rInfo.mpPrintOpts->GetOptionsPrint().IsPagesize();
- }
-
- // Papierschacht
- if( rInfo.mpPrintOpts && !rInfo.mpPrintOpts->GetOptionsPrint().IsPaperbin() ) // Drucken NICHT aus Druckereinstellung
- {
- USHORT nPaperBin = pPage->GetPaperBin();
- rInfo.mrPrinter.SetPaperBin( nPaperBin );
- }
-
- // Hoch/Querformat aendern?
- Orientation eOrientation = rMaster.GetOrientation();
-
- short nDlgResult = RET_OK;
-
- if ( !rInfo.mrPrinter.SetOrientation(eOrientation) &&
- (!rInfo.mpPrintOpts || rInfo.mpPrintOpts->GetOptionsPrint().IsWarningOrientation()) )
- {
- // eine Warnung anzeigen
- WarningBox aWarnBox(rInfo.mrViewShell.GetActiveWindow(),(WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL),
- String(SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
- nDlgResult = aWarnBox.Execute();
- }
-
- if ( nDlgResult == RET_OK )
- {
- const MapMode aOldMap( rInfo.mrPrinter.GetMapMode() );
- MapMode aMap( aOldMap );
- Point aPageOfs( rInfo.mrPrinter.GetPageOffset() );
- DrawView* pPrintView;
- BOOL bPrintExcluded = TRUE;
-
- aMap.SetOrigin(Point() - aPageOfs);
-
- if ( bScalePage )
- {
- Size aPageSize(pPage->GetSize());
- Size aPrintSize( rInfo.mrPrinter.GetOutputSize() );
-
- double fHorz = (double) aPrintSize.Width() / aPageSize.Width();
- double fVert = (double) aPrintSize.Height() / aPageSize.Height();
-
- Fraction aFract;
- if ( fHorz < fVert )
- aFract = Fraction(aPrintSize.Width(), aPageSize.Width());
- else
- aFract = Fraction(aPrintSize.Height(), aPageSize.Height());
-
- aMap.SetScaleX(aFract);
- aMap.SetScaleY(aFract);
- aMap.SetOrigin(Point());
- }
-
- rInfo.mrPrinter.SetMapMode(aMap);
-
- if (rInfo.mrViewShell.ISA(DrawViewShell))
- pPrintView = new DrawView (rInfo.mrViewShell.GetDocSh(), &rInfo.mrPrinter,
- static_cast<DrawViewShell*>(&rInfo.mrViewShell));
- else
- pPrintView = new DrawView (rInfo.mrViewShell.GetDocSh(), &rInfo.mrPrinter, NULL);
-
- USHORT nPageCount = rInfo.mnProgressOffset;
-
- rInfo.mrViewShell.WriteFrameViewData();
-
- rInfo.mrViewShell.SetPrintedHandoutPageNum(0);
-
- if ( rInfo.mpPrintOpts )
- bPrintExcluded = rInfo.mpPrintOpts->GetOptionsPrint().IsHiddenPages();
-
- std::vector< SdPage* > aPagesVector;
- while ( nPage < rInfo.mnPageMax )
- {
- nPage++;
- if( rInfo.mrSelPages.IsSelected(nPage) )
- {
- SdPage* pTemp = pDocument->GetSdPage(nPage-1, PK_STANDARD);
- if( !pTemp->IsExcluded() || bPrintExcluded )
- aPagesVector.push_back( pTemp );
- }
- }
-
- std::vector< SdrPageObj* > aPageObjVector;
- SdrObjListIter aShapeIter( *pPage );
- while( aShapeIter.IsMore() )
- {
- SdrPageObj* pPageObj = dynamic_cast< SdrPageObj* >(aShapeIter.Next());
- if( pPageObj )
- aPageObjVector.push_back( pPageObj );
- }
-
- if( aPageObjVector.empty() )
- return;
-
- rInfo.mrViewShell.SetPrintedHandoutPageCount( (USHORT)((aPagesVector.size() + aPageObjVector.size() - 1) / aPageObjVector.size()) );
-
-/*
- sal_Int32 nHandoutPageCount = aPagesVector.size() / aPageObjVector.size();
- sal_Int32 nHandoutPage = 0;
-*/
- std::vector< SdPage* >::iterator aPageIter( aPagesVector.begin() );
- while( aPageIter != aPagesVector.end() )
- {
- std::vector< SdrPageObj* >::iterator aPageObjIter( aPageObjVector.begin() );
-
- while( (aPageObjIter != aPageObjVector.end()) && (aPageIter != aPagesVector.end()) )
- {
- SdrPageObj* pPageObj = (*aPageObjIter++);
- pPageObj->SetReferencedPage( (*aPageIter++) );
- }
-
- // if there are more page objects than pages left, set the rest to invisible
- int nHangoverCount = 0;
- while(aPageObjIter != aPageObjVector.end())
- {
- (*aPageObjIter++)->SetReferencedPage(0L);
- nHangoverCount++;
- }
-
- if( nHangoverCount )
- {
- int nSkip = aPageObjVector.size() - nHangoverCount;
- aShapeIter.Reset();
- while( aShapeIter.IsMore() )
- {
- SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( aShapeIter.Next() );
- if( pPathObj )
- {
- if( nSkip )
- {
- nSkip--;
- }
- else
- {
- pPathObj->SetMergedItem( XLineStyleItem(XLINE_NONE) );
- }
- }
- }
- }
-
- // todo progress
- String aTmp = UniString::CreateFromInt32( nPage );
- aTmp += String( SdResId( STR_PRINT_HANDOUT ) );
- rInfo.mrProgress.SetStateText( nPageCount, aTmp, rInfo.mnTotal );
-
- rInfo.mrViewShell.SetPrintedHandoutPageNum(rInfo.mrViewShell.GetPrintedHandoutPageNum() + 1);
-
- rInfo.mrPrinter.StartPage();
- pPrintView->ShowSdrPage(pPage); // , Point());
-
- SdrPageView* pPageView = pPrintView->GetSdrPageView(); // pPage);
- pPageView->SetVisibleLayers(rInfo.mrViewShell.GetFrameView()->GetVisibleLayers() );
- pPageView->SetPrintableLayers(rInfo.mrViewShell.GetFrameView()->GetPrintableLayers() );
-
- pPrintView->CompleteRedraw(&rInfo.mrPrinter, Rectangle(Point(0,0), pPage->GetSize()));
-
- if ( rInfo.mrTimeDateStr.Len() )
- {
- Font aOldFont = rInfo.mrPrinter.OutputDevice::GetFont();
- rInfo.mrPrinter.SetFont(rInfo.mrTimeDateFont);
- rInfo.mrPrinter.DrawText(aPageOfs, rInfo.mrTimeDateStr);
- rInfo.mrPrinter.SetFont(aOldFont);
- }
- rInfo.mrPrinter.EndPage();
- pPrintView->HideSdrPage(); // pPrintView->GetPageView(pPage));
-
- if( nHangoverCount )
- {
- aShapeIter.Reset();
- while( aShapeIter.IsMore() )
- {
- SdrPathObj* pPathObj = dynamic_cast< SdrPathObj* >( aShapeIter.Next() );
- if( pPathObj )
- pPathObj->SetMergedItem( XLineStyleItem(XLINE_SOLID) );
- }
- }
-
- }
-
- rInfo.mrViewShell.SetPrintedHandoutPageNum(1);
- rInfo.mrViewShell.SetPrintedHandoutPageCount(0);
- delete pPrintView;
- rInfo.mrPrinter.SetMapMode(aOldMap);
- }
-}
-
-
-
-
-void PrintManager::PrintStdOrNotes (
- PrintInfo& rInfo,
- USHORT nPage,
- PageKind ePageKind,
- BOOL bPrintMarkedOnly)
-{
- Fraction aFract;
- BOOL bScalePage = TRUE;
- BOOL bTilePage = FALSE;
- BOOL bPrintExcluded = TRUE;
- BOOL bPrintPageName = TRUE;
- BOOL bPrintBooklet = FALSE;
- BOOL bPrintFrontPage = FALSE;
- BOOL bPrintBackPage = FALSE;
- SdDrawDocument* pDocument = rInfo.mrViewShell.GetDoc();
-
- SdPage* pRefPage = pDocument->GetSdPage(nPage, ePageKind);
-
- if ( rInfo.mpPrintOpts )
- {
- bScalePage = rInfo.mpPrintOpts->GetOptionsPrint().IsPagesize();
- bTilePage = rInfo.mpPrintOpts->GetOptionsPrint().IsPagetile();
- bPrintPageName = rInfo.mpPrintOpts->GetOptionsPrint().IsPagename();
- bPrintExcluded = rInfo.mpPrintOpts->GetOptionsPrint().IsHiddenPages();
- bPrintBooklet = rInfo.mpPrintOpts->GetOptionsPrint().IsBooklet();
- bPrintFrontPage = rInfo.mpPrintOpts->GetOptionsPrint().IsFrontPage();
- bPrintBackPage = rInfo.mpPrintOpts->GetOptionsPrint().IsBackPage();
-
- // Papierschacht
- if( !rInfo.mpPrintOpts->GetOptionsPrint().IsPaperbin() ) // Drucken NICHT aus Druckereinstellung
- {
- USHORT nPaperBin = pDocument->GetSdPage(nPage, ePageKind)->GetPaperBin();
- rInfo.mrPrinter.SetPaperBin( nPaperBin );
- }
-
- }
-
- // Hoch/Querformat aendern?
- Size aPageSize(pRefPage->GetSize());
- Orientation eOrientation = ORIENTATION_PORTRAIT;
-
- short nDlgResult = RET_OK;
-
- if( !bPrintBooklet )
- {
- eOrientation = pRefPage->GetOrientation();
- }
- else if( aPageSize.Width() < aPageSize.Height() )
- eOrientation = ORIENTATION_LANDSCAPE;
-
- if ( !rInfo.mrPrinter.SetOrientation(eOrientation) &&
- (!rInfo.mpPrintOpts || rInfo.mpPrintOpts->GetOptionsPrint().IsWarningOrientation()) )
- {
- // eine Warnung anzeigen
- WarningBox aWarnBox(
- rInfo.mrViewShell.GetActiveWindow(),
- (WinBits)(WB_OK_CANCEL | WB_DEF_CANCEL),
- String(SdResId(STR_WARN_PRINTFORMAT_FAILURE)));
- nDlgResult = aWarnBox.Execute();
- }
-
- if ( nDlgResult == RET_OK )
- {
- const MapMode aOldMap( rInfo.mrPrinter.GetMapMode() );
- MapMode aMap( aOldMap );
- Point aPageOfs( rInfo.mrPrinter.GetPageOffset() );
- DrawView* pPrintView;
-
- aMap.SetOrigin(Point() - aPageOfs);
- rInfo.mrPrinter.SetMapMode(aMap);
- Size aPrintSize( rInfo.mrPrinter.GetOutputSize() );
-
- if (rInfo.mrViewShell.ISA(DrawViewShell))
- pPrintView = new DrawView (rInfo.mrViewShell.GetDocSh(), &rInfo.mrPrinter,
- static_cast<DrawViewShell*>(&rInfo.mrViewShell));
- else
- pPrintView = new DrawView (rInfo.mrViewShell.GetDocSh(), &rInfo.mrPrinter, NULL);
-
- USHORT nPageCount = rInfo.mnProgressOffset;
-
- // Als Broschuere drucken ?
- if( bPrintBooklet )
- {
- MapMode aStdMap( rInfo.mrPrinter.GetMapMode() );
- ::std::vector< USHORT > aPageVector;
- ::std::vector< ::std::pair< USHORT, USHORT > > aPairVector;
- Point aOffset;
- Size aPrintSize_2( aPrintSize );
- Size aPageSize_2( aPageSize );
-
- if( eOrientation == ORIENTATION_LANDSCAPE )
- aPrintSize_2.Width() >>= 1;
- else
- aPrintSize_2.Height() >>= 1;
-
- const double fPageWH = (double) aPageSize_2.Width() / aPageSize_2.Height();
- const double fPrintWH = (double) aPrintSize_2.Width() / aPrintSize_2.Height();
-
- if( fPageWH < fPrintWH )
- {
- aPageSize_2.Width() = (long) ( aPrintSize_2.Height() * fPageWH );
- aPageSize_2.Height()= aPrintSize_2.Height();
- }
- else
- {
- aPageSize_2.Width() = aPrintSize_2.Width();
- aPageSize_2.Height() = (long) ( aPrintSize_2.Width() / fPageWH );
- }
-
- aMap.SetScaleX( Fraction( aPageSize_2.Width(), aPageSize.Width() ) );
- aMap.SetScaleY( Fraction( aPageSize_2.Height(), aPageSize.Height() ) );
-
- // calculate adjusted print size
- aPrintSize = OutputDevice::LogicToLogic( aPrintSize, aStdMap, aMap );
-
- if( eOrientation == ORIENTATION_LANDSCAPE )
- {
- aOffset.X() = ( ( aPrintSize.Width() >> 1 ) - aPageSize.Width() ) >> 1;
- aOffset.Y() = ( aPrintSize.Height() - aPageSize.Height() ) >> 1;
- }
- else
- {
- aOffset.X() = ( aPrintSize.Width() - aPageSize.Width() ) >> 1;
- aOffset.Y() = ( ( aPrintSize.Height() >> 1 ) - aPageSize.Height() ) >> 1;
- }
-
- // create vector of pages to print
- while( nPage < rInfo.mnPageMax )
- {
- if( rInfo.mrSelPages.IsSelected( nPage + 1 ) )
- {
- SdPage* pP = pDocument->GetSdPage( nPage, ePageKind );
-
- if( pP && ( !pP->IsExcluded() || bPrintExcluded ) )
- aPageVector.push_back( nPage );
- }
-
- nPage++;
- }
-
- // create pairs of pages to print on each page
- if( aPageVector.size() )
- {
- sal_uInt32 nFirstIndex = 0, nLastIndex = aPageVector.size() - 1;
-
- if( aPageVector.size() & 1 )
- aPairVector.push_back( ::std::make_pair( (USHORT) 65535, aPageVector[ nFirstIndex++ ] ) );
- else
- aPairVector.push_back( ::std::make_pair( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ) );
-
- while( nFirstIndex < nLastIndex )
- {
- if( nFirstIndex & 1 )
- aPairVector.push_back( ::std::make_pair( aPageVector[ nFirstIndex++ ], aPageVector[ nLastIndex-- ] ) );
- else
- aPairVector.push_back( ::std::make_pair( aPageVector[ nLastIndex-- ], aPageVector[ nFirstIndex++ ] ) );
- }
- }
-
- for( sal_uInt32 i = 0; i < aPairVector.size(); i++ )
- {
- if( ( !( i & 1 ) && bPrintFrontPage ) || ( ( i & 1 ) && bPrintBackPage ) )
- {
- const ::std::pair< USHORT, USHORT > aPair( aPairVector[ i ] );
-
- rInfo.mrPrinter.StartPage();
-
- SdPage* pPageToPrint = pDocument->GetSdPage( aPair.first, ePageKind );
-
- if( pPageToPrint )
- {
- aMap.SetOrigin( aOffset );
- rInfo.mrPrinter.SetMapMode( aMap );
- PrintPage(rInfo, pPrintView, pPageToPrint, bPrintMarkedOnly );
- }
-
- pPageToPrint = pDocument->GetSdPage( aPair.second, ePageKind );
-
- if( pPageToPrint )
- {
- Point aSecondOffset( aOffset );
-
- if( eOrientation == ORIENTATION_LANDSCAPE )
- aSecondOffset.X() += ( aPrintSize.Width() >> 1 );
- else
- aSecondOffset.Y() += ( aPrintSize.Height() >> 1 );
-
- aMap.SetOrigin( aSecondOffset );
- rInfo.mrPrinter.SetMapMode( aMap );
- PrintPage(rInfo, pPrintView, pPageToPrint, bPrintMarkedOnly );
- }
-
- rInfo.mrPrinter.EndPage();
- }
- }
-
- rInfo.mrPrinter.SetMapMode( aStdMap );
- }
- else
- {
- rInfo.mrViewShell.WriteFrameViewData();
- Point aPtZero;
-
- while ( nPage < rInfo.mnPageMax )
- {
- if (rInfo.mrSelPages.IsSelected(nPage+1) )
- {
- SdPage* pPage = pDocument->GetSdPage(nPage, ePageKind);
- // Kann sich die Seitengroesse geaendert haben?
- aPageSize = pPage->GetSize();
-
- rInfo.mrProgress.SetState( nPageCount, rInfo.mnTotal );
- nPageCount = nPageCount + rInfo.mnCopies;
-
- if ( bScalePage )
- {
- double fHorz = (double) aPrintSize.Width() / aPageSize.Width();
- double fVert = (double) aPrintSize.Height() / aPageSize.Height();
-
- if ( fHorz < fVert )
- aFract = Fraction(aPrintSize.Width(), aPageSize.Width());
- else
- aFract = Fraction(aPrintSize.Height(), aPageSize.Height());
-
- aMap.SetScaleX(aFract);
- aMap.SetScaleY(aFract);
- aMap.SetOrigin(Point());
- }
-
- if ( !pPage->IsExcluded() || bPrintExcluded )
- {
- String aTmp = UniString::CreateFromInt32( nPage+1 );
-
- if(ePageKind == PK_NOTES)
- aTmp += String( SdResId( STR_PRINT_NOTES ) );
- else
- aTmp += String( SdResId( STR_PRINT_DRAWING ) );
- rInfo.mrProgress.SetStateText( nPageCount, aTmp, rInfo.mnTotal );
-
- String aPageStr;
- if ( bPrintPageName )
- {
- aPageStr = pPage->GetName();
- aPageStr += (sal_Unicode)' ';
- }
- aPageStr += rInfo.mrTimeDateStr;
-
- MapMode aStdMap = rInfo.mrPrinter.GetMapMode();
- rInfo.mrPrinter.SetMapMode(aMap);
-
- //
- BOOL bPrint = TRUE;
- Point aPageOrigin;
- long aPageWidth = aPageSize.Width() - pPage->GetLftBorder() - pPage->GetRgtBorder();
- long aPageHeight = aPageSize.Height() - pPage->GetUppBorder() - pPage->GetLwrBorder();
- long aPrintWidth = aPrintSize.Width();
- long aPrintHeight = aPrintSize.Height();
-
- // Bugfix zu 44530:
- // Falls implizit umgestellt wurde (Landscape/Portrait)
- // wird dies beim Kacheln, bzw. aufteilen (Poster) beruecksichtigt
- BOOL bSwitchPageSize = FALSE;
- if( ( aPrintWidth > aPrintHeight && aPageWidth < aPageHeight ) ||
- ( aPrintWidth < aPrintHeight && aPageWidth > aPageHeight ) )
- {
- bSwitchPageSize = TRUE;
- aPrintWidth = aPrintSize.Height();
- aPrintHeight = aPrintSize.Width();
- }
-
- // Eine (kleine) Seite, die gekachelt ausgegeben werden soll
- if( bTilePage &&
- aPageWidth < aPrintWidth &&
- aPageHeight < aPrintHeight )
- {
- aPageWidth += 500;
- aPageHeight += 500;
- Point aPrintOrigin;
-
- rInfo.mrPrinter.StartPage();
- pPrintView->ShowSdrPage( pPage );
-
- SdrPageView* pPageView = pPrintView->GetSdrPageView(); // pPage);
- pPageView->SetVisibleLayers(rInfo.mrViewShell.GetFrameView()->GetVisibleLayers() );
- pPageView->SetPrintableLayers(rInfo.mrViewShell.GetFrameView()->GetPrintableLayers() );
-
- long nPagesPrinted = 0; // Fuer Bedingung s.u.
- BOOL bPrintPage; // Fuer Bedingung s.u.
-
- while( bPrint )
- {
- BOOL bWidth = aPageWidth < aPrintWidth;
- BOOL bHeight = aPageHeight < aPrintHeight;
- if( !bWidth && !bHeight )
- bPrint = FALSE;
-
- // Etwas umstaendliche Abfrage, die ausdrueckt, ob eine Seite
- // beim Kacheln abgeschnitten oder gar nicht dargestellt werden
- // soll. Die Bedingung ist, dass eine 2. Seite (horz. oder vert.)
- // immer gedruck wird, waehrend eine dritte Seite (oder hoeher)
- // nur noch gedruckt wird, wenn diese auch noch vollstaendig
- // aufs Papier passt.
- if( nPagesPrinted < 4 && !( !bWidth && nPagesPrinted == 2 ) )
- bPrintPage = TRUE;
- else
- bPrintPage = FALSE;
- nPagesPrinted++;
-
- if( ( bWidth && bHeight ) || bPrintPage )
- {
- aStdMap.SetOrigin( aPrintOrigin );
- rInfo.mrPrinter.SetMapMode( aStdMap );
-
- if (rInfo.mrViewShell.ISA(DrawViewShell) && bPrintMarkedOnly )
- {
- rInfo.mrViewShell.GetView()->DrawMarkedObj(rInfo.mrPrinter);
- }
- else
- pPrintView->CompleteRedraw( &rInfo.mrPrinter, Rectangle( aPtZero, aPageSize ) );
- }
- if( bWidth )
- {
- aPrintOrigin.X() += aPageWidth;
- aPrintWidth -= aPageWidth;
- }
- else if( bHeight )
- {
- aPrintOrigin.X() = 0;
- aPrintWidth = bSwitchPageSize ? aPrintSize.Height() : aPrintSize.Width();
- aPrintOrigin.Y() += aPageHeight;
- aPrintHeight -= aPageHeight;
- }
- }
-
- if ( aPageStr.Len() )
- {
- Font aOldFont = rInfo.mrPrinter.OutputDevice::GetFont();
- rInfo.mrPrinter.SetFont(rInfo.mrTimeDateFont);
- rInfo.mrPrinter.DrawText(aPageOfs, aPageStr);
- rInfo.mrPrinter.SetFont(aOldFont);
- }
- rInfo.mrPrinter.EndPage();
- pPrintView->HideSdrPage(); // pPrintView->GetPageView(pPage));
-
- bPrint = FALSE;
- }
-
- // For pages larger then the printable area there
- // are three options:
- // 1. Scale down to the page to the printable area.
- // 2. Print only the upper left part of the page
- // (without the unprintable borders).
- // 3. Split the page into parts of the size of the
- // printable area.
- if (bPrint)
- {
- const bool bCutPage (rInfo.mpPrintOpts && rInfo.mpPrintOpts->GetOptionsPrint().IsCutPage());
- if (bScalePage || bCutPage)
- {
- // Handle 1 and 2.
-
- // if CutPage is set then do not move
- // it, otherwise move the scaled page
- // to printable area
-
- PrintPagePart(
- rInfo,
- pPage,
- *pPrintView,
- bCutPage ? Point(-aPageOfs.X(), -aPageOfs.Y()) : Point(0,0),
- bPrintMarkedOnly,
- aPageStr,
- aPageOfs);
- }
- else
- {
- // Handle 3. Print parts of the page in the
- // size of the printable area until the
- // whole page is covered.
-
- // keep the page content at its
- // position if it fits, otherwise move
- // it to the printable area
- Point aOrigin (aPageWidth < aPrintWidth ? -aPageOfs.X() : 0, aPageHeight < aPrintHeight ? -aPageOfs.Y() : 0);
-
- for (aPageOrigin = aOrigin;
- -aPageOrigin.Y()<aPageHeight;
- aPageOrigin.Y() -= aPrintHeight)
- {
- for (aPageOrigin.X()=aOrigin.X();
- -aPageOrigin.X()<aPageWidth;
- aPageOrigin.X() -= aPrintWidth)
- {
- PrintPagePart(
- rInfo,
- pPage,
- *pPrintView,
- aPageOrigin,
- bPrintMarkedOnly,
- aPageStr,
- aPageOfs);
- }
- }
- }
- }
- }
- }
- nPage++;
- }
- }
-
- delete pPrintView;
- rInfo.mrPrinter.SetMapMode( aOldMap );
- }
-}
-
-
-
-
-void PrintManager::PrintPagePart (
- PrintInfo& rInfo,
- SdPage* pPage,
- DrawView& rPrintView,
- const Point& rPageOrigin,
- BOOL bPrintMarkedOnly,
- const String& rsPageString,
- const Point& rStringOffset)
-{
- rInfo.mrPrinter.StartPage();
- rPrintView.ShowSdrPage(pPage); // , Point(0,0));
-
- // Set origin of the map mode so that the next part of the page is
- // printed.
- MapMode aOriginalMapMode = rInfo.mrPrinter.GetMapMode();
- MapMode aMapMode = rInfo.mrPrinter.GetMapMode();
- aMapMode.SetOrigin(rPageOrigin);
- rInfo.mrPrinter.SetMapMode(aMapMode);
-
- SdrPageView* pPageView = rPrintView.GetSdrPageView(); // pPage);
- pPageView->SetVisibleLayers(rInfo.mrViewShell.GetFrameView()->GetVisibleLayers() );
- pPageView->SetPrintableLayers(rInfo.mrViewShell.GetFrameView()->GetPrintableLayers() );
-
- if (rInfo.mrViewShell.ISA(DrawViewShell) && bPrintMarkedOnly)
- rInfo.mrViewShell.GetView()->DrawMarkedObj(rInfo.mrPrinter);
- else
- rPrintView.CompleteRedraw(&rInfo.mrPrinter, Rectangle(Point(0,0), pPage->GetSize()));
- rInfo.mrPrinter.SetMapMode(aOriginalMapMode);
-
- if (rsPageString.Len())
- {
- Font aOldFont = rInfo.mrPrinter.OutputDevice::GetFont();
- rInfo.mrPrinter.SetFont(rInfo.mrTimeDateFont);
- rInfo.mrPrinter.DrawText(rStringOffset, rsPageString);
- rInfo.mrPrinter.SetFont(aOldFont);
- }
- rInfo.mrPrinter.EndPage();
- rPrintView.HideSdrPage(); // rPrintView.GetPageView(pPage));
-}
-
-
-
-
-
-void PrintManager::PrintPage (
- PrintInfo& rInfo,
- ::sd::View* pPrintView,
- SdPage* pPage,
- BOOL bPrintMarkedOnly)
-{
- Point aPtZero;
- pPrintView->ShowSdrPage( pPage ); // , aPtZero );
-
- SdrPageView* pPageView = pPrintView->GetSdrPageView(); // pPage );
- pPageView->SetVisibleLayers(rInfo.mrViewShell.GetFrameView()->GetVisibleLayers() );
- pPageView->SetPrintableLayers(rInfo.mrViewShell.GetFrameView()->GetPrintableLayers() );
-
- if (rInfo.mrViewShell.ISA(DrawViewShell) && bPrintMarkedOnly)
- rInfo.mrViewShell.GetView()->DrawMarkedObj(rInfo.mrPrinter);
- else
- pPrintView->CompleteRedraw(&rInfo.mrPrinter, Rectangle(Point(0,0), pPage->GetSize()));
-
- pPrintView->HideSdrPage(); // pPrintView->GetPageView( pPage ) );
-}
-
-
-
-
-bool PrintManager::IsScreenFormat (void)
-{
- // Determine the page size.
- SdPage* pPage = mrBase.GetDocument()->GetSdPage(0, PK_STANDARD);
- Size aPaperSize (pPage->GetSize());
-
- // Take Orientation into account.
- if (pPage->GetOrientation() == ORIENTATION_LANDSCAPE)
- Swap(aPaperSize);
-
- // Check whether paper size is 'Screen'
- Paper ePaper(SvxPaperInfo::GetSvxPaper(aPaperSize, MAP_100TH_MM, TRUE));
- return (ePaper == PAPER_SCREEN);
-}
-
-
-void PrintManager::InitHandoutTemplate( PrintInfo& /*rInfo*/, USHORT nSlidesPerHandout, BOOL bHandoutHorizontal )
-{
- AutoLayout eLayout = AUTOLAYOUT_HANDOUT6;
- switch( nSlidesPerHandout )
- {
- case 1: eLayout = AUTOLAYOUT_HANDOUT1; break;
- case 2: eLayout = AUTOLAYOUT_HANDOUT2; break;
- case 3: eLayout = AUTOLAYOUT_HANDOUT3; break;
- case 4: eLayout = AUTOLAYOUT_HANDOUT4; break;
- case 9: eLayout = AUTOLAYOUT_HANDOUT9; break;
- }
-
- if( !mrBase.GetDocument() )
- return;
-
- SdDrawDocument& rModel = *mrBase.GetDocument();
-
- // first, prepare handout page (not handout master)
-
- SdPage* pHandout = rModel.GetSdPage(0, PK_HANDOUT);
- if( !pHandout )
- return;
-
- // delete all previous shapes from handout page
- while( pHandout->GetObjCount() )
- {
- SdrObject* pObj = pHandout->NbcRemoveObject(0);
- if( pObj )
- SdrObject::Free( pObj );
- }
-
- const bool bDrawLines = eLayout == AUTOLAYOUT_HANDOUT3;
-
- std::vector< Rectangle > aAreas;
- SdPage::CalculateHandoutAreas( rModel, eLayout, bHandoutHorizontal, aAreas );
-
- std::vector< Rectangle >::iterator iter( aAreas.begin() );
- while( iter != aAreas.end() )
- {
- pHandout->NbcInsertObject( new SdrPageObj((*iter++)) );
-
- if( bDrawLines && (iter != aAreas.end()) )
- {
- Rectangle aRect( (*iter++) );
-
- basegfx::B2DPolygon aPoly;
- aPoly.insert(0, basegfx::B2DPoint( aRect.Left(), aRect.Top() ) );
- aPoly.insert(1, basegfx::B2DPoint( aRect.Right(), aRect.Top() ) );
-
- const basegfx::B2DHomMatrix aMatrix(basegfx::tools::createTranslateB2DHomMatrix(
- 0.0, static_cast< double >( aRect.GetHeight() / 7 )));
- basegfx::B2DPolyPolygon aPathPoly;
-
- for( sal_uInt16 nLine = 0; nLine < 7; nLine++ )
- {
- aPoly.transform( aMatrix );
- aPathPoly.append( aPoly );
- }
-
- SdrPathObj* pPathObj = new SdrPathObj(OBJ_PATHLINE, aPathPoly );
- pPathObj->SetMergedItem( XLineStyleItem(XLINE_SOLID) );
- pPathObj->SetMergedItem( XLineColorItem(String(), Color(COL_BLACK)));
-
- pHandout->NbcInsertObject( pPathObj );
- }
- }
-}
-
-} // end of namespace sd
diff --git a/sd/source/ui/view/ViewShellBase.cxx b/sd/source/ui/view/ViewShellBase.cxx
index 3e0f6297f8d6..431add66bc2b 100644
--- a/sd/source/ui/view/ViewShellBase.cxx
+++ b/sd/source/ui/view/ViewShellBase.cxx
@@ -33,8 +33,8 @@
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/frame/UnknownModuleException.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
+#include <com/sun/star/frame/UnknownModuleException.hpp>
+#include <com/sun/star/frame/XModuleManager.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -54,7 +54,6 @@
#include "NotesChildWindow.hxx"
#include "ViewShellManager.hxx"
#include "DrawController.hxx"
-#include "PrintManager.hxx"
#include "UpdateLockManager.hxx"
#include "FrameView.hxx"
#include "ViewTabBar.hxx"
@@ -62,6 +61,7 @@
#include "drawdoc.hxx"
#include <sfx2/dispatch.hxx>
#include <sfx2/request.hxx>
+#include <sfx2/printer.hxx>
#include "DrawViewShell.hxx"
#include "GraphicViewShell.hxx"
#include "OutlineViewShell.hxx"
@@ -72,6 +72,7 @@
#include "ToolBarManager.hxx"
#include "Window.hxx"
#include "framework/ConfigurationController.hxx"
+#include "DocumentRenderer.hxx"
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/awt/XWindow.hpp>
@@ -92,6 +93,7 @@
#include <sfx2/viewfrm.hxx>
#include <svl/whiter.hxx>
#include <comphelper/processfactory.hxx>
+#include <vcl/msgbox.hxx>
#include "fubullet.hxx"
@@ -162,9 +164,6 @@ public:
::boost::shared_ptr<UpdateLockManager> mpUpdateLockManager;
- /// The print manager is responsible for printing documents.
- ::boost::shared_ptr<PrintManager> mpPrintManager;
-
::boost::shared_ptr<FormShellManager> mpFormShellManager;
::boost::shared_ptr<CustomHandleManager> mpCustomHandleManager;
@@ -299,7 +298,6 @@ ViewShellBase::ViewShellBase (
mpImpl->mpViewWindow.reset(new FocusForwardingWindow(_pFrame->GetWindow(),*this));
mpImpl->mpViewWindow->SetBackground(Wallpaper());
mpImpl->mpUpdateLockManager.reset(new UpdateLockManager(*this));
- mpImpl->mpPrintManager.reset(new PrintManager(*this));
_pFrame->GetWindow().SetBackground(Wallpaper());
@@ -598,12 +596,21 @@ ErrCode ViewShellBase::DoVerb (long nVerb)
+Reference<view::XRenderable> ViewShellBase::GetRenderable (void)
+{
+ // Create a new DocumentRenderer on every call. It observes the life
+ // time of this ViewShellBase object.
+ return Reference<view::XRenderable>(new DocumentRenderer(*this));
+}
+
+
+
+
SfxPrinter* ViewShellBase::GetPrinter (BOOL bCreate)
{
OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
- return mpImpl->mpPrintManager->GetPrinter(bCreate);
+ return GetDocShell()->GetPrinter (bCreate);
}
@@ -615,9 +622,48 @@ USHORT ViewShellBase::SetPrinter (
bool bIsAPI)
{
OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
- return mpImpl->mpPrintManager->SetPrinter (pNewPrinter, nDiffFlags, bIsAPI);
+ GetDocShell()->SetPrinter(pNewPrinter);
+
+ if ( (nDiffFlags & SFX_PRINTER_CHG_ORIENTATION ||
+ nDiffFlags & SFX_PRINTER_CHG_SIZE) && pNewPrinter )
+ {
+ MapMode aMap = pNewPrinter->GetMapMode();
+ aMap.SetMapUnit(MAP_100TH_MM);
+ MapMode aOldMap = pNewPrinter->GetMapMode();
+ pNewPrinter->SetMapMode(aMap);
+ Size aNewSize = pNewPrinter->GetOutputSize();
+
+ BOOL bScaleAll = FALSE;
+ if ( bIsAPI )
+ {
+ WarningBox aWarnBox (
+ GetWindow(),
+ (WinBits)(WB_YES_NO | WB_DEF_YES),
+ String(SdResId(STR_SCALE_OBJS_TO_PAGE)));
+ bScaleAll = (aWarnBox.Execute() == RET_YES);
+ }
+
+ ::boost::shared_ptr<DrawViewShell> pDrawViewShell (
+ ::boost::dynamic_pointer_cast<DrawViewShell>(GetMainViewShell()));
+ if (pDrawViewShell)
+ {
+ SdPage* pPage = GetDocument()->GetSdPage(
+ 0, PK_STANDARD );
+ pDrawViewShell->SetPageSizeAndBorder (
+ pDrawViewShell->GetPageKind(),
+ aNewSize,
+ -1,-1,-1,-1,
+ bScaleAll,
+ pNewPrinter->GetOrientation(),
+ pPage->GetPaperBin(),
+ pPage->IsBackgroundFullSize());
+ }
+
+ pNewPrinter->SetMapMode(aOldMap);
+ }
+
+ return 0;
}
@@ -625,10 +671,9 @@ USHORT ViewShellBase::SetPrinter (
PrintDialog* ViewShellBase::CreatePrintDialog (::Window *pParent)
{
- OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
-
- return mpImpl->mpPrintManager->CreatePrintDialog (pParent);
+ (void)pParent;
+ return NULL;
+ // return mpImpl->mpPrintManager->CreatePrintDialog (pParent);
}
@@ -638,21 +683,21 @@ SfxTabPage* ViewShellBase::CreatePrintOptionsPage(
::Window *pParent,
const SfxItemSet &rOptions)
{
- OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
-
- return mpImpl->mpPrintManager->CreatePrintOptionsPage (pParent, rOptions);
+ (void)pParent;
+ (void)rOptions;
+ return NULL;
+ // return mpImpl->mpPrintManager->CreatePrintOptionsPage (pParent, rOptions);
}
-USHORT ViewShellBase::Print(SfxProgress& rProgress, BOOL bIsAPI, PrintDialog* pDlg)
+USHORT ViewShellBase::Print(SfxProgress&, BOOL bIsAPI, PrintDialog* pDlg)
{
- OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
-
- return mpImpl->mpPrintManager->Print (rProgress, bIsAPI, pDlg);
+ (void)bIsAPI;
+ (void)pDlg;
+ return 0;
+ // return mpImpl->mpPrintManager->Print (rProgress, bIsAPI, pDlg);
}
@@ -663,10 +708,12 @@ ErrCode ViewShellBase::DoPrint (
PrintDialog* pPrintDialog,
BOOL bSilent, BOOL bIsAPI )
{
- OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
-
- return mpImpl->mpPrintManager->DoPrint (pPrinter, pPrintDialog, bSilent, bIsAPI );
+ (void)pPrinter;
+ (void)pPrintDialog;
+ (void)bSilent;
+ (void)bIsAPI;
+ return 0;
+ //return mpImpl->mpPrintManager->DoPrint (pPrinter, pPrintDialog, bSilent, bIsAPI );
}
@@ -677,13 +724,11 @@ USHORT ViewShellBase::SetPrinterOptDlg (
USHORT nDiffFlags,
BOOL bShowDialog)
{
- OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
-
- return mpImpl->mpPrintManager->SetPrinterOptDlg (
- pNewPrinter,
- nDiffFlags,
- bShowDialog);
+ (void)pNewPrinter;
+ (void)nDiffFlags;
+ (void)bShowDialog;
+ return 0;
+ // return mpImpl->mpPrintManager->SetPrinterOptDlg ( pNewPrinter, nDiffFlags, bShowDialog);
}
@@ -691,11 +736,8 @@ USHORT ViewShellBase::SetPrinterOptDlg (
void ViewShellBase::PreparePrint (PrintDialog* pPrintDialog)
{
- OSL_ASSERT(mpImpl.get()!=NULL);
- OSL_ASSERT(mpImpl->mpPrintManager.get()!=NULL);
-
SfxViewShell::PreparePrint (pPrintDialog);
- return mpImpl->mpPrintManager->PreparePrint (pPrintDialog);
+ //mpImpl->mpPrintManager->PreparePrint (pPrintDialog);
}
@@ -1222,46 +1264,46 @@ CustomHandleManager& ViewShellBase::getCustomHandleManager() const
return *mpImpl->mpCustomHandleManager.get();
}
-::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const
-{
- ::rtl::OUString aLabel;
+::rtl::OUString ViewShellBase::RetrieveLabelFromCommand( const ::rtl::OUString& aCmdURL ) const
+{
+ ::rtl::OUString aLabel;
- if ( aCmdURL.getLength() > 0 ) try
- {
+ if ( aCmdURL.getLength() > 0 ) try
+ {
Reference< XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
-
+
Reference< XModuleManager > xModuleManager( xServiceManager->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager") ) ), UNO_QUERY_THROW );
Reference< XInterface > xIfac( GetMainViewShell()->GetViewFrame()->GetFrame()->GetFrameInterface(), UNO_QUERY_THROW );
-
- ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) );
-
- if( aModuleIdentifier.getLength() > 0 )
- {
- Reference< XNameAccess > xNameAccess( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.UICommandDescription" ) ) ), UNO_QUERY );
- if( xNameAccess.is() )
- {
- Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW );
- Sequence< PropertyValue > aPropSeq;
- if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
- {
- for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
- {
- if( aPropSeq[i].Name.equalsAscii( "Name" ))
- {
- aPropSeq[i].Value >>= aLabel;
- break;
- }
- }
- }
- }
- }
- }
- catch ( Exception& )
- {
- }
-
- return aLabel;
-}
+
+ ::rtl::OUString aModuleIdentifier( xModuleManager->identify( xIfac ) );
+
+ if( aModuleIdentifier.getLength() > 0 )
+ {
+ Reference< XNameAccess > xNameAccess( xServiceManager->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.UICommandDescription" ) ) ), UNO_QUERY );
+ if( xNameAccess.is() )
+ {
+ Reference< ::com::sun::star::container::XNameAccess > m_xUICommandLabels( xNameAccess->getByName( aModuleIdentifier ), UNO_QUERY_THROW );
+ Sequence< PropertyValue > aPropSeq;
+ if( m_xUICommandLabels->getByName( aCmdURL ) >>= aPropSeq )
+ {
+ for( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ if( aPropSeq[i].Name.equalsAscii( "Name" ))
+ {
+ aPropSeq[i].Value >>= aLabel;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ catch ( Exception& )
+ {
+ }
+
+ return aLabel;
+}
@@ -1277,7 +1319,6 @@ ViewShellBase::Implementation::Implementation (ViewShellBase& rBase)
mpViewShellManager(),
mpEventMultiplexer(),
mpUpdateLockManager(),
- mpPrintManager(),
mpFormShellManager(),
mrBase(rBase),
mpPageCacheManager(slidesorter::cache::PageCacheManager::Instance())
diff --git a/sd/source/ui/view/makefile.mk b/sd/source/ui/view/makefile.mk
index a65f3fd7c87f..fede66ea2d13 100644
--- a/sd/source/ui/view/makefile.mk
+++ b/sd/source/ui/view/makefile.mk
@@ -29,6 +29,7 @@
#
#*************************************************************************
+
PRJ=..$/..$/..
PROJECTPCH=sd
@@ -47,6 +48,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
+SRS1NAME=$(TARGET)
+SRC1FILES = \
+ DocumentRenderer.src
+
SLOFILES = \
$(SLO)$/sdview.obj \
$(SLO)$/sdview2.obj \
@@ -94,6 +99,7 @@ SLOFILES = \
$(SLO)$/clview.obj \
$(SLO)$/zoomlist.obj \
$(SLO)$/unmodpg.obj \
+ $(SLO)$/DocumentRenderer.obj \
$(SLO)$/FormShellManager.obj \
$(SLO)$/GraphicObjectBar.obj \
$(SLO)$/GraphicViewShellBase.obj \
@@ -104,7 +110,6 @@ SLOFILES = \
$(SLO)$/OutlineViewShellBase.obj \
$(SLO)$/SlideSorterViewShellBase.obj \
$(SLO)$/PresentationViewShellBase.obj \
- $(SLO)$/PrintManager.obj \
$(SLO)$/ToolBarManager.obj \
$(SLO)$/UpdateLockManager.obj \
$(SLO)$/ViewClipboard.obj \
@@ -116,7 +121,6 @@ SLOFILES = \
$(SLO)$/WindowUpdater.obj
-
# --- Tagets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/sd/util/makefile.mk b/sd/util/makefile.mk
index 6b1e6ebf1676..d74700307291 100644
--- a/sd/util/makefile.mk
+++ b/sd/util/makefile.mk
@@ -55,6 +55,7 @@ RESLIB1SRSFILES=\
$(SRS)$/animui.srs \
$(SRS)$/slideshow.srs \
$(SRS)$/uitable.srs \
+ $(SRS)$/view.srs \
$(SRS)$/uiannotations.srs \
$(SOLARCOMMONRESDIR)$/sfx.srs