[ooo-build-commit] .: 3 commits - svx/source

Jan Holesovsky kendy at kemper.freedesktop.org
Tue Sep 14 05:20:19 PDT 2010


 svx/source/tbxctrls/layctrl.cxx  |  488 +++++++++++++++++----------------------
 svx/source/tbxctrls/lboxctrl.cxx |    5 
 svx/source/tbxctrls/lboxctrl.src |   13 -
 svx/source/tbxctrls/linectrl.cxx |    4 
 svx/source/tbxctrls/tbcontrl.cxx |    6 
 5 files changed, 227 insertions(+), 289 deletions(-)

New commits:
commit c6eb9605babcd5621b77a3c12a977fed3a84c742
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Sep 14 11:50:57 2010 +0200

    toolbar-decorations-svx-undo-redo.diff: Update "Undo" and "Redo" widgets.

diff --git a/svx/source/tbxctrls/lboxctrl.cxx b/svx/source/tbxctrls/lboxctrl.cxx
index c5d7d21..2a1bb74 100644
--- a/svx/source/tbxctrls/lboxctrl.cxx
+++ b/svx/source/tbxctrls/lboxctrl.cxx
@@ -70,7 +70,6 @@ class SvxPopupWindowListBox : public SfxPopupWindow
 {
     using FloatingWindow::StateChanged;
 
-    FixedInfo		aInfo;
     ListBox	*		pListBox;
     ToolBox &		rToolBox;
     BOOL			bUserSel;
@@ -95,7 +94,6 @@ public:
 
     void 						StartSelection();
     inline ListBox &			GetListBox()	{ return *pListBox; }
-    inline FixedInfo &			GetInfo()		{ return aInfo; }
 
     BOOL						IsUserSelected() const			{ return bUserSel; }
     void						SetUserSelected( BOOL bVal )	{ bUserSel = bVal; }
@@ -106,7 +104,6 @@ public:
 
 SvxPopupWindowListBox::SvxPopupWindowListBox( USHORT nSlotId, const rtl::OUString& rCommandURL, USHORT nId, ToolBox& rTbx ) :
     SfxPopupWindow( nSlotId, Reference< XFrame >(), SVX_RES( RID_SVXTBX_UNDO_REDO_CTRL ) ),
-    aInfo		( this, SVX_RES( FT_NUM_OPERATIONS ) ),
     rToolBox	( rTbx ),
     bUserSel	( FALSE ),
     nTbxId      ( nId ),
@@ -242,7 +239,7 @@ void SvxListBoxControl::Impl_SetInfo( USHORT nCount )
 
     String aText( aActionStr );
     aText.SearchAndReplaceAllAscii( "$(ARG1)", String::CreateFromInt32( nCount ) );
-    pPopupWin->GetInfo().SetText( aText );
+    pPopupWin->SetText( aText );
 }
 
 
diff --git a/svx/source/tbxctrls/lboxctrl.src b/svx/source/tbxctrls/lboxctrl.src
index 481c358..149627e 100644
--- a/svx/source/tbxctrls/lboxctrl.src
+++ b/svx/source/tbxctrls/lboxctrl.src
@@ -32,27 +32,20 @@
 FloatingWindow RID_SVXTBX_UNDO_REDO_CTRL
 {
     Pos = MAP_APPFONT ( 0 , 0 ) ;
-    Size = MAP_APPFONT ( 150 , 74 ) ;
+    Size = MAP_APPFONT ( 102 , 87 ) ;
     HelpID = HID_SVXTBX_UNDO_REDO_CTRL ;
-    SysWin = TRUE;
-    Border = TRUE ;
+    StdPopup = TRUE;
     Hide = TRUE ;
-    SVLook = TRUE ;
     OutputSize = TRUE ;
 
     ListBox LB_SVXTBX_UNDO_REDO_CTRL
     {
         Pos = MAP_APPFONT ( 0 , 0 ) ;
-        Size = MAP_APPFONT ( 150 , 60 ) ;
+        Size = MAP_APPFONT ( 100 , 85 ) ;
         Border = TRUE ;
         DropDown = FALSE ;
         OutputSize = TRUE ;
     };
-    FixedText FT_NUM_OPERATIONS
-    {
-        Pos = MAP_APPFONT ( 6 , 64 ) ;
-        Size = MAP_APPFONT ( 138 , 10 ) ;
-    };
 };
 
 String RID_SVXSTR_NUM_UNDO_ACTIONS
commit 41e00d403cbcea258168bf1a7650db28fd15c6a9
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Sep 14 11:49:46 2010 +0200

    toolbar-decorations-svx-tables-columns.diff: "New table" widget rework.
    
    And a small update of the "Columns" widget.

diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx
index 0ffa7de..2f2c1c9 100644
--- a/svx/source/tbxctrls/layctrl.cxx
+++ b/svx/source/tbxctrls/layctrl.cxx
@@ -32,9 +32,7 @@
 
 #include <string> // HACK: prevent conflict between STLPORT and Workshop headers
 #include <vcl/toolbox.hxx>
-#ifndef _SV_BUTTON_HXX //autogen
 #include <vcl/button.hxx>
-#endif
 #include <svl/intitem.hxx>
 #include <sfx2/dispatch.hxx>
 #include <sfx2/app.hxx>
@@ -56,51 +54,72 @@ SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item);
 
 // class TableWindow -----------------------------------------------------
 
+const long TABLE_CELL_WIDTH  = 15;
+const long TABLE_CELL_HEIGHT = 15;
+
+const long TABLE_CELLS_HORIZ = 10;
+const long TABLE_CELLS_VERT  = 15;
+
+const long TABLE_POS_X = 2;
+const long TABLE_POS_Y = 2;
+
+const long TABLE_WIDTH  = TABLE_POS_X + TABLE_CELLS_HORIZ*TABLE_CELL_WIDTH;
+const long TABLE_HEIGHT = TABLE_POS_Y + TABLE_CELLS_VERT*TABLE_CELL_HEIGHT;
+
 class TableWindow : public SfxPopupWindow
 {
 private:
+    PushButton          aTableButton;
     ::Color			    aLineColor;
-    ::Color			    aHighlightLineColor;
     ::Color			    aFillColor;
     ::Color			    aHighlightFillColor;
+    ::Color			    aBackgroundColor;
     long                nCol;
     long                nLine;
-    long                nWidth;
-    long                nHeight;
-    long                nMX;
-    long                nMY;
-    long                nTextHeight;
     BOOL                bInitialKeyInput;
     BOOL                m_bMod1;
     ToolBox&            rTbx;
     Reference< XFrame > mxFrame;
     rtl::OUString       maCommand;
 
-    void UpdateSize_Impl( long nNewCol, long nNewLine);
+    DECL_LINK( SelectHdl, void * );
 
 public:
                             TableWindow( USHORT                     nSlotId,
                                          const rtl::OUString&       rCmd,
+                                         const String&              rText,
                                          ToolBox&                   rParentTbx,
                                          const Reference< XFrame >& rFrame );
                             ~TableWindow();
 
     void                    KeyInput( const KeyEvent& rKEvt );
     virtual void            MouseMove( const MouseEvent& rMEvt );
-    virtual void			MouseButtonDown( const MouseEvent& rMEvt );
     virtual void			MouseButtonUp( const MouseEvent& rMEvt );
     virtual void    		Paint( const Rectangle& );
     virtual void    		PopupModeEnd();
     virtual SfxPopupWindow*	Clone() const;
 
-    USHORT          		GetColCount() const { return (USHORT)nCol; }
-    USHORT          		GetLineCount() const { return (USHORT)nLine; }
+private:
+    void    				Update( long nNewCol, long nNewLine );
+    void    				TableDialog( const Sequence< PropertyValue >& rArgs );
+    void    				CloseAndShowTableDialog();
 };
 
 // -----------------------------------------------------------------------
 
-TableWindow::TableWindow( USHORT nSlotId, const rtl::OUString& rCmd, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) :
-    SfxPopupWindow( nSlotId, rFrame, WB_SYSTEMWINDOW ),
+IMPL_LINK( TableWindow, SelectHdl, void *, EMPTYARG )
+{
+    CloseAndShowTableDialog();
+    return NULL;
+}
+
+// -----------------------------------------------------------------------
+
+TableWindow::TableWindow( USHORT nSlotId, const rtl::OUString& rCmd, const String& rText, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) :
+    SfxPopupWindow( nSlotId, rFrame, WinBits( WB_STDPOPUP ) ),
+    aTableButton( this ),
+    nCol( 0 ),
+    nLine( 0 ),
     bInitialKeyInput(TRUE),
     m_bMod1(FALSE),
     rTbx(rParentTbx),
@@ -109,38 +128,41 @@ TableWindow::TableWindow( USHORT nSlotId, const rtl::OUString& rCmd, ToolBox& rP
 {
     const StyleSettings& rStyles = Application::GetSettings().GetStyleSettings();
     svtools::ColorConfig aColorConfig;
-    aLineColor = ::Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor );
-    aHighlightLineColor = rStyles.GetHighlightTextColor();
+
+    aLineColor = rStyles.GetShadowColor();
     aFillColor = rStyles.GetWindowColor();
     aHighlightFillColor = rStyles.GetHighlightColor();
+    aBackgroundColor = GetSettings().GetStyleSettings().GetFaceColor();
 
-    nTextHeight = GetTextHeight()+1;
-    SetBackground();
+    SetBackground( aBackgroundColor );
     Font aFont = GetFont();
-    aFont.SetColor( aLineColor );
-    aFont.SetFillColor( aFillColor );
+    aFont.SetColor( ::Color( aColorConfig.GetColorValue( svtools::FONTCOLOR ).nColor )  );
+    aFont.SetFillColor( aBackgroundColor );
     aFont.SetTransparent( FALSE );
     SetFont( aFont );
 
-    nCol    = 0;
-    nLine   = 0;
-    nWidth  = 5;
-    nHeight = 5;
+    SetText( rText );
 
-    Size aLogicSize = LogicToPixel( Size( 55, 35 ), MapMode( MAP_10TH_MM ) );
-    nMX = aLogicSize.Width();
-    nMY = aLogicSize.Height();
-    SetOutputSizePixel( Size( nMX*nWidth-1, nMY*nHeight-1+nTextHeight ) );
+    aTableButton.SetPosSizePixel( Point( TABLE_POS_X + TABLE_CELL_WIDTH, TABLE_HEIGHT + 5 ),
+            Size( TABLE_WIDTH - TABLE_POS_X - 2*TABLE_CELL_WIDTH, 24 ) );
+    aTableButton.SetText( String( SVX_RESSTR( RID_SVXSTR_MORE ) ) );
+    aTableButton.SetClickHdl( LINK( this, TableWindow, SelectHdl ) );
+    aTableButton.Show();
+
+    SetOutputSizePixel( Size( TABLE_WIDTH + 3, TABLE_HEIGHT + 33 ) );
 }
+
 // -----------------------------------------------------------------------
+
 TableWindow::~TableWindow()
 {
 }
+
 // -----------------------------------------------------------------------
 
 SfxPopupWindow* TableWindow::Clone() const
 {
-    return new TableWindow( GetId(), maCommand, rTbx, mxFrame );
+    return new TableWindow( GetId(), maCommand, GetText(), rTbx, mxFrame );
 }
 
 // -----------------------------------------------------------------------
@@ -151,164 +173,64 @@ void TableWindow::MouseMove( const MouseEvent& rMEvt )
     Point aPos = rMEvt.GetPosPixel();
     Point aMousePos( aPos );
 
-    if ( rMEvt.IsEnterWindow() )
-        CaptureMouse();
-    else if ( aMousePos.X() < 0 || aMousePos.Y() < 0 )
-    {
-        nCol = 0;
-        nLine = 0;
-        ReleaseMouse();
-        Invalidate();
-        return;
-    }
-
-    long    nNewCol = 0;
-    long    nNewLine = 0;
-
-    if ( aPos.X() > 0 )
-        nNewCol = aPos.X() / nMX + 1;
-    if ( aPos.Y() > 0 )
-        nNewLine = aPos.Y() / nMY + 1;
-
-    if ( nNewCol > 500 )
-        nNewCol = 500;
-    if ( nNewLine > 1000 )
-        nNewLine = 1000;
-
-    UpdateSize_Impl( nNewCol, nNewLine);
+    long nNewCol = ( aMousePos.X() - TABLE_POS_X + TABLE_CELL_WIDTH ) / TABLE_CELL_WIDTH;
+    long nNewLine = ( aMousePos.Y() - TABLE_POS_Y + TABLE_CELL_HEIGHT ) / TABLE_CELL_HEIGHT;
 
+    Update( nNewCol, nNewLine );
 }
-/* -----------------------------15.05.2002 17:14------------------------------
 
- ---------------------------------------------------------------------------*/
-void TableWindow::UpdateSize_Impl( long nNewCol, long nNewLine)
-{
-    Size  aWinSize = GetOutputSizePixel();
-    Point aWinPos = GetPosPixel();
-    Point aMaxPos = OutputToScreenPixel( GetDesktopRectPixel().BottomRight() );
-    if ( (nWidth <= nNewCol) || (nHeight < nNewLine) )
-    {
-        long    nOff = 0;
-
-        if ( nWidth <= nNewCol )
-        {
-            nWidth = nNewCol;
-            nWidth++;
-        }
-        if ( nHeight <= nNewLine )
-        {
-            nHeight = nNewLine;
-            nOff = 1;
-        }
-        while ( nWidth > 0 &&
-                (short)(aWinPos.X()+(nMX*nWidth-1)) >= aMaxPos.X()-3 )
-            nWidth--;
-
-        while ( nHeight > 0 &&
-                (short)(aWinPos.Y()+(nMY*nHeight-1+nTextHeight)) >=
-                aMaxPos.Y()-3 )
-            nHeight--;
-
-        if ( nNewCol > nWidth )
-            nNewCol = nWidth;
-
-        if ( nNewLine > nHeight )
-            nNewLine = nHeight;
-
-        Size    _aWinSize = GetOutputSizePixel();
-        Invalidate( Rectangle( 0, _aWinSize.Height()-nTextHeight+2-nOff,
-                               _aWinSize.Width(), _aWinSize.Height() ) );
-        SetOutputSizePixel( Size( nMX*nWidth-1, nMY*nHeight-1+nTextHeight ) );
-    }
-    long    nMinCol = 0;
-    long    nMaxCol = 0;
-    long    nMinLine = 0;
-    long    nMaxLine = 0;
-    if ( nNewCol < nCol )
-    {
-        nMinCol = nNewCol;
-        nMaxCol = nCol;
-    }
-    else
-    {
-        nMinCol = nCol;
-        nMaxCol = nNewCol;
-    }
-    if ( nNewLine < nLine )
-    {
-        nMinLine = nNewLine;
-        nMaxLine = nLine;
-    }
-    else
-    {
-        nMinLine = nLine;
-        nMaxLine = nNewLine;
-    }
-
-    if ( (nNewCol != nCol) || (nNewLine != nLine) )
-    {
-        Invalidate( Rectangle( 0, aWinSize.Height()-nTextHeight+2,
-                               aWinSize.Width(), aWinSize.Height() ) );
-
-        if ( nNewCol != nCol )
-        {
-            Invalidate( Rectangle( nMinCol*nMX-1, 0, nMaxCol*nMX+1, nMaxLine*nMY ) );
-            nCol  = nNewCol;
-        }
-        if ( nNewLine != nLine )
-        {
-            Invalidate( Rectangle( 0, nMinLine*nMY-2, nMaxCol*nMX, nMaxLine*nMY+1 ) );
-            nLine = nNewLine;
-        }
-    }
-    Update();
-}
-/* -----------------------------15.05.2002 14:22------------------------------
+// -----------------------------------------------------------------------
 
- ---------------------------------------------------------------------------*/
 void TableWindow::KeyInput( const KeyEvent& rKEvt )
 {
-    BOOL bHandled = FALSE;
+    bool bHandled = false;
     USHORT nModifier = rKEvt.GetKeyCode().GetModifier();
     USHORT nKey = rKEvt.GetKeyCode().GetCode();
-    if(!nModifier)
+    if ( !nModifier )
     {
-        if( KEY_UP == nKey || KEY_DOWN == nKey ||
-            KEY_LEFT == nKey || KEY_RIGHT == nKey ||
-            KEY_ESCAPE == nKey ||KEY_RETURN == nKey )
+        bHandled = true;
+        long nNewCol = nCol;
+        long nNewLine = nLine;
+        switch(nKey)
         {
-            bHandled = TRUE;
-            long nNewCol = nCol;
-            long nNewLine = nLine;
-            switch(nKey)
-            {
-                case KEY_UP :
-                    if(nNewLine > 1)
-                    {
-                        nNewLine--;
-                        break;
-                    }
-                //no break;
-                case KEY_ESCAPE:
-                    EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL);
+            case KEY_UP:
+                if ( nNewLine > 1 )
+                    nNewLine--;
+                else
+                    EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
                 break;
-                case KEY_DOWN :
+            case KEY_DOWN:
+                if ( nNewLine < TABLE_CELLS_VERT )
                     nNewLine++;
+                else
+                    CloseAndShowTableDialog();
                 break;
-                case KEY_LEFT :
-
-                    if(nNewCol)
-                        nNewCol--;
+            case KEY_LEFT:
+                if ( nNewCol > 1 )
+                    nNewCol--;
+                else
+                    EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
                 break;
-                case KEY_RIGHT :
+            case KEY_RIGHT:
+                if ( nNewCol < TABLE_CELLS_HORIZ )
                     nNewCol++;
+                else
+                    CloseAndShowTableDialog();
                 break;
-                case KEY_RETURN :
-                    if(IsMouseCaptured())
-                        ReleaseMouse();
-                    EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL );
+            case KEY_ESCAPE:
+                EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
                 break;
-            }
+            case KEY_RETURN:
+                EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
+                break;
+            case KEY_TAB:
+                CloseAndShowTableDialog();
+                break;
+            default:
+                bHandled = false;
+        }
+        if ( bHandled )
+        {
             //make sure that a table can initially be created
             if(bInitialKeyInput)
             {
@@ -318,27 +240,17 @@ void TableWindow::KeyInput( const KeyEvent& rKEvt )
                 if(!nNewCol)
                     nNewCol = 1;
             }
-            UpdateSize_Impl( nNewCol, nNewLine);
+            Update( nNewCol, nNewLine );
         }
     }
     else if(KEY_MOD1 == nModifier && KEY_RETURN == nKey)
     {
         m_bMod1 = TRUE;
-        if(IsMouseCaptured())
-            ReleaseMouse();
-        EndPopupMode(FLOATWIN_POPUPMODEEND_CLOSEALL );
+        EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
     }
 
     if(!bHandled)
         SfxPopupWindow::KeyInput(rKEvt);
-
-}
-// -----------------------------------------------------------------------
-
-void TableWindow::MouseButtonDown( const MouseEvent& rMEvt )
-{
-    SfxPopupWindow::MouseButtonDown( rMEvt );
-    CaptureMouse();
 }
 
 // -----------------------------------------------------------------------
@@ -346,56 +258,45 @@ void TableWindow::MouseButtonDown( const MouseEvent& rMEvt )
 void TableWindow::MouseButtonUp( const MouseEvent& rMEvt )
 {
     SfxPopupWindow::MouseButtonUp( rMEvt );
-    ReleaseMouse();
-
-    if ( IsInPopupMode() )
-        EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
+    EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
 }
 
 // -----------------------------------------------------------------------
 
 void TableWindow::Paint( const Rectangle& )
 {
-    long    i;
-    long    nStart;
-    Size    aSize = GetOutputSizePixel();
+    const long nSelectionWidth = TABLE_POS_X + nCol*TABLE_CELL_WIDTH;
+    const long nSelectionHeight = TABLE_POS_Y + nLine*TABLE_CELL_HEIGHT;
 
-    SetLineColor();
-    SetFillColor( aHighlightFillColor );
-    DrawRect( Rectangle( 0, 0, nCol*nMX-1, nLine*nMY-1 ) );
-    SetFillColor( aFillColor );
-    DrawRect( Rectangle( nCol*nMX-1, 0,
-                         aSize.Width(), aSize.Height()-nTextHeight+1 ) );
-    DrawRect( Rectangle( 0, nLine*nMY-1,
-                         aSize.Width(), aSize.Height()-nTextHeight+1 ) );
-
-    SetLineColor( aHighlightLineColor );
-    for ( i = 1; i < nCol; i++ )
-        DrawLine( Point( i*nMX-1, 0 ), Point( i*nMX-1, nLine*nMY-1 ) );
-    for ( i = 1; i < nLine; i++ )
-        DrawLine( Point( 0, i*nMY-1 ), Point( nCol*nMX-1, i*nMY-1 ) );
+    // the non-selected parts of the table
     SetLineColor( aLineColor );
-    for ( i = 1; i <= nWidth; i++ )
-    {
-        if ( i < nCol )
-            nStart = nLine*nMY-1;
-        else
-            nStart = 0;
-        DrawLine( Point( i*nMX-1, nStart ), Point( i*nMX-1, nHeight*nMY-1 ) );
-    }
-    for ( i = 1; i <= nHeight; i++ )
+    SetFillColor( aFillColor );
+    DrawRect( Rectangle( nSelectionWidth, TABLE_POS_Y, TABLE_WIDTH, nSelectionHeight ) );
+    DrawRect( Rectangle( TABLE_POS_X, nSelectionHeight, nSelectionWidth, TABLE_HEIGHT ) );
+    DrawRect( Rectangle( nSelectionWidth, nSelectionHeight, TABLE_WIDTH, TABLE_HEIGHT ) );
+
+    // the selection
+    if ( nCol > 0 && nLine > 0 )
     {
-        if ( i < nLine )
-            nStart = nCol*nMX-1;
-        else
-            nStart = 0;
-        DrawLine( Point( nStart, i*nMY-1 ), Point( nWidth*nMX-1, i*nMY-1 ) );
+        SetFillColor( aHighlightFillColor );
+        DrawRect( Rectangle( TABLE_POS_X, TABLE_POS_Y,
+                    nSelectionWidth, nSelectionHeight ) );
     }
 
-    SetLineColor();
-    String aText;
+    // lines inside of the table
+    SetLineColor( aLineColor );
+    for ( long i = 1; i < TABLE_CELLS_VERT; ++i )
+        DrawLine( Point( TABLE_POS_X, TABLE_POS_Y + i*TABLE_CELL_HEIGHT ),
+                  Point( TABLE_WIDTH, TABLE_POS_Y + i*TABLE_CELL_HEIGHT ) );
+
+    for ( long i = 1; i < TABLE_CELLS_HORIZ; ++i )
+        DrawLine( Point( TABLE_POS_X + i*TABLE_CELL_WIDTH, TABLE_POS_Y ),
+                  Point( TABLE_POS_X + i*TABLE_CELL_WIDTH, TABLE_HEIGHT ) );
+
+    // the text near the mouse cursor telling the table dimensions
     if ( nCol && nLine )
     {
+        String aText;
         aText += String::CreateFromInt32( nCol );
         aText.AppendAscii( " x " );
         aText += String::CreateFromInt32( nLine );
@@ -405,22 +306,30 @@ void TableWindow::Paint( const Rectangle& )
             aText += String(SVX_RESSTR(RID_SVXSTR_PAGES));
         }
 
-    }
-    else
-        aText = Button::GetStandardText( BUTTON_CANCEL );
-    Size aTextSize( GetTextWidth( aText ), GetTextHeight() );
+        Size aSize = GetOutputSizePixel();
+        Size aTextSize( GetTextWidth( aText ), GetTextHeight() );
 
-    Rectangle aClearRect( 0, aSize.Height()-nTextHeight+2, (aSize.Width()), aSize.Height() );
-    DrawRect( aClearRect );
+        long nTextX = nSelectionWidth + TABLE_CELL_WIDTH;
+        long nTextY = nSelectionHeight + TABLE_CELL_HEIGHT;
+        const long nTipBorder = 2;
 
-    // #i95350# force RTL output
-    if( IsRTLEnabled() && 	nCol && nLine )
-        aText.Insert(0x202D, 0);
-    DrawText( Point( (aSize.Width() - aTextSize.Width()) / 2, aSize.Height() - nTextHeight + 2 ), aText );
+        if ( aTextSize.Width() + TABLE_POS_X + TABLE_CELL_WIDTH + 2*nTipBorder < nSelectionWidth )
+            nTextX = nSelectionWidth - TABLE_CELL_WIDTH - aTextSize.Width();
 
-    SetLineColor( aLineColor );
-    SetFillColor();
-    DrawRect( Rectangle( Point(0,0), aSize ) );
+        if ( aTextSize.Height() + TABLE_POS_Y + TABLE_CELL_HEIGHT + 2*nTipBorder < nSelectionHeight )
+            nTextY = nSelectionHeight - TABLE_CELL_HEIGHT - aTextSize.Height();
+
+        SetLineColor( aLineColor );
+        SetFillColor( aBackgroundColor );
+        DrawRect( Rectangle ( nTextX - 2*nTipBorder, nTextY - 2*nTipBorder,
+                    nTextX + aTextSize.Width() + nTipBorder, nTextY + aTextSize.Height() + nTipBorder ) );
+
+        // #i95350# force RTL output
+        if ( IsRTLEnabled() )
+            aText.Insert( 0x202D, 0 );
+
+        DrawText( Point( nTextX, nTextY ), aText );
+    }
 }
 
 // -----------------------------------------------------------------------
@@ -429,37 +338,71 @@ void TableWindow::PopupModeEnd()
 {
     if ( !IsPopupModeCanceled() && nCol && nLine )
     {
-        Window* pParent = rTbx.GetParent();
-        USHORT nId = GetId();
-        pParent->UserEvent(SVX_EVENT_COLUM_WINDOW_EXECUTE, reinterpret_cast<void*>(nId));
-
-        Reference< XDispatchProvider > xDispatchProvider( mxFrame, UNO_QUERY );
-        if ( xDispatchProvider.is() )
-        {
-            com::sun::star::util::URL aTargetURL;
-            Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
-                                                    rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )),
-                                                  UNO_QUERY );
-            aTargetURL.Complete = maCommand;
-            xTrans->parseStrict( aTargetURL );
-            Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
-            if ( xDispatch.is() )
-            {
-                Sequence< PropertyValue > aArgs( 2 );
-                aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ));
-                aArgs[0].Value = makeAny( sal_Int16( nCol ));
-                aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Rows" ));
-                aArgs[1].Value = makeAny( sal_Int16( nLine ));
+        Sequence< PropertyValue > aArgs( 2 );
+        aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Columns" ));
+        aArgs[0].Value = makeAny( sal_Int16( nCol ));
+        aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Rows" ));
+        aArgs[1].Value = makeAny( sal_Int16( nLine ));
 
-                xDispatch->dispatch( aTargetURL, aArgs );
-            }
-        }
+        TableDialog( aArgs );
     }
-    else if ( IsPopupModeCanceled() )
-        ReleaseMouse();
+
     SfxPopupWindow::PopupModeEnd();
 }
 
+// -----------------------------------------------------------------------
+
+void TableWindow::Update( long nNewCol, long nNewLine )
+{
+    if ( nNewCol < 0 || nNewCol > TABLE_CELLS_HORIZ )
+        nNewCol = 0;
+
+    if ( nNewLine < 0 || nNewLine > TABLE_CELLS_VERT )
+        nNewLine = 0;
+
+    if ( nNewCol != nCol || nNewLine != nLine )
+    {
+        nCol = nNewCol;
+        nLine = nNewLine;
+        Invalidate( Rectangle( TABLE_POS_X, TABLE_POS_Y, TABLE_WIDTH, TABLE_HEIGHT ) );
+    }
+}
+
+// -----------------------------------------------------------------------
+
+void TableWindow::TableDialog( const Sequence< PropertyValue >& rArgs )
+{
+    Window* pParent = rTbx.GetParent();
+    USHORT nId = GetId();
+    pParent->UserEvent(SVX_EVENT_COLUM_WINDOW_EXECUTE, reinterpret_cast<void*>(nId));
+
+    Reference< XDispatchProvider > xDispatchProvider( mxFrame, UNO_QUERY );
+    if ( xDispatchProvider.is() )
+    {
+        com::sun::star::util::URL aTargetURL;
+        Reference < XURLTransformer > xTrans( ::comphelper::getProcessServiceFactory()->createInstance(
+                    rtl::OUString::createFromAscii("com.sun.star.util.URLTransformer" )),
+                UNO_QUERY );
+        aTargetURL.Complete = maCommand;
+        xTrans->parseStrict( aTargetURL );
+
+        Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, rtl::OUString(), 0 );
+        if ( xDispatch.is() )
+            xDispatch->dispatch( aTargetURL, rArgs );
+    }
+}
+
+// -----------------------------------------------------------------------
+
+void TableWindow::CloseAndShowTableDialog()
+{
+    // close the toolbar tool
+    EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+
+    // and open the table dialog instead
+    TableDialog( Sequence< PropertyValue >() );
+}
+
 // class ColumnsWindow ---------------------------------------------------
 
 class ColumnsWindow : public SfxPopupWindow
@@ -469,6 +412,7 @@ private:
     ::Color			    aHighlightLineColor;
     ::Color			    aFillColor;
     ::Color			    aHighlightFillColor;
+    ::Color			    aFaceColor;
     long                nCol;
     long                nWidth;
     long                nMX;
@@ -481,7 +425,7 @@ private:
 
     void UpdateSize_Impl( long nNewCol );
 public:
-                            ColumnsWindow( USHORT nId, const ::rtl::OUString& rCmd, ToolBox& rParentTbx, const Reference< XFrame >& rFrame );
+                            ColumnsWindow( USHORT nId, const ::rtl::OUString& rCmd, const String& rText, ToolBox& rParentTbx, const Reference< XFrame >& rFrame );
 
     void                    KeyInput( const KeyEvent& rKEvt );
     virtual void            MouseMove( const MouseEvent& rMEvt );
@@ -496,8 +440,8 @@ public:
 
 // -----------------------------------------------------------------------
 
-ColumnsWindow::ColumnsWindow( USHORT nId, const ::rtl::OUString& rCmd, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) :
-    SfxPopupWindow( nId, rFrame, WB_SYSTEMWINDOW ),
+ColumnsWindow::ColumnsWindow( USHORT nId, const ::rtl::OUString& rCmd, const String& rText, ToolBox& rParentTbx, const Reference< XFrame >& rFrame ) :
+    SfxPopupWindow( nId, rFrame, WB_STDPOPUP ),
     bInitialKeyInput(TRUE),
     m_bMod1(FALSE),
     rTbx(rParentTbx),
@@ -510,18 +454,21 @@ ColumnsWindow::ColumnsWindow( USHORT nId, const ::rtl::OUString& rCmd, ToolBox&
     aHighlightLineColor = rStyles.GetHighlightTextColor();
     aFillColor = rStyles.GetWindowColor();
     aHighlightFillColor = rStyles.GetHighlightColor();
+    aFaceColor = rStyles.GetFaceColor();
 
     nTextHeight = GetTextHeight()+1;
     SetBackground();
     Font aFont( GetFont() );
     aFont.SetColor( aLineColor );
-    aFont.SetFillColor( aFillColor );
+    aFont.SetFillColor( aFaceColor );
     aFont.SetTransparent( FALSE );
     SetFont( aFont );
 
     nCol        = 0;
     nWidth      = 4;
 
+    SetText( rText );
+
     Size aLogicSize = LogicToPixel( Size( 95, 155 ), MapMode( MAP_10TH_MM ) );
     nMX = aLogicSize.Width();
     SetOutputSizePixel( Size( nMX*nWidth-1, aLogicSize.Height()+nTextHeight ) );
@@ -532,7 +479,7 @@ ColumnsWindow::ColumnsWindow( USHORT nId, const ::rtl::OUString& rCmd, ToolBox&
 
 SfxPopupWindow* ColumnsWindow::Clone() const
 {
-    return new ColumnsWindow( GetId(), maCommand, rTbx, mxFrame );
+    return new ColumnsWindow( GetId(), maCommand, GetText(), rTbx, mxFrame );
 }
 
 // -----------------------------------------------------------------------
@@ -730,12 +677,13 @@ void ColumnsWindow::Paint( const Rectangle& )
     }
 
     SetLineColor();
-    SetFillColor( aFillColor );
+    SetFillColor( aFaceColor );
     String aText;
     if ( nCol )
         aText = String( String::CreateFromInt32(nCol) );
     else
-        aText = Button::GetStandardText( BUTTON_CANCEL );
+        aText = Button::GetStandardText( BUTTON_CANCEL ).EraseAllChars( '~' );
+
     Size aTextSize(GetTextWidth( aText ), GetTextHeight());
     DrawText( Point( ( aSize.Width() - aTextSize.Width() ) / 2, aSize.Height() - nTextHeight + 2 ), aText );
 
@@ -744,7 +692,7 @@ void ColumnsWindow::Paint( const Rectangle& )
 
     SetLineColor( aLineColor );
     SetFillColor();
-    DrawRect( Rectangle( Point(0,0), aSize ) );
+    DrawRect( Rectangle( 0, 0, aSize.Width() - 1, aSize.Height() - nTextHeight + 1 ) );
 }
 
 // -----------------------------------------------------------------------
@@ -802,7 +750,7 @@ SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
     if ( bEnabled )
     {
         ToolBox& rTbx = GetToolBox();
-        TableWindow* pWin = new TableWindow( GetSlotId(), m_aCommandURL, rTbx, m_xFrame );
+        TableWindow* pWin = new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), rTbx, m_xFrame );
         pWin->StartPopupMode( &rTbx, FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
         SetPopupWindow( pWin );
         return pWin;
@@ -815,7 +763,7 @@ SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindow()
 SfxPopupWindow* SvxTableToolBoxControl::CreatePopupWindowCascading()
 {
     if ( bEnabled )
-        return new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox(), m_xFrame );
+        return new TableWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
     return 0;
 }
 
@@ -868,7 +816,7 @@ SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindow()
     ColumnsWindow* pWin = 0;
     if(bEnabled)
     {
-            pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox(), m_xFrame );
+            pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
             pWin->StartPopupMode( &GetToolBox(),
                                   FLOATWIN_POPUPMODE_GRABFOCUS|FLOATWIN_POPUPMODE_NOKEYCLOSE );
             SetPopupWindow( pWin );
@@ -883,7 +831,7 @@ SfxPopupWindow* SvxColumnsToolBoxControl::CreatePopupWindowCascading()
     ColumnsWindow* pWin = 0;
     if(bEnabled)
     {
-        pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox(), m_xFrame );
+        pWin = new ColumnsWindow( GetSlotId(), m_aCommandURL, GetToolBox().GetItemText( GetId() ), GetToolBox(), m_xFrame );
     }
     return pWin;
 }
commit 46ea2f6cb38536aa1b1a259af2145a581e19f6e8
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Tue Sep 14 11:47:49 2010 +0200

    toolbar-decorations-svx.diff: Improved toolbar popups.

diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx
index f3a21c1..bd88600 100644
--- a/svx/source/tbxctrls/linectrl.cxx
+++ b/svx/source/tbxctrls/linectrl.cxx
@@ -382,7 +382,7 @@ SvxLineEndWindow::SvxLineEndWindow(
     const String& rWndTitle ) :
     SfxPopupWindow( nSlotId,
                     rFrame,
-                    WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
+                    WinBits( WB_STDPOPUP ) ),
     pLineEndList	( NULL ),
     aLineEndSet		( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
     nCols			( 2 ),
@@ -404,7 +404,7 @@ SvxLineEndWindow::SvxLineEndWindow(
     SfxPopupWindow( nSlotId,
                     rFrame,
                     pParentWindow,
-                    WinBits( WB_BORDER | WB_STDFLOATWIN | WB_SIZEABLE | WB_3DLOOK ) ),
+                    WinBits( WB_STDPOPUP ) ),
     pLineEndList	( NULL ),
     aLineEndSet		( this, WinBits( WB_ITEMBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
     nCols			( 2 ),
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index db1c542..01d02a6 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -829,7 +829,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
                                           const String&              rWndTitle,
                                           Window*                    pParentWindow ) :
 
-    SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK|WB_DIALOGCONTROL ) ),
+    SfxPopupWindow( nSlotId, rFrame, pParentWindow, WinBits( WB_STDPOPUP ) ),
 
     theSlotId( nSlotId ),
     aColorSet( this, WinBits( WB_ITEMBORDER | WB_NAMEFIELD | WB_3DLOOK | WB_NO_DIRECTSELECT) ),
@@ -1055,7 +1055,7 @@ void SvxColorWindow_Impl::StateChanged( USHORT nSID, SfxItemState eState, const
 
 SvxFrameWindow_Impl::SvxFrameWindow_Impl( USHORT nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
 
-    SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL ) ),
+    SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP ) ),
     aFrameSet   ( this, WinBits( WB_ITEMBORDER | WB_DOUBLEBORDER | WB_3DLOOK | WB_NO_DIRECTSELECT ) ),
     bParagraphMode(sal_False)
 
@@ -1329,7 +1329,7 @@ BOOL SvxFrameWindow_Impl::Close()
 
 SvxLineWindow_Impl::SvxLineWindow_Impl( USHORT nId, const Reference< XFrame >& rFrame, Window* pParentWindow ) :
 
-    SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_BORDER | WB_STDFLOATWIN | WB_3DLOOK | WB_DIALOGCONTROL ) ),
+    SfxPopupWindow( nId, rFrame, pParentWindow, WinBits( WB_STDPOPUP ) ),
 
     aLineSet( this, WinBits( WB_3DLOOK | WB_ITEMBORDER | WB_DOUBLEBORDER | WB_NAMEFIELD | WB_NONEFIELD | WB_NO_DIRECTSELECT ) )
 {


More information about the ooo-build-commit mailing list