[Libreoffice-commits] core.git: 2 commits - svx/source sw/source

Luboš Luňák l.lunak at suse.cz
Thu Feb 14 08:24:37 PST 2013


 svx/source/tbxctrls/tbcontrl.cxx             |   32 +++++++++++----------------
 sw/source/filter/ww8/docxattributeoutput.cxx |    4 +--
 2 files changed, 16 insertions(+), 20 deletions(-)

New commits:
commit a12286cf81b2483e1585b2c45c40fa507fdd3136
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Thu Feb 14 17:12:54 2013 +0100

    more reliable detecting of changes in the combobox lineedit
    
    Change-Id: I3563a961c54e235fffe0c2ab1809f51882ba3831

diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 89d73d1..021e8a9 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -191,7 +191,7 @@ private:
 
     void            ReleaseFocus_Impl();
     void            EnableControls_Impl();
-    void            CheckAndMarkUnknownFont( const OUString& fontname );
+    DECL_DLLPRIVATE_LINK( CheckAndMarkUnknownFont, VclWindowEvent* );
 
 protected:
     virtual void    Select();
@@ -201,6 +201,7 @@ public:
     SvxFontNameBox_Impl( Window* pParent, const Reference< XDispatchProvider >& rDispatchProvider,const Reference< XFrame >& _xFrame
         , WinBits nStyle = WB_SORT
         );
+    virtual ~SvxFontNameBox_Impl();
 
     void            FillList();
     void            Update( const SvxFontItem* pFontItem );
@@ -209,8 +210,6 @@ public:
     void            Fill( const FontList* pList )
                         { FontNameBox::Fill( pList );
                           nFtCount = pList->GetFontNameCount(); }
-    virtual void    SetText( const OUString& rStr ) SAL_OVERRIDE;
-    virtual void    SetText( const OUString& rStr, const Selection& rNewSelection ) SAL_OVERRIDE;
     virtual long    PreNotify( NotifyEvent& rNEvt );
     virtual long    Notify( NotifyEvent& rNEvt );
     virtual Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
@@ -771,7 +770,14 @@ SvxFontNameBox_Impl::SvxFontNameBox_Impl( Window* pParent, const Reference< XDis
 {
     SetSizePixel(LogicToPixel( aLogicalSize, MAP_APPFONT ));
     EnableControls_Impl();
+    GetSubEdit()->AddEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont ));
 }
+
+SvxFontNameBox_Impl::~SvxFontNameBox_Impl()
+{
+    GetSubEdit()->RemoveEventListener( LINK( this, SvxFontNameBox_Impl, CheckAndMarkUnknownFont ));
+}
+
 // -----------------------------------------------------------------------
 
 void SvxFontNameBox_Impl::FillList()
@@ -784,22 +790,11 @@ void SvxFontNameBox_Impl::FillList()
     SetSelection( aOldSel );
 }
 
-void SvxFontNameBox_Impl::SetText( const OUString& rStr )
-{
-    CheckAndMarkUnknownFont( rStr );
-    return FontNameBox::SetText( rStr );
-}
-
-void SvxFontNameBox_Impl::SetText( const OUString& rStr, const Selection& rNewSelection )
-{
-    CheckAndMarkUnknownFont( rStr );
-    return FontNameBox::SetText( rStr, rNewSelection );
-}
-
-void SvxFontNameBox_Impl::CheckAndMarkUnknownFont( const OUString& fontname )
+IMPL_LINK( SvxFontNameBox_Impl, CheckAndMarkUnknownFont, VclWindowEvent*, event )
 {
-    if( fontname == GetText())
-        return;
+    if( event->GetId() != VCLEVENT_EDIT_MODIFY )
+        return 0;
+    OUString fontname = GetSubEdit()->GetText();
     GetDocFontList_Impl( &pFontList, this );
     // If the font is unknown, show it in italic.
     Font font = GetControlFont();
@@ -821,6 +816,7 @@ void SvxFontNameBox_Impl::CheckAndMarkUnknownFont( const OUString& fontname )
             SetQuickHelpText( SVX_RESSTR( RID_SVXSTR_CHARFONTNAME_NOTAVAILABLE ));
         }
     }
+    return 0;
 }
 
 // -----------------------------------------------------------------------
commit fe8bfb201e79c31de1b692931a0e9ee6c7ff1d25
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Feb 12 19:06:54 2013 +0100

    mso saves obfuscated fonts as .odttf in .docx, so use the extension as well
    
    Change-Id: I5d4cb579c042f03137188f3e0293015bea723dce

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0732979..9ff630a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3059,7 +3059,7 @@ void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, const c
     if( file.open( osl_File_OpenFlag_Read ) != osl::File::E_None )
         return;
     uno::Reference< com::sun::star::io::XOutputStream > xOutStream = m_rExport.GetFilter().openFragmentStream(
-        OUString( "word/fonts/font" ) + OUString::number(m_nextFontId) + ".ttf",
+        OUString( "word/fonts/font" ) + OUString::number(m_nextFontId) + ".odttf",
         "application/vnd.openxmlformats-officedocument.obfuscatedFont" );
     // Not much point in trying hard with the obfuscation key, whoever reads the spec can read the font anyway,
     // so just alter the first and last part of the key.
@@ -3110,7 +3110,7 @@ void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, const c
     xOutStream->closeOutput();
     OString relId = OUStringToOString( GetExport().GetFilter().addRelation( m_pSerializer->getOutputStream(),
         "http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",
-        OUString( "fonts/font" ) + OUString::number(m_nextFontId) + ".ttf" ), RTL_TEXTENCODING_UTF8 );
+        OUString( "fonts/font" ) + OUString::number(m_nextFontId) + ".odttf" ), RTL_TEXTENCODING_UTF8 );
     m_pSerializer->singleElementNS( XML_w, tag,
         FSNS( XML_r, XML_id ), relId.getStr(),
         FSNS( XML_w, XML_fontKey ), fontKeyStr,


More information about the Libreoffice-commits mailing list