summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-09-14 09:13:16 +0200
committerobo <obo@openoffice.org>2010-09-14 09:13:16 +0200
commitc548b0b0b38ad2b1a7184a4ffc97ca26958b0389 (patch)
treedd3ed6775fab729fbc9daf17f1b6d2ed73fe2167
parent1a8dc8a165c73588cee713173f09609a07f7c258 (diff)
parentc87fa692ab3b94601d3556b0e81c396f7cadc40d (diff)
CWS-TOOLING: integrate CWS calc59
Notes
split repo tag: calc_ooo/OOO330_m8 split repo tag: calc_ooo/OOO330_m9
-rw-r--r--sc/inc/dpobject.hxx4
-rw-r--r--sc/inc/dpsave.hxx1
-rw-r--r--sc/inc/pivot.hxx1
-rw-r--r--sc/inc/unonames.hxx1
-rw-r--r--sc/source/core/data/dpobject.cxx35
-rw-r--r--sc/source/core/data/dpsave.cxx5
-rw-r--r--[-rwxr-xr-x]sc/source/core/data/dptabsrc.cxx6
-rw-r--r--sc/source/core/data/pivot2.cxx1
-rw-r--r--sc/source/filter/xml/XMLExportDataPilot.cxx10
-rw-r--r--sc/source/ui/dbgui/pvfundlg.cxx5
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx57
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx1
-rw-r--r--sc/source/ui/view/gridwin2.cxx13
13 files changed, 123 insertions, 17 deletions
diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx
index 44aa1daa9a92..e1b88919dad6 100644
--- a/sc/inc/dpobject.hxx
+++ b/sc/inc/dpobject.hxx
@@ -186,7 +186,7 @@ public:
bool IsDataDescriptionCell(const ScAddress& rPos);
bool IsDimNameInUse(const ::rtl::OUString& rName) const;
- String GetDimName( long nDim, BOOL& rIsDataLayout );
+ String GetDimName( long nDim, BOOL& rIsDataLayout, sal_Int32* pFlags = NULL );
BOOL IsDuplicated( long nDim );
long GetDimCount();
void GetHeaderPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTableHeaderData& rData);
@@ -259,6 +259,8 @@ public:
PivotField* pRefColFields = NULL, SCSIZE nRefColCount = 0,
PivotField* pRefRowFields = NULL, SCSIZE nRefRowCount = 0,
PivotField* pRefPageFields = NULL, SCSIZE nRefPageCount = 0 );
+
+ static bool IsOrientationAllowed( USHORT nOrient, sal_Int32 nDimFlags );
};
diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx
index bfff0b97a168..8272b850b27e 100644
--- a/sc/inc/dpsave.hxx
+++ b/sc/inc/dpsave.hxx
@@ -140,6 +140,7 @@ public:
void SetSubTotals(long nCount, const USHORT* pFuncs);
long GetSubTotalsCount() const { return nSubTotalCount; }
USHORT GetSubTotalFunc(long nIndex) const { return pSubTotalFuncs[nIndex]; }
+ bool HasShowEmpty() const;
void SetShowEmpty(BOOL bSet);
BOOL GetShowEmpty() const { return BOOL(nShowEmptyMode); }
void SetFunction(USHORT nNew); // enum GeneralFunction
diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx
index 915a311411c4..489f272bc8ba 100644
--- a/sc/inc/pivot.hxx
+++ b/sc/inc/pivot.hxx
@@ -141,6 +141,7 @@ struct ScDPLabelData
SCsCOL mnCol;
USHORT mnFuncMask; /// Page/Column/Row subtotal function.
sal_Int32 mnUsedHier; /// Used hierarchy.
+ sal_Int32 mnFlags; /// Flags from the DataPilotSource dimension
bool mbShowAll; /// true = Show all (also empty) results.
bool mbIsValue; /// true = Sum or count in data field.
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx
index 2d011f425398..1e56743d8129 100644
--- a/sc/inc/unonames.hxx
+++ b/sc/inc/unonames.hxx
@@ -565,6 +565,7 @@
#define SC_UNO_FIELD_SUBTOTALNAME "FieldSubtotalName"
#define SC_UNO_GRANDTOTAL_NAME "GrandTotalName"
#define SC_UNO_HAS_HIDDEN_MEMBER "HasHiddenMember"
+#define SC_UNO_FLAGS "Flags"
// (preliminary:)
#define SC_UNO_REFVALUE "ReferenceValue"
diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx
index e994339f4a9a..29ba9f15dc92 100644
--- a/sc/source/core/data/dpobject.cxx
+++ b/sc/source/core/data/dpobject.cxx
@@ -65,6 +65,7 @@
#include <com/sun/star/sheet/DataPilotTableHeaderData.hpp>
#include <com/sun/star/sheet/DataPilotTablePositionData.hpp>
#include <com/sun/star/sheet/DataPilotTablePositionType.hpp>
+#include <com/sun/star/sheet/DimensionFlags.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XSingleComponentFactory.hpp>
@@ -845,7 +846,7 @@ bool ScDPObject::IsDimNameInUse(const OUString& rName) const
return false;
}
-String ScDPObject::GetDimName( long nDim, BOOL& rIsDataLayout )
+String ScDPObject::GetDimName( long nDim, BOOL& rIsDataLayout, sal_Int32* pFlags )
{
rIsDataLayout = FALSE;
String aRet;
@@ -879,6 +880,10 @@ String ScDPObject::GetDimName( long nDim, BOOL& rIsDataLayout )
rIsDataLayout = TRUE;
else
aRet = String( aName );
+
+ if (pFlags)
+ *pFlags = ScUnoHelpFunctions::GetLongProperty( xDimProp,
+ rtl::OUString::createFromAscii(SC_UNO_FLAGS), 0 );
}
}
}
@@ -2003,6 +2008,8 @@ BOOL ScDPObject::FillLabelData(ScPivotParam& rParam)
GetHierarchies(nDim, pNewLabel->maHiers);
GetMembers(nDim, GetUsedHierarchy(nDim), pNewLabel->maMembers);
lcl_FillLabelData(*pNewLabel, xDimProp);
+ pNewLabel->mnFlags = ScUnoHelpFunctions::GetLongProperty( xDimProp,
+ rtl::OUString::createFromAscii(SC_UNO_FLAGS), 0 );
rParam.maLabelArray.push_back(pNewLabel);
}
}
@@ -2231,6 +2238,32 @@ void ScDPObject::ConvertOrientation( ScDPSaveData& rSaveData,
}
}
+// static
+bool ScDPObject::IsOrientationAllowed( USHORT nOrient, sal_Int32 nDimFlags )
+{
+ bool bAllowed = true;
+ switch (nOrient)
+ {
+ case sheet::DataPilotFieldOrientation_PAGE:
+ bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_PAGE_ORIENTATION ) == 0;
+ break;
+ case sheet::DataPilotFieldOrientation_COLUMN:
+ bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_COLUMN_ORIENTATION ) == 0;
+ break;
+ case sheet::DataPilotFieldOrientation_ROW:
+ bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_ROW_ORIENTATION ) == 0;
+ break;
+ case sheet::DataPilotFieldOrientation_DATA:
+ bAllowed = ( nDimFlags & sheet::DimensionFlags::NO_DATA_ORIENTATION ) == 0;
+ break;
+ default:
+ {
+ // allowed to remove from previous orientation
+ }
+ }
+ return bAllowed;
+}
+
// -----------------------------------------------------------------------
// static
diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx
index dd493bb0df6c..bad05968bf72 100644
--- a/sc/source/core/data/dpsave.cxx
+++ b/sc/source/core/data/dpsave.cxx
@@ -410,6 +410,11 @@ void ScDPSaveDimension::SetSubTotals(long nCount, const USHORT* pFuncs)
bSubTotalDefault = FALSE;
}
+bool ScDPSaveDimension::HasShowEmpty() const
+{
+ return nShowEmptyMode != SC_DPSAVEMODE_DONTKNOW;
+}
+
void ScDPSaveDimension::SetShowEmpty(BOOL bSet)
{
nShowEmptyMode = bSet;
diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx
index da40e6e230c4..b4ca5dbc7330 100755..100644
--- a/sc/source/core/data/dptabsrc.cxx
+++ b/sc/source/core/data/dptabsrc.cxx
@@ -1576,6 +1576,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDPDimension::getPropertySetIn
static SfxItemPropertyMapEntry aDPDimensionMap_Impl[] =
{
{MAP_CHAR_LEN(SC_UNO_FILTER), 0, &getCppuType((uno::Sequence<sheet::TableFilterField>*)0), 0, 0 },
+ {MAP_CHAR_LEN(SC_UNO_FLAGS), 0, &getCppuType((sal_Int32*)0), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNO_FUNCTION), 0, &getCppuType((sheet::GeneralFunction*)0), 0, 0 },
{MAP_CHAR_LEN(SC_UNO_ISDATALA), 0, &getBooleanCppuType(), beans::PropertyAttribute::READONLY, 0 },
{MAP_CHAR_LEN(SC_UNO_NUMBERFO), 0, &getCppuType((sal_Int32*)0), beans::PropertyAttribute::READONLY, 0 },
@@ -1753,6 +1754,11 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const rtl::OUString& aPropert
aRet <<= mpSubtotalName.get() ? *mpSubtotalName : OUString::createFromAscii("");
else if (aNameStr.EqualsAscii(SC_UNO_HAS_HIDDEN_MEMBER))
aRet <<= mbHasHiddenMember;
+ else if (aNameStr.EqualsAscii(SC_UNO_FLAGS))
+ {
+ sal_Int32 nFlags = 0; // tabular data: all orientations are possible
+ aRet <<= nFlags;
+ }
else
{
DBG_ERROR("unknown property");
diff --git a/sc/source/core/data/pivot2.cxx b/sc/source/core/data/pivot2.cxx
index 5a6174bc0129..ddac72f0230b 100644
--- a/sc/source/core/data/pivot2.cxx
+++ b/sc/source/core/data/pivot2.cxx
@@ -82,6 +82,7 @@ ScDPLabelData::ScDPLabelData( const String& rName, short nCol, bool bIsValue ) :
mnCol( nCol ),
mnFuncMask( PIVOT_FUNC_NONE ),
mnUsedHier( 0 ),
+ mnFlags( 0 ),
mbShowAll( false ),
mbIsValue( bIsValue )
{
diff --git a/sc/source/filter/xml/XMLExportDataPilot.cxx b/sc/source/filter/xml/XMLExportDataPilot.cxx
index e43ff21a114d..f8cba5ecf6c3 100644
--- a/sc/source/filter/xml/XMLExportDataPilot.cxx
+++ b/sc/source/filter/xml/XMLExportDataPilot.cxx
@@ -503,9 +503,13 @@ void ScXMLExportDataPilot::WriteMembers(ScDPSaveDimension* pDim)
void ScXMLExportDataPilot::WriteLevels(ScDPSaveDimension* pDim)
{
- rtl::OUStringBuffer sBuffer;
- SvXMLUnitConverter::convertBool(sBuffer, pDim->GetShowEmpty());
- rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, sBuffer.makeStringAndClear());
+ // #i114202# GetShowEmpty is only valid if HasShowEmpty is true.
+ if (pDim->HasShowEmpty())
+ {
+ rtl::OUStringBuffer sBuffer;
+ SvXMLUnitConverter::convertBool(sBuffer, pDim->GetShowEmpty());
+ rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, sBuffer.makeStringAndClear());
+ }
SvXMLElementExport aElemDPL(rExport, XML_NAMESPACE_TABLE, XML_DATA_PILOT_LEVEL, sal_True, sal_True);
WriteSubTotals(pDim);
diff --git a/sc/source/ui/dbgui/pvfundlg.cxx b/sc/source/ui/dbgui/pvfundlg.cxx
index 6b04993ba0bc..b5a19ef0ec9b 100644
--- a/sc/source/ui/dbgui/pvfundlg.cxx
+++ b/sc/source/ui/dbgui/pvfundlg.cxx
@@ -735,8 +735,9 @@ ScDPShowDetailDlg::ScDPShowDetailDlg( Window* pParent, ScDPObject& rDPObj, USHOR
for (long nDim=0; nDim<nDimCount; nDim++)
{
BOOL bIsDataLayout;
- String aName = rDPObj.GetDimName( nDim, bIsDataLayout );
- if ( !bIsDataLayout && !rDPObj.IsDuplicated( nDim ) )
+ sal_Int32 nDimFlags = 0;
+ String aName = rDPObj.GetDimName( nDim, bIsDataLayout, &nDimFlags );
+ if ( !bIsDataLayout && !rDPObj.IsDuplicated( nDim ) && ScDPObject::IsOrientationAllowed( nOrient, nDimFlags ) )
{
const ScDPSaveDimension* pDimension = pSaveData ? pSaveData->GetExistingDimensionByName(aName) : 0;
if ( !pDimension || (pDimension->GetOrientation() != nOrient) )
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
index 1eca44a787ed..56d7e3550cda 100644
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ b/sc/source/ui/dbgui/pvlaydlg.cxx
@@ -567,7 +567,9 @@ void ScDPLayoutDlg::AddField( size_t nFromIndex, ScDPFieldType eToType, const Po
}
}
- if ( (toArr->back().get() == NULL)
+ bool bAllowed = IsOrientationAllowed( fData.mnCol, eToType );
+ if ( bAllowed
+ && (toArr->back().get() == NULL)
&& (!Contains( toArr, fData.mnCol, nAt )) )
{
// ggF. in anderem Fenster entfernen
@@ -714,7 +716,8 @@ void ScDPLayoutDlg::MoveField( ScDPFieldType eFromType, size_t nFromIndex, ScDPF
{
ScDPFuncData fData( *((*fromArr)[nFromIndex]) );
- if ( Contains( fromArr, fData.mnCol, nAt ) )
+ bool bAllowed = IsOrientationAllowed( fData.mnCol, eToType );
+ if ( bAllowed && Contains( fromArr, fData.mnCol, nAt ) )
{
fromWnd->DelField( nAt );
Remove( fromArr, nAt );
@@ -935,21 +938,41 @@ PointerStyle ScDPLayoutDlg::NotifyMouseMove( const Point& rAt )
if ( bIsDrag )
{
Point aPos = ScreenToOutputPixel( rAt );
+ ScDPFieldType eCheckTarget = TYPE_SELECT;
if ( aRectPage.IsInside( aPos ) )
- ePtr = lclGetPointerForField( TYPE_PAGE );
+ eCheckTarget = TYPE_PAGE;
else if ( aRectCol.IsInside( aPos ) )
- ePtr = lclGetPointerForField( TYPE_COL );
+ eCheckTarget = TYPE_COL;
else if ( aRectRow.IsInside( aPos ) )
- ePtr = lclGetPointerForField( TYPE_ROW );
+ eCheckTarget = TYPE_ROW;
else if ( aRectData.IsInside( aPos ) )
- ePtr = lclGetPointerForField( TYPE_DATA );
+ eCheckTarget = TYPE_DATA;
else if ( eDnDFromType != TYPE_SELECT )
ePtr = POINTER_PIVOT_DELETE;
else if ( aRectSelect.IsInside( aPos ) )
ePtr = lclGetPointerForField( TYPE_SELECT );
else
ePtr = POINTER_NOTALLOWED;
+
+ if ( eCheckTarget != TYPE_SELECT )
+ {
+ // check if the target orientation is allowed for this field
+ ScDPFuncDataVec* fromArr = NULL;
+ switch ( eDnDFromType )
+ {
+ case TYPE_PAGE: fromArr = &aPageArr; break;
+ case TYPE_COL: fromArr = &aColArr; break;
+ case TYPE_ROW: fromArr = &aRowArr; break;
+ case TYPE_DATA: fromArr = &aDataArr; break;
+ case TYPE_SELECT: fromArr = &aSelectArr; break;
+ }
+ ScDPFuncData fData( *((*fromArr)[nDnDFromIndex]) );
+ if (IsOrientationAllowed( fData.mnCol, eCheckTarget ))
+ ePtr = lclGetPointerForField( eCheckTarget );
+ else
+ ePtr = POINTER_NOTALLOWED;
+ }
}
return ePtr;
@@ -1218,6 +1241,28 @@ String ScDPLayoutDlg::GetLabelString( SCsCOL nCol )
return String();
}
+//----------------------------------------------------------------------------
+
+bool ScDPLayoutDlg::IsOrientationAllowed( SCsCOL nCol, ScDPFieldType eType )
+{
+ bool bAllowed = true;
+ ScDPLabelData* pData = GetLabelData( nCol );
+ DBG_ASSERT( pData, "LabelData not found" );
+ if (pData)
+ {
+ sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN;
+ switch (eType)
+ {
+ case TYPE_PAGE: eOrient = sheet::DataPilotFieldOrientation_PAGE; break;
+ case TYPE_COL: eOrient = sheet::DataPilotFieldOrientation_COLUMN; break;
+ case TYPE_ROW: eOrient = sheet::DataPilotFieldOrientation_ROW; break;
+ case TYPE_DATA: eOrient = sheet::DataPilotFieldOrientation_DATA; break;
+ case TYPE_SELECT: eOrient = sheet::DataPilotFieldOrientation_HIDDEN; break;
+ }
+ bAllowed = ScDPObject::IsOrientationAllowed( (USHORT)eOrient, pData->mnFlags );
+ }
+ return bAllowed;
+}
//----------------------------------------------------------------------------
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
index c74b9e028d2f..e16c3266510e 100644
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ b/sc/source/ui/inc/pvlaydlg.hxx
@@ -198,6 +198,7 @@ private:
Point DlgPos2WndPos ( const Point& rPt, Window& rWnd );
ScDPLabelData* GetLabelData ( SCsCOL nCol, size_t* pPos = NULL );
String GetLabelString ( SCsCOL nCol );
+ bool IsOrientationAllowed( SCsCOL nCol, ScDPFieldType eType );
String GetFuncString ( USHORT& rFuncMask, BOOL bIsValue = TRUE );
BOOL Contains ( ScDPFuncDataVec* pArr, SCsCOL nCol, size_t& nAt );
void Remove ( ScDPFuncDataVec* pArr, size_t nAt );
diff --git a/sc/source/ui/view/gridwin2.cxx b/sc/source/ui/view/gridwin2.cxx
index a64814d952ef..ec584213898c 100644
--- a/sc/source/ui/view/gridwin2.cxx
+++ b/sc/source/ui/view/gridwin2.cxx
@@ -309,10 +309,17 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, BOOL bMove )
aPosRect, nOrient, nDimPos );
UpdateDragRect( bHasRange && bMove, aPosRect );
+ BOOL bIsDataLayout;
+ sal_Int32 nDimFlags = 0;
+ String aDimName = pDragDPObj->GetDimName( nDPField, bIsDataLayout, &nDimFlags );
+ bool bAllowed = !bHasRange || ScDPObject::IsOrientationAllowed( nOrient, nDimFlags );
+
if (bMove) // set mouse pointer
{
PointerStyle ePointer = POINTER_PIVOT_DELETE;
- if ( bHasRange )
+ if ( !bAllowed )
+ ePointer = POINTER_NOTALLOWED;
+ else if ( bHasRange )
switch (nOrient)
{
case sheet::DataPilotFieldOrientation_COLUMN: ePointer = POINTER_PIVOT_COL; break;
@@ -327,15 +334,13 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, BOOL bMove )
if (!bHasRange)
nOrient = sheet::DataPilotFieldOrientation_HIDDEN;
- BOOL bIsDataLayout;
- String aDimName = pDragDPObj->GetDimName( nDPField, bIsDataLayout );
if ( bIsDataLayout && ( nOrient != sheet::DataPilotFieldOrientation_COLUMN &&
nOrient != sheet::DataPilotFieldOrientation_ROW ) )
{
// removing data layout is not allowed
pViewData->GetView()->ErrorMessage(STR_PIVOT_MOVENOTALLOWED);
}
- else
+ else if ( bAllowed )
{
ScDPSaveData aSaveData( *pDragDPObj->GetSaveData() );