[Libreoffice-commits] core.git: solenv/clang-format starmath/source writerfilter/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Mon Nov 25 21:51:44 UTC 2019


 solenv/clang-format/blacklist               |    3 
 starmath/source/unofilter.cxx               |   33 ++-----
 writerfilter/source/filter/RtfFilter.cxx    |   86 ++++++++----------
 writerfilter/source/filter/WriterFilter.cxx |  131 ++++++++++++++--------------
 4 files changed, 119 insertions(+), 134 deletions(-)

New commits:
commit 7e91df3a62e604b3137606e0dfd28879527efc17
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Mon Nov 25 16:01:34 2019 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Mon Nov 25 22:50:15 2019 +0100

    Turn on clang-format for these files
    
    I (tried to) keep these files consistent locally with astyle in the past,
    switching to clang-format makes sure that the recent problem with introducing
    inconsistencies with automatic loplugin rewrites doesn't happen again.
    
    Change-Id: I86def0d13a1d16f8cedb7cf9927a48ce14c2b3bf
    Reviewed-on: https://gerrit.libreoffice.org/83690
    Reviewed-by: Miklos Vajna <vmiklos at collabora.com>
    Tested-by: Jenkins

diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index b3c04fccfdde..9edbcba9b7d1 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -13358,7 +13358,6 @@ starmath/source/typemap.cxx
 starmath/source/uiobject.cxx
 starmath/source/uiobject.hxx
 starmath/source/unodoc.cxx
-starmath/source/unofilter.cxx
 starmath/source/unomodel.cxx
 starmath/source/utility.cxx
 starmath/source/view.cxx
@@ -18373,8 +18372,6 @@ writerfilter/source/dmapper/WrapPolygonHandler.hxx
 writerfilter/source/dmapper/domainmapperfactory.cxx
 writerfilter/source/dmapper/util.cxx
 writerfilter/source/dmapper/util.hxx
-writerfilter/source/filter/RtfFilter.cxx
-writerfilter/source/filter/WriterFilter.cxx
 writerfilter/source/ooxml/Handler.cxx
 writerfilter/source/ooxml/Handler.hxx
 writerfilter/source/ooxml/OOXMLBinaryObjectReference.cxx
diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx
index 5886e9e6e0b9..719681af4b4b 100644
--- a/starmath/source/unofilter.cxx
+++ b/starmath/source/unofilter.cxx
@@ -21,15 +21,11 @@
 
 using namespace ::com::sun::star;
 
-namespace {
-
+namespace
+{
 /// Invokes the MathType importer via UNO.
-class MathTypeFilter : public cppu::WeakImplHelper
-    <
-    document::XFilter,
-    document::XImporter,
-    lang::XServiceInfo
-    >
+class MathTypeFilter
+    : public cppu::WeakImplHelper<document::XFilter, document::XImporter, lang::XServiceInfo>
 {
     uno::Reference<lang::XComponent> m_xDstDoc;
 
@@ -48,7 +44,6 @@ public:
     sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
     uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 };
-
 }
 
 MathTypeFilter::MathTypeFilter() = default;
@@ -94,19 +89,14 @@ sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDesc
     return bSuccess;
 }
 
-void MathTypeFilter::cancel()
-{
-}
+void MathTypeFilter::cancel() {}
 
-void MathTypeFilter::setTargetDocument(const uno::Reference< lang::XComponent >& xDoc)
+void MathTypeFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDoc)
 {
     m_xDstDoc = xDoc;
 }
 
-OUString MathTypeFilter::getImplementationName()
-{
-    return "com.sun.star.comp.Math.MathTypeFilter";
-}
+OUString MathTypeFilter::getImplementationName() { return "com.sun.star.comp.Math.MathTypeFilter"; }
 
 sal_Bool MathTypeFilter::supportsService(const OUString& rServiceName)
 {
@@ -115,14 +105,13 @@ sal_Bool MathTypeFilter::supportsService(const OUString& rServiceName)
 
 uno::Sequence<OUString> MathTypeFilter::getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet =
-    {
-        OUString("com.sun.star.document.ImportFilter")
-    };
+    uno::Sequence<OUString> aRet = { OUString("com.sun.star.document.ImportFilter") };
     return aRet;
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* com_sun_star_comp_Math_MathTypeFilter_get_implementation(uno::XComponentContext* /*pCtx*/, uno::Sequence<uno::Any> const& /*rSeq*/)
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_comp_Math_MathTypeFilter_get_implementation(uno::XComponentContext* /*pCtx*/,
+                                                         uno::Sequence<uno::Any> const& /*rSeq*/)
 {
     return cppu::acquire(new MathTypeFilter);
 }
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index 1f6260b1c1e6..68995b348d80 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -41,17 +41,12 @@
 
 using namespace ::com::sun::star;
 
-namespace {
-
+namespace
+{
 /// Invokes the RTF tokenizer + dmapper or RtfExportFilter in sw via UNO.
-class RtfFilter : public cppu::WeakImplHelper
-    <
-    document::XFilter,
-    document::XImporter,
-    document::XExporter,
-    lang::XInitialization,
-    lang::XServiceInfo
-    >
+class RtfFilter
+    : public cppu::WeakImplHelper<document::XFilter, document::XImporter, document::XExporter,
+                                  lang::XInitialization, lang::XServiceInfo>
 {
     uno::Reference<uno::XComponentContext> m_xContext;
     uno::Reference<lang::XComponent> m_xSrcDoc, m_xDstDoc;
@@ -76,9 +71,7 @@ public:
     OUString SAL_CALL getImplementationName() override;
     sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
     uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
-
 };
-
 }
 
 RtfFilter::RtfFilter(uno::Reference<uno::XComponentContext> xContext)
@@ -86,15 +79,17 @@ RtfFilter::RtfFilter(uno::Reference<uno::XComponentContext> xContext)
 {
 }
 
-sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+sal_Bool RtfFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescriptor)
 {
     sal_uInt32 nStartTime = osl_getGlobalTimer();
     if (m_xSrcDoc.is())
     {
-        uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
-        uno::Reference< uno::XInterface > xIfc(xMSF->createInstance("com.sun.star.comp.Writer.RtfExport"), uno::UNO_SET_THROW);
-        uno::Reference< document::XExporter > xExporter(xIfc, uno::UNO_QUERY_THROW);
-        uno::Reference< document::XFilter > xFilter(xIfc, uno::UNO_QUERY_THROW);
+        uno::Reference<lang::XMultiServiceFactory> xMSF(m_xContext->getServiceManager(),
+                                                        uno::UNO_QUERY_THROW);
+        uno::Reference<uno::XInterface> xIfc(
+            xMSF->createInstance("com.sun.star.comp.Writer.RtfExport"), uno::UNO_SET_THROW);
+        uno::Reference<document::XExporter> xExporter(xIfc, uno::UNO_QUERY_THROW);
+        uno::Reference<document::XFilter> xFilter(xIfc, uno::UNO_QUERY_THROW);
         xExporter->setSourceDocument(m_xSrcDoc);
         return xFilter->filter(rDescriptor);
     }
@@ -107,17 +102,20 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescrip
         utl::MediaDescriptor aMediaDesc(rDescriptor);
         bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
         bool bIsNewDoc = !aMediaDesc.getUnpackedValueOrDefault("InsertMode", false);
-        uno::Reference< io::XInputStream > xInputStream;
+        uno::Reference<io::XInputStream> xInputStream;
 
         aMediaDesc.addInputStream();
-        aMediaDesc[ utl::MediaDescriptor::PROP_INPUTSTREAM() ] >>= xInputStream;
+        aMediaDesc[utl::MediaDescriptor::PROP_INPUTSTREAM()] >>= xInputStream;
 
         // If this is set, write to this file, instead of the real document during paste.
         char* pEnv = getenv("SW_DEBUG_RTF_PASTE_TO");
         OUString aOutStr;
-        if (!bIsNewDoc && pEnv && osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pEnv), aOutStr) == osl::FileBase::E_None)
+        if (!bIsNewDoc && pEnv
+            && osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pEnv), aOutStr)
+                   == osl::FileBase::E_None)
         {
-            std::unique_ptr<SvStream> pOut(utl::UcbStreamHelper::CreateStream(aOutStr, StreamMode::WRITE));
+            std::unique_ptr<SvStream> pOut(
+                utl::UcbStreamHelper::CreateStream(aOutStr, StreamMode::WRITE));
             std::unique_ptr<SvStream> pIn(utl::UcbStreamHelper::CreateStream(xInputStream));
             pOut->WriteStream(*pIn);
             return true;
@@ -129,34 +127,36 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescrip
         {
             OUString aInStr;
             osl::FileBase::getFileURLFromSystemPath(OUString::fromUtf8(pEnv), aInStr);
-            std::unique_ptr<SvStream> pStream = utl::UcbStreamHelper::CreateStream(aInStr, StreamMode::READ);
+            std::unique_ptr<SvStream> pStream
+                = utl::UcbStreamHelper::CreateStream(aInStr, StreamMode::READ);
             uno::Reference<io::XStream> xStream(new utl::OStreamWrapper(std::move(pStream)));
             xInputStream.set(xStream, uno::UNO_QUERY);
         }
 
-        uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_FRAME(),
-                                               uno::Reference<frame::XFrame>());
+        uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(
+            utl::MediaDescriptor::PROP_FRAME(), uno::Reference<frame::XFrame>());
 
-        xStatusIndicator = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(),
-                           uno::Reference<task::XStatusIndicator>());
+        xStatusIndicator = aMediaDesc.getUnpackedValueOrDefault(
+            utl::MediaDescriptor::PROP_STATUSINDICATOR(), uno::Reference<task::XStatusIndicator>());
 
         writerfilter::Stream::Pointer_t pStream(
             writerfilter::dmapper::DomainMapperFactory::createMapper(
                 m_xContext, xInputStream, m_xDstDoc, bRepairStorage,
                 writerfilter::dmapper::SourceDocumentType::RTF, aMediaDesc));
         writerfilter::rtftok::RTFDocument::Pointer_t pDocument(
-            writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator, aMediaDesc));
+            writerfilter::rtftok::RTFDocumentFactory::createDocument(
+                m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator, aMediaDesc));
         pDocument->resolve(*pStream);
         bResult = true;
         sal_uInt32 nEndTime = osl_getGlobalTimer();
-        SAL_INFO("writerfilter.profile", "RtfFilter::filter: finished in " << nEndTime - nStartTime << " ms");
+        SAL_INFO("writerfilter.profile",
+                 "RtfFilter::filter: finished in " << nEndTime - nStartTime << " ms");
     }
     catch (const io::WrongFormatException&)
     {
         css::uno::Any anyEx = cppu::getCaughtException();
         // cannot throw WrongFormatException directly :(
-        throw lang::WrappedTargetRuntimeException("",
-                static_cast<OWeakObject*>(this), anyEx);
+        throw lang::WrappedTargetRuntimeException("", static_cast<OWeakObject*>(this), anyEx);
     }
     catch (const uno::Exception&)
     {
@@ -168,30 +168,25 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescrip
     return bResult;
 }
 
-void RtfFilter::cancel()
-{
-}
+void RtfFilter::cancel() {}
 
-void RtfFilter::setSourceDocument(const uno::Reference< lang::XComponent >& xDoc)
+void RtfFilter::setSourceDocument(const uno::Reference<lang::XComponent>& xDoc)
 {
     m_xSrcDoc = xDoc;
 }
 
-void RtfFilter::setTargetDocument(const uno::Reference< lang::XComponent >& xDoc)
+void RtfFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDoc)
 {
     m_xDstDoc = xDoc;
 }
 
-void RtfFilter::initialize(const uno::Sequence< uno::Any >& /*aArguments*/)
+void RtfFilter::initialize(const uno::Sequence<uno::Any>& /*aArguments*/)
 {
     // The DOCX exporter here extracts 'type' of the filter, ie 'Word' or
     // 'Word Template' but we don't need it for RTF.
 }
 
-OUString RtfFilter::getImplementationName()
-{
-    return "com.sun.star.comp.Writer.RtfFilter";
-}
+OUString RtfFilter::getImplementationName() { return "com.sun.star.comp.Writer.RtfFilter"; }
 
 sal_Bool RtfFilter::supportsService(const OUString& rServiceName)
 {
@@ -200,15 +195,14 @@ sal_Bool RtfFilter::supportsService(const OUString& rServiceName)
 
 uno::Sequence<OUString> RtfFilter::getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet =
-    {
-        OUString("com.sun.star.document.ImportFilter"),
-        OUString("com.sun.star.document.ExportFilter")
-    };
+    uno::Sequence<OUString> aRet = { OUString("com.sun.star.document.ImportFilter"),
+                                     OUString("com.sun.star.document.ExportFilter") };
     return aRet;
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* com_sun_star_comp_Writer_RtfFilter_get_implementation(uno::XComponentContext* pComponent, uno::Sequence<uno::Any> const& /*rSequence*/)
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_comp_Writer_RtfFilter_get_implementation(uno::XComponentContext* pComponent,
+                                                      uno::Sequence<uno::Any> const& /*rSequence*/)
 {
     return cppu::acquire(new RtfFilter(pComponent));
 }
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index a89c6874427a..4b4ccbb2a431 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -57,8 +57,9 @@ static OUString lcl_GetExceptionMessage(xml::sax::SAXException const& e)
 }
 static OUString lcl_GetExceptionMessage(xml::sax::SAXParseException const& e)
 {
-    OUString const thisMessage("SAXParseException: '" + e.Message + "', Stream '" + e.SystemId + "', Line " + OUString::number(e.LineNumber)
-                               + ", Column " + OUString::number(e.ColumnNumber));
+    OUString const thisMessage("SAXParseException: '" + e.Message + "', Stream '" + e.SystemId
+                               + "', Line " + OUString::number(e.LineNumber) + ", Column "
+                               + OUString::number(e.ColumnNumber));
     OUString const restMessage(lcl_GetExceptionMessageRec(e));
     return restMessage + "\n" + thisMessage;
 }
@@ -83,17 +84,12 @@ static OUString lcl_GetExceptionMessageRec(xml::sax::SAXException const& e)
     return OUString();
 }
 
-namespace {
-
+namespace
+{
 /// Common DOCX filter, calls DocxExportFilter via UNO or does the DOCX import.
-class WriterFilter : public cppu::WeakImplHelper
-    <
-    document::XFilter,
-    document::XImporter,
-    document::XExporter,
-    lang::XInitialization,
-    lang::XServiceInfo
-    >
+class WriterFilter
+    : public cppu::WeakImplHelper<document::XFilter, document::XImporter, document::XExporter,
+                                  lang::XInitialization, lang::XServiceInfo>
 {
     uno::Reference<uno::XComponentContext> m_xContext;
     uno::Reference<lang::XComponent> m_xSrcDoc, m_xDstDoc;
@@ -102,7 +98,8 @@ class WriterFilter : public cppu::WeakImplHelper
 public:
     explicit WriterFilter(uno::Reference<uno::XComponentContext> xContext)
         : m_xContext(std::move(xContext))
-    {}
+    {
+    }
 
     // XFilter
     sal_Bool SAL_CALL filter(const uno::Sequence<beans::PropertyValue>& rDescriptor) override;
@@ -122,18 +119,19 @@ public:
     sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
     uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
 };
-
 }
 
-sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescriptor)
+sal_Bool WriterFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescriptor)
 {
     if (m_xSrcDoc.is())
     {
-        uno::Reference< lang::XMultiServiceFactory > xMSF(m_xContext->getServiceManager(), uno::UNO_QUERY_THROW);
-        uno::Reference< uno::XInterface > xIfc;
+        uno::Reference<lang::XMultiServiceFactory> xMSF(m_xContext->getServiceManager(),
+                                                        uno::UNO_QUERY_THROW);
+        uno::Reference<uno::XInterface> xIfc;
         try
         {
-            xIfc.set(xMSF->createInstance("com.sun.star.comp.Writer.DocxExport"), uno::UNO_SET_THROW);
+            xIfc.set(xMSF->createInstance("com.sun.star.comp.Writer.DocxExport"),
+                     uno::UNO_SET_THROW);
         }
         catch (uno::RuntimeException&)
         {
@@ -142,14 +140,16 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
         catch (uno::Exception& e)
         {
             uno::Any a(cppu::getCaughtException());
-            throw lang::WrappedTargetRuntimeException("wrapped " + a.getValueTypeName() + ": " + e.Message, uno::Reference<uno::XInterface>(), a);
+            throw lang::WrappedTargetRuntimeException("wrapped " + a.getValueTypeName() + ": "
+                                                          + e.Message,
+                                                      uno::Reference<uno::XInterface>(), a);
         }
 
         uno::Reference<lang::XInitialization> xInit(xIfc, uno::UNO_QUERY_THROW);
         xInit->initialize(m_xInitializationArguments);
 
         uno::Reference<document::XExporter> xExprtr(xIfc, uno::UNO_QUERY_THROW);
-        uno::Reference< document::XFilter > xFltr(xIfc, uno::UNO_QUERY_THROW);
+        uno::Reference<document::XFilter> xFltr(xIfc, uno::UNO_QUERY_THROW);
         xExprtr->setSourceDocument(m_xSrcDoc);
         return xFltr->filter(rDescriptor);
     }
@@ -157,13 +157,15 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
     {
         utl::MediaDescriptor aMediaDesc(rDescriptor);
         bool bRepairStorage = aMediaDesc.getUnpackedValueOrDefault("RepairPackage", false);
-        bool bSkipImages = aMediaDesc.getUnpackedValueOrDefault("FilterOptions", OUString()) == "SkipImages";
+        bool bSkipImages
+            = aMediaDesc.getUnpackedValueOrDefault("FilterOptions", OUString()) == "SkipImages";
 
-        uno::Reference< io::XInputStream > xInputStream;
+        uno::Reference<io::XInputStream> xInputStream;
         try
         {
             // use the oox.core.FilterDetect implementation to extract the decrypted ZIP package
-            rtl::Reference<::oox::core::FilterDetect> xDetector(new ::oox::core::FilterDetect(m_xContext));
+            rtl::Reference<::oox::core::FilterDetect> xDetector(
+                new ::oox::core::FilterDetect(m_xContext));
             xInputStream = xDetector->extractUnencryptedPackage(aMediaDesc);
         }
         catch (uno::Exception&)
@@ -178,17 +180,21 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
                 m_xContext, xInputStream, m_xDstDoc, bRepairStorage,
                 writerfilter::dmapper::SourceDocumentType::OOXML, aMediaDesc));
         //create the tokenizer and domain mapper
-        writerfilter::ooxml::OOXMLStream::Pointer_t pDocStream = writerfilter::ooxml::OOXMLDocumentFactory::createStream(m_xContext, xInputStream, bRepairStorage);
-        uno::Reference<task::XStatusIndicator> xStatusIndicator = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(), uno::Reference<task::XStatusIndicator>());
-        writerfilter::ooxml::OOXMLDocument::Pointer_t pDocument(writerfilter::ooxml::OOXMLDocumentFactory::createDocument(pDocStream, xStatusIndicator, bSkipImages, rDescriptor));
+        writerfilter::ooxml::OOXMLStream::Pointer_t pDocStream
+            = writerfilter::ooxml::OOXMLDocumentFactory::createStream(m_xContext, xInputStream,
+                                                                      bRepairStorage);
+        uno::Reference<task::XStatusIndicator> xStatusIndicator
+            = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_STATUSINDICATOR(),
+                                                   uno::Reference<task::XStatusIndicator>());
+        writerfilter::ooxml::OOXMLDocument::Pointer_t pDocument(
+            writerfilter::ooxml::OOXMLDocumentFactory::createDocument(pDocStream, xStatusIndicator,
+                                                                      bSkipImages, rDescriptor));
 
         uno::Reference<frame::XModel> xModel(m_xDstDoc, uno::UNO_QUERY_THROW);
         pDocument->setModel(xModel);
 
-        uno::Reference<drawing::XDrawPageSupplier> xDrawings
-        (m_xDstDoc, uno::UNO_QUERY_THROW);
-        uno::Reference<drawing::XDrawPage> xDrawPage
-        (xDrawings->getDrawPage(), uno::UNO_SET_THROW);
+        uno::Reference<drawing::XDrawPageSupplier> xDrawings(m_xDstDoc, uno::UNO_QUERY_THROW);
+        uno::Reference<drawing::XDrawPage> xDrawPage(xDrawings->getDrawPage(), uno::UNO_SET_THROW);
         pDocument->setDrawPage(xDrawPage);
 
         try
@@ -199,15 +205,15 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
         {
             // note: SfxObjectShell checks for WrongFormatException
             io::WrongFormatException wfe(lcl_GetExceptionMessage(e));
-            throw lang::WrappedTargetRuntimeException("",
-                    static_cast<OWeakObject*>(this), uno::makeAny(wfe));
+            throw lang::WrappedTargetRuntimeException("", static_cast<OWeakObject*>(this),
+                                                      uno::makeAny(wfe));
         }
         catch (xml::sax::SAXException const& e)
         {
             // note: SfxObjectShell checks for WrongFormatException
             io::WrongFormatException wfe(lcl_GetExceptionMessage(e));
-            throw lang::WrappedTargetRuntimeException("",
-                    static_cast<OWeakObject*>(this), uno::makeAny(wfe));
+            throw lang::WrappedTargetRuntimeException("", static_cast<OWeakObject*>(this),
+                                                      uno::makeAny(wfe));
         }
         catch (uno::RuntimeException const&)
         {
@@ -216,9 +222,9 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
         catch (uno::Exception const&)
         {
             css::uno::Any anyEx = cppu::getCaughtException();
-            SAL_WARN("writerfilter", "WriterFilter::filter(): failed with " << exceptionToString(anyEx));
-            throw lang::WrappedTargetRuntimeException("",
-                    static_cast<OWeakObject*>(this), anyEx);
+            SAL_WARN("writerfilter",
+                     "WriterFilter::filter(): failed with " << exceptionToString(anyEx));
+            throw lang::WrappedTargetRuntimeException("", static_cast<OWeakObject*>(this), anyEx);
         }
 
         // Adding some properties to the document's grab bag for interoperability purposes:
@@ -240,24 +246,30 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
 
         oox::core::XmlFilterBase::putPropertiesToDocumentGrabBag(m_xDstDoc, aGrabBagProperties);
 
-        writerfilter::ooxml::OOXMLStream::Pointer_t  pVBAProjectStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream(pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT));
-        oox::StorageRef xVbaPrjStrg(new ::oox::ole::OleStorage(m_xContext, pVBAProjectStream->getDocumentStream(), false));
+        writerfilter::ooxml::OOXMLStream::Pointer_t pVBAProjectStream(
+            writerfilter::ooxml::OOXMLDocumentFactory::createStream(
+                pDocStream, writerfilter::ooxml::OOXMLStream::VBAPROJECT));
+        oox::StorageRef xVbaPrjStrg(
+            new ::oox::ole::OleStorage(m_xContext, pVBAProjectStream->getDocumentStream(), false));
         if (xVbaPrjStrg.get() && xVbaPrjStrg->isStorage())
         {
             ::oox::ole::VbaProject aVbaProject(m_xContext, xModel, "Writer");
-            uno::Reference< frame::XFrame > xFrame = aMediaDesc.getUnpackedValueOrDefault(utl::MediaDescriptor::PROP_FRAME(), uno::Reference< frame::XFrame > ());
+            uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(
+                utl::MediaDescriptor::PROP_FRAME(), uno::Reference<frame::XFrame>());
 
             // if no XFrame try fallback to what we can glean from the Model
             if (!xFrame.is())
             {
-                uno::Reference< frame::XController > xController =  xModel->getCurrentController();
-                xFrame =  xController.is() ? xController->getFrame() : nullptr;
+                uno::Reference<frame::XController> xController = xModel->getCurrentController();
+                xFrame = xController.is() ? xController->getFrame() : nullptr;
             }
 
             oox::GraphicHelper gHelper(m_xContext, xFrame, xVbaPrjStrg);
             aVbaProject.importVbaProject(*xVbaPrjStrg, gHelper);
 
-            writerfilter::ooxml::OOXMLStream::Pointer_t pVBADataStream(writerfilter::ooxml::OOXMLDocumentFactory::createStream(pDocStream, writerfilter::ooxml::OOXMLStream::VBADATA));
+            writerfilter::ooxml::OOXMLStream::Pointer_t pVBADataStream(
+                writerfilter::ooxml::OOXMLDocumentFactory::createStream(
+                    pDocStream, writerfilter::ooxml::OOXMLStream::VBADATA));
             if (pVBADataStream)
             {
                 uno::Reference<io::XInputStream> xDataStream = pVBADataStream->getDocumentStream();
@@ -273,17 +285,16 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
     return false;
 }
 
-void WriterFilter::cancel()
-{
-}
+void WriterFilter::cancel() {}
 
-void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& xDoc)
+void WriterFilter::setTargetDocument(const uno::Reference<lang::XComponent>& xDoc)
 {
     m_xDstDoc = xDoc;
 
     // Set some compatibility options that are valid for all the formats
-    uno::Reference< lang::XMultiServiceFactory > xFactory(xDoc, uno::UNO_QUERY);
-    uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
+    uno::Reference<lang::XMultiServiceFactory> xFactory(xDoc, uno::UNO_QUERY);
+    uno::Reference<beans::XPropertySet> xSettings(
+        xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
 
     xSettings->setPropertyValue("AddFrameOffsets", uno::makeAny(true));
     xSettings->setPropertyValue("AddVerticalFrameOffsets", uno::makeAny(true));
@@ -312,39 +323,33 @@ void WriterFilter::setTargetDocument(const uno::Reference< lang::XComponent >& x
     xSettings->setPropertyValue("DisableOffPagePositioning", uno::makeAny(true));
 }
 
-void WriterFilter::setSourceDocument(const uno::Reference< lang::XComponent >& xDoc)
+void WriterFilter::setSourceDocument(const uno::Reference<lang::XComponent>& xDoc)
 {
     m_xSrcDoc = xDoc;
 }
 
-void WriterFilter::initialize(const uno::Sequence< uno::Any >& rArguments)
+void WriterFilter::initialize(const uno::Sequence<uno::Any>& rArguments)
 {
     m_xInitializationArguments = rArguments;
 }
 
-OUString WriterFilter::getImplementationName()
-{
-    return "com.sun.star.comp.Writer.WriterFilter";
-}
-
+OUString WriterFilter::getImplementationName() { return "com.sun.star.comp.Writer.WriterFilter"; }
 
 sal_Bool WriterFilter::supportsService(const OUString& rServiceName)
 {
     return cppu::supportsService(this, rServiceName);
 }
 
-
 uno::Sequence<OUString> WriterFilter::getSupportedServiceNames()
 {
-    uno::Sequence<OUString> aRet =
-    {
-        OUString("com.sun.star.document.ImportFilter"),
-        OUString("com.sun.star.document.ExportFilter")
-    };
+    uno::Sequence<OUString> aRet = { OUString("com.sun.star.document.ImportFilter"),
+                                     OUString("com.sun.star.document.ExportFilter") };
     return aRet;
 }
 
-extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* com_sun_star_comp_Writer_WriterFilter_get_implementation(uno::XComponentContext* component, uno::Sequence<uno::Any> const& /*rSequence*/)
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_comp_Writer_WriterFilter_get_implementation(
+    uno::XComponentContext* component, uno::Sequence<uno::Any> const& /*rSequence*/)
 {
     return cppu::acquire(new WriterFilter(component));
 }


More information about the Libreoffice-commits mailing list