filter/source/msfilter/escherex.cxx          |   11 ++++---
 filter/source/msfilter/eschesdo.cxx          |   14 ++++-----
 filter/source/msfilter/eschesdo.hxx          |    4 +-
 framework/source/services/autorecovery.cxx   |   24 +++++++++++-----
 include/filter/msfilter/escherex.hxx         |    8 +++--
 include/oox/export/vmlexport.hxx             |    2 -
 oox/source/drawingml/graphicshapecontext.cxx |   40 ++++++++++++++++++---------
 oox/source/export/vmlexport.cxx              |    4 +-
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 -
 9 files changed, 69 insertions(+), 40 deletions(-)

New commits:
commit 9cfd47f878dbb84fe516ce7992277fedcb026b24
Author: Nikhil Walvekar <nikhil.walve...@synerzip.com>
Date:   Fri Nov 29 14:03:46 2013 +0530

    fdo#65836 bnc#621241 Do not compress WMF / EMF file incase of OOXML export
    
    (cherry picked from commit 8fe352be80ff69552f622f3c7a6a6f269912ab71)
    
    Change-Id: Ic498e5703ab48719f998be6da3f245843cc0979d
    Reviewed-on: https://gerrit.libreoffice.org/11426
    Reviewed-by: Nikhil Walvekar <nikhil.walve...@synerzip.com>
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/filter/source/msfilter/escherex.cxx 
b/filter/source/msfilter/escherex.cxx
index 7318de1..cc865ba 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -1428,7 +1428,7 @@ sal_Bool 
EscherPropertyContainer::CreateEmbeddedHatchProperties( const ::com::su
 sal_Bool EscherPropertyContainer::CreateGraphicProperties(
     const ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySet > & rXPropSet,
         const OUString& rSource, const sal_Bool bCreateFillBitmap, const 
sal_Bool bCreateCroppingAttributes,
-            const sal_Bool bFillBitmapModeAllowed )
+            const sal_Bool bFillBitmapModeAllowed, const sal_Bool bOOxmlExport 
)
 {
     sal_Bool        bRetValue = sal_False;
     sal_Bool        bCreateFillStyles = sal_False;
@@ -1742,7 +1742,7 @@ sal_Bool EscherPropertyContainer::CreateGraphicProperties(
                     SvMemoryStream aMemStrm;
                     Rectangle aRect;
 
-                    if ( aProvider.GetBlibID( aMemStrm, aUniqueId, aRect, 
NULL, pGraphicAttr ) )
+                    if ( aProvider.GetBlibID( aMemStrm, aUniqueId, aRect, 
NULL, pGraphicAttr, bOOxmlExport ) )
                     {
                         // grab BLIP from stream and insert directly as 
complex property
                         // ownership of stream memory goes to complex property
@@ -4217,7 +4217,8 @@ sal_Bool EscherGraphicProvider::GetPrefSize( const 
sal_uInt32 nBlibId, Size& rPr
 }
 
 sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, const 
OString& rId,
-                                            const Rectangle& /* rBoundRect */, 
const com::sun::star::awt::Rectangle* pVisArea, const GraphicAttr* pGraphicAttr 
)
+                                            const Rectangle& /* rBoundRect */, 
const com::sun::star::awt::Rectangle* pVisArea,
+                                            const GraphicAttr* pGraphicAttr, 
const sal_Bool bOOxmlExport )
 {
     sal_uInt32          nBlibId = 0;
     GraphicObject       aGraphicObject( rId );
@@ -4353,7 +4354,9 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& 
rPicOutStrm, const OStrin
                 else if ( eBlibType == PEG )
                     rPicOutStrm << (sal_uInt16)0x0505;
             }
-            if ( ( eBlibType == PEG ) || ( eBlibType == PNG ) )
+            // #69607 do not compress WMF files if we are in OOXML export
+            if ( ( eBlibType == PEG ) || ( eBlibType == PNG ) ||
+                    ( ( ( eBlibType == WMF ) || ( eBlibType == EMF ) ) && 
bOOxmlExport ) )
             {
                 nExtra = 17;
                 p_EscherBlibEntry->mnSizeExtra = nExtra + 8;
diff --git a/filter/source/msfilter/eschesdo.cxx 
b/filter/source/msfilter/eschesdo.cxx
index 0e20dfb..cbf457f 100644
--- a/filter/source/msfilter/eschesdo.cxx
+++ b/filter/source/msfilter/eschesdo.cxx
@@ -173,7 +173,7 @@ void ImplEESdrWriter::MapRect(ImplEESdrObject& /* rObj */ )
 
 sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj,
                                 EscherSolverContainer& rSolverContainer,
-                                ImplEESdrPageType ePageType )
+                                ImplEESdrPageType ePageType, const sal_Bool 
bOOxmlExport )
 {
     sal_uInt32 nShapeID = 0;
     sal_uInt16 nShapeType = 0;
@@ -209,7 +209,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                     ImplEESdrObject aObj( *this, *(Reference< XShape >*)
                                     xXIndexAccess->getByIndex( n ).getValue() 
);
                     if( aObj.IsValid() )
-                        ImplWriteShape( aObj, rSolverContainer, ePageType );
+                        ImplWriteShape( aObj, rSolverContainer, ePageType, 
bOOxmlExport );
                 }
                 mpEscherEx->LeaveGroup();
             }
@@ -551,7 +551,7 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( 
ImplEESdrObject& rObj,
                 else
                 {
                     ADD_SHAPE( ESCHER_ShpInst_PictureFrame, 0xa00 );
-                    if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, 
"GraphicURL", sal_False, sal_True ) )
+                    if ( aPropOpt.CreateGraphicProperties( rObj.mXPropSet, 
"GraphicURL", sal_False, sal_True, sal_True, bOOxmlExport ) )
                         aPropOpt.AddOpt( ESCHER_Prop_LockAgainstGrouping, 
0x800080 );
                 }
             }
@@ -934,10 +934,10 @@ void ImplEscherExSdr::ImplWriteCurrentPage()
 }
 
 
-sal_uInt32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj )
+sal_uInt32 ImplEscherExSdr::ImplWriteTheShape( ImplEESdrObject& rObj , bool 
ooxmlExport )
 {
     DBG_ASSERT( mpSolverContainer, "ImplEscherExSdr::ImplWriteShape: no 
SolverContainer" );
-    return ImplWriteShape( rObj, *mpSolverContainer, NORMAL );
+    return ImplWriteShape( rObj, *mpSolverContainer, NORMAL, ooxmlExport );
 }
 
 
@@ -953,11 +953,11 @@ void EscherEx::AddUnoShapes( const Reference< XShapes >& 
rxShapes )
         mpImplEscherExSdr->ImplWriteCurrentPage();
 }
 
-sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj )
+sal_uInt32 EscherEx::AddSdrObject( const SdrObject& rObj, bool ooxmlExport )
 {
     ImplEESdrObject aObj( *mpImplEscherExSdr, rObj );
     if( aObj.IsValid() )
-        return mpImplEscherExSdr->ImplWriteTheShape( aObj );
+        return mpImplEscherExSdr->ImplWriteTheShape( aObj, ooxmlExport );
     return 0;
 }
 
diff --git a/filter/source/msfilter/eschesdo.hxx 
b/filter/source/msfilter/eschesdo.hxx
index f011285..8ddc1db 100644
--- a/filter/source/msfilter/eschesdo.hxx
+++ b/filter/source/msfilter/eschesdo.hxx
@@ -150,7 +150,7 @@ protected:
 
             sal_uInt32              ImplWriteShape( ImplEESdrObject& rObj,
                                     EscherSolverContainer& rSolver,
-                                    ImplEESdrPageType ePageType );  // returns 
ShapeID
+                                    ImplEESdrPageType ePageType, const 
sal_Bool bOOxmlExport = false );  // returns ShapeID
 
             void                ImplFlipBoundingBox( ImplEESdrObject& rObj, 
EscherPropertyContainer& rPropOpt );
             sal_Bool                ImplGetText( ImplEESdrObject& rObj );
@@ -189,7 +189,7 @@ public:
             bool                ImplInitUnoShapes( const 
::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& 
rxShapes );
             void                ImplWriteCurrentPage();
 
-            sal_uInt32              ImplWriteTheShape( ImplEESdrObject& rObj );
+            sal_uInt32              ImplWriteTheShape( ImplEESdrObject& rObj, 
bool ooxmlExport = false );
 
             void                ImplExitPage();
             void                ImplFlushSolverContainer();
diff --git a/include/filter/msfilter/escherex.hxx 
b/include/filter/msfilter/escherex.hxx
index 2ee35fc..09c2ad9 100644
--- a/include/filter/msfilter/escherex.hxx
+++ b/include/filter/msfilter/escherex.hxx
@@ -1095,7 +1095,8 @@ public:
                     const OString& rGraphicId,
                     const Rectangle& rBoundRect,
                     const com::sun::star::awt::Rectangle* pVisArea = NULL,
-                    const GraphicAttr* pGrafikAttr = NULL
+                    const GraphicAttr* pGrafikAttr = NULL,
+                    const sal_Bool ooxmlExport = false
                 );
     sal_Bool    HasGraphics() const { return mnBlibEntrys != 0; };
 
@@ -1259,7 +1260,8 @@ public:
                     const OUString& rSource,
                     const sal_Bool bCreateFillBitmap,
                     const sal_Bool bCreateCroppingAttributes = sal_False,
-                    const sal_Bool bFillBitmapModeAllowed = sal_True
+                    const sal_Bool bFillBitmapModeAllowed = sal_True,
+                    const sal_Bool bOOxmlExport = false
                 );
 
     sal_Bool   CreateBlipPropertiesforOLEControl( const 
::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & 
rXPropSet, const ::com::sun::star::uno::Reference< 
::com::sun::star::drawing::XShape > & rXShape);
@@ -1680,7 +1682,7 @@ public:
     void    AddUnoShapes( const ::com::sun::star::uno::Reference< 
::com::sun::star::drawing::XShapes >& rxShapes );
 
                 /// returns the ShapeID
-    sal_uInt32  AddSdrObject( const SdrObject& rObj );
+    sal_uInt32  AddSdrObject( const SdrObject& rObj, bool ooxmlExport = false 
);
 
                 /// If objects are written through AddSdrObject the
                 /// SolverContainer has to be written, and maybe some
diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx
index 8121e3b..876ff7b 100644
--- a/include/oox/export/vmlexport.hxx
+++ b/include/oox/export/vmlexport.hxx
@@ -88,7 +88,7 @@ public:
     /// Call this when you need to export the object as VML.
     sal_uInt32 AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1,
             sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
-            sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0 );
+            sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0, const sal_Bool 
bOOxmlExport = false );
 
 protected:
     /// Add an attribute to the generated <v:shape/> element.
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx
index f87e773..2cf4606 100644
--- a/oox/source/export/vmlexport.cxx
+++ b/oox/source/export/vmlexport.cxx
@@ -1048,7 +1048,7 @@ void VMLExport::EndShape( sal_Int32 nShapeElement )
     }
 }
 
-sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, 
sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, const Point* pNdTopLeft )
+sal_uInt32 VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, 
sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, const Point* pNdTopLeft, 
const sal_Bool bOOxmlExport )
 {
     m_pSdrObject = &rObj;
     m_eHOri = eHOri;
@@ -1056,7 +1056,7 @@ sal_uInt32 VMLExport::AddSdrObject( const SdrObject& 
rObj, sal_Int16 eHOri, sal_
     m_eHRel = eHRel;
     m_eVRel = eVRel;
     m_pNdTopLeft = pNdTopLeft;
-    return EscherEx::AddSdrObject(rObj);
+    return EscherEx::AddSdrObject(rObj, bOOxmlExport);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx 
b/sw/source/filter/ww8/docxattributeoutput.cxx
index 22612f5..1d9479a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3329,7 +3329,7 @@ void DocxAttributeOutput::WriteVMLDrawing( const 
SdrObject* sdrObj, const SwFrmF
    m_rExport.VMLExporter().AddSdrObject( *(sdrObj),
         rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(),
         rHoriOri.GetRelationOrient(),
-        rVertOri.GetRelationOrient(), (&rNdTopLeft) );
+        rVertOri.GetRelationOrient(), (&rNdTopLeft), true );
    m_pSerializer->endElementNS( XML_w, XML_pict );
 
    if ( bSwapInPage )
commit 3e19445805b73519cae6be1b2b766d4c5ad8984a
Author: Matúš Kukan <matus.ku...@collabora.com>
Date:   Fri Sep 12 16:08:34 2014 +0200

    bnc#591147: OOXML import: Import video file too.
    
    Change-Id: Ie9b6c5ff866269e5d7a26d025cb1c0d884ff1134
    (cherry picked from commit b7006f3c2f8f71f4d4721c6e5cdc122628c756f0)
    Reviewed-on: https://gerrit.libreoffice.org/11468
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/oox/source/drawingml/graphicshapecontext.cxx 
b/oox/source/drawingml/graphicshapecontext.cxx
index cd4e75d..1813af4 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -47,6 +47,22 @@ using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::xml::sax;
 using namespace ::oox::core;
 
+static OUString lcl_CopyToTempFile(const OUString& rStream, const 
oox::core::XmlFilterBase& rFilter)
+{
+    if (rStream.isEmpty())
+        return OUString();
+
+    Reference< XInputStream > xInStrm( rFilter.openInputStream(rStream), 
UNO_SET_THROW );
+    Reference< XTempFile > xTempFile( 
TempFile::create(rFilter.getComponentContext()) );
+    Reference< XOutputStream > xOutStrm( xTempFile->getOutputStream(), 
UNO_SET_THROW );
+    oox::BinaryXOutputStream aOutStrm( xOutStrm, false );
+    oox::BinaryXInputStream aInStrm( xInStrm, false );
+    aInStrm.copyToStream( aOutStrm );
+
+    xTempFile->setRemoveFile( false );
+    return xTempFile->getUri();
+}
+
 namespace oox {
 namespace drawingml {
 
@@ -70,19 +86,17 @@ ContextHandlerRef GraphicShapeContext::onCreateContext( 
sal_Int32 aElementToken,
     case XML_wavAudioFile:
         {
             getEmbeddedWAVAudioFile( getRelations(), 
rAttribs.getFastAttributeList(), mpShapePtr->getGraphicProperties().maAudio );
-            if( !mpShapePtr->getGraphicProperties().maAudio.msEmbed.isEmpty() )
-            {
-                Reference< XComponentContext > xContext = 
comphelper::getProcessComponentContext();
-                Reference< XInputStream > xInStrm( 
getFilter().openInputStream( mpShapePtr->getGraphicProperties().maAudio.msEmbed 
), UNO_SET_THROW );
-                Reference< XTempFile > xTempFile( TempFile::create(xContext) );
-                Reference< XOutputStream > xOutStrm( 
xTempFile->getOutputStream(), UNO_SET_THROW );
-                BinaryXOutputStream aOutStrm( xOutStrm, false );
-                BinaryXInputStream aInStrm( xInStrm, false );
-                aInStrm.copyToStream( aOutStrm );
-
-                xTempFile->setRemoveFile( false );
-                mpShapePtr->getGraphicProperties().maAudio.msEmbed = 
xTempFile->getUri();
-            }
+            mpShapePtr->getGraphicProperties().maAudio.msEmbed =
+                lcl_CopyToTempFile( 
mpShapePtr->getGraphicProperties().maAudio.msEmbed, getFilter() );
+        }
+        break;
+    case XML_audioFile:
+    case XML_videoFile:
+        {
+            OUString rPath = getRelations().getFragmentPathFromRelId(
+                    rAttribs.getString(R_TOKEN(link)).get() );
+            mpShapePtr->getGraphicProperties().maAudio.msEmbed =
+                lcl_CopyToTempFile( rPath, getFilter() );
         }
         break;
     }
commit f52ddf6d6e117479e68ca8a20ea6f47378718081
Author: Maxim Monastirsky <momonas...@gmail.com>
Date:   Sun Aug 10 14:45:19 2014 +0300

    fdo#71625 Don't loop autosave if userautosave fails
    
    Should also fix most of the reports of fdo#46635
    (I have no idea regarding the original report,
    because it predates the autosave feature.)
    
    Change-Id: I006d62053a159ab3157438a57dee56d6d99990a8
    (cherry picked from commit 5b9509115bd4adc5ef2618f0d9436cda1c0d9fbe)
    Reviewed-on: https://gerrit.libreoffice.org/10859
    Reviewed-by: David Tardon <dtar...@redhat.com>
    Tested-by: David Tardon <dtar...@redhat.com>
    (cherry picked from commit 9799a623161f43a0ca0c7a4806416ce466b558a6)
    Signed-off-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/framework/source/services/autorecovery.cxx 
b/framework/source/services/autorecovery.cxx
index 3a18af4..4dfa3ed 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -2335,6 +2335,23 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
     rInfo.DocumentState |= AutoRecovery::E_TRY_SAVE;
     implts_flushConfigItem(rInfo);
 
+    // If userautosave is enabled, first try to save the original file.
+    // Note that we must do it *before* calling storeToRecoveryFile, so in 
case of failure here
+    // we won't remain with the modified flag set to true, even though the 
autorecovery save succeeded.
+    try
+    {
+        // We must check here for an empty URL to avoid a "This operation is 
not supported on this operating system."
+        // message during autosave.
+        if ((m_eJob & AutoRecovery::E_USER_AUTO_SAVE) == 
AutoRecovery::E_USER_AUTO_SAVE && !rInfo.OrgURL.isEmpty())
+        {
+            Reference< XStorable > xDocSave(rInfo.Document, 
css::uno::UNO_QUERY_THROW);
+            xDocSave->store();
+        }
+    }
+    catch(const css::uno::Exception&)
+    {
+    }
+
     sal_Int32 nRetry = RETRY_STORE_ON_FULL_DISC_FOREVER;
     sal_Bool  bError = sal_False;
     do
@@ -2343,13 +2360,6 @@ void AutoRecovery::implts_saveOneDoc(const OUString&
         {
             xDocRecover->storeToRecoveryFile( rInfo.NewTempURL, 
lNewArgs.getAsConstPropertyValueList() );
 
-            // if userautosave is enabled, also save to the original file
-            if((m_eJob & AutoRecovery::E_USER_AUTO_SAVE) == 
AutoRecovery::E_USER_AUTO_SAVE)
-            {
-                Reference< XStorable > xDocSave(rInfo.Document, 
css::uno::UNO_QUERY_THROW);
-                xDocSave->store();
-            }
-
 #ifdef TRIGGER_FULL_DISC_CHECK
             throw css::uno::Exception();
 #else  // TRIGGER_FULL_DISC_CHECK
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to