LibreOffice Module sw (master)  1
navipi.hxx
Go to the documentation of this file.
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/toolbox.hxx>
24 #include <vcl/idle.hxx>
25 #include <svl/lstner.hxx>
26 #include <vcl/transfer.hxx>
27 #include <sfx2/childwin.hxx>
28 #include <sfx2/ctrlitem.hxx>
29 #include <sfx2/tbxctrl.hxx>
31 #include "conttree.hxx"
32 #include <ndarr.hxx>
33 #include <memory>
34 
35 class SwWrtShell;
36 class SwNavigationPI;
37 class SwNavigationChild;
38 class SfxBindings;
39 class NumEditAction;
40 class SwNavigationConfig;
41 class SwScrollNaviPopup;
42 class SwView;
43 class SfxObjectShellLock;
45 enum class RegionMode;
46 class SpinField;
47 
49 {
50 private:
52 public:
53  NaviStateListener(SfxBindings& rBindings, SwNavigationPI* pNavigation);
54  virtual ~NaviStateListener() override;
55 
56  virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState,
57  const SfxPoolItem* pState) override;
58 };
59 
60 class SwNavigationPI : public PanelLayout,
61  public SfxControllerItem, public SfxListener
62 {
63  friend class SwNavigationChild;
64  friend class SwContentTree;
65  friend class SwGlobalTree;
66  friend class SwNavigationPIUIObject;
67 
69  std::unique_ptr<NaviStateListener> m_xNaviListener;
79  OUString m_aContextArr[3];
80  OUString m_aStatusArr[4];
81 
82  std::unique_ptr<SfxObjectShellLock> m_pxObjectShell;
88 
91 
92  RegionMode m_nRegionMode; // 0 - URL, 1 - region with link 2 - region without link
94 
95  bool m_bIsZoomedIn : 1;
96  bool m_bGlobalMode : 1;
97 
98  bool IsZoomedIn() const {return m_bIsZoomedIn;}
99  void ZoomOut();
100  void ZoomIn();
101 
102  void FillBox();
103 
104  DECL_LINK( DocListBoxSelectHdl, ListBox&, void );
105  DECL_LINK( ToolBoxSelectHdl, ToolBox *, void );
106  DECL_LINK( ToolBoxClickHdl, ToolBox *, void );
107  DECL_LINK( ToolBoxDropdownClickHdl, ToolBox*, void );
108  DECL_LINK( EditAction, NumEditAction&, void );
109  DECL_LINK( EditGetFocus, Control&, void );
110  DECL_LINK( DoneLink, SfxPoolItem const *, void );
111  DECL_LINK( MenuSelectHdl, Menu *, bool );
112  DECL_LINK( ChangePageHdl, Timer*, void );
113  DECL_LINK( PageEditModifyHdl, SpinField&, void );
114  void UsePage();
115 
117 
118 protected:
119 
120  // release ObjectShellLock early enough for app end
121  virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
122 
124  void ToggleTree();
125  void SetGlobalMode(bool bSet) {m_bGlobalMode = bSet;}
126 
127 public:
128 
130  virtual ~SwNavigationPI() override;
131  virtual void dispose() override;
132 
133  void UpdateListBox();
134  void MoveOutline(SwOutlineNodes::size_type nSource, SwOutlineNodes::size_type nTarget, bool bWithCilds);
135 
136  virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
137  const SfxPoolItem* pState ) override;
138 
139  virtual void StateChanged(StateChangedType nStateChange) override;
140 
141  static OUString CreateDropFileName( TransferableDataHelper& rData );
142  static OUString CleanEntry(const OUString& rEntry);
143 
145  void SetRegionDropMode(RegionMode nNewMode);
146 
148  sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt );
149 
150  bool IsGlobalDoc() const;
151  bool IsGlobalMode() const {return m_bGlobalMode;}
152 
153  SwView* GetCreateView() const;
154  void CreateNavigationTool();
155 
156  void NaviStateChanged();
157 
158  FactoryFunction GetUITestFactory() const override;
159 };
160 
162 {
163 public:
165  sal_uInt16 nId,
166  SfxBindings* );
167 
169  static std::unique_ptr<SfxChildWindowContext> CreateImpl(vcl::Window *pParent,
170  SfxBindings *pBindings, SfxChildWinInfo* pInfo );
171  static void RegisterChildWindowContext(SfxModule *pMod);
172 };
173 
174 #endif
175 
176 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwNavigationChild(vcl::Window *, sal_uInt16 nId, SfxBindings *)
Definition: navipi.cxx:1119
SwNavigationConfig * m_pConfig
Definition: navipi.hxx:89
bool IsZoomedIn() const
Definition: navipi.hxx:98
void ZoomIn()
Definition: navipi.cxx:473
void MoveOutline(SwOutlineNodes::size_type nSource, SwOutlineNodes::size_type nTarget, bool bWithCilds)
Definition: navipi.cxx:90
virtual ~SwNavigationPI() override
Definition: navipi.cxx:675
void SetRegionDropMode(RegionMode nNewMode)
Definition: navipi.cxx:1017
signed char sal_Int8
std::unique_ptr< NaviStateListener > m_xNaviListener
Definition: navipi.hxx:69
void SetGlobalMode(bool bSet)
Definition: navipi.hxx:125
static std::unique_ptr< SfxChildWindowContext > CreateImpl(vcl::Window *pParent, SfxBindings *pBindings, SfxChildWinInfo *pInfo)
soon obsolete !
Definition: navipi.cxx:57
VclPtr< ToolBox > m_aContentToolBox
Definition: navipi.hxx:68
void UsePage()
Definition: navipi.cxx:184
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
OUString m_aStatusArr[4]
Definition: navipi.hxx:80
sal_Int16 nId
sal_Int8 ExecuteDrop(const ExecuteDropEvent &rEvt)
Definition: navipi.cxx:976
SwView * m_pActContView
Definition: navipi.hxx:85
void UpdateListBox()
Definition: navipi.cxx:836
void CreateNavigationTool()
Definition: navipi.cxx:391
Used by the UI to modify the document model.
Definition: wrtsh.hxx:90
StateChangedType
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: navipi.cxx:729
TreeListBox for content indicator.
Definition: conttree.hxx:71
VclPtr< ListBox > m_aDocListBox
Definition: navipi.hxx:76
static OUString CreateDropFileName(TransferableDataHelper &rData)
Definition: navipi.cxx:928
void ToggleTree()
Definition: navipi.cxx:1038
VclPtr< VclContainer > m_aGlobalBox
Definition: navipi.hxx:74
SwWrtShell * m_pContentWrtShell
Definition: navipi.hxx:84
sal_Int8 AcceptDrop()
Definition: navipi.cxx:961
void NaviStateChanged()
Definition: navipi.cxx:1171
virtual void dispose() override
Definition: navipi.cxx:680
virtual ~NaviStateListener() override
Definition: navipi.cxx:1161
RegionMode GetRegionDropMode() const
Definition: navipi.hxx:144
bool m_bGlobalMode
Definition: navipi.hxx:96
VclPtr< ToolBox > m_aGlobalToolBox
Definition: navipi.hxx:70
static OUString CleanEntry(const OUString &rEntry)
Definition: navipi.cxx:75
RegionMode
Definition: swcont.hxx:51
bool IsGlobalMode() const
Definition: navipi.hxx:151
SwNavigationPI(SfxBindings *, vcl::Window *)
Definition: navipi.cxx:514
OUString m_sContentFileName
Definition: navipi.hxx:78
VclPtr< SwGlobalTree > m_aGlobalTree
Definition: navipi.hxx:75
VclPtr< SwScrollNaviPopup > m_xPopupWindow
Definition: navipi.hxx:87
VclPtr< SwContentTree > m_aContentTree
Definition: navipi.hxx:73
Idle m_aPageChgIdle
Definition: navipi.hxx:77
VclPtr< VclContainer > m_aContentBox
Definition: navipi.hxx:72
SwView * GetCreateView() const
Definition: navipi.cxx:1100
void SetPopupWindow(SwScrollNaviPopup *)
Definition: navipi.cxx:723
SwView * m_pCreateView
Definition: navipi.hxx:86
virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem *pState) override
Definition: navipi.cxx:1165
void ZoomOut()
Definition: navipi.cxx:439
SwView * m_pContentView
Definition: navipi.hxx:83
bool IsGlobalDoc() const
Definition: navipi.cxx:1072
static void RegisterChildWindowContext(SfxModule *pMod)
Definition: navipi.cxx:64
SfxItemState
VclPtr< SwNavigationPI > m_xNavigation
Definition: navipi.hxx:51
Size m_aExpandedSize
Definition: navipi.hxx:93
VclPtr< NumEditAction > m_xEdit
Definition: navipi.hxx:71
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: navipi.cxx:787
NumEditAction & GetPageEdit()
Definition: navipi.cxx:781
void FillBox()
Definition: navipi.cxx:159
SfxBindings & m_rBindings
Definition: navipi.hxx:90
bool m_bIsZoomedIn
Definition: navipi.hxx:95
FactoryFunction GetUITestFactory() const override
Definition: navipi.cxx:403
std::vector< SwNode * >::size_type size_type
OUString m_aContextArr[3]
Definition: navipi.hxx:79
NaviStateListener(SfxBindings &rBindings, SwNavigationPI *pNavigation)
Definition: navipi.cxx:1155
std::unique_ptr< SfxObjectShellLock > m_pxObjectShell
Definition: navipi.hxx:82
Definition: view.hxx:146
DECL_LINK(DocListBoxSelectHdl, ListBox &, void)
RegionMode m_nRegionMode
Definition: navipi.hxx:92