SwRenderData::~SwRenderData()
{
OSL_ENSURE( !m_pPostItShell, "m_pPostItShell should already have been deleted" );
OSL_ENSURE( !m_pPostItFields, " should already have been deleted" );
}
//!! 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 );
void SwRenderData::ViewOptionAdjustStart(
SwViewShell &rSh, const SwViewOption &rViewOptions)
{ if (m_pViewOptionAdjust)
{
OSL_FAIL("error: there should be no ViewOptionAdjust active when calling this function" );
}
m_pViewOptionAdjust.reset( new SwViewOptionAdjust_Impl( rSh, rViewOptions ));
}
// get print options to use from provided properties
rOptions.m_bPrintGraphic = pOpt->IsPrintGraphics();
rOptions.m_bPrintControl = pOpt->IsPrintFormControls();
rOptions.m_bPrintLeftPages = pOpt->IsPrintLeftPages();
rOptions.m_bPrintRightPages = pOpt->IsPrintRightPages();
rOptions.m_bPrintPageBackground = pOpt->IsPrintPageBackground();
rOptions.m_bPrintEmptyPages = pOpt->IsPrintEmptyPages( bIsPDFExport ); // bUpdateFieldsInPrinting <-- not set here; mail merge only
rOptions.m_bPaperFromSetup = pOpt->IsPaperFromSetup();
rOptions.m_bPrintProspect = pOpt->IsPrintProspect();
rOptions.m_bPrintProspectRTL = pOpt->IsPrintProspectRTL(); // bModified <-- not set here; mail merge only
rOptions.m_bPrintBlackFont = pOpt->IsPrintWithBlackTextColor();
rOptions.m_bPrintHiddenText = pOpt->IsPrintHiddenText();
rOptions.m_bPrintTextPlaceholder = pOpt->IsPrintTextPlaceholders();
rOptions.m_nPrintPostIts = pOpt->GetPrintPostItsType();
//! needs to be set after MakeOptions since the assignment operation in that //! function will destroy the pointers
rOptions.SetRenderData( this );
}
SwPrintUIOptions::SwPrintUIOptions(
sal_uInt16 nCurrentPage, bool bWeb, bool bSwSrcView, bool bHasSelection, bool bHasPostIts, const SwPrintData &rDefaultPrintData ) :
m_rDefaultPrintData( rDefaultPrintData )
{ // printing HTML sources does not have any valid UI options. // It's just the source code that gets printed... if (bSwSrcView || comphelper::IsFuzzing())
{
m_aUIProperties.clear(); return;
}
// check if either CJK or CTL is enabled bool bRTL = SvtCJKOptions::IsCJKFontEnabled() || SvtCTLOptions::IsCTLFontEnabled();
// create sequence of print UI options // (5 options are not available for Writer-Web) constint nRTLOpts = bRTL ? 1 : 0; constint nNumProps = nRTLOpts + (bWeb ? 15 : 19);
m_aUIProperties.resize( nNumProps); int nIdx = 0;
// load the writer PrinterOptions into the custom tab
m_aUIProperties[nIdx].Name = "OptionsUIFile";
m_aUIProperties[nIdx++].Value <<= u"modules/swriter/ui/printeroptions.ui"_ustr;
// create a bool option for pictures/graphics AND OLE and drawing objects as well
bDefaultVal = rDefaultPrintData.IsPrintGraphic();
m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt(u"pictures"_ustr, SwResId( STR_PRINTOPTUI_PICTURES),
u".HelpID:vcl:PrintDialog:PrintPicturesAndObjects:CheckBox"_ustr,
u"PrintPicturesAndObjects"_ustr,
bDefaultVal); if (!bWeb)
{ // create a bool option for hidden text
bDefaultVal = rDefaultPrintData.IsPrintHiddenText();
m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt(u"hiddentext"_ustr, SwResId( STR_PRINTOPTUI_HIDDEN),
u".HelpID:vcl:PrintDialog:PrintHiddenText:CheckBox"_ustr,
u"PrintHiddenText"_ustr,
bDefaultVal);
// create a bool option for place holder
bDefaultVal = rDefaultPrintData.IsPrintTextPlaceholder();
m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt(u"placeholders"_ustr, SwResId( STR_PRINTOPTUI_TEXT_PLACEHOLDERS),
u".HelpID:vcl:PrintDialog:PrintTextPlaceholder:CheckBox"_ustr,
u"PrintTextPlaceholder"_ustr,
bDefaultVal);
}
// create a bool option for controls
bDefaultVal = rDefaultPrintData.IsPrintControl();
m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt(u"formcontrols"_ustr, SwResId( STR_PRINTOPTUI_FORM_CONTROLS),
u".HelpID:vcl:PrintDialog:PrintControls:CheckBox"_ustr,
u"PrintControls"_ustr,
bDefaultVal);
// create sub section for Color
m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt(u"color"_ustr, SwResId( STR_PRINTOPTUI_COLOR), OUString());
// create a bool option for printing text with black font color
bDefaultVal = rDefaultPrintData.IsPrintBlackFont();
m_aUIProperties[ nIdx++ ].Value = setBoolControlOpt(u"textinblack"_ustr, SwResId( STR_PRINTOPTUI_PRINT_BLACK),
u".HelpID:vcl:PrintDialog:PrintBlackFonts:CheckBox"_ustr,
u"PrintBlackFonts"_ustr,
bDefaultVal);
if (!bWeb)
{ // create subgroup for misc options
m_aUIProperties[ nIdx++ ].Value = setSubgroupControlOpt(u"pages"_ustr, SwResId( STR_PRINTOPTUI_PAGES_TEXT), OUString());
// show an Edit dependent on "Pages" selected
vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintRangeName, 1, true );
m_aUIProperties[nIdx++].Value = setEditControlOpt(u"pagerange"_ustr, OUString(),
u".HelpID:vcl:PrintDialog:PageRange:Edit"_ustr,
u"PageRange"_ustr,
OUString::number( nCurrentPage ) /* set text box to current page number */,
aPageRangeOpt);
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 nEOPages = getIntValue( "EvenOdd", 0/* default: all */ ); bool bRes = nEOPages != 1;
bRes = getBoolValue( "EvenOdd", 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 nEOPages = getIntValue( "EvenOdd", 0/* default: all */ ); bool bRes = nEOPages != 2;
bRes = getBoolValue( "EvenOdd", 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 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)