reportdesign/source/ui/report/ViewsWindow.cxx | 13 +++- svtools/source/control/ctrlbox.cxx | 9 +- sw/source/core/text/inftxt.cxx | 5 - sw/source/core/text/inftxt.hxx | 2 sw/source/core/text/itrform2.cxx | 48 ++++++++++++++- sw/source/core/text/porfld.cxx | 6 + sw/source/core/text/porfld.hxx | 15 ++++ sw/source/core/text/portxt.cxx | 82 ++++---------------------- sw/source/core/text/portxt.hxx | 9 +- 9 files changed, 104 insertions(+), 85 deletions(-)
New commits: commit 9b3ff437132b77de62f25b83e65be67100c610ca Author: Caolán McNamara <caol...@redhat.com> Date: Wed Apr 2 12:38:36 2014 +0100 coverity#707971 Uninitialized scalar field Change-Id: I5c1045253c082a00397cf0f048baee947232c9b1 (cherry picked from commit 4ab06a576313de973ae96787a19215b208737859) Reviewed-on: https://gerrit.libreoffice.org/8820 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx index 910f056..7608789 100644 --- a/reportdesign/source/ui/report/ViewsWindow.cxx +++ b/reportdesign/source/ui/report/ViewsWindow.cxx @@ -958,8 +958,17 @@ namespace sal_Bool m_bCopy; public: - ApplySectionViewAction( sal_Bool _bCopy ) : m_eAction( eEndDragObj ), m_bCopy( _bCopy ) { } - ApplySectionViewAction(SectionViewAction _eAction = eEndAction ) : m_eAction( _eAction ) { } + ApplySectionViewAction(sal_Bool _bCopy) + : m_eAction(eEndDragObj) + , m_bCopy(_bCopy) + { + } + + ApplySectionViewAction(SectionViewAction _eAction = eEndAction) + : m_eAction(_eAction) + , m_bCopy(false) + { + } void operator() ( const OViewsWindow::TSectionsMap::value_type& _rhs ) { commit 3b39a6e87a7f81f90a0e41924750148d74bed3b9 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Apr 2 13:47:54 2014 +0100 Resolves: fdo#76905 long delay when changing font size from % to pt (cherry picked from commit aa16ca73260681b19f0be8a58be95ed454580f7f) Conflicts: svtools/source/control/ctrlbox.cxx Change-Id: I33d72b51536ab96653ccda64c6e058c497289327 Reviewed-on: https://gerrit.libreoffice.org/8814 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index fe48970..9250f30 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -1879,13 +1879,13 @@ void FontSizeBox::SetRelative( sal_Bool bNewRelative ) if ( bPtRelative ) { + Clear(); //clear early because SetDecimalDigits is a slow recalc + SetDecimalDigits( 1 ); SetMin( nPtRelMin ); SetMax( nPtRelMax ); SetUnit( FUNIT_POINT ); - Clear(); - short i = nPtRelMin, n = 0; // JP 30.06.98: more than 100 values are not useful while ( i <= nPtRelMax && n++ < 100 ) @@ -1896,13 +1896,14 @@ void FontSizeBox::SetRelative( sal_Bool bNewRelative ) } else { + Clear(); //clear early because SetDecimalDigits is a slow recalc + SetDecimalDigits( 0 ); SetMin( nRelMin ); SetMax( nRelMax ); SetCustomUnitText(OUString('%')); SetUnit( FUNIT_CUSTOM ); - Clear(); sal_uInt16 i = nRelMin; while ( i <= nRelMax ) { @@ -1913,6 +1914,8 @@ void FontSizeBox::SetRelative( sal_Bool bNewRelative ) } else { + if (pFontList) + Clear(); //clear early because SetDecimalDigits is a slow recalc bRelative = bPtRelative = sal_False; SetDecimalDigits( 1 ); SetMin( 20 ); commit 6749b28c53903924d865a9001a9cb28c27284ba2 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Mar 26 17:08:35 2014 +0000 Resolves: fdo#73936 make FormFieldDropDowns a real fieldportion split the checkbox and list and use a field portion for the list. That way it knows how to line break correctly wrt hardspaces and doesn't hang when the situation arises. (cherry picked from commit a52ee51269a47e52d68405caf8507e1abaa6fd8f) Conflicts: sw/source/core/text/itrform2.cxx sw/source/core/text/portxt.cxx sw/source/core/text/portxt.hxx Change-Id: I46d73f19ef8e51e7c21c8783ce70bb80d98a784c Reviewed-on: https://gerrit.libreoffice.org/8776 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx index adf78fa..8d03d84 100644 --- a/sw/source/core/text/inftxt.cxx +++ b/sw/source/core/text/inftxt.cxx @@ -1056,7 +1056,7 @@ void SwTxtPaintInfo::DrawPostIts( const SwLinePortion&, sal_Bool bScript ) const } } -void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) const +void SwTxtPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const { SwRect aIntersect; CalcRect( rPor, &aIntersect, 0 ); @@ -1078,7 +1078,8 @@ void SwTxtPaintInfo::DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) m_pOut->SetLineColor( Color(0, 0, 0)); m_pOut->SetFillColor(); m_pOut->DrawRect( r ); - if (checked) { + if (bChecked) + { m_pOut->DrawLine(r.TopLeft(), r.BottomRight()); m_pOut->DrawLine(r.TopRight(), r.BottomLeft()); } diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx index 2127221..8c3ed9a 100644 --- a/sw/source/core/text/inftxt.hxx +++ b/sw/source/core/text/inftxt.hxx @@ -450,7 +450,7 @@ public: **/ void DrawBorder( const SwLinePortion &rPor ) const; - void DrawCheckBox( const SwFieldFormPortion &rPor, bool checked) const; + void DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool bChecked) const; inline void NotifyURL( const SwLinePortion &rPor ) const { if( URLNotify() ) _NotifyURL( rPor ); } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 12c58e4..9cb57bc 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -55,6 +55,7 @@ #include <doc.hxx> #include <pormulti.hxx> #include <unotools/charclass.hxx> +#include <xmloff/odffields.hxx> #include <vector> @@ -876,11 +877,31 @@ void SwMetaPortion::Paint( const SwTxtPaintInfo &rInf ) const } } +namespace { + using namespace sw::mark; + static OUString getCurrentListIndex(IFieldmark* pBM) + { + const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters(); + sal_Int32 nCurrentIdx = 0; + const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(OUString(ODF_FORMDROPDOWN_RESULT)); + if(pResult != pParameters->end()) + pResult->second >>= nCurrentIdx; + + const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(OUString(ODF_FORMDROPDOWN_LISTENTRY)); + if (pListEntries != pParameters->end()) + { + uno::Sequence< OUString > vListEntries; + pListEntries->second >>= vListEntries; + if (nCurrentIdx < vListEntries.getLength()) + return vListEntries[nCurrentIdx]; + } + return OUString(); + } +} /************************************************************************* * SwTxtFormatter::WhichTxtPor() *************************************************************************/ - SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const { SwTxtPortion *pPor = 0; @@ -912,7 +933,29 @@ SwTxtPortion *SwTxtFormatter::WhichTxtPor( SwTxtFormatInfo &rInf ) const else if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FIELDEND ) pPor = new SwFieldMarkPortion(); else if( rInf.GetTxt()[rInf.GetIdx()]==CH_TXT_ATR_FORMELEMENT ) - pPor = new SwFieldFormPortion(); + { + SwTxtNode *pNd = const_cast<SwTxtNode *>(rInf.GetTxtFrm()->GetTxtNode()); + const SwDoc *doc = pNd->GetDoc(); + SwIndex aIndex(pNd, rInf.GetIdx()); + SwPosition aPosition(*pNd, aIndex); + sw::mark::IFieldmark *pBM = doc->getIDocumentMarkAccess()->getFieldmarkFor(aPosition); + OSL_ENSURE(pBM != NULL, "Where is my form field bookmark???"); + if (pBM != NULL) + { + if (pBM->GetFieldname( ) == ODF_FORMCHECKBOX) + { + pPor = new SwFieldFormCheckboxPortion(); + } + else if (pBM->GetFieldname( ) == ODF_FORMDROPDOWN) + { + pPor = new SwFieldFormDropDownPortion(getCurrentListIndex(pBM)); + } + else + { + assert( false ); // unknown type... + } + } + } } if( !pPor ) { @@ -1010,7 +1053,6 @@ SwTxtPortion *SwTxtFormatter::NewTxtPortion( SwTxtFormatInfo &rInf ) /************************************************************************* * SwTxtFormatter::WhichFirstPortion() *************************************************************************/ - SwLinePortion *SwTxtFormatter::WhichFirstPortion(SwTxtFormatInfo &rInf) { SwLinePortion *pPor = 0; diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index b0c57ac..f2f5a0f 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -40,7 +40,6 @@ #include <porftn.hxx> #include <accessibilityoptions.hxx> #include <editeng/lrspitem.hxx> - #include <unicode/ubidi.h> using namespace ::com::sun::star; @@ -1352,4 +1351,9 @@ KSHORT SwCombinedPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const return SwFldPortion::GetViewWidth( rInf ); } +SwFldPortion *SwFieldFormDropDownPortion::Clone(const OUString &rExpand) const +{ + return new SwFieldFormDropDownPortion(rExpand); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index ef9f956..16ab858 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -246,6 +246,21 @@ public: OUTPUT_OPERATOR }; +namespace sw { namespace mark { + class IFieldmark; +} } + +class SwFieldFormDropDownPortion : public SwFldPortion +{ +public: + SwFieldFormDropDownPortion(const OUString &rExpand) + : SwFldPortion(rExpand) + { + } + // Field cloner for SplitGlue + virtual SwFldPortion *Clone( const OUString &rExpand ) const; +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index 68a290bd..b6ee27e 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -916,32 +916,7 @@ sal_Bool SwFieldMarkPortion::Format( SwTxtFormatInfo & ) return ret; } -namespace { - static sal_Int32 getCurrentListIndex( IFieldmark* pBM, - OUString* io_pCurrentText = NULL ) - { - const IFieldmark::parameter_map_t* const pParameters = pBM->GetParameters(); - sal_Int32 nCurrentIdx = 0; - const IFieldmark::parameter_map_t::const_iterator pResult = pParameters->find(OUString(ODF_FORMDROPDOWN_RESULT)); - if(pResult != pParameters->end()) - pResult->second >>= nCurrentIdx; - if(io_pCurrentText) - { - const IFieldmark::parameter_map_t::const_iterator pListEntries = pParameters->find(OUString(ODF_FORMDROPDOWN_LISTENTRY)); - if(pListEntries != pParameters->end()) - { - uno::Sequence< OUString > vListEntries; - pListEntries->second >>= vListEntries; - if(nCurrentIdx < vListEntries.getLength()) - *io_pCurrentText = vListEntries[nCurrentIdx]; - } - } - return nCurrentIdx; - } -} - -//FIXME Fieldbk -void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const +void SwFieldFormCheckboxPortion::Paint( const SwTxtPaintInfo& rInf ) const { SwTxtNode* pNd = const_cast<SwTxtNode*>(rInf.GetTxtFrm()->GetTxtNode()); const SwDoc *doc=pNd->GetDoc(); @@ -950,33 +925,18 @@ void SwFieldFormPortion::Paint( const SwTxtPaintInfo& rInf ) const IFieldmark* pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition ); - OSL_ENSURE( pBM, - "SwFieldFormPortion::Paint(..)" - " - Where is my form field bookmark???"); + OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX, + "Where is my form field bookmark???"); - if ( pBM != NULL ) + if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX) { - if ( pBM->GetFieldname( ) == ODF_FORMCHECKBOX ) - { // a checkbox... - ICheckboxFieldmark* pCheckboxFm = dynamic_cast< ICheckboxFieldmark* >(pBM); - bool checked = pCheckboxFm->IsChecked(); - rInf.DrawCheckBox(*this, checked); - } - else if ( pBM->GetFieldname( ) == ODF_FORMDROPDOWN ) - { // a list... - OUString aTxt; - getCurrentListIndex( pBM, &aTxt ); - rInf.DrawViewOpt( *this, POR_FLD ); - rInf.DrawText( aTxt, *this, 0, aTxt.getLength(), false ); - } - else - { - assert(0); // unknown type... - } + const ICheckboxFieldmark* pCheckboxFm = dynamic_cast< ICheckboxFieldmark* >(pBM); + bool bChecked = pCheckboxFm && pCheckboxFm->IsChecked(); + rInf.DrawCheckBox(*this, bChecked); } } -sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo & rInf ) +sal_Bool SwFieldFormCheckboxPortion::Format( SwTxtFormatInfo & rInf ) { sal_Bool ret = 0; SwTxtNode *pNd = const_cast < SwTxtNode * >( rInf.GetTxtFrm( )->GetTxtNode( ) ); @@ -984,28 +944,12 @@ sal_Bool SwFieldFormPortion::Format( SwTxtFormatInfo & rInf ) SwIndex aIndex( pNd, rInf.GetIdx( ) ); SwPosition aPosition( *pNd, aIndex ); IFieldmark *pBM = doc->getIDocumentMarkAccess( )->getFieldmarkFor( aPosition ); - OSL_ENSURE( pBM != NULL, "Where is my form field bookmark???" ); - if ( pBM != NULL ) + OSL_ENSURE(pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX, "Where is my form field bookmark???"); + if (pBM && pBM->GetFieldname( ) == ODF_FORMCHECKBOX) { - if ( pBM->GetFieldname( ) == ODF_FORMCHECKBOX ) - { - Width( rInf.GetTxtHeight( ) ); - Height( rInf.GetTxtHeight( ) ); - SetAscent( rInf.GetAscent( ) ); - } - else if ( pBM->GetFieldname( ) == ODF_FORMDROPDOWN ) - { - OUString aTxt; - getCurrentListIndex( pBM, &aTxt ); - SwPosSize aPosSize = rInf.GetTxtSize( aTxt ); - Width( aPosSize.Width( ) ); - Height( aPosSize.Height( ) ); - SetAscent( rInf.GetAscent( ) ); - } - else - { - assert( 0 ); // unknown type... - } + Width( rInf.GetTxtHeight( ) ); + Height( rInf.GetTxtHeight( ) ); + SetAscent( rInf.GetAscent( ) ); } return ret; } diff --git a/sw/source/core/text/portxt.hxx b/sw/source/core/text/portxt.hxx index 71e6de5..4cec8cf 100644 --- a/sw/source/core/text/portxt.hxx +++ b/sw/source/core/text/portxt.hxx @@ -108,11 +108,12 @@ class SwFieldMarkPortion : public SwTxtPortion virtual sal_Bool Format( SwTxtFormatInfo &rInf ); }; -class SwFieldFormPortion : public SwTxtPortion +class SwFieldFormCheckboxPortion : public SwTxtPortion { - public: - inline SwFieldFormPortion() : SwTxtPortion() - { } +public: + SwFieldFormCheckboxPortion() : SwTxtPortion() + { + } virtual void Paint( const SwTxtPaintInfo &rInf ) const; virtual sal_Bool Format( SwTxtFormatInfo &rInf ); };
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits