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