[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/inc sw/source xmloff/source
sw/inc/grfatr.hxx | 10 +++--- sw/source/core/graphic/grfatr.cxx | 28 +++- xmloff/source/text/XMLTextFrameContext.cxx |8 xmloff/source/text/txtparae.cxx| 11 +++ 4 files changed, 53 insertions(+), 4 deletions(-) New commits: commit 58607318bf39053d2f20d47ae8e3e69e6b3eeb04 Author: Armin Le GrandDate: Thu Feb 15 15:41:50 2018 +0100 tdf#115519: Handle rotation for WriterFlyFrames correctly Adapted due to no transformation is written here, but still controlling the values of persistent data is a good thing. Change-Id: I5f29b3640eaf24d63c64edfecd6732f336582640 Reviewed-on: https://gerrit.libreoffice.org/49826 Tested-by: Jenkins Reviewed-by: Armin Le Grand Reviewed-on: https://gerrit.libreoffice.org/49897 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx index d4aa180dcddc..9d3d52f57985 100644 --- a/sw/inc/grfatr.hxx +++ b/sw/inc/grfatr.hxx @@ -92,14 +92,18 @@ public: class SwRotationGrf : public SfxUInt16Item { +private: Size aUnrotatedSize; + +// tdf#15529 check and evtl. correct value, it is in 10th +// degrees and *has* to be in the range [0 .. 3600[ +sal_Int16 checkAndCorrectValue(sal_Int16 nValue); + public: SwRotationGrf( sal_Int16 nVal = 0 ) : SfxUInt16Item( RES_GRFATR_ROTATION, nVal ) {} -SwRotationGrf( sal_Int16 nVal, const Size& rSz ) -: SfxUInt16Item( RES_GRFATR_ROTATION, nVal ), aUnrotatedSize( rSz ) -{} +SwRotationGrf( sal_Int16 nVal, const Size& rSz ); // pure virtual methods from SfxInt16Item virtual SfxPoolItem* Clone( SfxItemPool *pPool = nullptr ) const override; diff --git a/sw/source/core/graphic/grfatr.cxx b/sw/source/core/graphic/grfatr.cxx index 71cf98283d6b..163a5bcb600f 100644 --- a/sw/source/core/graphic/grfatr.cxx +++ b/sw/source/core/graphic/grfatr.cxx @@ -158,6 +158,31 @@ SfxPoolItem* SwCropGrf::Clone( SfxItemPool* ) const return new SwCropGrf( *this ); } +sal_Int16 SwRotationGrf::checkAndCorrectValue(sal_Int16 nValue) +{ +if(nValue < 0) +{ +// smaller zero, modulo (will keep negative) and add one range +DBG_ASSERT(false, "SwRotationGrf: Value is in 10th degree and *has* to be in [0 .. 3600[ (!)"); +return 3600 + (nValue % 3600); +} +else if (nValue > 3600) +{ +// bigger range, use modulo +DBG_ASSERT(false, "SwRotationGrf: Value is in 10th degree and *has* to be in [0 .. 3600[ (!)"); +return nValue % 3600; +} + +return nValue; +} + +SwRotationGrf::SwRotationGrf( sal_Int16 nVal, const Size& rSz ) +// tdf#15529 check and evtl. correct value +: SfxUInt16Item( RES_GRFATR_ROTATION, checkAndCorrectValue(nVal) ), +aUnrotatedSize( rSz ) +{ +} + SfxPoolItem* SwRotationGrf::Clone( SfxItemPool * ) const { return new SwRotationGrf( GetValue(), aUnrotatedSize ); @@ -185,7 +210,8 @@ bool SwRotationGrf::PutValue( const uno::Any& rVal, sal_uInt8 ) if (rVal >>= nValue) { // sal_uInt16 argument needed -SetValue( (sal_uInt16) nValue ); +// tdf#15529 check and evtl. correct value +SetValue(static_cast(checkAndCorrectValue(nValue))); return true; } diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index e7f81a6e6d27..2e0a50bb3f6b 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -1058,6 +1058,14 @@ XMLTextFrameContext_Impl::XMLTextFrameContext_Impl( { // RotGrfFlyFrame: is in 10th degrees nRotation = (sal_Int16)(nVal % 3600 ); + +// tdf#115519 may be negative, with the above modulo maximal -3599, so +// no loop needed here. nRotation is used in setPropertyValue("GraphicRotation") +// and *has* to be in the range [0 .. 3600[ +if(nRotation < 0) +{ +nRotation += 3600; +} } } } diff --git a/xmloff/source/text/txtparae.cxx b/xmloff/source/text/txtparae.cxx index 41bd0d503898..763058f270b7 100644 --- a/xmloff/source/text/txtparae.cxx +++ b/xmloff/source/text/txtparae.cxx @@ -3092,6 +3092,17 @@ void XMLTextParagraphExport::_exportTextGraphic( rPropSet->getPropertyValue( sGraphicRotation ) >>= nVal; if( nVal != 0 ) { +// tdf#115519 may be bigger 3600 or negative, +// correct to range [0 .. 3600[ +if(nVal > 0) +{ +nVal %= 3600; +} +else if(nVal < 0) +{ +
[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - sw/inc sw/source xmloff/source
sw/inc/cmdid.h |2 + sw/inc/crsrsh.hxx |5 ++ sw/inc/unoprnms.hxx|2 + sw/source/core/crsr/crbm.cxx | 25 sw/source/core/unocore/unobkm.cxx | 74 - sw/source/core/unocore/unomap1.cxx |2 + sw/source/ui/misc/bookmark.cxx |2 - xmloff/source/text/txtparae.cxx| 24 8 files changed, 133 insertions(+), 3 deletions(-) New commits: commit b3226f8133ef28a0cc7328e419e0bf54abd3fda1 Author: Bernhard WidlDate: Fri Dec 22 17:39:15 2017 +0100 tdf#101856 create bookmarks w/ new hidden/condition attrs, and save as odt Change-Id: Ib1df7a4c1477693aa2d0ec067635cdcbd393cebd Reviewed-on: https://gerrit.libreoffice.org/47598 Reviewed-by: Thorsten Behrens Tested-by: Thorsten Behrens diff --git a/sw/inc/cmdid.h b/sw/inc/cmdid.h index 09cd1f48513c..36a93cef8ba7 100644 --- a/sw/inc/cmdid.h +++ b/sw/inc/cmdid.h @@ -814,6 +814,8 @@ #define FN_PARAM_PAM(FN_PARAM2+27) /* Point and Mark */ #define FN_TEXT_BOX (FN_PARAM2+28) /* TextBox Property*/ #define FN_PARAM_IGNORE_PROTECTED (FN_PARAM2+29) /* Ignore protected areas */ +#define FN_BOOKMARK_HIDDEN (FN_PARAM2+30) /* Hidden Property of bookmarks*/ +#define FN_BOOKMARK_CONDITION (FN_PARAM2+31) /* Condition Property of bookmarks*/ // Status: not more than 19! #define FN_STAT_PAGE(FN_STAT + 1) diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 89c90a965cfd..8195259686eb 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -549,6 +549,11 @@ public: const OUString& rName, const OUString& rShortName, IDocumentMarkAccess::MarkType eMark = IDocumentMarkAccess::MarkType::BOOKMARK); +::sw::mark::IMark* SetBookmark( +const vcl::KeyCode&, +const OUString& rName, +bool rHide, +const OUString& rCondition); bool GotoMark( const ::sw::mark::IMark* const pMark );// sets CurrentCursor.SPoint bool GotoMark( const ::sw::mark::IMark* const pMark, bool bAtStart ); bool GoNextBookmark(); // true, if there was one diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 63589f273ce5..c700ee3bb468 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -331,6 +331,8 @@ #define UNO_NAME_IS_GLOBAL_DOCUMENT_SECTION "IsGlobalDocumentSection" #define UNO_NAME_TEXT_FIELD "TextField" #define UNO_NAME_BOOKMARK "Bookmark" +#define UNO_NAME_BOOKMARK_HIDDEN "BookmarkHidden" +#define UNO_NAME_BOOKMARK_CONDITION "BookmarkCondition" #define UNO_NAME_TEXT_TABLE "TextTable" #define UNO_NAME_CELL "Cell" #define UNO_NAME_TEXT_FRAME "TextFrame" diff --git a/sw/source/core/crsr/crbm.cxx b/sw/source/core/crsr/crbm.cxx index 946af35c5cae..eff58b1f8ad6 100644 --- a/sw/source/core/crsr/crbm.cxx +++ b/sw/source/core/crsr/crbm.cxx @@ -99,6 +99,31 @@ namespace } // set CurrentCursor.SPoint +// at CurrentCursor.SPoint +::sw::mark::IMark* SwCursorShell::SetBookmark( +const vcl::KeyCode& rCode, +const OUString& rName, +bool rHide, +const OUString& rCondition) +{ +StartAction(); +::sw::mark::IMark* pMark = getIDocumentMarkAccess()->makeMark( +*GetCursor(), +rName, +IDocumentMarkAccess::MarkType::BOOKMARK, sw::mark::InsertMode::New); +::sw::mark::IBookmark* pBookmark = dynamic_cast< ::sw::mark::IBookmark* >(pMark); +if (pBookmark) +{ +pBookmark->SetKeyCode(rCode); +pBookmark->SetShortName(OUString()); +pBookmark->Hide(rHide); +pBookmark->SetHideCondition(rCondition); +} +EndAction(); +return pMark; +} +// set CurrentCursor.SPoint + bool SwCursorShell::GotoMark(const ::sw::mark::IMark* const pMark, bool bAtStart) { // watch Cursor-Moves diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index feca7d3cdee8..bfd4bedc3975 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -52,13 +52,16 @@ public: ::comphelper::OInterfaceContainerHelper2 m_EventListeners; SwDoc * m_pDoc; ::sw::mark::IMark * m_pRegisteredBookmark; -OUString m_sMarkName; +OUStringm_sMarkName; +boolm_bHidden; +OUStringm_HideCondition; Impl( SwDoc *const pDoc, ::sw::mark::IMark *const /*pBookmark*/) : SwClient() , m_EventListeners(m_Mutex) , m_pDoc(pDoc) , m_pRegisteredBookmark(nullptr) +, m_bHidden(false) { // DO NOT registerInMark here! (because SetXBookmark would delete rThis) } @@ -106,6 +109,14 @@ void SwXBookmark::Impl::registerInMark(SwXBookmark & rThis, else if (m_pRegisteredBookmark) { m_sMarkName =