Kaydet (Commit) d334dd95 authored tarafından Miklos Vajna's avatar Miklos Vajna

tdf#68183 sw: config option for disabling the creation of automatic RSID marks

It was a problem since the initial commit
062eaeff (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/14277Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarJenkins <ci@libreoffice.org>
üst c33c309f
......@@ -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>
......
......@@ -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
......
......@@ -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();
......
......@@ -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;
......
......@@ -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)
......
......@@ -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;
}
}
}
......
......@@ -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();
......
......@@ -174,6 +174,25 @@
<property name="height">1</property>
</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>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment