[Libreoffice-commits] core.git: 3 commits - dbaccess/source sc/source sw/CppunitTest_sw_tox.mk sw/CppunitTest_sw_uwriter.mk sw/inc sw/Module_sw.mk sw/qa sw/source unusedcode.easy
Caolán McNamara
caolanm at redhat.com
Mon Nov 3 06:49:28 PST 2014
dbaccess/source/core/api/RowSetCacheIterator.cxx | 5
dbaccess/source/core/api/RowSetCacheIterator.hxx | 1
sc/source/ui/unoobj/celllistsource.cxx | 16 -
sc/source/ui/unoobj/celllistsource.hxx | 6
sc/source/ui/unoobj/cellvaluebinding.cxx | 19 --
sc/source/ui/unoobj/cellvaluebinding.hxx | 6
sw/CppunitTest_sw_tox.mk | 84 ---------
sw/CppunitTest_sw_uwriter.mk | 3
sw/Module_sw.mk | 4
sw/inc/ToxLinkProcessor.hxx | 2
sw/inc/ToxTabStopTokenHandler.hxx | 4
sw/inc/ToxTextGenerator.hxx | 2
sw/inc/ToxWhitespaceStripper.hxx | 2
sw/inc/modeltoviewhelper.hxx | 25 ++
sw/qa/core/test_ToxLinkProcessor.cxx | 140 ++++++++++++++++
sw/qa/core/test_ToxTextGenerator.cxx | 195 +++++++++++++++++++++++
sw/qa/core/test_ToxWhitespaceStripper.cxx | 147 +++++++++++++++++
sw/qa/core/uwriter.cxx | 34 +++-
sw/qa/extras/tox/test_ToxLinkProcessor.cxx | 140 ----------------
sw/qa/extras/tox/test_ToxTextGenerator.cxx | 195 -----------------------
sw/qa/extras/tox/test_ToxWhitespaceStripper.cxx | 150 -----------------
sw/source/core/inc/txmsrt.hxx | 2
sw/source/core/text/porlay.cxx | 5
sw/source/core/txtnode/modeltoviewhelper.cxx | 70 +++++---
sw/source/core/txtnode/txtedt.cxx | 2
unusedcode.easy | 3
26 files changed, 585 insertions(+), 677 deletions(-)
New commits:
commit 6c52a8b916e52c9ab33461e931a4e75b3dae04f7
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 3 13:58:52 2014 +0000
drop SW_DLLPUBLICs for unit-test only exposure
seeing as have a uwriter target for the non-exposed symbols case.
As a motivating side-effect stops crashing on exit on an optimized build with
my x86_64 fedora 20 gcc 4.8.3 build
Change-Id: If0240ee02d4899e488b12d2d8d5f9b6bf7cca37d
diff --git a/sw/CppunitTest_sw_tox.mk b/sw/CppunitTest_sw_tox.mk
deleted file mode 100644
index cca386f..0000000
--- a/sw/CppunitTest_sw_tox.mk
+++ /dev/null
@@ -1,84 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-# This file contains the unit test definition for class in the sources/core/tox subfolder
-# The macro which defines the main method is contained in test_ToxWhitespaceStripper.cxx
-
-$(eval $(call gb_CppunitTest_CppunitTest,sw_tox))
-
-$(eval $(call gb_CppunitTest_add_exception_objects,sw_tox, \
- sw/qa/extras/tox/test_ToxWhitespaceStripper \
- sw/qa/extras/tox/test_ToxLinkProcessor \
- sw/qa/extras/tox/test_ToxTextGenerator \
-))
-
-$(eval $(call gb_CppunitTest_use_libraries,sw_tox, \
- $(call gb_Helper_optional,AVMEDIA,avmedia) \
- basegfx \
- comphelper \
- cppu \
- cppuhelper \
- drawinglayer \
- editeng \
- i18nlangtag \
- i18nutil \
- lng \
- sal \
- salhelper \
- sax \
- sb \
- sfx \
- sot \
- svl \
- svt \
- svx \
- svxcore \
- sw \
- test \
- unotest \
- vcl \
- tk \
- tl \
- ucbhelper \
- utl \
- xmlreader \
- xo \
- $(gb_UWINAPI) \
-))
-
-$(eval $(call gb_CppunitTest_use_externals,sw_tox, \
- boost_headers \
- icuuc \
- libxml2 \
-))
-
-$(eval $(call gb_CppunitTest_use_api,sw_tox,\
- offapi \
- udkapi \
-))
-
-$(eval $(call gb_CppunitTest_use_components,sw_tox, \
- configmgr/source/configmgr \
- framework/util/fwk \
- i18npool/util/i18npool \
- ucb/source/core/ucb1 \
- ucb/source/ucp/file/ucpfile1 \
-))
-
-$(eval $(call gb_CppunitTest_use_configuration,sw_tox))
-$(eval $(call gb_CppunitTest_use_ure,sw_tox))
-$(eval $(call gb_CppunitTest_use_vcl,sw_tox))
-
-$(eval $(call gb_CppunitTest_set_include,sw_tox,\
- -I$(SRCDIR)/sw/inc \
- -I$(SRCDIR)/sw/source/core/inc \
- $$(INCLUDE) \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/sw/CppunitTest_sw_uwriter.mk b/sw/CppunitTest_sw_uwriter.mk
index 495d088..9f4e9f9 100644
--- a/sw/CppunitTest_sw_uwriter.mk
+++ b/sw/CppunitTest_sw_uwriter.mk
@@ -14,6 +14,9 @@ $(eval $(call gb_CppunitTest_CppunitTest,sw_uwriter))
$(eval $(call gb_CppunitTest_add_exception_objects,sw_uwriter, \
sw/qa/core/uwriter \
sw/qa/core/Test-BigPtrArray \
+ sw/qa/core/test_ToxWhitespaceStripper \
+ sw/qa/core/test_ToxLinkProcessor \
+ sw/qa/core/test_ToxTextGenerator \
))
$(eval $(call gb_CppunitTest_use_library_objects,sw_uwriter,sw))
diff --git a/sw/Module_sw.mk b/sw/Module_sw.mk
index d205968..b5809c2 100644
--- a/sw/Module_sw.mk
+++ b/sw/Module_sw.mk
@@ -46,10 +46,6 @@ $(eval $(call gb_Module_add_targets,sw,\
endif
-$(eval $(call gb_Module_add_check_targets,sw,\
- CppunitTest_sw_tox \
-))
-
$(eval $(call gb_Module_add_slowcheck_targets,sw,\
CppunitTest_sw_uwriter \
CppunitTest_sw_htmlexport \
diff --git a/sw/inc/ToxLinkProcessor.hxx b/sw/inc/ToxLinkProcessor.hxx
index dcf1002..2e439c0 100644
--- a/sw/inc/ToxLinkProcessor.hxx
+++ b/sw/inc/ToxLinkProcessor.hxx
@@ -24,7 +24,7 @@ namespace sw {
/** A helper class for ToxTextGenerator.
* It collects information about encountered link tokens and allows access in a processed form.
*/
-class SW_DLLPUBLIC ToxLinkProcessor {
+class ToxLinkProcessor {
public:
ToxLinkProcessor() {}
virtual ~ToxLinkProcessor() {}
diff --git a/sw/inc/ToxTabStopTokenHandler.hxx b/sw/inc/ToxTabStopTokenHandler.hxx
index 8830de9..a0d9e42 100644
--- a/sw/inc/ToxTabStopTokenHandler.hxx
+++ b/sw/inc/ToxTabStopTokenHandler.hxx
@@ -28,7 +28,7 @@ namespace sw {
* @internal
* This is an interface class. It allows to mock the class in unit tests
*/
-class SW_DLLPUBLIC ToxTabStopTokenHandler
+class ToxTabStopTokenHandler
{
public:
virtual ~ToxTabStopTokenHandler() {}
@@ -50,7 +50,7 @@ public:
};
/** The default implementation of ToxTabStopTokenHandler */
-class SW_DLLPUBLIC DefaultToxTabStopTokenHandler : public ToxTabStopTokenHandler
+class DefaultToxTabStopTokenHandler : public ToxTabStopTokenHandler
{
public:
diff --git a/sw/inc/ToxTextGenerator.hxx b/sw/inc/ToxTextGenerator.hxx
index a9c9cad..45af131 100644
--- a/sw/inc/ToxTextGenerator.hxx
+++ b/sw/inc/ToxTextGenerator.hxx
@@ -54,7 +54,7 @@ class ToxTabStopTokenHandler;
*
* You can control its behavior by calling @link SetTabstopPolicy() and specifying the desired behavior.
*/
-class SW_DLLPUBLIC ToxTextGenerator
+class ToxTextGenerator
{
public:
ToxTextGenerator(const SwForm& toxForm, boost::shared_ptr<ToxTabStopTokenHandler> tabStopHandler);
diff --git a/sw/inc/ToxWhitespaceStripper.hxx b/sw/inc/ToxWhitespaceStripper.hxx
index bc8e869..dc3e741 100644
--- a/sw/inc/ToxWhitespaceStripper.hxx
+++ b/sw/inc/ToxWhitespaceStripper.hxx
@@ -30,7 +30,7 @@ namespace sw {
*
* @note One leading whitespace is preserved.
*/
-class SW_DLLPUBLIC ToxWhitespaceStripper
+class ToxWhitespaceStripper
{
public:
ToxWhitespaceStripper(const OUString&);
diff --git a/sw/qa/extras/tox/test_ToxLinkProcessor.cxx b/sw/qa/core/test_ToxLinkProcessor.cxx
similarity index 100%
rename from sw/qa/extras/tox/test_ToxLinkProcessor.cxx
rename to sw/qa/core/test_ToxLinkProcessor.cxx
diff --git a/sw/qa/extras/tox/test_ToxTextGenerator.cxx b/sw/qa/core/test_ToxTextGenerator.cxx
similarity index 100%
rename from sw/qa/extras/tox/test_ToxTextGenerator.cxx
rename to sw/qa/core/test_ToxTextGenerator.cxx
diff --git a/sw/qa/extras/tox/test_ToxWhitespaceStripper.cxx b/sw/qa/core/test_ToxWhitespaceStripper.cxx
similarity index 98%
rename from sw/qa/extras/tox/test_ToxWhitespaceStripper.cxx
rename to sw/qa/core/test_ToxWhitespaceStripper.cxx
index adaffd9..30da0bd 100644
--- a/sw/qa/extras/tox/test_ToxWhitespaceStripper.cxx
+++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx
@@ -18,7 +18,6 @@
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
using namespace sw;
@@ -145,6 +144,4 @@ ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested()
// Put the test suite in the registry
CPPUNIT_TEST_SUITE_REGISTRATION(ToxWhitespaceStripperTest);
-CPPUNIT_PLUGIN_IMPLEMENT();
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/inc/txmsrt.hxx b/sw/source/core/inc/txmsrt.hxx
index d2d550a..f1e62ad 100644
--- a/sw/source/core/inc/txmsrt.hxx
+++ b/sw/source/core/inc/txmsrt.hxx
@@ -118,7 +118,7 @@ public:
/**
* Class for sorting directories
*/
-struct SW_DLLPUBLIC SwTOXSortTabBase
+struct SwTOXSortTabBase
{
SwTOXSources aTOXSources;
::com::sun::star::lang::Locale aLocale;
commit fa430e6b4e6f5d096bdf59db26e5d7393ca2297b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 3 09:49:37 2014 +0000
Resolves: fdo#68347 fix word count with recorded changes
also see fdo#46757
a) We need to ignore redline-deleted text, but count redline-added text
b) each block of text is denoted by its end position in the model
and where that maps to in the view so a hidden portion
should record its end point not its starting point, and a non-hidden
deleted portion should always record its end point
c) when mapping a model position to the view we take the offset of
the model pos arg from the block end and use that to offset the
mapped block-end view pos to get the final view pos. But for
hidden portions that won't make a whole lot of sense, and
end up offsetting into prior portions, so map all positions within a
hidden portion to the same block-end view pos
add regression tests for these cases
Change-Id: I45c76bba47fd430bc3bccb5f919502660d415d9e
diff --git a/sw/inc/modeltoviewhelper.hxx b/sw/inc/modeltoviewhelper.hxx
index 018b67c..d99c9db 100644
--- a/sw/inc/modeltoviewhelper.hxx
+++ b/sw/inc/modeltoviewhelper.hxx
@@ -65,19 +65,30 @@ class SwTxtNode;
#define EXPANDFIELDS 0x0001
#define EXPANDFOOTNOTE 0x0002
#define HIDEINVISIBLE 0x0004
-#define HIDEREDLINED 0x0008
+#define HIDEDELETIONS 0x0008
/// do not expand to content, but replace with ZWSP
#define REPLACEMODE 0x0010
class ModelToViewHelper
{
- /** For each field in the model string, there is an entry in the conversion
- map. The first value of the ConversionMapEntry points to the field
- position in the model string, the second value points to the associated
- position in the view string. The last entry in the conversion map
- denotes the lengths of the model resp. view string.
+ /** For each expanded/hidden portion in the model string, there is an entry in
+ the conversion map. The first value of the ConversionMapEntry points to
+ the start position in the model string, the second value points to the
+ associated start position in the view string. The last entry in the
+ conversion map denotes the lengths of the model resp. view string.
*/
- typedef std::pair< sal_Int32 , sal_Int32 > ConversionMapEntry;
+ struct ConversionMapEntry
+ {
+ ConversionMapEntry(sal_Int32 nModelPos, sal_Int32 nViewPos, bool bVisible)
+ : m_nModelPos(nModelPos)
+ , m_nViewPos(nViewPos)
+ , m_bVisible(bVisible)
+ {
+ }
+ sal_Int32 m_nModelPos;
+ sal_Int32 m_nViewPos;
+ bool m_bVisible;
+ };
typedef std::vector< ConversionMapEntry > ConversionMap;
typedef std::vector<sal_Int32> Positions;
diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx
index 8efd1b0..71409b8 100644
--- a/sw/qa/core/uwriter.cxx
+++ b/sw/qa/core/uwriter.cxx
@@ -406,7 +406,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideRedlined()
{
SwTxtNode* pTxtNode = getModelToViewTestDocument(m_pDoc);
- ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEREDLINED);
+ ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEDELETIONS);
OUString sViewText = aModelToViewHelper.getViewText();
CPPUNIT_ASSERT_EQUAL(
OUString("AAAABB " + OUString(CH_TXTATR_BREAKWORD) + " CCCCC " + OUString(CH_TXTATR_BREAKWORD) + " DDDDD"),
@@ -444,7 +444,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnote(
{
SwTxtNode* pTxtNode = getModelToViewTestDocument(m_pDoc);
- ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEREDLINED | EXPANDFOOTNOTE);
+ ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEDELETIONS | EXPANDFOOTNOTE);
OUString sViewText = aModelToViewHelper.getViewText();
CPPUNIT_ASSERT_EQUAL(
OUString("AAAABB foo CCCCC foo DDDDD"), sViewText);
@@ -455,7 +455,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideHideRedlinedExpandFootnoteR
SwTxtNode* pTxtNode = getModelToViewTestDocument(m_pDoc);
ModelToViewHelper aModelToViewHelper(*pTxtNode,
- EXPANDFIELDS | HIDEREDLINED | EXPANDFOOTNOTE | REPLACEMODE);
+ EXPANDFIELDS | HIDEDELETIONS | EXPANDFOOTNOTE | REPLACEMODE);
OUString sViewText = aModelToViewHelper.getViewText();
CPPUNIT_ASSERT_EQUAL(
OUString("AAAABB " + OUString(CHAR_ZWSP) + " CCCCC " + OUString(CHAR_ZWSP) + " DDDDD"),
@@ -474,7 +474,7 @@ void SwDocTest::testModelToViewHelperHideInvisibleHideRedlined()
{
SwTxtNode* pTxtNode = getModelToViewTestDocument(m_pDoc);
- ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEINVISIBLE | HIDEREDLINED);
+ ModelToViewHelper aModelToViewHelper(*pTxtNode, HIDEINVISIBLE | HIDEDELETIONS);
OUString sViewText = aModelToViewHelper.getViewText();
OUStringBuffer aBuffer;
aBuffer.append("AAAACCCCC ");
@@ -487,7 +487,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpand
{
SwTxtNode* pTxtNode = getModelToViewTestDocument(m_pDoc);
- ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED | EXPANDFOOTNOTE);
+ ModelToViewHelper aModelToViewHelper(*pTxtNode, EXPANDFIELDS | HIDEINVISIBLE | HIDEDELETIONS | EXPANDFOOTNOTE);
OUString sViewText = aModelToViewHelper.getViewText();
CPPUNIT_ASSERT_EQUAL(OUString("AAAACCCCC foo DDDDD"), sViewText);
}
@@ -497,7 +497,7 @@ void SwDocTest::testModelToViewHelperExpandFieldsHideInvisibleHideRedlinedExpand
SwTxtNode* pTxtNode = getModelToViewTestDocument(m_pDoc);
ModelToViewHelper aModelToViewHelper(*pTxtNode,
- EXPANDFIELDS | HIDEINVISIBLE | HIDEREDLINED | EXPANDFOOTNOTE | REPLACEMODE);
+ EXPANDFIELDS | HIDEINVISIBLE | HIDEDELETIONS | EXPANDFOOTNOTE | REPLACEMODE);
OUString sViewText = aModelToViewHelper.getViewText();
CPPUNIT_ASSERT_EQUAL(sViewText,
OUString("AAAACCCCC " + OUString(CHAR_ZWSP) + " DDDDD"));
@@ -768,8 +768,26 @@ void SwDocTest::testSwScanner()
aDocStat.Reset();
pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len()); //word-counting the text should only count the non-deleted text, and this whole chunk should be ignored
- CPPUNIT_ASSERT_EQUAL(aDocStat.nWord, static_cast<sal_uLong>(0));
- CPPUNIT_ASSERT_EQUAL(aDocStat.nChar, static_cast<sal_uLong>(0));
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(0), aDocStat.nWord);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(0), aDocStat.nChar);
+
+ // https://bugs.libreoffice.org/show_bug.cgi?id=68347 we do want to count
+ // redline *added* text though
+ m_pDoc->getIDocumentRedlineAccess().SetRedlineMode(nsRedlineMode_t::REDLINE_ON | nsRedlineMode_t::REDLINE_SHOW_DELETE|nsRedlineMode_t::REDLINE_SHOW_INSERT);
+ aPaM.DeleteMark();
+ aPaM.GetPoint()->nContent.Assign(aPaM.GetCntntNode(), 0);
+ m_pDoc->getIDocumentContentOperations().InsertString(aPaM, "redline-new-text ");
+ aDocStat.Reset();
+ pTxtNode = aPaM.GetNode().GetTxtNode();
+ pTxtNode->SetWordCountDirty(true);
+ pTxtNode->CountWords(aDocStat, 0, pTxtNode->Len());
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(2), aDocStat.nWord);
+ //redline-new-text Lorem ipsum
+ //+++++++++++++++++ ------
+ //select start of original text and part of deleted text
+ aDocStat.Reset();
+ pTxtNode->CountWords(aDocStat, 17, 25);
+ CPPUNIT_ASSERT_EQUAL(static_cast<sal_uLong>(5), aDocStat.nChar);
}
//See https://bugs.libreoffice.org/show_bug.cgi?id=38983
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 8870f58..97af17a 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -2100,9 +2100,12 @@ void SwScriptInfo::selectRedLineDeleted(const SwTxtNode& rNode, MultiSelection &
{
const SwRangeRedline* pRed = rIDRA.GetRedlineTbl()[ nAct ];
- if ( pRed->Start()->nNode > rNode.GetIndex() )
+ if (pRed->Start()->nNode > rNode.GetIndex())
break;
+ if (pRed->GetType() != nsRedlineType_t::REDLINE_DELETE)
+ continue;
+
sal_Int32 nRedlStart;
sal_Int32 nRedlnEnd;
pRed->CalcStartEnd( rNode.GetIndex(), nRedlStart, nRedlnEnd );
diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx
index ad268cd..43bab21 100644
--- a/sw/source/core/txtnode/modeltoviewhelper.cxx
+++ b/sw/source/core/txtnode/modeltoviewhelper.cxx
@@ -94,7 +94,7 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
if (eMode & HIDEINVISIBLE)
SwScriptInfo::selectHiddenTextProperty(rNode, aHiddenMulti);
- if (eMode & HIDEREDLINED)
+ if (eMode & HIDEDELETIONS)
SwScriptInfo::selectRedLineDeleted(rNode, aHiddenMulti);
std::vector<block> aBlocks;
@@ -203,43 +203,55 @@ ModelToViewHelper::ModelToViewHelper(const SwTxtNode &rNode, sal_uInt16 eMode)
}
}
+ //store the end of each range in the model and where that end of range
+ //maps to in the view
sal_Int32 nOffset = 0;
for (std::vector<block>::iterator i = aBlocks.begin(); i != aBlocks.end(); ++i)
{
+ const sal_Int32 nBlockLen = i->m_nLen;
+ if (!nBlockLen)
+ continue;
+ const sal_Int32 nBlockStart = i->m_nStart;
+ const sal_Int32 nBlockEnd = nBlockStart + nBlockLen;
+
if (!i->m_bVisible)
{
- const sal_Int32 nHiddenStart = i->m_nStart;
- const sal_Int32 nHiddenLen = i->m_nLen;
+ sal_Int32 const modelBlockPos(nBlockEnd);
+ sal_Int32 const viewBlockPos(nBlockStart + nOffset);
+ m_aMap.push_back(ConversionMapEntry(modelBlockPos, viewBlockPos, false));
- m_aRetText = m_aRetText.replaceAt( nOffset + nHiddenStart, nHiddenLen, OUString() );
- m_aMap.push_back( ConversionMapEntry( nHiddenStart, nOffset + nHiddenStart ) );
- nOffset -= nHiddenLen;
+ m_aRetText = m_aRetText.replaceAt(nOffset + nBlockStart, nBlockLen, OUString());
+ nOffset -= nBlockLen;
}
else
{
for (FieldResultSet::iterator j = i->m_aAttrs.begin(); j != i->m_aAttrs.end(); ++j)
{
- sal_Int32 const viewPos(nOffset + j->m_nFieldPos);
- m_aRetText = m_aRetText.replaceAt(viewPos, 1, j->m_sExpand);
- m_aMap.push_back( ConversionMapEntry(j->m_nFieldPos, viewPos) );
+ sal_Int32 const modelFieldPos(j->m_nFieldPos);
+ sal_Int32 const viewFieldPos(j->m_nFieldPos + nOffset);
+ m_aMap.push_back( ConversionMapEntry(modelFieldPos, viewFieldPos, true) );
+
+ m_aRetText = m_aRetText.replaceAt(viewFieldPos, 1, j->m_sExpand);
+ nOffset += j->m_sExpand.getLength() - 1;
+
switch (j->m_eType)
{
case FieldResult::FIELD:
- m_FieldPositions.push_back(viewPos);
+ m_FieldPositions.push_back(viewFieldPos);
break;
case FieldResult::FOOTNOTE:
- m_FootnotePositions.push_back(viewPos);
+ m_FootnotePositions.push_back(viewFieldPos);
break;
case FieldResult::NONE: /*ignore*/
break;
}
- nOffset += j->m_sExpand.getLength() - 1;
}
+
+ sal_Int32 const modelEndBlock(nBlockEnd);
+ sal_Int32 const viewFieldPos(nBlockEnd + nOffset);
+ m_aMap.push_back(ConversionMapEntry(modelEndBlock, viewFieldPos, true));
}
}
-
- if ( !m_aMap.empty() )
- m_aMap.push_back( ConversionMapEntry( rNodeText.getLength()+1, m_aRetText.getLength()+1 ) );
}
/** Converts a model position into a view position
@@ -248,15 +260,21 @@ sal_Int32 ModelToViewHelper::ConvertToViewPosition( sal_Int32 nModelPos ) const
{
// Search for entry after nPos:
ConversionMap::const_iterator aIter;
+
for ( aIter = m_aMap.begin(); aIter != m_aMap.end(); ++aIter )
{
- if ( (*aIter).first >= nModelPos )
+ if (aIter->m_nModelPos >= nModelPos)
{
- const sal_Int32 nPosModel = (*aIter).first;
- const sal_Int32 nPosExpand = (*aIter).second;
-
- const sal_Int32 nDistToNextModel = nPosModel - nModelPos;
- return nPosExpand - nDistToNextModel;
+ //if it's an invisible portion, map all contained positions
+ //to the anchor viewpos
+ if (!aIter->m_bVisible)
+ return aIter->m_nViewPos;
+
+ //if it's a visible portion, then the view position is the anchor
+ //viewpos - the offset of the input modelpos from the anchor
+ //modelpos
+ const sal_Int32 nOffsetFromEnd = aIter->m_nModelPos - nModelPos;
+ return aIter->m_nViewPos - nOffsetFromEnd;
}
}
@@ -274,10 +292,10 @@ ModelToViewHelper::ModelPosition ModelToViewHelper::ConvertToModelPosition( sal_
ConversionMap::const_iterator aIter;
for ( aIter = m_aMap.begin(); aIter != m_aMap.end(); ++aIter )
{
- if ( (*aIter).second > nViewPos )
+ if (aIter->m_nViewPos > nViewPos)
{
- const sal_Int32 nPosModel = (*aIter).first;
- const sal_Int32 nPosExpand = (*aIter).second;
+ const sal_Int32 nPosModel = aIter->m_nModelPos;
+ const sal_Int32 nPosExpand = aIter->m_nViewPos;
// If nViewPos is in front of first field, we are finished.
if ( aIter == m_aMap.begin() )
@@ -286,8 +304,8 @@ ModelToViewHelper::ModelPosition ModelToViewHelper::ConvertToModelPosition( sal_
--aIter;
// nPrevPosModel is the field position
- const sal_Int32 nPrevPosModel = (*aIter).first;
- const sal_Int32 nPrevPosExpand = (*aIter).second;
+ const sal_Int32 nPrevPosModel = aIter->m_nModelPos;
+ const sal_Int32 nPrevPosExpand = aIter->m_nViewPos;
const sal_Int32 nLengthModel = nPosModel - nPrevPosModel;
const sal_Int32 nLengthExpand = nPosExpand - nPrevPosExpand;
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index d094b83..2ec09bb 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1993,7 +1993,7 @@ bool SwTxtNode::CountWords( SwDocStat& rStat,
}
// ConversionMap to expand fields, remove invisible and redline deleted text for scanner
- const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEREDLINED);
+ const ModelToViewHelper aConversionMap(*this, EXPANDFIELDS | EXPANDFOOTNOTE | HIDEINVISIBLE | HIDEDELETIONS);
OUString aExpandText = aConversionMap.getViewText();
if (aExpandText.isEmpty() && !bCountNumbering)
commit 79fcf0b4a86e22e541eecd6e39726fac2016750b
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Nov 3 09:53:00 2014 +0000
callcatcher: update unused code
Change-Id: Ida4221bfbfe30f7e1abd5c367d8cb8b9edd310bb
diff --git a/dbaccess/source/core/api/RowSetCacheIterator.cxx b/dbaccess/source/core/api/RowSetCacheIterator.cxx
index 555d28b..106893b 100644
--- a/dbaccess/source/core/api/RowSetCacheIterator.cxx
+++ b/dbaccess/source/core/api/RowSetCacheIterator.cxx
@@ -124,9 +124,4 @@ bool ORowSetCacheIterator::isNull() const
return bRet;
}
-::osl::Mutex* ORowSetCacheIterator::getMutex() const
-{
- return m_pRowSet ? m_pRowSet->getMutex() : NULL;
-}
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/dbaccess/source/core/api/RowSetCacheIterator.hxx b/dbaccess/source/core/api/RowSetCacheIterator.hxx
index 083a82f..82d118e 100644
--- a/dbaccess/source/core/api/RowSetCacheIterator.hxx
+++ b/dbaccess/source/core/api/RowSetCacheIterator.hxx
@@ -73,7 +73,6 @@ namespace dbaccess
void setBookmark(const ::com::sun::star::uno::Any& _rBookmark);
::com::sun::star::uno::Any getBookmark() const { return m_aIter->second.aBookmark; }
- ::osl::Mutex* getMutex() const;
ORowSetCacheMap::iterator getIter() const { return m_aIter; }
};
diff --git a/sc/source/ui/unoobj/celllistsource.cxx b/sc/source/ui/unoobj/celllistsource.cxx
index 574cfda..9191597 100644
--- a/sc/source/ui/unoobj/celllistsource.cxx
+++ b/sc/source/ui/unoobj/celllistsource.cxx
@@ -42,22 +42,6 @@ namespace calc
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::form::binding;
-#ifdef DBG_UTIL
- const char* OCellListSource::checkConsistency_static( const void* _pThis )
- {
- return static_cast< const OCellListSource* >( _pThis )->checkConsistency( );
- }
-
- const char* OCellListSource::checkConsistency( ) const
- {
- const char* pAssertion = NULL;
-
- // TODO: place any checks here to ensure consistency of this instance
-
- return pAssertion;
- }
-#endif
-
OCellListSource::OCellListSource( const Reference< XSpreadsheetDocument >& _rxDocument )
:OCellListSource_Base( m_aMutex )
,OCellListSource_PBase( OCellListSource_Base::rBHelper )
diff --git a/sc/source/ui/unoobj/celllistsource.hxx b/sc/source/ui/unoobj/celllistsource.hxx
index fc8a1a9..03b1e67 100644
--- a/sc/source/ui/unoobj/celllistsource.hxx
+++ b/sc/source/ui/unoobj/celllistsource.hxx
@@ -146,12 +146,6 @@ namespace calc
OCellListSource(); // never implemented
OCellListSource( const OCellListSource& ); // never implemented
OCellListSource& operator=( const OCellListSource& ); // never implemented
-
-#ifdef DBG_UTIL
- private:
- static const char* checkConsistency_static( const void* _pThis );
- const char* checkConsistency( ) const;
-#endif
};
} // namespace calc
diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx
index 6a34339..1bce4af 100644
--- a/sc/source/ui/unoobj/cellvaluebinding.cxx
+++ b/sc/source/ui/unoobj/cellvaluebinding.cxx
@@ -47,25 +47,6 @@ namespace calc
using namespace ::com::sun::star::util;
using namespace ::com::sun::star::form::binding;
-#ifdef DBG_UTIL
- const char* OCellValueBinding::checkConsistency_static( const void* _pThis )
- {
- return static_cast< const OCellValueBinding* >( _pThis )->checkConsistency( );
- }
-
- const char* OCellValueBinding::checkConsistency( ) const
- {
- const char* pAssertion = NULL;
- if ( m_xCellText.is() && !m_xCell.is() )
- // there are places (e.g. getSupportedTypes) which rely on the fact
- // that m_xCellText.is() implies m_xCell.is()
- pAssertion = "cell references inconsistent!";
-
- // TODO: place any additional checks here to ensure consistency of this instance
- return pAssertion;
- }
-#endif
-
OCellValueBinding::OCellValueBinding( const Reference< XSpreadsheetDocument >& _rxDocument, bool _bListPos )
:OCellValueBinding_Base( m_aMutex )
,OCellValueBinding_PBase( OCellValueBinding_Base::rBHelper )
diff --git a/sc/source/ui/unoobj/cellvaluebinding.hxx b/sc/source/ui/unoobj/cellvaluebinding.hxx
index 2e19ac9..4b1ff80 100644
--- a/sc/source/ui/unoobj/cellvaluebinding.hxx
+++ b/sc/source/ui/unoobj/cellvaluebinding.hxx
@@ -141,12 +141,6 @@ namespace calc
OCellValueBinding(); // never implemented
OCellValueBinding( const OCellValueBinding& ); // never implemented
OCellValueBinding& operator=( const OCellValueBinding& ); // never implemented
-
-#ifdef DBG_UTIL
- private:
- static const char* checkConsistency_static( const void* _pThis );
- const char* checkConsistency( ) const;
-#endif
};
} // namespace calc
diff --git a/unusedcode.easy b/unusedcode.easy
index ad3ba9c..4379f7f 100644
--- a/unusedcode.easy
+++ b/unusedcode.easy
@@ -169,14 +169,13 @@ apitest::XTextContent::testAttach()
apitest::XTextContent::testGetAnchor()
apitest::XTextField::testGetPresentation()
basegfx::tools::containsOnlyHorizontalAndVerticalEdges(basegfx::B2DPolyPolygon const&)
-calc::OCellListSource::checkConsistency_static(void const*)
-calc::OCellValueBinding::checkConsistency_static(void const*)
canvas::createSurfaceProxyManager(boost::shared_ptr<canvas::IRenderModule> const&)
chart::BaseGFXHelper::B2IRectangleToAWTRectangle(basegfx::B2IRange const&)
chart::ChartTypeUnoDlg::Create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
chart::InternalData::isDefaultData()
chart::ShapeToolbarController::create(com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> const&)
comphelper::OAccessibleImplementationAccess::setStateBit(short, bool)
+comphelper::ThreadPool::getSharedOptimalPool()
comphelper::detail::ConfigurationWrapper::getGroupReadWrite(boost::shared_ptr<comphelper::ConfigurationChanges> const&, rtl::OUString const&) const
comphelper::detail::ConfigurationWrapper::getLocalizedPropertyValue(rtl::OUString const&) const
comphelper::detail::ConfigurationWrapper::setLocalizedPropertyValue(boost::shared_ptr<comphelper::ConfigurationChanges> const&, rtl::OUString const&, com::sun::star::uno::Any const&) const
More information about the Libreoffice-commits
mailing list