[Libreoffice-commits] core.git: 9 commits - sw/qa writerfilter/inc writerfilter/source

Michael Stahl mstahl at redhat.com
Tue Jul 22 07:45:33 PDT 2014


 sw/qa/extras/rtfimport/data/fdo77996.rtf                 |   36 +++
 sw/qa/extras/rtfimport/rtfimport.cxx                     |   24 ++
 writerfilter/inc/dmapper/DomainMapper.hxx                |    8 
 writerfilter/inc/resourcemodel/LoggedResources.hxx       |    4 
 writerfilter/inc/resourcemodel/WW8ResourceModel.hxx      |    2 
 writerfilter/source/dmapper/DomainMapper.cxx             |   12 -
 writerfilter/source/dmapper/DomainMapperTableHandler.cxx |    6 
 writerfilter/source/dmapper/DomainMapperTableHandler.hxx |    3 
 writerfilter/source/dmapper/DomainMapper_Impl.cxx        |   52 ++--
 writerfilter/source/dmapper/DomainMapper_Impl.hxx        |   59 +++--
 writerfilter/source/dmapper/FontTable.cxx                |    2 
 writerfilter/source/dmapper/FontTable.hxx                |    2 
 writerfilter/source/dmapper/FormControlHelper.cxx        |   10 
 writerfilter/source/dmapper/FormControlHelper.hxx        |   10 
 writerfilter/source/dmapper/GraphicHelpers.cxx           |    2 
 writerfilter/source/dmapper/GraphicHelpers.hxx           |    3 
 writerfilter/source/dmapper/GraphicImport.cxx            |    6 
 writerfilter/source/dmapper/GraphicImport.hxx            |    6 
 writerfilter/source/dmapper/NumberingManager.cxx         |    8 
 writerfilter/source/dmapper/NumberingManager.hxx         |    8 
 writerfilter/source/dmapper/OLEHandler.cxx               |    5 
 writerfilter/source/dmapper/OLEHandler.hxx               |    4 
 writerfilter/source/dmapper/PropertyMap.cxx              |   11 -
 writerfilter/source/dmapper/PropertyMap.hxx              |   12 -
 writerfilter/source/dmapper/SdtHelper.cxx                |    7 
 writerfilter/source/dmapper/SdtHelper.hxx                |    6 
 writerfilter/source/dmapper/SettingsTable.cxx            |    6 
 writerfilter/source/dmapper/SettingsTable.hxx            |    4 
 writerfilter/source/dmapper/StyleSheetTable.cxx          |   11 -
 writerfilter/source/dmapper/StyleSheetTable.hxx          |    2 
 writerfilter/source/resourcemodel/LoggedResources.cxx    |    4 
 writerfilter/source/rtftok/rtfdocumentimpl.cxx           |  158 +++++++++------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx           |    2 
 writerfilter/source/rtftok/rtfsdrimport.cxx              |   11 -
 writerfilter/source/rtftok/rtfsdrimport.hxx              |   10 
 writerfilter/source/rtftok/rtfvalue.cxx                  |   19 +
 writerfilter/source/rtftok/rtfvalue.hxx                  |   14 -
 37 files changed, 350 insertions(+), 199 deletions(-)

New commits:
commit 75c5679a96437caa6041d2550562f2a4db80d586
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 22 16:13:48 2014 +0200

    fdo#80486 writerfilter: RTF import: ignore \par inside \ftnsep
    
    Word can apparently have complex footnote separators, but the
    domain-mapper only sets a single flag that there is a separator
    (m_bHasFtnSep), so the only thing that makes sense for \par here
    is to completely ignore it.
    
    (regression from e1afe4318787425dc40f2d0b1f02fa17e925c8da)
    
    Change-Id: I32d9b01a0a9248ba646654295a74953a6cb74fb3

diff --git a/sw/qa/extras/rtfimport/data/fdo77996.rtf b/sw/qa/extras/rtfimport/data/fdo77996.rtf
index b5b4fde..055d860 100644
--- a/sw/qa/extras/rtfimport/data/fdo77996.rtf
+++ b/sw/qa/extras/rtfimport/data/fdo77996.rtf
@@ -26,6 +26,7 @@
 {\operator {\uc1 \u106 ?}{\uc1 \u97 ?}{\uc1 \u121 ?}}
 }
 
+\fet2 {\*\ftnsep \pard \plain {\insrsid \chftnsep \par }}{\*\ftnsepc \pard \plain {\insrsid \chftnsepc \par }}{\*\aftnsep \pard \plain {\insrsid \chftnsep \par }}{\*\aftnsepc \pard \plain {\insrsid \chftnsepc \par }}
 
 {\loch \af11 \hich \af11 \dbch \f11
 {\uc1 \u21414 ?}{\uc1 \u38376 ?}{\uc1 \u38056 ?}{\uc1 \u19994 ?}{\uc1 \u32929 ?}{\uc1 \u20221 ?}{\uc1 \u26377 ?}{\uc1 \u38480 ?}{\uc1 \u20844 ?}{\uc1 \u21496 ?}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 14a8728..289cce8 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1337,12 +1337,14 @@ DECLARE_RTFIMPORT_TEST(testFdo77996, "fdo77996.rtf")
     uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
     uno::Reference<document::XDocumentProperties> xProps(xDocumentPropertiesSupplier->getDocumentProperties());
     CPPUNIT_ASSERT_EQUAL(OUString("Aln Lin (Bei Jing)"), xProps->getAuthor());
-    CPPUNIT_ASSERT_EQUAL(
-        OUString("\xe5\x8e\xa6\xe9\x97\xa8\xe9\x92\xa8\xe4\xb8\x9a\xe8\x82\xa1\xe4\xbb\xbd\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8", 30,
-            RTL_TEXTENCODING_UTF8),
-        xProps->getTitle());
+    OUString aTitle("\xe5\x8e\xa6\xe9\x97\xa8\xe9\x92\xa8\xe4\xb8\x9a\xe8\x82\xa1\xe4\xbb\xbd\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8", 30,
+            RTL_TEXTENCODING_UTF8);
+    CPPUNIT_ASSERT_EQUAL(aTitle, xProps->getTitle());
     uno::Reference<beans::XPropertySet> xUDProps(xProps->getUserDefinedProperties(), uno::UNO_QUERY);
     CPPUNIT_ASSERT_EQUAL(OUString("jay"), getProperty<OUString>(xUDProps, "Operator"));
+
+    // fdo#80486 also check that the ftnsep doesn't insert paragraph breaks
+    getParagraph(1, aTitle);
 }
 
 DECLARE_RTFIMPORT_TEST(testFdo47802, "fdo47802.rtf")
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f25e518..95e41dc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2040,6 +2040,8 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
     break;
     case RTF_PAR:
     {
+        if (m_aStates.top().nDestinationState == DESTINATION_FOOTNOTESEPARATOR)
+            break; // just ignore it - only thing we read in here is CHFTNSEP
         checkFirstRun();
         bool bNeedPap = m_bNeedPap;
         checkNeedPap();
@@ -2047,13 +2049,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
             runProps();
         if (!m_aStates.top().pCurrentBuffer)
         {
-            if (m_aStates.top().nDestinationState == DESTINATION_FOOTNOTESEPARATOR)
-            {
-                static const sal_Unicode uCR = 0xd;
-                Mapper().utext((const sal_uInt8*)&uCR, 1);
-            }
-            else
-                parBreak();
+            parBreak();
             // Not in table? Reset max width.
             m_nCellxMax = 0;
         }
commit 82e17dbb2a16c7653a163139f0eea51faa4d46b8
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 22 15:05:24 2014 +0200

    fdo#77996: writerfilter: RTF import: re-work destination text buffering
    
    The problem in the bugdoc is that the ';' style terminator is encoded as
    {\uc1 \u59 ?}, i.e. inside a group, so when reading the ';' the
    aDestinationText of the top group is empty and the style name is lost.
    Or since the style name characters are encoded in the same way, every
    character is lost once the group closes.
    
    The same problem affects some of the document properties.
    
    Introduce an abstraction of RTFParserState::aDestinationText so that for
    every destination only one of these buffers is used, regardless of
    nested group structures; the aDestinationText buffer is only switched
    when entering a new destination.
    
    Also, the \revtbl and \stylesheet destinations do not contain entries
    directly, i.e., every entry must be in a sub-group, so remove some
    special-casing for these; however, for \fonttbl the entries may be in
    groups or not.
    
    Change-Id: Ica276a8b730e4a707530471ba27bfdd1582b8890

diff --git a/sw/qa/extras/rtfimport/data/fdo77996.rtf b/sw/qa/extras/rtfimport/data/fdo77996.rtf
new file mode 100644
index 0000000..b5b4fde
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo77996.rtf
@@ -0,0 +1,35 @@
+{\rtf \ansi \ansicpg0 \deff0 \stshfdbch1 \stshfloch0 \stshfhich0 \deflang1033 \deflangfe1033
+
+{\fonttbl
+{\f0 \froman \fcharset0 \fprq2 Times New Roman{\*\falt Times New Roman};}
+{\f1 \fnil \fcharset134 \fprq0 {\uc1 \u23435 ?}{\uc1 \u20307 ?}{\*\falt {\uc1 \u23435 ?}{\uc1 \u20307 ?}};}
+{\f6 \fnil \fcharset0 \fprq0 Wingdings{\*\falt Wingdings};}
+{\f10 \fnil \fcharset0 \fprq0 Calibri{\*\falt Calibri};}
+{\f11 \fnil \fcharset134 \fprq0 {\uc1 \u24494 ?}{\uc1 \u36719 ?}{\uc1 \u38597 ?}{\uc1 \u40657 ?}{\*\falt {\uc1 \u24494 ?}{\uc1 \u36719 ?}{\uc1 \u38597 ?}{\uc1 \u40657 ?}};}
+}
+
+{\stylesheet
+{\qj \li0 \ri0 \nowidctlpar \aspalpha \aspnum \adjustright \lin0 \rin0 \itap0 \fs21 \kerning2 \dbch \af1 \hich \af10 \loch \f10 \lang1033 \langnp1033 \langfe2052 \langfenp2052 \snext0 Normal{\uc1 \u59 ?}}
+{\s1 \ql \li0 \ri0 \sb100 \lisb0 \sa100 \lisa0 \sbauto1 \saauto1 \widctlpar \aspalpha \aspnum \adjustright \lin0 \rin0 \itap0 \outlinelevel0 \b1 \fs48 \kerning36 \dbch \af1 \hich \af1 \loch \f1 \lang1033 \langnp1033 \langfe2052 \langfenp2052 \sbasedon0 \snext1 \slink18 heading 1{\uc1 \u59 ?}}
+{\s2 \ql \li0 \ri0 \sb100 \lisb0 \sa100 \lisa0 \sbauto1 \saauto1 \widctlpar \aspalpha \aspnum \adjustright \lin0 \rin0 \itap0 \outlinelevel1 \b1 \fs36 \kerning0 \dbch \af1 \hich \af1 \loch \f1 \lang1033 \langnp1033 \langfe2052 \langfenp2052 \sbasedon0 \snext2 \slink16 heading 2{\uc1 \u59 ?}}
+{\*\cs10 \snext10 Default Paragraph Font{\uc1 \u59 ?}}
+{\*\cs15 \fs18 \v0 \sbasedon10 \snext15 {\uc1 \u97 ?}{\uc1 \u117 ?}{\uc1 \u116 ?}{\uc1 \u104 ?}{\uc1 \u111 ?}{\uc1 \u114 ?}{\uc1 \u59 ?}}
+{\*\cs16 \b1 \fs36 \kerning0 \dbch \af1 \hich \af1 \loch \f1 \sbasedon10 \snext16 \slink2 {\uc1 \u26631 ?}{\uc1 \u39064 ?}{\uc1 \u32 ?}{\uc1 \u50 ?}{\uc1 \u32 ?}{\uc1 \u67 ?}{\uc1 \u104 ?}{\uc1 \u97 ?}{\uc1 \u114 ?}{\uc1 \u59 ?}}
+{\*\cs17 \b1 \sbasedon10 \snext17 strong{\uc1 \u59 ?}}
+{\*\cs18 \b1 \fs48 \kerning36 \dbch \af1 \hich \af1 \loch \f1 \sbasedon10 \snext18 \slink1 {\uc1 \u26631 ?}{\uc1 \u39064 ?}{\uc1 \u32 ?}{\uc1 \u49 ?}{\uc1 \u32 ?}{\uc1 \u67 ?}{\uc1 \u104 ?}{\uc1 \u97 ?}{\uc1 \u114 ?}{\uc1 \u59 ?}}
+{\s19 \ql \li0 \ri0 \sb375 \lisb0 \sa100 \lisa0 \saauto1 \widctlpar \aspalpha \aspnum \adjustright \lin0 \rin0 \itap0 \fs18 \kerning0 \dbch \af1 \hich \af1 \loch \f1 \lang1033 \langnp1033 \langfe2052 \langfenp2052 \sbasedon0 \snext19 {\uc1 \u101 ?}{\uc1 \u120 ?}{\uc1 \u116 ?}{\uc1 \u114 ?}{\uc1 \u97 ?}{\uc1 \u99 ?}{\uc1 \u116 ?}{\uc1 \u50 ?}{\uc1 \u59 ?}}
+}
+
+{\info
+{\title {\uc1 \u21414 ?}{\uc1 \u38376 ?}{\uc1 \u38056 ?}{\uc1 \u19994 ?}{\uc1 \u32929 ?}{\uc1 \u20221 ?}{\uc1 \u26377 ?}{\uc1 \u38480 ?}{\uc1 \u20844 ?}{\uc1 \u21496 ?}}
+{\author {\uc1 \u65 ?}{\uc1 \u108 ?}{\uc1 \u110 ?}{\uc1 \u32 ?}{\uc1 \u76 ?}{\uc1 \u105 ?}{\uc1 \u110 ?}{\uc1 \u32 ?}{\uc1 \u40 ?}{\uc1 \u66 ?}{\uc1 \u101 ?}{\uc1 \u105 ?}{\uc1 \u32 ?}{\uc1 \u74 ?}{\uc1 \u105 ?}{\uc1 \u110 ?}{\uc1 \u103 ?}{\uc1 \u41 ?}}
+{\operator {\uc1 \u106 ?}{\uc1 \u97 ?}{\uc1 \u121 ?}}
+}
+
+
+{\loch \af11 \hich \af11 \dbch \f11
+{\uc1 \u21414 ?}{\uc1 \u38376 ?}{\uc1 \u38056 ?}{\uc1 \u19994 ?}{\uc1 \u32929 ?}{\uc1 \u20221 ?}{\uc1 \u26377 ?}{\uc1 \u38480 ?}{\uc1 \u20844 ?}{\uc1 \u21496 ?}
+}
+\par
+
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 9784736..14a8728 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1323,6 +1323,28 @@ DECLARE_RTFIMPORT_TEST(testN823675, "n823675.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("Symbol"), aFont.Name);
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo77996, "fdo77996.rtf")
+{
+    // all styles were imported as name "0"
+    uno::Reference<container::XNameAccess> xChars(getStyles("CharacterStyles"));
+    CPPUNIT_ASSERT(!xChars->hasByName("0"));
+    CPPUNIT_ASSERT(xChars->hasByName("strong"));
+    CPPUNIT_ASSERT(xChars->hasByName("author"));
+    uno::Reference<container::XNameAccess> xParas(getStyles("ParagraphStyles"));
+    CPPUNIT_ASSERT(!xParas->hasByName("0"));
+    CPPUNIT_ASSERT(xParas->hasByName("extract2"));
+    // some document properties were lost
+    uno::Reference<document::XDocumentPropertiesSupplier> xDocumentPropertiesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<document::XDocumentProperties> xProps(xDocumentPropertiesSupplier->getDocumentProperties());
+    CPPUNIT_ASSERT_EQUAL(OUString("Aln Lin (Bei Jing)"), xProps->getAuthor());
+    CPPUNIT_ASSERT_EQUAL(
+        OUString("\xe5\x8e\xa6\xe9\x97\xa8\xe9\x92\xa8\xe4\xb8\x9a\xe8\x82\xa1\xe4\xbb\xbd\xe6\x9c\x89\xe9\x99\x90\xe5\x85\xac\xe5\x8f\xb8", 30,
+            RTL_TEXTENCODING_UTF8),
+        xProps->getTitle());
+    uno::Reference<beans::XPropertySet> xUDProps(xProps->getUserDefinedProperties(), uno::UNO_QUERY);
+    CPPUNIT_ASSERT_EQUAL(OUString("jay"), getProperty<OUString>(xUDProps, "Operator"));
+}
+
 DECLARE_RTFIMPORT_TEST(testFdo47802, "fdo47802.rtf")
 {
     uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 879bc22..f25e518 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -705,7 +705,9 @@ int RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XSh
         int b = 0, count = 2;
 
         // Feed the destination text to a stream.
-        OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
+        OString aStr = OUStringToOString(
+                m_aStates.top().aDestinationText.makeStringAndClear(),
+                RTL_TEXTENCODING_ASCII_US);
         const char* str = aStr.getStr();
         for (int i = 0; i < aStr.getLength(); ++i)
         {
@@ -1093,12 +1095,12 @@ void RTFDocumentImpl::text(OUString& rString)
     bool bRet = true;
     switch (m_aStates.top().nDestinationState)
     {
+        // Note: in fonttbl there may or may not be groups; in stylesheet
+        // and revtbl groups are mandatory
     case DESTINATION_FONTTABLE:
     case DESTINATION_FONTENTRY:
-    case DESTINATION_STYLESHEET:
     case DESTINATION_STYLEENTRY:
     case DESTINATION_LISTNAME:
-    case DESTINATION_REVISIONTABLE:
     case DESTINATION_REVISIONENTRY:
     {
         // ; is the end of the entry
@@ -1108,15 +1110,16 @@ void RTFDocumentImpl::text(OUString& rString)
             rString = rString.copy(0, rString.getLength() - 1);
             bEnd = true;
         }
-        m_aStates.top().aDestinationText.append(rString);
+        m_aStates.top().pDestinationText->append(rString);
         if (bEnd)
         {
+            // always clear, necessary in case of group-less fonttable
+            OUString const aName = m_aStates.top().pDestinationText->makeStringAndClear();
             switch (m_aStates.top().nDestinationState)
             {
             case DESTINATION_FONTTABLE:
             case DESTINATION_FONTENTRY:
             {
-                OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
                 m_aFontNames[m_nCurrentFontIndex] = aName;
                 if (m_nCurrentEncoding > 0)
                 {
@@ -1139,11 +1142,9 @@ void RTFDocumentImpl::text(OUString& rString)
                     m_aFontTableEntries.insert(lb, make_pair(m_nCurrentFontIndex, pProp));
             }
             break;
-            case DESTINATION_STYLESHEET:
             case DESTINATION_STYLEENTRY:
                 if (m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type))
                 {
-                    OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
                     m_aStyleNames[m_nCurrentStyleIndex] = aName;
                     RTFValue::Pointer_t pValue(new RTFValue(aName));
                     m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue);
@@ -1159,11 +1160,9 @@ void RTFDocumentImpl::text(OUString& rString)
                 break;
             case DESTINATION_LISTNAME:
                 // TODO: what can be done with a list name?
-                m_aStates.top().aDestinationText.makeStringAndClear();
                 break;
-            case DESTINATION_REVISIONTABLE:
             case DESTINATION_REVISIONENTRY:
-                m_aAuthors[m_aAuthors.size()] = m_aStates.top().aDestinationText.makeStringAndClear();
+                m_aAuthors[m_aAuthors.size()] = aName;
                 break;
             default:
                 break;
@@ -1213,7 +1212,7 @@ void RTFDocumentImpl::text(OUString& rString)
     case DESTINATION_MSUPHIDE:
     case DESTINATION_MTYPE:
     case DESTINATION_MGROW:
-        m_aStates.top().aDestinationText.append(rString);
+        m_aStates.top().pDestinationText->append(rString);
         break;
     default:
         bRet = false;
@@ -1243,7 +1242,7 @@ void RTFDocumentImpl::text(OUString& rString)
     // Don't return earlier, a bookmark start has to be in a paragraph group.
     if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKSTART)
     {
-        m_aStates.top().aDestinationText.append(rString);
+        m_aStates.top().pDestinationText->append(rString);
         return;
     }
 
@@ -1962,6 +1961,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
     break;
     }
 
+    // new destination => use new destination text
+    m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
+
     return 0;
 }
 
@@ -4681,19 +4683,23 @@ int RTFDocumentImpl::pushState()
     else
     {
         if (m_aStates.top().nDestinationState == DESTINATION_MR)
-            lcl_DestinationToMath(m_aStates.top().aDestinationText, m_aMathBuffer, m_bMathNor);
+            lcl_DestinationToMath(*m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor);
         m_aStates.push(m_aStates.top());
     }
-    m_aStates.top().aDestinationText.setLength(0);
+    m_aStates.top().aDestinationText.setLength(0); // was copied: always reset!
 
     m_pTokenizer->pushGroup();
 
     switch (m_aStates.top().nDestinationState)
     {
     case DESTINATION_FONTTABLE:
+        // this is a "faked" destination for the font entry
+        m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
         m_aStates.top().nDestinationState = DESTINATION_FONTENTRY;
         break;
     case DESTINATION_STYLESHEET:
+        // this is a "faked" destination for the style sheet entry
+        m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
         m_aStates.top().nDestinationState = DESTINATION_STYLEENTRY;
         {
             // the *default* is \s0 i.e. paragraph style default
@@ -4722,6 +4728,8 @@ int RTFDocumentImpl::pushState()
         m_aStates.top().nDestinationState = DESTINATION_MR;
         break;
     case DESTINATION_REVISIONTABLE:
+        // this is a "faked" destination for the revision table entry
+        m_aStates.top().pDestinationText = &m_aStates.top().aDestinationText;
         m_aStates.top().nDestinationState = DESTINATION_REVISIONENTRY;
         break;
     default:
@@ -4835,7 +4843,9 @@ int RTFDocumentImpl::popState()
         break;
     case DESTINATION_LEVELTEXT:
     {
-        OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
 
         // The first character is the length of the string (the rest should be ignored).
         sal_Int32 nLength(aStr.toChar());
@@ -4874,12 +4884,15 @@ int RTFDocumentImpl::popState()
         }
         break;
     case DESTINATION_SHAPEPROPERTYNAME:
-        aState.aShape.aProperties.push_back(make_pair(m_aStates.top().aDestinationText.makeStringAndClear(), OUString()));
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        aState.aShape.aProperties.push_back(make_pair(
+            m_aStates.top().pDestinationText->makeStringAndClear(), OUString()));
         break;
     case DESTINATION_SHAPEPROPERTYVALUE:
         if (aState.aShape.aProperties.size())
         {
-            aState.aShape.aProperties.back().second = m_aStates.top().aDestinationText.makeStringAndClear();
+            aState.aShape.aProperties.back().second = m_aStates.top().pDestinationText->makeStringAndClear();
             if (m_aStates.top().bHadShapeText)
                 m_pSdrImport->append(aState.aShape.aProperties.back().first, aState.aShape.aProperties.back().second);
             else if (aState.bInShapeGroup && !aState.bInShape && aState.aShape.aProperties.back().first == "rotation")
@@ -4908,30 +4921,40 @@ int RTFDocumentImpl::popState()
         break;
     case DESTINATION_BOOKMARKSTART:
     {
-        OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
         int nPos = m_aBookmarks.size();
         m_aBookmarks[aStr] = nPos;
         Mapper().props(lcl_getBookmarkProperties(nPos, aStr));
     }
     break;
     case DESTINATION_BOOKMARKEND:
-        Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().aDestinationText.makeStringAndClear()]));
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().pDestinationText->makeStringAndClear()]));
         break;
     case DESTINATION_FORMFIELDNAME:
     {
-        RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()));
         m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue);
     }
     break;
     case DESTINATION_FORMFIELDLIST:
     {
-        RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().pDestinationText->makeStringAndClear()));
         m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue);
     }
     break;
     case DESTINATION_DATAFIELD:
     {
-        OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), aState.nCurrentEncoding);
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), aState.nCurrentEncoding);
         // decode hex dump
         OStringBuffer aBuf;
         const char* str = aStr.getStr();
@@ -4999,30 +5022,51 @@ int RTFDocumentImpl::popState()
             m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState));
         break;
     case DESTINATION_AUTHOR:
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
         if (m_xDocumentProperties.is())
-            m_xDocumentProperties->setAuthor(m_aStates.top().aDestinationText.makeStringAndClear());
+            m_xDocumentProperties->setAuthor(m_aStates.top().pDestinationText->makeStringAndClear());
         break;
     case DESTINATION_KEYWORDS:
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
         if (m_xDocumentProperties.is())
-            m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().aDestinationText.makeStringAndClear()));
+            m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().pDestinationText->makeStringAndClear()));
         break;
     case DESTINATION_COMMENT:
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
         if (m_xDocumentProperties.is())
-            m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear());
+            m_xDocumentProperties->setGenerator(m_aStates.top().pDestinationText->makeStringAndClear());
         break;
     case DESTINATION_SUBJECT:
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
         if (m_xDocumentProperties.is())
-            m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear());
+            m_xDocumentProperties->setSubject(m_aStates.top().pDestinationText->makeStringAndClear());
         break;
+    case DESTINATION_TITLE:
+    {
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        if (m_xDocumentProperties.is())
+            m_xDocumentProperties->setTitle(aState.pDestinationText->makeStringAndClear());
+    }
+    break;
+
     case DESTINATION_DOCCOMM:
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
         if (m_xDocumentProperties.is())
-            m_xDocumentProperties->setDescription(m_aStates.top().aDestinationText.makeStringAndClear());
+            m_xDocumentProperties->setDescription(m_aStates.top().pDestinationText->makeStringAndClear());
         break;
     case DESTINATION_OPERATOR:
     case DESTINATION_COMPANY:
     {
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
         OUString aName = aState.nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
-        uno::Any aValue = uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear());
+        uno::Any aValue = uno::makeAny(m_aStates.top().pDestinationText->makeStringAndClear());
         if (m_xDocumentProperties.is())
         {
             uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
@@ -5037,11 +5081,14 @@ int RTFDocumentImpl::popState()
     break;
     case DESTINATION_OBJDATA:
     {
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+
         m_pObjectData.reset(new SvMemoryStream());
         int b = 0, count = 2;
 
         // Feed the destination text to a stream.
-        OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
+        OString aStr = OUStringToOString(m_aStates.top().pDestinationText->makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
         const char* str = aStr.getStr();
         for (int i = 0; i < aStr.getLength(); ++i)
         {
@@ -5119,7 +5166,9 @@ int RTFDocumentImpl::popState()
     break;
     case DESTINATION_ANNOTATIONDATE:
     {
-        OUString aStr(OStringToOUString(lcl_DTTM22OString(m_aStates.top().aDestinationText.makeStringAndClear().toInt32()),
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OUString aStr(OStringToOUString(lcl_DTTM22OString(m_aStates.top().pDestinationText->makeStringAndClear().toInt32()),
                                         aState.nCurrentEncoding));
         RTFValue::Pointer_t pValue(new RTFValue(aStr));
         RTFSprms aAnnAttributes;
@@ -5129,15 +5178,21 @@ int RTFDocumentImpl::popState()
     }
     break;
     case DESTINATION_ANNOTATIONAUTHOR:
-        m_aAuthor = m_aStates.top().aDestinationText.makeStringAndClear();
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        m_aAuthor = m_aStates.top().pDestinationText->makeStringAndClear();
         break;
     case DESTINATION_ATNID:
-        m_aAuthorInitials = m_aStates.top().aDestinationText.makeStringAndClear();
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        m_aAuthorInitials = m_aStates.top().pDestinationText->makeStringAndClear();
         break;
     case DESTINATION_ANNOTATIONREFERENCESTART:
     case DESTINATION_ANNOTATIONREFERENCEEND:
     {
-        OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
         RTFValue::Pointer_t pValue(new RTFValue(aStr.toInt32()));
         RTFSprms aAttributes;
         if (aState.nDestinationState == DESTINATION_ANNOTATIONREFERENCESTART)
@@ -5150,7 +5205,9 @@ int RTFDocumentImpl::popState()
     break;
     case DESTINATION_ANNOTATIONREFERENCE:
     {
-        OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OUString aStr = m_aStates.top().pDestinationText->makeStringAndClear();
         RTFSprms aAnnAttributes;
         aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, RTFValue::Pointer_t(new RTFValue(aStr.toInt32())));
         Mapper().props(writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAnnAttributes)));
@@ -5158,7 +5215,9 @@ int RTFDocumentImpl::popState()
     break;
     case DESTINATION_FALT:
     {
-        OUString aStr(m_aStates.top().aDestinationText.makeStringAndClear());
+        if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+            break; // not for nested group
+        OUString aStr(m_aStates.top().pDestinationText->makeStringAndClear());
         RTFValue::Pointer_t pValue(new RTFValue(aStr));
         aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue);
     }
@@ -5250,7 +5309,7 @@ int RTFDocumentImpl::popState()
     }
     break;
     case DESTINATION_MR:
-        lcl_DestinationToMath(m_aStates.top().aDestinationText, m_aMathBuffer, m_bMathNor);
+        lcl_DestinationToMath(*m_aStates.top().pDestinationText, m_aMathBuffer, m_bMathNor);
         break;
     case DESTINATION_MF:
         m_aMathBuffer.appendClosingTag(M_TOKEN(f));
@@ -5330,7 +5389,7 @@ int RTFDocumentImpl::popState()
         }
 
         oox::formulaimport::XmlStream::AttributeList aAttribs;
-        aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear();
+        aAttribs[M_TOKEN(val)] = m_aStates.top().pDestinationText->makeStringAndClear();
         m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs);
         m_aMathBuffer.appendClosingTag(nMathToken);
     }
@@ -5561,12 +5620,14 @@ int RTFDocumentImpl::popState()
     break;
     case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
     {
+        // FIXME: don't use pDestinationText, points to popped state
         RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
         m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue);
     }
     break;
     case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
     {
+        // FIXME: don't use pDestinationText, points to popped state
         RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
         m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
     }
@@ -5633,6 +5694,7 @@ int RTFDocumentImpl::popState()
     case DESTINATION_SHAPEPROPERTYVALUEPICT:
     {
         m_aStates.top().aPicture = aState.aPicture;
+        // both \sp and \sv are destinations, copy the text up-ward for later
         m_aStates.top().aDestinationText = aState.aDestinationText;
     }
     break;
@@ -5663,15 +5725,6 @@ int RTFDocumentImpl::popState()
             m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_numPicBullet, pValue, OVERWRITE_NO_APPEND);
         }
         break;
-    case DESTINATION_TITLE:
-    {
-        if (m_aStates.top().nDestinationState == DESTINATION_TITLE)
-            // The parent is a title as well, just append what we have so far.
-            m_aStates.top().aDestinationText.append(aState.aDestinationText.makeStringAndClear());
-        else if (m_xDocumentProperties.is())
-            m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear());
-    }
-    break;
     case DESTINATION_SHAPETEXT:
         // If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject.
         if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT && !m_aStates.top().aDrawingObject.bHadShapeText)
@@ -5747,6 +5800,8 @@ void RTFDocumentImpl::setDestinationState(RTFDestinationState nDestinationState)
     m_aStates.top().nDestinationState = nDestinationState;
 }
 
+// this is a questionably named method that is used only in a very special
+// situation where it looks like the "current" buffer is needed?
 void RTFDocumentImpl::setDestinationText(OUString& rString)
 {
     m_aStates.top().aDestinationText.setLength(0);
@@ -5815,6 +5870,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
       nDay(0),
       nHour(0),
       nMinute(0),
+      pDestinationText(0),
       nCurrentStyleIndex(-1),
       pCurrentBuffer(0),
       bInListpicture(false),
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 39a6654..94f43bf 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -270,6 +270,8 @@ public:
 
     /// Text from special destinations.
     OUStringBuffer aDestinationText;
+    /// point to the buffer of the current destination
+    OUStringBuffer * pDestinationText;
 
     /// Index of the current style.
     int nCurrentStyleIndex;
commit 78234837352b9417573a4bd1efa8cfe68902e24b
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 22:27:29 2014 +0200

    writerfilter: pass uno::Reference by reference, more dmapper...
    
    Change-Id: I9eba51e3fe2a50488d2ff9320bf68fe6ae65040d

diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
index 28e413a..7692597 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.cxx
@@ -83,7 +83,8 @@ static void  lcl_printProperties( PropertyMapPtr pProps )
 }
 #endif
 
-DomainMapperTableHandler::DomainMapperTableHandler(TextReference_t xText, DomainMapper_Impl& rDMapper_Impl)
+DomainMapperTableHandler::DomainMapperTableHandler(TextReference_t const& xText,
+            DomainMapper_Impl& rDMapper_Impl)
     : m_xText(xText),
         m_rDMapper_Impl( rDMapper_Impl ),
         m_nCellIndex(0),
@@ -923,7 +924,8 @@ RowPropertyValuesSeq_t DomainMapperTableHandler::endTableGetRowProperties()
 }
 
 // Apply paragraph property to each paragraph within a cell.
-static void lcl_ApplyCellParaProps(uno::Reference<table::XCell> xCell, uno::Any aBottomMargin)
+static void lcl_ApplyCellParaProps(uno::Reference<table::XCell> const& xCell,
+        uno::Any aBottomMargin)
 {
     uno::Reference<container::XEnumerationAccess> xEnumerationAccess(xCell, uno::UNO_QUERY);
     uno::Reference<container::XEnumeration> xEnumeration = xEnumerationAccess->createEnumeration();
diff --git a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
index 8c0f9d5..71ce8ef 100644
--- a/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
+++ b/writerfilter/source/dmapper/DomainMapperTableHandler.hxx
@@ -90,7 +90,8 @@ class DomainMapperTableHandler : public TableDataHandler<Handle_t , TablePropert
 public:
     typedef boost::shared_ptr<DomainMapperTableHandler> Pointer_t;
 
-    DomainMapperTableHandler(TextReference_t xText, DomainMapper_Impl& rDMapper_Impl);
+    DomainMapperTableHandler(TextReference_t const& xText,
+                             DomainMapper_Impl& rDMapper_Impl);
     virtual ~DomainMapperTableHandler();
 
     virtual void startTable(unsigned int nRows, unsigned int nDepth,
diff --git a/writerfilter/source/dmapper/FormControlHelper.cxx b/writerfilter/source/dmapper/FormControlHelper.cxx
index 74df8fb..54c6b4a 100644
--- a/writerfilter/source/dmapper/FormControlHelper.cxx
+++ b/writerfilter/source/dmapper/FormControlHelper.cxx
@@ -129,19 +129,19 @@ uno::Reference<container::XIndexContainer> FormControlHelper::FormControlHelper_
 }
 
 FormControlHelper::FormControlHelper(FieldId eFieldId,
-                                     uno::Reference<text::XTextDocument> rTextDocument,
+                                     uno::Reference<text::XTextDocument> const& xTextDocument,
                                      FFDataHandler::Pointer_t pFFData)
     : m_pFFData(pFFData), m_pImpl(new FormControlHelper_Impl)
 {
     m_pImpl->m_eFieldId = eFieldId;
-    m_pImpl->rTextDocument = rTextDocument;
+    m_pImpl->rTextDocument = xTextDocument;
 }
 
 FormControlHelper::~FormControlHelper()
 {
 }
 
-bool FormControlHelper::createCheckbox(uno::Reference<text::XTextRange> xTextRange,
+bool FormControlHelper::createCheckbox(uno::Reference<text::XTextRange> const& xTextRange,
                                        const OUString & rControlName)
 {
     if ( !m_pFFData )
@@ -206,7 +206,7 @@ bool FormControlHelper::createCheckbox(uno::Reference<text::XTextRange> xTextRan
     return true;
 }
 
-bool FormControlHelper::processField(uno::Reference<text::XFormField> xFormField)
+bool FormControlHelper::processField(uno::Reference<text::XFormField> const& xFormField)
 {
     bool bRes = true;
     uno::Reference<container::XNameContainer> xNameCont = xFormField->getParameters();
@@ -260,7 +260,7 @@ bool FormControlHelper::processField(uno::Reference<text::XFormField> xFormField
     return bRes;
 }
 
-bool FormControlHelper::insertControl(uno::Reference<text::XTextRange> xTextRange)
+bool FormControlHelper::insertControl(uno::Reference<text::XTextRange> const& xTextRange)
 {
     bool bCreated = false;
     if ( !m_pFFData )
diff --git a/writerfilter/source/dmapper/FormControlHelper.hxx b/writerfilter/source/dmapper/FormControlHelper.hxx
index a3a683f..2ff0ad1 100644
--- a/writerfilter/source/dmapper/FormControlHelper.hxx
+++ b/writerfilter/source/dmapper/FormControlHelper.hxx
@@ -33,12 +33,12 @@ class FormControlHelper
 public:
     typedef boost::shared_ptr<FormControlHelper> Pointer_t;
     FormControlHelper(FieldId eFieldId,
-                      css::uno::Reference<css::text::XTextDocument> rTextDocument,
+                      css::uno::Reference<css::text::XTextDocument> const& rTextDocument,
                       FFDataHandler::Pointer_t pFFData);
     ~FormControlHelper();
 
-    bool insertControl(css::uno::Reference<css::text::XTextRange> xTextRange);
-    bool processField(css::uno::Reference<css::text::XFormField> xFormField);
+    bool insertControl(css::uno::Reference<css::text::XTextRange> const& xTextRange);
+    bool processField(css::uno::Reference<css::text::XFormField> const& xFormField);
     bool hasFFDataHandler() const { return (m_pFFData != 0); }
 private:
     FFDataHandler::Pointer_t m_pFFData;
@@ -46,9 +46,9 @@ private:
     typedef boost::shared_ptr<FormControlHelper_Impl> ImplPointer_t;
     ImplPointer_t m_pImpl;
 
-    bool createCheckbox(css::uno::Reference<css::text::XTextRange> xTextRange,
+    bool createCheckbox(css::uno::Reference<css::text::XTextRange> const& xTextRange,
                         const OUString & rControlName);
-    bool createDropdown(css::uno::Reference<css::text::XTextRange> xTextRange,
+    bool createDropdown(css::uno::Reference<css::text::XTextRange> const& xTextRange,
                         const OUString & rControlName);
 };
 
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index d34c0b9..7fc2066 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -421,7 +421,7 @@ void NumPicBullet::SetId(sal_Int32 nId)
     m_nId = nId;
 }
 
-void NumPicBullet::SetShape(uno::Reference<drawing::XShape> xShape)
+void NumPicBullet::SetShape(uno::Reference<drawing::XShape> const& xShape)
 {
     m_xShape = xShape;
 }
@@ -527,7 +527,7 @@ uno::Sequence< uno::Sequence< beans::PropertyValue > > ListDef::GetPropertyValue
 }
 
 uno::Reference< container::XNameContainer > lcl_getUnoNumberingStyles(
-       uno::Reference< lang::XMultiServiceFactory > xFactory )
+       uno::Reference<lang::XMultiServiceFactory> const& xFactory)
 {
     uno::Reference< container::XNameContainer > xStyles;
 
@@ -546,7 +546,7 @@ uno::Reference< container::XNameContainer > lcl_getUnoNumberingStyles(
 }
 
 void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
-        uno::Reference< lang::XMultiServiceFactory> xFactory )
+        uno::Reference<lang::XMultiServiceFactory> const& xFactory)
 {
     // Get the UNO Numbering styles
     uno::Reference< container::XNameContainer > xStyles = lcl_getUnoNumberingStyles( xFactory );
@@ -688,7 +688,7 @@ void ListDef::CreateNumberingRules( DomainMapper& rDMapper,
 
 
 ListsManager::ListsManager(DomainMapper& rDMapper,
-    const uno::Reference< lang::XMultiServiceFactory > xFactory)
+    const uno::Reference<lang::XMultiServiceFactory> & xFactory)
     : LoggedProperties(dmapper_logger, "ListsManager")
     , LoggedTable(dmapper_logger, "ListsManager")
     , m_rDMapper(rDMapper)
diff --git a/writerfilter/source/dmapper/NumberingManager.hxx b/writerfilter/source/dmapper/NumberingManager.hxx
index 3eff441..5a180cf 100644
--- a/writerfilter/source/dmapper/NumberingManager.hxx
+++ b/writerfilter/source/dmapper/NumberingManager.hxx
@@ -80,7 +80,7 @@ public:
     void SetValue( Id nId, sal_Int32 nValue );
     void SetBulletChar( const OUString& sValue ) { m_sBulletChar = sValue; };
     void SetGraphicURL( const OUString& sValue ) { m_sGraphicURL = sValue; };
-    void SetGraphicBitmap( com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic > sValue )
+    void SetGraphicBitmap( com::sun::star::uno::Reference< com::sun::star::graphic::XGraphic > const& sValue )
         { m_sGraphicBitmap = sValue; }
     void SetParaStyle( boost::shared_ptr< StyleSheetEntry > pStyle );
     void AddRGBXchNums( const OUString& sValue ) { m_sRGBXchNums += sValue; };
@@ -119,7 +119,7 @@ public:
 
     void SetId(sal_Int32 nId);
     sal_Int32 GetId() { return m_nId;}
-    void SetShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> xShape);
+    void SetShape(com::sun::star::uno::Reference<com::sun::star::drawing::XShape> const& xShape);
     com::sun::star::uno::Reference<com::sun::star::drawing::XShape> GetShape() { return m_xShape;}
 private:
     sal_Int32 m_nId;
@@ -203,7 +203,7 @@ public:
     void CreateNumberingRules(
             DomainMapper& rDMapper,
             com::sun::star::uno::Reference<
-                com::sun::star::lang::XMultiServiceFactory> xFactory );
+                com::sun::star::lang::XMultiServiceFactory> const& xFactory );
 
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace >
             GetNumberingRules( ) { return m_xNumRules; };
@@ -246,7 +246,7 @@ public:
 
     ListsManager(
             DomainMapper& rDMapper,
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory);
+            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xFactory);
     virtual ~ListsManager();
 
     typedef boost::shared_ptr< ListsManager >  Pointer;
diff --git a/writerfilter/source/dmapper/SdtHelper.cxx b/writerfilter/source/dmapper/SdtHelper.cxx
index 2b1a111..671e4c2 100644
--- a/writerfilter/source/dmapper/SdtHelper.cxx
+++ b/writerfilter/source/dmapper/SdtHelper.cxx
@@ -135,12 +135,15 @@ void SdtHelper::createDateControl(OUString& rContentText, beans::PropertyValue a
     createControlShape(lcl_getOptimalWidth(m_rDM_Impl.GetStyleSheetTable(), rContentText, aItems), xControlModel, aGrabBag.getAsConstPropertyValueList());
 }
 
-void SdtHelper::createControlShape(awt::Size aSize, uno::Reference<awt::XControlModel> xControlModel)
+void SdtHelper::createControlShape(awt::Size aSize,
+        uno::Reference<awt::XControlModel> const& xControlModel)
 {
     createControlShape(aSize, xControlModel, uno::Sequence<beans::PropertyValue>());
 }
 
-void SdtHelper::createControlShape(awt::Size aSize, uno::Reference<awt::XControlModel> xControlModel, const uno::Sequence<beans::PropertyValue>& rGrabBag)
+void SdtHelper::createControlShape(awt::Size aSize,
+        uno::Reference<awt::XControlModel> const& xControlModel,
+        const uno::Sequence<beans::PropertyValue>& rGrabBag)
 {
     uno::Reference<drawing::XControlShape> xControlShape(m_rDM_Impl.GetTextFactory()->createInstance("com.sun.star.drawing.ControlShape"), uno::UNO_QUERY);
     xControlShape->setSize(aSize);
diff --git a/writerfilter/source/dmapper/SdtHelper.hxx b/writerfilter/source/dmapper/SdtHelper.hxx
index 08f87a4..11c879a 100644
--- a/writerfilter/source/dmapper/SdtHelper.hxx
+++ b/writerfilter/source/dmapper/SdtHelper.hxx
@@ -62,8 +62,10 @@ class SdtHelper
     bool m_bHasElements;
 
     /// Create and append the drawing::XControlShape, containing the various models.
-    void createControlShape(com::sun::star::awt::Size aSize, com::sun::star::uno::Reference<com::sun::star::awt::XControlModel>);
-    void createControlShape(com::sun::star::awt::Size aSize, com::sun::star::uno::Reference<com::sun::star::awt::XControlModel>,
+    void createControlShape(com::sun::star::awt::Size aSize,
+        com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> const&);
+    void createControlShape(com::sun::star::awt::Size aSize,
+        com::sun::star::uno::Reference<com::sun::star::awt::XControlModel> const&,
                             const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rGrabBag);
 public:
     SdtHelper(DomainMapper_Impl& rDM_Impl);
diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx
index 07ad91a..48492ed 100644
--- a/writerfilter/source/dmapper/SettingsTable.cxx
+++ b/writerfilter/source/dmapper/SettingsTable.cxx
@@ -82,7 +82,7 @@ struct SettingsTable_Impl
     uno::Sequence<beans::PropertyValue> m_pCompatSettings;
     uno::Sequence<beans::PropertyValue> m_pCurrentCompatSetting;
 
-    SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory ) :
+    SettingsTable_Impl( DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > & xTextFactory ) :
     m_rDMapper( rDMapper )
     , m_xTextFactory( xTextFactory )
     , m_nDefaultTabStop( 720 ) //default is 1/2 in
@@ -115,7 +115,7 @@ struct SettingsTable_Impl
 
 };
 
-SettingsTable::SettingsTable(DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > xTextFactory)
+SettingsTable::SettingsTable(DomainMapper& rDMapper, const uno::Reference< lang::XMultiServiceFactory > & xTextFactory)
 : LoggedProperties(dmapper_logger, "SettingsTable")
 , LoggedTable(dmapper_logger, "SettingsTable")
 , m_pImpl( new SettingsTable_Impl(rDMapper, xTextFactory) )
@@ -368,7 +368,7 @@ uno::Sequence<beans::PropertyValue> SettingsTable::GetCompatSettings() const
     return m_pImpl->m_pCompatSettings;
 }
 
-void SettingsTable::ApplyProperties( uno::Reference< text::XTextDocument > xDoc )
+void SettingsTable::ApplyProperties(uno::Reference<text::XTextDocument> const& xDoc)
 {
     uno::Reference< beans::XPropertySet> xDocProps( xDoc, uno::UNO_QUERY );
 
diff --git a/writerfilter/source/dmapper/SettingsTable.hxx b/writerfilter/source/dmapper/SettingsTable.hxx
index 36c9bb5..9c30791 100644
--- a/writerfilter/source/dmapper/SettingsTable.hxx
+++ b/writerfilter/source/dmapper/SettingsTable.hxx
@@ -45,7 +45,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
 
  public:
     SettingsTable(  DomainMapper& rDMapper,
-            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xTextFactory
+            const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xTextFactory
             );
     virtual ~SettingsTable();
 
@@ -77,7 +77,7 @@ class SettingsTable : public LoggedProperties, public LoggedTable
 
     css::uno::Sequence<css::beans::PropertyValue> GetCompatSettings() const;
 
-    void ApplyProperties( css::uno::Reference< css::text::XTextDocument > xDoc );
+    void ApplyProperties(css::uno::Reference<css::text::XTextDocument> const& xDoc);
 
  private:
     // Properties
diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx
index 3ff8e59..36f99ee 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.cxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.cxx
@@ -304,7 +304,7 @@ struct StyleSheetTable_Impl
     ListCharStylePropertyVector_t           m_aListCharStylePropertyVector;
     bool                                    m_bIsNewDoc;
 
-    StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument, bool bIsNewDoc);
+    StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> const& xTextDocument, bool bIsNewDoc);
 
     OUString HasListCharStyle( const PropertyValueVector_t& rCharProperties );
 
@@ -313,7 +313,10 @@ struct StyleSheetTable_Impl
 };
 
 
-StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument, bool bIsNewDoc ) :
+StyleSheetTable_Impl::StyleSheetTable_Impl(DomainMapper& rDMapper,
+        uno::Reference< text::XTextDocument> const& xTextDocument,
+        bool const bIsNewDoc)
+    :
             m_rDMapper( rDMapper ),
             m_xTextDocument( xTextDocument ),
             m_pCurrentEntry(),
@@ -382,7 +385,9 @@ void StyleSheetTable_Impl::AppendLatentStyleProperty(const OUString& aName, Valu
 }
 
 
-StyleSheetTable::StyleSheetTable(DomainMapper& rDMapper, uno::Reference< text::XTextDocument> xTextDocument, bool bIsNewDoc)
+StyleSheetTable::StyleSheetTable(DomainMapper& rDMapper,
+        uno::Reference< text::XTextDocument> const& xTextDocument,
+        bool const bIsNewDoc)
 : LoggedProperties(dmapper_logger, "StyleSheetTable")
 , LoggedTable(dmapper_logger, "StyleSheetTable")
 , m_pImpl( new StyleSheetTable_Impl(rDMapper, xTextDocument, bIsNewDoc) )
diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx
index 482e15d..43b3b43 100644
--- a/writerfilter/source/dmapper/StyleSheetTable.hxx
+++ b/writerfilter/source/dmapper/StyleSheetTable.hxx
@@ -89,7 +89,7 @@ class StyleSheetTable :
 
 public:
     StyleSheetTable( DomainMapper& rDMapper,
-                        ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument> xTextDocument, bool bIsNewDoc );
+                        ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument> const& xTextDocument, bool bIsNewDoc );
     virtual ~StyleSheetTable();
 
     void ApplyStyleSheets( FontTablePtr rFontTable );
commit 8ba92fcd83f351f50e874f01c48f7de3acee971d
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 22:08:46 2014 +0200

    writerfilter: pass uno::Reference by reference in DomainMapper_Impl
    
    Change-Id: I91d0c2ffb958262fad0e7920852449e73d5481ea

diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index bc70082..dd4dc3f 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -77,11 +77,11 @@ class DomainMapper : public LoggedProperties, public LoggedTable,
 
 public:
     DomainMapper(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
-                                ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > xInputStream,
-                                ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xModel,
+                                ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > const& xInputStream,
+                                ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > const& xModel,
                                 bool bRepairStorage,
                                 SourceDocumentType eDocumentType,
-                                ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xInsertTextRange,
+                                ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xInsertTextRange,
                                 bool bIsNewDoc = true);
     virtual ~DomainMapper();
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index cdb65cb..a6c71b1 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -89,11 +89,11 @@ struct _PageSz
 
 
 DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xContext,
-                            uno::Reference< io::XInputStream > xInputStream,
-                            uno::Reference< lang::XComponent > xModel,
+                            uno::Reference<io::XInputStream> const& xInputStream,
+                            uno::Reference<lang::XComponent> const& xModel,
                             bool bRepairStorage,
                             SourceDocumentType eDocumentType,
-                            uno::Reference< text::XTextRange > xInsertTextRange,
+                            uno::Reference<text::XTextRange> const& xInsertTextRange,
                             bool bIsNewDoc ) :
 LoggedProperties(dmapper_logger, "DomainMapper"),
 LoggedTable(dmapper_logger, "DomainMapper"),
@@ -984,7 +984,9 @@ void DomainMapper::lcl_sprm(Sprm & rSprm)
         sprmWithProps( rSprm, m_pImpl->GetTopContext() );
 }
 
-sal_Int32 lcl_getCurrentNumberingProperty(uno::Reference<container::XIndexAccess> xNumberingRules, sal_Int32 nNumberingLevel, const OUString& aProp)
+sal_Int32 lcl_getCurrentNumberingProperty(
+        uno::Reference<container::XIndexAccess> const& xNumberingRules,
+        sal_Int32 nNumberingLevel, const OUString& aProp)
 {
     sal_Int32 nRet = 0;
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index bab9053..edee510 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -145,10 +145,10 @@ uno::Any FloatingTableInfo::getPropertyValue(const OUString &propertyName)
 
 DomainMapper_Impl::DomainMapper_Impl(
             DomainMapper& rDMapper,
-            uno::Reference < uno::XComponentContext >  xContext,
-            uno::Reference< lang::XComponent >  xModel,
+            uno::Reference<uno::XComponentContext> const& xContext,
+            uno::Reference<lang::XComponent> const& xModel,
             SourceDocumentType eDocumentType,
-            uno::Reference< text::XTextRange > xInsertTextRange,
+            uno::Reference<text::XTextRange> const& xInsertTextRange,
             bool bIsNewDoc) :
         m_eDocumentType( eDocumentType ),
         m_rDMapper( rDMapper ),
@@ -718,8 +718,8 @@ bool DomainMapper_Impl::isSdtEndDeferred()
 }
 
 void lcl_MoveBorderPropertiesToFrame(comphelper::SequenceAsHashMap& rFrameProperties,
-    uno::Reference<text::XTextRange> xStartTextRange,
-    uno::Reference<text::XTextRange> xEndTextRange )
+    uno::Reference<text::XTextRange> const& xStartTextRange,
+    uno::Reference<text::XTextRange> const& xEndTextRange )
 {
     try
     {
@@ -763,7 +763,7 @@ void lcl_MoveBorderPropertiesToFrame(comphelper::SequenceAsHashMap& rFrameProper
 
 void lcl_AddRangeAndStyle(
     ParagraphPropertiesPtr& pToBeSavedProperties,
-    uno::Reference< text::XTextAppend > xTextAppend,
+    uno::Reference< text::XTextAppend > const& xTextAppend,
     PropertyMapPtr pPropertyMap,
     TextAppendContext& rAppendContext)
 {
@@ -1265,7 +1265,7 @@ void DomainMapper_Impl::appendTextPortion( const OUString& rString, PropertyMapP
 
 
 void DomainMapper_Impl::appendTextContent(
-    const uno::Reference< text::XTextContent > xContent,
+    const uno::Reference< text::XTextContent >& xContent,
     const uno::Sequence< beans::PropertyValue >& xPropertyValues
     )
 {
@@ -1564,7 +1564,8 @@ void DomainMapper_Impl::PushFootOrEndnote( bool bIsFootnote )
     }
 }
 
-void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange, RedlineParamsPtr& pRedline )
+void DomainMapper_Impl::CreateRedline(uno::Reference<text::XTextRange> const& xRange,
+        RedlineParamsPtr& pRedline)
 {
     if ( pRedline.get( ) )
     {
@@ -1607,7 +1608,7 @@ void DomainMapper_Impl::CreateRedline( uno::Reference< text::XTextRange > xRange
     }
 }
 
-void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange > xRange )
+void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange > const& xRange )
 {
     if ( m_pParaMarkerRedline.get( ) )
     {
@@ -1616,7 +1617,7 @@ void DomainMapper_Impl::CheckParaMarkerRedline( uno::Reference< text::XTextRange
     }
 }
 
-void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > xRange )
+void DomainMapper_Impl::CheckRedline( uno::Reference< text::XTextRange > const& xRange )
 {
     vector<RedlineParamsPtr>::iterator pIt = m_aRedlines.top().begin( );
     vector< RedlineParamsPtr > aCleaned;
@@ -1725,7 +1726,7 @@ void DomainMapper_Impl::PopAnnotation()
     m_nAnnotationId = -1;
 }
 
-void DomainMapper_Impl::PushPendingShape( const uno::Reference< drawing::XShape > xShape )
+void DomainMapper_Impl::PushPendingShape( const uno::Reference< drawing::XShape > & xShape )
 {
     m_aPendingShapes.push_back(xShape);
 }
@@ -1741,7 +1742,7 @@ uno::Reference<drawing::XShape> DomainMapper_Impl::PopPendingShape()
     return xRet;
 }
 
-void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape > xShape )
+void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape > & xShape )
 {
     if (m_aTextAppendStack.empty())
         return;
@@ -1899,7 +1900,7 @@ void DomainMapper_Impl::PushShapeContext( const uno::Reference< drawing::XShape
 /*
  * Updating chart height and width after reading the actual values from wp:extent
 */
-void DomainMapper_Impl::UpdateEmbeddedShapeProps(const uno::Reference< drawing::XShape > xShape)
+void DomainMapper_Impl::UpdateEmbeddedShapeProps(const uno::Reference< drawing::XShape > & xShape)
 {
     if (!xShape.is())
         return;
@@ -2262,7 +2263,8 @@ void DomainMapper_Impl::GetCurrentLocale(lang::Locale& rLocale)
     format to the XPropertySet
   -----------------------------------------------------------------------*/
 void DomainMapper_Impl::SetNumberFormat( const OUString& rCommand,
-                            uno::Reference< beans::XPropertySet >& xPropertySet, bool bDetectFormat )
+        uno::Reference< beans::XPropertySet > const& xPropertySet,
+        bool const bDetectFormat)
 {
     OUString sFormatString = lcl_ParseFormat( rCommand );
     // find \h - hijri/luna calendar todo: what about saka/era calendar?
@@ -2481,8 +2483,8 @@ bool DomainMapper_Impl::IsOpenField() const
 }
 
 
-FieldContext::FieldContext(uno::Reference< text::XTextRange > xStart) :
-    m_bFieldCommandCompleted( false )
+FieldContext::FieldContext(uno::Reference< text::XTextRange > const& xStart)
+    : m_bFieldCommandCompleted(false)
     ,m_xStartRange( xStart )
 {
     m_pProperties.reset(new PropertyMap());
@@ -2696,7 +2698,7 @@ void DomainMapper_Impl::handleFieldAsk
     (FieldContextPtr pContext,
      PropertyNameSupplier& rPropNameSupplier,
      uno::Reference< uno::XInterface > & xFieldInterface,
-     uno::Reference< beans::XPropertySet > xFieldProperties)
+     uno::Reference< beans::XPropertySet > const& xFieldProperties)
 {
     //doesn the command contain a variable name?
     OUString sVariable, sHint;
@@ -2740,7 +2742,7 @@ void DomainMapper_Impl::handleAutoNum
     (FieldContextPtr pContext,
     PropertyNameSupplier& rPropNameSupplier,
     uno::Reference< uno::XInterface > & xFieldInterface,
-    uno::Reference< beans::XPropertySet > xFieldProperties)
+    uno::Reference< beans::XPropertySet > const& xFieldProperties)
 {
     //create a sequence field master "AutoNr"
     uno::Reference< beans::XPropertySet > xMaster =
@@ -2765,7 +2767,7 @@ void DomainMapper_Impl::handleAuthor
     (OUString const& rFirstParam,
     PropertyNameSupplier& rPropNameSupplier,
      uno::Reference< uno::XInterface > & /*xFieldInterface*/,
-     uno::Reference< beans::XPropertySet > xFieldProperties,
+     uno::Reference< beans::XPropertySet > const& xFieldProperties,
      FieldId  eFieldId )
 {
     if ( eFieldId != FIELD_USERINITIALS )
@@ -2786,7 +2788,7 @@ void DomainMapper_Impl::handleAuthor
         OUString const& rFirstParam,
         PropertyNameSupplier& rPropNameSupplier,
         uno::Reference< uno::XInterface > & xFieldInterface,
-        uno::Reference< beans::XPropertySet > xFieldProperties)
+        uno::Reference< beans::XPropertySet > const&)
 {
     //some docproperties should be imported as document statistic fields, some as DocInfo fields
     //others should be user fields
@@ -2852,7 +2854,7 @@ void DomainMapper_Impl::handleAuthor
         }
         if (m_xTextFactory.is())
             xFieldInterface = m_xTextFactory->createInstance(sServiceName);
-        xFieldProperties =
+        uno::Reference<beans::XPropertySet> xFieldProperties =
             uno::Reference< beans::XPropertySet >( xFieldInterface,
                 uno::UNO_QUERY_THROW);
         if( bIsCustomField )
@@ -2937,7 +2939,7 @@ void DomainMapper_Impl::handleToc
     (FieldContextPtr pContext,
     PropertyNameSupplier& rPropNameSupplier,
      uno::Reference< uno::XInterface > & /*xFieldInterface*/,
-     uno::Reference< beans::XPropertySet > /*xFieldProperties*/,
+     uno::Reference< beans::XPropertySet > const& /*xFieldProperties*/,
     const OUString & sTOCServiceName)
 {
     OUString sValue;
@@ -3205,7 +3207,7 @@ void DomainMapper_Impl::handleIndex
     (FieldContextPtr pContext,
     PropertyNameSupplier& rPropNameSupplier,
      uno::Reference< uno::XInterface > & /*xFieldInterface*/,
-     uno::Reference< beans::XPropertySet > /*xFieldProperties*/,
+     uno::Reference< beans::XPropertySet > const& /*xFieldProperties*/,
     const OUString & sTOCServiceName)
 {
     uno::Reference< beans::XPropertySet > xTOC;
@@ -4440,8 +4442,8 @@ _PageMar::_PageMar()
 
 
 void DomainMapper_Impl::RegisterFrameConversion(
-        uno::Reference< text::XTextRange >           xFrameStartRange,
-        uno::Reference< text::XTextRange >           xFrameEndRange,
+        uno::Reference< text::XTextRange > const&    xFrameStartRange,
+        uno::Reference< text::XTextRange > const&    xFrameEndRange,
         const uno::Sequence< beans::PropertyValue >& aFrameProperties
         )
 {
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
index d59306a..ebf7426 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx
@@ -136,7 +136,7 @@ class FieldContext
     PropertyMapPtr m_pProperties;
 
 public:
-    FieldContext(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xStart);
+    FieldContext(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xStart);
     ~FieldContext();
 
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetStartRange() const { return m_xStartRange; }
@@ -151,16 +151,16 @@ public:
     bool                    IsCommandCompleted() const { return m_bFieldCommandCompleted;    }
 
     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   GetCustomField() const { return m_xCustomField; }
-    void    SetCustomField( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >  xCustomField ) { m_xCustomField = xCustomField; }
+    void    SetCustomField( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xCustomField ) { m_xCustomField = xCustomField; }
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField >      GetTextField() const { return m_xTextField;}
-    void    SetTextField(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > xTextField) { m_xTextField = xTextField;}
+    void    SetTextField(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextField > const& xTextField) { m_xTextField = xTextField;}
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField >      GetFormField() const { return m_xFormField;}
-    void    SetFormField(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > xFormField) { m_xFormField = xFormField;}
+    void    SetFormField(::com::sun::star::uno::Reference< ::com::sun::star::text::XFormField > const& xFormField) { m_xFormField = xFormField;}
 
-    void    SetTOC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xTOC ) { m_xTOC = xTOC; }
+    void    SetTOC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xTOC ) { m_xTOC = xTOC; }
     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   GetTOC() { return m_xTOC; }
 
-    void    SetTC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xTC ) { m_xTC = xTC; }
+    void    SetTC( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xTC ) { m_xTC = xTC; }
     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >   GetTC( ) { return m_xTC; }
 
     void    SetHyperlinkURL( const OUString& rURL ) { m_sHyperlinkURL = rURL; }
@@ -229,7 +229,8 @@ struct BookmarkInsertPosition
     bool                                                                    m_bIsStartOfText;
     OUString                                                         m_sBookmarkName;
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >  m_xTextRange;
-    BookmarkInsertPosition(bool bIsStartOfText, const OUString& rName, ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange >  xTextRange):
+    BookmarkInsertPosition(bool bIsStartOfText, const OUString& rName,
+            ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xTextRange):
         m_bIsStartOfText( bIsStartOfText ),
         m_sBookmarkName( rName ),
         m_xTextRange( xTextRange )
@@ -283,7 +284,10 @@ struct FloatingTableInfo
     css::uno::Sequence<css::beans::PropertyValue> m_aFrameProperties;
     sal_Int32 m_nTableWidth;
 
-    FloatingTableInfo(css::uno::Reference<css::text::XTextRange> xStart, css::uno::Reference<css::text::XTextRange> xEnd, const css::uno::Sequence<css::beans::PropertyValue>& aFrameProperties, sal_Int32 nTableWidth)
+    FloatingTableInfo(css::uno::Reference<css::text::XTextRange> const& xStart,
+            css::uno::Reference<css::text::XTextRange> const& xEnd,
+            const css::uno::Sequence<css::beans::PropertyValue>& aFrameProperties,
+            sal_Int32 nTableWidth)
         : m_xStart(xStart),
         m_xEnd(xEnd),
         m_aFrameProperties(aFrameProperties),
@@ -410,7 +414,8 @@ private:
 
     void                            GetCurrentLocale(::com::sun::star::lang::Locale& rLocale);
     void                            SetNumberFormat( const OUString& rCommand,
-                                        ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xPropertySet, bool bDetectFormat = false );
+                                        ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xPropertySet,
+                                        bool bDetectFormat = false );
     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >
                                     FindOrCreateFieldMaster( const sal_Char* pFieldMasterService,
                                                             const OUString& rFieldMasterName )
@@ -426,10 +431,10 @@ private:
 public:
     DomainMapper_Impl(
             DomainMapper& rDMapper,
-            css::uno::Reference < css::uno::XComponentContext >  xContext,
-            css::uno::Reference< css::lang::XComponent >  xModel,
+            css::uno::Reference < css::uno::XComponentContext > const& xContext,
+            css::uno::Reference< css::lang::XComponent > const& xModel,
             SourceDocumentType eDocumentType,
-            css::uno::Reference< css::text::XTextRange > xInsertTextRange,
+            css::uno::Reference< css::text::XTextRange > const& xInsertTextRange,
             bool bIsNewDoc );
     virtual ~DomainMapper_Impl();
 
@@ -454,11 +459,11 @@ public:
     }
     void SetDocumentSettingsProperty( const OUString& rPropName, const css::uno::Any& rValue );
 
-    void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange, RedlineParamsPtr& pRedline  );
+    void CreateRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xRange, RedlineParamsPtr& pRedline  );
 
-    void CheckParaMarkerRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
+    void CheckParaMarkerRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xRange );
 
-    void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xRange );
+    void CheckRedline( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xRange );
 
     void StartParaMarkerChange( );
     void EndParaMarkerChange( );
@@ -498,7 +503,7 @@ public:
 
     void finishParagraph( PropertyMapPtr pPropertyMap );
     void appendTextPortion( const OUString& rString, PropertyMapPtr pPropertyMap );
-    void appendTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >,
+    void appendTextContent( const ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent >&,
                             const css::uno::Sequence< css::beans::PropertyValue >& );
     void appendOLE( const OUString& rStreamName, OLEHandlerPtr pOleHandler );
     void appendStarMath( const Value& v );
@@ -568,11 +573,11 @@ public:
     bool        IsAnyTableImport()const { return m_bInAnyTableImport;}
     bool        IsInShape()const { return m_aAnchoredStack.size() > 0;}
 
-    void PushShapeContext( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+    void PushShapeContext( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape );
     void PopShapeContext();
-    void UpdateEmbeddedShapeProps( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+    void UpdateEmbeddedShapeProps( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape );
     /// Add a pending shape: it's currently inserted into the document, but it should be removed before the import finishes.
-    void PushPendingShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
+    void PushPendingShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape );
     /// Get the first pending shape, if there are any.
     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > PopPendingShape();
 
@@ -600,35 +605,35 @@ public:
         (FieldContextPtr pContext,
         PropertyNameSupplier& rPropNameSupplier,
         css::uno::Reference< css::uno::XInterface > & xFieldInterface,
-        css::uno::Reference< css::beans::XPropertySet > xFieldProperties);
+        css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
     void handleAutoNum
         (FieldContextPtr pContext,
         PropertyNameSupplier& rPropNameSupplier,
         css::uno::Reference< css::uno::XInterface > & xFieldInterface,
-        css::uno::Reference< css::beans::XPropertySet > xFieldProperties);
+        css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
     void handleAuthor
         (OUString const& rFirstParam,
         PropertyNameSupplier& rPropNameSupplier,
         css::uno::Reference< css::uno::XInterface > & xFieldInterface,
-        css::uno::Reference< css::beans::XPropertySet > xFieldProperties,
+        css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties,
         FieldId eFieldId);
     void handleDocProperty
         (FieldContextPtr pContext,
         OUString const& rFirstParam,
         PropertyNameSupplier& rPropNameSupplier,
         css::uno::Reference< css::uno::XInterface > & xFieldInterface,
-        css::uno::Reference< css::beans::XPropertySet > xFieldProperties);
+        css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties);
     void handleToc
         (FieldContextPtr pContext,
         PropertyNameSupplier& rPropNameSupplier,
         css::uno::Reference< css::uno::XInterface > & xFieldInterface,
-        css::uno::Reference< css::beans::XPropertySet > xFieldProperties,
+        css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties,
         const OUString & sTOCServiceName);
     void handleIndex
         (FieldContextPtr pContext,
         PropertyNameSupplier& rPropNameSupplier,
         css::uno::Reference< css::uno::XInterface > & xFieldInterface,
-        css::uno::Reference< css::beans::XPropertySet > xFieldProperties,
+        css::uno::Reference< css::beans::XPropertySet > const& xFieldProperties,
         const OUString & sTOCServiceName);
 
     void handleBibliography
@@ -705,8 +710,8 @@ public:
     void CheckUnregisteredFrameConversion( );
 
     void RegisterFrameConversion(
-        ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameStartRange,
-        ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xFrameEndRange,
+        ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xFrameStartRange,
+        ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xFrameEndRange,
         const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aFrameProperties
         );
     bool ExecuteFrameConversion();
commit a140f3bca681ffcc5944d2b4cb9a81985c59c702
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 21:40:47 2014 +0200

    writerfilter: more pass uno::Reference by reference in dmapper
    
    Change-Id: I71645b208854877fbd5cb29327d467da5cbe0e46

diff --git a/writerfilter/source/dmapper/GraphicHelpers.cxx b/writerfilter/source/dmapper/GraphicHelpers.cxx
index 79ca0d0..4756478 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.cxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.cxx
@@ -260,7 +260,7 @@ sal_Int32 WrapHandler::getWrapMode( )
 }
 
 
-void GraphicZOrderHelper::addItem( uno::Reference< beans::XPropertySet > props, sal_Int32 relativeHeight )
+void GraphicZOrderHelper::addItem(uno::Reference<beans::XPropertySet> const& props, sal_Int32 const relativeHeight)
 {
     items[ relativeHeight ] = props;
 }
diff --git a/writerfilter/source/dmapper/GraphicHelpers.hxx b/writerfilter/source/dmapper/GraphicHelpers.hxx
index e8c4aa5..53c2b6f 100644
--- a/writerfilter/source/dmapper/GraphicHelpers.hxx
+++ b/writerfilter/source/dmapper/GraphicHelpers.hxx
@@ -73,7 +73,8 @@ typedef boost::shared_ptr<WrapHandler> WrapHandlerPtr;
 class GraphicZOrderHelper
 {
 public:
-    void addItem( css::uno::Reference< css::beans::XPropertySet > props, sal_Int32 relativeHeight );
+    void addItem(css::uno::Reference<css::beans::XPropertySet> const& props,
+                 sal_Int32 relativeHeight);
     sal_Int32 findZOrder( sal_Int32 relativeHeight, bool bOldStyle = false );
 private:
     typedef std::map< sal_Int32, css::uno::Reference< css::beans::XPropertySet > > Items;
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 3d9b597..e67b8e9 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -405,8 +405,8 @@ public:
     }
 };
 
-GraphicImport::GraphicImport(uno::Reference<uno::XComponentContext> xComponentContext,
-                             uno::Reference<lang::XMultiServiceFactory> xTextFactory,
+GraphicImport::GraphicImport(uno::Reference<uno::XComponentContext> const& xComponentContext,
+                             uno::Reference<lang::XMultiServiceFactory> const& xTextFactory,
                              DomainMapper& rDMapper,
                              GraphicImportType eImportType,
                              std::queue<OUString>& rPositivePercentages)
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index 53def97..160e417 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -81,8 +81,8 @@ class GraphicImport : public LoggedProperties, public LoggedTable
     void putPropertyToFrameGrabBag( const OUString& sPropertyName, const css::uno::Any& aPropertyValue );
 
 public:
-    explicit GraphicImport( css::uno::Reference<css::uno::XComponentContext> xComponentContext,
-                            css::uno::Reference<css::lang::XMultiServiceFactory> xTextFactory,
+    explicit GraphicImport( css::uno::Reference<css::uno::XComponentContext> const& xComponentContext,
+                            css::uno::Reference<css::lang::XMultiServiceFactory> const& xTextFactory,
                             DomainMapper& rDomainMapper,
                             GraphicImportType eGraphicImportType,
                             std::queue<OUString>& rPositivePercentages);
diff --git a/writerfilter/source/dmapper/OLEHandler.cxx b/writerfilter/source/dmapper/OLEHandler.cxx
index 73b0c6d..a084005 100644
--- a/writerfilter/source/dmapper/OLEHandler.cxx
+++ b/writerfilter/source/dmapper/OLEHandler.cxx
@@ -177,7 +177,7 @@ void OLEHandler::lcl_sprm(Sprm & rSprm)
 }
 
 
-void OLEHandler::saveInteropProperties( uno::Reference< text::XTextDocument > xTextDocument, const OUString& sObjectName )
+void OLEHandler::saveInteropProperties(uno::Reference<text::XTextDocument> const& xTextDocument, const OUString& sObjectName)
 {
     const OUString sGrabBagPropName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG;
     const OUString sEmbeddingsPropName = "EmbeddedObjects";
@@ -225,7 +225,8 @@ void OLEHandler::saveInteropProperties( uno::Reference< text::XTextDocument > xT
 }
 
 
-OUString OLEHandler::copyOLEOStream( uno::Reference< text::XTextDocument > xTextDocument )
+OUString OLEHandler::copyOLEOStream(
+        uno::Reference<text::XTextDocument> const& xTextDocument)
 {
     OUString sRet;
     if( !m_xInputStream.is( ) )
diff --git a/writerfilter/source/dmapper/OLEHandler.hxx b/writerfilter/source/dmapper/OLEHandler.hxx
index 9e22fc1..2c96955 100644
--- a/writerfilter/source/dmapper/OLEHandler.hxx
+++ b/writerfilter/source/dmapper/OLEHandler.hxx
@@ -71,7 +71,7 @@ class OLEHandler : public LoggedProperties
     virtual void lcl_sprm(Sprm & sprm) SAL_OVERRIDE;
 
     // Interoperability
-    virtual void saveInteropProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > xTextDocument,
+    virtual void saveInteropProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > const& xTextDocument,
                                         const OUString& sObjectName );
 
 public:
@@ -82,7 +82,7 @@ public:
 
     inline bool isOLEObject( ) { return m_xInputStream.is( ); };
 
-    OUString copyOLEOStream( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > xTextDocument );
+    OUString copyOLEOStream( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextDocument > const & xTextDocument );
 
     ::com::sun::star::awt::Size     getSize() const { return m_aShapeSize;}
     ::com::sun::star::awt::Point    getPosition() const { return m_aShapePosition;}
commit d9c4aa3838044e86013ee6c0e49afa45274faf89
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 21:38:42 2014 +0200

    writerfilter: pass uno::Reference by reference in RTFSdrImport
    
    Change-Id: I3a0821caccc37beb37f4ad8ecb4b0fdb5d2d5a58

diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index d8aa4a3..3fb2f09 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -114,7 +114,7 @@ std::vector<beans::PropertyValue> RTFSdrImport::getTextFrameDefaults(bool bNew)
     return aRet;
 }
 
-void RTFSdrImport::pushParent(uno::Reference<drawing::XShapes> xParent)
+void RTFSdrImport::pushParent(uno::Reference<drawing::XShapes> const& xParent)
 {
     m_aParents.push(xParent);
 }
@@ -124,7 +124,8 @@ void RTFSdrImport::popParent()
     m_aParents.pop();
 }
 
-void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder, bool bOldStyle)
+void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> const& xPropertySet,
+                               sal_Int32 const nZOrder, bool const bOldStyle)
 {
     writerfilter::dmapper::DomainMapper& rMapper =
         dynamic_cast<writerfilter::dmapper::DomainMapper&>(m_rImport.Mapper());
@@ -133,13 +134,15 @@ void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet,
     pHelper->addItem(xPropertySet, nZOrder);
 }
 
-void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nFLine)
+void RTFSdrImport::resolveFLine(uno::Reference<beans::XPropertySet> const& xPropertySet,
+                                sal_Int32 const nFLine)
 {
     if (nFLine == 0)
         xPropertySet->setPropertyValue("LineStyle", uno::makeAny(drawing::LineStyle_NONE));
 }
 
-void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> xShape, const OUString& aKey, const OUString& aValue)
+void RTFSdrImport::applyProperty(uno::Reference<drawing::XShape> const& xShape,
+        const OUString& aKey, const OUString& aValue)
 {
     uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
     sal_Int16 nHoriOrient = 0;
diff --git a/writerfilter/source/rtftok/rtfsdrimport.hxx b/writerfilter/source/rtftok/rtfsdrimport.hxx
index 5b1ddd8..8135ada 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.hxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.hxx
@@ -31,8 +31,8 @@ public:
     void append(const OUString& aKey, const OUString& aValue);
     /// Append property on the current parent.
     void appendGroupProperty(const OUString& aKey, const OUString& aValue);
-    void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> xPropertySet, sal_Int32 nZOrder, bool bOldStyle);
-    void resolveFLine(css::uno::Reference<css::beans::XPropertySet> xPropertySet, sal_Int32 nFLine);
+    void resolveDhgt(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nZOrder, bool bOldStyle);
+    void resolveFLine(css::uno::Reference<css::beans::XPropertySet> const& xPropertySet, sal_Int32 nFLine);
     /**
      * These are the default in Word, but not in Writer.
      *
@@ -40,7 +40,7 @@ public:
      */
     std::vector<css::beans::PropertyValue> getTextFrameDefaults(bool bNew);
     /// Push a new group shape to the parent stack.
-    void pushParent(css::uno::Reference<css::drawing::XShapes> xParent);
+    void pushParent(css::uno::Reference<css::drawing::XShapes> const& xParent);
     /// Pop the current group shape from the parent stack.
     void popParent();
     css::uno::Reference<css::drawing::XShape> const& getCurrentShape()
@@ -53,7 +53,7 @@ public:
     }
 private:
     void createShape(const OUString& aService, css::uno::Reference<css::drawing::XShape>& xShape, css::uno::Reference<css::beans::XPropertySet>& xPropertySet);
-    void applyProperty(css::uno::Reference<css::drawing::XShape> xShape, const OUString& aKey, const OUString& aValue);
+    void applyProperty(css::uno::Reference<css::drawing::XShape> const& xShape, const OUString& aKey, const OUString& aValue);
     int initShape(css::uno::Reference<css::drawing::XShape>& o_xShape,
                   css::uno::Reference<css::beans::XPropertySet>& o_xPropSet,
                   bool& o_rIsCustomShape,
@@ -70,6 +70,6 @@ private:
 } // namespace rtftok
 } // namespace writerfilter
 
-#endif // _RTFSDRIPORT_HXX_
+#endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFSDRIMPORT_HXX
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 2354d22b7ce12738bb929fc9c513e70ebd9f34fb
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 21:34:51 2014 +0200

    writerfilter: pass uno::Reference by reference in RTFValue
    
    Change-Id: I21d81d4454e65cf7f341f659b70b684dc3aa4621

diff --git a/writerfilter/source/rtftok/rtfvalue.cxx b/writerfilter/source/rtftok/rtfvalue.cxx
index bbfafd4..986cd76 100644
--- a/writerfilter/source/rtftok/rtfvalue.cxx
+++ b/writerfilter/source/rtftok/rtfvalue.cxx
@@ -18,9 +18,12 @@ namespace rtftok
 {
 
 
-RTFValue::RTFValue(int nValue, const OUString& sValue, RTFSprms rAttributes,
-                   RTFSprms rSprms, uno::Reference<drawing::XShape> xShape,
-                   uno::Reference<io::XInputStream> xStream, uno::Reference<embed::XEmbeddedObject> xObject, bool bForceString,
+RTFValue::RTFValue(int nValue, const OUString& sValue,
+                   RTFSprms rAttributes, RTFSprms rSprms,
+                   uno::Reference<drawing::XShape> const& xShape,
+                   uno::Reference<io::XInputStream> const& xStream,
+                   uno::Reference<embed::XEmbeddedObject> const& xObject,
+                   bool bForceString,
                    const RTFShape& aShape)
     : m_nValue(nValue),
       m_sValue(sValue),
@@ -99,10 +102,10 @@ RTFValue::RTFValue(RTFSprms rAttributes, RTFSprms rSprms)
     m_pShape.reset(new RTFShape());
 }
 
-RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape)
+RTFValue::RTFValue(uno::Reference<drawing::XShape> const& xShape)
     : m_nValue(),
       m_sValue(),
-      m_xShape(rShape),
+      m_xShape(xShape),
       m_xStream(),
       m_xObject(),
       m_bForceString(false)
@@ -112,11 +115,11 @@ RTFValue::RTFValue(uno::Reference<drawing::XShape> rShape)
     m_pShape.reset(new RTFShape());
 }
 
-RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream)
+RTFValue::RTFValue(uno::Reference<io::XInputStream> const& xStream)
     : m_nValue(),
       m_sValue(),
       m_xShape(),
-      m_xStream(rStream),
+      m_xStream(xStream),
       m_xObject(),
       m_bForceString(false)
 {
@@ -125,7 +128,7 @@ RTFValue::RTFValue(uno::Reference<io::XInputStream> rStream)
     m_pShape.reset(new RTFShape());
 }
 
-RTFValue::RTFValue(uno::Reference<embed::XEmbeddedObject> xObject)
+RTFValue::RTFValue(uno::Reference<embed::XEmbeddedObject> const& xObject)
     : m_nValue(),
       m_sValue(),
       m_xShape(),
diff --git a/writerfilter/source/rtftok/rtfvalue.hxx b/writerfilter/source/rtftok/rtfvalue.hxx
index af7d857..9e9ec25 100644
--- a/writerfilter/source/rtftok/rtfvalue.hxx
+++ b/writerfilter/source/rtftok/rtfvalue.hxx
@@ -26,17 +26,19 @@ class RTFValue
 {
 public:
     typedef boost::shared_ptr<RTFValue> Pointer_t;
-    RTFValue(int nValue, const OUString& sValue, RTFSprms rAttributes, RTFSprms rSprms, css::uno::Reference<css::drawing::XShape> rShape,
-             css::uno::Reference<css::io::XInputStream> rStream, css::uno::Reference<css::embed::XEmbeddedObject> rObject, bool bForceString,
-             const RTFShape& aShape);
+    RTFValue(int nValue, const OUString& sValue, RTFSprms rAttributes, RTFSprms rSprms,
+            css::uno::Reference<css::drawing::XShape> const& xShape,
+            css::uno::Reference<css::io::XInputStream> const& xStream,
+            css::uno::Reference<css::embed::XEmbeddedObject> const& xObject,
+            bool bForceString, const RTFShape& aShape);
     RTFValue();
     RTFValue(int nValue);
     RTFValue(const OUString& sValue, bool bForce = false);
     RTFValue(RTFSprms rAttributes);
     RTFValue(RTFSprms rAttributes, RTFSprms rSprms);
-    RTFValue(css::uno::Reference<css::drawing::XShape> rShape);
-    RTFValue(css::uno::Reference<css::io::XInputStream> rStream);
-    RTFValue(css::uno::Reference<css::embed::XEmbeddedObject> rObject);
+    RTFValue(css::uno::Reference<css::drawing::XShape> const& xShape);
+    RTFValue(css::uno::Reference<css::io::XInputStream> const& xStream);
+    RTFValue(css::uno::Reference<css::embed::XEmbeddedObject> const& xObject);
     RTFValue(const RTFShape& aShape);
     virtual ~RTFValue();
     void setString(const OUString& sValue);
commit 1398bdf35ecffcf4629f81f64cab51ab1b6a24ad
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 21:27:39 2014 +0200

    writerfilter: more pass by reference on PropertyMap
    
    Change-Id: I7f0666b882117518bddfc23d4fcf005a77bc11e9

diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx
index 1743d32..6aace22 100644
--- a/writerfilter/source/dmapper/PropertyMap.cxx
+++ b/writerfilter/source/dmapper/PropertyMap.cxx
@@ -581,7 +581,7 @@ table::ShadowFormat PropertyMap::getShadowFromBorder(table::BorderLine2 aBorder)
     return aFormat;
 }
 
-void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > xStyle,
+void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet > const& xStyle,
         PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth )
 {
     PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
@@ -608,7 +608,7 @@ void SectionPropertyMap::SetBorderDistance( uno::Reference< beans::XPropertySet
 
 
 uno::Reference< text::XTextColumns > SectionPropertyMap::ApplyColumnProperties(
-                            uno::Reference< beans::XPropertySet > xColumnContainer, DomainMapper_Impl& rDM_Impl )
+                            uno::Reference< beans::XPropertySet > const& xColumnContainer, DomainMapper_Impl& rDM_Impl )
 {
     uno::Reference< text::XTextColumns > xColumns;
     try
@@ -860,7 +860,9 @@ void SectionPropertyMap::PrepareHeaderFooterProperties( bool bFirstPage )
     operator[](PROP_BOTTOM_MARGIN) = uno::makeAny( nBottomMargin );
 }
 
-uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection, DomainMapper_Impl& rDM_Impl, uno::Reference<text::XTextRange> xStartingRange)
+uno::Reference<beans::XPropertySet> lcl_GetRangeProperties(bool bIsFirstSection,
+        DomainMapper_Impl& rDM_Impl,
+        uno::Reference<text::XTextRange> const& xStartingRange)
 {
     uno::Reference< beans::XPropertySet > xRangeProperties;
     if (bIsFirstSection && rDM_Impl.GetBodyText().is())
@@ -1198,7 +1200,8 @@ void SectionPropertyMap::CloseSectionGroup( DomainMapper_Impl& rDM_Impl )
 }
 
 
-void SectionPropertyMap::_ApplyProperties( uno::Reference< beans::XPropertySet > xStyle )
+void SectionPropertyMap::_ApplyProperties(
+        uno::Reference< beans::XPropertySet > const& xStyle)
 {
     PropertyNameSupplier& rPropNameSupplier = PropertyNameSupplier::GetPropertyNameSupplier();
     uno::Reference<beans::XMultiPropertySet> const xMultiSet(xStyle,
diff --git a/writerfilter/source/dmapper/PropertyMap.hxx b/writerfilter/source/dmapper/PropertyMap.hxx
index cbefc97..8ed3b2a 100644
--- a/writerfilter/source/dmapper/PropertyMap.hxx
+++ b/writerfilter/source/dmapper/PropertyMap.hxx
@@ -120,7 +120,7 @@ public:
     void Insert( PropertyIds eId, const PropValue& rValue, bool bOverwrite = true );
     void InsertProps(const boost::shared_ptr<PropertyMap> pMap);
     const ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote>&  GetFootnote() const { return m_xFootnote;}
-    void SetFootnote( ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote> xF ) { m_xFootnote = xF; }
+    void SetFootnote( ::com::sun::star::uno::Reference< ::com::sun::star::text::XFootnote> const& xF ) { m_xFootnote = xF; }
 
     sal_Unicode GetFootnoteSymbol() const { return m_cFootnoteSymbol;}
     void        SetFootnoteSymbol(sal_Unicode cSet) { m_cFootnoteSymbol = cSet;}
@@ -201,15 +201,15 @@ class SectionPropertyMap : public PropertyMap
     sal_Int32                               m_ndxaLnn;
     sal_Int32                               m_nLnnMin;
 
-    void _ApplyProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle );
+    void _ApplyProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xStyle );
     ::com::sun::star::uno::Reference< com::sun::star::text::XTextColumns > ApplyColumnProperties(
-            ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xFollowPageStyle, DomainMapper_Impl& rDM_Impl );
+            ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xFollowPageStyle, DomainMapper_Impl& rDM_Impl );
     void CopyLastHeaderFooter( bool bFirstPage, DomainMapper_Impl& rDM_Impl );
     void PrepareHeaderFooterProperties( bool bFirstPage );
     bool HasHeader( bool bFirstPage ) const;
     bool HasFooter( bool bFirstPage ) const;
 
-    void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xStyle,
+    void SetBorderDistance( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > const& xStyle,
         PropertyIds eMarginId, PropertyIds eDistId, sal_Int32 nDistance, sal_Int32 nOffsetFrom, sal_uInt32 nLineWidth );
 
 public:
@@ -380,10 +380,10 @@ public:
     void        SetDropCapLength(sal_Int8 nSet) { m_nDropCapLength = nSet;}
 
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetStartingRange() const { return m_xStartingRange; }
-    void SetStartingRange( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xSet ) { m_xStartingRange = xSet; }
+    void SetStartingRange( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xSet ) { m_xStartingRange = xSet; }
 
     ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > GetEndingRange() const { return m_xEndingRange; }
-    void SetEndingRange( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > xSet ) { m_xEndingRange = xSet; }
+    void SetEndingRange( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > const& xSet ) { m_xEndingRange = xSet; }
 
     void                    SetParaStyleName( const OUString& rSet ) { m_sParaStyleName = rSet;}
     const OUString&  GetParaStyleName() const { return m_sParaStyleName;}
commit 1b3305df4afb40e20bea74fc0068ea427050656c
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jul 21 21:19:53 2014 +0200

    writerfilter: pass uno::Reference by reference
    
    Stepping into Reference ctors in debugger on every function call is annoying.
    
    Change-Id: Iba3c6ee143a772768084d65fb7036cbd4abcf050

diff --git a/writerfilter/inc/dmapper/DomainMapper.hxx b/writerfilter/inc/dmapper/DomainMapper.hxx
index 7143219..bc70082 100644
--- a/writerfilter/inc/dmapper/DomainMapper.hxx
+++ b/writerfilter/inc/dmapper/DomainMapper.hxx
@@ -140,7 +140,7 @@ private:
     virtual void lcl_endParagraphGroup() SAL_OVERRIDE;
     virtual void lcl_startCharacterGroup() SAL_OVERRIDE;
     virtual void lcl_endCharacterGroup() SAL_OVERRIDE;
-    virtual void lcl_startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > xShape ) SAL_OVERRIDE;
+    virtual void lcl_startShape( ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > const& xShape ) SAL_OVERRIDE;
     virtual void lcl_endShape( ) SAL_OVERRIDE;
 
     virtual void lcl_text(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
diff --git a/writerfilter/inc/resourcemodel/LoggedResources.hxx b/writerfilter/inc/resourcemodel/LoggedResources.hxx
index 3781388..a914ec3 100644
--- a/writerfilter/inc/resourcemodel/LoggedResources.hxx
+++ b/writerfilter/inc/resourcemodel/LoggedResources.hxx
@@ -59,7 +59,7 @@ public:
     void endParagraphGroup() SAL_OVERRIDE;
     void startCharacterGroup() SAL_OVERRIDE;
     void endCharacterGroup() SAL_OVERRIDE;
-    void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) SAL_OVERRIDE;
+    void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > const& xShape ) SAL_OVERRIDE;
     void endShape() SAL_OVERRIDE;
     void text(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
     void utext(const sal_uInt8 * data, size_t len) SAL_OVERRIDE;
@@ -76,7 +76,7 @@ protected:
     virtual void lcl_endParagraphGroup() = 0;
     virtual void lcl_startCharacterGroup() = 0;
     virtual void lcl_endCharacterGroup() = 0;
-    virtual void lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape )  = 0;
+    virtual void lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > const& xShape )  = 0;
     virtual void lcl_endShape() = 0;
     virtual void lcl_text(const sal_uInt8 * data, size_t len) = 0;
     virtual void lcl_utext(const sal_uInt8 * data, size_t len) = 0;
diff --git a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
index 81209c0..b061713 100644
--- a/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
+++ b/writerfilter/inc/resourcemodel/WW8ResourceModel.hxx
@@ -225,7 +225,7 @@ public:
     /**
       Receives a shape.
      */
-    virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) = 0;
+    virtual void startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > const& xShape ) = 0;
 
     virtual void endShape( ) = 0;
 
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 23ffe2a..cdb65cb 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2616,7 +2616,7 @@ void DomainMapper::markLastSectionGroup( )
     m_pImpl->SetIsLastSectionGroup( true );
 }
 
-void DomainMapper::lcl_startShape( uno::Reference< drawing::XShape > xShape )
+void DomainMapper::lcl_startShape(uno::Reference<drawing::XShape> const& xShape)
 {
     if (m_pImpl->GetTopContext())
     {
diff --git a/writerfilter/source/dmapper/FontTable.cxx b/writerfilter/source/dmapper/FontTable.cxx
index ace3c71..67c0aae 100644
--- a/writerfilter/source/dmapper/FontTable.cxx
+++ b/writerfilter/source/dmapper/FontTable.cxx
@@ -219,7 +219,7 @@ void FontTable::lcl_info(const std::string& )
 {
 }
 
-void FontTable::lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > )
+void FontTable::lcl_startShape(uno::Reference<drawing::XShape> const&)
 {
 }
 
diff --git a/writerfilter/source/dmapper/FontTable.hxx b/writerfilter/source/dmapper/FontTable.hxx
index bd11825..8a05dce 100644
--- a/writerfilter/source/dmapper/FontTable.hxx
+++ b/writerfilter/source/dmapper/FontTable.hxx
@@ -89,7 +89,7 @@ class FontTable : public LoggedProperties, public LoggedTable
     virtual void lcl_substream(Id name,
                                ::writerfilter::Reference<Stream>::Pointer_t ref) SAL_OVERRIDE;
     virtual void lcl_info(const std::string & info) SAL_OVERRIDE;
-    virtual void lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape ) SAL_OVERRIDE;
+    virtual void lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > const& xShape ) SAL_OVERRIDE;
     virtual void lcl_endShape( ) SAL_OVERRIDE;
 
 };
diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index da20fa0..3d9b597 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1368,7 +1368,7 @@ void GraphicImport::lcl_info(const string & /*info*/)
 {
 }
 
-void GraphicImport::lcl_startShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > /*xShape*/ )
+void GraphicImport::lcl_startShape(uno::Reference<drawing::XShape> const&)
 {
 }
 
diff --git a/writerfilter/source/dmapper/GraphicImport.hxx b/writerfilter/source/dmapper/GraphicImport.hxx
index aa2e519..53def97 100644
--- a/writerfilter/source/dmapper/GraphicImport.hxx
+++ b/writerfilter/source/dmapper/GraphicImport.hxx
@@ -117,7 +117,7 @@ public:
                            writerfilter::Reference<Table>::Pointer_t ref) SAL_OVERRIDE;
     virtual void lcl_substream(Id name, writerfilter::Reference<Stream>::Pointer_t ref) SAL_OVERRIDE;
     virtual void lcl_info(const std::string & info) SAL_OVERRIDE;
-    virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> xShape) SAL_OVERRIDE;
+    virtual void lcl_startShape(css::uno::Reference<css::drawing::XShape> const& xShape) SAL_OVERRIDE;
     virtual void lcl_endShape() SAL_OVERRIDE;
 
     void handleWrapTextValue(sal_uInt32 nVal);
diff --git a/writerfilter/source/resourcemodel/LoggedResources.cxx b/writerfilter/source/resourcemodel/LoggedResources.cxx
index 6c4aa97..9217035 100644
--- a/writerfilter/source/resourcemodel/LoggedResources.cxx
+++ b/writerfilter/source/resourcemodel/LoggedResources.cxx
@@ -21,6 +21,8 @@
 #include <resourcemodel/LoggedResources.hxx>
 #include <resourcemodel/QNameToString.hxx>
 
+using namespace ::com::sun::star;
+

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list