https://bugs.freedesktop.org/show_bug.cgi?id=77516

Julien Nabet <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #2 from Julien Nabet <[email protected]> ---
Michael: would you have some time to give your opinion about this?
Indeed, I thought about 2 ways (perhaps there are others)
1) put a minimum to 1 for subdivisionX/Y so we're sure there's no problem (but
how to do this?)
2) Investigating the code, here what I found:
rOpt.GetDivisionX/Y() return -1 if 0 has been selected on UI because the values
come from this part:
   359         short nDiv = (short)pGridItem->GetFldDivisionX() ;
   360         if( aViewOpt.GetDivisionX() != nDiv  )
   361             aViewOpt.SetDivisionX( nDiv );
   362         nDiv = (short)pGridItem->GetFldDivisionY();
   363         if( aViewOpt.GetDivisionY() != nDiv  )
   364             aViewOpt.SetDivisionY( nDiv  );
in sw/source/core/uibase/app/appopt.cxx (see
http://opengrok.libreoffice.org/xref/core/sw/source/core/uibase/app/appopt.cxx#359)

then
http://opengrok.libreoffice.org/xref/core/svx/source/dialog/optgrid.cxx#211
show this:
    211         aGridItem.nFldDivisionX =
static_cast<long>(pNumFldDivisionX->GetValue()-1);
    212         aGridItem.nFldDivisionY =
static_cast<long>(pNumFldDivisionY->GetValue()-1);

So I don't know the reason of all this but this simple patch could make it:
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index b46d071..31d2fda 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -2149,8 +2149,8 @@ void SwViewShell::ImplApplyViewOptions( const
SwViewOption &rOpt )
         pDView->SetGridCoarse( rSz );

         const Size aFSize
-            ( rSz.Width() ? rSz.Width() / (rOpt.GetDivisionX()+1) : 0,
-              rSz.Height()? rSz.Height()/ (rOpt.GetDivisionY()+1) : 0);
+            ( (rSz.Width() && rOpt.GetDivisionX() != -1) ? rSz.Width() /
(rOpt.GetDivisionX()+1) : 0,
+              (rSz.Height() && rOpt.GetDivisionY() != -1)? rSz.Height()/
(rOpt.GetDivisionY()+1) : 0);
I tested it, it doesn't crash but has it a meaning?

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to