summaryrefslogtreecommitdiff
path: root/cui/source/dialogs/hldocntp.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/dialogs/hldocntp.cxx')
-rw-r--r--cui/source/dialogs/hldocntp.cxx134
1 files changed, 67 insertions, 67 deletions
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: */