chart2/source/controller/main/DragMethod_RotateDiagram.cxx | 3 desktop/source/app/app.cxx | 59 --- drawinglayer/Library_drawinglayer.mk | 1 drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx | 112 +++++++ drawinglayer/source/processor2d/processor2dtools.cxx | 63 ++++ drawinglayer/source/tools/converters.cxx | 80 ++--- filter/source/msfilter/util.cxx | 44 -- include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx | 3 include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx | 65 ++++ include/drawinglayer/processor2d/linegeometryextractor2d.hxx | 2 include/drawinglayer/processor2d/processor2dtools.hxx | 79 +++++ include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx | 2 include/drawinglayer/processor2d/vclpixelprocessor2d.hxx | 2 include/drawinglayer/processor2d/vclprocessor2d.hxx | 2 include/drawinglayer/processor3d/defaultprocessor3d.hxx | 2 include/drawinglayer/processor3d/zbufferprocessor3d.hxx | 2 include/filter/msfilter/util.hxx | 1 include/svtools/optionsdrawinglayer.hxx | 5 include/svx/sdr/overlay/overlayanimatedbitmapex.hxx | 9 include/svx/sdr/overlay/overlayobject.hxx | 3 include/svx/sdr/overlay/overlaypolypolygon.hxx | 13 include/svx/sdr/overlay/overlayrectangle.hxx | 87 +++++ include/svx/sdr/overlay/overlaytools.hxx | 21 - include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx | 2 include/svx/svdview.hxx | 6 include/tools/datetimeutils.hxx | 20 + include/unotools/localfilehelper.hxx | 3 sc/source/ui/view/gridwin.cxx | 20 - sd/source/ui/view/sdview2.cxx | 8 sd/source/ui/view/sdview3.cxx | 97 ++++-- svtools/source/config/optionsdrawinglayer.cxx | 21 + svx/Library_svxcore.mk | 2 svx/source/engine3d/dragmt3d.cxx | 3 svx/source/engine3d/view3d.cxx | 3 svx/source/sdr/contact/objectcontactofobjlistpainter.cxx | 9 svx/source/sdr/contact/objectcontactofpageview.cxx | 7 svx/source/sdr/overlay/overlayanimatedbitmapex.cxx | 15 - svx/source/sdr/overlay/overlayhatchrect.cxx | 71 ---- svx/source/sdr/overlay/overlaymanager.cxx | 20 - svx/source/sdr/overlay/overlayobject.cxx | 14 svx/source/sdr/overlay/overlaypolypolygon.cxx | 33 +- svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx | 2 svx/source/sdr/overlay/overlayrectangle.cxx | 150 ++++++++++ svx/source/sdr/overlay/overlayrollingrectangle.cxx | 26 + svx/source/sdr/overlay/overlaytools.cxx | 119 +++++-- svx/source/svdraw/svdcrtv.cxx | 9 svx/source/svdraw/svddrgmt.cxx | 23 + svx/source/svdraw/svdedxv.cxx | 79 ++--- svx/source/svdraw/svdhdl.cxx | 21 - svx/source/svdraw/svdmrkv.cxx | 46 +-- svx/source/svdraw/svdobj.cxx | 54 ++- svx/source/svdraw/svdview.cxx | 31 +- svx/source/table/svdotable.cxx | 2 svx/source/table/tablehandles.cxx | 31 +- svx/source/table/tablehandles.hxx | 8 sw/inc/doc.hxx | 13 sw/inc/frmfmt.hxx | 27 + sw/inc/index.hxx | 14 sw/inc/iodetect.hxx | 5 sw/qa/extras/inc/swmodeltestbase.hxx | 4 sw/qa/extras/odfimport/data/uno-cycle.odt |binary sw/qa/extras/odfimport/odfimport.cxx | 16 + sw/source/core/attr/swatrset.cxx | 27 + sw/source/core/bastyp/index.cxx | 9 sw/source/core/crsr/bookmrk.cxx | 15 + sw/source/core/crsr/viscrs.cxx | 21 - sw/source/core/doc/docbm.cxx | 44 ++ sw/source/core/doc/doclay.cxx | 56 ++- sw/source/core/doc/docnew.cxx | 37 +- sw/source/core/doc/docnum.cxx | 10 sw/source/core/doc/doctxm.cxx | 10 sw/source/core/doc/notxtfrm.cxx | 6 sw/source/core/docnode/ndcopy.cxx | 18 - sw/source/core/docnode/ndsect.cxx | 14 sw/source/core/docnode/ndtbl.cxx | 9 sw/source/core/frmedt/fecopy.cxx | 38 ++ sw/source/core/frmedt/fefly1.cxx | 18 - sw/source/core/frmedt/feshview.cxx | 16 - sw/source/core/inc/MarkManager.hxx | 2 sw/source/core/inc/UndoBookmark.hxx | 25 + sw/source/core/inc/bookmrk.hxx | 4 sw/source/core/inc/flyfrm.hxx | 2 sw/source/core/layout/atrfrm.cxx | 83 +++++ sw/source/core/layout/flycnt.cxx | 15 - sw/source/core/layout/frmtool.cxx | 39 ++ sw/source/core/layout/tabfrm.cxx | 4 sw/source/core/txtnode/atrflyin.cxx | 9 sw/source/core/txtnode/ndtxt.cxx | 20 - sw/source/core/undo/unbkmk.cxx | 62 ++++ sw/source/core/undo/undobj.cxx | 10 sw/source/core/undo/undobj1.cxx | 2 sw/source/core/unocore/unobkm.cxx | 29 - sw/source/core/unocore/unoportenum.cxx | 144 ++++++--- sw/source/filter/basflt/iodetect.cxx | 30 -- sw/source/filter/ww8/docxattributeoutput.cxx | 5 sw/source/ui/dbui/dbmgr.cxx | 46 ++- sw/source/ui/dbui/mmoutputpage.cxx | 57 +++ sw/source/ui/dbui/mmoutputpage.hxx | 4 sw/source/ui/dochdl/swdtflvr.cxx | 93 +++++- sw/source/ui/inc/mmconfigitem.hxx | 4 sw/source/ui/inc/swdtflvr.hxx | 4 sw/source/ui/uno/swdet2.cxx | 3 sysui/desktop/menus/base.desktop | 12 sysui/desktop/menus/calc.desktop | 12 sysui/desktop/menus/draw.desktop | 12 sysui/desktop/menus/impress.desktop | 12 sysui/desktop/menus/math.desktop | 14 sysui/desktop/menus/qstart.desktop | 2 sysui/desktop/menus/startcenter.desktop | 33 ++ sysui/desktop/menus/writer.desktop | 12 sysui/desktop/menus/xsltfilter.desktop | 2 tools/Library_tl.mk | 1 tools/source/datetime/datetimeutils.cxx | 56 +++ unotools/source/ucbhelper/localfilehelper.cxx | 51 +++ writerfilter/source/rtftok/rtfdocumentimpl.cxx | 3 115 files changed, 2104 insertions(+), 856 deletions(-)
New commits: commit 1db2b31b06199bffc65251b3f2209c4572cb9394 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Wed Dec 10 12:06:49 2014 +0100 sw: Unit test for cycle in lcl_CreatePortions Reviewed on: https://gerrit.libreoffice.org/13413 Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx (cherry picked from commit 4a3328a98f00818044694a9b6a0f7cda392273c6) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx Change-Id: I26a8707046d7f30381fb51c41e49f8dee4796ba7 diff --git a/sw/qa/extras/odfimport/data/uno-cycle.odt b/sw/qa/extras/odfimport/data/uno-cycle.odt new file mode 100644 index 0000000..51e798f Binary files /dev/null and b/sw/qa/extras/odfimport/data/uno-cycle.odt differ diff --git a/sw/qa/extras/odfimport/odfimport.cxx b/sw/qa/extras/odfimport/odfimport.cxx index 92139c1..ac6b4a2 100644 --- a/sw/qa/extras/odfimport/odfimport.cxx +++ b/sw/qa/extras/odfimport/odfimport.cxx @@ -27,6 +27,7 @@ public: void testFdo60842(); void testFdo56272(); void testFdo55814(); + void testCreatePortions(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -50,6 +51,7 @@ void Test::run() {"fdo60842.odt", &Test::testFdo60842}, {"fdo56272.odt", &Test::testFdo56272}, {"fdo55814.odt", &Test::testFdo55814}, + {"uno-cycle.odt", &Test::testCreatePortions}, }; header(); for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) @@ -322,6 +324,20 @@ void Test::testFdo55814() CPPUNIT_ASSERT_EQUAL(OUString("Hide==\"Yes\""), getProperty<OUString>(xSections->getByIndex(0), "Condition")); } +void Test::testCreatePortions() +{ + uno::Reference<text::XBookmarksSupplier> xBookmarksSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextContent> xText(xBookmarksSupplier->getBookmarks()->getByName("Mark"), uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> xTextCursor(xText->getAnchor(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xTextCursor.is()); + + uno::Reference<container::XEnumerationAccess> xParagraph( + xTextCursor->createEnumeration()->nextElement(), uno::UNO_QUERY); + CPPUNIT_ASSERT(xParagraph.is()); + // This looped forever in lcl_CreatePortions + xParagraph->createEnumeration(); +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_PLUGIN_IMPLEMENT(); commit a3f8e909e088640232012dfb36e0eb47b429f09e Author: Miklos Vajna <vmik...@collabora.co.uk> Date: Wed Dec 10 16:08:05 2014 +0100 sw UNO API: fix infinite loop when building portions of a bookmark range The problem was that in case the bookmark range points to a number of characters in a text node, where neither the start or the end is the paragraph start and end, and in case there is an at-char anchored object at the beginning of the paragraph, then lcl_CreatePortions() never ended. It is assumed that the loop in lcl_CreatePortions() will end at some stage, as every iteration moves the cursor forward. But this wasn't true in the above situation: the first frame was anchored at char pos 0, the range was char positions 1..7, and we failed to ignore frames which are anchored before start: so position was constantly 1. Fix the problem by explicitly ignoring frames before the current position, so lcl_ExportFrames() properly returns -1 when there are no anchored objects in the current range. Testcase is in the next commit. Change-Id: I73662e09cd09ee7e0ea4575b1150beb40f1ccc3a (cherry picked from commit 6d65e30fbaba383cbb9e1db6230a04865897ac8f) diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index eb1ee0a..8f18419 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -1033,6 +1033,11 @@ lcl_ExportFrames( FrameDependSortList_t & i_rFrames, xub_StrLen const i_nCurrentIndex) { + // Ignore frames which are not exported, as we are exporting a selection + // and they are anchored before the start of the selection. + while (i_rFrames.size() && i_rFrames.front().nIndex < i_nCurrentIndex) + i_rFrames.pop_front(); + // find first Frame in (sorted) i_rFrames at current position while (i_rFrames.size() && (i_rFrames.front().nIndex == i_nCurrentIndex)) // do not check for i_nEnd here; this is done implicity by lcl_MoveCursor commit c1092635feacdaebb88b673c4b2e58a21d3ec937 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Thu Dec 11 15:24:40 2014 +0100 Add undo operation for deleting a bookmark, related fdo#51741 (cherry picked from commit 9338bea6e8dfab8d360fe8ab19dd5d75071bfc2a) Conflicts: sw/qa/extras/uiwriter/uiwriter.cxx sw/source/core/crsr/bookmrk.cxx sw/source/core/doc/docbm.cxx Change-Id: I79d8d3c30b6b0b2cc253963fdd50019aec033e12 diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 00f88c8..07c649e 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -269,7 +269,11 @@ namespace sw { namespace mark { DdeBookmark::DeregisterFromDoc(io_pDoc); - // fdo#51741 Bookmark should mark document as modified when deleted + if (io_pDoc->GetIDocumentUndoRedo().DoesUndo()) + { + io_pDoc->GetIDocumentUndoRedo().AppendUndo( + new SwUndoDeleteBookmark(*this)); + } io_pDoc->SetModified(); } diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 457d82f..5f1ed7b 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -25,6 +25,7 @@ #include <dcontact.hxx> #include <doc.hxx> #include <IDocumentState.hxx> +#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <xmloff/odffields.hxx> #include <editsh.hxx> @@ -45,6 +46,7 @@ #include <sfx2/linkmgr.hxx> #include <swserv.hxx> #include <swundo.hxx> +#include <UndoBookmark.hxx> #include <unocrsr.hxx> #include <viscrs.hxx> #include <stdio.h> @@ -466,12 +468,18 @@ namespace sw { namespace mark return false; if (::sw::mark::MarkBase* pMarkBase = dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)) { - m_aMarkNamesSet.erase(pMarkBase->GetName()); + const OUString sOldName(pMarkBase->GetName()); + m_aMarkNamesSet.erase(sOldName); m_aMarkNamesSet.insert(rNewName); pMarkBase->SetName(rNewName); - // fdo#51741 Bookmark should mark document as modified when renamed - if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark)) { + if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark)) + { + if (m_pDoc->GetIDocumentUndoRedo().DoesUndo()) + { + m_pDoc->GetIDocumentUndoRedo().AppendUndo( + new SwUndoRenameBookmark(sOldName, rNewName)); + } m_pDoc->SetModified(); } } diff --git a/sw/source/core/inc/UndoBookmark.hxx b/sw/source/core/inc/UndoBookmark.hxx index 7f15733..4907d58 100644 --- a/sw/source/core/inc/UndoBookmark.hxx +++ b/sw/source/core/inc/UndoBookmark.hxx @@ -68,13 +68,22 @@ public: virtual void RedoImpl( ::sw::UndoRedoContext & ); }; +class SwUndoDeleteBookmark : public SwUndoBookmark +{ +public: + SwUndoDeleteBookmark( const ::sw::mark::IMark& ); + + virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE; + virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE; +}; + class SwUndoRenameBookmark : public SwUndo { const OUString m_sOldName; const OUString m_sNewName; public: - SwUndoRenameBookmark( const ::sw::mark::IMark&, const OUString& rNewName ); + SwUndoRenameBookmark( const OUString& rOldName, const OUString& rNewName ); virtual ~SwUndoRenameBookmark(); private: diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx index 6080cdc..c7f38e2 100644 --- a/sw/source/core/undo/unbkmk.cxx +++ b/sw/source/core/undo/unbkmk.cxx @@ -93,10 +93,25 @@ void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext) SetInDoc( &rContext.GetDoc() ); } -SwUndoRenameBookmark::SwUndoRenameBookmark( const ::sw::mark::IMark& rBkmk, const OUString& rOldName ) +SwUndoDeleteBookmark::SwUndoDeleteBookmark( const ::sw::mark::IMark& rBkmk ) + : SwUndoBookmark( UNDO_DELBOOKMARK, rBkmk ) +{ +} + +void SwUndoDeleteBookmark::UndoImpl(::sw::UndoRedoContext & rContext) +{ + SetInDoc( &rContext.GetDoc() ); +} + +void SwUndoDeleteBookmark::RedoImpl(::sw::UndoRedoContext & rContext) +{ + ResetInDoc( &rContext.GetDoc() ); +} + +SwUndoRenameBookmark::SwUndoRenameBookmark( const OUString& rOldName, const OUString& rNewName ) : SwUndo( UNDO_BOOKMARK_RENAME ) , m_sOldName( rOldName ) - , m_sNewName( rBkmk.GetName() ) + , m_sNewName( rNewName ) { } diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index bf9514a..e512c52 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -24,7 +24,6 @@ #include <vcl/svapp.hxx> #include <TextCursorHelper.hxx> -#include <UndoBookmark.hxx> #include <unotextrange.hxx> #include <unomap.hxx> #include <unoprnms.hxx> @@ -32,7 +31,6 @@ #include <crossrefbookmark.hxx> #include <doc.hxx> #include <IDocumentState.hxx> -#include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <swundo.hxx> #include <docsh.hxx> @@ -346,15 +344,7 @@ throw (uno::RuntimeException) *aPam.GetMark() = m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos(); } - const OUString sOldName(m_pImpl->m_pRegisteredBookmark->GetName()); - if (pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName)) - { - if (m_pImpl->m_pDoc->GetIDocumentUndoRedo().DoesUndo()) - { - m_pImpl->m_pDoc->GetIDocumentUndoRedo().AppendUndo( - new SwUndoRenameBookmark(*m_pImpl->m_pRegisteredBookmark, sOldName)); - } - } + pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName); } OUString SAL_CALL commit 0570459630e97fb92cca1681f3e8e92b94925951 Author: Renato Ferreira <renato.w...@gmail.com> Date: Sat Nov 15 00:22:57 2014 -0500 fdo#51741 Mark document as modified on bookmark rename / delete Deletion: overrided DdeBookmark::DeregisterFromDoc in Bookmark Renaming: in MarkManager::renameMark Reviewed-on: https://gerrit.libreoffice.org/12436 Reviewed-by: Michael Stahl <mst...@redhat.com> Tested-by: Michael Stahl <mst...@redhat.com> (cherry picked from commit f0c4cd51cb160492d78c2796f71ecd88da25fa59) Conflicts: sw/source/core/doc/docbm.cxx sw/source/core/inc/bookmrk.hxx sw/source/core/unocore/unobkm.cxx Change-Id: I378037ea546d0f2dc4ab9e0b0e6f9bf65c8db5b4 diff --git a/sw/source/core/crsr/bookmrk.cxx b/sw/source/core/crsr/bookmrk.cxx index 81256fd..00f88c8 100644 --- a/sw/source/core/crsr/bookmrk.cxx +++ b/sw/source/core/crsr/bookmrk.cxx @@ -265,6 +265,14 @@ namespace sw { namespace mark io_pDoc->SetModified(); } + void Bookmark::DeregisterFromDoc(SwDoc* const io_pDoc) + { + DdeBookmark::DeregisterFromDoc(io_pDoc); + + // fdo#51741 Bookmark should mark document as modified when deleted + io_pDoc->SetModified(); + } + ::sfx2::IXmlIdRegistry& Bookmark::GetRegistry() { SwDoc *const pDoc( GetMarkPos().GetDoc() ); diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index 5a52a3e..457d82f 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -24,6 +24,7 @@ #include <crossrefbookmark.hxx> #include <dcontact.hxx> #include <doc.hxx> +#include <IDocumentState.hxx> #include <docary.hxx> #include <xmloff/odffields.hxx> #include <editsh.hxx> @@ -463,9 +464,17 @@ namespace sw { namespace mark return true; if(hasMark(rNewName)) return false; - m_aMarkNamesSet.erase(dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->GetName()); - m_aMarkNamesSet.insert(rNewName); - dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)->SetName(rNewName); + if (::sw::mark::MarkBase* pMarkBase = dynamic_cast< ::sw::mark::MarkBase* >(io_pMark)) + { + m_aMarkNamesSet.erase(pMarkBase->GetName()); + m_aMarkNamesSet.insert(rNewName); + pMarkBase->SetName(rNewName); + + // fdo#51741 Bookmark should mark document as modified when renamed + if (dynamic_cast< ::sw::mark::Bookmark* >(io_pMark)) { + m_pDoc->SetModified(); + } + } return true; } diff --git a/sw/source/core/inc/bookmrk.hxx b/sw/source/core/inc/bookmrk.hxx index 37f32ee..e6dd653 100644 --- a/sw/source/core/inc/bookmrk.hxx +++ b/sw/source/core/inc/bookmrk.hxx @@ -149,7 +149,7 @@ namespace sw { void SetRefObject( SwServerObject* pObj ); - void DeregisterFromDoc(SwDoc* const pDoc); + virtual void DeregisterFromDoc(SwDoc* const pDoc); virtual ~DdeBookmark(); private: @@ -168,6 +168,8 @@ namespace sw { const OUString& rShortName); virtual void InitDoc(SwDoc* const io_Doc); + virtual void DeregisterFromDoc(SwDoc* const io_pDoc); + virtual const OUString& GetShortName() const { return m_sShortName; } virtual const KeyCode& GetKeyCode() const diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index d4ce015..bf9514a 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -354,7 +354,6 @@ throw (uno::RuntimeException) m_pImpl->m_pDoc->GetIDocumentUndoRedo().AppendUndo( new SwUndoRenameBookmark(*m_pImpl->m_pRegisteredBookmark, sOldName)); } - m_pImpl->m_pDoc->SetModified(); } } commit 22727fb5c8a5b7a055882550e20cee7a0b1507f9 Author: Matúš Kukan <matus.ku...@collabora.com> Date: Wed Nov 26 11:58:13 2014 +0100 Writer: Set document as modified and add undo when renaming bookmarks (cherry picked from commit c7fa6687e544e7f9702da23aadbd31c1f2e0115e) Change-Id: Id0d4695b6a7c5eae0493e679345bd41d4687d6d7 diff --git a/sw/source/core/inc/UndoBookmark.hxx b/sw/source/core/inc/UndoBookmark.hxx index a9650f5..7f15733 100644 --- a/sw/source/core/inc/UndoBookmark.hxx +++ b/sw/source/core/inc/UndoBookmark.hxx @@ -68,6 +68,22 @@ public: virtual void RedoImpl( ::sw::UndoRedoContext & ); }; +class SwUndoRenameBookmark : public SwUndo +{ + const OUString m_sOldName; + const OUString m_sNewName; + +public: + SwUndoRenameBookmark( const ::sw::mark::IMark&, const OUString& rNewName ); + virtual ~SwUndoRenameBookmark(); + +private: + virtual SwRewriter GetRewriter() const SAL_OVERRIDE; + void Rename( ::sw::UndoRedoContext &, const OUString& sFrom, const OUString& sTo ); + virtual void UndoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE; + virtual void RedoImpl( ::sw::UndoRedoContext & ) SAL_OVERRIDE; +}; + #endif // SW_UNDO_BOOKMARK_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/undo/unbkmk.cxx b/sw/source/core/undo/unbkmk.cxx index 0162ceb..6080cdc 100644 --- a/sw/source/core/undo/unbkmk.cxx +++ b/sw/source/core/undo/unbkmk.cxx @@ -20,6 +20,7 @@ #include <UndoBookmark.hxx> +#include <comcore.hrc> #include "doc.hxx" #include "docary.hxx" #include "swundo.hxx" // fuer die UndoIds @@ -92,5 +93,51 @@ void SwUndoInsBookmark::RedoImpl(::sw::UndoRedoContext & rContext) SetInDoc( &rContext.GetDoc() ); } +SwUndoRenameBookmark::SwUndoRenameBookmark( const ::sw::mark::IMark& rBkmk, const OUString& rOldName ) + : SwUndo( UNDO_BOOKMARK_RENAME ) + , m_sOldName( rOldName ) + , m_sNewName( rBkmk.GetName() ) +{ +} + +SwUndoRenameBookmark::~SwUndoRenameBookmark() +{ +} + +static OUString lcl_QuoteName(const OUString& rName) +{ + static const OUString sStart = SW_RES(STR_START_QUOTE); + static const OUString sEnd = SW_RES(STR_END_QUOTE); + return sStart + rName + sEnd; +} + +SwRewriter SwUndoRenameBookmark::GetRewriter() const +{ + SwRewriter aRewriter; + aRewriter.AddRule(UndoArg1, lcl_QuoteName(m_sOldName)); + aRewriter.AddRule(UndoArg2, SW_RES(STR_YIELDS)); + aRewriter.AddRule(UndoArg3, lcl_QuoteName(m_sNewName)); + return aRewriter; +} + +void SwUndoRenameBookmark::Rename(::sw::UndoRedoContext & rContext, const OUString& sFrom, const OUString& sTo) +{ + IDocumentMarkAccess* const pMarkAccess = rContext.GetDoc().getIDocumentMarkAccess(); + IDocumentMarkAccess::const_iterator_t ppBkmk = pMarkAccess->findMark(sFrom); + if (ppBkmk != pMarkAccess->getMarksEnd()) + { + pMarkAccess->renameMark( ppBkmk->get(), sTo ); + } +} + +void SwUndoRenameBookmark::UndoImpl(::sw::UndoRedoContext & rContext) +{ + Rename(rContext, m_sNewName, m_sOldName); +} + +void SwUndoRenameBookmark::RedoImpl(::sw::UndoRedoContext & rContext) +{ + Rename(rContext, m_sOldName, m_sNewName); +} /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/unocore/unobkm.cxx b/sw/source/core/unocore/unobkm.cxx index 856c2f8..d4ce015 100644 --- a/sw/source/core/unocore/unobkm.cxx +++ b/sw/source/core/unocore/unobkm.cxx @@ -24,17 +24,17 @@ #include <vcl/svapp.hxx> #include <TextCursorHelper.hxx> +#include <UndoBookmark.hxx> #include <unotextrange.hxx> #include <unomap.hxx> #include <unoprnms.hxx> #include <IMark.hxx> #include <crossrefbookmark.hxx> #include <doc.hxx> +#include <IDocumentState.hxx> #include <IDocumentUndoRedo.hxx> #include <docary.hxx> #include <swundo.hxx> -#include <comcore.hrc> -#include <SwRewriter.hxx> #include <docsh.hxx> #include <xmloff/odffields.hxx> #include <comphelper/servicehelper.hxx> @@ -42,22 +42,6 @@ using namespace ::sw::mark; using namespace ::com::sun::star; - -namespace -{ - static OUString lcl_QuoteName(const OUString& rName) - { - static const OUString sStart = OUString(String(SW_RES(STR_START_QUOTE))); - static const OUString sEnd = OUString(String(SW_RES(STR_END_QUOTE))); - OUStringBuffer sBuf(64); - return sBuf.append(sStart).append(rName).append(sEnd).makeStringAndClear(); - } -} - -/****************************************************************** - * SwXBookmark - ******************************************************************/ - class SwXBookmark::Impl : public SwClient { @@ -362,16 +346,16 @@ throw (uno::RuntimeException) *aPam.GetMark() = m_pImpl->m_pRegisteredBookmark->GetOtherMarkPos(); } - SwRewriter aRewriter; - aRewriter.AddRule(UndoArg1, lcl_QuoteName(getName())); - aRewriter.AddRule(UndoArg2, SW_RES(STR_YIELDS)); - aRewriter.AddRule(UndoArg3, lcl_QuoteName(rName)); - - m_pImpl->m_pDoc->GetIDocumentUndoRedo().StartUndo( - UNDO_BOOKMARK_RENAME, &aRewriter); - pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName); - m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo( - UNDO_BOOKMARK_RENAME, &aRewriter); + const OUString sOldName(m_pImpl->m_pRegisteredBookmark->GetName()); + if (pMarkAccess->renameMark(m_pImpl->m_pRegisteredBookmark, rName)) + { + if (m_pImpl->m_pDoc->GetIDocumentUndoRedo().DoesUndo()) + { + m_pImpl->m_pDoc->GetIDocumentUndoRedo().AppendUndo( + new SwUndoRenameBookmark(*m_pImpl->m_pRegisteredBookmark, sOldName)); + } + m_pImpl->m_pDoc->SetModified(); + } } OUString SAL_CALL commit 1adf8c67068c2470e5affdf94757781ba79a6277 Author: LuboÅ¡ LuÅák <l.lu...@collabora.com> Date: Mon Dec 1 12:58:47 2014 +0100 do not save UNO marks in undo history These are usually very short-lived marks that are used for various internal purposes or by UNO interfaces, so restoring them from undo history does not make any sense. It can in fact lead to a crash on undo if the mark has been already deleted (which is usually the case with UNO marks) but the restoring still refers to it (this is not a problem with other mark types since those should be deleted only when they are no longer in the document, in which case they are saved in undo history by content positions rather than mark references). (cherry picked from commit 1ecf9ed3fc33c984890848eacbecad5e009eb33d) Conflicts: sw/source/core/undo/undobj.cxx Change-Id: Id707dc3d2b888b5c96a974d04a0ef17b22fc024c diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 30a8677..0442c54 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -772,10 +772,12 @@ void SwUndoSaveCntnt::DelCntntIndex( const SwPosition& rMark, } if( bSavePos || bSaveOtherPos ) { - if( !pHistory ) - pHistory = new SwHistory; - - pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos ); + if( IDocumentMarkAccess::GetType(*pBkmk) != IDocumentMarkAccess::UNO_BOOKMARK ) + { + if( !pHistory ) + pHistory = new SwHistory; + pHistory->Add( *pBkmk, bSavePos, bSaveOtherPos ); + } if(bSavePos && (bSaveOtherPos || !pBkmk->IsExpanded())) { commit ce994cf9815e4e8e021332b5e3eb6a4e13d7a276 Author: Armin Le Grand <a...@apache.org> Date: Wed Jan 30 12:10:59 2013 +0000 Related: #i121532# unified processor2d usages from other modules (cherry picked from commit f371f92c89d296207ef9a219518ba8caa481bcfe) Conflicts: drawinglayer/Library_drawinglayer.mk drawinglayer/Package_inc.mk drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx drawinglayer/source/processor2d/processor2dtools.cxx svx/Package_inc.mk svx/source/sdr/contact/objectcontactofobjlistpainter.cxx svx/source/sdr/contact/objectcontactofpageview.cxx svx/source/sdr/overlay/overlaymanager.cxx svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx svx/source/svdraw/svdedxv.cxx sw/source/core/doc/notxtfrm.cxx Related: #i121532# missing defaultprocessor3d.hxx breaks build Revision 1440387 changed defaultprocessor3d.hxx to be no longer "delivered". It is needed in svx by being included indirectly via cutfindprocessor3d.hxx. Fixing the build breaker by "delivering" the missing header file again. (cherry picked from commit 3bd3ea81c8d54109950b435225c3aac011d56c3d) Conflicts: drawinglayer/Package_inc.mk Related: #i121532# removed include to no longer existing file (cherry picked from commit a4c602d9b5b17e220dbaa4dec2cef91d39945154) Conflicts: sw/source/core/doc/notxtfrm.cxx (cherry picked from commit d1310b7628a68fe13284818ba4a5d38eaef742c4) Conflicts: drawinglayer/Library_drawinglayer.mk Change-Id: Iea4a79133f4375cb0625b187eeb3d727b50ff0fe f0dcea79cfff4cf20a1ca1af3d0a34f86eb2e24e 7dc2f99684fa285225dfdcfc7add553695b8412e diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 96e61de..d3300f8 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -134,6 +134,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/primitive3d/transformprimitive3d \ drawinglayer/source/processor2d/baseprocessor2d \ drawinglayer/source/processor2d/canvasprocessor \ + drawinglayer/source/processor2d/processor2dtools \ drawinglayer/source/processor2d/contourextractor2d \ drawinglayer/source/processor2d/getdigitlanguage \ drawinglayer/source/processor2d/helperwrongspellrenderer \ diff --git a/drawinglayer/source/processor2d/processor2dtools.cxx b/drawinglayer/source/processor2d/processor2dtools.cxx new file mode 100644 index 0000000..041b311 --- /dev/null +++ b/drawinglayer/source/processor2d/processor2dtools.cxx @@ -0,0 +1,63 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#include <drawinglayer/processor2d/processor2dtools.hxx> +#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> +#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + BaseProcessor2D* createPixelProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) + { + // create Pixel Vcl-Processor + return new VclPixelProcessor2D(rViewInformation2D, rTargetOutDev); + } + + BaseProcessor2D* createProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) + { + const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile(); + const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); + + if(bOutputToRecordingMetaFile) + { + // create MetaFile Vcl-Processor and process + return new VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev); + } + else + { + // create Pixel Vcl-Processor + return createPixelProcessor2DFromOutputDevice( + rTargetOutDev, + rViewInformation2D); + } + } + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index dc53f27..7ae4547 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -19,10 +19,10 @@ #include <drawinglayer/tools/converters.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> -#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> #include <vcl/virdev.hxx> #ifdef DBG_UTIL @@ -35,7 +35,7 @@ namespace drawinglayer { namespace tools { - BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx( + BitmapEx convertToBitmapEx( const drawinglayer::primitive2d::Primitive2DSequence& rSeq, const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 nDiscreteWidth, @@ -80,42 +80,48 @@ namespace drawinglayer maContent.SetBackground(Wallpaper(Color(COL_WHITE))); maContent.Erase(); - // create processor - processor2d::VclPixelProcessor2D aContentProcessor(aViewInformation2D, maContent); + // create pixel processor + processor2d::BaseProcessor2D* pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice( + maContent, + aViewInformation2D); - // render content - aContentProcessor.process(aSequence); - - // get content - maContent.EnableMapMode(false); - const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); - - // prepare for mask creation - maContent.SetMapMode(aMapModePixel); - maContent.SetAntialiasing(true); - - // set alpha to all white (fully transparent) - maContent.Erase(); - - // embed primitives to paint them black - const primitive2d::Primitive2DReference xRef( - new primitive2d::ModifiedColorPrimitive2D( - aSequence, - basegfx::BColorModifier( - basegfx::BColor(0.0, 0.0, 0.0), - 0.5, - basegfx::BCOLORMODIFYMODE_REPLACE))); - const primitive2d::Primitive2DSequence xSeq(&xRef, 1); - - // render - aContentProcessor.process(xSeq); - - // get alpha cahannel from vdev - maContent.EnableMapMode(false); - const AlphaMask aAlphaMask(maContent.GetBitmap(aEmptyPoint, aSizePixel)); - - // create BitmapEx result - aRetval = BitmapEx(aContent, aAlphaMask); + if(pContentProcessor) + { + // render content + pContentProcessor->process(aSequence); + + // get content + maContent.EnableMapMode(false); + const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + + // prepare for mask creation + maContent.SetMapMode(aMapModePixel); + maContent.SetAntialiasing(true); + + // set alpha to all white (fully transparent) + maContent.Erase(); + + // embed primitives to paint them black + const primitive2d::Primitive2DReference xRef( + new primitive2d::ModifiedColorPrimitive2D( + aSequence, + basegfx::BColorModifier( + basegfx::BColor(0.0, 0.0, 0.0), + 0.5, + basegfx::BCOLORMODIFYMODE_REPLACE))); + const primitive2d::Primitive2DSequence xSeq(&xRef, 1); + + // render + pContentProcessor->process(xSeq); + delete pContentProcessor; + + // get alpha cahannel from vdev + maContent.EnableMapMode(false); + const AlphaMask aAlphaMask(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + + // create BitmapEx result + aRetval = BitmapEx(aContent, aAlphaMask); + } } #ifdef DBG_UTIL diff --git a/include/drawinglayer/processor2d/processor2dtools.hxx b/include/drawinglayer/processor2d/processor2dtools.hxx new file mode 100644 index 0000000..31cb666 --- /dev/null +++ b/include/drawinglayer/processor2d/processor2dtools.hxx @@ -0,0 +1,79 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSOR2DTOOLS_HXX +#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSOR2DTOOLS_HXX + +#include <drawinglayer/drawinglayerdllapi.h> +#include <drawinglayer/processor2d/baseprocessor2d.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> + +////////////////////////////////////////////////////////////////////////////// +// predefines + +class OutputDevice; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + /** create the best available pixel based BaseProcessor2D + (which may be system-dependent) + + @param rTargetOutDev + The target OutputDevice + + @param rViewInformation2D + The ViewInformation to use + + @return + the created BaseProcessor2D (ownership change) or null if + something went wrong + */ + DRAWINGLAYER_DLLPUBLIC BaseProcessor2D* createPixelProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D); + + /** create a BaseProcessor2D dependent on some states of the + given OutputDevice. If metafile is recorded, the needed + VclMetafileProcessor2D will be created. If a pixel renderer + is requested, the best one is incarnated + + @param rTargetOutDev + The target OutputDevice + + @param rViewInformation2D + The ViewInformation to use + + @return + the created BaseProcessor2D (ownership change) or null if + something went wrong + */ + DRAWINGLAYER_DLLPUBLIC BaseProcessor2D* createProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D); + + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //INCLUDED_DRAWINGLAYER_PROCESSOR2D_PROCESSOR2DTOOLS_HXX + +// eof diff --git a/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx index fa85105..84bfea4 100644 --- a/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx +++ b/include/drawinglayer/processor2d/vclmetafileprocessor2d.hxx @@ -69,7 +69,7 @@ namespace drawinglayer and the extra-data added to it (which can be seen mostly as 'extensions' or simply as 'hacks'). */ - class DRAWINGLAYER_DLLPUBLIC VclMetafileProcessor2D : public VclProcessor2D + class VclMetafileProcessor2D : public VclProcessor2D { private: /// local helper(s) diff --git a/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx b/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx index 7e10de4..4497877 100644 --- a/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx +++ b/include/drawinglayer/processor2d/vclpixelprocessor2d.hxx @@ -42,7 +42,7 @@ namespace drawinglayer all feeded primitives to a VCL Window. It is the currently used renderer for all VCL editing output from the DrawingLayer. */ - class DRAWINGLAYER_DLLPUBLIC VclPixelProcessor2D : public VclProcessor2D + class VclPixelProcessor2D : public VclProcessor2D { private: struct Impl; diff --git a/include/drawinglayer/processor2d/vclprocessor2d.hxx b/include/drawinglayer/processor2d/vclprocessor2d.hxx index 32dafbc..24a5133 100644 --- a/include/drawinglayer/processor2d/vclprocessor2d.hxx +++ b/include/drawinglayer/processor2d/vclprocessor2d.hxx @@ -66,7 +66,7 @@ namespace drawinglayer This processor is the base class for VCL-Based processors. It has no processBasePrimitive2D implementation and thus is not usable directly. */ - class DRAWINGLAYER_DLLPUBLIC VclProcessor2D : public BaseProcessor2D + class VclProcessor2D : public BaseProcessor2D { protected: // the destination OutDev diff --git a/include/drawinglayer/processor3d/defaultprocessor3d.hxx b/include/drawinglayer/processor3d/defaultprocessor3d.hxx index 010fba3..f227767 100644 --- a/include/drawinglayer/processor3d/defaultprocessor3d.hxx +++ b/include/drawinglayer/processor3d/defaultprocessor3d.hxx @@ -71,7 +71,7 @@ namespace drawinglayer rasterconvertB3DPolyPolygon for filled geometry is called. It is a beseclass to e.g. base a Z-Buffer supported renderer on the 3D primitive processing. */ - class DRAWINGLAYER_DLLPUBLIC DefaultProcessor3D : public BaseProcessor3D + class DefaultProcessor3D : public BaseProcessor3D { protected: /// read-only scene infos (normal handling, etc...) diff --git a/include/drawinglayer/processor3d/zbufferprocessor3d.hxx b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx index 8570809..fd05c08 100644 --- a/include/drawinglayer/processor3d/zbufferprocessor3d.hxx +++ b/include/drawinglayer/processor3d/zbufferprocessor3d.hxx @@ -58,7 +58,7 @@ namespace drawinglayer raster bitmap using a Z-Buffer based approach. It is able to supersample and to handle transparent content. */ - class DRAWINGLAYER_DLLPUBLIC ZBufferProcessor3D : public DefaultProcessor3D + class ZBufferProcessor3D : public DefaultProcessor3D { private: /// the raster target, a Z-Buffer diff --git a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx index def4dfe..28c4be5 100644 --- a/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx +++ b/svx/source/sdr/contact/objectcontactofobjlistpainter.cxx @@ -24,9 +24,8 @@ #include <svx/svdobj.hxx> #include <svx/sdr/contact/viewcontact.hxx> #include <svx/svdmodel.hxx> -#include <drawinglayer/processor2d/vclprocessor2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> #include <svx/unoapi.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -128,9 +127,9 @@ namespace sdr // if there is something to show, use a vclProcessor to render it if(xPrimitiveSequence.hasElements()) { - drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = - drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( - *pTargetDevice, getViewInformation2D()); + drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createProcessor2DFromOutputDevice( + *pTargetDevice, + getViewInformation2D()); if(pProcessor2D) { diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx index d53539f..bbc69ed 100644 --- a/svx/source/sdr/contact/objectcontactofpageview.cxx +++ b/svx/source/sdr/contact/objectcontactofpageview.cxx @@ -29,11 +29,10 @@ #include <svx/sdr/event/eventhandler.hxx> #include <svx/sdrpagewindow.hxx> #include <svx/sdrpaintwindow.hxx> -#include <drawinglayer/processor2d/vclprocessor2d.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> -#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> #include <com/sun/star/rendering/XSpriteCanvas.hpp> +#include <drawinglayer/processor2d/processor2dtools.hxx> #include <svx/unoapi.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -240,7 +239,7 @@ namespace sdr // if there is something to show, use a primitive processor to render it. There // is a choice between VCL and Canvas processors currently. The decision is made in - // createBaseProcessor2DFromOutputDevice and takes into accout things like the + // createProcessor2DFromOutputDevice and takes into accout things like the // Target is a MetaFile, a VDev or something else. The Canvas renderer is triggered // currently using the shown boolean. Canvas is not yet the default. if(xPrimitiveSequence.hasElements()) @@ -251,7 +250,7 @@ namespace sdr // create renderer drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = - drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( + drawinglayer::processor2d::createProcessor2DFromOutputDevice( rTargetOutDev, getViewInformation2D()); if(pProcessor2D) diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index d9a0ef4..2509d16 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -25,8 +25,7 @@ #include <vcl/window.hxx> #include <svx/sdr/overlay/overlayobject.hxx> #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/processor2d/baseprocessor2d.hxx> -#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -48,10 +47,9 @@ namespace sdr const bool bIsAntiAliasing(getDrawinglayerOpt().IsAntiAliasing()); // create processor - drawinglayer::processor2d::BaseProcessor2D* pProcessor = - ::drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( - rDestinationDevice, - getCurrentViewInformation2D()); + drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice( + rDestinationDevice, + getCurrentViewInformation2D()); if(pProcessor) { diff --git a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx index 823eb74..33dcbc3 100644 --- a/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx +++ b/svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx @@ -20,8 +20,6 @@ #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> -#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> -#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> #include <svx/sdr/overlay/overlaymanager.hxx> ////////////////////////////////////////////////////////////////////////////// diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 448f477..ef3e1a9 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -58,8 +58,7 @@ #include <vcl/svapp.hxx> #include <svx/sdrpaintwindow.hxx> #include <svx/sdr/overlay/overlaytools.hxx> -#include <drawinglayer/processor2d/baseprocessor2d.hxx> -#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -339,8 +338,7 @@ void SdrObjEditView::ImpPaintOutlinerView(OutlinerView& rOutlView, const Rectang { // completely reworked to use primitives; this ensures same look and functionality const drawinglayer::geometry::ViewInformation2D aViewInformation2D; - - drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( + drawinglayer::processor2d::BaseProcessor2D* pProcessor = drawinglayer::processor2d::createProcessor2DFromOutputDevice( rTargetDevice, aViewInformation2D); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 28a7515..271b081 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -64,15 +64,13 @@ #include <accessibilityoptions.hxx> #include <com/sun/star/embed/EmbedMisc.hpp> #include <com/sun/star/embed/EmbedStates.hpp> - #include <svtools/embedhlp.hxx> #include <svx/charthelper.hxx> #include <dview.hxx> // #i99665# - #include <basegfx/matrix/b2dhommatrix.hxx> -#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> #include <drawinglayer/processor2d/baseprocessor2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> using namespace com::sun::star; @@ -761,7 +759,7 @@ bool paintUsingPrimitivesHelper( // get a primitive processor for rendering drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = - drawinglayer::processor2d::createBaseProcessor2DFromOutputDevice( + drawinglayer::processor2d::createProcessor2DFromOutputDevice( rOutputDevice, aViewInformation2D); if(pProcessor2D) commit a325b6aed9bd8e7d3bd16352cbc063c6754d121f Author: Armin Le Grand <a...@apache.org> Date: Tue Jan 29 12:32:36 2013 +0000 Resolves: #i121532# enhanced visualisation of text edit&selection D&D overhauled (cherry picked from commit c6e63b6bbb6b4a63fe1302de57fc32cd28432378) Conflicts: drawinglayer/inc/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx drawinglayer/inc/drawinglayer/primitive2d/polypolygonprimitive2d.hxx drawinglayer/inc/drawinglayer/processor2d/linegeometryextractor2d.hxx drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx svx/Package_inc.mk svx/inc/svx/sdr/overlay/overlayanimatedbitmapex.hxx svx/inc/svx/sdr/overlay/overlayobject.hxx svx/inc/svx/sdr/overlay/overlaypolypolygon.hxx svx/inc/svx/sdr/overlay/overlayrectangle.hxx svx/inc/svx/sdr/overlay/overlaytools.hxx svx/inc/svx/sdr/primitive2d/svx_primitivetypes2d.hxx svx/inc/svx/svdview.hxx svx/source/engine3d/view3d.cxx svx/source/sdr/overlay/overlayanimatedbitmapex.cxx svx/source/sdr/overlay/overlayhatchrect.cxx svx/source/sdr/overlay/overlaypolypolygon.cxx svx/source/sdr/overlay/overlaytools.cxx svx/source/svdraw/svdcrtv.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdview.cxx sw/source/ui/dochdl/swdtflvr.cxx Unname unused arguments to prevent WaE issues. (cherry picked from commit 5aee0c13cc62a81a38d4132db7972dc301c21b3d) Conflicts: drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx sd/source/ui/view/sdview3.cxx svx/source/svdraw/svdedxv.cxx Change-Id: I3b1cf4754063985dc1b4adac44b33e52e200607f diff --git a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx index 00cada7..a983d85 100644 --- a/chart2/source/controller/main/DragMethod_RotateDiagram.cxx +++ b/chart2/source/controller/main/DragMethod_RotateDiagram.cxx @@ -215,7 +215,8 @@ void DragMethod_RotateDiagram::CreateOverlayGeometry(sdr::overlay::OverlayManage // transform to 2D view coordinates aPolyPolygon.transform(rVCScene.getObjectTransformation()); - sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon); + sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aPolyPolygon); rOverlayManager.add(*pNew); addToOverlayObjectList(*pNew); } diff --git a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx index 95b5aac..b7f91d2 100644 --- a/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/polypolygonprimitive2d.cxx @@ -27,6 +27,8 @@ #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx> +#include <drawinglayer/primitive2d/unifiedtransparenceprimitive2d.hxx> +#include <drawinglayer/geometry/viewinformation2d.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -109,7 +111,12 @@ namespace drawinglayer for(sal_uInt32 a(0L); a < nCount; a++) { - aRetval[a] = Primitive2DReference(new PolygonMarkerPrimitive2D(aPolyPolygon.getB2DPolygon(a), getRGBColorA(), getRGBColorB(), getDiscreteDashLength())); + aRetval[a] = Primitive2DReference( + new PolygonMarkerPrimitive2D( + aPolyPolygon.getB2DPolygon(a), + getRGBColorA(), + getRGBColorB(), + getDiscreteDashLength())); } return aRetval; @@ -458,4 +465,107 @@ namespace drawinglayer } // end of namespace primitive2d } // end of namespace drawinglayer +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace primitive2d + { + Primitive2DSequence PolyPolygonSelectionPrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const + { + Primitive2DSequence aRetval; + + if(getTransparence() < 1.0 && getB2DPolyPolygon().count()) + { + if(getFill() && getB2DPolyPolygon().isClosed()) + { + // create fill primitive + const Primitive2DReference aFill( + new PolyPolygonColorPrimitive2D( + getB2DPolyPolygon(), + getColor())); + + aRetval = Primitive2DSequence(&aFill, 1); + } + + if(getDiscreteGrow() > 0.0) + { + const attribute::LineAttribute aLineAttribute( + getColor(), + getDiscreteGrow() * getDiscreteUnit() * 2.0); + const Primitive2DReference aFatLine( + new PolyPolygonStrokePrimitive2D( + getB2DPolyPolygon(), + aLineAttribute)); + + appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFatLine); + } + + // embed filled to transparency (if used) + if(aRetval.getLength() && getTransparence() > 0.0) + { + const Primitive2DReference aTrans( + new UnifiedTransparencePrimitive2D( + aRetval, + getTransparence())); + + aRetval = Primitive2DSequence(&aTrans, 1); + } + } + + return aRetval; + } + + PolyPolygonSelectionPrimitive2D::PolyPolygonSelectionPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rColor, + double fTransparence, + double fDiscreteGrow, + bool bFill) + : DiscreteMetricDependentPrimitive2D(), + maPolyPolygon(rPolyPolygon), + maColor(rColor), + mfTransparence(fTransparence), + mfDiscreteGrow(fabs(fDiscreteGrow)), + mbFill(bFill) + { + } + + bool PolyPolygonSelectionPrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const + { + if(DiscreteMetricDependentPrimitive2D::operator==(rPrimitive)) + { + const PolyPolygonSelectionPrimitive2D& rCompare = (PolyPolygonSelectionPrimitive2D&)rPrimitive; + + return (getB2DPolyPolygon() == rCompare.getB2DPolyPolygon() + && getColor() == rCompare.getColor() + && getTransparence() == rCompare.getTransparence() + && getDiscreteGrow() == rCompare.getDiscreteGrow() + && getFill() == rCompare.getFill()); + } + + return false; + } + + basegfx::B2DRange PolyPolygonSelectionPrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const + { + basegfx::B2DRange aRetval(basegfx::tools::getRange(getB2DPolyPolygon())); + + if(getDiscreteGrow() > 0.0) + { + // get the current DiscreteUnit (not sure if getDiscreteUnit() is updated here, better go safe way) + const double fDiscreteUnit((rViewInformation.getInverseObjectToViewTransformation() * basegfx::B2DVector(1.0, 0.0)).getLength()); + + aRetval.grow(fDiscreteUnit * getDiscreteGrow()); + } + + return aRetval; + } + + // provide unique ID + ImplPrimitive2DIDBlock(PolyPolygonSelectionPrimitive2D, PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D) + + } // end of namespace primitive2d +} // end of namespace drawinglayer + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx index a3af5cb..e9c646e 100644 --- a/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx +++ b/include/drawinglayer/primitive2d/drawinglayer_primitivetypes2d.hxx @@ -101,7 +101,8 @@ #define PRIMITIVE2D_ID_CROPPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 66) #define PRIMITIVE2D_ID_PATTERNFILLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 67) #define PRIMITIVE2D_ID_OBJECTINFOPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 68) -#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69) +#define PRIMITIVE2D_ID_POLYPOLYGONSELECTIONPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 69) +#define PRIMITIVE2D_ID_CLIPPEDBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_DRAWINGLAYER| 70) ////////////////////////////////////////////////////////////////////////////// diff --git a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx index 6284b88..683d2c4 100644 --- a/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx +++ b/include/drawinglayer/primitive2d/polypolygonprimitive2d.hxx @@ -30,6 +30,7 @@ #include <drawinglayer/attribute/linestartendattribute.hxx> #include <drawinglayer/attribute/fillgradientattribute.hxx> #include <drawinglayer/attribute/fillhatchattribute.hxx> +#include <drawinglayer/primitive2d/primitivetools2d.hxx> #include <basegfx/color/bcolor.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -376,6 +377,70 @@ namespace drawinglayer } // end of namespace drawinglayer ////////////////////////////////////////////////////////////////////////////// +// PolyPolygonSelectionPrimitive2D class + +namespace drawinglayer +{ + namespace primitive2d + { + /** PolyPolygonSelectionPrimitive2D class + + This primitive defines a PolyPolygon which gets filled with a defined color + and a defined transparence, but also gets extended ('grown') by the given + discrete size (thus being a view-dependent primitive) + */ + class DRAWINGLAYER_DLLPUBLIC PolyPolygonSelectionPrimitive2D : public DiscreteMetricDependentPrimitive2D + { + private: + /// the PolyPolygon geometry + basegfx::B2DPolyPolygon maPolyPolygon; + + /// the color + basegfx::BColor maColor; + + /// the transparence [0.0 .. 1.0] + double mfTransparence; + + /// the discrete grow size ('pixels'), only posivive values allowed + double mfDiscreteGrow; + + /// bitfield + /// draw polygons filled when fill is set + bool mbFill : 1; + + protected: + /// local decomposition. + virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; + + public: + /// constructor + PolyPolygonSelectionPrimitive2D( + const basegfx::B2DPolyPolygon& rPolyPolygon, + const basegfx::BColor& rColor, + double fTransparence, + double fDiscreteGrow, + bool bFill); + + /// data read access + const basegfx::B2DPolyPolygon& getB2DPolyPolygon() const { return maPolyPolygon; } + const basegfx::BColor& getColor() const { return maColor; } + double getTransparence() const { return mfTransparence; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + bool getFill() const { return mbFill; } + + /// compare operator + virtual bool operator==(const BasePrimitive2D& rPrimitive) const; + + /// get range + virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const; + + /// provide unique ID + DeclPrimitive2DIDBlock() + }; + } // end of namespace primitive2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_POLYPOLYGONPRIMITIVE2D_HXX diff --git a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx index 4905f40..906dd9e 100644 --- a/include/drawinglayer/processor2d/linegeometryextractor2d.hxx +++ b/include/drawinglayer/processor2d/linegeometryextractor2d.hxx @@ -35,7 +35,7 @@ namespace drawinglayer /** LineGeometryExtractor2D class This processor can extract the line geometry from feeded primpitives. The - hairlines and the fille geometry from fat lines are separated. + hairlines and the fill geometry from fat lines are separated. */ class DRAWINGLAYER_DLLPUBLIC LineGeometryExtractor2D : public BaseProcessor2D { diff --git a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx index 756d2da..ee9a4a6 100644 --- a/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx +++ b/include/svx/sdr/overlay/overlayanimatedbitmapex.hxx @@ -45,16 +45,13 @@ namespace sdr // #i53216# added CursorBlinkTime (in ms) sal_uInt32 mnBlinkTime; - // bitfield - // Flag to remember which state to draw. Inited with sal_False (0) - unsigned mbOverlayState : 1; + /// bitfield + // Flag to remember which state to draw. Inited with false (0) + bool mbOverlayState : 1; // geometry creation for OverlayObject virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); - // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) - void impCheckBlinkTimeValueRange(); - public: OverlayAnimatedBitmapEx( const basegfx::B2DPoint& rBasePos, diff --git a/include/svx/sdr/overlay/overlayobject.hxx b/include/svx/sdr/overlay/overlayobject.hxx index 263e9a9..3b56c97 100644 --- a/include/svx/sdr/overlay/overlayobject.hxx +++ b/include/svx/sdr/overlay/overlayobject.hxx @@ -82,6 +82,9 @@ namespace sdr // a missing implementation virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + // #i53216# check blink time value range (currently 25 < mnBlinkTime < 10000) + sal_uInt32 impCheckBlinkTimeValueRange(sal_uInt32 nBlinkTime) const; + // region in logical coordinates basegfx::B2DRange maBaseRange; diff --git a/include/svx/sdr/overlay/overlaypolypolygon.hxx b/include/svx/sdr/overlay/overlaypolypolygon.hxx index d7dd827..a716aac 100644 --- a/include/svx/sdr/overlay/overlaypolypolygon.hxx +++ b/include/svx/sdr/overlay/overlaypolypolygon.hxx @@ -22,6 +22,7 @@ #include <svx/sdr/overlay/overlayobject.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> ////////////////////////////////////////////////////////////////////////////// @@ -29,21 +30,23 @@ namespace sdr { namespace overlay { - class SVX_DLLPUBLIC OverlayPolyPolygonStriped : public OverlayObject + class SVX_DLLPUBLIC OverlayPolyPolygonStripedAndFilled : public OverlayObject { protected: // geometry - basegfx::B2DPolyPolygon maPolyPolygon; + basegfx::B2DPolyPolygon maLinePolyPolygon; // geometry creation for OverlayObject virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); public: - explicit OverlayPolyPolygonStriped(const basegfx::B2DPolyPolygon& rPolyPolygon); - virtual ~OverlayPolyPolygonStriped(); + explicit OverlayPolyPolygonStripedAndFilled( + const basegfx::B2DPolyPolygon& rLinePolyPolygon); + virtual ~OverlayPolyPolygonStripedAndFilled(); // change geometry - basegfx::B2DPolyPolygon getPolyPolygon() const { return maPolyPolygon; } + basegfx::B2DPolyPolygon getLinePolyPolygon() const { return maLinePolyPolygon; } + void setLinePolyPolygon(const basegfx::B2DPolyPolygon& rNew); // react on stripe definition change virtual void stripeDefinitionHasChanged(); diff --git a/include/svx/sdr/overlay/overlayrectangle.hxx b/include/svx/sdr/overlay/overlayrectangle.hxx new file mode 100644 index 0000000..3d2f6f7 --- /dev/null +++ b/include/svx/sdr/overlay/overlayrectangle.hxx @@ -0,0 +1,87 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef _SDR_OVERLAY_OVERLAYRECTANGLE_HXX +#define _SDR_OVERLAY_OVERLAYRECTANGLE_HXX + +#include <svx/sdr/overlay/overlayobject.hxx> +#include <tools/gen.hxx> + +////////////////////////////////////////////////////////////////////////////// + +class PolyPolygon; + +namespace sdr +{ + namespace overlay + { + class OverlayRectangle : public OverlayObjectWithBasePosition + { + // geometric definitions + basegfx::B2DPoint maSecondPosition; + const double mfTransparence; + const double mfDiscreteGrow; + const double mfDiscreteShrink; + const double mfRotation; + + // #i53216# added CursorBlinkTime (in ms) + sal_uInt32 mnBlinkTime; + + /// bitfield + // Flag to remember which state to draw. Inited with false (0) + bool mbOverlayState : 1; + + // geometry creation for OverlayObject + virtual drawinglayer::primitive2d::Primitive2DSequence createOverlayObjectPrimitive2DSequence(); + + public: + OverlayRectangle( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fTransparence, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation, + sal_uInt32 nBlinkTime, + bool bAnimate); + + const basegfx::B2DPoint& getSecondPosition() const { return maSecondPosition; } + void setSecondPosition(const basegfx::B2DPoint&); + + // data read access + double getTransparence() const { return mfTransparence; } + double getDiscreteGrow() const { return mfDiscreteGrow; } + double getDiscreteShrink() const { return mfDiscreteShrink; } + double getRotation() const { return mfRotation; } + + // added CursorBlinkTime (in ms) + sal_uInt32 getBlinkTime() const { return mnBlinkTime; } + void setBlinkTime(sal_uInt32 nNew); + + // execute event from base class ::sdr::animation::Event. Default + // implementation does nothing and does not create a new event. + virtual void Trigger(sal_uInt32 nTime); + }; + } // end of namespace overlay +} // end of namespace sdr + +////////////////////////////////////////////////////////////////////////////// + +#endif //_SDR_OVERLAY_OVERLAYRECTANGLE_HXX + +// eof diff --git a/include/svx/sdr/overlay/overlaytools.hxx b/include/svx/sdr/overlay/overlaytools.hxx index 408c81b..57bbcf7 100644 --- a/include/svx/sdr/overlay/overlaytools.hxx +++ b/include/svx/sdr/overlay/overlaytools.hxx @@ -118,16 +118,15 @@ namespace drawinglayer { namespace primitive2d { - class OverlayHatchRectanglePrimitive : public DiscreteMetricDependentPrimitive2D + class OverlayRectanglePrimitive : public DiscreteMetricDependentPrimitive2D { private: // the logic rectangle definition basegfx::B2DRange maObjectRange; - // the hatch definition - double mfDiscreteHatchDistance; - double mfHatchRotation; - basegfx::BColor maHatchColor; + // the graphic definition + basegfx::BColor maColor; + double mfTransparence; // the dscrete grow and shrink of the box double mfDiscreteGrow; @@ -140,20 +139,18 @@ namespace drawinglayer virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; public: - OverlayHatchRectanglePrimitive( + OverlayRectanglePrimitive( const basegfx::B2DRange& rObjectRange, - double fDiscreteHatchDistance, - double fHatchRotation, - const basegfx::BColor& rHatchColor, + const basegfx::BColor& rColor, + double fTransparence, double fDiscreteGrow, double fDiscreteShrink, double fRotation); // data access const basegfx::B2DRange& getObjectRange() const { return maObjectRange; } - double getDiscreteHatchDistance() const { return mfDiscreteHatchDistance; } - double getHatchRotation() const { return mfHatchRotation; } - const basegfx::BColor& getHatchColor() const { return maHatchColor; } + const basegfx::BColor& getColor() const { return maColor; } + double getTransparence() const { return mfTransparence; } double getDiscreteGrow() const { return mfDiscreteGrow; } double getDiscreteShrink() const { return mfDiscreteShrink; } double getRotation() const { return mfRotation; } diff --git a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx index 6178695..42d5109 100644 --- a/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx +++ b/include/svx/sdr/primitive2d/svx_primitivetypes2d.hxx @@ -42,7 +42,7 @@ #define PRIMITIVE2D_ID_SDRBORDERLINEPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 15) #define PRIMITIVE2D_ID_OVERLAYBITMAPEXPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 16) #define PRIMITIVE2D_ID_OVERLAYCROSSHAIRPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 17) -#define PRIMITIVE2D_ID_OVERLAYHATCHRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) +#define PRIMITIVE2D_ID_OVERLAYRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 18) #define PRIMITIVE2D_ID_OVERLAYHELPLINESTRIPEDPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 19) #define PRIMITIVE2D_ID_OVERLAYROLLINGRECTANGLEPRIMITIVE (PRIMITIVE2D_ID_RANGE_SVX| 20) #define PRIMITIVE2D_ID_SDRCONTROLPRIMITIVE2D (PRIMITIVE2D_ID_RANGE_SVX| 21) diff --git a/include/svx/svdview.hxx b/include/svx/svdview.hxx index ef28a17..7628926 100644 --- a/include/svx/svdview.hxx +++ b/include/svx/svdview.hxx @@ -28,6 +28,8 @@ #include "svx/svxdllapi.h" #include <svx/svdcrtv.hxx> #include <unotools/options.hxx> +#include <basegfx/polygon/b2dpolypolygon.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> //////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -151,7 +153,9 @@ class SVX_DLLPUBLIC SdrDropMarkerOverlay // The OverlayObjects ::sdr::overlay::OverlayObjectList maObjects; - void ImplCreateOverlays(const SdrView& rView, const basegfx::B2DPolyPolygon& rPolyPolygon); + void ImplCreateOverlays( + const SdrView& rView, + const basegfx::B2DPolyPolygon& rLinePolyPolygon); public: SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject); diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index e030435..fa14fe1 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -512,6 +512,12 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge { SdTransferable* pDragTransferable = SD_MOD()->pTransferDrag; + if(pDragTransferable && (nDropAction & DND_ACTION_LINK)) + { + // suppress own data when it's intention is to use it as fill information + pDragTransferable = 0; + } + if( pDragTransferable ) { const View* pSourceView = pDragTransferable->GetView(); @@ -581,7 +587,7 @@ sal_Int8 View::AcceptDrop( const AcceptDropEvent& rEvt, DropTargetHelper& rTarge } if( bHasPickObj && !bIsPresTarget && - ( !pPickObj->ISA( SdrGrafObj ) || bGraphic || bMtf || bBitmap || ( bXFillExchange && !pPickObj->ISA( SdrGrafObj ) && !pPickObj->ISA( SdrOle2Obj ) ) ) ) + ( bGraphic || bMtf || bBitmap || bXFillExchange ) ) { if( mpDropMarkerObj != pPickObj ) { diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index 123a3f4..1711426 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -266,7 +266,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, SdrObject* pPickObj = NULL; SdPage* pPage = NULL; ImageMap* pImageMap = NULL; - sal_Bool bReturn = sal_False; + bool bReturn = false; sal_Bool bLink = ( ( mnAction & DND_ACTION_LINK ) != 0 ); sal_Bool bCopy = ( ( ( mnAction & DND_ACTION_COPY ) != 0 ) || bLink ); sal_uLong nPasteOptions = SDRINSERT_SETDEFLAYER; @@ -292,6 +292,12 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, SdTransferable* pOwnData = NULL; SdTransferable* pImplementation = SdTransferable::getImplementation( aDataHelper.GetTransferable() ); + if(pImplementation && (rDnDAction & DND_ACTION_LINK)) + { + // suppress own data when it's intention is to use it as fill information + pImplementation = 0; + } + // try to get own transfer data if( pImplementation ) { @@ -344,11 +350,14 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } + // Changed the whole decision tree to be dependent of bReturn as a flag that + // the work was done; this allows to check multiple formats and not just fail + // when a CHECK_FORMAT_TRANS(*format*) detected format does not work. This is + // e.g. necessary for FORMAT_BITMAP if( pOwnData && !nFormat ) { const View* pSourceView = pOwnData->GetView(); - if( pOwnData->GetDocShell() && pOwnData->IsPageTransferable() && ISA( View ) ) { mpClipboard->HandlePageDrop (*pOwnData); @@ -390,7 +399,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - bReturn = sal_True; + bReturn = true; } } else @@ -566,12 +575,12 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pMarkList != mpDragSrcMarkList ) delete pMarkList; - bReturn = sal_True; + bReturn = true; } else { maDropErrorTimer.Start(); - bReturn = sal_False; + bReturn = false; } } } @@ -580,7 +589,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, pOwnData->SetInternalMove( sal_True ); MoveAllMarked( Size( maDropPos.X() - pOwnData->GetStartPos().X(), maDropPos.Y() - pOwnData->GetStartPos().Y() ), bCopy ); - bReturn = sal_True; + bReturn = true; } } } @@ -606,7 +615,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, else { maDropErrorTimer.Start(); - bReturn = sal_False; + bReturn = false; } } } @@ -642,7 +651,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, pPage->SetPresentationLayout( aLayout, sal_False, sal_False ); } } - else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING ) ) + + if(!bReturn && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_DRAWING )) { SotStorageStreamRef xStm; @@ -784,7 +794,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } - else if( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE ) ) + + if(!bReturn && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_SBA_FIELDDATAEXCHANGE)) { OUString aOUString; @@ -803,14 +814,15 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, aRect.SetPos( maDropPos ); pObj->SetLogicRect( aRect ); InsertObjectAtView( pObj, *GetSdrPageView(), SDRINSERT_SETDEFLAYER ); - bReturn = sal_True; + bReturn = true; } } } - else if( !bLink && - ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE ) || - CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ ) ) && - aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) ) + + if(!bReturn && + !bLink && + (CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBED_SOURCE) || CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBEDDED_OBJ)) && + aDataHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR)) { //TODO/LATER: is it possible that this format is binary?! (from old versions of SO) uno::Reference < io::XInputStream > xStm; @@ -977,15 +989,16 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } - bReturn = sal_True; + bReturn = true; } } } } - else if( !bLink && - ( CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE ) || - CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EMBED_SOURCE_OLE ) ) && - aDataHelper.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE ) ) + + if(!bReturn && + !bLink && + (CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBEDDED_OBJ_OLE) || CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EMBED_SOURCE_OLE)) && + aDataHelper.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR_OLE)) { // online insert ole if format is forced or no gdi metafile is available if( (nFormat != 0) || !aDataHelper.HasFormat( FORMAT_GDIMETAFILE ) ) @@ -1126,7 +1139,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, // let the object stay in loaded state after insertion pObj->Unload(); - bReturn = sal_True; + bReturn = true; } } } @@ -1137,7 +1150,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, InsertMetaFile( aDataHelper, rPos, pImageMap, true ); } } - else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_SVXB ) ) + + if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_SVXB)) { SotStorageStreamRef xStm; @@ -1171,10 +1185,11 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea()); InsertGraphic( aGraphic, mnAction, aInsertPos, NULL, pImageMap ); - bReturn = sal_True; + bReturn = true; } } - else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_GDIMETAFILE ) ) + + if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_GDIMETAFILE)) { Point aInsertPos( rPos ); @@ -1197,7 +1212,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = InsertMetaFile( aDataHelper, aInsertPos, pImageMap, nFormat == 0 ? true : false ) ? sal_True : sal_False; } - else if( ( !bLink || pPickObj ) && CHECK_FORMAT_TRANS( FORMAT_BITMAP ) ) + + if(!bReturn && (!bLink || pPickObj) && CHECK_FORMAT_TRANS(FORMAT_BITMAP)) { Bitmap aBmp; @@ -1226,10 +1242,11 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, ImpCheckInsertPos(aInsertPos, aImageMapSize, GetWorkArea()); InsertGraphic( aBmp, mnAction, aInsertPos, NULL, pImageMap ); - bReturn = sal_True; + bReturn = true; } } - else if( pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) ) + + if(!bReturn && pPickObj && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_XFA ) ) { SotStorageStreamRef xStm; @@ -1292,7 +1309,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } - else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_HTML ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_HTML)) { SotStorageStreamRef xStm; @@ -1303,7 +1321,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_HTML, maDropPos, pPage, nPasteOptions ); } } - else if( !bLink && CHECK_FORMAT_TRANS( SOT_FORMATSTR_ID_EDITENGINE ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(SOT_FORMATSTR_ID_EDITENGINE)) { SotStorageStreamRef xStm; @@ -1322,7 +1341,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, { // mba: clipboard always must contain absolute URLs (could be from alien source) pOLV->Read( *xStm, String(), EE_FORMAT_BIN, sal_False, mpDocSh->GetHeaderAttributes() ); - bReturn = sal_True; + bReturn = true; } } @@ -1331,7 +1350,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, bReturn = SdrView::Paste( *xStm, String(), EE_FORMAT_BIN, maDropPos, pPage, nPasteOptions ); } } - else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_RTF ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(FORMAT_RTF)) { SotStorageStreamRef xStm; @@ -1356,7 +1376,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, { // mba: clipboard always must contain absolute URLs (could be from alien source) pOLV->Read( *xStm, String(), EE_FORMAT_RTF, sal_False, mpDocSh->GetHeaderAttributes() ); - bReturn = sal_True; + bReturn = true; } } @@ -1366,7 +1386,8 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, } } } - else if( CHECK_FORMAT_TRANS( FORMAT_FILE_LIST ) ) + + if(!bReturn && CHECK_FORMAT_TRANS(FORMAT_FILE_LIST)) { FileList aDropFileList; @@ -1380,9 +1401,10 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropInsertFileTimer.Start(); } - bReturn = sal_True; + bReturn = true; } - else if( CHECK_FORMAT_TRANS( FORMAT_FILE ) ) + + if(!bReturn && CHECK_FORMAT_TRANS(FORMAT_FILE)) { String aDropFile; @@ -1393,9 +1415,10 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, maDropInsertFileTimer.Start(); } - bReturn = sal_True; + bReturn = true; } - else if( !bLink && CHECK_FORMAT_TRANS( FORMAT_STRING ) ) + + if(!bReturn && !bLink && CHECK_FORMAT_TRANS(FORMAT_STRING)) { if( ( FORMAT_STRING == nFormat ) || ( !aDataHelper.HasFormat( SOT_FORMATSTR_ID_SOLK ) && @@ -1411,7 +1434,7 @@ sal_Bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pOLV ) { pOLV->InsertText( aOUString ); - bReturn = sal_True; + bReturn = true; } if( !bReturn ) diff --git a/svx/Library_svxcore.mk b/svx/Library_svxcore.mk index 94fbf16..5feda8f 100644 --- a/svx/Library_svxcore.mk +++ b/svx/Library_svxcore.mk @@ -196,7 +196,7 @@ $(eval $(call gb_Library_add_exception_objects,svxcore,\ svx/source/sdr/overlay/overlayrollingrectangle \ svx/source/sdr/overlay/overlaytriangle \ svx/source/sdr/overlay/overlayselection \ - svx/source/sdr/overlay/overlayhatchrect \ + svx/source/sdr/overlay/overlayrectangle \ svx/source/sdr/overlay/overlaybitmapex \ svx/source/sdr/overlay/overlaymanagerbuffered \ svx/source/sdr/overlay/overlayhelpline \ diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index ccc796e..4e0bf86 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -259,7 +259,8 @@ void E3dDragMethod::CreateOverlayGeometry(::sdr::overlay::OverlayManager& rOverl if(aResult.count()) { - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aResult); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aResult); rOverlayManager.add(*pNew); addToOverlayObjectList(*pNew); } diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index 5f856ed..15a4787 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -213,7 +213,8 @@ void Impl3DMirrorConstructOverlay::SetMirrorAxis(Point aMirrorAxisA, Point aMirr basegfx::B2DPolyPolygon aPolyPolygon(mpPolygons[b]); aPolyPolygon.transform(aMatrixTransform); - ::sdr::overlay::OverlayPolyPolygonStriped* pNew = new ::sdr::overlay::OverlayPolyPolygonStriped(aPolyPolygon); + ::sdr::overlay::OverlayPolyPolygonStripedAndFilled* pNew = new ::sdr::overlay::OverlayPolyPolygonStripedAndFilled( + aPolyPolygon); xTargetOverlay->add(*pNew); maObjects.append(*pNew); } diff --git a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx index cf9d584..ff4d97b 100644 --- a/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx +++ b/svx/source/sdr/overlay/overlayanimatedbitmapex.cxx @@ -29,19 +29,6 @@ namespace sdr { namespace overlay { - // #i53216# check blink time value range - void OverlayAnimatedBitmapEx::impCheckBlinkTimeValueRange() - { - if(mnBlinkTime < 25) - { - mnBlinkTime = 25; - } - else if(mnBlinkTime > 10000) - { - mnBlinkTime = 10000; - } - } - drawinglayer::primitive2d::Primitive2DSequence OverlayAnimatedBitmapEx::createOverlayObjectPrimitive2DSequence() { if(mbOverlayState) @@ -89,7 +76,7 @@ namespace sdr mbAllowsAnimation = true; // #i53216# check blink time value range - impCheckBlinkTimeValueRange(); + mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime); } OverlayAnimatedBitmapEx::~OverlayAnimatedBitmapEx() diff --git a/svx/source/sdr/overlay/overlayhatchrect.cxx b/svx/source/sdr/overlay/overlayhatchrect.cxx deleted file mode 100644 index 2b6c7e1..0000000 --- a/svx/source/sdr/overlay/overlayhatchrect.cxx +++ /dev/null @@ -1,71 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -#include <svx/sdr/overlay/overlayhatchrect.hxx> -#include <vcl/hatch.hxx> -#include <vcl/outdev.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/polygon/b2dpolygontools.hxx> -#include <basegfx/polygon/b2dpolygon.hxx> -#include <basegfx/numeric/ftools.hxx> -#include <svx/sdr/overlay/overlaytools.hxx> - -////////////////////////////////////////////////////////////////////////////// - -namespace sdr -{ - namespace overlay - { - drawinglayer::primitive2d::Primitive2DSequence OverlayHatchRect::createOverlayObjectPrimitive2DSequence() - { - const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition()); - const drawinglayer::primitive2d::Primitive2DReference aReference( - new drawinglayer::primitive2d::OverlayHatchRectanglePrimitive( - aHatchRange, - 3.0, - getHatchRotation(), - getBaseColor().getBColor(), - getDiscreteGrow(), - getDiscreteShrink(), - getRotation())); - - return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); - } - - OverlayHatchRect::OverlayHatchRect( - const basegfx::B2DPoint& rBasePosition, - const basegfx::B2DPoint& rSecondPosition, - const Color& rHatchColor, - double fDiscreteGrow, - double fDiscreteShrink, - double fHatchRotation, - double fRotation) - : OverlayObjectWithBasePosition(rBasePosition, rHatchColor), - maSecondPosition(rSecondPosition), - mfDiscreteGrow(fDiscreteGrow), - mfDiscreteShrink(fDiscreteShrink), - mfHatchRotation(fHatchRotation), - mfRotation(fRotation) - { - } - } // end of namespace overlay -} // end of namespace sdr - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 818bfc6..d9a0ef4 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -157,8 +157,14 @@ namespace sdr if(OUTDEV_WINDOW == getOutputDevice().GetOutDevType()) { const Size aOutputSizePixel(getOutputDevice().GetOutputSizePixel()); - aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); - aViewRange.transform(getOutputDevice().GetInverseViewTransformation()); + + // only set when we *have* a output size, else let aViewRange + // stay on empty + if(aOutputSizePixel.Width() && aOutputSizePixel.Height()) + { + aViewRange = basegfx::B2DRange(0.0, 0.0, aOutputSizePixel.getWidth(), aOutputSizePixel.getHeight()); + aViewRange.transform(getOutputDevice().GetInverseViewTransformation()); + } } OverlayManager* pThis = const_cast< OverlayManager* >(this); diff --git a/svx/source/sdr/overlay/overlayobject.cxx b/svx/source/sdr/overlay/overlayobject.cxx index da15079..292cb5a 100644 --- a/svx/source/sdr/overlay/overlayobject.cxx +++ b/svx/source/sdr/overlay/overlayobject.cxx @@ -63,6 +63,20 @@ namespace sdr return drawinglayer::primitive2d::Primitive2DSequence(); } + sal_uInt32 OverlayObject::impCheckBlinkTimeValueRange(sal_uInt32 nBlinkTime) const + { + if(nBlinkTime < 25) + { + nBlinkTime = 25; + } + else if(nBlinkTime > 10000) + { + nBlinkTime = 10000; + } + + return nBlinkTime; + } + void OverlayObject::allowAntiAliase(bool bNew) { if(bNew != (bool)mbAllowsAntiAliase) diff --git a/svx/source/sdr/overlay/overlaypolypolygon.cxx b/svx/source/sdr/overlay/overlaypolypolygon.cxx index e1b0646..f85021c 100644 --- a/svx/source/sdr/overlay/overlaypolypolygon.cxx +++ b/svx/source/sdr/overlay/overlaypolypolygon.cxx @@ -30,7 +30,7 @@ namespace sdr { namespace overlay { - drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStriped::createOverlayObjectPrimitive2DSequence() + drawinglayer::primitive2d::Primitive2DSequence OverlayPolyPolygonStripedAndFilled::createOverlayObjectPrimitive2DSequence() { drawinglayer::primitive2d::Primitive2DSequence aRetval; @@ -39,34 +39,47 @@ namespace sdr const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor()); const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor()); const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel()); - - const drawinglayer::primitive2d::Primitive2DReference aReference( + const drawinglayer::primitive2d::Primitive2DReference aStriped( new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D( - getPolyPolygon(), + getLinePolyPolygon(), aRGBColorA, aRGBColorB, fStripeLengthPixel)); - aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + aRetval = drawinglayer::primitive2d::Primitive2DSequence(&aStriped, 1); + + const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor()); + const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01); + + const drawinglayer::primitive2d::Primitive2DReference aFilled( + new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D( + getLinePolyPolygon(), + aHilightColor, + fTransparence, + 3.0, + false)); + + drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aFilled); } return aRetval; } - void OverlayPolyPolygonStriped::stripeDefinitionHasChanged() + void OverlayPolyPolygonStripedAndFilled::stripeDefinitionHasChanged() { // react on OverlayManager's stripe definition change objectChange(); } - OverlayPolyPolygonStriped::OverlayPolyPolygonStriped( - const basegfx::B2DPolyPolygon& rPolyPolygon) + OverlayPolyPolygonStripedAndFilled::OverlayPolyPolygonStripedAndFilled( + const basegfx::B2DPolyPolygon& rLinePolyPolygon) : OverlayObject(Color(COL_BLACK)), - maPolyPolygon(rPolyPolygon) + maLinePolyPolygon(rLinePolyPolygon) { } - OverlayPolyPolygonStriped::~OverlayPolyPolygonStriped() + OverlayPolyPolygonStripedAndFilled::~OverlayPolyPolygonStripedAndFilled() { } } // end of namespace overlay diff --git a/svx/source/sdr/overlay/overlayrectangle.cxx b/svx/source/sdr/overlay/overlayrectangle.cxx new file mode 100644 index 0000000..7f07be0 --- /dev/null +++ b/svx/source/sdr/overlay/overlayrectangle.cxx @@ -0,0 +1,150 @@ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <svx/sdr/overlay/overlayrectangle.hxx> +#include <vcl/outdev.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/polygon/b2dpolygontools.hxx> +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/numeric/ftools.hxx> +#include <svx/sdr/overlay/overlaytools.hxx> +#include <svx/sdr/overlay/overlaymanager.hxx> +#include <vcl/svapp.hxx> + +////////////////////////////////////////////////////////////////////////////// + +namespace sdr +{ + namespace overlay + { + drawinglayer::primitive2d::Primitive2DSequence OverlayRectangle::createOverlayObjectPrimitive2DSequence() + { + const basegfx::B2DRange aHatchRange(getBasePosition(), getSecondPosition()); + basegfx::BColor aColor(getBaseColor().getBColor()); + static double fChange(0.1); // just small optical change, do not make it annoying + + if(mbOverlayState) + { + aColor += basegfx::B3DTuple(fChange, fChange, fChange); + aColor.clamp(); + } + else + { + aColor -= basegfx::B3DTuple(fChange, fChange, fChange); + aColor.clamp(); + } + + const drawinglayer::primitive2d::Primitive2DReference aReference( + new drawinglayer::primitive2d::OverlayRectanglePrimitive( + aHatchRange, + aColor, + getTransparence(), + getDiscreteGrow(), + getDiscreteShrink(), + getRotation())); + + return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1); + } + + OverlayRectangle::OverlayRectangle( + const basegfx::B2DPoint& rBasePosition, + const basegfx::B2DPoint& rSecondPosition, + const Color& rHatchColor, + double fTransparence, + double fDiscreteGrow, + double fDiscreteShrink, + double fRotation, + sal_uInt32 nBlinkTime, + bool bAnimate) ... etc. - the rest is truncated
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits