LCOV - code coverage report
Current view: top level - cui/source/inc - thesdlg.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 10 0.0 %
Date: 2014-04-14 Functions: 0 9 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             : #ifndef INCLUDED_CUI_SOURCE_INC_THESDLG_HXX
      20             : #define INCLUDED_CUI_SOURCE_INC_THESDLG_HXX
      21             : 
      22             : #include <com/sun/star/linguistic2/XThesaurus.hpp>
      23             : 
      24             : #include <svx/checklbx.hxx>
      25             : #include <vcl/button.hxx>
      26             : #include <vcl/combobox.hxx>
      27             : #include <vcl/lstbox.hxx>
      28             : #include <svx/stddlg.hxx>
      29             : 
      30             : #include <memory>
      31             : 
      32             : class SvxThesaurusDialog;
      33             : 
      34             : class LookUpComboBox : public ComboBox
      35             : {
      36             :     Timer                       m_aModifyTimer;
      37             :     Selection                   m_aSelection;
      38             :     SvxThesaurusDialog*         m_pDialog;
      39             : 
      40             :     /// disable copy ctor and assignment operator
      41             :     LookUpComboBox( const LookUpComboBox & );
      42             :     LookUpComboBox& operator = ( const LookUpComboBox & );
      43             : 
      44             : public:
      45             :     LookUpComboBox(Window *pParent);
      46             :     virtual ~LookUpComboBox();
      47             : 
      48             :     DECL_LINK( ModifyTimer_Hdl, Timer * );
      49             : 
      50             :     void init(SvxThesaurusDialog *pDialog);
      51             : 
      52             :     // ComboBox
      53             :     virtual void        Modify() SAL_OVERRIDE;
      54             : };
      55             : 
      56           0 : class AlternativesExtraData
      57             : {
      58             :     OUString  sText;
      59             :     bool      bHeader;
      60             : 
      61             : public:
      62           0 :     AlternativesExtraData() : bHeader( false ) {}
      63           0 :     AlternativesExtraData( const OUString &rText, bool bIsHeader ) :
      64             :         sText(rText),
      65           0 :         bHeader(bIsHeader)
      66             :         {
      67           0 :         }
      68             : 
      69           0 :     bool  IsHeader() const          { return bHeader; }
      70           0 :     const OUString& GetText() const   { return sText; }
      71             : };
      72             : 
      73             : class ThesaurusAlternativesCtrl
      74             :     : public SvxCheckListBox
      75             : {
      76             :     SvxThesaurusDialog*     m_pDialog;
      77             : 
      78             :     typedef std::map< const SvTreeListEntry *, AlternativesExtraData >  UserDataMap_t;
      79             :     UserDataMap_t           m_aUserData;
      80             : 
      81             :     /// disable copy ctor and assignment operator
      82             :     ThesaurusAlternativesCtrl( const ThesaurusAlternativesCtrl & );
      83             :     ThesaurusAlternativesCtrl & operator = ( const ThesaurusAlternativesCtrl & );
      84             : 
      85             : public:
      86             :     ThesaurusAlternativesCtrl(Window* pParent);
      87             : 
      88             :     void init(SvxThesaurusDialog *pDialog);
      89             :     virtual ~ThesaurusAlternativesCtrl();
      90             : 
      91             : 
      92             :     SvTreeListEntry *   AddEntry( sal_Int32 nVal, const OUString &rText, bool bIsHeader );
      93             : 
      94             :     void            ClearExtraData();
      95             :     void            SetExtraData( const SvTreeListEntry *pEntry, const AlternativesExtraData &rData );
      96             :     AlternativesExtraData * GetExtraData( const SvTreeListEntry *pEntry );
      97             : 
      98             :     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
      99             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     100             : };
     101             : 
     102             : class ReplaceEdit : public Edit
     103             : {
     104             :     Button *                    m_pBtn;
     105             : 
     106             :     /// disable copy ctor and assignment operator
     107             :     ReplaceEdit( const ReplaceEdit & );
     108             :     ReplaceEdit & operator = ( const ReplaceEdit & );
     109             : 
     110             : public:
     111             :     ReplaceEdit(Window *pParent);
     112             :     virtual ~ReplaceEdit();
     113             : 
     114           0 :     void init(Button *pBtn)  { m_pBtn = pBtn; }
     115             : 
     116             :     // Edit
     117             :     virtual void        Modify() SAL_OVERRIDE;
     118             :     virtual void        SetText( const OUString& rStr ) SAL_OVERRIDE;
     119             :     virtual void        SetText( const OUString& rStr, const Selection& rNewSelection ) SAL_OVERRIDE;
     120             : };
     121             : 
     122             : class SvxThesaurusDialog : public SvxStandardDialog
     123             : {
     124             :     PushButton*             m_pLeftBtn;
     125             :     LookUpComboBox*         m_pWordCB;
     126             :     ThesaurusAlternativesCtrl* m_pAlternativesCT;
     127             :     ReplaceEdit*            m_pReplaceEdit;
     128             :     ListBox*                m_pLangLB;
     129             : 
     130             :     OUString                m_aErrStr;
     131             : 
     132             :     css::uno::Reference< css::linguistic2::XThesaurus >   xThesaurus;
     133             :     OUString                aLookUpText;
     134             :     LanguageType            nLookUpLanguage;
     135             :     std::stack< OUString >  aLookUpHistory;
     136             :     bool                    m_bWordFound;
     137             : 
     138             : public:
     139           0 :     bool                    WordFound() const { return m_bWordFound; }
     140           0 :     OUString                getErrStr() const { return m_aErrStr; }
     141             : 
     142             :     // Handler
     143             :     DECL_LINK( ReplaceBtnHdl_Impl, Button * );
     144             :     DECL_LINK( LeftBtnHdl_Impl, Button * );
     145             :     DECL_LINK( LanguageHdl_Impl, ListBox * );
     146             :     DECL_LINK( LookUpHdl_Impl, Button * );
     147             :     DECL_LINK( WordSelectHdl_Impl, ComboBox * );
     148             :     DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * );
     149             :     DECL_LINK( AlternativesDoubleClickHdl_Impl, SvxCheckListBox * );
     150             : 
     151             :     DECL_STATIC_LINK( SvxThesaurusDialog, SelectFirstHdl_Impl, SvxCheckListBox * );
     152             : 
     153             :     css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > >
     154             :             queryMeanings_Impl( OUString& rTerm, const css::lang::Locale& rLocale, const css::beans::PropertyValues& rProperties ) throw(css::lang::IllegalArgumentException, css::uno::RuntimeException);
     155             : 
     156             :     bool    UpdateAlternativesBox_Impl();
     157             :     void    LookUp( const OUString &rText );
     158             :     void    LookUp_Impl();
     159             :     virtual void     Apply() SAL_OVERRIDE;
     160             : 
     161             : public:
     162             :     SvxThesaurusDialog( Window* pParent,
     163             :                         css::uno::Reference< css::linguistic2::XThesaurus >  xThesaurus,
     164             :                         const OUString &rWord, LanguageType nLanguage );
     165             :     virtual ~SvxThesaurusDialog();
     166             : 
     167             :     void            SetWindowTitle( LanguageType nLanguage );
     168             :     OUString        GetWord();
     169             :     sal_uInt16      GetLanguage() const;
     170             : };
     171             : 
     172             : #endif
     173             : 
     174             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10