LCOV - code coverage report
Current view: top level - libreoffice/cui/source/dialogs - commonlingui.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 100 0.0 %
Date: 2012-12-27 Functions: 0 14 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include "commonlingui.hxx"
      21             : 
      22             : #include <cuires.hrc>
      23             : #include <dialmgr.hxx>
      24             : #include <vcl/decoview.hxx>
      25             : #include <sal/macros.h>
      26             : 
      27             : #include "hangulhanjadlg.hrc"
      28             : 
      29             : //=============================================================================
      30             : // SvxClickInfoCtr
      31             : //=============================================================================
      32             : 
      33             : //-----------------------------------------------------------------------------
      34           0 : SvxClickInfoCtr::SvxClickInfoCtr( Window* pParent, const ResId& rResId ) :
      35             :         Control( pParent, rResId ),
      36           0 :         aFixedInfo( this)
      37             : {
      38           0 :     aFixedInfo.SetSizePixel(GetOutputSizePixel());
      39           0 :     aFixedInfo.Show();
      40           0 : }
      41             : 
      42             : //-----------------------------------------------------------------------------
      43           0 : void SvxClickInfoCtr::MouseButtonDown( const MouseEvent& )
      44             : {
      45           0 :     aActivateLink.Call(this);
      46           0 : }
      47             : 
      48             : //-----------------------------------------------------------------------------
      49           0 : long SvxClickInfoCtr::PreNotify( NotifyEvent& rNEvt )
      50             : {
      51           0 :     if(rNEvt.GetType()==EVENT_GETFOCUS || rNEvt.GetType()==EVENT_MOUSEBUTTONDOWN)
      52             :     {
      53           0 :         aActivateLink.Call(this);
      54             :     }
      55             : 
      56           0 :     return Control::PreNotify(rNEvt);
      57             : }
      58             : 
      59             : //-----------------------------------------------------------------------------
      60           0 : void SvxClickInfoCtr::SetText( const XubString& rStr )
      61             : {
      62           0 :     aFixedInfo.SetText(rStr );
      63           0 : }
      64             : 
      65             : //-----------------------------------------------------------------------------
      66           0 : XubString SvxClickInfoCtr::GetText() const
      67             : {
      68           0 :     return aFixedInfo.GetText();
      69             : }
      70             : 
      71             : //-----------------------------------------------------------------------------
      72           0 : SvxClickInfoCtr::~SvxClickInfoCtr()
      73             : {
      74           0 : }
      75             : 
      76             : //=============================================================================
      77             : // SvxCommonLinguisticControl
      78             : //=============================================================================
      79             : //-----------------------------------------------------------------------------
      80           0 : SvxCommonLinguisticControl::SvxCommonLinguisticControl( ModalDialog* _pParent )
      81           0 :     :Window( _pParent, CUI_RES( RID_SVX_WND_COMMON_LINGU ) )
      82           0 :     ,aWordText      ( this, CUI_RES( FT_WORD ) )
      83           0 :     ,aAktWord       ( this, CUI_RES( FT_AKTWORD ) )
      84           0 :     ,aNewWord       ( this, CUI_RES( FT_NEWWORD ) )
      85           0 :     ,aNewWordED     ( this, CUI_RES( ED_NEWWORD ) )
      86           0 :     ,aSuggestionFT  ( this, CUI_RES( FT_SUGGESTION ) )
      87           0 :     ,aIgnoreBtn     ( this, CUI_RES( BTN_IGNORE ) )
      88           0 :     ,aIgnoreAllBtn  ( this, CUI_RES( BTN_IGNOREALL ) )
      89           0 :     ,aChangeBtn     ( this, CUI_RES( BTN_CHANGE ) )
      90           0 :     ,aChangeAllBtn  ( this, CUI_RES( BTN_CHANGEALL ) )
      91           0 :     ,aOptionsBtn    ( this, CUI_RES( BTN_OPTIONS ) )
      92           0 :     ,aStatusText    ( this, CUI_RES( FT_STATUS ) )
      93           0 :     ,aHelpBtn       ( this, CUI_RES( BTN_SPL_HELP ) )
      94           0 :     ,aCancelBtn     ( this, CUI_RES( BTN_SPL_CANCEL ) )
      95           0 :     ,aAuditBox      ( this, CUI_RES( GB_AUDIT ) )
      96             : {
      97           0 :     FreeResource();
      98           0 :     aAktWord.SetAccessibleName(aWordText.GetText());
      99           0 :     SetPosSizePixel( Point( 0, 0 ), _pParent->GetOutputSizePixel() );
     100           0 :     Show();
     101           0 : }
     102             : 
     103             : // -----------------------------------------------------------------------
     104           0 : PushButton* SvxCommonLinguisticControl::implGetButton( ButtonType _eType  ) const
     105             : {
     106           0 :     const PushButton* pButton = NULL;
     107           0 :     switch ( _eType )
     108             :     {
     109           0 :         case eClose: pButton = &aCancelBtn; break;
     110           0 :         case eIgnore: pButton = &aIgnoreBtn; break;
     111           0 :         case eIgnoreAll: pButton = &aIgnoreAllBtn; break;
     112           0 :         case eChange: pButton = &aChangeBtn; break;
     113           0 :         case eChangeAll: pButton = &aChangeAllBtn; break;
     114           0 :         case eOptions: pButton = &aOptionsBtn; break;
     115             :     }
     116           0 :     return const_cast< PushButton* >( pButton );
     117             : }
     118             : 
     119             : // -----------------------------------------------------------------------
     120           0 : void SvxCommonLinguisticControl::SetButtonHandler( ButtonType _eType, const Link& _rHandler )
     121             : {
     122           0 :     Button* pButton = GetButton( _eType );
     123           0 :     if ( pButton )
     124           0 :         pButton->SetClickHdl( _rHandler );
     125           0 : }
     126             : 
     127             : // -----------------------------------------------------------------------
     128           0 : void SvxCommonLinguisticControl::EnableButton( ButtonType _eType, sal_Bool _bEnable )
     129             : {
     130           0 :     Button* pButton = GetButton( _eType );
     131           0 :     if ( pButton )
     132           0 :         pButton->Enable( _bEnable );
     133           0 : }
     134             : 
     135             : // -----------------------------------------------------------------------
     136           0 : void SvxCommonLinguisticControl::InsertControlGroup( Window& _rFirstGroupWindow, Window& _rLastGroupWindow, ControlGroup _eInsertAfter )
     137             : {
     138           0 :     Window* pInsertAfter = NULL;    // will be the last window of our own "undividable" group, after which we insert the foreign group
     139           0 :     switch ( _eInsertAfter )
     140             :     {
     141           0 :         case eLeftRightWords    : pInsertAfter = &aNewWordED; break;
     142           0 :         case eSuggestionLabel   : pInsertAfter = &aSuggestionFT; break;
     143           0 :         case eActionButtons     : pInsertAfter = &aChangeAllBtn; break;
     144           0 :         case eDialogButtons     : pInsertAfter = &aCancelBtn; break;
     145             :     }
     146             : 
     147             :     // now loop through the remaining windows of the foreign group
     148           0 :     Window* pInsertBehind = pInsertAfter;
     149           0 :     Window* pInsert = &_rFirstGroupWindow;
     150             : 
     151             :     // some strange thing below: asking a window for WINDOW_NEXT or WINDOW_PREV does not take into
     152             :     // account the border window, _but_ SetZOrder _does_!. Thus, when advancing through a chain
     153             :     // of windows, we need to work with the border windows (WINDOW_BORDER), instead of simply
     154             :     // asking for WINDOW_NEXT.
     155             : 
     156           0 :     Window* pLoopEnd = _rLastGroupWindow.GetWindow( WINDOW_BORDER );
     157           0 :     while ( pInsert && ( pInsertBehind != pLoopEnd ) )
     158             :     {
     159             :         // we'll destroy the NEXT relation immediately, so remember the next window
     160             :         DBG_ASSERT( pInsert->GetWindow( WINDOW_BORDER ), "SvxCommonLinguisticControl::InsertControlGroup: border window is expected to be non NULL!" );
     161           0 :         Window* pNextInsert = pInsert->GetWindow( WINDOW_BORDER )->GetWindow( WINDOW_NEXT );
     162             :         // knit
     163           0 :         pInsert->SetZOrder( pInsertBehind, WINDOW_ZORDER_BEHIND );
     164             :         // advance
     165           0 :         pInsertBehind = pInsert;
     166           0 :         pInsert = pNextInsert;
     167             :     }
     168             :     DBG_ASSERT( pInsertBehind == pLoopEnd, "SvxCommonLinguisticControl::InsertControlGroup: controls do not form a group!" );
     169             :         // if we did not reach pLoopEnd, then we did not reach _rLastGroupWindow in the loop, then
     170             :         // (FirstWindow, LastWindow) was no valid control group
     171           0 : }
     172             : 
     173             : //-----------------------------------------------------------------------------
     174           0 : void SvxCommonLinguisticControl::Paint( const Rectangle& rRect )
     175             : {
     176           0 :     Window::Paint(rRect );
     177             : 
     178           0 :     DecorationView aDecoView( this );
     179             : 
     180           0 :     Rectangle aRect( aAuditBox.GetPosPixel(), aAuditBox.GetSizePixel() );
     181           0 :     aDecoView.DrawButton( aRect, BUTTON_DRAW_NOFILL );
     182           0 : }
     183             : 
     184             : //-----------------------------------------------------------------------------
     185           0 : void SvxCommonLinguisticControl::Enlarge( sal_Int32 _nX, sal_Int32 _nY )
     186             : {
     187           0 :     Size aSize;
     188           0 :     Point aPos;
     189             : 
     190             :     // the controls which need to be resized
     191             :     {
     192             :         Window* pResize[] =
     193             :         {
     194             :             this, &aAuditBox, &aStatusText
     195           0 :         };
     196           0 :         for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pResize ); ++i )
     197             :         {
     198           0 :             aSize = pResize[i]->GetSizePixel( );
     199           0 :             pResize[i]->SetSizePixel( Size( aSize.Width() + _nX, aSize.Height() + _nY ) );
     200             :         }
     201             :     }
     202             : 
     203             :     // the controls which stick to the bottom of the window
     204             :     {
     205             :         Window* pMoveDown[] =
     206             :         {
     207             :             &aStatusText, &aHelpBtn, &aCancelBtn
     208           0 :         };
     209           0 :         for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveDown ); ++i )
     210             :         {
     211           0 :             aPos = pMoveDown[i]->GetPosPixel();
     212           0 :             aPos.Y() += _nY;
     213           0 :             pMoveDown[i]->SetPosPixel( aPos );
     214             :         }
     215             :     }
     216             : 
     217             :     // the controls which stick to the right
     218             :     {
     219             :         Window* pMoveRight[] =
     220             :         {
     221             :             &aIgnoreBtn, &aIgnoreAllBtn, &aChangeBtn, &aChangeAllBtn, &aOptionsBtn, &aHelpBtn, &aCancelBtn
     222           0 :         };
     223           0 :         for ( sal_uInt32 i = 0; i < SAL_N_ELEMENTS( pMoveRight ); ++i )
     224             :         {
     225           0 :             aPos = pMoveRight[i]->GetPosPixel();
     226           0 :             aPos.X() += _nX;
     227           0 :             pMoveRight[i]->SetPosPixel( aPos );
     228             :         }
     229             :     }
     230           0 : }
     231             : 
     232             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10