[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - 2 commits - include/svx sfx2/Library_sfx.mk sfx2/source svx/source

Caolán McNamara caolanm at redhat.com
Fri May 31 08:13:37 PDT 2013


 include/svx/SvxColorValueSet.hxx           |    2 
 sfx2/Library_sfx.mk                        |    2 
 sfx2/source/sidebar/Accessible.cxx         |   63 ++++++++++++++++++++++++++
 sfx2/source/sidebar/Accessible.hxx         |   70 +++++++++++++++++++++++++++++
 sfx2/source/sidebar/AccessibleTitleBar.cxx |   67 +++++++++++++++++++++++++++
 sfx2/source/sidebar/AccessibleTitleBar.hxx |   49 ++++++++++++++++++++
 sfx2/source/sidebar/DeckTitleBar.cxx       |   11 ++++
 sfx2/source/sidebar/DeckTitleBar.hxx       |    1 
 sfx2/source/sidebar/PanelTitleBar.cxx      |   21 +++++---
 sfx2/source/sidebar/PanelTitleBar.hxx      |    2 
 sfx2/source/sidebar/TitleBar.cxx           |   32 ++++++++-----
 sfx2/source/sidebar/TitleBar.hxx           |    5 +-
 svx/source/tbxctrls/SvxColorValueSet.cxx   |    9 +++
 13 files changed, 312 insertions(+), 22 deletions(-)

New commits:
commit 98a3c7228c6e6ed4da284eb4258cd787999a71b4
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Fri May 31 15:22:42 2013 +0100

    make SvxColorValueSet not squish all colours into avail space
    
    instead hook SvxColorValueSet::Resize() to layoutToGivenHeight
    and let it add a scrollbar if the height would squish them
    
    Change-Id: Ia94b01b247f734f3640b15f7161d28530e65d538
    (cherry picked from commit b425c2964b0f35fe12383b47c41816d612b6981b)

diff --git a/include/svx/SvxColorValueSet.hxx b/include/svx/SvxColorValueSet.hxx
index 819de02..f4b2ba3 100644
--- a/include/svx/SvxColorValueSet.hxx
+++ b/include/svx/SvxColorValueSet.hxx
@@ -35,6 +35,8 @@ public:
     SvxColorValueSet(Window* pParent, WinBits nWinStyle = WB_ITEMBORDER);
     SvxColorValueSet(Window* pParent, const ResId& rResId);
 
+    virtual void Resize();
+
     sal_uInt32 getMaxRowCount() const;
     sal_uInt32 getEntryEdgeLength() const;
     sal_uInt32 getColumnCount() const;
diff --git a/svx/source/tbxctrls/SvxColorValueSet.cxx b/svx/source/tbxctrls/SvxColorValueSet.cxx
index d990fab..9c558c2 100644
--- a/svx/source/tbxctrls/SvxColorValueSet.cxx
+++ b/svx/source/tbxctrls/SvxColorValueSet.cxx
@@ -118,6 +118,15 @@ Size SvxColorValueSet::layoutAllVisible(sal_uInt32 nEntryCount)
     return CalcWindowSizePixel(aItemSize);
 }
 
+void SvxColorValueSet::Resize()
+{
+    Window *pParent = GetParent();
+    //don't do this for the drop down color palettes
+    if (pParent && pParent->GetType() != WINDOW_FLOATINGWINDOW)
+        layoutToGivenHeight(GetOutputSizePixel().Height(), GetItemCount());
+    ValueSet::Resize();
+}
+
 Size SvxColorValueSet::layoutToGivenHeight(sal_uInt32 nHeight, sal_uInt32 nEntryCount)
 {
     if(!nEntryCount)
commit 3e0fa22de3b761686fb5b5bf4e44a91172c45f3b
Author: Andre Fischer <af at apache.org>
Date:   Fri May 31 09:03:08 2013 +0000

    Resolves: #i122271# FOCUSABLE flag at accessibility object sidebar title bars
    
    so that bridges create focus events and title bars become visible
    to AT devices.
    
    (cherry picked from commit 6055c2b50b36a0fc1b26c18b030827e3e08a51fc)
    
    Conflicts:
    	sfx2/source/sidebar/TitleBar.cxx
    
    Change-Id: If863c2c9d5ba19ba627639b294a430869f245abd
    (cherry picked from commit 8502b8006fdf03d2bc634f53490200f853474867)

diff --git a/sfx2/Library_sfx.mk b/sfx2/Library_sfx.mk
index 03775fd..aefe3a2 100644
--- a/sfx2/Library_sfx.mk
+++ b/sfx2/Library_sfx.mk
@@ -233,6 +233,8 @@ $(eval $(call gb_Library_add_exception_objects,sfx,\
     sfx2/source/sidebar/SidebarController \
     sfx2/source/sidebar/SidebarPanelBase \
     sfx2/source/sidebar/SidebarToolBox \
+    sfx2/source/sidebar/Accessible \
+    sfx2/source/sidebar/AccessibleTitleBar \
     sfx2/source/sidebar/AsynchronousCall \
     sfx2/source/sidebar/CommandInfoProvider \
     sfx2/source/sidebar/Context \
diff --git a/sfx2/source/sidebar/Accessible.cxx b/sfx2/source/sidebar/Accessible.cxx
new file mode 100644
index 0000000..13d52aa
--- /dev/null
+++ b/sfx2/source/sidebar/Accessible.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 "Accessible.hxx"
+
+
+using namespace css;
+using namespace cssu;
+
+
+namespace sfx2 { namespace sidebar {
+
+
+Accessible::Accessible (
+    const Reference<accessibility::XAccessibleContext>& rxContext)
+    : AccessibleInterfaceBase(m_aMutex),
+      mxContext(rxContext)
+{
+}
+
+
+
+
+Accessible::~Accessible (void)
+{
+}
+
+
+
+
+void SAL_CALL Accessible::disposing (void)
+{
+    Reference<XComponent> xComponent (mxContext, UNO_QUERY);
+    if (xComponent.is())
+        xComponent->dispose();
+}
+
+
+
+
+Reference<accessibility::XAccessibleContext> SAL_CALL Accessible::getAccessibleContext (void)
+    throw (cssu::RuntimeException)
+{
+    return mxContext;
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/Accessible.hxx b/sfx2/source/sidebar/Accessible.hxx
new file mode 100644
index 0000000..d6b8584
--- /dev/null
+++ b/sfx2/source/sidebar/Accessible.hxx
@@ -0,0 +1,70 @@
+/*
+ * 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 SFX_SIDEBAR_ACCESSIBLE_HXX
+#define SFX_SIDEBAR_ACCESSIBLE_HXX
+
+#include <boost/noncopyable.hpp>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+#include <cppuhelper/compbase1.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace
+{
+    typedef ::cppu::WeakComponentImplHelper1 <
+        css::accessibility::XAccessible
+        > AccessibleInterfaceBase;
+}
+
+namespace sfx2 { namespace sidebar {
+
+
+/** Simple implementation of the XAccessible interface.
+    Its getAccessibleContext() method returns a context object given
+    to its constructor.
+*/
+class Accessible
+    : private ::boost::noncopyable,
+      private ::cppu::BaseMutex,
+      public AccessibleInterfaceBase
+{
+public:
+    Accessible (
+        const cssu::Reference<css::accessibility::XAccessibleContext>& rxContext);
+    virtual ~Accessible (void);
+
+    virtual void SAL_CALL disposing (void);
+
+
+    // XAccessible
+    virtual cssu::Reference<css::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext (void)
+        throw (cssu::RuntimeException);
+
+private:
+    cssu::Reference<css::accessibility::XAccessibleContext> mxContext;
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/source/sidebar/AccessibleTitleBar.cxx b/sfx2/source/sidebar/AccessibleTitleBar.cxx
new file mode 100644
index 0000000..47600f0
--- /dev/null
+++ b/sfx2/source/sidebar/AccessibleTitleBar.cxx
@@ -0,0 +1,67 @@
+/*
+ * 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 "AccessibleTitleBar.hxx"
+#include "Accessible.hxx"
+#include "TitleBar.hxx"
+
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <unotools/accessiblestatesethelper.hxx>
+
+using namespace css;
+using namespace cssu;
+
+namespace sfx2 { namespace sidebar {
+
+
+Reference<accessibility::XAccessible> AccessibleTitleBar::Create (TitleBar& rTitleBar)
+{
+    rTitleBar.GetComponentInterface(sal_True);
+    VCLXWindow* pWindow = rTitleBar.GetWindowPeer();
+    if (pWindow != NULL)
+        return new Accessible(new AccessibleTitleBar(pWindow));
+    else
+        return NULL;
+}
+
+
+
+
+AccessibleTitleBar::AccessibleTitleBar (VCLXWindow* pWindow)
+    : VCLXAccessibleComponent(pWindow)
+{
+}
+
+
+
+
+AccessibleTitleBar::~AccessibleTitleBar (void)
+{
+}
+
+
+
+
+void AccessibleTitleBar::FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet)
+{
+    VCLXAccessibleComponent::FillAccessibleStateSet(rStateSet);
+    rStateSet.AddState(accessibility::AccessibleStateType::FOCUSABLE);
+}
+
+
+} } // end of namespace sfx2::sidebar
diff --git a/sfx2/source/sidebar/AccessibleTitleBar.hxx b/sfx2/source/sidebar/AccessibleTitleBar.hxx
new file mode 100644
index 0000000..ffbe8ac
--- /dev/null
+++ b/sfx2/source/sidebar/AccessibleTitleBar.hxx
@@ -0,0 +1,49 @@
+/*
+ * 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 SFX_SIDEBAR_ACCESSIBLE_TITLE_BAR_HXX
+#define SFX_SIDEBAR_ACCESSIBLE_TITLE_BAR_HXX
+
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+
+namespace css = ::com::sun::star;
+namespace cssu = ::com::sun::star::uno;
+
+namespace sfx2 { namespace sidebar {
+
+class TitleBar;
+
+class AccessibleTitleBar
+    : public VCLXAccessibleComponent
+{
+public:
+    static cssu::Reference<css::accessibility::XAccessible> Create (TitleBar& rTitleBar);
+
+protected:
+    virtual void FillAccessibleStateSet (utl::AccessibleStateSetHelper& rStateSet);
+
+private:
+    AccessibleTitleBar (VCLXWindow* pWindow);
+    virtual ~AccessibleTitleBar (void);
+};
+
+
+} } // end of namespace sfx2::sidebar
+
+#endif
diff --git a/sfx2/source/sidebar/DeckTitleBar.cxx b/sfx2/source/sidebar/DeckTitleBar.cxx
index ed7fd17..7855347 100644
--- a/sfx2/source/sidebar/DeckTitleBar.cxx
+++ b/sfx2/source/sidebar/DeckTitleBar.cxx
@@ -134,6 +134,17 @@ void DeckTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
 
 
 
+cssu::Reference<css::accessibility::XAccessible> DeckTitleBar::CreateAccessible (void)
+{
+    const ::rtl::OUString sAccessibleName(msTitle);
+    SetAccessibleName(sAccessibleName);
+    SetAccessibleDescription(sAccessibleName);
+    return TitleBar::CreateAccessible();
+}
+
+
+
+
 void DeckTitleBar::DataChanged (const DataChangedEvent& rEvent)
 {
     maToolBox.SetItemImage(
diff --git a/sfx2/source/sidebar/DeckTitleBar.hxx b/sfx2/source/sidebar/DeckTitleBar.hxx
index aab0564..bc31d98 100644
--- a/sfx2/source/sidebar/DeckTitleBar.hxx
+++ b/sfx2/source/sidebar/DeckTitleBar.hxx
@@ -45,6 +45,7 @@ protected:
     virtual sidebar::Paint GetBackgroundPaint (void);
     virtual Color GetTextColor (void);
     virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+    virtual cssu::Reference<css::accessibility::XAccessible> CreateAccessible (void);
 
 private:
     const sal_uInt16 mnCloserItemIndex;
diff --git a/sfx2/source/sidebar/PanelTitleBar.cxx b/sfx2/source/sidebar/PanelTitleBar.cxx
index 738593a..dd1b681 100644
--- a/sfx2/source/sidebar/PanelTitleBar.cxx
+++ b/sfx2/source/sidebar/PanelTitleBar.cxx
@@ -30,7 +30,6 @@
 #include <vcl/image.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 
-
 using namespace css;
 using namespace cssu;
 
@@ -50,16 +49,11 @@ PanelTitleBar::PanelTitleBar (
       mpPanel(pPanel),
       mnMenuItemIndex(1),
       mxFrame(),
-      msMoreOptionsCommand()
+      msMoreOptionsCommand(),
+      msAccessibleNamePrefix(String(SfxResId(SFX_STR_SIDEBAR_ACCESSIBILITY_PANEL_PREFIX)))
 {
     OSL_ASSERT(mpPanel != NULL);
 
-    const ::rtl::OUString sAccessibleName(
-        String(SfxResId(SFX_STR_SIDEBAR_ACCESSIBILITY_PANEL_PREFIX))
-            + rsTitle);
-    SetAccessibleName(sAccessibleName);
-    SetAccessibleDescription(sAccessibleName);
-
 #ifdef DEBUG
     SetText(A2S("PanelTitleBar"));
 #endif
@@ -190,6 +184,17 @@ void PanelTitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
 
 
 
+Reference<accessibility::XAccessible> PanelTitleBar::CreateAccessible (void)
+{
+    const ::rtl::OUString sAccessibleName(msAccessibleNamePrefix + msTitle);
+    SetAccessibleName(sAccessibleName);
+    SetAccessibleDescription(sAccessibleName);
+    return TitleBar::CreateAccessible();
+}
+
+
+
+
 void PanelTitleBar::MouseButtonDown (const MouseEvent& rMouseEvent)
 {
     if (rMouseEvent.IsLeft())
diff --git a/sfx2/source/sidebar/PanelTitleBar.hxx b/sfx2/source/sidebar/PanelTitleBar.hxx
index f47f86e..6044e27 100644
--- a/sfx2/source/sidebar/PanelTitleBar.hxx
+++ b/sfx2/source/sidebar/PanelTitleBar.hxx
@@ -52,6 +52,7 @@ protected:
     virtual sidebar::Paint GetBackgroundPaint (void);
     virtual Color GetTextColor (void);
     virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+    virtual cssu::Reference<css::accessibility::XAccessible> CreateAccessible (void);
 
 private:
     bool mbIsLeftButtonDown;
@@ -59,6 +60,7 @@ private:
     const sal_uInt16 mnMenuItemIndex;
     cssu::Reference<css::frame::XFrame> mxFrame;
     ::rtl::OUString msMoreOptionsCommand;
+    ::rtl::OUString msAccessibleNamePrefix;
 };
 
 
diff --git a/sfx2/source/sidebar/TitleBar.cxx b/sfx2/source/sidebar/TitleBar.cxx
index bab9631..e45a6fb 100644
--- a/sfx2/source/sidebar/TitleBar.cxx
+++ b/sfx2/source/sidebar/TitleBar.cxx
@@ -18,11 +18,16 @@
 
 #include "TitleBar.hxx"
 #include "Paint.hxx"
+#include "Accessible.hxx"
+#include "AccessibleTitleBar.hxx"
 
 #include <tools/svborder.hxx>
 #include <vcl/gradient.hxx>
 #include <vcl/lineinfo.hxx>
 
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+
+
 namespace
 {
     const static sal_Int32 gnLeftIconSpace (3);
@@ -89,8 +94,7 @@ void TitleBar::Paint (const Rectangle& rUpdateArea)
     PaintDecoration(aTitleBarBox);
     const Rectangle aTitleBox (GetTitleArea(aTitleBarBox));
     PaintTitle(aTitleBox);
-    if (HasFocus())
-        PaintFocus(aTitleBox);
+    PaintFocus(aTitleBox);
 }
 
 
@@ -149,6 +153,15 @@ void TitleBar::HandleToolBoxItemClick (const sal_uInt16 nItemIndex)
 
 
 
+cssu::Reference<css::accessibility::XAccessible> TitleBar::CreateAccessible (void)
+{
+    SetAccessibleRole(css::accessibility::AccessibleRole::PANEL);
+    return AccessibleTitleBar::Create(*this);
+}
+
+
+
+
 void TitleBar::PaintTitle (const Rectangle& rTitleBox)
 {
     Push(PUSH_FONT | PUSH_TEXTCOLOR);
@@ -186,7 +199,7 @@ void TitleBar::PaintTitle (const Rectangle& rTitleBox)
 
 void TitleBar::PaintFocus (const Rectangle& rFocusBox)
 {
-    Push(PUSH_FONT | PUSH_TEXTCOLOR | PUSH_LINECOLOR | PUSH_FILLCOLOR);
+    Push(PUSH_FONT | PUSH_TEXTCOLOR);
 
     Font aFont(GetFont());
     aFont.SetWeight(WEIGHT_BOLD);
@@ -203,15 +216,10 @@ void TitleBar::PaintFocus (const Rectangle& rFocusBox)
         aTextBox.Right() + 2,
         aTextBox.Bottom() + 2);
 
-    LineInfo aDottedStyle (LINE_DASH);
-    aDottedStyle.SetDashCount(0);
-    aDottedStyle.SetDotCount(1);
-    aDottedStyle.SetDotLen(1);
-    aDottedStyle.SetDistance(1);
-
-    SetFillColor();
-    SetLineColor(COL_BLACK);
-    DrawPolyLine(Polygon(aLargerTextBox), aDottedStyle);
+    if (HasFocus())
+        Window::ShowFocus(aLargerTextBox);
+    else
+        Window::HideFocus();
 
     Pop();
 }
diff --git a/sfx2/source/sidebar/TitleBar.hxx b/sfx2/source/sidebar/TitleBar.hxx
index 229d3b7..36c31a6 100644
--- a/sfx2/source/sidebar/TitleBar.hxx
+++ b/sfx2/source/sidebar/TitleBar.hxx
@@ -20,7 +20,7 @@
 
 #include "Paint.hxx"
 
-#include <vcl/window.hxx>
+#include <vcl/fixed.hxx>
 #include "sfx2/sidebar/SidebarToolBox.hxx"
 
 
@@ -53,6 +53,7 @@ public:
 
 protected:
     SidebarToolBox maToolBox;
+    ::rtl::OUString msTitle;
 
     virtual Rectangle GetTitleArea (const Rectangle& rTitleBarBox) = 0;
     virtual void PaintDecoration (const Rectangle& rTitleBarBox) = 0;
@@ -60,9 +61,9 @@ protected:
     virtual sidebar::Paint GetBackgroundPaint (void) = 0;
     virtual Color GetTextColor (void) = 0;
     virtual void HandleToolBoxItemClick (const sal_uInt16 nItemIndex);
+    virtual cssu::Reference<css::accessibility::XAccessible> CreateAccessible (void);
 
 private:
-    ::rtl::OUString msTitle;
     Image maIcon;
 
     void PaintTitle (const Rectangle& rTitleBox);


More information about the Libreoffice-commits mailing list