[Libreoffice-commits] core.git: Branch 'aoo/trunk' - 7 commits - sfx2/source solenv/unxmacxp svx/source

Andre Fischer af at apache.org
Wed May 8 06:09:43 PDT 2013


 sfx2/source/sidebar/ContextList.cxx       |   12 +
 sfx2/source/sidebar/ContextList.hxx       |    5 
 sfx2/source/sidebar/Deck.cxx              |   52 +++++++-
 sfx2/source/sidebar/Deck.hxx              |    1 
 sfx2/source/sidebar/Panel.cxx             |   16 ++
 sfx2/source/sidebar/Panel.hxx             |    7 -
 sfx2/source/sidebar/ResourceManager.cxx   |   24 +++
 sfx2/source/sidebar/ResourceManager.hxx   |    8 +
 sfx2/source/sidebar/SidebarController.cxx |   31 +++-
 sfx2/source/sidebar/SidebarController.hxx |    5 
 sfx2/source/sidebar/TabBar.cxx            |    8 +
 sfx2/source/sidebar/TabBar.hxx            |    1 
 solenv/unxmacxp/inc/poll.h                |  193 ------------------------------
 svx/source/svdraw/svdfmtf.cxx             |   98 +++++++++++----
 14 files changed, 222 insertions(+), 239 deletions(-)

New commits:
commit f44ca372a2a88f996366e5cb44842ef79dd9df6e
Author: Andre Fischer <af at apache.org>
Date:   Wed May 8 12:35:53 2013 +0000

    122082: Show correct deck title and tab bar highlight after switching sidebar decks.

diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 2552c88..6d6250d 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -390,7 +390,6 @@ void SidebarController::UpdateConfigurations (void)
             maCurrentContext,
             mbIsDocumentReadOnly,
             mxFrame);
-        mpTabBar->SetDecks(aDecks);
 
         // Notify the tab bar about the updated set of decks.
         mpTabBar->SetDecks(aDecks);
@@ -422,13 +421,12 @@ void SidebarController::UpdateConfigurations (void)
             // We did not find a valid deck.
             RequestCloseDeck();
             return;
-
-            // Tell the tab bar to highlight the button associated
-            // with the deck.
-            mpTabBar->HighlightDeck(sNewDeckId);
         }
 
-        msCurrentDeckId = sNewDeckId;
+        // Tell the tab bar to highlight the button associated
+        // with the deck.
+        mpTabBar->HighlightDeck(sNewDeckId);
+
         SwitchToDeck(
             *ResourceManager::Instance().GetDeckDescriptor(sNewDeckId),
             maCurrentContext);
commit 4a84ca3c6515bddb02a789d9386b6c6e74b037dc
Author: Andre Fischer <af at apache.org>
Date:   Wed May 8 12:01:43 2013 +0000

    122251: Avoid compiler warning.

diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 30f04a5..0521c7a 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -270,7 +270,7 @@ void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent)
 
 
 
-long TabBar::Notify (NotifyEvent& rEvent)
+long TabBar::Notify (NotifyEvent&)
 {
     return sal_False;
 }
commit 2abab958f237c62abbd59b46b36354db60f23009
Author: Andre Fischer <af at apache.org>
Date:   Wed May 8 11:57:24 2013 +0000

    122251: Prevent key events from being forwarded from sidebar tab bar to Calc.

diff --git a/sfx2/source/sidebar/TabBar.cxx b/sfx2/source/sidebar/TabBar.cxx
index 0fcbb14..30f04a5 100644
--- a/sfx2/source/sidebar/TabBar.cxx
+++ b/sfx2/source/sidebar/TabBar.cxx
@@ -270,6 +270,14 @@ void TabBar::DataChanged (const DataChangedEvent& rDataChangedEvent)
 
 
 
+long TabBar::Notify (NotifyEvent& rEvent)
+{
+    return sal_False;
+}
+
+
+
+
 RadioButton* TabBar::CreateTabItem (const DeckDescriptor& rDeckDescriptor)
 {
     RadioButton* pItem = ControlFactory::CreateTabItem(this);
diff --git a/sfx2/source/sidebar/TabBar.hxx b/sfx2/source/sidebar/TabBar.hxx
index 28684ac..6f18545 100644
--- a/sfx2/source/sidebar/TabBar.hxx
+++ b/sfx2/source/sidebar/TabBar.hxx
@@ -70,6 +70,7 @@ public:
 
     virtual void Paint (const Rectangle& rUpdateArea);
     virtual void DataChanged (const DataChangedEvent& rDataChangedEvent);
+    virtual long Notify (NotifyEvent& rEvent);
 
     static sal_Int32 GetDefaultWidth (void);
 
commit 945f56f22d6b0f3a30e179b7b853a2e2de751fb1
Author: Herbert Dürr <hdu at apache.org>
Date:   Wed May 8 11:40:40 2013 +0000

    poll.h has been available in OSX SDKs>=10.3
    
    even the macosxp target has a higher baseline than that

diff --git a/solenv/unxmacxp/inc/poll.h b/solenv/unxmacxp/inc/poll.h
deleted file mode 100644
index a978163..0000000
--- a/solenv/unxmacxp/inc/poll.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/**************************************************************
- *
- * 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
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- *************************************************************/
-// poll.h
-// MacOS X does not implement poll().  Therefore, this replacement
-// is required.  It uses select().
-
-#ifndef _FAKE_POLL_H
-#define _FAKE_POLL_H
-
-#include <sys/errno.h>
-#include <string.h>
-#include <limits.h>
-#undef FD_SETSIZE
-#define FD_SETSIZE OPEN_MAX
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <stdlib.h>
-
-typedef struct pollfd {
-    int fd;                         /* file desc to poll */
-    short events;                   /* events of interest on fd */
-    short revents;                  /* events that occurred on fd */
-} pollfd_t;
-
-
-// poll flags
-#define POLLIN  0x0001
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-
-// synonyms
-#define POLLNORM POLLIN
-#define POLLPRI POLLIN
-#define POLLRDNORM POLLIN
-#define POLLRDBAND POLLIN
-#define POLLWRNORM POLLOUT
-#define POLLWRBAND POLLOUT
-
-// ignored
-#define POLLHUP 0x0010
-#define POLLNVAL 0x0020
-
-inline int poll(struct pollfd *pollSet, int pollCount, int pollTimeout)
-{
-    struct timeval      tv;
-    struct timeval      *tvp;
-    fd_set          readFDs, writeFDs, exceptFDs;
-    fd_set          *readp, *writep, *exceptp;
-    struct pollfd       *pollEnd, *p;
-    int             selected;
-    int             result;
-    int             maxFD;
-
-    if ( !pollSet )
-    {
-        pollEnd = NULL;
-        readp = NULL;
-        writep = NULL;
-        exceptp = NULL;
-        maxFD = 0;
-    }
-    else
-    {
-        pollEnd = pollSet + pollCount;
-        readp = &readFDs;
-        writep = &writeFDs;
-        exceptp = &exceptFDs;
-
-        FD_ZERO(readp);
-        FD_ZERO(writep);
-        FD_ZERO(exceptp);
-
-        // Find the biggest fd in the poll set
-        maxFD = 0;
-        for (p = pollSet; p < pollEnd; p++)
-        {
-            if (p->fd > maxFD)
-                maxFD = p->fd;
-        }
-
-        if (maxFD >= FD_SETSIZE)
-        {
-            // At least one fd is too big
-            errno = EINVAL;
-            return -1;
-        }
-
-        // Transcribe flags from the poll set to the fd sets
-        for (p = pollSet; p < pollEnd; p++)
-        {
-            if (p->fd < 0)
-            {
-                // Negative fd checks nothing and always reports zero
-            }
-            else
-            {
-                if (p->events & POLLIN)
-                    FD_SET(p->fd, readp);
-                if (p->events & POLLOUT)
-                    FD_SET(p->fd, writep);
-                if (p->events != 0)
-                    FD_SET(p->fd, exceptp);
-                // POLLERR is never set coming in; poll() always reports errors
-                // But don't report if we're not listening to anything at all.
-            }
-        }
-    }
-
-    // poll timeout is in milliseconds. Convert to struct timeval.
-    // poll timeout == -1 : wait forever : select timeout of NULL
-    // poll timeout == 0  : return immediately : select timeout of zero
-    if (pollTimeout >= 0)
-    {
-        tv.tv_sec = pollTimeout / 1000;
-        tv.tv_usec = (pollTimeout % 1000) * 1000;
-        tvp = &tv;
-    }
-    else
-    {
-        tvp = NULL;
-    }
-
-    selected = select(maxFD+1, readp, writep, exceptp, tvp);
-
-    if (selected < 0)
-    {
-        // Error during select
-        result = -1;
-    }
-    else if (selected > 0)
-    {
-        // Select found something
-        // Transcribe result from fd sets to poll set.
-        // Also count the number of selected fds. poll returns the
-        // number of ready fds; select returns the number of bits set.
-        int polled = 0;
-        for (p = pollSet; p < pollEnd; p++)
-        {
-            p->revents = 0;
-            if (p->fd < 0) {
-                // Negative fd always reports zero
-            }
-            else
-            {
-                if ( (p->events & POLLIN) && FD_ISSET(p->fd, readp) )
-                    p->revents |= POLLIN;
-                if ( (p->events & POLLOUT) && FD_ISSET(p->fd, writep) )
-                    p->revents |= POLLOUT;
-                if ( (p->events != 0) && FD_ISSET(p->fd, exceptp) )
-                    p->revents |= POLLERR;
-
-                if (p->revents)
-                    polled++;
-            }
-        }
-        result = polled;
-    }
-    else
-    {
-        // selected == 0, select timed out before anything happened
-        // Clear all result bits and return zero.
-        for (p = pollSet; p < pollEnd; p++)
-            p->revents = 0;
-
-        result = 0;
-    }
-
-    return result;
-}
-
-
-#undef FD_SETSIZE
-
-#endif
commit f6f8c047b73f8fc8b4c78b321761a26ef7ed96ba
Author: Andre Fischer <af at apache.org>
Date:   Wed May 8 09:48:36 2013 +0000

    122255: Store sidebar panel extension state (non persistent).

diff --git a/sfx2/source/sidebar/ContextList.cxx b/sfx2/source/sidebar/ContextList.cxx
index ee17b78..8e2d137 100644
--- a/sfx2/source/sidebar/ContextList.cxx
+++ b/sfx2/source/sidebar/ContextList.cxx
@@ -56,6 +56,18 @@ const ContextList::Entry* ContextList::GetMatch (const Context& rContext) const
 
 
 
+ContextList::Entry* ContextList::GetMatch (const Context& rContext)
+{
+    const ::std::vector<Entry>::const_iterator iEntry = FindBestMatch(rContext);
+    if (iEntry != maEntries.end())
+        return const_cast<Entry*>(&*iEntry);
+    else
+        return NULL;
+}
+
+
+
+
 ::std::vector<ContextList::Entry>::const_iterator ContextList::FindBestMatch (const Context& rContext) const
 {
     sal_Int32 nBestMatch (Context::NoMatch);
diff --git a/sfx2/source/sidebar/ContextList.hxx b/sfx2/source/sidebar/ContextList.hxx
index 3b98731..a95432c 100644
--- a/sfx2/source/sidebar/ContextList.hxx
+++ b/sfx2/source/sidebar/ContextList.hxx
@@ -31,7 +31,8 @@
 
 namespace sfx2 { namespace sidebar {
 
-
+/** Per context data for deck and panel descriptors.
+*/
 class ContextList
 {
 public:
@@ -50,6 +51,8 @@ public:
     */
     const Entry* GetMatch (
         const Context& rContext) const;
+    Entry* GetMatch (
+        const Context& rContext);
 
     void AddContextDescription (
         const Context& rContext,
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index ad50527..cf414a7 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -26,6 +26,7 @@
 #include "PanelDescriptor.hxx"
 #include "sfx2/sidebar/Theme.hxx"
 #include "Paint.hxx"
+#include "ResourceManager.hxx"
 
 #ifdef DEBUG
 #include "sfx2/sidebar/Tools.hxx"
@@ -52,7 +53,9 @@ namespace sfx2 { namespace sidebar {
 Panel::Panel (
     const PanelDescriptor& rPanelDescriptor,
     Window* pParentWindow,
-    const ::boost::function<void(void)>& rDeckLayoutTrigger)
+    const bool bIsInitiallyExpanded,
+    const ::boost::function<void(void)>& rDeckLayoutTrigger,
+    const ::boost::function<Context(void)>& rContextAccess)
     : Window(pParentWindow),
       msPanelId(rPanelDescriptor.msId),
       mpTitleBar(new PanelTitleBar(
@@ -62,8 +65,9 @@ Panel::Panel (
       mbIsTitleBarOptional(rPanelDescriptor.mbIsTitleBarOptional),
       mxElement(),
       mxPanelComponent(),
-      mbIsExpanded(true),
-      maDeckLayoutTrigger(rDeckLayoutTrigger)
+      mbIsExpanded(bIsInitiallyExpanded),
+      maDeckLayoutTrigger(rDeckLayoutTrigger),
+      maContextAccess(rContextAccess)
 {
     SetBackground(Theme::GetPaint(Theme::Paint_PanelBackground).GetWallpaper());
 
@@ -158,6 +162,12 @@ void Panel::SetExpanded (const bool bIsExpanded)
     {
         mbIsExpanded = bIsExpanded;
         maDeckLayoutTrigger();
+
+        if (maContextAccess)
+            ResourceManager::Instance().StorePanelExpansionState(
+                msPanelId,
+                bIsExpanded,
+                maContextAccess());
     }
 }
 
diff --git a/sfx2/source/sidebar/Panel.hxx b/sfx2/source/sidebar/Panel.hxx
index ab19940..983c160 100644
--- a/sfx2/source/sidebar/Panel.hxx
+++ b/sfx2/source/sidebar/Panel.hxx
@@ -22,6 +22,7 @@
 #ifndef SFX_SIDEBAR_PANEL_HXX
 #define SFX_SIDEBAR_PANEL_HXX
 
+#include "Context.hxx"
 #include <vcl/window.hxx>
 
 #include <com/sun/star/ui/XUIElement.hpp>
@@ -49,7 +50,9 @@ public:
     Panel (
         const PanelDescriptor& rPanelDescriptor,
         Window* pParentWindow,
-        const ::boost::function<void(void)>& rDeckLayoutTrigger );
+        const bool bIsInitiallyExpanded,
+        const ::boost::function<void(void)>& rDeckLayoutTrigger,
+        const ::boost::function<Context(void)>& rContextAccess);
     virtual ~Panel (void);
 
     void Dispose (void);
@@ -80,7 +83,7 @@ private:
     cssu::Reference<css::ui::XSidebarPanel> mxPanelComponent;
     bool mbIsExpanded;
     const ::boost::function<void(void)> maDeckLayoutTrigger;
-    Rectangle maBoundingBox;
+    const ::boost::function<Context(void)> maContextAccess;
 };
 typedef ::boost::shared_ptr<Panel> SharedPanel;
 typedef ::std::vector<SharedPanel> SharedPanelContainer;
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 0ab3662..cbd8d8f 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -572,6 +572,30 @@ void ResourceManager::ReadLegacyAddons (const Reference<frame::XFrame>& rxFrame)
 
 
 
+void ResourceManager::StorePanelExpansionState (
+    const ::rtl::OUString& rsPanelId,
+    const bool bExpansionState,
+    const Context& rContext)
+{
+    for (PanelContainer::iterator
+             iPanel(maPanels.begin()),
+             iEnd(maPanels.end());
+         iPanel!=iEnd;
+         ++iPanel)
+    {
+        if (iPanel->msId.equals(rsPanelId))
+        {
+            ContextList::Entry* pEntry (
+                iPanel->maContextList.GetMatch (rContext));
+            if (pEntry != NULL)
+                pEntry->mbIsInitiallyVisible = bExpansionState;
+        }
+    }
+}
+
+
+
+
 ::rtl::OUString ResourceManager::GetModuleName (
     const cssu::Reference<css::frame::XFrame>& rxFrame)
 {
diff --git a/sfx2/source/sidebar/ResourceManager.hxx b/sfx2/source/sidebar/ResourceManager.hxx
index 3dcd76a..7420c1d 100644
--- a/sfx2/source/sidebar/ResourceManager.hxx
+++ b/sfx2/source/sidebar/ResourceManager.hxx
@@ -94,6 +94,14 @@ public:
         const ::rtl::OUString& rsDeckId,
         const cssu::Reference<css::frame::XFrame>& rxFrame);
 
+    /** Remember the expansions state per panel and context.
+        This is not persistent past application end.
+    */
+    void StorePanelExpansionState (
+        const ::rtl::OUString& rsPanelId,
+        const bool bExpansionState,
+        const Context& rContext);
+
     static ::rtl::OUString GetModuleName (
         const cssu::Reference<css::frame::XFrame>& rxFrame);
 
diff --git a/sfx2/source/sidebar/SidebarController.cxx b/sfx2/source/sidebar/SidebarController.cxx
index 2d93c80..2552c88 100644
--- a/sfx2/source/sidebar/SidebarController.cxx
+++ b/sfx2/source/sidebar/SidebarController.cxx
@@ -573,19 +573,19 @@ void SidebarController::SwitchToDeck (
         {
             // Panel already exists in current deck.  Reuse it.
             aNewPanels[nWriteIndex] = *iPanel;
+            aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible);
         }
         else
         {
             // Panel does not yet exist.  Create it.
             aNewPanels[nWriteIndex] = CreatePanel(
                 rPanelContexDescriptor.msId,
-                mpCurrentDeck->GetPanelParentWindow());
+                mpCurrentDeck->GetPanelParentWindow(),
+                rPanelContexDescriptor.mbIsInitiallyVisible);
             bHasPanelSetChanged = true;
         }
         if (aNewPanels[nWriteIndex] != NULL)
         {
-            // Depending on the context we have to collapse the panel.
-            aNewPanels[nWriteIndex]->SetExpanded(rPanelContexDescriptor.mbIsInitiallyVisible);
             // Depending on the context we have to apply the show menu functor.
             aNewPanels[nWriteIndex]->SetShowMenuFunctor(
                 rPanelContexDescriptor.msMenuCommand.getLength()>0
@@ -649,7 +649,8 @@ bool SidebarController::ArePanelSetsEqual (
 
 SharedPanel SidebarController::CreatePanel (
     const OUString& rsPanelId,
-    ::Window* pParentWindow )
+    ::Window* pParentWindow,
+    const bool bIsInitiallyExpanded)
 {
     const PanelDescriptor* pPanelDescriptor = ResourceManager::Instance().GetPanelDescriptor(rsPanelId);
     if (pPanelDescriptor == NULL)
@@ -659,7 +660,9 @@ SharedPanel SidebarController::CreatePanel (
     SharedPanel pPanel (new Panel(
         *pPanelDescriptor,
         pParentWindow,
-        ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()) ) );
+        bIsInitiallyExpanded,
+        ::boost::bind(&Deck::RequestLayout, mpCurrentDeck.get()),
+        ::boost::bind(&SidebarController::GetCurrentContext, this)));
 
     // Create the XUIElement.
     Reference<ui::XUIElement> xUIElement (CreateUIElement(
@@ -1175,4 +1178,12 @@ void SidebarController::ShowPanel (const Panel& rPanel)
 }
 
 
+
+
+Context SidebarController::GetCurrentContext (void) const
+{
+    return maCurrentContext;
+}
+
+
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/SidebarController.hxx b/sfx2/source/sidebar/SidebarController.hxx
index 3f3929c..8a2f6c7 100644
--- a/sfx2/source/sidebar/SidebarController.hxx
+++ b/sfx2/source/sidebar/SidebarController.hxx
@@ -172,7 +172,8 @@ private:
         const bool bWantsCanvas);
     SharedPanel CreatePanel (
         const ::rtl::OUString& rsPanelId,
-        ::Window* pParentWindow );
+        ::Window* pParentWindow,
+        const bool bIsInitiallyExpanded);
     void SwitchToDeck (
         const DeckDescriptor& rDeckDescriptor,
         const Context& rContext);
@@ -216,6 +217,8 @@ private:
     */
     void ShowPanel (const Panel& rPanel);
 
+    Context GetCurrentContext (void) const;
+
     virtual void SAL_CALL disposing (void);
 };
 
commit 00174b7aac9692e3b70b6134cc9b4a005f8bc701
Author: Armin Le Grand <alg at apache.org>
Date:   Wed May 8 09:43:02 2013 +0000

    i12246 Corrected three basic problems in the metafile breaker

diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx
index 1314161..e214558 100644
--- a/svx/source/svdraw/svdfmtf.cxx
+++ b/svx/source/svdraw/svdfmtf.cxx
@@ -129,8 +129,18 @@ ImpSdrGDIMetaFileImport::~ImpSdrGDIMetaFileImport()
 
 void ImpSdrGDIMetaFileImport::DoLoopActions(GDIMetaFile& rMtf, SvdProgressInfo* pProgrInfo, sal_uInt32* pActionsToReport)
 {
-    for( MetaAction* pAct = rMtf.FirstAction(); pAct; pAct = rMtf.NextAction() )
+    const sal_uLong nCount(rMtf.GetActionCount());
+
+    for(sal_uLong a(0); a < nCount; a++)
     {
+        MetaAction* pAct = rMtf.GetAction(a);
+
+        if(!pAct)
+        {
+            OSL_ENSURE(false, "OOps, no action at valid position (!)");
+            pAct = rMtf.GetAction(0);
+        }
+
         switch (pAct->GetType())
         {
             case META_PIXEL_ACTION          : DoAction((MetaPixelAction          &)*pAct); break;
@@ -515,10 +525,17 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale)
                     aTrans.scale(fScaleX, fScaleY);
                     aPixel.transform(aTrans);
 
+                    const Size aOrigSizePixel(aBitmapEx.GetSizePixel());
+                    const Point aClipTopLeft(
+                        basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))),
+                        basegfx::fround(floor(std::max(0.0, aPixel.getMinY()))));
+                    const Size aClipSize(
+                        basegfx::fround(ceil(std::min((double)aOrigSizePixel.Width(), aPixel.getWidth()))),
+                        basegfx::fround(ceil(std::min((double)aOrigSizePixel.Height(), aPixel.getHeight()))));
                     const BitmapEx aClippedBitmap(
                         aBitmapEx,
-                        Point(floor(std::max(0.0, aPixel.getMinX())), floor(std::max(0.0, aPixel.getMinY()))),
-                        Size(ceil(aPixel.getWidth()), ceil(aPixel.getHeight())));
+                        aClipTopLeft,
+                        aClipSize);
 
                     pObj->SetMergedItem(XFillStyleItem(XFILL_BITMAP));
                     pObj->SetMergedItem(XFillBitmapItem(String(), Graphic(aClippedBitmap)));
@@ -1010,6 +1027,10 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpAction& rAct)
     Rectangle aRect(rAct.GetPoint(),rAct.GetBitmap().GetSizePixel());
     aRect.Right()++; aRect.Bottom()++;
     SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
+
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1018,6 +1039,10 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScaleAction& rAct)
     Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
     aRect.Right()++; aRect.Bottom()++;
     SdrGrafObj* pGraf=new SdrGrafObj(Graphic(rAct.GetBitmap()),aRect);
+
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1026,6 +1051,10 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExAction& rAct)
     Rectangle aRect(rAct.GetPoint(),rAct.GetBitmapEx().GetSizePixel());
     aRect.Right()++; aRect.Bottom()++;
     SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
+
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1034,6 +1063,10 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScaleAction& rAct)
     Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
     aRect.Right()++; aRect.Bottom()++;
     SdrGrafObj* pGraf=new SdrGrafObj( rAct.GetBitmapEx(), aRect );
+
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1158,22 +1191,18 @@ void ImpSdrGDIMetaFileImport::DoAction( MetaCommentAction& rAct, GDIMetaFile* pM
                     aXGradient.SetEndIntens(rGrad.GetEndIntensity());
                     aXGradient.SetSteps(rGrad.GetSteps());
 
-                    if(maVD.IsLineColor())
-                    {
-                        // switch line off; when there was one there will be a
-                        // META_POLYLINE_ACTION following creating another object
-                        const Color aLineColor(maVD.GetLineColor());
-                        maVD.SetLineColor();
-                        SetAttributes(pPath);
-                        maVD.SetLineColor(aLineColor);
-                    }
-                    else
-                    {
-                        SetAttributes(pPath);
-                    }
+                    // no need to use SetAttributes(..) here since line and fill style
+                    // need to be set individually
+                    // SetAttributes(pPath);
 
+                    // switch line off; when there was one there will be a
+                    // META_POLYLINE_ACTION following creating another object
+                    aGradAttr.Put(XLineStyleItem(XLINE_NONE));
+
+                    // add detected gradient fillstyle
                     aGradAttr.Put(XFillStyleItem(XFILL_GRADIENT));
                     aGradAttr.Put(XFillGradientItem(&mpModel->GetItemPool(), aXGradient));
+
                     pPath->SetMergedItemSet(aGradAttr);
 
                     InsertObj(pPath);
@@ -1215,9 +1244,11 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpScalePartAction& rAct)
     aRect.Right()++;
     aRect.Bottom()++;
     aBitmap.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
-
     SdrGrafObj* pGraf = new SdrGrafObj(aBitmap, aRect);
 
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1229,9 +1260,11 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaBmpExScalePartAction& rAct)
     aRect.Right()++;
     aRect.Bottom()++;
     aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
-
     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
 
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1240,11 +1273,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMaskAction& rAct)
     Rectangle aRect(rAct.GetPoint(), rAct.GetBitmap().GetSizePixel());
     BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
 
-    aRect.Right()++;
-    aRect.Bottom()++;
-
+    aRect.Right()++; aRect.Bottom()++;
     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
 
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1253,11 +1287,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScaleAction& rAct)
     Rectangle aRect(rAct.GetPoint(), rAct.GetSize());
     BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
 
-    aRect.Right()++;
-    aRect.Bottom()++;
-
+    aRect.Right()++; aRect.Bottom()++;
     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
 
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1266,12 +1301,13 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaMaskScalePartAction& rAct)
     Rectangle aRect(rAct.GetDestPoint(), rAct.GetDestSize());
     BitmapEx aBitmapEx(rAct.GetBitmap(), rAct.GetColor());
 
-    aRect.Right()++;
-    aRect.Bottom()++;
+    aRect.Right()++; aRect.Bottom()++;
     aBitmapEx.Crop(Rectangle(rAct.GetSrcPoint(), rAct.GetSrcSize()));
-
     SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
 
+    // This action is not creating line and fill, set directly, do not use SetAttributes(..)
+    pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+    pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
     InsertObj(pGraf);
 }
 
@@ -1417,6 +1453,9 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct)
     {
         const Rectangle aRect(rAct.GetPoint(),rAct.GetSize());
 
+        Rectangle aHairline;
+        const Rectangle aBoundRect(rMtf.GetBoundRect(*Application::GetDefaultDevice(), &aHairline));
+
         // convert metafile sub-content to BitmapEx
         BitmapEx aBitmapEx(
             convertMetafileToBitmapEx(
@@ -1585,6 +1624,11 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction& rAct)
             // create and add object
             SdrGrafObj* pGraf = new SdrGrafObj(aBitmapEx, aRect);
 
+            // for MetaFloatTransparentAction, do not use SetAttributes(...)
+            // since these metafile content is not used to draw line/fill
+            // dependent of these setting at the device content
+            pGraf->SetMergedItem(XLineStyleItem(XLINE_NONE));
+            pGraf->SetMergedItem(XFillStyleItem(XFILL_NONE));
             InsertObj(pGraf);
         }
     }
commit db9602cbf627e1a7af56f3a419ec7c7445dcfb85
Author: Andre Fischer <af at apache.org>
Date:   Wed May 8 07:21:37 2013 +0000

    122254: Process mouse wheel events over sidebar scroll bar.

diff --git a/sfx2/source/sidebar/Deck.cxx b/sfx2/source/sidebar/Deck.cxx
index 59946f6..eb62058 100644
--- a/sfx2/source/sidebar/Deck.cxx
+++ b/sfx2/source/sidebar/Deck.cxx
@@ -220,6 +220,56 @@ void Deck::DataChanged (const DataChangedEvent& rEvent)
 
 
 
+long Deck::Notify (NotifyEvent& rEvent)
+{
+    if (rEvent.GetType() != EVENT_COMMAND)
+        return sal_False;
+
+    CommandEvent* pCommandEvent = reinterpret_cast<CommandEvent*>(rEvent.GetData());
+    if (pCommandEvent == NULL)
+        return sal_False;
+
+    switch (pCommandEvent->GetCommand())
+    {
+        case COMMAND_WHEEL:
+        {
+            if ( ! mpVerticalScrollBar
+                || ! mpVerticalScrollBar->IsVisible())
+                return sal_False;
+
+            // Ignore all wheel commands from outside the vertical
+            // scroll bar.  Otherwise after a scroll we might land on
+            // a spin field and subsequent wheel events would change
+            // the value of that control.
+            if (rEvent.GetWindow() != mpVerticalScrollBar.get())
+                return sal_True;
+
+            // Get the wheel data and check that it describes a valid
+            // vertical scroll.
+            const CommandWheelData* pData = pCommandEvent->GetWheelData();
+            if (pData==NULL
+                || pData->GetModifier()
+                || pData->GetMode() != COMMAND_WHEEL_SCROLL
+                || pData->IsHorz())
+                return sal_False;
+
+            // Execute the actual scroll action.
+            long nDelta = pData->GetDelta();
+            mpVerticalScrollBar->DoScroll(
+                mpVerticalScrollBar->GetThumbPos() - nDelta);
+            return sal_True;
+        }
+
+        default:
+            break;
+    }
+
+    return sal_False;
+}
+
+
+
+
 void Deck::SetPanels (const SharedPanelContainer& rPanels)
 {
     maPanels = rPanels;
@@ -276,7 +326,6 @@ void Deck::ShowPanel (const Panel& rPanel)
         if (rPanel.GetTitleBar() != NULL && rPanel.GetTitleBar()->IsVisible())
             nPanelTop = rPanel.GetTitleBar()->GetPosPixel().Y();
 
-
         // Determine what the new thumb position should be like.
         // When the whole panel does not fit then make its top visible
         // and it off at the bottom.
@@ -419,4 +468,5 @@ void Deck::ScrollContainerWindow::SetSeparators (const ::std::vector<sal_Int32>&
     maSeparators = rSeparators;
 }
 
+
 } } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/Deck.hxx b/sfx2/source/sidebar/Deck.hxx
index 33cb09a..89f5e4b 100644
--- a/sfx2/source/sidebar/Deck.hxx
+++ b/sfx2/source/sidebar/Deck.hxx
@@ -73,6 +73,7 @@ public:
 
     virtual void Paint (const Rectangle& rUpdateArea);
     virtual void DataChanged (const DataChangedEvent& rEvent);
+    virtual long Notify (NotifyEvent& rEvent);
 
     void PrintWindowTree (void);
     void PrintWindowTree (const ::std::vector<Panel*>& rPanels);


More information about the Libreoffice-commits mailing list