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