[ooo-build-commit] patches/dev300

René Engelhard rene at kemper.freedesktop.org
Sat Dec 26 04:32:07 PST 2009


 patches/dev300/apply                    |    6 
 patches/dev300/kde4_fpicker_fixes3.diff |   70 +++
 patches/dev300/kde4_vcl_fixes2.diff     |  662 ++++++++++++++++++++++++++++++++
 3 files changed, 738 insertions(+)

New commits:
commit 54f38c9aea0dfb7f084d9b625aac89e76ccc862b
Author: Roman Shtylman <shtylman at gmail.com>
Date:   Fri Dec 25 19:18:18 2009 -0500

    fix for various filepicker bugs and vcl bugs
    
    * patches/dev300/apply:
    * patches/dev300/kde4_fpicker_fixes3.diff:
    	override existing files
    	multiple autoextension checkboxes
    * patches/dev300/kde4_vcl_fixes2.diff:
    	3rd party plugin should not cause crash

diff --git a/patches/dev300/apply b/patches/dev300/apply
index 02256a9..d4d2c8f 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -2109,6 +2109,12 @@ kde4_vcl_fixes.diff
 # Fixes filter issues and crash when dragging
 kde4_fpicker_fixes2.diff
 
+# fixes multiple auto extension checkboxes, fixes override of exising file bug
+kde4_fpicker_fixes3.diff
+
+# fixes 3rd party plugin support
+kde4_vcl_fixes2.diff
+
 # Fix the KDE3 backend build, when KDE4 is installed
 kde4-and-kde3-shell-build.diff, jholesov
 
diff --git a/patches/dev300/kde4_fpicker_fixes3.diff b/patches/dev300/kde4_fpicker_fixes3.diff
new file mode 100644
index 0000000..edd562a
--- /dev/null
+++ b/patches/dev300/kde4_fpicker_fixes3.diff
@@ -0,0 +1,70 @@
+diff --git fpicker/source/unx/kde4/KDE4FilePicker.cxx fpicker/source/unx/kde4/KDE4FilePicker.cxx
+index d7dfbc1..a5418d3 100644
+--- fpicker/source/unx/kde4/KDE4FilePicker.cxx
++++ fpicker/source/unx/kde4/KDE4FilePicker.cxx
+@@ -163,8 +163,6 @@ KDE4FilePicker::KDE4FilePicker( const uno::Reference<lang::XMultiServiceFactory>
+     
+ 	_dialog = new KFileDialog(KUrl("~"), QString(""), 0, _extraControls);
+     _dialog->setMode(KFile::File | KFile::LocalOnly);
+-    
+-	_dialog->setStyleSheet("color: black;");
+ }
+ 
+ KDE4FilePicker::~KDE4FilePicker()
+@@ -209,6 +207,7 @@ sal_Int16 SAL_CALL KDE4FilePicker::execute()
+     
+ 	_dialog->clearFilter();
+     _dialog->setFilter(_filter);
++	_dialog->filterWidget()->setEditable(false);
+ 	
+     //block and wait for user input
+ 	if (_dialog->exec() == KFileDialog::Accepted)
+@@ -260,7 +259,7 @@ uno::Sequence< ::rtl::OUString > SAL_CALL KDE4FilePicker::getFiles()
+ 		QCheckBox *cb = dynamic_cast<QCheckBox*> (
+ 			_customWidgets[ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION ]);
+ 			
+-		if (cb->isChecked())
++		if (cb && cb->isChecked())
+ 		{
+ 			extension = _dialog->currentFilter(); // assuming filter value is like this *.ext
+ 			extension.replace("*","");
+@@ -655,27 +654,27 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
+             
+         case FILESAVE_AUTOEXTENSION:
+             operationMode = KFileDialog::Saving;
+-            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+             break;
+ 
+         case FILESAVE_AUTOEXTENSION_PASSWORD:
+         {
+             operationMode = KFileDialog::Saving;
+-            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+             addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
+             break;
+         }
+         case FILESAVE_AUTOEXTENSION_PASSWORD_FILTEROPTIONS:
+         {
+             operationMode = KFileDialog::Saving;
+-            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+             addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_PASSWORD );
+             addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_FILTEROPTIONS );
+             break;
+         }
+         case FILESAVE_AUTOEXTENSION_SELECTION:
+             operationMode = KFileDialog::Saving;
+-            addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
++            //addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION );
+             addCustomControl( ExtendedFilePickerElementIds::CHECKBOX_SELECTION );
+             break;
+ 
+@@ -712,6 +711,7 @@ void SAL_CALL KDE4FilePicker::initialize( const uno::Sequence<uno::Any> &args )
+     }
+     
+     _dialog->setOperationMode(operationMode);
++	_dialog->setConfirmOverwrite(true);
+ }
+ 
+ void SAL_CALL KDE4FilePicker::cancel()
diff --git a/patches/dev300/kde4_vcl_fixes2.diff b/patches/dev300/kde4_vcl_fixes2.diff
new file mode 100644
index 0000000..38a47c6
--- /dev/null
+++ b/patches/dev300/kde4_vcl_fixes2.diff
@@ -0,0 +1,662 @@
+diff --git vcl/unx/kde4/KDESalGraphics.cxx vcl/unx/kde4/KDESalGraphics.cxx
+index 0e8accc..4c94ffa 100644
+--- vcl/unx/kde4/KDESalGraphics.cxx
++++ vcl/unx/kde4/KDESalGraphics.cxx
+@@ -87,9 +87,18 @@ QStyle::State vclStateValue2StateFlag( ControlState nControlState,
+ QRect region2QRect( const Region& rControlRegion )
+ {
+     Rectangle aRect = rControlRegion.GetBoundRect();
++    return QRect(aRect.getX(), aRect.getY(), aRect.getWidth(), aRect.GetHeight());
++}
++
++KDESalGraphics::KDESalGraphics() : 
++	m_image(0)
++{
++}
+ 
+-    return QRect( QPoint( aRect.Left(), aRect.Top() ),
+-          QPoint( aRect.Right(), aRect.Bottom() ) );
++KDESalGraphics::~KDESalGraphics()
++{
++	if (m_image)
++		delete m_image;
+ }
+ 
+ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart part )
+@@ -126,7 +135,6 @@ BOOL KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart par
+ 	//if ( (type == CTRL_PROGRESS)    && (part == PART_ENTIRE_CONTROL) ) return true;
+ }
+ 
+-
+ BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
+                                            const Region&, const Point&,
+                                            SalControlHandle&, BOOL& )
+@@ -134,28 +142,57 @@ BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
+     return FALSE;
+ }
+ 
+-void lcl_drawFrame( QRect& i_rRect, QPainter& i_rPainter, QStyle::PrimitiveElement i_nElement,
+-                    ControlState i_nState, const ImplControlValue& i_rValue )
++/// helper drawing methods
++namespace 
+ {
+-    #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+-    QStyleOptionFrameV3 styleOption;
+-    styleOption.frameShape = QFrame::StyledPanel;		
+-    #else
+-    QStyleOptionFrame styleOption;
+-    QFrame aFrame( NULL );
+-    aFrame.setFrameRect( QRect(0, 0, i_rRect.width(), i_rRect.height()) );
+-    aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
+-    aFrame.ensurePolished();
+-    styleOption.initFrom( &aFrame );
+-    styleOption.lineWidth = aFrame.lineWidth();
+-    styleOption.midLineWidth = aFrame.midLineWidth();
+-    #endif
+-    styleOption.rect = QRect(0, 0, i_rRect.width(), i_rRect.height());
+-    styleOption.state = vclStateValue2StateFlag( i_nState, i_rValue );
+-    #if ( QT_VERSION < QT_VERSION_CHECK( 4, 5, 0 ) )
+-    styleOption.state |= QStyle::State_Sunken;
+-    #endif
+-    kapp->style()->drawPrimitive(i_nElement, &styleOption, &i_rPainter);
++	void draw(QStyle::ControlElement element, QStyleOption* option, QImage* image, QStyle::State state)
++	{
++		option->state |= state;
++		option->rect = image->rect();
++		
++		QPainter painter(image);
++		kapp->style()->drawControl(element, option, &painter);
++	}
++
++	void draw(QStyle::PrimitiveElement element, QStyleOption* option, QImage* image, QStyle::State state)
++	{
++		option->state |= state;
++		option->rect = image->rect();
++		
++		QPainter painter(image);
++		kapp->style()->drawPrimitive(element, option, &painter);
++	}
++
++	void draw(QStyle::ComplexControl element, QStyleOptionComplex* option, QImage* image, QStyle::State state)
++	{
++		option->state |= state;
++		option->rect = image->rect();
++		
++		QPainter painter(image);
++		kapp->style()->drawComplexControl(element, option, &painter);
++	}
++
++	void lcl_drawFrame(QStyle::PrimitiveElement element, QImage* image, QStyle::State state)
++	{
++	#if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
++		QStyleOptionFrameV3 option;
++		option.frameShape = QFrame::StyledPanel;
++		option.state = QStyle::State_Sunken;
++	#else
++		QStyleOptionFrame option;
++		
++		QFrame aFrame( NULL );
++		aFrame.setFrameRect( QRect(0, 0, image->width(), image->height()) );
++		aFrame.setFrameStyle( QFrame::StyledPanel | QFrame::Sunken );
++		aFrame.ensurePolished();
++		
++		option.initFrom( &aFrame );
++		option.lineWidth = aFrame.lineWidth();
++		option.midLineWidth = aFrame.midLineWidth();
++	#endif
++
++		draw(element, &option, image, state);
++	}
+ }
+ 
+ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+@@ -163,22 +200,15 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+                                         const ImplControlValue& value, SalControlHandle&,
+                                         const OUString& )
+ {
+-    
+ 	if (!IsNativeControlSupported(type, part))
+ 		return false;
+     
+     BOOL returnVal = true;
+-
+-	SelectFont();
+-	SelectPen();
+ 	
+-    Display* dpy = GetXDisplay();
+-    XLIB_Window drawable = GetDrawable();
+-    GC gc = SelectPen();
+-    
+ 	QRect widgetRect = region2QRect(rControlRegion.GetBoundRect());
+     if( type == CTRL_SPINBOX && part == PART_ALL_BUTTONS )
+         type = CTRL_SPINBUTTONS;
++	
+     if( type == CTRL_SPINBUTTONS )
+     {
+         SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
+@@ -188,125 +218,105 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+                             aButtonRect.Right(), aButtonRect.Bottom() );
+     }
+     
+-    QPixmap pixmap(widgetRect.width(), widgetRect.height());
+-    
+-	// always fill the background
+-	// this way we avoid copying the screen contents over to our pixmap
+-	pixmap.fill(KApplication::palette().color(QPalette::Window));
+-    
+-    QPainter painter(&pixmap);
+-    
++    //if no image, or resized, make a new image
++    if (!m_image || m_image->size() != widgetRect.size())
++	{
++		if (m_image)
++			delete m_image;
++		
++		m_image = new QImage(widgetRect.width(), widgetRect.height(), 
++							 QImage::Format_ARGB32);
++		m_image->fill(KApplication::palette().color(QPalette::Window).rgb());
++	}
++	
+     if (type == CTRL_PUSHBUTTON)
+     {
+-        QStyleOptionButton styleOption;
+-        
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state =vclStateValue2StateFlag( nControlState, value );
+-        
+-        kapp->style()->drawControl( QStyle::CE_PushButton, &styleOption, &painter);
+-    }
+-    else if ( (type == CTRL_MENUBAR))
+-    {
+-        if (part == PART_MENU_ITEM) 
+-        {
+-            QStyleOptionMenuItem styleOption;
+-            
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-            
+-            kapp->style()->drawControl( QStyle::CE_MenuBarItem, &styleOption, &painter);
+-        }
++		QStyleOptionButton option;
++		draw(QStyle::CE_PushButton, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
++	}
++    else if (type == CTRL_MENUBAR)
++    {	
++		if (part == PART_MENU_ITEM)
++		{
++			QStyleOptionMenuItem option;
++			draw(QStyle::CE_MenuBarItem, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
++		}
+ 		else if (part == PART_ENTIRE_CONTROL)
+-        {
+-        }
++		{
++			QStyleOption option;
++			draw(QStyle::CE_MenuBarEmptyArea, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
++		}
++		else
++		{
++			returnVal = false;
++		}
+     }
+     else if (type == CTRL_MENU_POPUP)
+     {		
+         if (part == PART_MENU_ITEM)
+         {
+-            QStyleOptionMenuItem styleOption;
+-            
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-            
+-            kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
++			QStyleOptionMenuItem option;
++			draw(QStyle::CE_MenuItem, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
+         }
+-        else if (part == PART_MENU_ITEM_CHECK_MARK)
++        else if (part == PART_MENU_ITEM_CHECK_MARK && nControlState & CTRL_STATE_PRESSED)
+         {
+-            QStyleOptionButton styleOption;
+-            
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-            
+-            if (nControlState & CTRL_STATE_PRESSED)
+-            {
+-                kapp->style()->drawPrimitive( QStyle::PE_IndicatorMenuCheckMark, &styleOption, &painter);
+-            }
++			QStyleOptionButton option;
++			draw(QStyle::PE_IndicatorMenuCheckMark, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
+         }
+-        else if (part == PART_MENU_ITEM_RADIO_MARK)
++        else if (part == PART_MENU_ITEM_RADIO_MARK && nControlState & CTRL_STATE_PRESSED)
+         {
+-            QStyleOptionButton styleOption;
+-            
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-            
+-            if (nControlState & CTRL_STATE_PRESSED)
+-            {
+-                kapp->style()->drawPrimitive( QStyle::PE_IndicatorRadioButton, &styleOption, &painter);
+-            }
++			QStyleOptionButton option;
++			draw(QStyle::PE_IndicatorRadioButton, &option, m_image, 
++				vclStateValue2StateFlag(nControlState, value));
+         }
+         else
+         {
+             
+-            #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+-            QStyleOptionFrameV3 styleOption;
+-            #else
+-            QStyleOptionFrameV2 styleOption;
+-            #endif
+-        
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-            #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+-            styleOption.frameShape = QFrame::StyledPanel;
+-            #endif
+-            
+-            kapp->style()->drawPrimitive( QStyle::PE_FrameMenu, &styleOption, &painter);
++#if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
++			QStyleOptionFrameV3 option;
++			option.frameShape = QFrame::StyledPanel;
++#else
++			QStyleOptionFrameV2 option;
++#endif
++			draw(QStyle::PE_FrameMenu, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
+         }
+     }
+ 	else if (type == CTRL_TOOLBAR)
+     {
+ 		if (part == PART_BUTTON)
+ 		{
+-			QStyleOptionToolButton styleOption;
+-			
+-			styleOption.arrowType = Qt::NoArrow;
+-			styleOption.subControls = QStyle::SC_ToolButton;
++			QStyleOptionToolButton option;
++			option.arrowType = Qt::NoArrow;
++			option.subControls = QStyle::SC_ToolButton;
++			option.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
+ 			
+-			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-			styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-			styleOption.state |= QStyle::State_Raised | QStyle::State_Enabled | QStyle::State_AutoRaise;
+-			
+-			kapp->style()->drawComplexControl( QStyle::CC_ToolButton, &styleOption, &painter);
++			draw(QStyle::CC_ToolButton, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
+ 		}
+ 		else if (part == PART_THUMB_VERT)
+ 		{
+-			QStyleOption styleOption;
+-        
+-			int width = kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent);
++			const int tw = widgetRect.width();
++			widgetRect.setWidth(kapp->style()->pixelMetric(QStyle::PM_ToolBarHandleExtent));
+ 			
+-			styleOption.rect = QRect(0, 0, width, widgetRect.height());
+-			styleOption.state = QStyle::State_Horizontal;
++			QStyleOption option;
++			option.state = QStyle::State_Horizontal;
+ 			
+-			kapp->style()->drawPrimitive( QStyle::PE_IndicatorToolBarHandle, &styleOption, &painter);
++			draw(QStyle::PE_IndicatorToolBarHandle, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
++				 
++			widgetRect.setWidth(tw);
+ 		}
+ 		else if (part == PART_ENTIRE_CONTROL)
+ 		{
+-			QStyleOptionToolBar styleOption;
+-        
+-			styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-			styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-			
+-			kapp->style()->drawControl( QStyle::CE_ToolBar, &styleOption, &painter);
++			QStyleOptionToolBar option;
++			draw(QStyle::CE_ToolBar, &option, m_image, 
++				 vclStateValue2StateFlag(nControlState, value));
+ 		}
+ 		else
+ 		{
+@@ -314,212 +324,172 @@ BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
+ 		}
+     }
+     else if (type == CTRL_EDITBOX)
+-    {
+-        
+-        //TODO hover?? OO does not seem to do this for line edits
+-        
+-        #if ( QT_VERSION >= QT_VERSION_CHECK( 4, 5, 0 ) )
+-        QStyleOptionFrameV3 styleOption;
+-        #else
+-        QStyleOptionFrameV2 styleOption;
+-        #endif
+-        
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        //TODO...how does the line edit draw itself internally??
+-        styleOption.rect = QRect(2, 2, widgetRect.width()-4, widgetRect.height()-4);
+-        kapp->style()->drawPrimitive( QStyle::PE_PanelLineEdit, &styleOption, &painter);
+-        
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        kapp->style()->drawPrimitive( QStyle::PE_FrameLineEdit, &styleOption, &painter);
++    {   
++		QStyleOptionFrameV2 option;
++		draw(QStyle::PE_FrameLineEdit, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
++				 
++		draw(QStyle::PE_PanelLineEdit, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_COMBOBOX)
+     {
+-        
+-        QStyleOptionComboBox styleOption;
+-        
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        styleOption.editable = true;
+-        
+-        kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
++		QStyleOptionComboBox option;
++		option.editable = true;
++		
++		draw(QStyle::CC_ComboBox, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_LISTBOX)
+     {
+         if( part == PART_WINDOW )
+         {
+-            lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value );
+-        }
+-        else
+-        {
+-        if( part == PART_WINDOW )
+-        {
+-            lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value );
++			lcl_drawFrame(QStyle::PE_Frame, m_image, 
++						  vclStateValue2StateFlag(nControlState, value));
+         }
+         else
+         {
+-            QStyleOptionComboBox styleOption;
+-            
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-            
++            QStyleOptionComboBox option;
+             if (part == PART_SUB_EDIT)
+-            {
+-                kapp->style()->drawControl(QStyle::CE_ComboBoxLabel, &styleOption, &painter);
+-            }
++				draw(QStyle::CE_ComboBoxLabel, &option, m_image, 
++					 vclStateValue2StateFlag(nControlState, value));
+             else
+-            {
+-                kapp->style()->drawComplexControl(QStyle::CC_ComboBox, &styleOption, &painter);
+-            }
+-        }
++				draw(QStyle::CC_ComboBox, &option, m_image, 
++					 vclStateValue2StateFlag(nControlState, value));
+         }
+     }
+     else if (type == CTRL_LISTNODE)
+     {
+-        QStyleOption styleOption;
+-        
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        styleOption.state |= QStyle::State_Item;
+-        styleOption.state |= QStyle::State_Children;
+-        
+-        if (nControlState & CTRL_STATE_PRESSED)
+-        {
+-            styleOption.state |= QStyle::State_Open;
+-        }
+-        
+-        kapp->style()->drawPrimitive(QStyle::PE_IndicatorBranch, &styleOption, &painter);
++		QStyleOption option;
++		option.state = QStyle::State_Item | QStyle::State_Children;
++		
++		if (nControlState & CTRL_STATE_PRESSED)
++            option.state |= QStyle::State_Open;
++		
++		draw(QStyle::PE_IndicatorBranch, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_CHECKBOX)
+     {	
+-        QStyleOptionButton styleOption;
+-        
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        kapp->style()->drawControl(QStyle::CE_CheckBox, &styleOption, &painter);
++		QStyleOptionButton option;
++		draw(QStyle::CE_CheckBox, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_SCROLLBAR)
+     {
+         if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
+         {
++			QStyleOptionSlider option;
++			
+             ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
+             
+-            QStyleOptionSlider styleOption;
+-            styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-            
+             //if the scroll bar is active (aka not degenrate...allow for hover events
+             if (sbVal->mnVisibleSize < sbVal->mnMax)
+-            {
+-                styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-                styleOption.state |= QStyle::State_MouseOver;
+-            }
++                option.state = QStyle::State_MouseOver;
+             
+             //horizontal or vertical
+             if (part == PART_DRAW_BACKGROUND_VERT)
+-            {
+-                styleOption.orientation = Qt::Vertical;
+-            }
++                option.orientation = Qt::Vertical;
+             else
+-            {
+-                styleOption.state |= QStyle::State_Horizontal;
+-            }
++                option.state |= QStyle::State_Horizontal;
+             
+             //setup parameters from the OO values
+-            styleOption.minimum = sbVal->mnMin;
+-            styleOption.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
+-            styleOption.sliderValue = sbVal->mnCur;
+-            styleOption.sliderPosition = sbVal->mnCur;
+-            styleOption.pageStep = sbVal->mnVisibleSize;
++            option.minimum = sbVal->mnMin;
++            option.maximum = sbVal->mnMax - sbVal->mnVisibleSize;
++            option.sliderValue = sbVal->mnCur;
++            option.sliderPosition = sbVal->mnCur;
++            option.pageStep = sbVal->mnVisibleSize;
+             
+             //setup the active control...always the slider
+             if (sbVal->mnThumbState & CTRL_STATE_ROLLOVER)
+-            {
+-                styleOption.activeSubControls = QStyle::SC_ScrollBarSlider;
+-            }
+-            
+-            kapp->style()->drawComplexControl(QStyle::CC_ScrollBar, &styleOption, &painter);
++                option.activeSubControls = QStyle::SC_ScrollBarSlider;
++			
++			draw(QStyle::CC_ScrollBar, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+         }
++        else
++		{
++			returnVal = false;
++		}
+     }
+     else if (type == CTRL_SPINBOX)
+     {
+-        QStyleOptionSpinBox styleOption;
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
++		QStyleOptionSpinBox option;
++		
+         // determine active control
+         SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
+         if( pSpinVal )
+         {
+             if( (pSpinVal->mnUpperState & CTRL_STATE_PRESSED) )
+-                styleOption.activeSubControls |= QStyle::SC_SpinBoxUp;
++                option.activeSubControls |= QStyle::SC_SpinBoxUp;
+             if( (pSpinVal->mnLowerState & CTRL_STATE_PRESSED) )
+-                styleOption.activeSubControls |= QStyle::SC_SpinBoxDown;
++                option.activeSubControls |= QStyle::SC_SpinBoxDown;
+         }
+-        
+-        kapp->style()->drawComplexControl(QStyle::CC_SpinBox, &styleOption, &painter);
++		
++		draw(QStyle::CC_SpinBox, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_GROUPBOX)
+     {
+-        QStyleOptionGroupBox styleOption;
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        kapp->style()->drawComplexControl(QStyle::CC_GroupBox, &styleOption, &painter);
++		QStyleOptionGroupBox option;
++		draw(QStyle::CC_GroupBox, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_RADIOBUTTON)
+     {
+-        QStyleOptionButton styleOption;
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        kapp->style()->drawControl(QStyle::CE_RadioButton, &styleOption, &painter);
++		QStyleOptionButton option;
++		draw(QStyle::CE_RadioButton, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_TOOLTIP)
+     {
+-        QStyleOption styleOption;
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        
+-        kapp->style()->drawPrimitive(QStyle::PE_PanelTipLabel, &styleOption, &painter);
++		QStyleOption option;
++		draw(QStyle::PE_PanelTipLabel, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_FRAME)
+     {
+-        lcl_drawFrame( widgetRect, painter, QStyle::PE_Frame, nControlState, value );
++		lcl_drawFrame(QStyle::PE_Frame, m_image, 
++					  vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_FIXEDBORDER)
+     {
+-        lcl_drawFrame( widgetRect, painter, QStyle::PE_FrameWindow, nControlState, value );
++		lcl_drawFrame(QStyle::PE_FrameWindow, m_image, 
++					  vclStateValue2StateFlag(nControlState, value));
+     }
+     else if (type == CTRL_WINDOW_BACKGROUND)
+     {
++		m_image->fill(KApplication::palette().color(QPalette::Window).rgb());
+     }
+     else if (type == CTRL_FIXEDLINE)
+     {
+-        QStyleOptionMenuItem styleOption;
+-            
+-        styleOption.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
+-        styleOption.state = vclStateValue2StateFlag( nControlState, value );
+-        styleOption.menuItemType = QStyleOptionMenuItem::Separator;
+-        styleOption.state |= QStyle::State_Item;
+-        
+-        kapp->style()->drawControl( QStyle::CE_MenuItem, &styleOption, &painter);
++		QStyleOptionMenuItem option;
++		option.menuItemType = QStyleOptionMenuItem::Separator;
++        option.state |= QStyle::State_Item;
++		
++		draw(QStyle::CE_MenuItem, &option, m_image, 
++			 vclStateValue2StateFlag(nControlState, value));
+     }
+     else
+     {
+-        returnVal = false;
+-    }
+-    
+-    if (returnVal)
+-    {
+-        X11SalGraphics::CopyScreenArea( dpy,
+-            pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
+-            drawable, GetScreenNumber(), GetVisual().GetDepth(), gc,
+-            0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top() );
+-    }
++        return false;
++	}
++
++	if (returnVal)
++	{
++		if( SelectFont() == 0 )
++			return false;
++		
++		QPixmap pixmap = QPixmap::fromImage(*m_image, Qt::ColorOnly | Qt::OrderedDither | Qt::OrderedAlphaDither);
++		X11SalGraphics::CopyScreenArea( GetXDisplay(),
++			pixmap.handle(), pixmap.x11Info().screen(), pixmap.x11Info().depth(),
++			GetDrawable(), GetScreenNumber(), GetVisual().GetDepth(),
++			SelectFont(), 0, 0, widgetRect.width(), widgetRect.height(), widgetRect.left(), widgetRect.top());
++		
++		return true;
++	}
+ 	
+-    return returnVal;
++	return false;
+ }
+ 
+ BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
+diff --git vcl/unx/kde4/KDESalGraphics.hxx vcl/unx/kde4/KDESalGraphics.hxx
+index 1a6a9c1..5014941 100644
+--- vcl/unx/kde4/KDESalGraphics.hxx
++++ vcl/unx/kde4/KDESalGraphics.hxx
+@@ -31,13 +31,19 @@
+ #include <saldisp.hxx>
+ #include <salgdi.h>
+ 
++#define Region QtXRegion
++#include <QImage>
++#undef Region
++
+ /** handles graphics drawings requests and performs the needed drawing operations */
+ class KDESalGraphics : public X11SalGraphics
+ {
++	QImage* m_image;
++	
+     public:
+-        KDESalGraphics() {}
+-        virtual ~KDESalGraphics() {}
+-        
++        KDESalGraphics();
++        virtual ~KDESalGraphics();
++		
+         /**
+             What widgets can be drawn the native way.
+             @param type Type of the widget.


More information about the ooo-build-commit mailing list