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