diff options
author | Daniel Rentz <dr@openoffice.org> | 2002-03-01 10:38:14 +0000 |
---|---|---|
committer | Daniel Rentz <dr@openoffice.org> | 2002-03-01 10:38:14 +0000 |
commit | e865c5d71ea6904de4727e2f59071bea8f496bfb (patch) | |
tree | 45288c7f573cb782328b2205ff66caf5b90770ce /sc/source/ui/inc/fieldwnd.hxx | |
parent | 26d7ad5c6f9999cfeba8f93a6fcdd42ea60bff29 (diff) |
#97742# DataPilot layout dialog keyboard acc.
Diffstat (limited to 'sc/source/ui/inc/fieldwnd.hxx')
-rw-r--r-- | sc/source/ui/inc/fieldwnd.hxx | 168 |
1 files changed, 124 insertions, 44 deletions
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx index d7fe6c07eb1f..dfe30ca46a55 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.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: hr $ $Date: 2000-09-18 16:44:58 $ + * last change: $Author: dr $ $Date: 2002-03-01 11:33:44 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -63,69 +63,149 @@ #define SC_FIELDWND_HXX -#ifndef _SV_WINDOW_HXX //autogen -#include <vcl/window.hxx> +#ifndef _SV_CTRL_HXX +#include <vcl/ctrl.hxx> +#endif +#ifndef _SV_FIXED_HXX +#include <vcl/fixed.hxx> #endif #define MAX_LABELS 256 -#define PAGE_SIZE 16 -#define LINE_SIZE 8 -#define MAX_FIELDS 8 -#define EMPTY_SLOT 0xffff +#define PAGE_SIZE 16 // count of visible fields for scrollbar +#define LINE_SIZE 8 // count of fields per column for scrollbar +#define MAX_FIELDS 8 // maximum count of fields for row/col/data area #define OWIDTH PivotGlobal::nObjWidth #define OHEIGHT PivotGlobal::nObjHeight #define SSPACE PivotGlobal::nSelSpace +class ScDPLayoutDlg; + //=================================================================== -enum FieldType +/** Type of content area. */ +enum ScDPFieldType { - TYPE_ROW, TYPE_COL, TYPE_DATA, TYPE_SELECT + TYPE_ROW, /// Area for all row fields. + TYPE_COL, /// Area for all column fields. + TYPE_DATA, /// Area for all data fields. + TYPE_SELECT /// Selection area with all fields. }; //------------------------------------------------------------------- -class ScPivotLayoutDlg; -class FieldWindow : public Window +/** Represents a field area in the DataPilot layout dialog. */ +class ScDPFieldWindow : public Control { -public: - FieldWindow( ScPivotLayoutDlg* pDialog, const ResId& rResId, - FieldType eType ); - ~FieldWindow(); - - BOOL AddField ( const String& rStr, const Point& rAt, USHORT& rAddedAt ); - void AddField ( const String& rStr, USHORT nIndex ); - void DelField ( USHORT nFieldIndex ); - void ClearFields (); - void Redraw (); - void SetText ( const String& rStr, USHORT nIndex ); - BOOL GetInsertIndex ( const Point& rInsertPos, USHORT& rIndex ); +private: + ScDPLayoutDlg* pDlg; /// Parent dialog. + Rectangle aWndRect; /// Area rectangle in pixels. + FixedText* pFtCaption; /// FixedText containing the name of the control. + Point aTextPos; /// Position of the caption text. + String** aFieldArr; /// Pointer to string array of the field names. + ScDPFieldType eType; /// Type of this area. + long nFieldSize; /// Maximum count of fields. + long nFieldCount; /// Count of existing fields. + long nFieldSelected; /// Currently selected field. + + /** @return The pixel position of a field (without bound check). */ + Point GetFieldPosition( long nIndex ) const; + /** @return The pixel size of a field. */ + Size GetFieldSize() const; + /** Calculates the field index at a specific pixel position. + @param rnIndex The index of the field is returned here. + @return TRUE, if the index value is valid. */ + BOOL GetFieldIndex( const Point& rPos, long& rnIndex ) const; + + /** Draws the background. */ + void DrawBackground( OutputDevice& rDev ); + /** Draws a field into the specified rectangle. */ + void DrawField( + OutputDevice& rDev, + const Rectangle& rRect, + const String& rText, + BOOL bSelected ); + + /** @return TRUE, if the field index is inside of the control area. */ + BOOL IsValidIndex( long nIndex ) const; + /** @return TRUE, if the field with the given index exists. */ + BOOL IsExistingIndex( long nIndex ) const; + /** @return The new selection index after moving to the given direction. */ + long CalcNewFieldIndex( short nDX, short nDY ) const; + + /** Sets selection to the field with index nIndex. */ + void SetSelection( long nIndex ); + /** Sets selection to first field. */ + void SetSelectionHome(); + /** Sets selection to last field. */ + void SetSelectionEnd(); + /** Sets selection to new position relative to current. */ + void MoveSelection( USHORT nKeyCode, short nDX, short nDY ); + + /** Moves the selected field to nDestIndex. */ + void MoveField( long nDestIndex ); + /** Moves the selected field to the given direction. */ + void MoveFieldRel( short nDX, short nDY ); + + /** Grabs focus and sets new selection. */ + void GrabFocusWithSel( long nIndex ); protected: - virtual void Paint( const Rectangle& rRect ); - virtual void MouseButtonDown ( const MouseEvent& rMEvt ); - virtual void MouseButtonUp ( const MouseEvent& rMEvt ); - virtual void MouseMove ( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle& rRect ); + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void MouseButtonUp( const MouseEvent& rMEvt ); + virtual void MouseMove( const MouseEvent& rMEvt ); + virtual void KeyInput( const KeyEvent& rKEvt ); + virtual void GetFocus(); + virtual void LoseFocus(); -private: - ScPivotLayoutDlg* pDlg; - Rectangle aWndRect; - FieldType eFieldType; - Point aCenterPos; - String** aFieldArr; - USHORT nFieldSize; - USHORT nFieldCount; - -private: - void DoPaint ( const Rectangle& rRect ); - void DrawField ( OutputDevice& rDev, - const Rectangle& rRect, - const String& rStr ); - BOOL GetFieldIndex ( const Point& rPos, USHORT& rIndex ); - BOOL GetFirstEmptySlot ( USHORT& rIndex ); +public: + ScDPFieldWindow( + ScDPLayoutDlg* pDialog, + const ResId& rResId, + ScDPFieldType eFieldType, + FixedText* pFtFieldCaption ); + virtual ~ScDPFieldWindow(); + + /** Draws the complete control. */ + void Redraw(); + + /** @return The index of the selected field. */ + inline BOOL IsEmpty() const { return nFieldCount == 0; } + /** @return The index of the selected field. */ + inline long GetSelectedField() const { return nFieldSelected; } + /** @return The pixel position of the last possible field. */ + Point GetLastPosition() const; + + /** Inserts a field to the specified index. */ + void AddField( const String& rText, long nNewIndex ); + /** Removes a field from the specified index. */ + void DelField( long nDelIndex ); + /** Removes all fields. */ + void ClearFields(); + /** Changes the text on an existing field. */ + void SetFieldText( const String& rText, long nIndex ); + + /** Inserts a field using the specified pixel position. + @param rPos The coordinates to insert the field. + @param rnIndex The new index of the field is returned here. + @return TRUE, if the field has been created. */ + BOOL AddField( const String& rText, const Point& rPos, long& rnIndex ); + /** Calculates a field index at a specific pixel position. Returns in every + case the index of an existing field. + @param rnIndex The index of the field is returned here. + @return TRUE, if the index value is valid. */ + void GetExistingIndex( const Point& rPos, long& rnIndex ); + + /** Notifies this control that the offset of the first field has been changed. + The control has to adjust the selection to keep the same field selected + on scrolling with scrollbar. */ + void ModifySelectionOffset( long nOffsetDiff ); + /** Selects the next field. Called i.e. after moving a field from SELECT area. */ + void SelectNext(); }; +//=================================================================== #endif // SC_FIELDWND_HXX |