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 #pragma once
20 
21 #include <sfx2/tabdlg.hxx>
22 #include <svx/langbox.hxx>
23 #include <com/sun/star/uno/Reference.hxx>
24 #include <com/sun/star/uno/Sequence.hxx>
25 
26 namespace com::sun::star{
27     namespace beans{
28         class XPropertySet;
29     }
30     namespace linguistic2{
31         class XDictionary;
32         class XDictionaryList;
33         class XLinguProperties;
34     }
35 }
36 
37 class SvxLinguData_Impl;
38 
39 // define ----------------------------------------------------------------
40 
41 #define GROUP_MODULES   (sal_uInt16(0x0008))
42 
43 // forward ---------------------------------------------------------------
44 
45 class SvxEditModulesDlg : public weld::GenericDialogController
46 {
47     OUString            sSpell;
48     OUString            sHyph;
49     OUString            sThes;
50     OUString            sGrammar;
51 
52     std::unique_ptr<SvxLinguData_Impl>  pDefaultLinguData;
53     SvxLinguData_Impl&  rLinguData;
54 
55     std::unique_ptr<weld::TreeView> m_xModulesCLB;
56     std::unique_ptr<weld::Button> m_xPrioUpPB;
57     std::unique_ptr<weld::Button> m_xPrioDownPB;
58     std::unique_ptr<weld::Button> m_xBackPB;
59     std::unique_ptr<weld::LinkButton> m_xMoreDictsLink;
60     std::unique_ptr<weld::Button> m_xClosePB;
61     std::unique_ptr<SvxLanguageBox> m_xLanguageLB;
62 
63     DECL_LINK( SelectHdl_Impl, weld::TreeView&, void );
64     DECL_LINK( UpDownHdl_Impl, weld::Button&, void );
65     DECL_LINK( ClickHdl_Impl, weld::Button&, void );
66     DECL_LINK( BackHdl_Impl, weld::Button&, void );
67     DECL_LINK( LangSelectListBoxHdl_Impl, weld::ComboBox&, void );
68     DECL_LINK( BoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
69     DECL_STATIC_LINK( SvxEditModulesDlg, OnLinkClick, weld::LinkButton&, bool);
70     void LangSelectHdl_Impl(const SvxLanguageBox* pBox);
71 
72 public:
73     SvxEditModulesDlg(weld::Window* pParent, SvxLinguData_Impl& rData);
74     virtual ~SvxEditModulesDlg() override;
75 };
76 
77 struct ImplSVEvent;
78 
79 // class SvxLinguTabPage -------------------------------------------------
80 class SvxLinguTabPage : public SfxTabPage
81 {
82 private:
83     OUString            sCapitalWords;
84     OUString            sWordsWithDigits;
85     OUString            sSpellSpecial;
86     OUString            sSpellAuto;
87     OUString            sGrammarAuto;
88     OUString            sNumMinWordlen;
89     OUString            sNumPreBreak;
90     OUString            sNumPostBreak;
91     OUString            sHyphAuto;
92     OUString            sHyphSpecial;
93 
94     int nUPN_HYPH_MIN_WORD_LENGTH;
95     int nUPN_HYPH_MIN_LEADING;
96     int nUPN_HYPH_MIN_TRAILING;
97 
98     ImplSVEvent* m_nDlbClickEventId;
99 
100     css::uno::Reference<
101         css::linguistic2::XLinguProperties >     xProp;
102 
103     css::uno::Reference<
104         css::linguistic2::XDictionaryList >      xDicList;
105     css::uno::Sequence<
106         css::uno::Reference<
107             css::linguistic2::XDictionary > >    aDics;
108 
109     std::unique_ptr<SvxLinguData_Impl>  pLinguData;
110 
111     std::unique_ptr<weld::Label> m_xLinguModulesFT;
112     std::unique_ptr<weld::TreeView> m_xLinguModulesCLB;
113     std::unique_ptr<weld::Button> m_xLinguModulesEditPB;
114     std::unique_ptr<weld::Label> m_xLinguDicsFT;
115     std::unique_ptr<weld::TreeView> m_xLinguDicsCLB;
116     std::unique_ptr<weld::Button> m_xLinguDicsNewPB;
117     std::unique_ptr<weld::Button> m_xLinguDicsEditPB;
118     std::unique_ptr<weld::Button> m_xLinguDicsDelPB;
119     std::unique_ptr<weld::TreeView> m_xLinguOptionsCLB;
120     std::unique_ptr<weld::Button> m_xLinguOptionsEditPB;
121     std::unique_ptr<weld::LinkButton> m_xMoreDictsLink;
122 
123     void    AddDicBoxEntry( const css::uno::Reference< css::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx );
124     static sal_uInt32 GetDicUserData( const css::uno::Reference< css::linguistic2::XDictionary > &rxDic, sal_uInt16 nIdx );
125 
126     DECL_LINK( SelectHdl_Impl, weld::TreeView&, void );
127     DECL_LINK( ClickHdl_Impl, weld::Button&, void );
128     DECL_LINK( BoxDoubleClickHdl_Impl, weld::TreeView&, bool );
129     DECL_LINK( ModulesBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
130     DECL_LINK( DicsBoxCheckButtonHdl_Impl, const weld::TreeView::iter_col&, void );
131     DECL_LINK( PostDblClickHdl_Impl, void *, void);
132     DECL_STATIC_LINK( SvxLinguTabPage, OnLinkClick, weld::LinkButton&, bool);
133 
134     void                UpdateModulesBox_Impl();
135     void                UpdateDicBox_Impl();
136 
137 public:
138     SvxLinguTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rCoreSet);
139     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
140     virtual ~SvxLinguTabPage() override;
141 
142     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
143     virtual void        Reset( const SfxItemSet* rSet ) override;
144 
145     void                HideGroups( sal_uInt16 nGrp );
146 };
147 
148 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
149