xref: /trunk/main/sw/source/ui/inc/navipi.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 #ifndef _NAVIPI_HXX
28 #define _NAVIPI_HXX
29 
30 // INCLUDE ---------------------------------------------------------------
31 
32 #ifndef _LSTBOX_HXX //autogen
33 #include <vcl/lstbox.hxx>
34 #endif
35 #include <svl/lstner.hxx>
36 #include <svtools/transfer.hxx>
37 #include <sfx2/childwin.hxx>
38 #include <sfx2/ctrlitem.hxx>
39 #include <sfx2/tbxctrl.hxx>
40 #include <conttree.hxx>
41 #include <popbox.hxx>
42 
43 class SwWrtShell;
44 class SwNavigationPI;
45 class SwNavigationChild;
46 class SfxBindings;
47 class NumEditAction;
48 class SwView;
49 class SwNavigationConfig;
50 class SfxObjectShellLock;
51 class SfxChildWindowContext;
52 
53 //-----------------------------------------------------------------------
54 class SwNavigationPI;
55 class SwNavHelpToolBox : public SwHelpToolBox
56 {
57     virtual void    MouseButtonDown(const MouseEvent &rEvt);
58     virtual void    RequestHelp( const HelpEvent& rHEvt );
59     public:
60         SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId);
61 };
62 
63 
64 // CLASS -----------------------------------------------------------------
65 class SwNavigationPI : public Window,
66                         public SfxControllerItem, public SfxListener
67 {
68     friend class SwNavigationChild;
69     friend class SwContentTree;
70     friend class SwGlobalTree;
71 
72     // --------- members -----------------------------
73     SwNavHelpToolBox    aContentToolBox;
74     SwHelpToolBox       aGlobalToolBox;
75     ImageList           aContentImageList;
76     ImageList           aContentImageListH;
77     SwContentTree       aContentTree;
78     SwGlobalTree        aGlobalTree;
79     ListBox             aDocListBox;
80     Timer               aPageChgTimer;
81     String              sContentFileName;
82     String              aContextArr[3];
83     String              aStatusArr[4];
84     Point               aBoxBottomLeft; // Pos., wenn Box unten ist
85 
86     SfxObjectShellLock  *pxObjectShell;
87     SwView              *pContentView;
88     SwWrtShell          *pContentWrtShell;
89     SwView              *pActContView;
90     SwView              *pCreateView;
91     SfxPopupWindow      *pPopupWindow;
92     SfxPopupWindow      *pFloatingWindow;
93 
94     SfxChildWindowContext* pContextWin;
95 
96     SwNavigationConfig  *pConfig;
97     SfxBindings         &rBindings;
98 
99     long    nDocLBIniHeight;
100     long    nWishWidth;
101     sal_uInt16  nAutoMarkIdx;
102     sal_uInt16  nRegionMode; // 0 - URL, 1 - Bereich mit Link 2 - B. ohne Link
103     short   nZoomIn;
104     short   nZoomOutInit;
105     short   nZoomOut;
106 
107     sal_Bool    bSmallMode : 1;
108     sal_Bool    bIsZoomedIn : 1;
109     sal_Bool    bPageCtrlsVisible : 1;
110     sal_Bool    bGlobalMode : 1;
111 
112     // --------- methods -----------------------------
113     sal_Bool _IsZoomedIn() const {return bIsZoomedIn;}
114     void _ZoomOut();
115     void _ZoomIn();
116 
117     void FillBox();
118     void MakeMark();
119 
120     DECL_LINK( DocListBoxSelectHdl, ListBox * );
121     DECL_LINK( ToolBoxSelectHdl, ToolBox * );
122     DECL_LINK( ToolBoxClickHdl, ToolBox * );
123     DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* );
124     DECL_LINK( EditAction, NumEditAction * );
125     DECL_LINK( EditGetFocus, NumEditAction * );
126     DECL_LINK( DoneLink, SfxPoolItem * );
127     DECL_LINK( MenuSelectHdl, Menu * );
128     DECL_LINK( ChangePageHdl, Timer* );
129     DECL_LINK( PageEditModifyHdl, Edit* );
130     DECL_LINK( PopupModeEndHdl, void * );
131     DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
132     void UsePage(SwWrtShell *);
133 
134     void MakeVisible();
135     void InitImageList();
136     virtual SfxChildAlignment
137                     CheckAlignment(SfxChildAlignment,SfxChildAlignment);
138     void SetPopupWindow( SfxPopupWindow* );
139 
140     using Window::Notify;
141     using Window::StateChanged;
142 
143 protected:
144 
145     virtual         sal_Bool Close();
146     virtual         void Resize();
147     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
148 
149 
150     // zum App-Ende rechtzeitig ObjectShellLock loslassen
151     virtual void    Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
152 
153     NumEditAction&  GetPageEdit();
154     sal_Bool            ToggleTree();
155     void            SetGlobalMode(sal_Bool bSet) {bGlobalMode = bSet;}
156 
157 public:
158 
159     SwNavigationPI(SfxBindings*, SfxChildWindowContext*, Window*);
160     ~SwNavigationPI();
161 
162     void            GotoPage(); // Seite anspringen; bindbare Funktion
163 
164     void            Update() { FillBox(); }
165     void            UpdateListBox();
166     void            MoveOutline(sal_uInt16 nSource, sal_uInt16 nTarget, sal_Bool bWithCilds);
167 
168     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,
169                                             const SfxPoolItem* pState );
170 
171     static String   CreateDropFileName( TransferableDataHelper& rData );
172     static void     CleanEntry( String& rEntry );
173 
174     sal_uInt16          GetRegionDropMode() const {return nRegionMode;}
175     void            SetRegionDropMode(sal_uInt16 nNewMode);
176 
177     sal_Int8        AcceptDrop( const AcceptDropEvent& rEvt );
178     sal_Int8        ExecuteDrop( const ExecuteDropEvent& rEvt );
179 
180     sal_Bool            IsGlobalDoc() const;
181     sal_Bool            IsGlobalMode() const {return    bGlobalMode;}
182 
183     SwView*         GetCreateView() const;
184     void            CreateNavigationTool(const Rectangle& rRect, sal_Bool bSetFocus);
185 };
186 
187 class SwNavigationChild : public SfxChildWindowContext
188 {
189 public:
190     SwNavigationChild( Window* ,
191                         sal_uInt16 nId,
192                         SfxBindings*,
193                         SfxChildWinInfo*  );
194 
195     SFX_DECL_CHILDWINDOW_CONTEXT( SwNavigationChild )
196 };
197 
198 #endif
199