Kaydet (Commit) 16400db4 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Header/Footer: don't show the separator action in readonly mode

üst 052f181d
......@@ -423,7 +423,7 @@ public:
inline const SwViewOption *GetViewOptions() const { return pOpt; }
virtual void ApplyViewOptions( const SwViewOption &rOpt );
void SetUIOptions( const SwViewOption &rOpt );
void SetReadonlyOption(sal_Bool bSet); // Set readonly-bit of ViewOptions.
virtual void SetReadonlyOption(sal_Bool bSet); // Set readonly-bit of ViewOptions.
void SetPDFExportOption(sal_Bool bSet); // Set/reset PDF export mode.
void SetPrtFormatOption(sal_Bool bSet); // Set PrtFormat-Bit of ViewOptions.
void SetReadonlySelectionOption(sal_Bool bSet); // Change the selection mode in readonly docs.
......
......@@ -150,9 +150,13 @@ SwHeaderFooterWin::~SwHeaderFooterWin( )
MenuButton* SwHeaderFooterWin::GetMenuButton()
{
if ( !m_pButton )
{
m_pButton = new SwHeaderFooterButton( this );
m_pButton->Show();
// Don't blindly show it: check for readonly document
const SwViewOption* pViewOpt = m_pEditWin->GetView().GetWrtShell().GetViewOptions();
m_pButton->Show( !pViewOpt->IsReadonly() );
}
return m_pButton;
}
......@@ -274,6 +278,15 @@ void SwHeaderFooterWin::ExecuteCommand( sal_uInt16 nSlot )
}
}
void SwHeaderFooterWin::SetReadonly( bool bReadonly )
{
if ( bReadonly )
m_pButton->Hide();
else
m_pButton->Show();
Update();
}
SwHeaderFooterButton::SwHeaderFooterButton( SwHeaderFooterWin* pWindow ) :
MenuButton( pWindow ),
m_pWindow( pWindow )
......
......@@ -5736,4 +5736,14 @@ void SwEditWin::HideHeaderFooterControls( )
}
}
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: */
......@@ -63,6 +63,8 @@ public:
void ChangeHeaderOrFooter( bool bAdd );
void ExecuteCommand(sal_uInt16 nSlot);
void SetReadonly( bool bReadonly );
private:
MenuButton* GetMenuButton( );
};
......
......@@ -315,6 +315,7 @@ public:
void SetHeaderFooterControl( const SwPageFrm* pPageFrm, bool bHeader, Point aOffset );
void RemoveHeaderFooterControls( const SwPageFrm* pPageFrm );
void HideHeaderFooterControls( );
void SetReadonlyHeaderFooterControls( bool bReadonly );
SwEditWin(Window *pParent, SwView &);
virtual ~SwEditWin();
......
......@@ -450,6 +450,7 @@ typedef sal_Bool (SwWrtShell:: *FNSimpleMove)();
virtual void NewCoreSelection();
virtual void ApplyViewOptions( const SwViewOption &rOpt );
virtual void SetReadonlyOption( sal_Bool bSet );
// automatic update of styles
void AutoUpdateFrame(SwFrmFmt* pFmt, const SfxItemSet& rStyleSet);
......
......@@ -1808,4 +1808,10 @@ void SwWrtShell::ApplyViewOptions( const SwViewOption &rOpt )
}
void SwWrtShell::SetReadonlyOption(sal_Bool bSet)
{
GetView().GetEditWin().SetReadonlyHeaderFooterControls( bSet );
ViewShell::SetReadonlyOption( bSet );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment