[Libreoffice-commits] core.git: 10 commits - extensions/source include/svx lotuswordpro/source sc/source sfx2/source svx/source sw/source

Caolán McNamara caolanm at redhat.com
Tue Jun 17 06:00:16 PDT 2014


 extensions/source/propctrlr/browserlistbox.cxx |    2 
 extensions/source/propctrlr/browserlistbox.hxx |    2 
 include/svx/fillctrl.hxx                       |   64 -
 lotuswordpro/source/filter/lwptablelayout.cxx  |    2 
 sc/source/filter/excel/excform.cxx             |   26 
 sc/source/filter/excel/excform8.cxx            |   20 
 sc/source/filter/excel/xepivot.cxx             |    2 
 sc/source/filter/excel/xestring.cxx            |    2 
 sfx2/source/dialog/dinfdlg.cxx                 |    2 
 svx/source/tbxctrls/fillctrl.cxx               |  955 +++++++++++++------------
 sw/source/core/doc/htmltbl.cxx                 |    2 
 11 files changed, 599 insertions(+), 480 deletions(-)

New commits:
commit 7986b6a37151ec67ada5fd9ff7759b85412ae42f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:25:00 2014 +0100

    coverity#983449 Unintended sign extension
    
    also
    
    coverity#983450
    
    Change-Id: I43f88005ab130f74df2316f51ab898b112002044

diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 206e755..c4c105d 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -176,7 +176,7 @@ SwHTMLTableLayout::SwHTMLTableLayout( const SwTable * pSwTbl,
                                       sal_uInt16 nInhLeftBWidth,
                                       sal_uInt16 nInhRightBWidth )
     : aColumns( new SwHTMLTableLayoutColumnPtr[nCls] )
-    , aCells( new SwHTMLTableLayoutCellPtr[nRws*nCls] )
+    , aCells( new SwHTMLTableLayoutCellPtr[static_cast<size_t>(nRws)*nCls] )
     , pSwTable( pSwTbl )
     , pLeftFillerBox( 0 )
     , pRightFillerBox( 0 )
commit 5a69d3afc74d26f325d9f78839e9b36b956aae15
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:22:10 2014 +0100

    coverity#736887 Unintended sign extension
    
    also
    
    coverity#736888
    coverity#736889
    coverity#736890
    
    Change-Id: I3e0d11d12c7da17297ba827f8125b9d99680121b

diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index ee3d1eb..ccc38e5 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -975,8 +975,8 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                 break;
             case 0x19: // Special Attribute                     [327 279]
             {
-                sal_uInt16 nData, nFakt;
-                sal_uInt8 nOpt;
+                sal_uInt16 nData(0), nFakt(0);
+                sal_uInt8 nOpt(0);
 
                 aIn >> nOpt;
 
@@ -992,9 +992,10 @@ ConvErr ExcelToSc::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sal
                 }
 
                 if( nOpt & 0x04 )
-                {// nFakt -> skip bytes or words    AttrChoose
-                    nData++;
-                    aIn.Ignore( nData * nFakt );
+                {
+                    // nFakt -> skip bytes or words    AttrChoose
+                    ++nData;
+                    aIn.Ignore(static_cast<sal_Size>(nData) * nFakt);
                 }
             }
                 break;
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 09652d2..a056dc1 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -993,16 +993,17 @@ ConvErr ExcelToSc8::Convert( _ScRangeListTabs& rRangeList, XclImpStream& aIn, sa
                 break;
             case 0x19: // Special Attribute                     [327 279]
             {
-                sal_uInt16 nData, nFakt;
-                sal_uInt8 nOpt;
+                sal_uInt16 nData(0), nFakt(0);
+                sal_uInt8 nOpt(0);
 
                 aIn >> nOpt >> nData;
                 nFakt = 2;
 
                 if( nOpt & 0x04 )
-                {// nFakt -> skip bytes or words    AttrChoose
-                    nData++;
-                    aIn.Ignore( nData * nFakt );
+                {
+                    // nFakt -> skip bytes or words    AttrChoose
+                    ++nData;
+                    aIn.Ignore(static_cast<sal_Size>(nData) * nFakt);
                 }
             }
                 break;
commit da69c7633a486651f9f4fd4cfd08f167881e0bd6
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:20:48 2014 +0100

    coverity#736883 Unintended sign extension
    
    Change-Id: I8e6a81b6c1605bd1be33f5f8d75d2472a39361d4

diff --git a/lotuswordpro/source/filter/lwptablelayout.cxx b/lotuswordpro/source/filter/lwptablelayout.cxx
index 1a018a4..89eaa04 100644
--- a/lotuswordpro/source/filter/lwptablelayout.cxx
+++ b/lotuswordpro/source/filter/lwptablelayout.cxx
@@ -449,7 +449,7 @@ LwpCellLayout * LwpTableLayout::GetCellByRowCol(sal_uInt16 nRow, sal_uInt16 nCol
     if (nRow >= m_nRows || nCol >= m_nCols)
         return NULL;
 
-    return m_WordProCellsMap[nRow*m_nCols + nCol];
+    return m_WordProCellsMap[static_cast<size_t>(nRow)*m_nCols + nCol];
 }
 /**
  * @short   traverse all table cells
commit b34abf1d3d19ebe55dc899b9579213bda0fb9643
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:18:39 2014 +0100

    coverity#706054 Unintended sign extension
    
    Change-Id: I69df0aa6091263cbb6e500a5015915c6678764ec

diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 65bea0b..0cd33f9 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -1663,7 +1663,7 @@ void CustomPropertiesWindow::AddLine( const OUString& sName, Any& rAny )
     pNewLine->m_aTypeBox.SetAccessibleName(m_aTypeBox.GetAccessibleName());
     pNewLine->m_aValueEdit.SetAccessibleName(m_aValueEdit.GetAccessibleName());
 
-    long nPos = GetVisibleLineCount() * GetLineHeight();
+    sal_Int32 nPos = GetVisibleLineCount() * GetLineHeight();
     m_aCustomPropertiesLines.push_back( pNewLine );
     Window* pWindows[] = {  &m_aNameBox, &m_aTypeBox, &m_aValueEdit,
                             &m_aDateField, &m_aTimeField,
commit daa287bdf18dfefca7b889091a1f250d958b8c82
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:15:06 2014 +0100

    coverity#706049 Unintended sign extension
    
    Change-Id: Idb9c4aa6475fcd9edd0d76c06509df182bd2111c

diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index 685d447..0f052a7 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -233,7 +233,7 @@ sal_uInt16 XclExpString::GetHeaderSize() const
 
 sal_Size XclExpString::GetBufferSize() const
 {
-    return mnLen * (mbIsUnicode ? 2 : 1);
+    return static_cast<sal_Size>(mnLen) * (mbIsUnicode ? 2 : 1);
 }
 
 sal_Size XclExpString::GetSize() const
commit 8a4dc64c04c9b0d6dbd1ce1699f793beeecfe95f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:13:40 2014 +0100

    coverity#706047 Unintended sign extension
    
    also
    
    coverity#706048
    
    Change-Id: I93caf413db4582c8b2cdfbcf2358027c03ed113a

diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx
index 9623b9a..4b8ca13 100644
--- a/sc/source/filter/excel/xepivot.cxx
+++ b/sc/source/filter/excel/xepivot.cxx
@@ -1677,7 +1677,7 @@ void XclExpPivotTable::WriteSxli( XclExpStream& rStrm, sal_uInt16 nLineCount, sa
 {
     if( nLineCount > 0 )
     {
-        sal_uInt16 nLineSize = 8 + 2 * nIndexCount;
+        sal_Size nLineSize = 8 + 2 * nIndexCount;
         rStrm.StartRecord( EXC_ID_SXLI, nLineSize * nLineCount );
 
         /*  Excel expects the records to be filled completely, do not
commit d28b51b92f96b1c2b04b0d69c5256d669d32afe7
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:09:27 2014 +0100

    coverity#706041 Unintended sign extension
    
    also
    
    coverity#706042
    coverity#706045
    coverity#706046
    
    Change-Id: I173603a638ef3e2d9ca358a4d4ba111910fac05f

diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 41fdbe4..ee3d1eb 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -383,8 +383,8 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
                 break;
             case 0x19: // Special Attribute                     [327 279]
             {
-                sal_uInt16  nData, nFakt;
-                sal_uInt8   nOpt;
+                sal_uInt16  nData(0), nFakt(0);
+                sal_uInt8   nOpt(0);
 
                 aIn >> nOpt;
 
@@ -400,9 +400,10 @@ ConvErr ExcelToSc::Convert( const ScTokenArray*& pErgebnis, XclImpStream& aIn, s
                 }
 
                 if( nOpt & 0x04 )
-                {// nFakt -> skip bytes or words    AttrChoose
-                    nData++;
-                    aIn.Ignore( nData * nFakt );
+                {
+                    // nFakt -> skip bytes or words    AttrChoose
+                    ++nData;
+                    aIn.Ignore(static_cast<sal_Size>(nData) * nFakt);
                 }
                 else if( nOpt & 0x10 )                      // AttrSum
                     DoMulArgs( ocSum, 1 );
diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx
index 1653ea9..09652d2 100644
--- a/sc/source/filter/excel/excform8.cxx
+++ b/sc/source/filter/excel/excform8.cxx
@@ -373,16 +373,17 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn,
                 break;
             case 0x19: // Special Attribute                     [327 279]
             {
-                sal_uInt16 nData, nFakt;
-                sal_uInt8 nOpt;
+                sal_uInt16 nData(0), nFakt(0);
+                sal_uInt8 nOpt(0);
 
                 aIn >> nOpt >> nData;
                 nFakt = 2;
 
                 if( nOpt & 0x04 )
-                {// nFakt -> skip bytes or words    AttrChoose
+                {
+                    // nFakt -> skip bytes or words    AttrChoose
                     nData++;
-                    aIn.Ignore( nData * nFakt );
+                    aIn.Ignore(static_cast<sal_Size>(nData) * nFakt);
                 }
                 else if( nOpt & 0x10 )                      // AttrSum
                     DoMulArgs( ocSum, 1 );
commit d688fbdd271445a95a2a97938b99578fa3130f24
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:08:12 2014 +0100

    coverity#706038 Unintended sign extension
    
    Change-Id: I363c90a71225744bacd0bedccf6938da63e0428f

diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx
index 74f14a2..41fdbe4 100644
--- a/sc/source/filter/excel/excform.cxx
+++ b/sc/source/filter/excel/excform.cxx
@@ -1874,10 +1874,10 @@ void ExcelToSc::ReadExtensionNlr( XclImpStream& aIn )
 
 void ExcelToSc::ReadExtensionMemArea( XclImpStream& aIn )
 {
-    sal_uInt16 nCount;
+    sal_uInt16 nCount(0);
     aIn >> nCount;
 
-    aIn.Ignore( nCount * ((GetBiff() == EXC_BIFF8) ? 8 : 6) ); // drop the ranges
+    aIn.Ignore( static_cast<sal_Size>(nCount) * ((GetBiff() == EXC_BIFF8) ? 8 : 6) ); // drop the ranges
 }
 
 void ExcelToSc::ReadExtensions( const ExtensionTypeVec& rExtensions,
commit aecbffc5f14a708eb3f3e3fda6028d164d6bc9e0
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Jun 17 12:04:10 2014 +0100

    coverity#705999 Unintended sign extension
    
    also
    
    coverity#706000
    coverity#706001
    coverity#706002
    
    Change-Id: Ib970a4956fcf8362b8e3f9ae859c374c5fc8a545

diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx
index 8083f8e..699d573 100644
--- a/extensions/source/propctrlr/browserlistbox.cxx
+++ b/extensions/source/propctrlr/browserlistbox.cxx
@@ -360,7 +360,7 @@ namespace pcr
 
         ListBox aListBox(this,WB_DROPDOWN);
         aListBox.SetPosSizePixel(Point(0,0),Size(100,100));
-        m_nRowHeight = (sal_uInt16)aListBox.GetSizePixel().Height()+2;
+        m_nRowHeight = aListBox.GetSizePixel().Height()+2;
         SetBackground( pParent->GetBackground() );
         m_aLinesPlayground.SetBackground( GetBackground() );
 
diff --git a/extensions/source/propctrlr/browserlistbox.hxx b/extensions/source/propctrlr/browserlistbox.hxx
index 1652e07..24ed978 100644
--- a/extensions/source/propctrlr/browserlistbox.hxx
+++ b/extensions/source/propctrlr/browserlistbox.hxx
@@ -105,7 +105,7 @@ namespace pcr
         ::com::sun::star::uno::Reference< ::com::sun::star::inspection::XPropertyControl >
                                     m_xActiveControl;
         sal_uInt16                  m_nTheNameSize;
-        sal_uInt16                  m_nRowHeight;
+        long                        m_nRowHeight;
         ::std::set< sal_uInt16 >    m_aOutOfDateLines;
         bool                    m_bIsActive : 1;
         bool                    m_bUpdate : 1;
commit 0f61a89e51a9ac2e4be29df9974562d23fb63b06
Author: Armin Le Grand <alg at apache.org>
Date:   Mon Jun 16 11:23:03 2014 +0000

    Resolves: #i125065# handle critical cases in FillStyle/FillProperties...
    
    toolbar combination
    (cherry picked from commit 0ce4a90e14ddc9067d014405235a36aa959c6ea2)
    
    Conflicts:
    	include/svx/fillctrl.hxx
    	svx/source/tbxctrls/fillctrl.cxx
    
    Change-Id: I9a1b2490a7e9285559dddd4df7fb20c2216fd450

diff --git a/include/svx/fillctrl.hxx b/include/svx/fillctrl.hxx
index c409aec..8825770 100644
--- a/include/svx/fillctrl.hxx
+++ b/include/svx/fillctrl.hxx
@@ -40,32 +40,33 @@ class ListBox;
 |*
 \************************************************************************/
 
-class SVX_DLLPUBLIC SvxFillToolBoxControl: public SfxToolBoxControl
+class SVX_DLLPUBLIC SvxFillToolBoxControl : public SfxToolBoxControl
 {
 private:
-    XFillStyleItem*     pStyleItem;
-    XFillColorItem*     pColorItem;
-    XFillGradientItem*  pGradientItem;
-    XFillHatchItem*     pHatchItem;
-    XFillBitmapItem*    pBitmapItem;
+    XFillStyleItem*     mpStyleItem;
+    XFillColorItem*     mpColorItem;
+    XFillGradientItem*  mpGradientItem;
+    XFillHatchItem*     mpHatchItem;
+    XFillBitmapItem*    mpBitmapItem;
 
-    FillControl*        pFillControl;
-    SvxFillTypeBox*     pFillTypeLB;
-    SvxFillAttrBox*     pFillAttrLB;
+    FillControl*        mpFillControl;
+    SvxFillTypeBox*     mpFillTypeLB;
+    SvxFillAttrBox*     mpFillAttrLB;
 
-    bool                bUpdate;
-    sal_uInt16          eLastXFS;
+    XFillStyle          meLastXFS;
+
+    /// bitfield
+    bool                mbUpdate:1;
 
 public:
     SFX_DECL_TOOLBOX_CONTROL();
 
-    SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
+    SvxFillToolBoxControl(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx);
     virtual ~SvxFillToolBoxControl();
 
-    virtual void        StateChanged( sal_uInt16 nSID, SfxItemState eState,
-                                      const SfxPoolItem* pState ) SAL_OVERRIDE;
-    void                Update( const SfxPoolItem* pState );
-    virtual Window*     CreateItemWindow( Window *pParent ) SAL_OVERRIDE;
+    virtual void StateChanged(sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState) SAL_OVERRIDE;
+    void Update(const SfxPoolItem* pState);
+    virtual Window* CreateItemWindow(Window* pParent) SAL_OVERRIDE;
 };
 
 
@@ -75,18 +76,29 @@ class FillControl : public Window
 private:
     friend class SvxFillToolBoxControl;
 
-    SvxFillTypeBox* pLbFillType;
-    SvxFillAttrBox* pLbFillAttr;
-    Size            aLogicalFillSize;
-    Size            aLogicalAttrSize;
-    Timer           aDelayTimer;
+    SvxFillTypeBox*     mpLbFillType;
+    SvxFillAttrBox*     mpLbFillAttr;
+    Size                maLogicalFillSize;
+    Size                maLogicalAttrSize;
+
+    //
+    sal_uInt16          mnLastFillTypeControlSelectEntryPos;
+    sal_uInt16          mnLastFillAttrControlSelectEntryPos;
+
+    /// bitfield
+    bool                mbFillTypeChanged : 1;
+
+    DECL_LINK(SelectFillTypeHdl,ListBox *);
+    DECL_LINK(SelectFillAttrHdl,ListBox *);
+
+    virtual void DataChanged(const DataChangedEvent& rDCEvt) SAL_OVERRIDE;
+
+    void InitializeFillStyleAccordingToGivenFillType(XFillStyle eFillStyle);
+    void updateLastFillTypeControlSelectEntryPos();
+    void updateLastFillAttrControlSelectEntryPos();
 
-    DECL_LINK( DelayHdl, void * );
-    DECL_LINK( SelectFillTypeHdl, ListBox * );
-    DECL_LINK( SelectFillAttrHdl, ListBox * );
-    virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
 public:
-    FillControl( Window* pParent, WinBits nStyle = 0 );
+    FillControl(Window* pParent, WinBits nStyle = 0);
     virtual ~FillControl();
 
     virtual void Resize() SAL_OVERRIDE;
diff --git a/svx/source/tbxctrls/fillctrl.cxx b/svx/source/tbxctrls/fillctrl.cxx
index 305725a..4a26ac4 100644
--- a/svx/source/tbxctrls/fillctrl.cxx
+++ b/svx/source/tbxctrls/fillctrl.cxx
@@ -26,8 +26,6 @@
 #include <vcl/settings.hxx>
 #include <svx/dialogs.hrc>
 
-#define DELAY_TIMEOUT           300
-
 #define TMP_STR_BEGIN   "["
 #define TMP_STR_END     "]"
 
@@ -52,20 +50,21 @@ SFX_IMPL_TOOLBOX_CONTROL( SvxFillToolBoxControl, XFillStyleItem );
 |* SvxFillToolBoxControl
 |*
 \************************************************************************/
-
-SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
-    SfxToolBoxControl( nSlotId, nId, rTbx ),
-
-    pStyleItem      ( NULL ),
-    pColorItem      ( NULL ),
-    pGradientItem   ( NULL ),
-    pHatchItem      ( NULL ),
-    pBitmapItem     ( NULL ),
-    pFillControl    ( NULL ),
-    pFillTypeLB     ( NULL ),
-    pFillAttrLB     ( NULL ),
-    bUpdate         ( false ),
-    eLastXFS        ( XFILL_NONE )
+SvxFillToolBoxControl::SvxFillToolBoxControl(
+    sal_uInt16 nSlotId,
+    sal_uInt16 nId,
+    ToolBox& rTbx )
+    : SfxToolBoxControl( nSlotId, nId, rTbx )
+    , mpStyleItem(0)
+    , mpColorItem(0)
+    , mpGradientItem(0)
+    , mpHatchItem(0)
+    , mpBitmapItem(0)
+    , mpFillControl(0)
+    , mpFillTypeLB(0)
+    , mpFillAttrLB(0)
+    , meLastXFS(XFILL_NONE)
+    , mbUpdate(false)
 {
     addStatusListener( OUString( ".uno:FillColor" ));
     addStatusListener( OUString( ".uno:FillGradient" ));
@@ -81,134 +80,146 @@ SvxFillToolBoxControl::SvxFillToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId
 
 SvxFillToolBoxControl::~SvxFillToolBoxControl()
 {
-    delete pStyleItem;
-    delete pColorItem;
-    delete pGradientItem;
-    delete pHatchItem;
-    delete pBitmapItem;
+    delete mpStyleItem;
+    delete mpColorItem;
+    delete mpGradientItem;
+    delete mpHatchItem;
+    delete mpBitmapItem;
 }
 
 
 
 void SvxFillToolBoxControl::StateChanged(
-
-    sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
-
+    sal_uInt16 nSID,
+    SfxItemState eState,
+    const SfxPoolItem* pState)
 {
-
-    if( eState == SFX_ITEM_DISABLED )
+    if(eState == SFX_ITEM_DISABLED)
     {
-        if( nSID == SID_ATTR_FILL_STYLE )
+        // slot disable state
+        if(nSID == SID_ATTR_FILL_STYLE)
         {
-            pFillTypeLB->Disable();
-            pFillTypeLB->SetNoSelection();
+            mpFillTypeLB->Disable();
+            mpFillTypeLB->SetNoSelection();
         }
-        pFillAttrLB->Disable();
-        pFillAttrLB->SetNoSelection();
+
+        mpFillAttrLB->Disable();
+        mpFillAttrLB->SetNoSelection();
     }
-    else
+    else if(SFX_ITEM_AVAILABLE == eState)
     {
-        if ( SFX_ITEM_AVAILABLE == eState )
+        bool bEnableControls(false);
+
+        // slot available state
+        if(nSID == SID_ATTR_FILL_STYLE)
         {
-            bool bEnableControls = false;
-            if( nSID == SID_ATTR_FILL_STYLE )
-            {
-                delete pStyleItem;
-                pStyleItem = (XFillStyleItem*) pState->Clone();
-                pFillTypeLB->Enable();
-            }
-            else if( pStyleItem )
+            delete mpStyleItem;
+            mpStyleItem = static_cast< XFillStyleItem* >(pState->Clone());
+            mpFillTypeLB->Enable();
+        }
+        else if(mpStyleItem)
+        {
+            const XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue()));
+
+            if(nSID == SID_ATTR_FILL_COLOR)
             {
-                XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
+                delete mpColorItem;
+                mpColorItem = static_cast< XFillColorItem* >(pState->Clone());
 
-                if( nSID == SID_ATTR_FILL_COLOR )
+                if(eXFS == XFILL_SOLID)
                 {
-                    delete pColorItem;
-                    pColorItem = (XFillColorItem*) pState->Clone();
-
-                    if( eXFS == XFILL_SOLID )
-                        bEnableControls = true;
+                    bEnableControls = true;
                 }
-                else if( nSID == SID_ATTR_FILL_GRADIENT )
-                {
-                    delete pGradientItem;
-                    pGradientItem = (XFillGradientItem*) pState->Clone();
+            }
+            else if(nSID == SID_ATTR_FILL_GRADIENT)
+            {
+                delete mpGradientItem;
+                mpGradientItem = static_cast< XFillGradientItem* >(pState->Clone());
 
-                    if( eXFS == XFILL_GRADIENT )
-                        bEnableControls = true;
-                }
-                else if( nSID == SID_ATTR_FILL_HATCH )
+                if(eXFS == XFILL_GRADIENT)
                 {
-                    delete pHatchItem;
-                    pHatchItem = (XFillHatchItem*) pState->Clone();
-
-                    if( eXFS == XFILL_HATCH )
-                        bEnableControls = true;
+                    bEnableControls = true;
                 }
-                else if( nSID == SID_ATTR_FILL_BITMAP )
-                {
-                    delete pBitmapItem;
-                    pBitmapItem = (XFillBitmapItem*) pState->Clone();
+            }
+            else if(nSID == SID_ATTR_FILL_HATCH)
+            {
+                delete mpHatchItem;
+                mpHatchItem = static_cast< XFillHatchItem* >(pState->Clone());
 
-                    if( eXFS == XFILL_BITMAP )
-                        bEnableControls = true;
+                if(eXFS == XFILL_HATCH)
+                {
+                    bEnableControls = true;
                 }
             }
-
-            if( pStyleItem )
+            else if(nSID == SID_ATTR_FILL_BITMAP)
             {
-                // ensure that the correct entry is selected in pFillTypeLB. It
-                // might have been changed by nSID == SID_ATTR_FILL_STYLE, but
-                // it might also be in an in-between state when user had started to
-                // change fillstyle, but not yet changed fillvalue for new style
-                // and when nSID == SID_ATTR_FILL_COLOR/SID_ATTR_FILL_GRADIENT/
-                // SID_ATTR_FILL_HATCH/SID_ATTR_FILL_BITMAP value change is triggered
-                eLastXFS = pFillTypeLB->GetSelectEntryPos();
-                XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
-
-                if(eLastXFS != eXFS)
+                delete mpBitmapItem;
+                mpBitmapItem = static_cast< XFillBitmapItem* >(pState->Clone());
+
+                if(eXFS == XFILL_BITMAP)
                 {
-                    bUpdate = true;
-                    pFillTypeLB->SelectEntryPos( eXFS );
+                    bEnableControls = true;
                 }
-
-                pFillAttrLB->Enable();
             }
+        }
+
+        if(mpStyleItem)
+        {
+            // ensure that the correct entry is selected in mpFillTypeLB
+            XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue()));
+            const bool bFillTypeChangedByUser(mpFillControl->mbFillTypeChanged);
 
-            if( bEnableControls )
+            if(bFillTypeChangedByUser)
             {
-                //pFillTypeLB->Enable();
-                pFillAttrLB->Enable();
+                meLastXFS = static_cast< XFillStyle >(mpFillControl->mnLastFillTypeControlSelectEntryPos);
+                mpFillControl->mbFillTypeChanged = false;
+            }
 
-                bUpdate = true;
+            if(meLastXFS != eXFS)
+            {
+                mbUpdate = true;
+                mpFillTypeLB->SelectEntryPos(sal::static_int_cast<sal_uInt16>(eXFS));
             }
 
-            Update( pState );
+            mpFillAttrLB->Enable();
+        }
+
+        if(bEnableControls)
+        {
+            mpFillAttrLB->Enable();
+            mbUpdate = true;
+        }
+
+        Update(pState);
+    }
+    else
+    {
+        // slot empty or ambigous
+        if(nSID == SID_ATTR_FILL_STYLE)
+        {
+            mpFillTypeLB->SetNoSelection();
+            mpFillAttrLB->Disable();
+            mpFillAttrLB->SetNoSelection();
+            delete mpStyleItem;
+            mpStyleItem = 0;
+            mbUpdate = false;
         }
         else
         {
-            // empty or ambiguous status
-            if( nSID == SID_ATTR_FILL_STYLE )
+            XFillStyle eXFS(XFILL_NONE);
+
+            if(mpStyleItem)
             {
-                pFillTypeLB->SetNoSelection();
-                pFillAttrLB->Disable();
-                pFillAttrLB->SetNoSelection();
-                bUpdate = false;
+                eXFS = static_cast< XFillStyle >(mpStyleItem->GetValue());
             }
-            else
+
+            if(!mpStyleItem ||
+                (nSID == SID_ATTR_FILL_COLOR && eXFS == XFILL_SOLID) ||
+                (nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT) ||
+                (nSID == SID_ATTR_FILL_HATCH && eXFS == XFILL_HATCH) ||
+                (nSID == SID_ATTR_FILL_BITMAP && eXFS == XFILL_BITMAP))
             {
-                XFillStyle eXFS = XFILL_NONE;
-                if( pStyleItem )
-                    eXFS = (XFillStyle)pStyleItem->GetValue();
-                if( !pStyleItem ||
-                    ( nSID == SID_ATTR_FILL_COLOR    && eXFS == XFILL_SOLID ) ||
-                    ( nSID == SID_ATTR_FILL_GRADIENT && eXFS == XFILL_GRADIENT ) ||
-                    ( nSID == SID_ATTR_FILL_HATCH    && eXFS == XFILL_HATCH ) ||
-                    ( nSID == SID_ATTR_FILL_BITMAP   && eXFS == XFILL_BITMAP ) )
-                {
-                    pFillAttrLB->SetNoSelection();
-                    //bUpdate = sal_False;
-                }
+                mpFillAttrLB->SetNoSelection();
             }
         }
     }
@@ -216,102 +227,106 @@ void SvxFillToolBoxControl::StateChanged(
 
 
 
-void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
+void SvxFillToolBoxControl::Update(const SfxPoolItem* pState)
 {
-    if ( pStyleItem && pState && bUpdate )
+    if(mpStyleItem && pState && mbUpdate)
     {
-        bUpdate = false;
-
-        XFillStyle eXFS = (XFillStyle)pStyleItem->GetValue();
+        mbUpdate = false;
+        const XFillStyle eXFS(static_cast< XFillStyle >(mpStyleItem->GetValue()));
 
         // Check if the fill style was already active
-        //if( eTmpXFS != eXFS )
-        if( (XFillStyle) eLastXFS != eXFS )
-            pFillControl->SelectFillTypeHdl( NULL );
-            //eLastXFS = eXFS;
+        if(meLastXFS != eXFS)
+        {
+            // update mnLastFillTypeControlSelectEntryPos and fill style list
+            mpFillControl->updateLastFillTypeControlSelectEntryPos();
+            mpFillControl->InitializeFillStyleAccordingToGivenFillType(eXFS);
+            meLastXFS = eXFS;
+        }
 
-        switch( eXFS )
+        switch(eXFS)
         {
             case XFILL_NONE:
-            break;
+            {
+                break;
+            }
 
             case XFILL_SOLID:
             {
-                if ( pColorItem )
+                if(mpColorItem)
                 {
-                    OUString aString( pColorItem->GetName() );
-                    ::Color aColor = pColorItem->GetColorValue();
+                    OUString aString(mpColorItem->GetName());
+                    ::Color aColor = mpColorItem->GetColorValue();
 
-                    pFillAttrLB->SelectEntry( aString );
+                    mpFillAttrLB->SelectEntry(aString);
 
-                    if ( pFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND ||
-                         pFillAttrLB->GetSelectEntryColor() != aColor )
-                        pFillAttrLB->SelectEntry( aColor );
+                    if(mpFillAttrLB->GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND || mpFillAttrLB->GetSelectEntryColor() != aColor)
+                    {
+                        mpFillAttrLB->SelectEntry(aColor);
+                    }
 
                     // Check if the entry is not in the list
-                    if( pFillAttrLB->GetSelectEntryPos() ==
+                    if( mpFillAttrLB->GetSelectEntryPos() ==
                         LISTBOX_ENTRY_NOTFOUND ||
-                        pFillAttrLB->GetSelectEntryColor() != aColor )
+                        mpFillAttrLB->GetSelectEntryColor() != aColor )
                     {
-                        sal_Int32 nCount = pFillAttrLB->GetEntryCount();
+                        sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
                         OUString aTmpStr;
                         if( nCount > 0 )
                         {
                             // Last entry gets tested against temporary color
-                            aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
-                            if(  aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                 aTmpStr.endsWith(TMP_STR_END) )
+                            aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
+                            if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                pFillAttrLB->RemoveEntry( nCount - 1 );
+                                mpFillAttrLB->RemoveEntry(nCount - 1);
                             }
                         }
                         aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
 
-                        //pFillAttrLB->SetUpdateMode( sal_False );
-                        sal_Int32 nPos = pFillAttrLB->InsertEntry( aColor, aTmpStr );
-                        //pFillAttrLB->SetUpdateMode( sal_True );
-                        pFillAttrLB->SelectEntryPos( nPos );
+                        sal_Int32 nPos = mpFillAttrLB->InsertEntry(aColor, aTmpStr);
+                        mpFillAttrLB->SelectEntryPos(nPos);
                     }
                 }
                 else
-                    pFillAttrLB->SetNoSelection();
+                {
+                    mpFillAttrLB->SetNoSelection();
+                }
+                break;
             }
-            break;
 
             case XFILL_GRADIENT:
             {
-                if ( pGradientItem )
+                if(mpGradientItem)
                 {
-                    OUString aString( pGradientItem->GetName() );
-                    pFillAttrLB->SelectEntry( aString );
+                    OUString aString(mpGradientItem->GetName());
+                    mpFillAttrLB->SelectEntry( aString );
                     // Check if the entry is not in the list
-                    if( pFillAttrLB->GetSelectEntry() != aString )
+                    if (mpFillAttrLB->GetSelectEntry() != aString)
                     {
-                        sal_Int32 nCount = pFillAttrLB->GetEntryCount();
+                        sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
                         OUString aTmpStr;
                         if( nCount > 0 )
                         {
                             // Last entry gets tested against temporary entry
-                            aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
-                            if(  aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                 aTmpStr.endsWith(TMP_STR_END) )
+                            aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
+                            if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                pFillAttrLB->RemoveEntry( nCount - 1 );
+                                mpFillAttrLB->RemoveEntry(nCount - 1);
                             }
                         }
                         aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
 
-                        XGradientEntry* pEntry = new XGradientEntry( pGradientItem->GetGradientValue(), aTmpStr );
+                        XGradientEntry* pEntry = new XGradientEntry(mpGradientItem->GetGradientValue(), aTmpStr);
                         XGradientList aGradientList( "", ""/*TODO?*/ );
                         aGradientList.Insert( pEntry );
                         aGradientList.SetDirty( false );
                         const Bitmap aBmp = aGradientList.GetUiBitmap( 0 );
 
-                        if( !aBmp.IsEmpty() )
+                        if(!aBmp.IsEmpty())
                         {
-                            pFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
-                            pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
-                            //delete pBmp;
+                            mpFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
+                            mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
                         }
 
                         aGradientList.Remove( 0 );
@@ -319,44 +334,45 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
                     }
                 }
                 else
-                    pFillAttrLB->SetNoSelection();
+                {
+                    mpFillAttrLB->SetNoSelection();
+                }
+                break;
             }
-            break;
 
             case XFILL_HATCH:
             {
-                if ( pHatchItem )
+                if(mpHatchItem)
                 {
-                    OUString aString( pHatchItem->GetName() );
-                    pFillAttrLB->SelectEntry( aString );
+                    OUString aString(mpHatchItem->GetName());
+                    mpFillAttrLB->SelectEntry( aString );
                     // Check if the entry is not in the list
-                    if( pFillAttrLB->GetSelectEntry() != aString )
+                    if (mpFillAttrLB->GetSelectEntry() != aString)
                     {
-                        sal_Int32 nCount = pFillAttrLB->GetEntryCount();
+                        sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
                         OUString aTmpStr;
                         if( nCount > 0 )
                         {
                             // Last entry gets tested against temporary entry
-                            aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
-                            if(  aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                 aTmpStr.endsWith(TMP_STR_END) )
+                            aTmpStr = mpFillAttrLB->GetEntry( nCount - 1 );
+                            if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                pFillAttrLB->RemoveEntry( nCount - 1 );
+                                mpFillAttrLB->RemoveEntry(nCount - 1);
                             }
                         }
                         aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
 
-                        XHatchEntry* pEntry = new XHatchEntry( pHatchItem->GetHatchValue(), aTmpStr );
+                        XHatchEntry* pEntry = new XHatchEntry(mpHatchItem->GetHatchValue(), aTmpStr);
                         XHatchList aHatchList( "", ""/*TODO?*/ );
                         aHatchList.Insert( pEntry );
                         aHatchList.SetDirty( false );
                         const Bitmap aBmp = aHatchList.GetUiBitmap( 0 );
 
-                        if( !aBmp.IsEmpty() )
+                        if(!aBmp.IsEmpty())
                         {
-                            pFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
-                            pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
-                            //delete pBmp;
+                            mpFillAttrLB->InsertEntry(pEntry->GetName(), Image(aBmp));
+                            mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
                         }
 
                         aHatchList.Remove( 0 );
@@ -364,121 +380,159 @@ void SvxFillToolBoxControl::Update( const SfxPoolItem* pState )
                     }
                 }
                 else
-                    pFillAttrLB->SetNoSelection();
+                {
+                    mpFillAttrLB->SetNoSelection();
+                }
+                break;
             }
-            break;
 
             case XFILL_BITMAP:
             {
-                if ( pBitmapItem )
-                    // &&
-                    // SfxObjectShell::Current()    &&
-                    // SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) )
+                if(mpBitmapItem)
                 {
-                    OUString aString( pBitmapItem->GetName() );
-                    // Bitmap aBitmap( pBitmapItem->GetValue() );
-
-                    // SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
-                    //  SfxObjectShell::Current()->GetItem( SID_BITMAP_LIST ) ) );
-                    pFillAttrLB->SelectEntry( aString );
+                    OUString aString(mpBitmapItem->GetName());
+                    mpFillAttrLB->SelectEntry( aString );
                     // Check if the entry is not in the list
-                    if( pFillAttrLB->GetSelectEntry() != aString )
+                    if (mpFillAttrLB->GetSelectEntry() != aString)
                     {
-                        sal_Int32 nCount = pFillAttrLB->GetEntryCount();
+                        sal_Int32 nCount = mpFillAttrLB->GetEntryCount();
                         OUString aTmpStr;
                         if( nCount > 0 )
                         {
                             // Last entry gets tested against temporary entry
-                            aTmpStr = pFillAttrLB->GetEntry( nCount - 1 );
-                            if(  aTmpStr.startsWith(TMP_STR_BEGIN) &&
-                                 aTmpStr.endsWith(TMP_STR_END) )
+                            aTmpStr = mpFillAttrLB->GetEntry(nCount - 1);
+                            if( aTmpStr.startsWith(TMP_STR_BEGIN) &&
+                                aTmpStr.endsWith(TMP_STR_END) )
                             {
-                                pFillAttrLB->RemoveEntry( nCount - 1 );
+                                mpFillAttrLB->RemoveEntry(nCount - 1);
                             }
                         }
                         aTmpStr = TMP_STR_BEGIN + aString + TMP_STR_END;
 
-                        XBitmapEntry* pEntry = new XBitmapEntry(pBitmapItem->GetGraphicObject(), aTmpStr);
+                        XBitmapEntry* pEntry = new XBitmapEntry(mpBitmapItem->GetGraphicObject(), aTmpStr);
                         XBitmapListRef xBitmapList =
                             XPropertyList::CreatePropertyList(XBITMAP_LIST,
                             OUString("TmpList"), ""/*TODO?*/)->AsBitmapList();
                         xBitmapList->Insert( pEntry );
                         xBitmapList->SetDirty( false );
-                        pFillAttrLB->Fill( xBitmapList );
-                        pFillAttrLB->SelectEntryPos( pFillAttrLB->GetEntryCount() - 1 );
+                        mpFillAttrLB->Fill( xBitmapList );
+                        mpFillAttrLB->SelectEntryPos(mpFillAttrLB->GetEntryCount() - 1);
                         xBitmapList->Remove( 0 );
                         delete pEntry;
                     }
                 }
                 else
-                    pFillAttrLB->SetNoSelection();
+                {
+                    mpFillAttrLB->SetNoSelection();
+                }
+                break;
             }
-            break;
 
             default:
+            {
                 OSL_FAIL( "Unsupported fill type" );
-            break;
+                break;
+            }
         }
+
+        // update mnLastFillAttrControlSelectEntryPos
+        mpFillControl->updateLastFillAttrControlSelectEntryPos();
     }
 
-    if( pState && pStyleItem )
+    if(pState && mpStyleItem)
     {
-        XFillStyle eXFS = (XFillStyle) pStyleItem->GetValue();
+        XFillStyle eXFS = static_cast< XFillStyle >(mpStyleItem->GetValue());
 
         // Does the lists have changed?
-        if( pState->ISA( SvxColorListItem ) &&
-            eXFS == XFILL_SOLID )
+        switch(eXFS)
         {
-            ::Color aTmpColor( pFillAttrLB->GetSelectEntryColor() );
-            pFillAttrLB->Clear();
-            pFillAttrLB->Fill( ( (SvxColorListItem*)pState )->GetColorList() );
-            pFillAttrLB->SelectEntry( aTmpColor );
-        }
-        if( pState->ISA( SvxGradientListItem ) &&
-            eXFS == XFILL_GRADIENT )
-        {
-            OUString aString( pFillAttrLB->GetSelectEntry() );
-            pFillAttrLB->Clear();
-            pFillAttrLB->Fill( ( (SvxGradientListItem*)pState )->GetGradientList() );
-            pFillAttrLB->SelectEntry( aString );
-        }
-        if( pState->ISA( SvxHatchListItem ) &&
-            eXFS == XFILL_HATCH )
-        {
-            OUString aString( pFillAttrLB->GetSelectEntry() );
-            pFillAttrLB->Clear();
-            pFillAttrLB->Fill( ( (SvxHatchListItem*)pState )->GetHatchList() );
-            pFillAttrLB->SelectEntry( aString );
-        }
-        if( pState->ISA( SvxBitmapListItem ) &&
-            eXFS == XFILL_BITMAP )
-        {
-            OUString aString( pFillAttrLB->GetSelectEntry() );
-            pFillAttrLB->Clear();
-            pFillAttrLB->Fill( ( (SvxBitmapListItem*)pState )->GetBitmapList() );
-            pFillAttrLB->SelectEntry( aString );
+            case XFILL_SOLID:
+            {
+                const SvxColorListItem* pItem = dynamic_cast< const SvxColorListItem* >(pState);
+
+                if(pItem)
+                {
+                    ::Color aTmpColor(mpFillAttrLB->GetSelectEntryColor());
+                    mpFillAttrLB->Clear();
+                    mpFillAttrLB->Fill(pItem->GetColorList());
+                    mpFillAttrLB->SelectEntry(aTmpColor);
+                }
+                break;
+            }
+            case XFILL_GRADIENT:
+            {
+                const SvxGradientListItem* pItem = dynamic_cast< const SvxGradientListItem* >(pState);
+
+                if(pItem)
+                {
+                    OUString aString(mpFillAttrLB->GetSelectEntry());
+                    mpFillAttrLB->Clear();
+                    mpFillAttrLB->Fill(pItem->GetGradientList());
+                    mpFillAttrLB->SelectEntry(aString);
+                }
+                break;
+            }
+            case XFILL_HATCH:
+            {
+                const SvxHatchListItem* pItem = dynamic_cast< const SvxHatchListItem* >(pState);
+
+                if(pItem)
+                {
+                    OUString aString(mpFillAttrLB->GetSelectEntry());
+                    mpFillAttrLB->Clear();
+                    mpFillAttrLB->Fill(pItem->GetHatchList());
+                    mpFillAttrLB->SelectEntry(aString);
+                }
+                break;
+            }
+            case XFILL_BITMAP:
+            {
+                const SvxBitmapListItem* pItem = dynamic_cast< const SvxBitmapListItem* >(pState);
+
+                if(pItem)
+                {
+                    OUString aString(mpFillAttrLB->GetSelectEntry());
+                    mpFillAttrLB->Clear();
+                    mpFillAttrLB->Fill(pItem->GetBitmapList());
+                    mpFillAttrLB->SelectEntry(aString);
+                }
+                break;
+            }
+            default: // XFILL_NONE
+            {
+                break;
+            }
         }
     }
 }
 
-
-
-Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent )
+Window* SvxFillToolBoxControl::CreateItemWindow(Window *pParent)
 {
-    if ( GetSlotId() == SID_ATTR_FILL_STYLE )
+    if(GetSlotId() == SID_ATTR_FILL_STYLE)
     {
-        pFillControl = new FillControl( pParent );
+        mpFillControl = new FillControl(pParent);
         // Thus the FillControl is known by SvxFillToolBoxControl
         // (and in order to remain compatible)
-        pFillControl->SetData( this );
+        mpFillControl->SetData(this);
+
+        mpFillAttrLB = (SvxFillAttrBox*)mpFillControl->mpLbFillAttr;
+        mpFillTypeLB = (SvxFillTypeBox*)mpFillControl->mpLbFillType;
 
-        pFillAttrLB = (SvxFillAttrBox*)pFillControl->pLbFillAttr;
-        pFillTypeLB = (SvxFillTypeBox*)pFillControl->pLbFillType;
+        mpFillAttrLB->SetUniqueId(HID_FILL_ATTR_LISTBOX);
+        mpFillTypeLB->SetUniqueId(HID_FILL_TYPE_LISTBOX);
 
-        pFillAttrLB->SetUniqueId( HID_FILL_ATTR_LISTBOX );
-        pFillTypeLB->SetUniqueId( HID_FILL_TYPE_LISTBOX );
+        if(!mpStyleItem)
+        {
+            // for Writer and Calc it's not the same instance of
+            // SvxFillToolBoxControl which gets used after deselecting
+            // and selecting a DrawObject, thhus a useful initialization is
+            // needed to get the FillType and the FillStyle List inited
+            // correctly. This in combination with meLastXFS inited to
+            // XFILL_NONE do the trick
+            mpStyleItem = new XFillStyleItem(XFILL_SOLID);
+        }
 
-        return pFillControl;
+        return mpFillControl;
     }
     return NULL;
 }
@@ -489,280 +543,328 @@ Window* SvxFillToolBoxControl::CreateItemWindow( Window *pParent )
 |*
 \************************************************************************/
 
-FillControl::FillControl( Window* pParent, WinBits nStyle ) :
-    Window( pParent, nStyle | WB_DIALOGCONTROL ),
-    pLbFillType(new SvxFillTypeBox( this )),
-    aLogicalFillSize(40,80),
-    aLogicalAttrSize(50,80)
+FillControl::FillControl(Window* pParent,WinBits nStyle)
+:   Window(pParent,nStyle | WB_DIALOGCONTROL),
+    mpLbFillType(new SvxFillTypeBox(this)),
+    mpLbFillAttr(new SvxFillAttrBox(this)),
+    maLogicalFillSize(40,80),
+    maLogicalAttrSize(50,80),
+    mnLastFillTypeControlSelectEntryPos(mpLbFillType->GetSelectEntryPos()),
+    mnLastFillAttrControlSelectEntryPos(mpLbFillAttr->GetSelectEntryPos()),
+    mbFillTypeChanged(false)
 {
-    pLbFillAttr = new SvxFillAttrBox( this );
-    Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
-    Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
-    pLbFillType->SetSizePixel(aTypeSize);
-    pLbFillAttr->SetSizePixel(aAttrSize);
+    Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
+    Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
+    mpLbFillType->SetSizePixel(aTypeSize);
+    mpLbFillAttr->SetSizePixel(aAttrSize);
+
     //to get the base height
-    aTypeSize = pLbFillType->GetSizePixel();
-    aAttrSize = pLbFillAttr->GetSizePixel();
-    Point aAttrPnt = pLbFillAttr->GetPosPixel();
+    aTypeSize = mpLbFillType->GetSizePixel();
+    aAttrSize = mpLbFillAttr->GetSizePixel();
+    Point aAttrPnt = mpLbFillAttr->GetPosPixel();
     SetSizePixel(
-        Size( aAttrPnt.X() + aAttrSize.Width(),
-              std::max( aAttrSize.Height(), aTypeSize.Height() ) ) );
-
-    pLbFillType->SetSelectHdl( LINK( this, FillControl, SelectFillTypeHdl ) );
-    pLbFillAttr->SetSelectHdl( LINK( this, FillControl, SelectFillAttrHdl ) );
+        Size(aAttrPnt.X() + aAttrSize.Width(),
+            std::max(aAttrSize.Height(),aTypeSize.Height())));
 
-    aDelayTimer.SetTimeout( DELAY_TIMEOUT );
-    aDelayTimer.SetTimeoutHdl( LINK( this, FillControl, DelayHdl ) );
-    aDelayTimer.Start();
+    mpLbFillType->SetSelectHdl(LINK(this,FillControl,SelectFillTypeHdl));
+    mpLbFillAttr->SetSelectHdl(LINK(this,FillControl,SelectFillAttrHdl));
 }
 
-
-
 FillControl::~FillControl()
 {
-    delete pLbFillType;
-    delete pLbFillAttr;
+    delete mpLbFillType;
+    delete mpLbFillAttr;
 }
 
-
-
-IMPL_LINK_NOARG_INLINE_START(FillControl, DelayHdl)
+void FillControl::InitializeFillStyleAccordingToGivenFillType(XFillStyle aFillStyle)
 {
-    SelectFillTypeHdl( NULL );
-    ( (SvxFillToolBoxControl*)GetData() )->updateStatus( OUString( ".uno:FillStyle" ));
-//  ( (SvxFillToolBoxControl*)GetData() )->GetBindings().Invalidate( SID_ATTR_FILL_STYLE );
-    return 0;
-}
-IMPL_LINK_INLINE_END( FillControl, DelayHdl, Timer *, pTimer )
-
-
-
-IMPL_LINK( FillControl, SelectFillTypeHdl, ListBox *, pBox )
-{
-    XFillStyle  eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
-
-    // Later, an optimization should be accomplished,
-    // that the lists or tables can only be deleted and rebuilt
-    // when the lists, or tables have actually changed (in the LBs of course).
+    SfxObjectShell* pSh = SfxObjectShell::Current();
+    bool bDone(false);
 
-    if ( ( pBox && !pBox->IsTravelSelect() ) || !pBox )
+    if(pSh)
     {
-        // So that we can show a status in the following case:
-        // One type was selected but no attribute.
-        // The selection has exactly the same attributes as the previous one.
-//      SvxFillToolBoxControl* pControlerItem = (SvxFillToolBoxControl*)GetData();
-//      if( pControlerItem )
-//          pControlerItem->ClearCache();
-
-        pLbFillAttr->Clear();
-        SfxObjectShell* pSh = SfxObjectShell::Current();
+        // clear in all cases, else we would risk a mix of FillStyles in the Style list
+        mpLbFillAttr->Clear();
 
-        switch( eXFS )
+        switch (aFillStyle)
         {
-            case XFILL_NONE:
-            {
-                pLbFillType->Selected();
-                SelectFillAttrHdl( pBox );
-                pLbFillAttr->Disable();
-            }
-            break;
-
             case XFILL_SOLID:
             {
-                if ( pSh && pSh->GetItem( SID_COLOR_TABLE ) )
+                if(pSh->GetItem(SID_COLOR_TABLE))
                 {
-                    SvxColorListItem aItem( *(const SvxColorListItem*)(
-                        pSh->GetItem( SID_COLOR_TABLE ) ) );
-                    pLbFillAttr->Enable();
-                    pLbFillAttr->Fill( aItem.GetColorList() );
+                    const SvxColorListItem* pItem = static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE));
+                    mpLbFillAttr->Enable();
+                    mpLbFillAttr->Fill(pItem->GetColorList());
+                    bDone = true;
                 }
-                else
-                    pLbFillAttr->Disable();
+                break;
             }
-            break;
 
             case XFILL_GRADIENT:
             {
-                if ( pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+                if(pSh->GetItem(SID_GRADIENT_LIST))
                 {
-                    SvxGradientListItem aItem( *(const SvxGradientListItem*)(
-                        pSh->GetItem( SID_GRADIENT_LIST ) ) );
-                    pLbFillAttr->Enable();
-                    pLbFillAttr->Fill( aItem.GetGradientList() );
+                    const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST));
+                    mpLbFillAttr->Enable();
+                    mpLbFillAttr->Fill(pItem->GetGradientList());
+                    bDone = true;
                 }
-                else
-                    pLbFillAttr->Disable();
+                break;
             }
-            break;
 
             case XFILL_HATCH:
             {
-                if ( pSh && pSh->GetItem( SID_HATCH_LIST ) )
+                if(pSh->GetItem(SID_HATCH_LIST))
                 {
-                    SvxHatchListItem aItem( *(const SvxHatchListItem*)(
-                        pSh->GetItem( SID_HATCH_LIST ) ) );
-                    pLbFillAttr->Enable();
-                    pLbFillAttr->Fill( aItem.GetHatchList() );
+                    const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST));
+                    mpLbFillAttr->Enable();
+                    mpLbFillAttr->Fill(pItem->GetHatchList());
+                    bDone = true;
                 }
-                else
-                    pLbFillAttr->Disable();
+                break;
             }
-            break;
 
             case XFILL_BITMAP:
             {
-                if ( pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+                if(pSh->GetItem(SID_BITMAP_LIST))
                 {
-                    SvxBitmapListItem aItem( *(const SvxBitmapListItem*)(
-                        pSh->GetItem( SID_BITMAP_LIST ) ) );
-                    pLbFillAttr->Enable();
-                    pLbFillAttr->Fill( aItem.GetBitmapList() );
+                    const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST));
+                    mpLbFillAttr->Enable();
+                    mpLbFillAttr->Fill(pItem->GetBitmapList());
+                    bDone = true;
                 }
-                else
-                    pLbFillAttr->Disable();
+                break;
+            }
+            default: // XFILL_NONE
+            {
+                // accept disable (no styles for XFILL_NONE)
+                break;
             }
-            break;
         }
+    }
 
-        if( eXFS != XFILL_NONE ) // Has already been done
-        {
-            if ( pBox )
-                pLbFillType->Selected();
+    if (!bDone)
+    {
+        mpLbFillAttr->Disable();
+    }
+}
 
-            // release focus
-            if ( pBox && pLbFillType->IsRelease() )
-            {
-                SfxViewShell* pViewShell = SfxViewShell::Current();
-                if( pViewShell && pViewShell->GetWindow() )
-                    pViewShell->GetWindow()->GrabFocus();
-            }
+void FillControl::updateLastFillTypeControlSelectEntryPos()
+{
+    mnLastFillTypeControlSelectEntryPos = mpLbFillType->GetSelectEntryPos();
+}
+
+IMPL_LINK(FillControl,SelectFillTypeHdl,ListBox *,pBox)
+{
+    if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here
+    {
+        return 0;
+    }
+
+    const bool bAction(
+           !mpLbFillType->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list
+        && mpLbFillType->GetSelectEntryCount()
+        && mpLbFillType->GetSelectEntryPos() != mnLastFillTypeControlSelectEntryPos);
+
+    updateLastFillTypeControlSelectEntryPos();
+    XFillStyle eXFS = static_cast< XFillStyle >(mpLbFillType->GetSelectEntryPos());
+
+    if(bAction && XFILL_NONE != eXFS)
+    {
+        mbFillTypeChanged = true;
+    }
+
+    // update list of FillStyles in any case
+    InitializeFillStyleAccordingToGivenFillType(eXFS);
+
+    // for XFILL_NONE do no longer call SelectFillAttrHdl (as done before),
+    // trigger needed actions directly. This is the only action this handler
+    // can trigger directly as the user action is finished in this case
+    if(XFILL_NONE == eXFS && bAction)
+    {
+        // for XFILL_NONE do no longer call SelectFillAttrHdl,
+        // trigger needed actions directly
+        Any a;
+        Sequence< PropertyValue > aArgsFillStyle(1);
+        XFillStyleItem aXFillStyleItem(eXFS);
+
+        aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
+        aXFillStyleItem.QueryValue(a);
+        aArgsFillStyle[0].Value = a;
+        ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle);
+    }
+
+    mpLbFillType->Selected();
+
+    // release focus. Needed to get focus automatically back to EditView
+    if(mpLbFillType->IsRelease())
+    {
+        SfxViewShell* pViewShell = SfxViewShell::Current();
+
+        if(pViewShell && pViewShell->GetWindow())
+        {
+            pViewShell->GetWindow()->GrabFocus();
         }
     }
+
     return 0;
 }
 
 
 
-IMPL_LINK( FillControl, SelectFillAttrHdl, ListBox *, pBox )
+void FillControl::updateLastFillAttrControlSelectEntryPos()
 {
-    XFillStyle eXFS = (XFillStyle)pLbFillType->GetSelectEntryPos();
-    XFillStyleItem aXFillStyleItem( eXFS );
-    bool bAction = pBox && !pLbFillAttr->IsTravelSelect();
+    mnLastFillAttrControlSelectEntryPos = mpLbFillAttr->GetSelectEntryPos();
+}
 
-    SfxObjectShell* pSh = SfxObjectShell::Current();
-    if ( bAction )
+IMPL_LINK(FillControl, SelectFillAttrHdl, ListBox *, pBox)
+{
+    if(!pBox) // only work with real calls from ListBox, do not accept direct calls with zeros here
     {
-        Any a;
-        Sequence< PropertyValue > aArgs( 1 );
+        return 0;
+    }
 
-        // First set the style
-        aArgs[0].Name = "FillStyle";
-        aXFillStyleItem.QueryValue(  a );
-        aArgs[0].Value = a;
-        ((SvxFillToolBoxControl*)GetData())->Dispatch(
-            OUString( ".uno:FillStyle" ), aArgs );
+    const bool bAction(
+           !mpLbFillAttr->IsTravelSelect() // keep TravelSelect, this means keyboard up/down in the list
+        && mpLbFillAttr->GetSelectEntryCount()
+        && mpLbFillAttr->GetSelectEntryPos() != mnLastFillAttrControlSelectEntryPos);
 
-        switch( eXFS )
+    updateLastFillAttrControlSelectEntryPos();
+
+    if(bAction)
+    {
+        SfxObjectShell* pSh = SfxObjectShell::Current();
+
+        // Need to prepare the PropertyValue for the FillStyle dispatch action early,
+        // else the call for FillType to Dispatch(".uno:FillStyle") will already destroy the current state
+        // of selection in mpLbFillAttr again by calls to StateChanged which *will* set to no
+        // selection again (e.g. when two objects, same fill style, but different fill attributes)
+        Any a;
+        Sequence< PropertyValue > aArgsFillAttr(1);
+        OUString aFillAttrCommand;
+        XFillStyle eXFS(static_cast< XFillStyle >(mpLbFillType->GetSelectEntryPos()));
+
+        switch(eXFS)
         {
             case XFILL_NONE:
             {
+                // handled in SelectFillTypeHdl, nothing to do here
+                break;
             }
-            break;
 
             case XFILL_SOLID:
             {
                 // Entry gets tested against temporary color
-                OUString aTmpStr = pLbFillAttr->GetSelectEntry();
+                OUString aTmpStr = mpLbFillAttr->GetSelectEntry();
                 if( aTmpStr.startsWith(TMP_STR_BEGIN) && aTmpStr.endsWith(TMP_STR_END) )
                 {
                     aTmpStr = aTmpStr.copy(1, aTmpStr.getLength()-2);
                 }
 
-                XFillColorItem aXFillColorItem( aTmpStr, pLbFillAttr->GetSelectEntryColor() );
-
-                aArgs[0].Name = "FillColor";
-                aXFillColorItem.QueryValue( a );
-                aArgs[0].Value = a;
-                ((SvxFillToolBoxControl*)GetData())->Dispatch( ".uno:FillColor",
-                                                               aArgs );
+                XFillColorItem aXFillColorItem(aTmpStr, mpLbFillAttr->GetSelectEntryColor());
+                aArgsFillAttr[0].Name = "FillColor";
+                aXFillColorItem.QueryValue(a);
+                aArgsFillAttr[0].Value = a;
+                aFillAttrCommand = ".uno:FillColor";
+                break;
             }
-            break;
             case XFILL_GRADIENT:
             {
-                sal_Int32 nPos = pLbFillAttr->GetSelectEntryPos();
-
-                if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_GRADIENT_LIST ) )
+                sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
+                if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_GRADIENT_LIST))
                 {
-                    SvxGradientListItem aItem(
-                        *(const SvxGradientListItem*)( pSh->GetItem( SID_GRADIENT_LIST ) ) );
+                    const SvxGradientListItem* pItem = static_cast< const SvxGradientListItem* >(pSh->GetItem(SID_GRADIENT_LIST));
 
-                    if ( nPos < aItem.GetGradientList()->Count() )  // no temporary entry?
+                    if (nPos < pItem->GetGradientList()->Count())  // no temporary entry?
                     {
-                        XGradient aGradient = aItem.GetGradientList()->GetGradient( nPos )->GetGradient();
-                        XFillGradientItem aXFillGradientItem( pLbFillAttr->GetSelectEntry(), aGradient );
-
-                        aArgs[0].Name = "FillGradient";
-                        aXFillGradientItem.QueryValue( a );
-                        aArgs[0].Value = a;
-                        ((SvxFillToolBoxControl*)GetData())->Dispatch( OUString( ".uno:FillGradient" ),
-                                                                       aArgs );
+                        XGradient aGradient = pItem->GetGradientList()->GetGradient(nPos)->GetGradient();
+                        XFillGradientItem aXFillGradientItem(mpLbFillAttr->GetSelectEntry(),aGradient);
+                        aArgsFillAttr[0].Name = "FillGradient";
+                        aXFillGradientItem.QueryValue(a);
+                        aArgsFillAttr[0].Value = a;
+                        aFillAttrCommand = ".uno:FillGradient";
                     }
                 }
+                break;
             }
-            break;
 
             case XFILL_HATCH:
             {
-                sal_Int32 nPos = pLbFillAttr->GetSelectEntryPos();
-
-                if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_HATCH_LIST ) )
+                sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
+                if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_HATCH_LIST))
                 {
-                    SvxHatchListItem aItem( *(const SvxHatchListItem*)( pSh->GetItem( SID_HATCH_LIST ) ) );
+                    const SvxHatchListItem* pItem = static_cast< const SvxHatchListItem* >(pSh->GetItem(SID_HATCH_LIST));
 
-                    if ( nPos < aItem.GetHatchList()->Count() )  // no temporary entry?
+                    if (nPos < pItem->GetHatchList()->Count())  // no temporary entry?
                     {
-                        XHatch aHatch = aItem.GetHatchList()->GetHatch( nPos )->GetHatch();
-                        XFillHatchItem aXFillHatchItem( pLbFillAttr->GetSelectEntry(), aHatch );
-
-                        aArgs[0].Name = "FillHatch";
-                        aXFillHatchItem.QueryValue( a );
-                        aArgs[0].Value = a;
-                        ((SvxFillToolBoxControl*)GetData())->Dispatch( OUString( ".uno:FillHatch" ),
-                                                                       aArgs );
+                        XHatch aHatch = pItem->GetHatchList()->GetHatch(nPos)->GetHatch();
+                        XFillHatchItem aXFillHatchItem(mpLbFillAttr->GetSelectEntry(), aHatch);
+
+                        aArgsFillAttr[0].Name = "FillHatch";
+                        aXFillHatchItem.QueryValue(a);
+                        aArgsFillAttr[0].Value = a;
+                        aFillAttrCommand = ".uno:FillHatch";
                     }
                 }
+                break;
             }
-            break;
 
             case XFILL_BITMAP:
             {
-                sal_Int32 nPos = pLbFillAttr->GetSelectEntryPos();
-
-                if ( nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem( SID_BITMAP_LIST ) )
+                sal_Int32 nPos = mpLbFillAttr->GetSelectEntryPos();
+                if (nPos != LISTBOX_ENTRY_NOTFOUND && pSh && pSh->GetItem(SID_BITMAP_LIST))
                 {
-                    SvxBitmapListItem aItem(
-                        *(const SvxBitmapListItem*)( pSh->GetItem( SID_BITMAP_LIST ) ) );
+                    const SvxBitmapListItem* pItem = static_cast< const SvxBitmapListItem* >(pSh->GetItem(SID_BITMAP_LIST));
 
-                    if ( nPos < aItem.GetBitmapList()->Count() )  // no temporary entry?
+                    if (nPos < pItem->GetBitmapList()->Count())  // no temporary entry?
                     {
-                        const XBitmapEntry* pXBitmapEntry = aItem.GetBitmapList()->GetBitmap(nPos);
-                        const XFillBitmapItem aXFillBitmapItem(pLbFillAttr->GetSelectEntry(), pXBitmapEntry->GetGraphicObject());
+                        const XBitmapEntry* pXBitmapEntry = pItem->GetBitmapList()->GetBitmap(nPos);
+                        const XFillBitmapItem aXFillBitmapItem(mpLbFillAttr->GetSelectEntry(),pXBitmapEntry->GetGraphicObject());
 
-                        aArgs[0].Name = "FillBitmap";
-                        aXFillBitmapItem.QueryValue( a );
-                        aArgs[0].Value = a;
-                        ((SvxFillToolBoxControl*)GetData())->Dispatch(OUString(".uno:FillBitmap"), aArgs);
+                        aArgsFillAttr[0].Name = "FillBitmap";
+                        aXFillBitmapItem.QueryValue(a);
+                        aArgsFillAttr[0].Value = a;
+                        aFillAttrCommand = ".uno:FillBitmap";
                     }
                 }
+                break;
             }
-            break;
         }
 
-        // release focus
-        if ( pLbFillAttr->IsRelease()  && pBox )
+        // this is the place where evtl. a new slot action may be introduced to avoid the
+        // two undo entries. Reason for this is that indeed two actions are executed, the fill style
+        // and the fill attribute change. The sidebar already handles both separately, so
+        // changing the fill style already changes the object and adds a default fill attribute for
+        // the newly choosen fill style.
+        // This control uses the older user's two-step action to select a fill style and a fill attribute. In
+        // this case a lot of things may go wrong (e.g. the user stops that action and does something
+        // different), thus the solution of the sidebar should be preferred from my POV in the future
+
+        // first set the fill style if changed
+        if(mbFillTypeChanged)
+        {
+            Sequence< PropertyValue > aArgsFillStyle(1);
+            XFillStyleItem aXFillStyleItem(eXFS);
+
+            aArgsFillStyle[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("FillStyle"));
+            aXFillStyleItem.QueryValue(a);
+            aArgsFillStyle[0].Value = a;
+            ((SvxFillToolBoxControl*)GetData())->Dispatch(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".uno:FillStyle")), aArgsFillStyle);
+            mbFillTypeChanged = false;
+        }
+
+        // second set fill attribute when a change was detected and prepared
+        if(aFillAttrCommand.getLength())
+        {
+            ((SvxFillToolBoxControl*)GetData())->Dispatch(aFillAttrCommand, aArgsFillAttr);
+        }
+
+        // release focus. Needed to get focus automatically back to EditView
+        if(mpLbFillAttr->IsRelease() && pBox)
         {
             SfxViewShell* pViewShell = SfxViewShell::Current();
-            if( pViewShell && pViewShell->GetWindow() )
+
+            if(pViewShell && pViewShell->GetWindow())
             {
                 pViewShell->GetWindow()->GrabFocus();
             }
@@ -781,29 +883,30 @@ void FillControl::Resize()
     long nH = 180;
     long nSep = 0; // was previously 4
 
-    pLbFillType->SetSizePixel( Size( nW * 2 - nSep, nH ) );
-    pLbFillAttr->SetPosSizePixel( Point( nW * 2 + nSep, 0 ), Size( nW * 3 - nSep, nH ) );
+    mpLbFillType->SetSizePixel(Size(nW * 2 - nSep,nH));
+    mpLbFillAttr->SetPosSizePixel(Point(nW * 2 + nSep,0),Size(nW * 3 - nSep,nH));
 }
 
-void FillControl::DataChanged( const DataChangedEvent& rDCEvt )
+void FillControl::DataChanged(const DataChangedEvent& rDCEvt)
 {
-    if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
-         (rDCEvt.GetFlags() & SETTINGS_STYLE) )
+    if((rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
+        (rDCEvt.GetFlags() & SETTINGS_STYLE))
     {
-        Size aTypeSize(LogicToPixel(aLogicalFillSize, MAP_APPFONT));
-        Size aAttrSize(LogicToPixel(aLogicalAttrSize, MAP_APPFONT));
-        pLbFillType->SetSizePixel(aTypeSize);
-        pLbFillAttr->SetSizePixel(aAttrSize);
+        Size aTypeSize(LogicToPixel(maLogicalFillSize,MAP_APPFONT));
+        Size aAttrSize(LogicToPixel(maLogicalAttrSize,MAP_APPFONT));
+        mpLbFillType->SetSizePixel(aTypeSize);
+        mpLbFillAttr->SetSizePixel(aAttrSize);
+
         //to get the base height
-        aTypeSize = pLbFillType->GetSizePixel();
-        aAttrSize = pLbFillAttr->GetSizePixel();
-        Point aAttrPnt = pLbFillAttr->GetPosPixel();
+        aTypeSize = mpLbFillType->GetSizePixel();
+        aAttrSize = mpLbFillAttr->GetSizePixel();
+        Point aAttrPnt = mpLbFillAttr->GetPosPixel();
 
         SetSizePixel(
-            Size( aAttrPnt.X() + aAttrSize.Width(),
-                std::max( aAttrSize.Height(), aTypeSize.Height() ) ) );
+            Size(aAttrPnt.X() + aAttrSize.Width(),
+                std::max(aAttrSize.Height(), aTypeSize.Height())));
     }
-    Window::DataChanged( rDCEvt );
+    Window::DataChanged(rDCEvt);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list