This is an automated email from the ASF dual-hosted git repository. mseidel pushed a commit to branch AOO42X in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/AOO42X by this push: new 349452d101 Cleanup 349452d101 is described below commit 349452d101e29f8d8303a5f001125234808ea83e Author: mseidel <msei...@apache.org> AuthorDate: Sun Jun 22 18:36:15 2025 +0200 Cleanup (cherry picked from commit 7daebb42ab830f5977cd81c8838aabddbd89bb3c) --- main/sw/source/ui/app/appenv.cxx | 203 +++++++++++++++++++-------------------- main/sw/source/ui/app/applab.cxx | 179 +++++++++++++++++----------------- 2 files changed, 188 insertions(+), 194 deletions(-) diff --git a/main/sw/source/ui/app/appenv.cxx b/main/sw/source/ui/app/appenv.cxx index 3a3d1f8046..9b627f3991 100644 --- a/main/sw/source/ui/app/appenv.cxx +++ b/main/sw/source/ui/app/appenv.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,20 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" @@ -84,11 +82,7 @@ #define ENV_INSERT RET_USER #define ENV_CANCEL SHRT_MAX - -// -------------------------------------------------------------------------- - - -// Funktion wird fuer Etiketten und Briefumschlaege benutzt! +// Funktion wird für Etiketten und Briefumschläge benutzt! // im applab.cxx und appenv.cxx String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText ) { @@ -128,14 +122,14 @@ String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText aLine.Erase( 0, nPos + 1); // sTmpText = aLine.Cut( 0, nPos + 1 ); - // Datenbankfelder muesen mind. 3 Punkte beinhalten! + // Datenbankfelder müssen mind. 3 Punkte beinhalten! String sDBName( sTmpText.Copy( 1, sTmpText.Len() - 2)); sal_uInt16 nCnt = sDBName.GetTokenCount('.'); if (nCnt >= 3) { - ::ReplacePoint(sDBName, sal_True); - SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyStr, 0, &rSh ); - rFldMgr.InsertFld( aData ); + ::ReplacePoint(sDBName, sal_True); + SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, aEmptyStr, 0, &rSh ); + rFldMgr.InsertFld( aData ); sRet = sDBName; bField = sal_True; } @@ -146,7 +140,7 @@ String InsertLabEnvText( SwWrtShell& rSh, SwFldMgr& rFldMgr, const String& rText } rSh.InsertLineBreak(); } - rSh.DelLeft(); // Letzten Linebreak wieder l???schen + rSh.DelLeft(); // Letzten Linebreak wieder löschen return sRet; } @@ -160,39 +154,38 @@ void lcl_CopyCollAttr(SwWrtShell* pOldSh, SwWrtShell* pNewSh, sal_uInt16 nCollId SwTxtFmtColl* pColl; for( sal_uInt16 nCnt = 0; nCnt < nCollCnt; ++nCnt ) if(nCollId == (pColl = &pOldSh->GetTxtFmtColl(nCnt))->GetPoolFmtId()) - pNewSh->GetTxtCollFromPool(nCollId)->SetFmtAttr(pColl->GetAttrSet()); + pNewSh->GetTxtCollFromPool(nCollId)->SetFmtAttr(pColl->GetAttrSet()); } // ---------------------------------------------------------------------------- - void SwModule::InsertEnv( SfxRequest& rReq ) { static sal_uInt16 nTitleNo = 0; SwDocShell *pMyDocSh; SfxViewFrame *pFrame; - SwView *pNewView; + SwView *pNewView; SwWrtShell *pOldSh, *pSh; - //aktuelle Shell besorgen + // aktuelle Shell besorgen pMyDocSh = (SwDocShell*) SfxObjectShell::Current(); pOldSh = pMyDocSh ? pMyDocSh->GetWrtShell() : 0; // Neues Dokument erzeugen (kein Show!) SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_STANDARD ) ); xDocSh->DoInitNew( 0 ); - pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); - pNewView = (SwView*) pFrame->GetViewShell(); - pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. - pSh = pNewView->GetWrtShellPtr(); + pFrame = SfxViewFrame::LoadHiddenDocument( *xDocSh, 0 ); + pNewView = (SwView*) pFrame->GetViewShell(); + pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. + pSh = pNewView->GetWrtShellPtr(); String aTmp( SW_RES(STR_ENV_TITLE) ); aTmp += String::CreateFromInt32( ++nTitleNo ); xDocSh->SetTitle( aTmp ); - // Ggf. alte Collections "Absender" und "Empfaenger" in neues + // Ggf. alte Collections "Absender" und "Empfänger" in neues // Dokument kopieren if ( pOldSh ) { @@ -203,13 +196,13 @@ static sal_uInt16 nTitleNo = 0; // SwEnvItem aus Config lesen SwEnvCfgItem aEnvCfg; - //Haben wir schon einen Briefumschlag. + // Haben wir schon einen Briefumschlag. sal_Bool bEnvChange = sal_False; SfxItemSet aSet(GetPool(), FN_ENVELOP, FN_ENVELOP, 0); aSet.Put(aEnvCfg.GetItem()); - SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + SfxPrinter* pTempPrinter = pSh->getIDocumentDeviceAccess()->getPrinter( true ); if(pOldSh ) { const SwPageDesc& rCurPageDesc = pOldSh->GetPageDesc(pOldSh->GetCurPageDesc()); @@ -217,13 +210,13 @@ static sal_uInt16 nTitleNo = 0; SwStyleNameMapper::FillUIName( RES_POOLPAGE_JAKET, sJacket ); bEnvChange = rCurPageDesc.GetName() == sJacket; - IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess(); - if( pIDDA_old->getPrinter( false ) ) + IDocumentDeviceAccess* pIDDA_old = pOldSh->getIDocumentDeviceAccess(); + if( pIDDA_old->getPrinter( false ) ) { - IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); - pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); + IDocumentDeviceAccess* pIDDA = pSh->getIDocumentDeviceAccess(); + pIDDA->setJobsetup( *pIDDA_old->getJobsetup() ); //#69563# if it isn't the same printer then the pointer has been invalidated! - pTempPrinter = pIDDA->getPrinter( true ); + pTempPrinter = pIDDA->getPrinter( true ); } pTempPrinter->SetPaperBin(rCurPageDesc.GetMaster().GetPaperBin().GetValue()); @@ -231,44 +224,44 @@ static sal_uInt16 nTitleNo = 0; Window *pParent = pOldSh ? pOldSh->GetWin() : 0; SfxAbstractTabDialog * pDlg=NULL; - short nMode = ENV_INSERT; - - SFX_REQUEST_ARG( rReq, pItem, SwEnvItem, FN_ENVELOP, sal_False ); - if ( !pItem ) - { - SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); - - pDlg = pFact->CreateSwEnvDlg( pParent, aSet, pOldSh, pTempPrinter, !bEnvChange, DLG_ENV ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); - nMode = pDlg->Execute(); - } - else - { - SFX_REQUEST_ARG( rReq, pBoolItem, SfxBoolItem, FN_PARAM_1, sal_False ); - if ( pBoolItem && pBoolItem->GetValue() ) - nMode = ENV_NEWDOC; - } + short nMode = ENV_INSERT; + + SFX_REQUEST_ARG( rReq, pItem, SwEnvItem, FN_ENVELOP, sal_False ); + if ( !pItem ) + { + SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "SwAbstractDialogFactory fail!"); + + pDlg = pFact->CreateSwEnvDlg( pParent, aSet, pOldSh, pTempPrinter, !bEnvChange, DLG_ENV ); + DBG_ASSERT(pDlg, "Dialogdiet fail!"); + nMode = pDlg->Execute(); + } + else + { + SFX_REQUEST_ARG( rReq, pBoolItem, SfxBoolItem, FN_PARAM_1, sal_False ); + if ( pBoolItem && pBoolItem->GetValue() ) + nMode = ENV_NEWDOC; + } if (nMode == ENV_NEWDOC || nMode == ENV_INSERT) { SwWait aWait( (SwDocShell&)*xDocSh, true ); // Dialog auslesen, Item in Config speichern - const SwEnvItem& rItem = pItem ? *pItem : (const SwEnvItem&) pDlg->GetOutputItemSet()->Get(FN_ENVELOP); + const SwEnvItem& rItem = pItem ? *pItem : (const SwEnvItem&) pDlg->GetOutputItemSet()->Get(FN_ENVELOP); aEnvCfg.GetItem() = rItem; aEnvCfg.Commit(); - //Wenn wir Drucken uebernehmen wir den eingestellten Jobsetup aus - //dem Dialog. Die Informationen muessen hier vor dem evtl. zerstoeren - //der neuen Shell gesetzt werden, weil deren Drucker an den Dialog - //gereicht wurde. + // Wenn wir Drucken übernehmen wir den eingestellten Jobsetup aus + // dem Dialog. Die Informationen müssen hier vor dem evtl. zerstören + // der neuen Shell gesetzt werden, weil deren Drucker an den Dialog + // gereicht wurde. if ( nMode != ENV_NEWDOC ) { ASSERT(pOldSh, "Kein Dokument - war 'Einfuegen' nicht disabled???"); - SvxPaperBinItem aItem( RES_PAPER_BIN ); - aItem.SetValue((sal_uInt8)pSh->getIDocumentDeviceAccess()->getPrinter(true)->GetPaperBin()); - pOldSh->GetPageDescFromPool(RES_POOLPAGE_JAKET)->GetMaster().SetFmtAttr(aItem); + SvxPaperBinItem aItem( RES_PAPER_BIN ); + aItem.SetValue((sal_uInt8)pSh->getIDocumentDeviceAccess()->getPrinter(true)->GetPaperBin()); + pOldSh->GetPageDescFromPool(RES_POOLPAGE_JAKET)->GetMaster().SetFmtAttr(aItem); } SwWrtShell *pTmp = nMode == ENV_INSERT ? pOldSh : pSh; @@ -283,14 +276,14 @@ static sal_uInt16 nTitleNo = 0; SetView(&pOldSh->GetView()); // Pointer auf oberste View restaurieren - //Neues Dok wieder loeschen + // Neues Dok wieder löschen xDocSh->DoClose(); pSh = pOldSh; - //#i4251# selected text or objects in the document should - //not be deleted on inserting envelopes - pSh->EnterStdMode(); + //#i4251# selected text or objects in the document should + //not be deleted on inserting envelopes + pSh->EnterStdMode(); // Los geht's (Einfuegen) - pSh->StartUndo(UNDO_UI_INSERT_ENVELOPE, NULL); + pSh->StartUndo(UNDO_UI_INSERT_ENVELOPE, NULL); pSh->StartAllAction(); pSh->SttEndDoc(sal_True); @@ -299,11 +292,11 @@ static sal_uInt16 nTitleNo = 0; // Folgevorlage: Seite 2 pFollow = pSh->GetPageDesc(pSh->GetCurPageDesc()).GetFollow(); - // Text der ersten Seite loeschen + // Text der ersten Seite löschen if ( !pSh->SttNxtPg(sal_True) ) pSh->EndPg(sal_True); pSh->DelRight(); - // Rahmen der ersten Seite loeschen + // Rahmen der ersten Seite löschen if( pSh->GotoFly( rSendMark ) ) { pSh->EnterSelFrmMode(); @@ -320,14 +313,14 @@ static sal_uInt16 nTitleNo = 0; // Folgevorlage: Seite 1 pFollow = &pSh->GetPageDesc(pSh->GetCurPageDesc()); - // Seitenumbruch einfuegen + // Seitenumbruch einfügen if ( pSh->IsCrsrInTbl() ) { pSh->SplitNode(); pSh->Right( CRSR_SKIP_CHARS, sal_False, 1, sal_False ); - SfxItemSet aBreakSet( pSh->GetAttrPool(), RES_BREAK, RES_BREAK, 0 ); - aBreakSet.Put( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) ); - pSh->SetTblAttr( aBreakSet ); + SfxItemSet aBreakSet( pSh->GetAttrPool(), RES_BREAK, RES_BREAK, 0 ); + aBreakSet.Put( SvxFmtBreakItem(SVX_BREAK_PAGE_BEFORE, RES_BREAK) ); + pSh->SetTblAttr( aBreakSet ); } else pSh->InsertPageBreak(0, sal_False); @@ -340,7 +333,7 @@ static sal_uInt16 nTitleNo = 0; pSh->StartAllAction(); pSh->DoUndo(sal_False); - // Neue Collections "Absender" und "Empfaenger" wieder in neues + // Neue Collections "Absender" und "Empfänger" wieder in neues // Dokument kopieren if ( pOldSh ) { @@ -350,7 +343,7 @@ static sal_uInt16 nTitleNo = 0; } SET_CURR_SHELL(pSh); - pSh->SetNewDoc(); // Performanceprobleme vermeiden + pSh->SetNewDoc(); // Performanceprobleme vermeiden // Flys dieser Seite merken SvPtrarr aFlyArr(0, 5); @@ -361,14 +354,14 @@ static sal_uInt16 nTitleNo = 0; SwPageDesc* pDesc = pSh->GetPageDescFromPool(RES_POOLPAGE_JAKET); SwFrmFmt& rFmt = pDesc->GetMaster(); - Printer *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + Printer *pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); - // Raender (setzen sich zusammen aus Shift-Offset und + // Ränder (setzen sich zusammen aus Shift-Offset und // Ausrichtung) Size aPaperSize = pPrt->PixelToLogic( pPrt->GetPaperSizePixel(), MAP_TWIP); if ( !aPaperSize.Width() && !aPaperSize.Height() ) - aPaperSize = SvxPaperInfo::GetPaperSize(PAPER_A4); + aPaperSize = SvxPaperInfo::GetPaperSize(PAPER_A4); if ( aPaperSize.Width() > aPaperSize.Height() ) Swap( aPaperSize ); @@ -391,26 +384,26 @@ static sal_uInt16 nTitleNo = 0; break; case ENV_VER_RGHT: break; } - SvxLRSpaceItem aLRMargin( RES_LR_SPACE ); - SvxULSpaceItem aULMargin( RES_UL_SPACE ); + SvxLRSpaceItem aLRMargin( RES_LR_SPACE ); + SvxULSpaceItem aULMargin( RES_UL_SPACE ); aLRMargin.SetLeft ((sal_uInt16) lLeft ); aULMargin.SetUpper((sal_uInt16) lUpper); aLRMargin.SetRight(0); aULMargin.SetLower(0); - rFmt.SetFmtAttr(aLRMargin); - rFmt.SetFmtAttr(aULMargin); + rFmt.SetFmtAttr(aLRMargin); + rFmt.SetFmtAttr(aULMargin); - // Kopf-, Fusszeilen - rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False))); + // Kopf-, Fußzeilen + rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False))); pDesc->ChgHeaderShare(sal_False); - rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False))); + rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False))); pDesc->ChgFooterShare(sal_False); // Seitennumerierung pDesc->SetUseOn(nsUseOnPage::PD_ALL); - // Einstellen der Seitengroesse - rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, + // Einstellen der Seitengröße + rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, nPageW + lLeft, nPageH + lUpper)); // Einstellen der Numerierungsart der Seite @@ -437,21 +430,21 @@ static sal_uInt16 nTitleNo = 0; pSh->ChgPageDesc( nPos, *pDesc); pSh->ChgCurPageDesc(*pDesc); - // Rahmen einfuegen + // Rahmen einfügen SwFlyFrmAttrMgr aMgr(sal_False, pSh, FRMMGR_TYPE_ENVELP); SwFldMgr aFldMgr; - aMgr.SetHeightSizeType(ATT_VAR_SIZE); + aMgr.SetHeightSizeType(ATT_VAR_SIZE); - //Defaults ueberschreiben! - aMgr.GetAttrSet().Put( SvxBoxItem(RES_BOX) ); - aMgr.SetULSpace( 0L, 0L ); - aMgr.SetLRSpace( 0L, 0L ); + // Defaults überschreiben! + aMgr.GetAttrSet().Put( SvxBoxItem(RES_BOX) ); + aMgr.SetULSpace( 0L, 0L ); + aMgr.SetLRSpace( 0L, 0L ); // Absender if (rItem.bSend) { pSh->SttEndDoc(sal_True); - aMgr.InsertFlyFrm(FLY_AT_PAGE, + aMgr.InsertFlyFrm(FLY_AT_PAGE, Point(rItem.lSendFromLeft + lLeft, rItem.lSendFromTop + lUpper), Size (rItem.lAddrFromLeft - rItem.lSendFromLeft, 0)); @@ -464,10 +457,10 @@ static sal_uInt16 nTitleNo = 0; aMgr.UpdateAttrMgr(); } - // Empfaenger + // Empfänger pSh->SttEndDoc(sal_True); - aMgr.InsertFlyFrm(FLY_AT_PAGE, + aMgr.InsertFlyFrm(FLY_AT_PAGE, Point(rItem.lAddrFromLeft + lLeft, rItem.lAddrFromTop + lUpper), Size (nPageW - rItem.lAddrFromLeft - 566, 0)); pSh->EnterSelFrmMode(); @@ -489,7 +482,7 @@ static sal_uInt16 nTitleNo = 0; if (nMode == ENV_NEWDOC) pSh->DoUndo(sal_True); else - pSh->EndUndo(UNDO_UI_INSERT_ENVELOPE); + pSh->EndUndo(UNDO_UI_INSERT_ENVELOPE); if (nMode == ENV_NEWDOC) { @@ -506,23 +499,23 @@ static sal_uInt16 nTitleNo = 0; }; pFrame->GetBindings().Invalidate( aInva ); - // Datenbankbeamer oeffnen - ShowDBObj(*pNewView, pSh->GetDBData()); + // Datenbankbeamer öffnen + ShowDBObj(*pNewView, pSh->GetDBData()); } } - if ( !pItem ) - { - rReq.AppendItem( rItem ); - if ( nMode == ENV_NEWDOC ) - rReq.AppendItem( SfxBoolItem( FN_PARAM_1, sal_True ) ); - } + if ( !pItem ) + { + rReq.AppendItem( rItem ); + if ( nMode == ENV_NEWDOC ) + rReq.AppendItem( SfxBoolItem( FN_PARAM_1, sal_True ) ); + } - rReq.Done(); + rReq.Done(); } - else //Abbruch + else //Abbruch { - rReq.Ignore(); + rReq.Ignore(); xDocSh->DoClose(); --nTitleNo; @@ -533,3 +526,5 @@ static sal_uInt16 nTitleNo = 0; } delete pDlg; } + +/* vim: set noet sw=4 ts=4: */ diff --git a/main/sw/source/ui/app/applab.cxx b/main/sw/source/ui/app/applab.cxx index d2f67c7e4c..415d56d593 100644 --- a/main/sw/source/ui/app/applab.cxx +++ b/main/sw/source/ui/app/applab.cxx @@ -1,5 +1,5 @@ /************************************************************** - * + * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -7,20 +7,18 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - * + * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" @@ -102,19 +100,19 @@ const SwFrmFmt *lcl_InsertBCText( SwWrtShell& rSh, const SwLabItem& rItem, sal_uInt16 nPhyPageNum, nVirtPageNum; rSh.GetPageNum( nPhyPageNum, nVirtPageNum ); - aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum)); + aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum)); if (!bPage) { aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist, - text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME )); + text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME )); aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist, - text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME )); + text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME )); } - if ( nCol == rItem.nCols -1 ) - { - aSet.Put( SvxLRSpaceItem( 0, 0, 0, 0, RES_LR_SPACE ) ); - } - const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfuegen + if ( nCol == rItem.nCols -1 ) + { + aSet.Put( SvxLRSpaceItem( 0, 0, 0, 0, RES_LR_SPACE ) ); + } + const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfügen ASSERT( pFmt, "Fly not inserted" ); rSh.UnSelectFrm(); //Rahmen wurde automatisch selektiert @@ -125,7 +123,7 @@ const SwFrmFmt *lcl_InsertBCText( SwWrtShell& rSh, const SwLabItem& rItem, if(!rItem.bSynchron || !(nCol|nRow)) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - DBG_ASSERT(pFact, "Dialogdiet fail!"); + DBG_ASSERT(pFact, "Dialogdiet fail!"); ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc( DLG_RENAME_GLOS ); if ( fnSetActGroup ) (*fnSetActGroup)( rItem.sGlossaryGroup ); @@ -142,23 +140,23 @@ const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem, sal_uInt16 nCol, sal_uInt16 nRow, sal_Bool bLast, sal_Bool bPage) { SfxItemSet aSet(rSh.GetAttrPool(), RES_ANCHOR, RES_ANCHOR, - RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, + RES_VERT_ORIENT, RES_VERT_ORIENT, RES_HORI_ORIENT, RES_HORI_ORIENT, RES_LR_SPACE, RES_LR_SPACE, 0 ); sal_uInt16 nPhyPageNum, nVirtPageNum; rSh.GetPageNum( nPhyPageNum, nVirtPageNum ); - aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum)); + aSet.Put(SwFmtAnchor(bPage ? FLY_AS_CHAR : FLY_AT_PAGE, nPhyPageNum)); if (!bPage) { aSet.Put(SwFmtHoriOrient(rItem.lLeft + nCol * rItem.lHDist, - text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME )); + text::HoriOrientation::NONE, text::RelOrientation::PAGE_FRAME )); aSet.Put(SwFmtVertOrient(rItem.lUpper + nRow * rItem.lVDist, - text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME )); + text::VertOrientation::NONE, text::RelOrientation::PAGE_FRAME )); + } + if ( nCol == rItem.nCols -1 ) + { + aSet.Put( SvxLRSpaceItem( 0, 0, 0, 0, RES_LR_SPACE ) ); } - if ( nCol == rItem.nCols -1 ) - { - aSet.Put( SvxLRSpaceItem( 0, 0, 0, 0, RES_LR_SPACE ) ); - } const SwFrmFmt *pFmt = rSh.NewFlyFrm(aSet, sal_True, &rFmt ); // Fly einfuegen ASSERT( pFmt, "Fly not inserted" ); @@ -170,9 +168,9 @@ const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem, String sDBName; if( (!rItem.bSynchron || !(nCol|nRow)) && (sDBName = InsertLabEnvText( rSh, rFldMgr, rItem.aWriting )).Len() && !bLast ) { - sDBName.SetToken( 3, DB_DELIM, String::CreateFromAscii("True")); - SwInsertFld_Data aData(TYP_DBNEXTSETFLD, 0, sDBName, aEmptyStr, 0, &rSh ); - rFldMgr.InsertFld( aData ); + sDBName.SetToken( 3, DB_DELIM, String::CreateFromAscii("True")); + SwInsertFld_Data aData(TYP_DBNEXTSETFLD, 0, sDBName, aEmptyStr, 0, &rSh ); + rFldMgr.InsertFld( aData ); } return pFmt; @@ -180,7 +178,6 @@ const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rItem, // ---------------------------------------------------------------------------- - void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel) { static sal_uInt16 nLabelTitleNo = 0; @@ -196,11 +193,11 @@ static sal_uInt16 nBCTitleNo = 0; SfxItemSet aSet( GetPool(), FN_LABEL, FN_LABEL, 0 ); aSet.Put( aLabCfg.GetItem() ); - SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create(); - DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!"); + SwAbstractDialogFactory* pDialogFactory = SwAbstractDialogFactory::Create(); + DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!"); - AbstarctSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg( 0, aSet, pNewDBMgr, bLabel, DLG_LAB ); - DBG_ASSERT(pDlg, "Dialogdiet fail!"); + AbstarctSwLabDlg* pDlg = pDialogFactory->CreateSwLabDlg( 0, aSet, pNewDBMgr, bLabel, DLG_LAB ); + DBG_ASSERT(pDlg, "Dialogdiet fail!"); if ( RET_OK == pDlg->Execute() ) { @@ -219,13 +216,13 @@ static sal_uInt16 nBCTitleNo = 0; if (pPrt) { SwDocShell *pDocSh = (SwDocShell*)(&*xDocSh); - pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); + pDocSh->getIDocumentDeviceAccess()->setJobsetup(pPrt->GetJobSetup()); } SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq ); - SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); - pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );//Damit SelectShell gerufen wird. + SwView *pNewView = (SwView*) pViewFrame->GetViewShell(); + pNewView->AttrChangedNotify( &pNewView->GetWrtShell() ); // Damit SelectShell gerufen wird. // Dokumenttitel setzen String aTmp; @@ -244,46 +241,46 @@ static sal_uInt16 nBCTitleNo = 0; pViewFrame->GetFrame().Appear(); // Shell ermitteln - SwWrtShell *pSh = pNewView->GetWrtShellPtr(); + SwWrtShell *pSh = pNewView->GetWrtShellPtr(); ASSERT( pSh, "missing WrtShell" ); - { // block for locks the dispatcher!! + { // block for locks the dispatcher!! SwWait aWait( (SwDocShell&)*xDocSh, true ); SET_CURR_SHELL(pSh); - pSh->SetLabelDoc(rItem.bSynchron); - pSh->DoUndo( sal_False ); + pSh->SetLabelDoc(rItem.bSynchron); + pSh->DoUndo( sal_False ); pSh->StartAllAction(); - pSh->SetNewDoc(); // Performanceprobleme vermeiden + pSh->SetNewDoc(); // Performanceprobleme vermeiden SwPageDesc aDesc = pSh->GetPageDesc( 0 ); SwFrmFmt& rFmt = aDesc.GetMaster(); - // Raender - SvxLRSpaceItem aLRMargin( RES_LR_SPACE ); - SvxULSpaceItem aULMargin( RES_UL_SPACE ); + // Ränder + SvxLRSpaceItem aLRMargin( RES_LR_SPACE ); + SvxULSpaceItem aULMargin( RES_UL_SPACE ); aLRMargin.SetLeft ((sal_uInt16) rItem.lLeft ); aULMargin.SetUpper((sal_uInt16) rItem.lUpper); - aLRMargin.SetRight(MINLAY/2); - aULMargin.SetLower(MINLAY/2); - rFmt.SetFmtAttr(aLRMargin); - rFmt.SetFmtAttr(aULMargin); + aLRMargin.SetRight(MINLAY/2); + aULMargin.SetLower(MINLAY/2); + rFmt.SetFmtAttr(aLRMargin); + rFmt.SetFmtAttr(aULMargin); // Kopf- und Fusszeilen - rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False))); + rFmt.SetFmtAttr(SwFmtHeader(sal_Bool(sal_False))); aDesc.ChgHeaderShare(sal_False); - rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False))); + rFmt.SetFmtAttr(SwFmtFooter(sal_Bool(sal_False))); aDesc.ChgFooterShare(sal_False); - aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Seitennumerierung + aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Seitennumerierung // Einstellen der Seitengroesse - rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, - rItem.lPaperWidth == 0 ? rItem.lLeft + rItem.nCols * rItem.lHDist + MINLAY : rItem.lPaperWidth, - rItem.bCont || rItem.lPaperHeight == 0 ? rItem.lUpper + rItem.nRows * rItem.lVDist + MINLAY : rItem.lPaperHeight)); + rFmt.SetFmtAttr(SwFmtFrmSize(ATT_FIX_SIZE, + rItem.lPaperWidth == 0 ? rItem.lLeft + rItem.nCols * rItem.lHDist + MINLAY : rItem.lPaperWidth, + rItem.bCont || rItem.lPaperHeight == 0 ? rItem.lUpper + rItem.nRows * rItem.lVDist + MINLAY : rItem.lPaperHeight)); // Numerierungsart SvxNumberType aType; @@ -294,12 +291,12 @@ static sal_uInt16 nBCTitleNo = 0; const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() ); aDesc.SetFollow( &rFollow ); - pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); - SvxPaperBinItem aItem( RES_PAPER_BIN ); + pPrt = pSh->getIDocumentDeviceAccess()->getPrinter( true ); + SvxPaperBinItem aItem( RES_PAPER_BIN ); aItem.SetValue((sal_Int8)pPrt->GetPaperBin()); - rFmt.SetFmtAttr(aItem); + rFmt.SetFmtAttr(aItem); - //determine orientation by calculating the width and height of the resulting page + // determine orientation by calculating the width and height of the resulting page const int nResultWidth = rItem.lHDist * (rItem.nCols - 1) + rItem.lWidth + rItem.lLeft; const int nResultHeight = rItem.lVDist * (rItem.nRows - 1) + rItem.lHeight + rItem.lUpper; aDesc.SetLandscape(nResultWidth > nResultHeight); @@ -310,21 +307,21 @@ static sal_uInt16 nBCTitleNo = 0; SwFldMgr* pFldMgr = new SwFldMgr; pFldMgr->SetEvalExpFlds(sal_False); - //fix(24446): Damit der Text der Ettiketten nicht im unbedruckbaren - //Bereich landet stellen wir entsprechende Raender ein. Um das Handling - //so Optimal wie moeglich zu halten stellen wir zunaechst an der - //aktuellen Absatzvorlage keinen Rand als hartes Attribut ein (Damit die - //Formatierung wg. der Zeichengeb. Rahmen passt. Dann stellen wir die - //Standarabsatzvorlage anhand des unbedruckbaren Bereiches ein. + // fix(24446): Damit der Text der Ettiketten nicht im unbedruckbaren + // Bereich landet stellen wir entsprechende Ränder ein. Um das Handling + // so Optimal wie möglich zu halten stellen wir zunächst an der + // aktuellen Absatzvorlage keinen Rand als hartes Attribut ein (Damit die + // Formatierung wg. der Zeichengeb. Rahmen passt. Dann stellen wir die + // Standardabsatzvorlage anhand des unbedruckbaren Bereiches ein. const long nMin = pPrt->GetPageOffset().X() - rItem.lLeft; if ( nMin > 0 ) { - SvxLRSpaceItem aLR( RES_LR_SPACE ); + SvxLRSpaceItem aLR( RES_LR_SPACE ); pSh->SetAttrItem( aLR ); SwFmt *pStandard = pSh->GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); aLR.SetLeft ( sal_uInt16(nMin) ); aLR.SetRight( sal_uInt16(nMin) ); - pStandard->SetFmtAttr( aLR ); + pStandard->SetFmtAttr( aLR ); } // Rahmenvorlage vorbereiten @@ -332,23 +329,23 @@ static sal_uInt16 nBCTitleNo = 0; SwFmtFrmSize aFrmSize( ATT_FIX_SIZE, rItem.lHDist - (rItem.lHDist-rItem.lWidth), rItem.lVDist - (rItem.lVDist-rItem.lHeight)); - pFmt->SetFmtAttr(aFrmSize); + pFmt->SetFmtAttr(aFrmSize); SvxLRSpaceItem aFrmLRSpace( 0, (sal_uInt16)(rItem.lHDist - rItem.lWidth), 0, 0, RES_LR_SPACE); - pFmt->SetFmtAttr(aFrmLRSpace); + pFmt->SetFmtAttr(aFrmLRSpace); SvxULSpaceItem aFrmULSpace( 0, (sal_uInt16)(rItem.lVDist - rItem.lHeight), RES_UL_SPACE); - pFmt->SetFmtAttr(aFrmULSpace); + pFmt->SetFmtAttr(aFrmULSpace); const SwFrmFmt *pFirstFlyFmt = 0; if ( rItem.bPage ) { SwFmtVertOrient aFrmVertOrient( pFmt->GetVertOrient() ); - aFrmVertOrient.SetVertOrient( text::VertOrientation::TOP ); - pFmt->SetFmtAttr(aFrmVertOrient); + aFrmVertOrient.SetVertOrient( text::VertOrientation::TOP ); + pFmt->SetFmtAttr(aFrmVertOrient); for ( sal_uInt16 i = 0; i < rItem.nRows; ++i ) { @@ -368,7 +365,7 @@ static sal_uInt16 nBCTitleNo = 0; if (rItem.bSynchron) { // if there is no content in the fly then - // dont leave the fly!!! + // don't leave the fly!!! pSh->Push(); pSh->SttDoc(); sal_Bool bInFly = 0 != pSh->WizzardGetFly(); @@ -380,20 +377,20 @@ static sal_uInt16 nBCTitleNo = 0; else pSh->SetMark(); // set only the mark - SwSectionData aSect(CONTENT_SECTION, - String::CreateFromAscii(MASTER_LABEL)); + SwSectionData aSect(CONTENT_SECTION, + String::CreateFromAscii(MASTER_LABEL)); pSh->InsertSection(aSect); } } else if (rItem.bSynchron) - { - SwSectionData aSect(FILE_LINK_SECTION, - pSh->GetUniqueSectionName()); - String sLinkName(sfx2::cTokenSeperator); - sLinkName += sfx2::cTokenSeperator; + { + SwSectionData aSect(FILE_LINK_SECTION, + pSh->GetUniqueSectionName()); + String sLinkName(sfx2::cTokenSeperator); + sLinkName += sfx2::cTokenSeperator; sLinkName += String::CreateFromAscii(MASTER_LABEL); aSect.SetLinkFileName(sLinkName); - aSect.SetProtectFlag(true); + aSect.SetProtectFlag(true); pSh->Insert(aDotStr); // Dummytext zum Zuweisen der Section pSh->SttDoc(); pSh->EndDoc(sal_True); // Alles im Rahmen selektieren @@ -409,19 +406,19 @@ static sal_uInt16 nBCTitleNo = 0; { pFirstFlyFmt = bLabel ? lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr, - static_cast< sal_uInt16 >(rItem.nCol - 1), - static_cast< sal_uInt16 >(rItem.nRow - 1), sal_True, sal_False ) : - lcl_InsertBCText(*pSh, rItem, *pFmt, - static_cast< sal_uInt16 >(rItem.nCol - 1), - static_cast< sal_uInt16 >(rItem.nRow - 1), sal_False); + static_cast< sal_uInt16 >(rItem.nCol - 1), + static_cast< sal_uInt16 >(rItem.nRow - 1), sal_True, sal_False ) : + lcl_InsertBCText(*pSh, rItem, *pFmt, + static_cast< sal_uInt16 >(rItem.nCol - 1), + static_cast< sal_uInt16 >(rItem.nRow - 1), sal_False); } - //fill the user fields + // fill the user fields if(!bLabel) { uno::Reference< frame::XModel > xModel = pSh->GetView().GetDocShell()->GetBaseModel(); - DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!"); - SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod (); + DBG_ASSERT(pDialogFactory, "SwAbstractDialogFactory fail!"); + SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod (); SwLabDlgUpdateFieldInformation(xModel, rItem); } @@ -434,12 +431,12 @@ static sal_uInt16 nBCTitleNo = 0; pSh->EndAllAction(); pSh->DoUndo( sal_True ); - } + } if( rItem.aWriting.indexOf( '<' ) >= 0 ) { - // Datenbankbrowser mit zuletzt verwendeter Datenbank oeffnen - ShowDBObj( *pNewView, pSh->GetDBData() ); + // Datenbankbrowser mit zuletzt verwendeter Datenbank öffnen + ShowDBObj( *pNewView, pSh->GetDBData() ); } if( rItem.bSynchron ) @@ -448,10 +445,12 @@ static sal_uInt16 nBCTitleNo = 0; ASSERT(pDisp, "Heute kein Dispatcher am Frame?"); pDisp->Execute(FN_SYNC_LABELS, SFX_CALLMODE_ASYNCHRON); } - rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD)); + rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD)); } delete pDlg; if( pNewDBMgr ) delete pNewDBMgr; } + +/* vim: set noet sw=4 ts=4: */