[Libreoffice-commits] core.git: 8 commits - extensions/AllLangResTarget_scn.mk extensions/Module_extensions.mk extensions/source extensions/uiconfig extras/source oox/source scp2/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Thu Jun 12 05:54:46 PDT 2014


 extensions/AllLangResTarget_scn.mk             |   27 -
 extensions/Module_extensions.mk                |    1 
 extensions/source/scanner/grid.cxx             |  363 +++++++++++++++----------
 extensions/source/scanner/grid.hxx             |  122 +-------
 extensions/source/scanner/sanedlg.cxx          |    2 
 extensions/uiconfig/scanner/ui/griddialog.ui   |   43 ++
 extras/source/glade/libreoffice-catalog.xml.in |    4 
 oox/source/ppt/pptshape.cxx                    |   15 -
 scp2/source/ooo/file_resource_ooo.scp          |    6 
 scp2/source/ooo/module_lang_template.scp       |    1 
 svx/source/svdraw/svdedxv.cxx                  |   12 
 sw/source/filter/ww8/wrtww8gr.cxx              |  111 +++----
 12 files changed, 365 insertions(+), 342 deletions(-)

New commits:
commit 264d3746ca79bbbe4b1b4373dbeb8b5908b760bb
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:40:56 2014 +0100

    coverity#704831 Dereference after null check
    
    Change-Id: Ia1466b6215c2189395285ba377a18ac27e67b93a

diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx
index a0bbfa1..6278595 100644
--- a/svx/source/svdraw/svdedxv.cxx
+++ b/svx/source/svdraw/svdedxv.cxx
@@ -1275,13 +1275,19 @@ bool SdrObjEditView::MouseMove(const MouseEvent& rMEvt, Window* pWin)
         bool bPostIt=bSelMode;
         if (!bPostIt) {
             Point aPt(rMEvt.GetPosPixel());
-            if (pWin!=NULL) aPt=pWin->PixelToLogic(aPt);
-            else if (pTextEditWin!=NULL) aPt=pTextEditWin->PixelToLogic(aPt);
+            if (pWin)
+                aPt=pWin->PixelToLogic(aPt);
+            else if (pTextEditWin)
+                aPt=pTextEditWin->PixelToLogic(aPt);
             bPostIt=IsTextEditHit(aPt,nHitTolLog);
         }
         if (bPostIt) {
             Point aPixPos(rMEvt.GetPosPixel());
-            Rectangle aR(pWin->LogicToPixel(pTextEditOutlinerView->GetOutputArea()));
+            Rectangle aR(pTextEditOutlinerView->GetOutputArea());
+            if (pWin)
+                aR = pWin->LogicToPixel(aR);
+            else if (pTextEditWin)
+                aR = pTextEditWin->LogicToPixel(aR);
             if (aPixPos.X()<aR.Left  ()) aPixPos.X()=aR.Left  ();
             if (aPixPos.X()>aR.Right ()) aPixPos.X()=aR.Right ();
             if (aPixPos.Y()<aR.Top   ()) aPixPos.Y()=aR.Top   ();
commit 1bd5e8bc058c2e67aa2f5f99e326819f3d33b067
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:33:34 2014 +0100

    coverity#735762 Unchecked dynamic_cast
    
    Change-Id: If5ce403d9a216847532d5a2898e95c9bbde71570

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index a2dd728..c5a2d06 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -378,6 +378,15 @@ void PPTShape::applyShapeReference( const oox::drawingml::Shape& rReferencedShap
     Shape::applyShapeReference( rReferencedShape, bUseText );
 }
 
+namespace
+{
+    bool ShapeLocationIsMaster(oox::drawingml::Shape *pInShape)
+    {
+        PPTShape* pShape = dynamic_cast<PPTShape*>(pInShape);
+        return pShape && pShape->getShapeLocation() == Master;
+    }
+}
+
 oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlaceholder, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
     oox::drawingml::ShapePtr aShapePtr;
@@ -385,8 +394,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace
     while( aRevIter != rShapes.rend() )
     {
         if ( (*aRevIter)->getSubType() == nMasterPlaceholder &&
-             ( !bMasterOnly ||
-               ( dynamic_cast< PPTShape* >( (*aRevIter).get() ) && dynamic_cast< PPTShape* >( (*aRevIter).get() )->getShapeLocation() == Master ) ) )
+             ( !bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()) ) )
         {
             aShapePtr = *aRevIter;
             break;
@@ -400,15 +408,6 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace
     return aShapePtr;
 }
 
-namespace
-{
-    bool ShapeLocationIsMaster(oox::drawingml::Shape *pInShape)
-    {
-        PPTShape* pShape = dynamic_cast<PPTShape*>(pInShape);
-        return pShape && pShape->getShapeLocation() == Master;
-    }
-}
-
 oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
     oox::drawingml::ShapePtr aShapePtr;
commit c0cb909ba7f01e3d644e8555289be3ab0785d15d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:31:49 2014 +0100

    coverity#735763 Unchecked dynamic_cast
    
    Change-Id: I4b8a0ebc846ee91530d28821643b3d2f98c0d4f2

diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index 0c5ebe0..a2dd728 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -400,6 +400,15 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholder( const sal_Int32 nMasterPlace
     return aShapePtr;
 }
 
+namespace
+{
+    bool ShapeLocationIsMaster(oox::drawingml::Shape *pInShape)
+    {
+        PPTShape* pShape = dynamic_cast<PPTShape*>(pInShape);
+        return pShape && pShape->getShapeLocation() == Master;
+    }
+}
+
 oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx, std::vector< oox::drawingml::ShapePtr >& rShapes, bool bMasterOnly )
 {
     oox::drawingml::ShapePtr aShapePtr;
@@ -408,8 +417,7 @@ oox::drawingml::ShapePtr PPTShape::findPlaceholderByIndex( const sal_Int32 nIdx,
     while( aRevIter != rShapes.rend() )
     {
         if ( (*aRevIter)->getSubTypeIndex().has() && (*aRevIter)->getSubTypeIndex().get() == nIdx &&
-             ( !bMasterOnly ||
-               ( dynamic_cast< PPTShape* >( (*aRevIter).get() ) && dynamic_cast< PPTShape* >( (*aRevIter).get() )->getShapeLocation() == Master ) ) )
+             ( !bMasterOnly || ShapeLocationIsMaster((*aRevIter).get()) ) )
         {
             aShapePtr = *aRevIter;
             break;
commit 1e022fda62d93421c0de064e3422f9d695409e1e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:24:29 2014 +0100

    coverity#735947 Explicit null dereferenced
    
    Change-Id: I8fc9d0eeab6f63be4c815adcbd092d5ff2a96586

diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx
index a4c45c9..c29cf96 100644
--- a/sw/source/filter/ww8/wrtww8gr.cxx
+++ b/sw/source/filter/ww8/wrtww8gr.cxx
@@ -918,77 +918,78 @@ void SwWW8WrGrf::WriteGraphicNode(SvStream& rStrm, const GraphicDetails &rItem)
 
         case sw::Frame::eOle:
         {
-#ifdef OLE_PREVIEW_AS_EMF
             const SwNode *pNode = rItem.maFly.GetContent();
             const SwOLENode *pNd = pNode ? pNode->GetOLENode() : 0;
             OSL_ENSURE(pNd, "Impossible");
-            if (!rWrt.bWrtWW8)
+            if (pNd)
             {
-                SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd);
-                OSL_ENSURE( pOleNd, " Wer hat den OleNode versteckt ?" );
-                SwOLEObj&                   rSObj= pOleNd->GetOLEObj();
-                uno::Reference < embed::XEmbeddedObject > rObj(  rSObj.GetOleRef() );
+#ifdef OLE_PREVIEW_AS_EMF
+                if (!rWrt.bWrtWW8)
+                {
+                    SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd);
+                    SwOLEObj& rSObj = pOleNd->GetOLEObj();
+                    uno::Reference < embed::XEmbeddedObject > rObj(  rSObj.GetOleRef() );
 
-                comphelper::EmbeddedObjectContainer aCnt( pOleNd->GetDoc()->GetDocStorage() );
+                    comphelper::EmbeddedObjectContainer aCnt( pOleNd->GetDoc()->GetDocStorage() );
 
-                SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( aCnt.GetGraphicStream( rObj ) );
-                OSL_ENSURE( pGraphicStream && !pGraphicStream->GetError(), "No graphic stream available!" );
-                if ( pGraphicStream && !pGraphicStream->GetError() )
-                {
-                    Graphic aGr;
-                    GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
-                    if( rGF.ImportGraphic( aGr, OUString(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ) == GRFILTER_OK )
+                    SvStream* pGraphicStream = ::utl::UcbStreamHelper::CreateStream( aCnt.GetGraphicStream( rObj ) );
+                    OSL_ENSURE( pGraphicStream && !pGraphicStream->GetError(), "No graphic stream available!" );
+                    if ( pGraphicStream && !pGraphicStream->GetError() )
                     {
-                        //TODO/LATER: do we really want to use GDIMetafile?!
-                        GDIMetaFile aMtf;
-                        aMtf = aGr.GetGDIMetaFile();
-                        aMtf.WindStart();
-                        aMtf.Play(Application::GetDefaultDevice(), Point(0, 0),
-                            Size(2880, 2880));
-                        WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight,
-                            pNd->GetpSwAttrSet());
-                        WriteWindowMetafileBits(rStrm, aMtf);
+                        Graphic aGr;
+                        GraphicFilter& rGF = GraphicFilter::GetGraphicFilter();
+                        if( rGF.ImportGraphic( aGr, OUString(), *pGraphicStream, GRFILTER_FORMAT_DONTKNOW ) == GRFILTER_OK )
+                        {
+                            //TODO/LATER: do we really want to use GDIMetafile?!
+                            GDIMetaFile aMtf;
+                            aMtf = aGr.GetGDIMetaFile();
+                            aMtf.WindStart();
+                            aMtf.Play(Application::GetDefaultDevice(), Point(0, 0),
+                                Size(2880, 2880));
+                            WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight,
+                                pNd->GetpSwAttrSet());
+                            WriteWindowMetafileBits(rStrm, aMtf);
+                        }
                     }
+                    else
+                        delete pGraphicStream;
                 }
                 else
-                    delete pGraphicStream;
-            }
-            else
-            {
-                //Convert this ole2 preview in ww8+ to an EMF for better unicode
-                //support (note that at this moment this breaks StarSymbol
-                //using graphics because I need to embed starsymbol in exported
-                //documents.
-                WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight,
-                    pNd->GetpSwAttrSet());
-                SwBasicEscherEx aInlineEscher(&rStrm, rWrt);
-                aInlineEscher.WriteOLEFlyFrame(rFly.GetFrmFmt(), 0x401);
-                aInlineEscher.WritePictures();
-            }
+                {
+                    //Convert this ole2 preview in ww8+ to an EMF for better unicode
+                    //support (note that at this moment this breaks StarSymbol
+                    //using graphics because I need to embed starsymbol in exported
+                    //documents.
+                    WritePICFHeader(rStrm, rFly, 0x64, nWidth, nHeight,
+                        pNd->GetpSwAttrSet());
+                    SwBasicEscherEx aInlineEscher(&rStrm, rWrt);
+                    aInlineEscher.WriteOLEFlyFrame(rFly.GetFrmFmt(), 0x401);
+                    aInlineEscher.WritePictures();
+                }
 #else
-            // cast away const
-            SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd);
-            OSL_ENSURE( pOleNd, " Wer hat den OleNode versteckt ?" );
-            SwOLEObj&                   rSObj= pOleNd->GetOLEObj();
+                // cast away const
+                SwOLENode *pOleNd = const_cast<SwOLENode*>(pNd);
+                SwOLEObj& rSObj= pOleNd->GetOLEObj();
 
-            // TODO/LATER: do we need to load object?
-            Graphic* pGr = SdrOle2Obj::GetGraphicFromObject( pOleNd->GetDoc()->GetDocStorage(), rObj );
+                // TODO/LATER: do we need to load object?
+                Graphic* pGr = SdrOle2Obj::GetGraphicFromObject( pOleNd->GetDoc()->GetDocStorage(), rObj );
 
-            //TODO/LATER: do we really want to use GDIMetafile?!
-            GDIMetaFile aMtf;
-            if ( pGr )
-                aMtf = pGr->GetGDIMetaFile();
+                //TODO/LATER: do we really want to use GDIMetafile?!
+                GDIMetaFile aMtf;
+                if ( pGr )
+                    aMtf = pGr->GetGDIMetaFile();
 
-            Size aS(aMtf.GetPrefSize());
-            aMtf.WindStart();
-            aMtf.Play(Application::GetDefaultDevice(), Point(0, 0),
-                Size(2880, 2880));
+                Size aS(aMtf.GetPrefSize());
+                aMtf.WindStart();
+                aMtf.Play(Application::GetDefaultDevice(), Point(0, 0),
+                    Size(2880, 2880));
 
-            WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight,
-                pNd->GetpSwAttrSet());
-            WriteWindowMetafileBits(rStrm, aMtf);
-            delete pGr;
+                WritePICFHeader(rStrm, rFly, 8, nWidth, nHeight,
+                    pNd->GetpSwAttrSet());
+                WriteWindowMetafileBits(rStrm, aMtf);
+                delete pGr;
 #endif
+            }
         }
         break;
         case sw::Frame::eDrawing:
commit 5c53bb8a99b34827a2dfe38ef9eaf173b1a650ce
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:10:40 2014 +0100

    scn resource file is empty now post ui-ification
    
    Change-Id: Id8a6d6c4faf3101b13d84de180f8db7cab2cb16f

diff --git a/extensions/AllLangResTarget_scn.mk b/extensions/AllLangResTarget_scn.mk
deleted file mode 100644
index 10ee455..0000000
--- a/extensions/AllLangResTarget_scn.mk
+++ /dev/null
@@ -1,27 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-#
-
-$(eval $(call gb_AllLangResTarget_AllLangResTarget,scn))
-
-$(eval $(call gb_AllLangResTarget_set_reslocation,scn,extensions/source/scanner))
-
-$(eval $(call gb_AllLangResTarget_add_srs,scn,\
-	scn/res \
-))
-
-$(eval $(call gb_SrsTarget_SrsTarget,scn/res))
-
-$(eval $(call gb_SrsTarget_set_include,scn/res,\
-	$$(INCLUDE) \
-	-I$(SRCDIR)/extensions/source/scanner \
-))
-
-# vim:set noet sw=4 ts=4:
diff --git a/extensions/Module_extensions.mk b/extensions/Module_extensions.mk
index de1fa1b..f62ba8d 100644
--- a/extensions/Module_extensions.mk
+++ b/extensions/Module_extensions.mk
@@ -19,7 +19,6 @@ $(eval $(call gb_Module_add_targets,extensions,\
 
 $(eval $(call gb_Module_add_l10n_targets,extensions,\
 	AllLangResTarget_abp \
-	AllLangResTarget_scn \
 	AllLangResTarget_upd \
 	UIConfig_sabpilot \
 	UIConfig_scanner \
diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 88a09b3..4de38de 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -138,17 +138,6 @@ public:
     virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
 };
 
-
-namespace {
-
-ResId SaneResId( sal_uInt32 nID )
-{
-    static ResMgr* pResMgr = ResMgr::CreateResMgr( "scn" );
-    return ResId( nID, *pResMgr );
-}
-
-}
-
 GridWindow::GridWindow(Window* pParent)
     : Window(pParent, 0)
     , m_aGridArea(50, 15, 100, 100)
diff --git a/scp2/source/ooo/file_resource_ooo.scp b/scp2/source/ooo/file_resource_ooo.scp
index a8dd5eb..e544426 100644
--- a/scp2/source/ooo/file_resource_ooo.scp
+++ b/scp2/source/ooo/file_resource_ooo.scp
@@ -59,12 +59,6 @@ STD_RES_FILE( gid_File_Res_Pcr, pcr)
 
 STD_RES_FILE( gid_File_Res_Pdffilter, pdffilter)
 
-#ifdef UNX
-
-STD_RES_FILE( gid_File_Res_San, scn )
-
-#endif
-
 STD_RES_FILE( gid_File_Res_Sd, sd )
 
 STD_RES_FILE( gid_File_Res_Sfx, sfx )
diff --git a/scp2/source/ooo/module_lang_template.scp b/scp2/source/ooo/module_lang_template.scp
index 104712b..8e3a1a7 100644
--- a/scp2/source/ooo/module_lang_template.scp
+++ b/scp2/source/ooo/module_lang_template.scp
@@ -81,7 +81,6 @@ Module gid_Module_Langpack_Resource_Template
              gid_File_Res_Ofa,
              gid_File_Res_Pcr,
              gid_File_Res_Pdffilter,
-             gid_File_Res_San,
              gid_File_Res_Sb,
              gid_File_Res_Sd,
              gid_File_Res_Sfx,
commit 84e1368bd8014f418b575239cd16c11704123e8d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:08:59 2014 +0100

    more the png into the .ui so it isn't garbage collected
    
    Change-Id: If0d3829bfc14c602a0167967cbe215782c75f549

diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index ae36954..88a09b3 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -119,7 +119,7 @@ class GridWindow : public Window
     void drawLine( double x1, double y1, double x2, double y2 );
 public:
     GridWindow(Window* pParent);
-    void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues);
+    void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap);
     virtual ~GridWindow();
 
     void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
@@ -159,13 +159,13 @@ GridWindow::GridWindow(Window* pParent)
     , m_bCutValues(false)
     , m_aHandles()
     , m_nDragIndex(0xffffffff)
-    , m_aMarkerBitmap( FixedImage::loadThemeImage("extensions/source/scanner/handle.png").GetBitmapEx() )
 {
     SetMapMode(MapMode(MAP_PIXEL));
 }
 
-void GridWindow::Init(double* pXValues, double* pYValues, int nValues, bool bCutValues)
+void GridWindow::Init(double* pXValues, double* pYValues, int nValues, bool bCutValues, const BitmapEx &rMarkerBitmap)
 {
+    m_aMarkerBitmap = rMarkerBitmap;
     m_pXValues = pXValues;
     m_pOrigYValues = pYValues;
     m_nValues = nValues;
@@ -214,7 +214,7 @@ GridDialog::GridDialog(double* pXValues, double* pYValues, int nValues, Window*
     get(m_pResetTypeBox, "resetTypeCombobox");
     get(m_pResetButton, "resetButton");
     get(m_pGridWindow, "gridwindow");
-    m_pGridWindow->Init(pXValues, pYValues, nValues, bCutValues);
+    m_pGridWindow->Init(pXValues, pYValues, nValues, bCutValues, get<FixedImage>("handle")->GetImage().GetBitmapEx());
 
     m_pResetTypeBox->SelectEntryPos( 0 );
 
diff --git a/extensions/uiconfig/scanner/ui/griddialog.ui b/extensions/uiconfig/scanner/ui/griddialog.ui
index 25638a5..baebe9f 100644
--- a/extensions/uiconfig/scanner/ui/griddialog.ui
+++ b/extensions/uiconfig/scanner/ui/griddialog.ui
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- Generated with glade 3.16.1 -->
 <interface>
-  <!-- interface-requires LibreOffice 1.0 -->
   <requires lib="gtk+" version="3.0"/>
+  <!-- interface-requires LibreOffice 1.0 -->
   <object class="GtkDialog" id="GridDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -80,6 +80,18 @@
                 <property name="position">3</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkImage" id="handle">
+                <property name="can_focus">False</property>
+                <property name="no_show_all">True</property>
+                <property name="pixbuf">extensions/source/scanner/handle.png</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">4</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
commit 0cab72b8191dc8ee5941fc5900d0c3b2c48fd0f3
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 13:02:05 2014 +0100

    extract gamma grid drawing to standalone widget
    
    so the dialog stops scribbling on itself, and instead
    uses a real widget for that
    
    This has to be one of our weirdest dialogs, why expend so much effort to create
    this dialog for the most obscure of issues.
    
    Change-Id: Ia25e6c67fb278528c6c68a1d6db74de59915fd34

diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 898f834..ae36954 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -29,6 +29,116 @@
 #include <algorithm>
 #include <boost/scoped_array.hpp>
 
+class GridWindow : public Window
+{
+    // helper class for handles
+    struct impHandle
+    {
+        Point           maPos;
+        sal_uInt16      mnOffX;
+        sal_uInt16      mnOffY;
+
+        impHandle(const Point& rPos, sal_uInt16 nX, sal_uInt16 nY)
+        :   maPos(rPos), mnOffX(nX), mnOffY(nY)
+        {
+        }
+
+        bool operator<(const impHandle& rComp) const
+        {
+            return (maPos.X() < rComp.maPos.X());
+        }
+
+        void draw(Window& rWin, const BitmapEx& rBitmapEx)
+        {
+            const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
+            rWin.DrawBitmapEx(maPos - aOffset, rBitmapEx);
+        }
+
+        bool isHit(Window& rWin, const Point& rPos)
+        {
+            const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
+            const Rectangle aTarget(maPos - aOffset, maPos + aOffset);
+            return aTarget.IsInside(rPos);
+        }
+    };
+
+    Rectangle       m_aGridArea;
+
+    double          m_fMinX;
+    double          m_fMinY;
+    double          m_fMaxX;
+    double          m_fMaxY;
+
+    double          m_fChunkX;
+    double          m_fMinChunkX;
+    double          m_fChunkY;
+    double          m_fMinChunkY;
+
+    double*         m_pXValues;
+    double*         m_pOrigYValues;
+    int             m_nValues;
+    double*         m_pNewYValues;
+
+    sal_uInt16      m_BmOffX;
+    sal_uInt16      m_BmOffY;
+
+    bool            m_bCutValues;
+
+    // stuff for handles
+    std::vector< impHandle >    m_aHandles;
+    sal_uInt32                  m_nDragIndex;
+
+    BitmapEx        m_aMarkerBitmap;
+
+    Point transform( double x, double y );
+    void transform( const Point& rOriginal, double& x, double& y );
+
+    double findMinX();
+    double findMinY();
+    double findMaxX();
+    double findMaxY();
+
+    void updateRectSize();
+
+    void drawGrid();
+    void drawOriginal();
+    void drawNew();
+    void drawHandles();
+
+    void computeExtremes();
+    void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
+    void computeNew();
+    double interpolate( double x, double* pNodeX, double* pNodeY, int nNodes );
+
+    virtual void MouseMove( const MouseEvent& ) SAL_OVERRIDE;
+    virtual void MouseButtonDown( const MouseEvent& ) SAL_OVERRIDE;
+    virtual void MouseButtonUp( const MouseEvent& ) SAL_OVERRIDE;
+    void onResize();
+    virtual void Resize() SAL_OVERRIDE;
+    virtual Size GetOptimalSize() const SAL_OVERRIDE;
+    void drawLine( double x1, double y1, double x2, double y2 );
+public:
+    GridWindow(Window* pParent);
+    void Init(double* pXValues, double* pYValues, int nValues, bool bCutValues);
+    virtual ~GridWindow();
+
+    void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
+    double getMinX() { return m_fMinX; }
+    double getMinY() { return m_fMinY; }
+    double getMaxX() { return m_fMaxX; }
+    double getMaxY() { return m_fMaxY; }
+
+    int countValues() { return m_nValues; }
+    double* getXValues() { return m_pXValues; }
+    double* getOrigYValues() { return m_pOrigYValues; }
+    double* getNewYValues() { return m_pNewYValues; }
+
+    void ChangeMode(int nType);
+
+    virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
+};
+
+
 namespace {
 
 ResId SaneResId( sal_uInt32 nID )
@@ -39,41 +149,32 @@ ResId SaneResId( sal_uInt32 nID )
 
 }
 
-/***********************************************************************
- *
- *  GridWindow
- *
- ***********************************************************************/
-
-
-
-GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window* pParent, bool bCutValues )
-:   ModalDialog( pParent, "GridDialog", "modules/scanner/ui/griddialog.ui" ),
-    m_aGridArea( 50, 15, 100, 100 ),
-    m_pXValues( pXValues ),
-    m_pOrigYValues( pYValues ),
-    m_nValues( nValues ),
-    m_pNewYValues( NULL ),
-    m_bCutValues( bCutValues ),
-    m_aHandles(),
-    m_nDragIndex( 0xffffffff ),
-    m_aMarkerBitmap( FixedImage::loadThemeImage("extensions/source/scanner/handle.png").GetBitmapEx() )
+GridWindow::GridWindow(Window* pParent)
+    : Window(pParent, 0)
+    , m_aGridArea(50, 15, 100, 100)
+    , m_pXValues(NULL)
+    , m_pOrigYValues(NULL)
+    , m_nValues(0)
+    , m_pNewYValues(NULL)
+    , m_bCutValues(false)
+    , m_aHandles()
+    , m_nDragIndex(0xffffffff)
+    , m_aMarkerBitmap( FixedImage::loadThemeImage("extensions/source/scanner/handle.png").GetBitmapEx() )
 {
-    get(m_pOKButton, "ok");
-    get(m_pResetTypeBox, "resetTypeCombobox");
-    get(m_pResetButton, "resetButton");
-
-    m_pResetTypeBox->SelectEntryPos( 0 );
+    SetMapMode(MapMode(MAP_PIXEL));
+}
 
-    m_pResetButton->SetClickHdl( LINK( this, GridWindow, ClickButtonHdl ) );
+void GridWindow::Init(double* pXValues, double* pYValues, int nValues, bool bCutValues)
+{
+    m_pXValues = pXValues;
+    m_pOrigYValues = pYValues;
+    m_nValues = nValues;
+    m_bCutValues = bCutValues;
 
-    SetMapMode( MapMode( MAP_PIXEL ) );
-    Size aSize = GetOutputSizePixel();
-    Size aBtnSize = m_pOKButton->GetOutputSizePixel();
-    m_aGridArea.setWidth( aSize.Width() - aBtnSize.Width() - 80 );
-    m_aGridArea.setHeight( aSize.Height() - 40 );
+    SetSizePixel(GetOptimalSize());
+    onResize();
 
-    if( m_pOrigYValues && m_nValues )
+    if (m_pOrigYValues && m_nValues)
     {
         m_pNewYValues = new double[ m_nValues ];
         memcpy( m_pNewYValues, m_pOrigYValues, sizeof( double ) * m_nValues );
@@ -89,6 +190,37 @@ GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window*
     m_aHandles.push_back(impHandle(transform(findMaxX(), findMaxY()), m_BmOffX, m_BmOffY));
 }
 
+void GridWindow::Resize()
+{
+    onResize();
+}
+
+void GridWindow::onResize()
+{
+    Size aSize = GetSizePixel();
+    m_aGridArea.setWidth( aSize.Width() - 80 );
+    m_aGridArea.setHeight( aSize.Height() - 40 );
+}
+
+Size GridWindow::GetOptimalSize() const
+{
+    return LogicToPixel(Size(240, 200), MAP_APPFONT);
+}
+
+GridDialog::GridDialog(double* pXValues, double* pYValues, int nValues, Window* pParent, bool bCutValues )
+    : ModalDialog(pParent, "GridDialog", "modules/scanner/ui/griddialog.ui")
+{
+    get(m_pOKButton, "ok");
+    get(m_pResetTypeBox, "resetTypeCombobox");
+    get(m_pResetButton, "resetButton");
+    get(m_pGridWindow, "gridwindow");
+    m_pGridWindow->Init(pXValues, pYValues, nValues, bCutValues);
+
+    m_pResetTypeBox->SelectEntryPos( 0 );
+
+    m_pResetButton->SetClickHdl( LINK( this, GridDialog, ClickButtonHdl ) );
+}
+
 GridWindow::~GridWindow()
 {
     delete [] m_pNewYValues;
@@ -105,8 +237,6 @@ double GridWindow::findMinX()
     return fMin;
 }
 
-
-
 double GridWindow::findMinY()
 {
     if( ! m_pNewYValues )
@@ -183,23 +313,17 @@ Point GridWindow::transform( double x, double y )
     return aRet;
 }
 
-
-
 void GridWindow::transform( const Point& rOriginal, double& x, double& y )
 {
     x = ( rOriginal.X() - m_aGridArea.Left() ) * (m_fMaxX - m_fMinX) / (double)m_aGridArea.GetWidth() + m_fMinX;
     y = ( m_aGridArea.Bottom() - rOriginal.Y() ) * (m_fMaxY - m_fMinY) / (double)m_aGridArea.GetHeight() + m_fMinY;
 }
 
-
-
 void GridWindow::drawLine( double x1, double y1, double x2, double y2 )
 {
     DrawLine( transform( x1, y1 ), transform( x2, y2 ) );
 }
 
-
-
 void GridWindow::computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut )
 {
     // get a nice chunk size like 10, 100, 25 or such
@@ -298,9 +422,12 @@ double GridWindow::interpolate(
     return ret;
 }
 
+void GridDialog::setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY)
+{
+    m_pGridWindow->setBoundings(fMinX, fMinY, fMaxX, fMaxY);
+}
 
-
-void GridWindow::setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY )
+void GridWindow::setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY)
 {
     m_fMinX = fMinX;
     m_fMinY = fMinY;
@@ -311,8 +438,6 @@ void GridWindow::setBoundings( double fMinX, double fMinY, double fMaxX, double
     computeChunk( m_fMinY, m_fMaxY, m_fChunkY, m_fMinChunkY );
 }
 
-
-
 void GridWindow::drawGrid()
 {
     char pBuf[256];
@@ -351,8 +476,6 @@ void GridWindow::drawGrid()
     drawLine( m_fMaxX, m_fMinY, m_fMaxX, m_fMaxY );
 }
 
-
-
 void GridWindow::drawOriginal()
 {
     if( m_nValues && m_pXValues && m_pOrigYValues )
@@ -366,8 +489,6 @@ void GridWindow::drawOriginal()
     }
 }
 
-
-
 void GridWindow::drawNew()
 {
     if( m_nValues && m_pXValues && m_pNewYValues )
@@ -383,8 +504,6 @@ void GridWindow::drawNew()
     }
 }
 
-
-
 void GridWindow::drawHandles()
 {
     for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
@@ -393,19 +512,15 @@ void GridWindow::drawHandles()
     }
 }
 
-
-
 void GridWindow::Paint( const Rectangle& rRect )
 {
-    ModalDialog::Paint( rRect );
+    Window::Paint(rRect);
     drawGrid();
     drawOriginal();
     drawNew();
     drawHandles();
 }
 
-
-
 void GridWindow::MouseMove( const MouseEvent& rEvt )
 {
     if( rEvt.GetButtons() == MOUSE_LEFT && m_nDragIndex != 0xffffffff )
@@ -436,7 +551,7 @@ void GridWindow::MouseMove( const MouseEvent& rEvt )
         }
     }
 
-    ModalDialog::MouseMove( rEvt );
+    Window::MouseMove( rEvt );
 }
 
 void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
@@ -452,7 +567,7 @@ void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
         }
     }
 
-    ModalDialog::MouseButtonUp( rEvt );
+    Window::MouseButtonUp( rEvt );
 }
 
 void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
@@ -502,81 +617,95 @@ void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
         Paint( m_aGridArea );
     }
 
-    ModalDialog::MouseButtonDown( rEvt );
+    Window::MouseButtonDown( rEvt );
 }
 
-IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton )
+void GridWindow::ChangeMode(int nType)
 {
-    if( pButton == m_pResetButton )
+    switch( nType )
     {
-        int nType = m_pResetTypeBox->GetSelectEntryPos();
-        switch( nType )
+        case LINEAR_ASCENDING:
         {
-            case LINEAR_ASCENDING:
+            for( int i = 0; i < m_nValues; i++ )
             {
-                for( int i = 0; i < m_nValues; i++ )
-                {
-                    m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX);
-                }
+                m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX);
             }
-            break;
-            case LINEAR_DESCENDING:
-            {
-                for( int i = 0; i < m_nValues; i++ )
-                {
-                    m_pNewYValues[ i ] = m_fMaxY - (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX);
-                }
-            }
-            break;
-            case RESET:
+        }
+        break;
+        case LINEAR_DESCENDING:
+        {
+            for( int i = 0; i < m_nValues; i++ )
             {
-                if( m_pOrigYValues && m_pNewYValues && m_nValues )
-                    memcpy( m_pNewYValues, m_pOrigYValues, m_nValues*sizeof(double) );
+                m_pNewYValues[ i ] = m_fMaxY - (m_fMaxY-m_fMinY)/(m_fMaxX-m_fMinX)*(m_pXValues[i]-m_fMinX);
             }
-            break;
-            case EXPONENTIAL:
+        }
+        break;
+        case RESET:
+        {
+            if( m_pOrigYValues && m_pNewYValues && m_nValues )
+                memcpy( m_pNewYValues, m_pOrigYValues, m_nValues*sizeof(double) );
+        }
+        break;
+        case EXPONENTIAL:
+        {
+            for( int i = 0; i < m_nValues; i++ )
             {
-                for( int i = 0; i < m_nValues; i++ )
-                {
-                    m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(std::exp((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX))-1.0)/(M_E-1.0);
-                }
+                m_pNewYValues[ i ] = m_fMinY + (m_fMaxY-m_fMinY)*(std::exp((m_pXValues[i]-m_fMinX)/(m_fMaxX-m_fMinX))-1.0)/(M_E-1.0);
             }
-            break;
-
-            default:
-                break;
         }
+        break;
 
-        if (m_pNewYValues)
+        default:
+            break;
+    }
+
+    if (m_pNewYValues)
+    {
+        for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
         {
-            for(sal_uInt32 i(0L); i < m_aHandles.size(); i++)
+            // find nearest xvalue
+            double x, y;
+            transform( m_aHandles[i].maPos, x, y );
+            int nIndex = 0;
+            double delta = std::fabs( x-m_pXValues[0] );
+            for( int n = 1; n < m_nValues; n++ )
             {
-                // find nearest xvalue
-                double x, y;
-                transform( m_aHandles[i].maPos, x, y );
-                int nIndex = 0;
-                double delta = std::fabs( x-m_pXValues[0] );
-                for( int n = 1; n < m_nValues; n++ )
+                if( delta > std::fabs( x - m_pXValues[ n ] ) )
                 {
-                    if( delta > std::fabs( x - m_pXValues[ n ] ) )
-                    {
-                        delta = std::fabs( x - m_pXValues[ n ] );
-                        nIndex = n;
-                    }
+                    delta = std::fabs( x - m_pXValues[ n ] );
+                    nIndex = n;
                 }
-                if( 0 == i )
-                    m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] );
-                else if( m_aHandles.size() - 1L == i )
-                    m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] );
-                else
-                    m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] );
             }
+            if( 0 == i )
+                m_aHandles[i].maPos = transform( m_fMinX, m_pNewYValues[ nIndex ] );
+            else if( m_aHandles.size() - 1L == i )
+                m_aHandles[i].maPos = transform( m_fMaxX, m_pNewYValues[ nIndex ] );
+            else
+                m_aHandles[i].maPos = transform( m_pXValues[ nIndex ], m_pNewYValues[ nIndex ] );
         }
+    }
 
-        Invalidate( m_aGridArea );
-        Paint(Rectangle());
+    Invalidate();
+}
+
+IMPL_LINK( GridDialog, ClickButtonHdl, Button*, pButton )
+{
+    if (pButton == m_pResetButton)
+    {
+        int nType = m_pResetTypeBox->GetSelectEntryPos();
+        m_pGridWindow->ChangeMode(nType);
     }
     return 0;
 }
 
+double* GridDialog::getNewYValues()
+{
+    return m_pGridWindow->getNewYValues();
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeGridWindow(Window *pParent, VclBuilder::stringmap &)
+{
+    return new GridWindow(pParent);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx
index da59d65..7416c6a 100644
--- a/extensions/source/scanner/grid.hxx
+++ b/extensions/source/scanner/grid.hxx
@@ -25,125 +25,33 @@
 #include <vcl/dialog.hxx>
 #include <vcl/fixed.hxx>
 
-class GridWindow : public ModalDialog
-{
-    // helper class for handles
-    struct impHandle
-    {
-        Point           maPos;
-        sal_uInt16      mnOffX;
-        sal_uInt16      mnOffY;
-
-        impHandle(const Point& rPos, sal_uInt16 nX, sal_uInt16 nY)
-        :   maPos(rPos), mnOffX(nX), mnOffY(nY)
-        {
-        }
-
-        bool operator<(const impHandle& rComp) const
-        {
-            return (maPos.X() < rComp.maPos.X());
-        }
-
-        void draw(Window& rWin, const BitmapEx& rBitmapEx)
-        {
-            const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
-            rWin.DrawBitmapEx(maPos - aOffset, rBitmapEx);
-        }
-
-        bool isHit(Window& rWin, const Point& rPos)
-        {
-            const Point aOffset(rWin.PixelToLogic(Point(mnOffX, mnOffY)));
-            const Rectangle aTarget(maPos - aOffset, maPos + aOffset);
-            return aTarget.IsInside(rPos);
-        }
-    };
-
-    enum resetType
-    {
-        LINEAR_ASCENDING = 0,
-        LINEAR_DESCENDING = 1,
-        RESET = 2,
-        EXPONENTIAL = 3
-    };
-
-    Rectangle       m_aGridArea;
-
-    double          m_fMinX;
-    double          m_fMinY;
-    double          m_fMaxX;
-    double          m_fMaxY;
-
-    double          m_fChunkX;
-    double          m_fMinChunkX;
-    double          m_fChunkY;
-    double          m_fMinChunkY;
-
-    double*         m_pXValues;
-    double*         m_pOrigYValues;
-    int             m_nValues;
-    double*         m_pNewYValues;
-
-    sal_uInt16      m_BmOffX;
-    sal_uInt16      m_BmOffY;
-
-    bool            m_bCutValues;
+class GridWindow;
 
-    // stuff for handles
-    std::vector< impHandle >    m_aHandles;
-    sal_uInt32                  m_nDragIndex;
-
-    BitmapEx        m_aMarkerBitmap;
+enum resetType
+{
+    LINEAR_ASCENDING = 0,
+    LINEAR_DESCENDING = 1,
+    RESET = 2,
+    EXPONENTIAL = 3
+};
 
+class GridDialog : public ModalDialog
+{
     OKButton*       m_pOKButton;
 
     ListBox*        m_pResetTypeBox;
     PushButton*     m_pResetButton;
 
-
-    Point transform( double x, double y );
-    void transform( const Point& rOriginal, double& x, double& y );
-
-    double findMinX();
-    double findMinY();
-    double findMaxX();
-    double findMaxY();
-
-    void updateRectSize();
-
-    void drawGrid();
-    void drawOriginal();
-    void drawNew();
-    void drawHandles();
-
-    void computeExtremes();
-    void computeChunk( double fMin, double fMax, double& fChunkOut, double& fMinChunkOut );
-    void computeNew();
-    double interpolate( double x, double* pNodeX, double* pNodeY, int nNodes );
+    GridWindow*     m_pGridWindow;
 
     DECL_LINK( ClickButtonHdl, Button* );
 
-    virtual void MouseMove( const MouseEvent& ) SAL_OVERRIDE;
-    virtual void MouseButtonDown( const MouseEvent& ) SAL_OVERRIDE;
-    virtual void MouseButtonUp( const MouseEvent& ) SAL_OVERRIDE;
 public:
-    GridWindow( double* pXValues, double* pYValues, int nValues,
-                Window* pParent, bool bCutValues = true );
-    virtual ~GridWindow();
-
-    void setBoundings( double fMinX, double fMinY, double fMaxX, double fMaxY );
-    double getMinX() { return m_fMinX; }
-    double getMinY() { return m_fMinY; }
-    double getMaxX() { return m_fMaxX; }
-    double getMaxY() { return m_fMaxY; }
-
-    int countValues() { return m_nValues; }
-    double* getXValues() { return m_pXValues; }
-    double* getOrigYValues() { return m_pOrigYValues; }
-    double* getNewYValues() { return m_pNewYValues; }
-
-    void drawLine( double x1, double y1, double x2, double y2 );
+    GridDialog(double* pXValues, double* pYValues, int nValues,
+                Window* pParent, bool bCutValues = true);
 
-    virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
+    void setBoundings(double fMinX, double fMinY, double fMaxX, double fMaxY);
+    double* getNewYValues();
 };
 
 #endif // INCLUDED_EXTENSIONS_SOURCE_SCANNER_GRID_HXX
diff --git a/extensions/source/scanner/sanedlg.cxx b/extensions/source/scanner/sanedlg.cxx
index ebae9fe..6e431bd 100644
--- a/extensions/source/scanner/sanedlg.cxx
+++ b/extensions/source/scanner/sanedlg.cxx
@@ -559,7 +559,7 @@ IMPL_LINK( SaneDlg, ClickBtnHdl, Button*, pButton )
                         x[ i ] = (double)i;
                     mrSane.GetOptionValue( mnCurrentOption, y.get() );
 
-                    GridWindow aGrid( x.get(), y.get(), nElements, this );
+                    GridDialog aGrid( x.get(), y.get(), nElements, this );
                     aGrid.SetText( mrSane.GetOptionName( mnCurrentOption ) );
                     aGrid.setBoundings( 0, mfMin, nElements, mfMax );
                     if( aGrid.Execute() && aGrid.getNewYValues() )
diff --git a/extensions/uiconfig/scanner/ui/griddialog.ui b/extensions/uiconfig/scanner/ui/griddialog.ui
index 1d95b3c..25638a5 100644
--- a/extensions/uiconfig/scanner/ui/griddialog.ui
+++ b/extensions/uiconfig/scanner/ui/griddialog.ui
@@ -1,6 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkDialog" id="GridDialog">
     <property name="can_focus">False</property>
     <property name="border_width">6</property>
@@ -20,8 +22,9 @@
                 <property name="use_action_appearance">False</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -37,7 +40,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_stock">True</property>
               </object>
               <packing>
@@ -47,9 +49,15 @@
               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="resetTypeCombobox">
+              <object class="GtkComboBoxText" id="resetTypeCombobox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <items>
+                  <item translatable="yes">Linear ascending</item>
+                  <item translatable="yes">Linear descending</item>
+                  <item translatable="yes">Original values</item>
+                  <item translatable="yes">Exponential increasing</item>
+                </items>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -64,7 +72,6 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
-                <property name="use_action_appearance">False</property>
                 <property name="use_underline">True</property>
               </object>
               <packing>
@@ -82,7 +89,19 @@
           </packing>
         </child>
         <child>
-          <placeholder/>
+          <object class="scnlo-GridWindow" id="gridwindow">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="halign">center</property>
+            <property name="valign">start</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
         </child>
       </object>
     </child>
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index a39e779..be14101 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -252,6 +252,10 @@
                         generic-name="Scan Preview Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
 
+    <glade-widget-class title="Gamma Grid" name="scnlo-GridWindow"
+                        generic-name="Gamma Grid Widget" parent="GtkDrawingArea"
+                        icon-name="widget-gtk-drawingarea"/>
+
     <glade-widget-class title="Token Window" name="swuilo-SwTokenWindow"
                         generic-name="Token Window" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
commit 99b1b4d4751081cee70d4ccb1d459a3776ed2250
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jun 12 11:59:56 2014 +0100

    don't use raw english string
    
    Change-Id: I5f34889520afb2149ba480f56d59f14d75ee50c0

diff --git a/extensions/source/scanner/grid.cxx b/extensions/source/scanner/grid.cxx
index 5266919..898f834 100644
--- a/extensions/source/scanner/grid.cxx
+++ b/extensions/source/scanner/grid.cxx
@@ -62,17 +62,6 @@ GridWindow::GridWindow(double* pXValues, double* pYValues, int nValues, Window*
     get(m_pOKButton, "ok");
     get(m_pResetTypeBox, "resetTypeCombobox");
     get(m_pResetButton, "resetButton");
-    sal_uInt16 nPos = m_pResetTypeBox->InsertEntry( "Linear ascending" );
-    m_pResetTypeBox->SetEntryData( nPos, (void *)LINEAR_ASCENDING );
-
-    nPos = m_pResetTypeBox->InsertEntry( "Linear descending" );
-    m_pResetTypeBox->SetEntryData( nPos, (void *)LINEAR_DESCENDING );
-
-    nPos = m_pResetTypeBox->InsertEntry( "Original values" );
-    m_pResetTypeBox->SetEntryData( nPos, (void *)RESET );
-
-    nPos = m_pResetTypeBox->InsertEntry( "Exponential increasing" );
-    m_pResetTypeBox->SetEntryData( nPos, (void *)EXPONENTIAL );
 
     m_pResetTypeBox->SelectEntryPos( 0 );
 
@@ -450,8 +439,6 @@ void GridWindow::MouseMove( const MouseEvent& rEvt )
     ModalDialog::MouseMove( rEvt );
 }
 
-
-
 void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
 {
     if( rEvt.GetButtons() == MOUSE_LEFT )
@@ -468,8 +455,6 @@ void GridWindow::MouseButtonUp( const MouseEvent& rEvt )
     ModalDialog::MouseButtonUp( rEvt );
 }
 
-
-
 void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
 {
     Point aPoint( rEvt.GetPosPixel() );
@@ -520,13 +505,11 @@ void GridWindow::MouseButtonDown( const MouseEvent& rEvt )
     ModalDialog::MouseButtonDown( rEvt );
 }
 
-
-
 IMPL_LINK( GridWindow, ClickButtonHdl, Button*, pButton )
 {
     if( pButton == m_pResetButton )
     {
-        int nType = (int)(sal_IntPtr)m_pResetTypeBox->GetEntryData( m_pResetTypeBox->GetSelectEntryPos() );
+        int nType = m_pResetTypeBox->GetSelectEntryPos();
         switch( nType )
         {
             case LINEAR_ASCENDING:
diff --git a/extensions/source/scanner/grid.hxx b/extensions/source/scanner/grid.hxx
index 04346ba..da59d65 100644
--- a/extensions/source/scanner/grid.hxx
+++ b/extensions/source/scanner/grid.hxx
@@ -60,10 +60,10 @@ class GridWindow : public ModalDialog
 
     enum resetType
     {
-        LINEAR_ASCENDING = 10,
-        LINEAR_DESCENDING,
-        RESET,
-        EXPONENTIAL
+        LINEAR_ASCENDING = 0,
+        LINEAR_DESCENDING = 1,
+        RESET = 2,
+        EXPONENTIAL = 3
     };
 
     Rectangle       m_aGridArea;


More information about the Libreoffice-commits mailing list