update dev300-m57
[ooovba.git] / sc / source / ui / inc / gridwin.hxx
bloba90858338b6f21309c522826f58407640ac6244b
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: gridwin.hxx,v $
10 * $Revision: 1.30 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_GRIDWIN_HXX
32 #define SC_GRIDWIN_HXX
34 #include <tools/string.hxx>
35 #include <svtools/transfer.hxx>
36 #include "viewutil.hxx"
37 #include "viewdata.hxx"
38 #include "cbutton.hxx"
39 #include <svx/sdr/overlay/overlayobject.hxx>
40 #include <basegfx/matrix/b2dhommatrix.hxx>
42 #include <vector>
43 #include <memory>
45 // ---------------------------------------------------------------------------
47 struct ScTableInfo;
48 class ScViewSelectionEngine;
49 class ScDPObject;
50 class ScDPFieldPopupWindow;
51 class ScOutputData;
52 class ScFilterListBox;
53 class AutoFilterPopup;
54 class SdrObject;
55 class SdrEditView;
56 class ScNoteMarker;
57 class FloatingWindow;
58 class SdrHdlList;
59 class ScTransferObj;
60 struct SpellCallbackInfo;
62 // Maus-Status (nMouseStatus)
64 #define SC_GM_NONE 0
65 #define SC_GM_TABDOWN 1
66 #define SC_GM_DBLDOWN 2
67 #define SC_GM_FILTER 3
68 #define SC_GM_IGNORE 4
69 #define SC_GM_WATERUNDO 5
70 #define SC_GM_URLDOWN 6
72 // Page-Drag-Modus
74 #define SC_PD_NONE 0
75 #define SC_PD_RANGE_L 1
76 #define SC_PD_RANGE_R 2
77 #define SC_PD_RANGE_T 4
78 #define SC_PD_RANGE_B 8
79 #define SC_PD_RANGE_TL (SC_PD_RANGE_T|SC_PD_RANGE_L)
80 #define SC_PD_RANGE_TR (SC_PD_RANGE_T|SC_PD_RANGE_R)
81 #define SC_PD_RANGE_BL (SC_PD_RANGE_B|SC_PD_RANGE_L)
82 #define SC_PD_RANGE_BR (SC_PD_RANGE_B|SC_PD_RANGE_R)
83 #define SC_PD_BREAK_H 16
84 #define SC_PD_BREAK_V 32
87 class ScHideTextCursor
89 private:
90 ScViewData* pViewData;
91 ScSplitPos eWhich;
93 public:
94 ScHideTextCursor( ScViewData* pData, ScSplitPos eW );
95 ~ScHideTextCursor();
98 // ---------------------------------------------------------------------------
99 // predefines
100 namespace sdr { namespace overlay { class OverlayObjectList; }}
102 class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHelper
104 // ScFilterListBox wird immer fuer Auswahlliste benutzt
105 friend class ScFilterListBox;
107 private:
108 // #114409#
109 ::sdr::overlay::OverlayObjectList* mpOOCursors;
110 ::sdr::overlay::OverlayObjectList* mpOOSelection;
111 ::sdr::overlay::OverlayObjectList* mpOOAutoFill;
112 ::sdr::overlay::OverlayObjectList* mpOODragRect;
113 ::sdr::overlay::OverlayObjectList* mpOOHeader;
114 ::sdr::overlay::OverlayObjectList* mpOOShrink;
116 private:
117 ScViewData* pViewData;
118 ScSplitPos eWhich;
119 ScHSplitPos eHWhich;
120 ScVSplitPos eVWhich;
122 ScNoteMarker* pNoteMarker;
124 ScFilterListBox* pFilterBox;
125 FloatingWindow* pFilterFloat;
126 ::std::auto_ptr<ScDPFieldPopupWindow> mpDPFieldPopup;
128 USHORT nCursorHideCount;
130 BOOL bMarking;
132 USHORT nButtonDown;
133 BOOL bEEMouse; // Edit-Engine hat Maus
134 BYTE nMouseStatus;
135 BYTE nNestedButtonState; // track nested button up/down calls
137 BOOL bDPMouse; // DataPilot-D&D (neue Pivottabellen)
138 long nDPField;
139 ScDPObject* pDragDPObj; //! name?
141 BOOL bRFMouse; // RangeFinder-Drag
142 BOOL bRFSize;
143 USHORT nRFIndex;
144 SCsCOL nRFAddX;
145 SCsROW nRFAddY;
147 USHORT nPagebreakMouse; // Pagebreak-Modus Drag
148 SCCOLROW nPagebreakBreak;
149 SCCOLROW nPagebreakPrev;
150 ScRange aPagebreakSource;
151 ScRange aPagebreakDrag;
152 BOOL bPagebreakDrawn;
154 BYTE nPageScript;
156 long nLastClickX;
157 long nLastClickY;
159 BOOL bDragRect;
160 SCCOL nDragStartX;
161 SCROW nDragStartY;
162 SCCOL nDragEndX;
163 SCROW nDragEndY;
164 InsCellCmd meDragInsertMode;
166 USHORT nCurrentPointer;
168 BOOL bIsInScroll;
169 BOOL bIsInPaint;
171 ScDDComboBoxButton aComboButton;
173 Point aCurMousePos;
175 USHORT nPaintCount;
176 Rectangle aRepaintPixel;
177 BOOL bNeedsRepaint;
179 BOOL bAutoMarkVisible;
180 ScAddress aAutoMarkPos;
182 BOOL bListValButton;
183 ScAddress aListValPos;
185 Rectangle aInvertRect;
187 DECL_LINK( PopupModeEndHdl, FloatingWindow* );
188 DECL_LINK( PopupSpellingHdl, SpellCallbackInfo* );
190 BOOL TestMouse( const MouseEvent& rMEvt, BOOL bAction );
192 BOOL DoPageFieldSelection( SCCOL nCol, SCROW nRow );
193 void DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt );
195 void DPMouseMove( const MouseEvent& rMEvt );
196 void DPMouseButtonUp( const MouseEvent& rMEvt );
197 void DPTestMouse( const MouseEvent& rMEvt, BOOL bMove );
199 /**
200 * Check if the mouse click is on a field popup button.
202 * @return bool true if the field popup menu has been launched and no
203 * further mouse event handling is necessary, false otherwise.
205 bool DPTestFieldPopupArrow(const MouseEvent& rMEvt, const ScAddress& rPos, ScDPObject* pDPObj);
206 void DPLaunchFieldPopupMenu(
207 const Point& rSrcPos, const Size& rSrcSize, const ScAddress& rPos, ScDPObject* pDPObj);
209 void RFMouseMove( const MouseEvent& rMEvt, BOOL bUp );
211 void PagebreakMove( const MouseEvent& rMEvt, BOOL bUp );
213 void UpdateDragRect( BOOL bShowRange, const Rectangle& rPosRect );
215 BOOL IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab );
216 void ExecFilter( ULONG nSel, SCCOL nCol, SCROW nRow,
217 const String& aValue );
218 void FilterSelect( ULONG nSel );
220 void ExecDataSelect( SCCOL nCol, SCROW nRow, const String& rStr );
222 void ExecPageFieldSelect( SCCOL nCol, SCROW nRow, BOOL bHasSelection, const String& rStr );
224 BOOL HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange );
226 BOOL DropScroll( const Point& rMousePos );
228 sal_Int8 AcceptPrivateDrop( const AcceptDropEvent& rEvt );
229 sal_Int8 ExecutePrivateDrop( const ExecuteDropEvent& rEvt );
230 sal_Int8 DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPosX, SCROW nDestPosY,
231 const Point& rLogicPos, sal_Int8 nDndAction );
233 void HandleMouseButtonDown( const MouseEvent& rMEvt );
235 BOOL DrawMouseButtonDown(const MouseEvent& rMEvt);
236 BOOL DrawMouseButtonUp(const MouseEvent& rMEvt);
237 BOOL DrawMouseMove(const MouseEvent& rMEvt);
238 BOOL DrawKeyInput(const KeyEvent& rKEvt);
239 BOOL DrawCommand(const CommandEvent& rCEvt);
240 BOOL DrawHasMarkedObj();
241 void DrawEndAction();
242 void DrawMarkDropObj( SdrObject* pObj );
243 SdrObject* GetEditObject();
244 BOOL IsMyModel(SdrEditView* pSdrView);
245 //void DrawStartTimer();
247 void DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, ULONG nLayer );
248 void DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev );
249 //BOOL DrawBeforeScroll();
250 void DrawAfterScroll(/*BOOL bVal*/);
251 //void DrawMarks();
252 //BOOL NeedDrawMarks();
253 void DrawComboButton( const Point& rCellPos,
254 long nCellSizeX,
255 long nCellSizeY,
256 BOOL bArrowState,
257 BOOL bBtnIn = FALSE );
258 Rectangle GetListValButtonRect( const ScAddress& rButtonPos );
260 void DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev );
262 BOOL GetEditUrl( const Point& rPos,
263 String* pName=0, String* pUrl=0, String* pTarget=0 );
264 BOOL GetEditUrlOrError( BOOL bSpellErr, const Point& rPos,
265 String* pName=0, String* pUrl=0, String* pTarget=0 );
267 BOOL HitRangeFinder( const Point& rMouse, BOOL& rCorner, USHORT* pIndex = NULL,
268 SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL );
270 USHORT HitPageBreak( const Point& rMouse, ScRange* pSource = NULL,
271 SCCOLROW* pBreak = NULL, SCCOLROW* pPrev = NULL );
273 void PasteSelection( const Point& rPosPixel );
275 void SelectForContextMenu( const Point& rPosPixel );
277 void GetSelectionRects( ::std::vector< Rectangle >& rPixelRects );
279 protected:
280 using Window::Resize;
281 virtual void Resize( const Size& rSize );
282 virtual void PrePaint();
283 virtual void Paint( const Rectangle& rRect );
284 virtual void KeyInput(const KeyEvent& rKEvt);
285 virtual void GetFocus();
286 virtual void LoseFocus();
288 virtual void RequestHelp( const HelpEvent& rEvt );
289 virtual void Command( const CommandEvent& rCEvt );
291 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
292 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
293 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
295 public:
296 ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos );
297 ~ScGridWindow();
299 // #i70788# flush and get overlay
300 ::sdr::overlay::OverlayManager* getOverlayManager();
301 void flushOverlayManager();
303 virtual void DataChanged( const DataChangedEvent& rDCEvt );
305 virtual void MouseButtonDown( const MouseEvent& rMEvt );
306 virtual void MouseButtonUp( const MouseEvent& rMEvt );
307 virtual void MouseMove( const MouseEvent& rMEvt );
308 virtual long PreNotify( NotifyEvent& rNEvt );
309 virtual void Tracking( const TrackingEvent& rTEvt );
311 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
313 void FakeButtonUp();
315 Point GetMousePosPixel() const;
316 void UpdateStatusPosSize();
318 void ClickExtern();
320 void SetPointer( const Pointer& rPointer );
322 void MoveMouseStatus( ScGridWindow &rDestWin );
324 void ScrollPixel( long nDifX, long nDifY );
325 void UpdateEditViewPos();
327 void UpdateFormulas();
329 void DoAutoFilterMenue( SCCOL nCol, SCROW nRow, BOOL bDataSelect );
330 void DoScenarioMenue( const ScRange& rScenRange );
331 void DoPageFieldMenue( SCCOL nCol, SCROW nRow );
333 BOOL HasPageFieldData( SCCOL nCol, SCROW nRow ) const;
335 void DrawButtons( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
336 ScTableInfo& rTabInfo, OutputDevice* pContentDev );
338 using Window::Draw;
339 void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
340 ScUpdateMode eMode = SC_UPDATE_ALL );
342 void InvertSimple( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
343 BOOL bTestMerge = FALSE, BOOL bRepeat = FALSE );
345 //UNUSED2008-05 void DrawDragRect( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2 );
347 void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress);
349 void HideCursor();
350 void ShowCursor();
351 void DrawCursor();
352 void DrawAutoFillMark();
353 void UpdateAutoFillMark(BOOL bMarked, const ScRange& rMarkRange);
355 void UpdateListValPos( BOOL bVisible, const ScAddress& rPos );
357 BOOL ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, BOOL bKeyboard );
358 void HideNoteMarker();
360 MapMode GetDrawMapMode( BOOL bForce = FALSE );
362 void ContinueDrag();
364 void StopMarking();
365 void UpdateInputContext();
367 void CheckInverted() { if (nPaintCount) bNeedsRepaint = TRUE; }
369 void DoInvertRect( const Rectangle& rPixel );
371 void CheckNeedsRepaint();
373 void UpdateDPFromFieldPopupMenu();
375 // #114409#
376 void CursorChanged();
377 void DrawLayerCreated();
379 void DeleteCursorOverlay();
380 void UpdateCursorOverlay();
381 void DeleteSelectionOverlay();
382 void UpdateSelectionOverlay();
383 void DeleteAutoFillOverlay();
384 void UpdateAutoFillOverlay();
385 void DeleteDragRectOverlay();
386 void UpdateDragRectOverlay();
387 void DeleteHeaderOverlay();
388 void UpdateHeaderOverlay();
389 void DeleteShrinkOverlay();
390 void UpdateShrinkOverlay();
391 void UpdateAllOverlays();
393 protected:
394 // #114409#
395 void ImpCreateOverlayObjects();
396 void ImpDestroyOverlayObjects();
402 #endif