summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2010-04-12 18:21:12 +0200
committerJens-Heiner Rechtien <hr@openoffice.org>2010-04-12 18:21:12 +0200
commitab03b13fb4faa4201316d6d63a94955b4a72fcdc (patch)
treedaf0ca7a8c0dd481600e2b97134c215e2c1892e3
parentc84af0cedc1c407d5e1a92fe172e134c08b130f6 (diff)
parent95672348df2be4631642ce336ff48411bb3d21f7 (diff)
CWS-TOOLING: integrate CWS ppp02
-rw-r--r--starmath/source/smres.src2
-rwxr-xr-x[-rw-r--r--]sw/inc/printdata.hxx9
-rwxr-xr-x[-rw-r--r--]sw/inc/unotxdoc.hxx3
-rwxr-xr-x[-rw-r--r--]sw/source/core/doc/doc.cxx50
-rwxr-xr-x[-rw-r--r--]sw/source/core/view/makefile.mk11
-rwxr-xr-xsw/source/core/view/printdata.cxx546
-rwxr-xr-x[-rw-r--r--]sw/source/core/view/viewsh.cxx3
-rwxr-xr-x[-rw-r--r--]sw/source/core/view/vprint.cxx555
-rwxr-xr-x[-rw-r--r--]sw/source/ui/config/optdlg.src6
-rw-r--r--sw/source/ui/dbui/dbmgr.cxx3
-rw-r--r--sw/source/ui/dbui/dbui.src2
-rw-r--r--sw/source/ui/envelp/mailmrge.cxx6
-rwxr-xr-x[-rw-r--r--]sw/source/ui/uno/unotxdoc.cxx63
13 files changed, 682 insertions, 577 deletions
diff --git a/starmath/source/smres.src b/starmath/source/smres.src
index 64891a95daf9..ec6d8114759b 100644
--- a/starmath/source/smres.src
+++ b/starmath/source/smres.src
@@ -3559,7 +3559,7 @@ StringArray RID_PRINTUIOPTIONS
{
< "%PRODUCTNAME %s"; >;
< "Contents"; >;
- < "~Title row"; >;
+ < "~Title"; >;
< "Specifies whether you want the name of the document to be included in the printout"; >;
< "~Formula text"; >;
< "Specifies whether to include the contents of the 'Commands' window at the bottom of the printout."; >;
diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index ce5cf81a6f00..f76ac65e747a 100644..100755
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -230,6 +230,9 @@ class SwRenderData
std::set< sal_Int32 > m_aValidPages; // the set of possible pages (see StringRangeEnumerator::getRangesFromString )
std::map< sal_Int32, const SwPageFrm * > m_aValidStartFrames; // the map of start frames for those pages
+ // printer paper tray to use for each of the m_aValidPages above
+ std::map< sal_Int32, sal_Int32 > m_aPrinterPaperTrays;
+
// vector of pages and their order to be printed (duplicates and any order allowed!)
// (see 'render' in unotxdoc.cxx)
std::vector< sal_Int32 > m_aPagesToPrint;
@@ -264,6 +267,7 @@ public:
void DeletePostItData();
bool IsViewOptionAdjust() const { return m_pViewOptionAdjust != 0; }
+ bool NeedNewViewOptionAdjust( const SwWrtShell& ) const;
void ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions );
void ViewOptionAdjust( const SwPrtOptions *pPrtOptions );
void ViewOptionAdjustStop();
@@ -284,6 +288,11 @@ public:
ValidStartFramesMap_t & GetValidStartFrames() { return m_aValidStartFrames; }
const ValidStartFramesMap_t & GetValidStartFrames() const { return m_aValidStartFrames; }
+ // a map for printer paper tray numbers to use for each document page
+ // a value of -1 for the tray means that there is no specific tray defined
+ std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() { return m_aPrinterPaperTrays; }
+ const std::map< sal_Int32, sal_Int32 >& GetPrinterPaperTrays() const { return m_aPrinterPaperTrays; }
+
// used for 'normal' printing
// A page value of 0 as entry indicates that this page is not from the document but
// from the post-it document. (See also GetPostItStartFrame below)
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index fc5ae0fad8a9..b50d5b0a1b76 100644..100755
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -607,6 +607,9 @@ public:
~SwViewOptionAdjust_Impl();
void AdjustViewOptions( const SwPrtOptions *pPrtOptions );
+
+ bool checkShell( const SwWrtShell& rCompare ) const
+ { return &rCompare == &m_rShell; }
};
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 31c88825ec35..ecc0ea066bf5 100644..100755
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -47,6 +47,7 @@
#include <rtl/ustring.hxx>
#include <vcl/virdev.hxx>
#include <svl/itemiter.hxx>
+#include <svl/poolitem.hxx>
#include <unotools/syslocale.hxx>
#include <sfx2/printer.hxx>
#include <editeng/keepitem.hxx>
@@ -55,9 +56,11 @@
#include <sfx2/linkmgr.hxx>
#include <editeng/forbiddencharacterstable.hxx>
#include <svx/svdmodel.hxx>
+#include <svx/pbinitem.hxx>
#include <unotools/charclass.hxx>
#include <unotools/localedatawrapper.hxx>
+#include <swatrset.hxx>
#include <swmodule.hxx>
#include <fmtpdsc.hxx>
#include <fmtanchr.hxx>
@@ -1177,6 +1180,23 @@ static void lcl_FormatPostIt(
}
+// provide the paper tray to use according to the page style in use,
+// but do that only if the respective item is NOT just the default item
+static sal_Int32 lcl_GetPaperBin( const SwPageFrm *pStartFrm )
+{
+ sal_Int32 nRes = -1;
+
+ const SwFrmFmt &rFmt = pStartFrm->GetPageDesc()->GetMaster();
+ const SfxPoolItem *pItem = NULL;
+ SfxItemState eState = rFmt.GetItemState( RES_PAPER_BIN, FALSE, &pItem );
+ const SvxPaperBinItem *pPaperBinItem = dynamic_cast< const SvxPaperBinItem * >(pItem);
+ if (eState > SFX_ITEM_DEFAULT && pPaperBinItem)
+ nRes = pPaperBinItem->GetValue();
+
+ return nRes;
+}
+
+
void SwDoc::CalculatePagesForPrinting(
/* out */ SwRenderData &rData,
const SwPrintUIOptions &rOptions,
@@ -1187,11 +1207,15 @@ void SwDoc::CalculatePagesForPrinting(
if (!pLayout)
return;
+ const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 );
+ const bool bPrintSelection = nContent == 2;
+
// properties to take into account when calcualting the set of pages
// (PDF export UI does not allow for selecting left or right pages only)
bool bPrintLeftPages = bIsPDFExport ? true : rOptions.IsPrintLeftPages();
bool bPrintRightPages = bIsPDFExport ? true : rOptions.IsPrintRightPages();
- bool bPrintEmptyPages = rOptions.IsPrintEmptyPages( bIsPDFExport );
+ // #i103700# printing selections should not allow for automatic inserting empty pages
+ bool bPrintEmptyPages = bPrintSelection ? false : rOptions.IsPrintEmptyPages( bIsPDFExport );
Range aPages( 1, nDocPageCount );
@@ -1253,6 +1277,7 @@ void SwDoc::CalculatePagesForPrinting(
nPageNo = nFirstPageNo;
+ std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays();
std::set< sal_Int32 > &rValidPages = rData.GetValidPagesSet();
std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames();
rValidPages.clear();
@@ -1268,9 +1293,10 @@ void SwDoc::CalculatePagesForPrinting(
if ( bPrintEmptyPages || pStPage->Frm().Height() )
// <--
{
- // pStPage->GetUpper()->Paint( pStPage->Frm() );
rValidPages.insert( nPageNo );
rValidStartFrms[ nPageNo ] = pStPage;
+
+ rPrinterPaperTrays[ nPageNo ] = lcl_GetPaperBin( pStPage );
}
}
@@ -1306,7 +1332,6 @@ void SwDoc::CalculatePagesForPrinting(
// 0 -> print all pages (default if aPageRange is empty)
// 1 -> print range according to PageRange
// 2 -> print selection
- const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 );
if (1 == nContent)
aPageRange = rOptions.getStringValue( "PageRange", OUString() );
if (2 == nContent)
@@ -1526,8 +1551,9 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
const SwPrintUIOptions &rOptions,
sal_Int32 nDocPageCount )
{
- std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet();
- std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames();
+ std::map< sal_Int32, sal_Int32 > &rPrinterPaperTrays = rData.GetPrinterPaperTrays();
+ std::set< sal_Int32 > &rValidPagesSet = rData.GetValidPagesSet();
+ std::map< sal_Int32, const SwPageFrm * > &rValidStartFrms = rData.GetValidStartFrames();
std::vector< std::pair< sal_Int32, sal_Int32 > > &rPagePairs = rData.GetPagePairsForProspectPrinting();
rPagePairs.clear();
@@ -1535,6 +1561,18 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
rValidStartFrms.clear();
rtl::OUString aPageRange = rOptions.getStringValue( "PageRange", rtl::OUString() );
+ // PageContent :
+ // 0 -> print all pages (default if aPageRange is empty)
+ // 1 -> print range according to PageRange
+ // 2 -> print selection
+ const sal_Int32 nContent = rOptions.getIntValue( "PrintContent", 0 );
+ if (0 == nContent)
+ {
+ // set page range to print to 'all pages'
+ aPageRange = OUString::valueOf( (sal_Int32)1 );
+ aPageRange += OUString::valueOf( (sal_Unicode)'-');
+ aPageRange += OUString::valueOf( nDocPageCount );
+ }
StringRangeEnumerator aRange( aPageRange, 1, nDocPageCount, 0 );
DBG_ASSERT( pLayout, "no layout present" );
@@ -1559,6 +1597,8 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
rValidPagesSet.insert( nPageNum );
rValidStartFrms[ nPageNum ] = pPageFrm;
pPageFrm = (SwPageFrm*)pPageFrm->GetNext();
+
+ rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage );
}
DBG_ASSERT( nPageNum == nDocPageCount, "unexpected number of pages" );
diff --git a/sw/source/core/view/makefile.mk b/sw/source/core/view/makefile.mk
index 7a0f19c956ed..0ac0e0d106cb 100644..100755
--- a/sw/source/core/view/makefile.mk
+++ b/sw/source/core/view/makefile.mk
@@ -43,10 +43,13 @@ SLOFILES = \
$(SLO)$/vdraw.obj \
$(SLO)$/viewimp.obj \
$(SLO)$/viewsh.obj \
- $(SLO)$/viewpg.obj \
- $(SLO)$/vnew.obj \
- $(SLO)$/vprint.obj \
- $(SLO)$/pagepreviewlayout.obj
+ $(SLO)$/pagepreviewlayout.obj \
+ $(SLO)$/printdata.obj \
+ $(SLO)$/viewpg.obj \
+ $(SLO)$/vnew.obj \
+ $(SLO)$/vprint.obj
+
+
EXCEPTIONSFILES = \
$(SLO)$/pagepreviewlayout.obj
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
new file mode 100755
index 000000000000..39bd4d91290c
--- /dev/null
+++ b/sw/source/core/view/printdata.cxx
@@ -0,0 +1,546 @@
+/**************************************************************************
+ *
+ *
+ * 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: vprint.cxx,v $
+ * $Revision: 1.46 $
+ *
+ * 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_sw.hxx"
+
+#include <printdata.hxx>
+
+#include <globals.hrc>
+#include <doc.hxx>
+#include <unotxdoc.hxx>
+#include <wdocsh.hxx>
+#include <viewsh.hxx>
+#include <docfld.hxx>
+#include <swprtopt.hxx>
+
+#include <svl/languageoptions.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <tools/string.hxx>
+#include <tools/debug.hxx>
+#include <tools/resary.hxx>
+#include <unotools/moduleoptions.hxx>
+#include <vcl/outdev.hxx>
+
+
+extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
+
+
+using namespace ::com::sun::star;
+using ::rtl::OUString;
+
+
+//////////////////////////////////////////////////////////////////////
+
+SwRenderData::SwRenderData()
+{
+ m_pPostItFields = 0;
+ m_pPostItDoc = 0;
+ m_pPostItShell = 0;
+
+ m_pViewOptionAdjust = 0;
+ m_pPrtOptions = 0;
+}
+
+
+SwRenderData::~SwRenderData()
+{
+ delete m_pViewOptionAdjust; m_pViewOptionAdjust = 0;
+ delete m_pPrtOptions; m_pPrtOptions = 0;
+ DBG_ASSERT( !m_pPostItShell, "m_pPostItShell should already have been deleted" );
+ DBG_ASSERT( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" );
+ DBG_ASSERT( !m_pPostItFields, " should already have been deleted" );
+}
+
+
+void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev )
+{
+ DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" );
+ m_pPostItFields = new _SetGetExpFlds;
+ lcl_GetPostIts( pDoc, m_pPostItFields );
+ m_pPostItDoc = new SwDoc;
+
+ //!! Disable spell and grammar checking in the temporary document.
+ //!! Otherwise the grammar checker might process it and crash if we later on
+ //!! simply delete this document while he is still at it.
+ SwViewOption aViewOpt( *pViewOpt );
+ aViewOpt.SetOnlineSpell( FALSE );
+
+ m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev );
+}
+
+
+void SwRenderData::DeletePostItData()
+{
+ if (HasPostItData())
+ {
+ m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt
+ delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab.
+ delete m_pPostItFields;
+ m_pPostItDoc = 0;
+ m_pPostItShell = 0;
+ m_pPostItFields = 0;
+ }
+}
+
+bool SwRenderData::NeedNewViewOptionAdjust( const SwWrtShell& rCompare ) const
+{
+ return m_pViewOptionAdjust ? ! m_pViewOptionAdjust->checkShell( rCompare ) : true;
+}
+
+
+void SwRenderData::ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions )
+{
+ if (m_pViewOptionAdjust)
+ {
+ DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" );
+ }
+ m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions );
+}
+
+
+void SwRenderData::ViewOptionAdjust( const SwPrtOptions *pPrtOptions )
+{
+ m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
+}
+
+
+void SwRenderData::ViewOptionAdjustStop()
+{
+ if (m_pViewOptionAdjust)
+ {
+ delete m_pViewOptionAdjust;
+ m_pViewOptionAdjust = 0;
+ }
+}
+
+
+void SwRenderData::MakeSwPrtOptions(
+ SwPrtOptions &rOptions,
+ const SwDocShell *pDocShell,
+ const SwPrintUIOptions *pOpt,
+ const SwRenderData *pData,
+ bool bIsPDFExport )
+{
+ if (!pDocShell || !pOpt || !pData)
+ return;
+
+ // get default print options
+ const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell);
+ BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId );
+ rOptions.MakeOptions( bWeb );
+
+ // get print options to use from provided properties
+ rOptions.bPrintGraphic = pOpt->IsPrintGraphics();
+ rOptions.bPrintTable = pOpt->IsPrintTables();
+ rOptions.bPrintDraw = pOpt->IsPrintDrawings();
+ rOptions.bPrintControl = pOpt->IsPrintFormControls();
+ rOptions.bPrintLeftPages = pOpt->IsPrintLeftPages();
+ rOptions.bPrintRightPages = pOpt->IsPrintRightPages();
+ rOptions.bPrintPageBackground = pOpt->IsPrintPageBackground();
+ rOptions.bPrintEmptyPages = pOpt->IsPrintEmptyPages( bIsPDFExport );
+ // bUpdateFieldsInPrinting <-- not set here; mail merge only
+ rOptions.bPaperFromSetup = pOpt->IsPaperFromSetup();
+ rOptions.bPrintReverse = pOpt->IsPrintReverse();
+ rOptions.bPrintProspect = pOpt->IsPrintProspect();
+ rOptions.bPrintProspectRTL = pOpt->IsPrintProspectRTL();
+ // bPrintSingleJobs <-- not set here; mail merge and or configuration
+ // bModified <-- not set here; mail merge only
+ rOptions.bPrintBlackFont = pOpt->IsPrintWithBlackTextColor();
+ rOptions.bPrintHiddenText = pOpt->IsPrintHiddenText();
+ rOptions.bPrintTextPlaceholder = pOpt->IsPrintTextPlaceholders();
+ rOptions.nPrintPostIts = pOpt->GetPrintPostItsType();
+
+ //! needs to be set after MakeOptions since the assignment operation in that
+ //! function will destroy the pointers
+ rOptions.SetPrintUIOptions( pOpt );
+ rOptions.SetRenderData( pData );
+
+ // rOptions.aMulti is not used anymore in the XRenderable API
+ // Thus we set it to a dummy value here.
+ rOptions.aMulti = MultiSelection( Range( 1, 1 ) );
+
+ //! Note: Since for PDF export of (multi-)selection a temporary
+ //! document is created that contains only the selects parts,
+ //! and thus that document is to printed in whole the,
+ //! rOptions.bPrintSelection parameter will be false.
+ if (bIsPDFExport)
+ rOptions.bPrintSelection = FALSE;
+}
+
+
+//////////////////////////////////////////////////////////////////////
+
+SwPrintUIOptions::SwPrintUIOptions(
+ bool bWeb,
+ bool bSwSrcView,
+ bool bHasSelection,
+ bool bHasPostIts,
+ const SwPrintData &rDefaultPrintData ) :
+ m_pLast( NULL ),
+ m_rDefaultPrintData( rDefaultPrintData )
+{
+ ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
+
+ DBG_ASSERT( aLocalizedStrings.Count() >= 44, "resource incomplete" );
+ if( aLocalizedStrings.Count() < 44 ) // bad resource ?
+ return;
+
+ // printing HTML sources does not have any valid UI options.
+ // Its just the source code that gets printed ...
+ if (bSwSrcView)
+ {
+ m_aUIProperties.realloc( 0 );
+ return;
+ }
+
+ // check if CTL is enabled
+ SvtLanguageOptions aLangOpt;
+ bool bCTL = aLangOpt.IsCTLFontEnabled();
+
+ // create sequence of print UI options
+ // (5 options are not available for Writer-Web)
+ const int nCTLOpts = bCTL ? 1 : 0;
+ const int nNumProps = nCTLOpts + (bWeb ? 14 : 20);
+ m_aUIProperties.realloc( nNumProps );
+ int nIdx = 0;
+
+ // create "writer" section (new tab page in dialog)
+ SvtModuleOptions aModOpt;
+ String aAppGroupname( aLocalizedStrings.GetString( 0 ) );
+ aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
+ aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) );
+ m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() );
+
+ // create sub section for Contents
+ m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() );
+
+ // create a bool option for background
+ bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ),
+ aLocalizedStrings.GetString( 3 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ),
+ bDefaultVal );
+
+ // create a bool option for pictures/graphics AND OLE and drawing objects as well
+ bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ),
+ aLocalizedStrings.GetString( 5 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ),
+ bDefaultVal );
+ if (!bWeb)
+ {
+ // create a bool option for hidden text
+ bDefaultVal = rDefaultPrintData.IsPrintHiddenText();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ),
+ aLocalizedStrings.GetString( 7 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ),
+ bDefaultVal );
+
+ // create a bool option for place holder
+ bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ),
+ aLocalizedStrings.GetString( 9 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ),
+ bDefaultVal );
+ }
+
+ // create a bool option for controls
+ bDefaultVal = rDefaultPrintData.IsPrintControl();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ),
+ aLocalizedStrings.GetString( 11 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ),
+ bDefaultVal );
+
+ // create sub section for Color
+ m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() );
+
+ // create a bool option for printing text with black font color
+ bDefaultVal = rDefaultPrintData.IsPrintBlackFont();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ),
+ aLocalizedStrings.GetString( 14 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ),
+ bDefaultVal );
+
+ if (!bWeb)
+ {
+ // create subgroup for misc options
+ m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() );
+
+ // create a bool option for printing automatically inserted blank pages
+ bDefaultVal = rDefaultPrintData.IsPrintEmptyPages();
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ),
+ aLocalizedStrings.GetString( 17 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ),
+ bDefaultVal );
+ }
+
+ // create a bool option for paper tray
+ bDefaultVal = rDefaultPrintData.IsPaperFromSetup();
+ vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
+ aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) );
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ),
+ aLocalizedStrings.GetString( 19 ),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ),
+ bDefaultVal,
+ aPaperTrayOpt
+ );
+
+ // print range selection
+ vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
+ aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
+ aPrintRangeOpt.mbInternalOnly = sal_True;
+ m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ),
+ rtl::OUString(),
+ aPrintRangeOpt
+ );
+
+ // create a choice for the content to create
+ rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
+ uno::Sequence< rtl::OUString > aChoices( bHasSelection ? 3 : 2 );
+ uno::Sequence< rtl::OUString > aHelpText( bHasSelection ? 3 : 2 );
+ aChoices[0] = aLocalizedStrings.GetString( 38 );
+ aHelpText[0] = aLocalizedStrings.GetString( 39 );
+ aChoices[1] = aLocalizedStrings.GetString( 40 );
+ aHelpText[1] = aLocalizedStrings.GetString( 41 );
+ if (bHasSelection)
+ {
+ aChoices[2] = aLocalizedStrings.GetString( 42 );
+ aHelpText[2] = aLocalizedStrings.GetString( 43 );
+ }
+ m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(),
+ aHelpText,
+ aPrintRangeName,
+ aChoices,
+ bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */);
+ // create a an Edit dependent on "Pages" selected
+ vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True );
+ m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(),
+ rtl::OUString(),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ),
+ rtl::OUString(),
+ aPageRangeOpt
+ );
+ // print content selection
+ vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt;
+ aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) );
+ m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 20 ) ),
+ rtl::OUString(),
+ aContentsOpt
+ );
+ // create a list box for notes content
+ const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
+ aChoices.realloc( 4 );
+ aChoices[0] = aLocalizedStrings.GetString( 21 );
+ aChoices[1] = aLocalizedStrings.GetString( 22 );
+ aChoices[2] = aLocalizedStrings.GetString( 23 );
+ aChoices[3] = aLocalizedStrings.GetString( 24 );
+ aHelpText.realloc( 2 );
+ aHelpText[0] = aLocalizedStrings.GetString( 25 );
+ aHelpText[1] = aLocalizedStrings.GetString( 25 );
+ vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False );
+ aAnnotOpt.mbEnabled = bHasPostIts;
+ m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ),
+ aHelpText,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ),
+ aChoices,
+ nPrintPostIts,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ aAnnotOpt
+ );
+
+ // create subsection for Page settings
+ vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt;
+ aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
+
+ if (!bWeb)
+ {
+ m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 27 ) ),
+ rtl::OUString(),
+ aPageSetOpt
+ );
+ uno::Sequence< rtl::OUString > aRLChoices( 3 );
+ aRLChoices[0] = aLocalizedStrings.GetString( 28 );
+ aRLChoices[1] = aLocalizedStrings.GetString( 29 );
+ aRLChoices[2] = aLocalizedStrings.GetString( 30 );
+ uno::Sequence< rtl::OUString > aRLHelp( 1 );
+ aRLHelp[0] = aLocalizedStrings.GetString( 31 );
+ // create a choice option for all/left/right pages
+ // 0 : all pages (left & right)
+ // 1 : left pages
+ // 2 : right pages
+ DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(),
+ "unexpected value combination" );
+ sal_Int16 nPagesChoice = 0;
+ if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage())
+ nPagesChoice = 1;
+ else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage())
+ nPagesChoice = 2;
+ m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ),
+ aRLHelp,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ),
+ aRLChoices,
+ nPagesChoice,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) )
+ );
+ }
+
+ // create a bool option for brochure
+ bDefaultVal = rDefaultPrintData.IsPrintProspect();
+ rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) );
+ m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ),
+ aLocalizedStrings.GetString( 34 ),
+ aBrochurePropertyName,
+ bDefaultVal,
+ aPageSetOpt
+ );
+
+ if (bCTL)
+ {
+ // create a bool option for brochure RTL dependent on brochure
+ uno::Sequence< rtl::OUString > aBRTLChoices( 2 );
+ aBRTLChoices[0] = aLocalizedStrings.GetString( 35 );
+ aBRTLChoices[1] = aLocalizedStrings.GetString( 36 );
+ vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True );
+ aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
+ // RTL brochure choices
+ // 0 : left-to-right
+ // 1 : right-to-left
+ const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0;
+ m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(),
+ uno::Sequence< rtl::OUString >(),
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ),
+ aBRTLChoices,
+ nBRTLChoice,
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
+ aBrochureRTLOpt
+ );
+ }
+
+
+ DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" );
+}
+
+
+SwPrintUIOptions::~SwPrintUIOptions()
+{
+}
+
+bool SwPrintUIOptions::IsPrintLeftPages() const
+{
+ // take care of different property names for the option.
+ // for compatibility the old name should win (may still be used for PDF export or via Uno API)
+
+ // 0: left and right pages
+ // 1: left pages only
+ // 2: right pages only
+ sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
+ bool bRes = nLRPages == 0 || nLRPages == 1;
+ bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintRightPages() const
+{
+ // take care of different property names for the option.
+ // for compatibility the old name should win (may still be used for PDF export or via Uno API)
+
+ sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
+ bool bRes = nLRPages == 0 || nLRPages == 2;
+ bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const
+{
+ // take care of different property names for the option.
+
+ bool bRes = bIsPDFExport ?
+ !getBoolValue( "IsSkipEmptyPages", sal_True ) :
+ getBoolValue( "PrintEmptyPages", sal_True );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintTables() const
+{
+ // take care of different property names currently in use for this option.
+ // for compatibility the old name should win (may still be used for PDF export or via Uno API)
+
+// bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True );
+// bRes = getBoolValue( "PrintTables", bRes );
+// return bRes;
+ // for now it was decided that tables should always be printed
+ return true;
+}
+
+bool SwPrintUIOptions::IsPrintGraphics() const
+{
+ // take care of different property names for the option.
+ // for compatibility the old name should win (may still be used for PDF export or via Uno API)
+
+ bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True );
+ bRes = getBoolValue( "PrintGraphics", bRes );
+ return bRes;
+}
+
+bool SwPrintUIOptions::IsPrintDrawings() const
+{
+ // take care of different property names for the option.
+ // for compatibility the old name should win (may still be used for PDF export or via Uno API)
+
+ bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True );
+ bRes = getBoolValue( "PrintDrawings", bRes );
+ return bRes;
+}
+
+bool SwPrintUIOptions::processPropertiesAndCheckFormat( const uno::Sequence< beans::PropertyValue >& i_rNewProp )
+{
+ bool bChanged = processProperties( i_rNewProp );
+
+ uno::Reference< awt::XDevice > xRenderDevice;
+ uno::Any aVal( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
+ aVal >>= xRenderDevice;
+
+ OutputDevice* pOut = 0;
+ if (xRenderDevice.is())
+ {
+ VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
+ pOut = pDevice ? pDevice->GetOutputDevice() : 0;
+ }
+ bChanged = bChanged || (pOut != m_pLast);
+ if( pOut )
+ m_pLast = pOut;
+
+ return bChanged;
+}
+
+//////////////////////////////////////////////////////////////////////
+
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 1b04f206b164..08aae426fd8c 100644..100755
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2243,7 +2243,8 @@ void ViewShell::ApplyViewOptions( const SwViewOption &rOpt )
void ViewShell::ImplApplyViewOptions( const SwViewOption &rOpt )
{
- ASSERT( !(*pOpt == rOpt), "ViewShell::ApplyViewOptions: ");
+ if (*pOpt == rOpt)
+ return;
Window *pMyWin = GetWin();
if( !pMyWin )
diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx
index d7400ad2a73b..e74fb21f720a 100644..100755
--- a/sw/source/core/view/vprint.cxx
+++ b/sw/source/core/view/vprint.cxx
@@ -31,35 +31,27 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/view/XRenderable.hpp>
#include <hintids.hxx>
-#include <vcl/oldprintadaptor.hxx>
-#include <sfx2/printer.hxx>
-#include <sfx2/objsh.hxx>
-#include <tools/resary.hxx>
-#include <tools/debug.hxx>
#include <rtl/ustring.hxx>
-#include <toolkit/awt/vclxdevice.hxx>
-#include <toolkit/awt/vclxdevice.hxx>
-
-#include <sfx2/progress.hxx>
#include <sfx2/app.hxx>
+#include <sfx2/objsh.hxx>
#include <sfx2/prnmon.hxx>
+#include <svl/languageoptions.hxx>
#include <editeng/paperinf.hxx>
#include <editeng/pbinitem.hxx>
#include <svx/svdview.hxx>
+#include <toolkit/awt/vclxdevice.hxx>
+#include <tools/debug.hxx>
#include <unotools/localedatawrapper.hxx>
-
#include <unotools/moduleoptions.hxx>
-#include <svl/languageoptions.hxx>
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/view/XRenderable.hpp>
+#include <unotools/syslocale.hxx>
+#include <vcl/oldprintadaptor.hxx>
#include <unotxdoc.hxx>
-
#include <docsh.hxx>
-#include <unotools/syslocale.hxx>
#include <txtfld.hxx>
#include <fmtfld.hxx>
#include <fmtfsize.hxx>
@@ -83,9 +75,7 @@
#include <pagedesc.hxx>
#include <poolfmt.hxx> // fuer RES_POOLPAGE_JAKET
#include <mdiexp.hxx> // Ansteuern der Statusleiste
-#ifndef _STATSTR_HRC
#include <statstr.hrc> // -- " --
-#endif
#include <ptqueue.hxx>
#include <tabfrm.hxx>
#include <txtfrm.hxx> // MinPrtLine
@@ -93,13 +83,6 @@
#include <fmtpdsc.hxx> // SwFmtPageDesc
#include <globals.hrc>
-#define JOBSET_ERR_DEFAULT 0
-#define JOBSET_ERR_ERROR 1
-#define JOBSET_ERR_ISSTARTET 2
-
-
-extern bool lcl_GetPostIts( IDocumentFieldsAccess* pIDFA, _SetGetExpFlds * pSrtLst );
-
using namespace ::com::sun::star;
@@ -210,500 +193,6 @@ void SwPaintQueue::Remove( ViewShell *pSh )
}
}
-/*****************************************************************************/
-
-const XubString& SwPrtOptions::MakeNextJobName()
-{
- static char __READONLY_DATA sDelim[] = " - ";
- USHORT nDelim = sJobName.SearchAscii( sDelim );
- if( STRING_NOTFOUND == nDelim )
- sJobName.AppendAscii(sDelim);
- else
- sJobName.Erase( nDelim + 3/*Zeichen!*/ );
-
- return sJobName += XubString::CreateFromInt32( ++nJobNo );
-}
-
-/*****************************************************************************/
-
-SwRenderData::SwRenderData()
-{
- m_pPostItFields = 0;
- m_pPostItDoc = 0;
- m_pPostItShell = 0;
-
- m_pViewOptionAdjust = 0;
- m_pPrtOptions = 0;
-}
-
-
-SwRenderData::~SwRenderData()
-{
- delete m_pViewOptionAdjust; m_pViewOptionAdjust = 0;
- delete m_pPrtOptions; m_pPrtOptions = 0;
- DBG_ASSERT( !m_pPostItShell, "m_pPostItShell should already have been deleted" );
- DBG_ASSERT( !m_pPostItDoc, "m_pPostItDoc should already have been deleted" );
- DBG_ASSERT( !m_pPostItFields, " should already have been deleted" );
-}
-
-
-void SwRenderData::CreatePostItData( SwDoc *pDoc, const SwViewOption *pViewOpt, OutputDevice *pOutDev )
-{
- DBG_ASSERT( !m_pPostItFields && !m_pPostItDoc && !m_pPostItShell, "some post-it data already exists" );
- m_pPostItFields = new _SetGetExpFlds;
- lcl_GetPostIts( pDoc, m_pPostItFields );
- m_pPostItDoc = new SwDoc;
-
- //!! Disable spell and grammar checking in the temporary document.
- //!! Otherwise the grammar checker might process it and crash if we later on
- //!! simply delete this document while he is still at it.
- SwViewOption aViewOpt( *pViewOpt );
- aViewOpt.SetOnlineSpell( FALSE );
-
- m_pPostItShell = new ViewShell( *m_pPostItDoc, 0, &aViewOpt, pOutDev );
-}
-
-
-void SwRenderData::DeletePostItData()
-{
- if (HasPostItData())
- {
- m_pPostItDoc->setPrinter( 0, false, false ); //damit am echten DOC der Drucker bleibt
- delete m_pPostItShell; //Nimmt das PostItDoc mit ins Grab.
- delete m_pPostItFields;
- m_pPostItDoc = 0;
- m_pPostItShell = 0;
- m_pPostItFields = 0;
- }
-}
-
-
-void SwRenderData::ViewOptionAdjustStart( SwWrtShell &rSh, const SwViewOption &rViewOptions )
-{
- if (m_pViewOptionAdjust)
- {
- DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" );
- }
- m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions );
-}
-
-
-void SwRenderData::ViewOptionAdjust( const SwPrtOptions *pPrtOptions )
-{
- m_pViewOptionAdjust->AdjustViewOptions( pPrtOptions );
-}
-
-
-void SwRenderData::ViewOptionAdjustStop()
-{
- if (m_pViewOptionAdjust)
- {
- delete m_pViewOptionAdjust;
- m_pViewOptionAdjust = 0;
- }
-}
-
-
-void SwRenderData::MakeSwPrtOptions(
- SwPrtOptions &rOptions,
- const SwDocShell *pDocShell,
- const SwPrintUIOptions *pOpt,
- const SwRenderData *pData,
- bool bIsPDFExport )
-{
- if (!pDocShell || !pOpt || !pData)
- return;
-
- // get default print options
- const TypeId aSwWebDocShellTypeId = TYPE(SwWebDocShell);
- BOOL bWeb = pDocShell->IsA( aSwWebDocShellTypeId );
- rOptions.MakeOptions( bWeb );
-
- // get print options to use from provided properties
- rOptions.bPrintGraphic = pOpt->IsPrintGraphics();
- rOptions.bPrintTable = pOpt->IsPrintTables();
- rOptions.bPrintDraw = pOpt->IsPrintDrawings();
- rOptions.bPrintControl = pOpt->IsPrintFormControls();
- rOptions.bPrintLeftPages = pOpt->IsPrintLeftPages();
- rOptions.bPrintRightPages = pOpt->IsPrintRightPages();
- rOptions.bPrintPageBackground = pOpt->IsPrintPageBackground();
- rOptions.bPrintEmptyPages = pOpt->IsPrintEmptyPages( bIsPDFExport );
- // bUpdateFieldsInPrinting <-- not set here; mail merge only
- rOptions.bPaperFromSetup = pOpt->IsPaperFromSetup();
- rOptions.bPrintReverse = pOpt->IsPrintReverse();
- rOptions.bPrintProspect = pOpt->IsPrintProspect();
- rOptions.bPrintProspectRTL = pOpt->IsPrintProspectRTL();
- // bPrintSingleJobs <-- not set here; mail merge and or configuration
- // bModified <-- not set here; mail merge only
- rOptions.bPrintBlackFont = pOpt->IsPrintWithBlackTextColor();
- rOptions.bPrintHiddenText = pOpt->IsPrintHiddenText();
- rOptions.bPrintTextPlaceholder = pOpt->IsPrintTextPlaceholders();
- rOptions.nPrintPostIts = pOpt->GetPrintPostItsType();
-
- //! needs to be set after MakeOptions since the assignment operation in that
- //! function will destroy the pointers
- rOptions.SetPrintUIOptions( pOpt );
- rOptions.SetRenderData( pData );
-
- // rOptions.aMulti is not used anymore in the XRenderable API
- // Thus we set it to a dummy value here.
- rOptions.aMulti = MultiSelection( Range( 1, 1 ) );
-
- //! Note: Since for PDF export of (multi-)selection a temporary
- //! document is created that contains only the selects parts,
- //! and thus that document is to printed in whole the,
- //! rOptions.bPrintSelection parameter will be false.
- if (bIsPDFExport)
- rOptions.bPrintSelection = FALSE;
-}
-
-
-/*****************************************************************************/
-
-SwPrintUIOptions::SwPrintUIOptions(
- bool bWeb,
- bool bSwSrcView,
- bool bHasSelection,
- bool bHasPostIts,
- const SwPrintData &rDefaultPrintData ) :
- m_pLast( NULL ),
- m_rDefaultPrintData( rDefaultPrintData )
-{
- ResStringArray aLocalizedStrings( SW_RES( STR_PRINTOPTUI ) );
-
- DBG_ASSERT( aLocalizedStrings.Count() >= 44, "resource incomplete" );
- if( aLocalizedStrings.Count() < 44 ) // bad resource ?
- return;
-
- // printing HTML sources does not have any valid UI options.
- // Its just the source code that gets printed ...
- if (bSwSrcView)
- {
- m_aUIProperties.realloc( 0 );
- return;
- }
-
- // check if CTL is enabled
- SvtLanguageOptions aLangOpt;
- bool bCTL = aLangOpt.IsCTLFontEnabled();
-
- // create sequence of print UI options
- // (5 options are not available for Writer-Web)
- const int nCTLOpts = bCTL ? 1 : 0;
- const int nNumProps = nCTLOpts + (bWeb ? 14 : 20);
- m_aUIProperties.realloc( nNumProps );
- int nIdx = 0;
-
- // create "writer" section (new tab page in dialog)
- SvtModuleOptions aModOpt;
- String aAppGroupname( aLocalizedStrings.GetString( 0 ) );
- aAppGroupname.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%s" ) ),
- aModOpt.GetModuleName( SvtModuleOptions::E_SWRITER ) );
- m_aUIProperties[ nIdx++ ].Value = getGroupControlOpt( aAppGroupname, rtl::OUString() );
-
- // create sub section for Contents
- m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 1 ), rtl::OUString() );
-
- // create a bool option for background
- bool bDefaultVal = rDefaultPrintData.IsPrintPageBackground();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 2 ),
- aLocalizedStrings.GetString( 3 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPageBackground" ) ),
- bDefaultVal );
-
- // create a bool option for pictures/graphics AND OLE and drawing objects as well
- bDefaultVal = rDefaultPrintData.IsPrintGraphic() || rDefaultPrintData.IsPrintDraw();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 4 ),
- aLocalizedStrings.GetString( 5 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPicturesAndObjects" ) ),
- bDefaultVal );
- if (!bWeb)
- {
- // create a bool option for hidden text
- bDefaultVal = rDefaultPrintData.IsPrintHiddenText();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 6 ),
- aLocalizedStrings.GetString( 7 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintHiddenText" ) ),
- bDefaultVal );
-
- // create a bool option for place holder
- bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 8 ),
- aLocalizedStrings.GetString( 9 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintTextPlaceholder" ) ),
- bDefaultVal );
- }
-
- // create a bool option for controls
- bDefaultVal = rDefaultPrintData.IsPrintControl();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 10 ),
- aLocalizedStrings.GetString( 11 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintControls" ) ),
- bDefaultVal );
-
- // create sub section for Color
- m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( aLocalizedStrings.GetString( 12 ), rtl::OUString() );
-
- // create a bool option for printing text with black font color
- bDefaultVal = rDefaultPrintData.IsPrintBlackFont();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 13 ),
- aLocalizedStrings.GetString( 14 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintBlackFonts" ) ),
- bDefaultVal );
-
- if (!bWeb)
- {
- // create subgroup for misc options
- m_aUIProperties[ nIdx++ ].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 15 ) ), rtl::OUString() );
-
- // create a bool option for printing automatically inserted blank pages
- bDefaultVal = rDefaultPrintData.IsPrintEmptyPages();
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 16 ),
- aLocalizedStrings.GetString( 17 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintEmptyPages" ) ),
- bDefaultVal );
- }
-
- // create a bool option for paper tray
- bDefaultVal = rDefaultPrintData.IsPaperFromSetup();
- vcl::PrinterOptionsHelper::UIControlOptions aPaperTrayOpt;
- aPaperTrayOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OptionsPageOptGroup" ) );
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 18 ),
- aLocalizedStrings.GetString( 19 ),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintPaperFromSetup" ) ),
- bDefaultVal,
- aPaperTrayOpt
- );
-
- // print range selection
- vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
- aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
- aPrintRangeOpt.mbInternalOnly = sal_True;
- m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 37 ) ),
- rtl::OUString(),
- aPrintRangeOpt
- );
-
- // create a choice for the content to create
- rtl::OUString aPrintRangeName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
- uno::Sequence< rtl::OUString > aChoices( bHasSelection ? 3 : 2 );
- uno::Sequence< rtl::OUString > aHelpText( bHasSelection ? 3 : 2 );
- aChoices[0] = aLocalizedStrings.GetString( 38 );
- aHelpText[0] = aLocalizedStrings.GetString( 39 );
- aChoices[1] = aLocalizedStrings.GetString( 40 );
- aHelpText[1] = aLocalizedStrings.GetString( 41 );
- if (bHasSelection)
- {
- aChoices[2] = aLocalizedStrings.GetString( 42 );
- aHelpText[2] = aLocalizedStrings.GetString( 43 );
- }
- m_aUIProperties[nIdx++].Value = getChoiceControlOpt( rtl::OUString(),
- aHelpText,
- aPrintRangeName,
- aChoices,
- bHasSelection ? 2 /*enable 'Selection' radio button*/ : 0 /* enable 'All pages' */);
- // create a an Edit dependent on "Pages" selected
- vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, sal_True );
- m_aUIProperties[nIdx++].Value = getEditControlOpt( rtl::OUString(),
- rtl::OUString(),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ),
- rtl::OUString(),
- aPageRangeOpt
- );
- // print content selection
- vcl::PrinterOptionsHelper::UIControlOptions aContentsOpt;
- aContentsOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "JobPage" ) );
- m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 20 ) ),
- rtl::OUString(),
- aContentsOpt
- );
- // create a list box for notes content
- const sal_Int16 nPrintPostIts = rDefaultPrintData.GetPrintPostIts();
- aChoices.realloc( 4 );
- aChoices[0] = aLocalizedStrings.GetString( 21 );
- aChoices[1] = aLocalizedStrings.GetString( 22 );
- aChoices[2] = aLocalizedStrings.GetString( 23 );
- aChoices[3] = aLocalizedStrings.GetString( 24 );
- aHelpText.realloc( 2 );
- aHelpText[0] = aLocalizedStrings.GetString( 25 );
- aHelpText[1] = aLocalizedStrings.GetString( 25 );
- vcl::PrinterOptionsHelper::UIControlOptions aAnnotOpt( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) ), 0, sal_False );
- aAnnotOpt.mbEnabled = bHasPostIts;
- m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 26 ),
- aHelpText,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintAnnotationMode" ) ),
- aChoices,
- nPrintPostIts,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
- aAnnotOpt
- );
-
- // create subsection for Page settings
- vcl::PrinterOptionsHelper::UIControlOptions aPageSetOpt;
- aPageSetOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
-
- if (!bWeb)
- {
- m_aUIProperties[nIdx++].Value = getSubgroupControlOpt( rtl::OUString( aLocalizedStrings.GetString( 27 ) ),
- rtl::OUString(),
- aPageSetOpt
- );
- uno::Sequence< rtl::OUString > aRLChoices( 3 );
- aRLChoices[0] = aLocalizedStrings.GetString( 28 );
- aRLChoices[1] = aLocalizedStrings.GetString( 29 );
- aRLChoices[2] = aLocalizedStrings.GetString( 30 );
- uno::Sequence< rtl::OUString > aRLHelp( 1 );
- aRLHelp[0] = aLocalizedStrings.GetString( 31 );
- // create a choice option for all/left/right pages
- // 0 : all pages (left & right)
- // 1 : left pages
- // 2 : right pages
- DBG_ASSERT( rDefaultPrintData.IsPrintLeftPage() || rDefaultPrintData.IsPrintRightPage(),
- "unexpected value combination" );
- sal_Int16 nPagesChoice = 0;
- if (rDefaultPrintData.IsPrintLeftPage() && !rDefaultPrintData.IsPrintRightPage())
- nPagesChoice = 1;
- else if (!rDefaultPrintData.IsPrintLeftPage() && rDefaultPrintData.IsPrintRightPage())
- nPagesChoice = 2;
- m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( aLocalizedStrings.GetString( 32 ),
- aRLHelp,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintLeftRightPages" ) ),
- aRLChoices,
- nPagesChoice,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) )
- );
- }
-
- // create a bool option for brochure
- bDefaultVal = rDefaultPrintData.IsPrintProspect();
- rtl::OUString aBrochurePropertyName( RTL_CONSTASCII_USTRINGPARAM( "PrintProspect" ) );
- m_aUIProperties[ nIdx++ ].Value = getBoolControlOpt( aLocalizedStrings.GetString( 33 ),
- aLocalizedStrings.GetString( 34 ),
- aBrochurePropertyName,
- bDefaultVal,
- aPageSetOpt
- );
-
- if (bCTL)
- {
- // create a bool option for brochure RTL dependent on brochure
- uno::Sequence< rtl::OUString > aBRTLChoices( 2 );
- aBRTLChoices[0] = aLocalizedStrings.GetString( 35 );
- aBRTLChoices[1] = aLocalizedStrings.GetString( 36 );
- vcl::PrinterOptionsHelper::UIControlOptions aBrochureRTLOpt( aBrochurePropertyName, -1, sal_True );
- aBrochureRTLOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutPage" ) );
- // RTL brochure choices
- // 0 : left-to-right
- // 1 : right-to-left
- const sal_Int16 nBRTLChoice = rDefaultPrintData.IsPrintProspectRTL() ? 1 : 0;
- m_aUIProperties[ nIdx++ ].Value = getChoiceControlOpt( rtl::OUString(),
- uno::Sequence< rtl::OUString >(),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintProspectRTL" ) ),
- aBRTLChoices,
- nBRTLChoice,
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "List" ) ),
- aBrochureRTLOpt
- );
- }
-
-
- DBG_ASSERT( nIdx == nNumProps, "number of added properties is not as expected" );
-}
-
-
-SwPrintUIOptions::~SwPrintUIOptions()
-{
-}
-
-bool SwPrintUIOptions::IsPrintLeftPages() const
-{
- // take care of different property names for the option.
- // for compatibility the old name should win (may still be used for PDF export or via Uno API)
-
- // 0: left and right pages
- // 1: left pages only
- // 2: right pages only
- sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
- bool bRes = nLRPages == 0 || nLRPages == 1;
- bRes = getBoolValue( "PrintLeftPages", bRes /* <- default value if property is not found */ );
- return bRes;
-}
-
-bool SwPrintUIOptions::IsPrintRightPages() const
-{
- // take care of different property names for the option.
- // for compatibility the old name should win (may still be used for PDF export or via Uno API)
-
- sal_Int64 nLRPages = getIntValue( "PrintLeftRightPages", 0 /* default: all */ );
- bool bRes = nLRPages == 0 || nLRPages == 2;
- bRes = getBoolValue( "PrintRightPages", bRes /* <- default value if property is not found */ );
- return bRes;
-}
-
-bool SwPrintUIOptions::IsPrintEmptyPages( bool bIsPDFExport ) const
-{
- // take care of different property names for the option.
-
- bool bRes = bIsPDFExport ?
- !getBoolValue( "IsSkipEmptyPages", sal_True ) :
- getBoolValue( "PrintEmptyPages", sal_True );
- return bRes;
-}
-
-bool SwPrintUIOptions::IsPrintTables() const
-{
- // take care of different property names currently in use for this option.
- // for compatibility the old name should win (may still be used for PDF export or via Uno API)
-
-// bool bRes = getBoolValue( "PrintTablesGraphicsAndDiagrams", sal_True );
-// bRes = getBoolValue( "PrintTables", bRes );
-// return bRes;
- // for now it was decided that tables should always be printed
- return true;
-}
-
-bool SwPrintUIOptions::IsPrintGraphics() const
-{
- // take care of different property names for the option.
- // for compatibility the old name should win (may still be used for PDF export or via Uno API)
-
- bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True );
- bRes = getBoolValue( "PrintGraphics", bRes );
- return bRes;
-}
-
-bool SwPrintUIOptions::IsPrintDrawings() const
-{
- // take care of different property names for the option.
- // for compatibility the old name should win (may still be used for PDF export or via Uno API)
-
- bool bRes = getBoolValue( "PrintPicturesAndObjects", sal_True );
- bRes = getBoolValue( "PrintDrawings", bRes );
- return bRes;
-}
-
-bool SwPrintUIOptions::processPropertiesAndCheckFormat( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& i_rNewProp )
-{
- bool bChanged = processProperties( i_rNewProp );
-
- uno::Reference< awt::XDevice > xRenderDevice;
- uno::Any aVal( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
- aVal >>= xRenderDevice;
-
- OutputDevice* pOut = 0;
- if (xRenderDevice.is())
- {
- VCLXDevice* pDevice = VCLXDevice::GetImplementation( xRenderDevice );
- pOut = pDevice ? pDevice->GetOutputDevice() : 0;
- }
- bChanged = bChanged || (pOut != m_pLast);
- if( pOut )
- m_pLast = pOut;
-
- return bChanged;
-}
-
-
/******************************************************************************
* Methode : void SetSwVisArea( ViewShell *pSh, Point aPrtOffset, ...
* Beschreibung:
@@ -847,33 +336,6 @@ void ViewShell::ChgAllPageSize( Size &rSz )
}
-void lcl_SetState( SfxProgress& rProgress, ULONG nPage, ULONG nMax,
- const XubString *pStr, ULONG nAct, ULONG nCnt, ULONG nOffs, ULONG nPageNo )
-{
- XubString aTmp = XubString::CreateFromInt64( nPageNo );
- if( pStr )
- {
- aTmp += ' ';
- aTmp += *pStr;
- if( nCnt )
- {
- nMax *= 2;
- rProgress.SetStateText( (nAct-1)*nMax+nPage+nOffs,
- aTmp, nCnt*nMax );
- }
- else
- rProgress.SetStateText( nPage, aTmp, nMax );
- }
- else
- {
- aTmp += ' '; aTmp += '('; aTmp += XubString::CreateFromInt64( nPage );
- aTmp += '/'; aTmp += XubString::CreateFromInt64( nMax ); aTmp += ')';
- rProgress.SetStateText( nPage, aTmp, nMax );
- }
-}
-
-
-
void ViewShell::CalcPagesForPrint( USHORT nMax )
{
SET_CURR_SHELL( this );
@@ -1394,3 +856,4 @@ void ViewShell::PrepareForPrint( const SwPrintData &rOptions )
}
}
}
+
diff --git a/sw/source/ui/config/optdlg.src b/sw/source/ui/config/optdlg.src
index a2b9b4af8a9e..97f903557bda 100644..100755
--- a/sw/source/ui/config/optdlg.src
+++ b/sw/source/ui/config/optdlg.src
@@ -952,11 +952,11 @@ StringArray STR_PRINTOPTUI
< "Contents"; >;
< "Page ba~ckground"; >;
< "Specifies whether to include colors and objects that are inserted to the background of the page (Format - Page - Background) in the printed document."; >;
- < "~Pictures and objects"; >;
+ < "P~ictures and other graphic objects"; >;
< "Specifies whether the graphics and drawing or OLE objects of your text document are printed"; >;
< "Hidden te~xt"; >;
< "Enable this option to print text that is marked as hidden."; >;
- < "~Text placeholder"; >;
+ < "~Text placeholders"; >;
< "Enable this option to print text placeholders. Disable this option to leave the text placeholders blank in the printout."; >;
< "Form control~s"; >;
< "Specifies whether the form control fields of the text document are printed"; >;
@@ -985,7 +985,7 @@ StringArray STR_PRINTOPTUI
< "Select the Brochure option to print the document in brochure format."; >;
< "Left-to-right script"; >;
< "Right-to-left script"; >;
- < "Ranges and copies"; >;
+ < "Range and copies"; >;
< "~All pages"; >;
< "Print the whole document."; >;
< "Pa~ges"; >;
diff --git a/sw/source/ui/dbui/dbmgr.cxx b/sw/source/ui/dbui/dbmgr.cxx
index a54217e1312b..8ad861713e0a 100644
--- a/sw/source/ui/dbui/dbmgr.cxx
+++ b/sw/source/ui/dbui/dbmgr.cxx
@@ -1255,6 +1255,9 @@ BOOL SwNewDBMgr::MergeMailFiles(SwWrtShell* pSourceShell,
nEndRow = pImpl->pMergeData ? pImpl->pMergeData->xResultSet->getRow() : 0;
} while( !bCancel &&
(bSynchronizedDoc && (nStartRow != nEndRow)? ExistsNextRecord() : ToNextMergeRecord()));
+
+ aPrtMonDlg.Show( FALSE );
+
// save the single output document
if(rMergeDescriptor.bCreateSingleFile || bAsSingleFile)
{
diff --git a/sw/source/ui/dbui/dbui.src b/sw/source/ui/dbui/dbui.src
index aa84a1b1f997..f0dba28f75cc 100644
--- a/sw/source/ui/dbui/dbui.src
+++ b/sw/source/ui/dbui/dbui.src
@@ -83,7 +83,7 @@ ModelessDialog DLG_PRINTMONITOR
Pos = MAP_APPFONT ( 6, 17 ) ;
Size = MAP_APPFONT ( 100, 8 ) ;
CENTER = TRUE ;
- Text [ en-US ] = "is being printed on" ;
+ Text [ en-US ] = "is being prepared for printing on" ;
};
FixedText FT_SENDING
{
diff --git a/sw/source/ui/envelp/mailmrge.cxx b/sw/source/ui/envelp/mailmrge.cxx
index ae553ee89a19..141adf35ddf0 100644
--- a/sw/source/ui/envelp/mailmrge.cxx
+++ b/sw/source/ui/envelp/mailmrge.cxx
@@ -65,7 +65,7 @@
#include <com/sun/star/sdbc/XDataSource.hpp>
#include <toolkit/unohlp.hxx>
#include <comphelper/processfactory.hxx>
-#include <com/sun/star/form/XFormController.hpp>
+#include <com/sun/star/form/runtime/XFormController.hpp>
#include <cppuhelper/implbase1.hxx>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XContainerQuery.hpp>
@@ -96,7 +96,7 @@ using namespace ::com::sun::star::ui::dialogs;
---------------------------------------------------------------------------*/
struct SwMailMergeDlg_Impl
{
- uno::Reference<XFormController> xFController;
+ uno::Reference<runtime::XFormController> xFController;
uno::Reference<XSelectionChangeListener> xChgLstnr;
uno::Reference<XSelectionSupplier> xSelSupp;
};
@@ -329,7 +329,7 @@ SwMailMergeDlg::SwMailMergeDlg(Window* pParent, SwWrtShell& rShell,
pBeamerWin->Show();
}
uno::Reference<XController> xController = xFrame->getController();
- pImpl->xFController = uno::Reference<XFormController>(xController, UNO_QUERY);
+ pImpl->xFController = uno::Reference<runtime::XFormController>(xController, UNO_QUERY);
if(pImpl->xFController.is())
{
uno::Reference< awt::XControl > xCtrl = pImpl->xFController->getCurrentControl( );
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index c818affa9398..a4167da88748 100644..100755
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -35,6 +35,7 @@
#include <vcl/print.hxx>
#include <sfx2/viewfrm.hxx>
#include <sfx2/sfxbasecontroller.hxx>
+#include <sfx2/docfile.hxx>
#include <toolkit/helper/vclunohelper.hxx>
#include <toolkit/awt/vclxdevice.hxx>
#include <cmdid.h>
@@ -2709,6 +2710,8 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
const TypeId aSwViewTypeId = TYPE(SwView);
if (pView->IsA(aSwViewTypeId))
{
+ if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pWrtShell ) )
+ m_pRenderData->ViewOptionAdjustStop();
if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust())
m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() );
}
@@ -2811,6 +2814,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
m_pPrintUIOptions->processProperties( rxOptions );
const bool bPrintProspect = m_pPrintUIOptions->getBoolValue( "PrintProspect", false );
const bool bIsSkipEmptyPages = !m_pPrintUIOptions->IsPrintEmptyPages( bIsPDFExport );
+ const bool bPrintPaperFromSetup = m_pPrintUIOptions->getBoolValue( "PrintPaperFromSetup", false );
SwDoc *pDoc = GetRenderDoc( pView, rSelection, bIsPDFExport );
DBG_ASSERT( pDoc && pView, "doc or view shell missing!" );
@@ -2838,7 +2842,21 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
uno::Sequence< beans::PropertyValue > aRenderer;
if (m_pRenderData)
{
+ const USHORT nPage = nRenderer + 1;
+
+ // get paper tray to use ...
+ sal_Int32 nPrinterPaperTray = -1;
+ if (! bPrintPaperFromSetup)
+ {
+ // ... from individual page style (see the page tab in Format/Page dialog)
+ const std::map< sal_Int32, sal_Int32 > &rPaperTrays = m_pRenderData->GetPrinterPaperTrays();
+ std::map< sal_Int32, sal_Int32 >::const_iterator aIt( rPaperTrays.find( nPage ) );
+ if (aIt != rPaperTrays.end())
+ nPrinterPaperTray = aIt->second;
+ }
+
awt::Size aPageSize;
+ awt::Size aPreferredPageSize;
Size aTmpSize;
if (bIsSwSrcView || bPrintProspect)
{
@@ -2856,36 +2874,49 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
Printer *pPrinter = dynamic_cast< Printer * >(lcl_GetOutputDevice( *m_pPrintUIOptions ));
if (pPrinter)
{
+ // HTML source view and prospect adapt to the printer's paper size
+ aTmpSize = pPrinter->GetPaperSize();
+ aTmpSize = pPrinter->LogicToLogic( aTmpSize,
+ pPrinter->GetMapMode(), MapMode( MAP_100TH_MM ));
+ aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
if (bPrintProspect)
{
- aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages );
// we just state what output size we would need
- // the rest is nowadays up to vcl
- aPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ),
- TWIP_TO_MM100( aTmpSize.Height() ));
- }
- else
- {
- // printing HTML source view
- aTmpSize = pPrinter->GetPaperSize();
- aTmpSize = pPrinter->LogicToLogic( aTmpSize,
- pPrinter->GetMapMode(), MapMode( MAP_100TH_MM ));
- aPageSize = awt::Size( aTmpSize.Width(), aTmpSize.Height() );
+ // which may cause vcl to set that page size on the printer
+ // (if available and not overriden by the user)
+ aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages );
+ aPreferredPageSize = awt::Size ( TWIP_TO_MM100( 2 * aTmpSize.Width() ),
+ TWIP_TO_MM100( aTmpSize.Height() ));
}
}
}
else
{
- aTmpSize = pDoc->GetPageSize( USHORT(nRenderer + 1), bIsSkipEmptyPages );
+ aTmpSize = pDoc->GetPageSize( nPage, bIsSkipEmptyPages );
aPageSize = awt::Size ( TWIP_TO_MM100( aTmpSize.Width() ),
TWIP_TO_MM100( aTmpSize.Height() ));
}
+ sal_Int32 nLen = 2;
aRenderer.realloc(2);
aRenderer[0].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
aRenderer[0].Value <<= aPageSize;
aRenderer[1].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PageIncludesNonprintableArea" ) );
aRenderer[1].Value <<= sal_True;
+ if (aPreferredPageSize.Width && aPreferredPageSize.Height)
+ {
+ ++nLen;
+ aRenderer.realloc( nLen );
+ aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PreferredPageSize" ) );
+ aRenderer[ nLen - 1 ].Value <<= aPreferredPageSize;
+ }
+ if (nPrinterPaperTray >= 0)
+ {
+ ++nLen;
+ aRenderer.realloc( nLen );
+ aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrinterPaperTray" ) );
+ aRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray;
+ }
}
m_pPrintUIOptions->appendPrintUIOptions( aRenderer );
@@ -3073,6 +3104,12 @@ void SAL_CALL SwXTextDocument::render(
{
lcl_DisposeView( m_pHiddenViewFrame, pDocShell );
m_pHiddenViewFrame = 0;
+
+ // prevent crash described in #i108805
+ SwDocShell *pRenderDocShell = pDoc->GetDocShell();
+ SfxItemSet *pSet = pRenderDocShell->GetMedium()->GetItemSet();
+ pSet->Put( SfxBoolItem( SID_HIDDEN, sal_False ) );
+
}
}
}