[Libreoffice-commits] core.git: 2 commits - sw/source unotest/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Mar 31 00:17:59 PDT 2015


 sw/source/filter/ww8/rtfattributeoutput.cxx |   12 ++++-----
 sw/source/filter/ww8/rtfsdrexport.cxx       |    2 -
 unotest/source/cpp/macros_test.cxx          |   37 +++++++++++++---------------
 3 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit 0986fe775563a9fd2a463f1c1b288fb5209b0b52
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 31 09:14:45 2015 +0200

    MacrosTest::loadFromDesktop: use comphelper::containerToSequence()
    
    Change-Id: I91e385a6a7fe88251ec11ed90b61a3f61768ff5a

diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx
index 7dce6ef..aab1f44 100644
--- a/unotest/source/cpp/macros_test.cxx
+++ b/unotest/source/cpp/macros_test.cxx
@@ -9,11 +9,14 @@
 
 #include "unotest/macros_test.hxx"
 
+#include <vector>
+
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/document/MacroExecMode.hpp>
 
 #include "cppunit/TestAssert.h"
 #include <rtl/ustrbuf.hxx>
+#include <comphelper/sequence.hxx>
 
 using namespace css;
 
@@ -24,35 +27,31 @@ uno::Reference<css::lang::XComponent> MacrosTest::loadFromDesktop(const OUString
     CPPUNIT_ASSERT_MESSAGE("no desktop", mxDesktop.is());
     uno::Reference<frame::XComponentLoader> xLoader = uno::Reference<frame::XComponentLoader>(mxDesktop, uno::UNO_QUERY);
     CPPUNIT_ASSERT_MESSAGE("no loader", xLoader.is());
-    uno::Sequence<beans::PropertyValue> args(1);
-    args[0].Name = "MacroExecutionMode";
-    args[0].Handle = -1;
-    args[0].Value <<= document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
-    args[0].State = beans::PropertyState_DIRECT_VALUE;
+    std::vector<beans::PropertyValue> args;
+    beans::PropertyValue aMacroValue;
+    aMacroValue.Name = "MacroExecutionMode";
+    aMacroValue.Handle = -1;
+    aMacroValue.Value <<= document::MacroExecMode::ALWAYS_EXECUTE_NO_WARN;
+    aMacroValue.State = beans::PropertyState_DIRECT_VALUE;
+    args.push_back(aMacroValue);
 
     if (!rDocService.isEmpty())
     {
-        args.realloc(2);
-        args[1].Name = "DocumentService";
-        args[1].Handle = -1;
-        args[1].Value <<= rDocService;
-        args[1].State = beans::PropertyState_DIRECT_VALUE;
+        beans::PropertyValue aValue;
+        aValue.Name = "DocumentService";
+        aValue.Handle = -1;
+        aValue.Value <<= rDocService;
+        aValue.State = beans::PropertyState_DIRECT_VALUE;
+        args.push_back(aValue);
     }
 
     if (rExtraArgs.getLength() > 0)
     {
-        sal_Int32 aSize = args.getLength();
-        args.realloc(aSize + rExtraArgs.getLength());
         for (int i = 0; i < rExtraArgs.getLength(); i++)
-        {
-            args[aSize + i].Name = rExtraArgs[i].Name;
-            args[aSize + i].Handle = rExtraArgs[i].Handle;
-            args[aSize + i].Value = rExtraArgs[i].Value;
-            args[aSize + i].State = rExtraArgs[i].State;
-        }
+            args.push_back(rExtraArgs[i]);
     }
 
-    uno::Reference<lang::XComponent> xComponent = xLoader->loadComponentFromURL(rURL, OUString("_default"), 0, args);
+    uno::Reference<lang::XComponent> xComponent = xLoader->loadComponentFromURL(rURL, OUString("_default"), 0, comphelper::containerToSequence(args));
     OUString sMessage = "loading failed: " + rURL;
     CPPUNIT_ASSERT_MESSAGE(OUStringToOString( sMessage, RTL_TEXTENCODING_UTF8 ).getStr( ), xComponent.is());
     return xComponent;
commit 9c9ef9f2df532e8dbaf8e6500c3c6978f3ae80be
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Tue Mar 31 09:14:22 2015 +0200

    RTF export: indentation fixes
    
    Change-Id: I86ee19578546b55d4f1e3e6e9cecad2021ac49b2

diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 61405e0..08f927b 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3639,7 +3639,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrmFmt* pFlyFrmFmt, S
         SAL_WARN("sw.rtf", "failed to export the graphic");
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
-    pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
+    pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
     m_aRunText->append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport));
     m_aRunText->append("}"); // shppict
     m_aRunText->append("{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT);
@@ -3649,7 +3649,7 @@ void RtfAttributeOutput::FlyFrameOLEReplacement(const SwFlyFrmFmt* pFlyFrmFmt, S
         SAL_WARN("sw.rtf", "failed to export the graphic");
     aWmfStream.Seek(STREAM_SEEK_TO_END);
     nSize = aWmfStream.Tell();
-    pGraphicAry = static_cast<sal_uInt8 const *>(aWmfStream.GetData());
+    pGraphicAry = static_cast<sal_uInt8 const*>(aWmfStream.GetData());
     m_aRunText->append(ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport));
     m_aRunText->append("}"); // nonshppict
 }
@@ -3753,7 +3753,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
                         OOO_STRING_SVTOOLS_RTF_PNGBLIP : OOO_STRING_SVTOOLS_RTF_WMETAFILE;
             aStream.Seek(STREAM_SEEK_TO_END);
             nSize = aStream.Tell();
-            pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
+            pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
         }
     }
 
@@ -3851,7 +3851,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
         pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
         aStream.Seek(STREAM_SEEK_TO_END);
         nSize = aStream.Tell();
-        pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
+        pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
 
         ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
     }
@@ -3868,7 +3868,7 @@ void RtfAttributeOutput::FlyFrameGraphic(const SwFlyFrmFmt* pFlyFrmFmt, const Sw
             pBLIPType = OOO_STRING_SVTOOLS_RTF_WMETAFILE;
             aStream.Seek(STREAM_SEEK_TO_END);
             nSize = aStream.Tell();
-            pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
+            pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
 
             ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, pGraphicAry, nSize, m_rExport, &m_rExport.Strm());
 
@@ -3898,7 +3898,7 @@ void RtfAttributeOutput::BulletDefinition(int /*nId*/, const Graphic& rGraphic,
         SAL_WARN("sw.rtf", "failed to export the numbering picture bullet");
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
-    pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
+    pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
     RtfAttributeOutput::WriteHex(pGraphicAry, nSize, &m_rExport.Strm());
     m_rExport.Strm().WriteCharPtr("}}");   // pict, shppict
 }
diff --git a/sw/source/filter/ww8/rtfsdrexport.cxx b/sw/source/filter/ww8/rtfsdrexport.cxx
index 1c61222..31db341 100644
--- a/sw/source/filter/ww8/rtfsdrexport.cxx
+++ b/sw/source/filter/ww8/rtfsdrexport.cxx
@@ -459,7 +459,7 @@ void RtfSdrExport::impl_writeGraphic()
     GraphicConverter::Export(aStream, aGraphic, CVT_PNG);
     aStream.Seek(STREAM_SEEK_TO_END);
     sal_uInt32 nSize = aStream.Tell();
-    const sal_uInt8* pGraphicAry = static_cast<sal_uInt8 const *>(aStream.GetData());
+    const sal_uInt8* pGraphicAry = static_cast<sal_uInt8 const*>(aStream.GetData());
 
     Size aMapped(aGraphic.GetPrefSize());
 


More information about the Libreoffice-commits mailing list