Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 73cdc430 authored by Marijn Kruisselbrink's avatar Marijn Kruisselbrink

save the musicshape inside a draw:frame to prepare for the possibility of also...

save the musicshape inside a draw:frame to prepare for the possibility of also saving a pixmap and/or svg representation of it

svn path=/trunk/koffice/; revision=924242
parent af2061a3
......@@ -49,7 +49,8 @@ using namespace MusicCore;
//static MusicShape* firstShape = 0;
MusicShape::MusicShape()
: m_firstSystem(0),
: KoFrameShape("http://www.koffice.org/music", "shape"),
m_firstSystem(0),
m_style(new MusicStyle),
m_engraver(new Engraver()),
m_renderer(new MusicRenderer(m_style)),
......@@ -116,19 +117,25 @@ void MusicShape::paint( QPainter& painter, const KoViewConverter& converter )
void MusicShape::saveOdf( KoShapeSavingContext & context ) const
{
KoXmlWriter& writer = context.xmlWriter();
writer.startElement("draw:frame");
saveOdfAttributes(context, OdfAllAttributes);
writer.startElement("music:shape");
writer.addAttribute("xmlns:music", "http://www.koffice.org/music");
saveOdfAttributes( context, OdfAllAttributes );
MusicXmlWriter().writeSheet( writer, m_sheet, false );
MusicXmlWriter().writeSheet(writer, m_sheet, false);
writer.endElement(); // music:shape
saveOdfCommonChildElements( context );
writer.endElement();
saveOdfCommonChildElements(context);
writer.endElement(); // draw:frame
}
bool MusicShape::loadOdf( const KoXmlElement & element, KoShapeLoadingContext &context ) {
loadOdfAttributes( element, context, OdfAllAttributes );
loadOdfAttributes(element, context, OdfAllAttributes);
return loadOdfFrame(element, context);
}
bool MusicShape::loadOdfFrameElement( const KoXmlElement & element, KoShapeLoadingContext & context )
{
KoXmlElement score = KoXml::namedItemNS(element, "http://www.koffice.org/music", "score-partwise");
if (score.isNull()) {
kWarning() << "no music:score-partwise element as first child";
......
......@@ -20,6 +20,7 @@
#define MUSIC_SHAPE
#include <KoShape.h>
#include <KoFrameShape.h>
#include <kurl.h>
#define MusicShapeId "MusicShape"
......@@ -31,7 +32,7 @@ class MusicRenderer;
class MusicStyle;
class Engraver;
class MusicShape : public KoShape
class MusicShape : public KoShape, public KoFrameShape
{
public:
MusicShape();
......@@ -57,11 +58,13 @@ public:
MusicRenderer* renderer();
MusicStyle* style();
void engrave(bool engraveBars=true);
MusicShape* successor() { return m_successor; }
MusicShape* predecessor() { return m_predecessor; }
protected:
// reimplemented
virtual bool loadOdfFrameElement( const KoXmlElement & element, KoShapeLoadingContext & context );
private:
MusicCore::Sheet* m_sheet;
int m_firstSystem;
int m_lastSystem;
......
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