LCOV - code coverage report
Current view: top level - svx/source/unodialogs/textconversiondlgs - chinese_dictionarydialog.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 2 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             : #ifndef INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDIALOG_HXX
      21             : #define INCLUDED_SVX_SOURCE_UNODIALOGS_TEXTCONVERSIONDLGS_CHINESE_DICTIONARYDIALOG_HXX
      22             : 
      23             : #include <vcl/dialog.hxx>
      24             : // header for class FixedLine
      25             : #include <vcl/fixed.hxx>
      26             : // header for class RadioButton
      27             : #include <vcl/button.hxx>
      28             : // header for class Edit
      29             : #include <vcl/edit.hxx>
      30             : // header for class ListBox
      31             : #include <vcl/lstbox.hxx>
      32             : #include <svtools/simptabl.hxx>
      33             : #include <com/sun/star/uno/XComponentContext.hpp>
      34             : #include <com/sun/star/linguistic2/XConversionDictionary.hpp>
      35             : 
      36             : #include <vector>
      37             : 
      38             : 
      39             : namespace textconversiondlgs
      40             : {
      41             : 
      42             : 
      43             : 
      44             : /**
      45             : */
      46             : 
      47             : struct DictionaryEntry
      48             : {
      49             :     DictionaryEntry( const OUString& rTerm, const OUString& rMapping
      50             :                     , sal_Int16 nConversionPropertyType //linguistic2::ConversionPropertyType
      51             :                     , bool bNewEntry = false );
      52             : 
      53             :     virtual ~DictionaryEntry();
      54             : 
      55             :     bool operator==( const DictionaryEntry& rE ) const;
      56             : 
      57             :     OUString m_aTerm;
      58             :     OUString m_aMapping;
      59             :     sal_Int16     m_nConversionPropertyType; //linguistic2::ConversionPropertyType
      60             : 
      61             :     bool     m_bNewEntry;
      62             : };
      63             : 
      64           0 : class DictionaryList : public SvSimpleTable
      65             : {
      66             : public:
      67             :     DictionaryList(SvSimpleTableContainer& rParent, WinBits nBits);
      68             : 
      69             :     void init(const css::uno::Reference< css::linguistic2::XConversionDictionary>& xDictionary,
      70             :         Window *pED_Term, Window *pED_Mapping, ListBox *pLB_Property,
      71             :         Window *pFT_Term, Window *pFT_Mapping, Window *pFT_Property);
      72             : 
      73             :     void deleteAll();
      74             :     void refillFromDictionary( sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
      75             :     void save();
      76             : 
      77             :     DictionaryEntry* getTermEntry( const OUString& rTerm ) const;
      78             :     bool hasTerm( const OUString& rTerm ) const;
      79             : 
      80             :     void addEntry( const OUString& rTerm, const OUString& rMapping
      81             :             , sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/, sal_uIntPtr nPos = TREELIST_APPEND );
      82             :     sal_uIntPtr deleteEntries( const OUString& rTerm ); //return lowest position of deleted entries or LIST_APPEND if no entry was deleted
      83             :     void deleteEntryOnPos( sal_Int32 nPos  );
      84             :     DictionaryEntry* getEntryOnPos( sal_Int32 nPos ) const;
      85             :     DictionaryEntry* getFirstSelectedEntry() const;
      86             : 
      87             :     void sortByColumn( sal_uInt16 nSortColumnIndex, bool bSortAtoZ );
      88             :     sal_uInt16 getSortColumn() const;
      89             : 
      90             : private:
      91             :     OUString getPropertyTypeName( sal_Int16 nConversionPropertyType /*linguistic2::ConversionPropertyType*/ ) const;
      92             :     OUString makeTabString( const DictionaryEntry& rEntry ) const;
      93             : 
      94             :     DECL_LINK( CompareHdl, SvSortData* );
      95             :     sal_Int32 ColumnCompare( SvTreeListEntry* pLeft, SvTreeListEntry* pRight );
      96             :     SvLBoxItem* getItemAtColumn( SvTreeListEntry* pEntry, sal_uInt16 nColumn ) const;
      97             : 
      98             :     void setColSizes();
      99             : 
     100             :     virtual void Resize() SAL_OVERRIDE;
     101             : 
     102             : public:
     103             :     css::uno::Reference<css::linguistic2::XConversionDictionary>  m_xDictionary;
     104             : 
     105             : private:
     106             :     Window*     m_pED_Term;
     107             :     Window*     m_pED_Mapping;
     108             :     ListBox*    m_pLB_Property;
     109             : 
     110             :     std::vector< DictionaryEntry* > m_aToBeDeleted;
     111             : 
     112             :     sal_uInt16      m_nSortColumnIndex;
     113             : };
     114             : 
     115             : class ChineseDictionaryDialog : public ModalDialog
     116             : {
     117             : public:
     118             :     ChineseDictionaryDialog( Window* pParent );
     119             :     virtual ~ChineseDictionaryDialog();
     120             : 
     121             :     //this method should be called once before calling execute
     122             :     void setDirectionAndTextConversionOptions( bool bDirectionToSimplified, sal_Int32 nTextConversionOptions /*i18n::TextConversionOption*/ );
     123             : 
     124             :     virtual short   Execute() SAL_OVERRIDE;
     125             : 
     126             : private:
     127             :     DECL_LINK( DirectionHdl, void* );
     128             :     DECL_LINK(EditFieldsHdl, void *);
     129             :     DECL_LINK( MappingSelectHdl, void* );
     130             :     DECL_LINK( AddHdl, void* );
     131             :     DECL_LINK( ModifyHdl, void* );
     132             :     DECL_LINK( DeleteHdl, void* );
     133             :     DECL_LINK( HeaderBarClick, HeaderBar* );
     134             : 
     135             :     void initDictionaryControl(DictionaryList *pList,
     136             :         const css::uno::Reference< css::linguistic2::XConversionDictionary>& xDictionary);
     137             : 
     138             :     void updateAfterDirectionChange();
     139             :     void updateButtons();
     140             : 
     141             :     bool isEditFieldsHaveContent() const;
     142             :     bool isEditFieldsContentEqualsSelectedListContent() const;
     143             : 
     144             :     DictionaryList& getActiveDictionary();
     145             :     DictionaryList& getReverseDictionary();
     146             : 
     147             :     const DictionaryList& getActiveDictionary() const;
     148             :     const DictionaryList& getReverseDictionary() const;
     149             : 
     150             : private:
     151             :     sal_Int32    m_nTextConversionOptions; //i18n::TextConversionOption
     152             : 
     153             :     RadioButton* m_pRB_To_Simplified;
     154             :     RadioButton* m_pRB_To_Traditional;
     155             : 
     156             :     CheckBox*    m_pCB_Reverse;
     157             : 
     158             :     FixedText*   m_pFT_Term;
     159             :     Edit*        m_pED_Term;
     160             : 
     161             :     FixedText*   m_pFT_Mapping;
     162             :     Edit*        m_pED_Mapping;
     163             : 
     164             :     FixedText*   m_pFT_Property;
     165             :     ListBox*     m_pLB_Property;
     166             : 
     167             :     SvSimpleTableContainer* mpToSimplifiedContainer;
     168             :     DictionaryList* m_pCT_DictionaryToSimplified;
     169             :     SvSimpleTableContainer* mpToTraditionalContainer;
     170             :     DictionaryList* m_pCT_DictionaryToTraditional;
     171             : 
     172             :     PushButton*  m_pPB_Add;
     173             :     PushButton*  m_pPB_Modify;
     174             :     PushButton*  m_pPB_Delete;
     175             : 
     176             :     css::uno::Reference<css::uno::XComponentContext> m_xContext;
     177             : };
     178             : 
     179             : 
     180             : } //end namespace
     181             : 
     182             : #endif
     183             : 
     184             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10