summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-04-04 09:07:22 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-04-04 09:35:20 +0100
commitd13f1ed261463ac2d27a5e071fb83c7f5fb7231c (patch)
tree02a43472d435a68f989d02484439d5358a915068 /sc
parentf19ca44a0451df84c5329e456765eef4886e644b (diff)
callcatcher: remove old pivot table dialog
Change-Id: I9e80a0d6661c29343103a27baa752cebbc876314
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_sc.mk6
-rw-r--r--sc/UIConfig_scalc.mk1
-rw-r--r--sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx862
-rw-r--r--sc/source/ui/dbgui/fieldwnd.cxx1506
-rw-r--r--sc/source/ui/dbgui/pvlaydlg.cxx1640
-rw-r--r--sc/source/ui/inc/AccessibleDataPilotControl.hxx140
-rw-r--r--sc/source/ui/inc/fieldwnd.hxx405
-rw-r--r--sc/source/ui/inc/pvlaydlg.hxx272
-rw-r--r--sc/source/ui/view/tabvwshc.cxx3
-rw-r--r--sc/uiconfig/scalc/ui/pivottablelayout.ui745
-rw-r--r--sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui12
11 files changed, 6 insertions, 5586 deletions
diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk
index 5c3801320071..05cefb6bf6a1 100644
--- a/sc/Library_sc.mk
+++ b/sc/Library_sc.mk
@@ -339,8 +339,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/Accessibility/AccessibleCellBase \
sc/source/ui/Accessibility/AccessibleContextBase \
sc/source/ui/Accessibility/AccessibleCsvControl \
- $(if $(filter TRUE,$(MPL_SUBSET)),, \
- sc/source/ui/Accessibility/AccessibleDataPilotControl) \
sc/source/ui/Accessibility/AccessibleDocument \
sc/source/ui/Accessibility/AccessibleDocumentBase \
sc/source/ui/Accessibility/AccessibleDocumentPagePreview \
@@ -390,13 +388,9 @@ $(eval $(call gb_Library_add_exception_objects,sc,\
sc/source/ui/dbgui/csvsplits \
sc/source/ui/dbgui/csvtablebox \
sc/source/ui/dbgui/dbnamdlg \
- $(if $(filter TRUE,$(MPL_SUBSET)),, \
- sc/source/ui/dbgui/fieldwnd) \
sc/source/ui/dbgui/filtdlg \
sc/source/ui/dbgui/foptmgr \
sc/source/ui/dbgui/imoptdlg \
- $(if $(filter TRUE,$(MPL_SUBSET)),, \
- sc/source/ui/dbgui/pvlaydlg) \
sc/source/ui/dbgui/PivotLayoutDialog \
sc/source/ui/dbgui/PivotLayoutTreeListBase \
sc/source/ui/dbgui/PivotLayoutTreeListData \
diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk
index 534b21bfacae..7035d2e379a8 100644
--- a/sc/UIConfig_scalc.mk
+++ b/sc/UIConfig_scalc.mk
@@ -128,7 +128,6 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\
sc/uiconfig/scalc/ui/paratemplatedialog \
sc/uiconfig/scalc/ui/pivotfielddialog \
sc/uiconfig/scalc/ui/pivotfilterdialog \
- sc/uiconfig/scalc/ui/pivottablelayout \
sc/uiconfig/scalc/ui/pivottablelayoutdialog \
sc/uiconfig/scalc/ui/printareasdialog \
sc/uiconfig/scalc/ui/printeroptions \
diff --git a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
deleted file mode 100644
index 32534899b8bd..000000000000
--- a/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
+++ /dev/null
@@ -1,862 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#include "AccessibleDataPilotControl.hxx"
-#include "fieldwnd.hxx"
-
-#include <com/sun/star/accessibility/AccessibleRole.hpp>
-#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
-#include <com/sun/star/accessibility/AccessibleStateType.hpp>
-#include <com/sun/star/accessibility/AccessibleEventId.hpp>
-#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
-#include <com/sun/star/accessibility/XAccessibleAction.hpp>
-#include <comphelper/accessiblekeybindinghelper.hxx>
-#include <com/sun/star/awt/KeyModifier.hpp>
-#include <vcl/keycodes.hxx>
-#include <vcl/settings.hxx>
-#include <unotools/accessiblerelationsethelper.hxx>
-#include <unotools/accessiblestatesethelper.hxx>
-#include <comphelper/servicehelper.hxx>
-#include <tools/gen.hxx>
-#include <toolkit/helper/convert.hxx>
-#include <vcl/svapp.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::accessibility;
-
-class ScAccessibleDataPilotButton
- : public ScAccessibleContextBase
- , public ::com::sun::star::accessibility::XAccessibleAction
-{
-public:
- //===== internal ========================================================
- ScAccessibleDataPilotButton(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent,
- ScDPFieldControlBase* pFieldWindow,
- sal_Int32 nIndex);
-
- virtual void Init() SAL_OVERRIDE;
-
- using ScAccessibleContextBase::disposing;
- virtual void SAL_CALL disposing() SAL_OVERRIDE;
-
- void SetIndex(sal_Int32 nIndex) { mnIndex = nIndex; }
- void NameChanged();
- void SetFocused();
- void ResetFocused();
-protected:
- virtual ~ScAccessibleDataPilotButton(void);
-public:
- // XAccessibleAction
- virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- ///===== XInterface =====================================================
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
- ::com::sun::star::uno::Type const & rType )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- virtual void SAL_CALL acquire() throw () SAL_OVERRIDE;
- virtual void SAL_CALL release() throw () SAL_OVERRIDE;
- ///===== XAccessibleComponent ============================================
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- SAL_CALL getAccessibleAtPoint(
- const ::com::sun::star::awt::Point& rPoint )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual sal_Bool SAL_CALL isVisible( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual void SAL_CALL grabFocus( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual sal_Int32 SAL_CALL getForeground( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual sal_Int32 SAL_CALL getBackground( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- ///===== XAccessibleContext ==============================================
-
- /// Return the number of currently visible children.
- virtual sal_Int32 SAL_CALL
- getAccessibleChildCount(void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the specified child or NULL if index is invalid.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleChild(sal_Int32 nIndex)
- throw (::com::sun::star::uno::RuntimeException,
- ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
-
- /// Return this objects index among the parents children.
- virtual sal_Int32 SAL_CALL
- getAccessibleIndexInParent(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the set of current states.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
- getAccessibleStateSet(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet >
- SAL_CALL getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
- ///===== XServiceInfo ====================================================
-
- /** Returns an identifier for the implementation of this object.
- */
- virtual OUString SAL_CALL
- getImplementationName(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- ///===== XTypeProvider ===================================================
-
- /** Returns a implementation id.
- */
- virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
- getImplementationId(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-protected:
- /// Return this object's description.
- virtual OUString SAL_CALL
- createAccessibleDescription(void)
- throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
-
- /// Return the object's current name.
- virtual OUString SAL_CALL
- createAccessibleName(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the object's current bounding box relative to the desktop.
- virtual Rectangle GetBoundingBoxOnScreen(void) const
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the object's current bounding box relative to the parent object.
- virtual Rectangle GetBoundingBox(void) const
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-private:
- ScDPFieldControlBase* mpFieldWindow;
- sal_Int32 mnIndex;
-};
-
- //===== internal ========================================================
-ScAccessibleDataPilotControl::ScAccessibleDataPilotControl(
- const uno::Reference<XAccessible>& rxParent,
- ScDPFieldControlBase* pFieldWindow)
- :
- ScAccessibleContextBase(rxParent, AccessibleRole::GROUP_BOX),
- mpFieldWindow(pFieldWindow)
-{
- if (mpFieldWindow)
- maChildren.resize(mpFieldWindow->GetFieldCount());
-}
-
-ScAccessibleDataPilotControl::~ScAccessibleDataPilotControl(void)
-{
- if (!IsDefunc() && !rBHelper.bInDispose)
- {
- // increment refcount to prevent double call off dtor
- osl_atomic_increment( &m_refCount );
- // call dispose to inform object which have a weak reference to this object
- dispose();
- }
-}
-
-void ScAccessibleDataPilotControl::Init()
-{
-}
-
-void SAL_CALL ScAccessibleDataPilotControl::disposing()
-{
- SolarMutexGuard aGuard;
- mpFieldWindow = NULL;
-
- ScAccessibleContextBase::disposing();
-}
-
-void ScAccessibleDataPilotControl::AddField(sal_Int32 nNewIndex)
-{
- sal_Bool bAdded(sal_False);
- if (static_cast<size_t>(nNewIndex) == maChildren.size())
- {
- maChildren.push_back(AccessibleWeak());
- bAdded = sal_True;
- }
- else if (static_cast<size_t>(nNewIndex) < maChildren.size())
- {
- ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nNewIndex;
- maChildren.insert(aItr, AccessibleWeak());
-
- ::std::vector < AccessibleWeak >::iterator aEndItr = maChildren.end();
- aItr = maChildren.begin() + nNewIndex + 1;
- uno::Reference< XAccessible > xTempAcc;
- sal_Int32 nIndex = nNewIndex + 1;
- while (aItr != aEndItr)
- {
- xTempAcc = aItr->xWeakAcc;
- if (xTempAcc.is() && aItr->pAcc)
- aItr->pAcc->SetIndex(nIndex);
- ++nIndex;
- ++aItr;
- }
- bAdded = sal_True;
- }
- else
- {
- OSL_FAIL("did not recognize a child count change");
- }
-
- if (bAdded)
- {
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::CHILD;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
- aEvent.NewValue <<= getAccessibleChild(nNewIndex);
-
- CommitChange(aEvent); // new child - event
- }
-}
-
-void ScAccessibleDataPilotControl::MoveField(sal_Int32 nOldIndex, sal_Int32 nNewIndex)
-{
- RemoveField(nOldIndex);
- if (nNewIndex > nOldIndex)
- --nNewIndex;
- AddField(nNewIndex);
-}
-
-void ScAccessibleDataPilotControl::RemoveField(sal_Int32 nOldIndex)
-{
- sal_Bool bRemoved(sal_False);
- uno::Reference< XAccessible > xTempAcc;
- ScAccessibleDataPilotButton* pField = NULL;
- if (static_cast<size_t>(nOldIndex) < maChildren.size())
- {
- xTempAcc = getAccessibleChild(nOldIndex);
- pField = maChildren[nOldIndex].pAcc;
-
- ::std::vector < AccessibleWeak >::iterator aItr = maChildren.begin() + nOldIndex;
- aItr = maChildren.erase(aItr);
-
- ::std::vector < AccessibleWeak >::iterator aEndItr = maChildren.end();
- uno::Reference< XAccessible > xItrAcc;
- while (aItr != aEndItr)
- {
- xItrAcc = aItr->xWeakAcc;
- if (xItrAcc.is() && aItr->pAcc)
- aItr->pAcc->SetIndex(nOldIndex);
- ++nOldIndex;
- ++aItr;
- }
- bRemoved = sal_True;
- }
- else
- {
- OSL_FAIL("did not recognize a child count change");
- }
-
- if (bRemoved)
- {
- AccessibleEventObject aEvent;
- aEvent.EventId = AccessibleEventId::CHILD;
- aEvent.Source = uno::Reference< XAccessibleContext >(this);
- aEvent.OldValue <<= xTempAcc;
-
- CommitChange(aEvent); // gone child - event
-
- if (pField)
- pField->dispose();
- }
-}
-
-void ScAccessibleDataPilotControl::FieldFocusChange(sal_Int32 nOldIndex, sal_Int32 nNewIndex)
-{
- if (0 <= nOldIndex && static_cast<size_t>(nOldIndex) < maChildren.size())
- {
- uno::Reference < XAccessible > xTempAcc = maChildren[nOldIndex].xWeakAcc;
- if (xTempAcc.is() && maChildren[nOldIndex].pAcc)
- maChildren[nOldIndex].pAcc->ResetFocused();
- }
- else
- {
- SAL_WARN( "sc", "ScAccessibleDataPilotControl::FieldFocusChange() old index out of bounds: " << nOldIndex);
- }
-
- if (0 <= nNewIndex && static_cast<size_t>(nNewIndex) < maChildren.size())
- {
- uno::Reference < XAccessible > xTempAcc = maChildren[nNewIndex].xWeakAcc;
- if (xTempAcc.is() && maChildren[nNewIndex].pAcc)
- maChildren[nNewIndex].pAcc->SetFocused();
- }
- else
- {
- SAL_WARN( "sc", "ScAccessibleDataPilotControl::FieldFocusChange() new index out of bounds: " << nNewIndex);
- }
-}
-
-void ScAccessibleDataPilotControl::FieldNameChange(sal_Int32 nIndex)
-{
- if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size())
- {
- uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
- if (xTempAcc.is() && maChildren[nIndex].pAcc)
- maChildren[nIndex].pAcc->ChangeName();
- }
- else
- {
- SAL_WARN( "sc", "ScAccessibleDataPilotControl::FieldNameChange() index out of bounds: " << nIndex);
- }
-}
-
-void ScAccessibleDataPilotControl::GotFocus()
-{
- if (mpFieldWindow)
- {
- OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
-
- if(maChildren.size()==0)
- return ;
-
- sal_Int32 nIndex(mpFieldWindow->GetSelectedField());
- if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size())
- {
- uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
- if (xTempAcc.is() && maChildren[nIndex].pAcc)
- maChildren[nIndex].pAcc->SetFocused();
- }
- else
- {
- SAL_WARN( "sc", "ScAccessibleDataPilotControl::GotFocus() field index out of bounds: " << nIndex);
- }
- }
-}
-
-void ScAccessibleDataPilotControl::LostFocus()
-{
- if (mpFieldWindow)
- {
- OSL_ENSURE(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
-
- if(maChildren.size()==0)
- return ;
-
- sal_Int32 nIndex(mpFieldWindow->GetSelectedField());
- if (0 <= nIndex && static_cast<size_t>(nIndex) < maChildren.size())
- {
- uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
- if (xTempAcc.is() && maChildren[nIndex].pAcc)
- maChildren[nIndex].pAcc->ResetFocused();
- }
- else
- {
- // This may actually happen if the last field is dropped somewhere
- // and was already removed from the pane by dragging it away. This
- // is odd.. looks like all LostFocus() are called for the previous
- // field of the same original pane in the remove case?
- SAL_WARN_IF( nIndex != -1 || !maChildren.empty(), "sc",
- "ScAccessibleDataPilotControl::LostFocus() field index out of bounds: " << nIndex);
- }
- }
-}
-
- ///===== XAccessibleComponent ============================================
-
-uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotControl::getAccessibleAtPoint(
- const awt::Point& rPoint )
- throw (uno::RuntimeException, std::exception)
-{
- uno::Reference<XAccessible> xAcc;
- if (containsPoint(rPoint))
- {
- SolarMutexGuard aGuard;
- IsObjectValid();
- if (mpFieldWindow)
- {
- Point aAbsPoint(VCLPoint(rPoint));
- Point aControlEdge(GetBoundingBoxOnScreen().TopLeft());
- Point aRelPoint(aAbsPoint - aControlEdge);
- size_t nChildIndex = mpFieldWindow->GetFieldIndex(aRelPoint );
- if( nChildIndex != PIVOTFIELD_INVALID )
- xAcc = getAccessibleChild(static_cast< long >( nChildIndex ));
- }
- }
- return xAcc;
-}
-
-sal_Bool SAL_CALL ScAccessibleDataPilotControl::isVisible( )
- throw (uno::RuntimeException, std::exception)
-{
- return sal_True;
-}
-
-void SAL_CALL ScAccessibleDataPilotControl::grabFocus( )
- throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- if (mpFieldWindow)
- mpFieldWindow->GrabFocus();
-}
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getForeground( )
- throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- sal_Int32 nColor(0);
- if (mpFieldWindow)
- {
- nColor = mpFieldWindow->GetSettings().GetStyleSettings().GetWindowTextColor().GetColor();
- }
- return nColor;
-}
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getBackground( )
- throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- sal_Int32 nColor(0);
- if (mpFieldWindow)
- {
- const StyleSettings& rStyleSett = mpFieldWindow->GetSettings().GetStyleSettings();
- nColor = (mpFieldWindow->GetFieldType() == PIVOTFIELDTYPE_SELECT) ? rStyleSett.GetFaceColor().GetColor() : rStyleSett.GetWindowColor().GetColor();
- }
- return nColor;
-}
-
- ///===== XAccessibleContext ==============================================
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotControl::getAccessibleChildCount(void)
- throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- return static_cast<sal_Int32>(maChildren.size());
-}
-
-uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotControl::getAccessibleChild(sal_Int32 nIndex)
- throw (uno::RuntimeException, lang::IndexOutOfBoundsException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- uno::Reference<XAccessible> xAcc;
- if (mpFieldWindow)
- {
- if (nIndex < 0 || static_cast< size_t >( nIndex ) >= maChildren.size())
- throw lang::IndexOutOfBoundsException();
-
- OSL_ENSURE( mpFieldWindow->GetFieldCount() == maChildren.size() // all except ...
- || mpFieldWindow->GetFieldCount() == maChildren.size() + 1, // in CommitChange during RemoveField
- "did not recognize a child count change");
-
- uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
- if (!xTempAcc.is())
- {
- if (static_cast< size_t >( nIndex ) >= mpFieldWindow->GetFieldCount())
- throw lang::IndexOutOfBoundsException();
-
- maChildren[nIndex].pAcc = new ScAccessibleDataPilotButton(this, mpFieldWindow, nIndex);
- xTempAcc = maChildren[nIndex].pAcc;
- maChildren[nIndex].xWeakAcc = xTempAcc;
- }
-
- xAcc = xTempAcc;
- }
- return xAcc;
-}
-
-uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotControl::getAccessibleStateSet(void)
- throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
-
- utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
-
- if (IsDefunc())
- pStateSet->AddState(AccessibleStateType::DEFUNC);
- else
- {
- pStateSet->AddState(AccessibleStateType::ENABLED);
- pStateSet->AddState(AccessibleStateType::OPAQUE);
- if (isShowing())
- pStateSet->AddState(AccessibleStateType::SHOWING);
- if (isVisible())
- pStateSet->AddState(AccessibleStateType::VISIBLE);
- }
-
- return pStateSet;
-}
-
- ///===== XServiceInfo ====================================================
-
-OUString SAL_CALL ScAccessibleDataPilotControl::getImplementationName(void)
- throw (uno::RuntimeException, std::exception)
-{
- return OUString("ScAccessibleDataPilotControl");
-}
-
- ///===== XTypeProvider ===================================================
-
-uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotControl::getImplementationId(void)
- throw (uno::RuntimeException, std::exception)
-{
- return css::uno::Sequence<sal_Int8>();
-}
-
- //===== internal ========================================================
-
-OUString SAL_CALL ScAccessibleDataPilotControl::createAccessibleDescription(void)
- throw (uno::RuntimeException)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- if (mpFieldWindow)
- return mpFieldWindow->GetDescription();
-
- return OUString();
-}
-
-OUString SAL_CALL ScAccessibleDataPilotControl::createAccessibleName(void)
- throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- if (mpFieldWindow)
- return mpFieldWindow->GetName();
-
- return OUString();
-}
-
-Rectangle ScAccessibleDataPilotControl::GetBoundingBoxOnScreen(void) const
- throw (uno::RuntimeException, std::exception)
-{
- if (mpFieldWindow)
- return mpFieldWindow->GetWindowExtentsRelative(NULL);
- else
- return Rectangle();
-}
-
-Rectangle ScAccessibleDataPilotControl::GetBoundingBox(void) const
- throw (uno::RuntimeException, std::exception)
-{
- if (mpFieldWindow)
- return mpFieldWindow->GetWindowExtentsRelative(mpFieldWindow->GetAccessibleParentWindow());
- else
- return Rectangle();
-}
-
-
-
-
-ScAccessibleDataPilotButton::ScAccessibleDataPilotButton(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent,
- ScDPFieldControlBase* pFieldWindow,
- sal_Int32 nIndex)
- : ScAccessibleContextBase(rxParent, AccessibleRole::BUTTON_MENU),
- mpFieldWindow(pFieldWindow),
- mnIndex(nIndex)
-{
-}
-
-ScAccessibleDataPilotButton::~ScAccessibleDataPilotButton(void)
-{
- if (!IsDefunc() && !rBHelper.bInDispose)
- {
- // increment refcount to prevent double call off dtor
- osl_atomic_increment( &m_refCount );
- // call dispose to inform object which have a weak reference to this object
- dispose();
- }
-}
-
-void ScAccessibleDataPilotButton::Init()
-{
-}
-
-void SAL_CALL ScAccessibleDataPilotButton::disposing()
-{
- SolarMutexGuard aGuard;
- mpFieldWindow = NULL;
-
- ScAccessibleContextBase::disposing();
-}
-
-void ScAccessibleDataPilotButton::SetFocused()
-{
- CommitFocusGained();
-}
-
-void ScAccessibleDataPilotButton::ResetFocused()
-{
- CommitFocusLost();
-}
-
- ///===== XAccessibleComponent ============================================
-
-uno::Reference< XAccessible > SAL_CALL ScAccessibleDataPilotButton::getAccessibleAtPoint(
- const ::com::sun::star::awt::Point& /* rPoint */ )
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- return NULL;
-}
-
-sal_Bool SAL_CALL ScAccessibleDataPilotButton::isVisible( )
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- return sal_True;
-}
-
-void SAL_CALL ScAccessibleDataPilotButton::grabFocus( )
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- if (mpFieldWindow)
- {
- mpFieldWindow->GrabFocusAndSelect(getAccessibleIndexInParent());
- }
-}
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getForeground( )
-throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- sal_Int32 nColor(0);
- if (mpFieldWindow)
- {
- nColor = mpFieldWindow->GetSettings().GetStyleSettings().GetButtonTextColor().GetColor();
- }
- return nColor;
-}
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getBackground( )
-throw (uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- sal_Int32 nColor(0);
- if (mpFieldWindow)
- {
- nColor = mpFieldWindow->GetSettings().GetStyleSettings().GetFaceColor().GetColor();
- }
- return nColor;
-}
-
- ///===== XAccessibleContext ==============================================
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getAccessibleChildCount(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- return 0;
-}
-
-uno::Reference< XAccessible> SAL_CALL ScAccessibleDataPilotButton::getAccessibleChild(sal_Int32 /* nIndex */)
- throw (::com::sun::star::uno::RuntimeException,
- ::com::sun::star::lang::IndexOutOfBoundsException, std::exception)
-{
- throw lang::IndexOutOfBoundsException();
-}
-
-sal_Int32 SAL_CALL ScAccessibleDataPilotButton::getAccessibleIndexInParent(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- return mnIndex;
-}
-
-uno::Reference<XAccessibleStateSet> SAL_CALL ScAccessibleDataPilotButton::getAccessibleStateSet(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
-
- utl::AccessibleStateSetHelper* pStateSet = new utl::AccessibleStateSetHelper();
-
- if (IsDefunc())
- pStateSet->AddState(AccessibleStateType::DEFUNC);
- else
- {
- pStateSet->AddState(AccessibleStateType::ENABLED);
- pStateSet->AddState(AccessibleStateType::OPAQUE);
- pStateSet->AddState(AccessibleStateType::FOCUSABLE);
- if (mpFieldWindow && (sal::static_int_cast<sal_Int32>(mpFieldWindow->GetSelectedField()) == mnIndex))
- pStateSet->AddState(AccessibleStateType::FOCUSED);
- if (isShowing())
- pStateSet->AddState(AccessibleStateType::SHOWING);
- if (isVisible())
- pStateSet->AddState(AccessibleStateType::VISIBLE);
- }
-
- return pStateSet;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet >
- SAL_CALL ScAccessibleDataPilotButton::getAccessibleRelationSet( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- SolarMutexGuard g;
-
- utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
- uno::Reference< com::sun::star::accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
- if(mxParent.is())
- {
- uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
- aSequence[0] = mxParent;
- pRelationSetHelper->AddRelation( com::sun::star::accessibility::AccessibleRelation(
- com::sun::star::accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
- }
-
- return xSet;
-
-}
-
-///===== XServiceInfo ====================================================
-
-OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- return OUString("ScAccessibleDataPilotButton");
-}
-
- ///===== XTypeProvider ===================================================
-
-uno::Sequence<sal_Int8> SAL_CALL ScAccessibleDataPilotButton::getImplementationId(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- return css::uno::Sequence<sal_Int8>();
-}
-
-OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void)
- throw (::com::sun::star::uno::RuntimeException)
-{
- SolarMutexGuard g;
-
- if (mpFieldWindow)
- return mpFieldWindow->GetHelpText();
- return OUString();
-}
-
-OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleName(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- SolarMutexGuard aGuard;
- IsObjectValid();
- if (mpFieldWindow)
- return mpFieldWindow->GetFieldText(getAccessibleIndexInParent());
-
- return OUString();
-}
-
-Rectangle ScAccessibleDataPilotButton::GetBoundingBoxOnScreen(void) const
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- Rectangle aRect(GetBoundingBox());
-
- if (mpFieldWindow)
- {
- Point aParentPos(mpFieldWindow->GetWindowExtentsRelative(NULL).TopLeft());
- aRect.Move(aParentPos.getX(), aParentPos.getY());
- }
-
- return aRect;
-}
-
-Rectangle ScAccessibleDataPilotButton::GetBoundingBox(void) const
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- if (mpFieldWindow)
- return Rectangle (mpFieldWindow->GetFieldPosition(const_cast<ScAccessibleDataPilotButton*> (this)->getAccessibleIndexInParent()), mpFieldWindow->GetFieldSize());
- else
- return Rectangle();
-}
-
-
-// XAccessibleAction
-
-sal_Int32 ScAccessibleDataPilotButton::getAccessibleActionCount( ) throw (uno::RuntimeException, std::exception)
-{
- return 1;
-}
-
-sal_Bool ScAccessibleDataPilotButton::doAccessibleAction ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception)
-{
- if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
- throw lang::IndexOutOfBoundsException();
- return sal_True;
-}
-
-OUString ScAccessibleDataPilotButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException, std::exception)
-{
- if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
- throw lang::IndexOutOfBoundsException();
- return OUString("press");
-}
-
-::com::sun::star::uno::Reference< XAccessibleKeyBinding > ScAccessibleDataPilotButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception)
-{
- SolarMutexGuard g;
-
- if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
- throw lang::IndexOutOfBoundsException();
- comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new comphelper::OAccessibleKeyBindingHelper();
- ::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
- ScDPFieldControlBase* pWindow = mpFieldWindow;
- if ( pWindow )
- {
- awt::KeyStroke aKeyStroke;
- aKeyStroke.Modifiers = 0;
- aKeyStroke.KeyCode = KEY_SPACE;
- pKeyBindingHelper->AddKeyBinding( aKeyStroke );
- }
- return xKeyBinding;
-}
-
-uno::Any SAL_CALL ScAccessibleDataPilotButton::queryInterface( uno::Type const & rType )
- throw (::com::sun::star::uno::RuntimeException, std::exception)
-{
- uno::Any aAny (ScAccessibleContextBase::queryInterface(rType));
- if(!aAny.hasValue())
- {
- aAny = ::cppu::queryInterface (rType,
- static_cast<XAccessibleAction*>(this)
- );
- }
- return aAny;
-}
-
-void SAL_CALL ScAccessibleDataPilotButton::acquire()
- throw ()
-{
- ScAccessibleContextBase::acquire();
-}
-
-void SAL_CALL ScAccessibleDataPilotButton::release()
- throw ()
-{
- ScAccessibleContextBase::release();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/fieldwnd.cxx b/sc/source/ui/dbgui/fieldwnd.cxx
deleted file mode 100644
index 788f029f498f..000000000000
--- a/sc/source/ui/dbgui/fieldwnd.cxx
+++ /dev/null
@@ -1,1506 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- ************************************************************************/
-
-#include <config_lgpl.h>
-
-#include "fieldwnd.hxx"
-
-#include <comphelper/string.hxx>
-#include <vcl/decoview.hxx>
-#include <vcl/help.hxx>
-#include <vcl/svapp.hxx>
-#include <vcl/virdev.hxx>
-#include <vcl/mnemonic.hxx>
-#include <vcl/settings.hxx>
-
-#include "pvlaydlg.hxx"
-#include "dpuiglobal.hxx"
-#include "calcmacros.hxx"
-#include "AccessibleDataPilotControl.hxx"
-#include "sc.hrc"
-#include "scresid.hxx"
-
-using namespace com::sun::star;
-using ::std::vector;
-using ::com::sun::star::uno::Reference;
-using ::com::sun::star::uno::WeakReference;
-using ::com::sun::star::accessibility::XAccessible;
-
-const size_t PIVOTFIELD_INVALID = static_cast< size_t >(-1);
-const size_t INVALID_INDEX = static_cast<size_t>(-1);
-
-#if DEBUG_PIVOT_TABLE
-using std::cout;
-using std::endl;
-#endif
-
-namespace {
-
-#if DEBUG_PIVOT_TABLE
-void DumpAllFuncData(const ScDPFieldControlBase::FuncDataType& rData)
-{
- cout << "---" << endl;
- ScDPFieldControlBase::FuncDataType::const_iterator it = rData.begin(), itEnd = rData.end();
- for (; it != itEnd; ++it)
- it->Dump();
-}
-#endif
-
-}
-
-ScDPFieldControlBase::FieldName::FieldName(const OUString& rText, bool bFits, sal_uInt8 nDupCount) :
- maText(rText), mbFits(bFits), mnDupCount(nDupCount) {}
-
-ScDPFieldControlBase::FieldName::FieldName(const FieldName& r) :
- maText(r.maText), mbFits(r.mbFits), mnDupCount(r.mnDupCount) {}
-
-OUString ScDPFieldControlBase::FieldName::getDisplayedText() const
-{
- OUStringBuffer aBuf(maText);
- if (mnDupCount > 0)
- aBuf.append(static_cast<sal_Int32>(mnDupCount+1));
- return aBuf.makeStringAndClear();
-}
-
-ScDPFieldControlBase::ScrollBar::ScrollBar(Window* pParent, WinBits nStyle) :
- ::ScrollBar(pParent, nStyle),
- mpParent(pParent)
-{
-}
-
-void ScDPFieldControlBase::ScrollBar::Command( const CommandEvent& rCEvt )
-{
- mpParent->Command(rCEvt);
-}
-
-ScDPFieldControlBase::AccessRef::AccessRef( const com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > & rAccessible ) : mxRef( rAccessible ) {}
-
-// easy, safe access to the backing accessible for the lifetime of AccessRef
-ScAccessibleDataPilotControl *ScDPFieldControlBase::AccessRef::operator -> () const
-{
- if (!mxRef.is())
- return NULL;
- return static_cast< ScAccessibleDataPilotControl * >( mxRef.get() );
-}
-
-ScDPFieldControlBase::ScDPFieldControlBase(Window* pParent)
- : Control(pParent)
- , mpDlg(NULL)
- , mpCaption(NULL)
- , mnFieldSelected(0)
-{
-}
-
-void ScDPFieldControlBase::Init( ScPivotLayoutDlg* pDlg, FixedText* pCaption )
-{
- mpDlg = pDlg;
- mpCaption = pCaption;
-
- if (pCaption)
- maName = MnemonicGenerator::EraseAllMnemonicChars( pCaption->GetText() );
-}
-
-ScDPFieldControlBase::~ScDPFieldControlBase()
-{
- AccessRef aRef( mxAccessible );
- if( aRef.is() )
- aRef->dispose();
-}
-
-OUString ScDPFieldControlBase::GetName() const
-{
- return maName;
-}
-
-void ScDPFieldControlBase::SetName(const OUString& rName)
-{
- maName = rName;
-}
-
-bool ScDPFieldControlBase::IsExistingIndex( size_t nIndex ) const
-{
- return nIndex < maFieldNames.size();
-}
-
-void ScDPFieldControlBase::AppendField( const OUString& rText, const ScPivotFuncData& rFunc )
-{
- size_t nNewIndex = maFieldNames.size();
-
- sal_uInt8 nDupCount = GetNextDupCount(rText);
- maFieldNames.push_back(FieldName(rText, true, nDupCount));
- maFuncData.push_back(new ScPivotFuncData(rFunc));
-
- AccessRef xRef(mxAccessible);
- if ( xRef.is() )
- xRef->AddField(nNewIndex);
-}
-
-size_t ScDPFieldControlBase::AddField(
- const OUString& rText, const Point& rPos, const ScPivotFuncData& rFunc)
-{
- size_t nNewIndex = GetFieldIndex(rPos);
- if (nNewIndex == PIVOTFIELD_INVALID)
- return PIVOTFIELD_INVALID;
-
- if (nNewIndex > maFieldNames.size())
- nNewIndex = maFieldNames.size();
-
- sal_uInt8 nDupCount = GetNextDupCount(rText);
- maFieldNames.insert(maFieldNames.begin() + nNewIndex, FieldName(rText, true, nDupCount));
-
- maFuncData.insert(maFuncData.begin() + nNewIndex, new ScPivotFuncData(rFunc));
- maFuncData.back().mnDupCount = nDupCount;
-
- mnFieldSelected = nNewIndex;
- ResetScrollBar();
- Invalidate();
-
- AccessRef xRef( mxAccessible );
- if ( xRef.is() )
- xRef->AddField(nNewIndex);
-
- return nNewIndex;
-}
-
-bool ScDPFieldControlBase::MoveField(size_t nCurPos, const Point& rPos, size_t& rnIndex)
-{
- if (nCurPos >= maFieldNames.size())
- // out-of-bound
- return false;
-
- size_t nNewIndex = GetFieldIndex(rPos);
- if (nNewIndex == PIVOTFIELD_INVALID)
- return false;
-
- if (nNewIndex == nCurPos)
- // Nothing to do.
- return true;
-
- FieldName aName = maFieldNames[nCurPos];
- ScPivotFuncData aFunc = maFuncData[nCurPos];
- if (nNewIndex >= maFieldNames.size())
- {
- // Move to the back.
- maFieldNames.erase(maFieldNames.begin()+nCurPos);
- maFieldNames.push_back(aName);
- maFuncData.erase(maFuncData.begin()+nCurPos);
- maFuncData.push_back(new ScPivotFuncData(aFunc));
- rnIndex = maFieldNames.size()-1;
- }
- else
- {
- maFieldNames.erase(maFieldNames.begin()+nCurPos);
- maFuncData.erase(maFuncData.begin()+nCurPos);
- size_t nTmp = nNewIndex; // we need to keep the original index for accessible.
- if (nNewIndex > nCurPos)
- --nTmp;
-
- maFieldNames.insert(maFieldNames.begin()+nTmp, aName);
- maFuncData.insert(maFuncData.begin()+nTmp, new ScPivotFuncData(aFunc));
- rnIndex = nTmp;
- }
-
- ResetScrollBar();
- Invalidate();
-
- AccessRef xRef( mxAccessible );
- if ( xRef.is() )
- xRef->MoveField(nCurPos, nNewIndex);
-
- return true;
-}
-
-void ScDPFieldControlBase::DeleteFieldByIndex( size_t nIndex )
-{
- if (!IsExistingIndex(nIndex))
- // Nothing to delete.
- return;
-
- AccessRef xRef(mxAccessible);
- if (xRef.is())
- xRef->RemoveField(nIndex);
-
-
- maFieldNames.erase(maFieldNames.begin() + nIndex);
- if (mnFieldSelected >= maFieldNames.size())
- mnFieldSelected = maFieldNames.size() - 1;
-
- maFuncData.erase(maFuncData.begin() + nIndex);
-
- ResetScrollBar();
- Invalidate();
-}
-
-size_t ScDPFieldControlBase::GetFieldCount() const
-{
- return maFieldNames.size();
-}
-
-bool ScDPFieldControlBase::IsEmpty() const
-{
- return maFieldNames.empty();
-}
-
-void ScDPFieldControlBase::ClearFields()
-{
- AccessRef xRef( mxAccessible );
- if ( xRef.is() )
- for( size_t nIdx = maFieldNames.size(); nIdx > 0; --nIdx )
- xRef->RemoveField( nIdx - 1 );
-
- maFieldNames.clear();
- maFuncData.clear();
-}
-
-void ScDPFieldControlBase::SetFieldText(const OUString& rText, size_t nIndex, sal_uInt8 nDupCount)
-{
- if( IsExistingIndex( nIndex ) )
- {
- maFieldNames[nIndex] = FieldName(rText, true, nDupCount);
- Invalidate();
-
- AccessRef xRef( mxAccessible );
- if ( xRef.is() )
- xRef->FieldNameChange(nIndex);
- }
-}
-
-OUString ScDPFieldControlBase::GetFieldText( size_t nIndex ) const
-{
- if( IsExistingIndex( nIndex ) )
- return maFieldNames[nIndex].maText;
- return OUString();
-}
-
-void ScDPFieldControlBase::GetExistingIndex( const Point& rPos, size_t& rnIndex )
-{
- if (maFieldNames.empty() || GetFieldType() == PIVOTFIELDTYPE_SELECT)
- {
- rnIndex = 0;
- return;
- }
-
- rnIndex = GetFieldIndex(rPos);
- if (rnIndex == PIVOTFIELD_INVALID)
- rnIndex = 0;
-}
-
-size_t ScDPFieldControlBase::GetSelectedField() const
-{
- return mnFieldSelected;
-}
-
-vector<ScDPFieldControlBase::FieldName>& ScDPFieldControlBase::GetFieldNames()
-{
- return maFieldNames;
-}
-
-const vector<ScDPFieldControlBase::FieldName>& ScDPFieldControlBase::GetFieldNames() const
-{
- return maFieldNames;
-}
-
-void ScDPFieldControlBase::Paint( const Rectangle& /* rRect */ )
-{
- // hiding the caption is now done from StateChanged
- Redraw();
-}
-
-void ScDPFieldControlBase::StateChanged( StateChangedType nStateChange )
-{
- Control::StateChanged( nStateChange );
-
- if( nStateChange == STATE_CHANGE_INITSHOW )
- {
- /* After the fixed text associated to this control has received its
- unique mnemonic from VCL dialog initialization code, put this text
- into the field windows.
- #124828# Hiding the FixedTexts and clearing the tab stop style bits
- has to be done after assigning the mnemonics, but Paint() is too
- late, because the test tool may send key events to the dialog when
- it isn't visible. Mnemonics are assigned in Dialog::StateChanged()
- for STATE_CHANGE_INITSHOW, so this can be done immediately
- afterwards. */
-
- if ( mpCaption )
- {
- SetText( mpCaption->GetText() );
- mpCaption->Hide();
- }
- }
-}
-
-void ScDPFieldControlBase::DataChanged( const DataChangedEvent& rDCEvt )
-{
- Control::DataChanged( rDCEvt );
- if( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
- Invalidate();
-}
-
-void ScDPFieldControlBase::Command( const CommandEvent& rCEvt )
-{
- if (rCEvt.GetCommand() == COMMAND_WHEEL)
- {
- const CommandWheelData* pData = rCEvt.GetWheelData();
- if (pData->GetMode() == COMMAND_WHEEL_SCROLL && !pData->IsHorz())
- {
- // Handle vertical mouse wheel scrolls.
- long nNotch = pData->GetNotchDelta(); // positive => up; negative => down
- HandleWheelScroll(nNotch);
- }
- }
-}
-
-void ScDPFieldControlBase::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if( rMEvt.IsLeft() )
- {
- size_t nNewSelectIndex = GetFieldIndex( rMEvt.GetPosPixel() );
- if (nNewSelectIndex != PIVOTFIELD_INVALID && IsExistingIndex(nNewSelectIndex))
- {
- // grabbing after GetFieldIndex() will prevent to focus empty window
- GrabFocusAndSelect( nNewSelectIndex );
-
- if( rMEvt.GetClicks() == 1 )
- {
- PointerStyle ePtr = mpDlg->NotifyMouseButtonDown( GetFieldType(), nNewSelectIndex );
- CaptureMouse();
- SetPointer( Pointer( ePtr ) );
- }
- else
- mpDlg->NotifyDoubleClick( GetFieldType(), nNewSelectIndex );
- }
- }
-}
-
-void ScDPFieldControlBase::MouseButtonUp( const MouseEvent& rMEvt )
-{
- if( rMEvt.IsLeft() )
- {
- if( rMEvt.GetClicks() == 1 )
- {
- Point aScrPos = OutputToScreenPixel(rMEvt.GetPosPixel());
- ScPivotFieldType eToType = mpDlg->GetFieldTypeAtPoint(aScrPos);
-
- mpDlg->DropFieldItem(aScrPos, eToType);
- SetPointer( Pointer( POINTER_ARROW ) );
- }
-
- if( IsMouseCaptured() )
- ReleaseMouse();
- }
-}
-
-void ScDPFieldControlBase::MouseMove( const MouseEvent& rMEvt )
-{
- if( IsMouseCaptured() )
- {
- Point aScrPos = OutputToScreenPixel(rMEvt.GetPosPixel());
- ScPivotFieldType eFieldType = mpDlg->GetFieldTypeAtPoint(aScrPos);
- PointerStyle ePtr = mpDlg->GetPointerStyle(eFieldType);
- SetPointer( Pointer( ePtr ) );
- }
- const FieldNames& rFields = GetFieldNames();
- size_t nIndex = GetFieldIndex(rMEvt.GetPosPixel());
- // does the string not fit on the screen ? show a helpful helptext instead
- if (nIndex != PIVOTFIELD_INVALID && (nIndex < rFields.size()) && !rFields[nIndex].mbFits)
- {
- Point aPos = OutputToScreenPixel( rMEvt.GetPosPixel() );
- Rectangle aRect( aPos, GetSizePixel() );
- OUString aHelpText = GetFieldText(nIndex);
- Help::ShowQuickHelp( this, aRect, aHelpText );
- }
-}
-
-void ScDPFieldControlBase::KeyInput( const KeyEvent& rKEvt )
-{
- const KeyCode& rKeyCode = rKEvt.GetKeyCode();
- sal_uInt16 nCode = rKeyCode.GetCode();
-
-
- const FieldNames& rFields = GetFieldNames();
- bool bFieldMove = ( rKeyCode.IsMod1() && (GetFieldType() != PIVOTFIELDTYPE_SELECT) );
- bool bKeyEvaluated = true;
- void (ScDPFieldControlBase::*pMoveXY) (SCsCOL nDX, SCsROW nDY);
- if (bFieldMove)
- pMoveXY = &ScDPFieldControlBase::MoveFieldRel;
- else
- pMoveXY = &ScDPFieldControlBase::MoveSelection;
- switch( nCode )
- {
- case KEY_UP: (this->*pMoveXY)( 0, -1 ); break;
- case KEY_DOWN: (this->*pMoveXY)( 0, 1 ); break;
- case KEY_LEFT: (this->*pMoveXY)( -1, 0 ); break;
- case KEY_RIGHT: (this->*pMoveXY)( 1, 0 ); break;
- case KEY_HOME:
- if (bFieldMove)
- MoveField( 0 );
- else
- {
- if( !rFields.empty() )
- MoveSelection( 0 );
- }
- break;
- case KEY_END:
- if (bFieldMove)
- MoveField( rFields.size() - 1 );
- else
- {
- if( !rFields.empty() )
- MoveSelection( rFields.size() - 1 );
- }
- break;
- default:
- if ( !bFieldMove && nCode == KEY_DELETE )
- mpDlg->NotifyRemoveField( GetFieldType(), mnFieldSelected );
- else
- bKeyEvaluated = false;
- break;
- }
-
- if (bKeyEvaluated)
- {
- ScrollToShowSelection();
- Invalidate();
- }
- else
- Control::KeyInput( rKEvt );
-}
-
-void ScDPFieldControlBase::GetFocus()
-{
- Control::GetFocus();
- Invalidate();
- if( GetGetFocusFlags() & GETFOCUS_MNEMONIC )
- {
- size_t nOldCount = GetFieldCount();
- mpDlg->NotifyMoveFieldToEnd( GetFieldType() );
- if (GetFieldCount() > nOldCount)
- // Scroll to the end only when a new field is inserted.
- ScrollToEnd();
- }
- else // notify change focus
- mpDlg->NotifyFieldFocus( GetFieldType(), true );
-
- AccessRef xRef( mxAccessible );
- if( xRef.is() )
- xRef->GotFocus();
-}
-
-void ScDPFieldControlBase::LoseFocus()
-{
- Control::LoseFocus();
- Invalidate();
- mpDlg->NotifyFieldFocus( GetFieldType(), false );
-
- AccessRef xRef( mxAccessible );
- if( xRef.is() )
- xRef->LostFocus();
-}
-
-Reference<XAccessible> ScDPFieldControlBase::CreateAccessible()
-{
- com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xReturn(new ScAccessibleDataPilotControl(GetAccessibleParentWindow()->GetAccessible(), this));
-
- mxAccessible = xReturn;
- AccessRef xRef( mxAccessible );
- xRef->Init();
-
- return xReturn;
-}
-
-void ScDPFieldControlBase::FieldFocusChanged(size_t nOldSelected, size_t nFieldSelected)
-{
- AccessRef xRef( mxAccessible );
- if ( xRef.is() )
- xRef->FieldFocusChange(nOldSelected, nFieldSelected);
-}
-
-void ScDPFieldControlBase::UpdateStyle()
-{
- WinBits nMask = ~(WB_TABSTOP | WB_NOTABSTOP);
- SetStyle( (GetStyle() & nMask) | (IsEmpty() ? WB_NOTABSTOP : WB_TABSTOP) );
-}
-
-void ScDPFieldControlBase::DrawBackground( OutputDevice& rDev )
-{
- const StyleSettings& rStyleSet = GetSettings().GetStyleSettings();
- Color aFaceColor = rStyleSet.GetFaceColor();
- Color aWinColor = rStyleSet.GetWindowColor();
- Color aWinTextColor = rStyleSet.GetWindowTextColor();
-
- Point aPos0;
- Size aSize( GetSizePixel() );
-
- if (mpCaption)
- {
- rDev.SetLineColor( aWinTextColor );
- rDev.SetFillColor( aWinColor );
- }
- else
- {
- rDev.SetLineColor( aFaceColor );
- rDev.SetFillColor( aFaceColor );
- }
- rDev.DrawRect( Rectangle( aPos0, aSize ) );
-
- rDev.SetTextColor( aWinTextColor );
-
- /* Draw the caption text. This needs some special handling, because we
- support hard line breaks here. This part will draw each line of the
- text for itself. */
-
- sal_Int32 nTokenCnt = comphelper::string::getTokenCount(GetText(), '\n');
- long nY = (aSize.Height() - nTokenCnt * rDev.GetTextHeight()) / 2;
- sal_Int32 nStringIx = 0;
- for( sal_Int32 nToken = 0; nToken < nTokenCnt; ++nToken )
- {
- OUString aLine( GetText().getToken( 0, '\n', nStringIx ) );
- Point aLinePos( (aSize.Width() - rDev.GetCtrlTextWidth( aLine )) / 2, nY );
- rDev.DrawCtrlText( aLinePos, aLine );
- nY += rDev.GetTextHeight();
- }
-}
-
-void ScDPFieldControlBase::DrawField(
- OutputDevice& rDev, const Rectangle& rRect, FieldName& rText, bool bFocus )
-{
- const StyleSettings& rStyleSet = GetSettings().GetStyleSettings();
- Color aTextColor = rStyleSet.GetButtonTextColor();
-
- VirtualDevice aVirDev( rDev );
- // #i97623# VirtualDevice is always LTR while other windows derive direction from parent
- aVirDev.EnableRTL( IsRTLEnabled() );
-
- OUString aText = rText.getDisplayedText();
-
- Size aDevSize( rRect.GetSize() );
- long nWidth = aDevSize.Width();
- long nHeight = aDevSize.Height();
- long nLabelWidth = rDev.GetTextWidth( aText );
- long nLabelHeight = rDev.GetTextHeight();
-
- // #i31600# if text is too long, cut and add ellipsis
- rText.mbFits = nLabelWidth + 6 <= nWidth;
- if (!rText.mbFits)
- {
- sal_Int32 nMinLen = 0;
- sal_Int32 nMaxLen = aText.getLength();
- bool bFits = false;
- do
- {
- sal_Int32 nCurrLen = (nMinLen + nMaxLen) / 2;
- OUStringBuffer aBuf(rText.maText.copy(0, nCurrLen));
- aBuf.appendAscii("...");
- aText = aBuf.makeStringAndClear();
- nLabelWidth = rDev.GetTextWidth( aText );
- bFits = nLabelWidth + 6 <= nWidth;
- (bFits ? nMinLen : nMaxLen) = nCurrLen;
- }
- while( !bFits || (nMinLen + 1 < nMaxLen) );
- }
- Point aLabelPos( (nWidth - nLabelWidth) / 2, ::std::max< long >( (nHeight - nLabelHeight) / 2, 3 ) );
-
- aVirDev.SetOutputSizePixel( aDevSize );
- aVirDev.SetFont( rDev.GetFont() );
- DecorationView aDecoView( &aVirDev );
- aDecoView.DrawButton( Rectangle( Point( 0, 0 ), aDevSize ), bFocus ? BUTTON_DRAW_DEFAULT : 0 );
- aVirDev.SetTextColor( aTextColor );
- aVirDev.DrawText( aLabelPos, aText );
- rDev.DrawBitmap( rRect.TopLeft(), aVirDev.GetBitmap( Point( 0, 0 ), aDevSize ) );
-}
-
-void ScDPFieldControlBase::AppendPaintable(Window* p)
-{
- maPaintables.push_back(p);
-}
-
-void ScDPFieldControlBase::DrawPaintables()
-{
- Rectangle aRect(GetPosPixel(), GetSizePixel());
- Paintables::iterator itr = maPaintables.begin(), itrEnd = maPaintables.end();
- for (; itr != itrEnd; ++itr)
- {
- Window* p = *itr;
- if (!p->IsVisible())
- continue;
-
- p->Paint(aRect);
- }
-}
-
-void ScDPFieldControlBase::DrawInvertSelection()
-{
- if (!HasFocus())
- return;
-
- if (mnFieldSelected >= maFieldNames.size())
- return;
-
- size_t nPos = GetDisplayPosition(mnFieldSelected);
- if (nPos == INVALID_INDEX)
- return;
-
- Size aFldSize = GetFieldSize();
- long nFldWidth = aFldSize.Width();
- long nSelWidth = std::min<long>(
- GetTextWidth(maFieldNames[mnFieldSelected].getDisplayedText()) + 4, nFldWidth - 6);
-
- Point aPos = GetFieldPosition(nPos);
- aPos += Point((nFldWidth - nSelWidth) / 2, 3);
- Size aSize(nSelWidth, aFldSize.Height() - 6);
-
- Rectangle aSel(aPos, aSize);
- InvertTracking(aSel, SHOWTRACK_SMALL | SHOWTRACK_WINDOW);
-}
-
-Size ScDPFieldControlBase::GetStdFieldBtnSize() const
-{
- return Size(approximate_char_width() * 8, FIELD_BTN_HEIGHT);
-}
-
-void ScDPFieldControlBase::MoveField( size_t nDestIndex )
-{
- if (nDestIndex != mnFieldSelected)
- {
- std::swap(maFieldNames[nDestIndex], maFieldNames[mnFieldSelected]);
- std::swap(maFuncData[nDestIndex], maFuncData[mnFieldSelected]);
- mnFieldSelected = nDestIndex;
- }
-}
-
-void ScDPFieldControlBase::MoveFieldRel( SCsCOL nDX, SCsROW nDY )
-{
- MoveField( CalcNewFieldIndex( nDX, nDY ) );
-}
-
-void ScDPFieldControlBase::MoveSelection(size_t nIndex)
-{
- FieldNames& rFields = GetFieldNames();
- if (rFields.empty())
- return;
-
- if (nIndex >= rFields.size())
- // Prevent it from going out-of-bound.
- nIndex = rFields.size() - 1;
-
- if( mnFieldSelected != nIndex )
- {
- size_t nOldSelected = mnFieldSelected;
- mnFieldSelected = nIndex;
- Invalidate();
-
- if (HasFocus())
- FieldFocusChanged(nOldSelected, mnFieldSelected);
- }
-
- ScrollToShowSelection();
-}
-
-void ScDPFieldControlBase::MoveSelection(SCsCOL nDX, SCsROW nDY)
-{
- size_t nNewIndex = CalcNewFieldIndex( nDX, nDY );
- MoveSelection( nNewIndex );
-}
-
-sal_uInt8 ScDPFieldControlBase::GetNextDupCount(const OUString& rFieldText) const
-{
- sal_uInt8 nMax = 0;
- FieldNames::const_iterator it = maFieldNames.begin(), itEnd = maFieldNames.end();
- for (; it != itEnd; ++it)
- {
- if (it->maText != rFieldText)
- continue;
-
- sal_uInt8 nNextUp = it->mnDupCount + 1;
- if (nMax < nNextUp)
- nMax = nNextUp;
- }
- return nMax;
-}
-
-sal_uInt8 ScDPFieldControlBase::GetNextDupCount(const ScPivotFuncData& rData, size_t nSelfIndex) const
-{
- sal_uInt8 nDupCount = 0;
- bool bFound = false;
- for (size_t i = 0, n = maFuncData.size(); i < n; ++i)
- {
- if (i == nSelfIndex)
- // Skip itself.
- continue;
-
- const ScPivotFuncData& r = maFuncData[i];
-
- if (r.mnCol != rData.mnCol || r.mnFuncMask != rData.mnFuncMask)
- continue;
-
- bFound = true;
- if (r.mnDupCount > nDupCount)
- nDupCount = r.mnDupCount;
- }
-
- return bFound ? nDupCount + 1 : 0;
-}
-
-void ScDPFieldControlBase::SelectNext()
-{
- MoveSelection(mnFieldSelected + 1);
-}
-
-void ScDPFieldControlBase::GrabFocusAndSelect( size_t nIndex )
-{
- MoveSelection( nIndex );
- if( !HasFocus() )
- GrabFocus();
-}
-
-const ScPivotFuncData& ScDPFieldControlBase::GetFuncData(size_t nIndex) const
-{
- return maFuncData.at(nIndex);
-}
-
-ScPivotFuncData& ScDPFieldControlBase::GetFuncData(size_t nIndex)
-{
- return maFuncData.at(nIndex);
-}
-
-namespace {
-
-class PushFuncItem : std::unary_function<ScPivotFuncData, void>
-{
- std::vector<ScDPFieldControlBase::FuncItem>& mrItems;
-public:
- PushFuncItem(std::vector<ScDPFieldControlBase::FuncItem>& rItems) : mrItems(rItems) {}
-
- void operator() (const ScPivotFuncData& r)
- {
- ScDPFieldControlBase::FuncItem aItem;
- aItem.mnCol = r.mnCol;
- aItem.mnFuncMask = r.mnFuncMask;
- mrItems.push_back(aItem);
- }
-};
-
-}
-
-void ScDPFieldControlBase::GetAllFuncItems(std::vector<FuncItem>& rItems) const
-{
- std::for_each(maFuncData.begin(), maFuncData.end(), PushFuncItem(rItems));
-}
-
-namespace {
-
-class PivotFieldInserter : public ::std::unary_function<ScPivotFuncData, void>
-{
- vector<ScPivotField>& mrFields;
-public:
- explicit PivotFieldInserter(vector<ScPivotField>& r, size_t nSize) : mrFields(r)
- {
- mrFields.reserve(nSize);
- }
-
- PivotFieldInserter(const PivotFieldInserter& r) : mrFields(r.mrFields) {}
-
- void operator() (const ScPivotFuncData& r)
- {
- ScPivotField aField;
- aField.nCol = r.mnCol;
- aField.mnOriginalDim = r.mnOriginalDim;
- aField.mnDupCount = r.mnDupCount;
- aField.nFuncMask = r.mnFuncMask;
- aField.maFieldRef = r.maFieldRef;
- mrFields.push_back(aField);
- }
-};
-
-}
-
-void ScDPFieldControlBase::ConvertToPivotArray(std::vector<ScPivotField>& rArray) const
-{
- for_each(maFuncData.begin(), maFuncData.end(), PivotFieldInserter(rArray, maFuncData.size()));
-}
-
-namespace {
-
-class EqualByDimOnly : std::unary_function<ScPivotFuncData, bool>
-{
- const ScPivotFuncData& mrData;
- long mnDim;
-
-public:
- EqualByDimOnly(const ScPivotFuncData& rData) : mrData(rData)
- {
- mnDim = rData.mnCol;
- if (rData.mnOriginalDim >= 0)
- mnDim = rData.mnOriginalDim;
- }
- bool operator() (const ScPivotFuncData& rData) const
- {
- long nDim = rData.mnCol;
- if (rData.mnOriginalDim >= 0)
- nDim = rData.mnOriginalDim;
-
- return nDim == mnDim;
- }
-};
-
-}
-
-size_t ScDPFieldControlBase::GetFieldIndexByData( const ScPivotFuncData& rData ) const
-{
- FuncDataType::const_iterator it = std::find_if(maFuncData.begin(), maFuncData.end(), EqualByDimOnly(rData));
- return it == maFuncData.end() ? PIVOTFIELD_INVALID : std::distance(maFuncData.begin(), it);
-}
-
-void ScDPFieldControlBase::Resize()
-{
- Control::Resize();
- CalcSize();
-}
-
-
-
-ScDPHorFieldControl::ScDPHorFieldControl ( Window* pParent ) :
- ScDPFieldControlBase( pParent ),
- maScroll(this, WB_HORZ | WB_DRAG),
- mnFieldBtnRowCount(0),
- mnFieldBtnColCount(0)
-{
- maScroll.SetScrollHdl( LINK(this, ScDPHorFieldControl, ScrollHdl) );
- maScroll.SetEndScrollHdl( LINK(this, ScDPHorFieldControl, EndScrollHdl) );
- maScroll.Hide();
-
- AppendPaintable(&maScroll);
-}
-
-ScDPHorFieldControl::~ScDPHorFieldControl()
-{
-}
-
-Point ScDPHorFieldControl::GetFieldPosition( size_t nIndex )
-{
- Point aPos;
- Size aSize;
- GetFieldBtnPosSize(nIndex, aPos, aSize);
- return aPos;
-}
-
-Size ScDPHorFieldControl::GetFieldSize() const
-{
- return GetStdFieldBtnSize();
-}
-
-size_t ScDPHorFieldControl::GetFieldIndex( const Point& rPos )
-{
- if (rPos.X() < 0 || rPos.Y() < 0)
- return PIVOTFIELD_INVALID;
-
- Size aWndSize = GetSizePixel();
- if (rPos.X() > aWndSize.Width() || rPos.Y() > aWndSize.Height())
- return PIVOTFIELD_INVALID;
-
- size_t nX = rPos.X();
- size_t nY = rPos.Y();
- size_t nW = aWndSize.Width();
- size_t nH = aWndSize.Height();
-
- Size aFldSize = GetFieldSize();
- size_t nCurX = OUTER_MARGIN_HOR + aFldSize.Width() + ROW_FIELD_BTN_GAP/2;
- size_t nCurY = OUTER_MARGIN_VER + aFldSize.Height() + ROW_FIELD_BTN_GAP/2;
- size_t nCol = 0;
- size_t nRow = 0;
- while (nX > nCurX && nCurX <= nW)
- {
- nCurX += aFldSize.Width() + ROW_FIELD_BTN_GAP;
- ++nCol;
- }
- while (nY > nCurY && nCurY <= nH)
- {
- nCurY += aFldSize.Height() + ROW_FIELD_BTN_GAP;
- ++nRow;
- }
-
- size_t nOffset = maScroll.GetThumbPos();
- nCol += nOffset; // convert to logical column ID.
- size_t nIndex = nCol * mnFieldBtnRowCount + nRow;
- size_t nFldCount = GetFieldCount();
- if (nIndex > nFldCount)
- nIndex = nFldCount;
- return IsValidIndex(nIndex) ? nIndex : PIVOTFIELD_INVALID;
-}
-
-void ScDPHorFieldControl::Redraw()
-{
- VirtualDevice aVirDev;
- // #i97623# VirtualDevice is always LTR while other windows derive direction from parent
- aVirDev.EnableRTL( IsRTLEnabled() );
- aVirDev.SetMapMode( MAP_PIXEL );
-
- Point aPos0;
- Size aSize( GetSizePixel() );
- Font aFont( GetFont() ); // Font vom Window
- aFont.SetTransparent( true );
- aVirDev.SetFont( aFont );
- aVirDev.SetOutputSizePixel( aSize );
-
- DrawBackground( aVirDev );
-
- FieldNames& rFields = GetFieldNames();
- {
- long nScrollOffset = maScroll.GetThumbPos();
- FieldNames::iterator itr = rFields.begin(), itrEnd = rFields.end();
- if (nScrollOffset)
- ::std::advance(itr, nScrollOffset*mnFieldBtnRowCount);
-
- for (size_t i = 0; itr != itrEnd; ++itr, ++i)
- {
- Point aFldPt;
- Size aFldSize;
- if (!GetFieldBtnPosSize(i, aFldPt, aFldSize))
- break;
-
- size_t nField = i + nScrollOffset*mnFieldBtnRowCount;
- bool bFocus = HasFocus() && (nField == GetSelectedField());
- DrawField(aVirDev, Rectangle(aFldPt, aFldSize), *itr, bFocus);
- }
- }
-
- DrawBitmap( aPos0, aVirDev.GetBitmap( aPos0, aSize ) );
- DrawPaintables();
- DrawInvertSelection();
- UpdateStyle();
-}
-
-void ScDPHorFieldControl::CalcSize()
-{
- Size aWndSize = GetSizePixel();
-
- long nScrollSize = GetSettings().GetStyleSettings().GetScrollBarSize();
- maScroll.SetSizePixel(Size(aWndSize.Width() - OUTER_MARGIN_HOR*2, nScrollSize));
- maScroll.SetPosPixel(Point(OUTER_MARGIN_HOR, aWndSize.Height() - OUTER_MARGIN_VER - nScrollSize));
-
- long nTotalH = aWndSize.Height() - nScrollSize - OUTER_MARGIN_VER*2;
- long nTotalW = aWndSize.Width() - OUTER_MARGIN_HOR*2;
- mnFieldBtnRowCount = nTotalH / (GetFieldSize().Height() + ROW_FIELD_BTN_GAP);
- mnFieldBtnColCount = (nTotalW + ROW_FIELD_BTN_GAP) / (GetFieldSize().Width() + ROW_FIELD_BTN_GAP);
-
- maScroll.SetLineSize(1);
- maScroll.SetVisibleSize(mnFieldBtnColCount);
- maScroll.SetPageSize(mnFieldBtnColCount);
- maScroll.SetRange(Range(0, mnFieldBtnColCount));
-
- ResetScrollBar();
-}
-
-bool ScDPHorFieldControl::IsValidIndex(size_t /*nIndex*/) const
-{
- return true;
-}
-
-size_t ScDPHorFieldControl::CalcNewFieldIndex(SCsCOL nDX, SCsROW nDY) const
-{
- size_t nSel = GetSelectedField();
- size_t nFldCount = GetFieldCount();
- SCsROW nRow = nSel % mnFieldBtnRowCount;
- SCsCOL nCol = nSel / mnFieldBtnRowCount;
- SCsCOL nColUpper = static_cast<SCsCOL>(ceil(
- static_cast<double>(nFldCount) / static_cast<double>(mnFieldBtnRowCount)) - 1);
- SCsROW nRowUpper = mnFieldBtnRowCount - 1;
-
- nCol += nDX;
- if (nCol < 0)
- nCol = 0;
- else if (nColUpper < nCol)
- nCol = nColUpper;
- nRow += nDY;
- if (nRow < 0)
- nRow = 0;
- else if (nRowUpper < nRow)
- nRow = nRowUpper;
-
- nSel = nCol*mnFieldBtnRowCount + nRow;
- if (nSel >= nFldCount)
- nSel = nFldCount - 1;
-
- return nSel;
-}
-
-size_t ScDPHorFieldControl::GetDisplayPosition(size_t nIndex) const
-{
- size_t nColFirst = maScroll.GetThumbPos();
- size_t nColLast = nColFirst + mnFieldBtnColCount - 1;
- size_t nCol = nIndex / mnFieldBtnRowCount;
- size_t nRow = nIndex % mnFieldBtnRowCount;
- if (nCol < nColFirst || nColLast < nCol)
- // index is outside the visible area.
- return INVALID_INDEX;
-
- size_t nPos = (nCol - nColFirst)*mnFieldBtnRowCount + nRow;
- return nPos;
-}
-
-OUString ScDPHorFieldControl::GetDescription() const
-{
- return ScResId(STR_ACC_DATAPILOT_COL_DESCR);
-}
-
-void ScDPHorFieldControl::ScrollToEnd()
-{
- maScroll.DoScroll(maScroll.GetRangeMax());
-}
-
-void ScDPHorFieldControl::ScrollToShowSelection()
-{
- size_t nLower = maScroll.GetThumbPos();
- size_t nUpper = nLower + mnFieldBtnColCount - 1;
- size_t nCol = GetSelectedField() / mnFieldBtnRowCount;
- if (nCol < nLower)
- {
- // scroll to left.
- maScroll.DoScroll(nCol);
- }
- else if (nUpper < nCol)
- {
- // scroll to right.
- maScroll.DoScroll(nCol - mnFieldBtnColCount + 1);
- }
-}
-
-void ScDPHorFieldControl::ResetScrollBar()
-{
- long nOldMax = maScroll.GetRangeMax();
- long nNewMax = static_cast<long>(ceil(
- static_cast<double>(GetFieldCount()) / static_cast<double>(mnFieldBtnRowCount)));
-
- if (nOldMax != nNewMax)
- {
- maScroll.SetRangeMax(nNewMax);
- bool bShow = mnFieldBtnColCount*mnFieldBtnRowCount < GetFieldCount();
- maScroll.Show(bShow);
- }
-}
-
-void ScDPHorFieldControl::HandleWheelScroll(long /*nNotch*/)
-{
- // not handled for horizontal field controls.
-}
-
-bool ScDPHorFieldControl::GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize)
-{
- if (nPos >= mnFieldBtnColCount*mnFieldBtnRowCount)
- return false;
-
- Point aPos = Point(OUTER_MARGIN_HOR, OUTER_MARGIN_VER);
- size_t nRow = nPos % mnFieldBtnRowCount;
- size_t nCol = nPos / mnFieldBtnRowCount;
-
- aPos.X() += nCol*(GetFieldSize().Width() + ROW_FIELD_BTN_GAP);
- aPos.Y() += nRow*(GetFieldSize().Height() + ROW_FIELD_BTN_GAP);
-
- rPos = aPos;
- rSize = GetFieldSize();
- return true;
-}
-
-void ScDPHorFieldControl::HandleScroll()
-{
- Redraw();
-}
-
-IMPL_LINK_NOARG(ScDPHorFieldControl, ScrollHdl)
-{
- HandleScroll();
- return 0;
-}
-
-IMPL_LINK_NOARG(ScDPHorFieldControl, EndScrollHdl)
-{
- HandleScroll();
- return 0;
-}
-
-
-
-ScDPPageFieldControl::ScDPPageFieldControl ( Window* pParent ) :
- ScDPHorFieldControl( pParent )
-{
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScDPPageFieldControl( Window *pParent, VclBuilder::stringmap & )
-{
- return new ScDPPageFieldControl( pParent );
-}
-
-
-ScDPPageFieldControl::~ScDPPageFieldControl()
-{
-}
-
-ScPivotFieldType ScDPPageFieldControl::GetFieldType() const
-{
- return PIVOTFIELDTYPE_PAGE;
-}
-
-OUString ScDPPageFieldControl::GetDescription() const
-{
- return ScResId(STR_ACC_DATAPILOT_PAGE_DESCR);
-}
-
-
-
-ScDPColFieldControl::ScDPColFieldControl ( Window* pParent ) :
- ScDPHorFieldControl( pParent )
-{
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScDPColFieldControl( Window *pParent, VclBuilder::stringmap & )
-{
- return new ScDPColFieldControl( pParent );
-}
-
-ScDPColFieldControl::~ScDPColFieldControl()
-{
-}
-
-ScPivotFieldType ScDPColFieldControl::GetFieldType() const
-{
- return PIVOTFIELDTYPE_COL;
-}
-
-OUString ScDPColFieldControl::GetDescription() const
-{
- return ScResId(STR_ACC_DATAPILOT_COL_DESCR);
-}
-
-
-
-ScDPRowFieldControl::ScDPRowFieldControl ( Window* pParent ) :
- ScDPFieldControlBase( pParent ),
- maScroll(this, WB_VERT | WB_DRAG),
- mnColumnBtnCount(0)
-{
- maScroll.SetScrollHdl( LINK(this, ScDPRowFieldControl, ScrollHdl) );
- maScroll.SetEndScrollHdl( LINK(this, ScDPRowFieldControl, EndScrollHdl) );
- maScroll.Show(false);
-
- AppendPaintable(&maScroll);
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScDPRowFieldControl( Window *pParent, VclBuilder::stringmap & )
-{
- return new ScDPRowFieldControl( pParent );
-}
-
-
-ScDPRowFieldControl::~ScDPRowFieldControl()
-{
-}
-
-
-
-Point ScDPRowFieldControl::GetFieldPosition(size_t nIndex)
-{
- Point aPos;
- Size aSize;
- GetFieldBtnPosSize(nIndex, aPos, aSize);
- return aPos;
-}
-
-Size ScDPRowFieldControl::GetFieldSize() const
-{
- return GetStdFieldBtnSize();
-}
-
-size_t ScDPRowFieldControl::GetFieldIndex( const Point& rPos )
-{
- if (rPos.X() < 0 || rPos.Y() < 0)
- return PIVOTFIELD_INVALID;
-
- long nFldH = GetFieldSize().Height();
- long nThreshold = OUTER_MARGIN_VER + nFldH + ROW_FIELD_BTN_GAP / 2;
-
- size_t nIndex = 0;
- for (; nIndex < mnColumnBtnCount; ++nIndex)
- {
- if (rPos.Y() < nThreshold)
- break;
-
- nThreshold += nFldH + ROW_FIELD_BTN_GAP;
- }
-
- if (nIndex >= mnColumnBtnCount)
- nIndex = mnColumnBtnCount - 1;
-
- nIndex += maScroll.GetThumbPos();
- return IsValidIndex(nIndex) ? nIndex : PIVOTFIELD_INVALID;
-}
-
-void ScDPRowFieldControl::Redraw()
-{
- VirtualDevice aVirDev;
- // #i97623# VirtualDevice is always LTR while other windows derive direction from parent
- aVirDev.EnableRTL( IsRTLEnabled() );
- aVirDev.SetMapMode( MAP_PIXEL );
-
- Point aPos0;
- Size aWndSize = GetSizePixel();
- Font aFont = GetFont();
- aFont.SetTransparent(true);
- aVirDev.SetFont(aFont);
- aVirDev.SetOutputSizePixel(aWndSize);
-
- DrawBackground(aVirDev);
-
- FieldNames& rFields = GetFieldNames();
- {
- long nScrollOffset = maScroll.GetThumbPos();
- FieldNames::iterator itr = rFields.begin(), itrEnd = rFields.end();
- if (nScrollOffset)
- ::std::advance(itr, nScrollOffset);
-
- for (size_t i = 0; itr != itrEnd; ++itr, ++i)
- {
- Point aFldPt;
- Size aFldSize;
- if (!GetFieldBtnPosSize(i, aFldPt, aFldSize))
- break;
-
- size_t nField = i + nScrollOffset;
- bool bFocus = HasFocus() && (nField == GetSelectedField());
- DrawField(aVirDev, Rectangle(aFldPt, aFldSize), *itr, bFocus);
- }
- }
-
- // Create a bitmap from the virtual device, and place that bitmap onto
- // this control.
- DrawBitmap(aPos0, aVirDev.GetBitmap(aPos0, aWndSize));
-
- DrawPaintables();
- DrawInvertSelection();
- UpdateStyle();
-}
-
-void ScDPRowFieldControl::CalcSize()
-{
- Size aWndSize = GetSizePixel();
-
- long nTotal = aWndSize.Height() - OUTER_MARGIN_VER;
- mnColumnBtnCount = nTotal / (GetFieldSize().Height() + ROW_FIELD_BTN_GAP);
-
- long nScrollSize = GetSettings().GetStyleSettings().GetScrollBarSize();
-
- maScroll.SetSizePixel(Size(nScrollSize, aWndSize.Height() - OUTER_MARGIN_VER*2));
- maScroll.SetPosPixel(Point(aWndSize.Width() - nScrollSize - OUTER_MARGIN_HOR, OUTER_MARGIN_VER));
- maScroll.SetLineSize(1);
- maScroll.SetVisibleSize(mnColumnBtnCount);
- maScroll.SetPageSize(mnColumnBtnCount);
- maScroll.SetRange(Range(0, mnColumnBtnCount));
- maScroll.DoScroll(0);
-
- ResetScrollBar();
-}
-
-bool ScDPRowFieldControl::IsValidIndex(size_t /*nIndex*/) const
-{
- // This method is here in case we decide to impose an arbitrary upper
- // boundary on the number of fields.
- return true;
-}
-
-size_t ScDPRowFieldControl::CalcNewFieldIndex(SCsCOL /*nDX*/, SCsROW nDY) const
-{
- size_t nNewField = GetSelectedField();
- nNewField += nDY;
- return IsExistingIndex(nNewField) ? nNewField : GetSelectedField();
-}
-
-size_t ScDPRowFieldControl::GetDisplayPosition(size_t nIndex) const
-{
- size_t nLower = maScroll.GetThumbPos();
- size_t nUpper = nLower + mnColumnBtnCount;
- if (nLower <= nIndex && nIndex <= nUpper)
- return nIndex - nLower;
-
- return INVALID_INDEX;
-}
-
-
-
-OUString ScDPRowFieldControl::GetDescription() const
-{
- return ScResId(STR_ACC_DATAPILOT_ROW_DESCR);
-}
-
-ScPivotFieldType ScDPRowFieldControl::GetFieldType() const
-{
- return PIVOTFIELDTYPE_ROW;
-}
-
-void ScDPRowFieldControl::ScrollToEnd()
-{
- maScroll.DoScroll(maScroll.GetRangeMax());
-}
-
-void ScDPRowFieldControl::ScrollToShowSelection()
-{
- size_t nLower = maScroll.GetThumbPos();
- size_t nUpper = nLower + mnColumnBtnCount - 1;
- size_t nSel = GetSelectedField();
- if (nSel < nLower)
- {
- // scroll up
- maScroll.DoScroll(nSel);
- }
- else if (nUpper < nSel)
- {
- // scroll down
- size_t nD = nSel - nUpper;
- maScroll.DoScroll(nLower + nD);
- }
-}
-
-void ScDPRowFieldControl::ResetScrollBar()
-{
- long nOldMax = maScroll.GetRangeMax();
- long nNewMax = std::max<long>(mnColumnBtnCount, GetFieldCount());
-
- if (nOldMax != nNewMax)
- {
- maScroll.SetRangeMax(nNewMax);
- maScroll.Show(GetFieldCount() > mnColumnBtnCount);
- }
-}
-
-void ScDPRowFieldControl::HandleWheelScroll(long nNotch)
-{
- maScroll.DoScroll(maScroll.GetThumbPos() - nNotch);
-}
-
-bool ScDPRowFieldControl::GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize)
-{
- if (nPos >= mnColumnBtnCount)
- return false;
-
- size_t nOffset = maScroll.GetThumbPos();
- if (nPos + nOffset >= GetFieldCount())
- return false;
-
- rSize = GetFieldSize();
- rPos = Point(OUTER_MARGIN_HOR, OUTER_MARGIN_VER);
- rPos.Y() += nPos * (rSize.Height() + ROW_FIELD_BTN_GAP);
- return true;
-}
-
-void ScDPRowFieldControl::HandleScroll()
-{
- Redraw();
-}
-
-IMPL_LINK_NOARG(ScDPRowFieldControl, ScrollHdl)
-{
- HandleScroll();
- return 0;
-}
-
-IMPL_LINK_NOARG(ScDPRowFieldControl, EndScrollHdl)
-{
- HandleScroll();
- return 0;
-}
-
-
-
-ScDPSelectFieldControl::ScDPSelectFieldControl( Window* pParent ):
- ScDPHorFieldControl( pParent )
-{
- SetName(OUString(ScResId(SCSTR_SELECT)));
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScDPSelectFieldControl( Window *pParent, VclBuilder::stringmap & )
-{
- return new ScDPSelectFieldControl( pParent );
-}
-
-ScDPSelectFieldControl::~ScDPSelectFieldControl()
-{
-}
-
-ScPivotFieldType ScDPSelectFieldControl::GetFieldType() const
-{
- return PIVOTFIELDTYPE_SELECT;
-}
-
-OUString ScDPSelectFieldControl::GetDescription() const
-{
- return ScResId(STR_ACC_DATAPILOT_SEL_DESCR);
-}
-
-
-
-ScDPDataFieldControl::ScDPDataFieldControl( Window* pParent ):
- ScDPHorFieldControl( pParent )
-{
-}
-
-extern "C" SAL_DLLPUBLIC_EXPORT Window* SAL_CALL makeScDPDataFieldControl( Window *pParent, VclBuilder::stringmap & )
-{
- return new ScDPDataFieldControl( pParent );
-}
-
-ScDPDataFieldControl::~ScDPDataFieldControl()
-{
-}
-
-ScPivotFieldType ScDPDataFieldControl::GetFieldType() const
-{
- return PIVOTFIELDTYPE_DATA;
-}
-
-Size ScDPDataFieldControl::GetFieldSize() const
-{
- Size aWndSize = GetSizePixel();
- long nFieldObjWidth = static_cast<long>(aWndSize.Width() / 2.0 - OUTER_MARGIN_HOR - DATA_FIELD_BTN_GAP/2);
- Size aFieldSize(nFieldObjWidth, FIELD_BTN_HEIGHT);
- return aFieldSize;
-}
-
-OUString ScDPDataFieldControl::GetDescription() const
-{
- return ScResId(STR_ACC_DATAPILOT_DATA_DESCR);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/dbgui/pvlaydlg.cxx b/sc/source/ui/dbgui/pvlaydlg.cxx
deleted file mode 100644
index 6dfee0c2fff5..000000000000
--- a/sc/source/ui/dbgui/pvlaydlg.cxx
+++ /dev/null
@@ -1,1640 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- ************************************************************************/
-
-#include <config_lgpl.h>
-
-#include "pvlaydlg.hxx"
-#include "dpuiglobal.hxx"
-
-#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
-#include <com/sun/star/sheet/DataPilotFieldSortMode.hpp>
-
-#include <sfx2/dispatch.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/layout.hxx>
-#include <vcl/settings.hxx>
-
-#include "dbdocfun.hxx"
-#include "uiitems.hxx"
-#include "rangeutl.hxx"
-#include "document.hxx"
-#include "viewdata.hxx"
-#include "tabvwsh.hxx"
-#include "reffact.hxx"
-#include "scresid.hxx"
-#include "globstr.hrc"
-#include "dpobject.hxx"
-#include "dpsave.hxx"
-#include "dpshttab.hxx"
-#include "scmod.hxx"
-#include "dputil.hxx"
-
-#include "sc.hrc"
-#include "scabstdlg.hxx"
-
-#include <boost/scoped_ptr.hpp>
-
-using namespace com::sun::star;
-using ::std::vector;
-using ::std::for_each;
-
-namespace {
-
-const sal_uInt16 STD_FORMAT = sal_uInt16( SCA_VALID | SCA_TAB_3D | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE );
-
-static const OString* getFuncNames()
-{
- static const OString gFuncNames[ PIVOT_MAXFUNC ] =
- {
- OString("sum") ,
- OString("count") ,
- OString("mean") ,
- OString("max") ,
- OString("min") ,
- OString("product"),
- OString("count2"),
- OString("stdev") ,
- OString("stdevp") ,
- OString("var") ,
- OString("varp") ,
- };
- return &gFuncNames[0];
-}
-
-} // namespace
-
-ScPivotLayoutDlg::ScPivotLayoutDlg( SfxBindings* pB, SfxChildWindow* pCW, Window* pParent, const ScDPObject& rDPObject, bool bNewOutput ) :
- ScAnyRefDlg( pB, pCW, pParent, "PivotTableLayout", "modules/scalc/ui/pivottablelayout.ui" ),
- mxDlgDPObject( new ScDPObject( rDPObject ) ),
- mpViewData( ((ScTabViewShell*)SfxViewShell::Current())->GetViewData() ),
- mpDoc( ((ScTabViewShell*)SfxViewShell::Current())->GetViewData()->GetDocument() ),
- mpRefInputEdit(NULL),
- maStrUndefined(SC_RESSTR(SCSTR_UNDEFINED)),
- maStrNewTable(SC_RESSTR(SCSTR_NEWTABLE)),
- mbIsDrag(false),
- meLastActiveType(PIVOTFIELDTYPE_SELECT),
- mnOffset(0),
- mbRefInputMode( false )
-{
- get( mpFtPage, "page_text" );
- get( mpWndPage, "pagefield" );
- get( mpFtCol, "column_text" );
- get( mpWndCol, "columnfield" );
- get( mpFtRow, "row_text" );
- get( mpWndRow, "rowfield" );
- get( mpFtData, "data_text" );
- get( mpWndData, "datafield" );
- get( mpWndSelect, "buttonfield" );
- get( mpFtInfo, "info" );
-
- mpWndPage->Init( this, mpFtPage );
- mpWndCol->Init( this, mpFtCol );
- mpWndRow->Init( this, mpFtRow );
- mpWndData->Init( this, mpFtData );
- mpWndSelect->Init( this, NULL );
- mpWndSelect->SetName(get<FixedText>("select_text")->GetText());
-
- get( mpFtInArea, "select_from" );
- get( mpEdInPos, "rangesel1" );
- mpEdInPos->SetReferences(this, mpFtInArea);
- get( mpRbInPos, "changebutton1" );
- mpRbInPos->SetReferences(this, mpEdInPos);
- get( mpLbOutPos, "target_area" );
- get( mpFtOutArea, "results_to" );
- get( mpEdOutPos, "rangesel2" );
- mpEdOutPos->SetReferences(this, mpFtOutArea);
- get( mpRbOutPos, "changebutton2" );
- mpRbOutPos->SetReferences(this, mpEdOutPos);
- get( mpBtnIgnEmptyRows, "ignore_empty" );
- get( mpBtnDetectCat, "detect_category" );
- get( mpBtnTotalCol, "total_cols" );
- get( mpBtnTotalRow, "total_rows" );
- get( mpBtnFilter, "add_filter" );
- get( mpBtnDrillDown, "drill_down" );
-
- get( mpBtnOk, "ok" );
- get( mpBtnCancel, "cancel" );
- get( mpBtnRemove, "remove" );
- get( mpBtnOptions, "options" );
- get( mpExpander, "more" );
- mpExpander->SetExpandedHdl( LINK( this, ScPivotLayoutDlg, ExpandHdl ) );
-
- mxDlgDPObject->FillOldParam( maPivotData );
- mxDlgDPObject->FillLabelData( maPivotData );
-
- mpBtnRemove->SetClickHdl( LINK( this, ScPivotLayoutDlg, ClickHdl ) );
- mpBtnOptions->SetClickHdl( LINK( this, ScPivotLayoutDlg, ClickHdl ) );
-
- maFuncNames.reserve( PIVOT_MAXFUNC );
- const OString* pFuncNames = getFuncNames();
- for ( sal_uInt16 i = 0; i < PIVOT_MAXFUNC; ++i )
- {
- OUString tmpText = get<FixedText>(pFuncNames[i])->GetText();
- maFuncNames.push_back(tmpText);
- }
-
- maFieldCtrls.reserve(5);
- maFieldCtrls.push_back(mpWndPage);
- maFieldCtrls.push_back(mpWndCol);
- maFieldCtrls.push_back(mpWndRow);
- maFieldCtrls.push_back(mpWndData);
- maFieldCtrls.push_back(mpWndSelect);
-
- InitControlAndDlgSizes();
-
- if (mxDlgDPObject->GetSheetDesc())
- {
- mpEdInPos->Enable();
- mpRbInPos->Enable();
- const ScSheetSourceDesc* p = mxDlgDPObject->GetSheetDesc();
- OUString aRangeName = p->GetRangeName();
- if (!aRangeName.isEmpty())
- mpEdInPos->SetText(aRangeName);
- else
- {
- maOldRange = p->GetSourceRange();
- OUString aStr(maOldRange.Format(SCR_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
- mpEdInPos->SetText(aStr);
- }
- }
- else
- {
- // data is not reachable, so could be a remote database
- mpEdInPos->Disable();
- mpRbInPos->Disable();
- }
-
- InitFieldWindows();
-
- mpLbOutPos->SetSelectHdl( LINK( this, ScPivotLayoutDlg, SelAreaHdl ) );
- mpEdOutPos->SetModifyHdl( LINK( this, ScPivotLayoutDlg, EdOutModifyHdl ) );
- mpEdInPos->SetModifyHdl( LINK( this, ScPivotLayoutDlg, EdInModifyHdl ) );
- mpBtnOk->SetClickHdl( LINK( this, ScPivotLayoutDlg, OkHdl ) );
- mpBtnCancel->SetClickHdl( LINK( this, ScPivotLayoutDlg, CancelHdl ) );
-
- // Set focus handler for the reference edit text boxes.
- Link aGetFocusLink = LINK(this, ScPivotLayoutDlg, GetRefEditFocusHdl);
- if (mpEdInPos->IsEnabled())
- mpEdInPos->SetGetFocusHdl(aGetFocusLink);
- mpEdOutPos->SetGetFocusHdl(aGetFocusLink);
-
- if ( mpViewData && mpDoc )
- {
- /*
- * Aus den RangeNames des Dokumentes werden nun die
- * in einem Zeiger-Array gemerkt, bei denen es sich
- * um sinnvolle Bereiche handelt
- */
-
- mpLbOutPos->Clear();
- mpLbOutPos->InsertEntry( maStrUndefined, 0 );
- mpLbOutPos->InsertEntry( maStrNewTable, 1 );
-
- ScAreaNameIterator aIter( mpDoc );
- OUString aName;
- ScRange aRange;
- while ( aIter.Next( aName, aRange ) )
- {
- if ( !aIter.WasDBName() ) // hier keine DB-Bereiche !
- {
- sal_uInt16 nInsert = mpLbOutPos->InsertEntry( aName );
-
- OUString aRefStr(aRange.aStart.Format(SCA_ABS_3D, mpDoc, mpDoc->GetAddressConvention()));
- maRefStrs.push_back(new OUString(aRefStr));
- mpLbOutPos->SetEntryData(nInsert, &maRefStrs.back());
- }
- }
- }
-
- if (bNewOutput)
- {
- // Output to a new sheet by default for a brand-new output.
- mpLbOutPos->SelectEntryPos(1);
- mpEdOutPos->Disable();
- mpRbOutPos->Disable();
- }
- else
- {
- // Modifying an existing dp output.
-
- if ( maPivotData.nTab != MAXTAB+1 )
- {
- OUString aStr =
- ScAddress( maPivotData.nCol,
- maPivotData.nRow,
- maPivotData.nTab ).Format(STD_FORMAT, mpDoc, mpDoc->GetAddressConvention());
- mpEdOutPos->SetText( aStr );
- maOutputRefStr = aStr;
- EdOutModifyHdl(0);
- }
- else
- {
- mpLbOutPos->SelectEntryPos( mpLbOutPos->GetEntryCount()-1 );
- SelAreaHdl(NULL);
- }
- }
-
- mpBtnIgnEmptyRows->Check( maPivotData.bIgnoreEmptyRows );
- mpBtnDetectCat->Check( maPivotData.bDetectCategories );
- mpBtnTotalCol->Check( maPivotData.bMakeTotalCol );
- mpBtnTotalRow->Check( maPivotData.bMakeTotalRow );
-
- const ScDPSaveData* pSaveData = mxDlgDPObject->GetSaveData();
- mpBtnFilter->Check( !pSaveData || pSaveData->GetFilterButton() );
- mpBtnDrillDown->Check( !pSaveData || pSaveData->GetDrillDown() );
-
- GrabFieldFocus( mpWndSelect );
-}
-
-ScPivotLayoutDlg::~ScPivotLayoutDlg()
-{
-}
-
-bool ScPivotLayoutDlg::Close()
-{
- return DoClose( ScPivotLayoutWrapper::GetChildWindowId() );
-}
-
-void ScPivotLayoutDlg::InitWndSelect(const ScDPLabelDataVector& rLabels)
-{
- size_t nLabelCount = rLabels.size();
-
- maLabelData.clear();
- maLabelData.reserve( nLabelCount );
- for ( size_t i=0; i < nLabelCount; i++ )
- {
- const ScDPLabelData& r = rLabels[i];
-
- maLabelData.push_back(new ScDPLabelData(r));
- if (r.mnOriginalDim < 0 && !r.mbDataLayout)
- {
- // For dimension with duplicates, use the layout name of the
- // original dimension if available. Be aware that duplicate
- // dimensions may have different layout names.
- ScPivotFuncData aFunc(maLabelData[i].mnCol, maLabelData[i].mnFuncMask);
- mpWndSelect->AppendField(maLabelData[i].getDisplayName(), aFunc);
- }
- }
- mpWndSelect->ResetScrollBar();
- mpWndSelect->Paint(Rectangle());
-}
-
-void ScPivotLayoutDlg::InitWndData(const vector<ScPivotField>& rFields)
-{
- vector<ScPivotField>::const_iterator it = rFields.begin(), itEnd = rFields.end();
- for (; it != itEnd; ++it)
- {
- SCCOL nCol = it->nCol;
- sal_uInt16 nMask = it->nFuncMask;
- if (nCol == PIVOT_DATA_FIELD)
- continue;
-
- // data field - we need to concatenate function name with the field name.
- ScDPLabelData* pData = GetLabelData(nCol);
- OSL_ENSURE( pData, "ScDPLabelData not found" );
- if (pData)
- {
- ScPivotFuncData aFunc(nCol, it->mnOriginalDim, nMask, it->mnDupCount, it->maFieldRef);
- OUString aStr = pData->maLayoutName;
- if (aStr.isEmpty())
- {
- aStr = GetFuncString(aFunc.mnFuncMask, pData->mbIsValue);
- aStr += pData->maName;
- }
-
- mpWndData->AppendField(aStr, aFunc);
- pData->mnFuncMask = nMask;
- }
- }
- mpWndData->ResetScrollBar();
-}
-
-void ScPivotLayoutDlg::InitFieldWindow( const vector<ScPivotField>& rFields, ScPivotFieldType eType )
-{
- OSL_ASSERT(eType != PIVOTFIELDTYPE_DATA);
- ScDPFieldControlBase* pInitWnd = GetFieldWindow(eType);
-
- if (!pInitWnd)
- return;
-
- vector<ScPivotField>::const_iterator itr = rFields.begin(), itrEnd = rFields.end();
- for (; itr != itrEnd; ++itr)
- {
- SCCOL nCol = itr->nCol;
- sal_uInt16 nMask = itr->nFuncMask;
- if (nCol == PIVOT_DATA_FIELD)
- continue;
-
- ScPivotFuncData aFunc(nCol, itr->mnOriginalDim, nMask, itr->mnDupCount, itr->maFieldRef);
- pInitWnd->AppendField(GetLabelString(nCol), aFunc);
- }
- pInitWnd->ResetScrollBar();
-}
-
-void ScPivotLayoutDlg::InitFieldWindows()
-{
- InitWndSelect(maPivotData.maLabelArray);
- InitFieldWindow(maPivotData.maPageFields, PIVOTFIELDTYPE_PAGE);
- InitFieldWindow(maPivotData.maColFields, PIVOTFIELDTYPE_COL);
- InitFieldWindow(maPivotData.maRowFields, PIVOTFIELDTYPE_ROW);
- InitWndData(maPivotData.maDataFields);
-}
-
-void ScPivotLayoutDlg::GrabFieldFocus( ScDPFieldControlBase* rFieldWindow )
-{
- if( rFieldWindow->IsEmpty() )
- {
- if( mpWndSelect->IsEmpty() )
- mpBtnOk->GrabFocus();
- else
- mpWndSelect->GrabFocus();
- }
- else
- rFieldWindow->GrabFocus();
-}
-
-void ScPivotLayoutDlg::AddField( size_t nFromIndex, ScPivotFieldType eToType, const Point& rScrPos )
-{
- ScPivotFuncData aFunc = mpWndSelect->GetFuncData(nFromIndex); // local copy
-
- bool bAllowed = IsOrientationAllowed(aFunc.mnCol, eToType);
- if (!bAllowed)
- return;
-
- size_t nAt = 0;
- ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
- if (!toWnd)
- return;
- ScDPFieldControlBase* rmWnd1 = NULL;
- ScDPFieldControlBase* rmWnd2 = NULL;
- GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
-
- if (eToType == PIVOTFIELDTYPE_DATA)
- {
- // Data field allows duplicates.
- ScDPLabelData* p = GetLabelData(aFunc.mnCol);
- OUString aStr = p->maLayoutName;
- sal_uInt16 nMask = aFunc.mnFuncMask;
- if (nMask == PIVOT_FUNC_NONE)
- nMask = PIVOT_FUNC_SUM; // Use SUM by default.
- if (aStr.isEmpty())
- {
- aStr = GetFuncString(nMask);
- aStr += p->maName;
- }
-
- aFunc.mnFuncMask = nMask;
- size_t nAddedAt = toWnd->AddField(aStr, toWnd->ScreenToOutputPixel(rScrPos), aFunc);
- if (nAddedAt != PIVOTFIELD_INVALID)
- toWnd->GrabFocus();
-
- return;
- }
-
- nAt = toWnd->GetFieldIndexByData(aFunc);
- if (nAt == PIVOTFIELD_INVALID)
- {
- if (rmWnd1)
- {
- nAt = rmWnd1->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd1->DeleteFieldByIndex(nAt);
- }
- if (rmWnd2)
- {
- nAt = rmWnd2->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd2->DeleteFieldByIndex(nAt);
- }
-
- const ScDPLabelData& rData = maLabelData[nFromIndex+mnOffset];
- size_t nAddedAt = toWnd->AddField(rData.getDisplayName(), toWnd->ScreenToOutputPixel(rScrPos), aFunc);
- if (nAddedAt != PIVOTFIELD_INVALID)
- toWnd->GrabFocus();
- }
-}
-
-void ScPivotLayoutDlg::AppendField(size_t nFromIndex, ScPivotFieldType eToType)
-{
- ScPivotFuncData aFunc = mpWndSelect->GetFuncData(nFromIndex); // local copy
-
- size_t nAt = 0;
- ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
- if (!toWnd)
- return;
- ScDPFieldControlBase* rmWnd1 = NULL;
- ScDPFieldControlBase* rmWnd2 = NULL;
- GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
-
- bool bDataArr = eToType == PIVOTFIELDTYPE_DATA;
-
- nAt = toWnd->GetFieldIndexByData(aFunc);
- if (nAt == PIVOTFIELD_INVALID)
- {
- if (rmWnd1)
- {
- nAt = rmWnd1->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd1->DeleteFieldByIndex(nAt);
- }
- if (rmWnd2)
- {
- nAt = rmWnd2->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd2->DeleteFieldByIndex(nAt);
- }
-
- ScDPLabelData& rData = maLabelData[nFromIndex+mnOffset];
-
- if ( !bDataArr )
- {
- toWnd->AppendField(rData.getDisplayName(), aFunc);
- toWnd->GrabFocus();
- }
- else
- {
- ScDPLabelData* p = GetLabelData(aFunc.mnCol);
- OUString aStr = p->maLayoutName;
- sal_uInt16 nMask = aFunc.mnFuncMask;
- if (aStr.isEmpty())
- {
- aStr = GetFuncString(nMask);
- aStr += p->maName;
- }
-
- aFunc.mnFuncMask = nMask;
- toWnd->AppendField(aStr, aFunc);
- toWnd->GrabFocus();
- }
- }
-}
-
-void ScPivotLayoutDlg::MoveField( ScPivotFieldType eFromType, size_t nFromIndex, ScPivotFieldType eToType, const Point& rScrPos )
-{
- if ( eFromType == PIVOTFIELDTYPE_SELECT )
- AddField( nFromIndex, eToType, rScrPos );
- else if (eFromType != PIVOTFIELDTYPE_SELECT && eToType == PIVOTFIELDTYPE_SELECT)
- RemoveField(eFromType, nFromIndex);
- else if ( eFromType != eToType )
- {
- ScDPFieldControlBase* fromWnd = GetFieldWindow(eFromType);
- ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
-
- ScDPFieldControlBase* rmWnd1 = NULL;
- ScDPFieldControlBase* rmWnd2 = NULL;
- GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
-
- bool bDataArr = eToType == PIVOTFIELDTYPE_DATA;
-
- if (fromWnd && toWnd)
- {
- ScPivotFuncData aFunc = fromWnd->GetFuncData(nFromIndex); // local copy
- bool bAllowed = IsOrientationAllowed(aFunc.mnCol, eToType);
-
- size_t nAt = fromWnd->GetFieldIndexByData(aFunc);
- if (bAllowed && nAt != PIVOTFIELD_INVALID)
- {
- fromWnd->DeleteFieldByIndex(nAt);
-
- nAt = toWnd->GetFieldIndexByData(aFunc);
- if (nAt == PIVOTFIELD_INVALID)
- {
- size_t nAddedAt = 0;
- if ( !bDataArr )
- {
- if (rmWnd1)
- {
- nAt = rmWnd1->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd1->DeleteFieldByIndex(nAt);
- }
- if (rmWnd2)
- {
- nAt = rmWnd2->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd2->DeleteFieldByIndex(nAt);
- }
-
- nAddedAt = toWnd->AddField(
- GetLabelString(aFunc.mnCol), toWnd->ScreenToOutputPixel(rScrPos), aFunc);
- if (nAddedAt != PIVOTFIELD_INVALID)
- toWnd->GrabFocus();
- }
- else
- {
- ScDPLabelData* p = GetLabelData(aFunc.mnCol);
- OUString aStr = p->maLayoutName;
- sal_uInt16 nMask = aFunc.mnFuncMask;
- if (aStr.isEmpty())
- {
- aStr = GetFuncString(nMask);
- aStr += p->maName;
- }
-
- aFunc.mnFuncMask = nMask;
- nAddedAt = toWnd->AddField(aStr, toWnd->ScreenToOutputPixel(rScrPos), aFunc);
- if (nAddedAt != PIVOTFIELD_INVALID)
- toWnd->GrabFocus();
- }
- }
- }
- }
- }
- else // -> eFromType == eToType
- {
- ScDPFieldControlBase* pWnd = GetFieldWindow(eFromType);
- if (!pWnd)
- return;
-
- const ScPivotFuncData& rFunc = pWnd->GetFuncData(nFromIndex);
-
- size_t nAt = pWnd->GetFieldIndexByData(rFunc);
- if (nAt != PIVOTFIELD_INVALID)
- {
- Point aToPos = pWnd->ScreenToOutputPixel(rScrPos);
- size_t nToIndex = 0;
- pWnd->GetExistingIndex(aToPos, nToIndex);
-
- if ( nToIndex != nAt )
- {
- size_t nAddedAt = 0;
- pWnd->MoveField(nAt, aToPos, nAddedAt);
- }
- }
- }
-}
-
-void ScPivotLayoutDlg::MoveFieldToEnd( ScPivotFieldType eFromType, size_t nFromIndex, ScPivotFieldType eToType )
-{
- if ( eFromType == PIVOTFIELDTYPE_SELECT )
- AppendField( nFromIndex, eToType );
- else if ( eFromType != eToType )
- {
- ScDPFieldControlBase* fromWnd = GetFieldWindow(eFromType);
- ScDPFieldControlBase* toWnd = GetFieldWindow(eToType);
-
- ScDPFieldControlBase* rmWnd1 = NULL;
- ScDPFieldControlBase* rmWnd2 = NULL;
- GetOtherFieldWindows(eToType, rmWnd1, rmWnd2);
-
- bool bDataArr = eToType == PIVOTFIELDTYPE_DATA;
-
- if (!fromWnd || !toWnd)
- return;
-
- ScPivotFuncData aFunc = fromWnd->GetFuncData(nFromIndex); // local copy
-
- size_t nAt = fromWnd->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- {
- fromWnd->DeleteFieldByIndex(nAt);
-
- nAt = toWnd->GetFieldIndexByData(aFunc);
- if (nAt == PIVOTFIELD_INVALID)
- {
- if ( !bDataArr )
- {
- if (rmWnd1)
- {
- nAt = rmWnd1->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd1->DeleteFieldByIndex(nAt);
- }
- if (rmWnd2)
- {
- nAt = rmWnd2->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- rmWnd2->DeleteFieldByIndex(nAt);
- }
-
- toWnd->AppendField(GetLabelString(aFunc.mnCol), aFunc);
- toWnd->GrabFocus();
- }
- else
- {
- ScDPLabelData* p = GetLabelData(aFunc.mnCol);
- OUString aStr = p->maLayoutName;
- sal_uInt16 nMask = aFunc.mnFuncMask;
- if (aStr.isEmpty())
- {
- aStr = GetFuncString(nMask);
- aStr += p->maName;
- }
-
- aFunc.mnFuncMask = nMask;
- toWnd->AppendField(aStr, aFunc);
- toWnd->GrabFocus();
- }
- }
- }
- }
- else // -> eFromType == eToType
- {
- ScDPFieldControlBase* pWnd = GetFieldWindow(eFromType);
- if (!pWnd)
- return;
-
- Point aToPos;
- bool bDataArr = eFromType == PIVOTFIELDTYPE_DATA;
-
- ScPivotFuncData aFunc = pWnd->GetFuncData(nFromIndex); // local copy
- size_t nAt = pWnd->GetFieldIndexByData(aFunc);
- if (nAt != PIVOTFIELD_INVALID)
- {
- size_t nToIndex = 0;
- pWnd->GetExistingIndex( aToPos, nToIndex );
-
- if ( nToIndex != nAt )
- {
- pWnd->DeleteFieldByIndex(nAt);
-
- if ( !bDataArr )
- pWnd->AppendField(GetLabelString(aFunc.mnCol), aFunc);
- else
- {
- ScDPLabelData* p = GetLabelData(aFunc.mnCol);
- OUString aStr = p->maLayoutName;
- sal_uInt16 nMask = aFunc.mnFuncMask;
- if (aStr.isEmpty())
- {
- aStr = GetFuncString(nMask);
- aStr += p->maName;
- }
-
- aFunc.mnFuncMask = nMask;
- pWnd->AppendField(aStr, aFunc);
- }
- }
- }
- }
-}
-
-void ScPivotLayoutDlg::RemoveField( ScPivotFieldType eFromType, size_t nIndex )
-{
- ScDPFieldControlBase* pWnd = GetFieldWindow(eFromType);
- if (!pWnd)
- return;
-
- if (nIndex >= pWnd->GetFieldCount())
- // out of bound
- return;
-
- pWnd->DeleteFieldByIndex(nIndex);
- if (pWnd->IsEmpty())
- GrabFieldFocus(mpWndSelect);
-}
-
-PointerStyle ScPivotLayoutDlg::NotifyMouseButtonDown( ScPivotFieldType eType, size_t nFieldIndex )
-{
- mbIsDrag = true;
- meDnDFromType = eType;
- mnDnDFromIndex = nFieldIndex;
-
- switch (eType)
- {
- case PIVOTFIELDTYPE_PAGE:
- return POINTER_PIVOT_FIELD;
- case PIVOTFIELDTYPE_COL:
- return POINTER_PIVOT_COL;
- case PIVOTFIELDTYPE_ROW:
- return POINTER_PIVOT_ROW;
- case PIVOTFIELDTYPE_DATA:
- return POINTER_PIVOT_FIELD;
- case PIVOTFIELDTYPE_SELECT:
- return POINTER_PIVOT_FIELD;
- default:
- ;
- }
- return POINTER_ARROW;
-}
-
-void ScPivotLayoutDlg::NotifyDoubleClick( ScPivotFieldType eType, size_t nFieldIndex )
-{
- ScDPFieldControlBase* pWnd = GetFieldWindow(eType);
- if (!pWnd)
- return;
-
- if (nFieldIndex >= pWnd->GetFieldCount())
- {
- OSL_FAIL("invalid selection");
- return;
- }
-
- ScPivotFuncData& rFunc = pWnd->GetFuncData(nFieldIndex);
- ScDPLabelData* pData = GetLabelData(rFunc.mnCol);
- if (!pData)
- return;
-
- ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- OSL_ENSURE(pFact, "ScAbstractFactory create fail!");
-
- switch ( eType )
- {
- case PIVOTFIELDTYPE_PAGE:
- case PIVOTFIELDTYPE_COL:
- case PIVOTFIELDTYPE_ROW:
- {
- // list of names of all data fields
- vector<ScDPName> aDataFieldNames;
- vector<ScDPFieldControlBase::FuncItem> aFuncItems;
- mpWndData->GetAllFuncItems(aFuncItems);
- vector<ScDPFieldControlBase::FuncItem>::const_iterator it = aFuncItems.begin(), itEnd = aFuncItems.end();
- for (; it != itEnd; ++it)
- {
- ScDPLabelData* pDFData = GetLabelData(it->mnCol);
- if (!pDFData)
- continue;
-
- if (pDFData->maName.isEmpty())
- continue;
-
- OUString aLayoutName = pDFData->maLayoutName;
- if (aLayoutName.isEmpty())
- {
- // No layout name exists. Use the stock name.
- sal_uInt16 nMask = it->mnFuncMask;
- OUString aFuncStr = GetFuncString(nMask);
- aLayoutName = aFuncStr + pDFData->maName;
- }
- aDataFieldNames.push_back(ScDPName(pDFData->maName, aLayoutName, pDFData->mnDupCount));
- }
-
- bool bLayout = (eType == PIVOTFIELDTYPE_ROW) &&
- ((aDataFieldNames.size() > 1) || (nFieldIndex + 1 < pWnd->GetFieldCount()));
-
- boost::scoped_ptr<AbstractScDPSubtotalDlg> pDlg(
- pFact->CreateScDPSubtotalDlg(
- this, *mxDlgDPObject, *pData, rFunc,
- aDataFieldNames, bLayout));
-
- if ( pDlg->Execute() == RET_OK )
- {
- pDlg->FillLabelData( *pData );
- rFunc.mnFuncMask = pData->mnFuncMask;
- }
- }
- break;
-
- case PIVOTFIELDTYPE_DATA:
- {
- ScPivotFuncData& rFuncData = mpWndData->GetFuncData(nFieldIndex);
- boost::scoped_ptr<AbstractScDPFunctionDlg> pDlg(
- pFact->CreateScDPFunctionDlg(
- this, maLabelData, *pData, rFuncData));
-
- if ( pDlg->Execute() == RET_OK )
- {
- bool bFuncChanged = rFuncData.mnFuncMask != pDlg->GetFuncMask();
- rFuncData.mnFuncMask = pData->mnFuncMask = pDlg->GetFuncMask();
- rFuncData.maFieldRef = pDlg->GetFieldRef();
-
- if (bFuncChanged)
- // Get the new duplicate count since the function has changed.
- rFuncData.mnDupCount = mpWndData->GetNextDupCount(rFuncData, nFieldIndex);
-
- ScDPLabelData* p = GetLabelData(rFuncData.mnCol);
- OUString aStr = p->maLayoutName;
- if (aStr.isEmpty())
- {
- // Layout name is not available. Use default name.
- aStr = GetFuncString (rFuncData.mnFuncMask);
- aStr += p->maName;
- }
- mpWndData->SetFieldText(aStr, nFieldIndex, rFuncData.mnDupCount);
- }
- }
- break;
-
- default:
- {
- // added to avoid warnings
- }
- }
-}
-
-void ScPivotLayoutDlg::NotifyFieldFocus( ScPivotFieldType eType, bool bGotFocus )
-{
- /* Enable Remove/Options buttons on GetFocus in field window.
- Enable them also, if dialog is deactivated (click into document).
- The !IsActive() condition handles the case that a LoseFocus event of a
- field window would follow the Deactivate event of this dialog. */
- bool bEnable = (bGotFocus || !IsActive()) && (eType != PIVOTFIELDTYPE_SELECT);
-
- // The TestTool may set the focus into an empty field.
- // Then the Remove/Options buttons must be disabled.
- ScDPFieldControlBase* pWnd = GetFieldWindow(eType);
- if ( bEnable && bGotFocus && pWnd && pWnd->IsEmpty() )
- bEnable = false;
-
- mpBtnRemove->Enable( bEnable );
- mpBtnOptions->Enable( bEnable );
- if( bGotFocus )
- meLastActiveType = eType;
-}
-
-void ScPivotLayoutDlg::NotifyMoveFieldToEnd( ScPivotFieldType eToType )
-{
- ScDPFieldControlBase* pWnd = GetFieldWindow(meLastActiveType);
- ScDPFieldControlBase* pToWnd = GetFieldWindow(eToType);
- if (pWnd && pToWnd && (eToType != PIVOTFIELDTYPE_SELECT) && !pWnd->IsEmpty())
- {
- MoveFieldToEnd(meLastActiveType, pWnd->GetSelectedField(), eToType);
-
- if( pWnd->IsEmpty() )
- NotifyFieldFocus( eToType, true );
- else
- pWnd->GrabFocus();
- if( meLastActiveType == PIVOTFIELDTYPE_SELECT )
- mpWndSelect->SelectNext();
- }
- else
- GrabFieldFocus( mpWndSelect );
-}
-
-void ScPivotLayoutDlg::NotifyRemoveField( ScPivotFieldType eType, size_t nFieldIndex )
-{
- if( eType != PIVOTFIELDTYPE_SELECT )
- RemoveField( eType, nFieldIndex );
-}
-
-Size ScPivotLayoutDlg::GetStdFieldBtnSize() const
-{
- return Size(approximate_char_width() * 8, FIELD_BTN_HEIGHT);
-}
-
-void ScPivotLayoutDlg::DropFieldItem( const Point& rScrPos, ScPivotFieldType eToType )
-{
- if (!mbIsDrag)
- // Not in drag mode. Do nothing.
- return;
-
- mbIsDrag = false;
-
- if (eToType == PIVOTFIELDTYPE_UNKNOWN)
- {
- // We don't remove any buttons from the select field.
- if (meDnDFromType != PIVOTFIELDTYPE_SELECT)
- RemoveField(meDnDFromType, mnDnDFromIndex);
- }
- else
- {
- MoveField(meDnDFromType, mnDnDFromIndex, eToType, rScrPos);
- }
-}
-
-PointerStyle ScPivotLayoutDlg::GetPointerStyle(ScPivotFieldType eFieldType)
-{
- if (!mbIsDrag)
- return POINTER_ARROW;
-
- if (eFieldType == PIVOTFIELDTYPE_UNKNOWN)
- // Outside any field areas.
- return meDnDFromType == PIVOTFIELDTYPE_SELECT ? POINTER_PIVOT_FIELD : POINTER_PIVOT_DELETE;
-
- if (eFieldType == PIVOTFIELDTYPE_SELECT)
- return POINTER_PIVOT_FIELD;
-
- // check if the target orientation is allowed for this field
- ScDPFieldControlBase* pWnd = GetFieldWindow(meDnDFromType);
- if (!pWnd)
- return POINTER_ARROW;
-
- const ScPivotFuncData& rData = pWnd->GetFuncData(mnDnDFromIndex);
- if (!IsOrientationAllowed(rData.mnCol, eFieldType))
- return POINTER_NOTALLOWED;
-
- switch (eFieldType)
- {
- case PIVOTFIELDTYPE_COL:
- return POINTER_PIVOT_COL;
- case PIVOTFIELDTYPE_ROW:
- return POINTER_PIVOT_ROW;
- case PIVOTFIELDTYPE_DATA:
- case PIVOTFIELDTYPE_SELECT:
- case PIVOTFIELDTYPE_PAGE:
- default:
- ;
- }
-
- return POINTER_PIVOT_FIELD;
-}
-
-namespace {
-
-class InsideFieldControl : std::unary_function<ScDPFieldControlBase*, bool>
-{
- Point maScrPos;
-public:
- InsideFieldControl(const Point& rScrPos) : maScrPos(rScrPos) {}
-
- bool operator() (const ScDPFieldControlBase* p) const
- {
- Point aOutputPos = p->ScreenToOutputPixel(maScrPos);
- Rectangle aRect(Point(0, 0), p->GetSizePixel());
- return aRect.IsInside(aOutputPos);
- }
-};
-
-}
-
-ScPivotFieldType ScPivotLayoutDlg::GetFieldTypeAtPoint( const Point& rScrPos ) const
-{
- std::vector<ScDPFieldControlBase*>::const_iterator it =
- std::find_if(maFieldCtrls.begin(), maFieldCtrls.end(), InsideFieldControl(rScrPos));
-
- return it == maFieldCtrls.end() ? PIVOTFIELDTYPE_UNKNOWN : (*it)->GetFieldType();
-}
-
-void ScPivotLayoutDlg::Deactivate()
-{
- /* If the dialog has been deactivated (click into document), the LoseFocus
- event from field window disables Remove/Options buttons. Re-enable them here by
- simulating a GetFocus event. Event order of LoseFocus and Deactivate is not important.
- The last event will enable the buttons in both cases (see NotifyFieldFocus). */
- NotifyFieldFocus( meLastActiveType, true );
-}
-
-namespace {
-
-class FindLabelDataByCol : std::unary_function<ScDPLabelData, bool>
-{
- SCCOL mnCol;
-public:
- FindLabelDataByCol(SCCOL nCol) : mnCol(nCol) {}
-
- bool operator() (const ScDPLabelData& r) const
- {
- return r.mnCol == mnCol;
- }
-};
-
-}
-
-ScDPLabelData* ScPivotLayoutDlg::GetLabelData( SCCOL nCol )
-{
- ScDPLabelDataVector::iterator it =
- std::find_if(maLabelData.begin(), maLabelData.end(), FindLabelDataByCol(nCol));
- return it == maLabelData.end() ? NULL : &(*it);
-}
-
-OUString ScPivotLayoutDlg::GetLabelString( SCsCOL nCol )
-{
- ScDPLabelData* pData = GetLabelData( nCol );
- OSL_ENSURE( pData, "LabelData not found" );
- if (pData)
- return pData->getDisplayName();
- return OUString();
-}
-
-bool ScPivotLayoutDlg::IsOrientationAllowed( SCsCOL nCol, ScPivotFieldType eType )
-{
- bool bAllowed = true;
- ScDPLabelData* pData = GetLabelData( nCol );
- OSL_ENSURE( pData, "LabelData not found" );
- if (pData)
- {
- sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN;
- switch (eType)
- {
- case PIVOTFIELDTYPE_PAGE: eOrient = sheet::DataPilotFieldOrientation_PAGE; break;
- case PIVOTFIELDTYPE_COL: eOrient = sheet::DataPilotFieldOrientation_COLUMN; break;
- case PIVOTFIELDTYPE_ROW: eOrient = sheet::DataPilotFieldOrientation_ROW; break;
- case PIVOTFIELDTYPE_DATA: eOrient = sheet::DataPilotFieldOrientation_DATA; break;
- case PIVOTFIELDTYPE_SELECT: eOrient = sheet::DataPilotFieldOrientation_HIDDEN; break;
- default:
- ;
- }
- bAllowed = ScDPObject::IsOrientationAllowed( (sal_uInt16)eOrient, pData->mnFlags );
- }
- return bAllowed;
-}
-
-OUString ScPivotLayoutDlg::GetFuncString( sal_uInt16& rFuncMask, bool bIsValue )
-{
- OUStringBuffer aBuf;
-
- if ( rFuncMask == PIVOT_FUNC_NONE
- || rFuncMask == PIVOT_FUNC_AUTO )
- {
- if ( bIsValue )
- {
- aBuf.append(GetFuncName(PIVOTSTR_SUM));
- rFuncMask = PIVOT_FUNC_SUM;
- }
- else
- {
- aBuf.append(GetFuncName(PIVOTSTR_COUNT));
- rFuncMask = PIVOT_FUNC_COUNT;
- }
- }
- else if ( rFuncMask == PIVOT_FUNC_SUM ) aBuf = GetFuncName(PIVOTSTR_SUM);
- else if ( rFuncMask == PIVOT_FUNC_COUNT ) aBuf = GetFuncName(PIVOTSTR_COUNT);
- else if ( rFuncMask == PIVOT_FUNC_AVERAGE ) aBuf = GetFuncName(PIVOTSTR_AVG);
- else if ( rFuncMask == PIVOT_FUNC_MAX ) aBuf = GetFuncName(PIVOTSTR_MAX);
- else if ( rFuncMask == PIVOT_FUNC_MIN ) aBuf = GetFuncName(PIVOTSTR_MIN);
- else if ( rFuncMask == PIVOT_FUNC_PRODUCT ) aBuf = GetFuncName(PIVOTSTR_PROD);
- else if ( rFuncMask == PIVOT_FUNC_COUNT_NUM ) aBuf = GetFuncName(PIVOTSTR_COUNT2);
- else if ( rFuncMask == PIVOT_FUNC_STD_DEV ) aBuf = GetFuncName(PIVOTSTR_DEV);
- else if ( rFuncMask == PIVOT_FUNC_STD_DEVP ) aBuf = GetFuncName(PIVOTSTR_DEV2);
- else if ( rFuncMask == PIVOT_FUNC_STD_VAR ) aBuf = GetFuncName(PIVOTSTR_VAR);
- else if ( rFuncMask == PIVOT_FUNC_STD_VARP ) aBuf = GetFuncName(PIVOTSTR_VAR2);
- else
- {
- aBuf.append(ScGlobal::GetRscString(STR_TABLE_ERGEBNIS));
- aBuf.appendAscii(" - ");
- }
-
- return aBuf.makeStringAndClear();
-}
-
-void ScPivotLayoutDlg::InitControlAndDlgSizes()
-{
- // row/column/data area sizes
- long nFldW = GetStdFieldBtnSize().Width();
- long nFldH = GetStdFieldBtnSize().Height();
-
- mpWndPage->set_width_request(approximate_char_width() * 35);
- mpWndPage->set_height_request(GetTextHeight() * 4);
- mpWndCol->set_width_request(approximate_char_width() * 30);
- mpWndCol->set_height_request(GetTextHeight() * 4);
- mpWndRow->set_width_request(approximate_char_width() * 10);
- mpWndRow->set_height_request(GetTextHeight() * 8);
- mpWndData->set_width_request(approximate_char_width() * 30);
- mpWndData->set_height_request(GetTextHeight() * 8);
-
- // selection area
- long nLineSize = 10; // number of fields per column.
- long nH = OUTER_MARGIN_VER + nLineSize* nFldH + nLineSize * ROW_FIELD_BTN_GAP;
- nH += ROW_FIELD_BTN_GAP;
- nH += GetSettings().GetStyleSettings().GetScrollBarSize() + OUTER_MARGIN_VER;
- mpWndSelect->set_width_request(2 * nFldW + ROW_FIELD_BTN_GAP + 10);
- mpWndSelect->set_height_request(nH);
-}
-
-bool ScPivotLayoutDlg::GetPivotArrays(
- vector<ScPivotField>& rPageFields, vector<ScPivotField>& rColFields,
- vector<ScPivotField>& rRowFields, vector<ScPivotField>& rDataFields )
-{
- vector<ScPivotField> aPageFields;
- mpWndPage->ConvertToPivotArray(aPageFields);
-
- vector<ScPivotField> aColFields;
- mpWndCol->ConvertToPivotArray(aColFields);
-
- vector<ScPivotField> aRowFields;
- mpWndRow->ConvertToPivotArray(aRowFields);
-
- vector<ScPivotField> aDataFields;
- mpWndData->ConvertToPivotArray(aDataFields);
-
- sheet::DataPilotFieldOrientation eOrientDataLayout = sheet::DataPilotFieldOrientation_ROW;
- ScDPSaveData* pSaveData = mxDlgDPObject->GetSaveData();
- if (pSaveData)
- {
- const ScDPSaveDimension* p = pSaveData->GetExistingDataLayoutDimension();
- if (p)
- // Try to preserve the orientation of existing data layout dimension.
- eOrientDataLayout = static_cast<sheet::DataPilotFieldOrientation>(p->GetOrientation());
- }
- switch (eOrientDataLayout)
- {
- case sheet::DataPilotFieldOrientation_COLUMN:
- aColFields.push_back(ScPivotField(PIVOT_DATA_FIELD, 0));
- break;
- default:
- // data layout dimension can only be row or column.
- aRowFields.push_back(ScPivotField(PIVOT_DATA_FIELD, 0));
- }
-
- rPageFields.swap(aPageFields);
- rColFields.swap(aColFields);
- rRowFields.swap(aRowFields);
- rDataFields.swap(aDataFields);
-
- return true;
-}
-
-void ScPivotLayoutDlg::UpdateSrcRange()
-{
- OUString aSrcStr = mpEdInPos->GetText();
- sal_uInt16 nResult = ScRange().Parse(aSrcStr, mpDoc, mpDoc->GetAddressConvention());
- DataSrcType eSrcType = SRC_INVALID;
- ScRange aNewRange;
-
- if (SCA_VALID == (nResult & SCA_VALID))
- {
- // Valid source range. Take it.
- ScRefAddress start, end;
- ConvertDoubleRef(mpDoc, aSrcStr, 1, start, end, mpDoc->GetAddressConvention());
- aNewRange.aStart = start.GetAddress();
- aNewRange.aEnd = end.GetAddress();
- mpEdInPos->SetRefValid(true);
- eSrcType = SRC_REF;
- }
- else
- {
- // invalid source range. Check if this is a valid range name.
- bool bValid = false;
- ScRangeName* pRangeName = mpDoc->GetRangeName();
- if (pRangeName)
- {
- OUString aUpper = ScGlobal::pCharClass->uppercase(aSrcStr);
- const ScRangeData* pData = pRangeName->findByUpperName(aUpper);
- if (pData)
- {
- // range name found. Check if this is a valid reference.
- bValid = pData->IsReference(aNewRange);
- }
- }
-
- mpEdInPos->SetRefValid(bValid);
- if (!bValid)
- {
- // All attempts have failed. Give up.
- mpBtnOk->Disable();
- return;
- }
-
- eSrcType = SRC_NAME;
- }
-
- mpBtnOk->Enable();
-
- // Now update the data src range or range name with the dp object.
- ScSheetSourceDesc inSheet = *mxDlgDPObject->GetSheetDesc();
-
- switch (eSrcType)
- {
- case SRC_REF:
- {
- // data source is a range reference.
- if (inSheet.GetSourceRange() == aNewRange)
- // new range is identical to the current range. Nothing to do.
- return;
- inSheet.SetSourceRange(aNewRange);
- sal_uLong nError = inSheet.CheckSourceRange();
- if (nError)
- {
- // The error number corresponds with string ID for the error
- // message. In the future we should display the error message
- // somewhere in the dialog to let the user know of the reason
- // for error.
- mpEdInPos->SetRefValid(false);
- mpBtnOk->Disable();
- return;
- }
- }
- break;
- case SRC_NAME:
- // data source is a range name.
- inSheet.SetRangeName(aSrcStr);
- break;
- default:
- OSL_FAIL( "Unknown source type.");
- return;
- }
-
- mxDlgDPObject->SetSheetDesc(inSheet);
- mxDlgDPObject->FillOldParam( maPivotData );
- mxDlgDPObject->FillLabelData(maPivotData);
-
- maLabelData.clear();
- mpWndSelect->ClearFields();
- mpWndData->ClearFields();
- mpWndRow->ClearFields();
- mpWndCol->ClearFields();
- mpWndPage->ClearFields();
-
- InitFieldWindows();
- RepaintFieldWindows();
-}
-
-void ScPivotLayoutDlg::UpdateOutputPos()
-{
- sal_uInt16 nSelPos = mpLbOutPos->GetSelectEntryPos();
- OUString aEntryStr = mpLbOutPos->GetEntry(nSelPos);
-
- if (aEntryStr == maStrNewTable)
- {
- // New sheet as output.
- mpEdOutPos->Disable();
- mpRbOutPos->Disable();
- mpEdOutPos->SetText(OUString()); // Clear the reference text.
- }
- else if (aEntryStr == maStrUndefined)
- {
- mpEdOutPos->Enable();
- mpRbOutPos->Enable();
- mpEdOutPos->SetText(maOutputRefStr);
- OutputPosUpdated();
- }
- else
- {
- // Named range as output. Get its corresponding reference string.
- const OUString* p = (const OUString*)mpLbOutPos->GetEntryData(nSelPos);
- if (p)
- mpEdOutPos->SetText(*p);
- }
-}
-
-void ScPivotLayoutDlg::OutputPosUpdated()
-{
- OUString aOutPosStr = mpEdOutPos->GetText();
- sal_uInt16 nResult = ScAddress().Parse(aOutPosStr, mpDoc, mpDoc->GetAddressConvention());
-
- if (!(nResult & SCA_VALID))
- {
- // Not a valid reference.
- mpEdOutPos->SetRefValid(false);
- return;
- }
-
- mpEdOutPos->SetRefValid(true);
-
- boost::ptr_vector<OUString>::const_iterator it =
- std::find(maRefStrs.begin(), maRefStrs.end(), aOutPosStr);
-
- if (it == maRefStrs.end())
- {
- // This is NOT one of the named ranges.
- mpLbOutPos->SelectEntryPos(0);
- return;
- }
-
- // Select the corresponding named range item in the list box. Be sure to
- // offset for the top two entries which are reserved for something else.
- boost::ptr_vector<OUString>::const_iterator itBeg = maRefStrs.begin();
- size_t nPos = std::distance(itBeg, it);
- mpLbOutPos->SelectEntryPos(nPos+2);
-}
-
-namespace {
-
-void EnableAndGrabFocus(formula::RefEdit& rEdit)
-{
- rEdit.Enable();
- rEdit.GrabFocus();
- rEdit.Enable();
-}
-
-}
-
-void ScPivotLayoutDlg::ExpanderClicked()
-{
- mbRefInputMode = mpExpander->get_expanded();
- if (!mpExpander->get_expanded())
- return;
-
- formula::RefEdit* p = mpEdInPos->IsEnabled() ? mpEdInPos : mpEdOutPos;
- EnableAndGrabFocus(*p);
-}
-
-void ScPivotLayoutDlg::RepaintFieldWindows()
-{
- Rectangle aRect; // currently has no effect whatsoever.
- mpWndPage->Paint(aRect);
- mpWndCol->Paint(aRect);
- mpWndRow->Paint(aRect);
- mpWndData->Paint(aRect);
-}
-
-ScDPFieldControlBase* ScPivotLayoutDlg::GetFieldWindow(ScPivotFieldType eType)
-{
- switch (eType)
- {
- case PIVOTFIELDTYPE_PAGE:
- return mpWndPage;
- case PIVOTFIELDTYPE_COL:
- return mpWndCol;
- case PIVOTFIELDTYPE_ROW:
- return mpWndRow;
- case PIVOTFIELDTYPE_DATA:
- return mpWndData;
- case PIVOTFIELDTYPE_SELECT:
- return mpWndSelect;
- default:
- ;
- }
- return NULL;
-}
-
-void ScPivotLayoutDlg::GetOtherFieldWindows(ScPivotFieldType eType, ScDPFieldControlBase*& rpWnd1, ScDPFieldControlBase*& rpWnd2)
-{
- rpWnd1 = NULL;
- rpWnd2 = NULL;
- switch (eType)
- {
- case PIVOTFIELDTYPE_PAGE:
- rpWnd1 = mpWndRow;
- rpWnd2 = mpWndCol;
- break;
- case PIVOTFIELDTYPE_COL:
- rpWnd1 = mpWndPage;
- rpWnd2 = mpWndRow;
- break;
- case PIVOTFIELDTYPE_ROW:
- rpWnd1 = mpWndPage;
- rpWnd2 = mpWndCol;
- break;
- default:
- ;
- }
-}
-
-void ScPivotLayoutDlg::SetReference( const ScRange& rRef, ScDocument* pDoc )
-{
- if (!mbRefInputMode || !mpRefInputEdit)
- return;
-
- if ( rRef.aStart != rRef.aEnd )
- RefInputStart(mpRefInputEdit);
-
- if (mpRefInputEdit == mpEdInPos)
- {
- OUString aRefStr(rRef.Format(SCR_ABS_3D, pDoc, pDoc->GetAddressConvention()));
- mpRefInputEdit->SetRefString(aRefStr);
- }
- else if (mpRefInputEdit == mpEdOutPos)
- {
- OUString aRefStr(rRef.aStart.Format(STD_FORMAT, pDoc, pDoc->GetAddressConvention()));
- mpRefInputEdit->SetRefString(aRefStr);
- maOutputRefStr = aRefStr;
- OutputPosUpdated();
- }
-}
-
-bool ScPivotLayoutDlg::IsRefInputMode() const
-{
- return mbRefInputMode;
-}
-
-void ScPivotLayoutDlg::SetActive()
-{
- if ( mbRefInputMode )
- {
- if (mpRefInputEdit)
- mpRefInputEdit->GrabFocus();
-
- if (mpRefInputEdit == mpEdInPos)
- EdInModifyHdl( NULL );
- else if (mpRefInputEdit == mpEdOutPos)
- EdOutModifyHdl( NULL );
- }
- else
- {
- GrabFocus();
- }
-
- RefInputDone();
-}
-
-IMPL_LINK( ScPivotLayoutDlg, ClickHdl, PushButton *, pBtn )
-{
- ScDPFieldControlBase* pWnd = GetFieldWindow( meLastActiveType );
- if (!pWnd)
- return 0;
-
- if( pBtn == mpBtnRemove )
- {
- RemoveField( meLastActiveType, pWnd->GetSelectedField() );
- if( !pWnd->IsEmpty() ) pWnd->GrabFocus();
- }
- else if( pBtn == mpBtnOptions )
- {
- NotifyDoubleClick( meLastActiveType, pWnd->GetSelectedField() );
- pWnd->GrabFocus();
- }
- return 0;
-}
-
-IMPL_LINK_NOARG(ScPivotLayoutDlg, OkHdl)
-{
- OUString aOutPosStr = mpEdOutPos->GetText();
- ScAddress aAdrDest;
- bool bToNewTable = (mpLbOutPos->GetSelectEntryPos() == 1);
- sal_uInt16 nResult = !bToNewTable ? aAdrDest.Parse( aOutPosStr, mpDoc, mpDoc->GetAddressConvention() ) : 0;
-
- if (!bToNewTable && (aOutPosStr.isEmpty() || (nResult & SCA_VALID) != SCA_VALID))
- {
- // Invalid reference. Bail out.
- if ( !mpExpander->get_expanded() )
- mpExpander->set_expanded(true);
-
- ErrorBox(this, WinBits(WB_OK | WB_DEF_OK), ScGlobal::GetRscString(STR_INVALID_TABREF)).Execute();
- mpEdOutPos->GrabFocus();
- return 0;
- }
-
- ScPivotParam theOutParam;
- vector<ScPivotField> aPageFields;
- vector<ScPivotField> aColFields;
- vector<ScPivotField> aRowFields;
- vector<ScPivotField> aDataFields;
-
- // Convert an array of function data into an array of pivot field data.
- bool bFit = GetPivotArrays(aPageFields, aColFields, aRowFields, aDataFields);
-
- if (!bFit)
- {
- // General data pilot table error. Bail out.
- ErrorBox(this, WinBits(WB_OK | WB_DEF_OK), ScGlobal::GetRscString(STR_PIVOT_ERROR)).Execute();
- return 0;
- }
-
- ScDPSaveData* pOldSaveData = mxDlgDPObject->GetSaveData();
-
- ScRange aOutRange( aAdrDest ); // bToNewTable is passed separately
-
- ScDPSaveData aSaveData;
- aSaveData.SetIgnoreEmptyRows( mpBtnIgnEmptyRows->IsChecked() );
- aSaveData.SetRepeatIfEmpty( mpBtnDetectCat->IsChecked() );
- aSaveData.SetColumnGrand( mpBtnTotalCol->IsChecked() );
- aSaveData.SetRowGrand( mpBtnTotalRow->IsChecked() );
- aSaveData.SetFilterButton( mpBtnFilter->IsChecked() );
- aSaveData.SetDrillDown( mpBtnDrillDown->IsChecked() );
-
- uno::Reference<sheet::XDimensionsSupplier> xSource = mxDlgDPObject->GetSource();
-
- ScDPObject::ConvertOrientation(
- aSaveData, aPageFields, sheet::DataPilotFieldOrientation_PAGE, xSource, maLabelData);
- ScDPObject::ConvertOrientation(
- aSaveData, aColFields, sheet::DataPilotFieldOrientation_COLUMN, xSource, maLabelData);
- ScDPObject::ConvertOrientation(
- aSaveData, aRowFields, sheet::DataPilotFieldOrientation_ROW, xSource, maLabelData);
- ScDPObject::ConvertOrientation(
- aSaveData, aDataFields, sheet::DataPilotFieldOrientation_DATA, xSource, maLabelData,
- &aColFields, &aRowFields, &aPageFields );
-
- for( ScDPLabelDataVector::const_iterator aIt = maLabelData.begin(), aEnd = maLabelData.end(); aIt != aEnd; ++aIt )
- {
- // "UNO" name may have trailing '*'s which signifies duplicate index.
- OUString aUnoName = ScDPUtil::createDuplicateDimensionName(aIt->maName, aIt->mnDupCount);
- ScDPSaveDimension* pDim = aSaveData.GetExistingDimensionByName(aUnoName);
-
- if (!pDim)
- continue;
-
- pDim->SetUsedHierarchy( aIt->mnUsedHier );
- pDim->SetShowEmpty( aIt->mbShowAll );
- pDim->SetSortInfo( &aIt->maSortInfo );
- pDim->SetLayoutInfo( &aIt->maLayoutInfo );
- pDim->SetAutoShowInfo( &aIt->maShowInfo );
- ScDPSaveDimension* pOldDim = NULL;
-
- bool bManualSort = ( aIt->maSortInfo.Mode == sheet::DataPilotFieldSortMode::MANUAL );
-
- // visibility of members
- for (vector<ScDPLabelData::Member>::const_iterator itr = aIt->maMembers.begin(), itrEnd = aIt->maMembers.end();
- itr != itrEnd; ++itr)
- {
- ScDPSaveMember* pMember = pDim->GetMemberByName(itr->maName);
-
- // #i40054# create/access members only if flags are not default
- // (or in manual sorting mode - to keep the order)
- if (bManualSort || !itr->mbVisible || !itr->mbShowDetails)
- {
- pMember->SetIsVisible(itr->mbVisible);
- pMember->SetShowDetails(itr->mbShowDetails);
- }
-
- if (!pOldDim)
- continue;
-
- // Transfer the existing layout name.
- ScDPSaveMember* pOldMember = pOldDim->GetMemberByName(itr->maName);
- if (pOldMember)
- {
- const OUString* pLayoutName = pOldMember->GetLayoutName();
- if (pLayoutName)
- pMember->SetLayoutName(*pLayoutName);
- }
- }
- }
- ScDPSaveDimension* pDim = aSaveData.GetDataLayoutDimension();
- if (pDim && pOldSaveData)
- {
- ScDPSaveDimension* pOldDim = pOldSaveData->GetDataLayoutDimension();
- if (pOldDim)
- {
- const OUString* pLayoutName = pOldDim->GetLayoutName();
- if (pLayoutName)
- pDim->SetLayoutName(*pLayoutName);
- }
- }
-
- // also transfer grand total name
- if (pOldSaveData)
- {
- const OUString* pGrandTotalName = pOldSaveData->GetGrandTotalName();
- if (pGrandTotalName)
- aSaveData.SetGrandTotalName(*pGrandTotalName);
- }
-
- sal_uInt16 nWhichPivot = SC_MOD()->GetPool().GetWhich( SID_PIVOT_TABLE );
- ScPivotItem aOutItem( nWhichPivot, &aSaveData, &aOutRange, bToNewTable );
-
- mbRefInputMode = false; // to allow deselecting when switching sheets
-
- SetDispatcherLock( false );
- SwitchToDocument();
-
- ScTabViewShell* pTabViewShell = mpViewData->GetViewShell();
- pTabViewShell->SetDialogDPObject(mxDlgDPObject.get());
-
- // don't hide the dialog before executing the slot, instead it is used as
- // parent for message boxes in ScTabViewShell::GetDialogParent
-
- const SfxPoolItem* pRet = GetBindings().GetDispatcher()->Execute(
- SID_PIVOT_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aOutItem, 0L, 0L );
-
- bool bSuccess = true;
- if (pRet)
- {
- const SfxBoolItem* pItem = dynamic_cast<const SfxBoolItem*>(pRet);
- if (pItem)
- bSuccess = pItem->GetValue();
- }
- if (bSuccess)
- // Table successfully inserted.
- Close();
- else
- {
- // Table insertion failed. Keep the dialog open.
- mbRefInputMode = true;
- SetDispatcherLock(true);
- }
-
- return 0;
-}
-
-IMPL_LINK_NOARG(ScPivotLayoutDlg, CancelHdl)
-{
- Close();
- return 0;
-}
-
-IMPL_LINK_NOARG(ScPivotLayoutDlg, ExpandHdl)
-{
- ExpanderClicked();
- return 0;
-}
-
-IMPL_LINK_NOARG(ScPivotLayoutDlg, EdOutModifyHdl)
-{
- OutputPosUpdated();
- return 0;
-}
-
-IMPL_LINK_NOARG(ScPivotLayoutDlg, EdInModifyHdl)
-{
- UpdateSrcRange();
- return 0;
-}
-
-IMPL_LINK_NOARG(ScPivotLayoutDlg, SelAreaHdl)
-{
- UpdateOutputPos();
- return 0;
-}
-
-IMPL_LINK( ScPivotLayoutDlg, GetRefEditFocusHdl, formula::RefEdit*, pEdit )
-{
- mpRefInputEdit = pEdit;
- return 0;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/AccessibleDataPilotControl.hxx b/sc/source/ui/inc/AccessibleDataPilotControl.hxx
deleted file mode 100644
index 583105ae40b8..000000000000
--- a/sc/source/ui/inc/AccessibleDataPilotControl.hxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-
-#ifndef _SC_ACCESSIBLEDATAPILOTCONTROL_HXX
-#define _SC_ACCESSIBLEDATAPILOTCONTROL_HXX
-
-#include "AccessibleContextBase.hxx"
-
-class ScDPFieldControlBase;
-class ScAccessibleDataPilotButton;
-
-class ScAccessibleDataPilotControl
- : public ScAccessibleContextBase
-{
-public:
- //===== internal ========================================================
- ScAccessibleDataPilotControl(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible>& rxParent,
- ScDPFieldControlBase* pFieldWindow);
-
- virtual void Init() SAL_OVERRIDE;
-
- using ScAccessibleContextBase::disposing;
- virtual void SAL_CALL disposing() SAL_OVERRIDE;
-
- void AddField(sal_Int32 nNewIndex);
- void MoveField(sal_Int32 nOldIndex, sal_Int32 nNewIndex);
- void RemoveField(sal_Int32 nOldIndex);
- void FieldFocusChange(sal_Int32 nOldIndex, sal_Int32 nNewIndex);
- void FieldNameChange(sal_Int32 nIndex);
- void GotFocus();
- void LostFocus();
-protected:
- virtual ~ScAccessibleDataPilotControl(void);
-public:
- ///===== XAccessibleComponent ============================================
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
- SAL_CALL getAccessibleAtPoint(
- const ::com::sun::star::awt::Point& rPoint )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual sal_Bool SAL_CALL isVisible( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual void SAL_CALL grabFocus( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual sal_Int32 SAL_CALL getForeground( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- virtual sal_Int32 SAL_CALL getBackground( )
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- ///===== XAccessibleContext ==============================================
-
- /// Return the number of currently visible children.
- virtual sal_Int32 SAL_CALL
- getAccessibleChildCount(void) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the specified child or NULL if index is invalid.
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
- getAccessibleChild(sal_Int32 nIndex)
- throw (::com::sun::star::uno::RuntimeException,
- ::com::sun::star::lang::IndexOutOfBoundsException, std::exception) SAL_OVERRIDE;
-
- /// Return the set of current states.
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
- getAccessibleStateSet(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- ///===== XServiceInfo ====================================================
-
- /** Returns an identifier for the implementation of this object.
- */
- virtual OUString SAL_CALL
- getImplementationName(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- ///===== XTypeProvider ===================================================
-
- /** Returns a implementation id.
- */
- virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
- getImplementationId(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-protected:
- /// Return this object's description.
- virtual OUString SAL_CALL
- createAccessibleDescription(void)
- throw (::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
-
- /// Return the object's current name.
- virtual OUString SAL_CALL
- createAccessibleName(void)
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the object's current bounding box relative to the desktop.
- virtual Rectangle GetBoundingBoxOnScreen(void) const
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
- /// Return the object's current bounding box relative to the parent object.
- virtual Rectangle GetBoundingBox(void) const
- throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
-
-private:
- ScDPFieldControlBase* mpFieldWindow;
- struct AccessibleWeak
- {
- ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xWeakAcc;
- ScAccessibleDataPilotButton* pAcc;
- AccessibleWeak() : pAcc(NULL) {}
- };
- ::std::vector< AccessibleWeak > maChildren;
-};
-
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/fieldwnd.hxx b/sc/source/ui/inc/fieldwnd.hxx
deleted file mode 100644
index 8442dc8862f4..000000000000
--- a/sc/source/ui/inc/fieldwnd.hxx
+++ /dev/null
@@ -1,405 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- */
-
-#ifndef SC_FIELDWND_HXX
-#define SC_FIELDWND_HXX
-
-#include <vector>
-
-#include <vcl/ctrl.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/scrbar.hxx>
-#include <vcl/layout.hxx>
-
-#include "address.hxx"
-#include "pivot.hxx"
-
-struct ScPivotField;
-class ScPivotLayoutDlg;
-class ScAccessibleDataPilotControl;
-
-extern const size_t PIVOTFIELD_INVALID;
-
-/** Type of the pivot table field window. */
-enum ScPivotFieldType
-{
- PIVOTFIELDTYPE_PAGE = 0, /// Window for all page fields.
- PIVOTFIELDTYPE_COL, /// Window for all column fields.
- PIVOTFIELDTYPE_ROW, /// Window for all row fields.
- PIVOTFIELDTYPE_DATA, /// Window for all data fields.
- PIVOTFIELDTYPE_SELECT, /// Selection window with all fields.
- PIVOTFIELDTYPE_UNKNOWN
-};
-
-/**
- * Represents a field area in the DataPilot layout dialog. This base class
- * handles storage of field names and the accessibility object.
- */
-class ScDPFieldControlBase : public Control
-{
-protected:
- struct FieldName
- {
- OUString maText;
- bool mbFits;
- sal_uInt8 mnDupCount;
- FieldName(const OUString& rText, bool bFits, sal_uInt8 nDupCount = 0);
- FieldName(const FieldName& r);
-
- OUString getDisplayedText() const;
- };
- typedef ::std::vector<FieldName> FieldNames;
-
-public:
- typedef boost::ptr_vector<ScPivotFuncData> FuncDataType;
-
- struct FuncItem
- {
- SCCOL mnCol;
- sal_uInt16 mnFuncMask;
- };
-
- /**
- * Custom scroll bar to pass the command event to its parent window.
- * We need this to pass the mouse wheel events to its parent field
- * control to have mouse wheel events appaer to be properly handled by the
- * scroll bar.
- */
- class ScrollBar : public ::ScrollBar
- {
- public:
- ScrollBar(Window* pParent, WinBits nStyle);
- virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
- private:
- Window* mpParent;
- };
-
- ScDPFieldControlBase( Window* pParent );
- virtual ~ScDPFieldControlBase();
-
- virtual void CalcSize() = 0;
-
- virtual void Init( ScPivotLayoutDlg* pDlg, FixedText* pCaption );
-
- virtual bool IsValidIndex( size_t nIndex ) const = 0;
- /** @return The pixel position of a field (without bound check). */
- virtual Point GetFieldPosition( size_t nIndex ) = 0;
- /** Calculates the field index at a specific pixel position. */
- virtual size_t GetFieldIndex( const Point& rPos ) = 0;
- /** @return The pixel size of a field. */
- virtual Size GetFieldSize() const = 0;
-
- /** @return The description of the control which is used for the accessibility objects. */
- virtual OUString GetDescription() const = 0;
- /** @return The type of the FieldWindow. */
- virtual ScPivotFieldType GetFieldType() const = 0;
- virtual void ScrollToShowSelection() = 0;
- virtual void ScrollToEnd() = 0;
- virtual void ResetScrollBar() = 0;
- virtual void HandleWheelScroll(long nNotch) = 0;
-
- /** @return The name of the control without shortcut. */
- OUString GetName() const;
- void SetName(const OUString& rName);
-
- /** @return TRUE, if the field with the given index exists. */
- bool IsExistingIndex( size_t nIndex ) const;
-
- void AppendField( const OUString& rText, const ScPivotFuncData& rFunc );
-
- /**
- * Inserts a field using the specified pixel position.
- *
- * @param rPos The coordinates to insert the field.
- */
- size_t AddField(const OUString& rText, const Point& rPos, const ScPivotFuncData& rFunc);
-
- bool MoveField(size_t nCurPos, const Point& rPos, size_t& rnIndex);
-
- /** Remove a field by specified index. */
- void DeleteFieldByIndex( size_t nIndex );
-
- /** Returns the number of existing fields. */
- size_t GetFieldCount() const;
-
- bool IsEmpty() const;
-
- /** Removes all fields. */
- void ClearFields();
- /** Changes the text on an existing field. */
- void SetFieldText(const OUString& rText, size_t nIndex, sal_uInt8 nDupCount);
- /** Returns the text of an existing field. */
- OUString GetFieldText( size_t nIndex ) const;
-
- /** Calculates a field index at a specific pixel position. Returns in every
- case the index of an existing field.
- @param rnIndex The index of the field is returned here.
- @return TRUE, if the index value is valid. */
- void GetExistingIndex( const Point& rPos, size_t& rnIndex );
-
- size_t GetSelectedField() const;
-
- /** Selects the next field. Called i.e. after moving a field from SELECT area. */
- void SelectNext();
- /** Grabs focus and sets new selection. */
- void GrabFocusAndSelect( size_t nIndex );
-
- const ScPivotFuncData& GetFuncData(size_t nIndex) const;
- ScPivotFuncData& GetFuncData(size_t nIndex);
-
- void GetAllFuncItems(std::vector<FuncItem>& rItems) const;
-
- sal_uInt8 GetNextDupCount(const ScPivotFuncData& rData, size_t nSelfIndex) const;
-
- void ConvertToPivotArray(std::vector<ScPivotField>& rFields) const;
-
- size_t GetFieldIndexByData( const ScPivotFuncData& rData ) const;
-
- virtual void Paint( const Rectangle& rRect ) SAL_OVERRIDE;
-
-protected:
- virtual void StateChanged( StateChangedType nStateChange ) SAL_OVERRIDE;
- virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
- virtual void KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
- virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
- virtual void MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
- virtual void GetFocus() SAL_OVERRIDE;
- virtual void LoseFocus() SAL_OVERRIDE;
- virtual void Resize() SAL_OVERRIDE;
-
-protected:
- FieldNames& GetFieldNames();
- const FieldNames& GetFieldNames() const;
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
-
- void FieldFocusChanged(size_t nOldSelected, size_t nFieldSelected);
-
- /** Updates the tab stop style bits. */
- void UpdateStyle();
-
- /** Draw background color for the whole control area. */
- void DrawBackground( OutputDevice& rDev );
-
- /** Draw a single field button. */
- void DrawField( OutputDevice& rDev, const Rectangle& rRect,
- FieldName& rText, bool bFocus );
-
- void AppendPaintable(Window* p);
- void DrawPaintables();
- void DrawInvertSelection();
- Size GetStdFieldBtnSize() const;
-
- /** @return The new selection index after moving to the given direction. */
- virtual size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const = 0;
-
- /**
- * @param nIndex logical index of a field name, independent of scroll
- * offsets.
- * @return Display position of the button. The first displayed button is
- * always 0 no matter what the current scroll offset is. In case
- * the field specified by the index is outside the visible range,
- * <code>INVALID_INDEX</code> is returned.
- */
- virtual size_t GetDisplayPosition(size_t nIndex) const = 0;
-
- /** Draws the complete control. */
- virtual void Redraw() = 0;
-
-private:
- /** Moves the selected field to nDestIndex. */
- void MoveField( size_t nDestIndex );
- /** Moves the selected field to the given direction. */
- void MoveFieldRel( SCsCOL nDX, SCsROW nDY );
-
- /** Selects a field and adjusts scrolling position to make the field visible. */
- void MoveSelection( size_t nSelectedIndex );
- /** Selects a field at a new position relative to the current. */
- void MoveSelection( SCsCOL nDX, SCsROW nDY );
-
- sal_uInt8 GetNextDupCount(const OUString& rFieldText) const;
-
-private:
- typedef ::std::vector<Window*> Paintables;
- Paintables maPaintables;
-
- FuncDataType maFuncData;
- FieldNames maFieldNames; /// String array of the field names and flags, if text fits into button.
- ScPivotLayoutDlg* mpDlg;
- FixedText* mpCaption; /// FixedText containing the name of the control.
- OUString maName;
-
- size_t mnFieldSelected; /// Currently selected field.
-
- // Hold a helpful reference while we work with our weakref.
- class AccessRef
- {
- com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxRef;
- public:
- AccessRef( const com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > & rAccessible );
- ScAccessibleDataPilotControl *operator -> () const;
- bool is() { return mxRef.is(); }
- };
-
- com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > mxAccessible;
-};
-
-
-
-/**
- * Base class for field control with a horizontal scroll bar at the bottom.
- * Page, column, data and select fields are derived from this class.
- */
-class ScDPHorFieldControl : public ScDPFieldControlBase
-{
-protected:
- virtual size_t CalcNewFieldIndex(SCsCOL nDX, SCsROW nDY) const SAL_OVERRIDE;
- virtual size_t GetDisplayPosition(size_t nIndex) const SAL_OVERRIDE;
- virtual void Redraw() SAL_OVERRIDE;
-
-public:
- ScDPHorFieldControl(Window* pParent);
-
- virtual ~ScDPHorFieldControl();
-
- virtual void CalcSize() SAL_OVERRIDE;
- virtual bool IsValidIndex( size_t nIndex ) const SAL_OVERRIDE;
- virtual Point GetFieldPosition(size_t nIndex) SAL_OVERRIDE;
- virtual Size GetFieldSize() const SAL_OVERRIDE;
- virtual size_t GetFieldIndex( const Point& rPos ) SAL_OVERRIDE;
- virtual OUString GetDescription() const SAL_OVERRIDE;
-
- virtual void ScrollToEnd() SAL_OVERRIDE;
- virtual void ScrollToShowSelection() SAL_OVERRIDE;
- virtual void ResetScrollBar() SAL_OVERRIDE;
- virtual void HandleWheelScroll(long nNotch) SAL_OVERRIDE;
-
-private:
- bool GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize);
- void HandleScroll();
-
- DECL_LINK(ScrollHdl, void*);
- DECL_LINK(EndScrollHdl, void*);
-
-private:
-
- ScrollBar maScroll;
-
- size_t mnFieldBtnRowCount;
- size_t mnFieldBtnColCount;
-};
-
-
-
-class ScDPPageFieldControl : public ScDPHorFieldControl
-{
-public:
- ScDPPageFieldControl( Window* pParent );
- virtual ~ScDPPageFieldControl();
-
- virtual ScPivotFieldType GetFieldType() const SAL_OVERRIDE;
- virtual OUString GetDescription() const SAL_OVERRIDE;
-};
-
-
-
-class ScDPColFieldControl : public ScDPHorFieldControl
-{
-public:
- ScDPColFieldControl( Window* pParent );
- virtual ~ScDPColFieldControl();
-
- virtual ScPivotFieldType GetFieldType() const SAL_OVERRIDE;
- virtual OUString GetDescription() const SAL_OVERRIDE;
-};
-
-
-
-/**
- * Row field control with a vertical scroll bar.
- */
-class ScDPRowFieldControl : public ScDPFieldControlBase
-{
-public:
- ScDPRowFieldControl( Window* pParent );
-
- virtual ~ScDPRowFieldControl();
-
- virtual void CalcSize() SAL_OVERRIDE;
- virtual bool IsValidIndex( size_t nIndex ) const SAL_OVERRIDE;
- virtual Point GetFieldPosition( size_t nIndex ) SAL_OVERRIDE;
- virtual Size GetFieldSize() const SAL_OVERRIDE;
- virtual size_t GetFieldIndex( const Point& rPos ) SAL_OVERRIDE;
- virtual OUString GetDescription() const SAL_OVERRIDE;
- virtual ScPivotFieldType GetFieldType() const SAL_OVERRIDE;
-
- virtual void ScrollToEnd() SAL_OVERRIDE;
- virtual void ScrollToShowSelection() SAL_OVERRIDE;
- virtual void ResetScrollBar() SAL_OVERRIDE;
- virtual void HandleWheelScroll(long nNotch) SAL_OVERRIDE;
-
-protected:
- virtual size_t CalcNewFieldIndex( SCsCOL nDX, SCsROW nDY ) const SAL_OVERRIDE;
- virtual size_t GetDisplayPosition(size_t nIndex) const SAL_OVERRIDE;
- virtual void Redraw() SAL_OVERRIDE;
-
-private:
- bool GetFieldBtnPosSize(size_t nPos, Point& rPos, Size& rSize);
- void HandleScroll();
-
- DECL_LINK(ScrollHdl, void*);
- DECL_LINK(EndScrollHdl, void*);
-
-private:
-
- ScDPFieldControlBase::ScrollBar maScroll;
- size_t mnColumnBtnCount;
-};
-
-
-
-class ScDPSelectFieldControl : public ScDPHorFieldControl
-{
-public:
- ScDPSelectFieldControl( Window* pParent );
- virtual ~ScDPSelectFieldControl();
-
- virtual ScPivotFieldType GetFieldType() const SAL_OVERRIDE;
- virtual OUString GetDescription() const SAL_OVERRIDE;
-};
-
-
-
-class ScDPDataFieldControl : public ScDPHorFieldControl
-{
-public:
- ScDPDataFieldControl( Window* pParent );
- virtual ~ScDPDataFieldControl();
-
- virtual ScPivotFieldType GetFieldType() const SAL_OVERRIDE;
- virtual Size GetFieldSize() const SAL_OVERRIDE;
- virtual OUString GetDescription() const SAL_OVERRIDE;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/pvlaydlg.hxx b/sc/source/ui/inc/pvlaydlg.hxx
deleted file mode 100644
index 12046580edfe..000000000000
--- a/sc/source/ui/inc/pvlaydlg.hxx
+++ /dev/null
@@ -1,272 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * 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.
- *
- * This file incorporates work covered by the following license notice:
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed
- * with this work for additional information regarding copyright
- * ownership. The ASF licenses this file to you under the Apache
- * License, Version 2.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.apache.org/licenses/LICENSE-2.0 .
- ************************************************************************/
-
-#ifndef SC_PVLAYDLG_HXX
-#define SC_PVLAYDLG_HXX
-
-#include <config_lgpl.h>
-
-#include <vector>
-
-#include <boost/ptr_container/ptr_vector.hpp>
-#include <boost/scoped_ptr.hpp>
-
-#include <formula/funcutl.hxx>
-#include <svtools/stdctrl.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/morebtn.hxx>
-#include <vcl/scrbar.hxx>
-
-#include "anyrefdg.hxx"
-#include "fieldwnd.hxx"
-
-/*==========================================================================*\
-
- An instance of the class ScPivotLayoutDlg is a (semi-)modal dialog
- that can be associated to the mouse fields with column headings of
- the three pivot categories "column", "row" and "data".
-
- The dialog receives information about these headers (name,
- type (number/string) and function mask) in the label data structure
- Furthermore, three pivot field arrays are passed on, with which the three
- category windows are initialized. A window class is represented by an
- instance of class FieldWindow. Such a window is responsible for the
- representation of data structures on the screen. It reports on mouse
- actions in the dialogue and provides appropriate methods for
- changing the representation. The dialogue provides the adjustment of the
- internal data structures with respect to the representation on the screen.
- Another FieldWindow(Select) provides all table headers for selection,
- is thus "read only".
-
-\*==========================================================================*/
-
-class ScViewData;
-class ScDocument;
-struct ScPivotFuncData;
-class ScDPObject;
-
-#define PIVOTSTR_SUM 0
-#define PIVOTSTR_COUNT 1
-#define PIVOTSTR_AVG 2
-#define PIVOTSTR_MAX 3
-#define PIVOTSTR_MIN 4
-#define PIVOTSTR_PROD 5
-#define PIVOTSTR_COUNT2 6
-#define PIVOTSTR_DEV 7
-#define PIVOTSTR_DEV2 8
-#define PIVOTSTR_VAR 9
-#define PIVOTSTR_VAR2 10
-
-class ScPivotLayoutDlg : public ScAnyRefDlg
-{
- /** data source type */
- enum DataSrcType {
- SRC_REF, /// range reference
- SRC_NAME, /// range name
- SRC_INVALID /// invalid range
- };
-public:
- ScPivotLayoutDlg(
- SfxBindings* pB,
- SfxChildWindow* pCW,
- Window* pParent,
- const ScDPObject& rDPObject,
- bool bNewOutput );
- virtual ~ScPivotLayoutDlg();
-
- void NotifyDoubleClick ( ScPivotFieldType eType, size_t nFieldIndex );
- PointerStyle NotifyMouseButtonDown( ScPivotFieldType eType, size_t nFieldIndex );
- void NotifyFieldFocus ( ScPivotFieldType eType, bool bGotFocus );
- void NotifyMoveFieldToEnd ( ScPivotFieldType eToType );
- void NotifyRemoveField ( ScPivotFieldType eType, size_t nFieldIndex );
-
- Size GetStdFieldBtnSize() const;
-
- /**
- * Drop currently dragged field item into specified position.
- *
- * @param rScrPos screen position of mouse cursor.
- * @param eToType type of field at mouse cursor position.
- */
- void DropFieldItem( const Point& rScrPos, ScPivotFieldType eToType );
-
- /**
- * Get pointer style during dragging of field
- * item.
- */
- PointerStyle GetPointerStyle( ScPivotFieldType eFieldType );
-
- /**
- * Determine the type of field at mouse cursor position.
- *
- * @param rScrPos mouse cursor position (screen position).
- */
- ScPivotFieldType GetFieldTypeAtPoint( const Point& rScrPos ) const;
-
-protected:
- virtual void Deactivate() SAL_OVERRIDE;
- virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) SAL_OVERRIDE;
- virtual bool IsRefInputMode() const SAL_OVERRIDE;
- virtual void SetActive() SAL_OVERRIDE;
- virtual bool Close() SAL_OVERRIDE;
-
-private:
- /** Returns the localized function name for the specified resource index. */
- inline const OUString& GetFuncName( sal_uInt16 nFuncIdx ) const { return maFuncNames[nFuncIdx]; }
-
- /** Fills the field windows from the current pivot table settings. */
- void InitFieldWindows();
- /** Sets focus to the specified field control, if it is not empty. */
- void GrabFieldFocus( ScDPFieldControlBase* rFieldWindow );
-
- void InitWndSelect(const ScDPLabelDataVector& rLabels);
- void InitWndData(const std::vector<ScPivotField>& rFields);
- void InitFieldWindow ( const ::std::vector<ScPivotField>& rFields, ScPivotFieldType eType );
- void AdjustDlgSize();
- ScDPLabelData* GetLabelData( SCCOL nCol );
- OUString GetLabelString(SCsCOL nCol);
- bool IsOrientationAllowed( SCsCOL nCol, ScPivotFieldType eType );
- OUString GetFuncString( sal_uInt16& rFuncMask, bool bIsValue = true );
-
- void AddField ( size_t nFromIndex,
- ScPivotFieldType eToType, const Point& rAtPos );
- void AppendField(size_t nFromIndex, ScPivotFieldType eToType);
- void MoveField ( ScPivotFieldType eFromType, size_t nFromIndex,
- ScPivotFieldType eToType, const Point& rAtPos );
- void MoveFieldToEnd(ScPivotFieldType eFromType, size_t nFromIndex, ScPivotFieldType eToType);
- void RemoveField ( ScPivotFieldType eRemType, size_t nRemIndex );
-
- bool GetPivotArrays( ::std::vector<ScPivotField>& rPageFields,
- ::std::vector<ScPivotField>& rColFields,
- ::std::vector<ScPivotField>& rRowFields,
- ::std::vector<ScPivotField>& rDataFields );
-
- void UpdateSrcRange();
- void UpdateOutputPos();
- void OutputPosUpdated();
- void ExpanderClicked();
-
- void RepaintFieldWindows();
-
- /**
- * Initialize control sizes and the dialog size which depends on them.
- */
- void InitControlAndDlgSizes();
-
- ScDPFieldControlBase* GetFieldWindow(ScPivotFieldType eType);
-
- /**
- * Get pointers to field windows that are <b>not</b> the window of
- * specified type. The select window type is not included.
- */
- void GetOtherFieldWindows(
- ScPivotFieldType eType, ScDPFieldControlBase*& rpWnd1, ScDPFieldControlBase*& rpWnd2);
-
- // Handler
- DECL_LINK( ClickHdl, PushButton * );
- DECL_LINK( OkHdl, void * );
- DECL_LINK( CancelHdl, void * );
- DECL_LINK( ExpandHdl, void * );
- DECL_LINK( EdOutModifyHdl, void * );
- DECL_LINK( EdInModifyHdl, void * );
- DECL_LINK( SelAreaHdl, void * );
- DECL_LINK( GetRefEditFocusHdl, formula::RefEdit* );
-
-private:
- typedef boost::scoped_ptr<ScDPObject> ScDPObjectPtr;
-
- FixedText* mpFtPage;
- ScDPPageFieldControl* mpWndPage;
- FixedText* mpFtCol;
- ScDPColFieldControl* mpWndCol;
- FixedText* mpFtRow;
- ScDPRowFieldControl* mpWndRow;
- FixedText* mpFtData;
- ScDPDataFieldControl* mpWndData;
- ScDPSelectFieldControl* mpWndSelect;
- FixedText* mpFtInfo;
-
- std::vector<ScDPFieldControlBase*> maFieldCtrls;
-
- FixedText* mpFtInArea;
- ::formula::RefEdit* mpEdInPos;
- ::formula::RefButton* mpRbInPos;
- ListBox* mpLbOutPos;
- FixedText* mpFtOutArea;
- formula::RefEdit* mpEdOutPos;
- formula::RefButton* mpRbOutPos;
- CheckBox* mpBtnIgnEmptyRows;
- CheckBox* mpBtnDetectCat;
- CheckBox* mpBtnTotalCol;
- CheckBox* mpBtnTotalRow;
- CheckBox* mpBtnFilter;
- CheckBox* mpBtnDrillDown;
-
- OKButton* mpBtnOk;
- CancelButton* mpBtnCancel;
- PushButton* mpBtnRemove;
- PushButton* mpBtnOptions;
- VclExpander* mpExpander;
- std::vector<OUString> maFuncNames; /// Localized function names from resource.
- boost::ptr_vector<OUString> maRefStrs; /// Reference strings stored with the output list box.
- ScDPObjectPtr mxDlgDPObject; /// Clone of the pivot table object this dialog is based on.
- ScPivotParam maPivotData; /// The pivot table field configuration.
- ScDPLabelDataVector maLabelData; /// Information about all dimensions.
-
- ScViewData* mpViewData;
- ScDocument* mpDoc;
- formula::RefEdit* mpRefInputEdit;
-
- const OUString maStrUndefined;
- const OUString maStrNewTable;
- OUString maOutputRefStr; /// Used only for caching in UI.
-
- ScPivotFieldType meDnDFromType;
- size_t mnDnDFromIndex;
- bool mbIsDrag;
-
- ScPivotFieldType meLastActiveType; /// Type of last active area.
- size_t mnOffset; /// Offset of first field in TYPE_SELECT area.
-
- ScRange maOldRange;
- bool mbRefInputMode;
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
-
-#endif
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index ac7b7a0a5797..ad3d4742fb68 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -43,9 +43,6 @@
#include "consdlg.hxx"
#include "filtdlg.hxx"
#include "dbnamdlg.hxx"
-#if ! MPL_HAVE_SUBSET
-# include "pvlaydlg.hxx"
-#endif
#include "areasdlg.hxx"
#include "rangeutl.hxx"
#include "crnrdlg.hxx"
diff --git a/sc/uiconfig/scalc/ui/pivottablelayout.ui b/sc/uiconfig/scalc/ui/pivottablelayout.ui
deleted file mode 100644
index e114a0764be1..000000000000
--- a/sc/uiconfig/scalc/ui/pivottablelayout.ui
+++ /dev/null
@@ -1,745 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.16.1 -->
-<interface>
- <requires lib="gtk+" version="3.0"/>
- <!-- interface-requires LibreOffice 1.0 -->
- <object class="GtkDialog" id="PivotTableLayout">
- <property name="can_focus">False</property>
- <property name="border_width">6</property>
- <property name="title" translatable="yes">Pivot table</property>
- <property name="type_hint">dialog</property>
- <child internal-child="vbox">
- <object class="GtkBox" id="dialog-vbox1">
- <property name="can_focus">False</property>
- <property name="spacing">12</property>
- <child internal-child="action_area">
- <object class="GtkButtonBox" id="dialog-action_area1">
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="layout_style">start</property>
- <child>
- <object class="GtkButton" id="ok">
- <property name="label">gtk-ok</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_default">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="cancel">
- <property name="label">gtk-cancel</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="help">
- <property name="label">gtk-help</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="remove">
- <property name="label">gtk-remove</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="options">
- <property name="label" translatable="yes">Options...</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="box1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <child>
- <object class="GtkBox" id="box2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="spacing">12</property>
- <child>
- <object class="GtkBox" id="box5">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkGrid" id="grid1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <property name="row_homogeneous">True</property>
- <property name="column_homogeneous">True</property>
- <child>
- <object class="sclo-ScDPColFieldControl" id="columnfield">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
- <property name="width">6</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="sclo-ScDPDataFieldControl" id="datafield">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">2</property>
- <property name="width">6</property>
- <property name="height">2</property>
- </packing>
- </child>
- <child>
- <object class="sclo-ScDPPageFieldControl" id="pagefield">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">7</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="sclo-ScDPRowFieldControl" id="rowfield">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="vexpand">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">2</property>
- <property name="height">2</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="info">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Drag the fields from the right into the desired position</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="sclo-ScDPSelectFieldControl" id="buttonfield">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkExpander" id="more">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkFrame" id="frame1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="top_padding">6</property>
- <property name="left_padding">12</property>
- <child>
- <object class="GtkBox" id="box3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkBox" id="box4">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="spacing">6</property>
- <child>
- <object class="GtkGrid" id="grid2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">12</property>
- <child>
- <object class="GtkLabel" id="select_from">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">_Selection from:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">rangesel1</property>
- <property name="ellipsize">end</property>
- </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>
- <child>
- <object class="foruilo-RefButton" id="changebutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="foruilo-RefButton" id="changebutton2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="left_attach">3</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="foruilo-RefEdit" id="rangesel2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="hexpand">True</property>
- <property name="width_chars">25</property>
- </object>
- <packing>
- <property name="left_attach">2</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="target_area">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="results_to">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Res_ults to:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="foruilo-RefEdit" id="rangesel1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">2</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkGrid" id="grid3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hexpand">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkCheckButton" id="ignore_empty">
- <property name="label" translatable="yes">Ignore _empty rows</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </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>
- <child>
- <object class="GtkCheckButton" id="detect_category">
- <property name="label" translatable="yes">_Identify categories</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">0</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="total_cols">
- <property name="label" translatable="yes">Total colum_ns</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="total_rows">
- <property name="label" translatable="yes">_Total rows</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">1</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="add_filter">
- <property name="label" translatable="yes">_Add filter</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">0</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkCheckButton" id="drill_down">
- <property name="label" translatable="yes">Ena_ble drill to details</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="hexpand">True</property>
- <property name="use_underline">True</property>
- <property name="xalign">0</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="top_attach">2</property>
- <property name="width">1</property>
- <property name="height">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Result</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- </attributes>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">More</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="page_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Page Fields</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">pagefield</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="column_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Column Fields</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">columnfield</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="row_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Row Fields</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">rowfield</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">4</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="data_text">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Data Fields</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">datafield</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">5</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="select_text">
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">Selection area</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">buttonfield</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">6</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="sum">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Sum - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">7</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="count">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Count - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">8</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="mean">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Mean - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">9</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="max">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Max - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">10</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="min">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Min - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">11</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="product">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Product - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">12</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="count2">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Count - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">13</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="stdev">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">StDev - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">14</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="stdevp">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">StDevP - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">15</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="var">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Var - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">16</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="varp">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">VarP - </property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">17</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- <action-widgets>
- <action-widget response="0">ok</action-widget>
- <action-widget response="0">cancel</action-widget>
- <action-widget response="0">help</action-widget>
- <action-widget response="0">remove</action-widget>
- <action-widget response="0">options</action-widget>
- </action-widgets>
- </object>
-</interface>
diff --git a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
index e7820a7d4e5c..deb025f6ba7b 100644
--- a/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
+++ b/sc/uiconfig/scalc/ui/pivottablelayoutdialog.ui
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.1 -->
<interface>
- <!-- interface-requires gtk+ 3.0 -->
+ <requires lib="gtk+" version="3.0"/>
<!-- interface-requires LibreOffice 1.0 -->
<object class="GtkDialog" id="PivotTableLayout">
<property name="can_focus">False</property>
@@ -385,7 +386,7 @@
</packing>
</child>
<child>
- <object class="GtkExpander" id="expander2">
+ <object class="GtkExpander" id="options">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -393,7 +394,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
- <property name="border_width">12</property>
+ <property name="margin_top">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
@@ -518,7 +519,7 @@
</packing>
</child>
<child>
- <object class="GtkExpander" id="expander1">
+ <object class="GtkExpander" id="more">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
@@ -526,6 +527,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">12</property>
+ <property name="margin_top">6</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
<property name="row_spacing">6</property>
@@ -592,7 +594,6 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>
@@ -710,7 +711,6 @@
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="invisible_char">●</property>
- <property name="invisible_char_set">True</property>
</object>
<packing>
<property name="left_attach">1</property>