xref: /AOO41X/main/padmin/source/fontentry.hxx (revision 23e9c6ca8a88572e85d00ef2448f2333808607a0)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _PAD_FONTENTRY_HXX_
25 #define _PAD_FONTENTRY_HXX_
26 
27 #include "progress.hxx"
28 #include "helper.hxx"
29 
30 #include "vcl/timer.hxx"
31 #include "vcl/dialog.hxx"
32 #include "vcl/button.hxx"
33 #include "vcl/combobox.hxx"
34 #include "vcl/lstbox.hxx"
35 #include "vcl/group.hxx"
36 #include "vcl/fontmanager.hxx"
37 
38 #include "tools/urlobj.hxx"
39 
40 namespace padmin {
41 
42     class FontImportDialog :
43         public ModalDialog,
44         public ::psp::PrintFontManager::ImportFontCallback
45     {
46         OKButton                            m_aOKBtn;
47         CancelButton                        m_aCancelBtn;
48         PushButton                          m_aSelectAllBtn;
49         ListBox                             m_aNewFontsBox;
50         FixedLine                           m_aFromFL;
51         Edit                                m_aFromDirEdt;
52         PushButton                          m_aFromBtn;
53         CheckBox                            m_aSubDirsBox;
54         FixedLine                           m_aTargetOptFL;
55         CheckBox                            m_aLinkOnlyBox;
56         FixedText                           m_aFixedText;
57         bool                                m_bOverwriteAll;
58         bool                                m_bOverwriteNone;
59         ProgressDialog*                     m_pProgress;
60         int                                 m_nFont;
61 
62         String                              m_aImportOperation;
63         String                              m_aOverwriteQueryText;
64         String                              m_aOverwriteAllText;
65         String                              m_aOverwriteNoneText;
66         String                              m_aNoAfmText;
67         String                              m_aAfmCopyFailedText;
68         String                              m_aFontCopyFailedText;
69         String                              m_aNoWritableFontsDirText;
70         String                              m_aFontsImportedText;
71 
72         ::std::hash_map< ::rtl::OString, ::std::list< ::psp::FastPrintFontInfo >, ::rtl::OStringHash >
73                                             m_aNewFonts;
74 
75         Timer                               m_aRefreshTimer;
76         DECL_LINK( RefreshTimeoutHdl, void* );
77 
78 
79         ::psp::PrintFontManager&            m_rFontManager;
80 
81         DECL_LINK( ClickBtnHdl, Button* );
82         DECL_LINK( ModifyHdl, Edit* );
83         DECL_LINK( ToggleHdl, CheckBox* );
84 
85         // implement ImportFontCallback
86         virtual void importFontsFailed( ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason );
87         virtual void progress( const ::rtl::OUString& rFile );
88         virtual bool queryOverwriteFile( const ::rtl::OUString& rFile );
89         virtual void importFontFailed( const ::rtl::OUString& rFile, ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason );
90         virtual bool isCanceled();
91 
92         void copyFonts();
93         void fillFontBox();
94     public:
95         FontImportDialog( Window* );
96         ~FontImportDialog();
97     };
98 
99     class FontNameDlg : public ModalDialog
100     {
101     private:
102         OKButton                    m_aOKButton;
103         PushButton                  m_aRenameButton;
104         PushButton                  m_aRemoveButton;
105         PushButton                  m_aImportButton;
106 
107         DelListBox                  m_aFontBox;
108         FixedText                   m_aFixedText;
109 
110         String                      m_aRenameString;
111         String                      m_aRenameTTCString;
112         String                      m_aNoRenameString;
113 
114         ::psp::PrintFontManager&    m_rFontManager;
115 
116         // maps fontID to XLFD
117         ::std::hash_map< ::psp::fontID, String >
118                                     m_aFonts;
119         void init();
120     public:
121         FontNameDlg( Window* );
122         ~FontNameDlg();
123 
124         DECL_LINK( ClickBtnHdl, Button* );
125         DECL_LINK( DelPressedHdl, ListBox* );
126         DECL_LINK( SelectHdl, ListBox* );
127 
128         static String fillFontEntry( ::psp::FastPrintFontInfo& rInfo, const String& rFile, bool bAddRegular );
129         static String fillFontEntry( const ::std::list< ::psp::FastPrintFontInfo >& rInfos, const String& rFile );
130     };
131 } // namespace
132 
133 #endif
134