sw/Library_sw.mk | 1 sw/source/core/inc/layfrm.hxx | 2 sw/source/core/layout/pagechg.cxx | 2 sw/source/core/layout/paintfrm.cxx | 25 ++-- sw/source/ui/docvw/FrameControlsManager.cxx | 155 ++++++++++++++++++++++++++++ sw/source/ui/docvw/HeaderFooterWin.cxx | 26 ++-- sw/source/ui/docvw/edtwin.cxx | 70 ------------ sw/source/ui/inc/FrameControl.hxx | 55 +++++++++ sw/source/ui/inc/FrameControlsManager.hxx | 72 +++++++++++++ sw/source/ui/inc/HeaderFooterWin.hxx | 7 - sw/source/ui/inc/edtwin.hxx | 13 -- sw/source/ui/wrtsh/wrtsh1.cxx | 4 12 files changed, 325 insertions(+), 107 deletions(-)
New commits: commit e19f926ba247b4b84c4efa368cf19c312f5f51e7 Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Sep 21 17:40:40 2011 +0200 Header/Footer: refactored the SwEditWin to extend it to page breaks diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index 709b4b5..f1e7d5c 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -584,6 +584,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\ sw/source/ui/docvw/AnnotationMenuButton \ sw/source/ui/docvw/AnnotationWin \ sw/source/ui/docvw/DashedLine \ + sw/source/ui/docvw/FrameControlsManager \ sw/source/ui/docvw/PostItMgr \ sw/source/ui/docvw/ShadowOverlayObject \ sw/source/ui/docvw/SidebarTxtControl \ diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index e028d27..5f2637d 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -286,7 +286,7 @@ SwPageFrm::~SwPageFrm() if ( pWrtSh ) { SwEditWin& rEditWin = pWrtSh->GetView().GetEditWin(); - rEditWin.RemoveHeaderFooterControls( this ); + rEditWin.GetFrameControlsManager( ).RemoveControls( this ); } //FlyContainer entleeren, delete der Flys uebernimmt der Anchor diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5a1621a..9301167 100755 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3512,7 +3512,7 @@ void SwPageFrm::PaintDecorators( ) const long nHeaderYOff = aBodyRect.Top(); Point nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nHeaderYOff ) ); - rEditWin.SetHeaderFooterControl( this, true, nOutputOff ); + rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, true, nOutputOff ); // Footer const SwFrm* pFtnContFrm = Lower(); @@ -3525,7 +3525,7 @@ void SwPageFrm::PaintDecorators( ) const long nFooterYOff = aBodyRect.Bottom(); nOutputOff = rEditWin.LogicToPixel( Point( nXOff, nFooterYOff ) ); - rEditWin.SetHeaderFooterControl( this, false, nOutputOff ); + rEditWin.GetFrameControlsManager().SetHeaderFooterControl( this, false, nOutputOff ); } } } diff --git a/sw/source/ui/docvw/FrameControlsManager.cxx b/sw/source/ui/docvw/FrameControlsManager.cxx new file mode 100644 index 0000000..69b9c98 --- /dev/null +++ b/sw/source/ui/docvw/FrameControlsManager.cxx @@ -0,0 +1,155 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 SUSE <cbosdon...@suse.com> (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#include <edtwin.hxx> +#include <FrameControlsManager.hxx> +#include <HeaderFooterWin.hxx> +#include <pagefrm.hxx> +#include <viewopt.hxx> +#include <view.hxx> +#include <wrtsh.hxx> + +using namespace std; + +namespace +{ + class FramePredicate + { + const SwFrm* m_pToMatch; + + public: + FramePredicate( const SwFrm* pFrm ) : m_pToMatch( pFrm ) { }; + + virtual bool operator()( SwFrameControlPtr pToCheck ) + { return m_pToMatch == pToCheck->GetFrame(); }; + }; +} + +SwFrameControlsManager::SwFrameControlsManager( SwEditWin* pEditWin ) : + m_pEditWin( pEditWin ) +{ +} + +SwFrameControlsManager::~SwFrameControlsManager() +{ + map< FrameControlType, vector< SwFrameControlPtr > >::iterator pIt = m_aControls.begin(); + + while ( pIt != m_aControls.end() ) + { + pIt->second.clear( ); + ++pIt; + } + m_aControls.clear(); +} + +std::vector< SwFrameControlPtr > SwFrameControlsManager::GetControls( FrameControlType eType ) +{ + return m_aControls[eType]; +} + +void SwFrameControlsManager::AddControl( FrameControlType eType, SwFrameControlPtr pControl ) +{ + m_aControls[eType].push_back( pControl ); +} + +void SwFrameControlsManager::RemoveControls( const SwFrm* pFrm ) +{ + map< FrameControlType, vector< SwFrameControlPtr > >::iterator pIt = m_aControls.begin(); + + while ( pIt != m_aControls.end() ) + { + vector< SwFrameControlPtr > aVect = pIt->second; + aVect.erase( remove_if( aVect.begin(), + aVect.end(), + FramePredicate( pFrm ) ), aVect.end() ); + ++pIt; + } +} + + +void SwFrameControlsManager::HideControls( FrameControlType eType ) +{ + vector< SwFrameControlPtr >::iterator pIt = m_aControls[eType].begin(); + while ( pIt != m_aControls[eType].end() ) + { + ( *pIt )->ShowAll( false ); + pIt++; + } +} + +void SwFrameControlsManager::SetReadonlyControls( bool bReadonly ) +{ + map< FrameControlType, vector< SwFrameControlPtr > >::iterator pIt = m_aControls.begin(); + + while ( pIt != m_aControls.end() ) + { + vector< SwFrameControlPtr >::iterator pVectIt = pIt->second.begin(); + while ( pVectIt != pIt->second.end() ) + { + ( *pVectIt )->SetReadonly( bReadonly ); + ++pVectIt; + } + ++pIt; + } +} + +void SwFrameControlsManager::SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, Point aOffset ) +{ + // Check if we already have the control + SwFrameControlPtr pControl; + + vector< SwFrameControlPtr > aControls = m_aControls[HeaderFooter]; + + vector< SwFrameControlPtr >::iterator pIt = aControls.begin(); + while ( pIt != aControls.end() && !pControl.get() ) + { + SwHeaderFooterWin* pToTest = dynamic_cast< SwHeaderFooterWin* >( pIt->get() ); + if ( pToTest->GetPageFrame( ) == pPageFrm && + pToTest->IsHeader( ) == bHeader ) + pControl = *pIt; + pIt++; + } + + if ( !pControl.get() ) + { + pControl = SwFrameControlPtr( new SwHeaderFooterWin( m_pEditWin, pPageFrm, bHeader ) ); + const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); + pControl->SetReadonly( pViewOpt->IsReadonly() ); + AddControl( HeaderFooter, pControl ); + } + + Rectangle aPageRect = m_pEditWin->LogicToPixel( pPageFrm->Frm().SVRect() ); + + SwHeaderFooterWin* pHFWin = dynamic_cast< SwHeaderFooterWin* >( pControl.get() ); + pHFWin->SetOffset( aOffset, aPageRect.Left(), aPageRect.Right() ); + + if ( !pHFWin->IsVisible() ) + pControl->ShowAll( true ); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index e985981..cac5277 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -214,17 +214,6 @@ namespace } return bRet; } - - class PageFramePredicate - { - const SwPageFrm* m_pToMatch; - - public: - PageFramePredicate( const SwPageFrm* pPageFrm ) : m_pToMatch( pPageFrm ) { }; - - virtual bool operator()( boost::shared_ptr< SwHeaderFooterWin > pToCheck ) - { return m_pToMatch == pToCheck->GetPageFrame(); }; - }; } class SwAnchorMarker @@ -4580,7 +4569,8 @@ SwEditWin::SwEditWin(Window *pParent, SwView &rMyView): bLockInput(sal_False), bObjectSelect( sal_False ), nKS_NUMDOWN_Count(0), - nKS_NUMINDENTINC_Count(0) + nKS_NUMINDENTINC_Count(0), + m_aFrameControlsManager( this ) { SetHelpId(HID_EDIT_WIN); EnableChildTransparentMode(); @@ -4623,7 +4613,6 @@ SwEditWin::SwEditWin(Window *pParent, SwView &rMyView): SwEditWin::~SwEditWin() { - aHeadFootControls.clear(); aKeyInputTimer.Stop(); delete pShadCrsr; delete pRowColumnSelectionStart; @@ -5758,61 +5747,4 @@ Selection SwEditWin::GetSurroundingTextSelection() const } } -void SwEditWin::SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, Point aOffset ) -{ - // Check if we already have the control - boost::shared_ptr< SwHeaderFooterWin > pControl; - std::vector< boost::shared_ptr< SwHeaderFooterWin > >::iterator pIt = aHeadFootControls.begin(); - while ( pIt != aHeadFootControls.end() && !pControl.get() ) - { - if ( ( *pIt )->GetPageFrame( ) == pPageFrm && - ( *pIt )->IsHeader( ) == bHeader ) - pControl = *pIt; - ++pIt; - } - - if ( !pControl.get() ) - { - boost::shared_ptr< SwHeaderFooterWin > pNewControl( new SwHeaderFooterWin( this, pPageFrm, bHeader ) ); - const SwViewOption* pViewOpt = GetView().GetWrtShell().GetViewOptions(); - pNewControl->SetReadonly( pViewOpt->IsReadonly() ); - pControl.swap( pNewControl ); - aHeadFootControls.push_back( pControl ); - } - - Rectangle aPageRect = LogicToPixel( pPageFrm->Frm().SVRect() ); - - pControl->SetOffset( aOffset, aPageRect.Left(), aPageRect.Right() ); - - if ( !pControl->IsVisible() ) - pControl->ShowAll( true ); -} - -void SwEditWin::RemoveHeaderFooterControls( const SwPageFrm* pPageFrm ) -{ - aHeadFootControls.erase( remove_if( aHeadFootControls.begin(), - aHeadFootControls.end(), - PageFramePredicate( pPageFrm ) ), aHeadFootControls.end() ); -} - -void SwEditWin::HideHeaderFooterControls( ) -{ - std::vector< boost::shared_ptr< SwHeaderFooterWin > >::iterator pIt = aHeadFootControls.begin(); - while ( pIt != aHeadFootControls.end() ) - { - ( *pIt )->ShowAll( false ); - ++pIt; - } -} - -void SwEditWin::SetReadonlyHeaderFooterControls( bool bReadonly ) -{ - std::vector< boost::shared_ptr< SwHeaderFooterWin > >::iterator pIt = aHeadFootControls.begin(); - while ( pIt != aHeadFootControls.end() ) - { - ( *pIt )->SetReadonly( bReadonly ); - ++pIt; - } -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/inc/FrameControl.hxx b/sw/source/ui/inc/FrameControl.hxx index 01bbb6b..0be643d 100644 --- a/sw/source/ui/inc/FrameControl.hxx +++ b/sw/source/ui/inc/FrameControl.hxx @@ -28,8 +28,8 @@ #ifndef _FRAMECONTROL_HXX #define _FRAMECONTROL_HXX -#include <edtwin.hxx> -#include <frame.hxx> +class SwEditWin; +class SwFrm; /** Class representing a control linked to a SwFrm. */ diff --git a/sw/source/ui/inc/FrameControlsManager.hxx b/sw/source/ui/inc/FrameControlsManager.hxx new file mode 100644 index 0000000..a37305b --- /dev/null +++ b/sw/source/ui/inc/FrameControlsManager.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 SUSE <cbosdon...@suse.com> (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _FRAMECONTROLSMANAGER_HXX +#define _FRAMECONTROLSMANAGER_HXX + +#include <FrameControl.hxx> + +#include <boost/shared_ptr.hpp> +#include <tools/gen.hxx> + +#include <map> +#include <vector> + +class SwPageFrm; +class SwEditWin; + +enum FrameControlType +{ + PageBreak, + HeaderFooter +}; + +typedef boost::shared_ptr< SwFrameControl > SwFrameControlPtr; + +class SwFrameControlsManager +{ + private: + SwEditWin* m_pEditWin; + std::map< FrameControlType, std::vector< SwFrameControlPtr > > m_aControls; + + public: + SwFrameControlsManager( SwEditWin* pEditWin ); + ~SwFrameControlsManager( ); + + std::vector< SwFrameControlPtr > GetControls( FrameControlType eType ); + void AddControl( FrameControlType eType, SwFrameControlPtr pControl ); + void RemoveControls( const SwFrm* pFrm ); + void HideControls( FrameControlType eType ); + void SetReadonlyControls( bool bReadonly ); + + // Helper methods + void SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, Point aOffset ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx index f85b2f1..8cdcb1b 100644 --- a/sw/source/ui/inc/edtwin.hxx +++ b/sw/source/ui/inc/edtwin.hxx @@ -28,6 +28,8 @@ #ifndef _EDTWIN_HXX #define _EDTWIN_HXX +#include <FrameControlsManager.hxx> + #include <svx/svdobj.hxx> #include <tools/link.hxx> #include <vcl/timer.hxx> @@ -38,8 +40,6 @@ #define _SVSTDARR_STRINGSISORTDTOR #include <svl/svstdarr.hxx> -#include <boost/shared_ptr.hpp> - class SwWrtShell; class SwView; class SwRect; @@ -54,8 +54,6 @@ class SwPaM; struct SwApplyTemplate; struct QuickHelpData; class SdrDropMarkerOverlay; -class SwHeaderFooterWin; -class SwPageFrm; /*-------------------------------------------------------------------- Description: input window @@ -162,7 +160,7 @@ friend void PageNumNotify( ViewShell* pVwSh, sal_uInt16 nKS_NUMDOWN_Count; // #i23725# sal_uInt16 nKS_NUMINDENTINC_Count; - std::vector< boost::shared_ptr<SwHeaderFooterWin> > aHeadFootControls; + SwFrameControlsManager m_aFrameControlsManager; void LeaveArea(const Point &); void JustifyAreaTimer(); @@ -320,10 +318,7 @@ public: void SetUseInputLanguage( sal_Bool bNew ); sal_Bool IsUseInputLanguage() const { return bUseInputLanguage; } - void SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, Point aOffset ); - void RemoveHeaderFooterControls( const SwPageFrm* pPageFrm ); - void HideHeaderFooterControls( ); - void SetReadonlyHeaderFooterControls( bool bReadonly ); + SwFrameControlsManager& GetFrameControlsManager() { return m_aFrameControlsManager; } SwEditWin(Window *pParent, SwView &); virtual ~SwEditWin(); diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx index ec54dc2..c5f873d 100644 --- a/sw/source/ui/wrtsh/wrtsh1.cxx +++ b/sw/source/ui/wrtsh/wrtsh1.cxx @@ -1816,7 +1816,7 @@ void SwWrtShell::ApplyViewOptions( const SwViewOption &rOpt ) void SwWrtShell::SetReadonlyOption(sal_Bool bSet) { - GetView().GetEditWin().SetReadonlyHeaderFooterControls( bSet ); + GetView().GetEditWin().GetFrameControlsManager().SetReadonlyControls( bSet ); ViewShell::SetReadonlyOption( bSet ); } @@ -1894,7 +1894,7 @@ void SwWrtShell::SetShowHeaderFooterSeparator( sal_Bool bShow ) { ViewShell::SetShowHeaderFooterSeparator( bShow ); if ( !bShow ) - GetView().GetEditWin().HideHeaderFooterControls( ); + GetView().GetEditWin().GetFrameControlsManager().HideControls( HeaderFooter ); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ commit 1ca08ac546c24f12644e387418d88dba7c1c4236 Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Sep 21 14:29:30 2011 +0200 Header/Footer: Extracted a few common things to a SwFrameControl class diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx index f1eb77a..f3bb00a 100644 --- a/sw/source/ui/docvw/HeaderFooterWin.cxx +++ b/sw/source/ui/docvw/HeaderFooterWin.cxx @@ -139,18 +139,13 @@ namespace SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPageFrm, bool bHeader ) : MenuButton( pEditWin, WB_DIALOGCONTROL ), - m_pEditWin( pEditWin ), + SwFrameControl( pEditWin, pPageFrm ), m_sLabel( ), - m_pPageFrm( pPageFrm ), m_bIsHeader( bHeader ), m_bReadonly( false ), m_pPopupMenu( NULL ), m_pLine( NULL ) { - // Define the readonly member - const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions(); - m_bReadonly = pViewOpt->IsReadonly(); - // Get the font and configure it Font aFont = GetSettings().GetStyleSettings().GetToolFont(); SetZoomedPointFont( aFont ); @@ -163,11 +158,11 @@ SwHeaderFooterWin::SwHeaderFooterWin( SwEditWin* pEditWin, const SwPageFrm* pPag if ( !m_bIsHeader ) m_sLabel = ResId::toString( SW_RES( STR_FOOTER_TITLE ) ); sal_Int32 nPos = m_sLabel.lastIndexOf( rtl::OUString::createFromAscii( "%1" ) ); - m_sLabel = m_sLabel.replaceAt( nPos, 2, m_pPageFrm->GetPageDesc()->GetName() ); + m_sLabel = m_sLabel.replaceAt( nPos, 2, GetPageFrame()->GetPageDesc()->GetName() ); // Create the line control basegfx::BColor aColor = SwViewOption::GetHeaderFooterMarkColor().getBColor(); - m_pLine = new SwDashedLine( m_pEditWin, aColor ); + m_pLine = new SwDashedLine( GetEditWin(), aColor ); // Create and set the PopupMenu m_pPopupMenu = new PopupMenu( SW_RES( MN_HEADERFOOTER_BUTTON ) ); @@ -193,6 +188,11 @@ SwHeaderFooterWin::~SwHeaderFooterWin( ) delete m_pLine; } +const SwPageFrm* SwHeaderFooterWin::GetPageFrame( ) +{ + return static_cast< const SwPageFrm * >( GetFrame( ) ); +} + void SwHeaderFooterWin::SetOffset( Point aOffset, long nXLineStart, long nXLineEnd ) { // Compute the text size and get the box position & size from it @@ -278,10 +278,10 @@ bool SwHeaderFooterWin::IsEmptyHeaderFooter( ) bool bResult = true; // Actually check it - const SwPageDesc* pDesc = m_pPageFrm->GetPageDesc(); + const SwPageDesc* pDesc = GetPageFrame()->GetPageDesc(); const SwFrmFmt* pFmt = pDesc->GetLeftFmt(); - if ( m_pPageFrm->OnRightPage() ) + if ( GetPageFrame()->OnRightPage() ) pFmt = pDesc->GetRightFmt(); if ( pFmt ) @@ -297,7 +297,7 @@ bool SwHeaderFooterWin::IsEmptyHeaderFooter( ) void SwHeaderFooterWin::ExecuteCommand( sal_uInt16 nSlot ) { - SwView& rView = m_pEditWin->GetView(); + SwView& rView = GetEditWin()->GetView(); SwWrtShell& rSh = rView.GetWrtShell(); const String& rStyleName = GetPageFrame()->GetPageDesc()->GetName(); @@ -316,7 +316,7 @@ void SwHeaderFooterWin::ExecuteCommand( sal_uInt16 nSlot ) break; case FN_HEADERFOOTER_BORDERBACK: { - const SwPageDesc* pDesc = m_pPageFrm->GetPageDesc(); + const SwPageDesc* pDesc = GetPageFrame()->GetPageDesc(); const SwFrmFmt& rMaster = pDesc->GetMaster(); SwFrmFmt* pHFFmt = const_cast< SwFrmFmt* >( rMaster.GetFooter().GetFooterFmt() ); if ( m_bIsHeader ) @@ -380,7 +380,7 @@ void SwHeaderFooterWin::MouseButtonDown( const MouseEvent& rMEvt ) { if ( IsEmptyHeaderFooter( ) ) { - SwView& rView = m_pEditWin->GetView(); + SwView& rView = GetEditWin()->GetView(); SwWrtShell& rSh = rView.GetWrtShell(); const String& rStyleName = GetPageFrame()->GetPageDesc()->GetName(); diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 3c29c27..e985981 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -5774,6 +5774,8 @@ void SwEditWin::SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, if ( !pControl.get() ) { boost::shared_ptr< SwHeaderFooterWin > pNewControl( new SwHeaderFooterWin( this, pPageFrm, bHeader ) ); + const SwViewOption* pViewOpt = GetView().GetWrtShell().GetViewOptions(); + pNewControl->SetReadonly( pViewOpt->IsReadonly() ); pControl.swap( pNewControl ); aHeadFootControls.push_back( pControl ); } diff --git a/sw/source/ui/inc/FrameControl.hxx b/sw/source/ui/inc/FrameControl.hxx new file mode 100644 index 0000000..01bbb6b --- /dev/null +++ b/sw/source/ui/inc/FrameControl.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License or as specified alternatively below. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * Major Contributor(s): + * [ Copyright (C) 2011 SUSE <cbosdon...@suse.com> (initial developer) ] + * + * All Rights Reserved. + * + * For minor contributions see the git repository. + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ +#ifndef _FRAMECONTROL_HXX +#define _FRAMECONTROL_HXX + +#include <edtwin.hxx> +#include <frame.hxx> + +/** Class representing a control linked to a SwFrm. + */ +class SwFrameControl +{ + SwEditWin* m_pEditWin; + const SwFrm* m_pFrm; + +public: + SwFrameControl( SwEditWin* pEditWin, const SwFrm* pFrm ) : + m_pEditWin( pEditWin ), m_pFrm( pFrm ) {}; + ~SwFrameControl( ) {}; + + const SwFrm* GetFrame( ) { return m_pFrm; } + SwEditWin* GetEditWin( ) { return m_pEditWin; } + + virtual void SetReadonly( bool bReadonly ) = 0; + virtual void ShowAll( bool bShow ) = 0; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/ui/inc/HeaderFooterWin.hxx b/sw/source/ui/inc/HeaderFooterWin.hxx index c59211d..bbb93b2 100644 --- a/sw/source/ui/inc/HeaderFooterWin.hxx +++ b/sw/source/ui/inc/HeaderFooterWin.hxx @@ -28,6 +28,7 @@ #ifndef _HEADERFOOTERWINDOW_HXX #define _HEADERFOOTERWINDOW_HXX +#include <FrameControl.hxx> #include <pagedesc.hxx> #include <vcl/menubtn.hxx> @@ -37,11 +38,9 @@ This control is showing the header / footer style name and provides a few useful actions to the user. */ -class SwHeaderFooterWin : public MenuButton +class SwHeaderFooterWin : public MenuButton, public SwFrameControl { - SwEditWin* m_pEditWin; rtl::OUString m_sLabel; - const SwPageFrm* m_pPageFrm; bool m_bIsHeader; bool m_bReadonly; PopupMenu* m_pPopupMenu; @@ -61,7 +60,7 @@ public: bool IsHeader() { return m_bIsHeader; }; bool IsEmptyHeaderFooter( ); - const SwPageFrm* GetPageFrame( ) { return m_pPageFrm; }; + const SwPageFrm* GetPageFrame( ); void ExecuteCommand(sal_uInt16 nSlot); commit aaa34f74a639b8cf54d27d52b292f4d0ed0f1231 Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Sep 21 10:02:58 2011 +0200 Page Break: Fix the line position in side-by-side pages display diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index a03701f..5a1621a 100755 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3338,9 +3338,7 @@ void SwPageFrm::PaintBreak( ) const if ( pCnt && pCnt->IsPageBreak( sal_True ) ) { const SwPageFrm* pPageFrm = FindPageFrm(); - const SwPageFrm* pPrevPageFrm = static_cast< const SwPageFrm* >( pPageFrm->GetPrev() ); - - double nYLineOffset = double( pPageFrm->Frm().Top() + pPrevPageFrm->Frm().Bottom() ) / 2.0; + double nYLineOffset = double( pPageFrm->GetBoundRect().Top() + pPageFrm->Frm().Top() ) / 2.0; SwRect aRect = pPageFrm->GetBoundRect(); basegfx::BColor aColor = SwViewOption::GetPageBreakColor().getBColor(); commit 7a6ae7ff20a0b26a083c13649712635758797c15 Author: Cédric Bosdonnat <cedric.bosdonnat....@free.fr> Date: Wed Sep 21 09:51:51 2011 +0200 Page Break: decouple it from the text bounding lines painting diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 5300ba8..4d5d3e8 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -170,7 +170,7 @@ public: const SwFrm* GetLastLower() const; inline SwFrm* GetLastLower(); - virtual void PaintBreak() const{ }; + virtual void PaintBreak() const; }; //Um doppelte Implementierung zu sparen wird hier ein bischen gecasted diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f3db985..a03701f 100755 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -3006,6 +3006,7 @@ SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) const } pPage->PaintDecorators( ); + pPage->PaintBreak(); } else if ( bBookMode && pSh->GetWin() && !pSh->GetDoc()->GetDocShell()->IsInPlaceActive() ) { @@ -3385,6 +3386,7 @@ void SwPageFrm::PaintBreak( ) const ProcessPrimitives( aSeq ); } } + SwLayoutFrm::PaintBreak( ); } } @@ -3474,6 +3476,17 @@ void SwColumnFrm::PaintBreak( ) const } } +void SwLayoutFrm::PaintBreak( ) const +{ + const SwFrm* pFrm = Lower(); + while ( pFrm ) + { + if ( pFrm->IsLayoutFrm() ) + static_cast< const SwLayoutFrm*>( pFrm )->PaintBreak( ); + pFrm = pFrm->GetNext(); + } +} + void SwPageFrm::PaintDecorators( ) const { SwWrtShell* pWrtSh = dynamic_cast< SwWrtShell* >( pGlobalShell ); @@ -6377,8 +6390,6 @@ void SwPageFrm::PaintSubsidiaryLines( const SwPageFrm *, ProcessPrimitives( lcl_CreatePageAreaDelimiterPrimitives( aArea ) ); } - - PaintBreak(); } void SwColumnFrm::PaintSubsidiaryLines( const SwPageFrm *, @@ -6415,8 +6426,6 @@ void SwColumnFrm::PaintSubsidiaryLines( const SwPageFrm *, ::SwAlignRect( aArea, pGlobalShell ); ProcessPrimitives( lcl_CreateColumnAreaDelimiterPrimitives( aArea ) ); - - PaintBreak(); } void SwSectionFrm::PaintSubsidiaryLines( const SwPageFrm * pPage,
_______________________________________________ Libreoffice-commits mailing list Libreoffice-commits@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits