[Libreoffice-commits] core.git: sw/source

Stephan Bergmann sbergman at redhat.com
Mon Nov 14 17:01:44 UTC 2016


 sw/source/uibase/uiview/viewport.cxx |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

New commits:
commit 27ee9ee8e816334447f1cf781bc2892469e0c8dc
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Mon Nov 14 17:48:56 2016 +0100

    Don't AlignToPixel in SwView::SetVisArea
    
    When e.g. inserting a Writer doc in a Calc doc ("Insert - Object - OLE Object...
    - Create new - LibreOffice 5.3 Text" in Calc), the resulting .ods contains the
    size of the embedded Writer doc in two places.  First as
    
      <draw:frame svg:width=... svg:height=... ...>
    
    in content.xml, where the size is apparently the original rectangle's size,
    before it got aligned in SetVisArea.  And a second time as
    
      <config:config-item config:name="ViewAreaWidth" config:type="long">...</config:config-item>
    <config:config-item config:name="ViewAreaHeight" config:type="long">...</config:config-item>
    
    in Object 1/settings.xml, where the size is apparently the aligned size.
    
    When the document is loaded again, at first the first size is used to display
    the inner Writer doc.  But when the inner Writer doc is double-clicked (to make
    it editable), now the second size is used, and because they don't match, the
    whole document is erroneously considered modified
    (ScTabViewShell::ActivateObject -> SfxInPlaceClient::SetObjArea ->
    SfxInPlaceClient::Invalidate -> ScClient::ViewChanged ->
    ScDocShell::SetDrawModified -> ScDocShell::SetModified ->
    SfxObjectShell::SetModified), causing e.g. the "Save" icon to become "active".
    
    It is unclear to me whether these calls to AlignToPixel still serve any real
    purpose; lets see whether removing them causes any issues...
    
    Change-Id: I755dd9e8b2406f0b4b41d0f3d1281d6ad4b1b238

diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 0c70ff6..f34b89c 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -217,16 +217,13 @@ void SwView::SetVisArea( const Rectangle &rRect, bool bUpdateScrollbar )
         // If m_pWrtShell's visible area is the whole document, do the same here.
         aOldSz = m_pWrtShell->VisArea().SSize();
 
-    const Point aTopLeft(     AlignToPixel( rRect.TopLeft() ));
-    const Point aBottomRight( AlignToPixel( rRect.BottomRight() ));
-    Rectangle aLR( aTopLeft, aBottomRight );
-
-    if( aLR == m_aVisArea )
+    if( rRect == m_aVisArea )
         return;
 
     const SwTwips lMin = IsDocumentBorder() ? DOCUMENTBORDER : 0;
 
     // No negative position, no negative size
+    Rectangle aLR = rRect;
     if( aLR.Top() < lMin )
     {
         aLR.Bottom() += lMin - aLR.Top();


More information about the Libreoffice-commits mailing list