diff options
Diffstat (limited to 'sw')
26 files changed, 369 insertions, 167 deletions
diff --git a/sw/qa/tiledrendering/tiledrendering.cxx b/sw/qa/tiledrendering/tiledrendering.cxx new file mode 100644 index 000000000000..f3c245db2d0e --- /dev/null +++ b/sw/qa/tiledrendering/tiledrendering.cxx @@ -0,0 +1,202 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include <comphelper/processfactory.hxx> +#include <cppuhelper/bootstrap.hxx> +#include <osl/file.hxx> +#include <vcl/builder.hxx> +#include <vcl/dialog.hxx> +#include <vcl/help.hxx> +#include <vcl/svapp.hxx> +#include <vcl/vclmain.hxx> +#include <vcl/field.hxx> +#include <vcl/button.hxx> +#include <vcl/fixed.hxx> +#include <vcl/virdev.hxx> +#include <sfx2/filedlghelper.hxx> +#include <swmodule.hxx> +#include <wrtsh.hxx> + +#include <com/sun/star/lang/XComponent.hpp> +#include <com/sun/star/lang/XMultiComponentFactory.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/ucb/UniversalContentBroker.hpp> +#include <com/sun/star/ui/dialogs/TemplateDescription.hpp> +#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/frame/XComponentLoader.hpp> +#include <com/sun/star/frame/Desktop.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; +using namespace ::com::sun::star::ui::dialogs; +using namespace ::sfx2; + +class TiledRenderingApp : public Application +{ +private: + uno::Reference<uno::XComponentContext> xContext; + uno::Reference<lang::XMultiComponentFactory> xFactory; + uno::Reference<lang::XMultiServiceFactory> xSFactory; + uno::Reference<uno::XInterface> xDesktop; + uno::Reference<frame::XComponentLoader> xLoader; + uno::Reference<lang::XComponent> xComponent; +public: + virtual void Init() SAL_OVERRIDE; + virtual int Main() SAL_OVERRIDE; + void Open(OUString & aFileUrl); +}; + +class TiledRenderingDialog: public ModalDialog +{ +private: + TiledRenderingApp *mpApp; + NumericField *mpContextWidth; + NumericField *mpContextHeight; + NumericField *mpTilePosX; + NumericField *mpTilePosY; + NumericField *mpTileWidth; + NumericField *mpTileHeight; + FixedImage *mpImage; + +public: + TiledRenderingDialog(TiledRenderingApp * app) : + ModalDialog(DIALOG_NO_PARENT, "TiledRendering", "qa/sw/ui/tiledrendering.ui"), + mpApp(app) + { + PushButton * renderButton; + get(renderButton, "buttonRenderTile"); + renderButton->SetClickHdl( LINK( this, TiledRenderingDialog, RenderHdl)); + + PushButton * chooseDocumentButton; + get(chooseDocumentButton, "buttonChooseDocument"); + chooseDocumentButton->SetClickHdl( LINK( this, TiledRenderingDialog, ChooseDocumentHdl)); + + SetStyle(GetStyle()|WB_CLOSEABLE); + + get(mpContextWidth, "spinContextWidth"); + get(mpContextHeight, "spinContextHeight"); + get(mpTilePosX, "spinTilePosX"); + get(mpTilePosY, "spinTilePosY"); + get(mpTileWidth, "spinTileWidth"); + get(mpTileHeight, "spinTileHeight"); + get(mpImage, "imageTile"); + } + + virtual ~TiledRenderingDialog() + { + } + + DECL_LINK ( RenderHdl, Button * ); + DECL_LINK ( ChooseDocumentHdl, Button * ); +}; + +IMPL_LINK ( TiledRenderingDialog, RenderHdl, Button *, EMPTYARG ) +{ + int contextWidth = mpContextWidth->GetValue(); + int contextHeight = mpContextHeight->GetValue(); + int tilePosX = mpTilePosX->GetValue(); + int tilePosY = mpTilePosY->GetValue(); + long tileWidth = mpTileWidth->GetValue(); + long tileHeight = mpTileHeight->GetValue(); + + // do the same thing we are doing in touch_lo_draw_tile() + SwWrtShell *pViewShell = GetActiveWrtShell(); + + if (pViewShell) + { + // TODO create a VirtualDevice based on SystemGraphicsData instead so + // that we get direct rendering; something like: + // + // SystemGraphicsData aData; + // [setup the aData] + // VirtualDevice aDevice(&aData, [color depth]); + VirtualDevice aDevice; + + // paint to it + pViewShell->PaintTile(aDevice, contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight); + + // copy the aDevice content to mpImage + Bitmap aBitmap(aDevice.GetBitmap(aDevice.PixelToLogic(Point(0,0)), aDevice.PixelToLogic(Size(contextWidth, contextHeight)))); + mpImage->SetImage(Image(aBitmap)); + + // update the dialog size + setOptimalLayoutSize(); + } + + return 1; +} + +IMPL_LINK ( TiledRenderingDialog, ChooseDocumentHdl, Button *, EMPTYARG ) +{ + FileDialogHelper aDlgHelper( TemplateDescription::FILEOPEN_SIMPLE, 0 ); + uno::Reference < XFilePicker > xFP = aDlgHelper.GetFilePicker(); + if( aDlgHelper.Execute() == ERRCODE_NONE ) + { + OUString aFileUrl =xFP->getFiles().getConstArray()[0]; + mpApp->Open(aFileUrl); + } + return 1; +} + +void TiledRenderingApp::Open(OUString & aFileUrl) +{ + static const char TARGET[] = "_default"; + static const Sequence<beans::PropertyValue> PROPS (0); + if(xComponent.get()) + { + xComponent->dispose(); + xComponent.clear(); + } + xComponent.set(xLoader->loadComponentFromURL(aFileUrl, TARGET, 0, PROPS)); +} + +void TiledRenderingApp::Init() +{ + xContext.set(cppu::defaultBootstrap_InitialComponentContext()); + xFactory.set(xContext->getServiceManager()); + xSFactory.set(uno::Reference<lang::XMultiServiceFactory> (xFactory, uno::UNO_QUERY_THROW)); + comphelper::setProcessServiceFactory(xSFactory); + + // Create UCB (for backwards compatibility, in case some code still uses + // plain createInstance w/o args directly to obtain an instance): + ::ucb::UniversalContentBroker::create(comphelper::getProcessComponentContext() ); + + xDesktop.set(xFactory->createInstanceWithContext(OUString("com.sun.star.frame.Desktop"), xContext)); + xLoader.set(frame::Desktop::create(xContext)); +} + +int TiledRenderingApp::Main() +{ + if(GetCommandLineParamCount()>0) + { + OUString aFileUrl; + osl::File::getFileURLFromSystemPath(GetCommandLineParam(0), aFileUrl); + Open(aFileUrl); + } + Help::EnableQuickHelp(); + try + { + VclPtr<TiledRenderingDialog> pDialog(new TiledRenderingDialog(this)); + pDialog->Execute(); + } + catch (const uno::Exception &e) + { + fprintf(stderr, "fatal error: %s\n", OUStringToOString(e.Message, osl_getThreadTextEncoding()).getStr()); + } + return EXIT_SUCCESS; +} + +void vclmain::createApplication() +{ + static TiledRenderingApp aApp; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index ba5ddad31282..b5c28bad182a 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -2665,8 +2665,8 @@ void DocumentRedlineManager::checkRedlining(RedlineMode_t& _rReadlineMode) if ( pParent && !mbReadlineChecked && rRedlineTbl.size() > MAX_REDLINE_COUNT && !((_rReadlineMode & nsRedlineMode_t::REDLINE_SHOW_DELETE) == nsRedlineMode_t::REDLINE_SHOW_DELETE) ) { - MessageDialog aQuery(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui"); - sal_uInt16 nResult = aQuery.Execute(); + VclPtr<MessageDialog> aQuery(new MessageDialog(pParent, "QueryShowChangesDialog", "modules/swriter/ui/queryshowchangesdialog.ui")); + sal_uInt16 nResult = aQuery->Execute(); mbReadlineChecked = true; if ( nResult == RET_YES ) { diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 7a70e375a4c7..4b006c0a1381 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -204,8 +204,8 @@ IMPL_LINK(SwMailConfigPage, ReplyToHdl, CheckBox*, pBox) IMPL_LINK_NOARG(SwMailConfigPage, AuthenticationHdl) { - SwAuthenticationSettingsDialog aDlg(this, *m_pConfigItem); - aDlg.Execute(); + VclPtr<SwAuthenticationSettingsDialog> aDlg(new SwAuthenticationSettingsDialog(this, *m_pConfigItem)); + aDlg->Execute(); return 0; } diff --git a/sw/source/ui/config/optcomp.cxx b/sw/source/ui/config/optcomp.cxx index a826fd02cb6d..a0deaa471e9a 100644 --- a/sw/source/ui/config/optcomp.cxx +++ b/sw/source/ui/config/optcomp.cxx @@ -315,9 +315,9 @@ IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl) IMPL_LINK_NOARG(SwCompatibilityOptPage, UseAsDefaultHdl) { - MessageDialog aQuery(this, "QueryDefaultCompatDialog", - "modules/swriter/ui/querydefaultcompatdialog.ui"); - if (aQuery.Execute() == RET_YES) + VclPtr<MessageDialog> aQuery(new MessageDialog(this, "QueryDefaultCompatDialog", + "modules/swriter/ui/querydefaultcompatdialog.ui")); + if (aQuery->Execute() == RET_YES) { for ( vector< CompatibilityItem >::iterator pItem = m_pImpl->m_aList.begin(); pItem != m_pImpl->m_aList.end(); ++pItem ) diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index a08e1033a36d..c75a8d6afce6 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -695,12 +695,12 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) } SwView* pSourceView = rConfigItem.GetSourceView(); - PrintMonitor aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE); - aSaveMonitor.m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22)); - aSaveMonitor.SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl)); - aSaveMonitor.m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) ); + VclPtr<PrintMonitor> aSaveMonitor(this, false, PrintMonitor::MONITOR_TYPE_SAVE); + aSaveMonitor->m_pDocName->SetText(pSourceView->GetDocShell()->GetTitle(22)); + aSaveMonitor->SetCancelHdl(LINK(this, SwMailMergeOutputPage, SaveCancelHdl_Impl)); + aSaveMonitor->m_pPrinter->SetText( INetURLObject( sPath ).getFSysPath( INetURLObject::FSYS_DETECT ) ); m_bCancelSaving = false; - aSaveMonitor.Show(); + aSaveMonitor->Show(); m_pWizard->enableButtons(WZB_CANCEL, false); for(sal_uInt32 nDoc = nBegin; nDoc < nEnd && !m_bCancelSaving; ++nDoc) @@ -713,7 +713,7 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) sPath += "." + sExtension; } OUString sStat = OUString(SW_RES(STR_STATSTR_LETTER)) + " " + OUString::number( nDoc ); - aSaveMonitor.m_pPrintInfo->SetText(sStat); + aSaveMonitor->m_pPrintInfo->SetText(sStat); //now extract a document from the target document // the shell will be closed at the end, but it is more safe to use SfxObjectShellLock here @@ -761,9 +761,9 @@ IMPL_LINK(SwMailMergeOutputPage, SaveOutputHdl_Impl, PushButton*, pButton) if(bFailed) { - SwSaveWarningBox_Impl aWarning( pButton, sOutPath ); - if(RET_OK == aWarning.Execute()) - sOutPath = aWarning.GetFileName(); + VclPtr<SwSaveWarningBox_Impl> aWarning(new SwSaveWarningBox_Impl( pButton, sOutPath )); + if(RET_OK == aWarning->Execute()) + sOutPath = aWarning->GetFileName(); else { xTempDocShell->DoClose(); @@ -945,8 +945,8 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(rConfigItem.GetMailServer().isEmpty() || !SwMailMergeHelper::CheckMailAddress(rConfigItem.GetMailAddress()) ) { - QueryBox aQuery(pButton, WB_YES_NO_CANCEL, m_sConfigureMail); - sal_uInt16 nRet = aQuery.Execute(); + VclPtr<QueryBox> aQuery(new QueryBox(pButton, WB_YES_NO_CANCEL, m_sConfigureMail)); + sal_uInt16 nRet = aQuery->Execute(); if(RET_YES == nRet ) { SfxAllItemSet aSet(pTargetView->GetPool()); @@ -1039,26 +1039,26 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) if(m_pSubjectED->GetText().isEmpty()) { - SwSendQueryBox_Impl aQuery(pButton, "SubjectDialog", - "modules/swriter/ui/subjectdialog.ui"); - aQuery.SetIsEmptyTextAllowed(true); - aQuery.SetValue(m_sNoSubjectST); - if(RET_OK == aQuery.Execute()) + VclPtr<SwSendQueryBox_Impl> aQuery(new SwSendQueryBox_Impl(pButton, "SubjectDialog", + "modules/swriter/ui/subjectdialog.ui")); + aQuery->SetIsEmptyTextAllowed(true); + aQuery->SetValue(m_sNoSubjectST); + if(RET_OK == aQuery->Execute()) { - if(aQuery.GetValue() != m_sNoSubjectST) - m_pSubjectED->SetText(aQuery.GetValue()); + if(aQuery->GetValue() != m_sNoSubjectST) + m_pSubjectED->SetText(aQuery->GetValue()); } else return 0; } if(!bAsBody && m_pAttachmentED->GetText().isEmpty()) { - SwSendQueryBox_Impl aQuery(pButton, "AttachNameDialog", - "modules/swriter/ui/attachnamedialog.ui"); - aQuery.SetIsEmptyTextAllowed(false); - if(RET_OK == aQuery.Execute()) + VclPtr<SwSendQueryBox_Impl> aQuery(new SwSendQueryBox_Impl(pButton, "AttachNameDialog", + "modules/swriter/ui/attachnamedialog.ui")); + aQuery->SetIsEmptyTextAllowed(false); + if(RET_OK == aQuery->Execute()) { - OUString sAttach(aQuery.GetValue()); + OUString sAttach(aQuery->GetValue()); sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if (2 > nTokenCount) { diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index 68ece3831ec5..8d16c7aae2df 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -404,11 +404,11 @@ bool SwEditRegionDlg::CheckPasswd(CheckBox* pBox) if (!pRepr->GetTempPasswd().getLength() && pRepr->GetSectionData().GetPassword().getLength()) { - SfxPasswordDialog aPasswdDlg(this); + VclPtr<SfxPasswordDialog> aPasswdDlg(new SfxPasswordDialog(this)); bRet = false; - if (aPasswdDlg.Execute()) + if (aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); ::com::sun::star::uno::Sequence <sal_Int8 > aNewPasswd; SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if (SvPasswordHelper::CompareHashPassword( @@ -1059,10 +1059,10 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl) aSet.Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth)); aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth))); - SwSectionPropertyTabDialog aTabDlg(this, aSet, rSh); - if(RET_OK == aTabDlg.Execute()) + VclPtr<SwSectionPropertyTabDialog> aTabDlg(new SwSectionPropertyTabDialog(this, aSet, rSh)); + if(RET_OK == aTabDlg->Execute()) { - const SfxItemSet* pOutSet = aTabDlg.GetOutputItemSet(); + const SfxItemSet* pOutSet = aTabDlg->GetOutputItemSet(); if( pOutSet && pOutSet->Count() ) { const SfxPoolItem *pColItem, *pBrushItem, @@ -1238,12 +1238,12 @@ IMPL_LINK( SwEditRegionDlg, ChangePasswdHdl, Button *, pBox ) { if(!pRepr->GetTempPasswd().getLength() || bChange) { - SfxPasswordDialog aPasswdDlg(this); - aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); - if(RET_OK == aPasswdDlg.Execute()) + VclPtr<SfxPasswordDialog> aPasswdDlg(new SfxPasswordDialog(this)); + aPasswdDlg->ShowExtras(SHOWEXTRAS_CONFIRM); + if(RET_OK == aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); - if( aPasswdDlg.GetConfirm() == sNewPasswd ) + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); + if( aPasswdDlg->GetConfirm() == sNewPasswd ) { SvPasswordHelper::GetHashPassword( pRepr->GetTempPasswd(), sNewPasswd ); } @@ -1682,12 +1682,12 @@ IMPL_LINK( SwInsertSectionTabPage, ChangePasswdHdl, Button *, pButton ) { if(!m_aNewPasswd.getLength() || bChange) { - SfxPasswordDialog aPasswdDlg(this); - aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); - if(RET_OK == aPasswdDlg.Execute()) + VclPtr<SfxPasswordDialog> aPasswdDlg(new SfxPasswordDialog(this)); + aPasswdDlg->ShowExtras(SHOWEXTRAS_CONFIRM); + if(RET_OK == aPasswdDlg->Execute()) { - const OUString sNewPasswd( aPasswdDlg.GetPassword() ); - if( aPasswdDlg.GetConfirm() == sNewPasswd ) + const OUString sNewPasswd( aPasswdDlg->GetPassword() ); + if( aPasswdDlg->GetConfirm() == sNewPasswd ) { SvPasswordHelper::GetHashPassword( m_aNewPasswd, sNewPasswd ); } diff --git a/sw/source/ui/envelp/label1.cxx b/sw/source/ui/envelp/label1.cxx index e5cc7dd7c72b..5f163c79f4ae 100644 --- a/sw/source/ui/envelp/label1.cxx +++ b/sw/source/ui/envelp/label1.cxx @@ -412,24 +412,24 @@ IMPL_LINK_NOARG_INLINE_END(SwLabPage, TypeHdl) void SwLabPage::DisplayFormat() { - MetricField aField(this, WinBits(0)); + VclPtr<MetricField> aField(new MetricField(this, WinBits(0))); FieldUnit aMetric = ::GetDfltMetric(false); - SetMetric(aField, aMetric); - aField.SetDecimalDigits(2); - aField.SetMin (0); - aField.SetMax (LONG_MAX); + SetMetric(*aField.get(), aMetric); + aField->SetDecimalDigits(2); + aField->SetMin (0); + aField->SetMax (LONG_MAX); SwLabRec* pRec = GetSelectedEntryPos(); aItem.aLstType = pRec->aType; - SETFLDVAL(aField, pRec->lWidth); - aField.Reformat(); - const OUString aWString = aField.GetText(); + SETFLDVAL(*aField.get(), pRec->lWidth); + aField->Reformat(); + const OUString aWString = aField->GetText(); - SETFLDVAL(aField, pRec->lHeight); - aField.Reformat(); + SETFLDVAL(*aField.get(), pRec->lHeight); + aField->Reformat(); OUString aText = pRec->aType + ": " + aWString + - " x " + aField.GetText() + + " x " + aField->GetText() + " (" + OUString::number( pRec->nCols ) + " x " + OUString::number( pRec->nRows ) + ")"; m_pFormatInfo->SetText(aText); diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx index 4a83c7867f72..f0ce86273f93 100644 --- a/sw/source/ui/envelp/labfmt.cxx +++ b/sw/source/ui/envelp/labfmt.cxx @@ -614,15 +614,15 @@ IMPL_LINK_NOARG(SwSaveLabelDlg, OkHdl) return 0; } - MessageDialog aQuery(this, "QuerySaveLabelDialog", - "modules/swriter/ui/querysavelabeldialog.ui"); + VclPtr<MessageDialog> aQuery(new MessageDialog(this, "QuerySaveLabelDialog", + "modules/swriter/ui/querysavelabeldialog.ui")); - aQuery.set_primary_text(aQuery.get_primary_text(). + aQuery->set_primary_text(aQuery->get_primary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - aQuery.set_secondary_text(aQuery.get_secondary_text(). + aQuery->set_secondary_text(aQuery->get_secondary_text(). replaceAll("%1", sMake).replaceAll("%2", sType)); - if (RET_YES != aQuery.Execute()) + if (RET_YES != aQuery->Execute()) return 0; } rLabRec.aType = sType; diff --git a/sw/source/ui/fmtui/tmpdlg.cxx b/sw/source/ui/fmtui/tmpdlg.cxx index 0fef7a5499cb..553dcf9ff5e8 100644 --- a/sw/source/ui/fmtui/tmpdlg.cxx +++ b/sw/source/ui/fmtui/tmpdlg.cxx @@ -540,15 +540,15 @@ void SwTemplateDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); // collect character styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + VclPtr<ListBox> rCharFmtLB(new ListBox(this)); + rCharFmtLB->Clear(); + rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); SwDocShell* pDocShell = ::GetActiveWrtShell()->GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); + ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( rCharFmtLB.GetEntry(j) ); + for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++) + aList.push_back( rCharFmtLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; FieldUnit eMetric = ::GetDfltMetric(pDocShell->ISA(SwWebDocShell)); diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index b30f2be25e94..89b798c8d7b7 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -284,17 +284,17 @@ IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton ) OUString sFldTypeName = m_pCategoryBox->GetText(); if(sFldTypeName == m_sNone) sFldTypeName = OUString(); - SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName ); - aDlg.SetApplyBorderAndShadow(bCopyAttributes); - aDlg.SetCharacterStyle( sCharacterStyle ); - aDlg.SetOrderNumberingFirst( bOrderNumberingFirst ); - aDlg.Execute(); - bCopyAttributes = aDlg.IsApplyBorderAndShadow(); - sCharacterStyle = aDlg.GetCharacterStyle(); + VclPtr<SwSequenceOptionDialog> aDlg( pButton, rView, sFldTypeName ); + aDlg->SetApplyBorderAndShadow(bCopyAttributes); + aDlg->SetCharacterStyle( sCharacterStyle ); + aDlg->SetOrderNumberingFirst( bOrderNumberingFirst ); + aDlg->Execute(); + bCopyAttributes = aDlg->IsApplyBorderAndShadow(); + sCharacterStyle = aDlg->GetCharacterStyle(); //#i61007# order of captions - if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() ) + if( bOrderNumberingFirst != aDlg->IsOrderNumberingFirst() ) { - bOrderNumberingFirst = aDlg.IsOrderNumberingFirst(); + bOrderNumberingFirst = aDlg->IsOrderNumberingFirst(); SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst); ApplyCaptionOrder(); } @@ -338,8 +338,8 @@ IMPL_LINK_NOARG(SwCaptionDialog, ModifyHdl) IMPL_LINK_NOARG(SwCaptionDialog, CaptionHdl) { SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() ); - SwCaptionOptDlg aDlg( this, aSet ); - aDlg.Execute(); + VclPtr<SwCaptionOptDlg> aDlg(new SwCaptionOptDlg( this, aSet ) ); + aDlg->Execute(); return 0; } diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 89db59c34d24..9bcaa1f8e2bb 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -488,8 +488,8 @@ IMPL_LINK_NOARG( SwMultiTOXTabDialog, ShowPreviewHdl ) OUString sInfo(SW_RESSTR(STR_FILE_NOT_FOUND)); sInfo = sInfo.replaceFirst( "%1", sTemplate ); sInfo = sInfo.replaceFirst( "%2", aOpt.GetTemplatePath() ); - InfoBox aInfo(GetParent(), sInfo); - aInfo.Execute(); + VclPtr<InfoBox> aInfo(new InfoBox(GetParent(), sInfo)); + aInfo->Execute(); } else { diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 701c6aee6250..9a5f7985b783 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -1201,8 +1201,8 @@ IMPL_LINK_NOARG(SwAuthorMarkPane, InsertHdl) bDifferent |= m_sFields[i] != pEntry->GetAuthorField((ToxAuthorityField)i); if(bDifferent) { - MessageDialog aQuery(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if(RET_YES != aQuery.Execute()) + VclPtr<MessageDialog> aQuery(new MessageDialog(&m_rDialog, SW_RES(STR_QUERY_CHANGE_AUTH_ENTRY), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)); + if(RET_YES != aQuery->Execute()) return 0; } } @@ -1241,14 +1241,14 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton) OUString sOldId = m_sCreatedEntry[0]; for(int i = 0; i < AUTH_FIELD_END; i++) m_sCreatedEntry[i] = bCreate ? OUString() : m_sFields[i]; - SwCreateAuthEntryDlg_Impl aDlg(pButton, + VclPtr<SwCreateAuthEntryDlg_Impl> aDlg(new SwCreateAuthEntryDlg_Impl(pButton, bCreate ? m_sCreatedEntry : m_sFields, - *pSh, bNewEntry, bCreate); + *pSh, bNewEntry, bCreate)); if(bNewEntry) { - aDlg.SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl)); + aDlg->SetCheckNameHdl(LINK(this, SwAuthorMarkPane, IsEntryAllowedHdl)); } - if(RET_OK == aDlg.Execute()) + if(RET_OK == aDlg->Execute()) { if(bCreate && !sOldId.isEmpty()) { @@ -1256,7 +1256,7 @@ IMPL_LINK(SwAuthorMarkPane, CreateEntryHdl, PushButton*, pButton) } for(int i = 0; i < AUTH_FIELD_END; i++) { - m_sFields[i] = aDlg.GetEntryText((ToxAuthorityField)i); + m_sFields[i] = aDlg->GetEntryText((ToxAuthorityField)i); m_sCreatedEntry[i] = m_sFields[i]; } if(bNewEntry && !m_pFromDocContentRB->IsChecked()) diff --git a/sw/source/ui/misc/glosbib.cxx b/sw/source/ui/misc/glosbib.cxx index 11a3666236bb..fcdec5ab38bf 100644 --- a/sw/source/ui/misc/glosbib.cxx +++ b/sw/source/ui/misc/glosbib.cxx @@ -139,8 +139,8 @@ void SwGlossaryGroupDlg::Apply() const OUString sMsg(SW_RESSTR(STR_QUERY_DELETE_GROUP1) + sTitle + SW_RESSTR(STR_QUERY_DELETE_GROUP2)); - QueryBox aQuery(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg ); - if(RET_YES == aQuery.Execute()) + VclPtr<QueryBox> aQuery(new QueryBox(this->GetParent(), WB_YES_NO|WB_DEF_NO, sMsg )); + if(RET_YES == aQuery->Execute()) pGlosHdl->DelGroup( sDelGroup ); } diff --git a/sw/source/ui/misc/glossary.cxx b/sw/source/ui/misc/glossary.cxx index 75db8cd62a1e..47fb56870532 100644 --- a/sw/source/ui/misc/glossary.cxx +++ b/sw/source/ui/misc/glossary.cxx @@ -494,8 +494,8 @@ IMPL_LINK( SwGlossaryDlg, MenuHdl, Menu *, pMn ) } else if (sItemIdent == "delete") { - MessageDialog aQuery(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if (RET_YES == aQuery.Execute()) + VclPtr<MessageDialog> aQuery(new MessageDialog(this, SW_RES(STR_QUERY_DELETE), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)); + if (RET_YES == aQuery->Execute()) { const OUString aShortName(m_pShortNameEdit->GetText()); const OUString aTitle(m_pNameED->GetText()); @@ -652,9 +652,9 @@ IMPL_LINK_NOARG(SwGlossaryDlg, BibHdl) } else { - MessageDialog aBox(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); + VclPtr<MessageDialog> aBox(new MessageDialog(this, sReadonlyPath, VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)); - if(RET_YES == aBox.Execute()) + if(RET_YES == aBox->Execute()) PathHdl(m_pPathBtn); } } diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 87b535d482b5..65543804b845 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -966,15 +966,15 @@ void SwSvxNumBulletTabDialog::PageCreated(sal_uInt16 nPageId, SfxTabPage& rPage) aSet.Put (SfxStringItem(SID_NUM_CHAR_FMT,sNumCharFmt)); aSet.Put (SfxStringItem(SID_BULLET_CHAR_FMT,sBulletCharFmt)); // collect char styles - ListBox rCharFmtLB(this); - rCharFmtLB.Clear(); - rCharFmtLB.InsertEntry( SwViewShell::GetShellRes()->aStrNone ); + VclPtr<ListBox> rCharFmtLB(new ListBox(this)); + rCharFmtLB->Clear(); + rCharFmtLB->InsertEntry( SwViewShell::GetShellRes()->aStrNone ); SwDocShell* pDocShell = rWrtSh.GetView().GetDocShell(); - ::FillCharStyleListBox(rCharFmtLB, pDocShell); + ::FillCharStyleListBox(*rCharFmtLB.get(), pDocShell); std::vector<OUString> aList; - for(sal_Int32 j = 0; j < rCharFmtLB.GetEntryCount(); j++) - aList.push_back( rCharFmtLB.GetEntry(j) ); + for(sal_Int32 j = 0; j < rCharFmtLB->GetEntryCount(); j++) + aList.push_back( rCharFmtLB->GetEntry(j) ); aSet.Put( SfxStringListItem( SID_CHAR_FMT_LIST_BOX,&aList ) ) ; diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index f9fba49adc50..cc2fe41bac06 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -608,10 +608,10 @@ void SwDocShell::Execute(SfxRequest& rReq) const SfxFilter* pFlt = GetMedium()->GetFilter(); if(!pFlt || pFlt->GetUserData() != pHtmlFlt->GetUserData()) { - MessageDialog aQuery(&pViewFrm->GetWindow(), - "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui"); + VclPtr<MessageDialog> aQuery(new MessageDialog(&pViewFrm->GetWindow(), + "SaveAsHTMLDialog", "modules/swriter/ui/saveashtmldialog.ui")); - if(RET_YES == aQuery.Execute()) + if(RET_YES == aQuery->Execute()) bLocalHasName = false; else break; diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 1df19b765208..03545308ca2d 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -388,8 +388,8 @@ namespace sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - MessageDialog aQueryBox( 0,"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox.Execute() == RET_YES) + VclPtr<MessageDialog> aQueryBox(new MessageDialog( 0,"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui") ); + if (aQueryBox->Execute() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx index e4edd46a7112..a1cdc385a2e3 100644 --- a/sw/source/uibase/lingu/olmenu.cxx +++ b/sw/source/uibase/lingu/olmenu.cxx @@ -803,9 +803,9 @@ void SwSpellPopup::Execute( sal_uInt16 nId ) uno::Any exc( ::cppu::getCaughtException() ); OUString msg( ::comphelper::anyToString( exc ) ); const SolarMutexGuard guard; - MessageDialog aErrorBox(NULL, msg); - aErrorBox.SetText( "Explanations" ); - aErrorBox.Execute(); + VclPtr<MessageDialog> aErrorBox(new MessageDialog(NULL, msg)); + aErrorBox->SetText( "Explanations" ); + aErrorBox->Execute(); } } else if (nId == FN_REDLINE_ACCEPT_DIRECT || nId == FN_REDLINE_REJECT_DIRECT diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index effa9f4b31aa..be54e67b88ae 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -163,19 +163,19 @@ void SwGrfShell::Execute(SfxRequest &rReq) Graphic aGraphic = Graphic( *pGraphic ); - CompressGraphicsDialog aDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() ); - if( aDialog.Execute() == RET_OK ) + VclPtr<CompressGraphicsDialog> aDialog(new CompressGraphicsDialog( GetView().GetWindow(), aGraphic, aSize, aCropRectangle, GetView().GetViewFrame()->GetBindings() ) ); + if( aDialog->Execute() == RET_OK ) { rSh.StartAllAction(); rSh.StartUndo(UNDO_START); - Rectangle aScaledCropedRectangle = aDialog.GetScaledCropRectangle(); + Rectangle aScaledCropedRectangle = aDialog->GetScaledCropRectangle(); aCrop.SetLeft( convertMm100ToTwip( aScaledCropedRectangle.Left() )); aCrop.SetTop( convertMm100ToTwip( aScaledCropedRectangle.Top() )); aCrop.SetRight( convertMm100ToTwip( aScaledCropedRectangle.Right() )); aCrop.SetBottom( convertMm100ToTwip( aScaledCropedRectangle.Bottom() )); - Graphic aCompressedGraphic( aDialog.GetCompressedGraphic() ); + Graphic aCompressedGraphic( aDialog->GetCompressedGraphic() ); rSh.ReRead(OUString(), OUString(), (const Graphic*) &aCompressedGraphic); rSh.SetAttrItem(aCrop); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index 888bf213cbfa..3a282dfa5258 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -735,9 +735,9 @@ void SwTableShell::Execute(SfxRequest &rReq) break; case TBLMERGE_TOOCOMPLEX: { - MessageDialog aInfoBox( GetView().GetWindow(), - SW_RES( STR_ERR_TABLE_MERGE ), VCL_MESSAGE_INFO ); - aInfoBox.Execute(); + VclPtr<MessageDialog> aInfoBox(new MessageDialog( GetView().GetWindow(), + SW_RES( STR_ERR_TABLE_MERGE ), VCL_MESSAGE_INFO ) ); + aInfoBox->Execute(); break; } default: diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 8ad15cf406d7..cbaf14a9bc8c 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -257,23 +257,23 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const static short lcl_AskRedlineMode(vcl::Window *pWin) { - MessBox aQBox( pWin, 0, + VclPtr<MessBox> aQBox(new MessBox( pWin, 0, OUString( SW_RES( STR_REDLINE_TITLE ) ), - OUString( SW_RES( STR_REDLINE_MSG ) ) ); - aQBox.SetImage( QueryBox::GetStandardImage() ); + OUString( SW_RES( STR_REDLINE_MSG ) ) ) ); + aQBox->SetImage( QueryBox::GetStandardImage() ); const sal_uInt16 nBtnFlags = BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON; - aQBox.AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags); - aQBox.GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT); - aQBox.AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON); - aQBox.GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT ); - aQBox.AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0); - aQBox.GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG); - aQBox.SetButtonHelpText( RET_OK, OUString() ); + aQBox->AddButton(OUString(SW_RES(STR_REDLINE_ACCEPT_ALL)), RET_OK, nBtnFlags); + aQBox->GetPushButton( RET_OK )->SetHelpId(HID_AUTOFORMAT_ACCEPT); + aQBox->AddButton(OUString(SW_RES(STR_REDLINE_REJECT_ALL)), RET_CANCEL, BUTTONDIALOG_CANCELBUTTON); + aQBox->GetPushButton( RET_CANCEL )->SetHelpId(HID_AUTOFORMAT_REJECT ); + aQBox->AddButton(OUString(SW_RES(STR_REDLINE_EDIT)), 2, 0); + aQBox->GetPushButton( 2 )->SetHelpId(HID_AUTOFORMAT_EDIT_CHG); + aQBox->SetButtonHelpText( RET_OK, OUString() ); - return aQBox.Execute(); + return aQBox->Execute(); } void SwTextShell::Execute(SfxRequest &rReq) diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 19530171d8fd..14698d8593c2 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -240,8 +240,8 @@ int SwView::InsertGraphic( const OUString &rPath, const OUString &rFilter, const sal_uInt16 aRotation = aMetadata.getRotation(); if (aRotation != 0) { - MessageDialog aQueryBox( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui"); - if (aQueryBox.Execute() == RET_YES) + VclPtr<MessageDialog> aQueryBox(new MessageDialog( GetWindow(),"QueryRotateIntoStandardOrientationDialog","modules/swriter/ui/queryrotateintostandarddialog.ui") ); + if (aQueryBox->Execute() == RET_YES) { GraphicNativeTransform aTransform( aGraphic ); aTransform.rotate( aRotation ); @@ -439,8 +439,8 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) // really store as link only? if( bAsLink && SvtMiscOptions().ShowLinkWarningDialog() ) { - SvxLinkWarningDialog aWarnDlg(GetWindow(),pFileDlg->GetPath()); - if( aWarnDlg.Execute() != RET_OK ) + VclPtr<SvxLinkWarningDialog> aWarnDlg(new SvxLinkWarningDialog(GetWindow(),pFileDlg->GetPath())); + if( aWarnDlg->Execute() != RET_OK ) bAsLink=false; // don't store as link } } @@ -504,8 +504,8 @@ bool SwView::InsertGraphicDlg( SfxRequest& rReq ) { if( bShowError ) { - MessageDialog aInfoBox( GetWindow(), SW_RESSTR( nResId ), VCL_MESSAGE_INFO); - aInfoBox.Execute(); + VclPtr<MessageDialog> aInfoBox(new MessageDialog( GetWindow(), SW_RESSTR( nResId ), VCL_MESSAGE_INFO) ); + aInfoBox->Execute(); } rReq.Ignore(); } @@ -585,11 +585,11 @@ void SwView::Execute(SfxRequest &rReq) pParent = static_cast<const XWindowItem*>( pParentItem )->GetWindowPtr(); else pParent = &GetViewFrame()->GetWindow(); - SfxPasswordDialog aPasswdDlg( pParent ); - aPasswdDlg.SetMinLen( 1 ); + VclPtr<SfxPasswordDialog> aPasswdDlg(new SfxPasswordDialog( pParent )); + aPasswdDlg->SetMinLen( 1 ); //#i69751# the result of Execute() can be ignored - (void)aPasswdDlg.Execute(); - OUString sNewPasswd( aPasswdDlg.GetPassword() ); + (void)aPasswdDlg->Execute(); + OUString sNewPasswd( aPasswdDlg->GetPassword() ); Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); if(SvPasswordHelper::CompareHashPassword(aPasswd, sNewPasswd)) @@ -623,14 +623,14 @@ void SwView::Execute(SfxRequest &rReq) pParent = static_cast<const XWindowItem*>( pParentItem )->GetWindowPtr(); else pParent = &GetViewFrame()->GetWindow(); - SfxPasswordDialog aPasswdDlg( pParent ); - aPasswdDlg.SetMinLen( 1 ); + VclPtr<SfxPasswordDialog> aPasswdDlg(new SfxPasswordDialog( pParent )); + aPasswdDlg->SetMinLen( 1 ); if(!aPasswd.getLength()) - aPasswdDlg.ShowExtras(SHOWEXTRAS_CONFIRM); - if (aPasswdDlg.Execute()) + aPasswdDlg->ShowExtras(SHOWEXTRAS_CONFIRM); + if (aPasswdDlg->Execute()) { sal_uInt16 nOn = nsRedlineMode_t::REDLINE_ON; - OUString sNewPasswd( aPasswdDlg.GetPassword() ); + OUString sNewPasswd( aPasswdDlg->GetPassword() ); Sequence <sal_Int8> aNewPasswd = pIDRA->GetRedlinePassword(); SvPasswordHelper::GetHashPassword( aNewPasswd, sNewPasswd ); @@ -2287,11 +2287,11 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) if ( lcl_NeedAdditionalDataSource( xDBContext ) ) { // no data sources are available - create a new one - MessageDialog aQuery(&GetViewFrame()->GetWindow(), + VclPtr<MessageDialog> aQuery(new MessageDialog(&GetViewFrame()->GetWindow(), "DataSourcesUnavailableDialog", - "modules/swriter/ui/datasourcesunavailabledialog.ui"); + "modules/swriter/ui/datasourcesunavailabledialog.ui")); // no cancel allowed - if (RET_OK != aQuery.Execute()) + if (RET_OK != aQuery->Execute()) return; bCallAddressPilot = true; } @@ -2336,12 +2336,12 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) OUString sSource; if(!GetWrtShell().IsFieldDataSourceAvailable(sSource)) { - MessageDialog aWarning(&GetViewFrame()->GetWindow(), + VclPtr<MessageDialog> aWarning(new MessageDialog(&GetViewFrame()->GetWindow(), "WarnDataSourceDialog", - "modules/swriter/ui/warndatasourcedialog.ui"); - OUString sTmp(aWarning.get_primary_text()); - aWarning.set_primary_text(sTmp.replaceFirst("%1", sSource)); - if (RET_OK == aWarning.Execute()) + "modules/swriter/ui/warndatasourcedialog.ui")); + OUString sTmp(aWarning->get_primary_text()); + aWarning->set_primary_text(sTmp.replaceFirst("%1", sSource)); + if (RET_OK == aWarning->Execute()) { SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); if ( pFact ) @@ -2390,8 +2390,8 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) SfxApplication* pSfxApp = SfxGetpApp(); vcl::Window* pTopWin = pSfxApp->GetTopWindow(); - SfxTemplateManagerDlg aDocTemplDlg; - int nRet = aDocTemplDlg.Execute(); + VclPtr<SfxTemplateManagerDlg> aDocTemplDlg(new SfxTemplateManagerDlg); + int nRet = aDocTemplDlg->Execute(); bool bNewWin = false; if ( nRet == RET_OK ) { diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index ccc39a4aca63..1319bd75ee8a 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -177,9 +177,9 @@ void SwView::ExecDraw(SfxRequest& rReq) if ( pSdrView ) { SdrObject* pObj = NULL; - svx::FontWorkGalleryDialog aDlg( pSdrView, pWin, nSlotId ); - aDlg.SetSdrObjectRef( &pObj, pSdrView->GetModel() ); - aDlg.Execute(); + VclPtr<svx::FontWorkGalleryDialog> aDlg(new svx::FontWorkGalleryDialog( pSdrView, pWin, nSlotId )); + aDlg->SetSdrObjectRef( &pObj, pSdrView->GetModel() ); + aDlg->Execute(); if ( pObj ) { Size aDocSize( m_pWrtShell->GetDocSize() ); diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 7b3c95d25f2d..001f48dad3ce 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -459,8 +459,8 @@ void SwView::HyphenateDocument() // turned on no special area { // I want also in special areas hyphenation - MessageDialog aBox(&GetEditWin(), SW_RES(STR_QUERY_SPECIAL_FORCED), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO); - if( aBox.Execute() == RET_YES ) + VclPtr<MessageDialog> aBox(new MessageDialog(&GetEditWin(), SW_RES(STR_QUERY_SPECIAL_FORCED), VCL_MESSAGE_QUESTION, VCL_BUTTONS_YES_NO)); + if( aBox->Execute() == RET_YES ) { bOther = true; if (xProp.is()) diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index a9e63c363856..0a3a4cf363e0 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -175,10 +175,10 @@ void SwView::ExecutePrint(SfxRequest& rReq) } else { - MessageDialog aInfoBox(&GetEditWin(), SW_RES(STR_ERR_NO_FAX), VCL_MESSAGE_INFO); + VclPtr<MessageDialog> aInfoBox(new MessageDialog(&GetEditWin(), SW_RES(STR_ERR_NO_FAX), VCL_MESSAGE_INFO)); sal_uInt16 nResNo = bWeb ? STR_WEBOPTIONS : STR_TEXTOPTIONS; - aInfoBox.set_primary_text(aInfoBox.get_primary_text().replaceFirst("%1", OUString(SW_RES(nResNo)))); - aInfoBox.Execute(); + aInfoBox->set_primary_text(aInfoBox->get_primary_text().replaceFirst("%1", OUString(SW_RES(nResNo)))); + aInfoBox->Execute(); SfxUInt16Item aDefPage(SID_SW_EDITOPTIONS, TP_OPTPRINT_PAGE); GetViewFrame()->GetDispatcher()->Execute(SID_SW_EDITOPTIONS, SfxCallMode::SYNCHRON|SfxCallMode::RECORD, @@ -201,9 +201,9 @@ void SwView::ExecutePrint(SfxRequest& rReq) if(!bSilent && !bFromMerge && SW_MOD()->GetModuleConfig()->IsAskForMailMerge() && pSh->IsAnyDatabaseFieldInDoc()) { - MessageDialog aBox(&GetEditWin(), "PrintMergeDialog", - "modules/swriter/ui/printmergedialog.ui"); - short nRet = aBox.Execute(); + VclPtr<MessageDialog> aBox(new MessageDialog(&GetEditWin(), "PrintMergeDialog", + "modules/swriter/ui/printmergedialog.ui")); + short nRet = aBox->Execute(); if(RET_YES == nRet) { SfxBoolItem aBool(FN_QRY_MERGE, true); diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 7f18c24ab564..4951847ff958 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -143,16 +143,16 @@ bool SwGlossaryList::GetShortName(const OUString& rLongName, } else if(1 < nCount) { - SwGlossDecideDlg aDlg(0); - OUString sTitle = aDlg.GetText() + " " + aTripleStrings.front().sBlock; - aDlg.SetText(sTitle); + VclPtr<SwGlossDecideDlg> aDlg(new SwGlossDecideDlg(0)); + OUString sTitle = aDlg->GetText() + " " + aTripleStrings.front().sBlock; + aDlg->SetText(sTitle); - ListBox& rLB = aDlg.GetListBox(); + ListBox& rLB = aDlg->GetListBox(); for(std::vector<TripleString>::const_iterator i = aTripleStrings.begin(); i != aTripleStrings.end(); ++i) rLB.InsertEntry(i->sGroup.getToken(0, GLOS_DELIM)); rLB.SelectEntryPos(0); - if(RET_OK == aDlg.Execute() && + if(RET_OK == aDlg->Execute() && LISTBOX_ENTRY_NOTFOUND != rLB.GetSelectEntryPos()) { const TripleString& pTriple(aTripleStrings[rLB.GetSelectEntryPos()]); |