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_UI_INC_NAVIPI_HXX
20 : #define INCLUDED_SW_SOURCE_UI_INC_NAVIPI_HXX
21 :
22 : // INCLUDE ---------------------------------------------------------------
23 :
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>
31 : #include <popbox.hxx>
32 :
33 : class SwWrtShell;
34 : class SwNavigationPI;
35 : class SwNavigationChild;
36 : class SfxBindings;
37 : class NumEditAction;
38 : class SwView;
39 : class SwNavigationConfig;
40 : class SfxObjectShellLock;
41 : class SfxChildWindowContext;
42 : class SwNavigationPI;
43 :
44 0 : class SwNavHelpToolBox : public SwHelpToolBox
45 : {
46 : virtual void MouseButtonDown(const MouseEvent &rEvt) SAL_OVERRIDE;
47 : virtual void RequestHelp( const HelpEvent& rHEvt ) SAL_OVERRIDE;
48 : public:
49 : SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId);
50 : };
51 :
52 : // CLASS -----------------------------------------------------------------
53 : class SwNavigationPI : public Window,
54 : public SfxControllerItem, public SfxListener
55 : {
56 : friend class SwNavigationChild;
57 : friend class SwContentTree;
58 : friend class SwGlobalTree;
59 :
60 : // --------- members -----------------------------
61 : SwNavHelpToolBox aContentToolBox;
62 : SwHelpToolBox aGlobalToolBox;
63 : ImageList aContentImageList;
64 : SwContentTree aContentTree;
65 : SwGlobalTree aGlobalTree;
66 : ListBox aDocListBox;
67 : Timer aPageChgTimer;
68 : OUString sContentFileName;
69 : OUString aContextArr[3];
70 : OUString aStatusArr[4];
71 : Point aBoxBottomLeft; // Pos when Box is at bottom
72 :
73 : SfxObjectShellLock *pxObjectShell;
74 : SwView *pContentView;
75 : SwWrtShell *pContentWrtShell;
76 : SwView *pActContView;
77 : SwView *pCreateView;
78 : SfxPopupWindow *pPopupWindow;
79 : SfxPopupWindow *pFloatingWindow;
80 :
81 : SfxChildWindowContext* pContextWin;
82 :
83 : SwNavigationConfig *pConfig;
84 : SfxBindings &rBindings;
85 :
86 : long nDocLBIniHeight;
87 : long nWishWidth;
88 : sal_uInt16 nAutoMarkIdx;
89 : sal_uInt16 nRegionMode; // 0 - URL, 1 - region with link 2 - region without link
90 : short nZoomIn;
91 : short nZoomOutInit;
92 : short nZoomOut;
93 :
94 : sal_Bool bSmallMode : 1;
95 : sal_Bool bIsZoomedIn : 1;
96 : sal_Bool bPageCtrlsVisible : 1;
97 : sal_Bool bGlobalMode : 1;
98 :
99 : // --------- methods -----------------------------
100 0 : sal_Bool _IsZoomedIn() const {return bIsZoomedIn;}
101 : void _ZoomOut();
102 : void _ZoomIn();
103 :
104 : void FillBox();
105 : void MakeMark();
106 :
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 *);
120 :
121 : void MakeVisible();
122 : void InitImageList();
123 : virtual SfxChildAlignment
124 : CheckAlignment(SfxChildAlignment,SfxChildAlignment);
125 : void SetPopupWindow( SfxPopupWindow* );
126 :
127 : using Window::Notify;
128 : using Window::StateChanged;
129 :
130 : protected:
131 :
132 : virtual sal_Bool Close();
133 : virtual void Resize() SAL_OVERRIDE;
134 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
135 :
136 : // release ObjectShellLock early enough for app end
137 : virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) SAL_OVERRIDE;
138 :
139 : NumEditAction& GetPageEdit();
140 : sal_Bool ToggleTree();
141 0 : void SetGlobalMode(sal_Bool bSet) {bGlobalMode = bSet;}
142 :
143 : public:
144 :
145 : SwNavigationPI(SfxBindings*, SfxChildWindowContext*, Window*);
146 : virtual ~SwNavigationPI();
147 :
148 : void GotoPage(); // jump to page; bindable function
149 :
150 : void Update() { FillBox(); }
151 : void UpdateListBox();
152 : void MoveOutline(sal_uInt16 nSource, sal_uInt16 nTarget, bool bWithCilds);
153 :
154 : virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
155 : const SfxPoolItem* pState ) SAL_OVERRIDE;
156 :
157 : static OUString CreateDropFileName( TransferableDataHelper& rData );
158 : static OUString CleanEntry(const OUString& rEntry);
159 :
160 0 : sal_uInt16 GetRegionDropMode() const {return nRegionMode;}
161 : void SetRegionDropMode(sal_uInt16 nNewMode);
162 :
163 : sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt );
164 : sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
165 :
166 : sal_Bool IsGlobalDoc() const;
167 0 : sal_Bool IsGlobalMode() const {return bGlobalMode;}
168 :
169 : SwView* GetCreateView() const;
170 : void CreateNavigationTool(const Rectangle& rRect, bool bSetFocus, Window *pParent);
171 : };
172 :
173 0 : class SwNavigationChild : public SfxChildWindowContext
174 : {
175 : public:
176 : SwNavigationChild( Window* ,
177 : sal_uInt16 nId,
178 : SfxBindings*,
179 : SfxChildWinInfo* );
180 :
181 : SFX_DECL_CHILDWINDOW_CONTEXT( SwNavigationChild )
182 : };
183 :
184 : #endif
185 :
186 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|