From f2c3a695d0cedb4adfab320eb177e13de948b589 Mon Sep 17 00:00:00 2001
From: Ruslan Kabatsayev <b7.10110111@gmail.com>
Date: Thu, 7 Jun 2012 03:54:43 +0400
Subject: Implement native FixedLine render, add GTK support for it

Change-Id: I142cc8c48331aaed0d157b4b0f81e7c021005624
---
 vcl/inc/unx/gtk/gtkgdi.hxx               |    5 +++++
 vcl/source/window/decoview.cxx           |   11 +++++++++++
 vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx |   25 +++++++++++++++++++++++++
 3 files changed, 41 insertions(+)

diff --git a/vcl/inc/unx/gtk/gtkgdi.hxx b/vcl/inc/unx/gtk/gtkgdi.hxx
index b4fe837..a8d6584 100644
--- a/vcl/inc/unx/gtk/gtkgdi.hxx
+++ b/vcl/inc/unx/gtk/gtkgdi.hxx
@@ -165,6 +165,11 @@ protected:
     GdkPixmap* NWGetPixmapFromScreen( Rectangle srcRect );
     sal_Bool NWRenderPixmapToScreen( GdkPixmap* pPixmap, Rectangle dstRect );
 
+    sal_Bool NWPaintGTKFixedLine( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
+                           const Rectangle& rControlRectangle,
+                           const clipList& rClipList,
+                           ControlState nState, const ImplControlValue& aValue,
+                           const OUString& rCaption );
     sal_Bool NWPaintGTKFrame( GdkDrawable* gdkDrawable, ControlType nType, ControlPart nPart,
                            const Rectangle& rControlRectangle,
                            const clipList& rClipList,
diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx
index 381043e..3e85e2e 100644
--- a/vcl/source/window/decoview.cxx
+++ b/vcl/source/window/decoview.cxx
@@ -1087,6 +1087,17 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo
 {
     Point aStart( rStart ), aStop( rStop );
     const StyleSettings& rStyleSettings = mpOutDev->GetSettings().GetStyleSettings();
+    Window *const pWin = (mpOutDev->GetOutDevType()==OUTDEV_WINDOW) ? (Window*) mpOutDev: NULL;
+    if(pWin)
+    {
+        ControlPart nPart = ( bVertical ? PART_SEPARATOR_VERT : PART_SEPARATOR_HORZ );
+        bool nativeSupported = pWin->IsNativeControlSupported( CTRL_FIXEDLINE, nPart );
+        ImplControlValue    aValue;
+        ControlState        nState = 0;
+        Rectangle aRect(rStart,rStop);
+        if(nativeSupported && pWin->DrawNativeControl(CTRL_FIXEDLINE,nPart,aRect,nState,aValue,rtl::OUString()))
+            return;
+    }
 
     mpOutDev->Push( PUSH_LINECOLOR );
     if ( rStyleSettings.GetOptions() & STYLE_OPTION_MONO )
diff --git a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
index 6ffbb8c..2b5d3c8 100644
--- a/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk/gdi/salnativewidgets-gtk.cxx
@@ -635,6 +635,11 @@ sal_Bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPar
             if(nPart == PART_TRACK_HORZ_AREA || nPart == PART_TRACK_VERT_AREA)
                 return true;
             break;
+
+        case CTRL_FIXEDLINE:
+            if(nPart == PART_SEPARATOR_VERT || nPart == PART_SEPARATOR_HORZ)
+                return true;
+            break;
     }
 
     return false;
@@ -921,6 +926,10 @@ sal_Bool GtkSalGraphics::drawNativeControl(    ControlType nType,
     {
         returnVal = NWPaintGTKWindowBackground( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
     }
+    else if( nType == CTRL_FIXEDLINE )
+    {
+        returnVal = NWPaintGTKFixedLine( gdkDrawable, nType, nPart, aCtrlRect, aClip, nState, aValue, rCaption );
+    }
 
     if(nType==CTRL_FRAME)
     {
@@ -1187,6 +1196,22 @@ sal_Bool GtkSalGraphics::getNativeControlRegion(  ControlType nType,
 /************************************************************************
  * Individual control drawing functions
  ************************************************************************/
+sal_Bool GtkSalGraphics::NWPaintGTKFixedLine(
+            GdkDrawable* gdkDrawable,
+            ControlType, ControlPart nPart,
+            const Rectangle& rControlRectangle,
+            const clipList&,
+            ControlState, const ImplControlValue&,
+            const OUString& )
+{
+    if(nPart == PART_SEPARATOR_HORZ)
+        gtk_paint_hline(m_pWindow->style,gdkDrawable,GTK_STATE_NORMAL,NULL,m_pWindow,"hseparator",rControlRectangle.Left(),rControlRectangle.Right(),rControlRectangle.Top());
+    else
+        gtk_paint_vline(m_pWindow->style,gdkDrawable,GTK_STATE_NORMAL,NULL,m_pWindow,"vseparator",rControlRectangle.Top(),rControlRectangle.Bottom(),rControlRectangle.Left());
+
+    return true;
+}
+
 sal_Bool GtkSalGraphics::NWPaintGTKFrame(
             GdkDrawable* gdkDrawable,
             ControlType, ControlPart,
-- 
1.7.10.2

