13334a7e6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 33334a7e6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 43334a7e6SAndrew Rist * or more contributor license agreements. See the NOTICE file 53334a7e6SAndrew Rist * distributed with this work for additional information 63334a7e6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 73334a7e6SAndrew Rist * to you under the Apache License, Version 2.0 (the 83334a7e6SAndrew Rist * "License"); you may not use this file except in compliance 93334a7e6SAndrew Rist * with the License. You may obtain a copy of the License at 103334a7e6SAndrew Rist * 113334a7e6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 123334a7e6SAndrew Rist * 133334a7e6SAndrew Rist * Unless required by applicable law or agreed to in writing, 143334a7e6SAndrew Rist * software distributed under the License is distributed on an 153334a7e6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 163334a7e6SAndrew Rist * KIND, either express or implied. See the License for the 173334a7e6SAndrew Rist * specific language governing permissions and limitations 183334a7e6SAndrew Rist * under the License. 193334a7e6SAndrew Rist * 203334a7e6SAndrew Rist *************************************************************/ 213334a7e6SAndrew Rist 223334a7e6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVX_GALBRWS2_HXX_ 25cdf0e10cSrcweir #define _SVX_GALBRWS2_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/lstbox.hxx> 28cdf0e10cSrcweir #include <vcl/button.hxx> 29cdf0e10cSrcweir #include <vcl/fixed.hxx> 30cdf0e10cSrcweir #include <vcl/timer.hxx> 31cdf0e10cSrcweir #include <vcl/toolbox.hxx> 32cdf0e10cSrcweir #include <svtools/transfer.hxx> 33cdf0e10cSrcweir #include <svl/lstner.hxx> 34cdf0e10cSrcweir #include <svtools/miscopt.hxx> 35cdf0e10cSrcweir #include "svx/galbrws.hxx" 36cdf0e10cSrcweir 37*9afceb33SAriel Constenla-Haile #include <com/sun/star/frame/XDispatch.hpp> 38*9afceb33SAriel Constenla-Haile #include <com/sun/star/util/XURLTransformer.hpp> 39*9afceb33SAriel Constenla-Haile 40cdf0e10cSrcweir // ---------------------- 41cdf0e10cSrcweir // - GalleryBrowserMode - 42cdf0e10cSrcweir // ---------------------- 43cdf0e10cSrcweir 44cdf0e10cSrcweir enum GalleryBrowserMode 45cdf0e10cSrcweir { 46cdf0e10cSrcweir GALLERYBROWSERMODE_NONE = 0, 47cdf0e10cSrcweir GALLERYBROWSERMODE_ICON = 1, 48cdf0e10cSrcweir GALLERYBROWSERMODE_LIST = 2, 49cdf0e10cSrcweir GALLERYBROWSERMODE_PREVIEW = 3 50cdf0e10cSrcweir }; 51cdf0e10cSrcweir 52cdf0e10cSrcweir // ----------------- 53cdf0e10cSrcweir // - GalleryTravel - 54cdf0e10cSrcweir // ----------------- 55cdf0e10cSrcweir 56cdf0e10cSrcweir enum GalleryBrowserTravel 57cdf0e10cSrcweir { 58cdf0e10cSrcweir GALLERYBROWSERTRAVEL_CURRENT = 0, 59cdf0e10cSrcweir GALLERYBROWSERTRAVEL_FIRST = 1, 60cdf0e10cSrcweir GALLERYBROWSERTRAVEL_LAST = 2, 61cdf0e10cSrcweir GALLERYBROWSERTRAVEL_PREVIOUS = 3, 62cdf0e10cSrcweir GALLERYBROWSERTRAVEL_NEXT = 4 63cdf0e10cSrcweir }; 64cdf0e10cSrcweir 65cdf0e10cSrcweir // ------------------------ 66cdf0e10cSrcweir // - GalleryItemTextFlags - 67cdf0e10cSrcweir // ------------------------ 68cdf0e10cSrcweir 69cdf0e10cSrcweir #define GALLERY_ITEM_THEMENAME 0x00000001 70cdf0e10cSrcweir #define GALLERY_ITEM_TITLE 0x00000002 71cdf0e10cSrcweir #define GALLERY_ITEM_PATH 0x00000004 72cdf0e10cSrcweir 73cdf0e10cSrcweir // ------------------ 74cdf0e10cSrcweir // - GalleryToolBox - 75cdf0e10cSrcweir // ------------------ 76cdf0e10cSrcweir 77cdf0e10cSrcweir class GalleryToolBox : public ToolBox 78cdf0e10cSrcweir { 79cdf0e10cSrcweir private: 80cdf0e10cSrcweir 81cdf0e10cSrcweir virtual void KeyInput( const KeyEvent& rKEvt ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir public: 84cdf0e10cSrcweir 85cdf0e10cSrcweir GalleryToolBox( GalleryBrowser2* pParent ); 86cdf0e10cSrcweir ~GalleryToolBox(); 87cdf0e10cSrcweir }; 88cdf0e10cSrcweir 89cdf0e10cSrcweir // ------------------- 90cdf0e10cSrcweir // - GalleryBrowser2 - 91cdf0e10cSrcweir // ------------------- 92cdf0e10cSrcweir 93cdf0e10cSrcweir class Gallery; 94cdf0e10cSrcweir class GalleryTheme; 95cdf0e10cSrcweir class GalleryIconView; 96cdf0e10cSrcweir class GalleryListView; 97cdf0e10cSrcweir class GalleryPreview; 98cdf0e10cSrcweir class Menu; 99cdf0e10cSrcweir class SgaObject; 100*9afceb33SAriel Constenla-Haile struct DispatchInfo; 101cdf0e10cSrcweir 10202c50d82SAndre Fischer namespace svx { namespace sidebar { class GalleryControl; } } 10302c50d82SAndre Fischer 104cdf0e10cSrcweir class GalleryBrowser2 : public Control, public SfxListener 105cdf0e10cSrcweir { 106cdf0e10cSrcweir friend class GalleryBrowser; 10702c50d82SAndre Fischer friend class svx::sidebar::GalleryControl; 108cdf0e10cSrcweir using Control::Notify; 109cdf0e10cSrcweir using Window::KeyInput; 110cdf0e10cSrcweir 111cdf0e10cSrcweir private: 112cdf0e10cSrcweir 113cdf0e10cSrcweir SvtMiscOptions maMiscOptions; 114cdf0e10cSrcweir Gallery* mpGallery; 115cdf0e10cSrcweir GalleryTheme* mpCurTheme; 116cdf0e10cSrcweir GalleryIconView* mpIconView; 117cdf0e10cSrcweir GalleryListView* mpListView; 118cdf0e10cSrcweir GalleryPreview* mpPreview; 119cdf0e10cSrcweir GalleryToolBox maViewBox; 120cdf0e10cSrcweir FixedLine maSeparator; 121cdf0e10cSrcweir FixedText maInfoBar; 122cdf0e10cSrcweir Point maDragStartPos; 123cdf0e10cSrcweir sal_uIntPtr mnCurActionPos; 124cdf0e10cSrcweir GalleryBrowserMode meMode; 125cdf0e10cSrcweir GalleryBrowserMode meLastMode; 126*9afceb33SAriel Constenla-Haile 127*9afceb33SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext; 128*9afceb33SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > m_xTransformer; 129cdf0e10cSrcweir 130cdf0e10cSrcweir void InitSettings(); 131cdf0e10cSrcweir 132cdf0e10cSrcweir void ImplUpdateViews( sal_uInt16 nSelectionId ); 133cdf0e10cSrcweir void ImplUpdateInfoBar(); 134cdf0e10cSrcweir sal_uIntPtr ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos ); 135cdf0e10cSrcweir void ImplSelectItemId( sal_uIntPtr nItemId ); 136cdf0e10cSrcweir 137cdf0e10cSrcweir // Control 138cdf0e10cSrcweir virtual void Resize(); 139cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 140cdf0e10cSrcweir 141cdf0e10cSrcweir // SfxListener 142cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 143cdf0e10cSrcweir 144cdf0e10cSrcweir DECL_LINK( SelectObjectHdl, void* ); 145cdf0e10cSrcweir DECL_LINK( SelectTbxHdl, ToolBox* ); 146cdf0e10cSrcweir DECL_LINK( MiscHdl, void* ); 147cdf0e10cSrcweir 148cdf0e10cSrcweir private: 149cdf0e10cSrcweir 150cdf0e10cSrcweir static GalleryBrowserMode meInitMode; 151cdf0e10cSrcweir 152cdf0e10cSrcweir public: 153cdf0e10cSrcweir 154cdf0e10cSrcweir static String GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags ); 155cdf0e10cSrcweir 156cdf0e10cSrcweir public: 157cdf0e10cSrcweir 15802c50d82SAndre Fischer GalleryBrowser2( Window* pParent, const ResId& rResId, Gallery* pGallery ); 159cdf0e10cSrcweir ~GalleryBrowser2(); 160cdf0e10cSrcweir 161cdf0e10cSrcweir void SelectTheme( const String& rThemeName ); 162cdf0e10cSrcweir GetMode() const163cdf0e10cSrcweir GalleryBrowserMode GetMode() const { return meMode; } 164cdf0e10cSrcweir void SetMode( GalleryBrowserMode eMode ); 165cdf0e10cSrcweir 166cdf0e10cSrcweir Window* GetViewWindow() const; 167cdf0e10cSrcweir 168cdf0e10cSrcweir void Travel( GalleryBrowserTravel eTravel ); 169cdf0e10cSrcweir 170cdf0e10cSrcweir INetURLObject GetURL() const; 171cdf0e10cSrcweir String GetFilterName() const; 172cdf0e10cSrcweir Graphic GetGraphic() const; 173cdf0e10cSrcweir sal_Bool GetVCDrawModel( FmFormModel& rModel ) const; 174cdf0e10cSrcweir 175cdf0e10cSrcweir sal_Int8 AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt ); 176cdf0e10cSrcweir sal_Int8 ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt ); 177cdf0e10cSrcweir void StartDrag( Window* pWindow, const Point* pDragPoint = NULL ); 178cdf0e10cSrcweir void TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL ); 179cdf0e10cSrcweir void ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL ); 180*9afceb33SAriel Constenla-Haile sal_Bool KeyInput( const KeyEvent& rEvt, Window* pWindow ); 181*9afceb33SAriel Constenla-Haile 182*9afceb33SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::frame::XFrame > GetFrame() const; GetUNOContext() const183*9afceb33SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > GetUNOContext() const { return m_xContext; } GetURLTransformer() const184*9afceb33SAriel Constenla-Haile com::sun::star::uno::Reference< com::sun::star::util::XURLTransformer > GetURLTransformer() const { return m_xTransformer; } 185*9afceb33SAriel Constenla-Haile 186*9afceb33SAriel Constenla-Haile void Execute( sal_uInt16 nId ); 187*9afceb33SAriel Constenla-Haile void Dispatch( sal_uInt16 nId, 188*9afceb33SAriel Constenla-Haile const com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > &rxDispatch = com::sun::star::uno::Reference< com::sun::star::frame::XDispatch >(), 189*9afceb33SAriel Constenla-Haile const com::sun::star::util::URL &rURL = com::sun::star::util::URL() ); 190*9afceb33SAriel Constenla-Haile 191*9afceb33SAriel Constenla-Haile DECL_STATIC_LINK( GalleryBrowser2, AsyncDispatch_Impl, DispatchInfo* ); 192cdf0e10cSrcweir }; 193cdf0e10cSrcweir 194cdf0e10cSrcweir #endif 195