1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _SVX_GALBRWS2_HXX_ 29 #define _SVX_GALBRWS2_HXX_ 30 31 #include <vcl/lstbox.hxx> 32 #include <vcl/button.hxx> 33 #include <vcl/fixed.hxx> 34 #include <vcl/timer.hxx> 35 #include <vcl/toolbox.hxx> 36 #include <svtools/transfer.hxx> 37 #include <svl/lstner.hxx> 38 #include <svtools/miscopt.hxx> 39 #include "svx/galbrws.hxx" 40 41 // ---------------------- 42 // - GalleryBrowserMode - 43 // ---------------------- 44 45 enum GalleryBrowserMode 46 { 47 GALLERYBROWSERMODE_NONE = 0, 48 GALLERYBROWSERMODE_ICON = 1, 49 GALLERYBROWSERMODE_LIST = 2, 50 GALLERYBROWSERMODE_PREVIEW = 3 51 }; 52 53 // ----------------- 54 // - GalleryTravel - 55 // ----------------- 56 57 enum GalleryBrowserTravel 58 { 59 GALLERYBROWSERTRAVEL_CURRENT = 0, 60 GALLERYBROWSERTRAVEL_FIRST = 1, 61 GALLERYBROWSERTRAVEL_LAST = 2, 62 GALLERYBROWSERTRAVEL_PREVIOUS = 3, 63 GALLERYBROWSERTRAVEL_NEXT = 4 64 }; 65 66 // ------------------------ 67 // - GalleryItemTextFlags - 68 // ------------------------ 69 70 #define GALLERY_ITEM_THEMENAME 0x00000001 71 #define GALLERY_ITEM_TITLE 0x00000002 72 #define GALLERY_ITEM_PATH 0x00000004 73 74 // ------------------ 75 // - GalleryToolBox - 76 // ------------------ 77 78 class GalleryToolBox : public ToolBox 79 { 80 private: 81 82 virtual void KeyInput( const KeyEvent& rKEvt ); 83 84 public: 85 86 GalleryToolBox( GalleryBrowser2* pParent ); 87 ~GalleryToolBox(); 88 }; 89 90 // ------------------- 91 // - GalleryBrowser2 - 92 // ------------------- 93 94 class Gallery; 95 class GalleryTheme; 96 class GalleryIconView; 97 class GalleryListView; 98 class GalleryPreview; 99 class Menu; 100 class SgaObject; 101 102 class GalleryBrowser2 : public Control, public SfxListener 103 { 104 friend class GalleryBrowser; 105 using Control::Notify; 106 using Window::KeyInput; 107 108 private: 109 110 SvtMiscOptions maMiscOptions; 111 Gallery* mpGallery; 112 GalleryTheme* mpCurTheme; 113 GalleryIconView* mpIconView; 114 GalleryListView* mpListView; 115 GalleryPreview* mpPreview; 116 GalleryToolBox maViewBox; 117 FixedLine maSeparator; 118 FixedText maInfoBar; 119 Point maDragStartPos; 120 sal_uIntPtr mnCurActionPos; 121 GalleryBrowserMode meMode; 122 GalleryBrowserMode meLastMode; 123 sal_Bool mbCurActionIsLinkage; 124 125 void InitSettings(); 126 127 void ImplUpdateViews( sal_uInt16 nSelectionId ); 128 void ImplUpdateInfoBar(); 129 sal_uIntPtr ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos ); 130 void ImplSelectItemId( sal_uIntPtr nItemId ); 131 void ImplExecute( sal_uInt16 nId ); 132 133 // Control 134 virtual void Resize(); 135 virtual void DataChanged( const DataChangedEvent& rDCEvt ); 136 137 // SfxListener 138 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 139 140 DECL_LINK( MenuSelectHdl, Menu* pMenu ); 141 DECL_LINK( SelectObjectHdl, void* ); 142 DECL_LINK( SelectTbxHdl, ToolBox* ); 143 DECL_LINK( MiscHdl, void* ); 144 145 private: 146 147 static GalleryBrowserMode meInitMode; 148 149 public: 150 151 static String GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ); 152 153 public: 154 155 GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery ); 156 ~GalleryBrowser2(); 157 158 void SelectTheme( const String& rThemeName ); 159 160 GalleryBrowserMode GetMode() const { return meMode; } 161 void SetMode( GalleryBrowserMode eMode ); 162 163 Window* GetViewWindow() const; 164 165 void Travel( GalleryBrowserTravel eTravel ); 166 167 INetURLObject GetURL() const; 168 String GetFilterName() const; 169 Graphic GetGraphic() const; 170 sal_Bool GetVCDrawModel( FmFormModel& rModel ) const; 171 sal_Bool IsLinkage() const; 172 173 sal_Int8 AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt ); 174 sal_Int8 ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt ); 175 void StartDrag( Window* pWindow, const Point* pDragPoint = NULL ); 176 void TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL ); 177 void ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL ); 178 sal_Bool KeyInput( const KeyEvent& rEvt, Window* pWindow ); 179 }; 180 181 #endif 182