[Libreoffice-commits] core.git: sc/source sc/uiconfig

Rishabh Kumar kris.kr296 at gmail.com
Wed Jul 29 03:22:34 PDT 2015


 sc/source/ui/sidebar/AlignmentPropertyPanel.cxx |   88 +++++++++++++++-
 sc/source/ui/sidebar/AlignmentPropertyPanel.hxx |   10 +
 sc/source/ui/view/formatsh.cxx                  |    1 
 sc/uiconfig/scalc/ui/sidebaralignment.ui        |  131 ++++++++++++++++++++----
 4 files changed, 210 insertions(+), 20 deletions(-)

New commits:
commit b763f33f14ca7433370512a0d12307f2ff01e5d6
Author: Rishabh Kumar <kris.kr296 at gmail.com>
Date:   Thu Jul 23 04:03:17 2015 +0530

    tdf#91802: Add reference edge to text orientation
    
    Addition of reference edge and vertically stacked checkbox to
    the Alignment sidebar tab in Calc
    
    Change-Id: I62ba4145a33cf637d1d5f1f08b3f3f01e4165571

diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
index d572ffd..66c5fc9 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx
@@ -21,9 +21,11 @@
 #include <editeng/justifyitem.hxx>
 #include "sc.hrc"
 #include "scresid.hxx"
+#include "scitems.hxx"
 #include <sfx2/bindings.hxx>
 #include <sfx2/dispatch.hxx>
 #include <svx/algitem.hxx>
+#include <svx/rotmodit.hxx>
 #include <svx/dlgutil.hxx>
 #include <vcl/toolbox.hxx>
 #include <svx/sidebar/SidebarDialControl.hxx>
@@ -45,6 +47,8 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
       maMergeCellControl(FID_MERGE_TOGGLE, *pBindings, *this),
       maWrapTextControl(SID_ATTR_ALIGN_LINEBREAK, *pBindings, *this),
       maAngleControl(SID_ATTR_ALIGN_DEGREES, *pBindings, *this),
+      maVrtStackControl(SID_ATTR_ALIGN_STACKED, *pBindings, *this),
+      maRefEdgeControl(SID_ATTR_ALIGN_LOCKPOS, *pBindings, *this),
       mbMultiDisable(false),
       mxFrame(rxFrame),
       maContext(),
@@ -56,6 +60,11 @@ AlignmentPropertyPanel::AlignmentPropertyPanel(
     get(mpCBXMergeCell, "mergecells");
     get(mpFtRotate, "orientationlabel");
     get(mpMtrAngle, "orientationdegrees");
+    get(mpRefEdgeBottom, "bottom");
+    get(mpRefEdgeTop, "top");
+    get(mpRefEdgeStd, "standard");
+    get(mpCBStacked, "stacked");
+    get(mpTextOrientBox , "textorientbox");
 
     Initialize();
 
@@ -76,12 +85,19 @@ void AlignmentPropertyPanel::dispose()
     mpCBXMergeCell.clear();
     mpFtRotate.clear();
     mpMtrAngle.clear();
+    mpCBStacked.clear();
+    mpRefEdgeBottom.clear();
+    mpRefEdgeTop.clear();
+    mpRefEdgeStd.clear();
+    mpTextOrientBox.clear();
 
     maAlignHorControl.dispose();
     maLeftIndentControl.dispose();
     maMergeCellControl.dispose();
     maWrapTextControl.dispose();
     maAngleControl.dispose();
+    maVrtStackControl.dispose();
+    maRefEdgeControl.dispose();
 
     PanelLayout::dispose();
 }
@@ -100,14 +116,16 @@ void AlignmentPropertyPanel::Initialize()
     aLink = LINK(this, AlignmentPropertyPanel, CBOXWrapTextClkHdl);
     mpCBXWrapText->SetClickHdl ( aLink );
 
-    //rotation control
-
     //rotation
     mpMtrAngle->SetAccessibleName(OUString( "Text Orientation"));   //wj acc
     mpMtrAngle->SetModifyHdl(LINK( this, AlignmentPropertyPanel, AngleModifiedHdl));
     mpMtrAngle->EnableAutocomplete( false );
+    mpCBStacked->SetClickHdl(LINK(this, AlignmentPropertyPanel, ClickStackHdl));
 
-    //Vertical stacked
+    aLink = LINK(this, AlignmentPropertyPanel, ReferenceEdgeHdl);
+    mpRefEdgeBottom->SetClickHdl(aLink);
+    mpRefEdgeTop->SetClickHdl(aLink);
+    mpRefEdgeStd->SetClickHdl(aLink);
 
     mpMtrAngle->InsertValue(0, FUNIT_CUSTOM);
     mpMtrAngle->InsertValue(45, FUNIT_CUSTOM);
@@ -123,6 +141,20 @@ void AlignmentPropertyPanel::Initialize()
     mpMtrAngle->SetAccessibleRelationLabeledBy(mpFtRotate);
 }
 
+IMPL_LINK( AlignmentPropertyPanel, ReferenceEdgeHdl, Control*, pControl )
+{
+    SvxRotateMode eMode;
+    if(pControl == mpRefEdgeBottom)
+        eMode = SVX_ROTATE_MODE_BOTTOM;
+    else if(pControl == mpRefEdgeTop)
+        eMode = SVX_ROTATE_MODE_TOP;
+    else
+        eMode = SVX_ROTATE_MODE_STANDARD;
+    SvxRotateModeItem aItem(eMode,ATTR_ROTATE_MODE);
+    GetBindings()->GetDispatcher()->Execute(SID_ATTR_ALIGN_LOCKPOS, SfxCallMode::RECORD, &aItem, 0l);
+    return 0;
+}
+
 IMPL_LINK_NOARG( AlignmentPropertyPanel, AngleModifiedHdl )
 {
     OUString sTmp = mpMtrAngle->GetText();
@@ -161,6 +193,14 @@ IMPL_LINK_NOARG( AlignmentPropertyPanel, AngleModifiedHdl )
         SID_ATTR_ALIGN_DEGREES, SfxCallMode::RECORD, &aAngleItem, 0L );
     return 0;
 }
+IMPL_LINK_NOARG( AlignmentPropertyPanel, ClickStackHdl )
+{
+    bool bVertical = mpCBStacked->IsChecked();
+    SfxBoolItem  aStackItem( SID_ATTR_ALIGN_STACKED, bVertical );
+    GetBindings()->GetDispatcher()->Execute(
+        SID_ATTR_ALIGN_STACKED, SfxCallMode::RECORD, &aStackItem, 0L );
+    return 0;
+}
 IMPL_LINK_NOARG(AlignmentPropertyPanel, MFLeftIndentMdyHdl)
 {
     mpCBXWrapText->EnableTriState(false);
@@ -314,6 +354,48 @@ void AlignmentPropertyPanel::NotifyItemUpdate(
             }
         }
         break;
+    case SID_ATTR_ALIGN_STACKED:
+        if (eState >= SfxItemState::DEFAULT)
+        {
+            mpCBStacked->EnableTriState(false);
+            const SfxBoolItem* aStackItem = static_cast<const SfxBoolItem*>(pState);
+            mbMultiDisable = aStackItem->GetValue();
+            mpCBStacked->Check(mbMultiDisable);
+            mpTextOrientBox->Enable(!mbMultiDisable);
+        }
+        else
+        {
+            mbMultiDisable = true;
+            mpTextOrientBox->Disable();
+            mpCBStacked->EnableTriState(true);
+            mpCBStacked->SetState(TRISTATE_INDET);
+        }
+        break;
+    case SID_ATTR_ALIGN_LOCKPOS:
+        if( eState >= SfxItemState::DEFAULT)
+        {
+            const SvxRotateModeItem* pItem = static_cast<const SvxRotateModeItem*>(pState);
+            SvxRotateMode eMode = (SvxRotateMode)pItem->GetValue();
+            if(eMode == SVX_ROTATE_MODE_BOTTOM)
+            {
+                mpRefEdgeBottom->SetState(true);
+                mpRefEdgeTop->SetState(false);
+                mpRefEdgeStd->SetState(false);
+            }
+            else if(eMode == SVX_ROTATE_MODE_TOP)
+            {
+                mpRefEdgeBottom->SetState(false);
+                mpRefEdgeStd->SetState(false);
+                mpRefEdgeTop->SetState(true);
+            }
+            else if(eMode == SVX_ROTATE_MODE_STANDARD)
+            {
+                mpRefEdgeBottom->SetState(false);
+                mpRefEdgeTop->SetState(false);
+                mpRefEdgeStd->SetState(true);
+            }
+        }
+        break;
     case SID_ATTR_ALIGN_DEGREES:
         if (eState >= SfxItemState::DEFAULT)
         {
diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
index d268eff..6702194 100644
--- a/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
+++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.hxx
@@ -23,6 +23,8 @@
 #include <sfx2/sidebar/IContextChangeReceiver.hxx>
 #include <svx/sidebar/PanelLayout.hxx>
 #include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/layout.hxx>
 #include <editeng/svxenum.hxx>
 
 class ToolBox;
@@ -74,12 +76,19 @@ private:
     VclPtr<CheckBox>                                   mpCBXMergeCell;
     VclPtr<FixedText>                                  mpFtRotate;
     VclPtr<MetricBox>                                  mpMtrAngle;
+    VclPtr<RadioButton>                                mpRefEdgeBottom;
+    VclPtr<RadioButton>                                mpRefEdgeTop;
+    VclPtr<RadioButton>                                mpRefEdgeStd;
+    VclPtr<CheckBox>                                   mpCBStacked;
+    VclPtr<VclHBox>                                    mpTextOrientBox;
 
     ::sfx2::sidebar::ControllerItem             maAlignHorControl;
     ::sfx2::sidebar::ControllerItem             maLeftIndentControl;
     ::sfx2::sidebar::ControllerItem             maMergeCellControl;
     ::sfx2::sidebar::ControllerItem             maWrapTextControl;
     ::sfx2::sidebar::ControllerItem             maAngleControl;
+    ::sfx2::sidebar::ControllerItem             maVrtStackControl;
+    ::sfx2::sidebar::ControllerItem             maRefEdgeControl;
 
     /// bitfield
     bool                                        mbMultiDisable : 1;
@@ -94,6 +103,7 @@ private:
     DECL_LINK( AngleModifiedHdl, void * );
     DECL_LINK( RotationHdl, void * );
     DECL_LINK( ClickStackHdl, void * );
+    DECL_LINK( ReferenceEdgeHdl, Control* );
 
     void Initialize();
     static void FormatDegrees(double& dTmp);
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 06fedc2..a4f6a0a 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -2137,6 +2137,7 @@ void ScFormatShell::GetAttrState( SfxItemSet& rSet )
 
     // stuff for sidebar panels
     Invalidate(SID_ATTR_ALIGN_DEGREES);
+    Invalidate(SID_ATTR_ALIGN_LOCKPOS);
     Invalidate(SID_ATTR_ALIGN_STACKED);
 }
 
diff --git a/sc/uiconfig/scalc/ui/sidebaralignment.ui b/sc/uiconfig/scalc/ui/sidebaralignment.ui
index 09eefc4..c718eab 100644
--- a/sc/uiconfig/scalc/ui/sidebaralignment.ui
+++ b/sc/uiconfig/scalc/ui/sidebaralignment.ui
@@ -2,6 +2,21 @@
 <!-- Generated with glade 3.18.3 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="pixbuf">svx/res/lo03.png</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="pixbuf">svx/res/lo02.png</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="pixbuf">svx/res/lo01.png</property>
+  </object>
   <object class="GtkGrid" id="AlignmentPropertyPanel">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -135,6 +150,45 @@
                 <property name="position">1</property>
               </packing>
             </child>
+            <child>
+              <object class="sfxlo-SidebarToolBox" id="writedirection">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="show_arrow">False</property>
+                <child>
+                  <object class="GtkToolButton" id="lefttoright">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:ParaLeftToRight</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolButton" id="righttoleft">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="is_important">True</property>
+                    <property name="action_name">.uno:ParaRightToLeft</property>
+                    <property name="use_underline">True</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="homogeneous">True</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="pack_type">end</property>
+                <property name="position">2</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -299,7 +353,7 @@
           </packing>
         </child>
         <child>
-          <object class="GtkBox" id="box2">
+          <object class="GtkBox" id="textorientbox">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
             <property name="spacing">12</property>
@@ -332,40 +386,68 @@
               </packing>
             </child>
             <child>
-              <object class="sfxlo-SidebarToolBox" id="writedirection">
+              <object class="GtkBox" id="box4">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="show_arrow">False</property>
+                <property name="spacing">3</property>
                 <child>
-                  <object class="GtkToolButton" id="lefttoright">
+                  <object class="GtkRadioButton" id="bottom">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="is_important">True</property>
-                    <property name="action_name">.uno:ParaLeftToRight</property>
-                    <property name="use_underline">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="tooltip_text" translatable="yes">Text Extension From Lower Cell Border</property>
+                    <property name="receives_default">False</property>
+                    <property name="image">image3</property>
+                    <property name="focus_on_click">False</property>
+                    <property name="xalign">0</property>
+                    <property name="always_show_image">True</property>
+                    <property name="draw_indicator">False</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkToolButton" id="righttoleft">
+                  <object class="GtkRadioButton" id="top">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="is_important">True</property>
-                    <property name="action_name">.uno:ParaRightToLeft</property>
-                    <property name="use_underline">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="tooltip_text" translatable="yes">Text Extension From Upper Cell Border</property>
+                    <property name="receives_default">False</property>
+                    <property name="image">image2</property>
+                    <property name="focus_on_click">False</property>
+                    <property name="xalign">0</property>
+                    <property name="always_show_image">True</property>
+                    <property name="draw_indicator">False</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
-                    <property name="homogeneous">True</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkRadioButton" id="standard">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="tooltip_text" translatable="yes">Text Extension Inside Cell</property>
+                    <property name="receives_default">False</property>
+                    <property name="image">image1</property>
+                    <property name="focus_on_click">False</property>
+                    <property name="xalign">0</property>
+                    <property name="always_show_image">True</property>
+                    <property name="draw_indicator">False</property>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">False</property>
-                <property name="fill">True</property>
+                <property name="fill">False</property>
                 <property name="pack_type">end</property>
                 <property name="position">2</property>
               </packing>
@@ -373,10 +455,25 @@
           </object>
           <packing>
             <property name="expand">False</property>
-            <property name="fill">True</property>
+            <property name="fill">False</property>
             <property name="position">2</property>
           </packing>
         </child>
+        <child>
+          <object class="GtkCheckButton" id="stacked">
+            <property name="label" translatable="yes">Vertically stacked</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="xalign">0</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
       </object>
       <packing>
         <property name="left_attach">0</property>


More information about the Libreoffice-commits mailing list