summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/tabcont.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2010-10-13 00:37:10 -0400
committerKohei Yoshida <kyoshida@novell.com>2010-10-13 00:37:10 -0400
commit123cca20a19868a52a25f79680f20cb4e92ed7ce (patch)
treef2a066f59838997099ddb81eec3fe3ccc9e5ff99 /sc/source/ui/view/tabcont.cxx
parent4b33c0d44fe85064d73ebe39eba4ea2d8ed018b9 (diff)
Remove the "insert new sheet" tab when the document is in read-only mode.
When the document is in read-only mode, we shouldn't show the insert sheet tab. (fdo#30678)
Diffstat (limited to 'sc/source/ui/view/tabcont.cxx')
-rw-r--r--sc/source/ui/view/tabcont.cxx17
1 files changed, 15 insertions, 2 deletions
diff --git a/sc/source/ui/view/tabcont.cxx b/sc/source/ui/view/tabcont.cxx
index 1048c903ec4a..06bc9612866b 100644
--- a/sc/source/ui/view/tabcont.cxx
+++ b/sc/source/ui/view/tabcont.cxx
@@ -54,8 +54,9 @@
//==================================================================
ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
- TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_INSERTTAB |
- WB_RANGESELECT | WB_MULTISELECT | WB_DRAG | WB_SIZEABLE ) ),
+ TabBar( pParent,
+ WinBits(WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_RANGESELECT |
+ WB_MULTISELECT | WB_DRAG | WB_SIZEABLE) ),
DropTargetHelper( this ),
DragSourceHelper( this ),
pViewData( pData ),
@@ -94,6 +95,7 @@ ScTabControl::ScTabControl( Window* pParent, ScViewData* pData ) :
SetSplitHdl( LINK( pViewData->GetView(), ScTabView, TabBarResize ) );
EnableEditMode();
+ UpdateInputContext();
}
ScTabControl::~ScTabControl()
@@ -297,6 +299,17 @@ void ScTabControl::Select()
}
}
+void ScTabControl::UpdateInputContext()
+{
+ ScDocument* pDoc = pViewData->GetDocument();
+ WinBits nStyle = GetStyle();
+ if (pDoc->GetDocumentShell()->IsReadOnly())
+ // no insert sheet tab for readonly doc.
+ SetStyle((nStyle & ~WB_INSERTTAB));
+ else
+ SetStyle((nStyle | WB_INSERTTAB));
+}
+
void ScTabControl::UpdateStatus()
{
ScDocument* pDoc = pViewData->GetDocument();