[Libreoffice-commits] core.git: sd/inc sd/source sfx2/source svtools/source vcl/workben

Caolán McNamara caolanm at redhat.com
Wed Aug 26 03:05:54 PDT 2015


 sd/inc/sddll.hxx                               |    3 +
 sd/source/core/drawdoc.cxx                     |   10 ++++-
 sd/source/filter/ppt/pptin.cxx                 |   46 ++++++++++++++++++++++---
 sd/source/ui/app/sddll.cxx                     |   15 ++++----
 sfx2/source/doc/docfile.cxx                    |    3 +
 svtools/source/config/accessibilityoptions.cxx |    5 --
 svtools/source/config/colorcfg.cxx             |   12 ++++--
 vcl/workben/fftester.cxx                       |   14 +++++++
 8 files changed, 84 insertions(+), 24 deletions(-)

New commits:
commit a523b7c434f252a90f6cf9563a24ea230c9fcc20
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Aug 26 10:51:29 2015 +0100

    add ppt to fftester
    
    Change-Id: I49162355ce5a58c6aaadfcfb9f45471e5c2a1424

diff --git a/sd/inc/sddll.hxx b/sd/inc/sddll.hxx
index 22e8e61..6f8a049 100644
--- a/sd/inc/sddll.hxx
+++ b/sd/inc/sddll.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_SD_INC_SDDLL_HXX
 
 #include <sfx2/module.hxx>
+#include "sddllapi.h"
 
 /*************************************************************************
 |*
@@ -32,7 +33,7 @@
 |*
 \************************************************************************/
 
-class SdDLL
+class SD_DLLPUBLIC SdDLL
 {
 protected:
 #ifdef ENABLE_SDREMOTE
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 5fbeec9..f31528b 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -30,6 +30,7 @@
 #include <editeng/eeitem.hxx>
 #include <editeng/scriptspaceitem.hxx>
 
+#include <unotools/configmgr.hxx>
 #include <unotools/useroptions.hxx>
 #include <officecfg/Office/Impress.hxx>
 
@@ -149,7 +150,7 @@ PresentationSettings::PresentationSettings( const PresentationSettings& r )
 }
 
 SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
-: FmFormModel( SvtPathOptions().GetPalettePath(), NULL, pDrDocSh )
+: FmFormModel( !utl::ConfigManager::IsAvoidConfig() ? SvtPathOptions().GetPalettePath() : OUString(), NULL, pDrDocSh )
 , bReadOnly(false)
 , mpOutliner(NULL)
 , mpInternalOutliner(NULL)
@@ -217,6 +218,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
     SetCalcFieldValueHdl( &rOutliner );
 
     // set linguistic options
+    if (!utl::ConfigManager::IsAvoidConfig())
     {
         const SvtLinguConfig    aLinguConfig;
         SvtLinguOptions         aOptions;
@@ -980,6 +982,9 @@ sal_uInt16 SdDrawDocument::GetAnnotationAuthorIndex( const OUString& rAuthor )
 
 void SdDrawDocument::InitLayoutVector()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return;
+
     const Reference<css::uno::XComponentContext> xContext(
         ::comphelper::getProcessComponentContext() );
 
@@ -1016,6 +1021,9 @@ void SdDrawDocument::InitLayoutVector()
 
 void SdDrawDocument::InitObjectVector()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return;
+
     const Reference<css::uno::XComponentContext> xContext(
         ::comphelper::getProcessComponentContext() );
 
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index a5a8a61..af1588f 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -19,6 +19,7 @@
 
 #include <editeng/numitem.hxx>
 #include <osl/file.hxx>
+#include <unotools/configmgr.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <vcl/wrkwin.hxx>
 #include <svl/urihelper.hxx>
@@ -68,6 +69,7 @@
 #include <cusshow.hxx>
 #include <vcl/bmpacc.hxx>
 #include "customshowlist.hxx"
+#include "sddll.hxx"
 
 #include "../../ui/inc/DrawDocShell.hxx"
 #include "../../ui/inc/FrameView.hxx"
@@ -539,8 +541,14 @@ bool ImplSdPPTImport::Import()
 
     // create master pages:
 
-    SfxProgress* pStbMgr = new SfxProgress( pDocShell, SD_RESSTR( STR_POWERPOINT_IMPORT ),
-        m_pMasterPages->size() + m_pSlidePages->size() + m_pNotePages->size() );
+    std::unique_ptr<SfxProgress> xStbMgr;
+    if (!utl::ConfigManager::IsAvoidConfig())
+    {
+        xStbMgr.reset(new SfxProgress(pDocShell,
+                        SD_RESSTR( STR_POWERPOINT_IMPORT),
+                        m_pMasterPages->size() +
+                        m_pSlidePages->size() + m_pNotePages->size()));
+    }
 
     sal_uInt32 nImportedPages = 0;
     {
@@ -852,7 +860,8 @@ bool ImplSdPPTImport::Import()
                 }
             }
         }
-        pStbMgr->SetState( nImportedPages++ );
+        if (xStbMgr)
+            xStbMgr->SetState( nImportedPages++ );
     }
 
     // importing slide pages
@@ -982,7 +991,8 @@ bool ImplSdPPTImport::Import()
                         static_cast<SdrPageObj*>(pPageObj)->SetReferencedPage(pSdrModel->GetPage(( nPage << 1 ) + 1));
                 }
 
-                pStbMgr->SetState( nImportedPages++ );
+                if (xStbMgr)
+                    xStbMgr->SetState( nImportedPages++ );
             }
         }
         else
@@ -1347,7 +1357,7 @@ bool ImplSdPPTImport::Import()
         }
     }
 
-    delete pStbMgr;
+    xStbMgr.reset();
 
     // read DocumentProperties
     uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
@@ -2691,4 +2701,30 @@ extern "C" SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL ImportPPT(
     return bRet;
 }
 
+extern "C" SAL_DLLPUBLIC_EXPORT bool SAL_CALL TestImportPPT(const OUString &rURL)
+{
+    SvFileStream aFileStream(rURL, StreamMode::READ);
+    tools::SvRef<SotStorage> xStorage(new SotStorage(aFileStream));
+    if (xStorage->GetError())
+        return false;
+
+    tools::SvRef<SotStorageStream> xDocStream(xStorage->OpenSotStream( OUString("PowerPoint Document"), STREAM_STD_READ));
+    if (!xDocStream)
+        return false;
+
+    SdDLL::Init();
+
+    SfxMedium aSrcMed(rURL, STREAM_STD_READ);
+
+    xDocStream->SetVersion(xStorage->GetVersion());
+    xDocStream->SetCryptMaskKey(xStorage->GetKey());
+
+    ::sd::DrawDocShellRef xDocShRef = new ::sd::DrawDocShell();
+    SdDrawDocument *pDoc = xDocShRef->GetDoc();
+
+    bool bRet = ImportPPT(pDoc, *xDocStream, *xStorage, aSrcMed);
+
+    return bRet;
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/app/sddll.cxx b/sd/source/ui/app/sddll.cxx
index 32badfe..a6f6669 100644
--- a/sd/source/ui/app/sddll.cxx
+++ b/sd/source/ui/app/sddll.cxx
@@ -22,6 +22,7 @@
 #include <editeng/eeitem.hxx>
 #include <editeng/editeng.hxx>
 #include <svx/svdobj.hxx>
+#include <unotools/configmgr.hxx>
 #include <unotools/moduleoptions.hxx>
 #include <svx/fmobjfac.hxx>
 #include <svx/svdfield.hxx>
@@ -98,7 +99,7 @@ using namespace ::com::sun::star;
 // Register all Factories
 void SdDLL::RegisterFactorys()
 {
-    if (SvtModuleOptions().IsImpress())
+    if (utl::ConfigManager::IsAvoidConfig() || SvtModuleOptions().IsImpress())
     {
         ::sd::ImpressViewShellBase::RegisterFactory (
             ::sd::IMPRESS_FACTORY_ID);
@@ -109,7 +110,7 @@ void SdDLL::RegisterFactorys()
         ::sd::PresentationViewShellBase::RegisterFactory (
             ::sd::PRESENTATION_FACTORY_ID);
     }
-    if (SvtModuleOptions().IsDraw())
+    if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsDraw())
     {
         ::sd::GraphicViewShellBase::RegisterFactory (::sd::DRAW_FACTORY_ID);
     }
@@ -255,10 +256,10 @@ void SdDLL::Init()
     SfxObjectFactory* pDrawFact = NULL;
     SfxObjectFactory* pImpressFact = NULL;
 
-    if (SvtModuleOptions().IsImpress())
+    if (utl::ConfigManager::IsAvoidConfig() || SvtModuleOptions().IsImpress())
         pImpressFact = &::sd::DrawDocShell::Factory();
 
-    if (SvtModuleOptions().IsDraw())
+    if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsDraw())
         pDrawFact = &::sd::GraphicDocShell::Factory();
 
     // the SdModule must be created
@@ -276,14 +277,14 @@ void SdDLL::Init()
         (*ppShlPtr) = new SdModule( pDrawFact, pImpressFact );
      }
 
-    if (SvtModuleOptions().IsImpress())
+    if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsImpress())
     {
         // Register the Impress shape types in order to make the shapes accessible.
         ::accessibility::RegisterImpressShapeTypes ();
         ::sd::DrawDocShell::Factory().SetDocumentServiceName( "com.sun.star.presentation.PresentationDocument" );
     }
 
-    if (SvtModuleOptions().IsDraw())
+    if (!utl::ConfigManager::IsAvoidConfig() && SvtModuleOptions().IsDraw())
     {
         ::sd::GraphicDocShell::Factory().SetDocumentServiceName( "com.sun.star.drawing.DrawingDocument" );
     }
@@ -311,7 +312,7 @@ void SdDLL::Init()
 
     // register your exotic remote controls here
 #ifdef ENABLE_SDREMOTE
-    if ( !Application::IsHeadlessModeEnabled() )
+    if (!utl::ConfigManager::IsAvoidConfig() && !Application::IsHeadlessModeEnabled())
         RegisterRemotes();
 #endif
 }
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 284c581..c19f7d2 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -65,6 +65,7 @@
 #include <com/sun/star/security/DocumentSignatureInformation.hpp>
 #include <com/sun/star/security/DocumentDigitalSignatures.hpp>
 #include <tools/urlobj.hxx>
+#include <unotools/configmgr.hxx>
 #include <unotools/tempfile.hxx>
 #include <comphelper/fileurl.hxx>
 #include <comphelper/processfactory.hxx>
@@ -450,7 +451,7 @@ OUString SfxMedium::GetBaseURL( bool bForSaving )
     const SfxStringItem* pBaseURLItem = static_cast<const SfxStringItem*>( GetItemSet()->GetItem(SID_DOC_BASEURL) );
     if ( pBaseURLItem )
         aBaseURL = pBaseURLItem->GetValue();
-    else if ( GetContent().is() )
+    else if (!utl::ConfigManager::IsAvoidConfig() && GetContent().is())
     {
         try
         {
diff --git a/svtools/source/config/accessibilityoptions.cxx b/svtools/source/config/accessibilityoptions.cxx
index 30e5658..5d3f971 100644
--- a/svtools/source/config/accessibilityoptions.cxx
+++ b/svtools/source/config/accessibilityoptions.cxx
@@ -572,6 +572,7 @@ void SvtAccessibilityOptions_Impl::SetVCLSettings()
 
 SvtAccessibilityOptions::SvtAccessibilityOptions()
 {
+    if (!utl::ConfigManager::IsAvoidConfig())
     {
         ::osl::MutexGuard aGuard( SingletonMutex::get() );
         if(!sm_pSingleImplConfig)
@@ -584,8 +585,6 @@ SvtAccessibilityOptions::SvtAccessibilityOptions()
     //StartListening( *sm_pSingleImplConfig, sal_True );
 }
 
-
-
 SvtAccessibilityOptions::~SvtAccessibilityOptions()
 {
     //EndListening( *sm_pSingleImplConfig, sal_True );
@@ -598,8 +597,6 @@ SvtAccessibilityOptions::~SvtAccessibilityOptions()
     }
 }
 
-
-
 void SvtAccessibilityOptions::Notify( SfxBroadcaster&, const SfxHint& rHint )
 {
     NotifyListeners(0);
diff --git a/svtools/source/config/colorcfg.cxx b/svtools/source/config/colorcfg.cxx
index b025562..e199fc5 100644
--- a/svtools/source/config/colorcfg.cxx
+++ b/svtools/source/config/colorcfg.cxx
@@ -392,10 +392,10 @@ void ColorConfig_Impl::ImplUpdateApplicationSettings()
     }
 }
 
-
-
 ColorConfig::ColorConfig()
 {
+    if (utl::ConfigManager::IsAvoidConfig())
+        return;
     ::osl::MutexGuard aGuard( ColorMutex_Impl::get() );
     if ( !m_pImpl )
     {
@@ -506,8 +506,12 @@ Color ColorConfig::GetDefaultColor(ColorConfigEntry eEntry)
 
 ColorConfigValue ColorConfig::GetColorValue(ColorConfigEntry eEntry, bool bSmart) const
 {
-    ColorConfigValue aRet = m_pImpl->GetColorConfigValue(eEntry);
-    if(bSmart)
+    ColorConfigValue aRet;
+
+    if (m_pImpl)
+        aRet = m_pImpl->GetColorConfigValue(eEntry);
+
+    if (bSmart)
     {
         if(COL_AUTO == sal::static_int_cast<ColorData>(aRet.nColor))
             aRet.nColor = ColorConfig::GetDefaultColor(eEntry).GetColor();
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index adf03b9..41f5f88 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -361,7 +361,19 @@ try_again:
                 }
                 ret = (int) (*pfnImport)(out);
             }
-
+            else if (strcmp(argv[2], "ppt") == 0)
+            {
+                static HFilterCall pfnImport(0);
+                if (!pfnImport)
+                {
+                    osl::Module aLibrary;
+                    aLibrary.loadRelative(&thisModule, "libsdfiltlo.so", SAL_LOADMODULE_LAZY);
+                    pfnImport = reinterpret_cast<HFilterCall>(
+                        aLibrary.getFunctionSymbol("TestImportPPT"));
+                    aLibrary.release();
+                }
+                ret = (int) (*pfnImport)(out);
+            }
         }
 
         /* To signal successful completion of a run, we need to deliver


More information about the Libreoffice-commits mailing list