[Libreoffice-commits] core.git: 5 commits - sw/qa sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Fri Nov 21 14:06:40 PST 2014


 sw/qa/extras/inc/swmodeltestbase.hxx              |   54 -----------------
 sw/qa/extras/mailmerge/mailmerge.cxx              |   69 ++++++++++++++++++++--
 sw/qa/extras/ooxmlexport/ooxmlexport2.cxx         |   12 +--
 sw/qa/extras/ooxmlimport/ooxmlimport.cxx          |   11 +--
 sw/source/core/unocore/unofield.cxx               |    3 
 writerfilter/source/dmapper/DomainMapper.cxx      |    2 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |    2 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx    |   11 +--
 8 files changed, 85 insertions(+), 79 deletions(-)

New commits:
commit 186d021c157ddcbe98474dd347c80e8dcc7ab471
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 21 22:31:56 2014 +0100

    Use oox::drawingml::convertEmuToHmm()
    
    This makes the +1 hack unnecessary in CppunitTest_sw_ooxmlexport2.
    
    Change-Id: Ibf0a32b0bf03e9b47850edb335947e4ec383327b

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index e5966e3..4f71ff6 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -51,7 +51,6 @@
 using namespace css;
 
 #define DEFAULT_STYLE "Default Style"
-#define EMU_TO_MM100(EMU) (EMU / 360)
 
 /**
  * Macro to declare a new test (with full round-trip. To test
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 8dc4e94..6d7a87a 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -49,6 +49,7 @@
 #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
 #include <com/sun/star/drawing/Hatch.hpp>
+#include <oox/drawingml/drawingmltypes.hxx>
 
 #include <string>
 
@@ -974,17 +975,16 @@ DECLARE_OOXMLEXPORT_TEST(testFdo65718, "fdo65718.docx")
     // the actual attributes where 'distT', 'distB', 'distL', 'distR'
     uno::Reference<beans::XPropertySet> xPropertySet(getShape(1), uno::UNO_QUERY);
 
-    CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(0) ), getProperty<sal_Int32>(xPropertySet, "TopMargin") );
-    CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(0) ), getProperty<sal_Int32>(xPropertySet, "BottomMargin") );
+    CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(0) ), getProperty<sal_Int32>(xPropertySet, "TopMargin") );
+    CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(0) ), getProperty<sal_Int32>(xPropertySet, "BottomMargin") );
 
-    // Going to do '+1' because the 'getProperty' return 318 (instead of 317.5)
+    // 'getProperty' return 318 (instead of 317.5)
     // I think this is because it returns an integer, instead of a float.
     // The actual exporting to DOCX exports the correct value (114300 = 317.5 * 360)
     // The exporting to DOCX uses the 'SvxLRSpacing' that stores the value in TWIPS (180 TWIPS)
     // However, the 'LeftMargin' property is an integer property that holds that value in 'MM100' (should hold 317.5, but it is 318)
-    // So I had to add the hack of the '+1' to make the test-case pass
-    CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(114300) + 1 ), getProperty<sal_Int32>(xPropertySet, "LeftMargin") );
-    CPPUNIT_ASSERT_EQUAL(sal_Int32( EMU_TO_MM100(114300) + 1), getProperty<sal_Int32>(xPropertySet, "RightMargin") );
+    CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(114300) ), getProperty<sal_Int32>(xPropertySet, "LeftMargin") );
+    CPPUNIT_ASSERT_EQUAL(sal_Int32( oox::drawingml::convertEmuToHmm(114300) ), getProperty<sal_Int32>(xPropertySet, "RightMargin") );
 }
 
 DECLARE_OOXMLEXPORT_TEST(testFdo64350, "fdo64350.docx")
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
index 27fe3d6..0c095e3 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx
@@ -64,6 +64,7 @@
 #include <com/sun/star/text/GraphicCrop.hpp>
 #include <swtypes.hxx>
 #include <tools/datetimeutils.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
 
 #include <bordertest.hxx>
 
@@ -1216,7 +1217,7 @@ DECLARE_OOXMLIMPORT_TEST(testfdo78904, "fdo78904.docx")
     if (xIndexAccess->getCount())
     {
         uno::Reference<beans::XPropertySet> xFrame(xIndexAccess->getByIndex(0), uno::UNO_QUERY);
-        CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(0)), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
+        CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(0)), getProperty<sal_Int32>(xFrame, "HoriOrientPosition"));
     }
 }
 
@@ -1381,7 +1382,7 @@ DECLARE_OOXMLIMPORT_TEST(testFdo43641, "fdo43641.docx")
     uno::Reference<container::XIndexAccess> xGroupShape(getShape(1), uno::UNO_QUERY);
     uno::Reference<drawing::XShape> xLine(xGroupShape->getByIndex(1), uno::UNO_QUERY);
     // This was 2200, not 2579 in mm100, i.e. the size of the line shape was incorrect.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(928694)), xLine->getSize().Width);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(928440)), xLine->getSize().Width);
 }
 
 DECLARE_OOXMLIMPORT_TEST(testTableAutoColumnFixedSize, "table-auto-column-fixed-size.docx")
@@ -1660,7 +1661,7 @@ DECLARE_OOXMLIMPORT_TEST(testWpsOnly, "wps-only.docx")
     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_PARAGRAPH, eValue);
 
     // Check position, it was 0. This is a shape, so use getPosition(), not a property.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(671830)), xShape->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(671830)), xShape->getPosition().X);
 
     // Left margin was 0, instead of 114300 EMU's.
     CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xShape, "LeftMargin"));
@@ -1705,7 +1706,7 @@ DECLARE_OOXMLIMPORT_TEST(testWpgOnly, "wpg-only.docx")
 {
     uno::Reference<drawing::XShape> xShape = getShape(1);
     // Check position, it was nearly 0. This is a shape, so use getPosition(), not a property.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(548005)), xShape->getPosition().X);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(548005)), xShape->getPosition().X);
 }
 
 DECLARE_OOXMLIMPORT_TEST(testWpgNested, "wpg-nested.docx")
@@ -1871,7 +1872,7 @@ DECLARE_OOXMLIMPORT_TEST(testDmlCharheightDefault, "dml-charheight-default.docx"
 DECLARE_OOXMLIMPORT_TEST(testGroupshapeRelsize, "groupshape-relsize.docx")
 {
     // This was 43760, i.e. the height of the groupshape was larger than the page height, which is obviously incorrect.
-    CPPUNIT_ASSERT_EQUAL(sal_Int32(EMU_TO_MM100(9142730)), getShape(1)->getSize().Height);
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(oox::drawingml::convertEmuToHmm(9142730)), getShape(1)->getSize().Height);
 }
 
 DECLARE_OOXMLIMPORT_TEST(testOleAnchor, "ole-anchor.docx")
commit 93e5b09f3acab7998cac2b1879e43e98ad7cc81a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 21 22:27:45 2014 +0100

    Use oox::drawingml::convertHmmToEmu()
    
    Change-Id: I0ee90069eaf626e84f3b2b84d10be09a0f5b1561

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index cfca395..70cc3da 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -33,6 +33,7 @@
 #include <oox/mathml/import.hxx>
 #include <ooxml/resourceids.hxx>
 #include <oox/token/namespaces.hxx>
+#include <oox/drawingml/drawingmltypes.hxx>
 #include <dmapper/GraphicHelpers.hxx>
 #include <rtfsdrimport.hxx>
 #include <rtflookahead.hxx>
@@ -41,8 +42,6 @@
 #include <rtfskipdestination.hxx>
 #include <rtffly.hxx>
 
-#define MM100_TO_EMU(MM100)     (MM100 * 360)
-
 using namespace com::sun::star;
 
 namespace writerfilter
@@ -894,8 +893,8 @@ int RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XSh
         nXExt = (((long)m_aStates.top().aPicture.nScaleX) * (nXExt - (m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR))) / 100L;
     if (m_aStates.top().aPicture.nScaleY != 100)
         nYExt = (((long)m_aStates.top().aPicture.nScaleY) * (nYExt - (m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB))) / 100L;
-    RTFValue::Pointer_t pXExtValue(new RTFValue(MM100_TO_EMU(nXExt)));
-    RTFValue::Pointer_t pYExtValue(new RTFValue(MM100_TO_EMU(nYExt)));
+    RTFValue::Pointer_t pXExtValue(new RTFValue(oox::drawingml::convertHmmToEmu(nXExt)));
+    RTFValue::Pointer_t pYExtValue(new RTFValue(oox::drawingml::convertHmmToEmu(nYExt)));
     aExtentAttributes.set(NS_ooxml::LN_CT_PositiveSize2D_cx, pXExtValue);
     aExtentAttributes.set(NS_ooxml::LN_CT_PositiveSize2D_cy, pYExtValue);
     RTFValue::Pointer_t pExtentValue(new RTFValue(aExtentAttributes));
@@ -956,14 +955,14 @@ int RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XSh
         if (m_aStates.top().aShape.nHoriOrientRelationToken > 0)
             aPoshSprms.set(NS_ooxml::LN_CT_PosH_relativeFrom, RTFValue::Pointer_t(new RTFValue(m_aStates.top().aShape.nHoriOrientRelationToken)));
         if (m_aStates.top().aShape.nLeft != 0)
-            writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nLeft)), false);
+            writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nLeft)), false);
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionH, RTFValue::Pointer_t(new RTFValue(aPoshSprms)));
 
         RTFSprms aPosvSprms;
         if (m_aStates.top().aShape.nVertOrientRelationToken > 0)
             aPosvSprms.set(NS_ooxml::LN_CT_PosV_relativeFrom, RTFValue::Pointer_t(new RTFValue(m_aStates.top().aShape.nVertOrientRelationToken)));
         if (m_aStates.top().aShape.nTop != 0)
-            writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(MM100_TO_EMU(m_aStates.top().aShape.nTop)), true);
+            writerfilter::dmapper::PositionHandler::setPositionOffset(OUString::number(oox::drawingml::convertHmmToEmu(m_aStates.top().aShape.nTop)), true);
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_positionV, RTFValue::Pointer_t(new RTFValue(aPosvSprms)));
 
         aAnchorSprms.set(NS_ooxml::LN_CT_Anchor_docPr, pDocprValue);
commit dfdfdedfff1444963cae4d4d85ddf99f3ee2f02d
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 21 22:11:02 2014 +0100

    CppunitTest_sw_mailmerge: remaining MM methods from header file
    
    Change-Id: I74e5ebd0d879ce6864707b28b002672e5fb78f74

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx b/sw/qa/extras/inc/swmodeltestbase.hxx
index 3452950..e5966e3 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -27,7 +27,6 @@
 #include <com/sun/star/sdb/CommandType.hpp>
 #include <com/sun/star/sdb/DatabaseContext.hpp>
 #include <com/sun/star/sdb/XDocumentDataSource.hpp>
-#include <com/sun/star/text/MailMergeType.hpp>
 
 #include <test/bootstrapfixture.hxx>
 #include <test/xmltesttools.hxx>
@@ -157,9 +156,6 @@ private:
 
 protected:
     uno::Reference< lang::XComponent > mxComponent;
-    uno::Reference< lang::XComponent > mxMMComponent;
-    uno::Reference< com::sun::star::task::XJob > mxJob;
-    uno::Sequence< beans::NamedValue > mSeqMailMergeArgs;
 
     xmlBufferPtr mpXmlBuffer;
     const char* mpTestDocumentPath;
@@ -175,9 +171,6 @@ protected:
     sal_uInt32 mnStartTime;
     utl::TempFile maTempFile;
     bool mbExported; ///< Does maTempFile already contain something useful?
-    sal_Int16 nCurOutputType;
-    OUString mailMergeOutputURL;
-    OUString mailMergeOutputPrefix;
 
 protected:
     virtual OUString getTestName() { return OUString(); }
@@ -198,7 +191,6 @@ public:
         , mpFilter(pFilter)
         , mnStartTime(0)
         , mbExported(false)
-        , nCurOutputType(0)
     {
         maTempFile.EnableKillingFile();
     }
@@ -217,17 +209,6 @@ public:
     {
         if (mxComponent.is())
             mxComponent->dispose();
-        if (mxMMComponent.is())
-        {
-            if (nCurOutputType == text::MailMergeType::SHELL)
-            {
-                SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument*>(mxMMComponent.get());
-                CPPUNIT_ASSERT(pTxtDoc);
-                pTxtDoc->GetDocShell()->DoClose();
-            }
-            else
-                mxMMComponent->dispose();
-        }
 
         test::BootstrapFixture::tearDown();
     }
@@ -356,6 +337,7 @@ private:
         xmlFreeTextWriter(pXmlWriter);
     }
 
+protected:
     void discardDumpedLayout()
     {
         if (mpXmlBuffer)
@@ -373,7 +355,6 @@ private:
         pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->CalcLayout();
     }
 
-protected:
     /// Get the length of the whole document.
     int getLength()
     {
@@ -618,26 +599,6 @@ protected:
             calcLayout();
     }
 
-    /**
-     Loads number-th document from mail merge. Requires file output from mail merge.
-    */
-    void loadMailMergeDocument( int number )
-    {
-        assert( nCurOutputType == text::MailMergeType::FILE );
-        if (mxComponent.is())
-            mxComponent->dispose();
-        OUString name = mailMergeOutputPrefix + OUString::number( number ) + ".odt";
-        // Output name early, so in the case of a hang, the name of the hanging input file is visible.
-        std::cout << name << ",";
-        mnStartTime = osl_getGlobalTimer();
-        mxComponent = loadFromDesktop(mailMergeOutputURL + "/" + name, "com.sun.star.text.TextDocument");
-        CPPUNIT_ASSERT( mxComponent.is());
-        OString name2 = OUStringToOString( name, RTL_TEXTENCODING_UTF8 );
-        discardDumpedLayout();
-        if (mustCalcLayoutOf(name2.getStr()))
-            calcLayout();
-    }
-
     void reload(const char* pFilter, const char* filename)
     {
         uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY);
@@ -712,18 +673,6 @@ protected:
         return parseExportInternal( maTempFile.GetURL(), rStreamName );
     }
 
-    /**
-     * Like parseExport(), but for given mail merge document.
-     */
-    xmlDocPtr parseMailMergeExport(int number, const OUString& rStreamName = OUString("word/document.xml"))
-    {
-        if (nCurOutputType != text::MailMergeType::FILE)
-            return 0;
-
-        OUString name = mailMergeOutputPrefix + OUString::number( number ) + ".odt";
-        return parseExportInternal( mailMergeOutputURL + "/" + name, rStreamName );
-    }
-
     xmlDocPtr parseExportInternal( const OUString& url, const OUString& rStreamName )
     {
         // Read the XML stream we're interested in.
diff --git a/sw/qa/extras/mailmerge/mailmerge.cxx b/sw/qa/extras/mailmerge/mailmerge.cxx
index d17c835..9fa68bb 100644
--- a/sw/qa/extras/mailmerge/mailmerge.cxx
+++ b/sw/qa/extras/mailmerge/mailmerge.cxx
@@ -40,7 +40,24 @@ DBuriMap aDBuriMap;
 class MMTest : public SwModelTestBase
 {
 public:
-        MMTest() : SwModelTestBase("/sw/qa/extras/mailmerge/data/", "writer8") {}
+    MMTest();
+
+    virtual void tearDown() SAL_OVERRIDE
+    {
+        if (mxMMComponent.is())
+        {
+            if (mnCurOutputType == text::MailMergeType::SHELL)
+            {
+                SwXTextDocument* pTxtDoc = dynamic_cast<SwXTextDocument*>(mxMMComponent.get());
+                CPPUNIT_ASSERT(pTxtDoc);
+                pTxtDoc->GetDocShell()->DoClose();
+            }
+            else
+                mxMMComponent->dispose();
+        }
+        SwModelTestBase::tearDown();
+    }
+
     /**
      * Helper func used by each unit test to test the 'mail merge' code.
      *
@@ -67,7 +84,7 @@ public:
         finish();
 
         ::utl::removeTree(aWorkDir);
-        nCurOutputType = 0;
+        mnCurOutputType = 0;
     }
 
     OUString registerDBsource( const OUString &aURI, const OUString &aWorkDir )
@@ -131,12 +148,12 @@ public:
             else if (rName == UNO_NAME_FILE_NAME_PREFIX)
                 bOk &= rValue >>= mailMergeOutputPrefix;
             else if (rName == UNO_NAME_OUTPUT_TYPE)
-                bOk &= rValue >>= nCurOutputType;
+                bOk &= rValue >>= mnCurOutputType;
         }
 
         CPPUNIT_ASSERT(bOk);
 
-        if (nCurOutputType == text::MailMergeType::SHELL)
+        if (mnCurOutputType == text::MailMergeType::SHELL)
         {
             CPPUNIT_ASSERT(res >>= mxMMComponent);
             CPPUNIT_ASSERT(mxMMComponent.is());
@@ -148,9 +165,48 @@ public:
         }
     }
 
+    /**
+     * Like parseExport(), but for given mail merge document.
+     */
+    xmlDocPtr parseMailMergeExport(int number, const OUString& rStreamName = OUString("word/document.xml"))
+    {
+        if (mnCurOutputType != text::MailMergeType::FILE)
+            return 0;
+
+        OUString name = mailMergeOutputPrefix + OUString::number( number ) + ".odt";
+        return parseExportInternal( mailMergeOutputURL + "/" + name, rStreamName );
+    }
+
+    /**
+     Loads number-th document from mail merge. Requires file output from mail merge.
+    */
+    void loadMailMergeDocument( int number )
+    {
+        assert( mnCurOutputType == text::MailMergeType::FILE );
+        if (mxComponent.is())
+            mxComponent->dispose();
+        OUString name = mailMergeOutputPrefix + OUString::number( number ) + ".odt";
+        // Output name early, so in the case of a hang, the name of the hanging input file is visible.
+        std::cout << name << ",";
+        mnStartTime = osl_getGlobalTimer();
+        mxComponent = loadFromDesktop(mailMergeOutputURL + "/" + name, "com.sun.star.text.TextDocument");
+        CPPUNIT_ASSERT( mxComponent.is());
+        OString name2 = OUStringToOString( name, RTL_TEXTENCODING_UTF8 );
+        discardDumpedLayout();
+        if (mustCalcLayoutOf(name2.getStr()))
+            calcLayout();
+    }
+
 protected:
     // Returns page number of the first page of a MM document inside the large MM document (used in the SHELL case).
     int documentStartPageNumber( int document ) const;
+
+    uno::Reference< com::sun::star::task::XJob > mxJob;
+    uno::Sequence< beans::NamedValue > mSeqMailMergeArgs;
+    OUString mailMergeOutputURL;
+    OUString mailMergeOutputPrefix;
+    sal_Int16 mnCurOutputType;
+    uno::Reference< lang::XComponent > mxMMComponent;
 };
 
 #define DECLARE_MAILMERGE_TEST(TestName, filename, datasource, tablename, file, BaseClass) \
@@ -201,6 +257,11 @@ int MMTest::documentStartPageNumber( int document ) const
     shell->Pop(false);
     return page;
 }
+MMTest::MMTest()
+    : SwModelTestBase("/sw/qa/extras/mailmerge/data/", "writer8")
+    , mnCurOutputType(0)
+{
+}
 
 DECLARE_SHELL_MAILMERGE_TEST(testMultiPageAnchoredDraws, "multiple-page-anchored-draws.odt", "4_v01.ods", "Tabelle1")
 {
commit b7574264b5a554683bfbf9316cf4b5a502e90575
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 21 21:59:32 2014 +0100

    SwXTextField::getAnchor: avoid pointless dynamic_cast<>
    
    Change-Id: I4cc96b8e1dee423216e528410953108c64ac5d63

diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx
index 07a996c..93fae3b 100644
--- a/sw/source/core/unocore/unofield.cxx
+++ b/sw/source/core/unocore/unofield.cxx
@@ -2079,8 +2079,9 @@ SwXTextField::getAnchor() throw (uno::RuntimeException, std::exception)
         return 0;
 
     // If this is a postit field, then return the range of its annotation mark if it has one.
-    if (const SwPostItField* pPostItField = dynamic_cast<const SwPostItField*>(pField))
+    if (pField->Which() == RES_POSTITFLD)
     {
+        const SwPostItField* pPostItField = static_cast<const SwPostItField*>(pField);
         IDocumentMarkAccess* pMarkAccess = m_pImpl->m_pDoc->getIDocumentMarkAccess();
         for (IDocumentMarkAccess::const_iterator_t ppMark = pMarkAccess->getAnnotationMarksBegin(); ppMark != pMarkAccess->getAnnotationMarksEnd(); ++ppMark)
         {
commit 6fb943be1cd9d41e173914176698a9b162618447
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Fri Nov 21 21:47:46 2014 +0100

    writerfilter: remove strange SAL_DEBUG lines
    
    Ideally the git hook makes impossible to add these.
    
    Change-Id: Ifa06ddde41ad4f23368ae401c1aa58a43fd14e12

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8d4f548..3285d7e 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -219,11 +219,9 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
         case NS_ooxml::LN_endnote:
             break;
         case NS_ooxml::LN_CT_Bookmark_name:
-            // SAL_DEBUG("LN_CT_Bookmark_name " << sStringValue);
             m_pImpl->SetBookmarkName( sStringValue );
         break;
         case NS_ooxml::LN_CT_MarkupRangeBookmark_id:
-            // SAL_DEBUG("LN_CT_MarkupRangeBookmark_id " << sStringValue);
             // add a bookmark range -- this remembers a bookmark starting here
             // or, if the bookmark was already started or, if the bookmark was
             // already started before, writes out the bookmark
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 5c3aaeb..462c449 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -4354,7 +4354,6 @@ void DomainMapper_Impl::PopFieldContext()
 
 void DomainMapper_Impl::SetBookmarkName( const OUString& rBookmarkName )
 {
-    // SAL_DEBUG("DomainMapper_Impl::SetBookmarkName for id " << m_sCurrentBkmkId << " to " << rBookmarkName);
     BookmarkMap_t::iterator aBookmarkIter = m_aBookmarkMap.find( m_sCurrentBkmkId );
     if( aBookmarkIter != m_aBookmarkMap.end() )
         aBookmarkIter->second.m_sBookmarkName = rBookmarkName;
@@ -4364,7 +4363,6 @@ void DomainMapper_Impl::SetBookmarkName( const OUString& rBookmarkName )
 
 void DomainMapper_Impl::StartOrEndBookmark( const OUString& rId )
 {
-    // SAL_DEBUG("DomainMapper_Impl::AddBookmark " << rId);
     /*
      * Add the dummy paragraph to handle section properties
      * iff the first element in the section is a table. If the dummy para is not added yet, then add it;


More information about the Libreoffice-commits mailing list