summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-25 19:11:12 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-26 09:17:47 +0200
commit2dbe6a2d57956be392966c363d03f54cb68dd4fa (patch)
tree148065e98b7470331edaa83b95c85eae6e179ed2 /sfx2
parentd416a5ff59b31dd7250d392278c43f66cdb81e35 (diff)
loplugin:oncevar in sfx2
Change-Id: I9aadcb9a12ef9b0c3f93ea255f2542e51d31fbf7 Reviewed-on: https://gerrit.libreoffice.org/39242 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/qa/cppunit/test_metadatable.cxx6
-rw-r--r--sfx2/source/appl/appdispatchprovider.cxx5
-rw-r--r--sfx2/source/appl/appserv.cxx149
-rw-r--r--sfx2/source/appl/shutdownicon.cxx8
-rw-r--r--sfx2/source/control/dispatch.cxx3
-rw-r--r--sfx2/source/control/emojiviewitem.cxx3
-rw-r--r--sfx2/source/control/recentdocsviewitem.cxx3
-rw-r--r--sfx2/source/control/templatelocalview.cxx3
-rw-r--r--sfx2/source/control/templateviewitem.cxx3
-rw-r--r--sfx2/source/dialog/dinfdlg.cxx3
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx3
-rw-r--r--sfx2/source/dialog/printopt.cxx3
-rw-r--r--sfx2/source/dialog/templdlg.cxx8
-rw-r--r--sfx2/source/doc/docfilt.cxx3
-rw-r--r--sfx2/source/doc/doctempl.cxx6
-rw-r--r--sfx2/source/doc/doctemplates.cxx15
-rw-r--r--sfx2/source/doc/guisaveas.cxx4
-rw-r--r--sfx2/source/doc/objserv.cxx22
-rw-r--r--sfx2/source/doc/objstor.cxx7
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx17
-rw-r--r--sfx2/source/doc/templatedlg.cxx9
-rw-r--r--sfx2/source/inet/inettbc.cxx4
-rw-r--r--sfx2/source/sidebar/Theme.cxx3
-rw-r--r--sfx2/source/view/frame2.cxx3
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx5
-rw-r--r--sfx2/source/view/viewfrm2.cxx3
-rw-r--r--sfx2/source/view/viewprn.cxx3
-rw-r--r--sfx2/source/view/viewsh.cxx12
28 files changed, 119 insertions, 197 deletions
diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx
index bb883b6a9cc2..d469859c4cf0 100644
--- a/sfx2/qa/cppunit/test_metadatable.cxx
+++ b/sfx2/qa/cppunit/test_metadatable.cxx
@@ -88,9 +88,9 @@ void MetadatableTest::test()
MockMetadatable m5(*pReg);
OUString empty;
OUString content( "content.xml" );
- OUString styles( "styles.xml" );
- OUString sid1( "id1" );
- OUString sid2( "id2" );
+ OUString const styles( "styles.xml" );
+ OUString const sid1( "id1" );
+ OUString const sid2( "id2" );
OUString sid3( "id3" );
OUString sid4( "id4" );
beans::StringPair id1(content, sid1);
diff --git a/sfx2/source/appl/appdispatchprovider.cxx b/sfx2/source/appl/appdispatchprovider.cxx
index e840361d2b3f..e7e70a878cf2 100644
--- a/sfx2/source/appl/appdispatchprovider.cxx
+++ b/sfx2/source/appl/appdispatchprovider.cxx
@@ -205,7 +205,6 @@ Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfi
SfxSlotPool& rAppSlotPool = SfxGetpApp()->GetAppSlotPool_Impl();
const SfxSlotMode nMode( SfxSlotMode::TOOLBOXCONFIG|SfxSlotMode::ACCELCONFIG|SfxSlotMode::MENUCONFIG );
- OUString aCmdPrefix( ".uno:" );
// Select group ( group 0 is internal )
for (sal_uInt16 i=0; i< rAppSlotPool.GetGroupCount(); ++i)
@@ -222,9 +221,7 @@ Sequence< frame::DispatchInformation > SAL_CALL SfxAppDispatchProvider::getConfi
if ( pSfxSlot->GetMode() & nMode )
{
frame::DispatchInformation aCmdInfo;
- OUStringBuffer aBuf( aCmdPrefix );
- aBuf.appendAscii( pSfxSlot->GetUnoName() );
- aCmdInfo.Command = aBuf.makeStringAndClear();
+ aCmdInfo.Command = ".uno:" + OUString::createFromAscii(pSfxSlot->GetUnoName());
aCmdInfo.GroupId = nCommandGroup;
aCmdList.push_back( aCmdInfo );
}
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 4ee7dc17a2fe..efdd469b424e 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -791,7 +791,6 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
css::uno::Sequence<OUString> aUserToolbars;
std::vector<OUString> aBackupList;
OUString aSidebarMode;
- bool bCorrectMode = true;
OUStringBuffer aPath = OUStringBuffer( "org.openoffice.Office.UI.ToolbarMode/Applications/" );
aPath.append( lcl_getAppName( eApp ) );
@@ -828,103 +827,100 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
}
}
- if ( bCorrectMode )
+ // Backup visible toolbar list and hide all toolbars
+ Sequence<Reference<XUIElement>> aUIElements = xLayoutManager->getElements();
+ for ( sal_Int32 i = 0; i < aUIElements.getLength(); i++ )
{
- // Backup visible toolbar list and hide all toolbars
- Sequence<Reference<XUIElement>> aUIElements = xLayoutManager->getElements();
- for ( sal_Int32 i = 0; i < aUIElements.getLength(); i++ )
+ Reference< XUIElement > xUIElement( aUIElements[i] );
+ Reference< XPropertySet > xPropertySet( aUIElements[i], UNO_QUERY );
+ if ( xPropertySet.is() && xUIElement.is() )
{
- Reference< XUIElement > xUIElement( aUIElements[i] );
- Reference< XPropertySet > xPropertySet( aUIElements[i], UNO_QUERY );
- if ( xPropertySet.is() && xUIElement.is() )
+ try
{
- try
- {
- OUString aResName;
- sal_Int16 nType( -1 );
- xPropertySet->getPropertyValue( "Type" ) >>= nType;
- xPropertySet->getPropertyValue( "ResourceURL" ) >>= aResName;
+ OUString aResName;
+ sal_Int16 nType( -1 );
+ xPropertySet->getPropertyValue( "Type" ) >>= nType;
+ xPropertySet->getPropertyValue( "ResourceURL" ) >>= aResName;
- if (( nType == css::ui::UIElementType::TOOLBAR ) &&
- !aResName.isEmpty() )
+ if (( nType == css::ui::UIElementType::TOOLBAR ) &&
+ !aResName.isEmpty() )
+ {
+ if ( xLayoutManager->isElementVisible( aResName ) )
{
- if ( xLayoutManager->isElementVisible( aResName ) )
- {
- aBackupList.push_back( aResName );
- }
- xLayoutManager->hideElement( aResName );
+ aBackupList.push_back( aResName );
}
- }
- catch ( const Exception& )
- {
+ xLayoutManager->hideElement( aResName );
}
}
+ catch ( const Exception& )
+ {
+ }
}
+ }
+
+ // Show toolbars
+ for ( OUString& rName : aMandatoryToolbars )
+ {
+ xLayoutManager->createElement( rName );
+ xLayoutManager->showElement( rName );
+ }
+
+ for ( OUString& rName : aUserToolbars )
+ {
+ xLayoutManager->createElement( rName );
+ xLayoutManager->showElement( rName );
+ }
+
+ // Sidebar
+ pViewFrame->ShowChildWindow( SID_SIDEBAR );
- // Show toolbars
- for ( OUString& rName : aMandatoryToolbars )
+ sfx2::sidebar::SidebarController* pSidebar =
+ sfx2::sidebar::SidebarController::GetSidebarControllerForFrame( xFrame );
+ if ( pSidebar )
+ {
+ if ( aSidebarMode.compareTo( "Arrow" ) == 0 )
{
- xLayoutManager->createElement( rName );
- xLayoutManager->showElement( rName );
+ pSidebar->FadeOut();
}
-
- for ( OUString& rName : aUserToolbars )
+ else if ( aSidebarMode.compareTo( "Tabs" ) == 0 )
{
- xLayoutManager->createElement( rName );
- xLayoutManager->showElement( rName );
+ pSidebar->FadeIn();
+ pSidebar->RequestOpenDeck();
+ pSidebar->RequestCloseDeck();
}
-
- // Sidebar
- pViewFrame->ShowChildWindow( SID_SIDEBAR );
-
- sfx2::sidebar::SidebarController* pSidebar =
- sfx2::sidebar::SidebarController::GetSidebarControllerForFrame( xFrame );
- if ( pSidebar )
+ else if ( aSidebarMode.compareTo( "Opened" ) == 0 )
{
- if ( aSidebarMode.compareTo( "Arrow" ) == 0 )
- {
- pSidebar->FadeOut();
- }
- else if ( aSidebarMode.compareTo( "Tabs" ) == 0 )
- {
- pSidebar->FadeIn();
- pSidebar->RequestOpenDeck();
- pSidebar->RequestCloseDeck();
- }
- else if ( aSidebarMode.compareTo( "Opened" ) == 0 )
- {
- pSidebar->FadeIn();
- pSidebar->RequestOpenDeck();
- }
+ pSidebar->FadeIn();
+ pSidebar->RequestOpenDeck();
}
+ }
- // Show/Hide the Notebookbar
- const SfxPoolItem* pItem;
- pViewFrame->GetDispatcher()->QueryState( SID_NOTEBOOKBAR, pItem );
+ // Show/Hide the Notebookbar
+ const SfxPoolItem* pItem;
+ pViewFrame->GetDispatcher()->QueryState( SID_NOTEBOOKBAR, pItem );
- // Save settings
- if ( pViewFrame == SfxViewFrame::Current() )
- {
- css::uno::Sequence<OUString> aBackup( aBackupList.size() );
- for ( size_t i = 0; i < aBackupList.size(); ++i )
- aBackup[i] = aBackupList[i];
+ // Save settings
+ if ( pViewFrame == SfxViewFrame::Current() )
+ {
+ css::uno::Sequence<OUString> aBackup( aBackupList.size() );
+ for ( size_t i = 0; i < aBackupList.size(); ++i )
+ aBackup[i] = aBackupList[i];
- for ( sal_Int32 nReadIndex = 0; nReadIndex < nCount; ++nReadIndex )
- {
- const utl::OConfigurationNode aModeNode( aModesNode.openNode( aModeNodeNames[nReadIndex] ) );
- if ( !aModeNode.isValid() )
- continue;
+ for ( sal_Int32 nReadIndex = 0; nReadIndex < nCount; ++nReadIndex )
+ {
+ const utl::OConfigurationNode aModeNode( aModesNode.openNode( aModeNodeNames[nReadIndex] ) );
+ if ( !aModeNode.isValid() )
+ continue;
- OUString aCommandArg = comphelper::getString( aModeNode.getNodeValue( "CommandArg" ) );
+ OUString aCommandArg = comphelper::getString( aModeNode.getNodeValue( "CommandArg" ) );
- if ( aCommandArg.compareTo( aCurrentMode ) == 0 )
- {
- aModeNode.setNodeValue( "UserToolbars", makeAny( aBackup ) );
- break;
- }
+ if ( aCommandArg.compareTo( aCurrentMode ) == 0 )
+ {
+ aModeNode.setNodeValue( "UserToolbars", makeAny( aBackup ) );
+ break;
}
- aModesNode.commit();
}
+ aModesNode.commit();
}
}
@@ -963,8 +959,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
if ( xLayoutManager.is() )
{
- OUString aToolbarResName( "private:resource/toolbar/" );
- OUStringBuffer aBuf( aToolbarResName );
+ OUStringBuffer aBuf( "private:resource/toolbar/" );
aBuf.append( pToolbarName->GetValue() );
// Evaluate Parameter
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index 7496e6aa153f..031c395cf3c0 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -377,13 +377,11 @@ IMPL_LINK( ShutdownIcon, DialogClosedHdl_Impl, FileDialogHelper*, /*unused*/, vo
aArgs[0].Name = "InteractionHandler";
aArgs[0].Value <<= xInteraction;
- sal_Int16 nMacroExecMode = css::document::MacroExecMode::USE_CONFIG;
aArgs[1].Name = "MacroExecutionMode";
- aArgs[1].Value <<= nMacroExecMode;
+ aArgs[1].Value <<= sal_Int16(css::document::MacroExecMode::USE_CONFIG);
- sal_Int16 nUpdateDoc = css::document::UpdateDocMode::ACCORDING_TO_CONFIG;
aArgs[2].Name = "UpdateDocMode";
- aArgs[2].Value <<= nUpdateDoc;
+ aArgs[2].Value <<= sal_Int16(css::document::UpdateDocMode::ACCORDING_TO_CONFIG);
// use the filedlghelper to get the current filter name,
// because it removes the extensions before you get the filter name.
@@ -717,6 +715,7 @@ OUString ShutdownIcon::getShortcutName()
return OUString();
#else
+#ifdef _WIN32
OUString aShortcutName( "StarOffice 6.0" );
ResMgr* pMgr = SfxResMgr::GetResMgr();
if( pMgr )
@@ -724,7 +723,6 @@ OUString ShutdownIcon::getShortcutName()
::SolarMutexGuard aGuard;
aShortcutName = SfxResId(STR_QUICKSTART_LNKNAME);
}
-#ifdef _WIN32
aShortcutName += ".lnk";
OUString aShortcut(GetAutostartFolderNameW32());
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index d3ec2a340bfd..f00259b1356f 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -931,8 +931,7 @@ const SfxSlot* SfxDispatcher::GetSlot( const OUString& rCommand )
}
}
- sal_uInt16 nFirstShell = 0;
- for ( sal_uInt16 i = nFirstShell; i < nTotCount; ++i )
+ for ( sal_uInt16 i = 0; i < nTotCount; ++i )
{
SfxShell *pObjShell = GetShell(i);
SfxInterface *pIFace = pObjShell->GetInterface();
diff --git a/sfx2/source/control/emojiviewitem.cxx b/sfx2/source/control/emojiviewitem.cxx
index ca3be4cc56e6..9b4c8c7888d3 100644
--- a/sfx2/source/control/emojiviewitem.cxx
+++ b/sfx2/source/control/emojiviewitem.cxx
@@ -64,8 +64,7 @@ void EmojiViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProcessor
{
BColor aFillColor = pAttrs->aFillColor;
- int nCount = 2;
- drawinglayer::primitive2d::Primitive2DContainer aSeq(nCount);
+ drawinglayer::primitive2d::Primitive2DContainer aSeq(2);
double fTransparence = 0.0;
// Draw background
diff --git a/sfx2/source/control/recentdocsviewitem.cxx b/sfx2/source/control/recentdocsviewitem.cxx
index 289edbb7ba19..c1dc04d49008 100644
--- a/sfx2/source/control/recentdocsviewitem.cxx
+++ b/sfx2/source/control/recentdocsviewitem.cxx
@@ -196,8 +196,7 @@ void RecentDocsViewItem::OpenDocument()
Reference<util::XURLTransformer> xTrans(util::URLTransformer::create(::comphelper::getProcessComponentContext()));
xTrans->parseStrict(aTargetURL);
- sal_Int32 nSize = 2;
- aArgsList.realloc(nSize);
+ aArgsList.realloc(2);
aArgsList[0].Name = "Referer";
aArgsList[0].Value <<= OUString("private:user");
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index 57acf992c8cb..83f25c641165 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -396,13 +396,12 @@ sal_uInt16 TemplateLocalView::createRegion(const OUString &rName)
bool TemplateLocalView::renameRegion(const OUString &rTitle, const OUString &rNewTitle)
{
- sal_uInt16 nDocId = USHRT_MAX;
TemplateContainerItem *pRegion = getRegion(rTitle);
if(pRegion)
{
sal_uInt16 nRegionId = pRegion->mnRegionId;
- return mpDocTemplates->SetName( rNewTitle, nRegionId, nDocId );
+ return mpDocTemplates->SetName( rNewTitle, nRegionId, USHRT_MAX/*nDocId*/ );
}
return false;
}
diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx
index ffa069410ab0..36c4242e5991 100644
--- a/sfx2/source/control/templateviewitem.cxx
+++ b/sfx2/source/control/templateviewitem.cxx
@@ -59,8 +59,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces
{
BColor aFillColor = pAttrs->aFillColor;
- int nCount = 5;
- drawinglayer::primitive2d::Primitive2DContainer aSeq(nCount);
+ drawinglayer::primitive2d::Primitive2DContainer aSeq(5);
double fTransparence = 0.0;
// Draw background
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index 4524caefe1af..c749ca3b2137 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -897,11 +897,10 @@ void SfxDocumentPage::ImplUpdateSignatures()
s = m_aMultiSignedStr;
else if ( aInfos.getLength() == 1 )
{
- OUString aCN_Id("CN");
const security::DocumentSignatureInformation& rInfo = aInfos[ 0 ];
s = GetDateTimeString( rInfo.SignatureDate, rInfo.SignatureTime );
s += ", ";
- s += GetContentPart( rInfo.Signer->getSubjectName(), aCN_Id );
+ s += GetContentPart( rInfo.Signer->getSubjectName(), "CN" );
}
m_pSignedValFt->SetText( s );
}
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index acb10f0d2c56..14140b6b8b51 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -453,14 +453,13 @@ void FileDialogHelper_Impl::updateExportButton()
uno::Reference < XFilePickerControlAccess > xCtrlAccess( mxFileDlg, UNO_QUERY );
if ( xCtrlAccess.is() )
{
- OUString sEllipses( "..." );
OUString sOldLabel( xCtrlAccess->getLabel( CommonFilePickerElementIds::PUSHBUTTON_OK ) );
// initialize button label; we need the label with the mnemonic char
if ( maButtonLabel.isEmpty() || maButtonLabel.indexOf( MNEMONIC_CHAR ) == -1 )
{
// cut the ellipses, if necessary
- sal_Int32 nIndex = sOldLabel.indexOf( sEllipses );
+ sal_Int32 nIndex = sOldLabel.indexOf( "..." );
if ( -1 == nIndex )
nIndex = sOldLabel.getLength();
maButtonLabel = sOldLabel.copy( 0, nIndex );
diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx
index 6a57f2622aaf..a9fa42dad284 100644
--- a/sfx2/source/dialog/printopt.cxx
+++ b/sfx2/source/dialog/printopt.cxx
@@ -145,7 +145,6 @@ bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet* /*rSet*/ )
SvtPrintWarningOptions aWarnOptions;
SvtPrinterOptions aPrinterOptions;
SvtPrintFileOptions aPrintFileOptions;
- bool bModified = false;
if( m_pPaperSizeCB->IsValueChangedFromSaved())
@@ -161,7 +160,7 @@ bool SfxCommonPrintOptionsTabPage::FillItemSet( SfxItemSet* /*rSet*/ )
aPrinterOptions.SetPrinterOptions( maPrinterOptions );
aPrintFileOptions.SetPrinterOptions( maPrintFileOptions );
- return bModified;
+ return false;
}
void SfxCommonPrintOptionsTabPage::Reset( const SfxItemSet* /*rSet*/ )
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 48a874f34996..4013c0283e39 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -787,10 +787,7 @@ void SfxCommonTemplateDialog_Impl::ReadResource()
LoadedFamilies();
- sal_uInt16 nStart = SID_STYLE_FAMILY1;
- sal_uInt16 nEnd = SID_STYLE_FAMILY4;
-
- for ( i = nStart; i <= nEnd; i++ )
+ for ( i = SID_STYLE_FAMILY1; i <= SID_STYLE_FAMILY4; i++ )
pBindings->Update(i);
}
@@ -1763,8 +1760,7 @@ sal_Int32 SfxCommonTemplateDialog_Impl::LoadFactoryStyleFilter( SfxObjectShell*
::comphelper::SequenceAsHashMap aFactoryProps(
xModuleManager->getByName( getModuleIdentifier( xModuleManager, i_pObjSh ) ) );
- sal_Int32 nDefault = -1;
- sal_Int32 nFilter = aFactoryProps.getUnpackedValueOrDefault( "ooSetupFactoryStyleFilter", nDefault );
+ sal_Int32 nFilter = aFactoryProps.getUnpackedValueOrDefault( "ooSetupFactoryStyleFilter", sal_Int32(-1) );
m_bWantHierarchical =
(nFilter & SFXSTYLEBIT_HIERARCHY) != 0;
diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index 99406c4ef772..ed5a13c1be80 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -68,14 +68,13 @@ SfxFilter::SfxFilter( const OUString &rName,
OUString aExts = GetWildcard().getGlob();
OUString aShort, aLong;
OUString aRet;
- sal_uInt16 nMaxLength = USHRT_MAX;
OUString aTest;
sal_uInt16 nPos = 0;
while (!(aRet = aExts.getToken(nPos++, ';')).isEmpty() )
{
aTest = aRet;
aTest = aTest.replaceFirst( "*." , "" );
- if( aTest.getLength() <= nMaxLength )
+ if( aTest.getLength() <= USHRT_MAX )
{
if (!aShort.isEmpty())
aShort += ";";
diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx
index cca1bee7cabe..5a844d5591f4 100644
--- a/sfx2/source/doc/doctempl.cxx
+++ b/sfx2/source/doc/doctempl.cxx
@@ -1516,11 +1516,10 @@ void SfxDocTemplate_Impl::AddRegion( const OUString& rTitle,
try
{
- ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = true;
- xResultSet = rContent.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
+ xResultSet = rContent.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, INCLUDE_DOCUMENTS_ONLY );
}
catch ( Exception& ) {}
@@ -1547,11 +1546,10 @@ void SfxDocTemplate_Impl::CreateFromHierarchy( Content &rTemplRoot )
try
{
- ResultSetInclude eInclude = INCLUDE_FOLDERS_ONLY;
Sequence< NumberedSortingInfo > aSortingInfo(1);
aSortingInfo.getArray()->ColumnIndex = 1;
aSortingInfo.getArray()->Ascending = true;
- xResultSet = rTemplRoot.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, eInclude );
+ xResultSet = rTemplRoot.createSortedCursor( aProps, aSortingInfo, m_rCompareFactory, INCLUDE_FOLDERS_ONLY );
}
catch ( Exception& ) {}
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 0ea4a1f093c2..c811fde66138 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -1522,8 +1522,7 @@ bool SfxDocTplService_Impl::removeGroup( const OUString& rGroupName )
try
{
- ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
- xResultSet = aGroup.createCursor( aProps, eInclude );
+ xResultSet = aGroup.createCursor( aProps, INCLUDE_DOCUMENTS_ONLY );
if ( xResultSet.is() )
{
@@ -1633,8 +1632,7 @@ bool SfxDocTplService_Impl::renameGroup( const OUString& rOldName,
{
uno::Reference< XResultSet > xResultSet;
Sequence< OUString > aProps { TARGET_URL };
- ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
- xResultSet = aGroup.createCursor( aProps, eInclude );
+ xResultSet = aGroup.createCursor( aProps, INCLUDE_DOCUMENTS_ONLY );
if ( xResultSet.is() )
{
@@ -2328,8 +2326,7 @@ void SfxDocTplService_Impl::addHierGroup( GroupList_Impl& rList,
try
{
aContent = Content(rOwnURL, maCmdEnv, comphelper::getProcessComponentContext());
- ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
- xResultSet = aContent.createCursor( aProps, eInclude );
+ xResultSet = aContent.createCursor( aProps, INCLUDE_DOCUMENTS_ONLY );
}
catch (ContentCreationException&)
{
@@ -2439,8 +2436,7 @@ void SfxDocTplService_Impl::addFsysGroup( GroupList_Impl& rList,
// that should happen quietly
uno::Reference< XCommandEnvironment > aQuietEnv;
aContent = Content( rOwnURL, aQuietEnv, comphelper::getProcessComponentContext() );
- ResultSetInclude eInclude = INCLUDE_DOCUMENTS_ONLY;
- xResultSet = aContent.createCursor( aProps, eInclude );
+ xResultSet = aContent.createCursor( aProps, INCLUDE_DOCUMENTS_ONLY );
}
catch ( Exception& ) {}
@@ -2500,8 +2496,7 @@ void SfxDocTplService_Impl::createFromContent( GroupList_Impl& rList,
try
{
- ResultSetInclude eInclude = INCLUDE_FOLDERS_ONLY;
- xResultSet = rContent.createCursor( aProps, eInclude );
+ xResultSet = rContent.createCursor( aProps, INCLUDE_FOLDERS_ONLY );
}
catch ( Exception& ) {}
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index 7adac1e93a7d..bd3c541f8d81 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -232,12 +232,10 @@ public:
{
if ( m_bRestoreSettings )
{
- OUString aLoadReadonlyString( "LoadReadonly" );
-
try
{
if ( m_bReadOnlySupported )
- m_xDocumentSettings->setPropertyValue( aLoadReadonlyString, uno::makeAny( m_bPreserveReadOnly ) );
+ m_xDocumentSettings->setPropertyValue( "LoadReadonly", uno::makeAny( m_bPreserveReadOnly ) );
}
catch( const uno::Exception& )
{
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index dc2cfa229ed1..e890a04ae430 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -729,28 +729,6 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_CLOSEDOC:
{
- SfxViewFrame *pFrame = GetFrame();
-
- bool bInFrameSet = false;
- sal_uInt16 nFrames=0;
- pFrame = SfxViewFrame::GetFirst( this );
- while ( pFrame )
- {
- nFrames++;
- pFrame = SfxViewFrame::GetNext( *pFrame, this );
- }
-
- if ( bInFrameSet )
- {
- // Close all views that are not in a FrameSet.
- pFrame = SfxViewFrame::GetFirst( this );
- while ( pFrame )
- {
- pFrame->GetFrame().DoClose();
- pFrame = SfxViewFrame::GetNext( *pFrame, this );
- }
- }
-
// Evaluate Parameter
const SfxBoolItem* pSaveItem = rReq.GetArg<SfxBoolItem>(SID_CLOSEDOC_SAVE);
const SfxStringItem* pNameItem = rReq.GetArg<SfxStringItem>(SID_CLOSEDOC_FILENAME);
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 3ae613ff60c8..6714c7a0ef94 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -3042,14 +3042,13 @@ uno::Reference< embed::XStorage > SfxObjectShell::GetStorage()
bool SfxObjectShell::SaveChildren( bool bObjectsOnly )
{
- bool bResult = true;
if ( pImpl->mpObjectContainer )
{
bool bOasis = ( SotStorage::GetVersion( GetStorage() ) > SOFFICE_FILEFORMAT_60 );
GetEmbeddedObjectContainer().StoreChildren(bOasis,bObjectsOnly);
}
- return bResult;
+ return true;
}
bool SfxObjectShell::SaveAsChildren( SfxMedium& rMedium )
@@ -3118,12 +3117,10 @@ bool SfxObjectShell::SwitchChildrenPersistance( const uno::Reference< embed::XSt
return false;
}
- bool bResult = true;
-
if ( pImpl->mpObjectContainer )
pImpl->mpObjectContainer->SetPersistentEntries(xStorage,bForceNonModified);
- return bResult;
+ return true;
}
// Never call this method directly, always use the DoSaveCompleted call
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index e2ebee05f9bb..2c90f8280363 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3430,14 +3430,12 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage
if ( xConfigStorage.is() )
{
OUString aMediaTypeProp( "MediaType" );
- OUString aUIConfigMediaType(
- "application/vnd.sun.xml.ui.configuration" );
OUString aMediaType;
Reference< beans::XPropertySet > xPropSet( xConfigStorage, UNO_QUERY );
Any a = xPropSet->getPropertyValue( aMediaTypeProp );
if ( !( a >>= aMediaType ) || aMediaType.isEmpty())
{
- xPropSet->setPropertyValue( aMediaTypeProp, Any(aUIConfigMediaType) );
+ xPropSet->setPropertyValue( aMediaTypeProp, Any(OUString("application/vnd.sun.xml.ui.configuration")) );
}
}
else
@@ -3452,10 +3450,9 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage
{
// Import old UI configuration from OOo 1.x
Reference< embed::XStorage > xOOo1ConfigStorage;
- OUString aOOo1UIConfigFolderName( "Configurations" );
// Try to open with READ
- xOOo1ConfigStorage = getDocumentSubStorage( aOOo1UIConfigFolderName, embed::ElementModes::READ );
+ xOOo1ConfigStorage = getDocumentSubStorage( "Configurations", embed::ElementModes::READ );
if ( xOOo1ConfigStorage.is() )
{
Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
@@ -3467,12 +3464,10 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage
{
SfxObjectShell* pObjShell = SfxBaseModel::GetObjectShell();
- OUString aNum( "private:resource/toolbar/custom_OOo1x_" );
- OUString aTitle( "Toolbar " );
for ( size_t i = 0; i < rToolbars.size(); i++ )
{
- OUString aCustomTbxName = aNum + OUString::number( i + 1 );
- OUString aCustomTbxTitle = aTitle + OUString::number( i + 1 );
+ OUString aCustomTbxName = "private:resource/toolbar/custom_OOo1x_" + OUString::number( i + 1 );
+ OUString aCustomTbxTitle = "Toolbar " + OUString::number( i + 1 );
Reference< container::XIndexContainer > xToolbar = rToolbars[i];
ConvertSlotsToCommands( pObjShell, xToolbar );
@@ -3484,9 +3479,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage
{
try
{
- OUString aPropName( "UIName" );
- Any aAny( aCustomTbxTitle );
- xPropSet->setPropertyValue( aPropName, aAny );
+ xPropSet->setPropertyValue( "UIName", Any( aCustomTbxTitle ) );
}
catch ( beans::UnknownPropertyException& )
{
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index f4be8a17ae76..a202a820d797 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -885,10 +885,8 @@ void SfxTemplateManagerDlg::OnTemplateState (const ThumbnailViewItem *pItem)
void SfxTemplateManagerDlg::OnTemplateImportCategory(const OUString& sCategory)
{
- sal_Int16 nDialogType =
- css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE;
-
- sfx2::FileDialogHelper aFileDlg(nDialogType, FileDialogFlags::MultiSelection);
+ sfx2::FileDialogHelper aFileDlg(css::ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE,
+ FileDialogFlags::MultiSelection);
// add "All" filter
aFileDlg.AddFilter( SfxResId(STR_SFX_FILTERNAME_ALL),
@@ -1069,7 +1067,6 @@ void SfxTemplateManagerDlg::OnTemplateExport()
void SfxTemplateManagerDlg::OnTemplateLink ()
{
- OUString sNode("TemplateRepositoryURL");
OUString sNodePath("/org.openoffice.Office.Common/Help/StartCenter");
try
{
@@ -1086,7 +1083,7 @@ void SfxTemplateManagerDlg::OnTemplateLink ()
{
OUString sURL;
//throws css::container::NoSuchElementException, css::lang::WrappedTargetException
- Any value( xNameAccess->getByName(sNode) );
+ Any value( xNameAccess->getByName("TemplateRepositoryURL") );
sURL = value.get<OUString> ();
localizeWebserviceURI(sURL);
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index c44509fe207d..978209c6e941 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -96,12 +96,10 @@ void SfxURLToolBoxControl_Impl::OpenURL( const OUString& rName ) const
if ( xDispatchProvider.is() )
{
URL aTargetURL;
- OUString aTarget( "_default" );
-
aTargetURL.Complete = aName;
getURLTransformer()->parseStrict( aTargetURL );
- Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, aTarget, 0 );
+ Reference< XDispatch > xDispatch = xDispatchProvider->queryDispatch( aTargetURL, "_default", 0 );
if ( xDispatch.is() )
{
Sequence< PropertyValue > aArgs( 2 );
diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx
index 2b29083f5bd9..6b130d984545 100644
--- a/sfx2/source/sidebar/Theme.cxx
+++ b/sfx2/source/sidebar/Theme.cxx
@@ -551,7 +551,8 @@ css::uno::Sequence<css::beans::Property> SAL_CALL Theme::getProperties()
{
::std::vector<beans::Property> aProperties;
- for (sal_Int32 nItem(Begin_),nEnd(End_); nItem!=nEnd; ++nItem)
+ sal_Int32 const nEnd(End_);
+ for (sal_Int32 nItem(Begin_); nItem!=nEnd; ++nItem)
{
const ThemeItem eItem (static_cast<ThemeItem>(nItem));
const PropertyType eType (GetPropertyType(eItem));
diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx
index fbb44fc5b6e7..e89086bc02f6 100644
--- a/sfx2/source/view/frame2.cxx
+++ b/sfx2/source/view/frame2.cxx
@@ -247,10 +247,9 @@ SfxFrame* SfxFrame::Create( SfxObjectShell& rDoc, vcl::Window& rWindow, SfxInter
aLoadArgs = aArgs.getPropertyValues();
// load the doc into that frame
- OUString sLoaderURL( "private:object" );
Reference< XComponentLoader > xLoader( xFrame, UNO_QUERY_THROW );
xLoader->loadComponentFromURL(
- sLoaderURL,
+ "private:object",
"_self",
0,
aLoadArgs
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index 448adcfb4812..bede7424acaf 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -1144,7 +1144,6 @@ uno::Sequence< frame::DispatchInformation > SAL_CALL SfxBaseController::getConfi
SfxViewFrame* pViewFrame( m_pData->m_pViewShell->GetFrame() );
SfxSlotPool* pPool( &SfxSlotPool::GetSlotPool( pViewFrame ));
- OUString aCmdPrefix( ".uno:" );
SfxSlotPool* pSlotPool = pPool ? pPool : &SFX_SLOTPOOL();
for ( sal_uInt16 i=0; i<pSlotPool->GetGroupCount(); i++ )
@@ -1161,9 +1160,7 @@ uno::Sequence< frame::DispatchInformation > SAL_CALL SfxBaseController::getConfi
if ( pSfxSlot->GetMode() & nMode )
{
frame::DispatchInformation aCmdInfo;
- OUStringBuffer aBuf( aCmdPrefix );
- aBuf.appendAscii( pSfxSlot->GetUnoName() );
- aCmdInfo.Command = aBuf.makeStringAndClear();
+ aCmdInfo.Command = ".uno:" + OUString::createFromAscii( pSfxSlot->GetUnoName() );
aCmdInfo.GroupId = nCommandGroup;
aCmdList.push_back( aCmdInfo );
}
diff --git a/sfx2/source/view/viewfrm2.cxx b/sfx2/source/view/viewfrm2.cxx
index 116df435e91b..b6e5b96a1e4d 100644
--- a/sfx2/source/view/viewfrm2.cxx
+++ b/sfx2/source/view/viewfrm2.cxx
@@ -233,8 +233,7 @@ void SfxViewFrame::Exec_Impl(SfxRequest &rReq )
// Document only needs to be queried, if no other View present.
bool bClosed = false;
- bool bUI = true;
- if ( ( bOther || pDocSh->PrepareClose( bUI ) ) )
+ if ( ( bOther || pDocSh->PrepareClose( true/*bUI*/ ) ) )
{
if ( !bOther )
pDocSh->SetModified( false );
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index a616d2d1237f..2a4fca34715c 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -642,10 +642,9 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
// no help button in dialogs if called from the help window
// (pressing help button would exchange the current page inside the help
// document that is going to be printed!)
- OUString aHelpFilterName( "writer_web_HTML_help" );
SfxMedium* pMedium = GetViewFrame()->GetObjectShell()->GetMedium();
std::shared_ptr<const SfxFilter> pFilter = pMedium ? pMedium->GetFilter() : nullptr;
- bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == aHelpFilterName );
+ bool bPrintOnHelp = ( pFilter && pFilter->GetFilterName() == "writer_web_HTML_help" );
const sal_uInt16 nId = rReq.GetSlot();
switch( nId )
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index dd81339f9783..2fc7afaf330a 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -418,17 +418,14 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
aValue >>= xLayoutManager;
if ( xLayoutManager.is() )
{
- OUString aTextResString( "private:resource/toolbar/textobjectbar" );
- uno::Reference< ui::XUIElement > xElement = xLayoutManager->getElement( aTextResString );
+ uno::Reference< ui::XUIElement > xElement = xLayoutManager->getElement( "private:resource/toolbar/textobjectbar" );
if(!xElement.is())
{
- OUString aFrameResString( "private:resource/toolbar/frameobjectbar" );
- xElement = xLayoutManager->getElement( aFrameResString );
+ xElement = xLayoutManager->getElement( "private:resource/toolbar/frameobjectbar" );
}
if(!xElement.is())
{
- OUString aOleResString( "private:resource/toolbar/oleobjectbar" );
- xElement = xLayoutManager->getElement( aOleResString );
+ xElement = xLayoutManager->getElement( "private:resource/toolbar/oleobjectbar" );
}
if(xElement.is())
{
@@ -585,7 +582,6 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
OUString aFilterName;
OUString aTypeName( "generic_HTML" );
OUString aFileName;
- OUString aExtension( "htm" );
OUString aLocation = xStorable->getLocation();
INetURLObject aFileObj( aLocation );
@@ -637,7 +633,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
INetURLObject aFilePathObj( aTempDir.GetURL() );
aFilePathObj.insertName( aFileName );
- aFilePathObj.setExtension( aExtension );
+ aFilePathObj.setExtension( "htm" );
OUString aFileURL = aFilePathObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );