On 09/05/2011 07:51 PM, Tommaso Cucinotta wrote: > Hi, > > [... extracted from the Image Lifecycle Patch ...] > > the attached patch adds the OpenOffice drawing format (.odg). With it > you can: > > -) include in LyX OpenOffice drawings > -) preview them on the screen > -) view them in the final .ps/.pdf output > -) edit them externally via libreoffice, ooffice or soffice. > > Notes: > 1) It includes a trick to avoid detecting .odg as a zipped format, > unfortunately > I had to replicate it both in Format.cpp and in FileName.cpp. > Any hint on how to possible make the design better ? > z > Would adding a method > > static bool FileName::isZippedExtension(string const &ext); > > and using it from within Format.cpp be better ? > Just have a standalone function: bool isZippedFormat(string ext) and call that from both FileName and Format. I guess it would make sense in support/filetools.{h,cpp}. Though I wonder if there is a better way than checking extensions....
> Index: src/support/FileName.cpp > =================================================================== > --- src/support/FileName.cpp (revisione 39605) > +++ src/support/FileName.cpp (copia locale) > @@ -950,6 +950,13 @@ > > bool FileName::isZippedFile() const > { > + string const & ex = extension(); > + bool zipped_format = (ex == "odg" || ex == "sxd" > + || ex == "odt" || ex == "sxw" || ex == "docx" > + || ex == "ods" || ex == "sxc" || ex == "xlsx" > + || ex == "gnumeric" || ex == "dia"); > + if (zipped_format) > + return false; > Shouldn't that be "return true"? rh