Author: af
Date: Tue Apr 23 15:08:04 2013
New Revision: 1471003

URL: http://svn.apache.org/r1471003
Log:
122086: Show icons in decks and titles (optionally).

Modified:
    
openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
    openoffice/trunk/main/sfx2/source/sidebar/Deck.hxx
    openoffice/trunk/main/sfx2/source/sidebar/DeckDescriptor.hxx
    openoffice/trunk/main/sfx2/source/sidebar/PanelDescriptor.hxx
    openoffice/trunk/main/sfx2/source/sidebar/ResourceManager.cxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx
    openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx
    openoffice/trunk/main/sfx2/source/sidebar/TitleBar.cxx
    openoffice/trunk/main/sfx2/source/sidebar/TitleBar.hxx

Modified: 
openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- 
openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
 (original)
+++ 
openoffice/trunk/main/officecfg/registry/schema/org/openoffice/Office/UI/Sidebar.xcs
 Tue Apr 23 15:08:04 2013
@@ -58,6 +58,20 @@
         </info>
         <value></value>
       </prop>
+      <prop oor:name="TitleBarIconURL" oor:type="xs:string">
+        <info>
+          <desc>This icon is displayed in the title bar of the deck.
+          Any URL scheme supported by the com.sun.star.graphic.GraphicProvider 
service is suitable here.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="HighContrastTitleBarIconURL" oor:type="xs:string">
+        <info>
+          <desc>This icon is displayed in the title bar of the deck when high 
contrast mode is active.
+          Any URL scheme supported by the com.sun.star.graphic.GraphicProvider 
service is suitable here.</desc>
+        </info>
+        <value></value>
+      </prop>
       <prop oor:name="HelpURL" oor:type="xs:string">
         <info>
           <desc>Help about the sidebar deck.</desc>
@@ -147,6 +161,20 @@
         </info>
         <value></value>
       </prop>
+      <prop oor:name="TitleBarIconURL" oor:type="xs:string">
+        <info>
+          <desc>This icon is displayed in the title bar of the panel.
+          Any URL scheme supported by the com.sun.star.graphic.GraphicProvider 
service is suitable here.</desc>
+        </info>
+        <value></value>
+      </prop>
+      <prop oor:name="HighContrastTitleBarIconURL" oor:type="xs:string">
+        <info>
+          <desc>This icon is displayed in the title bar of the panel when high 
contrast mode is active.
+          Any URL scheme supported by the com.sun.star.graphic.GraphicProvider 
service is suitable here.</desc>
+        </info>
+        <value></value>
+      </prop>
       <prop oor:name="HelpURL" oor:type="xs:string">
         <info>
           <desc>Help about the sidebar content panel.</desc>

Modified: openoffice/trunk/main/sfx2/source/sidebar/Deck.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/Deck.hxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/Deck.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/Deck.hxx Tue Apr 23 15:08:04 2013
@@ -97,6 +97,8 @@ private:
     ::boost::scoped_ptr<ScrollBar> mpVerticalScrollBar;
     
     DECL_LINK(HandleVerticalScrollBarChange,void*);
+
+    
 };
 
 

Modified: openoffice/trunk/main/sfx2/source/sidebar/DeckDescriptor.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/DeckDescriptor.hxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/DeckDescriptor.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/DeckDescriptor.hxx Tue Apr 23 
15:08:04 2013
@@ -36,6 +36,8 @@ public:
     ::rtl::OUString msId;
     ::rtl::OUString msIconURL;
     ::rtl::OUString msHighContrastIconURL;
+    ::rtl::OUString msTitleBarIconURL;
+    ::rtl::OUString msHighContrastTitleBarIconURL;
     ::rtl::OUString msHelpURL;
     ::rtl::OUString msHelpText;
     ContextList maContextList;

Modified: openoffice/trunk/main/sfx2/source/sidebar/PanelDescriptor.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/PanelDescriptor.hxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/PanelDescriptor.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/PanelDescriptor.hxx Tue Apr 23 
15:08:04 2013
@@ -36,6 +36,8 @@ public:
     sal_Bool mbIsTitleBarOptional;
     ::rtl::OUString msId;
     ::rtl::OUString msDeckId;
+    ::rtl::OUString msTitleBarIconURL;
+    ::rtl::OUString msHighContrastTitleBarIconURL;
     ::rtl::OUString msHelpURL;
     ContextList maContextList;
     ::rtl::OUString msImplementationURL;

Modified: openoffice/trunk/main/sfx2/source/sidebar/ResourceManager.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/ResourceManager.cxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/ResourceManager.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/ResourceManager.cxx Tue Apr 23 
15:08:04 2013
@@ -279,6 +279,10 @@ void ResourceManager::ReadDeckList (void
             aDeckNode.getNodeValue("IconURL"));
         rDeckDescriptor.msHighContrastIconURL = ::comphelper::getString(
             aDeckNode.getNodeValue("HighContrastIconURL"));
+        rDeckDescriptor.msTitleBarIconURL = ::comphelper::getString(
+            aDeckNode.getNodeValue("TitleBarIconURL"));
+        rDeckDescriptor.msHighContrastTitleBarIconURL = 
::comphelper::getString(
+            aDeckNode.getNodeValue("HighContrastTitleBarIconURL"));
         rDeckDescriptor.msHelpURL = ::comphelper::getString(
             aDeckNode.getNodeValue("HelpURL"));
         rDeckDescriptor.msHelpText = rDeckDescriptor.msTitle;
@@ -331,6 +335,10 @@ void ResourceManager::ReadPanelList (voi
             aPanelNode.getNodeValue("Id"));
         rPanelDescriptor.msDeckId = ::comphelper::getString(
             aPanelNode.getNodeValue("DeckId"));
+        rPanelDescriptor.msTitleBarIconURL = ::comphelper::getString(
+            aPanelNode.getNodeValue("TitleBarIconURL"));
+        rPanelDescriptor.msHighContrastTitleBarIconURL = 
::comphelper::getString(
+            aPanelNode.getNodeValue("HighContrastTitleBarIconURL"));
         rPanelDescriptor.msHelpURL = ::comphelper::getString(
             aPanelNode.getNodeValue("HelpURL"));
         rPanelDescriptor.msImplementationURL = ::comphelper::getString(

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarController.cxx Tue Apr 23 
15:08:04 2013
@@ -495,6 +495,7 @@ void SidebarController::SwitchToDeck (
     // buttons.
     maFocusManager.SetPanels(aNewPanels);
     mpTabBar->UpdateFocusManager(maFocusManager);
+    UpdateTitleBarIcons();
 }
 
 
@@ -650,6 +651,7 @@ IMPL_LINK(SidebarController, WindowEvent
                 // Force an update of deck and tab bar to reflect
                 // changes in theme (high contrast mode).
                 Theme::HandleDataChange();
+                UpdateTitleBarIcons();
                 mpParentWindow->Invalidate();
                 break;
                 
@@ -939,4 +941,48 @@ void SidebarController::RestrictWidth (v
 }
 
 
+
+
+void SidebarController::UpdateTitleBarIcons (void)
+{
+    if ( ! mpCurrentDeck)
+        return;
+    
+    const bool bIsHighContrastModeActive (Theme::IsHighContrastMode());
+    const ResourceManager& rResourceManager (ResourceManager::Instance());
+    
+    // Update the deck icon.
+    const DeckDescriptor* pDeckDescriptor = 
rResourceManager.GetDeckDescriptor(mpCurrentDeck->GetId());
+    if (pDeckDescriptor != NULL && mpCurrentDeck->GetTitleBar())
+    {
+        const OUString sIconURL(
+            bIsHighContrastModeActive
+                ? pDeckDescriptor->msHighContrastTitleBarIconURL
+                : pDeckDescriptor->msTitleBarIconURL);
+        mpCurrentDeck->GetTitleBar()->SetIcon(Tools::GetImage(sIconURL, 
mxFrame));
+    }
+
+    // Update the panel icons.
+    const SharedPanelContainer& rPanels (mpCurrentDeck->GetPanels());
+    for (SharedPanelContainer::const_iterator
+             iPanel(rPanels.begin()), iEnd(rPanels.end());
+             iPanel!=iEnd;
+             ++iPanel)
+    {
+        if ( ! *iPanel)
+            continue;
+        if ((*iPanel)->GetTitleBar() == NULL)
+            continue;
+        const PanelDescriptor* pPanelDescriptor = 
rResourceManager.GetPanelDescriptor((*iPanel)->GetId());
+        if (pPanelDescriptor == NULL)
+            continue;
+        const OUString sIconURL (
+            bIsHighContrastModeActive
+               ? pPanelDescriptor->msHighContrastTitleBarIconURL
+               : pPanelDescriptor->msTitleBarIconURL);
+        (*iPanel)->GetTitleBar()->SetIcon(Tools::GetImage(sIconURL, mxFrame));
+    }
+}
+
+
 } } // end of namespace sfx2::sidebar

Modified: openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/SidebarController.hxx Tue Apr 23 
15:08:04 2013
@@ -164,6 +164,12 @@ private:
     sal_Int32 SetChildWindowWidth (const sal_Int32 nNewWidth);
 
     void RestrictWidth (void);
+
+    /** Update the icons displayed in the title bars of the deck and
+        the panels.  This is called once when a deck is created and
+        every time when a data change event is processed.
+    */
+    void UpdateTitleBarIcons (void);
     
     virtual void SAL_CALL disposing (void);
 };

Modified: openoffice/trunk/main/sfx2/source/sidebar/TitleBar.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/TitleBar.cxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/TitleBar.cxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/TitleBar.cxx Tue Apr 23 15:08:04 
2013
@@ -30,6 +30,11 @@
 
 ToolbarValue::~ToolbarValue (void) {}
 
+namespace
+{
+    const static sal_Int32 gnLeftIconSpace (3);
+    const static sal_Int32 gnRightIconSpace (3);
+}
 
 namespace sfx2 { namespace sidebar {
 
@@ -39,10 +44,11 @@ TitleBar::TitleBar (
     const sidebar::Paint& rInitialBackgroundPaint)
     : Window(pParentWindow),
       maToolBox(this),
-      msTitle(rsTitle)
+      msTitle(rsTitle),
+      maIcon()
 {
     SetBackground(rInitialBackgroundPaint.GetWallpaper());
-
+    
     maToolBox.SetSelectHdl(LINK(this, TitleBar, SelectionHandler));
 }
 
@@ -65,6 +71,15 @@ void TitleBar::SetTitle (const ::rtl::OU
 
 
 
+void TitleBar::SetIcon (const Image& rIcon)
+{
+    maIcon = rIcon;
+    Invalidate();
+}
+
+
+
+
 void TitleBar::Paint (const Rectangle& rUpdateArea)
 {
     (void)rUpdateArea;
@@ -137,6 +152,20 @@ void TitleBar::PaintTitle (const Rectang
 {
     Push(PUSH_FONT | PUSH_TEXTCOLOR);
 
+    Rectangle aTitleBox (rTitleBox);
+    
+    // When there is an icon then paint it at the left of the given
+    // box.
+    if ( !! maIcon)
+    {
+        DrawImage(
+            Point(
+                aTitleBox.Left() + gnLeftIconSpace,
+                aTitleBox.Top() + 
(aTitleBox.GetHeight()-maIcon.GetSizePixel().Height())/2),
+            maIcon);
+        aTitleBox.Left() += gnLeftIconSpace + maIcon.GetSizePixel().Width() + 
gnRightIconSpace;
+    }
+
     Font aFont(GetFont());
     aFont.SetWeight(WEIGHT_BOLD);
     SetFont(aFont);
@@ -144,7 +173,7 @@ void TitleBar::PaintTitle (const Rectang
     // Paint title bar text.
     SetTextColor(GetTextColor());
     DrawText(
-        rTitleBox,
+        aTitleBox,
         msTitle,
         TEXT_DRAW_LEFT | TEXT_DRAW_VCENTER);
 

Modified: openoffice/trunk/main/sfx2/source/sidebar/TitleBar.hxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/sfx2/source/sidebar/TitleBar.hxx?rev=1471003&r1=1471002&r2=1471003&view=diff
==============================================================================
--- openoffice/trunk/main/sfx2/source/sidebar/TitleBar.hxx (original)
+++ openoffice/trunk/main/sfx2/source/sidebar/TitleBar.hxx Tue Apr 23 15:08:04 
2013
@@ -41,6 +41,7 @@ public:
     virtual ~TitleBar (void);
 
     void SetTitle (const ::rtl::OUString& rsTitle);
+    void SetIcon (const Image& rIcon);
 
     virtual void Paint (const Rectangle& rUpdateArea);
     virtual void DataChanged (const DataChangedEvent& rEvent);
@@ -65,7 +66,8 @@ protected:
     
 private:
     ::rtl::OUString msTitle;
-
+    Image maIcon;
+    
     void PaintTitle (const Rectangle& rTitleBox);
     DECL_LINK(SelectionHandler, ToolBox*);
 };


Reply via email to