[prev in list] [next in list] [prev in thread] [next in thread] 

List:       koffice-devel
Subject:    Review Request: This patch implements the KoUnavailShape class,
From:       "Inge Wallin" <inge () lysator ! liu ! se>
Date:       2010-08-26 9:02:23
Message-ID: 20100826090223.3682.84570 () vidsolbach ! de
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://reviewboard.kde.org/r/5150/
-----------------------------------------------------------

Review request for KOffice.


Summary
-------

On Monday March 18th, I sent a mail to koffice-devel about handling
unsupported data types in frames.  The subject line was 'kounavail
reborn'.  I got some nice feedback, and here is the patch that
implements this.

The shape is part of the Flake library, and it's created by the
KoShapeRegistry if it cannot find a suitable shape to handle any of
the data inside the frame.

The problem is the saving of embedded files. The main problem is that there
is no way to get access to the store in saveOdf() of a shape, and even if we
could, there is still the problem that when contents.xml is created, there =
is
already an open file in the store and we can't open another one. There are =

several ways that saving of embedded files could be implemented, but all of =

them are complicated and convoluted.  I can see two main ways forward:

1. Add a call queueForSaving(QString &fileName, QByteArray &contents) to =

   the KoShapeSavingContext.  This would queue an embedded file for saving
   somewhere and would then actually save them when content.xml is closed.
   This is a little like the KoImageCollection is handled.

2. Add a KoDocument based document class like the chartshape does and use
   the same way of saving.  That doesn't tell me how to save embedded files
   in different subdirectories, though (see below).

The advantage of solution 1. is that it could be used in other shapes as we=
ll,
like the Vector Shape.

Another problem is how to get the filenames.  For instance if we read the =

object with name "Object_1", say, there is no way to tell if that name is
not already taken when the time comes to save this shape.  Also, it's not
certain that all files in the shape will have the same prefix.  For instance
we could have some files under (say) Object_1, one under ObjectReplacements
and one under Pictures.  In fact there is no telling at all where the files
that were referenced in the original objects were found.

So, if anybody has some insights into this, it would be good to hear them.

Some other comments:
 * It was suggested that I should save the files as external files instead =
of
   in QByteArrays during the lifetime of the document.  However, it is my
   experience that embedded documents are small, so this doesn't seem neces=
sary.

* I would like to show an icon for the embedded contents based on mimetype =
found
  in the manifest.  I suppose there is an easy way to get such an icon?  Bu=
t how
  to map from mime type to icon name?


Diffs
-----

  trunk/koffice/libs/flake/CMakeLists.txt 1168106 =

  trunk/koffice/libs/flake/KoShapeRegistry.cpp 1168106 =

  trunk/koffice/libs/flake/KoShapeSavingContext.cpp 1168106 =

  trunk/koffice/libs/flake/KoUnavailShape.h PRE-CREATION =

  trunk/koffice/libs/flake/KoUnavailShape.cpp PRE-CREATION =

  trunk/koffice/libs/odf/KoStore.h 1168106 =

  trunk/koffice/libs/odf/KoXmlNS.h 1168106 =

  trunk/koffice/libs/odf/KoXmlNS.cpp 1168106 =

  trunk/koffice/libs/odf/KoXmlReader.h 1168106 =

  trunk/koffice/libs/odf/KoXmlReader.cpp 1168106 =


Diff: http://reviewboard.kde.org/r/5150/diff


Testing
-------

I have tested with a file that I created in OOo.  It is a text document wit=
h an
embedded spreadsheet (attached).  Unfortunately it has an ObjectReplacement=
 picture
that is in the unhandled StarView Metafile format.  This picture is not han=
dled
by the picture shape, but it still loads it and then fails to show it.

So I had to create another file with the same embedded spreadsheet, but wit=
hout the
image.  This file is also attached.


Thanks,

Inge


[Attachment #5 (text/html)]

<html>
 <body>
  <div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
   <table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 \
solid;">  <tr>
     <td>
      This is an automatically generated e-mail. To reply, visit:
      <a href="http://reviewboard.kde.org/r/5150/">http://reviewboard.kde.org/r/5150/</a>
  </td>
    </tr>
   </table>
   <br />


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" \
style="background-image: \
url('http://reviewboard.kde.orgrb/images/review_request_box_top_bg.png'); \
background-position: left top; background-repeat: repeat-x; border: 1px black \
solid;">  <tr>
  <td>

<div>Review request for KOffice.</div>
<div>By Inge Wallin.</div>





<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">On Monday March 18th, I sent a mail to koffice-devel about handling \
unsupported data types in frames.  The subject line was &#39;kounavail reborn&#39;.  \
I got some nice feedback, and here is the patch that implements this.

The shape is part of the Flake library, and it&#39;s created by the
KoShapeRegistry if it cannot find a suitable shape to handle any of
the data inside the frame.

The problem is the saving of embedded files. The main problem is that there
is no way to get access to the store in saveOdf() of a shape, and even if we
could, there is still the problem that when contents.xml is created, there is
already an open file in the store and we can&#39;t open another one. There are 
several ways that saving of embedded files could be implemented, but all of 
them are complicated and convoluted.  I can see two main ways forward:

1. Add a call queueForSaving(QString &amp;fileName, QByteArray &amp;contents) to 
   the KoShapeSavingContext.  This would queue an embedded file for saving
   somewhere and would then actually save them when content.xml is closed.
   This is a little like the KoImageCollection is handled.

2. Add a KoDocument based document class like the chartshape does and use
   the same way of saving.  That doesn&#39;t tell me how to save embedded files
   in different subdirectories, though (see below).

The advantage of solution 1. is that it could be used in other shapes as well,
like the Vector Shape.

Another problem is how to get the filenames.  For instance if we read the 
object with name &quot;Object_1&quot;, say, there is no way to tell if that name is
not already taken when the time comes to save this shape.  Also, it&#39;s not
certain that all files in the shape will have the same prefix.  For instance
we could have some files under (say) Object_1, one under ObjectReplacements
and one under Pictures.  In fact there is no telling at all where the files
that were referenced in the original objects were found.

So, if anybody has some insights into this, it would be good to hear them.

Some other comments:
 * It was suggested that I should save the files as external files instead of
   in QByteArrays during the lifetime of the document.  However, it is my
   experience that embedded documents are small, so this doesn&#39;t seem necessary.

* I would like to show an icon for the embedded contents based on mimetype found
  in the manifest.  I suppose there is an easy way to get such an icon?  But how
  to map from mime type to icon name?
</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: \
1px solid #b8b5a0">  <tr>
  <td>
   <pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: \
-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: \
break-word;">I have tested with a file that I created in OOo.  It is a text document \
with an embedded spreadsheet (attached).  Unfortunately it has an ObjectReplacement \
picture that is in the unhandled StarView Metafile format.  This picture is not \
handled by the picture shape, but it still loads it and then fails to show it.

So I had to create another file with the same embedded spreadsheet, but without the
image.  This file is also attached.</pre>
  </td>
 </tr>
</table>




<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>trunk/koffice/libs/flake/CMakeLists.txt <span style="color: \
grey">(1168106)</span></li>

 <li>trunk/koffice/libs/flake/KoShapeRegistry.cpp <span style="color: \
grey">(1168106)</span></li>

 <li>trunk/koffice/libs/flake/KoShapeSavingContext.cpp <span style="color: \
grey">(1168106)</span></li>

 <li>trunk/koffice/libs/flake/KoUnavailShape.h <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>trunk/koffice/libs/flake/KoUnavailShape.cpp <span style="color: \
grey">(PRE-CREATION)</span></li>

 <li>trunk/koffice/libs/odf/KoStore.h <span style="color: grey">(1168106)</span></li>

 <li>trunk/koffice/libs/odf/KoXmlNS.h <span style="color: grey">(1168106)</span></li>

 <li>trunk/koffice/libs/odf/KoXmlNS.cpp <span style="color: \
grey">(1168106)</span></li>

 <li>trunk/koffice/libs/odf/KoXmlReader.h <span style="color: \
grey">(1168106)</span></li>

 <li>trunk/koffice/libs/odf/KoXmlReader.cpp <span style="color: \
grey">(1168106)</span></li>

</ul>

<p><a href="http://reviewboard.kde.org/r/5150/diff/" style="margin-left: 3em;">View \
Diff</a></p>




  </td>
 </tr>
</table>




  </div>
 </body>
</html>



_______________________________________________
koffice-devel mailing list
koffice-devel@kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic