summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2001-06-26 18:27:24 +0000
committerPhilipp Lohmann <pl@openoffice.org>2001-06-26 18:27:24 +0000
commitfe958007bf53d284f173201a7f6f0c987c7c1256 (patch)
treebe327406d7bb8667b7dac696a813fa29a1895174
parent#85520# cache ttc files in fonts.dir also (diff)
downloadcore-fe958007bf53d284f173201a7f6f0c987c7c1256.tar.gz
core-fe958007bf53d284f173201a7f6f0c987c7c1256.zip
#85520# add: rename fonts
-rw-r--r--padmin/source/fontentry.cxx59
-rw-r--r--padmin/source/fontentry.hxx7
-rw-r--r--padmin/source/helper.cxx25
-rw-r--r--padmin/source/helper.hxx11
-rw-r--r--padmin/source/padialog.hrc18
-rw-r--r--padmin/source/padialog.src28
6 files changed, 127 insertions, 21 deletions
diff --git a/padmin/source/fontentry.cxx b/padmin/source/fontentry.cxx
index ca6978bcdb7c..1ad22c4e5594 100644
--- a/padmin/source/fontentry.cxx
+++ b/padmin/source/fontentry.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fontentry.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: pl $ $Date: 2001-06-15 15:30:08 $
+ * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,9 @@
#ifndef _CONFIG_HXX_
#include <tools/config.hxx>
#endif
+#ifndef _PSPRINT_STRHELPER_HXX_
+#include <psprint/strhelper.hxx>
+#endif
#if 0
#include <convafm.hxx>
@@ -189,8 +192,11 @@ FontNameDlg::FontNameDlg( Window *pParent ) :
m_aFixedText( this, PaResId( RID_FNTNM_FIXED ) ),
m_aOKButton( this, PaResId( RID_FNTNM_BTN_OK ) ),
m_aRemoveButton( this, PaResId( RID_FNTNM_BTN_REMOVE ) ),
+ m_aRenameButton( this, PaResId( RID_FNTNM_BTN_RENAME ) ),
m_aFontBox( this, PaResId( RID_FNTNM_LB_FONTS ) ),
m_aImportButton( this, PaResId( RID_FNTNM_BTN_IMPORT ) ),
+ m_aRenameString( PaResId( RID_FNTNM_STR_RENAME ) ),
+ m_aRenameTTCString( PaResId( RID_FNTNM_STR_TTCRENAME ) ),
m_rFontManager( PrintFontManager::get() )
{
FreeResource();
@@ -198,6 +204,7 @@ FontNameDlg::FontNameDlg( Window *pParent ) :
m_aFontBox.EnableMultiSelection( TRUE );
m_aOKButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
+ m_aRenameButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
m_aRemoveButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
m_aImportButton.SetClickHdl( LINK( this, FontNameDlg, ClickBtnHdl ) );
m_aFontBox.setDelPressedLink( LINK( this, FontNameDlg, DelPressedHdl ) );
@@ -389,6 +396,53 @@ IMPL_LINK( FontNameDlg, ClickBtnHdl, Button*, pButton )
aDialog.Execute();
init();
}
+ else if( pButton == &m_aRenameButton )
+ {
+ for( i = 0; i < m_aFontBox.GetSelectEntryCount(); i++ )
+ {
+ fontID aFont = (fontID)m_aFontBox.GetEntryData( m_aFontBox.GetSelectEntryPos( i ) );
+ ::std::list< fontID > aDuplicates;
+ m_rFontManager.getFileDuplicates( aFont, aDuplicates );
+ aDuplicates.push_front( aFont );
+ int nFonts = aDuplicates.size();
+ for( int n = 0; n < nFonts; n++ )
+ {
+ aFont = aDuplicates.front();
+ aDuplicates.pop_front();
+ String aFamily( m_rFontManager.getFontFamily( aFont ) );
+ ::std::list< OUString > aAlternatives;
+ m_rFontManager.getAlternativeFamilyNames( aFont, aAlternatives );
+ ::std::list< String > aChoices;
+ while( aAlternatives.size() )
+ {
+ aChoices.push_back( aAlternatives.front() );
+ aAlternatives.pop_front();
+ }
+ String aQueryTxt( m_aRenameString );
+ if( nFonts > 1 )
+ {
+ aQueryTxt = m_aRenameTTCString;
+ aQueryTxt.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%d1" ) ), String::CreateFromInt32( n+1 ) );
+ aQueryTxt.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "%d2" ) ), String::CreateFromInt32( nFonts ) );
+ }
+ QueryString aQuery( this, aQueryTxt, aFamily, aChoices );
+ if( aQuery.Execute() )
+ {
+ aFamily.SearchAndReplaceAll( '-', ' ' );
+ aFamily.SearchAndReplaceAll( '?', ' ' );
+ aFamily.SearchAndReplaceAll( '*', ' ' );
+ aFamily = WhitespaceToSpace( aFamily );
+ if( aFamily.Len() )
+ {
+ String aXLFD = m_rFontManager.getFontXLFD( aFont );
+ aXLFD.SetToken( 2, '-', aFamily );
+ m_rFontManager.changeFontProperties( aFont, aXLFD );
+ }
+ }
+ }
+ }
+ init();
+ }
return 0;
}
@@ -608,6 +662,7 @@ IMPL_LINK( FontImportDialog, ClickBtnHdl, Button*, pButton )
if( pButton == &m_aFromBtn )
{
PathDialog aDlg( this );
+ aDlg.SetPath( m_aFromDirEdt.GetText() );
if( aDlg.Execute() )
{
m_aFromDirEdt.SetText( aDlg.GetPath() );
diff --git a/padmin/source/fontentry.hxx b/padmin/source/fontentry.hxx
index 7866b59ae634..fbea21c7bf1c 100644
--- a/padmin/source/fontentry.hxx
+++ b/padmin/source/fontentry.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: fontentry.hxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: pl $ $Date: 2001-06-15 15:30:08 $
+ * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -156,12 +156,15 @@ namespace padmin {
{
private:
OKButton m_aOKButton;
+ PushButton m_aRenameButton;
PushButton m_aRemoveButton;
PushButton m_aImportButton;
DelListBox m_aFontBox;
FixedText m_aFixedText;
+ String m_aRenameString;
+ String m_aRenameTTCString;
::psp::PrintFontManager& m_rFontManager;
// maps fontID to XLFD
diff --git a/padmin/source/helper.cxx b/padmin/source/helper.cxx
index 794ea27a588e..a9c3f56c8989 100644
--- a/padmin/source/helper.cxx
+++ b/padmin/source/helper.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: helper.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: pl $ $Date: 2001-06-19 13:47:44 $
+ * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -194,17 +194,32 @@ long DelListBox::Notify( NotifyEvent& rEvent )
* QueryString
*/
-QueryString::QueryString( Window* pParent, String& rQuery, String& rRet ) :
+QueryString::QueryString( Window* pParent, String& rQuery, String& rRet, const ::std::list< String >& rChoices ) :
m_rReturnValue( rRet ),
ModalDialog( pParent, PaResId( RID_STRINGQUERYDLG ) ),
m_aOKButton( this, PaResId( RID_STRQRY_BTN_OK ) ),
m_aEdit( this, PaResId( RID_STRQRY_EDT_NEWNAME ) ),
+ m_aComboBox( this, PaResId( RID_STRQRY_BOX_NEWNAME ) ),
m_aFixedText( this, PaResId( RID_STRQRY_TXT_RENAME ) ),
m_aCancelButton( this, PaResId( RID_STRQRY_BTN_CANCEL ) )
{
m_aOKButton.SetClickHdl( LINK( this, QueryString, ClickBtnHdl ) );
m_aFixedText.SetText( rQuery );
- m_aEdit.SetText( m_rReturnValue );
+ if( rChoices.begin() != rChoices.end() )
+ {
+ m_aComboBox.SetText( m_rReturnValue );
+ m_aComboBox.InsertEntry( m_rReturnValue );
+ for( ::std::list<String>::const_iterator it = rChoices.begin(); it != rChoices.end(); ++it )
+ m_aComboBox.InsertEntry( *it );
+ m_aEdit.Show( FALSE );
+ m_bUseEdit = false;
+ }
+ else
+ {
+ m_aEdit.SetText( m_rReturnValue );
+ m_aComboBox.Show( FALSE );
+ m_bUseEdit = true;
+ }
SetText( Application::GetDisplayName() );
FreeResource();
}
@@ -217,7 +232,7 @@ IMPL_LINK( QueryString, ClickBtnHdl, Button*, pButton )
{
if( pButton == &m_aOKButton )
{
- m_rReturnValue = m_aEdit.GetText();
+ m_rReturnValue = m_bUseEdit ? m_aEdit.GetText() : m_aComboBox.GetText();
EndDialog( 1 );
}
else
diff --git a/padmin/source/helper.hxx b/padmin/source/helper.hxx
index 5d45e5b09b31..21b9121d2c73 100644
--- a/padmin/source/helper.hxx
+++ b/padmin/source/helper.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: helper.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pl $ $Date: 2001-06-21 12:59:43 $
+ * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,6 +86,9 @@
#ifndef _SV_LISTBOX_HXX
#include <vcl/lstbox.hxx>
#endif
+#ifndef _SV_COMBOBOX_HXX
+#include <vcl/combobox.hxx>
+#endif
class Config;
@@ -138,13 +141,15 @@ namespace padmin
CancelButton m_aCancelButton;
FixedText m_aFixedText;
Edit m_aEdit;
+ ComboBox m_aComboBox;
String& m_rReturnValue;
+ bool m_bUseEdit;
DECL_LINK( ClickBtnHdl, Button* );
public:
- QueryString( Window*, String &, String & );
+ QueryString( Window*, String &, String &, const ::std::list< String >& rChoices = ::std::list<String>() );
// parent window, Query text, initial value
~QueryString();
};
diff --git a/padmin/source/padialog.hrc b/padmin/source/padialog.hrc
index 20fa913cfdec..abb9a57577c3 100644
--- a/padmin/source/padialog.hrc
+++ b/padmin/source/padialog.hrc
@@ -2,9 +2,9 @@
*
* $RCSfile: padialog.hrc,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: pl $ $Date: 2001-06-19 13:47:44 $
+ * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -91,6 +91,7 @@
#define RID_STRQRY_EDT_NEWNAME 2
#define RID_STRQRY_BTN_OK 3
#define RID_STRQRY_BTN_CANCEL 4
+#define RID_STRQRY_BOX_NEWNAME 5
#define RID_PPDIMPORT_DLG 1004
#define RID_PPDIMP_BTN_OK 1
@@ -129,11 +130,14 @@
#define RID_METDLG_BTN_CORRECT 5
#define RID_FONTNAMEDIALOG 1030
-#define RID_FNTNM_FIXED 1
-#define RID_FNTNM_BTN_OK 2
-#define RID_FNTNM_BTN_REMOVE 3
-#define RID_FNTNM_LB_FONTS 4
-#define RID_FNTNM_BTN_IMPORT 5
+#define RID_FNTNM_FIXED 1
+#define RID_FNTNM_BTN_OK 2
+#define RID_FNTNM_BTN_REMOVE 3
+#define RID_FNTNM_LB_FONTS 4
+#define RID_FNTNM_BTN_IMPORT 5
+#define RID_FNTNM_BTN_RENAME 6
+#define RID_FNTNM_STR_RENAME 7
+#define RID_FNTNM_STR_TTCRENAME 8
#define RID_TXT_REFETCH 1031
diff --git a/padmin/source/padialog.src b/padmin/source/padialog.src
index e2d9303ef6de..81ed175e9a24 100644
--- a/padmin/source/padialog.src
+++ b/padmin/source/padialog.src
@@ -2,9 +2,9 @@
*
* $RCSfile: padialog.src,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: kz $ $Date: 2001-06-22 21:43:31 $
+ * last change: $Author: pl $ $Date: 2001-06-26 19:27:24 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -951,6 +951,13 @@ ModalDialog RID_STRINGQUERYDLG
Pos = MAP_APPFONT ( 6 , 23 ) ;
Size = MAP_APPFONT ( 130 , 12 ) ;
};
+ ComboBox RID_STRQRY_BOX_NEWNAME
+ {
+ Border = TRUE ;
+ DropDown = TRUE;
+ Pos = MAP_APPFONT ( 6 , 23 ) ;
+ Size = MAP_APPFONT ( 130 , 12 ) ;
+ };
OKButton RID_STRQRY_BTN_OK
{
DefButton = TRUE ;
@@ -1236,6 +1243,13 @@ ModalDialog RID_FONTNAMEDIALOG
Text[ finnish ] = "Close";
Text[ catalan ] = "Cerrar";
};
+ PushButton RID_FNTNM_BTN_RENAME
+ {
+ Pos = MAP_APPFONT( 196, 31 );
+ Size = MAP_APPFONT( 50, 12 );
+ Text = "~Umbenennen...";
+ Text [ English ] = "Re~name";
+ };
PushButton RID_FNTNM_BTN_REMOVE
{
Pos = MAP_APPFONT ( 196 , 48 ) ;
@@ -1326,6 +1340,16 @@ ModalDialog RID_FONTNAMEDIALOG
Text[ arabic ] = "íÊÑßÈ ÇÓã ÎØXwindow \n ãä ÇáÎÕÇÆÕ";
Text[ catalan ] = "De las propiedades se construirá el nombre\nXwindow de la fuente.";
};
+ String RID_FNTNM_STR_RENAME
+ {
+ Text = "~Neuer Schriftname";
+ Text [ English ] = "~New font name";
+ };
+ String RID_FNTNM_STR_TTCRENAME
+ {
+ Text = "~Neuer Schriftname (%d1 von %d2)";
+ Text [ English ] = "~New font name (%d1 of %d2)";
+ };
Text[ english_us ] = "Fonts";
Text[ portuguese ] = "Tipos de letra";
Text[ russian ] = "Øðèôòû";