summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-09 09:13:10 +0200
committerCédric Bosdonnat <cedric.bosdonnat.ooo@free.fr>2011-09-09 21:34:08 +0200
commit16400db4629133ad59ce8cbc8746a63b33202fd3 (patch)
tree0e37f19c60edb18847e8e507208203b388df7644 /sw
parent052f181dad89ad34d90513bc9dcd3e3239727933 (diff)
Header/Footer: don't show the separator action in readonly mode
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/viewsh.hxx2
-rw-r--r--sw/source/ui/docvw/HeaderFooterWin.cxx15
-rw-r--r--sw/source/ui/docvw/edtwin.cxx10
-rw-r--r--sw/source/ui/inc/HeaderFooterWin.hxx2
-rw-r--r--sw/source/ui/inc/edtwin.hxx1
-rw-r--r--sw/source/ui/inc/wrtsh.hxx1
-rw-r--r--sw/source/ui/wrtsh/wrtsh1.cxx6
7 files changed, 35 insertions, 2 deletions
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 472739e988a3..3f95de7ac0d5 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -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.
diff --git a/sw/source/ui/docvw/HeaderFooterWin.cxx b/sw/source/ui/docvw/HeaderFooterWin.cxx
index e926d5406bcb..1a33706fa97b 100644
--- a/sw/source/ui/docvw/HeaderFooterWin.cxx
+++ b/sw/source/ui/docvw/HeaderFooterWin.cxx
@@ -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 )
diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx
index 6b800f81afa1..034b0631ec5b 100644
--- a/sw/source/ui/docvw/edtwin.cxx
+++ b/sw/source/ui/docvw/edtwin.cxx
@@ -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: */
diff --git a/sw/source/ui/inc/HeaderFooterWin.hxx b/sw/source/ui/inc/HeaderFooterWin.hxx
index c3c21d500158..e7d4d65c80fa 100644
--- a/sw/source/ui/inc/HeaderFooterWin.hxx
+++ b/sw/source/ui/inc/HeaderFooterWin.hxx
@@ -63,6 +63,8 @@ public:
void ChangeHeaderOrFooter( bool bAdd );
void ExecuteCommand(sal_uInt16 nSlot);
+ void SetReadonly( bool bReadonly );
+
private:
MenuButton* GetMenuButton( );
};
diff --git a/sw/source/ui/inc/edtwin.hxx b/sw/source/ui/inc/edtwin.hxx
index 142514c655f7..6468f5122a79 100644
--- a/sw/source/ui/inc/edtwin.hxx
+++ b/sw/source/ui/inc/edtwin.hxx
@@ -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();
diff --git a/sw/source/ui/inc/wrtsh.hxx b/sw/source/ui/inc/wrtsh.hxx
index ef7337d6178f..e98afbd33333 100644
--- a/sw/source/ui/inc/wrtsh.hxx
+++ b/sw/source/ui/inc/wrtsh.hxx
@@ -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);
diff --git a/sw/source/ui/wrtsh/wrtsh1.cxx b/sw/source/ui/wrtsh/wrtsh1.cxx
index 9a3a7d953644..94460f91425b 100644
--- a/sw/source/ui/wrtsh/wrtsh1.cxx
+++ b/sw/source/ui/wrtsh/wrtsh1.cxx
@@ -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: */