1efeef26fSAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3efeef26fSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4efeef26fSAndrew Rist * or more contributor license agreements. See the NOTICE file
5efeef26fSAndrew Rist * distributed with this work for additional information
6efeef26fSAndrew Rist * regarding copyright ownership. The ASF licenses this file
7efeef26fSAndrew Rist * to you under the Apache License, Version 2.0 (the
8efeef26fSAndrew Rist * "License"); you may not use this file except in compliance
9efeef26fSAndrew Rist * with the License. You may obtain a copy of the License at
10efeef26fSAndrew Rist *
11efeef26fSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12efeef26fSAndrew Rist *
13efeef26fSAndrew Rist * Unless required by applicable law or agreed to in writing,
14efeef26fSAndrew Rist * software distributed under the License is distributed on an
15efeef26fSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16efeef26fSAndrew Rist * KIND, either express or implied. See the License for the
17efeef26fSAndrew Rist * specific language governing permissions and limitations
18efeef26fSAndrew Rist * under the License.
19efeef26fSAndrew Rist *
20efeef26fSAndrew Rist *************************************************************/
21efeef26fSAndrew Rist
22efeef26fSAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sw.hxx"
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir #define NAVIPI_CXX
30cdf0e10cSrcweir
31cdf0e10cSrcweir #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
32cdf0e10cSrcweir #include <tools/list.hxx>
33cdf0e10cSrcweir #include <svl/urlbmk.hxx>
34cdf0e10cSrcweir #include <svl/stritem.hxx>
35cdf0e10cSrcweir #include <svtools/filter.hxx>
36cdf0e10cSrcweir #include <svl/urihelper.hxx>
37cdf0e10cSrcweir #include <sot/formats.hxx>
38cdf0e10cSrcweir #include <sot/filelist.hxx>
39cdf0e10cSrcweir #include <sfx2/event.hxx>
40cdf0e10cSrcweir #include <sfx2/imgmgr.hxx>
41cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
42cdf0e10cSrcweir #include <sfx2/dockwin.hxx>
43cdf0e10cSrcweir #include <vcl/toolbox.hxx>
44cdf0e10cSrcweir #include <swtypes.hxx> // fuer Pathfinder
45cdf0e10cSrcweir #include <errhdl.hxx>
46cdf0e10cSrcweir #include <swmodule.hxx>
47cdf0e10cSrcweir #ifndef _VIEW_HXX
48cdf0e10cSrcweir #include <view.hxx>
49cdf0e10cSrcweir #endif
50cdf0e10cSrcweir #include <navicfg.hxx>
51cdf0e10cSrcweir #include <wrtsh.hxx>
52cdf0e10cSrcweir #ifndef _DOCSH_HXX
53cdf0e10cSrcweir #include <docsh.hxx>
54cdf0e10cSrcweir #endif
55cdf0e10cSrcweir #include <actctrl.hxx>
56cdf0e10cSrcweir #include <IMark.hxx>
57cdf0e10cSrcweir #include <navipi.hxx>
58cdf0e10cSrcweir #include <content.hxx>
59cdf0e10cSrcweir #include <workctrl.hxx>
60cdf0e10cSrcweir #include <section.hxx>
61cdf0e10cSrcweir #include <edtwin.hxx>
62cdf0e10cSrcweir #include <sfx2/app.hxx>
63cdf0e10cSrcweir #ifndef _CMDID_H
64cdf0e10cSrcweir #include <cmdid.h>
65cdf0e10cSrcweir #endif
66cdf0e10cSrcweir #ifndef _HELPID_H
67cdf0e10cSrcweir #include <helpid.h>
68cdf0e10cSrcweir #endif
69cdf0e10cSrcweir #ifndef _RIBBAR_HRC
70cdf0e10cSrcweir #include <ribbar.hrc>
71cdf0e10cSrcweir #endif
72cdf0e10cSrcweir #ifndef _NAVIPI_HRC
73cdf0e10cSrcweir #include <navipi.hrc>
74cdf0e10cSrcweir #endif
75cdf0e10cSrcweir #ifndef _UTLUI_HRC
76cdf0e10cSrcweir #include <utlui.hrc>
77cdf0e10cSrcweir #endif
78cdf0e10cSrcweir
79cdf0e10cSrcweir #include "access.hrc"
80cdf0e10cSrcweir
81cdf0e10cSrcweir #include <unomid.h>
82cdf0e10cSrcweir
83cdf0e10cSrcweir
84cdf0e10cSrcweir #define PAGE_CHANGE_TIMEOUT 1000 //Timeout fuer Seitenwechsel
85cdf0e10cSrcweir
86cdf0e10cSrcweir #define JUMP_TYPE_TBL 0
87cdf0e10cSrcweir #define JUMP_TYPE_FRM 1
88cdf0e10cSrcweir #define JUMP_TYPE_GRF 2
89cdf0e10cSrcweir #define JUMP_TYPE_REG 3
90cdf0e10cSrcweir #define JUMP_TYPE_BKM 4
91cdf0e10cSrcweir
92cdf0e10cSrcweir // Version fuer Konfiguration
93cdf0e10cSrcweir
94cdf0e10cSrcweir #define NAVI_VERSION0 0
95cdf0e10cSrcweir #define NAVI_VERSION1 1
96cdf0e10cSrcweir #define NAVI_VERSION2 2 // bIsGlobalActive
97cdf0e10cSrcweir
98cdf0e10cSrcweir #define NAVI_CONFIG_VERSION NAVI_VERSION2
99cdf0e10cSrcweir
100cdf0e10cSrcweir using namespace ::com::sun::star::uno;
101cdf0e10cSrcweir using namespace ::com::sun::star::frame;
102cdf0e10cSrcweir
SFX_IMPL_CHILDWINDOW_CONTEXT(SwNavigationChild,SID_NAVIGATOR,SwView)103cdf0e10cSrcweir SFX_IMPL_CHILDWINDOW_CONTEXT( SwNavigationChild, SID_NAVIGATOR, SwView )
104cdf0e10cSrcweir
105cdf0e10cSrcweir /*------------------------------------------------------------------------
106cdf0e10cSrcweir Bechreibung: Steuerzeichen aus dem Outline-Entry filtern
107cdf0e10cSrcweir ------------------------------------------------------------------------*/
108cdf0e10cSrcweir
109cdf0e10cSrcweir void SwNavigationPI::CleanEntry( String& rEntry )
110cdf0e10cSrcweir {
111cdf0e10cSrcweir sal_uInt16 i = rEntry.Len();
112cdf0e10cSrcweir if( i )
113cdf0e10cSrcweir for( sal_Unicode* pStr = rEntry.GetBufferAccess(); i; --i, ++pStr )
114cdf0e10cSrcweir if( *pStr == 10 || *pStr == 9 )
115cdf0e10cSrcweir *pStr = 0x20;
116cdf0e10cSrcweir }
117cdf0e10cSrcweir /*------------------------------------------------------------------------
118cdf0e10cSrcweir Beschreibung: Ausfuehrung der Drag-Operation
119cdf0e10cSrcweir mit und ohne Childs
120cdf0e10cSrcweir ------------------------------------------------------------------------*/
121cdf0e10cSrcweir
MoveOutline(sal_uInt16 nSource,sal_uInt16 nTarget,sal_Bool bWithChilds)122cdf0e10cSrcweir void SwNavigationPI::MoveOutline(sal_uInt16 nSource, sal_uInt16 nTarget,
123cdf0e10cSrcweir sal_Bool bWithChilds)
124cdf0e10cSrcweir {
125cdf0e10cSrcweir SwView *pView = GetCreateView();
126cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell();
127cdf0e10cSrcweir if(nTarget < nSource || nTarget == USHRT_MAX)
128cdf0e10cSrcweir nTarget ++;
129cdf0e10cSrcweir if ( rSh.IsOutlineMovable( nSource ))
130cdf0e10cSrcweir {
131cdf0e10cSrcweir
132cdf0e10cSrcweir short nMove = nTarget-nSource; //( nDir<0 ) ? 1 : 0 ;
133cdf0e10cSrcweir rSh.GotoOutline(nSource);
134cdf0e10cSrcweir if (bWithChilds)
135cdf0e10cSrcweir rSh.MakeOutlineSel(nSource, nSource, sal_True);
136cdf0e10cSrcweir // Die selektierten Children zaehlen bei der Bewegung vorwaerts nicht mit
137cdf0e10cSrcweir sal_uInt16 nLastOutlinePos = rSh.GetOutlinePos(MAXLEVEL);
138cdf0e10cSrcweir if(bWithChilds && nMove > 1 &&
139cdf0e10cSrcweir nLastOutlinePos < nTarget)
140cdf0e10cSrcweir {
141cdf0e10cSrcweir if(!rSh.IsCrsrPtAtEnd())
142cdf0e10cSrcweir rSh.SwapPam();
143cdf0e10cSrcweir nMove -= nLastOutlinePos - nSource;
144cdf0e10cSrcweir }
145cdf0e10cSrcweir if(!bWithChilds || nMove < 1 || nLastOutlinePos < nTarget )
146cdf0e10cSrcweir rSh.MoveOutlinePara( nMove );
147cdf0e10cSrcweir rSh.ClearMark();
148cdf0e10cSrcweir rSh.GotoOutline( nSource + nMove);
149cdf0e10cSrcweir FillBox();
150cdf0e10cSrcweir }
151cdf0e10cSrcweir
152cdf0e10cSrcweir }
153cdf0e10cSrcweir
154cdf0e10cSrcweir
155cdf0e10cSrcweir /*------------------------------------------------------------------------
156cdf0e10cSrcweir Beschreibung: Nach Goto einen Status Rahmenselektion aufheben
157cdf0e10cSrcweir ------------------------------------------------------------------------*/
158cdf0e10cSrcweir
159cdf0e10cSrcweir
lcl_UnSelectFrm(SwWrtShell * pSh)160cdf0e10cSrcweir void lcl_UnSelectFrm(SwWrtShell *pSh)
161cdf0e10cSrcweir {
162cdf0e10cSrcweir if (pSh->IsFrmSelected())
163cdf0e10cSrcweir {
164cdf0e10cSrcweir pSh->UnSelectFrm();
165cdf0e10cSrcweir pSh->LeaveSelFrmMode();
166cdf0e10cSrcweir }
167cdf0e10cSrcweir }
168cdf0e10cSrcweir
169cdf0e10cSrcweir /*------------------------------------------------------------------------
170cdf0e10cSrcweir Beschreibung: Select der Documentanzeige
171cdf0e10cSrcweir ------------------------------------------------------------------------*/
172cdf0e10cSrcweir
173cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,DocListBoxSelectHdl,ListBox *,pBox)174cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, DocListBoxSelectHdl, ListBox *, pBox )
175cdf0e10cSrcweir {
176cdf0e10cSrcweir int nEntryIdx = pBox->GetSelectEntryPos();
177cdf0e10cSrcweir SwView *pView ;
178cdf0e10cSrcweir pView = SwModule::GetFirstView();
179cdf0e10cSrcweir while (nEntryIdx-- && pView)
180cdf0e10cSrcweir {
181cdf0e10cSrcweir pView = SwModule::GetNextView(pView);
182cdf0e10cSrcweir }
183cdf0e10cSrcweir if(!pView)
184cdf0e10cSrcweir {
185cdf0e10cSrcweir nEntryIdx == 0 ?
186cdf0e10cSrcweir aContentTree.ShowHiddenShell():
187cdf0e10cSrcweir aContentTree.ShowActualView();
188cdf0e10cSrcweir
189cdf0e10cSrcweir
190cdf0e10cSrcweir }
191cdf0e10cSrcweir else
192cdf0e10cSrcweir {
193cdf0e10cSrcweir aContentTree.SetConstantShell(pView->GetWrtShellPtr());
194cdf0e10cSrcweir }
195cdf0e10cSrcweir return 0;
196cdf0e10cSrcweir }
197cdf0e10cSrcweir
198cdf0e10cSrcweir /*------------------------------------------------------------------------
199cdf0e10cSrcweir Beschreibung: Fuellen der ListBox fuer Outline Sicht oder Dokumente
200cdf0e10cSrcweir Der PI wird auf volle Groesse gesetzt
201cdf0e10cSrcweir ------------------------------------------------------------------------*/
202cdf0e10cSrcweir
203cdf0e10cSrcweir
FillBox()204cdf0e10cSrcweir void SwNavigationPI::FillBox()
205cdf0e10cSrcweir {
206cdf0e10cSrcweir if(pContentWrtShell)
207cdf0e10cSrcweir {
208cdf0e10cSrcweir aContentTree.SetHiddenShell( pContentWrtShell );
209cdf0e10cSrcweir aContentTree.Display( sal_False );
210cdf0e10cSrcweir }
211cdf0e10cSrcweir else
212cdf0e10cSrcweir {
213cdf0e10cSrcweir SwView *pView = GetCreateView();
214cdf0e10cSrcweir if(!pView)
215cdf0e10cSrcweir {
216cdf0e10cSrcweir aContentTree.SetActiveShell(0);
217cdf0e10cSrcweir }
218cdf0e10cSrcweir else if( pView != pActContView)
219cdf0e10cSrcweir {
220cdf0e10cSrcweir SwWrtShell* pWrtShell = pView->GetWrtShellPtr();
221cdf0e10cSrcweir aContentTree.SetActiveShell(pWrtShell);
222cdf0e10cSrcweir }
223cdf0e10cSrcweir else
224cdf0e10cSrcweir aContentTree.Display( sal_True );
225cdf0e10cSrcweir pActContView = pView;
226cdf0e10cSrcweir }
227cdf0e10cSrcweir }
228cdf0e10cSrcweir
229cdf0e10cSrcweir
UsePage(SwWrtShell * pSh)230cdf0e10cSrcweir void SwNavigationPI::UsePage(SwWrtShell *pSh)
231cdf0e10cSrcweir {
232cdf0e10cSrcweir if (!pSh)
233cdf0e10cSrcweir {
234cdf0e10cSrcweir SwView *pView = GetCreateView();
235cdf0e10cSrcweir pSh = pView ? &pView->GetWrtShell() : 0;
236cdf0e10cSrcweir GetPageEdit().SetValue(1);
237cdf0e10cSrcweir }
238cdf0e10cSrcweir if (pSh)
239cdf0e10cSrcweir {
240cdf0e10cSrcweir const sal_uInt16 nPageCnt = pSh->GetPageCnt();
241cdf0e10cSrcweir sal_uInt16 nPhyPage, nVirPage;
242cdf0e10cSrcweir pSh->GetPageNum(nPhyPage, nVirPage);
243cdf0e10cSrcweir
244cdf0e10cSrcweir GetPageEdit().SetMax(nPageCnt);
245cdf0e10cSrcweir GetPageEdit().SetLast(nPageCnt);
246cdf0e10cSrcweir GetPageEdit().SetValue(nPhyPage);
247cdf0e10cSrcweir }
248cdf0e10cSrcweir }
249cdf0e10cSrcweir
250cdf0e10cSrcweir /*------------------------------------------------------------------------
251cdf0e10cSrcweir Beschreibung: SelectHandler der Toolboxen
252cdf0e10cSrcweir ------------------------------------------------------------------------*/
253cdf0e10cSrcweir
254cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,ToolBoxSelectHdl,ToolBox *,pBox)255cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox )
256cdf0e10cSrcweir {
257cdf0e10cSrcweir const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
258cdf0e10cSrcweir SwView *pView = GetCreateView();
259cdf0e10cSrcweir if (!pView)
260cdf0e10cSrcweir return 1;
261cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell();
262cdf0e10cSrcweir //MouseModifier fuer Outline-Move besorgen
263cdf0e10cSrcweir
264cdf0e10cSrcweir //Standard: Unterebenen werden mitgenommen
265cdf0e10cSrcweir // mit Ctrl Unterebenen nicht mitnehmen
266cdf0e10cSrcweir sal_Bool bOutlineWithChilds = ( KEY_MOD1 != pBox->GetModifier());
267cdf0e10cSrcweir int nFuncId = 0;
268cdf0e10cSrcweir sal_Bool bFocusToDoc = sal_False;
269cdf0e10cSrcweir switch (nCurrItemId)
270cdf0e10cSrcweir {
271cdf0e10cSrcweir case FN_UP:
272cdf0e10cSrcweir case FN_DOWN:
273cdf0e10cSrcweir {
274cdf0e10cSrcweir // #i75416# move the execution of the search to an asynchronously called static link
275cdf0e10cSrcweir bool* pbNext = new bool( FN_DOWN == nCurrItemId );
276cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK(pView, SwView, MoveNavigationHdl), pbNext );
277cdf0e10cSrcweir }
278cdf0e10cSrcweir break;
279cdf0e10cSrcweir case FN_SHOW_ROOT:
280cdf0e10cSrcweir {
281cdf0e10cSrcweir aContentTree.ToggleToRoot();
282cdf0e10cSrcweir }
283cdf0e10cSrcweir break;
284cdf0e10cSrcweir case FN_SHOW_CONTENT_BOX:
285cdf0e10cSrcweir case FN_SELECT_CONTENT:
286b7d08b69SAndre Fischer if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL)
287b7d08b69SAndre Fischer {
288b7d08b69SAndre Fischer if(_IsZoomedIn() )
289b7d08b69SAndre Fischer {
290b7d08b69SAndre Fischer _ZoomOut();
291b7d08b69SAndre Fischer }
292b7d08b69SAndre Fischer else
293b7d08b69SAndre Fischer {
294b7d08b69SAndre Fischer _ZoomIn();
295b7d08b69SAndre Fischer }
296b7d08b69SAndre Fischer }
297b7d08b69SAndre Fischer return sal_True;
298cdf0e10cSrcweir //break;
299cdf0e10cSrcweir // Funktionen, die eine direkte Aktion ausloesen
300cdf0e10cSrcweir
301cdf0e10cSrcweir case FN_SELECT_FOOTER:
302cdf0e10cSrcweir {
303cdf0e10cSrcweir rSh.MoveCrsr();
304cdf0e10cSrcweir const sal_uInt16 eType = rSh.GetFrmType(0,sal_False);
305cdf0e10cSrcweir if (eType & FRMTYPE_FOOTER)
306cdf0e10cSrcweir {
307cdf0e10cSrcweir if (rSh.EndPg())
308cdf0e10cSrcweir nFuncId = FN_END_OF_PAGE;
309cdf0e10cSrcweir }
310cdf0e10cSrcweir else if (rSh.GotoFooterTxt())
311cdf0e10cSrcweir nFuncId = FN_TO_FOOTER;
312cdf0e10cSrcweir bFocusToDoc = sal_True;
313cdf0e10cSrcweir }
314cdf0e10cSrcweir break;
315cdf0e10cSrcweir case FN_SELECT_HEADER:
316cdf0e10cSrcweir {
317cdf0e10cSrcweir rSh.MoveCrsr();
318cdf0e10cSrcweir const sal_uInt16 eType = rSh.GetFrmType(0,sal_False);
319cdf0e10cSrcweir if (eType & FRMTYPE_HEADER)
320cdf0e10cSrcweir {
321cdf0e10cSrcweir if (rSh.SttPg())
322cdf0e10cSrcweir nFuncId = FN_START_OF_PAGE;
323cdf0e10cSrcweir }
324cdf0e10cSrcweir else if (rSh.GotoHeaderTxt())
325cdf0e10cSrcweir nFuncId = FN_TO_HEADER;
326cdf0e10cSrcweir bFocusToDoc = sal_True;
327cdf0e10cSrcweir }
328cdf0e10cSrcweir break;
329cdf0e10cSrcweir case FN_SELECT_FOOTNOTE:
330cdf0e10cSrcweir {
331cdf0e10cSrcweir rSh.MoveCrsr();
332cdf0e10cSrcweir const sal_uInt16 eFrmType = rSh.GetFrmType(0,sal_False);
333cdf0e10cSrcweir // aus Fussnote zum Anker springen
334cdf0e10cSrcweir if (eFrmType & FRMTYPE_FOOTNOTE)
335cdf0e10cSrcweir {
336cdf0e10cSrcweir if (rSh.GotoFtnAnchor())
337cdf0e10cSrcweir nFuncId = FN_FOOTNOTE_TO_ANCHOR;
338cdf0e10cSrcweir }
339cdf0e10cSrcweir // andernfalls zuerst zum Fussnotentext springen; geht
340cdf0e10cSrcweir // dies nicht, zur naechten Fussnote; geht auch dies
341cdf0e10cSrcweir // nicht, zur vorhergehenden Fussnote
342cdf0e10cSrcweir else
343cdf0e10cSrcweir {
344cdf0e10cSrcweir if (rSh.GotoFtnTxt())
345cdf0e10cSrcweir nFuncId = FN_FOOTNOTE_TO_ANCHOR;
346cdf0e10cSrcweir else if (rSh.GotoNextFtnAnchor())
347cdf0e10cSrcweir nFuncId = FN_NEXT_FOOTNOTE;
348cdf0e10cSrcweir else if (rSh.GotoPrevFtnAnchor())
349cdf0e10cSrcweir nFuncId = FN_PREV_FOOTNOTE;
350cdf0e10cSrcweir }
351cdf0e10cSrcweir bFocusToDoc = sal_True;
352cdf0e10cSrcweir }
353cdf0e10cSrcweir break;
354cdf0e10cSrcweir
355cdf0e10cSrcweir case FN_SELECT_SET_AUTO_BOOKMARK:
356cdf0e10cSrcweir MakeMark();
357cdf0e10cSrcweir break;
358cdf0e10cSrcweir case FN_ITEM_DOWN:
359cdf0e10cSrcweir case FN_ITEM_UP:
360cdf0e10cSrcweir case FN_ITEM_LEFT:
361cdf0e10cSrcweir case FN_ITEM_RIGHT:
362cdf0e10cSrcweir case FN_GLOBAL_EDIT:
363cdf0e10cSrcweir {
364cdf0e10cSrcweir if(IsGlobalMode())
365cdf0e10cSrcweir aGlobalTree.ExecCommand(nCurrItemId);
366cdf0e10cSrcweir else
367cdf0e10cSrcweir aContentTree.ExecCommand(nCurrItemId, bOutlineWithChilds);
368cdf0e10cSrcweir }
369cdf0e10cSrcweir break;
370cdf0e10cSrcweir case FN_GLOBAL_SWITCH:
371cdf0e10cSrcweir {
372cdf0e10cSrcweir ToggleTree();
373cdf0e10cSrcweir pConfig->SetGlobalActive(IsGlobalMode());
374cdf0e10cSrcweir }
375cdf0e10cSrcweir break;
376cdf0e10cSrcweir case FN_GLOBAL_SAVE_CONTENT:
377cdf0e10cSrcweir {
378cdf0e10cSrcweir sal_Bool bSave = rSh.IsGlblDocSaveLinks();
379cdf0e10cSrcweir rSh.SetGlblDocSaveLinks( !bSave );
380cdf0e10cSrcweir pBox->CheckItem(FN_GLOBAL_SAVE_CONTENT, !bSave );
381cdf0e10cSrcweir }
382cdf0e10cSrcweir break;
383cdf0e10cSrcweir }
384cdf0e10cSrcweir
385cdf0e10cSrcweir if (nFuncId)
386cdf0e10cSrcweir {
387cdf0e10cSrcweir lcl_UnSelectFrm(&rSh);
388cdf0e10cSrcweir }
389cdf0e10cSrcweir if(bFocusToDoc)
390cdf0e10cSrcweir pView->GetEditWin().GrabFocus();
391cdf0e10cSrcweir return sal_True;
392cdf0e10cSrcweir }
393cdf0e10cSrcweir /*------------------------------------------------------------------------
394cdf0e10cSrcweir Beschreibung: ClickHandler der Toolboxen
395cdf0e10cSrcweir ------------------------------------------------------------------------*/
396cdf0e10cSrcweir
397cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,ToolBoxClickHdl,ToolBox *,pBox)398cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxClickHdl, ToolBox *, pBox )
399cdf0e10cSrcweir {
400cdf0e10cSrcweir const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
401cdf0e10cSrcweir switch (nCurrItemId)
402cdf0e10cSrcweir {
403cdf0e10cSrcweir case FN_GLOBAL_UPDATE:
404cdf0e10cSrcweir case FN_GLOBAL_OPEN:
405cdf0e10cSrcweir {
406cdf0e10cSrcweir aGlobalTree.TbxMenuHdl(nCurrItemId, pBox);
407cdf0e10cSrcweir }
408cdf0e10cSrcweir break;
409cdf0e10cSrcweir }
410cdf0e10cSrcweir
411cdf0e10cSrcweir return sal_True;
412cdf0e10cSrcweir }
413cdf0e10cSrcweir
414cdf0e10cSrcweir /*-----------------13.07.04 -------------------
415cdf0e10cSrcweir ----------------------------------------------*/
416cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,ToolBoxDropdownClickHdl,ToolBox *,pBox)417cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ToolBoxDropdownClickHdl, ToolBox*, pBox )
418cdf0e10cSrcweir {
419cdf0e10cSrcweir const sal_uInt16 nCurrItemId = pBox->GetCurItemId();
420cdf0e10cSrcweir switch (nCurrItemId)
421cdf0e10cSrcweir {
422cdf0e10cSrcweir case FN_CREATE_NAVIGATION:
423cdf0e10cSrcweir {
424cdf0e10cSrcweir CreateNavigationTool(pBox->GetItemRect(FN_CREATE_NAVIGATION), sal_True);
425cdf0e10cSrcweir }
426cdf0e10cSrcweir break;
427cdf0e10cSrcweir
428cdf0e10cSrcweir case FN_DROP_REGION:
429cdf0e10cSrcweir {
430cdf0e10cSrcweir static const char* aHIDs[] =
431cdf0e10cSrcweir {
432cdf0e10cSrcweir HID_NAVI_DRAG_HYP,
433cdf0e10cSrcweir HID_NAVI_DRAG_LINK,
434cdf0e10cSrcweir HID_NAVI_DRAG_COPY,
435cdf0e10cSrcweir };
436cdf0e10cSrcweir PopupMenu *pMenu = new PopupMenu;
437cdf0e10cSrcweir for (sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++)
438cdf0e10cSrcweir {
439cdf0e10cSrcweir pMenu->InsertItem( i + 1, aContextArr[i] );
440cdf0e10cSrcweir pMenu->SetHelpId(i + 1, aHIDs[i]);
441cdf0e10cSrcweir }
442cdf0e10cSrcweir pMenu->CheckItem( nRegionMode + 1 );
443cdf0e10cSrcweir pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
444cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_True );
445cdf0e10cSrcweir pMenu->Execute( pBox,
446cdf0e10cSrcweir pBox->GetItemRect(FN_DROP_REGION),
447cdf0e10cSrcweir POPUPMENU_EXECUTE_DOWN );
448cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_False );
449cdf0e10cSrcweir pBox->EndSelection();
450cdf0e10cSrcweir delete pMenu;
451cdf0e10cSrcweir pBox->Invalidate();
452cdf0e10cSrcweir }
453cdf0e10cSrcweir break;
454cdf0e10cSrcweir case FN_OUTLINE_LEVEL:
455cdf0e10cSrcweir {
456cdf0e10cSrcweir PopupMenu *pMenu = new PopupMenu;
457cdf0e10cSrcweir for (sal_uInt16 i = 101; i <= 100 + MAXLEVEL; i++)
458cdf0e10cSrcweir {
459cdf0e10cSrcweir pMenu->InsertItem( i, String::CreateFromInt32(i - 100) );
460cdf0e10cSrcweir pMenu->SetHelpId( i, HID_NAVI_OUTLINES );
461cdf0e10cSrcweir }
462cdf0e10cSrcweir pMenu->CheckItem( aContentTree.GetOutlineLevel() + 100 );
463cdf0e10cSrcweir pMenu->SetSelectHdl(LINK(this, SwNavigationPI, MenuSelectHdl));
464cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_True );
465cdf0e10cSrcweir pMenu->Execute( pBox,
466cdf0e10cSrcweir pBox->GetItemRect(FN_OUTLINE_LEVEL),
467cdf0e10cSrcweir POPUPMENU_EXECUTE_DOWN );
468cdf0e10cSrcweir pBox->SetItemDown( nCurrItemId, sal_False );
469cdf0e10cSrcweir delete pMenu;
470cdf0e10cSrcweir pBox->EndSelection();
471cdf0e10cSrcweir pBox->Invalidate();
472cdf0e10cSrcweir }
473cdf0e10cSrcweir break;
474cdf0e10cSrcweir }
475cdf0e10cSrcweir return sal_True;
476cdf0e10cSrcweir }
477cdf0e10cSrcweir
478cdf0e10cSrcweir /*-----------------13.07.04 -------------------
479cdf0e10cSrcweir --------------------------------------------------*/
480cdf0e10cSrcweir
SwNavHelpToolBox(SwNavigationPI * pParent,const ResId & rResId)481cdf0e10cSrcweir SwNavHelpToolBox::SwNavHelpToolBox(SwNavigationPI* pParent, const ResId &rResId) :
482cdf0e10cSrcweir SwHelpToolBox(pParent, rResId)
483cdf0e10cSrcweir {}
484cdf0e10cSrcweir /*-----------------19.06.97 09:09-------------------
485cdf0e10cSrcweir
486cdf0e10cSrcweir --------------------------------------------------*/
MouseButtonDown(const MouseEvent & rEvt)487cdf0e10cSrcweir void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
488cdf0e10cSrcweir {
489cdf0e10cSrcweir if(rEvt.GetButtons() == MOUSE_LEFT &&
490cdf0e10cSrcweir FN_CREATE_NAVIGATION == GetItemId(rEvt.GetPosPixel()))
491cdf0e10cSrcweir {
492cdf0e10cSrcweir ((SwNavigationPI*)GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION), sal_False);
493cdf0e10cSrcweir }
494cdf0e10cSrcweir else
495cdf0e10cSrcweir SwHelpToolBox::MouseButtonDown(rEvt);
496cdf0e10cSrcweir }
497cdf0e10cSrcweir /* -----------------------------12.03.2002 16:55------------------------------
498cdf0e10cSrcweir
499cdf0e10cSrcweir ---------------------------------------------------------------------------*/
CreateNavigationTool(const Rectangle & rRect,sal_Bool bSetFocus)500cdf0e10cSrcweir void SwNavigationPI::CreateNavigationTool(const Rectangle& rRect, sal_Bool bSetFocus)
501cdf0e10cSrcweir {
502cdf0e10cSrcweir // SfxBindings& rBind = GetCreateView()->GetViewFrame()->GetBindings();
503cdf0e10cSrcweir // rBind.ENTERREGISTRATIONS();
504cdf0e10cSrcweir Reference< XFrame > xFrame = GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface();
505cdf0e10cSrcweir SwScrollNaviPopup* pPopup = new
506cdf0e10cSrcweir SwScrollNaviPopup(FN_SCROLL_NAVIGATION,
507cdf0e10cSrcweir xFrame );
508cdf0e10cSrcweir // rBind.LEAVEREGISTRATIONS();
509cdf0e10cSrcweir
510cdf0e10cSrcweir Rectangle aRect(rRect);
511cdf0e10cSrcweir Point aT1 = aRect.TopLeft();
512cdf0e10cSrcweir aT1 = pPopup->GetParent()->OutputToScreenPixel(pPopup->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox.OutputToAbsoluteScreenPixel(aT1)));
513cdf0e10cSrcweir aRect.SetPos(aT1);
514cdf0e10cSrcweir pPopup->StartPopupMode(aRect, FLOATWIN_POPUPMODE_RIGHT|FLOATWIN_POPUPMODE_ALLOWTEAROFF);
515cdf0e10cSrcweir SetPopupWindow( pPopup );
516cdf0e10cSrcweir if(bSetFocus)
517cdf0e10cSrcweir {
518cdf0e10cSrcweir pPopup->EndPopupMode(FLOATWIN_POPUPMODEEND_TEAROFF);
519cdf0e10cSrcweir pPopup->GrabFocus();
520cdf0e10cSrcweir }
521cdf0e10cSrcweir }
522cdf0e10cSrcweir
523cdf0e10cSrcweir /*-----------------19.06.97 10:12-------------------
524cdf0e10cSrcweir
525cdf0e10cSrcweir --------------------------------------------------*/
RequestHelp(const HelpEvent & rHEvt)526cdf0e10cSrcweir void SwNavHelpToolBox::RequestHelp( const HelpEvent& rHEvt )
527cdf0e10cSrcweir {
528cdf0e10cSrcweir sal_uInt16 nItemId = GetItemId(ScreenToOutputPixel(rHEvt.GetMousePosPixel()));
529cdf0e10cSrcweir if( FN_UP == nItemId || FN_DOWN == nItemId )
530cdf0e10cSrcweir {
531cdf0e10cSrcweir SetItemText(nItemId, SwScrollNaviPopup::GetQuickHelpText((FN_DOWN == nItemId)));
532cdf0e10cSrcweir }
533cdf0e10cSrcweir SwHelpToolBox::RequestHelp(rHEvt);
534cdf0e10cSrcweir }
535cdf0e10cSrcweir
536cdf0e10cSrcweir /*------------------------------------------------------------------------
537cdf0e10cSrcweir Beschreibung: Action-Handler Edit; wechselt auf die Seite, wenn
538cdf0e10cSrcweir nicht Gliederungssicht angeschaltet ist.
539cdf0e10cSrcweir ------------------------------------------------------------------------*/
540cdf0e10cSrcweir
541cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,EditAction,NumEditAction *,pEdit)542cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, EditAction, NumEditAction *, pEdit )
543cdf0e10cSrcweir {
544cdf0e10cSrcweir SwView *pView = GetCreateView();
545cdf0e10cSrcweir if (pView)
546cdf0e10cSrcweir {
547cdf0e10cSrcweir if(aPageChgTimer.IsActive())
548cdf0e10cSrcweir aPageChgTimer.Stop();
549cdf0e10cSrcweir pCreateView->GetWrtShell().GotoPage((sal_uInt16)pEdit->GetValue(), sal_True);
550cdf0e10cSrcweir pCreateView->GetEditWin().GrabFocus();
551cdf0e10cSrcweir pCreateView->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE);
552cdf0e10cSrcweir }
553cdf0e10cSrcweir return 0;
554cdf0e10cSrcweir }
555cdf0e10cSrcweir
556cdf0e10cSrcweir /*------------------------------------------------------------------------
557cdf0e10cSrcweir Beschreibung: Falls die Seite eingestellt werden kann, wird hier
558cdf0e10cSrcweir das Maximum gesetzt.
559cdf0e10cSrcweir ------------------------------------------------------------------------*/
560cdf0e10cSrcweir
561cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,EditGetFocus,NumEditAction *,pEdit)562cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, EditGetFocus, NumEditAction *, pEdit )
563cdf0e10cSrcweir {
564cdf0e10cSrcweir SwView *pView = GetCreateView();
565cdf0e10cSrcweir if (!pView)
566cdf0e10cSrcweir return 0;
567cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell();
568cdf0e10cSrcweir
569cdf0e10cSrcweir const sal_uInt16 nPageCnt = rSh.GetPageCnt();
570cdf0e10cSrcweir pEdit->SetMax(nPageCnt);
571cdf0e10cSrcweir pEdit->SetLast(nPageCnt);
572cdf0e10cSrcweir return 0;
573cdf0e10cSrcweir }
574cdf0e10cSrcweir
575cdf0e10cSrcweir /*------------------------------------------------------------------------
576cdf0e10cSrcweir Beschreibung:
577cdf0e10cSrcweir ------------------------------------------------------------------------*/
578cdf0e10cSrcweir
Close()579cdf0e10cSrcweir sal_Bool SwNavigationPI::Close()
580cdf0e10cSrcweir {
581cdf0e10cSrcweir SfxViewFrame* pVFrame = pCreateView->GetViewFrame();
582cdf0e10cSrcweir pVFrame->GetBindings().Invalidate(SID_NAVIGATOR);
583cdf0e10cSrcweir pVFrame->GetDispatcher()->Execute(SID_NAVIGATOR);
584cdf0e10cSrcweir return sal_True;
585cdf0e10cSrcweir }
586cdf0e10cSrcweir
587cdf0e10cSrcweir /*------------------------------------------------------------------------
588cdf0e10cSrcweir Beschreibung: Setzen einer automatischen Marke
589cdf0e10cSrcweir ------------------------------------------------------------------------*/
590cdf0e10cSrcweir
591cdf0e10cSrcweir
MakeMark()592cdf0e10cSrcweir void SwNavigationPI::MakeMark()
593cdf0e10cSrcweir {
594cdf0e10cSrcweir SwView *pView = GetCreateView();
595cdf0e10cSrcweir if (!pView) return;
596cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell();
597cdf0e10cSrcweir IDocumentMarkAccess* const pMarkAccess = rSh.getIDocumentMarkAccess();
598cdf0e10cSrcweir
599cdf0e10cSrcweir // collect and sort navigator reminder names
600cdf0e10cSrcweir ::std::vector< ::rtl::OUString > vNavMarkNames;
601dec99bbdSOliver-Rainer Wittmann for(IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAllMarksBegin();
602dec99bbdSOliver-Rainer Wittmann ppMark != pMarkAccess->getAllMarksEnd();
603cdf0e10cSrcweir ppMark++)
604cdf0e10cSrcweir if( IDocumentMarkAccess::GetType(**ppMark) == IDocumentMarkAccess::NAVIGATOR_REMINDER )
605cdf0e10cSrcweir vNavMarkNames.push_back(ppMark->get()->GetName());
606cdf0e10cSrcweir ::std::sort(vNavMarkNames.begin(), vNavMarkNames.end());
607cdf0e10cSrcweir
608cdf0e10cSrcweir // we are maxed out and delete one
609cdf0e10cSrcweir // nAutoMarkIdx rotates through the available MarkNames
610cdf0e10cSrcweir // this assumes that IDocumentMarkAccess generates Names in ascending order
611cdf0e10cSrcweir if(vNavMarkNames.size() == MAX_MARKS)
612cdf0e10cSrcweir pMarkAccess->deleteMark(pMarkAccess->findMark(vNavMarkNames[nAutoMarkIdx]));
613cdf0e10cSrcweir
614cdf0e10cSrcweir rSh.SetBookmark(KeyCode(), ::rtl::OUString(), ::rtl::OUString(), IDocumentMarkAccess::NAVIGATOR_REMINDER);
615cdf0e10cSrcweir SwView::SetActMark( nAutoMarkIdx );
616cdf0e10cSrcweir
617cdf0e10cSrcweir if(++nAutoMarkIdx == MAX_MARKS)
618cdf0e10cSrcweir nAutoMarkIdx = 0;
619cdf0e10cSrcweir }
620cdf0e10cSrcweir
621cdf0e10cSrcweir /*------------------------------------------------------------------------
622cdf0e10cSrcweir Beschreibung:
623cdf0e10cSrcweir ------------------------------------------------------------------------*/
624cdf0e10cSrcweir
GotoPage()625cdf0e10cSrcweir void SwNavigationPI::GotoPage()
626cdf0e10cSrcweir {
627b7d08b69SAndre Fischer if (pContextWin && pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
628cdf0e10cSrcweir _ZoomIn();
629cdf0e10cSrcweir if(IsGlobalMode())
630cdf0e10cSrcweir ToggleTree();
631cdf0e10cSrcweir UsePage(0);
632cdf0e10cSrcweir GetPageEdit().GrabFocus();
633cdf0e10cSrcweir }
634cdf0e10cSrcweir
635cdf0e10cSrcweir /*------------------------------------------------------------------------
636cdf0e10cSrcweir Beschreibung:
637cdf0e10cSrcweir ------------------------------------------------------------------------*/
638cdf0e10cSrcweir
_ZoomOut()639cdf0e10cSrcweir void SwNavigationPI::_ZoomOut()
640cdf0e10cSrcweir {
641cdf0e10cSrcweir if (_IsZoomedIn())
642cdf0e10cSrcweir {
643b7d08b69SAndre Fischer FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
644cdf0e10cSrcweir bIsZoomedIn = sal_False;
645cdf0e10cSrcweir Size aSz(GetOutputSizePixel());
646cdf0e10cSrcweir aSz.Height() = nZoomOut;
647cdf0e10cSrcweir Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
648cdf0e10cSrcweir ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
649cdf0e10cSrcweir aMinOutSizePixel.Width(),nZoomOutInit));
650b7d08b69SAndre Fischer if (pFloat != NULL)
651b7d08b69SAndre Fischer pFloat->SetOutputSizePixel(aSz);
652cdf0e10cSrcweir FillBox();
653cdf0e10cSrcweir if(IsGlobalMode())
654cdf0e10cSrcweir {
655cdf0e10cSrcweir aGlobalTree.ShowTree();
656cdf0e10cSrcweir }
657cdf0e10cSrcweir else
658cdf0e10cSrcweir {
659cdf0e10cSrcweir aContentTree.ShowTree();
660cdf0e10cSrcweir aDocListBox.Show();
661cdf0e10cSrcweir }
662cdf0e10cSrcweir SvLBoxEntry* pFirst = aContentTree.FirstSelected();
663cdf0e10cSrcweir if(pFirst)
664cdf0e10cSrcweir aContentTree.Select(pFirst, sal_True); // toolbox enablen
665cdf0e10cSrcweir pConfig->SetSmall( sal_False );
666cdf0e10cSrcweir aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX);
667cdf0e10cSrcweir }
668cdf0e10cSrcweir }
669cdf0e10cSrcweir
670cdf0e10cSrcweir /*------------------------------------------------------------------------
671cdf0e10cSrcweir Beschreibung:
672cdf0e10cSrcweir ------------------------------------------------------------------------*/
673cdf0e10cSrcweir
_ZoomIn()674cdf0e10cSrcweir void SwNavigationPI::_ZoomIn()
675cdf0e10cSrcweir {
676b7d08b69SAndre Fischer if (pContextWin != NULL)
677b7d08b69SAndre Fischer {
678b7d08b69SAndre Fischer FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
679b7d08b69SAndre Fischer if (pFloat &&
680b7d08b69SAndre Fischer (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
681b7d08b69SAndre Fischer {
682b7d08b69SAndre Fischer aContentTree.HideTree();
683b7d08b69SAndre Fischer aDocListBox.Hide();
684b7d08b69SAndre Fischer aGlobalTree.HideTree();
685b7d08b69SAndre Fischer bIsZoomedIn = sal_True;
686b7d08b69SAndre Fischer Size aSz(GetOutputSizePixel());
687b7d08b69SAndre Fischer if( aSz.Height() > nZoomIn )
688b7d08b69SAndre Fischer nZoomOut = ( short ) aSz.Height();
689b7d08b69SAndre Fischer
690b7d08b69SAndre Fischer aSz.Height() = nZoomIn;
691b7d08b69SAndre Fischer Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
692b7d08b69SAndre Fischer ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
693b7d08b69SAndre Fischer aMinOutSizePixel.Width(), aSz.Height()));
694b7d08b69SAndre Fischer pFloat->SetOutputSizePixel(aSz);
695b7d08b69SAndre Fischer SvLBoxEntry* pFirst = aContentTree.FirstSelected();
696b7d08b69SAndre Fischer if(pFirst)
697b7d08b69SAndre Fischer aContentTree.Select(pFirst, sal_True); // toolbox enablen
698b7d08b69SAndre Fischer pConfig->SetSmall( sal_True );
699b7d08b69SAndre Fischer aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
700b7d08b69SAndre Fischer }
701b7d08b69SAndre Fischer }
702cdf0e10cSrcweir }
703cdf0e10cSrcweir /*------------------------------------------------------------------------
704cdf0e10cSrcweir Beschreibung:
705cdf0e10cSrcweir ------------------------------------------------------------------------*/
706cdf0e10cSrcweir
Resize()707cdf0e10cSrcweir void SwNavigationPI::Resize()
708cdf0e10cSrcweir {
709cdf0e10cSrcweir Window* pParent = GetParent();
710b7d08b69SAndre Fischer if( !_IsZoomedIn() )
711b7d08b69SAndre Fischer {
712b7d08b69SAndre Fischer Size aNewSize (pParent->GetOutputSizePixel());
713cdf0e10cSrcweir
714b7d08b69SAndre Fischer SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
715b7d08b69SAndre Fischer if (pDockingParent != NULL)
716b7d08b69SAndre Fischer {
717b7d08b69SAndre Fischer FloatingWindow* pFloat = pDockingParent->GetFloatingWindow();
718b7d08b69SAndre Fischer //change the minimum width depending on the dock status
719b7d08b69SAndre Fischer Size aMinOutSizePixel = pDockingParent->GetMinOutputSizePixel();
720b7d08b69SAndre Fischer if( pFloat)
721b7d08b69SAndre Fischer {
722b7d08b69SAndre Fischer aNewSize = pFloat->GetOutputSizePixel();
723b7d08b69SAndre Fischer aMinOutSizePixel.Width() = nWishWidth;
724b7d08b69SAndre Fischer aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
725b7d08b69SAndre Fischer }
726b7d08b69SAndre Fischer else
727b7d08b69SAndre Fischer {
728b7d08b69SAndre Fischer aMinOutSizePixel.Width() = 0;
729b7d08b69SAndre Fischer aMinOutSizePixel.Height() = 0;
730b7d08b69SAndre Fischer }
731b7d08b69SAndre Fischer pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel);
732b7d08b69SAndre Fischer }
733b7d08b69SAndre Fischer
734cdf0e10cSrcweir const Point aPos = aContentTree.GetPosPixel();
735b7d08b69SAndre Fischer Point aLBPos = aDocListBox.GetPosPixel();
736b7d08b69SAndre Fischer long nDist = aPos.X();
737b7d08b69SAndre Fischer aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist);
738b7d08b69SAndre Fischer aNewSize.Width() -= 2 * nDist;
739b7d08b69SAndre Fischer aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist;
740b7d08b69SAndre Fischer aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() );
741b7d08b69SAndre Fischer
742b7d08b69SAndre Fischer Size aDocLBSz = aDocListBox.GetSizePixel();
743b7d08b69SAndre Fischer aDocLBSz.Width() = aNewSize.Width();
744b7d08b69SAndre Fischer if(aNewSize.Height() < 0)
745b7d08b69SAndre Fischer aDocLBSz.Height() = 0;
746b7d08b69SAndre Fischer else
747b7d08b69SAndre Fischer aDocLBSz.Height() = nDocLBIniHeight;
748b7d08b69SAndre Fischer aContentTree.SetSizePixel(aNewSize);
749b7d08b69SAndre Fischer // GlobalTree faengt weiter oben an und reicht bis ganz unten
750b7d08b69SAndre Fischer aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
751b7d08b69SAndre Fischer aGlobalTree.SetSizePixel(aNewSize);
752b7d08b69SAndre Fischer aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
753b7d08b69SAndre Fischer aDocLBSz.Width(), aDocLBSz.Height(),
754b7d08b69SAndre Fischer WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
755cdf0e10cSrcweir }
756cdf0e10cSrcweir }
757cdf0e10cSrcweir
758cdf0e10cSrcweir
759cdf0e10cSrcweir /*------------------------------------------------------------------------
760cdf0e10cSrcweir Beschreibung:
761cdf0e10cSrcweir ------------------------------------------------------------------------*/
762cdf0e10cSrcweir
SwNavigationPI(SfxBindings * _pBindings,SfxChildWindowContext * pCw,Window * pParent)763cdf0e10cSrcweir SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
764cdf0e10cSrcweir SfxChildWindowContext* pCw,
765cdf0e10cSrcweir Window* pParent) :
766cdf0e10cSrcweir
767cdf0e10cSrcweir Window( pParent, SW_RES(DLG_NAVIGATION_PI)),
768cdf0e10cSrcweir SfxControllerItem( SID_DOCFULLNAME, *_pBindings ),
769cdf0e10cSrcweir
770cdf0e10cSrcweir aContentToolBox(this, SW_RES(TB_CONTENT)),
771cdf0e10cSrcweir aGlobalToolBox(this, SW_RES(TB_GLOBAL)),
772cdf0e10cSrcweir aContentImageList(SW_RES(IL_CONTENT)),
773cdf0e10cSrcweir aContentImageListH(SW_RES(ILH_CONTENT)),
774cdf0e10cSrcweir aContentTree(this, SW_RES(TL_CONTENT)),
775cdf0e10cSrcweir aGlobalTree(this, SW_RES(TL_GLOBAL)),
776cdf0e10cSrcweir aDocListBox(this, SW_RES(LB_DOCS)),
777cdf0e10cSrcweir
778cdf0e10cSrcweir pxObjectShell(0),
779cdf0e10cSrcweir pContentView(0),
780cdf0e10cSrcweir pContentWrtShell(0),
781cdf0e10cSrcweir pActContView(0),
782cdf0e10cSrcweir pCreateView(0),
783cdf0e10cSrcweir pPopupWindow(0),
784cdf0e10cSrcweir pFloatingWindow(0),
785cdf0e10cSrcweir
786cdf0e10cSrcweir pContextWin(pCw),
787cdf0e10cSrcweir
788cdf0e10cSrcweir pConfig(SW_MOD()->GetNavigationConfig()),
789cdf0e10cSrcweir rBindings(*_pBindings),
790cdf0e10cSrcweir
791cdf0e10cSrcweir nWishWidth(0),
792cdf0e10cSrcweir nAutoMarkIdx(1),
793cdf0e10cSrcweir nRegionMode(REGION_MODE_NONE),
794cdf0e10cSrcweir
795cdf0e10cSrcweir bSmallMode(sal_False),
796cdf0e10cSrcweir bIsZoomedIn(sal_False),
797cdf0e10cSrcweir bPageCtrlsVisible(sal_False),
798cdf0e10cSrcweir bGlobalMode(sal_False)
799cdf0e10cSrcweir {
800cdf0e10cSrcweir GetCreateView();
801cdf0e10cSrcweir InitImageList();
802cdf0e10cSrcweir
803cdf0e10cSrcweir aContentToolBox.SetHelpId(HID_NAVIGATOR_TOOLBOX );
804cdf0e10cSrcweir aGlobalToolBox.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX);
805cdf0e10cSrcweir aDocListBox.SetHelpId(HID_NAVIGATOR_LISTBOX );
806*74e40a03STsutomu Uchino aDocListBox.SetDropDownLineCount(9);
807cdf0e10cSrcweir
808cdf0e10cSrcweir nDocLBIniHeight = aDocListBox.GetSizePixel().Height();
809cdf0e10cSrcweir nZoomOutInit = nZoomOut = Resource::ReadShortRes();
810cdf0e10cSrcweir
811cdf0e10cSrcweir //NumericField in die Toolbox einfuegen
812cdf0e10cSrcweir NumEditAction* pEdit = new NumEditAction(
813cdf0e10cSrcweir &aContentToolBox, SW_RES(NF_PAGE ));
814cdf0e10cSrcweir pEdit->SetActionHdl(LINK(this, SwNavigationPI, EditAction));
815cdf0e10cSrcweir pEdit->SetGetFocusHdl(LINK(this, SwNavigationPI, EditGetFocus));
816cdf0e10cSrcweir pEdit->SetAccessibleName(pEdit->GetQuickHelpText());
817cdf0e10cSrcweir pEdit->SetUpHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
818cdf0e10cSrcweir pEdit->SetDownHdl(LINK(this, SwNavigationPI, PageEditModifyHdl));
819cdf0e10cSrcweir
820cdf0e10cSrcweir bPageCtrlsVisible = sal_True;
821cdf0e10cSrcweir
822cdf0e10cSrcweir // Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SHOW_ROOT);
823cdf0e10cSrcweir // sal_uInt16 nWidth = 2 * (sal_uInt16)aFirstRect.Left();
824cdf0e10cSrcweir //doppelte Separatoren sind nicht erlaubt, also muss
825cdf0e10cSrcweir //die passende Groesse anders ermittelt werden
826cdf0e10cSrcweir Rectangle aFirstRect = aContentToolBox.GetItemRect(FN_SELECT_FOOTNOTE);
827cdf0e10cSrcweir Rectangle aSecondRect = aContentToolBox.GetItemRect(FN_SELECT_HEADER);
828cdf0e10cSrcweir sal_uInt16 nWidth = sal_uInt16(aFirstRect.Left() - aSecondRect.Left());
829cdf0e10cSrcweir
830cdf0e10cSrcweir Size aItemWinSize( nWidth , aFirstRect.Bottom() - aFirstRect.Top() );
831cdf0e10cSrcweir pEdit->SetSizePixel(aItemWinSize);
832cdf0e10cSrcweir aContentToolBox.InsertSeparator(4);
833cdf0e10cSrcweir aContentToolBox.InsertWindow( FN_PAGENUMBER, pEdit, 0, 4);
834cdf0e10cSrcweir aContentToolBox.InsertSeparator(4);
835cdf0e10cSrcweir aContentToolBox.SetHelpId(FN_PAGENUMBER, HID_NAVI_TBX16);
836cdf0e10cSrcweir aContentToolBox.ShowItem( FN_PAGENUMBER );
837cdf0e10cSrcweir
838cdf0e10cSrcweir for( sal_uInt16 i = 0; i <= REGION_MODE_EMBEDDED; i++ )
839cdf0e10cSrcweir {
840cdf0e10cSrcweir aContextArr[i] = SW_RESSTR(ST_HYPERLINK + i);
841cdf0e10cSrcweir aStatusArr[i] = SW_RESSTR(ST_STATUS_FIRST + i);
842cdf0e10cSrcweir }
843cdf0e10cSrcweir aStatusArr[3] = SW_RESSTR(ST_ACTIVE_VIEW);
844cdf0e10cSrcweir FreeResource();
845cdf0e10cSrcweir
846cdf0e10cSrcweir
847cdf0e10cSrcweir const Size& rOutSize = GetOutputSizePixel();
848cdf0e10cSrcweir
849cdf0e10cSrcweir nZoomIn = (short)rOutSize.Height();
850cdf0e10cSrcweir
851cdf0e10cSrcweir // Make sure the toolbox has a size that fits all its contents
852cdf0e10cSrcweir Size aContentToolboxSize( aContentToolBox.CalcWindowSizePixel() );
853cdf0e10cSrcweir aContentToolBox.SetOutputSizePixel( aContentToolboxSize );
854cdf0e10cSrcweir
855cdf0e10cSrcweir // position listbox below toolbar and add some space
856cdf0e10cSrcweir long nListboxYPos = aContentToolBox.GetPosPixel().Y() + aContentToolboxSize.Height() + 4;
857cdf0e10cSrcweir
858cdf0e10cSrcweir //Der linke und rechte Rand um die Toolboxen soll gleich sein
859cdf0e10cSrcweir nWishWidth = aContentToolboxSize.Width();
860cdf0e10cSrcweir nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
861cdf0e10cSrcweir
862b7d08b69SAndre Fischer DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent);
863b7d08b69SAndre Fischer if (pDockingParent != NULL)
864b7d08b69SAndre Fischer {
865b7d08b69SAndre Fischer FloatingWindow* pFloat = pDockingParent->GetFloatingWindow();
866b7d08b69SAndre Fischer Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
867b7d08b69SAndre Fischer pDockingParent->SetMinOutputSizePixel(aMinSize);
868b7d08b69SAndre Fischer SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
869b7d08b69SAndre Fischer
870b7d08b69SAndre Fischer SfxDockingWindow* pSfxDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
871b7d08b69SAndre Fischer if (pSfxDockingParent != NULL)
872b7d08b69SAndre Fischer {
873b7d08b69SAndre Fischer Size aTmpParentSize(pSfxDockingParent->GetSizePixel());
874b7d08b69SAndre Fischer if (aTmpParentSize.Width() < aMinSize.Width()
875b7d08b69SAndre Fischer || aTmpParentSize.Height() < aMinSize.Height())
876b7d08b69SAndre Fischer {
877b7d08b69SAndre Fischer if (pSfxDockingParent->GetFloatingWindow()
878b7d08b69SAndre Fischer && ! pSfxDockingParent->GetFloatingWindow()->IsRollUp())
879b7d08b69SAndre Fischer {
880b7d08b69SAndre Fischer pSfxDockingParent->SetOutputSizePixel(aMinSize);
881b7d08b69SAndre Fischer }
882b7d08b69SAndre Fischer }
883b7d08b69SAndre Fischer }
884b7d08b69SAndre Fischer }
885cdf0e10cSrcweir
886cdf0e10cSrcweir aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
887cdf0e10cSrcweir aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
888cdf0e10cSrcweir WB_CLIPCHILDREN|WB_HSCROLL|WB_FORCE_MAKEVISIBLE );
889cdf0e10cSrcweir aContentTree.SetSpaceBetweenEntries(3);
890cdf0e10cSrcweir aContentTree.SetSelectionMode( SINGLE_SELECTION );
891cdf0e10cSrcweir aContentTree.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE |
892cdf0e10cSrcweir SV_DRAGDROP_CTRL_COPY |
893cdf0e10cSrcweir SV_DRAGDROP_ENABLE_TOP );
894cdf0e10cSrcweir aContentTree.EnableAsyncDrag(sal_True);
895cdf0e10cSrcweir aContentTree.ShowTree();
8961ff378efSZheng Fan aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_True);
897cdf0e10cSrcweir
898cdf0e10cSrcweir // TreeListBox fuer Globaldokument
899cdf0e10cSrcweir aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
900cdf0e10cSrcweir aGlobalTree.SetSelectionMode( MULTIPLE_SELECTION );
901cdf0e10cSrcweir aGlobalTree.SetStyle( aGlobalTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
902cdf0e10cSrcweir WB_CLIPCHILDREN|WB_HSCROLL );
903cdf0e10cSrcweir Size aGlblSize(aGlobalToolBox.CalcWindowSizePixel());
904cdf0e10cSrcweir aGlobalToolBox.SetSizePixel(aGlblSize);
905cdf0e10cSrcweir
906cdf0e10cSrcweir // Handler
907cdf0e10cSrcweir
908cdf0e10cSrcweir Link aLk = LINK(this, SwNavigationPI, ToolBoxSelectHdl);
909cdf0e10cSrcweir aContentToolBox.SetSelectHdl( aLk );
910cdf0e10cSrcweir aGlobalToolBox.SetSelectHdl( aLk );
911cdf0e10cSrcweir aDocListBox.SetSelectHdl(LINK(this, SwNavigationPI,
912cdf0e10cSrcweir DocListBoxSelectHdl));
913cdf0e10cSrcweir aContentToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
914cdf0e10cSrcweir aContentToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
915cdf0e10cSrcweir aGlobalToolBox.SetClickHdl( LINK(this, SwNavigationPI, ToolBoxClickHdl) );
916cdf0e10cSrcweir aGlobalToolBox.SetDropdownClickHdl( LINK(this, SwNavigationPI, ToolBoxDropdownClickHdl) );
917cdf0e10cSrcweir aGlobalToolBox.CheckItem(FN_GLOBAL_SWITCH, sal_True);
918cdf0e10cSrcweir
919cdf0e10cSrcweir Font aFont(GetFont());
920cdf0e10cSrcweir aFont.SetWeight(WEIGHT_NORMAL);
921cdf0e10cSrcweir GetPageEdit().SetFont(aFont);
922cdf0e10cSrcweir aFont = aContentTree.GetFont();
923cdf0e10cSrcweir aFont.SetWeight(WEIGHT_NORMAL);
924cdf0e10cSrcweir aContentTree.SetFont(aFont);
925cdf0e10cSrcweir aGlobalTree.SetFont(aFont);
926cdf0e10cSrcweir
927cdf0e10cSrcweir StartListening(*SFX_APP());
928cdf0e10cSrcweir if ( pCreateView )
929cdf0e10cSrcweir StartListening(*pCreateView);
930cdf0e10cSrcweir SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
931cdf0e10cSrcweir pImgMan->RegisterToolBox(&aContentToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
932cdf0e10cSrcweir pImgMan->RegisterToolBox(&aGlobalToolBox, SFX_TOOLBOX_CHANGEOUTSTYLE);
933cdf0e10cSrcweir
934cdf0e10cSrcweir aContentToolBox.SetItemBits( FN_CREATE_NAVIGATION, aContentToolBox.GetItemBits( FN_CREATE_NAVIGATION ) | TIB_DROPDOWNONLY );
935cdf0e10cSrcweir aContentToolBox.SetItemBits( FN_DROP_REGION, aContentToolBox.GetItemBits( FN_DROP_REGION ) | TIB_DROPDOWNONLY );
936cdf0e10cSrcweir aContentToolBox.SetItemBits( FN_OUTLINE_LEVEL, aContentToolBox.GetItemBits( FN_OUTLINE_LEVEL ) | TIB_DROPDOWNONLY );
937cdf0e10cSrcweir
938cdf0e10cSrcweir if(IsGlobalDoc())
939cdf0e10cSrcweir {
940cdf0e10cSrcweir SwView *pActView = GetCreateView();
941cdf0e10cSrcweir aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT,
942cdf0e10cSrcweir pActView->GetWrtShellPtr()->IsGlblDocSaveLinks());
943cdf0e10cSrcweir if(pConfig->IsGlobalActive())
944cdf0e10cSrcweir ToggleTree();
945cdf0e10cSrcweir aGlobalTree.GrabFocus();
946cdf0e10cSrcweir }
947cdf0e10cSrcweir else
948cdf0e10cSrcweir aContentTree.GrabFocus();
949cdf0e10cSrcweir UsePage(0);
950cdf0e10cSrcweir aPageChgTimer.SetTimeoutHdl(LINK(this, SwNavigationPI, ChangePageHdl));
951cdf0e10cSrcweir aPageChgTimer.SetTimeout(PAGE_CHANGE_TIMEOUT);
952cdf0e10cSrcweir
953cdf0e10cSrcweir aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
954cdf0e10cSrcweir aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
955cdf0e10cSrcweir aDocListBox.SetAccessibleName(aStatusArr[3]);
956b7d08b69SAndre Fischer
957b7d08b69SAndre Fischer if (pContextWin == NULL)
958b7d08b69SAndre Fischer {
959b7d08b69SAndre Fischer // When the context window is missing then the navigator is
960b7d08b69SAndre Fischer // displayed in the sidebar. While the navigator could change
961b7d08b69SAndre Fischer // its size, the sidebar can not, and the navigator would just
962b7d08b69SAndre Fischer // waste space. Therefore hide this button.
963b7d08b69SAndre Fischer aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX));
964b7d08b69SAndre Fischer }
965cdf0e10cSrcweir }
966cdf0e10cSrcweir
967cdf0e10cSrcweir /*------------------------------------------------------------------------
968cdf0e10cSrcweir Beschreibung:
969cdf0e10cSrcweir ------------------------------------------------------------------------*/
970cdf0e10cSrcweir
~SwNavigationPI()971cdf0e10cSrcweir SwNavigationPI::~SwNavigationPI()
972cdf0e10cSrcweir {
973cdf0e10cSrcweir if(IsGlobalDoc() && !IsGlobalMode())
974cdf0e10cSrcweir {
975cdf0e10cSrcweir SwView *pView = GetCreateView();
976cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell();
977cdf0e10cSrcweir if( !rSh.IsAllProtect() )
978cdf0e10cSrcweir pView->GetDocShell()->SetReadOnlyUI(sal_False);
979cdf0e10cSrcweir }
980cdf0e10cSrcweir
981cdf0e10cSrcweir EndListening(*SFX_APP());
982cdf0e10cSrcweir
983cdf0e10cSrcweir SfxImageManager* pImgMan = SfxImageManager::GetImageManager( SW_MOD() );
984cdf0e10cSrcweir pImgMan->ReleaseToolBox(&aContentToolBox);
985cdf0e10cSrcweir pImgMan->ReleaseToolBox(&aGlobalToolBox);
986cdf0e10cSrcweir delete aContentToolBox.GetItemWindow(FN_PAGENUMBER);
987cdf0e10cSrcweir aContentToolBox.Clear();
988cdf0e10cSrcweir if(pxObjectShell)
989cdf0e10cSrcweir {
990cdf0e10cSrcweir if(pxObjectShell->Is())
991cdf0e10cSrcweir (*pxObjectShell)->DoClose();
992cdf0e10cSrcweir delete pxObjectShell;
993cdf0e10cSrcweir }
994cdf0e10cSrcweir delete pPopupWindow;
995cdf0e10cSrcweir delete pFloatingWindow;
996cdf0e10cSrcweir
997cdf0e10cSrcweir if ( IsBound() )
998cdf0e10cSrcweir rBindings.Release(*this);
999cdf0e10cSrcweir }
1000cdf0e10cSrcweir
1001cdf0e10cSrcweir /*------------------------------------------------------------------------
1002cdf0e10cSrcweir Beschreibung:
1003cdf0e10cSrcweir ------------------------------------------------------------------------*/
1004cdf0e10cSrcweir
SetPopupWindow(SfxPopupWindow * pWindow)1005cdf0e10cSrcweir void SwNavigationPI::SetPopupWindow( SfxPopupWindow* pWindow )
1006cdf0e10cSrcweir {
1007cdf0e10cSrcweir pPopupWindow = pWindow;
1008cdf0e10cSrcweir pPopupWindow->SetPopupModeEndHdl( LINK( this, SwNavigationPI, PopupModeEndHdl ));
1009cdf0e10cSrcweir pPopupWindow->SetDeleteLink_Impl( LINK( this, SwNavigationPI, ClosePopupWindow ));
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir
1012cdf0e10cSrcweir /*------------------------------------------------------------------------
1013cdf0e10cSrcweir Beschreibung:
1014cdf0e10cSrcweir ------------------------------------------------------------------------*/
1015cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,PopupModeEndHdl,void *,EMPTYARG)1016cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PopupModeEndHdl, void *, EMPTYARG )
1017cdf0e10cSrcweir {
1018cdf0e10cSrcweir if ( pPopupWindow->IsVisible() )
1019cdf0e10cSrcweir {
1020cdf0e10cSrcweir // Replace floating window with popup window and destroy
1021cdf0e10cSrcweir // floating window instance.
1022cdf0e10cSrcweir delete pFloatingWindow;
1023cdf0e10cSrcweir pFloatingWindow = pPopupWindow;
1024cdf0e10cSrcweir pPopupWindow = 0;
1025cdf0e10cSrcweir }
1026cdf0e10cSrcweir else
1027cdf0e10cSrcweir {
1028cdf0e10cSrcweir // Popup window has been closed by the user. No replacement, instance
1029cdf0e10cSrcweir // will destroy itself.
1030cdf0e10cSrcweir pPopupWindow = 0;
1031cdf0e10cSrcweir }
1032cdf0e10cSrcweir
1033cdf0e10cSrcweir return 1;
1034cdf0e10cSrcweir }
1035cdf0e10cSrcweir
1036cdf0e10cSrcweir /*------------------------------------------------------------------------
1037cdf0e10cSrcweir Beschreibung:
1038cdf0e10cSrcweir ------------------------------------------------------------------------*/
1039cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,ClosePopupWindow,SfxPopupWindow *,pWindow)1040cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ClosePopupWindow, SfxPopupWindow *, pWindow )
1041cdf0e10cSrcweir {
1042cdf0e10cSrcweir if ( pWindow == pFloatingWindow )
1043cdf0e10cSrcweir pFloatingWindow = 0;
1044cdf0e10cSrcweir else
1045cdf0e10cSrcweir pPopupWindow = 0;
1046cdf0e10cSrcweir
1047cdf0e10cSrcweir return 1;
1048cdf0e10cSrcweir }
1049cdf0e10cSrcweir
1050cdf0e10cSrcweir /*------------------------------------------------------------------------
1051cdf0e10cSrcweir Beschreibung:
1052cdf0e10cSrcweir ------------------------------------------------------------------------*/
1053cdf0e10cSrcweir
StateChanged(sal_uInt16 nSID,SfxItemState,const SfxPoolItem *)1054cdf0e10cSrcweir void SwNavigationPI::StateChanged( sal_uInt16 nSID, SfxItemState /*eState*/,
1055cdf0e10cSrcweir const SfxPoolItem* /*pState*/ )
1056cdf0e10cSrcweir {
1057cdf0e10cSrcweir if(nSID == SID_DOCFULLNAME)
1058cdf0e10cSrcweir {
1059cdf0e10cSrcweir SwView *pActView = GetCreateView();
1060cdf0e10cSrcweir if(pActView)
1061cdf0e10cSrcweir {
1062cdf0e10cSrcweir SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
1063cdf0e10cSrcweir aContentTree.SetActiveShell(pWrtShell);
1064cdf0e10cSrcweir sal_Bool bGlobal = IsGlobalDoc();
1065cdf0e10cSrcweir aContentToolBox.EnableItem(FN_GLOBAL_SWITCH, bGlobal);
1066cdf0e10cSrcweir if( (!bGlobal && IsGlobalMode()) ||
1067cdf0e10cSrcweir (!IsGlobalMode() && pConfig->IsGlobalActive()) )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir ToggleTree();
1070cdf0e10cSrcweir }
1071cdf0e10cSrcweir if(bGlobal)
1072cdf0e10cSrcweir {
1073cdf0e10cSrcweir aGlobalToolBox.CheckItem(FN_GLOBAL_SAVE_CONTENT, pWrtShell->IsGlblDocSaveLinks());
1074cdf0e10cSrcweir }
1075cdf0e10cSrcweir }
1076cdf0e10cSrcweir else
1077cdf0e10cSrcweir {
1078cdf0e10cSrcweir aContentTree.SetActiveShell(0);
1079cdf0e10cSrcweir }
1080cdf0e10cSrcweir UpdateListBox();
1081cdf0e10cSrcweir }
1082cdf0e10cSrcweir }
1083cdf0e10cSrcweir
1084cdf0e10cSrcweir /*------------------------------------------------------------------------
1085cdf0e10cSrcweir Bechreibung: NumericField aus der Toolbox holen
1086cdf0e10cSrcweir ------------------------------------------------------------------------*/
1087cdf0e10cSrcweir
GetPageEdit()1088cdf0e10cSrcweir NumEditAction& SwNavigationPI::GetPageEdit()
1089cdf0e10cSrcweir {
1090cdf0e10cSrcweir return *(NumEditAction*)aContentToolBox.GetItemWindow(FN_PAGENUMBER);
1091cdf0e10cSrcweir }
1092cdf0e10cSrcweir
1093cdf0e10cSrcweir /*------------------------------------------------------------------------
1094cdf0e10cSrcweir Beschreibung:
1095cdf0e10cSrcweir ------------------------------------------------------------------------*/
1096cdf0e10cSrcweir
CheckAlignment(SfxChildAlignment eActAlign,SfxChildAlignment eAlign)1097cdf0e10cSrcweir SfxChildAlignment SwNavigationPI::CheckAlignment
1098cdf0e10cSrcweir (
1099cdf0e10cSrcweir SfxChildAlignment eActAlign,
1100cdf0e10cSrcweir SfxChildAlignment eAlign
1101cdf0e10cSrcweir )
1102cdf0e10cSrcweir {
1103cdf0e10cSrcweir SfxChildAlignment eRetAlign;
1104cdf0e10cSrcweir
1105cdf0e10cSrcweir if(_IsZoomedIn())
1106cdf0e10cSrcweir eRetAlign = SFX_ALIGN_NOALIGNMENT;
1107cdf0e10cSrcweir else
1108cdf0e10cSrcweir switch (eAlign)
1109cdf0e10cSrcweir {
1110cdf0e10cSrcweir case SFX_ALIGN_BOTTOM:
1111cdf0e10cSrcweir case SFX_ALIGN_LOWESTBOTTOM:
1112cdf0e10cSrcweir case SFX_ALIGN_HIGHESTBOTTOM:
1113cdf0e10cSrcweir eRetAlign = eActAlign;
1114cdf0e10cSrcweir break;
1115cdf0e10cSrcweir
1116cdf0e10cSrcweir case SFX_ALIGN_TOP:
1117cdf0e10cSrcweir case SFX_ALIGN_HIGHESTTOP:
1118cdf0e10cSrcweir case SFX_ALIGN_LOWESTTOP:
1119cdf0e10cSrcweir case SFX_ALIGN_LEFT:
1120cdf0e10cSrcweir case SFX_ALIGN_RIGHT:
1121cdf0e10cSrcweir case SFX_ALIGN_FIRSTLEFT:
1122cdf0e10cSrcweir case SFX_ALIGN_LASTLEFT:
1123cdf0e10cSrcweir case SFX_ALIGN_FIRSTRIGHT:
1124cdf0e10cSrcweir case SFX_ALIGN_LASTRIGHT:
1125cdf0e10cSrcweir eRetAlign = eAlign;
1126cdf0e10cSrcweir break;
1127cdf0e10cSrcweir
1128cdf0e10cSrcweir default:
1129cdf0e10cSrcweir eRetAlign = eAlign;
1130cdf0e10cSrcweir break;
1131cdf0e10cSrcweir }
1132cdf0e10cSrcweir return eRetAlign;
1133cdf0e10cSrcweir
1134cdf0e10cSrcweir }
1135cdf0e10cSrcweir
1136cdf0e10cSrcweir /*--------------------------------------------------------------------
1137cdf0e10cSrcweir Beschreibung: Benachrichtigung bei geaenderter DocInfo
1138cdf0e10cSrcweir --------------------------------------------------------------------*/
1139cdf0e10cSrcweir
Notify(SfxBroadcaster & rBrdc,const SfxHint & rHint)1140cdf0e10cSrcweir void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
1141cdf0e10cSrcweir {
1142cdf0e10cSrcweir if(&rBrdc == pCreateView)
1143cdf0e10cSrcweir {
1144cdf0e10cSrcweir if(rHint.ISA(SfxSimpleHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
1145cdf0e10cSrcweir {
1146cdf0e10cSrcweir pCreateView = 0;
1147cdf0e10cSrcweir }
1148cdf0e10cSrcweir }
1149cdf0e10cSrcweir else
1150cdf0e10cSrcweir {
1151cdf0e10cSrcweir if(rHint.ISA(SfxEventHint))
1152cdf0e10cSrcweir {
1153cdf0e10cSrcweir if( pxObjectShell &&
1154cdf0e10cSrcweir ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP)
1155cdf0e10cSrcweir {
1156cdf0e10cSrcweir DELETEZ(pxObjectShell);
1157cdf0e10cSrcweir }
1158cdf0e10cSrcweir else if(((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_OPENDOC)
1159cdf0e10cSrcweir {
1160cdf0e10cSrcweir
1161cdf0e10cSrcweir SwView *pActView = GetCreateView();
1162cdf0e10cSrcweir if(pActView)
1163cdf0e10cSrcweir {
1164cdf0e10cSrcweir SwWrtShell* pWrtShell = pActView->GetWrtShellPtr();
1165cdf0e10cSrcweir aContentTree.SetActiveShell(pWrtShell);
1166cdf0e10cSrcweir if(aGlobalTree.IsVisible())
1167cdf0e10cSrcweir {
1168cdf0e10cSrcweir if(aGlobalTree.Update( sal_False ))
1169cdf0e10cSrcweir aGlobalTree.Display();
1170cdf0e10cSrcweir else
1171cdf0e10cSrcweir // wenn kein Update notwendig, dann zumindest painten
1172cdf0e10cSrcweir // wg. der roten Eintraege fuer broken links
1173cdf0e10cSrcweir aGlobalTree.Invalidate();
1174cdf0e10cSrcweir }
1175cdf0e10cSrcweir }
1176cdf0e10cSrcweir }
1177cdf0e10cSrcweir }
1178cdf0e10cSrcweir }
1179cdf0e10cSrcweir }
1180cdf0e10cSrcweir
1181cdf0e10cSrcweir /*--------------------------------------------------------------------
1182cdf0e10cSrcweir Beschreibung:
1183cdf0e10cSrcweir --------------------------------------------------------------------*/
1184cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,MenuSelectHdl,Menu *,pMenu)1185cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, MenuSelectHdl, Menu *, pMenu )
1186cdf0e10cSrcweir {
1187cdf0e10cSrcweir sal_uInt16 nMenuId = pMenu->GetCurItemId();
1188cdf0e10cSrcweir if(nMenuId != USHRT_MAX)
1189cdf0e10cSrcweir {
1190cdf0e10cSrcweir if(nMenuId < 100)
1191cdf0e10cSrcweir SetRegionDropMode( --nMenuId);
1192cdf0e10cSrcweir else
1193cdf0e10cSrcweir aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >(nMenuId - 100) );
1194cdf0e10cSrcweir }
1195cdf0e10cSrcweir return 0;
1196cdf0e10cSrcweir }
1197cdf0e10cSrcweir
1198cdf0e10cSrcweir
1199cdf0e10cSrcweir /*--------------------------------------------------------------------
1200cdf0e10cSrcweir Beschreibung:
1201cdf0e10cSrcweir --------------------------------------------------------------------*/
1202cdf0e10cSrcweir
UpdateListBox()1203cdf0e10cSrcweir void SwNavigationPI::UpdateListBox()
1204cdf0e10cSrcweir {
1205cdf0e10cSrcweir aDocListBox.SetUpdateMode(sal_False);
1206cdf0e10cSrcweir aDocListBox.Clear();
1207cdf0e10cSrcweir SwView *pActView = GetCreateView();
1208cdf0e10cSrcweir sal_Bool bDisable = pActView == 0;
1209cdf0e10cSrcweir SwView *pView = SwModule::GetFirstView();
1210cdf0e10cSrcweir sal_uInt16 nCount = 0;
1211cdf0e10cSrcweir sal_uInt16 nAct = 0;
1212cdf0e10cSrcweir sal_uInt16 nConstPos = 0;
1213cdf0e10cSrcweir const SwView* pConstView = aContentTree.IsConstantView() &&
1214cdf0e10cSrcweir aContentTree.GetActiveWrtShell() ?
1215cdf0e10cSrcweir &aContentTree.GetActiveWrtShell()->GetView():
1216cdf0e10cSrcweir 0;
1217cdf0e10cSrcweir while (pView)
1218cdf0e10cSrcweir {
1219cdf0e10cSrcweir SfxObjectShell* pDoc = pView->GetDocShell();
1220cdf0e10cSrcweir // pb: #i53333# don't show help pages here
1221cdf0e10cSrcweir if ( !pDoc->IsHelpDocument() )
1222cdf0e10cSrcweir {
1223cdf0e10cSrcweir String sEntry = pDoc->GetTitle();
1224cdf0e10cSrcweir sEntry += C2S(" (");
1225cdf0e10cSrcweir if (pView == pActView)
1226cdf0e10cSrcweir {
1227cdf0e10cSrcweir nAct = nCount;
1228cdf0e10cSrcweir sEntry += aStatusArr[ST_ACTIVE - ST_STATUS_FIRST];
1229cdf0e10cSrcweir }
1230cdf0e10cSrcweir else
1231cdf0e10cSrcweir sEntry += aStatusArr[ST_INACTIVE - ST_STATUS_FIRST];
1232cdf0e10cSrcweir sEntry += ')';
1233cdf0e10cSrcweir aDocListBox.InsertEntry(sEntry);
1234cdf0e10cSrcweir
1235cdf0e10cSrcweir
1236cdf0e10cSrcweir if (pConstView && pView == pConstView)
1237cdf0e10cSrcweir nConstPos = nCount;
1238cdf0e10cSrcweir
1239cdf0e10cSrcweir nCount++;
1240cdf0e10cSrcweir }
1241cdf0e10cSrcweir pView = SwModule::GetNextView(pView);
1242cdf0e10cSrcweir }
1243cdf0e10cSrcweir aDocListBox.InsertEntry(aStatusArr[3]); //"Aktives Fenster"
1244cdf0e10cSrcweir nCount++;
1245cdf0e10cSrcweir
1246cdf0e10cSrcweir if(aContentTree.GetHiddenWrtShell())
1247cdf0e10cSrcweir {
1248cdf0e10cSrcweir String sEntry = aContentTree.GetHiddenWrtShell()->GetView().
1249cdf0e10cSrcweir GetDocShell()->GetTitle();
1250cdf0e10cSrcweir sEntry += C2S(" (");
1251cdf0e10cSrcweir sEntry += aStatusArr[ST_HIDDEN - ST_STATUS_FIRST];
1252cdf0e10cSrcweir sEntry += ')';
1253cdf0e10cSrcweir aDocListBox.InsertEntry(sEntry);
1254cdf0e10cSrcweir bDisable = sal_False;
1255cdf0e10cSrcweir }
1256cdf0e10cSrcweir if(aContentTree.IsActiveView())
1257cdf0e10cSrcweir {
1258cdf0e10cSrcweir //entweder den Namen des akt. Docs oder "Aktives Dokument"
1259cdf0e10cSrcweir sal_uInt16 nTmp = pActView ? nAct : --nCount;
1260cdf0e10cSrcweir aDocListBox.SelectEntryPos( nTmp );
1261cdf0e10cSrcweir }
1262cdf0e10cSrcweir else if(aContentTree.IsHiddenView())
1263cdf0e10cSrcweir {
1264cdf0e10cSrcweir aDocListBox.SelectEntryPos(nCount);
1265cdf0e10cSrcweir }
1266cdf0e10cSrcweir else
1267cdf0e10cSrcweir aDocListBox.SelectEntryPos(nConstPos);
1268cdf0e10cSrcweir
1269cdf0e10cSrcweir aDocListBox.Enable( !bDisable );
1270cdf0e10cSrcweir aDocListBox.SetUpdateMode(sal_True);
1271cdf0e10cSrcweir }
1272cdf0e10cSrcweir
1273cdf0e10cSrcweir /*-----------------16.06.97 15:05-------------------
1274cdf0e10cSrcweir
1275cdf0e10cSrcweir --------------------------------------------------*/
1276cdf0e10cSrcweir
1277cdf0e10cSrcweir /*------------------------------------------------------------------------
1278cdf0e10cSrcweir Beschreibung:
1279cdf0e10cSrcweir ------------------------------------------------------------------------*/
1280cdf0e10cSrcweir
IMPL_LINK(SwNavigationPI,DoneLink,SfxPoolItem *,pItem)1281cdf0e10cSrcweir IMPL_LINK(SwNavigationPI, DoneLink, SfxPoolItem *, pItem)
1282cdf0e10cSrcweir {
1283cdf0e10cSrcweir const SfxViewFrameItem* pFrameItem = PTR_CAST(SfxViewFrameItem, pItem );
1284cdf0e10cSrcweir if( pFrameItem )
1285cdf0e10cSrcweir {
1286cdf0e10cSrcweir SfxViewFrame* pFrame = pFrameItem->GetFrame();
1287cdf0e10cSrcweir if(pFrame)
1288cdf0e10cSrcweir {
1289cdf0e10cSrcweir aContentTree.Clear();
1290cdf0e10cSrcweir pContentView = PTR_CAST(SwView, pFrame->GetViewShell());
1291cdf0e10cSrcweir DBG_ASSERT(pContentView, "keine SwView");
1292cdf0e10cSrcweir if(pContentView)
1293cdf0e10cSrcweir pContentWrtShell = pContentView->GetWrtShellPtr();
1294cdf0e10cSrcweir else
1295cdf0e10cSrcweir pContentWrtShell = 0;
1296cdf0e10cSrcweir pxObjectShell = new SfxObjectShellLock(pFrame->GetObjectShell());
1297cdf0e10cSrcweir FillBox();
1298cdf0e10cSrcweir aContentTree.Update();
1299cdf0e10cSrcweir }
1300cdf0e10cSrcweir }
1301cdf0e10cSrcweir return 0;
1302cdf0e10cSrcweir }
1303cdf0e10cSrcweir
CreateDropFileName(TransferableDataHelper & rData)1304cdf0e10cSrcweir String SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
1305cdf0e10cSrcweir {
1306cdf0e10cSrcweir String sFileName;
1307cdf0e10cSrcweir sal_uLong nFmt;
1308cdf0e10cSrcweir if( rData.HasFormat( nFmt = FORMAT_FILE_LIST ))
1309cdf0e10cSrcweir {
1310cdf0e10cSrcweir FileList aFileList;
1311cdf0e10cSrcweir rData.GetFileList( nFmt, aFileList );
1312cdf0e10cSrcweir sFileName = aFileList.GetFile( 0 );
1313cdf0e10cSrcweir }
1314cdf0e10cSrcweir else if( rData.HasFormat( nFmt = FORMAT_STRING ) ||
1315cdf0e10cSrcweir rData.HasFormat( nFmt = FORMAT_FILE ) ||
1316cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME ))
1317cdf0e10cSrcweir rData.GetString( nFmt, sFileName );
1318cdf0e10cSrcweir else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) ||
1319cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
1320cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) ||
1321cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
1322cdf0e10cSrcweir rData.HasFormat( nFmt = SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ))
1323cdf0e10cSrcweir {
1324cdf0e10cSrcweir INetBookmark aBkmk( aEmptyStr, aEmptyStr );
1325cdf0e10cSrcweir rData.GetINetBookmark( nFmt, aBkmk );
1326cdf0e10cSrcweir sFileName = aBkmk.GetURL();
1327cdf0e10cSrcweir }
1328cdf0e10cSrcweir if( sFileName.Len() )
1329cdf0e10cSrcweir {
1330cdf0e10cSrcweir sFileName = INetURLObject( sFileName ).GetMainURL( INetURLObject::NO_DECODE );
1331cdf0e10cSrcweir }
1332cdf0e10cSrcweir return sFileName;
1333cdf0e10cSrcweir }
1334cdf0e10cSrcweir
1335cdf0e10cSrcweir /*------------------------------------------------------------------------
1336cdf0e10cSrcweir Beschreibung:
1337cdf0e10cSrcweir ------------------------------------------------------------------------*/
1338cdf0e10cSrcweir
AcceptDrop(const AcceptDropEvent &)1339cdf0e10cSrcweir sal_Int8 SwNavigationPI::AcceptDrop( const AcceptDropEvent& /*rEvt*/ )
1340cdf0e10cSrcweir {
1341cdf0e10cSrcweir return ( !aContentTree.IsInDrag() &&
1342cdf0e10cSrcweir ( aContentTree.IsDropFormatSupported( FORMAT_FILE ) ||
1343cdf0e10cSrcweir aContentTree.IsDropFormatSupported( FORMAT_STRING ) ||
1344cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK ) ||
1345cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
1346cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT ) ||
1347cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR ) ||
1348cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR ) ||
1349cdf0e10cSrcweir aContentTree.IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME )))
1350cdf0e10cSrcweir ? DND_ACTION_COPY
1351cdf0e10cSrcweir : DND_ACTION_NONE;
1352cdf0e10cSrcweir }
1353cdf0e10cSrcweir
ExecuteDrop(const ExecuteDropEvent & rEvt)1354cdf0e10cSrcweir sal_Int8 SwNavigationPI::ExecuteDrop( const ExecuteDropEvent& rEvt )
1355cdf0e10cSrcweir {
1356cdf0e10cSrcweir TransferableDataHelper aData( rEvt.maDropEvent.Transferable );
1357cdf0e10cSrcweir sal_Int8 nRet = DND_ACTION_NONE;
1358cdf0e10cSrcweir String sFileName;
1359cdf0e10cSrcweir if( !aContentTree.IsInDrag() &&
1360cdf0e10cSrcweir 0 != (sFileName = SwNavigationPI::CreateDropFileName( aData )).Len() )
1361cdf0e10cSrcweir {
1362cdf0e10cSrcweir INetURLObject aTemp( sFileName );
1363cdf0e10cSrcweir GraphicDescriptor aDesc( aTemp );
1364cdf0e10cSrcweir if( !aDesc.Detect() ) // keine Grafiken annehmen
1365cdf0e10cSrcweir {
1366cdf0e10cSrcweir if( STRING_NOTFOUND == sFileName.Search('#')
1367cdf0e10cSrcweir && (!sContentFileName.Len() || sContentFileName != sFileName ))
1368cdf0e10cSrcweir {
1369cdf0e10cSrcweir nRet = rEvt.mnAction;
1370cdf0e10cSrcweir sFileName.EraseTrailingChars( char(0) );
1371cdf0e10cSrcweir sContentFileName = sFileName;
1372cdf0e10cSrcweir if(pxObjectShell)
1373cdf0e10cSrcweir {
1374cdf0e10cSrcweir aContentTree.SetHiddenShell( 0 );
1375cdf0e10cSrcweir (*pxObjectShell)->DoClose();
1376cdf0e10cSrcweir DELETEZ( pxObjectShell);
1377cdf0e10cSrcweir }
1378cdf0e10cSrcweir SfxStringItem aFileItem(SID_FILE_NAME, sFileName );
1379cdf0e10cSrcweir String sOptions = C2S("HRC");
1380cdf0e10cSrcweir SfxStringItem aOptionsItem( SID_OPTIONS, sOptions );
1381cdf0e10cSrcweir SfxLinkItem aLink( SID_DONELINK,
1382cdf0e10cSrcweir LINK( this, SwNavigationPI, DoneLink ) );
1383cdf0e10cSrcweir GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(
1384cdf0e10cSrcweir SID_OPENDOC, SFX_CALLMODE_ASYNCHRON,
1385cdf0e10cSrcweir &aFileItem, &aOptionsItem, &aLink, 0L );
1386cdf0e10cSrcweir }
1387cdf0e10cSrcweir }
1388cdf0e10cSrcweir }
1389cdf0e10cSrcweir return nRet;
1390cdf0e10cSrcweir }
1391cdf0e10cSrcweir
1392cdf0e10cSrcweir /*-----------------27.11.96 13.00-------------------
1393cdf0e10cSrcweir
1394cdf0e10cSrcweir --------------------------------------------------*/
1395cdf0e10cSrcweir
SetRegionDropMode(sal_uInt16 nNewMode)1396cdf0e10cSrcweir void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode)
1397cdf0e10cSrcweir {
1398cdf0e10cSrcweir nRegionMode = nNewMode;
1399cdf0e10cSrcweir pConfig->SetRegionMode( nRegionMode );
1400cdf0e10cSrcweir
1401cdf0e10cSrcweir sal_uInt16 nDropId = FN_DROP_REGION;
1402cdf0e10cSrcweir if(nRegionMode == REGION_MODE_LINK)
1403cdf0e10cSrcweir nDropId = FN_DROP_REGION_LINK;
1404cdf0e10cSrcweir else if(nRegionMode == REGION_MODE_EMBEDDED)
1405cdf0e10cSrcweir nDropId = FN_DROP_REGION_COPY;
1406cdf0e10cSrcweir
1407cdf0e10cSrcweir ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode()
1408cdf0e10cSrcweir ? aContentImageListH : aContentImageList;
1409cdf0e10cSrcweir
1410cdf0e10cSrcweir aContentToolBox.SetItemImage( FN_DROP_REGION,
1411cdf0e10cSrcweir rImgLst.GetImage(nDropId));
1412cdf0e10cSrcweir }
1413cdf0e10cSrcweir
1414cdf0e10cSrcweir
1415cdf0e10cSrcweir /*-----------------12.06.97 09:47-------------------
1416cdf0e10cSrcweir
1417cdf0e10cSrcweir --------------------------------------------------*/
1418cdf0e10cSrcweir
ToggleTree()1419cdf0e10cSrcweir sal_Bool SwNavigationPI::ToggleTree()
1420cdf0e10cSrcweir {
1421cdf0e10cSrcweir sal_Bool bRet = sal_True;
1422cdf0e10cSrcweir sal_Bool bGlobalDoc = IsGlobalDoc();
1423cdf0e10cSrcweir if(!IsGlobalMode() && bGlobalDoc)
1424cdf0e10cSrcweir {
1425cdf0e10cSrcweir SetUpdateMode(sal_False);
1426cdf0e10cSrcweir if(_IsZoomedIn())
1427cdf0e10cSrcweir _ZoomOut();
1428cdf0e10cSrcweir aGlobalTree.ShowTree();
1429cdf0e10cSrcweir aGlobalToolBox.Show();
1430cdf0e10cSrcweir aContentTree.HideTree();
1431cdf0e10cSrcweir aContentToolBox.Hide();
1432cdf0e10cSrcweir aDocListBox.Hide();
1433cdf0e10cSrcweir SetGlobalMode(sal_True);
1434cdf0e10cSrcweir SetUpdateMode(sal_True);
1435cdf0e10cSrcweir }
1436cdf0e10cSrcweir else
1437cdf0e10cSrcweir {
1438cdf0e10cSrcweir aGlobalTree.HideTree();
1439cdf0e10cSrcweir aGlobalToolBox.Hide();
1440cdf0e10cSrcweir if(!_IsZoomedIn())
1441cdf0e10cSrcweir {
1442cdf0e10cSrcweir aContentTree.ShowTree();
1443cdf0e10cSrcweir aContentToolBox.Show();
1444cdf0e10cSrcweir aDocListBox.Show();
1445cdf0e10cSrcweir }
1446cdf0e10cSrcweir bRet = sal_False;
1447cdf0e10cSrcweir SetGlobalMode(sal_False);
1448cdf0e10cSrcweir }
1449cdf0e10cSrcweir return bRet;
1450cdf0e10cSrcweir }
1451cdf0e10cSrcweir
1452cdf0e10cSrcweir /*-----------------13.06.97 09:42-------------------
1453cdf0e10cSrcweir
1454cdf0e10cSrcweir --------------------------------------------------*/
IsGlobalDoc() const1455cdf0e10cSrcweir sal_Bool SwNavigationPI::IsGlobalDoc() const
1456cdf0e10cSrcweir {
1457cdf0e10cSrcweir sal_Bool bRet = sal_False;
1458cdf0e10cSrcweir SwView *pView = GetCreateView();
1459cdf0e10cSrcweir if(pView)
1460cdf0e10cSrcweir {
1461cdf0e10cSrcweir SwWrtShell &rSh = pView->GetWrtShell();
1462cdf0e10cSrcweir bRet = rSh.IsGlobalDoc();
1463cdf0e10cSrcweir }
1464cdf0e10cSrcweir return bRet;
1465cdf0e10cSrcweir }
1466cdf0e10cSrcweir /* -----------------26.10.98 08:10-------------------
1467cdf0e10cSrcweir *
1468cdf0e10cSrcweir * --------------------------------------------------*/
IMPL_LINK(SwNavigationPI,ChangePageHdl,Timer *,EMPTYARG)1469cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, ChangePageHdl, Timer*, EMPTYARG )
1470cdf0e10cSrcweir {
1471cdf0e10cSrcweir EditAction(&GetPageEdit());
1472cdf0e10cSrcweir GetPageEdit().GrabFocus();
1473cdf0e10cSrcweir return 0;
1474cdf0e10cSrcweir }
1475cdf0e10cSrcweir /* -----------------26.10.98 08:14-------------------
1476cdf0e10cSrcweir *
1477cdf0e10cSrcweir * --------------------------------------------------*/
IMPL_LINK(SwNavigationPI,PageEditModifyHdl,Edit *,EMPTYARG)1478cdf0e10cSrcweir IMPL_LINK( SwNavigationPI, PageEditModifyHdl, Edit*, EMPTYARG )
1479cdf0e10cSrcweir {
1480cdf0e10cSrcweir if(aPageChgTimer.IsActive())
1481cdf0e10cSrcweir aPageChgTimer.Stop();
1482cdf0e10cSrcweir aPageChgTimer.Start();
1483cdf0e10cSrcweir return 0;
1484cdf0e10cSrcweir }
1485cdf0e10cSrcweir
1486cdf0e10cSrcweir /* -----------------------------23.04.01 07:34--------------------------------
1487cdf0e10cSrcweir
1488cdf0e10cSrcweir ---------------------------------------------------------------------------*/
GetCreateView() const1489cdf0e10cSrcweir SwView* SwNavigationPI::GetCreateView() const
1490cdf0e10cSrcweir {
1491cdf0e10cSrcweir if(!pCreateView)
1492cdf0e10cSrcweir {
1493cdf0e10cSrcweir SwView* pView = SwModule::GetFirstView();
1494cdf0e10cSrcweir while(pView)
1495cdf0e10cSrcweir {
1496cdf0e10cSrcweir if(&pView->GetViewFrame()->GetBindings() == &rBindings)
1497cdf0e10cSrcweir {
1498cdf0e10cSrcweir ((SwNavigationPI*)this)->pCreateView = pView;
1499cdf0e10cSrcweir ((SwNavigationPI*)this)->StartListening(*pCreateView);
1500cdf0e10cSrcweir break;
1501cdf0e10cSrcweir }
1502cdf0e10cSrcweir pView = SwModule::GetNextView(pView);
1503cdf0e10cSrcweir }
1504cdf0e10cSrcweir }
1505cdf0e10cSrcweir return pCreateView;
1506cdf0e10cSrcweir }
1507cdf0e10cSrcweir
1508cdf0e10cSrcweir
1509cdf0e10cSrcweir /*------------------------------------------------------------------------
1510cdf0e10cSrcweir Beschreibung:
1511cdf0e10cSrcweir ------------------------------------------------------------------------*/
1512cdf0e10cSrcweir
SwNavigationChild(Window * pParent,sal_uInt16 nId,SfxBindings * _pBindings,SfxChildWinInfo * pInfo)1513cdf0e10cSrcweir SwNavigationChild::SwNavigationChild( Window* pParent,
1514cdf0e10cSrcweir sal_uInt16 nId,
1515cdf0e10cSrcweir SfxBindings* _pBindings,
1516cdf0e10cSrcweir SfxChildWinInfo* pInfo )
1517cdf0e10cSrcweir : SfxChildWindowContext( nId )
1518cdf0e10cSrcweir {
1519cdf0e10cSrcweir SwNavigationPI* pNavi = new SwNavigationPI( _pBindings, this, pParent );
1520cdf0e10cSrcweir SetWindow( pNavi );
1521cdf0e10cSrcweir _pBindings->Invalidate(SID_NAVIGATOR);
1522cdf0e10cSrcweir String sExtra = pInfo->aExtraString;
1523cdf0e10cSrcweir
1524cdf0e10cSrcweir SwNavigationConfig* pNaviConfig = SW_MOD()->GetNavigationConfig();
1525cdf0e10cSrcweir
1526cdf0e10cSrcweir sal_uInt16 nRootType = static_cast< sal_uInt16 >( pNaviConfig->GetRootType() );
1527cdf0e10cSrcweir if( nRootType < CONTENT_TYPE_MAX )
1528cdf0e10cSrcweir {
1529cdf0e10cSrcweir pNavi->aContentTree.SetRootType(nRootType);
1530cdf0e10cSrcweir pNavi->aContentToolBox.CheckItem(FN_SHOW_ROOT, sal_True);
1531cdf0e10cSrcweir }
1532cdf0e10cSrcweir pNavi->aContentTree.SetOutlineLevel( static_cast< sal_uInt8 >( pNaviConfig->GetOutlineLevel() ) );
1533cdf0e10cSrcweir pNavi->SetRegionDropMode( static_cast< sal_uInt16 >( pNaviConfig->GetRegionMode() ) );
1534cdf0e10cSrcweir
1535cdf0e10cSrcweir if(GetFloatingWindow() && pNaviConfig->IsSmall())
1536cdf0e10cSrcweir {
1537cdf0e10cSrcweir pNavi->_ZoomIn();
1538cdf0e10cSrcweir }
1539cdf0e10cSrcweir }
1540cdf0e10cSrcweir /* -----------------------------06.05.2002 10:06------------------------------
1541cdf0e10cSrcweir
1542cdf0e10cSrcweir ---------------------------------------------------------------------------*/
DataChanged(const DataChangedEvent & rDCEvt)1543cdf0e10cSrcweir void SwNavigationPI::DataChanged( const DataChangedEvent& rDCEvt )
1544cdf0e10cSrcweir {
1545cdf0e10cSrcweir Window::DataChanged( rDCEvt );
1546cdf0e10cSrcweir if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
1547cdf0e10cSrcweir (rDCEvt.GetFlags() & SETTINGS_STYLE) )
1548cdf0e10cSrcweir {
1549cdf0e10cSrcweir InitImageList();
1550cdf0e10cSrcweir const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings();
1551cdf0e10cSrcweir Color aBgColor = rStyleSettings.GetFaceColor();
1552cdf0e10cSrcweir Wallpaper aBack( aBgColor );
1553cdf0e10cSrcweir SetBackground( aBack );
1554cdf0e10cSrcweir }
1555cdf0e10cSrcweir }
1556cdf0e10cSrcweir /* -----------------------------06.05.2002 10:07------------------------------
1557cdf0e10cSrcweir
1558cdf0e10cSrcweir ---------------------------------------------------------------------------*/
InitImageList()1559cdf0e10cSrcweir void SwNavigationPI::InitImageList()
1560cdf0e10cSrcweir {
1561cdf0e10cSrcweir sal_uInt16 k;
1562cdf0e10cSrcweir
1563cdf0e10cSrcweir ImageList& rImgLst = aContentToolBox.GetSettings().GetStyleSettings().GetHighContrastMode() ?
1564cdf0e10cSrcweir aContentImageListH : aContentImageList;
1565cdf0e10cSrcweir for( k = 0; k < aContentToolBox.GetItemCount(); k++)
1566cdf0e10cSrcweir aContentToolBox.SetItemImage(aContentToolBox.GetItemId(k),
1567cdf0e10cSrcweir rImgLst.GetImage(aContentToolBox.GetItemId(k)));
1568cdf0e10cSrcweir
1569cdf0e10cSrcweir for( k = 0; k < aGlobalToolBox.GetItemCount(); k++)
1570cdf0e10cSrcweir aGlobalToolBox.SetItemImage(aGlobalToolBox.GetItemId(k),
1571cdf0e10cSrcweir rImgLst.GetImage(aGlobalToolBox.GetItemId(k)));
1572cdf0e10cSrcweir
1573cdf0e10cSrcweir sal_uInt16 nDropId = FN_DROP_REGION;
1574cdf0e10cSrcweir if(nRegionMode == REGION_MODE_LINK)
1575cdf0e10cSrcweir nDropId = FN_DROP_REGION_LINK;
1576cdf0e10cSrcweir else if(nRegionMode == REGION_MODE_EMBEDDED)
1577cdf0e10cSrcweir nDropId = FN_DROP_REGION_COPY;
1578cdf0e10cSrcweir aContentToolBox.SetItemImage( FN_DROP_REGION,
1579cdf0e10cSrcweir rImgLst.GetImage(nDropId));
1580cdf0e10cSrcweir }
1581cdf0e10cSrcweir
1582