You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2013/02/27 11:13:30 UTC

svn commit: r1450707 - in /openoffice/branches/sidebar/main: officecfg/registry/data/org/openoffice/Office/UI/ sfx2/source/sidebar/ svx/ svx/source/sidebar/

Author: af
Date: Wed Feb 27 10:13:30 2013
New Revision: 1450707

URL: http://svn.apache.org/r1450707
Log:
i121420: Added a color panel that displays StyleSettings colors (for debugging).

Added:
    openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.cxx
    openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.hxx
Modified:
    openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.hrc
    openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.src
    openoffice/branches/sidebar/main/svx/Library_svx.mk
    openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx

Modified: openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/officecfg/registry/data/org/openoffice/Office/UI/Sidebar.xcu?rev=1450707&r1=1450706&r2=1450707&view=diff
==============================================================================
Binary files - no diff available.

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.hrc
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.hrc?rev=1450707&r1=1450706&r2=1450707&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.hrc (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.hrc Wed Feb 27 10:13:30 2013
@@ -37,5 +37,6 @@
 #define IMAGE_SIDEBAR_TABBAR_MASTERS_SD          11
 #define IMAGE_SIDEBAR_TABBAR_CUSTOM_ANIMATION_SD 12
 #define IMAGE_SIDEBAR_TABBAR_SLIDE_TRANSITION_SD 13
-#define STRING_CUSTOMIZATION                     14
-#define STRING_RESTORE                           15
+#define IMAGE_SIDEBAR_TABBAR_GALLERY_SD          14
+#define STRING_CUSTOMIZATION                     15
+#define STRING_RESTORE                           16

Modified: openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.src
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.src?rev=1450707&r1=1450706&r2=1450707&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.src (original)
+++ openoffice/branches/sidebar/main/sfx2/source/sidebar/Sidebar.src Wed Feb 27 10:13:30 2013
@@ -84,6 +84,10 @@ Resource RID_SIDEBAR_RESOURCE
     {
         ImageBitmap = Bitmap { File = "symphony/hpaneldock03_sd.png" ;};
     };
+    Image IMAGE_SIDEBAR_TABBAR_GALLERY_SD
+    {
+        ImageBitmap = Bitmap { File = "symphony/hpaneldock04_sd.png" ;};
+    };
 
     String STRING_CUSTOMIZATION
     {

Modified: openoffice/branches/sidebar/main/svx/Library_svx.mk
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/Library_svx.mk?rev=1450707&r1=1450706&r2=1450707&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/Library_svx.mk (original)
+++ openoffice/branches/sidebar/main/svx/Library_svx.mk Wed Feb 27 10:13:30 2013
@@ -171,6 +171,7 @@ $(eval $(call gb_Library_add_exception_o
     svx/source/mnuctrls/SmartTagCtl \
     svx/source/sidebar/ContextChangeEventMultiplexer \
     svx/source/sidebar/PanelFactory \
+    svx/source/sidebar/ColorPanel \
     svx/source/sidebar/text/SvxSBFontNameBox \
     svx/source/sidebar/text/TextPropertyPanel \
     svx/source/sidebar/geometry/AreaPropertyPanel \

Added: openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.cxx?rev=1450707&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.cxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.cxx Wed Feb 27 10:13:30 2013
@@ -0,0 +1,233 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+#include "precompiled_svx.hxx"
+
+#include "ColorPanel.hxx"
+
+#include <vcl/image.hxx>
+#include <vcl/svapp.hxx>
+
+namespace svx { namespace sidebar {
+
+ColorPanel::ColorPanel (::Window* pParent)
+    : ValueSet(pParent),
+      mnPreferredColumnCount(2)
+{
+    WinBits aStyle = 
+        WB_ITEMBORDER 
+        | WB_DOUBLEBORDER 
+        | WB_NAMEFIELD 
+        | WB_FLATVALUESET
+        | WB_TABSTOP
+        | WB_VSCROLL;
+
+    SetStyle(GetStyle() | aStyle); 
+    SetExtraSpacing(2);
+
+    Fill ();
+    Show();
+}
+
+
+
+
+ColorPanel::~ColorPanel (void)
+{
+}
+
+
+
+
+sal_Int32 ColorPanel::GetPreferredHeight (sal_Int32 nWidth)
+{
+    sal_Int32 nPreferredHeight = 0;
+    if (GetItemCount()>0)
+    {
+        Image aImage = GetItemImage(GetItemId(0));
+        Size aItemSize = CalcItemSizePixel (aImage.GetSizePixel());
+        if (nWidth>0 && aItemSize.Width()>0)
+        {
+            int nColumnCount = nWidth / aItemSize.Width();
+            if (nColumnCount <= 0)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+            int nRowCount = (GetItemCount() + nColumnCount-1) 
+                / nColumnCount;
+            nPreferredHeight = nRowCount * aItemSize.Height();
+        }
+    }
+    return nPreferredHeight;
+}
+
+
+
+
+void ColorPanel::Resize (void)
+{
+    ::Window::Resize();
+    Size aWindowSize = GetOutputSizePixel();
+    SetPosSizePixel(Point(0,0), aWindowSize);
+    if (IsVisible() && aWindowSize.Width() > 0)
+    {
+        // Calculate the number of rows and columns.
+        if (GetItemCount() > 0)
+        {
+            Image aImage = GetItemImage(GetItemId(0));
+            Size aItemSize = CalcItemSizePixel (
+                aImage.GetSizePixel());
+            int nColumnCount = aWindowSize.Width() / 30;
+            if (nColumnCount < 1)
+                nColumnCount = 1;
+            else if (nColumnCount > 4)
+                nColumnCount = 4;
+
+            sal_uInt16 nRowCount = (sal_uInt16)CalculateRowCount(aItemSize, nColumnCount);
+            
+            SetColCount((sal_uInt16)nColumnCount);
+            SetLineCount(nRowCount);
+        }
+    }
+
+}
+
+
+
+
+int ColorPanel::CalculateRowCount (const Size&, int nColumnCount)
+{
+    int nRowCount = 0;
+
+    if (GetItemCount()>0 && nColumnCount>0)
+    {
+        nRowCount = GetOutputSizePixel().Height() / 30;
+        if (nRowCount < 1)
+            nRowCount = 1;
+    }
+
+    return nRowCount;
+}
+
+
+
+
+void ColorPanel::DataChanged (const DataChangedEvent& rEvent)
+{
+    Fill();
+}
+
+
+
+
+void ColorPanel::Fill (void)
+{
+    const StyleSettings& rSettings (
+        Application::GetSettings().GetStyleSettings());
+    Clear();
+    SetItemWidth (30);
+    SetItemHeight (30);
+    sal_uInt16 i = 0;
+    InsertItem (++i, rSettings.GetFaceColor());
+    SetItemText (i, String::CreateFromAscii("FaceColor"));
+    InsertItem (++i, rSettings.GetCheckedColor());
+    SetItemText (i, String::CreateFromAscii("CheckedColor"));
+    InsertItem (++i, rSettings.GetLightColor());
+    SetItemText (i, String::CreateFromAscii("LightColor"));
+    InsertItem (++i, rSettings.GetLightBorderColor());
+    SetItemText (i, String::CreateFromAscii("LightBorderColor"));
+    InsertItem (++i, rSettings.GetShadowColor());
+    SetItemText (i, String::CreateFromAscii("ShadowColor"));
+    InsertItem (++i, rSettings.GetDarkShadowColor());
+    SetItemText (i, String::CreateFromAscii("DarkShadowColor"));
+    InsertItem (++i, rSettings.GetButtonTextColor());
+    SetItemText (i, String::CreateFromAscii("ButtonTextColor"));
+    InsertItem (++i, rSettings.GetRadioCheckTextColor());
+    SetItemText (i, String::CreateFromAscii("RadioCheckTextColor"));
+    InsertItem (++i, rSettings.GetGroupTextColor());
+    SetItemText (i, String::CreateFromAscii("GroupTextColor"));
+    InsertItem (++i, rSettings.GetLabelTextColor());
+    SetItemText (i, String::CreateFromAscii("LabelTextColor"));
+    InsertItem (++i, rSettings.GetInfoTextColor());
+    SetItemText (i, String::CreateFromAscii("InfoTextColor"));
+    InsertItem (++i, rSettings.GetWindowColor());
+    SetItemText (i, String::CreateFromAscii("WindowColor"));
+    InsertItem (++i, rSettings.GetWindowTextColor());
+    SetItemText (i, String::CreateFromAscii("WindowTextColor"));
+    InsertItem (++i, rSettings.GetDialogColor());
+    SetItemText (i, String::CreateFromAscii("DialogColor"));
+    InsertItem (++i, rSettings.GetDialogTextColor());
+    SetItemText (i, String::CreateFromAscii("DialogTextColor"));
+    InsertItem (++i, rSettings.GetWorkspaceColor());
+    SetItemText (i, String::CreateFromAscii("WorkspaceColor"));
+    InsertItem (++i, rSettings.GetFieldColor());
+    SetItemText (i, String::CreateFromAscii("FieldColor"));
+    InsertItem (++i, rSettings.GetFieldTextColor());
+    SetItemText (i, String::CreateFromAscii("FieldTextColor"));
+    InsertItem (++i, rSettings.GetActiveColor());
+    SetItemText (i, String::CreateFromAscii("ActiveColor"));
+    InsertItem (++i, rSettings.GetActiveColor2());
+    SetItemText (i, String::CreateFromAscii("ActiveColor2"));
+    InsertItem (++i, rSettings.GetActiveTextColor());
+    SetItemText (i, String::CreateFromAscii("ActiveTextColor"));
+    InsertItem (++i, rSettings.GetActiveBorderColor());
+    SetItemText (i, String::CreateFromAscii("ActiveBorderColor"));
+    InsertItem (++i, rSettings.GetDeactiveColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveColor"));
+    InsertItem (++i, rSettings.GetDeactiveColor2());
+    SetItemText (i, String::CreateFromAscii("DeactiveColor2"));
+    InsertItem (++i, rSettings.GetDeactiveTextColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveTextColor"));
+    InsertItem (++i, rSettings.GetDeactiveBorderColor());
+    SetItemText (i, String::CreateFromAscii("DeactiveBorderColor"));
+    InsertItem (++i, rSettings.GetHighlightColor());
+    SetItemText (i, String::CreateFromAscii("HighlightColor"));
+    InsertItem (++i, rSettings.GetHighlightTextColor());
+    SetItemText (i, String::CreateFromAscii("HighlightTextColor"));
+    InsertItem (++i, rSettings.GetDisableColor());
+    SetItemText (i, String::CreateFromAscii("DisableColor"));
+    InsertItem (++i, rSettings.GetHelpColor());
+    SetItemText (i, String::CreateFromAscii("HelpColor"));
+    InsertItem (++i, rSettings.GetHelpTextColor());
+    SetItemText (i, String::CreateFromAscii("HelpTextColor"));
+    InsertItem (++i, rSettings.GetMenuColor());
+    SetItemText (i, String::CreateFromAscii("MenuColor"));
+    InsertItem (++i, rSettings.GetMenuBarColor());
+    SetItemText (i, String::CreateFromAscii("MenuBarColor"));
+    InsertItem (++i, rSettings.GetMenuBorderColor());
+    SetItemText (i, String::CreateFromAscii("MenuBorderColor"));
+    InsertItem (++i, rSettings.GetMenuTextColor());
+    SetItemText (i, String::CreateFromAscii("MenuTextColor"));
+    InsertItem (++i, rSettings.GetMenuHighlightColor());
+    SetItemText (i, String::CreateFromAscii("MenuHighlightColor"));
+    InsertItem (++i, rSettings.GetMenuHighlightTextColor());
+    SetItemText (i, String::CreateFromAscii("MenuHighlightTextColor"));
+    InsertItem (++i, rSettings.GetLinkColor());
+    SetItemText (i, String::CreateFromAscii("LinkColor"));
+    InsertItem (++i, rSettings.GetVisitedLinkColor());
+    SetItemText (i, String::CreateFromAscii("VisitedLinkColor"));
+    InsertItem (++i, rSettings.GetHighlightLinkColor());
+    SetItemText (i, String::CreateFromAscii("HighlightLinkColor"));
+    InsertItem (++i, rSettings.GetFontColor());
+    SetItemText (i, String::CreateFromAscii("FontColor"));
+}
+
+} } // end of namespace ::svx::sidebar

Added: openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.hxx?rev=1450707&view=auto
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.hxx (added)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/ColorPanel.hxx Wed Feb 27 10:13:30 2013
@@ -0,0 +1,61 @@
+/**************************************************************
+ * 
+ * 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.
+ * 
+ *************************************************************/
+
+#ifndef SVX_SIDEBAR_COLOR_PANEL_HXX
+#define SVX_SIDEBAR_COLOR_PANEL_HXX
+
+#include <svtools/valueset.hxx>
+#include <vcl/window.hxx>
+
+
+namespace svx { namespace sidebar {
+
+
+/** This demo panel shows the colors that are available from the
+    StyleSettings.
+*/
+class ColorPanel
+    : public ValueSet
+{
+public:
+    ColorPanel (::Window* pParent);
+    virtual ~ColorPanel (void);
+
+    // From ::Window
+    virtual void Resize (void);
+    virtual void DataChanged (const DataChangedEvent& rEvent);
+
+private:
+    int mnPreferredColumnCount;
+
+    /** Depending on the given number of columns and the item size
+        calculate the number of rows that are necessary to display all
+        items.
+    */
+    int CalculateRowCount (const Size& rItemSize, int nColumnCount);
+    void Fill (void);
+
+    sal_Int32 GetPreferredHeight (sal_Int32 nWidth);
+};
+
+} } // end of namespace ::svx::sidebar
+
+#endif

Modified: openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx?rev=1450707&r1=1450706&r2=1450707&view=diff
==============================================================================
--- openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx (original)
+++ openoffice/branches/sidebar/main/svx/source/sidebar/PanelFactory.cxx Wed Feb 27 10:13:30 2013
@@ -27,6 +27,7 @@
 #include "geometry/LinePropertyPanel.hxx"
 #include "geometry/TransformationPropertyPanel.hxx"
 #include "gallery/GalleryControl.hxx"
+#include "ColorPanel.hxx"
 #include <sfx2/sidebar/SidebarPanelBase.hxx>
 #include <sfx2/sfxbasecontroller.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
@@ -190,6 +191,17 @@ Reference<ui::XUIElement> SAL_CALL Panel
             ::boost::function<void(void)>(),
             ui::LayoutSize(300,-1,400));
     }
+    else if (DoesResourceEndWith("/Debug_ColorPanel"))
+    {
+        ColorPanel* pColorPanel = new ColorPanel(
+            pParentWindow);
+        xElement = sfx2::sidebar::SidebarPanelBase::Create(
+            rsResourceURL,
+            xFrame,
+            pColorPanel,
+            ::boost::function<void(void)>(),
+            ui::LayoutSize(300,-1,400));
+    }
 #undef DoesResourceEndWith
 
     return xElement;