[Libreoffice-commits] core.git: 7 commits - sw/inc sw/qa sw/source unusedcode.easy

Caolán McNamara caolanm at redhat.com
Fri Mar 28 01:59:07 PDT 2014


 sw/inc/IDocumentMarkAccess.hxx               |    3 
 sw/inc/IMark.hxx                             |    2 
 sw/inc/modeltoviewhelper.hxx                 |   11 +-
 sw/inc/pam.hxx                               |    2 
 sw/qa/core/uwriter.cxx                       |   37 +++++++-
 sw/source/core/doc/docbm.cxx                 |   30 ++++++
 sw/source/core/edit/edlingu.cxx              |    5 +
 sw/source/core/inc/MarkManager.hxx           |    3 
 sw/source/core/text/inftxt.cxx               |    5 -
 sw/source/core/text/inftxt.hxx               |    2 
 sw/source/core/text/itrform2.cxx             |   48 ++++++++++
 sw/source/core/text/porfld.cxx               |    6 +
 sw/source/core/text/porfld.hxx               |   15 +++
 sw/source/core/text/portxt.cxx               |   82 ++----------------
 sw/source/core/text/portxt.hxx               |    9 +-
 sw/source/core/txtnode/modeltoviewhelper.cxx |  118 +++++++++++++++++++--------
 sw/source/core/txtnode/ndtxt.cxx             |   14 ++-
 sw/source/core/txtnode/txtedt.cxx            |   10 +-
 sw/source/core/uibase/cctrl/actctrl.cxx      |    9 --
 sw/source/core/uibase/inc/actctrl.hxx        |    6 -
 unusedcode.easy                              |    1 
 21 files changed, 275 insertions(+), 143 deletions(-)

New commits:
commit 1e25d6d9a59d3508b7f7d3e37b01a1ca8baa99ca
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Mar 28 08:55:47 2014 +0000

    callcatcher: update unused code
    
    Change-Id: Iefb8aa92a143fd192c382a0e18a632a0888cc511

diff --git a/sw/source/core/uibase/cctrl/actctrl.cxx b/sw/source/core/uibase/cctrl/actctrl.cxx
index d3d1936..eb5fe93 100644
--- a/sw/source/core/uibase/cctrl/actctrl.cxx
+++ b/sw/source/core/uibase/cctrl/actctrl.cxx
@@ -90,15 +90,6 @@ void NoSpaceEdit::Modify()
     Edit::Modify();
 }
 
-ReturnActionEdit::ReturnActionEdit(Window* pParent, const ResId& rResId)
-    : Edit(pParent, rResId)
-{
-}
-
-ReturnActionEdit::~ReturnActionEdit()
-{
-}
-
 void ReturnActionEdit::KeyInput( const KeyEvent& rEvt)
 {
     const KeyCode aKeyCode = rEvt.GetKeyCode();
diff --git a/sw/source/core/uibase/inc/actctrl.hxx b/sw/source/core/uibase/inc/actctrl.hxx
index d51ac3d..cc4508d 100644
--- a/sw/source/core/uibase/inc/actctrl.hxx
+++ b/sw/source/core/uibase/inc/actctrl.hxx
@@ -77,10 +77,10 @@ class SW_DLLPUBLIC ReturnActionEdit : public Edit
 {
     Link    aReturnActionLink;
 public:
-    ReturnActionEdit(Window* pParent, const ResId& rResId);
     ReturnActionEdit(Window* pParent, WinBits nStyle)
-        : Edit(pParent, nStyle){}
-    ~ReturnActionEdit();
+        : Edit(pParent, nStyle)
+    {
+    }
     virtual void KeyInput( const KeyEvent& ) SAL_OVERRIDE;
 
     void SetReturnActionLink(const Link& rLink)
diff --git a/unusedcode.easy b/unusedcode.easy
index de96f91..e60422b 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -180,6 +180,7 @@ basegfx::tools::containsOnlyHorizontalAndVerticalEdges(basegfx::B2DPolyPolygon c
 basegfx::tools::equal(basegfx::B2DPolygon const&, basegfx::B2DPolygon const&, double const&)
 basegfx::tools::equal(basegfx::B3DPolyPolygon const&, basegfx::B3DPolyPolygon const&)
 canvas::createSurfaceProxyManager(boost::shared_ptr<canvas::IRenderModule> const&)
+chart::GL3DBarChartDialogController::GL3DBarChartDialogController()
 comphelper::detail::ConfigurationWrapper::getGroupReadWrite(boost::shared_ptr<comphelper::ConfigurationChanges> const&, rtl::OUString const&) const
 comphelper::detail::ConfigurationWrapper::getLocalizedPropertyValue(rtl::OUString const&) const
 comphelper::detail::ConfigurationWrapper::setLocalizedPropertyValue(boost::shared_ptr<comphelper::ConfigurationChanges> const&, rtl::OUString const&, com::sun::star::uno::Any const&) const
commit 38e4ef50d43bdab45e7b43244b3fc6dde6f0e697
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 27 20:42:57 2014 +0000

    Related: fdo#73936 for spelling restrict formelements-as-fields..
    
    to dropdowns to be on the safe side for now anyway.
    
    Change-Id: I88a73fe37b39306c6b24226e3b02c702d992ecb0

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 3fd37b8..7ae711c 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -249,6 +249,7 @@ class IDocumentMarkAccess
         virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0;
         virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0;
 
+        virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition& pos) const=0;
         virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const=0;
 
         // Marks exclusive annotation marks
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index e3f3583..481490b 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1013,6 +1013,14 @@ namespace sw { namespace mark
         return dynamic_cast<IFieldmark*>(pFieldmark->get());
     }
 
+    IFieldmark* MarkManager::getDropDownFor(const SwPosition& rPos) const
+    {
+        IFieldmark *pMark = getFieldmarkFor(rPos);
+        if (!pMark || pMark->GetFieldname() != ODF_FORMDROPDOWN)
+            return NULL;
+        return pMark;
+    }
+
     std::vector<IFieldmark*> MarkManager::getDropDownsFor(const SwPaM &rPaM) const
     {
         std::vector<IFieldmark*> aRet;
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index ed7b067..bc3a0fa 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1661,7 +1661,7 @@ void    SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt,
                 else if (cChar == CH_TXT_ATR_FORMELEMENT)
                 {
                     SwPosition aPos(*pCrsr->GetMark());
-                    bField = pMySh->GetDoc()->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+                    bField = pMySh->GetDoc()->getIDocumentMarkAccess()->getDropDownFor(aPos);
                 }
 
                 LanguageType eCurLanguage = lcl_GetLanguage(*GetSh());
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 890fe7d..a5a6b6d 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -82,6 +82,7 @@ namespace sw {
             virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const SAL_OVERRIDE;
             virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const SAL_OVERRIDE;
 
+            virtual ::sw::mark::IFieldmark* getDropDownFor(const SwPosition &rPos) const;
             virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const;
 
             void dumpAsXml(xmlTextWriterPtr w);
commit 4e0118aba0d41008c1a31b1cdc7ce7596b894ae2
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 27 20:22:24 2014 +0000

    Related: fdo#73936 use ModelToViewHelper to expand SwTxtNodes
    
    ModelToViewHelper knows about formfield dropdown lists
    so their content gets expanded, which means that
    in the spelling dialog the dropdowns get shown and
    are detected as fields
    
    Change-Id: If23d44c6189a73d04205816a32e863161f7f38ef

diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 4812b4d..1f10456 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -3109,10 +3109,16 @@ OUString SwTxtNode::GetExpandTxt(  const sal_Int32 nIdx,
                                    const bool bWithFtn ) const
 
 {
-    OUStringBuffer aTxt(
-        (nLen == -1) ? GetTxt().copy(nIdx) : GetTxt().copy(nIdx, nLen));
-    sal_Int32 nTxtStt = nIdx;
-    Replace0xFF(*this, aTxt, nTxtStt, aTxt.getLength(), true, bWithFtn );
+    sal_uInt16 eMode = EXPANDFIELDS;
+    if (bWithFtn)
+        eMode |= EXPANDFOOTNOTE;
+
+    ModelToViewHelper aConversionMap(*this, eMode);
+    OUString aExpandText = aConversionMap.getViewText();
+    const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nIdx );
+    sal_Int32 nEnd = nLen == -1 ? GetTxt().getLength() : nIdx + nLen;
+    const sal_Int32 nExpandEnd = aConversionMap.ConvertToViewPosition( nEnd );
+    OUStringBuffer aTxt(aExpandText.copy(nExpandBegin, nExpandEnd-nExpandBegin));
 
     // remove dummy characters of Input Fields
     comphelper::string::remove(aTxt, CH_TXT_ATR_INPUTFIELDSTART);
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 7338995..8cb0435 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1983,15 +1983,15 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
     const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED);
     OUString aExpandText = aConversionMap.getViewText();
 
-    // map start and end points onto the ConversionMap
-    const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nStt );
-    const sal_Int32 nExpandEnd   = aConversionMap.ConvertToViewPosition( nEnd );
-
     if (aExpandText.isEmpty() && !bCountNumbering)
     {
         return false;
     }
 
+    // map start and end points onto the ConversionMap
+    const sal_Int32 nExpandBegin = aConversionMap.ConvertToViewPosition( nStt );
+    const sal_Int32 nExpandEnd   = aConversionMap.ConvertToViewPosition( nEnd );
+
     //do the count
     // all counts exclude hidden paras and hidden+redlined within para
     // definition of space/white chars in SwScanner (and BreakIter!)
commit 88005f6f2541e12325c3e00aa438317ed8ab06bd
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 27 16:59:17 2014 +0000

    Related: fdo#73936 allow ModelToViewHelper to not expand footnotes..
    
    but continue to expand fields. No change to anything yet, but
    should allow this to be reused in SwTxtNode::GetExpandText
    
    Change-Id: I4dbfc454d498fc85a918b0e43e68c219cbc37a21

diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx
index d67110a..82ec6da 100644
--- a/sw/inc/modeltoviewhelper.hxx
+++ b/sw/inc/modeltoviewhelper.hxx
@@ -61,10 +61,11 @@ class SwTxtNode;
     0111: expanding fields + hiding hiddens + hiding redlines gives: AAAABB foo CCCCC foo DDDDD
 */
 
-#define PASSTHROUGH   0x0000
-#define EXPANDFIELDS  0x0001
-#define HIDEINVISIBLE 0x0002
-#define HIDEREDLINED  0x0004
+#define PASSTHROUGH    0x0000
+#define EXPANDFIELDS   0x0001
+#define EXPANDFOOTNOTE 0x0002
+#define HIDEINVISIBLE  0x0004
+#define HIDEREDLINED   0x0008
 
 class ModelToViewHelper
 {
@@ -98,7 +99,7 @@ public:
         ModelPosition() : mnPos(0), mnSubPos(0), mbIsField(false) {}
     };
 
-    ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode = EXPANDFIELDS);
+    ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode = EXPANDFIELDS | EXPANDFOOTNOTE);
     ModelToViewHelper() //pass through filter, view == model
     {
     }
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index bdbeda3..b32e824 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -265,12 +265,18 @@ void SwDocTest::testModelToViewHelper()
         }
 
         {
-            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS);
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | EXPANDFOOTNOTE);
             OUString sViewText = aModelToViewHelper.getViewText();
             CPPUNIT_ASSERT(sViewText == "AAAAA BBBBB foo CCCCC foo DDDDD");
         }
 
         {
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS);
+            OUString sViewText = aModelToViewHelper.getViewText();
+            CPPUNIT_ASSERT(sViewText == "AAAAA BBBBB  CCCCC  DDDDD");
+        }
+
+        {
             ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEINVISIBLE);
             OUString sViewText = aModelToViewHelper.getViewText();
             CPPUNIT_ASSERT(sViewText == "AAAAA CCCCC " + OUString(CH_TXTATR_BREAKWORD) + " DDDDD");
@@ -283,13 +289,13 @@ void SwDocTest::testModelToViewHelper()
         }
 
         {
-            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE);
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | EXPANDFOOTNOTE);
             OUString sViewText = aModelToViewHelper.getViewText();
             CPPUNIT_ASSERT(sViewText == "AAAAA CCCCC foo DDDDD");
         }
 
         {
-            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEREDLINED);
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEREDLINED | EXPANDFOOTNOTE);
             OUString sViewText = aModelToViewHelper.getViewText();
             CPPUNIT_ASSERT(sViewText == "AAAABB foo CCCCC foo DDDDD");
         }
@@ -305,7 +311,7 @@ void SwDocTest::testModelToViewHelper()
         }
 
         {
-            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED);
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED | EXPANDFOOTNOTE);
             OUString sViewText = aModelToViewHelper.getViewText();
             CPPUNIT_ASSERT(sViewText == "AAAACCCCC foo DDDDD");
         }
@@ -325,7 +331,7 @@ void SwDocTest::testModelToViewHelper()
         CPPUNIT_ASSERT(pTxtNode->GetTxt().getLength() == 11);
 
         {
-            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS);
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | EXPANDFOOTNOTE);
             OUString sViewText = aModelToViewHelper.getViewText();
             fprintf(stderr, "string is %s\n", OUStringToOString(sViewText, RTL_TEXTENCODING_UTF8).getStr());
             CPPUNIT_ASSERT(sViewText == "AAAAABBBBBCCCCC");
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 0d77cb1..2a338ad 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -119,7 +119,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
     if (nTrailingShownLen)
         aBlocks.push_back(block(nShownStart, nTrailingShownLen, true));
 
-    if (eMode & EXPANDFIELDS)
+    if (eMode & EXPANDFIELDS || eMode & EXPANDFOOTNOTE)
     {
         //first the normal fields, get their position in the node and what the text they expand
         //to is
@@ -142,11 +142,15 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
                     {
                         case RES_TXTATR_FIELD:
                         case RES_TXTATR_ANNOTATION:
-                            aFieldResult.m_sExpand =
-                                static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()
-                                    ->ExpandField(true);
+                            if (eMode & EXPANDFIELDS)
+                            {
+                                aFieldResult.m_sExpand =
+                                    static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()
+                                        ->ExpandField(true);
+                            }
                             break;
                         case RES_TXTATR_FTN:
+                            if (eMode & EXPANDFOOTNOTE)
                             {
                                 const SwFmtFtn& rFtn = static_cast<SwTxtFtn const*>(pAttr)->GetFtn();
                                 const SwDoc *pDoc = rNode.GetDoc();
@@ -156,33 +160,35 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
                         default:
                             break;
                     }
-
                     aFind->m_aAttrs.insert(aFieldResult);
                 }
             }
         }
 
-        //now get the dropdown formfields, get their position in the node and what the text they expand
-        //to is
-        SwPaM aPaM(rNode, 0, rNode, rNode.Len());
-        std::vector<sw::mark::IFieldmark*> aDropDowns =
-            rNode.GetDoc()->getIDocumentMarkAccess()->getDropDownsFor(aPaM);
-
-        for (std::vector<sw::mark::IFieldmark*>::iterator aI = aDropDowns.begin(), aEnd = aDropDowns.end();
-            aI != aEnd; ++aI)
+        if (eMode & EXPANDFIELDS)
         {
-            sw::mark::IFieldmark *pMark = *aI;
-            const sal_Int32 nDummyCharPos = pMark->GetMarkPos().nContent.GetIndex()-1;
-            if (aHiddenMulti.IsSelected(nDummyCharPos))
-                continue;
-            std::vector<block>::iterator aFind = std::find_if(aBlocks.begin(), aBlocks.end(),
-                containsPos(nDummyCharPos));
-            if (aFind != aBlocks.end())
+            //now get the dropdown formfields, get their position in the node and what the text they expand
+            //to is
+            SwPaM aPaM(rNode, 0, rNode, rNode.Len());
+            std::vector<sw::mark::IFieldmark*> aDropDowns =
+                rNode.GetDoc()->getIDocumentMarkAccess()->getDropDownsFor(aPaM);
+
+            for (std::vector<sw::mark::IFieldmark*>::iterator aI = aDropDowns.begin(), aEnd = aDropDowns.end();
+                aI != aEnd; ++aI)
             {
-                FieldResult aFieldResult;
-                aFieldResult.m_nFieldPos = nDummyCharPos;
-                aFieldResult.m_sExpand = sw::mark::ExpandFieldmark(pMark);
-                aFind->m_aAttrs.insert(aFieldResult);
+                sw::mark::IFieldmark *pMark = *aI;
+                const sal_Int32 nDummyCharPos = pMark->GetMarkPos().nContent.GetIndex()-1;
+                if (aHiddenMulti.IsSelected(nDummyCharPos))
+                    continue;
+                std::vector<block>::iterator aFind = std::find_if(aBlocks.begin(), aBlocks.end(),
+                    containsPos(nDummyCharPos));
+                if (aFind != aBlocks.end())
+                {
+                    FieldResult aFieldResult;
+                    aFieldResult.m_nFieldPos = nDummyCharPos;
+                    aFieldResult.m_sExpand = sw::mark::ExpandFieldmark(pMark);
+                    aFind->m_aAttrs.insert(aFieldResult);
+                }
             }
         }
     }
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 8167639..7338995 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1980,7 +1980,7 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
     }
 
     // ConversionMap to expand fields, remove invisible and redline deleted text for scanner
-    const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED);
+    const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED);
     OUString aExpandText = aConversionMap.getViewText();
 
     // map start and end points onto the ConversionMap
commit d0c545bede035f3a4757ac433d919f65d1d06cf0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 27 10:54:53 2014 +0000

    Related: fdo#73936 expand FormFieldDropDowns in ModelToViewHelper
    
    when EXPANDFIELDS is set. i.e. for spell and grammar checking
    
    Change-Id: I8c524f0cd584c9d6043dece5c1b736afb254b7c0

diff --git a/sw/inc/IDocumentMarkAccess.hxx b/sw/inc/IDocumentMarkAccess.hxx
index 8d59cbf..3fd37b8 100644
--- a/sw/inc/IDocumentMarkAccess.hxx
+++ b/sw/inc/IDocumentMarkAccess.hxx
@@ -249,6 +249,8 @@ class IDocumentMarkAccess
         virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& pos) const =0;
         virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& pos) const =0;
 
+        virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const=0;
+
         // Marks exclusive annotation marks
         virtual const_iterator_t getCommonMarksBegin() const = 0;
         virtual const_iterator_t getCommonMarksEnd() const = 0;
diff --git a/sw/inc/IMark.hxx b/sw/inc/IMark.hxx
index d073085..ba2b0f4 100644
--- a/sw/inc/IMark.hxx
+++ b/sw/inc/IMark.hxx
@@ -156,6 +156,8 @@ namespace sw { namespace mark
 #endif
     };
 
+    OUString ExpandFieldmark(IFieldmark* pBM);
+
 }}
 #endif
 
diff --git a/sw/inc/pam.hxx b/sw/inc/pam.hxx
index c2a7f34..957f967 100644
--- a/sw/inc/pam.hxx
+++ b/sw/inc/pam.hxx
@@ -290,7 +290,7 @@ public:
        something protected. */
     bool HasReadonlySel( bool bFormView, bool bAnnotationMode = false ) const;
 
-    bool ContainsPosition(const SwPosition & rPos)
+    bool ContainsPosition(const SwPosition & rPos) const
     {
         return *Start() <= rPos && rPos <= *End();
     }
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 046158c..bdbeda3 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -242,6 +242,7 @@ void SwDocTest::testModelToViewHelper()
         //set character attribute hidden on range
         SvxCharHiddenItem aHidden(true, RES_CHRATR_HIDDEN);
         m_pDoc->InsertPoolItem(aPaM, aHidden, 0 );
+        aPaM.DeleteMark();
 
         //turn on red-lining and show changes
         m_pDoc->SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT);
@@ -254,6 +255,7 @@ void SwDocTest::testModelToViewHelper()
         //set end of selection to second last B
         aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 9);
         m_pDoc->DeleteAndJoin(aPaM);    //redline-aware deletion api
+        aPaM.DeleteMark();
 
         {
             ModelToViewHelper aModelToViewHelper(*pTxtNode, PASSTHROUGH);
@@ -307,6 +309,27 @@ void SwDocTest::testModelToViewHelper()
             OUString sViewText = aModelToViewHelper.getViewText();
             CPPUNIT_ASSERT(sViewText == "AAAACCCCC foo DDDDD");
         }
+
+        m_pDoc->AppendTxtNode(*aPaM.GetPoint());
+        m_pDoc->InsertString(aPaM, OUString("AAAAA"));
+        IDocumentMarkAccess* pMarksAccess = m_pDoc->getIDocumentMarkAccess();
+        sw::mark::IFieldmark *pFieldmark = dynamic_cast<sw::mark::IFieldmark*>(
+                pMarksAccess->makeNoTextFieldBookmark(aPaM, "test", ODF_FORMDROPDOWN));
+        CPPUNIT_ASSERT(pFieldmark);
+        uno::Sequence< OUString > vListEntries(1);
+        vListEntries[0] = "BBBBB";
+        (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_LISTENTRY] = uno::makeAny(vListEntries);
+        (*pFieldmark->GetParameters())[ODF_FORMDROPDOWN_RESULT] = uno::makeAny(sal_Int32(0));
+        m_pDoc->InsertString(aPaM, OUString("CCCCC"));
+        pTxtNode = aPaM.GetNode()->GetTxtNode();
+        CPPUNIT_ASSERT(pTxtNode->GetTxt().getLength() == 11);
+
+        {
+            ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS);
+            OUString sViewText = aModelToViewHelper.getViewText();
+            fprintf(stderr, "string is %s\n", OUStringToOString(sViewText, RTL_TEXTENCODING_UTF8).getStr());
+            CPPUNIT_ASSERT(sViewText == "AAAAABBBBBCCCCC");
+        }
     }
 }
 
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index d972236..e3f3583 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1013,6 +1013,28 @@ namespace sw { namespace mark
         return dynamic_cast<IFieldmark*>(pFieldmark->get());
     }
 
+    std::vector<IFieldmark*> MarkManager::getDropDownsFor(const SwPaM &rPaM) const
+    {
+        std::vector<IFieldmark*> aRet;
+
+        for (IDocumentMarkAccess::const_iterator_t aI = m_vFieldmarks.begin(),
+            aEnd = m_vFieldmarks.end(); aI != aEnd; ++aI)
+        {
+            boost::shared_ptr<IMark> xI = *aI;
+            const SwPosition &rStart = xI->GetMarkPos();
+            if (!rPaM.ContainsPosition(rStart))
+                continue;
+
+            IFieldmark *pMark = dynamic_cast<IFieldmark*>(xI.get());
+            if (!pMark || pMark->GetFieldname() != ODF_FORMDROPDOWN)
+                continue;
+
+            aRet.push_back(pMark);
+        }
+
+        return aRet;
+    }
+
     IFieldmark* MarkManager::getFieldmarkAfter(const SwPosition& rPos) const
         { return dynamic_cast<IFieldmark*>(lcl_getMarkAfter(m_vFieldmarks, rPos)); }
 
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index 0d9dc6f..890fe7d 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -82,6 +82,8 @@ namespace sw {
             virtual ::sw::mark::IFieldmark* getFieldmarkBefore(const SwPosition& rPos) const SAL_OVERRIDE;
             virtual ::sw::mark::IFieldmark* getFieldmarkAfter(const SwPosition& rPos) const SAL_OVERRIDE;
 
+            virtual std::vector< ::sw::mark::IFieldmark* > getDropDownsFor(const SwPaM &rPaM) const;
+
             void dumpAsXml(xmlTextWriterPtr w);
 
             // Marks exclusive annotation marks
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 5edca1d..7926e6d 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -873,9 +873,8 @@ void SwMetaPortion::Paint( const SwTxtPaintInfo &rInf ) const
     }
 }
 
-namespace {
-    using namespace sw::mark;
-    static OUString getCurrentListIndex(IFieldmark* pBM)
+namespace sw { namespace mark {
+    OUString ExpandFieldmark(IFieldmark* pBM)
     {
         const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters();
         sal_Int32 nCurrentIdx = 0;
@@ -893,7 +892,7 @@ namespace {
         }
         return OUString();
     }
-}
+} }
 
 /*************************************************************************
  *                      SwTxtFormatter::WhichTxtPor()
@@ -944,7 +943,7 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
                         }
                         else if (pBM->GetFieldname( ) == ODF_FORMDROPDOWN)
                         {
-                            pPor = new SwFieldFormDropDownPortion(getCurrentListIndex(pBM));
+                            pPor = new SwFieldFormDropDownPortion(sw::mark::ExpandFieldmark(pBM));
                         }
                         else
                         {
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index 85390d0..0d77cb1 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -17,25 +17,46 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <modeltoviewhelper.hxx>
+#include <tools/multisel.hxx>
+#include <doc.hxx>
+#include <IMark.hxx>
 #include <fldbas.hxx>
 #include <fmtfld.hxx>
 #include <fmtftn.hxx>
+#include <modeltoviewhelper.hxx>
 #include <ndtxt.hxx>
+#include <pam.hxx>
 #include <txatbase.hxx>
 #include <txtfld.hxx>
 #include <txtftn.hxx>
+#include <scriptinfo.hxx>
+#include <set>
+#include <vector>
 
-#include <tools/multisel.hxx>
+struct FieldResult
+{
+    sal_Int32 m_nFieldPos;
+    OUString m_sExpand;
+};
 
-#include <scriptinfo.hxx>
+class sortfieldresults :
+    public std::binary_function<const FieldResult&, const FieldResult&, bool>
+{
+public:
+    bool operator()(const FieldResult &rOne, const FieldResult &rTwo) const
+    {
+        return rOne.m_nFieldPos < rTwo.m_nFieldPos;
+    }
+};
+
+typedef std::set<FieldResult, sortfieldresults> FieldResultSet;
 
 struct block
 {
     sal_Int32 m_nStart;
     sal_Int32 m_nLen;
     bool m_bVisible;
-    std::vector<const SwTxtAttr*> m_aAttrs;
+    FieldResultSet m_aAttrs;
     block(sal_Int32 nStart, sal_Int32 nLen, bool bVisible)
         : m_nStart(nStart), m_nLen(nLen), m_bVisible(bVisible)
     {
@@ -100,6 +121,8 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
 
     if (eMode & EXPANDFIELDS)
     {
+        //first the normal fields, get their position in the node and what the text they expand
+        //to is
         const SwpHints* pSwpHints2 = rNode.GetpSwpHints();
         for ( sal_uInt16 i = 0; pSwpHints2 && i < pSwpHints2->Count(); ++i )
         {
@@ -109,13 +132,59 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
                 const sal_Int32 nDummyCharPos = *pAttr->GetStart();
                 if (aHiddenMulti.IsSelected(nDummyCharPos))
                     continue;
-                std::vector<block>::iterator aFind = std::find_if(aBlocks.begin(), aBlocks.end(), containsPos(nDummyCharPos));
+                std::vector<block>::iterator aFind = std::find_if(aBlocks.begin(),
+                    aBlocks.end(), containsPos(nDummyCharPos));
                 if (aFind != aBlocks.end())
                 {
-                    aFind->m_aAttrs.push_back(pAttr);
+                    FieldResult aFieldResult;
+                    aFieldResult.m_nFieldPos = nDummyCharPos;
+                    switch (pAttr->Which())
+                    {
+                        case RES_TXTATR_FIELD:
+                        case RES_TXTATR_ANNOTATION:
+                            aFieldResult.m_sExpand =
+                                static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()
+                                    ->ExpandField(true);
+                            break;
+                        case RES_TXTATR_FTN:
+                            {
+                                const SwFmtFtn& rFtn = static_cast<SwTxtFtn const*>(pAttr)->GetFtn();
+                                const SwDoc *pDoc = rNode.GetDoc();
+                                aFieldResult.m_sExpand = rFtn.GetViewNumStr(*pDoc);
+                            }
+                            break;
+                        default:
+                            break;
+                    }
+
+                    aFind->m_aAttrs.insert(aFieldResult);
                 }
             }
         }
+
+        //now get the dropdown formfields, get their position in the node and what the text they expand
+        //to is
+        SwPaM aPaM(rNode, 0, rNode, rNode.Len());
+        std::vector<sw::mark::IFieldmark*> aDropDowns =
+            rNode.GetDoc()->getIDocumentMarkAccess()->getDropDownsFor(aPaM);
+
+        for (std::vector<sw::mark::IFieldmark*>::iterator aI = aDropDowns.begin(), aEnd = aDropDowns.end();
+            aI != aEnd; ++aI)
+        {
+            sw::mark::IFieldmark *pMark = *aI;
+            const sal_Int32 nDummyCharPos = pMark->GetMarkPos().nContent.GetIndex()-1;
+            if (aHiddenMulti.IsSelected(nDummyCharPos))
+                continue;
+            std::vector<block>::iterator aFind = std::find_if(aBlocks.begin(), aBlocks.end(),
+                containsPos(nDummyCharPos));
+            if (aFind != aBlocks.end())
+            {
+                FieldResult aFieldResult;
+                aFieldResult.m_nFieldPos = nDummyCharPos;
+                aFieldResult.m_sExpand = sw::mark::ExpandFieldmark(pMark);
+                aFind->m_aAttrs.insert(aFieldResult);
+            }
+        }
     }
 
     sal_Int32 nOffset = 0;
@@ -132,32 +201,11 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
         }
         else
         {
-            for (std::vector<const SwTxtAttr*>::iterator j = i->m_aAttrs.begin(); j != i->m_aAttrs.end(); ++j)
+            for (FieldResultSet::iterator j = i->m_aAttrs.begin(); j != i->m_aAttrs.end(); ++j)
             {
-                const SwTxtAttr* pAttr = *j;
-                const sal_Int32 nFieldPos = *pAttr->GetStart();
-                OUString aExpand;
-                switch (pAttr->Which())
-                {
-                    case RES_TXTATR_FIELD:
-                    case RES_TXTATR_ANNOTATION:
-                        aExpand =
-                            static_cast<SwTxtFld const*>(pAttr)->GetFmtFld().GetField()
-                                ->ExpandField(true);
-                        break;
-                    case RES_TXTATR_FTN:
-                        {
-                            const SwFmtFtn& rFtn = static_cast<SwTxtFtn const*>(pAttr)->GetFtn();
-                            const SwDoc *pDoc = rNode.GetDoc();
-                            aExpand = rFtn.GetViewNumStr(*pDoc);
-                        }
-                        break;
-                    default:
-                        break;
-                }
-                m_aRetText = m_aRetText.replaceAt( nOffset + nFieldPos, 1, aExpand );
-                m_aMap.push_back( ConversionMapEntry( nFieldPos, nOffset + nFieldPos ) );
-                nOffset += aExpand.getLength() - 1;
+                m_aRetText = m_aRetText.replaceAt( nOffset + j->m_nFieldPos, 1, j->m_sExpand );
+                m_aMap.push_back( ConversionMapEntry( j->m_nFieldPos, nOffset + j->m_nFieldPos ) );
+                nOffset += j->m_sExpand.getLength() - 1;
             }
         }
     }
commit c76b8783e2ada67449fd88390c30943ca7f5a55e
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Mar 27 15:52:31 2014 +0000

    Related: fdo#73936 detect dropdown form fields as fields for spellchecking
    
    so they will appear grayed in the spell check preview (they don't appear
    at all yet, they will in later commits)
    
    Change-Id: Ic0c6fe2979c7c731d0efb85c747afca2268abc53

diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 41fcaa4..ed7b067 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1658,6 +1658,11 @@ void    SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > xAlt,
                             break;
                     }
                 }
+                else if (cChar == CH_TXT_ATR_FORMELEMENT)
+                {
+                    SwPosition aPos(*pCrsr->GetMark());
+                    bField = pMySh->GetDoc()->getIDocumentMarkAccess()->getFieldmarkFor(aPos);
+                }
 
                 LanguageType eCurLanguage = lcl_GetLanguage(*GetSh());
                 bool bRedline = aNextRedline.nLeft == pCrsr->GetPoint()->nContent.GetIndex();
commit a52ee51269a47e52d68405caf8507e1abaa6fd8f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Wed Mar 26 17:08:35 2014 +0000

    Resolves: fdo#73936 make FormFieldDropDowns a real fieldportion
    
    split the checkbox and list and use a field portion for the list.
    That way it knows how to line break correctly wrt hardspaces and doesn't hang
    when the situation arises.
    
    Change-Id: I46d73f19ef8e51e7c21c8783ce70bb80d98a784c

diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index ea96e08..85ea319 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1065,7 +1065,7 @@ void SwTxtPaintInfo::DrawPostIts( const SwLinePortion&, bool bScript ) const
     }
 }
 
-void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) const
+void SwTxtPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
 {
     SwRect aIntersect;
     CalcRect( rPor, &aIntersect, 0 );
@@ -1087,7 +1087,8 @@ void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked)
         m_pOut->SetLineColor( Color(0, 0, 0));
         m_pOut->SetFillColor();
         m_pOut->DrawRect( r );
-        if (checked) {
+        if (bChecked)
+        {
             m_pOut->DrawLine(r.TopLeft(), r.BottomRight());
             m_pOut->DrawLine(r.TopRight(), r.BottomLeft());
         }
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 5b133e8..24ce4cb 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -485,7 +485,7 @@ public:
     **/
     void DrawBorder( const SwLinePortion &rPor ) const;
 
-    void DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) const;
+    void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const;
 
     inline void NotifyURL( const SwLinePortion &rPor ) const
         { if( URLNotify() ) _NotifyURL( rPor ); }
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 1ba49c8..5edca1d 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -54,6 +54,7 @@
 #include <doc.hxx>
 #include <pormulti.hxx>
 #include <unotools/charclass.hxx>
+#include <xmloff/odffields.hxx>
 
 #include <vector>
 
@@ -872,10 +873,31 @@ void SwMetaPortion::Paint( const SwTxtPaintInfo &rInf ) const
     }
 }
 
+namespace {
+    using namespace sw::mark;
+    static OUString getCurrentListIndex(IFieldmark* pBM)
+    {
+        const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters();
+        sal_Int32 nCurrentIdx = 0;
+        const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(OUString(ODF_FORMDROPDOWN_RESULT));
+        if(pResult != pParameters->end())
+            pResult->second >>= nCurrentIdx;
+
+        const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(OUString(ODF_FORMDROPDOWN_LISTENTRY));
+        if (pListEntries != pParameters->end())
+        {
+            uno::Sequence< OUString > vListEntries;
+            pListEntries->second >>= vListEntries;
+            if (nCurrentIdx < vListEntries.getLength())
+                return vListEntries[nCurrentIdx];
+        }
+        return OUString();
+    }
+}
+
 /*************************************************************************
  *                      SwTxtFormatter::WhichTxtPor()
  *************************************************************************/
-
 SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
 {
     SwTxtPortion *pPor = 0;
@@ -907,7 +929,29 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const
                 else if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FIELDEND )
                     pPor = new SwFieldMarkPortion();
                 else if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FORMELEMENT )
-                    pPor = new SwFieldFormPortion();
+                {
+                    SwTxtNode *pNd = const_cast<SwTxtNode *>(rInf.GetTxtFrm()->GetTxtNode());
+                    const SwDoc *doc = pNd->GetDoc();
+                    SwIndex aIndex(pNd, rInf.GetIdx());
+                    SwPosition aPosition(*pNd, aIndex);
+                    sw::mark::IFieldmark *pBM = doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition);
+                    OSL_ENSURE(pBM != NULL, "Where is my form field bookmark???");
+                    if (pBM != NULL)
+                    {
+                        if (pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
+                        {
+                            pPor = new SwFieldFormCheckboxPortion();
+                        }
+                        else if (pBM->GetFieldname( ) == ODF_FORMDROPDOWN)
+                        {
+                            pPor = new SwFieldFormDropDownPortion(getCurrentListIndex(pBM));
+                        }
+                        else
+                        {
+                            assert( false );        // unknown type...
+                        }
+                    }
+                }
             }
             if( !pPor )
             {
@@ -1004,7 +1048,6 @@ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf )
 /*************************************************************************
  *                 SwTxtFormatter::WhichFirstPortion()
  *************************************************************************/
-
 SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf)
 {
     SwLinePortion *pPor = 0;
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 3a74264..61c5063 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -40,7 +40,6 @@
 #include <porftn.hxx>
 #include <accessibilityoptions.hxx>
 #include <editeng/lrspitem.hxx>
-
 #include <unicode/ubidi.h>
 
 using namespace ::com::sun::star;
@@ -1314,4 +1313,9 @@ KSHORT SwCombinedPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
     return SwFldPortion::GetViewWidth( rInf );
 }
 
+SwFldPortion *SwFieldFormDropDownPortion::Clone(const OUString &rExpand) const
+{
+    return new SwFieldFormDropDownPortion(rExpand);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx
index 3107a19..59ee2dc 100644
--- a/sw/source/core/text/porfld.hxx
+++ b/sw/source/core/text/porfld.hxx
@@ -247,6 +247,21 @@ public:
     OUTPUT_OPERATOR_OVERRIDE
 };
 
+namespace sw { namespace mark {
+    class IFieldmark;
+} }
+
+class SwFieldFormDropDownPortion : public SwFldPortion
+{
+public:
+    SwFieldFormDropDownPortion(const OUString &rExpand)
+        : SwFldPortion(rExpand)
+    {
+    }
+    // Field cloner for SplitGlue
+    virtual SwFldPortion *Clone( const OUString &rExpand ) const;
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 422d9d6..ebeef8e 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -900,32 +900,7 @@ bool SwFieldMarkPortion::Format( SwTxtFormatInfo & )
     return false;
 }
 
-namespace {
-    static sal_Int32 getCurrentListIndex( IFieldmark* pBM,
-            OUString* io_pCurrentText = NULL )
-    {
-        const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters();
-        sal_Int32 nCurrentIdx = 0;
-        const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(OUString(ODF_FORMDROPDOWN_RESULT));
-        if(pResult != pParameters->end())
-            pResult->second >>= nCurrentIdx;
-        if(io_pCurrentText)
-        {
-            const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(OUString(ODF_FORMDROPDOWN_LISTENTRY));
-            if(pListEntries != pParameters->end())
-            {
-                uno::Sequence< OUString > vListEntries;
-                pListEntries->second >>= vListEntries;
-                if(nCurrentIdx < vListEntries.getLength())
-                    *io_pCurrentText = vListEntries[nCurrentIdx];
-            }
-        }
-        return nCurrentIdx;
-    }
-}
-
-//FIXME Fieldbk
-void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const
+void SwFieldFormCheckboxPortion::Paint( const SwTxtPaintInfo& rInf ) const
 {
     SwTxtNode* pNd = const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode());
     const SwDoc *doc=pNd->GetDoc();
@@ -934,61 +909,30 @@ void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const
 
     IFieldmark* pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition );
 
-    OSL_ENSURE( pBM,
-        "SwFieldFormPortion::Paint(..)"
-        " - Where is my form field bookmark???");
+    OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX,
+        "Where is my form field bookmark???");
 
-    if ( pBM != NULL )
+    if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
     {
-        if ( pBM->GetFieldname( ) == ODF_FORMCHECKBOX )
-        { // a checkbox...
-            const ICheckboxFieldmark* pCheckboxFm = dynamic_cast< ICheckboxFieldmark* >(pBM);
-            bool checked = pCheckboxFm && pCheckboxFm->IsChecked();
-            rInf.DrawCheckBox(*this, checked);
-        }
-        else if ( pBM->GetFieldname( ) == ODF_FORMDROPDOWN )
-        { // a list...
-            OUString aTxt;
-            getCurrentListIndex( pBM, &aTxt );
-            rInf.DrawViewOpt( *this, POR_FLD );
-            rInf.DrawText( aTxt, *this, 0, aTxt.getLength(), false );
-        }
-        else
-        {
-            assert(false); // unknown type...
-        }
+        const ICheckboxFieldmark* pCheckboxFm = dynamic_cast< ICheckboxFieldmark* >(pBM);
+        bool bChecked = pCheckboxFm && pCheckboxFm->IsChecked();
+        rInf.DrawCheckBox(*this, bChecked);
     }
 }
 
-bool SwFieldFormPortion::Format( SwTxtFormatInfo & rInf )
+bool SwFieldFormCheckboxPortion::Format( SwTxtFormatInfo & rInf )
 {
     SwTxtNode *pNd = const_cast < SwTxtNode * >( rInf.GetTxtFrm(  )->GetTxtNode(  ) );
     const SwDoc *doc = pNd->GetDoc(  );
     SwIndex aIndex( pNd, rInf.GetIdx(  ) );
     SwPosition aPosition( *pNd, aIndex );
     IFieldmark *pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition );
-    OSL_ENSURE( pBM != NULL, "Where is my form field bookmark???" );
-    if ( pBM != NULL )
+    OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX, "Where is my form field bookmark???");
+    if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX)
     {
-        if ( pBM->GetFieldname( ) == ODF_FORMCHECKBOX )
-        {
-            Width( rInf.GetTxtHeight(  ) );
-            Height( rInf.GetTxtHeight(  ) );
-            SetAscent( rInf.GetAscent(  ) );
-        }
-        else if ( pBM->GetFieldname( ) == ODF_FORMDROPDOWN )
-        {
-            OUString aTxt;
-            getCurrentListIndex( pBM, &aTxt );
-            SwPosSize aPosSize = rInf.GetTxtSize( aTxt );
-            Width( aPosSize.Width(  ) );
-            Height( aPosSize.Height(  ) );
-            SetAscent( rInf.GetAscent(  ) );
-        }
-        else
-        {
-            assert( false );        // unknown type...
-        }
+        Width( rInf.GetTxtHeight(  ) );
+        Height( rInf.GetTxtHeight(  ) );
+        SetAscent( rInf.GetAscent(  ) );
     }
     return false;
 }
diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx
index 2a9b275..b84dd2a 100644
--- a/sw/source/core/text/portxt.hxx
+++ b/sw/source/core/text/portxt.hxx
@@ -107,11 +107,12 @@ class SwFieldMarkPortion : public SwTxtPortion
         virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
 };
 
-class SwFieldFormPortion : public SwTxtPortion
+class SwFieldFormCheckboxPortion : public SwTxtPortion
 {
-    public:
-        inline SwFieldFormPortion() : SwTxtPortion()
-            { }
+public:
+    SwFieldFormCheckboxPortion() : SwTxtPortion()
+    {
+    }
     virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
     virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
 };


More information about the Libreoffice-commits mailing list