diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-27 11:12:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-27 13:06:59 +0200 |
commit | e5ece062058f7772f8414d47d07bb8af6e8e5c2a (patch) | |
tree | 97ab9340c5e29f5445279a9585b4abe42396b14d /sw | |
parent | 2d5090419e0113f5b411ee84bfc55926a19da411 (diff) |
loplugin:oncevar in sw
Change-Id: Ia96172489eec09607113d388a5b683bb6e0d2dec
Reviewed-on: https://gerrit.libreoffice.org/39290
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
80 files changed, 170 insertions, 303 deletions
diff --git a/sw/qa/core/macros-test.cxx b/sw/qa/core/macros-test.cxx index b356a5f237fc..cc75587a04dd 100644 --- a/sw/qa/core/macros-test.cxx +++ b/sw/qa/core/macros-test.cxx @@ -159,11 +159,10 @@ void SwMacrosTest::testVba() OUString("vnd.sun.Star.script:Project.NewMacros.Macro1?language=Basic&location=document") } }; - OUString aFileExtension( "doc" ); for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( testInfo ); ++i ) { OUString aFileName; - createFileURL(testInfo[i].sFileBaseName, aFileExtension, aFileName); + createFileURL(testInfo[i].sFileBaseName, "doc", aFileName); uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.text.TextDocument"); OUStringBuffer sMsg( "Failed to load " ); sMsg.append ( aFileName ); diff --git a/sw/qa/core/test_ToxTextGenerator.cxx b/sw/qa/core/test_ToxTextGenerator.cxx index 2a41c9844201..a9b280f59994 100644 --- a/sw/qa/core/test_ToxTextGenerator.cxx +++ b/sw/qa/core/test_ToxTextGenerator.cxx @@ -61,7 +61,7 @@ struct MockedSortTab : public SwTOXSortTabBase { void ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems() { - OUString expected(""); + OUString const expected(""); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(0); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -69,7 +69,7 @@ ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems() void ToxTextGeneratorTest::OneAtSignIsReturnedForPageNumberPlaceholderOfOneItem() { - OUString expected("@~"); + OUString const expected("@~"); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(1); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -77,7 +77,7 @@ ToxTextGeneratorTest::OneAtSignIsReturnedForPageNumberPlaceholderOfOneItem() void ToxTextGeneratorTest::TwoAtSignsAreReturnedForPageNumberPlaceholderOfOneItem() { - OUString expected("@, @~"); + OUString const expected("@, @~"); OUString actual = ToxTextGenerator::ConstructPageNumberPlaceholder(2); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -88,7 +88,7 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfNoTextMarkIsSet() MockedSortTab sortTab; sortTab.pTextMark = nullptr; - OUString expected(""); + OUString const expected(""); OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0); CPPUNIT_ASSERT_EQUAL(expected, actual); } @@ -99,7 +99,7 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfToxSourcesIsEmpty() MockedSortTab sortTab; sortTab.pTextMark = reinterpret_cast<SwTextTOXMark*>(1); - OUString expected(""); + OUString const expected(""); OUString actual = ToxTextGenerator::GetNumStringOfFirstNode(sortTab, false, 0); CPPUNIT_ASSERT_EQUAL(expected, actual); } diff --git a/sw/qa/core/test_ToxWhitespaceStripper.cxx b/sw/qa/core/test_ToxWhitespaceStripper.cxx index 53819333579e..dc3b23b828aa 100644 --- a/sw/qa/core/test_ToxWhitespaceStripper.cxx +++ b/sw/qa/core/test_ToxWhitespaceStripper.cxx @@ -49,7 +49,7 @@ void ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() { { - OUString test("abc\n"); + OUString const test("abc\n"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); @@ -57,7 +57,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(3)); } { - OUString test("abc\n\n"); + OUString const test("abc\n\n"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); @@ -66,7 +66,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(3), sut.GetPositionInStrippedString(4)); } { - OUString test("abc\ndef"); + OUString const test("abc\ndef"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(0), sut.GetPositionInStrippedString(0)); CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(1), sut.GetPositionInStrippedString(1)); @@ -78,7 +78,7 @@ ToxWhitespaceStripperTest::MappingCharactersToVariousStrippedStringsWorks() } { // 012345 6789 - OUString test(" abc \ndef"); + OUString const test(" abc \ndef"); // 01234567 // " abc def" ToxWhitespaceStripper sut(test); @@ -99,38 +99,38 @@ void ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks() { { - OUString test("abc\n"); - OUString expected("abc"); + OUString const test("abc\n"); + OUString const expected("abc"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test("abc\n\n"); - OUString expected("abc"); + OUString const test("abc\n\n"); + OUString const expected("abc"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test("abc\ndef"); - OUString expected("abc def"); + OUString const test("abc\ndef"); + OUString const expected("abc def"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test(" abc \ndef"); - OUString expected(" abc def"); + OUString const test(" abc \ndef"); + OUString const expected(" abc def"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test(" "); - OUString expected(""); + OUString const test(" "); + OUString const expected(""); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } { - OUString test("d "); - OUString expected("d"); + OUString const test("d "); + OUString const expected("d"); ToxWhitespaceStripper sut(test); CPPUNIT_ASSERT_EQUAL(expected, sut.GetStrippedString()); } @@ -139,7 +139,7 @@ ToxWhitespaceStripperTest::StrippingWhitespacesFromVariousStringsWorks() void ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested() { - OUString test("abc"); + OUString const test("abc"); ToxWhitespaceStripper sut(test); sal_Int32 expected = test.getLength(); CPPUNIT_ASSERT_EQUAL(expected, sut.GetPositionInStrippedString(test.getLength())); @@ -148,9 +148,9 @@ ToxWhitespaceStripperTest::PositionAfterStringCanBeRequested() void ToxWhitespaceStripperTest::InvalidPositionIsMappedToLastEntry() { - OUString test("ab c"); + OUString const test("ab c"); ToxWhitespaceStripper sut(test); - sal_Int32 expected = 4; // the length of the string after merging the two whitespaces + sal_Int32 const expected = 4; // the length of the string after merging the two whitespaces sal_Int32 result = sut.GetPositionInStrippedString(40); // a value past the original string length CPPUNIT_ASSERT_EQUAL(expected, result); } diff --git a/sw/qa/core/uwriter.cxx b/sw/qa/core/uwriter.cxx index 4148d93c40f2..b6bb8526b6b0 100644 --- a/sw/qa/core/uwriter.cxx +++ b/sw/qa/core/uwriter.cxx @@ -1559,13 +1559,11 @@ void SwDocTest::testClientModify() CPPUNIT_ASSERT_EQUAL(aClient1.GetRegisteredIn(), static_cast<SwModify*>(nullptr)); CPPUNIT_ASSERT_EQUAL(aClient2.GetRegisteredIn(), static_cast<SwModify*>(nullptr)); { - int nCount = 0; SwIterator<TestClient,SwModify> aIter(aMod); for(TestClient* pClient = aIter.First(); pClient ; pClient = aIter.Next()) { CPPUNIT_ASSERT(false); } - CPPUNIT_ASSERT_EQUAL(nCount,0); } aMod.ModifyBroadcast(nullptr, nullptr); CPPUNIT_ASSERT_EQUAL(aClient1.m_nModifyCount,2); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx index 9a43087df0c8..3a84b313b15c 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx @@ -593,7 +593,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx") comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); //check that images are also saved - OUString sImageFile( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name + OUString const sImageFile( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name uno::Reference<io::XInputStream> xInputStream(xNameAccess->getByName( sImageFile ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream.is() ); } @@ -620,12 +620,12 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx") comphelper::getComponentContext(m_xSFactory), maTempFile.GetURL()); //check that images are also saved - OUString sImageFile1( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name + OUString const sImageFile1( "word/media/OOXDiagramDataRels1_0.jpeg" ); //added anchor id to form a uniqe name uno::Reference<io::XInputStream> xInputStream1(xNameAccess->getByName( sImageFile1 ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream1.is() ); //check that images are saved for other smart-arts as well. - OUString sImageFile2( "word/media/OOXDiagramDataRels2_0.jpeg" ); //added anchor id to form a uniqe name + OUString const sImageFile2( "word/media/OOXDiagramDataRels2_0.jpeg" ); //added anchor id to form a uniqe name uno::Reference<io::XInputStream> xInputStream2(xNameAccess->getByName( sImageFile2 ), uno::UNO_QUERY); CPPUNIT_ASSERT( xInputStream2.is() ); } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index 67179b5c14a0..c4c4f035a784 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -691,8 +691,6 @@ DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx") if (!pXmlDoc) return; - sal_Int32 IntMax = SAL_MAX_INT32; - xmlXPathObjectPtr pXmlObjs[6]; pXmlObjs[0] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionH[1]/wp:posOffset[1]"); pXmlObjs[1] = getXPathNode(pXmlDoc,"/w:document[1]/w:body[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:positionV[1]/wp:posOffset[1]"); @@ -708,7 +706,7 @@ DECLARE_OOXMLEXPORT_TEST(testAbsolutePositionOffsetValue,"fdo78432.docx") CPPUNIT_ASSERT(pXmlObjs[index]->nodesetval != nullptr); xmlNodePtr pXmlNode = pXmlObjs[index]->nodesetval->nodeTab[0]; OUString contents = OUString::createFromAscii(reinterpret_cast<const char*>((pXmlNode->children[0]).content)); - CPPUNIT_ASSERT( contents.toInt64() <= IntMax ); + CPPUNIT_ASSERT( contents.toInt64() <= SAL_MAX_INT32 ); xmlXPathFreeObject(pXmlObjs[index]); } } diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx index ac7ba7838132..808ac9679b14 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport8.cxx @@ -745,7 +745,7 @@ DECLARE_OOXMLEXPORT_TEST(testN793998, "n793998.docx") sal_Int32 nTextPortion = parseDump("/root/page/body/txt/Text[1]", "nWidth").toInt32(); // Width of the first (text) portion sal_Int32 nTabPortion = parseDump("/root/page/body/txt/Text[2]", "nWidth").toInt32(); // Width of the second (tab) portion sal_Int32 nParagraph = parseDump("/root/page/body/txt/infos/bounds", "width").toInt32(); // Width of the paragraph - sal_Int32 nRightMargin = 3000; + sal_Int32 const nRightMargin = 3000; // The problem was that the tab portion didn't ignore the right margin, so text + tab width wasn't larger than body (paragraph - right margin) width. CPPUNIT_ASSERT(nTextPortion + nTabPortion > nParagraph - nRightMargin); } diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx index 0ab46d27f0ee..abba8f9bfe39 100644 --- a/sw/qa/extras/rtfexport/rtfexport.cxx +++ b/sw/qa/extras/rtfexport/rtfexport.cxx @@ -244,14 +244,14 @@ DECLARE_RTFEXPORT_TEST(testMathLim, "math-lim.rtf") DECLARE_RTFEXPORT_TEST(testMathMatrix, "math-matrix.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString aExpected("left [matrix {1 # 2 ## 3 # 4} right ]"); + OUString const aExpected("left [matrix {1 # 2 ## 3 # 4} right ]"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } DECLARE_RTFEXPORT_TEST(testMathBox, "math-mbox.rtf") { OUString aActual = getFormula(getRun(getParagraph(1), 1)); - OUString aExpected("a"); + OUString const aExpected("a"); CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx index fe52bed1cf87..05df875832d5 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -1643,7 +1643,7 @@ DECLARE_RTFIMPORT_TEST(testCp1000018, "cp1000018.rtf") uno::Reference<text::XFootnotesSupplier> xFootnotesSupplier(mxComponent, uno::UNO_QUERY); uno::Reference<container::XIndexAccess> xFootnotes(xFootnotesSupplier->getFootnotes(), uno::UNO_QUERY); uno::Reference<text::XTextRange> xTextRange(xFootnotes->getByIndex(0), uno::UNO_QUERY); - OUString aExpected("Footnote first line.\n"); + OUString const aExpected("Footnote first line.\n"); CPPUNIT_ASSERT_EQUAL(aExpected, xTextRange->getString()); } @@ -2055,7 +2055,7 @@ DECLARE_RTFIMPORT_TEST(testFdo82114, "fdo82114.rtf") { uno::Reference<text::XText> xHeaderText = getProperty< uno::Reference<text::XText> >(getStyles("PageStyles")->getByName("Converted1"), "HeaderText"); OUString aActual = xHeaderText->getString(); - OUString aExpected("First page header, section 2"); + OUString const aExpected("First page header, section 2"); // This was 'Right page header, section 1'. CPPUNIT_ASSERT_EQUAL(aExpected, aActual); } diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index d574ad0efaf6..f743fd5a80b9 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -3764,9 +3764,8 @@ void SwUiWriterTest::testTdf87922() // Get access to the single paragraph in the document. SwNodeIndex aNodeIndex(pDoc->GetNodes().GetEndOfContent(), -1); const OUString& rText = aNodeIndex.GetNode().GetTextNode()->GetText(); - sal_Int32 nIndex = 0; sal_Int32 nLength = rText.getLength(); - SwDrawTextInfo aDrawTextInfo(pWrtShell, *pWrtShell->GetOut(), pScriptInfo, rText, nIndex, nLength); + SwDrawTextInfo aDrawTextInfo(pWrtShell, *pWrtShell->GetOut(), pScriptInfo, rText, 0, nLength); // Root -> page -> body -> text. SwTextFrame* pTextFrame = static_cast<SwTextFrame*>(pWrtShell->GetLayout()->GetLower()->GetLower()->GetLower()); aDrawTextInfo.SetFrame(pTextFrame); diff --git a/sw/source/core/bastyp/bparr.cxx b/sw/source/core/bastyp/bparr.cxx index 5aac6c226c23..b0d62c7a6e9c 100644 --- a/sw/source/core/bastyp/bparr.cxx +++ b/sw/source/core/bastyp/bparr.cxx @@ -412,7 +412,7 @@ sal_uInt16 BigPtrArray::Compress() sal_uInt16 nFirstChgPos = USHRT_MAX; // at which position was the 1st change? // convert fill percentage into number of remaining elements - short nMax = MAXENTRY - (long) MAXENTRY * COMPRESSLVL / 100; + short const nMax = MAXENTRY - (long) MAXENTRY * COMPRESSLVL / 100; for( sal_uInt16 cur = 0; cur < m_nBlock; ++cur ) { diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index e80a3cd54205..a109b502c48e 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -811,8 +811,7 @@ int SwCursorShell::SetCursor( const Point &rLPt, bool bOnlyText, bool bBlock ) if( !pCursor->IsSelOvr( SwCursorSelOverFlags::ChangePos ) ) { - sal_uInt16 nFlag = SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE; - UpdateCursor( nFlag ); + UpdateCursor( SwCursorShell::SCROLLWIN | SwCursorShell::CHKRANGE ); bRet &= ~CRSR_POSOLD; } else if( bOnlyText && !m_pCurrentCursor->HasMark() ) diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 0d14fbf72a94..cfe9031e2f3d 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -1121,10 +1121,9 @@ int SwFindParaAttr::Find( SwPaM* pCursor, SwMoveFnCollection const & fnMove, con } // TODO: searching for attributes in Outliner text?! - bool bSearchInNotes = false; // continue search in correct section (pTextRegion) - if( aSrchPam.Find( *pSearchOpt, bSearchInNotes, *pSText, fnMove, pTextRegion, bInReadOnly ) && + if( aSrchPam.Find( *pSearchOpt, false/*bSearchInNotes*/, *pSText, fnMove, pTextRegion, bInReadOnly ) && *aSrchPam.GetMark() != *aSrchPam.GetPoint() ) break; // found else if( !pSet->Count() ) diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index e68c4eb00cd5..bcce9d2bffbb 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -937,8 +937,7 @@ void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUp if (aPam.Start()->nNode.GetNode().StartOfSectionNode()->IsSectionNode()) { // This would be the last section, so set its condition to false, and avoid hiding it. - OUString aCond("0"); - pSect->SetCondition(aCond); + pSect->SetCondition("0"); bHide = false; } } diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 90cc40202ab8..7605a05e9325 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -1709,7 +1709,6 @@ bool DocumentRedlineManager::AppendTableRowRedline( SwTableRowRedline* pNewRedl, (void)bCallDelete; // #TODO - equivalent for 'SwTableRowRedline' - bool bMerged = false; /* CHECK_REDLINE( this ) */ @@ -1746,7 +1745,7 @@ bool DocumentRedlineManager::AppendTableRowRedline( SwTableRowRedline* pNewRedl, CHECK_REDLINE( this ) */ - return ( nullptr != pNewRedl ) || bMerged; + return nullptr != pNewRedl; } bool DocumentRedlineManager::AppendTableCellRedline( SwTableCellRedline* pNewRedl, bool bCallDelete ) @@ -1754,7 +1753,6 @@ bool DocumentRedlineManager::AppendTableCellRedline( SwTableCellRedline* pNewRed (void)bCallDelete; // #TODO - equivalent for 'SwTableCellRedline' - bool bMerged = false; /* CHECK_REDLINE( this ) */ @@ -1791,7 +1789,7 @@ bool DocumentRedlineManager::AppendTableCellRedline( SwTableCellRedline* pNewRed CHECK_REDLINE( this ) */ - return ( nullptr != pNewRedl ) || bMerged; + return nullptr != pNewRedl; } void DocumentRedlineManager::CompressRedlines() diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index fb0ed0fed7d9..6f518258b588 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -321,7 +321,6 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) SdrObject *pMyObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj(); if( !pMyObj->GetUpGroup() ) { - OUString sDrwFormatNm("DrawObject"); for ( size_t i = 0; i < nMarkCount; ++i ) { SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); @@ -341,7 +340,7 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) for ( size_t i2 = 0; i2 < pLst->GetObjCount(); ++i2 ) { SdrObject* pSubObj = pLst->GetObj( i2 ); - SwDrawFrameFormat *pFormat = MakeDrawFrameFormat( sDrwFormatNm, + SwDrawFrameFormat *pFormat = MakeDrawFrameFormat( "DrawObject", GetDfltFrameFormat() ); pFormat->SetFormatAttr( aAnch ); // #i36010# - set layout direction of the position diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx index 618278a47d09..0dc68ed2b2f1 100644 --- a/sw/source/core/doc/fmtcol.cxx +++ b/sw/source/core/doc/fmtcol.cxx @@ -276,7 +276,7 @@ void SwTextFormatColl::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew bContinue = pNewChgSet->GetTheChgdSet() == &GetAttrSet(); } - for( int nC = 0, nArrLen = SAL_N_ELEMENTS(aFontSizeArr); nC < nArrLen; ++nC ) + for( int nC = 0; nC < int(SAL_N_ELEMENTS(aFontSizeArr)); ++nC ) { const SvxFontHeightItem *pFSize = aFontSizeArr[ nC ], *pOldFSize; if( pFSize && SfxItemState::SET == GetItemState( diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 215b29c730e9..44fbbfaad073 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -107,8 +107,7 @@ namespace // logic to be written with portability in mind. sal_uInt64 whereToWriteEndOfSwBlock = rStream.Tell(); - sal_uInt64 endOfSwBlock = 0; - rStream.WriteUInt64( endOfSwBlock ); + rStream.WriteUInt64( 0 ); // endOfSwBlock return whereToWriteEndOfSwBlock; } @@ -1029,8 +1028,7 @@ bool SwTableAutoFormat::Load( SvStream& rStream, const SwAfVersions& rVersions ) bool SwTableAutoFormat::Save( SvStream& rStream, sal_uInt16 fileVersion ) const { - sal_uInt16 nVal = AUTOFORMAT_DATA_ID; - rStream.WriteUInt16( nVal ); + rStream.WriteUInt16( AUTOFORMAT_DATA_ID ); // --- from 680/dr25 on: store strings as UTF-8 write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, m_aName, RTL_TEXTENCODING_UTF8 ); @@ -1398,8 +1396,7 @@ bool SwTableAutoFormatTable::Save( SvStream& rStream ) const rStream.SetVersion(AUTOFORMAT_FILE_VERSION); // Attention: We need to save a general Header here - sal_uInt16 nVal = AUTOFORMAT_ID; - rStream.WriteUInt16( nVal ) + rStream.WriteUInt16( AUTOFORMAT_ID ) .WriteUChar( 2 ) // Character count of the Header including this value .WriteUChar( GetStoreCharSet( ::osl_getThreadTextEncoding() ) ); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index bba0d703f00d..f16e1cde47a8 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -4016,7 +4016,6 @@ static bool lcl_SetOtherLineHeight( SwTableLine* pLine, CR_SetLineHeight& rParam static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, SwTwips nDist, bool bCheck ) { - bool bRet = true; if( !bCheck ) { SwTableBoxes& rBoxes = pLine->GetTabBoxes(); @@ -4110,7 +4109,7 @@ static bool lcl_InsDelSelLine( SwTableLine* pLine, CR_SetLineHeight& rParam, } } } - return bRet; + return true; } bool SwTable::SetRowHeight( SwTableBox& rAktBox, TableChgWidthHeightType eType, diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index bd3c90a24499..07bb4e869449 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -157,8 +157,6 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) /// update tables of content bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) { - bool bRet = false; - OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOX) != nullptr, "no TOXBaseSection!" ); SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX)); OSL_ENSURE(pTOX, "no current listing"); @@ -194,7 +192,7 @@ bool SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) ::EndProgress( pDocSh ); EndAllAction(); } - return bRet; + return false; } /// Get current listing before or at the Cursor @@ -308,14 +306,13 @@ void SwEditShell::ApplyAutoMark() rtl_TextEncoding eChrSet = ::osl_getThreadTextEncoding(); // SearchOptions to be used in loop below - sal_Int32 nLEV_Other = 2; // -> changedChars; - sal_Int32 nLEV_Longer = 3; //! -> deletedChars; - sal_Int32 nLEV_Shorter = 1; //! -> insertedChars; - - sal_Int32 nSrchFlags = SearchFlags::LEV_RELAXED; + sal_Int32 const nLEV_Other = 2; // -> changedChars; + sal_Int32 const nLEV_Longer = 3; //! -> deletedChars; + sal_Int32 const nLEV_Shorter = 1; //! -> insertedChars; i18nutil::SearchOptions2 aSearchOpt( - SearchAlgorithms_ABSOLUTE, nSrchFlags, + SearchAlgorithms_ABSOLUTE, + SearchFlags::LEV_RELAXED, "", "", SvtSysLocale().GetLanguageTag().getLocale(), nLEV_Other, nLEV_Longer, nLEV_Shorter, @@ -371,8 +368,7 @@ void SwEditShell::ApplyAutoMark() bool bCancel; // todo/mba: assuming that notes shouldn't be searched - bool bSearchInNotes = false; - sal_uLong nRet = Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel, + sal_uLong nRet = Find( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel, FindRanges::InSelAll ); if(nRet) diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 05864d10a4ba..41221d2300bd 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -358,7 +358,6 @@ bool SwPageFrame::GetCursorOfst( SwPosition *pPos, Point &rPoint, bool SwLayoutFrame::FillSelection( SwSelectionList& rList, const SwRect& rRect ) const { - bool bRet = false; if( rRect.IsOver(PaintArea()) ) { const SwFrame* pFrame = Lower(); @@ -368,7 +367,7 @@ bool SwLayoutFrame::FillSelection( SwSelectionList& rList, const SwRect& rRect ) pFrame = pFrame->GetNext(); } } - return bRet; + return false; } bool SwPageFrame::FillSelection( SwSelectionList& rList, const SwRect& rRect ) const diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index f9cb6df41e48..5f32ed3f6da0 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -491,7 +491,6 @@ bool SwOLENode::IsInGlobalDocSection() const bool SwOLENode::IsOLEObjectDeleted() const { - bool bRet = false; if( aOLEObj.xOLERef.is() ) { SfxObjectShell* p = GetDoc()->GetPersist(); @@ -500,7 +499,7 @@ bool SwOLENode::IsOLEObjectDeleted() const return !p->GetEmbeddedObjectContainer().HasEmbeddedObject( aOLEObj.aName ); } } - return bRet; + return false; } void SwOLENode::GetNewReplacement() diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx index 500a3eac3c8b..108c8473d309 100644 --- a/sw/source/core/swg/SwXMLTextBlocks.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks.cxx @@ -296,9 +296,8 @@ ErrCode SwXMLTextBlocks::StartPutBlock( const OUString& rShort, const OUString& xRoot = xBlkRoot->openStorageElement( rPackageName, embed::ElementModes::READWRITE ); uno::Reference< beans::XPropertySet > xRootProps( xRoot, uno::UNO_QUERY_THROW ); - OUString aPropName( "MediaType" ); OUString aMime( SotExchange::GetFormatMimeType( SotClipboardFormatId::STARWRITER_8 ) ); - xRootProps->setPropertyValue( aPropName, uno::makeAny( aMime ) ); + xRootProps->setPropertyValue( "MediaType", uno::makeAny( aMime ) ); } catch (const uno::Exception&) { diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 861de5d197d5..d1df0a5252ca 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -177,9 +177,8 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, xRoot = xBlkRoot->openStorageElement( aPackageName, embed::ElementModes::READ ); bool bOasis = SotStorage::GetVersion( xRoot ) > SOFFICE_FILEFORMAT_60; - OUString sStreamName("atevent.xml"); uno::Reference < io::XStream > xDocStream = xRoot->openStreamElement( - sStreamName, embed::ElementModes::READ ); + "atevent.xml", embed::ElementModes::READ ); OSL_ENSURE(xDocStream.is(), "Can't create stream"); if ( xDocStream.is() ) { @@ -264,7 +263,6 @@ ErrCode SwXMLTextBlocks::GetMacroTable( sal_uInt16 nIdx, ErrCode SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) { - ErrCode n = ERRCODE_NONE; OUString aFolderName = GeneratePackageName ( rShort ); OUString aStreamName = aFolderName + ".xml"; rText.clear(); @@ -326,7 +324,7 @@ ErrCode SwXMLTextBlocks::GetBlockText( const OUString& rShort, OUString& rText ) OSL_FAIL( "Tried to open non-existent folder or stream!"); } - return n; + return ERRCODE_NONE; } ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, @@ -355,8 +353,7 @@ ErrCode SwXMLTextBlocks::PutBlockText( const OUString& rShort, embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); - OUString aMime ( "text/xml" ); - xSet->setPropertyValue("MediaType", Any(aMime) ); + xSet->setPropertyValue("MediaType", Any(OUString( "text/xml" )) ); uno::Reference < io::XOutputStream > xOut = xDocStream->getOutputStream(); uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); xSrc->setOutputStream(xOut); @@ -475,8 +472,7 @@ void SwXMLTextBlocks::WriteInfo() embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); - OUString aMime ( "text/xml" ); - xSet->setPropertyValue("MediaType", Any(aMime) ); + xSet->setPropertyValue("MediaType", Any(OUString( "text/xml" )) ); uno::Reference < io::XOutputStream > xOut = xDocStream->getOutputStream(); uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); xSrc->setOutputStream(xOut); @@ -531,15 +527,13 @@ ErrCode SwXMLTextBlocks::SetMacroTable( try { xRoot = xBlkRoot->openStorageElement( aPackageName, embed::ElementModes::WRITE ); - OUString sStreamName("atevent.xml" ); bool bOasis = SotStorage::GetVersion( xRoot ) > SOFFICE_FILEFORMAT_60; - uno::Reference < io::XStream > xDocStream = xRoot->openStreamElement( sStreamName, + uno::Reference < io::XStream > xDocStream = xRoot->openStreamElement( "atevent.xml", embed::ElementModes::WRITE | embed::ElementModes::TRUNCATE ); uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); - OUString aMime( "text/xml" ); - xSet->setPropertyValue("MediaType", Any(aMime) ); + xSet->setPropertyValue("MediaType", Any(OUString( "text/xml" )) ); uno::Reference < io::XOutputStream > xOutputStream = xDocStream->getOutputStream(); // get XML writer diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 65a55aa91d74..cfe12197735f 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1189,7 +1189,6 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, GetAdjusted(); const Point aCharPos( GetTopLeft() ); - bool bRet = true; GetCharRect_( pOrig, nFindOfst, pCMS ); @@ -1244,7 +1243,7 @@ bool SwTextCursor::GetCharRect( SwRect* pOrig, const sal_Int32 nOfst, pOrig->Pos().X() -= nOut + 10; } - return bRet; + return true; } // Return: Offset in String diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 92d16a4b0eb6..c653e16334dd 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -153,13 +153,11 @@ void SwKernPortion::Paint( const SwTextPaintInfo &rInf ) const if( rInf.GetFont()->IsPaintBlank() ) { - OUString aTextDouble(" "); - SwRect aClipRect; rInf.CalcRect( *this, &aClipRect ); SwSaveClip aClip( const_cast<OutputDevice*>(rInf.GetOut()) ); aClip.ChgClip( aClipRect ); - rInf.DrawText( aTextDouble, *this, 0, 2, true ); + rInf.DrawText( " ", *this, 0, 2, true ); } } } diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 5831deb74089..f7ee6d7cb61c 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -1228,7 +1228,6 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey ) { Size aFontSize = GetTextSize_( rInf ); const OUString oldStr = rInf.GetText(); - OUString aStr(" "); sal_Int32 nOldIdx = rInf.GetIdx(); sal_Int32 nOldLen = rInf.GetLen(); @@ -1260,7 +1259,7 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey ) } rInf.SetWidth( sal_uInt16(aFontSize.Width() + nSpace) ); - rInf.SetText( aStr ); + rInf.SetText( " " ); rInf.SetIdx( 0 ); rInf.SetLen( 2 ); SetUnderline( nOldUnder ); @@ -1339,10 +1338,9 @@ void SwSubFont::DrawStretchText_( SwDrawTextInfo &rInf ) if( pUnderFnt && nOldUnder != LINESTYLE_NONE ) { const OUString oldStr = rInf.GetText(); - OUString aStr(" "); sal_Int32 nOldIdx = rInf.GetIdx(); sal_Int32 nOldLen = rInf.GetLen(); - rInf.SetText( aStr ); + rInf.SetText( " " ); rInf.SetIdx( 0 ); rInf.SetLen( 2 ); SetUnderline( nOldUnder ); diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index c29296165256..703393ba557f 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1518,7 +1518,6 @@ void SwChartDataProvider::InvalidateTable( const SwTable *pTable ) bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox &rBox ) { - bool bRes = false; OSL_ENSURE( pTable, "table pointer is NULL" ); if (pTable) { @@ -1570,7 +1569,7 @@ bool SwChartDataProvider::DeleteBox( const SwTable *pTable, const SwTableBox &rB } } } - return bRes; + return false; } void SwChartDataProvider::DisposeAllDataSequences( const SwTable *pTable ) diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 3e902cd9611f..f463bf3f95fd 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -2952,8 +2952,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan SwFlyFrameFormat* pFormat2 = nullptr; // TODO/LATER: Is it the only possible aspect here? - sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; - ::svt::EmbeddedObjectRef xObjRef( xIPObj, nAspect ); + ::svt::EmbeddedObjectRef xObjRef( xIPObj, embed::Aspects::MSOLE_CONTENT ); pFormat2 = pDoc->getIDocumentContentOperations().InsertEmbObject( aPam, xObjRef, &aFrameSet ); assert(pFormat2 && "Doc->Insert(notxt) failed."); diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index e6801bb79984..cc56970350ec 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -248,8 +248,7 @@ void SwPagePreviewLayout::ApplyNewZoomAtViewShell( sal_uInt8 _aNewZoom ) { aNewViewOptions.SetZoom( _aNewZoom ); //#i19975# - consider zoom type. - SvxZoomType eZoomType = SvxZoomType::PERCENT; - aNewViewOptions.SetZoomType( eZoomType ); + aNewViewOptions.SetZoomType( SvxZoomType::PERCENT ); mrParentViewShell.ApplyViewOptions( aNewViewOptions ); } } diff --git a/sw/source/filter/basflt/iodetect.cxx b/sw/source/filter/basflt/iodetect.cxx index 32fd3a13048c..862f0165e4c3 100644 --- a/sw/source/filter/basflt/iodetect.cxx +++ b/sw/source/filter/basflt/iodetect.cxx @@ -296,9 +296,9 @@ bool SwIoSystem::IsDetectableText(const sal_Char* pBuf, sal_uLong &rLen, nNewLen = rLen/2; memcpy(pNewBuf, pBuf, rLen); #ifdef OSL_LITENDIAN - bool bNativeLE = true; + bool const bNativeLE = true; #else - bool bNativeLE = false; + bool const bNativeLE = false; #endif if (bLE != bNativeLE) { diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index 372ee9be7078..0bcca0f9b98f 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -272,7 +272,6 @@ void SwHTMLWriter::OutBasic() for( const auto& pModule: pBasic->GetModules() ) { OUString sLang(SVX_MACRO_LANGUAGE_STARBASIC); - ScriptType eType = STARBASIC; if( bFirst ) { @@ -294,7 +293,7 @@ void SwHTMLWriter::OutBasic() const OUString& rModName = pModule->GetName(); Strm().WriteCharPtr( SAL_NEWLINE_STRING ); // don't indent! HTMLOutFuncs::OutScript( Strm(), GetBaseURL(), pModule->GetSource(), - sLang, eType, aEmptyOUStr, + sLang, STARBASIC, aEmptyOUStr, &rLibName, &rModName, m_eDestEnc, &m_aNonConvertableCharacters ); } diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index eb72f91f3bd7..f5dde653a0e7 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -2040,7 +2040,6 @@ void SwHTMLParser::SetVarSize( SvxCSS1PropertyInfo &rPropInfo, SfxItemSet &rFrameItemSet, SwTwips nDfltWidth, sal_uInt8 nDfltPrcWidth ) { - SwFrameSize eSize = ATT_MIN_SIZE; SwTwips nWidth = nDfltWidth, nHeight = MINFLY; sal_uInt8 nPrcWidth = nDfltPrcWidth, nPrcHeight = 0; switch( rPropInfo.m_eWidthType ) @@ -2070,7 +2069,7 @@ void SwHTMLParser::SetVarSize( SvxCSS1PropertyInfo &rPropInfo, ; } - SwFormatFrameSize aFrameSize( eSize, nWidth, nHeight ); + SwFormatFrameSize aFrameSize( ATT_MIN_SIZE, nWidth, nHeight ); aFrameSize.SetWidthPercent( nPrcWidth ); aFrameSize.SetHeightPercent( nPrcHeight ); rFrameItemSet.Put( aFrameSize ); diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 933da9bddfe2..07f4fa4174e2 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -609,8 +609,7 @@ static void lcl_html_setFixedFontProperty( aTmp <<= (sal_Int16) aFixedFont.GetPitch(); rPropSet->setPropertyValue("FontPitch", aTmp ); - float fVal(10.); - aTmp <<= fVal; + aTmp <<= float(10.0); rPropSet->setPropertyValue("FontHeight", aTmp ); } diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 5f5d78fe52a3..e497972a948c 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -1093,8 +1093,6 @@ SwHTMLTableLayout *HTMLTable::CreateLayoutInfo() (*m_pColumns)[0]->bLeftBorder ? GetBorderWidth(m_aLeftBorderLine, true) : 0; sal_uInt16 nRightBorderWidth = m_bRightBorder ? GetBorderWidth( m_aRightBorderLine, true ) : 0; - sal_uInt16 nInhLeftBorderWidth = 0; - sal_uInt16 nInhRightBorderWidth = 0; m_pLayoutInfo = new SwHTMLTableLayout( m_pSwTable, @@ -1103,7 +1101,7 @@ SwHTMLTableLayout *HTMLTable::CreateLayoutInfo() m_nCellSpacing, m_eTableAdjust, m_nLeftMargin, m_nRightMargin, nBorderWidth, nLeftBorderWidth, nRightBorderWidth, - nInhLeftBorderWidth, nInhRightBorderWidth ); + 0/*nInhLeftBorderWidth*/, 0/*nInhRightBorderWidth*/ ); bool bExportable = true; sal_uInt16 i; diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index e87fb3ad6adf..eeeeca87c8de 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -1075,8 +1075,6 @@ static void ParseCSS1_font_family( const CSS1Expression *pExpr, OSL_ENSURE( pExpr, "no expression" ); OUString aName, aStyleName; - FontFamily eFamily = FAMILY_DONTKNOW; - FontPitch ePitch = PITCH_DONTKNOW; rtl_TextEncoding eEnc = rParser.GetDfltEncoding(); const FontList *pFList = rParser.GetFontList(); bool bFirst = true; @@ -1128,7 +1126,7 @@ static void ParseCSS1_font_family( const CSS1Expression *pExpr, if( !aName.isEmpty() && !rParser.IsIgnoreFontFamily() ) { - SvxFontItem aFont( eFamily, aName, aStyleName, ePitch, + SvxFontItem aFont( FAMILY_DONTKNOW, aName, aStyleName, PITCH_DONTKNOW, eEnc, aItemIds.nFont ); if( rParser.IsSetWesternProps() ) rItemSet.Put( aFont ); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 46691f5fec8b..8c5e7369945a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -6799,13 +6799,11 @@ void DocxAttributeOutput::WritePostitFields() bool DocxAttributeOutput::DropdownField( const SwField* pField ) { - bool bExpand = false; - ww::eField eType = ww::eFORMDROPDOWN; OUString sCmd = FieldString( eType ); GetExport( ).OutputField( pField, eType, sCmd ); - return bExpand; + return false; } bool DocxAttributeOutput::PlaceholderField( const SwField* pField ) diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index fce28149f983..0503f2a97030 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -2068,12 +2068,11 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, const SvxShadowItem* pSI = static_cast<const SvxShadowItem*>(pShadItem); const sal_uInt16 nCstScale = 635; // unit scale between AOO and MS Word - const sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value. + const sal_uInt32 nShadowType = 131074; // shadow type of ms word. need to set the default value. sal_uInt32 nColor = (sal_uInt32)(pSI->GetColor().GetColor()) ; sal_Int32 nOffX = pSI->GetWidth() * nCstScale; sal_Int32 nOffY = pSI->GetWidth() * nCstScale; - sal_uInt32 nShadow = nShadowType; SvxShadowLocation eLocation = pSI->GetLocation(); if( (eLocation!=SvxShadowLocation::NONE) && (pSI->GetWidth()!=0) ) @@ -2102,10 +2101,10 @@ sal_Int32 SwBasicEscherEx::WriteFlyFrameAttr(const SwFrameFormat& rFormat, break; } - rPropOpt.AddOpt( DFF_Prop_shadowColor, wwUtility::RGBToBGR((nColor))); + rPropOpt.AddOpt( DFF_Prop_shadowColor, wwUtility::RGBToBGR(nColor)); rPropOpt.AddOpt( DFF_Prop_shadowOffsetX, nOffX ); rPropOpt.AddOpt( DFF_Prop_shadowOffsetY, nOffY ); - rPropOpt.AddOpt( DFF_Prop_fshadowObscured, nShadow ); + rPropOpt.AddOpt( DFF_Prop_fshadowObscured, nShadowType ); } } } diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 37e38d5c52b4..74a5041ecccc 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -403,9 +403,8 @@ void SwWW8AttrIter::OutAttr( sal_Int32 nSwPos, bool bRuby ) //The hard formatting properties that affect the entire paragraph if (rNd.HasSwAttrSet()) { - bool bDeep = false; // only copy hard attributes - bDeep = false - aExportSet.Set(rNd.GetSwAttrSet(), bDeep); + aExportSet.Set(rNd.GetSwAttrSet(), false/*bDeep*/); // get the current font item. Use rNd.GetSwAttrSet instead of aExportSet: const SvxFontItem &rNdFont = ItemGet<SvxFontItem>(rNd.GetSwAttrSet(), nFontId); pFont = &rNdFont; @@ -2136,7 +2135,6 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) sal_Int32 const nEnd = aStr.getLength(); bool bIncludeEndOfParaCRInRedlineProperties = false; sal_Int32 nOpenAttrWithRange = 0; - OUString aStringForImage("\001"); ww8::WW8TableNodeInfoInner::Pointer_t pTextNodeInfoInner; if ( pTextNodeInfo.get() != nullptr ) @@ -2168,7 +2166,7 @@ void MSWordExportBase::OutputTextNode( const SwTextNode& rNode ) 3) If the anchor is associated with a text node with empty text then we ignore. */ if( rNode.IsTextNode() - && aStr != aStringForImage && !aStr.isEmpty() + && aStr != "\001" && !aStr.isEmpty() && !rNode.GetFlyFormat() && !(IsInTable() && !AllowPostponedTextInTable()) && aAttrIter.IsAnchorLinkedToThisNode(rNode.GetIndex()) ) diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx index ecb31796f019..43cdb2008d75 100644 --- a/sw/source/filter/ww8/wrtw8num.cxx +++ b/sw/source/filter/ww8/wrtw8num.cxx @@ -162,11 +162,11 @@ void WW8AttributeOutput::NumberingDefinition( sal_uInt16 nId, const SwNumRule &r for ( int i = 0; i < WW8ListManager::nMaxLevel; ++i ) SwWW8Writer::WriteShort( *m_rWW8Export.pTableStrm, 0xFFF ); - sal_uInt8 nFlags = 0, nDummy = 0; + sal_uInt8 nFlags = 0; if ( rRule.IsContinusNum() ) nFlags |= 0x1; - m_rWW8Export.pTableStrm->WriteUChar( nFlags ).WriteUChar( nDummy ); + m_rWW8Export.pTableStrm->WriteUChar( nFlags ).WriteUChar( 0/*nDummy*/ ); } void MSWordExportBase::NumberingDefinitions() diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 7b1a06f741aa..b1a49391b848 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2246,11 +2246,11 @@ void WW8AttributeOutput::TableSpacing(ww8::WW8TableNodeInfoInner::Pointer_t pTab if (rUL.GetUpper() > 0) { - sal_uInt8 nPadding = 2; - sal_uInt8 nPcVert = 0; - sal_uInt8 nPcHorz = 0; + sal_uInt8 const nPadding = 2; + sal_uInt8 const nPcVert = 0; + sal_uInt8 const nPcHorz = 0; - sal_uInt8 nTPc = (nPadding << 4) | (nPcVert << 2) | nPcHorz; + sal_uInt8 const nTPc = (nPadding << 4) | (nPcVert << 2) | nPcHorz; m_rWW8Export.InsUInt16(NS_sprm::sprmTPc); m_rWW8Export.pO->push_back( nTPc ); @@ -3321,8 +3321,7 @@ void WW8Export::ExportDocument_Impl() // Write Unencrypted Header 52 bytes to the start of the table stream // EncryptionVersionInfo (4 bytes): A Version structure where Version.vMajor MUST be 0x0001, and Version.vMinor MUST be 0x0001. pTableStrmTemp->Seek( 0 ); - sal_uInt32 nEncType = 0x10001; - pTableStrmTemp->WriteUInt32( nEncType ); + pTableStrmTemp->WriteUInt32( 0x10001 ); // nEncType sal_uInt8 pDocId[16]; aCtx.GetDocId( pDocId ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index e11013186485..1986429414b2 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -657,7 +657,7 @@ void SwWW8WrGrf::WriteGrfFromGrfNode(SvStream& rStrm, const SwGrfNode &rGrfNd, OUString aFileN; rGrfNd.GetFileFilterNms( &aFileN, nullptr ); - sal_uInt16 mm = 94; // 94 = BMP, GIF + sal_uInt16 const mm = 94; // 94 = BMP, GIF WritePICFHeader(rStrm, rFly, mm, nWidth, nHeight, rGrfNd.GetpSwAttrSet()); @@ -679,7 +679,6 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, sal_uInt16 mm, sal_uInt16 nWidth, sal_uInt16 nHeight) { sal_Int16 nXSizeAdd = 0, nYSizeAdd = 0; - sal_Int16 nCropL = 0, nCropR = 0, nCropT = 0, nCropB = 0; Size aGrTwipSz(rGrf.GetPrefSize()); sal_uInt16 nHdrLen = 0x44; @@ -754,10 +753,10 @@ void SwWW8WrGrf::WritePICBulletFHeader(SvStream& rStrm, const Graphic &rGrf, else pArr += 2; - Set_UInt16( pArr, nCropL ); // set dxaCropLeft - Set_UInt16( pArr, nCropT ); // set dyaCropTop - Set_UInt16( pArr, nCropR ); // set dxaCropRight - Set_UInt16( pArr, nCropB ); // set dyaCropBottom + Set_UInt16( pArr, 0 ); // set dxaCropLeft + Set_UInt16( pArr, 0 ); // set dyaCropTop + Set_UInt16( pArr, 0 ); // set dxaCropRight + Set_UInt16( pArr, 0 ); // set dyaCropBottom rStrm.WriteBytes(aArr, nHdrLen); } diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index da52344e2545..ab83079eebf5 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -1946,10 +1946,9 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) // Add a continuous section break if( GetExport().AddSectionBreaksForTOX() ) { - sal_uLong nRstLnNum = 0; SwSection *pParent = rSect.GetParent(); WW8_SepInfo rInfo(&GetExport( ).m_pDoc->GetPageDesc(0), - pParent ? pParent->GetFormat() : nullptr, nRstLnNum); + pParent ? pParent->GetFormat() : nullptr, 0/*nRstLnNum*/); GetExport( ).AttrOutput().SectionBreak( msword::PageBreak, &rInfo ); } @@ -2276,8 +2275,7 @@ void AttributeOutputBase::EndTOX( const SwSection& rSect,bool bCareEnd ) if ( 0 < nCol ) { - sal_uLong nRstLnNum = 0; - WW8_SepInfo rInfo( &GetExport( ).m_pDoc->GetPageDesc( 0 ), rSect.GetFormat() , nRstLnNum ); + WW8_SepInfo rInfo( &GetExport( ).m_pDoc->GetPageDesc( 0 ), rSect.GetFormat(), 0/*nRstLnNum*/ ); GetExport( ).AttrOutput().SectionBreak( msword::PageBreak, &rInfo ); } } diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 9eb7f693b77e..77009b764fed 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1907,8 +1907,7 @@ void SwWW8ImplReader::ImportDop() { if (xInfo->hasPropertyByName("ApplyFormDesignMode")) { - bool bValue = false; - xDocProps->setPropertyValue("ApplyFormDesignMode", css::uno::makeAny(bValue)); + xDocProps->setPropertyValue("ApplyFormDesignMode", css::uno::makeAny(false)); } } } @@ -4869,8 +4868,6 @@ void SwWW8ImplReader::ReadGlobalTemplateSettings( const OUString& sCreatedFrom, ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) { - ErrCode nErrRet = ERRCODE_NONE; - m_rDoc.SetDocumentType( SwDoc::DOCTYPE_MSWORD ); if (m_bNewDoc && m_pStg && !pGloss) { @@ -5376,7 +5373,7 @@ ErrCode SwWW8ImplReader::CoreLoad(WW8Glossary *pGloss) UpdatePageDescs(m_rDoc, nPageDescOffset); - return nErrRet; + return ERRCODE_NONE; } ErrCode SwWW8ImplReader::SetSubStreams(tools::SvRef<SotStorageStream> &rTableStream, diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index 19ca8dee7437..18e5ac15c3ab 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -2415,8 +2415,7 @@ bool WW8FormulaListBox::Import(const uno::Reference < xPropSet->setPropertyValue("HelpText", aTmp ); } - bool bDropDown(true); - xPropSet->setPropertyValue("Dropdown", css::uno::makeAny(bDropDown)); + xPropSet->setPropertyValue("Dropdown", css::uno::makeAny(true)); if (!maListEntries.empty()) { diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 32acea9229c2..53c0550386d6 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -169,7 +169,6 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) // needed if the filterflags say we will convert bookmarks // to SetExpFields! And this the exception! - OUString sHex("\\x"); bool bSetAsHex; bool bAllowCr = SwFltGetFlag(m_nFieldFlags, SwFltControlStack::ALLOW_FLD_CR); @@ -206,7 +205,7 @@ long SwWW8ImplReader::Read_Book(WW8PLCFManResult*) if( bSetAsHex ) { //all Hex-Numbers with \x before - OUString sTmp( sHex ); + OUString sTmp( "\\x" ); if( cChar < 0x10 ) sTmp += "0"; sTmp += OUString::number( cChar, 16 ); @@ -1018,7 +1017,6 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) // If none of these special characters is found, the function returns 0. void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) { - OUString sHex("\\x"); bool bAllowCr = SwFltGetFlag( m_nFieldFlags, SwFltControlStack::TAGS_IN_TEXT ) || SwFltGetFlag( m_nFieldFlags, SwFltControlStack::ALLOW_FLD_CR ); sal_Unicode cChar; @@ -1071,7 +1069,7 @@ void SwWW8ImplReader::MakeTagString( OUString& rStr, const OUString& rOrg ) if( bSetAsHex ) { //all Hex-Numbers with \x before - OUString sTmp( sHex ); + OUString sTmp( "\\x" ); if( cChar < 0x10 ) sTmp += "0"; sTmp += OUString::number( cChar, 16 ); @@ -3038,7 +3036,6 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) case TOX_CONTENT: { bool bIsHyperlink = false; - bool bShowPage = true; // We set SwTOXElement::OutlineLevel only if // the parameter \o is within 1 to 9 // or the parameter \f exists @@ -3223,7 +3220,7 @@ eF_ResT SwWW8ImplReader::Read_F_Tox( WW8FieldDesc* pF, OUString& rStr ) { aPattern.insert(aPattern.begin(), aLinkStart); } - else if ( bShowPage ) + else { for (SwFormTokens::iterator aItr = aPattern.begin();aItr!= aPattern.end();++aItr) { diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index f5752a43481c..d6f02d7bdcec 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -304,8 +304,7 @@ void SwWW8ImplReader::SetDocumentGrid(SwFrameFormat &rFormat, const wwSection &r aGrid.SetBaseHeight(writer_cast<sal_uInt16>(nLinePitch)); } - sal_Int32 nRubyHeight = 0; - aGrid.SetRubyHeight(writer_cast<sal_uInt16>(nRubyHeight)); + aGrid.SetRubyHeight(0); rFormat.SetFormatAttr(aGrid); } @@ -1431,7 +1430,7 @@ bool SwWW8ImplReader::SetBorder(SvxBoxItem& rBox, const WW8_BRCVer9* pbrc, { WW8_BETW, SvxBoxItemLine::BOTTOM } }; - for( int i = 0, nEnd = 4; i < nEnd; ++i ) + for( int i = 0; i < 4; ++i ) { // ungueltige Borders ausfiltern const WW8_BRCVer9& rB = pbrc[ aIdArr[ i ].first ]; diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx index 6d41045d0b8c..0e2758b6b0fd 100644 --- a/sw/source/filter/xml/xmlexp.cxx +++ b/sw/source/filter/xml/xmlexp.cxx @@ -426,9 +426,8 @@ void SwXMLExport::SetBodyAttributes() if( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() && pDoc->getIDocumentLayoutAccess().GetCurrentViewShell()->GetPageCount() > 1 ) { - bool bValue = true; OUStringBuffer sBuffer; - ::sax::Converter::convertBool(sBuffer, bValue); + ::sax::Converter::convertBool(sBuffer, true); AddAttribute(XML_NAMESPACE_TEXT, XML_USE_SOFT_PAGE_BREAKS, sBuffer.makeStringAndClear()); } diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index dba62895d3f7..e12627b4c656 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1259,8 +1259,7 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if( ! bPrinterIndependentLayout ) { - sal_Int16 nTmp = document::PrinterIndependentLayout::DISABLED; - xProps->setPropertyValue( "PrinterIndependentLayout", Any(nTmp) ); + xProps->setPropertyValue( "PrinterIndependentLayout", Any(sal_Int16(document::PrinterIndependentLayout::DISABLED)) ); } if( ! bAddExternalLeading ) diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 99052561e3db..58a3bd20f4b8 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -269,8 +269,6 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( try { // create object with desired ClassId - sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT; - OUString aName("DummyName"); uno::Sequence < sal_Int8 > aClass( aClassName.GetByteSequence() ); uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Sequence<beans::PropertyValue> aObjArgs( comphelper::InitPropertySequence({ @@ -278,11 +276,11 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOLEObject( })); uno::Reference < embed::XEmbeddedObject > xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( - aClass, OUString(), xStorage, aName, aObjArgs), uno::UNO_QUERY ); + aClass, OUString(), xStorage, "DummyName", aObjArgs), uno::UNO_QUERY ); if ( xObj.is() ) { //TODO/LATER: is it enough to only set the VisAreaSize? - lcl_setObjectVisualArea( xObj, nAspect, aTwipSize, MapUnit::MapTwip ); + lcl_setObjectVisualArea( xObj, embed::Aspects::MSOLE_CONTENT, aTwipSize, MapUnit::MapTwip ); } if( pTextCursor ) @@ -566,7 +564,6 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( try { // create object with desired ClassId - OUString aName("DummyName"); uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::OOoEmbeddedObjectFactory::create(::comphelper::getProcessComponentContext()); @@ -587,7 +584,7 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink( uno::Reference < embed::XEmbeddedObject > xObj( xFactory->createInstanceLink( - xStorage, aName, aMediaDescriptor, uno::Sequence< beans::PropertyValue >() ), + xStorage, "DummyName", aMediaDescriptor, uno::Sequence< beans::PropertyValue >() ), uno::UNO_QUERY_THROW ); { @@ -700,12 +697,11 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin( try { // create object with desired ClassId - OUString aName("DummyName"); uno::Sequence < sal_Int8 > aClass( SvGlobalName( SO3_PLUGIN_CLASSID ).GetByteSequence() ); uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Reference < embed::XEmbeddedObject > xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( - aClass, OUString(), xStorage, aName, + aClass, OUString(), xStorage, "DummyName", uno::Sequence < beans::PropertyValue >() ), uno::UNO_QUERY ); // set size to the object @@ -833,12 +829,11 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra try { // create object with desired ClassId - OUString aName("DummyName"); uno::Sequence < sal_Int8 > aClass( SvGlobalName( SO3_IFRAME_CLASSID ).GetByteSequence() ); uno::Reference < embed::XEmbeddedObjectCreator > xFactory = embed::EmbeddedObjectCreator::create( ::comphelper::getProcessComponentContext() ); uno::Reference < embed::XEmbeddedObject > xObj = uno::Reference < embed::XEmbeddedObject >( xFactory->createInstanceInitNew( - aClass, OUString(), xStorage, aName, + aClass, OUString(), xStorage, "DummyName", uno::Sequence < beans::PropertyValue >() ), uno::UNO_QUERY ); // set size to the object diff --git a/sw/source/ui/chrdlg/swuiccoll.cxx b/sw/source/ui/chrdlg/swuiccoll.cxx index b76eb30dbf8c..6d835abcf2e3 100644 --- a/sw/source/ui/chrdlg/swuiccoll.cxx +++ b/sw/source/ui/chrdlg/swuiccoll.cxx @@ -159,7 +159,6 @@ VclPtr<SfxTabPage> SwCondCollPage::Create(vcl::Window *pParent, const SfxItemSet bool SwCondCollPage::FillItemSet(SfxItemSet *rSet) { - bool bModified = true; SwCondCollItem aCondItem; for (size_t i = 0; i < m_aStrArr.size(); ++i) { @@ -167,7 +166,7 @@ bool SwCondCollPage::FillItemSet(SfxItemSet *rSet) aCondItem.SetStyle( &sEntry, i); } rSet->Put(aCondItem); - return bModified; + return true; } void SwCondCollPage::Reset(const SfxItemSet *) diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 4718cb12736f..d608139bfee6 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1675,15 +1675,12 @@ void SwMarkPreview::PaintPage(vcl::RenderContext& rRenderContext, const tools::R drawRect(rRenderContext, rRect, m_aTransCol, m_aPrintAreaCol); // draw Testparagraph - sal_uLong nLTextBorder = 4; - sal_uLong nRTextBorder = 4; - sal_uLong nTTextBorder = 4; tools::Rectangle aTextLine = rRect; aTextLine.SetSize(Size(aTextLine.GetWidth(), 2)); - aTextLine.Left() += nLTextBorder; - aTextLine.Right() -= nRTextBorder; - aTextLine.Move(0, nTTextBorder); + aTextLine.Left() += 4; + aTextLine.Right() -= 4; + aTextLine.Move(0, 4); const long nStep = aTextLine.GetHeight() + 2; const long nLines = rRect.GetHeight() / (aTextLine.GetHeight() + 2) - 1; diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx index fe769115b0a2..f6d34dc72589 100644 --- a/sw/source/ui/fldui/flddb.cxx +++ b/sw/source/ui/fldui/flddb.cxx @@ -500,8 +500,7 @@ void SwFieldDBPage::FillUserData() void SwFieldDBPage::ActivateMailMergeAddress() { - sal_uLong nData = TYP_DBFLD; - m_pTypeLB->SelectEntryPos(m_pTypeLB->GetEntryPos( reinterpret_cast<const void*>( nData ) )); + m_pTypeLB->SelectEntryPos(m_pTypeLB->GetEntryPos( reinterpret_cast<const void*>( TYP_DBFLD ) )); m_pTypeLB->GetSelectHdl().Call(*m_pTypeLB); const SwDBData& rData = SW_MOD()->GetDBConfig()->GetAddressSource(); m_pDatabaseTLB->Select(rData.sDataSource, rData.sCommand, aEmptyOUStr); diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index de8570f82c1e..4768e0166264 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -3078,11 +3078,9 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) m_pPrintFrameCB->Check(rPrt.GetValue()); m_pPrintFrameCB->SaveValue(); // textflow - SfxItemState eState; if( (!m_bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES))) - && m_sDlgType != "PictureDialog" && m_sDlgType != "ObjectDialog" && - SfxItemState::UNKNOWN != ( eState = rSet->GetItemState( - RES_FRAMEDIR )) ) + && m_sDlgType != "PictureDialog" && m_sDlgType != "ObjectDialog" + && SfxItemState::UNKNOWN != rSet->GetItemState( RES_FRAMEDIR ) ) { m_pTextFlowFT->Show(); m_pTextFlowLB->Show(); @@ -3090,8 +3088,7 @@ void SwFrameAddPage::Reset(const SfxItemSet *rSet ) //vertical text flow is not possible in HTML if(m_bHtmlMode) { - SvxFrameDirection nData = SvxFrameDirection::Vertical_RL_TB; - m_pTextFlowLB->RemoveEntry(m_pTextFlowLB->GetEntryPos(reinterpret_cast<void*>(nData))); + m_pTextFlowLB->RemoveEntry(m_pTextFlowLB->GetEntryPos(reinterpret_cast<void*>(SvxFrameDirection::Vertical_RL_TB))); } SvxFrameDirection nVal = static_cast<const SvxFrameDirectionItem&>(rSet->Get(RES_FRAMEDIR)).GetValue(); sal_Int32 nPos; diff --git a/sw/source/ui/index/cntex.cxx b/sw/source/ui/index/cntex.cxx index 72b2bb61fbee..205be4835b8e 100644 --- a/sw/source/ui/index/cntex.cxx +++ b/sw/source/ui/index/cntex.cxx @@ -112,10 +112,9 @@ IMPL_LINK_NOARG(SwMultiTOXTabDialog, CreateExample_Hdl, SwOneExampleFrame&, void uno::Reference< container::XNameAccess > xSections = xSectionSupplier->getTextSections(); - OUString sSectionName("IndexSection_"); for(int i = 0; i < 7; ++i ) { - OUString sTmp( sSectionName ); sTmp += OUString::number(i); + OUString sTmp = "IndexSection_" + OUString::number(i); uno::Any aSection = xSections->getByName( sTmp ); aSection >>= m_pxIndexSectionsArray[i]->xContainerSection; } diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index a04f5c8fdc8c..91b2a360ead5 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -452,9 +452,8 @@ static void lcl_SelectSameStrings(SwWrtShell& rSh, bool bWordOnly, bool bCaseSen bool bCancel; //todo/mba: assuming that notes should not be searched - bool bSearchInNotes = false; - rSh.Find( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End, bCancel, - (FindRanges)(FindRanges::InSelAll|FindRanges::InBodyOnly) ); + rSh.Find( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End, bCancel, + FindRanges::InSelAll | FindRanges::InBodyOnly ); } void SwIndexMarkPane::InsertMark() @@ -633,8 +632,7 @@ IMPL_LINK_NOARG(SwIndexMarkPane, CloseHdl, Button*, void) { if(bNewMark) { - sal_uInt16 nSlot = FN_INSERT_IDX_ENTRY_DLG; - SfxViewFrame::Current()->GetDispatcher()->Execute(nSlot, + SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_IDX_ENTRY_DLG, SfxCallMode::ASYNCHRON|SfxCallMode::RECORD); } else @@ -1135,8 +1133,7 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, CloseHdl, Button*, void) { if(bNewEntry) { - sal_uInt16 nSlot = FN_INSERT_AUTH_ENTRY_DLG; - SfxViewFrame::Current()->GetDispatcher()->Execute(nSlot, + SfxViewFrame::Current()->GetDispatcher()->Execute(FN_INSERT_AUTH_ENTRY_DLG, SfxCallMode::ASYNCHRON|SfxCallMode::RECORD); } else diff --git a/sw/source/ui/misc/linenum.cxx b/sw/source/ui/misc/linenum.cxx index b31af09f6f29..a8020dd42ff5 100644 --- a/sw/source/ui/misc/linenum.cxx +++ b/sw/source/ui/misc/linenum.cxx @@ -38,9 +38,8 @@ static rtl::Reference<SwDocStyleSheet> lcl_getDocStyleSheet(const OUString& rName, SwWrtShell *pSh) { - SfxStyleFamily nFamily = SfxStyleFamily::Para; SfxStyleSheetBasePool* pBase = pSh->GetView().GetDocShell()->GetStyleSheetPool(); - SfxStyleSheetBase* pStyle = pBase->Find(rName, nFamily); + SfxStyleSheetBase* pStyle = pBase->Find(rName, SfxStyleFamily::Para); SAL_WARN_IF( !pStyle, "sw.ui", "Style not found" ); if(!pStyle) return nullptr; diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 2a8aa76ca608..d3032c298a4c 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -246,8 +246,7 @@ IMPL_LINK( SwOutlineTabDialog, FormHdl, Button *, pBtn, void ) OString sHelpId(pFormMenu->GetHelpId(pFormMenu->GetItemId("form1"))); for (sal_Int32 i = 2; i <= 9; ++i) { - OString sForm("form"); - pFormMenu->SetHelpId(pFormMenu->GetItemId(sForm + OString::number(i)), sHelpId); + pFormMenu->SetHelpId(pFormMenu->GetItemId("form" + OString::number(i)), sHelpId); } pFormMenu->SetSelectHdl(LINK(this, SwOutlineTabDialog, MenuSelectHdl)); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 465fdc9c4b62..527052c9c996 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1247,7 +1247,7 @@ void SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (nId == m_nBackgroundId) { - SvxBackgroundTabFlags nFlagType = SvxBackgroundTabFlags::SHOW_TBLCTL | SvxBackgroundTabFlags::SHOW_SELECTOR; + SvxBackgroundTabFlags const nFlagType = SvxBackgroundTabFlags::SHOW_TBLCTL | SvxBackgroundTabFlags::SHOW_SELECTOR; aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, static_cast<sal_uInt32>(nFlagType))); rPage.PageCreated(aSet); } diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index c409de73df73..4e1ce1815a5c 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -867,10 +867,9 @@ public: void addProp( const OUString& Name, const uno::Any& Value ) { - sal_Int16 attributes = 128; uno::Reference< beans::XPropertyContainer > xContainer( mxUserDefinedProp, uno::UNO_QUERY_THROW ); // TODO fixme, perform the necessary Type Value conversions - xContainer->addProperty( Name, attributes, Value ); + xContainer->addProperty( Name, sal_Int16(128), Value ); } }; diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx index 933032169085..5b27aed01fff 100644 --- a/sw/source/ui/vba/vbafont.cxx +++ b/sw/source/ui/vba/vbafont.cxx @@ -67,9 +67,7 @@ class UnderLineMapper private: UnderLineMapper() { - sal_Int32 nLen = SAL_N_ELEMENTS( UnderLineTable ); - - for ( sal_Int32 index=0; index<nLen; ++index ) + for ( sal_Int32 index=0; index<sal_Int32(SAL_N_ELEMENTS( UnderLineTable )); ++index ) { MSO2OOO[ UnderLineTable[ index ].nMSOConst ] = UnderLineTable[ index ].nOOOConst; OOO2MSO[ UnderLineTable[ index ].nOOOConst ] = UnderLineTable[ index ].nMSOConst; diff --git a/sw/source/ui/vba/vbalistformat.cxx b/sw/source/ui/vba/vbalistformat.cxx index 670fe376b427..25c8a8ab0426 100644 --- a/sw/source/ui/vba/vbalistformat.cxx +++ b/sw/source/ui/vba/vbalistformat.cxx @@ -74,8 +74,7 @@ void SAL_CALL SwVbaListFormat::ApplyListTemplate( const css::uno::Reference< wor xProps->setPropertyValue("ParaIsNumberingRestart", uno::makeAny( isNumberingRestart ) ); if( isNumberingRestart ) { - sal_Int16 nStartValue = 1; - xProps->setPropertyValue("NumberingStartValue", uno::makeAny( nStartValue ) ); + xProps->setPropertyValue("NumberingStartValue", uno::makeAny( sal_Int16(1) ) ); } isFirstElement = false; } diff --git a/sw/source/ui/vba/vbalisthelper.cxx b/sw/source/ui/vba/vbalisthelper.cxx index 483526bfab13..e0775ced187b 100644 --- a/sw/source/ui/vba/vbalisthelper.cxx +++ b/sw/source/ui/vba/vbalisthelper.cxx @@ -134,10 +134,8 @@ void SwVbaListHelper::CreateBulletListTemplate() sal_Int32 nLevel = 0; uno::Sequence< beans::PropertyValue > aPropertyValues; mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues; - OUString sCharStyleName( "Bullet Symbols" ); - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_CHAR_STYLE_NAME, uno::makeAny( sCharStyleName ) ); - sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL; - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( nNumberingType ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_CHAR_STYLE_NAME, uno::makeAny( OUString( "Bullet Symbols" ) ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( sal_Int16(style::NumberingType::CHAR_SPECIAL) ) ); OUString aBulletChar; switch( mnTemplateType ) @@ -379,7 +377,6 @@ void SwVbaListHelper::CreateOutlineNumberForType1() void SwVbaListHelper::CreateOutlineNumberForType2() { - sal_Int16 nNumberingType = style::NumberingType::ARABIC; sal_Int16 nParentNumbering = 0; OUString sSuffix = OUString( '.' ); uno::Sequence< beans::PropertyValue > aPropertyValues; @@ -387,7 +384,7 @@ void SwVbaListHelper::CreateOutlineNumberForType2() for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ ) { mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues; - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( nNumberingType ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( sal_Int16(style::NumberingType::ARABIC) ) ); setOrAppendPropertyValue( aPropertyValues, UNO_NAME_SUFFIX, uno::makeAny( sSuffix ) ); if( nLevel != 0 ) { @@ -400,16 +397,14 @@ void SwVbaListHelper::CreateOutlineNumberForType2() void SwVbaListHelper::CreateOutlineNumberForType3() { - sal_Int16 nNumberingType = style::NumberingType::CHAR_SPECIAL; - OUString sCharStyleName( "Bullet Symbols" ); OUString aBulletChar; uno::Sequence< beans::PropertyValue > aPropertyValues; for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ ) { mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues; - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( nNumberingType ) ); - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_CHAR_STYLE_NAME, uno::makeAny( sCharStyleName ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( sal_Int16(style::NumberingType::CHAR_SPECIAL) ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_CHAR_STYLE_NAME, uno::makeAny( OUString("Bullet Symbols") ) ); switch( nLevel ) { case 0: @@ -471,8 +466,7 @@ void SwVbaListHelper::CreateOutlineNumberForType4() nNumberingType = style::NumberingType::ARABIC; sPrefix.clear(); sSuffix = "."; - sal_Int16 nParentNumbering = 0; - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_PARENT_NUMBERING, uno::makeAny( nParentNumbering ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_PARENT_NUMBERING, uno::makeAny( sal_Int16(0) ) ); break; } case 2: @@ -534,14 +528,13 @@ void SwVbaListHelper::CreateOutlineNumberForType4() void SwVbaListHelper::CreateOutlineNumberForType5() { - sal_Int16 nNumberingType = style::NumberingType::ARABIC; sal_Int16 nParentNumbering = 0; uno::Sequence< beans::PropertyValue > aPropertyValues; for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ ) { mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues; - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( nNumberingType ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( sal_Int16(style::NumberingType::ARABIC) ) ); if( nLevel != 0 ) { nParentNumbering = sal_Int16( nLevel - 1 ); @@ -636,15 +629,13 @@ void SwVbaListHelper::CreateOutlineNumberForType6() void SwVbaListHelper::CreateOutlineNumberForType7() { - sal_Int16 nNumberingType = style::NumberingType::ARABIC; uno::Sequence< beans::PropertyValue > aPropertyValues; - OUString sPrefix("Chapter "); for( sal_Int32 nLevel = 0; nLevel < LIST_LEVEL_COUNT; nLevel++ ) { mxNumberingRules->getByIndex( nLevel ) >>= aPropertyValues; - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( nNumberingType ) ); - setOrAppendPropertyValue( aPropertyValues, UNO_NAME_PREFIX, uno::makeAny( sPrefix ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_NUMBERING_TYPE, uno::makeAny( sal_Int16(style::NumberingType::ARABIC) ) ); + setOrAppendPropertyValue( aPropertyValues, UNO_NAME_PREFIX, uno::makeAny( OUString("Chapter ") ) ); mxNumberingRules->replaceByIndex( nLevel, uno::makeAny( aPropertyValues ) ); } } diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx index f229ded6a11e..ac08e16e9726 100644 --- a/sw/source/ui/vba/vbarows.cxx +++ b/sw/source/ui/vba/vbarows.cxx @@ -141,8 +141,7 @@ uno::Any SAL_CALL SwVbaRows::getAllowBreakAcrossPages() } if( bSplit != bAllowBreak ) { - sal_Int32 nRet = word::WdConstants::wdUndefined; - return uno::makeAny( nRet ); + return uno::makeAny( sal_Int32(word::WdConstants::wdUndefined) ); } } return uno::makeAny( bAllowBreak ); @@ -239,9 +238,8 @@ void SwVbaRows::setIndentWithAdjustNone( sal_Int32 indent ) void SwVbaRows::setIndentWithAdjustFirstColumn( const uno::Reference< word::XColumns >& xColumns, sal_Int32 indent ) { - sal_Int32 nIndex = 1; uno::Reference< XCollection > xCol( xColumns, uno::UNO_QUERY_THROW ); - uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( nIndex ), uno::Any() ), uno::UNO_QUERY_THROW ); + uno::Reference< word::XColumn > xColumn( xCol->Item( uno::makeAny( sal_Int32(1) ), uno::Any() ), uno::UNO_QUERY_THROW ); sal_Int32 nWidth = xColumn->getWidth(); nWidth -= indent; xColumn->setWidth( nWidth ); diff --git a/sw/source/ui/vba/vbatablesofcontents.cxx b/sw/source/ui/vba/vbatablesofcontents.cxx index e1fac5afca27..13b171337481 100644 --- a/sw/source/ui/vba/vbatablesofcontents.cxx +++ b/sw/source/ui/vba/vbatablesofcontents.cxx @@ -114,8 +114,7 @@ SwVbaTablesOfContents::Add( const uno::Reference< word::XRange >& Range, const u uno::Reference< text::XDocumentIndex > xDocumentIndex( xDocMSF->createInstance("com.sun.star.text.ContentIndex"), uno::UNO_QUERY_THROW ); uno::Reference< beans::XPropertySet > xTocProps( xDocumentIndex, uno::UNO_QUERY_THROW ); - bool isProtected = false; - xTocProps->setPropertyValue("IsProtected", uno::makeAny( isProtected ) ); + xTocProps->setPropertyValue("IsProtected", uno::makeAny( false ) ); uno::Reference< word::XTableOfContents > xToc( new SwVbaTableOfContents( this, mxContext, mxTextDocument, xDocumentIndex ) ); @@ -129,8 +128,7 @@ SwVbaTablesOfContents::Add( const uno::Reference< word::XRange >& Range, const u UseFields >>= bUseFields; xToc->setUseFields( bUseFields ); - bool bUseOutlineLevels = true; - xToc->setUseOutlineLevels( bUseOutlineLevels ); + xToc->setUseOutlineLevels( true ); SwVbaRange* pVbaRange = dynamic_cast<SwVbaRange*>( Range.get() ); if( !pVbaRange ) diff --git a/sw/source/ui/vba/vbatabstops.cxx b/sw/source/ui/vba/vbatabstops.cxx index c69a503a8e8b..fbcddca22ba6 100644 --- a/sw/source/ui/vba/vbatabstops.cxx +++ b/sw/source/ui/vba/vbatabstops.cxx @@ -192,12 +192,10 @@ uno::Reference< word::XTabStop > SAL_CALL SwVbaTabStops::Add( float Position, co } } - sal_Char cDecimal = '.'; // default value - style::TabStop aTab; aTab.Position = nPosition; aTab.Alignment = nAlign; - aTab.DecimalChar = cDecimal; + aTab.DecimalChar = '.'; // default value aTab.FillChar = cLeader; uno::Sequence< style::TabStop > aOldTabs = lcl_getTabStops( mxParaProps ); diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index 89bf88550bd3..ab2e1f490ccc 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -720,7 +720,6 @@ void SwDocShell::Execute(SfxRequest& rReq) uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); - OUString aCmd("SendOutlineToImpress"); uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); pStrm->Seek( STREAM_SEEK_TO_END ); pStrm->WriteChar( '\0' ); @@ -739,7 +738,7 @@ void SwDocShell::Execute(SfxRequest& rReq) uno::Sequence< beans::PropertyValue > aArgs(1); aArgs[0].Name = "RtfOutline"; aArgs[0].Value <<= aSeq; - xHelper->executeDispatch( xProv, aCmd, OUString(), 0, aArgs ); + xHelper->executeDispatch( xProv, "SendOutlineToImpress", OUString(), 0, aArgs ); } } else @@ -786,7 +785,6 @@ void SwDocShell::Execute(SfxRequest& rReq) uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); uno::Reference< frame::XDispatchProvider > xProv = drawing::ModuleDispatcher::create( xContext ); - OUString aCmd("SendOutlineToImpress"); uno::Reference< frame::XDispatchHelper > xHelper( frame::DispatchHelper::create(xContext) ); pStrm->Seek( STREAM_SEEK_TO_END ); pStrm->WriteChar( '\0' ); @@ -805,7 +803,7 @@ void SwDocShell::Execute(SfxRequest& rReq) uno::Sequence< beans::PropertyValue > aArgs(1); aArgs[0].Name = "RtfOutline"; aArgs[0].Value <<= aSeq; - xHelper->executeDispatch( xProv, aCmd, OUString(), 0, aArgs ); + xHelper->executeDispatch( xProv, "SendOutlineToImpress", OUString(), 0, aArgs ); } } else diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 32f651cd529a..f0b489455d49 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -151,8 +151,7 @@ SwSpellDialogChildWindow::SwSpellDialogChildWindow ( , m_bIsGrammarCheckingOn(false) , m_pSpellState(new SpellState) { - OUString aPropName(UPN_IS_GRAMMAR_INTERACTIVE); - SvtLinguConfig().GetProperty( aPropName ) >>= m_bIsGrammarCheckingOn; + SvtLinguConfig().GetProperty( UPN_IS_GRAMMAR_INTERACTIVE ) >>= m_bIsGrammarCheckingOn; } SwSpellDialogChildWindow::~SwSpellDialogChildWindow () @@ -478,8 +477,7 @@ void SwSpellDialogChildWindow::SetGrammarChecking(bool bOn) uno::Any aVal; aVal <<= bOn; m_bIsGrammarCheckingOn = bOn; - OUString aPropName(UPN_IS_GRAMMAR_INTERACTIVE); - SvtLinguConfig().SetProperty( aPropName, aVal ); + SvtLinguConfig().SetProperty( UPN_IS_GRAMMAR_INTERACTIVE, aVal ); // set current spell position to the start of the current sentence to // continue with this sentence after grammar checking state has been changed SwWrtShell* pWrtShell = GetWrtShell_Impl(); diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 892a0b724249..922d5ec72166 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -672,7 +672,7 @@ void SwEditWin::JustifyAreaTimer() #else const long coMinLen = 50; #endif - long nTimeout = 800, + long const nTimeout = 800, nDiff = std::max( std::max( m_aMovePos.Y() - rVisArea.Bottom(), rVisArea.Top() - m_aMovePos.Y() ), std::max( m_aMovePos.X() - rVisArea.Right(), rVisArea.Left() - m_aMovePos.X())); @@ -5283,8 +5283,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt ) aEvent.ExecutePosition.X = aPixPos.X(); aEvent.ExecutePosition.Y = aPixPos.Y(); VclPtr<Menu> pMenu; - OUString sMenuName("private:resource/ReadonlyContextMenu"); - if (GetView().TryContextMenuInterception(aROPopup.GetMenu(), sMenuName, pMenu, aEvent)) + if (GetView().TryContextMenuInterception(aROPopup.GetMenu(), "private:resource/ReadonlyContextMenu", pMenu, aEvent)) { if ( pMenu ) { @@ -5753,7 +5752,6 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) m_rView.NoRotate(); bool bUnLockView = !rSh.IsViewLocked(); rSh.LockView( true ); - sal_uInt8 nFlag = 0; if ( rSh.IsSelFrameMode() ) { @@ -5762,7 +5760,7 @@ void SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) m_rView.AttrChangedNotify(&rSh); } - bool bSelObj = rSh.SelectObj( aDocPos, nFlag ); + bool bSelObj = rSh.SelectObj( aDocPos, 0/*nFlag*/ ); if( bUnLockView ) rSh.LockView( false ); diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index c8a963a0e7a9..40fbf5a0b5dc 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -256,8 +256,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) FN_PARAM_FIELD_FORMAT, false, &pItem )) nFormat = static_cast<const SfxUInt32Item *>(pItem)->GetValue(); OSL_FAIL("Command is not yet used"); - sal_Unicode cSeparator = ' '; - SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator ); + SwInsertField_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), ' '/*separator*/ ); bRes = aFieldMgr.InsertField(aData); } rReq.SetReturnValue(SfxBoolItem( nSlot, bRes )); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index d02048d49e7e..a5a295c820d6 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -706,8 +706,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_AUTO_CORRECT: { // At first set to blank as default. - sal_Unicode cChar = ' '; - rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get().GetAutoCorrect(), cChar ); + rWrtSh.AutoCorrect( *SvxAutoCorrCfg::Get().GetAutoCorrect(), ' ' ); rReq.Done(); } break; diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx index edcbb3ca4e1e..d6323a87b26d 100644 --- a/sw/source/uibase/uiview/formatclipboard.cxx +++ b/sw/source/uibase/uiview/formatclipboard.cxx @@ -368,8 +368,7 @@ void SwFormatClipboard::Copy( SwWrtShell& rWrtShell, SfxItemPool& rPool, bool bP { if( pDrawView->AreObjectsMarked() ) { - bool bOnlyHardAttr = true; - pItemSet_TextAttr = o3tl::make_unique<SfxItemSet>( pDrawView->GetAttrFromMarked(bOnlyHardAttr) ); + pItemSet_TextAttr = o3tl::make_unique<SfxItemSet>( pDrawView->GetAttrFromMarked(true/*bOnlyHardAttr*/) ); //remove attributes defining the type/data of custom shapes pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_ENGINE); pItemSet_TextAttr->ClearItem(SDRATTR_CUSTOMSHAPE_DATA); @@ -543,8 +542,7 @@ void SwFormatClipboard::Paste( SwWrtShell& rWrtShell, SfxStyleSheetBasePool* pPo SdrView* pDrawView = rWrtShell.GetDrawView(); if(pDrawView) { - bool bReplaceAll = true; - pDrawView->SetAttrToMarked(*m_pItemSet_TextAttr, bReplaceAll); + pDrawView->SetAttrToMarked(*m_pItemSet_TextAttr, true/*bReplaceAll*/); } } else diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index e0a3b73aaccb..588fce60b723 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -815,9 +815,8 @@ void SwPagePreview::Execute( SfxRequest &rReq ) case SID_ZOOM_IN: case SID_ZOOM_OUT: { - SvxZoomType eType = SvxZoomType::PERCENT; const SwViewOption* pVOpt = GetViewShell()->GetViewOptions(); - SetZoom(eType, + SetZoom(SvxZoomType::PERCENT, lcl_GetNextZoomStep(pVOpt->GetZoom(), SID_ZOOM_IN == rReq.GetSlot())); } break; @@ -972,7 +971,6 @@ MOVEPAGE: void SwPagePreview::GetState( SfxItemSet& rSet ) { SfxWhichIter aIter(rSet); - sal_uInt8 nRow = 1; sal_uInt16 nWhich = aIter.FirstWhich(); OSL_ENSURE(nWhich, "empty set"); SwPagePreviewLayout* pPagePreviewLay = GetViewShell()->PagePreviewLayout(); @@ -1068,7 +1066,7 @@ void SwPagePreview::GetState( SfxItemSet& rSet ) break; case FN_SHOW_TWO_PAGES: - if( 2 == m_pViewWin->GetCol() && nRow == m_pViewWin->GetRow() ) + if( 2 == m_pViewWin->GetCol() && 1 == m_pViewWin->GetRow() ) rSet.DisableItem( nWhich ); break; diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index a297001ffc1a..18cdea0f2c0a 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -508,10 +508,8 @@ void SwView::ExecViewOptions(SfxRequest &rReq) pOpt->SetOnlineSpell(bSet); { - OUString aPropName(UPN_IS_SPELL_AUTO); - SvtLinguConfig aCfg; - aCfg.SetProperty( aPropName, uno::makeAny( bSet ) ); + aCfg.SetProperty( UPN_IS_SPELL_AUTO, uno::makeAny( bSet ) ); if (xLngProp.is()) xLngProp->setIsSpellAuto( bSet ); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index f3049f9c0be8..2f55016e378f 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -1965,8 +1965,7 @@ bool SwView::JumpToSwMark( const OUString& rMark ) '\\' ); //todo/mba: assuming that notes shouldn't be searched - bool bSearchInNotes = false; - if( m_pWrtShell->SearchPattern( aSearchOpt, bSearchInNotes, SwDocPositions::Start, SwDocPositions::End )) + if( m_pWrtShell->SearchPattern( aSearchOpt, false/*bSearchInNotes*/, SwDocPositions::Start, SwDocPositions::End )) { m_pWrtShell->EnterStdMode(); // remove the selection bRet = true; diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index cd38970c6bd9..3ac39c0f091c 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -752,10 +752,8 @@ void SwView::ExecTabWin( SfxRequest& rReq ) { SvxULSpaceItem aParaMargin(static_cast<const SvxULSpaceItem&>(pReqArgs->Get(nSlot))); - long nUDist = 0; - long nLDist = 0; - aParaMargin.SetUpper( aParaMargin.GetUpper() - nUDist ); - aParaMargin.SetLower(aParaMargin.GetLower() - nLDist); + aParaMargin.SetUpper( aParaMargin.GetUpper() ); + aParaMargin.SetLower(aParaMargin.GetLower()); aParaMargin.SetWhich( RES_UL_SPACE ); SwTextFormatColl* pColl = rSh.GetCurTextFormatColl(); diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx index ed90741306d5..bf6beddad447 100644 --- a/sw/source/uibase/uno/unomailmerge.cxx +++ b/sw/source/uibase/uno/unomailmerge.cxx @@ -137,8 +137,7 @@ static bool LoadFromURL_impl( Reference< frame::XModel > xTmpModel; Sequence < PropertyValue > aArgs( 1 ); aArgs[0].Name = "Hidden"; - bool bVal = true; - aArgs[0].Value <<= bVal; + aArgs[0].Value <<= true; try { Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 4ba3d0b3784e..cc07d453d3e4 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -794,9 +794,8 @@ sal_Int32 SwXTextDocument::replaceAll(const Reference< util::XSearchDescriptor > else { //todo/mba: assuming that notes should be omitted - bool bSearchInNotes = false; bool bCancel; - nResult = pUnoCursor->Find( aSearchOpt, bSearchInNotes, + nResult = pUnoCursor->Find( aSearchOpt, false/*bSearchInNotes*/, eStart, eEnd, bCancel, (FindRanges)eRanges, true ); @@ -922,9 +921,8 @@ SwUnoCursor* SwXTextDocument::FindAny(const Reference< util::XSearchDescriptor > else { //todo/mba: assuming that notes should be omitted - bool bSearchInNotes = false; bool bCancel; - nResult = (sal_Int32)pUnoCursor->Find( aSearchOpt, bSearchInNotes, + nResult = (sal_Int32)pUnoCursor->Find( aSearchOpt, false/*bSearchInNotes*/, eStart, eEnd, bCancel, eRanges ); } @@ -2207,18 +2205,12 @@ void SwXTextDocument::updateLinks( ) PropertyState SAL_CALL SwXTextDocument::getPropertyState( const OUString& rPropertyName ) { SolarMutexGuard aGuard; - PropertyState eRet = PropertyState_DIRECT_VALUE; if(!IsValid()) throw RuntimeException(); const SfxItemPropertySimpleEntry* pEntry = pPropSet->getPropertyMap().getByName( rPropertyName); - if(!pEntry) throw UnknownPropertyException(); - switch(pEntry->nWID) - { - case 0:default:break; - } - return eRet; + return PropertyState_DIRECT_VALUE; } Sequence< PropertyState > SAL_CALL SwXTextDocument::getPropertyStates( const Sequence< OUString >& rPropertyNames ) @@ -3304,14 +3296,11 @@ void SwXTextDocument::initializeForTiledRendering(const css::uno::Sequence<css:: SwViewShell* pViewShell = pDocShell->GetWrtShell(); - bool bBookMode = false; - sal_Int16 nColumns = 1; - SwView* pView = pDocShell->GetView(); if (!pView) return; - pView->SetViewLayout(nColumns, bBookMode, true); + pView->SetViewLayout(1/*nColumns*/, false/*bBookMode*/, true); // Tiled rendering defaults. SwViewOption aViewOption(*pViewShell->GetViewOptions()); @@ -3982,12 +3971,11 @@ Sequence< OUString > SwXLinkNameAccessWrapper::getElementNames() const size_t nOutlineCount = rOutlineNodes.size(); aRet.realloc(nOutlineCount); OUString* pResArr = aRet.getArray(); - OUString sSuffix("|outline"); const SwNumRule* pOutlRule = pDoc->GetOutlineNumRule(); for (size_t i = 0; i < nOutlineCount; ++i) { OUString sEntry = lcl_CreateOutlineString(i, rOutlineNodes, pOutlRule); - sEntry += sSuffix; + sEntry += "|outline"; pResArr[i] = sEntry; } } diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 6cafada3d10d..5202958bb997 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -749,8 +749,7 @@ void FillCharStyleListBox(ListBox& rToFill, SwDocShell* pDocSh, bool bSorted, bo const sal_Int32 nPos = bSorted ? InsertStringSorted(rName, rToFill, nOffset ) : rToFill.InsertEntry(rName); - sal_IntPtr nPoolId = USHRT_MAX; - rToFill.SetEntryData( nPos, reinterpret_cast<void*>(nPoolId)); + rToFill.SetEntryData( nPos, reinterpret_cast<void*>(USHRT_MAX)); } } }; diff --git a/sw/source/uibase/wrtsh/wrtsh3.cxx b/sw/source/uibase/wrtsh/wrtsh3.cxx index 5773a060253e..a169c246f710 100644 --- a/sw/source/uibase/wrtsh/wrtsh3.cxx +++ b/sw/source/uibase/wrtsh/wrtsh3.cxx @@ -190,14 +190,13 @@ bool SwWrtShell::GetURLFromButton( OUString& rURL, OUString& rDescr ) const uno::Any aTmp; - form::FormButtonType eButtonType = form::FormButtonType_URL; uno::Reference< beans::XPropertySetInfo > xInfo = xPropSet->getPropertySetInfo(); if(xInfo->hasPropertyByName( "ButtonType" )) { aTmp = xPropSet->getPropertyValue( "ButtonType" ); form::FormButtonType eTmpButtonType; aTmp >>= eTmpButtonType; - if( eButtonType == eTmpButtonType) + if( form::FormButtonType_URL == eTmpButtonType) { // Label aTmp = xPropSet->getPropertyValue( "Label" ); |