[Libreoffice-commits] core.git: officecfg/registry sw/inc sw/qa sw/source sw/uiconfig

Miklos Vajna vmiklos at collabora.co.uk
Mon Feb 2 05:25:12 PST 2015


 officecfg/registry/schema/org/openoffice/Office/Writer.xcs |    5 ++
 sw/inc/modcfg.hxx                                          |   12 ++++++
 sw/qa/extras/uiwriter/uiwriter.cxx                         |   26 +++++++++++++
 sw/source/core/doc/docfmt.cxx                              |    8 ++++
 sw/source/ui/config/optpage.cxx                            |   10 +++++
 sw/source/uibase/config/modcfg.cxx                         |    8 +++-
 sw/source/uibase/inc/optpage.hxx                           |    1 
 sw/uiconfig/swriter/ui/optcomparison.ui                    |   19 +++++++++
 8 files changed, 87 insertions(+), 2 deletions(-)

New commits:
commit d334dd956a594c2fdda43706417ebf4d489f206a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Feb 2 11:59:04 2015 +0100

    tdf#68183 sw: config option for disabling the creation of automatic RSID marks
    
    It was a problem since the initial commit
    062eaeffe7cb986255063bb9b0a5f3fb3fc8e34c (sw: Improved document
    comparison based on RSIDs., 2011-12-22) that this new feature -- which
    is annoying for some use-cases -- could not be disabled, let's allow
    that.
    
    Change-Id: I33fa77382919586fb00198246f737caa68dcbd85
    Reviewed-on: https://gerrit.libreoffice.org/14277
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 4127fd7..a43cbc6 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -2669,6 +2669,11 @@
           <desc>Defines the length of ignored pieces.</desc>
         </info>
       </prop>
+      <prop oor:name="StoreRSID" oor:type="xs:boolean">
+        <info>
+          <desc>Specifies whether RSIDs are stored in the document model.</desc>
+        </info>
+      </prop>
     </group>
     <group oor:name="Insert">
       <info>
diff --git a/sw/inc/modcfg.hxx b/sw/inc/modcfg.hxx
index 1e36115..a506db9 100644
--- a/sw/inc/modcfg.hxx
+++ b/sw/inc/modcfg.hxx
@@ -74,6 +74,8 @@ class SwCompareConfig : public utl::ConfigItem
 
     sal_uInt16      eCmpMode;		//Compare/CompareDocuments;
     bool            bUseRsid;       //Compare/Settings/Use RSID
+    /// Compare/Settings/Store RSID
+    bool            m_bStoreRsid;
     bool            bIgnorePieces;  //Compare/Settings/Ignore pieces of length
     sal_uInt16      nPieceLen;		//Compare/Settings/Ignore pieces of length
 
@@ -350,6 +352,16 @@ public:
     void        SetPieceLen( sal_uInt16 nLen ) { aCompareConfig.nPieceLen = nLen;
                                                  aCompareConfig.SetModified(); }
 
+    bool IsStoreRsid() const
+    {
+        return aCompareConfig.m_bStoreRsid;
+    }
+    void SetStoreRsid(bool bStoreRsid)
+    {
+        aCompareConfig.m_bStoreRsid = bStoreRsid;
+        aCompareConfig.SetModified();
+    }
+
 };
 #endif
 
diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx
index 047d0b0..0fb6c82 100644
--- a/sw/qa/extras/uiwriter/uiwriter.cxx
+++ b/sw/qa/extras/uiwriter/uiwriter.cxx
@@ -26,6 +26,8 @@
 #include <view.hxx>
 #include <hhcwrp.hxx>
 #include <swacorr.hxx>
+#include <swmodule.hxx>
+#include <modcfg.hxx>
 #include <editeng/acorrcfg.hxx>
 #include <unotools/streamwrap.hxx>
 #include <test/mtfxmldump.hxx>
@@ -76,6 +78,7 @@ public:
     void testBookmarkUndo();
     void testFdo85876();
     void testFdo87448();
+    void testTdf68183();
 
     CPPUNIT_TEST_SUITE(SwUiWriterTest);
     CPPUNIT_TEST(testReplaceForward);
@@ -106,6 +109,7 @@ public:
     CPPUNIT_TEST(testBookmarkUndo);
     CPPUNIT_TEST(testFdo85876);
     CPPUNIT_TEST(testFdo87448);
+    CPPUNIT_TEST(testTdf68183);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -805,6 +809,28 @@ void SwUiWriterTest::testFdo87448()
     CPPUNIT_ASSERT_MESSAGE(aMsg.getStr(), abs(nFirstEnd - nSecondEnd) < 10);
 }
 
+void SwUiWriterTest::testTdf68183()
+{
+    // First disable RSID and check if indeed no such attribute is inserted.
+    SwDoc* pDoc = createDoc();
+    SW_MOD()->GetModuleConfig()->SetStoreRsid(false);
+    SwWrtShell* pWrtShell = pDoc->GetDocShell()->GetWrtShell();
+    pWrtShell->Insert2("X");
+
+    SwNodeIndex aIdx(pDoc->GetNodes().GetEndOfContent(), -1);
+    SwPaM aPaM(aIdx);
+    SwTxtNode* pTxtNode = aPaM.GetNode().GetTxtNode();
+    CPPUNIT_ASSERT_EQUAL(false, pTxtNode->GetSwAttrSet().HasItem(RES_PARATR_RSID));
+
+    // Then enable storing of RSID and make sure that the attribute is inserted.
+    SW_MOD()->GetModuleConfig()->SetStoreRsid(true);
+
+    pWrtShell->DelToStartOfLine();
+    pWrtShell->Insert2("X");
+
+    CPPUNIT_ASSERT_EQUAL(true, pTxtNode->GetSwAttrSet().HasItem(RES_PARATR_RSID));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest);
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 68c28ea..0dcaa3e 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -73,6 +73,8 @@
 #include <SwUndoFmt.hxx>
 #include <UndoManager.hxx>
 #include <docsh.hxx>
+#include <swmodule.hxx>
+#include <modcfg.hxx>
 #include <boost/scoped_ptr.hpp>
 
 using namespace ::com::sun::star::i18n;
@@ -405,6 +407,9 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
 /// Set the rsid of the next nLen symbols of rRg to the current session number
 bool SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen )
 {
+    if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
+        return false;
+
     SwTxtNode *pTxtNode = rRg.GetPoint()->nNode.GetNode().GetTxtNode();
     if (!pTxtNode)
     {
@@ -434,6 +439,9 @@ bool SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen )
 
 bool SwDoc::UpdateParRsid( SwTxtNode *pTxtNode, sal_uInt32 nVal )
 {
+    if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
+        return false;
+
     if (!pTxtNode)
     {
         return false;
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index 7a704f2..cd68cb6 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -2215,6 +2215,7 @@ SwCompareOptionsTabPage::SwCompareOptionsTabPage(  vcl::Window* pParent, const S
     get(m_pRsidCB, "useRSID");
     get(m_pIgnoreCB, "ignore");
     get(m_pLenNF, "ignorelen");
+    get(m_pStoreRsidCB, "storeRSID");
 
     Link aLnk( LINK( this, SwCompareOptionsTabPage, ComparisonHdl ) );
     m_pAutoRB->SetClickHdl( aLnk );
@@ -2270,6 +2271,12 @@ bool SwCompareOptionsTabPage::FillItemSet( SfxItemSet* )
         bRet = true;
     }
 
+    if (m_pStoreRsidCB->IsValueChangedFromSaved())
+    {
+        pOpt->SetStoreRsid(m_pStoreRsidCB->IsChecked());
+        bRet = true;
+    }
+
     return bRet;
 }
 
@@ -2313,6 +2320,9 @@ void SwCompareOptionsTabPage::Reset( const SfxItemSet* )
 
     m_pLenNF->SetValue( pOpt->GetPieceLen() );
     m_pLenNF->SaveValue();
+
+    m_pStoreRsidCB->Check(pOpt->IsStoreRsid());
+    m_pStoreRsidCB->SaveValue();
 }
 
 IMPL_LINK_NOARG(SwCompareOptionsTabPage, ComparisonHdl)
diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx
index 5364393..8176a79 100644
--- a/sw/source/uibase/config/modcfg.cxx
+++ b/sw/source/uibase/config/modcfg.cxx
@@ -1306,14 +1306,15 @@ const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
     static Sequence<OUString> aNames;
     if(!aNames.getLength())
     {
-        const int nCount = 4;
+        const int nCount = 5;
         aNames.realloc(nCount);
         static const char* aPropNames[] =
         {
             "Mode",							// 0
             "UseRSID",						// 1
             "IgnorePieces",				// 2
-            "IgnoreLength"					// 3
+            "IgnoreLength", // 3
+            "StoreRSID" // 4
         };
         OUString* pNames = aNames.getArray();
         for(int i = 0; i < nCount; i++)
@@ -1325,6 +1326,7 @@ const Sequence<OUString>& SwCompareConfig::GetPropertyNames()
 SwCompareConfig::SwCompareConfig() :
     ConfigItem("Office.Writer/Comparison",
         CONFIG_MODE_DELAYED_UPDATE|CONFIG_MODE_RELEASE_TREE)
+    ,m_bStoreRsid(true)
 {
     eCmpMode = SVX_CMP_AUTO;
     bUseRsid = false;
@@ -1348,6 +1350,7 @@ void SwCompareConfig::Commit()
     pValues[1] <<= bUseRsid;
     pValues[2] <<= bIgnorePieces;
     pValues[3] <<= (sal_Int32) nPieceLen;
+    pValues[4] <<= m_bStoreRsid;
 
     PutProperties(aNames, aValues);
 }
@@ -1373,6 +1376,7 @@ void SwCompareConfig::Load()
                     case 1 : bUseRsid = *(sal_Bool*)pValues[nProp].getValue(); break;
                     case 2 : bIgnorePieces = *(sal_Bool*)pValues[nProp].getValue(); break;
                     case 3 : nPieceLen = nVal; break;
+                    case 4 : m_bStoreRsid = *(sal_Bool*)pValues[nProp].getValue(); break;
                 }
             }
         }
diff --git a/sw/source/uibase/inc/optpage.hxx b/sw/source/uibase/inc/optpage.hxx
index d623923..968ebee 100644
--- a/sw/source/uibase/inc/optpage.hxx
+++ b/sw/source/uibase/inc/optpage.hxx
@@ -409,6 +409,7 @@ class SwCompareOptionsTabPage : public SfxTabPage
     CheckBox*     m_pRsidCB;
     CheckBox*     m_pIgnoreCB;
     NumericField* m_pLenNF;
+    CheckBox*     m_pStoreRsidCB;
 
     SwCompareOptionsTabPage( vcl::Window* pParent, const SfxItemSet& rSet );
     virtual ~SwCompareOptionsTabPage();
diff --git a/sw/uiconfig/swriter/ui/optcomparison.ui b/sw/uiconfig/swriter/ui/optcomparison.ui
index deee8c9..f204294 100644
--- a/sw/uiconfig/swriter/ui/optcomparison.ui
+++ b/sw/uiconfig/swriter/ui/optcomparison.ui
@@ -175,6 +175,25 @@
                   </packing>
                 </child>
                 <child>
+                  <object class="GtkCheckButton" id="storeRSID">
+                    <property name="label" translatable="yes">Store RSID</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">False</property>
+                    <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
+                    <property name="image_position">right</property>
+                    <property name="draw_indicator">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
                   <placeholder/>
                 </child>
               </object>


More information about the Libreoffice-commits mailing list