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

Generated by: LCOV version 1.10