Skip to content
Permalink
Browse files

Fix for ticket 4813 and cleanup legacy code in composer

  • Loading branch information
mhugent committed Jan 16, 2012
1 parent 0b951c6 commit 5afa34c5aa1151ce27f41121d56d21fcbb92d1cd
Showing with 0 additions and 145 deletions.
  1. +0 −136 src/app/composer/qgscomposer.cpp
  2. +0 −9 src/core/composer/qgscomposition.cpp
@@ -1342,142 +1342,6 @@ void QgsComposer::readXML( const QDomElement& composerElem, const QDomDocument&
mComposition->addItemsFromXML( composerElem, doc );
}

#if 0
//composer labels
QDomNodeList composerLabelList = composerElem.elementsByTagName( "ComposerLabel" );
for ( int i = 0; i < composerLabelList.size(); ++i )
{
QDomElement currentComposerLabelElem = composerLabelList.at( i ).toElement();
QgsComposerLabel* newLabel = new QgsComposerLabel( mComposition );
newLabel->readXML( currentComposerLabelElem, doc );
addComposerLabel( newLabel );
mComposition->addItem( newLabel );
mComposition->update();
mComposition->clearSelection();
newLabel->setSelected( true );
showItemOptions( newLabel );
}

//composer maps
QDomNodeList composerMapList = composerElem.elementsByTagName( "ComposerMap" );
for ( int i = 0; i < composerMapList.size(); ++i )
{
QDomElement currentComposerMapElem = composerMapList.at( i ).toElement();
QgsComposerMap* newMap = new QgsComposerMap( mComposition );
newMap->readXML( currentComposerMapElem, doc );

if ( fromTemplate ) //show map directly if loaded from template
{
newMap->updateItem();
}
else //show map only on demand if loaded from project
{
if ( newMap->previewMode() != QgsComposerMap::Rectangle )
{
mMapsToRestore.insert( newMap, newMap->previewMode() );
newMap->setPreviewMode( QgsComposerMap::Rectangle );
}
}

addComposerMap( newMap );
mComposition->addItem( newMap );
mComposition->update();
mComposition->clearSelection();
newMap->setSelected( true );
showItemOptions( newMap );
}

//composer scalebars
QDomNodeList composerScaleBarList = composerElem.elementsByTagName( "ComposerScaleBar" );
for ( int i = 0; i < composerScaleBarList.size(); ++i )
{
QDomElement currentScaleBarElem = composerScaleBarList.at( i ).toElement();
QgsComposerScaleBar* newScaleBar = new QgsComposerScaleBar( mComposition );
newScaleBar->readXML( currentScaleBarElem, doc );
addComposerScaleBar( newScaleBar );
mComposition->addItem( newScaleBar );
mComposition->update();
mComposition->clearSelection();
newScaleBar->setSelected( true );
showItemOptions( newScaleBar );
}

//composer legends
QDomNodeList composerLegendList = composerElem.elementsByTagName( "ComposerLegend" );
for ( int i = 0; i < composerLegendList.size(); ++i )
{
QDomElement currentLegendElem = composerLegendList.at( i ).toElement();
QgsComposerLegend* newLegend = new QgsComposerLegend( mComposition );
newLegend->readXML( currentLegendElem, doc );
addComposerLegend( newLegend );
mComposition->addItem( newLegend );
mComposition->update();
mComposition->clearSelection();
newLegend->setSelected( true );
showItemOptions( newLegend );
}

//composer pictures
QDomNodeList composerPictureList = composerElem.elementsByTagName( "ComposerPicture" );
for ( int i = 0; i < composerPictureList.size(); ++i )
{
QDomElement currentPictureElem = composerPictureList.at( i ).toElement();
QgsComposerPicture* newPicture = new QgsComposerPicture( mComposition );
newPicture->readXML( currentPictureElem, doc );
addComposerPicture( newPicture );
mComposition->addItem( newPicture );
mComposition->update();
mComposition->clearSelection();
newPicture->setSelected( true );
showItemOptions( newPicture );
}

//composer shapes
QDomNodeList composerShapeList = composerElem.elementsByTagName( "ComposerShape" );
for ( int i = 0; i < composerShapeList.size(); ++i )
{
QDomElement currentShapeElem = composerShapeList.at( i ).toElement();
QgsComposerShape* newShape = new QgsComposerShape( mComposition );
newShape->readXML( currentShapeElem, doc );
addComposerShape( newShape );
mComposition->addItem( newShape );
mComposition->update();
mComposition->clearSelection();
newShape->setSelected( true );
showItemOptions( newShape );
}

//composer arrows
QDomNodeList composerArrowList = composerElem.elementsByTagName( "ComposerArrow" );
for ( int i = 0; i < composerArrowList.size(); ++i )
{
QDomElement currentArrowElem = composerArrowList.at( i ).toElement();
QgsComposerArrow* newArrow = new QgsComposerArrow( mComposition );
newArrow->readXML( currentArrowElem, doc );
addComposerArrow( newArrow );
mComposition->addItem( newArrow );
mComposition->update();
mComposition->clearSelection();
newArrow->setSelected( true );
showItemOptions( newArrow );
}

//composer tables
QDomNodeList composerTableList = composerElem.elementsByTagName( "ComposerAttributeTable" );
for ( int i = 0; i < composerTableList.size(); ++i )
{
QDomElement currentTableElem = composerTableList.at( i ).toElement();
QgsComposerAttributeTable* newTable = new QgsComposerAttributeTable( mComposition );
newTable->readXML( currentTableElem, doc );
addComposerTable( newTable );
mComposition->addItem( newTable );
mComposition->update();
mComposition->clearSelection();
newTable->setSelected( true );
showItemOptions( newTable );
}
#endif //0

mComposition->sortZList();
mView->setComposition( mComposition );

@@ -989,7 +989,6 @@ void QgsComposition::addComposerArrow( QgsComposerArrow* arrow )
clearSelection();
arrow->setSelected( true );
emit selectedItemChanged( arrow );
//pushAddRemoveCommand( arrow, tr( "Arrow added" ) );
}

void QgsComposition::addComposerLabel( QgsComposerLabel* label )
@@ -999,7 +998,6 @@ void QgsComposition::addComposerLabel( QgsComposerLabel* label )
clearSelection();
label->setSelected( true );
emit selectedItemChanged( label );
//pushAddRemoveCommand( label, tr( "Label added" ) );
}

void QgsComposition::addComposerMap( QgsComposerMap* map )
@@ -1012,7 +1010,6 @@ void QgsComposition::addComposerMap( QgsComposerMap* map )
clearSelection();
map->setSelected( true );
emit selectedItemChanged( map );
//pushAddRemoveCommand( map, tr( "Map added" ) );
}

void QgsComposition::addComposerScaleBar( QgsComposerScaleBar* scaleBar )
@@ -1023,13 +1020,11 @@ void QgsComposition::addComposerScaleBar( QgsComposerScaleBar* scaleBar )
{
scaleBar->setComposerMap( mapItemList.at( 0 ) );
}
scaleBar->applyDefaultSize(); //4 segments, 1/5 of composer map width
addItem( scaleBar );
emit composerScaleBarAdded( scaleBar );
clearSelection();
scaleBar->setSelected( true );
emit selectedItemChanged( scaleBar );
//pushAddRemoveCommand( scaleBar, tr( "Scale bar added" ) );
}

void QgsComposition::addComposerLegend( QgsComposerLegend* legend )
@@ -1045,7 +1040,6 @@ void QgsComposition::addComposerLegend( QgsComposerLegend* legend )
clearSelection();
legend->setSelected( true );
emit selectedItemChanged( legend );
//pushAddRemoveCommand( legend, tr( "Legend added" ) );
}

void QgsComposition::addComposerPicture( QgsComposerPicture* picture )
@@ -1055,7 +1049,6 @@ void QgsComposition::addComposerPicture( QgsComposerPicture* picture )
clearSelection();
picture->setSelected( true );
emit selectedItemChanged( picture );
//pushAddRemoveCommand( picture, tr( "Picture added" ) );
}

void QgsComposition::addComposerShape( QgsComposerShape* shape )
@@ -1065,7 +1058,6 @@ void QgsComposition::addComposerShape( QgsComposerShape* shape )
clearSelection();
shape->setSelected( true );
emit selectedItemChanged( shape );
//pushAddRemoveCommand( shape, tr( "Shape added" ) );
}

void QgsComposition::addComposerTable( QgsComposerAttributeTable* table )
@@ -1075,7 +1067,6 @@ void QgsComposition::addComposerTable( QgsComposerAttributeTable* table )
clearSelection();
table->setSelected( true );
emit selectedItemChanged( table );
//pushAddRemoveCommand( table, tr( "Table added" ) );
}

void QgsComposition::removeComposerItem( QgsComposerItem* item )

0 comments on commit 5afa34c

Please sign in to comment.
You can’t perform that action at this time.