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 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | |
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_NEWDOC RET_OK |
60 | #define ENV_INSERT RET_USER |
61 | |
62 | |
63 | OUString 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 | |
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(); |
115 | |
116 | return sRet; |
117 | } |
118 | |
119 | static 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 | |
130 | void 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 | |
141 | pMyDocSh = static_cast<SwDocShell*>( SfxObjectShell::Current()); |
142 | pOldSh = pMyDocSh ? pMyDocSh->GetWrtShell() : nullptr; |
| 1 | Assuming 'pMyDocSh' is null | |
|
| |
| 3 | | Null pointer value stored to 'pOldSh' | |
|
143 | |
144 | |
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); |
150 | pSh = pNewView->GetWrtShellPtr(); |
151 | |
152 | OUString aTmp = SwResId(STR_ENV_TITLE) + OUString::number( ++nTitleNo ); |
153 | xDocSh->SetTitle( aTmp ); |
154 | |
155 | |
156 | |
157 | if ( pOldSh ) |
| |
158 | { |
159 | ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_ENVELOPE_ADDRESS); |
160 | ::lcl_CopyCollAttr(pOldSh, pSh, RES_POOLCOLL_SEND_ADDRESS); |
161 | } |
162 | |
163 | |
164 | SwEnvCfgItem aEnvCfg; |
165 | |
166 | |
167 | bool bEnvChange = false; |
168 | |
169 | SfxItemSet aSet(GetPool(), svl::Items<FN_ENVELOP, FN_ENVELOP>{}); |
170 | aSet.Put(aEnvCfg.GetItem()); |
171 | |
172 | SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess().getPrinter( true ); |
173 | if(pOldSh ) |
| |
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 | |
186 | pTempPrinter = rIDDA.getPrinter( true ); |
187 | } |
188 | pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); |
189 | |
190 | } |
191 | |
192 | ScopedVclPtr<SfxAbstractTabDialog> pDlg; |
193 | short nMode = ENV_INSERT; |
194 | |
195 | const SwEnvItem* pItem = rReq.GetArg<SwEnvItem>(FN_ENVELOP); |
196 | if ( !pItem ) |
| |
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); |
205 | if ( pBoolItem && pBoolItem->GetValue() ) |
206 | nMode = ENV_NEWDOC; |
207 | } |
208 | |
209 | if (nMode == ENV_NEWDOC || nMode == ENV_INSERT) |
| 7 | | Assuming 'nMode' is not equal to RET_OK | |
|
| 8 | | Assuming 'nMode' is equal to ENV_INSERT | |
|
| |
210 | { |
211 | SwWait aWait( static_cast<SwDocShell&>(*xDocSh), true ); |
212 | |
213 | |
214 | const SwEnvItem& rItem = pItem ? *pItem : static_cast<const SwEnvItem&>( pDlg->GetOutputItemSet()->Get(FN_ENVELOP) ); |
| |
215 | aEnvCfg.GetItem() = rItem; |
216 | aEnvCfg.Commit(); |
217 | |
218 | |
219 | |
220 | |
221 | |
222 | if ( nMode != ENV_NEWDOC ) |
| |
223 | { |
224 | OSL_ENSURE(pOldSh, "No document - wasn't 'Insert' disabled???"); |
| |
| 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_INSERT ? 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_INSERT) |
238 | { |
239 | |
240 | SetView(&pOldSh->GetView()); |
241 | |
242 | |
243 | xDocSh->DoClose(); |
244 | pSh = pOldSh; |
245 | |
246 | |
247 | pSh->EnterStdMode(); |
248 | |
249 | pSh->StartUndo(SwUndoId::UI_INSERT_ENVELOPE); |
250 | pSh->StartAllAction(); |
251 | pSh->SttEndDoc(true); |
252 | |
253 | if (bEnvChange) |
254 | { |
255 | |
256 | pFollow = pSh->GetPageDesc(pSh->GetCurPageDesc()).GetFollow(); |
257 | |
258 | |
259 | if ( !pSh->SttNxtPg(true) ) |
260 | pSh->EndPg(true); |
261 | pSh->DelRight(); |
262 | |
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 | |
277 | pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc()); |
278 | |
279 | |
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 | |
299 | pSh->StartAllAction(); |
300 | pSh->DoUndo(false); |
301 | |
302 | |
303 | |
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(); |
313 | |
314 | |
315 | std::vector<SwFrameFormat*> aFlyArr; |
316 | if( ENV_NEWDOC != nMode && !bEnvChange ) |
317 | pSh->GetPageObjs( aFlyArr ); |
318 | |
319 | |
320 | SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_ENVELOPE); |
321 | SwFrameFormat& rFormat = pDesc->GetMaster(); |
322 | |
323 | Printer *pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true ); |
324 | |
325 | |
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 | |
362 | rFormat.SetFormatAttr(SwFormatHeader(false)); |
363 | pDesc->ChgHeaderShare(false); |
364 | rFormat.SetFormatAttr(SwFormatFooter(false)); |
365 | pDesc->ChgFooterShare(false); |
366 | |
367 | |
368 | pDesc->SetUseOn(UseOnPage::All); |
369 | |
370 | |
371 | rFormat.SetFormatAttr(SwFormatFrameSize(SwFrameSize::Fixed, |
372 | nPageW + lLeft, nPageH + lUpper)); |
373 | |
374 | |
375 | SvxNumberType aType; |
376 | aType.SetNumberingType(SVX_NUM_NUMBER_NONE); |
377 | pDesc->SetNumType(aType); |
378 | |
379 | |
380 | if (pFollow) |
381 | pDesc->SetFollow(pFollow); |
382 | |
383 | |
384 | pDesc->SetLandscape( rItem.m_eAlign >= ENV_VER_LEFT && |
385 | rItem.m_eAlign <= ENV_VER_RGHT); |
386 | |
387 | |
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 | |
398 | SwFlyFrameAttrMgr aMgr(false, pSh, Frmmgr_Type::ENVELP, nullptr); |
399 | SwFieldMgr aFieldMgr; |
400 | aMgr.SetHeightSizeType(SwFrameSize::Variable); |
401 | |
402 | |
403 | aMgr.GetAttrSet().Put( SvxBoxItem(RES_BOX) ); |
404 | aMgr.SetULSpace( 0, 0 ); |
405 | aMgr.SetLRSpace( 0, 0 ); |
406 | |
407 | |
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 | |
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 | |
438 | if (!aFlyArr.empty()) |
439 | pSh->SetPageObjsNewPage(aFlyArr); |
440 | |
441 | |
442 | pSh->SttEndDoc(true); |
443 | |
444 | pSh->EndAllAction(); |
445 | |
446 | if (nMode == ENV_NEWDOC) |
447 | pSh->DoUndo(); |
448 | else |
449 | pSh->EndUndo(SwUndoId::UI_INSERT_ENVELOPE); |
450 | |
451 | if (nMode == ENV_NEWDOC) |
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, |
460 | SID_SBA_BRW_INSERT, |
461 | SID_SBA_BRW_MERGE, |
462 | 0 |
463 | }; |
464 | pFrame->GetBindings().Invalidate( aInva ); |
465 | |
466 | |
467 | ShowDBObj(*pNewView, pSh->GetDBData()); |
468 | } |
469 | } |
470 | |
471 | if ( !pItem ) |
472 | { |
473 | rReq.AppendItem( rItem ); |
474 | if ( nMode == ENV_NEWDOC ) |
475 | rReq.AppendItem( SfxBoolItem( FN_PARAM_1, true ) ); |
476 | } |
477 | |
478 | rReq.Done(); |
479 | } |
480 | else |
481 | { |
482 | rReq.Ignore(); |
483 | |
484 | xDocSh->DoClose(); |
485 | --nTitleNo; |
486 | |
487 | |
488 | if (pOldSh) |
489 | SetView(&pOldSh->GetView()); |
490 | } |
491 | } |
492 | |
493 | |