xref: /AOO41X/main/svx/inc/galbrws2.hxx (revision 8809db7a87f97847b57a57f4cd2b0104b2b83182)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_GALBRWS2_HXX_
25 #define _SVX_GALBRWS2_HXX_
26 
27 #include <vcl/lstbox.hxx>
28 #include <vcl/button.hxx>
29 #include <vcl/fixed.hxx>
30 #include <vcl/timer.hxx>
31 #include <vcl/toolbox.hxx>
32 #include <svtools/transfer.hxx>
33 #include <svl/lstner.hxx>
34 #include <svtools/miscopt.hxx>
35 #include "svx/galbrws.hxx"
36 
37 // ----------------------
38 // - GalleryBrowserMode -
39 // ----------------------
40 
41 enum GalleryBrowserMode
42 {
43     GALLERYBROWSERMODE_NONE = 0,
44     GALLERYBROWSERMODE_ICON = 1,
45     GALLERYBROWSERMODE_LIST = 2,
46     GALLERYBROWSERMODE_PREVIEW = 3
47 };
48 
49 // -----------------
50 // - GalleryTravel -
51 // -----------------
52 
53 enum GalleryBrowserTravel
54 {
55     GALLERYBROWSERTRAVEL_CURRENT = 0,
56     GALLERYBROWSERTRAVEL_FIRST = 1,
57     GALLERYBROWSERTRAVEL_LAST = 2,
58     GALLERYBROWSERTRAVEL_PREVIOUS = 3,
59     GALLERYBROWSERTRAVEL_NEXT = 4
60 };
61 
62 // ------------------------
63 // - GalleryItemTextFlags -
64 // ------------------------
65 
66 #define GALLERY_ITEM_THEMENAME  0x00000001
67 #define GALLERY_ITEM_TITLE      0x00000002
68 #define GALLERY_ITEM_PATH       0x00000004
69 
70 // ------------------
71 // - GalleryToolBox -
72 // ------------------
73 
74 class GalleryToolBox : public ToolBox
75 {
76 private:
77 
78     virtual void    KeyInput( const KeyEvent& rKEvt );
79 
80 public:
81 
82                     GalleryToolBox( GalleryBrowser2* pParent );
83                     ~GalleryToolBox();
84 };
85 
86 // -------------------
87 // - GalleryBrowser2 -
88 // -------------------
89 
90 class Gallery;
91 class GalleryTheme;
92 class GalleryIconView;
93 class GalleryListView;
94 class GalleryPreview;
95 class Menu;
96 class SgaObject;
97 
98 class GalleryBrowser2 : public Control, public SfxListener
99 {
100     friend class GalleryBrowser;
101     using Control::Notify;
102     using Window::KeyInput;
103 
104 private:
105 
106     SvtMiscOptions      maMiscOptions;
107     Gallery*            mpGallery;
108     GalleryTheme*       mpCurTheme;
109     GalleryIconView*    mpIconView;
110     GalleryListView*    mpListView;
111     GalleryPreview*     mpPreview;
112     GalleryToolBox      maViewBox;
113     FixedLine           maSeparator;
114     FixedText           maInfoBar;
115     Point               maDragStartPos;
116     sal_uIntPtr             mnCurActionPos;
117     GalleryBrowserMode  meMode;
118     GalleryBrowserMode  meLastMode;
119     sal_Bool                mbCurActionIsLinkage;
120 
121     void                InitSettings();
122 
123     void                ImplUpdateViews( sal_uInt16 nSelectionId );
124     void                ImplUpdateInfoBar();
125     sal_uIntPtr               ImplGetSelectedItemId( const Point* pSelPosPixel, Point& rSelPos );
126     void                ImplSelectItemId( sal_uIntPtr nItemId );
127     void                ImplExecute( sal_uInt16 nId );
128 
129     // Control
130     virtual void        Resize();
131     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
132 
133     // SfxListener
134     virtual void        Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
135 
136                         DECL_LINK( MenuSelectHdl, Menu* pMenu );
137                         DECL_LINK( SelectObjectHdl, void* );
138                         DECL_LINK( SelectTbxHdl, ToolBox* );
139                         DECL_LINK( MiscHdl, void* );
140 
141 private:
142 
143     static GalleryBrowserMode meInitMode;
144 
145 public:
146 
147     static String       GetItemText( const GalleryTheme& rTheme, const SgaObject& rObj, sal_uIntPtr nItemTextFlags );
148 
149 public:
150 
151                         GalleryBrowser2( GalleryBrowser* pParent, const ResId& rResId, Gallery* pGallery );
152                         ~GalleryBrowser2();
153 
154     void                SelectTheme( const String& rThemeName );
155 
156     GalleryBrowserMode  GetMode() const { return meMode; }
157     void                SetMode( GalleryBrowserMode eMode );
158 
159     Window*             GetViewWindow() const;
160 
161     void                Travel( GalleryBrowserTravel eTravel );
162 
163     INetURLObject       GetURL() const;
164     String              GetFilterName() const;
165     Graphic             GetGraphic() const;
166     sal_Bool                GetVCDrawModel( FmFormModel& rModel ) const;
167     sal_Bool                IsLinkage() const;
168 
169     sal_Int8            AcceptDrop( DropTargetHelper& rTarget, const AcceptDropEvent& rEvt );
170     sal_Int8            ExecuteDrop( DropTargetHelper& rTarget, const ExecuteDropEvent& rEvt );
171     void                StartDrag( Window* pWindow, const Point* pDragPoint = NULL );
172     void                TogglePreview( Window* pWindow, const Point* pPreviewPoint = NULL );
173     void                ShowContextMenu( Window* pWindow, const Point* pContextPoint = NULL );
174     sal_Bool                KeyInput( const KeyEvent& rEvt, Window* pWindow );
175 };
176 
177 #endif
178