diff options
author | Rishabh Kumar <kris.kr296@gmail.com> | 2015-08-27 14:48:34 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2015-08-27 16:34:02 +0000 |
commit | 30c2ae28eecb3f1a4454784974c0c2bffc60334e (patch) | |
tree | 6f5adecb77418c497edeb55bc85cc89988097de1 /sw | |
parent | d400f155fdc3867ad4a067c2bf85588fc0fbb2a2 (diff) |
Addition of new controls to Wrap sidebar tab in Writer
Addition of Enable Contour and Edit Contour button to the sidebar
Change-Id: I9cadbcc9643b9fc87b3dbe3a9a2355cd674d1e53
Reviewed-on: https://gerrit.libreoffice.org/17324
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/uibase/sidebar/WrapPropertyPanel.cxx | 163 | ||||
-rw-r--r-- | sw/source/uibase/sidebar/WrapPropertyPanel.hxx | 25 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/sidebarwrap.ui | 186 |
3 files changed, 320 insertions, 54 deletions
diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx index d312cedb4b36..00c64353c639 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.cxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.cxx @@ -22,15 +22,18 @@ #include <cmdid.h> #include <swtypes.hxx> - +#include <svx/svxids.hrc> #include <sfx2/bindings.hxx> #include <sfx2/dispatch.hxx> #include <sfx2/sidebar/ControlFactory.hxx> #include <sfx2/imagemgr.hxx> #include <svl/eitem.hxx> #include <vcl/svapp.hxx> +#include <vcl/lstbox.hxx> #include <vcl/settings.hxx> - +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <hintids.hxx> #include <com/sun/star/lang/IllegalArgumentException.hpp> const char UNO_WRAPOFF[] = ".uno:WrapOff"; @@ -67,7 +70,13 @@ WrapPropertyPanel::WrapPropertyPanel( : PanelLayout(pParent, "WrapPropertyPanel", "modules/swriter/ui/sidebarwrap.ui", rxFrame) , mxFrame( rxFrame ) , mpBindings(pBindings) + // spacing + , nTop(0) + , nBottom(0) + , nLeft(0) + , nRight(0) // resources + , aCustomEntry() , aWrapIL(6,2) // controller items , maSwNoWrapControl(FN_FRAME_NOWRAP, *pBindings, *this) @@ -76,6 +85,9 @@ WrapPropertyPanel::WrapPropertyPanel( , maSwWrapParallelControl(FN_FRAME_WRAP_LEFT, *pBindings, *this) , maSwWrapThroughControl(FN_FRAME_WRAPTHRU, *pBindings, *this) , maSwWrapIdealControl(FN_FRAME_WRAP_IDEAL, *pBindings, *this) + , maSwEnableContourControl(FN_FRAME_WRAP_CONTOUR, *pBindings, *this) + , maSwLRSpacingControl(SID_ATTR_LRSPACE, *pBindings, *this) + , maSwULSpacingControl(SID_ATTR_ULSPACE, *pBindings, *this) { get(mpRBNoWrap, "buttonnone"); get(mpRBWrapLeft, "buttonbefore"); @@ -83,6 +95,10 @@ WrapPropertyPanel::WrapPropertyPanel( get(mpRBWrapParallel, "buttonparallel"); get(mpRBWrapThrough, "buttonthrough"); get(mpRBIdealWrap, "buttonoptimal"); + get(mpEnableContour, "enablecontour"); + get(mpEditContour, "editcontour"); + get(mpSpacingLB, "spacingLB"); + get(mpCustomEntry, "customlabel"); Initialize(); } @@ -100,6 +116,10 @@ void WrapPropertyPanel::dispose() mpRBWrapParallel.clear(); mpRBWrapThrough.clear(); mpRBIdealWrap.clear(); + mpEnableContour.clear(); + mpEditContour.clear(); + mpSpacingLB.clear(); + mpCustomEntry.clear(); maSwNoWrapControl.dispose(); maSwWrapLeftControl.dispose(); @@ -107,6 +127,9 @@ void WrapPropertyPanel::dispose() maSwWrapParallelControl.dispose(); maSwWrapThroughControl.dispose(); maSwWrapIdealControl.dispose(); + maSwEnableContourControl.dispose(); + maSwLRSpacingControl.dispose(); + maSwULSpacingControl.dispose(); PanelLayout::dispose(); } @@ -121,6 +144,12 @@ void WrapPropertyPanel::Initialize() mpRBWrapThrough->SetClickHdl(aLink); mpRBIdealWrap->SetClickHdl(aLink); + Link<Button*,void> EditContourLink = LINK(this, WrapPropertyPanel, EditContourHdl); + mpEditContour->SetClickHdl(EditContourLink); + Link<Button*, void> EnableContourLink = LINK(this,WrapPropertyPanel, EnableContourHdl); + mpEnableContour->SetClickHdl(EnableContourLink); + mpSpacingLB->SetSelectHdl(LINK(this, WrapPropertyPanel, SpacingLBHdl)); + aWrapIL.AddImage( UNO_WRAPOFF, ::GetImage( mxFrame, UNO_WRAPOFF, false ) ); aWrapIL.AddImage( UNO_WRAPLEFT, @@ -149,6 +178,8 @@ void WrapPropertyPanel::Initialize() mpRBWrapThrough->SetModeRadioImage( aWrapIL.GetImage(UNO_WRAPTHROUGH) ); mpRBIdealWrap->SetModeRadioImage( aWrapIL.GetImage(UNO_WRAPIDEAL) ); + aCustomEntry = mpCustomEntry->GetText(); + mpRBNoWrap->SetAccessibleName(mpRBNoWrap->GetQuickHelpText()); mpRBWrapLeft->SetAccessibleName(mpRBWrapLeft->GetQuickHelpText()); mpRBWrapRight->SetAccessibleName(mpRBWrapRight->GetQuickHelpText()); @@ -162,6 +193,56 @@ void WrapPropertyPanel::Initialize() mpBindings->Update( FN_FRAME_WRAP_LEFT ); mpBindings->Update( FN_FRAME_WRAPTHRU ); mpBindings->Update( FN_FRAME_WRAP_IDEAL ); + mpBindings->Update( FN_FRAME_WRAP_CONTOUR ); + mpBindings->Update( SID_ATTR_LRSPACE ); + mpBindings->Update( SID_ATTR_ULSPACE ); + +} + +void WrapPropertyPanel::UpdateSpacingLB() +{ + if( (nLeft == nRight) && (nTop == nBottom) && (nLeft == nTop) ) + { + for(sal_uInt16 i = 0; i < mpSpacingLB->GetEntryCount(); i++) + { + if(reinterpret_cast<sal_uLong>(mpSpacingLB->GetEntryData(i)) == nLeft ) + { + mpSpacingLB->SelectEntryPos(i); + mpSpacingLB->RemoveEntry(aCustomEntry); + return; + } + } + } + + mpSpacingLB->InsertEntry(aCustomEntry); + mpSpacingLB->SelectEntry(aCustomEntry); +} + +IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, EditContourHdl, Button*, void) +{ + SfxBoolItem aItem(SID_CONTOUR_DLG, true); + mpBindings->GetDispatcher()->Execute(SID_CONTOUR_DLG, SfxCallMode::RECORD, &aItem, 0L); +} + +IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, EnableContourHdl, Button*, void) +{ + bool IsContour = mpEnableContour->IsChecked(); + SfxBoolItem aItem(FN_FRAME_WRAP_CONTOUR, IsContour); + mpBindings->GetDispatcher()->Execute(FN_FRAME_WRAP_CONTOUR, SfxCallMode::RECORD, &aItem, 0l); +} + +IMPL_LINK(WrapPropertyPanel, SpacingLBHdl, ListBox*, pBox) +{ + sal_uInt16 nVal = (sal_uInt16)reinterpret_cast<sal_uLong>(pBox->GetSelectEntryData()); + + SvxLRSpaceItem aLRItem(nVal, nVal, 0, 0, RES_LR_SPACE); + SvxULSpaceItem aULItem(nVal, nVal, RES_UL_SPACE); + + nTop = nBottom = nLeft = nRight = nVal; + mpBindings->GetDispatcher()->Execute(SID_ATTR_LRSPACE, SfxCallMode::RECORD, &aLRItem, 0l); + mpBindings->GetDispatcher()->Execute(SID_ATTR_ULSPACE, SfxCallMode::RECORD, &aULItem, 0l); + + return 0L; } IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, WrapTypeHdl, Button*, void) @@ -193,6 +274,21 @@ IMPL_LINK_NOARG_TYPED(WrapPropertyPanel, WrapTypeHdl, Button*, void) } SfxBoolItem bStateItem( nSlot, true ); mpBindings->GetDispatcher()->Execute( nSlot, SfxCallMode::RECORD, &bStateItem, 0L ); + +} + +void WrapPropertyPanel::UpdateEditContour() +{ + if(mpRBNoWrap->IsChecked() || mpRBWrapThrough->IsChecked()) + { + mpEnableContour->Check( false ); + mpEnableContour->Disable(); + } + else + { + mpEnableContour->Enable(); + } + } void WrapPropertyPanel::NotifyItemUpdate( @@ -207,12 +303,13 @@ void WrapPropertyPanel::NotifyItemUpdate( pState->ISA(SfxBoolItem) ) { //Set Radio Button enable - mpRBNoWrap->Enable(true); - mpRBWrapLeft->Enable(true); - mpRBWrapRight->Enable(true); - mpRBWrapParallel->Enable(true); - mpRBWrapThrough->Enable(true); - mpRBIdealWrap->Enable(true); + mpRBNoWrap->Enable(); + mpRBWrapLeft->Enable(); + mpRBWrapRight->Enable(); + mpRBWrapParallel->Enable(); + mpRBWrapThrough->Enable(); + mpRBIdealWrap->Enable(); + mpEnableContour->Enable(); const SfxBoolItem* pBoolItem = static_cast< const SfxBoolItem* >( pState ); switch( nSId ) @@ -232,27 +329,47 @@ void WrapPropertyPanel::NotifyItemUpdate( case FN_FRAME_WRAP: mpRBWrapParallel->Check( pBoolItem->GetValue() ); break; + case FN_FRAME_WRAP_CONTOUR: + mpEnableContour->Check( pBoolItem->GetValue() ); + break; case FN_FRAME_NOWRAP: - default: mpRBNoWrap->Check( pBoolItem->GetValue() ); break; } + UpdateEditContour(); } - else + switch(nSId) { - mpRBNoWrap->Enable(false); - mpRBWrapLeft->Enable(false); - mpRBWrapRight->Enable(false); - mpRBWrapParallel->Enable(false); - mpRBWrapThrough->Enable(false); - mpRBIdealWrap->Enable(false); - - mpRBNoWrap->Check( false ); - mpRBWrapLeft->Check( false ); - mpRBWrapRight->Check( false ); - mpRBWrapParallel->Check( false ); - mpRBWrapThrough->Check( false ); - mpRBIdealWrap->Check( false ); + case SID_ATTR_LRSPACE: + { + if(eState >= SfxItemState::DEFAULT) + { + const SvxLRSpaceItem* pItem = dynamic_cast< const SvxLRSpaceItem* >(pState); + if(pItem) + { + nLeft = pItem->GetLeft(); + nRight = pItem->GetRight(); + + UpdateSpacingLB(); + } + } + } + break; + case SID_ATTR_ULSPACE: + { + if(eState >= SfxItemState::DEFAULT) + { + const SvxULSpaceItem* pItem = dynamic_cast< const SvxULSpaceItem* >(pState); + if(pItem) + { + nTop = pItem->GetUpper(); + nBottom = pItem->GetLower(); + + UpdateSpacingLB(); + } + } + } + break; } } diff --git a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx index 9edcb9cb7764..931641ceecbb 100644 --- a/sw/source/uibase/sidebar/WrapPropertyPanel.hxx +++ b/sw/source/uibase/sidebar/WrapPropertyPanel.hxx @@ -22,10 +22,10 @@ #include <svx/sidebar/PanelLayout.hxx> #include <vcl/button.hxx> #include <vcl/image.hxx> - +#include <vcl/fixed.hxx> #include <sfx2/sidebar/ControllerItem.hxx> #include <com/sun/star/frame/XFrame.hpp> - +#include <vcl/lstbox.hxx> #include <boost/scoped_ptr.hpp> namespace sw { namespace sidebar { @@ -64,6 +64,19 @@ namespace sw { namespace sidebar { VclPtr<RadioButton> mpRBWrapParallel; VclPtr<RadioButton> mpRBWrapThrough; VclPtr<RadioButton> mpRBIdealWrap; + VclPtr<Button> mpEditContour; + VclPtr<CheckBox> mpEnableContour; + VclPtr<ListBox> mpSpacingLB; + VclPtr<FixedText> mpCustomEntry; + + //Spacing + sal_uInt16 nTop; + sal_uInt16 nBottom; + sal_uInt16 nLeft; + sal_uInt16 nRight; + + //custom entry + OUString aCustomEntry; //Image resource. ImageList aWrapIL; @@ -75,10 +88,18 @@ namespace sw { namespace sidebar { ::sfx2::sidebar::ControllerItem maSwWrapParallelControl; ::sfx2::sidebar::ControllerItem maSwWrapThroughControl; ::sfx2::sidebar::ControllerItem maSwWrapIdealControl; + ::sfx2::sidebar::ControllerItem maSwEnableContourControl; + ::sfx2::sidebar::ControllerItem maSwLRSpacingControl; + ::sfx2::sidebar::ControllerItem maSwULSpacingControl; void Initialize(); + void UpdateEditContour(); + void UpdateSpacingLB(); DECL_LINK_TYPED(WrapTypeHdl, Button*, void); + DECL_LINK_TYPED(EnableContourHdl, Button*, void); + DECL_LINK_TYPED(EditContourHdl, Button*, void); + DECL_LINK(SpacingLBHdl, ListBox*); }; } } // end of namespace ::sw::sidebar diff --git a/sw/uiconfig/swriter/ui/sidebarwrap.ui b/sw/uiconfig/swriter/ui/sidebarwrap.ui index d964341b45aa..9e3708a2f79b 100644 --- a/sw/uiconfig/swriter/ui/sidebarwrap.ui +++ b/sw/uiconfig/swriter/ui/sidebarwrap.ui @@ -1,6 +1,49 @@ <?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> <interface> - <!-- interface-requires gtk+ 3.0 --> + <requires lib="gtk+" version="3.0"/> + <object class="GtkListStore" id="spacinglist"> + <columns> + <!-- column-name gchararray1 --> + <column type="gchararray"/> + <!-- column-name gint1 --> + <column type="gint"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">None</col> + <col id="1">0</col> + </row> + <row> + <col id="0" translatable="yes">Extra Small (0.16cm)</col> + <col id="1">91</col> + </row> + <row> + <col id="0" translatable="yes">Small (0.32cm)</col> + <col id="1">181</col> + </row> + <row> + <col id="0" translatable="yes">Small Medium (0.64cm)</col> + <col id="1">363</col> + </row> + <row> + <col id="0" translatable="yes">Medium (0.95cm)</col> + <col id="1">539</col> + </row> + <row> + <col id="0" translatable="yes">Medium Large (1.27cm)</col> + <col id="1">720</col> + </row> + <row> + <col id="0" translatable="yes">Large (1.9cm)</col> + <col id="1">1077</col> + </row> + <row> + <col id="0" translatable="yes">Extra Large (2.54cm)</col> + <col id="1">1440</col> + </row> + </data> + </object> <object class="GtkGrid" id="WrapPropertyPanel"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -28,7 +71,6 @@ <property name="tooltip_markup" translatable="yes">None</property> <property name="tooltip_text" translatable="yes">None</property> <property name="action_name">.uno:WrapOff</property> - <property name="use_action_appearance">False</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -40,15 +82,14 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="buttonbefore"> + <object class="GtkRadioButton" id="buttonparallel"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_markup" translatable="yes">Before</property> - <property name="tooltip_text" translatable="yes">Before</property> - <property name="action_name">.uno:WrapLeft</property> - <property name="use_action_appearance">False</property> + <property name="tooltip_markup" translatable="yes">Parallel</property> + <property name="tooltip_text" translatable="yes">Parallel</property> + <property name="action_name">.uno:WrapOn</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -60,15 +101,14 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="buttonafter"> + <object class="GtkRadioButton" id="buttonoptimal"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_markup" translatable="yes">After</property> - <property name="tooltip_text" translatable="yes">After</property> - <property name="action_name">.uno:WrapRight</property> - <property name="use_action_appearance">False</property> + <property name="tooltip_markup" translatable="yes">Optimal</property> + <property name="tooltip_text" translatable="yes">Optimal</property> + <property name="action_name">.uno:WrapIdeal</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -80,15 +120,14 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="buttonparallel"> + <object class="GtkRadioButton" id="buttonbefore"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_markup" translatable="yes">Parallel</property> - <property name="tooltip_text" translatable="yes">Parallel</property> - <property name="action_name">.uno:WrapOn</property> - <property name="use_action_appearance">False</property> + <property name="tooltip_markup" translatable="yes">Before</property> + <property name="tooltip_text" translatable="yes">Before</property> + <property name="action_name">.uno:WrapLeft</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -100,15 +139,14 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="buttonthrough"> + <object class="GtkRadioButton" id="buttonafter"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_markup" translatable="yes">Through</property> - <property name="tooltip_text" translatable="yes">Through</property> - <property name="action_name">.uno:WrapThrough</property> - <property name="use_action_appearance">False</property> + <property name="tooltip_markup" translatable="yes">After</property> + <property name="tooltip_text" translatable="yes">After</property> + <property name="action_name">.uno:WrapRight</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -120,15 +158,14 @@ </packing> </child> <child> - <object class="GtkRadioButton" id="buttonoptimal"> + <object class="GtkRadioButton" id="buttonthrough"> <property name="use_action_appearance">False</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> - <property name="tooltip_markup" translatable="yes">Optimal</property> - <property name="tooltip_text" translatable="yes">Optimal</property> - <property name="action_name">.uno:WrapIdeal</property> - <property name="use_action_appearance">False</property> + <property name="tooltip_markup" translatable="yes">Through</property> + <property name="tooltip_text" translatable="yes">Through</property> + <property name="action_name">.uno:WrapThrough</property> <property name="xalign">0</property> <property name="active">True</property> <property name="draw_indicator">True</property> @@ -146,12 +183,103 @@ <property name="position">0</property> </packing> </child> + <child> + <object class="GtkBox" id="box3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkCheckButton" id="enablecontour"> + <property name="label" translatable="yes">Enable Contour</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="tooltip_markup" translatable="yes">Click to automatically trim unnecessary parts of the image</property> + <property name="tooltip_text" translatable="yes">Click to automatically trim unnecessary parts of the image</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="editcontour"> + <property name="label" translatable="yes">Edit Contour</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="tooltip_markup" translatable="yes">Edit the trimmed area of the image</property> + <property name="tooltip_text" translatable="yes">Edit the trimmed area of the image</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkBox" id="box4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Spacing:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkComboBox" id="spacingLB"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="tooltip_markup" translatable="yes">Set the amount of space between the image and surrounding text</property> + <property name="tooltip_text" translatable="yes">Set the amount of space between the image and surrounding text</property> + <property name="model">spacinglist</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="customlabel"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Custom</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> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> |