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

Generated by: LCOV version 1.10