Author: af Date: Tue Apr 2 12:55:46 2013 New Revision: 1463515 URL: http://svn.apache.org/r1463515 Log: i121961: Added navigator to sidebar for Writer.
Modified: openoffice/branches/sidebar/main/sw/source/ui/sidebar/SwPanelFactory.cxx openoffice/branches/sidebar/main/sw/source/ui/utlui/navipi.cxx Modified: openoffice/branches/sidebar/main/sw/source/ui/sidebar/SwPanelFactory.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/sidebar/SwPanelFactory.cxx?rev=1463515&r1=1463514&r2=1463515&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sw/source/ui/sidebar/SwPanelFactory.cxx (original) +++ openoffice/branches/sidebar/main/sw/source/ui/sidebar/SwPanelFactory.cxx Tue Apr 2 12:55:46 2013 @@ -25,6 +25,7 @@ #include <PagePropertyPanel.hxx> #include <WrapPropertyPanel.hxx> +#include <navipi.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> #include <sfx2/sfxbasecontroller.hxx> @@ -132,6 +133,15 @@ Reference<ui::XUIElement> SAL_CALL SwPan pPanel, ui::LayoutSize(-1,-1,-1)); } + else if (DoesResourceEndWith("/NavigatorPanel")) + { + Window* pPanel = new SwNavigationPI(pBindings, NULL, pParentWindow); + xElement = sfx2::sidebar::SidebarPanelBase::Create( + rsResourceURL, + xFrame, + pPanel, + ui::LayoutSize(0,-1,-1)); + } #undef DoesResourceEndWith return xElement; Modified: openoffice/branches/sidebar/main/sw/source/ui/utlui/navipi.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sw/source/ui/utlui/navipi.cxx?rev=1463515&r1=1463514&r2=1463515&view=diff ============================================================================== --- openoffice/branches/sidebar/main/sw/source/ui/utlui/navipi.cxx (original) +++ openoffice/branches/sidebar/main/sw/source/ui/utlui/navipi.cxx Tue Apr 2 12:55:46 2013 @@ -283,18 +283,18 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelect break; case FN_SHOW_CONTENT_BOX: case FN_SELECT_CONTENT: - if(pContextWin->GetFloatingWindow()) - { - if(_IsZoomedIn() ) - { - _ZoomOut(); - } - else - { - _ZoomIn(); - } - } - return sal_True; + if(pContextWin!=NULL && pContextWin->GetFloatingWindow()!=NULL) + { + if(_IsZoomedIn() ) + { + _ZoomOut(); + } + else + { + _ZoomIn(); + } + } + 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,29 +673,32 @@ void SwNavigationPI::_ZoomOut() void SwNavigationPI::_ZoomIn() { - 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); - } + if (pContextWin != NULL) + { + 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); + } + } } /*------------------------------------------------------------------------ Beschreibung: @@ -703,48 +707,51 @@ 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 - { - aNewSize = pParent->GetOutputSizePixel(); - aMinOutSizePixel.Width() = 0; - aMinOutSizePixel.Height() = 0; - } - ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(aMinOutSizePixel); + if( !_IsZoomedIn() ) + { + Size aNewSize (pParent->GetOutputSizePixel()); + SfxDockingWindow* pDockingParent = dynamic_cast<SfxDockingWindow*>(pParent); + if (pDockingParent != NULL) + { + 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); + } + const Point aPos = aContentTree.GetPosPixel(); - Point aLBPos = aDocListBox.GetPosPixel(); - long nDist = aPos.X(); - aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist); - aNewSize.Width() -= 2 * nDist; - aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist; - aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() ); - - Size aDocLBSz = aDocListBox.GetSizePixel(); - aDocLBSz.Width() = aNewSize.Width(); - if(aNewSize.Height() < 0) - aDocLBSz.Height() = 0; - else - aDocLBSz.Height() = nDocLBIniHeight; - aContentTree.SetSizePixel(aNewSize); - // GlobalTree faengt weiter oben an und reicht bis ganz unten - 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); - + Point aLBPos = aDocListBox.GetPosPixel(); + long nDist = aPos.X(); + aNewSize.Height() -= (aPos.Y() + aPos.X() + nDocLBIniHeight + nDist); + aNewSize.Width() -= 2 * nDist; + aLBPos.Y() = aPos.Y() + aNewSize.Height() + nDist; + aDocListBox.Show(!aGlobalTree.IsVisible() && aLBPos.Y() > aPos.Y() ); + + Size aDocLBSz = aDocListBox.GetSizePixel(); + aDocLBSz.Width() = aNewSize.Width(); + if(aNewSize.Height() < 0) + aDocLBSz.Height() = 0; + else + aDocLBSz.Height() = nDocLBIniHeight; + aContentTree.SetSizePixel(aNewSize); + // GlobalTree faengt weiter oben an und reicht bis ganz unten + 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); } } @@ -851,21 +858,29 @@ SwNavigationPI::SwNavigationPI( SfxBindi 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| @@ -877,7 +892,7 @@ SwNavigationPI::SwNavigationPI( SfxBindi SV_DRAGDROP_ENABLE_TOP ); aContentTree.EnableAsyncDrag(sal_True); aContentTree.ShowTree(); - aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_True); + aContentToolBox.CheckItem(FN_SHOW_CONTENT_BOX, sal_True); // TreeListBox fuer Globaldokument aGlobalTree.SetPosSizePixel( 0, nListboxYPos, 0, 0, WINDOW_POSSIZE_Y ); @@ -937,6 +952,15 @@ SwNavigationPI::SwNavigationPI( SfxBindi 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)); + } } /*------------------------------------------------------------------------