[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sw/inc sw/source

Noel Power noelp at kemper.freedesktop.org
Wed Aug 10 08:05:43 PDT 2011


 sw/inc/printdata.hxx              |    2 +-
 sw/inc/unotxdoc.hxx               |    3 ++-
 sw/source/core/view/printdata.cxx |    4 ++--
 sw/source/ui/uno/unotxdoc.cxx     |   14 ++++++++++----
 4 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit cc8624a8ebcf0b612709d24069d52a1e5b2c8042
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 10 16:06:25 2011 +0100

    Resolves: fdo#39159 don't restore original view settings on temp documents

diff --git a/sw/inc/printdata.hxx b/sw/inc/printdata.hxx
index f7ecb55..99c5cb4 100644
--- a/sw/inc/printdata.hxx
+++ b/sw/inc/printdata.hxx
@@ -269,7 +269,7 @@ public:
 
     bool IsViewOptionAdjust() const  { return m_pViewOptionAdjust != 0; }
     bool NeedNewViewOptionAdjust( const ViewShell& ) const;
-    void ViewOptionAdjustStart( ViewShell &rSh, const SwViewOption &rViewOptions );
+    void ViewOptionAdjustStart( ViewShell &rSh, const SwViewOption &rViewOptions, bool bIsTmpSelection );
     void ViewOptionAdjust( SwPrintData const* const pPrtOptions );
     void ViewOptionAdjustStop();
 
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index ca8ee42..ab8ae52 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -588,9 +588,10 @@ class SwViewOptionAdjust_Impl
 {
     ViewShell &    m_rShell;
     SwViewOption    m_aOldViewOptions;
+    bool m_bIsTmpSelection;
 
 public:
-    SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions );
+    SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions, bool bIsTmpSelection );
     ~SwViewOptionAdjust_Impl();
     void AdjustViewOptions( SwPrintData const* const pPrtOptions );  
     bool checkShell( const ViewShell& rCompare ) const
diff --git a/sw/source/core/view/printdata.cxx b/sw/source/core/view/printdata.cxx
index 955e98a..a60bd67 100644
--- a/sw/source/core/view/printdata.cxx
+++ b/sw/source/core/view/printdata.cxx
@@ -114,13 +114,13 @@ bool SwRenderData::NeedNewViewOptionAdjust( const ViewShell& rCompare ) const
 }
 
 
-void SwRenderData::ViewOptionAdjustStart( ViewShell &rSh, const SwViewOption &rViewOptions )
+void SwRenderData::ViewOptionAdjustStart( ViewShell &rSh, const SwViewOption &rViewOptions,  bool bIsTmpSelection )
 {
     if (m_pViewOptionAdjust)
     {
         DBG_ASSERT( 0, "error: there should be no ViewOptionAdjust active when calling this function" );
     }
-    m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions );
+    m_pViewOptionAdjust = new SwViewOptionAdjust_Impl( rSh, rViewOptions,  bIsTmpSelection );
 }
 
 
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 6892867..8fad3d7 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -2547,7 +2547,7 @@ 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() );
+                    m_pRenderData->ViewOptionAdjustStart( *pViewShell, *pViewShell->GetViewOptions(), rSelection.hasValue() );
             }
 
             m_pRenderData->SetSwPrtOptions( new SwPrintData );
@@ -3834,15 +3834,21 @@ void SwXDocumentPropertyHelper::onChange()
        m_pDoc->SetModified();
 }
 
-SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions ) :
+SwViewOptionAdjust_Impl::SwViewOptionAdjust_Impl( ViewShell& rSh, const SwViewOption &rViewOptions, bool bIsTmpSelection ) :
     m_rShell( rSh ),
-    m_aOldViewOptions( rViewOptions )
+    m_aOldViewOptions( rViewOptions ),
+    m_bIsTmpSelection( bIsTmpSelection )
 {
 }
 
 SwViewOptionAdjust_Impl::~SwViewOptionAdjust_Impl()
 {
-    m_rShell.ApplyViewOptions( m_aOldViewOptions );
+    //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 );
 }
 
 void


More information about the Libreoffice-commits mailing list