sync master with lastest vba changes
[ooovba.git] / binfilter / inc / bf_svtools / svicnvw.hxx
blob3e4d20a1ea40955bfd762ef2ca6aa241806cc143
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: svicnvw.hxx,v $
10 * $Revision: 1.3 $
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 _SVICNVW_HXX
32 #define _SVICNVW_HXX
34 #ifndef _IMAGE_HXX
35 #include <vcl/image.hxx>
36 #endif
38 #ifndef _SVLBOX_HXX
39 #include <bf_svtools/svlbox.hxx>
40 #endif
42 namespace binfilter
45 class SvPtrarr;
46 class SvImpIconView;
47 class SvLBoxEntry;
48 class SvLBoxItem;
49 class SvLBoxString;
50 class SvLBoxContextBmp;
52 #define WB_ICON 0x0001
53 #define WB_NAME 0x0002
54 #define WB_TEXT 0x0004
55 #define WB_FLOW 0x0008
57 #define ICNVW_FLAG_POS_LOCKED 0x0001
58 #define ICNVW_FLAG_USER1 0x1000
59 #define ICNVW_FLAG_USER2 0x2000
60 #define ICNVW_FLAG_USER3 0x4000
61 #define ICNVW_FLAG_USER4 0x8000
63 enum SvIconViewTextMode
65 ShowTextFull = 1,
66 ShowTextShort,
67 ShowTextSmart, // not implemented
68 ShowTextDontKnow // nur fuer Eintraege (->Einstellung der View
69 // wird genommen)
72 class SvIcnVwDataEntry : public SvViewDataEntry
74 friend class SvImpIconView;
75 USHORT nIcnVwFlags;
76 SvIconViewTextMode eTextMode;
77 public:
78 Rectangle aRect; // Bounding-Rect des Entries
79 Rectangle aGridRect; // gesetzt im Grid-Modus
80 Size aTextSize; // nur gesetzt im Grid-Modus
81 USHORT nX,nY; // fuer Tastatursteuerung
82 SvIcnVwDataEntry();
83 virtual ~SvIcnVwDataEntry();
85 BOOL IsEntryPosLocked() const { return (BOOL)((nIcnVwFlags & ICNVW_FLAG_POS_LOCKED) !=0); }
86 void ClearVwFlags( USHORT nMask ) { nIcnVwFlags &= (~nMask); }
87 void SetVwFlags( USHORT nMask ) { nIcnVwFlags |= nMask; }
88 USHORT GetVwFlags() const { return nIcnVwFlags; }
89 SvIconViewTextMode GetTextMode() const { return eTextMode; }
92 #define SV_LISTBOX_ID_ICONVIEW 2
94 class SvIconView : public SvLBox
96 friend class SvImpIconView;
98 SvImpIconView* pImp;
99 Image aCollapsedEntryBmp;
100 Image aExpandedEntryBmp;
101 WinBits nWinBits;
102 USHORT nIcnVwFlags;
103 void SetModel( SvLBoxTreeList* );
105 protected:
107 using SvLBox::CreateEntry;
108 SvLBoxEntry* CreateEntry( const XubString&, const Image&, const Image&);
109 void ViewDataInitialized( SvLBoxEntry* );
110 virtual SvViewData* CreateViewData( SvListEntry* );
111 virtual void InitViewData( SvViewData* pData, SvListEntry* pEntry );
113 void EditingRequest(SvLBoxEntry*,SvLBoxItem*,const Point& );
114 void EditedText( const XubString& );
115 void EditItemText( SvLBoxEntry*,SvLBoxItem*,const Selection& );
116 SvLBoxEntry* pCurEdEntry;
117 SvLBoxItem* pCurEdItem;
119 virtual void WriteDragServerInfo( const Point&, SvLBoxDDInfo* );
120 virtual void ReadDragServerInfo( const Point&, SvLBoxDDInfo* );
121 virtual void Command( const CommandEvent& rCEvt );
122 virtual void PreparePaint( SvLBoxEntry* );
124 public:
126 SvIconView( Window* pParent,WinBits nWinStyle=0 );
127 SvIconView( Window* pParent,const ResId& rResId );
128 ~SvIconView();
130 void DisconnectFromModel();
132 SvLBoxEntry* InsertEntry( const XubString& rText, SvLBoxEntry* pParent = 0,
133 BOOL bChildsOnDemand = FALSE,
134 ULONG nPos=LIST_APPEND );
136 SvLBoxEntry* InsertEntry( const XubString& rText,
137 const Image& rExpandedEntryBmp,
138 const Image& rCollapsedEntryBmp,
139 SvLBoxEntry* pParent = 0,
140 BOOL bChildsOnDemand = FALSE,
141 ULONG nPos = LIST_APPEND );
143 const Image& GetDefaultExpandedEntryBmp() const { return aExpandedEntryBmp;}
144 const Image& GetDefaultCollapsedEntryBmp() const { return aCollapsedEntryBmp;}
145 void SetDefaultExpandedEntryBmp( const Image& rBmp) { aExpandedEntryBmp=rBmp;}
146 void SetDefaultCollapsedEntryBmp( const Image& rBmp ) { aCollapsedEntryBmp=rBmp;}
148 void SetEntryText(SvLBoxEntry*, const XubString& );
149 void SetExpandedEntryBmp(SvLBoxEntry*, const Image& );
150 void SetCollapsedEntryBmp(SvLBoxEntry*, const Image& );
152 XubString GetEntryText(SvLBoxEntry*) const;
153 Image GetExpandedEntryBmp(SvLBoxEntry*) const;
154 Image GetCollapsedEntryBmp(SvLBoxEntry*) const;
156 virtual SvLBoxEntry* CloneEntry( SvLBoxEntry* pSource );
158 virtual USHORT IsA();
160 virtual void RequestingChilds( SvLBoxEntry* pParent );
162 virtual void Paint( const Rectangle& rRect );
163 virtual void MouseButtonDown( const MouseEvent& rMEvt );
164 virtual void MouseButtonUp( const MouseEvent& rMEvt );
165 virtual void MouseMove( const MouseEvent& rMEvt );
166 virtual void KeyInput( const KeyEvent& rKEvt );
167 virtual void Resize();
168 virtual void GetFocus();
169 virtual void LoseFocus();
170 void SetUpdateMode( BOOL );
172 using SvListView::SetModel;
173 virtual void SetModel( SvLBoxTreeList*, SvLBoxEntry* pParent );
174 virtual void ModelHasCleared();
175 virtual void ModelHasInserted( SvListEntry* pEntry );
176 virtual void ModelHasInsertedTree( SvListEntry* pEntry );
177 virtual void ModelIsMoving(SvListEntry* pSource,
178 SvListEntry* pTargetParent, ULONG nChildPos );
179 virtual void ModelHasMoved(SvListEntry* pSource );
180 virtual void ModelIsRemoving( SvListEntry* pEntry );
181 virtual void ModelHasRemoved( SvListEntry* pEntry );
182 virtual void ModelHasEntryInvalidated( SvListEntry* pEntry );
184 virtual void ShowTargetEmphasis( SvLBoxEntry*, BOOL bShow );
185 using Window::GetDropTarget;
186 virtual SvLBoxEntry* GetDropTarget( const Point& );
187 virtual Region GetDragRegion() const;
188 // NotifyMoving/Copying ueberladen, da wir bei GetDropTarget
189 // einen "magic pointer" zurueckgeben, falls in einen leeren
190 // Bereich auf der IconView gedroppt wird.
191 virtual BOOL NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
192 SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos);
193 virtual BOOL NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
194 SvLBoxEntry*& rpNewParent, ULONG& rNewChildPos);
196 // gibt TopLeft des BoundingRects zurueck
197 // Konvertierung in Fensterposition: MapMode.Origin addieren
198 Point GetEntryPosition( SvLBoxEntry* ) const;
199 void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos);
200 void SetEntryPosition( SvLBoxEntry*, const Point& rDocPos,
201 BOOL bAdjustAtGrid );
203 void SetFont( const Font& rFont );
204 void SetDefaultFont();
206 using SvLBox::GetEntry;
207 SvLBoxEntry* GetEntry( const Point& rPixPos, BOOL ) const;
208 // Gibt den naechsten ueber pCurEntry liegenden Eintrag (ZOrder)
209 SvLBoxEntry* GetNextEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, BOOL ) const;
210 // Gibt den naechsten unter pCurEntry liegenden Eintrag (ZOrder)
211 SvLBoxEntry* GetPrevEntry( const Point& rPixPos, SvLBoxEntry* pCurEntry, BOOL ) const;
213 SvLBoxEntry* GetEntryFromLogicPos( const Point& rDocPos ) const;
215 void SetWindowBits( WinBits nWinStyle );
216 virtual void PaintEntry( SvLBoxEntry* );
217 virtual void PaintEntry( SvLBoxEntry*, const Point& rDocPos );
218 Rectangle GetFocusRect( SvLBoxEntry* );
219 void InvalidateEntry( SvLBoxEntry* );
220 void MakeVisible( SvLBoxEntry* );
222 void SetDragDropMode( DragDropMode );
223 void SetSelectionMode( SelectionMode );
225 using SvListView::Select;
226 BOOL Select( SvLBoxEntry* pEntry, BOOL bSelect=TRUE );
227 void SelectAll( BOOL bSelect, BOOL bPaint=TRUE );
228 virtual void SetCurEntry( SvLBoxEntry* _pEntry );
229 virtual SvLBoxEntry*
230 GetCurEntry() const;
232 // logische Koordinaten
233 void SelectRect(
234 const Rectangle& rRect,
235 BOOL bAdd = FALSE,
236 // die Schnittmenge mit rRect wird invertiert
237 // wird bei bAdd == FALSE ignoriert
238 SvPtrarr* pOtherRects = 0,
239 short nBorderOffs = -5 );
240 ULONG GetSelectionCount() const;
242 virtual void Arrange();
243 void SetSpaceBetweenEntries( long nHor, long Ver );
244 long GetHorSpaceBetweenEntries();
245 long GetVerSpaceBetweenEntries();
247 void EnableInplaceEditing( BOOL bEnable );
248 void EditEntry( SvLBoxEntry* pEntry = 0 );
249 virtual BOOL EditingEntry( SvLBoxEntry* pEntry, Selection& );
250 virtual BOOL EditedEntry( SvLBoxEntry*, const XubString& rNewText );
252 void SetCurParent( SvLBoxEntry* pNewParent );
253 SvLBoxEntry* GetCurParent() const;
255 virtual void ModelNotification( USHORT nActionId, SvListEntry* pEntry1,
256 SvListEntry* pEntry2, ULONG nPos );
258 // 0,0: Grid-Modus ausschalten
259 void SetGrid( long nDX, long nDY );
261 // nDeltaY < 0 : View bewegt sich auf dem Doc nach oben
262 // nDeltaY > 0 : View bewegt sich auf dem Doc nach unten
263 // nDeltaX < 0 : View bewegt sich auf dem Doc nach links
264 // nDeltaX > 0 : View bewegt sich auf dem Doc nach rechts
265 using Window::Scroll;
266 virtual void Scroll( long nDeltaX, long nDeltaY, USHORT nFlags = 0 );
268 virtual void PrepareCommandEvent( const CommandEvent& );
269 virtual void StartDrag( sal_Int8 nAction, const Point& );
270 virtual void DragFinished( sal_Int8 );
271 virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
272 using SvLBox::ExecuteDrop;
273 virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
275 void ShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
276 void HideDDIcon();
277 void HideShowDDIcon( SvLBoxEntry* pRefEntry, const Point& rPos );
279 // fuers Scrollen beim D&D
280 void CalcScrollOffsets(
281 const Point& rRefPosPixel,
282 long& rScrollX,
283 long& rScrollY,
284 BOOL bInDragDrop = FALSE,
285 USHORT nBorderWidth = 10 );
287 using Window::EndTracking;
288 void EndTracking();
289 void AdjustAtGrid( SvLBoxEntry* pEntry = 0 );
290 void LockEntryPos( SvLBoxEntry* pEntry, BOOL bLock = TRUE );
291 BOOL IsEntryPosLocked( const SvLBoxEntry* pEntry ) const;
293 void SetTextMode( SvIconViewTextMode, SvLBoxEntry* pEntry = 0 );
294 SvIconViewTextMode GetTextMode( const SvLBoxEntry* pEntry = 0 ) const;
296 void ShowFocusRect( const SvLBoxEntry* pEntry );
301 #endif