summaryrefslogtreecommitdiff
path: root/sc/source/ui/app/scmod.cxx
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2012-06-04 14:20:35 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2012-06-05 12:16:24 -0400
commit1227601d74ecddb06dcbe69e260aa32835900ed3 (patch)
treec1e10121461221780a4db173afa5b19c7d667ee0 /sc/source/ui/app/scmod.cxx
parentf7ebee38a3c5c6cb58f40109a213d449138ea987 (diff)
Disable file load and save and a whole bunch of other commands in preview.
We will probably need to go through more commands and disable them. Change-Id: Ie3d547f18d799b76290f469d2790902c6883774c
Diffstat (limited to 'sc/source/ui/app/scmod.cxx')
-rw-r--r--sc/source/ui/app/scmod.cxx31
1 files changed, 13 insertions, 18 deletions
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c2eb40441e74..845e551ac7f1 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -586,10 +586,19 @@ void ScModule::Execute( SfxRequest& rReq )
void ScModule::GetState( SfxItemSet& rSet )
{
+ ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
+ bool bTabView = pDocSh && (pDocSh->GetBestViewShell(true) != NULL);
+
SfxWhichIter aIter(rSet);
- sal_uInt16 nWhich = aIter.FirstWhich();
- while ( nWhich )
+ for (sal_uInt16 nWhich = aIter.FirstWhich(); nWhich; nWhich = aIter.NextWhich())
{
+ if (!bTabView)
+ {
+ // Not in the normal calc view shell (most likely in preview shell). Disable all actions.
+ rSet.DisableItem(nWhich);
+ continue;
+ }
+
switch ( nWhich )
{
case FID_AUTOCOMPLETE:
@@ -605,25 +614,13 @@ void ScModule::GetState( SfxItemSet& rSet )
rSet.Put( SfxUInt16Item( nWhich, sal::static_int_cast<sal_uInt16>(GetAppOptions().GetAppMetric()) ) );
break;
case SID_AUTOSPELL_CHECK:
- {
- sal_Bool bAuto;
- ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
- if ( pDocSh )
- bAuto = pDocSh->GetDocument()->GetDocOptions().IsAutoSpell();
- else
- {
- sal_uInt16 nDummyLang, nDummyCjk, nDummyCtl;
- GetSpellSettings( nDummyLang, nDummyCjk, nDummyCtl, bAuto );
- }
- rSet.Put( SfxBoolItem( nWhich, bAuto ) );
- }
+ rSet.Put( SfxBoolItem( nWhich, pDocSh->GetDocument()->GetDocOptions().IsAutoSpell()) );
break;
case SID_ATTR_LANGUAGE:
case ATTR_CJK_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CJK_LANGUAGE
case ATTR_CTL_FONT_LANGUAGE: // WID for SID_ATTR_CHAR_CTL_LANGUAGE
{
- ScDocShell* pDocSh = PTR_CAST(ScDocShell, SfxObjectShell::Current());
- ScDocument* pDoc = pDocSh ? pDocSh->GetDocument() : NULL;
+ ScDocument* pDoc = pDocSh->GetDocument();
if ( pDoc )
{
LanguageType eLatin, eCjk, eCtl;
@@ -634,9 +631,7 @@ void ScModule::GetState( SfxItemSet& rSet )
}
}
break;
-
}
- nWhich = aIter.NextWhich();
}
}