#102281# HC for outline symbols

This commit is contained in:
Daniel Rentz 2002-08-14 11:24:42 +00:00
parent 581d7145a2
commit 8b2a9e1af5
6 changed files with 88 additions and 62 deletions

View file

@ -2,9 +2,9 @@
*
* $RCSfile: global.hxx,v $
*
* $Revision: 1.18 $
* $Revision: 1.19 $
*
* last change: $Author: dr $ $Date: 2002-04-22 14:10:06 $
* last change: $Author: dr $ $Date: 2002-08-14 12:19:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -550,6 +550,7 @@ class ScGlobal
static SvxBrushItem* pProtectedBrushItem;
static ImageList* pOutlineBitmaps;
static ImageList* pOutlineBitmapsHC;
// static Bitmap* pAnchorBitmap;
// static Bitmap* pGrayAnchorBitmap;
@ -622,7 +623,10 @@ public:
static const String& GetEmptyString();
static const String& GetScDocString();
static ImageList* GetOutlineBitmaps();
/** Returns the specified image list with outline symbols.
@param bHC false = standard symbols; true = high contrast symbols. */
static ImageList* GetOutlineSymbols( bool bHC );
// static const Bitmap& GetAnchorBitmap();
// static const Bitmap& GetGrayAnchorBitmap();

View file

@ -2,9 +2,9 @@
*
* $RCSfile: sc.hrc,v $
*
* $Revision: 1.27 $
* $Revision: 1.28 $
*
* last change: $Author: sab $ $Date: 2002-08-08 13:13:02 $
* last change: $Author: dr $ $Date: 2002-08-14 12:19:59 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -1144,7 +1144,7 @@
#define RID_BMP_REFBTN1_H (SC_RESOURCE_START+55)
#define RID_BMP_REFBTN2_H (SC_RESOURCE_START+56)
#define RID_IMAGELIST_H_NAVCONT (SC_RESOURCE_START+57)
#define RID_OUTLINEBITMAPS_H (SC_RESOURCE_START+58)
#define STR_START (SC_RESOURCE_START+100)
#define STR_ROWHEIGHT (STR_START)

View file

@ -2,9 +2,9 @@
*
* $RCSfile: global.cxx,v $
*
* $Revision: 1.25 $
* $Revision: 1.26 $
*
* last change: $Author: dr $ $Date: 2002-07-29 15:18:45 $
* last change: $Author: dr $ $Date: 2002-08-14 12:21:57 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -170,6 +170,7 @@ SvxBrushItem* ScGlobal::pEmbeddedBrushItem = NULL;
SvxBrushItem* ScGlobal::pProtectedBrushItem = NULL;
ImageList* ScGlobal::pOutlineBitmaps = NULL;
ImageList* ScGlobal::pOutlineBitmapsHC = NULL;
ScFunctionList* ScGlobal::pStarCalcFunctionList = NULL;
ScFunctionMgr* ScGlobal::pStarCalcFunctionMgr = NULL;
@ -609,11 +610,12 @@ const String& ScGlobal::GetEmptyString()
return *pEmptyString;
}
ImageList* ScGlobal::GetOutlineBitmaps()
ImageList* ScGlobal::GetOutlineSymbols( bool bHC )
{
if (!pOutlineBitmaps)
pOutlineBitmaps = new ImageList( ScResId(RID_OUTLINEBITMAPS) );
return pOutlineBitmaps;
ImageList*& rpImageList = bHC ? pOutlineBitmapsHC : pOutlineBitmaps;
if( !rpImageList )
rpImageList = new ImageList( ScResId( bHC ? RID_OUTLINEBITMAPS_H : RID_OUTLINEBITMAPS ) );
return rpImageList;
}
void ScGlobal::Init()
@ -760,6 +762,7 @@ void ScGlobal::Clear()
DELETEZ(pEmbeddedBrushItem);
DELETEZ(pProtectedBrushItem);
DELETEZ(pOutlineBitmaps);
DELETEZ(pOutlineBitmapsHC);
// DELETEZ(pAnchorBitmap);
// DELETEZ(pGrayAnchorBitmap);
DELETEZ(pEnglishFormatter);

View file

@ -2,9 +2,9 @@
*
* $RCSfile: outline.src,v $
*
* $Revision: 1.5 $
* $Revision: 1.6 $
*
* last change: $Author: os $ $Date: 2002-04-04 09:58:36 $
* last change: $Author: dr $ $Date: 2002-08-14 12:22:40 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -65,12 +65,21 @@
// Imageliste hier, damit sie nicht in ui.src beim Zusammenbauen der
// "echten" Imagelisten stoert
#define OUTLINE_ID_LIST \
IdList = { 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; }; \
IdCount = { 12; };
ImageList RID_OUTLINEBITMAPS
{
ImageBitmap = Bitmap { File = "outline.bmp" ; };
IdList = { 1 ; 2 ; 3 ; 4 ; 5 ; 6 ; 7 ; 8 ; 9 ; 10 ; };
IdCount = { 10 ; };
MaskColor = STD_MASKCOLOR;
OUTLINE_ID_LIST
};
ImageList RID_OUTLINEBITMAPS_H
{
ImageBitmap = Bitmap { File = "outline_h.bmp" ; };
MaskColor = SC_HC_MASKCOLOR;
OUTLINE_ID_LIST
};

View file

@ -2,9 +2,9 @@
*
* $RCSfile: olinewin.hxx,v $
*
* $Revision: 1.1.1.1 $
* $Revision: 1.2 $
*
* last change: $Author: hr $ $Date: 2000-09-18 16:45:00 $
* last change: $Author: dr $ $Date: 2002-08-14 12:23:27 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -83,12 +83,13 @@ private:
ScViewData* pViewData;
Color aColor;
ImageList* pSymbols;
BOOL bHitMode; // Knopf gedrueckt ?
USHORT nHitLevel;
USHORT nHitEntry;
BOOL bHitHeader;
Rectangle aInvRect;
Point aImagePos;
BOOL bIsInverted;
@ -96,13 +97,15 @@ private:
long& rFirstEntry, long& rSecondEntry, long& rBitmapEntry,
ScOutlineEntry* pPrevious );
void DoFunction( USHORT nLevel, USHORT nEntry, BOOL bHeader );
void ToggleRect( const Rectangle& rRect );
BOOL ButtonHit( const Point& rPos, USHORT& rLevel, USHORT& rEntry, BOOL& rHeader,
Rectangle& rInvRect );
Point& rImagePos );
BOOL LineHit( const Point& rPos, USHORT& rLevel, USHORT& rEntry );
BOOL IsFirst(USHORT nPos);
void ImplDrawImage( const Point& rPos, sal_uInt16 nId );
void ImplDrawBorder( const Point& rPos, bool bPressed );
protected:
virtual void Paint( const Rectangle& rRect );

View file

@ -2,9 +2,9 @@
*
* $RCSfile: olinewin.cxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: mh $ $Date: 2001-10-23 11:24:24 $
* last change: $Author: dr $ $Date: 2002-08-14 12:24:42 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@ -78,6 +78,8 @@
#define SC_OL_IMAGE_PLUS 9
#define SC_OL_IMAGE_MINUS 10
#define SC_OL_IMAGE_NOTPRESSED 11
#define SC_OL_IMAGE_PRESSED 12
//==================================================================
@ -89,7 +91,8 @@ ScOutlineWindow::ScOutlineWindow( Window* pParent, ScOutlineMode eNewMode,
eWhich( eNewWhich ),
nHeaderSize( 0 ),
bHitMode( FALSE ),
aColor( COL_BLACK )
aColor( COL_BLACK ),
pSymbols( NULL )
{
ImplInitSettings();
}
@ -212,13 +215,29 @@ BOOL ScOutlineWindow::GetEntryPos( ScOutlineEntry* pEntry,
return bVisible;
}
void ScOutlineWindow::ImplDrawImage( const Point& rPos, sal_uInt16 nId )
{
DBG_ASSERT( pSymbols, "ScOutlineWindow::ImplDrawImage - no images" );
const Image& rImage = pSymbols->GetImage( nId );
SetLineColor();
SetFillColor( GetBackground().GetColor() );
DrawRect( Rectangle( rPos, rImage.GetSizePixel() ) );
DrawImage( rPos, rImage );
}
void ScOutlineWindow::ImplDrawBorder( const Point& rPos, bool bPressed )
{
DBG_ASSERT( pSymbols, "ScOutlineWindow::ImplDrawBorder - no images" );
DrawImage( rPos, pSymbols->GetImage( bPressed ? SC_OL_IMAGE_PRESSED : SC_OL_IMAGE_NOTPRESSED ) );
}
#define GETPREV(nLevel,nEntryNo) (nEntryNo ? pArray->GetEntry( nLevel, nEntryNo-1 ) : 0)
void __EXPORT ScOutlineWindow::Paint( const Rectangle& rRect )
{
ImageList* pBitmaps = ScGlobal::GetOutlineBitmaps();
USHORT nTab = pViewData->GetTabNo();
ScDocument* pDoc = pViewData->GetDocument();
ScOutlineTable* pTable = pDoc->GetOutlineTable( nTab );
@ -237,7 +256,6 @@ void __EXPORT ScOutlineWindow::Paint( const Rectangle& rRect )
long nDestPos = nAllSize - 1;
SetLineColor( aColor );
if (bHor)
DrawLine(Point(0,nDestPos), Point(aSize.Width()-1,nDestPos));
else
@ -261,11 +279,12 @@ void __EXPORT ScOutlineWindow::Paint( const Rectangle& rRect )
for (nLevel=0; nLevel<=nDepth; nLevel++)
{
DrawImage( aFirstPos, pBitmaps->GetImage(nLevel+1) );
ImplDrawImage( aFirstPos, nLevel + 1 );
nFirstLevel += SC_OL_BITMAPSIZE;
}
long nStart = nHeaderSize-1;
SetLineColor( aColor );
if (bHor)
DrawLine(Point(nStart,0),Point(nStart,nDestPos));
else
@ -326,6 +345,7 @@ void __EXPORT ScOutlineWindow::Paint( const Rectangle& rRect )
if (bDraw)
{
SetLineColor();
SetFillColor( aColor );
nSecondLevel = nFirstLevel;
nSecondLevel += 1;
@ -385,9 +405,9 @@ void __EXPORT ScOutlineWindow::Paint( const Rectangle& rRect )
}
if (pEntry->IsHidden())
DrawImage( aFirstPos, pBitmaps->GetImage(SC_OL_IMAGE_PLUS) );
ImplDrawImage( aFirstPos, SC_OL_IMAGE_PLUS );
else
DrawImage( aFirstPos, pBitmaps->GetImage(SC_OL_IMAGE_MINUS) );
ImplDrawImage( aFirstPos, SC_OL_IMAGE_MINUS );
if (bClip)
SetClipRegion();
@ -402,16 +422,8 @@ void __EXPORT ScOutlineWindow::Paint( const Rectangle& rRect )
}
void ScOutlineWindow::ToggleRect( const Rectangle& rRect )
{
Update();
Invert( Rectangle( rRect.Left()+1, rRect.Top()+1, rRect.Right()-2, rRect.Top()+1 ) );
Invert( Rectangle( rRect.Left()+1, rRect.Top()+2, rRect.Left()+1, rRect.Bottom()-2 ) );
}
BOOL ScOutlineWindow::ButtonHit( const Point& rPos, USHORT& rLevel, USHORT& rEntry, BOOL& rHeader,
Rectangle& rInvRect )
Point& rImagePos )
{
USHORT nTab = pViewData->GetTabNo();
ScDocument* pDoc = pViewData->GetDocument();
@ -462,11 +474,9 @@ BOOL ScOutlineWindow::ButtonHit( const Point& rPos, USHORT& rLevel, USHORT& rEnt
rEntry = 0;
rHeader = TRUE;
if (bHor)
rInvRect = Rectangle( Point( nEntryPos, nLevelPos ),
Size( SC_OL_BITMAPSIZE, SC_OL_BITMAPSIZE ) );
rImagePos = Point( nEntryPos, nLevelPos );
else
rInvRect = Rectangle( Point( nLevelPos, nEntryPos ),
Size( SC_OL_BITMAPSIZE, SC_OL_BITMAPSIZE ) );
rImagePos = Point( nLevelPos, nEntryPos );
return TRUE;
}
}
@ -493,11 +503,9 @@ BOOL ScOutlineWindow::ButtonHit( const Point& rPos, USHORT& rLevel, USHORT& rEnt
rEntry = nEntryNo;
rHeader = FALSE;
if (bHor)
rInvRect = Rectangle( Point( nEntryPos, nLevelPos ),
Size( SC_OL_BITMAPSIZE, SC_OL_BITMAPSIZE ) );
rImagePos = Point( nEntryPos, nLevelPos );
else
rInvRect = Rectangle( Point( nLevelPos, nEntryPos ),
Size( SC_OL_BITMAPSIZE, SC_OL_BITMAPSIZE ) );
rImagePos = Point( nLevelPos, nEntryPos );
return TRUE;
}
}
@ -613,25 +621,25 @@ void __EXPORT ScOutlineWindow::MouseMove( const MouseEvent& rMEvt )
USHORT nLevel;
USHORT nEntry;
BOOL bHeader;
Rectangle aDummyRect;
Point aDummy;
if ( bHitMode )
{
BOOL bHit = FALSE;
if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry, bHeader, aDummyRect ) )
if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry, bHeader, aDummy ) )
if ( nLevel == nHitLevel && nEntry == nHitEntry && bHeader == bHitHeader )
bHit = TRUE;
if (bHit)
{
if (!bIsInverted)
ToggleRect( aInvRect );
ImplDrawBorder( aImagePos, true );
bIsInverted = TRUE;
}
else
{
if (bIsInverted)
ToggleRect( aInvRect );
ImplDrawBorder( aImagePos, false );
bIsInverted = FALSE;
}
}
@ -643,14 +651,14 @@ void __EXPORT ScOutlineWindow::MouseButtonUp( const MouseEvent& rMEvt )
USHORT nLevel;
USHORT nEntry;
BOOL bHeader;
Rectangle aDummyRect;
Point aDummy;
if ( bHitMode )
{
if ( bIsInverted )
ToggleRect( aInvRect );
ImplDrawBorder( aImagePos, false );
if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry, bHeader, aDummyRect ) )
if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry, bHeader, aDummy ) )
if ( nLevel == nHitLevel && nEntry == nHitEntry && bHeader == bHitHeader )
DoFunction( nLevel, nEntry, bHeader );
@ -665,14 +673,14 @@ void __EXPORT ScOutlineWindow::MouseButtonDown( const MouseEvent& rMEvt )
USHORT nEntry;
BOOL bHeader;
if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry, bHeader, aInvRect ) )
if ( ButtonHit( rMEvt.GetPosPixel(), nLevel, nEntry, bHeader, aImagePos ) )
{
bHitMode = TRUE;
nHitLevel = nLevel;
nHitEntry = nEntry;
bHitHeader = bHeader;
ToggleRect( aInvRect );
ImplDrawBorder( aImagePos, true );
bIsInverted = TRUE;
}
else if ( rMEvt.GetClicks() == 2 )
@ -772,13 +780,12 @@ void ScOutlineWindow::ImplInitSettings()
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
SetBackground( rStyleSettings.GetFaceColor() );
SetFillColor( rStyleSettings.GetButtonTextColor() );
aColor = rStyleSettings.GetButtonTextColor();
pSymbols = ScGlobal::GetOutlineSymbols( GetBackground().GetColor().IsDark() );
Invalidate();
}
// -----------------------------------------------------------------------
void ScOutlineWindow::DataChanged( const DataChangedEvent& rDCEvt )