1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: layctrl.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 // include ---------------------------------------------------------------
36 #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
37 #include <vcl/toolbox.hxx>
38 #ifndef _SV_BUTTON_HXX //autogen
39 #include <vcl/button.hxx>
41 #include <svtools/intitem.hxx>
42 #include <sfx2/dispatch.hxx>
43 #include <sfx2/app.hxx>
45 #include <svx/dialogs.hrc>
46 #include "layctrl.hxx"
47 #include <svx/dialmgr.hxx>
48 #include <comphelper/processfactory.hxx>
49 #include <svtools/colorcfg.hxx>
52 using namespace ::com::sun::star::uno
;
53 using namespace ::com::sun::star::beans
;
54 using namespace ::com::sun::star::util
;
55 using namespace ::com::sun::star::frame
;
57 SFX_IMPL_TOOLBOX_CONTROL(SvxTableToolBoxControl
,SfxUInt16Item
);
58 SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl
,SfxUInt16Item
);
60 // class TableWindow -----------------------------------------------------
62 class TableWindow
: public SfxPopupWindow
66 ::Color aHighlightLineColor
;
68 ::Color aHighlightFillColor
;
76 BOOL bInitialKeyInput
;
79 Reference
< XFrame
> mxFrame
;
80 rtl::OUString maCommand
;
82 void UpdateSize_Impl( long nNewCol
, long nNewLine
);
85 TableWindow( USHORT nSlotId
,
86 const rtl::OUString
& rCmd
,
88 const Reference
< XFrame
>& rFrame
);
91 void KeyInput( const KeyEvent
& rKEvt
);
92 virtual void MouseMove( const MouseEvent
& rMEvt
);
93 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
94 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
95 virtual void Paint( const Rectangle
& );
96 virtual void PopupModeEnd();
97 virtual SfxPopupWindow
* Clone() const;
99 USHORT
GetColCount() const { return (USHORT
)nCol
; }
100 USHORT
GetLineCount() const { return (USHORT
)nLine
; }
103 // -----------------------------------------------------------------------
105 TableWindow::TableWindow( USHORT nSlotId
, const rtl::OUString
& rCmd
, ToolBox
& rParentTbx
, const Reference
< XFrame
>& rFrame
) :
106 SfxPopupWindow( nSlotId
, rFrame
, WB_SYSTEMWINDOW
),
107 bInitialKeyInput(TRUE
),
113 const StyleSettings
& rStyles
= Application::GetSettings().GetStyleSettings();
114 svtools::ColorConfig aColorConfig
;
115 aLineColor
= ::Color( aColorConfig
.GetColorValue( svtools::FONTCOLOR
).nColor
);
116 aHighlightLineColor
= rStyles
.GetHighlightTextColor();
117 aFillColor
= rStyles
.GetWindowColor();
118 aHighlightFillColor
= rStyles
.GetHighlightColor();
120 nTextHeight
= GetTextHeight()+1;
122 Font aFont
= GetFont();
123 aFont
.SetColor( aLineColor
);
124 aFont
.SetFillColor( aFillColor
);
125 aFont
.SetTransparent( FALSE
);
133 Size aLogicSize
= LogicToPixel( Size( 55, 35 ), MapMode( MAP_10TH_MM
) );
134 nMX
= aLogicSize
.Width();
135 nMY
= aLogicSize
.Height();
136 SetOutputSizePixel( Size( nMX
*nWidth
-1, nMY
*nHeight
-1+nTextHeight
) );
138 // -----------------------------------------------------------------------
139 TableWindow::~TableWindow()
142 // -----------------------------------------------------------------------
144 SfxPopupWindow
* TableWindow::Clone() const
146 return new TableWindow( GetId(), maCommand
, rTbx
, mxFrame
);
149 // -----------------------------------------------------------------------
151 void TableWindow::MouseMove( const MouseEvent
& rMEvt
)
153 SfxPopupWindow::MouseMove( rMEvt
);
154 Point aPos
= rMEvt
.GetPosPixel();
155 Point
aMousePos( aPos
);
157 if ( rMEvt
.IsEnterWindow() )
159 else if ( aMousePos
.X() < 0 || aMousePos
.Y() < 0 )
172 nNewCol
= aPos
.X() / nMX
+ 1;
174 nNewLine
= aPos
.Y() / nMY
+ 1;
178 if ( nNewLine
> 1000 )
181 UpdateSize_Impl( nNewCol
, nNewLine
);
184 /* -----------------------------15.05.2002 17:14------------------------------
186 ---------------------------------------------------------------------------*/
187 void TableWindow::UpdateSize_Impl( long nNewCol
, long nNewLine
)
189 Size aWinSize
= GetOutputSizePixel();
190 Point aWinPos
= GetPosPixel();
191 Point aMaxPos
= OutputToScreenPixel( GetDesktopRectPixel().BottomRight() );
192 if ( (nWidth
<= nNewCol
) || (nHeight
< nNewLine
) )
196 if ( nWidth
<= nNewCol
)
201 if ( nHeight
<= nNewLine
)
206 while ( nWidth
> 0 &&
207 (short)(aWinPos
.X()+(nMX
*nWidth
-1)) >= aMaxPos
.X()-3 )
210 while ( nHeight
> 0 &&
211 (short)(aWinPos
.Y()+(nMY
*nHeight
-1+nTextHeight
)) >=
215 if ( nNewCol
> nWidth
)
218 if ( nNewLine
> nHeight
)
221 Size _aWinSize
= GetOutputSizePixel();
222 Invalidate( Rectangle( 0, _aWinSize
.Height()-nTextHeight
+2-nOff
,
223 _aWinSize
.Width(), _aWinSize
.Height() ) );
224 SetOutputSizePixel( Size( nMX
*nWidth
-1, nMY
*nHeight
-1+nTextHeight
) );
230 if ( nNewCol
< nCol
)
240 if ( nNewLine
< nLine
)
251 if ( (nNewCol
!= nCol
) || (nNewLine
!= nLine
) )
253 Invalidate( Rectangle( 0, aWinSize
.Height()-nTextHeight
+2,
254 aWinSize
.Width(), aWinSize
.Height() ) );
256 if ( nNewCol
!= nCol
)
258 Invalidate( Rectangle( nMinCol
*nMX
-1, 0, nMaxCol
*nMX
+1, nMaxLine
*nMY
) );
261 if ( nNewLine
!= nLine
)
263 Invalidate( Rectangle( 0, nMinLine
*nMY
-2, nMaxCol
*nMX
, nMaxLine
*nMY
+1 ) );
269 /* -----------------------------15.05.2002 14:22------------------------------
271 ---------------------------------------------------------------------------*/
272 void TableWindow::KeyInput( const KeyEvent
& rKEvt
)
274 BOOL bHandled
= FALSE
;
275 USHORT nModifier
= rKEvt
.GetKeyCode().GetModifier();
276 USHORT nKey
= rKEvt
.GetKeyCode().GetCode();
279 if( KEY_UP
== nKey
|| KEY_DOWN
== nKey
||
280 KEY_LEFT
== nKey
|| KEY_RIGHT
== nKey
||
281 KEY_ESCAPE
== nKey
||KEY_RETURN
== nKey
)
285 long nNewLine
= nLine
;
296 EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL
);
310 if(IsMouseCaptured())
312 EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL
);
315 //make sure that a table can initially be created
318 bInitialKeyInput
= FALSE
;
324 UpdateSize_Impl( nNewCol
, nNewLine
);
327 else if(KEY_MOD1
== nModifier
&& KEY_RETURN
== nKey
)
330 if(IsMouseCaptured())
332 EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL
);
336 SfxPopupWindow::KeyInput(rKEvt
);
339 // -----------------------------------------------------------------------
341 void TableWindow::MouseButtonDown( const MouseEvent
& rMEvt
)
343 SfxPopupWindow::MouseButtonDown( rMEvt
);
347 // -----------------------------------------------------------------------
349 void TableWindow::MouseButtonUp( const MouseEvent
& rMEvt
)
351 SfxPopupWindow::MouseButtonUp( rMEvt
);
354 if ( IsInPopupMode() )
355 EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL
);
358 // -----------------------------------------------------------------------
360 void TableWindow::Paint( const Rectangle
& )
364 Size aSize
= GetOutputSizePixel();
367 SetFillColor( aHighlightFillColor
);
368 DrawRect( Rectangle( 0, 0, nCol
*nMX
-1, nLine
*nMY
-1 ) );
369 SetFillColor( aFillColor
);
370 DrawRect( Rectangle( nCol
*nMX
-1, 0,
371 aSize
.Width(), aSize
.Height()-nTextHeight
+1 ) );
372 DrawRect( Rectangle( 0, nLine
*nMY
-1,
373 aSize
.Width(), aSize
.Height()-nTextHeight
+1 ) );
375 SetLineColor( aHighlightLineColor
);
376 for ( i
= 1; i
< nCol
; i
++ )
377 DrawLine( Point( i
*nMX
-1, 0 ), Point( i
*nMX
-1, nLine
*nMY
-1 ) );
378 for ( i
= 1; i
< nLine
; i
++ )
379 DrawLine( Point( 0, i
*nMY
-1 ), Point( nCol
*nMX
-1, i
*nMY
-1 ) );
380 SetLineColor( aLineColor
);
381 for ( i
= 1; i
<= nWidth
; i
++ )
384 nStart
= nLine
*nMY
-1;
387 DrawLine( Point( i
*nMX
-1, nStart
), Point( i
*nMX
-1, nHeight
*nMY
-1 ) );
389 for ( i
= 1; i
<= nHeight
; i
++ )
395 DrawLine( Point( nStart
, i
*nMY
-1 ), Point( nWidth
*nMX
-1, i
*nMY
-1 ) );
402 aText
+= String::CreateFromInt32( nCol
);
403 aText
.AppendAscii( " x " );
404 aText
+= String::CreateFromInt32( nLine
);
405 if(GetId() == FN_SHOW_MULTIPLE_PAGES
)
408 aText
+= String(SVX_RESSTR(RID_SVXSTR_PAGES
));
413 aText
= Button::GetStandardText( BUTTON_CANCEL
);
414 Size
aTextSize( GetTextWidth( aText
), GetTextHeight() );
416 Rectangle
aClearRect( 0, aSize
.Height()-nTextHeight
+2, (aSize
.Width()), aSize
.Height() );
417 DrawRect( aClearRect
);
419 // #i95350# force RTL output
420 if( IsRTLEnabled() && nCol
&& nLine
)
421 aText
.Insert(0x202D, 0);
422 DrawText( Point( (aSize
.Width() - aTextSize
.Width()) / 2, aSize
.Height() - nTextHeight
+ 2 ), aText
);
424 SetLineColor( aLineColor
);
426 DrawRect( Rectangle( Point(0,0), aSize
) );
429 // -----------------------------------------------------------------------
431 void TableWindow::PopupModeEnd()
433 if ( !IsPopupModeCanceled() && nCol
&& nLine
)
435 Window
* pParent
= rTbx
.GetParent();
436 USHORT nId
= GetId();
437 pParent
->UserEvent(SVX_EVENT_COLUM_WINDOW_EXECUTE
, reinterpret_cast<void*>(nId
));
439 Reference
< XDispatchProvider
> xDispatchProvider( mxFrame
, UNO_QUERY
);
440 if ( xDispatchProvider
.is() )
442 com::sun::star::util::URL aTargetURL
;
443 Reference
< XURLTransformer
> xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
444 rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )),
446 aTargetURL
.Complete
= maCommand
;
447 xTrans
->parseStrict( aTargetURL
);
448 Reference
< XDispatch
> xDispatch
= xDispatchProvider
->queryDispatch( aTargetURL
, rtl::OUString(), 0 );
449 if ( xDispatch
.is() )
451 Sequence
< PropertyValue
> aArgs( 2 );
452 aArgs
[0].Name
= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ));
453 aArgs
[0].Value
= makeAny( sal_Int16( nCol
));
454 aArgs
[1].Name
= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Rows" ));
455 aArgs
[1].Value
= makeAny( sal_Int16( nLine
));
457 xDispatch
->dispatch( aTargetURL
, aArgs
);
461 else if ( IsPopupModeCanceled() )
463 SfxPopupWindow::PopupModeEnd();
466 // class ColumnsWindow ---------------------------------------------------
468 class ColumnsWindow
: public SfxPopupWindow
472 ::Color aHighlightLineColor
;
474 ::Color aHighlightFillColor
;
479 BOOL bInitialKeyInput
;
482 Reference
< XFrame
> mxFrame
;
483 ::rtl::OUString maCommand
;
485 void UpdateSize_Impl( long nNewCol
);
487 ColumnsWindow( USHORT nId
, const ::rtl::OUString
& rCmd
, ToolBox
& rParentTbx
, const Reference
< XFrame
>& rFrame
);
489 void KeyInput( const KeyEvent
& rKEvt
);
490 virtual void MouseMove( const MouseEvent
& rMEvt
);
491 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
492 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
493 virtual void Paint( const Rectangle
& );
494 virtual void PopupModeEnd();
495 virtual SfxPopupWindow
* Clone() const;
497 USHORT
GetColCount() const { return (USHORT
)nCol
; }
500 // -----------------------------------------------------------------------
502 ColumnsWindow::ColumnsWindow( USHORT nId
, const ::rtl::OUString
& rCmd
, ToolBox
& rParentTbx
, const Reference
< XFrame
>& rFrame
) :
503 SfxPopupWindow( nId
, rFrame
, WB_SYSTEMWINDOW
),
504 bInitialKeyInput(TRUE
),
510 const StyleSettings
& rStyles
= Application::GetSettings().GetStyleSettings();
511 svtools::ColorConfig aColorConfig
;
512 aLineColor
= ::Color( aColorConfig
.GetColorValue( svtools::FONTCOLOR
).nColor
);
513 aHighlightLineColor
= rStyles
.GetHighlightTextColor();
514 aFillColor
= rStyles
.GetWindowColor();
515 aHighlightFillColor
= rStyles
.GetHighlightColor();
517 nTextHeight
= GetTextHeight()+1;
519 Font
aFont( GetFont() );
520 aFont
.SetColor( aLineColor
);
521 aFont
.SetFillColor( aFillColor
);
522 aFont
.SetTransparent( FALSE
);
528 Size aLogicSize
= LogicToPixel( Size( 95, 155 ), MapMode( MAP_10TH_MM
) );
529 nMX
= aLogicSize
.Width();
530 SetOutputSizePixel( Size( nMX
*nWidth
-1, aLogicSize
.Height()+nTextHeight
) );
534 // -----------------------------------------------------------------------
536 SfxPopupWindow
* ColumnsWindow::Clone() const
538 return new ColumnsWindow( GetId(), maCommand
, rTbx
, mxFrame
);
541 // -----------------------------------------------------------------------
543 void ColumnsWindow::MouseMove( const MouseEvent
& rMEvt
)
545 SfxPopupWindow::MouseMove( rMEvt
);
546 Point aPos
= rMEvt
.GetPosPixel();
547 Point aMousePos
= aPos
;
548 Point aWinPos
= GetPosPixel();
550 if ( rMEvt
.IsEnterWindow() )
552 else if ( aMousePos
.X() < 0 || aMousePos
.Y() < 0 )
562 nNewCol
= aPos
.X() / nMX
+ 1;
567 UpdateSize_Impl( nNewCol
);
569 /* -----------------------------21.05.2002 16:16------------------------------
571 ---------------------------------------------------------------------------*/
572 void ColumnsWindow::UpdateSize_Impl( long nNewCol
)
574 Size aWinSize
= GetOutputSizePixel();
577 Point aWinPos
;// = GetPosPixel();
579 if ( nWidth
<= nNewCol
)
581 Point aMaxPos
= OutputToScreenPixel( GetDesktopRectPixel().BottomRight() );
583 if ( nWidth
<= nNewCol
)
589 while ( nWidth
> 0 &&
590 (short)(aWinPos
.X()+(nMX
*nWidth
-1)) >= aMaxPos
.X()-3 )
593 if ( nNewCol
> nWidth
)
596 Invalidate( Rectangle( 0, aWinSize
.Height()-nTextHeight
+2,
597 aWinSize
.Width(), aWinSize
.Height() ) );
598 SetOutputSizePixel( Size( nMX
*nWidth
-1, aWinSize
.Height() ) );
602 if ( nNewCol
!= nCol
)
604 Invalidate( Rectangle( 0, aWinSize
.Height()-nTextHeight
+2,
605 aWinSize
.Width(), aWinSize
.Height() ) );
607 if ( nNewCol
< nCol
)
618 Invalidate( Rectangle( nMinCol
*nMX
-1, 0,
619 nMaxCol
*nMX
+1, aWinSize
.Height()-nTextHeight
+2 ) );
624 // -----------------------------------------------------------------------
626 void ColumnsWindow::MouseButtonDown( const MouseEvent
& rMEvt
)
628 SfxPopupWindow::MouseButtonDown( rMEvt
);
631 /* -----------------------------21.05.2002 16:11------------------------------
633 ---------------------------------------------------------------------------*/
634 void ColumnsWindow::KeyInput( const KeyEvent
& rKEvt
)
636 BOOL bHandled
= FALSE
;
637 USHORT nModifier
= rKEvt
.GetKeyCode().GetModifier();
638 USHORT nKey
= rKEvt
.GetKeyCode().GetCode();
641 if( KEY_LEFT
== nKey
|| KEY_RIGHT
== nKey
||
642 KEY_RETURN
== nKey
||KEY_ESCAPE
== nKey
||
657 if(IsMouseCaptured())
659 EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL
);
663 EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL
);
666 //make sure that a table can initially be created
669 bInitialKeyInput
= FALSE
;
673 UpdateSize_Impl( nNewCol
);
676 else if(KEY_MOD1
== nModifier
&& KEY_RETURN
== nKey
)
679 if(IsMouseCaptured())
681 EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL
);
684 SfxPopupWindow::KeyInput(rKEvt
);
687 // -----------------------------------------------------------------------
689 void ColumnsWindow::MouseButtonUp( const MouseEvent
& rMEvt
)
691 SfxPopupWindow::MouseButtonUp( rMEvt
);
694 if ( IsInPopupMode() )
695 EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL
);
698 // -----------------------------------------------------------------------
700 void ColumnsWindow::Paint( const Rectangle
& )
705 Size aSize
= GetOutputSizePixel();
707 for ( i
= 0; i
< nWidth
; i
++ )
711 SetLineColor( aHighlightLineColor
);
712 SetFillColor( aHighlightFillColor
);
716 SetLineColor( aLineColor
);
717 SetFillColor( aFillColor
);
720 DrawRect( Rectangle( i
*nMX
-1, -1,
721 i
*nMX
+nMX
, aSize
.Height()-nTextHeight
+1 ) );
724 while ( j
< aSize
.Height()-nTextHeight
-4 )
730 DrawLine( Point( i
*nMX
+4, j
), Point( i
*nMX
+nMX
-nLineWidth
-4, j
) );
736 SetFillColor( aFillColor
);
739 aText
= String( String::CreateFromInt32(nCol
) );
741 aText
= Button::GetStandardText( BUTTON_CANCEL
);
742 Size
aTextSize(GetTextWidth( aText
), GetTextHeight());
743 DrawText( Point( ( aSize
.Width() - aTextSize
.Width() ) / 2, aSize
.Height() - nTextHeight
+ 2 ), aText
);
745 DrawRect( Rectangle( 0, aSize
.Height()-nTextHeight
+2, (aSize
.Width()-aTextSize
.Width())/2-1, aSize
.Height() ) );
746 DrawRect( Rectangle( (aSize
.Width()-aTextSize
.Width())/2+aTextSize
.Width(), aSize
.Height()-nTextHeight
+2, aSize
.Width(), aSize
.Height() ) );
748 SetLineColor( aLineColor
);
750 DrawRect( Rectangle( Point(0,0), aSize
) );
753 // -----------------------------------------------------------------------
755 void ColumnsWindow::PopupModeEnd()
757 if ( !IsPopupModeCanceled() && nCol
)
759 USHORT nId
= GetId();
760 Window
* pParent
= rTbx
.GetParent();
761 pParent
->UserEvent(SVX_EVENT_COLUM_WINDOW_EXECUTE
, reinterpret_cast<void*>(nId
));
763 Sequence
< PropertyValue
> aArgs( 2 );
764 aArgs
[0].Name
= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ));
765 aArgs
[0].Value
= makeAny( sal_Int16( nCol
));
766 aArgs
[1].Name
= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Modifier" ));
767 aArgs
[1].Value
= makeAny( sal_Int16( m_bMod1
? KEY_MOD1
: 0 ));
769 SfxToolBoxControl::Dispatch( Reference
< XDispatchProvider
>( mxFrame
->getController(), UNO_QUERY
),
773 else if ( IsPopupModeCanceled() )
775 SfxPopupWindow::PopupModeEnd();
778 // class SvxTableToolBoxControl ------------------------------------------
780 SvxTableToolBoxControl::SvxTableToolBoxControl( USHORT nSlotId
, USHORT nId
, ToolBox
& rTbx
) :
781 SfxToolBoxControl( nSlotId
, nId
, rTbx
),
784 rTbx
.SetItemBits( nId
, TIB_DROPDOWN
| rTbx
.GetItemBits( nId
) );
788 // -----------------------------------------------------------------------
790 SvxTableToolBoxControl::~SvxTableToolBoxControl()
794 // -----------------------------------------------------------------------
796 SfxPopupWindowType
SvxTableToolBoxControl::GetPopupWindowType() const
798 return SFX_POPUPWINDOW_ONTIMEOUTANDMOVE
;
801 // -----------------------------------------------------------------------
803 SfxPopupWindow
* SvxTableToolBoxControl::CreatePopupWindow()
807 ToolBox
& rTbx
= GetToolBox();
808 TableWindow
* pWin
= new TableWindow( GetSlotId(), m_aCommandURL
, rTbx
, m_xFrame
);
809 pWin
->StartPopupMode( &rTbx
, FLOATWIN_POPUPMODE_GRABFOCUS
|FLOATWIN_POPUPMODE_NOKEYCLOSE
);
810 SetPopupWindow( pWin
);
816 // -----------------------------------------------------------------------
818 SfxPopupWindow
* SvxTableToolBoxControl::CreatePopupWindowCascading()
821 return new TableWindow( GetSlotId(), m_aCommandURL
, GetToolBox(), m_xFrame
);
825 // -----------------------------------------------------------------------
827 void SvxTableToolBoxControl::StateChanged( USHORT
, SfxItemState eState
, const SfxPoolItem
* pState
)
829 if ( pState
&& pState
->ISA(SfxUInt16Item
) )
831 INT16 nValue
= static_cast< const SfxUInt16Item
* >( pState
)->GetValue();
832 bEnabled
= ( nValue
!= 0 );
835 bEnabled
= SFX_ITEM_DISABLED
!= eState
;
837 USHORT nId
= GetId();
838 ToolBox
& rTbx
= GetToolBox();
840 rTbx
.EnableItem( nId
, SFX_ITEM_DISABLED
!= eState
);
841 rTbx
.SetItemState( nId
,
842 ( SFX_ITEM_DONTCARE
== eState
) ? STATE_DONTKNOW
: STATE_NOCHECK
);
845 // class SvxColumnsToolBoxControl ------------------------------------------
847 SvxColumnsToolBoxControl::SvxColumnsToolBoxControl( USHORT nSlotId
, USHORT nId
, ToolBox
& rTbx
) :
848 SfxToolBoxControl( nSlotId
, nId
, rTbx
)
850 rTbx
.SetItemBits( nId
, TIB_DROPDOWN
| rTbx
.GetItemBits( nId
) );
854 // -----------------------------------------------------------------------
856 SvxColumnsToolBoxControl::~SvxColumnsToolBoxControl()
860 // -----------------------------------------------------------------------
862 SfxPopupWindowType
SvxColumnsToolBoxControl::GetPopupWindowType() const
864 return SFX_POPUPWINDOW_ONTIMEOUTANDMOVE
;
867 // -----------------------------------------------------------------------
869 SfxPopupWindow
* SvxColumnsToolBoxControl::CreatePopupWindow()
871 ColumnsWindow
* pWin
= 0;
874 pWin
= new ColumnsWindow( GetSlotId(), m_aCommandURL
, GetToolBox(), m_xFrame
);
875 pWin
->StartPopupMode( &GetToolBox(),
876 FLOATWIN_POPUPMODE_GRABFOCUS
|FLOATWIN_POPUPMODE_NOKEYCLOSE
);
877 SetPopupWindow( pWin
);
882 // -----------------------------------------------------------------------
884 SfxPopupWindow
* SvxColumnsToolBoxControl::CreatePopupWindowCascading()
886 ColumnsWindow
* pWin
= 0;
889 pWin
= new ColumnsWindow( GetSlotId(), m_aCommandURL
, GetToolBox(), m_xFrame
);
893 /* -----------------18.11.99 16:38-------------------
895 --------------------------------------------------*/
896 void SvxColumnsToolBoxControl::StateChanged( USHORT nSID
,
898 const SfxPoolItem
* pState
)
900 bEnabled
= SFX_ITEM_DISABLED
!= eState
;
901 SfxToolBoxControl::StateChanged(nSID
, eState
, pState
);