summaryrefslogtreecommitdiff
path: root/sc/source
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2002-05-22 13:38:17 +0000
committerDaniel Rentz <dr@openoffice.org>2002-05-22 13:38:17 +0000
commit3a370365cd1e5d366218023ea3a5bc09f8afd29c (patch)
tree5274545ea11230eb80f55d1912b773c50a436651 /sc/source
parentb82bd3498abecf7f7fc53136e8498c84f2cb32e4 (diff)
#99357# use StyleSettings for controls
Diffstat (limited to 'sc/source')
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx75
-rw-r--r--sc/source/ui/inc/fieldwnd.hxx11
2 files changed, 47 insertions, 39 deletions
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
index 90e370367973..51547a4f15d1 100644
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ b/sc/source/ui/dbgui/fieldwnd.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fieldwnd.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: dr $ $Date: 2002-03-01 11:35:58 $
+ * last change: $Author: dr $ $Date: 2002-05-22 14:38:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -63,10 +63,11 @@
#include "ui_pch.hxx"
#endif
+#pragma hdrstop
-#ifndef PCH
#include <vcl/virdev.hxx>
-#endif
+#include <vcl/decoview.hxx>
+#include <vcl/svapp.hxx>
#include <tools/debug.hxx>
@@ -102,6 +103,8 @@ ScDPFieldWindow::ScDPFieldWindow(
aTextPos.X() = (aWinSize.Width() - aTextSize.Width()) / 2;
aTextPos.Y() = (aWinSize.Height() - aTextSize.Height()) / 2;
}
+
+ GetStyleSettings();
}
__EXPORT ScDPFieldWindow::~ScDPFieldWindow()
@@ -113,6 +116,16 @@ __EXPORT ScDPFieldWindow::~ScDPFieldWindow()
//-------------------------------------------------------------------
+void ScDPFieldWindow::GetStyleSettings()
+{
+ const StyleSettings& rStyleSet = GetSettings().GetStyleSettings();
+ aFaceColor = rStyleSet.GetFaceColor();
+ aWinColor = rStyleSet.GetWindowColor();
+ aTextColor = rStyleSet.GetButtonTextColor();
+}
+
+//-------------------------------------------------------------------
+
Point ScDPFieldWindow::GetFieldPosition( long nIndex ) const
{
Point aPos;
@@ -184,14 +197,15 @@ void ScDPFieldWindow::DrawBackground( OutputDevice& rDev )
if ( eType == TYPE_SELECT )
{
rDev.SetLineColor();
- rDev.SetFillColor( GetBackground().GetColor() );
+ rDev.SetFillColor( aFaceColor );
rDev.DrawRect( Rectangle( aPos0, aSize ) );
}
else
{
- rDev.SetLineColor( Color( COL_BLACK ) );
- rDev.SetFillColor( Color( COL_WHITE ) );
+ rDev.SetLineColor( aTextColor );
+ rDev.SetFillColor( aWinColor );
rDev.DrawRect( Rectangle( aPos0, aSize ) );
+ rDev.SetTextColor( aTextColor );
rDev.DrawCtrlText( aTextPos, GetText() );
}
}
@@ -203,45 +217,21 @@ void ScDPFieldWindow::DrawField(
BOOL bSelected )
{
VirtualDevice aVirDev( rDev );
- Size aDevSize( rRect.GetSize() );
+ Size aDevSize( rRect.GetSize() );
long nWidth = aDevSize.Width();
long nHeight = aDevSize.Height();
long nLabelWidth = rDev.GetTextWidth( rText );
long nLabelHeight = rDev.GetTextHeight();
- Point topLeft( 1, 1 );
- Point topRight( nWidth - 2, 1 );
- Point botLeft( 1, nHeight - 2 );
- Point botRight( nWidth - 2, nHeight - 2 );
Point aLabelPos(
((nWidth > nLabelWidth + 6) ? (nWidth - nLabelWidth) / 2 : 3),
((nHeight > nLabelHeight + 6) ? (nHeight - nLabelHeight) / 2 : 3) );
- aVirDev.SetOutputSizePixel ( aDevSize );
- aVirDev.SetFont ( rDev.GetFont() );
- aVirDev.SetFillColor( GetBackground().GetColor() );
- aVirDev.SetLineColor( Color( COL_BLACK ) );
-
- aVirDev.DrawRect( Rectangle( Point(), aDevSize ) ); // 1 pixel border
+ aVirDev.SetOutputSizePixel( aDevSize );
+ aVirDev.SetFont( rDev.GetFont() );
+ DecorationView aDecoView( &aVirDev );
+ aDecoView.DrawButton( Rectangle( Point(), aDevSize ), bSelected ? BUTTON_DRAW_DEFAULT : 0 );
+ aVirDev.SetTextColor( aTextColor );
aVirDev.DrawText( aLabelPos, rText ); // text
- if( bSelected )
- {
- aVirDev.SetLineColor( Color( COL_GRAY ) ); // thick border
- aVirDev.SetFillColor();
- Rectangle aRect( topLeft, botRight );
- aVirDev.DrawRect( aRect );
- ++aRect.nLeft; ++aRect.nTop; --aRect.nRight; --aRect.nBottom;
- aVirDev.DrawRect( aRect );
- }
- else
- {
- aVirDev.SetLineColor( Color( COL_WHITE ) ); // 3D border
- aVirDev.DrawLine( topLeft, topRight );
- aVirDev.DrawLine( topLeft, botLeft );
- aVirDev.SetLineColor( Color( COL_GRAY ) );
- aVirDev.DrawLine( botLeft, botRight );
- aVirDev.DrawLine( topRight, botRight );
- }
-
rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point(), aDevSize ) );
}
@@ -406,6 +396,17 @@ void __EXPORT ScDPFieldWindow::Paint( const Rectangle& rRect )
Redraw();
}
+void __EXPORT ScDPFieldWindow::DataChanged( const DataChangedEvent& rDCEvt )
+{
+ if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+ {
+ GetStyleSettings();
+ Redraw();
+ }
+ else
+ Control::DataChanged( rDCEvt );
+}
+
void __EXPORT ScDPFieldWindow::MouseButtonDown( const MouseEvent& rMEvt )
{
if( rMEvt.IsLeft() )
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
index dfe30ca46a55..6cd2f43bafa4 100644
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ b/sc/source/ui/inc/fieldwnd.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fieldwnd.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: dr $ $Date: 2002-03-01 11:33:44 $
+ * last change: $Author: dr $ $Date: 2002-05-22 14:37:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -105,10 +105,16 @@ private:
Point aTextPos; /// Position of the caption text.
String** aFieldArr; /// Pointer to string array of the field names.
ScDPFieldType eType; /// Type of this area.
+ Color aFaceColor; /// Color for dialog background.
+ Color aWinColor; /// Color for window background.
+ Color aTextColor; /// Color for text output.
long nFieldSize; /// Maximum count of fields.
long nFieldCount; /// Count of existing fields.
long nFieldSelected; /// Currently selected field.
+ /** Reads all needed style settings. */
+ void GetStyleSettings();
+
/** @return The pixel position of a field (without bound check). */
Point GetFieldPosition( long nIndex ) const;
/** @return The pixel size of a field. */
@@ -153,6 +159,7 @@ private:
protected:
virtual void Paint( const Rectangle& rRect );
+ virtual void DataChanged( const DataChangedEvent& rDCEvt );
virtual void MouseButtonDown( const MouseEvent& rMEvt );
virtual void MouseButtonUp( const MouseEvent& rMEvt );
virtual void MouseMove( const MouseEvent& rMEvt );