[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/karbon
From: Jan Hambrecht <jaham () gmx ! net>
Date: 2009-01-21 23:47:19
Message-ID: 1232581639.596263.28019.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 914884 by jaham:
remove some old code related to loading/saving the old native file format
M +0 -86 common/KarbonDocument.cpp
M +1 -10 common/KarbonDocument.h
M +2 -58 ui/KarbonPart.cpp
--- trunk/koffice/karbon/common/KarbonDocument.cpp #914883:914884
@@ -160,16 +160,6 @@
d->objects.removeAt( d->objects.indexOf( shape ) );
}
-QDomDocument
-KarbonDocument::saveXML() const
-{
- QDomDocument doc;
- QDomElement me = doc.createElement( "DOC" );
- doc.appendChild( me );
- save( me );
- return doc;
- }
-
void KarbonDocument::saveOasis( KoShapeSavingContext & context ) const
{
context.xmlWriter().startElement( "draw:page" );
@@ -183,82 +173,6 @@
context.xmlWriter().endElement(); // draw:page
}
-void
-KarbonDocument::save( QDomElement& me ) const
-{
- me.setAttribute( "mime", "application/x-karbon" ),
- me.setAttribute( "version", "0.1" );
- me.setAttribute( "editor", "Karbon14" );
- me.setAttribute( "syntaxVersion", "0.1" );
- if( d->pageSize.width() > 0.0 )
- me.setAttribute( "width", d->pageSize.width() );
- if( d->pageSize.height() > 0. )
- me.setAttribute( "height", d->pageSize.height() );
- me.setAttribute( "unit", KoUnit::unitName( d->unit ) );
-
- // save objects:
- /* TODO: porting to flake
- VLayerListIterator itr( m_layers );
-
- for ( ; itr.current(); ++itr )
- itr.current()->save( me );
- */
-}
-
-KarbonDocument*
-KarbonDocument::clone() const
-{
- return new KarbonDocument( *this );
-}
-
-void
-KarbonDocument::load( const KoXmlElement& doc )
-{
- loadXML( doc );
-}
-
-bool KarbonDocument::loadXML( const KoXmlElement& doc )
-{
- if( doc.attribute( "mime" ) != "application/x-karbon" ||
- doc.attribute( "syntaxVersion" ) != "0.1" )
- {
- return false;
- }
-
- qDeleteAll( d->layers );
- d->layers.clear();
- qDeleteAll( d->objects );
- d->objects.clear();
-
- d->pageSize.setWidth( doc.attribute( "width", "800.0" ).toDouble() );
- d->pageSize.setHeight( doc.attribute( "height", "550.0" ).toDouble() );
-
- d->unit = KoUnit::unit( doc.attribute( "unit", KoUnit::unitName( d->unit ) ) );
-
- loadDocumentContent( doc );
-
- if( d->layers.isEmpty() )
- insertLayer( new KoShapeLayer() );
-
- return true;
-}
-
-void
-KarbonDocument::loadDocumentContent( const KoXmlElement& doc )
-{
- KoXmlElement e;
- forEachElement(e, doc)
- {
- if( e.tagName() == "LAYER" )
- {
- KoShapeLayer* layer = new KoShapeLayer();
- // TODO implement layer loading
- //layer->load( e );
- insertLayer( layer );
- }
- }
-}
-
bool KarbonDocument::loadOasis( const KoXmlElement &element, KoShapeLoadingContext \
&context ) {
qDeleteAll( d->layers );
--- trunk/koffice/karbon/common/KarbonDocument.h #914883:914884
@@ -170,19 +170,10 @@
*/
const QList<KoShape*> shapes() const;
- QDomDocument saveXML() const;
void saveOasis( KoShapeSavingContext & context ) const;
bool saveOdf( KoDocument::SavingContext & documentContext );
+ bool loadOasis( const KoXmlElement &element, KoShapeLoadingContext &context );
- bool loadXML( const KoXmlElement& doc );
- virtual bool loadOasis( const KoXmlElement &element, KoShapeLoadingContext \
&context );
- virtual void save( QDomElement& element ) const;
- virtual void load( const KoXmlElement& element );
- void loadDocumentContent( const KoXmlElement& doc );
-
- virtual KarbonDocument* clone() const;
-
-
/**
* Adds an object to the document.
*
--- trunk/koffice/karbon/ui/KarbonPart.cpp #914883:914884
@@ -165,65 +165,9 @@
setOutputMimeType( "application/vnd.oasis.opendocument.graphics" );
}
-bool KarbonPart::loadXML( const KoXmlDocument& document, KoStore* )
+bool KarbonPart::loadXML( const KoXmlDocument&, KoStore* )
{
- bool success = false;
-
- KoXmlElement doc = document.documentElement();
-
- if( d->merge )
- {
- d->document.loadDocumentContent( doc );
- return true;
- }
-
- success = d->document.loadXML( doc );
-
- //m_pageLayout = KoPageLayout::standardLayout();
-
- // <PAPER>
- KoXmlElement paper = doc.namedItem( "PAPER" ).toElement();
- if ( !paper.isNull() )
- {
- m_pageLayout.format = static_cast<KoPageFormat::Format>( d->getAttribute( \
paper, "format", 0 ) );
- m_pageLayout.orientation = static_cast<KoPageFormat::Orientation>( \
d->getAttribute( paper, "orientation", 0 ) );
-
- if( m_pageLayout.format == KoPageFormat::CustomSize )
- {
- m_pageLayout.width = d->document.pageSize().width();
- m_pageLayout.height = d->document.pageSize().height();
- }
- else
- {
- m_pageLayout.width = d->getAttribute( paper, "width", qreal(0.0) );
- m_pageLayout.height = d->getAttribute( paper, "height", qreal(0.0) );
- }
- }
- else
- {
- m_pageLayout.width = d->getAttribute( doc, "width", qreal(595.277) );
- m_pageLayout.height = d->getAttribute( doc, "height", qreal(841.891) );
- }
-
- kDebug(38000) <<" width=" << m_pageLayout.width;
- kDebug(38000) <<" height=" << m_pageLayout.height;
- KoXmlElement borders = paper.namedItem( "PAPERBORDERS" ).toElement();
- if( !borders.isNull() )
- {
- if( borders.hasAttribute( "left" ) )
- m_pageLayout.left = borders.attribute( "left" ).toDouble();
- if( borders.hasAttribute( "top" ) )
- m_pageLayout.top = borders.attribute( "top" ).toDouble();
- if( borders.hasAttribute( "right" ) )
- m_pageLayout.right = borders.attribute( "right" ).toDouble();
- if( borders.hasAttribute( "bottom" ) )
- m_pageLayout.bottom = borders.attribute( "bottom" ).toDouble();
- }
-
- setUnit( d->document.unit() );
- setPageSize( d->document.pageSize() );
-
- return success;
+ return false;
}
bool KarbonPart::loadOdf( KoOdfReadStore & odfStore )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic