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