Commits

Anonymous committed a0389c6

ooo33gsl02: #i112873# change NativeWidget methods to be prepared for mapmodes (KDE4)

Comments (0)

Files changed (2)

vcl/unx/kde4/KDESalGraphics.cxx

 }
 
 /** 
- Convert VCL Region to QRect.
- @param rControlRegion The region to convert.
- @return The bounding box of the region.
+ Convert VCL Rectangle to QRect.
+ @param rControlRegion The Rectangle to convert.
+ @return The matching QRect
 */
-QRect region2QRect( const Region& rControlRegion )
+QRect region2QRect( const Rectangle& rControlRegion )
 {
-    Rectangle aRect = rControlRegion.GetBoundRect();
-
-    return QRect(aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight());
+    return QRect(rControlRegion.Left(), rControlRegion.Top(), rControlRegion.GetWidth(), rControlRegion.GetHeight());
 }
 
 KDESalGraphics::KDESalGraphics() : 
 }
 
 BOOL KDESalGraphics::hitTestNativeControl( ControlType, ControlPart,
-										   const Region&, const Point&,
+										   const Rectangle&, const Point&,
 										   BOOL& )
 {
     return FALSE;
 }
 
 BOOL KDESalGraphics::drawNativeControl( ControlType type, ControlPart part,
-										const Region& rControlRegion, ControlState nControlState,
+										const Rectangle& rControlRegion, ControlState nControlState,
 										const ImplControlValue& value,
 										const OUString& )
 {
         type = CTRL_SPINBUTTONS;
     if( type == CTRL_SPINBUTTONS )
     {
-        SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
+        OSL_ASSERT( value.getType() != CTRL_SPINBUTTONS );
+        const SpinbuttonValue* pSpinVal = static_cast<const SpinbuttonValue *>(&value);
         Rectangle aButtonRect( pSpinVal->maUpperRect);
         aButtonRect.Union( pSpinVal->maLowerRect );;
         widgetRect = QRect( aButtonRect.Left(), aButtonRect.Top(),
 		if ((part == PART_DRAW_BACKGROUND_VERT) || (part == PART_DRAW_BACKGROUND_HORZ))
 		{
             QStyleOptionSlider option;
-			ScrollbarValue* sbVal = static_cast<ScrollbarValue *> ( value.getOptionalVal() );
+            OSL_ASSERT( value.getType() == CTRL_SCROLLBAR );
+			const ScrollbarValue* sbVal = static_cast<const ScrollbarValue *>(&value);
 			
 			//if the scroll bar is active (aka not degenrate...allow for hover events
 			if (sbVal->mnVisibleSize < sbVal->mnMax)
         QStyleOptionSpinBox option;
         
         // determine active control
-        SpinbuttonValue* pSpinVal = (SpinbuttonValue *)(value.getOptionalVal());
-        if( pSpinVal )
+        if( value.getType() == CTRL_SPINBUTTONS )
         {
+            const SpinbuttonValue* pSpinVal = static_cast<const SpinbuttonValue *>(&value);
             if( (pSpinVal->mnUpperState & CTRL_STATE_PRESSED) )
                 option.activeSubControls |= QStyle::SC_SpinBoxUp;
             if( (pSpinVal->mnLowerState & CTRL_STATE_PRESSED) )
 	}
 	else if (type == CTRL_SLIDER && (part == PART_TRACK_HORZ_AREA || part == PART_TRACK_VERT_AREA))
 	{
-        SliderValue* slVal = static_cast<SliderValue *> ( value.getOptionalVal() );
+	    OSL_ASSERT( value.getType() == CTRL_SLIDER );
+        const SliderValue* slVal = static_cast<const SliderValue *>(&value);
 		QStyleOptionSlider option;
         
 		option.rect = QRect(0, 0, widgetRect.width(), widgetRect.height());
 }
 
 BOOL KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart part,
-											 const Region& controlRegion, ControlState controlState,
+											 const Rectangle& controlRegion, ControlState controlState,
 											 const ImplControlValue& val,
 											 const OUString&,
-											 Region &nativeBoundingRegion, Region &nativeContentRegion )
+											 Rectangle &nativeBoundingRegion, Rectangle &nativeContentRegion )
 {
     bool retVal = false;
 	
 		// Bounding region
 		Point aBPoint( boundingRect.x(), boundingRect.y() );
 		Size aBSize( boundingRect.width(), boundingRect.height() );
-		nativeBoundingRegion = Region( Rectangle( aBPoint, aBSize ) );
+		nativeBoundingRegion = Rectangle( aBPoint, aBSize );
 
 		// Region of the content
 		Point aPoint( contentRect.x(), contentRect.y() );
 		Size  aSize( contentRect.width(), contentRect.height() );
-		nativeContentRegion = Region( Rectangle( aPoint, aSize ) );
+		nativeContentRegion = Rectangle( aPoint, aSize );
     }
 	
     return retVal;

vcl/unx/kde4/KDESalGraphics.hxx

 			type/part combination.
 		*/
 		virtual BOOL hitTestNativeControl( ControlType type, ControlPart part,
-										const Region& rControlRegion, const Point& aPos,
+										const Rectangle& rControlRegion, const Point& aPos,
 										BOOL& rIsInside );
 		/** Draw the requested control described by part/nControlState.
 		
 			@param rControlRegion
-			The bounding region of the complete control in VCL frame coordinates.
+			The bounding Rectangle of the complete control in VCL frame coordinates.
 			
 			@param aValue
 			An optional value (tristate/numerical/string).
 			A caption or title string (like button text etc.)
 		*/
 		virtual BOOL drawNativeControl( ControlType type, ControlPart part,
-										const Region& rControlRegion, ControlState nControlState,
+										const Rectangle& rControlRegion, ControlState nControlState,
 										const ImplControlValue& aValue,
 										const rtl::OUString& aCaption );
 										
 			@param aCaption	A caption or title string (like button text etc.)
 		*/
 		virtual BOOL drawNativeControlText( ControlType, ControlPart,
-											const Region&, ControlState,
+											const Rectangle&, ControlState,
 											const ImplControlValue&,
 											const rtl::OUString& ) { return false; }
 		/** Check if the bounding regions match.
 			A caption or title string (like button text etc.)
 		*/
 		virtual BOOL getNativeControlRegion( ControlType type, ControlPart part,
-											const Region& rControlRegion, ControlState nControlState,
+											const Rectangle& rControlRegion, ControlState nControlState,
 											const ImplControlValue& aValue,
 											const rtl::OUString& aCaption,
-											Region &rNativeBoundingRegion, Region &rNativeContentRegion );
+											Rectangle &rNativeBoundingRegion, Rectangle &rNativeContentRegion );
 };
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.