diff options
Diffstat (limited to 'sw/source/ui/uno/unotxdoc.cxx')
-rw-r--r-- | sw/source/ui/uno/unotxdoc.cxx | 45 |
1 files changed, 24 insertions, 21 deletions
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index ad3cba0060..cf19091c3e 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -46,7 +46,7 @@ #include <pview.hxx> #include <viewsh.hxx> #include <pvprtdat.hxx> -#include <swprtopt.hxx> +#include <printdata.hxx> #include <svl/stritem.hxx> #include <unotxdoc.hxx> #include <svl/numuno.hxx> @@ -81,7 +81,6 @@ #include <globals.hrc> #include <unomid.h> #include <unotools/printwarningoptions.hxx> - #include <com/sun/star/util/SearchOptions.hpp> #include <com/sun/star/lang/ServiceNotRegisteredException.hpp> #include <com/sun/star/lang/DisposedException.hpp> @@ -106,7 +105,6 @@ #include <swcont.hxx> #include <unodefaults.hxx> #include <SwXDocumentSettings.hxx> -#include <SwXPrintPreviewSettings.hxx> #include <doc.hxx> #include <editeng/forbiddencharacterstable.hxx> #include <svl/zforlist.hxx> @@ -115,6 +113,7 @@ #include <osl/file.hxx> #include <comphelper/storagehelper.hxx> + // --> FME 2004-06-08 #i12836# enhanced pdf export #include <EnhancedPDFExportHelper.hxx> // <-- @@ -863,7 +862,7 @@ SwUnoCrsr* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > RES_CHRATR_BEGIN, RES_CHRATR_END-1, RES_PARATR_BEGIN, RES_PARATR_END-1, RES_FRMATR_BEGIN, RES_FRMATR_END-1, - RES_TXTATR_INETFMT, RES_TXTATR_INETFMT, + RES_TXTATR_INETFMT, RES_TXTATR_CHARFMT, 0); pSearch->FillSearchItemSet(aSearch); BOOL bCancel; @@ -1668,9 +1667,7 @@ Reference< XInterface > SwXTextDocument::createInstance(const OUString& rServic } else if (sCategory == C2U ("text") ) { - if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.PrintPreviewSettings") ) ) - xRet = Reference < XInterface > ( *new SwXPrintPreviewSettings ( pDocShell->GetDoc() ) ); - else if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.DocumentSettings") ) ) + if( 0 == rServiceName.reverseCompareToAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.text.DocumentSettings") ) ) xRet = Reference < XInterface > ( *new SwXDocumentSettings ( this ) ); } else if (sCategory == C2U ("chart2") ) @@ -2425,7 +2422,7 @@ SwDoc * SwXTextDocument::GetRenderDoc( const TypeId aSwViewTypeId = TYPE(SwView); if (rpView && rpView->IsA(aSwViewTypeId)) { - SfxObjectShellRef xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc()); + SfxObjectShellLock xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc()); if (xDocSh.Is()) { pDoc = ((SwDocShell*)&xDocSh)->GetDoc(); @@ -2543,14 +2540,15 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( m_pRenderData->ViewOptionAdjustStart( *pWrtShell, *pWrtShell->GetViewOptions() ); } - m_pRenderData->SetSwPrtOptions( new SwPrtOptions( bIsPDFExport ? rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("PDF export")) : rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Printing") ) ) ); + m_pRenderData->SetSwPrtOptions( new SwPrintData ); m_pRenderData->MakeSwPrtOptions( m_pRenderData->GetSwPrtOptionsRef(), pRenderDocShell, m_pPrintUIOptions, m_pRenderData, bIsPDFExport ); if (pView->IsA(aSwViewTypeId)) { // PDF export should not make use of the SwPrtOptions - const SwPrtOptions *pPrtOptions = bIsPDFExport? NULL : m_pRenderData->GetSwPrtOptions(); + const SwPrintData *pPrtOptions = (bIsPDFExport) + ? NULL : m_pRenderData->GetSwPrtOptions(); m_pRenderData->ViewOptionAdjust( pPrtOptions ); } @@ -2562,10 +2560,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount( bool bStateChanged = false; if ( bOrigStatus && !SvtPrintWarningOptions().IsModifyDocumentOnPrintingAllowed() ) { - pRenderDocShell->EnableSetModified( sal_False ); + pRenderDocShell->EnableSetModified( sal_False ); bStateChanged = true; } - + // --> FME 2005-05-23 #122919# Force field update before PDF export: pWrtShell->ViewShell::UpdateFlds(TRUE); @@ -2686,8 +2684,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( ? nRenderer + 1 : m_pRenderData->GetPagesToPrint()[ nRenderer ]; // <-- - - // get paper tray to use ... + + // get paper tray to use ... sal_Int32 nPrinterPaperTray = -1; if (! bPrintPaperFromSetup) { @@ -2759,7 +2757,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer( aRenderer.realloc( nLen ); aRenderer[ nLen - 1 ].Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "PrinterPaperTray" ) ); aRenderer[ nLen - 1 ].Value <<= nPrinterPaperTray; - } + } } m_pPrintUIOptions->appendPrintUIOptions( aRenderer ); @@ -2906,7 +2904,8 @@ void SAL_CALL SwXTextDocument::render( } // <-- - const SwPrtOptions &rSwPrtOptions = *m_pRenderData->GetSwPrtOptions(); + SwPrintData const& rSwPrtOptions = + *m_pRenderData->GetSwPrtOptions(); if (bPrintProspect) pVwSh->PrintProspect( pOut, rSwPrtOptions, nRenderer ); else // normal printing and PDF export @@ -2981,8 +2980,12 @@ uno::Reference< util::XCloneable > SwXTextDocument::createClone( ) throw (uno:: SolarMutexGuard aGuard; if(!IsValid()) throw RuntimeException(); - //create a new document - hidden - copy the storage and return it - SfxObjectShell* pShell = pDocShell->GetDoc()->CreateCopy(false); + + // create a new document - hidden - copy the storage and return it + // SfxObjectShellRef is used here, since the model should control object lifetime after creation + // and thus SfxObjectShellLock is not allowed here + // the model holds reference to the shell, so the shell will not destructed at the end of method + SfxObjectShellRef pShell = pDocShell->GetDoc()->CreateCopy(false); uno::Reference< frame::XModel > xNewModel = pShell->GetModel(); uno::Reference< embed::XStorage > xNewStorage = ::comphelper::OStorageHelper::GetTemporaryStorage( ); uno::Sequence< beans::PropertyValue > aTempMediaDescriptor; @@ -3805,8 +3808,8 @@ SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl() m_rShell.ApplyViewOptions( m_aOldViewOptions ); } -void SwViewOptionAdjust_Impl::AdjustViewOptions( - const SwPrtOptions *pPrtOptions ) +void +SwViewOptionAdjust_Impl::AdjustViewOptions(SwPrintData const*const pPrtOptions) { // to avoid unnecessary reformatting the view options related to the content // below should only change if necessary, that is if respective content is present |