Kaydet (Commit) e0284f4b authored tarafından npcdoom's avatar npcdoom Kaydeden (comit) Thorsten Behrens

Remove usage of deprecated container List in sd.

üst 923452cf
...@@ -630,14 +630,16 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium) ...@@ -630,14 +630,16 @@ void FuInsertFile::InsTextOrRTFinOlMode(SfxMedium* pMedium)
nFormat = EE_FORMAT_HTML; nFormat = EE_FORMAT_HTML;
::Outliner* pDocliner = static_cast<OutlineView*>(mpView)->GetOutliner(); ::Outliner* pDocliner = static_cast<OutlineView*>(mpView)->GetOutliner();
List* pList = pDocliner->GetView(0)->CreateSelectionList();
Paragraph* pPara = (Paragraph*)pList->First(); std::vector<Paragraph*> aSelList;
pDocliner->GetView(0)->CreateSelectionList(aSelList);
Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
// wo soll eingefuegt werden? // wo soll eingefuegt werden?
while( !pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) while( !pDocliner->HasParaFlag( pPara, PARAFLAG_ISPAGE ) )
{
pPara = pDocliner->GetParent(pPara); pPara = pDocliner->GetParent(pPara);
}
ULONG nTargetPos = pDocliner->GetAbsPos(pPara) + 1; ULONG nTargetPos = pDocliner->GetAbsPos(pPara) + 1;
// Layout der Vorgaengerseite uebernehmen // Layout der Vorgaengerseite uebernehmen
......
...@@ -99,13 +99,20 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) ...@@ -99,13 +99,20 @@ void FuPresentationObjects::DoExecute( SfxRequest& )
OutlineView* pOlView = static_cast<OutlineView*>(pOutlineViewShell->GetView()); OutlineView* pOlView = static_cast<OutlineView*>(pOutlineViewShell->GetView());
OutlinerView* pOutlinerView = pOlView->GetViewByWindow( (Window*) mpWindow ); OutlinerView* pOutlinerView = pOlView->GetViewByWindow( (Window*) mpWindow );
::Outliner* pOutl = pOutlinerView->GetOutliner(); ::Outliner* pOutl = pOutlinerView->GetOutliner();
List* pList = pOutlinerView->CreateSelectionList();
Paragraph* pPara = (Paragraph*)pList->First(); std::vector<Paragraph*> aSelList;
pOutlinerView->CreateSelectionList(aSelList);
std::vector<Paragraph*>::const_iterator iter = aSelList.begin();
Paragraph* pPara = aSelList.empty() ? NULL : *iter;
nDepth = pOutl->GetDepth((USHORT)pOutl->GetAbsPos( pPara ) ); nDepth = pOutl->GetDepth((USHORT)pOutl->GetAbsPos( pPara ) );
bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ); bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
while( pPara ) while( iter != aSelList.end() )
{ {
pPara = *iter;
nTmp = pOutl->GetDepth((USHORT) pOutl->GetAbsPos( pPara ) ); nTmp = pOutl->GetDepth((USHORT) pOutl->GetAbsPos( pPara ) );
if( nDepth != nTmp ) if( nDepth != nTmp )
...@@ -120,8 +127,7 @@ void FuPresentationObjects::DoExecute( SfxRequest& ) ...@@ -120,8 +127,7 @@ void FuPresentationObjects::DoExecute( SfxRequest& )
break; break;
} }
bUnique = TRUE; bUnique = TRUE;
++iter;
pPara = (Paragraph*) pList->Next();
} }
if( bUnique ) if( bUnique )
......
...@@ -191,8 +191,8 @@ private: ...@@ -191,8 +191,8 @@ private:
SdrOutliner* mpOutliner; SdrOutliner* mpOutliner;
OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS]; OutlinerView* mpOutlinerView[MAX_OUTLINERVIEWS];
List* mpOldParaOrder; std::vector<Paragraph*> maOldParaOrder;
List* mpSelectedParas; std::vector<Paragraph*> maSelectedParas;
USHORT mnPagesToProcess; // fuer die Fortschrittsanzeige USHORT mnPagesToProcess; // fuer die Fortschrittsanzeige
USHORT mnPagesProcessed; USHORT mnPagesProcessed;
......
...@@ -206,7 +206,7 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet, ...@@ -206,7 +206,7 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet,
// Presentation object outline // Presentation object outline
OutlinerView* pOV = GetTextEditOutlinerView(); OutlinerView* pOV = GetTextEditOutlinerView();
::Outliner* pOutliner = pOV->GetOutliner(); ::Outliner* pOutliner = pOV->GetOutliner();
List* pList = (List*)pOV->CreateSelectionList();
aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE)); aTemplateName += String(SdResId(STR_LAYOUT_OUTLINE));
pOutliner->SetUpdateMode(FALSE); pOutliner->SetUpdateMode(FALSE);
...@@ -219,7 +219,12 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet, ...@@ -219,7 +219,12 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet,
aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos); aComment.Insert( String((SdResId(STR_PSEUDOSHEET_OUTLINE))), nPos);
mpDocSh->GetUndoManager()->EnterListAction( aComment, String() ); mpDocSh->GetUndoManager()->EnterListAction( aComment, String() );
Paragraph* pPara = (Paragraph*)pList->Last(); std::vector<Paragraph*> aSelList;
pOV->CreateSelectionList(aSelList);
std::vector<Paragraph*>::reverse_iterator iter = aSelList.rbegin();
Paragraph* pPara = iter != aSelList.rend() ? *iter : NULL;
while (pPara) while (pPara)
{ {
ULONG nParaPos = pOutliner->GetAbsPos( pPara ); ULONG nParaPos = pOutliner->GetAbsPos( pPara );
...@@ -260,10 +265,11 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet, ...@@ -260,10 +265,11 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet,
pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED)); pOutlSheet->Broadcast(SfxSimpleHint(SFX_HINT_DATACHANGED));
} }
pPara = (Paragraph*)pList->Prev(); ++iter;
pPara = iter != aSelList.rend() ? *iter : NULL;
if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON && if( !pPara && nDepth > 0 && rSet.GetItemState( EE_PARA_NUMBULLET ) == SFX_ITEM_ON &&
pOutliner->GetDepth( (USHORT) pOutliner->GetAbsPos( (Paragraph*) pList->First() ) ) > 0 ) pOutliner->GetDepth( (USHORT) pOutliner->GetAbsPos(*(aSelList.begin())) ) > 0 )
pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1 pPara = pOutliner->GetParagraph( 0 ); // Put NumBulletItem in outline level 1
} }
...@@ -272,7 +278,6 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet, ...@@ -272,7 +278,6 @@ BOOL DrawView::SetAttributes(const SfxItemSet& rSet,
mpDocSh->GetUndoManager()->LeaveListAction(); mpDocSh->GetUndoManager()->LeaveListAction();
delete pList;
bOk = TRUE; bOk = TRUE;
} }
else else
......
...@@ -262,8 +262,10 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) ...@@ -262,8 +262,10 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
{ {
// Outliner im Gliederungsmodus // Outliner im Gliederungsmodus
::Outliner* pOutl = pOLV->GetOutliner(); ::Outliner* pOutl = pOLV->GetOutliner();
List* pList = pOLV->CreateSelectionList();
Paragraph* pPara = (Paragraph*) pList->First(); std::vector<Paragraph*> aSelList;
pOLV->CreateSelectionList(aSelList);
Paragraph* pPara = aSelList.empty() ? NULL : *(aSelList.begin());
// find out if we are a OutlineView // find out if we are a OutlineView
BOOL bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode()); BOOL bIsOutlineView(OUTLINERMODE_OUTLINEVIEW == pOLV->GetOutliner()->GetMode());
...@@ -289,8 +291,10 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) ...@@ -289,8 +291,10 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
} }
} }
while (pPara) for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
{ {
pPara = *iter;
sal_Int16 nDepth = pOutl->GetDepth( (USHORT) pOutl->GetAbsPos( pPara ) ); sal_Int16 nDepth = pOutl->GetDepth( (USHORT) pOutl->GetAbsPos( pPara ) );
if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) ) if (nDepth > 0 || (bOutlineViewSh && (nDepth <= 0) && !pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE )) )
...@@ -305,11 +309,9 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) ...@@ -305,11 +309,9 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
// Nicht maximale Tiefe und nicht ganz oben // Nicht maximale Tiefe und nicht ganz oben
bDisableRight = FALSE; bDisableRight = FALSE;
} }
pPara = static_cast<Paragraph*>( pList->Next() );
} }
if ( ( pOutl->GetAbsPos((Paragraph*) pList->Last()) < pOutl->GetParagraphCount() - 1 ) && if ( ( pOutl->GetAbsPos(pPara) < pOutl->GetParagraphCount() - 1 ) &&
( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) ) ( pOutl->GetParagraphCount() > 1 || !bOutlineViewSh) )
{ {
// Nicht letzter Absatz // Nicht letzter Absatz
...@@ -317,7 +319,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) ...@@ -317,7 +319,8 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
} }
// disable when first para and 2nd is not a title // disable when first para and 2nd is not a title
pPara = static_cast< Paragraph* >( pList->First() ); pPara = aSelList.empty() ? NULL : *(aSelList.begin());
if(!bDisableDown && bIsOutlineView if(!bDisableDown && bIsOutlineView
&& pPara && pPara
&& 0 == pOutl->GetAbsPos(pPara) && 0 == pOutl->GetAbsPos(pPara)
...@@ -327,8 +330,6 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet ) ...@@ -327,8 +330,6 @@ void TextObjectBar::GetAttrState( SfxItemSet& rSet )
// Needs to be disabled // Needs to be disabled
bDisableDown = TRUE; bDisableDown = TRUE;
} }
delete pList;
} }
if (bDisableLeft) if (bDisableLeft)
......
...@@ -862,29 +862,39 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) ...@@ -862,29 +862,39 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
BOOL bDisableExpand = TRUE; BOOL bDisableExpand = TRUE;
BOOL bUnique = TRUE; BOOL bUnique = TRUE;
OutlinerView* pOutlinerView = pOlView->GetViewByWindow(GetActiveWindow()); OutlinerView* pOutlinerView = pOlView->GetViewByWindow(GetActiveWindow());
List* pList = pOutlinerView->CreateSelectionList();
Paragraph* pPara = (Paragraph*)pList->First();
sal_Int16 nDepth; std::vector<Paragraph*> aSelList;
sal_Int16 nTmpDepth = pOutl->GetDepth( (USHORT) pOutl->GetAbsPos( pPara ) ); pOutlinerView->CreateSelectionList(aSelList);
bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
while (pPara) if (!aSelList.empty())
{ {
nDepth = pOutl->GetDepth( (USHORT) pOutl->GetAbsPos( pPara ) ); std::vector<Paragraph*>::const_iterator iter = aSelList.begin();
Paragraph* pPara = *iter;
if( nDepth != nTmpDepth ) sal_Int16 nDepth;
bUnique = FALSE; sal_Int16 nTmpDepth = pOutl->GetDepth( (USHORT) pOutl->GetAbsPos( pPara ) );
if( bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ) ) bool bPage = pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE );
bUnique = FALSE;
if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
bDisableExpand = FALSE;
if (pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
bDisableCollapse = FALSE;
pPara = (Paragraph*)pList->Next(); while (iter != aSelList.begin())
} {
pPara = *iter;
delete pList; nDepth = pOutl->GetDepth( (USHORT) pOutl->GetAbsPos( pPara ) );
if( nDepth != nTmpDepth || bPage != pOutl->HasParaFlag( pPara, PARAFLAG_ISPAGE ))
bUnique = FALSE;
if (pOutl->HasChilds(pPara))
{
if (!pOutl->IsExpanded(pPara))
bDisableExpand = FALSE;
else
bDisableCollapse = FALSE;
}
++iter;
}
}
if (bDisableExpand) if (bDisableExpand)
rSet.DisableItem(SID_OUTLINE_EXPAND); rSet.DisableItem(SID_OUTLINE_EXPAND);
...@@ -919,7 +929,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet ) ...@@ -919,7 +929,7 @@ void OutlineViewShell::GetMenuState( SfxItemSet &rSet )
if (bDisableCollapseAll || bDisableExpandAll) if (bDisableCollapseAll || bDisableExpandAll)
{ {
ULONG nParaPos = 0; ULONG nParaPos = 0;
pPara = pOutl->GetParagraph( nParaPos ); Paragraph* pPara = pOutl->GetParagraph( nParaPos );
while (pPara && (bDisableCollapseAll || bDisableExpandAll)) while (pPara && (bDisableCollapseAll || bDisableExpandAll))
{ {
if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara)) if (!pOutl->IsExpanded(pPara) && pOutl->HasChilds(pPara))
...@@ -1393,9 +1403,18 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) ...@@ -1393,9 +1403,18 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
::sd::Window* pWin = GetActiveWindow(); ::sd::Window* pWin = GetActiveWindow();
OutlinerView* pActiveView = pOlView->GetViewByWindow( pWin ); OutlinerView* pActiveView = pOlView->GetViewByWindow( pWin );
::Outliner* pOutliner = pOlView->GetOutliner(); ::Outliner* pOutliner = pOlView->GetOutliner();
List* pSelList = (List*)pActiveView->CreateSelectionList();
Paragraph* pFirstPara = (Paragraph*)pSelList->First(); std::vector<Paragraph*> aSelList;
Paragraph* pLastPara = (Paragraph*)pSelList->Last(); pActiveView->CreateSelectionList(aSelList);
Paragraph *pFirstPara = NULL;
Paragraph *pLastPara = NULL;
if (!aSelList.empty())
{
pFirstPara = *(aSelList.begin());
pLastPara = *(aSelList.rbegin());
}
if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) ) if( !pOutliner->HasParaFlag(pFirstPara,PARAFLAG_ISPAGE) )
pFirstPara = pOlView->GetPrevTitle( pFirstPara ); pFirstPara = pOlView->GetPrevTitle( pFirstPara );
...@@ -1403,8 +1422,6 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet) ...@@ -1403,8 +1422,6 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) ) if( !pOutliner->HasParaFlag(pLastPara, PARAFLAG_ISPAGE) )
pLastPara = pOlView->GetPrevTitle( pLastPara ); pLastPara = pOlView->GetPrevTitle( pLastPara );
delete pSelList; // has been created only for us
// only one page selected? // only one page selected?
if( pFirstPara == pLastPara ) if( pFirstPara == pLastPara )
{ {
...@@ -1759,12 +1776,6 @@ SdPage* OutlineViewShell::GetActualPage() ...@@ -1759,12 +1776,6 @@ SdPage* OutlineViewShell::GetActualPage()
String OutlineViewShell::GetPageRangeString() String OutlineViewShell::GetPageRangeString()
{ {
::sd::Window* pWin = GetActiveWindow();
OutlinerView* pActiveView = pOlView->GetViewByWindow(pWin);
::Outliner* pOutl = pActiveView->GetOutliner();
List* pSelList = (List*)pActiveView->CreateSelectionList();
Paragraph* pPara = (Paragraph*)pSelList->First();
String aStrPageRange; String aStrPageRange;
BOOL bFirstPageNo = TRUE; BOOL bFirstPageNo = TRUE;
BOOL bOpenRange = FALSE; BOOL bOpenRange = FALSE;
...@@ -1776,8 +1787,18 @@ String OutlineViewShell::GetPageRangeString() ...@@ -1776,8 +1787,18 @@ String OutlineViewShell::GetPageRangeString()
if( ( (SdPage*)GetDoc()->GetPage( n ) )->GetPageKind() == PK_STANDARD ) if( ( (SdPage*)GetDoc()->GetPage( n ) )->GetPageKind() == PK_STANDARD )
nPageCount++; nPageCount++;
while ( pPara ) ::sd::Window *pWin = GetActiveWindow();
OutlinerView *pActiveView = pOlView->GetViewByWindow(pWin);
::Outliner *pOutl = pActiveView->GetOutliner();
std::vector<Paragraph*> aSelList;
pActiveView->CreateSelectionList(aSelList);
Paragraph *pPara = NULL;
for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
{ {
pPara = *iter;
if ( !pOutl->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) if ( !pOutl->HasParaFlag(pPara, PARAFLAG_ISPAGE) )
{ {
pPara = pOlView->GetPrevTitle(pPara); pPara = pOlView->GetPrevTitle(pPara);
...@@ -1827,7 +1848,6 @@ String OutlineViewShell::GetPageRangeString() ...@@ -1827,7 +1848,6 @@ String OutlineViewShell::GetPageRangeString()
} }
nLastPage = nPageToSelect; nLastPage = nPageToSelect;
pPara = (Paragraph*)pSelList->Next();
} }
if( bOpenRange ) if( bOpenRange )
...@@ -1843,8 +1863,6 @@ String OutlineViewShell::GetPageRangeString() ...@@ -1843,8 +1863,6 @@ String OutlineViewShell::GetPageRangeString()
if( nPageCount == 0 ) if( nPageCount == 0 )
aStrPageRange.Erase(); aStrPageRange.Erase();
delete pSelList; // has been created only for us
return aStrPageRange; return aStrPageRange;
} }
......
...@@ -113,8 +113,6 @@ OutlineView::OutlineView( DrawDocShell* pDocSh, ::Window* pWindow, OutlineViewSh ...@@ -113,8 +113,6 @@ OutlineView::OutlineView( DrawDocShell* pDocSh, ::Window* pWindow, OutlineViewSh
: ::sd::View(pDocSh->GetDoc(), pWindow, pOutlineViewSh) : ::sd::View(pDocSh->GetDoc(), pWindow, pOutlineViewSh)
, mpOutlineViewShell(pOutlineViewSh) , mpOutlineViewShell(pOutlineViewSh)
, mpOutliner( mpDoc->GetOutliner(TRUE) ) , mpOutliner( mpDoc->GetOutliner(TRUE) )
, mpOldParaOrder(NULL)
, mpSelectedParas(NULL)
, mnPagesToProcess(0) , mnPagesToProcess(0)
, mnPagesProcessed(0) , mnPagesProcessed(0)
, mbFirstPaint(TRUE) , mbFirstPaint(TRUE)
...@@ -669,14 +667,18 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) ...@@ -669,14 +667,18 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner )
{ {
Window* pActWin = mpOutlineViewShell->GetActiveWindow(); Window* pActWin = mpOutlineViewShell->GetActiveWindow();
OutlinerView* pOlView = GetViewByWindow(pActWin); OutlinerView* pOlView = GetViewByWindow(pActWin);
List* pList = pOlView->CreateSelectionList();
Paragraph* pParagraph = (Paragraph*)pList->First(); std::vector<Paragraph*> aSelList;
while (pParagraph) pOlView->CreateSelectionList(aSelList);
Paragraph *pParagraph = NULL;
for (std::vector<Paragraph*>::const_iterator iter = aSelList.begin(); iter != aSelList.end(); ++iter)
{ {
if( !pOutliner->HasParaFlag( pParagraph, PARAFLAG_ISPAGE ) && (pOutliner->GetDepth( (USHORT) pOutliner->GetAbsPos( pParagraph ) ) <= 0) ) pParagraph = *iter;
if( !pOutliner->HasParaFlag( pParagraph, PARAFLAG_ISPAGE ) &&
(pOutliner->GetDepth( (USHORT) pOutliner->GetAbsPos( pParagraph ) ) <= 0) )
mnPagesToProcess++; mnPagesToProcess++;
pParagraph = (Paragraph*)pList->Next();
} }
mnPagesToProcess++; // the paragraph being in level 0 already mnPagesToProcess++; // the paragraph being in level 0 already
...@@ -695,7 +697,6 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner ) ...@@ -695,7 +697,6 @@ IMPL_LINK( OutlineView, DepthChangedHdl, ::Outliner *, pOutliner )
{ {
mpDocSh->SetWaitCursor( TRUE ); mpDocSh->SetWaitCursor( TRUE );
} }
delete pList;
} }
ParagraphInsertedHdl(pOutliner); ParagraphInsertedHdl(pOutliner);
...@@ -923,41 +924,35 @@ IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner ) ...@@ -923,41 +924,35 @@ IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, pOutliner )
OutlineViewPageChangesGuard aGuard(this); OutlineViewPageChangesGuard aGuard(this);
mpOldParaOrder = new List;
// list of selected title paragraphs // list of selected title paragraphs
mpSelectedParas = mpOutlinerView[0]->CreateSelectionList(); mpOutlinerView[0]->CreateSelectionList(maSelectedParas);
Paragraph* pPara = static_cast<Paragraph*>(mpSelectedParas->First());
while (pPara) for (std::vector<Paragraph*>::iterator it = maSelectedParas.begin(); it != maSelectedParas.end();)
{ {
if( !pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) if (!pOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE))
{ it = maSelectedParas.erase(it);
mpSelectedParas->Remove();
pPara = static_cast<Paragraph*>(mpSelectedParas->GetCurObject());
}
else else
{ ++it;
pPara = static_cast<Paragraph*>(mpSelectedParas->Next());
}
} }
// select the pages belonging to the paragraphs on level 0 to select // select the pages belonging to the paragraphs on level 0 to select
USHORT nPos = 0; USHORT nPos = 0;
ULONG nParaPos = 0; ULONG nParaPos = 0;
pPara = pOutliner->GetParagraph( 0 ); Paragraph* pPara = pOutliner->GetParagraph( 0 );
std::vector<Paragraph*>::const_iterator fiter;
while(pPara) while(pPara)
{ {
if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page? if( pOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) // one page?
{ {
mpOldParaOrder->Insert(pPara, LIST_APPEND); maOldParaOrder.push_back(pPara);
SdPage* pPage = mpDoc->GetSdPage(nPos, PK_STANDARD); SdPage* pPage = mpDoc->GetSdPage(nPos, PK_STANDARD);
pPage->SetSelected(FALSE);
if (mpSelectedParas->Seek(pPara)) // selected? fiter = std::find(maSelectedParas.begin(),maSelectedParas.end(),pPara);
{
pPage->SetSelected(TRUE); pPage->SetSelected(fiter != maSelectedParas.end());
}
nPos++; ++nPos;
} }
pPara = pOutliner->GetParagraph( ++nParaPos ); pPara = pOutliner->GetParagraph( ++nParaPos );
} }
...@@ -975,12 +970,10 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) ...@@ -975,12 +970,10 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner )
{ {
OutlineViewPageChangesGuard aGuard(this); OutlineViewPageChangesGuard aGuard(this);
DBG_ASSERT(mpSelectedParas, "keine Absatzliste");
DBG_ASSERT(mpOldParaOrder, "keine Absatzliste");
DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::EndMovingHdl(), model change without undo?!" ); DBG_ASSERT( isRecordingUndo(), "sd::OutlineView::EndMovingHdl(), model change without undo?!" );
// look for insertion position via the first paragraph // look for insertion position via the first paragraph
Paragraph* pSearchIt = (Paragraph*)mpSelectedParas->First(); Paragraph* pSearchIt = maSelectedParas.empty() ? NULL : *(maSelectedParas.begin());
// look for the first of the selected paragraphs in the new ordering // look for the first of the selected paragraphs in the new ordering
USHORT nPosNewOrder = 0; USHORT nPosNewOrder = 0;
...@@ -1005,14 +998,22 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) ...@@ -1005,14 +998,22 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner )
else else
{ {
// look for the predecessor in the old ordering // look for the predecessor in the old ordering
nPos = (USHORT)mpOldParaOrder->GetPos(pPrev); std::vector<Paragraph*>::const_iterator it = std::find(maOldParaOrder.begin(),
maOldParaOrder.end(),
pPrev);
if (it != maOldParaOrder.end())
nPos = static_cast<USHORT>(it-maOldParaOrder.begin());
else
nPos = 0xffff;
DBG_ASSERT(nPos != 0xffff, "Absatz nicht gefunden"); DBG_ASSERT(nPos != 0xffff, "Absatz nicht gefunden");
} }
mpDoc->MovePages(nPos); mpDoc->MovePages(nPos);
// deselect the pages again // deselect the pages again
USHORT nPageCount = (USHORT)mpSelectedParas->Count(); USHORT nPageCount = (USHORT)maSelectedParas.size();
while (nPageCount) while (nPageCount)
{ {
SdPage* pPage = mpDoc->GetSdPage(nPosNewOrder, PK_STANDARD); SdPage* pPage = mpDoc->GetSdPage(nPosNewOrder, PK_STANDARD);
...@@ -1023,10 +1024,8 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner ) ...@@ -1023,10 +1024,8 @@ IMPL_LINK( OutlineView, EndMovingHdl, ::Outliner *, pOutliner )
pOutliner->UpdateFields(); pOutliner->UpdateFields();
delete mpSelectedParas; maSelectedParas.clear();
mpSelectedParas = NULL; maOldParaOrder.clear();
delete mpOldParaOrder;
mpOldParaOrder = NULL;
InvalidateSlideNumberArea(); InvalidateSlideNumberArea();
...@@ -1350,17 +1349,22 @@ SdPage* OutlineView::GetActualPage() ...@@ -1350,17 +1349,22 @@ SdPage* OutlineView::GetActualPage()
{ {
::sd::Window* pWin = mpOutlineViewShell->GetActiveWindow(); ::sd::Window* pWin = mpOutlineViewShell->GetActiveWindow();
OutlinerView* pActiveView = GetViewByWindow(pWin); OutlinerView* pActiveView = GetViewByWindow(pWin);
std::auto_ptr<List> pSelList( static_cast< List* >(pActiveView->CreateSelectionList()) );
SdPage* pCurrent = GetPageForParagraph(static_cast<Paragraph*>(pSelList->First()) ); std::vector<Paragraph*> aSelList;
pActiveView->CreateSelectionList(aSelList);
Paragraph *pPar = aSelList.empty() ? NULL : *(aSelList.begin());
SdPage* pCurrent = GetPageForParagraph(pPar);
DBG_ASSERT( pCurrent || DBG_ASSERT( pCurrent ||
(mpDocSh->GetUndoManager() && static_cast< sd::UndoManager *>(mpDocSh->GetUndoManager())->isInUndo()) || (mpDocSh->GetUndoManager() && static_cast< sd::UndoManager *>(mpDocSh->GetUndoManager())->isInUndo()) ||
maDragAndDropModelGuard.get(), maDragAndDropModelGuard.get(),
"sd::OutlineView::GetActualPage(), no current page?" ); "sd::OutlineView::GetActualPage(), no current page?" );
if( pCurrent ) if( pCurrent )
return pCurrent; return pCurrent;
else
return mpDoc->GetSdPage( 0, PK_STANDARD ); return mpDoc->GetSdPage( 0, PK_STANDARD );
} }
SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara ) SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara )
...@@ -1378,8 +1382,8 @@ SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara ) ...@@ -1378,8 +1382,8 @@ SdPage* OutlineView::GetPageForParagraph( Paragraph* pPara )
if( nPageToSelect < (sal_uInt32)mpDoc->GetSdPageCount( PK_STANDARD ) ) if( nPageToSelect < (sal_uInt32)mpDoc->GetSdPageCount( PK_STANDARD ) )
return static_cast< SdPage* >( mpDoc->GetSdPage( (USHORT)nPageToSelect, PK_STANDARD) ); return static_cast< SdPage* >( mpDoc->GetSdPage( (USHORT)nPageToSelect, PK_STANDARD) );
else
return 0; return 0;
} }
Paragraph* OutlineView::GetParagraphForPage( ::Outliner* pOutl, SdPage* pPage ) Paragraph* OutlineView::GetParagraphForPage( ::Outliner* pOutl, SdPage* pPage )
...@@ -1447,26 +1451,22 @@ SfxStyleSheet* OutlineView::GetStyleSheet() const ...@@ -1447,26 +1451,22 @@ SfxStyleSheet* OutlineView::GetStyleSheet() const
void OutlineView::SetSelectedPages() void OutlineView::SetSelectedPages()
{ {
// list of selected title paragraphs // list of selected title paragraphs
List* pSelParas = mpOutlinerView[0]->CreateSelectionList(); std::vector<Paragraph*> aSelParas;
Paragraph* pPara = (Paragraph*) pSelParas->First(); mpOutlinerView[0]->CreateSelectionList(aSelParas);
while(pPara) for (std::vector<Paragraph*>::iterator it = aSelParas.begin(); it != aSelParas.end();)
{ {
if( !mpOutliner->HasParaFlag(pPara, PARAFLAG_ISPAGE) ) if (!mpOutliner->HasParaFlag(*it, PARAFLAG_ISPAGE))
{ it = aSelParas.erase(it);
pSelParas->Remove();
pPara = (Paragraph*) pSelParas->GetCurObject();
}
else else
{ ++it;
pPara = (Paragraph*) pSelParas->Next();
}
} }
// select the pages belonging to the paragraphs on level 0 to select // select the pages belonging to the paragraphs on level 0 to select
USHORT nPos = 0; USHORT nPos = 0;
ULONG nParaPos = 0; ULONG nParaPos = 0;
pPara = mpOutliner->GetParagraph( 0 ); Paragraph *pPara = mpOutliner->GetParagraph( 0 );
std::vector<Paragraph*>::const_iterator fiter;
while(pPara) while(pPara)
{ {
...@@ -1475,12 +1475,11 @@ void OutlineView::SetSelectedPages() ...@@ -1475,12 +1475,11 @@ void OutlineView::SetSelectedPages()
SdPage* pPage = mpDoc->GetSdPage(nPos, PK_STANDARD); SdPage* pPage = mpDoc->GetSdPage(nPos, PK_STANDARD);
DBG_ASSERT(pPage!=NULL, DBG_ASSERT(pPage!=NULL,
"Trying to select non-existing page OutlineView::SetSelectedPages()"); "Trying to select non-existing page OutlineView::SetSelectedPages()");
if (pPage != NULL)
{
pPage->SetSelected(FALSE);
if (pSelParas->Seek(pPara)) // selected? if (pPage)
pPage->SetSelected(TRUE); {
fiter = std::find(aSelParas.begin(),aSelParas.end(),pPara);
pPage->SetSelected(fiter != aSelParas.end());
} }
nPos++; nPos++;
......
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