[Libreoffice-commits] core.git: 3 commits - desktop/inc desktop/source sw/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Tue Apr 8 10:15:36 PDT 2014


 desktop/inc/liblibreoffice.h            |    9 ++++++---
 desktop/inc/liblibreoffice.hxx          |    9 +++++++--
 desktop/source/lib/init.cxx             |   12 ++++++++++--
 sw/source/filter/html/htmlflywriter.cxx |   12 ++++++++++--
 sw/source/filter/html/htmlplug.cxx      |   19 ++++++++++---------
 5 files changed, 43 insertions(+), 18 deletions(-)

New commits:
commit 930f669be1100bfa1447f60cc379d51d18224dff
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Tue Apr 8 17:50:04 2014 +0200

    liblo: Return early everywhere where we potentially export images.
    
    To avoid searching the node(s).
    
    Change-Id: I1ddf962113ead192435c174ff3bf607596e4bfc3

diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx
index 6060530..e7d5c4d 100644
--- a/sw/source/filter/html/htmlflywriter.cxx
+++ b/sw/source/filter/html/htmlflywriter.cxx
@@ -809,7 +809,7 @@ Writer& OutHTML_Image( Writer& rWrt, const SwFrmFmt &rFrmFmt,
                        const sal_Char *pMarkType,
                        const ImageMap *pAltImgMap )
 {
-    SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
+    SwHTMLWriter &rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
 
     if (rHTMLWrt.mbSkipImages)
         return rHTMLWrt;
@@ -1439,6 +1439,11 @@ static Writer& OutHTML_FrmFmtAsDivOrSpan( Writer& rWrt,
 static Writer & OutHTML_FrmFmtAsImage( Writer& rWrt, const SwFrmFmt& rFrmFmt,
                                        sal_Bool /*bInCntnr*/ )
 {
+    SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
+
+    if (rHTMLWrt.mbSkipImages)
+        return rWrt;
+
     ImageMap aIMap;
     Graphic aGraphic( ((SwFrmFmt &)rFrmFmt).MakeGraphic( &aIMap ) );
     Size aSz( 0, 0 );
@@ -1452,7 +1457,10 @@ static Writer & OutHTML_FrmFmtAsImage( Writer& rWrt, const SwFrmFmt& rFrmFmt,
 static Writer& OutHTML_FrmFmtGrfNode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
                                       sal_Bool bInCntnr )
 {
-    SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
+    SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
+
+    if (rHTMLWrt.mbSkipImages)
+        return rWrt;
 
     const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
     sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1;
diff --git a/sw/source/filter/html/htmlplug.cxx b/sw/source/filter/html/htmlplug.cxx
index 421239b..f124b6b 100644
--- a/sw/source/filter/html/htmlplug.cxx
+++ b/sw/source/filter/html/htmlplug.cxx
@@ -1247,7 +1247,10 @@ Writer& OutHTML_FrmFmtOLENode( Writer& rWrt, const SwFrmFmt& rFrmFmt,
 Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFrmFmt,
                                   sal_Bool bInCntnr )
 {
-    SwHTMLWriter& rHTMLWrt = (SwHTMLWriter&)rWrt;
+    SwHTMLWriter& rHTMLWrt = static_cast<SwHTMLWriter&>(rWrt);
+
+    if (rHTMLWrt.mbSkipImages)
+        return rWrt;
 
     const SwFmtCntnt& rFlyCntnt = rFrmFmt.GetCntnt();
     sal_uLong nStt = rFlyCntnt.GetCntntIdx()->GetIndex()+1;
@@ -1257,14 +1260,12 @@ Writer& OutHTML_FrmFmtOLENodeGrf( Writer& rWrt, const SwFrmFmt& rFrmFmt,
     if( !pOLENd )
         return rWrt;
 
-    {
-        Graphic aGraphic( *pOLENd->GetGraphic() );
-        sal_uLong nFlags = bInCntnr ? HTML_FRMOPTS_GENIMG_CNTNR
-                                  : HTML_FRMOPTS_GENIMG;
-        OutHTML_Image( rWrt, rFrmFmt, aGraphic,
-                       pOLENd->GetTitle(), pOLENd->GetTwipSize(),
-                       nFlags, "ole" );
-    }
+    Graphic aGraphic( *pOLENd->GetGraphic() );
+    sal_uLong nFlags = bInCntnr ? HTML_FRMOPTS_GENIMG_CNTNR
+        : HTML_FRMOPTS_GENIMG;
+    OutHTML_Image( rWrt, rFrmFmt, aGraphic,
+            pOLENd->GetTitle(), pOLENd->GetTwipSize(),
+            nFlags, "ole" );
 
     return rWrt;
 }
commit 55e39c72d6ac462b201dc0ae0ab0c610a0f13056
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Tue Apr 8 17:39:10 2014 +0200

    liblo: new saveAsWithOptions function
    
    To not break API compatibility of libLO, add a new saveAsWithOptions
    function and revert the old saveAs to initial state.
    
    Change-Id: If245c0261a932b6ed5d65e20cb1b6d8bd1c50ce6

diff --git a/desktop/inc/liblibreoffice.h b/desktop/inc/liblibreoffice.h
index e9df566..87111c4 100644
--- a/desktop/inc/liblibreoffice.h
+++ b/desktop/inc/liblibreoffice.h
@@ -35,14 +35,17 @@ struct _LibreOfficeDocument
   void (*destroy)   (LibreOfficeDocument* pThis);
   int (*saveAs)     (LibreOfficeDocument* pThis,
                      const char *pUrl,
-                     const char *pFormat,
-                     const char *pFilterOptions);
+                     const char *pFormat);
+  int (*saveAsWithOptions) (LibreOfficeDocument* pThis,
+                            const char *pUrl,
+                            const char *pFormat,
+                            const char *pFilterOptions);
 };
 
 LibreOffice* lo_init (const char* pInstallPath);
 
 #ifdef __cplusplus
-  }
+}
 #endif
 
 #endif
diff --git a/desktop/inc/liblibreoffice.hxx b/desktop/inc/liblibreoffice.hxx
index ef01cb3..29d3f72 100644
--- a/desktop/inc/liblibreoffice.hxx
+++ b/desktop/inc/liblibreoffice.hxx
@@ -35,9 +35,14 @@ public:
     }
 
     // Save as the given format, if format is NULL sniff from ext'n
-    inline bool saveAs(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
+    inline bool saveAs(const char* pUrl, const char* pFormat = NULL)
     {
-        return mpDoc->saveAs(mpDoc, pUrl, pFormat, pFilterOptions);
+        return mpDoc->saveAs(mpDoc, pUrl, pFormat);
+    }
+
+    inline bool saveAsWithOptions(const char* pUrl, const char* pFormat = NULL, const char* pFilterOptions = NULL)
+    {
+        return mpDoc->saveAsWithOptions(mpDoc, pUrl, pFormat, pFilterOptions);
     }
 };
 
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7629988..183a555 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -129,7 +129,8 @@ extern "C"
 SAL_DLLPUBLIC_EXPORT LibreOffice *liblibreoffice_hook(void);
 
 static void doc_destroy(LibreOfficeDocument* pThis);
-static int  doc_saveAs(LibreOfficeDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions);
+static int  doc_saveAs(LibreOfficeDocument* pThis, const char* pUrl, const char* pFormat);
+static int  doc_saveAsWithOptions(LibreOfficeDocument* pThis, const char* pUrl, const char* pFormat, const char* pFilterOptions);
 
 struct LibLODocument_Impl : public _LibreOfficeDocument
 {
@@ -142,6 +143,7 @@ struct LibLODocument_Impl : public _LibreOfficeDocument
 
         destroy = doc_destroy;
         saveAs = doc_saveAs;
+        saveAsWithOptions = doc_saveAsWithOptions;
     }
 };
 
@@ -207,7 +209,12 @@ static LibreOfficeDocument* lo_documentLoad(LibreOffice* pThis, const char* pURL
     return NULL;
 }
 
-static int doc_saveAs(LibreOfficeDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions)
+static int doc_saveAs(LibreOfficeDocument* pThis, const char* sUrl, const char* pFormat)
+{
+    return doc_saveAsWithOptions(pThis, sUrl, pFormat, NULL);
+}
+
+static int doc_saveAsWithOptions(LibreOfficeDocument* pThis, const char* sUrl, const char* pFormat, const char* pFilterOptions)
 {
     LibLODocument_Impl* pDocument = static_cast<LibLODocument_Impl*>(pThis);
 
commit 98668cd581f9f8dc272d42580c3989ee5dee0b53
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Tue Apr 8 17:18:53 2014 +0200

    liblo: We need to provide LibreOffice with fake command line args too.
    
    Change-Id: I34f364e63f814921bfe88af7cdf4ff4cdf6745fa

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 9703699..7629988 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -360,6 +360,7 @@ static int lo_initialize(LibreOffice* pThis, const char* pAppPath)
 
     try
     {
+        osl_setCommandArgs(0, NULL);
         initialize_uno(aAppURL);
         force_c_locale();
 


More information about the Libreoffice-commits mailing list