[Libreoffice-commits] .: 8 commits - compilerplugins/Makefile-clang.mk sw/source vcl/source xmloff/inc xmloff/source

Luboš Luňák l.lunak at suse.cz
Fri Feb 1 05:24:30 PST 2013


 compilerplugins/Makefile-clang.mk            |    2 
 sw/source/filter/ww8/docxattributeoutput.cxx |    2 
 sw/source/filter/xml/swxml.cxx               |    4 +
 sw/source/filter/xml/xmlexp.cxx              |   93 +++++++++------------------
 sw/source/filter/xml/xmlexp.hxx              |    6 +
 sw/source/filter/xml/xmlfonte.cxx            |   15 ----
 sw/source/filter/xml/xmlimp.cxx              |   85 +++++++++++-------------
 sw/source/filter/xml/xmlimp.hxx              |    5 +
 sw/source/ui/uiview/view.cxx                 |    6 +
 vcl/source/gdi/outdev3.cxx                   |   12 +--
 xmloff/inc/xmloff/XMLFontStylesContext.hxx   |   43 ++++++++++++
 xmloff/source/style/XMLFontStylesContext.cxx |   41 -----------
 12 files changed, 145 insertions(+), 169 deletions(-)

New commits:
commit 5ceaa68ca51c4d182210a28a64d574de6170b9ca
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Feb 1 14:23:46 2013 +0100

    one more config/ -> config_host/ fix after the rename
    
    Change-Id: I347790e1ca2ee6a27303d3644aa1459ff76ba4b0

diff --git a/compilerplugins/Makefile-clang.mk b/compilerplugins/Makefile-clang.mk
index 53c0f2c..205f605 100644
--- a/compilerplugins/Makefile-clang.mk
+++ b/compilerplugins/Makefile-clang.mk
@@ -53,7 +53,7 @@ CLANGOBJS=
 define clangbuildsrc
 $(3): $(2) $(SRCDIR)/compilerplugins/Makefile-clang.mk $(CLANGOUTDIR)/clang-timestamp
 	@echo [build CXX] $(subst $(SRCDIR)/,,$(2))
-	$(CXX) $(CLANGCXXFLAGS) $(CLANGDEFS) $(CLANGINCLUDES) -I$(BUILDDIR)/config $(2) -fPIC -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
+	$(CXX) $(CLANGCXXFLAGS) $(CLANGDEFS) $(CLANGINCLUDES) -I$(BUILDDIR)/config_host $(2) -fPIC -c -o $(3) -MMD -MT $(3) -MP -MF $(CLANGOUTDIR)/$(1).d
 
 -include $(CLANGOUTDIR)/$(1).d
 
commit 4a4c5f331b495d758aaad4e7253b13883dc863a9
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Thu Jan 31 18:30:31 2013 +0100

    consolidate the ugly code for getting SwDoc* to a function
    
    I'm not quite sure why the code has to do it this complicated way,
    but at least it's just in one (ok, two) places. Additionally, it
    seems all those checks are needless paranoia, so just assert.
    
    Change-Id: I9f0d4ecc5aec6995eb66ae553a4bd92cc5450b86

diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index 7148709..2d2d903 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -88,6 +88,7 @@ SwXMLExport::SwXMLExport(
     pTableLines( 0 ),
     bBlock( sal_False ),
     bShowProgress( sal_True ),
+    doc( NULL ),
     sNumberFormat(RTL_CONSTASCII_USTRINGPARAM("NumberFormat")),
     sIsProtected(RTL_CONSTASCII_USTRINGPARAM("IsProtected")),
     sCell(RTL_CONSTASCII_USTRINGPARAM("Cell"))
@@ -108,13 +109,6 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
 
     SwPauseThreadStarting aPauseThreadStarting; // #i73788#
 
-    Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
-    Reference < XText > xText = xTextDoc->getText();
-    Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
-    OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
-    if( !xTextTunnel.is() )
-        return ERR_SWG_WRITE_ERROR;
-
     // from here, we use core interfaces -> lock Solar-Mutex
     SolarMutexGuard aGuard;
 
@@ -135,13 +129,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
         }
     }
 
-    SwXText *pText = reinterpret_cast< SwXText * >(
-            sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
-    OSL_ENSURE( pText, "SwXText missing" );
-    if( !pText )
-        return ERR_SWG_WRITE_ERROR;
-
-    SwDoc *pDoc = pText->GetDoc();
+    SwDoc *pDoc = getDoc();
 
     sal_Bool bExtended = sal_False;
     if( (getExportFlags() & (EXPORT_FONTDECLS|EXPORT_STYLES|
@@ -377,30 +365,7 @@ void SwXMLExport::GetViewSettings(Sequence<PropertyValue>& aProps)
     pValue[nIndex].Name = OUString( RTL_CONSTASCII_USTRINGPARAM ( "Views") );
     pValue[nIndex++].Value <<= Reference < XIndexAccess > ( xBox, UNO_QUERY );
 
-    Reference < XText > xText;
-    SwXText *pText = 0;
-
-    if( GetModel().is() )
-    {
-        Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
-        xText = xTextDoc->getText();
-        Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
-        OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
-        if( xTextTunnel.is() )
-        {
-            pText = reinterpret_cast< SwXText * >(
-                    sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId()) ));
-            OSL_ENSURE( pText, "SwXText missing" );
-        }
-    }
-
-    if( !pText )
-    {
-        aProps.realloc(nIndex);
-        return;
-    }
-
-    SwDoc *pDoc = pText->GetDoc();
+    SwDoc *pDoc = getDoc();
     const Rectangle rRect =
         pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT );
     sal_Bool bTwip = pDoc->GetDocShell()->GetMapUnit ( ) == MAP_TWIP;
@@ -476,31 +441,16 @@ sal_Int32 SwXMLExport::GetDocumentSpecificSettings( ::std::list< SettingsGroup >
 
 void SwXMLExport::SetBodyAttributes()
 {
-    Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
-    Reference < XText > xText = xTextDoc->getText();
     // export use of soft page breaks
+    SwDoc *pDoc = getDoc();
+    if( pDoc->GetCurrentViewShell() &&
+        pDoc->GetCurrentViewShell()->GetPageCount() > 1 )
     {
-        Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
-        OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
-        if( xTextTunnel.is() )
-        {
-            SwXText *pText = reinterpret_cast< SwXText * >(
-                    sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
-            OSL_ENSURE( pText, "SwXText missing" );
-            if( pText )
-            {
-                SwDoc *pDoc = pText->GetDoc();
-                if( pDoc && pDoc->GetCurrentViewShell() &&
-                    pDoc->GetCurrentViewShell()->GetPageCount() > 1 )
-                {
-                    sal_Bool bValue = sal_True;
-                    rtl::OUStringBuffer sBuffer;
-                    ::sax::Converter::convertBool(sBuffer, bValue);
-                    AddAttribute(XML_NAMESPACE_TEXT, XML_USE_SOFT_PAGE_BREAKS,
-                        sBuffer.makeStringAndClear());
-                }
-            }
-        }
+        sal_Bool bValue = sal_True;
+        rtl::OUStringBuffer sBuffer;
+        ::sax::Converter::convertBool(sBuffer, bValue);
+        AddAttribute(XML_NAMESPACE_TEXT, XML_USE_SOFT_PAGE_BREAKS,
+            sBuffer.makeStringAndClear());
     }
 }
 
@@ -836,4 +786,25 @@ OUString SAL_CALL SwXMLExport::getImplementationName()
     }
 }
 
+SwDoc* SwXMLExport::getDoc()
+{
+    if( doc != NULL )
+        return doc;
+    Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
+    Reference < XText > xText = xTextDoc->getText();
+    Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
+    assert( xTextTunnel.is());
+    SwXText *pText = reinterpret_cast< SwXText *>(
+            sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
+    assert( pText != NULL );
+    doc = pText->GetDoc();
+    assert( doc != NULL );
+    return doc;
+}
+
+const SwDoc* SwXMLExport::getDoc() const
+{
+    return const_cast< SwXMLExport* >( this )->getDoc();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/xml/xmlexp.hxx b/sw/source/filter/xml/xmlexp.hxx
index d5c9ea2..9015bc6 100644
--- a/sw/source/filter/xml/xmlexp.hxx
+++ b/sw/source/filter/xml/xmlexp.hxx
@@ -26,6 +26,7 @@
 #include <xmloff/xmltoken.hxx>
 #include <vector>
 
+class SwDoc;
 class SwFmt;
 class SwFrmFmt;
 class SvXMLUnitConverter;
@@ -60,6 +61,8 @@ class SwXMLExport : public SvXMLExport
     sal_Bool                    bShowProgress : 1;
     sal_Bool                    bSavedShowChanges : 1;
 
+    SwDoc*                      doc; // cached for getDoc()
+
     void _InitItemExport();
     void _FinitItemExport();
     void ExportTableLinesAutoStyles( const SwTableLines& rLines,
@@ -144,6 +147,9 @@ public:
     // XServiceInfo (override parent method)
     ::rtl::OUString SAL_CALL getImplementationName()
         throw( ::com::sun::star::uno::RuntimeException );
+
+    const SwDoc* getDoc() const;
+    SwDoc* getDoc();
 };
 
 inline const SvXMLUnitConverter& SwXMLExport::GetTwipUnitConverter() const
diff --git a/sw/source/filter/xml/xmlfonte.cxx b/sw/source/filter/xml/xmlfonte.cxx
index bf9563b..4b4e48c 100644
--- a/sw/source/filter/xml/xmlfonte.cxx
+++ b/sw/source/filter/xml/xmlfonte.cxx
@@ -46,20 +46,7 @@ SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(
     sal_uInt16 aWhichIds[3] = { RES_CHRATR_FONT, RES_CHRATR_CJK_FONT,
                                 RES_CHRATR_CTL_FONT };
 
-    Reference < XTextDocument > xTextDoc( _rExport.GetModel(), UNO_QUERY );
-    Reference < XText > xText = xTextDoc->getText();
-    Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
-    OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
-    if( !xTextTunnel.is() )
-        return;
-
-    SwXText *pText = reinterpret_cast< SwXText *>(
-            sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
-    OSL_ENSURE( pText, "SwXText missing" );
-    if( !pText )
-        return;
-
-    const SfxItemPool& rPool = pText->GetDoc()->GetAttrPool();
+    const SfxItemPool& rPool = _rExport.getDoc()->GetAttrPool();
     const SfxPoolItem* pItem;
     for( sal_uInt16 i=0; i<3; i++ )
     {
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index a86364b..67fa1ef 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -425,7 +425,8 @@ SwXMLImport::SwXMLImport(
     bShowProgress( true ),
     bOrganizerMode( false ),
     bInititedXForms( false ),
-    bPreserveRedlineMode( sal_True )
+    bPreserveRedlineMode( sal_True ),
+    doc( NULL )
 {
     _InitItemImport();
 
@@ -1016,20 +1017,7 @@ void SwXMLImport::SetViewSettings(const Sequence < PropertyValue > & aViewProps)
     // this method will modify the document directly -> lock SolarMutex
     SolarMutexGuard aGuard;
 
-    Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
-    Reference < XText > xText = xTextDoc->getText();
-    Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
-    OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
-    if( !xTextTunnel.is() )
-        return;
-
-    SwXText *pText = reinterpret_cast< SwXText *>(
-            sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
-    OSL_ENSURE( pText, "SwXText missing" );
-    if( !pText )
-        return;
-
-    SwDoc *pDoc = pText->GetDoc();
+    SwDoc *pDoc = getDoc();
     Rectangle aRect;
     if( pDoc->GetDocShell() )
         aRect = pDoc->GetDocShell()->GetVisArea( ASPECT_CONTENT );
@@ -1463,39 +1451,23 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC
     if ( !bTabOverMargin )
         xProps->setPropertyValue("TabOverMargin", makeAny( false ) );
 
-    Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
-    Reference < XText > xText = xTextDoc->getText();
-    Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
-    OSL_ENSURE( xTextTunnel.is(), "missing XUnoTunnel for Cursor" );
-    if( xTextTunnel.is() )
+    SwDoc *pDoc = getDoc();
+    SfxPrinter *pPrinter = pDoc->getPrinter( false );
+    if( pPrinter )
     {
-        SwXText *pText = reinterpret_cast< SwXText *>(
-                sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
-        OSL_ENSURE( pText, "SwXText missing" );
-        if( pText )
+        // If the printer is known, then the OLE objects will
+        // already have correct sizes, and we don't have to call
+        // PrtOLENotify again. Otherwise we have to call it.
+        // The flag might be set from setting the printer, so it
+        // it is required to clear it.
+        pDoc->SetOLEPrtNotifyPending( !pPrinter->IsKnown() );
+
+        // old printer metrics compatibility
+        if (  pDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS ) &&
+             !pDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
         {
-            SwDoc *pDoc = pText->GetDoc();
-            if( pDoc )
-            {
-                SfxPrinter *pPrinter = pDoc->getPrinter( false );
-                if( pPrinter )
-                {
-                    // If the printer is known, then the OLE objects will
-                    // already have correct sizes, and we don't have to call
-                    // PrtOLENotify again. Otherwise we have to call it.
-                    // The flag might be set from setting the printer, so it
-                    // it is required to clear it.
-                    pDoc->SetOLEPrtNotifyPending( !pPrinter->IsKnown() );
-
-                    // old printer metrics compatibility
-                    if (  pDoc->get(IDocumentSettingAccess::USE_OLD_PRINTER_METRICS ) &&
-                         !pDoc->get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
-                    {
-                        pPrinter->Compat_OldPrinterMetrics( true );
-                        pDoc->GetDocShell()->UpdateFontList();
-                    }
-                }
-            }
+            pPrinter->Compat_OldPrinterMetrics( true );
+            pDoc->GetDocShell()->UpdateFontList();
         }
     }
 }
@@ -1740,4 +1712,25 @@ void SwXMLImport::initXForms()
     bInititedXForms = true;
 }
 
+SwDoc* SwXMLImport::getDoc()
+{
+    if( doc != NULL )
+        return doc;
+    Reference < XTextDocument > xTextDoc( GetModel(), UNO_QUERY );
+    Reference < XText > xText = xTextDoc->getText();
+    Reference<XUnoTunnel> xTextTunnel( xText, UNO_QUERY);
+    assert( xTextTunnel.is());
+    SwXText *pText = reinterpret_cast< SwXText *>(
+            sal::static_int_cast< sal_IntPtr >( xTextTunnel->getSomething( SwXText::getUnoTunnelId() )));
+    assert( pText != NULL );
+    doc = pText->GetDoc();
+    assert( doc != NULL );
+    return doc;
+}
+
+const SwDoc* SwXMLImport::getDoc() const
+{
+    return const_cast< SwXMLImport* >( this )->getDoc();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/filter/xml/xmlimp.hxx b/sw/source/filter/xml/xmlimp.hxx
index e77cedd..093aea3 100644
--- a/sw/source/filter/xml/xmlimp.hxx
+++ b/sw/source/filter/xml/xmlimp.hxx
@@ -79,6 +79,8 @@ class SwXMLImport: public SvXMLImport
     bool                bInititedXForms : 1;
     sal_Bool                bPreserveRedlineMode;
 
+    SwDoc*      doc; // cached for getDoc()
+
     void                    _InitItemImport();
     void                    _FinitItemImport();
     void                    UpdateTxtCollConditions( SwDoc *pDoc );
@@ -194,6 +196,9 @@ public:
     ::com::sun::star::uno::Reference<
         ::com::sun::star::document::XDocumentProperties>
             GetDocumentProperties() const;
+
+    const SwDoc* getDoc() const;
+    SwDoc* getDoc();
 };
 
 inline const SvXMLUnitConverter& SwXMLImport::GetTwipUnitConverter() const
commit 805fc4bf039e011591d29f8a75e53c0b1b3a3c6b
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jan 30 20:00:21 2013 +0100

    correct flag for file opening
    
    Although it seems reading works even when opened just for write ...
    
    Change-Id: I57039e7b72dd466e1b087c81377b2b2dcd26fb5c

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 917ddb5..a2ed719 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3056,7 +3056,7 @@ void DocxAttributeOutput::EmbedFontStyle( const OUString& name, int tag, const c
     // and embed it again.
     // TODO IDocumentSettingAccess::EMBED_SYSTEM_FONTS
     osl::File file( fontUrl );
-    if( file.open( osl_File_OpenFlag_Write ) != osl::File::E_None )
+    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",
commit 73a24e709396e4dd906b8cfbd7719e51f29dd3a7
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jan 30 19:10:12 2013 +0100

    pass the storage to the XML import filter
    
    So that SvXMLImport::GetSourceStorage() returns something useful.
    
    Change-Id: Iecb2044336d45eefcb2b0ca5cfda5bc173d4e71e

diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 736a5a8..76778b6 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -643,6 +643,8 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con
         { "TextDocInOOoFileFormat", sizeof("TextDocInOOoFileFormat")-1, 0,
               &::getBooleanCppuType(),
               beans::PropertyAttribute::MAYBEVOID, 0 },
+        { "SourceStorage", strlen( "SourceStorage" ), 0, &embed::XStorage::static_type(),
+          ::com::sun::star::beans::PropertyAttribute::MAYBEVOID, 0 },
         { NULL, 0, 0, NULL, 0, 0 }
     };
     uno::Reference< beans::XPropertySet > xInfoSet(
@@ -701,6 +703,8 @@ sal_uLong XMLReader::Read( SwDoc &rDoc, const String& rBaseURL, SwPaM &rPaM, con
         makeAny( xLateInitSettings )
     );
 
+    xInfoSet->setPropertyValue( "SourceStorage", Any( xStorage ) );
+
     // prepare filter arguments, WARNING: the order is important!
     Sequence<Any> aFilterArgs( 5 );
     Any *pArgs = aFilterArgs.getArray();
commit d28f0bfda55eebc34bbe5aab22f430ee37ef7e9b
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jan 23 16:31:31 2013 +0100

    move class definition to a header file
    
    Change-Id: Id41200667089d4f42f7999060fd97545bb069788

diff --git a/xmloff/inc/xmloff/XMLFontStylesContext.hxx b/xmloff/inc/xmloff/XMLFontStylesContext.hxx
index afd495c..e48ae0a 100644
--- a/xmloff/inc/xmloff/XMLFontStylesContext.hxx
+++ b/xmloff/inc/xmloff/XMLFontStylesContext.hxx
@@ -84,6 +84,49 @@ public:
 
 };
 
+/// Handles <style:font-face>
+class XMLFontStyleContext_Impl : public SvXMLStyleContext
+{
+    ::com::sun::star::uno::Any aFamilyName;
+    ::com::sun::star::uno::Any aStyleName;
+    ::com::sun::star::uno::Any aFamily;
+    ::com::sun::star::uno::Any aPitch;
+    ::com::sun::star::uno::Any aEnc;
+
+    SvXMLImportContextRef xStyles;
+
+    XMLFontStylesContext *GetStyles()
+    {
+        return ((XMLFontStylesContext *)&xStyles);
+    }
+
+public:
+
+    TYPEINFO();
+
+    XMLFontStyleContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
+            const ::rtl::OUString& rLName,
+            const ::com::sun::star::uno::Reference<
+                ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
+            XMLFontStylesContext& rStyles );
+    virtual ~XMLFontStyleContext_Impl();
+
+    void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
+                       const OUString& rValue );
+
+    void FillProperties( ::std::vector< XMLPropertyState > &rProps,
+                         sal_Int32 nFamilyNameIdx,
+                         sal_Int32 nStyleNameIdx,
+                         sal_Int32 nFamilyIdx,
+                         sal_Int32 nPitchIdx,
+                         sal_Int32 nCharsetIdx ) const;
+
+    SvXMLImportContext * CreateChildContext(
+        sal_uInt16 nPrefix,
+        const ::rtl::OUString& rLocalName,
+        const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList > & xAttrList );
+};
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/style/XMLFontStylesContext.cxx b/xmloff/source/style/XMLFontStylesContext.cxx
index 5997f19..6a6e290 100644
--- a/xmloff/source/style/XMLFontStylesContext.cxx
+++ b/xmloff/source/style/XMLFontStylesContext.cxx
@@ -17,6 +17,7 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <xmloff/XMLFontStylesContext.hxx>
 
 #include <com/sun/star/awt/FontFamily.hpp>
 #include <com/sun/star/awt/FontPitch.hpp>
@@ -29,8 +30,6 @@
 #include "fonthdl.hxx"
 #include <xmloff/xmlimp.hxx>
 #include <xmloff/maptype.hxx>
-#include <xmloff/XMLFontStylesContext.hxx>
-
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -78,44 +77,6 @@ static const SvXMLTokenMapEntry* lcl_getFontStyleAttrTokenMap()
     return aFontStyleAttrTokenMap;
 }
 
-class XMLFontStyleContext_Impl : public SvXMLStyleContext
-{
-    Any aFamilyName;
-    Any aStyleName;
-    Any aFamily;
-    Any aPitch;
-    Any aEnc;
-
-    SvXMLImportContextRef xStyles;
-
-    XMLFontStylesContext *GetStyles()
-    {
-        return ((XMLFontStylesContext *)&xStyles);
-    }
-
-public:
-
-    TYPEINFO();
-
-    XMLFontStyleContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx,
-            const ::rtl::OUString& rLName,
-            const ::com::sun::star::uno::Reference<
-                ::com::sun::star::xml::sax::XAttributeList > & xAttrList,
-            XMLFontStylesContext& rStyles );
-    virtual ~XMLFontStyleContext_Impl();
-
-    void SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName,
-                       const OUString& rValue );
-
-    void FillProperties( ::std::vector< XMLPropertyState > &rProps,
-                         sal_Int32 nFamilyNameIdx,
-                         sal_Int32 nStyleNameIdx,
-                         sal_Int32 nFamilyIdx,
-                         sal_Int32 nPitchIdx,
-                         sal_Int32 nCharsetIdx ) const;
-
-};
-
 TYPEINIT1( XMLFontStyleContext_Impl, SvXMLStyleContext );
 
 XMLFontStyleContext_Impl::XMLFontStyleContext_Impl( SvXMLImport& rImport,
commit 32e3ede97ec6bad1b3c19545709b54eff29eafc6
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jan 23 15:22:28 2013 +0100

    make sure newly created SwDocShell has font info up to date
    
    http://lists.freedesktop.org/archives/libreoffice/2012-September/038163.html
    
    Change-Id: I41a195180411800f72b8e251b5c19553a51cde44

diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index 44fa043..1d27f8d 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -778,6 +778,12 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     sal_Bool bOldModifyFlag = pDocSh->IsEnableSetModified();
     if(bOldModifyFlag)
         pDocSh->EnableSetModified( sal_False );
+    // HACK: SwDocShell has some cached font info, VCL informs about font updates,
+    // but loading of docs with embedded fonts happens after SwDocShell is created
+    // but before SwEditWin (which handles the VCL event) is created. So update
+    // manually.
+    if( pDocSh->GetDoc()->get( IDocumentSettingAccess::EMBED_FONTS ))
+        pDocSh->UpdateFontList();
     OSL_ENSURE( pDocSh, "view without DocShell." );
     SwWebDocShell* pWebDShell = PTR_CAST( SwWebDocShell, pDocSh );
 
commit 65e294e618e077ad6999ef24f9e6047c2a838b7d
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Wed Jan 23 15:13:11 2013 +0100

    always propagate font changes
    
    Otherwise e.g. informing about new fonts when loading a document
    with embedded fonts doesn't work. I'm not quite sure why this
    should be limited to only printers or pdf, so this may be temporary
    until a problem shows up. There'a also a warning about refcount
    in ImplFontCache::Invalidate(), which seems to be bogus, because
    invalidating caches shouldn't have effect on anything except for speed,
    but with the way font handling in vcl is designed I wouldn't be
    surprised if ImplFontCache wasn't actually a cache.
    
    http://lists.freedesktop.org/archives/libreoffice/2012-September/038163.html
    
    Change-Id: Ib68c0c10a0f5340a532c5c59396ef2cfbc588b5f

diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index efabb84..e5d22a3 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -198,7 +198,7 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
             mpGraphics->ReleaseFonts();
     }
 
-    if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
+//    if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
     {
         ImplSVData* pSVData = ImplGetSVData();
 
commit f3513d038dfc09b2be784ae1c747917edbbc085a
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Tue Jan 22 18:17:34 2013 +0100

    fix incorrect if indentation
    
    Change-Id: If3607886050c4e2e649e5678cc39f290b122f537

diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index fe3d652..efabb84 100644
--- a/vcl/source/gdi/outdev3.cxx
+++ b/vcl/source/gdi/outdev3.cxx
@@ -194,8 +194,8 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
         }
 
         // release all physically selected fonts on this device
-    if( ImplGetGraphics() )
-         mpGraphics->ReleaseFonts();
+        if( ImplGetGraphics() )
+            mpGraphics->ReleaseFonts();
     }
 
     if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
@@ -406,7 +406,7 @@ sal_uInt16 OutputDevice::GetFontSubstituteCount()
 {
     const ImplDirectFontSubstitution* pSubst = ImplGetSVData()->maGDIData.mpDirectFontSubst;
     if( !pSubst )
-    return 0;
+        return 0;
     int nCount =  pSubst->GetFontSubstituteCount();
     return (sal_uInt16)nCount;
 }
@@ -8045,7 +8045,7 @@ sal_Bool OutputDevice::GetTextOutlines( PolyPolyVector& rResultVector,
     ::basegfx::B2DPolyPolygonVector aB2DPolyPolyVector;
     if( !GetTextOutlines( aB2DPolyPolyVector, rStr, nBase, nIndex, nLen,
                          bOptimize, nTWidth, pDXArray ) )
-    return sal_False;
+        return sal_False;
 
     // convert to a tool polypolygon vector
     rResultVector.reserve( aB2DPolyPolyVector.size() );
@@ -8068,7 +8068,7 @@ sal_Bool OutputDevice::GetTextOutline( PolyPolygon& rPolyPoly,
     ::basegfx::B2DPolyPolygonVector aB2DPolyPolyVector;
     if( !GetTextOutlines( aB2DPolyPolyVector, rStr, nBase, nIndex, nLen,
                          bOptimize, nTWidth, pDXArray ) )
-    return sal_False;
+        return sal_False;
 
     // convert and merge into a tool polypolygon
     ::basegfx::B2DPolyPolygonVector::const_iterator aIt = aB2DPolyPolyVector.begin();


More information about the Libreoffice-commits mailing list