Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_SW_SOURCE_UIBASE_INC_NAVIPI_HXX
20 : #define INCLUDED_SW_SOURCE_UIBASE_INC_NAVIPI_HXX
21 :
22 : #include <vcl/lstbox.hxx>
23 : #include <svl/lstner.hxx>
24 : #include <svtools/transfer.hxx>
25 : #include <sfx2/childwin.hxx>
26 : #include <sfx2/ctrlitem.hxx>
27 : #include <sfx2/tbxctrl.hxx>
28 : #include <conttree.hxx>
29 : #include <popbox.hxx>
30 :
31 : class SwWrtShell;
32 : class SwNavigationPI;
33 : class SwNavigationChild;
34 : class SfxBindings;
35 : class NumEditAction;
36 : class SwView;
37 : class SwNavigationConfig;
38 : class SfxObjectShellLock;
39 : class SfxChildWindowContext;
40 : class SwNavigationPI;
41 :
42 120 : class SwNavHelpToolBox : public SwHelpToolBox
43 : {
44 : virtual void MouseButtonDown(const MouseEvent &rEvt) SAL_OVERRIDE;
45 : virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
46 : public:
47 : SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId);
48 : };
49 :
50 : class SwNavigationPI : public vcl::Window,
51 : public SfxControllerItem, public SfxListener
52 : {
53 : friend class SwNavigationChild;
54 : friend class SwContentTree;
55 : friend class SwGlobalTree;
56 :
57 : SwNavHelpToolBox aContentToolBox;
58 : SwHelpToolBox aGlobalToolBox;
59 : ImageList aContentImageList;
60 : SwContentTree aContentTree;
61 : SwGlobalTree aGlobalTree;
62 : ListBox aDocListBox;
63 : Timer aPageChgTimer;
64 : OUString sContentFileName;
65 : OUString aContextArr[3];
66 : OUString aStatusArr[4];
67 : Point aBoxBottomLeft; // Pos when Box is at bottom
68 :
69 : SfxObjectShellLock *pxObjectShell;
70 : SwView *pContentView;
71 : SwWrtShell *pContentWrtShell;
72 : SwView *pActContView;
73 : SwView *pCreateView;
74 : SfxPopupWindow *pPopupWindow;
75 : SfxPopupWindow *pFloatingWindow;
76 :
77 : SfxChildWindowContext* pContextWin;
78 :
79 : SwNavigationConfig *pConfig;
80 : SfxBindings &rBindings;
81 :
82 : long nDocLBIniHeight;
83 : long nWishWidth;
84 : sal_uInt16 nAutoMarkIdx;
85 : sal_uInt16 nRegionMode; // 0 - URL, 1 - region with link 2 - region without link
86 : short nZoomIn;
87 : short nZoomOutInit;
88 : short nZoomOut;
89 :
90 : bool bSmallMode : 1;
91 : bool bIsZoomedIn : 1;
92 : bool bPageCtrlsVisible : 1;
93 : bool bGlobalMode : 1;
94 :
95 304 : bool _IsZoomedIn() const {return bIsZoomedIn;}
96 : void _ZoomOut();
97 : void _ZoomIn();
98 :
99 : void FillBox();
100 : void MakeMark();
101 :
102 : DECL_LINK( DocListBoxSelectHdl, ListBox * );
103 : DECL_LINK( ToolBoxSelectHdl, ToolBox * );
104 : DECL_LINK( ToolBoxClickHdl, ToolBox * );
105 : DECL_LINK( ToolBoxDropdownClickHdl, ToolBox* );
106 : DECL_LINK( EditAction, NumEditAction * );
107 : DECL_LINK( EditGetFocus, NumEditAction * );
108 : DECL_LINK( DoneLink, SfxPoolItem * );
109 : DECL_LINK( MenuSelectHdl, Menu * );
110 : DECL_LINK( ChangePageHdl, void* );
111 : DECL_LINK( PageEditModifyHdl, void* );
112 : DECL_LINK( PopupModeEndHdl, void * );
113 : DECL_LINK( ClosePopupWindow, SfxPopupWindow * );
114 : void UsePage(SwWrtShell *);
115 :
116 : void MakeVisible();
117 : void InitImageList();
118 : virtual SfxChildAlignment
119 : CheckAlignment(SfxChildAlignment,SfxChildAlignment);
120 : void SetPopupWindow( SfxPopupWindow* );
121 :
122 : using Window::Notify;
123 : using Window::StateChanged;
124 :
125 : protected:
126 :
127 : virtual bool Close();
128 : virtual void Resize() SAL_OVERRIDE;
129 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
130 :
131 : // release ObjectShellLock early enough for app end
132 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
133 :
134 : NumEditAction& GetPageEdit();
135 : bool ToggleTree();
136 62 : void SetGlobalMode(bool bSet) {bGlobalMode = bSet;}
137 :
138 : public:
139 :
140 : SwNavigationPI(SfxBindings*, SfxChildWindowContext*, vcl::Window*);
141 : virtual ~SwNavigationPI();
142 :
143 : void GotoPage(); // jump to page; bindable function
144 :
145 : void Update() { FillBox(); }
146 : void UpdateListBox();
147 : void MoveOutline(sal_uInt16 nSource, sal_uInt16 nTarget, bool bWithCilds);
148 :
149 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
150 : const SfxPoolItem* pState ) SAL_OVERRIDE;
151 :
152 : static OUString CreateDropFileName( TransferableDataHelper& rData );
153 : static OUString CleanEntry(const OUString& rEntry);
154 :
155 0 : sal_uInt16 GetRegionDropMode() const {return nRegionMode;}
156 : void SetRegionDropMode(sal_uInt16 nNewMode);
157 :
158 : sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
159 : sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
160 :
161 : bool IsGlobalDoc() const;
162 186 : bool IsGlobalMode() const {return bGlobalMode;}
163 :
164 : SwView* GetCreateView() const;
165 : void CreateNavigationTool(const Rectangle& rRect, bool bSetFocus, vcl::Window *pParent);
166 : };
167 :
168 236 : class SwNavigationChild : public SfxChildWindowContext
169 : {
170 : public:
171 : SwNavigationChild( vcl::Window* ,
172 : sal_uInt16 nId,
173 : SfxBindings*,
174 : SfxChildWinInfo* );
175 :
176 : SFX_DECL_CHILDWINDOW_CONTEXT( SwNavigationChild )
177 : };
178 :
179 : #endif
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|