Update ooo320-m1
[ooovba.git] / padmin / source / fontentry.hxx
blob55dfa5ca3240293411a45f57f5ec5a1b1542a5d6
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fontentry.hxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _PAD_FONTENTRY_HXX_
32 #define _PAD_FONTENTRY_HXX_
34 #include "progress.hxx"
35 #include "helper.hxx"
37 #include "vcl/timer.hxx"
38 #include "vcl/dialog.hxx"
39 #include "vcl/button.hxx"
40 #include "vcl/combobox.hxx"
41 #include "vcl/lstbox.hxx"
42 #include "vcl/group.hxx"
43 #include "vcl/fontmanager.hxx"
45 #include "tools/urlobj.hxx"
47 namespace padmin {
49 class FontImportDialog :
50 public ModalDialog,
51 public ::psp::PrintFontManager::ImportFontCallback
53 OKButton m_aOKBtn;
54 CancelButton m_aCancelBtn;
55 PushButton m_aSelectAllBtn;
56 ListBox m_aNewFontsBox;
57 FixedLine m_aFromFL;
58 Edit m_aFromDirEdt;
59 PushButton m_aFromBtn;
60 CheckBox m_aSubDirsBox;
61 FixedLine m_aTargetOptFL;
62 CheckBox m_aLinkOnlyBox;
63 FixedText m_aFixedText;
64 bool m_bOverwriteAll;
65 bool m_bOverwriteNone;
66 ProgressDialog* m_pProgress;
67 int m_nFont;
69 String m_aImportOperation;
70 String m_aOverwriteQueryText;
71 String m_aOverwriteAllText;
72 String m_aOverwriteNoneText;
73 String m_aNoAfmText;
74 String m_aAfmCopyFailedText;
75 String m_aFontCopyFailedText;
76 String m_aNoWritableFontsDirText;
77 String m_aFontsImportedText;
79 ::std::hash_map< ::rtl::OString, ::std::list< ::psp::FastPrintFontInfo >, ::rtl::OStringHash >
80 m_aNewFonts;
82 Timer m_aRefreshTimer;
83 DECL_LINK( RefreshTimeoutHdl, void* );
86 ::psp::PrintFontManager& m_rFontManager;
88 DECL_LINK( ClickBtnHdl, Button* );
89 DECL_LINK( ModifyHdl, Edit* );
90 DECL_LINK( ToggleHdl, CheckBox* );
92 // implement ImportFontCallback
93 virtual void importFontsFailed( ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason );
94 virtual void progress( const ::rtl::OUString& rFile );
95 virtual bool queryOverwriteFile( const ::rtl::OUString& rFile );
96 virtual void importFontFailed( const ::rtl::OUString& rFile, ::psp::PrintFontManager::ImportFontCallback::FailCondition eReason );
97 virtual bool isCanceled();
99 void copyFonts();
100 void fillFontBox();
101 public:
102 FontImportDialog( Window* );
103 ~FontImportDialog();
106 class FontNameDlg : public ModalDialog
108 private:
109 OKButton m_aOKButton;
110 PushButton m_aRenameButton;
111 PushButton m_aRemoveButton;
112 PushButton m_aImportButton;
114 DelListBox m_aFontBox;
115 FixedText m_aFixedText;
117 String m_aRenameString;
118 String m_aRenameTTCString;
119 String m_aNoRenameString;
121 ::psp::PrintFontManager& m_rFontManager;
123 // maps fontID to XLFD
124 ::std::hash_map< ::psp::fontID, String >
125 m_aFonts;
126 void init();
127 public:
128 FontNameDlg( Window* );
129 ~FontNameDlg();
131 DECL_LINK( ClickBtnHdl, Button* );
132 DECL_LINK( DelPressedHdl, ListBox* );
133 DECL_LINK( SelectHdl, ListBox* );
135 static String fillFontEntry( ::psp::FastPrintFontInfo& rInfo, const String& rFile, bool bAddRegular );
136 static String fillFontEntry( const ::std::list< ::psp::FastPrintFontInfo >& rInfos, const String& rFile );
138 } // namespace
140 #endif