[Libreoffice-commits] .: 4 commits - chart2/source cui/source reportdesign/source sd/source svtools/inc svtools/source svx/inc svx/source
Matteo Casalin
mcasalin at kemper.freedesktop.org
Tue Apr 3 11:49:40 PDT 2012
chart2/source/controller/dialogs/ChartTypeDialogController.cxx | 1
chart2/source/controller/dialogs/ChartTypeDialogController.hxx | 3
chart2/source/controller/inc/res_ErrorBar.hxx | 1
cui/source/tabpages/numpages.cxx | 1
reportdesign/source/ui/dlg/Condition.cxx | 1
reportdesign/source/ui/dlg/Condition.hxx | 2
sd/source/ui/animations/CustomAnimationCreateDialog.cxx | 1
sd/source/ui/table/TableDesignPane.cxx | 1
sd/source/ui/table/TableDesignPane.hxx | 1
sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx | 1
svtools/inc/svtools/valueset.hxx | 1
svtools/source/control/toolbarmenuimp.hxx | 2
svtools/source/control/valueset.cxx | 218 ++++------
svx/inc/svx/float3d.hxx | 1
svx/source/gallery2/galbrws2.cxx | 1
svx/source/tbxctrls/colorwindow.hxx | 1
svx/source/tbxctrls/extrusioncontrols.hxx | 2
17 files changed, 96 insertions(+), 143 deletions(-)
New commits:
commit d701d7b68344854b9a67583bbd38f40d061e6cb4
Author: Matteo Casalin <matteo.casalin at gmx.com>
Date: Tue Apr 3 15:00:19 2012 +0200
ValueSet: reworked key navigation
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index e8aa9f5..95d5e6b 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1299,41 +1299,22 @@ void ValueSet::Tracking( const TrackingEvent& rTEvt )
// -----------------------------------------------------------------------
-namespace
-{
-
-size_t
-lcl_gotoLastLine(size_t const nLastPos, size_t const nCols, size_t const nCurPos)
-{
- size_t nItemPos = ((((nLastPos+1)/nCols)-1)*nCols)+(nCurPos%nCols);
- if ( nItemPos+nCols <= nLastPos )
- nItemPos = nItemPos + nCols;
- return nItemPos;
-}
-
-}
-
void ValueSet::KeyInput( const KeyEvent& rKEvt )
{
size_t nLastItem = mItemList.size();
- size_t nItemPos = VALUESET_ITEM_NOTFOUND;
- size_t nCurPos = VALUESET_ITEM_NONEITEM;
- size_t nCalcPos;
if ( !nLastItem || !ImplGetFirstItem() )
{
Control::KeyInput( rKEvt );
return;
}
- else
- nLastItem--;
- if ( mnSelItemId )
- nCurPos = GetItemPos( mnSelItemId );
- nCalcPos = nCurPos;
+ --nLastItem;
+ const size_t nCurPos = mnSelItemId ? GetItemPos( mnSelItemId )
+ : mpNoneItem ? VALUESET_ITEM_NONEITEM : 0;
+ size_t nItemPos = VALUESET_ITEM_NOTFOUND;
+ size_t nVStep = mnCols;
- //switch off selection mode if key travelling is used
- bool bDefault = false;
switch ( rKEvt.GetKeyCode().GetCode() )
{
case KEY_HOME:
@@ -1345,147 +1326,129 @@ void ValueSet::KeyInput( const KeyEvent& rKEvt )
break;
case KEY_LEFT:
- case KEY_RIGHT:
- if ( rKEvt.GetKeyCode().GetCode()==KEY_LEFT )
+ if (nCurPos != VALUESET_ITEM_NONEITEM)
{
- if ( nCalcPos == VALUESET_ITEM_NONEITEM )
- nItemPos = nLastItem;
- else if ( !nCalcPos )
+ if (nCurPos)
{
- if ( mpNoneItem )
- nItemPos = VALUESET_ITEM_NONEITEM;
- else
- nItemPos = nLastItem;
+ nItemPos = nCurPos-1;
+ }
+ else if (mpNoneItem)
+ {
+ nItemPos = VALUESET_ITEM_NONEITEM;
}
- else
- nItemPos = nCalcPos-1;
}
- else
+ break;
+
+ case KEY_RIGHT:
+ if (nCurPos < nLastItem)
{
- if ( nCalcPos == VALUESET_ITEM_NONEITEM )
- nItemPos = 0;
- else if ( nCalcPos == nLastItem )
+ if (nCurPos == VALUESET_ITEM_NONEITEM)
{
- if ( mpNoneItem )
- nItemPos = VALUESET_ITEM_NONEITEM;
- else
- nItemPos = 0;
+ nItemPos = 0;
}
else
- nItemPos = nCalcPos+1;
+ {
+ nItemPos = nCurPos+1;
+ }
}
- nCalcPos = nItemPos;
break;
- case KEY_UP:
case KEY_PAGEUP:
- {
- if( rKEvt.GetKeyCode().GetCode() != KEY_PAGEUP ||
- ( !rKEvt.GetKeyCode().IsShift() && !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() ) )
+ if (rKEvt.GetKeyCode().IsShift() || rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
{
- const size_t nLineCount = ( ( KEY_UP == rKEvt.GetKeyCode().GetCode() ) ? 1 : mnVisLines );
- if ( nCalcPos == VALUESET_ITEM_NONEITEM )
+ Control::KeyInput( rKEvt );
+ return;
+ }
+ nVStep *= mnVisLines;
+ // intentional fall-through
+ case KEY_UP:
+ if (nCurPos != VALUESET_ITEM_NONEITEM)
+ {
+ if (nCurPos == nLastItem)
{
- if ( nLastItem+1 <= mnCols )
- nItemPos = mnCurCol;
- else
- nItemPos = lcl_gotoLastLine(nLastItem, mnCols, mnCurCol);
+ const size_t nCol = nLastItem % mnCols;
+ if (nCol < mnCurCol)
+ {
+ // Move to previous row/page, keeping the old column
+ nVStep -= mnCurCol - nCol;
+ }
}
- else if ( nCalcPos >= mnCols ) // we can go up
+ if (nCurPos >= nVStep)
{
- if ( nCalcPos >= ( nLineCount * mnCols ) )
- nItemPos = nCalcPos - ( nLineCount * mnCols );
- else
- // Go to the first line. This can only happen for KEY_PAGEUP
- nItemPos = nCalcPos % mnCols;
+ // Go up of a whole page
+ nItemPos = nCurPos-nVStep;
}
- else // wrap around
+ else if (mpNoneItem)
{
- if ( mpNoneItem )
- {
- mnCurCol = nCalcPos%mnCols;
- nItemPos = VALUESET_ITEM_NONEITEM;
- }
- else
- {
- if ( nLastItem+1 <= mnCols )
- nItemPos = nCalcPos;
- else
- nItemPos = lcl_gotoLastLine(nLastItem, mnCols, nCalcPos);
- }
+ nItemPos = VALUESET_ITEM_NONEITEM;
+ }
+ else if (nCurPos > mnCols)
+ {
+ // Go to same column in first row
+ nItemPos = nCurPos % mnCols;
}
- nCalcPos = nItemPos;
}
- else
- Control::KeyInput( rKEvt );
- }
- break;
+ break;
- case KEY_DOWN:
case KEY_PAGEDOWN:
- {
- if( rKEvt.GetKeyCode().GetCode() != KEY_PAGEDOWN ||
- ( !rKEvt.GetKeyCode().IsShift() && !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsMod2() ) )
+ if (rKEvt.GetKeyCode().IsShift() || rKEvt.GetKeyCode().IsMod1() || rKEvt.GetKeyCode().IsMod2())
{
- const long nLineCount = ( ( KEY_DOWN == rKEvt.GetKeyCode().GetCode() ) ? 1 : mnVisLines );
- if ( nCalcPos == VALUESET_ITEM_NONEITEM )
- nItemPos = mnCurCol;
- else if ( nCalcPos + mnCols <= nLastItem ) // we can go down
+ Control::KeyInput( rKEvt );
+ return;
+ }
+ nVStep *= mnVisLines;
+ // intentional fall-through
+ case KEY_DOWN:
+ if (nCurPos != nLastItem)
+ {
+ if (nCurPos == VALUESET_ITEM_NONEITEM)
{
- if ( nCalcPos + ( nLineCount * mnCols ) <= nLastItem )
- nItemPos = nCalcPos + ( nLineCount * mnCols );
- else
- // Go to the last line. This can only happen for KEY_PAGEDOWN
- nItemPos = lcl_gotoLastLine(nLastItem, mnCols, nCalcPos);
+ nItemPos = nVStep-mnCols+mnCurCol;
}
- else // wrap around
+ else
{
- {
- if ( mpNoneItem )
- {
- mnCurCol = nCalcPos%mnCols;
- nItemPos = VALUESET_ITEM_NONEITEM;
- }
- else
- nItemPos = nCalcPos%mnCols;
- }
+ nItemPos = nCurPos+nVStep;
+ }
+ if (nItemPos > nLastItem)
+ {
+ nItemPos = nLastItem;
}
- nCalcPos = nItemPos;
}
- else
- Control::KeyInput( rKEvt );
+ break;
- }
- break;
case KEY_RETURN:
- //enable default handling of KEY_RETURN in dialogs
- if(0 != (GetStyle()&WB_NO_DIRECTSELECT))
+ if (GetStyle() & WB_NO_DIRECTSELECT)
{
Select();
break;
}
- //no break;
+ // intentional fall-through
default:
Control::KeyInput( rKEvt );
- bDefault = true;
- break;
+ return;
}
- if(!bDefault)
- EndSelection();
+
+ // This point is reached only if key travelling was used,
+ // in which case selection mode should be switched off
+ EndSelection();
+
if ( nItemPos != VALUESET_ITEM_NOTFOUND )
{
- sal_uInt16 nItemId;
- if ( nItemPos != VALUESET_ITEM_NONEITEM )
- nItemId = GetItemId( nItemPos );
- else
- nItemId = 0;
-
+ if ( nItemPos!=VALUESET_ITEM_NONEITEM && nItemPos<nLastItem )
+ {
+ // update current column only in case of a new position
+ // which is also not a "specially" handled one.
+ mnCurCol = nItemPos % mnCols;
+ }
+ const sal_uInt16 nItemId = (nItemPos != VALUESET_ITEM_NONEITEM) ? GetItemId( nItemPos ) : 0;
if ( nItemId != mnSelItemId )
{
SelectItem( nItemId );
- //select only if WB_NO_DIRECTSELECT is not set
- if(0 == (GetStyle()&WB_NO_DIRECTSELECT))
+ if (!(GetStyle() & WB_NO_DIRECTSELECT))
+ {
+ // select only if WB_NO_DIRECTSELECT is not set
Select();
+ }
}
}
}
commit 6ac9544454daa0330f84fd10de26ee6d4d657990
Author: Matteo Casalin <matteo.casalin at gmx.com>
Date: Sun Mar 4 21:01:01 2012 +0100
Cleanup some unnecessary #include
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
index 98247b9..f235ffa 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
#include <svtools/controldims.hrc>
+#include <svtools/valueset.hxx>
// header for class Image
#include <vcl/image.hxx>
// header for class Bitmap
diff --git a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
index 7871891..d0af40a 100644
--- a/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
+++ b/chart2/source/controller/dialogs/ChartTypeDialogController.hxx
@@ -36,7 +36,6 @@
#include <com/sun/star/chart2/CurveStyle.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
-#include <svtools/valueset.hxx>
// header for class CheckBox
#include <vcl/button.hxx>
// header for class FixedText
@@ -45,6 +44,8 @@
#include <vcl/field.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+class ValueSet;
+
//.............................................................................
namespace chart
{
diff --git a/chart2/source/controller/inc/res_ErrorBar.hxx b/chart2/source/controller/inc/res_ErrorBar.hxx
index 74ee6de..747bac2 100644
--- a/chart2/source/controller/inc/res_ErrorBar.hxx
+++ b/chart2/source/controller/inc/res_ErrorBar.hxx
@@ -32,7 +32,6 @@
#include <vcl/fixed.hxx>
#include <vcl/field.hxx>
#include <vcl/lstbox.hxx>
-#include <svtools/valueset.hxx>
#include <svl/itemset.hxx>
#include <svx/chrtitem.hxx>
#include "chartview/ChartSfxItemIds.hxx"
diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx
index b2de320..e5b8a6c 100644
--- a/cui/source/tabpages/numpages.cxx
+++ b/cui/source/tabpages/numpages.cxx
@@ -35,7 +35,6 @@
#include <dialmgr.hxx>
#include <tools/shl.hxx>
#include <i18npool/mslangid.hxx>
-#include <svtools/valueset.hxx>
#include <helpid.hrc>
#include <editeng/numitem.hxx>
#include <svl/eitem.hxx>
diff --git a/reportdesign/source/ui/dlg/Condition.cxx b/reportdesign/source/ui/dlg/Condition.cxx
index 724ea2f..bbe7e3b 100644
--- a/reportdesign/source/ui/dlg/Condition.cxx
+++ b/reportdesign/source/ui/dlg/Condition.cxx
@@ -58,6 +58,7 @@
#include <vcl/bmpacc.hxx>
#include <tools/diagnose_ex.h>
#include <rtl/ustrbuf.hxx>
+#include <svtools/valueset.hxx>
namespace rptui
{
diff --git a/reportdesign/source/ui/dlg/Condition.hxx b/reportdesign/source/ui/dlg/Condition.hxx
index aa34d46..b05a1ec 100644
--- a/reportdesign/source/ui/dlg/Condition.hxx
+++ b/reportdesign/source/ui/dlg/Condition.hxx
@@ -37,8 +37,6 @@
#include <svx/fntctrl.hxx>
-#include <svtools/valueset.hxx>
-
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/field.hxx>
diff --git a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
index 2d3933a..76f3b5a 100644
--- a/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
+++ b/sd/source/ui/animations/CustomAnimationCreateDialog.cxx
@@ -38,7 +38,6 @@
#include <vcl/fixed.hxx>
#include <vcl/lstbox.hxx>
#include <vcl/combobox.hxx>
-#include <svtools/valueset.hxx>
#include <svx/svdetc.hxx>
#include <svx/svdstr.hrc>
diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx
index 1817c48..2c4a929 100644
--- a/sd/source/ui/table/TableDesignPane.cxx
+++ b/sd/source/ui/table/TableDesignPane.cxx
@@ -52,6 +52,7 @@
#include <svx/sdr/table/tabledesign.hxx>
#include "TableDesignPane.hxx"
+#include <svtools/valueset.hxx>
#include "DrawDocShell.hxx"
#include "ViewShellBase.hxx"
diff --git a/sd/source/ui/table/TableDesignPane.hxx b/sd/source/ui/table/TableDesignPane.hxx
index 37ffe1d..5df94d9 100644
--- a/sd/source/ui/table/TableDesignPane.hxx
+++ b/sd/source/ui/table/TableDesignPane.hxx
@@ -37,7 +37,6 @@
#include <vcl/dialog.hxx>
#include <vcl/fixed.hxx>
#include <vcl/button.hxx>
-#include <svtools/valueset.hxx>
#include <boost/scoped_ptr.hpp>
diff --git a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
index d542fe4..4002cbc 100644
--- a/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
+++ b/sd/source/ui/toolpanel/controls/MasterPagesPanel.cxx
@@ -43,7 +43,6 @@
#include "strings.hrc"
#include "sdresid.hxx"
#include "helpids.h"
-#include <svtools/valueset.hxx>
#include "app.hrc"
namespace sd { namespace toolpanel { namespace controls {
diff --git a/svtools/source/control/toolbarmenuimp.hxx b/svtools/source/control/toolbarmenuimp.hxx
index e487483..9a1cdc1 100644
--- a/svtools/source/control/toolbarmenuimp.hxx
+++ b/svtools/source/control/toolbarmenuimp.hxx
@@ -48,8 +48,6 @@
#include "framestatuslistener.hxx"
-#include "svtools/valueset.hxx"
-
namespace svtools {
struct ToolbarMenu_Impl;
diff --git a/svx/inc/svx/float3d.hxx b/svx/inc/svx/float3d.hxx
index 5769657..380c77d 100644
--- a/svx/inc/svx/float3d.hxx
+++ b/svx/inc/svx/float3d.hxx
@@ -34,7 +34,6 @@
#include <vcl/field.hxx>
#include <sfx2/dockwin.hxx>
#include <vcl/button.hxx>
-#include <svtools/valueset.hxx>
#include <svtools/stdctrl.hxx>
#include "svx/svxdllapi.h"
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index b9953f9..3da4fe9 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -30,7 +30,6 @@
#include <comphelper/string.hxx>
#include <sot/formats.hxx>
#include <vcl/msgbox.hxx>
-#include <svtools/valueset.hxx>
#include <svl/urlbmk.hxx>
#include <svl/stritem.hxx>
#include <svl/intitem.hxx>
diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index 641e3db..1b033ab 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -6,6 +6,7 @@
#define __SVX_COLORWINDOW_HXX_
#include <sfx2/tbxctrl.hxx>
+#include <svtools/valueset.hxx>
#include <svl/lstner.hxx>
#include <rtl/ustring.hxx>
#include <com/sun/star/frame/XFrame.hpp>
diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx
index 35993c4..5ff022b 100644
--- a/svx/source/tbxctrls/extrusioncontrols.hxx
+++ b/svx/source/tbxctrls/extrusioncontrols.hxx
@@ -30,7 +30,6 @@
#include "svx/svxdllapi.h"
-#include <svtools/valueset.hxx>
#include <svtools/svtreebx.hxx>
#include <vcl/button.hxx>
#include <vcl/dialog.hxx>
@@ -43,6 +42,7 @@
class SfxBindings;
class SfxStatusForwarder;
+class ValueSet;
//========================================================================
commit f3b8d732f376c56a39f962dce4faa0335bfe12df
Author: Matteo Casalin <matteo.casalin at gmx.com>
Date: Sun Mar 4 08:21:34 2012 +0100
ValueSet: remove obsolete forward declaration
diff --git a/svtools/inc/svtools/valueset.hxx b/svtools/inc/svtools/valueset.hxx
index 22271da..24fa35e 100644
--- a/svtools/inc/svtools/valueset.hxx
+++ b/svtools/inc/svtools/valueset.hxx
@@ -42,7 +42,6 @@ class HelpEvent;
class KeyEvent;
class DataChangedEvent;
class ScrollBar;
-struct ValueSet_Impl;
struct ValueSetItem;
typedef ::std::vector< ValueSetItem* > ValueItemList;
commit 57533a3ddb37cd367e7ae0edfef1c8502a7d9199
Author: Matteo Casalin <matteo.casalin at gmx.com>
Date: Sat Mar 3 21:55:29 2012 +0100
ValueSet: simplify calculation of item rectangle
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 8cd032b..e8aa9f5 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -1758,14 +1758,11 @@ void ValueSet::ImplInsertItem( ValueSetItem *const pItem, const size_t nPos )
Rectangle ValueSet::ImplGetItemRect( size_t nPos ) const
{
const size_t nVisibleBegin = static_cast<size_t>(mnFirstLine)*mnCols;
- const size_t nMaxVisible = static_cast<size_t>(mnVisLines)*mnCols;
- size_t nVisibleEnd = nVisibleBegin+nMaxVisible;
- if ( nVisibleEnd>mItemList.size() )
- {
- nVisibleEnd = mItemList.size();
- }
+ const size_t nVisibleEnd = nVisibleBegin + static_cast<size_t>(mnVisLines)*mnCols;
- if ( nPos<nVisibleBegin || nPos>=nVisibleEnd )
+ // Check if the item is inside the range of the displayed ones,
+ // taking into account that last row could be incomplete
+ if ( nPos<nVisibleBegin || nPos>=nVisibleEnd || nPos>=mItemList.size() )
return Rectangle();
nPos -= nVisibleBegin;
More information about the Libreoffice-commits
mailing list