ooo-build r15541 - trunk/patches/test
- From: kyoshida svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r15541 - trunk/patches/test
- Date: Sat, 14 Mar 2009 01:25:13 +0000 (UTC)
Author: kyoshida
Date: Sat Mar 14 01:25:13 2009
New Revision: 15541
URL: http://svn.gnome.org/viewvc/ooo-build?rev=15541&view=rev
Log:
on-going work for dp. not even remotely done yet.
Added:
trunk/patches/test/calc-dp-hide-list-menu.diff
Added: trunk/patches/test/calc-dp-hide-list-menu.diff
==============================================================================
--- (empty file)
+++ trunk/patches/test/calc-dp-hide-list-menu.diff Sat Mar 14 01:25:13 2009
@@ -0,0 +1,986 @@
+diff --git sc/inc/attrib.hxx sc/inc/attrib.hxx
+index 3fed033..271e91d 100644
+--- sc/inc/attrib.hxx
++++ sc/inc/attrib.hxx
+@@ -42,13 +42,14 @@
+
+ // Flags fuer durch Merge verdeckte Zellen
+ // und Control fuer Auto-Filter
+-#define SC_MF_HOR 1
+-#define SC_MF_VER 2
+-#define SC_MF_AUTO 4
+-#define SC_MF_BUTTON 8
+-#define SC_MF_SCENARIO 16
+-
+-#define SC_MF_ALL 31
++#define SC_MF_HOR 0x0001
++#define SC_MF_VER 0x0002
++#define SC_MF_AUTO 0x0004 /// autofilter arrow
++#define SC_MF_BUTTON 0x0008 /// field button for datapilot
++#define SC_MF_SCENARIO 0x0010
++#define SC_MF_BUTTON_POPUP 0x0020 /// datapilot button with popup arrow
++
++#define SC_MF_ALL (SC_MF_HOR|SC_MF_VER|SC_MF_AUTO|SC_MF_BUTTON|SC_MF_SCENARIO|SC_MF_BUTTON_POPUP)
+
+
+ class EditTextObject;
+diff --git sc/inc/dpoutputgeometry.hxx sc/inc/dpoutputgeometry.hxx
+new file mode 100644
+index 0000000..c8abd2c
+--- /dev/null
++++ sc/inc/dpoutputgeometry.hxx
+@@ -0,0 +1,64 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: xmldpimp.cxx,v $
++ * $Revision: 1.27.134.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef SC_DPOUTPUTGEOMETRY_HXX
++#define SC_DPOUTPUTGEOMETRY_HXX
++
++#include "address.hxx"
++
++class ScDPOutputGeometry
++{
++public:
++ enum FieldType { Column, Row, Page, Data, None };
++
++ ScDPOutputGeometry(const ScRange& rOutRange, bool bShowFilter);
++ ~ScDPOutputGeometry();
++
++ void setRowFieldCount(sal_uInt32 nCount);
++ void setColumnFieldCount(sal_uInt32 nCount);
++ void setPageFieldCount(sal_uInt32 nCount);
++ void setDataFieldCount(sal_uInt32 nCount);
++
++ FieldType getFieldButtonType(const ScAddress& rPos) const;
++
++private:
++ ScDPOutputGeometry(); // disabled
++
++private:
++ ScRange maOutRange;
++ sal_uInt32 mnRowFields;
++ sal_uInt32 mnColumnFields;
++ sal_uInt32 mnPageFields;
++ sal_uInt32 mnDataFields;
++
++ bool mbShowFilter;
++};
++
++#endif
+diff --git sc/inc/fillinfo.hxx sc/inc/fillinfo.hxx
+index c9bfc1d..5cf89f3 100644
+--- sc/inc/fillinfo.hxx
++++ sc/inc/fillinfo.hxx
+@@ -99,6 +99,7 @@ struct CellInfo
+ BOOL bVOverlapped : 1;
+ BOOL bAutoFilter : 1;
+ BOOL bPushButton : 1;
++ bool bPopupButton: 1;
+
+ BOOL bPrinted : 1; // bei Bedarf (Pagebreak-Modus)
+
+diff --git sc/source/core/data/dpoutputgeometry.cxx sc/source/core/data/dpoutputgeometry.cxx
+new file mode 100644
+index 0000000..7a6d813
+--- /dev/null
++++ sc/source/core/data/dpoutputgeometry.cxx
+@@ -0,0 +1,117 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: xmldpimp.cxx,v $
++ * $Revision: 1.27.134.1 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sc.hxx"
++
++
++
++// INCLUDE ---------------------------------------------------------------
++
++#include "dpoutputgeometry.hxx"
++
++ScDPOutputGeometry::ScDPOutputGeometry(const ScRange& rOutRange, bool bShowFilter) :
++ maOutRange(rOutRange),
++ mbShowFilter(bShowFilter),
++ mnRowFields(0),
++ mnColumnFields(0),
++ mnPageFields(0),
++ mnDataFields(0)
++{
++}
++
++ScDPOutputGeometry::~ScDPOutputGeometry()
++{
++}
++
++void ScDPOutputGeometry::setRowFieldCount(sal_uInt32 nCount)
++{
++ mnRowFields = nCount;
++}
++
++void ScDPOutputGeometry::setColumnFieldCount(sal_uInt32 nCount)
++{
++ mnColumnFields = nCount;
++}
++
++void ScDPOutputGeometry::setPageFieldCount(sal_uInt32 nCount)
++{
++ mnPageFields = nCount;
++}
++
++void ScDPOutputGeometry::setDataFieldCount(sal_uInt32 nCount)
++{
++ mnDataFields = nCount;
++}
++
++ScDPOutputGeometry::FieldType ScDPOutputGeometry::getFieldButtonType(const ScAddress& rPos) const
++{
++ // We will ignore the table position for now.
++
++ // position relative to the output range.
++ SCCOL nColPos = rPos.Col() - maOutRange.aStart.Col();
++ SCROW nRowPos = rPos.Row() - maOutRange.aStart.Row();
++
++ bool bDataLayout = mnDataFields > 1;
++
++ SCROW nCurRow = maOutRange.aStart.Row();
++
++ if (mnPageFields)
++ {
++ SCCOL nCol = maOutRange.aStart.Col();
++ SCROW nRowStart = maOutRange.aStart.Row() + mbShowFilter;
++ SCROW nRowEnd = nRowStart + static_cast<SCCOL>(mnPageFields-1);
++ if (rPos.Col() == nCol && nRowStart <= rPos.Row() && rPos.Row() <= nRowEnd)
++ return Page;
++
++ nCurRow = nRowEnd + 2;
++ }
++
++ if (mnColumnFields)
++ {
++ SCROW nRow = nCurRow;
++ SCCOL nColStart = maOutRange.aStart.Col() + mnRowFields + bDataLayout;
++ SCCOL nColEnd = nColStart + static_cast<SCCOL>(mnColumnFields-1);
++ if (rPos.Row() == nRow && nColStart <= rPos.Col() && rPos.Col() <= nColEnd)
++ return Column;
++
++ nCurRow += static_cast<SCROW>(mnColumnFields);
++ }
++
++ if (mnRowFields)
++ {
++ SCCOL nColStart = maOutRange.aStart.Col();
++ SCCOL nColEnd = nColStart + static_cast<SCCOL>(mnRowFields-1);
++ if (rPos.Row() == nCurRow && nColStart <= rPos.Col() && rPos.Col() <= nColEnd)
++ return Row;
++ }
++
++ return None;
++}
+diff --git sc/source/core/data/fillinfo.cxx sc/source/core/data/fillinfo.cxx
+index 9fbeb09..f434db3 100644
+--- sc/source/core/data/fillinfo.cxx
++++ sc/source/core/data/fillinfo.cxx
+@@ -56,6 +56,31 @@
+ #include "stlpool.hxx"
+
+
++#include <stdio.h>
++#include <string>
++
++namespace {
++
++class StackPrinter
++{
++public:
++ explicit StackPrinter(const char* msg) :
++ msMsg(msg)
++ {
++ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
++ }
++
++ ~StackPrinter()
++ {
++ fprintf(stdout, "%s: --end\n", msMsg.c_str());
++ }
++
++private:
++ ::std::string msMsg;
++};
++
++}
++
+ // -----------------------------------------------------------------------
+
+ const USHORT ROWINFO_MAX = 1024;
+@@ -170,6 +195,8 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
+ SCTAB nTab, double nScaleX, double nScaleY,
+ BOOL bPageMode, BOOL bFormulaMode, const ScMarkData* pMarkData )
+ {
++ StackPrinter __stack_printer__("ScDocument::FillInfo");
++
+ DBG_ASSERT( pTab[nTab], "Tabelle existiert nicht" );
+
+ BOOL bLayoutRTL = IsLayoutRTL( nTab );
+@@ -332,6 +359,7 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
+ pInfo->bVOverlapped = FALSE;
+ pInfo->bAutoFilter = FALSE;
+ pInfo->bPushButton = FALSE;
++ pInfo->bPopupButton = false;
+ pInfo->nRotateDir = SC_ROTDIR_NONE;
+
+ pInfo->bPrinted = FALSE; // view-intern
+@@ -458,6 +486,7 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
+ BOOL bAutoFilter = ((nOverlap & SC_MF_AUTO) != 0);
+ BOOL bPushButton = ((nOverlap & SC_MF_BUTTON) != 0);
+ BOOL bScenario = ((nOverlap & SC_MF_SCENARIO) != 0);
++ bool bPopupButton = ((nOverlap & SC_MF_BUTTON_POPUP) != 0);
+ if (bMerged||bHOverlapped||bVOverlapped)
+ bAnyMerged = TRUE; // intern
+
+@@ -498,6 +527,7 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
+ pInfo->bVOverlapped = bVOverlapped;
+ pInfo->bAutoFilter = bAutoFilter;
+ pInfo->bPushButton = bPushButton;
++ pInfo->bPopupButton = bPopupButton;
+ pInfo->pLinesAttr = pLinesAttr;
+ pInfo->mpTLBRLine = pTLBRLine;
+ pInfo->mpBLTRLine = pBLTRLine;
+@@ -512,7 +542,7 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
+ nCurRow >= aEmbedRange.aStart.Row() &&
+ nCurRow <= aEmbedRange.aEnd.Row();
+
+- if (bPushButton || bScenario)
++ if (bScenario)
+ {
+ pInfo->pBackground = ScGlobal::GetButtonBrushItem();
+ pThisRowInfo->bEmptyBack = FALSE;
+diff --git sc/source/core/data/makefile.mk sc/source/core/data/makefile.mk
+index 2abd0d8..c631bb4 100644
+--- sc/source/core/data/makefile.mk
++++ sc/source/core/data/makefile.mk
+@@ -79,6 +79,7 @@ SLOFILES = \
+ $(SLO)$/dpgroup.obj \
+ $(SLO)$/dpobject.obj \
+ $(SLO)$/dpoutput.obj \
++ $(SLO)$/dpoutputgeometry.obj \
+ $(SLO)$/dpsave.obj \
+ $(SLO)$/dpsdbtab.obj \
+ $(SLO)$/dpshttab.obj \
+@@ -141,6 +142,7 @@ EXCEPTIONSFILES= \
+ $(SLO)$/dpsdbtab.obj \
+ $(SLO)$/dpobject.obj \
+ $(SLO)$/dpoutput.obj \
++ $(SLO)$/dpoutputgeometry.obj \
+ $(SLO)$/dpsave.obj \
+ $(SLO)$/dbdocutl.obj \
+ $(SLO)$/dptabsrc.obj \
+diff --git sc/source/filter/xml/xmldpimp.cxx sc/source/filter/xml/xmldpimp.cxx
+index 9dfcd8c..103c5c8 100644
+--- sc/source/filter/xml/xmldpimp.cxx
++++ sc/source/filter/xml/xmldpimp.cxx
+@@ -48,6 +48,7 @@
+ #include "dpgroup.hxx"
+ #include "dpdimsave.hxx"
+ #include "rangeutl.hxx"
++#include "dpoutputgeometry.hxx"
+
+ #include <xmloff/xmltkmap.hxx>
+ #include <xmloff/nmspmap.hxx>
+@@ -67,6 +68,32 @@ using namespace com::sun::star;
+ using namespace xmloff::token;
+ using ::rtl::OUString;
+
++
++#include <stdio.h>
++#include <string>
++
++namespace {
++
++class StackPrinter
++{
++public:
++ explicit StackPrinter(const char* msg) :
++ msMsg(msg)
++ {
++ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
++ }
++
++ ~StackPrinter()
++ {
++ fprintf(stdout, "%s: --end\n", msMsg.c_str());
++ }
++
++private:
++ ::std::string msMsg;
++};
++
++}
++
+ //------------------------------------------------------------------
+
+ ScXMLDataPilotTablesContext::ScXMLDataPilotTablesContext( ScXMLImport& rImport,
+@@ -126,6 +153,10 @@ ScXMLDataPilotTableContext::ScXMLDataPilotTableContext( ScXMLImport& rImport,
+ sDataPilotTableName(),
+ sApplicationData(),
+ sGrandTotal(GetXMLToken(XML_BOTH)),
++ mnRowFieldCount(0),
++ mnColFieldCount(0),
++ mnPageFieldCount(0),
++ mnDataFieldCount(0),
+ bIsNative(sal_True),
+ bIgnoreEmptyRows(sal_False),
+ bIdentifyCategories(sal_False),
+@@ -262,7 +293,13 @@ SvXMLImportContext *ScXMLDataPilotTableContext::CreateChildContext( USHORT nPref
+ }
+
+ void ScXMLDataPilotTableContext::SetButtons()
+-{
++{
++ ScDPOutputGeometry aGeometry(aTargetRangeAddress, bShowFilter);
++ aGeometry.setColumnFieldCount(mnColFieldCount);
++ aGeometry.setRowFieldCount(mnRowFieldCount);
++ aGeometry.setPageFieldCount(mnPageFieldCount);
++ aGeometry.setDataFieldCount(mnDataFieldCount);
++
+ OUString sAddress;
+ sal_Int32 nOffset = 0;
+ while( nOffset >= 0 )
+@@ -274,7 +311,13 @@ void ScXMLDataPilotTableContext::SetButtons()
+ sal_Int32 nAddrOffset(0);
+ if (pDoc && ScRangeStringConverter::GetAddressFromString( aScAddress, sAddress, pDoc, ::formula::FormulaGrammar::CONV_OOO, nAddrOffset ))
+ {
+- ScMergeFlagAttr aAttr( SC_MF_BUTTON );
++ ScDPOutputGeometry::FieldType eType = aGeometry.getFieldButtonType(aScAddress);
++
++ sal_Int16 nMFlag = SC_MF_BUTTON;
++ if (eType == ScDPOutputGeometry::Column || eType == ScDPOutputGeometry::Row)
++ nMFlag |= SC_MF_BUTTON_POPUP;
++
++ ScMergeFlagAttr aAttr(nMFlag);
+ pDoc->ApplyAttr( aScAddress.Col(), aScAddress.Row(), aScAddress.Tab(), aAttr );
+ }
+ }
+@@ -294,6 +337,33 @@ void ScXMLDataPilotTableContext::AddDimension(ScDPSaveDimension* pDim)
+ pDPSave->GetExistingDimensionByName(pDim->GetName()) )
+ pDim->SetDupFlag( TRUE );
+
++ OUString aStr;
++ ScXMLConverter::GetStringFromOrientation(aStr, static_cast<sheet::DataPilotFieldOrientation>(pDim->GetOrientation()));
++ fprintf(stdout, "ScXMLDataPilotTableContext::AddDimension: name = '%s'; orientation = '%s'\n",
++ rtl::OUStringToOString(pDim->GetName(), RTL_TEXTENCODING_UTF8).getStr(),
++ rtl::OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr());
++
++ if (!pDim->IsDataLayout())
++ {
++ switch (pDim->GetOrientation())
++ {
++ case sheet::DataPilotFieldOrientation_ROW:
++ ++mnRowFieldCount;
++ break;
++ case sheet::DataPilotFieldOrientation_COLUMN:
++ ++mnColFieldCount;
++ break;
++ case sheet::DataPilotFieldOrientation_PAGE:
++ ++mnPageFieldCount;
++ break;
++ case sheet::DataPilotFieldOrientation_DATA:
++ ++mnDataFieldCount;
++ break;
++ case sheet::DataPilotFieldOrientation_HIDDEN:
++ default:
++ ;
++ }
++ }
+ pDPSave->AddDimension(pDim);
+ }
+ }
+diff --git sc/source/filter/xml/xmldpimp.hxx sc/source/filter/xml/xmldpimp.hxx
+index 25450c3..548b18e 100644
+--- sc/source/filter/xml/xmldpimp.hxx
++++ sc/source/filter/xml/xmldpimp.hxx
+@@ -100,6 +100,10 @@ class ScXMLDataPilotTableContext : public SvXMLImportContext
+ ScAddress aFilterOutputPosition;
+ ScQueryParam aSourceQueryParam;
+ ScMySourceType nSourceType;
++ sal_uInt32 mnRowFieldCount;
++ sal_uInt32 mnColFieldCount;
++ sal_uInt32 mnPageFieldCount;
++ sal_uInt32 mnDataFieldCount;
+ sal_Bool bIsNative;
+ sal_Bool bIgnoreEmptyRows;
+ sal_Bool bIdentifyCategories;
+diff --git sc/source/ui/cctrl/dpcontrol.cxx sc/source/ui/cctrl/dpcontrol.cxx
+new file mode 100644
+index 0000000..043f996
+--- /dev/null
++++ sc/source/ui/cctrl/dpcontrol.cxx
+@@ -0,0 +1,166 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: document.hxx,v $
++ * $Revision: 1.115.36.9 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++// MARKER(update_precomp.py): autogen include statement, do not remove
++#include "precompiled_sc.hxx"
++
++// INCLUDE ---------------------------------------------------------------
++
++#include "dpcontrol.hxx"
++
++#include "vcl/outdev.hxx"
++#include "vcl/settings.hxx"
++
++using ::rtl::OUString;
++
++#include <stdio.h>
++#include <string>
++
++namespace {
++
++class StackPrinter
++{
++public:
++ explicit StackPrinter(const char* msg) :
++ msMsg(msg)
++ {
++ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
++ }
++
++ ~StackPrinter()
++ {
++ fprintf(stdout, "%s: --end\n", msMsg.c_str());
++ }
++
++private:
++ ::std::string msMsg;
++};
++
++}
++
++ScDPFieldButton::ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle) :
++ mpOutDev(pOutDev),
++ mpStyle(pStyle),
++ mbPopupButton(false)
++{
++}
++
++ScDPFieldButton::~ScDPFieldButton()
++{
++}
++
++void ScDPFieldButton::setText(const OUString& rText)
++{
++ maText = rText;
++}
++
++void ScDPFieldButton::setBoundingBox(const Point& rPos, const Size& rSize)
++{
++ maPos = rPos;
++ maSize = rSize;
++}
++
++void ScDPFieldButton::setDrawPopupButton(bool b)
++{
++ mbPopupButton = b;
++}
++
++void ScDPFieldButton::draw()
++{
++ StackPrinter __stack_printer__("ScDPFieldButton::Draw");
++
++ const long nMargin = 2;
++
++ Rectangle aRect(maPos, maSize);
++ mpOutDev->SetLineColor( mpStyle->GetDarkShadowColor() );
++ mpOutDev->SetFillColor( mpStyle->GetFaceColor() );
++ mpOutDev->DrawRect(aRect);
++
++ Point aTextPos;
++ long nTHeight = mpOutDev->GetTextHeight();
++ aTextPos.setX(maPos.getX() + nMargin);
++ aTextPos.setY(maPos.getY() + maSize.Height()/2 + nTHeight/3);
++ mpOutDev->DrawText(aTextPos, maText);
++
++ if (mbPopupButton)
++ drawPopupButton();
++}
++
++void ScDPFieldButton::getPopupBoundingBox(Point& rPos, Size& rSize) const
++{
++ long nW = maSize.getWidth()*0.2;
++ long nH = maSize.getHeight();
++ if (nW > 16)
++ nW = 16;
++ if (nH > 16)
++ nH = 16;
++
++ rPos.setX(maPos.getX() + maSize.getWidth() - nW);
++ rPos.setY(maPos.getY() + maSize.getHeight() - nH);
++ rSize.setWidth(nW);
++ rSize.setHeight(nH);
++}
++
++bool ScDPFieldButton::isPopupButton() const
++{
++ return mbPopupButton;
++}
++
++void ScDPFieldButton::drawPopupButton()
++{
++ Point aPos;
++ Size aSize;
++ getPopupBoundingBox(aPos, aSize);
++ Rectangle aRect(aPos, aSize);
++ mpOutDev->DrawRect(aRect);
++
++ Polygon aArrow(3);
++ Point center(aPos.X() + aSize.Width()/2, aPos.Y() + aSize.Height()/2);
++ Point a0(aPos.X() + (center.X()-aPos.X())*0.7, aPos.Y() + (center.Y()-aPos.Y())*0.75);
++ Point a1(center.X() + (center.X()-a0.X()), a0.Y());
++ Point a2(center.X(), center.Y()+(center.Y()-aPos.Y())*0.3);
++ aArrow.SetPoint(a0, 0);
++ aArrow.SetPoint(a1, 1);
++ aArrow.SetPoint(a2, 2);
++ mpOutDev->SetFillColor(mpStyle->GetDarkShadowColor());
++ mpOutDev->DrawPolygon(aArrow);
++}
++
++// ============================================================================
++
++ScDPFieldPopupWindow::ScDPFieldPopupWindow(Window* pParent) :
++ FloatingWindow(pParent, (WB_SYSTEMFLOATWIN|WB_SYSTEMWINDOW|WB_BORDER))
++{
++}
++
++ScDPFieldPopupWindow::~ScDPFieldPopupWindow()
++{
++ EndPopupMode();
++}
+diff --git sc/source/ui/cctrl/makefile.mk sc/source/ui/cctrl/makefile.mk
+index 4cce7f6..8e8add3 100644
+--- sc/source/ui/cctrl/makefile.mk
++++ sc/source/ui/cctrl/makefile.mk
+@@ -51,6 +51,7 @@ SLOFILES = \
+ $(SLO)$/popmenu.obj \
+ $(SLO)$/tbinsert.obj \
+ $(SLO)$/cbuttonw.obj \
++ $(SLO)$/dpcontrol.obj \
+ $(SLO)$/editfield.obj \
+ $(EXCEPTIONSFILES)
+
+@@ -59,6 +60,7 @@ LIB1OBJFILES= \
+ $(SLO)$/popmenu.obj \
+ $(SLO)$/tbinsert.obj \
+ $(SLO)$/cbuttonw.obj \
++ $(SLO)$/dpcontrol.obj \
+ $(SLO)$/tbzoomsliderctrl.obj
+
+ # --- Tagets -------------------------------------------------------
+diff --git sc/source/ui/inc/dpcontrol.hxx sc/source/ui/inc/dpcontrol.hxx
+new file mode 100644
+index 0000000..f957e4f
+--- /dev/null
++++ sc/source/ui/inc/dpcontrol.hxx
+@@ -0,0 +1,87 @@
++/*************************************************************************
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * Copyright 2008 by Sun Microsystems, Inc.
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * $RCSfile: document.hxx,v $
++ * $Revision: 1.115.36.9 $
++ *
++ * This file is part of OpenOffice.org.
++ *
++ * OpenOffice.org is free software: you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License version 3
++ * only, as published by the Free Software Foundation.
++ *
++ * OpenOffice.org is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU Lesser General Public License version 3 for more details
++ * (a copy is included in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * version 3 along with OpenOffice.org. If not, see
++ * <http://www.openoffice.org/license.html>
++ * for a copy of the LGPLv3 License.
++ *
++ ************************************************************************/
++
++#ifndef SC_DPCONTROL_HXX
++#define SC_DPCONTROL_HXX
++
++#include "rtl/ustring.hxx"
++#include "tools/gen.hxx"
++#include "vcl/floatwin.hxx"
++
++class OutputDevice;
++class Point;
++class Size;
++class StyleSettings;
++class Window;
++
++/**
++ * This class takes care of physically drawing field button controls inside
++ * data pilot tables.
++ */
++class ScDPFieldButton
++{
++public:
++ ScDPFieldButton(OutputDevice* pOutDev, const StyleSettings* pStyle);
++ ~ScDPFieldButton();
++
++ void setText(const ::rtl::OUString& rText);
++ void setBoundingBox(const Point& rPos, const Size& rSize);
++ void setDrawPopupButton(bool b);
++ void draw();
++
++ void getPopupBoundingBox(Point& rPos, Size& rSize) const;
++ bool isPopupButton() const;
++
++private:
++ void drawPopupButton();
++
++private:
++ Point maPos;
++ Size maSize;
++ ::rtl::OUString maText;
++ OutputDevice* mpOutDev;
++ const StyleSettings* mpStyle;
++ bool mbPopupButton;
++};
++
++// ============================================================================
++
++/**
++ * This class implements a popup window for field button, for quick access
++ * of hide-item list, and possbly more stuff related to field attributes.
++ */
++class ScDPFieldPopupWindow : public FloatingWindow
++{
++public:
++ explicit ScDPFieldPopupWindow(Window* pParent);
++ virtual ~ScDPFieldPopupWindow();
++};
++
++#endif
+diff --git sc/source/ui/inc/gridwin.hxx sc/source/ui/inc/gridwin.hxx
+index 2946c39..7cb3980 100644
+--- sc/source/ui/inc/gridwin.hxx
++++ sc/source/ui/inc/gridwin.hxx
+@@ -39,6 +39,7 @@
+ #include <svx/sdr/overlay/overlayobject.hxx>
+
+ #include <vector>
++#include <memory>
+
+ // ---------------------------------------------------------------------------
+
+@@ -48,6 +49,7 @@ class ScViewSelectionEngine;
+ class ScPivot;
+ #endif
+ class ScDPObject;
++class ScDPFieldPopupWindow;
+ class ScOutputData;
+ class ScFilterListBox;
+ class AutoFilterPopup;
+@@ -160,6 +162,7 @@ private:
+
+ ScFilterListBox* pFilterBox;
+ FloatingWindow* pFilterFloat;
++ ::std::auto_ptr<ScDPFieldPopupWindow> mpDPFieldPopup;
+
+ USHORT nCursorHideCount;
+
+@@ -245,6 +248,8 @@ private:
+ void DPMouseMove( const MouseEvent& rMEvt );
+ void DPMouseButtonUp( const MouseEvent& rMEvt );
+ void DPTestMouse( const MouseEvent& rMEvt, BOOL bMove );
++ bool DPTestFieldPopupArrow( const MouseEvent& rMEvt );
++ void DPLaunchFieldPopupMenu( const Point& rSrcPos, const Size& rSrcSize );
+
+ void RFMouseMove( const MouseEvent& rMEvt, BOOL bUp );
+
+diff --git sc/source/ui/view/gridwin.cxx sc/source/ui/view/gridwin.cxx
+index 3d7f3d4..078c55a 100644
+--- sc/source/ui/view/gridwin.cxx
++++ sc/source/ui/view/gridwin.cxx
+@@ -121,6 +121,7 @@
+ #include "cellsh.hxx"
+ #include "tabprotection.hxx"
+ #include "clipparam.hxx"
++#include "dpcontrol.hxx"
+
+ // #114409#
+ #include <vcl/salbtype.hxx> // FRound
+@@ -407,6 +408,7 @@ ScGridWindow::ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhic
+ pNoteMarker( NULL ),
+ pFilterBox( NULL ),
+ pFilterFloat( NULL ),
++ mpDPFieldPopup(NULL),
+ nCursorHideCount( 0 ),
+ bMarking( FALSE ),
+ nButtonDown( 0 ),
+diff --git sc/source/ui/view/gridwin2.cxx sc/source/ui/view/gridwin2.cxx
+index c6f589e..4de2cf2 100644
+--- sc/source/ui/view/gridwin2.cxx
++++ sc/source/ui/view/gridwin2.cxx
+@@ -55,12 +55,38 @@
+ #include "dpoutput.hxx" // ScDPPositionData
+ #include "dpshttab.hxx"
+ #include "dbdocfun.hxx"
++#include "dpcontrol.hxx"
+
+ #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
+ #include "scabstdlg.hxx" //CHINA001
+ using namespace com::sun::star;
+
+
++#include <stdio.h>
++#include <string>
++
++namespace {
++
++class StackPrinter
++{
++public:
++ explicit StackPrinter(const char* msg) :
++ msMsg(msg)
++ {
++ fprintf(stdout, "%s: --begin\n", msMsg.c_str());
++ }
++
++ ~StackPrinter()
++ {
++ fprintf(stdout, "%s: --end\n", msMsg.c_str());
++ }
++
++private:
++ ::std::string msMsg;
++};
++
++}
++
+ // STATIC DATA -----------------------------------------------------------
+
+ // -----------------------------------------------------------------------
+@@ -99,6 +125,7 @@ BOOL ScGridWindow::DoPageFieldSelection( SCCOL nCol, SCROW nRow )
+
+ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt )
+ {
++ StackPrinter __stack_printer__("ScGridWindow::DoPushButton");
+ ScDocument* pDoc = pViewData->GetDocument();
+ SCTAB nTab = pViewData->GetTabNo();
+
+@@ -196,14 +223,25 @@ void ScGridWindow::DoPushButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt
+ long nField = pDPObj->GetHeaderDim( aPos, nOrient );
+ if ( nField >= 0 )
+ {
++ fprintf(stdout, "ScGridWindow::DoPushButton: field button (%ld)\n", nField);
+ bDPMouse = TRUE;
+ nDPField = nField;
+ pDragDPObj = pDPObj;
++
++ if (DPTestFieldPopupArrow(rMEvt))
++ {
++ // field name pop up menu has been launched. Don't activate
++ // field move.
++ bDPMouse = false;
++ return;
++ }
++
+ DPTestMouse( rMEvt, TRUE );
+ StartTracking();
+ }
+ else if ( pDPObj->IsFilterButton(aPos) )
+ {
++ fprintf(stdout, "ScGridWindow::DoPushButton: filter button\n");
+ ReleaseMouse(); // may have been captured in ButtonDown
+
+ ScQueryParam aQueryParam;
+@@ -726,6 +764,43 @@ void ScGridWindow::DPTestMouse( const MouseEvent& rMEvt, BOOL bMove )
+ pViewData->GetView()->ResetTimer();
+ }
+
++bool ScGridWindow::DPTestFieldPopupArrow( const MouseEvent& rMEvt )
++{
++ Point aPixel = rMEvt.GetPosPixel();
++ SCsCOL nPosX;
++ SCsROW nPosY;
++ pViewData->GetPosFromPixel( aPixel.X(), aPixel.Y(), eWhich, nPosX, nPosY );
++
++ Point aSrcPos = pViewData->GetScrPos(nPosX, nPosY, eWhich);
++ long nSizeX, nSizeY;
++ pViewData->GetMergeSizePixel(nPosX, nPosY, nSizeX, nSizeY);
++ Size aSrcSize(nSizeX, nSizeY);
++
++ ScDPFieldButton aBtn(this, &GetSettings().GetStyleSettings());
++ aBtn.setBoundingBox(aSrcPos, aSrcSize);
++ Point aPopupPos;
++ Size aPopupSize;
++ aBtn.getPopupBoundingBox(aPopupPos, aPopupSize);
++ Rectangle aRec(aPopupPos, aPopupSize);
++ if (aRec.IsInside(aPixel))
++ {
++ DPLaunchFieldPopupMenu(aSrcPos, aSrcSize);
++ return true;
++ }
++
++ return false;
++}
++
++void ScGridWindow::DPLaunchFieldPopupMenu( const Point& rSrcPos, const Size& rSrcSize )
++{
++ StackPrinter __stack_printer__("ScGridWindow::DPLaunchFieldPopupMenu");
++ mpDPFieldPopup.reset(new ScDPFieldPopupWindow(this));
++ mpDPFieldPopup->SetPopupModeEndHdl( LINK( this, ScGridWindow, PopupModeEndHdl ) );
++ mpDPFieldPopup->SetOutputSizePixel(Size(100,100));
++ Rectangle aCellRect(OutputToScreenPixel(rSrcPos), rSrcSize);
++ mpDPFieldPopup->StartPopupMode(aCellRect, (FLOATWIN_POPUPMODE_DOWN | FLOATWIN_POPUPMODE_GRABFOCUS));
++}
++
+ void ScGridWindow::DPMouseMove( const MouseEvent& rMEvt )
+ {
+ DPTestMouse( rMEvt, TRUE );
+diff --git sc/source/ui/view/gridwin4.cxx sc/source/ui/view/gridwin4.cxx
+index 97f04ad..aa604ee 100644
+--- sc/source/ui/view/gridwin4.cxx
++++ sc/source/ui/view/gridwin4.cxx
+@@ -73,6 +73,7 @@
+ #include "editutil.hxx"
+ #include "inputopt.hxx"
+ #include "fillinfo.hxx"
++#include "dpcontrol.hxx"
+ #include "sc.hrc"
+ #include <vcl/virdev.hxx>
+
+@@ -1205,6 +1206,8 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
+ {
+ aComboButton.SetOutputDevice( pContentDev );
+
++ ScDPFieldButton aDPFieldBtn(pContentDev, &GetSettings().GetStyleSettings());
++
+ SCCOL nCol;
+ SCROW nRow;
+ SCSIZE nArrY;
+@@ -1307,12 +1310,17 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
+ CellInfo* pInfo = &pThisRowInfo->pCellInfo[nCol+1];
+ if ( pInfo->bPushButton && !pInfo->bHOverlapped && !pInfo->bVOverlapped )
+ {
++ fprintf(stdout, "ScGridWindow::DrawButtons: push button at (%d,%ld)\n", nCol,nRow);
+ Point aScrPos = pViewData->GetScrPos( nCol, nRow, eWhich );
+ long nSizeX;
+ long nSizeY;
+ pViewData->GetMergeSizePixel( nCol, nRow, nSizeX, nSizeY );
+ long nPosX = aScrPos.X();
+ long nPosY = aScrPos.Y();
++
++ fprintf(stdout, "ScGridWindow::DrawButtons: src pos = (%ld,%ld) size = (%ld,%ld)\n",
++ nPosX,nPosY,nSizeX,nSizeY);
++
+ if ( bLayoutRTL )
+ {
+ // overwrite the right, not left (visually) grid as long as the
+@@ -1320,13 +1328,12 @@ void ScGridWindow::DrawButtons( SCCOL nX1, SCROW /*nY1*/, SCCOL nX2, SCROW /*nY2
+ nPosX -= nSizeX - 2;
+ }
+
+- pContentDev->SetLineColor( GetSettings().GetStyleSettings().GetLightColor() );
+- pContentDev->DrawLine( Point(nPosX,nPosY), Point(nPosX,nPosY+nSizeY-1) );
+- pContentDev->DrawLine( Point(nPosX,nPosY), Point(nPosX+nSizeX-1,nPosY) );
+- pContentDev->SetLineColor( GetSettings().GetStyleSettings().GetDarkShadowColor() );
+- pContentDev->DrawLine( Point(nPosX,nPosY+nSizeY-1), Point(nPosX+nSizeX-1,nPosY+nSizeY-1) );
+- pContentDev->DrawLine( Point(nPosX+nSizeX-1,nPosY), Point(nPosX+nSizeX-1,nPosY+nSizeY-1) );
+- pContentDev->SetLineColor( COL_BLACK );
++ String aStr;
++ pDoc->GetString(nCol, nRow, nTab, aStr);
++ aDPFieldBtn.setText(aStr);
++ aDPFieldBtn.setBoundingBox(Point(nPosX,nPosY), Size(nSizeX,nSizeY));
++ aDPFieldBtn.setDrawPopupButton(pInfo->bPopupButton);
++ aDPFieldBtn.draw();
+ }
+ }
+ }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]