summaryrefslogtreecommitdiff
path: root/sw/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-11-20 09:25:11 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-11-21 11:32:43 +0100
commita60ffa6985dec32cc73032a7774f58694a6ee9a7 (patch)
treee94b9c586e6db1dde0a69aeddbe067bf8be2a47d /sw/source
parent466c3564058aae4946cdd21eab9dfef529554d90 (diff)
loplugin:flatten in sw
Change-Id: I64176f48d90303f078e326c8838da9eb2daf8126 Reviewed-on: https://gerrit.libreoffice.org/44937 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source')
-rw-r--r--sw/source/core/access/accmap.cxx201
-rw-r--r--sw/source/core/access/accpara.cxx49
-rw-r--r--sw/source/core/doc/doc.cxx211
-rw-r--r--sw/source/core/doc/docftn.cxx222
-rw-r--r--sw/source/core/doc/docredln.cxx115
-rw-r--r--sw/source/core/doc/tblrwcl.cxx91
-rw-r--r--sw/source/core/doc/textboxhelper.cxx117
-rw-r--r--sw/source/core/docnode/ndsect.cxx85
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx403
-rw-r--r--sw/source/core/edit/autofmt.cxx73
-rw-r--r--sw/source/core/edit/edfcol.cxx241
-rw-r--r--sw/source/core/edit/editsh.cxx43
-rw-r--r--sw/source/core/edit/edlingu.cxx310
-rw-r--r--sw/source/core/frmedt/fefly1.cxx67
-rw-r--r--sw/source/core/frmedt/feshview.cxx202
-rw-r--r--sw/source/core/frmedt/fews.cxx215
-rw-r--r--sw/source/core/layout/fly.cxx337
-rw-r--r--sw/source/core/layout/pagechg.cxx45
-rw-r--r--sw/source/core/layout/paintfrm.cxx336
-rw-r--r--sw/source/core/layout/sectfrm.cxx428
-rw-r--r--sw/source/core/layout/virtoutp.cxx71
-rw-r--r--sw/source/core/layout/wsfrm.cxx75
-rw-r--r--sw/source/core/table/swtable.cxx332
-rw-r--r--sw/source/core/text/frmpaint.cxx334
-rw-r--r--sw/source/core/text/inftxt.cxx75
-rw-r--r--sw/source/core/text/itrform2.cxx238
-rw-r--r--sw/source/core/text/porfld.cxx228
-rw-r--r--sw/source/core/text/portxt.cxx55
-rw-r--r--sw/source/core/txtnode/fntcache.cxx39
-rw-r--r--sw/source/core/undo/SwUndoPageDesc.cxx110
-rw-r--r--sw/source/core/unocore/unodraw.cxx63
-rw-r--r--sw/source/core/unocore/unoobj.cxx110
-rw-r--r--sw/source/core/view/vdraw.cxx113
-rw-r--r--sw/source/filter/html/htmlatr.cxx173
-rw-r--r--sw/source/filter/html/htmltab.cxx141
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx222
-rw-r--r--sw/source/filter/ww8/docxsdrexport.cxx85
-rw-r--r--sw/source/filter/ww8/rtfattributeoutput.cxx95
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx42
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx172
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx139
-rw-r--r--sw/source/filter/xml/xmltble.cxx51
-rw-r--r--sw/source/ui/config/optload.cxx47
-rw-r--r--sw/source/ui/config/optpage.cxx37
-rw-r--r--sw/source/ui/dbui/mmaddressblockpage.cxx115
-rw-r--r--sw/source/ui/dbui/mmresultdialogs.cxx53
-rw-r--r--sw/source/ui/dbui/selectdbtabledialog.cxx57
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx239
-rw-r--r--sw/source/ui/envelp/labfmt.cxx33
-rw-r--r--sw/source/ui/fldui/flddb.cxx183
-rw-r--r--sw/source/ui/fldui/flddok.cxx365
-rw-r--r--sw/source/ui/fldui/fldfunc.cxx285
-rw-r--r--sw/source/ui/fldui/fldref.cxx99
-rw-r--r--sw/source/ui/frmdlg/frmpage.cxx102
-rw-r--r--sw/source/ui/misc/pggrid.cxx99
-rw-r--r--sw/source/ui/table/tautofmt.cxx141
-rw-r--r--sw/source/uibase/app/applab.cxx403
-rw-r--r--sw/source/uibase/dialog/regionsw.cxx47
-rw-r--r--sw/source/uibase/docvw/AnnotationWin2.cxx35
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx514
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx112
-rw-r--r--sw/source/uibase/envelp/labimg.cxx43
-rw-r--r--sw/source/uibase/frmdlg/colex.cxx167
-rw-r--r--sw/source/uibase/shells/annotsh.cxx105
-rw-r--r--sw/source/uibase/shells/basesh.cxx155
-rw-r--r--sw/source/uibase/shells/drwtxtsh.cxx105
-rw-r--r--sw/source/uibase/shells/textfld.cxx104
-rw-r--r--sw/source/uibase/shells/textsh1.cxx89
-rw-r--r--sw/source/uibase/uiview/view.cxx375
-rw-r--r--sw/source/uibase/uiview/view2.cxx43
-rw-r--r--sw/source/uibase/utlui/glbltree.cxx145
-rw-r--r--sw/source/uibase/utlui/numfmtlb.cxx348
-rw-r--r--sw/source/uibase/utlui/unotools.cxx57
73 files changed, 5776 insertions, 5680 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 66a022d49356..98a50e784b5b 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1438,151 +1438,152 @@ void SwAccessibleMap::DoInvalidateShapeSelection(bool bInvalidateFocusMode /*=fa
pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
}
- if( pShapes )
- {
- typedef std::vector< ::rtl::Reference < ::accessibility::AccessibleShape > > VEC_SHAPE;
- VEC_SHAPE vecxShapeAdd;
- VEC_SHAPE vecxShapeRemove;
- int nCountSelectedShape=0;
+ if( !pShapes )
+ return;
- vcl::Window *pWin = GetShell()->GetWin();
- bool bFocused = pWin && pWin->HasFocus();
- SwAccessibleObjShape_Impl *pShape = pShapes;
- int nShapeCount = nShapes;
- while( nShapeCount )
+ typedef std::vector< ::rtl::Reference < ::accessibility::AccessibleShape > > VEC_SHAPE;
+ VEC_SHAPE vecxShapeAdd;
+ VEC_SHAPE vecxShapeRemove;
+ int nCountSelectedShape=0;
+
+ vcl::Window *pWin = GetShell()->GetWin();
+ bool bFocused = pWin && pWin->HasFocus();
+ SwAccessibleObjShape_Impl *pShape = pShapes;
+ int nShapeCount = nShapes;
+ while( nShapeCount )
+ {
+ if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
{
- if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
+ if( pShape < pSelShape )
{
- if( pShape < pSelShape )
+ if(pShape->second->ResetState( AccessibleStateType::SELECTED ))
{
- if(pShape->second->ResetState( AccessibleStateType::SELECTED ))
- {
- vecxShapeRemove.push_back(pShape->second);
- }
- pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ vecxShapeRemove.push_back(pShape->second);
}
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
}
- --nShapeCount;
- ++pShape;
}
+ --nShapeCount;
+ ++pShape;
+ }
- VEC_SHAPE::iterator vi =vecxShapeRemove.begin();
- for (; vi != vecxShapeRemove.end(); ++vi)
+ VEC_SHAPE::iterator vi =vecxShapeRemove.begin();
+ for (; vi != vecxShapeRemove.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = vi->get();
+ if (pAccShape)
{
- ::accessibility::AccessibleShape *pAccShape = vi->get();
- if (pAccShape)
- {
- pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any());
- }
+ pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any());
}
+ }
- pShape = pShapes;
+ pShape = pShapes;
- while( nShapes )
+ while( nShapes )
+ {
+ if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
{
- if (pShape->second.is() && IsInSameLevel(pShape->first, pFESh))
+ if( pShape >= pSelShape )
{
- if( pShape >= pSelShape )
- {
- //first fire focus event
- if( bFocused && 1 == nSelShapes )
- pShape->second->SetState( AccessibleStateType::FOCUSED );
- else
- pShape->second->ResetState( AccessibleStateType::FOCUSED );
+ //first fire focus event
+ if( bFocused && 1 == nSelShapes )
+ pShape->second->SetState( AccessibleStateType::FOCUSED );
+ else
+ pShape->second->ResetState( AccessibleStateType::FOCUSED );
- if(pShape->second->SetState( AccessibleStateType::SELECTED ))
- {
- vecxShapeAdd.push_back(pShape->second);
- }
- ++nCountSelectedShape;
+ if(pShape->second->SetState( AccessibleStateType::SELECTED ))
+ {
+ vecxShapeAdd.push_back(pShape->second);
}
+ ++nCountSelectedShape;
}
-
- --nShapes;
- ++pShape;
}
- const unsigned int SELECTION_WITH_NUM = 10;
- if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
+ --nShapes;
+ ++pShape;
+ }
+
+ const unsigned int SELECTION_WITH_NUM = 10;
+ if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
+ {
+ uno::Reference< XAccessible > xDoc = GetDocumentView( );
+ SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get());
+ if (pCont)
+ {
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+ pCont->FireAccessibleEvent(aEvent);
+ }
+ }
+ else
+ {
+ short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
+ if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
{
- uno::Reference< XAccessible > xDoc = GetDocumentView( );
- SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get());
- if (pCont)
- {
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
- pCont->FireAccessibleEvent(aEvent);
- }
+ nEventID = AccessibleEventId::SELECTION_CHANGED;
}
- else
+ vi = vecxShapeAdd.begin();
+ for (; vi != vecxShapeAdd.end(); ++vi)
{
- short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
- if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
- {
- nEventID = AccessibleEventId::SELECTION_CHANGED;
- }
- vi = vecxShapeAdd.begin();
- for (; vi != vecxShapeAdd.end(); ++vi)
+ ::accessibility::AccessibleShape *pAccShape = vi->get();
+ if (pAccShape)
{
- ::accessibility::AccessibleShape *pAccShape = vi->get();
- if (pAccShape)
- {
- pAccShape->CommitChange(nEventID, uno::Any(), uno::Any());
- }
+ pAccShape->CommitChange(nEventID, uno::Any(), uno::Any());
}
}
+ }
- vi = vecxShapeAdd.begin();
- for (; vi != vecxShapeAdd.end(); ++vi)
+ vi = vecxShapeAdd.begin();
+ for (; vi != vecxShapeAdd.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = vi->get();
+ if (pAccShape)
{
- ::accessibility::AccessibleShape *pAccShape = vi->get();
- if (pAccShape)
+ SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape());
+ SwFrameFormat *pFrameFormat = pObj ? FindFrameFormat( pObj ) : nullptr;
+ if (pFrameFormat)
{
- SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape());
- SwFrameFormat *pFrameFormat = pObj ? FindFrameFormat( pObj ) : nullptr;
- if (pFrameFormat)
+ const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
+ if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
{
- const SwFormatAnchor& rAnchor = pFrameFormat->GetAnchor();
- if( rAnchor.GetAnchorId() == RndStdIds::FLY_AS_CHAR )
+ uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+ if (xPara.is())
{
- uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
- if (xPara.is())
+ uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+ if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
{
- uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
- if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+ if (pAccPara)
{
- SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
- if (pAccPara)
- {
- m_setParaAdd.insert(pAccPara);
- }
+ m_setParaAdd.insert(pAccPara);
}
}
}
}
}
}
- vi = vecxShapeRemove.begin();
- for (; vi != vecxShapeRemove.end(); ++vi)
+ }
+ vi = vecxShapeRemove.begin();
+ for (; vi != vecxShapeRemove.end(); ++vi)
+ {
+ ::accessibility::AccessibleShape *pAccShape = vi->get();
+ if (pAccShape)
{
- ::accessibility::AccessibleShape *pAccShape = vi->get();
- if (pAccShape)
+ uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+ uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+ if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
{
- uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
- uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
- if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+ SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+ if (m_setParaAdd.count(pAccPara) == 0 )
{
- SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
- if (m_setParaAdd.count(pAccPara) == 0 )
- {
- m_setParaRemove.insert(pAccPara);
- }
+ m_setParaRemove.insert(pAccPara);
}
}
}
-
- delete[] pShapes;
}
+
+ delete[] pShapes;
+
}
//Marge with DoInvalidateShapeSelection
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index 84fded6f5a2c..0d60a9d09af3 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -480,34 +480,35 @@ void SwAccessibleParagraph::InvalidateCursorPos_()
}
vcl::Window *pWin = GetWindow();
- if( nOld != nNew )
- {
- // The cursor's node position is simulated by the focus!
- if( pWin && pWin->HasFocus() && -1 == nOld )
- FireStateChangedEvent( AccessibleStateType::FOCUSED, true );
+ if( nOld == nNew )
+ return;
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::CARET_CHANGED;
- aEvent.OldValue <<= nOld;
- aEvent.NewValue <<= nNew;
+ // The cursor's node position is simulated by the focus!
+ if( pWin && pWin->HasFocus() && -1 == nOld )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, true );
- FireAccessibleEvent( aEvent );
+ AccessibleEventObject aEvent;
+ aEvent.EventId = AccessibleEventId::CARET_CHANGED;
+ aEvent.OldValue <<= nOld;
+ aEvent.NewValue <<= nNew;
- if( pWin && pWin->HasFocus() && -1 == nNew )
- FireStateChangedEvent( AccessibleStateType::FOCUSED, false );
- //To send TEXT_SELECTION_CHANGED event
- sal_Int32 nStart=0;
- sal_Int32 nEnd =0;
- bool bCurSelection=GetSelection(nStart,nEnd);
- if(m_bLastHasSelection || bCurSelection )
- {
- aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
- aEvent.OldValue.clear();
- aEvent.NewValue.clear();
- FireAccessibleEvent(aEvent);
- }
- m_bLastHasSelection =bCurSelection;
+ FireAccessibleEvent( aEvent );
+
+ if( pWin && pWin->HasFocus() && -1 == nNew )
+ FireStateChangedEvent( AccessibleStateType::FOCUSED, false );
+ //To send TEXT_SELECTION_CHANGED event
+ sal_Int32 nStart=0;
+ sal_Int32 nEnd =0;
+ bool bCurSelection=GetSelection(nStart,nEnd);
+ if(m_bLastHasSelection || bCurSelection )
+ {
+ aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
+ aEvent.OldValue.clear();
+ aEvent.NewValue.clear();
+ FireAccessibleEvent(aEvent);
}
+ m_bLastHasSelection =bCurSelection;
+
}
void SwAccessibleParagraph::InvalidateFocus_()
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index d0c0839ec0ae..2d45bac285f0 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -777,131 +777,132 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
&& "print post-its without post-it data?");
const SetGetExpFields::size_type nPostItCount =
rData.HasPostItData() ? rData.m_pPostItFields->size() : 0;
- if (nPostItMode != SwPostItMode::NONE && nPostItCount > 0)
+ if (nPostItMode == SwPostItMode::NONE || nPostItCount <= 0)
+ return;
+
+ SET_CURR_SHELL( rData.m_pPostItShell.get() );
+
+ // clear document and move to end of it
+ SwDoc & rPostItDoc(*rData.m_pPostItShell->GetDoc());
+ SwPaM aPam(rPostItDoc.GetNodes().GetEndOfContent());
+ aPam.Move( fnMoveBackward, GoInDoc );
+ aPam.SetMark();
+ aPam.Move( fnMoveForward, GoInDoc );
+ rPostItDoc.getIDocumentContentOperations().DeleteRange( aPam );
+
+ const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 );
+
+ // For mode SwPostItMode::EndPage:
+ // maps a physical page number to the page number in post-it document that holds
+ // the first post-it for that physical page . Needed to relate the correct start frames
+ // from the post-it doc to the physical page of the document
+ std::map< sal_Int32, sal_Int32 > aPostItLastStartPageNum;
+
+ // add all post-its on valid pages within the page range to the
+ // temporary post-it document.
+ // Since the array of post-it fields is sorted by page and line number we will
+ // already get them in the correct order
+ sal_uInt16 nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0;
+ bool bIsFirstPostIt = true;
+ for (SetGetExpFields::size_type i = 0; i < nPostItCount; ++i)
{
- SET_CURR_SHELL( rData.m_pPostItShell.get() );
-
- // clear document and move to end of it
- SwDoc & rPostItDoc(*rData.m_pPostItShell->GetDoc());
- SwPaM aPam(rPostItDoc.GetNodes().GetEndOfContent());
- aPam.Move( fnMoveBackward, GoInDoc );
- aPam.SetMark();
- aPam.Move( fnMoveForward, GoInDoc );
- rPostItDoc.getIDocumentContentOperations().DeleteRange( aPam );
-
- const StringRangeEnumerator aRangeEnum( rData.GetPageRange(), 1, nDocPageCount, 0 );
-
- // For mode SwPostItMode::EndPage:
- // maps a physical page number to the page number in post-it document that holds
- // the first post-it for that physical page . Needed to relate the correct start frames
- // from the post-it doc to the physical page of the document
- std::map< sal_Int32, sal_Int32 > aPostItLastStartPageNum;
-
- // add all post-its on valid pages within the page range to the
- // temporary post-it document.
- // Since the array of post-it fields is sorted by page and line number we will
- // already get them in the correct order
- sal_uInt16 nVirtPg = 0, nLineNo = 0, nLastPageNum = 0, nPhyPageNum = 0;
- bool bIsFirstPostIt = true;
- for (SetGetExpFields::size_type i = 0; i < nPostItCount; ++i)
+ PostItField_& rPostIt = static_cast<PostItField_&>(*(*rData.m_pPostItFields)[ i ]);
+ nLastPageNum = nPhyPageNum;
+ nPhyPageNum = rPostIt.GetPageNo(
+ aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo );
+ if (nPhyPageNum)
{
- PostItField_& rPostIt = static_cast<PostItField_&>(*(*rData.m_pPostItFields)[ i ]);
- nLastPageNum = nPhyPageNum;
- nPhyPageNum = rPostIt.GetPageNo(
- aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo );
- if (nPhyPageNum)
- {
- // need to insert a page break?
- // In SwPostItMode::EndPage mode for each document page the following
- // post-it page needs to start on a new page
- const bool bNewPage = nPostItMode == SwPostItMode::EndPage &&
- !bIsFirstPostIt && nPhyPageNum != nLastPageNum;
+ // need to insert a page break?
+ // In SwPostItMode::EndPage mode for each document page the following
+ // post-it page needs to start on a new page
+ const bool bNewPage = nPostItMode == SwPostItMode::EndPage &&
+ !bIsFirstPostIt && nPhyPageNum != nLastPageNum;
- lcl_FormatPostIt( &rData.m_pPostItShell->GetDoc()->getIDocumentContentOperations(), aPam,
- rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo );
- bIsFirstPostIt = false;
+ lcl_FormatPostIt( &rData.m_pPostItShell->GetDoc()->getIDocumentContentOperations(), aPam,
+ rPostIt.GetPostIt(), bNewPage, bIsFirstPostIt, nVirtPg, nLineNo );
+ bIsFirstPostIt = false;
- if (nPostItMode == SwPostItMode::EndPage)
- {
- // get the correct number of current pages for the post-it document
- rData.m_pPostItShell->CalcLayout();
- const sal_Int32 nPages = rData.m_pPostItShell->GetPageCount();
- aPostItLastStartPageNum[ nPhyPageNum ] = nPages;
- }
+ if (nPostItMode == SwPostItMode::EndPage)
+ {
+ // get the correct number of current pages for the post-it document
+ rData.m_pPostItShell->CalcLayout();
+ const sal_Int32 nPages = rData.m_pPostItShell->GetPageCount();
+ aPostItLastStartPageNum[ nPhyPageNum ] = nPages;
}
}
+ }
- // format post-it doc to get correct number of pages
- rData.m_pPostItShell->CalcLayout();
+ // format post-it doc to get correct number of pages
+ rData.m_pPostItShell->CalcLayout();
- SwRootFrame* pPostItRoot = rData.m_pPostItShell->GetLayout();
- //tdf#103313 print dialog maxes out cpu as Idles never get to
- //complete this postitshell's desire to complete formatting
- pPostItRoot->ResetIdleFormat();
+ SwRootFrame* pPostItRoot = rData.m_pPostItShell->GetLayout();
+ //tdf#103313 print dialog maxes out cpu as Idles never get to
+ //complete this postitshell's desire to complete formatting
+ pPostItRoot->ResetIdleFormat();
- const sal_Int32 nPostItDocPageCount = rData.m_pPostItShell->GetPageCount();
+ const sal_Int32 nPostItDocPageCount = rData.m_pPostItShell->GetPageCount();
- if (nPostItMode == SwPostItMode::Only || nPostItMode == SwPostItMode::EndDoc)
- {
- // now add those post-it pages to the vector of pages to print
- // or replace them if only post-its should be printed
+ if (nPostItMode == SwPostItMode::Only || nPostItMode == SwPostItMode::EndDoc)
+ {
+ // now add those post-it pages to the vector of pages to print
+ // or replace them if only post-its should be printed
- if (nPostItMode == SwPostItMode::Only)
- {
- // no document page to be printed
- rData.GetPagesToPrint().clear();
- }
+ if (nPostItMode == SwPostItMode::Only)
+ {
+ // no document page to be printed
+ rData.GetPagesToPrint().clear();
+ }
- // now we just need to add the post-it pages to be printed to the
- // end of the vector of pages to print
- sal_Int32 nPageNum = 0;
- const SwPageFrame * pPageFrame = static_cast<SwPageFrame*>(pPostItRoot->Lower());
- while( pPageFrame && nPageNum < nPostItDocPageCount )
- {
- ++nPageNum;
- // negative page number indicates page is from the post-it doc
- rData.GetPagesToPrint().push_back( -nPageNum );
- pPageFrame = static_cast<const SwPageFrame*>(pPageFrame->GetNext());
- }
- OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" );
+ // now we just need to add the post-it pages to be printed to the
+ // end of the vector of pages to print
+ sal_Int32 nPageNum = 0;
+ const SwPageFrame * pPageFrame = static_cast<SwPageFrame*>(pPostItRoot->Lower());
+ while( pPageFrame && nPageNum < nPostItDocPageCount )
+ {
+ ++nPageNum;
+ // negative page number indicates page is from the post-it doc
+ rData.GetPagesToPrint().push_back( -nPageNum );
+ pPageFrame = static_cast<const SwPageFrame*>(pPageFrame->GetNext());
}
- else if (nPostItMode == SwPostItMode::EndPage)
+ OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" );
+ }
+ else if (nPostItMode == SwPostItMode::EndPage)
+ {
+ // the next step is to find all the pages from the post-it
+ // document that should be printed for a given physical page
+ // of the document
+
+ std::vector< sal_Int32 > aTmpPagesToPrint;
+ sal_Int32 nLastPostItPage(0);
+ const size_t nNum = rData.GetPagesToPrint().size();
+ for (size_t i = 0 ; i < nNum; ++i)
{
- // the next step is to find all the pages from the post-it
- // document that should be printed for a given physical page
- // of the document
-
- std::vector< sal_Int32 > aTmpPagesToPrint;
- sal_Int32 nLastPostItPage(0);
- const size_t nNum = rData.GetPagesToPrint().size();
- for (size_t i = 0 ; i < nNum; ++i)
+ // add the physical page to print from the document
+ const sal_Int32 nPhysPage = rData.GetPagesToPrint()[i];
+ aTmpPagesToPrint.push_back( nPhysPage );
+
+ // add the post-it document pages to print, i.e those
+ // post-it pages that have the data for the above physical page
+ std::map<sal_Int32, sal_Int32>::const_iterator const iter(
+ aPostItLastStartPageNum.find(nPhysPage));
+ if (iter != aPostItLastStartPageNum.end())
{
- // add the physical page to print from the document
- const sal_Int32 nPhysPage = rData.GetPagesToPrint()[i];
- aTmpPagesToPrint.push_back( nPhysPage );
-
- // add the post-it document pages to print, i.e those
- // post-it pages that have the data for the above physical page
- std::map<sal_Int32, sal_Int32>::const_iterator const iter(
- aPostItLastStartPageNum.find(nPhysPage));
- if (iter != aPostItLastStartPageNum.end())
+ for (sal_Int32 j = nLastPostItPage + 1;
+ j <= iter->second; ++j)
{
- for (sal_Int32 j = nLastPostItPage + 1;
- j <= iter->second; ++j)
- {
- // negative page number indicates page is from the
- aTmpPagesToPrint.push_back(-j); // post-it document
- }
- nLastPostItPage = iter->second;
+ // negative page number indicates page is from the
+ aTmpPagesToPrint.push_back(-j); // post-it document
}
+ nLastPostItPage = iter->second;
}
-
- // finally we need to assign those vectors to the resulting ones.
- // swapping the data should be more efficient than assigning since
- // we won't need the temporary vectors anymore
- rData.GetPagesToPrint().swap( aTmpPagesToPrint );
}
+
+ // finally we need to assign those vectors to the resulting ones.
+ // swapping the data should be more efficient than assigning since
+ // we won't need the temporary vectors anymore
+ rData.GetPagesToPrint().swap( aTmpPagesToPrint );
}
+
}
void SwDoc::CalculatePagePairsForProspectPrinting(
diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx
index afafe83ac769..3e333adcdecc 100644
--- a/sw/source/core/doc/docftn.cxx
+++ b/sw/source/core/doc/docftn.cxx
@@ -251,111 +251,43 @@ SwFootnoteInfo::SwFootnoteInfo() :
void SwDoc::SetFootnoteInfo(const SwFootnoteInfo& rInfo)
{
SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
- if( !(GetFootnoteInfo() == rInfo) )
- {
- const SwFootnoteInfo &rOld = GetFootnoteInfo();
+ if( GetFootnoteInfo() == rInfo )
+ return;
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld, this) );
- }
+ const SwFootnoteInfo &rOld = GetFootnoteInfo();
- bool bFootnotePos = rInfo.ePos != rOld.ePos;
- bool bFootnoteDesc = rOld.ePos == FTNPOS_CHAPTER &&
- rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
- bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis ||
- rInfo.aErgoSum != rOld.aErgoSum ||
- rInfo.aFormat.GetNumberingType() != rOld.aFormat.GetNumberingType() ||
- rInfo.GetPrefix() != rOld.GetPrefix() ||
- rInfo.GetSuffix() != rOld.GetSuffix();
- SwCharFormat *pOldChrFormat = rOld.GetCharFormat( *this ),
- *pNewChrFormat = rInfo.GetCharFormat( *this );
- bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat;
-
- *mpFootnoteInfo = rInfo;
-
- if (pTmpRoot)
- {
- std::set<SwRootFrame*> aAllLayouts = GetAllLayouts();
- if ( bFootnotePos )
- for( auto aLayout : aAllLayouts )
- aLayout->AllRemoveFootnotes();
- else
- {
- for( auto aLayout : aAllLayouts )
- aLayout->UpdateFootnoteNums();
- if ( bFootnoteDesc )
- for( auto aLayout : aAllLayouts )
- aLayout->CheckFootnotePageDescs(false);
- if ( bExtra )
- {
- // For messages regarding ErgoSum etc. we save the extra code and use the
- // available methods.
- SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs();
- for( size_t nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos )
- {
- SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
- const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
- if ( !rFootnote.IsEndNote() )
- pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
- }
- }
- }
- }
- if( FTNNUM_PAGE != rInfo.eNum )
- GetFootnoteIdxs().UpdateAllFootnote();
- else if( bFootnoteChrFormats )
- {
- SwFormatChg aOld( pOldChrFormat );
- SwFormatChg aNew( pNewChrFormat );
- mpFootnoteInfo->ModifyNotification( &aOld, &aNew );
- }
-
- // #i81002# no update during loading
- if ( !IsInReading() )
- {
- getIDocumentFieldsAccess().UpdateRefFields();
- }
- getIDocumentState().SetModified();
+ if (GetIDocumentUndoRedo().DoesUndo())
+ {
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoFootNoteInfo(rOld, this) );
}
-}
-void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
-{
- SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
- if( !(GetEndNoteInfo() == rInfo) )
+ bool bFootnotePos = rInfo.ePos != rOld.ePos;
+ bool bFootnoteDesc = rOld.ePos == FTNPOS_CHAPTER &&
+ rInfo.GetPageDesc( *this ) != rOld.GetPageDesc( *this );
+ bool bExtra = rInfo.aQuoVadis != rOld.aQuoVadis ||
+ rInfo.aErgoSum != rOld.aErgoSum ||
+ rInfo.aFormat.GetNumberingType() != rOld.aFormat.GetNumberingType() ||
+ rInfo.GetPrefix() != rOld.GetPrefix() ||
+ rInfo.GetSuffix() != rOld.GetSuffix();
+ SwCharFormat *pOldChrFormat = rOld.GetCharFormat( *this ),
+ *pNewChrFormat = rInfo.GetCharFormat( *this );
+ bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat;
+
+ *mpFootnoteInfo = rInfo;
+
+ if (pTmpRoot)
{
- if(GetIDocumentUndoRedo().DoesUndo())
- {
- SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo(), this ) );
- GetIDocumentUndoRedo().AppendUndo(pUndo);
- }
-
- bool bNumChg = rInfo.nFootnoteOffset != GetEndNoteInfo().nFootnoteOffset;
- // this seems to be an optimization: UpdateAllFootnote() is only called
- // if the offset changes; if the offset is the same,
- // but type/prefix/suffix changes, just set new numbers.
- bool const bExtra = !bNumChg &&
- ( (rInfo.aFormat.GetNumberingType() !=
- GetEndNoteInfo().aFormat.GetNumberingType())
- || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
- || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
- );
- bool bFootnoteDesc = rInfo.GetPageDesc( *this ) !=
- GetEndNoteInfo().GetPageDesc( *this );
- SwCharFormat *pOldChrFormat = GetEndNoteInfo().GetCharFormat( *this ),
- *pNewChrFormat = rInfo.GetCharFormat( *this );
- bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat;
-
- *mpEndNoteInfo = rInfo;
-
- if ( pTmpRoot )
+ std::set<SwRootFrame*> aAllLayouts = GetAllLayouts();
+ if ( bFootnotePos )
+ for( auto aLayout : aAllLayouts )
+ aLayout->AllRemoveFootnotes();
+ else
{
+ for( auto aLayout : aAllLayouts )
+ aLayout->UpdateFootnoteNums();
if ( bFootnoteDesc )
- {
- for( auto aLayout : GetAllLayouts() )
- aLayout->CheckFootnotePageDescs(true);
- }
+ for( auto aLayout : aAllLayouts )
+ aLayout->CheckFootnotePageDescs(false);
if ( bExtra )
{
// For messages regarding ErgoSum etc. we save the extra code and use the
@@ -365,27 +297,97 @@ void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
{
SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
- if ( rFootnote.IsEndNote() )
+ if ( !rFootnote.IsEndNote() )
pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
}
}
}
- if( bNumChg )
- GetFootnoteIdxs().UpdateAllFootnote();
- else if( bFootnoteChrFormats )
+ }
+ if( FTNNUM_PAGE != rInfo.eNum )
+ GetFootnoteIdxs().UpdateAllFootnote();
+ else if( bFootnoteChrFormats )
+ {
+ SwFormatChg aOld( pOldChrFormat );
+ SwFormatChg aNew( pNewChrFormat );
+ mpFootnoteInfo->ModifyNotification( &aOld, &aNew );
+ }
+
+ // #i81002# no update during loading
+ if ( !IsInReading() )
+ {
+ getIDocumentFieldsAccess().UpdateRefFields();
+ }
+ getIDocumentState().SetModified();
+
+}
+
+void SwDoc::SetEndNoteInfo(const SwEndNoteInfo& rInfo)
+{
+ SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
+ if( GetEndNoteInfo() == rInfo )
+ return;
+
+ if(GetIDocumentUndoRedo().DoesUndo())
+ {
+ SwUndo *const pUndo( new SwUndoEndNoteInfo( GetEndNoteInfo(), this ) );
+ GetIDocumentUndoRedo().AppendUndo(pUndo);
+ }
+
+ bool bNumChg = rInfo.nFootnoteOffset != GetEndNoteInfo().nFootnoteOffset;
+ // this seems to be an optimization: UpdateAllFootnote() is only called
+ // if the offset changes; if the offset is the same,
+ // but type/prefix/suffix changes, just set new numbers.
+ bool const bExtra = !bNumChg &&
+ ( (rInfo.aFormat.GetNumberingType() !=
+ GetEndNoteInfo().aFormat.GetNumberingType())
+ || (rInfo.GetPrefix() != GetEndNoteInfo().GetPrefix())
+ || (rInfo.GetSuffix() != GetEndNoteInfo().GetSuffix())
+ );
+ bool bFootnoteDesc = rInfo.GetPageDesc( *this ) !=
+ GetEndNoteInfo().GetPageDesc( *this );
+ SwCharFormat *pOldChrFormat = GetEndNoteInfo().GetCharFormat( *this ),
+ *pNewChrFormat = rInfo.GetCharFormat( *this );
+ bool bFootnoteChrFormats = pOldChrFormat != pNewChrFormat;
+
+ *mpEndNoteInfo = rInfo;
+
+ if ( pTmpRoot )
+ {
+ if ( bFootnoteDesc )
{
- SwFormatChg aOld( pOldChrFormat );
- SwFormatChg aNew( pNewChrFormat );
- mpEndNoteInfo->ModifyNotification( &aOld, &aNew );
+ for( auto aLayout : GetAllLayouts() )
+ aLayout->CheckFootnotePageDescs(true);
}
-
- // #i81002# no update during loading
- if ( !IsInReading() )
+ if ( bExtra )
{
- getIDocumentFieldsAccess().UpdateRefFields();
+ // For messages regarding ErgoSum etc. we save the extra code and use the
+ // available methods.
+ SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs();
+ for( size_t nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos )
+ {
+ SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
+ const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
+ if ( rFootnote.IsEndNote() )
+ pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumStr());
+ }
}
- getIDocumentState().SetModified();
}
+ if( bNumChg )
+ GetFootnoteIdxs().UpdateAllFootnote();
+ else if( bFootnoteChrFormats )
+ {
+ SwFormatChg aOld( pOldChrFormat );
+ SwFormatChg aNew( pNewChrFormat );
+ mpEndNoteInfo->ModifyNotification( &aOld, &aNew );
+ }
+
+ // #i81002# no update during loading
+ if ( !IsInReading() )
+ {
+ getIDocumentFieldsAccess().UpdateRefFields();
+ }
+ getIDocumentState().SetModified();
+
}
bool SwDoc::SetCurFootnote( const SwPaM& rPam, const OUString& rNumStr,
diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx
index 347c8cc8c91f..7644a107200e 100644
--- a/sw/source/core/doc/docredln.cxx
+++ b/sw/source/core/doc/docredln.cxx
@@ -1364,78 +1364,79 @@ void SwRangeRedline::MoveToSection()
void SwRangeRedline::CopyToSection()
{
- if( !pContentSect )
- {
- const SwPosition* pStt = Start(),
- * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
+ if( pContentSect )
+ return;
- SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode();
- SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode();
+ const SwPosition* pStt = Start(),
+ * pEnd = pStt == GetPoint() ? GetMark() : GetPoint();
- SwStartNode* pSttNd;
- SwDoc* pDoc = GetDoc();
- SwNodes& rNds = pDoc->GetNodes();
+ SwContentNode* pCSttNd = pStt->nNode.GetNode().GetContentNode();
+ SwContentNode* pCEndNd = pEnd->nNode.GetNode().GetContentNode();
- bool bSaveCopyFlag = pDoc->IsCopyIsMove(),
- bSaveRdlMoveFlg = pDoc->getIDocumentRedlineAccess().IsRedlineMove();
- pDoc->SetCopyIsMove( true );
+ SwStartNode* pSttNd;
+ SwDoc* pDoc = GetDoc();
+ SwNodes& rNds = pDoc->GetNodes();
- // The IsRedlineMove() flag causes the behaviour of the
- // SwDoc::_CopyFlyInFly method to change, which will eventually be
- // called by the pDoc->Copy line below (through SwDoc::Copy_,
- // SwDoc::CopyWithFlyInFly). This rather obscure bugfix
- // apparently never really worked.
- pDoc->getIDocumentRedlineAccess().SetRedlineMove( pStt->nContent == 0 );
+ bool bSaveCopyFlag = pDoc->IsCopyIsMove(),
+ bSaveRdlMoveFlg = pDoc->getIDocumentRedlineAccess().IsRedlineMove();
+ pDoc->SetCopyIsMove( true );
- if( pCSttNd )
- {
- SwTextFormatColl* pColl = (pCSttNd && pCSttNd->IsTextNode() )
- ? pCSttNd->GetTextNode()->GetTextColl()
- : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD);
+ // The IsRedlineMove() flag causes the behaviour of the
+ // SwDoc::_CopyFlyInFly method to change, which will eventually be
+ // called by the pDoc->Copy line below (through SwDoc::Copy_,
+ // SwDoc::CopyWithFlyInFly). This rather obscure bugfix
+ // apparently never really worked.
+ pDoc->getIDocumentRedlineAccess().SetRedlineMove( pStt->nContent == 0 );
- pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ),
- SwNormalStartNode, pColl );
+ if( pCSttNd )
+ {
+ SwTextFormatColl* pColl = (pCSttNd && pCSttNd->IsTextNode() )
+ ? pCSttNd->GetTextNode()->GetTextColl()
+ : pDoc->getIDocumentStylePoolAccess().GetTextCollFromPool(RES_POOLCOLL_STANDARD);
- SwNodeIndex aNdIdx( *pSttNd, 1 );
- SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode();
- SwPosition aPos( aNdIdx, SwIndex( pTextNd ));
- pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true );
+ pSttNd = rNds.MakeTextSection( SwNodeIndex( rNds.GetEndOfRedlines() ),
+ SwNormalStartNode, pColl );
- // Take over the style from the EndNode if needed
- // We don't want this in Doc::Copy
- if( pCEndNd && pCEndNd != pCSttNd )
+ SwNodeIndex aNdIdx( *pSttNd, 1 );
+ SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode();
+ SwPosition aPos( aNdIdx, SwIndex( pTextNd ));
+ pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true );
+
+ // Take over the style from the EndNode if needed
+ // We don't want this in Doc::Copy
+ if( pCEndNd && pCEndNd != pCSttNd )
+ {
+ SwContentNode* pDestNd = aPos.nNode.GetNode().GetContentNode();
+ if( pDestNd )
{
- SwContentNode* pDestNd = aPos.nNode.GetNode().GetContentNode();
- if( pDestNd )
- {
- if( pDestNd->IsTextNode() && pCEndNd->IsTextNode() )
- pCEndNd->GetTextNode()->CopyCollFormat(*pDestNd->GetTextNode());
- else
- pDestNd->ChgFormatColl( pCEndNd->GetFormatColl() );
- }
+ if( pDestNd->IsTextNode() && pCEndNd->IsTextNode() )
+ pCEndNd->GetTextNode()->CopyCollFormat(*pDestNd->GetTextNode());
+ else
+ pDestNd->ChgFormatColl( pCEndNd->GetFormatColl() );
}
}
+ }
+ else
+ {
+ pSttNd = SwNodes::MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ) );
+
+ if( pCEndNd )
+ {
+ SwPosition aPos( *pSttNd->EndOfSectionNode() );
+ pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true );
+ }
else
{
- pSttNd = SwNodes::MakeEmptySection( SwNodeIndex( rNds.GetEndOfRedlines() ) );
-
- if( pCEndNd )
- {
- SwPosition aPos( *pSttNd->EndOfSectionNode() );
- pDoc->getIDocumentContentOperations().CopyRange( *this, aPos, /*bCopyAll=*/false, /*bCheckPos=*/true );
- }
- else
- {
- SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() );
- SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 );
- pDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos );
- }
+ SwNodeIndex aInsPos( *pSttNd->EndOfSectionNode() );
+ SwNodeRange aRg( pStt->nNode, 0, pEnd->nNode, 1 );
+ pDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos );
}
- pContentSect = new SwNodeIndex( *pSttNd );
-
- pDoc->SetCopyIsMove( bSaveCopyFlag );
- pDoc->getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg );
}
+ pContentSect = new SwNodeIndex( *pSttNd );
+
+ pDoc->SetCopyIsMove( bSaveCopyFlag );
+ pDoc->getIDocumentRedlineAccess().SetRedlineMove( bSaveRdlMoveFlg );
+
}
void SwRangeRedline::DelCopyOfSection(size_t nMyPos)
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index 626bf644a6bc..6ce5831ff6de 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -901,61 +901,62 @@ lcl_SaveUpperLowerBorder( SwTable& rTable, const SwTableBox& rBox,
const SvxBoxItem& rBoxItem = rBox.GetFrameFormat()->GetBox();
// then the top/bottom edges
- if( rBoxItem.GetTop() || rBoxItem.GetBottom() )
- {
- bool bChgd = false;
- const SwTableLines* pTableLns;
- if( pUpperBox )
- pTableLns = &pUpperBox->GetTabLines();
- else
- pTableLns = &rTable.GetTabLines();
+ if( !rBoxItem.GetTop() && !rBoxItem.GetBottom() )
+ return;
+
+ bool bChgd = false;
+ const SwTableLines* pTableLns;
+ if( pUpperBox )
+ pTableLns = &pUpperBox->GetTabLines();
+ else
+ pTableLns = &rTable.GetTabLines();
- sal_uInt16 nLnPos = pTableLns->GetPos( pLine );
+ sal_uInt16 nLnPos = pTableLns->GetPos( pLine );
- // Calculate the attribute position of the top-be-deleted Box and then
- // search in the top/bottom Line of the respective counterparts.
- SwTwips nBoxStt = 0;
- for( sal_uInt16 n = 0; n < nDelPos; ++n )
- nBoxStt += rTableBoxes[ n ]->GetFrameFormat()->GetFrameSize().GetWidth();
- SwTwips nBoxWidth = rBox.GetFrameFormat()->GetFrameSize().GetWidth();
+ // Calculate the attribute position of the top-be-deleted Box and then
+ // search in the top/bottom Line of the respective counterparts.
+ SwTwips nBoxStt = 0;
+ for( sal_uInt16 n = 0; n < nDelPos; ++n )
+ nBoxStt += rTableBoxes[ n ]->GetFrameFormat()->GetFrameSize().GetWidth();
+ SwTwips nBoxWidth = rBox.GetFrameFormat()->GetFrameSize().GetWidth();
- SwTableBox *pPrvBox = nullptr, *pNxtBox = nullptr;
- if( nLnPos ) // Predecessor?
- pPrvBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth,
- nLnPos, false, pAllDelBoxes, pCurPos );
+ SwTableBox *pPrvBox = nullptr, *pNxtBox = nullptr;
+ if( nLnPos ) // Predecessor?
+ pPrvBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth,
+ nLnPos, false, pAllDelBoxes, pCurPos );
- if( nLnPos + 1 < (sal_uInt16)pTableLns->size() ) // Successor?
- pNxtBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth,
- nLnPos, true, pAllDelBoxes, pCurPos );
+ if( nLnPos + 1 < (sal_uInt16)pTableLns->size() ) // Successor?
+ pNxtBox = ::lcl_FndNxtPrvDelBox( *pTableLns, nBoxStt, nBoxWidth,
+ nLnPos, true, pAllDelBoxes, pCurPos );
- if( pNxtBox && pNxtBox->GetSttNd() )
+ if( pNxtBox && pNxtBox->GetSttNd() )
+ {
+ const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrameFormat()->GetBox();
+ if( !rNxtBoxItem.GetTop() && ( !pPrvBox ||
+ !pPrvBox->GetFrameFormat()->GetBox().GetBottom()) )
{
- const SvxBoxItem& rNxtBoxItem = pNxtBox->GetFrameFormat()->GetBox();
- if( !rNxtBoxItem.GetTop() && ( !pPrvBox ||
- !pPrvBox->GetFrameFormat()->GetBox().GetBottom()) )
- {
- SvxBoxItem aTmp( rNxtBoxItem );
- aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
- : rBoxItem.GetBottom(),
- SvxBoxItemLine::TOP );
- rShareFormats.SetAttr( *pNxtBox, aTmp );
- bChgd = true;
- }
+ SvxBoxItem aTmp( rNxtBoxItem );
+ aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
+ : rBoxItem.GetBottom(),
+ SvxBoxItemLine::TOP );
+ rShareFormats.SetAttr( *pNxtBox, aTmp );
+ bChgd = true;
}
- if( !bChgd && pPrvBox && pPrvBox->GetSttNd() )
+ }
+ if( !bChgd && pPrvBox && pPrvBox->GetSttNd() )
+ {
+ const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrameFormat()->GetBox();
+ if( !rPrvBoxItem.GetTop() && ( !pNxtBox ||
+ !pNxtBox->GetFrameFormat()->GetBox().GetTop()) )
{
- const SvxBoxItem& rPrvBoxItem = pPrvBox->GetFrameFormat()->GetBox();
- if( !rPrvBoxItem.GetTop() && ( !pNxtBox ||
- !pNxtBox->GetFrameFormat()->GetBox().GetTop()) )
- {
- SvxBoxItem aTmp( rPrvBoxItem );
- aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
- : rBoxItem.GetBottom(),
- SvxBoxItemLine::BOTTOM );
- rShareFormats.SetAttr( *pPrvBox, aTmp );
- }
+ SvxBoxItem aTmp( rPrvBoxItem );
+ aTmp.SetLine( rBoxItem.GetTop() ? rBoxItem.GetTop()
+ : rBoxItem.GetBottom(),
+ SvxBoxItemLine::BOTTOM );
+ rShareFormats.SetAttr( *pPrvBox, aTmp );
}
}
+
}
bool SwTable::DeleteSel(
diff --git a/sw/source/core/doc/textboxhelper.cxx b/sw/source/core/doc/textboxhelper.cxx
index 2bc005b247c3..050d5339961c 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -49,66 +49,67 @@ using namespace com::sun::star;
void SwTextBoxHelper::create(SwFrameFormat* pShape)
{
// If TextBox wasn't enabled previously
- if (!pShape->GetAttrSet().HasItem(RES_CNTNT))
- {
- // Create the associated TextFrame and insert it into the document.
- uno::Reference<text::XTextContent> xTextFrame(SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, *pShape->GetDoc()), uno::UNO_QUERY);
- uno::Reference<text::XTextDocument> xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
- uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY);
- xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
-
- // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
- uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);
- auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
- assert(nullptr != pTextFrame);
- SwFrameFormat* pFormat = pTextFrame->GetFrameFormat();
-
- assert(nullptr != dynamic_cast<SwDrawFrameFormat*>(pShape));
- assert(nullptr != dynamic_cast<SwFlyFrameFormat*>(pFormat));
-
- pShape->SetOtherTextBoxFormat(pFormat);
- pFormat->SetOtherTextBoxFormat(pShape);
-
- // Initialize properties.
- uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY);
- uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2());
- xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder);
- xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder);
- xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder);
- xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder);
-
- xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(sal_Int32(100)));
-
- xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::makeAny(text::SizeType::FIX));
-
- uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY);
- xNamed->setName(pShape->GetDoc()->GetUniqueFrameName());
-
- // Link its text range to the original shape.
- uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW);
- SwUnoInternalPaM aInternalPaM(*pShape->GetDoc());
- if (sw::XTextRangeToSwPaM(aInternalPaM, xTextBox))
- {
- SwAttrSet aSet(pShape->GetAttrSet());
- SwFormatContent aContent(aInternalPaM.GetNode().StartOfSectionNode());
- aSet.Put(aContent);
- pShape->SetFormatAttr(aSet);
- }
+ if (pShape->GetAttrSet().HasItem(RES_CNTNT))
+ return;
+
+ // Create the associated TextFrame and insert it into the document.
+ uno::Reference<text::XTextContent> xTextFrame(SwXServiceProvider::MakeInstance(SwServiceType::TypeTextFrame, *pShape->GetDoc()), uno::UNO_QUERY);
+ uno::Reference<text::XTextDocument> xTextDocument(pShape->GetDoc()->GetDocShell()->GetBaseModel(), uno::UNO_QUERY);
+ uno::Reference<text::XTextContentAppend> xTextContentAppend(xTextDocument->getText(), uno::UNO_QUERY);
+ xTextContentAppend->appendTextContent(xTextFrame, uno::Sequence<beans::PropertyValue>());
+
+ // Link FLY and DRAW formats, so it becomes a text box (needed for syncProperty calls).
+ uno::Reference<text::XTextFrame> xRealTextFrame(xTextFrame, uno::UNO_QUERY);
+ auto pTextFrame = dynamic_cast<SwXTextFrame*>(xRealTextFrame.get());
+ assert(nullptr != pTextFrame);
+ SwFrameFormat* pFormat = pTextFrame->GetFrameFormat();
+
+ assert(nullptr != dynamic_cast<SwDrawFrameFormat*>(pShape));
+ assert(nullptr != dynamic_cast<SwFlyFrameFormat*>(pFormat));
+
+ pShape->SetOtherTextBoxFormat(pFormat);
+ pFormat->SetOtherTextBoxFormat(pShape);
- // Also initialize the properties, which are not constant, but inherited from the shape's ones.
- uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(), uno::UNO_QUERY);
- syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize()));
-
- uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
- syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT));
- syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION));
- syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT));
- syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
- syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
- syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
- syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
- syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST));
+ // Initialize properties.
+ uno::Reference<beans::XPropertySet> xPropertySet(xTextFrame, uno::UNO_QUERY);
+ uno::Any aEmptyBorder = uno::makeAny(table::BorderLine2());
+ xPropertySet->setPropertyValue(UNO_NAME_TOP_BORDER, aEmptyBorder);
+ xPropertySet->setPropertyValue(UNO_NAME_BOTTOM_BORDER, aEmptyBorder);
+ xPropertySet->setPropertyValue(UNO_NAME_LEFT_BORDER, aEmptyBorder);
+ xPropertySet->setPropertyValue(UNO_NAME_RIGHT_BORDER, aEmptyBorder);
+
+ xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(sal_Int32(100)));
+
+ xPropertySet->setPropertyValue(UNO_NAME_SIZE_TYPE, uno::makeAny(text::SizeType::FIX));
+
+ uno::Reference<container::XNamed> xNamed(xTextFrame, uno::UNO_QUERY);
+ xNamed->setName(pShape->GetDoc()->GetUniqueFrameName());
+
+ // Link its text range to the original shape.
+ uno::Reference<text::XTextRange> xTextBox(xTextFrame, uno::UNO_QUERY_THROW);
+ SwUnoInternalPaM aInternalPaM(*pShape->GetDoc());
+ if (sw::XTextRangeToSwPaM(aInternalPaM, xTextBox))
+ {
+ SwAttrSet aSet(pShape->GetAttrSet());
+ SwFormatContent aContent(aInternalPaM.GetNode().StartOfSectionNode());
+ aSet.Put(aContent);
+ pShape->SetFormatAttr(aSet);
}
+
+ // Also initialize the properties, which are not constant, but inherited from the shape's ones.
+ uno::Reference<drawing::XShape> xShape(pShape->FindRealSdrObject()->getUnoShape(), uno::UNO_QUERY);
+ syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_SIZE, uno::makeAny(xShape->getSize()));
+
+ uno::Reference<beans::XPropertySet> xShapePropertySet(xShape, uno::UNO_QUERY);
+ syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT));
+ syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_RELATION));
+ syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_ORIENT, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT));
+ syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_RELATION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_RELATION));
+ syncProperty(pShape, RES_HORI_ORIENT, MID_HORIORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_HORI_ORIENT_POSITION));
+ syncProperty(pShape, RES_VERT_ORIENT, MID_VERTORIENT_POSITION, xShapePropertySet->getPropertyValue(UNO_NAME_VERT_ORIENT_POSITION));
+ syncProperty(pShape, RES_FRM_SIZE, MID_FRMSIZE_IS_AUTO_HEIGHT, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT));
+ syncProperty(pShape, RES_TEXT_VERT_ADJUST, 0, xShapePropertySet->getPropertyValue(UNO_NAME_TEXT_VERT_ADJUST));
+
}
void SwTextBoxHelper::destroy(SwFrameFormat* pShape)
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 9b72c028dbbe..8c8edb5ed218 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -1292,58 +1292,59 @@ bool SwSectionNode::IsContentHidden() const
void SwSectionNode::NodesArrChgd()
{
SwSectionFormat *const pFormat = m_pSection->GetFormat();
- if( pFormat )
- {
- SwNodes& rNds = GetNodes();
- SwDoc* pDoc = pFormat->GetDoc();
+ if( !pFormat )
+ return;
- if( !rNds.IsDocNodes() )
- {
- SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
- pFormat->ModifyNotification( &aMsgHint, &aMsgHint );
- }
+ SwNodes& rNds = GetNodes();
+ SwDoc* pDoc = pFormat->GetDoc();
- pFormat->LockModify();
- pFormat->SetFormatAttr( SwFormatContent( this ));
- pFormat->UnlockModify();
+ if( !rNds.IsDocNodes() )
+ {
+ SwPtrMsgPoolItem aMsgHint( RES_REMOVE_UNO_OBJECT, pFormat );
+ pFormat->ModifyNotification( &aMsgHint, &aMsgHint );
+ }
- SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode();
- // set the correct parent from the new section
- pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat()
- : pDoc->GetDfltFrameFormat() );
+ pFormat->LockModify();
+ pFormat->SetFormatAttr( SwFormatContent( this ));
+ pFormat->UnlockModify();
- // Set the right StartNode for all in this Area
- sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex();
- for( sal_uLong n = nStart; n < nEnde; ++n )
- // Make up the Format's nesting
- if( nullptr != ( pSectNd = rNds[ n ]->GetSectionNode() ) )
- {
- pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat );
- n = pSectNd->EndOfSectionIndex();
- }
+ SwSectionNode* pSectNd = StartOfSectionNode()->FindSectionNode();
+ // set the correct parent from the new section
+ pFormat->SetDerivedFrom( pSectNd ? pSectNd->GetSection().GetFormat()
+ : pDoc->GetDfltFrameFormat() );
- // Moving Nodes to the UndoNodes array?
- if( rNds.IsDocNodes() )
+ // Set the right StartNode for all in this Area
+ sal_uLong nStart = GetIndex()+1, nEnde = EndOfSectionIndex();
+ for( sal_uLong n = nStart; n < nEnde; ++n )
+ // Make up the Format's nesting
+ if( nullptr != ( pSectNd = rNds[ n ]->GetSectionNode() ) )
{
- OSL_ENSURE( pDoc == GetDoc(),
- "Moving to different Documents?" );
- if( m_pSection->IsLinkType() ) // Remove the Link
- m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE );
-
- if (m_pSection->IsServer())
- pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() );
+ pSectNd->GetSection().GetFormat()->SetDerivedFrom( pFormat );
+ n = pSectNd->EndOfSectionIndex();
}
- else
+
+ // Moving Nodes to the UndoNodes array?
+ if( rNds.IsDocNodes() )
+ {
+ OSL_ENSURE( pDoc == GetDoc(),
+ "Moving to different Documents?" );
+ if( m_pSection->IsLinkType() ) // Remove the Link
+ m_pSection->CreateLink( pDoc->getIDocumentLayoutAccess().GetCurrentViewShell() ? CREATE_CONNECT : CREATE_NONE );
+
+ if (m_pSection->IsServer())
+ pDoc->getIDocumentLinksAdministration().GetLinkManager().InsertServer( m_pSection->GetObject() );
+ }
+ else
+ {
+ if (CONTENT_SECTION != m_pSection->GetType()
+ && m_pSection->IsConnected())
{
- if (CONTENT_SECTION != m_pSection->GetType()
- && m_pSection->IsConnected())
- {
- pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() );
- }
- if (m_pSection->IsServer())
- pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_pSection->GetObject() );
+ pDoc->getIDocumentLinksAdministration().GetLinkManager().Remove( &m_pSection->GetBaseLink() );
}
+ if (m_pSection->IsServer())
+ pDoc->getIDocumentLinksAdministration().GetLinkManager().RemoveServer( m_pSection->GetObject() );
}
+
}
OUString SwDoc::GetUniqueSectionName( const OUString* pChkStr ) const
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index a589cbf5091e..fbe12fd69018 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -561,255 +561,256 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
SwSelUnions aUnions;
::MakeSelUnions( aUnions, pStart, pEnd );
- if( !aUnions.empty() )
+ if( aUnions.empty() )
+ return;
+
+ SwTable& rTable = pTableNd->GetTable();
+ if (GetIDocumentUndoRedo().DoesUndo())
{
- SwTable& rTable = pTableNd->GetTable();
- if (GetIDocumentUndoRedo().DoesUndo())
- {
- GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTable(*pTableNd) );
- }
+ GetIDocumentUndoRedo().AppendUndo( new SwUndoAttrTable(*pTableNd) );
+ }
- std::vector<SwTableFormatCmp*> aFormatCmp;
- aFormatCmp.reserve( 255 );
- const SvxBoxItem* pSetBox;
- const SvxBoxInfoItem *pSetBoxInfo;
-
- const SvxBorderLine* pLeft = nullptr;
- const SvxBorderLine* pRight = nullptr;
- const SvxBorderLine* pTop = nullptr;
- const SvxBorderLine* pBottom = nullptr;
- const SvxBorderLine* pHori = nullptr;
- const SvxBorderLine* pVert = nullptr;
- bool bHoriValid = true, bVertValid = true,
- bTopValid = true, bBottomValid = true,
- bLeftValid = true, bRightValid = true;
-
- // The Flags in the BoxInfo Item decide whether a BorderLine is valid!
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, false,
- reinterpret_cast<const SfxPoolItem**>(&pSetBoxInfo)) )
- {
- pHori = pSetBoxInfo->GetHori();
- pVert = pSetBoxInfo->GetVert();
+ std::vector<SwTableFormatCmp*> aFormatCmp;
+ aFormatCmp.reserve( 255 );
+ const SvxBoxItem* pSetBox;
+ const SvxBoxInfoItem *pSetBoxInfo;
+
+ const SvxBorderLine* pLeft = nullptr;
+ const SvxBorderLine* pRight = nullptr;
+ const SvxBorderLine* pTop = nullptr;
+ const SvxBorderLine* pBottom = nullptr;
+ const SvxBorderLine* pHori = nullptr;
+ const SvxBorderLine* pVert = nullptr;
+ bool bHoriValid = true, bVertValid = true,
+ bTopValid = true, bBottomValid = true,
+ bLeftValid = true, bRightValid = true;
+
+ // The Flags in the BoxInfo Item decide whether a BorderLine is valid!
+ if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_BORDER_INNER, false,
+ reinterpret_cast<const SfxPoolItem**>(&pSetBoxInfo)) )
+ {
+ pHori = pSetBoxInfo->GetHori();
+ pVert = pSetBoxInfo->GetVert();
- bHoriValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::HORI);
- bVertValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::VERT);
+ bHoriValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::HORI);
+ bVertValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::VERT);
- // Do we want to evaluate these?
- bTopValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::TOP);
- bBottomValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::BOTTOM);
- bLeftValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT);
- bRightValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT);
- }
+ // Do we want to evaluate these?
+ bTopValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::TOP);
+ bBottomValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::BOTTOM);
+ bLeftValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::LEFT);
+ bRightValid = pSetBoxInfo->IsValid(SvxBoxInfoItemValidFlags::RIGHT);
+ }
- if( SfxItemState::SET == rSet.GetItemState( RES_BOX, false,
- reinterpret_cast<const SfxPoolItem**>(&pSetBox)) )
- {
- pLeft = pSetBox->GetLeft();
- pRight = pSetBox->GetRight();
- pTop = pSetBox->GetTop();
- pBottom = pSetBox->GetBottom();
- }
- else
- {
- // Not set, thus not valid values
- bTopValid = bBottomValid = bLeftValid = bRightValid = false;
- pSetBox = nullptr;
- }
+ if( SfxItemState::SET == rSet.GetItemState( RES_BOX, false,
+ reinterpret_cast<const SfxPoolItem**>(&pSetBox)) )
+ {
+ pLeft = pSetBox->GetLeft();
+ pRight = pSetBox->GetRight();
+ pTop = pSetBox->GetTop();
+ pBottom = pSetBox->GetBottom();
+ }
+ else
+ {
+ // Not set, thus not valid values
+ bTopValid = bBottomValid = bLeftValid = bRightValid = false;
+ pSetBox = nullptr;
+ }
- bool bFirst = true;
- for ( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i )
+ bool bFirst = true;
+ for ( SwSelUnions::size_type i = 0; i < aUnions.size(); ++i )
+ {
+ SwSelUnion *pUnion = &aUnions[i];
+ SwTabFrame *pTab = pUnion->GetTable();
+ const SwRect &rUnion = pUnion->GetUnion();
+ const bool bLast = (i == aUnions.size() - 1);
+
+ std::vector<SwCellFrame*> aCellArr;
+ aCellArr.reserve( 255 );
+ ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
+
+ // All Cell Borders that match the UnionRect or extend it are
+ // Outer Borders. All others are Inner Borders.
+
+ // New: The Outer Borders can, depending on whether it's a
+ // Start/Middle/Follow Table (for Selection via FollowTabs),
+ // also not be Outer Borders.
+ // Outer Borders are set on the left, right, at the top and at the bottom.
+ // Inner Borders are only set at the top and on the left.
+ for ( auto pCell : aCellArr )
{
- SwSelUnion *pUnion = &aUnions[i];
- SwTabFrame *pTab = pUnion->GetTable();
- const SwRect &rUnion = pUnion->GetUnion();
- const bool bLast = (i == aUnions.size() - 1);
+ const bool bVert = pTab->IsVertical();
+ const bool bRTL = pTab->IsRightToLeft();
+ bool bTopOver, bLeftOver, bRightOver, bBottomOver;
+ if ( bVert )
+ {
+ bTopOver = pCell->getFrameArea().Right() >= rUnion.Right();
+ bLeftOver = pCell->getFrameArea().Top() <= rUnion.Top();
+ bRightOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom();
+ bBottomOver = pCell->getFrameArea().Left() <= rUnion.Left();
+ }
+ else
+ {
+ bTopOver = pCell->getFrameArea().Top() <= rUnion.Top();
+ bLeftOver = pCell->getFrameArea().Left() <= rUnion.Left();
+ bRightOver = pCell->getFrameArea().Right() >= rUnion.Right();
+ bBottomOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom();
+ }
- std::vector<SwCellFrame*> aCellArr;
- aCellArr.reserve( 255 );
- ::lcl_CollectCells( aCellArr, pUnion->GetUnion(), pTab );
+ if ( bRTL )
+ {
+ bool bTmp = bRightOver;
+ bRightOver = bLeftOver;
+ bLeftOver = bTmp;
+ }
- // All Cell Borders that match the UnionRect or extend it are
- // Outer Borders. All others are Inner Borders.
+ // Do not set anything by default in HeadlineRepeats
+ if ( pTab->IsFollow() &&
+ ( pTab->IsInHeadline( *pCell ) ||
+ // Same holds for follow flow rows
+ pCell->IsInFollowFlowRow() ) )
+ continue;
- // New: The Outer Borders can, depending on whether it's a
- // Start/Middle/Follow Table (for Selection via FollowTabs),
- // also not be Outer Borders.
- // Outer Borders are set on the left, right, at the top and at the bottom.
- // Inner Borders are only set at the top and on the left.
- for ( auto pCell : aCellArr )
+ SvxBoxItem aBox( pCell->GetFormat()->GetBox() );
+
+ sal_Int16 nType = 0;
+
+ // Top Border
+ if( bTopValid )
{
- const bool bVert = pTab->IsVertical();
- const bool bRTL = pTab->IsRightToLeft();
- bool bTopOver, bLeftOver, bRightOver, bBottomOver;
- if ( bVert )
+ if ( bFirst && bTopOver )
{
- bTopOver = pCell->getFrameArea().Right() >= rUnion.Right();
- bLeftOver = pCell->getFrameArea().Top() <= rUnion.Top();
- bRightOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom();
- bBottomOver = pCell->getFrameArea().Left() <= rUnion.Left();
+ aBox.SetLine( pTop, SvxBoxItemLine::TOP );
+ nType |= 0x0001;
}
- else
+ else if ( bHoriValid )
{
- bTopOver = pCell->getFrameArea().Top() <= rUnion.Top();
- bLeftOver = pCell->getFrameArea().Left() <= rUnion.Left();
- bRightOver = pCell->getFrameArea().Right() >= rUnion.Right();
- bBottomOver = pCell->getFrameArea().Bottom() >= rUnion.Bottom();
+ aBox.SetLine( nullptr, SvxBoxItemLine::TOP );
+ nType |= 0x0002;
}
+ }
- if ( bRTL )
- {
- bool bTmp = bRightOver;
- bRightOver = bLeftOver;
- bLeftOver = bTmp;
- }
-
- // Do not set anything by default in HeadlineRepeats
- if ( pTab->IsFollow() &&
- ( pTab->IsInHeadline( *pCell ) ||
- // Same holds for follow flow rows
- pCell->IsInFollowFlowRow() ) )
- continue;
-
- SvxBoxItem aBox( pCell->GetFormat()->GetBox() );
-
- sal_Int16 nType = 0;
-
- // Top Border
- if( bTopValid )
- {
- if ( bFirst && bTopOver )
- {
- aBox.SetLine( pTop, SvxBoxItemLine::TOP );
- nType |= 0x0001;
- }
- else if ( bHoriValid )
+ // Fix fdo#62470 correct the input for RTL table
+ if (bRTL)
+ {
+ if( bLeftOver && bRightOver)
{
- aBox.SetLine( nullptr, SvxBoxItemLine::TOP );
- nType |= 0x0002;
- }
- }
-
- // Fix fdo#62470 correct the input for RTL table
- if (bRTL)
- {
- if( bLeftOver && bRightOver)
+ if ( bLeftValid )
{
- if ( bLeftValid )
- {
- aBox.SetLine( pLeft, SvxBoxItemLine::RIGHT );
- nType |= 0x0010;
- }
- if ( bRightValid )
- {
- aBox.SetLine( pRight, SvxBoxItemLine::LEFT );
- nType |= 0x0004;
- }
+ aBox.SetLine( pLeft, SvxBoxItemLine::RIGHT );
+ nType |= 0x0010;
}
- else
+ if ( bRightValid )
{
- if ( bLeftValid )
- {
- aBox.SetLine( bRightOver ? pLeft : nullptr, SvxBoxItemLine::RIGHT );
- bVertValid ? nType |= 0x0020 : nType |= 0x0010;
- }
- if ( bLeftOver )
- {
- if ( bRightValid )
- {
- aBox.SetLine( pRight, SvxBoxItemLine::LEFT );
- nType |= 0x0004;
- }
- }
- else if ( bVertValid )
- {
- aBox.SetLine( pVert, SvxBoxItemLine::LEFT );
- nType |= 0x0008;
- }
- }
- }
- else
- {
- // Left Border
- if ( bLeftOver )
- {
- if( bLeftValid )
- {
- aBox.SetLine( pLeft, SvxBoxItemLine::LEFT );
+ aBox.SetLine( pRight, SvxBoxItemLine::LEFT );
nType |= 0x0004;
}
}
- else if( bVertValid )
- {
- aBox.SetLine( pVert, SvxBoxItemLine::LEFT );
- nType |= 0x0008;
- }
-
- // Right Border
- if( bRightValid )
+ else
{
- if ( bRightOver )
+ if ( bLeftValid )
{
- aBox.SetLine( pRight, SvxBoxItemLine::RIGHT );
- nType |= 0x0010;
+ aBox.SetLine( bRightOver ? pLeft : nullptr, SvxBoxItemLine::RIGHT );
+ bVertValid ? nType |= 0x0020 : nType |= 0x0010;
+ }
+ if ( bLeftOver )
+ {
+ if ( bRightValid )
+ {
+ aBox.SetLine( pRight, SvxBoxItemLine::LEFT );
+ nType |= 0x0004;
+ }
}
else if ( bVertValid )
{
- aBox.SetLine( nullptr, SvxBoxItemLine::RIGHT );
- nType |= 0x0020;
+ aBox.SetLine( pVert, SvxBoxItemLine::LEFT );
+ nType |= 0x0008;
}
}
- }
-
- // Bottom Border
- if ( bLast && bBottomOver )
+ }
+ else
+ {
+ // Left Border
+ if ( bLeftOver )
{
- if( bBottomValid )
+ if( bLeftValid )
{
- aBox.SetLine( pBottom, SvxBoxItemLine::BOTTOM );
- nType |= 0x0040;
+ aBox.SetLine( pLeft, SvxBoxItemLine::LEFT );
+ nType |= 0x0004;
}
}
- else if( bHoriValid )
+ else if( bVertValid )
{
- aBox.SetLine( pHori, SvxBoxItemLine::BOTTOM );
- nType |= 0x0080;
+ aBox.SetLine( pVert, SvxBoxItemLine::LEFT );
+ nType |= 0x0008;
}
- if( pSetBox )
+ // Right Border
+ if( bRightValid )
{
- for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() )
- aBox.SetDistance( pSetBox->GetDistance( k ), k );
+ if ( bRightOver )
+ {
+ aBox.SetLine( pRight, SvxBoxItemLine::RIGHT );
+ nType |= 0x0010;
+ }
+ else if ( bVertValid )
+ {
+ aBox.SetLine( nullptr, SvxBoxItemLine::RIGHT );
+ nType |= 0x0020;
+ }
}
+ }
- SwTableBox *pBox = const_cast<SwTableBox*>(pCell->GetTabBox());
- SwFrameFormat *pNewFormat;
- if ( nullptr != (pNewFormat = SwTableFormatCmp::FindNewFormat( aFormatCmp, pBox->GetFrameFormat(), nType )))
- pBox->ChgFrameFormat( static_cast<SwTableBoxFormat*>(pNewFormat) );
- else
+ // Bottom Border
+ if ( bLast && bBottomOver )
+ {
+ if( bBottomValid )
{
- SwFrameFormat *pOld = pBox->GetFrameFormat();
- SwFrameFormat *pNew = pBox->ClaimFrameFormat();
- pNew->SetFormatAttr( aBox );
- aFormatCmp.push_back( new SwTableFormatCmp( pOld, pNew, nType ) );
+ aBox.SetLine( pBottom, SvxBoxItemLine::BOTTOM );
+ nType |= 0x0040;
}
}
+ else if( bHoriValid )
+ {
+ aBox.SetLine( pHori, SvxBoxItemLine::BOTTOM );
+ nType |= 0x0080;
+ }
+
+ if( pSetBox )
+ {
+ for( SvxBoxItemLine k : o3tl::enumrange<SvxBoxItemLine>() )
+ aBox.SetDistance( pSetBox->GetDistance( k ), k );
+ }
- bFirst = false;
+ SwTableBox *pBox = const_cast<SwTableBox*>(pCell->GetTabBox());
+ SwFrameFormat *pNewFormat;
+ if ( nullptr != (pNewFormat = SwTableFormatCmp::FindNewFormat( aFormatCmp, pBox->GetFrameFormat(), nType )))
+ pBox->ChgFrameFormat( static_cast<SwTableBoxFormat*>(pNewFormat) );
+ else
+ {
+ SwFrameFormat *pOld = pBox->GetFrameFormat();
+ SwFrameFormat *pNew = pBox->ClaimFrameFormat();
+ pNew->SetFormatAttr( aBox );
+ aFormatCmp.push_back( new SwTableFormatCmp( pOld, pNew, nType ) );
+ }
}
- SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
- if( pTableLayout )
- {
- SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
- SwTabFrame* pTabFrame = pFrame->ImplFindTabFrame();
+ bFirst = false;
+ }
- pTableLayout->BordersChanged(
- pTableLayout->GetBrowseWidthByTabFrame( *pTabFrame ) );
- }
- SwTableFormatCmp::Delete( aFormatCmp );
- ::ClearFEShellTabCols();
- getIDocumentState().SetModified();
+ SwHTMLTableLayout *pTableLayout = rTable.GetHTMLTableLayout();
+ if( pTableLayout )
+ {
+ SwContentFrame* pFrame = rCursor.GetContentNode()->getLayoutFrame( rCursor.GetContentNode()->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() );
+ SwTabFrame* pTabFrame = pFrame->ImplFindTabFrame();
+
+ pTableLayout->BordersChanged(
+ pTableLayout->GetBrowseWidthByTabFrame( *pTabFrame ) );
}
+ SwTableFormatCmp::Delete( aFormatCmp );
+ ::ClearFEShellTabCols();
+ getIDocumentState().SetModified();
+
}
static void lcl_SetLineStyle( SvxBorderLine *pToSet,
diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx
index d8411be089ec..f4dc58a07fad 100644
--- a/sw/source/core/edit/autofmt.cxx
+++ b/sw/source/core/edit/autofmt.cxx
@@ -2578,51 +2578,52 @@ void SwEditShell::AutoFormatBySplitNode()
{
SET_CURR_SHELL( this );
SwPaM* pCursor = GetCursor();
- if( !pCursor->IsMultiSelection() && pCursor->Move( fnMoveBackward, GoInNode ) )
- {
- StartAllAction();
- StartUndo( SwUndoId::AUTOFORMAT );
+ if( pCursor->IsMultiSelection() || !pCursor->Move( fnMoveBackward, GoInNode ) )
+ return;
+
+ StartAllAction();
+ StartUndo( SwUndoId::AUTOFORMAT );
- bool bRange = false;
- pCursor->SetMark();
- SwIndex* pContent = &pCursor->GetMark()->nContent;
- if( pContent->GetIndex() )
+ bool bRange = false;
+ pCursor->SetMark();
+ SwIndex* pContent = &pCursor->GetMark()->nContent;
+ if( pContent->GetIndex() )
+ {
+ *pContent = 0;
+ bRange = true;
+ }
+ else
+ {
+ // then go one node backwards
+ SwNodeIndex aNdIdx( pCursor->GetMark()->nNode, -1 );
+ SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode();
+ if (pTextNd && !pTextNd->GetText().isEmpty())
{
- *pContent = 0;
+ pContent->Assign( pTextNd, 0 );
+ pCursor->GetMark()->nNode = aNdIdx;
bRange = true;
}
- else
- {
- // then go one node backwards
- SwNodeIndex aNdIdx( pCursor->GetMark()->nNode, -1 );
- SwTextNode* pTextNd = aNdIdx.GetNode().GetTextNode();
- if (pTextNd && !pTextNd->GetText().isEmpty())
- {
- pContent->Assign( pTextNd, 0 );
- pCursor->GetMark()->nNode = aNdIdx;
- bRange = true;
- }
- }
+ }
- if( bRange )
- {
- Push(); // save cursor
+ if( bRange )
+ {
+ Push(); // save cursor
- SvxSwAutoFormatFlags aAFFlags = *GetAutoFormatFlags(); // use default values so far
+ SvxSwAutoFormatFlags aAFFlags = *GetAutoFormatFlags(); // use default values so far
- SwAutoFormat aFormat( this, aAFFlags, &pCursor->GetMark()->nNode,
- &pCursor->GetPoint()->nNode );
+ SwAutoFormat aFormat( this, aAFFlags, &pCursor->GetMark()->nNode,
+ &pCursor->GetPoint()->nNode );
- //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor!
- Pop(PopMode::DeleteCurrent);
- pCursor = GetCursor();
- }
- pCursor->DeleteMark();
- pCursor->Move( fnMoveForward, GoInNode );
-
- EndUndo( SwUndoId::AUTOFORMAT );
- EndAllAction();
+ //JP 30.09.96: DoTable() builds on PopCursor and MoveCursor!
+ Pop(PopMode::DeleteCurrent);
+ pCursor = GetCursor();
}
+ pCursor->DeleteMark();
+ pCursor->Move( fnMoveForward, GoInNode );
+
+ EndUndo( SwUndoId::AUTOFORMAT );
+ EndAllAction();
+
}
SvxSwAutoFormatFlags* SwEditShell::GetAutoFormatFlags()
diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx
index d76ab5a2120e..5b151e15d081 100644
--- a/sw/source/core/edit/edfcol.cxx
+++ b/sw/source/core/edit/edfcol.cxx
@@ -1453,132 +1453,133 @@ void lcl_placeWatermarkInHeader(const SfxWatermarkItem& rWatermark,
}
}
- if (!xWatermark.is() && !bDeleteWatermark)
+ if (xWatermark.is() || bDeleteWatermark)
+ return;
+
+ OUString sFont = rWatermark.GetFont();
+ sal_Int16 nAngle = rWatermark.GetAngle();
+ sal_Int16 nTransparency = rWatermark.GetTransparency();
+ sal_uInt32 nColor = rWatermark.GetColor();
+
+ // Calc the ratio.
+ double fRatio = 0;
+ double fRatioFrame = 0;
+ OutputDevice* pOut = Application::GetDefaultDevice();
+ vcl::Font aFont(pOut->GetFont());
+ aFont.SetFamilyName(sFont);
+
+ tools::Rectangle aBoundingRect;
+ pOut->GetTextBoundRect(aBoundingRect, rWatermark.GetText());
+ if (aBoundingRect.GetWidth())
{
- OUString sFont = rWatermark.GetFont();
- sal_Int16 nAngle = rWatermark.GetAngle();
- sal_Int16 nTransparency = rWatermark.GetTransparency();
- sal_uInt32 nColor = rWatermark.GetColor();
-
- // Calc the ratio.
- double fRatio = 0;
- double fRatioFrame = 0;
- OutputDevice* pOut = Application::GetDefaultDevice();
- vcl::Font aFont(pOut->GetFont());
- aFont.SetFamilyName(sFont);
-
- tools::Rectangle aBoundingRect;
- pOut->GetTextBoundRect(aBoundingRect, rWatermark.GetText());
- if (aBoundingRect.GetWidth())
+ fRatio = (double)aBoundingRect.GetHeight() / aBoundingRect.GetWidth();
+ auto nTextWidth = pOut->GetTextWidth(rWatermark.GetText());
+ if (nTextWidth)
{
- fRatio = (double)aBoundingRect.GetHeight() / aBoundingRect.GetWidth();
- auto nTextWidth = pOut->GetTextWidth(rWatermark.GetText());
- if (nTextWidth)
- {
- fRatioFrame = aFont.GetFontSize().Height();
- fRatioFrame /= nTextWidth;
- }
+ fRatioFrame = aFont.GetFontSize().Height();
+ fRatioFrame /= nTextWidth;
}
+ }
- // Calc the size.
- sal_Int32 nWidth = 0;
- awt::Size aSize;
- xPageStyle->getPropertyValue(UNO_NAME_SIZE) >>= aSize;
- if (aSize.Width < aSize.Height)
- {
- // Portrait.
- sal_Int32 nLeftMargin = 0;
- xPageStyle->getPropertyValue(UNO_NAME_LEFT_MARGIN) >>= nLeftMargin;
- sal_Int32 nRightMargin = 0;
- xPageStyle->getPropertyValue(UNO_NAME_RIGHT_MARGIN) >>= nRightMargin;
- nWidth = aSize.Width - nLeftMargin - nRightMargin;
- }
- else
- {
- // Landscape.
- sal_Int32 nTopMargin = 0;
- xPageStyle->getPropertyValue(UNO_NAME_TOP_MARGIN) >>= nTopMargin;
- sal_Int32 nBottomMargin = 0;
- xPageStyle->getPropertyValue(UNO_NAME_BOTTOM_MARGIN) >>= nBottomMargin;
- nWidth = aSize.Height - nTopMargin - nBottomMargin;
- }
- sal_Int32 nHeight = fRatio * nWidth;
- sal_Int32 nFrameHeight = fRatioFrame * nWidth;
-
- // Create and insert the shape.
- uno::Reference<drawing::XShape> xShape(xMultiServiceFactory->createInstance(aShapeServiceName), uno::UNO_QUERY);
- basegfx::B2DHomMatrix aTransformation;
- aTransformation.identity();
- aTransformation.scale(nWidth, nHeight);
- aTransformation.rotate(F_PI180 * -1 * nAngle);
- drawing::HomogenMatrix3 aMatrix;
- aMatrix.Line1.Column1 = aTransformation.get(0, 0);
- aMatrix.Line1.Column2 = aTransformation.get(0, 1);
- aMatrix.Line1.Column3 = aTransformation.get(0, 2);
- aMatrix.Line2.Column1 = aTransformation.get(1, 0);
- aMatrix.Line2.Column2 = aTransformation.get(1, 1);
- aMatrix.Line2.Column3 = aTransformation.get(1, 2);
- aMatrix.Line3.Column1 = aTransformation.get(2, 0);
- aMatrix.Line3.Column2 = aTransformation.get(2, 1);
- aMatrix.Line3.Column3 = aTransformation.get(2, 2);
- uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
- xPropertySet->setPropertyValue(UNO_NAME_ANCHOR_TYPE, uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
- uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY);
- xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, false);
-
- // The remaining properties have to be set after the shape is inserted: do that in one batch to avoid flickering.
- uno::Reference<document::XActionLockable> xLockable(xShape, uno::UNO_QUERY);
- xLockable->addActionLock();
- xPropertySet->setPropertyValue(UNO_NAME_FILLCOLOR, uno::makeAny(static_cast<sal_Int32>(nColor)));
- xPropertySet->setPropertyValue(UNO_NAME_FILLSTYLE, uno::makeAny(drawing::FillStyle_SOLID));
- xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(nTransparency));
- xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
- xPropertySet->setPropertyValue(UNO_NAME_LINESTYLE, uno::makeAny(drawing::LineStyle_NONE));
- xPropertySet->setPropertyValue(UNO_NAME_OPAQUE, uno::makeAny(false));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT, uno::makeAny(false));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_AUTOGROWWIDTH, uno::makeAny(false));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEHEIGHT, uno::makeAny(nHeight));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEWIDTH, uno::makeAny(nWidth));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_WRAP, uno::makeAny(text::WrapTextMode_THROUGH));
- xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
- xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME, uno::makeAny(sFont));
- xPropertySet->setPropertyValue(UNO_NAME_CHAR_HEIGHT, uno::makeAny(WATERMARK_AUTO_SIZE));
- xPropertySet->setPropertyValue(UNO_NAME_TEXT_UPPERDIST, uno::makeAny(sal_uInt32(nFrameHeight - nHeight)));
- xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
- xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT, uno::makeAny(static_cast<sal_Int16>(text::HoriOrientation::CENTER)));
- xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT, uno::makeAny(static_cast<sal_Int16>(text::VertOrientation::CENTER)));
-
- uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY);
- xTextRange->setString(rWatermark.GetText());
-
- uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(xShape, uno::UNO_QUERY);
- xDefaulter->createCustomShapeDefaults("fontwork-plain-text");
-
- auto aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >();
- auto aGeomPropVec = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aGeomPropSeq);
- uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
- {
- {"TextPath", uno::makeAny(true)},
- }));
- auto it = std::find_if(aGeomPropVec.begin(), aGeomPropVec.end(), [](const beans::PropertyValue& rValue)
- {
- return rValue.Name == "TextPath";
- });
- if (it == aGeomPropVec.end())
- aGeomPropVec.push_back(comphelper::makePropertyValue("TextPath", aPropertyValues));
- else
- it->Value <<= aPropertyValues;
- xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(comphelper::containerToSequence(aGeomPropVec)));
+ // Calc the size.
+ sal_Int32 nWidth = 0;
+ awt::Size aSize;
+ xPageStyle->getPropertyValue(UNO_NAME_SIZE) >>= aSize;
+ if (aSize.Width < aSize.Height)
+ {
+ // Portrait.
+ sal_Int32 nLeftMargin = 0;
+ xPageStyle->getPropertyValue(UNO_NAME_LEFT_MARGIN) >>= nLeftMargin;
+ sal_Int32 nRightMargin = 0;
+ xPageStyle->getPropertyValue(UNO_NAME_RIGHT_MARGIN) >>= nRightMargin;
+ nWidth = aSize.Width - nLeftMargin - nRightMargin;
+ }
+ else
+ {
+ // Landscape.
+ sal_Int32 nTopMargin = 0;
+ xPageStyle->getPropertyValue(UNO_NAME_TOP_MARGIN) >>= nTopMargin;
+ sal_Int32 nBottomMargin = 0;
+ xPageStyle->getPropertyValue(UNO_NAME_BOTTOM_MARGIN) >>= nBottomMargin;
+ nWidth = aSize.Height - nTopMargin - nBottomMargin;
+ }
+ sal_Int32 nHeight = fRatio * nWidth;
+ sal_Int32 nFrameHeight = fRatioFrame * nWidth;
- // tdf#108494, tdf#109313 the header height was switched to height of a watermark
- // and shape was moved to the lower part of a page, force position update
- xPropertySet->getPropertyValue("Transformation") >>= aMatrix;
- xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
+ // Create and insert the shape.
+ uno::Reference<drawing::XShape> xShape(xMultiServiceFactory->createInstance(aShapeServiceName), uno::UNO_QUERY);
+ basegfx::B2DHomMatrix aTransformation;
+ aTransformation.identity();
+ aTransformation.scale(nWidth, nHeight);
+ aTransformation.rotate(F_PI180 * -1 * nAngle);
+ drawing::HomogenMatrix3 aMatrix;
+ aMatrix.Line1.Column1 = aTransformation.get(0, 0);
+ aMatrix.Line1.Column2 = aTransformation.get(0, 1);
+ aMatrix.Line1.Column3 = aTransformation.get(0, 2);
+ aMatrix.Line2.Column1 = aTransformation.get(1, 0);
+ aMatrix.Line2.Column2 = aTransformation.get(1, 1);
+ aMatrix.Line2.Column3 = aTransformation.get(1, 2);
+ aMatrix.Line3.Column1 = aTransformation.get(2, 0);
+ aMatrix.Line3.Column2 = aTransformation.get(2, 1);
+ aMatrix.Line3.Column3 = aTransformation.get(2, 2);
+ uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
+ xPropertySet->setPropertyValue(UNO_NAME_ANCHOR_TYPE, uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
+ uno::Reference<text::XTextContent> xTextContent(xShape, uno::UNO_QUERY);
+ xHeaderText->insertTextContent(xHeaderText->getEnd(), xTextContent, false);
+
+ // The remaining properties have to be set after the shape is inserted: do that in one batch to avoid flickering.
+ uno::Reference<document::XActionLockable> xLockable(xShape, uno::UNO_QUERY);
+ xLockable->addActionLock();
+ xPropertySet->setPropertyValue(UNO_NAME_FILLCOLOR, uno::makeAny(static_cast<sal_Int32>(nColor)));
+ xPropertySet->setPropertyValue(UNO_NAME_FILLSTYLE, uno::makeAny(drawing::FillStyle_SOLID));
+ xPropertySet->setPropertyValue(UNO_NAME_FILL_TRANSPARENCE, uno::makeAny(nTransparency));
+ xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
+ xPropertySet->setPropertyValue(UNO_NAME_LINESTYLE, uno::makeAny(drawing::LineStyle_NONE));
+ xPropertySet->setPropertyValue(UNO_NAME_OPAQUE, uno::makeAny(false));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_AUTOGROWHEIGHT, uno::makeAny(false));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_AUTOGROWWIDTH, uno::makeAny(false));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEHEIGHT, uno::makeAny(nHeight));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_MINFRAMEWIDTH, uno::makeAny(nWidth));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_WRAP, uno::makeAny(text::WrapTextMode_THROUGH));
+ xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT_RELATION, uno::makeAny(static_cast<sal_Int16>(text::RelOrientation::PAGE_PRINT_AREA)));
+ xPropertySet->setPropertyValue(UNO_NAME_CHAR_FONT_NAME, uno::makeAny(sFont));
+ xPropertySet->setPropertyValue(UNO_NAME_CHAR_HEIGHT, uno::makeAny(WATERMARK_AUTO_SIZE));
+ xPropertySet->setPropertyValue(UNO_NAME_TEXT_UPPERDIST, uno::makeAny(sal_uInt32(nFrameHeight - nHeight)));
+ xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
+ xPropertySet->setPropertyValue(UNO_NAME_HORI_ORIENT, uno::makeAny(static_cast<sal_Int16>(text::HoriOrientation::CENTER)));
+ xPropertySet->setPropertyValue(UNO_NAME_VERT_ORIENT, uno::makeAny(static_cast<sal_Int16>(text::VertOrientation::CENTER)));
+
+ uno::Reference<text::XTextRange> xTextRange(xShape, uno::UNO_QUERY);
+ xTextRange->setString(rWatermark.GetText());
+
+ uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(xShape, uno::UNO_QUERY);
+ xDefaulter->createCustomShapeDefaults("fontwork-plain-text");
+
+ auto aGeomPropSeq = xPropertySet->getPropertyValue("CustomShapeGeometry").get< uno::Sequence<beans::PropertyValue> >();
+ auto aGeomPropVec = comphelper::sequenceToContainer< std::vector<beans::PropertyValue> >(aGeomPropSeq);
+ uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence(
+ {
+ {"TextPath", uno::makeAny(true)},
+ }));
+ auto it = std::find_if(aGeomPropVec.begin(), aGeomPropVec.end(), [](const beans::PropertyValue& rValue)
+ {
+ return rValue.Name == "TextPath";
+ });
+ if (it == aGeomPropVec.end())
+ aGeomPropVec.push_back(comphelper::makePropertyValue("TextPath", aPropertyValues));
+ else
+ it->Value <<= aPropertyValues;
+ xPropertySet->setPropertyValue("CustomShapeGeometry", uno::makeAny(comphelper::containerToSequence(aGeomPropVec)));
+
+ // tdf#108494, tdf#109313 the header height was switched to height of a watermark
+ // and shape was moved to the lower part of a page, force position update
+ xPropertySet->getPropertyValue("Transformation") >>= aMatrix;
+ xPropertySet->setPropertyValue("Transformation", uno::makeAny(aMatrix));
+
+ uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY);
+ xNamed->setName(sWatermark);
+ xLockable->removeActionLock();
- uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY);
- xNamed->setName(sWatermark);
- xLockable->removeActionLock();
- }
}
void SwEditShell::SetWatermark(const SfxWatermarkItem& rWatermark)
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 9a560070c349..0f9662f01f16 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -948,32 +948,33 @@ void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData )
{
const SwPosition& rPos = *GetCursor()->GetPoint();
SwExtTextInput* pInput = GetDoc()->GetExtTextInput( rPos.nNode.GetNode() );
- if( pInput )
- {
- StartAllAction();
- SET_CURR_SHELL( this );
+ if( !pInput )
+ return;
+
+ StartAllAction();
+ SET_CURR_SHELL( this );
- if( !rData.IsOnlyCursorChanged() )
- pInput->SetInputData( rData );
- // position cursor
- const SwPosition& rStt = *pInput->Start();
- const sal_Int32 nNewCursorPos = rStt.nContent.GetIndex() + rData.GetCursorPos();
+ if( !rData.IsOnlyCursorChanged() )
+ pInput->SetInputData( rData );
+ // position cursor
+ const SwPosition& rStt = *pInput->Start();
+ const sal_Int32 nNewCursorPos = rStt.nContent.GetIndex() + rData.GetCursorPos();
- // ugly but works
- ShowCursor();
- const sal_Int32 nDiff = nNewCursorPos - rPos.nContent.GetIndex();
- if( 0 > nDiff )
- Left( -nDiff, CRSR_SKIP_CHARS );
- else if( 0 < nDiff )
- Right( nDiff, CRSR_SKIP_CHARS );
+ // ugly but works
+ ShowCursor();
+ const sal_Int32 nDiff = nNewCursorPos - rPos.nContent.GetIndex();
+ if( 0 > nDiff )
+ Left( -nDiff, CRSR_SKIP_CHARS );
+ else if( 0 < nDiff )
+ Right( nDiff, CRSR_SKIP_CHARS );
- SetOverwriteCursor( rData.IsCursorOverwrite() );
+ SetOverwriteCursor( rData.IsCursorOverwrite() );
- EndAllAction();
+ EndAllAction();
+
+ if( !rData.IsCursorVisible() ) // must be called after the EndAction
+ HideCursor();
- if( !rData.IsCursorVisible() ) // must be called after the EndAction
- HideCursor();
- }
}
void SwEditShell::TransliterateText( TransliterationFlags nType )
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index faecd8033ec2..45e4927340aa 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -1112,151 +1112,152 @@ void SwEditShell::ApplyChangedSentence(const svx::SpellPortions& rNewPortions, b
// sentence got removed in the dialog
OSL_ENSURE( g_pSpellIter, "SpellIter missing" );
- if (g_pSpellIter &&
- g_pSpellIter->GetLastPortions().size() > 0) // no portions -> no text to be changed
- {
- const SpellPortions& rLastPortions = g_pSpellIter->GetLastPortions();
- const SpellContentPositions rLastPositions = g_pSpellIter->GetLastPositions();
- OSL_ENSURE(rLastPortions.size() > 0 &&
- rLastPortions.size() == rLastPositions.size(),
- "last vectors of spelling results are not set or not equal");
+ if (!g_pSpellIter ||
+ g_pSpellIter->GetLastPortions().size() <= 0) // no portions -> no text to be changed
+ return;
- // iterate over the new portions, beginning at the end to take advantage of the previously
- // saved content positions
+ const SpellPortions& rLastPortions = g_pSpellIter->GetLastPortions();
+ const SpellContentPositions rLastPositions = g_pSpellIter->GetLastPositions();
+ OSL_ENSURE(rLastPortions.size() > 0 &&
+ rLastPortions.size() == rLastPositions.size(),
+ "last vectors of spelling results are not set or not equal");
- mxDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::UI_TEXT_CORRECTION, nullptr );
- StartAction();
+ // iterate over the new portions, beginning at the end to take advantage of the previously
+ // saved content positions
+
+ mxDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::UI_TEXT_CORRECTION, nullptr );
+ StartAction();
- SwPaM *pCursor = GetCursor();
- // save cursor position (which should be at the end of the current sentence)
- // for later restoration
- Push();
+ SwPaM *pCursor = GetCursor();
+ // save cursor position (which should be at the end of the current sentence)
+ // for later restoration
+ Push();
- sal_uInt32 nRedlinePortions = lcl_CountRedlines(rLastPortions);
- if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())
+ sal_uInt32 nRedlinePortions = lcl_CountRedlines(rLastPortions);
+ if((rLastPortions.size() - nRedlinePortions) == rNewPortions.size())
+ {
+ OSL_ENSURE( !rNewPortions.empty(), "rNewPortions should not be empty here" );
+ OSL_ENSURE( !rLastPortions.empty(), "rLastPortions should not be empty here" );
+ OSL_ENSURE( !rLastPositions.empty(), "rLastPositions should not be empty here" );
+
+ // the simple case: the same number of elements on both sides
+ // each changed element has to be applied to the corresponding source element
+ svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
+ SpellPortions::const_iterator aCurrentOldPortion = rLastPortions.end();
+ SpellContentPositions::const_iterator aCurrentOldPosition = rLastPositions.end();
+ do
{
- OSL_ENSURE( !rNewPortions.empty(), "rNewPortions should not be empty here" );
- OSL_ENSURE( !rLastPortions.empty(), "rLastPortions should not be empty here" );
- OSL_ENSURE( !rLastPositions.empty(), "rLastPositions should not be empty here" );
-
- // the simple case: the same number of elements on both sides
- // each changed element has to be applied to the corresponding source element
- svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
- SpellPortions::const_iterator aCurrentOldPortion = rLastPortions.end();
- SpellContentPositions::const_iterator aCurrentOldPosition = rLastPositions.end();
- do
+ --aCurrentNewPortion;
+ --aCurrentOldPortion;
+ --aCurrentOldPosition;
+ //jump over redline portions
+ while(aCurrentOldPortion->bIsHidden)
{
- --aCurrentNewPortion;
- --aCurrentOldPortion;
- --aCurrentOldPosition;
- //jump over redline portions
- while(aCurrentOldPortion->bIsHidden)
+ if (aCurrentOldPortion != rLastPortions.begin() &&
+ aCurrentOldPosition != rLastPositions.begin())
{
- if (aCurrentOldPortion != rLastPortions.begin() &&
- aCurrentOldPosition != rLastPositions.begin())
- {
- --aCurrentOldPortion;
- --aCurrentOldPosition;
- }
- else
- {
- OSL_FAIL("ApplyChangedSentence: iterator positions broken" );
- break;
- }
- }
- if ( !pCursor->HasMark() )
- pCursor->SetMark();
- pCursor->GetPoint()->nContent = aCurrentOldPosition->nLeft;
- pCursor->GetMark()->nContent = aCurrentOldPosition->nRight;
- sal_uInt16 nScriptType = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
- sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
- switch(nScriptType)
- {
- case css::i18n::ScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
- case css::i18n::ScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ --aCurrentOldPortion;
+ --aCurrentOldPosition;
}
- if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
+ else
{
- // change text ...
- mxDoc->getIDocumentContentOperations().DeleteAndJoin(*pCursor);
- // ... and apply language if necessary
- if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
- SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
- mxDoc->getIDocumentContentOperations().InsertString(*pCursor, aCurrentNewPortion->sText);
- }
- else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
- {
- // apply language
- SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
- }
- else if( aCurrentNewPortion->bIgnoreThisError )
- {
- // add the 'ignore' markup to the TextNode's grammar ignore markup list
- IgnoreGrammarErrorAt( *pCursor );
- OSL_FAIL("TODO: add ignore mark to text node");
- }
- if(aCurrentNewPortion == rNewPortions.begin())
+ OSL_FAIL("ApplyChangedSentence: iterator positions broken" );
break;
+ }
}
- while(aCurrentNewPortion != rNewPortions.begin());
- }
- else
- {
- OSL_ENSURE( !rLastPositions.empty(), "rLastPositions should not be empty here" );
-
- // select the complete sentence
- SpellContentPositions::const_iterator aCurrentEndPosition = rLastPositions.end();
- --aCurrentEndPosition;
- SpellContentPositions::const_iterator aCurrentStartPosition = rLastPositions.begin();
- pCursor->GetPoint()->nContent = aCurrentStartPosition->nLeft;
- pCursor->GetMark()->nContent = aCurrentEndPosition->nRight;
-
- // delete the sentence completely
- mxDoc->getIDocumentContentOperations().DeleteAndJoin(*pCursor);
- svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.begin();
- while(aCurrentNewPortion != rNewPortions.end())
+ if ( !pCursor->HasMark() )
+ pCursor->SetMark();
+ pCursor->GetPoint()->nContent = aCurrentOldPosition->nLeft;
+ pCursor->GetMark()->nContent = aCurrentOldPosition->nRight;
+ sal_uInt16 nScriptType = SvtLanguageOptions::GetI18NScriptTypeOfLanguage( aCurrentNewPortion->eLanguage );
+ sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
+ switch(nScriptType)
{
- // set the language attribute
- SvtScriptType nScriptType = GetScriptType();
- sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
- switch(nScriptType)
- {
- case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
- case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
- default: break;
- }
- SfxItemSet aSet(GetAttrPool(), {{nLangWhichId, nLangWhichId}});
- GetCurAttr( aSet );
- const SvxLanguageItem& rLang = static_cast<const SvxLanguageItem& >(aSet.Get(nLangWhichId));
- if(rLang.GetLanguage() != aCurrentNewPortion->eLanguage)
+ case css::i18n::ScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case css::i18n::ScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ }
+ if(aCurrentNewPortion->sText != aCurrentOldPortion->sText)
+ {
+ // change text ...
+ mxDoc->getIDocumentContentOperations().DeleteAndJoin(*pCursor);
+ // ... and apply language if necessary
+ if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
- // insert the new string
mxDoc->getIDocumentContentOperations().InsertString(*pCursor, aCurrentNewPortion->sText);
-
- // set the cursor to the end of the inserted string
- *pCursor->Start() = *pCursor->End();
- ++aCurrentNewPortion;
}
+ else if(aCurrentNewPortion->eLanguage != aCurrentOldPortion->eLanguage)
+ {
+ // apply language
+ SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
+ }
+ else if( aCurrentNewPortion->bIgnoreThisError )
+ {
+ // add the 'ignore' markup to the TextNode's grammar ignore markup list
+ IgnoreGrammarErrorAt( *pCursor );
+ OSL_FAIL("TODO: add ignore mark to text node");
+ }
+ if(aCurrentNewPortion == rNewPortions.begin())
+ break;
}
-
- // restore cursor to the end of the sentence
- // (will work also if the sentence length has changed,
- // since cursors get updated automatically!)
- Pop(PopMode::DeleteCurrent);
-
- // collapse cursor to the end of the modified sentence
- *pCursor->Start() = *pCursor->End();
- if (bRecheck)
+ while(aCurrentNewPortion != rNewPortions.begin());
+ }
+ else
+ {
+ OSL_ENSURE( !rLastPositions.empty(), "rLastPositions should not be empty here" );
+
+ // select the complete sentence
+ SpellContentPositions::const_iterator aCurrentEndPosition = rLastPositions.end();
+ --aCurrentEndPosition;
+ SpellContentPositions::const_iterator aCurrentStartPosition = rLastPositions.begin();
+ pCursor->GetPoint()->nContent = aCurrentStartPosition->nLeft;
+ pCursor->GetMark()->nContent = aCurrentEndPosition->nRight;
+
+ // delete the sentence completely
+ mxDoc->getIDocumentContentOperations().DeleteAndJoin(*pCursor);
+ svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.begin();
+ while(aCurrentNewPortion != rNewPortions.end())
{
- // in grammar check the current sentence has to be checked again
- GoStartSentence();
+ // set the language attribute
+ SvtScriptType nScriptType = GetScriptType();
+ sal_uInt16 nLangWhichId = RES_CHRATR_LANGUAGE;
+ switch(nScriptType)
+ {
+ case SvtScriptType::ASIAN : nLangWhichId = RES_CHRATR_CJK_LANGUAGE; break;
+ case SvtScriptType::COMPLEX : nLangWhichId = RES_CHRATR_CTL_LANGUAGE; break;
+ default: break;
+ }
+ SfxItemSet aSet(GetAttrPool(), {{nLangWhichId, nLangWhichId}});
+ GetCurAttr( aSet );
+ const SvxLanguageItem& rLang = static_cast<const SvxLanguageItem& >(aSet.Get(nLangWhichId));
+ if(rLang.GetLanguage() != aCurrentNewPortion->eLanguage)
+ SetAttrItem( SvxLanguageItem(aCurrentNewPortion->eLanguage, nLangWhichId) );
+ // insert the new string
+ mxDoc->getIDocumentContentOperations().InsertString(*pCursor, aCurrentNewPortion->sText);
+
+ // set the cursor to the end of the inserted string
+ *pCursor->Start() = *pCursor->End();
+ ++aCurrentNewPortion;
}
- // set continuation position for spell/grammar checking to the end of this sentence
- g_pSpellIter->SetCurr( new SwPosition(*pCursor->Start()) );
+ }
- mxDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::UI_TEXT_CORRECTION, nullptr );
- EndAction();
+ // restore cursor to the end of the sentence
+ // (will work also if the sentence length has changed,
+ // since cursors get updated automatically!)
+ Pop(PopMode::DeleteCurrent);
+
+ // collapse cursor to the end of the modified sentence
+ *pCursor->Start() = *pCursor->End();
+ if (bRecheck)
+ {
+ // in grammar check the current sentence has to be checked again
+ GoStartSentence();
}
+ // set continuation position for spell/grammar checking to the end of this sentence
+ g_pSpellIter->SetCurr( new SwPosition(*pCursor->Start()) );
+
+ mxDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::UI_TEXT_CORRECTION, nullptr );
+ EndAction();
+
}
/** Collect all deleted redlines of the current text node
* beginning at the start of the cursor position
@@ -1567,43 +1568,44 @@ void SwSpellIter::CreatePortion(uno::Reference< XSpellAlternatives > const & xAl
svx::SpellPortion aPortion;
OUString sText;
GetSh()->GetSelectedText( sText );
- if(!sText.isEmpty())
+ if(sText.isEmpty())
+ return;
+
+ // in case of redlined deletions the selection of an error is not the same as the _real_ word
+ if(xAlt.is())
+ aPortion.sText = xAlt->getWord();
+ else if(pGrammarResult)
{
- // in case of redlined deletions the selection of an error is not the same as the _real_ word
- if(xAlt.is())
- aPortion.sText = xAlt->getWord();
- else if(pGrammarResult)
+ aPortion.bIsGrammarError = true;
+ if(pGrammarResult->aErrors.getLength())
{
- aPortion.bIsGrammarError = true;
- if(pGrammarResult->aErrors.getLength())
+ aPortion.aGrammarError = pGrammarResult->aErrors[0];
+ aPortion.sText = pGrammarResult->aText.copy( aPortion.aGrammarError.nErrorStart, aPortion.aGrammarError.nErrorLength );
+ aPortion.xGrammarChecker = pGrammarResult->xProofreader;
+ const beans::PropertyValue* pProperties = pGrammarResult->aProperties.getConstArray();
+ for( sal_Int32 nProp = 0; nProp < pGrammarResult->aProperties.getLength(); ++nProp )
{
- aPortion.aGrammarError = pGrammarResult->aErrors[0];
- aPortion.sText = pGrammarResult->aText.copy( aPortion.aGrammarError.nErrorStart, aPortion.aGrammarError.nErrorLength );
- aPortion.xGrammarChecker = pGrammarResult->xProofreader;
- const beans::PropertyValue* pProperties = pGrammarResult->aProperties.getConstArray();
- for( sal_Int32 nProp = 0; nProp < pGrammarResult->aProperties.getLength(); ++nProp )
+ if ( pProperties->Name == "DialogTitle" )
{
- if ( pProperties->Name == "DialogTitle" )
- {
- pProperties->Value >>= aPortion.sDialogTitle;
- break;
- }
+ pProperties->Value >>= aPortion.sDialogTitle;
+ break;
}
}
}
- else
- aPortion.sText = sText;
- aPortion.eLanguage = lcl_GetLanguage(*GetSh());
- aPortion.bIsField = bIsField;
- aPortion.bIsHidden = bIsHidden;
- aPortion.xAlternatives = xAlt;
- SpellContentPosition aPosition;
- SwPaM *pCursor = GetSh()->GetCursor();
- aPosition.nLeft = pCursor->Start()->nContent.GetIndex();
- aPosition.nRight = pCursor->End()->nContent.GetIndex();
- aLastPortions.push_back(aPortion);
- aLastPositions.push_back(aPosition);
}
+ else
+ aPortion.sText = sText;
+ aPortion.eLanguage = lcl_GetLanguage(*GetSh());
+ aPortion.bIsField = bIsField;
+ aPortion.bIsHidden = bIsHidden;
+ aPortion.xAlternatives = xAlt;
+ SpellContentPosition aPosition;
+ SwPaM *pCursor = GetSh()->GetCursor();
+ aPosition.nLeft = pCursor->Start()->nContent.GetIndex();
+ aPosition.nRight = pCursor->End()->nContent.GetIndex();
+ aLastPortions.push_back(aPortion);
+ aLastPositions.push_back(aPosition);
+
}
void SwSpellIter::AddPortion(uno::Reference< XSpellAlternatives > const & xAlt,
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index ece412fde57c..c06bbd6e2951 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -2015,48 +2015,49 @@ void SwFEShell::AlignFormulaToBaseline( const uno::Reference < embed::XEmbeddedO
SwFrameFormat * pFrameFormat = pFly ? pFly->GetFormat() : nullptr;
// baseline to baseline alignment should only be applied to formulas anchored as char
- if ( pFly && pFrameFormat && RndStdIds::FLY_AS_CHAR == pFrameFormat->GetAnchor().GetAnchorId() )
+ if ( !pFly || !pFrameFormat || RndStdIds::FLY_AS_CHAR != pFrameFormat->GetAnchor().GetAnchorId() )
+ return;
+
+ // get baseline from Math object
+ uno::Any aBaseline;
+ if( svt::EmbeddedObjectRef::TryRunningState( xObj ) )
{
- // get baseline from Math object
- uno::Any aBaseline;
- if( svt::EmbeddedObjectRef::TryRunningState( xObj ) )
+ uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
+ if ( xSet.is() )
{
- uno::Reference < beans::XPropertySet > xSet( xObj->getComponent(), uno::UNO_QUERY );
- if ( xSet.is() )
+ try
{
- try
- {
- aBaseline = xSet->getPropertyValue("BaseLine");
- }
- catch ( uno::Exception& )
- {
- OSL_FAIL( "Baseline could not be retrieved from Starmath!" );
- }
+ aBaseline = xSet->getPropertyValue("BaseLine");
+ }
+ catch ( uno::Exception& )
+ {
+ OSL_FAIL( "Baseline could not be retrieved from Starmath!" );
}
}
+ }
+
+ sal_Int32 nBaseline = ::comphelper::getINT32(aBaseline);
+ const MapMode aSourceMapMode( MapUnit::Map100thMM );
+ const MapMode aTargetMapMode( MapUnit::MapTwip );
+ nBaseline = OutputDevice::LogicToLogic( nBaseline, aSourceMapMode.GetMapUnit(), aTargetMapMode.GetMapUnit() );
- sal_Int32 nBaseline = ::comphelper::getINT32(aBaseline);
- const MapMode aSourceMapMode( MapUnit::Map100thMM );
- const MapMode aTargetMapMode( MapUnit::MapTwip );
- nBaseline = OutputDevice::LogicToLogic( nBaseline, aSourceMapMode.GetMapUnit(), aTargetMapMode.GetMapUnit() );
+ OSL_ENSURE( nBaseline > 0, "Wrong value of Baseline while retrieving from Starmath!" );
+ //nBaseline must be moved by aPrt position
+ const SwFlyFrameFormat *pFlyFrameFormat = pFly->GetFormat();
+ OSL_ENSURE( pFlyFrameFormat, "fly frame format missing!" );
+ if ( pFlyFrameFormat )
+ nBaseline += pFlyFrameFormat->GetLastFlyFramePrtRectPos().Y();
- OSL_ENSURE( nBaseline > 0, "Wrong value of Baseline while retrieving from Starmath!" );
- //nBaseline must be moved by aPrt position
- const SwFlyFrameFormat *pFlyFrameFormat = pFly->GetFormat();
- OSL_ENSURE( pFlyFrameFormat, "fly frame format missing!" );
- if ( pFlyFrameFormat )
- nBaseline += pFlyFrameFormat->GetLastFlyFramePrtRectPos().Y();
+ const SwFormatVertOrient &rVert = pFrameFormat->GetVertOrient();
+ SwFormatVertOrient aVert( rVert );
+ aVert.SetPos( -nBaseline );
+ aVert.SetVertOrient( css::text::VertOrientation::NONE );
- const SwFormatVertOrient &rVert = pFrameFormat->GetVertOrient();
- SwFormatVertOrient aVert( rVert );
- aVert.SetPos( -nBaseline );
- aVert.SetVertOrient( css::text::VertOrientation::NONE );
+ pFrameFormat->LockModify();
+ pFrameFormat->SetFormatAttr( aVert );
+ pFrameFormat->UnlockModify();
+ pFly->InvalidatePos();
- pFrameFormat->LockModify();
- pFrameFormat->SetFormatAttr( aVert );
- pFrameFormat->UnlockModify();
- pFly->InvalidatePos();
- }
}
void SwFEShell::AlignAllFormulasToBaseline()
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 267c1f3793d4..8f6e3ef357b9 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -895,132 +895,132 @@ void SwFEShell::SetLineEnds(SfxItemSet& rAttr, SdrObject const * pObj, sal_uInt1
{
SdrModel *pDoc = pObj->GetModel();
- if ( nSlotId == SID_LINE_ARROW_START ||
- nSlotId == SID_LINE_ARROW_END ||
- nSlotId == SID_LINE_ARROWS ||
- nSlotId == SID_LINE_ARROW_CIRCLE ||
- nSlotId == SID_LINE_CIRCLE_ARROW ||
- nSlotId == SID_LINE_ARROW_SQUARE ||
- nSlotId == SID_LINE_SQUARE_ARROW )
+ if ( !(nSlotId == SID_LINE_ARROW_START ||
+ nSlotId == SID_LINE_ARROW_END ||
+ nSlotId == SID_LINE_ARROWS ||
+ nSlotId == SID_LINE_ARROW_CIRCLE ||
+ nSlotId == SID_LINE_CIRCLE_ARROW ||
+ nSlotId == SID_LINE_ARROW_SQUARE ||
+ nSlotId == SID_LINE_SQUARE_ARROW) )
+ return;
+
+ // set attributes of line start and ends
+
+ // arrowhead
+ ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDoc ) );
+ if( !aArrow.count() )
+ {
+ ::basegfx::B2DPolygon aNewArrow;
+ aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0));
+ aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0));
+ aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0));
+ aNewArrow.setClosed(true);
+ aArrow.append(aNewArrow);
+ }
+
+ // Circles
+ ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, pDoc ) );
+ if( !aCircle.count() )
{
+ ::basegfx::B2DPolygon aNewCircle;
+ aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0);
+ aNewCircle.setClosed(true);
+ aCircle.append(aNewCircle);
+ }
+
+ // Square
+ ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, pDoc ) );
+ if( !aSquare.count() )
+ {
+ ::basegfx::B2DPolygon aNewSquare;
+ aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0));
+ aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0));
+ aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0));
+ aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0));
+ aNewSquare.setClosed(true);
+ aSquare.append(aNewSquare);
+ }
- // set attributes of line start and ends
+ SfxItemSet aSet( pDoc->GetItemPool() );
+ long nWidth = 100; // (1/100th mm)
- // arrowhead
- ::basegfx::B2DPolyPolygon aArrow( getPolygon( RID_SVXSTR_ARROW, pDoc ) );
- if( !aArrow.count() )
+ // determine line width and calculate with it the line end width
+ if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
+ {
+ long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue();
+ if( nValue > 0 )
+ nWidth = nValue * 3;
+ }
+
+ switch (nSlotId)
+ {
+ case SID_LINE_ARROWS:
{
- ::basegfx::B2DPolygon aNewArrow;
- aNewArrow.append(::basegfx::B2DPoint(10.0, 0.0));
- aNewArrow.append(::basegfx::B2DPoint(0.0, 30.0));
- aNewArrow.append(::basegfx::B2DPoint(20.0, 30.0));
- aNewArrow.setClosed(true);
- aArrow.append(aNewArrow);
+ // connector with arrow ends
+ rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineStartWidthItem(nWidth));
+ rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineEndWidthItem(nWidth));
}
+ break;
- // Circles
- ::basegfx::B2DPolyPolygon aCircle( getPolygon( RID_SVXSTR_CIRCLE, pDoc ) );
- if( !aCircle.count() )
+ case SID_LINE_ARROW_START:
+ case SID_LINE_ARROW_CIRCLE:
+ case SID_LINE_ARROW_SQUARE:
{
- ::basegfx::B2DPolygon aNewCircle;
- aNewCircle = ::basegfx::utils::createPolygonFromEllipse(::basegfx::B2DPoint(0.0, 0.0), 250.0, 250.0);
- aNewCircle.setClosed(true);
- aCircle.append(aNewCircle);
+ // connector with arrow start
+ rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineStartWidthItem(nWidth));
}
+ break;
- // Square
- ::basegfx::B2DPolyPolygon aSquare( getPolygon( RID_SVXSTR_SQUARE, pDoc ) );
- if( !aSquare.count() )
+ case SID_LINE_ARROW_END:
+ case SID_LINE_CIRCLE_ARROW:
+ case SID_LINE_SQUARE_ARROW:
{
- ::basegfx::B2DPolygon aNewSquare;
- aNewSquare.append(::basegfx::B2DPoint(0.0, 0.0));
- aNewSquare.append(::basegfx::B2DPoint(10.0, 0.0));
- aNewSquare.append(::basegfx::B2DPoint(10.0, 10.0));
- aNewSquare.append(::basegfx::B2DPoint(0.0, 10.0));
- aNewSquare.setClosed(true);
- aSquare.append(aNewSquare);
+ // connector with arrow end
+ rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
+ rAttr.Put(XLineEndWidthItem(nWidth));
}
+ break;
+ }
- SfxItemSet aSet( pDoc->GetItemPool() );
- long nWidth = 100; // (1/100th mm)
-
- // determine line width and calculate with it the line end width
- if( aSet.GetItemState( XATTR_LINEWIDTH ) != SfxItemState::DONTCARE )
+ // and again, for the still missing ends
+ switch (nSlotId)
+ {
+ case SID_LINE_ARROW_CIRCLE:
{
long nValue = aSet.Get( XATTR_LINEWIDTH ).GetValue();
if( nValue > 0 )
nWidth = nValue * 3;
}
+ break;
- switch (nSlotId)
+ case SID_LINE_CIRCLE_ARROW:
{
- case SID_LINE_ARROWS:
- {
- // connector with arrow ends
- rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
- rAttr.Put(XLineStartWidthItem(nWidth));
- rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
- rAttr.Put(XLineEndWidthItem(nWidth));
- }
- break;
-
- case SID_LINE_ARROW_START:
- case SID_LINE_ARROW_CIRCLE:
- case SID_LINE_ARROW_SQUARE:
- {
- // connector with arrow start
- rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
- rAttr.Put(XLineStartWidthItem(nWidth));
- }
- break;
-
- case SID_LINE_ARROW_END:
- case SID_LINE_CIRCLE_ARROW:
- case SID_LINE_SQUARE_ARROW:
- {
- // connector with arrow end
- rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_ARROW), aArrow));
- rAttr.Put(XLineEndWidthItem(nWidth));
- }
- break;
+ // circle start
+ rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle));
+ rAttr.Put(XLineStartWidthItem(nWidth));
}
+ break;
- // and again, for the still missing ends
- switch (nSlotId)
+ case SID_LINE_ARROW_SQUARE:
{
- case SID_LINE_ARROW_CIRCLE:
- {
- // circle end
- rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle));
- rAttr.Put(XLineEndWidthItem(nWidth));
- }
- break;
-
- case SID_LINE_CIRCLE_ARROW:
- {
- // circle start
- rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_CIRCLE), aCircle));
- rAttr.Put(XLineStartWidthItem(nWidth));
- }
- break;
-
- case SID_LINE_ARROW_SQUARE:
- {
- // square end
- rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_SQUARE), aSquare));
- rAttr.Put(XLineEndWidthItem(nWidth));
- }
- break;
+ // square end
+ rAttr.Put(XLineEndItem(SvxResId(RID_SVXSTR_SQUARE), aSquare));
+ rAttr.Put(XLineEndWidthItem(nWidth));
+ }
+ break;
- case SID_LINE_SQUARE_ARROW:
- {
- // square start
- rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_SQUARE), aSquare));
- rAttr.Put(XLineStartWidthItem(nWidth));
- }
- break;
+ case SID_LINE_SQUARE_ARROW:
+ {
+ // square start
+ rAttr.Put(XLineStartItem(SvxResId(RID_SVXSTR_SQUARE), aSquare));
+ rAttr.Put(XLineStartWidthItem(nWidth));
}
+ break;
}
+
}
void SwFEShell::SelectionToTop( bool bTop )
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index 88d893d036c8..05f011bdb9de 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -407,132 +407,133 @@ void SwFEShell::InsertLabel( const SwLabelType eType, const OUString &rText, con
{
// get node index of cursor position, SwDoc can do everything else itself
SwContentFrame *pCnt = LTYPE_DRAW==eType ? nullptr : GetCurrFrame( false );
- if( LTYPE_DRAW==eType || pCnt )
+ if( LTYPE_DRAW!=eType && !pCnt )
+ return;
+
+ StartAllAction();
+ SwRewriter aRewriter(SwUndoInsertLabel::CreateRewriter(rText));
+ StartUndo(SwUndoId::INSERTLABEL, &aRewriter);
+
+ sal_uLong nIdx = 0;
+ bool bInnerCntIsFly = false;
+ SwFlyFrameFormat* pFlyFormat = nullptr;
+ switch( eType )
{
- StartAllAction();
- SwRewriter aRewriter(SwUndoInsertLabel::CreateRewriter(rText));
- StartUndo(SwUndoId::INSERTLABEL, &aRewriter);
-
- sal_uLong nIdx = 0;
- bool bInnerCntIsFly = false;
- SwFlyFrameFormat* pFlyFormat = nullptr;
- switch( eType )
+ case LTYPE_OBJECT:
+ case LTYPE_FLY:
+ bInnerCntIsFly = pCnt->IsInFly();
+ if (bInnerCntIsFly)
{
- case LTYPE_OBJECT:
- case LTYPE_FLY:
- bInnerCntIsFly = pCnt->IsInFly();
- if (bInnerCntIsFly)
- {
- // pass down index to the startnode for flys
- nIdx = pCnt->FindFlyFrame()->
- GetFormat()->GetContent().GetContentIdx()->GetIndex();
- }
- break;
- case LTYPE_TABLE:
- if( pCnt->IsInTab() )
- {
- // pass down index to the TableNode for tables
- const SwTable& rTable = *pCnt->FindTabFrame()->GetTable();
- nIdx = rTable.GetTabSortBoxes()[ 0 ]
- ->GetSttNd()->FindTableNode()->GetIndex();
- }
- break;
- case LTYPE_DRAW:
- if( Imp()->GetDrawView() )
- {
- SwDrawView *pDView = Imp()->GetDrawView();
- const SdrMarkList& rMrkList = pDView->GetMarkedObjectList();
+ // pass down index to the startnode for flys
+ nIdx = pCnt->FindFlyFrame()->
+ GetFormat()->GetContent().GetContentIdx()->GetIndex();
+ }
+ break;
+ case LTYPE_TABLE:
+ if( pCnt->IsInTab() )
+ {
+ // pass down index to the TableNode for tables
+ const SwTable& rTable = *pCnt->FindTabFrame()->GetTable();
+ nIdx = rTable.GetTabSortBoxes()[ 0 ]
+ ->GetSttNd()->FindTableNode()->GetIndex();
+ }
+ break;
+ case LTYPE_DRAW:
+ if( Imp()->GetDrawView() )
+ {
+ SwDrawView *pDView = Imp()->GetDrawView();
+ const SdrMarkList& rMrkList = pDView->GetMarkedObjectList();
- // copy marked drawing objects to
- // local list to perform the corresponding action for each object
- std::vector<SdrObject*> aDrawObjs;
+ // copy marked drawing objects to
+ // local list to perform the corresponding action for each object
+ std::vector<SdrObject*> aDrawObjs;
+ {
+ for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
{
- for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i )
- {
- SdrObject* pDrawObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
- if( pDrawObj )
- aDrawObjs.push_back( pDrawObj );
- }
+ SdrObject* pDrawObj = rMrkList.GetMark(i)->GetMarkedSdrObj();
+ if( pDrawObj )
+ aDrawObjs.push_back( pDrawObj );
}
- // loop on marked drawing objects
- while ( !aDrawObjs.empty() )
+ }
+ // loop on marked drawing objects
+ while ( !aDrawObjs.empty() )
+ {
+ SdrObject* pDrawObj = aDrawObjs.back();
+ if ( dynamic_cast<const SwVirtFlyDrawObj*>( pDrawObj) == nullptr &&
+ dynamic_cast<const SwFlyDrawObj*>( pDrawObj) == nullptr )
{
- SdrObject* pDrawObj = aDrawObjs.back();
- if ( dynamic_cast<const SwVirtFlyDrawObj*>( pDrawObj) == nullptr &&
- dynamic_cast<const SwFlyDrawObj*>( pDrawObj) == nullptr )
- {
- SwFlyFrameFormat *pFormat =
- GetDoc()->InsertDrawLabel( rText, rSeparator, rNumberSeparator, nId, rCharacterStyle, *pDrawObj );
- if( !pFlyFormat )
- pFlyFormat = pFormat;
- }
-
- aDrawObjs.pop_back();
+ SwFlyFrameFormat *pFormat =
+ GetDoc()->InsertDrawLabel( rText, rSeparator, rNumberSeparator, nId, rCharacterStyle, *pDrawObj );
+ if( !pFlyFormat )
+ pFlyFormat = pFormat;
}
+ aDrawObjs.pop_back();
}
- break;
- default:
- OSL_ENSURE( false, "Cursor neither in table nor in fly." );
+
}
+ break;
+ default:
+ OSL_ENSURE( false, "Cursor neither in table nor in fly." );
+ }
- if( nIdx )
+ if( nIdx )
+ {
+ pFlyFormat = GetDoc()->InsertLabel(eType, rText, rSeparator,
+ rNumberSeparator, bBefore, nId,
+ nIdx, rCharacterStyle, bCpyBrd);
+
+ //if we succeeded in putting a caption on the content, and the
+ //content was a frame/graphic, then set the contained element
+ //to as-char anchoring because that's all msword is able to
+ //do when inside a frame, and in writer for freshly captioned
+ //elements it's largely irrelevant what the anchor of the contained
+ //type is but making it as-char by default results in very
+ //good roundtripping
+ if (pFlyFormat && bInnerCntIsFly)
{
- pFlyFormat = GetDoc()->InsertLabel(eType, rText, rSeparator,
- rNumberSeparator, bBefore, nId,
- nIdx, rCharacterStyle, bCpyBrd);
-
- //if we succeeded in putting a caption on the content, and the
- //content was a frame/graphic, then set the contained element
- //to as-char anchoring because that's all msword is able to
- //do when inside a frame, and in writer for freshly captioned
- //elements it's largely irrelevant what the anchor of the contained
- //type is but making it as-char by default results in very
- //good roundtripping
- if (pFlyFormat && bInnerCntIsFly)
- {
- SwNodeIndex aAnchIdx(*pFlyFormat->GetContent().GetContentIdx(), 1);
- SwTextNode *pTextNode = aAnchIdx.GetNode().GetTextNode();
+ SwNodeIndex aAnchIdx(*pFlyFormat->GetContent().GetContentIdx(), 1);
+ SwTextNode *pTextNode = aAnchIdx.GetNode().GetTextNode();
- SwFormatAnchor aAnc(RndStdIds::FLY_AS_CHAR);
- sal_Int32 nInsertPos = bBefore ? pTextNode->Len() : 0;
- SwPosition aPos(*pTextNode, nInsertPos);
+ SwFormatAnchor aAnc(RndStdIds::FLY_AS_CHAR);
+ sal_Int32 nInsertPos = bBefore ? pTextNode->Len() : 0;
+ SwPosition aPos(*pTextNode, nInsertPos);
- aAnc.SetAnchor(&aPos);
+ aAnc.SetAnchor(&aPos);
- SwFlyFrame *pFly = GetSelectedOrCurrFlyFrame();
- OSL_ENSURE(pFly, "SetFlyFrameAttr, no Fly selected.");
- if (pFly)
- {
- SfxItemSet aSet(makeItemSetFromFormatAnchor(GetDoc()->GetAttrPool(), aAnc));
- SwFlyFrameFormat* pInnerFlyFormat = pFly->GetFormat();
- GetDoc()->SetFlyFrameAttr(*pInnerFlyFormat, aSet);
- }
- //put a hard-break after the graphic to keep it separated
- //from the caption text if the outer frame is resized
- const sal_Int32 nIndex = bBefore ? nInsertPos : 1;
- SwIndex aIdx(pTextNode, nIndex);
- pTextNode->InsertText("\n", aIdx);
- //set the hard-break to be hidden, otherwise it has
- //non-zero width in word and so hard-break flows on
- //the next line, pushing the caption text out of
- //the frame making the caption apparently disappear
- SvxCharHiddenItem aHidden(true, RES_CHRATR_HIDDEN);
- SfxItemSet aSet(GetDoc()->GetAttrPool(), {{aHidden.Which(), aHidden.Which()}});
- aSet.Put(aHidden);
- pTextNode->SetAttr(aSet, nIndex, nIndex + 1);
+ SwFlyFrame *pFly = GetSelectedOrCurrFlyFrame();
+ OSL_ENSURE(pFly, "SetFlyFrameAttr, no Fly selected.");
+ if (pFly)
+ {
+ SfxItemSet aSet(makeItemSetFromFormatAnchor(GetDoc()->GetAttrPool(), aAnc));
+ SwFlyFrameFormat* pInnerFlyFormat = pFly->GetFormat();
+ GetDoc()->SetFlyFrameAttr(*pInnerFlyFormat, aSet);
}
+ //put a hard-break after the graphic to keep it separated
+ //from the caption text if the outer frame is resized
+ const sal_Int32 nIndex = bBefore ? nInsertPos : 1;
+ SwIndex aIdx(pTextNode, nIndex);
+ pTextNode->InsertText("\n", aIdx);
+ //set the hard-break to be hidden, otherwise it has
+ //non-zero width in word and so hard-break flows on
+ //the next line, pushing the caption text out of
+ //the frame making the caption apparently disappear
+ SvxCharHiddenItem aHidden(true, RES_CHRATR_HIDDEN);
+ SfxItemSet aSet(GetDoc()->GetAttrPool(), {{aHidden.Which(), aHidden.Which()}});
+ aSet.Put(aHidden);
+ pTextNode->SetAttr(aSet, nIndex, nIndex + 1);
}
+ }
- if (pFlyFormat)
- {
- const Point aPt(GetCursorDocPos());
- if (SwFlyFrame* pFrame = pFlyFormat->GetFrame(&aPt))
- SelectFlyFrame(*pFrame);
- }
- EndUndo();
- EndAllActionAndCall();
+ if (pFlyFormat)
+ {
+ const Point aPt(GetCursorDocPos());
+ if (SwFlyFrame* pFrame = pFlyFormat->GetFrame(&aPt))
+ SelectFlyFrame(*pFrame);
}
+ EndUndo();
+ EndAllActionAndCall();
+
}
bool SwFEShell::Sort(const SwSortOptions& rOpt)
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index 8f440743b736..c87f952ff5cb 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -634,42 +634,43 @@ void SwFlyFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
else
UpdateAttr_( pOld, pNew, nInvFlags );
- if ( nInvFlags != 0 )
- {
- Invalidate_();
- if ( nInvFlags & 0x01 )
- {
- InvalidatePos_();
- // #i68520#
- InvalidateObjRectWithSpaces();
- }
- if ( nInvFlags & 0x02 )
- {
- InvalidateSize_();
- // #i68520#
- InvalidateObjRectWithSpaces();
- }
- if ( nInvFlags & 0x04 )
- InvalidatePrt_();
- if ( nInvFlags & 0x08 )
- SetNotifyBack();
- if ( nInvFlags & 0x10 )
- SetCompletePaint();
- if ( ( nInvFlags & 0x40 ) && Lower() && Lower()->IsNoTextFrame() )
- ClrContourCache( GetVirtDrawObj() );
- SwRootFrame *pRoot;
- if ( nInvFlags & 0x20 && nullptr != (pRoot = getRootFrame()) )
- pRoot->InvalidateBrowseWidth();
- // #i28701#
- if ( nInvFlags & 0x80 )
- {
- // update sorted object lists, the Writer fly frame is registered at.
- UpdateObjInSortedList();
- }
+ if ( nInvFlags == 0 )
+ return;
- // #i87645# - reset flags for the layout process (only if something has been invalidated)
- ResetLayoutProcessBools();
+ Invalidate_();
+ if ( nInvFlags & 0x01 )
+ {
+ InvalidatePos_();
+ // #i68520#
+ InvalidateObjRectWithSpaces();
+ }
+ if ( nInvFlags & 0x02 )
+ {
+ InvalidateSize_();
+ // #i68520#
+ InvalidateObjRectWithSpaces();
+ }
+ if ( nInvFlags & 0x04 )
+ InvalidatePrt_();
+ if ( nInvFlags & 0x08 )
+ SetNotifyBack();
+ if ( nInvFlags & 0x10 )
+ SetCompletePaint();
+ if ( ( nInvFlags & 0x40 ) && Lower() && Lower()->IsNoTextFrame() )
+ ClrContourCache( GetVirtDrawObj() );
+ SwRootFrame *pRoot;
+ if ( nInvFlags & 0x20 && nullptr != (pRoot = getRootFrame()) )
+ pRoot->InvalidateBrowseWidth();
+ // #i28701#
+ if ( nInvFlags & 0x80 )
+ {
+ // update sorted object lists, the Writer fly frame is registered at.
+ UpdateObjInSortedList();
}
+
+ // #i87645# - reset flags for the layout process (only if something has been invalidated)
+ ResetLayoutProcessBools();
+
}
void SwFlyFrame::UpdateAttr_( const SfxPoolItem *pOld, const SfxPoolItem *pNew,
@@ -1046,116 +1047,117 @@ void SwFlyFrame::Invalidate_( SwPageFrame const *pPage )
*/
void SwFlyFrame::ChgRelPos( const Point &rNewPos )
{
- if ( GetCurrRelPos() != rNewPos )
+ if ( GetCurrRelPos() == rNewPos )
+ return;
+
+ SwFrameFormat *pFormat = GetFormat();
+ const bool bVert = GetAnchorFrame()->IsVertical();
+ const SwTwips nNewY = bVert ? rNewPos.X() : rNewPos.Y();
+ SwTwips nTmpY = nNewY == LONG_MAX ? 0 : nNewY;
+ if( bVert )
+ nTmpY = -nTmpY;
+ SfxItemSet aSet( pFormat->GetDoc()->GetAttrPool(),
+ svl::Items<RES_VERT_ORIENT, RES_HORI_ORIENT>{});
+
+ SwFormatVertOrient aVert( pFormat->GetVertOrient() );
+ const SwTextFrame *pAutoFrame = nullptr;
+ // #i34948# - handle also at-page and at-fly anchored
+ // Writer fly frames
+ const RndStdIds eAnchorType = GetFrameFormat().GetAnchor().GetAnchorId();
+ if ( eAnchorType == RndStdIds::FLY_AT_PAGE )
{
- SwFrameFormat *pFormat = GetFormat();
- const bool bVert = GetAnchorFrame()->IsVertical();
- const SwTwips nNewY = bVert ? rNewPos.X() : rNewPos.Y();
- SwTwips nTmpY = nNewY == LONG_MAX ? 0 : nNewY;
- if( bVert )
- nTmpY = -nTmpY;
- SfxItemSet aSet( pFormat->GetDoc()->GetAttrPool(),
- svl::Items<RES_VERT_ORIENT, RES_HORI_ORIENT>{});
-
- SwFormatVertOrient aVert( pFormat->GetVertOrient() );
- const SwTextFrame *pAutoFrame = nullptr;
+ aVert.SetVertOrient( text::VertOrientation::NONE );
+ aVert.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
+ }
+ else if ( eAnchorType == RndStdIds::FLY_AT_FLY )
+ {
+ aVert.SetVertOrient( text::VertOrientation::NONE );
+ aVert.SetRelationOrient( text::RelOrientation::FRAME );
+ }
+ else if ( IsFlyAtContentFrame() || text::VertOrientation::NONE != aVert.GetVertOrient() )
+ {
+ if( text::RelOrientation::CHAR == aVert.GetRelationOrient() && IsAutoPos() )
+ {
+ if( LONG_MAX != nNewY )
+ {
+ aVert.SetVertOrient( text::VertOrientation::NONE );
+ sal_Int32 nOfs =
+ pFormat->GetAnchor().GetContentAnchor()->nContent.GetIndex();
+ OSL_ENSURE( GetAnchorFrame()->IsTextFrame(), "TextFrame expected" );
+ pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
+ while( pAutoFrame->GetFollow() &&
+ pAutoFrame->GetFollow()->GetOfst() <= nOfs )
+ {
+ if( pAutoFrame == GetAnchorFrame() )
+ nTmpY += pAutoFrame->GetRelPos().Y();
+ nTmpY -= pAutoFrame->GetUpper()->getFramePrintArea().Height();
+ pAutoFrame = pAutoFrame->GetFollow();
+ }
+ nTmpY = static_cast<SwFlyAtContentFrame*>(this)->GetRelCharY(pAutoFrame)-nTmpY;
+ }
+ else
+ aVert.SetVertOrient( text::VertOrientation::CHAR_BOTTOM );
+ }
+ else
+ {
+ aVert.SetVertOrient( text::VertOrientation::NONE );
+ aVert.SetRelationOrient( text::RelOrientation::FRAME );
+ }
+ }
+ aVert.SetPos( nTmpY );
+ aSet.Put( aVert );
+
+ // For Flys in the Cnt, the horizontal orientation is of no interest,
+ // as it's always 0
+ if ( !IsFlyInContentFrame() )
+ {
+ const SwTwips nNewX = bVert ? rNewPos.Y() : rNewPos.X();
+ SwTwips nTmpX = nNewX == LONG_MAX ? 0 : nNewX;
+ SwFormatHoriOrient aHori( pFormat->GetHoriOrient() );
// #i34948# - handle also at-page and at-fly anchored
// Writer fly frames
- const RndStdIds eAnchorType = GetFrameFormat().GetAnchor().GetAnchorId();
if ( eAnchorType == RndStdIds::FLY_AT_PAGE )
{
- aVert.SetVertOrient( text::VertOrientation::NONE );
- aVert.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
+ aHori.SetHoriOrient( text::HoriOrientation::NONE );
+ aHori.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
+ aHori.SetPosToggle( false );
}
else if ( eAnchorType == RndStdIds::FLY_AT_FLY )
{
- aVert.SetVertOrient( text::VertOrientation::NONE );
- aVert.SetRelationOrient( text::RelOrientation::FRAME );
+ aHori.SetHoriOrient( text::HoriOrientation::NONE );
+ aHori.SetRelationOrient( text::RelOrientation::FRAME );
+ aHori.SetPosToggle( false );
}
- else if ( IsFlyAtContentFrame() || text::VertOrientation::NONE != aVert.GetVertOrient() )
+ else if ( IsFlyAtContentFrame() || text::HoriOrientation::NONE != aHori.GetHoriOrient() )
{
- if( text::RelOrientation::CHAR == aVert.GetRelationOrient() && IsAutoPos() )
+ aHori.SetHoriOrient( text::HoriOrientation::NONE );
+ if( text::RelOrientation::CHAR == aHori.GetRelationOrient() && IsAutoPos() )
{
- if( LONG_MAX != nNewY )
+ if( LONG_MAX != nNewX )
{
- aVert.SetVertOrient( text::VertOrientation::NONE );
- sal_Int32 nOfs =
- pFormat->GetAnchor().GetContentAnchor()->nContent.GetIndex();
- OSL_ENSURE( GetAnchorFrame()->IsTextFrame(), "TextFrame expected" );
- pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
- while( pAutoFrame->GetFollow() &&
- pAutoFrame->GetFollow()->GetOfst() <= nOfs )
+ if( !pAutoFrame )
{
- if( pAutoFrame == GetAnchorFrame() )
- nTmpY += pAutoFrame->GetRelPos().Y();
- nTmpY -= pAutoFrame->GetUpper()->getFramePrintArea().Height();
- pAutoFrame = pAutoFrame->GetFollow();
+ sal_Int32 nOfs = pFormat->GetAnchor().GetContentAnchor()
+ ->nContent.GetIndex();
+ OSL_ENSURE( GetAnchorFrame()->IsTextFrame(), "TextFrame expected");
+ pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
+ while( pAutoFrame->GetFollow() &&
+ pAutoFrame->GetFollow()->GetOfst() <= nOfs )
+ pAutoFrame = pAutoFrame->GetFollow();
}
- nTmpY = static_cast<SwFlyAtContentFrame*>(this)->GetRelCharY(pAutoFrame)-nTmpY;
+ nTmpX -= static_cast<SwFlyAtContentFrame*>(this)->GetRelCharX(pAutoFrame);
}
- else
- aVert.SetVertOrient( text::VertOrientation::CHAR_BOTTOM );
}
else
- {
- aVert.SetVertOrient( text::VertOrientation::NONE );
- aVert.SetRelationOrient( text::RelOrientation::FRAME );
- }
- }
- aVert.SetPos( nTmpY );
- aSet.Put( aVert );
-
- // For Flys in the Cnt, the horizontal orientation is of no interest,
- // as it's always 0
- if ( !IsFlyInContentFrame() )
- {
- const SwTwips nNewX = bVert ? rNewPos.Y() : rNewPos.X();
- SwTwips nTmpX = nNewX == LONG_MAX ? 0 : nNewX;
- SwFormatHoriOrient aHori( pFormat->GetHoriOrient() );
- // #i34948# - handle also at-page and at-fly anchored
- // Writer fly frames
- if ( eAnchorType == RndStdIds::FLY_AT_PAGE )
- {
- aHori.SetHoriOrient( text::HoriOrientation::NONE );
- aHori.SetRelationOrient( text::RelOrientation::PAGE_FRAME );
- aHori.SetPosToggle( false );
- }
- else if ( eAnchorType == RndStdIds::FLY_AT_FLY )
- {
- aHori.SetHoriOrient( text::HoriOrientation::NONE );
aHori.SetRelationOrient( text::RelOrientation::FRAME );
- aHori.SetPosToggle( false );
- }
- else if ( IsFlyAtContentFrame() || text::HoriOrientation::NONE != aHori.GetHoriOrient() )
- {
- aHori.SetHoriOrient( text::HoriOrientation::NONE );
- if( text::RelOrientation::CHAR == aHori.GetRelationOrient() && IsAutoPos() )
- {
- if( LONG_MAX != nNewX )
- {
- if( !pAutoFrame )
- {
- sal_Int32 nOfs = pFormat->GetAnchor().GetContentAnchor()
- ->nContent.GetIndex();
- OSL_ENSURE( GetAnchorFrame()->IsTextFrame(), "TextFrame expected");
- pAutoFrame = static_cast<const SwTextFrame*>(GetAnchorFrame());
- while( pAutoFrame->GetFollow() &&
- pAutoFrame->GetFollow()->GetOfst() <= nOfs )
- pAutoFrame = pAutoFrame->GetFollow();
- }
- nTmpX -= static_cast<SwFlyAtContentFrame*>(this)->GetRelCharX(pAutoFrame);
- }
- }
- else
- aHori.SetRelationOrient( text::RelOrientation::FRAME );
- aHori.SetPosToggle( false );
- }
- aHori.SetPos( nTmpX );
- aSet.Put( aHori );
+ aHori.SetPosToggle( false );
}
- SetCurrRelPos( rNewPos );
- pFormat->GetDoc()->SetAttr( aSet, *pFormat );
+ aHori.SetPos( nTmpX );
+ aSet.Put( aHori );
}
+ SetCurrRelPos( rNewPos );
+ pFormat->GetDoc()->SetAttr( aSet, *pFormat );
+
}
/** "Formats" the Frame; Frame and PrtArea.
@@ -1689,61 +1691,62 @@ void SwFlyFrame::MakePrtArea( const SwBorderAttrs &rAttrs )
void SwFlyFrame::MakeContentPos( const SwBorderAttrs &rAttrs )
{
- if ( !m_bValidContentPos )
- {
- m_bValidContentPos = true;
+ if ( m_bValidContentPos )
+ return;
- const SwTwips nUL = rAttrs.CalcTopLine() + rAttrs.CalcBottomLine();
- Size aRelSize( CalcRel( GetFormat()->GetFrameSize() ) );
+ m_bValidContentPos = true;
- SwRectFnSet aRectFnSet(this);
- long nMinHeight = 0;
- if( IsMinHeight() )
- nMinHeight = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height();
+ const SwTwips nUL = rAttrs.CalcTopLine() + rAttrs.CalcBottomLine();
+ Size aRelSize( CalcRel( GetFormat()->GetFrameSize() ) );
- Point aNewContentPos;
- aNewContentPos = getFramePrintArea().Pos();
- const SdrTextVertAdjust nAdjust = GetFormat()->GetTextVertAdjust().GetValue();
+ SwRectFnSet aRectFnSet(this);
+ long nMinHeight = 0;
+ if( IsMinHeight() )
+ nMinHeight = aRectFnSet.IsVert() ? aRelSize.Width() : aRelSize.Height();
- if( nAdjust != SDRTEXTVERTADJUST_TOP )
- {
- const SwTwips nContentHeight = CalcContentHeight(&rAttrs, nMinHeight, nUL);
- SwTwips nDiff = 0;
+ Point aNewContentPos;
+ aNewContentPos = getFramePrintArea().Pos();
+ const SdrTextVertAdjust nAdjust = GetFormat()->GetTextVertAdjust().GetValue();
+
+ if( nAdjust != SDRTEXTVERTADJUST_TOP )
+ {
+ const SwTwips nContentHeight = CalcContentHeight(&rAttrs, nMinHeight, nUL);
+ SwTwips nDiff = 0;
- if( nContentHeight != 0)
- nDiff = aRectFnSet.GetHeight(getFramePrintArea()) - nContentHeight;
+ if( nContentHeight != 0)
+ nDiff = aRectFnSet.GetHeight(getFramePrintArea()) - nContentHeight;
- if( nDiff > 0 )
+ if( nDiff > 0 )
+ {
+ if( nAdjust == SDRTEXTVERTADJUST_CENTER )
{
- if( nAdjust == SDRTEXTVERTADJUST_CENTER )
- {
- if( aRectFnSet.IsVertL2R() )
- aNewContentPos.setX(aNewContentPos.getX() + nDiff/2);
- else if( aRectFnSet.IsVert() )
- aNewContentPos.setX(aNewContentPos.getX() - nDiff/2);
- else
- aNewContentPos.setY(aNewContentPos.getY() + nDiff/2);
- }
- else if( nAdjust == SDRTEXTVERTADJUST_BOTTOM )
- {
- if( aRectFnSet.IsVertL2R() )
- aNewContentPos.setX(aNewContentPos.getX() + nDiff);
- else if( aRectFnSet.IsVert() )
- aNewContentPos.setX(aNewContentPos.getX() - nDiff);
- else
- aNewContentPos.setY(aNewContentPos.getY() + nDiff);
- }
+ if( aRectFnSet.IsVertL2R() )
+ aNewContentPos.setX(aNewContentPos.getX() + nDiff/2);
+ else if( aRectFnSet.IsVert() )
+ aNewContentPos.setX(aNewContentPos.getX() - nDiff/2);
+ else
+ aNewContentPos.setY(aNewContentPos.getY() + nDiff/2);
}
- }
- if( aNewContentPos != ContentPos() )
- {
- ContentPos() = aNewContentPos;
- for( SwFrame *pFrame = Lower(); pFrame; pFrame = pFrame->GetNext())
+ else if( nAdjust == SDRTEXTVERTADJUST_BOTTOM )
{
- pFrame->InvalidatePos();
+ if( aRectFnSet.IsVertL2R() )
+ aNewContentPos.setX(aNewContentPos.getX() + nDiff);
+ else if( aRectFnSet.IsVert() )
+ aNewContentPos.setX(aNewContentPos.getX() - nDiff);
+ else
+ aNewContentPos.setY(aNewContentPos.getY() + nDiff);
}
}
}
+ if( aNewContentPos != ContentPos() )
+ {
+ ContentPos() = aNewContentPos;
+ for( SwFrame *pFrame = Lower(); pFrame; pFrame = pFrame->GetNext())
+ {
+ pFrame->InvalidatePos();
+ }
+ }
+
}
void SwFlyFrame::InvalidateContentPos()
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 72f86fc8fd69..2956f4315a11 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -218,32 +218,33 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg
// create and insert body area if it is not a blank page
SwDoc *pDoc = pFormat->GetDoc();
m_bEmptyPage = pFormat == pDoc->GetEmptyPageFormat();
- if ( !m_bEmptyPage )
- {
- m_bEmptyPage = false;
- Calc(pRenderContext); // so that the PrtArea is correct
- SwBodyFrame *pBodyFrame = new SwBodyFrame( pDoc->GetDfltFrameFormat(), this );
- pBodyFrame->ChgSize( getFramePrintArea().SSize() );
- pBodyFrame->Paste( this );
- pBodyFrame->Calc(pRenderContext); // so that the columns can be inserted correctly
- pBodyFrame->InvalidatePos();
+ if ( m_bEmptyPage )
+ return;
- if ( bBrowseMode )
- InvalidateSize_();
+ m_bEmptyPage = false;
+ Calc(pRenderContext); // so that the PrtArea is correct
+ SwBodyFrame *pBodyFrame = new SwBodyFrame( pDoc->GetDfltFrameFormat(), this );
+ pBodyFrame->ChgSize( getFramePrintArea().SSize() );
+ pBodyFrame->Paste( this );
+ pBodyFrame->Calc(pRenderContext); // so that the columns can be inserted correctly
+ pBodyFrame->InvalidatePos();
- // insert header/footer,, but only if active.
- if ( pFormat->GetHeader().IsActive() )
- PrepareHeader();
- if ( pFormat->GetFooter().IsActive() )
- PrepareFooter();
+ if ( bBrowseMode )
+ InvalidateSize_();
- const SwFormatCol &rCol = pFormat->GetCol();
- if ( rCol.GetNumCols() > 1 )
- {
- const SwFormatCol aOld; //ChgColumns() needs an old value
- pBodyFrame->ChgColumns( aOld, rCol );
- }
+ // insert header/footer,, but only if active.
+ if ( pFormat->GetHeader().IsActive() )
+ PrepareHeader();
+ if ( pFormat->GetFooter().IsActive() )
+ PrepareFooter();
+
+ const SwFormatCol &rCol = pFormat->GetCol();
+ if ( rCol.GetNumCols() > 1 )
+ {
+ const SwFormatCol aOld; //ChgColumns() needs an old value
+ pBodyFrame->ChgColumns( aOld, rCol );
}
+
}
void SwPageFrame::DestroyImpl()
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 314338a7084e..6e687eddd781 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -864,24 +864,89 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties const &prope
{
// Paint the borders. Sadly two passes are needed.
// Once for the inside and once for the outside edges of tables
- if ( aLineRects.size() != nLastCount )
+ if ( aLineRects.size() == nLastCount )
+ return;
+
+ // #i16816# tagged pdf support
+ SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pOut );
+
+ pOut->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
+ pOut->SetFillColor();
+ pOut->SetLineColor();
+ ConnectEdges( pOut, properties );
+ const Color *pLast = nullptr;
+
+ bool bPaint2nd = false;
+ size_t nMinCount = aLineRects.size();
+
+ for ( size_t i = 0; i < aLineRects.size(); ++i )
{
- // #i16816# tagged pdf support
- SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pOut );
+ SwLineRect &rLRect = aLineRects[i];
- pOut->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
- pOut->SetFillColor();
- pOut->SetLineColor();
- ConnectEdges( pOut, properties );
- const Color *pLast = nullptr;
+ if ( rLRect.IsPainted() )
+ continue;
- bool bPaint2nd = false;
- size_t nMinCount = aLineRects.size();
+ if ( rLRect.IsLocked() )
+ {
+ nMinCount = std::min( nMinCount, i );
+ continue;
+ }
+
+ // Paint it now or in the second pass?
+ bool bPaint = true;
+ if ( rLRect.GetTab() )
+ {
+ if ( rLRect.Height() > rLRect.Width() )
+ {
+ // Vertical edge, overlapping with the table edge?
+ SwTwips nLLeft = rLRect.Left() - 30,
+ nLRight = rLRect.Right() + 30,
+ nTLeft = rLRect.GetTab()->getFrameArea().Left() + rLRect.GetTab()->getFramePrintArea().Left(),
+ nTRight = rLRect.GetTab()->getFrameArea().Left() + rLRect.GetTab()->getFramePrintArea().Right();
+ if ( (nTLeft >= nLLeft && nTLeft <= nLRight) ||
+ (nTRight>= nLLeft && nTRight<= nLRight) )
+ bPaint = false;
+ }
+ else
+ {
+ // Horizontal edge, overlapping with the table edge?
+ SwTwips nLTop = rLRect.Top() - 30,
+ nLBottom = rLRect.Bottom() + 30,
+ nTTop = rLRect.GetTab()->getFrameArea().Top() + rLRect.GetTab()->getFramePrintArea().Top(),
+ nTBottom = rLRect.GetTab()->getFrameArea().Top() + rLRect.GetTab()->getFramePrintArea().Bottom();
+ if ( (nTTop >= nLTop && nTTop <= nLBottom) ||
+ (nTBottom >= nLTop && nTBottom <= nLBottom) )
+ bPaint = false;
+ }
+ }
+ if ( bPaint )
+ {
+ if ( !pLast || *pLast != rLRect.GetColor() )
+ {
+ pLast = &rLRect.GetColor();
+ DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
+ if( properties.pSGlobalShell->GetWin() &&
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
+ pOut->SetDrawMode( DrawModeFlags::Default );
+
+ pOut->SetLineColor( *pLast );
+ pOut->SetFillColor( *pLast );
+ pOut->SetDrawMode( nOldDrawMode );
+ }
+
+ if( !rLRect.IsEmpty() )
+ lcl_DrawDashedRect( pOut, rLRect );
+ rLRect.SetPainted();
+ }
+ else
+ bPaint2nd = true;
+ }
+ if ( bPaint2nd )
+ {
for ( size_t i = 0; i < aLineRects.size(); ++i )
{
SwLineRect &rLRect = aLineRects[i];
-
if ( rLRect.IsPainted() )
continue;
@@ -891,92 +956,28 @@ void SwLineRects::PaintLines( OutputDevice *pOut, SwPaintProperties const &prope
continue;
}
- // Paint it now or in the second pass?
- bool bPaint = true;
- if ( rLRect.GetTab() )
- {
- if ( rLRect.Height() > rLRect.Width() )
- {
- // Vertical edge, overlapping with the table edge?
- SwTwips nLLeft = rLRect.Left() - 30,
- nLRight = rLRect.Right() + 30,
- nTLeft = rLRect.GetTab()->getFrameArea().Left() + rLRect.GetTab()->getFramePrintArea().Left(),
- nTRight = rLRect.GetTab()->getFrameArea().Left() + rLRect.GetTab()->getFramePrintArea().Right();
- if ( (nTLeft >= nLLeft && nTLeft <= nLRight) ||
- (nTRight>= nLLeft && nTRight<= nLRight) )
- bPaint = false;
- }
- else
- {
- // Horizontal edge, overlapping with the table edge?
- SwTwips nLTop = rLRect.Top() - 30,
- nLBottom = rLRect.Bottom() + 30,
- nTTop = rLRect.GetTab()->getFrameArea().Top() + rLRect.GetTab()->getFramePrintArea().Top(),
- nTBottom = rLRect.GetTab()->getFrameArea().Top() + rLRect.GetTab()->getFramePrintArea().Bottom();
- if ( (nTTop >= nLTop && nTTop <= nLBottom) ||
- (nTBottom >= nLTop && nTBottom <= nLBottom) )
- bPaint = false;
- }
- }
- if ( bPaint )
+ if ( !pLast || *pLast != rLRect.GetColor() )
{
- if ( !pLast || *pLast != rLRect.GetColor() )
- {
- pLast = &rLRect.GetColor();
-
- DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
- if( properties.pSGlobalShell->GetWin() &&
- Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- pOut->SetDrawMode( DrawModeFlags::Default );
-
- pOut->SetLineColor( *pLast );
- pOut->SetFillColor( *pLast );
- pOut->SetDrawMode( nOldDrawMode );
- }
+ pLast = &rLRect.GetColor();
- if( !rLRect.IsEmpty() )
- lcl_DrawDashedRect( pOut, rLRect );
- rLRect.SetPainted();
- }
- else
- bPaint2nd = true;
- }
- if ( bPaint2nd )
- {
- for ( size_t i = 0; i < aLineRects.size(); ++i )
- {
- SwLineRect &rLRect = aLineRects[i];
- if ( rLRect.IsPainted() )
- continue;
-
- if ( rLRect.IsLocked() )
+ DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
+ if( properties.pSGlobalShell->GetWin() &&
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
{
- nMinCount = std::min( nMinCount, i );
- continue;
+ pOut->SetDrawMode( DrawModeFlags::Default );
}
- if ( !pLast || *pLast != rLRect.GetColor() )
- {
- pLast = &rLRect.GetColor();
-
- DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
- if( properties.pSGlobalShell->GetWin() &&
- Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
- {
- pOut->SetDrawMode( DrawModeFlags::Default );
- }
-
- pOut->SetFillColor( *pLast );
- pOut->SetDrawMode( nOldDrawMode );
- }
- if( !rLRect.IsEmpty() )
- lcl_DrawDashedRect( pOut, rLRect );
- rLRect.SetPainted();
+ pOut->SetFillColor( *pLast );
+ pOut->SetDrawMode( nOldDrawMode );
}
+ if( !rLRect.IsEmpty() )
+ lcl_DrawDashedRect( pOut, rLRect );
+ rLRect.SetPainted();
}
- nLastCount = nMinCount;
- pOut->Pop();
}
+ nLastCount = nMinCount;
+ pOut->Pop();
+
}
void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
@@ -5274,96 +5275,97 @@ void SwFrame::PaintBorder( const SwRect& rRect, const SwPageFrame *pPage,
// - add condition <bFoundCellForTopOrBorderAttrs>
//-hack
- if ( bLine || bShadow || bFoundCellForTopOrBorderAttrs )
- {
- //If the rectangle is completely inside the PrtArea, no border needs to
- //be painted.
- //For the PrtArea the aligned value needs to be used, otherwise it could
- //happen, that some parts won't be processed.
- SwRect aRect( getFramePrintArea() );
- aRect += getFrameArea().Pos();
- ::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
- // OD 27.09.2002 #103636# - new local boolean variable in order to
- // suspend border paint under special cases - see below.
- // NOTE: This is a fix for the implementation of feature #99657#.
- bool bDrawOnlyShadowForTransparentFrame = false;
- if ( aRect.IsInside( rRect ) )
- {
- // OD 27.09.2002 #103636# - paint shadow, if background is transparent.
- // Because of introduced transparent background for fly frame #99657#,
- // the shadow have to be drawn if the background is transparent,
- // in spite the fact that the paint rectangle <rRect> lies fully
- // in the printing area.
- // NOTE to chosen solution:
- // On transparent background, continue processing, but suspend
- // drawing of border by setting <bDrawOnlyShadowForTransparentFrame>
- // to true.
- if ( IsLayoutFrame() &&
- static_cast<const SwLayoutFrame*>(this)->GetFormat()->IsBackgroundTransparent() )
+ if ( !(bLine || bShadow || bFoundCellForTopOrBorderAttrs) )
+ return;
+
+ //If the rectangle is completely inside the PrtArea, no border needs to
+ //be painted.
+ //For the PrtArea the aligned value needs to be used, otherwise it could
+ //happen, that some parts won't be processed.
+ SwRect aRect( getFramePrintArea() );
+ aRect += getFrameArea().Pos();
+ ::SwAlignRect( aRect, gProp.pSGlobalShell, gProp.pSGlobalShell->GetOut() );
+ // OD 27.09.2002 #103636# - new local boolean variable in order to
+ // suspend border paint under special cases - see below.
+ // NOTE: This is a fix for the implementation of feature #99657#.
+ bool bDrawOnlyShadowForTransparentFrame = false;
+ if ( aRect.IsInside( rRect ) )
+ {
+ // OD 27.09.2002 #103636# - paint shadow, if background is transparent.
+ // Because of introduced transparent background for fly frame #99657#,
+ // the shadow have to be drawn if the background is transparent,
+ // in spite the fact that the paint rectangle <rRect> lies fully
+ // in the printing area.
+ // NOTE to chosen solution:
+ // On transparent background, continue processing, but suspend
+ // drawing of border by setting <bDrawOnlyShadowForTransparentFrame>
+ // to true.
+ if ( IsLayoutFrame() &&
+ static_cast<const SwLayoutFrame*>(this)->GetFormat()->IsBackgroundTransparent() )
+ {
+ bDrawOnlyShadowForTransparentFrame = true;
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ if ( !pPage )
+ pPage = FindPageFrame();
+
+ ::lcl_CalcBorderRect( aRect, this, rAttrs, true, gProp );
+ rAttrs.SetGetCacheLine( true );
+ if ( bShadow )
+ PaintShadow( rRect, aRect, rAttrs );
+ // OD 27.09.2002 #103636# - suspend drawing of border
+ // add condition < NOT bDrawOnlyShadowForTransparentFrame > - see above
+ // - add condition <bFoundCellForTopOrBorderAttrs>
+ //-hack.
+ if ( ( bLine || bFoundCellForTopOrBorderAttrs ) &&
+ !bDrawOnlyShadowForTransparentFrame )
+ {
+ const SwFrame* pDirRefFrame = IsCellFrame() ? FindTabFrame() : this;
+ SwRectFnSet aRectFnSet(pDirRefFrame);
+ ::lcl_PaintLeftRightLine ( true, *(this), aRect, rAttrs, aRectFnSet.FnRect(), gProp);
+ ::lcl_PaintLeftRightLine ( false, *(this), aRect, rAttrs, aRectFnSet.FnRect(), gProp);
+ if ( !IsContentFrame() || rAttrs.GetTopLine( *(this) ) )
+ {
+ // -
+ //-hack
+ // paint is found, paint its top border.
+ if ( IsCellFrame() && pCellFrameForTopBorderAttrs != this )
{
- bDrawOnlyShadowForTransparentFrame = true;
+ SwBorderAttrAccess aAccess( SwFrame::GetCache(),
+ pCellFrameForTopBorderAttrs );
+ const SwBorderAttrs &rTopAttrs = *aAccess.Get();
+ ::lcl_PaintTopBottomLine( true, aRect, rTopAttrs, aRectFnSet.FnRect(), gProp);
}
else
{
- return;
+ ::lcl_PaintTopBottomLine( true, aRect, rAttrs, aRectFnSet.FnRect(), gProp );
}
}
-
- if ( !pPage )
- pPage = FindPageFrame();
-
- ::lcl_CalcBorderRect( aRect, this, rAttrs, true, gProp );
- rAttrs.SetGetCacheLine( true );
- if ( bShadow )
- PaintShadow( rRect, aRect, rAttrs );
- // OD 27.09.2002 #103636# - suspend drawing of border
- // add condition < NOT bDrawOnlyShadowForTransparentFrame > - see above
- // - add condition <bFoundCellForTopOrBorderAttrs>
- //-hack.
- if ( ( bLine || bFoundCellForTopOrBorderAttrs ) &&
- !bDrawOnlyShadowForTransparentFrame )
- {
- const SwFrame* pDirRefFrame = IsCellFrame() ? FindTabFrame() : this;
- SwRectFnSet aRectFnSet(pDirRefFrame);
- ::lcl_PaintLeftRightLine ( true, *(this), aRect, rAttrs, aRectFnSet.FnRect(), gProp);
- ::lcl_PaintLeftRightLine ( false, *(this), aRect, rAttrs, aRectFnSet.FnRect(), gProp);
- if ( !IsContentFrame() || rAttrs.GetTopLine( *(this) ) )
+ if ( !IsContentFrame() || rAttrs.GetBottomLine( *(this) ) )
+ {
+ // -
+ //-hack
+ // paint is found, paint its bottom border.
+ if ( IsCellFrame() && pCellFrameForBottomBorderAttrs != this )
{
- // -
- //-hack
- // paint is found, paint its top border.
- if ( IsCellFrame() && pCellFrameForTopBorderAttrs != this )
- {
- SwBorderAttrAccess aAccess( SwFrame::GetCache(),
- pCellFrameForTopBorderAttrs );
- const SwBorderAttrs &rTopAttrs = *aAccess.Get();
- ::lcl_PaintTopBottomLine( true, aRect, rTopAttrs, aRectFnSet.FnRect(), gProp);
- }
- else
- {
- ::lcl_PaintTopBottomLine( true, aRect, rAttrs, aRectFnSet.FnRect(), gProp );
- }
+ SwBorderAttrAccess aAccess( SwFrame::GetCache(),
+ pCellFrameForBottomBorderAttrs );
+ const SwBorderAttrs &rBottomAttrs = *aAccess.Get();
+ ::lcl_PaintTopBottomLine(false, aRect, rBottomAttrs, aRectFnSet.FnRect(), gProp);
}
- if ( !IsContentFrame() || rAttrs.GetBottomLine( *(this) ) )
+ else
{
- // -
- //-hack
- // paint is found, paint its bottom border.
- if ( IsCellFrame() && pCellFrameForBottomBorderAttrs != this )
- {
- SwBorderAttrAccess aAccess( SwFrame::GetCache(),
- pCellFrameForBottomBorderAttrs );
- const SwBorderAttrs &rBottomAttrs = *aAccess.Get();
- ::lcl_PaintTopBottomLine(false, aRect, rBottomAttrs, aRectFnSet.FnRect(), gProp);
- }
- else
- {
- ::lcl_PaintTopBottomLine(false, aRect, rAttrs, aRectFnSet.FnRect(), gProp);
- }
+ ::lcl_PaintTopBottomLine(false, aRect, rAttrs, aRectFnSet.FnRect(), gProp);
}
}
- rAttrs.SetGetCacheLine( false );
}
+ rAttrs.SetGetCacheLine( false );
+
}
/**
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index b294a395ec7f..3a1eafa2c746 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -1216,71 +1216,72 @@ class ExtraFormatToPositionObjs
{
vcl::RenderContext* pRenderContext = mpSectFrame->getRootFrame()->GetCurrShell()->GetOut();
// perform extra format for multi-columned section.
- if ( mpSectFrame->Lower() && mpSectFrame->Lower()->IsColumnFrame() &&
- mpSectFrame->Lower()->GetNext() )
- {
- // grow section till bottom of printing area of upper frame
- SwRectFnSet aRectFnSet(mpSectFrame);
- SwTwips nTopMargin = aRectFnSet.GetTopMargin(*mpSectFrame);
- Size aOldSectPrtSize( mpSectFrame->getFramePrintArea().SSize() );
- SwTwips nDiff = aRectFnSet.BottomDist( mpSectFrame->getFrameArea(), aRectFnSet.GetPrtBottom(*mpSectFrame->GetUpper()) );
+ if ( !(mpSectFrame->Lower() && mpSectFrame->Lower()->IsColumnFrame() &&
+ mpSectFrame->Lower()->GetNext()) )
+ return;
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*mpSectFrame);
- aRectFnSet.AddBottom( aFrm, nDiff );
- }
+ // grow section till bottom of printing area of upper frame
+ SwRectFnSet aRectFnSet(mpSectFrame);
+ SwTwips nTopMargin = aRectFnSet.GetTopMargin(*mpSectFrame);
+ Size aOldSectPrtSize( mpSectFrame->getFramePrintArea().SSize() );
+ SwTwips nDiff = aRectFnSet.BottomDist( mpSectFrame->getFrameArea(), aRectFnSet.GetPrtBottom(*mpSectFrame->GetUpper()) );
- aRectFnSet.SetYMargins( *mpSectFrame, nTopMargin, 0 );
- // #i59789#
- // suppress formatting, if printing area of section is too narrow
- if ( aRectFnSet.GetHeight(mpSectFrame->getFramePrintArea()) <= 0 )
- {
- return;
- }
- mpSectFrame->ChgLowersProp( aOldSectPrtSize );
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*mpSectFrame);
+ aRectFnSet.AddBottom( aFrm, nDiff );
+ }
- // format column frames and its body and footnote container
- SwColumnFrame* pColFrame = static_cast<SwColumnFrame*>(mpSectFrame->Lower());
- while ( pColFrame )
- {
- pColFrame->Calc(pRenderContext);
- pColFrame->Lower()->Calc(pRenderContext);
- if ( pColFrame->Lower()->GetNext() )
- {
- pColFrame->Lower()->GetNext()->Calc(pRenderContext);
- }
+ aRectFnSet.SetYMargins( *mpSectFrame, nTopMargin, 0 );
+ // #i59789#
+ // suppress formatting, if printing area of section is too narrow
+ if ( aRectFnSet.GetHeight(mpSectFrame->getFramePrintArea()) <= 0 )
+ {
+ return;
+ }
+ mpSectFrame->ChgLowersProp( aOldSectPrtSize );
- pColFrame = static_cast<SwColumnFrame*>(pColFrame->GetNext());
+ // format column frames and its body and footnote container
+ SwColumnFrame* pColFrame = static_cast<SwColumnFrame*>(mpSectFrame->Lower());
+ while ( pColFrame )
+ {
+ pColFrame->Calc(pRenderContext);
+ pColFrame->Lower()->Calc(pRenderContext);
+ if ( pColFrame->Lower()->GetNext() )
+ {
+ pColFrame->Lower()->GetNext()->Calc(pRenderContext);
}
- // unlock position of lower floating screen objects for the extra format
- // #i81555#
- // Section frame can already have changed the page and its content
- // can still be on the former page.
- // Thus, initialize objects via lower-relationship
- InitObjs( *mpSectFrame );
-
- // format content - first with collecting its foot-/endnotes before content
- // format, second without collecting its foot-/endnotes.
- ::CalcContent( mpSectFrame );
- ::CalcContent( mpSectFrame, true );
+ pColFrame = static_cast<SwColumnFrame*>(pColFrame->GetNext());
+ }
- // keep locked position of lower floating screen objects
- SwPageFrame* pPageFrame = mpSectFrame->FindPageFrame();
- SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
- if ( pObjs )
+ // unlock position of lower floating screen objects for the extra format
+ // #i81555#
+ // Section frame can already have changed the page and its content
+ // can still be on the former page.
+ // Thus, initialize objects via lower-relationship
+ InitObjs( *mpSectFrame );
+
+ // format content - first with collecting its foot-/endnotes before content
+ // format, second without collecting its foot-/endnotes.
+ ::CalcContent( mpSectFrame );
+ ::CalcContent( mpSectFrame, true );
+
+ // keep locked position of lower floating screen objects
+ SwPageFrame* pPageFrame = mpSectFrame->FindPageFrame();
+ SwSortedObjs* pObjs = pPageFrame ? pPageFrame->GetSortedObjs() : nullptr;
+ if ( pObjs )
+ {
+ for (SwAnchoredObject* pAnchoredObj : *pObjs)
{
- for (SwAnchoredObject* pAnchoredObj : *pObjs)
+ if ( mpSectFrame->IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
{
- if ( mpSectFrame->IsAnLower( pAnchoredObj->GetAnchorFrame() ) )
- {
- pAnchoredObj->SetKeepPosLocked( true );
- }
+ pAnchoredObj->SetKeepPosLocked( true );
}
}
-
- mbExtraFormatPerformed = true;
}
+
+ mbExtraFormatPerformed = true;
+
}
};
@@ -1320,204 +1321,205 @@ void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderA
aRectFnSet.SetYMargins( *this, nUpper, 0 );
}
- if ( !isFrameAreaSizeValid() )
- {
- PROTOCOL_ENTER( this, PROT::Size, DbgAction::NONE, nullptr )
- const long nOldHeight = aRectFnSet.GetHeight(getFrameArea());
- bool bOldLock = IsColLocked();
- ColLock();
+ if ( isFrameAreaSizeValid() )
+ return;
- setFrameAreaSizeValid(true);
+ PROTOCOL_ENTER( this, PROT::Size, DbgAction::NONE, nullptr )
+ const long nOldHeight = aRectFnSet.GetHeight(getFrameArea());
+ bool bOldLock = IsColLocked();
+ ColLock();
- // The size is only determined by the content, if the SectFrame does not have a
- // Follow. Otherwise it fills (occupies) the Upper down to the lower edge.
- // It is not responsible for the text flow, but the content is.
- bool bMaximize = ToMaximize( false );
+ setFrameAreaSizeValid(true);
- // OD 2004-05-17 #i28701# - If the wrapping style has to be considered
- // on object positioning, an extra formatting has to be performed
- // to determine the correct positions the floating screen objects.
- // #i40147#
- // use new helper class <ExtraFormatToPositionObjs>.
- // This class additionally keep the locked position of the objects
- // and releases this position lock keeping on destruction.
- ExtraFormatToPositionObjs aExtraFormatToPosObjs( *this );
- if ( !bMaximize &&
- GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) &&
- !GetFormat()->GetBalancedColumns().GetValue() )
- {
- aExtraFormatToPosObjs.FormatSectionToPositionObjs();
- }
+ // The size is only determined by the content, if the SectFrame does not have a
+ // Follow. Otherwise it fills (occupies) the Upper down to the lower edge.
+ // It is not responsible for the text flow, but the content is.
+ bool bMaximize = ToMaximize( false );
- // Column widths have to be adjusted before calling CheckClipping.
- // CheckClipping can cause the formatting of the lower frames
- // which still have a width of 0.
- const bool bHasColumns = Lower() && Lower()->IsColumnFrame();
- if ( bHasColumns && Lower()->GetNext() )
- AdjustColumns( nullptr, false );
+ // OD 2004-05-17 #i28701# - If the wrapping style has to be considered
+ // on object positioning, an extra formatting has to be performed
+ // to determine the correct positions the floating screen objects.
+ // #i40147#
+ // use new helper class <ExtraFormatToPositionObjs>.
+ // This class additionally keep the locked position of the objects
+ // and releases this position lock keeping on destruction.
+ ExtraFormatToPositionObjs aExtraFormatToPosObjs( *this );
+ if ( !bMaximize &&
+ GetFormat()->getIDocumentSettingAccess().get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) &&
+ !GetFormat()->GetBalancedColumns().GetValue() )
+ {
+ aExtraFormatToPosObjs.FormatSectionToPositionObjs();
+ }
- if( GetUpper() )
- {
- const long nWidth = aRectFnSet.GetWidth(GetUpper()->getFramePrintArea());
+ // Column widths have to be adjusted before calling CheckClipping.
+ // CheckClipping can cause the formatting of the lower frames
+ // which still have a width of 0.
+ const bool bHasColumns = Lower() && Lower()->IsColumnFrame();
+ if ( bHasColumns && Lower()->GetNext() )
+ AdjustColumns( nullptr, false );
- {
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aRectFnSet.SetWidth( aFrm, nWidth );
- }
+ if( GetUpper() )
+ {
+ const long nWidth = aRectFnSet.GetWidth(GetUpper()->getFramePrintArea());
- // #109700# LRSpace for sections
- {
- const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
- SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
- aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
- }
+ {
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aRectFnSet.SetWidth( aFrm, nWidth );
+ }
- // OD 15.10.2002 #103517# - allow grow in online layout
- // Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling
- // method <CheckClipping(..)>.
- const SwViewShell *pSh = getRootFrame()->GetCurrShell();
- CheckClipping( pSh && pSh->GetViewOptions()->getBrowseMode(), bMaximize );
- bMaximize = ToMaximize( false );
- setFrameAreaSizeValid(true);
+ // #109700# LRSpace for sections
+ {
+ const SvxLRSpaceItem& rLRSpace = GetFormat()->GetLRSpace();
+ SwFrameAreaDefinition::FramePrintAreaWriteAccess aPrt(*this);
+ aRectFnSet.SetWidth( aPrt, nWidth - rLRSpace.GetLeft() - rLRSpace.GetRight() );
}
- // Check the width of the columns and adjust if necessary
- if ( bHasColumns && ! Lower()->GetNext() && bMaximize )
- static_cast<SwColumnFrame*>(Lower())->Lower()->Calc(pRenderContext);
+ // OD 15.10.2002 #103517# - allow grow in online layout
+ // Thus, set <..IsBrowseMode()> as parameter <bGrow> on calling
+ // method <CheckClipping(..)>.
+ const SwViewShell *pSh = getRootFrame()->GetCurrShell();
+ CheckClipping( pSh && pSh->GetViewOptions()->getBrowseMode(), bMaximize );
+ bMaximize = ToMaximize( false );
+ setFrameAreaSizeValid(true);
+ }
+
+ // Check the width of the columns and adjust if necessary
+ if ( bHasColumns && ! Lower()->GetNext() && bMaximize )
+ static_cast<SwColumnFrame*>(Lower())->Lower()->Calc(pRenderContext);
- if ( !bMaximize )
+ if ( !bMaximize )
+ {
+ SwTwips nRemaining = aRectFnSet.GetTopMargin(*this);
+ SwFrame *pFrame = m_pLower;
+ if( pFrame )
{
- SwTwips nRemaining = aRectFnSet.GetTopMargin(*this);
- SwFrame *pFrame = m_pLower;
- if( pFrame )
+ if( pFrame->IsColumnFrame() && pFrame->GetNext() )
{
- if( pFrame->IsColumnFrame() && pFrame->GetNext() )
+ // #i61435#
+ // suppress formatting, if upper frame has height <= 0
+ if ( aRectFnSet.GetHeight(GetUpper()->getFrameArea()) > 0 )
{
- // #i61435#
- // suppress formatting, if upper frame has height <= 0
- if ( aRectFnSet.GetHeight(GetUpper()->getFrameArea()) > 0 )
- {
- FormatWidthCols( *pAttr, nRemaining, MINLAY );
- }
- // #126020# - adjust check for empty section
- // #130797# - correct fix #126020#
- while( HasFollow() && !GetFollow()->ContainsContent() &&
- !GetFollow()->ContainsAny( true ) )
- {
- SwFrame* pOld = GetFollow();
- GetFollow()->DelEmpty( false );
- if( pOld == GetFollow() )
- break;
- }
- bMaximize = ToMaximize( false );
- nRemaining += aRectFnSet.GetHeight(pFrame->getFrameArea());
+ FormatWidthCols( *pAttr, nRemaining, MINLAY );
}
- else
+ // #126020# - adjust check for empty section
+ // #130797# - correct fix #126020#
+ while( HasFollow() && !GetFollow()->ContainsContent() &&
+ !GetFollow()->ContainsAny( true ) )
{
- if( pFrame->IsColumnFrame() )
- {
- pFrame->Calc(pRenderContext);
- pFrame = static_cast<SwColumnFrame*>(pFrame)->Lower();
- pFrame->Calc(pRenderContext);
- pFrame = static_cast<SwLayoutFrame*>(pFrame)->Lower();
- CalcFootnoteContent();
- }
- // If we are in a columned frame which calls a CalcContent
- // in the FormatWidthCols, the content might need calculating
- if( pFrame && !pFrame->isFrameAreaDefinitionValid() && IsInFly() &&
- FindFlyFrame()->IsColLocked() )
- ::CalcContent( this );
- nRemaining += InnerHeight();
- bMaximize = HasFollow();
+ SwFrame* pOld = GetFollow();
+ GetFollow()->DelEmpty( false );
+ if( pOld == GetFollow() )
+ break;
}
+ bMaximize = ToMaximize( false );
+ nRemaining += aRectFnSet.GetHeight(pFrame->getFrameArea());
}
+ else
+ {
+ if( pFrame->IsColumnFrame() )
+ {
+ pFrame->Calc(pRenderContext);
+ pFrame = static_cast<SwColumnFrame*>(pFrame)->Lower();
+ pFrame->Calc(pRenderContext);
+ pFrame = static_cast<SwLayoutFrame*>(pFrame)->Lower();
+ CalcFootnoteContent();
+ }
+ // If we are in a columned frame which calls a CalcContent
+ // in the FormatWidthCols, the content might need calculating
+ if( pFrame && !pFrame->isFrameAreaDefinitionValid() && IsInFly() &&
+ FindFlyFrame()->IsColLocked() )
+ ::CalcContent( this );
+ nRemaining += InnerHeight();
+ bMaximize = HasFollow();
+ }
+ }
- SwTwips nDiff = aRectFnSet.GetHeight(getFrameArea()) - nRemaining;
- if( nDiff < 0)
+ SwTwips nDiff = aRectFnSet.GetHeight(getFrameArea()) - nRemaining;
+ if( nDiff < 0)
+ {
+ SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
{
- SwTwips nDeadLine = aRectFnSet.GetPrtBottom(*GetUpper());
+ long nBottom = aRectFnSet.GetBottom(getFrameArea());
+ nBottom = aRectFnSet.YInc( nBottom, -nDiff );
+ long nTmpDiff = aRectFnSet.YDiff( nBottom, nDeadLine );
+ if( nTmpDiff > 0 )
{
- long nBottom = aRectFnSet.GetBottom(getFrameArea());
- nBottom = aRectFnSet.YInc( nBottom, -nDiff );
- long nTmpDiff = aRectFnSet.YDiff( nBottom, nDeadLine );
+ nTmpDiff = GetUpper()->Grow( nTmpDiff, true );
+ nDeadLine = aRectFnSet.YInc( nDeadLine, nTmpDiff );
+ nTmpDiff = aRectFnSet.YDiff( nBottom, nDeadLine );
if( nTmpDiff > 0 )
- {
- nTmpDiff = GetUpper()->Grow( nTmpDiff, true );
- nDeadLine = aRectFnSet.YInc( nDeadLine, nTmpDiff );
- nTmpDiff = aRectFnSet.YDiff( nBottom, nDeadLine );
- if( nTmpDiff > 0 )
- nDiff += nTmpDiff;
- if( nDiff > 0 )
- nDiff = 0;
- }
+ nDiff += nTmpDiff;
+ if( nDiff > 0 )
+ nDiff = 0;
}
}
- if( nDiff )
+ }
+ if( nDiff )
+ {
+ long nTmp = nRemaining - aRectFnSet.GetHeight(getFrameArea());
+ long nTop = aRectFnSet.GetTopMargin(*this);
+
{
- long nTmp = nRemaining - aRectFnSet.GetHeight(getFrameArea());
- long nTop = aRectFnSet.GetTopMargin(*this);
+ SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
+ aRectFnSet.AddBottom( aFrm, nTmp );
+ }
+
+ aRectFnSet.SetYMargins( *this, nTop, 0 );
+ InvalidateNextPos();
+ if (m_pLower && (!m_pLower->IsColumnFrame() || !m_pLower->GetNext()))
+ {
+ // If a single-column section just created the space that
+ // was requested by the "undersized" paragraphs, then they
+ // have to be invalidated and calculated, so they fully cover it
+ pFrame = m_pLower;
+ if( pFrame->IsColumnFrame() )
{
- SwFrameAreaDefinition::FrameAreaWriteAccess aFrm(*this);
- aRectFnSet.AddBottom( aFrm, nTmp );
+ pFrame->InvalidateSize_();
+ pFrame->InvalidatePos_();
+ pFrame->Calc(pRenderContext);
+ pFrame = static_cast<SwColumnFrame*>(pFrame)->Lower();
+ pFrame->Calc(pRenderContext);
+ pFrame = static_cast<SwLayoutFrame*>(pFrame)->Lower();
+ CalcFootnoteContent();
}
-
- aRectFnSet.SetYMargins( *this, nTop, 0 );
- InvalidateNextPos();
-
- if (m_pLower && (!m_pLower->IsColumnFrame() || !m_pLower->GetNext()))
+ bool bUnderSz = false;
+ while( pFrame )
{
- // If a single-column section just created the space that
- // was requested by the "undersized" paragraphs, then they
- // have to be invalidated and calculated, so they fully cover it
- pFrame = m_pLower;
- if( pFrame->IsColumnFrame() )
+ if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
{
- pFrame->InvalidateSize_();
- pFrame->InvalidatePos_();
- pFrame->Calc(pRenderContext);
- pFrame = static_cast<SwColumnFrame*>(pFrame)->Lower();
- pFrame->Calc(pRenderContext);
- pFrame = static_cast<SwLayoutFrame*>(pFrame)->Lower();
- CalcFootnoteContent();
+ pFrame->Prepare( PREP_ADJUST_FRM );
+ bUnderSz = true;
}
- bool bUnderSz = false;
- while( pFrame )
- {
- if( pFrame->IsTextFrame() && static_cast<SwTextFrame*>(pFrame)->IsUndersized() )
- {
- pFrame->Prepare( PREP_ADJUST_FRM );
- bUnderSz = true;
- }
- pFrame = pFrame->GetNext();
- }
- if( bUnderSz && !IsContentLocked() )
- ::CalcContent( this );
+ pFrame = pFrame->GetNext();
}
+ if( bUnderSz && !IsContentLocked() )
+ ::CalcContent( this );
}
}
+ }
- // Do not exceed the lower edge of the Upper.
- // Do not extend below the lower edge with Sections with Follows
- if ( GetUpper() )
- CheckClipping( true, bMaximize );
- if( !bOldLock )
- ColUnlock();
- long nDiff = nOldHeight - aRectFnSet.GetHeight(getFrameArea());
+ // Do not exceed the lower edge of the Upper.
+ // Do not extend below the lower edge with Sections with Follows
+ if ( GetUpper() )
+ CheckClipping( true, bMaximize );
+ if( !bOldLock )
+ ColUnlock();
+ long nDiff = nOldHeight - aRectFnSet.GetHeight(getFrameArea());
- if( nDiff > 0 )
- {
- if( !GetNext() )
- SetRetouche(); // Take over the retouching ourselves
- if( GetUpper() && !GetUpper()->IsFooterFrame() )
- GetUpper()->Shrink( nDiff );
- }
+ if( nDiff > 0 )
+ {
+ if( !GetNext() )
+ SetRetouche(); // Take over the retouching ourselves
+ if( GetUpper() && !GetUpper()->IsFooterFrame() )
+ GetUpper()->Shrink( nDiff );
+ }
- if( IsUndersized() )
- {
- setFramePrintAreaValid(true);
- }
+ if( IsUndersized() )
+ {
+ setFramePrintAreaValid(true);
}
+
}
/// Returns the next layout sheet where the frame can be moved in.
diff --git a/sw/source/core/layout/virtoutp.cxx b/sw/source/core/layout/virtoutp.cxx
index 50273eed834a..523b340f99fd 100644
--- a/sw/source/core/layout/virtoutp.cxx
+++ b/sw/source/core/layout/virtoutp.cxx
@@ -129,50 +129,51 @@ void SwLayVout::Enter( SwViewShell *pShell, SwRect &rRect, bool bOn )
bOn = bOn && !nCount && rRect.HasArea() && pShell->GetWin();
++nCount;
- if( bOn )
+ if( !bOn )
+ return;
+
+ pSh = pShell;
+ pOut = nullptr;
+ OutputDevice *pO = pSh->GetOut();
+// We don't cheat on printers or virtual output devices...
+ if( OUTDEV_WINDOW != pO->GetOutDevType() )
+ return;
+
+ pOut = pO;
+ Size aPixSz( pOut->PixelToLogic( Size( 1,1 )) );
+ SwRect aTmp( rRect );
+ aTmp.SSize().Width() += aPixSz.Width()/2 + 1;
+ aTmp.SSize().Height()+= aPixSz.Height()/2 + 1;
+ tools::Rectangle aTmpRect( pO->LogicToPixel( aTmp.SVRect() ) );
+
+ OSL_ENSURE( !pSh->GetWin()->IsReallyVisible() ||
+ aTmpRect.GetWidth() <= pSh->GetWin()->GetOutputSizePixel().Width() + 2,
+ "Paintwidth bigger than visarea?" );
+ // Does the rectangle fit in our buffer?
+ if( !DoesFit( aTmpRect.GetSize() ) )
{
- pSh = pShell;
pOut = nullptr;
- OutputDevice *pO = pSh->GetOut();
-// We don't cheat on printers or virtual output devices...
- if( OUTDEV_WINDOW != pO->GetOutDevType() )
- return;
+ return;
+ }
- pOut = pO;
- Size aPixSz( pOut->PixelToLogic( Size( 1,1 )) );
- SwRect aTmp( rRect );
- aTmp.SSize().Width() += aPixSz.Width()/2 + 1;
- aTmp.SSize().Height()+= aPixSz.Height()/2 + 1;
- tools::Rectangle aTmpRect( pO->LogicToPixel( aTmp.SVRect() ) );
-
- OSL_ENSURE( !pSh->GetWin()->IsReallyVisible() ||
- aTmpRect.GetWidth() <= pSh->GetWin()->GetOutputSizePixel().Width() + 2,
- "Paintwidth bigger than visarea?" );
- // Does the rectangle fit in our buffer?
- if( !DoesFit( aTmpRect.GetSize() ) )
- {
- pOut = nullptr;
- return;
- }
+ aRect = SwRect( pO->PixelToLogic( aTmpRect ) );
- aRect = SwRect( pO->PixelToLogic( aTmpRect ) );
+ SetOutDev( pSh, pVirDev );
- SetOutDev( pSh, pVirDev );
+ if( pVirDev->GetFillColor() != pOut->GetFillColor() )
+ pVirDev->SetFillColor( pOut->GetFillColor() );
- if( pVirDev->GetFillColor() != pOut->GetFillColor() )
- pVirDev->SetFillColor( pOut->GetFillColor() );
+ MapMode aMapMode( pOut->GetMapMode() );
+ // OD 12.11.2002 #96272# - use method to set mapping
+ //aMapMode.SetOrigin( Point(0,0) - aRect.Pos() );
+ ::SetMappingForVirtDev( aRect.Pos(), pOut, pVirDev );
- MapMode aMapMode( pOut->GetMapMode() );
- // OD 12.11.2002 #96272# - use method to set mapping
- //aMapMode.SetOrigin( Point(0,0) - aRect.Pos() );
- ::SetMappingForVirtDev( aRect.Pos(), pOut, pVirDev );
+ if( aMapMode != pVirDev->GetMapMode() )
+ pVirDev->SetMapMode( aMapMode );
- if( aMapMode != pVirDev->GetMapMode() )
- pVirDev->SetMapMode( aMapMode );
+ /// OD 27.09.2002 #103636# - set value of parameter <rRect>
+ rRect = aRect;
- /// OD 27.09.2002 #103636# - set value of parameter <rRect>
- rRect = aRect;
- }
}
void SwLayVout::Flush_()
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index 08debf8408e2..01952039d9ee 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -2293,51 +2293,52 @@ void SwContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
else
UpdateAttr_( pOld, pNew, nInvFlags );
- if ( nInvFlags != 0 )
+ if ( nInvFlags == 0 )
+ return;
+
+ SwPageFrame *pPage = FindPageFrame();
+ InvalidatePage( pPage );
+ if ( nInvFlags & 0x01 )
+ SetCompletePaint();
+ if ( nInvFlags & 0x02 )
+ InvalidatePos_();
+ if ( nInvFlags & 0x04 )
+ InvalidateSize_();
+ if ( nInvFlags & 0x88 )
{
- SwPageFrame *pPage = FindPageFrame();
- InvalidatePage( pPage );
- if ( nInvFlags & 0x01 )
- SetCompletePaint();
- if ( nInvFlags & 0x02 )
- InvalidatePos_();
- if ( nInvFlags & 0x04 )
- InvalidateSize_();
- if ( nInvFlags & 0x88 )
+ if( IsInSct() && !GetPrev() )
{
- if( IsInSct() && !GetPrev() )
+ SwSectionFrame *pSect = FindSctFrame();
+ if( pSect->ContainsAny() == this )
{
- SwSectionFrame *pSect = FindSctFrame();
- if( pSect->ContainsAny() == this )
- {
- pSect->InvalidatePrt_();
- pSect->InvalidatePage( pPage );
- }
+ pSect->InvalidatePrt_();
+ pSect->InvalidatePage( pPage );
}
- InvalidatePrt_();
- }
- SwFrame* pNextFrame = GetIndNext();
- if ( pNextFrame && nInvFlags & 0x10)
- {
- pNextFrame->InvalidatePrt_();
- pNextFrame->InvalidatePage( pPage );
- }
- if ( pNextFrame && nInvFlags & 0x80 )
- {
- pNextFrame->SetCompletePaint();
}
- if ( nInvFlags & 0x20 )
+ InvalidatePrt_();
+ }
+ SwFrame* pNextFrame = GetIndNext();
+ if ( pNextFrame && nInvFlags & 0x10)
+ {
+ pNextFrame->InvalidatePrt_();
+ pNextFrame->InvalidatePage( pPage );
+ }
+ if ( pNextFrame && nInvFlags & 0x80 )
+ {
+ pNextFrame->SetCompletePaint();
+ }
+ if ( nInvFlags & 0x20 )
+ {
+ SwFrame* pPrevFrame = GetPrev();
+ if ( pPrevFrame )
{
- SwFrame* pPrevFrame = GetPrev();
- if ( pPrevFrame )
- {
- pPrevFrame->InvalidatePrt_();
- pPrevFrame->InvalidatePage( pPage );
- }
+ pPrevFrame->InvalidatePrt_();
+ pPrevFrame->InvalidatePage( pPage );
}
- if ( nInvFlags & 0x40 )
- InvalidateNextPos();
}
+ if ( nInvFlags & 0x40 )
+ InvalidateNextPos();
+
}
void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pNew,
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index c2ff19efd515..500485d26c95 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1957,212 +1957,214 @@ void ChgTextToNum( SwTableBox& rBox, const OUString& rText, const Color* pCol,
bool bChgAlign,sal_uLong nNdPos )
{
- if( ULONG_MAX != nNdPos )
- {
- SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
- SwTextNode* pTNd = pDoc->GetNodes()[ nNdPos ]->GetTextNode();
- const SfxPoolItem* pItem;
+ if( ULONG_MAX == nNdPos )
+ return;
+
+ SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
+ SwTextNode* pTNd = pDoc->GetNodes()[ nNdPos ]->GetTextNode();
+ const SfxPoolItem* pItem;
- // assign adjustment
- if( bChgAlign )
+ // assign adjustment
+ if( bChgAlign )
+ {
+ pItem = &pTNd->SwContentNode::GetAttr( RES_PARATR_ADJUST );
+ SvxAdjust eAdjust = static_cast<const SvxAdjustItem*>(pItem)->GetAdjust();
+ if( SvxAdjust::Left == eAdjust || SvxAdjust::Block == eAdjust )
{
- pItem = &pTNd->SwContentNode::GetAttr( RES_PARATR_ADJUST );
- SvxAdjust eAdjust = static_cast<const SvxAdjustItem*>(pItem)->GetAdjust();
- if( SvxAdjust::Left == eAdjust || SvxAdjust::Block == eAdjust )
- {
- SvxAdjustItem aAdjust( *static_cast<const SvxAdjustItem*>(pItem) );
- aAdjust.SetAdjust( SvxAdjust::Right );
- pTNd->SetAttr( aAdjust );
- }
+ SvxAdjustItem aAdjust( *static_cast<const SvxAdjustItem*>(pItem) );
+ aAdjust.SetAdjust( SvxAdjust::Right );
+ pTNd->SetAttr( aAdjust );
}
+ }
- // assign color or save "user color"
- if( !pTNd->GetpSwAttrSet() || SfxItemState::SET != pTNd->GetpSwAttrSet()->
- GetItemState( RES_CHRATR_COLOR, false, &pItem ))
- pItem = nullptr;
+ // assign color or save "user color"
+ if( !pTNd->GetpSwAttrSet() || SfxItemState::SET != pTNd->GetpSwAttrSet()->
+ GetItemState( RES_CHRATR_COLOR, false, &pItem ))
+ pItem = nullptr;
- const Color* pOldNumFormatColor = rBox.GetSaveNumFormatColor();
- const Color* pNewUserColor = pItem ? &static_cast<const SvxColorItem*>(pItem)->GetValue() : nullptr;
+ const Color* pOldNumFormatColor = rBox.GetSaveNumFormatColor();
+ const Color* pNewUserColor = pItem ? &static_cast<const SvxColorItem*>(pItem)->GetValue() : nullptr;
- if( ( pNewUserColor && pOldNumFormatColor &&
- *pNewUserColor == *pOldNumFormatColor ) ||
- ( !pNewUserColor && !pOldNumFormatColor ))
- {
- // Keep the user color, set updated values, delete old NumFormatColor if needed
- if( pCol )
- // if needed, set the color
- pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
- else if( pItem )
- {
- pNewUserColor = rBox.GetSaveUserColor();
- if( pNewUserColor )
- pTNd->SetAttr( SvxColorItem( *pNewUserColor, RES_CHRATR_COLOR ));
- else
- pTNd->ResetAttr( RES_CHRATR_COLOR );
- }
- }
- else
+ if( ( pNewUserColor && pOldNumFormatColor &&
+ *pNewUserColor == *pOldNumFormatColor ) ||
+ ( !pNewUserColor && !pOldNumFormatColor ))
+ {
+ // Keep the user color, set updated values, delete old NumFormatColor if needed
+ if( pCol )
+ // if needed, set the color
+ pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
+ else if( pItem )
{
- // Save user color, set NumFormat color if needed, but never reset the color
- rBox.SetSaveUserColor( pNewUserColor );
-
- if( pCol )
- // if needed, set the color
- pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
-
+ pNewUserColor = rBox.GetSaveUserColor();
+ if( pNewUserColor )
+ pTNd->SetAttr( SvxColorItem( *pNewUserColor, RES_CHRATR_COLOR ));
+ else
+ pTNd->ResetAttr( RES_CHRATR_COLOR );
}
- rBox.SetSaveNumFormatColor( pCol );
+ }
+ else
+ {
+ // Save user color, set NumFormat color if needed, but never reset the color
+ rBox.SetSaveUserColor( pNewUserColor );
- if( pTNd->GetText() != rText )
- {
- // Exchange text. Bugfix to keep Tabs (front and back!) and annotations (inword comment anchors)
- const OUString& rOrig = pTNd->GetText();
- sal_Int32 n;
+ if( pCol )
+ // if needed, set the color
+ pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
- for( n = 0; n < rOrig.getLength() && ('\x9' == rOrig[n] || CH_TXTATR_INWORD == rOrig[n]); ++n )
- ;
- for( ; n < rOrig.getLength() && '\x01' == rOrig[n]; ++n )
- ;
- SwIndex aIdx( pTNd, n );
- for( n = rOrig.getLength(); n && ('\x9' == rOrig[--n] || CH_TXTATR_INWORD == rOrig[n]); )
- ;
- sal_Int32 nEndPos = n;
- n -= aIdx.GetIndex() - 1;
+ }
+ rBox.SetSaveNumFormatColor( pCol );
- // Reset DontExpand-Flags before exchange, to retrigger expansion
- {
- SwIndex aResetIdx( aIdx, n );
- pTNd->DontExpandFormat( aResetIdx, false, false );
- }
+ if( pTNd->GetText() != rText )
+ {
+ // Exchange text. Bugfix to keep Tabs (front and back!) and annotations (inword comment anchors)
+ const OUString& rOrig = pTNd->GetText();
+ sal_Int32 n;
- if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
- {
- SwPaM aTemp(*pTNd, 0, *pTNd, rOrig.getLength());
- pDoc->getIDocumentRedlineAccess().DeleteRedline(aTemp, true, USHRT_MAX);
- }
+ for( n = 0; n < rOrig.getLength() && ('\x9' == rOrig[n] || CH_TXTATR_INWORD == rOrig[n]); ++n )
+ ;
+ for( ; n < rOrig.getLength() && '\x01' == rOrig[n]; ++n )
+ ;
+ SwIndex aIdx( pTNd, n );
+ for( n = rOrig.getLength(); n && ('\x9' == rOrig[--n] || CH_TXTATR_INWORD == rOrig[n]); )
+ ;
+ sal_Int32 nEndPos = n;
+ n -= aIdx.GetIndex() - 1;
- // preserve comments inside of the number by deleting number portions starting from the back
- sal_Int32 nCommentPos = pTNd->GetText().lastIndexOf( CH_TXTATR_INWORD, nEndPos );
- while( nCommentPos > aIdx.GetIndex() )
- {
- pTNd->EraseText( SwIndex(pTNd, nCommentPos+1), nEndPos - nCommentPos, SwInsertFlags::EMPTYEXPAND );
- // find the next non-sequential comment anchor
- do
- {
- nEndPos = nCommentPos;
- n = nEndPos - aIdx.GetIndex();
- nCommentPos = pTNd->GetText().lastIndexOf( CH_TXTATR_INWORD, nEndPos );
- --nEndPos;
- }
- while( nCommentPos > aIdx.GetIndex() && nCommentPos == nEndPos );
- }
+ // Reset DontExpand-Flags before exchange, to retrigger expansion
+ {
+ SwIndex aResetIdx( aIdx, n );
+ pTNd->DontExpandFormat( aResetIdx, false, false );
+ }
- pTNd->EraseText( aIdx, n, SwInsertFlags::EMPTYEXPAND );
- pTNd->InsertText( rText, aIdx, SwInsertFlags::EMPTYEXPAND );
+ if( !pDoc->getIDocumentRedlineAccess().IsIgnoreRedline() && !pDoc->getIDocumentRedlineAccess().GetRedlineTable().empty() )
+ {
+ SwPaM aTemp(*pTNd, 0, *pTNd, rOrig.getLength());
+ pDoc->getIDocumentRedlineAccess().DeleteRedline(aTemp, true, USHRT_MAX);
+ }
- if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
+ // preserve comments inside of the number by deleting number portions starting from the back
+ sal_Int32 nCommentPos = pTNd->GetText().lastIndexOf( CH_TXTATR_INWORD, nEndPos );
+ while( nCommentPos > aIdx.GetIndex() )
+ {
+ pTNd->EraseText( SwIndex(pTNd, nCommentPos+1), nEndPos - nCommentPos, SwInsertFlags::EMPTYEXPAND );
+ // find the next non-sequential comment anchor
+ do
{
- SwPaM aTemp(*pTNd, 0, *pTNd, rText.getLength());
- pDoc->getIDocumentRedlineAccess().AppendRedline(new SwRangeRedline(nsRedlineType_t::REDLINE_INSERT, aTemp), true);
+ nEndPos = nCommentPos;
+ n = nEndPos - aIdx.GetIndex();
+ nCommentPos = pTNd->GetText().lastIndexOf( CH_TXTATR_INWORD, nEndPos );
+ --nEndPos;
}
+ while( nCommentPos > aIdx.GetIndex() && nCommentPos == nEndPos );
}
- // assign vertical orientation
- if( bChgAlign &&
- ( SfxItemState::SET != rBox.GetFrameFormat()->GetItemState(
- RES_VERT_ORIENT, true, &pItem ) ||
- text::VertOrientation::TOP == static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient() ))
+ pTNd->EraseText( aIdx, n, SwInsertFlags::EMPTYEXPAND );
+ pTNd->InsertText( rText, aIdx, SwInsertFlags::EMPTYEXPAND );
+
+ if( pDoc->getIDocumentRedlineAccess().IsRedlineOn() )
{
- rBox.GetFrameFormat()->SetFormatAttr( SwFormatVertOrient( 0, text::VertOrientation::BOTTOM ));
+ SwPaM aTemp(*pTNd, 0, *pTNd, rText.getLength());
+ pDoc->getIDocumentRedlineAccess().AppendRedline(new SwRangeRedline(nsRedlineType_t::REDLINE_INSERT, aTemp), true);
}
}
+
+ // assign vertical orientation
+ if( bChgAlign &&
+ ( SfxItemState::SET != rBox.GetFrameFormat()->GetItemState(
+ RES_VERT_ORIENT, true, &pItem ) ||
+ text::VertOrientation::TOP == static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient() ))
+ {
+ rBox.GetFrameFormat()->SetFormatAttr( SwFormatVertOrient( 0, text::VertOrientation::BOTTOM ));
+ }
+
}
void ChgNumToText( SwTableBox& rBox, sal_uLong nFormat )
{
sal_uLong nNdPos = rBox.IsValidNumTextNd( false );
- if( ULONG_MAX != nNdPos )
- {
- SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
- SwTextNode* pTNd = pDoc->GetNodes()[ nNdPos ]->GetTextNode();
- bool bChgAlign = pDoc->IsInsTableAlignNum();
- const SfxPoolItem* pItem;
+ if( ULONG_MAX == nNdPos )
+ return;
+
+ SwDoc* pDoc = rBox.GetFrameFormat()->GetDoc();
+ SwTextNode* pTNd = pDoc->GetNodes()[ nNdPos ]->GetTextNode();
+ bool bChgAlign = pDoc->IsInsTableAlignNum();
+ const SfxPoolItem* pItem;
- Color* pCol = nullptr;
- if( css::util::NumberFormat::TEXT != static_cast<sal_Int16>(nFormat) )
+ Color* pCol = nullptr;
+ if( css::util::NumberFormat::TEXT != static_cast<sal_Int16>(nFormat) )
+ {
+ // special text format:
+ OUString sTmp;
+ const OUString sText( pTNd->GetText() );
+ pDoc->GetNumberFormatter()->GetOutputString( sText, nFormat, sTmp, &pCol );
+ if( sText != sTmp )
{
- // special text format:
- OUString sTmp;
- const OUString sText( pTNd->GetText() );
- pDoc->GetNumberFormatter()->GetOutputString( sText, nFormat, sTmp, &pCol );
- if( sText != sTmp )
- {
- // exchange text
- SwIndex aIdx( pTNd, sText.getLength() );
- // Reset DontExpand-Flags before exchange, to retrigger expansion
- pTNd->DontExpandFormat( aIdx, false, false );
- aIdx = 0;
- pTNd->EraseText( aIdx, SAL_MAX_INT32, SwInsertFlags::EMPTYEXPAND );
- pTNd->InsertText( sTmp, aIdx, SwInsertFlags::EMPTYEXPAND );
- }
+ // exchange text
+ SwIndex aIdx( pTNd, sText.getLength() );
+ // Reset DontExpand-Flags before exchange, to retrigger expansion
+ pTNd->DontExpandFormat( aIdx, false, false );
+ aIdx = 0;
+ pTNd->EraseText( aIdx, SAL_MAX_INT32, SwInsertFlags::EMPTYEXPAND );
+ pTNd->InsertText( sTmp, aIdx, SwInsertFlags::EMPTYEXPAND );
}
+ }
- const SfxItemSet* pAttrSet = pTNd->GetpSwAttrSet();
+ const SfxItemSet* pAttrSet = pTNd->GetpSwAttrSet();
- // assign adjustment
- if( bChgAlign && pAttrSet && SfxItemState::SET == pAttrSet->GetItemState(
- RES_PARATR_ADJUST, false, &pItem ) &&
- SvxAdjust::Right == static_cast<const SvxAdjustItem*>(pItem)->GetAdjust() )
- {
- pTNd->SetAttr( SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ) );
- }
+ // assign adjustment
+ if( bChgAlign && pAttrSet && SfxItemState::SET == pAttrSet->GetItemState(
+ RES_PARATR_ADJUST, false, &pItem ) &&
+ SvxAdjust::Right == static_cast<const SvxAdjustItem*>(pItem)->GetAdjust() )
+ {
+ pTNd->SetAttr( SvxAdjustItem( SvxAdjust::Left, RES_PARATR_ADJUST ) );
+ }
- // assign color or save "user color"
- if( !pAttrSet || SfxItemState::SET != pAttrSet->
- GetItemState( RES_CHRATR_COLOR, false, &pItem ))
- pItem = nullptr;
+ // assign color or save "user color"
+ if( !pAttrSet || SfxItemState::SET != pAttrSet->
+ GetItemState( RES_CHRATR_COLOR, false, &pItem ))
+ pItem = nullptr;
- const Color* pOldNumFormatColor = rBox.GetSaveNumFormatColor();
- const Color* pNewUserColor = pItem ? &static_cast<const SvxColorItem*>(pItem)->GetValue() : nullptr;
+ const Color* pOldNumFormatColor = rBox.GetSaveNumFormatColor();
+ const Color* pNewUserColor = pItem ? &static_cast<const SvxColorItem*>(pItem)->GetValue() : nullptr;
- if( ( pNewUserColor && pOldNumFormatColor &&
- *pNewUserColor == *pOldNumFormatColor ) ||
- ( !pNewUserColor && !pOldNumFormatColor ))
+ if( ( pNewUserColor && pOldNumFormatColor &&
+ *pNewUserColor == *pOldNumFormatColor ) ||
+ ( !pNewUserColor && !pOldNumFormatColor ))
+ {
+ // Keep the user color, set updated values, delete old NumFormatColor if needed
+ if( pCol )
+ // if needed, set the color
+ pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
+ else if( pItem )
{
- // Keep the user color, set updated values, delete old NumFormatColor if needed
- if( pCol )
- // if needed, set the color
- pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
- else if( pItem )
- {
- pNewUserColor = rBox.GetSaveUserColor();
- if( pNewUserColor )
- pTNd->SetAttr( SvxColorItem( *pNewUserColor, RES_CHRATR_COLOR ));
- else
- pTNd->ResetAttr( RES_CHRATR_COLOR );
- }
+ pNewUserColor = rBox.GetSaveUserColor();
+ if( pNewUserColor )
+ pTNd->SetAttr( SvxColorItem( *pNewUserColor, RES_CHRATR_COLOR ));
+ else
+ pTNd->ResetAttr( RES_CHRATR_COLOR );
}
- else
- {
- // Save user color, set NumFormat color if needed, but never reset the color
- rBox.SetSaveUserColor( pNewUserColor );
+ }
+ else
+ {
+ // Save user color, set NumFormat color if needed, but never reset the color
+ rBox.SetSaveUserColor( pNewUserColor );
- if( pCol )
- // if needed, set the color
- pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
+ if( pCol )
+ // if needed, set the color
+ pTNd->SetAttr( SvxColorItem( *pCol, RES_CHRATR_COLOR ));
- }
- rBox.SetSaveNumFormatColor( pCol );
+ }
+ rBox.SetSaveNumFormatColor( pCol );
- // assign vertical orientation
- if( bChgAlign &&
- SfxItemState::SET == rBox.GetFrameFormat()->GetItemState(
- RES_VERT_ORIENT, false, &pItem ) &&
- text::VertOrientation::BOTTOM == static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient() )
- {
- rBox.GetFrameFormat()->SetFormatAttr( SwFormatVertOrient( 0, text::VertOrientation::TOP ));
- }
+ // assign vertical orientation
+ if( bChgAlign &&
+ SfxItemState::SET == rBox.GetFrameFormat()->GetItemState(
+ RES_VERT_ORIENT, false, &pItem ) &&
+ text::VertOrientation::BOTTOM == static_cast<const SwFormatVertOrient*>(pItem)->GetVertOrient() )
+ {
+ rBox.GetFrameFormat()->SetFormatAttr( SwFormatVertOrient( 0, text::VertOrientation::TOP ));
}
+
}
// for detection of modifications (mainly TableBoxAttribute)
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 9b61f67b157b..ad35d18daf01 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -296,111 +296,112 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const
if( eHor != text::HoriOrientation::NONE && !IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) )
eHor = text::HoriOrientation::NONE;
bool bRedLine = eHor != text::HoriOrientation::NONE;
- if ( bLineNum || bRedLine )
- {
- if( IsLocked() || IsHiddenNow() || !getFramePrintArea().Height() )
- return;
- SwViewShell *pSh = getRootFrame()->GetCurrShell();
+ if ( !bLineNum && !bRedLine )
+ return;
- SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
- SwRect rOldRect( rRect );
+ if( IsLocked() || IsHiddenNow() || !getFramePrintArea().Height() )
+ return;
+ SwViewShell *pSh = getRootFrame()->GetCurrShell();
- if ( IsVertical() )
- SwitchVerticalToHorizontal( const_cast<SwRect&>(rRect) );
+ SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
+ SwRect rOldRect( rRect );
- SwLayoutModeModifier aLayoutModeModifier( *pSh->GetOut() );
- aLayoutModeModifier.Modify( false );
+ if ( IsVertical() )
+ SwitchVerticalToHorizontal( const_cast<SwRect&>(rRect) );
- // #i16816# tagged pdf support
- SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pSh->GetOut() );
+ SwLayoutModeModifier aLayoutModeModifier( *pSh->GetOut() );
+ aLayoutModeModifier.Modify( false );
- SwExtraPainter aExtra( this, pSh, rLineInf, rRect, eHor, bLineNum );
+ // #i16816# tagged pdf support
+ SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *pSh->GetOut() );
- if( HasPara() )
- {
- TextFrameLockGuard aLock(const_cast<SwTextFrame*>(this));
+ SwExtraPainter aExtra( this, pSh, rLineInf, rRect, eHor, bLineNum );
- SwTextLineAccess aAccess( this );
- aAccess.GetPara();
+ if( HasPara() )
+ {
+ TextFrameLockGuard aLock(const_cast<SwTextFrame*>(this));
+
+ SwTextLineAccess aAccess( this );
+ aAccess.GetPara();
- SwTextPaintInfo aInf( const_cast<SwTextFrame*>(this), rRect );
+ SwTextPaintInfo aInf( const_cast<SwTextFrame*>(this), rRect );
- aLayoutModeModifier.Modify( false );
+ aLayoutModeModifier.Modify( false );
- SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
- bool bNoDummy = !aLine.GetNext(); // Only one empty line!
+ SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
+ bool bNoDummy = !aLine.GetNext(); // Only one empty line!
- while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
+ while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
+ {
+ if( !aLine.GetCurr()->IsDummy() &&
+ ( rLineInf.IsCountBlankLines() ||
+ aLine.GetCurr()->HasContent() ) )
+ aExtra.IncLineNr();
+ if( !aLine.Next() )
{
- if( !aLine.GetCurr()->IsDummy() &&
- ( rLineInf.IsCountBlankLines() ||
- aLine.GetCurr()->HasContent() ) )
- aExtra.IncLineNr();
- if( !aLine.Next() )
- {
- const_cast<SwRect&>(rRect) = rOldRect;
- return;
- }
+ const_cast<SwRect&>(rRect) = rOldRect;
+ return;
}
+ }
- long nBottom = rRect.Bottom();
+ long nBottom = rRect.Bottom();
- bool bNoPrtLine = 0 == GetMinPrtLine();
- if( !bNoPrtLine )
+ bool bNoPrtLine = 0 == GetMinPrtLine();
+ if( !bNoPrtLine )
+ {
+ while ( aLine.Y() < GetMinPrtLine() )
{
- while ( aLine.Y() < GetMinPrtLine() )
- {
- if( ( rLineInf.IsCountBlankLines() || aLine.GetCurr()->HasContent() )
- && !aLine.GetCurr()->IsDummy() )
- aExtra.IncLineNr();
- if( !aLine.Next() )
- break;
- }
- bNoPrtLine = aLine.Y() >= GetMinPrtLine();
+ if( ( rLineInf.IsCountBlankLines() || aLine.GetCurr()->HasContent() )
+ && !aLine.GetCurr()->IsDummy() )
+ aExtra.IncLineNr();
+ if( !aLine.Next() )
+ break;
}
- if( bNoPrtLine )
+ bNoPrtLine = aLine.Y() >= GetMinPrtLine();
+ }
+ if( bNoPrtLine )
+ {
+ do
{
- do
+ if( bNoDummy || !aLine.GetCurr()->IsDummy() )
{
- if( bNoDummy || !aLine.GetCurr()->IsDummy() )
+ bool bRed = bRedLine && aLine.GetCurr()->HasRedline();
+ if( rLineInf.IsCountBlankLines() || aLine.GetCurr()->HasContent() )
{
- bool bRed = bRedLine && aLine.GetCurr()->HasRedline();
- if( rLineInf.IsCountBlankLines() || aLine.GetCurr()->HasContent() )
+ if( bLineNum &&
+ ( aExtra.HasNumber() || aExtra.HasDivider() ) )
{
- if( bLineNum &&
- ( aExtra.HasNumber() || aExtra.HasDivider() ) )
- {
- sal_uInt16 nTmpHeight, nTmpAscent;
- aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
- aExtra.PaintExtra( aLine.Y(), nTmpAscent,
- nTmpHeight, bRed );
- bRed = false;
- }
- aExtra.IncLineNr();
+ sal_uInt16 nTmpHeight, nTmpAscent;
+ aLine.CalcAscentAndHeight( nTmpAscent, nTmpHeight );
+ aExtra.PaintExtra( aLine.Y(), nTmpAscent,
+ nTmpHeight, bRed );
+ bRed = false;
}
- if( bRed )
- aExtra.PaintRedline( aLine.Y(), aLine.GetLineHeight() );
+ aExtra.IncLineNr();
}
- } while( aLine.Next() && aLine.Y() <= nBottom );
- }
+ if( bRed )
+ aExtra.PaintRedline( aLine.Y(), aLine.GetLineHeight() );
+ }
+ } while( aLine.Next() && aLine.Y() <= nBottom );
}
- else
- {
- if ( SwRedlineTable::npos == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) )
- bRedLine = false;
+ }
+ else
+ {
+ if ( SwRedlineTable::npos == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) )
+ bRedLine = false;
- if( bLineNum && rLineInf.IsCountBlankLines() &&
- ( aExtra.HasNumber() || aExtra.HasDivider() ) )
- {
- aExtra.PaintExtra( getFrameArea().Top()+getFramePrintArea().Top(), aExtra.GetFont()
- ->GetAscent( pSh, *pSh->GetOut() ), getFramePrintArea().Height(), bRedLine );
- }
- else if( bRedLine )
- aExtra.PaintRedline( getFrameArea().Top()+getFramePrintArea().Top(), getFramePrintArea().Height() );
+ if( bLineNum && rLineInf.IsCountBlankLines() &&
+ ( aExtra.HasNumber() || aExtra.HasDivider() ) )
+ {
+ aExtra.PaintExtra( getFrameArea().Top()+getFramePrintArea().Top(), aExtra.GetFont()
+ ->GetAscent( pSh, *pSh->GetOut() ), getFramePrintArea().Height(), bRedLine );
}
-
- const_cast<SwRect&>(rRect) = rOldRect;
+ else if( bRedLine )
+ aExtra.PaintRedline( getFrameArea().Top()+getFramePrintArea().Top(), getFramePrintArea().Height() );
}
+
+ const_cast<SwRect&>(rRect) = rOldRect;
+
}
SwRect SwTextFrame::Paint()
@@ -581,120 +582,121 @@ void SwTextFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect,
Frame_Info aFrameInfo( *this );
SwTaggedPDFHelper aTaggedPDFHelperParagraph( nullptr, &aFrameInfo, nullptr, rRenderContext );
- if( !IsEmpty() || !PaintEmpty( rRect, true ) )
+ if( IsEmpty() && PaintEmpty( rRect, true ) )
+ return;
+
+ if( IsLocked() || IsHiddenNow() || ! getFramePrintArea().HasArea() )
+ return;
+
+ // It can happen that the IdleCollector withdrew my cached information
+ if( !HasPara() )
{
- if( IsLocked() || IsHiddenNow() || ! getFramePrintArea().HasArea() )
- return;
+ OSL_ENSURE( isFrameAreaPositionValid(), "+SwTextFrame::Paint: no Calc()" );
- // It can happen that the IdleCollector withdrew my cached information
+ // #i29062# pass info that we are currently
+ // painting.
+ const_cast<SwTextFrame*>(this)->GetFormatted( true );
+ if( IsEmpty() )
+ {
+ PaintEmpty( rRect, false );
+ return;
+ }
if( !HasPara() )
{
- OSL_ENSURE( isFrameAreaPositionValid(), "+SwTextFrame::Paint: no Calc()" );
-
- // #i29062# pass info that we are currently
- // painting.
- const_cast<SwTextFrame*>(this)->GetFormatted( true );
- if( IsEmpty() )
- {
- PaintEmpty( rRect, false );
- return;
- }
- if( !HasPara() )
- {
- OSL_ENSURE( false, "+SwTextFrame::Paint: missing format information" );
- return;
- }
+ OSL_ENSURE( false, "+SwTextFrame::Paint: missing format information" );
+ return;
}
+ }
- // We don't want to be interrupted while painting.
- // Do that after thr Format()!
- TextFrameLockGuard aLock(const_cast<SwTextFrame*>(this));
+ // We don't want to be interrupted while painting.
+ // Do that after thr Format()!
+ TextFrameLockGuard aLock(const_cast<SwTextFrame*>(this));
- // We only paint the part of the TextFrame which changed, is within the
- // range and was requested to paint.
- // One could think that the area rRect _needs_ to be painted, although
- // rRepaint is set. Indeed, we cannot avoid this problem from a formal
- // perspective. Luckily we can assume rRepaint to be empty when we need
- // paint the while Frame.
- SwTextLineAccess aAccess( this );
- SwParaPortion *pPara = aAccess.GetPara();
+ // We only paint the part of the TextFrame which changed, is within the
+ // range and was requested to paint.
+ // One could think that the area rRect _needs_ to be painted, although
+ // rRepaint is set. Indeed, we cannot avoid this problem from a formal
+ // perspective. Luckily we can assume rRepaint to be empty when we need
+ // paint the while Frame.
+ SwTextLineAccess aAccess( this );
+ SwParaPortion *pPara = aAccess.GetPara();
- SwRepaint &rRepaint = pPara->GetRepaint();
+ SwRepaint &rRepaint = pPara->GetRepaint();
- // Switch off recycling when in the FlyContentFrame.
- // A DrawRect is called for repainting the line anyways.
- if( rRepaint.GetOfst() )
- {
- const SwFlyFrame *pFly = FindFlyFrame();
- if( pFly && pFly->IsFlyInContentFrame() )
- rRepaint.SetOfst( 0 );
- }
+ // Switch off recycling when in the FlyContentFrame.
+ // A DrawRect is called for repainting the line anyways.
+ if( rRepaint.GetOfst() )
+ {
+ const SwFlyFrame *pFly = FindFlyFrame();
+ if( pFly && pFly->IsFlyInContentFrame() )
+ rRepaint.SetOfst( 0 );
+ }
- // Ge the String for painting. The length is of special interest.
+ // Ge the String for painting. The length is of special interest.
- // Rectangle
- OSL_ENSURE( ! IsSwapped(), "A frame is swapped before Paint" );
- SwRect aOldRect( rRect );
+ // Rectangle
+ OSL_ENSURE( ! IsSwapped(), "A frame is swapped before Paint" );
+ SwRect aOldRect( rRect );
- {
- SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
+ {
+ SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this));
- if ( IsVertical() )
- SwitchVerticalToHorizontal( const_cast<SwRect&>(rRect) );
+ if ( IsVertical() )
+ SwitchVerticalToHorizontal( const_cast<SwRect&>(rRect) );
- if ( IsRightToLeft() )
- SwitchRTLtoLTR( const_cast<SwRect&>(rRect) );
+ if ( IsRightToLeft() )
+ SwitchRTLtoLTR( const_cast<SwRect&>(rRect) );
- SwTextPaintInfo aInf( const_cast<SwTextFrame*>(this), rRect );
- aInf.SetWrongList( const_cast<SwTextNode*>(GetTextNode())->GetWrong() );
- aInf.SetGrammarCheckList( const_cast<SwTextNode*>(GetTextNode())->GetGrammarCheck() );
- aInf.SetSmartTags( const_cast<SwTextNode*>(GetTextNode())->GetSmartTags() );
- aInf.GetTextFly().SetTopRule();
+ SwTextPaintInfo aInf( const_cast<SwTextFrame*>(this), rRect );
+ aInf.SetWrongList( const_cast<SwTextNode*>(GetTextNode())->GetWrong() );
+ aInf.SetGrammarCheckList( const_cast<SwTextNode*>(GetTextNode())->GetGrammarCheck() );
+ aInf.SetSmartTags( const_cast<SwTextNode*>(GetTextNode())->GetSmartTags() );
+ aInf.GetTextFly().SetTopRule();
- SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
- // Optimization: if no free flying Frame overlaps into our line, the
- // SwTextFly just switches off
- aInf.GetTextFly().Relax();
+ SwTextPainter aLine( const_cast<SwTextFrame*>(this), &aInf );
+ // Optimization: if no free flying Frame overlaps into our line, the
+ // SwTextFly just switches off
+ aInf.GetTextFly().Relax();
- OutputDevice* pOut = aInf.GetOut();
- const bool bOnWin = pSh->GetWin() != nullptr;
+ OutputDevice* pOut = aInf.GetOut();
+ const bool bOnWin = pSh->GetWin() != nullptr;
- SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : nullptr );
+ SwSaveClip aClip( bOnWin || IsUndersized() ? pOut : nullptr );
- // Output loop: For each Line ... (which is still visible) ...
- // adapt rRect (Top + 1, Bottom - 1)
- // Because the Iterator attaches the Lines without a gap to each other
- aLine.TwipsToLine( rRect.Top() + 1 );
- long nBottom = rRect.Bottom();
+ // Output loop: For each Line ... (which is still visible) ...
+ // adapt rRect (Top + 1, Bottom - 1)
+ // Because the Iterator attaches the Lines without a gap to each other
+ aLine.TwipsToLine( rRect.Top() + 1 );
+ long nBottom = rRect.Bottom();
- bool bNoPrtLine = 0 == GetMinPrtLine();
- if( !bNoPrtLine )
- {
- while ( aLine.Y() < GetMinPrtLine() && aLine.Next() )
- ;
- bNoPrtLine = aLine.Y() >= GetMinPrtLine();
- }
- if( bNoPrtLine )
+ bool bNoPrtLine = 0 == GetMinPrtLine();
+ if( !bNoPrtLine )
+ {
+ while ( aLine.Y() < GetMinPrtLine() && aLine.Next() )
+ ;
+ bNoPrtLine = aLine.Y() >= GetMinPrtLine();
+ }
+ if( bNoPrtLine )
+ {
+ do
{
- do
- {
- aLine.DrawTextLine( rRect, aClip, IsUndersized() );
-
- } while( aLine.Next() && aLine.Y() <= nBottom );
- }
-
- // Once is enough:
- if( aLine.IsPaintDrop() )
- aLine.PaintDropPortion();
+ aLine.DrawTextLine( rRect, aClip, IsUndersized() );
- if( rRepaint.HasArea() )
- rRepaint.Clear();
+ } while( aLine.Next() && aLine.Y() <= nBottom );
}
- const_cast<SwRect&>(rRect) = aOldRect;
+ // Once is enough:
+ if( aLine.IsPaintDrop() )
+ aLine.PaintDropPortion();
- OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Paint" );
+ if( rRepaint.HasArea() )
+ rRepaint.Clear();
}
+
+ const_cast<SwRect&>(rRect) = aOldRect;
+
+ OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Paint" );
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 105c3871c4ce..de131470c958 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1003,49 +1003,50 @@ void SwTextPaintInfo::DrawRedArrow( const SwLinePortion &rPor ) const
void SwTextPaintInfo::DrawPostIts( bool bScript ) const
{
- if( OnWin() && m_pOpt->IsPostIts() )
- {
- Size aSize;
- Point aTmp;
+ if( !OnWin() || !m_pOpt->IsPostIts() )
+ return;
- const sal_uInt16 nPostItsWidth = SwViewOption::GetPostItsWidth( GetOut() );
- const sal_uInt16 nFontHeight = m_pFnt->GetHeight( m_pVsh, *GetOut() );
- const sal_uInt16 nFontAscent = m_pFnt->GetAscent( m_pVsh, *GetOut() );
+ Size aSize;
+ Point aTmp;
- switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ) )
- {
- case 0 :
- aSize.Width() = nPostItsWidth;
- aSize.Height() = nFontHeight;
- aTmp.X() = aPos.X();
- aTmp.Y() = aPos.Y() - nFontAscent;
- break;
- case 900 :
- aSize.Height() = nPostItsWidth;
- aSize.Width() = nFontHeight;
- aTmp.X() = aPos.X() - nFontAscent;
- aTmp.Y() = aPos.Y();
- break;
- case 2700 :
- aSize.Height() = nPostItsWidth;
- aSize.Width() = nFontHeight;
- aTmp.X() = aPos.X() - nFontHeight +
- nFontAscent;
- aTmp.Y() = aPos.Y();
- break;
- }
+ const sal_uInt16 nPostItsWidth = SwViewOption::GetPostItsWidth( GetOut() );
+ const sal_uInt16 nFontHeight = m_pFnt->GetHeight( m_pVsh, *GetOut() );
+ const sal_uInt16 nFontAscent = m_pFnt->GetAscent( m_pVsh, *GetOut() );
- SwRect aTmpRect( aTmp, aSize );
+ switch ( m_pFnt->GetOrientation( GetTextFrame()->IsVertical() ) )
+ {
+ case 0 :
+ aSize.Width() = nPostItsWidth;
+ aSize.Height() = nFontHeight;
+ aTmp.X() = aPos.X();
+ aTmp.Y() = aPos.Y() - nFontAscent;
+ break;
+ case 900 :
+ aSize.Height() = nPostItsWidth;
+ aSize.Width() = nFontHeight;
+ aTmp.X() = aPos.X() - nFontAscent;
+ aTmp.Y() = aPos.Y();
+ break;
+ case 2700 :
+ aSize.Height() = nPostItsWidth;
+ aSize.Width() = nFontHeight;
+ aTmp.X() = aPos.X() - nFontHeight +
+ nFontAscent;
+ aTmp.Y() = aPos.Y();
+ break;
+ }
- if ( GetTextFrame()->IsRightToLeft() )
- GetTextFrame()->SwitchLTRtoRTL( aTmpRect );
+ SwRect aTmpRect( aTmp, aSize );
- if ( GetTextFrame()->IsVertical() )
- GetTextFrame()->SwitchHorizontalToVertical( aTmpRect );
+ if ( GetTextFrame()->IsRightToLeft() )
+ GetTextFrame()->SwitchLTRtoRTL( aTmpRect );
+
+ if ( GetTextFrame()->IsVertical() )
+ GetTextFrame()->SwitchHorizontalToVertical( aTmpRect );
+
+ const tools::Rectangle aRect( aTmpRect.SVRect() );
+ SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aRect, bScript );
- const tools::Rectangle aRect( aTmpRect.SVRect() );
- SwViewOption::PaintPostIts( const_cast<OutputDevice*>(GetOut()), aRect, bScript );
- }
}
void SwTextPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index e9c18c644867..32736e5cba1b 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -2315,151 +2315,153 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
if ( m_pFrame->IsVertical() )
m_pFrame->SwitchVerticalToHorizontal( aInter );
- if( aInter.IsOver( aLine ) )
+ if( !aInter.IsOver( aLine ) )
+ return;
+
+ aLine.Left( rInf.X() + nLeftMar );
+ bool bForced = false;
+ if( aInter.Left() <= nLeftMin )
{
- aLine.Left( rInf.X() + nLeftMar );
- bool bForced = false;
- if( aInter.Left() <= nLeftMin )
+ SwTwips nFrameLeft = GetTextFrame()->getFrameArea().Left();
+ if( GetTextFrame()->getFramePrintArea().Left() < 0 )
+ nFrameLeft += GetTextFrame()->getFramePrintArea().Left();
+ if( aInter.Left() < nFrameLeft )
+ aInter.Left( nFrameLeft );
+
+ long nAddMar = 0;
+ if ( m_pFrame->IsRightToLeft() )
{
- SwTwips nFrameLeft = GetTextFrame()->getFrameArea().Left();
- if( GetTextFrame()->getFramePrintArea().Left() < 0 )
- nFrameLeft += GetTextFrame()->getFramePrintArea().Left();
- if( aInter.Left() < nFrameLeft )
- aInter.Left( nFrameLeft );
+ nAddMar = m_pFrame->getFrameArea().Right() - Right();
+ if ( nAddMar < 0 )
+ nAddMar = 0;
+ }
+ else
+ nAddMar = nLeftMar - nFrameLeft;
- long nAddMar = 0;
- if ( m_pFrame->IsRightToLeft() )
- {
- nAddMar = m_pFrame->getFrameArea().Right() - Right();
- if ( nAddMar < 0 )
- nAddMar = 0;
- }
- else
- nAddMar = nLeftMar - nFrameLeft;
+ aInter.Width( aInter.Width() + nAddMar );
+ // For a negative first line indent, we set this flag to show
+ // that the indentation/margin has been moved.
+ // This needs to be respected by the DefaultTab at the zero position.
+ if( IsFirstTextLine() && HasNegFirst() )
+ bForced = true;
+ }
+ aInter.Intersection( aLine );
+ if( !aInter.HasArea() )
+ return;
- aInter.Width( aInter.Width() + nAddMar );
- // For a negative first line indent, we set this flag to show
- // that the indentation/margin has been moved.
- // This needs to be respected by the DefaultTab at the zero position.
- if( IsFirstTextLine() && HasNegFirst() )
- bForced = true;
- }
- aInter.Intersection( aLine );
- if( !aInter.HasArea() )
- return;
+ const bool bFullLine = aLine.Left() == aInter.Left() &&
+ aLine.Right() == aInter.Right();
- const bool bFullLine = aLine.Left() == aInter.Left() &&
- aLine.Right() == aInter.Right();
+ // Although no text is left, we need to format another line,
+ // because also empty lines need to avoid a Fly with no wrapping.
+ if( bFullLine && rInf.GetIdx() == rInf.GetText().getLength() )
+ {
+ rInf.SetNewLine( true );
+ // We know that for dummies, it holds ascent == height
+ m_pCurr->SetDummy(true);
+ }
- // Although no text is left, we need to format another line,
- // because also empty lines need to avoid a Fly with no wrapping.
- if( bFullLine && rInf.GetIdx() == rInf.GetText().getLength() )
+ // aInter becomes frame-local
+ aInter.Pos().X() -= nLeftMar;
+ SwFlyPortion *pFly = new SwFlyPortion( aInter );
+ if( bForced )
+ {
+ m_pCurr->SetForcedLeftMargin();
+ rInf.ForcedLeftMargin( (sal_uInt16)aInter.Width() );
+ }
+
+ if( bFullLine )
+ {
+ // In order to properly flow around Flys with different
+ // wrapping attributes, we need to increase by units of line height.
+ // The last avoiding line should be adjusted in height, so that
+ // we don't get a frame spacing effect.
+ // It is important that ascent == height, because the FlyPortion
+ // values are transferred to pCurr in CalcLine and IsDummy() relies
+ // on this behaviour.
+ // To my knowledge we only have two places where DummyLines can be
+ // created: here and in MakeFlyDummies.
+ // IsDummy() is evaluated in IsFirstTextLine(), when moving lines
+ // and in relation with DropCaps.
+ pFly->Height( sal_uInt16(aInter.Height()) );
+
+ // nNextTop now contains the margin's bottom edge, which we avoid
+ // or the next margin's top edge, which we need to respect.
+ // That means we can comfortably grow up to this value; that's how
+ // we save a few empty lines.
+ long nNextTop = rTextFly.GetNextTop();
+ if ( m_pFrame->IsVertical() )
+ nNextTop = m_pFrame->SwitchVerticalToHorizontal( nNextTop );
+ if( nNextTop > aInter.Bottom() )
{
- rInf.SetNewLine( true );
- // We know that for dummies, it holds ascent == height
- m_pCurr->SetDummy(true);
+ SwTwips nH = nNextTop - aInter.Top();
+ if( nH < USHRT_MAX )
+ pFly->Height( sal_uInt16( nH ) );
}
-
- // aInter becomes frame-local
- aInter.Pos().X() -= nLeftMar;
- SwFlyPortion *pFly = new SwFlyPortion( aInter );
- if( bForced )
+ if( nAscent < pFly->Height() )
+ pFly->SetAscent( sal_uInt16(nAscent) );
+ else
+ pFly->SetAscent( pFly->Height() );
+ }
+ else
+ {
+ if( rInf.GetIdx() == rInf.GetText().getLength() )
{
- m_pCurr->SetForcedLeftMargin();
- rInf.ForcedLeftMargin( (sal_uInt16)aInter.Width() );
+ // Don't use nHeight, or we have a huge descent
+ pFly->Height( pLast->Height() );
+ pFly->SetAscent( pLast->GetAscent() );
}
-
- if( bFullLine )
+ else
{
- // In order to properly flow around Flys with different
- // wrapping attributes, we need to increase by units of line height.
- // The last avoiding line should be adjusted in height, so that
- // we don't get a frame spacing effect.
- // It is important that ascent == height, because the FlyPortion
- // values are transferred to pCurr in CalcLine and IsDummy() relies
- // on this behaviour.
- // To my knowledge we only have two places where DummyLines can be
- // created: here and in MakeFlyDummies.
- // IsDummy() is evaluated in IsFirstTextLine(), when moving lines
- // and in relation with DropCaps.
pFly->Height( sal_uInt16(aInter.Height()) );
-
- // nNextTop now contains the margin's bottom edge, which we avoid
- // or the next margin's top edge, which we need to respect.
- // That means we can comfortably grow up to this value; that's how
- // we save a few empty lines.
- long nNextTop = rTextFly.GetNextTop();
- if ( m_pFrame->IsVertical() )
- nNextTop = m_pFrame->SwitchVerticalToHorizontal( nNextTop );
- if( nNextTop > aInter.Bottom() )
- {
- SwTwips nH = nNextTop - aInter.Top();
- if( nH < USHRT_MAX )
- pFly->Height( sal_uInt16( nH ) );
- }
if( nAscent < pFly->Height() )
pFly->SetAscent( sal_uInt16(nAscent) );
else
pFly->SetAscent( pFly->Height() );
}
- else
- {
- if( rInf.GetIdx() == rInf.GetText().getLength() )
- {
- // Don't use nHeight, or we have a huge descent
- pFly->Height( pLast->Height() );
- pFly->SetAscent( pLast->GetAscent() );
- }
- else
- {
- pFly->Height( sal_uInt16(aInter.Height()) );
- if( nAscent < pFly->Height() )
- pFly->SetAscent( sal_uInt16(nAscent) );
- else
- pFly->SetAscent( pFly->Height() );
- }
- }
+ }
- rInf.SetFly( pFly );
+ rInf.SetFly( pFly );
- if( pFly->GetFix() < rInf.Width() )
- rInf.Width( pFly->GetFix() );
+ if( pFly->GetFix() < rInf.Width() )
+ rInf.Width( pFly->GetFix() );
- SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
- if ( pGrid )
- {
- const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
- const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
+ SwTextGridItem const*const pGrid(GetGridItem(m_pFrame->FindPageFrame()));
+ if ( !pGrid )
+ return;
- SwRectFnSet aRectFnSet(pPageFrame);
+ const SwPageFrame* pPageFrame = m_pFrame->FindPageFrame();
+ const SwLayoutFrame* pBody = pPageFrame->FindBodyCont();
- const long nGridOrigin = pBody ?
- aRectFnSet.GetPrtLeft(*pBody) :
- aRectFnSet.GetPrtLeft(*pPageFrame);
+ SwRectFnSet aRectFnSet(pPageFrame);
- const SwDoc *pDoc = rInf.GetTextFrame()->GetNode()->GetDoc();
- const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
+ const long nGridOrigin = pBody ?
+ aRectFnSet.GetPrtLeft(*pBody) :
+ aRectFnSet.GetPrtLeft(*pPageFrame);
- SwTwips nStartX = GetLeftMargin();
- if ( aRectFnSet.IsVert() )
- {
- Point aPoint( nStartX, 0 );
- m_pFrame->SwitchHorizontalToVertical( aPoint );
- nStartX = aPoint.Y();
- }
+ const SwDoc *pDoc = rInf.GetTextFrame()->GetNode()->GetDoc();
+ const sal_uInt16 nGridWidth = GetGridWidth(*pGrid, *pDoc);
- const SwTwips nOfst = nStartX - nGridOrigin;
- const SwTwips nTmpWidth = rInf.Width() + nOfst;
+ SwTwips nStartX = GetLeftMargin();
+ if ( aRectFnSet.IsVert() )
+ {
+ Point aPoint( nStartX, 0 );
+ m_pFrame->SwitchHorizontalToVertical( aPoint );
+ nStartX = aPoint.Y();
+ }
+
+ const SwTwips nOfst = nStartX - nGridOrigin;
+ const SwTwips nTmpWidth = rInf.Width() + nOfst;
+
+ const sal_uLong i = nTmpWidth / nGridWidth + 1;
+
+ const long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
+ if ( nNewWidth > 0 )
+ rInf.Width( (sal_uInt16)nNewWidth );
+ else
+ rInf.Width( 0 );
- const sal_uLong i = nTmpWidth / nGridWidth + 1;
- const long nNewWidth = ( i - 1 ) * nGridWidth - nOfst;
- if ( nNewWidth > 0 )
- rInf.Width( (sal_uInt16)nNewWidth );
- else
- rInf.Width( 0 );
- }
- }
}
SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index fbcbcaef76d1..777165819b55 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -194,96 +194,97 @@ SwFieldSlot::~SwFieldSlot()
void SwFieldPortion::CheckScript( const SwTextSizeInfo &rInf )
{
OUString aText;
- if (GetExpText(rInf, aText) && !aText.isEmpty())
+ if (!GetExpText(rInf, aText) || aText.isEmpty())
+ return;
+
+ SwFontScript nActual = m_pFont ? m_pFont->GetActual() : rInf.GetFont()->GetActual();
+ sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( aText, 0 );
+ sal_Int32 nChg = 0;
+ if( i18n::ScriptType::WEAK == nScript )
{
- SwFontScript nActual = m_pFont ? m_pFont->GetActual() : rInf.GetFont()->GetActual();
- sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType( aText, 0 );
- sal_Int32 nChg = 0;
- if( i18n::ScriptType::WEAK == nScript )
- {
- nChg = g_pBreakIt->GetBreakIter()->endOfScript(aText,0,nScript);
- if (nChg < aText.getLength() && nChg >= 0)
- nScript = g_pBreakIt->GetBreakIter()->getScriptType( aText, nChg );
- }
+ nChg = g_pBreakIt->GetBreakIter()->endOfScript(aText,0,nScript);
+ if (nChg < aText.getLength() && nChg >= 0)
+ nScript = g_pBreakIt->GetBreakIter()->getScriptType( aText, nChg );
+ }
- // nNextScriptChg will be evaluated during SwFieldPortion::Format()
+ // nNextScriptChg will be evaluated during SwFieldPortion::Format()
- if (nChg < aText.getLength() && nChg >= 0)
- m_nNextScriptChg = g_pBreakIt->GetBreakIter()->endOfScript( aText, nChg, nScript );
- else
- m_nNextScriptChg = aText.getLength();
-
- SwFontScript nTmp;
- switch ( nScript ) {
- case i18n::ScriptType::LATIN : nTmp = SwFontScript::Latin; break;
- case i18n::ScriptType::ASIAN : nTmp = SwFontScript::CJK; break;
- case i18n::ScriptType::COMPLEX : nTmp = SwFontScript::CTL; break;
- default: nTmp = nActual;
- }
+ if (nChg < aText.getLength() && nChg >= 0)
+ m_nNextScriptChg = g_pBreakIt->GetBreakIter()->endOfScript( aText, nChg, nScript );
+ else
+ m_nNextScriptChg = aText.getLength();
+
+ SwFontScript nTmp;
+ switch ( nScript ) {
+ case i18n::ScriptType::LATIN : nTmp = SwFontScript::Latin; break;
+ case i18n::ScriptType::ASIAN : nTmp = SwFontScript::CJK; break;
+ case i18n::ScriptType::COMPLEX : nTmp = SwFontScript::CTL; break;
+ default: nTmp = nActual;
+ }
- // #i16354# Change script type for RTL text to CTL.
- const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
- // #i98418#
- const sal_uInt8 nFieldDir = ( IsNumberPortion() || IsFootnoteNumPortion() ) ?
- rSI.GetDefaultDir() :
- rSI.DirType( IsFollow() ? rInf.GetIdx() - 1 : rInf.GetIdx() );
+ // #i16354# Change script type for RTL text to CTL.
+ const SwScriptInfo& rSI = rInf.GetParaPortion()->GetScriptInfo();
+ // #i98418#
+ const sal_uInt8 nFieldDir = ( IsNumberPortion() || IsFootnoteNumPortion() ) ?
+ rSI.GetDefaultDir() :
+ rSI.DirType( IsFollow() ? rInf.GetIdx() - 1 : rInf.GetIdx() );
+ {
+ UErrorCode nError = U_ZERO_ERROR;
+ UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError );
+ ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nFieldDir, nullptr, &nError );
+ int32_t nEnd;
+ UBiDiLevel nCurrDir;
+ ubidi_getLogicalRun( pBidi, 0, &nEnd, &nCurrDir );
+ ubidi_close( pBidi );
+ const sal_Int32 nNextDirChg = nEnd;
+ m_nNextScriptChg = std::min( m_nNextScriptChg, nNextDirChg );
+
+ // #i89825# change the script type also to CTL
+ // if there is no strong LTR char in the LTR run (numbers)
+ if (nCurrDir != UBIDI_RTL &&
+ (UBIDI_LTR != nFieldDir || i18n::ScriptType::COMPLEX == nScript))
{
- UErrorCode nError = U_ZERO_ERROR;
- UBiDi* pBidi = ubidi_openSized( aText.getLength(), 0, &nError );
- ubidi_setPara( pBidi, reinterpret_cast<const UChar *>(aText.getStr()), aText.getLength(), nFieldDir, nullptr, &nError );
- int32_t nEnd;
- UBiDiLevel nCurrDir;
- ubidi_getLogicalRun( pBidi, 0, &nEnd, &nCurrDir );
- ubidi_close( pBidi );
- const sal_Int32 nNextDirChg = nEnd;
- m_nNextScriptChg = std::min( m_nNextScriptChg, nNextDirChg );
-
- // #i89825# change the script type also to CTL
- // if there is no strong LTR char in the LTR run (numbers)
- if (nCurrDir != UBIDI_RTL &&
- (UBIDI_LTR != nFieldDir || i18n::ScriptType::COMPLEX == nScript))
+ nCurrDir = UBIDI_RTL;
+ for( sal_Int32 nCharIdx = 0; nCharIdx < nEnd; ++nCharIdx )
{
- nCurrDir = UBIDI_RTL;
- for( sal_Int32 nCharIdx = 0; nCharIdx < nEnd; ++nCharIdx )
+ UCharDirection nCharDir = u_charDirection ( aText[ nCharIdx ]);
+ if ( nCharDir == U_LEFT_TO_RIGHT ||
+ nCharDir == U_LEFT_TO_RIGHT_EMBEDDING ||
+ nCharDir == U_LEFT_TO_RIGHT_OVERRIDE )
{
- UCharDirection nCharDir = u_charDirection ( aText[ nCharIdx ]);
- if ( nCharDir == U_LEFT_TO_RIGHT ||
- nCharDir == U_LEFT_TO_RIGHT_EMBEDDING ||
- nCharDir == U_LEFT_TO_RIGHT_OVERRIDE )
- {
- nCurrDir = UBIDI_LTR;
- break;
- }
+ nCurrDir = UBIDI_LTR;
+ break;
}
}
-
- if (nCurrDir == UBIDI_RTL)
- {
- nTmp = SwFontScript::CTL;
- // If we decided that this range was RTL after all and the
- // previous range was complex but clipped to the start of this
- // range, then extend it to be complex over the additional RTL range
- if (nScript == i18n::ScriptType::COMPLEX)
- m_nNextScriptChg = nNextDirChg;
- }
}
- // #i98418#
- // keep determined script type for footnote portions as preferred script type.
- // For footnote portions a font can not be created directly - see footnote
- // portion format method.
- if ( IsFootnotePortion() )
+ if (nCurrDir == UBIDI_RTL)
{
- static_cast<SwFootnotePortion*>(this)->SetPreferredScriptType( nTmp );
- }
- else if ( nTmp != nActual )
- {
- if( !m_pFont )
- m_pFont = new SwFont( *rInf.GetFont() );
- m_pFont->SetActual( nTmp );
+ nTmp = SwFontScript::CTL;
+ // If we decided that this range was RTL after all and the
+ // previous range was complex but clipped to the start of this
+ // range, then extend it to be complex over the additional RTL range
+ if (nScript == i18n::ScriptType::COMPLEX)
+ m_nNextScriptChg = nNextDirChg;
}
}
+
+ // #i98418#
+ // keep determined script type for footnote portions as preferred script type.
+ // For footnote portions a font can not be created directly - see footnote
+ // portion format method.
+ if ( IsFootnotePortion() )
+ {
+ static_cast<SwFootnotePortion*>(this)->SetPreferredScriptType( nTmp );
+ }
+ else if ( nTmp != nActual )
+ {
+ if( !m_pFont )
+ m_pFont = new SwFont( *rInf.GetFont() );
+ m_pFont->SetActual( nTmp );
+ }
+
}
bool SwFieldPortion::Format( SwTextFormatInfo &rInf )
@@ -1091,54 +1092,55 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText )
void SwCombinedPortion::Paint( const SwTextPaintInfo &rInf ) const
{
OSL_ENSURE( GetLen() <= 1, "SwFieldPortion::Paint: rest-portion pollution?" );
- if( Width() )
- {
- rInf.DrawBackBrush( *this );
- rInf.DrawViewOpt( *this, POR_FLD );
+ if( !Width() )
+ return;
- // do we have to repaint a post it portion?
- if( rInf.OnWin() && pPortion && !pPortion->Width() )
- pPortion->PrePaint( rInf, this );
+ rInf.DrawBackBrush( *this );
+ rInf.DrawViewOpt( *this, POR_FLD );
- const sal_Int32 nCount = m_aExpand.getLength();
- if( !nCount )
- return;
- OSL_ENSURE( nCount < 7, "Too much combined characters" );
+ // do we have to repaint a post it portion?
+ if( rInf.OnWin() && pPortion && !pPortion->Width() )
+ pPortion->PrePaint( rInf, this );
- // the first character of the second row
- const sal_Int32 nTop = ( nCount + 1 ) / 2;
+ const sal_Int32 nCount = m_aExpand.getLength();
+ if( !nCount )
+ return;
+ OSL_ENSURE( nCount < 7, "Too much combined characters" );
- SwFont aTmpFont( *rInf.GetFont() );
- aTmpFont.SetProportion( nProportion ); // a smaller font
- SwFontSave aFontSave( rInf, &aTmpFont );
+ // the first character of the second row
+ const sal_Int32 nTop = ( nCount + 1 ) / 2;
+
+ SwFont aTmpFont( *rInf.GetFont() );
+ aTmpFont.SetProportion( nProportion ); // a smaller font
+ SwFontSave aFontSave( rInf, &aTmpFont );
- Point aOldPos = rInf.GetPos();
- Point aOutPos( aOldPos.X(), aOldPos.Y() - nUpPos );// Y of the first row
- for( sal_Int32 i = 0 ; i < nCount; ++i )
+ Point aOldPos = rInf.GetPos();
+ Point aOutPos( aOldPos.X(), aOldPos.Y() - nUpPos );// Y of the first row
+ for( sal_Int32 i = 0 ; i < nCount; ++i )
+ {
+ if( i == nTop ) // change the row
+ aOutPos.Y() = aOldPos.Y() + nLowPos; // Y of the second row
+ aOutPos.X() = aOldPos.X() + aPos[i]; // X position
+ const SwFontScript nAct = aScrType[i]; // script type
+ aTmpFont.SetActual( nAct );
+
+ // if there're more than 4 characters to display, we choose fonts
+ // with 2/3 of the original font width.
+ if( aWidth[ nAct ] )
{
- if( i == nTop ) // change the row
- aOutPos.Y() = aOldPos.Y() + nLowPos; // Y of the second row
- aOutPos.X() = aOldPos.X() + aPos[i]; // X position
- const SwFontScript nAct = aScrType[i]; // script type
- aTmpFont.SetActual( nAct );
-
- // if there're more than 4 characters to display, we choose fonts
- // with 2/3 of the original font width.
- if( aWidth[ nAct ] )
+ Size aTmpSz = aTmpFont.GetSize( nAct );
+ if( aTmpSz.Width() != aWidth[ nAct ] )
{
- Size aTmpSz = aTmpFont.GetSize( nAct );
- if( aTmpSz.Width() != aWidth[ nAct ] )
- {
- aTmpSz.Width() = aWidth[ nAct ];
- aTmpFont.SetSize( aTmpSz, nAct );
- }
+ aTmpSz.Width() = aWidth[ nAct ];
+ aTmpFont.SetSize( aTmpSz, nAct );
}
- const_cast<SwTextPaintInfo&>(rInf).SetPos( aOutPos );
- rInf.DrawText( m_aExpand, *this, i, 1 );
}
- // rInf is const, so we have to take back our manipulations
- const_cast<SwTextPaintInfo&>(rInf).SetPos( aOldPos );
+ const_cast<SwTextPaintInfo&>(rInf).SetPos( aOutPos );
+ rInf.DrawText( m_aExpand, *this, i, 1 );
}
+ // rInf is const, so we have to take back our manipulations
+ const_cast<SwTextPaintInfo&>(rInf).SetPos( aOldPos );
+
}
bool SwCombinedPortion::Format( SwTextFormatInfo &rInf )
diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx
index 7ffc17e970fb..58ca2664ab0e 100644
--- a/sw/source/core/text/portxt.cxx
+++ b/sw/source/core/text/portxt.cxx
@@ -463,33 +463,36 @@ bool SwTextPortion::Format( SwTextFormatInfo &rInf )
// rInf.nIdx points to the next word, nIdx-1 is the portion's last char
void SwTextPortion::FormatEOL( SwTextFormatInfo &rInf )
{
- if( ( !GetPortion() || ( GetPortion()->IsKernPortion() &&
- !GetPortion()->GetPortion() ) ) && GetLen() &&
+ if( !(
+ ( !GetPortion() || ( GetPortion()->IsKernPortion() &&
+ !GetPortion()->GetPortion() ) ) &&
+ GetLen() &&
rInf.GetIdx() < rInf.GetText().getLength() &&
- 1 < rInf.GetIdx() && ' ' == rInf.GetChar( rInf.GetIdx() - 1 )
- && !rInf.GetLast()->IsHolePortion() )
- {
- // calculate number of blanks
- sal_Int32 nX = rInf.GetIdx() - 1;
- sal_Int32 nHoleLen = 1;
- while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
- nHoleLen++;
-
- // First set ourselves and the insert, because there could be
- // a SwLineLayout
- sal_uInt16 nBlankSize;
- if( nHoleLen == GetLen() )
- nBlankSize = Width();
- else
- nBlankSize = nHoleLen * rInf.GetTextSize(OUString(' ')).Width();
- Width( Width() - nBlankSize );
- rInf.X( rInf.X() - nBlankSize );
- SetLen( GetLen() - nHoleLen );
- SwLinePortion *pHole = new SwHolePortion( *this );
- static_cast<SwHolePortion *>( pHole )->SetBlankWidth( nBlankSize );
- static_cast<SwHolePortion *>( pHole )->SetLen( nHoleLen );
- Insert( pHole );
- }
+ 1 < rInf.GetIdx() && ' ' == rInf.GetChar( rInf.GetIdx() - 1 ) &&
+ !rInf.GetLast()->IsHolePortion()) )
+ return;
+
+ // calculate number of blanks
+ sal_Int32 nX = rInf.GetIdx() - 1;
+ sal_Int32 nHoleLen = 1;
+ while( nX && nHoleLen < GetLen() && CH_BLANK == rInf.GetChar( --nX ) )
+ nHoleLen++;
+
+ // First set ourselves and the insert, because there could be
+ // a SwLineLayout
+ sal_uInt16 nBlankSize;
+ if( nHoleLen == GetLen() )
+ nBlankSize = Width();
+ else
+ nBlankSize = nHoleLen * rInf.GetTextSize(OUString(' ')).Width();
+ Width( Width() - nBlankSize );
+ rInf.X( rInf.X() - nBlankSize );
+ SetLen( GetLen() - nHoleLen );
+ SwLinePortion *pHole = new SwHolePortion( *this );
+ static_cast<SwHolePortion *>( pHole )->SetBlankWidth( nBlankSize );
+ static_cast<SwHolePortion *>( pHole )->SetLen( nHoleLen );
+ Insert( pHole );
+
}
sal_Int32 SwTextPortion::GetCursorOfst( const sal_uInt16 nOfst ) const
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index c7ab996bf40b..22171d0245c1 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -140,25 +140,26 @@ SwFntObj::~SwFntObj()
void SwFntObj::CreatePrtFont( const OutputDevice& rPrt )
{
- if ( m_nPropWidth != 100 && m_pPrinter != &rPrt )
- {
- if( m_pScrFont != m_pPrtFont )
- delete m_pScrFont;
- if( m_pPrtFont != &m_aFont )
- delete m_pPrtFont;
-
- const vcl::Font aOldFnt( rPrt.GetFont() );
- const_cast<OutputDevice&>(rPrt).SetFont( m_aFont );
- const FontMetric aWinMet( rPrt.GetFontMetric() );
- const_cast<OutputDevice&>(rPrt).SetFont( aOldFnt );
- long nWidth = ( aWinMet.GetFontSize().Width() * m_nPropWidth ) / 100;
-
- if( !nWidth )
- ++nWidth;
- m_pPrtFont = new vcl::Font( m_aFont );
- m_pPrtFont->SetFontSize( Size( nWidth, m_aFont.GetFontSize().Height() ) );
- m_pScrFont = nullptr;
- }
+ if ( m_nPropWidth == 100 || m_pPrinter == &rPrt )
+ return;
+
+ if( m_pScrFont != m_pPrtFont )
+ delete m_pScrFont;
+ if( m_pPrtFont != &m_aFont )
+ delete m_pPrtFont;
+
+ const vcl::Font aOldFnt( rPrt.GetFont() );
+ const_cast<OutputDevice&>(rPrt).SetFont( m_aFont );
+ const FontMetric aWinMet( rPrt.GetFontMetric() );
+ const_cast<OutputDevice&>(rPrt).SetFont( aOldFnt );
+ long nWidth = ( aWinMet.GetFontSize().Width() * m_nPropWidth ) / 100;
+
+ if( !nWidth )
+ ++nWidth;
+ m_pPrtFont = new vcl::Font( m_aFont );
+ m_pPrtFont->SetFontSize( Size( nWidth, m_aFont.GetFontSize().Height() ) );
+ m_pScrFont = nullptr;
+
}
/*
diff --git a/sw/source/core/undo/SwUndoPageDesc.cxx b/sw/source/core/undo/SwUndoPageDesc.cxx
index 7b86ffac2c15..10602da49624 100644
--- a/sw/source/core/undo/SwUndoPageDesc.cxx
+++ b/sw/source/core/undo/SwUndoPageDesc.cxx
@@ -276,70 +276,72 @@ void SwUndoPageDesc::ExchangeContentNodes( SwPageDesc& rSource, SwPageDesc &rDes
// Same procedure for footers...
const SwFormatFooter& rDestFoot = rDest.GetMaster().GetFooter();
const SwFormatFooter& rSourceFoot = rSource.GetMaster().GetFooter();
- if( rDestFoot.IsActive() )
- {
- const SfxPoolItem* pItem;
- rDest.GetMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
- SfxPoolItem *pNewItem = pItem->Clone();
- SwFrameFormat *pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
- pNewFormat->SetFormatAttr( rSourceFoot.GetFooterFormat()->GetContent() );
- delete pNewItem;
+ if( !rDestFoot.IsActive() )
+ return;
+
+ const SfxPoolItem* pItem;
+ rDest.GetMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
+ SfxPoolItem *pNewItem = pItem->Clone();
+ SwFrameFormat *pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
+ pNewFormat->SetFormatAttr( rSourceFoot.GetFooterFormat()->GetContent() );
+ delete pNewItem;
#if OSL_DEBUG_LEVEL > 1
- const SwFormatContent& rFooterSourceContent = rSourceFoot.GetFooterFormat()->GetContent();
- (void)rFooterSourceContent;
- const SwFormatContent& rFooterDestContent = rDestFoot.GetFooterFormat()->GetContent();
- (void)rFooterDestContent;
+ const SwFormatContent& rFooterSourceContent = rSourceFoot.GetFooterFormat()->GetContent();
+ (void)rFooterSourceContent;
+ const SwFormatContent& rFooterDestContent = rDestFoot.GetFooterFormat()->GetContent();
+ (void)rFooterDestContent;
+#endif
+ rSource.GetMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
+ pNewItem = pItem->Clone();
+ pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
+ pNewFormat->SetFormatAttr( SwFormatContent() );
+ delete pNewItem;
+
+ if( !rDest.IsFooterShared() )
+ {
+ const SwFormatFooter& rSourceLeftFoot = rSource.GetLeft().GetFooter();
+#if OSL_DEBUG_LEVEL > 1
+ const SwFormatContent& rFooterSourceContent2 = rSourceLeftFoot.GetFooterFormat()->GetContent();
+ const SwFormatContent& rFooterDestContent2 =
+ rDest.GetLeft().GetFooter().GetFooterFormat()->GetContent();
+ (void)rFooterSourceContent2;
+ (void)rFooterDestContent2;
#endif
- rSource.GetMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
+ rDest.GetLeft().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
+ pNewItem = pItem->Clone();
+ pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
+ pNewFormat->SetFormatAttr( rSourceLeftFoot.GetFooterFormat()->GetContent() );
+ delete pNewItem;
+ rSource.GetLeft().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
pNewItem = pItem->Clone();
pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
pNewFormat->SetFormatAttr( SwFormatContent() );
delete pNewItem;
+ }
+ if (rDest.IsFirstShared())
+ return;
- if( !rDest.IsFooterShared() )
- {
- const SwFormatFooter& rSourceLeftFoot = rSource.GetLeft().GetFooter();
+ const SwFormatFooter& rSourceFirstMasterFoot = rSource.GetFirstMaster().GetFooter();
#if OSL_DEBUG_LEVEL > 1
- const SwFormatContent& rFooterSourceContent2 = rSourceLeftFoot.GetFooterFormat()->GetContent();
- const SwFormatContent& rFooterDestContent2 =
- rDest.GetLeft().GetFooter().GetFooterFormat()->GetContent();
- (void)rFooterSourceContent2;
- (void)rFooterDestContent2;
+ const SwFormatContent& rFooterSourceContent2 = rSourceFirstMasterFoot.GetFooterFormat()->GetContent();
+ const SwFormatContent& rFooterDestContent2 =
+ rDest.GetFirstMaster().GetFooter().GetFooterFormat()->GetContent();
+ (void)rFooterSourceContent2;
+ (void)rFooterDestContent2;
#endif
- rDest.GetLeft().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
- pNewItem = pItem->Clone();
- pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
- pNewFormat->SetFormatAttr( rSourceLeftFoot.GetFooterFormat()->GetContent() );
- delete pNewItem;
- rSource.GetLeft().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
- pNewItem = pItem->Clone();
- pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
- pNewFormat->SetFormatAttr( SwFormatContent() );
- delete pNewItem;
- }
- if (!rDest.IsFirstShared())
- {
- const SwFormatFooter& rSourceFirstMasterFoot = rSource.GetFirstMaster().GetFooter();
-#if OSL_DEBUG_LEVEL > 1
- const SwFormatContent& rFooterSourceContent2 = rSourceFirstMasterFoot.GetFooterFormat()->GetContent();
- const SwFormatContent& rFooterDestContent2 =
- rDest.GetFirstMaster().GetFooter().GetFooterFormat()->GetContent();
- (void)rFooterSourceContent2;
- (void)rFooterDestContent2;
-#endif
- rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
- pNewItem = pItem->Clone();
- pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
- pNewFormat->SetFormatAttr( rSourceFirstMasterFoot.GetFooterFormat()->GetContent() );
- delete pNewItem;
- rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
- pNewItem = pItem->Clone();
- pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
- pNewFormat->SetFormatAttr( SwFormatContent() );
- delete pNewItem;
- }
- }
+ rDest.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
+ pNewItem = pItem->Clone();
+ pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
+ pNewFormat->SetFormatAttr( rSourceFirstMasterFoot.GetFooterFormat()->GetContent() );
+ delete pNewItem;
+ rSource.GetFirstMaster().GetAttrSet().GetItemState( RES_FOOTER, false, &pItem );
+ pNewItem = pItem->Clone();
+ pNewFormat = static_cast<SwFormatFooter*>(pNewItem)->GetFooterFormat();
+ pNewFormat->SetFormatAttr( SwFormatContent() );
+ delete pNewItem;
+
+
}
void SwUndoPageDesc::UndoImpl(::sw::UndoRedoContext &)
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index cdaff02db50a..3d080b56391a 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -906,44 +906,45 @@ SwXShape::SwXShape(uno::Reference< uno::XInterface > & xShape) :
pImpl(new SwShapeDescriptor_Impl()),
m_bDescriptor(true)
{
- if(xShape.is()) // default Ctor
+ if(!xShape.is()) // default Ctor
+ return;
+
+ const uno::Type& rAggType = cppu::UnoType<uno::XAggregation>::get();
+ //aAgg contains a reference of the SvxShape!
{
- const uno::Type& rAggType = cppu::UnoType<uno::XAggregation>::get();
- //aAgg contains a reference of the SvxShape!
+ uno::Any aAgg = xShape->queryInterface(rAggType);
+ aAgg >>= xShapeAgg;
+ // #i31698#
+ if ( xShapeAgg.is() )
{
- uno::Any aAgg = xShape->queryInterface(rAggType);
- aAgg >>= xShapeAgg;
- // #i31698#
- if ( xShapeAgg.is() )
- {
- xShapeAgg->queryAggregation( cppu::UnoType<drawing::XShape>::get()) >>= mxShape;
- OSL_ENSURE( mxShape.is(),
- "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" );
- }
+ xShapeAgg->queryAggregation( cppu::UnoType<drawing::XShape>::get()) >>= mxShape;
+ OSL_ENSURE( mxShape.is(),
+ "<SwXShape::SwXShape(..)> - no XShape found at <xShapeAgg>" );
}
- xShape = nullptr;
- m_refCount++;
- if( xShapeAgg.is() )
- xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
- m_refCount--;
+ }
+ xShape = nullptr;
+ m_refCount++;
+ if( xShapeAgg.is() )
+ xShapeAgg->setDelegator( static_cast<cppu::OWeakObject*>(this) );
+ m_refCount--;
- uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
- SvxShape* pShape = nullptr;
- if(xShapeTunnel.is())
- pShape = reinterpret_cast< SvxShape * >(
- sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
+ uno::Reference< lang::XUnoTunnel > xShapeTunnel(xShapeAgg, uno::UNO_QUERY);
+ SvxShape* pShape = nullptr;
+ if(xShapeTunnel.is())
+ pShape = reinterpret_cast< SvxShape * >(
+ sal::static_int_cast< sal_IntPtr >( xShapeTunnel->getSomething(SvxShape::getUnoTunnelId()) ));
- SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr;
- if(pObj)
- {
- SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
- if(pFormat)
- pFormat->Add(this);
+ SdrObject* pObj = pShape ? pShape->GetSdrObject() : nullptr;
+ if(pObj)
+ {
+ SwFrameFormat* pFormat = ::FindFrameFormat( pObj );
+ if(pFormat)
+ pFormat->Add(this);
- lcl_addShapePropertyEventFactories( *pObj, *this );
- pImpl->bInitializedPropertyNotifier = true;
- }
+ lcl_addShapePropertyEventFactories( *pObj, *this );
+ pImpl->bInitializedPropertyNotifier = true;
}
+
}
void SwXShape::AddExistingShapeToFormat( SdrObject const & _rObj )
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index 515c5280362e..997b4081c3d1 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -174,36 +174,37 @@ void SwUnoCursorHelper::GetTextFromPam(SwPaM & rPam, OUString & rBuffer)
WriterRef xWrt;
// TODO/MBA: looks like a BaseURL doesn't make sense here
SwReaderWriter::GetWriter( FILTER_TEXT_DLG, OUString(), xWrt );
- if( xWrt.is() )
- {
- SwWriter aWriter( aStream, rPam );
- xWrt->bASCII_NoLastLineEnd = true;
- xWrt->bExportPargraphNumbering = false;
- SwAsciiOptions aOpt = xWrt->GetAsciiOptions();
- aOpt.SetCharSet( RTL_TEXTENCODING_UNICODE );
- xWrt->SetAsciiOptions( aOpt );
- xWrt->bUCS2_WithStartChar = false;
- // #i68522#
- const bool bOldShowProgress = xWrt->bShowProgress;
- xWrt->bShowProgress = false;
-
- if( ! aWriter.Write( xWrt ).IsError() )
- {
- const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode );
- if (lUniLen < static_cast<sal_uInt64>(SAL_MAX_INT32-1))
- {
- aStream.WriteUInt16( '\0' );
+ if( !xWrt.is() )
+ return;
- aStream.Seek( 0 );
- aStream.ResetError();
+ SwWriter aWriter( aStream, rPam );
+ xWrt->bASCII_NoLastLineEnd = true;
+ xWrt->bExportPargraphNumbering = false;
+ SwAsciiOptions aOpt = xWrt->GetAsciiOptions();
+ aOpt.SetCharSet( RTL_TEXTENCODING_UNICODE );
+ xWrt->SetAsciiOptions( aOpt );
+ xWrt->bUCS2_WithStartChar = false;
+ // #i68522#
+ const bool bOldShowProgress = xWrt->bShowProgress;
+ xWrt->bShowProgress = false;
- rtl_uString *pStr = rtl_uString_alloc(lUniLen);
- aStream.ReadBytes(pStr->buffer, lUniLen * sizeof(sal_Unicode));
- rBuffer = OUString(pStr, SAL_NO_ACQUIRE);
- }
+ if( ! aWriter.Write( xWrt ).IsError() )
+ {
+ const sal_uInt64 lUniLen = aStream.GetSize()/sizeof( sal_Unicode );
+ if (lUniLen < static_cast<sal_uInt64>(SAL_MAX_INT32-1))
+ {
+ aStream.WriteUInt16( '\0' );
+
+ aStream.Seek( 0 );
+ aStream.ResetError();
+
+ rtl_uString *pStr = rtl_uString_alloc(lUniLen);
+ aStream.ReadBytes(pStr->buffer, lUniLen * sizeof(sal_Unicode));
+ rBuffer = OUString(pStr, SAL_NO_ACQUIRE);
}
- xWrt->bShowProgress = bOldShowProgress;
}
+ xWrt->bShowProgress = bOldShowProgress;
+
}
/// @throws lang::IllegalArgumentException
@@ -2835,40 +2836,41 @@ SwXTextCursor::sort(const uno::Sequence< beans::PropertyValue >& rDescriptor)
SwUnoCursor & rUnoCursor( m_pImpl->GetCursorOrThrow() );
- if (rUnoCursor.HasMark())
- {
- SwSortOptions aSortOpt;
- if (!SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
- {
- throw uno::RuntimeException("Bad sort properties");
- }
- UnoActionContext aContext( rUnoCursor.GetDoc() );
+ if (!rUnoCursor.HasMark())
+ return;
- SwPosition & rStart = *rUnoCursor.Start();
- SwPosition & rEnd = *rUnoCursor.End();
+ SwSortOptions aSortOpt;
+ if (!SwUnoCursorHelper::ConvertSortProperties(rDescriptor, aSortOpt))
+ {
+ throw uno::RuntimeException("Bad sort properties");
+ }
+ UnoActionContext aContext( rUnoCursor.GetDoc() );
- SwNodeIndex aPrevIdx( rStart.nNode, -1 );
- const sal_uLong nOffset = rEnd.nNode.GetIndex() - rStart.nNode.GetIndex();
- const sal_Int32 nCntStt = rStart.nContent.GetIndex();
+ SwPosition & rStart = *rUnoCursor.Start();
+ SwPosition & rEnd = *rUnoCursor.End();
- rUnoCursor.GetDoc()->SortText(rUnoCursor, aSortOpt);
+ SwNodeIndex aPrevIdx( rStart.nNode, -1 );
+ const sal_uLong nOffset = rEnd.nNode.GetIndex() - rStart.nNode.GetIndex();
+ const sal_Int32 nCntStt = rStart.nContent.GetIndex();
- // update selection
- rUnoCursor.DeleteMark();
- rUnoCursor.GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
- SwContentNode *const pCNd = rUnoCursor.GetContentNode();
- sal_Int32 nLen = pCNd->Len();
- if (nLen > nCntStt)
- {
- nLen = nCntStt;
- }
- rUnoCursor.GetPoint()->nContent.Assign(pCNd, nLen );
- rUnoCursor.SetMark();
+ rUnoCursor.GetDoc()->SortText(rUnoCursor, aSortOpt);
- rUnoCursor.GetPoint()->nNode += nOffset;
- SwContentNode *const pCNd2 = rUnoCursor.GetContentNode();
- rUnoCursor.GetPoint()->nContent.Assign( pCNd2, pCNd2->Len() );
+ // update selection
+ rUnoCursor.DeleteMark();
+ rUnoCursor.GetPoint()->nNode.Assign( aPrevIdx.GetNode(), +1 );
+ SwContentNode *const pCNd = rUnoCursor.GetContentNode();
+ sal_Int32 nLen = pCNd->Len();
+ if (nLen > nCntStt)
+ {
+ nLen = nCntStt;
}
+ rUnoCursor.GetPoint()->nContent.Assign(pCNd, nLen );
+ rUnoCursor.SetMark();
+
+ rUnoCursor.GetPoint()->nNode += nOffset;
+ SwContentNode *const pCNd2 = rUnoCursor.GetContentNode();
+ rUnoCursor.GetPoint()->nContent.Assign( pCNd2, pCNd2->Len() );
+
}
uno::Reference< container::XEnumeration > SAL_CALL
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index ac30002f3639..6f1c02898f76 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -93,69 +93,70 @@ void SwViewShellImp::PaintLayer( const SdrLayerID _nLayerID,
const bool _bIsPageRightToLeft,
sdr::contact::ViewObjectContactRedirector* pRedirector )
{
- if ( HasDrawView() )
+ if ( !HasDrawView() )
+ return;
+
+ //change the draw mode in high contrast mode
+ OutputDevice* pOutDev = GetShell()->GetOut();
+ DrawModeFlags nOldDrawMode = pOutDev->GetDrawMode();
+ if( GetShell()->GetWin() &&
+ Application::GetSettings().GetStyleSettings().GetHighContrastMode() &&
+ (!GetShell()->IsPreview()||SW_MOD()->GetAccessibilityOptions().GetIsForPagePreviews()))
{
- //change the draw mode in high contrast mode
- OutputDevice* pOutDev = GetShell()->GetOut();
- DrawModeFlags nOldDrawMode = pOutDev->GetDrawMode();
- if( GetShell()->GetWin() &&
- Application::GetSettings().GetStyleSettings().GetHighContrastMode() &&
- (!GetShell()->IsPreview()||SW_MOD()->GetAccessibilityOptions().GetIsForPagePreviews()))
- {
- pOutDev->SetDrawMode( nOldDrawMode | DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill |
- DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient );
- }
+ pOutDev->SetDrawMode( nOldDrawMode | DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill |
+ DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient );
+ }
- // For correct handling of accessibility, high contrast, the
- // page background color is set as the background color at the
- // outliner of the draw view. Only necessary for the layers
- // hell and heaven
- Color aOldOutlinerBackgrdColor;
- // set default horizontal text direction on painting <hell> or
- // <heaven>.
- EEHorizontalTextDirection aOldEEHoriTextDir = EE_HTEXTDIR_L2R;
- const IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess();
- if ( (_nLayerID == rIDDMA.GetHellId()) ||
- (_nLayerID == rIDDMA.GetHeavenId()) )
+ // For correct handling of accessibility, high contrast, the
+ // page background color is set as the background color at the
+ // outliner of the draw view. Only necessary for the layers
+ // hell and heaven
+ Color aOldOutlinerBackgrdColor;
+ // set default horizontal text direction on painting <hell> or
+ // <heaven>.
+ EEHorizontalTextDirection aOldEEHoriTextDir = EE_HTEXTDIR_L2R;
+ const IDocumentDrawModelAccess& rIDDMA = GetShell()->getIDocumentDrawModelAccess();
+ if ( (_nLayerID == rIDDMA.GetHellId()) ||
+ (_nLayerID == rIDDMA.GetHeavenId()) )
+ {
+ OSL_ENSURE( _pPageBackgrdColor,
+ "incorrect usage of SwViewShellImp::PaintLayer: pPageBackgrdColor have to be set for painting layer <hell> or <heaven>");
+ if ( _pPageBackgrdColor )
{
- OSL_ENSURE( _pPageBackgrdColor,
- "incorrect usage of SwViewShellImp::PaintLayer: pPageBackgrdColor have to be set for painting layer <hell> or <heaven>");
- if ( _pPageBackgrdColor )
- {
- aOldOutlinerBackgrdColor =
- GetDrawView()->GetModel()->GetDrawOutliner().GetBackgroundColor();
- GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( *_pPageBackgrdColor );
- }
-
- aOldEEHoriTextDir =
- GetDrawView()->GetModel()->GetDrawOutliner().GetDefaultHorizontalTextDirection();
- EEHorizontalTextDirection aEEHoriTextDirOfPage =
- _bIsPageRightToLeft ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
- GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aEEHoriTextDirOfPage );
+ aOldOutlinerBackgrdColor =
+ GetDrawView()->GetModel()->GetDrawOutliner().GetBackgroundColor();
+ GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( *_pPageBackgrdColor );
}
- pOutDev->Push( PushFlags::LINECOLOR );
- if (pPrintData)
- {
- // hide drawings but not form controls (form controls are handled elsewhere)
- SdrView &rSdrView = GetPageView()->GetView();
- rSdrView.setHideDraw( !pPrintData->IsPrintDraw() );
- }
- basegfx::B2IRectangle const pageFrame(
- vcl::unotools::b2IRectangleFromRectangle(rPageFrame.getFrameArea().SVRect()));
- GetPageView()->DrawLayer(_nLayerID, pOutDev, pRedirector, aPaintRect.SVRect(), &pageFrame);
- pOutDev->Pop();
-
- // reset background color of the outliner & default horiz. text dir.
- if ( (_nLayerID == rIDDMA.GetHellId()) ||
- (_nLayerID == rIDDMA.GetHeavenId()) )
- {
- GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( aOldOutlinerBackgrdColor );
- GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aOldEEHoriTextDir );
- }
+ aOldEEHoriTextDir =
+ GetDrawView()->GetModel()->GetDrawOutliner().GetDefaultHorizontalTextDirection();
+ EEHorizontalTextDirection aEEHoriTextDirOfPage =
+ _bIsPageRightToLeft ? EE_HTEXTDIR_R2L : EE_HTEXTDIR_L2R;
+ GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aEEHoriTextDirOfPage );
+ }
- pOutDev->SetDrawMode( nOldDrawMode );
+ pOutDev->Push( PushFlags::LINECOLOR );
+ if (pPrintData)
+ {
+ // hide drawings but not form controls (form controls are handled elsewhere)
+ SdrView &rSdrView = GetPageView()->GetView();
+ rSdrView.setHideDraw( !pPrintData->IsPrintDraw() );
}
+ basegfx::B2IRectangle const pageFrame(
+ vcl::unotools::b2IRectangleFromRectangle(rPageFrame.getFrameArea().SVRect()));
+ GetPageView()->DrawLayer(_nLayerID, pOutDev, pRedirector, aPaintRect.SVRect(), &pageFrame);
+ pOutDev->Pop();
+
+ // reset background color of the outliner & default horiz. text dir.
+ if ( (_nLayerID == rIDDMA.GetHellId()) ||
+ (_nLayerID == rIDDMA.GetHeavenId()) )
+ {
+ GetDrawView()->GetModel()->GetDrawOutliner().SetBackgroundColor( aOldOutlinerBackgrdColor );
+ GetDrawView()->GetModel()->GetDrawOutliner().SetDefaultHorizontalTextDirection( aOldEEHoriTextDir );
+ }
+
+ pOutDev->SetDrawMode( nOldDrawMode );
+
}
#define FUZZY_EDGE 400
diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx
index deffa526c817..a17e2426af8d 100644
--- a/sw/source/filter/html/htmlatr.cxx
+++ b/sw/source/filter/html/htmlatr.cxx
@@ -309,105 +309,106 @@ SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTem
}
}
- if( bTextColl )
+ if( !bTextColl )
+ return;
+
+ if( bOutStyles )
{
- if( bOutStyles )
+ // We have to add hard attributes for any script dependent
+ // item that is not accessed by the style
+ static const sal_uInt16 aWhichIds[3][4] =
{
- // We have to add hard attributes for any script dependent
- // item that is not accessed by the style
- static const sal_uInt16 aWhichIds[3][4] =
- {
- { RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
- RES_CHRATR_POSTURE, RES_CHRATR_WEIGHT },
- { RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE,
- RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT },
- { RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE,
- RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT }
- };
-
- sal_uInt16 nRef = 0;
- sal_uInt16 aSets[2] = {0,0};
- switch( nCSS1Script )
- {
- case CSS1_OUTMODE_WESTERN:
- nRef = 0;
- aSets[0] = 1;
- aSets[1] = 2;
- break;
- case CSS1_OUTMODE_CJK:
- nRef = 1;
- aSets[0] = 0;
- aSets[1] = 2;
- break;
- case CSS1_OUTMODE_CTL:
- nRef = 2;
- aSets[0] = 0;
- aSets[1] = 1;
- break;
- }
- for( int i=0; i<4; ++i )
- {
- const SfxPoolItem& rRef = pFormat->GetFormatAttr( aWhichIds[nRef][i] );
- for(sal_uInt16 nSet : aSets)
- {
- const SfxPoolItem& rSet = pFormat->GetFormatAttr( aWhichIds[nSet][i] );
- if( rSet != rRef )
- {
- if( !pItemSet )
- pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
- pFormat->GetAttrSet().GetRanges() ) );
- pItemSet->Put( rSet );
- }
- }
- }
- }
+ { RES_CHRATR_FONT, RES_CHRATR_FONTSIZE,
+ RES_CHRATR_POSTURE, RES_CHRATR_WEIGHT },
+ { RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE,
+ RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT },
+ { RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE,
+ RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT }
+ };
- // remember all the different default spacings from the style or
- // the comparison style.
- const SvxLRSpaceItem &rLRSpace =
- (pReferenceFormat ? pReferenceFormat : pFormat)->GetLRSpace();
- nLeftMargin = rLRSpace.GetTextLeft();
- nRightMargin = rLRSpace.GetRight();
- nFirstLineIndent = rLRSpace.GetTextFirstLineOfst();
-
- const SvxULSpaceItem &rULSpace =
- (pReferenceFormat ? pReferenceFormat : pFormat)->GetULSpace();
- nTopMargin = rULSpace.GetUpper();
- nBottomMargin = rULSpace.GetLower();
-
- // export language if it differs from the default language
- sal_uInt16 nWhichId =
- SwHTMLWriter::GetLangWhichIdFromScript( nCSS1Script );
- const SvxLanguageItem& rLang =
- static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr( nWhichId ));
- LanguageType eLang = rLang.GetLanguage();
- if( eLang != eDfltLang )
- {
- if( !pItemSet )
- pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
- pFormat->GetAttrSet().GetRanges() ) );
- pItemSet->Put( rLang );
- }
-
- static const sal_uInt16 aWhichIds[3] =
- { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
- RES_CHRATR_CTL_LANGUAGE };
- for(sal_uInt16 i : aWhichIds)
+ sal_uInt16 nRef = 0;
+ sal_uInt16 aSets[2] = {0,0};
+ switch( nCSS1Script )
{
- if( i != nWhichId )
+ case CSS1_OUTMODE_WESTERN:
+ nRef = 0;
+ aSets[0] = 1;
+ aSets[1] = 2;
+ break;
+ case CSS1_OUTMODE_CJK:
+ nRef = 1;
+ aSets[0] = 0;
+ aSets[1] = 2;
+ break;
+ case CSS1_OUTMODE_CTL:
+ nRef = 2;
+ aSets[0] = 0;
+ aSets[1] = 1;
+ break;
+ }
+ for( int i=0; i<4; ++i )
+ {
+ const SfxPoolItem& rRef = pFormat->GetFormatAttr( aWhichIds[nRef][i] );
+ for(sal_uInt16 nSet : aSets)
{
- const SvxLanguageItem& rTmpLang =
- static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr(i));
- if( rTmpLang.GetLanguage() != eLang )
+ const SfxPoolItem& rSet = pFormat->GetFormatAttr( aWhichIds[nSet][i] );
+ if( rSet != rRef )
{
if( !pItemSet )
pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
pFormat->GetAttrSet().GetRanges() ) );
- pItemSet->Put( rTmpLang );
+ pItemSet->Put( rSet );
}
}
}
}
+
+ // remember all the different default spacings from the style or
+ // the comparison style.
+ const SvxLRSpaceItem &rLRSpace =
+ (pReferenceFormat ? pReferenceFormat : pFormat)->GetLRSpace();
+ nLeftMargin = rLRSpace.GetTextLeft();
+ nRightMargin = rLRSpace.GetRight();
+ nFirstLineIndent = rLRSpace.GetTextFirstLineOfst();
+
+ const SvxULSpaceItem &rULSpace =
+ (pReferenceFormat ? pReferenceFormat : pFormat)->GetULSpace();
+ nTopMargin = rULSpace.GetUpper();
+ nBottomMargin = rULSpace.GetLower();
+
+ // export language if it differs from the default language
+ sal_uInt16 nWhichId =
+ SwHTMLWriter::GetLangWhichIdFromScript( nCSS1Script );
+ const SvxLanguageItem& rLang =
+ static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr( nWhichId ));
+ LanguageType eLang = rLang.GetLanguage();
+ if( eLang != eDfltLang )
+ {
+ if( !pItemSet )
+ pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
+ pFormat->GetAttrSet().GetRanges() ) );
+ pItemSet->Put( rLang );
+ }
+
+ static const sal_uInt16 aWhichIds[3] =
+ { RES_CHRATR_LANGUAGE, RES_CHRATR_CJK_LANGUAGE,
+ RES_CHRATR_CTL_LANGUAGE };
+ for(sal_uInt16 i : aWhichIds)
+ {
+ if( i != nWhichId )
+ {
+ const SvxLanguageItem& rTmpLang =
+ static_cast<const SvxLanguageItem&>(pFormat->GetFormatAttr(i));
+ if( rTmpLang.GetLanguage() != eLang )
+ {
+ if( !pItemSet )
+ pItemSet.reset( new SfxItemSet( *pFormat->GetAttrSet().GetPool(),
+ pFormat->GetAttrSet().GetRanges() ) );
+ pItemSet->Put( rTmpLang );
+ }
+ }
+ }
+
}
SwHTMLFormatInfo::~SwHTMLFormatInfo()
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index f53e93fe3ec8..2a5f87f16d67 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -2512,99 +2512,100 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
}
// Finally, we'll do a garbage collection for the top level table
- if( this==m_pTopTable )
+ if( this!=m_pTopTable )
+ return;
+
+ if( 1==m_nRows && m_nHeight && 1==m_pSwTable->GetTabLines().size() )
{
- if( 1==m_nRows && m_nHeight && 1==m_pSwTable->GetTabLines().size() )
- {
- // Set height of a one-row table as the minimum width of the row
- // Was originally a fixed height, but that made problems
- // and is not Netscape 4.0 compliant
- m_nHeight = SwHTMLParser::ToTwips( m_nHeight );
- if( m_nHeight < MINLAY )
- m_nHeight = MINLAY;
-
- (m_pSwTable->GetTabLines())[0]->ClaimFrameFormat();
- (m_pSwTable->GetTabLines())[0]->GetFrameFormat()
- ->SetFormatAttr( SwFormatFrameSize( ATT_MIN_SIZE, 0, m_nHeight ) );
- }
+ // Set height of a one-row table as the minimum width of the row
+ // Was originally a fixed height, but that made problems
+ // and is not Netscape 4.0 compliant
+ m_nHeight = SwHTMLParser::ToTwips( m_nHeight );
+ if( m_nHeight < MINLAY )
+ m_nHeight = MINLAY;
- if( GetBGBrush() )
- m_pSwTable->GetFrameFormat()->SetFormatAttr( *GetBGBrush() );
+ (m_pSwTable->GetTabLines())[0]->ClaimFrameFormat();
+ (m_pSwTable->GetTabLines())[0]->GetFrameFormat()
+ ->SetFormatAttr( SwFormatFrameSize( ATT_MIN_SIZE, 0, m_nHeight ) );
+ }
+
+ if( GetBGBrush() )
+ m_pSwTable->GetFrameFormat()->SetFormatAttr( *GetBGBrush() );
- const_cast<SwTable *>(m_pSwTable)->SetRowsToRepeat( static_cast< sal_uInt16 >(m_nHeadlineRepeat) );
- const_cast<SwTable *>(m_pSwTable)->GCLines();
+ const_cast<SwTable *>(m_pSwTable)->SetRowsToRepeat( static_cast< sal_uInt16 >(m_nHeadlineRepeat) );
+ const_cast<SwTable *>(m_pSwTable)->GCLines();
- bool bIsInFlyFrame = m_pContext && m_pContext->GetFrameFormat();
- if( bIsInFlyFrame && !m_nWidth )
+ bool bIsInFlyFrame = m_pContext && m_pContext->GetFrameFormat();
+ if( bIsInFlyFrame && !m_nWidth )
+ {
+ SvxAdjust eAdjust = GetTableAdjust(false);
+ if (eAdjust != SvxAdjust::Left &&
+ eAdjust != SvxAdjust::Right)
+ {
+ // If a table with a width attribute isn't flowed around left or right
+ // we'll stack it with a border of 100% width, so its size will
+ // be adapted. That text frame mustn't be modified
+ OSL_ENSURE( HasToFly(), "Why is the table in a frame?" );
+ sal_uInt32 nMin = m_pLayoutInfo->GetMin();
+ if( nMin > USHRT_MAX )
+ nMin = USHRT_MAX;
+ SwFormatFrameSize aFlyFrameSize( ATT_VAR_SIZE, (SwTwips)nMin, MINLAY );
+ aFlyFrameSize.SetWidthPercent( 100 );
+ m_pContext->GetFrameFormat()->SetFormatAttr( aFlyFrameSize );
+ bIsInFlyFrame = false;
+ }
+ else
{
- SvxAdjust eAdjust = GetTableAdjust(false);
- if (eAdjust != SvxAdjust::Left &&
- eAdjust != SvxAdjust::Right)
+ // left or right adjusted table without width mustn't be adjusted in width
+ // as they would only shrink but never grow
+ m_pLayoutInfo->SetMustNotRecalc( true );
+ if( m_pContext->GetFrameFormat()->GetAnchor().GetContentAnchor()
+ ->nNode.GetNode().FindTableNode() )
{
- // If a table with a width attribute isn't flowed around left or right
- // we'll stack it with a border of 100% width, so its size will
- // be adapted. That text frame mustn't be modified
- OSL_ENSURE( HasToFly(), "Why is the table in a frame?" );
- sal_uInt32 nMin = m_pLayoutInfo->GetMin();
- if( nMin > USHRT_MAX )
- nMin = USHRT_MAX;
- SwFormatFrameSize aFlyFrameSize( ATT_VAR_SIZE, (SwTwips)nMin, MINLAY );
- aFlyFrameSize.SetWidthPercent( 100 );
+ sal_uInt32 nMax = m_pLayoutInfo->GetMax();
+ if( nMax > USHRT_MAX )
+ nMax = USHRT_MAX;
+ SwFormatFrameSize aFlyFrameSize( ATT_VAR_SIZE, (SwTwips)nMax, MINLAY );
m_pContext->GetFrameFormat()->SetFormatAttr( aFlyFrameSize );
bIsInFlyFrame = false;
}
else
{
- // left or right adjusted table without width mustn't be adjusted in width
- // as they would only shrink but never grow
- m_pLayoutInfo->SetMustNotRecalc( true );
- if( m_pContext->GetFrameFormat()->GetAnchor().GetContentAnchor()
- ->nNode.GetNode().FindTableNode() )
- {
- sal_uInt32 nMax = m_pLayoutInfo->GetMax();
- if( nMax > USHRT_MAX )
- nMax = USHRT_MAX;
- SwFormatFrameSize aFlyFrameSize( ATT_VAR_SIZE, (SwTwips)nMax, MINLAY );
- m_pContext->GetFrameFormat()->SetFormatAttr( aFlyFrameSize );
- bIsInFlyFrame = false;
- }
- else
- {
- m_pLayoutInfo->SetMustNotResize( true );
- }
+ m_pLayoutInfo->SetMustNotResize( true );
}
}
- m_pLayoutInfo->SetMayBeInFlyFrame( bIsInFlyFrame );
+ }
+ m_pLayoutInfo->SetMayBeInFlyFrame( bIsInFlyFrame );
- // Only tables with relative width or without width should be modified
- m_pLayoutInfo->SetMustResize( m_bPrcWidth || !m_nWidth );
+ // Only tables with relative width or without width should be modified
+ m_pLayoutInfo->SetMustResize( m_bPrcWidth || !m_nWidth );
- m_pLayoutInfo->SetWidths();
+ m_pLayoutInfo->SetWidths();
- const_cast<SwTable *>(m_pSwTable)->SetHTMLTableLayout( m_pLayoutInfo );
+ const_cast<SwTable *>(m_pSwTable)->SetHTMLTableLayout( m_pLayoutInfo );
- if( m_pResizeDrawObjects )
+ if( m_pResizeDrawObjects )
+ {
+ sal_uInt16 nCount = m_pResizeDrawObjects->size();
+ for( sal_uInt16 i=0; i<nCount; i++ )
{
- sal_uInt16 nCount = m_pResizeDrawObjects->size();
- for( sal_uInt16 i=0; i<nCount; i++ )
- {
- SdrObject *pObj = (*m_pResizeDrawObjects)[i];
- sal_uInt16 nRow = (*m_pDrawObjectPrcWidths)[3*i];
- sal_uInt16 nCol = (*m_pDrawObjectPrcWidths)[3*i+1];
- sal_uInt8 nPrcWidth = (sal_uInt8)(*m_pDrawObjectPrcWidths)[3*i+2];
+ SdrObject *pObj = (*m_pResizeDrawObjects)[i];
+ sal_uInt16 nRow = (*m_pDrawObjectPrcWidths)[3*i];
+ sal_uInt16 nCol = (*m_pDrawObjectPrcWidths)[3*i+1];
+ sal_uInt8 nPrcWidth = (sal_uInt8)(*m_pDrawObjectPrcWidths)[3*i+2];
- SwHTMLTableLayoutCell *pLayoutCell =
- m_pLayoutInfo->GetCell( nRow, nCol );
- sal_uInt16 nColSpan = pLayoutCell->GetColSpan();
+ SwHTMLTableLayoutCell *pLayoutCell =
+ m_pLayoutInfo->GetCell( nRow, nCol );
+ sal_uInt16 nColSpan = pLayoutCell->GetColSpan();
- sal_uInt16 nWidth2, nDummy;
- m_pLayoutInfo->GetAvail( nCol, nColSpan, nWidth2, nDummy );
- nWidth2 = static_cast< sal_uInt16 >(((long)m_nWidth * nPrcWidth) / 100);
+ sal_uInt16 nWidth2, nDummy;
+ m_pLayoutInfo->GetAvail( nCol, nColSpan, nWidth2, nDummy );
+ nWidth2 = static_cast< sal_uInt16 >(((long)m_nWidth * nPrcWidth) / 100);
- SwHTMLParser::ResizeDrawObject( pObj, nWidth2 );
- }
+ SwHTMLParser::ResizeDrawObject( pObj, nWidth2 );
}
}
+
}
void HTMLTable::SetTable( const SwStartNode *pStNd, HTMLTableContext *pCntxt,
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 98ddfcdc4ee5..6a0f2adec4ee 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -606,95 +606,96 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
OUString& rSdtPrAlias,
bool bPara )
{
- if( nSdtPrToken > 0 || pSdtPrDataBindingAttrs.is() )
- {
- // sdt start mark
- m_pSerializer->mark(Tag_WriteSdtBlock);
-
- m_pSerializer->startElementNS( XML_w, XML_sdt, FSEND );
+ if( nSdtPrToken <= 0 && !pSdtPrDataBindingAttrs.is() )
+ return;
- // output sdt properties
- m_pSerializer->startElementNS( XML_w, XML_sdtPr, FSEND );
+ // sdt start mark
+ m_pSerializer->mark(Tag_WriteSdtBlock);
- if( nSdtPrToken > 0 && pSdtPrTokenChildren.is() )
- {
- if (!pSdtPrTokenAttributes.is())
- m_pSerializer->startElement( nSdtPrToken, FSEND );
- else
- {
- XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get());
- pSdtPrTokenAttributes.clear();
- m_pSerializer->startElement(nSdtPrToken, xAttrList);
- }
+ m_pSerializer->startElementNS( XML_w, XML_sdt, FSEND );
- if (nSdtPrToken == FSNS( XML_w, XML_date ) || nSdtPrToken == FSNS( XML_w, XML_docPartObj ) || nSdtPrToken == FSNS( XML_w, XML_docPartList ) || nSdtPrToken == FSNS( XML_w14, XML_checkbox )) {
- uno::Sequence<xml::FastAttribute> aChildren = pSdtPrTokenChildren->getFastAttributes();
- for( sal_Int32 i=0; i < aChildren.getLength(); ++i )
- m_pSerializer->singleElement( aChildren[i].Token,
- FSNS(XML_w, XML_val),
- OUStringToOString( aChildren[i].Value, RTL_TEXTENCODING_UTF8 ).getStr(),
- FSEND );
- }
+ // output sdt properties
+ m_pSerializer->startElementNS( XML_w, XML_sdtPr, FSEND );
- m_pSerializer->endElement( nSdtPrToken );
- }
- else if( (nSdtPrToken > 0) && nSdtPrToken != FSNS( XML_w, XML_id ) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
+ if( nSdtPrToken > 0 && pSdtPrTokenChildren.is() )
+ {
+ if (!pSdtPrTokenAttributes.is())
+ m_pSerializer->startElement( nSdtPrToken, FSEND );
+ else
{
- if (!pSdtPrTokenAttributes.is())
- m_pSerializer->singleElement( nSdtPrToken, FSEND );
- else
- {
- XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get());
- pSdtPrTokenAttributes.clear();
- m_pSerializer->singleElement(nSdtPrToken, xAttrList);
- }
+ XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get());
+ pSdtPrTokenAttributes.clear();
+ m_pSerializer->startElement(nSdtPrToken, xAttrList);
}
- if( nSdtPrToken == FSNS( XML_w, XML_id ) || ( bPara && m_bParagraphSdtHasId ) )
- //Word won't open a document with an empty id tag, we fill it with a random number
- m_pSerializer->singleElementNS(XML_w, XML_id, FSNS(XML_w, XML_val),
- OString::number(comphelper::rng::uniform_int_distribution(0, std::numeric_limits<int>::max())),
- FSEND);
+ if (nSdtPrToken == FSNS( XML_w, XML_date ) || nSdtPrToken == FSNS( XML_w, XML_docPartObj ) || nSdtPrToken == FSNS( XML_w, XML_docPartList ) || nSdtPrToken == FSNS( XML_w14, XML_checkbox )) {
+ uno::Sequence<xml::FastAttribute> aChildren = pSdtPrTokenChildren->getFastAttributes();
+ for( sal_Int32 i=0; i < aChildren.getLength(); ++i )
+ m_pSerializer->singleElement( aChildren[i].Token,
+ FSNS(XML_w, XML_val),
+ OUStringToOString( aChildren[i].Value, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
+ }
- if( pSdtPrDataBindingAttrs.is() && !m_rExport.SdrExporter().IsParagraphHasDrawing())
+ m_pSerializer->endElement( nSdtPrToken );
+ }
+ else if( (nSdtPrToken > 0) && nSdtPrToken != FSNS( XML_w, XML_id ) && !(m_bRunTextIsOn && m_rExport.SdrExporter().IsParagraphHasDrawing()))
+ {
+ if (!pSdtPrTokenAttributes.is())
+ m_pSerializer->singleElement( nSdtPrToken, FSEND );
+ else
{
- XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.get() );
- pSdtPrDataBindingAttrs.clear();
- m_pSerializer->singleElementNS( XML_w, XML_dataBinding, xAttrList );
+ XFastAttributeListRef xAttrList(pSdtPrTokenAttributes.get());
+ pSdtPrTokenAttributes.clear();
+ m_pSerializer->singleElement(nSdtPrToken, xAttrList);
}
+ }
- if (!rSdtPrAlias.isEmpty())
- m_pSerializer->singleElementNS(XML_w, XML_alias, FSNS(XML_w, XML_val),
- OUStringToOString(rSdtPrAlias, RTL_TEXTENCODING_UTF8).getStr(),
- FSEND);
+ if( nSdtPrToken == FSNS( XML_w, XML_id ) || ( bPara && m_bParagraphSdtHasId ) )
+ //Word won't open a document with an empty id tag, we fill it with a random number
+ m_pSerializer->singleElementNS(XML_w, XML_id, FSNS(XML_w, XML_val),
+ OString::number(comphelper::rng::uniform_int_distribution(0, std::numeric_limits<int>::max())),
+ FSEND);
- m_pSerializer->endElementNS( XML_w, XML_sdtPr );
+ if( pSdtPrDataBindingAttrs.is() && !m_rExport.SdrExporter().IsParagraphHasDrawing())
+ {
+ XFastAttributeListRef xAttrList( pSdtPrDataBindingAttrs.get() );
+ pSdtPrDataBindingAttrs.clear();
+ m_pSerializer->singleElementNS( XML_w, XML_dataBinding, xAttrList );
+ }
- // sdt contents start tag
- m_pSerializer->startElementNS( XML_w, XML_sdtContent, FSEND );
+ if (!rSdtPrAlias.isEmpty())
+ m_pSerializer->singleElementNS(XML_w, XML_alias, FSNS(XML_w, XML_val),
+ OUStringToOString(rSdtPrAlias, RTL_TEXTENCODING_UTF8).getStr(),
+ FSEND);
- // prepend the tags since the sdt start mark before the paragraph
- m_pSerializer->mergeTopMarks(Tag_WriteSdtBlock, sax_fastparser::MergeMarks::PREPEND);
+ m_pSerializer->endElementNS( XML_w, XML_sdtPr );
- // write the ending tags after the paragraph
- if (bPara)
- {
- m_bStartedParaSdt = true;
- if (m_tableReference->m_bTableCellOpen)
- m_tableReference->m_bTableCellParaSdtOpen = true;
- if (m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen())
- m_rExport.SdrExporter().setParagraphSdtOpen(true);
- }
- else
- // Support multiple runs inside a run-level SDT: don't close the SDT block yet.
- m_bStartedCharSdt = true;
+ // sdt contents start tag
+ m_pSerializer->startElementNS( XML_w, XML_sdtContent, FSEND );
- // clear sdt status
- nSdtPrToken = 0;
- pSdtPrTokenChildren.clear();
- pSdtPrDataBindingAttrs.clear();
- rSdtPrAlias.clear();
+ // prepend the tags since the sdt start mark before the paragraph
+ m_pSerializer->mergeTopMarks(Tag_WriteSdtBlock, sax_fastparser::MergeMarks::PREPEND);
+
+ // write the ending tags after the paragraph
+ if (bPara)
+ {
+ m_bStartedParaSdt = true;
+ if (m_tableReference->m_bTableCellOpen)
+ m_tableReference->m_bTableCellParaSdtOpen = true;
+ if (m_rExport.SdrExporter().IsDMLAndVMLDrawingOpen())
+ m_rExport.SdrExporter().setParagraphSdtOpen(true);
}
+ else
+ // Support multiple runs inside a run-level SDT: don't close the SDT block yet.
+ m_bStartedCharSdt = true;
+
+ // clear sdt status
+ nSdtPrToken = 0;
+ pSdtPrTokenChildren.clear();
+ pSdtPrDataBindingAttrs.clear();
+ rSdtPrAlias.clear();
+
}
void DocxAttributeOutput::EndSdtBlock()
@@ -6028,52 +6029,53 @@ void DocxAttributeOutput::SectionPageBorders( const SwFrameFormat* pFormat, cons
const SvxBorderLine* pRight = rBox.GetRight( );
const SvxBorderLine* pBottom = rBox.GetBottom( );
- if ( pBottom || pTop || pLeft || pRight )
+ if ( !(pBottom || pTop || pLeft || pRight) )
+ return;
+
+ bool bExportDistanceFromPageEdge = false;
+ if ( boxHasLineLargerThan31(rBox) )
{
- bool bExportDistanceFromPageEdge = false;
- if ( boxHasLineLargerThan31(rBox) )
- {
- // The distance is larger than '31'. This cannot be exported as 'distance from text'.
- // Instead - it should be exported as 'distance from page edge'.
- // This is based on http://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
- // Specifically 'export case #2'
- bExportDistanceFromPageEdge = true;
- }
+ // The distance is larger than '31'. This cannot be exported as 'distance from text'.
+ // Instead - it should be exported as 'distance from page edge'.
+ // This is based on http://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
+ // Specifically 'export case #2'
+ bExportDistanceFromPageEdge = true;
+ }
- // All distances are relative to the text margins
- m_pSerializer->startElementNS( XML_w, XML_pgBorders,
- FSNS( XML_w, XML_display ), "allPages",
- FSNS( XML_w, XML_offsetFrom ), bExportDistanceFromPageEdge ? "page" : "text",
- FSEND );
+ // All distances are relative to the text margins
+ m_pSerializer->startElementNS( XML_w, XML_pgBorders,
+ FSNS( XML_w, XML_display ), "allPages",
+ FSNS( XML_w, XML_offsetFrom ), bExportDistanceFromPageEdge ? "page" : "text",
+ FSEND );
- OutputBorderOptions aOutputBorderOptions = lcl_getBoxBorderOptions();
+ OutputBorderOptions aOutputBorderOptions = lcl_getBoxBorderOptions();
- // Check if the distance is larger than 31 points
- aOutputBorderOptions.bCheckDistanceSize = true;
+ // Check if the distance is larger than 31 points
+ aOutputBorderOptions.bCheckDistanceSize = true;
- // Check if there is a shadow item
- const SfxPoolItem* pItem = GetExport().HasItem( RES_SHADOW );
- if ( pItem )
- {
- const SvxShadowItem* pShadowItem = static_cast<const SvxShadowItem*>(pItem);
- aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation();
- }
+ // Check if there is a shadow item
+ const SfxPoolItem* pItem = GetExport().HasItem( RES_SHADOW );
+ if ( pItem )
+ {
+ const SvxShadowItem* pShadowItem = static_cast<const SvxShadowItem*>(pItem);
+ aOutputBorderOptions.aShadowLocation = pShadowItem->GetLocation();
+ }
- // By top margin, impl_borders() means the distance between the top of the page and the header frame.
- PageMargins aMargins = m_pageMargins;
- HdFtDistanceGlue aGlue(pFormat->GetAttrSet());
- if (aGlue.HasHeader())
- aMargins.nPageMarginTop = aGlue.dyaHdrTop;
- // Ditto for bottom margin.
- if (aGlue.HasFooter())
- aMargins.nPageMarginBottom = aGlue.dyaHdrBottom;
+ // By top margin, impl_borders() means the distance between the top of the page and the header frame.
+ PageMargins aMargins = m_pageMargins;
+ HdFtDistanceGlue aGlue(pFormat->GetAttrSet());
+ if (aGlue.HasHeader())
+ aMargins.nPageMarginTop = aGlue.dyaHdrTop;
+ // Ditto for bottom margin.
+ if (aGlue.HasFooter())
+ aMargins.nPageMarginBottom = aGlue.dyaHdrBottom;
- std::map<SvxBoxItemLine, css::table::BorderLine2> aEmptyMap; // empty styles map
- impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &aMargins,
- aEmptyMap );
+ std::map<SvxBoxItemLine, css::table::BorderLine2> aEmptyMap; // empty styles map
+ impl_borders( m_pSerializer, rBox, aOutputBorderOptions, &aMargins,
+ aEmptyMap );
+
+ m_pSerializer->endElementNS( XML_w, XML_pgBorders );
- m_pSerializer->endElementNS( XML_w, XML_pgBorders );
- }
}
void DocxAttributeOutput::SectionBiDi( bool bBiDi )
diff --git a/sw/source/filter/ww8/docxsdrexport.cxx b/sw/source/filter/ww8/docxsdrexport.cxx
index 46671e083558..8b33ea440ca9 100644
--- a/sw/source/filter/ww8/docxsdrexport.cxx
+++ b/sw/source/filter/ww8/docxsdrexport.cxx
@@ -986,50 +986,51 @@ void DocxSdrExport::writeDMLEffectLst(const SwFrameFormat& rFrameFormat)
const SvxShadowItem& aShadowItem = rFrameFormat.GetShadow();
// Output effects
- if (aShadowItem.GetLocation() != SvxShadowLocation::NONE)
+ if (aShadowItem.GetLocation() == SvxShadowLocation::NONE)
+ return;
+
+ // Distance is measured diagonally from corner
+ double nShadowDist = sqrt((double)aShadowItem.GetWidth()*aShadowItem.GetWidth()*2.0);
+ OString aShadowDist(OString::number(TwipsToEMU(nShadowDist)));
+ OString aShadowColor = msfilter::util::ConvertColor(aShadowItem.GetColor());
+ OString aShadowAlpha = lcl_ConvertTransparency(aShadowItem.GetColor());
+ sal_uInt32 nShadowDir = 0;
+ switch (aShadowItem.GetLocation())
{
- // Distance is measured diagonally from corner
- double nShadowDist = sqrt((double)aShadowItem.GetWidth()*aShadowItem.GetWidth()*2.0);
- OString aShadowDist(OString::number(TwipsToEMU(nShadowDist)));
- OString aShadowColor = msfilter::util::ConvertColor(aShadowItem.GetColor());
- OString aShadowAlpha = lcl_ConvertTransparency(aShadowItem.GetColor());
- sal_uInt32 nShadowDir = 0;
- switch (aShadowItem.GetLocation())
- {
- case SvxShadowLocation::TopLeft:
- nShadowDir = 13500000;
- break;
- case SvxShadowLocation::TopRight:
- nShadowDir = 18900000;
- break;
- case SvxShadowLocation::BottomLeft:
- nShadowDir = 8100000;
- break;
- case SvxShadowLocation::BottomRight:
- nShadowDir = 2700000;
- break;
- case SvxShadowLocation::NONE:
- case SvxShadowLocation::End:
- break;
- }
- OString aShadowDir(OString::number(nShadowDir));
-
- m_pImpl->m_pSerializer->startElementNS(XML_a, XML_effectLst, FSEND);
- m_pImpl->m_pSerializer->startElementNS(XML_a, XML_outerShdw,
- XML_dist, aShadowDist.getStr(),
- XML_dir, aShadowDir.getStr(), FSEND);
- if (aShadowAlpha.isEmpty())
- m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_srgbClr,
- XML_val, aShadowColor.getStr(), FSEND);
- else
- {
- m_pImpl->m_pSerializer->startElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor.getStr(), FSEND);
- m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_alpha, XML_val, aShadowAlpha.getStr(), FSEND);
- m_pImpl->m_pSerializer->endElementNS(XML_a, XML_srgbClr);
- }
- m_pImpl->m_pSerializer->endElementNS(XML_a, XML_outerShdw);
- m_pImpl->m_pSerializer->endElementNS(XML_a, XML_effectLst);
+ case SvxShadowLocation::TopLeft:
+ nShadowDir = 13500000;
+ break;
+ case SvxShadowLocation::TopRight:
+ nShadowDir = 18900000;
+ break;
+ case SvxShadowLocation::BottomLeft:
+ nShadowDir = 8100000;
+ break;
+ case SvxShadowLocation::BottomRight:
+ nShadowDir = 2700000;
+ break;
+ case SvxShadowLocation::NONE:
+ case SvxShadowLocation::End:
+ break;
}
+ OString aShadowDir(OString::number(nShadowDir));
+
+ m_pImpl->m_pSerializer->startElementNS(XML_a, XML_effectLst, FSEND);
+ m_pImpl->m_pSerializer->startElementNS(XML_a, XML_outerShdw,
+ XML_dist, aShadowDist.getStr(),
+ XML_dir, aShadowDir.getStr(), FSEND);
+ if (aShadowAlpha.isEmpty())
+ m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_srgbClr,
+ XML_val, aShadowColor.getStr(), FSEND);
+ else
+ {
+ m_pImpl->m_pSerializer->startElementNS(XML_a, XML_srgbClr, XML_val, aShadowColor.getStr(), FSEND);
+ m_pImpl->m_pSerializer->singleElementNS(XML_a, XML_alpha, XML_val, aShadowAlpha.getStr(), FSEND);
+ m_pImpl->m_pSerializer->endElementNS(XML_a, XML_srgbClr);
+ }
+ m_pImpl->m_pSerializer->endElementNS(XML_a, XML_outerShdw);
+ m_pImpl->m_pSerializer->endElementNS(XML_a, XML_effectLst);
+
}
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index f0af3cbcb98b..508b60e68d62 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2821,68 +2821,69 @@ void RtfAttributeOutput::ParaNumRule_Impl(const SwTextNode* pTextNd, sal_Int32 n
const SwNumRule* pRule = pTextNd->GetNumRule();
- if (pRule && pTextNd->IsInList())
- {
- SAL_WARN_IF(pTextNd->GetActualListLevel() < 0 || pTextNd->GetActualListLevel() >= MAXLEVEL, "sw.rtf", "text node does not have valid list level");
+ if (!pRule || !pTextNd->IsInList())
+ return;
- const SwNumFormat* pFormat = pRule->GetNumFormat(nLvl);
- if (!pFormat)
- pFormat = &pRule->Get(nLvl);
+ SAL_WARN_IF(pTextNd->GetActualListLevel() < 0 || pTextNd->GetActualListLevel() >= MAXLEVEL, "sw.rtf", "text node does not have valid list level");
- const SfxItemSet& rNdSet = pTextNd->GetSwAttrSet();
+ const SwNumFormat* pFormat = pRule->GetNumFormat(nLvl);
+ if (!pFormat)
+ pFormat = &pRule->Get(nLvl);
- m_aStyles.append('{');
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LISTTEXT);
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PARD);
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PLAIN);
- m_aStyles.append(' ');
+ const SfxItemSet& rNdSet = pTextNd->GetSwAttrSet();
+
+ m_aStyles.append('{');
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LISTTEXT);
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PARD);
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_PLAIN);
+ m_aStyles.append(' ');
+
+ SvxLRSpaceItem aLR(static_cast<const SvxLRSpaceItem&>(rNdSet.Get(RES_LR_SPACE)));
+ aLR.SetTextLeft(aLR.GetTextLeft() + pFormat->GetIndentAt());
+ aLR.SetTextFirstLineOfst(pFormat->GetFirstLineOffset());
- SvxLRSpaceItem aLR(static_cast<const SvxLRSpaceItem&>(rNdSet.Get(RES_LR_SPACE)));
- aLR.SetTextLeft(aLR.GetTextLeft() + pFormat->GetIndentAt());
- aLR.SetTextFirstLineOfst(pFormat->GetFirstLineOffset());
+ sal_uInt16 nStyle = m_rExport.GetId(pFormat->GetCharFormat());
+ OString* pString = m_rExport.GetStyle(nStyle);
+ if (pString)
+ m_aStyles.append(*pString);
- sal_uInt16 nStyle = m_rExport.GetId(pFormat->GetCharFormat());
- OString* pString = m_rExport.GetStyle(nStyle);
- if (pString)
- m_aStyles.append(*pString);
+ {
+ OUString sText;
+ if (SVX_NUM_CHAR_SPECIAL == pFormat->GetNumberingType() || SVX_NUM_BITMAP == pFormat->GetNumberingType())
+ sText = OUString(pFormat->GetBulletChar());
+ else
+ sText = pTextNd->GetNumString();
+ if (!sText.isEmpty())
{
- OUString sText;
- if (SVX_NUM_CHAR_SPECIAL == pFormat->GetNumberingType() || SVX_NUM_BITMAP == pFormat->GetNumberingType())
- sText = OUString(pFormat->GetBulletChar());
- else
- sText = pTextNd->GetNumString();
+ m_aStyles.append(' ');
+ m_aStyles.append(msfilter::rtfutil::OutString(sText, m_rExport.m_eDefaultEncoding));
+ }
+ if (OUTLINE_RULE != pRule->GetRuleType())
+ {
if (!sText.isEmpty())
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB);
+ m_aStyles.append('}');
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ILVL);
+ if (nLvl > 8) // RTF knows only 9 levels
{
- m_aStyles.append(' ');
- m_aStyles.append(msfilter::rtfutil::OutString(sText, m_rExport.m_eDefaultEncoding));
- }
-
- if (OUTLINE_RULE != pRule->GetRuleType())
- {
- if (!sText.isEmpty())
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB);
+ m_aStyles.append((sal_Int32)8);
+ m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SOUTLVL);
+ m_aStyles.append(nLvl);
m_aStyles.append('}');
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_ILVL);
- if (nLvl > 8) // RTF knows only 9 levels
- {
- m_aStyles.append((sal_Int32)8);
- m_aStyles.append("{" OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SOUTLVL);
- m_aStyles.append(nLvl);
- m_aStyles.append('}');
- }
- else
- m_aStyles.append(nLvl);
}
else
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB "}");
- m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LS);
- m_aStyles.append((sal_Int32)m_rExport.GetId(*pRule)+1);
- m_aStyles.append(' ');
+ m_aStyles.append(nLvl);
}
- FormatLRSpace(aLR);
+ else
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_TAB "}");
+ m_aStyles.append(OOO_STRING_SVTOOLS_RTF_LS);
+ m_aStyles.append((sal_Int32)m_rExport.GetId(*pRule)+1);
+ m_aStyles.append(' ');
}
+ FormatLRSpace(aLR);
+
}
void RtfAttributeOutput::ParaScriptSpace(const SfxBoolItem& rScriptSpace)
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 709b0531297b..d4c598fa4ce4 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2961,33 +2961,35 @@ void SwBasicEscherEx::WriteOLEPicture(EscherPropertyContainer &rPropOpt,
void SwEscherEx::WriteOCXControl( const SwFrameFormat& rFormat, sal_uInt32 nShapeId )
{
- if (const SdrObject* pSdrObj = rFormat.FindRealSdrObject())
- {
- OpenContainer( ESCHER_SpContainer );
+ const SdrObject* pSdrObj = rFormat.FindRealSdrObject();
+ if (!pSdrObj)
+ return;
- SwDrawModel *pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel();
- OutputDevice *pDevice = Application::GetDefaultDevice();
- OSL_ENSURE(pModel && pDevice, "no model or device");
+ OpenContainer( ESCHER_SpContainer );
- // #i71538# use complete SdrViews
- // SdrExchangeView aExchange(pModel, pDevice);
- SdrView aExchange(pModel, pDevice);
+ SwDrawModel *pModel = rWrt.m_pDoc->getIDocumentDrawModelAccess().GetDrawModel();
+ OutputDevice *pDevice = Application::GetDefaultDevice();
+ OSL_ENSURE(pModel && pDevice, "no model or device");
- Graphic aGraphic(SdrExchangeView::GetObjGraphic(pModel, pSdrObj));
+ // #i71538# use complete SdrViews
+ // SdrExchangeView aExchange(pModel, pDevice);
+ SdrView aExchange(pModel, pDevice);
- EscherPropertyContainer aPropOpt;
- WriteOLEPicture(aPropOpt,
- ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::OLEShape, aGraphic,
- *pSdrObj, nShapeId, nullptr );
+ Graphic aGraphic(SdrExchangeView::GetObjGraphic(pModel, pSdrObj));
- WriteFlyFrameAttr( rFormat, mso_sptPictureFrame , aPropOpt );
- aPropOpt.Commit( GetStream() );
+ EscherPropertyContainer aPropOpt;
+ WriteOLEPicture(aPropOpt,
+ ShapeFlag::HaveAnchor | ShapeFlag::HaveShapeProperty | ShapeFlag::OLEShape, aGraphic,
+ *pSdrObj, nShapeId, nullptr );
- // store anchor attribute
- WriteFrameExtraData( rFormat );
+ WriteFlyFrameAttr( rFormat, mso_sptPictureFrame , aPropOpt );
+ aPropOpt.Commit( GetStream() );
+
+ // store anchor attribute
+ WriteFrameExtraData( rFormat );
+
+ CloseContainer(); // ESCHER_SpContainer
- CloseContainer(); // ESCHER_SpContainer
- }
}
void SwEscherEx::MakeZOrderArrAndFollowIds(
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index fc9ca941a39d..bc431c4a9cdd 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -1359,44 +1359,45 @@ void WW8TabBandDesc::ReadDef(bool bVer67, const sal_uInt8* pS)
void WW8TabBandDesc::ProcessSprmTSetBRC(int nBrcVer, const sal_uInt8* pParamsTSetBRC)
{
- if( pParamsTSetBRC && pTCs ) // set one or more cell border(s)
- {
- sal_uInt8 nitcFirst= pParamsTSetBRC[0];// first col to be changed
- sal_uInt8 nitcLim = pParamsTSetBRC[1];// (last col to be changed)+1
- sal_uInt8 nFlag = *(pParamsTSetBRC+2);
+ if( !pParamsTSetBRC || !pTCs ) // set one or more cell border(s)
+ return;
- if (nitcFirst >= nWwCols)
- return;
+ sal_uInt8 nitcFirst= pParamsTSetBRC[0];// first col to be changed
+ sal_uInt8 nitcLim = pParamsTSetBRC[1];// (last col to be changed)+1
+ sal_uInt8 nFlag = *(pParamsTSetBRC+2);
- if (nitcLim > nWwCols)
- nitcLim = nWwCols;
+ if (nitcFirst >= nWwCols)
+ return;
- bool bChangeRight = (nFlag & 0x08) != 0;
- bool bChangeBottom = (nFlag & 0x04) != 0;
- bool bChangeLeft = (nFlag & 0x02) != 0;
- bool bChangeTop = (nFlag & 0x01) != 0;
+ if (nitcLim > nWwCols)
+ nitcLim = nWwCols;
- WW8_TCell* pAktTC = pTCs + nitcFirst;
- WW8_BRCVer9 brcVer9;
- if( nBrcVer == 6 )
- brcVer9 = WW8_BRCVer9(WW8_BRC(*reinterpret_cast<WW8_BRCVer6 const *>(pParamsTSetBRC+3)));
- else if( nBrcVer == 8 )
- brcVer9 = WW8_BRCVer9(*reinterpret_cast<WW8_BRC const *>(pParamsTSetBRC+3));
- else
- brcVer9 = *reinterpret_cast<WW8_BRCVer9 const *>(pParamsTSetBRC+3);
+ bool bChangeRight = (nFlag & 0x08) != 0;
+ bool bChangeBottom = (nFlag & 0x04) != 0;
+ bool bChangeLeft = (nFlag & 0x02) != 0;
+ bool bChangeTop = (nFlag & 0x01) != 0;
- for( int i = nitcFirst; i < nitcLim; ++i, ++pAktTC )
- {
- if( bChangeTop )
- pAktTC->rgbrc[ WW8_TOP ] = brcVer9;
- if( bChangeLeft )
- pAktTC->rgbrc[ WW8_LEFT ] = brcVer9;
- if( bChangeBottom )
- pAktTC->rgbrc[ WW8_BOT ] = brcVer9;
- if( bChangeRight )
- pAktTC->rgbrc[ WW8_RIGHT ] = brcVer9;
- }
+ WW8_TCell* pAktTC = pTCs + nitcFirst;
+ WW8_BRCVer9 brcVer9;
+ if( nBrcVer == 6 )
+ brcVer9 = WW8_BRCVer9(WW8_BRC(*reinterpret_cast<WW8_BRCVer6 const *>(pParamsTSetBRC+3)));
+ else if( nBrcVer == 8 )
+ brcVer9 = WW8_BRCVer9(*reinterpret_cast<WW8_BRC const *>(pParamsTSetBRC+3));
+ else
+ brcVer9 = *reinterpret_cast<WW8_BRCVer9 const *>(pParamsTSetBRC+3);
+
+ for( int i = nitcFirst; i < nitcLim; ++i, ++pAktTC )
+ {
+ if( bChangeTop )
+ pAktTC->rgbrc[ WW8_TOP ] = brcVer9;
+ if( bChangeLeft )
+ pAktTC->rgbrc[ WW8_LEFT ] = brcVer9;
+ if( bChangeBottom )
+ pAktTC->rgbrc[ WW8_BOT ] = brcVer9;
+ if( bChangeRight )
+ pAktTC->rgbrc[ WW8_RIGHT ] = brcVer9;
}
+
}
void WW8TabBandDesc::ProcessSprmTTableBorders(int nBrcVer, const sal_uInt8* pParams)
@@ -1443,73 +1444,74 @@ void WW8TabBandDesc::ProcessSprmTDxaCol(const sal_uInt8* pParamsTDxaCol)
void WW8TabBandDesc::ProcessSprmTInsert(const sal_uInt8* pParamsTInsert)
{
- if( nWwCols && pParamsTInsert ) // set one or more cell length(s)
- {
- sal_uInt8 nitcInsert = pParamsTInsert[0]; // position at which to insert
- if (nitcInsert >= MAX_COL) // cannot insert into cell outside max possible index
- return;
- sal_uInt8 nctc = pParamsTInsert[1]; // number of cells
- sal_uInt16 ndxaCol = SVBT16ToShort( pParamsTInsert+2 );
+ if( !nWwCols || !pParamsTInsert ) // set one or more cell length(s)
+ return;
+
+ sal_uInt8 nitcInsert = pParamsTInsert[0]; // position at which to insert
+ if (nitcInsert >= MAX_COL) // cannot insert into cell outside max possible index
+ return;
+ sal_uInt8 nctc = pParamsTInsert[1]; // number of cells
+ sal_uInt16 ndxaCol = SVBT16ToShort( pParamsTInsert+2 );
- short nNewWwCols;
- if (nitcInsert > nWwCols)
+ short nNewWwCols;
+ if (nitcInsert > nWwCols)
+ {
+ nNewWwCols = nitcInsert+nctc;
+ //if new count would be outside max possible count, clip it, and calc a new replacement
+ //legal nctc
+ if (nNewWwCols > MAX_COL)
{
- nNewWwCols = nitcInsert+nctc;
- //if new count would be outside max possible count, clip it, and calc a new replacement
- //legal nctc
- if (nNewWwCols > MAX_COL)
- {
- nNewWwCols = MAX_COL;
- nctc = ::sal::static_int_cast<sal_uInt8>(nNewWwCols-nitcInsert);
- }
+ nNewWwCols = MAX_COL;
+ nctc = ::sal::static_int_cast<sal_uInt8>(nNewWwCols-nitcInsert);
}
- else
+ }
+ else
+ {
+ nNewWwCols = nWwCols+nctc;
+ //if new count would be outside max possible count, clip it, and calc a new replacement
+ //legal nctc
+ if (nNewWwCols > MAX_COL)
{
- nNewWwCols = nWwCols+nctc;
- //if new count would be outside max possible count, clip it, and calc a new replacement
- //legal nctc
- if (nNewWwCols > MAX_COL)
- {
- nNewWwCols = MAX_COL;
- nctc = ::sal::static_int_cast<sal_uInt8>(nNewWwCols-nWwCols);
- }
+ nNewWwCols = MAX_COL;
+ nctc = ::sal::static_int_cast<sal_uInt8>(nNewWwCols-nWwCols);
}
+ }
- WW8_TCell *pTC2s = new WW8_TCell[nNewWwCols];
- setcelldefaults(pTC2s, nNewWwCols);
+ WW8_TCell *pTC2s = new WW8_TCell[nNewWwCols];
+ setcelldefaults(pTC2s, nNewWwCols);
- if (pTCs)
- {
- memcpy( pTC2s, pTCs, nWwCols * sizeof( WW8_TCell ) );
- delete[] pTCs;
- }
- pTCs = pTC2s;
+ if (pTCs)
+ {
+ memcpy( pTC2s, pTCs, nWwCols * sizeof( WW8_TCell ) );
+ delete[] pTCs;
+ }
+ pTCs = pTC2s;
- //If we have to move some cells
- if (nitcInsert <= nWwCols)
+ //If we have to move some cells
+ if (nitcInsert <= nWwCols)
+ {
+ // adjust the left x-position of the dummy at the very end
+ nCenter[nWwCols + nctc] = nCenter[nWwCols]+nctc*ndxaCol;
+ for( int i = nWwCols-1; i >= nitcInsert; i--)
{
- // adjust the left x-position of the dummy at the very end
- nCenter[nWwCols + nctc] = nCenter[nWwCols]+nctc*ndxaCol;
- for( int i = nWwCols-1; i >= nitcInsert; i--)
- {
- // adjust the left x-position
- nCenter[i + nctc] = nCenter[i]+nctc*ndxaCol;
+ // adjust the left x-position
+ nCenter[i + nctc] = nCenter[i]+nctc*ndxaCol;
- // adjust the cell's borders
- pTCs[i + nctc] = pTCs[i];
- }
+ // adjust the cell's borders
+ pTCs[i + nctc] = pTCs[i];
}
+ }
- //if itcMac is larger than full size, fill in missing ones first
- for( int i = nWwCols; i > nitcInsert+nWwCols; i--)
- nCenter[i] = i ? (nCenter[i - 1]+ndxaCol) : 0;
+ //if itcMac is larger than full size, fill in missing ones first
+ for( int i = nWwCols; i > nitcInsert+nWwCols; i--)
+ nCenter[i] = i ? (nCenter[i - 1]+ndxaCol) : 0;
- //now add in our new cells
- for( int j = 0;j < nctc; j++)
- nCenter[j + nitcInsert] = (j + nitcInsert) ? (nCenter[j + nitcInsert -1]+ndxaCol) : 0;
+ //now add in our new cells
+ for( int j = 0;j < nctc; j++)
+ nCenter[j + nitcInsert] = (j + nitcInsert) ? (nCenter[j + nitcInsert -1]+ndxaCol) : 0;
+
+ nWwCols = nNewWwCols;
- nWwCols = nNewWwCols;
- }
}
void WW8TabBandDesc::ProcessDirection(const sal_uInt8* pParams)
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 72db4201932a..4ceee387fe45 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2670,84 +2670,85 @@ void SwWW8ImplReader::Read_SubF_Ruby( WW8ReadFieldParams& rReadParam)
}
//Translate and apply
- if (!sRuby.isEmpty() && !sText.isEmpty() && !sFontName.isEmpty() && nFontSize)
+ if (sRuby.isEmpty() || sText.isEmpty() || sFontName.isEmpty() || !nFontSize)
+ return;
+
+ css::text::RubyAdjust eRubyAdjust;
+ switch (nJustificationCode)
{
- css::text::RubyAdjust eRubyAdjust;
- switch (nJustificationCode)
- {
- case 0:
- eRubyAdjust = css::text::RubyAdjust_CENTER;
- break;
- case 1:
- eRubyAdjust = css::text::RubyAdjust_BLOCK;
- break;
- case 2:
- eRubyAdjust = css::text::RubyAdjust_INDENT_BLOCK;
- break;
- default:
- case 3:
- eRubyAdjust = css::text::RubyAdjust_LEFT;
- break;
- case 4:
- eRubyAdjust = css::text::RubyAdjust_RIGHT;
- break;
- }
+ case 0:
+ eRubyAdjust = css::text::RubyAdjust_CENTER;
+ break;
+ case 1:
+ eRubyAdjust = css::text::RubyAdjust_BLOCK;
+ break;
+ case 2:
+ eRubyAdjust = css::text::RubyAdjust_INDENT_BLOCK;
+ break;
+ default:
+ case 3:
+ eRubyAdjust = css::text::RubyAdjust_LEFT;
+ break;
+ case 4:
+ eRubyAdjust = css::text::RubyAdjust_RIGHT;
+ break;
+ }
- SwFormatRuby aRuby(sRuby);
- const SwCharFormat *pCharFormat=nullptr;
- //Make a guess at which of asian of western we should be setting
- assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
- sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType(sRuby, 0);
-
- //Check to see if we already have a ruby charstyle that this fits
- std::vector<const SwCharFormat*>::const_iterator aEnd =
- m_aRubyCharFormats.end();
- for(std::vector<const SwCharFormat*>::const_iterator aIter
- = m_aRubyCharFormats.begin(); aIter != aEnd; ++aIter)
+ SwFormatRuby aRuby(sRuby);
+ const SwCharFormat *pCharFormat=nullptr;
+ //Make a guess at which of asian of western we should be setting
+ assert(g_pBreakIt && g_pBreakIt->GetBreakIter().is());
+ sal_uInt16 nScript = g_pBreakIt->GetBreakIter()->getScriptType(sRuby, 0);
+
+ //Check to see if we already have a ruby charstyle that this fits
+ std::vector<const SwCharFormat*>::const_iterator aEnd =
+ m_aRubyCharFormats.end();
+ for(std::vector<const SwCharFormat*>::const_iterator aIter
+ = m_aRubyCharFormats.begin(); aIter != aEnd; ++aIter)
+ {
+ const SvxFontHeightItem &rFH =
+ ItemGet<SvxFontHeightItem>(*(*aIter),
+ GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript));
+ if (rFH.GetHeight() == nFontSize*10)
{
- const SvxFontHeightItem &rFH =
- ItemGet<SvxFontHeightItem>(*(*aIter),
- GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript));
- if (rFH.GetHeight() == nFontSize*10)
+ const SvxFontItem &rF = ItemGet<SvxFontItem>(*(*aIter),
+ GetWhichOfScript(RES_CHRATR_FONT,nScript));
+ if (rF.GetFamilyName() == sFontName)
{
- const SvxFontItem &rF = ItemGet<SvxFontItem>(*(*aIter),
- GetWhichOfScript(RES_CHRATR_FONT,nScript));
- if (rF.GetFamilyName() == sFontName)
- {
- pCharFormat=*aIter;
- break;
- }
+ pCharFormat=*aIter;
+ break;
}
}
+ }
- //Create a new char style if necessary
- if (!pCharFormat)
- {
- OUString aNm;
- //Take this as the base name
- SwStyleNameMapper::FillUIName(RES_POOLCHR_RUBYTEXT,aNm);
- aNm+=OUString::number(m_aRubyCharFormats.size()+1);
- SwCharFormat *pFormat = m_rDoc.MakeCharFormat(aNm, m_rDoc.GetDfltCharFormat());
- SvxFontHeightItem aHeightItem(nFontSize*10, 100, RES_CHRATR_FONTSIZE);
- SvxFontItem aFontItem(FAMILY_DONTKNOW,sFontName,
- OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT);
- aHeightItem.SetWhich(GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript));
- aFontItem.SetWhich(GetWhichOfScript(RES_CHRATR_FONT,nScript));
- pFormat->SetFormatAttr(aHeightItem);
- pFormat->SetFormatAttr(aFontItem);
- m_aRubyCharFormats.push_back(pFormat);
- pCharFormat = pFormat;
- }
+ //Create a new char style if necessary
+ if (!pCharFormat)
+ {
+ OUString aNm;
+ //Take this as the base name
+ SwStyleNameMapper::FillUIName(RES_POOLCHR_RUBYTEXT,aNm);
+ aNm+=OUString::number(m_aRubyCharFormats.size()+1);
+ SwCharFormat *pFormat = m_rDoc.MakeCharFormat(aNm, m_rDoc.GetDfltCharFormat());
+ SvxFontHeightItem aHeightItem(nFontSize*10, 100, RES_CHRATR_FONTSIZE);
+ SvxFontItem aFontItem(FAMILY_DONTKNOW,sFontName,
+ OUString(), PITCH_DONTKNOW, RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT);
+ aHeightItem.SetWhich(GetWhichOfScript(RES_CHRATR_FONTSIZE,nScript));
+ aFontItem.SetWhich(GetWhichOfScript(RES_CHRATR_FONT,nScript));
+ pFormat->SetFormatAttr(aHeightItem);
+ pFormat->SetFormatAttr(aFontItem);
+ m_aRubyCharFormats.push_back(pFormat);
+ pCharFormat = pFormat;
+ }
- //Set the charstyle and justification
- aRuby.SetCharFormatName(pCharFormat->GetName());
- aRuby.SetCharFormatId(pCharFormat->GetPoolFormatId());
- aRuby.SetAdjustment(eRubyAdjust);
+ //Set the charstyle and justification
+ aRuby.SetCharFormatName(pCharFormat->GetName());
+ aRuby.SetCharFormatId(pCharFormat->GetPoolFormatId());
+ aRuby.SetAdjustment(eRubyAdjust);
+
+ NewAttr(aRuby);
+ m_rDoc.getIDocumentContentOperations().InsertString( *m_pPaM, sText );
+ m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_TXTATR_CJK_RUBY );
- NewAttr(aRuby);
- m_rDoc.getIDocumentContentOperations().InsertString( *m_pPaM, sText );
- m_xCtrlStck->SetAttr( *m_pPaM->GetPoint(), RES_TXTATR_CJK_RUBY );
- }
}
// "table of ..." fields
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 18ed1cd2ef73..775bc175eaab 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -722,36 +722,37 @@ void SwXMLExport::ExportTableAutoStyles( const SwTableNode& rTableNd )
const SwTable& rTable = rTableNd.GetTable();
const SwFrameFormat *pTableFormat = rTable.GetFrameFormat();
- if( pTableFormat )
- {
- sal_Int16 eTabHoriOri = pTableFormat->GetHoriOrient().GetHoriOrient();
- const SwFormatFrameSize& rFrameSize = pTableFormat->GetFrameSize();
+ if( !pTableFormat )
+ return;
- sal_uInt32 nAbsWidth = rFrameSize.GetSize().Width();
- sal_uInt32 nBaseWidth = 0;
- sal_Int8 nPrcWidth = rFrameSize.GetWidthPercent();
+ sal_Int16 eTabHoriOri = pTableFormat->GetHoriOrient().GetHoriOrient();
+ const SwFormatFrameSize& rFrameSize = pTableFormat->GetFrameSize();
- bool bFixAbsWidth = nPrcWidth != 0 || /*text::*/HoriOrientation::NONE == eTabHoriOri
- || /*text::*/HoriOrientation::FULL == eTabHoriOri;
- if( bFixAbsWidth )
+ sal_uInt32 nAbsWidth = rFrameSize.GetSize().Width();
+ sal_uInt32 nBaseWidth = 0;
+ sal_Int8 nPrcWidth = rFrameSize.GetWidthPercent();
+
+ bool bFixAbsWidth = nPrcWidth != 0 || /*text::*/HoriOrientation::NONE == eTabHoriOri
+ || /*text::*/HoriOrientation::FULL == eTabHoriOri;
+ if( bFixAbsWidth )
+ {
+ nBaseWidth = nAbsWidth;
+ nAbsWidth = pTableFormat->FindLayoutRect(true).Width();
+ if( !nAbsWidth )
{
- nBaseWidth = nAbsWidth;
- nAbsWidth = pTableFormat->FindLayoutRect(true).Width();
- if( !nAbsWidth )
- {
- // TODO?
- }
+ // TODO?
}
- ExportTableFormat( *pTableFormat, nAbsWidth );
-
- SwXMLTableColumnsSortByWidth_Impl aExpCols;
- SwXMLTableFrameFormatsSort_Impl aExpRows;
- SwXMLTableFrameFormatsSort_Impl aExpCells;
- SwXMLTableInfo_Impl aTableInfo( &rTable, XML_NAMESPACE_TABLE );
- ExportTableLinesAutoStyles( rTable.GetTabLines(), nAbsWidth, nBaseWidth,
- pTableFormat->GetName(), aExpCols, aExpRows, aExpCells,
- aTableInfo, true);
}
+ ExportTableFormat( *pTableFormat, nAbsWidth );
+
+ SwXMLTableColumnsSortByWidth_Impl aExpCols;
+ SwXMLTableFrameFormatsSort_Impl aExpRows;
+ SwXMLTableFrameFormatsSort_Impl aExpCells;
+ SwXMLTableInfo_Impl aTableInfo( &rTable, XML_NAMESPACE_TABLE );
+ ExportTableLinesAutoStyles( rTable.GetTabLines(), nAbsWidth, nBaseWidth,
+ pTableFormat->GetName(), aExpCols, aExpRows, aExpCells,
+ aTableInfo, true);
+
}
void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
diff --git a/sw/source/ui/config/optload.cxx b/sw/source/ui/config/optload.cxx
index 1824dc7ab7ac..544aa7e7fe20 100644
--- a/sw/source/ui/config/optload.cxx
+++ b/sw/source/ui/config/optload.cxx
@@ -807,30 +807,31 @@ IMPL_LINK_NOARG(SwCaptionOptPage, SaveEntryHdl, SvTreeListBox*, void)
void SwCaptionOptPage::SaveEntry(SvTreeListEntry const * pEntry)
{
- if (pEntry)
- {
- InsCaptionOpt* pOpt = static_cast<InsCaptionOpt*>(pEntry->GetUserData());
+ if (!pEntry)
+ return;
+
+ InsCaptionOpt* pOpt = static_cast<InsCaptionOpt*>(pEntry->GetUserData());
+
+ pOpt->UseCaption() = m_pCheckLB->IsChecked(m_pCheckLB->GetModel()->GetAbsPos(pEntry));
+ const OUString aName( m_pCategoryBox->GetText() );
+ if (aName == m_sNone)
+ pOpt->SetCategory("");
+ else
+ pOpt->SetCategory(comphelper::string::strip(aName, ' '));
+ pOpt->SetNumType((sal_uInt16)reinterpret_cast<sal_uLong>(m_pFormatBox->GetSelectedEntryData()));
+ pOpt->SetCaption(m_pTextEdit->IsEnabled() ? m_pTextEdit->GetText() : OUString() );
+ pOpt->SetPos(m_pPosBox->GetSelectedEntryPos());
+ sal_Int32 nPos = m_pLbLevel->GetSelectedEntryPos();
+ sal_Int32 nLevel = ( nPos > 0 && nPos != LISTBOX_ENTRY_NOTFOUND ) ? nPos - 1 : MAXLEVEL;
+ pOpt->SetLevel(nLevel);
+ pOpt->SetSeparator(m_pEdDelim->GetText());
+ pOpt->SetNumSeparator( m_pNumberingSeparatorED->GetText());
+ if(!m_pCharStyleLB->GetSelectedEntryPos())
+ pOpt->SetCharacterStyle("");
+ else
+ pOpt->SetCharacterStyle(m_pCharStyleLB->GetSelectedEntry());
+ pOpt->CopyAttributes() = m_pApplyBorderCB->IsChecked();
- pOpt->UseCaption() = m_pCheckLB->IsChecked(m_pCheckLB->GetModel()->GetAbsPos(pEntry));
- const OUString aName( m_pCategoryBox->GetText() );
- if (aName == m_sNone)
- pOpt->SetCategory("");
- else
- pOpt->SetCategory(comphelper::string::strip(aName, ' '));
- pOpt->SetNumType((sal_uInt16)reinterpret_cast<sal_uLong>(m_pFormatBox->GetSelectedEntryData()));
- pOpt->SetCaption(m_pTextEdit->IsEnabled() ? m_pTextEdit->GetText() : OUString() );
- pOpt->SetPos(m_pPosBox->GetSelectedEntryPos());
- sal_Int32 nPos = m_pLbLevel->GetSelectedEntryPos();
- sal_Int32 nLevel = ( nPos > 0 && nPos != LISTBOX_ENTRY_NOTFOUND ) ? nPos - 1 : MAXLEVEL;
- pOpt->SetLevel(nLevel);
- pOpt->SetSeparator(m_pEdDelim->GetText());
- pOpt->SetNumSeparator( m_pNumberingSeparatorED->GetText());
- if(!m_pCharStyleLB->GetSelectedEntryPos())
- pOpt->SetCharacterStyle("");
- else
- pOpt->SetCharacterStyle(m_pCharStyleLB->GetSelectedEntry());
- pOpt->CopyAttributes() = m_pApplyBorderCB->IsChecked();
- }
}
IMPL_LINK_NOARG(SwCaptionOptPage, ModifyHdl, Edit&, void)
diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx
index a603ef992b81..b30f1bc72127 100644
--- a/sw/source/ui/config/optpage.cxx
+++ b/sw/source/ui/config/optpage.cxx
@@ -1356,25 +1356,26 @@ SwShdwCursorOptionsTabPage::SwShdwCursorOptionsTabPage( vcl::Window* pParent,
m_pFillSpaceRB->Check( FILL_SPACE == eMode );
m_pFillTabAndSpaceRB->Check( FILL_TAB_SPACE == eMode );
- if(SfxItemState::SET == rSet.GetItemState(SID_HTML_MODE, false, &pItem )
- && static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON)
- {
- m_pTabCB->Hide();
- m_pCharHiddenCB->Hide();
- m_pFieldHiddenCB->Hide();
- m_pFieldHiddenParaCB->Hide();
+ if(SfxItemState::SET != rSet.GetItemState(SID_HTML_MODE, false, &pItem )
+ || !(static_cast<const SfxUInt16Item*>(pItem)->GetValue() & HTMLMODE_ON))
+ return;
+
+ m_pTabCB->Hide();
+ m_pCharHiddenCB->Hide();
+ m_pFieldHiddenCB->Hide();
+ m_pFieldHiddenParaCB->Hide();
+
+ m_pDirectCursorFrame->Hide();
+ m_pOnOffCB->Hide();
+ m_pFillMarginRB->Hide();
+ m_pFillIndentRB->Hide();
+ m_pFillTabRB->Hide();
+ m_pFillSpaceRB->Hide();
+ m_pFillTabAndSpaceRB->Hide();
+
+ m_pCursorProtFrame->Hide();
+ m_pCursorInProtCB->Hide();
- m_pDirectCursorFrame->Hide();
- m_pOnOffCB->Hide();
- m_pFillMarginRB->Hide();
- m_pFillIndentRB->Hide();
- m_pFillTabRB->Hide();
- m_pFillSpaceRB->Hide();
- m_pFillTabAndSpaceRB->Hide();
-
- m_pCursorProtFrame->Hide();
- m_pCursorInProtCB->Hide();
- }
}
SwShdwCursorOptionsTabPage::~SwShdwCursorOptionsTabPage()
diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx
index e166f4d7d3e7..084819ca76d9 100644
--- a/sw/source/ui/dbui/mmaddressblockpage.cxx
+++ b/sw/source/ui/dbui/mmaddressblockpage.cxx
@@ -1478,72 +1478,73 @@ void AddressMultiLineEdit::MoveCurrentItem(MoveItemFlags nMove)
TextView* pTextView = GetTextView();
const TextSelection& rSelection = pTextView->GetSelection();
const TextCharAttrib* pBeginAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
- if(pBeginAttrib &&
- (pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex()
- && pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ if(!pBeginAttrib ||
+ !(pBeginAttrib->GetStart() <= rSelection.GetStart().GetIndex() &&
+ pBeginAttrib->GetEnd() >= rSelection.GetEnd().GetIndex()))
+ return;
+
+ //current item has been found
+ sal_uInt32 nPara = rSelection.GetStart().GetPara();
+ sal_Int32 nIndex = pBeginAttrib->GetStart();
+ TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
+ const OUString sCurrentItem = pTextEngine->GetText(aEntrySel);
+ pTextEngine->RemoveAttrib( nPara, *pBeginAttrib );
+ pTextEngine->ReplaceText(aEntrySel, OUString());
+ switch(nMove)
{
- //current item has been found
- sal_uInt32 nPara = rSelection.GetStart().GetPara();
- sal_Int32 nIndex = pBeginAttrib->GetStart();
- TextSelection aEntrySel(TextPaM( nPara, pBeginAttrib->GetStart()), TextPaM(nPara, pBeginAttrib->GetEnd()));
- const OUString sCurrentItem = pTextEngine->GetText(aEntrySel);
- pTextEngine->RemoveAttrib( nPara, *pBeginAttrib );
- pTextEngine->ReplaceText(aEntrySel, OUString());
- switch(nMove)
- {
- case MoveItemFlags::Left :
- if(nIndex)
- {
- //go left to find a predecessor or simple text
- --nIndex;
- const OUString sPara = pTextEngine->GetText( nPara );
- sal_Int32 nSearchIndex = sPara.lastIndexOf( '>', nIndex+1 );
- if( nSearchIndex != -1 && nSearchIndex == nIndex )
- {
- nSearchIndex = sPara.lastIndexOf( '<', nIndex );
- if( nSearchIndex != -1 )
- nIndex = nSearchIndex;
- }
- }
- break;
- case MoveItemFlags::Right:
+ case MoveItemFlags::Left :
+ if(nIndex)
{
- //go right to find a successor or simple text
- ++nIndex;
- const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
- if(pEndAttrib && pEndAttrib->GetEnd() >= nIndex)
+ //go left to find a predecessor or simple text
+ --nIndex;
+ const OUString sPara = pTextEngine->GetText( nPara );
+ sal_Int32 nSearchIndex = sPara.lastIndexOf( '>', nIndex+1 );
+ if( nSearchIndex != -1 && nSearchIndex == nIndex )
{
- nIndex = pEndAttrib->GetEnd();
+ nSearchIndex = sPara.lastIndexOf( '<', nIndex );
+ if( nSearchIndex != -1 )
+ nIndex = nSearchIndex;
}
}
- break;
- case MoveItemFlags::Up :
- --nPara;
- nIndex = 0;
- break;
- case MoveItemFlags::Down :
- ++nPara;
- nIndex = 0;
- break;
- default: break;
- }
- //add a new paragraph if there is none yet
- if(nPara >= pTextEngine->GetParagraphCount())
+ break;
+ case MoveItemFlags::Right:
{
-
- TextPaM aTemp(nPara - 1, pTextEngine->GetTextLen( nPara - 1 ));
- pTextEngine->ReplaceText(aTemp, "\n");
+ //go right to find a successor or simple text
+ ++nIndex;
+ const TextCharAttrib* pEndAttrib = pTextEngine->FindCharAttrib( rSelection.GetStart(), TEXTATTR_PROTECTED );
+ if(pEndAttrib && pEndAttrib->GetEnd() >= nIndex)
+ {
+ nIndex = pEndAttrib->GetEnd();
+ }
}
- InsertNewEntryAtPosition( sCurrentItem, nPara, nIndex );
+ break;
+ case MoveItemFlags::Up :
+ --nPara;
+ nIndex = 0;
+ break;
+ case MoveItemFlags::Down :
+ ++nPara;
+ nIndex = 0;
+ break;
+ default: break;
+ }
+ //add a new paragraph if there is none yet
+ if(nPara >= pTextEngine->GetParagraphCount())
+ {
- // select the new entry [#i40817]
- const TextCharAttrib *pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
- if (pAttrib)
- aEntrySel = TextSelection(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
- pTextView->SetSelection(aEntrySel);
- Invalidate();
- Modify();
+ TextPaM aTemp(nPara - 1, pTextEngine->GetTextLen( nPara - 1 ));
+ pTextEngine->ReplaceText(aTemp, "\n");
}
+ InsertNewEntryAtPosition( sCurrentItem, nPara, nIndex );
+
+ // select the new entry [#i40817]
+ const TextCharAttrib *pAttrib = pTextEngine->FindCharAttrib(TextPaM(nPara, nIndex),TEXTATTR_PROTECTED);
+ if (pAttrib)
+ aEntrySel = TextSelection(TextPaM(nPara, nIndex), TextPaM(nPara, pAttrib->GetEnd()));
+ pTextView->SetSelection(aEntrySel);
+ Invalidate();
+ Modify();
+
}
MoveItemFlags AddressMultiLineEdit::IsCurrentItemMoveable()
diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx
index 4ed83ff6dd95..05b354d9eb6d 100644
--- a/sw/source/ui/dbui/mmresultdialogs.cxx
+++ b/sw/source/ui/dbui/mmresultdialogs.cxx
@@ -441,32 +441,33 @@ void SwMMResultEmailDialog::FillInEmailSettings()
}
//fill mail address ListBox
- if (!m_pMailToLB->GetEntryCount())
- {
- //select first column
- uno::Reference< sdbcx::XColumnsSupplier > xColsSupp(xConfigItem->GetResultSet(), uno::UNO_QUERY);
- //get the name of the actual columns
- uno::Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : nullptr;
- uno::Sequence< OUString > aFields;
- if (xColAccess.is())
- aFields = xColAccess->getElementNames();
- const OUString* pFields = aFields.getConstArray();
- for (sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
- m_pMailToLB->InsertEntry(pFields[nField]);
-
- m_pMailToLB->SelectEntryPos(0);
- // then select the right one - may not be available
- const std::vector<std::pair<OUString, int>>& rHeaders = xConfigItem->GetDefaultAddressHeaders();
- OUString sEMailColumn = rHeaders[MM_PART_E_MAIL].first;
- Sequence< OUString> aAssignment = xConfigItem->GetColumnAssignment(xConfigItem->GetCurrentDBData());
- if (aAssignment.getLength() > MM_PART_E_MAIL && !aAssignment[MM_PART_E_MAIL].isEmpty())
- sEMailColumn = aAssignment[MM_PART_E_MAIL];
- m_pMailToLB->SelectEntry(sEMailColumn);
-
- // HTML format pre-selected
- m_pSendAsLB->SelectEntryPos(3);
- SendTypeHdl_Impl(*m_pSendAsLB);
- }
+ if (m_pMailToLB->GetEntryCount())
+ return;
+
+ //select first column
+ uno::Reference< sdbcx::XColumnsSupplier > xColsSupp(xConfigItem->GetResultSet(), uno::UNO_QUERY);
+ //get the name of the actual columns
+ uno::Reference < container::XNameAccess> xColAccess = xColsSupp.is() ? xColsSupp->getColumns() : nullptr;
+ uno::Sequence< OUString > aFields;
+ if (xColAccess.is())
+ aFields = xColAccess->getElementNames();
+ const OUString* pFields = aFields.getConstArray();
+ for (sal_Int32 nField = 0; nField < aFields.getLength(); ++nField)
+ m_pMailToLB->InsertEntry(pFields[nField]);
+
+ m_pMailToLB->SelectEntryPos(0);
+ // then select the right one - may not be available
+ const std::vector<std::pair<OUString, int>>& rHeaders = xConfigItem->GetDefaultAddressHeaders();
+ OUString sEMailColumn = rHeaders[MM_PART_E_MAIL].first;
+ Sequence< OUString> aAssignment = xConfigItem->GetColumnAssignment(xConfigItem->GetCurrentDBData());
+ if (aAssignment.getLength() > MM_PART_E_MAIL && !aAssignment[MM_PART_E_MAIL].isEmpty())
+ sEMailColumn = aAssignment[MM_PART_E_MAIL];
+ m_pMailToLB->SelectEntry(sEMailColumn);
+
+ // HTML format pre-selected
+ m_pSendAsLB->SelectEntryPos(3);
+ SendTypeHdl_Impl(*m_pSendAsLB);
+
}
IMPL_LINK(SwMMResultSaveDialog, DocumentSelectionHdl_Impl, Button*, pButton, void)
diff --git a/sw/source/ui/dbui/selectdbtabledialog.cxx b/sw/source/ui/dbui/selectdbtabledialog.cxx
index e1b5909817ea..45d605773161 100644
--- a/sw/source/ui/dbui/selectdbtabledialog.cxx
+++ b/sw/source/ui/dbui/selectdbtabledialog.cxx
@@ -160,36 +160,37 @@ void SwSelectDBTableDialog::dispose()
IMPL_LINK(SwSelectDBTableDialog, PreviewHdl, Button*, pButton, void)
{
SvTreeListEntry* pEntry = m_pTable->FirstSelected();
- if(pEntry)
- {
- OUString sTableOrQuery = SvTabListBox::GetEntryText(pEntry, 0);
- sal_Int32 nCommandType = nullptr == pEntry->GetUserData() ? 0 : 1;
+ if(!pEntry)
+ return;
- OUString sDataSourceName;
- Reference<XChild> xChild(m_xConnection, UNO_QUERY);
- if(xChild.is())
- {
- Reference<XDataSource> xSource(xChild->getParent(), UNO_QUERY);
- Reference<XPropertySet> xPrSet(xSource, UNO_QUERY);
- xPrSet->getPropertyValue("Name") >>= sDataSourceName;
- }
- OSL_ENSURE(!sDataSourceName.isEmpty(), "no data source found");
- Sequence<PropertyValue> aProperties(5);
- PropertyValue* pProperties = aProperties.getArray();
- pProperties[0].Name = "DataSourceName";
- pProperties[0].Value <<= sDataSourceName;
- pProperties[1].Name = "Command";
- pProperties[1].Value <<= sTableOrQuery;
- pProperties[2].Name = "CommandType";
- pProperties[2].Value <<= nCommandType;
- pProperties[3].Name = "ShowTreeView";
- pProperties[3].Value <<= false;
- pProperties[4].Name = "ShowTreeViewButton";
- pProperties[4].Value <<= false;
-
- VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties);
- pDlg->Execute();
+ OUString sTableOrQuery = SvTabListBox::GetEntryText(pEntry, 0);
+ sal_Int32 nCommandType = nullptr == pEntry->GetUserData() ? 0 : 1;
+
+ OUString sDataSourceName;
+ Reference<XChild> xChild(m_xConnection, UNO_QUERY);
+ if(xChild.is())
+ {
+ Reference<XDataSource> xSource(xChild->getParent(), UNO_QUERY);
+ Reference<XPropertySet> xPrSet(xSource, UNO_QUERY);
+ xPrSet->getPropertyValue("Name") >>= sDataSourceName;
}
+ OSL_ENSURE(!sDataSourceName.isEmpty(), "no data source found");
+ Sequence<PropertyValue> aProperties(5);
+ PropertyValue* pProperties = aProperties.getArray();
+ pProperties[0].Name = "DataSourceName";
+ pProperties[0].Value <<= sDataSourceName;
+ pProperties[1].Name = "Command";
+ pProperties[1].Value <<= sTableOrQuery;
+ pProperties[2].Name = "CommandType";
+ pProperties[2].Value <<= nCommandType;
+ pProperties[3].Name = "ShowTreeView";
+ pProperties[3].Value <<= false;
+ pProperties[4].Name = "ShowTreeViewButton";
+ pProperties[4].Value <<= false;
+
+ VclPtrInstance< SwDBTablePreviewDialog > pDlg(pButton, aProperties);
+ pDlg->Execute();
+
}
OUString SwSelectDBTableDialog::GetSelectedTable(bool& bIsTable)
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 7dd6c49a4495..78bf7c681bd5 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -739,24 +739,25 @@ IMPL_LINK( SwEditRegionDlg, GetFirstEntryHdl, SvTreeListBox *, pBox, void )
IMPL_LINK( SwEditRegionDlg, DeselectHdl, SvTreeListBox *, pBox, void )
{
- if( !pBox->GetSelectionCount() )
- {
- m_pHideCB->Enable(false);
- m_pProtectCB->Enable(false);
- // edit in readonly sections
- m_pEditInReadonlyCB->Enable(false);
+ if( pBox->GetSelectionCount() )
+ return;
- m_pPasswdCB->Enable(false);
- m_pConditionFT->Enable(false);
- m_pConditionED->Enable(false);
- m_pFileCB->Enable(false);
- m_pDDEFrame->Enable(false);
- m_pDDECB->Enable(false);
- m_pCurName->Enable(false);
+ m_pHideCB->Enable(false);
+ m_pProtectCB->Enable(false);
+ // edit in readonly sections
+ m_pEditInReadonlyCB->Enable(false);
+
+ m_pPasswdCB->Enable(false);
+ m_pConditionFT->Enable(false);
+ m_pConditionED->Enable(false);
+ m_pFileCB->Enable(false);
+ m_pDDEFrame->Enable(false);
+ m_pDDECB->Enable(false);
+ m_pCurName->Enable(false);
+
+ UseFileHdl(m_pFileCB);
+ DDEHdl(m_pDDECB);
- UseFileHdl(m_pFileCB);
- DDEHdl(m_pDDECB);
- }
}
// in OkHdl the modified settings are being applied and reversed regions are deleted
@@ -948,26 +949,27 @@ IMPL_LINK_NOARG(SwEditRegionDlg, ChangeDismissHdl, Button*, void)
m_pTree->GetModel()->Remove( pRemove );
}
- if ( m_pTree->FirstSelected() == nullptr )
- {
- m_pConditionFT->Enable(false);
- m_pConditionED->Enable(false);
- m_pDismiss-> Enable(false);
- m_pCurName->Enable(false);
- m_pProtectCB->Enable(false);
- m_pPasswdCB->Enable(false);
- m_pHideCB->Enable(false);
- // edit in readonly sections
- m_pEditInReadonlyCB->Enable(false);
- m_pEditInReadonlyCB->SetState(TRISTATE_FALSE);
- m_pProtectCB->SetState(TRISTATE_FALSE);
- m_pPasswdCB->Check(false);
- m_pHideCB->SetState(TRISTATE_FALSE);
- m_pFileCB->Check(false);
- // otherwise the focus would be on HelpButton
- m_pOK->GrabFocus();
- UseFileHdl(m_pFileCB);
- }
+ if ( m_pTree->FirstSelected() )
+ return;
+
+ m_pConditionFT->Enable(false);
+ m_pConditionED->Enable(false);
+ m_pDismiss-> Enable(false);
+ m_pCurName->Enable(false);
+ m_pProtectCB->Enable(false);
+ m_pPasswdCB->Enable(false);
+ m_pHideCB->Enable(false);
+ // edit in readonly sections
+ m_pEditInReadonlyCB->Enable(false);
+ m_pEditInReadonlyCB->SetState(TRISTATE_FALSE);
+ m_pProtectCB->SetState(TRISTATE_FALSE);
+ m_pPasswdCB->Check(false);
+ m_pHideCB->SetState(TRISTATE_FALSE);
+ m_pFileCB->Check(false);
+ // otherwise the focus would be on HelpButton
+ m_pOK->GrabFocus();
+ UseFileHdl(m_pFileCB);
+
}
// link CheckBox to file?
@@ -1043,96 +1045,97 @@ IMPL_LINK_NOARG(SwEditRegionDlg, OptionsHdl, Button*, void)
return;
SvTreeListEntry* pEntry = m_pTree->FirstSelected();
- if(pEntry)
+ if(!pEntry)
+ return;
+
+ SectRepr* pSectRepr = static_cast<SectRepr*>(pEntry->GetUserData());
+ SfxItemSet aSet(
+ rSh.GetView().GetPool(),
+ svl::Items<
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_LR_SPACE, RES_LR_SPACE,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_COL, RES_COL,
+ RES_FTN_AT_TXTEND, RES_FRAMEDIR,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE>{});
+
+ aSet.Put( pSectRepr->GetCol() );
+ aSet.Put( pSectRepr->GetBackground() );
+ aSet.Put( pSectRepr->GetFootnoteNtAtEnd() );
+ aSet.Put( pSectRepr->GetEndNtAtEnd() );
+ aSet.Put( pSectRepr->GetBalance() );
+ aSet.Put( pSectRepr->GetFrameDir() );
+ aSet.Put( pSectRepr->GetLRSpace() );
+
+ const SwSectionFormats& rDocFormats = rSh.GetDoc()->GetSections();
+ SwSectionFormats aOrigArray(rDocFormats);
+
+ SwSectionFormat* pFormat = aOrigArray[pSectRepr->GetArrPos()];
+ long nWidth = rSh.GetSectionWidth(*pFormat);
+ aOrigArray.clear();
+ if (!nWidth)
+ nWidth = USHRT_MAX;
+
+ aSet.Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth));
+ aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
+
+ ScopedVclPtrInstance< SwSectionPropertyTabDialog > aTabDlg(this, aSet, rSh);
+ if(RET_OK == aTabDlg->Execute())
{
- SectRepr* pSectRepr = static_cast<SectRepr*>(pEntry->GetUserData());
- SfxItemSet aSet(
- rSh.GetView().GetPool(),
- svl::Items<
- RES_FRM_SIZE, RES_FRM_SIZE,
- RES_LR_SPACE, RES_LR_SPACE,
- RES_BACKGROUND, RES_BACKGROUND,
- RES_COL, RES_COL,
- RES_FTN_AT_TXTEND, RES_FRAMEDIR,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE>{});
-
- aSet.Put( pSectRepr->GetCol() );
- aSet.Put( pSectRepr->GetBackground() );
- aSet.Put( pSectRepr->GetFootnoteNtAtEnd() );
- aSet.Put( pSectRepr->GetEndNtAtEnd() );
- aSet.Put( pSectRepr->GetBalance() );
- aSet.Put( pSectRepr->GetFrameDir() );
- aSet.Put( pSectRepr->GetLRSpace() );
-
- const SwSectionFormats& rDocFormats = rSh.GetDoc()->GetSections();
- SwSectionFormats aOrigArray(rDocFormats);
-
- SwSectionFormat* pFormat = aOrigArray[pSectRepr->GetArrPos()];
- long nWidth = rSh.GetSectionWidth(*pFormat);
- aOrigArray.clear();
- if (!nWidth)
- nWidth = USHRT_MAX;
-
- aSet.Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth));
- aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
-
- ScopedVclPtrInstance< SwSectionPropertyTabDialog > aTabDlg(this, aSet, rSh);
- if(RET_OK == aTabDlg->Execute())
+ const SfxItemSet* pOutSet = aTabDlg->GetOutputItemSet();
+ if( pOutSet && pOutSet->Count() )
{
- const SfxItemSet* pOutSet = aTabDlg->GetOutputItemSet();
- if( pOutSet && pOutSet->Count() )
+ const SfxPoolItem *pColItem, *pBrushItem,
+ *pFootnoteItem, *pEndItem, *pBalanceItem,
+ *pFrameDirItem, *pLRSpaceItem;
+ SfxItemState eColState = pOutSet->GetItemState(
+ RES_COL, false, &pColItem );
+ SfxItemState eBrushState = pOutSet->GetItemState(
+ RES_BACKGROUND, false, &pBrushItem );
+ SfxItemState eFootnoteState = pOutSet->GetItemState(
+ RES_FTN_AT_TXTEND, false, &pFootnoteItem );
+ SfxItemState eEndState = pOutSet->GetItemState(
+ RES_END_AT_TXTEND, false, &pEndItem );
+ SfxItemState eBalanceState = pOutSet->GetItemState(
+ RES_COLUMNBALANCE, false, &pBalanceItem );
+ SfxItemState eFrameDirState = pOutSet->GetItemState(
+ RES_FRAMEDIR, false, &pFrameDirItem );
+ SfxItemState eLRState = pOutSet->GetItemState(
+ RES_LR_SPACE, false, &pLRSpaceItem);
+
+ if( SfxItemState::SET == eColState ||
+ SfxItemState::SET == eBrushState ||
+ SfxItemState::SET == eFootnoteState ||
+ SfxItemState::SET == eEndState ||
+ SfxItemState::SET == eBalanceState||
+ SfxItemState::SET == eFrameDirState||
+ SfxItemState::SET == eLRState)
{
- const SfxPoolItem *pColItem, *pBrushItem,
- *pFootnoteItem, *pEndItem, *pBalanceItem,
- *pFrameDirItem, *pLRSpaceItem;
- SfxItemState eColState = pOutSet->GetItemState(
- RES_COL, false, &pColItem );
- SfxItemState eBrushState = pOutSet->GetItemState(
- RES_BACKGROUND, false, &pBrushItem );
- SfxItemState eFootnoteState = pOutSet->GetItemState(
- RES_FTN_AT_TXTEND, false, &pFootnoteItem );
- SfxItemState eEndState = pOutSet->GetItemState(
- RES_END_AT_TXTEND, false, &pEndItem );
- SfxItemState eBalanceState = pOutSet->GetItemState(
- RES_COLUMNBALANCE, false, &pBalanceItem );
- SfxItemState eFrameDirState = pOutSet->GetItemState(
- RES_FRAMEDIR, false, &pFrameDirItem );
- SfxItemState eLRState = pOutSet->GetItemState(
- RES_LR_SPACE, false, &pLRSpaceItem);
-
- if( SfxItemState::SET == eColState ||
- SfxItemState::SET == eBrushState ||
- SfxItemState::SET == eFootnoteState ||
- SfxItemState::SET == eEndState ||
- SfxItemState::SET == eBalanceState||
- SfxItemState::SET == eFrameDirState||
- SfxItemState::SET == eLRState)
+ SvTreeListEntry* pSelEntry = m_pTree->FirstSelected();
+ while( pSelEntry )
{
- SvTreeListEntry* pSelEntry = m_pTree->FirstSelected();
- while( pSelEntry )
- {
- SectRepr* pRepr = static_cast<SectRepr*>(pSelEntry->GetUserData());
- if( SfxItemState::SET == eColState )
- pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
- if( SfxItemState::SET == eBrushState )
- pRepr->GetBackground() = *static_cast<const SvxBrushItem*>(pBrushItem);
- if( SfxItemState::SET == eFootnoteState )
- pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
- if( SfxItemState::SET == eEndState )
- pRepr->GetEndNtAtEnd() = *static_cast<const SwFormatEndAtTextEnd*>(pEndItem);
- if( SfxItemState::SET == eBalanceState )
- pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
- if( SfxItemState::SET == eFrameDirState )
- pRepr->GetFrameDir().SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
- if( SfxItemState::SET == eLRState )
- pRepr->GetLRSpace() = *static_cast<const SvxLRSpaceItem*>(pLRSpaceItem);
-
- pSelEntry = m_pTree->NextSelected(pSelEntry);
- }
+ SectRepr* pRepr = static_cast<SectRepr*>(pSelEntry->GetUserData());
+ if( SfxItemState::SET == eColState )
+ pRepr->GetCol() = *static_cast<const SwFormatCol*>(pColItem);
+ if( SfxItemState::SET == eBrushState )
+ pRepr->GetBackground() = *static_cast<const SvxBrushItem*>(pBrushItem);
+ if( SfxItemState::SET == eFootnoteState )
+ pRepr->GetFootnoteNtAtEnd() = *static_cast<const SwFormatFootnoteAtTextEnd*>(pFootnoteItem);
+ if( SfxItemState::SET == eEndState )
+ pRepr->GetEndNtAtEnd() = *static_cast<const SwFormatEndAtTextEnd*>(pEndItem);
+ if( SfxItemState::SET == eBalanceState )
+ pRepr->GetBalance().SetValue(static_cast<const SwFormatNoBalancedColumns*>(pBalanceItem)->GetValue());
+ if( SfxItemState::SET == eFrameDirState )
+ pRepr->GetFrameDir().SetValue(static_cast<const SvxFrameDirectionItem*>(pFrameDirItem)->GetValue());
+ if( SfxItemState::SET == eLRState )
+ pRepr->GetLRSpace() = *static_cast<const SvxLRSpaceItem*>(pLRSpaceItem);
+
+ pSelEntry = m_pTree->NextSelected(pSelEntry);
}
}
}
}
+
}
// Applying of the filename or the linked region
diff --git a/sw/source/ui/envelp/labfmt.cxx b/sw/source/ui/envelp/labfmt.cxx
index b31bec047365..c60a46320ab9 100644
--- a/sw/source/ui/envelp/labfmt.cxx
+++ b/sw/source/ui/envelp/labfmt.cxx
@@ -500,22 +500,23 @@ DeactivateRC SwLabFormatPage::DeactivatePage(SfxItemSet* _pSet)
void SwLabFormatPage::FillItem(SwLabItem& rItem)
{
- if (bModified)
- {
- rItem.m_aMake = rItem.m_aType = SwResId(STR_CUSTOM_LABEL);
-
- SwLabRec& rRec = *GetParentSwLabDlg()->Recs()[0];
- rItem.m_lHDist = rRec.m_nHDist = static_cast< long >(GETFLDVAL(*m_pHDistField ));
- rItem.m_lVDist = rRec.m_nVDist = static_cast< long >(GETFLDVAL(*m_pVDistField ));
- rItem.m_lWidth = rRec.m_nWidth = static_cast< long >(GETFLDVAL(*m_pWidthField ));
- rItem.m_lHeight = rRec.m_nHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
- rItem.m_lLeft = rRec.m_nLeft = static_cast< long >(GETFLDVAL(*m_pLeftField ));
- rItem.m_lUpper = rRec.m_nUpper = static_cast< long >(GETFLDVAL(*m_pUpperField ));
- rItem.m_nCols = rRec.m_nCols = static_cast< sal_Int32 >(m_pColsField->GetValue());
- rItem.m_nRows = rRec.m_nRows = static_cast< sal_Int32 >(m_pRowsField->GetValue());
- rItem.m_lPWidth = rRec.m_nPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
- rItem.m_lPHeight = rRec.m_nPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
- }
+ if (!bModified)
+ return;
+
+ rItem.m_aMake = rItem.m_aType = SwResId(STR_CUSTOM_LABEL);
+
+ SwLabRec& rRec = *GetParentSwLabDlg()->Recs()[0];
+ rItem.m_lHDist = rRec.m_nHDist = static_cast< long >(GETFLDVAL(*m_pHDistField ));
+ rItem.m_lVDist = rRec.m_nVDist = static_cast< long >(GETFLDVAL(*m_pVDistField ));
+ rItem.m_lWidth = rRec.m_nWidth = static_cast< long >(GETFLDVAL(*m_pWidthField ));
+ rItem.m_lHeight = rRec.m_nHeight = static_cast< long >(GETFLDVAL(*m_pHeightField));
+ rItem.m_lLeft = rRec.m_nLeft = static_cast< long >(GETFLDVAL(*m_pLeftField ));
+ rItem.m_lUpper = rRec.m_nUpper = static_cast< long >(GETFLDVAL(*m_pUpperField ));
+ rItem.m_nCols = rRec.m_nCols = static_cast< sal_Int32 >(m_pColsField->GetValue());
+ rItem.m_nRows = rRec.m_nRows = static_cast< sal_Int32 >(m_pRowsField->GetValue());
+ rItem.m_lPWidth = rRec.m_nPWidth = static_cast< long >(GETFLDVAL(*m_pPWidthField ));
+ rItem.m_lPHeight = rRec.m_nPHeight = static_cast< long >(GETFLDVAL(*m_pPHeightField));
+
}
bool SwLabFormatPage::FillItemSet(SfxItemSet* rSet)
diff --git a/sw/source/ui/fldui/flddb.cxx b/sw/source/ui/fldui/flddb.cxx
index 0d2f547c7b72..cb2763b475a6 100644
--- a/sw/source/ui/fldui/flddb.cxx
+++ b/sw/source/ui/fldui/flddb.cxx
@@ -293,110 +293,111 @@ void SwFieldDBPage::TypeHdl( ListBox const * pBox )
m_pTypeLB->SelectEntryPos(0);
}
- if (nOld != GetTypeSel())
- {
- SwWrtShell *pSh = GetWrtShell();
- if(!pSh)
- pSh = ::GetActiveWrtShell();
- bool bCond = false, bSetNo = false, bFormat = false, bDBFormat = false;
- const sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
+ if (nOld == GetTypeSel())
+ return;
+
+ SwWrtShell *pSh = GetWrtShell();
+ if(!pSh)
+ pSh = ::GetActiveWrtShell();
+ bool bCond = false, bSetNo = false, bFormat = false, bDBFormat = false;
+ const sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
- m_pDatabaseTLB->ShowColumns(nTypeId == TYP_DBFLD);
+ m_pDatabaseTLB->ShowColumns(nTypeId == TYP_DBFLD);
- if (IsFieldEdit())
+ if (IsFieldEdit())
+ {
+ SwDBData aData;
+ OUString sColumnName;
+ if (nTypeId == TYP_DBFLD)
+ {
+ aData = static_cast<SwDBField*>(GetCurField())->GetDBData();
+ sColumnName = static_cast<SwDBFieldType*>(GetCurField()->GetTyp())->GetColumnName();
+ }
+ else
{
- SwDBData aData;
- OUString sColumnName;
- if (nTypeId == TYP_DBFLD)
+ aData = static_cast<SwDBNameInfField*>(GetCurField())->GetDBData(pSh->GetDoc());
+ }
+ m_pDatabaseTLB->Select(aData.sDataSource, aData.sCommand, sColumnName);
+ }
+
+ switch (nTypeId)
+ {
+ case TYP_DBFLD:
+ bFormat = true;
+ bDBFormat = true;
+ m_pNumFormatLB->Show();
+ m_pFormatLB->Hide();
+
+ if (pBox) // type was changed by user
+ m_pDBFormatRB->Check();
+
+ if (IsFieldEdit())
{
- aData = static_cast<SwDBField*>(GetCurField())->GetDBData();
- sColumnName = static_cast<SwDBFieldType*>(GetCurField()->GetTyp())->GetColumnName();
+ if (GetCurField()->GetFormat() != 0 && GetCurField()->GetFormat() != SAL_MAX_UINT32)
+ m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+
+ if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_OWN_FMT)
+ m_pNewFormatRB->Check();
+ else
+ m_pDBFormatRB->Check();
}
- else
+ break;
+
+ case TYP_DBNUMSETFLD:
+ bSetNo = true;
+ SAL_FALLTHROUGH;
+ case TYP_DBNEXTSETFLD:
+ bCond = true;
+ if (IsFieldEdit())
{
- aData = static_cast<SwDBNameInfField*>(GetCurField())->GetDBData(pSh->GetDoc());
+ m_pConditionED->SetText(GetCurField()->GetPar1());
+ m_pValueED->SetText(GetCurField()->GetPar2());
}
- m_pDatabaseTLB->Select(aData.sDataSource, aData.sCommand, sColumnName);
- }
+ break;
- switch (nTypeId)
- {
- case TYP_DBFLD:
- bFormat = true;
- bDBFormat = true;
- m_pNumFormatLB->Show();
- m_pFormatLB->Hide();
+ case TYP_DBNAMEFLD:
+ break;
- if (pBox) // type was changed by user
- m_pDBFormatRB->Check();
+ case TYP_DBSETNUMBERFLD:
+ bFormat = true;
+ m_pNewFormatRB->Check();
+ m_pNumFormatLB->Hide();
+ m_pFormatLB->Show();
+ if( IsFieldEdit() )
+ {
+ for( sal_Int32 nI = m_pFormatLB->GetEntryCount(); nI; )
+ if( GetCurField()->GetFormat() == reinterpret_cast<sal_uLong>(
+ m_pFormatLB->GetEntryData( --nI )))
+ {
+ m_pFormatLB->SelectEntryPos( nI );
+ break;
+ }
+ }
+ break;
+ }
- if (IsFieldEdit())
- {
- if (GetCurField()->GetFormat() != 0 && GetCurField()->GetFormat() != SAL_MAX_UINT32)
- m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
-
- if (GetCurField()->GetSubType() & nsSwExtendedSubType::SUB_OWN_FMT)
- m_pNewFormatRB->Check();
- else
- m_pDBFormatRB->Check();
- }
- break;
-
- case TYP_DBNUMSETFLD:
- bSetNo = true;
- SAL_FALLTHROUGH;
- case TYP_DBNEXTSETFLD:
- bCond = true;
- if (IsFieldEdit())
- {
- m_pConditionED->SetText(GetCurField()->GetPar1());
- m_pValueED->SetText(GetCurField()->GetPar2());
- }
- break;
-
- case TYP_DBNAMEFLD:
- break;
-
- case TYP_DBSETNUMBERFLD:
- bFormat = true;
- m_pNewFormatRB->Check();
- m_pNumFormatLB->Hide();
- m_pFormatLB->Show();
- if( IsFieldEdit() )
- {
- for( sal_Int32 nI = m_pFormatLB->GetEntryCount(); nI; )
- if( GetCurField()->GetFormat() == reinterpret_cast<sal_uLong>(
- m_pFormatLB->GetEntryData( --nI )))
- {
- m_pFormatLB->SelectEntryPos( nI );
- break;
- }
- }
- break;
- }
+ m_pCondition->Enable(bCond);
+ m_pValue->Enable(bSetNo);
+ if (nTypeId != TYP_DBFLD)
+ {
+ m_pDBFormatRB->Enable(bDBFormat);
+ m_pNewFormatRB->Enable(bDBFormat || bFormat);
+ m_pNumFormatLB->Enable(bDBFormat);
+ m_pFormatLB->Enable(bFormat);
+ }
+ m_pFormat->Enable(bDBFormat || bFormat);
- m_pCondition->Enable(bCond);
- m_pValue->Enable(bSetNo);
- if (nTypeId != TYP_DBFLD)
- {
- m_pDBFormatRB->Enable(bDBFormat);
- m_pNewFormatRB->Enable(bDBFormat || bFormat);
- m_pNumFormatLB->Enable(bDBFormat);
- m_pFormatLB->Enable(bFormat);
- }
- m_pFormat->Enable(bDBFormat || bFormat);
+ if (!IsFieldEdit())
+ {
+ m_pValueED->SetText(aEmptyOUStr);
+ if (bCond)
+ m_pConditionED->SetText("TRUE");
+ else
+ m_pConditionED->SetText(aEmptyOUStr);
+ }
- if (!IsFieldEdit())
- {
- m_pValueED->SetText(aEmptyOUStr);
- if (bCond)
- m_pConditionED->SetText("TRUE");
- else
- m_pConditionED->SetText(aEmptyOUStr);
- }
+ CheckInsert();
- CheckInsert();
- }
}
IMPL_LINK( SwFieldDBPage, NumSelectHdl, ListBox&, rLB, void )
diff --git a/sw/source/ui/fldui/flddok.cxx b/sw/source/ui/fldui/flddok.cxx
index 5709f6058389..d41cb9ee5b48 100644
--- a/sw/source/ui/fldui/flddok.cxx
+++ b/sw/source/ui/fldui/flddok.cxx
@@ -217,237 +217,238 @@ IMPL_LINK_NOARG(SwFieldDokPage, TypeHdl, ListBox&, void)
m_pTypeLB->SelectEntryPos(0);
}
- if (nOld != GetTypeSel())
- {
- size_t nCount;
+ if (nOld == GetTypeSel())
+ return;
- m_pDateFT->Hide();
- m_pTimeFT->Hide();
+ size_t nCount;
- sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
+ m_pDateFT->Hide();
+ m_pTimeFT->Hide();
- // fill Selection-Listbox
- m_pSelectionLB->Clear();
+ sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
- if (nTypeId != USHRT_MAX)
- {
- std::vector<OUString> aLst;
- GetFieldMgr().GetSubTypes(nTypeId, aLst);
+ // fill Selection-Listbox
+ m_pSelectionLB->Clear();
- if (nTypeId != TYP_AUTHORFLD)
- nCount = aLst.size();
- else
- nCount = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
+ if (nTypeId != USHRT_MAX)
+ {
+ std::vector<OUString> aLst;
+ GetFieldMgr().GetSubTypes(nTypeId, aLst);
+
+ if (nTypeId != TYP_AUTHORFLD)
+ nCount = aLst.size();
+ else
+ nCount = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
- size_t nPos;
+ size_t nPos;
- for(size_t i = 0; i < nCount; ++i)
+ for(size_t i = 0; i < nCount; ++i)
+ {
+ if (!IsFieldEdit())
+ {
+ if (nTypeId != TYP_AUTHORFLD)
+ nPos = m_pSelectionLB->InsertEntry(aLst[i]);
+ else
+ nPos = m_pSelectionLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
+
+ m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+ }
+ else
{
- if (!IsFieldEdit())
+ bool bInsert = false;
+
+ switch (nTypeId)
{
- if (nTypeId != TYP_AUTHORFLD)
+ case TYP_DATEFLD:
+ case TYP_TIMEFLD:
nPos = m_pSelectionLB->InsertEntry(aLst[i]);
- else
- nPos = m_pSelectionLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
+ m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && !i)
+ m_pSelectionLB->SelectEntryPos(nPos);
+ if (!static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && i)
+ m_pSelectionLB->SelectEntryPos(nPos);
+ break;
- m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
- }
- else
- {
- bool bInsert = false;
+ case TYP_EXTUSERFLD:
+ case TYP_DOCSTATFLD:
+ nPos = m_pSelectionLB->InsertEntry(aLst[i]);
+ m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+ if (GetCurField()->GetSubType() == i)
+ m_pSelectionLB->SelectEntryPos(nPos);
+ break;
- switch (nTypeId)
+ case TYP_AUTHORFLD:
{
- case TYP_DATEFLD:
- case TYP_TIMEFLD:
- nPos = m_pSelectionLB->InsertEntry(aLst[i]);
- m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
- if (static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && !i)
- m_pSelectionLB->SelectEntryPos(nPos);
- if (!static_cast<SwDateTimeField*>(GetCurField())->IsFixed() && i)
- m_pSelectionLB->SelectEntryPos(nPos);
- break;
-
- case TYP_EXTUSERFLD:
- case TYP_DOCSTATFLD:
- nPos = m_pSelectionLB->InsertEntry(aLst[i]);
- m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
- if (GetCurField()->GetSubType() == i)
- m_pSelectionLB->SelectEntryPos(nPos);
- break;
-
- case TYP_AUTHORFLD:
- {
- const OUString sFormat(GetFieldMgr().GetFormatStr(nTypeId, i));
- nPos = m_pSelectionLB->InsertEntry(sFormat);
- m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
- m_pSelectionLB->SelectEntry(GetFieldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
- break;
- }
-
- default:
- if (aLst[i] == GetCurField()->GetPar1())
- bInsert = true;
- break;
- }
- if (bInsert)
- {
- nPos = m_pSelectionLB->InsertEntry(aLst[i]);
+ const OUString sFormat(GetFieldMgr().GetFormatStr(nTypeId, i));
+ nPos = m_pSelectionLB->InsertEntry(sFormat);
m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+ m_pSelectionLB->SelectEntry(GetFieldMgr().GetFormatStr(nTypeId, GetCurField()->GetFormat()));
break;
}
+
+ default:
+ if (aLst[i] == GetCurField()->GetPar1())
+ bInsert = true;
+ break;
+ }
+ if (bInsert)
+ {
+ nPos = m_pSelectionLB->InsertEntry(aLst[i]);
+ m_pSelectionLB->SetEntryData(nPos, reinterpret_cast<void*>(i));
+ break;
}
}
- m_pSelectionLB->SetSelectHdl(Link<ListBox&,void>());
- }
- else
- {
- AddSubType(TYP_PAGENUMBERFLD);
- AddSubType(TYP_PREVPAGEFLD);
- AddSubType(TYP_NEXTPAGEFLD);
- nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(0));
- nCount = 3;
- m_pSelectionLB->SetSelectHdl(LINK(this, SwFieldDokPage, SubTypeHdl));
}
+ m_pSelectionLB->SetSelectHdl(Link<ListBox&,void>());
+ }
+ else
+ {
+ AddSubType(TYP_PAGENUMBERFLD);
+ AddSubType(TYP_PREVPAGEFLD);
+ AddSubType(TYP_NEXTPAGEFLD);
+ nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pSelectionLB->GetEntryData(0));
+ nCount = 3;
+ m_pSelectionLB->SetSelectHdl(LINK(this, SwFieldDokPage, SubTypeHdl));
+ }
- bool bEnable = nCount != 0;
-
- if (bEnable && !m_pSelectionLB->GetSelectedEntryCount())
- m_pSelectionLB->SelectEntryPos(0);
-
- m_pSelection->Enable( bEnable );
+ bool bEnable = nCount != 0;
- // fill Format-Listbox
- sal_Int32 nSize = FillFormatLB(nTypeId);
+ if (bEnable && !m_pSelectionLB->GetSelectedEntryCount())
+ m_pSelectionLB->SelectEntryPos(0);
- bool bValue = false, bLevel = false, bNumFormat = false, bOffset = false;
- bool bFormat = nSize != 0;
- bool bOneArea = false;
- bool bFixed = false;
- sal_uInt16 nFormatType = 0;
+ m_pSelection->Enable( bEnable );
- switch (nTypeId)
- {
- case TYP_DATEFLD:
- bFormat = bNumFormat = bOneArea = bOffset = true;
+ // fill Format-Listbox
+ sal_Int32 nSize = FillFormatLB(nTypeId);
- nFormatType = css::util::NumberFormat::DATE;
+ bool bValue = false, bLevel = false, bNumFormat = false, bOffset = false;
+ bool bFormat = nSize != 0;
+ bool bOneArea = false;
+ bool bFixed = false;
+ sal_uInt16 nFormatType = 0;
- m_pDateFT->Show();
+ switch (nTypeId)
+ {
+ case TYP_DATEFLD:
+ bFormat = bNumFormat = bOneArea = bOffset = true;
- m_pDateOffsetED->SetFirst(-31); // one month
- m_pDateOffsetED->SetLast(31);
+ nFormatType = css::util::NumberFormat::DATE;
- if (IsFieldEdit())
- m_pDateOffsetED->SetValue( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() / 24 / 60);
- break;
+ m_pDateFT->Show();
- case TYP_TIMEFLD:
- bFormat = bNumFormat = bOneArea = bOffset = true;
+ m_pDateOffsetED->SetFirst(-31); // one month
+ m_pDateOffsetED->SetLast(31);
- nFormatType = css::util::NumberFormat::TIME;
+ if (IsFieldEdit())
+ m_pDateOffsetED->SetValue( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() / 24 / 60);
+ break;
- m_pTimeFT->Show();
+ case TYP_TIMEFLD:
+ bFormat = bNumFormat = bOneArea = bOffset = true;
- m_pDateOffsetED->SetFirst(-1440); // one day
- m_pDateOffsetED->SetLast(1440);
+ nFormatType = css::util::NumberFormat::TIME;
- if (IsFieldEdit())
- m_pDateOffsetED->SetValue( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() );
- break;
+ m_pTimeFT->Show();
- case TYP_PREVPAGEFLD:
- case TYP_NEXTPAGEFLD:
- if (IsFieldEdit())
- {
- const sal_uInt16 nTmp = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(
- m_pFormatLB->GetSelectedEntryPos() ));
+ m_pDateOffsetED->SetFirst(-1440); // one day
+ m_pDateOffsetED->SetLast(1440);
- if(SVX_NUM_CHAR_SPECIAL != nTmp)
- {
- sal_Int32 nOff = GetCurField()->GetPar2().toInt32();
- if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
- m_pValueED->SetText(
- OUString::number(nOff - 1) );
- else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
- m_pValueED->SetText(
- OUString::number(nOff + 1) );
- else
- m_pValueED->SetText(aEmptyOUStr);
- }
- else
- m_pValueED->SetText(static_cast<SwPageNumberField*>(GetCurField())->GetUserString());
- }
- bValue = true;
- break;
-
- case TYP_CHAPTERFLD:
- m_pValueFT->SetText(SwResId(STR_LEVEL));
- if (IsFieldEdit())
- m_pLevelED->SetText(OUString::number(static_cast<SwChapterField*>(GetCurField())->GetLevel() + 1));
- bLevel = true;
- break;
-
- case TYP_PAGENUMBERFLD:
- m_pValueFT->SetText( SwResId( STR_OFFSET ));
- if (IsFieldEdit())
- m_pValueED->SetText(GetCurField()->GetPar2());
- bValue = true;
- break;
-
- case TYP_EXTUSERFLD:
- case TYP_AUTHORFLD:
- case TYP_FILENAMEFLD:
- bFixed = true;
- break;
-
- default:
- break;
- }
+ if (IsFieldEdit())
+ m_pDateOffsetED->SetValue( static_cast<SwDateTimeField*>(GetCurField())->GetOffset() );
+ break;
- if (bNumFormat)
- {
+ case TYP_PREVPAGEFLD:
+ case TYP_NEXTPAGEFLD:
if (IsFieldEdit())
{
- m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+ const sal_uInt16 nTmp = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pFormatLB->GetEntryData(
+ m_pFormatLB->GetSelectedEntryPos() ));
- if (m_pNumFormatLB->GetFormatType() == (css::util::NumberFormat::DATE|css::util::NumberFormat::TIME))
+ if(SVX_NUM_CHAR_SPECIAL != nTmp)
{
- // always set Format-Type because otherwise when date/time formats are combined,
- // both formats would be displayed at the same time
- m_pNumFormatLB->SetFormatType(0);
- m_pNumFormatLB->SetFormatType(nFormatType);
- // set correct format once again
- m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+ sal_Int32 nOff = GetCurField()->GetPar2().toInt32();
+ if( TYP_NEXTPAGEFLD == nTypeId && 1 != nOff )
+ m_pValueED->SetText(
+ OUString::number(nOff - 1) );
+ else if( TYP_PREVPAGEFLD == nTypeId && -1 != nOff )
+ m_pValueED->SetText(
+ OUString::number(nOff + 1) );
+ else
+ m_pValueED->SetText(aEmptyOUStr);
}
+ else
+ m_pValueED->SetText(static_cast<SwPageNumberField*>(GetCurField())->GetUserString());
}
- else
- m_pNumFormatLB->SetFormatType(nFormatType);
+ bValue = true;
+ break;
- m_pNumFormatLB->SetOneArea(bOneArea);
- }
+ case TYP_CHAPTERFLD:
+ m_pValueFT->SetText(SwResId(STR_LEVEL));
+ if (IsFieldEdit())
+ m_pLevelED->SetText(OUString::number(static_cast<SwChapterField*>(GetCurField())->GetLevel() + 1));
+ bLevel = true;
+ break;
- m_pFormatLB->Show(!bNumFormat);
- m_pNumFormatLB->Show(bNumFormat);
+ case TYP_PAGENUMBERFLD:
+ m_pValueFT->SetText( SwResId( STR_OFFSET ));
+ if (IsFieldEdit())
+ m_pValueED->SetText(GetCurField()->GetPar2());
+ bValue = true;
+ break;
- m_pValueFT->Show(bValue);
- m_pValueED->Show(bValue);
- m_pLevelFT->Show(bLevel);
- m_pLevelED->Show(bLevel);
- m_pDateOffsetED->Show(bOffset);
- m_pFixedCB->Show(!bValue && !bLevel && !bOffset);
+ case TYP_EXTUSERFLD:
+ case TYP_AUTHORFLD:
+ case TYP_FILENAMEFLD:
+ bFixed = true;
+ break;
- m_pFormat->Enable(bFormat);
- m_pFixedCB->Enable(bFixed);
+ default:
+ break;
+ }
+ if (bNumFormat)
+ {
if (IsFieldEdit())
- m_pFixedCB->Check( (GetCurField()->GetFormat() & AF_FIXED) != 0 && bFixed );
+ {
+ m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+
+ if (m_pNumFormatLB->GetFormatType() == (css::util::NumberFormat::DATE|css::util::NumberFormat::TIME))
+ {
+ // always set Format-Type because otherwise when date/time formats are combined,
+ // both formats would be displayed at the same time
+ m_pNumFormatLB->SetFormatType(0);
+ m_pNumFormatLB->SetFormatType(nFormatType);
+ // set correct format once again
+ m_pNumFormatLB->SetDefFormat(GetCurField()->GetFormat());
+ }
+ }
+ else
+ m_pNumFormatLB->SetFormatType(nFormatType);
- if (m_pNumFormatLB->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND)
- m_pNumFormatLB->SelectEntryPos(0);
- m_pValueFT->Enable(bValue || bLevel || bOffset);
- m_pValueED->Enable(bValue);
+ m_pNumFormatLB->SetOneArea(bOneArea);
}
+
+ m_pFormatLB->Show(!bNumFormat);
+ m_pNumFormatLB->Show(bNumFormat);
+
+ m_pValueFT->Show(bValue);
+ m_pValueED->Show(bValue);
+ m_pLevelFT->Show(bLevel);
+ m_pLevelED->Show(bLevel);
+ m_pDateOffsetED->Show(bOffset);
+ m_pFixedCB->Show(!bValue && !bLevel && !bOffset);
+
+ m_pFormat->Enable(bFormat);
+ m_pFixedCB->Enable(bFixed);
+
+ if (IsFieldEdit())
+ m_pFixedCB->Check( (GetCurField()->GetFormat() & AF_FIXED) != 0 && bFixed );
+
+ if (m_pNumFormatLB->GetSelectedEntryPos() == LISTBOX_ENTRY_NOTFOUND)
+ m_pNumFormatLB->SelectEntryPos(0);
+ m_pValueFT->Enable(bValue || bLevel || bOffset);
+ m_pValueED->Enable(bValue);
+
}
void SwFieldDokPage::AddSubType(sal_uInt16 nTypeId)
diff --git a/sw/source/ui/fldui/fldfunc.cxx b/sw/source/ui/fldui/fldfunc.cxx
index 32fb4862f929..74da178e3514 100644
--- a/sw/source/ui/fldui/fldfunc.cxx
+++ b/sw/source/ui/fldui/fldfunc.cxx
@@ -233,183 +233,184 @@ IMPL_LINK_NOARG(SwFieldFuncPage, TypeHdl, ListBox&, void)
m_pTypeLB->SelectEntryPos(0);
}
- if (nOld != GetTypeSel())
- {
- const sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
+ if (nOld == GetTypeSel())
+ return;
- // fill Selection-Listbox
- UpdateSubType();
+ const sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
- // fill Format-Listbox
- m_pFormatLB->Clear();
+ // fill Selection-Listbox
+ UpdateSubType();
- const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
+ // fill Format-Listbox
+ m_pFormatLB->Clear();
- for (sal_uInt16 i = 0; i < nSize; i++)
- {
- sal_Int32 nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
- m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, i )) );
- }
+ const sal_uInt16 nSize = GetFieldMgr().GetFormatCount(nTypeId, IsFieldDlgHtmlMode());
- if (nSize)
- {
- if (IsFieldEdit() && nTypeId == TYP_JUMPEDITFLD)
- m_pFormatLB->SelectEntry(SwResId(FMT_MARK_ARY[GetCurField()->GetFormat()]));
+ for (sal_uInt16 i = 0; i < nSize; i++)
+ {
+ sal_Int32 nPos = m_pFormatLB->InsertEntry(GetFieldMgr().GetFormatStr(nTypeId, i));
+ m_pFormatLB->SetEntryData( nPos, reinterpret_cast<void*>(GetFieldMgr().GetFormatId( nTypeId, i )) );
+ }
- if (!m_pFormatLB->GetSelectedEntryCount())
- m_pFormatLB->SelectEntryPos(0);
- }
+ if (nSize)
+ {
+ if (IsFieldEdit() && nTypeId == TYP_JUMPEDITFLD)
+ m_pFormatLB->SelectEntry(SwResId(FMT_MARK_ARY[GetCurField()->GetFormat()]));
- bool bValue = false, bName = false, bMacro = false, bInsert = true;
- bool bFormat = nSize != 0;
+ if (!m_pFormatLB->GetSelectedEntryCount())
+ m_pFormatLB->SelectEntryPos(0);
+ }
- // two controls for conditional text
- bool bDropDown = TYP_DROPDOWN == nTypeId;
- bool bCondTextField = TYP_CONDTXTFLD == nTypeId;
+ bool bValue = false, bName = false, bMacro = false, bInsert = true;
+ bool bFormat = nSize != 0;
- m_pCond1FT->Show(!bDropDown && bCondTextField);
- m_pCond1ED->Show(!bDropDown && bCondTextField);
- m_pCond2FT->Show(!bDropDown && bCondTextField);
- m_pCond2ED->Show(!bDropDown && bCondTextField);
- m_pValueGroup->Show(!bDropDown && !bCondTextField);
- m_pMacroBT->Show(!bDropDown);
- m_pNameED->Show(!bDropDown);
- m_pNameFT->Show(!bDropDown);
+ // two controls for conditional text
+ bool bDropDown = TYP_DROPDOWN == nTypeId;
+ bool bCondTextField = TYP_CONDTXTFLD == nTypeId;
- m_pListGroup->Show(bDropDown);
+ m_pCond1FT->Show(!bDropDown && bCondTextField);
+ m_pCond1ED->Show(!bDropDown && bCondTextField);
+ m_pCond2FT->Show(!bDropDown && bCondTextField);
+ m_pCond2ED->Show(!bDropDown && bCondTextField);
+ m_pValueGroup->Show(!bDropDown && !bCondTextField);
+ m_pMacroBT->Show(!bDropDown);
+ m_pNameED->Show(!bDropDown);
+ m_pNameFT->Show(!bDropDown);
- m_pNameED->SetDropEnable(false);
+ m_pListGroup->Show(bDropDown);
- if (IsFieldEdit())
+ m_pNameED->SetDropEnable(false);
+
+ if (IsFieldEdit())
+ {
+ if(bDropDown)
{
- if(bDropDown)
- {
- const SwDropDownField* pDrop = static_cast<const SwDropDownField*>(GetCurField());
- uno::Sequence<OUString> aItems = pDrop->GetItemSequence();
- const OUString* pArray = aItems.getConstArray();
- m_pListItemsLB->Clear();
- for(sal_Int32 i = 0; i < aItems.getLength(); i++)
- m_pListItemsLB->InsertEntry(pArray[i]);
- m_pListItemsLB->SelectEntry(pDrop->GetSelectedItem());
- m_pListNameED->SetText(pDrop->GetPar2());
- m_pListNameED->SaveValue();
- bDropDownLBChanged = false;
- }
- else
- {
- m_pNameED->SetText(GetCurField()->GetPar1());
- m_pValueED->SetText(GetCurField()->GetPar2());
- }
+ const SwDropDownField* pDrop = static_cast<const SwDropDownField*>(GetCurField());
+ uno::Sequence<OUString> aItems = pDrop->GetItemSequence();
+ const OUString* pArray = aItems.getConstArray();
+ m_pListItemsLB->Clear();
+ for(sal_Int32 i = 0; i < aItems.getLength(); i++)
+ m_pListItemsLB->InsertEntry(pArray[i]);
+ m_pListItemsLB->SelectEntry(pDrop->GetSelectedItem());
+ m_pListNameED->SetText(pDrop->GetPar2());
+ m_pListNameED->SaveValue();
+ bDropDownLBChanged = false;
}
else
{
- m_pNameED->SetText(OUString());
- m_pValueED->SetText(OUString());
+ m_pNameED->SetText(GetCurField()->GetPar1());
+ m_pValueED->SetText(GetCurField()->GetPar2());
}
- if(bDropDown)
- ListEnableHdl(*m_pListItemED);
+ }
+ else
+ {
+ m_pNameED->SetText(OUString());
+ m_pValueED->SetText(OUString());
+ }
+ if(bDropDown)
+ ListEnableHdl(*m_pListItemED);
- if (m_pNameFT->GetText() != m_sOldNameFT)
- m_pNameFT->SetText(m_sOldNameFT);
- if (m_pValueFT->GetText() != m_sOldValueFT)
- m_pValueFT->SetText(m_sOldValueFT);
+ if (m_pNameFT->GetText() != m_sOldNameFT)
+ m_pNameFT->SetText(m_sOldNameFT);
+ if (m_pValueFT->GetText() != m_sOldValueFT)
+ m_pValueFT->SetText(m_sOldValueFT);
- switch (nTypeId)
- {
- case TYP_MACROFLD:
- bMacro = true;
- if (!GetFieldMgr().GetMacroPath().isEmpty())
- bValue = true;
- else
- bInsert = false;
+ switch (nTypeId)
+ {
+ case TYP_MACROFLD:
+ bMacro = true;
+ if (!GetFieldMgr().GetMacroPath().isEmpty())
+ bValue = true;
+ else
+ bInsert = false;
- m_pNameFT->SetText(SwResId(STR_MACNAME));
- m_pValueFT->SetText(SwResId(STR_PROMPT));
- m_pNameED->SetText(GetFieldMgr().GetMacroName());
- m_pNameED->SetAccessibleName(m_pNameFT->GetText());
- m_pValueED->SetAccessibleName(m_pValueFT->GetText());
- break;
+ m_pNameFT->SetText(SwResId(STR_MACNAME));
+ m_pValueFT->SetText(SwResId(STR_PROMPT));
+ m_pNameED->SetText(GetFieldMgr().GetMacroName());
+ m_pNameED->SetAccessibleName(m_pNameFT->GetText());
+ m_pValueED->SetAccessibleName(m_pValueFT->GetText());
+ break;
- case TYP_HIDDENPARAFLD:
- m_pNameFT->SetText(SwResId(STR_COND));
- m_pNameED->SetDropEnable(true);
- bName = true;
- m_pNameED->SetAccessibleName(m_pNameFT->GetText());
- m_pValueED->SetAccessibleName(m_pValueFT->GetText());
- break;
+ case TYP_HIDDENPARAFLD:
+ m_pNameFT->SetText(SwResId(STR_COND));
+ m_pNameED->SetDropEnable(true);
+ bName = true;
+ m_pNameED->SetAccessibleName(m_pNameFT->GetText());
+ m_pValueED->SetAccessibleName(m_pValueFT->GetText());
+ break;
+
+ case TYP_HIDDENTXTFLD:
+ {
+ m_pNameFT->SetText(SwResId(STR_COND));
+ m_pNameED->SetDropEnable(true);
+ m_pValueFT->SetText(SwResId(STR_INSTEXT));
+ SwWrtShell* pSh = GetActiveWrtShell();
+ if (!IsFieldEdit() && pSh )
+ m_pValueED->SetText(pSh->GetSelText());
+ bName = bValue = true;
+ m_pNameED->SetAccessibleName(m_pNameFT->GetText());
+ m_pValueED->SetAccessibleName(m_pValueFT->GetText());
+ }
+ break;
- case TYP_HIDDENTXTFLD:
+ case TYP_CONDTXTFLD:
+ m_pNameFT->SetText(SwResId(STR_COND));
+ m_pNameED->SetDropEnable(true);
+ if (IsFieldEdit())
{
- m_pNameFT->SetText(SwResId(STR_COND));
- m_pNameED->SetDropEnable(true);
- m_pValueFT->SetText(SwResId(STR_INSTEXT));
- SwWrtShell* pSh = GetActiveWrtShell();
- if (!IsFieldEdit() && pSh )
- m_pValueED->SetText(pSh->GetSelText());
- bName = bValue = true;
- m_pNameED->SetAccessibleName(m_pNameFT->GetText());
- m_pValueED->SetAccessibleName(m_pValueFT->GetText());
+ m_pCond1ED->SetText(GetCurField()->GetPar2().getToken(0, '|'));
+ m_pCond2ED->SetText(GetCurField()->GetPar2().getToken(1, '|'));
}
+
+ bName = bValue = true;
+ m_pNameED->SetAccessibleName(m_pNameFT->GetText());
+ m_pValueED->SetAccessibleName(m_pValueFT->GetText());
break;
- case TYP_CONDTXTFLD:
- m_pNameFT->SetText(SwResId(STR_COND));
- m_pNameED->SetDropEnable(true);
- if (IsFieldEdit())
- {
- m_pCond1ED->SetText(GetCurField()->GetPar2().getToken(0, '|'));
- m_pCond2ED->SetText(GetCurField()->GetPar2().getToken(1, '|'));
- }
+ case TYP_JUMPEDITFLD:
+ m_pNameFT->SetText(SwResId(STR_JUMPEDITFLD));
+ m_pValueFT->SetText(SwResId(STR_PROMPT));
+ bName = bValue = true;
+ m_pNameED->SetAccessibleName(m_pNameFT->GetText());
+ m_pValueED->SetAccessibleName(m_pValueFT->GetText());
+ break;
- bName = bValue = true;
- m_pNameED->SetAccessibleName(m_pNameFT->GetText());
- m_pValueED->SetAccessibleName(m_pValueFT->GetText());
- break;
+ case TYP_INPUTFLD:
+ m_pValueFT->SetText(SwResId(STR_PROMPT));
+ bValue = true;
+ m_pNameED->SetAccessibleName(m_pNameFT->GetText());
+ m_pValueED->SetAccessibleName(m_pValueFT->GetText());
+ break;
- case TYP_JUMPEDITFLD:
- m_pNameFT->SetText(SwResId(STR_JUMPEDITFLD));
- m_pValueFT->SetText(SwResId(STR_PROMPT));
- bName = bValue = true;
- m_pNameED->SetAccessibleName(m_pNameFT->GetText());
- m_pValueED->SetAccessibleName(m_pValueFT->GetText());
- break;
+ case TYP_COMBINED_CHARS:
+ {
+ m_pNameFT->SetText(SwResId(STR_COMBCHRS_FT));
+ m_pNameED->SetDropEnable(true);
+ bName = true;
- case TYP_INPUTFLD:
- m_pValueFT->SetText(SwResId(STR_PROMPT));
- bValue = true;
+ const sal_Int32 nLen = m_pNameED->GetText().getLength();
+ if( !nLen || nLen > MAX_COMBINED_CHARACTERS )
+ bInsert = false;
m_pNameED->SetAccessibleName(m_pNameFT->GetText());
m_pValueED->SetAccessibleName(m_pValueFT->GetText());
- break;
-
- case TYP_COMBINED_CHARS:
- {
- m_pNameFT->SetText(SwResId(STR_COMBCHRS_FT));
- m_pNameED->SetDropEnable(true);
- bName = true;
-
- const sal_Int32 nLen = m_pNameED->GetText().getLength();
- if( !nLen || nLen > MAX_COMBINED_CHARACTERS )
- bInsert = false;
- m_pNameED->SetAccessibleName(m_pNameFT->GetText());
- m_pValueED->SetAccessibleName(m_pValueFT->GetText());
- }
- break;
- case TYP_DROPDOWN :
+ }
break;
- default:
- break;
- }
+ case TYP_DROPDOWN :
+ break;
+ default:
+ break;
+ }
- m_pSelectionLB->Hide();
+ m_pSelectionLB->Hide();
- m_pFormat->Enable(bFormat);
- m_pNameFT->Enable(bName);
- m_pNameED->Enable(bName);
- m_pValueGroup->Enable(bValue);
- m_pMacroBT->Enable(bMacro);
+ m_pFormat->Enable(bFormat);
+ m_pNameFT->Enable(bName);
+ m_pNameED->Enable(bName);
+ m_pValueGroup->Enable(bValue);
+ m_pMacroBT->Enable(bMacro);
+
+ EnableInsert( bInsert );
- EnableInsert( bInsert );
- }
}
IMPL_LINK_NOARG(SwFieldFuncPage, SelectHdl, ListBox&, void)
diff --git a/sw/source/ui/fldui/fldref.cxx b/sw/source/ui/fldui/fldref.cxx
index d8e1fc77cdb7..75e8bf794f34 100644
--- a/sw/source/ui/fldui/fldref.cxx
+++ b/sw/source/ui/fldui/fldref.cxx
@@ -378,64 +378,65 @@ IMPL_LINK_NOARG(SwFieldRefPage, TypeHdl, ListBox&, void)
}
}
- if (nOld != GetTypeSel())
- {
- sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
+ if (nOld == GetTypeSel())
+ return;
- // fill selection-ListBox
- OUString sFilter = comphelper::string::strip(m_pFilterED->GetText(), ' ');
- UpdateSubType(sFilter);
+ sal_uInt16 nTypeId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(GetTypeSel()));
- bool bName = false;
- nFieldDlgFormatSel = 0;
+ // fill selection-ListBox
+ OUString sFilter = comphelper::string::strip(m_pFilterED->GetText(), ' ');
+ UpdateSubType(sFilter);
- if ( ( !IsFieldEdit() || m_pSelectionLB->GetEntryCount() ) &&
- nOld != LISTBOX_ENTRY_NOTFOUND )
- {
- m_pNameED->SetText(aEmptyOUStr);
- m_pValueED->SetText(aEmptyOUStr);
- m_pFilterED->SetText(aEmptyOUStr);
- }
+ bool bName = false;
+ nFieldDlgFormatSel = 0;
- switch (nTypeId)
- {
- case TYP_GETREFFLD:
- if (REFFLDFLAG & (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(nOld)))
- // the old one stays
- nFieldDlgFormatSel = m_pFormatLB->GetSelectedEntryPos();
- bName = true;
- break;
+ if ( ( !IsFieldEdit() || m_pSelectionLB->GetEntryCount() ) &&
+ nOld != LISTBOX_ENTRY_NOTFOUND )
+ {
+ m_pNameED->SetText(aEmptyOUStr);
+ m_pValueED->SetText(aEmptyOUStr);
+ m_pFilterED->SetText(aEmptyOUStr);
+ }
- case TYP_SETREFFLD:
- bName = true;
- break;
+ switch (nTypeId)
+ {
+ case TYP_GETREFFLD:
+ if (REFFLDFLAG & (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(nOld)))
+ // the old one stays
+ nFieldDlgFormatSel = m_pFormatLB->GetSelectedEntryPos();
+ bName = true;
+ break;
- case REFFLDFLAG_BOOKMARK:
- bName = true;
- SAL_FALLTHROUGH;
- default:
- if( REFFLDFLAG & nTypeId )
- {
- const sal_uInt16 nOldId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(nOld));
- if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
- // then the old one stays
- nFieldDlgFormatSel = m_pFormatLB->GetSelectedEntryPos();
- }
- break;
- }
+ case TYP_SETREFFLD:
+ bName = true;
+ break;
+
+ case REFFLDFLAG_BOOKMARK:
+ bName = true;
+ SAL_FALLTHROUGH;
+ default:
+ if( REFFLDFLAG & nTypeId )
+ {
+ const sal_uInt16 nOldId = (sal_uInt16)reinterpret_cast<sal_uLong>(m_pTypeLB->GetEntryData(nOld));
+ if( nOldId & REFFLDFLAG || nOldId == TYP_GETREFFLD )
+ // then the old one stays
+ nFieldDlgFormatSel = m_pFormatLB->GetSelectedEntryPos();
+ }
+ break;
+ }
- m_pNameED->Enable(bName);
- m_pNameFT->Enable(bName);
+ m_pNameED->Enable(bName);
+ m_pNameFT->Enable(bName);
- // fill Format-Listbox
- sal_Int32 nSize = FillFormatLB(nTypeId);
- bool bFormat = nSize != 0;
- m_pFormat->Enable(bFormat);
+ // fill Format-Listbox
+ sal_Int32 nSize = FillFormatLB(nTypeId);
+ bool bFormat = nSize != 0;
+ m_pFormat->Enable(bFormat);
+
+ SubTypeHdl();
+ ModifyHdl(*m_pNameED);
+ ModifyHdl(*m_pFilterED);
- SubTypeHdl();
- ModifyHdl(*m_pNameED);
- ModifyHdl(*m_pFilterED);
- }
}
IMPL_LINK_NOARG(SwFieldRefPage, SubTypeTreeListBoxHdl, SvTreeListBox*, void)
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index c8470a43d773..88b2e8f5e30e 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2614,35 +2614,37 @@ IMPL_LINK_NOARG(SwGrfExtPage, BrowseHdl, Button*, void)
uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY);
xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, uno::makeAny(true) );
- if ( pGrfDlg->Execute() == ERRCODE_NONE )
- { // remember selected filter
- aFilterName = pGrfDlg->GetCurrentFilter();
- aNewGrfName = INetURLObject::decode( pGrfDlg->GetPath(),
- INetURLObject::DecodeMechanism::Unambiguous );
- m_pConnectED->SetModifyFlag();
- m_pConnectED->SetText( aNewGrfName );
- //reset mirrors because maybe a Bitmap was swapped with
- //another type of graphic that cannot be mirrored.
- m_pMirrorVertBox->Check(false);
- m_pMirrorHorzBox->Check(false);
- m_pAllPagesRB->Enable(false);
- m_pLeftPagesRB->Enable(false);
- m_pRightPagesRB->Enable(false);
- m_pBmpWin->MirrorHorz(false);
- m_pBmpWin->MirrorVert(false);
-
- Graphic aGraphic;
- (void)GraphicFilter::LoadGraphic(pGrfDlg->GetPath(), OUString(), aGraphic);
- m_pBmpWin->SetGraphic(aGraphic);
-
- bool bEnable = GraphicType::Bitmap == aGraphic.GetType() ||
- GraphicType::GdiMetafile == aGraphic.GetType();
- m_pMirrorVertBox->Enable(bEnable);
- m_pMirrorHorzBox->Enable(bEnable);
- m_pAllPagesRB->Enable(bEnable);
- m_pLeftPagesRB->Enable(bEnable);
- m_pRightPagesRB->Enable(bEnable);
- }
+ if ( pGrfDlg->Execute() != ERRCODE_NONE )
+ return;
+
+// remember selected filter
+ aFilterName = pGrfDlg->GetCurrentFilter();
+ aNewGrfName = INetURLObject::decode( pGrfDlg->GetPath(),
+ INetURLObject::DecodeMechanism::Unambiguous );
+ m_pConnectED->SetModifyFlag();
+ m_pConnectED->SetText( aNewGrfName );
+ //reset mirrors because maybe a Bitmap was swapped with
+ //another type of graphic that cannot be mirrored.
+ m_pMirrorVertBox->Check(false);
+ m_pMirrorHorzBox->Check(false);
+ m_pAllPagesRB->Enable(false);
+ m_pLeftPagesRB->Enable(false);
+ m_pRightPagesRB->Enable(false);
+ m_pBmpWin->MirrorHorz(false);
+ m_pBmpWin->MirrorVert(false);
+
+ Graphic aGraphic;
+ (void)GraphicFilter::LoadGraphic(pGrfDlg->GetPath(), OUString(), aGraphic);
+ m_pBmpWin->SetGraphic(aGraphic);
+
+ bool bEnable = GraphicType::Bitmap == aGraphic.GetType() ||
+ GraphicType::GdiMetafile == aGraphic.GetType();
+ m_pMirrorVertBox->Enable(bEnable);
+ m_pMirrorHorzBox->Enable(bEnable);
+ m_pAllPagesRB->Enable(bEnable);
+ m_pLeftPagesRB->Enable(bEnable);
+ m_pRightPagesRB->Enable(bEnable);
+
}
IMPL_LINK_NOARG(SwGrfExtPage, MirrorHdl, Button*, void)
@@ -3252,28 +3254,28 @@ IMPL_LINK(SwFrameAddPage, ChainModifyHdl, ListBox&, rBox, void)
if(m_pNextLB->GetSelectedEntryPos())
sCurrentNextChain = m_pNextLB->GetSelectedEntry();
SwFrameFormat* pFormat = m_pWrtSh->GetFlyFrameFormat();
- if (pFormat)
- {
- bool bNextBox = m_pNextLB == &rBox;
- ListBox& rChangeLB = bNextBox ? *m_pPrevLB : *m_pNextLB;
- for(sal_Int32 nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--)
- rChangeLB.RemoveEntry(nEntry - 1);
- //determine chainable frames
- std::vector< OUString > aPrevPageFrames;
- std::vector< OUString > aThisPageFrames;
- std::vector< OUString > aNextPageFrames;
- std::vector< OUString > aRemainFrames;
- m_pWrtSh->GetConnectableFrameFormats(*pFormat, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
- aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
- lcl_InsertVectors(rChangeLB,
- aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
- const OUString sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
- if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND)
- rChangeLB.SelectEntry(sToSelect);
- else
- rChangeLB.SelectEntryPos(0);
+ if (!pFormat)
+ return;
+
+ bool bNextBox = m_pNextLB == &rBox;
+ ListBox& rChangeLB = bNextBox ? *m_pPrevLB : *m_pNextLB;
+ for(sal_Int32 nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--)
+ rChangeLB.RemoveEntry(nEntry - 1);
+ //determine chainable frames
+ std::vector< OUString > aPrevPageFrames;
+ std::vector< OUString > aThisPageFrames;
+ std::vector< OUString > aNextPageFrames;
+ std::vector< OUString > aRemainFrames;
+ m_pWrtSh->GetConnectableFrameFormats(*pFormat, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox,
+ aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames );
+ lcl_InsertVectors(rChangeLB,
+ aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames);
+ const OUString sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain;
+ if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND)
+ rChangeLB.SelectEntry(sToSelect);
+ else
+ rChangeLB.SelectEntryPos(0);
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/ui/misc/pggrid.cxx b/sw/source/ui/misc/pggrid.cxx
index ffd65c2372e6..245ad05657c7 100644
--- a/sw/source/ui/misc/pggrid.cxx
+++ b/sw/source/ui/misc/pggrid.cxx
@@ -304,61 +304,62 @@ void SwTextGridPage::UpdatePageSize(const SfxItemSet& rSet)
rDirItem.GetValue() == SvxFrameDirection::Vertical_LR_TB;
}
- if( SfxItemState::SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
+ if( SfxItemState::SET != rSet.GetItemState( SID_ATTR_PAGE_SIZE ))
+ return;
+
+ const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(rSet.Get(
+ SID_ATTR_PAGE_SIZE));
+ const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rSet.Get(
+ RES_LR_SPACE ));
+ const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(rSet.Get(
+ RES_UL_SPACE ));
+ const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>( rSet.Get(RES_BOX));
+ sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
+ sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
+
+ sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
+ rBox.GetDistance(SvxBoxItemLine::TOP) -
+ rBox.GetDistance(SvxBoxItemLine::BOTTOM);
+ sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
+ rBox.GetDistance(SvxBoxItemLine::LEFT) -
+ rBox.GetDistance(SvxBoxItemLine::RIGHT);
+ if(m_bVertical)
{
- const SvxSizeItem& rSize = static_cast<const SvxSizeItem&>(rSet.Get(
- SID_ATTR_PAGE_SIZE));
- const SvxLRSpaceItem& rLRSpace = static_cast<const SvxLRSpaceItem&>(rSet.Get(
- RES_LR_SPACE ));
- const SvxULSpaceItem& rULSpace = static_cast<const SvxULSpaceItem&>(rSet.Get(
- RES_UL_SPACE ));
- const SvxBoxItem& rBox = static_cast<const SvxBoxItem&>( rSet.Get(RES_BOX));
- sal_Int32 nDistanceLR = rLRSpace.GetLeft() + rLRSpace.GetRight();
- sal_Int32 nDistanceUL = rULSpace.GetUpper() + rULSpace.GetLower();
-
- sal_Int32 nValue1 = rSize.GetSize().Height() - nDistanceUL -
- rBox.GetDistance(SvxBoxItemLine::TOP) -
- rBox.GetDistance(SvxBoxItemLine::BOTTOM);
- sal_Int32 nValue2 = rSize.GetSize().Width() - nDistanceLR -
- rBox.GetDistance(SvxBoxItemLine::LEFT) -
- rBox.GetDistance(SvxBoxItemLine::RIGHT);
- if(m_bVertical)
- {
- m_aPageSize.Width() = nValue1;
- m_aPageSize.Height() = nValue2;
- }
- else
- {
- m_aPageSize.Width() = nValue2;
- m_aPageSize.Height() = nValue1;
- }
+ m_aPageSize.Width() = nValue1;
+ m_aPageSize.Height() = nValue2;
+ }
+ else
+ {
+ m_aPageSize.Width() = nValue2;
+ m_aPageSize.Height() = nValue1;
+ }
- sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
- m_nRubyUserValue :
- m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)));
+ sal_Int32 nTextSize = static_cast< sal_Int32 >(m_bRubyUserValue ?
+ m_nRubyUserValue :
+ m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)));
- if ( m_bSquaredMode )
- {
- m_pCharsPerLineNF->SetValue(m_aPageSize.Width() / nTextSize);
- m_pCharsPerLineNF->SetMax( m_pCharsPerLineNF->GetValue() );
- m_pLinesPerPageNF->SetMax( m_aPageSize.Height() /
- ( m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)) +
- m_pRubySizeMF->Denormalize(m_pRubySizeMF->GetValue(FUNIT_TWIP))));
- SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() );
- SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() );
- }
- else
- {
- sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_pCharWidthMF->Denormalize(m_pCharWidthMF->GetValue(FUNIT_TWIP)));
- m_pLinesPerPageNF->SetValue(m_aPageSize.Height() / nTextSize);
- if (nTextWidth)
- m_pCharsPerLineNF->SetValue(m_aPageSize.Width() / nTextWidth);
- else
- m_pCharsPerLineNF->SetValue( 45 );
+ if ( m_bSquaredMode )
+ {
+ m_pCharsPerLineNF->SetValue(m_aPageSize.Width() / nTextSize);
+ m_pCharsPerLineNF->SetMax( m_pCharsPerLineNF->GetValue() );
+ m_pLinesPerPageNF->SetMax( m_aPageSize.Height() /
+ ( m_pTextSizeMF->Denormalize(m_pTextSizeMF->GetValue(FUNIT_TWIP)) +
+ m_pRubySizeMF->Denormalize(m_pRubySizeMF->GetValue(FUNIT_TWIP))));
SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() );
SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() );
- }
}
+ else
+ {
+ sal_Int32 nTextWidth = static_cast< sal_Int32 >(m_pCharWidthMF->Denormalize(m_pCharWidthMF->GetValue(FUNIT_TWIP)));
+ m_pLinesPerPageNF->SetValue(m_aPageSize.Height() / nTextSize);
+ if (nTextWidth)
+ m_pCharsPerLineNF->SetValue(m_aPageSize.Width() / nTextWidth);
+ else
+ m_pCharsPerLineNF->SetValue( 45 );
+ SetLinesOrCharsRanges( *m_pCharsRangeFT , m_pCharsPerLineNF->GetMax() );
+ SetLinesOrCharsRanges( *m_pLinesRangeFT , m_pLinesPerPageNF->GetMax() );
+ }
+
}
void SwTextGridPage::SetLinesOrCharsRanges(FixedText & rField, const sal_Int32 nValue )
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index 195048326248..a4e9080be0ed 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -704,91 +704,92 @@ MAKENUMSTR:
}
- if (!cellString.isEmpty())
+ if (cellString.isEmpty())
+ return;
+
+ SvtScriptedTextHelper aScriptedText(rRenderContext);
+ Size aStrSize;
+ sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow );
+ const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
+ const tools::Rectangle cellRect(
+ basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
+ basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
+ Point aPos = cellRect.TopLeft();
+ long nRightX = 0;
+
+ Size theMaxStrSize(cellRect.GetWidth() - FRAME_OFFSET,
+ cellRect.GetHeight() - FRAME_OFFSET);
+ if (aCurData.IsFont())
{
- SvtScriptedTextHelper aScriptedText(rRenderContext);
- Size aStrSize;
- sal_uInt8 nFormatIndex = GetFormatIndex( nCol, nRow );
- const basegfx::B2DRange aCellRange(maArray.GetCellRange( nCol, nRow ));
- const tools::Rectangle cellRect(
- basegfx::fround(aCellRange.getMinX()), basegfx::fround(aCellRange.getMinY()),
- basegfx::fround(aCellRange.getMaxX()), basegfx::fround(aCellRange.getMaxY()));
- Point aPos = cellRect.TopLeft();
- long nRightX = 0;
-
- Size theMaxStrSize(cellRect.GetWidth() - FRAME_OFFSET,
- cellRect.GetHeight() - FRAME_OFFSET);
- if (aCurData.IsFont())
- {
- vcl::Font aFont, aCJKFont, aCTLFont;
- MakeFonts(nFormatIndex, aFont, aCJKFont, aCTLFont);
- aScriptedText.SetFonts(&aFont, &aCJKFont, &aCTLFont);
- }
- else
+ vcl::Font aFont, aCJKFont, aCTLFont;
+ MakeFonts(nFormatIndex, aFont, aCJKFont, aCTLFont);
+ aScriptedText.SetFonts(&aFont, &aCJKFont, &aCTLFont);
+ }
+ else
+ aScriptedText.SetDefaultFont();
+
+ aScriptedText.SetText(cellString, m_xBreak);
+ aStrSize = aScriptedText.GetTextSize();
+
+ if (aCurData.IsFont() &&
+ theMaxStrSize.Height() < aStrSize.Height())
+ {
+ // If the string in this font does not
+ // fit into the cell, the standard font
+ // is taken again:
aScriptedText.SetDefaultFont();
+ aStrSize = aScriptedText.GetTextSize();
+ }
+ while (theMaxStrSize.Width() <= aStrSize.Width() &&
+ cellString.getLength() > 1)
+ {
+ cellString = cellString.copy(0, cellString.getLength() - 1);
aScriptedText.SetText(cellString, m_xBreak);
aStrSize = aScriptedText.GetTextSize();
+ }
- if (aCurData.IsFont() &&
- theMaxStrSize.Height() < aStrSize.Height())
- {
- // If the string in this font does not
- // fit into the cell, the standard font
- // is taken again:
- aScriptedText.SetDefaultFont();
- aStrSize = aScriptedText.GetTextSize();
- }
+ nRightX = cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET;
+
+ // vertical (always centering):
+ aPos.Y() += (nRowHeight - aStrSize.Height()) / 2;
- while (theMaxStrSize.Width() <= aStrSize.Width() &&
- cellString.getLength() > 1)
+ // horizontal
+ if (mbRTL)
+ aPos.X() += nRightX;
+ else if (aCurData.IsJustify())
+ {
+ const SvxAdjustItem& rAdj = aCurData.GetBoxFormat(nFormatIndex).GetAdjust();
+ switch (rAdj.GetAdjust())
{
- cellString = cellString.copy(0, cellString.getLength() - 1);
- aScriptedText.SetText(cellString, m_xBreak);
- aStrSize = aScriptedText.GetTextSize();
+ case SvxAdjust::Left:
+ aPos.X() += FRAME_OFFSET;
+ break;
+ case SvxAdjust::Right:
+ aPos.X() += nRightX;
+ break;
+ default:
+ aPos.X() += (cellRect.GetWidth() - aStrSize.Width()) / 2;
+ break;
}
-
- nRightX = cellRect.GetWidth() - aStrSize.Width() - FRAME_OFFSET;
-
- // vertical (always centering):
- aPos.Y() += (nRowHeight - aStrSize.Height()) / 2;
-
- // horizontal
- if (mbRTL)
- aPos.X() += nRightX;
- else if (aCurData.IsJustify())
+ }
+ else
+ {
+ // Standard align:
+ if (nCol == 0 || nIndex == 4)
{
- const SvxAdjustItem& rAdj = aCurData.GetBoxFormat(nFormatIndex).GetAdjust();
- switch (rAdj.GetAdjust())
- {
- case SvxAdjust::Left:
- aPos.X() += FRAME_OFFSET;
- break;
- case SvxAdjust::Right:
- aPos.X() += nRightX;
- break;
- default:
- aPos.X() += (cellRect.GetWidth() - aStrSize.Width()) / 2;
- break;
- }
+ // Text-Label left or sum left aligned
+ aPos.X() += FRAME_OFFSET;
}
else
{
- // Standard align:
- if (nCol == 0 || nIndex == 4)
- {
- // Text-Label left or sum left aligned
- aPos.X() += FRAME_OFFSET;
- }
- else
- {
- // numbers/dates right aligned
- aPos.X() += nRightX;
- }
+ // numbers/dates right aligned
+ aPos.X() += nRightX;
}
-
- aScriptedText.DrawText(aPos);
}
+
+ aScriptedText.DrawText(aPos);
+
}
#undef FRAME_OFFSET
diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx
index 4a0bd4568151..bacf171d9552 100644
--- a/sw/source/uibase/app/applab.cxx
+++ b/sw/source/uibase/app/applab.cxx
@@ -179,230 +179,231 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel)
bLabel));
OSL_ENSURE(pDlg, "Dialog creation failed!");
- if ( RET_OK == pDlg->Execute() )
+ if ( RET_OK != pDlg->Execute() )
+ return;
+
+ // Read dialog, store item in config
+ const SwLabItem& rItem = static_cast<const SwLabItem&>( pDlg->
+ GetOutputItemSet()->Get(FN_LABEL));
+ aLabCfg.GetItem() = rItem;
+ aLabCfg.Commit();
+
+ // Create new document
+ SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::STANDARD));
+ xDocSh->DoInitNew();
+
+ // Printer
+ Printer *pPrt = pDlg->GetPrt();
+ if (pPrt)
{
- // Read dialog, store item in config
- const SwLabItem& rItem = static_cast<const SwLabItem&>( pDlg->
- GetOutputItemSet()->Get(FN_LABEL));
- aLabCfg.GetItem() = rItem;
- aLabCfg.Commit();
-
- // Create new document
- SfxObjectShellLock xDocSh( new SwDocShell( SfxObjectCreateMode::STANDARD));
- xDocSh->DoInitNew();
-
- // Printer
- Printer *pPrt = pDlg->GetPrt();
- if (pPrt)
- {
- SwDocShell *pDocSh = static_cast<SwDocShell*>(&*xDocSh);
- pDocSh->getIDocumentDeviceAccess().setJobsetup(pPrt->GetJobSetup());
- }
+ SwDocShell *pDocSh = static_cast<SwDocShell*>(&*xDocSh);
+ pDocSh->getIDocumentDeviceAccess().setJobsetup(pPrt->GetJobSetup());
+ }
- SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
+ SfxViewFrame* pViewFrame = SfxViewFrame::DisplayNewDocument( *xDocSh, rReq );
- SwView *pNewView = static_cast<SwView*>( pViewFrame->GetViewShell());
- pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );// So that SelectShell is being called.
+ SwView *pNewView = static_cast<SwView*>( pViewFrame->GetViewShell());
+ pNewView->AttrChangedNotify( &pNewView->GetWrtShell() );// So that SelectShell is being called.
- // Set document title
- OUString aTmp;
- if(bLabel)
- {
- aTmp = SwResId( STR_LAB_TITLE);
- aTmp += OUString::number(++nLabelTitleNo );
- }
- else
+ // Set document title
+ OUString aTmp;
+ if(bLabel)
+ {
+ aTmp = SwResId( STR_LAB_TITLE);
+ aTmp += OUString::number(++nLabelTitleNo );
+ }
+ else
+ {
+ aTmp = pDlg->GetBusinessCardStr();
+ aTmp += OUString::number( ++nBCTitleNo );
+ }
+ xDocSh->SetTitle( aTmp );
+
+ pViewFrame->GetFrame().Appear();
+
+ // Determine Shell
+ SwWrtShell *pSh = pNewView->GetWrtShellPtr();
+ OSL_ENSURE( pSh, "missing WrtShell" );
+
+ { // block for locks the dispatcher!!
+
+ SwWait aWait( static_cast<SwDocShell&>(*xDocSh), true );
+
+ SET_CURR_SHELL(pSh);
+ pSh->SetLabelDoc(rItem.m_bSynchron);
+ pSh->DoUndo( false );
+ pSh->StartAllAction();
+
+ pSh->SetNewDoc(); // Avoid performance problems
+
+ SwPageDesc aDesc = pSh->GetPageDesc( 0 );
+ SwFrameFormat& rFormat = aDesc.GetMaster();
+
+ // Borders
+ SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
+ SvxULSpaceItem aULMargin( RES_UL_SPACE );
+ aLRMargin.SetLeft ((sal_uInt16) rItem.m_lLeft );
+ aULMargin.SetUpper((sal_uInt16) rItem.m_lUpper);
+ aLRMargin.SetRight( 0 );
+ aULMargin.SetLower( 0 );
+ rFormat.SetFormatAttr(aLRMargin);
+ rFormat.SetFormatAttr(aULMargin);
+
+ // Header and footer
+ rFormat.SetFormatAttr(SwFormatHeader(false));
+ aDesc.ChgHeaderShare(false);
+ rFormat.SetFormatAttr(SwFormatFooter(false));
+ aDesc.ChgFooterShare(false);
+
+ aDesc.SetUseOn(UseOnPage::All); // Site numbering
+
+ // Set page size
+ long lPgWidth, lPgHeight;
+ lPgWidth = (rItem.m_lPWidth > MINLAY ? rItem.m_lPWidth : MINLAY);
+ lPgHeight = (rItem.m_lPHeight > MINLAY ? rItem.m_lPHeight : MINLAY);
+ rFormat.SetFormatAttr( SwFormatFrameSize( ATT_FIX_SIZE, lPgWidth, lPgHeight ));
+ // Numbering type
+ SvxNumberType aType;
+ aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
+ aDesc.SetNumType( aType );
+
+ // Followup template
+ const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() );
+ aDesc.SetFollow( &rFollow );
+
+ pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true );
+ SvxPaperBinItem aItem( RES_PAPER_BIN );
+ aItem.SetValue((sal_Int8)pPrt->GetPaperBin());
+ rFormat.SetFormatAttr(aItem);
+
+ // Determine orientation of the resulting page
+ aDesc.SetLandscape(rItem.m_lPWidth > rItem.m_lPHeight);
+
+ pSh->ChgPageDesc( 0, aDesc );
+
+ // Insert frame
+ std::unique_ptr<SwFieldMgr> pFieldMgr(new SwFieldMgr);
+ pFieldMgr->SetEvalExpFields(false);
+
+ // Prepare border template
+ SwFrameFormat* pFormat = pSh->GetFrameFormatFromPool( RES_POOLFRM_LABEL );
+ sal_Int32 iResultWidth = rItem.m_lLeft + (rItem.m_nCols - 1) * rItem.m_lHDist + rItem.m_lWidth - rItem.m_lPWidth;
+ sal_Int32 iResultHeight = rItem.m_lUpper + (rItem.m_nRows - 1) * rItem.m_lVDist + rItem.m_lHeight - rItem.m_lPHeight;
+ sal_Int32 iWidth = (iResultWidth > 0 ? rItem.m_lWidth - (iResultWidth / rItem.m_nCols) - 1 : rItem.m_lWidth);
+ sal_Int32 iHeight = (iResultHeight > 0 ? rItem.m_lHeight - (iResultHeight / rItem.m_nRows) - 1 : rItem.m_lHeight);
+ SwFormatFrameSize aFrameSize( ATT_FIX_SIZE, iWidth, iHeight );
+ pFormat->SetFormatAttr( aFrameSize );
+
+ //frame represents label itself, no border space
+ SvxULSpaceItem aFrameNoULSpace( 0, 0, RES_UL_SPACE );
+ SvxLRSpaceItem aFrameNoLRSpace( 0, 0, 0, 0, RES_LR_SPACE );
+ pFormat->SetFormatAttr( aFrameNoULSpace );
+ pFormat->SetFormatAttr( aFrameNoLRSpace );
+
+ const SwFrameFormat *pFirstFlyFormat = nullptr;
+ if ( rItem.m_bPage )
{
- aTmp = pDlg->GetBusinessCardStr();
- aTmp += OUString::number( ++nBCTitleNo );
- }
- xDocSh->SetTitle( aTmp );
-
- pViewFrame->GetFrame().Appear();
-
- // Determine Shell
- SwWrtShell *pSh = pNewView->GetWrtShellPtr();
- OSL_ENSURE( pSh, "missing WrtShell" );
-
- { // block for locks the dispatcher!!
-
- SwWait aWait( static_cast<SwDocShell&>(*xDocSh), true );
-
- SET_CURR_SHELL(pSh);
- pSh->SetLabelDoc(rItem.m_bSynchron);
- pSh->DoUndo( false );
- pSh->StartAllAction();
-
- pSh->SetNewDoc(); // Avoid performance problems
-
- SwPageDesc aDesc = pSh->GetPageDesc( 0 );
- SwFrameFormat& rFormat = aDesc.GetMaster();
-
- // Borders
- SvxLRSpaceItem aLRMargin( RES_LR_SPACE );
- SvxULSpaceItem aULMargin( RES_UL_SPACE );
- aLRMargin.SetLeft ((sal_uInt16) rItem.m_lLeft );
- aULMargin.SetUpper((sal_uInt16) rItem.m_lUpper);
- aLRMargin.SetRight( 0 );
- aULMargin.SetLower( 0 );
- rFormat.SetFormatAttr(aLRMargin);
- rFormat.SetFormatAttr(aULMargin);
-
- // Header and footer
- rFormat.SetFormatAttr(SwFormatHeader(false));
- aDesc.ChgHeaderShare(false);
- rFormat.SetFormatAttr(SwFormatFooter(false));
- aDesc.ChgFooterShare(false);
-
- aDesc.SetUseOn(UseOnPage::All); // Site numbering
-
- // Set page size
- long lPgWidth, lPgHeight;
- lPgWidth = (rItem.m_lPWidth > MINLAY ? rItem.m_lPWidth : MINLAY);
- lPgHeight = (rItem.m_lPHeight > MINLAY ? rItem.m_lPHeight : MINLAY);
- rFormat.SetFormatAttr( SwFormatFrameSize( ATT_FIX_SIZE, lPgWidth, lPgHeight ));
- // Numbering type
- SvxNumberType aType;
- aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
- aDesc.SetNumType( aType );
-
- // Followup template
- const SwPageDesc &rFollow = pSh->GetPageDesc( pSh->GetCurPageDesc() );
- aDesc.SetFollow( &rFollow );
-
- pPrt = pSh->getIDocumentDeviceAccess().getPrinter( true );
- SvxPaperBinItem aItem( RES_PAPER_BIN );
- aItem.SetValue((sal_Int8)pPrt->GetPaperBin());
- rFormat.SetFormatAttr(aItem);
-
- // Determine orientation of the resulting page
- aDesc.SetLandscape(rItem.m_lPWidth > rItem.m_lPHeight);
-
- pSh->ChgPageDesc( 0, aDesc );
-
- // Insert frame
- std::unique_ptr<SwFieldMgr> pFieldMgr(new SwFieldMgr);
- pFieldMgr->SetEvalExpFields(false);
-
- // Prepare border template
- SwFrameFormat* pFormat = pSh->GetFrameFormatFromPool( RES_POOLFRM_LABEL );
- sal_Int32 iResultWidth = rItem.m_lLeft + (rItem.m_nCols - 1) * rItem.m_lHDist + rItem.m_lWidth - rItem.m_lPWidth;
- sal_Int32 iResultHeight = rItem.m_lUpper + (rItem.m_nRows - 1) * rItem.m_lVDist + rItem.m_lHeight - rItem.m_lPHeight;
- sal_Int32 iWidth = (iResultWidth > 0 ? rItem.m_lWidth - (iResultWidth / rItem.m_nCols) - 1 : rItem.m_lWidth);
- sal_Int32 iHeight = (iResultHeight > 0 ? rItem.m_lHeight - (iResultHeight / rItem.m_nRows) - 1 : rItem.m_lHeight);
- SwFormatFrameSize aFrameSize( ATT_FIX_SIZE, iWidth, iHeight );
- pFormat->SetFormatAttr( aFrameSize );
-
- //frame represents label itself, no border space
- SvxULSpaceItem aFrameNoULSpace( 0, 0, RES_UL_SPACE );
- SvxLRSpaceItem aFrameNoLRSpace( 0, 0, 0, 0, RES_LR_SPACE );
- pFormat->SetFormatAttr( aFrameNoULSpace );
- pFormat->SetFormatAttr( aFrameNoLRSpace );
-
- const SwFrameFormat *pFirstFlyFormat = nullptr;
- if ( rItem.m_bPage )
- {
- SwFormatVertOrient aFrameVertOrient( pFormat->GetVertOrient() );
- aFrameVertOrient.SetVertOrient( text::VertOrientation::TOP );
- pFormat->SetFormatAttr(aFrameVertOrient);
+ SwFormatVertOrient aFrameVertOrient( pFormat->GetVertOrient() );
+ aFrameVertOrient.SetVertOrient( text::VertOrientation::TOP );
+ pFormat->SetFormatAttr(aFrameVertOrient);
- for ( sal_Int32 i = 0; i < rItem.m_nRows; ++i )
+ for ( sal_Int32 i = 0; i < rItem.m_nRows; ++i )
+ {
+ for ( sal_Int32 j = 0; j < rItem.m_nCols; ++j )
{
- for ( sal_Int32 j = 0; j < rItem.m_nCols; ++j )
+ pSh->Push();
+ const SwFrameFormat *pTmp = ( bLabel ?
+ lcl_InsertLabText( *pSh, rItem, *pFormat, *pFieldMgr, j, i,
+ i == rItem.m_nRows - 1 && j == rItem.m_nCols - 1 ) :
+ lcl_InsertBCText( *pSh, rItem, *pFormat, j, i ) );
+ if (!(i|j))
{
- pSh->Push();
- const SwFrameFormat *pTmp = ( bLabel ?
- lcl_InsertLabText( *pSh, rItem, *pFormat, *pFieldMgr, j, i,
- i == rItem.m_nRows - 1 && j == rItem.m_nCols - 1 ) :
- lcl_InsertBCText( *pSh, rItem, *pFormat, j, i ) );
- if (!(i|j))
- {
- pFirstFlyFormat = pTmp;
-
- if (rItem.m_bSynchron)
- {
- // if there is no content in the fly then
- // don't leave the fly!!!
- pSh->Push();
- pSh->SttDoc();
- bool bInFly = nullptr != pSh->WizardGetFly();
- pSh->Pop((bInFly) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
-
- if( bInFly )
- pSh->EndDoc(true); // select all content
- // in the fly
- else
- pSh->SetMark(); // set only the mark
-
- SwSectionData aSect(CONTENT_SECTION, MASTER_LABEL);
- pSh->InsertSection(aSect);
- }
- }
- else if (rItem.m_bSynchron)
+ pFirstFlyFormat = pTmp;
+
+ if (rItem.m_bSynchron)
{
- SwSectionData aSect(FILE_LINK_SECTION,
- pSh->GetUniqueSectionName());
- OUStringBuffer sLinkName;
- sLinkName.append(sfx2::cTokenSeparator);
- sLinkName.append(sfx2::cTokenSeparator);
- sLinkName.append(MASTER_LABEL);
- aSect.SetLinkFileName(sLinkName.makeStringAndClear());
- aSect.SetProtectFlag(true);
- pSh->Insert("."); // Dummytext to allocate the Section
+ // if there is no content in the fly then
+ // don't leave the fly!!!
+ pSh->Push();
pSh->SttDoc();
- pSh->EndDoc(true); // Select everything in the frame
+ bool bInFly = nullptr != pSh->WizardGetFly();
+ pSh->Pop((bInFly) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
+
+ if( bInFly )
+ pSh->EndDoc(true); // select all content
+ // in the fly
+ else
+ pSh->SetMark(); // set only the mark
+
+ SwSectionData aSect(CONTENT_SECTION, MASTER_LABEL);
pSh->InsertSection(aSect);
}
- pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
}
+ else if (rItem.m_bSynchron)
+ {
+ SwSectionData aSect(FILE_LINK_SECTION,
+ pSh->GetUniqueSectionName());
+ OUStringBuffer sLinkName;
+ sLinkName.append(sfx2::cTokenSeparator);
+ sLinkName.append(sfx2::cTokenSeparator);
+ sLinkName.append(MASTER_LABEL);
+ aSect.SetLinkFileName(sLinkName.makeStringAndClear());
+ aSect.SetProtectFlag(true);
+ pSh->Insert("."); // Dummytext to allocate the Section
+ pSh->SttDoc();
+ pSh->EndDoc(true); // Select everything in the frame
+ pSh->InsertSection(aSect);
+ }
+ pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
}
}
- else
- {
- pFirstFlyFormat = bLabel ?
- lcl_InsertLabText( *pSh, rItem, *pFormat, *pFieldMgr,
- static_cast< sal_uInt16 >(rItem.m_nCol - 1),
- static_cast< sal_uInt16 >(rItem.m_nRow - 1), true ) :
- lcl_InsertBCText(*pSh, rItem, *pFormat,
- static_cast< sal_uInt16 >(rItem.m_nCol - 1),
- static_cast< sal_uInt16 >(rItem.m_nRow - 1));
- }
+ }
+ else
+ {
+ pFirstFlyFormat = bLabel ?
+ lcl_InsertLabText( *pSh, rItem, *pFormat, *pFieldMgr,
+ static_cast< sal_uInt16 >(rItem.m_nCol - 1),
+ static_cast< sal_uInt16 >(rItem.m_nRow - 1), true ) :
+ lcl_InsertBCText(*pSh, rItem, *pFormat,
+ static_cast< sal_uInt16 >(rItem.m_nCol - 1),
+ static_cast< sal_uInt16 >(rItem.m_nRow - 1));
+ }
- //fill the user fields
- if(!bLabel)
- {
- uno::Reference< frame::XModel > xModel = pSh->GetView().GetDocShell()->GetBaseModel();
- OSL_ENSURE(pDialogFactory, "SwAbstractDialogFactory fail!");
- SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod ();
- SwLabDlgUpdateFieldInformation(xModel, rItem);
- }
+ //fill the user fields
+ if(!bLabel)
+ {
+ uno::Reference< frame::XModel > xModel = pSh->GetView().GetDocShell()->GetBaseModel();
+ OSL_ENSURE(pDialogFactory, "SwAbstractDialogFactory fail!");
+ SwLabDlgMethod SwLabDlgUpdateFieldInformation = pDialogFactory->GetSwLabDlgStaticMethod ();
+ SwLabDlgUpdateFieldInformation(xModel, rItem);
+ }
- pFieldMgr->SetEvalExpFields(true);
- pFieldMgr->EvalExpFields(pSh);
+ pFieldMgr->SetEvalExpFields(true);
+ pFieldMgr->EvalExpFields(pSh);
- pFieldMgr.reset();
+ pFieldMgr.reset();
- if (pFirstFlyFormat)
- pSh->GotoFly(pFirstFlyFormat->GetName(), FLYCNTTYPE_ALL, false);
+ if (pFirstFlyFormat)
+ pSh->GotoFly(pFirstFlyFormat->GetName(), FLYCNTTYPE_ALL, false);
- pSh->EndAllAction();
- pSh->DoUndo();
- }
+ pSh->EndAllAction();
+ pSh->DoUndo();
+ }
- if( rItem.m_aWriting.indexOf( '<' ) >= 0 )
- {
- // Open database browser on recently used database
- ShowDBObj( *pNewView, pSh->GetDBData() );
- }
+ if( rItem.m_aWriting.indexOf( '<' ) >= 0 )
+ {
+ // Open database browser on recently used database
+ ShowDBObj( *pNewView, pSh->GetDBData() );
+ }
- if( rItem.m_bSynchron )
- {
- SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
- assert(pDisp && "No dispatcher in frame?");
- pDisp->Execute(FN_SYNC_LABELS, SfxCallMode::ASYNCHRON);
- }
- rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
+ if( rItem.m_bSynchron )
+ {
+ SfxDispatcher* pDisp = pViewFrame->GetDispatcher();
+ assert(pDisp && "No dispatcher in frame?");
+ pDisp->Execute(FN_SYNC_LABELS, SfxCallMode::ASYNCHRON);
}
+ rReq.SetReturnValue(SfxVoidItem(bLabel ? FN_LABEL : FN_BUSINESS_CARD));
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/dialog/regionsw.cxx b/sw/source/uibase/dialog/regionsw.cxx
index 3e55705254ae..4d4185104699 100644
--- a/sw/source/uibase/dialog/regionsw.cxx
+++ b/sw/source/uibase/dialog/regionsw.cxx
@@ -177,29 +177,30 @@ IMPL_LINK( SwWrtShell, InsertRegionDialog, void*, p, void )
{
SwSectionData* pSect = static_cast<SwSectionData*>(p);
std::unique_ptr<SwSectionData> xSectionData(pSect);
- if (xSectionData.get())
- {
- SfxItemSet aSet(
- GetView().GetPool(),
- svl::Items<
- RES_FRM_SIZE, RES_FRM_SIZE,
- RES_BACKGROUND, RES_BACKGROUND,
- RES_COL, RES_COL,
- SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE>{});
- SwRect aRect;
- CalcBoundRect(aRect, RndStdIds::FLY_AS_CHAR);
- long nWidth = aRect.Width();
- aSet.Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth));
- // height=width for more consistent preview (analog to edit region)
- aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "Dialog creation failed!");
- ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
- &GetView().GetViewFrame()->GetWindow(),aSet , *this));
- OSL_ENSURE(aTabDlg, "Dialog creation failed!");
- aTabDlg->SetSectionData(*xSectionData);
- aTabDlg->Execute();
- }
+ if (!xSectionData.get())
+ return;
+
+ SfxItemSet aSet(
+ GetView().GetPool(),
+ svl::Items<
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_BACKGROUND, RES_BACKGROUND,
+ RES_COL, RES_COL,
+ SID_ATTR_PAGE_SIZE, SID_ATTR_PAGE_SIZE>{});
+ SwRect aRect;
+ CalcBoundRect(aRect, RndStdIds::FLY_AS_CHAR);
+ long nWidth = aRect.Width();
+ aSet.Put(SwFormatFrameSize(ATT_VAR_SIZE, nWidth));
+ // height=width for more consistent preview (analog to edit region)
+ aSet.Put(SvxSizeItem(SID_ATTR_PAGE_SIZE, Size(nWidth, nWidth)));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ OSL_ENSURE(pFact, "Dialog creation failed!");
+ ScopedVclPtr<AbstractInsertSectionTabDialog> aTabDlg(pFact->CreateInsertSectionTabDialog(
+ &GetView().GetViewFrame()->GetWindow(),aSet , *this));
+ OSL_ENSURE(aTabDlg, "Dialog creation failed!");
+ aTabDlg->SetSectionData(*xSectionData);
+ aTabDlg->Execute();
+
}
void SwBaseShell::EditRegionDialog(SfxRequest const & rReq)
diff --git a/sw/source/uibase/docvw/AnnotationWin2.cxx b/sw/source/uibase/docvw/AnnotationWin2.cxx
index 182f19cc91b9..e7a76574bf22 100644
--- a/sw/source/uibase/docvw/AnnotationWin2.cxx
+++ b/sw/source/uibase/docvw/AnnotationWin2.cxx
@@ -310,26 +310,27 @@ void SwAnnotationWin::Draw(OutputDevice* pDev, const Point& rPt, const Size& rSz
pProcessor->process(mpTextRangeOverlay->getOverlayObjectPrimitive2DSequence());
pProcessor.reset();
- if (mpVScrollbar->IsVisible())
- {
- vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
- Color aOrigBg( mpMetadataDate->GetControlBackground() );
- OUString sOrigText(mpMetadataDate->GetText());
+ if (!mpVScrollbar->IsVisible())
+ return;
- Size aSize(PixelToLogic(mpMenuButton->GetSizePixel()));
- Point aPos(PixelToLogic(mpMenuButton->GetPosPixel()));
- aPos += rPt;
+ vcl::Font aOrigFont(mpMetadataDate->GetControlFont());
+ Color aOrigBg( mpMetadataDate->GetControlBackground() );
+ OUString sOrigText(mpMetadataDate->GetText());
- vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
- mpMetadataDate->SetControlFont( aFont );
- mpMetadataDate->SetControlBackground( 0xFFFFFF );
- mpMetadataDate->SetText("...");
- mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags);
+ Size aSize(PixelToLogic(mpMenuButton->GetSizePixel()));
+ Point aPos(PixelToLogic(mpMenuButton->GetPosPixel()));
+ aPos += rPt;
+
+ vcl::Font aFont( mpMetadataDate->GetSettings().GetStyleSettings().GetFieldFont() );
+ mpMetadataDate->SetControlFont( aFont );
+ mpMetadataDate->SetControlBackground( 0xFFFFFF );
+ mpMetadataDate->SetText("...");
+ mpMetadataDate->Draw(pDev, aPos, aSize, nInFlags);
+
+ mpMetadataDate->SetText(sOrigText);
+ mpMetadataDate->SetControlFont( aOrigFont );
+ mpMetadataDate->SetControlBackground( aOrigBg );
- mpMetadataDate->SetText(sOrigText);
- mpMetadataDate->SetControlFont( aOrigFont );
- mpMetadataDate->SetControlBackground( aOrigBg );
- }
}
void SwAnnotationWin::KeyInput(const KeyEvent& rKeyEvent)
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 803e959499df..41625b23fbfc 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -855,135 +855,136 @@ static sal_uInt16 lcl_isNonDefaultLanguage(LanguageType eBufferLanguage, SwView
*/
void SwEditWin::FlushInBuffer()
{
- if ( !m_aInBuffer.isEmpty() )
- {
- SwWrtShell& rSh = m_rView.GetWrtShell();
+ if ( m_aInBuffer.isEmpty() )
+ return;
- // generate new sequence input checker if not already done
- if ( !pCheckIt )
- pCheckIt = new SwCheckIt;
+ SwWrtShell& rSh = m_rView.GetWrtShell();
- uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = pCheckIt->xCheck;
- if ( xISC.is() && IsInputSequenceCheckingRequired( m_aInBuffer, *rSh.GetCursor() ) )
- {
+ // generate new sequence input checker if not already done
+ if ( !pCheckIt )
+ pCheckIt = new SwCheckIt;
- // apply (Thai) input sequence checking/correction
+ uno::Reference < i18n::XExtendedInputSequenceChecker > xISC = pCheckIt->xCheck;
+ if ( xISC.is() && IsInputSequenceCheckingRequired( m_aInBuffer, *rSh.GetCursor() ) )
+ {
- rSh.Push(); // push current cursor to stack
+ // apply (Thai) input sequence checking/correction
- // get text from the beginning (i.e left side) of current selection
- // to the start of the paragraph
- rSh.NormalizePam(); // make point be the first (left) one
- if (!rSh.GetCursor()->HasMark())
- rSh.GetCursor()->SetMark();
- rSh.GetCursor()->GetMark()->nContent = 0;
+ rSh.Push(); // push current cursor to stack
- const OUString aOldText( rSh.GetCursor()->GetText() );
- const sal_Int32 nOldLen = aOldText.getLength();
+ // get text from the beginning (i.e left side) of current selection
+ // to the start of the paragraph
+ rSh.NormalizePam(); // make point be the first (left) one
+ if (!rSh.GetCursor()->HasMark())
+ rSh.GetCursor()->SetMark();
+ rSh.GetCursor()->GetMark()->nContent = 0;
- SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+ const OUString aOldText( rSh.GetCursor()->GetText() );
+ const sal_Int32 nOldLen = aOldText.getLength();
- sal_Int32 nExpandSelection = 0;
- if (nOldLen > 0)
- {
- sal_Int32 nTmpPos = nOldLen;
- sal_Int16 nCheckMode = rCTLOptions.IsCTLSequenceCheckingRestricted() ?
- i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
+ SvtCTLOptions& rCTLOptions = SW_MOD()->GetCTLOptions();
+
+ sal_Int32 nExpandSelection = 0;
+ if (nOldLen > 0)
+ {
+ sal_Int32 nTmpPos = nOldLen;
+ sal_Int16 nCheckMode = rCTLOptions.IsCTLSequenceCheckingRestricted() ?
+ i18n::InputSequenceCheckMode::STRICT : i18n::InputSequenceCheckMode::BASIC;
- OUString aNewText( aOldText );
- if (rCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
+ OUString aNewText( aOldText );
+ if (rCTLOptions.IsCTLSequenceCheckingTypeAndReplace())
+ {
+ for( sal_Int32 k = 0; k < m_aInBuffer.getLength(); ++k)
{
- for( sal_Int32 k = 0; k < m_aInBuffer.getLength(); ++k)
- {
- const sal_Unicode cChar = m_aInBuffer[k];
- const sal_Int32 nPrevPos =xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode );
+ const sal_Unicode cChar = m_aInBuffer[k];
+ const sal_Int32 nPrevPos =xISC->correctInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode );
- // valid sequence or sequence could be corrected:
- if (nPrevPos != aNewText.getLength())
- nTmpPos = nPrevPos + 1;
- }
+ // valid sequence or sequence could be corrected:
+ if (nPrevPos != aNewText.getLength())
+ nTmpPos = nPrevPos + 1;
+ }
- // find position of first character that has changed
- sal_Int32 nNewLen = aNewText.getLength();
- const sal_Unicode *pOldText = aOldText.getStr();
- const sal_Unicode *pNewText = aNewText.getStr();
- sal_Int32 nChgPos = 0;
- while ( nChgPos < nOldLen && nChgPos < nNewLen &&
- pOldText[nChgPos] == pNewText[nChgPos] )
- ++nChgPos;
-
- const sal_Int32 nChgLen = nNewLen - nChgPos;
- if (nChgLen)
- {
- m_aInBuffer = aNewText.copy( nChgPos, nChgLen );
- nExpandSelection = nOldLen - nChgPos;
- }
- else
- m_aInBuffer.clear();
+ // find position of first character that has changed
+ sal_Int32 nNewLen = aNewText.getLength();
+ const sal_Unicode *pOldText = aOldText.getStr();
+ const sal_Unicode *pNewText = aNewText.getStr();
+ sal_Int32 nChgPos = 0;
+ while ( nChgPos < nOldLen && nChgPos < nNewLen &&
+ pOldText[nChgPos] == pNewText[nChgPos] )
+ ++nChgPos;
+
+ const sal_Int32 nChgLen = nNewLen - nChgPos;
+ if (nChgLen)
+ {
+ m_aInBuffer = aNewText.copy( nChgPos, nChgLen );
+ nExpandSelection = nOldLen - nChgPos;
}
else
+ m_aInBuffer.clear();
+ }
+ else
+ {
+ for( sal_Int32 k = 0; k < m_aInBuffer.getLength(); ++k )
{
- for( sal_Int32 k = 0; k < m_aInBuffer.getLength(); ++k )
+ const sal_Unicode cChar = m_aInBuffer[k];
+ if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ))
{
- const sal_Unicode cChar = m_aInBuffer[k];
- if (xISC->checkInputSequence( aNewText, nTmpPos - 1, cChar, nCheckMode ))
- {
- // character can be inserted:
- aNewText += OUStringLiteral1( cChar );
- ++nTmpPos;
- }
+ // character can be inserted:
+ aNewText += OUStringLiteral1( cChar );
+ ++nTmpPos;
}
- m_aInBuffer = aNewText.copy( aOldText.getLength() ); // copy new text to be inserted to buffer
}
+ m_aInBuffer = aNewText.copy( aOldText.getLength() ); // copy new text to be inserted to buffer
}
+ }
- // at this point now we will insert the buffer text 'normally' some lines below...
-
- rSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
+ // at this point now we will insert the buffer text 'normally' some lines below...
- if (m_aInBuffer.isEmpty())
- return;
+ rSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
- // if text prior to the original selection needs to be changed
- // as well, we now expand the selection accordingly.
- SwPaM &rCursor = *rSh.GetCursor();
- const sal_Int32 nCursorStartPos = rCursor.Start()->nContent.GetIndex();
- OSL_ENSURE( nCursorStartPos >= nExpandSelection, "cannot expand selection as specified!!" );
- if (nExpandSelection && nCursorStartPos >= nExpandSelection)
- {
- if (!rCursor.HasMark())
- rCursor.SetMark();
- rCursor.Start()->nContent -= nExpandSelection;
- }
- }
+ if (m_aInBuffer.isEmpty())
+ return;
- uno::Reference< frame::XDispatchRecorder > xRecorder =
- m_rView.GetViewFrame()->GetBindings().GetRecorder();
- if ( xRecorder.is() )
+ // if text prior to the original selection needs to be changed
+ // as well, we now expand the selection accordingly.
+ SwPaM &rCursor = *rSh.GetCursor();
+ const sal_Int32 nCursorStartPos = rCursor.Start()->nContent.GetIndex();
+ OSL_ENSURE( nCursorStartPos >= nExpandSelection, "cannot expand selection as specified!!" );
+ if (nExpandSelection && nCursorStartPos >= nExpandSelection)
{
- // determine shell
- SfxShell *pSfxShell = lcl_GetTextShellFromDispatcher( m_rView );
- // generate request and record
- if (pSfxShell)
- {
- SfxRequest aReq( m_rView.GetViewFrame(), FN_INSERT_STRING );
- aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, m_aInBuffer ) );
- aReq.Done();
- }
+ if (!rCursor.HasMark())
+ rCursor.SetMark();
+ rCursor.Start()->nContent -= nExpandSelection;
}
+ }
- sal_uInt16 nWhich = lcl_isNonDefaultLanguage(m_eBufferLanguage, m_rView, m_aInBuffer);
- if (nWhich != INVALID_HINT )
+ uno::Reference< frame::XDispatchRecorder > xRecorder =
+ m_rView.GetViewFrame()->GetBindings().GetRecorder();
+ if ( xRecorder.is() )
+ {
+ // determine shell
+ SfxShell *pSfxShell = lcl_GetTextShellFromDispatcher( m_rView );
+ // generate request and record
+ if (pSfxShell)
{
- SvxLanguageItem aLangItem( m_eBufferLanguage, nWhich );
- rSh.SetAttrItem( aLangItem );
+ SfxRequest aReq( m_rView.GetViewFrame(), FN_INSERT_STRING );
+ aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, m_aInBuffer ) );
+ aReq.Done();
}
+ }
- rSh.Insert( m_aInBuffer );
- m_eBufferLanguage = LANGUAGE_DONTKNOW;
- m_aInBuffer.clear();
- g_bFlushCharBuffer = false;
+ sal_uInt16 nWhich = lcl_isNonDefaultLanguage(m_eBufferLanguage, m_rView, m_aInBuffer);
+ if (nWhich != INVALID_HINT )
+ {
+ SvxLanguageItem aLangItem( m_eBufferLanguage, nWhich );
+ rSh.SetAttrItem( aLangItem );
}
+
+ rSh.Insert( m_aInBuffer );
+ m_eBufferLanguage = LANGUAGE_DONTKNOW;
+ m_aInBuffer.clear();
+ g_bFlushCharBuffer = false;
+
}
#define MOVE_LEFT_SMALL 0
@@ -1005,183 +1006,184 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
{
SwWrtShell &rSh = m_rView.GetWrtShell();
SwRect aTmp = rSh.GetFlyRect();
- if( aTmp.HasArea() &&
- rSh.IsSelObjProtected( FlyProtectFlags::Pos ) == FlyProtectFlags::NONE )
- {
- SfxItemSet aSet(
- rSh.GetAttrPool(),
- svl::Items<
- RES_FRM_SIZE, RES_FRM_SIZE,
- RES_PROTECT, RES_PROTECT,
- RES_VERT_ORIENT, RES_ANCHOR,
- RES_COL, RES_COL,
- RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW>{});
- rSh.GetFlyFrameAttr( aSet );
- RndStdIds eAnchorId = static_cast<const SwFormatAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId();
- Size aSnap;
- bool bHuge(MOVE_LEFT_HUGE == nDir ||
- MOVE_UP_HUGE == nDir ||
- MOVE_RIGHT_HUGE == nDir ||
- MOVE_DOWN_HUGE == nDir);
-
- if(MOVE_LEFT_SMALL == nDir ||
- MOVE_UP_SMALL == nDir ||
- MOVE_RIGHT_SMALL == nDir ||
- MOVE_DOWN_SMALL == nDir )
- {
- aSnap = PixelToLogic(Size(1,1));
- }
- else
- {
- aSnap = rSh.GetViewOptions()->GetSnapSize();
- short nDiv = rSh.GetViewOptions()->GetDivisionX();
- if ( nDiv > 0 )
- aSnap.Width() = std::max( (sal_uLong)1, (sal_uLong)aSnap.Width() / nDiv );
- nDiv = rSh.GetViewOptions()->GetDivisionY();
- if ( nDiv > 0 )
- aSnap.Height() = std::max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
- }
+ if( !aTmp.HasArea() ||
+ rSh.IsSelObjProtected( FlyProtectFlags::Pos ) != FlyProtectFlags::NONE )
+ return;
- if(bHuge)
- {
- // #i121236# 567twips == 1cm, but just take three times the normal snap
- aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
- }
+ SfxItemSet aSet(
+ rSh.GetAttrPool(),
+ svl::Items<
+ RES_FRM_SIZE, RES_FRM_SIZE,
+ RES_PROTECT, RES_PROTECT,
+ RES_VERT_ORIENT, RES_ANCHOR,
+ RES_COL, RES_COL,
+ RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW>{});
+ rSh.GetFlyFrameAttr( aSet );
+ RndStdIds eAnchorId = static_cast<const SwFormatAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId();
+ Size aSnap;
+ bool bHuge(MOVE_LEFT_HUGE == nDir ||
+ MOVE_UP_HUGE == nDir ||
+ MOVE_RIGHT_HUGE == nDir ||
+ MOVE_DOWN_HUGE == nDir);
- SwRect aBoundRect;
- Point aRefPoint;
- // adjustment for allowing vertical position
- // aligned to page for fly frame anchored to paragraph or to character.
- {
- SwFormatVertOrient aVert( static_cast<const SwFormatVertOrient&>(aSet.Get(RES_VERT_ORIENT)) );
- const bool bFollowTextFlow =
- static_cast<const SwFormatFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
- const SwPosition* pToCharContentPos = static_cast<const SwFormatAnchor&>(aSet.Get(RES_ANCHOR)).GetContentAnchor();
- rSh.CalcBoundRect( aBoundRect, eAnchorId,
- text::RelOrientation::FRAME, aVert.GetRelationOrient(),
- pToCharContentPos, bFollowTextFlow,
- false, &aRefPoint );
- }
- long nLeft = std::min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() );
- long nRight = std::min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() );
- long nUp = std::min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() );
- long nDown = std::min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() );
+ if(MOVE_LEFT_SMALL == nDir ||
+ MOVE_UP_SMALL == nDir ||
+ MOVE_RIGHT_SMALL == nDir ||
+ MOVE_DOWN_SMALL == nDir )
+ {
+ aSnap = PixelToLogic(Size(1,1));
+ }
+ else
+ {
+ aSnap = rSh.GetViewOptions()->GetSnapSize();
+ short nDiv = rSh.GetViewOptions()->GetDivisionX();
+ if ( nDiv > 0 )
+ aSnap.Width() = std::max( (sal_uLong)1, (sal_uLong)aSnap.Width() / nDiv );
+ nDiv = rSh.GetViewOptions()->GetDivisionY();
+ if ( nDiv > 0 )
+ aSnap.Height() = std::max( (sal_uLong)1, (sal_uLong)aSnap.Height() / nDiv );
+ }
- switch ( nDir )
- {
- case MOVE_LEFT_BIG:
- case MOVE_LEFT_HUGE:
- case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft );
- break;
+ if(bHuge)
+ {
+ // #i121236# 567twips == 1cm, but just take three times the normal snap
+ aSnap = Size(aSnap.Width() * 3, aSnap.Height() * 3);
+ }
- case MOVE_UP_BIG:
- case MOVE_UP_HUGE:
- case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp );
- break;
+ SwRect aBoundRect;
+ Point aRefPoint;
+ // adjustment for allowing vertical position
+ // aligned to page for fly frame anchored to paragraph or to character.
+ {
+ SwFormatVertOrient aVert( static_cast<const SwFormatVertOrient&>(aSet.Get(RES_VERT_ORIENT)) );
+ const bool bFollowTextFlow =
+ static_cast<const SwFormatFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
+ const SwPosition* pToCharContentPos = static_cast<const SwFormatAnchor&>(aSet.Get(RES_ANCHOR)).GetContentAnchor();
+ rSh.CalcBoundRect( aBoundRect, eAnchorId,
+ text::RelOrientation::FRAME, aVert.GetRelationOrient(),
+ pToCharContentPos, bFollowTextFlow,
+ false, &aRefPoint );
+ }
+ long nLeft = std::min( aTmp.Left() - aBoundRect.Left(), aSnap.Width() );
+ long nRight = std::min( aBoundRect.Right() - aTmp.Right(), aSnap.Width() );
+ long nUp = std::min( aTmp.Top() - aBoundRect.Top(), aSnap.Height() );
+ long nDown = std::min( aBoundRect.Bottom() - aTmp.Bottom(), aSnap.Height() );
- case MOVE_RIGHT_SMALL:
- if( aTmp.Width() < aSnap.Width() + MINFLY )
- break;
- nRight = aSnap.Width();
- SAL_FALLTHROUGH;
- case MOVE_RIGHT_HUGE:
- case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight );
+ switch ( nDir )
+ {
+ case MOVE_LEFT_BIG:
+ case MOVE_LEFT_HUGE:
+ case MOVE_LEFT_SMALL: aTmp.Left( aTmp.Left() - nLeft );
+ break;
+
+ case MOVE_UP_BIG:
+ case MOVE_UP_HUGE:
+ case MOVE_UP_SMALL: aTmp.Top( aTmp.Top() - nUp );
+ break;
+
+ case MOVE_RIGHT_SMALL:
+ if( aTmp.Width() < aSnap.Width() + MINFLY )
break;
+ nRight = aSnap.Width();
+ SAL_FALLTHROUGH;
+ case MOVE_RIGHT_HUGE:
+ case MOVE_RIGHT_BIG: aTmp.Left( aTmp.Left() + nRight );
+ break;
- case MOVE_DOWN_SMALL:
- if( aTmp.Height() < aSnap.Height() + MINFLY )
- break;
- nDown = aSnap.Height();
- SAL_FALLTHROUGH;
- case MOVE_DOWN_HUGE:
- case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown );
+ case MOVE_DOWN_SMALL:
+ if( aTmp.Height() < aSnap.Height() + MINFLY )
break;
+ nDown = aSnap.Height();
+ SAL_FALLTHROUGH;
+ case MOVE_DOWN_HUGE:
+ case MOVE_DOWN_BIG: aTmp.Top( aTmp.Top() + nDown );
+ break;
- default: OSL_ENSURE(true, "ChangeFly: Unknown direction." );
- }
- bool bSet = false;
- if ((RndStdIds::FLY_AS_CHAR == eAnchorId) && ( nDir % 2 ))
- {
- long aDiff = aTmp.Top() - aRefPoint.Y();
- if( aDiff > 0 )
- aDiff = 0;
- else if ( aDiff < -aTmp.Height() )
- aDiff = -aTmp.Height();
- SwFormatVertOrient aVert( static_cast<const SwFormatVertOrient&>(aSet.Get(RES_VERT_ORIENT)) );
- sal_Int16 eNew;
- if( bWeb )
- {
- eNew = aVert.GetVertOrient();
- bool bDown = 0 != ( nDir & 0x02 );
- switch( eNew )
- {
- case text::VertOrientation::CHAR_TOP:
- if( bDown ) eNew = text::VertOrientation::CENTER;
- break;
- case text::VertOrientation::CENTER:
- eNew = bDown ? text::VertOrientation::TOP : text::VertOrientation::CHAR_TOP;
- break;
- case text::VertOrientation::TOP:
- if( !bDown ) eNew = text::VertOrientation::CENTER;
- break;
- case text::VertOrientation::LINE_TOP:
- if( bDown ) eNew = text::VertOrientation::LINE_CENTER;
- break;
- case text::VertOrientation::LINE_CENTER:
- eNew = bDown ? text::VertOrientation::LINE_BOTTOM : text::VertOrientation::LINE_TOP;
- break;
- case text::VertOrientation::LINE_BOTTOM:
- if( !bDown ) eNew = text::VertOrientation::LINE_CENTER;
- break;
- default:; //prevent warning
- }
- }
- else
- {
- aVert.SetPos( aDiff );
- eNew = text::VertOrientation::NONE;
- }
- aVert.SetVertOrient( eNew );
- aSet.Put( aVert );
- bSet = true;
- }
- if (bWeb && (RndStdIds::FLY_AT_PARA == eAnchorId)
- && ( nDir==MOVE_LEFT_SMALL || nDir==MOVE_RIGHT_BIG ))
+ default: OSL_ENSURE(true, "ChangeFly: Unknown direction." );
+ }
+ bool bSet = false;
+ if ((RndStdIds::FLY_AS_CHAR == eAnchorId) && ( nDir % 2 ))
+ {
+ long aDiff = aTmp.Top() - aRefPoint.Y();
+ if( aDiff > 0 )
+ aDiff = 0;
+ else if ( aDiff < -aTmp.Height() )
+ aDiff = -aTmp.Height();
+ SwFormatVertOrient aVert( static_cast<const SwFormatVertOrient&>(aSet.Get(RES_VERT_ORIENT)) );
+ sal_Int16 eNew;
+ if( bWeb )
{
- SwFormatHoriOrient aHori( static_cast<const SwFormatHoriOrient&>(aSet.Get(RES_HORI_ORIENT)) );
- sal_Int16 eNew;
- eNew = aHori.GetHoriOrient();
+ eNew = aVert.GetVertOrient();
+ bool bDown = 0 != ( nDir & 0x02 );
switch( eNew )
{
- case text::HoriOrientation::RIGHT:
- if( nDir==MOVE_LEFT_SMALL )
- eNew = text::HoriOrientation::LEFT;
+ case text::VertOrientation::CHAR_TOP:
+ if( bDown ) eNew = text::VertOrientation::CENTER;
+ break;
+ case text::VertOrientation::CENTER:
+ eNew = bDown ? text::VertOrientation::TOP : text::VertOrientation::CHAR_TOP;
+ break;
+ case text::VertOrientation::TOP:
+ if( !bDown ) eNew = text::VertOrientation::CENTER;
+ break;
+ case text::VertOrientation::LINE_TOP:
+ if( bDown ) eNew = text::VertOrientation::LINE_CENTER;
+ break;
+ case text::VertOrientation::LINE_CENTER:
+ eNew = bDown ? text::VertOrientation::LINE_BOTTOM : text::VertOrientation::LINE_TOP;
break;
- case text::HoriOrientation::LEFT:
- if( nDir==MOVE_RIGHT_BIG )
- eNew = text::HoriOrientation::RIGHT;
+ case text::VertOrientation::LINE_BOTTOM:
+ if( !bDown ) eNew = text::VertOrientation::LINE_CENTER;
break;
default:; //prevent warning
}
- if( eNew != aHori.GetHoriOrient() )
- {
- aHori.SetHoriOrient( eNew );
- aSet.Put( aHori );
- bSet = true;
- }
}
- rSh.StartAllAction();
- if( bSet )
- rSh.SetFlyFrameAttr( aSet );
- bool bSetPos = (RndStdIds::FLY_AS_CHAR != eAnchorId);
- if(bSetPos && bWeb)
+ else
{
- bSetPos = RndStdIds::FLY_AT_PAGE == eAnchorId;
+ aVert.SetPos( aDiff );
+ eNew = text::VertOrientation::NONE;
}
- if( bSetPos )
- rSh.SetFlyPos( aTmp.Pos() );
- rSh.EndAllAction();
+ aVert.SetVertOrient( eNew );
+ aSet.Put( aVert );
+ bSet = true;
}
+ if (bWeb && (RndStdIds::FLY_AT_PARA == eAnchorId)
+ && ( nDir==MOVE_LEFT_SMALL || nDir==MOVE_RIGHT_BIG ))
+ {
+ SwFormatHoriOrient aHori( static_cast<const SwFormatHoriOrient&>(aSet.Get(RES_HORI_ORIENT)) );
+ sal_Int16 eNew;
+ eNew = aHori.GetHoriOrient();
+ switch( eNew )
+ {
+ case text::HoriOrientation::RIGHT:
+ if( nDir==MOVE_LEFT_SMALL )
+ eNew = text::HoriOrientation::LEFT;
+ break;
+ case text::HoriOrientation::LEFT:
+ if( nDir==MOVE_RIGHT_BIG )
+ eNew = text::HoriOrientation::RIGHT;
+ break;
+ default:; //prevent warning
+ }
+ if( eNew != aHori.GetHoriOrient() )
+ {
+ aHori.SetHoriOrient( eNew );
+ aSet.Put( aHori );
+ bSet = true;
+ }
+ }
+ rSh.StartAllAction();
+ if( bSet )
+ rSh.SetFlyFrameAttr( aSet );
+ bool bSetPos = (RndStdIds::FLY_AS_CHAR != eAnchorId);
+ if(bSetPos && bWeb)
+ {
+ bSetPos = RndStdIds::FLY_AT_PAGE == eAnchorId;
+ }
+ if( bSetPos )
+ rSh.SetFlyPos( aTmp.Pos() );
+ rSh.EndAllAction();
+
}
void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index bf49abb9bf7c..965ae6446396 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -326,53 +326,54 @@ void SwSrcEditWindow::DataChanged( const DataChangedEvent& rDCEvt )
void SwSrcEditWindow::Resize()
{
// ScrollBars, etc. happens in Adjust...
- if ( m_pTextView )
+ if ( !m_pTextView )
+ return;
+
+ long nVisY = m_pTextView->GetStartDocPos().Y();
+ m_pTextView->ShowCursor();
+ Size aOutSz( GetOutputSizePixel() );
+ long nMaxVisAreaStart = m_pTextView->GetTextEngine()->GetTextHeight() - aOutSz.Height();
+ if ( nMaxVisAreaStart < 0 )
+ nMaxVisAreaStart = 0;
+ if ( m_pTextView->GetStartDocPos().Y() > nMaxVisAreaStart )
{
- long nVisY = m_pTextView->GetStartDocPos().Y();
+ Point aStartDocPos( m_pTextView->GetStartDocPos() );
+ aStartDocPos.Y() = nMaxVisAreaStart;
+ m_pTextView->SetStartDocPos( aStartDocPos );
m_pTextView->ShowCursor();
- Size aOutSz( GetOutputSizePixel() );
- long nMaxVisAreaStart = m_pTextView->GetTextEngine()->GetTextHeight() - aOutSz.Height();
- if ( nMaxVisAreaStart < 0 )
- nMaxVisAreaStart = 0;
- if ( m_pTextView->GetStartDocPos().Y() > nMaxVisAreaStart )
- {
- Point aStartDocPos( m_pTextView->GetStartDocPos() );
- aStartDocPos.Y() = nMaxVisAreaStart;
- m_pTextView->SetStartDocPos( aStartDocPos );
- m_pTextView->ShowCursor();
- }
- long nScrollStd = GetSettings().GetStyleSettings().GetScrollBarSize();
- Size aScrollSz(aOutSz.Width() - nScrollStd, nScrollStd );
- Point aScrollPos(0, aOutSz.Height() - nScrollStd);
+ }
+ long nScrollStd = GetSettings().GetStyleSettings().GetScrollBarSize();
+ Size aScrollSz(aOutSz.Width() - nScrollStd, nScrollStd );
+ Point aScrollPos(0, aOutSz.Height() - nScrollStd);
- m_pHScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
+ m_pHScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
- aScrollSz.Width() = aScrollSz.Height();
- aScrollSz.Height() = aOutSz.Height();
- aScrollPos = Point(aOutSz.Width() - nScrollStd, 0);
+ aScrollSz.Width() = aScrollSz.Height();
+ aScrollSz.Height() = aOutSz.Height();
+ aScrollPos = Point(aOutSz.Width() - nScrollStd, 0);
- m_pVScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
- aOutSz.Width() -= nScrollStd;
- aOutSz.Height() -= nScrollStd;
- m_pOutWin->SetOutputSizePixel(aOutSz);
- InitScrollBars();
+ m_pVScrollbar->SetPosSizePixel( aScrollPos, aScrollSz);
+ aOutSz.Width() -= nScrollStd;
+ aOutSz.Height() -= nScrollStd;
+ m_pOutWin->SetOutputSizePixel(aOutSz);
+ InitScrollBars();
- // set line in first Resize
- if(USHRT_MAX != m_nStartLine)
+ // set line in first Resize
+ if(USHRT_MAX != m_nStartLine)
+ {
+ if(m_nStartLine < m_pTextEngine->GetParagraphCount())
{
- if(m_nStartLine < m_pTextEngine->GetParagraphCount())
- {
- TextSelection aSel(TextPaM( m_nStartLine, 0 ), TextPaM( m_nStartLine, 0x0 ));
- m_pTextView->SetSelection(aSel);
- m_pTextView->ShowCursor();
- }
- m_nStartLine = USHRT_MAX;
+ TextSelection aSel(TextPaM( m_nStartLine, 0 ), TextPaM( m_nStartLine, 0x0 ));
+ m_pTextView->SetSelection(aSel);
+ m_pTextView->ShowCursor();
}
-
- if ( nVisY != m_pTextView->GetStartDocPos().Y() )
- Invalidate();
+ m_nStartLine = USHRT_MAX;
}
+ if ( nVisY != m_pTextView->GetStartDocPos().Y() )
+ Invalidate();
+
+
}
void TextViewOutWin::DataChanged( const DataChangedEvent& rDCEvt )
@@ -649,24 +650,25 @@ void SwSrcEditWindow::DoSyntaxHighlight( sal_uInt16 nPara )
{
// Because of DelayedSyntaxHighlight it could happen,
// that the line doesn't exist anymore!
- if ( nPara < m_pTextEngine->GetParagraphCount() )
- {
- bool bTempModified = IsModified();
- m_pTextEngine->RemoveAttribs( nPara );
- OUString aSource( m_pTextEngine->GetText( nPara ) );
- m_pTextEngine->SetUpdateMode( false );
- ImpDoHighlight( aSource, nPara );
- TextView* pTmp = m_pTextEngine->GetActiveView();
- pTmp->SetAutoScroll(false);
- m_pTextEngine->SetActiveView(nullptr);
- m_pTextEngine->SetUpdateMode( true );
- m_pTextEngine->SetActiveView(pTmp);
- pTmp->SetAutoScroll(true);
- pTmp->ShowCursor( false/*pTmp->IsAutoScroll()*/ );
-
- if(!bTempModified)
- ClearModifyFlag();
- }
+ if ( nPara >= m_pTextEngine->GetParagraphCount() )
+ return;
+
+ bool bTempModified = IsModified();
+ m_pTextEngine->RemoveAttribs( nPara );
+ OUString aSource( m_pTextEngine->GetText( nPara ) );
+ m_pTextEngine->SetUpdateMode( false );
+ ImpDoHighlight( aSource, nPara );
+ TextView* pTmp = m_pTextEngine->GetActiveView();
+ pTmp->SetAutoScroll(false);
+ m_pTextEngine->SetActiveView(nullptr);
+ m_pTextEngine->SetUpdateMode( true );
+ m_pTextEngine->SetActiveView(pTmp);
+ pTmp->SetAutoScroll(true);
+ pTmp->ShowCursor( false/*pTmp->IsAutoScroll()*/ );
+
+ if(!bTempModified)
+ ClearModifyFlag();
+
}
void SwSrcEditWindow::ImpDoHighlight( const OUString& rSource, sal_uInt16 nLineOff )
diff --git a/sw/source/uibase/envelp/labimg.cxx b/sw/source/uibase/envelp/labimg.cxx
index ab0cad1880e6..a89ea3dbdd46 100644
--- a/sw/source/uibase/envelp/labimg.cxx
+++ b/sw/source/uibase/envelp/labimg.cxx
@@ -365,29 +365,30 @@ SwLabCfgItem::SwLabCfgItem(bool bLabel) :
}
}
}
- if(!bIsLabel && bNoConfigValues)
- {
- SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
- aItem.m_aPrivFirstName = rUserOpt.GetFirstName();
- aItem.m_aPrivName = rUserOpt.GetLastName();
- aItem.m_aPrivShortCut = rUserOpt.GetID();
- aItem.m_aCompCompany = rUserOpt.GetCompany();
- aItem.m_aCompStreet = aItem.m_aPrivStreet = rUserOpt.GetStreet();
+ if(bIsLabel || !bNoConfigValues)
+ return;
+
+ SvtUserOptions& rUserOpt = SW_MOD()->GetUserOptions();
+ aItem.m_aPrivFirstName = rUserOpt.GetFirstName();
+ aItem.m_aPrivName = rUserOpt.GetLastName();
+ aItem.m_aPrivShortCut = rUserOpt.GetID();
+ aItem.m_aCompCompany = rUserOpt.GetCompany();
+ aItem.m_aCompStreet = aItem.m_aPrivStreet = rUserOpt.GetStreet();
+
+ aItem.m_aCompCountry = aItem.m_aPrivCountry = rUserOpt.GetCountry();
+ aItem.m_aCompZip = aItem.m_aPrivZip= rUserOpt.GetZip();
+ aItem.m_aCompCity = aItem.m_aPrivCity = rUserOpt.GetCity();
+ aItem.m_aPrivTitle = rUserOpt.GetTitle();
+ aItem.m_aCompPosition = rUserOpt.GetPosition();
+ aItem.m_aPrivPhone = rUserOpt.GetTelephoneHome();
+ aItem.m_aCompPhone = rUserOpt.GetTelephoneWork();
+ aItem.m_aCompFax = aItem.m_aPrivFax = rUserOpt.GetFax();
+ aItem.m_aCompMail = aItem.m_aPrivMail = rUserOpt.GetEmail();
+ aItem.m_aCompState = aItem.m_aPrivState = rUserOpt.GetState();
+ aItem.m_bSynchron = true;
+ SetModified();
- aItem.m_aCompCountry = aItem.m_aPrivCountry = rUserOpt.GetCountry();
- aItem.m_aCompZip = aItem.m_aPrivZip= rUserOpt.GetZip();
- aItem.m_aCompCity = aItem.m_aPrivCity = rUserOpt.GetCity();
- aItem.m_aPrivTitle = rUserOpt.GetTitle();
- aItem.m_aCompPosition = rUserOpt.GetPosition();
- aItem.m_aPrivPhone = rUserOpt.GetTelephoneHome();
- aItem.m_aCompPhone = rUserOpt.GetTelephoneWork();
- aItem.m_aCompFax = aItem.m_aPrivFax = rUserOpt.GetFax();
- aItem.m_aCompMail = aItem.m_aPrivMail = rUserOpt.GetEmail();
- aItem.m_aCompState = aItem.m_aPrivState = rUserOpt.GetState();
- aItem.m_bSynchron = true;
- SetModified();
- }
}
void SwLabCfgItem::Notify( const css::uno::Sequence< OUString >& ) {}
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index ae4293d221f5..7e4c3cdf5629 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -513,98 +513,99 @@ void SwPageGridExample::DrawPage(vcl::RenderContext& rRenderContext, const Point
{
SwPageExample::DrawPage(rRenderContext, rOrg, bSecond, bEnabled);
- if (pGridItem && pGridItem->GetGridType())
+ if (!pGridItem || !pGridItem->GetGridType())
+ return;
+
+ //paint the grid now
+ Color aLineColor = pGridItem->GetColor();
+ if (aLineColor.GetColor() == COL_AUTO)
{
- //paint the grid now
- Color aLineColor = pGridItem->GetColor();
- if (aLineColor.GetColor() == COL_AUTO)
- {
- aLineColor = rRenderContext.GetFillColor();
- aLineColor.Invert();
- }
- rRenderContext.SetLineColor(aLineColor);
- long nL = GetLeft();
- long nR = GetRight();
+ aLineColor = rRenderContext.GetFillColor();
+ aLineColor.Invert();
+ }
+ rRenderContext.SetLineColor(aLineColor);
+ long nL = GetLeft();
+ long nR = GetRight();
- if (GetUsage() == SvxPageUsage::Mirror && !bSecond)
- {
- // rotate for mirrored
- nL = GetRight();
- nR = GetLeft();
- }
+ if (GetUsage() == SvxPageUsage::Mirror && !bSecond)
+ {
+ // rotate for mirrored
+ nL = GetRight();
+ nR = GetLeft();
+ }
- tools::Rectangle aRect;
- aRect.Right() = rOrg.X() + GetSize().Width() - nR;
- aRect.Left() = rOrg.X() + nL;
- aRect.Top() = rOrg.Y() + GetTop() + GetHdHeight() + GetHdDist();
- aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist();
-
- //increase the values to get a 'viewable' preview
- sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3;
- sal_Int32 nRubyHeight = pGridItem->GetRubyHeight() * 3;
-
- //detect height of rectangles
- tools::Rectangle aRubyRect(aRect.TopLeft(),
- m_bVertical ?
- Size(nRubyHeight, aRect.GetHeight()) :
- Size(aRect.GetWidth(), nRubyHeight));
- tools::Rectangle aCharRect(aRect.TopLeft(),
- m_bVertical ?
- Size(nBaseHeight, aRect.GetHeight()) :
- Size(aRect.GetWidth(), nBaseHeight));
-
- sal_Int32 nLineHeight = nBaseHeight + nRubyHeight;
-
- //detect count of rectangles
- sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight;
- if (nLines > pGridItem->GetLines())
- nLines = pGridItem->GetLines();
-
- // determine start position
- if (m_bVertical)
- {
- sal_Int16 nXStart = static_cast<sal_Int16>(aRect.GetWidth() / 2 - nLineHeight * nLines /2);
- aRubyRect.Move(nXStart, 0);
- aCharRect.Move(nXStart, 0);
- }
- else
- {
- sal_Int16 nYStart = static_cast<sal_Int16>(aRect.GetHeight() / 2 - nLineHeight * nLines /2);
- aRubyRect.Move(0, nYStart);
- aCharRect.Move(0, nYStart);
- }
+ tools::Rectangle aRect;
+ aRect.Right() = rOrg.X() + GetSize().Width() - nR;
+ aRect.Left() = rOrg.X() + nL;
+ aRect.Top() = rOrg.Y() + GetTop() + GetHdHeight() + GetHdDist();
+ aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() - GetFtHeight() - GetFtDist();
- if (pGridItem->IsRubyTextBelow())
- m_bVertical ? aRubyRect.Move(nBaseHeight, 0) : aRubyRect.Move(0, nBaseHeight);
- else
- m_bVertical ? aCharRect.Move(nRubyHeight, 0) : aCharRect.Move(0, nRubyHeight);
-
- //vertical lines
- bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS;
- rRenderContext.SetFillColor(Color(COL_TRANSPARENT));
- sal_Int32 nXMove = m_bVertical ? nLineHeight : 0;
- sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight;
- for (sal_Int32 nLine = 0; nLine < nLines; nLine++)
+ //increase the values to get a 'viewable' preview
+ sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3;
+ sal_Int32 nRubyHeight = pGridItem->GetRubyHeight() * 3;
+
+ //detect height of rectangles
+ tools::Rectangle aRubyRect(aRect.TopLeft(),
+ m_bVertical ?
+ Size(nRubyHeight, aRect.GetHeight()) :
+ Size(aRect.GetWidth(), nRubyHeight));
+ tools::Rectangle aCharRect(aRect.TopLeft(),
+ m_bVertical ?
+ Size(nBaseHeight, aRect.GetHeight()) :
+ Size(aRect.GetWidth(), nBaseHeight));
+
+ sal_Int32 nLineHeight = nBaseHeight + nRubyHeight;
+
+ //detect count of rectangles
+ sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight;
+ if (nLines > pGridItem->GetLines())
+ nLines = pGridItem->GetLines();
+
+ // determine start position
+ if (m_bVertical)
+ {
+ sal_Int16 nXStart = static_cast<sal_Int16>(aRect.GetWidth() / 2 - nLineHeight * nLines /2);
+ aRubyRect.Move(nXStart, 0);
+ aCharRect.Move(nXStart, 0);
+ }
+ else
+ {
+ sal_Int16 nYStart = static_cast<sal_Int16>(aRect.GetHeight() / 2 - nLineHeight * nLines /2);
+ aRubyRect.Move(0, nYStart);
+ aCharRect.Move(0, nYStart);
+ }
+
+ if (pGridItem->IsRubyTextBelow())
+ m_bVertical ? aRubyRect.Move(nBaseHeight, 0) : aRubyRect.Move(0, nBaseHeight);
+ else
+ m_bVertical ? aCharRect.Move(nRubyHeight, 0) : aCharRect.Move(0, nRubyHeight);
+
+ //vertical lines
+ bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS;
+ rRenderContext.SetFillColor(Color(COL_TRANSPARENT));
+ sal_Int32 nXMove = m_bVertical ? nLineHeight : 0;
+ sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight;
+ for (sal_Int32 nLine = 0; nLine < nLines; nLine++)
+ {
+ rRenderContext.DrawRect(aRubyRect);
+ rRenderContext.DrawRect(aCharRect);
+ if (bBothLines)
{
- rRenderContext.DrawRect(aRubyRect);
- rRenderContext.DrawRect(aCharRect);
- if (bBothLines)
+ Point aStart = aCharRect.TopLeft();
+ Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft();
+ while (m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right())
{
- Point aStart = aCharRect.TopLeft();
- Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft();
- while (m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right())
- {
- rRenderContext.DrawLine(aStart, aEnd);
- if(m_bVertical)
- aStart.Y() = aEnd.Y() += nBaseHeight;
- else
- aStart.X() = aEnd.X() += nBaseHeight;
- }
+ rRenderContext.DrawLine(aStart, aEnd);
+ if(m_bVertical)
+ aStart.Y() = aEnd.Y() += nBaseHeight;
+ else
+ aStart.X() = aEnd.X() += nBaseHeight;
}
- aRubyRect.Move(nXMove, nYMove);
- aCharRect.Move(nXMove, nYMove);
}
+ aRubyRect.Move(nXMove, nYMove);
+ aCharRect.Move(nXMove, nYMove);
}
+
}
void SwPageGridExample::UpdateExample( const SfxItemSet& rSet )
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index f7c789f496c0..1f8f1d775f11 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1778,63 +1778,64 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq)
}
}
- if( !sSym.isEmpty() )
+ if( sSym.isEmpty() )
+ return;
+
+ // do not flicker
+ pOLV->HideCursor();
+ Outliner * pOutliner = pOLV->GetOutliner();
+ pOutliner->SetUpdateMode(false);
+
+ SfxItemSet aOldSet( pOLV->GetAttribs() );
+ SfxItemSet aFontSet(
+ *aOldSet.GetPool(),
+ svl::Items<
+ EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
+ EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL>{});
+ aFontSet.Set( aOldSet );
+
+ // Insert string
+ pOLV->InsertText( sSym);
+
+ // Attributing (set font)
+ SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
+ SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(),
+ EE_CHAR_FONTINFO );
+ SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
+ if( SvtScriptType::LATIN & nScriptBreak )
+ aSetFont.Put( aFontItem );
+ if( SvtScriptType::ASIAN & nScriptBreak )
{
- // do not flicker
- pOLV->HideCursor();
- Outliner * pOutliner = pOLV->GetOutliner();
- pOutliner->SetUpdateMode(false);
-
- SfxItemSet aOldSet( pOLV->GetAttribs() );
- SfxItemSet aFontSet(
- *aOldSet.GetPool(),
- svl::Items<
- EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
- EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL>{});
- aFontSet.Set( aOldSet );
-
- // Insert string
- pOLV->InsertText( sSym);
-
- // Attributing (set font)
- SfxItemSet aSetFont( *aFontSet.GetPool(), aFontSet.GetRanges() );
- SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
- aFont.GetStyleName(), aFont.GetPitch(),
- aFont.GetCharSet(),
- EE_CHAR_FONTINFO );
- SvtScriptType nScriptBreak = g_pBreakIt->GetAllScriptsOfText( sSym );
- if( SvtScriptType::LATIN & nScriptBreak )
- aSetFont.Put( aFontItem );
- if( SvtScriptType::ASIAN & nScriptBreak )
- {
- aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
- aSetFont.Put( aFontItem );
- }
- if( SvtScriptType::COMPLEX & nScriptBreak )
- {
- aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
- aSetFont.Put( aFontItem );
- }
- pOLV->SetAttribs(aSetFont);
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
+ aSetFont.Put( aFontItem );
+ }
+ if( SvtScriptType::COMPLEX & nScriptBreak )
+ {
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
+ aSetFont.Put( aFontItem );
+ }
+ pOLV->SetAttribs(aSetFont);
- // Erase selection
- ESelection aSel(pOLV->GetSelection());
- aSel.nStartPara = aSel.nEndPara;
- aSel.nStartPos = aSel.nEndPos;
- pOLV->SetSelection(aSel);
+ // Erase selection
+ ESelection aSel(pOLV->GetSelection());
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOLV->SetSelection(aSel);
- // Restore old font
- pOLV->SetAttribs( aFontSet );
+ // Restore old font
+ pOLV->SetAttribs( aFontSet );
- // From now on show it again
- pOutliner->SetUpdateMode(true);
- pOLV->ShowCursor();
+ // From now on show it again
+ pOutliner->SetUpdateMode(true);
+ pOLV->ShowCursor();
+
+ rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
+ if(!aFont.GetFamilyName().isEmpty())
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
+ rReq.Done();
- rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
- if(!aFont.GetFamilyName().isEmpty())
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
- rReq.Done();
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index c053715bd4ad..c4b6d11ac96f 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -1840,99 +1840,100 @@ void SwBaseShell::SetWrapMode( sal_uInt16 nSlot )
{
SwWrtShell &rSh = GetShell();
bool bObj = 0 != rSh.IsObjSelected();
- if( bObj || rSh.IsFrameSelected())
- {
- SfxItemSet aSet(GetPool(), svl::Items<RES_OPAQUE, RES_SURROUND>{});
- if(bObj)
- rSh.GetObjAttr(aSet);
- else
- rSh.GetFlyFrameAttr(aSet);
- SwFormatSurround aWrap( static_cast<const SwFormatSurround&>(aSet.Get(RES_SURROUND)) );
- css::text::WrapTextMode nOldSurround(aWrap.GetSurround());
- css::text::WrapTextMode nSurround = css::text::WrapTextMode_PARALLEL;
+ if( !bObj && !rSh.IsFrameSelected())
+ return;
- switch (nSlot)
- {
- case FN_FRAME_NOWRAP:
- nSurround = css::text::WrapTextMode_NONE;
- if (aWrap.IsContour())
- aWrap.SetContour(false);
- break;
- case FN_FRAME_WRAP_IDEAL:
- nSurround = css::text::WrapTextMode_DYNAMIC;
- break;
- case FN_WRAP_ANCHOR_ONLY:
- aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
+ SfxItemSet aSet(GetPool(), svl::Items<RES_OPAQUE, RES_SURROUND>{});
+ if(bObj)
+ rSh.GetObjAttr(aSet);
+ else
+ rSh.GetFlyFrameAttr(aSet);
+ SwFormatSurround aWrap( static_cast<const SwFormatSurround&>(aSet.Get(RES_SURROUND)) );
+ css::text::WrapTextMode nOldSurround(aWrap.GetSurround());
+ css::text::WrapTextMode nSurround = css::text::WrapTextMode_PARALLEL;
- // keep previous wrapping
+ switch (nSlot)
+ {
+ case FN_FRAME_NOWRAP:
+ nSurround = css::text::WrapTextMode_NONE;
+ if (aWrap.IsContour())
+ aWrap.SetContour(false);
+ break;
+ case FN_FRAME_WRAP_IDEAL:
+ nSurround = css::text::WrapTextMode_DYNAMIC;
+ break;
+ case FN_WRAP_ANCHOR_ONLY:
+ aWrap.SetAnchorOnly(!aWrap.IsAnchorOnly());
- // switch to wrap css::text::WrapTextMode_PARALLEL, if previous wrap is css::text::WrapTextMode_NONE
- if ( nOldSurround != css::text::WrapTextMode_NONE )
- {
- nSurround = nOldSurround;
- }
- break;
- case FN_FRAME_WRAP_CONTOUR:
- aWrap.SetContour(!aWrap.IsContour());
- break;
- case FN_FRAME_WRAPTHRU_TRANSP:
- case FN_FRAME_WRAPTHRU_TOGGLE:
- if (aWrap.IsContour())
- aWrap.SetContour(false);
- SAL_FALLTHROUGH;
- case FN_FRAME_WRAPTHRU:
- nSurround = css::text::WrapTextMode_THROUGH;
- break;
+ // keep previous wrapping
- case FN_FRAME_WRAP_LEFT:
- nSurround = css::text::WrapTextMode_LEFT;
- break;
+ // switch to wrap css::text::WrapTextMode_PARALLEL, if previous wrap is css::text::WrapTextMode_NONE
+ if ( nOldSurround != css::text::WrapTextMode_NONE )
+ {
+ nSurround = nOldSurround;
+ }
+ break;
+ case FN_FRAME_WRAP_CONTOUR:
+ aWrap.SetContour(!aWrap.IsContour());
+ break;
+ case FN_FRAME_WRAPTHRU_TRANSP:
+ case FN_FRAME_WRAPTHRU_TOGGLE:
+ if (aWrap.IsContour())
+ aWrap.SetContour(false);
+ SAL_FALLTHROUGH;
+ case FN_FRAME_WRAPTHRU:
+ nSurround = css::text::WrapTextMode_THROUGH;
+ break;
- case FN_FRAME_WRAP_RIGHT:
- nSurround = css::text::WrapTextMode_RIGHT;
- break;
+ case FN_FRAME_WRAP_LEFT:
+ nSurround = css::text::WrapTextMode_LEFT;
+ break;
- default:
- break;
- }
- aWrap.SetSurround(nSurround);
+ case FN_FRAME_WRAP_RIGHT:
+ nSurround = css::text::WrapTextMode_RIGHT;
+ break;
+
+ default:
+ break;
+ }
+ aWrap.SetSurround(nSurround);
- if (nSlot != FN_FRAME_WRAP_CONTOUR)
+ if (nSlot != FN_FRAME_WRAP_CONTOUR)
+ {
+ // Defaulting the contour wrap on draw objects.
+ if (bObj && nOldSurround != nSurround &&
+ (nOldSurround == css::text::WrapTextMode_NONE || nOldSurround == css::text::WrapTextMode_THROUGH))
{
- // Defaulting the contour wrap on draw objects.
- if (bObj && nOldSurround != nSurround &&
- (nOldSurround == css::text::WrapTextMode_NONE || nOldSurround == css::text::WrapTextMode_THROUGH))
- {
- aWrap.SetContour(true);
- }
+ aWrap.SetContour(true);
}
+ }
- aSet.Put( aWrap );
+ aSet.Put( aWrap );
- bool bOpaque = nSlot != FN_FRAME_WRAPTHRU_TRANSP && nSlot != FN_FRAME_WRAPTHRU_TOGGLE;
- if( nSlot == FN_FRAME_WRAPTHRU_TOGGLE )
+ bool bOpaque = nSlot != FN_FRAME_WRAPTHRU_TRANSP && nSlot != FN_FRAME_WRAPTHRU_TOGGLE;
+ if( nSlot == FN_FRAME_WRAPTHRU_TOGGLE )
+ {
+ if( bObj )
+ bOpaque = !rSh.GetLayerId();
+ else
{
- if( bObj )
- bOpaque = !rSh.GetLayerId();
- else
- {
- const SvxOpaqueItem aOpaque( static_cast<const SvxOpaqueItem&>(aSet.Get(RES_OPAQUE)) );
- bOpaque = !aOpaque.GetValue();
- }
+ const SvxOpaqueItem aOpaque( static_cast<const SvxOpaqueItem&>(aSet.Get(RES_OPAQUE)) );
+ bOpaque = !aOpaque.GetValue();
}
- aSet.Put(SvxOpaqueItem(RES_OPAQUE, bOpaque ));
+ }
+ aSet.Put(SvxOpaqueItem(RES_OPAQUE, bOpaque ));
- if(bObj)
- {
- rSh.SetObjAttr(aSet);
- if ( bOpaque )
- rSh.SelectionToHeaven();
- else
- rSh.SelectionToHell();
- }
+ if(bObj)
+ {
+ rSh.SetObjAttr(aSet);
+ if ( bOpaque )
+ rSh.SelectionToHeaven();
else
- rSh.SetFlyFrameAttr(aSet);
+ rSh.SelectionToHell();
}
+ else
+ rSh.SetFlyFrameAttr(aSet);
+
}
//Force update of the status line
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index e0ce504234da..782560af5aee 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -753,63 +753,64 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq)
}
}
- if( !sSym.isEmpty() )
+ if( sSym.isEmpty() )
+ return;
+
+ // do not flicker
+ pOLV->HideCursor();
+ SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
+ pOutliner->SetUpdateMode(false);
+
+ SfxItemSet aOldSet( pOLV->GetAttribs() );
+ SfxItemSet aFontSet(
+ *aOldSet.GetPool(),
+ svl::Items<
+ EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
+ EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL>{});
+ aFontSet.Set( aOldSet );
+
+ // Insert string
+ pOLV->InsertText( sSym );
+
+ // assign attributes (Set font)
+ SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
+ SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
+ aFont.GetStyleName(), aFont.GetPitch(),
+ aFont.GetCharSet(),
+ EE_CHAR_FONTINFO );
+ nScript = g_pBreakIt->GetAllScriptsOfText( sSym );
+ if( SvtScriptType::LATIN & nScript )
+ aFontAttribSet.Put( aFontItem );
+ if( SvtScriptType::ASIAN & nScript )
{
- // do not flicker
- pOLV->HideCursor();
- SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner();
- pOutliner->SetUpdateMode(false);
-
- SfxItemSet aOldSet( pOLV->GetAttribs() );
- SfxItemSet aFontSet(
- *aOldSet.GetPool(),
- svl::Items<
- EE_CHAR_FONTINFO, EE_CHAR_FONTINFO,
- EE_CHAR_FONTINFO_CJK, EE_CHAR_FONTINFO_CTL>{});
- aFontSet.Set( aOldSet );
-
- // Insert string
- pOLV->InsertText( sSym );
-
- // assign attributes (Set font)
- SfxItemSet aFontAttribSet( *aFontSet.GetPool(), aFontSet.GetRanges() );
- SvxFontItem aFontItem (aFont.GetFamilyType(), aFont.GetFamilyName(),
- aFont.GetStyleName(), aFont.GetPitch(),
- aFont.GetCharSet(),
- EE_CHAR_FONTINFO );
- nScript = g_pBreakIt->GetAllScriptsOfText( sSym );
- if( SvtScriptType::LATIN & nScript )
- aFontAttribSet.Put( aFontItem );
- if( SvtScriptType::ASIAN & nScript )
- {
- aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
- aFontAttribSet.Put( aFontItem );
- }
- if( SvtScriptType::COMPLEX & nScript )
- {
- aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
- aFontAttribSet.Put( aFontItem );
- }
- pOLV->SetAttribs(aFontAttribSet);
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CJK);
+ aFontAttribSet.Put( aFontItem );
+ }
+ if( SvtScriptType::COMPLEX & nScript )
+ {
+ aFontItem.SetWhich(EE_CHAR_FONTINFO_CTL);
+ aFontAttribSet.Put( aFontItem );
+ }
+ pOLV->SetAttribs(aFontAttribSet);
- // Remove selection
- ESelection aSel(pOLV->GetSelection());
- aSel.nStartPara = aSel.nEndPara;
- aSel.nStartPos = aSel.nEndPos;
- pOLV->SetSelection(aSel);
+ // Remove selection
+ ESelection aSel(pOLV->GetSelection());
+ aSel.nStartPara = aSel.nEndPara;
+ aSel.nStartPos = aSel.nEndPos;
+ pOLV->SetSelection(aSel);
- // Restore old font
- pOLV->SetAttribs( aFontSet );
+ // Restore old font
+ pOLV->SetAttribs( aFontSet );
- // From now on show again
- pOutliner->SetUpdateMode(true);
- pOLV->ShowCursor();
+ // From now on show again
+ pOutliner->SetUpdateMode(true);
+ pOLV->ShowCursor();
+
+ rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
+ if(!aFont.GetFamilyName().isEmpty())
+ rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
+ rReq.Done();
- rReq.AppendItem( SfxStringItem( GetPool().GetWhich(SID_CHARMAP), sSym ) );
- if(!aFont.GetFamilyName().isEmpty())
- rReq.AppendItem( SfxStringItem( SID_ATTR_SPECIALCHAR, aFont.GetFamilyName() ) );
- rReq.Done();
- }
}
::svl::IUndoManager* SwDrawTextShell::GetUndoManager()
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index 359d937919d9..94ae920530cf 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -955,42 +955,43 @@ IMPL_LINK( SwTextShell, RedlineNextHdl, AbstractSvxPostItDialog&, rDlg, void )
const SwRangeRedline *pRedline = pSh->GetCurrRedline();
- if (pRedline)
- {
- // Traveling only if more than one field.
- if( !pSh->IsCursorPtAtEnd() )
- pSh->SwapPam(); // Move the cursor behind the Redline.
+ if (!pRedline)
+ return;
- pSh->Push();
- const SwRangeRedline *pActRed = pSh->SelNextRedline();
- pSh->Pop((pActRed != nullptr) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
+ // Traveling only if more than one field.
+ if( !pSh->IsCursorPtAtEnd() )
+ pSh->SwapPam(); // Move the cursor behind the Redline.
- bool bEnable = false;
+ pSh->Push();
+ const SwRangeRedline *pActRed = pSh->SelNextRedline();
+ pSh->Pop((pActRed != nullptr) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
- if (pActRed)
- {
- pSh->StartAction();
- pSh->Push();
- bEnable = pSh->SelNextRedline() != nullptr;
- pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
- pSh->EndAction();
- }
+ bool bEnable = false;
+
+ if (pActRed)
+ {
+ pSh->StartAction();
+ pSh->Push();
+ bEnable = pSh->SelNextRedline() != nullptr;
+ pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
+ pSh->EndAction();
+ }
- rDlg.EnableTravel(bEnable, true);
+ rDlg.EnableTravel(bEnable, true);
- if( pSh->IsCursorPtAtEnd() )
- pSh->SwapPam();
+ if( pSh->IsCursorPtAtEnd() )
+ pSh->SwapPam();
- pRedline = pSh->GetCurrRedline();
- OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
+ pRedline = pSh->GetCurrRedline();
+ OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
- rDlg.SetNote(sComment);
- rDlg.ShowLastAuthor( pRedline->GetAuthorString(),
- GetAppLangDateTimeString(
- pRedline->GetRedlineData().GetTimeStamp() ));
+ rDlg.SetNote(sComment);
+ rDlg.ShowLastAuthor( pRedline->GetAuthorString(),
+ GetAppLangDateTimeString(
+ pRedline->GetRedlineData().GetTimeStamp() ));
+
+ rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
- rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
- }
}
IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog&, rDlg, void )
@@ -1002,36 +1003,37 @@ IMPL_LINK( SwTextShell, RedlinePrevHdl, AbstractSvxPostItDialog&, rDlg, void )
const SwRangeRedline *pRedline = pSh->GetCurrRedline();
- if (pRedline)
+ if (!pRedline)
+ return;
+
+ // Traveling only if more than one field.
+ pSh->Push();
+ const SwRangeRedline *pActRed = pSh->SelPrevRedline();
+ pSh->Pop((pActRed != nullptr) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
+
+ bool bEnable = false;
+
+ if (pActRed)
{
- // Traveling only if more than one field.
+ pSh->StartAction();
pSh->Push();
- const SwRangeRedline *pActRed = pSh->SelPrevRedline();
- pSh->Pop((pActRed != nullptr) ? SwCursorShell::PopMode::DeleteStack : SwCursorShell::PopMode::DeleteCurrent);
-
- bool bEnable = false;
+ bEnable = pSh->SelPrevRedline() != nullptr;
+ pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
+ pSh->EndAction();
+ }
- if (pActRed)
- {
- pSh->StartAction();
- pSh->Push();
- bEnable = pSh->SelPrevRedline() != nullptr;
- pSh->Pop(SwCursorShell::PopMode::DeleteCurrent);
- pSh->EndAction();
- }
+ rDlg.EnableTravel(true, bEnable);
- rDlg.EnableTravel(true, bEnable);
+ pRedline = pSh->GetCurrRedline();
+ OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
- pRedline = pSh->GetCurrRedline();
- OUString sComment = convertLineEnd(pRedline->GetComment(), GetSystemLineEnd());
+ rDlg.SetNote(sComment);
+ rDlg.ShowLastAuthor(pRedline->GetAuthorString(),
+ GetAppLangDateTimeString(
+ pRedline->GetRedlineData().GetTimeStamp() ));
- rDlg.SetNote(sComment);
- rDlg.ShowLastAuthor(pRedline->GetAuthorString(),
- GetAppLangDateTimeString(
- pRedline->GetRedlineData().GetTimeStamp() ));
+ rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
- rDlg.SetText(lcl_BuildTitleWithRedline(pRedline));
- }
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 269d59d35f44..0bae10101af7 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -194,59 +194,60 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const
pSet = pDlg->GetOutputItemSet();
}
- if ( pSet)
- {
- SfxItemSet aTmpSet( *pSet );
- ::ConvertAttrGenToChar(aTmpSet, aCoreSet, CONV_ATTR_STD);
+ if ( !pSet)
+ return;
- const SfxPoolItem* pSelectionItem;
- bool bInsert = false;
- sal_Int32 nInsert = 0;
+ SfxItemSet aTmpSet( *pSet );
+ ::ConvertAttrGenToChar(aTmpSet, aCoreSet, CONV_ATTR_STD);
- // The old item is for unknown reasons back in the set again.
- if( !bSelectionPut && SfxItemState::SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, false, &pSelectionItem) )
- {
- OUString sInsert = static_cast<const SfxStringItem*>(pSelectionItem)->GetValue();
- bInsert = !sInsert.isEmpty();
- if(bInsert)
- {
- nInsert = sInsert.getLength();
- rWrtSh.StartAction();
- rWrtSh.Insert( sInsert );
- rWrtSh.SetMark();
- rWrtSh.ExtendSelection(false, sInsert.getLength());
- SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
- aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
- aReq.Done();
- SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
- aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
- aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, true) );
- aReq1.Done();
- }
- }
- aTmpSet.ClearItem(FN_PARAM_SELECTION);
+ const SfxPoolItem* pSelectionItem;
+ bool bInsert = false;
+ sal_Int32 nInsert = 0;
- SwTextFormatColl* pColl = rWrtSh.GetCurTextFormatColl();
- if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFormat())
- {
- rWrtSh.AutoUpdatePara(pColl, aTmpSet);
- }
- else
- rWrtSh.SetAttrSet( aTmpSet );
- if (pReq)
- pReq->Done(aTmpSet);
+ // The old item is for unknown reasons back in the set again.
+ if( !bSelectionPut && SfxItemState::SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, false, &pSelectionItem) )
+ {
+ OUString sInsert = static_cast<const SfxStringItem*>(pSelectionItem)->GetValue();
+ bInsert = !sInsert.isEmpty();
if(bInsert)
{
- SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
+ nInsert = sInsert.getLength();
+ rWrtSh.StartAction();
+ rWrtSh.Insert( sInsert );
+ rWrtSh.SetMark();
+ rWrtSh.ExtendSelection(false, sInsert.getLength());
+ SfxRequest aReq( rWrtSh.GetView().GetViewFrame(), FN_INSERT_STRING );
+ aReq.AppendItem( SfxStringItem( FN_INSERT_STRING, sInsert ) );
+ aReq.Done();
+ SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_LEFT );
aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
- aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, false) );
+ aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, true) );
aReq1.Done();
- rWrtSh.SwapPam();
- rWrtSh.ClearMark();
- rWrtSh.DontExpandFormat();
- rWrtSh.EndAction();
}
}
+ aTmpSet.ClearItem(FN_PARAM_SELECTION);
+
+ SwTextFormatColl* pColl = rWrtSh.GetCurTextFormatColl();
+ if(bSel && rWrtSh.IsSelFullPara() && pColl && pColl->IsAutoUpdateFormat())
+ {
+ rWrtSh.AutoUpdatePara(pColl, aTmpSet);
+ }
+ else
+ rWrtSh.SetAttrSet( aTmpSet );
+ if (pReq)
+ pReq->Done(aTmpSet);
+ if(bInsert)
+ {
+ SfxRequest aReq1( rWrtSh.GetView().GetViewFrame(), FN_CHAR_RIGHT );
+ aReq1.AppendItem( SfxInt32Item(FN_PARAM_MOVE_COUNT, nInsert) );
+ aReq1.AppendItem( SfxBoolItem(FN_PARAM_MOVE_SELECTION, false) );
+ aReq1.Done();
+ rWrtSh.SwapPam();
+ rWrtSh.ClearMark();
+ rWrtSh.DontExpandFormat();
+ rWrtSh.EndAction();
+ }
+
}
static short lcl_AskRedlineFlags(vcl::Window *pWin)
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index f2bcc222b22c..60d34de9fdd9 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -1239,228 +1239,229 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue >
return;
bool bIsOwnDocument = lcl_IsOwnDocument( *this );
sal_Int32 nLength = rSequence.getLength();
- if (nLength)
+ if (!nLength)
+ return;
+
+ SET_CURR_SHELL(m_pWrtShell);
+ const beans::PropertyValue *pValue = rSequence.getConstArray();
+ const SwRect& rRect = m_pWrtShell->GetCharRect();
+ const tools::Rectangle &rVis = GetVisArea();
+ const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions();
+
+ sal_Int64 nX = rRect.Left(), nY = rRect.Top(), nLeft = rVis.Left(), nTop = rVis.Top();
+ sal_Int64 nRight = LONG_MIN;
+ sal_Int64 nBottom = LONG_MIN;
+ sal_Int16 nZoomType = static_cast< sal_Int16 >(pVOpt->GetZoomType());
+ sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom());
+ bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode();
+ sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
+
+ bool bSelectedFrame = ( m_pWrtShell->GetSelFrameType() != FrameTypeFlags::NONE ),
+ bGotVisibleLeft = false,
+ bGotVisibleTop = false, bGotVisibleRight = false,
+ bGotVisibleBottom = false, bGotZoomType = false,
+ bGotZoomFactor = false, bGotIsSelectedFrame = false,
+ bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
+ bBrowseMode = false, bGotBrowseMode = false;
+
+ for (sal_Int32 i = 0 ; i < nLength; i++)
{
- SET_CURR_SHELL(m_pWrtShell);
- const beans::PropertyValue *pValue = rSequence.getConstArray();
- const SwRect& rRect = m_pWrtShell->GetCharRect();
- const tools::Rectangle &rVis = GetVisArea();
- const SwViewOption* pVOpt = m_pWrtShell->GetViewOptions();
-
- sal_Int64 nX = rRect.Left(), nY = rRect.Top(), nLeft = rVis.Left(), nTop = rVis.Top();
- sal_Int64 nRight = LONG_MIN;
- sal_Int64 nBottom = LONG_MIN;
- sal_Int16 nZoomType = static_cast< sal_Int16 >(pVOpt->GetZoomType());
- sal_Int16 nZoomFactor = static_cast < sal_Int16 > (pVOpt->GetZoom());
- bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode();
- sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns();
-
- bool bSelectedFrame = ( m_pWrtShell->GetSelFrameType() != FrameTypeFlags::NONE ),
- bGotVisibleLeft = false,
- bGotVisibleTop = false, bGotVisibleRight = false,
- bGotVisibleBottom = false, bGotZoomType = false,
- bGotZoomFactor = false, bGotIsSelectedFrame = false,
- bGotViewLayoutColumns = false, bGotViewLayoutBookMode = false,
- bBrowseMode = false, bGotBrowseMode = false;
-
- for (sal_Int32 i = 0 ; i < nLength; i++)
+ if ( pValue->Name == "ViewLeft" )
{
- if ( pValue->Name == "ViewLeft" )
- {
- pValue->Value >>= nX;
- nX = convertMm100ToTwip( nX );
- }
- else if ( pValue->Name == "ViewTop" )
- {
- pValue->Value >>= nY;
- nY = convertMm100ToTwip( nY );
- }
- else if ( pValue->Name == "VisibleLeft" )
- {
- pValue->Value >>= nLeft;
- nLeft = convertMm100ToTwip( nLeft );
- bGotVisibleLeft = true;
- }
- else if ( pValue->Name == "VisibleTop" )
- {
- pValue->Value >>= nTop;
- nTop = convertMm100ToTwip( nTop );
- bGotVisibleTop = true;
- }
- else if ( pValue->Name == "VisibleRight" )
- {
- pValue->Value >>= nRight;
- nRight = convertMm100ToTwip( nRight );
- bGotVisibleRight = true;
- }
- else if ( pValue->Name == "VisibleBottom" )
- {
- pValue->Value >>= nBottom;
- nBottom = convertMm100ToTwip( nBottom );
- bGotVisibleBottom = true;
- }
- else if ( pValue->Name == "ZoomType" )
- {
- pValue->Value >>= nZoomType;
- bGotZoomType = true;
- }
- else if ( pValue->Name == "ZoomFactor" )
- {
- pValue->Value >>= nZoomFactor;
- bGotZoomFactor = true;
- }
- else if ( pValue->Name == "ViewLayoutColumns" )
- {
- pValue->Value >>= nViewLayoutColumns;
- bGotViewLayoutColumns = true;
- }
- else if ( pValue->Name == "ViewLayoutBookMode" )
- {
- bViewLayoutBookMode = *o3tl::doAccess<bool>(pValue->Value);
- bGotViewLayoutBookMode = true;
- }
- else if ( pValue->Name == "IsSelectedFrame" )
- {
- pValue->Value >>= bSelectedFrame;
- bGotIsSelectedFrame = true;
- }
- else if (pValue->Name == "ShowOnlineLayout")
- {
- pValue->Value >>= bBrowseMode;
- bGotBrowseMode = true;
- }
- // Fallback to common SdrModel processing
- else GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(pValue);
- pValue++;
+ pValue->Value >>= nX;
+ nX = convertMm100ToTwip( nX );
}
- if (bGotBrowseMode)
+ else if ( pValue->Name == "ViewTop" )
{
- // delegate further
- GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout", uno::Any(bBrowseMode));
+ pValue->Value >>= nY;
+ nY = convertMm100ToTwip( nY );
}
- if (bGotVisibleBottom)
+ else if ( pValue->Name == "VisibleLeft" )
{
- Point aCursorPos( nX, nY );
- const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
- if (nBottom <= (m_pWrtShell->GetDocSize().Height()+nAdd) )
- {
- m_pWrtShell->EnableSmooth( false );
- const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
+ pValue->Value >>= nLeft;
+ nLeft = convertMm100ToTwip( nLeft );
+ bGotVisibleLeft = true;
+ }
+ else if ( pValue->Name == "VisibleTop" )
+ {
+ pValue->Value >>= nTop;
+ nTop = convertMm100ToTwip( nTop );
+ bGotVisibleTop = true;
+ }
+ else if ( pValue->Name == "VisibleRight" )
+ {
+ pValue->Value >>= nRight;
+ nRight = convertMm100ToTwip( nRight );
+ bGotVisibleRight = true;
+ }
+ else if ( pValue->Name == "VisibleBottom" )
+ {
+ pValue->Value >>= nBottom;
+ nBottom = convertMm100ToTwip( nBottom );
+ bGotVisibleBottom = true;
+ }
+ else if ( pValue->Name == "ZoomType" )
+ {
+ pValue->Value >>= nZoomType;
+ bGotZoomType = true;
+ }
+ else if ( pValue->Name == "ZoomFactor" )
+ {
+ pValue->Value >>= nZoomFactor;
+ bGotZoomFactor = true;
+ }
+ else if ( pValue->Name == "ViewLayoutColumns" )
+ {
+ pValue->Value >>= nViewLayoutColumns;
+ bGotViewLayoutColumns = true;
+ }
+ else if ( pValue->Name == "ViewLayoutBookMode" )
+ {
+ bViewLayoutBookMode = *o3tl::doAccess<bool>(pValue->Value);
+ bGotViewLayoutBookMode = true;
+ }
+ else if ( pValue->Name == "IsSelectedFrame" )
+ {
+ pValue->Value >>= bSelectedFrame;
+ bGotIsSelectedFrame = true;
+ }
+ else if (pValue->Name == "ShowOnlineLayout")
+ {
+ pValue->Value >>= bBrowseMode;
+ bGotBrowseMode = true;
+ }
+ // Fallback to common SdrModel processing
+ else GetDocShell()->GetDoc()->getIDocumentDrawModelAccess().GetDrawModel()->ReadUserDataSequenceValue(pValue);
+ pValue++;
+ }
+ if (bGotBrowseMode)
+ {
+ // delegate further
+ GetViewImpl()->GetUNOObject_Impl()->getViewSettings()->setPropertyValue("ShowOnlineLayout", uno::Any(bBrowseMode));
+ }
+ if (bGotVisibleBottom)
+ {
+ Point aCursorPos( nX, nY );
+ const long nAdd = m_pWrtShell->GetViewOptions()->getBrowseMode() ? DOCUMENTBORDER : DOCUMENTBORDER*2;
+ if (nBottom <= (m_pWrtShell->GetDocSize().Height()+nAdd) )
+ {
+ m_pWrtShell->EnableSmooth( false );
+ const tools::Rectangle aVis( nLeft, nTop, nRight, nBottom );
- SvxZoomType eZoom;
- if ( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
- eZoom = static_cast < SvxZoomType > ( nZoomType );
- else
- {
- eZoom = SvxZoomType::PERCENT;
- }
- if (bGotIsSelectedFrame)
- {
- bool bSelectObj = bSelectedFrame && m_pWrtShell->IsObjSelectable( aCursorPos );
+ SvxZoomType eZoom;
+ if ( !m_pWrtShell->GetViewOptions()->getBrowseMode() )
+ eZoom = static_cast < SvxZoomType > ( nZoomType );
+ else
+ {
+ eZoom = SvxZoomType::PERCENT;
+ }
+ if (bGotIsSelectedFrame)
+ {
+ bool bSelectObj = bSelectedFrame && m_pWrtShell->IsObjSelectable( aCursorPos );
- // set flag value to avoid macro execution.
- bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
- m_pWrtShell->SetMacroExecAllowed( false );
+ // set flag value to avoid macro execution.
+ bool bSavedFlagValue = m_pWrtShell->IsMacroExecAllowed();
+ m_pWrtShell->SetMacroExecAllowed( false );
// os: changed: The user data has to be read if the view is switched back from page preview
// go to the last editing position when opening own files
- m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
- if(m_bOldShellWasPagePreview|| bIsOwnDocument)
- {
- m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
+ m_pViewImpl->SetRestorePosition(aCursorPos, bSelectObj);
+ if(m_bOldShellWasPagePreview|| bIsOwnDocument)
+ {
+ m_pWrtShell->SwCursorShell::SetCursor( aCursorPos, !bSelectObj );
- // Update the shell to toggle Header/Footer edit if needed
- bool bInHeader = true;
- if ( m_pWrtShell->IsInHeaderFooter( &bInHeader ) )
+ // Update the shell to toggle Header/Footer edit if needed
+ bool bInHeader = true;
+ if ( m_pWrtShell->IsInHeaderFooter( &bInHeader ) )
+ {
+ if ( !bInHeader )
{
- if ( !bInHeader )
- {
- m_pWrtShell->SetShowHeaderFooterSeparator( Footer, true );
- m_pWrtShell->SetShowHeaderFooterSeparator( Header, false );
- }
- else
- {
- m_pWrtShell->SetShowHeaderFooterSeparator( Header, true );
- m_pWrtShell->SetShowHeaderFooterSeparator( Footer, false );
- }
-
- // Force repaint
- m_pWrtShell->GetWin()->Invalidate();
+ m_pWrtShell->SetShowHeaderFooterSeparator( Footer, true );
+ m_pWrtShell->SetShowHeaderFooterSeparator( Header, false );
}
- if ( m_pWrtShell->IsInHeaderFooter() != m_pWrtShell->IsHeaderFooterEdit() )
- m_pWrtShell->ToggleHeaderFooterEdit();
-
- if( bSelectObj )
+ else
{
- m_pWrtShell->SelectObj( aCursorPos );
- m_pWrtShell->EnterSelFrameMode( &aCursorPos );
+ m_pWrtShell->SetShowHeaderFooterSeparator( Header, true );
+ m_pWrtShell->SetShowHeaderFooterSeparator( Footer, false );
}
+
+ // Force repaint
+ m_pWrtShell->GetWin()->Invalidate();
}
+ if ( m_pWrtShell->IsInHeaderFooter() != m_pWrtShell->IsHeaderFooterEdit() )
+ m_pWrtShell->ToggleHeaderFooterEdit();
- // reset flag value
- m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+ if( bSelectObj )
+ {
+ m_pWrtShell->SelectObj( aCursorPos );
+ m_pWrtShell->EnterSelFrameMode( &aCursorPos );
+ }
}
- SelectShell();
- // Set ViewLayoutSettings
- const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
- ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
+ // reset flag value
+ m_pWrtShell->SetMacroExecAllowed( bSavedFlagValue );
+ }
+ SelectShell();
+
+ // Set ViewLayoutSettings
+ const bool bSetViewLayoutSettings = bGotViewLayoutColumns && bGotViewLayoutBookMode &&
+ ( pVOpt->GetViewLayoutColumns() != nViewLayoutColumns || pVOpt->IsViewLayoutBookMode() != bViewLayoutBookMode );
- const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
- ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
+ const bool bSetViewSettings = bGotZoomType && bGotZoomFactor &&
+ ( pVOpt->GetZoom() != nZoomFactor || pVOpt->GetZoomType() != eZoom );
- // In case we have a 'fixed' view layout of 2 or more columns,
- // we have to apply the view options *before* starting the action.
- // Otherwsie the SetZoom function cannot work correctly, because
- // the view layout hasn't been calculated.
- const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
- 1 < nViewLayoutColumns &&
- bSetViewSettings &&
- eZoom != SvxZoomType::PERCENT;
+ // In case we have a 'fixed' view layout of 2 or more columns,
+ // we have to apply the view options *before* starting the action.
+ // Otherwsie the SetZoom function cannot work correctly, because
+ // the view layout hasn't been calculated.
+ const bool bZoomNeedsViewLayout = bSetViewLayoutSettings &&
+ 1 < nViewLayoutColumns &&
+ bSetViewSettings &&
+ eZoom != SvxZoomType::PERCENT;
- if ( !bZoomNeedsViewLayout )
- m_pWrtShell->StartAction();
+ if ( !bZoomNeedsViewLayout )
+ m_pWrtShell->StartAction();
- if ( bSetViewLayoutSettings )
- SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, true );
+ if ( bSetViewLayoutSettings )
+ SetViewLayout( nViewLayoutColumns, bViewLayoutBookMode, true );
- if ( bZoomNeedsViewLayout )
- m_pWrtShell->StartAction();
+ if ( bZoomNeedsViewLayout )
+ m_pWrtShell->StartAction();
- if ( bSetViewSettings )
- SetZoom( eZoom, nZoomFactor, true );
+ if ( bSetViewSettings )
+ SetZoom( eZoom, nZoomFactor, true );
// os: changed: The user data has to be read if the view is switched back from page preview
// go to the last editing position when opening own files
- if(m_bOldShellWasPagePreview||bIsOwnDocument)
+ if(m_bOldShellWasPagePreview||bIsOwnDocument)
+ {
+ if ( bGotVisibleLeft && bGotVisibleTop )
{
- if ( bGotVisibleLeft && bGotVisibleTop )
+ Point aTopLeft(aVis.TopLeft());
+ // make sure the document is still centered
+ const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
+ SwTwips nEditWidth = GetEditWin().GetOutputSize().Width();
+ if(nEditWidth > (m_aDocSz.Width() + lBorder ))
+ aTopLeft.X() = ( m_aDocSz.Width() + lBorder - nEditWidth ) / 2;
+ else
{
- Point aTopLeft(aVis.TopLeft());
- // make sure the document is still centered
- const SwTwips lBorder = IsDocumentBorder() ? DOCUMENTBORDER : 2 * DOCUMENTBORDER;
- SwTwips nEditWidth = GetEditWin().GetOutputSize().Width();
- if(nEditWidth > (m_aDocSz.Width() + lBorder ))
- aTopLeft.X() = ( m_aDocSz.Width() + lBorder - nEditWidth ) / 2;
- else
- {
- //check if the values are possible
- long nXMax = m_pHScrollbar->GetRangeMax() - m_pHScrollbar->GetVisibleSize();
- if( aTopLeft.X() > nXMax )
- aTopLeft.X() = nXMax < 0 ? 0 : nXMax;
- }
- SetVisArea( aTopLeft );
+ //check if the values are possible
+ long nXMax = m_pHScrollbar->GetRangeMax() - m_pHScrollbar->GetVisibleSize();
+ if( aTopLeft.X() > nXMax )
+ aTopLeft.X() = nXMax < 0 ? 0 : nXMax;
}
- else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
- SetVisArea( aVis );
+ SetVisArea( aTopLeft );
}
-
- m_pWrtShell->LockView( true );
- m_pWrtShell->EndAction();
- m_pWrtShell->LockView( false );
- m_pWrtShell->EnableSmooth( true );
+ else if (bGotVisibleLeft && bGotVisibleTop && bGotVisibleRight && bGotVisibleBottom )
+ SetVisArea( aVis );
}
+
+ m_pWrtShell->LockView( true );
+ m_pWrtShell->EndAction();
+ m_pWrtShell->LockView( false );
+ m_pWrtShell->EnableSmooth( true );
}
}
+
}
void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSequence )
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 5d7f903f16d1..4cb021a90f3c 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -158,27 +158,28 @@ using namespace ::com::sun::star::ui::dialogs;
static void lcl_SetAllTextToDefaultLanguage( SwWrtShell &rWrtSh, sal_uInt16 nWhichId )
{
- if (nWhichId == RES_CHRATR_LANGUAGE ||
- nWhichId == RES_CHRATR_CJK_LANGUAGE ||
- nWhichId == RES_CHRATR_CTL_LANGUAGE)
- {
- rWrtSh.StartAction();
- rWrtSh.LockView( true );
- rWrtSh.Push();
-
- // prepare to apply new language to all text in document
- rWrtSh.SelAll();
- rWrtSh.ExtendedSelectAll();
-
- // set language attribute to default for all text
- std::set<sal_uInt16> aAttribs;
- aAttribs.insert( nWhichId );
- rWrtSh.ResetAttr( aAttribs );
-
- rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
- rWrtSh.LockView( false );
- rWrtSh.EndAction();
- }
+ if (!(nWhichId == RES_CHRATR_LANGUAGE ||
+ nWhichId == RES_CHRATR_CJK_LANGUAGE ||
+ nWhichId == RES_CHRATR_CTL_LANGUAGE))
+ return;
+
+ rWrtSh.StartAction();
+ rWrtSh.LockView( true );
+ rWrtSh.Push();
+
+ // prepare to apply new language to all text in document
+ rWrtSh.SelAll();
+ rWrtSh.ExtendedSelectAll();
+
+ // set language attribute to default for all text
+ std::set<sal_uInt16> aAttribs;
+ aAttribs.insert( nWhichId );
+ rWrtSh.ResetAttr( aAttribs );
+
+ rWrtSh.Pop(SwCursorShell::PopMode::DeleteCurrent);
+ rWrtSh.LockView( false );
+ rWrtSh.EndAction();
+
}
/**
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 17b29d4f1945..2e10acd8b45e 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -1281,92 +1281,93 @@ void SwGlobalTree::DataChanged( const DataChangedEvent& rDCEvt )
void SwGlobalTree::InsertRegion( const SwGlblDocContent* _pContent, const Sequence< OUString >& _rFiles )
{
sal_Int32 nFiles = _rFiles.getLength();
- if ( nFiles )
+ if ( !nFiles )
+ return;
+
+ bool bMove = false;
+ if ( !_pContent )
{
- bool bMove = false;
- if ( !_pContent )
- {
- SvTreeListEntry* pLast = LastVisible();
- _pContent = static_cast<SwGlblDocContent*>(pLast->GetUserData());
- bMove = true;
- }
- sal_uLong nEntryCount = GetEntryCount();
- const OUString* pFileNames = _rFiles.getConstArray();
- SwWrtShell& rSh = GetParentWindow()->GetCreateView()->GetWrtShell();
- rSh.StartAction();
- // after insertion of the first new content the 'pCont' parameter becomes invalid
- // find the index of the 'anchor' content to always use a current anchor content
- size_t nAnchorContent = m_pSwGlblDocContents->size() - 1;
- if ( !bMove )
+ SvTreeListEntry* pLast = LastVisible();
+ _pContent = static_cast<SwGlblDocContent*>(pLast->GetUserData());
+ bMove = true;
+ }
+ sal_uLong nEntryCount = GetEntryCount();
+ const OUString* pFileNames = _rFiles.getConstArray();
+ SwWrtShell& rSh = GetParentWindow()->GetCreateView()->GetWrtShell();
+ rSh.StartAction();
+ // after insertion of the first new content the 'pCont' parameter becomes invalid
+ // find the index of the 'anchor' content to always use a current anchor content
+ size_t nAnchorContent = m_pSwGlblDocContents->size() - 1;
+ if ( !bMove )
+ {
+ for (size_t nContent = 0; nContent < m_pSwGlblDocContents->size();
+ ++nContent)
{
- for (size_t nContent = 0; nContent < m_pSwGlblDocContents->size();
- ++nContent)
+ if( *_pContent == *(*m_pSwGlblDocContents)[ nContent ] )
{
- if( *_pContent == *(*m_pSwGlblDocContents)[ nContent ] )
- {
- nAnchorContent = nContent;
- break;
- }
+ nAnchorContent = nContent;
+ break;
}
}
- SwGlblDocContents aTempContents;
- for ( sal_Int32 nFile = 0; nFile < nFiles; ++nFile )
+ }
+ SwGlblDocContents aTempContents;
+ for ( sal_Int32 nFile = 0; nFile < nFiles; ++nFile )
+ {
+ //update the global document content after each inserted document
+ rSh.GetGlobalDocContent(aTempContents);
+ SwGlblDocContent* pAnchorContent = nullptr;
+ OSL_ENSURE(aTempContents.size() > (nAnchorContent + nFile), "invalid anchor content -> last insertion failed");
+ if ( aTempContents.size() > (nAnchorContent + nFile) )
+ pAnchorContent = aTempContents[nAnchorContent + nFile];
+ else
+ pAnchorContent = aTempContents.back();
+ OUString sFileName(pFileNames[nFile]);
+ INetURLObject aFileUrl;
+ aFileUrl.SetSmartURL( sFileName );
+ OUString sSectionName(aFileUrl.GetLastName(
+ INetURLObject::DecodeMechanism::Unambiguous).getToken(0, sfx2::cTokenSeparator));
+ sal_uInt16 nSectCount = rSh.GetSectionFormatCount();
+ OUString sTempSectionName(sSectionName);
+ sal_uInt16 nAddNumber = 0;
+ sal_uInt16 nCount = 0;
+ // if applicable: add index if the range name is already in use.
+ while ( nCount < nSectCount )
{
- //update the global document content after each inserted document
- rSh.GetGlobalDocContent(aTempContents);
- SwGlblDocContent* pAnchorContent = nullptr;
- OSL_ENSURE(aTempContents.size() > (nAnchorContent + nFile), "invalid anchor content -> last insertion failed");
- if ( aTempContents.size() > (nAnchorContent + nFile) )
- pAnchorContent = aTempContents[nAnchorContent + nFile];
- else
- pAnchorContent = aTempContents.back();
- OUString sFileName(pFileNames[nFile]);
- INetURLObject aFileUrl;
- aFileUrl.SetSmartURL( sFileName );
- OUString sSectionName(aFileUrl.GetLastName(
- INetURLObject::DecodeMechanism::Unambiguous).getToken(0, sfx2::cTokenSeparator));
- sal_uInt16 nSectCount = rSh.GetSectionFormatCount();
- OUString sTempSectionName(sSectionName);
- sal_uInt16 nAddNumber = 0;
- sal_uInt16 nCount = 0;
- // if applicable: add index if the range name is already in use.
- while ( nCount < nSectCount )
+ const SwSectionFormat& rFormat = rSh.GetSectionFormat(nCount);
+ if ((rFormat.GetSection()->GetSectionName() == sTempSectionName)
+ && rFormat.IsInNodesArr())
{
- const SwSectionFormat& rFormat = rSh.GetSectionFormat(nCount);
- if ((rFormat.GetSection()->GetSectionName() == sTempSectionName)
- && rFormat.IsInNodesArr())
- {
- nCount = 0;
- nAddNumber++;
- sTempSectionName = sSectionName + ":" + OUString::number( nAddNumber );
- }
- else
- nCount++;
+ nCount = 0;
+ nAddNumber++;
+ sTempSectionName = sSectionName + ":" + OUString::number( nAddNumber );
}
+ else
+ nCount++;
+ }
- if ( nAddNumber )
- sSectionName = sTempSectionName;
+ if ( nAddNumber )
+ sSectionName = sTempSectionName;
- SwSectionData aSectionData(CONTENT_SECTION, sSectionName);
- aSectionData.SetProtectFlag(true);
- aSectionData.SetHidden(false);
+ SwSectionData aSectionData(CONTENT_SECTION, sSectionName);
+ aSectionData.SetProtectFlag(true);
+ aSectionData.SetHidden(false);
- aSectionData.SetLinkFileName(sFileName);
- aSectionData.SetType(FILE_LINK_SECTION);
- aSectionData.SetLinkFilePassword( OUString() );
+ aSectionData.SetLinkFileName(sFileName);
+ aSectionData.SetType(FILE_LINK_SECTION);
+ aSectionData.SetLinkFilePassword( OUString() );
- rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
- }
- if ( bMove )
- {
- Update( false );
- rSh.MoveGlobalDocContent(
- *m_pSwGlblDocContents, nEntryCount, nEntryCount + nFiles, nEntryCount - nFiles );
- }
- rSh.EndAction();
+ rSh.InsertGlobalDocContent( *pAnchorContent, aSectionData );
+ }
+ if ( bMove )
+ {
Update( false );
- Display();
+ rSh.MoveGlobalDocContent(
+ *m_pSwGlblDocContents, nEntryCount, nEntryCount + nFiles, nEntryCount - nFiles );
}
+ rSh.EndAction();
+ Update( false );
+ Display();
+
}
IMPL_LINK( SwGlobalTree, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void )
diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx
index 00f701561e7c..355b41d76faa 100644
--- a/sw/source/uibase/utlui/numfmtlb.cxx
+++ b/sw/source/uibase/utlui/numfmtlb.cxx
@@ -104,135 +104,136 @@ NumFormatListBox::~NumFormatListBox()
void NumFormatListBox::SetFormatType(const short nFormatType)
{
- if (nCurrFormatType == -1 ||
- (nCurrFormatType & nFormatType) == 0) // there are mixed formats, like for example DateTime
- {
- SwView *pView = GetActiveView();
- OSL_ENSURE(pView, "no view found");
- if(!pView)
- return;
- SwWrtShell &rSh = pView->GetWrtShell();
- SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
-
- Clear(); // Remove all entries from the Listbox
-
- NfIndexTableOffset eOffsetStart = NF_NUMBER_START;
- NfIndexTableOffset eOffsetEnd = NF_NUMBER_START;
-
- switch( nFormatType )
- {
- case css::util::NumberFormat::NUMBER:
- eOffsetStart=NF_NUMBER_START;
- eOffsetEnd=NF_NUMBER_END;
- break;
-
- case css::util::NumberFormat::PERCENT:
- eOffsetStart=NF_PERCENT_START;
- eOffsetEnd=NF_PERCENT_END;
- break;
-
- case css::util::NumberFormat::CURRENCY:
- eOffsetStart=NF_CURRENCY_START;
- eOffsetEnd=NF_CURRENCY_END;
- break;
-
- case css::util::NumberFormat::DATETIME:
- eOffsetStart=NF_DATE_START;
- eOffsetEnd=NF_TIME_END;
- break;
-
- case css::util::NumberFormat::DATE:
- eOffsetStart=NF_DATE_START;
- eOffsetEnd=NF_DATE_END;
- break;
+ if (nCurrFormatType != -1 &&
+ (nCurrFormatType & nFormatType) != 0) // there are mixed formats, like for example DateTime
+ return;
- case css::util::NumberFormat::TIME:
- eOffsetStart=NF_TIME_START;
- eOffsetEnd=NF_TIME_END;
- break;
+ SwView *pView = GetActiveView();
+ OSL_ENSURE(pView, "no view found");
+ if(!pView)
+ return;
+ SwWrtShell &rSh = pView->GetWrtShell();
+ SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
- case css::util::NumberFormat::SCIENTIFIC:
- eOffsetStart=NF_SCIENTIFIC_START;
- eOffsetEnd=NF_SCIENTIFIC_END;
- break;
+ Clear(); // Remove all entries from the Listbox
- case css::util::NumberFormat::FRACTION:
- eOffsetStart=NF_FRACTION_START;
- eOffsetEnd=NF_FRACTION_END;
- break;
+ NfIndexTableOffset eOffsetStart = NF_NUMBER_START;
+ NfIndexTableOffset eOffsetEnd = NF_NUMBER_START;
- case css::util::NumberFormat::LOGICAL:
- eOffsetStart=NF_BOOLEAN;
- eOffsetEnd=NF_BOOLEAN;
- break;
+ switch( nFormatType )
+ {
+ case css::util::NumberFormat::NUMBER:
+ eOffsetStart=NF_NUMBER_START;
+ eOffsetEnd=NF_NUMBER_END;
+ break;
+
+ case css::util::NumberFormat::PERCENT:
+ eOffsetStart=NF_PERCENT_START;
+ eOffsetEnd=NF_PERCENT_END;
+ break;
+
+ case css::util::NumberFormat::CURRENCY:
+ eOffsetStart=NF_CURRENCY_START;
+ eOffsetEnd=NF_CURRENCY_END;
+ break;
+
+ case css::util::NumberFormat::DATETIME:
+ eOffsetStart=NF_DATE_START;
+ eOffsetEnd=NF_TIME_END;
+ break;
+
+ case css::util::NumberFormat::DATE:
+ eOffsetStart=NF_DATE_START;
+ eOffsetEnd=NF_DATE_END;
+ break;
+
+ case css::util::NumberFormat::TIME:
+ eOffsetStart=NF_TIME_START;
+ eOffsetEnd=NF_TIME_END;
+ break;
+
+ case css::util::NumberFormat::SCIENTIFIC:
+ eOffsetStart=NF_SCIENTIFIC_START;
+ eOffsetEnd=NF_SCIENTIFIC_END;
+ break;
+
+ case css::util::NumberFormat::FRACTION:
+ eOffsetStart=NF_FRACTION_START;
+ eOffsetEnd=NF_FRACTION_END;
+ break;
+
+ case css::util::NumberFormat::LOGICAL:
+ eOffsetStart=NF_BOOLEAN;
+ eOffsetEnd=NF_BOOLEAN;
+ break;
+
+ case css::util::NumberFormat::TEXT:
+ eOffsetStart=NF_TEXT;
+ eOffsetEnd=NF_TEXT;
+ break;
+
+ case css::util::NumberFormat::ALL:
+ eOffsetStart=NF_NUMERIC_START;
+ eOffsetEnd = NfIndexTableOffset( NF_INDEX_TABLE_ENTRIES - 1 );
+ break;
+
+ default:
+ OSL_FAIL("what a format?");
+ break;
+ }
- case css::util::NumberFormat::TEXT:
- eOffsetStart=NF_TEXT;
- eOffsetEnd=NF_TEXT;
- break;
+ const SvNumberformat* pFormat;
+ sal_Int32 i = 0;
+ Color* pCol;
+ double fVal = GetDefValue( nFormatType );
+ OUString sValue;
- case css::util::NumberFormat::ALL:
- eOffsetStart=NF_NUMERIC_START;
- eOffsetEnd = NfIndexTableOffset( NF_INDEX_TABLE_ENTRIES - 1 );
- break;
+ const sal_uInt32 nSysNumFormat = pFormatter->GetFormatIndex(
+ NF_NUMBER_SYSTEM, eCurLanguage );
+ const sal_uInt32 nSysShortDateFormat = pFormatter->GetFormatIndex(
+ NF_DATE_SYSTEM_SHORT, eCurLanguage );
+ const sal_uInt32 nSysLongDateFormat = pFormatter->GetFormatIndex(
+ NF_DATE_SYSTEM_LONG, eCurLanguage );
- default:
- OSL_FAIL("what a format?");
- break;
+ for( long nIndex = eOffsetStart; nIndex <= eOffsetEnd; ++nIndex )
+ {
+ const sal_uInt32 nFormat = pFormatter->GetFormatIndex(
+ (NfIndexTableOffset)nIndex, eCurLanguage );
+ pFormat = pFormatter->GetEntry( nFormat );
+
+ if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD,
+ eCurLanguage )
+ || const_cast<SvNumberformat*>(pFormat)->GetOutputString( fVal, sValue, &pCol )
+ || nFormatType == css::util::NumberFormat::UNDEFINED )
+ {
+ sValue = pFormat->GetFormatstring();
+ }
+ else if( nFormatType == css::util::NumberFormat::TEXT )
+ {
+ pFormatter->GetOutputString( "\"ABC\"", nFormat, sValue, &pCol);
}
- const SvNumberformat* pFormat;
- sal_Int32 i = 0;
- Color* pCol;
- double fVal = GetDefValue( nFormatType );
- OUString sValue;
-
- const sal_uInt32 nSysNumFormat = pFormatter->GetFormatIndex(
- NF_NUMBER_SYSTEM, eCurLanguage );
- const sal_uInt32 nSysShortDateFormat = pFormatter->GetFormatIndex(
- NF_DATE_SYSTEM_SHORT, eCurLanguage );
- const sal_uInt32 nSysLongDateFormat = pFormatter->GetFormatIndex(
- NF_DATE_SYSTEM_LONG, eCurLanguage );
-
- for( long nIndex = eOffsetStart; nIndex <= eOffsetEnd; ++nIndex )
+ if (nFormat != nSysNumFormat &&
+ nFormat != nSysShortDateFormat &&
+ nFormat != nSysLongDateFormat)
{
- const sal_uInt32 nFormat = pFormatter->GetFormatIndex(
- (NfIndexTableOffset)nIndex, eCurLanguage );
- pFormat = pFormatter->GetEntry( nFormat );
-
- if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD,
- eCurLanguage )
- || const_cast<SvNumberformat*>(pFormat)->GetOutputString( fVal, sValue, &pCol )
- || nFormatType == css::util::NumberFormat::UNDEFINED )
- {
- sValue = pFormat->GetFormatstring();
- }
- else if( nFormatType == css::util::NumberFormat::TEXT )
- {
- pFormatter->GetOutputString( "\"ABC\"", nFormat, sValue, &pCol);
- }
-
- if (nFormat != nSysNumFormat &&
- nFormat != nSysShortDateFormat &&
- nFormat != nSysLongDateFormat)
- {
- const sal_Int32 nPos = InsertEntry( sValue );
- SetEntryData( nPos, reinterpret_cast<void*>(nFormat) );
-
- if( nFormat == pFormatter->GetStandardFormat(
- nFormatType, eCurLanguage ) )
- nStdEntry = i;
- ++i;
- }
+ const sal_Int32 nPos = InsertEntry( sValue );
+ SetEntryData( nPos, reinterpret_cast<void*>(nFormat) );
+
+ if( nFormat == pFormatter->GetStandardFormat(
+ nFormatType, eCurLanguage ) )
+ nStdEntry = i;
+ ++i;
}
+ }
- const sal_Int32 nPos = InsertEntry(SwResId( STR_DEFINE_NUMBERFORMAT ));
- SetEntryData( nPos, nullptr );
+ const sal_Int32 nPos = InsertEntry(SwResId( STR_DEFINE_NUMBERFORMAT ));
+ SetEntryData( nPos, nullptr );
- SelectEntryPos( nStdEntry );
+ SelectEntryPos( nStdEntry );
+
+ nCurrFormatType = nFormatType;
- nCurrFormatType = nFormatType;
- }
}
namespace
@@ -338,75 +339,76 @@ IMPL_LINK( NumFormatListBox, SelectHdl, ListBox&, rBox, void )
OUString sDefine(SwResId( STR_DEFINE_NUMBERFORMAT ));
SwView *pView = GetActiveView();
- if( pView && nPos == rBox.GetEntryCount() - 1 &&
- rBox.GetEntry( nPos ) == sDefine )
- {
- SwWrtShell &rSh = pView->GetWrtShell();
- SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
-
- SfxItemSet aCoreSet(
- rSh.GetAttrPool(),
- svl::Items<
- SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
- SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
+ if( !pView || nPos != rBox.GetEntryCount() - 1 ||
+ rBox.GetEntry( nPos ) != sDefine )
+ return;
+
+ SwWrtShell &rSh = pView->GetWrtShell();
+ SvNumberFormatter* pFormatter = rSh.GetNumberFormatter();
+
+ SfxItemSet aCoreSet(
+ rSh.GetAttrPool(),
+ svl::Items<
+ SID_ATTR_NUMBERFORMAT_VALUE, SID_ATTR_NUMBERFORMAT_INFO,
+ SID_ATTR_NUMBERFORMAT_ONE_AREA, SID_ATTR_NUMBERFORMAT_ONE_AREA,
+ SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
- SID_ATTR_NUMBERFORMAT_NOLANGUAGE,
- SID_ATTR_NUMBERFORMAT_ADD_AUTO,
- SID_ATTR_NUMBERFORMAT_ADD_AUTO>{});
+ SID_ATTR_NUMBERFORMAT_ADD_AUTO,
+ SID_ATTR_NUMBERFORMAT_ADD_AUTO>{});
+
+ double fValue = GetDefValue( nCurrFormatType);
+
+ sal_uInt32 nFormat = pFormatter->GetStandardFormat( nCurrFormatType, eCurLanguage);
+ aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormat ));
- double fValue = GetDefValue( nCurrFormatType);
+ aCoreSet.Put( SvxNumberInfoItem( pFormatter, fValue,
+ SID_ATTR_NUMBERFORMAT_INFO ) );
- sal_uInt32 nFormat = pFormatter->GetStandardFormat( nCurrFormatType, eCurLanguage);
- aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, nFormat ));
+ if( (css::util::NumberFormat::DATE | css::util::NumberFormat::TIME) & nCurrFormatType )
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, bOneArea));
- aCoreSet.Put( SvxNumberInfoItem( pFormatter, fValue,
- SID_ATTR_NUMBERFORMAT_INFO ) );
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, !bShowLanguageControl));
+ aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, bUseAutomaticLanguage));
- if( (css::util::NumberFormat::DATE | css::util::NumberFormat::TIME) & nCurrFormatType )
- aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ONE_AREA, bOneArea));
+ SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
+ assert(pFact && "SwAbstractDialogFactory fail!");
+ ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateNumFormatDialog(this, aCoreSet));
+ assert(pDlg && "Dialog creation failed!");
- aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_NOLANGUAGE, !bShowLanguageControl));
- aCoreSet.Put(SfxBoolItem(SID_ATTR_NUMBERFORMAT_ADD_AUTO, bUseAutomaticLanguage));
+ if (RET_OK == pDlg->Execute())
+ {
+ const SfxPoolItem* pItem = pView->GetDocShell()->
+ GetItem( SID_ATTR_NUMBERFORMAT_INFO );
+
+ if( pItem && 0 != static_cast<const SvxNumberInfoItem*>(pItem)->GetDelCount() )
+ {
+ const sal_uInt32* pDelArr = static_cast<const SvxNumberInfoItem*>(pItem)->GetDelArray();
- SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
- assert(pFact && "SwAbstractDialogFactory fail!");
- ScopedVclPtr<SfxAbstractDialog> pDlg(pFact->CreateNumFormatDialog(this, aCoreSet));
- assert(pDlg && "Dialog creation failed!");
+ for ( sal_uInt32 i = 0; i < static_cast<const SvxNumberInfoItem*>(pItem)->GetDelCount(); i++ )
+ pFormatter->DeleteEntry( pDelArr[i] );
+ }
- if (RET_OK == pDlg->Execute())
+ const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
+ if( SfxItemState::SET == pOutSet->GetItemState(
+ SID_ATTR_NUMBERFORMAT_VALUE, false, &pItem ))
{
- const SfxPoolItem* pItem = pView->GetDocShell()->
- GetItem( SID_ATTR_NUMBERFORMAT_INFO );
-
- if( pItem && 0 != static_cast<const SvxNumberInfoItem*>(pItem)->GetDelCount() )
- {
- const sal_uInt32* pDelArr = static_cast<const SvxNumberInfoItem*>(pItem)->GetDelArray();
-
- for ( sal_uInt32 i = 0; i < static_cast<const SvxNumberInfoItem*>(pItem)->GetDelCount(); i++ )
- pFormatter->DeleteEntry( pDelArr[i] );
- }
-
- const SfxItemSet* pOutSet = pDlg->GetOutputItemSet();
- if( SfxItemState::SET == pOutSet->GetItemState(
- SID_ATTR_NUMBERFORMAT_VALUE, false, &pItem ))
- {
- sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
- // oj #105473# change order of calls
- const SvNumberformat* pFormat = pFormatter->GetEntry(nNumberFormat);
- if( pFormat )
- eCurLanguage = pFormat->GetLanguage();
- // SetDefFormat uses eCurLanguage to look for if this format already in the list
- SetDefFormat(nNumberFormat);
- }
- if( bShowLanguageControl && SfxItemState::SET == pOutSet->GetItemState(
- SID_ATTR_NUMBERFORMAT_ADD_AUTO, false, &pItem ))
- {
- bUseAutomaticLanguage = static_cast<const SfxBoolItem*>(pItem)->GetValue();
- }
+ sal_uInt32 nNumberFormat = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
+ // oj #105473# change order of calls
+ const SvNumberformat* pFormat = pFormatter->GetEntry(nNumberFormat);
+ if( pFormat )
+ eCurLanguage = pFormat->GetLanguage();
+ // SetDefFormat uses eCurLanguage to look for if this format already in the list
+ SetDefFormat(nNumberFormat);
+ }
+ if( bShowLanguageControl && SfxItemState::SET == pOutSet->GetItemState(
+ SID_ATTR_NUMBERFORMAT_ADD_AUTO, false, &pItem ))
+ {
+ bUseAutomaticLanguage = static_cast<const SfxBoolItem*>(pItem)->GetValue();
}
- else
- SetDefFormat(nFormat);
}
+ else
+ SetDefFormat(nFormat);
+
}
double NumFormatListBox::GetDefValue(const short nFormatType)
diff --git a/sw/source/uibase/utlui/unotools.cxx b/sw/source/uibase/utlui/unotools.cxx
index 6d2cd6f3f9b1..64107830e955 100644
--- a/sw/source/uibase/utlui/unotools.cxx
+++ b/sw/source/uibase/utlui/unotools.cxx
@@ -112,42 +112,43 @@ void SwOneExampleFrame::CreateControl()
uno::Reference< uno::XComponentContext > xContext = comphelper::getProcessComponentContext();
uno::Reference< uno::XInterface > xInst = xMgr->createInstance( "com.sun.star.frame.FrameControl" );
m_xControl.set(xInst, uno::UNO_QUERY);
- if(m_xControl.is())
- {
- uno::Reference< awt::XWindowPeer > xParent( m_aTopWindow->GetComponentInterface() );
+ if(!m_xControl.is())
+ return;
- uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
+ uno::Reference< awt::XWindowPeer > xParent( m_aTopWindow->GetComponentInterface() );
- m_xControl->createPeer( xToolkit, xParent );
+ uno::Reference< awt::XToolkit > xToolkit( awt::Toolkit::create(xContext), uno::UNO_QUERY_THROW );
- uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY );
- xWin->setVisible(false);
- Size aWinSize(m_aTopWindow->GetOutputSizePixel());
- xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
+ m_xControl->createPeer( xToolkit, xParent );
- uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY);
- uno::Any aURL;
- // create new doc
- OUString sTempURL(cFactory);
- if(!m_sArgumentURL.isEmpty())
- sTempURL = m_sArgumentURL;
- aURL <<= sTempURL;
+ uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY );
+ xWin->setVisible(false);
+ Size aWinSize(m_aTopWindow->GetOutputSizePixel());
+ xWin->setPosSize( 0, 0, aWinSize.Width(), aWinSize.Height(), awt::PosSize::SIZE );
- uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
- { "OpenFlags", uno::Any(OUString("-RB")) },
- { "Referer", uno::Any(OUString("private:user")) },
- { "ReadOnly", uno::Any(true) }
- }));
- uno::Any aArgs(aSeq);
+ uno::Reference< beans::XPropertySet > xPrSet(xInst, uno::UNO_QUERY);
+ uno::Any aURL;
+ // create new doc
+ OUString sTempURL(cFactory);
+ if(!m_sArgumentURL.isEmpty())
+ sTempURL = m_sArgumentURL;
+ aURL <<= sTempURL;
- xPrSet->setPropertyValue( "LoaderArguments", aArgs );
- //save and set readonly???
+ uno::Sequence<beans::PropertyValue> aSeq( comphelper::InitPropertySequence({
+ { "OpenFlags", uno::Any(OUString("-RB")) },
+ { "Referer", uno::Any(OUString("private:user")) },
+ { "ReadOnly", uno::Any(true) }
+ }));
+ uno::Any aArgs(aSeq);
- xPrSet->setPropertyValue("ComponentURL", aURL);
+ xPrSet->setPropertyValue( "LoaderArguments", aArgs );
+ //save and set readonly???
+
+ xPrSet->setPropertyValue("ComponentURL", aURL);
+
+ m_aLoadedIdle.Start();
+ m_bServiceAvailable = true;
- m_aLoadedIdle.Start();
- m_bServiceAvailable = true;
- }
}
void SwOneExampleFrame::DisposeControl()