summaryrefslogtreecommitdiff
path: root/sw/source/ui/uno/unotxdoc.cxx
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2011-12-21 16:39:22 +0100
committerMichael Stahl <mstahl@redhat.com>2011-12-21 16:44:50 +0100
commit89d2733e16ae6233deea6bef3193bd45c89b854c (patch)
tree29437ec754649108f9c208351eff8e2335e30993 /sw/source/ui/uno/unotxdoc.cxx
parentc84ac758aa081f2b642aa9b96fda8496d0d66188 (diff)
sw: fdo#39159 fdo#40482: temp selection print doc:
Ensure that the printing temp selection document is not destroyed prematurely by SwXTextView::NotifySelChanged, called via ViewOptionAdjustStop, by retaining the temp doc object shell not at the View but in SwRenderData. Not restoring the view options for selections does not actually work, because having a selection surprisingly does not imply printing a temp document: the preview also uses a selection. (view option regression from cd690d2e72be410058376c416a40ff5d918fb0f7)
Diffstat (limited to 'sw/source/ui/uno/unotxdoc.cxx')
-rw-r--r--sw/source/ui/uno/unotxdoc.cxx33
1 files changed, 21 insertions, 12 deletions
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index f0e3502c84b1..f27d9c877599 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -2425,7 +2425,18 @@ SwDoc * SwXTextDocument::GetRenderDoc(
const TypeId aSwViewTypeId = TYPE(SwView);
if (rpView && rpView->IsA(aSwViewTypeId))
{
- SfxObjectShellLock xDocSh(((SwView*)rpView)->GetOrCreateTmpSelectionDoc());
+ if (!m_pRenderData)
+ {
+ OSL_FAIL("GetRenderDoc: no renderdata");
+ return 0;
+ }
+ SwView *const pSwView(static_cast<SwView *>(rpView));
+ SfxObjectShellLock xDocSh(m_pRenderData->GetTempDocShell());
+ if (!xDocSh.Is())
+ {
+ xDocSh = pSwView->CreateTmpSelectionDoc();
+ m_pRenderData->SetTempDocShell(xDocSh);
+ }
if (xDocSh.Is())
{
pDoc = ((SwDocShell*)&xDocSh)->GetDoc();
@@ -2555,7 +2566,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
if (m_pRenderData && m_pRenderData->NeedNewViewOptionAdjust( *pViewShell ) )
m_pRenderData->ViewOptionAdjustStop();
if (m_pRenderData && !m_pRenderData->IsViewOptionAdjust())
- m_pRenderData->ViewOptionAdjustStart( *pViewShell, *pViewShell->GetViewOptions(), rSelection.hasValue() );
+ {
+ m_pRenderData->ViewOptionAdjustStart(
+ *pViewShell, *pViewShell->GetViewOptions() );
+ }
}
m_pRenderData->MakeSwPrtOptions( pRenderDocShell,
@@ -3842,21 +3856,16 @@ void SwXDocumentPropertyHelper::onChange()
m_pDoc->SetModified();
}
-SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions, bool bIsTmpSelection ) :
- m_rShell( rSh ),
- m_aOldViewOptions( rViewOptions ),
- m_bIsTmpSelection( bIsTmpSelection )
+SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl(
+ ViewShell& rSh, const SwViewOption &rViewOptions)
+ : m_rShell( rSh )
+ , m_aOldViewOptions( rViewOptions )
{
}
SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
{
- //fdo#39159 don't restore original view options on a temporary document
- //selection, it triggers throwing away the current view. Presumably we can
- //forget about it in the temporary document case as unimportant to restore
- //the original view settings
- if (!m_bIsTmpSelection)
- m_rShell.ApplyViewOptions( m_aOldViewOptions );
+ m_rShell.ApplyViewOptions( m_aOldViewOptions );
}
void