1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 // INCLUDE ---------------------------------------------------------------
24 #include <vcl/lstbox.hxx>
25 #include <svl/lstner.hxx>
26 #include <svtools/transfer.hxx>
27 #include <sfx2/childwin.hxx>
28 #include <sfx2/ctrlitem.hxx>
29 #include <sfx2/tbxctrl.hxx>
30 #include <conttree.hxx>
35 class SwNavigationChild
;
39 class SwNavigationConfig
;
40 class SfxObjectShellLock
;
41 class SfxChildWindowContext
;
44 class SwNavHelpToolBox
: public SwHelpToolBox
46 virtual void MouseButtonDown(const MouseEvent
&rEvt
);
47 virtual void RequestHelp( const HelpEvent
& rHEvt
);
49 SwNavHelpToolBox(SwNavigationPI
* pParent
, const ResId
&rResId
);
52 // CLASS -----------------------------------------------------------------
53 class SwNavigationPI
: public Window
,
54 public SfxControllerItem
, public SfxListener
56 friend class SwNavigationChild
;
57 friend class SwContentTree
;
58 friend class SwGlobalTree
;
60 // --------- members -----------------------------
61 SwNavHelpToolBox aContentToolBox
;
62 SwHelpToolBox aGlobalToolBox
;
63 ImageList aContentImageList
;
64 SwContentTree aContentTree
;
65 SwGlobalTree aGlobalTree
;
68 String sContentFileName
;
69 String aContextArr
[3];
71 Point aBoxBottomLeft
; // Pos when Box is at bottom
73 SfxObjectShellLock
*pxObjectShell
;
75 SwWrtShell
*pContentWrtShell
;
78 SfxPopupWindow
*pPopupWindow
;
79 SfxPopupWindow
*pFloatingWindow
;
81 SfxChildWindowContext
* pContextWin
;
83 SwNavigationConfig
*pConfig
;
84 SfxBindings
&rBindings
;
88 sal_uInt16 nAutoMarkIdx
;
89 sal_uInt16 nRegionMode
; // 0 - URL, 1 - region with link 2 - region without link
94 sal_Bool bSmallMode
: 1;
95 sal_Bool bIsZoomedIn
: 1;
96 sal_Bool bPageCtrlsVisible
: 1;
97 sal_Bool bGlobalMode
: 1;
99 // --------- methods -----------------------------
100 sal_Bool
_IsZoomedIn() const {return bIsZoomedIn
;}
107 DECL_LINK( DocListBoxSelectHdl
, ListBox
* );
108 DECL_LINK( ToolBoxSelectHdl
, ToolBox
* );
109 DECL_LINK( ToolBoxClickHdl
, ToolBox
* );
110 DECL_LINK( ToolBoxDropdownClickHdl
, ToolBox
* );
111 DECL_LINK( EditAction
, NumEditAction
* );
112 DECL_LINK( EditGetFocus
, NumEditAction
* );
113 DECL_LINK( DoneLink
, SfxPoolItem
* );
114 DECL_LINK( MenuSelectHdl
, Menu
* );
115 DECL_LINK( ChangePageHdl
, void* );
116 DECL_LINK( PageEditModifyHdl
, void* );
117 DECL_LINK( PopupModeEndHdl
, void * );
118 DECL_LINK( ClosePopupWindow
, SfxPopupWindow
* );
119 void UsePage(SwWrtShell
*);
122 void InitImageList();
123 virtual SfxChildAlignment
124 CheckAlignment(SfxChildAlignment
,SfxChildAlignment
);
125 void SetPopupWindow( SfxPopupWindow
* );
127 using Window::Notify
;
128 using Window::StateChanged
;
132 virtual sal_Bool
Close();
133 virtual void Resize();
134 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
137 // release ObjectShellLock early enough for app end
138 virtual void Notify( SfxBroadcaster
& rBC
, const SfxHint
& rHint
);
140 NumEditAction
& GetPageEdit();
141 sal_Bool
ToggleTree();
142 void SetGlobalMode(sal_Bool bSet
) {bGlobalMode
= bSet
;}
146 SwNavigationPI(SfxBindings
*, SfxChildWindowContext
*, Window
*);
149 void GotoPage(); // jump to page; bindable function
151 void Update() { FillBox(); }
152 void UpdateListBox();
153 void MoveOutline(sal_uInt16 nSource
, sal_uInt16 nTarget
, bool bWithCilds
);
155 virtual void StateChanged( sal_uInt16 nSID
, SfxItemState eState
,
156 const SfxPoolItem
* pState
);
158 static String
CreateDropFileName( TransferableDataHelper
& rData
);
159 static void CleanEntry( String
& rEntry
);
161 sal_uInt16
GetRegionDropMode() const {return nRegionMode
;}
162 void SetRegionDropMode(sal_uInt16 nNewMode
);
164 sal_Int8
AcceptDrop( const AcceptDropEvent
& rEvt
);
165 sal_Int8
ExecuteDrop( const ExecuteDropEvent
& rEvt
);
167 sal_Bool
IsGlobalDoc() const;
168 sal_Bool
IsGlobalMode() const {return bGlobalMode
;}
170 SwView
* GetCreateView() const;
171 void CreateNavigationTool(const Rectangle
& rRect
, bool bSetFocus
);
174 class SwNavigationChild
: public SfxChildWindowContext
177 SwNavigationChild( Window
* ,
182 SFX_DECL_CHILDWINDOW_CONTEXT( SwNavigationChild
)
187 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */