[Libreoffice-commits] core.git: 2 commits - extras/source sc/inc sc/source sc/uiconfig sc/UIConfig_scalc.mk sw/source

Caolán McNamara caolanm at redhat.com
Fri Jan 17 02:16:26 PST 2014


 extras/source/glade/libreoffice-catalog.xml.in |    4 
 sc/UIConfig_scalc.mk                           |    1 
 sc/inc/helpids.h                               |    1 
 sc/inc/sc.hrc                                  |    1 
 sc/inc/scabstdlg.hxx                           |    2 
 sc/source/ui/attrdlg/scdlgfact.cxx             |   16 -
 sc/source/ui/attrdlg/scdlgfact.hxx             |    2 
 sc/source/ui/dbgui/pvfundlg.cxx                |  153 +++++-----
 sc/source/ui/dbgui/pvfundlg.src                |  137 ---------
 sc/source/ui/dbgui/pvlaydlg.cxx                |    2 
 sc/source/ui/inc/pvfundlg.hxx                  |   35 +-
 sc/uiconfig/scalc/ui/datafielddialog.ui        |  352 +++++++++++++++++++++++++
 sw/source/core/doc/docbm.cxx                   |   76 +++--
 sw/source/core/inc/MarkManager.hxx             |    1 
 14 files changed, 511 insertions(+), 272 deletions(-)

New commits:
commit b33c7476e6975ecd7cfb233a7a0e8b417870bea5
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri Jan 17 09:40:03 2014 +0000

    convert data field dialog to .ui
    
    Change-Id: I68da93c1227e8140511f3ad4071c87b3cf0443c0

diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in
index 6d7a6dc..56572f2 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -578,6 +578,10 @@
                         generic-name="CondFormatList" parent="GtkDrawingArea"
                         icon-name="widget-gtk-drawingarea"/>
 
+    <glade-widget-class title="ScDPFunctionListBox" name="scuilo-ScDPFunctionListBox"
+                        generic-name="DPFunctionListBox" parent="GtkTreeView"
+                        icon-name="widget-gtk-treeview"/>
+
     <glade-widget-class title="Recent Documents View" name="sfxlo-RecentDocsView"
                         generic-name="Icon View" parent="GtkIconView"
                         icon-name="widget-gtk-iconview"/>
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 9fb69cf..729ae69 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -73,6 +73,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
 	sc/uiconfig/scalc/ui/covariancedialog \
 	sc/uiconfig/scalc/ui/createnamesdialog \
 	sc/uiconfig/scalc/ui/databaroptions \
+	sc/uiconfig/scalc/ui/datafielddialog \
 	sc/uiconfig/scalc/ui/dataform \
 	sc/uiconfig/scalc/ui/datastreams \
 	sc/uiconfig/scalc/ui/definedatabaserangedialog \
diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h
index 67c6156..2e0cf5e 100644
--- a/sc/inc/helpids.h
+++ b/sc/inc/helpids.h
@@ -152,7 +152,6 @@
 
 #define HID_SC_DRAW_RENAME                                      "SC_HID_SC_DRAW_RENAME"
 
-#define HID_SC_DPDATAFIELD                                      "SC_HID_SC_DPDATAFIELD"
 #define HID_SC_DPSUBT_OPT                                       "SC_HID_SC_DPSUBT_OPT"
 #define HID_SC_DPSUBT_HIDE                                      "SC_HID_SC_DPSUBT_HIDE"
 #define HID_SC_DPNUMGROUP                                       "SC_HID_SC_DPNUMGROUP"
diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc
index e6a61f4..97630f8 100644
--- a/sc/inc/sc.hrc
+++ b/sc/inc/sc.hrc
@@ -1080,7 +1080,6 @@
 #define RID_SCDLG_DAPIDATA              (SC_DIALOGS_START + 131)
 
 
-#define RID_SCDLG_DPDATAFIELD           (SC_DIALOGS_START + 133)
 #define RID_SCDLG_DPSUBTOTAL_OPT        (SC_DIALOGS_START + 134)
 #define RID_SCDLG_DPNUMGROUP            (SC_DIALOGS_START + 135)
 #define RID_SCDLG_DPDATEGROUP           (SC_DIALOGS_START + 136)
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 52d52bc..9b63ee0 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -416,7 +416,7 @@ public:
     virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent,
                                                                 const SfxItemSet&   rArgSet, sal_uInt16 nSourceTab , int nId ) = 0;
 
-    virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId,
+    virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent,
                                                                 const ScDPLabelDataVector& rLabelVec,
                                                                 const ScDPLabelData& rLabelData,
                                                                 const ScPivotFuncData& rFuncData ) = 0;
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index cf1208e..01a2c54 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -881,24 +881,12 @@ AbstractScPivotFilterDlg * ScAbstractDialogFactory_Impl::CreateScPivotFilterDlg
 }
 
 AbstractScDPFunctionDlg * ScAbstractDialogFactory_Impl::CreateScDPFunctionDlg ( Window* pParent,
-                                                                int nId,
                                                                 const ScDPLabelDataVector& rLabelVec,
                                                                 const ScDPLabelData& rLabelData,
                                                                 const ScPivotFuncData& rFuncData )
 {
-    ScDPFunctionDlg * pDlg=NULL;
-    switch ( nId )
-    {
-        case RID_SCDLG_DPDATAFIELD :
-            pDlg = new ScDPFunctionDlg( pParent, rLabelVec, rLabelData, rFuncData );
-            break;
-        default:
-            break;
-    }
-
-    if ( pDlg )
-        return new AbstractScDPFunctionDlg_Impl( pDlg );
-    return 0;
+    ScDPFunctionDlg * pDlg = new ScDPFunctionDlg( pParent, rLabelVec, rLabelData, rFuncData );
+    return new AbstractScDPFunctionDlg_Impl( pDlg );
 }
 
 AbstractScDPSubtotalDlg * ScAbstractDialogFactory_Impl::CreateScDPSubtotalDlg ( Window* pParent,
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index 6043574..69443d0 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -485,7 +485,7 @@ public:
     virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent,
                                                                 const SfxItemSet&   rArgSet, sal_uInt16 nSourceTab , int nId );
 
-    virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId,
+    virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent,
                                                                 const ScDPLabelDataVector& rLabelVec,
                                                                 const ScDPLabelData& rLabelData,
                                                                 const ScPivotFuncData& rFuncData );
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 40e431e..6ca97fe 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -28,6 +28,7 @@
 #include <com/sun/star/sheet/DataPilotFieldShowItemsMode.hpp>
 
 #include <tools/resary.hxx>
+#include <vcl/builder.hxx>
 #include <vcl/msgbox.hxx>
 
 #include "scresid.hxx"
@@ -155,12 +156,27 @@ static const ScDPListBoxWrapper::MapEntryType spShowFromMap[] =
 
 // ============================================================================
 
-ScDPFunctionListBox::ScDPFunctionListBox( Window* pParent, const ResId& rResId ) :
-    MultiListBox( pParent, rResId )
+ScDPFunctionListBox::ScDPFunctionListBox(Window* pParent, WinBits nStyle)
+    : MultiListBox(pParent, nStyle)
 {
     FillFunctionNames();
 }
 
+ScDPFunctionListBox::ScDPFunctionListBox(Window* pParent, const ResId& rResId)
+    : MultiListBox(pParent, rResId)
+{
+    FillFunctionNames();
+}
+
+extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScDPFunctionListBox(Window *pParent, VclBuilder::stringmap &rMap)
+{
+    WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE;
+    OString sBorder = VclBuilder::extractCustomProperty(rMap);
+    if (!sBorder.isEmpty())
+        nWinStyle |= WB_BORDER;
+    return new ScDPFunctionListBox(pParent, nWinStyle);
+}
+
 void ScDPFunctionListBox::SetSelection( sal_uInt16 nFuncMask )
 {
     if( (nFuncMask == PIVOT_FUNC_NONE) || (nFuncMask == PIVOT_FUNC_AUTO) )
@@ -191,45 +207,41 @@ void ScDPFunctionListBox::FillFunctionNames()
 
 ScDPFunctionDlg::ScDPFunctionDlg(
         Window* pParent, const ScDPLabelDataVector& rLabelVec,
-        const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData ) :
-    ModalDialog     ( pParent, ScResId( RID_SCDLG_DPDATAFIELD ) ),
-    maFlFunc        ( this, ScResId( FL_FUNC ) ),
-    maLbFunc        ( this, ScResId( LB_FUNC ) ),
-    maFtNameLabel   ( this, ScResId( FT_NAMELABEL ) ),
-    maFtName        ( this, ScResId( FT_NAME ) ),
-    maFlDisplay     ( this, ScResId( FL_DISPLAY ) ),
-    maFtType        ( this, ScResId( FT_TYPE ) ),
-    maLbType        ( this, ScResId( LB_TYPE ) ),
-    maFtBaseField   ( this, ScResId( FT_BASEFIELD ) ),
-    maLbBaseField   ( this, ScResId( LB_BASEFIELD ) ),
-    maFtBaseItem    ( this, ScResId( FT_BASEITEM ) ),
-    maLbBaseItem    ( this, ScResId( LB_BASEITEM ) ),
-    maBtnOk         ( this, ScResId( BTN_OK ) ),
-    maBtnCancel     ( this, ScResId( BTN_CANCEL ) ),
-    maBtnHelp       ( this, ScResId( BTN_HELP ) ),
-    maBtnMore       ( this, ScResId( BTN_MORE ) ),
-    maLbTypeWrp     ( maLbType, spRefTypeMap ),
-    mrLabelVec      ( rLabelVec ),
-    mbEmptyItem     ( false )
-{
-    FreeResource();
+        const ScDPLabelData& rLabelData, const ScPivotFuncData& rFuncData)
+    : ModalDialog(pParent, "DataFieldDialog",
+        "modules/scalc/ui/datafielddialog.ui")
+    , mrLabelVec(rLabelVec)
+    , mbEmptyItem(false)
+{
+    get(mpFtName, "name");
+    get(mpLbType, "type");
+    mxLbTypeWrp.reset(new ScDPListBoxWrapper(*mpLbType, spRefTypeMap));
+    get(mpLbFunc, "functions");
+    mpLbFunc->set_height_request(mpLbFunc->GetTextHeight() * 8);
+    get(mpFtBaseField, "basefieldft");
+    get(mpLbBaseField, "basefield");
+    get(mpFtBaseItem, "baseitemft");
+    get(mpLbBaseItem, "baseitem");
+    get(mpBtnOk, "ok");
+
     Init( rLabelData, rFuncData );
-    maLbFunc.EnableMultiSelection(false);
+
+    mpLbFunc->EnableMultiSelection(false);
 }
 
 sal_uInt16 ScDPFunctionDlg::GetFuncMask() const
 {
-    return maLbFunc.GetSelection();
+    return mpLbFunc->GetSelection();
 }
 
 DataPilotFieldReference ScDPFunctionDlg::GetFieldRef() const
 {
     DataPilotFieldReference aRef;
 
-    aRef.ReferenceType = maLbTypeWrp.GetControlValue();
-    aRef.ReferenceField = GetBaseFieldName(maLbBaseField.GetSelectEntry());
+    aRef.ReferenceType = mxLbTypeWrp->GetControlValue();
+    aRef.ReferenceField = GetBaseFieldName(mpLbBaseField->GetSelectEntry());
 
-    sal_uInt16 nBaseItemPos = maLbBaseItem.GetSelectEntryPos();
+    sal_uInt16 nBaseItemPos = mpLbBaseItem->GetSelectEntryPos();
     switch( nBaseItemPos )
     {
         case SC_BASEITEM_PREV_POS:
@@ -242,7 +254,7 @@ DataPilotFieldReference ScDPFunctionDlg::GetFieldRef() const
         {
             aRef.ReferenceItemType = DataPilotFieldReferenceItemType::NAMED;
             if( !mbEmptyItem || (nBaseItemPos > SC_BASEITEM_USER_POS) )
-                aRef.ReferenceItemName = GetBaseItemName(maLbBaseItem.GetSelectEntry());
+                aRef.ReferenceItemName = GetBaseItemName(mpLbBaseItem->GetSelectEntry());
         }
     }
 
@@ -253,30 +265,21 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa
 {
     // list box
     sal_uInt16 nFuncMask = (rFuncData.mnFuncMask == PIVOT_FUNC_NONE) ? PIVOT_FUNC_SUM : rFuncData.mnFuncMask;
-    maLbFunc.SetSelection( nFuncMask );
+    mpLbFunc->SetSelection( nFuncMask );
 
     // field name
-    maFtName.SetText(rLabelData.getDisplayName());
-
-    // "More button" controls
-    maBtnMore.AddWindow( &maFlDisplay );
-    maBtnMore.AddWindow( &maFtType );
-    maBtnMore.AddWindow( &maLbType );
-    maBtnMore.AddWindow( &maFtBaseField );
-    maBtnMore.AddWindow( &maLbBaseField );
-    maBtnMore.AddWindow( &maFtBaseItem );
-    maBtnMore.AddWindow( &maLbBaseItem );
+    mpFtName->SetText(rLabelData.getDisplayName());
 
     // handlers
-    maLbFunc.SetDoubleClickHdl( LINK( this, ScDPFunctionDlg, DblClickHdl ) );
-    maLbType.SetSelectHdl( LINK( this, ScDPFunctionDlg, SelectHdl ) );
-    maLbBaseField.SetSelectHdl( LINK( this, ScDPFunctionDlg, SelectHdl ) );
+    mpLbFunc->SetDoubleClickHdl( LINK( this, ScDPFunctionDlg, DblClickHdl ) );
+    mpLbType->SetSelectHdl( LINK( this, ScDPFunctionDlg, SelectHdl ) );
+    mpLbBaseField->SetSelectHdl( LINK( this, ScDPFunctionDlg, SelectHdl ) );
 
     // base field list box
     OUString aSelectedEntry;
     for( ScDPLabelDataVector::const_iterator aIt = mrLabelVec.begin(), aEnd = mrLabelVec.end(); aIt != aEnd; ++aIt )
     {
-        maLbBaseField.InsertEntry(aIt->getDisplayName());
+        mpLbBaseField->InsertEntry(aIt->getDisplayName());
         maBaseFieldNameMap.insert(
             NameMapType::value_type(aIt->getDisplayName(), aIt->maName));
         if (aIt->maName == rFuncData.maFieldRef.ReferenceField)
@@ -284,41 +287,41 @@ void ScDPFunctionDlg::Init( const ScDPLabelData& rLabelData, const ScPivotFuncDa
     }
 
     // base item list box
-    maLbBaseItem.SetSeparatorPos( SC_BASEITEM_USER_POS - 1 );
+    mpLbBaseItem->SetSeparatorPos( SC_BASEITEM_USER_POS - 1 );
 
     // select field reference type
-    maLbTypeWrp.SetControlValue( rFuncData.maFieldRef.ReferenceType );
-    SelectHdl( &maLbType );         // enables base field/item list boxes
+    mxLbTypeWrp->SetControlValue( rFuncData.maFieldRef.ReferenceType );
+    SelectHdl( mpLbType );         // enables base field/item list boxes
 
     // select base field
-    maLbBaseField.SelectEntry(aSelectedEntry);
-    if( maLbBaseField.GetSelectEntryPos() >= maLbBaseField.GetEntryCount() )
-        maLbBaseField.SelectEntryPos( 0 );
-    SelectHdl( &maLbBaseField );    // fills base item list, selects base item
+    mpLbBaseField->SelectEntry(aSelectedEntry);
+    if( mpLbBaseField->GetSelectEntryPos() >= mpLbBaseField->GetEntryCount() )
+        mpLbBaseField->SelectEntryPos( 0 );
+    SelectHdl( mpLbBaseField );    // fills base item list, selects base item
 
     // select base item
     switch( rFuncData.maFieldRef.ReferenceItemType )
     {
         case DataPilotFieldReferenceItemType::PREVIOUS:
-            maLbBaseItem.SelectEntryPos( SC_BASEITEM_PREV_POS );
+            mpLbBaseItem->SelectEntryPos( SC_BASEITEM_PREV_POS );
         break;
         case DataPilotFieldReferenceItemType::NEXT:
-            maLbBaseItem.SelectEntryPos( SC_BASEITEM_NEXT_POS );
+            mpLbBaseItem->SelectEntryPos( SC_BASEITEM_NEXT_POS );
         break;
         default:
         {
             if( mbEmptyItem && rFuncData.maFieldRef.ReferenceItemName.isEmpty() )
             {
                 // select special "(empty)" entry added before other items
-                maLbBaseItem.SelectEntryPos( SC_BASEITEM_USER_POS );
+                mpLbBaseItem->SelectEntryPos( SC_BASEITEM_USER_POS );
             }
             else
             {
                 sal_uInt16 nStartPos = mbEmptyItem ? (SC_BASEITEM_USER_POS + 1) : SC_BASEITEM_USER_POS;
                 sal_uInt16 nPos = FindBaseItemPos( rFuncData.maFieldRef.ReferenceItemName, nStartPos );
-                if( nPos >= maLbBaseItem.GetEntryCount() )
-                    nPos = (maLbBaseItem.GetEntryCount() > SC_BASEITEM_USER_POS) ? SC_BASEITEM_USER_POS : SC_BASEITEM_PREV_POS;
-                maLbBaseItem.SelectEntryPos( nPos );
+                if( nPos >= mpLbBaseItem->GetEntryCount() )
+                    nPos = (mpLbBaseItem->GetEntryCount() > SC_BASEITEM_USER_POS) ? SC_BASEITEM_USER_POS : SC_BASEITEM_PREV_POS;
+                mpLbBaseItem->SelectEntryPos( nPos );
             }
         }
     }
@@ -340,10 +343,10 @@ sal_uInt16 ScDPFunctionDlg::FindBaseItemPos( const OUString& rEntry, sal_uInt16
 {
     sal_uInt16 nPos = nStartPos;
     bool bFound = false;
-    while (nPos < maLbBaseItem.GetEntryCount())
+    while (nPos < mpLbBaseItem->GetEntryCount())
     {
         // translate the displayed field name back to its original field name.
-        const OUString& rName = GetBaseItemName(maLbBaseItem.GetEntry(nPos));
+        const OUString& rName = GetBaseItemName(mpLbBaseItem->GetEntry(nPos));
         if (rName.equals(rEntry))
         {
             bFound = true;
@@ -356,10 +359,10 @@ sal_uInt16 ScDPFunctionDlg::FindBaseItemPos( const OUString& rEntry, sal_uInt16
 
 IMPL_LINK( ScDPFunctionDlg, SelectHdl, ListBox*, pLBox )
 {
-    if( pLBox == &maLbType )
+    if( pLBox == mpLbType )
     {
         bool bEnableField, bEnableItem;
-        switch( maLbTypeWrp.GetControlValue() )
+        switch( mxLbTypeWrp->GetControlValue() )
         {
             case DataPilotFieldReferenceType::ITEM_DIFFERENCE:
             case DataPilotFieldReferenceType::ITEM_PERCENTAGE:
@@ -376,27 +379,27 @@ IMPL_LINK( ScDPFunctionDlg, SelectHdl, ListBox*, pLBox )
                 bEnableField = bEnableItem = false;
         }
 
-        bEnableField &= maLbBaseField.GetEntryCount() > 0;
-        maFtBaseField.Enable( bEnableField );
-        maLbBaseField.Enable( bEnableField );
+        bEnableField &= mpLbBaseField->GetEntryCount() > 0;
+        mpFtBaseField->Enable( bEnableField );
+        mpLbBaseField->Enable( bEnableField );
 
         bEnableItem &= bEnableField;
-        maFtBaseItem.Enable( bEnableItem );
-        maLbBaseItem.Enable( bEnableItem );
+        mpFtBaseItem->Enable( bEnableItem );
+        mpLbBaseItem->Enable( bEnableItem );
     }
-    else if( pLBox == &maLbBaseField )
+    else if( pLBox == mpLbBaseField )
     {
         // keep "previous" and "next" entries
-        while( maLbBaseItem.GetEntryCount() > SC_BASEITEM_USER_POS )
-            maLbBaseItem.RemoveEntry( SC_BASEITEM_USER_POS );
+        while( mpLbBaseItem->GetEntryCount() > SC_BASEITEM_USER_POS )
+            mpLbBaseItem->RemoveEntry( SC_BASEITEM_USER_POS );
 
         // update item list for current base field
         mbEmptyItem = false;
-        size_t nBasePos = maLbBaseField.GetSelectEntryPos();
+        size_t nBasePos = mpLbBaseField->GetSelectEntryPos();
         if( nBasePos < mrLabelVec.size() )
         {
             const vector<ScDPLabelData::Member>& rMembers = mrLabelVec[nBasePos].maMembers;
-            mbEmptyItem = lclFillListBox( maLbBaseItem, rMembers, SC_BASEITEM_USER_POS );
+            mbEmptyItem = lclFillListBox(*mpLbBaseItem, rMembers, SC_BASEITEM_USER_POS);
             // build cache for base names.
             NameMapType aMap;
             vector<ScDPLabelData::Member>::const_iterator itr = rMembers.begin(), itrEnd = rMembers.end();
@@ -406,15 +409,15 @@ IMPL_LINK( ScDPFunctionDlg, SelectHdl, ListBox*, pLBox )
         }
 
         // select base item
-        sal_uInt16 nItemPos = (maLbBaseItem.GetEntryCount() > SC_BASEITEM_USER_POS) ? SC_BASEITEM_USER_POS : SC_BASEITEM_PREV_POS;
-        maLbBaseItem.SelectEntryPos( nItemPos );
+        sal_uInt16 nItemPos = (mpLbBaseItem->GetEntryCount() > SC_BASEITEM_USER_POS) ? SC_BASEITEM_USER_POS : SC_BASEITEM_PREV_POS;
+        mpLbBaseItem->SelectEntryPos( nItemPos );
     }
     return 0;
 }
 
 IMPL_LINK_NOARG(ScDPFunctionDlg, DblClickHdl)
 {
-    maBtnOk.Click();
+    mpBtnOk->Click();
     return 0;
 }
 
diff --git a/sc/source/ui/dbgui/pvfundlg.src b/sc/source/ui/dbgui/pvfundlg.src
index 7af9bc8..a826665 100644
--- a/sc/source/ui/dbgui/pvfundlg.src
+++ b/sc/source/ui/dbgui/pvfundlg.src
@@ -39,143 +39,6 @@ StringArray SCSTR_DPFUNCLISTBOX
 
 // ----------------------------------------------------------------------------
 
-ModalDialog RID_SCDLG_DPDATAFIELD
-{
-    OutputSize = TRUE ;
-    HelpId = HID_SC_DPDATAFIELD ;
-    SVLook = TRUE ;
-    Size = MAP_APPFONT ( 220 , 99 ) ;
-    Moveable = TRUE ;
-    Closeable = FALSE ;
-    Hide = TRUE ;
-    FixedLine FL_FUNC
-    {
-        Pos = MAP_APPFONT ( 6 , 3 ) ;
-        Size = MAP_APPFONT ( 152 , 8 ) ;
-        Text [ en-US ] = "~Function" ;
-    };
-    MultiListBox LB_FUNC
-    {
-        HelpID = "sc:MultiListBox:RID_SCDLG_DPDATAFIELD:LB_FUNC";
-        Border = TRUE ;
-        Pos = MAP_APPFONT ( 12 , 14 ) ;
-        Size = MAP_APPFONT ( 140 , 65 ) ;
-        TabStop = TRUE ;
-        AutoHScroll = TRUE ;
-        SimpleMode = TRUE ;
-    };
-    FixedText FT_NAMELABEL
-    {
-        Pos = MAP_APPFONT ( 6 , 85 ) ;
-        Size = MAP_APPFONT ( 25 , 8 ) ;
-        Text [ en-US ] = "Name:" ;
-    };
-    FixedText FT_NAME
-    {
-        Pos = MAP_APPFONT ( 32 , 85 ) ;
-        Size = MAP_APPFONT ( 126 , 8 ) ;
-    };
-    FixedLine FL_DISPLAY
-    {
-        Pos = MAP_APPFONT( 6, 99 );
-        Size = MAP_APPFONT( 152, 8 );
-        Text [ en-US ] = "Displayed value";
-    };
-    FixedText FT_TYPE
-    {
-        Pos = MAP_APPFONT( 12, 112 );
-        Size = MAP_APPFONT( 60, 8 );
-        Text [ en-US ] = "~Type";
-    };
-    ListBox LB_TYPE
-    {
-        HelpID = "sc:ListBox:RID_SCDLG_DPDATAFIELD:LB_TYPE";
-        Pos = MAP_APPFONT( 75, 110 );
-        Size = MAP_APPFONT( 77, 120 );
-        TabStop = TRUE;
-        Border = TRUE;
-        DropDown = TRUE;
-        StringList [ en-US ] =
-        {
-            < "Normal"; Default; >;
-            < "Difference from"; Default; >;
-            < "% of"; Default; >;
-            < "% difference from"; Default; >;
-            < "Running total in"; Default; >;
-            < "% of row"; Default; >;
-            < "% of column"; Default; >;
-            < "% of total"; Default; >;
-            < "Index"; Default; >;
-        };
-    };
-    FixedText FT_BASEFIELD
-    {
-        Pos = MAP_APPFONT( 12, 128 );
-        Size = MAP_APPFONT( 60, 8 );
-        Text [ en-US ] = "~Base field";
-    };
-    ListBox LB_BASEFIELD
-    {
-        HelpID = "sc:ListBox:RID_SCDLG_DPDATAFIELD:LB_BASEFIELD";
-        Pos = MAP_APPFONT( 75, 126 );
-        Size = MAP_APPFONT( 77, 120 );
-        TabStop = TRUE;
-        Border = TRUE;
-        DropDown = TRUE;
-    };
-    FixedText FT_BASEITEM
-    {
-        Pos = MAP_APPFONT( 12, 144 );
-        Size = MAP_APPFONT( 60, 8 );
-        Text [ en-US ] = "Ba~se item";
-    };
-    ListBox LB_BASEITEM
-    {
-        HelpID = "sc:ListBox:RID_SCDLG_DPDATAFIELD:LB_BASEITEM";
-        Pos = MAP_APPFONT( 75, 142 );
-        Size = MAP_APPFONT( 77, 120 );
-        TabStop = TRUE;
-        Border = TRUE;
-        DropDown = TRUE;
-        StringList [ en-US ] =
-        {
-            < "- previous item -"; Default; >;
-            < "- next item -"; Default; >;
-        };
-    };
-    OKButton BTN_OK
-    {
-        Pos = MAP_APPFONT ( 164 , 6 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        DefButton = TRUE ;
-    };
-    CancelButton BTN_CANCEL
-    {
-        Pos = MAP_APPFONT ( 164 , 23 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    HelpButton BTN_HELP
-    {
-        Pos = MAP_APPFONT ( 164 , 43 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-    };
-    MoreButton BTN_MORE
-    {
-        HelpID = "sc:MoreButton:RID_SCDLG_DPDATAFIELD:BTN_MORE";
-        Pos = MAP_APPFONT ( 164 , 79 ) ;
-        Size = MAP_APPFONT ( 50 , 14 ) ;
-        TabStop = TRUE ;
-        MapUnit = MAP_APPFONT ;
-        Delta = 61 ;
-    };
-    Text [ en-US ] = "Data Field" ;
-};
-
-// ----------------------------------------------------------------------------
-
 ModalDialog RID_SCDLG_PIVOTSUBT
 {
     OutputSize = TRUE ;
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index e4a9beb..ec09af1 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -806,7 +806,7 @@ void ScPivotLayoutDlg::NotifyDoubleClick( ScPivotFieldType eType, size_t nFieldI
             ScPivotFuncData& rFuncData = maWndData.GetFuncData(nFieldIndex);
             boost::scoped_ptr<AbstractScDPFunctionDlg> pDlg(
                 pFact->CreateScDPFunctionDlg(
-                    this, RID_SCDLG_DPDATAFIELD, maLabelData, *pData, rFuncData));
+                    this, maLabelData, *pData, rFuncData));
 
             if ( pDlg->Execute() == RET_OK )
             {
diff --git a/sc/source/ui/inc/pvfundlg.hxx b/sc/source/ui/inc/pvfundlg.hxx
index a89ab38..e30798f 100644
--- a/sc/source/ui/inc/pvfundlg.hxx
+++ b/sc/source/ui/inc/pvfundlg.hxx
@@ -34,6 +34,7 @@
 #include <sfx2/itemconnect.hxx>
 #include "pivot.hxx"
 
+#include <boost/scoped_ptr.hpp>
 #include <boost/unordered_map.hpp>
 
 // ============================================================================
@@ -47,7 +48,8 @@ class ScDPObject;
 class ScDPFunctionListBox : public MultiListBox
 {
 public:
-    explicit            ScDPFunctionListBox( Window* pParent, const ResId& rResId );
+    ScDPFunctionListBox(Window* pParent, WinBits nStyle);
+    ScDPFunctionListBox(Window* pParent, const ResId& rResId);
 
     void                SetSelection( sal_uInt16 nFuncMask );
     sal_uInt16          GetSelection() const;
@@ -81,29 +83,22 @@ private:
     DECL_LINK( DblClickHdl, void* );
 
 private:
-    FixedLine           maFlFunc;
-    ScDPFunctionListBox maLbFunc;
-    FixedText           maFtNameLabel;
-    FixedInfo           maFtName;
-    FixedLine           maFlDisplay;
-    FixedText           maFtType;
-    ListBox             maLbType;
-    FixedText           maFtBaseField;
-    ListBox             maLbBaseField;
-    FixedText           maFtBaseItem;
-    ListBox             maLbBaseItem;
-    OKButton            maBtnOk;
-    CancelButton        maBtnCancel;
-    HelpButton          maBtnHelp;
-    MoreButton          maBtnMore;
+    ScDPFunctionListBox* mpLbFunc;
+    FixedText*           mpFtName;
+    ListBox*             mpLbType;
+    FixedText*           mpFtBaseField;
+    ListBox*             mpLbBaseField;
+    FixedText*           mpFtBaseItem;
+    ListBox*             mpLbBaseItem;
+    OKButton*            mpBtnOk;
 
-    NameMapType         maBaseFieldNameMap; // cache for base field display -> original name.
-    NameMapType         maBaseItemNameMap;  // cache for base item display -> original name.
+    NameMapType          maBaseFieldNameMap; // cache for base field display -> original name.
+    NameMapType          maBaseItemNameMap;  // cache for base item display -> original name.
 
-    ScDPListBoxWrapper  maLbTypeWrp;        /// Wrapper for direct usage of API constants.
+    boost::scoped_ptr<ScDPListBoxWrapper>  mxLbTypeWrp;        /// Wrapper for direct usage of API constants.
 
     const ScDPLabelDataVector& mrLabelVec;  /// Data of all labels.
-    bool                mbEmptyItem;        /// true = Empty base item in listbox.
+    bool                 mbEmptyItem;        /// true = Empty base item in listbox.
 };
 
 // ============================================================================
diff --git a/sc/uiconfig/scalc/ui/datafielddialog.ui b/sc/uiconfig/scalc/ui/datafielddialog.ui
new file mode 100644
index 0000000..da0decc
--- /dev/null
+++ b/sc/uiconfig/scalc/ui/datafielddialog.ui
@@ -0,0 +1,352 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 on Fri Jan 17 09:55:40 2014 -->
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <!-- interface-requires LibreOffice 1.0 -->
+  <object class="GtkDialog" id="DataFieldDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="title" translatable="yes">Data Field</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">12</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="ok">
+                <property name="label">gtk-ok</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="cancel">
+                <property name="label">gtk-cancel</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="help">
+                <property name="label">gtk-help</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="row_spacing">12</property>
+            <child>
+              <object class="GtkFrame" id="frame1">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="label_xalign">0</property>
+                <property name="shadow_type">none</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkGrid" id="grid2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="row_spacing">6</property>
+                        <child>
+                          <object class="scuilo-ScDPFunctionListBox" id="functions:border">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="hexpand">True</property>
+                            <property name="vexpand">True</property>
+                            <child internal-child="selection">
+                              <object class="GtkTreeSelection" id="treeview-selection1"/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Function</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="checkbutton1">
+                <property name="label" translatable="yes">Show it_ems without data</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_underline">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="column_spacing">12</property>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Name:</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="name">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="xalign">0</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkExpander" id="expander">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="resize_toplevel">True</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="margin_top">6</property>
+                    <property name="hexpand">True</property>
+                    <property name="top_padding">6</property>
+                    <property name="left_padding">12</property>
+                    <child>
+                      <object class="GtkGrid" id="grid4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="row_spacing">6</property>
+                        <property name="column_spacing">12</property>
+                        <child>
+                          <object class="GtkLabel" id="label4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Type</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">type</property>
+                            <property name="ellipsize">end</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="basefieldft">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">_Base field</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">basefield</property>
+                            <property name="ellipsize">end</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">1</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="baseitemft">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Ba_se item</property>
+                            <property name="use_underline">True</property>
+                            <property name="mnemonic_widget">baseitem</property>
+                            <property name="ellipsize">end</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBoxText" id="type">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <items>
+                              <item translatable="yes">Normal</item>
+                              <item translatable="yes">Difference from</item>
+                              <item translatable="yes">% of</item>
+                              <item translatable="yes">% difference from</item>
+                              <item translatable="yes">Running total in</item>
+                              <item translatable="yes">% of row</item>
+                              <item translatable="yes">% of column</item>
+                              <item translatable="yes">% of total</item>
+                              <item translatable="yes">Index</item>
+                            </items>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBoxText" id="basefield">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">1</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <object class="GtkComboBoxText" id="baseitem">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <items>
+                              <item translatable="yes">- previous item -</item>
+                              <item translatable="yes">- next item -</item>
+                            </items>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">2</property>
+                            <property name="width">1</property>
+                            <property name="height">1</property>
+                          </packing>
+                        </child>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">Displayed value</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">ok</action-widget>
+      <action-widget response="0">cancel</action-widget>
+    </action-widgets>
+  </object>
+</interface>
commit 59fd33c1f0495231e741437d6e9702b7687fc766
Author: Oliver-Rainer Wittmann <orw at apache.org>
Date:   Fri Jan 17 07:28:17 2014 +0000

    Resolves: #i123480# assure sorting of subset mark containers...
    
    before the intrinsic deletion of marks
    
    (cherry picked from commit 93ab293354bb322a7d57b7eaf21bcd2479453e87)
    
    Conflicts:
    	sw/source/core/doc/docbm.cxx
    
    Change-Id: I24e3b935df402f42dde135c7feda3b6e664370de

diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index 97b3298..e7d5cdc 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -97,7 +97,9 @@ namespace
     }
 
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    static inline ::std::auto_ptr<SwPosition> lcl_PositionFromCntntNode(SwCntntNode * const pCntntNode, const bool bAtEnd=false)
+    static inline ::std::auto_ptr<SwPosition> lcl_PositionFromCntntNode(
+        SwCntntNode * const pCntntNode,
+        const bool bAtEnd=false)
     {
         ::std::auto_ptr<SwPosition> pResult(new SwPosition(*pCntntNode));
         pResult->nContent.Assign(pCntntNode, bAtEnd ? pCntntNode->Len() : 0);
@@ -110,20 +112,30 @@ namespace
     // else set it to the end of the node before rStt
     // else set it to the CntntNode of the Pos outside the Range
     SAL_WNODEPRECATED_DECLARATIONS_PUSH
-    static inline ::std::auto_ptr<SwPosition> lcl_FindExpelPosition(const SwNodeIndex& rStt,
+    static inline ::std::auto_ptr<SwPosition> lcl_FindExpelPosition(
+        const SwNodeIndex& rStt,
         const SwNodeIndex& rEnd,
         const SwPosition& rOtherPosition)
     {
         SwCntntNode * pNode = rEnd.GetNode().GetCntntNode();
-        SwNodeIndex aStt = SwNodeIndex(rStt);
-        SwNodeIndex aEnd = SwNodeIndex(rEnd);
-        bool bAtEnd = false;
-        if(!pNode)
-            pNode = rEnd.GetNodes().GoNext(&aEnd), bAtEnd = false;
-        if(!pNode)
-            pNode = rStt.GetNodes().GoPrevious(&aStt), bAtEnd = true;
-        if(pNode)
-            return lcl_PositionFromCntntNode(pNode, bAtEnd);
+        bool bPosAtEndOfNode = false;
+        if ( pNode == NULL)
+        {
+            SwNodeIndex aEnd = SwNodeIndex(rEnd);
+            pNode = rEnd.GetNodes().GoNext( &aEnd );
+            bPosAtEndOfNode = false;
+        }
+        if ( pNode == NULL )
+        {
+            SwNodeIndex aStt = SwNodeIndex(rStt);
+            pNode = rStt.GetNodes().GoPrevious(&aStt);
+            bPosAtEndOfNode = true;
+        }
+        if ( pNode != NULL )
+        {
+            return lcl_PositionFromCntntNode( pNode, bPosAtEndOfNode );
+        }
+
         return ::std::auto_ptr<SwPosition>(new SwPosition(rOtherPosition));
     }
     SAL_WNODEPRECATED_DECLARATIONS_POP
@@ -635,6 +647,9 @@ namespace sw { namespace mark
         ::std::vector<const_iterator_t> vMarksToDelete;
         bool bIsSortingNeeded = false;
 
+        // boolean indicating, if at least one mark has been moved while colleting marks for deletion
+        bool bMarksMoved = false;
+
         // copy all bookmarks in the move area to a vector storing all position data as offset
         // reassignment is performed after the move
         for(iterator_t ppMark = m_vAllMarks.begin();
@@ -718,7 +733,8 @@ namespace sw { namespace mark
                     }
                     else
                     {
-                        pNewPos = lcl_FindExpelPosition( rStt, rEnd, bIsPosInRange ? pMark->GetOtherMarkPos() : pMark->GetMarkPos() );
+                        pNewPos =
+                            lcl_FindExpelPosition( rStt, rEnd, bIsPosInRange ? pMark->GetOtherMarkPos() : pMark->GetMarkPos() );
                     }
                 }
 
@@ -747,6 +763,7 @@ namespace sw { namespace mark
                         pMark->SetMarkPos(*pNewPos);
                     else
                         pMark->SetOtherMarkPos(*pNewPos);
+                    bMarksMoved = true;
 
                     // illegal selection? collapse the mark and restore sorting later
                     bIsSortingNeeded |= lcl_FixCorrectedMark( bIsPosInRange, bIsOtherPosInRange, pMark );
@@ -760,20 +777,32 @@ namespace sw { namespace mark
             // which would invalidate the iterators in vMarksToDelete
             std::vector< ::boost::shared_ptr<ILazyDeleter> > vDelay;
             vDelay.reserve(vMarksToDelete.size());
-            // we just remembered the iterators to delete, so we do not need to
-            // search for the boost::shared_ptr<> (the entry in m_vAllMarks) again.
+
+            // If needed, sort mark containers containing subsets of the marks
+            // in order to assure sorting.  The sorting is critical for the
+            // deletion of a mark as it is searched in these container for
+            // deletion.
+            if ( vMarksToDelete.size() > 0 && bMarksMoved )
+            {
+                sortSubsetMarks();
+            }
+            // we just remembered the iterators to delete, so we do not need to search
+            // for the shared_ptr<> (the entry in m_vAllMarks) again
             // reverse iteration, since erasing an entry invalidates iterators
             // behind it (the iterators in vMarksToDelete are sorted)
-            for (std::vector<const_iterator_t>::reverse_iterator pppMark
-                    = vMarksToDelete.rbegin();
-                pppMark != vMarksToDelete.rend();
-                ++pppMark)
+            for ( ::std::vector< const_iterator_t >::reverse_iterator pppMark = vMarksToDelete.rbegin();
+                  pppMark != vMarksToDelete.rend();
+                  ++pppMark )
             {
                 vDelay.push_back(deleteMark(*pppMark));
             }
         } // scope to kill vDelay
-        if(bIsSortingNeeded)
+
+        if ( bIsSortingNeeded )
+        {
             sortMarks();
+        }
+
 #if 0
         OSL_TRACE("deleteMarks");
         lcl_DebugMarks(m_vAllMarks);
@@ -1030,15 +1059,20 @@ namespace sw { namespace mark
         return sTmp;
     }
 
-    void MarkManager::sortMarks()
+    void MarkManager::sortSubsetMarks()
     {
-        sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vCommonMarks.begin(), m_vCommonMarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vBookmarks.begin(), m_vBookmarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vFieldmarks.begin(), m_vFieldmarks.end(), &lcl_MarkOrderingByStart);
         sort(m_vAnnotationMarks.begin(), m_vAnnotationMarks.end(), &lcl_MarkOrderingByStart);
     }
 
+    void MarkManager::sortMarks()
+    {
+        sort(m_vAllMarks.begin(), m_vAllMarks.end(), &lcl_MarkOrderingByStart);
+        sortSubsetMarks();
+    }
+
 #if OSL_DEBUG_LEVEL > 1
     void MarkManager::dumpFieldmarks( ) const
     {
diff --git a/sw/source/core/inc/MarkManager.hxx b/sw/source/core/inc/MarkManager.hxx
index fc4ee3e..f086908 100644
--- a/sw/source/core/inc/MarkManager.hxx
+++ b/sw/source/core/inc/MarkManager.hxx
@@ -100,6 +100,7 @@ namespace sw {
             // make names
             OUString getUniqueMarkName(const OUString& rName) const;
             void sortMarks();
+            void sortSubsetMarks();
 
             // container for all marks
             container_t m_vAllMarks;


More information about the Libreoffice-commits mailing list