1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <comphelper/string.hxx>
22 #include <svl/urlbmk.hxx>
23 #include <svl/stritem.hxx>
24 #include <vcl/graphicfilter.hxx>
25 #include <svl/urihelper.hxx>
26 #include <sot/formats.hxx>
27 #include <sot/filelist.hxx>
28 #include <sfx2/event.hxx>
29 #include <sfx2/imgmgr.hxx>
30 #include <sfx2/dispatch.hxx>
31 #include <sfx2/dockwin.hxx>
32 #include <vcl/toolbox.hxx>
33 #include <swtypes.hxx> // for pathfinder
34 #include <swmodule.hxx>
36 #include <navicfg.hxx>
39 #include <actctrl.hxx>
42 #include <content.hxx>
43 #include <workctrl.hxx>
44 #include <section.hxx>
46 #include <sfx2/app.hxx>
57 #define PAGE_CHANGE_TIMEOUT 1000
59 using namespace ::com::sun::star::uno
;
60 using namespace ::com::sun::star::frame
;
62 SFX_IMPL_CHILDWINDOW_CONTEXT( SwNavigationChild
, SID_NAVIGATOR
, SwView
)
64 // Filter the control characters out of the Outline-Entry
66 void SwNavigationPI::CleanEntry( String
& rEntry
)
68 sal_uInt16 i
= rEntry
.Len();
70 for( sal_Unicode
* pStr
= rEntry
.GetBufferAccess(); i
; --i
, ++pStr
)
71 if( *pStr
== 10 || *pStr
== 9 )
75 // Execution of the drag operation with and without the children.
77 void SwNavigationPI::MoveOutline(sal_uInt16 nSource
, sal_uInt16 nTarget
,
80 SwView
*pView
= GetCreateView();
81 SwWrtShell
&rSh
= pView
->GetWrtShell();
82 if(nTarget
< nSource
|| nTarget
== USHRT_MAX
)
84 if ( rSh
.IsOutlineMovable( nSource
))
87 short nMove
= nTarget
-nSource
; //( nDir<0 ) ? 1 : 0 ;
88 rSh
.GotoOutline(nSource
);
90 rSh
.MakeOutlineSel(nSource
, nSource
, sal_True
);
91 // While moving, the selected children does not counting.
92 sal_uInt16 nLastOutlinePos
= rSh
.GetOutlinePos(MAXLEVEL
);
93 if(bWithChildren
&& nMove
> 1 &&
94 nLastOutlinePos
< nTarget
)
96 if(!rSh
.IsCrsrPtAtEnd())
98 nMove
-= nLastOutlinePos
- nSource
;
100 if(!bWithChildren
|| nMove
< 1 || nLastOutlinePos
< nTarget
)
101 rSh
.MoveOutlinePara( nMove
);
103 rSh
.GotoOutline( nSource
+ nMove
);
109 // After goto cancel the status frame selection
111 static void lcl_UnSelectFrm(SwWrtShell
*pSh
)
113 if (pSh
->IsFrmSelected())
116 pSh
->LeaveSelFrmMode();
120 // Select the document view
122 IMPL_LINK( SwNavigationPI
, DocListBoxSelectHdl
, ListBox
*, pBox
)
124 int nEntryIdx
= pBox
->GetSelectEntryPos();
126 pView
= SwModule::GetFirstView();
127 while (nEntryIdx
-- && pView
)
129 pView
= SwModule::GetNextView(pView
);
134 aContentTree
.ShowHiddenShell():
135 aContentTree
.ShowActualView();
141 aContentTree
.SetConstantShell(pView
->GetWrtShellPtr());
146 // Filling of the list box for outline view or documents
147 // The PI will be set to full size
149 void SwNavigationPI::FillBox()
153 aContentTree
.SetHiddenShell( pContentWrtShell
);
154 aContentTree
.Display( sal_False
);
158 SwView
*pView
= GetCreateView();
161 aContentTree
.SetActiveShell(0);
163 else if( pView
!= pActContView
)
165 SwWrtShell
* pWrtShell
= pView
->GetWrtShellPtr();
166 aContentTree
.SetActiveShell(pWrtShell
);
169 aContentTree
.Display( sal_True
);
170 pActContView
= pView
;
174 void SwNavigationPI::UsePage(SwWrtShell
*pSh
)
178 SwView
*pView
= GetCreateView();
179 pSh
= pView
? &pView
->GetWrtShell() : 0;
180 GetPageEdit().SetValue(1);
184 const sal_uInt16 nPageCnt
= pSh
->GetPageCnt();
185 sal_uInt16 nPhyPage
, nVirPage
;
186 pSh
->GetPageNum(nPhyPage
, nVirPage
);
188 GetPageEdit().SetMax(nPageCnt
);
189 GetPageEdit().SetLast(nPageCnt
);
190 GetPageEdit().SetValue(nPhyPage
);
194 // Select handler of the toolboxes
196 IMPL_LINK( SwNavigationPI
, ToolBoxSelectHdl
, ToolBox
*, pBox
)
198 const sal_uInt16 nCurrItemId
= pBox
->GetCurItemId();
199 SwView
*pView
= GetCreateView();
202 SwWrtShell
&rSh
= pView
->GetWrtShell();
203 // Get MouseModifier for Outline-Move
205 // Standard: sublevels are taken
206 // do not take sublevels with Ctrl
207 sal_Bool bOutlineWithChildren
= ( KEY_MOD1
!= pBox
->GetModifier());
209 bool bFocusToDoc
= false;
215 // #i75416# move the execution of the search to an asynchronously called static link
216 bool* pbNext
= new bool( FN_DOWN
== nCurrItemId
);
217 Application::PostUserEvent( STATIC_LINK(pView
, SwView
, MoveNavigationHdl
), pbNext
);
222 aContentTree
.ToggleToRoot();
225 case FN_SHOW_CONTENT_BOX
:
226 case FN_SELECT_CONTENT
:
227 if(pContextWin
!=NULL
&& pContextWin
->GetFloatingWindow()!=NULL
)
239 // Functions that will trigger a direct action.
241 case FN_SELECT_FOOTER
:
244 const sal_uInt16 eType
= rSh
.GetFrmType(0,sal_False
);
245 if (eType
& FRMTYPE_FOOTER
)
248 nFuncId
= FN_END_OF_PAGE
;
250 else if (rSh
.GotoFooterTxt())
251 nFuncId
= FN_TO_FOOTER
;
255 case FN_SELECT_HEADER
:
258 const sal_uInt16 eType
= rSh
.GetFrmType(0,sal_False
);
259 if (eType
& FRMTYPE_HEADER
)
262 nFuncId
= FN_START_OF_PAGE
;
264 else if (rSh
.GotoHeaderTxt())
265 nFuncId
= FN_TO_HEADER
;
269 case FN_SELECT_FOOTNOTE
:
272 const sal_uInt16 eFrmType
= rSh
.GetFrmType(0,sal_False
);
273 // Jump from the footnote to the anchor.
274 if (eFrmType
& FRMTYPE_FOOTNOTE
)
276 if (rSh
.GotoFtnAnchor())
277 nFuncId
= FN_FOOTNOTE_TO_ANCHOR
;
279 // Otherwise, jump to the first footnote text;
280 // go to the next footnote if this is not possible;
281 // if this is also not possible got to the footnote before.
284 if (rSh
.GotoFtnTxt())
285 nFuncId
= FN_FOOTNOTE_TO_ANCHOR
;
286 else if (rSh
.GotoNextFtnAnchor())
287 nFuncId
= FN_NEXT_FOOTNOTE
;
288 else if (rSh
.GotoPrevFtnAnchor())
289 nFuncId
= FN_PREV_FOOTNOTE
;
295 case FN_SELECT_SET_AUTO_BOOKMARK
:
305 aGlobalTree
.ExecCommand(nCurrItemId
);
307 aContentTree
.ExecCommand(nCurrItemId
, bOutlineWithChildren
);
310 case FN_GLOBAL_SWITCH
:
313 pConfig
->SetGlobalActive(IsGlobalMode());
316 case FN_GLOBAL_SAVE_CONTENT
:
318 sal_Bool bSave
= rSh
.IsGlblDocSaveLinks();
319 rSh
.SetGlblDocSaveLinks( !bSave
);
320 pBox
->CheckItem(FN_GLOBAL_SAVE_CONTENT
, !bSave
);
326 lcl_UnSelectFrm(&rSh
);
329 pView
->GetEditWin().GrabFocus();
333 // Click handler of the toolboxes
335 IMPL_LINK( SwNavigationPI
, ToolBoxClickHdl
, ToolBox
*, pBox
)
337 const sal_uInt16 nCurrItemId
= pBox
->GetCurItemId();
340 case FN_GLOBAL_UPDATE
:
343 aGlobalTree
.TbxMenuHdl(nCurrItemId
, pBox
);
351 IMPL_LINK( SwNavigationPI
, ToolBoxDropdownClickHdl
, ToolBox
*, pBox
)
353 const sal_uInt16 nCurrItemId
= pBox
->GetCurItemId();
356 case FN_CREATE_NAVIGATION
:
358 CreateNavigationTool(pBox
->GetItemRect(FN_CREATE_NAVIGATION
), true);
364 static const char* aHIDs
[] =
370 PopupMenu
*pMenu
= new PopupMenu
;
371 for (sal_uInt16 i
= 0; i
<= REGION_MODE_EMBEDDED
; i
++)
373 pMenu
->InsertItem( i
+ 1, aContextArr
[i
] );
374 pMenu
->SetHelpId(i
+ 1, aHIDs
[i
]);
376 pMenu
->CheckItem( nRegionMode
+ 1 );
377 pMenu
->SetSelectHdl(LINK(this, SwNavigationPI
, MenuSelectHdl
));
378 pBox
->SetItemDown( nCurrItemId
, sal_True
);
379 pMenu
->Execute( pBox
,
380 pBox
->GetItemRect(FN_DROP_REGION
),
381 POPUPMENU_EXECUTE_DOWN
);
382 pBox
->SetItemDown( nCurrItemId
, sal_False
);
383 pBox
->EndSelection();
388 case FN_OUTLINE_LEVEL
:
390 PopupMenu
*pMenu
= new PopupMenu
;
391 for (sal_uInt16 i
= 101; i
<= 100 + MAXLEVEL
; i
++)
393 pMenu
->InsertItem( i
, OUString::number(i
- 100) );
394 pMenu
->SetHelpId( i
, HID_NAVI_OUTLINES
);
396 pMenu
->CheckItem( aContentTree
.GetOutlineLevel() + 100 );
397 pMenu
->SetSelectHdl(LINK(this, SwNavigationPI
, MenuSelectHdl
));
398 pBox
->SetItemDown( nCurrItemId
, sal_True
);
399 pMenu
->Execute( pBox
,
400 pBox
->GetItemRect(FN_OUTLINE_LEVEL
),
401 POPUPMENU_EXECUTE_DOWN
);
402 pBox
->SetItemDown( nCurrItemId
, sal_False
);
404 pBox
->EndSelection();
412 SwNavHelpToolBox::SwNavHelpToolBox(SwNavigationPI
* pParent
, const ResId
&rResId
) :
413 SwHelpToolBox(pParent
, rResId
)
416 void SwNavHelpToolBox::MouseButtonDown(const MouseEvent
&rEvt
)
418 if(rEvt
.GetButtons() == MOUSE_LEFT
&&
419 FN_CREATE_NAVIGATION
== GetItemId(rEvt
.GetPosPixel()))
421 ((SwNavigationPI
*)GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION
), false);
424 SwHelpToolBox::MouseButtonDown(rEvt
);
427 void SwNavigationPI::CreateNavigationTool(const Rectangle
& rRect
, bool bSetFocus
)
429 Reference
< XFrame
> xFrame
= GetCreateView()->GetViewFrame()->GetFrame().GetFrameInterface();
430 SwScrollNaviPopup
* pPopup
= new
431 SwScrollNaviPopup(FN_SCROLL_NAVIGATION
,
434 Rectangle
aRect(rRect
);
435 Point aT1
= aRect
.TopLeft();
436 aT1
= pPopup
->GetParent()->OutputToScreenPixel(pPopup
->GetParent()->AbsoluteScreenToOutputPixel(aContentToolBox
.OutputToAbsoluteScreenPixel(aT1
)));
438 pPopup
->StartPopupMode(aRect
, FLOATWIN_POPUPMODE_RIGHT
|FLOATWIN_POPUPMODE_ALLOWTEAROFF
);
439 SetPopupWindow( pPopup
);
442 pPopup
->EndPopupMode(FLOATWIN_POPUPMODEEND_TEAROFF
);
447 void SwNavHelpToolBox::RequestHelp( const HelpEvent
& rHEvt
)
449 sal_uInt16 nItemId
= GetItemId(ScreenToOutputPixel(rHEvt
.GetMousePosPixel()));
450 if( FN_UP
== nItemId
|| FN_DOWN
== nItemId
)
452 SetItemText(nItemId
, SwScrollNaviPopup::GetQuickHelpText((FN_DOWN
== nItemId
)));
454 SwHelpToolBox::RequestHelp(rHEvt
);
457 // Action-Handler Edit:
458 // Switches to the page if the structure view is not turned on.
460 IMPL_LINK( SwNavigationPI
, EditAction
, NumEditAction
*, pEdit
)
462 SwView
*pView
= GetCreateView();
465 if(aPageChgTimer
.IsActive())
466 aPageChgTimer
.Stop();
467 pCreateView
->GetWrtShell().GotoPage((sal_uInt16
)pEdit
->GetValue(), sal_True
);
468 pCreateView
->GetEditWin().GrabFocus();
469 pCreateView
->GetViewFrame()->GetBindings().Invalidate(FN_STAT_PAGE
);
474 // If the page can be set here, the maximum is set.
476 IMPL_LINK( SwNavigationPI
, EditGetFocus
, NumEditAction
*, pEdit
)
478 SwView
*pView
= GetCreateView();
481 SwWrtShell
&rSh
= pView
->GetWrtShell();
483 const sal_uInt16 nPageCnt
= rSh
.GetPageCnt();
484 pEdit
->SetMax(nPageCnt
);
485 pEdit
->SetLast(nPageCnt
);
489 sal_Bool
SwNavigationPI::Close()
491 SfxViewFrame
* pVFrame
= pCreateView
->GetViewFrame();
492 pVFrame
->GetBindings().Invalidate(SID_NAVIGATOR
);
493 pVFrame
->GetDispatcher()->Execute(SID_NAVIGATOR
);
497 // Setting of an automatic mark
499 void SwNavigationPI::MakeMark()
501 SwView
*pView
= GetCreateView();
503 SwWrtShell
&rSh
= pView
->GetWrtShell();
504 IDocumentMarkAccess
* const pMarkAccess
= rSh
.getIDocumentMarkAccess();
506 // collect and sort navigator reminder names
507 ::std::vector
< OUString
> vNavMarkNames
;
508 for(IDocumentMarkAccess::const_iterator_t ppMark
= pMarkAccess
->getMarksBegin();
509 ppMark
!= pMarkAccess
->getMarksEnd();
511 if( IDocumentMarkAccess::GetType(**ppMark
) == IDocumentMarkAccess::NAVIGATOR_REMINDER
)
512 vNavMarkNames
.push_back(ppMark
->get()->GetName());
513 ::std::sort(vNavMarkNames
.begin(), vNavMarkNames
.end());
515 // we are maxed out and delete one
516 // nAutoMarkIdx rotates through the available MarkNames
517 // this assumes that IDocumentMarkAccess generates Names in ascending order
518 if(vNavMarkNames
.size() == MAX_MARKS
)
519 pMarkAccess
->deleteMark(pMarkAccess
->findMark(vNavMarkNames
[nAutoMarkIdx
]));
521 rSh
.SetBookmark(KeyCode(), OUString(), OUString(), IDocumentMarkAccess::NAVIGATOR_REMINDER
);
522 SwView::SetActMark( nAutoMarkIdx
);
524 if(++nAutoMarkIdx
== MAX_MARKS
)
528 void SwNavigationPI::GotoPage()
530 if (pContextWin
&& pContextWin
->GetFloatingWindow() && pContextWin
->GetFloatingWindow()->IsRollUp())
535 GetPageEdit().GrabFocus();
538 void SwNavigationPI::_ZoomOut()
542 FloatingWindow
* pFloat
= pContextWin
!=NULL
? pContextWin
->GetFloatingWindow() : NULL
;
543 bIsZoomedIn
= sal_False
;
544 Size
aSz(GetOutputSizePixel());
545 aSz
.Height() = nZoomOut
;
546 Size aMinOutSizePixel
= ((SfxDockingWindow
*)GetParent())->GetMinOutputSizePixel();
547 ((SfxDockingWindow
*)GetParent())->SetMinOutputSizePixel(Size(
548 aMinOutSizePixel
.Width(),nZoomOutInit
));
550 pFloat
->SetOutputSizePixel(aSz
);
554 aGlobalTree
.ShowTree();
558 aContentTree
.ShowTree();
561 SvTreeListEntry
* pFirst
= aContentTree
.FirstSelected();
563 aContentTree
.Select(pFirst
, sal_True
); // Enable toolbox
564 pConfig
->SetSmall( sal_False
);
565 aContentToolBox
.CheckItem(FN_SHOW_CONTENT_BOX
);
569 void SwNavigationPI::_ZoomIn()
571 if (pContextWin
!= NULL
)
573 FloatingWindow
* pFloat
= pContextWin
->GetFloatingWindow();
575 (!_IsZoomedIn() || ( pContextWin
->GetFloatingWindow()->IsRollUp())))
577 aContentTree
.HideTree();
579 aGlobalTree
.HideTree();
580 bIsZoomedIn
= sal_True
;
581 Size
aSz(GetOutputSizePixel());
582 if( aSz
.Height() > nZoomIn
)
583 nZoomOut
= ( short ) aSz
.Height();
585 aSz
.Height() = nZoomIn
;
586 Size aMinOutSizePixel
= ((SfxDockingWindow
*)GetParent())->GetMinOutputSizePixel();
587 ((SfxDockingWindow
*)GetParent())->SetMinOutputSizePixel(Size(
588 aMinOutSizePixel
.Width(), aSz
.Height()));
589 pFloat
->SetOutputSizePixel(aSz
);
590 SvTreeListEntry
* pFirst
= aContentTree
.FirstSelected();
592 aContentTree
.Select(pFirst
, sal_True
); // Enable toolbox
593 pConfig
->SetSmall( sal_True
);
594 aContentToolBox
.CheckItem(FN_SHOW_CONTENT_BOX
, sal_False
);
599 void SwNavigationPI::Resize()
601 Window
* pParent
= GetParent();
604 Size
aNewSize (pParent
->GetOutputSizePixel());
606 SfxDockingWindow
* pDockingParent
= dynamic_cast<SfxDockingWindow
*>(pParent
);
607 if (pDockingParent
!= NULL
)
609 FloatingWindow
* pFloat
= pDockingParent
->GetFloatingWindow();
610 //change the minimum width depending on the dock status
611 Size aMinOutSizePixel
= pDockingParent
->GetMinOutputSizePixel();
614 aNewSize
= pFloat
->GetOutputSizePixel();
615 aMinOutSizePixel
.Width() = nWishWidth
;
616 aMinOutSizePixel
.Height() = _IsZoomedIn() ? nZoomIn
: nZoomOutInit
;
620 aMinOutSizePixel
.Width() = 0;
621 aMinOutSizePixel
.Height() = 0;
623 pDockingParent
->SetMinOutputSizePixel(aMinOutSizePixel
);
626 const Point aPos
= aContentTree
.GetPosPixel();
627 Point aLBPos
= aDocListBox
.GetPosPixel();
628 long nDist
= aPos
.X();
629 aNewSize
.Height() -= (aPos
.Y() + aPos
.X() + nDocLBIniHeight
+ nDist
);
630 aNewSize
.Width() -= 2 * nDist
;
631 aLBPos
.Y() = aPos
.Y() + aNewSize
.Height() + nDist
;
632 aDocListBox
.Show(!aGlobalTree
.IsVisible() && aLBPos
.Y() > aPos
.Y() );
634 Size aDocLBSz
= aDocListBox
.GetSizePixel();
635 aDocLBSz
.Width() = aNewSize
.Width();
636 if(aNewSize
.Height() < 0)
637 aDocLBSz
.Height() = 0;
639 aDocLBSz
.Height() = nDocLBIniHeight
;
640 aContentTree
.SetSizePixel(aNewSize
);
641 // GlobalTree starts on to the top and goes all the way down.
642 aNewSize
.Height() += (nDist
+ nDocLBIniHeight
+ aPos
.Y() - aGlobalTree
.GetPosPixel().Y());
643 aGlobalTree
.SetSizePixel(aNewSize
);
644 aDocListBox
.setPosSizePixel( aLBPos
.X(), aLBPos
.Y(),
645 aDocLBSz
.Width(), aDocLBSz
.Height(),
646 WINDOW_POSSIZE_X
|WINDOW_POSSIZE_Y
|WINDOW_POSSIZE_WIDTH
);
650 SwNavigationPI::SwNavigationPI( SfxBindings
* _pBindings
,
651 SfxChildWindowContext
* pCw
,
654 Window( pParent
, SW_RES(DLG_NAVIGATION_PI
)),
655 SfxControllerItem( SID_DOCFULLNAME
, *_pBindings
),
657 aContentToolBox(this, SW_RES(TB_CONTENT
)),
658 aGlobalToolBox(this, SW_RES(TB_GLOBAL
)),
659 aContentImageList(SW_RES(IL_CONTENT
)),
660 aContentTree(this, SW_RES(TL_CONTENT
)),
661 aGlobalTree(this, SW_RES(TL_GLOBAL
)),
662 aDocListBox(this, SW_RES(LB_DOCS
)),
674 pConfig(SW_MOD()->GetNavigationConfig()),
675 rBindings(*_pBindings
),
679 nRegionMode(REGION_MODE_NONE
),
681 bSmallMode(sal_False
),
682 bIsZoomedIn(sal_False
),
683 bPageCtrlsVisible(sal_False
),
684 bGlobalMode(sal_False
)
689 aContentToolBox
.SetHelpId(HID_NAVIGATOR_TOOLBOX
);
690 aGlobalToolBox
.SetHelpId(HID_NAVIGATOR_GLOBAL_TOOLBOX
);
691 aDocListBox
.SetHelpId(HID_NAVIGATOR_LISTBOX
);
693 nDocLBIniHeight
= aDocListBox
.GetSizePixel().Height();
694 nZoomOutInit
= nZoomOut
= Resource::ReadShortRes();
696 // Insert the numeric field in the toolbox.
697 NumEditAction
* pEdit
= new NumEditAction(
698 &aContentToolBox
, SW_RES(NF_PAGE
));
699 pEdit
->SetActionHdl(LINK(this, SwNavigationPI
, EditAction
));
700 pEdit
->SetGetFocusHdl(LINK(this, SwNavigationPI
, EditGetFocus
));
701 pEdit
->SetAccessibleName(pEdit
->GetQuickHelpText());
702 pEdit
->SetUpHdl(LINK(this, SwNavigationPI
, PageEditModifyHdl
));
703 pEdit
->SetDownHdl(LINK(this, SwNavigationPI
, PageEditModifyHdl
));
705 bPageCtrlsVisible
= sal_True
;
707 // Double separators are not allowed, so you have to
708 // determine the suitable size differently.
709 Rectangle aFirstRect
= aContentToolBox
.GetItemRect(FN_SELECT_FOOTNOTE
);
710 Rectangle aSecondRect
= aContentToolBox
.GetItemRect(FN_SELECT_HEADER
);
711 sal_uInt16 nWidth
= sal_uInt16(aFirstRect
.Left() - aSecondRect
.Left());
713 Size
aItemWinSize( nWidth
, aFirstRect
.Bottom() - aFirstRect
.Top() );
714 pEdit
->SetSizePixel(aItemWinSize
);
715 aContentToolBox
.InsertSeparator(4);
716 aContentToolBox
.InsertWindow( FN_PAGENUMBER
, pEdit
, 0, 4);
717 aContentToolBox
.InsertSeparator(4);
718 aContentToolBox
.SetHelpId(FN_PAGENUMBER
, HID_NAVI_TBX16
);
719 aContentToolBox
.ShowItem( FN_PAGENUMBER
);
721 for( sal_uInt16 i
= 0; i
<= REGION_MODE_EMBEDDED
; i
++ )
723 aContextArr
[i
] = SW_RESSTR(ST_HYPERLINK
+ i
);
724 aStatusArr
[i
] = SW_RESSTR(ST_STATUS_FIRST
+ i
);
726 aStatusArr
[3] = SW_RESSTR(ST_ACTIVE_VIEW
);
730 const Size
& rOutSize
= GetOutputSizePixel();
732 nZoomIn
= (short)rOutSize
.Height();
734 // Make sure the toolbox has a size that fits all its contents
735 Size
aContentToolboxSize( aContentToolBox
.CalcWindowSizePixel() );
736 aContentToolBox
.SetOutputSizePixel( aContentToolboxSize
);
738 // position listbox below toolbar and add some space
739 long nListboxYPos
= aContentToolBox
.GetPosPixel().Y() + aContentToolboxSize
.Height() + 4;
741 // The left and right margins around the toolboxes should be equal.
742 nWishWidth
= aContentToolboxSize
.Width();
743 nWishWidth
+= 2 * aContentToolBox
.GetPosPixel().X();
745 DockingWindow
* pDockingParent
= dynamic_cast<DockingWindow
*>(pParent
);
746 if (pDockingParent
!= NULL
)
748 FloatingWindow
* pFloat
= pDockingParent
->GetFloatingWindow();
749 Size
aMinSize(pFloat
? nWishWidth
: 0, pFloat
? nZoomOutInit
: 0);
750 pDockingParent
->SetMinOutputSizePixel(aMinSize
);
751 SetOutputSizePixel( Size( nWishWidth
, nZoomOutInit
));
753 SfxDockingWindow
* pSfxDockingParent
= dynamic_cast<SfxDockingWindow
*>(pParent
);
754 if (pSfxDockingParent
!= NULL
)
756 Size
aTmpParentSize(pSfxDockingParent
->GetSizePixel());
757 if (aTmpParentSize
.Width() < aMinSize
.Width()
758 || aTmpParentSize
.Height() < aMinSize
.Height())
760 if (pSfxDockingParent
->GetFloatingWindow()
761 && ! pSfxDockingParent
->GetFloatingWindow()->IsRollUp())
763 pSfxDockingParent
->SetOutputSizePixel(aMinSize
);
769 aContentTree
.setPosSizePixel( 0, nListboxYPos
, 0, 0, WINDOW_POSSIZE_Y
);
770 aContentTree
.SetStyle( aContentTree
.GetStyle()|WB_HASBUTTONS
|WB_HASBUTTONSATROOT
|
771 WB_CLIPCHILDREN
|WB_HSCROLL
|WB_FORCE_MAKEVISIBLE
);
772 aContentTree
.SetSpaceBetweenEntries(3);
773 aContentTree
.SetSelectionMode( SINGLE_SELECTION
);
774 aContentTree
.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE
|
775 SV_DRAGDROP_CTRL_COPY
|
776 SV_DRAGDROP_ENABLE_TOP
);
777 aContentTree
.EnableAsyncDrag(sal_True
);
778 aContentTree
.ShowTree();
779 aContentToolBox
.CheckItem(FN_SHOW_CONTENT_BOX
, sal_True
);
781 // TreeListBox for global document
782 aGlobalTree
.setPosSizePixel( 0, nListboxYPos
, 0, 0, WINDOW_POSSIZE_Y
);
783 aGlobalTree
.SetSelectionMode( MULTIPLE_SELECTION
);
784 aGlobalTree
.SetStyle( aGlobalTree
.GetStyle()|WB_HASBUTTONS
|WB_HASBUTTONSATROOT
|
785 WB_CLIPCHILDREN
|WB_HSCROLL
);
786 Size
aGlblSize(aGlobalToolBox
.CalcWindowSizePixel());
787 aGlobalToolBox
.SetSizePixel(aGlblSize
);
791 Link aLk
= LINK(this, SwNavigationPI
, ToolBoxSelectHdl
);
792 aContentToolBox
.SetSelectHdl( aLk
);
793 aGlobalToolBox
.SetSelectHdl( aLk
);
794 aDocListBox
.SetSelectHdl(LINK(this, SwNavigationPI
,
795 DocListBoxSelectHdl
));
796 aContentToolBox
.SetClickHdl( LINK(this, SwNavigationPI
, ToolBoxClickHdl
) );
797 aContentToolBox
.SetDropdownClickHdl( LINK(this, SwNavigationPI
, ToolBoxDropdownClickHdl
) );
798 aGlobalToolBox
.SetClickHdl( LINK(this, SwNavigationPI
, ToolBoxClickHdl
) );
799 aGlobalToolBox
.SetDropdownClickHdl( LINK(this, SwNavigationPI
, ToolBoxDropdownClickHdl
) );
800 aGlobalToolBox
.CheckItem(FN_GLOBAL_SWITCH
, sal_True
);
802 Font
aFont(GetFont());
803 aFont
.SetWeight(WEIGHT_NORMAL
);
804 GetPageEdit().SetFont(aFont
);
805 aFont
= aContentTree
.GetFont();
806 aFont
.SetWeight(WEIGHT_NORMAL
);
807 aContentTree
.SetFont(aFont
);
808 aGlobalTree
.SetFont(aFont
);
810 StartListening(*SFX_APP());
812 StartListening(*pCreateView
);
813 SfxImageManager
* pImgMan
= SfxImageManager::GetImageManager( SW_MOD() );
814 pImgMan
->RegisterToolBox(&aContentToolBox
, SFX_TOOLBOX_CHANGEOUTSTYLE
);
815 pImgMan
->RegisterToolBox(&aGlobalToolBox
, SFX_TOOLBOX_CHANGEOUTSTYLE
);
817 aContentToolBox
.SetItemBits( FN_CREATE_NAVIGATION
, aContentToolBox
.GetItemBits( FN_CREATE_NAVIGATION
) | TIB_DROPDOWNONLY
);
818 aContentToolBox
.SetItemBits( FN_DROP_REGION
, aContentToolBox
.GetItemBits( FN_DROP_REGION
) | TIB_DROPDOWNONLY
);
819 aContentToolBox
.SetItemBits( FN_OUTLINE_LEVEL
, aContentToolBox
.GetItemBits( FN_OUTLINE_LEVEL
) | TIB_DROPDOWNONLY
);
823 SwView
*pActView
= GetCreateView();
824 aGlobalToolBox
.CheckItem(FN_GLOBAL_SAVE_CONTENT
,
825 pActView
->GetWrtShellPtr()->IsGlblDocSaveLinks());
826 if(pConfig
->IsGlobalActive())
828 aGlobalTree
.GrabFocus();
831 aContentTree
.GrabFocus();
833 aPageChgTimer
.SetTimeoutHdl(LINK(this, SwNavigationPI
, ChangePageHdl
));
834 aPageChgTimer
.SetTimeout(PAGE_CHANGE_TIMEOUT
);
836 aContentTree
.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT
));
837 aGlobalTree
.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL
));
838 aDocListBox
.SetAccessibleName(aStatusArr
[3]);
840 if (pContextWin
== NULL
)
842 // When the context window is missing then the navigator is
843 // displayed in the sidebar. While the navigator could change
844 // its size, the sidebar can not, and the navigator would just
845 // waste space. Therefore hide this button.
846 aContentToolBox
.RemoveItem(aContentToolBox
.GetItemPos(FN_SHOW_CONTENT_BOX
));
850 SwNavigationPI::~SwNavigationPI()
852 if(IsGlobalDoc() && !IsGlobalMode())
854 SwView
*pView
= GetCreateView();
855 SwWrtShell
&rSh
= pView
->GetWrtShell();
856 if( !rSh
.IsAllProtect() )
857 pView
->GetDocShell()->SetReadOnlyUI(sal_False
);
860 EndListening(*SFX_APP());
862 SfxImageManager
* pImgMan
= SfxImageManager::GetImageManager( SW_MOD() );
863 pImgMan
->ReleaseToolBox(&aContentToolBox
);
864 pImgMan
->ReleaseToolBox(&aGlobalToolBox
);
865 delete aContentToolBox
.GetItemWindow(FN_PAGENUMBER
);
866 aContentToolBox
.Clear();
869 if(pxObjectShell
->Is())
870 (*pxObjectShell
)->DoClose();
871 delete pxObjectShell
;
874 delete pFloatingWindow
;
877 rBindings
.Release(*this);
880 void SwNavigationPI::SetPopupWindow( SfxPopupWindow
* pWindow
)
882 pPopupWindow
= pWindow
;
883 pPopupWindow
->SetPopupModeEndHdl( LINK( this, SwNavigationPI
, PopupModeEndHdl
));
884 pPopupWindow
->SetDeleteLink_Impl( LINK( this, SwNavigationPI
, ClosePopupWindow
));
887 IMPL_LINK_NOARG(SwNavigationPI
, PopupModeEndHdl
)
889 if ( pPopupWindow
->IsVisible() )
891 // Replace floating window with popup window and destroy
892 // floating window instance.
893 delete pFloatingWindow
;
894 pFloatingWindow
= pPopupWindow
;
899 // Popup window has been closed by the user. No replacement, instance
900 // will destroy itself.
907 IMPL_LINK( SwNavigationPI
, ClosePopupWindow
, SfxPopupWindow
*, pWindow
)
909 if ( pWindow
== pFloatingWindow
)
917 void SwNavigationPI::StateChanged( sal_uInt16 nSID
, SfxItemState
/*eState*/,
918 const SfxPoolItem
* /*pState*/ )
920 if(nSID
== SID_DOCFULLNAME
)
922 SwView
*pActView
= GetCreateView();
925 SwWrtShell
* pWrtShell
= pActView
->GetWrtShellPtr();
926 aContentTree
.SetActiveShell(pWrtShell
);
927 sal_Bool bGlobal
= IsGlobalDoc();
928 aContentToolBox
.EnableItem(FN_GLOBAL_SWITCH
, bGlobal
);
929 if( (!bGlobal
&& IsGlobalMode()) ||
930 (!IsGlobalMode() && pConfig
->IsGlobalActive()) )
936 aGlobalToolBox
.CheckItem(FN_GLOBAL_SAVE_CONTENT
, pWrtShell
->IsGlblDocSaveLinks());
941 aContentTree
.SetActiveShell(0);
947 // Get the numeric field from the toolbox.
949 NumEditAction
& SwNavigationPI::GetPageEdit()
951 return *(NumEditAction
*)aContentToolBox
.GetItemWindow(FN_PAGENUMBER
);
954 SfxChildAlignment
SwNavigationPI::CheckAlignment
956 SfxChildAlignment eActAlign
,
957 SfxChildAlignment eAlign
960 SfxChildAlignment eRetAlign
;
963 eRetAlign
= SFX_ALIGN_NOALIGNMENT
;
967 case SFX_ALIGN_BOTTOM
:
968 case SFX_ALIGN_LOWESTBOTTOM
:
969 case SFX_ALIGN_HIGHESTBOTTOM
:
970 eRetAlign
= eActAlign
;
974 case SFX_ALIGN_HIGHESTTOP
:
975 case SFX_ALIGN_LOWESTTOP
:
977 case SFX_ALIGN_RIGHT
:
978 case SFX_ALIGN_FIRSTLEFT
:
979 case SFX_ALIGN_LASTLEFT
:
980 case SFX_ALIGN_FIRSTRIGHT
:
981 case SFX_ALIGN_LASTRIGHT
:
993 // Notification on modified DocInfo
995 void SwNavigationPI::Notify( SfxBroadcaster
& rBrdc
, const SfxHint
& rHint
)
997 if(&rBrdc
== pCreateView
)
999 if(rHint
.ISA(SfxSimpleHint
) && ((SfxSimpleHint
&)rHint
).GetId() == SFX_HINT_DYING
)
1006 if(rHint
.ISA(SfxEventHint
))
1008 if( pxObjectShell
&&
1009 ((SfxEventHint
&) rHint
).GetEventId() == SFX_EVENT_CLOSEAPP
)
1011 DELETEZ(pxObjectShell
);
1013 else if(((SfxEventHint
&) rHint
).GetEventId() == SFX_EVENT_OPENDOC
)
1016 SwView
*pActView
= GetCreateView();
1019 SwWrtShell
* pWrtShell
= pActView
->GetWrtShellPtr();
1020 aContentTree
.SetActiveShell(pWrtShell
);
1021 if(aGlobalTree
.IsVisible())
1023 if(aGlobalTree
.Update( sal_False
))
1024 aGlobalTree
.Display();
1026 // If no update is needed, then paint at least,
1027 // because of the red entries for the broken links.
1028 aGlobalTree
.Invalidate();
1036 IMPL_LINK( SwNavigationPI
, MenuSelectHdl
, Menu
*, pMenu
)
1038 sal_uInt16 nMenuId
= pMenu
->GetCurItemId();
1039 if(nMenuId
!= USHRT_MAX
)
1042 SetRegionDropMode( --nMenuId
);
1044 aContentTree
.SetOutlineLevel( static_cast< sal_uInt8
>(nMenuId
- 100) );
1049 void SwNavigationPI::UpdateListBox()
1051 aDocListBox
.SetUpdateMode(sal_False
);
1052 aDocListBox
.Clear();
1053 SwView
*pActView
= GetCreateView();
1054 bool bDisable
= pActView
== 0;
1055 SwView
*pView
= SwModule::GetFirstView();
1056 sal_uInt16 nCount
= 0;
1057 sal_uInt16 nAct
= 0;
1058 sal_uInt16 nConstPos
= 0;
1059 const SwView
* pConstView
= aContentTree
.IsConstantView() &&
1060 aContentTree
.GetActiveWrtShell() ?
1061 &aContentTree
.GetActiveWrtShell()->GetView():
1065 SfxObjectShell
* pDoc
= pView
->GetDocShell();
1066 // #i53333# don't show help pages here
1067 if ( !pDoc
->IsHelpDocument() )
1069 String sEntry
= pDoc
->GetTitle();
1070 sEntry
+= OUString(" (");
1071 if (pView
== pActView
)
1074 sEntry
+= aStatusArr
[ST_ACTIVE
- ST_STATUS_FIRST
];
1077 sEntry
+= aStatusArr
[ST_INACTIVE
- ST_STATUS_FIRST
];
1079 aDocListBox
.InsertEntry(sEntry
);
1082 if (pConstView
&& pView
== pConstView
)
1087 pView
= SwModule::GetNextView(pView
);
1089 aDocListBox
.InsertEntry(aStatusArr
[3]); // "Active Window"
1092 if(aContentTree
.GetHiddenWrtShell())
1094 String sEntry
= aContentTree
.GetHiddenWrtShell()->GetView().
1095 GetDocShell()->GetTitle();
1096 sEntry
+= OUString(" (");
1097 sEntry
+= aStatusArr
[ST_HIDDEN
- ST_STATUS_FIRST
];
1099 aDocListBox
.InsertEntry(sEntry
);
1102 if(aContentTree
.IsActiveView())
1104 //Either the name of the current Document or "Active Document".
1105 sal_uInt16 nTmp
= pActView
? nAct
: --nCount
;
1106 aDocListBox
.SelectEntryPos( nTmp
);
1108 else if(aContentTree
.IsHiddenView())
1110 aDocListBox
.SelectEntryPos(nCount
);
1113 aDocListBox
.SelectEntryPos(nConstPos
);
1115 aDocListBox
.Enable( !bDisable
);
1116 aDocListBox
.SetUpdateMode(sal_True
);
1119 IMPL_LINK(SwNavigationPI
, DoneLink
, SfxPoolItem
*, pItem
)
1121 const SfxViewFrameItem
* pFrameItem
= PTR_CAST(SfxViewFrameItem
, pItem
);
1124 SfxViewFrame
* pFrame
= pFrameItem
->GetFrame();
1127 aContentTree
.Clear();
1128 pContentView
= PTR_CAST(SwView
, pFrame
->GetViewShell());
1129 OSL_ENSURE(pContentView
, "no SwView");
1131 pContentWrtShell
= pContentView
->GetWrtShellPtr();
1133 pContentWrtShell
= 0;
1134 pxObjectShell
= new SfxObjectShellLock(pFrame
->GetObjectShell());
1136 aContentTree
.Update();
1142 String
SwNavigationPI::CreateDropFileName( TransferableDataHelper
& rData
)
1146 if( rData
.HasFormat( nFmt
= FORMAT_FILE_LIST
))
1149 rData
.GetFileList( nFmt
, aFileList
);
1150 sFileName
= aFileList
.GetFile( 0 );
1152 else if( rData
.HasFormat( nFmt
= FORMAT_STRING
) ||
1153 rData
.HasFormat( nFmt
= FORMAT_FILE
) ||
1154 rData
.HasFormat( nFmt
= SOT_FORMATSTR_ID_FILENAME
))
1155 rData
.GetString( nFmt
, sFileName
);
1156 else if( rData
.HasFormat( nFmt
= SOT_FORMATSTR_ID_SOLK
) ||
1157 rData
.HasFormat( nFmt
= SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
)||
1158 rData
.HasFormat( nFmt
= SOT_FORMATSTR_ID_FILECONTENT
) ||
1159 rData
.HasFormat( nFmt
= SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
) ||
1160 rData
.HasFormat( nFmt
= SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
))
1162 INetBookmark
aBkmk( aEmptyStr
, aEmptyStr
);
1163 rData
.GetINetBookmark( nFmt
, aBkmk
);
1164 sFileName
= aBkmk
.GetURL();
1166 if( sFileName
.Len() )
1168 sFileName
= INetURLObject( sFileName
).GetMainURL( INetURLObject::NO_DECODE
);
1173 sal_Int8
SwNavigationPI::AcceptDrop( const AcceptDropEvent
& /*rEvt*/ )
1175 return ( !aContentTree
.IsInDrag() &&
1176 ( aContentTree
.IsDropFormatSupported( FORMAT_FILE
) ||
1177 aContentTree
.IsDropFormatSupported( FORMAT_STRING
) ||
1178 aContentTree
.IsDropFormatSupported( SOT_FORMATSTR_ID_SOLK
) ||
1179 aContentTree
.IsDropFormatSupported( SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK
)||
1180 aContentTree
.IsDropFormatSupported( SOT_FORMATSTR_ID_FILECONTENT
) ||
1181 aContentTree
.IsDropFormatSupported( SOT_FORMATSTR_ID_FILEGRPDESCRIPTOR
) ||
1182 aContentTree
.IsDropFormatSupported( SOT_FORMATSTR_ID_UNIFORMRESOURCELOCATOR
) ||
1183 aContentTree
.IsDropFormatSupported( SOT_FORMATSTR_ID_FILENAME
)))
1188 sal_Int8
SwNavigationPI::ExecuteDrop( const ExecuteDropEvent
& rEvt
)
1190 TransferableDataHelper
aData( rEvt
.maDropEvent
.Transferable
);
1191 sal_Int8 nRet
= DND_ACTION_NONE
;
1193 if( !aContentTree
.IsInDrag() &&
1194 0 != (sFileName
= SwNavigationPI::CreateDropFileName( aData
)).Len() )
1196 INetURLObject
aTemp( sFileName
);
1197 GraphicDescriptor
aDesc( aTemp
);
1198 if( !aDesc
.Detect() ) // accept no graphics
1200 if( STRING_NOTFOUND
== sFileName
.Search('#')
1201 && (!sContentFileName
.Len() || sContentFileName
!= sFileName
))
1203 nRet
= rEvt
.mnAction
;
1204 sFileName
= comphelper::string::stripEnd(sFileName
, 0);
1205 sContentFileName
= sFileName
;
1208 aContentTree
.SetHiddenShell( 0 );
1209 (*pxObjectShell
)->DoClose();
1210 DELETEZ( pxObjectShell
);
1212 SfxStringItem
aFileItem(SID_FILE_NAME
, sFileName
);
1213 SfxStringItem
aOptionsItem( SID_OPTIONS
, OUString("HRC") );
1214 SfxLinkItem
aLink( SID_DONELINK
,
1215 LINK( this, SwNavigationPI
, DoneLink
) );
1216 GetActiveView()->GetViewFrame()->GetDispatcher()->Execute(
1217 SID_OPENDOC
, SFX_CALLMODE_ASYNCHRON
,
1218 &aFileItem
, &aOptionsItem
, &aLink
, 0L );
1225 void SwNavigationPI::SetRegionDropMode(sal_uInt16 nNewMode
)
1227 nRegionMode
= nNewMode
;
1228 pConfig
->SetRegionMode( nRegionMode
);
1230 sal_uInt16 nDropId
= FN_DROP_REGION
;
1231 if(nRegionMode
== REGION_MODE_LINK
)
1232 nDropId
= FN_DROP_REGION_LINK
;
1233 else if(nRegionMode
== REGION_MODE_EMBEDDED
)
1234 nDropId
= FN_DROP_REGION_COPY
;
1236 ImageList
& rImgLst
= aContentImageList
;
1238 aContentToolBox
.SetItemImage( FN_DROP_REGION
, rImgLst
.GetImage(nDropId
));
1241 sal_Bool
SwNavigationPI::ToggleTree()
1243 sal_Bool bRet
= sal_True
;
1244 sal_Bool bGlobalDoc
= IsGlobalDoc();
1245 if(!IsGlobalMode() && bGlobalDoc
)
1247 SetUpdateMode(sal_False
);
1250 aGlobalTree
.ShowTree();
1251 aGlobalToolBox
.Show();
1252 aContentTree
.HideTree();
1253 aContentToolBox
.Hide();
1255 SetGlobalMode(sal_True
);
1256 SetUpdateMode(sal_True
);
1260 aGlobalTree
.HideTree();
1261 aGlobalToolBox
.Hide();
1264 aContentTree
.ShowTree();
1265 aContentToolBox
.Show();
1269 SetGlobalMode(sal_False
);
1274 sal_Bool
SwNavigationPI::IsGlobalDoc() const
1276 sal_Bool bRet
= sal_False
;
1277 SwView
*pView
= GetCreateView();
1280 SwWrtShell
&rSh
= pView
->GetWrtShell();
1281 bRet
= rSh
.IsGlobalDoc();
1286 IMPL_LINK_NOARG(SwNavigationPI
, ChangePageHdl
)
1288 EditAction(&GetPageEdit());
1289 GetPageEdit().GrabFocus();
1293 IMPL_LINK_NOARG(SwNavigationPI
, PageEditModifyHdl
)
1295 if(aPageChgTimer
.IsActive())
1296 aPageChgTimer
.Stop();
1297 aPageChgTimer
.Start();
1301 SwView
* SwNavigationPI::GetCreateView() const
1305 SwView
* pView
= SwModule::GetFirstView();
1308 if(&pView
->GetViewFrame()->GetBindings() == &rBindings
)
1310 ((SwNavigationPI
*)this)->pCreateView
= pView
;
1311 ((SwNavigationPI
*)this)->StartListening(*pCreateView
);
1314 pView
= SwModule::GetNextView(pView
);
1320 SwNavigationChild::SwNavigationChild( Window
* pParent
,
1322 SfxBindings
* _pBindings
,
1324 : SfxChildWindowContext( nId
)
1326 SwNavigationPI
* pNavi
= new SwNavigationPI( _pBindings
, this, pParent
);
1328 _pBindings
->Invalidate(SID_NAVIGATOR
);
1330 SwNavigationConfig
* pNaviConfig
= SW_MOD()->GetNavigationConfig();
1332 sal_uInt16 nRootType
= static_cast< sal_uInt16
>( pNaviConfig
->GetRootType() );
1333 if( nRootType
< CONTENT_TYPE_MAX
)
1335 pNavi
->aContentTree
.SetRootType(nRootType
);
1336 pNavi
->aContentToolBox
.CheckItem(FN_SHOW_ROOT
, sal_True
);
1338 pNavi
->aContentTree
.SetOutlineLevel( static_cast< sal_uInt8
>( pNaviConfig
->GetOutlineLevel() ) );
1339 pNavi
->SetRegionDropMode( static_cast< sal_uInt16
>( pNaviConfig
->GetRegionMode() ) );
1341 if(GetFloatingWindow() && pNaviConfig
->IsSmall())
1347 void SwNavigationPI::DataChanged( const DataChangedEvent
& rDCEvt
)
1349 Window::DataChanged( rDCEvt
);
1350 if ( (rDCEvt
.GetType() == DATACHANGED_SETTINGS
) &&
1351 (rDCEvt
.GetFlags() & SETTINGS_STYLE
) )
1354 const StyleSettings
& rStyleSettings
= Application::GetSettings().GetStyleSettings();
1355 Color aBgColor
= rStyleSettings
.GetFaceColor();
1356 Wallpaper
aBack( aBgColor
);
1357 SetBackground( aBack
);
1361 void SwNavigationPI::InitImageList()
1365 ImageList
& rImgLst
= aContentImageList
;
1366 for( k
= 0; k
< aContentToolBox
.GetItemCount(); k
++)
1367 aContentToolBox
.SetItemImage(aContentToolBox
.GetItemId(k
),
1368 rImgLst
.GetImage(aContentToolBox
.GetItemId(k
)));
1370 for( k
= 0; k
< aGlobalToolBox
.GetItemCount(); k
++)
1371 aGlobalToolBox
.SetItemImage(aGlobalToolBox
.GetItemId(k
),
1372 rImgLst
.GetImage(aGlobalToolBox
.GetItemId(k
)));
1374 sal_uInt16 nDropId
= FN_DROP_REGION
;
1375 if(nRegionMode
== REGION_MODE_LINK
)
1376 nDropId
= FN_DROP_REGION_LINK
;
1377 else if(nRegionMode
== REGION_MODE_EMBEDDED
)
1378 nDropId
= FN_DROP_REGION_COPY
;
1379 aContentToolBox
.SetItemImage( FN_DROP_REGION
,
1380 rImgLst
.GetImage(nDropId
));
1383 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */