Kaydet (Commit) cb0860ba authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Fridrich Štrba

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
üst 6ca0518b
......@@ -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;
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment