summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-20 12:37:42 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-20 12:38:51 +0100
commit27fc60874795849b43903f27076e9dcafb958c76 (patch)
tree7df32c1a58006df9002a236d88355699e8590298
parent52871279e9811d437ebe881e30b6c76208c84e65 (diff)
Related: fdo#78151 disable promote or demote outline levels in master view
it doesn't make sense in master view to do that Change-Id: I838422f93131b8a92745a624738c5be3a7ed3459
-rw-r--r--sd/source/ui/view/drtxtob.cxx134
1 files changed, 71 insertions, 63 deletions
diff --git a/sd/source/ui/view/drtxtob.cxx b/sd/source/ui/view/drtxtob.cxx
index 73852d01f7ac..ec24fc937367 100644
--- a/sd/source/ui/view/drtxtob.cxx
+++ b/sd/source/ui/view/drtxtob.cxx
@@ -253,88 +253,96 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
bool bDisableRight = true;
bool bDisableUp = true;
bool bDisableDown = true;
- OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
- if (mpView->ISA(OutlineView))
- {
- pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
- mpViewShell->GetActiveWindow());
- }
+ //fdo#78151 it doesn't make sense to promote or demote outline levels in master view.
+ const DrawViewShell* pDrawViewShell = dynamic_cast< DrawViewShell* >(mpViewShell);
+ const bool bInMasterView = pDrawViewShell && pDrawViewShell->GetEditMode() == EM_MASTERPAGE;
- bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell);
-
- if (pOLV &&
- ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) )
+ if (!bInMasterView)
{
- // Outliner at outline-mode
- ::Outliner* pOutl = pOLV->GetOutliner();
+ OutlinerView* pOLV = mpView->GetTextEditOutlinerView();
- std::vector<Paragraph*> aSelList;
- pOLV->CreateSelectionList(aSelList);
- Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
+ if (mpView->ISA(OutlineView))
+ {
+ pOLV = static_cast<OutlineView*>(mpView)->GetViewByWindow(
+ mpViewShell->GetActiveWindow());
+ }
- // find out if we are a OutlineView
- bool bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode());
+ bool bOutlineViewSh = mpViewShell->ISA(OutlineViewShell);
- // This is ONLY for OutlineViews
- if(bIsOutlineView)
+ if (pOLV &&
+ ( pOLV->GetOutliner()->GetMode() == OUTLINERMODE_OUTLINEOBJECT || bOutlineViewSh ) )
{
- // allow move up if position is 2 or greater OR it
- // is a title object (and thus depth==1)
- if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) )
+ // Outliner at outline-mode
+ ::Outliner* pOutl = pOLV->GetOutliner();
+
+ std::vector<Paragraph*> aSelList;
+ pOLV->CreateSelectionList(aSelList);
+ Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
+
+ // find out if we are a OutlineView
+ bool bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode());
+
+ // This is ONLY for OutlineViews
+ if(bIsOutlineView)
{
- // not at top
- bDisableUp = false;
+ // allow move up if position is 2 or greater OR it
+ // is a title object (and thus depth==1)
+ if(pOutl->GetAbsPos(pPara) > 1 || ( pOutl->HasParaFlag(pPara,PARAFLAG_ISPAGE) && pOutl->GetAbsPos(pPara) > 0 ) )
+ {
+ // not at top
+ bDisableUp = false;
+ }
}
- }
- else
- {
- // old behaviour for OUTLINERMODE_OUTLINEOBJECT
- if(pOutl->GetAbsPos(pPara) > 0)
+ else
{
- // not at top
- bDisableUp = false;
+ // old behaviour for OUTLINERMODE_OUTLINEOBJECT
+ if(pOutl->GetAbsPos(pPara) > 0)
+ {
+ // not at top
+ bDisableUp = false;
+ }
}
- }
- for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
- {
- pPara = *iter;
-
- sal_Int16 nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) );
-
- if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) )
+ for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
{
- // not minimum depth
- bDisableLeft = false;
+ pPara = *iter;
+
+ sal_Int16 nDepth = pOutl->GetDepth( pOutl->GetAbsPos( pPara ) );
+
+ if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) )
+ {
+ // not minimum depth
+ bDisableLeft = false;
+ }
+
+ if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) ||
+ (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) )
+ {
+ // not maximum depth and not at top
+ bDisableRight = false;
+ }
}
- if( (nDepth < pOLV->GetOutliner()->GetMaxDepth() && ( !bOutlineViewSh || pOutl->GetAbsPos(pPara) != 0 )) ||
- (bOutlineViewSh && (nDepth <= 0) && pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) && pOutl->GetAbsPos(pPara) != 0) )
+ if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) &&
+ ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
{
- // not maximum depth and not at top
- bDisableRight = false;
+ // not last paragraph
+ bDisableDown = false;
}
- }
- if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) &&
- ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
- {
- // not last paragraph
- bDisableDown = false;
- }
-
- // disable when first para and 2nd is not a title
- pPara = aSelList.empty() ? NULL : *(aSelList.begin());
+ // disable when first para and 2nd is not a title
+ pPara = aSelList.empty() ? NULL : *(aSelList.begin());
- if(!bDisableDown && bIsOutlineView
- && pPara
- && 0 == pOutl->GetAbsPos(pPara)
- && pOutl->GetParagraphCount() > 1
- && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) )
- {
- // Needs to be disabled
- bDisableDown = true;
+ if(!bDisableDown && bIsOutlineView
+ && pPara
+ && 0 == pOutl->GetAbsPos(pPara)
+ && pOutl->GetParagraphCount() > 1
+ && !pOutl->HasParaFlag( pOutl->GetParagraph(1), PARAFLAG_ISPAGE ) )
+ {
+ // Needs to be disabled
+ bDisableDown = true;
+ }
}
}