[Libreoffice-commits] core.git: 3 commits - sfx2/source sw/source writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Aug 27 23:28:00 PDT 2014


 sfx2/source/doc/docfile.cxx                |    6 -
 sw/source/filter/html/wrthtml.cxx          |  128 ++++++++++++++---------------
 writerfilter/source/dmapper/OLEHandler.cxx |   44 ++-------
 3 files changed, 78 insertions(+), 100 deletions(-)

New commits:
commit 1babe37e4871b47e37bef35378a5cf622948aeca
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Aug 28 08:27:27 2014 +0200

    Use comphelper::SequenceAsHashMap
    
    Change-Id: I21302361e89b9f01af04cf1a1ed78627097b9d8c

diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx
index a743ceb..325f6f1 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -184,24 +184,16 @@ void OLEHandler::lcl_sprm(Sprm & rSprm)
 
 void OLEHandler::saveInteropProperties(uno::Reference<text::XTextDocument> const& xTextDocument, const OUString& sObjectName, const OUString& sOldObjectName)
 {
-    const OUString sGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
-    const OUString sEmbeddingsPropName = "EmbeddedObjects";
+    static const OUString sEmbeddingsPropName = "EmbeddedObjects";
 
     // get interop grab bag from document
     uno::Reference< beans::XPropertySet > xDocProps( xTextDocument, uno::UNO_QUERY );
-    uno::Sequence< beans::PropertyValue > aGrabBag;
-    xDocProps->getPropertyValue( sGrabBagPropName ) >>= aGrabBag;
+    comphelper::SequenceAsHashMap aGrabBag(xDocProps->getPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG));
 
     // get EmbeddedObjects property inside grab bag
-    sal_Int32 i = 0;
-    sal_Int32 nBagLength = aGrabBag.getLength();
-    uno::Sequence< beans::PropertyValue > objectsList;
-    for( ; i < nBagLength; ++i )
-        if ( aGrabBag[i].Name == sEmbeddingsPropName )
-        {
-            aGrabBag[i].Value >>= objectsList;
-            break;
-        }
+    comphelper::SequenceAsHashMap objectsList;
+    if (aGrabBag.find(sEmbeddingsPropName) != aGrabBag.end())
+        objectsList << aGrabBag[sEmbeddingsPropName];
 
     uno::Sequence< beans::PropertyValue > aGrabBagAttribute(2);
     aGrabBagAttribute[0].Name = "ProgID";
@@ -209,35 +201,21 @@ void OLEHandler::saveInteropProperties(uno::Reference<text::XTextDocument> const
     aGrabBagAttribute[1].Name = "DrawAspect";
     aGrabBagAttribute[1].Value = uno::Any( m_sDrawAspect );
 
-    // save ProgID of current object
-    sal_Int32 length = objectsList.getLength();
-
     // If we got an "old name", erase that first.
     if (!sOldObjectName.isEmpty())
     {
-        comphelper::SequenceAsHashMap aMap(objectsList);
-        comphelper::SequenceAsHashMap::iterator it = aMap.find(sOldObjectName);
-        if (it != aMap.end())
-            aMap.erase(it);
-        objectsList = aMap.getAsConstPropertyValueList();
+        comphelper::SequenceAsHashMap::iterator it = objectsList.find(sOldObjectName);
+        if (it != objectsList.end())
+            objectsList.erase(it);
     }
 
-    objectsList.realloc( length + 1 );
-    objectsList[length].Name = sObjectName;
-    objectsList[length].Value = uno::Any( aGrabBagAttribute );
+    objectsList[sObjectName] = uno::Any( aGrabBagAttribute );
 
     // put objects list back into the grab bag
-    if( i == nBagLength )
-    {
-        aGrabBag.realloc( nBagLength + 1 );
-        aGrabBag[nBagLength].Name = sEmbeddingsPropName;
-        aGrabBag[nBagLength].Value = uno::Any( objectsList );
-    }
-    else
-        aGrabBag[i].Value = uno::Any( objectsList );
+    aGrabBag[sEmbeddingsPropName] = uno::Any(objectsList.getAsConstPropertyValueList());
 
     // put grab bag back into the document
-    xDocProps->setPropertyValue( sGrabBagPropName, uno::Any( aGrabBag ) );
+    xDocProps->setPropertyValue(UNO_NAME_MISC_OBJ_INTEROPGRABBAG, uno::Any(aGrabBag.getAsConstPropertyValueList()));
 }
 
 void OLEHandler::importStream(uno::Reference<uno::XComponentContext> xComponentContext, uno::Reference<text::XTextDocument> xTextDocument, uno::Reference<text::XTextContent> xOLE)
commit 2c8b1d761187dd4e93c2e26996f97aa1dd2e90a4
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Aug 28 08:07:44 2014 +0200

    SwHTMLWriter::MakeHeader: indent conditional block
    
    Change-Id: If401b798eca9a60c50669070dfb0a038f0710b3a

diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index 0ab79bd..e7c94be 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -940,39 +940,39 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
     OStringBuffer sOut;
     if (!mbSkipHeaderFooter)
     {
-    sOut.append(OString(OOO_STRING_SVTOOLS_HTML_doctype) + " " + OString(OOO_STRING_SVTOOLS_HTML_doctype40));
-    HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.makeStringAndClear().getStr() );
+        sOut.append(OString(OOO_STRING_SVTOOLS_HTML_doctype) + " " + OString(OOO_STRING_SVTOOLS_HTML_doctype40));
+        HTMLOutFuncs::Out_AsciiTag( Strm(), sOut.makeStringAndClear().getStr() );
 
-    // baue den Vorspann
-    OutNewLine();
-    HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_html );
+        // baue den Vorspann
+        OutNewLine();
+        HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_html );
 
-    OutNewLine();
-    HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_head );
+        OutNewLine();
+        HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_head );
 
-    IncIndentLevel();   // Inhalt von <HEAD> einruecken
+        IncIndentLevel();   // Inhalt von <HEAD> einruecken
 
-    // DokumentInfo
-    OString sIndent = GetIndentString();
+        // DokumentInfo
+        OString sIndent = GetIndentString();
 
-    uno::Reference<document::XDocumentProperties> xDocProps;
-    SwDocShell *pDocShell(pDoc->GetDocShell());
-    if (pDocShell)
-    {
-        uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
-            pDocShell->GetModel(), uno::UNO_QUERY_THROW);
-        xDocProps.set(xDPS->getDocumentProperties());
-    }
+        uno::Reference<document::XDocumentProperties> xDocProps;
+        SwDocShell *pDocShell(pDoc->GetDocShell());
+        if (pDocShell)
+        {
+            uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
+                                                                       pDocShell->GetModel(), uno::UNO_QUERY_THROW);
+            xDocProps.set(xDPS->getDocumentProperties());
+        }
 
-    // xDocProps may be null here (when copying)
-    SfxFrameHTMLWriter::Out_DocInfo( Strm(), GetBaseURL(), xDocProps,
-                                     sIndent.getStr(), eDestEnc,
-                                     &aNonConvertableCharacters );
+        // xDocProps may be null here (when copying)
+        SfxFrameHTMLWriter::Out_DocInfo( Strm(), GetBaseURL(), xDocProps,
+                                         sIndent.getStr(), eDestEnc,
+                                         &aNonConvertableCharacters );
 
-    // Kommentare und Meta-Tags des ersten Absatzes
-    rHeaderAttrs = OutHeaderAttrs();
+        // Kommentare und Meta-Tags des ersten Absatzes
+        rHeaderAttrs = OutHeaderAttrs();
 
-    OutFootEndNoteInfo();
+        OutFootEndNoteInfo();
     }
 
     const SwPageDesc *pPageDesc = 0;
@@ -1005,57 +1005,57 @@ const SwPageDesc *SwHTMLWriter::MakeHeader( sal_uInt16 &rHeaderAttrs )
 
     if (!mbSkipHeaderFooter)
     {
-    // und nun ... das Style-Sheet!!!
-    if( bCfgOutStyles )
-    {
-        OutStyleSheet( *pPageDesc );
-    }
+        // und nun ... das Style-Sheet!!!
+        if( bCfgOutStyles )
+        {
+            OutStyleSheet( *pPageDesc );
+        }
 
-    // und nun ... das BASIC und JavaScript!
-    if( pDoc->GetDocShell() )   // nur mit DocShell ist Basic moeglich
-        OutBasic();
+        // und nun ... das BASIC und JavaScript!
+        if( pDoc->GetDocShell() )   // nur mit DocShell ist Basic moeglich
+            OutBasic();
 
-    DecIndentLevel();   // Inhalt von <HEAD> einruecken
-    OutNewLine();
-    HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_head, false );
+        DecIndentLevel();   // Inhalt von <HEAD> einruecken
+        OutNewLine();
+        HTMLOutFuncs::Out_AsciiTag( Strm(), OOO_STRING_SVTOOLS_HTML_head, false );
 
-    // der Body wird nicht eingerueckt, weil sonst alles eingerueckt waere!
-    OutNewLine();
-    sOut.append("<" + OString(OOO_STRING_SVTOOLS_HTML_body));
-    Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
+        // der Body wird nicht eingerueckt, weil sonst alles eingerueckt waere!
+        OutNewLine();
+        sOut.append("<" + OString(OOO_STRING_SVTOOLS_HTML_body));
+        Strm().WriteCharPtr( sOut.makeStringAndClear().getStr() );
 
-    // language
-    OutLanguage( eLang );
+        // language
+        OutLanguage( eLang );
 
-    // Textfarbe ausgeben, wenn sie an der Standard-Vorlage gesetzt ist
-    // und sich geaendert hat.
-    OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_text,
-                  pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ),
-                  *this );
+        // Textfarbe ausgeben, wenn sie an der Standard-Vorlage gesetzt ist
+        // und sich geaendert hat.
+        OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_text,
+                      pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD, false ),
+                      *this );
 
-    // Farben fuer (un)besuchte Links
-    OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_link,
-                  pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ),
-                  *this );
-    OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_vlink,
-                  pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ),
-                  *this );
+        // Farben fuer (un)besuchte Links
+        OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_link,
+                      pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_NORMAL ),
+                      *this );
+        OutBodyColor( OOO_STRING_SVTOOLS_HTML_O_vlink,
+                      pDoc->getIDocumentStylePoolAccess().GetCharFmtFromPool( RES_POOLCHR_INET_VISIT ),
+                      *this );
 
-    const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet();
+        const SfxItemSet& rItemSet = pPageDesc->GetMaster().GetAttrSet();
 
-    OutBackground( rItemSet, true );
+        OutBackground( rItemSet, true );
 
-    nDirection = GetHTMLDirection( rItemSet );
-    OutDirection( nDirection );
+        nDirection = GetHTMLDirection( rItemSet );
+        OutDirection( nDirection );
 
-    if( bCfgOutStyles )
-        OutCSS1_BodyTagStyleOpt( *this, rItemSet );
+        if( bCfgOutStyles )
+            OutCSS1_BodyTagStyleOpt( *this, rItemSet );
 
-    // Events anhaengen
-    if( pDoc->GetDocShell() )   // nur mit DocShell ist Basic moeglich
-        OutBasicBodyEvents();
+        // Events anhaengen
+        if( pDoc->GetDocShell() )   // nur mit DocShell ist Basic moeglich
+            OutBasicBodyEvents();
 
-    Strm().WriteChar( '>' );
+        Strm().WriteChar( '>' );
     }
 
     return pPageDesc;
commit dfe4e902f2deaec832d29dc9b7657bb6028f33ea
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Thu Aug 28 08:05:55 2014 +0200

    SfxMedium::Transfer_Impl: fix indentation
    
    Change-Id: I05856f88dc1263bac39d9f1e76ef7c4697c345a6

diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 67e7d10..a844e21 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1756,8 +1756,8 @@ void SfxMedium::Transfer_Impl()
         if (pImp->m_aLogicName.startsWith("private:stream"))
         {
             // TODO/LATER: support storing to SID_STREAM
-               SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
-             if( pOutStreamItem && ( pOutStreamItem->GetValue() >>= rOutStream ) )
+            SFX_ITEMSET_ARG( pImp->m_pSet, pOutStreamItem, SfxUnoAnyItem, SID_OUTPUTSTREAM, false);
+            if( pOutStreamItem && ( pOutStreamItem->GetValue() >>= rOutStream ) )
             {
                 if ( pImp->xStorage.is() )
                     CloseStorage();
@@ -1799,7 +1799,7 @@ void SfxMedium::Transfer_Impl()
                     catch( const Exception& )
                     {}
                 }
-               }
+            }
             else
             {
                 SAL_WARN( "sfx.doc", "Illegal Output stream parameter!" );


More information about the Libreoffice-commits mailing list