[Libreoffice-commits] core.git: cui/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Fri Apr 17 13:51:52 UTC 2020
cui/source/customize/SvxMenuConfigPage.cxx | 68 +-
cui/source/customize/SvxToolbarConfigPage.cxx | 52 -
cui/source/customize/cfg.cxx | 120 ++--
cui/source/customize/macropg.cxx | 22
cui/source/dialogs/QrCodeGenDialog.cxx | 112 +--
cui/source/dialogs/SignSignatureLineDialog.cxx | 30 -
cui/source/dialogs/SignatureLineDialog.cxx | 87 +--
cui/source/dialogs/SpellDialog.cxx | 72 +-
cui/source/dialogs/colorpicker.cxx | 24
cui/source/dialogs/cuigaldlg.cxx | 176 +++---
cui/source/dialogs/cuihyperdlg.cxx | 24
cui/source/dialogs/hangulhanjadlg.cxx | 138 ++--
cui/source/dialogs/hldocntp.cxx | 134 ++--
cui/source/dialogs/hldoctp.cxx | 20
cui/source/dialogs/hltpbase.cxx | 78 +-
cui/source/dialogs/hyphen.cxx | 28
cui/source/dialogs/iconcdlg.cxx | 76 +-
cui/source/dialogs/linkdlg.cxx | 200 +++----
cui/source/dialogs/multipat.cxx | 80 +-
cui/source/dialogs/screenshotannotationdlg.cxx | 214 +++----
cui/source/dialogs/scriptdlg.cxx | 196 +++---
cui/source/options/dbregister.cxx | 22
cui/source/options/optaboutconfig.cxx | 356 ++++++------
cui/source/options/optchart.cxx | 36 -
cui/source/options/optcolor.cxx | 83 +-
cui/source/options/optdict.cxx | 76 +-
cui/source/options/optgdlg.cxx | 56 -
cui/source/options/optgenrl.cxx | 26
cui/source/options/optinet2.cxx | 36 -
cui/source/options/optjava.cxx | 74 +-
cui/source/options/optlingu.cxx | 238 ++++----
cui/source/options/optpath.cxx | 28
cui/source/options/optsave.cxx | 26
cui/source/options/treeopt.cxx | 52 -
cui/source/tabpages/autocdlg.cxx | 96 +--
cui/source/tabpages/backgrnd.cxx | 76 +-
cui/source/tabpages/chardlg.cxx | 54 -
cui/source/tabpages/labdlg.cxx | 22
cui/source/tabpages/numfmt.cxx | 74 +-
cui/source/tabpages/numpages.cxx | 709 ++++++++++++-------------
cui/source/tabpages/page.cxx | 256 ++++-----
cui/source/tabpages/paragrph.cxx | 80 +-
cui/source/tabpages/swpossizetabpage.cxx | 167 ++---
cui/source/tabpages/textanim.cxx | 135 ++--
cui/source/tabpages/textattr.cxx | 142 ++---
cui/source/tabpages/tpbitmap.cxx | 214 +++----
cui/source/tabpages/tpcolor.cxx | 120 ++--
cui/source/tabpages/tpgradnt.cxx | 238 ++++----
cui/source/tabpages/tphatch.cxx | 156 ++---
cui/source/tabpages/tpline.cxx | 138 ++--
cui/source/tabpages/tplnedef.cxx | 200 +++----
cui/source/tabpages/tplneend.cxx | 200 +++----
cui/source/tabpages/tppattern.cxx | 206 +++----
cui/source/tabpages/tpshadow.cxx | 60 +-
cui/source/tabpages/transfrm.cxx | 176 +++---
55 files changed, 3287 insertions(+), 3292 deletions(-)
New commits:
commit 3e57aad962c9d24c535daff893db203314709cfc
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Apr 17 14:48:19 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Apr 17 15:50:58 2020 +0200
loplugin:flatten in cui
Change-Id: I0ea0784ab8c4542747da1e15fa7c60c60bccb602
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92423
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
index d2cd438d4e35..064a0d508f8c 100644
--- a/cui/source/customize/SvxMenuConfigPage.cxx
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
@@ -221,33 +221,33 @@ void SvxMenuConfigPage::DeleteSelectedContent()
{
int nActEntry = m_xContentsListBox->get_selected_index();
- if (nActEntry != -1)
- {
- // get currently selected menu entry
- SvxConfigEntry* pMenuEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ if (nActEntry == -1)
+ return;
- // get currently selected menu
- SvxConfigEntry* pMenu = GetTopLevelSelection();
+ // get currently selected menu entry
+ SvxConfigEntry* pMenuEntry =
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
- // remove menu entry from the list for this menu
- SvxConfigPageHelper::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
+ // get currently selected menu
+ SvxConfigEntry* pMenu = GetTopLevelSelection();
- // remove menu entry from UI
- m_xContentsListBox->remove(nActEntry);
+ // remove menu entry from the list for this menu
+ SvxConfigPageHelper::RemoveEntry( pMenu->GetEntries(), pMenuEntry );
- // if this is a submenu entry, redraw the menus list box
- if ( pMenuEntry->IsPopup() )
- {
- ReloadTopLevelListBox();
- }
+ // remove menu entry from UI
+ m_xContentsListBox->remove(nActEntry);
- // delete data for menu entry
- delete pMenuEntry;
-
- GetSaveInData()->SetModified();
- pMenu->SetModified();
+ // if this is a submenu entry, redraw the menus list box
+ if ( pMenuEntry->IsPopup() )
+ {
+ ReloadTopLevelListBox();
}
+
+ // delete data for menu entry
+ delete pMenuEntry;
+
+ GetSaveInData()->SetModified();
+ pMenu->SetModified();
}
short SvxMenuConfigPage::QueryReset()
@@ -489,23 +489,23 @@ IMPL_LINK_NOARG(SvxMenuConfigPage, ResetMenuHdl, weld::Button&, void)
// Resetting individual top-level menus is not possible at the moment.
// So we are resetting only if it is a context menu
- if (!m_bIsMenuBar && xQueryBox->run() == RET_YES)
- {
- sal_Int32 nPos = m_xTopLevelListBox->get_active();
- ContextMenuSaveInData* pSaveInData = static_cast< ContextMenuSaveInData* >(GetSaveInData());
+ if (!(!m_bIsMenuBar && xQueryBox->run() == RET_YES))
+ return;
- pSaveInData->ResetContextMenu(pMenuData);
+ sal_Int32 nPos = m_xTopLevelListBox->get_active();
+ ContextMenuSaveInData* pSaveInData = static_cast< ContextMenuSaveInData* >(GetSaveInData());
- // ensure that the UI is cleared before populating it
- m_xTopLevelListBox->clear();
- m_xContentsListBox->clear();
+ pSaveInData->ResetContextMenu(pMenuData);
- ReloadTopLevelListBox();
+ // ensure that the UI is cleared before populating it
+ m_xTopLevelListBox->clear();
+ m_xContentsListBox->clear();
- // Reselect the reset menu
- m_xTopLevelListBox->set_active(nPos);
- SelectElement();
- }
+ ReloadTopLevelListBox();
+
+ // Reselect the reset menu
+ m_xTopLevelListBox->set_active(nPos);
+ SelectElement();
}
SaveInData* SvxMenuConfigPage::CreateSaveInData(
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
index 6fa173e958a1..dfe66d4e3721 100644
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
@@ -204,39 +204,39 @@ void SvxToolbarConfigPage::DeleteSelectedContent()
{
int nActEntry = m_xContentsListBox->get_selected_index();
- if (nActEntry != -1)
- {
- // get currently selected entry
- SvxConfigEntry* pEntry =
- reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
+ if (nActEntry == -1)
+ return;
- SvxConfigEntry* pToolbar = GetTopLevelSelection();
+ // get currently selected entry
+ SvxConfigEntry* pEntry =
+ reinterpret_cast<SvxConfigEntry*>(m_xContentsListBox->get_id(nActEntry).toInt64());
- // remove entry from the list for this toolbar
- SvxConfigPageHelper::RemoveEntry( pToolbar->GetEntries(), pEntry );
+ SvxConfigEntry* pToolbar = GetTopLevelSelection();
- // remove toolbar entry from UI
- m_xContentsListBox->remove(nActEntry);
+ // remove entry from the list for this toolbar
+ SvxConfigPageHelper::RemoveEntry( pToolbar->GetEntries(), pEntry );
- // delete data for toolbar entry
- delete pEntry;
+ // remove toolbar entry from UI
+ m_xContentsListBox->remove(nActEntry);
- static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar( pToolbar );
- UpdateButtonStates();
+ // delete data for toolbar entry
+ delete pEntry;
+
+ static_cast<ToolbarSaveInData*>(GetSaveInData())->ApplyToolbar( pToolbar );
+ UpdateButtonStates();
- // if this is the last entry in the toolbar and it is a user
- // defined toolbar pop up a dialog asking the user if they
- // want to delete the toolbar
- if ( m_xContentsListBox->n_children() == 0 &&
- GetTopLevelSelection()->IsDeletable() )
+ // if this is the last entry in the toolbar and it is a user
+ // defined toolbar pop up a dialog asking the user if they
+ // want to delete the toolbar
+ if ( m_xContentsListBox->n_children() == 0 &&
+ GetTopLevelSelection()->IsDeletable() )
+ {
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ VclMessageType::Question, VclButtonsType::YesNo,
+ CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR)));
+ if (xQueryBox->run() == RET_YES)
{
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
- VclMessageType::Question, VclButtonsType::YesNo,
- CuiResId(RID_SXVSTR_CONFIRM_DELETE_TOOLBAR)));
- if (xQueryBox->run() == RET_YES)
- {
- DeleteSelectedTopLevel();
- }
+ DeleteSelectedTopLevel();
}
}
}
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index ab240c2eba27..cc1c210819c9 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -1970,22 +1970,22 @@ void ToolbarSaveInData::SetSystemStyle(
window = VCLUnoHelper::GetWindow( xWindow ).get();
}
- if ( window != nullptr && window->GetType() == WindowType::TOOLBOX )
- {
- ToolBox* toolbox = static_cast<ToolBox*>(window);
+ if ( !(window != nullptr && window->GetType() == WindowType::TOOLBOX) )
+ return;
- if ( nStyle == 0 )
- {
- toolbox->SetButtonType( ButtonType::SYMBOLONLY );
- }
- else if ( nStyle == 1 )
- {
- toolbox->SetButtonType( ButtonType::TEXT );
- }
- if ( nStyle == 2 )
- {
- toolbox->SetButtonType( ButtonType::SYMBOLTEXT );
- }
+ ToolBox* toolbox = static_cast<ToolBox*>(window);
+
+ if ( nStyle == 0 )
+ {
+ toolbox->SetButtonType( ButtonType::SYMBOLONLY );
+ }
+ else if ( nStyle == 1 )
+ {
+ toolbox->SetButtonType( ButtonType::TEXT );
+ }
+ if ( nStyle == 2 )
+ {
+ toolbox->SetButtonType( ButtonType::SYMBOLTEXT );
}
}
@@ -1993,38 +1993,38 @@ void ToolbarSaveInData::SetSystemStyle(
const OUString& rResourceURL,
sal_Int32 nStyle )
{
- if ( rResourceURL.startsWith( "private" ) &&
+ if ( !(rResourceURL.startsWith( "private" ) &&
m_xPersistentWindowState.is() &&
- m_xPersistentWindowState->hasByName( rResourceURL ) )
+ m_xPersistentWindowState->hasByName( rResourceURL )) )
+ return;
+
+ try
{
- try
- {
- uno::Sequence< beans::PropertyValue > aProps;
+ uno::Sequence< beans::PropertyValue > aProps;
- uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) );
+ uno::Any a( m_xPersistentWindowState->getByName( rResourceURL ) );
- if ( a >>= aProps )
+ if ( a >>= aProps )
+ {
+ for ( sal_Int32 i = 0; i < aProps.getLength(); ++i )
{
- for ( sal_Int32 i = 0; i < aProps.getLength(); ++i )
+ if ( aProps[ i ].Name == ITEM_DESCRIPTOR_STYLE )
{
- if ( aProps[ i ].Name == ITEM_DESCRIPTOR_STYLE )
- {
- aProps[ i ].Value <<= nStyle;
- break;
- }
+ aProps[ i ].Value <<= nStyle;
+ break;
}
}
+ }
- uno::Reference< container::XNameReplace >
- xNameReplace( m_xPersistentWindowState, uno::UNO_QUERY );
+ uno::Reference< container::XNameReplace >
+ xNameReplace( m_xPersistentWindowState, uno::UNO_QUERY );
- xNameReplace->replaceByName( rResourceURL, uno::Any( aProps ) );
- }
- catch ( uno::Exception& )
- {
- // do nothing, a default value is returned
- SAL_WARN("cui.customize", "Exception setting toolbar style");
- }
+ xNameReplace->replaceByName( rResourceURL, uno::Any( aProps ) );
+ }
+ catch ( uno::Exception& )
+ {
+ // do nothing, a default value is returned
+ SAL_WARN("cui.customize", "Exception setting toolbar style");
}
}
@@ -2856,18 +2856,18 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, DeleteHdl, weld::Button&, void)
std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Warning, VclButtonsType::OkCancel,
message));
- if (xWarn->run() == RET_OK)
- {
- sal_uInt16 nId = m_xTbSymbol->GetSelectedItemId();
+ if (xWarn->run() != RET_OK)
+ return;
- OUString aSelImageText = m_xTbSymbol->GetItemText( nId );
- uno::Sequence< OUString > URLs { aSelImageText };
- m_xTbSymbol->RemoveItem(nId);
- m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
- if ( m_xImportedImageManager->isModified() )
- {
- m_xImportedImageManager->store();
- }
+ sal_uInt16 nId = m_xTbSymbol->GetSelectedItemId();
+
+ OUString aSelImageText = m_xTbSymbol->GetItemText( nId );
+ uno::Sequence< OUString > URLs { aSelImageText };
+ m_xTbSymbol->RemoveItem(nId);
+ m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
+ if ( m_xImportedImageManager->isModified() )
+ {
+ m_xImportedImageManager->store();
}
}
@@ -3066,20 +3066,20 @@ void SvxIconSelectorDialog::ImportGraphics(
}
}
- if ( rejectedCount != 0 )
- {
- OUStringBuffer message;
- OUString fPath;
- if (rejectedCount > 1)
- fPath = rPaths[0].copy(8) + "/";
- for ( sal_Int32 i = 0; i < rejectedCount; ++i )
- {
- message.append(fPath).append(rejected[i]).append("\n");
- }
+ if ( rejectedCount == 0 )
+ return;
- SvxIconChangeDialog aDialog(m_xDialog.get(), message.makeStringAndClear());
- aDialog.run();
+ OUStringBuffer message;
+ OUString fPath;
+ if (rejectedCount > 1)
+ fPath = rPaths[0].copy(8) + "/";
+ for ( sal_Int32 i = 0; i < rejectedCount; ++i )
+ {
+ message.append(fPath).append(rejected[i]).append("\n");
}
+
+ SvxIconChangeDialog aDialog(m_xDialog.get(), message.makeStringAndClear());
+ aDialog.run();
}
bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
diff --git a/cui/source/customize/macropg.cxx b/cui/source/customize/macropg.cxx
index cdf07498f83e..7b45afa8652e 100644
--- a/cui/source/customize/macropg.cxx
+++ b/cui/source/customize/macropg.cxx
@@ -534,19 +534,19 @@ void SvxMacroTabPage_::InitAndSetHandler( const Reference< container::XNameRepla
{
}
}
- if(m_xDocEvents.is())
+ if(!m_xDocEvents.is())
+ return;
+
+ eventNames = m_xDocEvents->getElementNames();
+ nEventCount = eventNames.getLength();
+ for(sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent )
{
- eventNames = m_xDocEvents->getElementNames();
- nEventCount = eventNames.getLength();
- for(sal_Int32 nEvent = 0; nEvent < nEventCount; ++nEvent )
+ try
+ {
+ m_docEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xDocEvents->getByName( eventNames[nEvent] ) );
+ }
+ catch (const Exception&)
{
- try
- {
- m_docEventsHash[ eventNames[nEvent] ] = GetPairFromAny( m_xDocEvents->getByName( eventNames[nEvent] ) );
- }
- catch (const Exception&)
- {
- }
}
}
}
diff --git a/cui/source/dialogs/QrCodeGenDialog.cxx b/cui/source/dialogs/QrCodeGenDialog.cxx
index cec3b82a3567..85ed9309df9c 100644
--- a/cui/source/dialogs/QrCodeGenDialog.cxx
+++ b/cui/source/dialogs/QrCodeGenDialog.cxx
@@ -186,69 +186,69 @@ void QrCodeGenDialog::Apply()
// Set QRCode properties
xShapeProps->setPropertyValue("QRCodeProperties", Any(aQRCode));
- if (!bIsExistingQRCode)
- {
- // Default size
- Reference<XShape> xShape(xShapeProps, UNO_QUERY);
- awt::Size aShapeSize;
- aShapeSize.Height = 4000;
- aShapeSize.Width = 4000;
- xShape->setSize(aShapeSize);
+ if (bIsExistingQRCode)
+ return;
- // Default anchoring
- xShapeProps->setPropertyValue("AnchorType", Any(TextContentAnchorType_AT_PARAGRAPH));
+ // Default size
+ Reference<XShape> xShape(xShapeProps, UNO_QUERY);
+ awt::Size aShapeSize;
+ aShapeSize.Height = 4000;
+ aShapeSize.Width = 4000;
+ xShape->setSize(aShapeSize);
- const Reference<XServiceInfo> xServiceInfo(m_xModel, UNO_QUERY_THROW);
+ // Default anchoring
+ xShapeProps->setPropertyValue("AnchorType", Any(TextContentAnchorType_AT_PARAGRAPH));
- // Writer
- if (xServiceInfo->supportsService("com.sun.star.text.TextDocument"))
- {
- Reference<XTextContent> xTextContent(xShape, UNO_QUERY_THROW);
- Reference<XTextViewCursorSupplier> xViewCursorSupplier(m_xModel->getCurrentController(),
- UNO_QUERY_THROW);
- Reference<XTextViewCursor> xCursor = xViewCursorSupplier->getViewCursor();
- // use cursor's XText - it might be in table cell, frame, ...
- Reference<XText> const xText(xCursor->getText());
- assert(xText.is());
- xText->insertTextContent(xCursor, xTextContent, true);
- return;
- }
+ const Reference<XServiceInfo> xServiceInfo(m_xModel, UNO_QUERY_THROW);
- // Calc
- else if (xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument"))
- {
- Reference<XPropertySet> xSheetCell(m_xModel->getCurrentSelection(), UNO_QUERY_THROW);
- awt::Point aCellPosition;
- xSheetCell->getPropertyValue("Position") >>= aCellPosition;
- xShape->setPosition(aCellPosition);
-
- Reference<XSpreadsheetView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW);
- Reference<XSpreadsheet> xSheet(xView->getActiveSheet(), UNO_SET_THROW);
- Reference<XDrawPageSupplier> xDrawPageSupplier(xSheet, UNO_QUERY_THROW);
- Reference<XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
- Reference<XShapes> xShapes(xDrawPage, UNO_QUERY_THROW);
-
- xShapes->add(xShape);
- return;
- }
+ // Writer
+ if (xServiceInfo->supportsService("com.sun.star.text.TextDocument"))
+ {
+ Reference<XTextContent> xTextContent(xShape, UNO_QUERY_THROW);
+ Reference<XTextViewCursorSupplier> xViewCursorSupplier(m_xModel->getCurrentController(),
+ UNO_QUERY_THROW);
+ Reference<XTextViewCursor> xCursor = xViewCursorSupplier->getViewCursor();
+ // use cursor's XText - it might be in table cell, frame, ...
+ Reference<XText> const xText(xCursor->getText());
+ assert(xText.is());
+ xText->insertTextContent(xCursor, xTextContent, true);
+ return;
+ }
- //Impress and Draw
- else if (xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument")
- || xServiceInfo->supportsService("com.sun.star.drawing.DrawingDocument"))
- {
- Reference<XDrawView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW);
- Reference<XDrawPage> xPage(xView->getCurrentPage(), UNO_SET_THROW);
- Reference<XShapes> xShapes(xPage, UNO_QUERY_THROW);
+ // Calc
+ else if (xServiceInfo->supportsService("com.sun.star.sheet.SpreadsheetDocument"))
+ {
+ Reference<XPropertySet> xSheetCell(m_xModel->getCurrentSelection(), UNO_QUERY_THROW);
+ awt::Point aCellPosition;
+ xSheetCell->getPropertyValue("Position") >>= aCellPosition;
+ xShape->setPosition(aCellPosition);
+
+ Reference<XSpreadsheetView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW);
+ Reference<XSpreadsheet> xSheet(xView->getActiveSheet(), UNO_SET_THROW);
+ Reference<XDrawPageSupplier> xDrawPageSupplier(xSheet, UNO_QUERY_THROW);
+ Reference<XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
+ Reference<XShapes> xShapes(xDrawPage, UNO_QUERY_THROW);
+
+ xShapes->add(xShape);
+ return;
+ }
- xShapes->add(xShape);
- return;
- }
+ //Impress and Draw
+ else if (xServiceInfo->supportsService("com.sun.star.presentation.PresentationDocument")
+ || xServiceInfo->supportsService("com.sun.star.drawing.DrawingDocument"))
+ {
+ Reference<XDrawView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW);
+ Reference<XDrawPage> xPage(xView->getCurrentPage(), UNO_SET_THROW);
+ Reference<XShapes> xShapes(xPage, UNO_QUERY_THROW);
- else
- {
- //Not implemented for math,base and other apps.
- throw uno::RuntimeException("Not implemented");
- }
+ xShapes->add(xShape);
+ return;
+ }
+
+ else
+ {
+ //Not implemented for math,base and other apps.
+ throw uno::RuntimeException("Not implemented");
}
}
diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx b/cui/source/dialogs/SignSignatureLineDialog.cxx
index 00ad09f4cbef..e7a6417d5571 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -132,24 +132,24 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, loadImage, weld::Button&, void)
Reference<XComponentContext> xContext = comphelper::getProcessComponentContext();
Reference<XFilePicker3> xFilePicker
= FilePicker::createWithMode(xContext, TemplateDescription::FILEOPEN_PREVIEW);
- if (xFilePicker->execute())
- {
- Sequence<OUString> aSelectedFiles = xFilePicker->getSelectedFiles();
- if (!aSelectedFiles.hasElements())
- return;
+ if (!xFilePicker->execute())
+ return;
- Reference<XGraphicProvider> xProvider = GraphicProvider::create(xContext);
- Sequence<PropertyValue> aMediaProperties(1);
- aMediaProperties[0].Name = "URL";
- aMediaProperties[0].Value <<= aSelectedFiles[0];
- m_xSignatureImage = xProvider->queryGraphic(aMediaProperties);
- m_sOriginalImageBtnLabel = m_xBtnLoadImage->get_label();
+ Sequence<OUString> aSelectedFiles = xFilePicker->getSelectedFiles();
+ if (!aSelectedFiles.hasElements())
+ return;
- INetURLObject aObj(aSelectedFiles[0]);
- m_xBtnLoadImage->set_label(aObj.GetLastName());
+ Reference<XGraphicProvider> xProvider = GraphicProvider::create(xContext);
+ Sequence<PropertyValue> aMediaProperties(1);
+ aMediaProperties[0].Name = "URL";
+ aMediaProperties[0].Value <<= aSelectedFiles[0];
+ m_xSignatureImage = xProvider->queryGraphic(aMediaProperties);
+ m_sOriginalImageBtnLabel = m_xBtnLoadImage->get_label();
- ValidateFields();
- }
+ INetURLObject aObj(aSelectedFiles[0]);
+ m_xBtnLoadImage->set_label(aObj.GetLastName());
+
+ ValidateFields();
}
IMPL_LINK_NOARG(SignSignatureLineDialog, clearImage, weld::Button&, void)
diff --git a/cui/source/dialogs/SignatureLineDialog.cxx b/cui/source/dialogs/SignatureLineDialog.cxx
index 45a11c9fc111..e295e288e388 100644
--- a/cui/source/dialogs/SignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignatureLineDialog.cxx
@@ -160,52 +160,51 @@ void SignatureLineDialog::Apply()
xShapeProps->setPropertyValue("SignatureLineShowSignDate", Any(bShowSignDate));
xShapeProps->setPropertyValue("SignatureLineCanAddComment", Any(bCanAddComments));
- if (!bIsExistingSignatureLine)
+ if (bIsExistingSignatureLine)
+ return;
+
+ // Default size
+ Reference<XShape> xShape(xShapeProps, UNO_QUERY);
+ awt::Size aShapeSize;
+ aShapeSize.Height = 3000;
+ aShapeSize.Width = 6000;
+ xShape->setSize(aShapeSize);
+
+ // Default anchoring
+ xShapeProps->setPropertyValue("AnchorType", Any(TextContentAnchorType_AT_PARAGRAPH));
+
+ // Writer
+ const Reference<XTextDocument> xTextDocument(m_xModel, UNO_QUERY);
+ if (xTextDocument.is())
{
- // Default size
- Reference<XShape> xShape(xShapeProps, UNO_QUERY);
- awt::Size aShapeSize;
- aShapeSize.Height = 3000;
- aShapeSize.Width = 6000;
- xShape->setSize(aShapeSize);
-
- // Default anchoring
- xShapeProps->setPropertyValue("AnchorType", Any(TextContentAnchorType_AT_PARAGRAPH));
-
- // Writer
- const Reference<XTextDocument> xTextDocument(m_xModel, UNO_QUERY);
- if (xTextDocument.is())
- {
- Reference<XTextContent> xTextContent(xShape, UNO_QUERY_THROW);
- Reference<XTextViewCursorSupplier> xViewCursorSupplier(m_xModel->getCurrentController(),
- UNO_QUERY_THROW);
- Reference<XTextViewCursor> xCursor = xViewCursorSupplier->getViewCursor();
- // use cursor's XText - it might be in table cell, frame, ...
- Reference<XText> const xText(xCursor->getText());
- assert(xText.is());
- xText->insertTextContent(xCursor, xTextContent, true);
- return;
- }
-
- // Calc
- const Reference<XSpreadsheetDocument> xSpreadsheetDocument(m_xModel, UNO_QUERY);
- if (xSpreadsheetDocument.is())
- {
- Reference<XPropertySet> xSheetCell(m_xModel->getCurrentSelection(), UNO_QUERY_THROW);
- awt::Point aCellPosition;
- xSheetCell->getPropertyValue("Position") >>= aCellPosition;
- xShape->setPosition(aCellPosition);
-
- Reference<XSpreadsheetView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW);
- Reference<XSpreadsheet> xSheet(xView->getActiveSheet(), UNO_SET_THROW);
- Reference<XDrawPageSupplier> xDrawPageSupplier(xSheet, UNO_QUERY_THROW);
- Reference<XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
- Reference<XShapes> xShapes(xDrawPage, UNO_QUERY_THROW);
-
- xShapes->add(xShape);
- return;
- }
+ Reference<XTextContent> xTextContent(xShape, UNO_QUERY_THROW);
+ Reference<XTextViewCursorSupplier> xViewCursorSupplier(m_xModel->getCurrentController(),
+ UNO_QUERY_THROW);
+ Reference<XTextViewCursor> xCursor = xViewCursorSupplier->getViewCursor();
+ // use cursor's XText - it might be in table cell, frame, ...
+ Reference<XText> const xText(xCursor->getText());
+ assert(xText.is());
+ xText->insertTextContent(xCursor, xTextContent, true);
+ return;
}
+
+ // Calc
+ const Reference<XSpreadsheetDocument> xSpreadsheetDocument(m_xModel, UNO_QUERY);
+ if (!xSpreadsheetDocument.is())
+ return;
+
+ Reference<XPropertySet> xSheetCell(m_xModel->getCurrentSelection(), UNO_QUERY_THROW);
+ awt::Point aCellPosition;
+ xSheetCell->getPropertyValue("Position") >>= aCellPosition;
+ xShape->setPosition(aCellPosition);
+
+ Reference<XSpreadsheetView> xView(m_xModel->getCurrentController(), UNO_QUERY_THROW);
+ Reference<XSpreadsheet> xSheet(xView->getActiveSheet(), UNO_SET_THROW);
+ Reference<XDrawPageSupplier> xDrawPageSupplier(xSheet, UNO_QUERY_THROW);
+ Reference<XDrawPage> xDrawPage(xDrawPageSupplier->getDrawPage(), UNO_SET_THROW);
+ Reference<XShapes> xShapes(xDrawPage, UNO_QUERY_THROW);
+
+ xShapes->add(xShape);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index fd47ab92d728..cfa05034727e 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -349,35 +349,35 @@ void SpellDialog::SpellContinue_Impl(bool bUseSavedSentence, bool bIgnoreCurrent
//then GetNextSentence() has to be called followed again by MarkNextError()
//MarkNextError is not initially called if the UndoEdit mode is active
bool bNextSentence = false;
- if((!m_xSentenceED->IsUndoEditMode() && m_xSentenceED->MarkNextError( bIgnoreCurrentError, xSpell )) ||
- ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, m_xSentenceED->IsUndoEditMode()) && m_xSentenceED->MarkNextError( false, xSpell )))
+ if(!((!m_xSentenceED->IsUndoEditMode() && m_xSentenceED->MarkNextError( bIgnoreCurrentError, xSpell )) ||
+ ( bNextSentence = GetNextSentence_Impl(bUseSavedSentence, m_xSentenceED->IsUndoEditMode()) && m_xSentenceED->MarkNextError( false, xSpell ))))
+ return;
+
+ SpellErrorDescription aSpellErrorDescription;
+ bool bSpellErrorDescription = m_xSentenceED->GetAlternatives(aSpellErrorDescription);
+ if (bSpellErrorDescription)
{
- SpellErrorDescription aSpellErrorDescription;
- bool bSpellErrorDescription = m_xSentenceED->GetAlternatives(aSpellErrorDescription);
- if (bSpellErrorDescription)
+ UpdateBoxes_Impl();
+ weld::Widget* aControls[] =
{
- UpdateBoxes_Impl();
- weld::Widget* aControls[] =
- {
- m_xNotInDictFT.get(),
- m_xSentenceED->GetDrawingArea(),
- m_xLanguageFT.get(),
- nullptr
- };
- sal_Int32 nIdx = 0;
- do
- {
- aControls[nIdx]->set_sensitive(true);
- }
- while(aControls[++nIdx]);
-
- }
- if( bNextSentence )
+ m_xNotInDictFT.get(),
+ m_xSentenceED->GetDrawingArea(),
+ m_xLanguageFT.get(),
+ nullptr
+ };
+ sal_Int32 nIdx = 0;
+ do
{
- //remove undo if a new sentence is active
- m_xSentenceED->ResetUndo();
- m_xUndoPB->set_sensitive(false);
+ aControls[nIdx]->set_sensitive(true);
}
+ while(aControls[++nIdx]);
+
+ }
+ if( bNextSentence )
+ {
+ //remove undo if a new sentence is active
+ m_xSentenceED->ResetUndo();
+ m_xUndoPB->set_sensitive(false);
}
}
/* Initialize, asynchronous to prevent virtual calls
@@ -898,18 +898,18 @@ void SpellDialog::ToplevelFocusChanged()
* The only sensible thing would be to call the new Method differently,
* e.g. DialogGot/LostFocus or so.
*/
- if (m_xDialog->get_visible() && !bFocusLocked)
+ if (!(m_xDialog->get_visible() && !bFocusLocked))
+ return;
+
+ if (m_xDialog->has_toplevel_focus())
{
- if (m_xDialog->has_toplevel_focus())
- {
- //notify the child window of the focus change
- rParent.GetFocus();
- }
- else
- {
- //notify the child window of the focus change
- rParent.LoseFocus();
- }
+ //notify the child window of the focus change
+ rParent.GetFocus();
+ }
+ else
+ {
+ //notify the child window of the focus change
+ rParent.LoseFocus();
}
}
diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx
index 565c3ca2c8b1..fbba1abd1e90 100644
--- a/cui/source/dialogs/colorpicker.cxx
+++ b/cui/source/dialogs/colorpicker.cxx
@@ -493,19 +493,19 @@ void ColorFieldControl::Modify()
void ColorFieldControl::SetValues( Color aColor, ColorMode eMode, double x, double y )
{
bool bUpdateBitmap = (maColor!= aColor) || (meMode != eMode);
- if( bUpdateBitmap || (mdX != x) || (mdY != y) )
- {
- maColor = aColor;
- meMode = eMode;
- mdX = x;
- mdY = y;
+ if( !(bUpdateBitmap || (mdX != x) || (mdY != y)) )
+ return;
- if (bUpdateBitmap)
- UpdateBitmap();
- UpdatePosition();
- if (bUpdateBitmap)
- Invalidate();
- }
+ maColor = aColor;
+ meMode = eMode;
+ mdX = x;
+ mdY = y;
+
+ if (bUpdateBitmap)
+ UpdateBitmap();
+ UpdatePosition();
+ if (bUpdateBitmap)
+ Invalidate();
}
void ColorFieldControl::UpdatePosition()
diff --git a/cui/source/dialogs/cuigaldlg.cxx b/cui/source/dialogs/cuigaldlg.cxx
index 919fae2f3e5f..de0b0c1663f5 100644
--- a/cui/source/dialogs/cuigaldlg.cxx
+++ b/cui/source/dialogs/cuigaldlg.cxx
@@ -809,36 +809,36 @@ void TPGalleryThemeProperties::SearchFiles()
IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickSearchHdl, weld::Button&, void)
{
- if( bInputAllowed )
+ if( !bInputAllowed )
+ return;
+
+ try
{
- try
- {
- // setup folder picker
- css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
- xFolderPicker = FolderPicker::create(xContext);
+ // setup folder picker
+ css::uno::Reference< XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
+ xFolderPicker = FolderPicker::create(xContext);
- OUString aDlgPathName( SvtPathOptions().GetGraphicPath() );
- xFolderPicker->setDisplayDirectory(aDlgPathName);
+ OUString aDlgPathName( SvtPathOptions().GetGraphicPath() );
+ xFolderPicker->setDisplayDirectory(aDlgPathName);
- aPreviewTimer.Stop();
+ aPreviewTimer.Stop();
- css::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
- if ( xAsyncDlg.is() )
- xAsyncDlg->startExecuteModal( xDialogListener.get() );
- else
+ css::uno::Reference< XAsynchronousExecutableDialog > xAsyncDlg( xFolderPicker, UNO_QUERY );
+ if ( xAsyncDlg.is() )
+ xAsyncDlg->startExecuteModal( xDialogListener.get() );
+ else
+ {
+ if( xFolderPicker->execute() == RET_OK )
{
- if( xFolderPicker->execute() == RET_OK )
- {
- aURL = INetURLObject( xFolderPicker->getDirectory() );
- bSearchRecursive = true; // UI choice no longer possible, windows file picker allows no user controls
- SearchFiles();
- }
+ aURL = INetURLObject( xFolderPicker->getDirectory() );
+ bSearchRecursive = true; // UI choice no longer possible, windows file picker allows no user controls
+ SearchFiles();
}
}
- catch (const IllegalArgumentException&)
- {
- OSL_FAIL( "Folder picker failed with illegal arguments" );
- }
+ }
+ catch (const IllegalArgumentException&)
+ {
+ OSL_FAIL( "Folder picker failed with illegal arguments" );
}
}
@@ -858,20 +858,20 @@ void TPGalleryThemeProperties::TakeFiles()
IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickPreviewHdl, weld::ToggleButton&, void)
{
- if ( bInputAllowed )
- {
- aPreviewTimer.Stop();
- aPreviewString.clear();
+ if ( !bInputAllowed )
+ return;
- if (!m_xCbxPreview->get_active())
- {
- xMediaPlayer.clear();
- m_aWndPreview.SetGraphic(Graphic());
- m_aWndPreview.Invalidate();
- }
- else
- DoPreview();
+ aPreviewTimer.Stop();
+ aPreviewString.clear();
+
+ if (!m_xCbxPreview->get_active())
+ {
+ xMediaPlayer.clear();
+ m_aWndPreview.SetGraphic(Graphic());
+ m_aWndPreview.Invalidate();
}
+ else
+ DoPreview();
}
void TPGalleryThemeProperties::DoPreview()
@@ -879,49 +879,49 @@ void TPGalleryThemeProperties::DoPreview()
int nIndex = m_xLbxFound->get_selected_index();
OUString aString(m_xLbxFound->get_text(nIndex));
- if (aString != aPreviewString)
- {
- INetURLObject _aURL(aFoundList[nIndex]);
- bInputAllowed = false;
+ if (aString == aPreviewString)
+ return;
- if (!m_aWndPreview.SetGraphic(_aURL))
- {
- weld::WaitObject aWaitObject(GetFrameWeld());
- ErrorHandler::HandleError(ERRCODE_IO_NOTEXISTSPATH, GetFrameWeld());
- }
+ INetURLObject _aURL(aFoundList[nIndex]);
+ bInputAllowed = false;
+
+ if (!m_aWndPreview.SetGraphic(_aURL))
+ {
+ weld::WaitObject aWaitObject(GetFrameWeld());
+ ErrorHandler::HandleError(ERRCODE_IO_NOTEXISTSPATH, GetFrameWeld());
+ }
#if HAVE_FEATURE_AVMEDIA
- else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ), "" ) )
- {
- xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), "" );
- if( xMediaPlayer.is() )
- xMediaPlayer->start();
- }
-#endif
- bInputAllowed = true;
- aPreviewString = aString;
+ else if( ::avmedia::MediaWindow::isMediaURL( _aURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous ), "" ) )
+ {
+ xMediaPlayer = ::avmedia::MediaWindow::createPlayer( _aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), "" );
+ if( xMediaPlayer.is() )
+ xMediaPlayer->start();
}
+#endif
+ bInputAllowed = true;
+ aPreviewString = aString;
}
IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickTakeHdl, weld::Button&, void)
{
- if( bInputAllowed )
- {
- aPreviewTimer.Stop();
+ if( !bInputAllowed )
+ return;
- if (!m_xLbxFound->count_selected_rows() || !bEntriesFound)
- {
- SvxOpenGraphicDialog aDlg(CuiResId(RID_SVXSTR_KEY_GALLERY_DIR), GetFrameWeld());
- aDlg.EnableLink(false);
- aDlg.AsLink(false);
+ aPreviewTimer.Stop();
- if( !aDlg.Execute() )
- pData->pTheme->InsertURL( INetURLObject( aDlg.GetPath() ) );
- }
- else
- {
- bTakeAll = false;
- TakeFiles();
- }
+ if (!m_xLbxFound->count_selected_rows() || !bEntriesFound)
+ {
+ SvxOpenGraphicDialog aDlg(CuiResId(RID_SVXSTR_KEY_GALLERY_DIR), GetFrameWeld());
+ aDlg.EnableLink(false);
+ aDlg.AsLink(false);
+
+ if( !aDlg.Execute() )
+ pData->pTheme->InsertURL( INetURLObject( aDlg.GetPath() ) );
+ }
+ else
+ {
+ bTakeAll = false;
+ TakeFiles();
}
}
@@ -937,31 +937,31 @@ IMPL_LINK_NOARG(TPGalleryThemeProperties, ClickTakeAllHdl, weld::Button&, void)
IMPL_LINK_NOARG(TPGalleryThemeProperties, SelectFoundHdl, weld::TreeView&, void)
{
- if (bInputAllowed)
- {
- bool bPreviewPossible = false;
+ if (!bInputAllowed)
+ return;
- aPreviewTimer.Stop();
+ bool bPreviewPossible = false;
- if( bEntriesFound )
- {
- if (m_xLbxFound->count_selected_rows() == 1)
- {
- m_xCbxPreview->set_sensitive(true);
- bPreviewPossible = true;
- }
- else
- m_xCbxPreview->set_sensitive(false);
+ aPreviewTimer.Stop();
- if( !aFoundList.empty() )
- m_xBtnTakeAll->set_sensitive(true);
- else
- m_xBtnTakeAll->set_sensitive(false);
+ if( bEntriesFound )
+ {
+ if (m_xLbxFound->count_selected_rows() == 1)
+ {
+ m_xCbxPreview->set_sensitive(true);
+ bPreviewPossible = true;
}
+ else
+ m_xCbxPreview->set_sensitive(false);
- if (bPreviewPossible && m_xCbxPreview->get_active())
- aPreviewTimer.Start();
+ if( !aFoundList.empty() )
+ m_xBtnTakeAll->set_sensitive(true);
+ else
+ m_xBtnTakeAll->set_sensitive(false);
}
+
+ if (bPreviewPossible && m_xCbxPreview->get_active())
+ aPreviewTimer.Start();
}
IMPL_LINK_NOARG(TPGalleryThemeProperties, DClickFoundHdl, weld::TreeView&, bool)
diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 1a3a7b520501..9ca722680a15 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -61,21 +61,21 @@ void SvxHlinkCtrl::dispose()
void SvxHlinkCtrl::StateChanged( sal_uInt16 nSID, SfxItemState eState,
const SfxPoolItem* pState )
{
- if (eState == SfxItemState::DEFAULT && pParent)
+ if (!(eState == SfxItemState::DEFAULT && pParent))
+ return;
+
+ switch ( nSID )
{
- switch ( nSID )
+ case SID_HYPERLINK_GETLINK :
{
- case SID_HYPERLINK_GETLINK :
- {
- pParent->SetPage( static_cast<const SvxHyperlinkItem*>(pState) );
- }
- break;
- case SID_READONLY_MODE :
- {
- pParent->SetReadOnlyMode( static_cast<const SfxBoolItem*>(pState)->GetValue() );
- }
- break;
+ pParent->SetPage( static_cast<const SvxHyperlinkItem*>(pState) );
+ }
+ break;
+ case SID_READONLY_MODE :
+ {
+ pParent->SetReadOnlyMode( static_cast<const SfxBoolItem*>(pState)->GetValue() );
}
+ break;
}
}
diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx
index a90d1725a50d..3c68eb9b5991 100644
--- a/cui/source/dialogs/hangulhanjadlg.cxx
+++ b/cui/source/dialogs/hangulhanjadlg.cxx
@@ -323,21 +323,21 @@ namespace svx
void SuggestionDisplay::DisplayListBox( bool bDisplayListBox )
{
- if( m_bDisplayListBox != bDisplayListBox )
- {
- weld::Widget& rOldControl = implGetCurrentControl();
- bool bHasFocus = rOldControl.has_focus();
+ if( m_bDisplayListBox == bDisplayListBox )
+ return;
- m_bDisplayListBox = bDisplayListBox;
+ weld::Widget& rOldControl = implGetCurrentControl();
+ bool bHasFocus = rOldControl.has_focus();
- if( bHasFocus )
- {
- weld::Widget& rNewControl = implGetCurrentControl();
- rNewControl.grab_focus();
- }
+ m_bDisplayListBox = bDisplayListBox;
- implUpdateDisplay();
+ if( bHasFocus )
+ {
+ weld::Widget& rNewControl = implGetCurrentControl();
+ rNewControl.grab_focus();
}
+
+ implUpdateDisplay();
}
IMPL_LINK_NOARG(SuggestionDisplay, SelectSuggestionValueSetHdl, SvtValueSet*, void)
@@ -598,24 +598,24 @@ namespace svx
m_xIgnoreAll->set_sensitive( m_bDocumentMode );
// switch the def button depending if we're working for document text
- if (bOldDocumentMode != m_bDocumentMode)
- {
- weld::Widget* pOldDefButton = nullptr;
- weld::Widget* pNewDefButton = nullptr;
- if (m_bDocumentMode)
- {
- pOldDefButton = m_xFind.get();
- pNewDefButton = m_xReplace.get();
- }
- else
- {
- pOldDefButton = m_xReplace.get();
- pNewDefButton = m_xFind.get();
- }
+ if (bOldDocumentMode == m_bDocumentMode)
+ return;
- pOldDefButton->set_has_default(false);
- pNewDefButton->set_has_default(true);
+ weld::Widget* pOldDefButton = nullptr;
+ weld::Widget* pNewDefButton = nullptr;
+ if (m_bDocumentMode)
+ {
+ pOldDefButton = m_xFind.get();
+ pNewDefButton = m_xReplace.get();
}
+ else
+ {
+ pOldDefButton = m_xReplace.get();
+ pNewDefButton = m_xFind.get();
+ }
+
+ pOldDefButton->set_has_default(false);
+ pNewDefButton->set_has_default(true);
}
OUString HangulHanjaConversionDialog::GetCurrentSuggestion( ) const
@@ -810,30 +810,30 @@ namespace svx
OUString aName;
HangulHanjaNewDictDialog aNewDlg(m_xDialog.get());
aNewDlg.run();
- if (aNewDlg.GetName(aName))
+ if (!aNewDlg.GetName(aName))
+ return;
+
+ if( !m_xConversionDictionaryList.is() )
+ return;
+
+ try
{
- if( m_xConversionDictionaryList.is() )
- {
- try
- {
- Reference< XConversionDictionary > xDic =
- m_xConversionDictionaryList->addNewDictionary( aName, LanguageTag::convertToLocale( LANGUAGE_KOREAN ), ConversionDictionaryType::HANGUL_HANJA );
+ Reference< XConversionDictionary > xDic =
+ m_xConversionDictionaryList->addNewDictionary( aName, LanguageTag::convertToLocale( LANGUAGE_KOREAN ), ConversionDictionaryType::HANGUL_HANJA );
- if( xDic.is() )
- {
- //adapt local caches:
- m_aDictList.push_back( xDic );
- AddDict( xDic->getName(), xDic->isActive() );
- }
- }
- catch( const ElementExistException& )
- {
- }
- catch( const NoSupportException& )
- {
- }
+ if( xDic.is() )
+ {
+ //adapt local caches:
+ m_aDictList.push_back( xDic );
+ AddDict( xDic->getName(), xDic->isActive() );
}
}
+ catch( const ElementExistException& )
+ {
+ }
+ catch( const NoSupportException& )
+ {
+ }
}
IMPL_LINK_NOARG(HangulHanjaOptionsDialog, EditDictHdl, weld::Button&, void)
@@ -850,30 +850,30 @@ namespace svx
IMPL_LINK_NOARG(HangulHanjaOptionsDialog, DeleteDictHdl, weld::Button&, void)
{
int nSelPos = m_xDictsLB->get_selected_index();
- if (nSelPos != -1)
+ if (nSelPos == -1)
+ return;
+
+ Reference< XConversionDictionary > xDic( m_aDictList[ nSelPos ] );
+ if( !(m_xConversionDictionaryList.is() && xDic.is()) )
+ return;
+
+ Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer();
+ if( !xNameCont.is() )
+ return;
+
+ try
{
- Reference< XConversionDictionary > xDic( m_aDictList[ nSelPos ] );
- if( m_xConversionDictionaryList.is() && xDic.is() )
- {
- Reference< XNameContainer > xNameCont = m_xConversionDictionaryList->getDictionaryContainer();
- if( xNameCont.is() )
- {
- try
- {
- xNameCont->removeByName( xDic->getName() );
+ xNameCont->removeByName( xDic->getName() );
- //adapt local caches:
- m_aDictList.erase(m_aDictList.begin()+nSelPos );
- m_xDictsLB->remove(nSelPos);
- }
- catch( const ElementExistException& )
- {
- }
- catch( const NoSupportException& )
- {
- }
- }
- }
+ //adapt local caches:
+ m_aDictList.erase(m_aDictList.begin()+nSelPos );
+ m_xDictsLB->remove(nSelPos);
+ }
+ catch( const ElementExistException& )
+ {
+ }
+ catch( const NoSupportException& )
+ {
}
}
diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx
index f800edba1cea..fa4529735185 100644
--- a/cui/source/dialogs/hldocntp.cxx
+++ b/cui/source/dialogs/hldocntp.cxx
@@ -358,52 +358,52 @@ void SvxHyperlinkNewDocTp::DoApply()
// create a real URL-String
INetURLObject aURL;
- if ( ImplGetURLObject( aStrNewName, m_xCbbPath->GetBaseURL(), aURL ) )
+ if ( !ImplGetURLObject( aStrNewName, m_xCbbPath->GetBaseURL(), aURL ) )
+ return;
+
+ // create Document
+ aStrNewName = aURL.GetURLPath( INetURLObject::DecodeMechanism::NONE );
+ bool bCreate = true;
+ try
{
- // create Document
- aStrNewName = aURL.GetURLPath( INetURLObject::DecodeMechanism::NONE );
- bool bCreate = true;
- try
- {
- // check if file exists, warn before we overwrite it
- std::unique_ptr<SvStream> pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ );
+ // check if file exists, warn before we overwrite it
+ std::unique_ptr<SvStream> pIStm = ::utl::UcbStreamHelper::CreateStream( aURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::READ );
- bool bOk = pIStm && ( pIStm->GetError() == ERRCODE_NONE);
+ bool bOk = pIStm && ( pIStm->GetError() == ERRCODE_NONE);
- pIStm.reset();
+ pIStm.reset();
- if( bOk )
- {
- std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(),
- VclMessageType::Warning, VclButtonsType::YesNo,
- CuiResId(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE)));
- bCreate = xWarn->run() == RET_YES;
- }
- }
- catch (const uno::Exception&)
+ if( bOk )
{
+ std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(mpDialog->getDialog(),
+ VclMessageType::Warning, VclButtonsType::YesNo,
+ CuiResId(RID_SVXSTR_HYPERDLG_QUERYOVERWRITE)));
+ bCreate = xWarn->run() == RET_YES;
}
+ }
+ catch (const uno::Exception&)
+ {
+ }
- if (bCreate && !aStrNewName.isEmpty())
- {
- ExecuteInfo* pExecuteInfo = new ExecuteInfo;
+ if (!(bCreate && !aStrNewName.isEmpty()))
+ return;
- pExecuteInfo->bRbtEditLater = m_xRbtEditLater->get_active();
- pExecuteInfo->bRbtEditNow = m_xRbtEditNow->get_active();
- // get private-url
- sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
- if (nPos == -1)
- nPos = 0;
- pExecuteInfo->aURL = aURL;
- pExecuteInfo->aStrDocName = reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrURL;
+ ExecuteInfo* pExecuteInfo = new ExecuteInfo;
- // current document
- pExecuteInfo->xFrame = GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface();
- pExecuteInfo->pDispatcher = GetDispatcher();
+ pExecuteInfo->bRbtEditLater = m_xRbtEditLater->get_active();
+ pExecuteInfo->bRbtEditNow = m_xRbtEditNow->get_active();
+ // get private-url
+ sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
+ if (nPos == -1)
+ nPos = 0;
+ pExecuteInfo->aURL = aURL;
+ pExecuteInfo->aStrDocName = reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrURL;
- Application::PostUserEvent(LINK(nullptr, SvxHyperlinkNewDocTp, DispatchDocument), pExecuteInfo);
- }
- }
+ // current document
+ pExecuteInfo->xFrame = GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface();
+ pExecuteInfo->pDispatcher = GetDispatcher();
+
+ Application::PostUserEvent(LINK(nullptr, SvxHyperlinkNewDocTp, DispatchDocument), pExecuteInfo);
}
/*************************************************************************
@@ -434,46 +434,46 @@ IMPL_LINK_NOARG(SvxHyperlinkNewDocTp, ClickNewHdl_Impl, weld::Button&, void)
xFolderPicker->setDisplayDirectory( aStrPath );
sal_Int16 nResult = xFolderPicker->execute();
DisableClose( false );
- if( ExecutableDialogResults::OK == nResult )
- {
- char const sSlash[] = "/";
+ if( ExecutableDialogResults::OK != nResult )
+ return;
- INetURLObject aURL( aStrURL, INetProtocol::File );
- OUString aStrName;
- if( bHandleFileName )
- aStrName = bZeroPath? aTempStrURL : aURL.getName();
+ char const sSlash[] = "/";
- m_xCbbPath->SetBaseURL( xFolderPicker->getDirectory() );
- OUString aStrTmp( xFolderPicker->getDirectory() );
+ INetURLObject aURL( aStrURL, INetProtocol::File );
+ OUString aStrName;
+ if( bHandleFileName )
+ aStrName = bZeroPath? aTempStrURL : aURL.getName();
- if( aStrTmp[ aStrTmp.getLength() - 1 ] != sSlash[0] )
- aStrTmp += sSlash;
+ m_xCbbPath->SetBaseURL( xFolderPicker->getDirectory() );
+ OUString aStrTmp( xFolderPicker->getDirectory() );
- // append old file name
- if( bHandleFileName )
- aStrTmp += aStrName;
+ if( aStrTmp[ aStrTmp.getLength() - 1 ] != sSlash[0] )
+ aStrTmp += sSlash;
- INetURLObject aNewURL( aStrTmp );
+ // append old file name
+ if( bHandleFileName )
+ aStrTmp += aStrName;
- if (!aStrName.isEmpty() && !aNewURL.getExtension().isEmpty() &&
- m_xLbDocTypes->get_selected_index() != -1)
- {
- // get private-url
- const sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
- aNewURL.setExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
- }
+ INetURLObject aNewURL( aStrTmp );
- if( aNewURL.GetProtocol() == INetProtocol::File )
- {
- osl::FileBase::getSystemPathFromFileURL(aNewURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aStrTmp);
- }
- else
- {
- aStrTmp = aNewURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous );
- }
+ if (!aStrName.isEmpty() && !aNewURL.getExtension().isEmpty() &&
+ m_xLbDocTypes->get_selected_index() != -1)
+ {
+ // get private-url
+ const sal_Int32 nPos = m_xLbDocTypes->get_selected_index();
+ aNewURL.setExtension(reinterpret_cast<DocumentTypeData*>(m_xLbDocTypes->get_id(nPos).toInt64())->aStrExt);
+ }
- m_xCbbPath->set_entry_text( aStrTmp );
+ if( aNewURL.GetProtocol() == INetProtocol::File )
+ {
+ osl::FileBase::getSystemPathFromFileURL(aNewURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), aStrTmp);
}
+ else
+ {
+ aStrTmp = aNewURL.GetMainURL( INetURLObject::DecodeMechanism::Unambiguous );
+ }
+
+ m_xCbbPath->set_entry_text( aStrTmp );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/dialogs/hldoctp.cxx b/cui/source/dialogs/hldoctp.cxx
index 3ac1ee03318d..8bfe89465962 100644
--- a/cui/source/dialogs/hldoctp.cxx
+++ b/cui/source/dialogs/hldoctp.cxx
@@ -184,19 +184,19 @@ IMPL_LINK_NOARG(SvxHyperlinkDocTp, ClickFileopenHdl_Impl, weld::Button&, void)
ErrCode nError = aDlg.Execute();
DisableClose( false );
- if ( ERRCODE_NONE == nError )
- {
- OUString aURL( aDlg.GetPath() );
- OUString aPath;
+ if ( ERRCODE_NONE != nError )
+ return;
- osl::FileBase::getSystemPathFromFileURL(aURL, aPath);
+ OUString aURL( aDlg.GetPath() );
+ OUString aPath;
- m_xCbbPath->SetBaseURL( aURL );
- m_xCbbPath->set_entry_text(aPath);
+ osl::FileBase::getSystemPathFromFileURL(aURL, aPath);
- if ( aOldURL != GetCurrentURL() )
- ModifiedPathHdl_Impl(*m_xCbbPath->getWidget());
- }
+ m_xCbbPath->SetBaseURL( aURL );
+ m_xCbbPath->set_entry_text(aPath);
+
+ if ( aOldURL != GetCurrentURL() )
+ ModifiedPathHdl_Impl(*m_xCbbPath->getWidget());
}
/*************************************************************************
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index aeecd54a85c3..6182adfd951f 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -331,47 +331,47 @@ IMPL_LINK_NOARG(SvxHyperlinkTabPageBase, ClickScriptHdl_Impl, weld::Button&, voi
SvxHyperlinkItem *pHyperlinkItem = const_cast<SvxHyperlinkItem*>(static_cast<const SvxHyperlinkItem *>(
GetItemSet().GetItem (SID_HYPERLINK_GETLINK)));
- if ( pHyperlinkItem->GetMacroEvents() != HyperDialogEvent::NONE )
+ if ( pHyperlinkItem->GetMacroEvents() == HyperDialogEvent::NONE )
+ return;
+
+ // get macros from itemset
+ const SvxMacroTableDtor* pMacroTbl = pHyperlinkItem->GetMacroTable();
+ SvxMacroItem aItem ( SID_ATTR_MACROITEM );
+ if( pMacroTbl )
+ aItem.SetMacroTable( *pMacroTbl );
+
+ // create empty itemset for macro-dlg
+ std::unique_ptr<SfxItemSet> pItemSet( new SfxItemSet(SfxGetpApp()->GetPool(),
+ svl::Items<SID_ATTR_MACROITEM,
+ SID_ATTR_MACROITEM>{} ) );
+ pItemSet->Put ( aItem );
+
+ DisableClose( true );
+
+ SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, *pItemSet);
+
+ // add events
+ SfxMacroTabPage *pMacroPage = aDlg.GetTabPage();
+
+ if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOverObject )
+ pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT1),
+ SvMacroItemId::OnMouseOver );
+ if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseClickObject )
+ pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT2),
+ SvMacroItemId::OnClick);
+ if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOutObject )
+ pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT3),
+ SvMacroItemId::OnMouseOut);
+ // execute dlg
+ short nRet = aDlg.run();
+ DisableClose( false );
+ if ( RET_OK == nRet )
{
- // get macros from itemset
- const SvxMacroTableDtor* pMacroTbl = pHyperlinkItem->GetMacroTable();
- SvxMacroItem aItem ( SID_ATTR_MACROITEM );
- if( pMacroTbl )
- aItem.SetMacroTable( *pMacroTbl );
-
- // create empty itemset for macro-dlg
- std::unique_ptr<SfxItemSet> pItemSet( new SfxItemSet(SfxGetpApp()->GetPool(),
- svl::Items<SID_ATTR_MACROITEM,
- SID_ATTR_MACROITEM>{} ) );
- pItemSet->Put ( aItem );
-
- DisableClose( true );
-
- SfxMacroAssignDlg aDlg(mpDialog->getDialog(), mxDocumentFrame, *pItemSet);
-
- // add events
- SfxMacroTabPage *pMacroPage = aDlg.GetTabPage();
-
- if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOverObject )
- pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT1),
- SvMacroItemId::OnMouseOver );
- if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseClickObject )
- pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT2),
- SvMacroItemId::OnClick);
- if ( pHyperlinkItem->GetMacroEvents() & HyperDialogEvent::MouseOutObject )
- pMacroPage->AddEvent( CuiResId(RID_SVXSTR_HYPDLG_MACROACT3),
- SvMacroItemId::OnMouseOut);
- // execute dlg
- short nRet = aDlg.run();
- DisableClose( false );
- if ( RET_OK == nRet )
+ const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
+ const SfxPoolItem* pItem;
+ if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem ))
{
- const SfxItemSet* pOutSet = aDlg.GetOutputItemSet();
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == pOutSet->GetItemState( SID_ATTR_MACROITEM, false, &pItem ))
- {
- pHyperlinkItem->SetMacroTable( static_cast<const SvxMacroItem*>(pItem)->GetMacroTable() );
- }
+ pHyperlinkItem->SetMacroTable( static_cast<const SvxMacroItem*>(pItem)->GetMacroTable() );
}
}
}
diff --git a/cui/source/dialogs/hyphen.cxx b/cui/source/dialogs/hyphen.cxx
index 48e7c4574ca1..f7b6549fc042 100644
--- a/cui/source/dialogs/hyphen.cxx
+++ b/cui/source/dialogs/hyphen.cxx
@@ -312,24 +312,24 @@ IMPL_LINK_NOARG(SvxHyphenWordDialog, CutHdl_Impl, weld::Button&, void)
IMPL_LINK_NOARG(SvxHyphenWordDialog, HyphenateAllHdl_Impl, weld::Button&, void)
{
- if( !m_bBusy )
+ if( m_bBusy )
+ return;
+
+ try
{
- try
- {
- uno::Reference< linguistic2::XLinguProperties > xProp( LinguMgr::GetLinguPropertySet() );
+ uno::Reference< linguistic2::XLinguProperties > xProp( LinguMgr::GetLinguPropertySet() );
- xProp->setIsHyphAuto( true );
+ xProp->setIsHyphAuto( true );
- m_bBusy = true;
- ContinueHyph_Impl( /*m_nHyphPos*/m_nOldPos );
- m_bBusy = false;
+ m_bBusy = true;
+ ContinueHyph_Impl( /*m_nHyphPos*/m_nOldPos );
+ m_bBusy = false;
- xProp->setIsHyphAuto( false );
- }
- catch (uno::Exception &)
- {
- SAL_WARN( "cui.dialogs", "Hyphenate All failed" );
- }
+ xProp->setIsHyphAuto( false );
+ }
+ catch (uno::Exception &)
+ {
+ SAL_WARN( "cui.dialogs", "Hyphenate All failed" );
}
}
diff --git a/cui/source/dialogs/iconcdlg.cxx b/cui/source/dialogs/iconcdlg.cxx
index fdeb3a36b780..bca5984f8817 100644
--- a/cui/source/dialogs/iconcdlg.cxx
+++ b/cui/source/dialogs/iconcdlg.cxx
@@ -157,55 +157,55 @@ void SvxHpLinkDlg::DeActivatePageImpl ()
DeactivateRC nRet = DeactivateRC::LeavePage;
- if ( pData )
- {
- IconChoicePage * pPage = pData->xPage.get();
+ if ( !pData )
+ return;
- if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
- pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
+ IconChoicePage * pPage = pData->xPage.get();
- if ( pSet )
- {
- SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
+ if ( !pExampleSet && pPage->HasExchangeSupport() && pSet )
+ pExampleSet = new SfxItemSet( *pSet->GetPool(), pSet->GetRanges() );
- if ( pPage->HasExchangeSupport() )
- nRet = pPage->DeactivatePage( &aTmp );
+ if ( pSet )
+ {
+ SfxItemSet aTmp( *pSet->GetPool(), pSet->GetRanges() );
- if ( ( DeactivateRC::LeavePage & nRet ) &&
- aTmp.Count() )
- {
- if (pExampleSet)
- pExampleSet->Put(aTmp);
- pOutSet->Put( aTmp );
- }
+ if ( pPage->HasExchangeSupport() )
+ nRet = pPage->DeactivatePage( &aTmp );
+
+ if ( ( DeactivateRC::LeavePage & nRet ) &&
+ aTmp.Count() )
+ {
+ if (pExampleSet)
+ pExampleSet->Put(aTmp);
+ pOutSet->Put( aTmp );
}
- else
+ }
+ else
+ {
+ if ( pPage->HasExchangeSupport() ) //!!!
{
- if ( pPage->HasExchangeSupport() ) //!!!
+ if ( !pExampleSet )
{
- if ( !pExampleSet )
- {
- SfxItemPool* pPool = pPage->GetItemSet().GetPool();
- pExampleSet =
- new SfxItemSet( *pPool, GetInputRanges( *pPool ) );
- }
- nRet = pPage->DeactivatePage( pExampleSet );
+ SfxItemPool* pPool = pPage->GetItemSet().GetPool();
+ pExampleSet =
+ new SfxItemSet( *pPool, GetInputRanges( *pPool ) );
}
- else
- nRet = pPage->DeactivatePage( nullptr );
+ nRet = pPage->DeactivatePage( pExampleSet );
}
+ else
+ nRet = pPage->DeactivatePage( nullptr );
+ }
- if ( nRet & DeactivateRC::RefreshSet )
+ if ( nRet & DeactivateRC::RefreshSet )
+ {
+ // TODO refresh input set
+ // flag all pages to be newly initialized
+ for (auto & pObj : maPageList)
{
- // TODO refresh input set
- // flag all pages to be newly initialized
- for (auto & pObj : maPageList)
- {
- if ( pObj->xPage.get() != pPage )
- pObj->bRefresh = true;
- else
- pObj->bRefresh = false;
- }
+ if ( pObj->xPage.get() != pPage )
+ pObj->bRefresh = true;
+ else
+ pObj->bRefresh = false;
}
}
}
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index bd6225ac89a1..764d29e0c191 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -252,39 +252,39 @@ IMPL_LINK_NOARG(SvBaseLinksDlg, UpdateNowClickHdl, weld::Button&, void)
aPosArr.push_back( nFndPos );
}
- if( !aLnkArr.empty() )
+ if( aLnkArr.empty() )
+ return;
+
+ for( size_t n = 0; n < aLnkArr.size(); ++n )
{
- for( size_t n = 0; n < aLnkArr.size(); ++n )
- {
- tools::SvRef<SvBaseLink> xLink = aLnkArr[ n ];
+ tools::SvRef<SvBaseLink> xLink = aLnkArr[ n ];
- // first look for the entry in the array
- for(const auto & i : pLinkMgr->GetLinks())
- if( xLink == i )
- {
- SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() );
- break;
- }
- }
+ // first look for the entry in the array
+ for(const auto & i : pLinkMgr->GetLinks())
+ if( xLink == i )
+ {
+ SetType( *xLink, aPosArr[ n ], xLink->GetUpdateMode() );
+ break;
+ }
+ }
- // if somebody is of the opinion to swap his links (SD)
- LinkManager* pNewMgr = pLinkMgr;
- pLinkMgr = nullptr;
- SetManager( pNewMgr );
+ // if somebody is of the opinion to swap his links (SD)
+ LinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = nullptr;
+ SetManager( pNewMgr );
- OUString sId = OUString::number(reinterpret_cast<sal_Int64>(aLnkArr[0]));
- int nE = m_xTbLinks->find_id(sId);
- if (nE == -1)
- nE = m_xTbLinks->get_selected_index();
- int nSelEntry = m_xTbLinks->get_selected_index();
- if (nE != nSelEntry)
- m_xTbLinks->unselect(nSelEntry);
- m_xTbLinks->select(nE);
- m_xTbLinks->scroll_to_row(nE);
+ OUString sId = OUString::number(reinterpret_cast<sal_Int64>(aLnkArr[0]));
+ int nE = m_xTbLinks->find_id(sId);
+ if (nE == -1)
+ nE = m_xTbLinks->get_selected_index();
+ int nSelEntry = m_xTbLinks->get_selected_index();
+ if (nE != nSelEntry)
+ m_xTbLinks->unselect(nSelEntry);
+ m_xTbLinks->select(nE);
+ m_xTbLinks->scroll_to_row(nE);
- pNewMgr->CloseCachedComps();
- }
+ pNewMgr->CloseCachedComps();
}
IMPL_LINK_NOARG(SvBaseLinksDlg, ChangeSourceClickHdl, weld::Button&, void)
@@ -421,22 +421,22 @@ IMPL_LINK_NOARG( SvBaseLinksDlg, BreakLinkClickHdl, weld::Button&, void )
// then remove all selected entries
}
}
- if(bModified)
+ if(!bModified)
+ return;
+
+ if (!m_xTbLinks->n_children())
{
- if (!m_xTbLinks->n_children())
- {
- m_xRbAutomatic->set_sensitive(false);
- m_xRbManual->set_sensitive(false);
- m_xPbUpdateNow->set_sensitive(false);
- m_xPbChangeSource->set_sensitive(false);
- m_xPbBreakLink->set_sensitive(false);
+ m_xRbAutomatic->set_sensitive(false);
+ m_xRbManual->set_sensitive(false);
+ m_xPbUpdateNow->set_sensitive(false);
+ m_xPbChangeSource->set_sensitive(false);
+ m_xPbBreakLink->set_sensitive(false);
- m_xFtFullSourceName->set_label( "" );
- m_xFtFullTypeName->set_label( "" );
- }
- if( pLinkMgr && pLinkMgr->GetPersist() )
- pLinkMgr->GetPersist()->SetModified();
+ m_xFtFullSourceName->set_label( "" );
+ m_xFtFullTypeName->set_label( "" );
}
+ if( pLinkMgr && pLinkMgr->GetPersist() )
+ pLinkMgr->GetPersist()->SetModified();
}
IMPL_LINK_NOARG( SvBaseLinksDlg, UpdateWaitingHdl, Timer*, void )
@@ -461,37 +461,37 @@ IMPL_LINK( SvBaseLinksDlg, EndEditHdl, sfx2::SvBaseLink&, _rLink, void )
int nPos;
GetSelEntry( &nPos );
- if( _rLink.WasLastEditOK() )
- {
- // StarImpress/Draw swap the LinkObjects themselves!
- // So search for the link in the manager; if it does not exist
- // anymore, fill the list completely new. Otherwise only the
- // edited link needs to be refreshed.
- bool bLinkFnd = false;
- for( size_t n = pLinkMgr->GetLinks().size(); n; )
- if( &_rLink == &(*pLinkMgr->GetLinks()[ --n ]) )
- {
- bLinkFnd = true;
- break;
- }
+ if( !_rLink.WasLastEditOK() )
+ return;
- if( bLinkFnd )
+ // StarImpress/Draw swap the LinkObjects themselves!
+ // So search for the link in the manager; if it does not exist
+ // anymore, fill the list completely new. Otherwise only the
+ // edited link needs to be refreshed.
+ bool bLinkFnd = false;
+ for( size_t n = pLinkMgr->GetLinks().size(); n; )
+ if( &_rLink == &(*pLinkMgr->GetLinks()[ --n ]) )
{
- m_xTbLinks->remove(nPos);
- int nToUnselect = m_xTbLinks->get_selected_index();
- InsertEntry(_rLink, nPos, true);
- if (nToUnselect != -1)
- m_xTbLinks->unselect(nToUnselect);
+ bLinkFnd = true;
+ break;
}
- else
- {
- LinkManager* pNewMgr = pLinkMgr;
- pLinkMgr = nullptr;
- SetManager( pNewMgr );
- }
- if (pLinkMgr && pLinkMgr->GetPersist())
- pLinkMgr->GetPersist()->SetModified();
+
+ if( bLinkFnd )
+ {
+ m_xTbLinks->remove(nPos);
+ int nToUnselect = m_xTbLinks->get_selected_index();
+ InsertEntry(_rLink, nPos, true);
+ if (nToUnselect != -1)
+ m_xTbLinks->unselect(nToUnselect);
}
+ else
+ {
+ LinkManager* pNewMgr = pLinkMgr;
+ pLinkMgr = nullptr;
+ SetManager( pNewMgr );
+ }
+ if (pLinkMgr && pLinkMgr->GetPersist())
+ pLinkMgr->GetPersist()->SetModified();
}
OUString SvBaseLinksDlg::ImplGetStateStr( const SvBaseLink& rLnk )
@@ -526,30 +526,30 @@ void SvBaseLinksDlg::SetManager( LinkManager* pNewMgr )
m_xTbLinks->clear();
pLinkMgr = pNewMgr;
- if( pLinkMgr )
+ if( !pLinkMgr )
+ return;
+
+ SvBaseLinks& rLnks = const_cast<SvBaseLinks&>(pLinkMgr->GetLinks());
+ for( size_t n = 0; n < rLnks.size(); ++n )
{
- SvBaseLinks& rLnks = const_cast<SvBaseLinks&>(pLinkMgr->GetLinks());
- for( size_t n = 0; n < rLnks.size(); ++n )
+ tools::SvRef<SvBaseLink>& rLinkRef = rLnks[ n ];
+ if( !rLinkRef.is() )
{
- tools::SvRef<SvBaseLink>& rLinkRef = rLnks[ n ];
- if( !rLinkRef.is() )
- {
- rLnks.erase( rLnks.begin() + n );
- --n;
- continue;
- }
- if( rLinkRef->IsVisible() )
- InsertEntry( *rLinkRef );
+ rLnks.erase( rLnks.begin() + n );
+ --n;
+ continue;
}
+ if( rLinkRef->IsVisible() )
+ InsertEntry( *rLinkRef );
+ }
- m_xTbLinks->thaw();
+ m_xTbLinks->thaw();
- if( !rLnks.empty() )
- {
- m_xTbLinks->set_cursor(0);
- m_xTbLinks->select(0);
- LinksSelectHdl( nullptr );
- }
+ if( !rLnks.empty() )
+ {
+ m_xTbLinks->set_cursor(0);
+ m_xTbLinks->select(0);
+ LinksSelectHdl( nullptr );
}
}
@@ -611,24 +611,24 @@ void SvBaseLinksDlg::SetType(SvBaseLink& rLink,
void SvBaseLinksDlg::SetActLink( SvBaseLink const * pLink )
{
- if( pLinkMgr )
+ if( !pLinkMgr )
+ return;
+
+ const SvBaseLinks& rLnks = pLinkMgr->GetLinks();
+ int nSelect = 0;
+ for(const auto & rLinkRef : rLnks)
{
- const SvBaseLinks& rLnks = pLinkMgr->GetLinks();
- int nSelect = 0;
- for(const auto & rLinkRef : rLnks)
+ // #109573# only visible links have been inserted into the TreeListBox,
+ // invisible ones have to be skipped here
+ if( rLinkRef->IsVisible() )
{
- // #109573# only visible links have been inserted into the TreeListBox,
- // invisible ones have to be skipped here
- if( rLinkRef->IsVisible() )
+ if( pLink == rLinkRef.get() )
{
- if( pLink == rLinkRef.get() )
- {
- m_xTbLinks->select(nSelect);
- LinksSelectHdl( nullptr );
- return ;
- }
- ++nSelect;
+ m_xTbLinks->select(nSelect);
+ LinksSelectHdl( nullptr );
+ return ;
}
+ ++nSelect;
}
}
}
diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx
index c81542b44840..48dc545f93ea 100644
--- a/cui/source/dialogs/multipat.cxx
+++ b/cui/source/dialogs/multipat.cxx
@@ -89,29 +89,29 @@ IMPL_LINK_NOARG(SvxMultiPathDialog, AddHdl_Impl, weld::Button&, void)
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
- if ( xFolderPicker->execute() == ExecutableDialogResults::OK )
- {
- INetURLObject aPath( xFolderPicker->getDirectory() );
- aPath.removeFinalSlash();
- OUString aURL = aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- OUString sInsPath;
- osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
+ if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
+ return;
- if (m_xRadioLB->find_text(sInsPath) != -1)
- {
- OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) );
- sMsg = sMsg.replaceFirst( "%1", sInsPath );
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
- VclMessageType::Info, VclButtonsType::Ok, sMsg));
- xInfoBox->run();
- }
- else
- {
- AppendEntry(sInsPath, aURL);
- }
+ INetURLObject aPath( xFolderPicker->getDirectory() );
+ aPath.removeFinalSlash();
+ OUString aURL = aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ OUString sInsPath;
+ osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
- SelectHdl_Impl(*m_xRadioLB);
+ if (m_xRadioLB->find_text(sInsPath) != -1)
+ {
+ OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) );
+ sMsg = sMsg.replaceFirst( "%1", sInsPath );
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
+ VclMessageType::Info, VclButtonsType::Ok, sMsg));
+ xInfoBox->run();
+ }
+ else
+ {
+ AppendEntry(sInsPath, aURL);
}
+
+ SelectHdl_Impl(*m_xRadioLB);
}
IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void)
@@ -119,29 +119,29 @@ IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void)
Reference < XComponentContext > xContext( ::comphelper::getProcessComponentContext() );
Reference < XFolderPicker2 > xFolderPicker = FolderPicker::create(xContext);
- if ( xFolderPicker->execute() == ExecutableDialogResults::OK )
- {
- INetURLObject aPath( xFolderPicker->getDirectory() );
- aPath.removeFinalSlash();
- OUString aURL = aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- OUString sInsPath;
- osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
+ if ( xFolderPicker->execute() != ExecutableDialogResults::OK )
+ return;
- if (m_xPathLB->find_text(sInsPath) != -1)
- {
- OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) );
- sMsg = sMsg.replaceFirst( "%1", sInsPath );
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
- VclMessageType::Info, VclButtonsType::Ok, sMsg));
- xInfoBox->run();
- }
- else
- {
- m_xPathLB->append(aURL, sInsPath);
- }
+ INetURLObject aPath( xFolderPicker->getDirectory() );
+ aPath.removeFinalSlash();
+ OUString aURL = aPath.GetMainURL( INetURLObject::DecodeMechanism::NONE );
+ OUString sInsPath;
+ osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath);
- SelectHdl_Impl(*m_xPathLB);
+ if (m_xPathLB->find_text(sInsPath) != -1)
+ {
+ OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) );
+ sMsg = sMsg.replaceFirst( "%1", sInsPath );
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(m_xDialog.get(),
+ VclMessageType::Info, VclButtonsType::Ok, sMsg));
+ xInfoBox->run();
+ }
+ else
+ {
+ m_xPathLB->append(aURL, sInsPath);
}
+
+ SelectHdl_Impl(*m_xPathLB);
}
IMPL_LINK_NOARG(SvxMultiPathDialog, DelHdl_Impl, weld::Button&, void)
diff --git a/cui/source/dialogs/screenshotannotationdlg.cxx b/cui/source/dialogs/screenshotannotationdlg.cxx
index c9a93d21d9c5..3731163a1f19 100644
--- a/cui/source/dialogs/screenshotannotationdlg.cxx
+++ b/cui/source/dialogs/screenshotannotationdlg.cxx
@@ -297,53 +297,53 @@ IMPL_LINK_NOARG(ScreenshotAnnotationDlg_Impl, saveButtonHandler, weld::Button&,
xFilePicker->setDefaultName(OStringToOUString(aDerivedFileName, RTL_TEXTENCODING_UTF8));
xFilePicker->setMultiSelectionMode(false);
- if (xFilePicker->execute() == ui::dialogs::ExecutableDialogResults::OK)
- {
- maLastFolderURL = xFilePicker->getDisplayDirectory();
- const uno::Sequence< OUString > files(xFilePicker->getSelectedFiles());
+ if (xFilePicker->execute() != ui::dialogs::ExecutableDialogResults::OK)
+ return;
- if (files.hasElements())
- {
- OUString aConfirmedName = files[0];
+ maLastFolderURL = xFilePicker->getDisplayDirectory();
+ const uno::Sequence< OUString > files(xFilePicker->getSelectedFiles());
- if (!aConfirmedName.isEmpty())
- {
- INetURLObject aConfirmedURL(aConfirmedName);
- OUString aCurrentExtension(aConfirmedURL.getExtension());
+ if (!files.hasElements())
+ return;
- if (!aCurrentExtension.isEmpty() && aCurrentExtension != "png")
- {
- aConfirmedURL.removeExtension();
- aCurrentExtension.clear();
- }
+ OUString aConfirmedName = files[0];
- if (aCurrentExtension.isEmpty())
- {
- aConfirmedURL.setExtension("png");
- }
+ if (aConfirmedName.isEmpty())
+ return;
- // open stream
- SvFileStream aNew(aConfirmedURL.PathToFileName(), StreamMode::WRITE | StreamMode::TRUNC);
+ INetURLObject aConfirmedURL(aConfirmedName);
+ OUString aCurrentExtension(aConfirmedURL.getExtension());
- if (aNew.IsOpen())
- {
- // prepare bitmap to save - do use the original screenshot here,
- // not the dimmed one
- RepaintToBuffer();
-
- // extract Bitmap
- const BitmapEx aTargetBitmap(
- mxVirtualBufferDevice->GetBitmapEx(
- Point(0, 0),
- mxVirtualBufferDevice->GetOutputSizePixel()));
-
- // write as PNG
- vcl::PNGWriter aPNGWriter(aTargetBitmap);
- aPNGWriter.Write(aNew);
- }
- }
- }
+ if (!aCurrentExtension.isEmpty() && aCurrentExtension != "png")
+ {
+ aConfirmedURL.removeExtension();
+ aCurrentExtension.clear();
+ }
+
+ if (aCurrentExtension.isEmpty())
+ {
+ aConfirmedURL.setExtension("png");
}
+
+ // open stream
+ SvFileStream aNew(aConfirmedURL.PathToFileName(), StreamMode::WRITE | StreamMode::TRUNC);
+
+ if (!aNew.IsOpen())
+ return;
+
+ // prepare bitmap to save - do use the original screenshot here,
+ // not the dimmed one
+ RepaintToBuffer();
+
+ // extract Bitmap
+ const BitmapEx aTargetBitmap(
+ mxVirtualBufferDevice->GetBitmapEx(
+ Point(0, 0),
+ mxVirtualBufferDevice->GetOutputSizePixel()));
+
+ // write as PNG
+ vcl::PNGWriter aPNGWriter(aTargetBitmap);
+ aPNGWriter.Write(aNew);
}
weld::ScreenShotEntry* ScreenshotAnnotationDlg_Impl::CheckHit(const basegfx::B2IPoint& rPosition)
@@ -378,42 +378,42 @@ void ScreenshotAnnotationDlg_Impl::PaintScreenShotEntry(
double fLineWidth,
double fTransparency)
{
- if (mxPicture && mxVirtualBufferDevice)
+ if (!(mxPicture && mxVirtualBufferDevice))
+ return;
+
+ basegfx::B2DRange aB2DRange(rEntry.getB2IRange());
+
+ // grow in pixels to be a little bit 'outside'. This also
+ // ensures that getWidth()/getHeight() ain't 0.0 (see division below)
+ static const double fGrowTopLeft(1.5);
+ static const double fGrowBottomRight(0.5);
+ aB2DRange.expand(aB2DRange.getMinimum() - basegfx::B2DPoint(fGrowTopLeft, fGrowTopLeft));
+ aB2DRange.expand(aB2DRange.getMaximum() + basegfx::B2DPoint(fGrowBottomRight, fGrowBottomRight));
+
+ // edge rounding in pixel. Need to convert, value for
+ // createPolygonFromRect is relative [0.0 .. 1.0]
+ static const double fEdgeRoundPixel(8.0);
+ const basegfx::B2DPolygon aPolygon(
+ basegfx::utils::createPolygonFromRect(
+ aB2DRange,
+ fEdgeRoundPixel / aB2DRange.getWidth(),
+ fEdgeRoundPixel / aB2DRange.getHeight()));
+
+ mxVirtualBufferDevice->SetLineColor(rColor);
+
+ // try to use transparency
+ if (!mxVirtualBufferDevice->DrawPolyLineDirect(
+ basegfx::B2DHomMatrix(),
+ aPolygon,
+ fLineWidth,
+ fTransparency,
+ nullptr, // MM01
+ basegfx::B2DLineJoin::Round))
{
- basegfx::B2DRange aB2DRange(rEntry.getB2IRange());
-
- // grow in pixels to be a little bit 'outside'. This also
- // ensures that getWidth()/getHeight() ain't 0.0 (see division below)
- static const double fGrowTopLeft(1.5);
- static const double fGrowBottomRight(0.5);
- aB2DRange.expand(aB2DRange.getMinimum() - basegfx::B2DPoint(fGrowTopLeft, fGrowTopLeft));
- aB2DRange.expand(aB2DRange.getMaximum() + basegfx::B2DPoint(fGrowBottomRight, fGrowBottomRight));
-
- // edge rounding in pixel. Need to convert, value for
- // createPolygonFromRect is relative [0.0 .. 1.0]
- static const double fEdgeRoundPixel(8.0);
- const basegfx::B2DPolygon aPolygon(
- basegfx::utils::createPolygonFromRect(
- aB2DRange,
- fEdgeRoundPixel / aB2DRange.getWidth(),
- fEdgeRoundPixel / aB2DRange.getHeight()));
-
- mxVirtualBufferDevice->SetLineColor(rColor);
-
- // try to use transparency
- if (!mxVirtualBufferDevice->DrawPolyLineDirect(
- basegfx::B2DHomMatrix(),
+ // no transparency, draw without
+ mxVirtualBufferDevice->DrawPolyLine(
aPolygon,
- fLineWidth,
- fTransparency,
- nullptr, // MM01
- basegfx::B2DLineJoin::Round))
- {
- // no transparency, draw without
- mxVirtualBufferDevice->DrawPolyLine(
- aPolygon,
- fLineWidth);
- }
+ fLineWidth);
}
}
@@ -430,43 +430,43 @@ void ScreenshotAnnotationDlg_Impl::RepaintToBuffer(
bool bUseDimmed,
bool bPaintHilight)
{
- if (mxVirtualBufferDevice)
+ if (!mxVirtualBufferDevice)
+ return;
+
+ // reset with original screenshot bitmap
+ mxVirtualBufferDevice->DrawBitmapEx(
+ Point(0, 0),
+ bUseDimmed ? maDimmedDialogBitmap : maParentDialogBitmap);
+
+ // get various options
+ const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
+ const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
+ const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
+ const bool bIsAntiAliasing(aSvtOptionsDrawinglayer.IsAntiAliasing());
+ const AntialiasingFlags nOldAA(mxVirtualBufferDevice->GetAntialiasing());
+
+ if (bIsAntiAliasing)
{
- // reset with original screenshot bitmap
- mxVirtualBufferDevice->DrawBitmapEx(
- Point(0, 0),
- bUseDimmed ? maDimmedDialogBitmap : maParentDialogBitmap);
-
- // get various options
- const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
- const Color aHilightColor(aSvtOptionsDrawinglayer.getHilightColor());
- const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
- const bool bIsAntiAliasing(aSvtOptionsDrawinglayer.IsAntiAliasing());
- const AntialiasingFlags nOldAA(mxVirtualBufferDevice->GetAntialiasing());
-
- if (bIsAntiAliasing)
- {
- mxVirtualBufferDevice->SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
- }
+ mxVirtualBufferDevice->SetAntialiasing(AntialiasingFlags::EnableB2dDraw);
+ }
- // paint selected entries
- for (auto&& rCandidate : maSelected)
- {
- static const double fLineWidthEntries(5.0);
- PaintScreenShotEntry(*rCandidate, COL_LIGHTRED, fLineWidthEntries, fTransparence * 0.2);
- }
+ // paint selected entries
+ for (auto&& rCandidate : maSelected)
+ {
+ static const double fLineWidthEntries(5.0);
+ PaintScreenShotEntry(*rCandidate, COL_LIGHTRED, fLineWidthEntries, fTransparence * 0.2);
+ }
- // paint highlighted entry
- if (mpHilighted && bPaintHilight)
- {
- static const double fLineWidthHilight(7.0);
- PaintScreenShotEntry(*mpHilighted, aHilightColor, fLineWidthHilight, fTransparence);
- }
+ // paint highlighted entry
+ if (mpHilighted && bPaintHilight)
+ {
+ static const double fLineWidthHilight(7.0);
+ PaintScreenShotEntry(*mpHilighted, aHilightColor, fLineWidthHilight, fTransparence);
+ }
- if (bIsAntiAliasing)
- {
- mxVirtualBufferDevice->SetAntialiasing(nOldAA);
- }
+ if (bIsAntiAliasing)
+ {
+ mxVirtualBufferDevice->SetAntialiasing(nOldAA);
}
}
diff --git a/cui/source/dialogs/scriptdlg.cxx b/cui/source/dialogs/scriptdlg.cxx
index 80bab2715ca4..1716316fb32f 100644
--- a/cui/source/dialogs/scriptdlg.cxx
+++ b/cui/source/dialogs/scriptdlg.cxx
@@ -553,133 +553,133 @@ IMPL_LINK(SvxScriptOrgDialog, ButtonHdl, weld::Button&, rButton, void)
StoreCurrentSelection();
m_xDialog->response(RET_CANCEL);
}
- if (&rButton == m_xEditButton.get() ||
+ if (!(&rButton == m_xEditButton.get() ||
&rButton == m_xCreateButton.get() ||
&rButton == m_xDelButton.get() ||
&rButton == m_xRunButton.get() ||
- &rButton == m_xRenameButton.get())
+ &rButton == m_xRenameButton.get()))
- {
- std::unique_ptr<weld::TreeIter> xIter = m_xScriptsBox->make_iterator();
- if (!m_xScriptsBox->get_selected(xIter.get()))
- return;
- SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xIter).toInt64());
- if (!userData)
- return;
+ return;
- Reference< browse::XBrowseNode > node;
- Reference< XModel > xModel;
+ std::unique_ptr<weld::TreeIter> xIter = m_xScriptsBox->make_iterator();
+ if (!m_xScriptsBox->get_selected(xIter.get()))
+ return;
+ SFEntry* userData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xIter).toInt64());
+ if (!userData)
+ return;
- node = userData->GetNode();
- xModel = userData->GetModel();
+ Reference< browse::XBrowseNode > node;
+ Reference< XModel > xModel;
+
+ node = userData->GetNode();
+ xModel = userData->GetModel();
+
+ if ( !node.is() )
+ {
+ return;
+ }
- if ( !node.is() )
+ if (&rButton == m_xRunButton.get())
+ {
+ OUString tmpString;
+ Reference< beans::XPropertySet > xProp( node, UNO_QUERY );
+ Reference< provider::XScriptProvider > mspNode;
+ if( !xProp.is() )
{
return;
}
- if (&rButton == m_xRunButton.get())
+ if ( xModel.is() )
{
- OUString tmpString;
- Reference< beans::XPropertySet > xProp( node, UNO_QUERY );
- Reference< provider::XScriptProvider > mspNode;
- if( !xProp.is() )
+ Reference< XEmbeddedScripts > xEmbeddedScripts( xModel, UNO_QUERY);
+ if( !xEmbeddedScripts.is() )
{
return;
}
- if ( xModel.is() )
+ if (!xEmbeddedScripts->getAllowMacroExecution())
{
- Reference< XEmbeddedScripts > xEmbeddedScripts( xModel, UNO_QUERY);
- if( !xEmbeddedScripts.is() )
- {
- return;
- }
-
- if (!xEmbeddedScripts->getAllowMacroExecution())
- {
- // Please FIXME: Show a message box if AllowMacroExecution is false
- return;
- }
+ // Please FIXME: Show a message box if AllowMacroExecution is false
+ return;
}
+ }
- std::unique_ptr<weld::TreeIter> xParentIter = m_xScriptsBox->make_iterator(xIter.get());
- bool bParent = m_xScriptsBox->iter_parent(*xParentIter);
- while (bParent && !mspNode.is() )
- {
- SFEntry* mspUserData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xParentIter).toInt64());
- mspNode.set( mspUserData->GetNode() , UNO_QUERY );
- bParent = m_xScriptsBox->iter_parent(*xParentIter);
- }
- xProp->getPropertyValue("URI") >>= tmpString;
- const OUString scriptURL( tmpString );
+ std::unique_ptr<weld::TreeIter> xParentIter = m_xScriptsBox->make_iterator(xIter.get());
+ bool bParent = m_xScriptsBox->iter_parent(*xParentIter);
+ while (bParent && !mspNode.is() )
+ {
+ SFEntry* mspUserData = reinterpret_cast<SFEntry*>(m_xScriptsBox->get_id(*xParentIter).toInt64());
+ mspNode.set( mspUserData->GetNode() , UNO_QUERY );
+ bParent = m_xScriptsBox->iter_parent(*xParentIter);
+ }
+ xProp->getPropertyValue("URI") >>= tmpString;
+ const OUString scriptURL( tmpString );
- if ( mspNode.is() )
+ if ( mspNode.is() )
+ {
+ try
{
- try
- {
- Reference< provider::XScript > xScript(
- mspNode->getScript( scriptURL ), UNO_SET_THROW );
+ Reference< provider::XScript > xScript(
+ mspNode->getScript( scriptURL ), UNO_SET_THROW );
- const Sequence< Any > args(0);
- Sequence< sal_Int16 > outIndex;
- Sequence< Any > outArgs( 0 );
- xScript->invoke( args, outIndex, outArgs );
- }
- catch ( reflection::InvocationTargetException& ite )
- {
- ShowErrorDialog(css::uno::Any(ite));
- }
- catch ( provider::ScriptFrameworkErrorException& ite )
- {
- ShowErrorDialog(css::uno::Any(ite));
- }
- catch ( RuntimeException& re )
- {
- ShowErrorDialog(css::uno::Any(re));
- }
- catch ( Exception& e )
- {
- ShowErrorDialog(css::uno::Any(e));
- }
+ const Sequence< Any > args(0);
+ Sequence< sal_Int16 > outIndex;
+ Sequence< Any > outArgs( 0 );
+ xScript->invoke( args, outIndex, outArgs );
}
- StoreCurrentSelection();
- m_xDialog->response(RET_CANCEL);
- }
- else if ( &rButton == m_xEditButton.get() )
- {
- Reference< script::XInvocation > xInv( node, UNO_QUERY );
- if ( xInv.is() )
+ catch ( reflection::InvocationTargetException& ite )
{
- StoreCurrentSelection();
- m_xDialog->response(RET_CANCEL);
- Sequence< Any > args(0);
- Sequence< Any > outArgs( 0 );
- Sequence< sal_Int16 > outIndex;
- try
- {
- // ISSUE need code to run script here
- xInv->invoke( "Editable", args, outIndex, outArgs );
- }
- catch( Exception const & )
- {
- TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to invoke" );
- }
+ ShowErrorDialog(css::uno::Any(ite));
+ }
+ catch ( provider::ScriptFrameworkErrorException& ite )
+ {
+ ShowErrorDialog(css::uno::Any(ite));
+ }
+ catch ( RuntimeException& re )
+ {
+ ShowErrorDialog(css::uno::Any(re));
+ }
+ catch ( Exception& e )
+ {
+ ShowErrorDialog(css::uno::Any(e));
}
}
- else if ( &rButton == m_xCreateButton.get() )
- {
- createEntry(*xIter);
- }
- else if ( &rButton == m_xDelButton.get() )
- {
- deleteEntry(*xIter);
- }
- else if ( &rButton == m_xRenameButton.get() )
+ StoreCurrentSelection();
+ m_xDialog->response(RET_CANCEL);
+ }
+ else if ( &rButton == m_xEditButton.get() )
+ {
+ Reference< script::XInvocation > xInv( node, UNO_QUERY );
+ if ( xInv.is() )
{
- renameEntry(*xIter);
+ StoreCurrentSelection();
+ m_xDialog->response(RET_CANCEL);
+ Sequence< Any > args(0);
+ Sequence< Any > outArgs( 0 );
+ Sequence< sal_Int16 > outIndex;
+ try
+ {
+ // ISSUE need code to run script here
+ xInv->invoke( "Editable", args, outIndex, outArgs );
+ }
+ catch( Exception const & )
+ {
+ TOOLS_WARN_EXCEPTION("cui.dialogs", "Caught exception trying to invoke" );
+ }
}
}
+ else if ( &rButton == m_xCreateButton.get() )
+ {
+ createEntry(*xIter);
+ }
+ else if ( &rButton == m_xDelButton.get() )
+ {
+ deleteEntry(*xIter);
+ }
+ else if ( &rButton == m_xRenameButton.get() )
+ {
+ renameEntry(*xIter);
+ }
}
Reference< browse::XBrowseNode > SvxScriptOrgDialog::getBrowseNode(const weld::TreeIter& rEntry)
diff --git a/cui/source/options/dbregister.cxx b/cui/source/options/dbregister.cxx
index 24df2e4930c6..98fd6d19fe15 100644
--- a/cui/source/options/dbregister.cxx
+++ b/cui/source/options/dbregister.cxx
@@ -271,20 +271,20 @@ void DbRegistrationOptionsPage::openLinkDialog(const OUString& sOldName, const O
aDlg.setLink(sOldName, sOldLocation);
aDlg.setNameValidator(LINK( this, DbRegistrationOptionsPage, NameValidator ) );
- if (aDlg.run() == RET_OK)
+ if (aDlg.run() != RET_OK)
+ return;
+
+ OUString sNewName,sNewLocation;
+ aDlg.getLink(sNewName,sNewLocation);
+ if ( nEntry == -1 || sNewName != sOldName || sNewLocation != sOldLocation )
{
- OUString sNewName,sNewLocation;
- aDlg.getLink(sNewName,sNewLocation);
- if ( nEntry == -1 || sNewName != sOldName || sNewLocation != sOldLocation )
+ if (nEntry != -1)
{
- if (nEntry != -1)
- {
- delete reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(nEntry).toInt64());
- m_xPathBox->remove(nEntry);
- }
- insertNewEntry( sNewName, sNewLocation, false );
- m_bModified = true;
+ delete reinterpret_cast<DatabaseRegistration*>(m_xPathBox->get_id(nEntry).toInt64());
+ m_xPathBox->remove(nEntry);
}
+ insertNewEntry( sNewName, sNewLocation, false );
+ m_bModified = true;
}
}
diff --git a/cui/source/options/optaboutconfig.cxx b/cui/source/options/optaboutconfig.cxx
index bb1b4fbc196b..f5afdca178dd 100644
--- a/cui/source/options/optaboutconfig.cxx
+++ b/cui/source/options/optaboutconfig.cxx
@@ -570,218 +570,218 @@ IMPL_LINK_NOARG( CuiAboutConfigTabPage, StandardHdl_Impl, weld::Button&, void )
return;
UserData *pUserData = reinterpret_cast<UserData*>(m_xPrefBox->get_id(*m_xScratchIter).toInt64());
- if (pUserData && pUserData->bIsPropertyPath)
- {
- //if selection is a node
- OUString sPropertyName = m_xPrefBox->get_text(*m_xScratchIter, 1);
- OUString sPropertyType = m_xPrefBox->get_text(*m_xScratchIter, 2);
- OUString sPropertyValue = m_xPrefBox->get_text(*m_xScratchIter, 3);
+ if (!(pUserData && pUserData->bIsPropertyPath))
+ return;
- auto pProperty = std::make_shared<Prop_Impl>( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) );
- bool bSaveChanges = false;
+ //if selection is a node
+ OUString sPropertyName = m_xPrefBox->get_text(*m_xScratchIter, 1);
+ OUString sPropertyType = m_xPrefBox->get_text(*m_xScratchIter, 2);
+ OUString sPropertyValue = m_xPrefBox->get_text(*m_xScratchIter, 3);
- bool bOpenDialog = true;
- OUString sDialogValue;
- OUString sNewValue;
+ auto pProperty = std::make_shared<Prop_Impl>( pUserData->sPropertyPath, sPropertyName, Any( sPropertyValue ) );
+ bool bSaveChanges = false;
- if( sPropertyType == "boolean" )
- {
- bool bValue;
- if( sPropertyValue == "true" )
- {
- sDialogValue = "false";
- bValue = false;
- }
- else
- {
- sDialogValue = "true";
- bValue = true;
- }
+ bool bOpenDialog = true;
+ OUString sDialogValue;
+ OUString sNewValue;
- pProperty->Value <<= bValue;
- bOpenDialog = false;
- bSaveChanges = true;
- }
- else if ( sPropertyType == "void" )
+ if( sPropertyType == "boolean" )
+ {
+ bool bValue;
+ if( sPropertyValue == "true" )
{
- bOpenDialog = false;
+ sDialogValue = "false";
+ bValue = false;
}
else
{
- sDialogValue = sPropertyValue;
- bOpenDialog = true;
+ sDialogValue = "true";
+ bValue = true;
}
- try
+ pProperty->Value <<= bValue;
+ bOpenDialog = false;
+ bSaveChanges = true;
+ }
+ else if ( sPropertyType == "void" )
+ {
+ bOpenDialog = false;
+ }
+ else
+ {
+ sDialogValue = sPropertyValue;
+ bOpenDialog = true;
+ }
+
+ try
+ {
+ if( bOpenDialog )
{
- if( bOpenDialog )
+ //Cosmetic length limit for integer values.
+ int limit=0;
+ if( sPropertyType == "short" )
+ limit = SHORT_LEN_LIMIT;
+ else if( sPropertyType == "long" )
+ limit = LONG_LEN_LIMIT;
+ else if( sPropertyType == "hyper" )
+ limit = HYPER_LEN_LIMIT;
+
+ CuiAboutConfigValueDialog aValueDialog(m_xDialog.get(), sDialogValue, limit);
+
+ if (aValueDialog.run() == RET_OK )
{
- //Cosmetic length limit for integer values.
- int limit=0;
- if( sPropertyType == "short" )
- limit = SHORT_LEN_LIMIT;
+ sNewValue = aValueDialog.getValue();
+ bSaveChanges = true;
+ if ( sPropertyType == "short")
+ {
+ sal_Int16 nShort;
+ sal_Int32 nNumb = sNewValue.toInt32();
+
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list