LCOV - code coverage report
Current view: top level - svx/source/tbxctrls - tbcontrl.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 392 1108 35.4 %
Date: 2012-08-25 Functions: 65 152 42.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 301 1751 17.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #include <string>
      30                 :            : #include <tools/shl.hxx>
      31                 :            : #include <tools/color.hxx>
      32                 :            : #include <svl/poolitem.hxx>
      33                 :            : #include <svl/eitem.hxx>
      34                 :            : #include <vcl/toolbox.hxx>
      35                 :            : #include <vcl/bmpacc.hxx>
      36                 :            : #include <svtools/valueset.hxx>
      37                 :            : #include <svtools/ctrlbox.hxx>
      38                 :            : #include <svl/style.hxx>
      39                 :            : #include <svtools/ctrltool.hxx>
      40                 :            : #include <svtools/borderhelper.hxx>
      41                 :            : #include <svl/stritem.hxx>
      42                 :            : #include <unotools/pathoptions.hxx>
      43                 :            : #include <sfx2/tplpitem.hxx>
      44                 :            : #include <sfx2/dispatch.hxx>
      45                 :            : #include <sfx2/viewsh.hxx>
      46                 :            : #include <sfx2/objsh.hxx>
      47                 :            : #include <sfx2/docfac.hxx>
      48                 :            : #include <sfx2/templdlg.hxx>
      49                 :            : #include <svl/isethint.hxx>
      50                 :            : #include <sfx2/querystatus.hxx>
      51                 :            : #include <sfx2/sfxstatuslistener.hxx>
      52                 :            : #include <tools/urlobj.hxx>
      53                 :            : #include <sfx2/childwin.hxx>
      54                 :            : #include <sfx2/viewfrm.hxx>
      55                 :            : #include <unotools/fontoptions.hxx>
      56                 :            : #include <vcl/mnemonic.hxx>
      57                 :            : #include <vcl/svapp.hxx>
      58                 :            : #include <svl/smplhint.hxx>
      59                 :            : #include <svtools/colorcfg.hxx>
      60                 :            : #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
      61                 :            : #include <com/sun/star/lang/XServiceInfo.hpp>
      62                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      63                 :            : #include <com/sun/star/frame/status/ItemStatus.hpp>
      64                 :            : #include <svx/dialogs.hrc>
      65                 :            : #include <svx/svxitems.hrc>
      66                 :            : #include "helpid.hrc"
      67                 :            : #include "svx/htmlmode.hxx"
      68                 :            : #include <svx/xtable.hxx>
      69                 :            : #include "editeng/fontitem.hxx"
      70                 :            : #include <editeng/fhgtitem.hxx>
      71                 :            : #include <editeng/brshitem.hxx>
      72                 :            : #include <editeng/boxitem.hxx>
      73                 :            : #include <editeng/colritem.hxx>
      74                 :            : #include "editeng/flstitem.hxx"
      75                 :            : #include "editeng/bolnitem.hxx"
      76                 :            : #include "svx/drawitem.hxx"
      77                 :            : #include <svx/tbcontrl.hxx>
      78                 :            : #include "svx/dlgutil.hxx"
      79                 :            : #include <svx/dialmgr.hxx>
      80                 :            : #include "colorwindow.hxx"
      81                 :            : #include <memory>
      82                 :            : 
      83                 :            : #include <svx/framelink.hxx>
      84                 :            : #include <svx/tbxcolorupdate.hxx>
      85                 :            : #include <editeng/eerdll.hxx>
      86                 :            : #include <editeng/editrids.hrc>
      87                 :            : 
      88                 :            : // ------------------------------------------------------------------------
      89                 :            : 
      90                 :            : #define MAX_MRU_FONTNAME_ENTRIES    5
      91                 :            : #define LOGICAL_EDIT_HEIGHT         12
      92                 :            : 
      93                 :            : // STATIC DATA -----------------------------------------------------------
      94                 :            : 
      95                 :            : #ifndef DELETEZ
      96                 :            : #define DELETEZ(p) (delete (p), (p)=NULL)
      97                 :            : #endif
      98                 :            : // don't make more than 15 entries visible at once
      99                 :            : #define MAX_STYLES_ENTRIES          static_cast< sal_uInt16 >( 15 )
     100                 :            : 
     101                 :            : void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet );
     102                 :            : void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
     103                 :            : 
     104                 :            : // namespaces
     105                 :            : using ::rtl::OUString;
     106                 :            : using namespace ::editeng;
     107                 :            : using namespace ::com::sun::star;
     108                 :            : using namespace ::com::sun::star::uno;
     109                 :            : using namespace ::com::sun::star::frame;
     110                 :            : using namespace ::com::sun::star::beans;
     111                 :            : using namespace ::com::sun::star::lang;
     112                 :            : 
     113         [ +  - ]:       1110 : SFX_IMPL_TOOLBOX_CONTROL( SvxStyleToolBoxControl, SfxTemplateItem );
     114         [ +  - ]:       1110 : SFX_IMPL_TOOLBOX_CONTROL( SvxFontNameToolBoxControl, SvxFontItem );
     115         [ #  # ]:         98 : SFX_IMPL_TOOLBOX_CONTROL( SvxFontColorToolBoxControl, SvxColorItem );
     116         [ +  - ]:       3336 : SFX_IMPL_TOOLBOX_CONTROL( SvxColorExtToolBoxControl, SvxColorItem );
     117         [ +  - ]:        352 : SFX_IMPL_TOOLBOX_CONTROL( SvxFrameToolBoxControl, SvxBoxItem );
     118         [ +  - ]:        352 : SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineStyleToolBoxControl, SvxLineItem );
     119         [ #  # ]:         25 : SFX_IMPL_TOOLBOX_CONTROL( SvxFrameLineColorToolBoxControl, SvxColorItem );
     120         [ #  # ]:          0 : SFX_IMPL_TOOLBOX_CONTROL( SvxSimpleUndoRedoController, SfxStringItem );
     121                 :            : 
     122                 :            : //========================================================================
     123                 :            : // class SvxStyleBox_Impl -----------------------------------------------------
     124                 :            : //========================================================================
     125                 :            : 
     126                 :            : 
     127                 :            : class SvxStyleBox_Impl : public ComboBox
     128                 :            : {
     129                 :            :     using Window::IsVisible;
     130                 :            : public:
     131                 :            :     SvxStyleBox_Impl( Window* pParent, const OUString& rCommand, SfxStyleFamily eFamily, const Reference< XDispatchProvider >& rDispatchProvider,
     132                 :            :                         const Reference< XFrame >& _xFrame,const String& rClearFormatKey, const String& rMoreKey, sal_Bool bInSpecialMode );
     133                 :            :     ~SvxStyleBox_Impl();
     134                 :            : 
     135                 :            :     void            SetFamily( SfxStyleFamily eNewFamily );
     136                 :       3225 :     inline sal_Bool     IsVisible() { return bVisible; }
     137                 :            : 
     138                 :            :     virtual long    PreNotify( NotifyEvent& rNEvt );
     139                 :            :     virtual long    Notify( NotifyEvent& rNEvt );
     140                 :            :     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
     141                 :            :     virtual void    StateChanged( StateChangedType nStateChange );
     142                 :            : 
     143                 :        961 :     inline void     SetVisibilityListener( const Link& aVisListener ) { aVisibilityListener = aVisListener; }
     144                 :            :     inline void     RemoveVisibilityListener() { aVisibilityListener = Link(); }
     145                 :            : 
     146                 :        957 :     void            SetDefaultStyle( const ::rtl::OUString& rDefault ) { sDefaultStyle = rDefault; }
     147                 :            :     DECL_STATIC_LINK( SvxStyleBox_Impl, FocusHdl_Impl, Control* );
     148                 :            : 
     149                 :            : protected:
     150                 :            :     virtual void    Select();
     151                 :            : 
     152                 :            : private:
     153                 :            :     SfxStyleFamily                  eStyleFamily;
     154                 :            :     sal_uInt16                          nCurSel;
     155                 :            :     sal_Bool                            bRelease;
     156                 :            :     Size                            aLogicalSize;
     157                 :            :     Link                            aVisibilityListener;
     158                 :            :     sal_Bool                            bVisible;
     159                 :            :     Reference< XDispatchProvider >  m_xDispatchProvider;
     160                 :            :     Reference< XFrame >             m_xFrame;
     161                 :            :     OUString                        m_aCommand;
     162                 :            :     String                          aClearFormatKey;
     163                 :            :     String                          aMoreKey;
     164                 :            :     String                          sDefaultStyle;
     165                 :            :     sal_Bool                            bInSpecialMode;
     166                 :            : 
     167                 :            :     void            ReleaseFocus();
     168                 :            : };
     169                 :            : 
     170                 :            : //========================================================================
     171                 :            : // class SvxFontNameBox --------------------------------------------------
     172                 :            : //========================================================================
     173                 :            : 
     174 [ +  - ][ +  - ]:       1922 : class SvxFontNameBox_Impl : public FontNameBox
         [ +  - ][ -  + ]
     175                 :            : {
     176                 :            :     using Window::Update;
     177                 :            : private:
     178                 :            :     const FontList*                pFontList;
     179                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     180                 :            :     ::std::auto_ptr<FontList>      m_aOwnFontList;
     181                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
     182                 :            :     Font                           aCurFont;
     183                 :            :     Size                           aLogicalSize;
     184                 :            :     String                         aCurText;
     185                 :            :     sal_uInt16                         nFtCount;
     186                 :            :     sal_Bool                           bRelease;
     187                 :            :     Reference< XDispatchProvider > m_xDispatchProvider;
     188                 :            :     Reference< XFrame >            m_xFrame;
     189                 :            : 
     190                 :            :     void            ReleaseFocus_Impl();
     191                 :            :     void            EnableControls_Impl();
     192                 :            : 
     193                 :            : protected:
     194                 :            :     virtual void    Select();
     195                 :            :     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
     196                 :            : 
     197                 :            : public:
     198                 :            :     SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame
     199                 :            :         , WinBits nStyle = WB_SORT
     200                 :            :         );
     201                 :            : 
     202                 :            :     void            FillList();
     203                 :            :     void            Update( const SvxFontItem* pFontItem );
     204                 :          0 :     sal_uInt16          GetListCount() { return nFtCount; }
     205                 :        961 :     void            Clear() { FontNameBox::Clear(); nFtCount = 0; }
     206                 :          2 :     void            Fill( const FontList* pList )
     207                 :          2 :                         { FontNameBox::Fill( pList );
     208                 :          2 :                           nFtCount = pList->GetFontNameCount(); }
     209                 :            :     virtual long    PreNotify( NotifyEvent& rNEvt );
     210                 :            :     virtual long    Notify( NotifyEvent& rNEvt );
     211                 :            :     virtual Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
     212                 :            :     SAL_WNODEPRECATED_DECLARATIONS_PUSH
     213                 :          0 :     void     SetOwnFontList(::std::auto_ptr<FontList> _aOwnFontList) { m_aOwnFontList = _aOwnFontList; }
     214                 :            :     SAL_WNODEPRECATED_DECLARATIONS_POP
     215                 :            : };
     216                 :            : 
     217                 :            : //========================================================================
     218                 :            : // class SvxFrameWindow_Impl --------------------------------------------------
     219                 :            : //========================================================================
     220                 :            : 
     221                 :            : // fuer den SelectHdl werden die Modifier gebraucht, also
     222                 :            : // muss man sie im MouseButtonUp besorgen
     223                 :            : 
     224         [ #  # ]:          0 : class SvxFrmValueSet_Impl : public ValueSet
     225                 :            : {
     226                 :            :     sal_uInt16          nModifier;
     227                 :            :     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
     228                 :            : public:
     229                 :          0 :     SvxFrmValueSet_Impl(Window* pParent,  WinBits nWinStyle)
     230                 :          0 :         : ValueSet(pParent, nWinStyle), nModifier(0) {}
     231                 :          0 :     sal_uInt16          GetModifier() const {return nModifier;}
     232                 :            : 
     233                 :            : };
     234                 :            : 
     235                 :          0 : void SvxFrmValueSet_Impl::MouseButtonUp( const MouseEvent& rMEvt )
     236                 :            : {
     237                 :          0 :     nModifier = rMEvt.GetModifier();
     238                 :          0 :     ValueSet::MouseButtonUp(rMEvt);
     239                 :          0 : }
     240                 :            : 
     241                 :            : class SvxFrameWindow_Impl : public SfxPopupWindow
     242                 :            : {
     243                 :            :     using FloatingWindow::StateChanged;
     244                 :            : 
     245                 :            : private:
     246                 :            :     SvxFrmValueSet_Impl  aFrameSet;
     247                 :            :     ImageList       aImgList;
     248                 :            :     sal_Bool        bParagraphMode;
     249                 :            : 
     250                 :            : #if _SOLAR__PRIVATE
     251                 :            :     DECL_LINK( SelectHdl, void * );
     252                 :            : #endif
     253                 :            : 
     254                 :            : protected:
     255                 :            :     virtual void    Resize();
     256                 :            :     virtual sal_Bool    Close();
     257                 :            :     virtual Window* GetPreferredKeyInputWindow();
     258                 :            :     virtual void    GetFocus();
     259                 :            : 
     260                 :            : public:
     261                 :            :     SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow );
     262                 :            :     ~SvxFrameWindow_Impl();
     263                 :            :     void            StartSelection();
     264                 :            : 
     265                 :            :     virtual void    StateChanged( sal_uInt16 nSID, SfxItemState eState,
     266                 :            :                                   const SfxPoolItem* pState );
     267                 :            :     virtual SfxPopupWindow* Clone() const;
     268                 :            :     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
     269                 :            : };
     270                 :            : 
     271                 :            : //========================================================================
     272                 :            : // class SvxLineWindow_Impl ---------------------------------------------------
     273                 :            : //========================================================================
     274 [ #  # ][ #  # ]:          0 : class SvxLineWindow_Impl : public SfxPopupWindow
     275                 :            : {
     276                 :            : private:
     277                 :            :     LineListBox         m_aLineStyleLb;
     278                 :            :     bool                m_bIsWriter;
     279                 :            : 
     280                 :            : #if _SOLAR__PRIVATE
     281                 :            :     DECL_LINK( SelectHdl, void * );
     282                 :            : #endif
     283                 :            : 
     284                 :            : protected:
     285                 :            :     virtual void    Resize();
     286                 :            :     virtual sal_Bool    Close();
     287                 :            :     virtual Window* GetPreferredKeyInputWindow();
     288                 :            :     virtual void    GetFocus();
     289                 :            :     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
     290                 :            : public:
     291                 :            :     SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow );
     292                 :            : 
     293                 :            :     virtual SfxPopupWindow* Clone() const;
     294                 :            : };
     295                 :            : 
     296                 :            : //########################################################################
     297                 :            : // Hilfsklassen:
     298                 :            : //========================================================================
     299                 :            : // class SfxStyleControllerItem ------------------------------------------
     300                 :            : //========================================================================
     301                 :            : class SvxStyleToolBoxControl;
     302                 :            : 
     303         [ -  + ]:       9610 : class SfxStyleControllerItem_Impl : public SfxStatusListener
     304                 :            : {
     305                 :            :     public:
     306                 :            :         SfxStyleControllerItem_Impl( const Reference< XDispatchProvider >& rDispatchProvider,
     307                 :            :                                      sal_uInt16 nSlotId,
     308                 :            :                                      const rtl::OUString& rCommand,
     309                 :            :                                      SvxStyleToolBoxControl& rTbxCtl );
     310                 :            : 
     311                 :            :     protected:
     312                 :            :         virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
     313                 :            : 
     314                 :            :     private:
     315                 :            :         SvxStyleToolBoxControl& rControl;
     316                 :            : };
     317                 :            : 
     318                 :            : //========================================================================
     319                 :            : // class SvxStyleBox_Impl -----------------------------------------------------
     320                 :            : //========================================================================
     321                 :            : 
     322                 :        961 : SvxStyleBox_Impl::SvxStyleBox_Impl(
     323                 :            :     Window*                                 pParent,
     324                 :            :     const rtl::OUString&                    rCommand,
     325                 :            :     SfxStyleFamily                          eFamily,
     326                 :            :     const Reference< XDispatchProvider >&   rDispatchProvider,
     327                 :            :     const Reference< XFrame >&              _xFrame,
     328                 :            :     const String&                           rClearFormatKey,
     329                 :            :     const String&                           rMoreKey,
     330                 :            :     sal_Bool                                    bInSpec) :
     331                 :            : 
     332                 :        961 :     ComboBox( pParent, SVX_RES( RID_SVXTBX_STYLE ) ),
     333                 :            : 
     334                 :            :     eStyleFamily( eFamily ),
     335                 :            :     bRelease    ( sal_True ),
     336                 :            :     bVisible(sal_False),
     337                 :            :     m_xDispatchProvider( rDispatchProvider ),
     338                 :            :     m_xFrame(_xFrame),
     339                 :            :     m_aCommand  ( rCommand ),
     340                 :            :     aClearFormatKey ( rClearFormatKey ),
     341                 :            :     aMoreKey        ( rMoreKey ),
     342 [ +  - ][ +  - ]:        961 :     bInSpecialMode  ( bInSpec )
         [ +  - ][ +  - ]
                 [ +  - ]
     343                 :            : {
     344 [ +  - ][ +  - ]:        961 :     aLogicalSize = PixelToLogic( GetSizePixel(), MAP_APPFONT );
         [ +  - ][ +  - ]
     345         [ +  - ]:        961 :     EnableAutocomplete( sal_True );
     346                 :        961 : }
     347                 :            : 
     348 [ +  - ][ +  - ]:        961 : SvxStyleBox_Impl::~SvxStyleBox_Impl()
                 [ +  - ]
     349                 :            : {
     350         [ -  + ]:       1922 : }
     351                 :            : 
     352                 :            : // -----------------------------------------------------------------------
     353                 :            : 
     354                 :          0 : void SvxStyleBox_Impl::ReleaseFocus()
     355                 :            : {
     356         [ #  # ]:          0 :     if ( !bRelease )
     357                 :            :     {
     358                 :          0 :         bRelease = sal_True;
     359                 :          0 :         return;
     360                 :            :     }
     361 [ #  # ][ #  # ]:          0 :     if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     362 [ #  # ][ #  # ]:          0 :         m_xFrame->getContainerWindow()->setFocus();
     363                 :            : }
     364                 :            : 
     365                 :            : // -----------------------------------------------------------------------
     366                 :            : 
     367                 :          0 : void SvxStyleBox_Impl::Select()
     368                 :            : {
     369                 :            :     // Tell base class about selection so that AT get informed about it.
     370                 :          0 :     ComboBox::Select();
     371                 :            : 
     372         [ #  # ]:          0 :     if ( !IsTravelSelect() )
     373                 :            :     {
     374         [ #  # ]:          0 :         String aSelEntry( GetText() );
     375                 :          0 :         bool bDoIt = true, bClear = false;
     376         [ #  # ]:          0 :         if( bInSpecialMode )
     377                 :            :         {
     378 [ #  # ][ #  # ]:          0 :             if( aSelEntry == aClearFormatKey && GetSelectEntryPos() == 0 )
         [ #  # ][ #  # ]
                 [ #  # ]
     379                 :            :             {
     380         [ #  # ]:          0 :                 aSelEntry = sDefaultStyle;
     381                 :          0 :                 bClear = true;
     382                 :            :                 //not only apply default style but also call 'ClearFormatting'
     383         [ #  # ]:          0 :                 Sequence< PropertyValue > aEmptyVals;
     384                 :            :                 SfxToolBoxControl::Dispatch( m_xDispatchProvider, rtl::OUString(".uno:ResetAttributes"),
     385 [ #  # ][ #  # ]:          0 :                     aEmptyVals);
     386                 :            :             }
     387 [ #  # ][ #  # ]:          0 :             else if( aSelEntry == aMoreKey && GetSelectEntryPos() == ( GetEntryCount() - 1 ) )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     388                 :            :             {
     389         [ #  # ]:          0 :                 SfxViewFrame* pViewFrm = SfxViewFrame::Current();
     390                 :            :                 DBG_ASSERT( pViewFrm, "SvxStyleBox_Impl::Select(): no viewframe" );
     391         [ #  # ]:          0 :                 pViewFrm->ShowChildWindow( SID_STYLE_DESIGNER );
     392         [ #  # ]:          0 :                 SfxChildWindow* pChildWin = pViewFrm->GetChildWindow( SID_STYLE_DESIGNER );
     393 [ #  # ][ #  # ]:          0 :                 if ( pChildWin && pChildWin->GetWindow() )
                 [ #  # ]
     394                 :            :                 {
     395         [ #  # ]:          0 :                     static_cast< SfxTemplateDialogWrapper* >( pChildWin )->SetParagraphFamily();
     396         [ #  # ]:          0 :                     static_cast< SfxDockingWindow* >( pChildWin->GetWindow() )->AutoShow( sal_True );
     397                 :            :                     Application::PostUserEvent(
     398 [ #  # ][ #  # ]:          0 :                         STATIC_LINK( 0, SvxStyleBox_Impl, FocusHdl_Impl ), pChildWin->GetWindow() );
     399                 :            :                 }
     400                 :          0 :                 bDoIt = false;
     401                 :            :             }
     402                 :            :         }
     403                 :            : 
     404                 :            :         // #i36723# after ReleaseFocus() the new entry is included into the List
     405         [ #  # ]:          0 :         sal_Bool bCreateNew = GetSelectEntryPos() == LISTBOX_ENTRY_NOTFOUND;
     406                 :            : 
     407                 :            :         /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
     408                 :            :             This instance may be deleted in the meantime (i.e. when a dialog is opened
     409                 :            :             while in Dispatch()), accessing members will crash in this case. */
     410         [ #  # ]:          0 :         ReleaseFocus();
     411                 :            : 
     412         [ #  # ]:          0 :         if( bDoIt )
     413                 :            :         {
     414         [ #  # ]:          0 :             if ( bClear )
     415         [ #  # ]:          0 :                 SetText( aSelEntry );
     416         [ #  # ]:          0 :             SaveValue();
     417                 :            : 
     418         [ #  # ]:          0 :             Sequence< PropertyValue > aArgs( 2 );
     419 [ #  # ][ #  # ]:          0 :             aArgs[0].Value  = makeAny( OUString( aSelEntry ) );
                 [ #  # ]
     420         [ #  # ]:          0 :             aArgs[1].Name   = OUString("Family");
     421 [ #  # ][ #  # ]:          0 :             aArgs[1].Value  = makeAny( sal_Int16( eStyleFamily ));
     422         [ #  # ]:          0 :             if( bCreateNew )
     423                 :            :             {
     424         [ #  # ]:          0 :                 aArgs[0].Name   = OUString("Param");
     425         [ #  # ]:          0 :                 SfxToolBoxControl::Dispatch( m_xDispatchProvider, rtl::OUString(".uno:StyleNewByExample"), aArgs);
     426                 :            :             }
     427                 :            :             else
     428                 :            :             {
     429         [ #  # ]:          0 :                 aArgs[0].Name   = OUString("Template");
     430         [ #  # ]:          0 :                 SfxToolBoxControl::Dispatch( m_xDispatchProvider, m_aCommand, aArgs );
     431         [ #  # ]:          0 :             }
     432         [ #  # ]:          0 :         }
     433                 :            :     }
     434                 :          0 : }
     435                 :            : // -----------------------------------------------------------------------
     436                 :            : 
     437                 :       9961 : void SvxStyleBox_Impl::SetFamily( SfxStyleFamily eNewFamily )
     438                 :            : {
     439                 :       9961 :     eStyleFamily = eNewFamily;
     440                 :       9961 : }
     441                 :            : 
     442                 :            : // -----------------------------------------------------------------------
     443                 :            : 
     444                 :          2 : long SvxStyleBox_Impl::PreNotify( NotifyEvent& rNEvt )
     445                 :            : {
     446                 :          2 :     sal_uInt16 nType = rNEvt.GetType();
     447                 :            : 
     448 [ +  - ][ +  - ]:          2 :     if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
     449                 :          2 :         nCurSel = GetSelectEntryPos();
     450         [ #  # ]:          0 :     else if ( EVENT_LOSEFOCUS == nType )
     451                 :            :     {
     452                 :            :         // don't handle before our Select() is called
     453 [ #  # ][ #  # ]:          0 :         if ( !HasFocus() && !HasChildPathFocus() )
                 [ #  # ]
     454                 :          0 :             SetText( GetSavedValue() );
     455                 :            :     }
     456                 :          2 :     return ComboBox::PreNotify( rNEvt );
     457                 :            : }
     458                 :            : 
     459                 :            : // -----------------------------------------------------------------------
     460                 :            : 
     461                 :          2 : long SvxStyleBox_Impl::Notify( NotifyEvent& rNEvt )
     462                 :            : {
     463                 :          2 :     long nHandled = 0;
     464                 :            : 
     465         [ -  + ]:          2 :     if ( rNEvt.GetType() == EVENT_KEYINPUT )
     466                 :            :     {
     467                 :          0 :         sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
     468                 :            : 
     469      [ #  #  # ]:          0 :         switch ( nCode )
     470                 :            :         {
     471                 :            :             case KEY_RETURN:
     472                 :            :             case KEY_TAB:
     473                 :            :             {
     474         [ #  # ]:          0 :                 if ( KEY_TAB == nCode )
     475                 :          0 :                     bRelease = sal_False;
     476                 :            :                 else
     477                 :          0 :                     nHandled = 1;
     478                 :          0 :                 Select();
     479                 :          0 :                 break;
     480                 :            :             }
     481                 :            : 
     482                 :            :             case KEY_ESCAPE:
     483                 :          0 :                 SelectEntryPos( nCurSel );
     484                 :          0 :                 ReleaseFocus();
     485                 :          0 :                 nHandled = 1;
     486                 :          0 :                 break;
     487                 :            :         }
     488                 :            :     }
     489         [ +  - ]:          2 :     return nHandled ? nHandled : ComboBox::Notify( rNEvt );
     490                 :            : }
     491                 :            : 
     492                 :          0 : void SvxStyleBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
     493                 :            : {
     494   [ #  #  #  # ]:          0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
                 [ #  # ]
     495                 :          0 :          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     496                 :            :     {
     497 [ #  # ][ #  # ]:          0 :         SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
         [ #  # ][ #  # ]
     498                 :          0 :         Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
     499 [ #  # ][ #  # ]:          0 :         SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
         [ #  # ][ #  # ]
     500                 :            :     }
     501                 :            : 
     502                 :          0 :     ComboBox::DataChanged( rDCEvt );
     503                 :          0 : }
     504                 :            : 
     505                 :      41296 : void SvxStyleBox_Impl::StateChanged( StateChangedType nStateChange )
     506                 :            : {
     507                 :      41296 :     ComboBox::StateChanged( nStateChange );
     508                 :            : 
     509         [ +  + ]:      41296 :     if ( nStateChange == STATE_CHANGE_VISIBLE )
     510                 :            :     {
     511                 :        762 :         bVisible = IsReallyVisible();
     512         [ +  - ]:        762 :         if ( aVisibilityListener.IsSet() )
     513                 :        762 :             aVisibilityListener.Call( this );
     514                 :            :     }
     515         [ +  + ]:      40534 :     else if ( nStateChange == STATE_CHANGE_INITSHOW )
     516                 :            :     {
     517                 :        762 :         bVisible = sal_True;
     518         [ +  - ]:        762 :         if ( aVisibilityListener.IsSet() )
     519                 :        762 :             aVisibilityListener.Call( this );
     520                 :            :     }
     521                 :      41296 : }
     522                 :            : 
     523                 :            : //--------------------------------------------------------------------
     524                 :            : 
     525                 :          0 : IMPL_STATIC_LINK( SvxStyleBox_Impl, FocusHdl_Impl, Control*, _pCtrl )
     526                 :            : {
     527                 :            :     (void)pThis;
     528         [ #  # ]:          0 :     if ( _pCtrl )
     529                 :          0 :         _pCtrl->GrabFocus();
     530                 :          0 :     return 0;
     531                 :            : }
     532                 :            : 
     533                 :            : // -----------------------------------------------------------------------
     534                 :            : 
     535                 :          2 : sal_Bool GetDocFontList_Impl( const FontList** ppFontList, SvxFontNameBox_Impl* pBox )
     536                 :            : {
     537                 :          2 :     sal_Bool bChanged = sal_False;
     538                 :          2 :     const SfxObjectShell* pDocSh = SfxObjectShell::Current();
     539                 :          2 :     SvxFontListItem* pFontListItem = NULL;
     540                 :            : 
     541         [ +  - ]:          2 :     if ( pDocSh )
     542                 :            :         pFontListItem =
     543                 :          2 :             (SvxFontListItem*)pDocSh->GetItem( SID_ATTR_CHAR_FONTLIST );
     544                 :            :     else
     545                 :            :     {
     546                 :            :         SAL_WNODEPRECATED_DECLARATIONS_PUSH
     547 [ #  # ][ #  # ]:          0 :         ::std::auto_ptr<FontList> aFontList(new FontList( pBox ));
     548                 :            :         SAL_WNODEPRECATED_DECLARATIONS_POP
     549                 :          0 :         *ppFontList = aFontList.get();
     550         [ #  # ]:          0 :         pBox->SetOwnFontList(aFontList);
     551         [ #  # ]:          0 :         bChanged = sal_True;
     552                 :            :     }
     553                 :            : 
     554         [ +  - ]:          2 :     if ( pFontListItem )
     555                 :            :     {
     556                 :          2 :         const FontList* pNewFontList = pFontListItem->GetFontList();
     557                 :            :         DBG_ASSERT( pNewFontList, "Doc-FontList not available!" );
     558                 :            : 
     559                 :            :         // keine alte Liste, aber neue Liste
     560 [ +  - ][ +  - ]:          2 :         if ( !*ppFontList && pNewFontList )
     561                 :            :         {
     562                 :            :             // => "ubernehmen
     563                 :          2 :             *ppFontList = pNewFontList;
     564                 :          2 :             bChanged = sal_True;
     565                 :            :         }
     566                 :            :         else
     567                 :            :         {
     568                 :            :             // Vergleich der Fontlisten ist nicht vollkommen
     569                 :            :             // wird die Fontliste am Doc geaendert, kann man hier
     570                 :            :             // nur ueber die Listbox Aenderungen feststellen, weil
     571                 :            :             // ppFontList dabei schon upgedatet wurde
     572                 :            :             bChanged =
     573                 :            :                 ( ( *ppFontList != pNewFontList ) ||
     574 [ #  # ][ #  # ]:          0 :                   pBox->GetListCount() != pNewFontList->GetFontNameCount() );
     575                 :            :             HACK(vergleich ist unvollstaendig)
     576                 :            : 
     577         [ #  # ]:          0 :             if ( bChanged )
     578                 :          0 :                 *ppFontList = pNewFontList;
     579                 :            :         }
     580                 :            : 
     581         [ +  - ]:          2 :         if ( pBox )
     582                 :          2 :             pBox->Enable();
     583                 :            :     }
     584 [ #  # ][ #  # ]:          0 :     else if ( pBox && ( pDocSh || ( !pDocSh && !ppFontList )))
         [ #  # ][ #  # ]
     585                 :            :     {
     586                 :            :         // Disable box only when we have a SfxObjectShell and didn't get a font list OR
     587                 :            :         // we don't have a SfxObjectShell and no current font list.
     588                 :            :         // It's possible that we currently have no SfxObjectShell, but a current font list.
     589                 :            :         // See #i58471: When a user set the focus into the font name combo box and opens
     590                 :            :         // the help window with F1. After closing the help window, we disable the font name
     591                 :            :         // combo box. The SfxObjectShell::Current() method returns in that case zero. But the
     592                 :            :         // font list hasn't changed and therefore the combo box shouldn't be disabled!
     593                 :          0 :         pBox->Disable();
     594                 :            :     }
     595                 :            : 
     596                 :            :     // in die FontBox ggf. auch die neue Liste f"ullen
     597 [ +  - ][ +  - ]:          2 :     if ( pBox && bChanged )
     598                 :            :     {
     599         [ +  - ]:          2 :         if ( *ppFontList )
     600                 :          2 :             pBox->Fill( *ppFontList );
     601                 :            :         else
     602                 :          0 :             pBox->Clear();
     603                 :            :     }
     604                 :          2 :     return bChanged;
     605                 :            : }
     606                 :            : 
     607                 :            : //========================================================================
     608                 :            : // class SvxFontNameBox_Impl --------------------------------------------------
     609                 :            : //========================================================================
     610                 :            : 
     611                 :        961 : SvxFontNameBox_Impl::SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame, WinBits nStyle ) :
     612                 :            : 
     613                 :            :     FontNameBox        ( pParent, nStyle | WinBits( WB_DROPDOWN | WB_AUTOHSCROLL ) ),
     614                 :            :     pFontList          ( NULL ),
     615                 :            :     aLogicalSize       ( 75,160 ),
     616                 :            :     nFtCount           ( 0 ),
     617                 :            :     bRelease           ( sal_True ),
     618                 :            :     m_xDispatchProvider( rDispatchProvider ),
     619 [ +  - ][ +  - ]:        961 :     m_xFrame (_xFrame)
     620                 :            : {
     621 [ +  - ][ +  - ]:        961 :     SetSizePixel(LogicToPixel( aLogicalSize, MAP_APPFONT ));
         [ +  - ][ +  - ]
     622         [ +  - ]:        961 :     EnableControls_Impl();
     623                 :        961 : }
     624                 :            : // -----------------------------------------------------------------------
     625                 :            : 
     626                 :          2 : void SvxFontNameBox_Impl::FillList()
     627                 :            : {
     628                 :            :     // alte Selektion merken, und am Ende wieder setzen
     629         [ +  - ]:          2 :     Selection aOldSel = GetSelection();
     630                 :            :     // hat sich Doc-Fontlist geaendert?
     631         [ +  - ]:          2 :     GetDocFontList_Impl( &pFontList, this );
     632 [ +  - ][ +  - ]:          2 :     aCurText = GetText();
                 [ +  - ]
     633         [ +  - ]:          2 :     SetSelection( aOldSel );
     634                 :          2 : }
     635                 :            : 
     636                 :            : // -----------------------------------------------------------------------
     637                 :            : 
     638                 :       1481 : void SvxFontNameBox_Impl::Update( const SvxFontItem* pFontItem )
     639                 :            : {
     640         [ +  - ]:       1481 :     if ( pFontItem )
     641                 :            :     {
     642 [ +  - ][ +  - ]:       1481 :         aCurFont.SetName        ( pFontItem->GetFamilyName() );
     643         [ +  - ]:       1481 :         aCurFont.SetFamily      ( pFontItem->GetFamily() );
     644         [ +  - ]:       1481 :         aCurFont.SetStyleName   ( pFontItem->GetStyleName() );
     645         [ +  - ]:       1481 :         aCurFont.SetPitch       ( pFontItem->GetPitch() );
     646         [ +  - ]:       1481 :         aCurFont.SetCharSet     ( pFontItem->GetCharSet() );
     647                 :            :     }
     648 [ +  - ][ +  - ]:       1481 :     String aCurName = aCurFont.GetName();
     649 [ +  - ][ +  - ]:       1481 :     if ( GetText() != aCurName )
         [ +  - ][ +  + ]
     650 [ +  - ][ +  - ]:       1481 :         SetText( aCurName );
     651                 :       1481 : }
     652                 :            : 
     653                 :            : // -----------------------------------------------------------------------
     654                 :            : 
     655                 :          0 : long SvxFontNameBox_Impl::PreNotify( NotifyEvent& rNEvt )
     656                 :            : {
     657                 :          0 :     sal_uInt16 nType = rNEvt.GetType();
     658                 :            : 
     659 [ #  # ][ #  # ]:          0 :     if ( EVENT_MOUSEBUTTONDOWN == nType || EVENT_GETFOCUS == nType )
     660                 :            :     {
     661                 :          0 :         EnableControls_Impl();
     662                 :          0 :         FillList();
     663                 :            :     }
     664                 :          0 :     return FontNameBox::PreNotify( rNEvt );
     665                 :            : }
     666                 :            : 
     667                 :            : // -----------------------------------------------------------------------
     668                 :            : 
     669                 :          0 : long SvxFontNameBox_Impl::Notify( NotifyEvent& rNEvt )
     670                 :            : {
     671                 :          0 :     long nHandled = 0;
     672                 :            : 
     673         [ #  # ]:          0 :     if ( rNEvt.GetType() == EVENT_KEYINPUT )
     674                 :            :     {
     675                 :          0 :         sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
     676                 :            : 
     677      [ #  #  # ]:          0 :         switch ( nCode )
     678                 :            :         {
     679                 :            :             case KEY_RETURN:
     680                 :            :             case KEY_TAB:
     681                 :            :             {
     682         [ #  # ]:          0 :                 if ( KEY_TAB == nCode )
     683                 :          0 :                     bRelease = sal_False;
     684                 :            :                 else
     685                 :          0 :                     nHandled = 1;
     686                 :          0 :                 Select();
     687                 :          0 :                 break;
     688                 :            :             }
     689                 :            : 
     690                 :            :             case KEY_ESCAPE:
     691                 :          0 :                 SetText( aCurText );
     692                 :          0 :                 ReleaseFocus_Impl();
     693                 :          0 :                 break;
     694                 :            :         }
     695                 :            :     }
     696         [ #  # ]:          0 :     else if ( EVENT_LOSEFOCUS == rNEvt.GetType() )
     697                 :            :     {
     698                 :          0 :         Window* pFocusWin = Application::GetFocusWindow();
     699 [ #  # ][ #  # ]:          0 :         if ( !HasFocus() && GetSubEdit() != pFocusWin )
                 [ #  # ]
     700                 :          0 :             SetText( GetSavedValue() );
     701                 :            :     }
     702                 :            : 
     703         [ #  # ]:          0 :     return nHandled ? nHandled : FontNameBox::Notify( rNEvt );
     704                 :            : }
     705                 :            : 
     706                 :            : // ---------------------------------------------------------------------------
     707                 :          0 : void SvxFontNameBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
     708                 :            : {
     709   [ #  #  #  # ]:          0 :     if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) &&
                 [ #  # ]
     710                 :          0 :          (rDCEvt.GetFlags() & SETTINGS_STYLE) )
     711                 :            :     {
     712 [ #  # ][ #  # ]:          0 :         SetSizePixel(LogicToPixel(aLogicalSize, MAP_APPFONT));
         [ #  # ][ #  # ]
     713                 :          0 :         Size aDropSize( aLogicalSize.Width(), LOGICAL_EDIT_HEIGHT);
     714 [ #  # ][ #  # ]:          0 :         SetDropDownSizePixel(LogicToPixel(aDropSize, MAP_APPFONT));
         [ #  # ][ #  # ]
     715                 :            :     }
     716                 :            : 
     717                 :          0 :     FontNameBox::DataChanged( rDCEvt );
     718                 :          0 : }
     719                 :            : 
     720                 :            : // -----------------------------------------------------------------------
     721                 :            : 
     722                 :          0 : void SvxFontNameBox_Impl::ReleaseFocus_Impl()
     723                 :            : {
     724         [ #  # ]:          0 :     if ( !bRelease )
     725                 :            :     {
     726                 :          0 :         bRelease = sal_True;
     727                 :          0 :         return;
     728                 :            :     }
     729 [ #  # ][ #  # ]:          0 :     if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     730 [ #  # ][ #  # ]:          0 :         m_xFrame->getContainerWindow()->setFocus();
     731                 :            : }
     732                 :            : 
     733                 :            : // -----------------------------------------------------------------------
     734                 :            : 
     735                 :        961 : void SvxFontNameBox_Impl::EnableControls_Impl()
     736                 :            : {
     737         [ +  - ]:        961 :     SvtFontOptions aFontOpt;
     738         [ +  - ]:        961 :     sal_Bool bEnable = aFontOpt.IsFontHistoryEnabled();
     739         [ +  - ]:        961 :     sal_uInt16 nEntries = bEnable ? MAX_MRU_FONTNAME_ENTRIES : 0;
     740 [ +  - ][ +  - ]:        961 :     if ( GetMaxMRUCount() != nEntries )
     741                 :            :     {
     742                 :            :         // refill in the next GetFocus-Handler
     743                 :        961 :         pFontList = NULL;
     744         [ +  - ]:        961 :         Clear();
     745         [ +  - ]:        961 :         SetMaxMRUCount( nEntries );
     746                 :            :     }
     747                 :            : 
     748         [ +  - ]:        961 :     bEnable = aFontOpt.IsFontWYSIWYGEnabled();
     749         [ +  - ]:        961 :     EnableWYSIWYG( bEnable );
     750 [ +  - ][ +  - ]:        961 :     EnableSymbols( bEnable );
     751                 :        961 : }
     752                 :            : 
     753                 :            : // -----------------------------------------------------------------------
     754                 :            : 
     755                 :          0 : void SvxFontNameBox_Impl::Select()
     756                 :            : {
     757                 :          0 :     FontNameBox::Select();
     758                 :            : 
     759         [ #  # ]:          0 :     if ( !IsTravelSelect() )
     760                 :            :     {
     761         [ #  # ]:          0 :         if ( pFontList )
     762                 :            :         {
     763                 :          0 :             FontInfo aInfo( pFontList->Get( GetText(),
     764                 :            :                                             aCurFont.GetWeight(),
     765 [ #  # ][ #  # ]:          0 :                                             aCurFont.GetItalic() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     766         [ #  # ]:          0 :             aCurFont = aInfo;
     767                 :            : 
     768                 :            :             SvxFontItem aFontItem( aInfo.GetFamily(),
     769         [ #  # ]:          0 :                                    aInfo.GetName(),
     770         [ #  # ]:          0 :                                    aInfo.GetStyleName(),
     771                 :            :                                    aInfo.GetPitch(),
     772         [ #  # ]:          0 :                                    aInfo.GetCharSet(),
     773 [ #  # ][ #  # ]:          0 :                                    SID_ATTR_CHAR_FONT );
                 [ #  # ]
     774                 :            : 
     775                 :          0 :             Any a;
     776         [ #  # ]:          0 :             Sequence< PropertyValue > aArgs( 1 );
     777         [ #  # ]:          0 :             aArgs[0].Name   = OUString( "CharFontName" );
     778         [ #  # ]:          0 :             aFontItem.QueryValue( a );
     779         [ #  # ]:          0 :             aArgs[0].Value  = a;
     780                 :            : 
     781                 :            :             //  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
     782                 :            :             //  This instance may be deleted in the meantime (i.e. when a dialog is opened
     783                 :            :             //  while in Dispatch()), accessing members will crash in this case.
     784         [ #  # ]:          0 :             ReleaseFocus_Impl();
     785                 :            : 
     786                 :            :             SfxToolBoxControl::Dispatch( m_xDispatchProvider,
     787                 :            :                                          OUString( ".uno:CharFontName" ),
     788 [ #  # ][ #  # ]:          0 :                                          aArgs );
         [ #  # ][ #  # ]
     789                 :            :         }
     790                 :            :         else
     791                 :          0 :             ReleaseFocus_Impl();
     792                 :            :     }
     793                 :          0 : }
     794                 :            : 
     795                 :            : //========================================================================
     796                 :            : // class SvxColorWindow_Impl --------------------------------------------------
     797                 :            : //========================================================================
     798                 :            : #ifndef WB_NO_DIRECTSELECT
     799                 :            : #define WB_NO_DIRECTSELECT      ((WinBits)0x04000000)
     800                 :            : #endif
     801                 :            : 
     802                 :            : #define PALETTE_X 8
     803                 :            : #define PALETTE_Y 13
     804                 :            : #define PALETTE_SIZE (PALETTE_X * PALETTE_Y)
     805                 :            : 
     806                 :          0 : SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     807                 :            :                                           sal_uInt16                     nSlotId,
     808                 :            :                                           const Reference< XFrame >& rFrame,
     809                 :            :                                           const String&              rWndTitle,
     810                 :            :                                           Window*                    pParentWindow,
     811                 :            :                                           const ::Color              rLastColor ) :
     812                 :            : 
     813                 :            :     SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
     814                 :            : 
     815                 :            :     theSlotId( nSlotId ),
     816                 :            :     aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ),
     817                 :            :     maCommand( rCommand ),
     818         [ #  # ]:          0 :     mLastColor( rLastColor )
     819                 :            : 
     820                 :            : {
     821         [ #  # ]:          0 :     SfxObjectShell* pDocSh = SfxObjectShell::Current();
     822                 :          0 :     const SfxPoolItem* pItem = NULL;
     823                 :          0 :     XColorListRef pColorList;
     824                 :          0 :     const Size aSize12( 13, 13 );
     825                 :            : 
     826         [ #  # ]:          0 :     if ( pDocSh )
     827 [ #  # ][ #  # ]:          0 :         if ( 0 != ( pItem = pDocSh->GetItem( SID_COLOR_TABLE ) ) )
     828 [ #  # ][ #  # ]:          0 :             pColorList = ( (SvxColorListItem*)pItem )->GetColorList();
     829                 :            : 
     830         [ #  # ]:          0 :     if ( !pColorList.is() )
     831 [ #  # ][ #  # ]:          0 :         pColorList = XColorList::CreateStdColorList();
     832                 :            : 
     833 [ #  # ][ #  # ]:          0 :     if ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId || SID_BACKGROUND_COLOR == theSlotId )
     834                 :            :     {
     835 [ #  # ][ #  # ]:          0 :         aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD );
     836 [ #  # ][ #  # ]:          0 :         aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_TRANSPARENT ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     837 [ #  # ][ #  # ]:          0 :         aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     838                 :            :     }
     839 [ #  # ][ #  # ]:          0 :     else if ( SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2 == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId )
                 [ #  # ]
     840                 :            :     {
     841                 :            :         SfxPoolItem* pDummy;
     842                 :            : 
     843 [ #  # ][ #  # ]:          0 :         Reference< XDispatchProvider > aDisp( GetFrame()->getController(), UNO_QUERY );
                 [ #  # ]
     844                 :            :         SfxQueryStatus aQueryStatus( aDisp,
     845                 :            :                                      SID_ATTR_AUTO_COLOR_INVALID,
     846         [ #  # ]:          0 :                                      rtl::OUString( ".uno:AutoColorInvalid" ));
     847         [ #  # ]:          0 :         SfxItemState eState = aQueryStatus.QueryState( pDummy );
     848 [ #  # ][ #  # ]:          0 :         if( (SFX_ITEM_DEFAULT > eState) || ( SID_EXTRUSION_3D_COLOR == theSlotId ) )
     849                 :            :         {
     850 [ #  # ][ #  # ]:          0 :             aColorSet.SetStyle( aColorSet.GetStyle() | WB_NONEFIELD );
     851 [ #  # ][ #  # ]:          0 :             aColorSet.SetText( SVX_RESSTR( RID_SVXSTR_AUTOMATIC ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     852 [ #  # ][ #  # ]:          0 :             aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_TEXTCOLOR ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     853         [ #  # ]:          0 :         }
     854                 :            :     }
     855                 :            :     else
     856                 :            :     {
     857 [ #  # ][ #  # ]:          0 :         aColorSet.SetAccessibleName( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     858                 :            :     }
     859                 :            : 
     860         [ #  # ]:          0 :     if ( pColorList.is() )
     861                 :            :     {
     862                 :          0 :         short i = 0;
     863         [ #  # ]:          0 :         long nCount = pColorList->Count();
     864                 :          0 :         XColorEntry* pEntry = NULL;
     865                 :          0 :         ::Color aColWhite( COL_WHITE );
     866 [ #  # ][ #  # ]:          0 :         String aStrWhite( EditResId(RID_SVXITEMS_COLOR_WHITE) );
     867                 :            : 
     868         [ #  # ]:          0 :         if ( nCount > PALETTE_SIZE )
     869                 :            :             // Show scrollbar if more than PALLETTE_SIZE colors are available
     870 [ #  # ][ #  # ]:          0 :             aColorSet.SetStyle( aColorSet.GetStyle() | WB_VSCROLL );
     871                 :            : 
     872         [ #  # ]:          0 :         for ( i = 0; i < nCount; i++ )
     873                 :            :         {
     874         [ #  # ]:          0 :             pEntry = pColorList->GetColor(i);
     875         [ #  # ]:          0 :             aColorSet.InsertItem( i+1, pEntry->GetColor(), pEntry->GetName() );
     876         [ #  # ]:          0 :             if( pEntry->GetColor() == mLastColor )
     877         [ #  # ]:          0 :                 aColorSet.SelectItem( i+1 );
     878                 :            :         }
     879                 :            : 
     880         [ #  # ]:          0 :         while ( i < PALETTE_SIZE )
     881                 :            :         {
     882                 :            :             // fill empty elements if less then PALLETTE_SIZE colors are available
     883         [ #  # ]:          0 :             aColorSet.InsertItem( i+1, aColWhite, aStrWhite );
     884                 :          0 :             i++;
     885         [ #  # ]:          0 :         }
     886                 :            :     }
     887                 :            : 
     888         [ #  # ]:          0 :     aColorSet.SetSelectHdl( LINK( this, SvxColorWindow_Impl, SelectHdl ) );
     889         [ #  # ]:          0 :     aColorSet.SetColCount( PALETTE_X );
     890         [ #  # ]:          0 :     aColorSet.SetLineCount( PALETTE_Y );
     891                 :            : 
     892         [ #  # ]:          0 :     lcl_CalcSizeValueSet( *this, aColorSet, aSize12 );
     893                 :            : 
     894         [ #  # ]:          0 :     SetHelpId( HID_POPUP_COLOR );
     895         [ #  # ]:          0 :     aColorSet.SetHelpId( HID_POPUP_COLOR_CTRL );
     896                 :            : 
     897         [ #  # ]:          0 :     SetText( rWndTitle );
     898         [ #  # ]:          0 :     aColorSet.Show();
     899                 :            : 
     900         [ #  # ]:          0 :     AddStatusListener( rtl::OUString( ".uno:ColorTableState" ));
     901                 :          0 : }
     902                 :            : 
     903         [ #  # ]:          0 : SvxColorWindow_Impl::~SvxColorWindow_Impl()
     904                 :            : {
     905         [ #  # ]:          0 : }
     906                 :            : 
     907                 :          0 : void SvxColorWindow_Impl::KeyInput( const KeyEvent& rKEvt )
     908                 :            : {
     909                 :          0 :     aColorSet.KeyInput(rKEvt);
     910                 :          0 : }
     911                 :            : 
     912                 :          0 : SfxPopupWindow* SvxColorWindow_Impl::Clone() const
     913                 :            : {
     914 [ #  # ][ #  # ]:          0 :     return new SvxColorWindow_Impl( maCommand, theSlotId, GetFrame(), GetText(), GetParent(), mLastColor );
                 [ #  # ]
     915                 :            : }
     916                 :            : 
     917                 :            : // -----------------------------------------------------------------------
     918                 :            : 
     919                 :          0 : IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectHdl)
     920                 :            : {
     921                 :          0 :     sal_uInt16 nItemId = aColorSet.GetSelectItemId();
     922 [ #  # ][ #  # ]:          0 :     SvxColorItem aColorItem( aColorSet.GetItemColor( nItemId ), theSlotId );
     923                 :            :     /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() calls.
     924                 :            :         This instance may be deleted in the meantime (i.e. when a dialog is opened
     925                 :            :         while in Dispatch()), accessing members will crash in this case. */
     926         [ #  # ]:          0 :     aColorSet.SetNoSelection();
     927                 :            : 
     928         [ #  # ]:          0 :     if ( IsInPopupMode() )
     929         [ #  # ]:          0 :         EndPopupMode();
     930                 :            : 
     931 [ #  # ][ #  # ]:          0 :     if ( !nItemId && ( SID_ATTR_CHAR_COLOR_BACKGROUND == theSlotId  || SID_BACKGROUND_COLOR == theSlotId ) )
                 [ #  # ]
     932                 :            :     {
     933         [ #  # ]:          0 :         Sequence< PropertyValue > aArgs;
     934         [ #  # ]:          0 :         SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
     935                 :            :                                      maCommand,
     936 [ #  # ][ #  # ]:          0 :                                      aArgs );
         [ #  # ][ #  # ]
     937                 :            :     }
     938 [ #  # ][ #  # ]:          0 :     else if ( !nItemId && (SID_ATTR_CHAR_COLOR == theSlotId || SID_ATTR_CHAR_COLOR2  == theSlotId || SID_EXTRUSION_3D_COLOR == theSlotId) )
         [ #  # ][ #  # ]
     939                 :            :     {
     940         [ #  # ]:          0 :         SvxColorItem _aColorItem( COL_AUTO, theSlotId );
     941         [ #  # ]:          0 :         INetURLObject aObj( maCommand );
     942                 :            : 
     943                 :          0 :         Any a;
     944         [ #  # ]:          0 :         Sequence< PropertyValue > aArgs( 1 );
     945 [ #  # ][ #  # ]:          0 :         aArgs[0].Name = aObj.GetURLPath();
     946         [ #  # ]:          0 :         _aColorItem.QueryValue( a );
     947         [ #  # ]:          0 :         aArgs[0].Value = a;
     948         [ #  # ]:          0 :         SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
     949                 :            :                                      maCommand,
     950 [ #  # ][ #  # ]:          0 :                                      aArgs );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     951                 :            :     }
     952                 :            :     else
     953                 :            :     {
     954         [ #  # ]:          0 :         INetURLObject aObj( maCommand );
     955                 :            : 
     956                 :          0 :         Any a;
     957         [ #  # ]:          0 :         Sequence< PropertyValue > aArgs( 1 );
     958 [ #  # ][ #  # ]:          0 :         aArgs[0].Name = aObj.GetURLPath();
     959         [ #  # ]:          0 :         aColorItem.QueryValue( a );
     960         [ #  # ]:          0 :         aArgs[0].Value = a;
     961         [ #  # ]:          0 :         SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
     962                 :            :                                      maCommand,
     963 [ #  # ][ #  # ]:          0 :                                      aArgs );
         [ #  # ][ #  # ]
                 [ #  # ]
     964                 :            :     }
     965                 :            : 
     966         [ #  # ]:          0 :     return 0;
     967                 :            : }
     968                 :            : 
     969                 :            : // -----------------------------------------------------------------------
     970                 :            : 
     971                 :          0 : void SvxColorWindow_Impl::Resize()
     972                 :            : {
     973                 :          0 :     lcl_ResizeValueSet( *this, aColorSet);
     974                 :          0 : }
     975                 :            : 
     976                 :            : // -----------------------------------------------------------------------
     977                 :            : 
     978                 :          0 : void SvxColorWindow_Impl::StartSelection()
     979                 :            : {
     980                 :          0 :     aColorSet.StartSelection();
     981                 :          0 : }
     982                 :            : 
     983                 :            : // -----------------------------------------------------------------------
     984                 :            : 
     985                 :          0 : sal_Bool SvxColorWindow_Impl::Close()
     986                 :            : {
     987                 :          0 :     return SfxPopupWindow::Close();
     988                 :            : }
     989                 :            : 
     990                 :            : // -----------------------------------------------------------------------
     991                 :            : 
     992                 :          0 : void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
     993                 :            : {
     994 [ #  # ][ #  # ]:          0 :     if (( SFX_ITEM_DISABLED != eState ) && pState )
     995                 :            :     {
     996 [ #  # ][ #  # ]:          0 :         if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
                 [ #  # ]
     997                 :            :         {
     998         [ #  # ]:          0 :             if ( pState )
     999                 :            :             {
    1000         [ #  # ]:          0 :                 XColorListRef pColorList = ((SvxColorListItem *)pState)->GetColorList();
    1001                 :            : 
    1002                 :          0 :                 short i = 0;
    1003         [ #  # ]:          0 :                 long nCount = pColorList->Count();
    1004                 :          0 :                 XColorEntry* pEntry = NULL;
    1005                 :          0 :                 ::Color aColWhite( COL_WHITE );
    1006 [ #  # ][ #  # ]:          0 :                 String aStrWhite( SVX_RES( RID_SVXITEMS_COLOR_WHITE ) );
    1007                 :            : 
    1008                 :            :                 // ScrollBar an oder aus
    1009         [ #  # ]:          0 :                 WinBits nBits = aColorSet.GetStyle();
    1010         [ #  # ]:          0 :                 if ( nCount > PALETTE_SIZE )
    1011                 :          0 :                     nBits &= ~WB_VSCROLL;
    1012                 :            :                 else
    1013                 :          0 :                     nBits |= WB_VSCROLL;
    1014         [ #  # ]:          0 :                 aColorSet.SetStyle( nBits );
    1015                 :            : 
    1016         [ #  # ]:          0 :                 for ( i = 0; i < nCount; ++i )
    1017                 :            :                 {
    1018         [ #  # ]:          0 :                     pEntry = pColorList->GetColor(i);
    1019         [ #  # ]:          0 :                     aColorSet.SetItemColor( i + 1, pEntry->GetColor() );
    1020         [ #  # ]:          0 :                     aColorSet.SetItemText ( i + 1, pEntry->GetName() );
    1021                 :            :                 }
    1022                 :            : 
    1023         [ #  # ]:          0 :                 while ( i < PALETTE_SIZE )
    1024                 :            :                 {
    1025         [ #  # ]:          0 :                     aColorSet.SetItemColor( i + 1, aColWhite );
    1026         [ #  # ]:          0 :                     aColorSet.SetItemText ( i + 1, aStrWhite );
    1027                 :          0 :                     i++;
    1028         [ #  # ]:          0 :                 }
    1029                 :            :             }
    1030                 :            :         }
    1031                 :            :     }
    1032                 :          0 : }
    1033                 :            : 
    1034                 :            : //========================================================================
    1035                 :            : // class SvxFrameWindow_Impl --------------------------------------------------
    1036                 :            : //========================================================================
    1037                 :            : 
    1038                 :          0 : SvxFrameWindow_Impl::SvxFrameWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
    1039                 :            : 
    1040                 :            :     SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION ) ),
    1041                 :            :     aFrameSet   ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
    1042 [ #  # ][ #  # ]:          0 :     bParagraphMode(sal_False)
    1043                 :            : 
    1044                 :            : {
    1045         [ #  # ]:          0 :     BindListener();
    1046         [ #  # ]:          0 :     AddStatusListener(rtl::OUString(".uno:BorderReducedMode"));
    1047 [ #  # ][ #  # ]:          0 :     aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) );
         [ #  # ][ #  # ]
    1048                 :            : 
    1049                 :            :     /*
    1050                 :            :      *  1       2        3         4
    1051                 :            :      *  -------------------------------------
    1052                 :            :      *  NONE    LEFT     RIGHT     LEFTRIGHT
    1053                 :            :      *  TOP     BOTTOM   TOPBOTTOM OUTER
    1054                 :            :      *  -------------------------------------
    1055                 :            :      *  HOR     HORINNER VERINNER   ALL         <- kann ueber bParagraphMode
    1056                 :            :      *                                             abgeschaltet werden
    1057                 :            :      */
    1058                 :            : 
    1059                 :          0 :     sal_uInt16 i = 0;
    1060                 :            : 
    1061         [ #  # ]:          0 :     for ( i=1; i<9; i++ )
    1062 [ #  # ][ #  # ]:          0 :         aFrameSet.InsertItem( i, aImgList.GetImage(i) );
                 [ #  # ]
    1063                 :            : 
    1064                 :            :     //bParagraphMode should have been set in StateChanged
    1065         [ #  # ]:          0 :     if ( !bParagraphMode )
    1066         [ #  # ]:          0 :         for ( i = 9; i < 13; i++ )
    1067 [ #  # ][ #  # ]:          0 :             aFrameSet.InsertItem( i, aImgList.GetImage(i) );
                 [ #  # ]
    1068                 :            : 
    1069         [ #  # ]:          0 :     aFrameSet.SetColCount( 4 );
    1070         [ #  # ]:          0 :     aFrameSet.SetSelectHdl( LINK( this, SvxFrameWindow_Impl, SelectHdl ) );
    1071                 :            : 
    1072         [ #  # ]:          0 :     lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
    1073                 :            : 
    1074         [ #  # ]:          0 :     SetHelpId( HID_POPUP_FRAME );
    1075 [ #  # ][ #  # ]:          0 :     SetText( SVX_RESSTR(RID_SVXSTR_FRAME) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1076 [ #  # ][ #  # ]:          0 :     aFrameSet.SetAccessibleName( SVX_RESSTR(RID_SVXSTR_FRAME) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1077         [ #  # ]:          0 :     aFrameSet.Show();
    1078                 :          0 : }
    1079                 :            : 
    1080 [ #  # ][ #  # ]:          0 : SvxFrameWindow_Impl::~SvxFrameWindow_Impl()
    1081                 :            : {
    1082         [ #  # ]:          0 :     UnbindListener();
    1083         [ #  # ]:          0 : }
    1084                 :            : 
    1085                 :          0 : SfxPopupWindow* SvxFrameWindow_Impl::Clone() const
    1086                 :            : {
    1087                 :            :     //! HACK: wie bekomme ich den Paragraph-Mode ??
    1088         [ #  # ]:          0 :     return new SvxFrameWindow_Impl( GetId(), GetFrame(), GetParent() );
    1089                 :            : }
    1090                 :            : 
    1091                 :          0 : Window* SvxFrameWindow_Impl::GetPreferredKeyInputWindow()
    1092                 :            : {
    1093                 :          0 :     return &aFrameSet;
    1094                 :            : }
    1095                 :            : 
    1096                 :          0 : void SvxFrameWindow_Impl::GetFocus()
    1097                 :            : {
    1098                 :          0 :     aFrameSet.GrabFocus();
    1099                 :          0 : }
    1100                 :            : 
    1101                 :          0 : void SvxFrameWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
    1102                 :            : {
    1103                 :          0 :     SfxPopupWindow::DataChanged( rDCEvt );
    1104                 :            : 
    1105 [ #  # ][ #  # ]:          0 :     if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
                 [ #  # ]
    1106                 :            :     {
    1107 [ #  # ][ #  # ]:          0 :         aImgList = ImageList( SVX_RES( RID_SVXIL_FRAME ) );
                 [ #  # ]
    1108                 :            : 
    1109                 :          0 :         sal_uInt16  nNumOfItems = aFrameSet.GetItemCount();
    1110                 :            : 
    1111         [ #  # ]:          0 :         for( sal_uInt16 i = 1 ; i <= nNumOfItems ; ++i )
    1112         [ #  # ]:          0 :             aFrameSet.SetItemImage( i, aImgList.GetImage( i ) );
    1113                 :            :     }
    1114                 :          0 : }
    1115                 :            : // -----------------------------------------------------------------------
    1116                 :            : 
    1117                 :            : #define FRM_VALID_LEFT      0x01
    1118                 :            : #define FRM_VALID_RIGHT     0x02
    1119                 :            : #define FRM_VALID_TOP       0x04
    1120                 :            : #define FRM_VALID_BOTTOM    0x08
    1121                 :            : #define FRM_VALID_HINNER    0x10
    1122                 :            : #define FRM_VALID_VINNER    0x20
    1123                 :            : #define FRM_VALID_OUTER     0x0f
    1124                 :            : #define FRM_VALID_ALL       0xff
    1125                 :            : 
    1126                 :            : //
    1127                 :            : // Per default bleiben ungesetzte Linien unveraendert
    1128                 :            : // Mit Shift werden ungesetzte Linien zurueckgsetzt
    1129                 :            : //
    1130                 :          0 : IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
    1131                 :            : {
    1132                 :          0 :     ::Color             aColBlack( COL_BLACK );
    1133         [ #  # ]:          0 :     SvxBoxItem          aBorderOuter( SID_ATTR_BORDER_OUTER );
    1134         [ #  # ]:          0 :     SvxBoxInfoItem      aBorderInner( SID_ATTR_BORDER_INNER );
    1135         [ #  # ]:          0 :     SvxBorderLine       theDefLine;
    1136                 :          0 :     SvxBorderLine       *pLeft = 0,
    1137                 :          0 :                         *pRight = 0,
    1138                 :          0 :                         *pTop = 0,
    1139                 :          0 :                         *pBottom = 0;
    1140                 :          0 :     sal_uInt16              nSel = aFrameSet.GetSelectItemId();
    1141                 :          0 :     sal_uInt16              nModifier = aFrameSet.GetModifier();
    1142                 :          0 :     sal_uInt8               nValidFlags = 0;
    1143                 :            : 
    1144                 :          0 :     theDefLine.GuessLinesWidths(theDefLine.GetBorderLineStyle(),
    1145         [ #  # ]:          0 :             DEF_LINE_WIDTH_0);
    1146   [ #  #  #  #  :          0 :     switch ( nSel )
          #  #  #  #  #  
             #  #  #  # ]
    1147                 :            :     {
    1148                 :          0 :         case 1: nValidFlags |= FRM_VALID_ALL;
    1149                 :          0 :         break;  // NONE
    1150                 :          0 :         case 2: pLeft = &theDefLine;
    1151                 :          0 :                 nValidFlags |= FRM_VALID_LEFT;
    1152                 :          0 :         break;  // LEFT
    1153                 :          0 :         case 3: pRight = &theDefLine;
    1154                 :          0 :                 nValidFlags |= FRM_VALID_RIGHT;
    1155                 :          0 :         break;  // RIGHT
    1156                 :          0 :         case 4: pLeft = pRight = &theDefLine;
    1157                 :          0 :                 nValidFlags |=  FRM_VALID_RIGHT|FRM_VALID_LEFT;
    1158                 :          0 :         break;  // LEFTRIGHT
    1159                 :          0 :         case 5: pTop = &theDefLine;
    1160                 :          0 :                 nValidFlags |= FRM_VALID_TOP;
    1161                 :          0 :         break;  // TOP
    1162                 :          0 :         case 6: pBottom = &theDefLine;
    1163                 :          0 :                 nValidFlags |= FRM_VALID_BOTTOM;
    1164                 :          0 :         break;  // BOTTOM
    1165                 :          0 :         case 7: pTop =  pBottom = &theDefLine;
    1166                 :          0 :                 nValidFlags |= FRM_VALID_BOTTOM|FRM_VALID_TOP;
    1167                 :          0 :         break;  // TOPBOTTOM
    1168                 :          0 :         case 8: pLeft = pRight = pTop = pBottom = &theDefLine;
    1169                 :          0 :                 nValidFlags |= FRM_VALID_OUTER;
    1170                 :          0 :         break;  // OUTER
    1171                 :            : 
    1172                 :            :         // Tabelle innen:
    1173                 :            :         case 9: // HOR
    1174                 :          0 :             pTop = pBottom = &theDefLine;
    1175         [ #  # ]:          0 :             aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
    1176         [ #  # ]:          0 :             aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT );
    1177                 :          0 :             nValidFlags |= FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
    1178                 :          0 :             break;
    1179                 :            : 
    1180                 :            :         case 10: // HORINNER
    1181                 :          0 :             pLeft = pRight = pTop = pBottom = &theDefLine;
    1182         [ #  # ]:          0 :             aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
    1183         [ #  # ]:          0 :             aBorderInner.SetLine( NULL, BOXINFO_LINE_VERT );
    1184                 :          0 :             nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_HINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
    1185                 :          0 :             break;
    1186                 :            : 
    1187                 :            :         case 11: // VERINNER
    1188                 :          0 :             pLeft = pRight = pTop = pBottom = &theDefLine;
    1189         [ #  # ]:          0 :             aBorderInner.SetLine( NULL, BOXINFO_LINE_HORI );
    1190         [ #  # ]:          0 :             aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT );
    1191                 :          0 :             nValidFlags |= FRM_VALID_RIGHT|FRM_VALID_LEFT|FRM_VALID_VINNER|FRM_VALID_TOP|FRM_VALID_BOTTOM;
    1192                 :          0 :         break;
    1193                 :            : 
    1194                 :            :         case 12: // ALL
    1195                 :          0 :             pLeft = pRight = pTop = pBottom = &theDefLine;
    1196         [ #  # ]:          0 :             aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_HORI );
    1197         [ #  # ]:          0 :             aBorderInner.SetLine( &theDefLine, BOXINFO_LINE_VERT );
    1198                 :          0 :             nValidFlags |= FRM_VALID_ALL;
    1199                 :          0 :             break;
    1200                 :            : 
    1201                 :            :         default:
    1202                 :          0 :         break;
    1203                 :            :     }
    1204         [ #  # ]:          0 :     aBorderOuter.SetLine( pLeft, BOX_LINE_LEFT );
    1205         [ #  # ]:          0 :     aBorderOuter.SetLine( pRight, BOX_LINE_RIGHT );
    1206         [ #  # ]:          0 :     aBorderOuter.SetLine( pTop, BOX_LINE_TOP );
    1207         [ #  # ]:          0 :     aBorderOuter.SetLine( pBottom, BOX_LINE_BOTTOM );
    1208                 :            : 
    1209         [ #  # ]:          0 :     if(nModifier == KEY_SHIFT)
    1210                 :          0 :         nValidFlags |= FRM_VALID_ALL;
    1211                 :          0 :     aBorderInner.SetValid( VALID_TOP,       0 != (nValidFlags&FRM_VALID_TOP ));
    1212                 :          0 :     aBorderInner.SetValid( VALID_BOTTOM,    0 != (nValidFlags&FRM_VALID_BOTTOM ));
    1213                 :          0 :     aBorderInner.SetValid( VALID_LEFT,      0 != (nValidFlags&FRM_VALID_LEFT));
    1214                 :          0 :     aBorderInner.SetValid( VALID_RIGHT,     0 != (nValidFlags&FRM_VALID_RIGHT ));
    1215                 :          0 :     aBorderInner.SetValid( VALID_HORI,      0 != (nValidFlags&FRM_VALID_HINNER ));
    1216                 :          0 :     aBorderInner.SetValid( VALID_VERT,      0 != (nValidFlags&FRM_VALID_VINNER));
    1217                 :          0 :     aBorderInner.SetValid( VALID_DISTANCE, sal_True );
    1218                 :          0 :     aBorderInner.SetValid( VALID_DISABLE, sal_False );
    1219                 :            : 
    1220         [ #  # ]:          0 :     if ( IsInPopupMode() )
    1221         [ #  # ]:          0 :         EndPopupMode();
    1222                 :            : 
    1223                 :          0 :     Any a;
    1224         [ #  # ]:          0 :     Sequence< PropertyValue > aArgs( 2 );
    1225         [ #  # ]:          0 :     aArgs[0].Name = OUString( "OuterBorder" );
    1226         [ #  # ]:          0 :     aBorderOuter.QueryValue( a );
    1227         [ #  # ]:          0 :     aArgs[0].Value = a;
    1228         [ #  # ]:          0 :     aArgs[1].Name = OUString( "InnerBorder" );
    1229         [ #  # ]:          0 :     aBorderInner.QueryValue( a );
    1230         [ #  # ]:          0 :     aArgs[1].Value = a;
    1231                 :            : 
    1232                 :            :     /*  #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call.
    1233                 :            :         This instance may be deleted in the meantime (i.e. when a dialog is opened
    1234                 :            :         while in Dispatch()), accessing members will crash in this case. */
    1235         [ #  # ]:          0 :     aFrameSet.SetNoSelection();
    1236                 :            : 
    1237         [ #  # ]:          0 :     SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
    1238                 :            :                                  OUString( ".uno:SetBorderStyle" ),
    1239 [ #  # ][ #  # ]:          0 :                                  aArgs );
                 [ #  # ]
    1240 [ #  # ][ #  # ]:          0 :     return 0;
                 [ #  # ]
    1241                 :            : }
    1242                 :            : 
    1243                 :            : // -----------------------------------------------------------------------
    1244                 :            : 
    1245                 :          0 : void SvxFrameWindow_Impl::Resize()
    1246                 :            : {
    1247                 :          0 :     lcl_ResizeValueSet( *this, aFrameSet);
    1248                 :          0 : }
    1249                 :            : 
    1250                 :            : // -----------------------------------------------------------------------
    1251                 :            : 
    1252                 :          0 : void SvxFrameWindow_Impl::StateChanged(
    1253                 :            : 
    1254                 :            :     sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
    1255                 :            : 
    1256                 :            : {
    1257 [ #  # ][ #  # ]:          0 :     if ( pState && nSID == SID_BORDER_REDUCED_MODE)
    1258                 :            :     {
    1259 [ #  # ][ #  # ]:          0 :         const SfxBoolItem* pItem = PTR_CAST( SfxBoolItem, pState );
    1260                 :            : 
    1261         [ #  # ]:          0 :         if ( pItem )
    1262                 :            :         {
    1263                 :          0 :             bParagraphMode = (sal_Bool)pItem->GetValue();
    1264                 :            :             //initial calls mustn't insert or remove elements
    1265         [ #  # ]:          0 :             if(aFrameSet.GetItemCount())
    1266                 :            :             {
    1267                 :          0 :                 sal_Bool bTableMode = ( aFrameSet.GetItemCount() == 12 );
    1268                 :          0 :                 sal_Bool bResize    = sal_False;
    1269                 :            : 
    1270 [ #  # ][ #  # ]:          0 :                 if ( bTableMode && bParagraphMode )
    1271                 :            :                 {
    1272         [ #  # ]:          0 :                     for ( sal_uInt16 i = 9; i < 13; i++ )
    1273                 :          0 :                         aFrameSet.RemoveItem(i);
    1274                 :          0 :                     bResize = sal_True;
    1275                 :            :                 }
    1276 [ #  # ][ #  # ]:          0 :                 else if ( !bTableMode && !bParagraphMode )
    1277                 :            :                 {
    1278         [ #  # ]:          0 :                     for ( sal_uInt16 i = 9; i < 13; i++ )
    1279         [ #  # ]:          0 :                         aFrameSet.InsertItem( i, aImgList.GetImage(i) );
    1280                 :          0 :                     bResize = sal_True;
    1281                 :            :                 }
    1282                 :            : 
    1283         [ #  # ]:          0 :                 if ( bResize )
    1284                 :            :                 {
    1285         [ #  # ]:          0 :                     lcl_CalcSizeValueSet( *this, aFrameSet,Size( 20, 20 ));
    1286                 :            :                 }
    1287                 :            :             }
    1288                 :            :         }
    1289                 :            :     }
    1290                 :          0 :     SfxPopupWindow::StateChanged( nSID, eState, pState );
    1291                 :          0 : }
    1292                 :            : 
    1293                 :            : // -----------------------------------------------------------------------
    1294                 :            : 
    1295                 :          0 : void SvxFrameWindow_Impl::StartSelection()
    1296                 :            : {
    1297                 :          0 :     aFrameSet.StartSelection();
    1298                 :          0 : }
    1299                 :            : 
    1300                 :            : // -----------------------------------------------------------------------
    1301                 :            : 
    1302                 :          0 : sal_Bool SvxFrameWindow_Impl::Close()
    1303                 :            : {
    1304                 :          0 :     return SfxPopupWindow::Close();
    1305                 :            : }
    1306                 :            : 
    1307                 :            : //========================================================================
    1308                 :            : // class SvxLineWindow_Impl --------------------------------------------------
    1309                 :            : //========================================================================
    1310                 :          0 : Color lcl_mediumColor( Color aMain, Color /*aDefault*/ )
    1311                 :            : {
    1312                 :          0 :     return SvxBorderLine::threeDMediumColor( aMain );
    1313                 :            : }
    1314                 :            : 
    1315                 :          0 : SvxLineWindow_Impl::SvxLineWindow_Impl( sal_uInt16 nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
    1316                 :            : 
    1317                 :            :     SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP | WB_OWNERDRAWDECORATION | WB_AUTOSIZE ) ),
    1318         [ #  # ]:          0 :     m_aLineStyleLb( this )
    1319                 :            : {
    1320                 :            :     try
    1321                 :            :     {
    1322 [ #  # ][ #  # ]:          0 :         Reference< lang::XServiceInfo > xServices( rFrame->getController()->getModel(), UNO_QUERY_THROW );
         [ #  # ][ #  # ]
                 [ #  # ]
    1323 [ #  # ][ #  # ]:          0 :         m_bIsWriter = xServices->supportsService(::rtl::OUString("com.sun.star.text.TextDocument"));
                 [ #  # ]
    1324                 :            :     }
    1325         [ #  # ]:          0 :     catch(const uno::Exception& )
    1326                 :            :     {
    1327                 :            :     }
    1328                 :            : 
    1329         [ #  # ]:          0 :     m_aLineStyleLb.SetPosSizePixel( 2, 2, 110, 140 );
    1330         [ #  # ]:          0 :     SetOutputSizePixel( Size( 114, 144 ) );
    1331                 :            : 
    1332                 :          0 :     m_aLineStyleLb.SetSourceUnit( FUNIT_TWIP );
    1333 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.SetNone( SVX_RESSTR(STR_NONE) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1334                 :            : 
    1335                 :            :     using namespace table::BorderLineStyle;
    1336 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( SOLID ), SOLID );
    1337 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOTTED ), DOTTED );
    1338 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DASHED ), DASHED );
    1339                 :            : 
    1340                 :            :     // Double lines
    1341 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( DOUBLE ), DOUBLE );
    1342 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_SMALLGAP ), THINTHICK_SMALLGAP, 20 );
    1343 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_MEDIUMGAP ), THINTHICK_MEDIUMGAP );
    1344 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THINTHICK_LARGEGAP ), THINTHICK_LARGEGAP );
    1345 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_SMALLGAP ), THICKTHIN_SMALLGAP, 20 );
    1346 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_MEDIUMGAP ), THICKTHIN_MEDIUMGAP );
    1347 [ #  # ][ #  # ]:          0 :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( THICKTHIN_LARGEGAP ), THICKTHIN_LARGEGAP );
    1348                 :            : 
    1349                 :            :     // Engraved / Embossed
    1350                 :            :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( EMBOSSED ), EMBOSSED, 15,
    1351                 :            :             &SvxBorderLine::threeDLightColor, &SvxBorderLine::threeDDarkColor,
    1352 [ #  # ][ #  # ]:          0 :             &lcl_mediumColor );
    1353                 :            :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( ENGRAVED ), ENGRAVED, 15,
    1354                 :            :             &SvxBorderLine::threeDDarkColor, &SvxBorderLine::threeDLightColor,
    1355 [ #  # ][ #  # ]:          0 :             &lcl_mediumColor );
    1356                 :            : 
    1357                 :            :     // Inset / Outset
    1358                 :            :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( OUTSET ), OUTSET, 10,
    1359 [ #  # ][ #  # ]:          0 :            &SvxBorderLine::lightColor, &SvxBorderLine::darkColor );
    1360                 :            :     m_aLineStyleLb.InsertEntry( SvxBorderLine::getWidthImpl( INSET ), INSET, 10,
    1361 [ #  # ][ #  # ]:          0 :            &SvxBorderLine::darkColor, &SvxBorderLine::lightColor );
    1362         [ #  # ]:          0 :     m_aLineStyleLb.SetWidth( 20 ); // 1pt by default
    1363                 :            : 
    1364         [ #  # ]:          0 :     m_aLineStyleLb.SetSelectHdl( LINK( this, SvxLineWindow_Impl, SelectHdl ) );
    1365                 :            : 
    1366         [ #  # ]:          0 :     SetHelpId( HID_POPUP_LINE );
    1367 [ #  # ][ #  # ]:          0 :     SetText( SVX_RESSTR(RID_SVXSTR_FRAME_STYLE) );
         [ #  # ][ #  # ]
                 [ #  # ]
    1368         [ #  # ]:          0 :     m_aLineStyleLb.Show();
    1369                 :          0 : }
    1370                 :            : 
    1371                 :          0 : SfxPopupWindow* SvxLineWindow_Impl::Clone() const
    1372                 :            : {
    1373         [ #  # ]:          0 :     return new SvxLineWindow_Impl( GetId(), GetFrame(), GetParent() );
    1374                 :            : }
    1375                 :            : 
    1376                 :            : // -----------------------------------------------------------------------
    1377                 :            : 
    1378                 :          0 : IMPL_LINK_NOARG(SvxLineWindow_Impl, SelectHdl)
    1379                 :            : {
    1380         [ #  # ]:          0 :     SvxLineItem     aLineItem( SID_FRAME_LINESTYLE );
    1381         [ #  # ]:          0 :     SvxBorderStyle  nStyle = SvxBorderStyle( m_aLineStyleLb.GetSelectEntryStyle() );
    1382                 :            : 
    1383 [ #  # ][ #  # ]:          0 :     if ( m_aLineStyleLb.GetSelectEntryPos( ) > 0 )
    1384                 :            :     {
    1385         [ #  # ]:          0 :         SvxBorderLine aTmp;
    1386         [ #  # ]:          0 :         aTmp.SetBorderLineStyle( nStyle );
    1387                 :          0 :         aTmp.SetWidth( 20 ); // TODO Make it depend on a width field
    1388         [ #  # ]:          0 :         aLineItem.SetLine( &aTmp );
    1389                 :            :     }
    1390                 :            :     else
    1391         [ #  # ]:          0 :         aLineItem.SetLine( NULL );
    1392                 :            : 
    1393         [ #  # ]:          0 :     if ( IsInPopupMode() )
    1394         [ #  # ]:          0 :         EndPopupMode();
    1395                 :            : 
    1396                 :          0 :     Any a;
    1397         [ #  # ]:          0 :     Sequence< PropertyValue > aArgs( 1 );
    1398         [ #  # ]:          0 :     aArgs[0].Name = OUString( "LineStyle" );
    1399 [ #  # ][ #  # ]:          0 :     aLineItem.QueryValue( a, m_bIsWriter ? CONVERT_TWIPS : 0 );
    1400         [ #  # ]:          0 :     aArgs[0].Value = a;
    1401                 :            : 
    1402         [ #  # ]:          0 :     SfxToolBoxControl::Dispatch( Reference< XDispatchProvider >( GetFrame()->getController(), UNO_QUERY ),
    1403                 :            :                                  OUString( ".uno:LineStyle" ),
    1404 [ #  # ][ #  # ]:          0 :                                  aArgs );
                 [ #  # ]
    1405 [ #  # ][ #  # ]:          0 :     return 0;
    1406                 :            : }
    1407                 :            : 
    1408                 :            : // -----------------------------------------------------------------------
    1409                 :            : 
    1410                 :          0 : void SvxLineWindow_Impl::Resize()
    1411                 :            : {
    1412                 :          0 :     m_aLineStyleLb.Resize();
    1413                 :          0 : }
    1414                 :            : 
    1415                 :            : // -----------------------------------------------------------------------
    1416                 :            : 
    1417                 :          0 : sal_Bool SvxLineWindow_Impl::Close()
    1418                 :            : {
    1419                 :          0 :     return SfxPopupWindow::Close();
    1420                 :            : }
    1421                 :            : 
    1422                 :            : // -----------------------------------------------------------------------
    1423                 :            : 
    1424                 :          0 : Window* SvxLineWindow_Impl::GetPreferredKeyInputWindow()
    1425                 :            : {
    1426                 :          0 :     return &m_aLineStyleLb;
    1427                 :            : }
    1428                 :            : 
    1429                 :            : // -----------------------------------------------------------------------
    1430                 :            : 
    1431                 :          0 : void SvxLineWindow_Impl::GetFocus()
    1432                 :            : {
    1433                 :          0 :     m_aLineStyleLb.GrabFocus();
    1434                 :          0 : }
    1435                 :            : 
    1436                 :          0 : void SvxLineWindow_Impl::DataChanged( const DataChangedEvent& rDCEvt )
    1437                 :            : {
    1438                 :          0 :     SfxPopupWindow::DataChanged( rDCEvt );
    1439                 :            : #if 0
    1440                 :            :     if( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) && ( rDCEvt.GetFlags() & SETTINGS_STYLE ) )
    1441                 :            :     {
    1442                 :            :         CreateBitmaps();
    1443                 :            :         Invalidate();
    1444                 :            :     }
    1445                 :            : #endif
    1446                 :          0 : }
    1447                 :            : 
    1448                 :            : // -----------------------------------------------------------------------
    1449                 :            : 
    1450                 :            : //########################################################################
    1451                 :            : // Hilfsklassen
    1452                 :            : 
    1453                 :            : //========================================================================
    1454                 :            : // class SfxStyleControllerItem_Impl ------------------------------------------
    1455                 :            : //========================================================================
    1456                 :            : 
    1457                 :       4805 : SfxStyleControllerItem_Impl::SfxStyleControllerItem_Impl(
    1458                 :            :     const Reference< XDispatchProvider >& rDispatchProvider,
    1459                 :            :     sal_uInt16                                nSlotId,      // Family-ID
    1460                 :            :     const rtl::OUString&                  rCommand,     // .uno: command bound to this item
    1461                 :            :     SvxStyleToolBoxControl&               rTbxCtl )     // Controller-Instanz, dem dieses Item zugeordnet ist.
    1462                 :            :     :   SfxStatusListener( rDispatchProvider, nSlotId, rCommand ),
    1463                 :       4805 :         rControl( rTbxCtl )
    1464                 :            : {
    1465                 :       4805 : }
    1466                 :            : 
    1467                 :            : // -----------------------------------------------------------------------
    1468                 :            : 
    1469                 :       7903 : void SfxStyleControllerItem_Impl::StateChanged(
    1470                 :            :     sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
    1471                 :            : {
    1472         [ +  - ]:       7903 :     switch ( GetId() )
    1473                 :            :     {
    1474                 :            :         case SID_STYLE_FAMILY1:
    1475                 :            :         case SID_STYLE_FAMILY2:
    1476                 :            :         case SID_STYLE_FAMILY3:
    1477                 :            :         case SID_STYLE_FAMILY4:
    1478                 :            :         case SID_STYLE_FAMILY5:
    1479                 :            :         {
    1480                 :       7903 :             const sal_uInt16 nIdx = GetId() - SID_STYLE_FAMILY_START;
    1481                 :            : 
    1482         [ +  + ]:       7903 :             if ( SFX_ITEM_AVAILABLE == eState )
    1483                 :            :             {
    1484                 :            :                 const SfxTemplateItem* pStateItem =
    1485 [ +  - ][ +  - ]:       5919 :                     PTR_CAST( SfxTemplateItem, pState );
    1486                 :            :                 DBG_ASSERT( pStateItem != NULL, "SfxTemplateItem expected" );
    1487                 :       5919 :                 rControl.SetFamilyState( nIdx, pStateItem );
    1488                 :            :             }
    1489                 :            :             else
    1490                 :       1984 :                 rControl.SetFamilyState( nIdx, NULL );
    1491                 :       7903 :             break;
    1492                 :            :         }
    1493                 :            :     }
    1494                 :       7903 : }
    1495                 :            : 
    1496                 :            : //########################################################################
    1497                 :            : 
    1498                 :            : //========================================================================
    1499                 :            : // class SvxStyleToolBoxControl ------------------------------------------
    1500                 :            : //========================================================================
    1501                 :            : 
    1502         [ +  - ]:        961 : struct SvxStyleToolBoxControl::Impl
    1503                 :            : {
    1504                 :            :     String                              aClearForm;
    1505                 :            :     String                              aMore;
    1506                 :            :     ::std::vector< ::rtl::OUString >    aDefaultStyles;
    1507                 :            :     sal_Bool                        bListening;
    1508                 :            :     sal_Bool                        bSpecModeWriter;
    1509                 :            :     sal_Bool                        bSpecModeCalc;
    1510                 :            : 
    1511                 :        961 :     inline Impl( void )
    1512                 :        961 :         :aClearForm         ( SVX_RESSTR( RID_SVXSTR_CLEARFORM ) )
    1513         [ +  - ]:        961 :         ,aMore              ( SVX_RESSTR( RID_SVXSTR_MORE ) )
    1514                 :            :         ,bListening         ( sal_False )
    1515                 :            :         ,bSpecModeWriter    ( sal_False )
    1516 [ +  - ][ +  - ]:       1922 :         ,bSpecModeCalc      ( sal_False )
         [ +  - ][ +  - ]
                 [ +  - ]
    1517                 :            :     {
    1518                 :            : 
    1519                 :            : 
    1520                 :        961 :     }
    1521                 :        961 :     void InitializeStyles(Reference < frame::XModel > xModel)
    1522                 :            :     {
    1523                 :            :         //now convert the default style names to the localized names
    1524                 :            :         try
    1525                 :            :         {
    1526         [ +  - ]:        961 :             Reference< style::XStyleFamiliesSupplier > xStylesSupplier( xModel, UNO_QUERY_THROW );
    1527         [ +  - ]:        961 :             Reference< lang::XServiceInfo > xServices( xModel, UNO_QUERY_THROW );
    1528 [ +  - ][ +  - ]:        961 :             bSpecModeWriter = xServices->supportsService(::rtl::OUString("com.sun.star.text.TextDocument"));
    1529         [ +  + ]:        961 :             if(bSpecModeWriter)
    1530                 :            :             {
    1531                 :        758 :                 Reference<container::XNameAccess> xParaStyles;
    1532 [ +  - ][ +  - ]:       1516 :                     xStylesSupplier->getStyleFamilies()->getByName(::rtl::OUString("ParagraphStyles")) >>=
                 [ +  - ]
    1533 [ +  - ][ +  - ]:        758 :                     xParaStyles;
    1534                 :            :                 static const sal_Char* aWriterStyles[] =
    1535                 :            :                 {
    1536                 :            :                     "Standard",
    1537                 :            :                     "Heading 1",
    1538                 :            :                     "Heading 2",
    1539                 :            :                     "Heading 3",
    1540                 :            :                     "Text body"
    1541                 :            :                 };
    1542         [ +  + ]:       4548 :                 for( sal_uInt32 nStyle = 0; nStyle < sizeof( aWriterStyles ) / sizeof( sal_Char*); ++nStyle )
    1543                 :            :                 {
    1544                 :            :                     try
    1545                 :            :                     {
    1546                 :       3790 :                         Reference< beans::XPropertySet > xStyle;
    1547 [ +  - ][ +  - ]:       3790 :                         xParaStyles->getByName( rtl::OUString::createFromAscii( aWriterStyles[nStyle] )) >>= xStyle;
                 [ +  - ]
    1548                 :       3790 :                         ::rtl::OUString sName;
    1549 [ +  - ][ +  - ]:       3790 :                         xStyle->getPropertyValue(::rtl::OUString("DisplayName")) >>= sName;
    1550         [ +  - ]:       3790 :                         if( !sName.isEmpty() )
    1551 [ +  - ][ #  # ]:       3790 :                             aDefaultStyles.push_back(sName);
    1552                 :            :                     }
    1553         [ #  # ]:          0 :                     catch( const uno::Exception& )
    1554                 :            :                     {}
    1555                 :        758 :                 }
    1556                 :            : 
    1557                 :            :             }
    1558         [ +  + ]:        203 :             else if( 0 != (
    1559         [ +  - ]:        203 :                 bSpecModeCalc = xServices->supportsService(::rtl::OUString(
    1560         [ +  - ]:        203 :                     "com.sun.star.sheet.SpreadsheetDocument"))))
    1561                 :            :             {
    1562                 :            :                 static const sal_Char* aCalcStyles[] =
    1563                 :            :                 {
    1564                 :            :                     "Default",
    1565                 :            :                     "Heading1",
    1566                 :            :                     "Result",
    1567                 :            :                     "Result2"
    1568                 :            :                 };
    1569                 :        199 :                 Reference<container::XNameAccess> xCellStyles;
    1570 [ +  - ][ +  - ]:        398 :                     xStylesSupplier->getStyleFamilies()->getByName(
                 [ +  - ]
    1571                 :        199 :                         ::rtl::OUString("CellStyles")) >>=
    1572 [ +  - ][ +  - ]:        199 :                         xCellStyles;
    1573         [ +  + ]:        995 :                 for( sal_uInt32 nStyle = 0; nStyle < sizeof( aCalcStyles ) / sizeof( sal_Char*); ++nStyle )
    1574                 :            :                 {
    1575                 :            :                     try
    1576                 :            :                     {
    1577                 :        796 :                         const rtl::OUString sStyleName( rtl::OUString::createFromAscii( aCalcStyles[nStyle] ) );
    1578 [ +  - ][ +  - ]:        796 :                         if( xCellStyles->hasByName( sStyleName ) )
                 [ +  - ]
    1579                 :            :                         {
    1580 [ +  - ][ +  - ]:        796 :                             Reference< beans::XPropertySet > xStyle( xCellStyles->getByName( sStyleName), UNO_QUERY_THROW );
                 [ +  - ]
    1581                 :        796 :                             ::rtl::OUString sName;
    1582 [ +  - ][ +  - ]:        796 :                             xStyle->getPropertyValue(::rtl::OUString("DisplayName")) >>= sName;
    1583         [ +  - ]:        796 :                             if( !sName.isEmpty() )
    1584         [ +  - ]:        796 :                                 aDefaultStyles.push_back(sName);
    1585         [ #  # ]:        796 :                         }
    1586                 :            :                     }
    1587         [ #  # ]:          0 :                     catch( const uno::Exception& )
    1588                 :            :                     {}
    1589                 :        199 :                 }
    1590         [ #  # ]:        961 :             }
    1591                 :            :         }
    1592                 :          0 :         catch(const uno::Exception& )
    1593                 :            :         {
    1594                 :            :             OSL_FAIL("error while initializing style names");
    1595                 :            :         }
    1596                 :        961 :     }
    1597                 :            : };
    1598                 :            : 
    1599                 :            : 
    1600                 :            : // mapping table from bound items. BE CAREFUL this table must be in the
    1601                 :            : // same order as the uno commands bound to the slots SID_STYLE_FAMILY1..n
    1602                 :            : // MAX_FAMILIES must also be correctly set!
    1603                 :            : static const char* StyleSlotToStyleCommand[MAX_FAMILIES] =
    1604                 :            : {
    1605                 :            :     ".uno:CharStyle",
    1606                 :            :     ".uno:ParaStyle",
    1607                 :            :     ".uno:FrameStyle",
    1608                 :            :     ".uno:PageStyle",
    1609                 :            :     ".uno:TemplateFamily5"
    1610                 :            : };
    1611                 :            : 
    1612                 :        961 : SvxStyleToolBoxControl::SvxStyleToolBoxControl(
    1613                 :            :     sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
    1614                 :            :     :   SfxToolBoxControl   ( nSlotId, nId, rTbx ),
    1615                 :            :         pStyleSheetPool     ( NULL ),
    1616                 :            :         nActFamily          ( 0xffff ),
    1617 [ +  + ][ +  - ]:       5766 :         pImpl               ( new Impl )
         [ +  - ][ +  - ]
    1618                 :            : {
    1619         [ +  + ]:       5766 :     for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
    1620                 :            :     {
    1621                 :       4805 :         pBoundItems[i] = 0;
    1622         [ +  - ]:       4805 :         m_xBoundItems[i] = Reference< XComponent >();
    1623                 :       4805 :         pFamilyState[i]  = NULL;
    1624                 :            :     }
    1625   [ #  #  #  # ]:        961 : }
    1626                 :            : 
    1627                 :            : // -----------------------------------------------------------------------
    1628         [ +  - ]:       6727 : SvxStyleToolBoxControl::~SvxStyleToolBoxControl()
    1629                 :            : {
    1630         [ +  - ]:       7688 : }
           [ +  +  -  + ]
           [ #  #  #  # ]
    1631                 :            : 
    1632                 :            : // -----------------------------------------------------------------------
    1633                 :        961 : void SAL_CALL SvxStyleToolBoxControl::initialize( const Sequence< Any >& aArguments )
    1634                 :            : throw ( Exception, RuntimeException)
    1635                 :            : {
    1636                 :        961 :     SfxToolBoxControl::initialize( aArguments );
    1637                 :            : 
    1638                 :            :     // After initialize we should have a valid frame member where we can retrieve our
    1639                 :            :     // dispatch provider.
    1640         [ +  - ]:        961 :     if ( m_xFrame.is() )
    1641                 :            :     {
    1642 [ +  - ][ +  - ]:        961 :         pImpl->InitializeStyles(m_xFrame->getController()->getModel());
         [ +  - ][ +  - ]
                 [ +  - ]
    1643 [ +  - ][ +  - ]:        961 :         Reference< XDispatchProvider > xDispatchProvider( m_xFrame->getController(), UNO_QUERY );
                 [ +  - ]
    1644         [ +  + ]:       5766 :         for ( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
    1645                 :            :         {
    1646                 :       4805 :             pBoundItems[i]   = new SfxStyleControllerItem_Impl( xDispatchProvider,
    1647                 :            :                                                                 SID_STYLE_FAMILY_START + i,
    1648                 :            :                                                                 OUString::createFromAscii( StyleSlotToStyleCommand[i] ),
    1649         [ +  - ]:       4805 :                                                                 *this );
    1650 [ +  - ][ +  - ]:       4805 :             m_xBoundItems[i] = Reference< XComponent >( static_cast< OWeakObject* >( pBoundItems[i] ), UNO_QUERY );
                 [ +  - ]
    1651                 :       4805 :             pFamilyState[i]  = NULL;
    1652                 :        961 :         }
    1653                 :            :     }
    1654                 :        961 : }
    1655                 :            : 
    1656                 :            : // XComponent
    1657                 :        961 : void SAL_CALL SvxStyleToolBoxControl::dispose()
    1658                 :            : throw (::com::sun::star::uno::RuntimeException)
    1659                 :            : {
    1660                 :        961 :     SfxToolBoxControl::dispose();
    1661                 :            : 
    1662         [ +  + ]:       5766 :     for( sal_uInt16 i=0; i<MAX_FAMILIES; i++ )
    1663                 :            :     {
    1664         [ +  - ]:       4805 :         if ( m_xBoundItems[i].is() )
    1665                 :            :         {
    1666                 :            :             try
    1667                 :            :             {
    1668 [ +  - ][ +  - ]:       4805 :                 m_xBoundItems[i]->dispose();
    1669                 :            :             }
    1670                 :          0 :             catch ( Exception& )
    1671                 :            :             {
    1672                 :            :             }
    1673                 :            : 
    1674                 :       4805 :             m_xBoundItems[i].clear();
    1675                 :       4805 :             pBoundItems[i] = 0;
    1676                 :            :         }
    1677         [ +  + ]:       4805 :         DELETEZ( pFamilyState[i] );
    1678                 :            :     }
    1679                 :        961 :     pStyleSheetPool = NULL;
    1680         [ +  - ]:        961 :     DELETEZ( pImpl );
    1681         [ #  # ]:        961 : }
    1682                 :            : 
    1683                 :            : // -----------------------------------------------------------------------
    1684                 :        939 : void SAL_CALL SvxStyleToolBoxControl::update() throw (RuntimeException)
    1685                 :            : {
    1686                 :            :     // Do nothing, we will start binding our listener when we are visible.
    1687                 :            :     // See link SvxStyleToolBoxControl::VisibilityNotification.
    1688                 :        939 :     SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() );
    1689         [ +  + ]:        939 :     if ( pBox->IsVisible() )
    1690                 :            :     {
    1691         [ +  + ]:       4482 :         for ( int i=0; i<MAX_FAMILIES; i++ )
    1692                 :       3735 :             pBoundItems [i]->ReBind();
    1693                 :            : 
    1694                 :        747 :         bindListener();
    1695                 :            :     }
    1696                 :        939 : }
    1697                 :            : 
    1698                 :            : // -----------------------------------------------------------------------
    1699                 :            : 
    1700                 :       9961 : SfxStyleFamily SvxStyleToolBoxControl::GetActFamily()
    1701                 :            : {
    1702   [ -  +  +  -  :       9961 :     switch ( nActFamily-1 + SID_STYLE_FAMILY_START )
                   -  - ]
    1703                 :            :     {
    1704                 :          0 :         case SID_STYLE_FAMILY1: return SFX_STYLE_FAMILY_CHAR;
    1705                 :       9199 :         case SID_STYLE_FAMILY2: return SFX_STYLE_FAMILY_PARA;
    1706                 :        762 :         case SID_STYLE_FAMILY3: return SFX_STYLE_FAMILY_FRAME;
    1707                 :          0 :         case SID_STYLE_FAMILY4: return SFX_STYLE_FAMILY_PAGE;
    1708                 :          0 :         case SID_STYLE_FAMILY5: return SFX_STYLE_FAMILY_PSEUDO;
    1709                 :            :         default:
    1710                 :            :             OSL_FAIL( "unknown style family" );
    1711                 :          0 :             break;
    1712                 :            :     }
    1713                 :       9961 :     return SFX_STYLE_FAMILY_PARA;
    1714                 :            : }
    1715                 :            : 
    1716                 :            : // -----------------------------------------------------------------------
    1717                 :            : 
    1718                 :       9961 : void SvxStyleToolBoxControl::FillStyleBox()
    1719                 :            : {
    1720                 :       9961 :     SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() );
    1721                 :            : 
    1722                 :            :     DBG_ASSERT( pStyleSheetPool, "StyleSheetPool not found!" );
    1723                 :            :     DBG_ASSERT( pBox,            "Control not found!" );
    1724                 :            : 
    1725 [ +  - ][ +  - ]:       9961 :     if ( pStyleSheetPool && pBox && nActFamily!=0xffff )
                 [ +  - ]
    1726                 :            :     {
    1727                 :       9961 :         const SfxStyleFamily    eFamily     = GetActFamily();
    1728                 :       9961 :         sal_uInt16                  nCount      = pStyleSheetPool->Count();
    1729                 :       9961 :         SfxStyleSheetBase*      pStyle      = NULL;
    1730                 :       9961 :         sal_Bool                    bDoFill     = sal_False;
    1731                 :            : 
    1732                 :       9961 :         pStyleSheetPool->SetSearchMask( eFamily, SFXSTYLEBIT_USED );
    1733                 :            : 
    1734                 :            :         //------------------------------
    1735                 :            :         // Ueberpruefen, ob Fill noetig:
    1736                 :            :         //------------------------------
    1737                 :            : 
    1738                 :       9961 :         pStyle = pStyleSheetPool->First();
    1739                 :            :         //!!! TODO: This condition isn't right any longer, because we always show some default entries
    1740                 :            :         //!!! so the list doesn't show the count
    1741         [ +  + ]:       9961 :         if ( nCount != pBox->GetEntryCount() )
    1742                 :            :         {
    1743                 :       9890 :             bDoFill = sal_True;
    1744                 :            :         }
    1745                 :            :         else
    1746                 :            :         {
    1747                 :         71 :             sal_uInt16 i= 0;
    1748 [ +  + ][ +  + ]:        184 :             while ( pStyle && !bDoFill )
                 [ +  + ]
    1749                 :            :             {
    1750         [ +  - ]:        113 :                 bDoFill = ( pBox->GetEntry(i) != pStyle->GetName() );
    1751                 :        113 :                 pStyle = pStyleSheetPool->Next();
    1752                 :        113 :                 i++;
    1753                 :            :             }
    1754                 :            :         }
    1755                 :            : 
    1756         [ +  - ]:       9961 :         if ( bDoFill )
    1757                 :            :         {
    1758                 :       9961 :             pBox->SetUpdateMode( sal_False );
    1759                 :       9961 :             pBox->Clear();
    1760                 :            : 
    1761                 :            :             {
    1762                 :            :                 sal_uInt16  _i;
    1763                 :       9961 :                 sal_uInt32  nCnt = pImpl->aDefaultStyles.size();
    1764                 :            : 
    1765                 :       9961 :                 pStyle = pStyleSheetPool->First();
    1766                 :            : 
    1767 [ -  + ][ +  + ]:       9961 :                 if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
    1768                 :            :                 {
    1769                 :            :                     bool bInsert;
    1770         [ +  + ]:      19757 :                     while ( pStyle )
    1771                 :            :                     {
    1772                 :            :                         // sort out default styles
    1773                 :       9846 :                         bInsert = true;
    1774 [ +  - ][ +  - ]:       9846 :                         ::rtl::OUString aName( pStyle->GetName() );
    1775         [ +  + ]:      13376 :                         for( _i = 0 ; _i < nCnt ; ++_i )
    1776                 :            :                         {
    1777         [ +  + ]:      12738 :                             if( pImpl->aDefaultStyles[_i] == aName )
    1778                 :            :                             {
    1779                 :       9208 :                                 bInsert = false;
    1780                 :       9208 :                                 break;
    1781                 :            :                             }
    1782                 :            :                         }
    1783                 :            : 
    1784         [ +  + ]:       9846 :                         if( bInsert )
    1785 [ +  - ][ +  - ]:        638 :                             pBox->InsertEntry( aName );
                 [ +  - ]
    1786         [ +  - ]:       9846 :                         pStyle = pStyleSheetPool->Next();
    1787                 :      19757 :                     }
    1788                 :            :                 }
    1789                 :            :                 else
    1790                 :            :                 {
    1791         [ +  + ]:        188 :                     while ( pStyle )
    1792                 :            :                     {
    1793                 :        138 :                         pBox->InsertEntry( pStyle->GetName() );
    1794                 :        138 :                         pStyle = pStyleSheetPool->Next();
    1795                 :            :                     }
    1796                 :            :                 }
    1797                 :            :             }
    1798                 :            : 
    1799 [ +  + ][ -  + ]:       9961 :             if( pImpl->bSpecModeWriter || pImpl->bSpecModeCalc )
    1800                 :            :             {
    1801                 :            :                 // insert default styles
    1802                 :            :                 sal_uInt16  _i;
    1803                 :       9911 :                 sal_uInt32  nCnt = pImpl->aDefaultStyles.size();
    1804                 :       9911 :                 sal_uInt16 nPos = 1;
    1805         [ +  + ]:      59466 :                 for( _i = 0 ; _i < nCnt ; ++_i )
    1806                 :            :                 {
    1807         [ +  - ]:      49555 :                     pBox->InsertEntry( pImpl->aDefaultStyles[_i], nPos );
    1808                 :      49555 :                     ++nPos;
    1809                 :            :                 }
    1810                 :            : 
    1811                 :            :                 // disable sort to preserve special order
    1812                 :       9911 :                 WinBits nWinBits = pBox->GetStyle();
    1813                 :       9911 :                 nWinBits &= ~WB_SORT;
    1814                 :       9911 :                 pBox->SetStyle( nWinBits );
    1815                 :            : 
    1816                 :       9911 :                 pBox->InsertEntry( pImpl->aClearForm, 0 );
    1817                 :       9911 :                 pBox->SetSeparatorPos( 0 );
    1818                 :            : 
    1819                 :       9911 :                 pBox->InsertEntry( pImpl->aMore );
    1820                 :            : 
    1821                 :            :                 // enable sort again
    1822                 :       9911 :                 nWinBits |= WB_SORT;
    1823                 :       9911 :                 pBox->SetStyle( nWinBits );
    1824                 :            :             }
    1825                 :            : 
    1826                 :       9961 :             pBox->SetUpdateMode( sal_True );
    1827                 :       9961 :             pBox->SetFamily( eFamily );
    1828                 :            : 
    1829                 :       9961 :             sal_uInt16 nLines = Min( pBox->GetEntryCount(), MAX_STYLES_ENTRIES );
    1830                 :       9961 :             pBox->SetDropDownLineCount( nLines );
    1831                 :            :         }
    1832                 :            :     }
    1833                 :       9961 : }
    1834                 :            : 
    1835                 :            : // -----------------------------------------------------------------------
    1836                 :            : 
    1837                 :       9199 : void SvxStyleToolBoxControl::SelectStyle( const String& rStyleName )
    1838                 :            : {
    1839                 :       9199 :     SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)GetToolBox().GetItemWindow( GetId() );
    1840                 :            :     DBG_ASSERT( pBox, "Control not found!" );
    1841                 :            : 
    1842         [ +  - ]:       9199 :     if ( pBox )
    1843                 :            :     {
    1844                 :            : //      String aStrSel( pBox->GetSelectEntry() );
    1845         [ +  - ]:       9199 :         String aStrSel( pBox->GetText() );
    1846                 :            : 
    1847         [ +  - ]:       9199 :         if ( rStyleName.Len() > 0 )
    1848                 :            :         {
    1849 [ +  - ][ +  + ]:       9199 :             if ( rStyleName != aStrSel )
    1850                 :            : //              pBox->SelectEntry( rStyleName );
    1851         [ +  - ]:        770 :                 pBox->SetText( rStyleName );
    1852                 :            :         }
    1853                 :            :         else
    1854         [ #  # ]:          0 :             pBox->SetNoSelection();
    1855 [ +  - ][ +  - ]:       9199 :         pBox->SaveValue();
    1856                 :            :     }
    1857                 :       9199 : }
    1858                 :            : 
    1859                 :            : // -----------------------------------------------------------------------
    1860                 :            : 
    1861                 :       9961 : void SvxStyleToolBoxControl::Update()
    1862                 :            : {
    1863                 :       9961 :     SfxStyleSheetBasePool*  pPool     = NULL;
    1864                 :       9961 :     SfxObjectShell*         pDocShell = SfxObjectShell::Current();
    1865                 :            : 
    1866         [ +  - ]:       9961 :     if ( pDocShell )
    1867                 :       9961 :         pPool = pDocShell->GetStyleSheetPool();
    1868                 :            : 
    1869                 :            :     sal_uInt16 i;
    1870         [ +  - ]:       9961 :     for ( i=0; i<MAX_FAMILIES; i++ )
    1871         [ +  - ]:       9961 :         if( pFamilyState[i] )
    1872                 :       9961 :             break;
    1873                 :            : 
    1874 [ +  - ][ -  + ]:       9961 :     if ( i==MAX_FAMILIES || !pPool )
    1875                 :            :     {
    1876                 :          0 :         pStyleSheetPool = pPool;
    1877                 :       9961 :         return;
    1878                 :            :     }
    1879                 :            : 
    1880                 :            :     //--------------------------------------------------------------------
    1881                 :       9961 :     const SfxTemplateItem* pItem = NULL;
    1882                 :            : 
    1883 [ +  + ][ +  + ]:       9961 :     if ( nActFamily == 0xffff || 0 == (pItem = pFamilyState[nActFamily-1]) )
                 [ +  + ]
    1884                 :            :         // aktueller Bereich nicht innerhalb der erlaubten Bereiche
    1885                 :            :         // oder Default
    1886                 :            :     {
    1887                 :       1524 :         pStyleSheetPool = pPool;
    1888                 :       1524 :         nActFamily      = 2;
    1889                 :            : 
    1890                 :       1524 :         pItem = pFamilyState[nActFamily-1];
    1891         [ +  + ]:       1524 :         if ( !pItem )
    1892                 :            :         {
    1893                 :        762 :             nActFamily++;
    1894                 :        762 :             pItem = pFamilyState[nActFamily-1];
    1895                 :            :         }
    1896                 :            : 
    1897                 :            :         if ( !pItem )
    1898                 :            :         {
    1899                 :            :             DBG_WARNING( "Unknown Family" ); // can happen
    1900                 :            :         }
    1901                 :            :     }
    1902         [ +  + ]:       8437 :     else if ( pPool != pStyleSheetPool )
    1903                 :          8 :         pStyleSheetPool = pPool;
    1904                 :            : 
    1905                 :       9961 :     FillStyleBox(); // entscheidet selbst, ob gefuellt werden muss
    1906                 :            : 
    1907         [ +  + ]:       9961 :     if ( pItem )
    1908                 :       9199 :         SelectStyle( pItem->GetStyleName() );
    1909                 :            : }
    1910                 :            : 
    1911                 :            : // -----------------------------------------------------------------------
    1912                 :            : 
    1913                 :       7903 : void SvxStyleToolBoxControl::SetFamilyState( sal_uInt16 nIdx,
    1914                 :            :                                              const SfxTemplateItem* pItem )
    1915                 :            : {
    1916         [ +  + ]:       7903 :     DELETEZ( pFamilyState[nIdx] );
    1917                 :            : 
    1918         [ +  + ]:       7903 :     if ( pItem )
    1919         [ +  - ]:       5919 :         pFamilyState[nIdx] = new SfxTemplateItem( *pItem );
    1920                 :            : 
    1921                 :       7903 :     Update();
    1922                 :       7903 : }
    1923                 :            : 
    1924                 :            : // -----------------------------------------------------------------------
    1925                 :            : 
    1926                 :       1524 : IMPL_LINK_NOARG(SvxStyleToolBoxControl, VisibilityNotification)
    1927                 :            : {
    1928                 :            : 
    1929                 :            :     sal_uInt16 i;
    1930                 :            : 
    1931                 :            :     // Call ReBind() && UnBind() according to visibility
    1932                 :       1524 :     SvxStyleBox_Impl* pBox = (SvxStyleBox_Impl*)( GetToolBox().GetItemWindow( GetId() ));
    1933 [ +  - ][ +  + ]:       1524 :     if ( pBox->IsVisible() && !isBound() )
                 [ +  + ]
    1934                 :            :     {
    1935         [ +  + ]:       4572 :         for ( i=0; i<MAX_FAMILIES; i++ )
    1936                 :       3810 :             pBoundItems [i]->ReBind();
    1937                 :            : 
    1938                 :        762 :         bindListener();
    1939                 :            :     }
    1940 [ +  - ][ -  + ]:        762 :     else if ( !pBox->IsVisible() && isBound() )
                 [ -  + ]
    1941                 :            :     {
    1942         [ #  # ]:          0 :         for ( i=0; i<MAX_FAMILIES; i++ )
    1943                 :          0 :             pBoundItems[i]->UnBind();
    1944                 :          0 :         unbindListener();
    1945                 :            :     }
    1946                 :            : 
    1947                 :       1524 :     return 0;
    1948                 :            : }
    1949                 :            : 
    1950                 :            : // -----------------------------------------------------------------------
    1951                 :            : 
    1952                 :       2058 : void SvxStyleToolBoxControl::StateChanged(
    1953                 :            : 
    1954                 :            :     sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
    1955                 :            : 
    1956                 :            : {
    1957                 :       2058 :     sal_uInt16       nId    = GetId();
    1958                 :       2058 :     ToolBox&     rTbx   = GetToolBox();
    1959                 :       2058 :     SvxStyleBox_Impl* pBox   = (SvxStyleBox_Impl*)(rTbx.GetItemWindow( nId ));
    1960                 :       2058 :     TriState     eTri   = STATE_NOCHECK;
    1961                 :            : 
    1962                 :            :     DBG_ASSERT( pBox, "Control not found!" );
    1963                 :            : 
    1964         [ -  + ]:       2058 :     if ( SFX_ITEM_DISABLED == eState )
    1965                 :          0 :         pBox->Disable();
    1966                 :            :     else
    1967                 :       2058 :         pBox->Enable();
    1968                 :            : 
    1969                 :       2058 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    1970                 :            : 
    1971      [ +  -  - ]:       2058 :     switch ( eState )
    1972                 :            :     {
    1973                 :            :         case SFX_ITEM_AVAILABLE:
    1974                 :       2058 :             eTri = ((const SfxBoolItem*)pState)->GetValue()
    1975                 :            :                         ? STATE_CHECK
    1976         [ +  - ]:       2058 :                         : STATE_NOCHECK;
    1977                 :       2058 :             break;
    1978                 :            : 
    1979                 :            :         case SFX_ITEM_DONTCARE:
    1980                 :          0 :             eTri = STATE_DONTKNOW;
    1981                 :          0 :             break;
    1982                 :            :     }
    1983                 :            : 
    1984                 :       2058 :     rTbx.SetItemState( nId, eTri );
    1985                 :            : 
    1986         [ +  - ]:       2058 :     if ( SFX_ITEM_DISABLED != eState )
    1987                 :       2058 :         Update();
    1988                 :       2058 : }
    1989                 :            : 
    1990                 :            : // -----------------------------------------------------------------------
    1991                 :            : 
    1992                 :        961 : Window* SvxStyleToolBoxControl::CreateItemWindow( Window *pParent )
    1993                 :            : {
    1994                 :            :     SvxStyleBox_Impl* pBox = new SvxStyleBox_Impl( pParent,
    1995                 :            :                                                    OUString( ".uno:StyleApply" ),
    1996                 :            :                                                    SFX_STYLE_FAMILY_PARA,
    1997         [ +  - ]:        961 :                                                    Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
    1998                 :            :                                                    m_xFrame,
    1999                 :            :                                                    pImpl->aClearForm,
    2000                 :            :                                                    pImpl->aMore,
    2001 [ +  - ][ +  - ]:       1922 :                                                    pImpl->bSpecModeWriter || pImpl->bSpecModeCalc );
         [ +  - ][ +  + ]
         [ +  + ][ +  - ]
    2002         [ +  + ]:        961 :     if( !pImpl->aDefaultStyles.empty())
    2003                 :        957 :         pBox->SetDefaultStyle( pImpl->aDefaultStyles[0] );
    2004                 :            :     // Set visibility listener to bind/unbind controller
    2005                 :        961 :     pBox->SetVisibilityListener( LINK( this, SvxStyleToolBoxControl, VisibilityNotification ));
    2006                 :            : 
    2007                 :        961 :     return pBox;
    2008                 :            : }
    2009                 :            : 
    2010                 :            : //========================================================================
    2011                 :            : // class SvxFontNameToolBoxControl ---------------------------------------
    2012                 :            : //========================================================================
    2013                 :            : 
    2014                 :        961 : SvxFontNameToolBoxControl::SvxFontNameToolBoxControl(
    2015                 :            :                                             sal_uInt16          nSlotId,
    2016                 :            :                                             sal_uInt16          nId,
    2017                 :            :                                             ToolBox&        rTbx )
    2018                 :            : 
    2019                 :        961 :     :   SfxToolBoxControl( nSlotId, nId, rTbx )
    2020                 :            : {
    2021                 :        961 : }
    2022                 :            : 
    2023                 :            : // -----------------------------------------------------------------------
    2024                 :            : 
    2025                 :       1481 : void SvxFontNameToolBoxControl::StateChanged(
    2026                 :            : 
    2027                 :            :     sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
    2028                 :            : 
    2029                 :            : {
    2030                 :       1481 :     sal_uInt16               nId    = GetId();
    2031                 :       1481 :     ToolBox&             rTbx   = GetToolBox();
    2032                 :       1481 :     SvxFontNameBox_Impl* pBox   = (SvxFontNameBox_Impl*)(rTbx.GetItemWindow( nId ));
    2033                 :            : 
    2034                 :            :     DBG_ASSERT( pBox, "Control not found!" );
    2035                 :            : 
    2036         [ -  + ]:       1481 :     if ( SFX_ITEM_DISABLED == eState )
    2037                 :            :     {
    2038                 :          0 :         pBox->Disable();
    2039                 :          0 :         pBox->Update( (const SvxFontItem*)NULL );
    2040                 :            :     }
    2041                 :            :     else
    2042                 :            :     {
    2043                 :       1481 :         pBox->Enable();
    2044                 :            : 
    2045         [ +  - ]:       1481 :         if ( SFX_ITEM_AVAILABLE == eState )
    2046                 :            :         {
    2047         [ -  + ]:       1481 :             const SvxFontItem* pFontItem = dynamic_cast< const SvxFontItem* >( pState );
    2048                 :            : 
    2049                 :            :             DBG_ASSERT( pFontItem, "svx::SvxFontNameToolBoxControl::StateChanged(), wrong item type!" );
    2050         [ +  - ]:       1481 :             if( pFontItem )
    2051                 :       1481 :                 pBox->Update( pFontItem );
    2052                 :            :         }
    2053                 :            :         else
    2054         [ #  # ]:          0 :             pBox->SetText( String() );
    2055                 :       1481 :         pBox->SaveValue();
    2056                 :            :     }
    2057                 :            : 
    2058                 :       1481 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    2059                 :       1481 : }
    2060                 :            : 
    2061                 :            : // -----------------------------------------------------------------------
    2062                 :            : 
    2063                 :        961 : Window* SvxFontNameToolBoxControl::CreateItemWindow( Window *pParent )
    2064                 :            : {
    2065                 :            :     SvxFontNameBox_Impl* pBox = new SvxFontNameBox_Impl( pParent,
    2066                 :        961 :                                                          Reference< XDispatchProvider >( m_xFrame->getController(), UNO_QUERY ),
    2067 [ +  - ][ +  - ]:        961 :                                                          m_xFrame,0);
                 [ +  - ]
    2068                 :        961 :     return pBox;
    2069                 :            : }
    2070                 :            : 
    2071                 :            : //========================================================================
    2072                 :            : // class SvxFontColorToolBoxControl --------------------------------------
    2073                 :            : //========================================================================
    2074                 :            : 
    2075                 :          0 : SvxFontColorToolBoxControl::SvxFontColorToolBoxControl(
    2076                 :            :     sal_uInt16          nSlotId,
    2077                 :            :     sal_uInt16          nId,
    2078                 :            :     ToolBox&        rTbx )
    2079                 :            : 
    2080                 :            :     :   SfxToolBoxControl( nSlotId, nId, rTbx ),
    2081                 :            :     pBtnUpdater( new ::svx::ToolboxButtonColorUpdater(
    2082         [ #  # ]:          0 :                     nSlotId, nId, &GetToolBox(), TBX_UPDATER_MODE_CHAR_COLOR_NEW )),
    2083 [ #  # ][ #  # ]:          0 :     mLastColor( COL_AUTO )
    2084                 :            : {
    2085 [ #  # ][ #  # ]:          0 :     rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
    2086                 :          0 : }
    2087                 :            : 
    2088                 :            : // -----------------------------------------------------------------------
    2089                 :            : 
    2090                 :          0 : SvxFontColorToolBoxControl::~SvxFontColorToolBoxControl()
    2091                 :            : {
    2092 [ #  # ][ #  # ]:          0 :     delete pBtnUpdater;
    2093         [ #  # ]:          0 : }
    2094                 :            : 
    2095                 :            : // -----------------------------------------------------------------------
    2096                 :            : 
    2097                 :          0 : SfxPopupWindowType SvxFontColorToolBoxControl::GetPopupWindowType() const
    2098                 :            : {
    2099                 :          0 :     return SFX_POPUPWINDOW_ONCLICK;
    2100                 :            : }
    2101                 :            : 
    2102                 :            : // -----------------------------------------------------------------------
    2103                 :            : 
    2104                 :          0 : SfxPopupWindow* SvxFontColorToolBoxControl::CreatePopupWindow()
    2105                 :            : {
    2106                 :            :     SvxColorWindow_Impl* pColorWin =
    2107                 :            :         new SvxColorWindow_Impl(
    2108                 :            :                 OUString( ".uno:Color" ),
    2109                 :            :                 SID_ATTR_CHAR_COLOR,
    2110                 :            :                 m_xFrame,
    2111         [ #  # ]:          0 :                 SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
    2112                 :          0 :                 &GetToolBox(),
    2113 [ #  # ][ #  # ]:          0 :                 mLastColor);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2114                 :            : 
    2115                 :          0 :     pColorWin->StartPopupMode( &GetToolBox(),
    2116                 :          0 :         FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
    2117                 :          0 :     pColorWin->StartSelection();
    2118                 :          0 :     SetPopupWindow( pColorWin );
    2119                 :          0 :     return pColorWin;
    2120                 :            : }
    2121                 :            : 
    2122                 :            : // -----------------------------------------------------------------------
    2123                 :            : 
    2124                 :          0 : void SvxFontColorToolBoxControl::StateChanged(
    2125                 :            : 
    2126                 :            :     sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
    2127                 :            : 
    2128                 :            : {
    2129                 :          0 :     sal_uInt16 nId = GetId();
    2130                 :          0 :     ToolBox& rTbx = GetToolBox();
    2131                 :          0 :     const SvxColorItem* pItem = 0;
    2132                 :            : 
    2133         [ #  # ]:          0 :     if ( SFX_ITEM_DONTCARE != eState )
    2134 [ #  # ][ #  # ]:          0 :        pItem = PTR_CAST( SvxColorItem, pState );
    2135                 :            : 
    2136         [ #  # ]:          0 :     if ( pItem )
    2137                 :            :     {
    2138                 :          0 :         pBtnUpdater->Update( pItem->GetValue() );
    2139                 :          0 :         mLastColor= pItem->GetValue();
    2140                 :            :     }
    2141                 :            : 
    2142                 :          0 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    2143         [ #  # ]:          0 :     rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
    2144                 :          0 : }
    2145                 :            : 
    2146                 :            : //========================================================================
    2147                 :            : // class SvxColorToolBoxControl --------------------------------
    2148                 :            : //========================================================================
    2149                 :            : 
    2150                 :          0 : SvxColorToolBoxControl::SvxColorToolBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
    2151                 :            : 
    2152                 :            :     SfxToolBoxControl( nSlotId, nId, rTbx ),
    2153                 :          0 :     mLastColor( COL_AUTO )
    2154                 :            : {
    2155         [ #  # ]:          0 :     if ( nSlotId == SID_BACKGROUND_COLOR )
    2156 [ #  # ][ #  # ]:          0 :         rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
    2157                 :            :     else
    2158 [ #  # ][ #  # ]:          0 :         rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
    2159         [ #  # ]:          0 :     rTbx.Invalidate();
    2160 [ #  # ][ #  # ]:          0 :     pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() );
                 [ #  # ]
    2161                 :          0 : }
    2162                 :            : 
    2163                 :            : // -----------------------------------------------------------------------
    2164                 :            : 
    2165                 :          0 : SvxColorToolBoxControl::~SvxColorToolBoxControl()
    2166                 :            : {
    2167 [ #  # ][ #  # ]:          0 :     delete pBtnUpdater;
    2168         [ #  # ]:          0 : }
    2169                 :            : 
    2170                 :            : // -----------------------------------------------------------------------
    2171                 :            : 
    2172                 :          0 : SfxPopupWindowType SvxColorToolBoxControl::GetPopupWindowType() const
    2173                 :            : {
    2174                 :          0 :     return SFX_POPUPWINDOW_ONCLICK;
    2175                 :            : }
    2176                 :            : 
    2177                 :            : // -----------------------------------------------------------------------
    2178                 :            : 
    2179                 :          0 : SfxPopupWindow* SvxColorToolBoxControl::CreatePopupWindow()
    2180                 :            : {
    2181                 :          0 :     sal_uInt16 nResId = GetSlotId() == SID_BACKGROUND_COLOR ?
    2182         [ #  # ]:          0 :                         RID_SVXSTR_BACKGROUND : RID_SVXSTR_COLOR;
    2183                 :            :     SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
    2184                 :            :         OUString( ".uno:BackgroundColor" ),
    2185                 :            :                                     SID_BACKGROUND_COLOR,
    2186                 :            :                                     m_xFrame,
    2187         [ #  # ]:          0 :                                     SVX_RESSTR(nResId),
    2188                 :          0 :                                     &GetToolBox(),
    2189 [ #  # ][ #  # ]:          0 :                                     mLastColor);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2190                 :            : 
    2191                 :          0 :     pColorWin->StartPopupMode( &GetToolBox(),
    2192                 :          0 :         FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
    2193                 :          0 :     pColorWin->StartSelection();
    2194                 :          0 :     SetPopupWindow( pColorWin );
    2195                 :          0 :     return pColorWin;
    2196                 :            : }
    2197                 :            : 
    2198                 :            : // -----------------------------------------------------------------------
    2199                 :            : 
    2200                 :          0 : void SvxColorToolBoxControl::StateChanged(
    2201                 :            :     sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
    2202                 :            : {
    2203                 :          0 :     const SvxColorItem* pItem = 0;
    2204         [ #  # ]:          0 :     if ( SFX_ITEM_DONTCARE != eState )
    2205 [ #  # ][ #  # ]:          0 :         pItem = PTR_CAST( SvxColorItem, pState );
    2206                 :            : 
    2207         [ #  # ]:          0 :     if ( pItem ) {
    2208                 :          0 :         pBtnUpdater->Update( pItem->GetValue() );
    2209                 :          0 :         mLastColor= pItem->GetValue();
    2210                 :            :     }
    2211                 :            : 
    2212                 :          0 :     sal_uInt16 nId = GetId();
    2213                 :          0 :     ToolBox& rTbx = GetToolBox();
    2214                 :          0 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    2215         [ #  # ]:          0 :     rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
    2216                 :          0 : }
    2217                 :            : 
    2218                 :            : //========================================================================
    2219                 :            : // class SvxColorExtToolBoxControl ----------------------------------------
    2220                 :            : //========================================================================
    2221                 :            : /* Note:
    2222                 :            :    The initial color shown on the button is set in /core/svx/source/tbxctrls/tbxcolorupdate.cxx
    2223                 :            :    (ToolboxButtonColorUpdater::ToolboxButtonColorUpdater()) .
    2224                 :            :    The initial color used by the button is set in /core/svx/source/tbxcntrls/tbcontrl.cxx
    2225                 :            :    (SvxColorExtToolBoxControl::SvxColorExtToolBoxControl())
    2226                 :            :    and in case of writer for text(background)color also in /core/sw/source/ui/docvw/edtwin.cxx
    2227                 :            :    (SwEditWin::aTextBackColor and SwEditWin::aTextBackColor)
    2228                 :            :  */
    2229                 :            : 
    2230                 :       2891 : SvxColorExtToolBoxControl::SvxColorExtToolBoxControl(
    2231                 :            :     sal_uInt16 nSlotId,
    2232                 :            :     sal_uInt16 nId,
    2233                 :            :     ToolBox& rTbx ) :
    2234                 :            : 
    2235                 :            :     SfxToolBoxControl( nSlotId, nId, rTbx ),
    2236                 :            :     pBtnUpdater(0),
    2237                 :       2891 :     mLastColor( COL_AUTO )
    2238                 :            : {
    2239                 :            :     sal_uInt16 nMode;
    2240                 :            : 
    2241 [ +  - ][ +  - ]:       2891 :     rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
    2242                 :       2891 :     bChoiceFromPalette = sal_False;
    2243                 :            : 
    2244                 :            :     // The following commands are available at the various modules
    2245   [ +  +  +  + ]:       2891 :     switch( nSlotId )
    2246                 :            :     {
    2247                 :            :         case SID_ATTR_CHAR_COLOR:
    2248         [ +  - ]:        199 :             addStatusListener( OUString( ".uno:Color" ));
    2249                 :        199 :             nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
    2250                 :        199 :             mLastColor = COL_RED;
    2251                 :        199 :             break;
    2252                 :            : 
    2253                 :            :         case SID_ATTR_CHAR_COLOR2:
    2254         [ +  - ]:        762 :             addStatusListener( OUString( ".uno:CharColorExt" ));
    2255                 :        762 :             nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
    2256                 :        762 :             mLastColor = COL_RED;
    2257                 :        762 :             break;
    2258                 :            : 
    2259                 :            :         case SID_BACKGROUND_COLOR:
    2260                 :            :         case SID_ATTR_CHAR_COLOR_BACKGROUND:
    2261                 :            :         default:
    2262         [ +  - ]:       1727 :             addStatusListener( OUString( ".uno:CharBackgroundExt" ));
    2263                 :       1727 :             nMode = TBX_UPDATER_MODE_CHAR_COLOR_NEW;
    2264                 :       1727 :             mLastColor = COL_YELLOW;
    2265                 :       1727 :             break;
    2266                 :            : 
    2267                 :            :         case SID_FRAME_LINECOLOR:
    2268         [ +  - ]:        203 :             addStatusListener( OUString( ".uno:FrameLineColor" ));
    2269                 :        203 :             nMode = 0;
    2270                 :        203 :             mLastColor = COL_BLUE;
    2271                 :        203 :             break;
    2272                 :            :     }
    2273                 :            : 
    2274 [ +  - ][ +  - ]:       2891 :     pBtnUpdater = new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox(), nMode );
                 [ +  - ]
    2275                 :       2891 : }
    2276                 :            : 
    2277                 :            : // -----------------------------------------------------------------------
    2278                 :            : 
    2279                 :       2891 : SvxColorExtToolBoxControl::~SvxColorExtToolBoxControl()
    2280                 :            : {
    2281 [ +  - ][ +  - ]:       2891 :     delete pBtnUpdater;
    2282         [ -  + ]:       5782 : }
    2283                 :            : 
    2284                 :            : // -----------------------------------------------------------------------
    2285                 :            : 
    2286                 :          0 : SfxPopupWindowType SvxColorExtToolBoxControl::GetPopupWindowType() const
    2287                 :            : {
    2288                 :          0 :     return SFX_POPUPWINDOW_ONTIMEOUT;
    2289                 :            : }
    2290                 :            : 
    2291                 :            : // -----------------------------------------------------------------------
    2292                 :            : 
    2293                 :          0 : SfxPopupWindow* SvxColorExtToolBoxControl::CreatePopupWindow()
    2294                 :            : {
    2295                 :            :     SvxColorWindow_Impl* pColorWin =
    2296                 :            :         new SvxColorWindow_Impl(
    2297                 :            :                             m_aCommandURL,
    2298                 :          0 :                             GetSlotId(),
    2299                 :            :                             m_xFrame,
    2300                 :          0 :                             SVX_RESSTR( RID_SVXITEMS_EXTRAS_CHARCOLOR ),
    2301                 :          0 :                             &GetToolBox(),
    2302 [ #  # ][ #  # ]:          0 :                             mLastColor );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2303                 :            : 
    2304   [ #  #  #  # ]:          0 :     switch( GetSlotId() )
    2305                 :            :     {
    2306                 :            :         case SID_ATTR_CHAR_COLOR_BACKGROUND :
    2307 [ #  # ][ #  # ]:          0 :             pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_EXTRAS_CHARBACKGROUND ) );
         [ #  # ][ #  # ]
    2308                 :          0 :             break;
    2309                 :            : 
    2310                 :            :         case SID_BACKGROUND_COLOR :
    2311 [ #  # ][ #  # ]:          0 :             pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_BACKGROUND ) );
         [ #  # ][ #  # ]
    2312                 :          0 :             break;
    2313                 :            : 
    2314                 :            :         case SID_FRAME_LINECOLOR:
    2315 [ #  # ][ #  # ]:          0 :             pColorWin->SetText( SVX_RESSTR( RID_SVXSTR_FRAME_COLOR ) );
         [ #  # ][ #  # ]
    2316                 :          0 :             break;
    2317                 :            :     }
    2318                 :            : 
    2319                 :          0 :     pColorWin->StartPopupMode( &GetToolBox(),
    2320                 :          0 :         FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
    2321                 :          0 :     pColorWin->StartSelection();
    2322                 :          0 :     SetPopupWindow( pColorWin );
    2323                 :          0 :     bChoiceFromPalette = sal_True;
    2324                 :          0 :     return pColorWin;
    2325                 :            : }
    2326                 :            : 
    2327                 :            : // -----------------------------------------------------------------------
    2328                 :            : 
    2329                 :       8073 : void SvxColorExtToolBoxControl::StateChanged(
    2330                 :            : 
    2331                 :            :     sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState )
    2332                 :            : 
    2333                 :            : {
    2334                 :       8073 :     const SvxColorItem* pItem = 0;
    2335         [ -  + ]:       8073 :     if ( bChoiceFromPalette )
    2336                 :            :     {
    2337                 :          0 :         bChoiceFromPalette = sal_False;
    2338      [ #  #  # ]:          0 :         switch( nSID )
    2339                 :            :         {
    2340                 :            :             case SID_ATTR_CHAR_COLOR :
    2341                 :            :             case SID_ATTR_CHAR_COLOR2 :
    2342                 :            :             case SID_ATTR_CHAR_COLOR_BACKGROUND :
    2343                 :            :             case SID_BACKGROUND_COLOR :
    2344         [ #  # ]:          0 :                 if ( SFX_ITEM_DONTCARE != eState )
    2345 [ #  # ][ #  # ]:          0 :                     pItem = PTR_CAST( SvxColorItem, pState );
    2346                 :            : 
    2347         [ #  # ]:          0 :                 if ( pItem )
    2348                 :            :                 {
    2349                 :          0 :                     pBtnUpdater->Update( pItem->GetValue() );
    2350                 :          0 :                     mLastColor = pItem->GetValue();
    2351                 :            :                 }
    2352                 :          0 :                 break;
    2353                 :            : 
    2354                 :            :             case SID_FRAME_LINECOLOR :
    2355                 :          0 :                 ToolBox& rTbx = GetToolBox();
    2356                 :          0 :                 rTbx.EnableItem( nSID, SFX_ITEM_DISABLED != eState );
    2357         [ #  # ]:          0 :                 rTbx.SetItemState( nSID, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
    2358                 :            : 
    2359         [ #  # ]:          0 :                 if ( SFX_ITEM_DONTCARE != eState )
    2360                 :            :                 {
    2361 [ #  # ][ #  # ]:          0 :                     pItem = PTR_CAST( SvxColorItem, pState );
    2362         [ #  # ]:          0 :                     if ( pItem )
    2363                 :            :                     {
    2364                 :          0 :                         pBtnUpdater->Update( pItem->GetValue());
    2365                 :          0 :                         mLastColor = pItem->GetValue();
    2366                 :            :                     }
    2367                 :            :                 }
    2368                 :          0 :                 break;
    2369                 :            :         }
    2370                 :            :     }
    2371                 :       8073 : }
    2372                 :            : 
    2373                 :            : // -----------------------------------------------------------------------
    2374                 :            : 
    2375                 :          0 : void SvxColorExtToolBoxControl::Select( sal_Bool )
    2376                 :            : {
    2377                 :          0 :     OUString aCommand;
    2378                 :          0 :     OUString aParamName;
    2379                 :          0 :     sal_Bool bNoArgs = sal_False;
    2380                 :            : 
    2381   [ #  #  #  #  :          0 :     switch( GetSlotId() )
           #  # ][ #  # ]
    2382                 :            :     {
    2383                 :            :         case SID_ATTR_CHAR_COLOR2 :
    2384                 :          0 :             bNoArgs     = sal_True;
    2385                 :          0 :             aCommand    = OUString( ".uno:CharColorExt" );
    2386                 :          0 :             aParamName  = OUString( "CharColorExt" );
    2387                 :          0 :             break;
    2388                 :            : 
    2389                 :            :         case SID_ATTR_CHAR_COLOR  :
    2390                 :          0 :             aCommand    = OUString( ".uno:Color" );
    2391                 :          0 :             aParamName  = OUString( "Color" );
    2392                 :          0 :             break;
    2393                 :            : 
    2394                 :            :         case SID_BACKGROUND_COLOR :
    2395                 :          0 :             aCommand    = OUString( ".uno:BackgroundColor" );
    2396                 :          0 :             aParamName  = OUString( "BackgroundColor" );
    2397                 :          0 :             break;
    2398                 :            : 
    2399                 :            :         case SID_ATTR_CHAR_COLOR_BACKGROUND :
    2400                 :          0 :             bNoArgs     = sal_True;
    2401                 :          0 :             aCommand    = OUString( ".uno:CharBackgroundExt" );
    2402                 :          0 :             aParamName  = OUString( "CharBackgroundExt" );
    2403                 :          0 :             break;
    2404                 :            : 
    2405                 :            :         case SID_FRAME_LINECOLOR  :
    2406                 :          0 :             aCommand    = OUString( ".uno:FrameLineColor" );
    2407                 :          0 :             aParamName  = OUString( "FrameLineColor" );
    2408                 :          0 :             break;
    2409                 :            :     }
    2410                 :            : 
    2411         [ #  # ]:          0 :     Sequence< PropertyValue > aArgs( 1 );
    2412         [ #  # ]:          0 :     aArgs[0].Name  = aParamName;
    2413         [ #  # ]:          0 :     if ( bNoArgs )
    2414 [ #  # ][ #  # ]:          0 :         aArgs[0].Value = makeAny( GetToolBox().IsItemChecked( GetId() ));
         [ #  # ][ #  # ]
                 [ #  # ]
    2415                 :            :     else
    2416 [ #  # ][ #  # ]:          0 :         aArgs[0].Value = makeAny( (sal_uInt32)( mLastColor.GetColor() ));
    2417 [ #  # ][ #  # ]:          0 :     Dispatch( aCommand, aArgs );
    2418                 :          0 : }
    2419                 :            : 
    2420                 :            : //========================================================================
    2421                 :            : // class SvxFrameToolBoxControl ------------------------------------------
    2422                 :            : //========================================================================
    2423                 :            : 
    2424                 :        203 : SvxFrameToolBoxControl::SvxFrameToolBoxControl(
    2425                 :            :     sal_uInt16      nSlotId,
    2426                 :            :     sal_uInt16      nId,
    2427                 :            :     ToolBox&    rTbx )
    2428                 :            : 
    2429                 :        203 :     :   SfxToolBoxControl( nSlotId, nId, rTbx )
    2430                 :            : {
    2431 [ +  - ][ +  - ]:        203 :     rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
    2432                 :        203 : }
    2433                 :            : 
    2434                 :            : // -----------------------------------------------------------------------
    2435                 :            : 
    2436                 :          0 : SfxPopupWindowType SvxFrameToolBoxControl::GetPopupWindowType() const
    2437                 :            : {
    2438                 :          0 :     return SFX_POPUPWINDOW_ONCLICK;
    2439                 :            : }
    2440                 :            : 
    2441                 :            : // -----------------------------------------------------------------------
    2442                 :            : 
    2443                 :          0 : SfxPopupWindow* SvxFrameToolBoxControl::CreatePopupWindow()
    2444                 :            : {
    2445                 :            :     SvxFrameWindow_Impl* pFrameWin = new SvxFrameWindow_Impl(
    2446         [ #  # ]:          0 :                                         GetSlotId(), m_xFrame, &GetToolBox() );
    2447                 :            : 
    2448                 :          0 :     pFrameWin->StartPopupMode( &GetToolBox(),
    2449                 :            :                                FLOATWIN_POPUPMODE_GRABFOCUS |
    2450                 :            :                                FLOATWIN_POPUPMODE_ALLOWTEAROFF |
    2451                 :          0 :                                FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
    2452                 :          0 :     pFrameWin->StartSelection();
    2453                 :          0 :     SetPopupWindow( pFrameWin );
    2454                 :            : 
    2455                 :          0 :     return pFrameWin;
    2456                 :            : }
    2457                 :            : 
    2458                 :            : // -----------------------------------------------------------------------
    2459                 :            : 
    2460                 :        266 : void SvxFrameToolBoxControl::StateChanged(
    2461                 :            : 
    2462                 :            :     sal_uInt16, SfxItemState eState, const SfxPoolItem*  )
    2463                 :            : 
    2464                 :            : {
    2465                 :        266 :     sal_uInt16                  nId     = GetId();
    2466                 :        266 :     ToolBox&                rTbx    = GetToolBox();
    2467                 :            : 
    2468                 :        266 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    2469                 :            :     rTbx.SetItemState( nId, (SFX_ITEM_DONTCARE == eState)
    2470                 :            :                             ? STATE_DONTKNOW
    2471         [ -  + ]:        266 :                             : STATE_NOCHECK );
    2472                 :        266 : }
    2473                 :            : 
    2474                 :            : //========================================================================
    2475                 :            : // class SvxFrameLineStyleToolBoxControl ---------------------------------
    2476                 :            : //========================================================================
    2477                 :            : 
    2478                 :        203 : SvxFrameLineStyleToolBoxControl::SvxFrameLineStyleToolBoxControl(
    2479                 :            :     sal_uInt16          nSlotId,
    2480                 :            :     sal_uInt16          nId,
    2481                 :            :     ToolBox&        rTbx )
    2482                 :            : 
    2483                 :        203 :     :    SfxToolBoxControl( nSlotId, nId, rTbx )
    2484                 :            : {
    2485 [ +  - ][ +  - ]:        203 :     rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
    2486                 :        203 : }
    2487                 :            : 
    2488                 :            : // -----------------------------------------------------------------------
    2489                 :            : 
    2490                 :          0 : SfxPopupWindowType SvxFrameLineStyleToolBoxControl::GetPopupWindowType() const
    2491                 :            : {
    2492                 :          0 :     return SFX_POPUPWINDOW_ONCLICK;
    2493                 :            : }
    2494                 :            : 
    2495                 :            : // -----------------------------------------------------------------------
    2496                 :            : 
    2497                 :          0 : SfxPopupWindow* SvxFrameLineStyleToolBoxControl::CreatePopupWindow()
    2498                 :            : {
    2499         [ #  # ]:          0 :     SvxLineWindow_Impl* pLineWin = new SvxLineWindow_Impl( GetSlotId(), m_xFrame, &GetToolBox() );
    2500                 :          0 :     pLineWin->StartPopupMode( &GetToolBox(),
    2501                 :            :                               FLOATWIN_POPUPMODE_GRABFOCUS |
    2502                 :            :                               FLOATWIN_POPUPMODE_ALLOWTEAROFF |
    2503                 :          0 :                               FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
    2504                 :          0 :     SetPopupWindow( pLineWin );
    2505                 :            : 
    2506                 :          0 :     return pLineWin;
    2507                 :            : }
    2508                 :            : 
    2509                 :            : // -----------------------------------------------------------------------
    2510                 :            : 
    2511                 :        266 : void SvxFrameLineStyleToolBoxControl::StateChanged(
    2512                 :            : 
    2513                 :            :     sal_uInt16 , SfxItemState eState, const SfxPoolItem*  )
    2514                 :            : {
    2515                 :        266 :     sal_uInt16       nId    = GetId();
    2516                 :        266 :     ToolBox&     rTbx   = GetToolBox();
    2517                 :            : 
    2518                 :        266 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    2519                 :            :     rTbx.SetItemState( nId, (SFX_ITEM_DONTCARE == eState)
    2520                 :            :                                 ? STATE_DONTKNOW
    2521         [ -  + ]:        266 :                                 : STATE_NOCHECK );
    2522                 :        266 : }
    2523                 :            : 
    2524                 :            : //========================================================================
    2525                 :            : // class SvxFrameLineColorToolBoxControl ---------------------------------
    2526                 :            : //========================================================================
    2527                 :            : 
    2528                 :          0 : SvxFrameLineColorToolBoxControl::SvxFrameLineColorToolBoxControl(
    2529                 :            :     sal_uInt16      nSlotId,
    2530                 :            :     sal_uInt16      nId,
    2531                 :            :     ToolBox&    rTbx ) :
    2532                 :            : 
    2533                 :            :     SfxToolBoxControl( nSlotId, nId, rTbx ),
    2534         [ #  # ]:          0 :     pBtnUpdater(new ::svx::ToolboxButtonColorUpdater( nSlotId, nId, &GetToolBox() )),
    2535 [ #  # ][ #  # ]:          0 :     mLastColor( COL_AUTO )
    2536                 :            : {
    2537 [ #  # ][ #  # ]:          0 :     rTbx.SetItemBits( nId, TIB_DROPDOWNONLY | rTbx.GetItemBits( nId ) );
    2538                 :          0 : }
    2539                 :            : 
    2540                 :            : // -----------------------------------------------------------------------
    2541                 :            : 
    2542                 :          0 : SvxFrameLineColorToolBoxControl::~SvxFrameLineColorToolBoxControl()
    2543                 :            : {
    2544                 :            : 
    2545 [ #  # ][ #  # ]:          0 :     delete pBtnUpdater;
    2546         [ #  # ]:          0 : }
    2547                 :            : 
    2548                 :            : // -----------------------------------------------------------------------
    2549                 :            : 
    2550                 :          0 : SfxPopupWindowType SvxFrameLineColorToolBoxControl::GetPopupWindowType() const
    2551                 :            : {
    2552                 :          0 :     return SFX_POPUPWINDOW_ONCLICK;
    2553                 :            : }
    2554                 :            : 
    2555                 :            : // -----------------------------------------------------------------------
    2556                 :            : 
    2557                 :          0 : SfxPopupWindow* SvxFrameLineColorToolBoxControl::CreatePopupWindow()
    2558                 :            : {
    2559                 :            :     SvxColorWindow_Impl* pColorWin = new SvxColorWindow_Impl(
    2560                 :            :                                         OUString( ".uno:FrameLineColor" ),
    2561                 :            :                                         SID_FRAME_LINECOLOR,
    2562                 :            :                                         m_xFrame,
    2563         [ #  # ]:          0 :                                         SVX_RESSTR(RID_SVXSTR_FRAME_COLOR),
    2564                 :          0 :                                         &GetToolBox(),
    2565 [ #  # ][ #  # ]:          0 :                                         mLastColor);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
    2566                 :            : 
    2567                 :          0 :     pColorWin->StartPopupMode( &GetToolBox(),
    2568                 :          0 :         FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_ALLOWTEAROFF|FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
    2569                 :          0 :     pColorWin->StartSelection();
    2570                 :          0 :     SetPopupWindow( pColorWin );
    2571                 :          0 :     return pColorWin;
    2572                 :            : }
    2573                 :            : 
    2574                 :            : // -----------------------------------------------------------------------
    2575                 :            : 
    2576                 :          0 : void SvxFrameLineColorToolBoxControl::StateChanged(
    2577                 :            :     sal_uInt16 , SfxItemState eState, const SfxPoolItem* pState )
    2578                 :            : {
    2579                 :          0 :     sal_uInt16 nId = GetId();
    2580                 :          0 :     ToolBox& rTbx = GetToolBox();
    2581                 :          0 :     rTbx.EnableItem( nId, SFX_ITEM_DISABLED != eState );
    2582         [ #  # ]:          0 :     rTbx.SetItemState( nId, ( SFX_ITEM_DONTCARE == eState ) ? STATE_DONTKNOW : STATE_NOCHECK );
    2583                 :            : 
    2584                 :          0 :     const SvxColorItem* pItem = 0;
    2585         [ #  # ]:          0 :     if ( SFX_ITEM_DONTCARE != eState )
    2586                 :            :     {
    2587 [ #  # ][ #  # ]:          0 :         pItem = PTR_CAST( SvxColorItem, pState );
    2588         [ #  # ]:          0 :         if ( pItem )
    2589                 :            :         {
    2590                 :          0 :             pBtnUpdater->Update( pItem->GetValue());
    2591                 :          0 :             mLastColor = pItem->GetValue();
    2592                 :            :         }
    2593                 :            :     }
    2594                 :          0 : }
    2595                 :            : 
    2596                 :            : //========================================================================
    2597                 :            : // class SvxSimpleUndoRedoController -------------------------------------
    2598                 :            : //========================================================================
    2599                 :            : 
    2600                 :          0 : SvxSimpleUndoRedoController::SvxSimpleUndoRedoController( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx  )
    2601                 :          0 :     :SfxToolBoxControl( nSlotId, nId, rTbx )
    2602                 :            : {
    2603 [ #  # ][ #  # ]:          0 :     aDefaultText = rTbx.GetItemText( nId );
    2604                 :          0 : }
    2605                 :            : 
    2606                 :            : // -----------------------------------------------------------------------
    2607                 :            : 
    2608                 :          0 : SvxSimpleUndoRedoController::~SvxSimpleUndoRedoController()
    2609                 :            : {
    2610         [ #  # ]:          0 : }
    2611                 :            : 
    2612                 :            : // -----------------------------------------------------------------------
    2613                 :            : 
    2614                 :          0 : void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
    2615                 :            : {
    2616 [ #  # ][ #  # ]:          0 :     SfxStringItem* pItem = PTR_CAST( SfxStringItem, pState );
    2617                 :          0 :     ToolBox& rBox = GetToolBox();
    2618 [ #  # ][ #  # ]:          0 :     if ( pItem && eState != SFX_ITEM_DISABLED )
    2619                 :            :     {
    2620 [ #  # ][ #  # ]:          0 :         ::rtl::OUString aNewText( MnemonicGenerator::EraseAllMnemonicChars( pItem->GetValue() ) );
                 [ #  # ]
    2621 [ #  # ][ #  # ]:          0 :         rBox.SetQuickHelpText( GetId(), aNewText );
         [ #  # ][ #  # ]
    2622                 :            :     }
    2623         [ #  # ]:          0 :     if ( eState == SFX_ITEM_DISABLED )
    2624 [ #  # ][ #  # ]:          0 :         rBox.SetQuickHelpText( GetId(), aDefaultText );
    2625                 :          0 :     rBox.EnableItem( GetId(), eState != SFX_ITEM_DISABLED );
    2626                 :          0 : }
    2627                 :            : 
    2628                 :            : //========================================================================
    2629                 :            : 
    2630                 :          0 : void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet )
    2631                 :            : {
    2632                 :          0 :     Size aSize = rWin.GetOutputSizePixel();
    2633                 :          0 :     aSize.Width()  -= 4;
    2634                 :          0 :     aSize.Height() -= 4;
    2635         [ #  # ]:          0 :     rValueSet.SetPosSizePixel( Point(2,2), aSize );
    2636                 :          0 : }
    2637                 :            : 
    2638                 :            : // -----------------------------------------------------------------------
    2639                 :            : 
    2640                 :          0 : void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize )
    2641                 :            : {
    2642         [ #  # ]:          0 :     Size aSize = rValueSet.CalcWindowSizePixel( aItemSize );
    2643                 :          0 :     aSize.Width()  += 4;
    2644                 :          0 :     aSize.Height() += 4;
    2645         [ #  # ]:          0 :     rWin.SetOutputSizePixel( aSize );
    2646                 :          0 : }
    2647                 :            : 
    2648                 :            : // -----------------------------------------------------------------------------
    2649                 :          2 : Reference< ::com::sun::star::accessibility::XAccessible > SvxFontNameBox_Impl::CreateAccessible()
    2650                 :            : {
    2651                 :          2 :     FillList();
    2652                 :          2 :     return FontNameBox::CreateAccessible();
    2653                 :            : }
    2654                 :            : 
    2655                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10