summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2015-02-02 11:59:04 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2015-02-02 13:24:51 +0000
commitd334dd956a594c2fdda43706417ebf4d489f206a (patch)
tree80a574ef0e018a8f3cedbbd6983ac6c220c7c510
parentc33c309f13dee335d81eb0e00363d4ae2d7c911a (diff)
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@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Writer.xcs5
-rw-r--r--sw/inc/modcfg.hxx12
-rw-r--r--sw/qa/extras/uiwriter/uiwriter.cxx26
-rw-r--r--sw/source/core/doc/docfmt.cxx8
-rw-r--r--sw/source/ui/config/optpage.cxx10
-rw-r--r--sw/source/uibase/config/modcfg.cxx8
-rw-r--r--sw/source/uibase/inc/optpage.hxx1
-rw-r--r--sw/uiconfig/swriter/ui/optcomparison.ui19
8 files changed, 87 insertions, 2 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 4127fd790648..a43cbc63b672 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 1e36115ae300..a506db9304bf 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 047d0b05cb99..0fb6c821a881 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 68c28eac66e0..0dcaa3e89010 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 7a704f2f573e..cd68cb6d88ec 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 5364393870d7..8176a79f608c 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 d623923f7c92..968ebee97af3 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 deee8c9d8b89..f2042941bb90 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>