summaryrefslogtreecommitdiff
path: root/sw/source/ui/utlui/navipi.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sw/source/ui/utlui/navipi.cxx')
-rw-r--r--sw/source/ui/utlui/navipi.cxx158
1 files changed, 91 insertions, 67 deletions
diff --git a/sw/source/ui/utlui/navipi.cxx b/sw/source/ui/utlui/navipi.cxx
index 8e0d414bfee5..9308c79afafa 100644
--- a/sw/source/ui/utlui/navipi.cxx
+++ b/sw/source/ui/utlui/navipi.cxx
@@ -283,18 +283,18 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox )
break;
case FN_SHOW_CONTENT_BOX:
case FN_SELECT_CONTENT:
- if(pContextWin->GetFloatingWindow())
- {
- if(_IsZoomedIn() )
- {
- _ZoomOut();
- }
- else
+ if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL)
{
- _ZoomIn();
+ if(_IsZoomedIn() )
+ {
+ _ZoomOut();
+ }
+ else
+ {
+ _ZoomIn();
+ }
}
- }
- return sal_True;
+ return sal_True;
//break;
// Funktionen, die eine direkte Aktion ausloesen
@@ -624,7 +624,7 @@ void SwNavigationPI::MakeMark()
void SwNavigationPI::GotoPage()
{
- if ( pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
+ if (pContextWin && pContextWin->GetFloatingWindow() && pContextWin->GetFloatingWindow()->IsRollUp())
_ZoomIn();
if(IsGlobalMode())
ToggleTree();
@@ -640,14 +640,15 @@ void SwNavigationPI::_ZoomOut()
{
if (_IsZoomedIn())
{
- FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+ FloatingWindow* pFloat = pContextWin!=NULL ? pContextWin->GetFloatingWindow() : NULL;
bIsZoomedIn = sal_False;
Size aSz(GetOutputSizePixel());
aSz.Height() = nZoomOut;
Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
aMinOutSizePixel.Width(),nZoomOutInit));
- pFloat->SetOutputSizePixel(aSz);
+ if (pFloat != NULL)
+ pFloat->SetOutputSizePixel(aSz);
FillBox();
if(IsGlobalMode())
{
@@ -672,28 +673,31 @@ void SwNavigationPI::_ZoomOut()
void SwNavigationPI::_ZoomIn()
{
- FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
- if (pFloat &&
- (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
+ if (pContextWin != NULL)
{
- aContentTree.HideTree();
- aDocListBox.Hide();
- aGlobalTree.HideTree();
- bIsZoomedIn = sal_True;
- Size aSz(GetOutputSizePixel());
- if( aSz.Height() > nZoomIn )
- nZoomOut = ( short ) aSz.Height();
-
- aSz.Height() = nZoomIn;
- Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
- ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
- aMinOutSizePixel.Width(), aSz.Height()));
- pFloat->SetOutputSizePixel(aSz);
- SvLBoxEntry* pFirst = aContentTree.FirstSelected();
- if(pFirst)
- aContentTree.Select(pFirst, sal_True); // toolbox enablen
- pConfig->SetSmall( sal_True );
- aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
+ FloatingWindow* pFloat = pContextWin->GetFloatingWindow();
+ if (pFloat &&
+ (!_IsZoomedIn() || ( pContextWin->GetFloatingWindow()->IsRollUp())))
+ {
+ aContentTree.HideTree();
+ aDocListBox.Hide();
+ aGlobalTree.HideTree();
+ bIsZoomedIn = sal_True;
+ Size aSz(GetOutputSizePixel());
+ if( aSz.Height() > nZoomIn )
+ nZoomOut = ( short ) aSz.Height();
+
+ aSz.Height() = nZoomIn;
+ Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
+ ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
+ aMinOutSizePixel.Width(), aSz.Height()));
+ pFloat->SetOutputSizePixel(aSz);
+ SvLBoxEntry* pFirst = aContentTree.FirstSelected();
+ if(pFirst)
+ aContentTree.Select(pFirst, sal_True); // toolbox enablen
+ pConfig->SetSmall( sal_True );
+ aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_False);
+ }
}
}
/*------------------------------------------------------------------------
@@ -703,25 +707,29 @@ void SwNavigationPI::_ZoomIn()
void SwNavigationPI::Resize()
{
Window* pParent = GetParent();
- FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow();
- Size aNewSize;
if( !_IsZoomedIn() )
{
- //change the minimum width depending on the dock status
- Size aMinOutSizePixel = ((SfxDockingWindow*)pParent)->GetMinOutputSizePixel();
- if( pFloat)
- {
- aNewSize = pFloat->GetOutputSizePixel();
- aMinOutSizePixel.Width() = nWishWidth;
- aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
- }
- else
+ Size aNewSize (pParent->GetOutputSizePixel());
+
+ SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
+ if (pDockingParent != NULL)
{
- aNewSize = pParent->GetOutputSizePixel();
- aMinOutSizePixel.Width() = 0;
- aMinOutSizePixel.Height() = 0;
+ FloatingWindow* pFloat = pDockingParent->GetFloatingWindow();
+ //change the minimum width depending on the dock status
+ Size aMinOutSizePixel = pDockingParent->GetMinOutputSizePixel();
+ if( pFloat)
+ {
+ aNewSize = pFloat->GetOutputSizePixel();
+ aMinOutSizePixel.Width() = nWishWidth;
+ aMinOutSizePixel.Height() = _IsZoomedIn() ? nZoomIn : nZoomOutInit;
+ }
+ else
+ {
+ aMinOutSizePixel.Width() = 0;
+ aMinOutSizePixel.Height() = 0;
+ }
+ pDockingParent->SetMinOutputSizePixel(aMinOutSizePixel);
}
- ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel);
const Point aPos = aContentTree.GetPosPixel();
Point aLBPos = aDocListBox.GetPosPixel();
@@ -742,9 +750,8 @@ void SwNavigationPI::Resize()
aNewSize.Height() += (nDist + nDocLBIniHeight + aPos.Y() - aGlobalTree.GetPosPixel().Y());
aGlobalTree.SetSizePixel(aNewSize);
aDocListBox.SetPosSizePixel( aLBPos.X(), aLBPos.Y(),
- aDocLBSz.Width(), aDocLBSz.Height(),
- WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
-
+ aDocLBSz.Width(), aDocLBSz.Height(),
+ WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y|WINDOW_POSSIZE_WIDTH);
}
}
@@ -851,21 +858,29 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
nWishWidth = aContentToolboxSize.Width();
nWishWidth += 2 * aContentToolBox.GetPosPixel().X();
- FloatingWindow* pFloat = ((DockingWindow*)pParent)->GetFloatingWindow();
- Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
- ((SfxDockingWindow*)pParent)->SetMinOutputSizePixel(aMinSize);
- SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
- Size aTmpParentSize(((SfxDockingWindow*)pParent)->GetSizePixel());
- if(
- (
- aTmpParentSize.Width() < aMinSize.Width() ||
- aTmpParentSize.Height() < aMinSize.Height()
- )
- &&
- ((SfxDockingWindow*)pParent)->GetFloatingWindow() &&
- !((SfxDockingWindow*)pParent)->GetFloatingWindow()->IsRollUp()
- )
- ((SfxDockingWindow*)pParent)->SetOutputSizePixel(aMinSize);
+ DockingWindow* pDockingParent = dynamic_cast<DockingWindow*>(pParent);
+ if (pDockingParent != NULL)
+ {
+ FloatingWindow* pFloat = pDockingParent->GetFloatingWindow();
+ Size aMinSize(pFloat ? nWishWidth : 0, pFloat ? nZoomOutInit : 0);
+ pDockingParent->SetMinOutputSizePixel(aMinSize);
+ SetOutputSizePixel( Size( nWishWidth, nZoomOutInit));
+
+ SfxDockingWindow* pSfxDockingParent = dynamic_cast<SfxDockingWindow*>(pParent);
+ if (pSfxDockingParent != NULL)
+ {
+ Size aTmpParentSize(pSfxDockingParent->GetSizePixel());
+ if (aTmpParentSize.Width() < aMinSize.Width()
+ || aTmpParentSize.Height() < aMinSize.Height())
+ {
+ if (pSfxDockingParent->GetFloatingWindow()
+ && ! pSfxDockingParent->GetFloatingWindow()->IsRollUp())
+ {
+ pSfxDockingParent->SetOutputSizePixel(aMinSize);
+ }
+ }
+ }
+ }
aContentTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y );
aContentTree.SetStyle( aContentTree.GetStyle()|WB_HASBUTTONS|WB_HASBUTTONSATROOT|
@@ -937,6 +952,15 @@ SwNavigationPI::SwNavigationPI( SfxBindings* _pBindings,
aContentTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_CONTENT));
aGlobalTree.SetAccessibleName(SW_RESSTR(STR_ACCESS_TL_GLOBAL));
aDocListBox.SetAccessibleName(aStatusArr[3]);
+
+ if (pContextWin == NULL)
+ {
+ // When the context window is missing then the navigator is
+ // displayed in the sidebar. While the navigator could change
+ // its size, the sidebar can not, and the navigator would just
+ // waste space. Therefore hide this button.
+ aContentToolBox.RemoveItem(aContentToolBox.GetItemPos(FN_SHOW_CONTENT_BOX));
+ }
}
/*------------------------------------------------------------------------