[Libreoffice-commits] core.git: sw/source
Norbert Thiebaud
nthiebaud at gmail.com
Mon Jun 24 05:26:03 PDT 2013
sw/source/ui/uiview/view0.cxx | 260 +++++++++++++++++++++---------------------
1 file changed, 132 insertions(+), 128 deletions(-)
New commits:
commit 5ac84ff884b491df4631d78b3c4ba74eddb0b1a5
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Thu Jun 20 14:03:38 2013 -0500
coverity#705766 Resource leak
Change-Id: I14ca19f33dd57ed1a4a52a8a02f213bada79c20c
Reviewed-on: https://gerrit.libreoffice.org/4409
Reviewed-by: Michael Stahl <mstahl at redhat.com>
Tested-by: Michael Stahl <mstahl at redhat.com>
diff --git a/sw/source/ui/uiview/view0.cxx b/sw/source/ui/uiview/view0.cxx
index 891680d..bcb06f6 100644
--- a/sw/source/ui/uiview/view0.cxx
+++ b/sw/source/ui/uiview/view0.cxx
@@ -360,177 +360,181 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
switch ( nSlot )
{
- case FN_VIEW_GRAPHIC:
-
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsGraphic();
- pOpt->SetGraphic( bFlag );
- break;
+ case FN_VIEW_GRAPHIC:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsGraphic();
+ pOpt->SetGraphic( bFlag );
+ break;
- case FN_VIEW_FIELDS:
- if( STATE_TOGGLE == eState )
- bFlag = !SwViewOption::IsFieldShadings() ;
- SwViewOption::SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bFlag, sal_True );
- break;
+ case FN_VIEW_FIELDS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !SwViewOption::IsFieldShadings() ;
+ SwViewOption::SetAppearanceFlag(VIEWOPT_FIELD_SHADINGS, bFlag, sal_True );
+ break;
- case FN_VIEW_BOUNDS:
- if( STATE_TOGGLE == eState )
- bFlag = !SwViewOption::IsDocBoundaries();
- SwViewOption::SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bFlag, sal_True );
- break;
+ case FN_VIEW_BOUNDS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !SwViewOption::IsDocBoundaries();
+ SwViewOption::SetAppearanceFlag(VIEWOPT_DOC_BOUNDARIES, bFlag, sal_True );
+ break;
- case SID_GRID_VISIBLE:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsGridVisible();
+ case SID_GRID_VISIBLE:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsGridVisible();
- pOpt->SetGridVisible( bFlag );
- break;
+ pOpt->SetGridVisible( bFlag );
+ break;
- case SID_GRID_USE:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsSnap();
+ case SID_GRID_USE:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsSnap();
- pOpt->SetSnap( bFlag );
- break;
+ pOpt->SetSnap( bFlag );
+ break;
- case SID_HELPLINES_MOVE:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsCrossHair();
+ case SID_HELPLINES_MOVE:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsCrossHair();
- pOpt->SetCrossHair( bFlag );
- break;
+ pOpt->SetCrossHair( bFlag );
+ break;
- case SID_BROWSER_MODE:
- case FN_PRINT_LAYOUT:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->getBrowseMode();
- else if( nSlot == FN_PRINT_LAYOUT )
- bFlag = !bFlag;
- bBrowseModeChanged = bFlag != pOpt->getBrowseMode();
- // Disable "multiple layout"
- GetDocShell()->ToggleBrowserMode( bFlag, this );
-
- pOpt->setBrowseMode( bFlag );
- break;
+ case SID_BROWSER_MODE:
+ case FN_PRINT_LAYOUT:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->getBrowseMode();
+ else if( nSlot == FN_PRINT_LAYOUT )
+ bFlag = !bFlag;
+ bBrowseModeChanged = bFlag != pOpt->getBrowseMode();
+ // Disable "multiple layout"
+ GetDocShell()->ToggleBrowserMode( bFlag, this );
+ pOpt->setBrowseMode( bFlag );
+ break;
case FN_VIEW_NOTES:
- if ( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsPostIts();
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsPostIts();
- GetPostItMgr()->SetLayout();
- pOpt->SetPostIts( bFlag );
- if (pOpt->IsPostIts())
+ GetPostItMgr()->SetLayout();
+ pOpt->SetPostIts( bFlag );
+ if (pOpt->IsPostIts())
GetPostItMgr()->CheckMetaText();
- break;
+ break;
- case FN_VIEW_HIDDEN_PARA:
- if ( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsShowHiddenPara();
+ case FN_VIEW_HIDDEN_PARA:
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsShowHiddenPara();
- pOpt->SetShowHiddenPara( bFlag );
- break;
+ pOpt->SetShowHiddenPara( bFlag );
+ break;
- case FN_VIEW_SMOOTH_SCROLL:
+ case FN_VIEW_SMOOTH_SCROLL:
- if ( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsSmoothScroll();
+ if ( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsSmoothScroll();
- pOpt->SetSmoothScroll( bFlag );
- break;
+ pOpt->SetSmoothScroll( bFlag );
+ break;
- case FN_VLINEAL:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsViewVRuler();
+ case FN_VLINEAL:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewVRuler();
- pOpt->SetViewVRuler( bFlag );
- break;
+ pOpt->SetViewVRuler( bFlag );
+ break;
- case FN_VSCROLLBAR:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsViewVScrollBar();
+ case FN_VSCROLLBAR:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewVScrollBar();
- pOpt->SetViewVScrollBar( bFlag );
- break;
+ pOpt->SetViewVScrollBar( bFlag );
+ break;
- case FN_HSCROLLBAR:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsViewHScrollBar();
+ case FN_HSCROLLBAR:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewHScrollBar();
- pOpt->SetViewHScrollBar( bFlag );
- break;
- case FN_RULER:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsViewAnyRuler();
+ pOpt->SetViewHScrollBar( bFlag );
+ break;
- pOpt->SetViewAnyRuler( bFlag );
- break;
+ case FN_RULER:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewAnyRuler();
- case FN_VIEW_TABLEGRID:
- if( STATE_TOGGLE == eState )
- bFlag = !SwViewOption::IsTableBoundaries();
- SwViewOption::SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bFlag, sal_True );
- break;
+ pOpt->SetViewAnyRuler( bFlag );
+ break;
- case FN_VIEW_FIELDNAME:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsFldName() ;
+ case FN_VIEW_TABLEGRID:
+ if( STATE_TOGGLE == eState )
+ bFlag = !SwViewOption::IsTableBoundaries();
+ SwViewOption::SetAppearanceFlag(VIEWOPT_TABLE_BOUNDARIES, bFlag, sal_True );
+ break;
- pOpt->SetFldName( bFlag );
- break;
- case FN_VIEW_MARKS:
- if( STATE_TOGGLE == eState )
- bFlag = !lcl_IsViewMarks(*pOpt) ;
+ case FN_VIEW_FIELDNAME:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsFldName() ;
- lcl_SetViewMarks( *pOpt, bFlag );
- break;
- case FN_VIEW_META_CHARS:
- if( STATE_TOGGLE == eState )
- bFlag = !pOpt->IsViewMetaChars();
+ pOpt->SetFldName( bFlag );
+ break;
+
+ case FN_VIEW_MARKS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !lcl_IsViewMarks(*pOpt) ;
- lcl_SetViewMetaChars( *pOpt, bFlag );
+ lcl_SetViewMarks( *pOpt, bFlag );
break;
- case SID_AUTOSPELL_CHECK:
- if( STATE_TOGGLE == eState )
- bFlag = bSet = !pOpt->IsOnlineSpell();
- pOpt->SetOnlineSpell(bSet);
- {
- uno::Any aVal( &bSet, ::getCppuBooleanType() );
- OUString aPropName(UPN_IS_SPELL_AUTO);
+ case FN_VIEW_META_CHARS:
+ if( STATE_TOGGLE == eState )
+ bFlag = !pOpt->IsViewMetaChars();
- SvtLinguConfig aCfg;
- aCfg.SetProperty( aPropName, aVal );
+ lcl_SetViewMetaChars( *pOpt, bFlag );
+ break;
- if (xLngProp.is())
- xLngProp->setIsSpellAuto( bSet );
+ case SID_AUTOSPELL_CHECK:
+ if( STATE_TOGGLE == eState )
+ bFlag = bSet = !pOpt->IsOnlineSpell();
- // for the time being we do not have a specific option for grammarchecking.
- // thus we'll use the one for spell checking...
- if (bSet)
- {
- SwDocShell *pDocSh = GetDocShell();
- SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL;
+ pOpt->SetOnlineSpell(bSet);
+ {
+ uno::Any aVal( &bSet, ::getCppuBooleanType() );
+ OUString aPropName(UPN_IS_SPELL_AUTO);
- // right now we don't have view options for automatic grammar checking. Thus...
- sal_Bool bIsAutoGrammar = sal_False;
- aCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bIsAutoGrammar;
+ SvtLinguConfig aCfg;
+ aCfg.SetProperty( aPropName, aVal );
- if (pDoc && bIsAutoGrammar)
- StartGrammarChecking( *pDoc );
- }
+ if (xLngProp.is())
+ xLngProp->setIsSpellAuto( bSet );
+
+ // for the time being we do not have a specific option for grammarchecking.
+ // thus we'll use the one for spell checking...
+ if (bSet)
+ {
+ SwDocShell *pDocSh = GetDocShell();
+ SwDoc *pDoc = pDocSh? pDocSh->GetDoc() : NULL;
+
+ // right now we don't have view options for automatic grammar checking. Thus...
+ sal_Bool bIsAutoGrammar = sal_False;
+ aCfg.GetProperty( UPN_IS_GRAMMAR_AUTO ) >>= bIsAutoGrammar;
+
+ if (pDoc && bIsAutoGrammar)
+ StartGrammarChecking( *pDoc );
}
+ }
break;
- case FN_SHADOWCURSOR:
- if( STATE_TOGGLE == eState )
- bFlag = bSet = !pOpt->IsShadowCursor();
- pOpt->SetShadowCursor(bSet);
+ case FN_SHADOWCURSOR:
+ if( STATE_TOGGLE == eState )
+ bFlag = bSet = !pOpt->IsShadowCursor();
+
+ pOpt->SetShadowCursor(bSet);
break;
- default:
- OSL_FAIL("wrong request method");
- return;
+ default:
+ delete pOpt;
+ OSL_FAIL("wrong request method");
+ return;
}
// Set UserPrefs, mark request as modified
More information about the Libreoffice-commits
mailing list