Bug Summary

File:home/maarten/src/libreoffice/core/sw/source/uibase/app/appenv.cxx
Warning:line 227, column 13
Called C++ object pointer is null

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -disable-llvm-verifier -discard-value-names -main-file-name appenv.cxx -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables -target-cpu x86-64 -fno-split-dwarf-inlining -debugger-tuning=gdb -resource-dir /usr/lib64/clang/11.0.0 -isystem /usr/include/libxml2 -D BOOST_ERROR_CODE_HEADER_ONLY -D BOOST_SYSTEM_NO_DEPRECATED -D CPPU_ENV=gcc3 -D LINUX -D OSL_DEBUG_LEVEL=1 -D SAL_LOG_INFO -D SAL_LOG_WARN -D UNIX -D UNX -D X86_64 -D _PTHREADS -D _REENTRANT -D SW_DLLIMPLEMENTATION -D SWUI_DLL_NAME="libswuilo.so" -D SYSTEM_LIBXML -D EXCEPTIONS_ON -D LIBO_INTERNAL_ONLY -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/i18n -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/icu/source/common -I /home/maarten/src/libreoffice/core/external/boost/include -I /home/maarten/src/libreoffice/core/workdir/UnpackedTarball/boost -I /home/maarten/src/libreoffice/core/sw/source/core/inc -I /home/maarten/src/libreoffice/core/sw/source/filter/inc -I /home/maarten/src/libreoffice/core/sw/source/uibase/inc -I /home/maarten/src/libreoffice/core/sw/inc -I /home/maarten/src/libreoffice/core/workdir/SdiTarget/sw/sdi -I /home/maarten/src/libreoffice/core/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include -I /usr/lib/jvm/java-11-openjdk-11.0.9.10-0.0.ea.fc33.x86_64/include/linux -I /home/maarten/src/libreoffice/core/config_host -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/officecfg/registry -I /home/maarten/src/libreoffice/core/workdir/CustomTarget/sw/generated -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/udkapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/offapi/normal -I /home/maarten/src/libreoffice/core/workdir/UnoApiHeadersTarget/oovbaapi/normal -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10 -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/x86_64-redhat-linux -internal-isystem /usr/bin/../lib/gcc/x86_64-redhat-linux/10/../../../../include/c++/10/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib64/clang/11.0.0/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O0 -Wno-missing-braces -std=c++17 -fdeprecated-macro -fdebug-compilation-dir /home/maarten/src/libreoffice/core -ferror-limit 19 -fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2 -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -debug-info-kind=constructor -analyzer-output=html -faddrsig -o /home/maarten/tmp/wis/scan-build-libreoffice/output/report/2020-10-07-141433-9725-1 -x c++ /home/maarten/src/libreoffice/core/sw/source/uibase/app/appenv.cxx
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <hintids.hxx>
21
22#include <comphelper/string.hxx>
23#include <sfx2/request.hxx>
24
25#include <sfx2/bindings.hxx>
26#include <sfx2/printer.hxx>
27#include <sfx2/viewfrm.hxx>
28#include <editeng/boxitem.hxx>
29#include <editeng/lrspitem.hxx>
30#include <editeng/ulspitem.hxx>
31#include <editeng/pbinitem.hxx>
32#include <editeng/paperinf.hxx>
33#include <fmthdft.hxx>
34#include <swwait.hxx>
35#include <swmodule.hxx>
36#include <wrtsh.hxx>
37#include <view.hxx>
38#include <docsh.hxx>
39#include <frmatr.hxx>
40#include <fldbas.hxx>
41#include <swundo.hxx>
42#include <IDocumentDeviceAccess.hxx>
43#include <dialoghelp.hxx>
44#include <fmtcol.hxx>
45#include <frmmgr.hxx>
46#include <fldmgr.hxx>
47#include <pagedesc.hxx>
48#include <poolfmt.hxx>
49#include <expfld.hxx>
50#include <SwStyleNameMapper.hxx>
51#include <fmtpdsc.hxx>
52
53#include <cmdid.h>
54#include <strings.hrc>
55#include <swabstdlg.hxx>
56#include <envimg.hxx>
57#include "appenv.hxx"
58
59#define ENV_NEWDOCRET_OK RET_OK
60#define ENV_INSERT100 RET_USER100
61
62// Function used for labels and envelopes in applab.cxx and appenv.cxx
63OUString InsertLabEnvText( SwWrtShell& rSh, SwFieldMgr& rFieldMgr, const OUString& rText )
64{
65 OUString sRet;
66 OUString aText = rText.replaceAll("\r", "");
67
68 sal_Int32 nTokenPos = 0;
69 while( -1 != nTokenPos )
70 {
71 OUString aLine = aText.getToken( 0, '\n', nTokenPos );
72 while ( !aLine.isEmpty() )
73 {
74 OUString sTmpText;
75 bool bField = false;
76
77 sal_Int32 nPos = aLine.indexOf( '<' );
78 if (0 != nPos)
79 {
80 sal_Int32 const nCopy((nPos != -1) ? nPos : aLine.getLength());
81 sTmpText = aLine.copy(0, nCopy);
82 aLine = aLine.copy(nCopy);
83 }
84 else
85 {
86 nPos = aLine.indexOf( '>' );
87 if ( nPos == -1 )
88 {
89 sTmpText = aLine;
90 aLine.clear();
91 }
92 else
93 {
94 sTmpText = aLine.copy( 0, nPos + 1);
95 aLine = aLine.copy( nPos + 1);
96
97 // Database fields must contain at least 3 points!
98 OUString sDBName( sTmpText.copy( 1, sTmpText.getLength() - 2));
99 if (comphelper::string::getTokenCount(sDBName, '.') >= 3)
100 {
101 sDBName = ::ReplacePoint(sDBName, true);
102 SwInsertField_Data aData(SwFieldTypesEnum::Database, 0, sDBName, OUString(), 0, &rSh);
103 rFieldMgr.InsertField( aData );
104 sRet = sDBName;
105 bField = true;
106 }
107 }
108 }
109 if ( !bField )
110 rSh.Insert( sTmpText );
111 }
112 rSh.SplitNode();
113 }
114 rSh.DelLeft(); // Again remove last linebreak
115
116 return sRet;
117}
118
119static void lcl_CopyCollAttr(SwWrtShell const * pOldSh, SwWrtShell* pNewSh, sal_uInt16 nCollId)
120{
121 sal_uInt16 nCollCnt = pOldSh->GetTextFormatCollCount();
122 for( sal_uInt16 nCnt = 0; nCnt < nCollCnt; ++nCnt )
123 {
124 SwTextFormatColl* pColl = &pOldSh->GetTextFormatColl(nCnt);
125 if(nCollId == pColl->GetPoolFormatId())
126 pNewSh->GetTextCollFromPool(nCollId)->SetFormatAttr(pColl->GetAttrSet());
127 }
128}
129
130void SwModule::InsertEnv( SfxRequest& rReq )
131{
132 static sal_uInt16 nTitleNo = 0;
133
134 SwDocShell *pMyDocSh;
135 SfxViewFrame *pFrame;
136 SwView *pNewView;
137 SwWrtShell *pOldSh,
138 *pSh;
139
140 // Get current shell
141 pMyDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current());
142 pOldSh = pMyDocSh ? pMyDocSh->GetWrtShell() : nullptr;
1
Assuming 'pMyDocSh' is null
2
'?' condition is false
3
Null pointer value stored to 'pOldSh'
143
144 // Create new document (don't show!)
145 SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::STANDARD ) );
146 xDocSh->DoInitNew();
147 pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, SFX_INTERFACE_NONE );
148 pNewView = static_cast<SwView*>( pFrame->GetViewShell());
149 pNewView->AttrChangedNotify(nullptr); // so that SelectShell is being called
150 pSh = pNewView->GetWrtShellPtr();
151
152 OUString aTmp = SwResId(STR_ENV_TITLEreinterpret_cast<char const *>("STR_ENV_TITLE" "\004" u8"Envelope"
)
) + OUString::number( ++nTitleNo );
153 xDocSh->SetTitle( aTmp );
154
155 // if applicable, copy the old Collections "Sender" and "Receiver" to
156 // a new document
157 if ( pOldSh
3.1
'pOldSh' is null
)
4
Taking false branch
158 {
159 ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_ENVELOPE_ADDRESS);
160 ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SEND_ADDRESS);
161 }
162
163 // Read SwEnvItem from config
164 SwEnvCfgItem aEnvCfg;
165
166 // Check if there's already an envelope.
167 bool bEnvChange = false;
168
169 SfxItemSet aSet(GetPool(), svl::Items<FN_ENVELOP((20000 + 1050) ), FN_ENVELOP((20000 + 1050) )>{});
170 aSet.Put(aEnvCfg.GetItem());
171
172 SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess().getPrinter( true );
173 if(pOldSh
4.1
'pOldSh' is null
)
5
Taking false branch
174 {
175 const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc());
176 OUString sEnvelope;
177 SwStyleNameMapper::FillUIName( RES_POOLPAGE_ENVELOPE, sEnvelope );
178 bEnvChange = rCurPageDesc.GetName() == sEnvelope;
179
180 IDocumentDeviceAccess& rIDDA_old = pOldSh->getIDocumentDeviceAccess();
181 if( rIDDA_old.getPrinter( false ) )
182 {
183 IDocumentDeviceAccess& rIDDA = pSh->getIDocumentDeviceAccess();
184 rIDDA.setJobsetup( *rIDDA_old.getJobsetup() );
185 //#69563# if it isn't the same printer then the pointer has been invalidated!
186 pTempPrinter = rIDDA.getPrinter( true );
187 }
188 pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue());
189
190 }
191
192 ScopedVclPtr<SfxAbstractTabDialog> pDlg;
193 short nMode = ENV_INSERT100;
194
195 const SwEnvItem* pItem = rReq.GetArg<SwEnvItem>(FN_ENVELOP((20000 + 1050) ));
196 if ( !pItem
5.1
'pItem' is null
)
6
Taking true branch
197 {
198 SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
199 pDlg.disposeAndReset(pFact->CreateSwEnvDlg(GetFrameWeld(pMyDocSh), aSet, pOldSh, pTempPrinter, !bEnvChange));
200 nMode = pDlg->Execute();
201 }
202 else
203 {
204 const SfxBoolItem* pBoolItem = rReq.GetArg<SfxBoolItem>(FN_PARAM_1((20000 + 1100)+60));
205 if ( pBoolItem && pBoolItem->GetValue() )
206 nMode = ENV_NEWDOCRET_OK;
207 }
208
209 if (nMode == ENV_NEWDOCRET_OK || nMode == ENV_INSERT100)
7
Assuming 'nMode' is not equal to RET_OK
8
Assuming 'nMode' is equal to ENV_INSERT
9
Taking true branch
210 {
211 SwWait aWait( static_cast<SwDocShell&>(*xDocSh), true );
212
213 // Read dialog and save item to config
214 const SwEnvItem& rItem = pItem
9.1
'pItem' is null
? *pItem : static_cast<const SwEnvItem&>( pDlg->GetOutputItemSet()->Get(FN_ENVELOP((20000 + 1050) )) );
10
'?' condition is false
215 aEnvCfg.GetItem() = rItem;
216 aEnvCfg.Commit();
217
218 // When we print we take the Jobsetup that is set up in the dialog.
219 // Information has to be set here, before a possible destruction of
220 // the new shell because the shell's printer has been handed to the
221 // dialog.
222 if ( nMode
10.1
'nMode' is not equal to RET_OK
!= ENV_NEWDOCRET_OK )
11
Taking true branch
223 {
224 OSL_ENSURE(pOldSh, "No document - wasn't 'Insert' disabled???")do { if (true && (!(pOldSh))) { sal_detail_logFormat(
(SAL_DETAIL_LOG_LEVEL_WARN), ("legacy.osl"), ("/home/maarten/src/libreoffice/core/sw/source/uibase/app/appenv.cxx"
":" "224" ": "), "%s", "No document - wasn't 'Insert' disabled???"
); } } while (false)
;
12
Taking true branch
13
Loop condition is false. Exiting loop
225 SvxPaperBinItem aItem( RES_PAPER_BIN );
226 aItem.SetValue(static_cast<sal_uInt8>(pSh->getIDocumentDeviceAccess().getPrinter(true)->GetPaperBin()));
227 pOldSh->GetPageDescFromPool(RES_POOLPAGE_ENVELOPE)->GetMaster().SetFormatAttr(aItem);
14
Called C++ object pointer is null
228 }
229
230 SwWrtShell *pTmp = nMode == ENV_INSERT100 ? pOldSh : pSh;
231 const SwPageDesc* pFollow = nullptr;
232 SwTextFormatColl *pSend = pTmp->GetTextCollFromPool(RES_POOLCOLL_SEND_ADDRESS),
233 *pAddr = pTmp->GetTextCollFromPool(RES_POOLCOLL_ENVELOPE_ADDRESS);
234 const OUString sSendMark = pSend->GetName();
235 const OUString sAddrMark = pAddr->GetName();
236
237 if (nMode == ENV_INSERT100)
238 {
239
240 SetView(&pOldSh->GetView()); // Set pointer to top view
241
242 // Delete new document
243 xDocSh->DoClose();
244 pSh = pOldSh;
245 //#i4251# selected text or objects in the document should
246 //not be deleted on inserting envelopes
247 pSh->EnterStdMode();
248 // Here it goes (insert)
249 pSh->StartUndo(SwUndoId::UI_INSERT_ENVELOPE);
250 pSh->StartAllAction();
251 pSh->SttEndDoc(true);
252
253 if (bEnvChange)
254 {
255 // followup template: page 2
256 pFollow = pSh->GetPageDesc(pSh->GetCurPageDesc()).GetFollow();
257
258 // Delete text from the first page
259 if ( !pSh->SttNxtPg(true) )
260 pSh->EndPg(true);
261 pSh->DelRight();
262 // Delete frame of the first page
263 if ( pSh->GotoFly(sSendMark) )
264 {
265 pSh->EnterSelFrameMode();
266 pSh->DelRight();
267 }
268 if ( pSh->GotoFly(sAddrMark) )
269 {
270 pSh->EnterSelFrameMode();
271 pSh->DelRight();
272 }
273 pSh->SttEndDoc(true);
274 }
275 else
276 // Followup template: page 1
277 pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc());
278
279 // Insert page break
280 if ( pSh->IsCursorInTable() )
281 {
282 pSh->SplitNode();
283 pSh->Right( CRSR_SKIP_CHARS, false, 1, false );
284 SfxItemSet aBreakSet( pSh->GetAttrPool(), svl::Items<RES_PAGEDESC, RES_PAGEDESC>{} );
285 aBreakSet.Put( SwFormatPageDesc( pFollow ) );
286 pSh->SetTableAttr( aBreakSet );
287 }
288 else
289 {
290 OUString sFollowName(pFollow->GetName());
291 pSh->InsertPageBreak(&sFollowName, std::nullopt);
292 }
293 pSh->SttEndDoc(true);
294 }
295 else
296 {
297 pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc());
298 // Let's go (print)
299 pSh->StartAllAction();
300 pSh->DoUndo(false);
301
302 // Again, copy the new collections "Sender" and "Receiver" to
303 // a new document
304 if ( pOldSh )
305 {
306 ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_ENVELOPE_ADDRESS);
307 ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SEND_ADDRESS);
308 }
309 }
310
311 CurrShell aCurr(pSh);
312 pSh->SetNewDoc(); // Avoid performance problems
313
314 // Remember Flys of this site
315 std::vector<SwFrameFormat*> aFlyArr;
316 if( ENV_NEWDOCRET_OK != nMode && !bEnvChange )
317 pSh->GetPageObjs( aFlyArr );
318
319 // Get page description
320 SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_ENVELOPE);
321 SwFrameFormat& rFormat = pDesc->GetMaster();
322
323 Printer *pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true );
324
325 // Borders (are put together by Shift-Offset and alignment)
326 Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(),
327 MapMode(MapUnit::MapTwip));
328 if ( !aPaperSize.Width() && !aPaperSize.Height() )
329 aPaperSize = SvxPaperInfo::GetPaperSize(PAPER_A4);
330 if ( aPaperSize.Width() > aPaperSize.Height() )
331 Swap( aPaperSize );
332
333 long lLeft = rItem.m_nShiftRight,
334 lUpper = rItem.m_nShiftDown;
335
336 sal_uInt16 nPageW = static_cast<sal_uInt16>(std::max(rItem.m_nWidth, rItem.m_nHeight)),
337 nPageH = static_cast<sal_uInt16>(std::min(rItem.m_nWidth, rItem.m_nHeight));
338
339 switch (rItem.m_eAlign)
340 {
341 case ENV_HOR_LEFT: break;
342 case ENV_HOR_CNTR: lLeft += std::max(0L, long(aPaperSize.Width() - nPageW)) / 2;
343 break;
344 case ENV_HOR_RGHT: lLeft += std::max(0L, long(aPaperSize.Width() - nPageW));
345 break;
346 case ENV_VER_LEFT: lUpper += std::max(0L, long(aPaperSize.Width() - nPageH));
347 break;
348 case ENV_VER_CNTR: lUpper += std::max(0L, long(aPaperSize.Width() - nPageH)) / 2;
349 break;
350 case ENV_VER_RGHT: break;
351 }
352 SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
353 SvxULSpaceItem aULMargin( RES_UL_SPACE );
354 aLRMargin.SetLeft (static_cast<sal_uInt16>(lLeft) );
355 aULMargin.SetUpper(static_cast<sal_uInt16>(lUpper));
356 aLRMargin.SetRight(0);
357 aULMargin.SetLower(0);
358 rFormat.SetFormatAttr(aLRMargin);
359 rFormat.SetFormatAttr(aULMargin);
360
361 // Header and footer
362 rFormat.SetFormatAttr(SwFormatHeader(false));
363 pDesc->ChgHeaderShare(false);
364 rFormat.SetFormatAttr(SwFormatFooter(false));
365 pDesc->ChgFooterShare(false);
366
367 // Page numbering
368 pDesc->SetUseOn(UseOnPage::All);
369
370 // Page size
371 rFormat.SetFormatAttr(SwFormatFrameSize(SwFrameSize::Fixed,
372 nPageW + lLeft, nPageH + lUpper));
373
374 // Set type of page numbering
375 SvxNumberType aType;
376 aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
377 pDesc->SetNumType(aType);
378
379 // Followup template
380 if (pFollow)
381 pDesc->SetFollow(pFollow);
382
383 // Landscape
384 pDesc->SetLandscape( rItem.m_eAlign >= ENV_VER_LEFT &&
385 rItem.m_eAlign <= ENV_VER_RGHT);
386
387 // Apply page description
388
389 size_t nPos;
390 pSh->FindPageDescByName( pDesc->GetName(),
391 false,
392 &nPos );
393
394 pSh->ChgPageDesc( nPos, *pDesc);
395 pSh->ChgCurPageDesc(*pDesc);
396
397 // Insert Frame
398 SwFlyFrameAttrMgr aMgr(false, pSh, Frmmgr_Type::ENVELP, nullptr);
399 SwFieldMgr aFieldMgr;
400 aMgr.SetHeightSizeType(SwFrameSize::Variable);
401
402 // Overwrite defaults!
403 aMgr.GetAttrSet().Put( SvxBoxItem(RES_BOX) );
404 aMgr.SetULSpace( 0, 0 );
405 aMgr.SetLRSpace( 0, 0 );
406
407 // Sender
408 if (rItem.m_bSend)
409 {
410 pSh->SttEndDoc(true);
411 aMgr.InsertFlyFrame(RndStdIds::FLY_AT_PAGE,
412 Point(rItem.m_nSendFromLeft + lLeft, rItem.m_nSendFromTop + lUpper),
413 Size (rItem.m_nAddrFromLeft - rItem.m_nSendFromLeft, 0));
414
415 pSh->EnterSelFrameMode();
416 pSh->SetFlyName(sSendMark);
417 pSh->UnSelectFrame();
418 pSh->LeaveSelFrameMode();
419 pSh->SetTextFormatColl( pSend );
420 InsertLabEnvText( *pSh, aFieldMgr, rItem.m_aSendText );
421 aMgr.UpdateAttrMgr();
422 }
423
424 // Addressee
425 pSh->SttEndDoc(true);
426
427 aMgr.InsertFlyFrame(RndStdIds::FLY_AT_PAGE,
428 Point(rItem.m_nAddrFromLeft + lLeft, rItem.m_nAddrFromTop + lUpper),
429 Size (nPageW - rItem.m_nAddrFromLeft - 566, 0));
430 pSh->EnterSelFrameMode();
431 pSh->SetFlyName(sAddrMark);
432 pSh->UnSelectFrame();
433 pSh->LeaveSelFrameMode();
434 pSh->SetTextFormatColl( pAddr );
435 InsertLabEnvText(*pSh, aFieldMgr, rItem.m_aAddrText);
436
437 // Move Flys to the "old" pages
438 if (!aFlyArr.empty())
439 pSh->SetPageObjsNewPage(aFlyArr);
440
441 // Finished
442 pSh->SttEndDoc(true);
443
444 pSh->EndAllAction();
445
446 if (nMode == ENV_NEWDOCRET_OK)
447 pSh->DoUndo();
448 else
449 pSh->EndUndo(SwUndoId::UI_INSERT_ENVELOPE);
450
451 if (nMode == ENV_NEWDOCRET_OK)
452 {
453 pFrame->GetFrame().Appear();
454
455 if ( rItem.m_aAddrText.indexOf('<') >= 0 )
456 {
457 static sal_uInt16 const aInva[] =
458 {
459 SID_SBA_BRW_UPDATE(((((((10000 + 1499) + 1) + 499) + 1) + 100) + 1)+100),
460 SID_SBA_BRW_INSERT(((((((10000 + 1499) + 1) + 499) + 1) + 100) + 1)+101),
461 SID_SBA_BRW_MERGE(((((((10000 + 1499) + 1) + 499) + 1) + 100) + 1)+102),
462 0
463 };
464 pFrame->GetBindings().Invalidate( aInva );
465
466 // Open database beamer
467 ShowDBObj(*pNewView, pSh->GetDBData());
468 }
469 }
470
471 if ( !pItem )
472 {
473 rReq.AppendItem( rItem );
474 if ( nMode == ENV_NEWDOCRET_OK )
475 rReq.AppendItem( SfxBoolItem( FN_PARAM_1((20000 + 1100)+60), true ) );
476 }
477
478 rReq.Done();
479 }
480 else // Abort
481 {
482 rReq.Ignore();
483
484 xDocSh->DoClose();
485 --nTitleNo;
486
487 // Set pointer to top view
488 if (pOldSh)
489 SetView(&pOldSh->GetView());
490 }
491}
492
493/* vim:set shiftwidth=4 softtabstop=4 expandtab: */