oox/inc/oox/vml/vmlshape.hxx | 15 ++++++--------- oox/source/vml/vmlshape.cxx | 23 ++++++++++++++++++----- sw/inc/fldbas.hxx | 2 ++ sw/source/core/fields/fldbas.cxx | 15 +++++++++++++++ sw/source/core/layout/trvlfrm.cxx | 19 ++++++++++++++++++- sw/source/core/text/itrcrsr.cxx | 4 +++- sw/source/core/text/itrform2.cxx | 18 ++++++++++++++++++ sw/source/ui/docvw/edtwin.cxx | 7 ++++++- sw/source/ui/wrtsh/wrtsh2.cxx | 2 ++ 9 files changed, 88 insertions(+), 17 deletions(-)
New commits: commit ad19ec1d08aed974e193978eb3e647a2bcf06767 Author: Miklos Vajna <[email protected]> Date: Wed Jan 30 16:43:35 2013 +0100 n#792778 oox: implement import of v:line inside v:group The problem was that in ShapeBase::convertAndInsert(), the rectangle calculated for a line was zero, that's why it wasn't imported. Fix this by overriding the get*Rectangle() methods in LineShape, instead of doing so with implConvertAndInsert(). (cherry picked from commit 7877638814de86202d33b5653a0f91d63341e98c) Conflicts: oox/source/vml/vmlshape.cxx Change-Id: Ie4bb2f7964b438cb56e4f5ee7a4ebe9f8f8eb734 diff --git a/oox/inc/oox/vml/vmlshape.hxx b/oox/inc/oox/vml/vmlshape.hxx index 2f4ab6f..bd7ced4 100644 --- a/oox/inc/oox/vml/vmlshape.hxx +++ b/oox/inc/oox/vml/vmlshape.hxx @@ -127,12 +127,10 @@ protected: ::com::sun::star::awt::Rectangle getCoordSystem() const; /** Returns the absolute shape rectangle according to the passed anchor. */ ::com::sun::star::awt::Rectangle getRectangle( const ShapeParentAnchor* pParentAnchor ) const; - -private: /** Returns the absolute shape rectangle. */ - ::com::sun::star::awt::Rectangle getAbsRectangle() const; + virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const; /** Returns the rectangle relative to the parent coordinate system. */ - ::com::sun::star::awt::Rectangle getRelRectangle() const; + virtual ::com::sun::star::awt::Rectangle getRelRectangle() const; protected: Drawing& mrDrawing; ///< The VML drawing page that contains this shape. @@ -340,11 +338,10 @@ public: explicit LineShape( Drawing& rDrawing ); protected: - /** Creates the corresponding XShape and inserts it into the passed container. */ - virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > - implConvertAndInsert( - const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes, - const ::com::sun::star::awt::Rectangle& rShapeRect ) const; + /** Returns the absolute shape rectangle. */ + virtual ::com::sun::star::awt::Rectangle getAbsRectangle() const; + /** Returns the rectangle relative to the parent coordinate system. */ + virtual ::com::sun::star::awt::Rectangle getRelRectangle() const; }; /** Bezier shape object that supports to, from, control1 and control2 diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 1b0caf9..6dfa35a 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -295,7 +295,6 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS according to some imported shape client data (e.g. Excel cell anchor). */ Rectangle aShapeRect = calcShapeRectangle( pParentAnchor ); - // convert the shape, if the calculated rectangle is not empty if( ((aShapeRect.Width > 0) || (aShapeRect.Height > 0)) && rxShapes.is() ) { xShape = implConvertAndInsert( rxShapes, aShapeRect ); @@ -318,6 +317,8 @@ Reference< XShape > ShapeBase::convertAndInsert( const Reference< XShapes >& rxS mrDrawing.notifyXShapeInserted( xShape, aShapeRect, *this, bGroupChild ); } } + else + SAL_WARN("oox", "not converting shape, as calculated rectangle is empty"); } return xShape; } @@ -610,10 +611,10 @@ LineShape::LineShape(Drawing& rDrawing) { } -Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const Rectangle& rShapeRect) const +awt::Rectangle LineShape::getAbsRectangle() const { const GraphicHelper& rGraphicHelper = mrDrawing.getFilter().getGraphicHelper(); - Rectangle aShapeRect(rShapeRect); + awt::Rectangle aShapeRect; sal_Int32 nIndex = 0; aShapeRect.X = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maFrom.getToken(0, ',', nIndex), 0, true, true); @@ -621,8 +622,20 @@ Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxSh nIndex = 0; aShapeRect.Width = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, true, true) - aShapeRect.X; aShapeRect.Height = ConversionHelper::decodeMeasureToHmm(rGraphicHelper, maShapeModel.maTo.getToken(0, ',', nIndex), 0, false, true) - aShapeRect.Y; + return aShapeRect; +} - return SimpleShape::implConvertAndInsert(rxShapes, aShapeRect); +awt::Rectangle LineShape::getRelRectangle() const +{ + awt::Rectangle aShapeRect; + sal_Int32 nIndex = 0; + + aShapeRect.X = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32(); + aShapeRect.Y = maShapeModel.maFrom.getToken(0, ',', nIndex).toInt32(); + nIndex = 0; + aShapeRect.Width = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.X; + aShapeRect.Height = maShapeModel.maTo.getToken(0, ',', nIndex).toInt32() - aShapeRect.Y; + return aShapeRect; } // ============================================================================ @@ -860,9 +873,9 @@ Reference< XShape > GroupShape::implConvertAndInsert( const Reference< XShapes > xGroupShape = mrDrawing.createAndInsertXShape( CREATE_OUSTRING( "com.sun.star.drawing.GroupShape" ), rxShapes, rShapeRect ); Reference< XShapes > xChildShapes( xGroupShape, UNO_QUERY_THROW ); mxChildren->convertAndInsert( xChildShapes, &aParentAnchor ); - // no child shape has been created - delete the group shape if( !xChildShapes->hasElements() ) { + SAL_WARN("oox", "no child shape has been created - deleting the group shape"); rxShapes->remove( xGroupShape ); xGroupShape.clear(); } commit cbb2863456cc71c44c8df70a4c4743537b0b0af9 Author: Miklos Vajna <[email protected]> Date: Tue Mar 5 16:25:57 2013 +0100 bnc#793998 SwTxtFormatter::FormatLine: fix missing repaints The incorrect SwLineLayout width caused a missing repaint when a character is inserted after the tab in the bugdoc, see the already existing sw/qa/extras/ooxmlimport/data/n793998.docx. Change-Id: I685203eeb2ed4236758d65132069cd894ece488c (cherry picked from commit 5dc729cae00e6ea35f5dde13eba89434be2d7dc5) diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index b36aa42..60c17da 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1595,6 +1595,24 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos ) } } + // In case of compat mode, it's possible that a tab portion is wider after + // formatting than before. If this is the case, we also have to make sure + // the SwLineLayout is wider as well. + if (GetInfo().GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_OVER_MARGIN)) + { + sal_uInt16 nSum = 0; + SwLinePortion* pPor = pCurr->GetFirstPortion(); + + while (pPor) + { + nSum += pPor->Width(); + pPor = pPor->GetPortion(); + } + + if (nSum > pCurr->Width()) + pCurr->Width(nSum); + } + // calculate optimal repaint rectangle if ( bOptimizeRepaint ) { commit 029ee0a0cb935283f0f0a997674944f1ea87c9f0 Author: Miklos Vajna <[email protected]> Date: Mon Feb 25 15:00:08 2013 +0100 n#793998 SwTxtCursor::GetCharRect: respect TabOverMargin compat mode Change-Id: I47280399bd9e0757365db8f4f1930efd0a340424 (cherry picked from commit 5e992f88d9f78a062bd78ea8907fa247f1f49b5f) diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx index 3127ae8..3fe4ce6 100644 --- a/sw/source/core/text/itrcrsr.cxx +++ b/sw/source/core/text/itrcrsr.cxx @@ -1209,7 +1209,9 @@ sal_Bool SwTxtCursor::GetCharRect( SwRect* pOrig, const xub_StrLen nOfst, pCMS->p2Lines->aPortion.Pos().Y() += aCharPos.Y(); } - if( pOrig->Left() > nTmpRight ) + const bool bTabOverMargin = GetTxtFrm()->GetTxtNode()->getIDocumentSettingAccess()->get(IDocumentSettingAccess::TAB_OVER_MARGIN); + // Make sure the cursor respects the right margin, unless in compat mode, where the tab size has priority over the margin size. + if( pOrig->Left() > nTmpRight && !bTabOverMargin) pOrig->Pos().X() = nTmpRight; if( nMax ) commit 88d46b9198a42956c521080f2aa7f3acf73cde06 Author: Miklos Vajna <[email protected]> Date: Tue Feb 26 11:48:22 2013 +0100 n#802888 SwEditWin: let fields have priority over header/footer flys http://people.freedesktop.org/~vmiklos/2013/watermark-field-click.odt is a reproducer, double-click was catched by the fly frame from the header, so the field edit dialog didn't appear. Change-Id: Ibd3ea382085fa4cbdc1af73d4be1e5c053a81eaa (cherry picked from commit 61f467c8974d6b6face41e7027d75ae4ddb6fdb2) Conflicts: sw/source/ui/docvw/edtwin.cxx diff --git a/sw/source/ui/docvw/edtwin.cxx b/sw/source/ui/docvw/edtwin.cxx index 27853a8..1529566 100644 --- a/sw/source/ui/docvw/edtwin.cxx +++ b/sw/source/ui/docvw/edtwin.cxx @@ -2774,6 +2774,12 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) bool bOverFly = false; bool bPageAnchored = false; bool bOverHeaderFooterFly = IsOverHeaderFooterFly( aDocPos, eControl, bOverFly, bPageAnchored ); + + sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly(); + if (bOverHeaderFooterFly && (!bIsDocReadOnly && rSh.GetCurFld())) + // We have a field here, that should have priority over header/footer fly. + bOverHeaderFooterFly = false; + int nNbFlyClicks = 1; // !bOverHeaderFooterFly doesn't mean we have a frame to select if ( !bPageAnchored && ( ( rSh.IsHeaderFooterEdit( ) && !bOverHeaderFooterFly && bOverFly ) || @@ -2870,7 +2876,6 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) // work but in practice ... rView.SelectShellForDrop(); - sal_Bool bIsDocReadOnly = rView.GetDocShell()->IsReadOnly(); sal_Bool bCallBase = sal_True; if( pQuickHlpData->m_bIsDisplayed ) commit a53e649884bb94dd99e9c930b583d8235add6363 Author: Miklos Vajna <[email protected]> Date: Tue Mar 19 13:41:19 2013 +0100 bnc#802888 SwPageFrm: let macro fields have priority over background objects The intention is to get similar behavior as 61f467c8974d6b6face41e7027d75ae4ddb6fdb2, except this applies to single clicks, while that one affected only double-click. Change-Id: Idddc26aa8cd064f89fb4f99b3ad7a5430ac455bc (cherry picked from commits a996678ed30804e16103e1cfdc439c8546e5d3b0 and e76e2c4ce76457e518b007b970e1b0c2742f8d6e) diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index c8e9fd7..55834ff 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -343,6 +343,8 @@ public: void SetAutomaticLanguage(sal_Bool bSet){bIsAutomaticLanguage = bSet;} virtual String GetDescription() const; + /// Is this field clickable? + bool IsClickable() const; }; inline SwFieldType* SwField::GetTyp() const diff --git a/sw/source/core/fields/fldbas.cxx b/sw/source/core/fields/fldbas.cxx index a28d6ee..1c9e2b9 100644 --- a/sw/source/core/fields/fldbas.cxx +++ b/sw/source/core/fields/fldbas.cxx @@ -761,6 +761,21 @@ String SwField::GetDescription() const return SW_RES(STR_FIELD); } +bool SwField::IsClickable() const +{ + switch (Which()) + { + case RES_JUMPEDITFLD: + case RES_MACROFLD: + case RES_GETREFFLD: + case RES_INPUTFLD: + case RES_SETEXPFLD: + case RES_DROPDOWN: + return true; + } + return false; +} + sal_uInt16 SwFldTypes::GetPos(const SwFieldType* pFieldType) const { const_iterator it = std::find(begin(), end(), pFieldType); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 443af12..517cb84 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -50,6 +50,9 @@ #include <dcontact.hxx> // OD 2004-05-24 #i28701# #include <sortedobjs.hxx> +#include <txatbase.hxx> +#include <fmtfld.hxx> +#include <fldbas.hxx> // FLT_MAX #include <cfloat> @@ -290,10 +293,24 @@ sal_Bool SwPageFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint, bValidTextDistance = true; } + bool bConsiderBackground = true; + // If the text position is a clickable field, then that should have priority. + if (pTextNd->IsTxtNode()) + { + SwTxtNode* pTxtNd = pTextNd->GetTxtNode(); + SwTxtAttr* pTxtAttr = pTxtNd->GetTxtAttrForCharAt(aTextPos.nContent.GetIndex(), RES_TXTATR_FIELD); + if (pTxtAttr) + { + const SwField* pField = pTxtAttr->GetFld().GetFld(); + if (pField->IsClickable()) + bConsiderBackground = false; + } + } + double nBackDistance = 0; bool bValidBackDistance = false; SwCntntNode* pBackNd = aBackPos.nNode.GetNode( ).GetCntntNode( ); - if ( pBackNd ) + if ( pBackNd && bConsiderBackground) { // FIXME There are still cases were we don't have the proper node here. SwCntntFrm* pBackFrm = pBackNd->getLayoutFrm( getRootFrm( ) ); diff --git a/sw/source/ui/wrtsh/wrtsh2.cxx b/sw/source/ui/wrtsh/wrtsh2.cxx index 86fe158..3dcdffa 100644 --- a/sw/source/ui/wrtsh/wrtsh2.cxx +++ b/sw/source/ui/wrtsh/wrtsh2.cxx @@ -315,6 +315,8 @@ void SwWrtShell::ClickToField( const SwField& rFld ) case RES_DROPDOWN : StartDropDownFldDlg( (SwField*)&rFld, sal_False ); break; + default: + SAL_WARN_IF(rFld.IsClickable(), "sw", "unhandled clickable field!"); } bIsInClickToEdit = sal_False; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
