Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <cstdarg>
31 : :
32 : : #include <hintids.hxx>
33 : :
34 : : #include <vcl/svapp.hxx>
35 : : #include <vcl/wrkwin.hxx>
36 : : #include <vcl/msgbox.hxx>
37 : : #include <sfx2/app.hxx>
38 : : #include <sfx2/dispatch.hxx>
39 : : #include <sfx2/printer.hxx>
40 : : #include <sfx2/request.hxx>
41 : : #include <sfx2/linkmgr.hxx>
42 : : #include <editeng/pbinitem.hxx>
43 : : #include <editeng/ulspitem.hxx>
44 : : #include <editeng/lrspitem.hxx>
45 : : #include <editeng/boxitem.hxx>
46 : : #include <editeng/paperinf.hxx>
47 : : #include <editeng/protitem.hxx>
48 : : #include <com/sun/star/frame/XStorable.hpp>
49 : : #include <com/sun/star/frame/XModel.hpp>
50 : : #include <fmthdft.hxx>
51 : : #include <fmtanchr.hxx>
52 : : #include <fmtfsize.hxx>
53 : : #include <fmtornt.hxx>
54 : : #include <swwait.hxx>
55 : : #include <gloshdl.hxx>
56 : : #include <mdiexp.hxx>
57 : : #include <frmatr.hxx>
58 : : #include <paratr.hxx>
59 : : #include <swmodule.hxx>
60 : : #include <view.hxx>
61 : : #include <docsh.hxx>
62 : : #include <fldbas.hxx>
63 : : #include <swundo.hxx>
64 : : #include <wrtsh.hxx>
65 : : #include <cmdid.h>
66 : : #include <dbmgr.hxx>
67 : : #include <fmtcol.hxx>
68 : : #include <expfld.hxx>
69 : : #include <fldmgr.hxx>
70 : : #include <label.hxx>
71 : : #include <labimg.hxx>
72 : : #include <section.hxx>
73 : : #include <pagedesc.hxx>
74 : : #include <poolfmt.hxx>
75 : :
76 : : #include <app.hrc>
77 : : #include <poolfmt.hrc>
78 : : #include "swabstdlg.hxx"
79 : : #include "envelp.hrc"
80 : : #include <misc.hrc>
81 : :
82 : : #include <IDocumentDeviceAccess.hxx>
83 : :
84 : : using namespace ::com::sun::star;
85 : : using ::rtl::OUString;
86 : :
87 : : // is in appenv.cxx
88 : : extern String InsertLabEnvText( SwWrtShell& , SwFldMgr& , const String& );
89 : :
90 : : const char MASTER_LABEL[] = "MasterLabel";
91 : :
92 : 0 : const SwFrmFmt *lcl_InsertBCText( SwWrtShell& rSh, const SwLabItem& rItem,
93 : : SwFrmFmt &rFmt,
94 : : sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bPage)
95 : : {
96 [ # # ]: 0 : SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
97 [ # # ]: 0 : RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
98 : : sal_uInt16 nPhyPageNum, nVirtPageNum;
99 [ # # ]: 0 : rSh.GetPageNum( nPhyPageNum, nVirtPageNum );
100 : :
101 [ # # ][ # # ]: 0 : aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum));
[ # # ][ # # ]
102 [ # # ]: 0 : if (!bPage)
103 : : {
104 : : aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist,
105 [ # # ][ # # ]: 0 : text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
[ # # ]
106 : : aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist,
107 [ # # ][ # # ]: 0 : text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
[ # # ]
108 : : }
109 [ # # ]: 0 : const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Insert Fly
110 : : OSL_ENSURE( pFmt, "Fly not inserted" );
111 : :
112 [ # # ]: 0 : rSh.UnSelectFrm(); //Frame was selected automatically
113 : :
114 [ # # ][ # # ]: 0 : rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
115 : :
116 [ # # ][ # # ]: 0 : if(!rItem.bSynchron || !(nCol|nRow))
117 : : {
118 [ # # ]: 0 : SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
119 : : OSL_ENSURE(pFact, "Dialogdiet fail!");
120 [ # # ]: 0 : ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS );
121 [ # # ]: 0 : if ( fnSetActGroup )
122 [ # # ][ # # ]: 0 : (*fnSetActGroup)( rItem.sGlossaryGroup );
[ # # ]
123 [ # # ]: 0 : SwGlossaryHdl* pGlosHdl = rSh.GetView().GetGlosHdl();
124 [ # # ][ # # ]: 0 : pGlosHdl->SetCurGroup(rItem.sGlossaryGroup, sal_True);
[ # # ]
125 [ # # ][ # # ]: 0 : pGlosHdl->InsertGlossary( rItem.sGlossaryBlockName );
[ # # ]
126 : : }
127 : :
128 [ # # ]: 0 : return pFmt;
129 : : }
130 : :
131 : 0 : const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem,
132 : : SwFrmFmt &rFmt, SwFldMgr& rFldMgr,
133 : : sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bLast, sal_Bool bPage)
134 : : {
135 [ # # ]: 0 : SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR,
136 [ # # ]: 0 : RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 );
137 : : sal_uInt16 nPhyPageNum, nVirtPageNum;
138 [ # # ]: 0 : rSh.GetPageNum( nPhyPageNum, nVirtPageNum );
139 : :
140 [ # # ][ # # ]: 0 : aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum));
[ # # ][ # # ]
141 [ # # ]: 0 : if (!bPage)
142 : : {
143 : : aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist,
144 [ # # ][ # # ]: 0 : text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
[ # # ]
145 : : aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist,
146 [ # # ][ # # ]: 0 : text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME ));
[ # # ]
147 : : }
148 [ # # ]: 0 : const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Insert Fly
149 : : OSL_ENSURE( pFmt, "Fly not inserted" );
150 : :
151 [ # # ]: 0 : rSh.UnSelectFrm(); //Frame was selected automatically
152 : :
153 [ # # ][ # # ]: 0 : rSh.SetTxtFmtColl( rSh.GetTxtCollFromPool( RES_POOLCOLL_STANDARD ) );
154 : :
155 : : // If applicable "next dataset"
156 [ # # ]: 0 : String sDBName;
157 [ # # ][ # # ]: 0 : if( (!rItem.bSynchron || !(nCol|nRow)) && (sDBName = InsertLabEnvText( rSh, rFldMgr, rItem.aWriting )).Len() && !bLast )
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # #
# # # # ]
158 : : {
159 [ # # ][ # # ]: 0 : sDBName.SetToken( 3, DB_DELIM, rtl::OUString("True"));
[ # # ]
160 [ # # ]: 0 : SwInsertFld_Data aData(TYP_DBNEXTSETFLD, 0, sDBName, aEmptyStr, 0, &rSh );
161 [ # # ][ # # ]: 0 : rFldMgr.InsertFld( aData );
162 : : }
163 : :
164 [ # # ][ # # ]: 0 : return pFmt;
165 : : }
166 : :
167 : 0 : void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
168 : : {
169 : : static sal_uInt16 nLabelTitleNo = 0;
170 : : static sal_uInt16 nBCTitleNo = 0;
171 : :
172 : : // Create DB-Manager
173 [ # # ][ # # ]: 0 : SwNewDBMgr* pNewDBMgr = new SwNewDBMgr;
174 : :
175 : : // Read SwLabItem from Config
176 [ # # ]: 0 : SwLabCfgItem aLabCfg(bLabel);
177 : :
178 : : // Move up Dialog
179 [ # # ]: 0 : SfxItemSet aSet( GetPool(), FN_LABEL, FN_LABEL, 0 );
180 [ # # ]: 0 : aSet.Put( aLabCfg.GetItem() );
181 : :
182 [ # # ]: 0 : SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create();
183 : : OSL_ENSURE(pDialogFactory, "SwAbstractDialogFactory fail!");
184 : :
185 [ # # ]: 0 : AbstractSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg( 0, aSet, pNewDBMgr, bLabel, DLG_LAB );
186 : : OSL_ENSURE(pDlg, "Dialogdiet fail!");
187 : :
188 [ # # ][ # # ]: 0 : if ( RET_OK == pDlg->Execute() )
189 : : {
190 : : // Read dialog, store item in config
191 : : const SwLabItem& rItem = (const SwLabItem&) pDlg->
192 [ # # ][ # # ]: 0 : GetOutputItemSet()->Get(FN_LABEL);
193 [ # # ]: 0 : aLabCfg.GetItem() = rItem;
194 [ # # ]: 0 : aLabCfg.Commit();
195 : :
196 : : // Create new document
197 [ # # ][ # # ]: 0 : SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD));
[ # # ]
198 [ # # ]: 0 : xDocSh->DoInitNew( 0 );
199 : :
200 : : // Printer
201 [ # # ]: 0 : Printer *pPrt = pDlg->GetPrt();
202 [ # # ]: 0 : if (pPrt)
203 : : {
204 : 0 : SwDocShell *pDocSh = (SwDocShell*)(&*xDocSh);
205 [ # # ][ # # ]: 0 : pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup());
206 : : }
207 : :
208 [ # # ]: 0 : SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
209 : :
210 [ # # ]: 0 : SwView *pNewView = (SwView*) pViewFrame->GetViewShell();
211 [ # # ]: 0 : pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );// So that SelectShell is being called.
212 : :
213 : : // Set document title
214 [ # # ]: 0 : String aTmp;
215 [ # # ]: 0 : if(bLabel)
216 : : {
217 [ # # ][ # # ]: 0 : aTmp = String(SW_RES( STR_LAB_TITLE));
[ # # ]
218 [ # # ][ # # ]: 0 : aTmp += String::CreateFromInt32(++nLabelTitleNo );
[ # # ]
219 : : }
220 : : else
221 : : {
222 [ # # ][ # # ]: 0 : aTmp = pDlg->GetBusinessCardStr();
223 [ # # ][ # # ]: 0 : aTmp += String::CreateFromInt32( ++nBCTitleNo );
[ # # ]
224 : : }
225 [ # # ]: 0 : xDocSh->SetTitle( aTmp );
226 : :
227 [ # # ][ # # ]: 0 : pViewFrame->GetFrame().Appear();
228 : :
229 : : // Determine Shell
230 : 0 : SwWrtShell *pSh = pNewView->GetWrtShellPtr();
231 : : OSL_ENSURE( pSh, "missing WrtShell" );
232 : :
233 : : { // block for locks the dispatcher!!
234 : :
235 [ # # ]: 0 : SwWait aWait( (SwDocShell&)*xDocSh, sal_True );
236 : :
237 [ # # ]: 0 : SET_CURR_SHELL(pSh);
238 [ # # ]: 0 : pSh->SetLabelDoc(rItem.bSynchron);
239 [ # # ]: 0 : pSh->DoUndo( sal_False );
240 [ # # ]: 0 : pSh->StartAllAction();
241 : :
242 [ # # ]: 0 : pSh->SetNewDoc(); // Avoid performance problems
243 : :
244 [ # # ][ # # ]: 0 : SwPageDesc aDesc = pSh->GetPageDesc( 0 );
245 : 0 : SwFrmFmt& rFmt = aDesc.GetMaster();
246 : :
247 : : // Borders
248 [ # # ]: 0 : SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
249 [ # # ]: 0 : SvxULSpaceItem aULMargin( RES_UL_SPACE );
250 : 0 : aLRMargin.SetLeft ((sal_uInt16) rItem.lLeft );
251 : 0 : aULMargin.SetUpper((sal_uInt16) rItem.lUpper);
252 : 0 : aLRMargin.SetRight( 0 );
253 : 0 : aULMargin.SetLower( 0 );
254 [ # # ]: 0 : rFmt.SetFmtAttr(aLRMargin);
255 [ # # ]: 0 : rFmt.SetFmtAttr(aULMargin);
256 : :
257 : : // Header and footer
258 [ # # ][ # # ]: 0 : rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False)));
[ # # ]
259 : 0 : aDesc.ChgHeaderShare(sal_False);
260 [ # # ][ # # ]: 0 : rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False)));
[ # # ]
261 : 0 : aDesc.ChgFooterShare(sal_False);
262 : :
263 : :
264 : 0 : aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Site numbering
265 : :
266 : : // Set page size
267 : : long lPgWidth, lPgHeight;
268 : 0 : lPgWidth = (rItem.lPWidth > MINLAY ? rItem.lPWidth : MINLAY);
269 : 0 : lPgHeight = (rItem.lPHeight > MINLAY ? rItem.lPHeight : MINLAY);
270 [ # # ][ # # ]: 0 : rFmt.SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE, lPgWidth, lPgHeight ));
[ # # ]
271 : : // Numbering type
272 [ # # ]: 0 : SvxNumberType aType;
273 : 0 : aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
274 : 0 : aDesc.SetNumType( aType );
275 : :
276 : : // Followup template
277 [ # # ][ # # ]: 0 : const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() );
278 : 0 : aDesc.SetFollow( &rFollow );
279 : :
280 [ # # ][ # # ]: 0 : pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true );
281 [ # # ]: 0 : SvxPaperBinItem aItem( RES_PAPER_BIN );
282 [ # # ]: 0 : aItem.SetValue((sal_Int8)pPrt->GetPaperBin());
283 [ # # ]: 0 : rFmt.SetFmtAttr(aItem);
284 : :
285 : : // Determine orientation of the resulting page
286 : 0 : aDesc.SetLandscape(rItem.lPWidth > rItem.lPHeight);
287 : :
288 [ # # ]: 0 : pSh->ChgPageDesc( 0, aDesc );
289 : :
290 : : // Insert frame
291 [ # # ][ # # ]: 0 : SwFldMgr* pFldMgr = new SwFldMgr;
292 : 0 : pFldMgr->SetEvalExpFlds(sal_False);
293 : :
294 : : // Prepare border template
295 [ # # ]: 0 : SwFrmFmt* pFmt = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL );
296 : 0 : sal_Int32 iResultWidth = rItem.lLeft + (rItem.nCols - 1) * rItem.lHDist + rItem.lWidth - rItem.lPWidth;
297 : 0 : sal_Int32 iResultHeight = rItem.lUpper + (rItem.nRows - 1) * rItem.lVDist + rItem.lHeight - rItem.lPHeight;
298 [ # # ]: 0 : sal_Int32 iWidth = (iResultWidth > 0 ? rItem.lWidth - (iResultWidth / rItem.nCols) - 1 : rItem.lWidth);
299 [ # # ]: 0 : sal_Int32 iHeight = (iResultHeight > 0 ? rItem.lHeight - (iResultHeight / rItem.nRows) - 1 : rItem.lHeight);
300 [ # # ]: 0 : SwFmtFrmSize aFrmSize( ATT_FIX_SIZE, iWidth, iHeight );
301 [ # # ]: 0 : pFmt->SetFmtAttr( aFrmSize );
302 : :
303 [ # # ][ # # ]: 0 : SwFrmFmt* pFmtEORow = new SwFrmFmt (*pFmt);
304 [ # # ][ # # ]: 0 : SwFrmFmt* pFmtEOCol = new SwFrmFmt (*pFmt);
305 [ # # ][ # # ]: 0 : SwFrmFmt* pFmtEOColEORow = new SwFrmFmt (*pFmt);
306 : :
307 : : SvxULSpaceItem aFrmULSpace( 0, (sal_uInt16)(rItem.lVDist - rItem.lHeight),
308 [ # # ]: 0 : RES_UL_SPACE );
309 [ # # ]: 0 : SvxULSpaceItem aFrmNoULSpace( 0, 0, RES_UL_SPACE );
310 : :
311 : : SvxLRSpaceItem aFrmLRSpace( 0, (sal_uInt16)(rItem.lHDist - rItem.lWidth),
312 [ # # ]: 0 : 0, 0, RES_LR_SPACE );
313 [ # # ]: 0 : SvxLRSpaceItem aFrmNoLRSpace( 0, 0, 0, 0, RES_LR_SPACE );
314 : :
315 [ # # ]: 0 : pFmt->SetFmtAttr(aFrmULSpace);
316 [ # # ]: 0 : pFmt->SetFmtAttr(aFrmLRSpace);
317 [ # # ]: 0 : pFmtEORow->SetFmtAttr(aFrmULSpace);
318 [ # # ]: 0 : pFmtEORow->SetFmtAttr(aFrmNoLRSpace);
319 [ # # ]: 0 : pFmtEOCol->SetFmtAttr(aFrmNoULSpace);
320 [ # # ]: 0 : pFmtEOCol->SetFmtAttr(aFrmLRSpace);
321 [ # # ]: 0 : pFmtEOColEORow->SetFmtAttr(aFrmNoULSpace);
322 [ # # ]: 0 : pFmtEOColEORow->SetFmtAttr(aFrmNoLRSpace);
323 : :
324 : 0 : const SwFrmFmt *pFirstFlyFmt = 0;
325 [ # # ]: 0 : if ( rItem.bPage )
326 : : {
327 [ # # ][ # # ]: 0 : SwFmtVertOrient aFrmVertOrient( pFmt->GetVertOrient() );
328 : 0 : aFrmVertOrient.SetVertOrient( text::VertOrientation::TOP );
329 [ # # ]: 0 : pFmt->SetFmtAttr(aFrmVertOrient);
330 [ # # ]: 0 : pFmtEORow->SetFmtAttr(aFrmVertOrient);
331 [ # # ]: 0 : pFmtEOCol->SetFmtAttr(aFrmVertOrient);
332 [ # # ]: 0 : pFmtEOColEORow->SetFmtAttr(aFrmVertOrient);
333 : :
334 [ # # ]: 0 : for ( sal_uInt16 i = 0; i < rItem.nRows; ++i )
335 : : {
336 [ # # ]: 0 : for ( sal_uInt16 j = 0; j < rItem.nCols; ++j )
337 : : {
338 [ # # ]: 0 : pSh->Push();
339 : : SwFrmFmt* pFrmFmt;
340 [ # # ]: 0 : if ( j == rItem.nCols - 1 )
341 [ # # ]: 0 : pFrmFmt = ( i == rItem.nRows - 1 ? pFmtEOColEORow : pFmtEORow );
342 : : else
343 [ # # ]: 0 : pFrmFmt = ( i == rItem.nRows - 1 ? pFmtEOCol : pFmt );
344 : :
345 : : const SwFrmFmt *pTmp =
346 : : bLabel ?
347 : : lcl_InsertLabText( *pSh, rItem, *pFrmFmt, *pFldMgr, j, i,
348 [ # # ][ # # ]: 0 : i == rItem.nRows - 1 && j == rItem.nCols - 1, sal_True ) :
349 [ # # ][ # # ]: 0 : lcl_InsertBCText(*pSh, rItem, *pFrmFmt, j, i, sal_True);
[ # # ]
350 [ # # ]: 0 : if (!(i|j))
351 : : {
352 : 0 : pFirstFlyFmt = pTmp;
353 : :
354 [ # # ]: 0 : if (rItem.bSynchron)
355 : : {
356 : : // if there is no content in the fly then
357 : : // dont leave the fly!!!
358 [ # # ]: 0 : pSh->Push();
359 [ # # ]: 0 : pSh->SttDoc();
360 [ # # ]: 0 : sal_Bool bInFly = 0 != pSh->WizzardGetFly();
361 [ # # ]: 0 : pSh->Pop( bInFly );
362 : :
363 [ # # ]: 0 : if( bInFly )
364 [ # # ]: 0 : pSh->EndDoc(sal_True); // select all content
365 : : // in the fly
366 : : else
367 [ # # ]: 0 : pSh->SetMark(); // set only the mark
368 : :
369 : : SwSectionData aSect(CONTENT_SECTION,
370 [ # # ][ # # ]: 0 : rtl::OUString(MASTER_LABEL));
[ # # ]
371 [ # # ][ # # ]: 0 : pSh->InsertSection(aSect);
372 : : }
373 : : }
374 [ # # ]: 0 : else if (rItem.bSynchron)
375 : : {
376 : : SwSectionData aSect(FILE_LINK_SECTION,
377 [ # # ][ # # ]: 0 : pSh->GetUniqueSectionName());
[ # # ]
378 : 0 : rtl::OUStringBuffer sLinkName;
379 [ # # ]: 0 : sLinkName.append(sfx2::cTokenSeperator);
380 [ # # ]: 0 : sLinkName.append(sfx2::cTokenSeperator);
381 [ # # ]: 0 : sLinkName.append(MASTER_LABEL);
382 [ # # ][ # # ]: 0 : aSect.SetLinkFileName(sLinkName.makeStringAndClear());
[ # # ][ # # ]
383 : 0 : aSect.SetProtectFlag(true);
384 [ # # ][ # # ]: 0 : pSh->Insert(aDotStr); // Dummytext to allocate the Section
[ # # ]
385 [ # # ]: 0 : pSh->SttDoc();
386 [ # # ]: 0 : pSh->EndDoc(sal_True); // Select everything in the frame
387 [ # # ][ # # ]: 0 : pSh->InsertSection(aSect);
388 : : }
389 [ # # ]: 0 : pSh->Pop( sal_False );
390 : : }
391 [ # # ]: 0 : if ( i + 1 != rItem.nRows )
392 [ # # ]: 0 : pSh->SplitNode(); // Small optimisation
393 [ # # ]: 0 : }
394 : : }
395 : : else
396 : : {
397 : : pFirstFlyFmt = bLabel ?
398 : : lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr,
399 : : static_cast< sal_uInt16 >(rItem.nCol - 1),
400 : 0 : static_cast< sal_uInt16 >(rItem.nRow - 1), sal_True, sal_False ) :
401 : : lcl_InsertBCText(*pSh, rItem, *pFmt,
402 : : static_cast< sal_uInt16 >(rItem.nCol - 1),
403 [ # # ][ # # ]: 0 : static_cast< sal_uInt16 >(rItem.nRow - 1), sal_False);
[ # # ]
404 : : }
405 : :
406 : : //fill the user fields
407 [ # # ]: 0 : if(!bLabel)
408 : : {
409 [ # # ][ # # ]: 0 : uno::Reference< frame::XModel > xModel = pSh->GetView().GetDocShell()->GetBaseModel();
410 : : OSL_ENSURE(pDialogFactory, "SwAbstractDialogFactory fail!");
411 [ # # ]: 0 : SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod ();
412 [ # # ]: 0 : SwLabDlgUpdateFieldInformation(xModel, rItem);
413 : : }
414 : :
415 : 0 : pFldMgr->SetEvalExpFlds(sal_True);
416 [ # # ]: 0 : pFldMgr->EvalExpFlds(pSh);
417 : :
418 [ # # ][ # # ]: 0 : delete pFldMgr;
419 : :
420 [ # # ]: 0 : pSh->GotoFly(pFirstFlyFmt->GetName(), FLYCNTTYPE_ALL, sal_False);
421 : :
422 [ # # ]: 0 : pSh->EndAllAction();
423 [ # # ][ # # ]: 0 : pSh->DoUndo( sal_True );
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ][ # # ]
[ # # ]
424 : : }
425 : :
426 [ # # ]: 0 : if( rItem.aWriting.indexOf( '<' ) >= 0 )
427 : : {
428 : : // Open database browser on recently used database
429 [ # # ][ # # ]: 0 : ShowDBObj( *pNewView, pSh->GetDBData() );
430 : : }
431 : :
432 [ # # ]: 0 : if( rItem.bSynchron )
433 : : {
434 : 0 : SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
435 : : OSL_ENSURE(pDisp, "No dispatcher in frame?");
436 [ # # ]: 0 : pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON);
437 : : }
438 [ # # ][ # # ]: 0 : rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
[ # # ][ # # ]
[ # # ][ # # ]
439 : : }
440 [ # # ][ # # ]: 0 : delete pDlg;
441 [ # # ][ # # ]: 0 : delete pNewDBMgr;
[ # # ][ # # ]
442 : 0 : }
443 : :
444 : :
445 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|