1*3334a7e6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*3334a7e6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*3334a7e6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*3334a7e6SAndrew Rist * distributed with this work for additional information 6*3334a7e6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*3334a7e6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*3334a7e6SAndrew Rist * "License"); you may not use this file except in compliance 9*3334a7e6SAndrew Rist * with the License. You may obtain a copy of the License at 10*3334a7e6SAndrew Rist * 11*3334a7e6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*3334a7e6SAndrew Rist * 13*3334a7e6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*3334a7e6SAndrew Rist * software distributed under the License is distributed on an 15*3334a7e6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*3334a7e6SAndrew Rist * KIND, either express or implied. See the License for the 17*3334a7e6SAndrew Rist * specific language governing permissions and limitations 18*3334a7e6SAndrew Rist * under the License. 19*3334a7e6SAndrew Rist * 20*3334a7e6SAndrew Rist *************************************************************/ 21*3334a7e6SAndrew Rist 22*3334a7e6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_GALCTRL_HXX_ 25cdf0e10cSrcweir #define _SVX_GALCTRL_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/dialog.hxx> 28cdf0e10cSrcweir #include <vcl/graph.hxx> 29cdf0e10cSrcweir #include <vcl/fixed.hxx> 30cdf0e10cSrcweir #include <vcl/group.hxx> 31cdf0e10cSrcweir #include <vcl/button.hxx> 32cdf0e10cSrcweir #include <vcl/lstbox.hxx> 33cdf0e10cSrcweir #include <vcl/menu.hxx> 34cdf0e10cSrcweir #include <vcl/edit.hxx> 35cdf0e10cSrcweir #include <vcl/combobox.hxx> 36cdf0e10cSrcweir #include <vcl/sound.hxx> 37cdf0e10cSrcweir #include <svl/slstitm.hxx> 38cdf0e10cSrcweir #include <svtools/transfer.hxx> 39cdf0e10cSrcweir #include <svtools/valueset.hxx> 40cdf0e10cSrcweir #include <svtools/brwbox.hxx> 41cdf0e10cSrcweir #include <svtools/grfmgr.hxx> 42cdf0e10cSrcweir #include "svx/galmisc.hxx" 43cdf0e10cSrcweir #include "svx/svxdllapi.h" 44cdf0e10cSrcweir 45cdf0e10cSrcweir // ------------ 46cdf0e10cSrcweir // - Forwards - 47cdf0e10cSrcweir // ------------ 48cdf0e10cSrcweir 49cdf0e10cSrcweir class GalleryTheme; 50cdf0e10cSrcweir class GalleryBrowser2; 51cdf0e10cSrcweir 52cdf0e10cSrcweir // ------------------ 53cdf0e10cSrcweir // - GalleryPreview - 54cdf0e10cSrcweir // ------------------ 55cdf0e10cSrcweir 56cdf0e10cSrcweir class SVX_DLLPUBLIC GalleryPreview : public Window, public DropTargetHelper, public DragSourceHelper 57cdf0e10cSrcweir { 58cdf0e10cSrcweir private: 59cdf0e10cSrcweir 60cdf0e10cSrcweir GraphicObject aGraphicObj; 61cdf0e10cSrcweir Rectangle aPreviewRect; 62cdf0e10cSrcweir GalleryTheme* mpTheme; 63cdf0e10cSrcweir 64cdf0e10cSrcweir SVX_DLLPRIVATE sal_Bool ImplGetGraphicCenterRect( const Graphic& rGraphic, Rectangle& rResultRect ) const; 65cdf0e10cSrcweir SVX_DLLPRIVATE void InitSettings(); 66cdf0e10cSrcweir 67cdf0e10cSrcweir // Window 68cdf0e10cSrcweir SVX_DLLPRIVATE virtual void Paint(const Rectangle& rRect); 69cdf0e10cSrcweir SVX_DLLPRIVATE virtual void MouseButtonDown(const MouseEvent& rMEvt); 70cdf0e10cSrcweir SVX_DLLPRIVATE virtual void Command(const CommandEvent& rCEvt); 71cdf0e10cSrcweir SVX_DLLPRIVATE virtual void KeyInput( const KeyEvent& rKEvt ); 72cdf0e10cSrcweir SVX_DLLPRIVATE virtual void DataChanged( const DataChangedEvent& rDCEvt ); 73cdf0e10cSrcweir 74cdf0e10cSrcweir 75cdf0e10cSrcweir // DropTargetHelper 76cdf0e10cSrcweir SVX_DLLPRIVATE virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 77cdf0e10cSrcweir SVX_DLLPRIVATE virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir // DragSourceHelper 80cdf0e10cSrcweir SVX_DLLPRIVATE virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir DECL_LINK( MenuSelectHdl, Menu* ); 83cdf0e10cSrcweir 84cdf0e10cSrcweir public: 85cdf0e10cSrcweir 86cdf0e10cSrcweir GalleryPreview( GalleryBrowser2* pParent, GalleryTheme* pTheme ); 87cdf0e10cSrcweir GalleryPreview( Window* pParent, const ResId& rResId ); 88cdf0e10cSrcweir ~GalleryPreview(); 89cdf0e10cSrcweir SetGraphic(const Graphic & rGraphic)90cdf0e10cSrcweir void SetGraphic( const Graphic& rGraphic ) { aGraphicObj.SetGraphic( rGraphic ); } 91cdf0e10cSrcweir bool SetGraphic( const INetURLObject& ); 92cdf0e10cSrcweir void PreviewMedia( const INetURLObject& rURL ); 93cdf0e10cSrcweir }; 94cdf0e10cSrcweir 95cdf0e10cSrcweir // ------------------- 96cdf0e10cSrcweir // - GalleryIconView - 97cdf0e10cSrcweir // ------------------- 98cdf0e10cSrcweir 99cdf0e10cSrcweir class GalleryIconView : public ValueSet, public DropTargetHelper, public DragSourceHelper 100cdf0e10cSrcweir { 101cdf0e10cSrcweir using ValueSet::StartDrag; 102cdf0e10cSrcweir 103cdf0e10cSrcweir private: 104cdf0e10cSrcweir 105cdf0e10cSrcweir GalleryTheme* mpTheme; 106cdf0e10cSrcweir 107cdf0e10cSrcweir void InitSettings(); 108cdf0e10cSrcweir 109cdf0e10cSrcweir // ValueSet 110cdf0e10cSrcweir virtual void UserDraw( const UserDrawEvent& rUDEvt ); 111cdf0e10cSrcweir 112cdf0e10cSrcweir // Window 113cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 114cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 115cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 116cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 117cdf0e10cSrcweir 118cdf0e10cSrcweir // DropTargetHelper 119cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ); 120cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ); 121cdf0e10cSrcweir 122cdf0e10cSrcweir // DragSourceHelper 123cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 124cdf0e10cSrcweir 125cdf0e10cSrcweir public: 126cdf0e10cSrcweir 127cdf0e10cSrcweir GalleryIconView( GalleryBrowser2* pParent, GalleryTheme* pTheme ); 128cdf0e10cSrcweir ~GalleryIconView(); 129cdf0e10cSrcweir }; 130cdf0e10cSrcweir 131cdf0e10cSrcweir // ------------------- 132cdf0e10cSrcweir // - GalleryListView - 133cdf0e10cSrcweir // ------------------- 134cdf0e10cSrcweir 135cdf0e10cSrcweir class GalleryListView : public BrowseBox 136cdf0e10cSrcweir { 137cdf0e10cSrcweir using BrowseBox::AcceptDrop; 138cdf0e10cSrcweir using BrowseBox::ExecuteDrop; 139cdf0e10cSrcweir 140cdf0e10cSrcweir private: 141cdf0e10cSrcweir 142cdf0e10cSrcweir Link maSelectHdl; 143cdf0e10cSrcweir GalleryTheme* mpTheme; 144cdf0e10cSrcweir sal_uIntPtr mnCurRow; 145cdf0e10cSrcweir sal_Bool mbInit; 146cdf0e10cSrcweir 147cdf0e10cSrcweir void InitSettings(); 148cdf0e10cSrcweir 149cdf0e10cSrcweir // BrowseBox 150cdf0e10cSrcweir virtual sal_Bool SeekRow( long nRow ); 151cdf0e10cSrcweir virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect, sal_uInt16 nColumnId ) const; 152cdf0e10cSrcweir virtual void DoubleClick( const BrowserMouseEvent& rEvt ); 153cdf0e10cSrcweir virtual void Select(); 154cdf0e10cSrcweir virtual sal_Int8 AcceptDrop( const BrowserAcceptDropEvent& rEvt ); 155cdf0e10cSrcweir virtual sal_Int8 ExecuteDrop( const BrowserExecuteDropEvent& rEvt ); 156cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 157cdf0e10cSrcweir 158cdf0e10cSrcweir // Window 159cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 160cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 161cdf0e10cSrcweir 162cdf0e10cSrcweir // DragSourceHelper 163cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 164cdf0e10cSrcweir 165cdf0e10cSrcweir public: 166cdf0e10cSrcweir 167cdf0e10cSrcweir GalleryListView( GalleryBrowser2* pParent, GalleryTheme* pTheme ); 168cdf0e10cSrcweir ~GalleryListView(); 169cdf0e10cSrcweir SetSelectHdl(const Link & rSelectHdl)170cdf0e10cSrcweir void SetSelectHdl( const Link& rSelectHdl ) { maSelectHdl = rSelectHdl; } 171cdf0e10cSrcweir 172cdf0e10cSrcweir /** GetCellText returns the text at the given position 173cdf0e10cSrcweir @param _nRow 174cdf0e10cSrcweir the number of the row 175cdf0e10cSrcweir @param _nColId 176cdf0e10cSrcweir the ID of the column 177cdf0e10cSrcweir @return 178cdf0e10cSrcweir the text out of the cell 179cdf0e10cSrcweir */ 180cdf0e10cSrcweir virtual String GetCellText(long _nRow, sal_uInt16 _nColId) const; 181cdf0e10cSrcweir 182cdf0e10cSrcweir // from IAccessibleTableProvider 183cdf0e10cSrcweir virtual Rectangle GetFieldCharacterBounds(sal_Int32 _nRow,sal_Int32 _nColumnPos,sal_Int32 nIndex); 184cdf0e10cSrcweir virtual sal_Int32 GetFieldIndexAtPoint(sal_Int32 _nRow,sal_Int32 _nColumnPos,const Point& _rPoint); 185cdf0e10cSrcweir }; 186cdf0e10cSrcweir 187cdf0e10cSrcweir #endif // _SVX_GALCTRL_HXX_ 188