/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU Lesser General Public License * version 3 along with OpenOffice.org. If not, see * * for a copy of the LGPLv3 License. * ************************************************************************/ #include #include #include #include #include #include #include #include "sdpptwrp.hxx" #include "ppt/pptin.hxx" #include "drawdoc.hxx" #include #include // -------------- // - Namespaces - // -------------- using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::task; using namespace ::com::sun::star::frame; typedef sal_Bool ( __LOADONCALLAPI *ExportPPT )( const std::vector< com::sun::star::beans::PropertyValue >&, SvStorageRef&, Reference< XModel > &, Reference< XStatusIndicator > &, SvMemoryStream*, sal_uInt32 nCnvrtFlags ); typedef sal_Bool ( SAL_CALL *ImportPPT )( const ::rtl::OUString&, Sequence< PropertyValue >*, SdDrawDocument*, SvStream&, SvStorage&, SfxMedium& ); typedef sal_Bool ( __LOADONCALLAPI *SaveVBA )( SfxObjectShell&, SvMemoryStream*& ); // --------------- // - SdPPTFilter - // --------------- SdPPTFilter::SdPPTFilter( SfxMedium& rMedium, ::sd::DrawDocShell& rDocShell, sal_Bool bShowProgress ) : SdFilter( rMedium, rDocShell, bShowProgress ), pBas ( NULL ) { } // ----------------------------------------------------------------------------- SdPPTFilter::~SdPPTFilter() { delete pBas; // deleting the compressed basic storage } // ----------------------------------------------------------------------------- sal_Bool SdPPTFilter::Import() { sal_Bool bRet = sal_False; SotStorageRef pStorage = new SotStorage( mrMedium.GetInStream(), sal_False ); if( !pStorage->GetError() ) { /* check if there is a dualstorage, then the document is propably a PPT95 containing PPT97 */ SvStorageRef xDualStorage; String sDualStorage( RTL_CONSTASCII_USTRINGPARAM( "PP97_DUALSTORAGE" ) ); if ( pStorage->IsContained( sDualStorage ) ) { xDualStorage = pStorage->OpenSotStorage( sDualStorage, STREAM_STD_READ ); pStorage = xDualStorage; } SvStream* pDocStream = pStorage->OpenSotStream( String( RTL_CONSTASCII_USTRINGPARAM("PowerPoint Document") ), STREAM_STD_READ ); if( pDocStream ) { pDocStream->SetVersion( pStorage->GetVersion() ); pDocStream->SetCryptMaskKey(pStorage->GetKey()); String aTraceConfigPath( RTL_CONSTASCII_USTRINGPARAM( "Office.Tracing/Import/PowerPoint" ) ); Sequence< PropertyValue > aConfigData( 1 ); PropertyValue aPropValue; aPropValue.Value <<= rtl::OUString( mrMedium.GetURLObject().GetMainURL( INetURLObject::NO_DECODE ) ); aPropValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentURL" ) ); aConfigData[ 0 ] = aPropValue; if ( pStorage->IsStream( String( RTL_CONSTASCII_USTRINGPARAM("EncryptedSummary") ) ) ) mrMedium.SetError( ERRCODE_SVX_READ_FILTER_PPOINT, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); else { ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() ); if ( pLibrary ) { ImportPPT PPTImport = reinterpret_cast< ImportPPT >( pLibrary->getFunctionSymbol( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ImportPPT" ) ) ) ); if ( PPTImport ) bRet = PPTImport( aTraceConfigPath, &aConfigData, &mrDocument, *pDocStream, *pStorage, mrMedium ); if ( !bRet ) mrMedium.SetError( SVSTREAM_WRONGVERSION, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) ); } } delete pDocStream; } } return bRet; } // ----------------------------------------------------------------------------- sal_Bool SdPPTFilter::Export() { ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() ); sal_Bool bRet = sal_False; if( pLibrary ) { if( mxModel.is() ) { SotStorageRef xStorRef = new SotStorage( mrMedium.GetOutStream(), sal_False ); ExportPPT PPTExport = reinterpret_cast(pLibrary->getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ExportPPT")) )); if( PPTExport && xStorRef.Is() ) { sal_uInt32 nCnvrtFlags = 0; const SvtFilterOptions& rFilterOptions = SvtFilterOptions::Get(); if ( rFilterOptions.IsMath2MathType() ) nCnvrtFlags |= OLE_STARMATH_2_MATHTYPE; if ( rFilterOptions.IsWriter2WinWord() ) nCnvrtFlags |= OLE_STARWRITER_2_WINWORD; if ( rFilterOptions.IsCalc2Excel() ) nCnvrtFlags |= OLE_STARCALC_2_EXCEL; if ( rFilterOptions.IsImpress2PowerPoint() ) nCnvrtFlags |= OLE_STARIMPRESS_2_POWERPOINT; if ( rFilterOptions.IsEnablePPTPreview() ) nCnvrtFlags |= 0x8000; mrDocument.SetSwapGraphicsMode( SDR_SWAPGRAPHICSMODE_TEMP ); if( mbShowProgress ) CreateStatusIndicator(); rtl::OUString sBaseURI( RTL_CONSTASCII_USTRINGPARAM("BaseURI") ); std::vector< PropertyValue > aProperties; PropertyValue aProperty; aProperty.Name = sBaseURI; aProperty.Value = makeAny( mrMedium.GetBaseURL( true ) ); aProperties.push_back( aProperty ); bRet = PPTExport( aProperties, xStorRef, mxModel, mxStatusIndicator, pBas, nCnvrtFlags ); xStorRef->Commit(); } } delete pLibrary; } return bRet; } void SdPPTFilter::PreSaveBasic() { const SvtFilterOptions& rFilterOptions = SvtFilterOptions::Get(); if( rFilterOptions.IsLoadPPointBasicStorage() ) { ::osl::Module* pLibrary = OpenLibrary( mrMedium.GetFilter()->GetUserData() ); if( pLibrary ) { SaveVBA pSaveVBA= reinterpret_cast(pLibrary->getFunctionSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SaveVBA")) )); if( pSaveVBA ) { pSaveVBA( (SfxObjectShell&) mrDocShell, pBas ); } } } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ -4.0 LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-16 14:14:43 +0200
committerNoel Grandin <noelgrandin@gmail.com>2016-02-17 11:33:57 +0000
commit2087484c65a3d5e75a9e8ad116d11a4e13366219 (patch)
tree1f335918a854319df9269329d165a91d711d2108 /cli_ure
parentd6bf086012343b4a1e27cd4242dced9ee0d73a06 (diff)
use consistent #define checks for the Windows platform 4801c0b48dae8b50f51f83595b286d6a1 Reviewed-on: https://gerrit.libreoffice.org/62229 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-10-17clang-tidy readability-redundant-smartptr-getNoel Grandin redundant get() call on smart pointer Change-Id: Icb5a03bbc15e79a30d3d135a507d22914d15c2bd Reviewed-on: https://gerrit.libreoffice.org/61837 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-09-05clang-tidy performance-inefficient-vector-operationNoel Grandin Change-Id: Iebcaea7b08c5284946d83b6b6b9ed26b218025d4 Reviewed-on: https://gerrit.libreoffice.org/59992 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-08-29Replace find_if with proper quantifier algorithmsArkadiy Illarionov Change-Id: Icc820a47ac891c358883f9c01224f676c58fdd11 Reviewed-on: https://gerrit.libreoffice.org/59744 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-08-20Simplify containers iterations, tdf#96099 follow-upArkadiy Illarionov Use range-based loop or replace with std::any_of, std::find and std::find_if where applicable. Change-Id: I2f80788c49d56094c29b102eb96a7a7c079567c6 Reviewed-on: https://gerrit.libreoffice.org/59143 Tested-by: Jenkins Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-08-14create appendCopy method in OUStringBufferNoel Grandin so we can avoid temporary copies when appending a substring of an OUString to the buffer. I would have preferred to call the method just "append" but that results in ambiguous method errors when the callsite is something like sal_Int32 n; OUStringBuffer s; s.append(n, 10); I'm not sure why Change-Id: I6b5b6641fcb5b26ce2269f89ef06e03c0b6aa76f Reviewed-on: https://gerrit.libreoffice.org/58666 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-07-09Add missing sal/log.hxx headersGabor Kelemen rtl/string.hxx and rtl/ustring.hxx both unnecessarily #include <sal/log.hxx> (and don't make use of it themselves), but many other files happen to depend on it. This is a continuation of commit 6ff2d84ade299cb3d14d4110e4cf1a4b8070c030 to be able to remove those unneeded includes. This commit adds missing headers to every file found by: grep -FwL sal/log.hxx $(git grep -Elw 'SAL_INFO|SAL_INFO_IF|SAL_WARN|SAL_WARN_IF|SAL_DETAIL_LOG_STREAM|SAL_WHERE|SAL_STREAM|SAL_DEBUG') to directories from a* to configmgr Change-Id: I6ea1a7f992b1f835f5bac7a725e1135abee3f85a Reviewed-on: https://gerrit.libreoffice.org/57170 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> 2018-05-25Improve re-throwing of UNO exceptionsNoel Grandin (*) if we are already throwing a Wrapped*Exception, get the exception using cppu::getCaughtexception. (*) when catching and then immediately throwing UNO exceptions, use cppu::getCaughtException to prevent exception slicing (*) if we are going to catch an exception and then immediately throw a RuntimeException, rather throw a WrappedTargetRuntimeException and preserve the original exception information. Change-Id: Ia7a501a50ae0e6f4d05186333c8517fdcb17d558 Reviewed-on: https://gerrit.libreoffice.org/54692 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2018-05-09Missing template clone() in configmgr dconf modeStephan Bergmann ...that could cause infinite recursion, e.g. when an erroneously modified /org.openoffice.ucb.Hierarchy/Entry template (which recursively has children of the same template type) is later used to instantiate a new set member. Change-Id: I7b9e55fa1c92979aed98b9f23f4432600afffed4 Reviewed-on: https://gerrit.libreoffice.org/54023 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> 2018-05-09Add possibility to read <value xsi:nil="true"/> from winreg conf backendAndras Timar Change-Id: I67bc14d7ee1bacc15d34e6ee25ca7638de268643 Reviewed-on: https://gerrit.libreoffice.org/53942 Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> Tested-by: Mike Kaganski <mike.kaganski@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/53943 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Andras Timar <andras.timar@collabora.com> 2018-04-25Winreg config layer: Allow to define external backend separatelyMike Kaganski Defining backend separately allows e.g. creating ADMX templates with easy-to-use UI, where user defines only LDAP names for the setting, and doesn't need to type the LO configuration backend name. Change-Id: I64f23043c94a5a4e0ba7281d0f711a427d694126 Reviewed-on: https://gerrit.libreoffice.org/53413 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> 2018-04-04Ignore dangling symlink configuration filesStephan Bergmann This will be used by the Flatpak build, to offload per-locale data to a Locale extension (which expects all per-locale files to be in one place, so we need to add---potentially dangling, if a given locale is not installed---symlinks from the original places to the location where that Locale extension stores the actual files). Change-Id: Id13b8c53fbc9e0763e53fd09c0c059c9e638c13d Reviewed-on: https://gerrit.libreoffice.org/52381 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> 2018-02-27Use for-range loops in comphelper and configmgrJulien Nabet Change-Id: I91033395cb30a4ba9e65adb89712b3c70a39a508 Reviewed-on: https://gerrit.libreoffice.org/50396 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> 2018-02-08Better return nil than an arbitrary xml:lang="..." valueStephan Bergmann ...for a localized property that doesn't have a suitable value, but is nillable. E.g., /org.openoffice.Office.Writer/Insert/Caption/CaptionOrderNumberingFirst (once fixed to indeed be a localized property as apparently intended, with a follow-up commit to this) only has an explicit value (true) for xml:lang="hu", but shouldn't return that for any other locale (where the implicit default for a nil value should instead be false, cf. the else branch at the end of SwInsertConfig::Load, sw/source/uibase/config/modcfg.cxx). Change-Id: I7b991c1bc4df22bf2359175b0734e85e0844ce99 Reviewed-on: https://gerrit.libreoffice.org/49409 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> 2018-02-01configmgr: MSVC: pragma warning: make more specific, remove obsoleteMike Kaganski Change-Id: I7f98fa855ff521db42bf9b379bfac3d430791ae0 Reviewed-on: https://gerrit.libreoffice.org/48968 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> 2017-12-23loplugin:passstuffbyref improved returnsNoel Grandin improve the detection of stuff we can return by const &, instead of by copying Change-Id: I479ae89d0413125a8295cc3cddbc0017ed61ed69 Reviewed-on: https://gerrit.libreoffice.org/46915 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-12-19inline use-once typedefsNoel Grandin Change-Id: I5c3ffc03c26b3428f1f336e6ecba7838a1cf1157 Reviewed-on: https://gerrit.libreoffice.org/46764 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> 2017-12-11loplugin:salcall fix functionsNoel Grandin since cdecl is the default calling convention on Windows for such functions, the annotation is redundant. Change-Id: I1a85fa27e5ac65ce0e04a19bde74c90800ffaa2d Reviewed-on: https://gerrit.libreoffice.org/46164 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>