diff options
Diffstat (limited to 'sc/inc')
187 files changed, 45208 insertions, 0 deletions
diff --git a/sc/inc/AccessibleFilterMenu.hxx b/sc/inc/AccessibleFilterMenu.hxx new file mode 100644 index 000000000000..25405a58a369 --- /dev/null +++ b/sc/inc/AccessibleFilterMenu.hxx @@ -0,0 +1,194 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ACCESSIBLEFILTERMENU_HXX +#define SC_ACCESSIBLEFILTERMENU_HXX + +#include "AccessibleContextBase.hxx" +#include "cppuhelper/implbase1.hxx" + +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +#include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp> +#include <com/sun/star/accessibility/TextSegment.hpp> + +#include <vector> + +namespace com { namespace sun { namespace star { + namespace accessibility { + struct AccessibleEventObject; + } +}}} + +class ScDocument; +class ScMenuFloatingWindow; + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleSelection > ScAccessibleFilterMenu_BASE; + +class ScAccessibleFilterMenu : + public ScAccessibleContextBase, + public ScAccessibleFilterMenu_BASE +{ +public: + explicit ScAccessibleFilterMenu( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent, + ScMenuFloatingWindow* pWin, const ::rtl::OUString& rName, size_t nMenuPos, ScDocument* pDoc); + virtual ~ScAccessibleFilterMenu(); + + // 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); + + virtual sal_Bool SAL_CALL isVisible() + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL grabFocus() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getForeground() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getBackground() + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleContext + + virtual ::rtl::OUString SAL_CALL getAccessibleName() + throw (::com::sun::star::uno::RuntimeException); + + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw (::com::sun::star::uno::RuntimeException); + + 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); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL + getAccessibleStateSet() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleEventBroadcaster + + using ScAccessibleContextBase::addEventListener; + using ScAccessibleContextBase::removeEventListener; + + virtual void SAL_CALL + addEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) + throw (com::sun::star::uno::RuntimeException); + + // Remove an existing event listener. + virtual void SAL_CALL + removeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleEventListener>& xListener) + throw (com::sun::star::uno::RuntimeException); + + // XAccessibleSelection + + virtual void SAL_CALL selectAccessibleChild(sal_Int32 nChildIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL isAccessibleChildSelected(sal_Int32 nChildIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL clearAccessibleSelection() + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL selectAllAccessibleChildren() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getSelectedAccessibleChildCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL + getSelectedAccessibleChild(sal_Int32 nChildIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL deselectAccessibleChild(sal_Int32 nChildIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + // XInterface + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + ::com::sun::star::uno::Type const & rType ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // XTypeProvider + + virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId() + throw (::com::sun::star::uno::RuntimeException); + + // non-UNO methods + + void appendMenuItem(const ::rtl::OUString& rName, bool bEnabled, size_t nMenuPos); + void setMenuPos(size_t nMenuPos); + void setEnabled(bool bEnabled); + +protected: + + sal_Int32 getMenuItemCount() const; + + virtual Rectangle GetBoundingBoxOnScreen() const + throw (::com::sun::star::uno::RuntimeException); + + virtual Rectangle GetBoundingBox() const + throw (::com::sun::star::uno::RuntimeException); + +private: + bool isSelected() const; + bool isFocused() const; + + void updateStates(); + +private: + ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > maMenuItems; + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; + + size_t mnMenuPos; + ScMenuFloatingWindow* mpWindow; + ScDocument* mpDoc; + + bool mbEnabled:1; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/AccessibleFilterMenuItem.hxx b/sc/inc/AccessibleFilterMenuItem.hxx new file mode 100644 index 000000000000..fbdcfbb6b36e --- /dev/null +++ b/sc/inc/AccessibleFilterMenuItem.hxx @@ -0,0 +1,124 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ACCESSIBLEFILTERMENUITEM_HXX +#define SC_ACCESSIBLEFILTERMENUITEM_HXX + +#include "AccessibleContextBase.hxx" +#include "cppuhelper/implbase1.hxx" + +#include <com/sun/star/accessibility/XAccessibleAction.hpp> + +class ScMenuFloatingWindow; + +typedef ::cppu::ImplHelper1< + ::com::sun::star::accessibility::XAccessibleAction > ScAccessibleFilterMenuItem_BASE; + +class ScAccessibleFilterMenuItem : + public ScAccessibleContextBase, + public ScAccessibleFilterMenuItem_BASE +{ +public: + explicit ScAccessibleFilterMenuItem( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent, ScMenuFloatingWindow* pWin, const ::rtl::OUString& rName, size_t nMenuPos); + + virtual ~ScAccessibleFilterMenuItem(); + + // XAccessibleContext + + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw (::com::sun::star::uno::RuntimeException); + + 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); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL + getAccessibleStateSet() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + + // XAccessibleAction + + virtual ::sal_Int32 SAL_CALL getAccessibleActionCount() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL doAccessibleAction(sal_Int32 nIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription(sal_Int32 nIndex) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + 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); + + // XInterface + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + ::com::sun::star::uno::Type const & rType ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + + // Non-UNO Methods + + void setEnabled(bool bEnabled); + +protected: + + virtual Rectangle GetBoundingBoxOnScreen() const + throw (::com::sun::star::uno::RuntimeException); + + virtual Rectangle GetBoundingBox() const + throw (::com::sun::star::uno::RuntimeException); + +private: + bool isSelected() const; + bool isFocused() const; + void updateStateSet(); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > mxStateSet; + + ScMenuFloatingWindow* mpWindow; + ::rtl::OUString maName; + size_t mnMenuPos; + bool mbEnabled; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/AccessibleFilterTopWindow.hxx b/sc/inc/AccessibleFilterTopWindow.hxx new file mode 100644 index 000000000000..d45a90a2cd0c --- /dev/null +++ b/sc/inc/AccessibleFilterTopWindow.hxx @@ -0,0 +1,100 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ACCESSIBLEFILTERTOPWINDOW_HXX +#define SC_ACCESSIBLEFILTERTOPWINDOW_HXX + +#include "AccessibleFilterMenu.hxx" +#include "cppuhelper/implbase1.hxx" + +class ScDPFieldPopupWindow; +class ScDocument; + +class ScAccessibleFilterTopWindow : public ScAccessibleFilterMenu +{ +public: + ScAccessibleFilterTopWindow( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible>& rxParent, + ScDPFieldPopupWindow* pWin, const ::rtl::OUString& rName, ScDocument* pDoc); + virtual ~ScAccessibleFilterTopWindow(); + + // XAccessibleContext + + virtual sal_Int32 SAL_CALL getAccessibleChildCount() + throw (::com::sun::star::uno::RuntimeException); + + 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); + + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + + // Non-UNO Methods + + enum ChildControlType { + LISTBOX, TOGGLE_ALL, SINGLE_ON_BTN, SINGLE_OFF_BTN, OK_BTN, CANCEL_BTN + }; + void setAccessibleChild( + const ::com::sun::star::uno::Reference< + ::com::sun::star::accessibility::XAccessible >& rAccessible, + ChildControlType eType); + +private: + /** The top menu part */ + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccMenu; + + /** check list box for field member visibility */ + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccListBox; + + /** check box for toggling all field member's visibility. */ + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccToggleAll; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccSingleOnBtn; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccSingleOffBtn; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccOkBtn; + + ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > + mxAccCancelBtn; + + ScDPFieldPopupWindow* mpWindow; + ScDocument* mpDoc; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/AccessibleGlobal.hxx b/sc/inc/AccessibleGlobal.hxx new file mode 100644 index 000000000000..5c06ed29edaf --- /dev/null +++ b/sc/inc/AccessibleGlobal.hxx @@ -0,0 +1,72 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ACCESSIBLEGLOBAL_HXX +#define SC_ACCESSIBLEGLOBAL_HXX + +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include "cppuhelper/implbase1.hxx" + +#include <set> + +/** + * Generic XAccessibleStateSet implementation. + */ +class ScAccessibleStateSet : public ::cppu::WeakImplHelper1< ::com::sun::star::accessibility::XAccessibleStateSet > +{ +public: + ScAccessibleStateSet(); + virtual ~ScAccessibleStateSet(); + + // XAccessibleStateSet + + virtual ::sal_Bool SAL_CALL isEmpty() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL contains(sal_Int16 nState) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL containsAll( + const ::com::sun::star::uno::Sequence<sal_Int16>& aStateSet) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence<sal_Int16> SAL_CALL getStates() + throw (::com::sun::star::uno::RuntimeException); + + // Non-UNO Methods + + void insert(sal_Int16 nState); + void clear(); + +private: + ::std::set<sal_Int16> maStates; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx b/sc/inc/ViewSettingsSequenceDefines.hxx new file mode 100644 index 000000000000..a0167898607d --- /dev/null +++ b/sc/inc/ViewSettingsSequenceDefines.hxx @@ -0,0 +1,112 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SC_VIEWSETTINGSSEQUENCEDEFINES_HXX +#define _SC_VIEWSETTINGSSEQUENCEDEFINES_HXX + +// this are the defines for the position of the settings in the +// ViewSettingsSequence + +#define SC_VIEWSETTINGS_COUNT 23 + +#define SC_VIEW_ID 0 +#define SC_TABLE_VIEWSETTINGS 1 +#define SC_ACTIVE_TABLE 2 +#define SC_HORIZONTAL_SCROLL_BAR_WIDTH 3 +#define SC_ZOOM_TYPE 4 +#define SC_ZOOM_VALUE 5 +#define SC_PAGE_VIEW_ZOOM_VALUE 6 +#define SC_PAGE_BREAK_PREVIEW 7 +#define SC_SHOWZERO 8 +#define SC_SHOWNOTES 9 +#define SC_SHOWGRID 10 +#define SC_GRIDCOLOR 11 +#define SC_SHOWPAGEBR 12 +#define SC_COLROWHDR 13 +#define SC_SHEETTABS 14 +#define SC_OUTLSYMB 15 +#define SC_SNAPTORASTER 16 +#define SC_RASTERVIS 17 +#define SC_RASTERRESX 18 +#define SC_RASTERRESY 19 +#define SC_RASTERSUBX 20 +#define SC_RASTERSUBY 21 +#define SC_RASTERSYNC 22 + + +// this are the defines for the position of the settings in the +// TableViewSettingsSequence + +#define SC_TABLE_VIEWSETTINGS_COUNT 16 + +#define SC_CURSOR_X 0 +#define SC_CURSOR_Y 1 +#define SC_HORIZONTAL_SPLIT_MODE 2 +#define SC_VERTICAL_SPLIT_MODE 3 +#define SC_HORIZONTAL_SPLIT_POSITION 4 +#define SC_VERTICAL_SPLIT_POSITION 5 +#define SC_ACTIVE_SPLIT_RANGE 6 +#define SC_POSITION_LEFT 7 +#define SC_POSITION_RIGHT 8 +#define SC_POSITION_TOP 9 +#define SC_POSITION_BOTTOM 10 +#define SC_TABLE_ZOOM_TYPE 11 +#define SC_TABLE_ZOOM_VALUE 12 +#define SC_TABLE_PAGE_VIEW_ZOOM_VALUE 13 +#define SC_TABLE_TAB_BG_COLOR 14 +#define SC_TABLE_SHOWGRID 15 + +#define SC_CURSORPOSITIONX "CursorPositionX" +#define SC_CURSORPOSITIONY "CursorPositionY" +#define SC_HORIZONTALSPLITMODE "HorizontalSplitMode" +#define SC_VERTICALSPLITMODE "VerticalSplitMode" +#define SC_HORIZONTALSPLITPOSITION "HorizontalSplitPosition" +#define SC_VERTICALSPLITPOSITION "VerticalSplitPosition" +#define SC_HORIZONTALSPLITPOSITION_TWIPS "HorizontalSplitPositionTwips" +#define SC_VERTICALSPLITPOSITION_TWIPS "VerticalSplitPositionTwips" +#define SC_ACTIVESPLITRANGE "ActiveSplitRange" +#define SC_POSITIONLEFT "PositionLeft" +#define SC_POSITIONRIGHT "PositionRight" +#define SC_POSITIONTOP "PositionTop" +#define SC_POSITIONBOTTOM "PositionBottom" +#define SC_TABLESELECTED "TableSelected" + +#define SC_TABLES "Tables" +#define SC_ACTIVETABLE "ActiveTable" +#define SC_HORIZONTALSCROLLBARWIDTH "HorizontalScrollbarWidth" +#define SC_RELHORIZONTALTABBARWIDTH "RelativeHorizontalTabbarWidth" +#define SC_ZOOMTYPE "ZoomType" +#define SC_ZOOMVALUE "ZoomValue" +#define SC_PAGEVIEWZOOMVALUE "PageViewZoomValue" +#define SC_SHOWPAGEBREAKPREVIEW "ShowPageBreakPreview" +#define SC_VIEWID "ViewId" +#define SC_VIEW "view" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/addincfg.hxx b/sc/inc/addincfg.hxx new file mode 100644 index 000000000000..9aa47147c621 --- /dev/null +++ b/sc/inc/addincfg.hxx @@ -0,0 +1,54 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ADDINCFG_HXX +#define SC_ADDINCFG_HXX + +#include <unotools/configitem.hxx> + +class ScAddInCfg : public utl::ConfigItem +{ + com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); + +public: + ScAddInCfg(); + + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames ); + virtual void Commit(); + + com::sun::star::uno::Sequence< com::sun::star::uno::Any> + GetProperties(const com::sun::star::uno::Sequence< rtl::OUString >& rNames) + { return ConfigItem::GetProperties( rNames ); } + + using ConfigItem::GetNodeNames; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx new file mode 100644 index 000000000000..662b45dd4e14 --- /dev/null +++ b/sc/inc/addincol.hxx @@ -0,0 +1,247 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ADDINCOL_HXX +#define SC_ADDINCOL_HXX + +#include "global.hxx" +#include <com/sun/star/sheet/XVolatileResult.hpp> +#include <com/sun/star/sheet/XAddIn.hpp> +#include <com/sun/star/sheet/XResultListener.hpp> +#include <com/sun/star/sheet/ResultEvent.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/reflection/XIdlMethod.hpp> +#include <com/sun/star/sheet/LocalizedName.hpp> +#include <tools/string.hxx> +#include <i18npool/lang.h> +#include <rtl/ustring.h> +#include "scdllapi.h" +#include <rtl/ustring.hxx> + +#include "scmatrix.hxx" + +#include <boost/unordered_map.hpp> + + +class String; +class SfxObjectShell; +class ScUnoAddInFuncData; +class ScMatrix; +class ScFuncDesc; + + +typedef ::boost::unordered_map< String, const ScUnoAddInFuncData*, ScStringHashCode, ::std::equal_to< String > > ScAddInHashMap; + + +enum ScAddInArgumentType +{ + SC_ADDINARG_NONE, // - + SC_ADDINARG_INTEGER, // long + SC_ADDINARG_DOUBLE, // double + SC_ADDINARG_STRING, // string + SC_ADDINARG_INTEGER_ARRAY, // sequence<sequence<long>> + SC_ADDINARG_DOUBLE_ARRAY, // sequence<sequence<double>> + SC_ADDINARG_STRING_ARRAY, // sequence<sequence<string>> + SC_ADDINARG_MIXED_ARRAY, // sequence<sequence<any>> + SC_ADDINARG_VALUE_OR_ARRAY, // any + SC_ADDINARG_CELLRANGE, // XCellRange + SC_ADDINARG_CALLER, // XPropertySet + SC_ADDINARG_VARARGS // sequence<any> +}; + +//------------------------------------------------------------------------ + +struct ScAddInArgDesc +{ + String aInternalName; // used to match configuration and reflection information + String aName; + String aDescription; + ScAddInArgumentType eType; + sal_Bool bOptional; +}; + +class ScUnoAddInFuncData +{ +private: + String aOriginalName; // kept in formula + String aLocalName; // for display + String aUpperName; // for entering formulas + String aUpperLocal; // for entering formulas + String aDescription; + com::sun::star::uno::Reference< com::sun::star::reflection::XIdlMethod> xFunction; + com::sun::star::uno::Any aObject; + long nArgCount; + ScAddInArgDesc* pArgDescs; + long nCallerPos; + sal_uInt16 nCategory; + rtl::OString sHelpId; + mutable com::sun::star::uno::Sequence< com::sun::star::sheet::LocalizedName> aCompNames; + mutable sal_Bool bCompInitialized; + +public: + ScUnoAddInFuncData( const String& rNam, const String& rLoc, + const String& rDesc, + sal_uInt16 nCat, const rtl::OString&, + const com::sun::star::uno::Reference< + com::sun::star::reflection::XIdlMethod>& rFunc, + const com::sun::star::uno::Any& rO, + long nAC, const ScAddInArgDesc* pAD, + long nCP ); + ~ScUnoAddInFuncData(); + + const String& GetOriginalName() const { return aOriginalName; } + const String& GetLocalName() const { return aLocalName; } + const String& GetUpperName() const { return aUpperName; } + const String& GetUpperLocal() const { return aUpperLocal; } + const com::sun::star::uno::Reference< com::sun::star::reflection::XIdlMethod>& GetFunction() const + { return xFunction; } + const com::sun::star::uno::Any& GetObject() const { return aObject; } + long GetArgumentCount() const { return nArgCount; } + const ScAddInArgDesc* GetArguments() const { return pArgDescs; } + long GetCallerPos() const { return nCallerPos; } + const String& GetDescription() const { return aDescription; } + sal_uInt16 GetCategory() const { return nCategory; } + const rtl::OString GetHelpId() const { return sHelpId; } + + const com::sun::star::uno::Sequence< com::sun::star::sheet::LocalizedName>& GetCompNames() const; + sal_Bool GetExcelName( LanguageType eDestLang, String& rRetExcelName ) const; + + void SetFunction( const com::sun::star::uno::Reference< com::sun::star::reflection::XIdlMethod>& rNewFunc, + const com::sun::star::uno::Any& rNewObj ); + void SetArguments( long nNewCount, const ScAddInArgDesc* pNewDescs ); + void SetCallerPos( long nNewPos ); + void SetCompNames( const com::sun::star::uno::Sequence< com::sun::star::sheet::LocalizedName>& rNew ); +}; + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScUnoAddInCollection +{ +private: + long nFuncCount; + ScUnoAddInFuncData** ppFuncData; + ScAddInHashMap* pExactHashMap; // exact internal name + ScAddInHashMap* pNameHashMap; // internal name upper + ScAddInHashMap* pLocalHashMap; // localized name upper + sal_Bool bInitialized; + + void Initialize(); + void ReadConfiguration(); + void ReadFromAddIn( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface>& xInterface ); + void UpdateFromAddIn( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface>& xInterface, + const String& rServiceName ); + void LoadComponent( const ScUnoAddInFuncData& rFuncData ); + +public: + ScUnoAddInCollection(); + ~ScUnoAddInCollection(); + + /// User enetered name. rUpperName MUST already be upper case! + String FindFunction( const String& rUpperName, sal_Bool bLocalFirst ); + + // rName is the exact Name. + // Only if bComplete is set, the function reference and argument types + // are initialized (component may have to be loaded). + const ScUnoAddInFuncData* GetFuncData( const String& rName, bool bComplete = false ); + + /** For enumeration in ScCompiler::OpCodeMap::getAvailableMappings(). + @param nIndex + 0 <= nIndex < GetFuncCount() + */ + const ScUnoAddInFuncData* GetFuncData( long nIndex ); + + void Clear(); + + void LocalizeString( String& rName ); // modify rName - input: exact name + + long GetFuncCount(); + sal_Bool FillFunctionDesc( long nFunc, ScFuncDesc& rDesc ); + + static sal_Bool FillFunctionDescFromData( const ScUnoAddInFuncData& rFuncData, ScFuncDesc& rDesc ); + + sal_Bool GetExcelName( const String& rCalcName, LanguageType eDestLang, String& rRetExcelName ); + sal_Bool GetCalcName( const String& rExcelName, String& rRetCalcName ); + // both leave rRet... unchanged, if no matching name is found +}; + + +class ScUnoAddInCall +{ +private: + const ScUnoAddInFuncData* pFuncData; + com::sun::star::uno::Sequence<com::sun::star::uno::Any> aArgs; + com::sun::star::uno::Sequence<com::sun::star::uno::Any> aVarArg; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xCaller; + sal_Bool bValidCount; + // result: + sal_uInt16 nErrCode; + sal_Bool bHasString; + double fValue; + String aString; + ScMatrixRef xMatrix; + com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> xVarRes; + + void ExecuteCallWithArgs( + com::sun::star::uno::Sequence<com::sun::star::uno::Any>& rCallArgs); + +public: + // exact name + ScUnoAddInCall( ScUnoAddInCollection& rColl, const String& rName, + long nParamCount ); + ~ScUnoAddInCall(); + + sal_Bool NeedsCaller() const; + void SetCaller( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface>& rInterface ); + void SetCallerFromObjectShell( SfxObjectShell* pSh ); + + sal_Bool ValidParamCount(); + ScAddInArgumentType GetArgType( long nPos ); + void SetParam( long nPos, const com::sun::star::uno::Any& rValue ); + + void ExecuteCall(); + + void SetResult( const com::sun::star::uno::Any& rNewRes ); + + sal_uInt16 GetErrCode() const { return nErrCode; } + sal_Bool HasString() const { return bHasString; } + bool HasMatrix() const { return xMatrix.get(); } + sal_Bool HasVarRes() const { return ( xVarRes.is() ); } + double GetValue() const { return fValue; } + const String& GetString() const { return aString; } + ScMatrixRef GetMatrix() const { return xMatrix; } + com::sun::star::uno::Reference<com::sun::star::sheet::XVolatileResult> + GetVarRes() const { return xVarRes; } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx new file mode 100644 index 000000000000..74920c7575b7 --- /dev/null +++ b/sc/inc/address.hxx @@ -0,0 +1,828 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ADDRESS_HXX +#define SC_ADDRESS_HXX + +#include <tools/stream.hxx> +#include <tools/string.hxx> +#include <tools/solar.h> +#include <tools/debug.hxx> +#include <rtl/ustrbuf.hxx> +#include <osl/endian.h> + +#ifndef INCLUDED_LIMITS +#include <limits> +#define INCLUDED_LIMITS +#endif +#include "scdllapi.h" +#include <formula/grammar.hxx> + +#include <com/sun/star/uno/Sequence.hxx> + +namespace com { namespace sun { namespace star { + namespace sheet { + struct ExternalLinkInfo; + } +}}} + +class ScDocument; + +// The typedefs +typedef sal_Int32 SCROW; +typedef sal_Int16 SCCOL; +typedef sal_Int16 SCTAB; +typedef sal_Int32 SCCOLROW; // a type capable of holding either SCCOL or SCROW + +// temporarily signed typedefs +typedef sal_Int32 SCsROW; +typedef sal_Int16 SCsCOL; +typedef sal_Int16 SCsTAB; +typedef sal_Int32 SCsCOLROW; + +// size_t typedef to be able to find places where code was changed from USHORT +// to size_t and is used to read/write from/to streams. +typedef size_t SCSIZE; + +// Maximum possible value of data type, NOT maximum row value. +// MSC confuses numeric_limit max() with macro max() if vcl/wintypes.hxx is +// included, we should not be using those stupid macros anyway. +#undef min +#undef max +const SCROW SCROW_MAX = ::std::numeric_limits<SCROW>::max(); +const SCCOL SCCOL_MAX = ::std::numeric_limits<SCCOL>::max(); +const SCTAB SCTAB_MAX = ::std::numeric_limits<SCTAB>::max(); +const SCCOLROW SCCOLROW_MAX = ::std::numeric_limits<SCCOLROW>::max(); +const SCSIZE SCSIZE_MAX = ::std::numeric_limits<SCSIZE>::max(); + +// A define to handle critical sections we hopefully don't need very often. +#define SC_ROWLIMIT_MORE_THAN_32K 1 /* set to 1 if we throw the switch */ + +// The maximum values. Defines are needed for preprocessor checks, for example +// in bcaslot.cxx, otherwise type safe constants are preferred. +#define MAXROWCOUNT_DEFINE 1048576 +#define MAXCOLCOUNT_DEFINE 1024 + +// Count values +const SCROW MAXROWCOUNT = MAXROWCOUNT_DEFINE; +const SCCOL MAXCOLCOUNT = MAXCOLCOUNT_DEFINE; +const SCTAB MAXTABCOUNT = 1024; +const SCCOLROW MAXCOLROWCOUNT = MAXROWCOUNT; +// Maximum values +const SCROW MAXROW = MAXROWCOUNT - 1; +const SCCOL MAXCOL = MAXCOLCOUNT - 1; +const SCTAB MAXTAB = MAXTABCOUNT - 1; +const SCCOLROW MAXCOLROW = MAXROW; + + +// Special values +const SCTAB SC_TAB_APPEND = SCTAB_MAX; +const SCTAB TABLEID_DOC = SCTAB_MAX; // entire document, e.g. protect +const SCROW SCROWS32K = 32000; +const SCCOL SCCOL_REPEAT_NONE = SCCOL_MAX; +const SCROW SCROW_REPEAT_NONE = SCROW_MAX; + + +// We hope to get rid of the binary file format. If not, these are the places +// we'd have to investigate because variable types changed. Just place code in +// #if SC_ROWLIMIT_STREAM_ACCESS for now. +#define SC_ROWLIMIT_STREAM_ACCESS 0 +// usage: +//#if SC_ROWLIMIT_STREAM_ACCESS +//#error address types changed! +//... code ... +//#endif // SC_ROWLIMIT_STREAM_ACCESS + + +// For future reference, place in code where more than 64k rows would need a +// special handling: +// #if SC_ROWLIMIT_MORE_THAN_64K +// #error row limit 64k +// #endif +#if MAXROWCOUNT_DEFINE > 65536 +#define SC_ROWLIMIT_MORE_THAN_64K 1 +#else +#define SC_ROWLIMIT_MORE_THAN_64K 0 +#endif +const SCROW SCROWS64K = 65536; + +// === old stuff defines ===================================================== + +#define MAXROW_30 8191 +#define MAXROW_40 31999 + +#ifdef SC_LIMIT_ROWS +#undef MAXROWCOUNT_DEFINE +#define MAXROWCOUNT_DEFINE 8192 +const SCROW W16MAXROWCOUNT = MAXROWCOUNT_DEFINE; +const SCROW W16MAXROW = W16MAXROWCOUNT - 1; +#define MAXROWCOUNT W16MAXROWCOUNT +#define MAXROW W16MAXROW +#endif + +#define VALIDCOL(nCol) (ValidCol(nCol)) +#define VALIDROW(nRow) (ValidRow(nRow)) +#define VALIDTAB(nTab) (ValidTab(nTab)) +#define VALIDCOLROW(nCol,nRow) (ValidColRow(nCol,nRow)) +#define VALIDCOLROWTAB(nCol,nRow,nTab) (ValidColRowTab(nCol,nRow,nTab)) + +// === old stuff defines end ================================================= + +inline bool ValidCol( SCCOL nCol ) +{ + return static_cast<SCCOL>(0) <= nCol && nCol <= MAXCOL; +} + +inline bool ValidRow( SCROW nRow ) +{ + return static_cast<SCROW>(0) <= nRow && nRow <= MAXROW; +} + +inline bool ValidTab( SCTAB nTab ) +{ + return static_cast<SCTAB>(0) <= nTab && nTab <= MAXTAB; +} + +inline bool ValidTab( SCTAB nTab, SCTAB nMaxTab ) +{ + return static_cast<SCTAB>(0) <= nTab && nTab <= nMaxTab; +} + +inline bool ValidColRow( SCCOL nCol, SCROW nRow ) +{ + return ValidCol( nCol) && ValidRow( nRow); +} + +inline bool ValidColRowTab( SCCOL nCol, SCROW nRow, SCTAB nTab ) +{ + return ValidCol( nCol) && ValidRow( nRow) && ValidTab( nTab); +} + +inline SCCOL SanitizeCol( SCCOL nCol ) +{ + return nCol < 0 ? 0 : (nCol > MAXCOL ? MAXCOL : nCol); +} + +inline SCROW SanitizeRow( SCROW nRow ) +{ + return nRow < 0 ? 0 : (nRow > MAXROW ? MAXROW : nRow); +} + +inline SCTAB SanitizeTab( SCTAB nTab ) +{ + return nTab < 0 ? 0 : (nTab > MAXTAB ? MAXTAB : nTab); +} + +inline SCTAB SanitizeTab( SCTAB nTab, SCTAB nMaxTab ) +{ + return nTab < 0 ? 0 : (nTab > nMaxTab ? nMaxTab : nTab); +} + +// === ScAddress ============================================================= + +// The old cell address is combined in one UINT32: +// +---+---+-------+ +// |Tab|Col| Row | +// +---+---+-------+ +// For speed reasons access isn't done by shifting bits but by using platform +// dependent casts, which unfortunately also leads to aliasing problems when +// not using gcc -fno-strict-aliasing + +// The result of ConvertRef() is a bit group of the following: + +#define SCA_COL_ABSOLUTE 0x01 +#define SCA_ROW_ABSOLUTE 0x02 +#define SCA_TAB_ABSOLUTE 0x04 +#define SCA_TAB_3D 0x08 +#define SCA_COL2_ABSOLUTE 0x10 +#define SCA_ROW2_ABSOLUTE 0x20 +#define SCA_TAB2_ABSOLUTE 0x40 +#define SCA_TAB2_3D 0x80 +#define SCA_VALID_ROW 0x0100 +#define SCA_VALID_COL 0x0200 +#define SCA_VALID_TAB 0x0400 +// SCA_BITS is a convience for +// (SCA_VALID_TAB | SCA_VALID_COL | SCA_VALID_ROW | SCA_TAB_3D | SCA_TAB_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_COL_ABSOLUTE) +#define SCA_BITS 0x070F +// somewhat cheesy kludge to force the display of the document name even for +// local references. Requires TAB_3D to be valid +#define SCA_FORCE_DOC 0x0800 +#define SCA_VALID_ROW2 0x1000 +#define SCA_VALID_COL2 0x2000 +#define SCA_VALID_TAB2 0x4000 +#define SCA_VALID 0x8000 + +#define SCA_ABS SCA_VALID \ + | SCA_COL_ABSOLUTE | SCA_ROW_ABSOLUTE | SCA_TAB_ABSOLUTE + +#define SCR_ABS SCA_ABS \ + | SCA_COL2_ABSOLUTE | SCA_ROW2_ABSOLUTE | SCA_TAB2_ABSOLUTE + +#define SCA_ABS_3D SCA_ABS | SCA_TAB_3D +#define SCR_ABS_3D SCR_ABS | SCA_TAB_3D + +// === ScAddress ============================================================= + +class ScAddress +{ +private: + SCROW nRow; + SCCOL nCol; + SCTAB nTab; + +public: + + enum Uninitialized { UNINITIALIZED }; + enum InitializeInvalid { INITIALIZE_INVALID }; + + struct Details { + formula::FormulaGrammar::AddressConvention eConv; + SCROW nRow; + SCCOL nCol; + inline Details( formula::FormulaGrammar::AddressConvention eConvP, SCROW nRowP, SCCOL nColP ) + : eConv( eConvP ), nRow( nRowP ), nCol( nColP ) + {} + inline Details( formula::FormulaGrammar::AddressConvention eConvP, ScAddress const & rAddr ) + : eConv( eConvP ), nRow( rAddr.Row() ), nCol( rAddr.Col() ) + {} + inline Details( formula::FormulaGrammar::AddressConvention eConvP) + : eConv( eConvP ), nRow( 0 ), nCol( 0 ) + {} + /* Use the formula::FormulaGrammar::AddressConvention associated with rAddr::Tab() */ + Details( const ScDocument* pDoc, const ScAddress & rAddr ); + }; + SC_DLLPUBLIC static const Details detailsOOOa1; + + struct ExternalInfo + { + String maTabName; + sal_uInt16 mnFileId; + bool mbExternal; + + inline ExternalInfo() : mnFileId(0), mbExternal(false) {} + }; + + inline ScAddress() : nRow(0), nCol(0), nTab(0) {} + inline ScAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP ) + : nRow(nRowP), nCol(nColP), nTab(nTabP) + {} + /** Yes, it is what it seems to be: Uninitialized. May be used for + performance reasons if it is initialized by other means. */ + inline ScAddress( Uninitialized ) {} + inline ScAddress( InitializeInvalid ) + : nRow(-1), nCol(-1), nTab(-1) {} + inline ScAddress( const ScAddress& r ) + : nRow(r.nRow), nCol(r.nCol), nTab(r.nTab) + {} + inline ScAddress& operator=( const ScAddress& r ); + + inline void Set( SCCOL nCol, SCROW nRow, SCTAB nTab ); + inline SCROW Row() const { return nRow; } + inline SCCOL Col() const { return nCol; } + inline SCTAB Tab() const { return nTab; } + inline void SetRow( SCROW nRowP ) { nRow = nRowP; } + inline void SetCol( SCCOL nColP ) { nCol = nColP; } + inline void SetTab( SCTAB nTabP ) { nTab = nTabP; } + inline void SetInvalid() { nRow = -1; nCol = -1; nTab = -1; } + inline bool IsValid() const { return (nRow >= 0) && (nCol >= 0) && (nTab >= 0); } + inline void PutInOrder( ScAddress& r ); + inline void IncRow( SCsROW n=1 ) { nRow = sal::static_int_cast<SCROW>(nRow + n); } + inline void IncCol( SCsCOL n=1 ) { nCol = sal::static_int_cast<SCCOL>(nCol + n); } + inline void IncTab( SCsTAB n=1 ) { nTab = sal::static_int_cast<SCTAB>(nTab + n); } + inline void GetVars( SCCOL& nColP, SCROW& nRowP, SCTAB& nTabP ) const + { nColP = nCol; nRowP = nRow; nTabP = nTab; } + + SC_DLLPUBLIC sal_uInt16 Parse( const String&, ScDocument* = NULL, + const Details& rDetails = detailsOOOa1, + ExternalInfo* pExtInfo = NULL, + const ::com::sun::star::uno::Sequence< + const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + + SC_DLLPUBLIC void Format( rtl::OUString&, sal_uInt16 = 0, ScDocument* = NULL, + const Details& rDetails = detailsOOOa1) const; + SC_DLLPUBLIC void Format( String&, sal_uInt16 = 0, ScDocument* = NULL, + const Details& rDetails = detailsOOOa1) const; + + // The document for the maximum defined sheet number + SC_DLLPUBLIC bool Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* =NULL ); + inline bool operator==( const ScAddress& r ) const; + inline bool operator!=( const ScAddress& r ) const; + inline bool operator<( const ScAddress& r ) const; + inline bool operator<=( const ScAddress& r ) const; + inline bool operator>( const ScAddress& r ) const; + inline bool operator>=( const ScAddress& r ) const; + + inline size_t hash() const; + + /// "A1" or "$A$1" or R1C1 or R[1]C[1] + String GetColRowString( bool bAbsolute = false, + const Details& rDetails = detailsOOOa1) const; +}; + +inline void ScAddress::PutInOrder( ScAddress& r ) +{ + if ( r.Col() < Col() ) + { + SCCOL nTmp = r.Col(); + r.SetCol( Col() ); + SetCol( nTmp ); + } + if ( r.Row() < Row() ) + { + SCROW nTmp = r.Row(); + r.SetRow( Row() ); + SetRow( nTmp ); + } + if ( r.Tab() < Tab() ) + { + SCTAB nTmp = r.Tab(); + r.SetTab( Tab() ); + SetTab( nTmp ); + } +} + +inline void ScAddress::Set( SCCOL nColP, SCROW nRowP, SCTAB nTabP ) +{ + nCol = nColP; + nRow = nRowP; + nTab = nTabP; +} + +inline ScAddress& ScAddress::operator=( const ScAddress& r ) +{ + nCol = r.nCol; + nRow = r.nRow; + nTab = r.nTab; + return *this; +} + +inline bool ScAddress::operator==( const ScAddress& r ) const +{ + return nRow == r.nRow && nCol == r.nCol && nTab == r.nTab; +} + +inline bool ScAddress::operator!=( const ScAddress& r ) const +{ + return !operator==( r ); +} + +inline bool ScAddress::operator<( const ScAddress& r ) const +{ + // Same behavior as the old sal_uInt32 nAddress < r.nAddress with encoded + // tab|col|row bit fields. + if (nTab == r.nTab) + { + if (nCol == r.nCol) + return nRow < r.nRow; + else + return nCol < r.nCol; + } + else + return nTab < r.nTab; +} + +inline bool ScAddress::operator<=( const ScAddress& r ) const +{ + return operator<( r ) || operator==( r ); +} + +inline bool ScAddress::operator>( const ScAddress& r ) const +{ + return !operator<=( r ); +} + +inline bool ScAddress::operator>=( const ScAddress& r ) const +{ + return !operator<( r ); +} + + +inline size_t ScAddress::hash() const +{ + // Assume that there are not that many addresses with row > 2^16 AND column + // > 2^8 AND sheet > 2^8 so we won't have too many collisions. + if (nRow <= 0xffff) + return (static_cast<size_t>(nTab) << 24) ^ + (static_cast<size_t>(nCol) << 16) ^ static_cast<size_t>(nRow); + else + return (static_cast<size_t>(nTab) << 28) ^ + (static_cast<size_t>(nCol) << 24) ^ static_cast<size_t>(nRow); +} + +struct ScAddressHashFunctor +{ + size_t operator()( const ScAddress & rAdr ) const + { + return rAdr.hash(); + } +}; + +struct ScAddressEqualFunctor +{ + bool operator()( const ScAddress & rAdr1, const ScAddress & rAdr2 ) const + { + return rAdr1 == rAdr2; + } +}; + + +// === ScRange =============================================================== + +class ScRange +{ +public: + ScAddress aStart, aEnd; + inline ScRange() : aStart(), aEnd() {} + inline ScRange( ScAddress::Uninitialized e ) + : aStart( e ), aEnd( e ) {} + inline ScRange( ScAddress::InitializeInvalid e ) + : aStart( e ), aEnd( e ) {} + inline ScRange( const ScAddress& s, const ScAddress& e ) + : aStart( s ), aEnd( e ) { aStart.PutInOrder( aEnd ); } + inline ScRange( const ScRange& r ) : aStart( r.aStart ), aEnd( r.aEnd ) {} + inline ScRange( const ScAddress& r ) : aStart( r ), aEnd( r ) {} + inline ScRange( SCCOL nCol, SCROW nRow, SCTAB nTab ) + : aStart( nCol, nRow, nTab ), aEnd( aStart ) {} + inline ScRange( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2 ) + : aStart( nCol1, nRow1, nTab1 ), aEnd( nCol2, nRow2, nTab2 ) {} + + inline ScRange& operator=( const ScRange& r ) + { aStart = r.aStart; aEnd = r.aEnd; return *this; } + inline ScRange& operator=( const ScAddress& rPos ) + { aStart = aEnd = rPos; return *this; } + inline void SetInvalid() { aStart.SetInvalid(); aEnd.SetInvalid(); } + inline bool IsValid() const { return aStart.IsValid() && aEnd.IsValid(); } + inline bool In( const ScAddress& ) const; // is Address& in Range? + inline bool In( const ScRange& ) const; // is Range& in Range? + + sal_uInt16 Parse( const String&, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, + ScAddress::ExternalInfo* pExtInfo = NULL, + const ::com::sun::star::uno::Sequence< + const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + + SC_DLLPUBLIC sal_uInt16 ParseAny( const String&, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); + SC_DLLPUBLIC sal_uInt16 ParseCols( const String&, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); + SC_DLLPUBLIC sal_uInt16 ParseRows( const String&, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); + + /** Parse an Excel style reference up to and including the sheet name + separator '!', including detection of external documents and sheet + names, and in case of MOOXML import the bracketed index is used to + determine the actual document name passed in pExternalLinks. For + internal references (resulting rExternDocName empty), aStart.nTab and + aEnd.nTab are set, or -1 if sheet name not found. + @param bOnlyAcceptSingle If <TRUE/>, a 3D reference (Sheet1:Sheet2) + encountered results in an error (NULL returned). + @param pExternalLinks pointer to ExternalLinkInfo sequence, may be + NULL for non-filter usage, in which case indices such as [1] are + not resolved. + @returns + Pointer to the position after '!' if successfully parsed, and + rExternDocName, rStartTabName and/or rEndTabName filled if + applicable. SCA_... flags set in nFlags. + Or if no valid document and/or sheet header could be parsed the start + position passed with pString. + Or NULL if a 3D sheet header could be parsed but + bOnlyAcceptSingle==true was given. + */ + const sal_Unicode* Parse_XL_Header( const sal_Unicode* pString, const ScDocument* pDoc, + String& rExternDocName, String& rStartTabName, String& rEndTabName, sal_uInt16& nFlags, + bool bOnlyAcceptSingle, + const ::com::sun::star::uno::Sequence< + const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + + SC_DLLPUBLIC void Format( String&, sal_uInt16 = 0, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ) const; + + SC_DLLPUBLIC void Format( rtl::OUString&, sal_uInt16 = 0, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ) const; + + inline void GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1, + SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const; + // The document for the maximum defined sheet number + SC_DLLPUBLIC bool Move( SCsCOL dx, SCsROW dy, SCsTAB dz, ScDocument* =NULL ); + SC_DLLPUBLIC void Justify(); + SC_DLLPUBLIC void ExtendTo( const ScRange& rRange ); + SC_DLLPUBLIC bool Intersects( const ScRange& ) const; // do two ranges intersect? + inline bool operator==( const ScRange& r ) const; + inline bool operator!=( const ScRange& r ) const; + inline bool operator<( const ScRange& r ) const; + inline bool operator<=( const ScRange& r ) const; + inline bool operator>( const ScRange& r ) const; + inline bool operator>=( const ScRange& r ) const; + + /// Hash 2D area ignoring table number. + inline size_t hashArea() const; + /// Hash start column and start and end rows. + inline size_t hashStartColumn() const; +}; + +inline void ScRange::GetVars( SCCOL& nCol1, SCROW& nRow1, SCTAB& nTab1, + SCCOL& nCol2, SCROW& nRow2, SCTAB& nTab2 ) const +{ + aStart.GetVars( nCol1, nRow1, nTab1 ); + aEnd.GetVars( nCol2, nRow2, nTab2 ); +} + +inline bool ScRange::operator==( const ScRange& r ) const +{ + return ( (aStart == r.aStart) && (aEnd == r.aEnd) ); +} + +inline bool ScRange::operator!=( const ScRange& r ) const +{ + return !operator==( r ); +} + +// Sort on upper left corner, if equal then use lower right too. +inline bool ScRange::operator<( const ScRange& r ) const +{ + return aStart < r.aStart || (aStart == r.aStart && aEnd < r.aEnd) ; +} + +inline bool ScRange::operator<=( const ScRange& r ) const +{ + return operator<( r ) || operator==( r ); +} + +inline bool ScRange::operator>( const ScRange& r ) const +{ + return !operator<=( r ); +} + +inline bool ScRange::operator>=( const ScRange& r ) const +{ + return !operator<( r ); +} + +inline bool ScRange::In( const ScAddress& rAddr ) const +{ + return + aStart.Col() <= rAddr.Col() && rAddr.Col() <= aEnd.Col() && + aStart.Row() <= rAddr.Row() && rAddr.Row() <= aEnd.Row() && + aStart.Tab() <= rAddr.Tab() && rAddr.Tab() <= aEnd.Tab(); +} + +inline bool ScRange::In( const ScRange& r ) const +{ + return + aStart.Col() <= r.aStart.Col() && r.aEnd.Col() <= aEnd.Col() && + aStart.Row() <= r.aStart.Row() && r.aEnd.Row() <= aEnd.Row() && + aStart.Tab() <= r.aStart.Tab() && r.aEnd.Tab() <= aEnd.Tab(); +} + + +inline size_t ScRange::hashArea() const +{ + // Assume that there are not that many ranges with identical corners so we + // won't have too many collisions. Also assume that more lower row and + // column numbers are used so that there are not too many conflicts with + // the columns hashed into the values, and that start row and column + // usually don't exceed certain values. High bits are not masked off and + // may overlap with lower bits of other values, e.g. if start column is + // greater than assumed. + return + (static_cast<size_t>(aStart.Row()) << 26) ^ // start row <= 2^6 + (static_cast<size_t>(aStart.Col()) << 21) ^ // start column <= 2^5 + (static_cast<size_t>(aEnd.Col()) << 15) ^ // end column <= 2^6 + static_cast<size_t>(aEnd.Row()); // end row <= 2^15 +} + + +inline size_t ScRange::hashStartColumn() const +{ + // Assume that for the start row more lower row numbers are used so that + // there are not too many conflicts with the column hashed into the higher + // values. + return + (static_cast<size_t>(aStart.Col()) << 24) ^ // start column <= 2^8 + (static_cast<size_t>(aStart.Row()) << 16) ^ // start row <= 2^8 + static_cast<size_t>(aEnd.Row()); +} + + +struct ScRangeHashAreaFunctor +{ + size_t operator()( const ScRange & rRange ) const + { + return rRange.hashArea(); + } +}; + +struct ScRangeEqualFunctor +{ + bool operator()( const ScRange & rRange1, const ScRange & rRange2 ) const + { + return rRange1 == rRange2; + } +}; + + +// === ScRangePair =========================================================== + +class ScRangePair +{ +private: + ScRange aRange[2]; + +public: + ScRangePair() {} + ScRangePair( const ScRangePair& r ) + { aRange[0] = r.aRange[0]; aRange[1] = r.aRange[1]; } + ScRangePair( const ScRange& r1, const ScRange& r2 ) + { aRange[0] = r1; aRange[1] = r2; } + + inline ScRangePair& operator= ( const ScRangePair& r ); + const ScRange& GetRange( sal_uInt16 n ) const { return aRange[n]; } + ScRange& GetRange( sal_uInt16 n ) { return aRange[n]; } + inline int operator==( const ScRangePair& ) const; + inline int operator!=( const ScRangePair& ) const; +}; + +inline ScRangePair& ScRangePair::operator= ( const ScRangePair& r ) +{ + aRange[0] = r.aRange[0]; + aRange[1] = r.aRange[1]; + return *this; +} + +inline int ScRangePair::operator==( const ScRangePair& r ) const +{ + return ( (aRange[0] == r.aRange[0]) && (aRange[1] == r.aRange[1]) ); +} + +inline int ScRangePair::operator!=( const ScRangePair& r ) const +{ + return !operator==( r ); +} + +// === ScRefAddress ========================================================== + +class ScRefAddress +{ + ScAddress aAdr; + bool bRelCol; + bool bRelRow; + bool bRelTab; +public: + inline ScRefAddress() : bRelCol(false), bRelRow(false), bRelTab(false) + {} + inline ScRefAddress( SCCOL nCol, SCROW nRow, SCTAB nTab, + bool bRelColP, bool bRelRowP, bool bRelTabP ) : + aAdr(nCol, nRow, nTab), + bRelCol(bRelColP), bRelRow(bRelRowP), bRelTab(bRelTabP) + {} + inline ScRefAddress( const ScAddress& rAdr, + bool bRelColP, bool bRelRowP, bool bRelTabP ) : + aAdr(rAdr), + bRelCol(bRelColP), bRelRow(bRelRowP), bRelTab(bRelTabP) + {} + inline ScRefAddress( const ScRefAddress& rRef ) : + aAdr(rRef.aAdr), bRelCol(rRef.bRelCol), bRelRow(rRef.bRelRow), + bRelTab(rRef.bRelTab) + {} + + inline ScRefAddress& operator=( const ScRefAddress& ); + + inline bool IsRelCol() const { return bRelCol; } + inline bool IsRelRow() const { return bRelRow; } + inline bool IsRelTab() const { return bRelTab; } + + inline void SetRelCol(bool bNewRelCol) { bRelCol = bNewRelCol; } + inline void SetRelRow(bool bNewRelRow) { bRelRow = bNewRelRow; } + inline void SetRelTab(bool bNewRelTab) { bRelTab = bNewRelTab; } + + inline void Set( const ScAddress& rAdr, + bool bNewRelCol, bool bNewRelRow, bool bNewRelTab ); + inline void Set( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, + bool bNewRelCol, bool bNewRelRow, bool bNewRelTab ); + + inline const ScAddress& GetAddress() const { return aAdr; } + inline SCCOL Col() const { return aAdr.Col(); } + inline SCROW Row() const { return aAdr.Row(); } + inline SCTAB Tab() const { return aAdr.Tab(); } + + inline int operator == ( const ScRefAddress& r ) const; + inline int operator != ( const ScRefAddress& r ) const + { return !(operator==(r)); } + + String GetRefString( ScDocument* pDoc, SCTAB nActTab, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1) const; +}; + +inline ScRefAddress& ScRefAddress::operator=( const ScRefAddress& rRef ) +{ + aAdr = rRef.aAdr; + bRelCol = rRef.bRelCol; + bRelRow = rRef.bRelRow; + bRelTab = rRef.bRelTab; + return *this; +} + +inline void ScRefAddress::Set( const ScAddress& rAdr, + bool bNewRelCol, bool bNewRelRow, bool bNewRelTab ) +{ + aAdr = rAdr; + bRelCol = bNewRelCol; + bRelRow = bNewRelRow; + bRelTab = bNewRelTab; +} + +inline void ScRefAddress::Set( SCCOL nNewCol, SCROW nNewRow, SCTAB nNewTab, + bool bNewRelCol, bool bNewRelRow, bool bNewRelTab ) +{ + aAdr.Set( nNewCol, nNewRow, nNewTab); + bRelCol = bNewRelCol; + bRelRow = bNewRelRow; + bRelTab = bNewRelTab; +} + +inline int ScRefAddress::operator==( const ScRefAddress& r ) const +{ + return aAdr == r.aAdr && bRelCol == r.bRelCol && bRelRow == r.bRelRow && + bRelTab == r.bRelTab; +} + +// =========================================================================== +// Global functions +// =========================================================================== + +// Special values for cells always broadcasting or listening (RECALCMODE_ALWAYS +// and the like). +#define BCA_BRDCST_ALWAYS ScAddress( 0, SCROW_MAX, 0 ) +#define BCA_LISTEN_ALWAYS ScRange( BCA_BRDCST_ALWAYS, BCA_BRDCST_ALWAYS ) + +template< typename T > void PutInOrder( T& nStart, T& nEnd ) +{ + if (nEnd < nStart) + { + T nTemp; + nTemp = nEnd; + nEnd = nStart; + nStart = nTemp; + } +} + +bool ConvertSingleRef( ScDocument* pDoc, const String& rRefString, + SCTAB nDefTab, ScRefAddress& rRefAddress, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, + ScAddress::ExternalInfo* pExtInfo = NULL ); + +bool ConvertDoubleRef(ScDocument* pDoc, const String& rRefString, + SCTAB nDefTab, ScRefAddress& rStartRefAddress, + ScRefAddress& rEndRefAddress, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1, + ScAddress::ExternalInfo* pExtInfo = NULL ); + +/// append alpha representation of column to buffer +SC_DLLPUBLIC void ScColToAlpha( rtl::OUStringBuffer& rBuffer, SCCOL nCol); + +inline void ScColToAlpha( String& rStr, SCCOL nCol) +{ + rtl::OUStringBuffer aBuf(2); + ScColToAlpha( aBuf, nCol); + rStr.Append( aBuf.getStr(), static_cast<xub_StrLen>(aBuf.getLength())); +} + +inline String ScColToAlpha( SCCOL nCol ) +{ + rtl::OUStringBuffer aBuf(2); + ScColToAlpha( aBuf, nCol); + return aBuf.makeStringAndClear(); +} + +/// get column number of A..IV... string +bool AlphaToCol( SCCOL& rCol, const String& rStr); + +#endif // SC_ADDRESS_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/addruno.hxx b/sc/inc/addruno.hxx new file mode 100644 index 000000000000..ee059463e807 --- /dev/null +++ b/sc/inc/addruno.hxx @@ -0,0 +1,112 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ADDRUNO_HXX +#define SC_ADDRUNO_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/implbase2.hxx> +#include <svl/lstner.hxx> +#include "global.hxx" +#include "address.hxx" + + +class ScAddressConversionObj : public ::cppu::WeakImplHelper2< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScRange aRange; + sal_Int32 nRefSheet; + sal_Bool bIsRange; + + sal_Bool ParseUIString( const String& rUIString, ::formula::FormulaGrammar::AddressConvention eConv = ::formula::FormulaGrammar::CONV_OOO ); + +public: + + ScAddressConversionObj(ScDocShell* pDocSh, sal_Bool bForRange); + virtual ~ScAddressConversionObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/afmtuno.hxx b/sc/inc/afmtuno.hxx new file mode 100644 index 000000000000..d78498f3a0fa --- /dev/null +++ b/sc/inc/afmtuno.hxx @@ -0,0 +1,312 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_AFMTUNO_HXX +#define SC_AFMTUNO_HXX + +#include <svl/lstner.hxx> +#include <svl/itemprop.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/container/XIndexContainer.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/container/XContainerListener.hpp> +#include <com/sun/star/container/XSet.hpp> +#include <com/sun/star/container/ContainerEvent.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase6.hxx> + +class ScAutoFormatFieldObj; +class ScAutoFormatObj; + + +#define SC_AFMTOBJ_INVALID USHRT_MAX + + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + ScAutoFormatsObj_CreateInstance( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& ); + + +class ScAutoFormatsObj : public ::cppu::WeakImplHelper4< + ::com::sun::star::container::XNameContainer, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::lang::XServiceInfo > +{ +private: + ScAutoFormatObj* GetObjectByIndex_Impl(sal_uInt16 nIndex); + ScAutoFormatObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +public: + ScAutoFormatsObj(); + virtual ~ScAutoFormatsObj(); + + static ::rtl::OUString getImplementationName_Static(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString> getSupportedServiceNames_Static(); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScAutoFormatObj : public ::cppu::WeakImplHelper6< + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XNamed, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + SfxItemPropertySet aPropSet; + sal_uInt16 nFormatIndex; + + ScAutoFormatFieldObj* GetObjectByIndex_Impl(sal_uInt16 nIndex); + +public: + ScAutoFormatObj(sal_uInt16 nIndex); + virtual ~ScAutoFormatObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // per getImplementation gerufen: + sal_Bool IsInserted() const { return nFormatIndex != SC_AFMTOBJ_INVALID; } + void InitFormat( sal_uInt16 nNewIndex ); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScAutoFormatObj* getImplementation( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface> xObj ); +}; + + +class ScAutoFormatFieldObj : public ::cppu::WeakImplHelper2< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + SfxItemPropertySet aPropSet; + sal_uInt16 nFormatIndex; + sal_uInt16 nFieldIndex; + +public: + ScAutoFormatFieldObj(sal_uInt16 nFormat, sal_uInt16 nField); + virtual ~ScAutoFormatFieldObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/appluno.hxx b/sc/inc/appluno.hxx new file mode 100644 index 000000000000..9ffff7247021 --- /dev/null +++ b/sc/inc/appluno.hxx @@ -0,0 +1,214 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_APPLUNO_HXX +#define SC_APPLUNO_HXX + +#include <svl/itemprop.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XRecentFunctions.hpp> +#include <com/sun/star/sheet/XFunctionDescriptions.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase4.hxx> +#include <rtl/ustring.hxx> + +class ScFunctionDescriptionObj; + + + +com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL + ScSpreadsheetSettings_CreateInstance( + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory>& rSMgr ); +com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL + ScRecentFunctionsObj_CreateInstance( + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory>& rSMgr ); +com::sun::star::uno::Reference<com::sun::star::uno::XInterface> SAL_CALL + ScFunctionListObj_CreateInstance( + const com::sun::star::uno::Reference< + com::sun::star::lang::XMultiServiceFactory>& rSMgr ); + + +class ScSpreadsheetSettings : public cppu::WeakImplHelper2< + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo> +{ +private: + SfxItemPropertySet aPropSet; + +public: + ScSpreadsheetSettings(); + virtual ~ScSpreadsheetSettings(); + + static ::rtl::OUString getImplementationName_Static(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScRecentFunctionsObj : public cppu::WeakImplHelper2< + com::sun::star::sheet::XRecentFunctions, + com::sun::star::lang::XServiceInfo> +{ +public: + ScRecentFunctionsObj(); + virtual ~ScRecentFunctionsObj(); + + static ::rtl::OUString getImplementationName_Static(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(); + + // XRecentFunctions + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getRecentFunctionIds() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRecentFunctionIds( const ::com::sun::star::uno::Sequence< + sal_Int32 >& aRecentFunctionIds ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getMaxRecentFunctions() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScFunctionListObj : public cppu::WeakImplHelper4< + com::sun::star::sheet::XFunctionDescriptions, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XNameAccess, + com::sun::star::lang::XServiceInfo> +{ +public: + ScFunctionListObj(); + virtual ~ScFunctionListObj(); + + static ::rtl::OUString getImplementationName_Static(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(); + + // XFunctionDescriptions + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getById( sal_Int32 nId ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx new file mode 100644 index 000000000000..53cf1b968b1a --- /dev/null +++ b/sc/inc/appoptio.hxx @@ -0,0 +1,156 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_APPOPTIO_HXX +#define SC_APPOPTIO_HXX + +#include <vcl/field.hxx> +#include <svx/zoomitem.hxx> +#include <unotools/configitem.hxx> +#include "scdllapi.h" +#include "global.hxx" +#include "optutil.hxx" + +class SC_DLLPUBLIC ScAppOptions +{ +public: + ScAppOptions(); + ScAppOptions( const ScAppOptions& rCpy ); + ~ScAppOptions(); + + void SetDefaults(); + + // Set or get the initial tab count for new spreadsheet, it is used by VBA API currently. + void SetTabCountInNewSpreadsheet( sal_Int16 nCount ) { nTabCountInNewSpreadsheet = nCount; } + sal_Int16 GetTabCountInNewSpreadsheet() const { return nTabCountInNewSpreadsheet; } + + void SetAppMetric( FieldUnit eUnit ) { eMetric = eUnit; } + FieldUnit GetAppMetric() const { return eMetric; } + void SetZoom( sal_uInt16 nNew ) { nZoom = nNew; } + sal_uInt16 GetZoom() const { return nZoom; } + void SetZoomType( SvxZoomType eNew ) { eZoomType = eNew; } + SvxZoomType GetZoomType() const { return eZoomType; } + void SetSynchronizeZoom( sal_Bool bNew ) { bSynchronizeZoom = bNew; } + sal_Bool GetSynchronizeZoom() const { return bSynchronizeZoom; } + sal_uInt16 GetLRUFuncListCount() const { return nLRUFuncCount; } + sal_uInt16* GetLRUFuncList() const { return pLRUList; } + void SetLRUFuncList( const sal_uInt16* pList, + const sal_uInt16 nCount ); + void SetStatusFunc( sal_uInt16 nNew ) { nStatusFunc = nNew; } + sal_uInt16 GetStatusFunc() const { return nStatusFunc; } + void SetAutoComplete( sal_Bool bNew ) { bAutoComplete = bNew; } + sal_Bool GetAutoComplete() const { return bAutoComplete; } + void SetDetectiveAuto( sal_Bool bNew ) { bDetectiveAuto = bNew; } + sal_Bool GetDetectiveAuto() const { return bDetectiveAuto; } + + void SetTrackContentColor(sal_uInt32 nNew) { nTrackContentColor = nNew; } + sal_uInt32 GetTrackContentColor() const { return nTrackContentColor; } + void SetTrackInsertColor(sal_uInt32 nNew) { nTrackInsertColor = nNew; } + sal_uInt32 GetTrackInsertColor() const { return nTrackInsertColor; } + void SetTrackDeleteColor(sal_uInt32 nNew) { nTrackDeleteColor = nNew; } + sal_uInt32 GetTrackDeleteColor() const { return nTrackDeleteColor; } + void SetTrackMoveColor(sal_uInt32 nNew) { nTrackMoveColor = nNew; } + sal_uInt32 GetTrackMoveColor() const { return nTrackMoveColor; } + + ScLkUpdMode GetLinkMode() const { return eLinkMode ;} + void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;} + + void SetDefaultObjectSizeWidth(sal_Int32 nNew) { nDefaultObjectSizeWidth = nNew; } + sal_Int32 GetDefaultObjectSizeWidth() const { return nDefaultObjectSizeWidth; } + void SetDefaultObjectSizeHeight(sal_Int32 nNew) { nDefaultObjectSizeHeight = nNew; } + sal_Int32 GetDefaultObjectSizeHeight() const { return nDefaultObjectSizeHeight; } + + void SetShowSharedDocumentWarning( sal_Bool bNew ) { mbShowSharedDocumentWarning = bNew; } + sal_Bool GetShowSharedDocumentWarning() const { return mbShowSharedDocumentWarning; } + + + const ScAppOptions& operator= ( const ScAppOptions& rOpt ); + +private: + sal_Int16 nTabCountInNewSpreadsheet; + FieldUnit eMetric; + sal_uInt16 nLRUFuncCount; + sal_uInt16* pLRUList; + SvxZoomType eZoomType; + sal_uInt16 nZoom; + sal_Bool bSynchronizeZoom; + sal_uInt16 nStatusFunc; + sal_Bool bAutoComplete; + sal_Bool bDetectiveAuto; + sal_uInt32 nTrackContentColor; + sal_uInt32 nTrackInsertColor; + sal_uInt32 nTrackDeleteColor; + sal_uInt32 nTrackMoveColor; + ScLkUpdMode eLinkMode; + sal_Int32 nDefaultObjectSizeWidth; + sal_Int32 nDefaultObjectSizeHeight; + sal_Bool mbShowSharedDocumentWarning; +}; + + +//================================================================== +// Config Item containing app options +//================================================================== + +class ScAppCfg : public ScAppOptions +{ + // spread about 5 config paths + //! split ScAppOptions into different classes + + ScLinkConfigItem aLayoutItem; + ScLinkConfigItem aInputItem; + ScLinkConfigItem aRevisionItem; + ScLinkConfigItem aContentItem; + ScLinkConfigItem aSortListItem; + ScLinkConfigItem aMiscItem; + + DECL_LINK( LayoutCommitHdl, void* ); + DECL_LINK( InputCommitHdl, void* ); + DECL_LINK( RevisionCommitHdl, void* ); + DECL_LINK( ContentCommitHdl, void* ); + DECL_LINK( SortListCommitHdl, void* ); + DECL_LINK( MiscCommitHdl, void* ); + + com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetInputPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetRevisionPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetContentPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetSortListPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetMiscPropertyNames(); + +public: + ScAppCfg(); + + void SetOptions( const ScAppOptions& rNew ); + void OptionsChanged(); // after direct access to ScAppOptions base class +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/arealink.hxx b/sc/inc/arealink.hxx new file mode 100644 index 000000000000..fb79891005c6 --- /dev/null +++ b/sc/inc/arealink.hxx @@ -0,0 +1,94 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_AREALINK_HXX +#define SC_AREALINK_HXX + +#include "global.hxx" +#include "refreshtimer.hxx" +#include "address.hxx" +#include <sfx2/lnkbase.hxx> +#include "scdllapi.h" + +class ScDocShell; +class SfxObjectShell; +class AbstractScLinkedAreaDlg; +struct AreaLink_Impl; + +class SC_DLLPUBLIC ScAreaLink : public ::sfx2::SvBaseLink, public ScRefreshTimer +{ +private: + AreaLink_Impl* pImpl; + String aFileName; + String aFilterName; + String aOptions; + String aSourceArea; + ScRange aDestArea; + sal_Bool bAddUndo; + sal_Bool bInCreate; + sal_Bool bDoInsert; // is set to FALSE for first update + sal_Bool FindExtRange( ScRange& rRange, ScDocument* pSrcDoc, const String& rAreaName ); + +public: + TYPEINFO(); + ScAreaLink( SfxObjectShell* pShell, const String& rFile, + const String& rFilter, const String& rOpt, + const String& rArea, const ScRange& rDest, sal_uLong nRefresh ); + virtual ~ScAreaLink(); + + virtual void Closed(); + virtual void DataChanged( const String& rMimeType, + const ::com::sun::star::uno::Any & rValue ); + + virtual void Edit( Window*, const Link& rEndEditHdl ); + + sal_Bool Refresh( const String& rNewFile, const String& rNewFilter, + const String& rNewArea, sal_uLong nNewRefresh ); + + void SetInCreate(sal_Bool bSet) { bInCreate = bSet; } + void SetDoInsert(sal_Bool bSet) { bDoInsert = bSet; } + void SetDestArea(const ScRange& rNew); + void SetSource(const String& rDoc, const String& rFlt, const String& rOpt, + const String& rArea); + + sal_Bool IsEqual( const String& rFile, const String& rFilter, const String& rOpt, + const String& rSource, const ScRange& rDest ) const; + + const String& GetFile() const { return aFileName; } + const String& GetFilter() const { return aFilterName; } + const String& GetOptions() const { return aOptions; } + const String& GetSource() const { return aSourceArea; } + const ScRange& GetDestArea() const { return aDestArea; } + + DECL_LINK( RefreshHdl, ScAreaLink* ); + DECL_LINK( AreaEndEditHdl, void* ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx new file mode 100644 index 000000000000..291e182ac69c --- /dev/null +++ b/sc/inc/attarray.hxx @@ -0,0 +1,247 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ATRARR_HXX +#define SC_ATRARR_HXX + +#include "global.hxx" +#include "attrib.hxx" + +class ScDocument; +class ScEditDataArray; +class ScMarkArray; +class ScPatternAttr; +class ScStyleSheet; +class ScFlatBoolRowSegments; + +class Rectangle; +class SfxItemPoolCache; +class SfxStyleSheetBase; +class SvxBoxItem; +class SvxBoxInfoItem; + +namespace editeng { class SvxBorderLine; } + +#define SC_LINE_EMPTY 0 +#define SC_LINE_SET 1 +#define SC_LINE_DONTCARE 2 + +#define SC_ATTRARRAY_DELTA 4 + +struct ScLineFlags +{ + sal_uInt8 nLeft; + sal_uInt8 nRight; + sal_uInt8 nTop; + sal_uInt8 nBottom; + sal_uInt8 nHori; + sal_uInt8 nVert; + + ScLineFlags() : nLeft(SC_LINE_EMPTY),nRight(SC_LINE_EMPTY),nTop(SC_LINE_EMPTY), + nBottom(SC_LINE_EMPTY),nHori(SC_LINE_EMPTY),nVert(SC_LINE_EMPTY) {} +}; + +struct ScMergePatternState +{ + SfxItemSet* pItemSet; // allocated in MergePatternArea, used for resulting ScPatternAttr + const ScPatternAttr* pOld1; // existing objects, temporary + const ScPatternAttr* pOld2; + + ScMergePatternState() : pItemSet(NULL), pOld1(NULL), pOld2(NULL) {} +}; + +struct ScAttrEntry +{ + SCROW nRow; + const ScPatternAttr* pPattern; +}; + + +class ScAttrArray +{ +private: + SCCOL nCol; + SCTAB nTab; + ScDocument* pDocument; + + SCSIZE nCount; + SCSIZE nLimit; + ScAttrEntry* pData; + +friend class ScDocument; // for FillInfo +friend class ScDocumentIterator; +friend class ScAttrIterator; +friend class ScHorizontalAttrIterator; +friend void lcl_IterGetNumberFormat( sal_uLong& nFormat, + const ScAttrArray*& rpArr, SCROW& nAttrEndRow, + const ScAttrArray* pNewArr, SCROW nRow, ScDocument* pDoc ); + + sal_Bool ApplyFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner, + SCROW nStartRow, SCROW nEndRow, + sal_Bool bLeft, SCCOL nDistRight, sal_Bool bTop, SCROW nDistBottom ); + + void RemoveCellCharAttribs( SCROW nStartRow, SCROW nEndRow, + const ScPatternAttr* pPattern, ScEditDataArray* pDataArray ); + +public: + ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc ); + ~ScAttrArray(); + + void SetTab(SCTAB nNewTab) { nTab = nNewTab; } + void SetCol(SCCOL nNewCol) { nCol = nNewCol; } +#if OSL_DEBUG_LEVEL > 1 + void TestData() const; +#endif + void Reset( const ScPatternAttr* pPattern, sal_Bool bAlloc = sal_True ); + sal_Bool Concat(SCSIZE nPos); + + const ScPatternAttr* GetPattern( SCROW nRow ) const; + const ScPatternAttr* GetPatternRange( SCROW& rStartRow, SCROW& rEndRow, SCROW nRow ) const; + void MergePatternArea( SCROW nStartRow, SCROW nEndRow, ScMergePatternState& rState, sal_Bool bDeep ) const; + + void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner, ScLineFlags& rFlags, + SCROW nStartRow, SCROW nEndRow, sal_Bool bLeft, SCCOL nDistRight ) const; + void ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner, + SCROW nStartRow, SCROW nEndRow, sal_Bool bLeft, SCCOL nDistRight ); + + void SetPattern( SCROW nRow, const ScPatternAttr* pPattern, sal_Bool bPutToPool = false ); + void SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, + sal_Bool bPutToPool = false, ScEditDataArray* pDataArray = NULL ); + void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle ); + void ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache, + ScEditDataArray* pDataArray = NULL ); + bool SetAttrEntries(ScAttrEntry* pNewData, SCSIZE nSize); + void ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow, + const ::editeng::SvxBorderLine* pLine, sal_Bool bColorOnly ); + + void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich ); + void ChangeIndent( SCROW nStartRow, SCROW nEndRow, sal_Bool bIncrement ); + + /// Including current, may return -1 + SCsROW GetNextUnprotected( SCsROW nRow, sal_Bool bUp ) const; + + /// May return -1 if not found + SCsROW SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, + sal_Bool bUp, ScMarkArray* pMarkArray = NULL ); + sal_Bool SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, + sal_Bool bUp, ScMarkArray* pMarkArray = NULL ); + + sal_Bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); + sal_Bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); + + sal_Bool Search( SCROW nRow, SCSIZE& nIndex ) const; + + sal_Bool HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, + sal_Bool bLeft, sal_Bool bRight ) const; + bool HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const; + sal_Bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, + SCCOL& rPaintCol, SCROW& rPaintRow, + sal_Bool bRefresh, sal_Bool bAttrs ); + sal_Bool RemoveAreaMerge( SCROW nStartRow, SCROW nEndRow ); + + void FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset ); + sal_Bool IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const; + + void DeleteAreaSafe(SCROW nStartRow, SCROW nEndRow); + void SetPatternAreaSafe( SCROW nStartRow, SCROW nEndRow, + const ScPatternAttr* pWantedPattern, sal_Bool bDefault ); + void CopyAreaSafe( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray ); + + sal_Bool IsEmpty() const; + + sal_Bool GetFirstVisibleAttr( SCROW& rFirstRow ) const; + sal_Bool GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData ) const; + sal_Bool HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const; + sal_Bool IsVisibleEqual( const ScAttrArray& rOther, + SCROW nStartRow, SCROW nEndRow ) const; + sal_Bool IsAllEqual( const ScAttrArray& rOther, SCROW nStartRow, SCROW nEndRow ) const; + + sal_Bool TestInsertCol( SCROW nStartRow, SCROW nEndRow) const; + sal_Bool TestInsertRow( SCSIZE nSize ) const; + void InsertRow( SCROW nStartRow, SCSIZE nSize ); + void DeleteRow( SCROW nStartRow, SCSIZE nSize ); + void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex ); + void DeleteArea( SCROW nStartRow, SCROW nEndRow ); + void MoveTo( SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray ); + void CopyArea( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, + sal_Int16 nStripFlags = 0 ); + + void DeleteHardAttr( SCROW nStartRow, SCROW nEndRow ); +}; + + +// ------------------------------------------------------------------------------ +// Iterator for attributes +// ------------------------------------------------------------------------------ + +class ScAttrIterator +{ + const ScAttrArray* pArray; + SCSIZE nPos; + SCROW nRow; + SCROW nEndRow; +public: + inline ScAttrIterator( const ScAttrArray* pNewArray, SCROW nStart, SCROW nEnd ); + inline const ScPatternAttr* Next( SCROW& rTop, SCROW& rBottom ); + SCROW GetNextRow() const { return nRow; } +}; + + +inline ScAttrIterator::ScAttrIterator( const ScAttrArray* pNewArray, SCROW nStart, SCROW nEnd ) : + pArray( pNewArray ), + nRow( nStart ), + nEndRow( nEnd ) +{ + if ( nStart > 0 ) + pArray->Search( nStart, nPos ); + else + nPos = 0; +} + +inline const ScPatternAttr* ScAttrIterator::Next( SCROW& rTop, SCROW& rBottom ) +{ + const ScPatternAttr* pRet; + if ( nPos < pArray->nCount && nRow <= nEndRow ) + { + rTop = nRow; + rBottom = Min( pArray->pData[nPos].nRow, nEndRow ); + pRet = pArray->pData[nPos].pPattern; + nRow = rBottom + 1; + ++nPos; + } + else + pRet = NULL; + return pRet; +} + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx new file mode 100644 index 000000000000..398a3178b509 --- /dev/null +++ b/sc/inc/attrib.hxx @@ -0,0 +1,400 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCATTR_HXX +#define SC_SCATTR_HXX + +#include <svl/poolitem.hxx> +#include <svl/intitem.hxx> +#include <svl/eitem.hxx> +#include "scdllapi.h" +#include "global.hxx" +#include "address.hxx" + +//------------------------------------------------------------------------ + + // flags for cells hidden by merge + // and control for auto filter +#define SC_MF_HOR 0x0001 +#define SC_MF_VER 0x0002 +#define SC_MF_AUTO 0x0004 /// autofilter arrow +#define SC_MF_BUTTON 0x0008 /// field button for datapilot +#define SC_MF_SCENARIO 0x0010 +#define SC_MF_BUTTON_POPUP 0x0020 /// dp button with popup arrow +#define SC_MF_HIDDEN_MEMBER 0x0040 /// dp field button with presence of hidden member +#define SC_MF_DP_TABLE 0x0080 /// dp table output + +#define SC_MF_ALL 0x00FF + + +class EditTextObject; +namespace editeng { class SvxBorderLine; } + +sal_Bool SC_DLLPUBLIC ScHasPriority( const ::editeng::SvxBorderLine* pThis, const ::editeng::SvxBorderLine* pOther ); + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScMergeAttr: public SfxPoolItem +{ + SCsCOL nColMerge; + SCsROW nRowMerge; +public: + TYPEINFO(); + ScMergeAttr(); + ScMergeAttr( SCsCOL nCol, SCsROW nRow = 0); + ScMergeAttr( const ScMergeAttr& ); + ~ScMergeAttr(); + + virtual String GetValueText() const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + SCsCOL GetColMerge() const {return nColMerge; } + SCsROW GetRowMerge() const {return nRowMerge; } + + sal_Bool IsMerged() const { return nColMerge>1 || nRowMerge>1; } + + inline ScMergeAttr& operator=(const ScMergeAttr& rMerge) + { + nColMerge = rMerge.nColMerge; + nRowMerge = rMerge.nRowMerge; + return *this; + } +}; + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScMergeFlagAttr: public SfxInt16Item +{ +public: + ScMergeFlagAttr(); + ScMergeFlagAttr(sal_Int16 nFlags); + ~ScMergeFlagAttr(); + + sal_Bool IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; } + sal_Bool IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; } + sal_Bool IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; } + + sal_Bool HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; } + sal_Bool HasButton() const { return ( GetValue() & SC_MF_BUTTON ) != 0; } + bool HasDPTable() const { return ( GetValue() & SC_MF_DP_TABLE ) != 0; } + + sal_Bool IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; } +}; + +//------------------------------------------------------------------------ +class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem +{ + sal_Bool bProtection; // protect cell + sal_Bool bHideFormula; // hide formula + sal_Bool bHideCell; // hide cell + sal_Bool bHidePrint; // don't print cell +public: + TYPEINFO(); + ScProtectionAttr(); + ScProtectionAttr( sal_Bool bProtect, + sal_Bool bHFormula = false, + sal_Bool bHCell = false, + sal_Bool bHPrint = false); + ScProtectionAttr( const ScProtectionAttr& ); + ~ScProtectionAttr(); + + virtual String GetValueText() const; + virtual SfxItemPresentation GetPresentation( + SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + String& rText, + const IntlWrapper* pIntl = 0 ) const; + + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + sal_Bool GetProtection() const { return bProtection; } + sal_Bool SetProtection( sal_Bool bProtect); + sal_Bool GetHideFormula() const { return bHideFormula; } + sal_Bool SetHideFormula( sal_Bool bHFormula); + sal_Bool GetHideCell() const { return bHideCell; } + sal_Bool SetHideCell( sal_Bool bHCell); + sal_Bool GetHidePrint() const { return bHidePrint; } + sal_Bool SetHidePrint( sal_Bool bHPrint); + inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection) + { + bProtection = rProtection.bProtection; + bHideFormula = rProtection.bHideFormula; + bHideCell = rProtection.bHideCell; + bHidePrint = rProtection.bHidePrint; + return *this; + } +}; + + +//---------------------------------------------------------------------------- +// ScRangeItem: manages an area of a table + +#define SCR_INVALID 0x01 +#define SCR_ALLTABS 0x02 +#define SCR_TONEWTAB 0x04 + +class ScRangeItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + inline ScRangeItem( const sal_uInt16 nWhich ); + inline ScRangeItem( const sal_uInt16 nWhich, + const ScRange& rRange, + const sal_uInt16 nNewFlags = 0 ); + inline ScRangeItem( const ScRangeItem& rCpy ); + + inline ScRangeItem& operator=( const ScRangeItem &rCpy ); + + // "pure virtual methods" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + String &rText, + const IntlWrapper* pIntl = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + const ScRange& GetRange() const { return aRange; } + void SetRange( const ScRange& rNew ) { aRange = rNew; } + + sal_uInt16 GetFlags() const { return nFlags; } + void SetFlags( sal_uInt16 nNew ) { nFlags = nNew; } + +private: + ScRange aRange; + sal_uInt16 nFlags; +}; + +inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP ) + : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == invalid area +{ +} + +inline ScRangeItem::ScRangeItem( const sal_uInt16 nWhichP, + const ScRange& rRange, + const sal_uInt16 nNew ) + : SfxPoolItem( nWhichP ), aRange( rRange ), nFlags( nNew ) +{ +} + +inline ScRangeItem::ScRangeItem( const ScRangeItem& rCpy ) + : SfxPoolItem( rCpy.Which() ), aRange( rCpy.aRange ), nFlags( rCpy.nFlags ) +{} + +inline ScRangeItem& ScRangeItem::operator=( const ScRangeItem &rCpy ) +{ + aRange = rCpy.aRange; + return *this; +} + +//---------------------------------------------------------------------------- +// ScTableListItem: manages a list of tables +//---------------------------------------------------------------------------- +class ScTableListItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + inline ScTableListItem( const sal_uInt16 nWhich ); + ScTableListItem( const ScTableListItem& rCpy ); + ~ScTableListItem(); + + ScTableListItem& operator=( const ScTableListItem &rCpy ); + + // "pure virtual Methoden" from SfxPoolItem + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + String &rText, + const IntlWrapper* pIntl = 0 ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + +public: + sal_uInt16 nCount; + SCTAB* pTabArr; +}; + +inline ScTableListItem::ScTableListItem( const sal_uInt16 nWhichP ) + : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL) +{} + +//---------------------------------------------------------------------------- +// page format item: contents of header and footer + +#define SC_HF_LEFTAREA 1 +#define SC_HF_CENTERAREA 2 +#define SC_HF_RIGHTAREA 3 + +class SC_DLLPUBLIC ScPageHFItem : public SfxPoolItem +{ + EditTextObject* pLeftArea; + EditTextObject* pCenterArea; + EditTextObject* pRightArea; + +public: + TYPEINFO(); + ScPageHFItem( sal_uInt16 nWhich ); + ScPageHFItem( const ScPageHFItem& rItem ); + ~ScPageHFItem(); + + virtual String GetValueText() const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ); + + const EditTextObject* GetLeftArea() const { return pLeftArea; } + const EditTextObject* GetCenterArea() const { return pCenterArea; } + const EditTextObject* GetRightArea() const { return pRightArea; } + + void SetLeftArea( const EditTextObject& rNew ); + void SetCenterArea( const EditTextObject& rNew ); + void SetRightArea( const EditTextObject& rNew ); + + // Set method with pointer assignment, nArea see defines above + void SetArea( EditTextObject *pNew, int nArea ); +}; + + +//---------------------------------------------------------------------------- +// page format item: contents of header and footer + +class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem +{ +public: + TYPEINFO(); + + ScViewObjectModeItem( sal_uInt16 nWhich ); + ScViewObjectModeItem( sal_uInt16 nWhich, ScVObjMode eMode ); + ~ScViewObjectModeItem(); + + virtual sal_uInt16 GetValueCount() const; + virtual String GetValueText( sal_uInt16 nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const; + virtual sal_uInt16 GetVersion( sal_uInt16 nFileVersion ) const; + virtual SfxItemPresentation GetPresentation( SfxItemPresentation ePres, + SfxMapUnit eCoreMetric, + SfxMapUnit ePresMetric, + String& rText, + const IntlWrapper* pIntl = 0 ) const; +}; + +//---------------------------------------------------------------------------- +// + +class ScDoubleItem : public SfxPoolItem +{ +public: + TYPEINFO(); + ScDoubleItem( sal_uInt16 nWhich, double nVal=0 ); + ScDoubleItem( const ScDoubleItem& rItem ); + ~ScDoubleItem(); + + virtual String GetValueText() const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + double GetValue() const { return nValue; } + + void SetValue( const double nVal ) { nValue = nVal;} + +private: + double nValue; +}; + + +// ============================================================================ + +/** Member ID for "page scale to width" value in QueryValue() and PutValue(). */ +const sal_uInt8 SC_MID_PAGE_SCALETO_WIDTH = 1; +/** Member ID for "page scale to height" value in QueryValue() and PutValue(). */ +const sal_uInt8 SC_MID_PAGE_SCALETO_HEIGHT = 2; + + +/** Contains the "scale to width/height" attribute in page styles. */ +class SC_DLLPUBLIC ScPageScaleToItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + /** Default c'tor sets the width and height to 0. */ + explicit ScPageScaleToItem(); + explicit ScPageScaleToItem( sal_uInt16 nWidth, sal_uInt16 nHeight ); + + virtual ~ScPageScaleToItem(); + + virtual ScPageScaleToItem* Clone( SfxItemPool* = 0 ) const; + + virtual int operator==( const SfxPoolItem& rCmp ) const; + + inline sal_uInt16 GetWidth() const { return mnWidth; } + inline sal_uInt16 GetHeight() const { return mnHeight; } + inline bool IsValid() const { return mnWidth || mnHeight; } + + inline void SetWidth( sal_uInt16 nWidth ) { mnWidth = nWidth; } + inline void SetHeight( sal_uInt16 nHeight ) { mnHeight = nHeight; } + inline void Set( sal_uInt16 nWidth, sal_uInt16 nHeight ) + { mnWidth = nWidth; mnHeight = nHeight; } + inline void SetInvalid() { mnWidth = mnHeight = 0; } + + virtual SfxItemPresentation GetPresentation( + SfxItemPresentation ePresentation, + SfxMapUnit, SfxMapUnit, + XubString& rText, + const IntlWrapper* = 0 ) const; + + virtual bool QueryValue( ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ) const; + virtual bool PutValue( const ::com::sun::star::uno::Any& rAny, sal_uInt8 nMemberId = 0 ); + +private: + sal_uInt16 mnWidth; + sal_uInt16 mnHeight; +}; + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx new file mode 100644 index 000000000000..4095494372b4 --- /dev/null +++ b/sc/inc/autoform.hxx @@ -0,0 +1,286 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_AUTOFORM_HXX +#define SC_AUTOFORM_HXX + +/************************************************************************* +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +JP 20.07.95: + + Die akt. Struktur der Autoformatierung darf nicht mehr veraendert werden. + Diese wird durch unterschiedlichen Code vom StartWriter und vom StarCalc + eingelesen/geschrieben. + Sollte sich doch mal eine Aenderung nicht vermeiden lassen, dann auf + jedenfall in beiden Applikationen aendern. + + The structure of table auto formatting should not changed. It is used + by different code of Writer and Calc. If a change is necessary, the + source code of both applications must be changed! + +!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +**************************************************************************/ + +#include "scitems.hxx" +#include <editeng/adjitem.hxx> +#include <svx/algitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/cntritem.hxx> +#include <editeng/colritem.hxx> +#include <editeng/crsditem.hxx> +#include <editeng/fhgtitem.hxx> +#include <editeng/fontitem.hxx> +#include <editeng/postitem.hxx> +#include <editeng/shdditem.hxx> +#include <editeng/udlnitem.hxx> +#include <editeng/wghtitem.hxx> +#include <editeng/justifyitem.hxx> +#include <svx/rotmodit.hxx> +#include <svl/intitem.hxx> +#include <editeng/bolnitem.hxx> +#include "scdllapi.h" +#include "collect.hxx" +#include "global.hxx" +#include "zforauto.hxx" + + +struct ScAfVersions; + + +/// Contains all items for one cell of a table autoformat. +class ScAutoFormatDataField +{ +private: + SvxFontItem aFont; + SvxFontHeightItem aHeight; + SvxWeightItem aWeight; + SvxPostureItem aPosture; + + SvxFontItem aCJKFont; + SvxFontHeightItem aCJKHeight; + SvxWeightItem aCJKWeight; + SvxPostureItem aCJKPosture; + + SvxFontItem aCTLFont; + SvxFontHeightItem aCTLHeight; + SvxWeightItem aCTLWeight; + SvxPostureItem aCTLPosture; + + SvxUnderlineItem aUnderline; + SvxOverlineItem aOverline; + SvxCrossedOutItem aCrossedOut; + SvxContourItem aContour; + SvxShadowedItem aShadowed; + SvxColorItem aColor; + SvxBoxItem aBox; + SvxLineItem aTLBR; + SvxLineItem aBLTR; + SvxBrushItem aBackground; + + // Writer specific + SvxAdjustItem aAdjust; + + // Calc specific + SvxHorJustifyItem aHorJustify; + SvxVerJustifyItem aVerJustify; + SfxBoolItem aStacked; + SvxMarginItem aMargin; + SfxBoolItem aLinebreak; + // from SO5, 504k on, rotated text + SfxInt32Item aRotateAngle; + SvxRotateModeItem aRotateMode; + + // number format + ScNumFormatAbbrev aNumFormat; + +public: + ScAutoFormatDataField(); + ScAutoFormatDataField( const ScAutoFormatDataField& rCopy ); + ~ScAutoFormatDataField(); + + const ScNumFormatAbbrev& GetNumFormat() const { return aNumFormat; } + const SvxFontItem& GetFont() const { return aFont; } + const SvxFontHeightItem& GetHeight() const { return aHeight; } + const SvxWeightItem& GetWeight() const { return aWeight; } + const SvxPostureItem& GetPosture() const { return aPosture; } + const SvxFontItem& GetCJKFont() const { return aCJKFont; } + const SvxFontHeightItem& GetCJKHeight() const { return aCJKHeight; } + const SvxWeightItem& GetCJKWeight() const { return aCJKWeight; } + const SvxPostureItem& GetCJKPosture() const { return aCJKPosture; } + const SvxFontItem& GetCTLFont() const { return aCTLFont; } + const SvxFontHeightItem& GetCTLHeight() const { return aCTLHeight; } + const SvxWeightItem& GetCTLWeight() const { return aCTLWeight; } + const SvxPostureItem& GetCTLPosture() const { return aCTLPosture; } + const SvxUnderlineItem& GetUnderline() const { return aUnderline; } + const SvxOverlineItem& GetOverline() const { return aOverline; } + const SvxCrossedOutItem& GetCrossedOut() const { return aCrossedOut; } + const SvxContourItem& GetContour() const { return aContour; } + const SvxShadowedItem& GetShadowed() const { return aShadowed; } + const SvxColorItem& GetColor() const { return aColor; } + const SvxHorJustifyItem& GetHorJustify() const { return aHorJustify; } + const SvxVerJustifyItem& GetVerJustify() const { return aVerJustify; } + const SfxBoolItem& GetStacked() const { return aStacked; } + const SfxBoolItem& GetLinebreak() const { return aLinebreak; } + const SvxMarginItem& GetMargin() const { return aMargin; } + const SvxBoxItem& GetBox() const { return aBox; } + const SvxLineItem& GetTLBR() const { return aTLBR; } + const SvxLineItem& GetBLTR() const { return aBLTR; } + const SvxBrushItem& GetBackground() const { return aBackground; } + const SvxAdjustItem& GetAdjust() const { return aAdjust; } + const SfxInt32Item& GetRotateAngle() const { return aRotateAngle; } + const SvxRotateModeItem& GetRotateMode() const { return aRotateMode; } + + void SetNumFormat( const ScNumFormatAbbrev& rNumFormat ) { aNumFormat = rNumFormat; } + void SetFont( const SvxFontItem& rFont ) { aFont = rFont; } + void SetHeight( const SvxFontHeightItem& rHeight ) { aHeight = rHeight; } + void SetWeight( const SvxWeightItem& rWeight ) { aWeight = rWeight; } + void SetPosture( const SvxPostureItem& rPosture ) { aPosture = rPosture; } + void SetCJKFont( const SvxFontItem& rCJKFont ) { aCJKFont = rCJKFont; } + void SetCJKHeight( const SvxFontHeightItem& rCJKHeight ) { aCJKHeight = rCJKHeight; } + void SetCJKWeight( const SvxWeightItem& rCJKWeight ) { aCJKWeight = rCJKWeight; } + void SetCJKPosture( const SvxPostureItem& rCJKPosture ) { aCJKPosture = rCJKPosture; } + void SetCTLFont( const SvxFontItem& rCTLFont ) { aCTLFont = rCTLFont; } + void SetCTLHeight( const SvxFontHeightItem& rCTLHeight ) { aCTLHeight = rCTLHeight; } + void SetCTLWeight( const SvxWeightItem& rCTLWeight ) { aCTLWeight = rCTLWeight; } + void SetCTLPosture( const SvxPostureItem& rCTLPosture ) { aCTLPosture = rCTLPosture; } + void SetUnderline( const SvxUnderlineItem& rUnderline ) { aUnderline = rUnderline; } + void SetOverline( const SvxOverlineItem& rOverline ) { aOverline = rOverline; } + void SetCrossedOut( const SvxCrossedOutItem& rCrossedOut ) { aCrossedOut = rCrossedOut; } + void SetContour( const SvxContourItem& rContour ) { aContour = rContour; } + void SetShadowed( const SvxShadowedItem& rShadowed ) { aShadowed = rShadowed; } + void SetColor( const SvxColorItem& rColor ) { aColor = rColor; } + void SetHorJustify( const SvxHorJustifyItem& rHorJustify ) { aHorJustify = rHorJustify; } + void SetVerJustify( const SvxVerJustifyItem& rVerJustify ) { aVerJustify = rVerJustify; } + void SetStacked( const SfxBoolItem& rStacked ) { aStacked.SetValue( rStacked.GetValue() ); } + void SetLinebreak( const SfxBoolItem& rLinebreak ) { aLinebreak.SetValue( rLinebreak.GetValue() ); } + void SetMargin( const SvxMarginItem& rMargin ) { aMargin = rMargin; } + void SetBox( const SvxBoxItem& rBox ) { aBox = rBox; } + void SetTLBR( const SvxLineItem& rTLBR ) { aTLBR = rTLBR; } + void SetBLTR( const SvxLineItem& rBLTR ) { aBLTR = rBLTR; } + void SetBackground( const SvxBrushItem& rBackground ) { aBackground = rBackground; } + void SetAdjust( const SvxAdjustItem& rAdjust ); + void SetRotateAngle( const SfxInt32Item& rRotateAngle ) { aRotateAngle.SetValue( rRotateAngle.GetValue() ); } + void SetRotateMode( const SvxRotateModeItem& rRotateMode ) { aRotateMode.SetValue( rRotateMode.GetValue() ); } + + sal_Bool Load( SvStream& rStream, const ScAfVersions& rVersions, sal_uInt16 nVer ); + sal_Bool Save( SvStream& rStream ); + +#ifdef READ_OLDVERS + sal_Bool LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); +#endif +}; + + +class SC_DLLPUBLIC ScAutoFormatData : public ScDataObject +{ +private: + String aName; + sal_uInt16 nStrResId; + // common flags of Calc and Writer + sal_Bool bIncludeFont : 1; + sal_Bool bIncludeJustify : 1; + sal_Bool bIncludeFrame : 1; + sal_Bool bIncludeBackground : 1; + + // Calc specific flags + sal_Bool bIncludeValueFormat : 1; + sal_Bool bIncludeWidthHeight : 1; + + ScAutoFormatDataField** ppDataField; + + SC_DLLPRIVATE ScAutoFormatDataField& GetField( sal_uInt16 nIndex ); + SC_DLLPRIVATE const ScAutoFormatDataField& GetField( sal_uInt16 nIndex ) const; + +public: + ScAutoFormatData(); + ScAutoFormatData( const ScAutoFormatData& rData ); + virtual ~ScAutoFormatData(); + + virtual ScDataObject* Clone() const { return new ScAutoFormatData( *this ); } + + void SetName( const String& rName ) { aName = rName; nStrResId = USHRT_MAX; } + void GetName( String& rName ) const { rName = aName; } + + sal_Bool GetIncludeValueFormat() const { return bIncludeValueFormat; } + sal_Bool GetIncludeFont() const { return bIncludeFont; } + sal_Bool GetIncludeJustify() const { return bIncludeJustify; } + sal_Bool GetIncludeFrame() const { return bIncludeFrame; } + sal_Bool GetIncludeBackground() const { return bIncludeBackground; } + sal_Bool GetIncludeWidthHeight() const { return bIncludeWidthHeight; } + + void SetIncludeValueFormat( sal_Bool bValueFormat ) { bIncludeValueFormat = bValueFormat; } + void SetIncludeFont( sal_Bool bFont ) { bIncludeFont = bFont; } + void SetIncludeJustify( sal_Bool bJustify ) { bIncludeJustify = bJustify; } + void SetIncludeFrame( sal_Bool bFrame ) { bIncludeFrame = bFrame; } + void SetIncludeBackground( sal_Bool bBackground ) { bIncludeBackground = bBackground; } + void SetIncludeWidthHeight( sal_Bool bWidthHeight ) { bIncludeWidthHeight = bWidthHeight; } + + const SfxPoolItem* GetItem( sal_uInt16 nIndex, sal_uInt16 nWhich ) const; + void PutItem( sal_uInt16 nIndex, const SfxPoolItem& rItem ); + void CopyItem( sal_uInt16 nToIndex, sal_uInt16 nFromIndex, sal_uInt16 nWhich ); + + const ScNumFormatAbbrev& GetNumFormat( sal_uInt16 nIndex ) const; + + sal_Bool IsEqualData( sal_uInt16 nIndex1, sal_uInt16 nIndex2 ) const; + + void FillToItemSet( sal_uInt16 nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const; + void GetFromItemSet( sal_uInt16 nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat ); + + sal_Bool Load( SvStream& rStream, const ScAfVersions& rVersions ); + sal_Bool Save( SvStream& rStream ); + +#ifdef READ_OLDVERS + sal_Bool LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); +#endif +}; + +class SC_DLLPUBLIC ScAutoFormat : public ScSortedCollection +{ +private: + sal_Bool bSaveLater; + +public: + ScAutoFormat( sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false ); + ScAutoFormat( const ScAutoFormat& AutoFormat ); + virtual ~ScAutoFormat(); + virtual ScDataObject* Clone() const { return new ScAutoFormat( *this ); } + ScAutoFormatData* operator[]( const sal_uInt16 nIndex ) const {return (ScAutoFormatData*)At( nIndex );} + virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; + sal_Bool Load(); + sal_Bool Save(); + sal_uInt16 FindIndexPerName( const String& rName ) const; + void SetSaveLater( sal_Bool bSet ); + sal_Bool IsSaveLater() const { return bSaveLater; } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/autonamecache.hxx b/sc/inc/autonamecache.hxx new file mode 100644 index 000000000000..76804adc1361 --- /dev/null +++ b/sc/inc/autonamecache.hxx @@ -0,0 +1,60 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_AUTONAMECACHE_HXX +#define SC_AUTONAMECACHE_HXX + +#include <vector> +#include <boost/unordered_map.hpp> +#include "address.hxx" +#include "global.hxx" + +typedef ::std::vector< ScAddress > ScAutoNameAddresses; +typedef ::boost::unordered_map< String, ScAutoNameAddresses, ScStringHashCode, ::std::equal_to< String > > ScAutoNameHashMap; + +// +// Cache for faster lookup of automatic names during CompileXML +// (during CompileXML, no document content is changed) +// + +class ScAutoNameCache +{ + ScAutoNameHashMap aNames; + ScDocument* pDoc; + SCTAB nCurrentTab; + +public: + ScAutoNameCache( ScDocument* pD ); + ~ScAutoNameCache(); + + const ScAutoNameAddresses& GetNameOccurrences( const String& rName, SCTAB nTab ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx new file mode 100644 index 000000000000..742fde7d07a4 --- /dev/null +++ b/sc/inc/bigrange.hxx @@ -0,0 +1,276 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_BIGRANGE_HXX +#define SC_BIGRANGE_HXX + + +#include "global.hxx" +#include "document.hxx" + + +static const sal_Int32 nInt32Min = 0x80000000; +static const sal_Int32 nInt32Max = 0x7fffffff; + + +class ScBigAddress +{ + sal_Int32 nRow; + sal_Int32 nCol; + sal_Int32 nTab; + +public: + ScBigAddress() : nRow(0), nCol(0), nTab(0) {} + ScBigAddress( sal_Int32 nColP, sal_Int32 nRowP, sal_Int32 nTabP ) + : nRow( nRowP ), nCol( nColP ), nTab( nTabP ) {} + ScBigAddress( const ScBigAddress& r ) + : nRow( r.nRow ), nCol( r.nCol ), nTab( r.nTab ) {} + ScBigAddress( const ScAddress& r ) + : nRow( r.Row() ), nCol( r.Col() ), nTab( r.Tab() ) {} + + sal_Int32 Col() const { return nCol; } + sal_Int32 Row() const { return nRow; } + sal_Int32 Tab() const { return nTab; } + + void Set( sal_Int32 nColP, sal_Int32 nRowP, sal_Int32 nTabP ) + { nCol = nColP; nRow = nRowP; nTab = nTabP; } + void SetCol( sal_Int32 nColP ) { nCol = nColP; } + void SetRow( sal_Int32 nRowP ) { nRow = nRowP; } + void SetTab( sal_Int32 nTabP ) { nTab = nTabP; } + void IncCol( sal_Int32 n = 1 ) { nCol += n; } + void IncRow( sal_Int32 n = 1 ) { nRow += n; } + void IncTab( sal_Int32 n = 1 ) { nTab += n; } + + void GetVars( sal_Int32& nColP, sal_Int32& nRowP, sal_Int32& nTabP ) const + { nColP = nCol; nRowP = nRow; nTabP = nTab; } + + inline void PutInOrder( ScBigAddress& r ); + inline sal_Bool IsValid( const ScDocument* ) const; + inline ScAddress MakeAddress() const; + + ScBigAddress& operator=( const ScBigAddress& r ) + { nCol = r.nCol; nRow = r.nRow; nTab = r.nTab; return *this; } + ScBigAddress& operator=( const ScAddress& r ) + { nCol = r.Col(); nRow = r.Row(); nTab = r.Tab(); return *this; } + int operator==( const ScBigAddress& r ) const + { return nCol == r.nCol && nRow == r.nRow && nTab == r.nTab; } + int operator!=( const ScBigAddress& r ) const + { return !operator==( r ); } + + friend inline SvStream& operator<< ( SvStream& rStream, const ScBigAddress& rAdr ); + friend inline SvStream& operator>> ( SvStream& rStream, ScBigAddress& rAdr ); +}; + + +inline void ScBigAddress::PutInOrder( ScBigAddress& r ) +{ + sal_Int32 nTmp; + if ( r.nCol < nCol ) + { + nTmp = r.nCol; + r.nCol = nCol; + nCol = nTmp; + } + if ( r.nRow < nRow ) + { + nTmp = r.nRow; + r.nRow = nRow; + nRow = nTmp; + } + if ( r.nTab < nTab ) + { + nTmp = r.nTab; + r.nTab = nTab; + nTab = nTmp; + } +} + + +inline sal_Bool ScBigAddress::IsValid( const ScDocument* pDoc ) const +{ // min/max interval bounds define whole col/row/tab + return + ((0 <= nCol && nCol <= MAXCOL) + || nCol == nInt32Min || nCol == nInt32Max) && + ((0 <= nRow && nRow <= MAXROW) + || nRow == nInt32Min || nRow == nInt32Max) && + ((0 <= nTab && nTab < pDoc->GetTableCount()) + || nTab == nInt32Min || nTab == nInt32Max) + ; +} + + +inline ScAddress ScBigAddress::MakeAddress() const +{ + SCCOL nColA; + SCROW nRowA; + SCTAB nTabA; + + if ( nCol < 0 ) + nColA = 0; + else if ( nCol > MAXCOL ) + nColA = MAXCOL; + else + nColA = (SCCOL) nCol; + + if ( nRow < 0 ) + nRowA = 0; + else if ( nRow > MAXROW ) + nRowA = MAXROW; + else + nRowA = (SCROW) nRow; + + if ( nTab < 0 ) + nTabA = 0; + else if ( nTab > MAXTAB ) + nTabA = MAXTAB; + else + nTabA = (SCTAB) nTab; + + return ScAddress( nColA, nRowA, nTabA ); +} + + +inline SvStream& operator<< ( SvStream& rStream, const ScBigAddress& rAdr ) +{ + rStream << rAdr.nCol << rAdr.nRow << rAdr.nTab; + return rStream; +} + + +inline SvStream& operator>> ( SvStream& rStream, ScBigAddress& rAdr ) +{ + rStream >> rAdr.nCol >> rAdr.nRow >> rAdr.nTab; + return rStream; +} + + +class ScBigRange +{ +public: + + ScBigAddress aStart; + ScBigAddress aEnd; + + ScBigRange() : aStart(), aEnd() {} + ScBigRange( const ScBigAddress& s, const ScBigAddress& e ) + : aStart( s ), aEnd( e ) { aStart.PutInOrder( aEnd ); } + ScBigRange( const ScBigRange& r ) + : aStart( r.aStart ), aEnd( r.aEnd ) {} + ScBigRange( const ScRange& r ) + : aStart( r.aStart ), aEnd( r.aEnd ) {} + ScBigRange( const ScBigAddress& r ) + : aStart( r ), aEnd( r ) {} + ScBigRange( const ScAddress& r ) + : aStart( r ), aEnd( r ) {} + ScBigRange( sal_Int32 nCol, sal_Int32 nRow, sal_Int32 nTab ) + : aStart( nCol, nRow, nTab ), aEnd( aStart ) {} + ScBigRange( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nTab1, + sal_Int32 nCol2, sal_Int32 nRow2, sal_Int32 nTab2 ) + : aStart( nCol1, nRow1, nTab1 ), + aEnd( nCol2, nRow2, nTab2 ) {} + + void Set( sal_Int32 nCol1, sal_Int32 nRow1, sal_Int32 nTab1, + sal_Int32 nCol2, sal_Int32 nRow2, sal_Int32 nTab2 ) + { aStart.Set( nCol1, nRow1, nTab1 ); + aEnd.Set( nCol2, nRow2, nTab2 ); } + + void GetVars( sal_Int32& nCol1, sal_Int32& nRow1, sal_Int32& nTab1, + sal_Int32& nCol2, sal_Int32& nRow2, sal_Int32& nTab2 ) const + { aStart.GetVars( nCol1, nRow1, nTab1 ); + aEnd.GetVars( nCol2, nRow2, nTab2 ); } + + sal_Bool IsValid( const ScDocument* pDoc ) const + { return aStart.IsValid( pDoc ) && aEnd.IsValid( pDoc ); } + inline ScRange MakeRange() const + { return ScRange( aStart.MakeAddress(), + aEnd.MakeAddress() ); } + + inline sal_Bool In( const ScBigAddress& ) const; // is Address& in range? + inline sal_Bool In( const ScBigRange& ) const; // is Range& in range? + inline sal_Bool Intersects( const ScBigRange& ) const; // do two ranges overlap? + + ScBigRange& operator=( const ScBigRange& r ) + { aStart = r.aStart; aEnd = r.aEnd; return *this; } + int operator==( const ScBigRange& r ) const + { return (aStart == r.aStart) && (aEnd == r.aEnd); } + int operator!=( const ScBigRange& r ) const + { return !operator==( r ); } + + friend inline SvStream& operator<< ( SvStream& rStream, const ScBigRange& rRange ); + friend inline SvStream& operator>> ( SvStream& rStream, ScBigRange& rRange ); +}; + + +inline sal_Bool ScBigRange::In( const ScBigAddress& rAddr ) const +{ + return + aStart.Col() <= rAddr.Col() && rAddr.Col() <= aEnd.Col() && + aStart.Row() <= rAddr.Row() && rAddr.Row() <= aEnd.Row() && + aStart.Tab() <= rAddr.Tab() && rAddr.Tab() <= aEnd.Tab(); +} + + +inline sal_Bool ScBigRange::In( const ScBigRange& r ) const +{ + return + aStart.Col() <= r.aStart.Col() && r.aEnd.Col() <= aEnd.Col() && + aStart.Row() <= r.aStart.Row() && r.aEnd.Row() <= aEnd.Row() && + aStart.Tab() <= r.aStart.Tab() && r.aEnd.Tab() <= aEnd.Tab(); +} + + +inline sal_Bool ScBigRange::Intersects( const ScBigRange& r ) const +{ + return !( + Min( aEnd.Col(), r.aEnd.Col() ) < Max( aStart.Col(), r.aStart.Col() ) + || Min( aEnd.Row(), r.aEnd.Row() ) < Max( aStart.Row(), r.aStart.Row() ) + || Min( aEnd.Tab(), r.aEnd.Tab() ) < Max( aStart.Tab(), r.aStart.Tab() ) + ); +} + + +inline SvStream& operator<< ( SvStream& rStream, const ScBigRange& rRange ) +{ + rStream << rRange.aStart; + rStream << rRange.aEnd; + return rStream; +} + + +inline SvStream& operator>> ( SvStream& rStream, ScBigRange& rRange ) +{ + rStream >> rRange.aStart; + rStream >> rRange.aEnd; + return rStream; +} + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx new file mode 100644 index 000000000000..cf937f29fa67 --- /dev/null +++ b/sc/inc/brdcst.hxx @@ -0,0 +1,73 @@ +/* -*- 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. + * + ************************************************************************/ +#ifndef _SC_BRDCST_HXX +#define _SC_BRDCST_HXX + +#include "global.hxx" +#include "address.hxx" +#include <tools/rtti.hxx> +#include <svl/hint.hxx> +#include <svl/smplhint.hxx> +class ScBaseCell; + +#define SC_HINT_DYING SFX_HINT_DYING +#define SC_HINT_DATACHANGED SFX_HINT_DATACHANGED +#define SC_HINT_TABLEOPDIRTY SFX_HINT_USER00 +#define SC_HINT_CALCALL SFX_HINT_USER01 + +class ScHint : public SfxSimpleHint +{ +private: + ScAddress aAddress; + ScBaseCell* pCell; + +public: + TYPEINFO(); + ScHint( sal_uLong n, const ScAddress& a, ScBaseCell* p ) + : SfxSimpleHint( n ), aAddress( a ), pCell( p ) {} + ScBaseCell* GetCell() const { return pCell; } + void SetCell( ScBaseCell* p ) { pCell = p; } + const ScAddress& GetAddress() const { return aAddress; } + ScAddress& GetAddress() { return aAddress; } + void SetAddress( const ScAddress& rAdr ) { aAddress = rAdr; } +}; + +class ScAreaChangedHint : public SfxHint +{ +private: + ScRange aNewRange; +public: + TYPEINFO(); + ScAreaChangedHint(const ScRange& rRange) : aNewRange(rRange) {} + const ScRange& GetRange() const { return aNewRange; } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/callform.hxx b/sc/inc/callform.hxx new file mode 100644 index 000000000000..e299e61874d8 --- /dev/null +++ b/sc/inc/callform.hxx @@ -0,0 +1,119 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CALLFORM_HXX +#define SC_CALLFORM_HXX + +#include "collect.hxx" + +#include <rtl/ustring.hxx> + +#define MAXFUNCPARAM 16 +#define MAXARRSIZE 0xfffe + +#ifndef WNT +#define CALLTYPE +#else +#define CALLTYPE __cdecl +#endif + +extern "C" { +typedef void (CALLTYPE* AdvData)( double& nHandle, void* pData ); +} + +enum ParamType +{ + PTR_DOUBLE, + PTR_STRING, + PTR_DOUBLE_ARR, + PTR_STRING_ARR, + PTR_CELL_ARR, + NONE +}; + +class ModuleData; +class FuncData : public ScDataObject +{ +friend class FuncCollection; + const ModuleData* pModuleData; + String aInternalName; + String aFuncName; + sal_uInt16 nNumber; + sal_uInt16 nParamCount; + ParamType eAsyncType; + ParamType eParamType[MAXFUNCPARAM]; +private: + FuncData(const String& rIName); +public: + FuncData(const ModuleData*pModule, + const String& rIName, + const String& rFName, + sal_uInt16 nNo, + sal_uInt16 nCount, + const ParamType* peType, + ParamType eType); + FuncData(const FuncData& rData); + virtual ScDataObject* Clone() const { return new FuncData(*this); } + + const String& GetModuleName() const; + const String& GetInternalName() const { return aInternalName; } + const String& GetFuncName() const { return aFuncName; } + sal_uInt16 GetParamCount() const { return nParamCount; } + ParamType GetParamType(sal_uInt16 nIndex) const { return eParamType[nIndex]; } + ParamType GetReturnType() const { return eParamType[0]; } + ParamType GetAsyncType() const { return eAsyncType; } + sal_Bool Call(void** ppParam); + sal_Bool Unadvice(double nHandle); + + // name and description of parameter nParam. + // nParam==0 => Desc := function description, + // Name := n/a + bool getParamDesc( ::rtl::OUString& aName, ::rtl::OUString& aDesc, sal_uInt16 nParam ); + +}; + + +class FuncCollection : public ScSortedCollection +{ +public: + FuncCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false) : ScSortedCollection ( nLim, nDel, bDup ) {} + FuncCollection(const FuncCollection& rFuncCollection) : ScSortedCollection ( rFuncCollection ) {} + + virtual ScDataObject* Clone() const { return new FuncCollection(*this); } + FuncData* operator[]( const sal_uInt16 nIndex) const {return (FuncData*)At(nIndex);} + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; + sal_Bool SearchFunc( const String& rName, sal_uInt16& rIndex ) const; +}; + + +sal_Bool InitExternalFunc(const rtl::OUString& rModuleName); +void ExitExternalFunc(); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx new file mode 100644 index 000000000000..ae5c3e7b880e --- /dev/null +++ b/sc/inc/cell.hxx @@ -0,0 +1,549 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CELL_HXX +#define SC_CELL_HXX + +#include <stddef.h> + +#include <set> +#include <vector> +#include <boost/shared_ptr.hpp> + +#include <tools/mempool.hxx> +#include <svl/listener.hxx> +#include "global.hxx" +#include "rangenam.hxx" +#include "formula/grammar.hxx" +#include "tokenarray.hxx" +#include "formularesult.hxx" +#include <rtl/ustrbuf.hxx> +#include <unotools/fontcvt.hxx> +#include "scdllapi.h" + +#define USE_MEMPOOL +#define TEXTWIDTH_DIRTY 0xffff + +// in addition to SCRIPTTYPE_... flags from scripttypeitem.hxx: +// set (in nScriptType) if type has not been determined yet +#define SC_SCRIPTTYPE_UNKNOWN 0x08 + +class ScDocument; +class EditTextObject; +class ScMatrix; +class SvtBroadcaster; +class ScCodeArray; +class ScProgress; +class ScPostIt; +class ScPatternAttr; + +// ============================================================================ + +/** Default cell clone flags: do not start listening, do not adjust 3D refs to + old position, clone note captions of cell notes. */ +const int SC_CLONECELL_DEFAULT = 0x0000; + +/** If set, cloned formula cells will start to listen to the document. */ +const int SC_CLONECELL_STARTLISTENING = 0x0001; + +/** If set, relative 3D references of cloned formula cells will be adjusted to + old position (used while swapping cells for sorting a cell range). */ +const int SC_CLONECELL_ADJUST3DREL = 0x0002; + +/** If set, the caption object of a cell note will not be cloned (used while + copying cells to undo document, where captions are handled in drawing undo). */ +const int SC_CLONECELL_NOCAPTION = 0x0004; + +// ============================================================================ + +class SC_DLLPUBLIC ScBaseCell +{ +protected: + ~ScBaseCell(); // not virtual - not to be called directly. + +public: + explicit ScBaseCell( CellType eNewType ); + + /** Base copy constructor. Does NOT clone cell note or broadcaster! */ + ScBaseCell( const ScBaseCell& rCell ); + + /** Returns a clone of this cell at the same position, cell note and + broadcaster will not be cloned. */ + ScBaseCell* CloneWithoutNote( ScDocument& rDestDoc, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; + + /** Returns a clone of this cell for the passed document position, cell + note and broadcaster will not be cloned. */ + ScBaseCell* CloneWithoutNote( ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; + + /** Returns a clone of this cell, clones cell note and caption object too + (unless SC_CLONECELL_NOCAPTION flag is set). Broadcaster will not be cloned. */ + ScBaseCell* CloneWithNote( const ScAddress& rOwnPos, ScDocument& rDestDoc, const ScAddress& rDestPos, int nCloneFlags = SC_CLONECELL_DEFAULT ) const; + + /** Due to the fact that ScBaseCell does not have a vtable, this function + deletes the cell by calling the appropriate d'tor of the derived class. */ + void Delete(); + + inline CellType GetCellType() const { return (CellType)eCellType; } + + /** Returns true, if the cell is empty (neither value nor formula nor cell note). + Returns false for formula cells returning nothing, use HasEmptyData() for that. */ + bool IsBlank( bool bIgnoreNotes = false ) const; + +// for idle-calculations + inline sal_uInt16 GetTextWidth() const { return nTextWidth; } + inline void SetTextWidth( sal_uInt16 nNew ) { nTextWidth = nNew; } + + inline sal_uInt8 GetScriptType() const { return nScriptType; } + inline void SetScriptType( sal_uInt8 nNew ) { nScriptType = nNew; } + + /** Returns true, if the cell contains a note. */ + inline bool HasNote() const { return mpNote != 0; } + /** Returns the pointer to a cell note object (read-only). */ + inline const ScPostIt* GetNote() const { return mpNote; } + /** Returns the pointer to a cell note object. */ + inline ScPostIt* GetNote() { return mpNote; } + /** Takes ownership of the passed cell note object. */ + void TakeNote( ScPostIt* pNote ); + /** Returns and forgets the own cell note object. Caller takes ownership! */ + ScPostIt* ReleaseNote(); + /** Deletes the own cell note object. */ + void DeleteNote(); + + /** Returns true, if the cell contains a broadcaster. */ + inline bool HasBroadcaster() const { return mpBroadcaster != 0; } + /** Returns the pointer to the cell broadcaster. */ + inline SvtBroadcaster* GetBroadcaster() const { return mpBroadcaster; } + /** Takes ownership of the passed cell broadcaster. */ + void TakeBroadcaster( SvtBroadcaster* pBroadcaster ); + /** Returns and forgets the own cell broadcaster. Caller takes ownership! */ + SvtBroadcaster* ReleaseBroadcaster(); + /** Deletes the own cell broadcaster. */ + void DeleteBroadcaster(); + + // String- oder EditCell + static ScBaseCell* CreateTextCell( const String& rString, ScDocument* ); + + // nOnlyNames may be one or more of SC_LISTENING_NAMES_* + void StartListeningTo( ScDocument* pDoc ); + void EndListeningTo( ScDocument* pDoc, + ScTokenArray* pArr = NULL, + ScAddress aPos = ScAddress() ); + + /** Error code if ScFormulaCell, else 0. */ + sal_uInt16 GetErrorCode() const; + /** ScFormulaCell with formula::svEmptyCell result, or ScNoteCell (may have been + created due to reference to empty cell). */ + sal_Bool HasEmptyData() const; + sal_Bool HasValueData() const; + sal_Bool HasStringData() const; + String GetStringData() const; // only real strings + + static sal_Bool CellEqual( const ScBaseCell* pCell1, const ScBaseCell* pCell2 ); + +private: + ScBaseCell& operator=( const ScBaseCell& ); + +private: + ScPostIt* mpNote; /// The cell note. Cell takes ownership! + SvtBroadcaster* mpBroadcaster; /// Broadcaster for changed values. Cell takes ownership! + +protected: + sal_uInt16 nTextWidth; + sal_uInt8 eCellType; // enum CellType - sal_uInt8 spart Speicher + sal_uInt8 nScriptType; +}; + +// ============================================================================ + +class SC_DLLPUBLIC ScNoteCell : public ScBaseCell +{ +public: +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScNoteCell ) +#endif + + /** Cell takes ownership of the passed broadcaster. */ + explicit ScNoteCell( SvtBroadcaster* pBC = 0 ); + /** Cell takes ownership of the passed note and broadcaster. */ + explicit ScNoteCell( ScPostIt* pNote, SvtBroadcaster* pBC = 0 ); + +#ifdef DBG_UTIL + ~ScNoteCell(); +#endif + +private: + ScNoteCell( const ScNoteCell& ); +}; + +class SC_DLLPUBLIC ScValueCell : public ScBaseCell +{ +public: +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScValueCell ) +#endif + ScValueCell(); + explicit ScValueCell( double fValue ); + +#ifdef DBG_UTIL + ~ScValueCell(); +#endif + + inline void SetValue( double fValue ) { mfValue = fValue; } + inline double GetValue() const { return mfValue; } + +private: + double mfValue; +}; + +class SC_DLLPUBLIC ScStringCell : public ScBaseCell +{ +public: +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScStringCell ) +#endif + + ScStringCell(); + explicit ScStringCell( const String& rString ); + +#ifdef DBG_UTIL + ~ScStringCell(); +#endif + + inline void SetString( const String& rString ) { maString = rString; } + inline void GetString( String& rString ) const { rString = maString; } + inline const String& GetString() const { return maString; } + +private: + String maString; +}; + +class SC_DLLPUBLIC ScEditCell : public ScBaseCell +{ +private: + EditTextObject* pData; + String* pString; // for faster access to formulas + ScDocument* pDoc; // for EditEngine access with Pool + + void SetTextObject( const EditTextObject* pObject, + const SfxItemPool* pFromPool ); + + // not implemented + ScEditCell( const ScEditCell& ); + +public: + +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScEditCell ) +#endif + + ~ScEditCell(); // always because of pData! + + ScEditCell( const EditTextObject* pObject, ScDocument*, + const SfxItemPool* pFromPool /* = NULL */ ); + ScEditCell( const ScEditCell& rCell, ScDocument& rDoc ); + // for line breaks + ScEditCell( const String& rString, ScDocument* ); + + void SetData( const EditTextObject* pObject, + const SfxItemPool* pFromPool /* = NULL */ ); + void GetData( const EditTextObject*& rpObject ) const; + void GetString( String& rString ) const; + + const EditTextObject* GetData() const { return pData; } + + /** Removes character attribute based on new pattern attributes. */ + void RemoveCharAttribs( const ScPatternAttr& rAttr ); +}; + +class ScEditDataArray +{ +public: + class Item + { + public: + explicit Item(SCTAB nTab, SCCOL nCol, SCROW nRow, + EditTextObject* pOldData, EditTextObject* pNewData); + ~Item(); + + const EditTextObject* GetOldData() const; + const EditTextObject* GetNewData() const; + SCTAB GetTab() const; + SCCOL GetCol() const; + SCROW GetRow() const; + + private: + Item(); // disabled + + private: + ::boost::shared_ptr<EditTextObject> mpOldData; + ::boost::shared_ptr<EditTextObject> mpNewData; + SCTAB mnTab; + SCCOL mnCol; + SCROW mnRow; + + }; + + ScEditDataArray(); + ~ScEditDataArray(); + + void AddItem(SCTAB nTab, SCCOL nCol, SCROW nRow, + EditTextObject* pOldData, EditTextObject* pNewData); + + const Item* First(); + const Item* Next(); + +private: + ::std::vector<Item>::const_iterator maIter; + ::std::vector<Item> maArray; +}; + +enum ScMatrixMode { + MM_NONE = 0, // No matrix formula + MM_FORMULA = 1, // Upper left matrix formula cell + MM_REFERENCE = 2, // Remaining cells, via ocMatRef reference token + MM_FAKE = 3 // Interpret "as-if" matrix formula (legacy) +}; + +class SC_DLLPUBLIC ScFormulaCell : public ScBaseCell, public SvtListener +{ +private: + ScFormulaResult aResult; + formula::FormulaGrammar::Grammar eTempGrammar; // used between string (creation) and (re)compilation + ScTokenArray* pCode; // The (new) token array + ScDocument* pDocument; + ScFormulaCell* pPrevious; + ScFormulaCell* pNext; + ScFormulaCell* pPreviousTrack; + ScFormulaCell* pNextTrack; + sal_uLong nFormatIndex; // Number format set by calculation + short nFormatType; // Number format type set by calculation + sal_uInt16 nSeenInIteration; // Iteration cycle in which the cell was last encountered + sal_uInt8 cMatrixFlag; // One of ScMatrixMode + sal_Bool bDirty : 1; // Must be (re)calculated + sal_Bool bChanged : 1; // Whether something changed regarding display/representation + sal_Bool bRunning : 1; // Already interpreting right now + sal_Bool bCompile : 1; // Must be (re)compiled + sal_Bool bSubTotal : 1; // Cell is part of or contains a SubTotal + sal_Bool bIsIterCell : 1; // Cell is part of a circular reference + sal_Bool bInChangeTrack : 1; // Cell is in ChangeTrack + sal_Bool bTableOpDirty : 1; // Dirty flag for TableOp + sal_Bool bNeedListening : 1; // Listeners need to be re-established after UpdateReference + + enum ScInterpretTailParameter + { + SCITP_NORMAL, + SCITP_FROM_ITERATION, + SCITP_CLOSE_ITERATION_CIRCLE + }; + void InterpretTail( ScInterpretTailParameter ); + + ScFormulaCell( const ScFormulaCell& ); + +public: + +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScFormulaCell ) +#endif + + ScAddress aPos; + + ~ScFormulaCell(); + ScFormulaCell(); + + /** Empty formula cell, or with a preconstructed token array. */ + ScFormulaCell( ScDocument*, const ScAddress&, const ScTokenArray* = NULL, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT, + sal_uInt8 = MM_NONE ); + + /** With formula string and grammar to compile with. + formula::FormulaGrammar::GRAM_DEFAULT effectively isformula::FormulaGrammar::GRAM_NATIVE_UI that + also includes formula::FormulaGrammar::CONV_UNSPECIFIED, therefor uses the address + convention associated with rPos::nTab by default. */ + ScFormulaCell( ScDocument* pDoc, const ScAddress& rPos, + const String& rFormula, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT, + sal_uInt8 cMatInd = MM_NONE ); + + ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags = SC_CLONECELL_DEFAULT ); + + void GetFormula( String& rFormula, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; + void GetFormula( rtl::OUStringBuffer& rBuffer, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; + + void SetDirty(); + void SetDirtyVar(); + // If setting entire document dirty after load, no broadcasts but still append to FormulaTree. + void SetDirtyAfterLoad(); + inline void ResetTableOpDirtyVar() { bTableOpDirty = false; } + void SetTableOpDirty(); + sal_Bool IsDirtyOrInTableOpDirty() const; + sal_Bool GetDirty() const { return bDirty; } + sal_Bool NeedsListening() const { return bNeedListening; } + void SetNeedsListening( sal_Bool bVar ) { bNeedListening = bVar; } + void Compile(const String& rFormula, + sal_Bool bNoListening = false, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ); + void CompileTokenArray( sal_Bool bNoListening = false ); + void CompileXML( ScProgress& rProgress ); // compile temporary string tokens + void CalcAfterLoad(); + bool MarkUsedExternalReferences(); + void Interpret(); + inline sal_Bool IsIterCell() const { return bIsIterCell; } + inline sal_uInt16 GetSeenInIteration() const { return nSeenInIteration; } + + sal_Bool HasOneReference( ScRange& r ) const; + /* Checks if the formula contains reference list that can be + expressed by one reference (like A1;A2;A3:A5 -> A1:A5). The + reference list is not required to be sorted (i.e. A3;A1;A2 is + still recognized as A1:A3), but no overlapping is allowed. + If one reference is recognized, the rRange is filled. + + It is similar to HasOneReference(), but more general. + */ + bool HasRefListExpressibleAsOneReference(ScRange& rRange) const; + sal_Bool HasRelNameReference() const; + sal_Bool HasColRowName() const; + + bool UpdateReference(UpdateRefMode eUpdateRefMode, + const ScRange& r, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + ScDocument* pUndoDoc = NULL, + const ScAddress* pUndoCellPos = NULL ); + + void TransposeReference(); + void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest, + ScDocument* pUndoDoc ); + + void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); + + void UpdateInsertTab(SCTAB nTable); + void UpdateInsertTabAbs(SCTAB nTable); + sal_Bool UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove = false); + void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo); + void UpdateRenameTab(SCTAB nTable, const String& rName); + sal_Bool TestTabRefAbs(SCTAB nTable); + void UpdateCompile( sal_Bool bForceIfNameInUse = false ); + sal_Bool IsRangeNameInUse(sal_uInt16 nIndex) const; + void FindRangeNamesInUse(std::set<sal_uInt16>& rIndexes) const; + void ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap ); + sal_Bool IsSubTotal() const { return bSubTotal; } + sal_Bool IsChanged() const { return bChanged; } + void ResetChanged() { bChanged = false; } + sal_Bool IsEmpty(); // formula::svEmptyCell result + // display as empty string if formula::svEmptyCell result + sal_Bool IsEmptyDisplayedAsString(); + sal_Bool IsValue(); // also sal_True if formula::svEmptyCell + double GetValue(); + double GetValueAlways(); // ignore errors + void GetString( String& rString ); + const ScMatrix* GetMatrix(); + sal_Bool GetMatrixOrigin( ScAddress& rPos ) const; + void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ); + sal_uInt16 GetMatrixEdge( ScAddress& rOrgPos ); + sal_uInt16 GetErrCode(); // interpret first if necessary + sal_uInt16 GetRawError(); // don't interpret, just return code or result error + short GetFormatType() const { return nFormatType; } + sal_uLong GetFormatIndex() const { return nFormatIndex; } + void GetFormatInfo( short& nType, sal_uLong& nIndex ) const + { nType = nFormatType; nIndex = nFormatIndex; } + sal_uInt8 GetMatrixFlag() const { return cMatrixFlag; } + ScTokenArray* GetCode() const { return pCode; } + + sal_Bool IsRunning() const { return bRunning; } + void SetRunning( sal_Bool bVal ) { bRunning = bVal; } + void CompileDBFormula(); + void CompileDBFormula( sal_Bool bCreateFormulaString ); + void CompileNameFormula( sal_Bool bCreateFormulaString ); + void CompileColRowNameFormula(); + ScFormulaCell* GetPrevious() const { return pPrevious; } + ScFormulaCell* GetNext() const { return pNext; } + void SetPrevious( ScFormulaCell* pF ) { pPrevious = pF; } + void SetNext( ScFormulaCell* pF ) { pNext = pF; } + ScFormulaCell* GetPreviousTrack() const { return pPreviousTrack; } + ScFormulaCell* GetNextTrack() const { return pNextTrack; } + void SetPreviousTrack( ScFormulaCell* pF ) { pPreviousTrack = pF; } + void SetNextTrack( ScFormulaCell* pF ) { pNextTrack = pF; } + + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint); + void SetCompile( sal_Bool bVal ) { bCompile = bVal; } + ScDocument* GetDocument() const { return pDocument; } + void SetMatColsRows( SCCOL nCols, SCROW nRows ); + void GetMatColsRows( SCCOL& nCols, SCROW& nRows ) const; + + // cell belongs to ChangeTrack and not to the real document + void SetInChangeTrack( sal_Bool bVal ) { bInChangeTrack = bVal; } + sal_Bool IsInChangeTrack() const { return bInChangeTrack; } + + // standard format for type and format + // for format "Standard" possibly the format used in the formula cell + sal_uLong GetStandardFormat( SvNumberFormatter& rFormatter, sal_uLong nFormat ) const; + + // For import filters! + void AddRecalcMode( formula::ScRecalcMode ); + /** For import only: set a double result. */ + void SetHybridDouble( double n ) { aResult.SetHybridDouble( n); } + /** For import only: set a string result. + If for whatever reason you have to use both, SetHybridDouble() and + SetHybridString() or SetHybridFormula(), use SetHybridDouble() first + for performance reasons.*/ + void SetHybridString( const String& r ) + { aResult.SetHybridString( r); } + /** For import only: set a temporary formula string to be compiled later. + If for whatever reason you have to use both, SetHybridDouble() and + SetHybridString() or SetHybridFormula(), use SetHybridDouble() first + for performance reasons.*/ + void SetHybridFormula( const String& r, + const formula::FormulaGrammar::Grammar eGrammar ) + { aResult.SetHybridFormula( r); eTempGrammar = eGrammar; } + void SetErrCode( sal_uInt16 n ); + inline sal_Bool IsHyperLinkCell() const { return pCode && pCode->IsHyperLink(); } + EditTextObject* CreateURLObject() ; + void GetURLResult( String& rURL, String& rCellText ); + + /** Determines whether or not the result string contains more than one paragraph */ + bool IsMultilineResult(); + + void MaybeInterpret(); +}; + +// Iterator for references in a formula cell +class ScDetectiveRefIter +{ +private: + ScTokenArray* pCode; + ScAddress aPos; +public: + ScDetectiveRefIter( ScFormulaCell* pCell ); + sal_Bool GetNextRef( ScRange& rRange ); + ScToken* GetNextRefToken(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx new file mode 100644 index 000000000000..70f0263c8064 --- /dev/null +++ b/sc/inc/cellform.hxx @@ -0,0 +1,67 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CELLFORM_HXX +#define SC_CELLFORM_HXX + +#include <tools/solar.h> +#include "scdllapi.h" + +class String; + +class ScBaseCell; +class SvNumberFormatter; +class Color; + +enum ScForceTextFmt { + ftDontForce, // numbers as numbers + ftForce, // numbers as text + ftCheck // is the numberformat a textformat? +}; + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScCellFormat +{ +public: + static void GetString( ScBaseCell* pCell, sal_uLong nFormat, String& rString, + Color** ppColor, SvNumberFormatter& rFormatter, + sal_Bool bNullVals = sal_True, + sal_Bool bFormula = false, + ScForceTextFmt eForceTextFmt = ftDontForce ); + + static void GetInputString( ScBaseCell* pCell, sal_uLong nFormat, String& rString, + SvNumberFormatter& rFormatter ); +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx new file mode 100644 index 000000000000..b1f703f39b9f --- /dev/null +++ b/sc/inc/cellsuno.hxx @@ -0,0 +1,1571 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CELLSUNO_HXX +#define SC_CELLSUNO_HXX + +#include "global.hxx" // ScRange, ScAddress +#include "rangelst.hxx" // ScRangeList + +#include "formula/grammar.hxx" +#include <svl/lstner.hxx> +#include <svl/listener.hxx> +#include <svl/itemprop.hxx> +#include <com/sun/star/table/XTableChartsSupplier.hpp> +#include <com/sun/star/chart/XChartDataArray.hpp> +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <com/sun/star/drawing/XDrawPageSupplier.hpp> +#include <com/sun/star/sheet/XSheetCellRange.hpp> +#include <com/sun/star/sheet/XFormulaQuery.hpp> +#include <com/sun/star/sheet/XCellRangeAddressable.hpp> +#include <com/sun/star/sheet/XSheetOperation.hpp> +#include <com/sun/star/sheet/XSheetCellRangeContainer.hpp> +#include <com/sun/star/sheet/XCellFormatRangesSupplier.hpp> +#include <com/sun/star/sheet/XUniqueCellFormatRangesSupplier.hpp> +#include <com/sun/star/sheet/XCellRangesQuery.hpp> +#include <com/sun/star/sheet/XSheetFilterableEx.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/sheet/XSheetPageBreak.hpp> +#include <com/sun/star/sheet/XCellRangeMovement.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/sheet/XPrintAreas.hpp> +#include <com/sun/star/sheet/XSheetLinkable.hpp> +#include <com/sun/star/sheet/XSubTotalCalculatable.hpp> +#include <com/sun/star/sheet/XArrayFormulaRange.hpp> +#include <com/sun/star/sheet/XCellRangeData.hpp> +#include <com/sun/star/sheet/XCellRangeFormula.hpp> +#include <com/sun/star/sheet/XCellSeries.hpp> +#include <com/sun/star/sheet/XMultipleOperation.hpp> +#include <com/sun/star/sheet/XFormulaTokens.hpp> +#include <com/sun/star/sheet/XArrayFormulaTokens.hpp> +#include <com/sun/star/sheet/XCellAddressable.hpp> +#include <com/sun/star/util/XReplaceable.hpp> +#include <com/sun/star/util/XIndent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/util/XMergeable.hpp> +#include <com/sun/star/table/XAutoFormattable.hpp> +#include <com/sun/star/util/XSortable.hpp> +#include <com/sun/star/util/XImportable.hpp> +#include <com/sun/star/table/XColumnRowRange.hpp> +#include <com/sun/star/table/BorderLine.hpp> +#include <com/sun/star/table/TableBorder.hpp> +#include <com/sun/star/sheet/XDataPilotTablesSupplier.hpp> +#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp> +#include <com/sun/star/sheet/XScenariosSupplier.hpp> +#include <com/sun/star/sheet/XSheetAnnotationsSupplier.hpp> +#include <com/sun/star/sheet/XSheetAuditing.hpp> +#include <com/sun/star/sheet/XSheetOutline.hpp> +#include <com/sun/star/util/XProtectable.hpp> +#include <com/sun/star/sheet/XScenario.hpp> +#include <com/sun/star/sheet/XScenarioEnhanced.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/document/XActionLockable.hpp> +#include <com/sun/star/beans/XTolerantMultiPropertySet.hpp> +#include <com/sun/star/sheet/XExternalSheetName.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> + +#ifndef __SGI_STL_VECTOR +#include <vector> +#endif + +class ScDocShell; +class ScMarkData; +class ScMemChart; +class ScPrintRangeSaver; +class ScAttrRectIterator; +class ScCellRangeObj; +class SvxUnoText; +class ScLinkListener; +class ScPatternAttr; +class SvxBoxItem; +class SvxBoxInfoItem; +class SvxItemPropertySet; + +namespace editeng { class SvxBorderLine; } + +class ScLinkListener : public SvtListener +{ + Link aLink; +public: + ScLinkListener(const Link& rL) : aLink(rL) {} + virtual ~ScLinkListener(); + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); +}; + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >* XModifyListenerPtr; +SV_DECL_PTRARR_DEL( XModifyListenerArr_Impl, XModifyListenerPtr, 4, 4 ) + +class ScNamedEntry; +typedef ScNamedEntry* ScNamedEntryPtr; +SV_DECL_PTRARR_DEL( ScNamedEntryArr_Impl, ScNamedEntryPtr, 4, 4 ) + + +// ScCellRangesBase - base class for ScCellRangesObj (with access by index) +// and ScCellRangeObj (without access by index) + +// XServiceInfo is implemented in derived classes + +class ScHelperFunctions +{ +public: + static const ::editeng::SvxBorderLine* GetBorderLine( ::editeng::SvxBorderLine& rLine, const com::sun::star::table::BorderLine& rStruct ); + static void FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const com::sun::star::table::TableBorder& rBorder ); + static void FillBorderLine( com::sun::star::table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine ); + static void FillTableBorder( com::sun::star::table::TableBorder& rBorder, + const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner ); + static void ApplyBorder( ScDocShell* pDocShell, const ScRangeList& rRanges, + const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner ); +}; + +namespace ooo +{ + namespace vba { + namespace excel { + class ScVbaCellRangeAccess; // Vba Helper class + } + } +} + +class SC_DLLPUBLIC ScCellRangesBase : public com::sun::star::beans::XPropertySet, + public com::sun::star::beans::XMultiPropertySet, + public com::sun::star::beans::XPropertyState, + public com::sun::star::sheet::XSheetOperation, + public com::sun::star::chart::XChartDataArray, + public com::sun::star::util::XIndent, + public com::sun::star::sheet::XCellRangesQuery, + public com::sun::star::sheet::XFormulaQuery, + public com::sun::star::util::XReplaceable, + public com::sun::star::util::XModifyBroadcaster, + public com::sun::star::lang::XServiceInfo, + public com::sun::star::lang::XUnoTunnel, + public com::sun::star::lang::XTypeProvider, + public com::sun::star::beans::XTolerantMultiPropertySet, + public cppu::OWeakObject, + public SfxListener +{ + friend class ScTabViewObj; // for select() + friend class ScTableSheetObj; // for createCursorByRange() + friend class ooo::vba::excel::ScVbaCellRangeAccess; + +private: + const SfxItemPropertySet* pPropSet; + ScDocShell* pDocShell; + ScLinkListener* pValueListener; + ScPatternAttr* pCurrentFlat; + ScPatternAttr* pCurrentDeep; + SfxItemSet* pCurrentDataSet; + SfxItemSet* pNoDfltCurrentDataSet; + ScMarkData* pMarkData; + ScRangeList aRanges; + sal_Int64 nObjectId; + sal_Bool bChartColAsHdr; + sal_Bool bChartRowAsHdr; + sal_Bool bCursorOnly; + sal_Bool bGotDataChangedHint; + XModifyListenerArr_Impl aValueListeners; + + DECL_LINK( ValueListenerHdl, SfxHint* ); + +private: + void PaintRanges_Impl( sal_uInt16 nPart ); + ScRangeListRef GetLimitedChartRanges_Impl( long nDataColumns, long nDataRows ) const; + void ForceChartListener_Impl(); + ScMemChart* CreateMemChart_Impl() const; + + const ScPatternAttr* GetCurrentAttrsFlat(); + const ScPatternAttr* GetCurrentAttrsDeep(); + SfxItemSet* GetCurrentDataSet(bool bNoDflt = false); + void ForgetMarkData(); + void ForgetCurrentAttrs(); + + com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRanges> + QueryDifferences_Impl(const com::sun::star::table::CellAddress& aCompare, + sal_Bool bColumnDiff); + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> + Find_Impl(const com::sun::star::uno::Reference< + com::sun::star::util::XSearchDescriptor>& xDesc, + const ScAddress* pLastPos); + +protected: + const ScMarkData* GetMarkData(); + + // GetItemPropertyMap for derived classes must contain all entries, including base class + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual ::com::sun::star::beans::PropertyState GetOnePropertyState( + sal_uInt16 nItemWhich, const SfxItemPropertySimpleEntry* pEntry ); + virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + ::com::sun::star::uno::Any& ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + +public: + ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR); + ScCellRangesBase(ScDocShell* pDocSh, const ScRangeList& rR); + virtual ~ScCellRangesBase(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void RefChanged(); + + // from derived classes and by getImplementation + ScDocShell* GetDocShell() const { return pDocShell; } + ScDocument* GetDocument() const; + const ScRangeList& GetRangeList() const { return aRanges; } + void AddRange(const ScRange& rRange, const sal_Bool bMergeRanges); + + // arouse object created via service: + void InitInsertRange(ScDocShell* pDocSh, const ScRange& rR); + + void SetNewRange(const ScRange& rNew); // for cursor + void SetNewRanges(const ScRangeList& rNew); + + void SetCursorOnly(sal_Bool bSet); + sal_Bool IsCursorOnly() const { return bCursorOnly; } + + // XSheetOperation + virtual double SAL_CALL computeFunction( ::com::sun::star::sheet::GeneralFunction nFunction ) + throw(::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearContents( sal_Int32 nContentFlags ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw (::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL + getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XTolerantMultiPropertySet + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::SetPropertyTolerantFailed > SAL_CALL + setPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetPropertyTolerantResult > SAL_CALL + getPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::GetDirectPropertyTolerantResult > SAL_CALL + getDirectPropertyValuesTolerant( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL + getPropertyStates( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( + const ::rtl::OUString& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XIndent + virtual void SAL_CALL decrementIndent() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL incrementIndent() throw(::com::sun::star::uno::RuntimeException); + + // XChartData + virtual void SAL_CALL addChartDataChangeEventListener( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart::XChartDataChangeEventListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getNotANumber() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isNotANumber( double nNumber ) + throw(::com::sun::star::uno::RuntimeException); + + // XChartDataArray + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< double > > SAL_CALL + getData() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< double > >& aData ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getRowDescriptions() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aRowDescriptions ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getColumnDescriptions() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aColumnDescriptions ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangesQuery + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryVisibleCells() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryEmptyCells() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryContentCells( sal_Int16 nContentFlags ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryFormulaCells( sal_Int32 nResultFlags ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryColumnDifferences( + const ::com::sun::star::table::CellAddress& aCompare ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryRowDifferences( + const ::com::sun::star::table::CellAddress& aCompare ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryIntersection( + const ::com::sun::star::table::CellRangeAddress& aRange ) + throw(::com::sun::star::uno::RuntimeException); + + // XFormulaQuery + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryDependents( sal_Bool bRecursive ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellRanges > SAL_CALL + queryPrecedents( sal_Bool bRecursive ) + throw(::com::sun::star::uno::RuntimeException); + + // XSearchable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XSearchDescriptor > SAL_CALL + createSearchDescriptor() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + findAll( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XSearchDescriptor >& xDesc ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + findFirst( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XSearchDescriptor >& xDesc ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + findNext( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& xStartAt, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XSearchDescriptor >& xDesc ) + throw(::com::sun::star::uno::RuntimeException); + + // XReplaceable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XReplaceDescriptor > SAL_CALL + createReplaceDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL replaceAll( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XSearchDescriptor >& xDesc ) + throw(::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScCellRangesBase* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class SC_DLLPUBLIC ScCellRangesObj : public ScCellRangesBase, + public com::sun::star::sheet::XSheetCellRangeContainer, + public com::sun::star::container::XNameContainer, + public com::sun::star::container::XEnumerationAccess +{ +private: + ScNamedEntryArr_Impl aNamedEntries; + + ScCellRangeObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const; + +public: + ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR); + virtual ~ScCellRangesObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void RefChanged(); + + // XSheetCellRanges + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL + getCells() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getRangeAddressesAsString() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL + getRangeAddresses() throw(::com::sun::star::uno::RuntimeException); + + // XSheetCellRangeContainer + virtual void SAL_CALL addRangeAddress( const ::com::sun::star::table::CellRangeAddress& rRange, + sal_Bool bMergeRanges ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRangeAddress( const ::com::sun::star::table::CellRangeAddress& rRange ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRangeAddresses( const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& rRanges, + sal_Bool bMergeRanges ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRangeAddresses( const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& rRanges ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class SC_DLLPUBLIC ScCellRangeObj : public ScCellRangesBase, + public com::sun::star::sheet::XCellRangeAddressable, + public com::sun::star::sheet::XSheetCellRange, + public com::sun::star::sheet::XArrayFormulaRange, + public com::sun::star::sheet::XArrayFormulaTokens, + public com::sun::star::sheet::XCellRangeData, + public com::sun::star::sheet::XCellRangeFormula, + public com::sun::star::sheet::XMultipleOperation, + public com::sun::star::util::XMergeable, + public com::sun::star::sheet::XCellSeries, + public com::sun::star::table::XAutoFormattable, + public com::sun::star::util::XSortable, + public com::sun::star::sheet::XSheetFilterableEx, + public com::sun::star::sheet::XSubTotalCalculatable, + public com::sun::star::util::XImportable, + public com::sun::star::sheet::XCellFormatRangesSupplier, + public com::sun::star::sheet::XUniqueCellFormatRangesSupplier, + public com::sun::star::table::XColumnRowRange +{ +private: + const SfxItemPropertySet* pRangePropSet; + ScRange aRange; + +protected: + const ScRange& GetRange() const { return aRange; } + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + ::com::sun::star::uno::Any& ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > + GetCellByPosition_Impl( sal_Int32 nColumn, sal_Int32 nRow ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + void SetArrayFormula_Impl( const rtl::OUString& rFormula, + const rtl::OUString& rFormulaNmsp, + const formula::FormulaGrammar::Grammar eGrammar ) + throw(::com::sun::star::uno::RuntimeException); + +public: + ScCellRangeObj(ScDocShell* pDocSh, const ScRange& rR); + virtual ~ScCellRangeObj(); + + // uses ObjectShell from document, if set (returns NULL otherwise) + static com::sun::star::uno::Reference<com::sun::star::table::XCellRange> + CreateRangeFromDoc( ScDocument* pDoc, const ScRange& rR ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void RefChanged(); + + // via getImplementation() + virtual void SetArrayFormulaWithGrammar( const ::rtl::OUString& rFormula, + const ::rtl::OUString& rFormulaNmsp, + const formula::FormulaGrammar::Grammar ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangeAddressable + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getRangeAddress() + throw(::com::sun::star::uno::RuntimeException); + + // XSheetCellRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL + getSpreadsheet() throw(::com::sun::star::uno::RuntimeException); + + // XArrayFormulaRange + virtual ::rtl::OUString SAL_CALL getArrayFormula() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArrayFormula( const ::rtl::OUString& aFormula ) + throw(::com::sun::star::uno::RuntimeException); + + // XArrayFormulaTokens + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getArrayTokens() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setArrayTokens( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::FormulaToken >& aTokens ) + throw (::com::sun::star::uno::RuntimeException); + + // XCellRangeData + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any > > SAL_CALL getDataArray() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDataArray( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any > >& aArray ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangeFormula + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< + ::rtl::OUString > > SAL_CALL getFormulaArray() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormulaArray( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aArray ) + throw (::com::sun::star::uno::RuntimeException); + + // XMultipleOperation + virtual void SAL_CALL setTableOperation( + const ::com::sun::star::table::CellRangeAddress& aFormulaRange, + ::com::sun::star::sheet::TableOperationMode nMode, + const ::com::sun::star::table::CellAddress& aColumnCell, + const ::com::sun::star::table::CellAddress& aRowCell ) + throw(::com::sun::star::uno::RuntimeException); + + // XMergeable + virtual void SAL_CALL merge( sal_Bool bMerge ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getIsMerged() throw(::com::sun::star::uno::RuntimeException); + + // XCellSeries + virtual void SAL_CALL fillSeries( ::com::sun::star::sheet::FillDirection nFillDirection, + ::com::sun::star::sheet::FillMode nFillMode, + ::com::sun::star::sheet::FillDateMode nFillDateMode, + double fStep, double fEndValue ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL fillAuto( ::com::sun::star::sheet::FillDirection nFillDirection, + sal_Int32 nSourceCount ) + throw(::com::sun::star::uno::RuntimeException); + + // XAutoFormattable + virtual void SAL_CALL autoFormat( const ::rtl::OUString& aName ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XSortable + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + createSortDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL sort( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xDescriptor ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetFilterableEx + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL + createFilterDescriptorByObject( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSheetFilterable >& xObject ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetFilterable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL + createFilterDescriptor( sal_Bool bEmpty ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL filter( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSheetFilterDescriptor >& xDescriptor ) + throw(::com::sun::star::uno::RuntimeException); + + // XSubTotalCalculatable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSubTotalDescriptor > SAL_CALL + createSubTotalDescriptor( sal_Bool bEmpty ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL applySubTotals( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSubTotalDescriptor >& xDescriptor, + sal_Bool bReplace ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSubTotals() throw(::com::sun::star::uno::RuntimeException); + + // XImportable + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + createImportDescriptor( sal_Bool bEmpty ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL doImport( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aDescriptor ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellFormatRangesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getCellFormatRanges() throw(::com::sun::star::uno::RuntimeException); + + // XUniqueCellFormatRangesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getUniqueCellFormatRanges() throw(::com::sun::star::uno::RuntimeException); + + // XColumnRowRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableColumns > SAL_CALL + getColumns() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableRows > SAL_CALL + getRows() throw(::com::sun::star::uno::RuntimeException); + + // XCellRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL + getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, + sal_Int32 nRight, sal_Int32 nBottom ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getCellRangeByName( const ::rtl::OUString& aRange ) + throw(::com::sun::star::uno::RuntimeException); + ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > + getCellRangeByName( const ::rtl::OUString& aRange, const ScAddress::Details& rDetails ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet overloaded due to Range-Properties + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +//! really derive cell from range? + +class SC_DLLPUBLIC ScCellObj : public ScCellRangeObj, + public com::sun::star::text::XText, + public com::sun::star::container::XEnumerationAccess, + public com::sun::star::table::XCell, + public com::sun::star::sheet::XFormulaTokens, + public com::sun::star::sheet::XCellAddressable, + public com::sun::star::sheet::XSheetAnnotationAnchor, + public com::sun::star::text::XTextFieldsSupplier, + public com::sun::star::document::XActionLockable +{ +private: + SvxUnoText* pUnoText; + const SfxItemPropertySet* pCellPropSet; + ScAddress aCellPos; + sal_Int16 nActionLockCount; + +private: + String GetInputString_Impl(sal_Bool bEnglish) const; + String GetOutputString_Impl() const; + void SetString_Impl(const String& rString, sal_Bool bInterpret, sal_Bool bEnglish); + double GetValue_Impl() const; + void SetValue_Impl(double fValue); + com::sun::star::table::CellContentType GetResultType_Impl(); + +protected: + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + ::com::sun::star::uno::Any& ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + +public: + static const SvxItemPropertySet* GetEditPropertySet(); + static const SfxItemPropertyMap* GetCellPropertyMap(); + + ScCellObj(ScDocShell* pDocSh, const ScAddress& rP); + virtual ~ScCellObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void RefChanged(); + + SvxUnoText& GetUnoText(); + + // XML import needs to set results at formula cells, + // not meant for any other purpose. + void SetFormulaResultString( const ::rtl::OUString& rResult ); + void SetFormulaResultDouble( double fResult ); + void SetFormulaWithGrammar( const ::rtl::OUString& rFormula, + const ::rtl::OUString& rFormulaNmsp, const formula::FormulaGrammar::Grammar ); + const ScAddress& GetPosition() const { return aCellPos; } + + void InputEnglishString( const ::rtl::OUString& rText ); + + // XText + virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent, + sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XSimpleText + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursorByRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& aTextPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::rtl::OUString& aString, sal_Bool bAbsorb ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XCell + virtual ::rtl::OUString SAL_CALL getFormula() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormula( const ::rtl::OUString& aFormula ) + throw(::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getValue() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setValue( double nValue ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellContentType SAL_CALL getType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getError() throw(::com::sun::star::uno::RuntimeException); + + // XFormulaTokens + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getTokens() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTokens( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::FormulaToken >& aTokens ) + throw (::com::sun::star::uno::RuntimeException); + + // XCellAddressable + virtual ::com::sun::star::table::CellAddress SAL_CALL getCellAddress() + throw(::com::sun::star::uno::RuntimeException); + + // XSheetAnnotationAnchor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetAnnotation > SAL_CALL + getAnnotation() throw(::com::sun::star::uno::RuntimeException); + + // XTextFieldsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL + getTextFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getTextFieldMasters() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet overloaded due to cell properties + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + + // XActionLockable + virtual sal_Bool SAL_CALL isActionLocked() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addActionLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL resetActionLocks() throw(::com::sun::star::uno::RuntimeException); + + static String GetOutputString_Impl(ScDocument* pDoc, const ScAddress& aPos); +}; + + +class ScTableSheetObj : public ScCellRangeObj, + public com::sun::star::sheet::XSpreadsheet, + public com::sun::star::container::XNamed, + public com::sun::star::sheet::XSheetPageBreak, + public com::sun::star::sheet::XCellRangeMovement, + public com::sun::star::table::XTableChartsSupplier, + public com::sun::star::sheet::XDataPilotTablesSupplier, + public com::sun::star::sheet::XScenariosSupplier, + public com::sun::star::sheet::XSheetAnnotationsSupplier, + public com::sun::star::drawing::XDrawPageSupplier, + public com::sun::star::sheet::XPrintAreas, + public com::sun::star::sheet::XSheetLinkable, + public com::sun::star::sheet::XSheetAuditing, + public com::sun::star::sheet::XSheetOutline, + public com::sun::star::util::XProtectable, + public com::sun::star::sheet::XScenario, + public com::sun::star::sheet::XScenarioEnhanced, + public com::sun::star::sheet::XExternalSheetName, + public com::sun::star::document::XEventsSupplier +{ + friend class ScTableSheetsObj; // for insertByName() + +private: + const SfxItemPropertySet* pSheetPropSet; + + SCTAB GetTab_Impl() const; + void PrintAreaUndo_Impl( ScPrintRangeSaver* pOldRanges ); + +protected: + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + ::com::sun::star::uno::Any& ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + +public: + ScTableSheetObj(ScDocShell* pDocSh, SCTAB nTab); + virtual ~ScTableSheetObj(); + + void InitInsertSheet(ScDocShell* pDocSh, SCTAB nTab); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XSpreadsheet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellCursor > + SAL_CALL createCursor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetCellCursor > SAL_CALL + createCursorByRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSheetCellRange >& aRange ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetCellRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL + getSpreadsheet() throw(::com::sun::star::uno::RuntimeException); + + // XCellRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL + getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, + sal_Int32 nRight, sal_Int32 nBottom ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + using ScCellRangeObj::getCellRangeByName; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getCellRangeByName( const ::rtl::OUString& aRange ) + throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetPageBreak + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TablePageBreakData > SAL_CALL + getColumnPageBreaks() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TablePageBreakData > SAL_CALL + getRowPageBreaks() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeAllManualPageBreaks() throw(::com::sun::star::uno::RuntimeException); + + // XCellRangeMovement + virtual void SAL_CALL insertCells( const ::com::sun::star::table::CellRangeAddress& aRange, + ::com::sun::star::sheet::CellInsertMode nMode ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRange( const ::com::sun::star::table::CellRangeAddress& aRange, + ::com::sun::star::sheet::CellDeleteMode nMode ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveRange( const ::com::sun::star::table::CellAddress& aDestination, + const ::com::sun::star::table::CellRangeAddress& aSource ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL copyRange( const ::com::sun::star::table::CellAddress& aDestination, + const ::com::sun::star::table::CellRangeAddress& aSource ) + throw(::com::sun::star::uno::RuntimeException); + + // XTableChartsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XTableCharts > SAL_CALL + getCharts() throw(::com::sun::star::uno::RuntimeException); + + // XDataPilotTablesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotTables > SAL_CALL + getDataPilotTables() throw(::com::sun::star::uno::RuntimeException); + + // XScenariosSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XScenarios > SAL_CALL + getScenarios() throw(::com::sun::star::uno::RuntimeException); + + // XSheetAnnotationsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetAnnotations > SAL_CALL + getAnnotations() throw(::com::sun::star::uno::RuntimeException); + + // XDrawPageSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL + getDrawPage() throw(::com::sun::star::uno::RuntimeException); + + // XPrintAreas + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL + getPrintAreas() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPrintAreas( const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& aPrintAreas ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getPrintTitleColumns() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPrintTitleColumns( sal_Bool bPrintTitleColumns ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getTitleColumns() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTitleColumns( + const ::com::sun::star::table::CellRangeAddress& aTitleColumns ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getPrintTitleRows() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPrintTitleRows( sal_Bool bPrintTitleRows ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getTitleRows() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTitleRows( + const ::com::sun::star::table::CellRangeAddress& aTitleRows ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetLinkable + virtual ::com::sun::star::sheet::SheetLinkMode SAL_CALL getLinkMode() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLinkMode( ::com::sun::star::sheet::SheetLinkMode nLinkMode ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLinkUrl() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLinkUrl( const ::rtl::OUString& aLinkUrl ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getLinkSheetName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLinkSheetName( const ::rtl::OUString& aLinkSheetName ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL link( const ::rtl::OUString& aUrl, + const ::rtl::OUString& aSheetName, + const ::rtl::OUString& aFilterName, + const ::rtl::OUString& aFilterOptions, + ::com::sun::star::sheet::SheetLinkMode nMode ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetAuditing + virtual sal_Bool SAL_CALL hideDependents( const ::com::sun::star::table::CellAddress& aPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hidePrecedents( const ::com::sun::star::table::CellAddress& aPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL showDependents( const ::com::sun::star::table::CellAddress& aPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL showPrecedents( const ::com::sun::star::table::CellAddress& aPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL showErrors( const ::com::sun::star::table::CellAddress& aPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL showInvalid() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearArrows() throw(::com::sun::star::uno::RuntimeException); + + // XSheetOutline + virtual void SAL_CALL group( const ::com::sun::star::table::CellRangeAddress& aRange, + ::com::sun::star::table::TableOrientation nOrientation ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL ungroup( const ::com::sun::star::table::CellRangeAddress& aRange, + ::com::sun::star::table::TableOrientation nOrientation ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL autoOutline( const ::com::sun::star::table::CellRangeAddress& aRange ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clearOutline() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL hideDetail( const ::com::sun::star::table::CellRangeAddress& aRange ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL showDetail( const ::com::sun::star::table::CellRangeAddress& aRange ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL showLevel( sal_Int16 nLevel, + ::com::sun::star::table::TableOrientation nOrientation ) + throw(::com::sun::star::uno::RuntimeException); + + // XProtectable + virtual void SAL_CALL protect( const ::rtl::OUString& aPassword ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unprotect( const ::rtl::OUString& aPassword ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isProtected() throw(::com::sun::star::uno::RuntimeException); + + // XScenario + virtual sal_Bool SAL_CALL getIsScenario() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getScenarioComment() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setScenarioComment( const ::rtl::OUString& aScenarioComment ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRanges( const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& aRanges ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL apply() throw(::com::sun::star::uno::RuntimeException); + // XScenarioEnhanced + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL + getRanges( ) + throw(::com::sun::star::uno::RuntimeException); + + // XExternalSheetName + virtual void SAL_CALL setExternalName( const ::rtl::OUString& aUrl, const ::rtl::OUString& aSheetName ) + throw (::com::sun::star::container::ElementExistException, + ::com::sun::star::uno::RuntimeException); + + // XEventsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents() + throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet overloaded due to sheet properties + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScTableSheetObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScTableColumnObj : public ScCellRangeObj, + public com::sun::star::container::XNamed +{ +private: + const SfxItemPropertySet* pColPropSet; + +protected: + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + ::com::sun::star::uno::Any& ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + +public: + ScTableColumnObj(ScDocShell* pDocSh, SCCOL nCol, SCTAB nTab); + virtual ~ScTableColumnObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet overloaded due to column properties + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScTableRowObj : public ScCellRangeObj +{ +private: + const SfxItemPropertySet* pRowPropSet; + +protected: + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual void GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + ::com::sun::star::uno::Any& ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + +public: + ScTableRowObj(ScDocShell* pDocSh, SCROW nRow, SCTAB nTab); + virtual ~ScTableRowObj(); + + // XPropertySet overloaded due to row properties + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScCellsObj : public cppu::WeakImplHelper2< + com::sun::star::container::XEnumerationAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScRangeList aRanges; + +public: + ScCellsObj(ScDocShell* pDocSh, const ScRangeList& rR); + virtual ~ScCellsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScCellsEnumeration : public cppu::WeakImplHelper2< + com::sun::star::container::XEnumeration, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScRangeList aRanges; + ScAddress aPos; + ScMarkData* pMark; + sal_Bool bAtEnd; + +private: + void Advance_Impl(); + void CheckPos_Impl(); + +public: + ScCellsEnumeration(ScDocShell* pDocSh, const ScRangeList& rR); + virtual ~ScCellsEnumeration(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement() + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +class ScCellFormatsObj : public cppu::WeakImplHelper3< + com::sun::star::container::XIndexAccess, + com::sun::star::container::XEnumerationAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScRange aTotalRange; + +private: + ScCellRangeObj* GetObjectByIndex_Impl(long nIndex) const; + +public: + ScCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR); + virtual ~ScCellFormatsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScCellFormatsEnumeration : public cppu::WeakImplHelper2< + com::sun::star::container::XEnumeration, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; + ScAttrRectIterator* pIter; + ScRange aNext; + sal_Bool bAtEnd; + sal_Bool bDirty; + +private: + void Advance_Impl(); + ScCellRangeObj* NextObject_Impl(); + +public: + ScCellFormatsEnumeration(ScDocShell* pDocSh, const ScRange& rR); + virtual ~ScCellFormatsEnumeration(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement() + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +typedef std::vector< ScRangeList > ScMyRangeLists; + +class ScUniqueCellFormatsObj : public cppu::WeakImplHelper3< + com::sun::star::container::XIndexAccess, + com::sun::star::container::XEnumerationAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScRange aTotalRange; + ScMyRangeLists aRangeLists; + +private: + void GetObjects_Impl(); + +public: + ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rR); + virtual ~ScUniqueCellFormatsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +class ScUniqueCellFormatsEnumeration : public cppu::WeakImplHelper2< + com::sun::star::container::XEnumeration, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScMyRangeLists aRangeLists; + ScDocShell* pDocShell; + sal_Int32 nCurrentPosition; + +public: + ScUniqueCellFormatsEnumeration(ScDocShell* pDocShell, const ScMyRangeLists& rRangeLists); + virtual ~ScUniqueCellFormatsEnumeration(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement() + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/cfgids.hxx b/sc/inc/cfgids.hxx new file mode 100644 index 000000000000..d428f03f456e --- /dev/null +++ b/sc/inc/cfgids.hxx @@ -0,0 +1,43 @@ +/* -*- 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. + * + ************************************************************************/ +#ifndef _CFGID_HXX +#define _CFGID_HXX + +#define SCCFG_DOC SFX_ITEMTYPE_SC_BEGIN +#define SCCFG_VIEW (SFX_ITEMTYPE_SC_BEGIN + 1) +#define SCCFG_APP (SFX_ITEMTYPE_SC_BEGIN + 2) +#define SCCFG_SPELLCHECK (SFX_ITEMTYPE_SC_BEGIN + 3) +#define SCCFG_PRINT (SFX_ITEMTYPE_SC_BEGIN + 4) +#define SCCFG_STATUSBAR (SFX_ITEMTYPE_SC_BEGIN + 5) +#define SCCFG_INPUT (SFX_ITEMTYPE_SC_BEGIN + 8) +#define SCCFG_NAVIPI (SFX_ITEMTYPE_SC_BEGIN + 9) + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx new file mode 100644 index 000000000000..705a7c328c6e --- /dev/null +++ b/sc/inc/chart2uno.hxx @@ -0,0 +1,611 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHART2UNO_HXX +#define SC_CHART2UNO_HXX + +#include "cellsuno.hxx" // for XModifyListenerArr_Impl / ScLinkListener +#include "rangelst.hxx" +#include "externalrefmgr.hxx" +#include "token.hxx" +#include "chartlis.hxx" + +#include <svl/lstner.hxx> +#include <com/sun/star/chart/ChartDataRowSource.hpp> +#include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <com/sun/star/chart2/data/XTextualDataSequence.hpp> +#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> +#include <com/sun/star/chart2/data/DataSequenceRole.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase6.hxx> +#include <cppuhelper/implbase7.hxx> +#include <rtl/ustring.hxx> +#include <svl/itemprop.hxx> + +#include <boost/unordered_set.hpp> +#include <list> +#include <vector> +#include <memory> +#include <boost/shared_ptr.hpp> + +#define USE_CHART2_EMPTYDATASEQUENCE 0 + +class ScDocument; + +// DataProvider ============================================================== + +class ScChart2DataProvider : public + ::cppu::WeakImplHelper4< + ::com::sun::star::chart2::data::XDataProvider, + ::com::sun::star::chart2::data::XRangeXMLConversion, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo>, + SfxListener +{ +public: + + explicit ScChart2DataProvider( ScDocument* pDoc ); + virtual ~ScChart2DataProvider(); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDataProvider --------------------------------------------------------- + + virtual ::sal_Bool SAL_CALL createDataSourcePossible( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( + const ::rtl::OUString& aRangeRepresentation ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( + const ::rtl::OUString& aRangeRepresentation ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection() + throw (::com::sun::star::uno::RuntimeException); + + // XRangeXMLConversion --------------------------------------------------- + + virtual ::rtl::OUString SAL_CALL convertRangeToXML( const ::rtl::OUString& sRangeRepresentation ) + throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); + + virtual ::rtl::OUString SAL_CALL convertRangeFromXML( const ::rtl::OUString& sXMLRange ) + throw ( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IllegalArgumentException ); + + // XPropertySet ---------------------------------------------------------- + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> SAL_CALL + getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rValue) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& rPropertyName) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& xListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo ---------------------------------------------------------- + + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( + ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& + rServiceName) throw( ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames() throw( + ::com::sun::star::uno::RuntimeException); + +private: + + ScDocument* m_pDocument; + SfxItemPropertySet m_aPropSet; + sal_Bool m_bIncludeHiddenCells; +}; + + +// DataSource ================================================================ + +class ScChart2DataSource : public + ::cppu::WeakImplHelper2< + ::com::sun::star::chart2::data::XDataSource, + ::com::sun::star::lang::XServiceInfo>, + SfxListener +{ +public: + + explicit ScChart2DataSource( ScDocument* pDoc); + virtual ~ScChart2DataSource(); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDataSource ----------------------------------------------------------- + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL + getDataSequences() throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo ---------------------------------------------------------- + + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( + ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& + rServiceName) throw( ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames() throw( + ::com::sun::star::uno::RuntimeException); + + // implementation + + void AddLabeledSequence(const com::sun::star::uno::Reference < com::sun::star::chart2::data::XLabeledDataSequence >& xNew); + +private: + + ScDocument* m_pDocument; + typedef std::list < com::sun::star::uno::Reference< com::sun::star::chart2::data::XLabeledDataSequence > > LabeledList; + LabeledList m_aLabeledSequences; + +}; + + +// DataSequence ============================================================== + +class ScChart2DataSequence : public + ::cppu::WeakImplHelper7< + ::com::sun::star::chart2::data::XDataSequence, + ::com::sun::star::chart2::data::XTextualDataSequence, + ::com::sun::star::chart2::data::XNumericalDataSequence, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::beans::XPropertySet, +// ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo>, + SfxListener +{ +public: + explicit ScChart2DataSequence( ScDocument* pDoc, + const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP, + ::std::vector<ScTokenRef>* pTokens, bool bIncludeHiddenCells ); + + virtual ~ScChart2DataSequence(); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDataSequence --------------------------------------------------------- + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > + SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + // XNumericalDataSequence -------------------------------------------------- + + virtual ::com::sun::star::uno::Sequence< double > + SAL_CALL getNumericalData( ) throw (::com::sun::star::uno::RuntimeException); + + // XTextualDataSequence -------------------------------------------------- + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > + SAL_CALL getTextualData( ) throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet ---------------------------------------------------------- + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> SAL_CALL + getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rValue) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& rPropertyName) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& xListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XCloneable ------------------------------------------------------------ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster ---------------------------------------------------- + + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo ---------------------------------------------------------- + + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( + ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& + rServiceName) throw( ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames() throw( + ::com::sun::star::uno::RuntimeException); + +private: + void setDataChangedHint(bool b); + + // Implementation -------------------------------------------------------- + + void RefChanged(); + DECL_LINK( ValueListenerHdl, SfxHint* ); + +private: + ScChart2DataSequence(); // disabled + ScChart2DataSequence(const ScChart2DataSequence& r); // disabled + + class ExternalRefListener : public ScExternalRefManager::LinkListener + { + public: + ExternalRefListener(ScChart2DataSequence& rParent, ScDocument* pDoc); + virtual ~ExternalRefListener(); + virtual void notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType); + void addFileId(sal_uInt16 nFileId); + void removeFileId(sal_uInt16 nFileId); + const ::boost::unordered_set<sal_uInt16>& getAllFileIds(); + + private: + ExternalRefListener(); + ExternalRefListener(const ExternalRefListener& r); + + ScChart2DataSequence& mrParent; + ::boost::unordered_set<sal_uInt16> maFileIds; + ScDocument* mpDoc; + }; + + /** + * Build an internal data array to cache the data ranges, and other + * information such as hidden values. + */ + void BuildDataCache(); + + void RebuildDataCache(); + + sal_Int32 FillCacheFromExternalRef(const ScTokenRef& pToken); + + void UpdateTokensFromRanges(const ScRangeList& rRanges); + + ExternalRefListener* GetExtRefListener(); + + void StopListeningToAllExternalRefs(); + + void CopyData(const ScChart2DataSequence& r); + +private: + + // data array + struct Item + { + double mfValue; + ::rtl::OUString maString; + bool mbIsValue; + Item(); + }; + + class HiddenRangeListener : public ScChartHiddenRangeListener + { + public: + HiddenRangeListener(ScChart2DataSequence& rParent); + virtual ~HiddenRangeListener(); + + virtual void notify(); + + private: + ScChart2DataSequence& mrParent; + }; + + ::std::list<Item> m_aDataArray; + + /** + * Cached data for getData. We may also need to cache data for the + * numerical and textural data series if they turn out to be bottlenecks + * under certain scenarios. + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aMixedDataCache; + + ::com::sun::star::uno::Sequence<sal_Int32> m_aHiddenValues; + + // properties + ::com::sun::star::chart2::data::DataSequenceRole m_aRole; + sal_Bool m_bIncludeHiddenCells; + + // internals + typedef ::std::auto_ptr< ::std::vector<ScTokenRef> > TokenListPtr; + typedef ::std::auto_ptr< ::std::vector<sal_uInt32> > RangeIndexMapPtr; + typedef ::std::auto_ptr<ExternalRefListener> ExtRefListenerPtr; + + sal_Int64 m_nObjectId; + ScDocument* m_pDocument; + TokenListPtr m_pTokens; + RangeIndexMapPtr m_pRangeIndices; + ExtRefListenerPtr m_pExtRefListener; + com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider; + SfxItemPropertySet m_aPropSet; + + ::std::auto_ptr<HiddenRangeListener> m_pHiddenListener; + ScLinkListener* m_pValueListener; + XModifyListenerArr_Impl m_aValueListeners; + + bool m_bGotDataChangedHint; + bool m_bExtDataRebuildQueued; +}; + +#if USE_CHART2_EMPTYDATASEQUENCE +// DataSequence ============================================================== + +class ScChart2EmptyDataSequence : public + ::cppu::WeakImplHelper6< + ::com::sun::star::chart2::data::XDataSequence, + ::com::sun::star::chart2::data::XTextualDataSequence, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::beans::XPropertySet, +// ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo>, + SfxListener +{ +public: + + explicit ScChart2EmptyDataSequence( ScDocument* pDoc, + const com::sun::star::uno::Reference< com::sun::star::chart2::data::XDataProvider >& xDP, + const ScRangeListRef& rRangeList, sal_Bool bColumn ); + virtual ~ScChart2EmptyDataSequence(); + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDataSequence --------------------------------------------------------- + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > + SAL_CALL getData() throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > + SAL_CALL generateLabel(::com::sun::star::chart2::data::LabelOrigin nOrigin) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + // XTextualDataSequence -------------------------------------------------- + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > + SAL_CALL getTextualData( ) throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet ---------------------------------------------------------- + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo> SAL_CALL + getPropertySetInfo() throw( ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL setPropertyValue( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rValue) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& rPropertyName) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addPropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& xListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removePropertyChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL addVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL removeVetoableChangeListener( + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener>& rListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XCloneable ------------------------------------------------------------ + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster ---------------------------------------------------- + + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo ---------------------------------------------------------- + + virtual ::rtl::OUString SAL_CALL getImplementationName() throw( + ::com::sun::star::uno::RuntimeException); + + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& + rServiceName) throw( ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL + getSupportedServiceNames() throw( + ::com::sun::star::uno::RuntimeException); + + // Implementation -------------------------------------------------------- + + ScRangeListRef GetRangeList() { return m_xRanges; } + +private: + + // properties + ::com::sun::star::chart2::data::DataSequenceRole m_aRole; + sal_Bool m_bIncludeHiddenCells; + // internals + ScRangeListRef m_xRanges; + ScDocument* m_pDocument; + com::sun::star::uno::Reference < com::sun::star::chart2::data::XDataProvider > m_xDataProvider; + SfxItemPropertySet m_aPropSet; + sal_Bool m_bColumn; // defines the orientation to create the right labels + +}; +#endif + +#endif // SC_CHART2UNO_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx new file mode 100644 index 000000000000..6b223dd715e5 --- /dev/null +++ b/sc/inc/chartarr.hxx @@ -0,0 +1,129 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHARTARR_HXX +#define SC_CHARTARR_HXX + +// ----------------------------------------------------------------------- + +#include "collect.hxx" +#include "rangelst.hxx" +#include "chartpos.hxx" + +class ScAddress; +class Table; +class ScDocument; + + +// ScMemChart is a stripped-down SchMemChart from old chart, +// used only to transport a rectangular data array for the UNO API, +// contains only column/row header text and data values. + +class ScMemChart +{ + short nRowCnt; + short nColCnt; + double* pData; + String* pColText; + String* pRowText; + + ScMemChart(const ScMemChart& rMemChart); // not implemented + +public: + ScMemChart(short nCols, short nRows); + ~ScMemChart(); + + short GetColCount() const { return nColCnt; } + short GetRowCount() const { return nRowCnt; } + const String& GetColText(short nCol) const { return pColText[nCol]; } + const String& GetRowText(short nRow) const { return pRowText[nRow]; } + double GetData(short nCol, short nRow) const { return pData[nCol * nRowCnt + nRow]; } + void SetData(short nCol, short nRow, const double& rVal) { pData[nCol * nRowCnt + nRow] = rVal; } + void SetColText(short nCol, const String& rText) { pColText[nCol] = rText; } + void SetRowText(short nRow, const String& rText) { pRowText[nRow] = rText; } +}; + + +class SC_DLLPUBLIC ScChartArray : public ScDataObject // only parameter-struct +{ + String aName; + ScDocument* pDocument; + ScChartPositioner aPositioner; + sal_Bool bValid; // for creation out of SchMemChart + +private: + ScMemChart* CreateMemChartSingle(); + ScMemChart* CreateMemChartMulti(); +public: + ScChartArray( ScDocument* pDoc, SCTAB nTab, + SCCOL nStartColP, SCROW nStartRowP, + SCCOL nEndColP, SCROW nEndRowP, + const String& rChartName ); + ScChartArray( ScDocument* pDoc, const ScRangeListRef& rRangeList, + const String& rChartName ); + ScChartArray( const ScChartArray& rArr ); + + virtual ~ScChartArray(); + virtual ScDataObject* Clone() const; + + const ScRangeListRef& GetRangeList() const { return aPositioner.GetRangeList(); } + void SetRangeList( const ScRangeListRef& rNew ) { aPositioner.SetRangeList(rNew); } + void SetRangeList( const ScRange& rNew ) { aPositioner.SetRangeList(rNew); } + const ScChartPositionMap* GetPositionMap() { return aPositioner.GetPositionMap(); } + + void SetHeaders(sal_Bool bCol, sal_Bool bRow) { aPositioner.SetHeaders(bCol, bRow); } + sal_Bool HasColHeaders() const { return aPositioner.HasColHeaders(); } + sal_Bool HasRowHeaders() const { return aPositioner.HasRowHeaders(); } + sal_Bool IsValid() const { return bValid; } + void SetName(const String& rNew) { aName = rNew; } + const String& GetName() const { return aName; } + + sal_Bool operator==(const ScChartArray& rCmp) const; + + ScMemChart* CreateMemChart(); +}; + +class ScChartCollection : public ScCollection +{ +public: + ScChartCollection() : ScCollection( 4,4 ) {} + ScChartCollection( const ScChartCollection& rColl ): + ScCollection( rColl ) {} + + virtual ScDataObject* Clone() const; + ScChartArray* operator[](sal_uInt16 nIndex) const + { return (ScChartArray*)At(nIndex); } + + sal_Bool operator==(const ScChartCollection& rCmp) const; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx new file mode 100644 index 000000000000..7c465945d37d --- /dev/null +++ b/sc/inc/charthelper.hxx @@ -0,0 +1,67 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHARTHELPER_HXX +#define SC_CHARTHELPER_HXX + +#include <tools/solar.h> +#include "address.hxx" +#include "global.hxx" +#include "rangelst.hxx" + +#include <com/sun/star/chart2/XChartDocument.hpp> + +class SdrObject; +class SdrPage; +class ScModelObj; + +typedef ::std::vector< ScRangeList > ScRangeListVector; + +/** Use this to handle charts in a calc document +*/ +class ScChartHelper +{ +public: + static sal_uInt16 DoUpdateAllCharts( ScDocument* pDoc ); + static void AdjustRangesOfChartsOnDestinationPage( ScDocument* pSrcDoc, ScDocument* pDestDoc, const SCTAB nSrcTab, const SCTAB nDestTab ); + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartFromSdrObject( SdrObject* pObject ); + static void GetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, + ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges ); + static void SetChartRanges( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, + const ::com::sun::star::uno::Sequence< rtl::OUString >& rRanges ); + + static void AddRangesIfProtectedChart( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrObject* pObject ); + static void FillProtectedChartRangesVector( ScRangeListVector& rRangesVector, ScDocument* pDocument, SdrPage* pPage ); + static void GetChartNames( ::std::vector< ::rtl::OUString >& rChartNames, SdrPage* pPage ); + static void CreateProtectedChartListenersAndNotify( ScDocument* pDoc, SdrPage* pPage, ScModelObj* pModelObj, SCTAB nTab, + const ScRangeListVector& rRangesVector, const ::std::vector< ::rtl::OUString >& rExcludedChartNames, bool bSameDoc = true ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx new file mode 100644 index 000000000000..fef859f4b7de --- /dev/null +++ b/sc/inc/chartlis.hxx @@ -0,0 +1,220 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHARTLIS_HXX +#define SC_CHARTLIS_HXX + + +#include <vcl/timer.hxx> +#include <svl/listener.hxx> +#include "collect.hxx" +#include "rangelst.hxx" +#include "token.hxx" +#include "externalrefmgr.hxx" + +#include <memory> +#include <vector> +#include <list> +#include <boost/unordered_set.hpp> + +class ScDocument; +class ScChartUnoData; +#include <com/sun/star/chart/XChartData.hpp> +#include <com/sun/star/chart/XChartDataChangeEventListener.hpp> + +class SC_DLLPUBLIC ScChartListener : public StrData, public SvtListener +{ +public: + class ExternalRefListener : public ScExternalRefManager::LinkListener + { + public: + ExternalRefListener(ScChartListener& rParent, ScDocument* pDoc); + virtual ~ExternalRefListener(); + virtual void notify(sal_uInt16 nFileId, ScExternalRefManager::LinkUpdateType eType); + void addFileId(sal_uInt16 nFileId); + void removeFileId(sal_uInt16 nFileId); + ::boost::unordered_set<sal_uInt16>& getAllFileIds(); + + private: + ExternalRefListener(); + ExternalRefListener(const ExternalRefListener& r); + + ScChartListener& mrParent; + ::boost::unordered_set<sal_uInt16> maFileIds; + ScDocument* mpDoc; + }; + +private: + + ::std::auto_ptr<ExternalRefListener> mpExtRefListener; + ::std::auto_ptr< ::std::vector<ScTokenRef> > mpTokens; + + ScChartUnoData* pUnoData; + ScDocument* pDoc; + sal_Bool bUsed; // for ScChartListenerCollection::FreeUnused + sal_Bool bDirty; + sal_Bool bSeriesRangesScheduled; + + // not implemented + ScChartListener& operator=( const ScChartListener& ); + +public: + ScChartListener( const String& rName, ScDocument* pDoc, + const ScRange& rRange ); + ScChartListener( const String& rName, ScDocument* pDoc, + const ScRangeListRef& rRangeListRef ); + ScChartListener( const String& rName, ScDocument* pDoc, + ::std::vector<ScTokenRef>* pTokens ); + ScChartListener( const ScChartListener& ); + virtual ~ScChartListener(); + virtual ScDataObject* Clone() const; + + void SetUno( const com::sun::star::uno::Reference< com::sun::star::chart::XChartDataChangeEventListener >& rListener, + const com::sun::star::uno::Reference< com::sun::star::chart::XChartData >& rSource ); + com::sun::star::uno::Reference< com::sun::star::chart::XChartDataChangeEventListener > GetUnoListener() const; + com::sun::star::uno::Reference< com::sun::star::chart::XChartData > GetUnoSource() const; + + sal_Bool IsUno() const { return (pUnoData != NULL); } + + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + void StartListeningTo(); + void EndListeningTo(); + void ChangeListening( const ScRangeListRef& rRangeListRef, + sal_Bool bDirty = false ); + void Update(); + ScRangeListRef GetRangeList() const; + void SetRangeList( const ScRangeListRef& rNew ); + void SetRangeList( const ScRange& rNew ); + sal_Bool IsUsed() const { return bUsed; } + void SetUsed( sal_Bool bFlg ) { bUsed = bFlg; } + sal_Bool IsDirty() const { return bDirty; } + void SetDirty( sal_Bool bFlg ) { bDirty = bFlg; } + + void UpdateChartIntersecting( const ScRange& rRange ); + + // if chart series ranges are to be updated later on (e.g. DeleteTab, InsertTab) + void ScheduleSeriesRanges() { bSeriesRangesScheduled = sal_True; } + void UpdateScheduledSeriesRanges(); + void UpdateSeriesRanges(); + + ExternalRefListener* GetExtRefListener(); + void SetUpdateQueue(); + + sal_Bool operator==( const ScChartListener& ); + sal_Bool operator!=( const ScChartListener& r ) + { return !operator==( r ); } +}; + +// ============================================================================ + +class ScChartHiddenRangeListener +{ +public: + ScChartHiddenRangeListener(); + virtual ~ScChartHiddenRangeListener(); + virtual void notify() = 0; +}; + +// ============================================================================ + +class ScChartListenerCollection : public ScStrCollection +{ +public: + struct RangeListenerItem + { + ScRange maRange; + ScChartHiddenRangeListener* mpListener; + explicit RangeListenerItem(const ScRange& rRange, ScChartHiddenRangeListener* p); + }; + +private: + ::std::list<RangeListenerItem> maHiddenListeners; + + Timer aTimer; + ScDocument* pDoc; + + DECL_LINK( TimerHdl, Timer* ); + + // not implemented + ScChartListenerCollection& operator=( const ScChartListenerCollection& ); + + using ScStrCollection::operator==; + +public: + ScChartListenerCollection( ScDocument* pDoc ); + ScChartListenerCollection( const ScChartListenerCollection& ); + virtual ScDataObject* Clone() const; + + virtual ~ScChartListenerCollection(); + + // only needed after copy-ctor, if newly added to doc + void StartAllListeners(); + + void ChangeListening( const String& rName, + const ScRangeListRef& rRangeListRef, + sal_Bool bDirty = sal_False ); + // use FreeUnused only the way it's used in ScDocument::UpdateChartListenerCollection + void FreeUnused(); + void FreeUno( const com::sun::star::uno::Reference< com::sun::star::chart::XChartDataChangeEventListener >& rListener, + const com::sun::star::uno::Reference< com::sun::star::chart::XChartData >& rSource ); + void StartTimer(); + void UpdateDirtyCharts(); + void SC_DLLPUBLIC SetDirty(); + void SetDiffDirty( const ScChartListenerCollection&, + sal_Bool bSetChartRangeLists = false ); + + void SetRangeDirty( const ScRange& rRange ); // for example rows/columns + + void UpdateScheduledSeriesRanges(); + void UpdateChartsContainingTab( SCTAB nTab ); + + sal_Bool operator==( const ScChartListenerCollection& ); + + /** + * Start listening on hide/show change within specified cell range. A + * single listener may listen on multiple ranges when the caller passes + * the same pointer multiple times with different ranges. + * + * Note that the caller is responsible for managing the life-cycle of the + * listener instance. + */ + void StartListeningHiddenRange( const ScRange& rRange, + ScChartHiddenRangeListener* pListener ); + + /** + * Remove all ranges associated with passed listener instance from the + * list of hidden range listeners. This does not delete the passed + * listener instance. + */ + void EndListeningHiddenRange( ScChartHiddenRangeListener* pListener ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chartlock.hxx b/sc/inc/chartlock.hxx new file mode 100644 index 000000000000..16afcc78ced0 --- /dev/null +++ b/sc/inc/chartlock.hxx @@ -0,0 +1,89 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHARTLOCK_HXX +#define SC_CHARTLOCK_HXX + + +#include <vcl/timer.hxx> + +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/frame/XModel.hpp> + +#include <memory> + +class ScDocument; + +/** All current charts in the calc will be locked in constructor and unlocked in destructor. +*/ +class ScChartLockGuard +{ +public: + ScChartLockGuard( ScDocument* pDoc ); + virtual ~ScChartLockGuard(); + + void AlsoLockThisChart( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + +private: + std::vector< ::com::sun::star::uno::WeakReference< + ::com::sun::star::frame::XModel > > maChartModels; + + ScChartLockGuard(); + ScChartLockGuard( const ScChartLockGuard& ); +}; + +/** Use this to lock all charts in the calc for a little time. + They will unlock automatically unless you call StartOrContinueLocking() again. +*/ +class ScTemporaryChartLock +{ +public: + ScTemporaryChartLock( ScDocument* pDoc ); + virtual ~ScTemporaryChartLock(); + + void StartOrContinueLocking(); + void StopLocking(); + void AlsoLockThisChart( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + +private: + ScDocument* mpDoc; + Timer maTimer; + std::auto_ptr< ScChartLockGuard > mapScChartLockGuard; + + DECL_LINK( TimeoutHdl, Timer* ); + + ScTemporaryChartLock(); + ScTemporaryChartLock( const ScTemporaryChartLock& ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx new file mode 100644 index 000000000000..b64804374f83 --- /dev/null +++ b/sc/inc/chartpos.hxx @@ -0,0 +1,170 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHARTPOS_HXX +#define SC_CHARTPOS_HXX + +// ----------------------------------------------------------------------- + +#include "collect.hxx" +#include "rangelst.hxx" + + +class ScAddress; +class Table; + +class ScChartPositionMap +{ + friend class ScChartPositioner; + + ScAddress** ppData; + ScAddress** ppColHeader; + ScAddress** ppRowHeader; + sal_uLong nCount; + SCCOL nColCount; + SCROW nRowCount; + + ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows, + SCCOL nColAdd, // header columns + SCROW nRowAdd, // header rows + Table& rCols // table with col tables with address* + ); + ~ScChartPositionMap(); //! deletes all ScAddress* + + // not implemented + ScChartPositionMap( const ScChartPositionMap& ); + ScChartPositionMap& operator=( const ScChartPositionMap& ); + +public: + + sal_uLong GetCount() const { return nCount; } + SCCOL GetColCount() const { return nColCount; } + SCROW GetRowCount() const { return nRowCount; } + + sal_Bool IsValid( SCCOL nCol, SCROW nRow ) const + { return nCol < nColCount && nRow < nRowCount; } + // data column by column + sal_uLong GetIndex( SCCOL nCol, SCROW nRow ) const + { return (sal_uLong) nCol * nRowCount + nRow; } + + const ScAddress* GetPosition( sal_uLong nIndex ) const + { + if ( nIndex < nCount ) + return ppData[ nIndex ]; + return NULL; + } + + //! might be NULL indicating "no value" + const ScAddress* GetPosition( SCCOL nChartCol, SCROW nChartRow ) const + { + if ( IsValid( nChartCol, nChartRow ) ) + return ppData[ GetIndex( nChartCol, nChartRow ) ]; + return NULL; + } + const ScAddress* GetColHeaderPosition( SCCOL nChartCol ) const + { + if ( nChartCol < nColCount ) + return ppColHeader[ nChartCol ]; + return NULL; + } + const ScAddress* GetRowHeaderPosition( SCROW nChartRow ) const + { + if ( nChartRow < nRowCount ) + return ppRowHeader[ nChartRow ]; + return NULL; + } +}; + + +enum ScChartGlue { + SC_CHARTGLUE_NA, + SC_CHARTGLUE_NONE, // old mimic + SC_CHARTGLUE_COLS, // old mimic + SC_CHARTGLUE_ROWS, + SC_CHARTGLUE_BOTH +}; + +class ScDocument; + +class ScChartPositioner // only parameter struct +{ + ScRangeListRef aRangeListRef; + ScDocument* pDocument; + ScChartPositionMap* pPositionMap; + ScChartGlue eGlue; + SCCOL nStartCol; + SCROW nStartRow; + sal_Bool bColHeaders; + sal_Bool bRowHeaders; + sal_Bool bDummyUpperLeft; + +private: + void CheckColRowHeaders(); + + void GlueState(); // summarised areas + void CreatePositionMap(); + +public: + ScChartPositioner( ScDocument* pDoc, SCTAB nTab, + SCCOL nStartColP, SCROW nStartRowP, + SCCOL nEndColP, SCROW nEndRowP ); + ScChartPositioner( ScDocument* pDoc, const ScRangeListRef& rRangeList ); + ScChartPositioner( const ScChartPositioner& rPositioner ); + + virtual ~ScChartPositioner(); + + const ScRangeListRef& GetRangeList() const { return aRangeListRef; } + void SetRangeList( const ScRangeListRef& rNew ) { aRangeListRef = rNew; } + void SetRangeList( const ScRange& rNew ); + + void SetHeaders(sal_Bool bCol, sal_Bool bRow) { bColHeaders=bCol; bRowHeaders=bRow; } + sal_Bool HasColHeaders() const { return bColHeaders; } + sal_Bool HasRowHeaders() const { return bRowHeaders; } + void SetDummyUpperLeft(sal_Bool bNew) { bDummyUpperLeft = bNew; } + void SeteGlue(ScChartGlue eNew) { eGlue = eNew; } + void SetStartCol(SCCOL nNew) { nStartCol = nNew; } + void SetStartRow(SCROW nNew) { nStartRow = nNew; } + + sal_Bool operator==(const ScChartPositioner& rCmp) const; + + void InvalidateGlue() + { + eGlue = SC_CHARTGLUE_NA; + if ( pPositionMap ) + { + delete pPositionMap; + pPositionMap = NULL; + } + } + const ScChartPositionMap* GetPositionMap(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chartuno.hxx b/sc/inc/chartuno.hxx new file mode 100644 index 000000000000..179fb789e178 --- /dev/null +++ b/sc/inc/chartuno.hxx @@ -0,0 +1,206 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHARTUNO_HXX +#define SC_CHARTUNO_HXX + +#include "address.hxx" +#include <svl/lstner.hxx> +#include <tools/string.hxx> +#include <comphelper/proparrhlp.hxx> +#include <comphelper/propertycontainer.hxx> + +#include <com/sun/star/table/XTableChart.hpp> +#include <com/sun/star/table/XTableCharts.hpp> +#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <cppuhelper/compbase4.hxx> +#include <cppuhelper/implbase4.hxx> + + +class ScDocShell; +class ScRangeListRef; +class ScChartObj; + + +class ScChartsObj : public cppu::WeakImplHelper4< + com::sun::star::table::XTableCharts, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; // Charts are per sheet + + ScChartObj* GetObjectByIndex_Impl(long nIndex) const; + ScChartObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const; + +public: + ScChartsObj(ScDocShell* pDocSh, SCTAB nT); + virtual ~ScChartsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XTableCharts + virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, + const ::com::sun::star::awt::Rectangle& aRect, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& aRanges, + sal_Bool bColumnHeaders, sal_Bool bRowHeaders ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +typedef ::cppu::WeakComponentImplHelper4< + ::com::sun::star::table::XTableChart, + ::com::sun::star::document::XEmbeddedObjectSupplier, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo > ScChartObj_Base; + +typedef ::comphelper::OPropertyContainer ScChartObj_PBase; +typedef ::comphelper::OPropertyArrayUsageHelper< ScChartObj > ScChartObj_PABase; + +class ScChartObj : public ::comphelper::OBaseMutex + ,public ScChartObj_Base + ,public ScChartObj_PBase + ,public ScChartObj_PABase + ,public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; // Charts are per sheet + String aChartName; + + void Update_Impl( const ScRangeListRef& rRanges, bool bColHeaders, bool bRowHeaders ); + void GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& rRowHeaders ) const; + +protected: + // ::comphelper::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::uno::Exception); + using ::cppu::OPropertySetHelper::getFastPropertyValue; + virtual void SAL_CALL getFastPropertyValue( ::com::sun::star::uno::Any& rValue, sal_Int32 nHandle ) const; + + // ::comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + +public: + ScChartObj(ScDocShell* pDocSh, SCTAB nT, const String& rN); + virtual ~ScChartObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XInterface + DECLARE_XINTERFACE() + + // XTypeProvider + DECLARE_XTYPEPROVIDER() + + // XComponent + virtual void SAL_CALL disposing(); + + // XTableChart + virtual sal_Bool SAL_CALL getHasColumnHeaders() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHasColumnHeaders( sal_Bool bHasColumnHeaders ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getHasRowHeaders() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setHasRowHeaders( sal_Bool bHasRowHeaders ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL + getRanges( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setRanges( const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& aRanges ) + throw(::com::sun::star::uno::RuntimeException); + + // XEmbeddedObjectSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > SAL_CALL + getEmbeddedObject() throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx new file mode 100644 index 000000000000..036b1a0d6c0f --- /dev/null +++ b/sc/inc/chgtrack.hxx @@ -0,0 +1,1350 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CHGTRACK_HXX +#define SC_CHGTRACK_HXX + + +#include <tools/string.hxx> +#include <tools/datetime.hxx> +#include <tools/table.hxx> +#include <tools/stack.hxx> +#include <tools/queue.hxx> +#include <tools/mempool.hxx> +#include <tools/link.hxx> +#include <unotools/options.hxx> +#include "global.hxx" +#include "bigrange.hxx" +#include "collect.hxx" +#include "scdllapi.h" + +#ifdef SC_CHGTRACK_CXX +// core/inc +#include "refupdat.hxx" +#endif + +class ScBaseCell; +class ScDocument; + + +enum ScChangeActionType +{ + SC_CAT_NONE, + SC_CAT_INSERT_COLS, + SC_CAT_INSERT_ROWS, + SC_CAT_INSERT_TABS, + SC_CAT_DELETE_COLS, + SC_CAT_DELETE_ROWS, + SC_CAT_DELETE_TABS, + SC_CAT_MOVE, + SC_CAT_CONTENT, + SC_CAT_REJECT +}; + + +enum ScChangeActionState +{ + SC_CAS_VIRGIN, + SC_CAS_ACCEPTED, + SC_CAS_REJECTED +}; + + +enum ScChangeActionClipMode +{ + SC_CACM_NONE, + SC_CACM_CUT, + SC_CACM_COPY, + SC_CACM_PASTE +}; + +class SvStream; + +// --- ScChangeActionLinkEntry --------------------------------------------- + +// Inserts itself as the head of a chain (better: linked list?), or before a LinkEntry +// on delete: automatically remove of what is linked (German original was strange...) +// ppPrev == &previous->pNext oder address of pointer to head of linked list, +// *ppPrev == this + +class ScChangeAction; + +class ScChangeActionLinkEntry +{ + // not implemented, prevent usage + ScChangeActionLinkEntry( + const ScChangeActionLinkEntry& ); + ScChangeActionLinkEntry& operator=( const ScChangeActionLinkEntry& ); + +protected: + + ScChangeActionLinkEntry* pNext; + ScChangeActionLinkEntry** ppPrev; + ScChangeAction* pAction; + ScChangeActionLinkEntry* pLink; + +public: + + DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionLinkEntry ) + + ScChangeActionLinkEntry( + ScChangeActionLinkEntry** ppPrevP, + ScChangeAction* pActionP ) + : pNext( *ppPrevP ), + ppPrev( ppPrevP ), + pAction( pActionP ), + pLink( NULL ) + { + if ( pNext ) + pNext->ppPrev = &pNext; + *ppPrevP = this; + } + + virtual ~ScChangeActionLinkEntry() + { + ScChangeActionLinkEntry* p = pLink; + UnLink(); + Remove(); + if ( p ) + delete p; + } + + void SetLink( ScChangeActionLinkEntry* pLinkP ) + { + UnLink(); + if ( pLinkP ) + { + pLink = pLinkP; + pLinkP->pLink = this; + } + } + + void UnLink() + { + if ( pLink ) + { + pLink->pLink = NULL; + pLink = NULL; + } + } + + void Remove() + { + if ( ppPrev ) + { + if ( ( *ppPrev = pNext ) != NULL ) + pNext->ppPrev = ppPrev; + ppPrev = NULL; // not inserted + } + } + + void Insert( ScChangeActionLinkEntry** ppPrevP ) + { + if ( !ppPrev ) + { + ppPrev = ppPrevP; + if ( (pNext = *ppPrevP) ) + pNext->ppPrev = &pNext; + *ppPrevP = this; + } + } + + const ScChangeActionLinkEntry* GetLink() const { return pLink; } + ScChangeActionLinkEntry* GetLink() { return pLink; } + const ScChangeActionLinkEntry* GetNext() const { return pNext; } + ScChangeActionLinkEntry* GetNext() { return pNext; } + const ScChangeAction* GetAction() const { return pAction; } + ScChangeAction* GetAction() { return pAction; } +}; + +// --- ScChangeActionCellListEntry ----------------------------------------- +// this is only for the XML Export in the hxx +class ScChangeActionContent; + +class ScChangeActionCellListEntry +{ + friend class ScChangeAction; + friend class ScChangeActionDel; + friend class ScChangeActionMove; + friend class ScChangeTrack; + + ScChangeActionCellListEntry* pNext; + ScChangeActionContent* pContent; + + ScChangeActionCellListEntry( + ScChangeActionContent* pContentP, + ScChangeActionCellListEntry* pNextP ) + : pNext( pNextP ), + pContent( pContentP ) + {} + +public: + const ScChangeActionCellListEntry* GetNext() const { return pNext; } // this is only for the XML Export public + const ScChangeActionContent* GetContent() const { return pContent; } // this is only for the XML Export public + + DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionCellListEntry ) +}; + +// --- ScChangeAction ------------------------------------------------------- + +class ScChangeTrack; +class ScChangeActionIns; +class ScChangeActionDel; +class ScChangeActionContent; + +class ScChangeAction +{ + friend class ScChangeTrack; + friend class ScChangeActionIns; + friend class ScChangeActionDel; + friend class ScChangeActionMove; + friend class ScChangeActionContent; + + // not implemented, prevent usage + ScChangeAction( const ScChangeAction& ); + ScChangeAction& operator=( const ScChangeAction& ); + +protected: + + ScBigRange aBigRange; // Ins/Del/MoveTo/ContentPos + DateTime aDateTime; //! UTC + String aUser; // who? + String aComment; // user comment + ScChangeAction* pNext; // next in linked list + ScChangeAction* pPrev; // previous in linked list + ScChangeActionLinkEntry* pLinkAny; // arbitrary links + ScChangeActionLinkEntry* pLinkDeletedIn; // access to insert areas which were + // deleted or moved or rejected + ScChangeActionLinkEntry* pLinkDeleted; // links to deleted + ScChangeActionLinkEntry* pLinkDependent; // links to dependent + sal_uLong nAction; + sal_uLong nRejectAction; + ScChangeActionType eType; + ScChangeActionState eState; + + + ScChangeAction( ScChangeActionType, + const ScRange& ); + + // only to be used in the XML import + ScChangeAction( ScChangeActionType, + const ScBigRange&, + const sal_uLong nAction, + const sal_uLong nRejectAction, + const ScChangeActionState eState, + const DateTime& aDateTime, + const String& aUser, + const String& aComment ); + // only to be used in the XML import + ScChangeAction( ScChangeActionType, + const ScBigRange&, + const sal_uLong nAction); + + virtual ~ScChangeAction(); + + String GetRefString( const ScBigRange&, + ScDocument*, sal_Bool bFlag3D = false ) const; + + void SetActionNumber( sal_uLong n ) { nAction = n; } + void SetRejectAction( sal_uLong n ) { nRejectAction = n; } + void SetUser( const String& r ) { aUser = r; } + void SetType( ScChangeActionType e ) { eType = e; } + void SetState( ScChangeActionState e ) { eState = e; } + void SetRejected(); + + ScBigRange& GetBigRange() { return aBigRange; } + + ScChangeActionLinkEntry* AddLink( ScChangeAction* p, + ScChangeActionLinkEntry* pL ) + { + ScChangeActionLinkEntry* pLnk = + new ScChangeActionLinkEntry( + &pLinkAny, p ); + pLnk->SetLink( pL ); + return pLnk; + } + void RemoveAllAnyLinks(); + + virtual ScChangeActionLinkEntry* GetDeletedIn() const + { return pLinkDeletedIn; } + virtual ScChangeActionLinkEntry** GetDeletedInAddress() + { return &pLinkDeletedIn; } + ScChangeActionLinkEntry* AddDeletedIn( ScChangeAction* p ) + { + return new ScChangeActionLinkEntry( + GetDeletedInAddress(), p ); + } + sal_Bool RemoveDeletedIn( const ScChangeAction* ); + void SetDeletedIn( ScChangeAction* ); + + ScChangeActionLinkEntry* AddDeleted( ScChangeAction* p ) + { + return new ScChangeActionLinkEntry( + &pLinkDeleted, p ); + } + void RemoveAllDeleted(); + + ScChangeActionLinkEntry* AddDependent( ScChangeAction* p ) + { + return new ScChangeActionLinkEntry( + &pLinkDependent, p ); + } + void RemoveAllDependent(); + + void RemoveAllLinks(); + + virtual void AddContent( ScChangeActionContent* ) = 0; + virtual void DeleteCellEntries() = 0; + + virtual void UpdateReference( const ScChangeTrack*, + UpdateRefMode, const ScBigRange&, + sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); + + void Accept(); + virtual sal_Bool Reject( ScDocument* ) = 0; + void RejectRestoreContents( ScChangeTrack*, + SCsCOL nDx, SCsROW nDy ); + + // used in Reject() instead of IsRejectable() + sal_Bool IsInternalRejectable() const; + + // Derived classes that hold a pointer to the + // ChangeTrack must return that. Otherwise NULL. + virtual const ScChangeTrack* GetChangeTrack() const = 0; + +public: + + sal_Bool IsInsertType() const + { + return eType == SC_CAT_INSERT_COLS || + eType == SC_CAT_INSERT_ROWS || + eType == SC_CAT_INSERT_TABS; + } + sal_Bool IsDeleteType() const + { + return eType == SC_CAT_DELETE_COLS || + eType == SC_CAT_DELETE_ROWS || + eType == SC_CAT_DELETE_TABS; + } + sal_Bool IsVirgin() const + { return eState == SC_CAS_VIRGIN; } + sal_Bool IsAccepted() const + { return eState == SC_CAS_ACCEPTED; } + sal_Bool IsRejected() const + { return eState == SC_CAS_REJECTED; } + + // Action rejects another Action + sal_Bool IsRejecting() const + { return nRejectAction != 0; } + + // if action is visible in the document + sal_Bool IsVisible() const; + + // if action if touchable + sal_Bool IsTouchable() const; + + // if action is an entry in dialog root + sal_Bool IsDialogRoot() const; + + // if an entry in a dialog shall be a drop down entry + sal_Bool IsDialogParent() const; + + // if action is a delete with subdeletes (aufgeklappt = open ?) + sal_Bool IsMasterDelete() const; + + // if action is acceptable/selectable/rejectable + sal_Bool IsClickable() const; + + // if action is rejectable + sal_Bool IsRejectable() const; + + const ScBigRange& GetBigRange() const { return aBigRange; } + SC_DLLPUBLIC DateTime GetDateTime() const; // local time + const DateTime& GetDateTimeUTC() const // UTC time + { return aDateTime; } + const String& GetUser() const { return aUser; } + const String& GetComment() const { return aComment; } + ScChangeActionType GetType() const { return eType; } + ScChangeActionState GetState() const { return eState; } + sal_uLong GetActionNumber() const { return nAction; } + sal_uLong GetRejectAction() const { return nRejectAction; } + + ScChangeAction* GetNext() const { return pNext; } + ScChangeAction* GetPrev() const { return pPrev; } + + sal_Bool IsDeletedIn() const + { return GetDeletedIn() != NULL; } + sal_Bool IsDeleted() const + { return IsDeleteType() || IsDeletedIn(); } + sal_Bool IsDeletedIn( const ScChangeAction* ) const; + sal_Bool IsDeletedInDelType( ScChangeActionType ) const; + void RemoveAllDeletedIn(); + + const ScChangeActionLinkEntry* GetFirstDeletedEntry() const + { return pLinkDeleted; } + const ScChangeActionLinkEntry* GetFirstDependentEntry() const + { return pLinkDependent; } + sal_Bool HasDependent() const + { return pLinkDependent != NULL; } + sal_Bool HasDeleted() const + { return pLinkDeleted != NULL; } + + // description will be appended to string + // with bSplitRange only one column/row will be considered for delete + // (for a listing of entries) + virtual void GetDescription( String&, ScDocument*, + sal_Bool bSplitRange = false, bool bWarning = true ) const; + + virtual void GetRefString( String&, ScDocument*, + sal_Bool bFlag3D = false ) const; + + // for DocumentMerge set old date of the other + // action, fetched by GetDateTimeUTC + void SetDateTimeUTC( const DateTime& rDT ) + { aDateTime = rDT; } + + // set user comment + void SetComment( const String& rStr ) + { aComment = rStr; } + + // only to be used in the XML import + void SetDeletedInThis( sal_uLong nActionNumber, + const ScChangeTrack* pTrack ); + // only to be used in the XML import + void AddDependent( sal_uLong nActionNumber, + const ScChangeTrack* pTrack ); +}; + + +// --- ScChangeActionIns ---------------------------------------------------- + +class ScChangeActionIns : public ScChangeAction +{ + friend class ScChangeTrack; + + ScChangeActionIns( const ScRange& rRange ); + virtual ~ScChangeActionIns(); + + virtual void AddContent( ScChangeActionContent* ) {} + virtual void DeleteCellEntries() {} + + virtual sal_Bool Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return 0; } + +public: + ScChangeActionIns(const sal_uLong nActionNumber, + const ScChangeActionState eState, + const sal_uLong nRejectingNumber, + const ScBigRange& aBigRange, + const String& aUser, + const DateTime& aDateTime, + const String &sComment, + const ScChangeActionType eType); // only to use in the XML import + + virtual void GetDescription( String&, ScDocument*, + sal_Bool bSplitRange = false, bool bWarning = true ) const; +}; + + +// --- ScChangeActionDel ---------------------------------------------------- + +class ScChangeActionMove; + +class ScChangeActionDelMoveEntry : public ScChangeActionLinkEntry +{ + friend class ScChangeActionDel; + friend class ScChangeTrack; + + short nCutOffFrom; + short nCutOffTo; + + + ScChangeActionDelMoveEntry( + ScChangeActionDelMoveEntry** ppPrevP, + ScChangeActionMove* pMove, + short nFrom, short nTo ) + : ScChangeActionLinkEntry( + (ScChangeActionLinkEntry**) + ppPrevP, + (ScChangeAction*) pMove ), + nCutOffFrom( nFrom ), + nCutOffTo( nTo ) + {} + + ScChangeActionDelMoveEntry* GetNext() + { + return (ScChangeActionDelMoveEntry*) + ScChangeActionLinkEntry::GetNext(); + } + ScChangeActionMove* GetMove() + { + return (ScChangeActionMove*) + ScChangeActionLinkEntry::GetAction(); + } + +public: + const ScChangeActionDelMoveEntry* GetNext() const + { + return (const ScChangeActionDelMoveEntry*) + ScChangeActionLinkEntry::GetNext(); + } + const ScChangeActionMove* GetMove() const + { + return (const ScChangeActionMove*) + ScChangeActionLinkEntry::GetAction(); + } + short GetCutOffFrom() const { return nCutOffFrom; } + short GetCutOffTo() const { return nCutOffTo; } +}; + + +class ScChangeActionDel : public ScChangeAction +{ + friend class ScChangeTrack; + friend void ScChangeAction::Accept(); + + ScChangeTrack* pTrack; + ScChangeActionCellListEntry* pFirstCell; + ScChangeActionIns* pCutOff; // cut insert + short nCutOff; // +: start -: end + ScChangeActionDelMoveEntry* pLinkMove; + SCsCOL nDx; + SCsROW nDy; + + ScChangeActionDel( const ScRange& rRange, + SCsCOL nDx, SCsROW nDy, ScChangeTrack* ); + virtual ~ScChangeActionDel(); + + ScChangeActionIns* GetCutOffInsert() { return pCutOff; } + + virtual void AddContent( ScChangeActionContent* ); + virtual void DeleteCellEntries(); + + void UndoCutOffMoves(); + void UndoCutOffInsert(); + + virtual void UpdateReference( const ScChangeTrack*, + UpdateRefMode, const ScBigRange&, + sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); + + virtual sal_Bool Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } + +public: + ScChangeActionDel(const sal_uLong nActionNumber, + const ScChangeActionState eState, + const sal_uLong nRejectingNumber, + const ScBigRange& aBigRange, + const String& aUser, + const DateTime& aDateTime, + const String &sComment, + const ScChangeActionType eType, + const SCsCOLROW nD, + ScChangeTrack* pTrack); // only to use in the XML import + // which of nDx and nDy is set is dependend on the type + + // is the last in a row (or single) + sal_Bool IsBaseDelete() const; + + // is the first in a row (or single) + sal_Bool IsTopDelete() const; + + // is part of a row + sal_Bool IsMultiDelete() const; + + // is col, belonging to a TabDelete + sal_Bool IsTabDeleteCol() const; + + SCsCOL GetDx() const { return nDx; } + SCsROW GetDy() const { return nDy; } + ScBigRange GetOverAllRange() const; // BigRange + (nDx, nDy) + + const ScChangeActionCellListEntry* GetFirstCellEntry() const + { return pFirstCell; } + const ScChangeActionDelMoveEntry* GetFirstMoveEntry() const + { return pLinkMove; } + const ScChangeActionIns* GetCutOffInsert() const { return pCutOff; } + short GetCutOffCount() const { return nCutOff; } + + virtual void GetDescription( String&, ScDocument*, + sal_Bool bSplitRange = false, bool bWarning = true ) const; + void SetCutOffInsert( ScChangeActionIns* p, short n ) + { pCutOff = p; nCutOff = n; } // only to use in the XML import + // this should be protected, but for the XML import it is public + // only to use in the XML import + // this should be protected, but for the XML import it is public + ScChangeActionDelMoveEntry* AddCutOffMove( ScChangeActionMove* pMove, + short nFrom, short nTo ) + { + return new ScChangeActionDelMoveEntry( + &pLinkMove, pMove, nFrom, nTo ); + } +}; + + +// --- ScChangeActionMove --------------------------------------------------- + +class ScChangeActionMove : public ScChangeAction +{ + friend class ScChangeTrack; + friend class ScChangeActionDel; + + ScBigRange aFromRange; + ScChangeTrack* pTrack; + ScChangeActionCellListEntry* pFirstCell; + sal_uLong nStartLastCut; // for PasteCut undo + sal_uLong nEndLastCut; + + ScChangeActionMove( const ScRange& rFromRange, + const ScRange& rToRange, + ScChangeTrack* pTrackP ) + : ScChangeAction( SC_CAT_MOVE, rToRange ), + aFromRange( rFromRange ), + pTrack( pTrackP ), + pFirstCell( NULL ), + nStartLastCut(0), + nEndLastCut(0) + {} + virtual ~ScChangeActionMove(); + + virtual void AddContent( ScChangeActionContent* ); + virtual void DeleteCellEntries(); + + ScBigRange& GetFromRange() { return aFromRange; } + + void SetStartLastCut( sal_uLong nVal ) { nStartLastCut = nVal; } + sal_uLong GetStartLastCut() const { return nStartLastCut; } + void SetEndLastCut( sal_uLong nVal ) { nEndLastCut = nVal; } + sal_uLong GetEndLastCut() const { return nEndLastCut; } + + virtual void UpdateReference( const ScChangeTrack*, + UpdateRefMode, const ScBigRange&, + sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); + + virtual sal_Bool Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } + +protected: + using ScChangeAction::GetRefString; + +public: + ScChangeActionMove(const sal_uLong nActionNumber, + const ScChangeActionState eState, + const sal_uLong nRejectingNumber, + const ScBigRange& aToBigRange, + const String& aUser, + const DateTime& aDateTime, + const String &sComment, + const ScBigRange& aFromBigRange, + ScChangeTrack* pTrack); // only to use in the XML import + const ScChangeActionCellListEntry* GetFirstCellEntry() const + { return pFirstCell; } // only to use in the XML export + + const ScBigRange& GetFromRange() const { return aFromRange; } + SC_DLLPUBLIC void GetDelta( sal_Int32& nDx, sal_Int32& nDy, sal_Int32& nDz ) const; + + virtual void GetDescription( String&, ScDocument*, + sal_Bool bSplitRange = false, bool bWarning = true ) const; + + virtual void GetRefString( String&, ScDocument*, + sal_Bool bFlag3D = false ) const; +}; + + +// --- ScChangeActionContent ------------------------------------------------ + +enum ScChangeActionContentCellType +{ + SC_CACCT_NONE = 0, + SC_CACCT_NORMAL, + SC_CACCT_MATORG, + SC_CACCT_MATREF +}; + +class Stack; + +class ScChangeActionContent : public ScChangeAction +{ + friend class ScChangeTrack; + + String aOldValue; + String aNewValue; + ScBaseCell* pOldCell; + ScBaseCell* pNewCell; + ScChangeActionContent* pNextContent; // at the same position + ScChangeActionContent* pPrevContent; + ScChangeActionContent* pNextInSlot; // in the same slot + ScChangeActionContent** ppPrevInSlot; + + void InsertInSlot( ScChangeActionContent** pp ) + { + if ( !ppPrevInSlot ) + { + ppPrevInSlot = pp; + if ( ( pNextInSlot = *pp ) != NULL ) + pNextInSlot->ppPrevInSlot = &pNextInSlot; + *pp = this; + } + } + void RemoveFromSlot() + { + if ( ppPrevInSlot ) + { + if ( ( *ppPrevInSlot = pNextInSlot ) != NULL ) + pNextInSlot->ppPrevInSlot = ppPrevInSlot; + ppPrevInSlot = NULL; // not inserted + } + } + ScChangeActionContent* GetNextInSlot() { return pNextInSlot; } + + void ClearTrack(); + + static void GetStringOfCell( String& rStr, + const ScBaseCell* pCell, + const ScDocument* pDoc, + const ScAddress& rPos ); + + static void GetStringOfCell( String& rStr, + const ScBaseCell* pCell, + const ScDocument* pDoc, + sal_uLong nFormat ); + + static void SetValue( String& rStr, ScBaseCell*& pCell, + const ScAddress& rPos, + const ScBaseCell* pOrgCell, + const ScDocument* pFromDoc, + ScDocument* pToDoc ); + + static void SetValue( String& rStr, ScBaseCell*& pCell, + sal_uLong nFormat, + const ScBaseCell* pOrgCell, + const ScDocument* pFromDoc, + ScDocument* pToDoc ); + + static void SetCell( String& rStr, ScBaseCell* pCell, + sal_uLong nFormat, const ScDocument* pDoc ); + + static sal_Bool NeedsNumberFormat( const ScBaseCell* ); + + void SetValueString( String& rValue, + ScBaseCell*& pCell, const String& rStr, + ScDocument* pDoc ); + + void GetValueString( String& rStr, + const String& rValue, + const ScBaseCell* pCell ) const; + + void GetFormulaString( String& rStr, + const ScFormulaCell* pCell ) const; + + virtual void AddContent( ScChangeActionContent* ) {} + virtual void DeleteCellEntries() {} + + virtual void UpdateReference( const ScChangeTrack*, + UpdateRefMode, const ScBigRange&, + sal_Int32 nDx, sal_Int32 nDy, sal_Int32 nDz ); + + virtual sal_Bool Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return 0; } + + // pRejectActions!=NULL: reject actions get + // stacked, no SetNewValue, no Append + sal_Bool Select( ScDocument*, ScChangeTrack*, + sal_Bool bOldest, Stack* pRejectActions ); + + void PutValueToDoc( ScBaseCell*, const String&, + ScDocument*, SCsCOL nDx, SCsROW nDy ) const; + +protected: + using ScChangeAction::GetRefString; + +public: + + DECL_FIXEDMEMPOOL_NEWDEL( ScChangeActionContent ) + + ScChangeActionContent( const ScRange& rRange ) + : ScChangeAction( SC_CAT_CONTENT, rRange ), + pOldCell( NULL ), + pNewCell( NULL ), + pNextContent( NULL ), + pPrevContent( NULL ), + pNextInSlot( NULL ), + ppPrevInSlot( NULL ) + {} + ScChangeActionContent(const sal_uLong nActionNumber, + const ScChangeActionState eState, + const sal_uLong nRejectingNumber, + const ScBigRange& aBigRange, + const String& aUser, + const DateTime& aDateTime, + const String &sComment, + ScBaseCell* pOldCell, + ScDocument* pDoc, + const String& sOldValue); // to use for XML Import + ScChangeActionContent(const sal_uLong nActionNumber, + ScBaseCell* pNewCell, + const ScBigRange& aBigRange, + ScDocument* pDoc, + const String& sNewValue); // to use for XML Import of Generated Actions + virtual ~ScChangeActionContent(); + + ScChangeActionContent* GetNextContent() const { return pNextContent; } + ScChangeActionContent* GetPrevContent() const { return pPrevContent; } + ScChangeActionContent* GetTopContent() const; + sal_Bool IsTopContent() const + { return pNextContent == NULL; } + + virtual ScChangeActionLinkEntry* GetDeletedIn() const; + virtual ScChangeActionLinkEntry** GetDeletedInAddress(); + + void PutOldValueToDoc( ScDocument*, + SCsCOL nDx, SCsROW nDy ) const; + void PutNewValueToDoc( ScDocument*, + SCsCOL nDx, SCsROW nDy ) const; + + void SetOldValue( const ScBaseCell*, + const ScDocument* pFromDoc, + ScDocument* pToDoc, + sal_uLong nFormat ); + void SetOldValue( const ScBaseCell*, + const ScDocument* pFromDoc, + ScDocument* pToDoc ); + void SetNewValue( const ScBaseCell*, ScDocument* ); + + // Used in import filter AppendContentOnTheFly, + // takes ownership of cells. + void SetOldNewCells( ScBaseCell* pOldCell, + sal_uLong nOldFormat, ScBaseCell* pNewCell, + sal_uLong nNewFormat, ScDocument* pDoc ); + + // Use this only in the XML import, + // takes ownership of cell. + void SetNewCell( ScBaseCell* pCell, ScDocument* pDoc, const String& rFormatted ); + + // These functions should be protected but for + // the XML import they are public. + void SetNextContent( ScChangeActionContent* p ) + { pNextContent = p; } + void SetPrevContent( ScChangeActionContent* p ) + { pPrevContent = p; } + + // don't use: + // assigns String / creates forumula cell + void SetOldValue( const String& rOld, ScDocument* ); + void SetNewValue( const String& rNew, ScDocument* ); + + void GetOldString( String& ) const; + void GetNewString( String& ) const; + const ScBaseCell* GetOldCell() const { return pOldCell; } + const ScBaseCell* GetNewCell() const { return pNewCell; } + virtual void GetDescription( String&, ScDocument*, + sal_Bool bSplitRange = false, bool bWarning = true ) const; + virtual void GetRefString( String&, ScDocument*, + sal_Bool bFlag3D = false ) const; + + static ScChangeActionContentCellType GetContentCellType( const ScBaseCell* ); + + // NewCell + sal_Bool IsMatrixOrigin() const + { + return GetContentCellType( GetNewCell() ) + == SC_CACCT_MATORG; + } + sal_Bool IsMatrixReference() const + { + return GetContentCellType( GetNewCell() ) + == SC_CACCT_MATREF; + } + // OldCell + sal_Bool IsOldMatrixOrigin() const + { + return GetContentCellType( GetOldCell() ) + == SC_CACCT_MATORG; + } + sal_Bool IsOldMatrixReference() const + { + return GetContentCellType( GetOldCell() ) + == SC_CACCT_MATREF; + } + +}; + + +// --- ScChangeActionReject ------------------------------------------------- + +class Stack; + +class ScChangeActionReject : public ScChangeAction +{ + friend class ScChangeTrack; + friend class ScChangeActionContent; + + ScChangeActionReject( sal_uLong nReject ) + : ScChangeAction( SC_CAT_REJECT, ScRange() ) + { + SetRejectAction( nReject ); + SetState( SC_CAS_ACCEPTED ); + } + + virtual void AddContent( ScChangeActionContent* ) {} + virtual void DeleteCellEntries() {} + + virtual sal_Bool Reject( ScDocument* ) { return false; } + + virtual const ScChangeTrack* GetChangeTrack() const { return 0; } + +public: + ScChangeActionReject(const sal_uLong nActionNumber, + const ScChangeActionState eState, + const sal_uLong nRejectingNumber, + const ScBigRange& aBigRange, + const String& aUser, + const DateTime& aDateTime, + const String &sComment); // only to use in the XML import +}; + + +// --- ScChangeTrack -------------------------------------------------------- + +enum ScChangeTrackMsgType +{ + SC_CTM_NONE, + SC_CTM_APPEND, // Actions appended + SC_CTM_REMOVE, // Actions removed + SC_CTM_CHANGE, // Actions changed + SC_CTM_PARENT // became a parent (and wasn't before) +}; + +struct ScChangeTrackMsgInfo +{ + DECL_FIXEDMEMPOOL_NEWDEL( ScChangeTrackMsgInfo ) + + ScChangeTrackMsgType eMsgType; + sal_uLong nStartAction; + sal_uLong nEndAction; +}; + +// MsgQueue for notification via ModifiedLink +DECLARE_QUEUE( ScChangeTrackMsgQueue, ScChangeTrackMsgInfo* ) +DECLARE_STACK( ScChangeTrackMsgStack, ScChangeTrackMsgInfo* ) + +enum ScChangeTrackMergeState +{ + SC_CTMS_NONE, + SC_CTMS_PREPARE, + SC_CTMS_OWN, + SC_CTMS_UNDO, + SC_CTMS_OTHER +}; + +// Table, additionally to pFirst/pNext/pLast/pPrev, to enable fast access by ActionNumber and by list +DECLARE_TABLE( ScChangeActionTable, ScChangeAction* ) + +// Internally generated actions start at this value (nearly all bits set) +// and are decremented, to keep values in a table seperated from "normal" actions. +#define SC_CHGTRACK_GENERATED_START ((sal_uInt32) 0xfffffff0) + +class ScChangeTrack : public utl::ConfigurationListener +{ + friend void ScChangeAction::RejectRestoreContents( ScChangeTrack*, SCsCOL, SCsROW ); + friend sal_Bool ScChangeActionDel::Reject( ScDocument* pDoc ); + friend void ScChangeActionDel::DeleteCellEntries(); + friend void ScChangeActionMove::DeleteCellEntries(); + friend sal_Bool ScChangeActionMove::Reject( ScDocument* pDoc ); + + static const SCROW nContentRowsPerSlot; + static const SCSIZE nContentSlots; + + com::sun::star::uno::Sequence< sal_Int8 > aProtectPass; + ScChangeActionTable aTable; + ScChangeActionTable aGeneratedTable; + ScChangeActionTable aPasteCutTable; + ScChangeTrackMsgQueue aMsgQueue; + ScChangeTrackMsgStack aMsgStackTmp; + ScChangeTrackMsgStack aMsgStackFinal; + ScStrCollection aUserCollection; + String aUser; + Link aModifiedLink; + ScRange aInDeleteRange; + DateTime aFixDateTime; + ScChangeAction* pFirst; + ScChangeAction* pLast; + ScChangeActionContent* pFirstGeneratedDelContent; + ScChangeActionContent** ppContentSlots; + ScChangeActionMove* pLastCutMove; + ScChangeActionLinkEntry* pLinkInsertCol; + ScChangeActionLinkEntry* pLinkInsertRow; + ScChangeActionLinkEntry* pLinkInsertTab; + ScChangeActionLinkEntry* pLinkMove; + ScChangeTrackMsgInfo* pBlockModifyMsg; + ScDocument* pDoc; + sal_uLong nActionMax; + sal_uLong nGeneratedMin; + sal_uLong nMarkLastSaved; + sal_uLong nStartLastCut; + sal_uLong nEndLastCut; + sal_uLong nLastMerge; + ScChangeTrackMergeState eMergeState; + sal_uInt16 nLoadedFileFormatVersion; + sal_Bool bLoadSave; + sal_Bool bInDelete; + sal_Bool bInDeleteUndo; + sal_Bool bInDeleteTop; + sal_Bool bInPasteCut; + sal_Bool bUseFixDateTime; + sal_Bool bTime100thSeconds; + + // not implemented, prevent usage + ScChangeTrack( const ScChangeTrack& ); + ScChangeTrack& operator=( const ScChangeTrack& ); + +#ifdef SC_CHGTRACK_CXX + static SCROW InitContentRowsPerSlot(); + + // sal_True if one is MM_FORMULA and the other is + // not, or if both are and range differs + static sal_Bool IsMatrixFormulaRangeDifferent( + const ScBaseCell* pOldCell, + const ScBaseCell* pNewCell ); + + void Init(); + void DtorClear(); + void SetLoadSave( sal_Bool bVal ) { bLoadSave = bVal; } + void SetInDeleteRange( const ScRange& rRange ) + { aInDeleteRange = rRange; } + void SetInDelete( sal_Bool bVal ) + { bInDelete = bVal; } + void SetInDeleteTop( sal_Bool bVal ) + { bInDeleteTop = bVal; } + void SetInDeleteUndo( sal_Bool bVal ) + { bInDeleteUndo = bVal; } + void SetInPasteCut( sal_Bool bVal ) + { bInPasteCut = bVal; } + void SetMergeState( ScChangeTrackMergeState eState ) + { eMergeState = eState; } + ScChangeTrackMergeState GetMergeState() const { return eMergeState; } + void SetLastMerge( sal_uLong nVal ) { nLastMerge = nVal; } + sal_uLong GetLastMerge() const { return nLastMerge; } + + void SetLastCutMoveRange( const ScRange&, ScDocument* ); + + // create block of ModifyMsg + void StartBlockModify( ScChangeTrackMsgType, + sal_uLong nStartAction ); + void EndBlockModify( sal_uLong nEndAction ); + + void AddDependentWithNotify( ScChangeAction* pParent, + ScChangeAction* pDependent ); + + void Dependencies( ScChangeAction* ); + void UpdateReference( ScChangeAction*, sal_Bool bUndo ); + void UpdateReference( ScChangeAction** ppFirstAction, + ScChangeAction* pAct, sal_Bool bUndo ); + void Append( ScChangeAction* pAppend, sal_uLong nAction ); + SC_DLLPUBLIC void AppendDeleteRange( const ScRange&, + ScDocument* pRefDoc, SCsTAB nDz, + sal_uLong nRejectingInsert ); + void AppendOneDeleteRange( const ScRange& rOrgRange, + ScDocument* pRefDoc, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + sal_uLong nRejectingInsert ); + void LookUpContents( const ScRange& rOrgRange, + ScDocument* pRefDoc, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void Remove( ScChangeAction* ); + void MasterLinks( ScChangeAction* ); + + // Content on top an Position + ScChangeActionContent* SearchContentAt( const ScBigAddress&, + ScChangeAction* pButNotThis ) const; + void DeleteGeneratedDelContent( + ScChangeActionContent* ); + ScChangeActionContent* GenerateDelContent( const ScAddress&, + const ScBaseCell*, + const ScDocument* pFromDoc ); + void DeleteCellEntries( + ScChangeActionCellListEntry*&, + ScChangeAction* pDeletor ); + + // Reject action and all dependent actions, + // Table stems from previous GetDependents, + // only needed for Insert and Move (MasterType), + // is NULL otherwise. + // bRecursion == called from reject with table + sal_Bool Reject( ScChangeAction*, + ScChangeActionTable*, sal_Bool bRecursion ); + +#endif // SC_CHGTRACK_CXX + + void ClearMsgQueue(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); + +public: + + static SCSIZE ComputeContentSlot( sal_Int32 nRow ) + { + if ( nRow < 0 || nRow > MAXROW ) + return nContentSlots - 1; + return static_cast< SCSIZE >( nRow / nContentRowsPerSlot ); + } + + SC_DLLPUBLIC ScChangeTrack( ScDocument* ); + ScChangeTrack( ScDocument*, + const ScStrCollection& ); // only to use in the XML import + SC_DLLPUBLIC virtual ~ScChangeTrack(); + void Clear(); + + ScChangeActionContent* GetFirstGenerated() const { return pFirstGeneratedDelContent; } + ScChangeAction* GetFirst() const { return pFirst; } + ScChangeAction* GetLast() const { return pLast; } + sal_uLong GetActionMax() const { return nActionMax; } + sal_Bool IsGenerated( sal_uLong nAction ) const + { return nAction >= nGeneratedMin; } + ScChangeAction* GetAction( sal_uLong nAction ) const + { return aTable.Get( nAction ); } + ScChangeAction* GetGenerated( sal_uLong nGenerated ) const + { return aGeneratedTable.Get( nGenerated ); } + ScChangeAction* GetActionOrGenerated( sal_uLong nAction ) const + { + return IsGenerated( nAction ) ? + GetGenerated( nAction ) : + GetAction( nAction ); + } + sal_uLong GetLastSavedActionNumber() const + { return nMarkLastSaved; } + void SetLastSavedActionNumber(sal_uLong nNew) + { nMarkLastSaved = nNew; } + ScChangeAction* GetLastSaved() const + { return aTable.Get( nMarkLastSaved ); } + ScChangeActionContent** GetContentSlots() const { return ppContentSlots; } + + sal_Bool IsLoadSave() const { return bLoadSave; } + const ScRange& GetInDeleteRange() const + { return aInDeleteRange; } + sal_Bool IsInDelete() const { return bInDelete; } + sal_Bool IsInDeleteTop() const { return bInDeleteTop; } + sal_Bool IsInDeleteUndo() const { return bInDeleteUndo; } + sal_Bool IsInPasteCut() const { return bInPasteCut; } + SC_DLLPUBLIC void SetUser( const String& ); + const String& GetUser() const { return aUser; } + const ScStrCollection& GetUserCollection() const + { return aUserCollection; } + ScDocument* GetDocument() const { return pDoc; } + // for import filter + const DateTime& GetFixDateTime() const { return aFixDateTime; } + + // set this if the date/time set with + // SetFixDateTime...() shall be applied to + // appended actions + void SetUseFixDateTime( sal_Bool bVal ) + { bUseFixDateTime = bVal; } + // for MergeDocument, apply original date/time as UTC + void SetFixDateTimeUTC( const DateTime& rDT ) + { aFixDateTime = rDT; } + // for import filter, apply original date/time as local time + void SetFixDateTimeLocal( const DateTime& rDT ) + { aFixDateTime = rDT; aFixDateTime.ConvertToUTC(); } + + void Append( ScChangeAction* ); + + // pRefDoc may be NULL => no lookup of contents + // => no generation of deleted contents + SC_DLLPUBLIC void AppendDeleteRange( const ScRange&, + ScDocument* pRefDoc, + sal_uLong& nStartAction, sal_uLong& nEndAction, + SCsTAB nDz = 0 ); + // nDz: multi TabDel, LookUpContent must be searched + // with an offset of -nDz + + // after new value was set in the document, + // old value from RefDoc/UndoDoc + void AppendContent( const ScAddress& rPos, + ScDocument* pRefDoc ); + // after new values were set in the document, + // old values from RefDoc/UndoDoc + void AppendContentRange( const ScRange& rRange, + ScDocument* pRefDoc, + sal_uLong& nStartAction, sal_uLong& nEndAction, + ScChangeActionClipMode eMode = SC_CACM_NONE ); + // after new value was set in the document, + // old value from pOldCell, nOldFormat, + // RefDoc==NULL => Doc + void AppendContent( const ScAddress& rPos, + const ScBaseCell* pOldCell, + sal_uLong nOldFormat, ScDocument* pRefDoc = NULL ); + // after new value was set in the document, + // old value from pOldCell, format from Doc + void AppendContent( const ScAddress& rPos, + const ScBaseCell* pOldCell ); + // after new values were set in the document, + // old values from RefDoc/UndoDoc. + // All contents with a cell in RefDoc + void AppendContentsIfInRefDoc( ScDocument* pRefDoc, + sal_uLong& nStartAction, sal_uLong& nEndAction ); + + // Meant for import filter, creates and inserts + // an unconditional content action of the two + // cells without querying the document, not + // even for number formats (though the number + // formatter of the document may be used). + // The action is returned and may be used to + // set user name, description, date/time et al. + // Takes ownership of the cells! + SC_DLLPUBLIC ScChangeActionContent* AppendContentOnTheFly( const ScAddress& rPos, + ScBaseCell* pOldCell, + ScBaseCell* pNewCell, + sal_uLong nOldFormat = 0, + sal_uLong nNewFormat = 0 ); + + // Only use the following two if there is no different solution! + // (Assign String for NewValue or creation of a formula respectively) + + SC_DLLPUBLIC void AppendInsert( const ScRange& ); + + // pRefDoc may be NULL => no lookup of contents + // => no generation of deleted contents + SC_DLLPUBLIC void AppendMove( const ScRange& rFromRange, + const ScRange& rToRange, + ScDocument* pRefDoc ); + + // Cut to Clipboard + void ResetLastCut() + { + nStartLastCut = nEndLastCut = 0; + if ( pLastCutMove ) + { + delete pLastCutMove; + pLastCutMove = NULL; + } + } + sal_Bool HasLastCut() const + { + return nEndLastCut > 0 && + nStartLastCut <= nEndLastCut && + pLastCutMove; + } + + SC_DLLPUBLIC void Undo( sal_uLong nStartAction, sal_uLong nEndAction, bool bMerge = false ); + + // adjust references for MergeDocument + //! may only be used in a temporary opened document. + //! the Track (?) is unclean afterwards + void MergePrepare( ScChangeAction* pFirstMerge, bool bShared = false ); + void MergeOwn( ScChangeAction* pAct, sal_uLong nFirstMerge, bool bShared = false ); + static sal_Bool MergeIgnore( const ScChangeAction&, sal_uLong nFirstMerge ); + + // This comment was already really strange in German. + // Tried to structure it a little. Hope no information got lost... + // + // Insert dependents into table. + // ScChangeAction is + // - "Insert": really dependents + // - "Move": dependent contents in FromRange / + // deleted contents in ToRange + // OR inserts in FromRange or ToRange + // - "Delete": a list of deleted (what?) + // OR for content, different contents at the same position + // OR MatrixReferences belonging to MatrixOrigin + // + // With bListMasterDelete (==TRUE ?) all Deletes of a row belonging + // to a MasterDelete are listed (possibly it is + // "all Deletes belonging...are listed in a row?) + // + // With bAllFlat (==TRUE ?) all dependents of dependents + // will be inserted flatly. + + SC_DLLPUBLIC void GetDependents( ScChangeAction*, + ScChangeActionTable&, + sal_Bool bListMasterDelete = false, + sal_Bool bAllFlat = false ) const; + + // Reject visible action (and dependents) + sal_Bool Reject( ScChangeAction*, bool bShared = false ); + + // Accept visible action (and dependents) + SC_DLLPUBLIC sal_Bool Accept( ScChangeAction* ); + + void AcceptAll(); // all Virgins + sal_Bool RejectAll(); // all Virgins + + // Selects a content of several contents at the same + // position and accepts this one and + // the older ones, rejects the more recent ones. + // If bOldest==TRUE then the first OldValue + // of a Virgin-Content-List will be restored. + sal_Bool SelectContent( ScChangeAction*, + sal_Bool bOldest = false ); + + // If ModifiedLink is set, changes go to + // ScChangeTrackMsgQueue + void SetModifiedLink( const Link& r ) + { aModifiedLink = r; ClearMsgQueue(); } + const Link& GetModifiedLink() const { return aModifiedLink; } + ScChangeTrackMsgQueue& GetMsgQueue() { return aMsgQueue; } + + void NotifyModified( ScChangeTrackMsgType eMsgType, + sal_uLong nStartAction, sal_uLong nEndAction ); + + sal_uInt16 GetLoadedFileFormatVersion() const + { return nLoadedFileFormatVersion; } + + sal_uLong AddLoadedGenerated(ScBaseCell* pOldCell, + const ScBigRange& aBigRange, const String& sNewValue ); // only to use in the XML import + void AppendLoaded( ScChangeAction* pAppend ); // this is only for the XML import public, it should be protected + void SetActionMax(sal_uLong nTempActionMax) + { nActionMax = nTempActionMax; } // only to use in the XML import + + void SetProtection( const com::sun::star::uno::Sequence< sal_Int8 >& rPass ) + { aProtectPass = rPass; } + com::sun::star::uno::Sequence< sal_Int8 > GetProtection() const + { return aProtectPass; } + sal_Bool IsProtected() const + { return aProtectPass.getLength() != 0; } + + // If time stamps of actions of this + // ChangeTrack and a second one are to be + // compared including 100th seconds. + void SetTime100thSeconds( sal_Bool bVal ) + { bTime100thSeconds = bVal; } + sal_Bool IsTime100thSeconds() const + { return bTime100thSeconds; } + + void AppendCloned( ScChangeAction* pAppend ); + SC_DLLPUBLIC ScChangeTrack* Clone( ScDocument* pDocument ) const; + void MergeActionState( ScChangeAction* pAct, const ScChangeAction* pOtherAct ); +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/chgviset.hxx b/sc/inc/chgviset.hxx new file mode 100644 index 000000000000..630128a8be94 --- /dev/null +++ b/sc/inc/chgviset.hxx @@ -0,0 +1,151 @@ +/* -*- 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. + * + ************************************************************************/ +#ifndef SC_CHGVISET_HXX +#define SC_CHGVISET_HXX + +#include <tools/datetime.hxx> +#include <tools/string.hxx> +#include "rangelst.hxx" +#include "scdllapi.h" + +enum ScChgsDateMode{ SCDM_DATE_BEFORE=0,SCDM_DATE_SINCE=1,SCDM_DATE_EQUAL=2, + SCDM_DATE_NOTEQUAL=3,SCDM_DATE_BETWEEN=4, SCDM_DATE_SAVE=5, + SCDM_NO_DATEMODE=6}; + +namespace utl { + class TextSearch; +} + +class ScDocument; + +class SC_DLLPUBLIC ScChangeViewSettings +{ +private: + + utl::TextSearch* pCommentSearcher; + DateTime aFirstDateTime; + DateTime aLastDateTime; + String aAuthorToShow; + String aComment; + ScRangeList aRangeList; + ScChgsDateMode eDateMode; + sal_Bool bShowIt; + sal_Bool bIsDate; + sal_Bool bIsAuthor; + sal_Bool bIsComment; + sal_Bool bIsRange; + sal_Bool bEveryoneButMe; + sal_Bool bShowAccepted; + sal_Bool bShowRejected; + bool mbIsActionRange; + sal_uLong mnFirstAction; + sal_uLong mnLastAction; + +public: + + ScChangeViewSettings() + { + pCommentSearcher=NULL; + bIsDate=false; + bIsAuthor=false; + bIsRange=false; + bIsComment=false; + bShowIt=false; + eDateMode=SCDM_DATE_BEFORE; + bEveryoneButMe=false; + bShowAccepted=false; + bShowRejected=false; + mbIsActionRange = false; + } + + ScChangeViewSettings( const ScChangeViewSettings& r ); + + ~ScChangeViewSettings(); + + sal_Bool ShowChanges() const {return bShowIt;} + void SetShowChanges(sal_Bool nFlag=sal_True){bShowIt=nFlag;} + + sal_Bool HasDate() const {return bIsDate;} + void SetHasDate(sal_Bool nFlag=sal_True) {bIsDate=nFlag;} + + void SetTheDateMode(ScChgsDateMode eDatMod){ eDateMode=eDatMod; } + ScChgsDateMode GetTheDateMode() const { return eDateMode; } + + void SetTheFirstDateTime(const DateTime& aDateTime) {aFirstDateTime=aDateTime;} + const DateTime& GetTheFirstDateTime()const {return aFirstDateTime;} + + void SetTheLastDateTime(const DateTime& aDateTime) {aLastDateTime=aDateTime;} + const DateTime& GetTheLastDateTime()const {return aLastDateTime;} + + + sal_Bool HasAuthor() const {return bIsAuthor;} + void SetHasAuthor(sal_Bool nFlag=sal_True) {bIsAuthor=nFlag;} + + String GetTheAuthorToShow()const {return aAuthorToShow;} + void SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;} + + sal_Bool HasComment() const {return bIsComment;} + void SetHasComment(sal_Bool nFlag=sal_True) {bIsComment=nFlag;} + + String GetTheComment()const {return aComment;} + void SetTheComment(const String& aString); + + sal_Bool IsValidComment(const String* pCommentStr) const; + + sal_Bool IsEveryoneButMe() const {return bEveryoneButMe;} + void SetEveryoneButMe(sal_Bool nFlag=sal_True) {bEveryoneButMe=nFlag;} + + + sal_Bool HasRange() const {return bIsRange;} + void SetHasRange(sal_Bool nFlag=sal_True) {bIsRange=nFlag;} + + const ScRangeList& GetTheRangeList()const {return aRangeList;} + void SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;} + + sal_Bool IsShowAccepted() const { return bShowAccepted; } + void SetShowAccepted( sal_Bool bVal ) { bShowAccepted = bVal; } + + sal_Bool IsShowRejected() const { return bShowRejected; } + void SetShowRejected( sal_Bool bVal ) { bShowRejected = bVal; } + + ScChangeViewSettings& operator= ( const ScChangeViewSettings& r ); + + /// Adjust dates according to selected DateMode + void AdjustDateMode( const ScDocument& rDoc ); + + bool HasActionRange() const { return mbIsActionRange; } + void SetHasActionRange( bool nFlag = true ) { mbIsActionRange = nFlag; } + void GetTheActionRange( sal_uLong& nFirst, sal_uLong& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; } + void SetTheActionRange( sal_uLong nFirst, sal_uLong nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; } +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx new file mode 100644 index 000000000000..f8a4038eaca4 --- /dev/null +++ b/sc/inc/clipparam.hxx @@ -0,0 +1,97 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CLIPPARAM_HXX +#define SC_CLIPPARAM_HXX + +#include "rangelst.hxx" +#include "rangenam.hxx" +#include "charthelper.hxx" + +#include <vector> + +/** + * This struct stores general clipboard parameters associated with a + * ScDocument instance created in clipboard mode. + */ +struct ScClipParam +{ + enum Direction { Unspecified, Column, Row }; + + ScRangeList maRanges; + Direction meDirection; + bool mbCutMode; + sal_uInt32 mnSourceDocID; + ScRangeListVector maProtectedChartRangesVector; + + ScClipParam(); + ScClipParam(const ScRange& rRange, bool bCutMode); + explicit ScClipParam(const ScClipParam& r); + + bool isMultiRange() const; + + /** + * Get the column size of a pasted range. Note that when the range is + * non-contiguous, we first compress all individual ranges into a single + * range, and the size of that compressed range is returned. + */ + SCCOL getPasteColSize(); + + /** + * Same as the above method, but returns the row size of the compressed + * range. + */ + SCROW getPasteRowSize(); + + /** + * Return a single range that encompasses all individual ranges. + */ + ScRange getWholeRange() const; + + void transpose(); + + sal_uInt32 getSourceDocID() const { return mnSourceDocID; } + void setSourceDocID( sal_uInt32 nVal ) { mnSourceDocID = nVal; } +}; + +// ============================================================================ + +struct ScClipRangeNameData +{ + ScRangeData::IndexMap maRangeMap; + ::std::vector<ScRangeData*> mpRangeNames; // Don't insert NULL pointers. + bool mbReplace; + + ScClipRangeNameData(); + ~ScClipRangeNameData(); + void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx new file mode 100644 index 000000000000..bc4144fca17c --- /dev/null +++ b/sc/inc/collect.hxx @@ -0,0 +1,202 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_COLLECT_HXX +#define SC_COLLECT_HXX + +#include "address.hxx" +#include <tools/string.hxx> + +#ifndef INCLUDED_LIMITS_H +#include <limits.h> +#define INCLUDED_LIMITS_H +#endif +#include "scdllapi.h" + +#define MAXCOLLECTIONSIZE 16384 +#define MAXDELTA 1024 +#define SCPOS_INVALID USHRT_MAX + +#define SC_STRTYPE_VALUE 0 +#define SC_STRTYPE_STANDARD 1 + +class ScDocument; + +class SC_DLLPUBLIC ScDataObject +{ +public: + ScDataObject() {} + virtual ~ScDataObject(); + virtual ScDataObject* Clone() const = 0; +}; + +class SC_DLLPUBLIC ScCollection : public ScDataObject +{ +protected: + sal_uInt16 nCount; + sal_uInt16 nLimit; + sal_uInt16 nDelta; + ScDataObject** pItems; +public: + ScCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4); + ScCollection(const ScCollection& rCollection); + virtual ~ScCollection(); + + virtual ScDataObject* Clone() const; + + void AtFree(sal_uInt16 nIndex); + void Free(ScDataObject* pScDataObject); + void FreeAll(); + + sal_Bool AtInsert(sal_uInt16 nIndex, ScDataObject* pScDataObject); + virtual sal_Bool Insert(ScDataObject* pScDataObject); + + ScDataObject* At(sal_uInt16 nIndex) const; + virtual sal_uInt16 IndexOf(ScDataObject* pScDataObject) const; + sal_uInt16 GetCount() const; + + ScDataObject* operator[]( const sal_uInt16 nIndex) const {return At(nIndex);} + ScCollection& operator=( const ScCollection& rCol ); +}; + + +class SC_DLLPUBLIC ScSortedCollection : public ScCollection +{ +private: + sal_Bool bDuplicates; +protected: + // for ScStrCollection load/store + void SetDups( sal_Bool bVal ) { bDuplicates = bVal; } + sal_Bool IsDups() const { return bDuplicates; } +public: + ScSortedCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false); + ScSortedCollection(const ScSortedCollection& rScSortedCollection) : + ScCollection(rScSortedCollection), + bDuplicates(rScSortedCollection.bDuplicates) {} + + virtual sal_uInt16 IndexOf(ScDataObject* pScDataObject) const; + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const = 0; + virtual sal_Bool IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; + sal_Bool Search(ScDataObject* pScDataObject, sal_uInt16& rIndex) const; + virtual sal_Bool Insert(ScDataObject* pScDataObject); + virtual sal_Bool InsertPos(ScDataObject* pScDataObject, sal_uInt16& nIndex); + + sal_Bool operator==(const ScSortedCollection& rCmp) const; +}; + + + +//------------------------------------------------------------------------ +class StrData : public ScDataObject +{ +friend class ScStrCollection; + String aStr; +public: + StrData(const String& rStr) : aStr(rStr) {} + StrData(const StrData& rData) : ScDataObject(), aStr(rData.aStr) {} + virtual ScDataObject* Clone() const; + const String& GetString() const { return aStr; } + // SetString only, if StrData is not in ScStrCollection! for example + // for Searcher + void SetString( const String& rNew ) { aStr = rNew; } +}; + +class SvStream; + +class SC_DLLPUBLIC ScStrCollection : public ScSortedCollection +{ +public: + ScStrCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false) : + ScSortedCollection ( nLim, nDel, bDup ) {} + ScStrCollection(const ScStrCollection& rScStrCollection) : + ScSortedCollection ( rScStrCollection ) {} + + virtual ScDataObject* Clone() const; + StrData* operator[]( const sal_uInt16 nIndex) const {return (StrData*)At(nIndex);} + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; +}; + +//------------------------------------------------------------------------ +// TypedScStrCollection: wie ScStrCollection, nur, dass Zahlen vor Strings +// sortiert werden + +class TypedStrData : public ScDataObject +{ +public: + TypedStrData( const String& rStr, double nVal = 0.0, + sal_uInt16 nType = SC_STRTYPE_STANDARD ) + : aStrValue(rStr), + nValue(nVal), + nStrType(nType) {} + + TypedStrData( const TypedStrData& rCpy ) + : ScDataObject(), + aStrValue(rCpy.aStrValue), + nValue(rCpy.nValue), + nStrType(rCpy.nStrType) {} + + virtual ScDataObject* Clone() const; + + sal_Bool IsStrData() const { return nStrType != 0; } + const String& GetString() const { return aStrValue; } + double GetValue () const { return nValue; } + +private: + friend class TypedScStrCollection; + + String aStrValue; + double nValue; + sal_uInt16 nStrType; // 0 = Value +}; + +class SC_DLLPUBLIC TypedScStrCollection : public ScSortedCollection +{ +private: + sal_Bool bCaseSensitive; + +public: + TypedScStrCollection( sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false ); + + TypedScStrCollection( const TypedScStrCollection& rCpy ) + : ScSortedCollection( rCpy ) { bCaseSensitive = rCpy.bCaseSensitive; } + ~TypedScStrCollection(); + + virtual ScDataObject* Clone() const; + virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; + + TypedStrData* operator[]( const sal_uInt16 nIndex) const; + + void SetCaseSensitive( sal_Bool bSet ); + + sal_Bool FindText( const String& rStart, String& rResult, sal_uInt16& rPos, sal_Bool bBack ) const; + sal_Bool GetExactMatch( String& rString ) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx new file mode 100644 index 000000000000..c06d4786a286 --- /dev/null +++ b/sc/inc/column.hxx @@ -0,0 +1,453 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_COLUMN_HXX +#define SC_COLUMN_HXX + +#include "markarr.hxx" +#include "global.hxx" +#include "address.hxx" +#include "rangenam.hxx" + +#include <set> + +namespace editeng { class SvxBorderLine; } + +class Fraction; +class OutputDevice; +class Rectangle; +class SfxBroadcaster; +class SfxItemPoolCache; +class SfxItemSet; +class SvtListener; +class SfxPoolItem; +class SfxStyleSheetBase; +class SvxBoxInfoItem; +class SvxBoxItem; + +class ScAttrIterator; +class ScAttrArray; +struct ScAttrEntry; +class ScBaseCell; +class ScDocument; +class ScEditDataArray; +class ScFormulaCell; +class ScMarkData; +class ScPatternAttr; +class ScStyleSheet; +class SvtBroadcaster; +class TypedScStrCollection; +class ScProgress; +class ScPostIt; +struct ScFunctionData; +struct ScLineFlags; +struct ScMergePatternState; +class ScFlatBoolRowSegments; +struct ScSetStringParam; +struct ScColWidthParam; + +#define COLUMN_DELTA 4 + + +struct ScNeededSizeOptions +{ + const ScPatternAttr* pPattern; + bool bFormula; + bool bSkipMerged; + bool bGetFont; + bool bTotalSize; + + ScNeededSizeOptions() + { + pPattern = NULL; + bFormula = false; + bSkipMerged = true; + bGetFont = true; + bTotalSize = false; + } +}; + +struct ColEntry +{ + SCROW nRow; + ScBaseCell* pCell; +}; + + +class ScColumn +{ +private: + SCCOL nCol; + SCTAB nTab; + + SCSIZE nCount; + SCSIZE nLimit; + ColEntry* pItems; + + ScAttrArray* pAttrArray; + ScDocument* pDocument; + +friend class ScDocument; // for FillInfo +friend class ScDocumentIterator; +friend class ScValueIterator; +friend class ScDBQueryDataIterator; +friend class ScColumnIterator; +friend class ScQueryCellIterator; +friend class ScMarkedDataIter; +friend class ScCellIterator; +friend class ScHorizontalCellIterator; +friend class ScHorizontalAttrIterator; + +public: + static bool bDoubleAlloc; // for Import: double size for alloc + + class DoubleAllocSwitch + { + public: + DoubleAllocSwitch(bool bNewVal = true); + ~DoubleAllocSwitch(); + private: + bool mbOldVal; + }; +public: + ScColumn(); + ~ScColumn(); + + void Init(SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc); + + bool Search( SCROW nRow, SCSIZE& nIndex ) const; + ScBaseCell* GetCell( SCROW nRow ) const; + void Insert( SCROW nRow, ScBaseCell* pCell ); + void Insert( SCROW nRow, sal_uInt32 nFormatIndex, ScBaseCell* pCell ); + void Append( SCROW nRow, ScBaseCell* pCell ); + void Delete( SCROW nRow ); + void DeleteAtIndex( SCSIZE nIndex ); + void FreeAll(); + void Resize( SCSIZE nSize ); + void SwapRow( SCROW nRow1, SCROW nRow2 ); + void SwapCell( SCROW nRow, ScColumn& rCol); + + bool HasAttrib( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const; + bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const; + bool ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, + SCCOL& rPaintCol, SCROW& rPaintRow, + bool bRefresh, bool bAttrs ); + + bool IsEmptyVisData(bool bNotes) const; // without Broadcaster + bool IsEmptyData() const; + bool IsEmptyAttr() const; + bool IsEmpty() const; + + // data only: + bool IsEmptyBlock(SCROW nStartRow, SCROW nEndRow, bool bIgnoreNotes = false) const; + SCSIZE GetEmptyLinesInBlock( SCROW nStartRow, SCROW nEndRow, ScDirection eDir ) const; + bool HasDataAt(SCROW nRow) const; + bool HasVisibleDataAt(SCROW nRow) const; + SCROW GetFirstDataPos() const; + SCROW GetLastDataPos() const; + SCROW GetLastVisDataPos(bool bNotes) const; // without Broadcaster + SCROW GetFirstVisDataPos(bool bNotes) const; + bool GetPrevDataPos(SCROW& rRow) const; + bool GetNextDataPos(SCROW& rRow) const; + void FindDataAreaPos(SCROW& rRow, long nMovY) const; // (without Broadcaster) + void FindUsed( SCROW nStartRow, SCROW nEndRow, bool* pUsed ) const; + + SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const; + sal_uInt16 GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, sal_uInt16 nMask ) const; + bool HasSelectionMatrixFragment(const ScMarkData& rMark) const; + + bool GetFirstVisibleAttr( SCROW& rFirstRow ) const; + bool GetLastVisibleAttr( SCROW& rLastRow ) const; + bool HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const; + bool IsVisibleAttrEqual( const ScColumn& rCol, SCROW nStartRow = 0, + SCROW nEndRow = MAXROW ) const; + bool IsAllAttrEqual( const ScColumn& rCol, SCROW nStartRow, SCROW nEndRow ) const; + + bool TestInsertCol( SCROW nStartRow, SCROW nEndRow) const; + bool TestInsertRow( SCSIZE nSize ) const; + void InsertRow( SCROW nStartRow, SCSIZE nSize ); + void DeleteRow( SCROW nStartRow, SCSIZE nSize ); + void DeleteRange( SCSIZE nStartIndex, SCSIZE nEndIndex, sal_uInt16 nDelFlag ); + void DeleteArea(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nDelFlag ); + void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, bool bKeepScenarioFlags, bool bCloneNoteCaptions); + void CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy, + sal_uInt16 nInsFlag, bool bAsLink, bool bSkipAttrForEmpty, ScColumn& rColumn); + void StartListeningInArea( SCROW nRow1, SCROW nRow2 ); + void BroadcastInArea( SCROW nRow1, SCROW nRow2 ); + + void RemoveEditAttribs( SCROW nStartRow, SCROW nEndRow ); + + // Selection (?) of this document + void MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction, + bool bSkipEmpty, ScColumn& rSrcCol ); + void MixData( SCROW nRow1, SCROW nRow2, sal_uInt16 nFunction, bool bSkipEmpty, + ScColumn& rSrcCol ); + + ScFormulaCell* CreateRefCell( ScDocument* pDestDoc, const ScAddress& rDestPos, + SCSIZE nIndex, sal_uInt16 nFlags ) const; + + ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const; + + + SCCOL GetCol() const { return nCol; } + + // UpdateSelectionFunction: multi-select + void UpdateSelectionFunction( const ScMarkData& rMark, + ScFunctionData& rData, + ScFlatBoolRowSegments& rHiddenRows, + bool bDoExclude, SCROW nExStartRow, SCROW nExEndRow ); + void UpdateAreaFunction( ScFunctionData& rData, + ScFlatBoolRowSegments& rHiddenRows, + SCROW nStartRow, SCROW nEndRow ); + + void CopyToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, + ScColumn& rColumn, const ScMarkData* pMarkData = NULL, + bool bAsLink = false ); + void UndoToColumn(SCROW nRow1, SCROW nRow2, sal_uInt16 nFlags, bool bMarked, + ScColumn& rColumn, const ScMarkData* pMarkData = NULL ); + + void CopyScenarioFrom( const ScColumn& rSrcCol ); + void CopyScenarioTo( ScColumn& rDestCol ) const; + bool TestCopyScenarioTo( const ScColumn& rDestCol ) const; + void MarkScenarioIn( ScMarkData& rDestMark ) const; + + void CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const; + + void SwapCol(ScColumn& rCol); + void MoveTo(SCROW nStartRow, SCROW nEndRow, ScColumn& rCol); + + + bool HasEditCells(SCROW nStartRow, SCROW nEndRow, SCROW& rFirst) const; + + // TRUE = format for numbers is set + bool SetString( SCROW nRow, SCTAB nTab, const String& rString, + formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO, + ScSetStringParam* pParam = NULL ); + void SetValue( SCROW nRow, const double& rVal); + void SetError( SCROW nRow, const sal_uInt16 nError); + + void GetString( SCROW nRow, String& rString ) const; + void GetInputString( SCROW nRow, String& rString ) const; + double GetValue( SCROW nRow ) const; + void GetFormula( SCROW nRow, String& rFormula ) const; + CellType GetCellType( SCROW nRow ) const; + SCSIZE GetCellCount() const { return nCount; } + sal_uInt32 GetWeightedCount() const; + sal_uInt32 GetCodeCount() const; // RPN-Code in formulas + sal_uInt16 GetErrCode( SCROW nRow ) const; + + bool HasStringData( SCROW nRow ) const; + bool HasValueData( SCROW nRow ) const; + bool HasStringCells( SCROW nStartRow, SCROW nEndRow ) const; + + /** Returns the pointer to a cell note object at the passed row. */ + ScPostIt* GetNote( SCROW nRow ); + /** Sets the passed cell note object at the passed row. Takes ownership! */ + void TakeNote( SCROW nRow, ScPostIt* pNote ); + /** Returns and forgets a cell note object at the passed row. */ + ScPostIt* ReleaseNote( SCROW nRow ); + /** Deletes the note at the passed row. */ + void DeleteNote( SCROW nRow ); + + void SetDirty(); + void SetDirty( const ScRange& ); + void SetDirtyVar(); + void SetDirtyAfterLoad(); + void SetTableOpDirty( const ScRange& ); + void CalcAll(); + void CalcAfterLoad(); + void CompileAll(); + void CompileXML( ScProgress& rProgress ); + + void ResetChanged( SCROW nStartRow, SCROW nEndRow ); + + bool UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + ScDocument* pUndoDoc = NULL ); + void UpdateInsertTab( SCTAB nTable); + void UpdateInsertTabOnlyCells( SCTAB nTable); + void UpdateDeleteTab( SCTAB nTable, bool bIsMove, ScColumn* pRefUndo = NULL ); + void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo); + void UpdateCompile( bool bForceIfNameInUse = false ); + void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest, + ScDocument* pUndoDoc ); + void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); + + void SetTabNo(SCTAB nNewTab); + bool IsRangeNameInUse(SCROW nRow1, SCROW nRow2, sal_uInt16 nIndex) const; + void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<sal_uInt16>& rIndexes) const; + void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap ); + + const SfxPoolItem* GetAttr( SCROW nRow, sal_uInt16 nWhich ) const; + const ScPatternAttr* GetPattern( SCROW nRow ) const; + const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const; + + sal_uInt32 GetNumberFormat( SCROW nRow ) const; + sal_uInt32 GetNumberFormat( SCROW nStartRow, SCROW nEndRow ) const; + + void MergeSelectionPattern( ScMergePatternState& rState, const ScMarkData& rMark, bool bDeep ) const; + void MergePatternArea( ScMergePatternState& rState, SCROW nRow1, SCROW nRow2, bool bDeep ) const; + void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner, + ScLineFlags& rFlags, + SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ) const; + void ApplyBlockFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner, + SCROW nStartRow, SCROW nEndRow, bool bLeft, SCCOL nDistRight ); + + void ApplyAttr( SCROW nRow, const SfxPoolItem& rAttr ); + void ApplyPattern( SCROW nRow, const ScPatternAttr& rPatAttr ); + void ApplyPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr& rPatAttr, + ScEditDataArray* pDataArray = NULL ); + bool SetAttrEntries(ScAttrEntry* pData, SCSIZE nSize); + void SetPattern( SCROW nRow, const ScPatternAttr& rPatAttr, bool bPutToPool = false ); + void SetPatternArea( SCROW nStartRow, SCROW nEndRow, + const ScPatternAttr& rPatAttr, bool bPutToPool = false ); + void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange, + const ScPatternAttr& rPattern, short nNewType ); + + void ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle ); + void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle ); + void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark); + void ApplySelectionLineStyle( const ScMarkData& rMark, + const ::editeng::SvxBorderLine* pLine, bool bColorOnly ); + + const ScStyleSheet* GetStyle( SCROW nRow ) const; + const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const; + const ScStyleSheet* GetAreaStyle( bool& rFound, SCROW nRow1, SCROW nRow2 ) const; + + void FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset ); + bool IsStyleSheetUsed( const ScStyleSheet& rStyle, bool bGatherAllStyles ) const; + + /// May return -1 if not found + SCsROW SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, + bool bUp, bool bInSelection, const ScMarkData& rMark ); + bool SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, + bool bUp, bool bInSelection, const ScMarkData& rMark ); + + bool ApplyFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); + bool RemoveFlags( SCROW nStartRow, SCROW nEndRow, sal_Int16 nFlags ); + void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich ); + + void RemoveProtected( SCROW nStartRow, SCROW nEndRow ); + + SCsROW ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL ); + void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark ); + + void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark ); + void ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark ); + + long GetNeededSize( SCROW nRow, OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + bool bWidth, const ScNeededSizeOptions& rOptions ); + sal_uInt16 GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + bool bFormula, sal_uInt16 nOldWidth, + const ScMarkData* pMarkData, + const ScColWidthParam* pParam ); + void GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16* pHeight, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + bool bShrink, sal_uInt16 nMinHeight, SCROW nMinStart ); +private: + long GetSimpleTextNeededSize( SCSIZE nIndex, OutputDevice* pDev, + bool bWidth ); +public: + + /// Including current, may return -1 + SCsROW GetNextUnprotected( SCROW nRow, bool bUp ) const; + + void GetFilterEntries(SCROW nStartRow, SCROW nEndRow, TypedScStrCollection& rStrings, bool& rHasDates); + bool GetDataEntries(SCROW nRow, TypedScStrCollection& rStrings, bool bLimit); + + void UpdateInsertTabAbs(SCTAB nNewPos); + bool TestTabRefAbs(SCTAB nTable); + bool GetNextSpellingCell(SCROW& nRow, bool bInSel, const ScMarkData& rData) const; + + void RemoveAutoSpellObj(); + + void StartListening( SvtListener& rLst, SCROW nRow ); + void EndListening( SvtListener& rLst, SCROW nRow ); + void MoveListeners( SvtBroadcaster& rSource, SCROW nDestRow ); + void StartAllListeners(); + void StartNeededListeners(); // only for cells where NeedsListening()==true + void SetRelNameDirty(); + + void CompileDBFormula(); + void CompileDBFormula( bool bCreateFormulaString ); + void CompileNameFormula( bool bCreateFormulaString ); + void CompileColRowNameFormula(); + + sal_Int32 GetMaxStringLen( SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const; + xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision, + SCROW nRowStart, SCROW nRowEnd ) const; + +private: + ScBaseCell* CloneCell(SCSIZE nIndex, sal_uInt16 nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos); +}; + + +class ScColumnIterator // walk through all data of a area/range +{ + const ScColumn* pColumn; + SCSIZE nPos; + SCROW nTop; + SCROW nBottom; +public: + ScColumnIterator( const ScColumn* pCol, SCROW nStart=0, SCROW nEnd=MAXROW ); + ~ScColumnIterator(); + + bool Next( SCROW& rRow, ScBaseCell*& rpCell ); + SCSIZE GetIndex() const; +}; + + +class ScMarkedDataIter // walk through data in a selected area/range +{ + const ScColumn* pColumn; + SCSIZE nPos; + ScMarkArrayIter* pMarkIter; + SCROW nTop; + SCROW nBottom; + bool bNext; + bool bAll; + +public: + ScMarkedDataIter( const ScColumn* pCol, const ScMarkData* pMarkData, + bool bAllIfNone = false ); + ~ScMarkedDataIter(); + + bool Next( SCSIZE& rIndex ); +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx new file mode 100644 index 000000000000..1e6875976e18 --- /dev/null +++ b/sc/inc/compiler.hxx @@ -0,0 +1,547 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_COMPILER_HXX +#define SC_COMPILER_HXX + +#ifndef INCLUDED_STRING_H +#include <string.h> +#define INCLUDED_STRING_H +#endif +#include <tools/mempool.hxx> +#include "scdllapi.h" +#include "global.hxx" +#include "refdata.hxx" +#include "formula/token.hxx" +#include "formula/grammar.hxx" +#include <unotools/charclass.hxx> +#include <rtl/ustrbuf.hxx> +#include <com/sun/star/sheet/ExternalLinkInfo.hpp> +#include <vector> + +#include <formula/FormulaCompiler.hxx> + +#include <boost/intrusive_ptr.hpp> + +#ifndef INCLUDED_HASH_MAP +#include <boost/unordered_map.hpp> +#define INCLUDED_HASH_MAP +#endif + +//----------------------------------------------- + +// constants and data types also for external modules (ScInterpreter et al) + +#define MAXCODE 512 /* maximum number of tokens in formula */ +#define MAXSTRLEN 1024 /* maximum length of input string of one symbol */ +#define MAXJUMPCOUNT 32 /* maximum number of jumps (ocChose) */ + +// flag values of CharTable +#define SC_COMPILER_C_ILLEGAL 0x00000000 +#define SC_COMPILER_C_CHAR 0x00000001 +#define SC_COMPILER_C_CHAR_BOOL 0x00000002 +#define SC_COMPILER_C_CHAR_WORD 0x00000004 +#define SC_COMPILER_C_CHAR_VALUE 0x00000008 +#define SC_COMPILER_C_CHAR_STRING 0x00000010 +#define SC_COMPILER_C_CHAR_DONTCARE 0x00000020 +#define SC_COMPILER_C_BOOL 0x00000040 +#define SC_COMPILER_C_WORD 0x00000080 +#define SC_COMPILER_C_WORD_SEP 0x00000100 +#define SC_COMPILER_C_VALUE 0x00000200 +#define SC_COMPILER_C_VALUE_SEP 0x00000400 +#define SC_COMPILER_C_VALUE_EXP 0x00000800 +#define SC_COMPILER_C_VALUE_SIGN 0x00001000 +#define SC_COMPILER_C_VALUE_VALUE 0x00002000 +#define SC_COMPILER_C_STRING_SEP 0x00004000 +#define SC_COMPILER_C_NAME_SEP 0x00008000 // there can be only one! '\'' +#define SC_COMPILER_C_CHAR_IDENT 0x00010000 // identifier (built-in function) or reference start +#define SC_COMPILER_C_IDENT 0x00020000 // identifier or reference continuation +#define SC_COMPILER_C_ODF_LBRACKET 0x00040000 // ODF '[' reference bracket +#define SC_COMPILER_C_ODF_RBRACKET 0x00080000 // ODF ']' reference bracket +#define SC_COMPILER_C_ODF_LABEL_OP 0x00100000 // ODF '!!' automatic intersection of labels +#define SC_COMPILER_C_ODF_NAME_MARKER 0x00200000 // ODF '$$' marker that starts a defined (range) name +#define SC_COMPILER_C_CHAR_NAME 0x00400000 // start character of a defined name +#define SC_COMPILER_C_NAME 0x00800000 // continuation character of a defined name + +#define SC_COMPILER_FILE_TAB_SEP '#' // 'Doc'#Tab + + +class ScDocument; +class ScMatrix; +class ScRangeData; +class ScExternalRefManager; +class ScTokenArray; + +// constants and data types internal to compiler + +/* + OpCode eOp; // OpCode + formula::StackVar eType; // type of data + sal_uInt16 nRefCnt; // reference count + sal_Bool bRaw; // not cloned yet and trimmed to real size + */ + +#define SC_TOKEN_FIX_MEMBERS \ + OpCode eOp; \ + formula::StackVar eType; \ + mutable sal_uInt16 nRefCnt; \ + sal_Bool bRaw; + +struct ScDoubleRawToken +{ +private: + SC_TOKEN_FIX_MEMBERS +public: + union + { // union only to assure alignment identical to ScRawToken + double nValue; + struct { + sal_uInt8 cByte; + bool bHasForceArray; + } sbyte; + }; + DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRawToken ); +}; + +struct ScRawToken +{ + friend class ScCompiler; + // Friends that use a temporary ScRawToken on the stack (and therefor need + // the private dtor) and know what they're doing.. + friend class ScTokenArray; + friend sal_uInt16 lcl_ScRawTokenOffset(); +private: + SC_TOKEN_FIX_MEMBERS +public: + union { + double nValue; + struct { + sal_uInt8 cByte; + bool bHasForceArray; + } sbyte; + ScComplexRefData aRef; + struct { + sal_uInt16 nFileId; + sal_Unicode cTabName[MAXSTRLEN+1]; + ScComplexRefData aRef; + } extref; + struct { + sal_uInt16 nFileId; + sal_Unicode cName[MAXSTRLEN+1]; + } extname; + struct { + bool bGlobal; + sal_uInt16 nIndex; + } name; + ScMatrix* pMat; + sal_Unicode cStr[ MAXSTRLEN+1 ]; // string (up to 255 characters + 0) + short nJump[MAXJUMPCOUNT+1]; // If/Chose token + }; + + //! other members not initialized + ScRawToken() : bRaw( sal_True ) {} +private: + ~ScRawToken() {} //! only delete via Delete() +public: + DECL_FIXEDMEMPOOL_NEWDEL( ScRawToken ); + formula::StackVar GetType() const { return (formula::StackVar) eType; } + OpCode GetOpCode() const { return (OpCode) eOp; } + void NewOpCode( OpCode e ) { eOp = e; } + void IncRef() { nRefCnt++; } + void DecRef() { if( !--nRefCnt ) Delete(); } + sal_uInt16 GetRef() const { return nRefCnt; } + SC_DLLPUBLIC void Delete(); + + // Use these methods only on tokens that are not part of a token array, + // since the reference count is cleared! + void SetOpCode( OpCode eCode ); + void SetString( const sal_Unicode* pStr ); + void SetSingleReference( const ScSingleRefData& rRef ); + void SetDoubleReference( const ScComplexRefData& rRef ); + void SetDouble( double fVal ); + + // These methods are ok to use, reference count not cleared. + void SetName(bool bGlobal, sal_uInt16 nIndex); + void SetExternalSingleRef( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ); + void SetExternalDoubleRef( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ); + void SetExternalName( sal_uInt16 nFileId, const String& rName ); + void SetMatrix( ScMatrix* p ); + void SetExternal(const sal_Unicode* pStr); + + ScRawToken* Clone() const; // real copy! + formula::FormulaToken* CreateToken() const; // create typified token + void Load( SvStream&, sal_uInt16 nVer ); + + static xub_StrLen GetStrLen( const sal_Unicode* pStr ); // as long as a "string" is an array + static size_t GetStrLenBytes( xub_StrLen nLen ) + { return nLen * sizeof(sal_Unicode); } + static size_t GetStrLenBytes( const sal_Unicode* pStr ) + { return GetStrLenBytes( GetStrLen( pStr ) ); } +}; + +inline void intrusive_ptr_add_ref(ScRawToken* p) +{ + p->IncRef(); +} + +inline void intrusive_ptr_release(ScRawToken* p) +{ + p->DecRef(); +} + +typedef ::boost::intrusive_ptr<ScRawToken> ScRawTokenRef; + +class SC_DLLPUBLIC ScCompiler : public formula::FormulaCompiler +{ +public: + + enum EncodeUrlMode + { + ENCODE_BY_GRAMMAR, + ENCODE_ALWAYS, + ENCODE_NEVER, + }; + + struct Convention + { + const formula::FormulaGrammar::AddressConvention meConv; + + Convention( formula::FormulaGrammar::AddressConvention eConvP ); + virtual ~Convention(); + + virtual void MakeRefStr( rtl::OUStringBuffer& rBuffer, + const ScCompiler& rCompiler, + const ScComplexRefData& rRef, + sal_Bool bSingleRef ) const = 0; + virtual ::com::sun::star::i18n::ParseResult + parseAnyToken( const String& rFormula, + xub_StrLen nSrcPos, + const CharClass* pCharClass) const = 0; + + /** + * Parse the symbol string and pick up the file name and the external + * range name. + * + * @return true on successful parse, or false otherwise. + */ + virtual bool parseExternalName( const String& rSymbol, String& rFile, String& rName, + const ScDocument* pDoc, + const ::com::sun::star::uno::Sequence< + const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks ) const = 0; + + virtual String makeExternalNameStr( const String& rFile, const String& rName ) const = 0; + + virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler, + sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef, + ScExternalRefManager* pRefMgr ) const = 0; + + virtual void makeExternalRefStr( ::rtl::OUStringBuffer& rBuffer, const ScCompiler& rCompiler, + sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef, + ScExternalRefManager* pRefMgr ) const = 0; + + enum SpecialSymbolType + { + /** + * Character between sheet name and address. In OOO A1 this is + * '.', while XL A1 and XL R1C1 this is '!'. + */ + SHEET_SEPARATOR, + + /** + * In OOO A1, a sheet name may be prefixed with '$' to indicate an + * absolute sheet position. + */ + ABS_SHEET_PREFIX + }; + virtual sal_Unicode getSpecialSymbol( SpecialSymbolType eSymType ) const = 0; + + virtual sal_uLong getCharTableFlags( sal_Unicode c, sal_Unicode cLast ) const = 0; + + protected: + const sal_uLong* mpCharTable; + }; + friend struct Convention; + +private: + + + static CharClass *pCharClassEnglish; // character classification for en_US locale + static const Convention *pConventions[ formula::FormulaGrammar::CONV_LAST ]; + + static const Convention * const pConvOOO_A1; + static const Convention * const pConvOOO_A1_ODF; + static const Convention * const pConvXL_A1; + static const Convention * const pConvXL_R1C1; + static const Convention * const pConvXL_OOX; + + static struct AddInMap + { + const char* pODFF; + const char* pEnglish; + bool bMapDupToInternal; // when writing ODFF + const char* pOriginal; // programmatical name + const char* pUpper; // upper case programmatical name + } maAddInMap[]; + static const AddInMap* GetAddInMap(); + static size_t GetAddInMapCount(); + + ScDocument* pDoc; + ScAddress aPos; + + // For CONV_XL_OOX, may be set via API by MOOXML filter. + ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks; + + sal_Unicode cSymbol[MAXSTRLEN]; // current Symbol + String aFormula; // formula source code + xub_StrLen nSrcPos; // tokenizer position (source code) + ScRawTokenRef pRawToken; + + const CharClass* pCharClass; // which character classification is used for parseAnyToken + sal_uInt16 mnPredetectedReference; // reference when reading ODF, 0 (none), 1 (single) or 2 (double) + SCsTAB nMaxTab; // last sheet in document + sal_Int32 mnRangeOpPosInSymbol; // if and where a range operator is in symbol + const Convention *pConv; + EncodeUrlMode meEncodeUrlMode; + bool mbCloseBrackets; // whether to close open brackets automatically, default TRUE + bool mbExtendedErrorDetection; + bool mbRewind; // whether symbol is to be rewound to some step during lexical analysis + + sal_Bool NextNewToken(bool bInArray = false); + + virtual void SetError(sal_uInt16 nError); + xub_StrLen NextSymbol(bool bInArray); + sal_Bool IsValue( const String& ); + sal_Bool IsOpCode( const String&, bool bInArray ); + sal_Bool IsOpCode2( const String& ); + sal_Bool IsString(); + sal_Bool IsReference( const String& ); + sal_Bool IsSingleReference( const String& ); + sal_Bool IsPredetectedReference( const String& ); + sal_Bool IsDoubleReference( const String& ); + sal_Bool IsMacro( const String& ); + sal_Bool IsNamedRange( const String& ); + bool IsExternalNamedRange( const String& rSymbol ); + sal_Bool IsDBRange( const String& ); + sal_Bool IsColRowName( const String& ); + sal_Bool IsBoolean( const String& ); + void AutoCorrectParsedSymbol(); + + void SetRelNameReference(); + + static void InitCharClassEnglish(); + +public: + ScCompiler( ScDocument* pDocument, const ScAddress&); + + ScCompiler( ScDocument* pDocument, const ScAddress&,ScTokenArray& rArr); + +public: + static void DeInit(); /// all + + // for ScAddress::Format() + static void CheckTabQuotes( String& aTabName, + const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ); + + static sal_Bool EnQuote( String& rStr ); + sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const; + + + // Check if it is a valid english function name + bool IsEnglishSymbol( const String& rName ); + + //! _either_ CompileForFAP _or_ AutoCorrection, _not_ both + // #i101512# SetCompileForFAP is in formula::FormulaCompiler + void SetAutoCorrection( sal_Bool bVal ) + { bAutoCorrect = bVal; bIgnoreErrors = bVal; } + void SetCloseBrackets( bool bVal ) { mbCloseBrackets = bVal; } + void SetRefConvention( const Convention *pConvP ); + void SetRefConvention( const formula::FormulaGrammar::AddressConvention eConv ); + + /// Set symbol map if not empty. + void SetFormulaLanguage( const OpCodeMapPtr & xMap ); + + void SetGrammar( const formula::FormulaGrammar::Grammar eGrammar ); + + EncodeUrlMode GetEncodeUrlMode() const; +private: + /** Set grammar and reference convention from within SetFormulaLanguage() + or SetGrammar(). + + @param eNewGrammar + The new grammar to be set and the associated reference convention. + + @param eOldGrammar + The previous grammar that was active before SetFormulaLanguage(). + */ + void SetGrammarAndRefConvention( + const formula::FormulaGrammar::Grammar eNewGrammar, + const formula::FormulaGrammar::Grammar eOldGrammar ); +public: + + /// Set external link info for ScAddress::CONV_XL_OOX. + inline void SetExternalLinks( + const ::com::sun::star::uno::Sequence< + const ::com::sun::star::sheet::ExternalLinkInfo > & rLinks ) + { + maExternalLinks = rLinks; + } + + void CreateStringFromXMLTokenArray( String& rFormula, String& rFormulaNmsp ); + + void SetExtendedErrorDetection( bool bVal ) { mbExtendedErrorDetection = bVal; } + + sal_Bool IsCorrected() { return bCorrected; } + const String& GetCorrectedFormula() { return aCorrectedFormula; } + + // Use convention from this->aPos by default + ScTokenArray* CompileString( const String& rFormula ); + ScTokenArray* CompileString( const String& rFormula, const String& rFormulaNmsp ); + const ScDocument* GetDoc() const { return pDoc; } + const ScAddress& GetPos() const { return aPos; } + + void MoveRelWrap( SCCOL nMaxCol, SCROW nMaxRow ); + static void MoveRelWrap( ScTokenArray& rArr, ScDocument* pDoc, const ScAddress& rPos, + SCCOL nMaxCol, SCROW nMaxRow ); + + sal_Bool UpdateNameReference( UpdateRefMode eUpdateRefMode, + const ScRange&, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + sal_Bool& rChanged, sal_Bool bSharedFormula = false); + + ScRangeData* UpdateReference( UpdateRefMode eUpdateRefMode, + const ScAddress& rOldPos, const ScRange&, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + bool& rChanged, bool& rRefSizeChanged ); + + /// Only once for converted shared formulas, + /// token array has to be compiled afterwards. + void UpdateSharedFormulaReference( UpdateRefMode eUpdateRefMode, + const ScAddress& rOldPos, const ScRange&, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + + ScRangeData* UpdateInsertTab(SCTAB nTable, sal_Bool bIsName ); + ScRangeData* UpdateDeleteTab(SCTAB nTable, sal_Bool bIsMove, sal_Bool bIsName, sal_Bool& bCompile); + ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, sal_Bool bIsName ); + + sal_Bool HasModifiedRange(); + + /** If the character is allowed as first character in sheet names or + references, includes '$' and '?'. */ + static inline sal_Bool IsCharWordChar( String const & rStr, + xub_StrLen nPos, + const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) + { + sal_Unicode c = rStr.GetChar( nPos ); + sal_Unicode cLast = nPos > 0 ? rStr.GetChar(nPos-1) : 0; + if (c < 128) + { + return pConventions[eConv] ? static_cast<sal_Bool>( + (pConventions[eConv]->getCharTableFlags(c, cLast) & SC_COMPILER_C_CHAR_WORD) == SC_COMPILER_C_CHAR_WORD) : + false; // no convention => assume invalid + } + else + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + } + + /** If the character is allowed in sheet names, thus may be part of a + reference, includes '$' and '?' and such. */ + static inline sal_Bool IsWordChar( String const & rStr, + xub_StrLen nPos, + const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) + { + sal_Unicode c = rStr.GetChar( nPos ); + sal_Unicode cLast = nPos > 0 ? rStr.GetChar(nPos-1) : 0; + if (c < 128) + { + return pConventions[eConv] ? static_cast<sal_Bool>( + (pConventions[eConv]->getCharTableFlags(c, cLast) & SC_COMPILER_C_WORD) == SC_COMPILER_C_WORD) : + false; // convention not known => assume invalid + } + else + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + } + + /** If the character is allowed as tested by nFlags (SC_COMPILER_C_... + bits) for all known address conventions. If more than one bit is given + in nFlags, all bits must match. If bTestLetterNumeric is sal_False and + char>=128, no LetterNumeric test is done and sal_False is returned. */ + static inline bool IsCharFlagAllConventions( String const & rStr, + xub_StrLen nPos, + sal_uLong nFlags, + bool bTestLetterNumeric = true ) + { + sal_Unicode c = rStr.GetChar( nPos ); + sal_Unicode cLast = nPos > 0 ? rStr.GetChar( nPos-1 ) : 0; + if (c < 128) + { + for ( int nConv = formula::FormulaGrammar::CONV_UNSPECIFIED; + ++nConv < formula::FormulaGrammar::CONV_LAST; ) + { + if (pConventions[nConv] && + ((pConventions[nConv]->getCharTableFlags(c, cLast) & nFlags) != nFlags)) + return false; + // convention not known => assume valid + } + return true; + } + else if (bTestLetterNumeric) + return ScGlobal::pCharClass->isLetterNumeric( rStr, nPos ); + else + return false; + } + +private: + // FormulaCompiler + virtual String FindAddInFunction( const String& rUpperName, sal_Bool bLocalFirst ) const; + virtual void fillFromAddInCollectionUpperName( NonConstOpCodeMapPtr xMap ) const; + virtual void fillFromAddInCollectionEnglishName( NonConstOpCodeMapPtr xMap ) const; + virtual void fillFromAddInMap( NonConstOpCodeMapPtr xMap, formula::FormulaGrammar::Grammar _eGrammar ) const; + virtual void fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const; + + virtual sal_Bool HandleExternalReference(const formula::FormulaToken& _aToken); + virtual sal_Bool HandleRange(); + virtual sal_Bool HandleSingleRef(); + virtual sal_Bool HandleDbData(); + + virtual formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, bool bReuseDoubleRef ); + virtual void CreateStringFromExternal(rtl::OUStringBuffer& rBuffer, formula::FormulaToken* pTokenP); + virtual void CreateStringFromSingleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); + virtual void CreateStringFromDoubleRef(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); + virtual void CreateStringFromMatrix( rtl::OUStringBuffer& rBuffer, formula::FormulaToken* _pTokenP); + virtual void CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,formula::FormulaToken* _pTokenP); + virtual void LocalizeString( String& rName ); // modify rName - input: exact name + virtual sal_Bool IsImportingXML() const; + + /// Access the CharTable flags + inline sal_uLong GetCharTableFlags( sal_Unicode c, sal_Unicode cLast ) + { return c < 128 ? pConv->getCharTableFlags(c, cLast) : 0; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/compressedarray.hxx b/sc/inc/compressedarray.hxx new file mode 100644 index 000000000000..c07eb43c0658 --- /dev/null +++ b/sc/inc/compressedarray.hxx @@ -0,0 +1,417 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_COMPRESSEDARRAY_HXX +#define SC_COMPRESSEDARRAY_HXX + +#ifndef INCLUDED_CSTDDEF +#include <cstddef> +#define INCLUDED_CSTDDEF +#endif + +#ifndef INCLUDED_ALGORITHM +#include <algorithm> +#define INCLUDED_ALGORITHM +#endif +#include "scdllapi.h" + +const size_t nScCompressedArrayDelta = 4; + +template< typename A, typename D > class ScCompressedArrayIterator; + +/** Compressed array of row (or column) entries, e.g. heights, flags, ... + + The array stores ranges of values such that consecutive values occupy only + one entry. Initially it consists of one DataEntry with an implied start + row/column of 0 and an end row/column of access type maximum value. + + typename A := access type, e.g. SCROW or SCCOL, must be a POD. + + typename D := data type, e.g. sal_uInt16 or sal_uInt8 or whatever, may also be a + struct or class. + + D::operator==() and D::operator=() must be implemented. Force template + instantiation for a specific type in source/core/data/compressedarray.cxx + + TODO: Currently the allocated memory never shrinks, must manually invoke + Resize() if needed. + */ + +template< typename A, typename D > class ScCompressedArray +{ +public: + struct DataEntry + { + A nEnd; // start is end of previous entry + 1 + D aValue; + DataEntry() {} //! uninitialized + }; + + /** Construct with nMaxAccess=MAXROW, for example. */ + ScCompressedArray( A nMaxAccess, + const D& rValue, + size_t nDelta = nScCompressedArrayDelta ); + /** Construct from a plain array of D */ + ScCompressedArray( A nMaxAccess, + const D* pDataArray, size_t nDataCount ); + virtual ~ScCompressedArray(); + void Resize( size_t nNewSize ); + void Reset( const D& rValue ); + void SetValue( A nPos, const D& rValue ); + void SetValue( A nStart, A nEnd, const D& rValue ); + const D& GetValue( A nPos ) const; + + /** Get value for a row, and it's region end row */ + const D& GetValue( A nPos, size_t& nIndex, A& nEnd ) const; + + /** Get next value and it's region end row. If nIndex<nCount, nIndex is + incremented first. If the resulting nIndex>=nCount, the value of the + last entry is returned again. */ + const D& GetNextValue( size_t& nIndex, A& nEnd ) const; + + /** Insert rows before nStart and copy value for inserted rows from + nStart-1, return that value. */ + const D& Insert( A nStart, size_t nCount ); + + void Remove( A nStart, size_t nCount ); + + /** Copy rArray.nStart+nSourceDy to this.nStart */ + void CopyFrom( const ScCompressedArray& rArray, + A nStart, A nEnd, long nSourceDy = 0 ); + + + // methods public for the coupled array sum methods + /** Obtain index into entries for nPos */ + SC_DLLPUBLIC size_t Search( A nPos ) const; + /** Get number of entries */ + size_t GetEntryCount() const; + +protected: + +friend class ScCompressedArrayIterator<A,D>; + + size_t nCount; + size_t nLimit; + size_t nDelta; + DataEntry* pData; + A nMaxAccess; +}; + + +template< typename A, typename D > +void ScCompressedArray<A,D>::Reset( const D& rValue ) +{ + // Create a temporary copy in case we got a reference passed that points to + // a part of the array to be reallocated. + D aTmpVal( rValue); + delete[] pData; + nCount = nLimit = 1; + pData = new DataEntry[1]; + pData[0].aValue = aTmpVal; + pData[0].nEnd = nMaxAccess; +} + + +template< typename A, typename D > +void ScCompressedArray<A,D>::SetValue( A nPos, const D& rValue ) +{ + SetValue( nPos, nPos, rValue); +} + + +template< typename A, typename D > +const D& ScCompressedArray<A,D>::GetValue( A nPos ) const +{ + size_t nIndex = Search( nPos); + return pData[nIndex].aValue; +} + + +template< typename A, typename D > +const D& ScCompressedArray<A,D>::GetValue( A nPos, size_t& nIndex, A& nEnd ) const +{ + nIndex = Search( nPos); + nEnd = pData[nIndex].nEnd; + return pData[nIndex].aValue; +} + + +template< typename A, typename D > +const D& ScCompressedArray<A,D>::GetNextValue( size_t& nIndex, A& nEnd ) const +{ + if (nIndex < nCount) + ++nIndex; + size_t nEntry = (nIndex < nCount ? nIndex : nCount-1); + nEnd = pData[nEntry].nEnd; + return pData[nEntry].aValue; +} + + +template< typename A, typename D > +size_t ScCompressedArray<A,D>::GetEntryCount() const +{ + return nCount; +} + + +// === ScCompressedArrayIterator ============================================= + +/** Iterator for ScCompressedArray. + + @ATTENTION: the iterator is not persistant if the underlying + ScCompressedArray happens to be changed by any means, for example by + setting new values or adding or removing or combining entries. If you do + such things inside a loop you MUST resynchronize the iterator by calling + <method>Resync()</method> with the row where resynchronization should + start. After doing so, <method>GetRangeStart()</method> and + <method>GetRangeEnd()</method> may not point to the previous access points + anymore. Use with care. + */ + +template< typename A, typename D > class ScCompressedArrayIterator +{ +public: + ScCompressedArrayIterator( + const ScCompressedArray<A,D> & rArray, + A nStart, A nEnd ); + /// Set new start and end, position on start. + void NewLimits( A nStart, A nEnd ); + A GetIterStart() const; + A GetIterEnd() const; + /// Advance by a single access point (e.g. row). + bool operator ++(); + A GetPos() const; + operator bool() const; + const D& operator *() const; + /// Advance an entire range, one entry of the array. + bool NextRange(); + A GetRangeStart() const; + A GetRangeEnd() const; + /// Resync to underlying array, calling Search(). + void Resync( A nPos ); + /** Set position without resyncing, avoid calling Search() if possible. + Position obtained from steering coupled iterator is NOT checked for + iterator bounds. */ + template< typename X > + void Follow( const ScCompressedArrayIterator<A,X>& ); + +private: + const ScCompressedArray<A,D> & rArray; + size_t nIndex; + A nIterStart; + A nIterEnd; + A nCurrent; + bool bEnd; +}; + + +template< typename A, typename D > +ScCompressedArrayIterator<A,D>::ScCompressedArrayIterator( + const ScCompressedArray<A,D> & rArrayP, A nStart, A nEnd ) + : rArray( rArrayP ) + // other values set in NewLimits() +{ + NewLimits( nStart, nEnd); +} + + +template< typename A, typename D > +void ScCompressedArrayIterator<A,D>::NewLimits( A nStart, A nEnd ) +{ + nIterStart = nStart; + nIterEnd = nEnd; + nIndex = rArray.Search( nStart); + nCurrent = GetRangeStart(); + bEnd = (nIterEnd < nIterStart); +} + + +template< typename A, typename D > +A ScCompressedArrayIterator<A,D>::GetIterStart() const +{ + return nIterStart; +} + + +template< typename A, typename D > +A ScCompressedArrayIterator<A,D>::GetIterEnd() const +{ + return nIterEnd; +} + + +template< typename A, typename D > +bool ScCompressedArrayIterator<A,D>::operator++() +{ + if (nCurrent < GetRangeEnd()) + { + ++nCurrent; + return true; + } + else + return NextRange(); +} + + +template< typename A, typename D > +A ScCompressedArrayIterator<A,D>::GetPos() const +{ + return nCurrent; +} + + +template< typename A, typename D > +bool ScCompressedArrayIterator<A,D>::NextRange() +{ + if (!operator bool()) + return false; + + if (rArray.pData[nIndex].nEnd >= nIterEnd) + bEnd = true; + else if (++nIndex >= rArray.GetEntryCount()) + { + nIndex = rArray.GetEntryCount() - 1; + bEnd = true; + } + nCurrent = bEnd ? nIterEnd : GetRangeStart(); + return operator bool(); +} + + +template< typename A, typename D > +ScCompressedArrayIterator<A,D>::operator bool() const +{ + return !bEnd; +} + + +template< typename A, typename D > +const D& ScCompressedArrayIterator<A,D>::operator*() const +{ + return rArray.pData[nIndex].aValue; +} + + +template< typename A, typename D > +A ScCompressedArrayIterator<A,D>::GetRangeStart() const +{ + if (nIndex == 0) + return nIterStart > 0 ? nIterStart : 0; + else + return nIterStart > rArray.pData[nIndex-1].nEnd ? nIterStart : + rArray.pData[nIndex-1].nEnd + 1; +} + + +template< typename A, typename D > +A ScCompressedArrayIterator<A,D>::GetRangeEnd() const +{ + return nIterEnd < rArray.pData[nIndex].nEnd ? nIterEnd : + rArray.pData[nIndex].nEnd; +} + + +template< typename A, typename D > +void ScCompressedArrayIterator<A,D>::Resync( A nPos ) +{ + if (nPos < nIterStart) + nPos = nIterStart; + else if (nPos > nIterEnd) + nPos = nIterEnd; + nCurrent = nPos; + bEnd = (nIterEnd < nIterStart); + nIndex = rArray.Search( nPos); +} + + +// === ScBitMaskCompressedArray ============================================== + +/** The data type represents bits, managable by bitwise operations. + */ + +template< typename A, typename D > class ScBitMaskCompressedArray : public ScCompressedArray<A,D> +{ +public: + ScBitMaskCompressedArray( A nMaxAccessP, + const D& rValue, + size_t nDeltaP = nScCompressedArrayDelta ) + : ScCompressedArray<A,D>( nMaxAccessP, rValue, nDeltaP) + {} + ScBitMaskCompressedArray( A nMaxAccessP, + const D* pDataArray, size_t nDataCount ) + : ScCompressedArray<A,D>( nMaxAccessP, + pDataArray, nDataCount) + {} + void AndValue( A nPos, const D& rValueToAnd ); + void OrValue( A nPos, const D& rValueToOr ); + void AndValue( A nStart, A nEnd, const D& rValueToAnd ); + void OrValue( A nStart, A nEnd, const D& rValueToOr ); + + /** Copy values from rArray and bitwise AND them with rValueToAnd. */ + void CopyFromAnded( + const ScBitMaskCompressedArray& rArray, + A nStart, A nEnd, const D& rValueToAnd, + long nSourceDy = 0 ); + + /** Return the first row where an entry meets the condition: + ((aValue & rBitMask) == rMaskedCompare), searching between nStart and + nEnd. If no entry meets this condition, ::std::numeric_limits<A>::max() + is returned. */ + SC_DLLPUBLIC A GetFirstForCondition( A nStart, A nEnd, + const D& rBitMask, + const D& rMaskedCompare ) const; + + /** Return the last row where an entry meets the condition: + ((aValue & rBitMask) != 0), start searching at nStart. If no entry + meets this condition, ::std::numeric_limits<A>::max() is returned. */ + A GetLastAnyBitAccess( A nStart, + const D& rBitMask ) const; +}; + + +template< typename A, typename D > +void ScBitMaskCompressedArray<A,D>::AndValue( A nPos, const D& rValueToAnd ) +{ + const D& rValue = GetValue( nPos); + if ((rValue & rValueToAnd) != rValue) + SetValue( nPos, rValue & rValueToAnd); +} + + +template< typename A, typename D > +void ScBitMaskCompressedArray<A,D>::OrValue( A nPos, const D& rValueToOr ) +{ + const D& rValue = GetValue( nPos); + if ((rValue | rValueToOr) != rValue) + SetValue( nPos, rValue | rValueToOr); +} + + +#endif // SC_COMPRESSEDARRAY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx new file mode 100644 index 000000000000..f541e247e7d8 --- /dev/null +++ b/sc/inc/conditio.hxx @@ -0,0 +1,308 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CONDITIO_HXX +#define SC_CONDITIO_HXX + +#include "global.hxx" +#include "address.hxx" +#include "formula/grammar.hxx" +#include <svl/svarray.hxx> +#include "scdllapi.h" +#include "rangelst.hxx" + +class ScBaseCell; +class ScFormulaCell; +class ScTokenArray; + + +#define SC_COND_GROW 16 + +// nOptions Flags +#define SC_COND_NOBLANKS 1 + + +// ordering of ScConditionMode and ScQueryOp is equal, +// to facilitate the merging of both in the future + +enum ScConditionMode +{ + SC_COND_EQUAL, + SC_COND_LESS, + SC_COND_GREATER, + SC_COND_EQLESS, + SC_COND_EQGREATER, + SC_COND_NOTEQUAL, + SC_COND_BETWEEN, + SC_COND_NOTBETWEEN, + SC_COND_DUPLICATE, + SC_COND_NOTDUPLICATE, + SC_COND_DIRECT, + SC_COND_NONE +}; + +enum ScConditionValType +{ + SC_VAL_VALUE, + SC_VAL_STRING, + SC_VAL_FORMULA +}; + +class ScConditionalFormat; + +class SC_DLLPUBLIC ScConditionEntry +{ + // stored data: + ScConditionMode eOp; + sal_uInt16 nOptions; + double nVal1; // input or calculated + double nVal2; + String aStrVal1; // input or calculated + String aStrVal2; + String aStrNmsp1; // namespace to be used on (re)compilation, e.g. in XML import + String aStrNmsp2; // namespace to be used on (re)compilation, e.g. in XML import + formula::FormulaGrammar::Grammar eTempGrammar1; // grammar to be used on (re)compilation, e.g. in XML import + formula::FormulaGrammar::Grammar eTempGrammar2; // grammar to be used on (re)compilation, e.g. in XML import + sal_Bool bIsStr1; // for recognition of empty strings + sal_Bool bIsStr2; + ScTokenArray* pFormula1; // entered formula + ScTokenArray* pFormula2; + ScAddress aSrcPos; // source position for formulas + // temporary data: + String aSrcString; // formula source position as text during XML import + ScFormulaCell* pFCell1; + ScFormulaCell* pFCell2; + ScDocument* pDoc; + sal_Bool bRelRef1; + sal_Bool bRelRef2; + sal_Bool bFirstRun; + + void MakeCells( const ScAddress& rPos ); + void Compile( const String& rExpr1, const String& rExpr2, + const String& rExprNmsp1, const String& rExprNmsp2, + formula::FormulaGrammar::Grammar eGrammar1, + formula::FormulaGrammar::Grammar eGrammar2, + sal_Bool bTextToReal ); + void Interpret( const ScAddress& rPos ); + + sal_Bool IsValid( double nArg, const ScAddress& rAddr ) const; + sal_Bool IsValidStr( const String& rArg, const ScAddress& rAddr ) const; + +public: + ScConditionEntry( ScConditionMode eOper, + const String& rExpr1, const String& rExpr2, + ScDocument* pDocument, const ScAddress& rPos, + const String& rExprNmsp1, const String& rExprNmsp2, + formula::FormulaGrammar::Grammar eGrammar1, + formula::FormulaGrammar::Grammar eGrammar2 ); + ScConditionEntry( ScConditionMode eOper, + const ScTokenArray* pArr1, const ScTokenArray* pArr2, + ScDocument* pDocument, const ScAddress& rPos ); + ScConditionEntry( const ScConditionEntry& r ); // flat copy of formulas + // true copy of formulas (for Ref-Undo): + ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r ); + virtual ~ScConditionEntry(); + + int operator== ( const ScConditionEntry& r ) const; + + void SetParent( ScConditionalFormat* pNew ) { pCondFormat = pNew; } + + sal_Bool IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) const; + + ScConditionMode GetOperation() const { return eOp; } + sal_Bool IsIgnoreBlank() const { return ( nOptions & SC_COND_NOBLANKS ) == 0; } + void SetIgnoreBlank(sal_Bool bSet); + ScAddress GetSrcPos() const { return aSrcPos; } + + ScAddress GetValidSrcPos() const; // adjusted to allow textual representation of expressions + + void SetSrcString( const String& rNew ); // for XML import + + void SetFormula1( const ScTokenArray& rArray ); + void SetFormula2( const ScTokenArray& rArray ); + + String GetExpression( const ScAddress& rCursor, sal_uInt16 nPos, sal_uLong nNumFmt = 0, + const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; + + ScTokenArray* CreateTokenArry( sal_uInt16 nPos ) const; + + void CompileAll(); + void CompileXML(); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + + void SourceChanged( const ScAddress& rChanged ); + + bool MarkUsedExternalReferences() const; + +protected: + virtual void DataChanged( const ScRange* pModified ) const; + ScDocument* GetDocument() const { return pDoc; } + ScConditionalFormat* pCondFormat; +}; + +// +// single entry for conditional formatting +// + +class SC_DLLPUBLIC ScCondFormatEntry : public ScConditionEntry +{ + String aStyleName; + + using ScConditionEntry::operator==; + +public: + ScCondFormatEntry( ScConditionMode eOper, + const String& rExpr1, const String& rExpr2, + ScDocument* pDocument, const ScAddress& rPos, + const String& rStyle, + const String& rExprNmsp1 = EMPTY_STRING, + const String& rExprNmsp2 = EMPTY_STRING, + formula::FormulaGrammar::Grammar eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT, + formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT ); + ScCondFormatEntry( ScConditionMode eOper, + const ScTokenArray* pArr1, const ScTokenArray* pArr2, + ScDocument* pDocument, const ScAddress& rPos, + const String& rStyle ); + ScCondFormatEntry( const ScCondFormatEntry& r ); + ScCondFormatEntry( ScDocument* pDocument, const ScCondFormatEntry& r ); + virtual ~ScCondFormatEntry(); + + int operator== ( const ScCondFormatEntry& r ) const; + + const String& GetStyle() const { return aStyleName; } + void UpdateStyleName(const String& rNew) { aStyleName=rNew; } + +protected: + virtual void DataChanged( const ScRange* pModified ) const; +}; + +// +// complete conditional formatting +// + +class SC_DLLPUBLIC ScConditionalFormat +{ + ScDocument* pDoc; + ScRangeList* pAreas; // area for Paint + sal_uInt32 nKey; // Index in attributes + ScCondFormatEntry** ppEntries; + sal_uInt16 nEntryCount; + sal_Bool bIsUsed; // temporary at Save + ScRangeListRef pRanges; // Ranges for conditional format + +public: + ScConditionalFormat(sal_uInt32 nNewKey, ScDocument* pDocument); + ScConditionalFormat(const ScConditionalFormat& r); + ~ScConditionalFormat(); + + // true copy of formulas (for Ref-Undo / between documents) + ScConditionalFormat* Clone(ScDocument* pNewDoc = NULL) const; + + void AddEntry( const ScCondFormatEntry& rNew ); + void AddRangeInfo( const ScRangeListRef& rRanges ); + const ScRangeListRef& GetRangeInfo() const { return pRanges; } + + sal_Bool IsEmpty() const { return (nEntryCount == 0); } + sal_uInt16 Count() const { return nEntryCount; } + + void CompileAll(); + void CompileXML(); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + void RenameCellStyle( const String& rOld, const String& rNew ); + + void SourceChanged( const ScAddress& rAddr ); + + const ScCondFormatEntry* GetEntry( sal_uInt16 nPos ) const; + + const String& GetCellStyle( ScBaseCell* pCell, const ScAddress& rPos ) const; + + sal_Bool EqualEntries( const ScConditionalFormat& r ) const; + + void DoRepaint( const ScRange* pModified ); + void InvalidateArea(); + + sal_uInt32 GetKey() const { return nKey; } + void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted! + + void SetUsed(sal_Bool bSet) { bIsUsed = bSet; } + sal_Bool IsUsed() const { return bIsUsed; } + + bool MarkUsedExternalReferences() const; + + // sorted (via PTRARR) by Index + // operator== only for sorting + sal_Bool operator ==( const ScConditionalFormat& r ) const { return nKey == r.nKey; } + sal_Bool operator < ( const ScConditionalFormat& r ) const { return nKey < r.nKey; } +}; + +// +// List of areas and formats: +// + +typedef ScConditionalFormat* ScConditionalFormatPtr; + +SV_DECL_PTRARR_SORT(ScConditionalFormats_Impl, ScConditionalFormatPtr, + SC_COND_GROW, SC_COND_GROW) + +class ScConditionalFormatList : public ScConditionalFormats_Impl +{ +public: + ScConditionalFormatList() {} + ScConditionalFormatList(const ScConditionalFormatList& rList); + ScConditionalFormatList(ScDocument* pNewDoc, const ScConditionalFormatList& rList); + ~ScConditionalFormatList() {} + + void InsertNew( ScConditionalFormat* pNew ) + { if (!Insert(pNew)) delete pNew; } + + ScConditionalFormat* GetFormat( sal_uInt32 nKey ); + + void CompileAll(); + void CompileXML(); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void RenameCellStyle( const String& rOld, const String& rNew ); + void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + + void SourceChanged( const ScAddress& rAddr ); + + /** Temporarily during save, returns RefManager's decision whether ALL + * references are marked now. */ + bool MarkUsedExternalReferences() const; + + sal_Bool operator==( const ScConditionalFormatList& r ) const; // for Ref-Undo +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/confuno.hxx b/sc/inc/confuno.hxx new file mode 100644 index 000000000000..2fa22ad4dcf2 --- /dev/null +++ b/sc/inc/confuno.hxx @@ -0,0 +1,109 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CONFUNO_HXX +#define SC_CONFUNO_HXX + +#include <svl/itemprop.hxx> +#include <svl/lstner.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/implbase2.hxx> + +class ScDocShell; + +class ScDocumentConfiguration : public cppu::WeakImplHelper2< + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SfxItemPropertySet aPropSet; + +public: + ScDocumentConfiguration(ScDocShell* pDocShell); + virtual ~ScDocumentConfiguration(); + + // SfxListener + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/consoli.hxx b/sc/inc/consoli.hxx new file mode 100644 index 000000000000..f56a4a521435 --- /dev/null +++ b/sc/inc/consoli.hxx @@ -0,0 +1,130 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CONSOLI_HXX +#define SC_CONSOLI_HXX + +#include "global.hxx" +#include "address.hxx" + +class ScDocument; + +struct ScReferenceEntry // without constructor ! +{ + SCCOL nCol; + SCROW nRow; + SCTAB nTab; +}; + + +//! Use delta value for data? + +class ScReferenceList // without constructor ! +{ +private: + SCSIZE nCount; + SCSIZE nFullSize; // incl. fill entries + ScReferenceEntry* pData; + +public: + void Init() { nCount=0; nFullSize=0; pData=NULL; } + void Clear() { delete[] pData; } + + SCSIZE GetCount() { return nCount; } + const ScReferenceEntry& GetEntry( SCSIZE nPos ) { return pData[nPos]; } + void SetFullSize( SCSIZE nNew ) { nFullSize = nNew; } + + void AddEntry( SCCOL nCol, SCROW nRow, SCTAB nTab ); +}; + +// +// Sequence: +// 1) create ScConsData +// 2) Parameter (Size/Flags) +// 3) AddFields for all areas (only needed for bColByName or bRowByName) +// 4) DoneFields ( " " ) +// 5) AddData for all areas +// perhaps AddName after each area +// 6) OutputToDocument +// + +//! Use structure ScDocument if a certain size is exceeded? + +class ScConsData +{ +private: + ScSubTotalFunc eFunction; + sal_Bool bReference; + sal_Bool bColByName; + sal_Bool bRowByName; + sal_Bool bSubTitles; + SCSIZE nColCount; + SCSIZE nRowCount; + sal_Bool** ppUsed; + double** ppSum; + double** ppCount; + double** ppSumSqr; + ScReferenceList** ppRefs; + String** ppColHeaders; + String** ppRowHeaders; + SCSIZE nDataCount; + SCSIZE nTitleCount; + String** ppTitles; + SCSIZE** ppTitlePos; + sal_Bool bCornerUsed; + String aCornerText; // only for bColByName && bRowByName + +public: + ScConsData(); + ~ScConsData(); + + void SetSize( SCCOL nCols, SCROW nRows ); + void SetFlags( ScSubTotalFunc eFunc, sal_Bool bColName, sal_Bool bRowName, sal_Bool bRef ); + + void InitData(sal_Bool bDelete=sal_True); + void DeleteData(); + + void AddFields( ScDocument* pSrcDoc, SCTAB nTab, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + void DoneFields(); + + void AddData( ScDocument* pSrcDoc, SCTAB nTab, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + void AddName( const String& rName ); + + void OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, SCTAB nTab ); + + void GetSize( SCCOL& rCols, SCROW& rRows ) const; + SCROW GetInsertCount() const; +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/convuno.hxx b/sc/inc/convuno.hxx new file mode 100644 index 000000000000..87c36aa95c82 --- /dev/null +++ b/sc/inc/convuno.hxx @@ -0,0 +1,220 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CONVUNO_HXX +#define SC_CONVUNO_HXX + +#include <algorithm> +#include <i18npool/lang.h> +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/lang/Locale.hpp> +#include "global.hxx" +#include "address.hxx" + + +class ScUnoConversion +{ +public: + static LanguageType GetLanguage( const com::sun::star::lang::Locale& rLocale ); + static void FillLocale( com::sun::star::lang::Locale& rLocale, LanguageType eLang ); + + // CellAddress -> ScAddress + static inline void FillScAddress( + ScAddress& rScAddress, + const ::com::sun::star::table::CellAddress& rApiAddress ); + // ScAddress -> CellAddress + static inline void FillApiAddress( + ::com::sun::star::table::CellAddress& rApiAddress, + const ScAddress& rScAddress ); + // CellRangeAddress -> ScRange + static inline void FillScRange( + ScRange& rScRange, + const ::com::sun::star::table::CellRangeAddress& rApiRange ); + // ScRange -> CellRangeAddress + static inline void FillApiRange( + ::com::sun::star::table::CellRangeAddress& rApiRange, + const ScRange& rScRange ); + // CellAddress -> CellRangeAddress + static inline void FillApiRange( + ::com::sun::star::table::CellRangeAddress& rApiRange, + const ::com::sun::star::table::CellAddress& rApiAddress ); + // CellRangeAddress-Start -> CellAddress + static inline void FillApiStartAddress( + ::com::sun::star::table::CellAddress& rApiAddress, + const ::com::sun::star::table::CellRangeAddress& rApiRange ); + // CellRangeAddress-End -> CellAddress + static inline void FillApiEndAddress( + ::com::sun::star::table::CellAddress& rApiAddress, + const ::com::sun::star::table::CellRangeAddress& rApiRange ); + + /** Returns true, if the passed ranges have at least one common cell. */ + static inline bool Intersects( + const ::com::sun::star::table::CellRangeAddress& rApiARange1, + const ::com::sun::star::table::CellRangeAddress& rApiARange2 ); + /** Returns true, if the passed address rApiInner is inside the passed range rApiOuter. */ + static inline bool Contains( + const ::com::sun::star::table::CellRangeAddress& rApiOuter, + const ::com::sun::star::table::CellAddress& rApiInner ); + /** Returns true, if the passed range rApiInner is completely inside the passed range rApiOuter. */ + static inline bool Contains( + const ::com::sun::star::table::CellRangeAddress& rApiOuter, + const ::com::sun::star::table::CellRangeAddress& rApiInner ); +}; + + +inline void ScUnoConversion::FillScAddress( + ScAddress& rScAddress, + const ::com::sun::star::table::CellAddress& rApiAddress ) +{ + rScAddress.Set( (SCCOL)rApiAddress.Column, (SCROW)rApiAddress.Row, (SCTAB)rApiAddress.Sheet ); +} + +inline void ScUnoConversion::FillApiAddress( + ::com::sun::star::table::CellAddress& rApiAddress, + const ScAddress& rScAddress ) +{ + rApiAddress.Column = rScAddress.Col(); + rApiAddress.Row = rScAddress.Row(); + rApiAddress.Sheet = rScAddress.Tab(); +} + +inline void ScUnoConversion::FillScRange( + ScRange& rScRange, + const ::com::sun::star::table::CellRangeAddress& rApiRange ) +{ + rScRange.aStart.Set( (SCCOL)rApiRange.StartColumn, (SCROW)rApiRange.StartRow, (SCTAB)rApiRange.Sheet ); + rScRange.aEnd.Set( (SCCOL)rApiRange.EndColumn, (SCROW)rApiRange.EndRow, (SCTAB)rApiRange.Sheet ); +} + +inline void ScUnoConversion::FillApiRange( + ::com::sun::star::table::CellRangeAddress& rApiRange, + const ScRange& rScRange ) +{ + rApiRange.StartColumn = rScRange.aStart.Col(); + rApiRange.StartRow = rScRange.aStart.Row(); + rApiRange.Sheet = rScRange.aStart.Tab(); + rApiRange.EndColumn = rScRange.aEnd.Col(); + rApiRange.EndRow = rScRange.aEnd.Row(); +} + +inline void ScUnoConversion::FillApiRange( + ::com::sun::star::table::CellRangeAddress& rApiRange, + const ::com::sun::star::table::CellAddress& rApiAddress ) +{ + rApiRange.StartColumn = rApiRange.EndColumn = rApiAddress.Column; + rApiRange.StartRow = rApiRange.EndRow = rApiAddress.Row; + rApiRange.Sheet = rApiAddress.Sheet; +} + +inline void ScUnoConversion::FillApiStartAddress( + ::com::sun::star::table::CellAddress& rApiAddress, + const ::com::sun::star::table::CellRangeAddress& rApiRange ) +{ + rApiAddress.Column = rApiRange.StartColumn; + rApiAddress.Row = rApiRange.StartRow; + rApiAddress.Sheet = rApiRange.Sheet; +} + +inline void ScUnoConversion::FillApiEndAddress( + ::com::sun::star::table::CellAddress& rApiAddress, + const ::com::sun::star::table::CellRangeAddress& rApiRange ) +{ + rApiAddress.Column = rApiRange.EndColumn; + rApiAddress.Row = rApiRange.EndRow; + rApiAddress.Sheet = rApiRange.Sheet; +} + +inline bool ScUnoConversion::Intersects( + const ::com::sun::star::table::CellRangeAddress& rApiRange1, + const ::com::sun::star::table::CellRangeAddress& rApiRange2 ) +{ + return (rApiRange1.Sheet == rApiRange2.Sheet) && + (::std::max( rApiRange1.StartColumn, rApiRange2.StartColumn ) <= ::std::min( rApiRange1.EndColumn, rApiRange2.EndColumn )) && + (::std::max( rApiRange1.StartRow, rApiRange2.StartRow ) <= ::std::min( rApiRange1.EndRow, rApiRange2.EndRow )); +} + +inline bool ScUnoConversion::Contains( + const ::com::sun::star::table::CellRangeAddress& rApiOuter, + const ::com::sun::star::table::CellAddress& rApiInner ) +{ + return (rApiOuter.Sheet == rApiInner.Sheet) && + (rApiOuter.StartColumn <= rApiInner.Column) && (rApiInner.Column <= rApiOuter.EndColumn) && + (rApiOuter.StartRow <= rApiInner.Row) && (rApiInner.Row <= rApiOuter.EndRow); +} + +inline bool ScUnoConversion::Contains( + const ::com::sun::star::table::CellRangeAddress& rApiOuter, + const ::com::sun::star::table::CellRangeAddress& rApiInner ) +{ + return (rApiOuter.Sheet == rApiInner.Sheet) && + (rApiOuter.StartColumn <= rApiInner.StartColumn) && (rApiInner.EndColumn <= rApiOuter.EndColumn) && + (rApiOuter.StartRow <= rApiInner.StartRow) && (rApiInner.EndRow <= rApiOuter.EndRow); +} + +//___________________________________________________________________ + +inline sal_Bool operator==( + const ::com::sun::star::table::CellAddress& rApiAddress1, + const ::com::sun::star::table::CellAddress& rApiAddress2 ) +{ + return + (rApiAddress1.Column == rApiAddress2.Column) && + (rApiAddress1.Row == rApiAddress2.Row) && + (rApiAddress1.Sheet == rApiAddress2.Sheet); +} + +inline sal_Bool operator!=( + const ::com::sun::star::table::CellAddress& rApiAddress1, + const ::com::sun::star::table::CellAddress& rApiAddress2 ) +{ + return !(rApiAddress1 == rApiAddress2); +} + +inline sal_Bool operator==( + const ::com::sun::star::table::CellRangeAddress& rApiRange1, + const ::com::sun::star::table::CellRangeAddress& rApiRange2 ) +{ + return + (rApiRange1.StartColumn == rApiRange2.StartColumn) && + (rApiRange1.StartRow == rApiRange2.StartRow) && + (rApiRange1.EndColumn == rApiRange2.EndColumn) && + (rApiRange1.EndRow == rApiRange2.EndRow) && + (rApiRange1.Sheet == rApiRange2.Sheet); +} + +inline sal_Bool operator!=( + const ::com::sun::star::table::CellRangeAddress& rApiRange1, + const ::com::sun::star::table::CellRangeAddress& rApiRange2 ) +{ + return !(rApiRange1 == rApiRange2); +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/cursuno.hxx b/sc/inc/cursuno.hxx new file mode 100644 index 000000000000..e4602a1da4f9 --- /dev/null +++ b/sc/inc/cursuno.hxx @@ -0,0 +1,112 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_CURSUNO_HXX +#define SC_CURSUNO_HXX + +#include "cellsuno.hxx" +#include <com/sun/star/table/XCellCursor.hpp> +#include <com/sun/star/sheet/XSheetCellCursor.hpp> +#include <com/sun/star/sheet/XUsedAreaCursor.hpp> + +class ScCellCursorObj : public ScCellRangeObj, + public com::sun::star::sheet::XSheetCellCursor, + public com::sun::star::sheet::XUsedAreaCursor, + public com::sun::star::table::XCellCursor +{ +public: + ScCellCursorObj(ScDocShell* pDocSh, const ScRange& rR); + virtual ~ScCellCursorObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XSheetCellCursor + virtual void SAL_CALL collapseToCurrentRegion() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL collapseToCurrentArray() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL collapseToMergedArea() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL expandToEntireColumns() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL expandToEntireRows() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL collapseToSize( sal_Int32 nColumns, sal_Int32 nRows ) + throw(::com::sun::star::uno::RuntimeException); + + // XUsedAreaCursor + virtual void SAL_CALL gotoStartOfUsedArea( sal_Bool bExpand ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoEndOfUsedArea( sal_Bool bExpand ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellCursor + virtual void SAL_CALL gotoStart() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoEnd() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoNext() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoPrevious() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL gotoOffset( sal_Int32 nColumnOffset, sal_Int32 nRowOffset ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetCellRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL + getSpreadsheet() throw(::com::sun::star::uno::RuntimeException); + + // XCellRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > SAL_CALL + getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, + sal_Int32 nRight, sal_Int32 nBottom ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + using ScCellRangeObj::getCellRangeByName; + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getCellRangeByName( const ::rtl::OUString& aRange ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx new file mode 100644 index 000000000000..fd3ec8d65fed --- /dev/null +++ b/sc/inc/dapiuno.hxx @@ -0,0 +1,963 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DAPIUNO_HXX +#define SC_DAPIUNO_HXX + +#include "global.hxx" +#include "dpobject.hxx" +#include "rangeutl.hxx" // ScArea +#include "cellsuno.hxx" // for XModifyListenerArr_Impl + +#include <svl/lstner.hxx> +#include <svl/itemprop.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> + +#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldGroupInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include <com/sun/star/sheet/DataPilotFieldReference.hpp> +#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/XDataPilotDataLayoutFieldSupplier.hpp> +#include <com/sun/star/sheet/XDataPilotDescriptor.hpp> +#include <com/sun/star/sheet/XDataPilotField.hpp> +#include <com/sun/star/sheet/XDataPilotFieldGrouping.hpp> +#include <com/sun/star/sheet/XDataPilotTable.hpp> +#include <com/sun/star/sheet/XDataPilotTable2.hpp> +#include <com/sun/star/sheet/XDataPilotTables.hpp> + +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> + +#include <memory> +#include <vector> + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldFilter; + struct DataPilotTablePositionData; +}}}} + +class ScDocShell; +class ScDPSaveDimension; +class ScDPSaveGroupDimension; +class ScDPSaveNumGroupDimension; +struct ScDPNumGroupInfo; + +class ScDataPilotTableObj; +class ScDataPilotFieldObj; +class ScDataPilotItemObj; + + +class ScDataPilotConversion +{ +public: + static com::sun::star::sheet::GeneralFunction FirstFunc( sal_uInt16 nBits ); + static sal_uInt16 FunctionBit( com::sun::star::sheet::GeneralFunction eFunc ); + + static void FillGroupInfo( + ::com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo, + const ScDPNumGroupInfo& rGroupInfo ); +}; + +/** DataPilotTables collection per sheet. */ +class ScDataPilotTablesObj : public cppu::WeakImplHelper4< + com::sun::star::sheet::XDataPilotTables, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; + + ScDataPilotTableObj* GetObjectByIndex_Impl( sal_Int32 nIndex ); + ScDataPilotTableObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +public: + ScDataPilotTablesObj(ScDocShell* pDocSh, SCTAB nT); + virtual ~ScDataPilotTablesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDataPilotTables + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotDescriptor > SAL_CALL + createDataPilotDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertNewByName( const ::rtl::OUString& aName, + const ::com::sun::star::table::CellAddress& aOutputAddress, + const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XDataPilotDescriptor >& xDescriptor ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +// ScDataPilotDescriptorBase is never instantiated directly +class ScDataPilotDescriptorBase : public com::sun::star::sheet::XDataPilotDescriptor, + public com::sun::star::beans::XPropertySet, + public com::sun::star::sheet::XDataPilotDataLayoutFieldSupplier, + public com::sun::star::lang::XServiceInfo, + public com::sun::star::lang::XUnoTunnel, + public com::sun::star::lang::XTypeProvider, + public cppu::OWeakObject, + public SfxListener +{ +private: + SfxItemPropertySet maPropSet; + ScDocShell* pDocShell; + +public: + ScDataPilotDescriptorBase(ScDocShell* pDocSh); + virtual ~ScDataPilotDescriptorBase(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + ScDocShell* GetDocShell() const { return pDocShell; } + + // in the derivatives: + virtual ScDPObject* GetDPObject() const = 0; + virtual void SetDPObject(ScDPObject* pDPObj) = 0; + + // XDataPilotDescriptor + // getName, setName, getTag, setTag in derived classes + + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getSourceRange() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSourceRange( const ::com::sun::star::table::CellRangeAddress& aSourceRange ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL + getFilterDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getDataPilotFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getColumnFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getRowFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getPageFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getDataFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL + getHiddenFields() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XDataPilotDataLayoutFieldSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDataPilotField > + SAL_CALL getDataLayoutField() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScDataPilotDescriptorBase* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDataPilotDescriptor> xObj ); + + // XTypeProvider (overloaded in ScDataPilotTableObj) + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo is in derived classes +}; + +class ScDataPilotDescriptor : public ScDataPilotDescriptorBase +{ +private: + ScDPObject* mpDPObject; + +public: + ScDataPilotDescriptor(ScDocShell* pDocSh); + virtual ~ScDataPilotDescriptor(); + + virtual ScDPObject* GetDPObject() const; + virtual void SetDPObject(ScDPObject* pDPObj); + + // rest of XDataPilotDescriptor (incl. XNamed) + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTag() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +class ScDataPilotTableObj : public ScDataPilotDescriptorBase, + public com::sun::star::sheet::XDataPilotTable2, + public com::sun::star::util::XModifyBroadcaster +{ +private: + SCTAB nTab; + String aName; + XModifyListenerArr_Impl aModifyListeners; + + void Refreshed_Impl(); + +public: + ScDataPilotTableObj(ScDocShell* pDocSh, SCTAB nT, const String& rN); + virtual ~ScDataPilotTableObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + virtual ScDPObject* GetDPObject() const; + virtual void SetDPObject(ScDPObject* pDPObj); + + // rest of XDataPilotDescriptor (incl. XNamed) + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTag() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) + throw(::com::sun::star::uno::RuntimeException); + + // XDataPilotTable + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getOutputRange() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); + + // XDataPilotTable2 + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > + SAL_CALL getDrillDownData(const ::com::sun::star::table::CellAddress& aAddr) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::sheet::DataPilotTablePositionData + SAL_CALL getPositionData(const ::com::sun::star::table::CellAddress& aAddr) + throw(::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL insertDrillDownSheet(const ::com::sun::star::table::CellAddress& aAddr) + throw(::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getOutputRangeByType( sal_Int32 nType ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XModifyBroadcaster + virtual void SAL_CALL addModifyListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XTypeProvider (overloaded) + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +struct ScFieldIdentifier +{ + ::rtl::OUString maFieldName; /// Source field name. + sal_Int32 mnFieldIdx; /// Field index (if several fields with same name exist). + bool mbDataLayout; /// True = data layout field collecting all data fields as items. + + inline explicit ScFieldIdentifier() : + mnFieldIdx( 0 ), mbDataLayout( false ) {} + + inline explicit ScFieldIdentifier( const ::rtl::OUString& rFieldName, sal_Int32 nFieldIdx, bool bDataLayout ) : + maFieldName( rFieldName ), mnFieldIdx( nFieldIdx ), mbDataLayout( bDataLayout ) {} +}; + +/** Base class of all implementation objects based on a DataPilot descriptor + or DataPilot table object. Wraps acquiring and releasing the parent. */ +class ScDataPilotChildObjBase +{ +protected: + explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent ); + explicit ScDataPilotChildObjBase( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ); + virtual ~ScDataPilotChildObjBase(); + + /** Returns the wrapped DataPilot object (calls GetDPObject() at parent). */ + ScDPObject* GetDPObject() const; + /** Sets the passed DataPilot object (calls SetDPObject() at parent). */ + void SetDPObject( ScDPObject* pDPObject ); + + /** Returns the DataPilot dimension object related to the field described by maFieldId. */ + ScDPSaveDimension* GetDPDimension( ScDPObject** ppDPObject = 0 ) const; + + /** Returns the number of members for the field described by maFieldId. */ + sal_Int32 GetMemberCount() const; + /** Returns the collection of members for the field described by maFieldId. */ + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + GetMembers() const; + +protected: + ScDataPilotDescriptorBase& mrParent; + ScFieldIdentifier maFieldId; + +private: + ScDataPilotChildObjBase& operator=( const ScDataPilotChildObjBase& ); +}; + +typedef ::cppu::WeakImplHelper4 +< + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotFieldsObjImpl; + +/** Collection of all DataPilot fields, or of all fields from a specific dimension. */ +class ScDataPilotFieldsObj : public ScDataPilotChildObjBase, public ScDataPilotFieldsObjImpl +{ +public: + explicit ScDataPilotFieldsObj( + ScDataPilotDescriptorBase& rParent ); + + explicit ScDataPilotFieldsObj( + ScDataPilotDescriptorBase& rParent, + ::com::sun::star::sheet::DataPilotFieldOrientation eOrient ); + + virtual ~ScDataPilotFieldsObj(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + ScDataPilotFieldObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const; + ScDataPilotFieldObj* GetObjectByName_Impl( const ::rtl::OUString& rName ) const; + +private: + ::com::sun::star::uno::Any maOrient; /// Field orientation, no value = all fields. +}; + +typedef ::cppu::WeakImplHelper5 +< + ::com::sun::star::container::XNamed, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::sheet::XDataPilotField, + ::com::sun::star::sheet::XDataPilotFieldGrouping, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotFieldObjImpl; + +/** Implementation of a single DataPilot field. */ +class ScDataPilotFieldObj : public ScDataPilotChildObjBase, public ScDataPilotFieldObjImpl +{ +public: + ScDataPilotFieldObj( + ScDataPilotDescriptorBase& rParent, + const ScFieldIdentifier& rIdent ); + + ScDataPilotFieldObj( + ScDataPilotDescriptorBase& rParent, + const ScFieldIdentifier& rIdent, + const ::com::sun::star::uno::Any& rOrient ); + + virtual ~ScDataPilotFieldObj(); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XDatePilotField + virtual com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> SAL_CALL + getItems() throw (::com::sun::star::uno::RuntimeException); + + // only called from property-functions: + com::sun::star::sheet::DataPilotFieldOrientation getOrientation(void) const; + void setOrientation(com::sun::star::sheet::DataPilotFieldOrientation Orientation); + com::sun::star::sheet::GeneralFunction getFunction(void) const; + void setFunction(com::sun::star::sheet::GeneralFunction Function); + com::sun::star::uno::Sequence< com::sun::star::sheet::GeneralFunction > getSubtotals() const; + void setSubtotals(const com::sun::star::uno::Sequence< com::sun::star::sheet::GeneralFunction >& rFunctions); + rtl::OUString getCurrentPage() const; + void setCurrentPage(const rtl::OUString& sPage); + sal_Bool getUseCurrentPage() const; + void setUseCurrentPage(sal_Bool bUse); + const com::sun::star::sheet::DataPilotFieldAutoShowInfo* getAutoShowInfo(); + void setAutoShowInfo(const com::sun::star::sheet::DataPilotFieldAutoShowInfo* pInfo); + const com::sun::star::sheet::DataPilotFieldLayoutInfo* getLayoutInfo(); + void setLayoutInfo(const com::sun::star::sheet::DataPilotFieldLayoutInfo* pInfo); + const com::sun::star::sheet::DataPilotFieldReference* getReference(); + void setReference(const com::sun::star::sheet::DataPilotFieldReference* pInfo); + const com::sun::star::sheet::DataPilotFieldSortInfo* getSortInfo(); + void setSortInfo(const com::sun::star::sheet::DataPilotFieldSortInfo* pInfo); + sal_Bool getShowEmpty() const; + void setShowEmpty(sal_Bool bShow); + + sal_Bool hasGroupInfo(); + com::sun::star::sheet::DataPilotFieldGroupInfo getGroupInfo(); + void setGroupInfo(const com::sun::star::sheet::DataPilotFieldGroupInfo* pInfo); + + // XDataPilotFieldGrouping + sal_Bool HasString(const com::sun::star::uno::Sequence< ::rtl::OUString >& aItems, const ::rtl::OUString& aString); + virtual com::sun::star::uno::Reference < com::sun::star::sheet::XDataPilotField > SAL_CALL + createNameGroup(const com::sun::star::uno::Sequence< ::rtl::OUString >& aItems) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException); + virtual com::sun::star::uno::Reference < com::sun::star::sheet::XDataPilotField > SAL_CALL + createDateGroup(const com::sun::star::sheet::DataPilotFieldGroupInfo& rInfo) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IllegalArgumentException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > + mxItems; + SfxItemPropertySet maPropSet; + ::com::sun::star::uno::Any maOrient; +}; + +typedef ::std::vector< ::rtl::OUString > ScFieldGroupMembers; + +struct ScFieldGroup +{ + ::rtl::OUString maName; + ScFieldGroupMembers maMembers; +}; + +typedef ::std::vector< ScFieldGroup > ScFieldGroups; + +typedef ::cppu::WeakImplHelper4 +< + ::com::sun::star::container::XNameContainer, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotFieldGroupsObjImpl; + +/** Implementation of all grouped items in a DataPilot field. + + This is a stand-alone object without any connection to the base DataPilot + field. Grouping info has to be written back with the GroupInfo property of + the DataPilot field after modifying this object. + */ +class ScDataPilotFieldGroupsObj : public ScDataPilotFieldGroupsObjImpl +{ +public: + explicit ScDataPilotFieldGroupsObj( const ScFieldGroups& rGroups ); + virtual ~ScDataPilotFieldGroupsObj(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // implementation + ScFieldGroup& getFieldGroup( const ::rtl::OUString& rName ) throw(::com::sun::star::uno::RuntimeException); + void renameFieldGroup( const ::rtl::OUString& rOldName, const ::rtl::OUString& rNewName ) throw(::com::sun::star::uno::RuntimeException); + +private: + ScFieldGroups::iterator implFindByName( const ::rtl::OUString& rName ); + +private: + ScFieldGroups maGroups; +}; + +typedef ::cppu::WeakImplHelper5 +< + ::com::sun::star::container::XNameContainer, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotFieldGroupObjImpl; + +class ScDataPilotFieldGroupObj : public ScDataPilotFieldGroupObjImpl +{ +public: + explicit ScDataPilotFieldGroupObj( ScDataPilotFieldGroupsObj& rParent, const ::rtl::OUString& rGroupName ); + virtual ~ScDataPilotFieldGroupObj(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + ScDataPilotFieldGroupsObj& mrParent; + ::rtl::OUString maGroupName; +}; + +typedef ::cppu::WeakImplHelper2 +< + ::com::sun::star::container::XNamed, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotFieldGroupItemObjImpl; + +class ScDataPilotFieldGroupItemObj : public ScDataPilotFieldGroupItemObjImpl +{ +public: + explicit ScDataPilotFieldGroupItemObj( ScDataPilotFieldGroupObj& rParent, const ::rtl::OUString& rName ); + virtual ~ScDataPilotFieldGroupItemObj(); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + ScDataPilotFieldGroupObj& mrParent; + ::rtl::OUString maName; +}; + +typedef ::cppu::WeakImplHelper4 +< + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotItemsObjImpl; + +class ScDataPilotItemsObj : public ScDataPilotChildObjBase, public ScDataPilotItemsObjImpl +{ +public: + explicit ScDataPilotItemsObj( ScDataPilotDescriptorBase& rParent, const ScFieldIdentifier& rFieldId ); + virtual ~ScDataPilotItemsObj(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + ScDataPilotItemObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const; +}; + +typedef ::cppu::WeakImplHelper3 +< + ::com::sun::star::container::XNamed, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo +> +ScDataPilotItemObjImpl; + +class ScDataPilotItemObj : public ScDataPilotChildObjBase, public ScDataPilotItemObjImpl +{ +public: + explicit ScDataPilotItemObj( + ScDataPilotDescriptorBase& rParent, + const ScFieldIdentifier& rFieldId, + sal_Int32 nIndex ); + + virtual ~ScDataPilotItemObj(); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + SfxItemPropertySet maPropSet; + sal_Int32 mnIndex; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx new file mode 100644 index 000000000000..b94a12481855 --- /dev/null +++ b/sc/inc/datauno.hxx @@ -0,0 +1,699 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DATAUNO_HXX +#define SC_DATAUNO_HXX + +#include "global.hxx" +#include "queryparam.hxx" +#include "subtotalparam.hxx" + +#include <com/sun/star/sheet/TableFilterField.hpp> +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor.hpp> +#include <com/sun/star/sheet/XConsolidationDescriptor.hpp> +#include <com/sun/star/sheet/XDatabaseRanges.hpp> +#include <com/sun/star/sheet/XDatabaseRange.hpp> +#include <com/sun/star/sheet/XUnnamedDatabaseRanges.hpp> +#include <com/sun/star/sheet/XSubTotalDescriptor.hpp> +#include <com/sun/star/sheet/XSubTotalField.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/sheet/XSheetFilterDescriptor2.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase6.hxx> +#include "svl/itemprop.hxx" +#include "svl/lstner.hxx" + +class ScDBData; +class ScDocShell; + +class ScSubTotalFieldObj; +class ScDatabaseRangeObj; +class ScDataPilotDescriptorBase; + +struct ScSortParam; + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >* XDBRefreshListenerPtr; +SV_DECL_PTRARR_DEL( XDBRefreshListenerArr_Impl, XDBRefreshListenerPtr, 4, 4 ) + +class ScDataUnoConversion +{ +public: + static ScSubTotalFunc GeneralToSubTotal( com::sun::star::sheet::GeneralFunction eSummary ); + static com::sun::star::sheet::GeneralFunction SubTotalToGeneral( ScSubTotalFunc eSubTotal ); +}; + + +// ImportDescriptor is not available as Uno-Objekt any longer, only Property-Sequence + +class ScImportDescriptor +{ +public: + static void FillImportParam( + ScImportParam& rParam, + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rSeq ); + static void FillProperties( + com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rSeq, + const ScImportParam& rParam ); + static long GetPropertyCount(); +}; + +// SortDescriptor is not available as Uno-Objekt any longer, only Property-Sequence + +class ScSortDescriptor +{ +public: + static void FillSortParam( + ScSortParam& rParam, + const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rSeq ); + static void FillProperties( + com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rSeq, + const ScSortParam& rParam ); + static long GetPropertyCount(); +}; + + +// ScSubTotalDescriptorBase - base class for SubTotalDescriptor stand alone and in DB area (context?) + +// to uno, both look the same + +class ScSubTotalDescriptorBase : public cppu::WeakImplHelper6< + com::sun::star::sheet::XSubTotalDescriptor, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XUnoTunnel, + com::sun::star::lang::XServiceInfo > +{ +private: + SfxItemPropertySet aPropSet; + + ScSubTotalFieldObj* GetObjectByIndex_Impl(sal_uInt16 nIndex); + +public: + ScSubTotalDescriptorBase(); + virtual ~ScSubTotalDescriptorBase(); + + // in derived classes: + // (Fields are within the range) + virtual void GetData( ScSubTotalParam& rParam ) const = 0; + virtual void PutData( const ScSubTotalParam& rParam ) = 0; + + // XSubTotalDescriptor + virtual void SAL_CALL addNew( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::SubTotalColumn >& aSubTotalColumns, + sal_Int32 nGroupColumn ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScSubTotalDescriptorBase* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::sheet::XSubTotalDescriptor> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +// ScSubTotalDescriptor - dummy container to use with XImportTarget + +class ScSubTotalDescriptor : public ScSubTotalDescriptorBase +{ +private: + ScSubTotalParam aStoredParam; + +public: + ScSubTotalDescriptor(); + virtual ~ScSubTotalDescriptor(); + + // from ScSubTotalDescriptorBase: + virtual void GetData( ScSubTotalParam& rParam ) const; + virtual void PutData( const ScSubTotalParam& rParam ); + + // external access: + void SetParam( const ScSubTotalParam& rNew ); +}; + + +// ScRangeSubTotalDescriptor - SubTotalDescriptor of a data base area + +class ScRangeSubTotalDescriptor : public ScSubTotalDescriptorBase +{ +private: + ScDatabaseRangeObj* pParent; + +public: + ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar); + virtual ~ScRangeSubTotalDescriptor(); + + // from ScSubTotalDescriptorBase: + virtual void GetData( ScSubTotalParam& rParam ) const; + virtual void PutData( const ScSubTotalParam& rParam ); +}; + + +class ScSubTotalFieldObj : public cppu::WeakImplHelper2< + com::sun::star::sheet::XSubTotalField, + com::sun::star::lang::XServiceInfo > +{ +private: + com::sun::star::uno::Reference<com::sun::star::sheet::XSubTotalDescriptor> xRef; + ScSubTotalDescriptorBase& rParent; + sal_uInt16 nPos; + +public: + ScSubTotalFieldObj( ScSubTotalDescriptorBase* pDesc, sal_uInt16 nP ); + virtual ~ScSubTotalFieldObj(); + + // XSubTotalField + virtual sal_Int32 SAL_CALL getGroupColumn() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setGroupColumn( sal_Int32 nGroupColumn ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::SubTotalColumn > SAL_CALL + getSubTotalColumns() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSubTotalColumns( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::SubTotalColumn >& aSubTotalColumns ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScConsolidationDescriptor : public cppu::WeakImplHelper2< + com::sun::star::sheet::XConsolidationDescriptor, + com::sun::star::lang::XServiceInfo > +{ +private: + ScConsolidateParam aParam; + +public: + ScConsolidationDescriptor(); + virtual ~ScConsolidationDescriptor(); + + void SetParam( const ScConsolidateParam& rNew ); + const ScConsolidateParam& GetParam() const { return aParam; } + + // XConsolidationDescriptor + virtual ::com::sun::star::sheet::GeneralFunction SAL_CALL getFunction() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFunction( ::com::sun::star::sheet::GeneralFunction nFunction ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress > SAL_CALL + getSources( ) throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSources( const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& aSources ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellAddress SAL_CALL getStartOutputPosition() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStartOutputPosition( + const ::com::sun::star::table::CellAddress& aStartOutputPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getUseColumnHeaders() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setUseColumnHeaders( sal_Bool bUseColumnHeaders ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getUseRowHeaders() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setUseRowHeaders( sal_Bool bUseRowHeaders ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getInsertLinks() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setInsertLinks( sal_Bool bInsertLinks ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +// ScFilterDescriptorBase - base class for FilterDescriptor +// stand alone, in a DB area (or context?) and in the DataPilot + +// to uno, all three look the same + +class ScFilterDescriptorBase : public cppu::WeakImplHelper4< + com::sun::star::sheet::XSheetFilterDescriptor, + com::sun::star::sheet::XSheetFilterDescriptor2, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + SfxItemPropertySet aPropSet; + ScDocShell* pDocSh; + +public: + static void fillQueryParam( + ScQueryParam& rParam, ScDocument* pDoc, + const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField2>& aFilterFields); + + ScFilterDescriptorBase(ScDocShell* pDocShell); + virtual ~ScFilterDescriptorBase(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // in the derived classes(?): + // (nField[] here within the area) + virtual void GetData( ScQueryParam& rParam ) const = 0; + virtual void PutData( const ScQueryParam& rParam ) = 0; + + // XSheetFilterDescriptor + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField > SAL_CALL + getFilterFields() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFilterFields( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::TableFilterField >& aFilterFields ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetFilterDescriptor2 + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::TableFilterField2 > SAL_CALL + getFilterFields2() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFilterFields2( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::TableFilterField2 >& aFilterFields ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +// ScFilterDescriptor - dummy container to use with XFilterable + +class ScFilterDescriptor : public ScFilterDescriptorBase +{ +private: + ScQueryParam aStoredParam; // nField[] here within the area + +public: + ScFilterDescriptor(ScDocShell* pDocSh); + virtual ~ScFilterDescriptor(); + + // from ScFilterDescriptorBase: + virtual void GetData( ScQueryParam& rParam ) const; + virtual void PutData( const ScQueryParam& rParam ); + + // external access: + void SetParam( const ScQueryParam& rNew ); + const ScQueryParam& GetParam() const { return aStoredParam; } +}; + + +// ScRangeFilterDescriptor - FilterDescriptor of a data base area + +class ScRangeFilterDescriptor : public ScFilterDescriptorBase +{ +private: + ScDatabaseRangeObj* pParent; + +public: + ScRangeFilterDescriptor(ScDocShell* pDocSh, ScDatabaseRangeObj* pPar); + virtual ~ScRangeFilterDescriptor(); + + // from ScFilterDescriptorBase: + virtual void GetData( ScQueryParam& rParam ) const; + virtual void PutData( const ScQueryParam& rParam ); +}; + + +// ScDataPilotFilterDescriptor - FilterDescriptor of a DataPilotDescriptors + +class ScDataPilotFilterDescriptor : public ScFilterDescriptorBase +{ +private: + ScDataPilotDescriptorBase* pParent; + +public: + ScDataPilotFilterDescriptor(ScDocShell* pDocSh, ScDataPilotDescriptorBase* pPar); + virtual ~ScDataPilotFilterDescriptor(); + + // from ScFilterDescriptorBase: + virtual void GetData( ScQueryParam& rParam ) const; + virtual void PutData( const ScQueryParam& rParam ); +}; + + +class ScDatabaseRangeObj : public cppu::WeakImplHelper6< + com::sun::star::sheet::XDatabaseRange, + com::sun::star::util::XRefreshable, + com::sun::star::container::XNamed, + com::sun::star::sheet::XCellRangeReferrer, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + String aName; + SfxItemPropertySet aPropSet; + XDBRefreshListenerArr_Impl aRefreshListeners; + bool bIsUnnamed; + SCTAB aTab; + +private: + ScDBData* GetDBData_Impl() const; + void Refreshed_Impl(); + +public: + ScDatabaseRangeObj(ScDocShell* pDocSh, const String& rNm); + ScDatabaseRangeObj(ScDocShell* pDocSh, const SCTAB nTab); + virtual ~ScDatabaseRangeObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // nField[] here within the area: + void GetQueryParam(ScQueryParam& rQueryParam) const; + void SetQueryParam(const ScQueryParam& rQueryParam); + void GetSubTotalParam(ScSubTotalParam& rSubTotalParam) const; + void SetSubTotalParam(const ScSubTotalParam& rSubTotalParam); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XDatabaseRange + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getDataArea() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDataArea( const ::com::sun::star::table::CellRangeAddress& aDataArea ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getSortDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSheetFilterDescriptor > SAL_CALL + getFilterDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSubTotalDescriptor > SAL_CALL + getSubTotalDescriptor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getImportDescriptor() throw(::com::sun::star::uno::RuntimeException); + + // XRefreshable + virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangeReferrer + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getReferredCells() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScDatabaseRangesObj : public cppu::WeakImplHelper4< + com::sun::star::sheet::XDatabaseRanges, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + ScDatabaseRangeObj* GetObjectByIndex_Impl(sal_uInt16 nIndex); + ScDatabaseRangeObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +public: + ScDatabaseRangesObj(ScDocShell* pDocSh); + virtual ~ScDatabaseRangesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDatabaseRanges + virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, + const ::com::sun::star::table::CellRangeAddress& aRange ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +class ScUnnamedDatabaseRangesObj : public cppu::WeakImplHelper1< + com::sun::star::sheet::XUnnamedDatabaseRanges>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + +public: + ScUnnamedDatabaseRangesObj(ScDocShell* pDocSh); + virtual ~ScUnnamedDatabaseRangesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XUnnamedDatabaseRanges + virtual void SAL_CALL setByTable( const ::com::sun::star::table::CellRangeAddress& aRange ) + throw(::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IndexOutOfBoundsException ); + virtual com::sun::star::uno::Any SAL_CALL getByTable( sal_Int32 nTab ) + throw(::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::container::NoSuchElementException ); + virtual sal_Bool SAL_CALL hasByTable( sal_Int32 nTab ) + throw (::com::sun::star::uno::RuntimeException, + ::com::sun::star::lang::IndexOutOfBoundsException); +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx new file mode 100644 index 000000000000..8f26f667f5f8 --- /dev/null +++ b/sc/inc/dbcolect.hxx @@ -0,0 +1,249 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DBCOLECT_HXX +#define SC_DBCOLECT_HXX + +#include "scdllapi.h" +#include "collect.hxx" +#include "global.hxx" // MAXQUERY +#include "sortparam.hxx" // MAXSORT +#include "refreshtimer.hxx" +#include "address.hxx" +#include "scdllapi.h" +#include "subtotalparam.hxx" + +#include <boost/ptr_container/ptr_vector.hpp> + +class ScDocument; + +class ScDBData : public ScDataObject, public ScRefreshTimer +{ +private: + // DBParam + String aName; + SCTAB nTable; + SCCOL nStartCol; + SCROW nStartRow; + SCCOL nEndCol; + SCROW nEndRow; + bool bByRow; + bool bHasHeader; + bool bDoSize; + bool bKeepFmt; + bool bStripData; + // SortParam + bool bSortCaseSens; + bool bSortNaturalSort; + bool bIncludePattern; + bool bSortInplace; + bool bSortUserDef; + sal_uInt16 nSortUserIndex; + SCTAB nSortDestTab; + SCCOL nSortDestCol; + SCROW nSortDestRow; + bool bDoSort[MAXSORT]; + SCCOLROW nSortField[MAXSORT]; + bool bAscending[MAXSORT]; + ::com::sun::star::lang::Locale aSortLocale; + String aSortAlgorithm; + // QueryParam + bool bQueryInplace; + bool bQueryCaseSens; + bool bQueryRegExp; + bool bQueryDuplicate; + SCTAB nQueryDestTab; + SCCOL nQueryDestCol; + SCROW nQueryDestRow; + bool bDoQuery[MAXQUERY]; + SCCOLROW nQueryField[MAXQUERY]; + ScQueryOp eQueryOp[MAXQUERY]; + bool bQueryByString[MAXQUERY]; + bool bQueryByDate[MAXQUERY]; + String* pQueryStr[MAXQUERY]; + double nQueryVal[MAXQUERY]; + ScQueryConnect eQueryConnect[MAXQUERY]; + bool bIsAdvanced; // sal_True if created by advanced filter + ScRange aAdvSource; // source range + + ScSubTotalParam maSubTotal; + + // data base import + bool bDBImport; + String aDBName; + String aDBStatement; + bool bDBNative; + bool bDBSelection; // not in Param: if selection, block update + bool bDBSql; // aDBStatement is SQL not a name + sal_uInt8 nDBType; // enum DBObject (up to now only dbTable, dbQuery) + + sal_uInt16 nIndex; // unique index formulas + bool bAutoFilter; // AutoFilter? (not saved) + bool bModified; // is set/cleared for/by(?) UpdateReference + + using ScRefreshTimer::operator==; + +public: + SC_DLLPUBLIC ScDBData(const String& rName, + SCTAB nTab, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + bool bByR = sal_True, bool bHasH = sal_True); + ScDBData(const ScDBData& rData); + ~ScDBData(); + + virtual ScDataObject* Clone() const; + + ScDBData& operator= (const ScDBData& rData); + + bool operator== (const ScDBData& rData) const; + + SCTAB GetTable() const; + const String& GetName() const { return aName; } + void GetName(String& rName) const { rName = aName; } + void SetName(const String& rName) { aName = rName; } + void GetArea(SCTAB& rTab, SCCOL& rCol1, SCROW& rRow1, SCCOL& rCol2, SCROW& rRow2) const; + SC_DLLPUBLIC void GetArea(ScRange& rRange) const; + void SetArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + void MoveTo(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + bool IsByRow() const { return bByRow; } + void SetByRow(bool bByR) { bByRow = bByR; } + bool HasHeader() const { return bHasHeader; } + void SetHeader(bool bHasH) { bHasHeader = bHasH; } + void SetIndex(sal_uInt16 nInd) { nIndex = nInd; } + sal_uInt16 GetIndex() const { return nIndex; } + bool IsDoSize() const { return bDoSize; } + void SetDoSize(bool bSet) { bDoSize = bSet; } + bool IsKeepFmt() const { return bKeepFmt; } + void SetKeepFmt(bool bSet) { bKeepFmt = bSet; } + bool IsStripData() const { return bStripData; } + void SetStripData(bool bSet) { bStripData = bSet; } + + String GetSourceString() const; + String GetOperations() const; + + void GetSortParam(ScSortParam& rSortParam) const; + void SetSortParam(const ScSortParam& rSortParam); + + SC_DLLPUBLIC void GetQueryParam(ScQueryParam& rQueryParam) const; + SC_DLLPUBLIC void SetQueryParam(const ScQueryParam& rQueryParam); + SC_DLLPUBLIC bool GetAdvancedQuerySource(ScRange& rSource) const; + SC_DLLPUBLIC void SetAdvancedQuerySource(const ScRange* pSource); + + void GetSubTotalParam(ScSubTotalParam& rSubTotalParam) const; + void SetSubTotalParam(const ScSubTotalParam& rSubTotalParam); + + void GetImportParam(ScImportParam& rImportParam) const; + void SetImportParam(const ScImportParam& rImportParam); + + bool IsDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const; + bool IsDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + + bool HasImportParam() const { return bDBImport; } + bool HasQueryParam() const { return bDoQuery[0]; } + bool HasSortParam() const { return bDoSort[0]; } + bool HasSubTotalParam() const { return maSubTotal.bGroupActive[0]; } + + bool HasImportSelection() const { return bDBSelection; } + void SetImportSelection(bool bSet) { bDBSelection = bSet; } + + bool HasAutoFilter() const { return bAutoFilter; } + void SetAutoFilter(bool bSet) { bAutoFilter = bSet; } + + bool IsModified() const { return bModified; } + void SetModified(bool bMod) { bModified = bMod; } + + void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + void UpdateReference(ScDocument* pDoc, UpdateRefMode eUpdateRefMode, + SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz); + + void ExtendDataArea(ScDocument* pDoc); +}; + + +//------------------------------------------------------------------------ +class SC_DLLPUBLIC ScDBCollection : public ScSortedCollection +{ + typedef ::boost::ptr_vector<ScDBData> DBRangesType; +public: + typedef DBRangesType AnonDBsType; + +private: + Link aRefreshHandler; + ScDocument* pDoc; + sal_uInt16 nEntryIndex; // counter for unique indices + AnonDBsType maAnonDBs; + +public: + ScDBCollection(sal_uInt16 nLim = 4, sal_uInt16 nDel = 4, sal_Bool bDup = false, ScDocument* pDocument = NULL) : + ScSortedCollection ( nLim, nDel, bDup ), + pDoc ( pDocument ), + nEntryIndex ( SC_START_INDEX_DB_COLL ) // see above for the names + {} + + ScDBCollection(const ScDBCollection& r); + + virtual ScDataObject* Clone() const { return new ScDBCollection(*this); } + ScDBData* operator[]( const sal_uInt16 nIndex) const {return (ScDBData*)At(nIndex);} + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; + virtual sal_Bool IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; + ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bStartOnly) const; + ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + ScDBData* GetFilterDBAtTable(SCTAB nTab) const; + ScDBData* GetDBNearCursor(SCCOL nCol, SCROW nRow, SCTAB nTab ); + + sal_Bool SearchName( const String& rName, sal_uInt16& rIndex ) const; + + void DeleteOnTab( SCTAB nTab ); + void UpdateReference(UpdateRefMode eUpdateRefMode, + SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz); + void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + + ScDBData* FindIndex(sal_uInt16 nIndex); + sal_uInt16 GetEntryIndex() { return nEntryIndex; } + void SetEntryIndex(sal_uInt16 nInd) { nEntryIndex = nInd; } + virtual sal_Bool Insert(ScDataObject* pScDataObject); + + void SetRefreshHandler( const Link& rLink ) + { aRefreshHandler = rLink; } + const Link& GetRefreshHandler() const { return aRefreshHandler; } + + const ScDBData* findAnonAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, bool bStartOnly) const; + const ScDBData* findAnonByRange(const ScRange& rRange) const; + ScDBData* getAnonByRange(const ScRange& rRange); + void insertAnonRange(ScDBData* pData); + + const AnonDBsType& getAnonRanges() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dbdocutl.hxx b/sc/inc/dbdocutl.hxx new file mode 100644 index 000000000000..26c0e5438f77 --- /dev/null +++ b/sc/inc/dbdocutl.hxx @@ -0,0 +1,64 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DBDOCUTL_HXX +#define SC_DBDOCUTL_HXX + +#include "address.hxx" +#include <tools/solar.h> +#include <com/sun/star/uno/Reference.hxx> + +class ScDocument; + +namespace com { namespace sun { namespace star { namespace sdbc { + class XRow; +} } } } + + +class ScDatabaseDocUtil +{ +public: + /** + * Detailed information on single string value. + */ + struct StrData + { + bool mbSimpleText; + sal_uInt32 mnStrLength; + + StrData(); + }; + static void PutData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, + const ::com::sun::star::uno::Reference< + ::com::sun::star::sdbc::XRow>& xRow, long nRowPos, + long nType, sal_Bool bCurrency, StrData* pStrData = NULL ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dbtoken.hxx b/sc/inc/dbtoken.hxx new file mode 100644 index 000000000000..edca2e505016 --- /dev/null +++ b/sc/inc/dbtoken.hxx @@ -0,0 +1,56 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _DBTOKEN_HXX +#define _DBTOKEN_HXX + +#include "compiler.hxx" + + +// SET DBG_TOKEN=string +// + - make new data +// - - do not make old data +// aA - dump old/new token array +// uU - dump old/new UPN array + +sal_Bool DbgToken( char ); +ScTokenArray* DbgMakeTokenArray + ( ScDocument* pDoc, SCTAB nTab, const String& r, sal_uInt16& rErr ); +void DbgDumpTokenArray( const sal_uInt8* pArr, sal_uInt16 nLen, const char* pMsg ); +void DbgDelTokenArray( ScTokenArray* ); +formula::StackVar DbgInterpret( ScDocument* pDok, const ScTokenArray* pToken, + SCCOL nCOL, SCROW nROW, SCTAB nTAB, + formula::StackVar eformula::StackVar, + char* &rStringErgPtr, + double& rDoubleErg, + sal_uInt16& rError, + ScMatrix** ppMat); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/defltuno.hxx b/sc/inc/defltuno.hxx new file mode 100644 index 000000000000..697180bbfaa1 --- /dev/null +++ b/sc/inc/defltuno.hxx @@ -0,0 +1,132 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DEFLTUNO_HXX +#define SC_DEFLTUNO_HXX + +#include <svl/lstner.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <cppuhelper/implbase3.hxx> +#include <svl/itemprop.hxx> + +class ScDocShell; + + +class ScDocDefaultsObj : public ::cppu::WeakImplHelper3< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SfxItemPropertyMap aPropertyMap; + + void ItemsChanged(); + +public: + ScDocDefaultsObj(ScDocShell* pDocSh); + virtual ~ScDocDefaultsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL + getPropertyStates( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( + const ::rtl::OUString& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/detdata.hxx b/sc/inc/detdata.hxx new file mode 100644 index 000000000000..9dc87fa7f57e --- /dev/null +++ b/sc/inc/detdata.hxx @@ -0,0 +1,109 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DETDATA_HXX +#define SC_DETDATA_HXX + +#include <svl/svarray.hxx> +#include "global.hxx" +#include "address.hxx" + + +//------------------------------------------------------------------------ + +#define SC_DETOP_GROW 4 + +//------------------------------------------------------------------------ +enum ScDetOpType +{ + SCDETOP_ADDSUCC, + SCDETOP_DELSUCC, + SCDETOP_ADDPRED, + SCDETOP_DELPRED, + SCDETOP_ADDERROR +}; + +//------------------------------------------------------------------------ + +class ScDetOpData +{ + ScAddress aPos; + ScDetOpType eOperation; + +public: + ScDetOpData( const ScAddress& rP, ScDetOpType eOp ) : + aPos(rP), eOperation(eOp) {} + + ScDetOpData( const ScDetOpData& rData ) : + aPos(rData.aPos), eOperation(rData.eOperation) {} + + const ScAddress& GetPos() const { return aPos; } + ScDetOpType GetOperation() const { return eOperation; } + + // for UpdateRef: + void SetPos(const ScAddress& rNew) { aPos=rNew; } + + int operator== ( const ScDetOpData& r ) const + { return eOperation == r.eOperation && aPos == r.aPos; } +}; + +//------------------------------------------------------------------------ + +// +// list of operators +// + +typedef ScDetOpData* ScDetOpDataPtr; + +SV_DECL_PTRARR_DEL(ScDetOpArr_Impl, ScDetOpDataPtr, SC_DETOP_GROW, SC_DETOP_GROW) + +class ScDetOpList : public ScDetOpArr_Impl +{ + sal_Bool bHasAddError; // updated in append + +public: + ScDetOpList() : bHasAddError(false) {} + ScDetOpList(const ScDetOpList& rList); + ~ScDetOpList() {} + + void DeleteOnTab( SCTAB nTab ); + void UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + + sal_Bool operator==( const ScDetOpList& r ) const; // for ref-undo + + void Append( ScDetOpData* pData ); + + sal_Bool HasAddError() const { return bHasAddError; } +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx new file mode 100644 index 000000000000..6509074dfc61 --- /dev/null +++ b/sc/inc/detfunc.hxx @@ -0,0 +1,176 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DETFUNC_HXX +#define SC_DETFUNC_HXX + +#include "address.hxx" +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include "scdllapi.h" +#include "token.hxx" + +#include <vector> + +class SdrObject; +class SdrPage; +class String; + +class ScPostIt; +class ScCommentData; +class ScDetectiveData; +class ScDocument; +class ScAddress; +class ScRange; +class ScRangeList; + +#define SC_DET_MAXCIRCLE 1000 + +enum ScDetectiveDelete { SC_DET_ALL, SC_DET_DETECTIVE, SC_DET_CIRCLES, SC_DET_ARROWS }; + +enum ScDetectiveObjType +{ + SC_DETOBJ_NONE, + SC_DETOBJ_ARROW, + SC_DETOBJ_FROMOTHERTAB, + SC_DETOBJ_TOOTHERTAB, + SC_DETOBJ_CIRCLE +}; + +class SC_DLLPUBLIC ScDetectiveFunc +{ + static ColorData nArrowColor; + static ColorData nErrorColor; + static ColorData nCommentColor; + static sal_Bool bColorsInitialized; + + ScDocument* pDoc; + SCTAB nTab; + + enum DrawPosMode + { + DRAWPOS_TOPLEFT, /// Top-left edge of the cell. + DRAWPOS_BOTTOMRIGHT, /// Bottom-right edge of the cell. + DRAWPOS_DETARROW, /// Position inside cell for detective arrows. + DRAWPOS_CAPTIONLEFT, /// Top-left edge of the cell for captions. + DRAWPOS_CAPTIONRIGHT /// Top-right edge of the cell for captions (incl. merged cells). + }; + + /** Returns a drawing layer position for the passed cell address. */ + Point GetDrawPos( SCCOL nCol, SCROW nRow, DrawPosMode eMode ) const; + + /** Returns the drawing layer rectangle for the passed cell range. */ + Rectangle GetDrawRect( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + + /** Returns the drawing layer rectangle for the passed cell address. */ + Rectangle GetDrawRect( SCCOL nCol, SCROW nRow ) const; + + sal_Bool HasArrow( const ScAddress& rStart, + SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab ); + + void DeleteArrowsAt( SCCOL nCol, SCROW nRow, sal_Bool bDestPnt ); + void DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + + sal_Bool HasError( const ScRange& rRange, ScAddress& rErrPos ); + + void FillAttributes( ScDetectiveData& rData ); + + // called from DrawEntry/DrawAlienEntry and InsertObject + sal_Bool InsertArrow( SCCOL nCol, SCROW nRow, + SCCOL nRefStartCol, SCROW nRefStartRow, + SCCOL nRefEndCol, SCROW nRefEndRow, + sal_Bool bFromOtherTab, sal_Bool bRed, + ScDetectiveData& rData ); + sal_Bool InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, sal_Bool bRed, + ScDetectiveData& rData ); + + // DrawEntry / DrawAlienEntry check for existing arrows and errors + sal_Bool DrawEntry( SCCOL nCol, SCROW nRow, const ScRange& rRef, + ScDetectiveData& rData ); + sal_Bool DrawAlienEntry( const ScRange& rRef, + ScDetectiveData& rData ); + + void DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData ); + + sal_uInt16 InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel ); + sal_uInt16 InsertPredLevelArea( const ScRange& rRef, + ScDetectiveData& rData, sal_uInt16 nLevel ); + sal_uInt16 FindPredLevel( SCCOL nCol, SCROW nRow, sal_uInt16 nLevel, sal_uInt16 nDeleteLevel ); + sal_uInt16 FindPredLevelArea( const ScRange& rRef, + sal_uInt16 nLevel, sal_uInt16 nDeleteLevel ); + + sal_uInt16 InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, sal_uInt16 nLevel ); + + sal_uInt16 InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + ScDetectiveData& rData, sal_uInt16 nLevel ); + sal_uInt16 FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uInt16 nLevel, sal_uInt16 nDeleteLevel ); + + sal_Bool FindFrameForObject( SdrObject* pObject, ScRange& rRange ); + + void Modified(); + +public: + ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {} + + sal_Bool ShowSucc( SCCOL nCol, SCROW nRow ); + sal_Bool ShowPred( SCCOL nCol, SCROW nRow ); + sal_Bool ShowError( SCCOL nCol, SCROW nRow ); + + sal_Bool DeleteSucc( SCCOL nCol, SCROW nRow ); + sal_Bool DeletePred( SCCOL nCol, SCROW nRow ); + sal_Bool DeleteAll( ScDetectiveDelete eWhat ); + + sal_Bool MarkInvalid(sal_Bool& rOverflow); + + void GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens); + void GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ::std::vector<ScTokenRef>& rRefTokens); + + static void UpdateAllComments( ScDocument& rDoc ); // on all tables + void UpdateAllArrowColors(); // on all tables + + static sal_Bool IsNonAlienArrow( SdrObject* pObject ); + + ScDetectiveObjType GetDetectiveObjectType( SdrObject* pObject, SCTAB nObjTab, + ScAddress& rPosition, ScRange& rSource, sal_Bool& rRedLine ); + void InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition, + const ScRange& rSource, sal_Bool bRedLine ); + + static ColorData GetArrowColor(); + static ColorData GetErrorColor(); + static ColorData GetCommentColor(); + static void InitializeColors(); + static sal_Bool IsColorsInitialized(); +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dispuno.hxx b/sc/inc/dispuno.hxx new file mode 100644 index 000000000000..4b29605cfc3f --- /dev/null +++ b/sc/inc/dispuno.hxx @@ -0,0 +1,153 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DISPUNO_HXX +#define SC_DISPUNO_HXX + +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <cppuhelper/implbase2.hxx> +#include <svl/lstner.hxx> +#include <svl/svarray.hxx> +#include "global.hxx" // ScImportParam + + +namespace com { namespace sun { namespace star { namespace frame { + class XDispatchProviderInterception; +} } } } + +class ScTabViewShell; + + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XStatusListener >* XStatusListenerPtr; +SV_DECL_PTRARR_DEL( XStatusListenerArr_Impl, XStatusListenerPtr, 4, 4 ) + + +class ScDispatchProviderInterceptor : public cppu::WeakImplHelper2< + com::sun::star::frame::XDispatchProviderInterceptor, + com::sun::star::lang::XEventListener>, + public SfxListener +{ + ScTabViewShell* pViewShell; + + // the component which's dispatches we're intercepting + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatchProviderInterception> m_xIntercepted; + + // chaining + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatchProvider> m_xSlaveDispatcher; + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatchProvider> m_xMasterDispatcher; + + // own dispatch + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatch> m_xMyDispatch; + +public: + + ScDispatchProviderInterceptor(ScTabViewShell* pViewSh); + virtual ~ScDispatchProviderInterceptor(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDispatchProvider + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > SAL_CALL + queryDispatch( const ::com::sun::star::util::URL& aURL, + const ::rtl::OUString& aTargetFrameName, + sal_Int32 nSearchFlags ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatch > > SAL_CALL + queryDispatches( const ::com::sun::star::uno::Sequence< + ::com::sun::star::frame::DispatchDescriptor >& aDescripts ) + throw(::com::sun::star::uno::RuntimeException); + + // XDispatchProviderInterceptor + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL + getSlaveDispatchProvider() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSlaveDispatchProvider( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatchProvider >& xNewDispatchProvider ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > SAL_CALL + getMasterDispatchProvider() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setMasterDispatchProvider( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XDispatchProvider >& xNewSupplier ) + throw(::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScDispatch : public cppu::WeakImplHelper2< + com::sun::star::frame::XDispatch, + com::sun::star::view::XSelectionChangeListener >, + public SfxListener +{ + ScTabViewShell* pViewShell; + XStatusListenerArr_Impl aDataSourceListeners; + ScImportParam aLastImport; + sal_Bool bListeningToView; + +public: + + ScDispatch(ScTabViewShell* pViewSh); + virtual ~ScDispatch(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDispatch + virtual void SAL_CALL dispatch( const ::com::sun::star::util::URL& aURL, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aArgs ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addStatusListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XStatusListener >& xControl, + const ::com::sun::star::util::URL& aURL ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeStatusListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XStatusListener >& xControl, + const ::com::sun::star::util::URL& aURL ) + throw(::com::sun::star::uno::RuntimeException); + + // XSelectionChangeListener + virtual void SAL_CALL selectionChanged( const ::com::sun::star::lang::EventObject& aEvent ) + throw (::com::sun::star::uno::RuntimeException); + + // XEventListener + virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx new file mode 100644 index 000000000000..c06b9935e1b1 --- /dev/null +++ b/sc/inc/dociter.hxx @@ -0,0 +1,565 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DOCITER_HXX +#define SC_DOCITER_HXX + +#include "address.hxx" +#include <tools/solar.h> +#include "global.hxx" +#include "scdllapi.h" +#include "queryparam.hxx" + +#include <memory> + +#include <set> +#include <vector> +#include <boost/shared_ptr.hpp> + +class ScDocument; +class ScBaseCell; +class ScPatternAttr; +class ScAttrArray; +class ScAttrIterator; +class ScRange; +class ScFlatBoolRowSegments; + +class ScDocumentIterator // walk through all non-empty cells +{ +private: + ScDocument* pDoc; + SCTAB nStartTab; + SCTAB nEndTab; + + const ScPatternAttr* pDefPattern; + + SCCOL nCol; + SCROW nRow; + SCTAB nTab; + ScBaseCell* pCell; + const ScPatternAttr* pPattern; + + + SCSIZE nColPos; + SCSIZE nAttrPos; + + sal_Bool GetThis(); + sal_Bool GetThisCol(); + +public: + ScDocumentIterator( ScDocument* pDocument, SCTAB nStartTable, SCTAB nEndTable ); + ~ScDocumentIterator(); + + sal_Bool GetFirst(); + sal_Bool GetNext(); + + ScBaseCell* GetCell(); + const ScPatternAttr* GetPattern(); + void GetPos( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ); +}; + +class ScValueIterator // walk through all values in an area +{ +private: + double fNextValue; + ScDocument* pDoc; + const ScAttrArray* pAttrArray; + sal_uLong nNumFormat; // for CalcAsShown + sal_uLong nNumFmtIndex; + SCCOL nStartCol; + SCROW nStartRow; + SCTAB nStartTab; + SCCOL nEndCol; + SCROW nEndRow; + SCTAB nEndTab; + SCCOL nCol; + SCROW nRow; + SCTAB nTab; + SCSIZE nColRow; + SCROW nNextRow; + SCROW nAttrEndRow; + short nNumFmtType; + sal_Bool bNumValid; + sal_Bool bSubTotal; + sal_Bool bNextValid; + sal_Bool bCalcAsShown; + sal_Bool bTextAsZero; + + sal_Bool GetThis(double& rValue, sal_uInt16& rErr); +public: + + ScValueIterator(ScDocument* pDocument, + const ScRange& rRange, sal_Bool bSTotal = false, + sal_Bool bTextAsZero = false ); + void GetCurNumFmtInfo( short& nType, sal_uLong& nIndex ); + /// Does NOT reset rValue if no value found! + sal_Bool GetFirst(double& rValue, sal_uInt16& rErr); + /// Does NOT reset rValue if no value found! + sal_Bool GetNext(double& rValue, sal_uInt16& rErr) + { + return bNextValid ? ( bNextValid = false, rValue = fNextValue, + rErr = 0, nRow = nNextRow, + ++nColRow, bNumValid = false, sal_True ) + : ( ++nRow, GetThis(rValue, rErr) ); + } +}; + +class ScDBQueryDataIterator +{ +public: + struct Value + { + ::rtl::OUString maString; + double mfValue; + sal_uInt16 mnError; + bool mbIsNumber; + + Value(); + }; + +private: + static SCROW GetRowByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow); + static ScBaseCell* GetCellByColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCCOL nCol, SCSIZE nColRow); + static ScAttrArray* GetAttrArrayByCol(ScDocument& rDoc, SCTAB nTab, SCCOL nCol); + static bool IsQueryValid(ScDocument& rDoc, const ScQueryParam& rParam, SCTAB nTab, SCROW nRow, ScBaseCell* pCell); + static SCSIZE SearchColEntryIndex(ScDocument& rDoc, SCTAB nTab, SCROW nRow, SCCOL nCol); + + class DataAccess + { + public: + DataAccess(const ScDBQueryDataIterator* pParent); + virtual ~DataAccess() = 0; + virtual bool getCurrent(Value& rValue) = 0; + virtual bool getFirst(Value& rValue) = 0; + virtual bool getNext(Value& rValue) = 0; + protected: + const ScDBQueryDataIterator* mpParent; + }; + + class DataAccessInternal : public DataAccess + { + public: + DataAccessInternal(const ScDBQueryDataIterator* pParent, ScDBQueryParamInternal* pParam, ScDocument* pDoc); + virtual ~DataAccessInternal(); + virtual bool getCurrent(Value& rValue); + virtual bool getFirst(Value& rValue); + virtual bool getNext(Value& rValue); + + private: + ScDBQueryParamInternal* mpParam; + ScDocument* mpDoc; + const ScAttrArray* pAttrArray; + sal_uLong nNumFormat; // for CalcAsShown + sal_uLong nNumFmtIndex; + SCCOL nCol; + SCROW nRow; + SCSIZE nColRow; + SCROW nAttrEndRow; + SCTAB nTab; + short nNumFmtType; + bool bCalcAsShown; + }; + + class DataAccessMatrix : public DataAccess + { + public: + DataAccessMatrix(const ScDBQueryDataIterator* pParent, ScDBQueryParamMatrix* pParam); + virtual ~DataAccessMatrix(); + virtual bool getCurrent(Value& rValue); + virtual bool getFirst(Value& rValue); + virtual bool getNext(Value& rValue); + + private: + bool isValidQuery(SCROW mnRow, const ScMatrix& rMat) const; + + ScDBQueryParamMatrix* mpParam; + SCROW mnCurRow; + SCROW mnRows; + SCCOL mnCols; + }; + + ::std::auto_ptr<ScDBQueryParamBase> mpParam; + ::std::auto_ptr<DataAccess> mpData; + +public: + ScDBQueryDataIterator(ScDocument* pDocument, ScDBQueryParamBase* pParam); + /// Does NOT reset rValue if no value found! + bool GetFirst(Value& rValue); + /// Does NOT reset rValue if no value found! + bool GetNext(Value& rValue); +}; + +class ScCellIterator // walk through all cells in an area +{ // for SubTotal no hidden and no sub-total lines +private: + ScDocument* pDoc; + SCCOL nStartCol; + SCROW nStartRow; + SCTAB nStartTab; + SCCOL nEndCol; + SCROW nEndRow; + SCTAB nEndTab; + SCCOL nCol; + SCROW nRow; + SCTAB nTab; + SCSIZE nColRow; + sal_Bool bSubTotal; + + ScBaseCell* GetThis(); +public: + ScCellIterator(ScDocument* pDocument, + SCCOL nSCol, SCROW nSRow, SCTAB nSTab, + SCCOL nECol, SCROW nERow, SCTAB nETab, + sal_Bool bSTotal = false); + ScCellIterator(ScDocument* pDocument, + const ScRange& rRange, sal_Bool bSTotal = false); + ScBaseCell* GetFirst(); + ScBaseCell* GetNext(); + SCCOL GetCol() const { return nCol; } + SCROW GetRow() const { return nRow; } + SCTAB GetTab() const { return nTab; } + ScAddress GetPos() const { return ScAddress( nCol, nRow, nTab ); } +}; + +class ScQueryCellIterator // walk through all non-empty cells in an area +{ + enum StopOnMismatchBits + { + nStopOnMismatchDisabled = 0x00, + nStopOnMismatchEnabled = 0x01, + nStopOnMismatchOccurred = 0x02, + nStopOnMismatchExecuted = nStopOnMismatchEnabled | nStopOnMismatchOccurred + }; + + enum TestEqualConditionBits + { + nTestEqualConditionDisabled = 0x00, + nTestEqualConditionEnabled = 0x01, + nTestEqualConditionMatched = 0x02, + nTestEqualConditionFulfilled = nTestEqualConditionEnabled | nTestEqualConditionMatched + }; + +private: + ScQueryParam aParam; + ScDocument* pDoc; + const ScAttrArray* pAttrArray; + sal_uLong nNumFormat; + SCTAB nTab; + SCCOL nCol; + SCROW nRow; + SCSIZE nColRow; + SCROW nAttrEndRow; + sal_uInt8 nStopOnMismatch; + sal_uInt8 nTestEqualCondition; + sal_Bool bAdvanceQuery; + sal_Bool bIgnoreMismatchOnLeadingStrings; + + ScBaseCell* GetThis(); + + /* Only works if no regular expression is involved, only + searches for rows in one column, and only the first + query entry is considered with simple conditions + SC_LESS_EQUAL (sorted ascending) or SC_GREATER_EQUAL + (sorted descending). Check these things before + invocation! Delivers a starting point, continue with + GetThis() and GetNext() afterwards. Introduced for + FindEqualOrSortedLastInRange() + */ + ScBaseCell* BinarySearch(); + +public: + ScQueryCellIterator(ScDocument* pDocument, SCTAB nTable, + const ScQueryParam& aParam, sal_Bool bMod = true); + // for bMod = FALSE the QueryParam has to be filled + // (bIsString) + ScBaseCell* GetFirst(); + ScBaseCell* GetNext(); + SCCOL GetCol() { return nCol; } + SCROW GetRow() { return nRow; } + + // increments all Entry.nField, if column + // changes, for ScInterpreter ScHLookup() + void SetAdvanceQueryParamEntryField( sal_Bool bVal ) + { bAdvanceQuery = bVal; } + void AdvanceQueryParamEntryField(); + + /** If set, iterator stops on first non-matching cell + content. May be used in SC_LESS_EQUAL queries where a + cell range is assumed to be sorted; stops on first + value being greater than the queried value and + GetFirst()/GetNext() return NULL. StoppedOnMismatch() + returns sal_True then. + However, the iterator's conditions are not set to end + all queries, GetCol() and GetRow() return values for + the non-matching cell, further GetNext() calls may be + executed. */ + void SetStopOnMismatch( sal_Bool bVal ) + { + nStopOnMismatch = sal::static_int_cast<sal_uInt8>(bVal ? nStopOnMismatchEnabled : + nStopOnMismatchDisabled); + } + sal_Bool StoppedOnMismatch() const + { return nStopOnMismatch == nStopOnMismatchExecuted; } + + /** If set, an additional test for SC_EQUAL condition is + executed in ScTable::ValidQuery() if SC_LESS_EQUAL or + SC_GREATER_EQUAL conditions are to be tested. May be + used where a cell range is assumed to be sorted to stop + if an equal match is found. */ + void SetTestEqualCondition( sal_Bool bVal ) + { + nTestEqualCondition = sal::static_int_cast<sal_uInt8>(bVal ? + nTestEqualConditionEnabled : + nTestEqualConditionDisabled); + } + sal_Bool IsEqualConditionFulfilled() const + { return nTestEqualCondition == nTestEqualConditionFulfilled; } + + /** In a range assumed to be sorted find either the last of + a sequence of equal entries or the last being less than + (or greater than) the queried value. Used by the + interpreter for [HV]?LOOKUP() and MATCH(). Column and + row position of the found entry are returned, otherwise + invalid. + + @param bSearchForEqualAfterMismatch + Continue searching for an equal entry even if the + last entry matching the range was found, in case + the data is not sorted. Is always done if regular + expressions are involved. + + @param bIgnoreMismatchOnLeadingStrings + Normally strings are sorted behind numerical + values. If this parameter is sal_True, the search does + not stop when encountering a string and does not + assume that no values follow anymore. + If querying for a string a mismatch on the first + entry, e.g. column header, is ignored. + + @ATTENTION! StopOnMismatch, TestEqualCondition and + the internal IgnoreMismatchOnLeadingStrings and query + params are in an undefined state upon return! The + iterator is not usable anymore except for obtaining the + number format! + */ + sal_Bool FindEqualOrSortedLastInRange( SCCOL& nFoundCol, + SCROW& nFoundRow, sal_Bool bSearchForEqualAfterMismatch = false, + sal_Bool bIgnoreMismatchOnLeadingStrings = sal_True ); +}; + +class ScDocAttrIterator // all attribute areas +{ +private: + ScDocument* pDoc; + SCTAB nTab; + SCCOL nEndCol; + SCROW nStartRow; + SCROW nEndRow; + SCCOL nCol; + ScAttrIterator* pColIter; + +public: + ScDocAttrIterator(ScDocument* pDocument, SCTAB nTable, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + ~ScDocAttrIterator(); + + const ScPatternAttr* GetNext( SCCOL& rCol, SCROW& rRow1, SCROW& rRow2 ); +}; + +class ScAttrRectIterator // all attribute areas, including areas stretching + // across more then one column +{ +private: + ScDocument* pDoc; + SCTAB nTab; + SCCOL nEndCol; + SCROW nStartRow; + SCROW nEndRow; + SCCOL nIterStartCol; + SCCOL nIterEndCol; + ScAttrIterator* pColIter; + +public: + ScAttrRectIterator(ScDocument* pDocument, SCTAB nTable, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + ~ScAttrRectIterator(); + + void DataChanged(); + const ScPatternAttr* GetNext( SCCOL& rCol1, SCCOL& rCol2, SCROW& rRow1, SCROW& rRow2 ); +}; + +class ScHorizontalCellIterator // walk through all non empty cells in an area +{ // row by row +private: + ScDocument* pDoc; + SCTAB nTab; + SCCOL nStartCol; + SCCOL nEndCol; + SCROW nEndRow; + SCROW* pNextRows; + SCSIZE* pNextIndices; + SCCOL nCol; + SCROW nRow; + sal_Bool bMore; + +public: + ScHorizontalCellIterator(ScDocument* pDocument, SCTAB nTable, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + ~ScHorizontalCellIterator(); + + ScBaseCell* GetNext( SCCOL& rCol, SCROW& rRow ); + sal_Bool ReturnNext( SCCOL& rCol, SCROW& rRow ); + +private: + void Advance(); +}; + + +// +// returns all areas with non-default formatting (horizontal) +// + +class ScHorizontalAttrIterator +{ +private: + ScDocument* pDoc; + SCTAB nTab; + SCCOL nStartCol; + SCROW nStartRow; + SCCOL nEndCol; + SCROW nEndRow; + + SCROW* pNextEnd; + SCSIZE* pIndices; + const ScPatternAttr** ppPatterns; + SCCOL nCol; + SCROW nRow; + sal_Bool bRowEmpty; + +public: + ScHorizontalAttrIterator( ScDocument* pDocument, SCTAB nTable, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + ~ScHorizontalAttrIterator(); + + const ScPatternAttr* GetNext( SCCOL& rCol1, SCCOL& rCol2, SCROW& rRow ); +}; + +// +// returns non-empty cells and areas with formatting (horizontal) +// + +class SC_DLLPUBLIC ScUsedAreaIterator +{ +private: + ScHorizontalCellIterator aCellIter; + ScHorizontalAttrIterator aAttrIter; + + SCCOL nNextCol; + SCROW nNextRow; + + SCCOL nCellCol; + SCROW nCellRow; + const ScBaseCell* pCell; + SCCOL nAttrCol1; + SCCOL nAttrCol2; + SCROW nAttrRow; + const ScPatternAttr* pPattern; + + SCCOL nFoundStartCol; // results after GetNext + SCCOL nFoundEndCol; + SCROW nFoundRow; + const ScPatternAttr* pFoundPattern; + const ScBaseCell* pFoundCell; + +public: + ScUsedAreaIterator( ScDocument* pDocument, SCTAB nTable, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + ~ScUsedAreaIterator(); + + sal_Bool GetNext(); + + SCCOL GetStartCol() const { return nFoundStartCol; } + SCCOL GetEndCol() const { return nFoundEndCol; } + SCROW GetRow() const { return nFoundRow; } + const ScPatternAttr* GetPattern() const { return pFoundPattern; } + const ScBaseCell* GetCell() const { return pFoundCell; } +}; + +class ScRowBreakIterator +{ +public: + static SCROW NOT_FOUND; + + explicit ScRowBreakIterator(::std::set<SCROW>& rBreaks); + SCROW first(); + SCROW next(); + +private: + ::std::set<SCROW>& mrBreaks; + ::std::set<SCROW>::const_iterator maItr; + ::std::set<SCROW>::const_iterator maEnd; +}; + +class ScDocRowHeightUpdater +{ +public: + struct TabRanges + { + SCTAB mnTab; + ::boost::shared_ptr<ScFlatBoolRowSegments> mpRanges; + + TabRanges(); + TabRanges(SCTAB nTab); + }; + + /** + * Passing a NULL pointer to pTabRangesArray forces the heights of all + * rows in all tables to be updated. + */ + explicit ScDocRowHeightUpdater( + ScDocument& rDoc, OutputDevice* pOutDev, double fPPTX, double fPPTY, + const ::std::vector<TabRanges>* pTabRangesArray = NULL); + + void update(); + +private: + void updateAll(); + +private: + ScDocument& mrDoc; + OutputDevice* mpOutDev; + double mfPPTX; + double mfPPTY; + const ::std::vector<TabRanges>* mpTabRangesArray; +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx new file mode 100644 index 000000000000..999b591f1881 --- /dev/null +++ b/sc/inc/docoptio.hxx @@ -0,0 +1,244 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DOCOPTIO_HXX +#define SC_DOCOPTIO_HXX + +#include <unotools/configitem.hxx> +#include <svl/poolitem.hxx> +#include <svl/itemprop.hxx> +#include "scdllapi.h" +#include "optutil.hxx" + +#include "formula/grammar.hxx" + +class SC_DLLPUBLIC ScDocOptions +{ + double fIterEps; // epsilon value dazu + sal_uInt16 nIterCount; // number + sal_uInt16 nPrecStandardFormat; // precision for standard format + ScOptionsUtil::KeyBindingType eKeyBindingType; + sal_uInt16 nDay; // Null date: + sal_uInt16 nMonth; + sal_uInt16 nYear; + sal_uInt16 nYear2000; // earlier 19YY is assumed, 20YY otherwise (if only YY of year is given) + sal_uInt16 nTabDistance; // distance of standard tabs + sal_Bool bIsIgnoreCase; // ignore case for comparisons? + sal_Bool bIsIter; // iterations for circular refs + sal_Bool bCalcAsShown; // calculate as shown (wrt precision) + sal_Bool bMatchWholeCell; // search criteria must match the whole cell + sal_Bool bDoAutoSpell; // auto-spelling + sal_Bool bLookUpColRowNames; // determine column-/row titles automagically + sal_Bool bFormulaRegexEnabled; // regular expressions in formulas enabled + bool bUseEnglishFuncName; // use English function name even if the locale is not English. + ::formula::FormulaGrammar::Grammar eFormulaGrammar; // formula grammar used to switch different formula syntax + + ::rtl::OUString aFormulaSepArg; + ::rtl::OUString aFormulaSepArrayRow; + ::rtl::OUString aFormulaSepArrayCol; + +public: + ScDocOptions(); + ScDocOptions( const ScDocOptions& rCpy ); + ~ScDocOptions(); + + sal_Bool IsLookUpColRowNames() const { return bLookUpColRowNames; } + void SetLookUpColRowNames( sal_Bool bVal ) { bLookUpColRowNames = bVal; } + sal_Bool IsAutoSpell() const { return bDoAutoSpell; } + void SetAutoSpell( sal_Bool bVal ) { bDoAutoSpell = bVal; } + sal_Bool IsMatchWholeCell() const { return bMatchWholeCell; } + void SetMatchWholeCell( sal_Bool bVal ){ bMatchWholeCell = bVal; } + sal_Bool IsIgnoreCase() const { return bIsIgnoreCase; } + void SetIgnoreCase( sal_Bool bVal ) { bIsIgnoreCase = bVal; } + sal_Bool IsIter() const { return bIsIter; } + void SetIter( sal_Bool bVal ) { bIsIter = bVal; } + sal_uInt16 GetIterCount() const { return nIterCount; } + void SetIterCount( sal_uInt16 nCount) { nIterCount = nCount; } + double GetIterEps() const { return fIterEps; } + void SetIterEps( double fEps ) { fIterEps = fEps; } + + void GetDate( sal_uInt16& rD, sal_uInt16& rM, sal_uInt16& rY ) const + { rD = nDay; rM = nMonth; rY = nYear;} + void SetDate (sal_uInt16 nD, sal_uInt16 nM, sal_uInt16 nY) + { nDay = nD; nMonth = nM; nYear = nY; } + sal_uInt16 GetTabDistance() const { return nTabDistance;} + void SetTabDistance( sal_uInt16 nTabDist ) {nTabDistance = nTabDist;} + + void ResetDocOptions(); + + inline const ScDocOptions& operator=( const ScDocOptions& rOpt ); + inline int operator==( const ScDocOptions& rOpt ) const; + inline int operator!=( const ScDocOptions& rOpt ) const; + + sal_uInt16 GetStdPrecision() const { return nPrecStandardFormat; } + void SetStdPrecision( sal_uInt16 n ) { nPrecStandardFormat = n; } + + ScOptionsUtil::KeyBindingType GetKeyBindingType() const { return eKeyBindingType; } + void SetKeyBindingType( ScOptionsUtil::KeyBindingType e ) { eKeyBindingType = e; } + + sal_Bool IsCalcAsShown() const { return bCalcAsShown; } + void SetCalcAsShown( sal_Bool bVal ) { bCalcAsShown = bVal; } + + void SetYear2000( sal_uInt16 nVal ) { nYear2000 = nVal; } + sal_uInt16 GetYear2000() const { return nYear2000; } + + void SetFormulaRegexEnabled( sal_Bool bVal ) { bFormulaRegexEnabled = bVal; } + sal_Bool IsFormulaRegexEnabled() const { return bFormulaRegexEnabled; } + + void SetFormulaSyntax( ::formula::FormulaGrammar::Grammar eGram ) { eFormulaGrammar = eGram; } + ::formula::FormulaGrammar::Grammar GetFormulaSyntax() const { return eFormulaGrammar; } + + void SetUseEnglishFuncName( bool bVal ) { bUseEnglishFuncName = bVal; } + bool GetUseEnglishFuncName() const { return bUseEnglishFuncName; } + + void SetFormulaSepArg(const ::rtl::OUString& rSep) { aFormulaSepArg = rSep; } + ::rtl::OUString GetFormulaSepArg() const { return aFormulaSepArg; } + + void SetFormulaSepArrayRow(const ::rtl::OUString& rSep) { aFormulaSepArrayRow = rSep; } + ::rtl::OUString GetFormulaSepArrayRow() const { return aFormulaSepArrayRow; } + + void SetFormulaSepArrayCol(const ::rtl::OUString& rSep) { aFormulaSepArrayCol = rSep; } + ::rtl::OUString GetFormulaSepArrayCol() const { return aFormulaSepArrayCol; } + + void ResetFormulaSeparators(); + static const LocaleDataWrapper& GetLocaleDataWrapper(); +}; + +inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy ) +{ + bIsIgnoreCase = rCpy.bIsIgnoreCase; + bIsIter = rCpy.bIsIter; + nIterCount = rCpy.nIterCount; + fIterEps = rCpy.fIterEps; + nPrecStandardFormat = rCpy.nPrecStandardFormat; + eKeyBindingType = rCpy.eKeyBindingType; + nDay = rCpy.nDay; + nMonth = rCpy.nMonth; + nYear = rCpy.nYear; + nYear2000 = rCpy.nYear2000; + nTabDistance = rCpy.nTabDistance; + bCalcAsShown = rCpy.bCalcAsShown; + bMatchWholeCell = rCpy.bMatchWholeCell; + bDoAutoSpell = rCpy.bDoAutoSpell; + bLookUpColRowNames = rCpy.bLookUpColRowNames; + bFormulaRegexEnabled= rCpy.bFormulaRegexEnabled; + bUseEnglishFuncName = rCpy.bUseEnglishFuncName; + eFormulaGrammar = rCpy.eFormulaGrammar; + aFormulaSepArg = rCpy.aFormulaSepArg; + aFormulaSepArrayRow = rCpy.aFormulaSepArrayRow; + aFormulaSepArrayCol = rCpy.aFormulaSepArrayCol; + + return *this; +} + +inline int ScDocOptions::operator==( const ScDocOptions& rOpt ) const +{ + return ( + rOpt.bIsIgnoreCase == bIsIgnoreCase + && rOpt.bIsIter == bIsIter + && rOpt.nIterCount == nIterCount + && rOpt.fIterEps == fIterEps + && rOpt.nPrecStandardFormat == nPrecStandardFormat + && rOpt.eKeyBindingType == eKeyBindingType + && rOpt.nDay == nDay + && rOpt.nMonth == nMonth + && rOpt.nYear == nYear + && rOpt.nYear2000 == nYear2000 + && rOpt.nTabDistance == nTabDistance + && rOpt.bCalcAsShown == bCalcAsShown + && rOpt.bMatchWholeCell == bMatchWholeCell + && rOpt.bDoAutoSpell == bDoAutoSpell + && rOpt.bLookUpColRowNames == bLookUpColRowNames + && rOpt.bFormulaRegexEnabled == bFormulaRegexEnabled + && rOpt.bUseEnglishFuncName == bUseEnglishFuncName + && rOpt.eFormulaGrammar == eFormulaGrammar + && rOpt.aFormulaSepArg == aFormulaSepArg + && rOpt.aFormulaSepArrayRow == aFormulaSepArrayRow + && rOpt.aFormulaSepArrayCol == aFormulaSepArrayCol + ); +} + +inline int ScDocOptions::operator!=( const ScDocOptions& rOpt ) const +{ + return !(operator==(rOpt)); +} + +//================================================================== +// Item for preferences dialog - calculation +//================================================================== + +class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem +{ +public: + TYPEINFO(); + ScTpCalcItem( sal_uInt16 nWhich, + const ScDocOptions& rOpt ); + ScTpCalcItem( const ScTpCalcItem& rItem ); + ~ScTpCalcItem(); + + virtual String GetValueText() const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + const ScDocOptions& GetDocOptions() const { return theOptions; } + +private: + ScDocOptions theOptions; +}; + +//================================================================== +// Config Item containing document options +//================================================================== + +class ScDocCfg : public ScDocOptions +{ + ScLinkConfigItem aCalcItem; + ScLinkConfigItem aFormulaItem; + ScLinkConfigItem aLayoutItem; + ScLinkConfigItem aCompatItem; + + DECL_LINK( CalcCommitHdl, void* ); + DECL_LINK( FormulaCommitHdl, void* ); + DECL_LINK( LayoutCommitHdl, void* ); + DECL_LINK( CompatCommitHdl, void* ); + + com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetFormulaPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetCompatPropertyNames(); + +public: + ScDocCfg(); + + void SetOptions( const ScDocOptions& rNew ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/docparam.hxx b/sc/inc/docparam.hxx new file mode 100644 index 000000000000..c5d0ec31085f --- /dev/null +++ b/sc/inc/docparam.hxx @@ -0,0 +1,47 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_DOCPARAM_HXX +#define SC_DOCPARAM_HXX + +#include "address.hxx" + +// Let's put here misc structures that get passed to ScDocument's methods. + +struct ScColWidthParam +{ + SCROW mnMaxTextRow; + sal_uInt32 mnMaxTextLen; + bool mbSimpleText; + + ScColWidthParam(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx new file mode 100644 index 000000000000..1af92d2b1cf1 --- /dev/null +++ b/sc/inc/docpool.hxx @@ -0,0 +1,84 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCDOCPOL_HXX +#define SC_SCDOCPOL_HXX + +#include <svl/itempool.hxx> +#include "scdllapi.h" + +class ScStyleSheet; + +class SC_DLLPUBLIC ScDocumentPool: public SfxItemPool +{ + SfxPoolItem** ppPoolDefaults; + SfxItemPool* pSecondary; + static sal_uInt16* pVersionMap1; + static sal_uInt16* pVersionMap2; + static sal_uInt16* pVersionMap3; + static sal_uInt16* pVersionMap4; + static sal_uInt16* pVersionMap5; + static sal_uInt16* pVersionMap6; + static sal_uInt16* pVersionMap7; + static sal_uInt16* pVersionMap8; + static sal_uInt16* pVersionMap9; + static sal_uInt16* pVersionMap10; + static sal_uInt16* pVersionMap11; + +public: + ScDocumentPool( SfxItemPool* pSecPool = NULL, sal_Bool bLoadRefCounts = false ); +protected: + virtual ~ScDocumentPool(); +public: + + virtual SfxItemPool* Clone() const; + virtual SfxMapUnit GetMetric( sal_uInt16 nWhich ) const; + + virtual const SfxPoolItem& Put( const SfxPoolItem&, sal_uInt16 nWhich = 0 ); + virtual void Remove( const SfxPoolItem& ); + static void CheckRef( const SfxPoolItem& ); + + void StyleDeleted( ScStyleSheet* pStyle ); // delete templates(?) in organizer + void CellStyleCreated( const String& rName ); + virtual SfxItemPresentation GetPresentation( + const SfxPoolItem& rItem, + SfxItemPresentation ePresentation, + SfxMapUnit ePresentationMetric, + String& rText, + const IntlWrapper* pIntl = 0 ) const; + + static void InitVersionMaps(); + static void DeleteVersionMaps(); +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx new file mode 100644 index 000000000000..3c485fd48575 --- /dev/null +++ b/sc/inc/document.hxx @@ -0,0 +1,1873 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DOCUMENT_HXX +#define SC_DOCUMENT_HXX + + +#include <vcl/prntypes.hxx> +#include <vcl/timer.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <rtl/ref.hxx> +#include "scdllapi.h" +#include "rangelst.hxx" +#include "rangenam.hxx" +#include "table.hxx" +#include "brdcst.hxx" +#include "tabopparams.hxx" +#include "types.hxx" +#include "formula/grammar.hxx" +#include <com/sun/star/chart2/XChartDocument.hpp> +#include "scdllapi.h" + +#include <memory> +#include <map> +#include <set> +#include <list> +#include <boost/ptr_container/ptr_vector.hpp> + +namespace editeng { class SvxBorderLine; } + +class KeyEvent; +class OutputDevice; +class SdrObject; +class SfxBroadcaster; +class SfxListener; +class SfxHint; +class SfxItemSet; +class SfxObjectShell; +class SfxBindings; +class SfxPoolItem; +class SfxItemPool; +class SfxPrinter; +class SfxStatusBarManager; +class SfxStyleSheetBase; +class SvMemoryStream; +class SvNumberFormatter; +class SvxBoxInfoItem; +class SvxBoxItem; +class SvxBrushItem; +class SvxForbiddenCharactersTable; +namespace sfx2 { + class LinkManager; + } +class SvxSearchItem; +class SvxShadowItem; +class Window; +class XColorTable; +class List; + +struct ScAttrEntry; +class ScAutoFormatData; +class ScBaseCell; +class ScStringCell; +class ScBroadcastAreaSlotMachine; +class ScChangeViewSettings; +class ScChartCollection; +class ScChartListenerCollection; +class ScConditionalFormat; +class ScConditionalFormatList; +class ScDBCollection; +class ScDBData; +class ScDetOpData; +class ScDetOpList; +class ScDocOptions; +class ScDocProtection; +class ScDocumentPool; +class ScDrawLayer; +class ScExtDocOptions; +class ScExternalRefManager; +class ScFormulaCell; +class ScMacroManager; +class ScMarkData; +class ScOutlineTable; +class ScPatternAttr; +class ScPrintRangeSaver; +class ScRangeData; +class ScRangeName; +class ScStyleSheet; +class ScStyleSheetPool; +class ScTable; +class ScTableProtection; +class ScTokenArray; +class ScValidationData; +class ScValidationDataList; +class ScViewOptions; +class ScStrCollection; +class TypedScStrCollection; +class ScChangeTrack; +class ScFieldEditEngine; +class ScNoteEditEngine; +struct ScConsolidateParam; +class ScDPObject; +class ScDPCollection; +class ScMatrix; +class ScScriptTypeData; +class ScPoolHelper; +struct ScSortParam; +class ScRefreshTimerControl; +class ScUnoListenerCalls; +class ScUnoRefList; +class ScRecursionHelper; +struct RowInfo; +struct ScTableInfo; +struct ScTabOpParam; +class VirtualDevice; +class ScAutoNameCache; +class ScTemporaryChartLock; +class ScLookupCache; +struct ScLookupCacheMapImpl; +class SfxUndoManager; +class ScFormulaParserPool; +struct ScClipParam; +struct ScClipRangeNameData; +class ScRowBreakIterator; +struct ScSetStringParam; +class ScDocRowHeightUpdater; +struct ScColWidthParam; +struct ScCopyBlockFromClipParams; + +namespace com { namespace sun { namespace star { + namespace lang { + class XMultiServiceFactory; + struct EventObject; + } + namespace i18n { + class XBreakIterator; + } + namespace util { + class XModifyListener; + } + namespace embed { + class XEmbeddedObject; + } + namespace script { namespace vba { + class XVBAEventProcessor; + } } + namespace sheet { + struct TablePageBreakData; + } +} } } + +#include <svl/zforlist.hxx> + +#define SC_DOC_NEW 0xFFFF + +#define SC_MACROCALL_ALLOWED 0 +#define SC_MACROCALL_NOTALLOWED 1 +#define SC_MACROCALL_ASK 2 + +#define SC_ASIANCOMPRESSION_INVALID 0xff +#define SC_ASIANKERNING_INVALID 0xff + + +enum ScDocumentMode + { + SCDOCMODE_DOCUMENT, + SCDOCMODE_CLIP, + SCDOCMODE_UNDO + }; + + +struct ScDocStat +{ + String aDocName; + SCTAB nTableCount; + sal_uLong nCellCount; + sal_uInt16 nPageCount; +}; + +// DDE link modes +const sal_uInt8 SC_DDE_DEFAULT = 0; +const sal_uInt8 SC_DDE_ENGLISH = 1; +const sal_uInt8 SC_DDE_TEXT = 2; +const sal_uInt8 SC_DDE_IGNOREMODE = 255; /// For usage in FindDdeLink() only! + +class ScDocument +{ +friend class ScDocumentIterator; +friend class ScValueIterator; +friend class ScDBQueryDataIterator; +friend class ScCellIterator; +friend class ScQueryCellIterator; +friend class ScHorizontalCellIterator; +friend class ScHorizontalAttrIterator; +friend class ScDocAttrIterator; +friend class ScAttrRectIterator; +friend class ScDocShell; +friend class ScDocRowHeightUpdater; + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; + + rtl::Reference<ScPoolHelper> xPoolHelper; + + SfxUndoManager* mpUndoManager; + ScFieldEditEngine* pEditEngine; // uses pEditPool from xPoolHelper + ScNoteEditEngine* pNoteEngine; // uses pEditPool from xPoolHelper + SfxItemPool* pNoteItemPool; // SfxItemPool to be used if pDrawLayer not created. + SfxObjectShell* pShell; + SfxPrinter* pPrinter; + VirtualDevice* pVirtualDevice_100th_mm; + ScDrawLayer* pDrawLayer; // SdrModel + XColorTable* pColorTable; + ScConditionalFormatList* pCondFormList; // conditional formats + ScValidationDataList* pValidationList; // validity + SvNumberFormatterIndexTable* pFormatExchangeList; // for application of number formats + ScTable* pTab[MAXTABCOUNT]; + mutable ScRangeName* pRangeName; + ScDBCollection* pDBCollection; + ScDPCollection* pDPCollection; + ScChartCollection* pChartCollection; + std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock; + ScPatternAttr* pSelectionAttr; // Attributes of a block + mutable sfx2::LinkManager* pLinkManager; + ScFormulaCell* pFormulaTree; // formula tree (start) + ScFormulaCell* pEOFormulaTree; // formula tree (end), last cell + ScFormulaCell* pFormulaTrack; // BroadcastTrack (start) + ScFormulaCell* pEOFormulaTrack; // BrodcastTrack (end), last cell + ScBroadcastAreaSlotMachine* pBASM; // BroadcastAreas + ScChartListenerCollection* pChartListenerCollection; + ScStrCollection* pOtherObjects; // non-chart OLE objects + SvMemoryStream* pClipData; + ScDetOpList* pDetOpList; + ScChangeTrack* pChangeTrack; + SfxBroadcaster* pUnoBroadcaster; + ScUnoListenerCalls* pUnoListenerCalls; + ScUnoRefList* pUnoRefUndoList; + ScChangeViewSettings* pChangeViewSettings; + ScScriptTypeData* pScriptTypeData; + ScRefreshTimerControl* pRefreshTimerControl; + rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharacters; + + ScFieldEditEngine* pCacheFieldEditEngine; + + ::std::auto_ptr<ScDocProtection> pDocProtection; + ::std::auto_ptr<ScClipParam> mpClipParam; + + ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr; + ::std::auto_ptr<ScMacroManager> mpMacroMgr; + + + // mutable for lazy construction + mutable ::std::auto_ptr< ScFormulaParserPool > + mxFormulaParserPool; /// Pool for all external formula parsers used by this document. + + String aDocName; // optional: name of document + String aDocCodeName; // optional: name of document (twice?) + ScRangePairListRef xColNameRanges; + ScRangePairListRef xRowNameRanges; + + ScViewOptions* pViewOptions; // view options + ScDocOptions* pDocOptions; // document options + ScExtDocOptions* pExtDocOptions; // for import etc. + ScConsolidateParam* pConsolidateDlgData; + + ScRecursionHelper* pRecursionHelper; // information for recursive and iterative cell formulas + + ScAutoNameCache* pAutoNameCache; // for automatic name lookup during CompileXML + + ScLookupCacheMapImpl* pLookupCacheMapImpl; // cache for lookups like VLOOKUP and MATCH + + sal_Int64 nUnoObjectId; // counted up for UNO objects + + sal_uInt32 nRangeOverflowType; // used in (xml) loading for overflow warnings + + ScRange aEmbedRange; + ScAddress aCurTextWidthCalcPos; + ScAddress aOnlineSpellPos; // within whole document + ScRange aVisSpellRange; + ScAddress aVisSpellPos; // within aVisSpellRange (see nVisSpellState) + + Timer aTrackTimer; + + com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > + mxVbaEvents; + +public: + boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use + ScInterpreterTableOpParams aLastTableOpParams; // remember last params +private: + + LanguageType eLanguage; // default language + LanguageType eCjkLanguage; // default language for asian text + LanguageType eCtlLanguage; // default language for complex text + CharSet eSrcSet; // during reading: source character set + + /** The compiler grammar used in document storage. GRAM_PODF for ODF 1.1 + documents, GRAM_ODFF for ODF 1.2 documents. */ + formula::FormulaGrammar::Grammar eStorageGrammar; + + /** The compiler grammar used in ODF import after brackets had been + stripped (which they shouldn't, but until that's fixed) by the XML + importer. */ + formula::FormulaGrammar::Grammar eXmlImportGrammar; + + sal_uLong nFormulaCodeInTree; // FormelRPN im Formelbaum + sal_uLong nXMLImportedFormulaCount; // progress count during XML import + sal_uInt16 nInterpretLevel; // >0 if in interpreter + sal_uInt16 nMacroInterpretLevel; // >0 if macro in interpreter + sal_uInt16 nInterpreterTableOpLevel; // >0 if in interpreter TableOp + SCTAB nMaxTableNumber; + sal_uInt16 nSrcVer; // file version (load/save) + SCROW nSrcMaxRow; // number of lines to load/save + sal_uInt16 nFormulaTrackCount; + sal_uInt16 nHardRecalcState; // 0: soft, 1: hard-warn, 2: hard + SCTAB nVisibleTab; // for OLE etc. + + ScLkUpdMode eLinkMode; + + sal_Bool bAutoCalc; // calculate automatically + sal_Bool bAutoCalcShellDisabled; // in/from/for ScDocShell disabled + // are there ForcedFormulas which have to be calculated + // in interaction with ScDocShell SetDocumentModified, + // AutoCalcShellDisabled and TrackFormulas + sal_Bool bForcedFormulaPending; + sal_Bool bCalculatingFormulaTree; + sal_Bool bIsClip; + sal_Bool bIsUndo; + sal_Bool bIsVisible; // set from view ctor + + sal_Bool bIsEmbedded; // display/adjust Embedded area? + + // no SetDirty for ScFormulaCell::CompileTokenArray but at the end of + // ScDocument::CompileAll[WithFormats], CopyScenario, CopyBlockFromClip + sal_Bool bNoSetDirty; + // no broadcast, construct no listener during insert from a different + // Doc (per filter or the like ), not until CompileAll / CalcAfterLoad + sal_Bool bInsertingFromOtherDoc; + bool bLoadingMedium; + bool bImportingXML; // special handling of formula text + sal_Bool bXMLFromWrapper; // distinguish ScXMLImportWrapper from external component + sal_Bool bCalcingAfterLoad; // in CalcAfterLoad TRUE + // don't construct/destruct listeners temporarily + sal_Bool bNoListening; + sal_Bool bIdleDisabled; + sal_Bool bInLinkUpdate; // TableLink or AreaLink + sal_Bool bChartListenerCollectionNeedsUpdate; + // are/were there RC_FORCED formula cells in the document (if set once to TRUE then set forever) + sal_Bool bHasForcedFormulas; + // is the Doc being destroyed? (no Notify-Tracking etc. needed anymore) + sal_Bool bInDtorClear; + // expand reference if insert column/row takes place at the border + // of a reference + // is fetched in each UpdateReference from InputOptions, + // assigned, and restored at the end of UpdateReference + sal_Bool bExpandRefs; + // for detective update, is set for each change of a formula + sal_Bool bDetectiveDirty; + + sal_uInt8 nMacroCallMode; // Macros per warning dialog disabled? + sal_Bool bHasMacroFunc; // valid only after loading + + sal_uInt8 nVisSpellState; + + sal_uInt8 nAsianCompression; + sal_uInt8 nAsianKerning; + sal_Bool bSetDrawDefaults; + + sal_Bool bPastingDrawFromOtherDoc; + + sal_uInt8 nInDdeLinkUpdate; // originating DDE links (stacked bool) + + sal_Bool bInUnoBroadcast; + sal_Bool bInUnoListenerCall; + formula::FormulaGrammar::Grammar eGrammar; + + mutable sal_Bool bStyleSheetUsageInvalid; + + bool mbUndoEnabled; + bool mbAdjustHeightEnabled; + bool mbExecuteLinkEnabled; + bool mbChangeReadOnlyEnabled; // allow changes in read-only document (for API import filters) + bool mbStreamValidLocked; + + sal_Int16 mnNamedRangesLockCount; + + ::std::set<ScFormulaCell*> maSubTotalCells; + +public: + SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells + SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const; + sal_uLong GetCodeCount() const; // RPN-Code in formulas + DECL_LINK( GetUserDefinedColor, sal_uInt16 * ); + // number formatter + +public: + SC_DLLPUBLIC ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT, + SfxObjectShell* pDocShell = NULL ); + SC_DLLPUBLIC ~ScDocument(); + + inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > + GetServiceManager() const { return xServiceManager; } + + SC_DLLPUBLIC const String& GetName() const { return aDocName; } + void SetName( const String& r ) { aDocName = r; } + const String& GetCodeName() const { return aDocCodeName; } + void SetCodeName( const String& r ) { aDocCodeName = r; } + + void GetDocStat( ScDocStat& rDocStat ); + + SC_DLLPUBLIC void InitDrawLayer( SfxObjectShell* pDocShell = NULL ); + XColorTable* GetColorTable(); + + SC_DLLPUBLIC sfx2::LinkManager* GetLinkManager() const; + + SC_DLLPUBLIC const ScDocOptions& GetDocOptions() const; + SC_DLLPUBLIC void SetDocOptions( const ScDocOptions& rOpt ); + SC_DLLPUBLIC const ScViewOptions& GetViewOptions() const; + SC_DLLPUBLIC void SetViewOptions( const ScViewOptions& rOpt ); + void SetPrintOptions(); + + ScExtDocOptions* GetExtDocOptions() { return pExtDocOptions; } + SC_DLLPUBLIC void SetExtDocOptions( ScExtDocOptions* pNewOptions ); + + void GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const; + void SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl ); + + void SetDrawDefaults(); + + void SetConsolidateDlgData( const ScConsolidateParam* pData ); + const ScConsolidateParam* GetConsolidateDlgData() const { return pConsolidateDlgData; } + + void Clear( sal_Bool bFromDestructor = false ); + + ScFieldEditEngine* CreateFieldEditEngine(); + void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine); + + /** + * Get all range names that are local to each table. It only returns + * non-empty range name set. + */ + void GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rRangeNames) const; + void SetAllTabRangeNames(const ScRangeName::TabNameCopyMap& rRangeNames); + SC_DLLPUBLIC ScRangeName* GetRangeName(SCTAB nTab) const; + SC_DLLPUBLIC ScRangeName* GetRangeName() const; + void SetRangeName(SCTAB nTab, ScRangeName* pNew); + void SetRangeName( ScRangeName* pNewRangeName ); + SCTAB GetMaxTableNumber() { return nMaxTableNumber; } + void SetMaxTableNumber(SCTAB nNumber) { nMaxTableNumber = nNumber; } + + ScRangePairList* GetColNameRanges() { return &xColNameRanges; } + ScRangePairList* GetRowNameRanges() { return &xRowNameRanges; } + ScRangePairListRef& GetColNameRangesRef() { return xColNameRanges; } + ScRangePairListRef& GetRowNameRangesRef() { return xRowNameRanges; } + + SC_DLLPUBLIC ScDBCollection* GetDBCollection() const; + void SetDBCollection( ScDBCollection* pNewDBCollection, + sal_Bool bRemoveAutoFilter = false ); + ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, + sal_Bool bStartOnly = false) const; + ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + ScDBData* GetFilterDBAtTable(SCTAB nTab) const; + + + SC_DLLPUBLIC const ScRangeData* GetRangeAtBlock( const ScRange& rBlock, String* pName=NULL ) const; + + SC_DLLPUBLIC ScDPCollection* GetDPCollection(); + ScDPObject* GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const; + ScDPObject* GetDPAtBlock( const ScRange& rBlock ) const; + + SC_DLLPUBLIC ScChartCollection* GetChartCollection() const; + + void StopTemporaryChartLock(); + + void EnsureGraphicNames(); + + SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos ); + sal_Bool HasChartAtPoint( SCTAB nTab, const Point& rPos, String* pName = NULL ); + + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument > GetChartByName( const String& rChartName ); + SC_DLLPUBLIC void GetChartRanges( const String& rChartName, ::std::vector< ScRangeList >& rRanges, ScDocument* pSheetNameDoc ); + void SetChartRanges( const String& rChartName, const ::std::vector< ScRangeList >& rRanges ); + + void UpdateChartArea( const String& rChartName, const ScRange& rNewArea, + sal_Bool bColHeaders, sal_Bool bRowHeaders, sal_Bool bAdd ); + void UpdateChartArea( const String& rChartName, + const ScRangeListRef& rNewList, + sal_Bool bColHeaders, sal_Bool bRowHeaders, sal_Bool bAdd ); + void GetOldChartParameters( const String& rName, + ScRangeList& rRanges, sal_Bool& rColHeaders, sal_Bool& rRowHeaders ); + ::com::sun::star::uno::Reference< + ::com::sun::star::embed::XEmbeddedObject > + FindOleObjectByName( const String& rName ); + + SC_DLLPUBLIC void MakeTable( SCTAB nTab,bool _bNeedsNameCheck = true ); + + SCTAB GetVisibleTab() const { return nVisibleTab; } + SC_DLLPUBLIC void SetVisibleTab(SCTAB nTab) { nVisibleTab = nTab; } + + SC_DLLPUBLIC sal_Bool HasTable( SCTAB nTab ) const; + SC_DLLPUBLIC sal_Bool GetName( SCTAB nTab, String& rName ) const; + SC_DLLPUBLIC sal_Bool GetCodeName( SCTAB nTab, String& rName ) const; + SC_DLLPUBLIC sal_Bool SetCodeName( SCTAB nTab, const String& rName ); + SC_DLLPUBLIC sal_Bool GetTable( const String& rName, SCTAB& rTab ) const; + + SC_DLLPUBLIC void SetAnonymousDBData(SCTAB nTab, ScDBData* pDBData); + SC_DLLPUBLIC ScDBData* GetAnonymousDBData(SCTAB nTab); + + SC_DLLPUBLIC inline SCTAB GetTableCount() const { return nMaxTableNumber; } + SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; } + + SC_DLLPUBLIC ScDocProtection* GetDocProtection() const; + SC_DLLPUBLIC void SetDocProtection(const ScDocProtection* pProtect); + SC_DLLPUBLIC sal_Bool IsDocProtected() const; + sal_Bool IsDocEditable() const; + SC_DLLPUBLIC sal_Bool IsTabProtected( SCTAB nTab ) const; + SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const; + SC_DLLPUBLIC void SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect); + void CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest); + + void LockTable(SCTAB nTab); + void UnlockTable(SCTAB nTab); + + sal_Bool IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + sal_Bool* pOnlyNotBecauseOfMatrix = NULL ) const; + sal_Bool IsSelectionEditable( const ScMarkData& rMark, + sal_Bool* pOnlyNotBecauseOfMatrix = NULL ) const; + sal_Bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + const ScMarkData& rMark ) const; + sal_Bool HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTAB ) const; + + sal_Bool GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix ); + + sal_Bool IsEmbedded() const; + void GetEmbedded( ScRange& rRange ) const; + void SetEmbedded( const ScRange& rRange ); + void ResetEmbedded(); + Rectangle GetEmbeddedRect() const; // 1/100 mm + void SetEmbedded( const Rectangle& rRect ); // from VisArea (1/100 mm) + void SnapVisArea( Rectangle& rRect ) const; // 1/100 mm + + static SC_DLLPUBLIC bool ValidTabName( const String& rName ); + + SC_DLLPUBLIC sal_Bool ValidNewTabName( const String& rName ) const; + SC_DLLPUBLIC void CreateValidTabName(String& rName) const; + SC_DLLPUBLIC sal_Bool InsertTab( SCTAB nPos, const String& rName, + sal_Bool bExternalDocument = false ); + SC_DLLPUBLIC sal_Bool DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc = NULL ); + SC_DLLPUBLIC sal_Bool RenameTab( SCTAB nTab, const String& rName, + sal_Bool bUpdateRef = sal_True, + sal_Bool bExternalDocument = false ); + sal_Bool MoveTab( SCTAB nOldPos, SCTAB nNewPos ); + sal_Bool CopyTab( SCTAB nOldPos, SCTAB nNewPos, + const ScMarkData* pOnlyMarked = NULL ); + SC_DLLPUBLIC sal_uLong TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos, + sal_Bool bInsertNew = sal_True, + sal_Bool bResultsOnly = false ); + SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos); + SC_DLLPUBLIC void SetVisible( SCTAB nTab, sal_Bool bVisible ); + SC_DLLPUBLIC sal_Bool IsVisible( SCTAB nTab ) const; + sal_Bool IsStreamValid( SCTAB nTab ) const; + void SetStreamValid( SCTAB nTab, sal_Bool bSet, sal_Bool bIgnoreLock = false ); + void LockStreamValid( bool bLock ); + bool IsStreamValidLocked() const { return mbStreamValidLocked; } + sal_Bool IsPendingRowHeights( SCTAB nTab ) const; + void SetPendingRowHeights( SCTAB nTab, sal_Bool bSet ); + SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, sal_Bool bRTL ); + SC_DLLPUBLIC sal_Bool IsLayoutRTL( SCTAB nTab ) const; + sal_Bool IsNegativePage( SCTAB nTab ) const; + SC_DLLPUBLIC void SetScenario( SCTAB nTab, sal_Bool bFlag ); + SC_DLLPUBLIC sal_Bool IsScenario( SCTAB nTab ) const; + SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, String& rComment, + Color& rColor, sal_uInt16& rFlags ) const; + SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const String& rComment, + const Color& rColor, sal_uInt16 nFlags ); + SC_DLLPUBLIC Color GetTabBgColor( SCTAB nTab ) const; + SC_DLLPUBLIC void SetTabBgColor( SCTAB nTab, const Color& rColor ); + SC_DLLPUBLIC bool IsDefaultTabBgColor( SCTAB nTab ) const; + void GetScenarioFlags( SCTAB nTab, sal_uInt16& rFlags ) const; + SC_DLLPUBLIC sal_Bool IsActiveScenario( SCTAB nTab ) const; + SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, sal_Bool bActive ); // only for Undo etc. + SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const; + SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const; + void SetGrammar( formula::FormulaGrammar::Grammar eGram ); + SC_DLLPUBLIC sal_uInt8 GetLinkMode( SCTAB nTab ) const; + sal_Bool IsLinked( SCTAB nTab ) const; + SC_DLLPUBLIC const String& GetLinkDoc( SCTAB nTab ) const; + const String& GetLinkFlt( SCTAB nTab ) const; + const String& GetLinkOpt( SCTAB nTab ) const; + SC_DLLPUBLIC const String& GetLinkTab( SCTAB nTab ) const; + sal_uLong GetLinkRefreshDelay( SCTAB nTab ) const; + void SetLink( SCTAB nTab, sal_uInt8 nMode, const String& rDoc, + const String& rFilter, const String& rOptions, + const String& rTabName, sal_uLong nRefreshDelay ); + sal_Bool HasLink( const String& rDoc, + const String& rFilter, const String& rOptions ) const; + SC_DLLPUBLIC sal_Bool LinkExternalTab( SCTAB& nTab, const String& aDocTab, + const String& aFileName, + const String& aTabName ); + + bool HasExternalRefManager() const { return pExternalRefMgr.get(); } + SC_DLLPUBLIC ScExternalRefManager* GetExternalRefManager() const; + bool IsInExternalReferenceMarking() const; + void MarkUsedExternalReferences(); + bool MarkUsedExternalReferences( ScTokenArray & rArr ); + + /** Returns the pool containing external formula parsers. Creates the pool + on first call. */ + ScFormulaParserPool& GetFormulaParserPool() const; + + sal_Bool HasDdeLinks() const; + sal_Bool HasAreaLinks() const; + void UpdateExternalRefLinks(); + void UpdateDdeLinks(); + void UpdateAreaLinks(); + + // originating DDE links + void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; } + void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; } + sal_Bool IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; } + + SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const; + void DisconnectDdeLinks(); + + // for StarOne Api: + sal_uInt16 GetDdeLinkCount() const; + sal_Bool UpdateDdeLink( const String& rAppl, const String& rTopic, const String& rItem ); + + /** Tries to find a DDE link with the specified connection data. + @param rnDdePos (out-param) Returns the index of the DDE link (does not include other links from link manager). + @return true = DDE link found, rnDdePos valid. */ + SC_DLLPUBLIC bool FindDdeLink( const String& rAppl, const String& rTopic, const String& rItem, sal_uInt8 nMode, sal_uInt16& rnDdePos ); + + /** Returns the connection data of the specified DDE link. + @param nDdePos Index of the DDE link (does not include other links from link manager). + @param rAppl (out-param) The application name. + @param rTopic (out-param) The DDE topic. + @param rItem (out-param) The DDE item. + @return true = DDE link found, out-parameters valid. */ + bool GetDdeLinkData( sal_uInt16 nDdePos, String& rAppl, String& rTopic, String& rItem ) const; + /** Returns the link mode of the specified DDE link. + @param nDdePos Index of the DDE link (does not include other links from link manager). + @param rnMode (out-param) The link mode of the specified DDE link. + @return true = DDE link found, rnMode valid. */ + bool GetDdeLinkMode( sal_uInt16 nDdePos, sal_uInt8& rnMode ) const; + /** Returns the result matrix of the specified DDE link. + @param nDdePos Index of the DDE link (does not include other links from link manager). + @return The result matrix, if the DDE link has been found, 0 otherwise. */ + SC_DLLPUBLIC const ScMatrix* GetDdeLinkResultMatrix( sal_uInt16 nDdePos ) const; + + /** Tries to find a DDE link or creates a new, if not extant. + @param pResults If not 0, sets the matrix as as DDE link result matrix (also for existing links). + @return true = DDE link found; false = Unpredictable error occurred, no DDE link created. */ + SC_DLLPUBLIC bool CreateDdeLink( const String& rAppl, const String& rTopic, const String& rItem, sal_uInt8 nMode, ScMatrixRef pResults ); + /** Sets a result matrix for the specified DDE link. + @param nDdePos Index of the DDE link (does not include other links from link manager). + @param pResults The array containing all results of the DDE link (intrusive-ref-counted, do not delete). + @return true = DDE link found and matrix set. */ + bool SetDdeLinkResultMatrix( sal_uInt16 nDdePos, ScMatrixRef pResults ); + + + SfxBindings* GetViewBindings(); + SfxObjectShell* GetDocumentShell() const { return pShell; } + ScDrawLayer* GetDrawLayer() { return pDrawLayer; } + SfxBroadcaster* GetDrawBroadcaster(); // to avoid header + void BeginDrawUndo(); + + void BeginUnoRefUndo(); + bool HasUnoRefUndo() const { return ( pUnoRefUndoList != NULL ); } + ScUnoRefList* EndUnoRefUndo(); // must be deleted by caller! + sal_Int64 GetNewUnoId(); + void AddUnoRefChange( sal_Int64 nId, const ScRangeList& rOldRanges ); + + sal_Bool IsChart( const SdrObject* pObject ); + + SC_DLLPUBLIC void UpdateAllCharts(); + void UpdateChartRef( UpdateRefMode eUpdateRefMode, + SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + //! only assigns the new RangeList, no ChartListener or the like + void SetChartRangeList( const String& rChartName, + const ScRangeListRef& rNewRangeListRef ); + + sal_Bool HasControl( SCTAB nTab, const Rectangle& rMMRect ); + void InvalidateControls( Window* pWin, SCTAB nTab, const Rectangle& rMMRect ); + + void StartAnimations( SCTAB nTab, Window* pWin ); + + sal_Bool HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ); + sal_Bool HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect ); + + const ScSheetEvents* GetSheetEvents( SCTAB nTab ) const; + void SetSheetEvents( SCTAB nTab, const ScSheetEvents* pNew ); + bool HasSheetEventScript( SCTAB nTab, sal_Int32 nEvent, bool bWithVbaEvents = false ) const; + bool HasAnySheetEventScript( sal_Int32 nEvent, bool bWithVbaEvents = false ) const; // on any sheet + + bool HasAnyCalcNotification() const; + sal_Bool HasCalcNotification( SCTAB nTab ) const; + void SetCalcNotification( SCTAB nTab ); + void ResetCalcNotifications(); + + SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, sal_Bool bCreate = false ); + sal_Bool SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline ); + + void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); + + sal_Bool DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam ); + void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam ); + sal_Bool TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam ); + sal_Bool HasSubTotalCells( const ScRange& rRange ); + + SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, sal_Bool bForceTab = false ); + SC_DLLPUBLIC void PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, + sal_Bool bForceTab = false ); + SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, + sal_uLong nFormatIndex, sal_Bool bForceTab = false); + // return TRUE = number format is set + SC_DLLPUBLIC sal_Bool SetString( + SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + ScSetStringParam* pParam = NULL ); + SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal ); + void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const sal_uInt16 nError); + + SC_DLLPUBLIC void InsertMatrixFormula(SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, + const String& rFormula, + const ScTokenArray* p = NULL, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ); + SC_DLLPUBLIC void InsertTableOp(const ScTabOpParam& rParam, // multi-operation + SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, const ScMarkData& rMark); + + SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ); + SC_DLLPUBLIC void GetString( SCCOL nCol, SCROW nRow, SCTAB nTab, rtl::OUString& rString ); + SC_DLLPUBLIC void GetInputString( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rString ); + SC_DLLPUBLIC double GetValue( const ScAddress& ); + SC_DLLPUBLIC void GetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, double& rValue ); + SC_DLLPUBLIC double RoundValueAsShown( double fVal, sal_uLong nFormat ); + SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, + sal_uInt32& rFormat ) const; + sal_uInt32 GetNumberFormat( const ScRange& rRange ) const; + SC_DLLPUBLIC sal_uInt32 GetNumberFormat( const ScAddress& ) const; + /** If no number format attribute is set and the cell + pointer passed is of type formula cell, the calculated + number format of the formula cell is returned. pCell + may be NULL. */ + SC_DLLPUBLIC void GetNumberFormatInfo( short& nType, sal_uLong& nIndex, + const ScAddress& rPos, const ScBaseCell* pCell ) const; + void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula ) const; + SC_DLLPUBLIC void GetCellType( SCCOL nCol, SCROW nRow, SCTAB nTab, CellType& rCellType ) const; + SC_DLLPUBLIC CellType GetCellType( const ScAddress& rPos ) const; + SC_DLLPUBLIC void GetCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell*& rpCell ) const; + SC_DLLPUBLIC ScBaseCell* GetCell( const ScAddress& rPos ) const; + + SC_DLLPUBLIC sal_Bool HasData( SCCOL nCol, SCROW nRow, SCTAB nTab ); + SC_DLLPUBLIC sal_Bool HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + SC_DLLPUBLIC sal_Bool HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + sal_Bool HasStringCells( const ScRange& rRange ) const; + + /** Returns true, if there is any data to create a selection list for rPos. */ + sal_Bool HasSelectionData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + + /** Returns the pointer to a cell note object at the passed cell address. */ + ScPostIt* GetNote( const ScAddress& rPos ); + /** Sets the passed note at the cell with the passed cell address. */ + void TakeNote( const ScAddress& rPos, ScPostIt*& rpNote ); + /** Returns and forgets the cell note object at the passed cell address. */ + ScPostIt* ReleaseNote( const ScAddress& rPos ); + /** Returns the pointer to an existing or created cell note object at the passed cell address. */ + SC_DLLPUBLIC ScPostIt* GetOrCreateNote( const ScAddress& rPos ); + /** Deletes the note at the passed cell address. */ + void DeleteNote( const ScAddress& rPos ); + /** Creates the captions of all uninitialized cell notes in the specified sheet. + @param bForced True = always create all captions, false = skip when Undo is disabled. */ + void InitializeNoteCaptions( SCTAB nTab, bool bForced = false ); + /** Creates the captions of all uninitialized cell notes in all sheets. + @param bForced True = always create all captions, false = skip when Undo is disabled. */ + void InitializeAllNoteCaptions( bool bForced = false ); + + void SetDrawPageSize(SCTAB nTab); + + sal_Bool ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark, + sal_Bool bRefresh = false, sal_Bool bAttrs = false ); + sal_Bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab, + sal_Bool bRefresh = false, sal_Bool bAttrs = false ); + sal_Bool ExtendMerge( ScRange& rRange, sal_Bool bRefresh = false, sal_Bool bAttrs = false ); + sal_Bool ExtendTotalMerge( ScRange& rRange ); + SC_DLLPUBLIC sal_Bool ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); + SC_DLLPUBLIC sal_Bool ExtendOverlapped( ScRange& rRange ); + + sal_Bool RefreshAutoFilter( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); + + SC_DLLPUBLIC void DoMergeContents( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow ); + // without checking: + SC_DLLPUBLIC void DoMerge( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, bool bDeleteCaptions = true ); + void RemoveMerge( SCCOL nCol, SCROW nRow, SCTAB nTab ); + + sal_Bool IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const; + sal_Bool IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + sal_Bool bLeftIsEmpty = false, + ScRange* pLastRange = NULL, + Rectangle* pLastMM = NULL ) const; + + void SkipOverlapped( SCCOL& rCol, SCROW& rRow, SCTAB nTab ) const; + sal_Bool IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + sal_Bool IsVerOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + + SC_DLLPUBLIC bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, sal_uInt16 nMask ) const; + SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, sal_uInt16 nMask ) const; + + void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab, + const ::editeng::SvxBorderLine** ppLeft, + const ::editeng::SvxBorderLine** ppTop, + const ::editeng::SvxBorderLine** ppRight, + const ::editeng::SvxBorderLine** ppBottom ) const; + + void ResetChanged( const ScRange& rRange ); + + void SetDirty(); + void SetDirty( const ScRange& ); + void SetTableOpDirty( const ScRange& ); // for Interpreter TableOp + void InterpretDirtyCells( const ScRangeList& rRanges ); + void CalcAll(); + SC_DLLPUBLIC void CalcAfterLoad(); + void CompileAll(); + void CompileXML(); + + ScAutoNameCache* GetAutoNameCache() { return pAutoNameCache; } + + /** Creates a ScLookupCache cache for the range if it + doesn't already exist. */ + ScLookupCache & GetLookupCache( const ScRange & rRange ); + /** Only ScLookupCache ctor uses AddLookupCache(), do not + use elsewhere! */ + void AddLookupCache( ScLookupCache & rCache ); + /** Only ScLookupCache dtor uses RemoveLookupCache(), do + not use elsewhere! */ + void RemoveLookupCache( ScLookupCache & rCache ); + /** Zap all caches. */ + void ClearLookupCaches(); + + // calculate automatically + void SetAutoCalc( sal_Bool bNewAutoCalc ); + sal_Bool GetAutoCalc() const { return bAutoCalc; } + // calculate automatically in/from/for ScDocShell disabled + void SetAutoCalcShellDisabled( sal_Bool bNew ) { bAutoCalcShellDisabled = bNew; } + sal_Bool IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; } + // ForcedFormulas are to be calculated + void SetForcedFormulaPending( sal_Bool bNew ) { bForcedFormulaPending = bNew; } + sal_Bool IsForcedFormulaPending() const { return bForcedFormulaPending; } + // if CalcFormulaTree() is currently running + sal_Bool IsCalculatingFormulaTree() { return bCalculatingFormulaTree; } + + sal_uInt16 GetErrCode( const ScAddress& ) const; + + /** Shrink a range to only include data area. + + This is not the actually used area within the + selection, but the bounds of the sheet's data area + instead. + + @returns TRUE if the area passed intersected the data + area, FALSE if not, in which case the values + obtained may be out of bounds, not in order or + unmodified. TRUE does not mean that there + actually is any data within the selection. + */ + bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const; + + /** Shrink a range to only include used data area. + + @param o_bShrunk + Out parameter, sal_True if area was shrunk, sal_False if not. + + @returns sal_True if there is any data, sal_False if not. + */ + bool ShrinkToUsedDataArea( bool& o_bShrunk, + SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, + SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; + + SC_DLLPUBLIC void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, + SCCOL& rEndCol, SCROW& rEndRow, sal_Bool bIncludeOld, bool bOnlyDown ) const; + SC_DLLPUBLIC sal_Bool GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; + SC_DLLPUBLIC sal_Bool GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; + SC_DLLPUBLIC sal_Bool GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, + sal_Bool bNotes = sal_True ) const; + SC_DLLPUBLIC sal_Bool GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, + SCCOL& rEndCol, sal_Bool bNotes = sal_True ) const; + SC_DLLPUBLIC sal_Bool GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, + SCROW& rEndRow, sal_Bool bNotes = sal_True ) const; + void InvalidateTableArea(); + + + SC_DLLPUBLIC sal_Bool GetDataStart( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow ) const; + + /** + * Find the maximum column position that contains printable data for the + * specified row range. The final column position must be equal or less + * than the initial value of rEndCol. + */ + void ExtendPrintArea( OutputDevice* pDev, SCTAB nTab, + SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW nEndRow ); + SC_DLLPUBLIC SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, + SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, + ScDirection eDir ); + + SC_DLLPUBLIC void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY ); + SC_DLLPUBLIC void GetNextPos( SCCOL& rCol, SCROW& rRow, SCTAB nTab, SCsCOL nMovX, SCsROW nMovY, + sal_Bool bMarked, sal_Bool bUnprotected, const ScMarkData& rMark ); + + sal_Bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, SCTAB nTab, + const ScMarkData& rMark ); + + void LimitChartArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, + SCCOL& rEndCol, SCROW& rEndRow ); + void LimitChartIfAll( ScRangeListRef& rRangeList ); + + sal_Bool InsertRow( SCCOL nStartCol, SCTAB nStartTab, + SCCOL nEndCol, SCTAB nEndTab, + SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL, + const ScMarkData* pTabMark = NULL ); + SC_DLLPUBLIC sal_Bool InsertRow( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL ); + void DeleteRow( SCCOL nStartCol, SCTAB nStartTab, + SCCOL nEndCol, SCTAB nEndTab, + SCROW nStartRow, SCSIZE nSize, + ScDocument* pRefUndoDoc = NULL, sal_Bool* pUndoOutline = NULL, + const ScMarkData* pTabMark = NULL ); + SC_DLLPUBLIC void DeleteRow( const ScRange& rRange, + ScDocument* pRefUndoDoc = NULL, sal_Bool* pUndoOutline = NULL ); + sal_Bool InsertCol( SCROW nStartRow, SCTAB nStartTab, + SCROW nEndRow, SCTAB nEndTab, + SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL, + const ScMarkData* pTabMark = NULL ); + SC_DLLPUBLIC sal_Bool InsertCol( const ScRange& rRange, ScDocument* pRefUndoDoc = NULL ); + void DeleteCol( SCROW nStartRow, SCTAB nStartTab, + SCROW nEndRow, SCTAB nEndTab, + SCCOL nStartCol, SCSIZE nSize, + ScDocument* pRefUndoDoc = NULL, sal_Bool* pUndoOutline = NULL, + const ScMarkData* pTabMark = NULL ); + void DeleteCol( const ScRange& rRange, + ScDocument* pRefUndoDoc = NULL, sal_Bool* pUndoOutline = NULL ); + + sal_Bool CanInsertRow( const ScRange& rRange ) const; + sal_Bool CanInsertCol( const ScRange& rRange ) const; + + void FitBlock( const ScRange& rOld, const ScRange& rNew, sal_Bool bClear = sal_True ); + sal_Bool CanFitBlock( const ScRange& rOld, const ScRange& rNew ); + + sal_Bool IsClipOrUndo() const { return bIsClip || bIsUndo; } + sal_Bool IsUndo() const { return bIsUndo; } + sal_Bool IsClipboard() const { return bIsClip; } + bool IsUndoEnabled() const { return mbUndoEnabled; } + void EnableUndo( bool bVal ); + + bool IsAdjustHeightEnabled() const { return mbAdjustHeightEnabled; } + void EnableAdjustHeight( bool bVal ) { mbAdjustHeightEnabled = bVal; } + bool IsExecuteLinkEnabled() const { return mbExecuteLinkEnabled; } + void EnableExecuteLink( bool bVal ) { mbExecuteLinkEnabled = bVal; } + bool IsChangeReadOnlyEnabled() const { return mbChangeReadOnlyEnabled; } + void EnableChangeReadOnly( bool bVal ) { mbChangeReadOnlyEnabled = bVal; } + SC_DLLPUBLIC sal_Int16 GetNamedRangesLockCount() const { return mnNamedRangesLockCount; } + void SetNamedRangesLockCount( sal_Int16 nCount ) { mnNamedRangesLockCount = nCount; } + SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, const ScMarkData* pMarks ); + SC_DLLPUBLIC void ResetClip( ScDocument* pSourceDoc, SCTAB nTab ); + void SetCutMode( sal_Bool bCut ); + SC_DLLPUBLIC sal_Bool IsCutMode(); + void SetClipArea( const ScRange& rArea, sal_Bool bCut = false ); + + SC_DLLPUBLIC sal_Bool IsDocVisible() const { return bIsVisible; } + void SetDocVisible( sal_Bool bSet ); + + sal_Bool HasOLEObjectsInArea( const ScRange& rRange, const ScMarkData* pTabMark = NULL ); + + void DeleteObjectsInArea( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark ); + void DeleteObjectsInSelection( const ScMarkData& rMark ); + + void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, sal_uInt16 nDelFlag); + void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCTAB nTab, sal_uInt16 nDelFlag); + void DeleteAreaTab(const ScRange& rRange, sal_uInt16 nDelFlag); + + void CopyToClip(const ScClipParam& rClipParam, ScDocument* pClipDoc, + const ScMarkData* pMarks = NULL, bool bAllTabs = false, bool bKeepScenarioFlags = false, + bool bIncludeObjects = false, bool bCloneNoteCaptions = true); + + void CopyToClip4VBA(const ScClipParam& rClipParam, ScDocument* pClipDoc, bool bKeepScenarioFlags = false, + bool bIncludeObjects = false, bool bCloneNoteCaptions = true); + + void CopyTabToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCTAB nTab, ScDocument* pClipDoc = NULL); + void CopyBlockFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, + const ScCopyBlockFromClipParams* pCBFCP ); + void CopyNonFilteredFromClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, SCsCOL nDx, SCsROW nDy, + const ScCopyBlockFromClipParams* pCBFCP, + SCROW & rClipStartRow ); + void StartListeningFromClip( SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, sal_uInt16 nInsFlag ); + void BroadcastFromClip( SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, sal_uInt16 nInsFlag ); + /** If pDestRanges is given it overrides rDestRange, rDestRange in this + case is the overall encompassing range. */ + void CopyFromClip( const ScRange& rDestRange, const ScMarkData& rMark, + sal_uInt16 nInsFlag, + ScDocument* pRefUndoDoc = NULL, + ScDocument* pClipDoc = NULL, + sal_Bool bResetCut = sal_True, + sal_Bool bAsLink = false, + sal_Bool bIncludeFiltered = sal_True, + sal_Bool bSkipAttrForEmpty = false, + const ScRangeList * pDestRanges = NULL ); + + void CopyMultiRangeFromClip(const ScAddress& rDestPos, const ScMarkData& rMark, + sal_uInt16 nInsFlag, ScDocument* pClipDoc, + bool bResetCut = true, bool bAsLink = false, + bool bIncludeFiltered = true, + bool bSkipAttrForEmpty = false); + + void GetClipArea(SCCOL& nClipX, SCROW& nClipY, sal_Bool bIncludeFiltered); + void GetClipStart(SCCOL& nClipX, SCROW& nClipY); + + sal_Bool HasClipFilteredRows(); + + sal_Bool IsClipboardSource() const; + + SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, sal_uInt16 nFlags, sal_Bool bAsLink ); + + ScClipParam& GetClipParam(); + void SetClipParam(const ScClipParam& rParam); + + void MixDocument( const ScRange& rRange, sal_uInt16 nFunction, sal_Bool bSkipEmpty, + ScDocument* pSrcDoc ); + + void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark, + sal_uInt16 nFlags, sal_uInt16 nFunction, + sal_Bool bSkipEmpty, sal_Bool bAsLink ); + void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark, + sal_uInt16 nFlags, sal_uInt16 nFunction, + sal_Bool bSkipEmpty, sal_Bool bAsLink ); + + void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType ); + + SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2, + sal_Bool bColInfo = false, sal_Bool bRowInfo = false ); + void AddUndoTab( SCTAB nTab1, SCTAB nTab2, + sal_Bool bColInfo = false, sal_Bool bRowInfo = false ); + SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection, + sal_Bool bColInfo = false, sal_Bool bRowInfo = false ); + + // don't use anymore: + void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + sal_uInt16 nFlags, sal_Bool bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL, sal_Bool bColRowFlags = sal_True); + void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + sal_uInt16 nFlags, sal_Bool bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL); + + void CopyToDocument(const ScRange& rRange, + sal_uInt16 nFlags, sal_Bool bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL, sal_Bool bColRowFlags = sal_True); + void UndoToDocument(const ScRange& rRange, + sal_uInt16 nFlags, sal_Bool bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL); + + void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, sal_Bool bNewScenario = false ); + sal_Bool TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const; + void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab, + ScMarkData& rDestMark, sal_Bool bResetMark = sal_True, + sal_uInt16 nNeededBits = 0 ) const; + sal_Bool HasScenarioRange( SCTAB nTab, const ScRange& rRange ) const; + SC_DLLPUBLIC const ScRangeList* GetScenarioRanges( SCTAB nTab ) const; + + SC_DLLPUBLIC void CopyUpdated( ScDocument* pPosDoc, ScDocument* pDestDoc ); + + void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + ScDocument* pUndoDoc = NULL, sal_Bool bIncludeDraw = sal_True, + bool bUpdateNoteCaptionPos = true ); + + SC_DLLPUBLIC void UpdateTranspose( const ScAddress& rDestPos, ScDocument* pClipDoc, + const ScMarkData& rMark, ScDocument* pUndoDoc = NULL ); + + void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); + + void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, + sal_uLong nFillCount, FillDir eFillDir = FILL_TO_BOTTOM, + FillCmd eFillCmd = FILL_LINEAR, FillDateCmd eFillDateCmd = FILL_DAY, + double nStepValue = 1.0, double nMaxValue = 1E307); + String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ); + + sal_Bool GetSelectionFunction( ScSubTotalFunc eFunc, + const ScAddress& rCursor, const ScMarkData& rMark, + double& rResult ); + + SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const; + SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const; + const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark, sal_Bool bDeep = sal_True ); + ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, sal_Bool bDeep = sal_True ); + + const ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const; + + SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator(); + sal_Bool HasStringWeakCharacters( const String& rString ); + SC_DLLPUBLIC sal_uInt8 GetStringScriptType( const String& rString ); + SC_DLLPUBLIC sal_uInt8 GetCellScriptType( ScBaseCell* pCell, sal_uLong nNumberFormat ); + SC_DLLPUBLIC sal_uInt8 GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell = NULL ); + + sal_Bool HasDetectiveOperations() const; + void AddDetectiveOperation( const ScDetOpData& rData ); + void ClearDetectiveOperations(); + ScDetOpList* GetDetOpList() const { return pDetOpList; } + void SetDetOpList(ScDetOpList* pNew); + + sal_Bool HasDetectiveObjects(SCTAB nTab) const; + + void GetSelectionFrame( const ScMarkData& rMark, + SvxBoxItem& rLineOuter, + SvxBoxInfoItem& rLineInner ); + void ApplySelectionFrame( const ScMarkData& rMark, + const SvxBoxItem* pLineOuter, + const SvxBoxInfoItem* pLineInner ); + void ApplyFrameAreaTab( const ScRange& rRange, + const SvxBoxItem* pLineOuter, + const SvxBoxInfoItem* pLineInner ); + + void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark ); + void ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark ); + + SC_DLLPUBLIC sal_uLong AddCondFormat( const ScConditionalFormat& rNew ); + SC_DLLPUBLIC void FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges ); + SC_DLLPUBLIC void FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges, SCTAB nTab ); + void ConditionalChanged( sal_uLong nKey ); + + SC_DLLPUBLIC sal_uLong AddValidationEntry( const ScValidationData& rNew ); + + SC_DLLPUBLIC const ScValidationData* GetValidationEntry( sal_uLong nIndex ) const; + + ScConditionalFormatList* GetCondFormList() const // Ref-Undo + { return pCondFormList; } + void SetCondFormList(ScConditionalFormatList* pNew); + + ScValidationDataList* GetValidationList() const + { return pValidationList; } + + SC_DLLPUBLIC void ApplyAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, + const SfxPoolItem& rAttr ); + SC_DLLPUBLIC void ApplyPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, + const ScPatternAttr& rAttr ); + SC_DLLPUBLIC void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + const ScMarkData& rMark, const ScPatternAttr& rAttr, + ScEditDataArray* pDataArray = NULL ); + SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, + const ScPatternAttr& rAttr ); + + SC_DLLPUBLIC bool SetAttrEntries(SCCOL nCol, SCTAB nTab, ScAttrEntry* pData, SCSIZE nSize); + + SC_DLLPUBLIC void ApplyPatternIfNumberformatIncompatible( + const ScRange& rRange, const ScMarkData& rMark, + const ScPatternAttr& rPattern, short nNewType ); + + void ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab, + const ScStyleSheet& rStyle); + void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + const ScMarkData& rMark, const ScStyleSheet& rStyle); + SC_DLLPUBLIC void ApplyStyleAreaTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, + const ScStyleSheet& rStyle); + + void ApplySelectionStyle( const ScStyleSheet& rStyle, const ScMarkData& rMark ); + void ApplySelectionLineStyle( const ScMarkData& rMark, + const ::editeng::SvxBorderLine* pLine, sal_Bool bColorOnly ); + + const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const; + + void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, sal_Bool bRemoved, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY ); + + sal_Bool IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const; + + SC_DLLPUBLIC sal_Bool ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab, sal_Int16 nFlags ); + SC_DLLPUBLIC sal_Bool RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab, sal_Int16 nFlags ); + + SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr, + sal_Bool bPutToPool = false ); + SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr, + sal_Bool bPutToPool = false ); + void DeleteNumberFormat( const sal_uInt32* pDelKeys, sal_uInt32 nCount ); + + void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + sal_uInt16 nFormatNo, const ScMarkData& rMark ); + void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + ScAutoFormatData& rData ); + sal_Bool SearchAndReplace( const SvxSearchItem& rSearchItem, + SCCOL& rCol, SCROW& rRow, SCTAB& rTab, + ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc = NULL ); + + // determine Col/Row of subsequent calls + // (e.g. not found from the beginning, or subsequent tables) + // meaning of explanation in "()" was already unclear in German + static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem, + SCCOL& rCol, SCROW& rRow ); + + sal_Bool Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, + SCCOL nVCol, SCROW nVRow, SCTAB nVTab, + const String& sValStr, double& nX); + + void ApplySelectionPattern( const ScPatternAttr& rAttr, const ScMarkData& rMark, + ScEditDataArray* pDataArray = NULL ); + void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark ); + void DeleteSelectionTab( SCTAB nTab, sal_uInt16 nDelFlag, const ScMarkData& rMark ); + + SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth ); + SC_DLLPUBLIC void SetColWidthOnly( SCCOL nCol, SCTAB nTab, sal_uInt16 nNewWidth ); + SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, sal_uInt16 nNewHeight ); + SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, + sal_uInt16 nNewHeight ); + + SC_DLLPUBLIC void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, + sal_uInt16 nNewHeight ); + SC_DLLPUBLIC void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_Bool bManual ); + + SC_DLLPUBLIC sal_uInt16 GetColWidth( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const; + SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const; + SC_DLLPUBLIC sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const; + SCROW GetRowForHeight( SCTAB nTab, sal_uLong nHeight ) const; + sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const; + SC_DLLPUBLIC sal_uLong GetColOffset( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC sal_uLong GetRowOffset( SCROW nRow, SCTAB nTab ) const; + + SC_DLLPUBLIC sal_uInt16 GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC sal_uInt16 GetOriginalHeight( SCROW nRow, SCTAB nTab ) const; + + sal_uInt16 GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const; + + SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const; + + sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bFormula, + const ScMarkData* pMarkData = NULL, + const ScColWidthParam* pParam = NULL ); + SC_DLLPUBLIC sal_Bool SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt16 nExtra, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bShrink ); + void UpdateAllRowHeights( OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + const ScMarkData* pTabMark = NULL ); + long GetNeededSize( SCCOL nCol, SCROW nRow, SCTAB nTab, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bWidth, sal_Bool bTotalSize = false ); + + SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, sal_Bool bShow); + SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, sal_Bool bShow); + SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, sal_Bool bShow); + SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, sal_uInt8 nNewFlags ); + SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_uInt8 nNewFlags ); + + SC_DLLPUBLIC sal_uInt8 GetColFlags( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC sal_uInt8 GetRowFlags( SCROW nRow, SCTAB nTab ) const; + + SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, sal_uInt8> & GetRowFlagsArray( SCTAB nTab ) const; + SC_DLLPUBLIC ScBitMaskCompressedArray< SCROW, sal_uInt8> & GetRowFlagsArrayModifiable( SCTAB nTab ); + + SC_DLLPUBLIC void GetAllRowBreaks(::std::set<SCROW>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const; + SC_DLLPUBLIC void GetAllColBreaks(::std::set<SCCOL>& rBreaks, SCTAB nTab, bool bPage, bool bManual) const; + SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const; + SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const; + SC_DLLPUBLIC void SetRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual); + SC_DLLPUBLIC void SetColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual); + void RemoveRowBreak(SCROW nRow, SCTAB nTab, bool bPage, bool bManual); + void RemoveColBreak(SCCOL nCol, SCTAB nTab, bool bPage, bool bManual); + ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData(SCTAB nTab) const; + + SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL); + SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL); + SC_DLLPUBLIC void SetRowHidden(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bHidden); + SC_DLLPUBLIC void SetColHidden(SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, bool bHidden); + SC_DLLPUBLIC SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + SC_DLLPUBLIC SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + + bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL); + bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + bool ColFiltered(SCCOL nCol, SCTAB nTab, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL); + SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered); + SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + + /** + * Write all column row flags to table's flag data, because not all column + * row attributes are stored in the flag data members. This is necessary + * for ods export. + */ + void SyncColRowFlags(); + + /// @return the index of the last row with any set flags (auto-pagebreak is ignored). + SC_DLLPUBLIC SCROW GetLastFlaggedRow( SCTAB nTab ) const; + + /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored). + SCCOL GetLastChangedCol( SCTAB nTab ) const; + /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). + SCROW GetLastChangedRow( SCTAB nTab ) const; + + SCCOL GetNextDifferentChangedCol( SCTAB nTab, SCCOL nStart) const; + + // if bCareManualSize is set then the row + // heights are compared only if the manual size flag for + // the row is set. If the bCareManualSize is not set then + // the row heights are always compared. + SCROW GetNextDifferentChangedRow( SCTAB nTab, SCROW nStart, bool bCareManualSize = true) const; + + // returns whether to export a Default style for this col/row or not + // nDefault is setted to one possition in the current row/col where the Default style is + sal_Bool GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault); + sal_Bool GetRowDefault( SCTAB nTab, SCROW nRow, SCCOL nLastCol, SCCOL& nDefault); + + sal_Bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, sal_Bool bShow ); + sal_Bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, sal_Bool bShow ); + + void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab ); + void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2, SCTAB nTab ); + + SC_DLLPUBLIC ScPatternAttr* GetDefPattern() const; + SC_DLLPUBLIC ScDocumentPool* GetPool(); + SC_DLLPUBLIC ScStyleSheetPool* GetStyleSheetPool() const; + + // PageStyle: + SC_DLLPUBLIC const String& GetPageStyle( SCTAB nTab ) const; + SC_DLLPUBLIC void SetPageStyle( SCTAB nTab, const String& rName ); + Size GetPageSize( SCTAB nTab ) const; + void SetPageSize( SCTAB nTab, const Size& rSize ); + void SetRepeatArea( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow ); + void InvalidatePageBreaks(SCTAB nTab); + void UpdatePageBreaks( SCTAB nTab, const ScRange* pUserArea = NULL ); + void RemoveManualBreaks( SCTAB nTab ); + sal_Bool HasManualBreaks( SCTAB nTab ) const; + + sal_Bool IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab = NULL ); + sal_Bool RemovePageStyleInUse( const String& rStrPageStyle ); + sal_Bool RenamePageStyleInUse( const String& rOld, const String& rNew ); + void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle, + const SfxItemSet& rChanges ); + + void PageStyleModified( SCTAB nTab, const String& rNewName ); + + SC_DLLPUBLIC sal_Bool NeedPageResetAfterTab( SCTAB nTab ) const; + + // Was stored in PageStyle previously. Now it exists for every table: + SC_DLLPUBLIC sal_Bool HasPrintRange(); + SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount( SCTAB nTab ); + SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, sal_uInt16 nPos ); + SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab ); + SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab ); + /** Returns true, if the specified sheet is always printed. */ + sal_Bool IsPrintEntireSheet( SCTAB nTab ) const; + + /** Removes all print ranges. */ + SC_DLLPUBLIC void ClearPrintRanges( SCTAB nTab ); + /** Adds a new print ranges. */ + SC_DLLPUBLIC void AddPrintRange( SCTAB nTab, const ScRange& rNew ); + /** Marks the specified sheet to be printed completely. Deletes old print ranges on the sheet! */ + SC_DLLPUBLIC void SetPrintEntireSheet( SCTAB nTab ); + SC_DLLPUBLIC void SetRepeatColRange( SCTAB nTab, const ScRange* pNew ); + SC_DLLPUBLIC void SetRepeatRowRange( SCTAB nTab, const ScRange* pNew ); + ScPrintRangeSaver* CreatePrintRangeSaver() const; + void RestorePrintRanges( const ScPrintRangeSaver& rSaver ); + + SC_DLLPUBLIC Rectangle GetMMRect( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ) const; + SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect ) const; + + void UpdStlShtPtrsFrmNms(); + void StylesToNames(); + + SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc ); + + CharSet GetSrcCharSet() const { return eSrcSet; } + sal_uLong GetSrcVersion() const { return nSrcVer; } + SCROW GetSrcMaxRow() const { return nSrcMaxRow; } + + void SetSrcCharSet( CharSet eNew ) { eSrcSet = eNew; } + void UpdateFontCharSet(); + + void FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, + SCTAB nTab, double nScaleX, double nScaleY, + sal_Bool bPageMode, sal_Bool bFormulaMode, + const ScMarkData* pMarkData = NULL ); + + SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const; + + void Sort( SCTAB nTab, const ScSortParam& rSortParam, sal_Bool bKeepQuery ); + SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, sal_Bool bKeepSub ); + SC_DLLPUBLIC sal_Bool CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCTAB nTab, ScQueryParam& rQueryParam ); + void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr); + + sal_Bool GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, + bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates); + SC_DLLPUBLIC sal_Bool GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, + SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates ); + sal_Bool GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, + TypedScStrCollection& rStrings, sal_Bool bLimit = false ); + sal_Bool GetFormulaEntries( TypedScStrCollection& rStrings ); + + sal_Bool HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab ); + + SC_DLLPUBLIC sal_Bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab ); + SC_DLLPUBLIC sal_Bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab ); + + SfxPrinter* GetPrinter( sal_Bool bCreateIfNotExist = sal_True ); + void SetPrinter( SfxPrinter* pNewPrinter ); + VirtualDevice* GetVirtualDevice_100th_mm(); + SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice... + + sal_Bool GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab, + sal_Bool bInSel, const ScMarkData& rMark) const; + + sal_Bool ReplaceStyle(const SvxSearchItem& rSearchItem, + SCCOL nCol, SCROW nRow, SCTAB nTab, + ScMarkData& rMark, sal_Bool bIsUndo); + + void DoColResize( SCTAB nTab, SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd ); + + void InvalidateTextWidth( const String& rStyleName ); + void InvalidateTextWidth( SCTAB nTab ); + void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, sal_Bool bNumFormatChanged ); + + sal_Bool IdleCalcTextWidth(); + sal_Bool IdleCheckLinks(); + + sal_Bool ContinueOnlineSpelling(); // TRUE = found s.th. + + void RepaintRange( const ScRange& rRange ); + + sal_Bool IsIdleDisabled() const { return bIdleDisabled; } + void DisableIdle(sal_Bool bDo) { bIdleDisabled = bDo; } + + sal_Bool IsDetectiveDirty() const { return bDetectiveDirty; } + void SetDetectiveDirty(sal_Bool bSet) { bDetectiveDirty = bSet; } + + void RemoveAutoSpellObj(); + void SetOnlineSpellPos( const ScAddress& rPos ); + SC_DLLPUBLIC sal_Bool SetVisibleSpellRange( const ScRange& rRange ); // sal_True = changed + + sal_uInt8 GetMacroCallMode() const { return nMacroCallMode; } + void SetMacroCallMode(sal_uInt8 nNew) { nMacroCallMode = nNew; } + + sal_Bool GetHasMacroFunc() const { return bHasMacroFunc; } + void SetHasMacroFunc(sal_Bool bSet) { bHasMacroFunc = bSet; } + + sal_Bool CheckMacroWarn(); + + void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; } + sal_Bool HasRangeOverflow() const { return nRangeOverflowType != 0; } + SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; } + + // for broadcasting/listening + void SetNoSetDirty( sal_Bool bVal ) { bNoSetDirty = bVal; } + sal_Bool GetNoSetDirty() const { return bNoSetDirty; } + void SetInsertingFromOtherDoc( sal_Bool bVal ) { bInsertingFromOtherDoc = bVal; } + sal_Bool IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; } + bool IsLoadingMedium() const; + void SetLoadingMedium( bool bVal ); + void SetImportingXML( bool bVal ); + bool IsImportingXML() const { return bImportingXML; } + void SetXMLFromWrapper( sal_Bool bVal ); + sal_Bool IsXMLFromWrapper() const { return bXMLFromWrapper; } + void SetCalcingAfterLoad( sal_Bool bVal ) { bCalcingAfterLoad = bVal; } + sal_Bool IsCalcingAfterLoad() const { return bCalcingAfterLoad; } + void SetNoListening( sal_Bool bVal ) { bNoListening = bVal; } + sal_Bool GetNoListening() const { return bNoListening; } + ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; } + + ScChartListenerCollection* GetChartListenerCollection() const + { return pChartListenerCollection; } + void SetChartListenerCollection( ScChartListenerCollection*, + sal_Bool bSetChartRangeLists = false ); + void UpdateChart( const String& rName ); + void RestoreChartListener( const String& rName ); + SC_DLLPUBLIC void UpdateChartListenerCollection(); + sal_Bool IsChartListenerCollectionNeedsUpdate() const + { return bChartListenerCollectionNeedsUpdate; } + void SetChartListenerCollectionNeedsUpdate( sal_Bool bFlg ) + { bChartListenerCollectionNeedsUpdate = bFlg; } + void AddOLEObjectToCollection(const String& rName); + + ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; } + SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew); + + rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharacters(); + void SetForbiddenCharacters( const rtl::Reference<SvxForbiddenCharactersTable> xNew ); + + sal_uInt8 GetAsianCompression() const; // CharacterCompressionType values + sal_Bool IsValidAsianCompression() const; + void SetAsianCompression(sal_uInt8 nNew); + + sal_Bool GetAsianKerning() const; + sal_Bool IsValidAsianKerning() const; + void SetAsianKerning(sal_Bool bNew); + + sal_uInt8 GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values + + SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;} + void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;} + + SC_DLLPUBLIC ScMacroManager* GetMacroManager(); + +private: + ScDocument(const ScDocument& r); // disabled with no definition + + void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount, + SCCOL nX1, SCCOL nX2 ) const; + + sal_uInt16 RowDifferences( SCROW nThisRow, SCTAB nThisTab, + ScDocument& rOtherDoc, + SCROW nOtherRow, SCTAB nOtherTab, + SCCOL nMaxCol, SCCOLROW* pOtherCols ); + sal_uInt16 ColDifferences( SCCOL nThisCol, SCTAB nThisTab, + ScDocument& rOtherDoc, + SCCOL nOtherCol, SCTAB nOtherTab, + SCROW nMaxRow, SCCOLROW* pOtherRows ); + void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow, + sal_Bool bColumns, + ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab, + SCCOLROW nEndCol, SCCOLROW* pTranslate, + ScProgress* pProgress, sal_uLong nProAdd ); + sal_Bool OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos, + sal_uInt16 nMaxTest ); + + DECL_LINK( TrackTimeHdl, Timer* ); + + static ScRecursionHelper* CreateRecursionHelperInstance(); + +public: + void StartListeningArea( const ScRange& rRange, + SvtListener* pListener ); + void EndListeningArea( const ScRange& rRange, + SvtListener* pListener ); + /** Broadcast wrapper, calls + SC_DLLPUBLIC rHint.GetCell()->Broadcast() and AreaBroadcast() + and TrackFormulas() and conditional format list + SourceChanged(). + Preferred. + */ + void Broadcast( const ScHint& rHint ); + /// deprecated + void Broadcast( sal_uLong nHint, const ScAddress& rAddr, + ScBaseCell* pCell ); + /// only area, no cell broadcast + void AreaBroadcast( const ScHint& rHint ); + /// only areas in range, no cell broadcasts + void AreaBroadcastInRange( const ScRange& rRange, + const ScHint& rHint ); + void DelBroadcastAreasInRange( const ScRange& rRange ); + void UpdateBroadcastAreas( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + + + void StartListeningCell( const ScAddress& rAddress, + SvtListener* pListener ); + void EndListeningCell( const ScAddress& rAddress, + SvtListener* pListener ); + void PutInFormulaTree( ScFormulaCell* pCell ); + void RemoveFromFormulaTree( ScFormulaCell* pCell ); + void CalcFormulaTree( sal_Bool bOnlyForced = false, + sal_Bool bNoProgressBar = false ); + void ClearFormulaTree(); + void AppendToFormulaTrack( ScFormulaCell* pCell ); + void RemoveFromFormulaTrack( ScFormulaCell* pCell ); + void TrackFormulas( sal_uLong nHintId = SC_HINT_DATACHANGED ); + sal_uInt16 GetFormulaTrackCount() const { return nFormulaTrackCount; } + sal_Bool IsInFormulaTree( ScFormulaCell* pCell ) const; + sal_Bool IsInFormulaTrack( ScFormulaCell* pCell ) const; + sal_uInt16 GetHardRecalcState() { return nHardRecalcState; } + void SetHardRecalcState( sal_uInt16 nVal ) { nHardRecalcState = nVal; } + void StartAllListeners(); + const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; } + sal_Bool HasForcedFormulas() const { return bHasForcedFormulas; } + void SetForcedFormulas( sal_Bool bVal ) { bHasForcedFormulas = bVal; } + sal_uLong GetFormulaCodeInTree() const { return nFormulaCodeInTree; } + sal_Bool IsInInterpreter() const { return nInterpretLevel != 0; } + sal_uInt16 GetInterpretLevel() { return nInterpretLevel; } + void IncInterpretLevel() + { + if ( nInterpretLevel < USHRT_MAX ) + nInterpretLevel++; + } + void DecInterpretLevel() + { + if ( nInterpretLevel ) + nInterpretLevel--; + } + sal_Bool IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; } + sal_uInt16 GetMacroInterpretLevel() { return nMacroInterpretLevel; } + void IncMacroInterpretLevel() + { + if ( nMacroInterpretLevel < USHRT_MAX ) + nMacroInterpretLevel++; + } + void DecMacroInterpretLevel() + { + if ( nMacroInterpretLevel ) + nMacroInterpretLevel--; + } + sal_Bool IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; } + sal_uInt16 GetInterpreterTableOpLevel() { return nInterpreterTableOpLevel; } + void IncInterpreterTableOpLevel() + { + if ( nInterpreterTableOpLevel < USHRT_MAX ) + nInterpreterTableOpLevel++; + } + void DecInterpreterTableOpLevel() + { + if ( nInterpreterTableOpLevel ) + nInterpreterTableOpLevel--; + } + // add a formula to be remembered for TableOp broadcasts + void AddTableOpFormulaCell( ScFormulaCell* ); + void InvalidateLastTableOpParams() { aLastTableOpParams.bValid = false; } + ScRecursionHelper& GetRecursionHelper() + { + if (!pRecursionHelper) + pRecursionHelper = CreateRecursionHelperInstance(); + return *pRecursionHelper; + } + sal_Bool IsInDtorClear() const { return bInDtorClear; } + void SetExpandRefs( sal_Bool bVal ) { bExpandRefs = bVal; } + sal_Bool IsExpandRefs() { return bExpandRefs; } + + SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab ); + SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos = true ); + + sal_uLong GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; } + void IncXMLImportedFormulaCount( sal_uLong nVal ) + { + if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount ) + nXMLImportedFormulaCount += nVal; + } + void DecXMLImportedFormulaCount( sal_uLong nVal ) + { + if ( nVal <= nXMLImportedFormulaCount ) + nXMLImportedFormulaCount -= nVal; + else + nXMLImportedFormulaCount = 0; + } + + void StartTrackTimer(); + + void CompileDBFormula(); + void CompileDBFormula( sal_Bool bCreateFormulaString ); + void CompileNameFormula( sal_Bool bCreateFormulaString ); + void CompileColRowNameFormula(); + + /** Maximum string length of a column, e.g. for dBase export. + @return String length in octets (!) of the destination encoding. In + case of non-octet encodings (e.g. UCS2) the length in code + points times sizeof(sal_Unicode) is returned. */ + sal_Int32 GetMaxStringLen( SCTAB nTab, SCCOL nCol, + SCROW nRowStart, SCROW nRowEnd, + CharSet eCharSet ) const; + /** Maximum string length of numerical cells of a column, e.g. for dBase export. + @return String length in characters (!) including the decimal + separator, and the decimal precision needed. */ + xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision, + SCTAB nTab, SCCOL nCol, + SCROW nRowStart, SCROW nRowEnd ) const; + + void KeyInput( const KeyEvent& rKEvt ); // TimerDelays etc. + + ScChangeTrack* GetChangeTrack() const { return pChangeTrack; } + + //! only for import filter, deletes any existing ChangeTrack via + //! EndChangeTracking() and takes ownership of new ChangeTrack pTrack + SC_DLLPUBLIC void SetChangeTrack( ScChangeTrack* pTrack ); + + void StartChangeTracking(); + void EndChangeTracking(); + + SC_DLLPUBLIC void CompareDocument( ScDocument& rOtherDoc ); + + void AddUnoObject( SfxListener& rObject ); + void RemoveUnoObject( SfxListener& rObject ); + void BroadcastUno( const SfxHint &rHint ); + void AddUnoListenerCall( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& rListener, + const ::com::sun::star::lang::EventObject& rEvent ); + + void SetInLinkUpdate(sal_Bool bSet); // TableLink or AreaLink + sal_Bool IsInLinkUpdate() const; // including DdeLink + + SC_DLLPUBLIC SfxItemPool* GetEditPool() const; + SC_DLLPUBLIC SfxItemPool* GetEnginePool() const; + SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine(); + SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine(); + + ScRefreshTimerControl* GetRefreshTimerControl() const + { return pRefreshTimerControl; } + ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const + { return &pRefreshTimerControl; } + + void SetPastingDrawFromOtherDoc( sal_Bool bVal ) + { bPastingDrawFromOtherDoc = bVal; } + sal_Bool PastingDrawFromOtherDoc() const + { return bPastingDrawFromOtherDoc; } + + /// an ID unique to each document instance + sal_uInt32 GetDocumentID() const; + + void InvalidateStyleSheetUsage() + { bStyleSheetUsageInvalid = sal_True; } + void GetSortParam( ScSortParam& rParam, SCTAB nTab ); + void SetSortParam( ScSortParam& rParam, SCTAB nTab ); + + inline void SetVbaEventProcessor( const com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor >& rxVbaEvents ) + { mxVbaEvents = rxVbaEvents; } + inline com::sun::star::uno::Reference< com::sun::star::script::vba::XVBAEventProcessor > + GetVbaEventProcessor() const { return mxVbaEvents; } + + /** Should only be GRAM_PODF or GRAM_ODFF. */ + void SetStorageGrammar( formula::FormulaGrammar::Grammar eGrammar ); + formula::FormulaGrammar::Grammar GetStorageGrammar() const + { return eStorageGrammar; } + + SfxUndoManager* GetUndoManager(); + bool IsInVBAMode() const; + ScRowBreakIterator* GetRowBreakIterator(SCTAB nTab) const; + + void AddSubTotalCell(ScFormulaCell* pCell); + void RemoveSubTotalCell(ScFormulaCell* pCell); + void SetSubTotalCellsDirty(const ScRange& rDirtyRange); + +private: // CLOOK-Impl-methods + + /** + * Use this class as a locale variable to merge number formatter from + * another document, and set NULL pointer to pFormatExchangeList when + * done. + */ + class NumFmtMergeHandler + { + public: + explicit NumFmtMergeHandler(ScDocument* pDoc, ScDocument* pSrcDoc); + ~NumFmtMergeHandler(); + + private: + ScDocument* mpDoc; + }; + + void MergeNumberFormatter(ScDocument* pSrcDoc); + + void ImplCreateOptions(); // Suggestion: switch to on-demand? + void ImplDeleteOptions(); + + void DeleteDrawLayer(); + void DeleteColorTable(); + SC_DLLPUBLIC sal_Bool DrawGetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const; + void DrawMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos ); + void DrawCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos ); + + void UpdateDrawPrinter(); + void UpdateDrawLanguages(); + void UpdateDrawDefaults(); + SC_DLLPUBLIC void InitClipPtrs( ScDocument* pSourceDoc ); + + void LoadDdeLinks(SvStream& rStream); + void SaveDdeLinks(SvStream& rStream) const; + + void DeleteAreaLinksOnTab( SCTAB nTab ); + void UpdateRefAreaLinks( UpdateRefMode eUpdateRefMode, + const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + + void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, const ScMarkData* pMarks, bool bAllTabs); + void CopyRangeNamesToClip(ScDocument* pClipDoc, const ScRange& rClipRange, SCTAB nTab); + void CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames); + void UpdateRangeNamesInFormulas( + ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark, + SCCOL nXw, SCROW nYw); + + sal_Bool HasPartOfMerged( const ScRange& rRange ); + + std::map< SCTAB, ScSortParam > mSheetSortParams; + +}; +inline void ScDocument::GetSortParam( ScSortParam& rParam, SCTAB nTab ) +{ + rParam = mSheetSortParams[ nTab ]; +} + +inline void ScDocument::SetSortParam( ScSortParam& rParam, SCTAB nTab ) +{ + mSheetSortParams[ nTab ] = rParam; +} + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx new file mode 100644 index 000000000000..5c5ad863b140 --- /dev/null +++ b/sc/inc/docuno.hxx @@ -0,0 +1,860 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DOCUNO_HXX +#define SC_DOCUNO_HXX + +#include "address.hxx" +#include <sfx2/sfxbasemodel.hxx> +#include <svl/lstner.hxx> +#include <svx/fmdmod.hxx> +#include <com/sun/star/view/XRenderable.hpp> +#include <com/sun/star/style/XStyleFamiliesSupplier.hpp> +#include <com/sun/star/document/XActionLockable.hpp> +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/drawing/XDrawPages.hpp> +#include <com/sun/star/sheet/XGoalSeek.hpp> +#include <com/sun/star/sheet/XCalculatable.hpp> +#include <com/sun/star/sheet/XScenarios.hpp> +#include <com/sun/star/sheet/XConsolidatable.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XDocumentAuditing.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XProtectable.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/table/XTableColumns.hpp> +#include <com/sun/star/table/XTableRows.hpp> +#include <com/sun/star/sheet/XSheetAnnotations.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XCellRangesAccess.hpp> +#include <com/sun/star/util/XChangesNotifier.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/interfacecontainer.h> +#include <svl/itemprop.hxx> +#include "drwlayer.hxx" + +class ScDocShell; +class ScAnnotationObj; +class ScMarkData; +class ScPrintFuncCache; +class ScPrintSelectionStatus; +class ScTableColumnObj; +class ScTableRowObj; +class ScTableSheetObj; +class SvxFmDrawPage; +class SvxDrawPage; +class ScRangeList; +class ScPrintUIOptions; +class ScSheetSaveData; + +class SC_DLLPUBLIC ScModelObj : public SfxBaseModel, + public com::sun::star::sheet::XSpreadsheetDocument, + public com::sun::star::document::XActionLockable, + public com::sun::star::sheet::XCalculatable, + public com::sun::star::util::XProtectable, + public com::sun::star::drawing::XDrawPagesSupplier, + public com::sun::star::sheet::XGoalSeek, + public com::sun::star::sheet::XConsolidatable, + public com::sun::star::sheet::XDocumentAuditing, + public com::sun::star::style::XStyleFamiliesSupplier, + public com::sun::star::view::XRenderable, + public com::sun::star::document::XLinkTargetSupplier, + public com::sun::star::beans::XPropertySet, + public SvxFmMSFactory, // derived from XMultiServiceFactory + public com::sun::star::lang::XServiceInfo, + public ::com::sun::star::util::XChangesNotifier +{ +private: + SfxItemPropertySet aPropSet; + ScDocShell* pDocShell; + ScPrintFuncCache* pPrintFuncCache; + ScPrintUIOptions* pPrinterOptions; + com::sun::star::uno::Reference<com::sun::star::uno::XAggregation> xNumberAgg; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawGradTab; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawHatchTab; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawBitmapTab; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawTrGradTab; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawMarkerTab; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xDrawDashTab; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xChartDataProv; + com::sun::star::uno::Reference<com::sun::star::uno::XInterface> xObjProvider; + + ::cppu::OInterfaceContainerHelper maChangesListeners; + + sal_Bool FillRenderMarkData( const com::sun::star::uno::Any& aSelection, + const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rOptions, + ScMarkData& rMark, ScPrintSelectionStatus& rStatus, String& rPagesStr ) const; + com::sun::star::uno::Reference<com::sun::star::uno::XAggregation> GetFormatter(); + void HandleCalculateEvents(); + + rtl::OUString maBuildId; +protected: + const SfxItemPropertySet& GetPropertySet() const { return aPropSet; } + +public: + ScModelObj(ScDocShell* pDocSh); + virtual ~ScModelObj(); + + // create ScModelObj and set at pDocSh (SetBaseModel) + static void CreateAndSet(ScDocShell* pDocSh); + + ScDocument* GetDocument() const; + SfxObjectShell* GetEmbeddedObject() const; + + void UpdateAllRowHeights( const ScMarkData* pTabMark = NULL ); + + void BeforeXMLLoading(); + void AfterXMLLoading(sal_Bool bRet); + ScSheetSaveData* GetSheetSaveData(); + + void RepaintRange( const ScRange& rRange ); + + bool HasChangesListeners() const; + + void NotifyChanges( const ::rtl::OUString& rOperation, const ScRangeList& rRanges, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rProperties = + ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >() ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XSpreadsheetDocument + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheets > SAL_CALL + getSheets() throw(::com::sun::star::uno::RuntimeException); + + // XStyleFamiliesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getStyleFamilies() throw(::com::sun::star::uno::RuntimeException); + + // XRenderable + virtual sal_Int32 SAL_CALL getRendererCount( const ::com::sun::star::uno::Any& aSelection, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xOptions ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getRenderer( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xOptions ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL render( sal_Int32 nRenderer, const ::com::sun::star::uno::Any& aSelection, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& xOptions ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XLinkTargetSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getLinks() throw(::com::sun::star::uno::RuntimeException); + + // XActionLockable + virtual sal_Bool SAL_CALL isActionLocked() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addActionLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL resetActionLocks() throw(::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL lockControllers() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unlockControllers() throw (::com::sun::star::uno::RuntimeException); + + // XCalculatable + virtual void SAL_CALL calculate() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL calculateAll() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isAutomaticCalculationEnabled() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL enableAutomaticCalculation( sal_Bool bEnabled ) + throw(::com::sun::star::uno::RuntimeException); + + // XProtectable + virtual void SAL_CALL protect( const ::rtl::OUString& aPassword ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL unprotect( const ::rtl::OUString& aPassword ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isProtected() throw(::com::sun::star::uno::RuntimeException); + + // XDrawPagesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPages > SAL_CALL + getDrawPages() throw(::com::sun::star::uno::RuntimeException); + + // XGoalSeek + virtual ::com::sun::star::sheet::GoalResult SAL_CALL seekGoal( + const ::com::sun::star::table::CellAddress& aFormulaPosition, + const ::com::sun::star::table::CellAddress& aVariablePosition, + const ::rtl::OUString& aGoalValue ) + throw(::com::sun::star::uno::RuntimeException); + + // XConsolidatable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XConsolidationDescriptor > + SAL_CALL createConsolidationDescriptor( sal_Bool bEmpty ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL consolidate( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XConsolidationDescriptor >& xDescriptor ) + throw(::com::sun::star::uno::RuntimeException); + + // XDocumentAuditing + virtual void SAL_CALL refreshArrows() throw(::com::sun::star::uno::RuntimeException); + + // XViewDataSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > SAL_CALL getViewData( ) + throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XMultiServiceFactory + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + createInstance( const ::rtl::OUString& aServiceSpecifier ) + throw(::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any >& Arguments ) + throw(::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAvailableServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScModelObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + + // XChangesNotifier + virtual void SAL_CALL addChangesListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XChangesListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeChangesListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XChangesListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); +}; + + +class ScDrawPagesObj : public cppu::WeakImplHelper2< + com::sun::star::drawing::XDrawPages, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + +::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > + GetObjectByIndex_Impl(sal_Int32 nIndex) const; + +public: + ScDrawPagesObj(ScDocShell* pDocSh); + virtual ~ScDrawPagesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XDrawPages + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > SAL_CALL + insertNewByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL remove( const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage >& xPage ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScTableSheetsObj : public cppu::WeakImplHelper5< + com::sun::star::sheet::XSpreadsheets, + com::sun::star::sheet::XCellRangesAccess, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + ScTableSheetObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const; + ScTableSheetObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const; + +public: + ScTableSheetsObj(ScDocShell* pDocSh); + virtual ~ScTableSheetsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XSpreadsheets + virtual void SAL_CALL insertNewByName( const ::rtl::OUString& aName, sal_Int16 nPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL moveByName( const ::rtl::OUString& aName, sal_Int16 nDestination ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL copyByName( const ::rtl::OUString& aName, + const ::rtl::OUString& aCopy, sal_Int16 nDestination ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangesAccess + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCell > + SAL_CALL getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow, sal_Int32 nSheet ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > + SAL_CALL getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom, sal_Int32 nSheet ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence < ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > > + SAL_CALL getCellRangesByName( const ::rtl::OUString& aRange ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScTableColumnsObj : public cppu::WeakImplHelper5< + com::sun::star::table::XTableColumns, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XNameAccess, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; + SCCOL nStartCol; + SCCOL nEndCol; + + ScTableColumnObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const; + ScTableColumnObj* GetObjectByName_Impl(const ::rtl::OUString& aName) const; + +public: + ScTableColumnsObj(ScDocShell* pDocSh, SCTAB nT, + SCCOL nSC, SCCOL nEC); + virtual ~ScTableColumnsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XTableColumns + virtual void SAL_CALL insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScTableRowsObj : public cppu::WeakImplHelper4< + com::sun::star::table::XTableRows, + com::sun::star::container::XEnumerationAccess, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; + SCROW nStartRow; + SCROW nEndRow; + + ScTableRowObj* GetObjectByIndex_Impl(sal_Int32 nIndex) const; + +public: + ScTableRowsObj(ScDocShell* pDocSh, SCTAB nT, + SCROW nSR, SCROW nER); + virtual ~ScTableRowsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XTableRows + virtual void SAL_CALL insertByIndex( sal_Int32 nIndex, sal_Int32 nCount ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 nIndex, sal_Int32 nCount ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScSpreadsheetSettingsObj : public cppu::WeakImplHelper2< + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + +public: + virtual ~ScSpreadsheetSettingsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScAnnotationsObj : public cppu::WeakImplHelper3< + com::sun::star::sheet::XSheetAnnotations, + com::sun::star::container::XEnumerationAccess, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; // Collection belongs to the sheet + + bool GetAddressByIndex_Impl( sal_Int32 nIndex, ScAddress& rPos ) const; + ScAnnotationObj* GetObjectByIndex_Impl( sal_Int32 nIndex ) const; + +public: + ScAnnotationsObj(ScDocShell* pDocSh, SCTAB nT); + virtual ~ScAnnotationsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XSheetAnnotations + virtual void SAL_CALL insertNew( const ::com::sun::star::table::CellAddress& aPosition, + const ::rtl::OUString& aText ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScScenariosObj : public cppu::WeakImplHelper4< + com::sun::star::sheet::XScenarios, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SCTAB nTab; + + sal_Bool GetScenarioIndex_Impl( const ::rtl::OUString& rName, SCTAB& rIndex ); + ScTableSheetObj* GetObjectByIndex_Impl(sal_Int32 nIndex); + ScTableSheetObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +public: + ScScenariosObj(ScDocShell* pDocSh, SCTAB nT); + virtual ~ScScenariosObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XScenarios + virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::table::CellRangeAddress >& aRanges, + const ::rtl::OUString& aComment ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx new file mode 100644 index 000000000000..9c6353d0b51a --- /dev/null +++ b/sc/inc/dpcachetable.hxx @@ -0,0 +1,205 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPCACHETABLE_HXX +#define SC_DPCACHETABLE_HXX + +#include "sal/types.h" +#include "osl/mutex.hxx" +#include "global.hxx" +#include "collect.hxx" + +#include <vector> +#include <boost/unordered_set.hpp> +#include <boost/shared_ptr.hpp> +#include <com/sun/star/uno/Reference.hxx> + +namespace com { namespace sun { namespace star { + namespace sdbc { + class XRowSet; + } + namespace sheet { + struct DataPilotFieldFilter; + } +}}} + +class Date; +class ScDPItemData; +class ScDPCache; +class ScDocument; +class ScRange; +struct ScDPValueData; +struct ScQueryParam; + +class SC_DLLPUBLIC ScDPCacheTable +{ + struct RowFlag + { + bool mbShowByFilter:1; + bool mbShowByPage:1; + bool isActive() const; + RowFlag(); + }; +public: + /** individual filter item used in SingleFilter and GroupFilter. */ + struct FilterItem + { + String maString; + double mfValue; + bool mbHasValue; + + FilterItem(); + bool match( const ScDPItemData& rCellData ) const; + }; + + /** interface class used for filtering of rows. */ + class FilterBase + { + public: + /** returns true if the matching condition is met for a single cell + value, or false otherwise. */ + virtual bool match( const ScDPItemData& rCellData ) const = 0; + }; + + /** ordinary single-item filter. */ + class SingleFilter : public FilterBase + { + public: + explicit SingleFilter(String aString, double fValue, bool bHasValue); + virtual ~SingleFilter() {} + + virtual bool match(const ScDPItemData& rCellData) const; + + const String& getMatchString(); + double getMatchValue() const; + bool hasValue() const; + + private: + explicit SingleFilter(); + + FilterItem maItem; + }; + + /** multi-item (group) filter. */ + class GroupFilter : public FilterBase + { + public: + GroupFilter(); + virtual ~GroupFilter() {} + virtual bool match( const ScDPItemData& rCellData ) const; + void addMatchItem(const String& rStr, double fVal, bool bHasValue); + size_t getMatchItemCount() const; + + private: + ::std::vector<FilterItem> maItems; + }; + + /** single filtering criterion. */ + struct Criterion + { + sal_Int32 mnFieldIndex; + ::boost::shared_ptr<FilterBase> mpFilter; + + Criterion(); + }; + + ScDPCacheTable(const ScDPCache* pCache); + ~ScDPCacheTable(); + + sal_Int32 getRowSize() const; + sal_Int32 getColSize() const; + + const ScDPCache* getCache() const; + + /** Fill the internal table from the cell range provided. This function + assumes that the first row is the column header. */ + void fillTable( const ScQueryParam& rQuery, bool* pSpecial, + bool bIgnoreEmptyRows, bool bRepeatIfEmpty ); + + /** Fill the internal table from database connection object. This function + assumes that the first row is the column header. */ + void fillTable(); + + /** Check whether a specified row is active or not. When a row is active, + it is used in calculation of the results data. A row becomes inactive + when it is filtered out by page field. */ + bool isRowActive(sal_Int32 nRow) const; + + /** Set filter on/off flag to each row to control visibility. The caller + must ensure that the table is filled before calling this function. */ + void filterByPageDimension(const ::std::vector<Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims); + + /** Get the cell instance at specified location within the data grid. Note + that the data grid doesn't include the header row. Don't delete the + returned object! */ + const ScDPItemData* getCell(SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; + void getValue( ScDPValueData& rVal, SCCOL nCol, SCROW nRow, bool bRepeatIfEmpty) const; + String getFieldName( SCCOL nIndex) const; + + /** Get the unique entries for a field specified by index. The caller must + make sure that the table is filled before calling function, or it will + get an empty collection. */ + const ::std::vector<SCROW>& getFieldEntries( sal_Int32 nColumn ) const; + + /** Filter the table based on the specified criteria, and copy the + result to rTabData. This method is used, for example, to generate + a drill-down data table. */ + void filterTable(const ::std::vector<Criterion>& rCriteria, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rTabData, + const ::boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims); + + SCROW getOrder(long nDim, SCROW nIndex) const; + void clear(); + bool empty() const; + void setCache(const ScDPCache* p); + bool hasCache() const; + +private: + ScDPCacheTable(); + ScDPCacheTable(const ScDPCacheTable&); + + /** + * Check if a given row meets all specified criteria. + * + * @param nRow index of row to be tested. + * @param rCriteria a list of criteria + */ + bool isRowQualified(sal_Int32 nRow, const ::std::vector<Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rRepeatIfEmptyDims) const; + +private: + /** unique field entires for each field (column). */ + ::std::vector< ::std::vector<SCROW> > maFieldEntries; + + /** Row flags. The first row below the header row has the index of 0. */ + ::std::vector<RowFlag> maRowFlags; + + const ScDPCache* mpCache; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx new file mode 100644 index 000000000000..3c377c04b1e8 --- /dev/null +++ b/sc/inc/dpdimsave.hxx @@ -0,0 +1,193 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPDIMSAVE_HXX +#define SC_DPDIMSAVE_HXX + +#include <vector> +#include <map> +#include <tools/string.hxx> +#include "dpgroup.hxx" // for ScDPNumGroupInfo +#include "scdllapi.h" + +class ScDPGroupTableData; +class ScDPGroupDimension; +class ScDPObject; +class ScStrCollection; +class SvNumberFormatter; + +class ScDPSaveGroupDimension; + +// +// Classes to save Data Pilot settings that create new dimensions (fields). +// These have to be applied before the other ScDPSaveData settings. +// + +class SC_DLLPUBLIC ScDPSaveGroupItem +{ + String aGroupName; // name of group + ::std::vector<String> aElements; // names of items in original dimension + +public: + ScDPSaveGroupItem( const String& rName ); + ~ScDPSaveGroupItem(); + + void AddToData( ScDPGroupDimension& rDataDim, SvNumberFormatter* pFormatter ) const; + + void AddElement( const String& rName ); + void AddElementsFromGroup( const ScDPSaveGroupItem& rGroup ); + const String& GetGroupName() const { return aGroupName; } + bool RemoveElement( const String& rName ); // returns true if found (removed) + + bool IsEmpty() const; + size_t GetElementCount() const; + const String* GetElementByIndex( size_t nIndex ) const; + + void Rename( const String& rNewName ); + + // remove this group's elements from their groups in rDimension + // (rDimension must be a different dimension from the one which contains this) + void RemoveElementsFromGroups( ScDPSaveGroupDimension& rDimension ) const; +}; + +typedef ::std::vector<ScDPSaveGroupItem> ScDPSaveGroupItemVec; + +class SC_DLLPUBLIC ScDPSaveGroupDimension +{ + String aSourceDim; // always the real source from the original data + String aGroupDimName; + ScDPSaveGroupItemVec aGroups; + ScDPNumGroupInfo aDateInfo; + sal_Int32 nDatePart; + +public: + ScDPSaveGroupDimension( const String& rSource, const String& rName ); + ScDPSaveGroupDimension( const String& rSource, const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart ); + ~ScDPSaveGroupDimension(); + + void AddToData( ScDPGroupTableData& rData ) const; + + void SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ); + + void AddGroupItem( const ScDPSaveGroupItem& rItem ); + const String& GetGroupDimName() const { return aGroupDimName; } + const String& GetSourceDimName() const { return aSourceDim; } + + sal_Int32 GetDatePart() const { return nDatePart; } + const ScDPNumGroupInfo& GetDateInfo() const { return aDateInfo; } + + String CreateGroupName( const String& rPrefix ); + const ScDPSaveGroupItem* GetNamedGroup( const String& rGroupName ) const; + ScDPSaveGroupItem* GetNamedGroupAcc( const String& rGroupName ); + void RemoveFromGroups( const String& rItemName ); + void RemoveGroup( const String& rGroupName ); + bool IsEmpty() const; + bool HasOnlyHidden( const ScStrCollection& rVisible ); + + long GetGroupCount() const; + const ScDPSaveGroupItem* GetGroupByIndex( long nIndex ) const; + ScDPSaveGroupItem* GetGroupAccByIndex( long nIndex ); + + void Rename( const String& rNewName ); +}; + +class SC_DLLPUBLIC ScDPSaveNumGroupDimension +{ + String aDimensionName; + ScDPNumGroupInfo aGroupInfo; + ScDPNumGroupInfo aDateInfo; + sal_Int32 nDatePart; + +public: + ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rInfo ); + ScDPSaveNumGroupDimension( const String& rName, const ScDPNumGroupInfo& rDateInfo, sal_Int32 nPart ); + ~ScDPSaveNumGroupDimension(); + + void AddToData( ScDPGroupTableData& rData ) const; + + const String& GetDimensionName() const { return aDimensionName; } + const ScDPNumGroupInfo& GetInfo() const { return aGroupInfo; } + + sal_Int32 GetDatePart() const { return nDatePart; } + const ScDPNumGroupInfo& GetDateInfo() const { return aDateInfo; } + + void SetGroupInfo( const ScDPNumGroupInfo& rNew ); + void SetDateInfo( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ); +}; + +class SC_DLLPUBLIC ScDPDimensionSaveData +{ +public: + ScDPDimensionSaveData(); + ~ScDPDimensionSaveData(); + + bool operator==( const ScDPDimensionSaveData& r ) const; + + void WriteToData( ScDPGroupTableData& rData ) const; + + String CreateGroupDimName( const String& rSourceName, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames ); + String CreateDateGroupDimName( sal_Int32 nDatePart, const ScDPObject& rObject, bool bAllowSource, const ::std::vector< String >* pDeletedNames ); + + void AddGroupDimension( const ScDPSaveGroupDimension& rGroupDim ); + void ReplaceGroupDimension( const ScDPSaveGroupDimension& rGroupDim ); + void RemoveGroupDimension( const String& rGroupDimName ); + + void AddNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim ); + void ReplaceNumGroupDimension( const ScDPSaveNumGroupDimension& rGroupDim ); + void RemoveNumGroupDimension( const String& rGroupDimName ); + + const ScDPSaveGroupDimension* GetGroupDimForBase( const String& rBaseDimName ) const; + const ScDPSaveGroupDimension* GetNamedGroupDim( const String& rGroupDimName ) const; + const ScDPSaveGroupDimension* GetFirstNamedGroupDim( const String& rBaseDimName ) const; + const ScDPSaveGroupDimension* GetNextNamedGroupDim( const String& rGroupDimName ) const; + const ScDPSaveNumGroupDimension* GetNumGroupDim( const String& rGroupDimName ) const; + + ScDPSaveGroupDimension* GetGroupDimAccForBase( const String& rBaseDimName ); + ScDPSaveGroupDimension* GetNamedGroupDimAcc( const String& rGroupDimName ); + ScDPSaveGroupDimension* GetFirstNamedGroupDimAcc( const String& rBaseDimName ); + ScDPSaveGroupDimension* GetNextNamedGroupDimAcc( const String& rGroupDimName ); + + ScDPSaveNumGroupDimension* GetNumGroupDimAcc( const String& rGroupDimName ); + + bool HasGroupDimensions() const; + + sal_Int32 CollectDateParts( const String& rBaseDimName ) const; + +private: + typedef ::std::vector< ScDPSaveGroupDimension > ScDPSaveGroupDimVec; + typedef ::std::map< String, ScDPSaveNumGroupDimension > ScDPSaveNumGroupDimMap; + + ScDPDimensionSaveData& operator=( const ScDPDimensionSaveData& ); + + ScDPSaveGroupDimVec maGroupDims; + ScDPSaveNumGroupDimMap maNumGroupDims; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx new file mode 100644 index 000000000000..8502a305c93f --- /dev/null +++ b/sc/inc/dpglobal.hxx @@ -0,0 +1,192 @@ +/* -*- 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 IBM Corporation 2009. + * Copyright 2009 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef _SC_DPGLOBAL_HXX +#define _SC_DPGLOBAL_HXX + +#include <algorithm> +#include <list> +#include <vector> +#include <tools/gen.hxx> +#include <tools/debug.hxx> +#include <global.hxx> + +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/sheet/XDimensionsSupplier.hpp> + +#include <com/sun/star/sheet/DataPilotFieldFilter.hpp> +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include <com/sun/star/sheet/DataPilotTableHeaderData.hpp> +#include <com/sun/star/sheet/DataPilotTablePositionData.hpp> +#include <com/sun/star/sheet/DataPilotTablePositionType.hpp> +#include <com/sun/star/sheet/DataPilotTableResultData.hpp> +#include <com/sun/star/sheet/DataResultFlags.hpp> +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/MemberResultFlags.hpp> +#include <com/sun/star/sheet/TableFilterField.hpp> +#include <com/sun/star/sheet/XDataPilotMemberResults.hpp> +#include <com/sun/star/sheet/XDataPilotResults.hpp> +#include <com/sun/star/sheet/XHierarchiesSupplier.hpp> +#include <com/sun/star/sheet/XLevelsSupplier.hpp> + + +// moved from fieldwnd.hxx, see also SC_DAPI_MAXFIELDS +#define MAX_LABELS 256 + +#define PIVOT_MAXFUNC 11 +#define PIVOT_FUNC_NONE 0x0000 +#define PIVOT_FUNC_SUM 0x0001 +#define PIVOT_FUNC_COUNT 0x0002 +#define PIVOT_FUNC_AVERAGE 0x0004 +#define PIVOT_FUNC_MAX 0x0008 +#define PIVOT_FUNC_MIN 0x0010 +#define PIVOT_FUNC_PRODUCT 0x0020 +#define PIVOT_FUNC_COUNT_NUM 0x0040 +#define PIVOT_FUNC_STD_DEV 0x0080 +#define PIVOT_FUNC_STD_DEVP 0x0100 +#define PIVOT_FUNC_STD_VAR 0x0200 +#define PIVOT_FUNC_STD_VARP 0x0400 +#define PIVOT_FUNC_AUTO 0x1000 + +#define DATA_RENAME_SEPARATOR "_" +#define __MAX_NUM_LEN 64 +#define __DECIMALPLACE 18 + +#define DP_PROP_COLUMNGRAND "ColumnGrand" +#define DP_PROP_FUNCTION "Function" +#define DP_PROP_IGNOREEMPTY "IgnoreEmptyRows" +#define DP_PROP_ISDATALAYOUT "IsDataLayoutDimension" +#define DP_PROP_ISVISIBLE "IsVisible" +#define DP_PROP_ORIENTATION "Orientation" +#define DP_PROP_REPEATIFEMPTY "RepeatIfEmpty" +#define DP_PROP_ROWGRAND "RowGrand" +#define DP_PROP_SHOWDETAILS "ShowDetails" +#define DP_PROP_SHOWEMPTY "ShowEmpty" +#define DP_PROP_SUBTOTALS "SubTotals" +#define DP_PROP_USEDHIERARCHY "UsedHierarchy" +#define DP_PROP_FILTER "Filter" +#define DP_PROP_POSITION "Position" + +class TypedStrData; +class ScDPObject; +class ScDPInfoWnd; +class ScDocShell; +class ScTabViewShell; + +class SC_DLLPUBLIC ScDPItemData +{ +public: + enum { + MK_VAL = 0x01, + MK_DATA = 0x02, + MK_ERR = 0x04, + MK_DATE = 0x08, + MK_DATEPART = 0x10 + }; +private: + union + { + sal_uLong nNumFormat; + sal_Int32 mnDatePart; + }; + + String aString; + double fValue; + sal_uInt8 mbFlag; + + friend class ScDPCache; +public: + ScDPItemData() : nNumFormat( 0 ), fValue(0.0), mbFlag( 0 ){} + ScDPItemData( sal_uLong nNF, const String & rS, double fV, sal_uInt8 bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){} + ScDPItemData( const String& rS, double fV = 0.0, bool bHV = false, const sal_uLong nNumFormat = 0 , bool bData = true) ; + ScDPItemData( ScDocument* pDoc, SCROW nRow, sal_uInt16 nCol, sal_uInt16 nDocTab ); + + void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; } + bool IsCaseInsEqual( const ScDPItemData& r ) const; + + size_t Hash() const; + + // exact equality + bool operator==( const ScDPItemData& r ) const; + // case insensitive equality + static sal_Int32 Compare( const ScDPItemData& rA, const ScDPItemData& rB ); + +#if OSL_DEBUG_LEVEL > 1 + void dump() const; +#endif + +public: + bool IsHasData() const ; + bool IsHasErr() const ; + bool IsValue() const; + String GetString() const ; + double GetValue() const ; + sal_uLong GetNumFormat() const ; + bool HasStringData() const ; + bool IsDate() const; + bool HasDatePart() const; + void SetDate( bool b ) ; + + TypedStrData* CreateTypeString( ); + sal_uInt8 GetType() const; + sal_uInt8 & GetFlag() throw() { return mbFlag; } + const sal_uInt8 & GetFlag() const throw() { return const_cast<ScDPItemData*>(this)->GetFlag(); } +}; + +class SC_DLLPUBLIC ScDPItemDataPool +{ +public: + ScDPItemDataPool(); + ScDPItemDataPool(const ScDPItemDataPool& r); + + virtual ~ScDPItemDataPool(); + virtual const ScDPItemData* getData( sal_Int32 nId ); + virtual sal_Int32 getDataId( const ScDPItemData& aData ); + virtual sal_Int32 insertData( const ScDPItemData& aData ); +protected: + struct DataHashFunc : public std::unary_function< const ScDPItemData &, size_t > + { + size_t operator() (const ScDPItemData &rData) const { return rData.Hash(); } + }; + + typedef ::boost::unordered_multimap< ScDPItemData, sal_Int32, DataHashFunc > DataHash; + + ::std::vector< ScDPItemData > maItems; + DataHash maItemIds; +}; + +namespace ScDPGlobal +{ +// common operation + String operator + ( const String & rL, const String &rR ); + Rectangle operator *( const Rectangle &rLeft, const std::pair<double,double> & rRight ); +} +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx new file mode 100644 index 000000000000..ada526cf1083 --- /dev/null +++ b/sc/inc/dpgroup.hxx @@ -0,0 +1,239 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPGROUP_HXX +#define SC_DPGROUP_HXX + +#include <vector> +#include <boost/unordered_set.hpp> +#include <boost/shared_ptr.hpp> + +#include "dptabdat.hxx" +#include "scdllapi.h" +#include "dpglobal.hxx" +class ScDocument; +class SvNumberFormatter; + +//! API struct? +struct ScDPNumGroupInfo +{ + sal_Bool Enable; + sal_Bool DateValues; + sal_Bool AutoStart; + sal_Bool AutoEnd; + double Start; + double End; + double Step; + + ScDPNumGroupInfo() : Enable(false), DateValues(false), AutoStart(false), AutoEnd(false), + Start(0.0), End(0.0), Step(0.0) {} +}; + +// ScDPDateGroupHelper is used as part of ScDPGroupDimension (additional dim.) +// or ScDPNumGroupDimension (innermost, replaces the original dim.). +// Source index, name and result collection are stored at the parent. + +class ScDPDateGroupHelper +{ + ScDPNumGroupInfo aNumInfo; // only start and end (incl. auto flags) are used + sal_Int32 nDatePart; // single part + +public: + ScDPDateGroupHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ); + ~ScDPDateGroupHelper(); + + sal_Int32 GetDatePart() const { return nDatePart; } + const ScDPNumGroupInfo& GetNumInfo() const { return aNumInfo; } + + void FillColumnEntries( + SCCOL nSourceDim, const ScDPCache* pCahe , std::vector<SCROW>& rEntries, + const std::vector<SCROW>& rOriginal) const; +}; + +typedef ::std::vector<ScDPItemData> ScDPItemDataVec; + +class ScDPGroupItem +{ + ScDPItemData aGroupName; // name of group item + ScDPItemDataVec aElements; // names of items in original dimension + +public: + ScDPGroupItem( const ScDPItemData& rName ); + ~ScDPGroupItem(); + + void AddElement( const ScDPItemData& rName ); + + const ScDPItemData& GetName() const { return aGroupName; } + bool HasElement( const ScDPItemData& rData ) const; + bool HasCommonElement( const ScDPGroupItem& rOther ) const; + + void FillGroupFilter( ScDPCacheTable::GroupFilter& rFilter ) const; +}; + +typedef ::std::vector<ScDPGroupItem> ScDPGroupItemVec; + +class ScDPGroupDimension +{ + long nSourceDim; + long nGroupDim; + String aGroupName; + ScDPDateGroupHelper* pDateHelper; + ScDPGroupItemVec aItems; + mutable ::std::vector< SCROW > maMemberEntries; +public: + ScDPGroupDimension( long nSource, const String& rNewName ); + ScDPGroupDimension( const ScDPGroupDimension& rOther ); + ~ScDPGroupDimension(); + + ScDPGroupDimension& operator=( const ScDPGroupDimension& rOther ); + + void AddItem( const ScDPGroupItem& rItem ); + void SetGroupDim( long nDim ); // called from AddGroupDimension + + long GetSourceDim() const { return nSourceDim; } + long GetGroupDim() const { return nGroupDim; } + const String& GetName() const { return aGroupName; } + + const std::vector< SCROW >& GetColumnEntries( const ScDPCacheTable& rCacheTable, const std::vector< SCROW >& rOriginal ) const; + const ScDPGroupItem* GetGroupForData( const ScDPItemData& rData ) const; // rData = entry in original dim. + const ScDPGroupItem* GetGroupForName( const ScDPItemData& rName ) const; // rName = entry in group dim. + const ScDPGroupItem* GetGroupByIndex( size_t nIndex ) const; + + const ScDPDateGroupHelper* GetDateHelper() const { return pDateHelper; } + + void MakeDateHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ); + + void DisposeData(); + + size_t GetItemCount() const { return aItems.size(); } +}; + +typedef ::std::vector<ScDPGroupDimension> ScDPGroupDimensionVec; + +class SC_DLLPUBLIC ScDPNumGroupDimension +{ + ScDPNumGroupInfo aGroupInfo; // settings + ScDPDateGroupHelper* pDateHelper; + mutable ::std::vector< SCROW > maMemberEntries; + mutable bool bHasNonInteger; // initialized in GetNumEntries + mutable sal_Unicode cDecSeparator; // initialized in GetNumEntries + +public: + ScDPNumGroupDimension(); + ScDPNumGroupDimension( const ScDPNumGroupInfo& rInfo ); + ScDPNumGroupDimension( const ScDPNumGroupDimension& rOther ); + ~ScDPNumGroupDimension(); + + ScDPNumGroupDimension& operator=( const ScDPNumGroupDimension& rOther ); + + const ScDPNumGroupInfo& GetInfo() const { return aGroupInfo; } + bool HasNonInteger() const { return bHasNonInteger; } + sal_Unicode GetDecSeparator() const { return cDecSeparator; } + + const ScDPDateGroupHelper* GetDateHelper() const { return pDateHelper; } + + const std::vector<SCROW>& GetNumEntries( + SCCOL nSourceDim, const ScDPCache* pCache, + const std::vector< SCROW >& rOriginal) const; + + void MakeDateHelper( const ScDPNumGroupInfo& rInfo, sal_Int32 nPart ); + + void DisposeData(); +}; + +// +// proxy implementation of ScDPTableData to add grouped items +// + +class ScDPGroupTableData : public ScDPTableData +{ + typedef ::boost::unordered_set< ::rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > StringHashSet; + + ::boost::shared_ptr<ScDPTableData> pSourceData; + long nSourceCount; + ScDPGroupDimensionVec aGroups; + ScDPNumGroupDimension* pNumGroups; // array[nSourceCount] + ScDocument* pDoc; + StringHashSet aGroupNames; + + void FillGroupValues( SCROW* pItemDataIndex, long nCount, const long* pDims ); + virtual long GetSourceDim( long nDim ); + + bool IsNumGroupDimension( long nDimension ) const; + void GetNumGroupInfo( long nDimension, ScDPNumGroupInfo& rInfo, + bool& rNonInteger, sal_Unicode& rDecimal ); + + void ModifyFilterCriteria(::std::vector<ScDPCacheTable::Criterion>& rCriteria); + +public: + // takes ownership of pSource + ScDPGroupTableData( const ::boost::shared_ptr<ScDPTableData>& pSource, ScDocument* pDocument ); + virtual ~ScDPGroupTableData(); + + void AddGroupDimension( const ScDPGroupDimension& rGroup ); + void SetNumGroupDimension( long nIndex, const ScDPNumGroupDimension& rGroup ); + long GetDimensionIndex( const String& rName ); + + ScDocument* GetDocument() { return pDoc; } + + virtual long GetColumnCount(); + virtual long GetMembersCount( long nDim ); + virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ; + virtual const ScDPItemData* GetMemberById( long nDim, long nId); + virtual long Compare( long nDim, long nDataId1, long nDataId2); + + virtual String getDimensionName(long nColumn); + virtual sal_Bool getIsDataLayoutDimension(long nColumn); + virtual sal_Bool IsDateDimension(long nDim); + virtual sal_uLong GetNumberFormat(long nDim); + virtual void DisposeData(); + virtual void SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty ); + + virtual bool IsRepeatIfEmpty(); + + virtual void CreateCacheTable(); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims); + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::boost::unordered_set<sal_Int32>& rCatDims, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); + virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); + virtual const ScDPCacheTable& GetCacheTable() const; + + virtual sal_Bool IsBaseForGroup(long nDim) const; + virtual long GetGroupBase(long nGroupDim) const; + virtual sal_Bool IsNumOrDateGroup(long nDim) const; + virtual sal_Bool IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + virtual sal_Bool HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, + const ScDPItemData& rSecondData, long nSecondIndex ) const; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx new file mode 100644 index 000000000000..5280cb0c3f73 --- /dev/null +++ b/sc/inc/dpobject.hxx @@ -0,0 +1,374 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPOBJECT_HXX +#define SC_DPOBJECT_HXX + +#include "scdllapi.h" +#include "global.hxx" +#include "address.hxx" +#include "collect.hxx" +#include "dpoutput.hxx" +#include "pivot.hxx" +#include <com/sun/star/sheet/XDimensionsSupplier.hpp> + +#include <boost/ptr_container/ptr_list.hpp> +#include <boost/ptr_container/ptr_vector.hpp> +#include <boost/ptr_container/ptr_map.hpp> +#include <boost/shared_ptr.hpp> + +namespace com { namespace sun { namespace star { namespace sheet { + + struct DataPilotTablePositionData; + struct DataPilotTableHeaderData; + +}}}} + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldFilter; +}}}} + +class Rectangle; +class SvStream; +class ScDPSaveData; +class ScDPOutput; +class ScPivot; +class ScPivotCollection; +struct ScPivotParam; +struct ScImportSourceDesc; +class ScSheetSourceDesc; +class ScStrCollection; +class TypedScStrCollection; +struct PivotField; +class ScDPCacheTable; +class ScDPTableData; + +struct ScDPServiceDesc +{ + String aServiceName; + String aParSource; + String aParName; + String aParUser; + String aParPass; + + ScDPServiceDesc( const String& rServ, const String& rSrc, const String& rNam, + const String& rUser, const String& rPass ) : + aServiceName( rServ ), aParSource( rSrc ), aParName( rNam ), + aParUser( rUser ), aParPass( rPass ) { } + + sal_Bool operator== ( const ScDPServiceDesc& rOther ) const + { return aServiceName == rOther.aServiceName && + aParSource == rOther.aParSource && + aParName == rOther.aParName && + aParUser == rOther.aParUser && + aParPass == rOther.aParPass; } +}; + + +class SC_DLLPUBLIC ScDPObject +{ +private: + ScDocument* pDoc; + // settings + ScDPSaveData* pSaveData; + String aTableName; + String aTableTag; + ScRange aOutRange; + ScSheetSourceDesc* pSheetDesc; // for sheet data + ScImportSourceDesc* pImpDesc; // for database data + ScDPServiceDesc* pServDesc; // for external service + ::boost::shared_ptr<ScDPTableData> mpTableData; + // cached data + com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier> xSource; + ScDPOutput* pOutput; + sal_Bool bSettingsChanged; + sal_Bool bAlive; // sal_False if only used to hold settings + sal_uInt16 mnAutoFormatIndex; + sal_Bool bAllowMove; + long nHeaderRows; // page fields plus filter button + bool mbHeaderLayout; // sal_True : grid, sal_False : standard + + + SC_DLLPRIVATE ScDPTableData* GetTableData(); + SC_DLLPRIVATE void CreateObjects(); + SC_DLLPRIVATE void CreateOutput(); + sal_Bool bRefresh; + +public: + ScDPObject(ScDocument* pD); + ScDPObject(const ScDPObject& r); + ~ScDPObject(); + + /** + * When a DP object is "alive", it has table output on a sheet. This flag + * doesn't really change the behavior of the object, but is used only for + * testing purposes. + */ + void SetAlive(sal_Bool bSet); + void SetAllowMove(sal_Bool bSet); + + void InvalidateData(); + void ClearSource(); + + + void Output( const ScAddress& rPos ); + ScRange GetNewOutputRange( bool& rOverflow ); + const ScRange GetOutputRangeByType( sal_Int32 nType ); + + void SetSaveData(const ScDPSaveData& rData); + ScDPSaveData* GetSaveData() const { return pSaveData; } + + void SetOutRange(const ScRange& rRange); + const ScRange& GetOutRange() const { return aOutRange; } + + void SetHeaderLayout(bool bUseGrid); + bool GetHeaderLayout() const; + + void SetSheetDesc(const ScSheetSourceDesc& rDesc); + void SetImportDesc(const ScImportSourceDesc& rDesc); + void SetServiceData(const ScDPServiceDesc& rDesc); + + void WriteSourceDataTo( ScDPObject& rDest ) const; + void WriteTempDataTo( ScDPObject& rDest ) const; + + const ScSheetSourceDesc* GetSheetDesc() const { return pSheetDesc; } + const ScImportSourceDesc* GetImportSourceDesc() const { return pImpDesc; } + const ScDPServiceDesc* GetDPServiceDesc() const { return pServDesc; } + + com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier> GetSource(); + + sal_Bool IsSheetData() const; + sal_Bool IsImportData() const { return(pImpDesc != NULL); } + sal_Bool IsServiceData() const { return(pServDesc != NULL); } + + void SetName(const String& rNew); + const String& GetName() const { return aTableName; } + void SetTag(const String& rNew); + const String& GetTag() const { return aTableTag; } + + /** + * Data description cell displays the description of a data dimension if + * and only if there is only one data dimension. It's usually located at + * the upper-left corner of the table output. + */ + bool IsDataDescriptionCell(const ScAddress& rPos); + + bool IsDimNameInUse(const ::rtl::OUString& rName) const; + String GetDimName( long nDim, sal_Bool& rIsDataLayout, sal_Int32* pFlags = NULL ); + sal_Bool IsDuplicated( long nDim ); + long GetDimCount(); + void GetHeaderPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTableHeaderData& rData); + long GetHeaderDim( const ScAddress& rPos, sal_uInt16& rOrient ); + sal_Bool GetHeaderDrag( const ScAddress& rPos, sal_Bool bMouseLeft, sal_Bool bMouseTop, + long nDragDim, + Rectangle& rPosRect, sal_uInt16& rOrient, long& rDimPos ); + sal_Bool IsFilterButton( const ScAddress& rPos ); + + sal_Bool GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */ + const std::vector< ScDPGetPivotDataField >& rFilters ); + sal_Bool ParseFilters( ScDPGetPivotDataField& rTarget, + std::vector< ScDPGetPivotDataField >& rFilters, + const String& rFilterList ); + + void GetMemberResultNames( ScStrCollection& rNames, long nDimension ); + + void FillPageList( TypedScStrCollection& rStrings, long nField ); + + void ToggleDetails(const ::com::sun::star::sheet::DataPilotTableHeaderData& rElemDesc, ScDPObject* pDestObj); + + sal_Bool FillOldParam(ScPivotParam& rParam) const; + sal_Bool FillLabelData(ScPivotParam& rParam); + void InitFromOldPivot(const ScPivot& rOld, ScDocument* pDoc, sal_Bool bSetSource); + + sal_Bool GetHierarchiesNA( sal_Int32 nDim, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xHiers ); + sal_Bool GetHierarchies( sal_Int32 nDim, com::sun::star::uno::Sequence< rtl::OUString >& rHiers ); + + sal_Int32 GetUsedHierarchy( sal_Int32 nDim ); + + sal_Bool GetMembersNA( sal_Int32 nDim, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xMembers ); + sal_Bool GetMembersNA( sal_Int32 nDim, sal_Int32 nHier, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xMembers ); + + bool GetMemberNames( sal_Int32 nDim, ::com::sun::star::uno::Sequence< ::rtl::OUString >& rNames ); + bool GetMembers( sal_Int32 nDim, sal_Int32 nHier, ::std::vector<ScDPLabelData::Member>& rMembers ); + + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + sal_Bool RefsEqual( const ScDPObject& r ) const; + void WriteRefsTo( ScDPObject& r ) const; + + void GetPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTablePositionData& rPosData); + + bool GetDataFieldPositionData(const ScAddress& rPos, + ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::DataPilotFieldFilter >& rFilters); + + void GetDrillDownData(const ScAddress& rPos, + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any > >& rTableData); + + // apply drop-down attribute, initialize nHeaderRows, without accessing the source + // (button attribute must be present) + void RefreshAfterLoad(); + + void BuildAllDimensionMembers(); + + static sal_Bool HasRegisteredSources(); + static com::sun::star::uno::Sequence<rtl::OUString> GetRegisteredSources(); + static com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier> + CreateSource( const ScDPServiceDesc& rDesc ); + + static void ConvertOrientation( ScDPSaveData& rSaveData, + const ::std::vector<PivotField>& rFields, sal_uInt16 nOrient, + const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSource, + ::std::vector<PivotField>* pRefColFields = NULL, + ::std::vector<PivotField>* pRefRowFields = NULL, + ::std::vector<PivotField>* pRefPageFields = NULL ); + + static bool IsOrientationAllowed( sal_uInt16 nOrient, sal_Int32 nDimFlags ); +}; + + +class ScDPCollection +{ +public: + + /** + * Stores and manages all caches from internal sheets. + */ + class SheetCaches + { + typedef ::boost::ptr_map<ScRange, ScDPCache> CachesType; + CachesType maCaches; + ScDocument* mpDoc; + public: + SheetCaches(ScDocument* pDoc); + const ScDPCache* getCache(const ScRange& rRange); + void removeCache(const ScRange& rRange); + }; + + /** + * Data caches for range name based source data. + */ + class NameCaches + { + typedef ::boost::ptr_map<rtl::OUString, ScDPCache> CachesType; + CachesType maCaches; + ScDocument* mpDoc; + public: + NameCaches(ScDocument* pDoc); + const ScDPCache* getCache(const ::rtl::OUString& rName, const ScRange& rRange); + void removeCache(const ::rtl::OUString& rName); + }; + + /** + * Defines connection type to external data source. Used as a key to look + * up database cache. + */ + struct DBType + { + sal_Int32 mnSdbType; + ::rtl::OUString maDBName; + ::rtl::OUString maCommand; + DBType(sal_Int32 nSdbType, const ::rtl::OUString& rDBName, const ::rtl::OUString& rCommand); + + struct less : public ::std::binary_function<DBType, DBType, bool> + { + bool operator() (const DBType& left, const DBType& right) const; + }; + }; + + /** + * Data caches for external database sources. + */ + class DBCaches + { + typedef ::boost::ptr_map<DBType, ScDPCache, DBType::less> CachesType; + CachesType maCaches; + ScDocument* mpDoc; + public: + DBCaches(ScDocument* pDoc); + const ScDPCache* getCache(sal_Int32 nSdbType, const ::rtl::OUString& rDBName, const ::rtl::OUString& rCommand); + void removeCache(sal_Int32 nSdbType, const ::rtl::OUString& rDBName, const ::rtl::OUString& rCommand); + }; + + ScDPCollection(ScDocument* pDocument); + ScDPCollection(const ScDPCollection& r); + ~ScDPCollection(); + + bool ClearCache(ScDPObject* pDPObj); + + SC_DLLPUBLIC size_t GetCount() const; + SC_DLLPUBLIC ScDPObject* operator[](size_t nIndex); + SC_DLLPUBLIC const ScDPObject* operator[](size_t nIndex) const; + + const ScDPObject* GetByName(const String& rName) const; + + void DeleteOnTab( SCTAB nTab ); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& r, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + + bool RefsEqual( const ScDPCollection& r ) const; + void WriteRefsTo( ScDPCollection& r ) const; + + /** + * Create a new name that's not yet used by any existing data pilot + * objects. All data pilot names are 'DataPilot' + <num>, and the nMin + * specifies the minimum number allowed. + * + * @param nMin minimum number allowed. + * + * @return new name for data pilot object. + */ + String CreateNewName( sal_uInt16 nMin = 1 ) const; + + void FreeTable(ScDPObject* pDPObj); + SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj); + + bool HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const; + + SheetCaches& GetSheetCaches(); + NameCaches& GetNameCaches(); + DBCaches& GetDBCaches(); + +private: + typedef ::boost::ptr_vector<ScDPObject> TablesType; + + ScDocument* pDoc; + TablesType maTables; + SheetCaches maSheetCaches; + NameCaches maNameCaches; + DBCaches maDBCaches; +}; + +bool operator<(const ScDPCollection::DBType& left, const ScDPCollection::DBType& right); + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx new file mode 100644 index 000000000000..d1d07e2c42cb --- /dev/null +++ b/sc/inc/dpoutput.hxx @@ -0,0 +1,176 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPOUTPUT_HXX +#define SC_DPOUTPUT_HXX + +#include <com/sun/star/sheet/XDimensionsSupplier.hpp> +#include <com/sun/star/sheet/DataResult.hpp> +#include <com/sun/star/sheet/MemberResult.hpp> +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/DataPilotOutputRangeType.hpp> + +#include "global.hxx" +#include "address.hxx" + +#include "dpcachetable.hxx" +#include <vector> + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldFilter; + struct DataPilotTablePositionData; +}}}} + +class Rectangle; +class SvStream; +class ScDocument; +class ScStrCollection; + +struct ScDPOutLevelData; + + +struct ScDPGetPivotDataField +{ + String maFieldName; + com::sun::star::sheet::GeneralFunction meFunction; + + bool mbValIsStr; + String maValStr; + double mnValNum; + + ScDPGetPivotDataField() : + meFunction( com::sun::star::sheet::GeneralFunction_NONE ), + mbValIsStr( false ), + mnValNum( 0.0 ) + { + } +}; + + + +class ScDPOutput //! name??? +{ +private: + //! use impl-object? + ScDocument* pDoc; + com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier> xSource; + ScAddress aStartPos; + bool bDoFilter; + ScDPOutLevelData* pColFields; + ScDPOutLevelData* pRowFields; + ScDPOutLevelData* pPageFields; + long nColFieldCount; + long nRowFieldCount; + long nPageFieldCount; + com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::sheet::DataResult> > aData; + bool bResultsError; + bool mbHasDataLayout; + String aDataDescription; + + // Number format related parameters + sal_uInt32* pColNumFmt; + sal_uInt32* pRowNumFmt; + long nColFmtCount; + long nRowFmtCount; + sal_uInt32 nSingleNumFmt; + + // Output geometry related parameters + bool bSizesValid; + bool bSizeOverflow; + long nColCount; + long nRowCount; + long nHeaderSize; + bool mbHeaderLayout; // sal_True : grid, sal_False : standard + SCCOL nTabStartCol; + SCROW nTabStartRow; + SCCOL nMemberStartCol; + SCROW nMemberStartRow; + SCCOL nDataStartCol; + SCROW nDataStartRow; + SCCOL nTabEndCol; + SCROW nTabEndRow; + + void DataCell( SCCOL nCol, SCROW nRow, SCTAB nTab, + const com::sun::star::sheet::DataResult& rData ); + void HeaderCell( SCCOL nCol, SCROW nRow, SCTAB nTab, + const com::sun::star::sheet::MemberResult& rData, + sal_Bool bColHeader, long nLevel ); + void FieldCell( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rCaption, + bool bInTable, bool bPopup, bool bHasHiddenMember ); + void CalcSizes(); + + /** Query which sub-area of the table the cell is in. See + css.sheet.DataPilotTablePositionType for the interpretation of the + return value. */ + sal_Int32 GetPositionType(const ScAddress& rPos); + +public: + ScDPOutput( ScDocument* pD, + const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSrc, + const ScAddress& rPos, bool bFilter ); + ~ScDPOutput(); + + void SetPosition( const ScAddress& rPos ); + + void Output(); //! Refresh? + ScRange GetOutputRange( sal_Int32 nRegionType = ::com::sun::star::sheet::DataPilotOutputRangeType::WHOLE ); + long GetHeaderRows(); + bool HasError(); // range overflow or exception from source + + void GetPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTablePositionData& rPosData); + + /** Get filtering criteria based on the position of the cell within data + field region. */ + bool GetDataResultPositionData(::std::vector< ::com::sun::star::sheet::DataPilotFieldFilter >& rFilters, const ScAddress& rPos); + + sal_Bool GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */ + const std::vector< ScDPGetPivotDataField >& rFilters ); + long GetHeaderDim( const ScAddress& rPos, sal_uInt16& rOrient ); + sal_Bool GetHeaderDrag( const ScAddress& rPos, sal_Bool bMouseLeft, sal_Bool bMouseTop, + long nDragDim, + Rectangle& rPosRect, sal_uInt16& rOrient, long& rDimPos ); + sal_Bool IsFilterButton( const ScAddress& rPos ); + + void GetMemberResultNames( ScStrCollection& rNames, long nDimension ); + + void SetHeaderLayout(bool bUseGrid); + bool GetHeaderLayout() const; + + static void GetDataDimensionNames( String& rSourceName, String& rGivenName, + const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface>& xDim ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpoutputgeometry.hxx b/sc/inc/dpoutputgeometry.hxx new file mode 100644 index 000000000000..c5c65195eff0 --- /dev/null +++ b/sc/inc/dpoutputgeometry.hxx @@ -0,0 +1,80 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPOUTPUTGEOMETRY_HXX +#define SC_DPOUTPUTGEOMETRY_HXX + +#include "address.hxx" +#include <vector> + +class ScAddress; + +class SC_DLLPUBLIC ScDPOutputGeometry +{ +public: + enum FieldType { Column, Row, Page, Data, None }; + enum ImportType { ODF, XLS }; + + ScDPOutputGeometry(const ScRange& rOutRange, bool bShowFilter, ImportType eImportType); + ~ScDPOutputGeometry(); + + /** + * @param nCount number of row fields, <b>excluding the data layout + * field if exists</b>. + */ + void setRowFieldCount(sal_uInt32 nCount); + void setColumnFieldCount(sal_uInt32 nCount); + void setPageFieldCount(sal_uInt32 nCount); + void setDataFieldCount(sal_uInt32 nCount); + + void getColumnFieldPositions(::std::vector<ScAddress>& rAddrs) const; + void getRowFieldPositions(::std::vector<ScAddress>& rAddrs) const; + void getPageFieldPositions(::std::vector<ScAddress>& rAddrs) const; + + SCROW getRowFieldHeaderRow() const; + + FieldType getFieldButtonType(const ScAddress& rPos) const; + +private: + ScDPOutputGeometry(); // disabled + +private: + ScRange maOutRange; + sal_uInt32 mnRowFields; /// number of row fields (data layout field NOT included!) + sal_uInt32 mnColumnFields; + sal_uInt32 mnPageFields; + sal_uInt32 mnDataFields; + + ImportType meImportType; + + bool mbShowFilter; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx new file mode 100644 index 000000000000..0458332d1e3d --- /dev/null +++ b/sc/inc/dpsave.hxx @@ -0,0 +1,346 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPSAVE_HXX +#define SC_DPSAVE_HXX + +#include <list> +#include <memory> + +#include <boost/ptr_container/ptr_vector.hpp> +#include <boost/unordered_map.hpp> + +#include <com/sun/star/sheet/XDimensionsSupplier.hpp> +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include <rtl/ustring.hxx> +#include <sal/types.h> +#include <tools/string.hxx> + +#include "scdllapi.h" + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldReference; + struct DataPilotFieldSortInfo; + struct DataPilotFieldAutoShowInfo; + struct DataPilotFieldLayoutInfo; +} } } } + +class ScDPDimensionSaveData; +class ScDPTableData; + +// +// classes to save Data Pilot settings +// + + +class ScDPSaveMember +{ +private: + ::rtl::OUString aName; + ::std::auto_ptr<rtl::OUString> mpLayoutName; // custom name to be displayed in the table. + sal_uInt16 nVisibleMode; + sal_uInt16 nShowDetailsMode; + +public: + ScDPSaveMember(const ::rtl::OUString& rName); + ScDPSaveMember(const ScDPSaveMember& r); + ~ScDPSaveMember(); + + bool operator== ( const ScDPSaveMember& r ) const; + + const ::rtl::OUString& GetName() const + { return aName; } + + bool HasIsVisible() const; + SC_DLLPUBLIC void SetIsVisible(bool bSet); + bool GetIsVisible() const + { return bool(nVisibleMode); } + + bool HasShowDetails() const; + SC_DLLPUBLIC void SetShowDetails(bool bSet); + bool GetShowDetails() const + { return bool(nShowDetailsMode); } + + void SetName( const ::rtl::OUString& rNew ); // used if the source member was renamed (groups) + + SC_DLLPUBLIC void SetLayoutName( const ::rtl::OUString& rName ); + SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const; + void RemoveLayoutName(); + + void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xMember, + sal_Int32 nPosition ); +}; + + +bool operator == (const ::com::sun::star::sheet::DataPilotFieldSortInfo &l, const ::com::sun::star::sheet::DataPilotFieldSortInfo &r ); +bool operator == (const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &l, const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo &r ); +bool operator == (const ::com::sun::star::sheet::DataPilotFieldReference &l, const ::com::sun::star::sheet::DataPilotFieldReference &r ); + +class SC_DLLPUBLIC ScDPSaveDimension +{ +private: + ::rtl::OUString aName; + ::rtl::OUString* pSelectedPage; + ::std::auto_ptr<rtl::OUString> mpLayoutName; + ::std::auto_ptr<rtl::OUString> mpSubtotalName; + bool bIsDataLayout; + bool bDupFlag; + sal_uInt16 nOrientation; + sal_uInt16 nFunction; // enum GeneralFunction, for data dimensions + long nUsedHierarchy; + sal_uInt16 nShowEmptyMode; //! at level + bool bSubTotalDefault; //! at level + long nSubTotalCount; + sal_uInt16* pSubTotalFuncs; // enum GeneralFunction + ::com::sun::star::sheet::DataPilotFieldReference* pReferenceValue; + ::com::sun::star::sheet::DataPilotFieldSortInfo* pSortInfo; // (level) + ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pAutoShowInfo; // (level) + ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pLayoutInfo; // (level) + +public: + typedef boost::unordered_map <rtl::OUString, ScDPSaveMember*, rtl::OUStringHash> MemberHash; + typedef std::list <ScDPSaveMember*> MemberList; + +private: + MemberHash maMemberHash; + MemberList maMemberList; + +public: + ScDPSaveDimension(const ::rtl::OUString& rName, bool bDataLayout); + ScDPSaveDimension(const ScDPSaveDimension& r); + ~ScDPSaveDimension(); + + bool operator== ( const ScDPSaveDimension& r ) const; + + const MemberList& GetMembers() const + { return maMemberList; } + + void AddMember(ScDPSaveMember* pMember); + + void SetDupFlag(bool bSet) + { bDupFlag = bSet; } + + bool GetDupFlag() const + { return bDupFlag; } + + const ::rtl::OUString& GetName() const + { return aName; } + + bool IsDataLayout() const + { return bIsDataLayout; } + + void SetName( const ::rtl::OUString& rNew ); // used if the source dim was renamed (groups) + + void SetOrientation(sal_uInt16 nNew); + void SetSubTotals(long nCount, const sal_uInt16* pFuncs); + long GetSubTotalsCount() const + { return nSubTotalCount; } + + sal_uInt16 GetSubTotalFunc(long nIndex) const + { return pSubTotalFuncs[nIndex]; } + + bool HasShowEmpty() const; + void SetShowEmpty(bool bSet); + bool GetShowEmpty() const + { return bool(nShowEmptyMode); } + + void SetFunction(sal_uInt16 nNew); // enum GeneralFunction + sal_uInt16 GetFunction() const + { return nFunction; } + + void SetUsedHierarchy(long nNew); + long GetUsedHierarchy() const + { return nUsedHierarchy; } + + void SetLayoutName(const ::rtl::OUString& rName); + const ::rtl::OUString* GetLayoutName() const; + void RemoveLayoutName(); + void SetSubtotalName(const ::rtl::OUString& rName); + const ::rtl::OUString* GetSubtotalName() const; + + bool IsMemberNameInUse(const ::rtl::OUString& rName) const; + + const ::com::sun::star::sheet::DataPilotFieldReference* GetReferenceValue() const + { return pReferenceValue; } + + void SetReferenceValue(const ::com::sun::star::sheet::DataPilotFieldReference* pNew); + + const ::com::sun::star::sheet::DataPilotFieldSortInfo* GetSortInfo() const + { return pSortInfo; } + + void SetSortInfo(const ::com::sun::star::sheet::DataPilotFieldSortInfo* pNew); + const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* GetAutoShowInfo() const + { return pAutoShowInfo; } + + void SetAutoShowInfo(const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo* pNew); + const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* GetLayoutInfo() const + { return pLayoutInfo; } + + void SetLayoutInfo(const ::com::sun::star::sheet::DataPilotFieldLayoutInfo* pNew); + + void SetCurrentPage( const ::rtl::OUString* pPage ); // NULL = no selection (all) + bool HasCurrentPage() const; + const ::rtl::OUString& GetCurrentPage() const; + + sal_uInt16 GetOrientation() const + { return nOrientation; } + + ScDPSaveMember* GetExistingMemberByName(const ::rtl::OUString& rName); + + /** + * Get a member object by its name. If one doesn't exist, creat a new + * object and return it. This class manages the life cycle of all member + * objects belonging to it, so <i>don't delete the returned instance.</i> + * + * @param rName member name + * + * @return pointer to the member object. + */ + ScDPSaveMember* GetMemberByName(const ::rtl::OUString& rName); + + void SetMemberPosition( const ::rtl::OUString& rName, sal_Int32 nNewPos ); + + void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xDim ); + void Refresh( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource , + const std::list<rtl::OUString> & deletedDims); + + void UpdateMemberVisibility(const ::boost::unordered_map< ::rtl::OUString, bool, ::rtl::OUStringHash>& rData); + + bool HasInvisibleMember() const; +}; + + +class ScDPSaveData +{ +private: + boost::ptr_vector<ScDPSaveDimension> aDimList; + ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions + sal_uInt16 nColumnGrandMode; + sal_uInt16 nRowGrandMode; + sal_uInt16 nIgnoreEmptyMode; + sal_uInt16 nRepeatEmptyMode; + bool bFilterButton; // not passed to DataPilotSource + bool bDrillDown; // not passed to DataPilotSource + + /** if true, all dimensions already have all of their member instances + * created. */ + bool mbDimensionMembersBuilt; + + ::std::auto_ptr<rtl::OUString> mpGrandTotalName; + +public: + SC_DLLPUBLIC ScDPSaveData(); + ScDPSaveData(const ScDPSaveData& r); + SC_DLLPUBLIC ~ScDPSaveData(); + + ScDPSaveData& operator= ( const ScDPSaveData& r ); + + bool operator== ( const ScDPSaveData& r ) const; + + SC_DLLPUBLIC void SetGrandTotalName(const ::rtl::OUString& rName); + SC_DLLPUBLIC const ::rtl::OUString* GetGrandTotalName() const; + + const boost::ptr_vector<ScDPSaveDimension>& GetDimensions() const + { return aDimList; } + + void AddDimension(ScDPSaveDimension* pDim) + { aDimList.push_back(pDim); } + + /** + * Get a dimension object by its name. <i>If one doesn't exist for the + * given name, it creats a new one.</i> + * + * @param rName dimension name + * + * @return pointer to the dimension object. The ScDPSaveData instance + * manages its life cycle; hence the caller must + * <i>not</i> delete this object. + */ + ScDPSaveDimension* GetDimensionByName(const ::rtl::OUString& rName); + SC_DLLPUBLIC ScDPSaveDimension* GetDataLayoutDimension(); + SC_DLLPUBLIC ScDPSaveDimension* GetExistingDataLayoutDimension() const; + + ScDPSaveDimension* DuplicateDimension(const ::rtl::OUString& rName); + SC_DLLPUBLIC ScDPSaveDimension& DuplicateDimension(const ScDPSaveDimension& rDim); + + SC_DLLPUBLIC ScDPSaveDimension* GetExistingDimensionByName(const ::rtl::OUString& rName) const; + SC_DLLPUBLIC ScDPSaveDimension* GetNewDimensionByName(const ::rtl::OUString& rName); + + void RemoveDimensionByName(const ::rtl::OUString& rName); + + ScDPSaveDimension* GetInnermostDimension(sal_uInt16 nOrientation); + ScDPSaveDimension* GetFirstDimension(::com::sun::star::sheet::DataPilotFieldOrientation eOrientation); + long GetDataDimensionCount() const; + + void SetPosition( ScDPSaveDimension* pDim, long nNew ); + SC_DLLPUBLIC void SetColumnGrand( bool bSet ); + bool GetColumnGrand() const + { return bool(nColumnGrandMode); } + + SC_DLLPUBLIC void SetRowGrand( bool bSet ); + bool GetRowGrand() const + { return bool(nRowGrandMode); } + + void SetIgnoreEmptyRows( bool bSet ); + bool GetIgnoreEmptyRows() const + { return bool(nIgnoreEmptyMode); } + + void SetRepeatIfEmpty( bool bSet ); + bool GetRepeatIfEmpty() const + { return bool(nRepeatEmptyMode); } + + SC_DLLPUBLIC void SetFilterButton( bool bSet ); + bool GetFilterButton() const + { return bFilterButton; } + + SC_DLLPUBLIC void SetDrillDown( bool bSet ); + bool GetDrillDown() const + { return bDrillDown; } + + void WriteToSource( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource ); + void Refresh( const com::sun::star::uno::Reference<com::sun::star::sheet::XDimensionsSupplier>& xSource ); + bool IsEmpty() const; + + const ScDPDimensionSaveData* GetExistingDimensionData() const + { return pDimensionData; } + + SC_DLLPUBLIC ScDPDimensionSaveData* GetDimensionData(); // create if not there + void SetDimensionData( const ScDPDimensionSaveData* pNew ); // copied + void BuildAllDimensionMembers(ScDPTableData* pData); + + /** + * Check whether a dimension has one or more invisible members. + * + * @param rDimName dimension name + */ + SC_DLLPUBLIC bool HasInvisibleMember(const ::rtl::OUString& rDimName) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx new file mode 100644 index 000000000000..87c3ccd1ec5c --- /dev/null +++ b/sc/inc/dpsdbtab.hxx @@ -0,0 +1,95 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPSDBTAB_HXX +#define SC_DPSDBTAB_HXX + +#include <com/sun/star/uno/Reference.hxx> + +#include "dptabdat.hxx" + +#include <vector> +#include <boost/unordered_set.hpp> + +class ScDPCacheTable; +class ScDocument; + +struct ScImportSourceDesc +{ + ::rtl::OUString aDBName; + ::rtl::OUString aObject; + sal_uInt16 nType; // enum DataImportMode + bool bNative; + ScDocument* mpDoc; + + ScImportSourceDesc(ScDocument* pDoc) : nType(0), bNative(false), mpDoc(pDoc) {} + + bool operator== ( const ScImportSourceDesc& rOther ) const + { return aDBName == rOther.aDBName && + aObject == rOther.aObject && + nType == rOther.nType && + bNative == rOther.bNative && + mpDoc == rOther.mpDoc; } + + sal_Int32 GetCommandType() const; + const ScDPCache* CreateCache() const; +}; + +/** + * This class represents source data from database source. + */ +class ScDatabaseDPData : public ScDPTableData +{ +private: + const ScImportSourceDesc& mrImport; + ScDPCacheTable aCacheTable; +public: + ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport); + virtual ~ScDatabaseDPData(); + + virtual long GetColumnCount(); + virtual String getDimensionName(long nColumn); + virtual sal_Bool getIsDataLayoutDimension(long nColumn); + virtual sal_Bool IsDateDimension(long nDim); + virtual void DisposeData(); + virtual void SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty ); + + virtual void CreateCacheTable(); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims); + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::boost::unordered_set<sal_Int32>& rCatDims, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); + virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); + virtual const ScDPCacheTable& GetCacheTable() const; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx new file mode 100644 index 000000000000..505a2758ae78 --- /dev/null +++ b/sc/inc/dpshttab.hxx @@ -0,0 +1,140 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPSHTTAB_HXX +#define SC_DPSHTTAB_HXX + +#include "dptabdat.hxx" +#include "global.hxx" +#include "address.hxx" +#include "scdllapi.h" +#include "queryparam.hxx" + +#include <boost/unordered_set.hpp> +#include <vector> + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldFilter; +}}}} + +class ScDPDimension; +class ScDPItemData; + +/** + * This class contains authoritative information on the internal reference + * used as the data source for datapilot table. <i>The range name takes + * precedence over the source range when it's non-empty.</i> When the range + * name is empty, the source range gets used. + */ +class ScSheetSourceDesc +{ + ScSheetSourceDesc(); // disabled + +public: + SC_DLLPUBLIC ScSheetSourceDesc(ScDocument* pDoc); + + SC_DLLPUBLIC void SetSourceRange(const ScRange& rRange); + + /** + * Get the range that contains the source data. In case the source data + * is referred to via a range name, it returns the range that the range + * name points to. + * + * <i>Note that currently only a single range is supported; if the + * range name contains multiple ranges, only the first range is used.</i> + * + * @return source range. + */ + SC_DLLPUBLIC const ScRange& GetSourceRange() const; + SC_DLLPUBLIC void SetRangeName(const ::rtl::OUString& rName); + SC_DLLPUBLIC const ::rtl::OUString& GetRangeName() const; + bool HasRangeName() const; + void SetQueryParam(const ScQueryParam& rParam); + const ScQueryParam& GetQueryParam() const; + + bool operator== ( const ScSheetSourceDesc& rOther ) const; + SC_DLLPUBLIC const ScDPCache* CreateCache() const; + + /** + * Check the sanity of the data source range. + * + * @return 0 if the source range is sane, otherwise an error message ID is + * returned. + */ + sal_uLong CheckSourceRange() const; + long GetCacheId() const; + +private: + mutable ScRange maSourceRange; + ::rtl::OUString maRangeName; + ScQueryParam maQueryParam; + ScDocument* mpDoc; +}; + +/** + * Implementation of ScDPTableData with sheet data. + */ +class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData +{ +private: + ScQueryParam aQuery; + bool* pSpecial; + bool bIgnoreEmptyRows; + bool bRepeatIfEmpty; + + const ScSheetSourceDesc& mrDesc; + ScDPCacheTable aCacheTable; + +public: + ScSheetDPData(ScDocument* pD, const ScSheetSourceDesc& rDesc, const ScDPCache* pCache); + virtual ~ScSheetDPData(); + + virtual long GetColumnCount(); + virtual String getDimensionName(long nColumn); + virtual sal_Bool getIsDataLayoutDimension(long nColumn); + virtual sal_Bool IsDateDimension(long nDim); + virtual sal_uLong GetNumberFormat(long nDim); + virtual void DisposeData(); + virtual void SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty ); + + virtual bool IsRepeatIfEmpty(); + + virtual void CreateCacheTable(); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rCatDims); + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::boost::unordered_set<sal_Int32>& rCatDims, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData); + virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow); + virtual const ScDPCacheTable& GetCacheTable() const; +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx new file mode 100644 index 000000000000..31d32fe25706 --- /dev/null +++ b/sc/inc/dptabdat.hxx @@ -0,0 +1,192 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPTABDAT_HXX +#define SC_DPTABDAT_HXX + +#include "address.hxx" +#include "dpoutput.hxx" +#include "dpcachetable.hxx" +#include "dptablecache.hxx" +#include <tools/string.hxx> + +#include <vector> +#include <set> +#include <boost/unordered_set.hpp> +#include <boost/unordered_map.hpp> +#include <boost/noncopyable.hpp> + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldFilter; +}}}} + + +#define SC_DAPI_DATE_HIERARCHIES 3 + +#define SC_DAPI_HIERARCHY_FLAT 0 +#define SC_DAPI_HIERARCHY_QUARTER 1 +#define SC_DAPI_HIERARCHY_WEEK 2 + +#define SC_DAPI_FLAT_LEVELS 1 // single level for flat dates +#define SC_DAPI_QUARTER_LEVELS 4 // levels in year/quarter/month/day hierarchy +#define SC_DAPI_WEEK_LEVELS 3 // levels in year/week/day hierarchy + +#define SC_DAPI_LEVEL_YEAR 0 +#define SC_DAPI_LEVEL_QUARTER 1 +#define SC_DAPI_LEVEL_MONTH 2 +#define SC_DAPI_LEVEL_DAY 3 +#define SC_DAPI_LEVEL_WEEK 1 +#define SC_DAPI_LEVEL_WEEKDAY 2 + + +// +// base class ScDPTableData to allow implementation with tabular data +// by deriving only of this +// +#define SC_VALTYPE_EMPTY 0 +#define SC_VALTYPE_VALUE 1 +#define SC_VALTYPE_STRING 2 +#define SC_VALTYPE_ERROR 3 + +struct ScDPValueData +{ + double fValue; + sal_uInt8 nType; + + void Set( double fV, sal_uInt8 nT ) { fValue = fV; nType = nT; } +}; + +class ScDPResultMember; +class ScDPDimension; +class ScDPLevel; +class ScDPInitState; +class ScDPResultMember; +class ScDocument; + +/** + * Base class that abstracts different data source types of a datapilot + * table. + */ +class SC_DLLPUBLIC ScDPTableData : public ::boost::noncopyable +{ + // cached data for GetDatePart + long nLastDateVal; + long nLastHier; + long nLastLevel; + long nLastRet; + const ScDocument* mpDoc; +public: + + /** This structure stores dimension information used when calculating + results. These data are read only during result calculation, so it + should be passed as a const instance. */ + struct CalcInfo + { + ::std::vector<long> aColLevelDims; + ::std::vector<ScDPDimension*> aColDims; + ::std::vector<ScDPLevel*> aColLevels; + ::std::vector<long> aRowLevelDims; + ::std::vector<ScDPDimension*> aRowDims; + ::std::vector<ScDPLevel*> aRowLevels; + ::std::vector<long> aPageDims; + ::std::vector<long> aDataSrcCols; + + ScDPInitState* pInitState; + ScDPResultMember* pColRoot; + ScDPResultMember* pRowRoot; + + bool bRepeatIfEmpty; + + CalcInfo(); + }; + + ScDPTableData(ScDocument* pDoc); + virtual ~ScDPTableData(); + + long GetDatePart( long nDateVal, long nHierarchy, long nLevel ); + + //! use (new) typed collection instead of ScStrCollection + //! or separate Str and ValueCollection + + virtual long GetColumnCount() = 0; + virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ; + virtual String getDimensionName(long nColumn) = 0; + virtual sal_Bool getIsDataLayoutDimension(long nColumn) = 0; + virtual sal_Bool IsDateDimension(long nDim) = 0; + virtual sal_uLong GetNumberFormat(long nDim); + virtual sal_uInt32 GetNumberFormatByIdx( NfIndexTableOffset ); + virtual void DisposeData() = 0; + virtual void SetEmptyFlags( sal_Bool bIgnoreEmptyRows, sal_Bool bRepeatIfEmpty ) = 0; + + virtual bool IsRepeatIfEmpty(); + + virtual void CreateCacheTable() = 0; + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::boost::unordered_set<sal_Int32>& rDataDims) = 0; + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::boost::unordered_set<sal_Int32>& rCatDims, + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& rData) = 0; + virtual void CalcResults(CalcInfo& rInfo, bool bAutoShow) = 0; + virtual const ScDPCacheTable& GetCacheTable() const = 0; + + // overloaded in ScDPGroupTableData: + virtual sal_Bool IsBaseForGroup(long nDim) const; + virtual long GetGroupBase(long nGroupDim) const; + virtual sal_Bool IsNumOrDateGroup(long nDim) const; + virtual sal_Bool IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + virtual sal_Bool HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, + const ScDPItemData& rSecondData, long nSecondIndex ) const; + + virtual long GetMembersCount( long nDim ); + virtual const ScDPItemData* GetMemberByIndex( long nDim, long nIndex ); + virtual const ScDPItemData* GetMemberById( long nDim, long nId); + virtual SCROW GetIdOfItemData( long nDim, const ScDPItemData& rData ); + virtual long GetSourceDim( long nDim ); + virtual long Compare( long nDim, long nDataId1, long nDataId2); +protected: + /** This structure stores vector arrays that hold intermediate data for + each row during cache table iteration. */ + struct CalcRowData + { + ::std::vector< SCROW > aColData; + ::std::vector< SCROW > aRowData; + ::std::vector< SCROW > aPageData; + ::std::vector<ScDPValueData> aValues; + }; + + void FillRowDataFromCacheTable(sal_Int32 nRow, const ScDPCacheTable& rCacheTable, const CalcInfo& rInfo, CalcRowData& rData); + void ProcessRowData(CalcInfo& rInfo, CalcRowData& rData, bool bAutoShow); + void CalcResultsFromCacheTable(const ScDPCacheTable& rCacheTable, CalcInfo& rInfo, bool bAutoShow); + +private: + void GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow, + const ::std::vector<long>& rDims, ::std::vector< SCROW >& rItemData); +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx new file mode 100644 index 000000000000..4bfb14dad727 --- /dev/null +++ b/sc/inc/dptablecache.hxx @@ -0,0 +1,136 @@ +/* -*- 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 IBM Corporation 2009. + * Copyright 2009 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ +#ifndef SC_DPTABLECACHE_HXX +#define SC_DPTABLECACHE_HXX + +#include "global.hxx" +#include <svl/zforlist.hxx> +#include "dpglobal.hxx" + +#include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> + +#include <vector> +#include <boost/ptr_container/ptr_vector.hpp> + +struct ScQueryParam; + +/** + * This class represents the cached data part of the datapilot cache table + * implementation. + */ +class SC_DLLPUBLIC ScDPCache +{ +public: + typedef ::boost::ptr_vector<ScDPItemData> DataListType; +private: + typedef ::boost::ptr_vector<DataListType> DataGridType; + typedef ::boost::ptr_vector< ::std::vector<SCROW> > RowGridType; + + ScDocument* mpDoc; + long mnColumnCount; + + /** + * This container stores only the unique instances of item data in each + * column. Duplicates are not allowed. + */ + DataGridType maTableDataValues; + + /** + * This container stores indices within maTableDataValues pointing to the + * data. The order of data are exactly as they appear in the original + * data source. + */ + RowGridType maSourceData; + + /** + * This container stores indices within maTableDataValues. The order of + * indices in each column represents ascending order of the actual data. + */ + RowGridType maGlobalOrder; + + /** + * This container stores the ranks of each unique data represented by + * their index. + */ + mutable RowGridType maIndexOrder; + + DataListType maLabelNames; // Stores dimension names. + std::vector<bool> mbEmptyRow; // Keeps track of empty rows. + + mutable ScDPItemDataPool maAdditionalData; + +public: + SCROW GetIdByItemData( long nDim, const String& sItemData ) const; + SCROW GetIdByItemData( long nDim, const ScDPItemData& rData ) const; + + SCROW GetAdditionalItemID ( const String& sItemData ) const; + SCROW GetAdditionalItemID( const ScDPItemData& rData ) const; + + SCCOL GetDimensionIndex( String sName) const; + const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const; + sal_uLong GetNumType ( sal_uLong nFormat ) const; + sal_uLong GetNumberFormat( long nDim ) const; + bool IsDateDimension( long nDim ) const ; + sal_uLong GetDimNumType( SCCOL nDim) const; + SCROW GetDimMemberCount( SCCOL nDim ) const; + SCROW GetOrder( long nDim, SCROW nIndex ) const; + + SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const; + const DataListType& GetDimMemberValues( SCCOL nDim ) const; + bool InitFromDoc(ScDocument* pDoc, const ScRange& rRange); + bool InitFromDataBase(const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& xRowSet, const Date& rNullDate); + + SCROW GetRowCount() const; + SCROW GetItemDataId( sal_uInt16 nDim, SCROW nRow, bool bRepeatIfEmpty ) const; + String GetDimensionName( sal_uInt16 nColumn ) const; + bool IsEmptyMember( SCROW nRow, sal_uInt16 nColumn ) const; + bool IsRowEmpty( SCROW nRow ) const; + bool IsValid() const; + bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, bool* pSpecial ) const; + + ScDocument* GetDoc() const;//ms-cache-core + long GetColumnCount() const; + + const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const; + + bool operator== ( const ScDPCache& r ) const; + + ScDPCache(ScDocument* pDoc); + ~ScDPCache(); + +private: + void AddLabel( ScDPItemData* pData); + bool AddData(long nDim, ScDPItemData* pData); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx new file mode 100644 index 000000000000..4e6c6eddd060 --- /dev/null +++ b/sc/inc/dptabres.hxx @@ -0,0 +1,681 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPTABRES_HXX +#define SC_DPTABRES_HXX + +#include <svl/svarray.hxx> +#include <tools/string.hxx> +#include <com/sun/star/sheet/MemberResult.hpp> +#include <com/sun/star/sheet/DataResult.hpp> +#include <com/sun/star/uno/Sequence.hxx> +#include "global.hxx" // enum ScSubTotalFunc +#include "dpcachetable.hxx" +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> +#include <vector> +#include <memory> + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldReference; +} } } } + + +class ScAddress; +class ScDocument; +class ScDPSource; +class ScDPDimension; +class ScDPDimensions; +class ScDPLevel; +class ScDPMember; +class ScDPAggData; +class ScDPResultMember; +class ScDPResultVisibilityData; + +struct ScDPValueData; +class ScDPItemData; +// +// Member names that are being processed for InitFrom/LateInitFrom +// (needed for initialization of grouped items) +// + +class ScDPInitState +{ + long* pIndex; // array + SCROW* pData; // array + long nCount; + +public: + ScDPInitState(); + ~ScDPInitState(); + + void AddMember( long nSourceIndex,SCROW nMember); + void RemoveMember(); + + long GetCount() const { return nCount; } + const long* GetSource() const { return pIndex; } + const SCROW* GetNameIds() const { return pData; } + SCROW GetNameIdForIndex( long nIndexValue ) const; +}; + +typedef ::std::vector<sal_Int32> ScMemberSortOrder; + +// +// selected subtotal information, passed down the dimensions +// + +struct ScDPSubTotalState +{ + ScSubTotalFunc eColForce; + ScSubTotalFunc eRowForce; + long nColSubTotalFunc; + long nRowSubTotalFunc; + + ScDPSubTotalState() : + eColForce( SUBTOTAL_FUNC_NONE ), + eRowForce( SUBTOTAL_FUNC_NONE ), + nColSubTotalFunc( -1 ), + nRowSubTotalFunc( -1 ) + {} +}; + +// +// indexes when calculating running totals +// Col/RowVisible: simple counts from 0 - without sort order applied - visible index +// (only used for running total / relative index) +// Col/RowIndexes: with sort order applied - member index +// (used otherwise - so other members' children can be accessed) +// + +class ScDPRunningTotalState +{ + ScDPResultMember* pColResRoot; + ScDPResultMember* pRowResRoot; + long* pColVisible; + long* pColIndexes; + long* pRowVisible; + long* pRowIndexes; + long nColIndexPos; + long nRowIndexPos; + +public: + ScDPRunningTotalState( ScDPResultMember* pColRoot, ScDPResultMember* pRowRoot ); + ~ScDPRunningTotalState(); + + ScDPResultMember* GetColResRoot() const { return pColResRoot; } + ScDPResultMember* GetRowResRoot() const { return pRowResRoot; } + + const long* GetColVisible() const { return pColVisible; } + const long* GetColIndexes() const { return pColIndexes; } + const long* GetRowVisible() const { return pRowVisible; } + const long* GetRowIndexes() const { return pRowIndexes; } + + void AddColIndex( long nVisible, long nSorted ); + void AddRowIndex( long nVisible, long nSorted ); + void RemoveColIndex(); + void RemoveRowIndex(); +}; + +struct ScDPRelativePos +{ + long nBasePos; // simple count, without sort order applied + long nDirection; + + ScDPRelativePos( long nBase, long nDir ); +}; + +// +// aggregated data +//! separate header file? +// + +// Possible values for the nCount member: +// (greater than 0 counts the collected values) +const long SC_DPAGG_EMPTY = 0; // empty during data collection +const long SC_DPAGG_DATA_ERROR = -1; // error during data collection +const long SC_DPAGG_RESULT_EMPTY = -2; // empty result calculated +const long SC_DPAGG_RESULT_VALID = -3; // valid result calculated +const long SC_DPAGG_RESULT_ERROR = -4; // error in calculated result + +class ScDPAggData +{ +private: + double fVal; + double fAux; + long nCount; + ScDPAggData* pChild; + +public: + ScDPAggData() : fVal(0.0), fAux(0.0), nCount(SC_DPAGG_EMPTY), pChild(NULL) {} + ~ScDPAggData() { delete pChild; } + + void Update( const ScDPValueData& rNext, ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState ); + void Calculate( ScSubTotalFunc eFunc, const ScDPSubTotalState& rSubState ); + sal_Bool IsCalculated() const; + + double GetResult() const; + sal_Bool HasError() const; + sal_Bool HasData() const; + + void SetResult( double fNew ); + void SetEmpty( sal_Bool bSet ); + void SetError(); + + double GetAuxiliary() const; + void SetAuxiliary( double fNew ); + + void Reset(); // also deletes children + + const ScDPAggData* GetExistingChild() const { return pChild; } + ScDPAggData* GetChild(); +}; + +// +// Row and grand total state, passed down (column total is at result member) +// + +class ScDPRowTotals +{ + ScDPAggData aRowTotal; + ScDPAggData aGrandTotal; + sal_Bool bIsInColRoot; + +public: + ScDPRowTotals(); + ~ScDPRowTotals(); + + ScDPAggData* GetRowTotal( long nMeasure ); + ScDPAggData* GetGrandTotal( long nMeasure ); + + sal_Bool IsInColRoot() const { return bIsInColRoot; } + void SetInColRoot(sal_Bool bSet) { bIsInColRoot = bSet; } +}; + +// -------------------------------------------------------------------- +// +// results for a hierarchy dimension +// + +#define SC_DP_RES_GROW 16 + +class ScDPResultDimension; +class ScDPDataDimension; +class ScDPDataMember; + +#define SC_DPMEASURE_ALL -1 +#define SC_DPMEASURE_ANY -2 + +struct MemberHashIndexFunc : public std::unary_function< const SCROW &, size_t > +{ + size_t operator() (const SCROW &rDataIndex) const { return rDataIndex; } +}; + +class ScDPParentDimData +{ +public: + const SCROW mnOrder; //! Ref + const ScDPDimension* mpParentDim; //! Ref + const ScDPLevel* mpParentLevel; //! Ref + const ScDPMember* mpMemberDesc; //! Ref + + ScDPParentDimData():mnOrder(-1), mpParentDim( NULL), mpParentLevel( NULL ), mpMemberDesc( NULL ){} + ScDPParentDimData( const SCROW nIndex, ScDPDimension* pDim, const ScDPLevel* pLev, const ScDPMember* pMember ): mnOrder( nIndex ), mpParentDim( pDim), mpParentLevel( pLev ), mpMemberDesc( pMember ){} +}; + +typedef std::vector <ScDPParentDimData *> DimMemberArray; +typedef boost::unordered_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash; + +class ResultMembers +{ + DimMemberHash maMemberHash; + sal_Bool mbHasHideDetailsMember; +public: + ScDPParentDimData* FindMember( const SCROW& nIndex ) const; + void InsertMember( ScDPParentDimData* pNew ); + sal_Bool IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; } + void SetHasHideDetailsMembers( sal_Bool b ) { mbHasHideDetailsMember=b; } + ResultMembers(); + virtual ~ResultMembers(); +}; + +class LateInitParams +{ +private: + const ::std::vector<ScDPDimension*>& mppDim; + const ::std::vector<ScDPLevel*>& mppLev; + + sal_Bool mbRow; + sal_Bool mbInitChild; + sal_Bool mbAllChildren; +public: + LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev, + sal_Bool bRow, sal_Bool bInitChild = sal_True , sal_Bool bAllChildren = false); + ~LateInitParams(); + + void SetInitChild( sal_Bool b ) { mbInitChild = b; } + void SetInitAllChildren( sal_Bool b ) { mbAllChildren = b; } + + inline ScDPDimension* GetDim( size_t nPos ) const { return mppDim[nPos];} + inline ScDPLevel* GetLevel( size_t nPos ) const { return mppLev[nPos];} + + inline sal_Bool GetInitChild() const {return mbInitChild; } + inline sal_Bool GetInitAllChild() const { return mbAllChildren; } + inline sal_Bool IsRow() const { return mbRow; } + sal_Bool IsEnd( size_t nPos ) const ; +}; + +class ScDPResultData +{ +private: + ScDPSource* pSource; //! Ref + //! keep things like measure lists here + + long nMeasCount; + ScSubTotalFunc* pMeasFuncs; + ::com::sun::star::sheet::DataPilotFieldReference* pMeasRefs; + sal_uInt16* pMeasRefOrient; + String* pMeasNames; + sal_Bool bLateInit; + sal_Bool bDataAtCol; + sal_Bool bDataAtRow; + + //! add "displayed values" settings + mutable std::vector< ResultMembers* > mpDimMembers; +public: + ScDPResultData( ScDPSource* pSrc ); //! Ref + ~ScDPResultData(); + + void SetMeasureData( long nCount, const ScSubTotalFunc* pFunctions, + const ::com::sun::star::sheet::DataPilotFieldReference* pRefs, + const sal_uInt16* pRefOrient, const String* pNames ); + void SetDataLayoutOrientation( sal_uInt16 nOrient ); + void SetLateInit( sal_Bool bSet ); + + long GetMeasureCount() const { return nMeasCount; } + ScSubTotalFunc GetMeasureFunction(long nMeasure) const; + String GetMeasureString(long nMeasure, sal_Bool bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const; + String GetMeasureDimensionName(long nMeasure) const; + const ::com::sun::star::sheet::DataPilotFieldReference& GetMeasureRefVal(long nMeasure) const; + sal_uInt16 GetMeasureRefOrient(long nMeasure) const; + + sal_Bool IsDataAtCol() const { return bDataAtCol; } + sal_Bool IsDataAtRow() const { return bDataAtRow; } + sal_Bool IsLateInit() const { return bLateInit; } + + long GetColStartMeasure() const; + long GetRowStartMeasure() const; + + long GetCountForMeasure( long nMeas ) const + { return ( nMeas == SC_DPMEASURE_ALL ) ? nMeasCount : 1; } + + sal_Bool IsBaseForGroup( long nDim ) const; // any group + long GetGroupBase( long nGroupDim ) const; + sal_Bool IsNumOrDateGroup( long nDim ) const; + sal_Bool IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, + long nBaseDataId, long nBaseIndex ) const; + sal_Bool IsInGroup( SCROW nGroupDataId, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + sal_Bool HasCommonElement( SCROW nFirstDataId, long nFirstIndex, + const ScDPItemData& rSecondData, long nSecondIndex ) const; + + ResultMembers* GetDimResultMembers( long nDim , ScDPDimension* pDim , ScDPLevel* pLevel) const ; + + const ScDPSource* GetSource() const; +}; + + +class ScDPResultMember +{ +private: + const ScDPResultData* pResultData; + ScDPParentDimData aParentDimData; + ScDPResultDimension* pChildDimension; + ScDPDataMember* pDataRoot; + sal_Bool bHasElements; + sal_Bool bForceSubTotal; + sal_Bool bHasHiddenDetails; + sal_Bool bInitialized; + sal_Bool bAutoHidden; + ScDPAggData aColTotal; // to store column totals + + sal_uInt16 nMemberStep; // step to show details +public: + ScDPResultMember( const ScDPResultData* pData, const ScDPParentDimData& rParentDimData, + sal_Bool bForceSub ); //! Ref + ScDPResultMember( const ScDPResultData* pData, sal_Bool bForceSub ); + ~ScDPResultMember(); + + void InitFrom( const ::std::vector<ScDPDimension*>& ppDim, + const ::std::vector<ScDPLevel*>& ppLev, + size_t nPos, + ScDPInitState& rInitState, + sal_Bool bInitChild = sal_True ); + void LateInitFrom( + LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState); + void CheckShowEmpty( sal_Bool bShow = false ); + String GetName() const; + void FillItemData( ScDPItemData& rData ) const; + sal_Bool IsValid() const; + sal_Bool IsVisible() const; + long GetSize(long nMeasure) const; + sal_Bool HasHiddenDetails() const; + sal_Bool IsSubTotalInTitle(long nMeasure) const; + + long GetSubTotalCount( long* pUserSubStart = NULL ) const; + + sal_Bool IsNamedItem( SCROW nIndex ) const; + bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const; + + void SetHasElements() { bHasElements = sal_True; } + void SetAutoHidden() { bAutoHidden = sal_True; } + + void ProcessData( const ::std::vector<SCROW>& aChildMembers, + const ScDPResultDimension* pDataDim, + const ::std::vector<SCROW>& aDataMembers, + const ::std::vector<ScDPValueData>& aValues ); + void FillMemberResults( com::sun::star::uno::Sequence< + com::sun::star::sheet::MemberResult>* pSequences, + long& rPos, long nMeasure, sal_Bool bRoot, + const String* pMemberName, + const String* pMemberCaption ); + + void FillDataResults( const ScDPResultMember* pRefMember, + com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::sheet::DataResult> >& rSequence, + long& rRow, long nMeasure ) const; + + void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const; + void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, + ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const; + + void SortMembers( ScDPResultMember* pRefMember ); + void DoAutoShow( ScDPResultMember* pRefMember ); + + void ResetResults( sal_Bool bRoot ); + + void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; + + //! this will be removed! + const ScDPResultDimension* GetChildDimension() const { return pChildDimension; } + ScDPResultDimension* GetChildDimension() { return pChildDimension; } + + ScDPDataMember* GetDataRoot() const { return pDataRoot; } + + const ScDPDimension* GetParentDim() const { return aParentDimData.mpParentDim; } //! Ref + const ScDPLevel* GetParentLevel() const { return aParentDimData.mpParentLevel; } //! Ref + const ScDPMember* GetDPMember()const { return aParentDimData.mpMemberDesc; } //! Ref + inline SCROW GetOrder() const { return aParentDimData.mnOrder; } //! Ref + inline sal_Bool IsRoot() const { return GetParentLevel() == NULL; } + SCROW GetDataId( ) const ; + ScDPAggData* GetColTotal( long nMeasure ) const; + + void FillVisibilityData(ScDPResultVisibilityData& rData) const; +}; + +class ScDPDataMember +{ +private: + const ScDPResultData* pResultData; + const ScDPResultMember* pResultMember; //! Ref? + ScDPDataDimension* pChildDimension; + ScDPAggData aAggregate; + + void UpdateValues( const ::std::vector<ScDPValueData>& aValues, const ScDPSubTotalState& rSubState ); + +public: + ScDPDataMember( const ScDPResultData* pData, const ScDPResultMember* pRes ); + ~ScDPDataMember(); + + void InitFrom( const ScDPResultDimension* pDim ); + + String GetName() const; + sal_Bool IsVisible() const; + sal_Bool HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const; + + sal_Bool IsNamedItem( SCROW r ) const; + sal_Bool HasHiddenDetails() const; + + void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValueData>& aValues, + const ScDPSubTotalState& rSubState ); + sal_Bool HasError( long nMeasure, const ScDPSubTotalState& rSubState ) const; + double GetAggregate( long nMeasure, const ScDPSubTotalState& rSubState ) const; + const ScDPAggData* GetConstAggData( long nMeasure, const ScDPSubTotalState& rSubState ) const; + ScDPAggData* GetAggData( long nMeasure, const ScDPSubTotalState& rSubState ); + + void FillDataRow( const ScDPResultMember* pRefMember, + com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence, + long& rCol, long nMeasure, sal_Bool bIsSubTotalRow, + const ScDPSubTotalState& rSubState ) const; + + void UpdateDataRow( const ScDPResultMember* pRefMember, long nMeasure, sal_Bool bIsSubTotalRow, + const ScDPSubTotalState& rSubState ); + void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, sal_Bool bIsSubTotalRow, + const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning, + ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ); + + void SortMembers( ScDPResultMember* pRefMember ); + void DoAutoShow( ScDPResultMember* pRefMember ); + + void ResetResults(); + + void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; + + //! this will be removed! + const ScDPDataDimension* GetChildDimension() const { return pChildDimension; } + ScDPDataDimension* GetChildDimension() { return pChildDimension; } +}; + +//! replace PtrArr with 32-bit array ???? + +typedef ScDPDataMember* ScDPDataMemberPtr; +SV_DECL_PTRARR_DEL(ScDPDataMembers, ScDPDataMemberPtr, SC_DP_RES_GROW, SC_DP_RES_GROW) + + +// result dimension contains only members + +class ScDPResultDimension +{ +public : + typedef std::vector <ScDPResultMember *> MemberArray; + typedef std::map < SCROW , ScDPResultMember *> MemberHash; +private: + const ScDPResultData* pResultData; + MemberArray maMemberArray; + MemberHash maMemberHash; + sal_Bool bInitialized; + String aDimensionName; //! or ptr to IntDimension? + sal_Bool bIsDataLayout; //! or ptr to IntDimension? + sal_Bool bSortByData; + sal_Bool bSortAscending; + long nSortMeasure; + ScMemberSortOrder aMemberOrder; // used when sorted by measure + sal_Bool bAutoShow; + sal_Bool bAutoTopItems; + long nAutoMeasure; + long nAutoCount; + + ScDPResultMember* FindMember( SCROW iData ) const; + ScDPResultMember* AddMember( const ScDPParentDimData& aData ); + ScDPResultMember* InsertMember( ScDPParentDimData* pMemberData ); + void InitWithMembers( LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState ); +public: + ScDPResultDimension( const ScDPResultData* pData ); + ~ScDPResultDimension(); + + // allocates new members + void InitFrom( const ::std::vector<ScDPDimension*>& ppDim, + const ::std::vector<ScDPLevel*>& ppLev, + size_t nPos, + ScDPInitState& rInitState , sal_Bool bInitChild = sal_True ); + void LateInitFrom( LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState ); + void CheckShowEmpty( sal_Bool bShow = false ); + + long GetSize(long nMeasure) const; + + bool IsValidEntry( const ::std::vector<SCROW>& aMembers ) const; + + // modifies existing members, allocates data dimensions + void ProcessData( const ::std::vector<SCROW>& aMembers, + const ScDPResultDimension* pDataDim, + const ::std::vector<SCROW>& aDataMembers, + const ::std::vector<ScDPValueData>& aValues ) const; //! Test + void FillMemberResults( com::sun::star::uno::Sequence< + com::sun::star::sheet::MemberResult>* pSequences, + long nStart, long nMeasure ); + + void FillDataResults( const ScDPResultMember* pRefMember, + com::sun::star::uno::Sequence< + com::sun::star::uno::Sequence< + com::sun::star::sheet::DataResult> >& rSequence, + long nRow, long nMeasure ) const; + + void UpdateDataResults( const ScDPResultMember* pRefMember, long nMeasure ) const; + void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, + ScDPRunningTotalState& rRunning, ScDPRowTotals& rTotals ) const; + + void SortMembers( ScDPResultMember* pRefMember ); + long GetSortedIndex( long nUnsorted ) const; + + void DoAutoShow( ScDPResultMember* pRefMember ); + + void ResetResults(); + + // called for the reference dimension + ScDPDataMember* GetRowReferenceMember( const ScDPRelativePos* pMemberPos, const String* pName, + const long* pRowIndexes, const long* pColIndexes ) const; + + // uses row root member from ScDPRunningTotalState + static ScDPDataMember* GetColReferenceMember( const ScDPRelativePos* pMemberPos, const String* pName, + long nRefDimPos, const ScDPRunningTotalState& rRunning ); + + void DumpState( const ScDPResultMember* pRefMember, ScDocument* pDoc, ScAddress& rPos ) const; + + // for ScDPDataDimension::InitFrom + long GetMemberCount() const; + const ScDPResultMember* GetMember(long n) const; + ScDPResultMember* GetMember(long n); + + const ScMemberSortOrder& GetMemberOrder() const { return aMemberOrder; } + ScMemberSortOrder& GetMemberOrder() { return aMemberOrder; } + + sal_Bool IsDataLayout() const { return bIsDataLayout; } + String GetName() const { return aDimensionName; } + + sal_Bool IsSortByData() const { return bSortByData; } + sal_Bool IsSortAscending() const { return bSortAscending; } + long GetSortMeasure() const { return nSortMeasure; } + + sal_Bool IsAutoShow() const { return bAutoShow; } + sal_Bool IsAutoTopItems() const { return bAutoTopItems; } + long GetAutoMeasure() const { return nAutoMeasure; } + long GetAutoCount() const { return nAutoCount; } + + ScDPResultDimension* GetFirstChildDimension() const; + + void FillVisibilityData(ScDPResultVisibilityData& rData) const; +}; + +class ScDPDataDimension +{ +private: + const ScDPResultData* pResultData; + const ScDPResultDimension* pResultDimension; // column + ScDPDataMembers aMembers; + sal_Bool bIsDataLayout; //! or ptr to IntDimension? + +public: + ScDPDataDimension( const ScDPResultData* pData ); + ~ScDPDataDimension(); + + void InitFrom( const ScDPResultDimension* pDim ); // recursive + void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValueData>& aValues, + const ScDPSubTotalState& rSubState ); + void FillDataRow( const ScDPResultDimension* pRefDim, + com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence, + long nCol, long nMeasure, sal_Bool bIsSubTotalRow, + const ScDPSubTotalState& rSubState ) const; + + void UpdateDataRow( const ScDPResultDimension* pRefDim, long nMeasure, sal_Bool bIsSubTotalRow, + const ScDPSubTotalState& rSubState ) const; + void UpdateRunningTotals( const ScDPResultDimension* pRefDim, long nMeasure, sal_Bool bIsSubTotalRow, + const ScDPSubTotalState& rSubState, ScDPRunningTotalState& rRunning, + ScDPRowTotals& rTotals, const ScDPResultMember& rRowParent ) const; + + void SortMembers( ScDPResultDimension* pRefDim ); + long GetSortedIndex( long nUnsorted ) const; + + void DoAutoShow( ScDPResultDimension* pRefDim ); + + void ResetResults(); + + void DumpState( const ScDPResultDimension* pRefDim, ScDocument* pDoc, ScAddress& rPos ) const; + + long GetMemberCount() const; + ScDPDataMember* GetMember(long n) const; +}; + +// ---------------------------------------------------------------------------- + +/** + * This class collects visible members of each dimension and uses that + * information to create filtering criteria (e.g. for drill-down data). + */ +class ScDPResultVisibilityData +{ +public: + ScDPResultVisibilityData( ScDPSource* pSource); + ~ScDPResultVisibilityData(); + + void addVisibleMember(const String& rDimName, const ScDPItemData& rMemberItem); + void fillFieldFilters(::std::vector<ScDPCacheTable::Criterion>& rFilters) const; + +private: + struct MemberHash + { + size_t operator()(const ScDPItemData& r) const; + }; + typedef ::boost::unordered_set<ScDPItemData, MemberHash> VisibleMemberType; + typedef ::boost::unordered_map<String, VisibleMemberType, ScStringHashCode> DimMemberType; + DimMemberType maDimensions; + + ScDPSource* mpSource; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx new file mode 100644 index 000000000000..c19bdfaf426f --- /dev/null +++ b/sc/inc/dptabsrc.hxx @@ -0,0 +1,838 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DPTABSRC_HXX +#define SC_DPTABSRC_HXX + +#include <vector> +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> +#include <list> +#include <memory> + +#include <tools/string.hxx> +#include "global.hxx" // enum ScSubTotalFunc +#include <com/sun/star/sheet/XDimensionsSupplier.hpp> +#include <com/sun/star/sheet/XHierarchiesSupplier.hpp> +#include <com/sun/star/sheet/XLevelsSupplier.hpp> +#include <com/sun/star/sheet/XMembersSupplier.hpp> +#include <com/sun/star/sheet/XDataPilotResults.hpp> +#include <com/sun/star/sheet/XDataPilotMemberResults.hpp> +#include <com/sun/star/sheet/MemberResult.hpp> +#include <com/sun/star/sheet/GeneralFunction.hpp> +#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldLayoutMode.hpp> +#include <com/sun/star/sheet/DataPilotFieldReference.hpp> +#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/sheet/XDrillDownDataSupplier.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase6.hxx> +#include "dpglobal.hxx" +#include "dptabdat.hxx" + +namespace com { namespace sun { namespace star { + namespace sheet { + struct DataPilotFieldFilter; + } + namespace table { + struct CellAddress; + } +}}} + +class ScDPResultMember; +class ScDPResultData; +class ScDPItemData; +class ScDPTableData; + +// should be dynamic! +#define SC_DAPI_MAXFIELDS 256 + + +// +// implementation of DataPilotSource using ScDPTableData +// + + +class ScDPDimensions; +class ScDPDimension; +class ScDPHierarchies; +class ScDPHierarchy; +class ScDPLevels; +class ScDPLevel; +class ScDPMembers; +class ScDPMember; + + +class ScDPSource : public cppu::WeakImplHelper6< + com::sun::star::sheet::XDimensionsSupplier, + com::sun::star::sheet::XDataPilotResults, + com::sun::star::util::XRefreshable, + com::sun::star::sheet::XDrillDownDataSupplier, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPTableData* pData; // data source (ScDPObject manages its life time) + ScDPDimensions* pDimensions; // api objects + // settings: + long nColDims[SC_DAPI_MAXFIELDS]; + long nRowDims[SC_DAPI_MAXFIELDS]; + long nDataDims[SC_DAPI_MAXFIELDS]; + long nPageDims[SC_DAPI_MAXFIELDS]; + long nColDimCount; + long nRowDimCount; + long nDataDimCount; + long nPageDimCount; + sal_Bool bColumnGrand; + sal_Bool bRowGrand; + sal_Bool bIgnoreEmptyRows; + sal_Bool bRepeatIfEmpty; + + long nDupCount; + + // results: + ScDPResultData* pResData; // keep the rest in this! + ScDPResultMember* pColResRoot; + ScDPResultMember* pRowResRoot; + com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pColResults; + com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* pRowResults; + std::vector<ScDPLevel*> aColLevelList; + std::vector<ScDPLevel*> aRowLevelList; + sal_Bool bResultOverflow; + + ::std::auto_ptr<rtl::OUString> mpGrandTotalName; + + void CreateRes_Impl(); + void FillMemberResults(); + void FillLevelList( sal_uInt16 nOrientation, std::vector<ScDPLevel*> &rList ); + void FillCalcInfo(bool bIsRow, ScDPTableData::CalcInfo& rInfo, bool &bHasAutoShow); + + /** + * Compile a list of dimension indices that are either, column, row or + * page dimensions (i.e. all but data dimensions). + */ + void GetCategoryDimensionIndices(::boost::unordered_set<sal_Int32>& rCatDims); + + /** + * Set visibilities of individual rows in the cache table based on the + * page field data. + */ + void FilterCacheTableByPageDimensions(); + + void SetDupCount( long nNew ); + +public: + ScDPSource( ScDPTableData* pD ); + virtual ~ScDPSource(); + + ScDPTableData* GetData() { return pData; } + const ScDPTableData* GetData() const { return pData; } + + const ::rtl::OUString* GetGrandTotalName() const; + + sal_uInt16 GetOrientation(long nColumn); + void SetOrientation(long nColumn, sal_uInt16 nNew); + long GetPosition(long nColumn); + + long GetDataDimensionCount(); + ScDPDimension* GetDataDimension(long nIndex); + String GetDataDimName(long nIndex); + const ScDPCache* GetCache(); + const ScDPItemData* GetItemDataById( long nDim, long nId ); + long GetDataLayoutDim(){ return pData->GetColumnCount(); } + SCROW GetMemberId( long nDim, const ScDPItemData& rData ); + sal_Bool IsDataLayoutDimension(long nDim); + sal_uInt16 GetDataLayoutOrientation(); + + sal_Bool IsDateDimension(long nDim); + + sal_Bool SubTotalAllowed(long nColumn); //! move to ScDPResultData + + ScDPDimension* AddDuplicated(long nSource, const String& rNewName); + long GetDupCount() const { return nDupCount; } + + long GetSourceDim(long nDim); + + const com::sun::star::uno::Sequence<com::sun::star::sheet::MemberResult>* + GetMemberResults( ScDPLevel* pLevel ); + + ScDPDimensions* GetDimensionsObject(); + + // XDimensionsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > + SAL_CALL getDimensions( ) + throw(::com::sun::star::uno::RuntimeException); + + // XDataPilotResults + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::DataResult > > SAL_CALL getResults( ) + throw(::com::sun::star::uno::RuntimeException); + + // XRefreshable + virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + + // XDrillDownDataSupplier + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > + SAL_CALL getDrillDownData(const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::DataPilotFieldFilter >& aFilters ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual String getDataDescription(); //! ??? + + virtual sal_Bool getColumnGrand() const; + virtual void setColumnGrand(sal_Bool bSet); + virtual sal_Bool getRowGrand() const; + virtual void setRowGrand(sal_Bool bSet); + + virtual sal_Bool getIgnoreEmptyRows() const; + virtual void setIgnoreEmptyRows(sal_Bool bSet); + virtual sal_Bool getRepeatIfEmpty() const; + virtual void setRepeatIfEmpty(sal_Bool bSet); + + virtual void validate(); //! ??? + virtual void disposeData(); +}; + +class ScDPDimensions : public cppu::WeakImplHelper2< + com::sun::star::container::XNameAccess, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDimCount; + ScDPDimension** ppDims; + +public: + ScDPDimensions( ScDPSource* pSrc ); + virtual ~ScDPDimensions(); + + void CountChanged(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual long getCount() const; + virtual ScDPDimension* getByIndex(long nIndex) const; +}; + +class ScDPDimension : public cppu::WeakImplHelper5< + com::sun::star::sheet::XHierarchiesSupplier, + com::sun::star::container::XNamed, + com::sun::star::util::XCloneable, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; // dimension index (== column ID) + ScDPHierarchies* pHierarchies; + long nUsedHier; + sal_uInt16 nFunction; // enum GeneralFunction + String aName; // if empty, take from source + ::std::auto_ptr<rtl::OUString> mpLayoutName; + ::std::auto_ptr<rtl::OUString> mpSubtotalName; + long nSourceDim; // >=0 if dup'ed + ::com::sun::star::sheet::DataPilotFieldReference + aReferenceValue; // settings for "show data as" / "displayed value" + sal_Bool bHasSelectedPage; + String aSelectedPage; + ScDPItemData* pSelectedData; // internal, temporary, created from aSelectedPage + sal_Bool mbHasHiddenMember; + +public: + ScDPDimension( ScDPSource* pSrc, long nD ); + virtual ~ScDPDimension(); + + long GetDimension() const { return nDim; } // dimension index in source + long GetSourceDim() const { return nSourceDim; } // >=0 if dup'ed + + ScDPDimension* CreateCloneObject(); + ScDPHierarchies* GetHierarchiesObject(); + + SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const; + const ::rtl::OUString* GetSubtotalName() const; + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XHierarchiesSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getHierarchies() throw(::com::sun::star::uno::RuntimeException); + + // XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL + createClone() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual sal_uInt16 getOrientation() const; + virtual void setOrientation(sal_uInt16 nNew); + virtual long getPosition() const; + virtual void setPosition(long nNew); + virtual sal_Bool getIsDataLayoutDimension() const; + virtual sal_uInt16 getFunction() const; + virtual void setFunction(sal_uInt16 nNew); // for data dimension + virtual long getUsedHierarchy() const; + virtual void setUsedHierarchy(long nNew); + virtual sal_Bool isDuplicated() const; + + sal_Bool HasSelectedPage() const { return bHasSelectedPage; } + const ScDPItemData& GetSelectedData(); + + const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const; +}; + +class ScDPHierarchies : public cppu::WeakImplHelper2< + com::sun::star::container::XNameAccess, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; + long nHierCount; + ScDPHierarchy** ppHiers; + +public: + ScDPHierarchies( ScDPSource* pSrc, long nD ); + virtual ~ScDPHierarchies(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual long getCount() const; + virtual ScDPHierarchy* getByIndex(long nIndex) const; +}; + +class ScDPHierarchy : public cppu::WeakImplHelper3< + com::sun::star::sheet::XLevelsSupplier, + com::sun::star::container::XNamed, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; + long nHier; + ScDPLevels* pLevels; + +public: + ScDPHierarchy( ScDPSource* pSrc, long nD, long nH ); + virtual ~ScDPHierarchy(); + + ScDPLevels* GetLevelsObject(); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XLevelsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getLevels() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +class ScDPLevels : public cppu::WeakImplHelper2< + com::sun::star::container::XNameAccess, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; + long nHier; + long nLevCount; + ScDPLevel** ppLevs; + +public: + ScDPLevels( ScDPSource* pSrc, long nD, long nH ); + virtual ~ScDPLevels(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual long getCount() const; + virtual ScDPLevel* getByIndex(long nIndex) const; +}; + +class ScDPLevel : public cppu::WeakImplHelper5< + com::sun::star::sheet::XMembersSupplier, + com::sun::star::container::XNamed, + com::sun::star::sheet::XDataPilotMemberResults, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; + long nHier; + long nLev; + ScDPMembers* pMembers; + com::sun::star::uno::Sequence<com::sun::star::sheet::GeneralFunction> aSubTotals; + sal_Bool bShowEmpty; + ::com::sun::star::sheet::DataPilotFieldSortInfo aSortInfo; // stored user settings + ::com::sun::star::sheet::DataPilotFieldAutoShowInfo aAutoShowInfo; // stored user settings + ::com::sun::star::sheet::DataPilotFieldLayoutInfo aLayoutInfo; // stored user settings + // valid only from result calculation: + ::std::vector<sal_Int32> aGlobalOrder; // result of sorting by name or position + long nSortMeasure; // measure (index of data dimension) to sort by + long nAutoMeasure; // measure (index of data dimension) for AutoShow + sal_Bool bEnableLayout; // enabled only for row fields, not for the innermost one + +public: + ScDPLevel( ScDPSource* pSrc, long nD, long nH, long nL ); + virtual ~ScDPLevel(); + + ScDPMembers* GetMembersObject(); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XMembersSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getMembers() throw(::com::sun::star::uno::RuntimeException); + + // XDataPilotMemberResults + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::MemberResult > SAL_CALL + getResults() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual com::sun::star::uno::Sequence<com::sun::star::sheet::GeneralFunction> getSubTotals() const; + virtual void setSubTotals(const com::sun::star::uno::Sequence< + com::sun::star::sheet::GeneralFunction>& rNew); + virtual sal_Bool getShowEmpty() const; + virtual void setShowEmpty(sal_Bool bSet); + + const ::com::sun::star::sheet::DataPilotFieldSortInfo& GetSortInfo() const { return aSortInfo; } + const ::com::sun::star::sheet::DataPilotFieldAutoShowInfo& GetAutoShow() const { return aAutoShowInfo; } + + void EvaluateSortOrder(); + void SetEnableLayout( sal_Bool bSet ); + + const ::std::vector<sal_Int32>& GetGlobalOrder() const { return aGlobalOrder; } + ::std::vector<sal_Int32>& GetGlobalOrder() { return aGlobalOrder; } + long GetSortMeasure() const { return nSortMeasure; } + long GetAutoMeasure() const { return nAutoMeasure; } + + sal_Bool IsOutlineLayout() const + { return bEnableLayout && + aLayoutInfo.LayoutMode != + ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT; } + + sal_Bool IsSubtotalsAtTop() const + { return bEnableLayout && + aLayoutInfo.LayoutMode == + ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP; } + + sal_Bool IsAddEmpty() const { return bEnableLayout && aLayoutInfo.AddEmptyLines; } + + //! number format (for data fields and date fields) +}; + +// hash map from name to index in the member array, for fast name access +typedef ::boost::unordered_map< ::rtl::OUString, sal_Int32, ::rtl::OUStringHash > ScDPMembersHashMap; + +class ScDPMembers : public cppu::WeakImplHelper2< + com::sun::star::container::XNameAccess, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; + long nHier; + long nLev; + long nMbrCount; + ScDPMember** ppMbrs; + mutable ScDPMembersHashMap aHashMap; + +public: + ScDPMembers( ScDPSource* pSrc, long nD, long nH, long nL ); + virtual ~ScDPMembers(); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual long getCount() const; + virtual ScDPMember* getByIndex(long nIndex) const; + + long getMinMembers() const; + + sal_Int32 GetIndexFromName( const ::rtl::OUString& rName ) const; // <0 if not found + const std::vector<sal_Int32>& GetGlobalOrder(); + const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex); + SCROW GetSrcItemsCount(); +}; + +class ScDPMember : public cppu::WeakImplHelper3< + com::sun::star::container::XNamed, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo > +{ +private: + ScDPSource* pSource; + long nDim; + long nHier; + long nLev; + + SCROW mnDataId; +// String aCaption; // visible name (changeable by user) + ::std::auto_ptr<rtl::OUString> mpLayoutName; + + sal_Int32 nPosition; // manual sorting + sal_Bool bVisible; + sal_Bool bShowDet; + +public: + ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL, + SCROW nIndex /*const String& rN, double fV, BOOL bHV */); + virtual ~ScDPMember(); + + String GetNameStr() const; + void FillItemData( ScDPItemData& rData ) const; + const ScDPItemData& GetItemData() const; + inline SCROW GetItemDataId() const { return mnDataId; } + sal_Bool IsNamedItem( SCROW nIndex ) const; + + SC_DLLPUBLIC const ::rtl::OUString* GetLayoutName() const; + + sal_Int32 Compare( const ScDPMember& rOther ) const; // visible order + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + virtual sal_Bool getIsVisible() const; + virtual void setIsVisible(sal_Bool bSet); + virtual sal_Bool getShowDetails() const; + virtual void setShowDetails(sal_Bool bSet); + + sal_Int32 getPosition() const; + void setPosition(sal_Int32 nNew); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/drawattr.hxx b/sc/inc/drawattr.hxx new file mode 100644 index 000000000000..34e08c975f02 --- /dev/null +++ b/sc/inc/drawattr.hxx @@ -0,0 +1,67 @@ +/* -*- 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. + * + ************************************************************************/ +#ifndef _IDLITEMS_HXX +#define _IDLITEMS_HXX + +#include <svl/eitem.hxx> +#include <editeng/svxenum.hxx> + + +class SvxDrawToolItem : public SfxEnumItem +{ +public: + + SvxDrawToolItem( const SvxDrawToolItem& rDrawToolItem ) : + SfxEnumItem( rDrawToolItem ){} + + SvxDrawToolItem(sal_uInt16 nWhichP) : SfxEnumItem(nWhichP){} + + + virtual String GetValueText() const; + + + virtual String GetValueText(sal_uInt16 nVal) const; + virtual sal_uInt16 GetValueCount() const + {return((sal_uInt16)SVX_SNAP_DRAW_TEXT);} + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual SfxPoolItem* Create( SvStream& rStream, sal_uInt16 nVer ) const; + + inline SvxDrawToolItem& operator=(const SvxDrawToolItem& + rDrawTool) + { + SetValue( rDrawTool.GetValue() ); + return *this; + + } +}; +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/drawpage.hxx b/sc/inc/drawpage.hxx new file mode 100644 index 000000000000..a4c891ecfc9f --- /dev/null +++ b/sc/inc/drawpage.hxx @@ -0,0 +1,50 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DRAWPAGE_HXX +#define SC_DRAWPAGE_HXX + +#include <svx/fmpage.hxx> + + +class ScDrawLayer; + +class ScDrawPage: public FmFormPage +{ +public: + ScDrawPage(ScDrawLayer& rNewModel, StarBASIC* pBasic, bool bMasterPage = false); + ~ScDrawPage(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage(); +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/drdefuno.hxx b/sc/inc/drdefuno.hxx new file mode 100644 index 000000000000..dd79fbbf2b1b --- /dev/null +++ b/sc/inc/drdefuno.hxx @@ -0,0 +1,54 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DRDEFUNO_HXX +#define SC_DRDEFUNO_HXX + +#include <svx/unopool.hxx> +#include <svl/lstner.hxx> + +class ScDocShell; + +class ScDrawDefaultsObj : public SvxUnoDrawPool, public SfxListener +{ +private: + ScDocShell* pDocShell; + +public: + ScDrawDefaultsObj(ScDocShell* pDocSh); + virtual ~ScDrawDefaultsObj() throw (); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // from SvxUnoDrawPool + virtual SfxItemPool* getModelPool( sal_Bool bReadOnly ) throw(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx new file mode 100644 index 000000000000..35e1843719a2 --- /dev/null +++ b/sc/inc/drwlayer.hxx @@ -0,0 +1,221 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_DRWLAYER_HXX +#define SC_DRWLAYER_HXX + +#include <vcl/graph.hxx> +#include <svx/fmmodel.hxx> +#include <svx/svdundo.hxx> +#include "global.hxx" + +class ScDocument; +class SfxViewShell; +class SfxObjectShell; +class ScDrawObjData; +class ScIMapInfo; +class ScMacroInfo; +class IMapObject; +class ScMarkData; +class SdrOle2Obj; +class ScRange; +class ScAddress; + +class ScTabDeletedHint : public SfxHint +{ +private: + SCTAB nTab; +public: + TYPEINFO(); + ScTabDeletedHint( SCTAB nTabNo = SCTAB_MAX ); + virtual ~ScTabDeletedHint(); + + SCTAB GetTab() { return nTab; } +}; + +class ScTabSizeChangedHint : public SfxHint +{ +private: + SCTAB nTab; +public: + TYPEINFO(); + ScTabSizeChangedHint( SCTAB nTabNo = SCTAB_MAX ); + virtual ~ScTabSizeChangedHint(); + + SCTAB GetTab() { return nTab; } +}; + +// Adjusting of detective UserData and draw undo's both have to be in SdrUndoGroup; +// therefore derived from SdrUndoAction + +class ScUndoObjData : public SdrUndoObj +{ +private: + ScAddress aOldStt; + ScAddress aOldEnd; + ScAddress aNewStt; + ScAddress aNewEnd; + sal_Bool bHasNew; +public: + ScUndoObjData( SdrObject* pObj, const ScAddress& rOS, const ScAddress& rOE, + const ScAddress& rNS, const ScAddress& rNE ); + ~ScUndoObjData(); + + virtual void Undo(); + virtual void Redo(); +}; + +class SC_DLLPUBLIC ScDrawLayer : public FmFormModel +{ +private: + String aName; + ScDocument* pDoc; + SdrUndoGroup* pUndoGroup; + sal_Bool bRecording; + sal_Bool bAdjustEnabled; + sal_Bool bHyphenatorSet; + +private: + void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, + SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos ); + + void RecalcPos( SdrObject* pObj, ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos ); + +public: + ScDrawLayer( ScDocument* pDocument, const String& rName ); + virtual ~ScDrawLayer(); + + virtual SdrPage* AllocPage(bool bMasterPage); + virtual SdrModel* AllocModel() const; + virtual void SetChanged( sal_Bool bFlg = sal_True ); + + virtual Window* GetCurDocViewWin(); + virtual SvStream* GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const; + + virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const; + + sal_Bool HasObjects() const; + + sal_Bool ScAddPage( SCTAB nTab ); + void ScRemovePage( SCTAB nTab ); + void ScRenamePage( SCTAB nTab, const String& rNewName ); + void ScMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos ); + // incl. content, bAlloc=FALSE -> only content + void ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, sal_Bool bAlloc ); + + ScDocument* GetDocument() const { return pDoc; } + + void UpdateBasic(); // set DocShell Basic in DrawPages + void UseHyphenator(); + + sal_Bool GetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const; + + // automatic adjustments + + void EnableAdjust( sal_Bool bSet = sal_True ) { bAdjustEnabled = bSet; } + + void BeginCalcUndo(); + SdrUndoGroup* GetCalcUndo(); + sal_Bool IsRecording() const { return bRecording; } + void AddCalcUndo( SdrUndoAction* pUndo ); + + void MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, + SCsCOL nDx,SCsROW nDy, sal_Bool bInsDel, bool bUpdateNoteCaptionPos = true ); + + sal_Bool HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow ); + + void DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, + SCCOL nCol2,SCROW nRow2 ); + void DeleteObjectsInSelection( const ScMarkData& rMark ); + + void CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle& rRange ); + void CopyFromClip( ScDrawLayer* pClipModel, + SCTAB nSourceTab, const Rectangle& rSourceRange, + const ScAddress& rDestPos, const Rectangle& rDestRange ); + + void SetPageSize( sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos = true ); + + // mirror or move between positive and negative positions for RTL + void MirrorRTL( SdrObject* pObj ); + static void MirrorRectRTL( Rectangle& rRect ); // for bounding rectangles etc. + + /** Returns the rectangle for the passed cell address in 1/100 mm. + @param bMergedCell True = regards merged cells. False = use single column/row size. */ + static Rectangle GetCellRect( ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell ); + + // GetVisibleName: name for navigator etc: GetPersistName or GetName + // (ChartListenerCollection etc. must use GetPersistName directly) + static String GetVisibleName( SdrObject* pObj ); + + SdrObject* GetNamedObject( const String& rName, sal_uInt16 nId, SCTAB& rFoundTab ) const; + // if pnCounter != NULL, the search for a name starts with this index + 1, + // and the index really used is returned. + String GetNewGraphicName( long* pnCounter = NULL ) const; + void EnsureGraphicNames(); + + static void SetPageAnchored( SdrObject& ); + static void SetCellAnchored( SdrObject&, const ScDrawObjData &rAnchor ); + static void SetCellAnchoredFromPosition( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab ); + static void UpdateCellAnchorFromPositionEnd( SdrObject &rObj, const ScDocument &rDoc, SCTAB nTab ); + static ScAnchorType GetAnchorType( const SdrObject& ); + + // positions for detektive lines + static ScDrawObjData* GetObjData( SdrObject* pObj, sal_Bool bCreate=false ); + + // The sheet information in ScDrawObjData isn't updated when sheets are inserted/deleted. + // Use this method to get an object with positions on the specified sheet (should be the + // sheet on which the object is inserted). + static ScDrawObjData* GetObjDataTab( SdrObject* pObj, SCTAB nTab ); + + /** Returns true, if the passed object is the caption of a cell note. */ + static bool IsNoteCaption( SdrObject* pObj ); + + /** Returns the object data, if the passed object is a cell note caption. */ + static ScDrawObjData* GetNoteCaptionData( SdrObject* pObj, SCTAB nTab ); + + // Image-Map + static ScIMapInfo* GetIMapInfo( SdrObject* pObj ); + + static IMapObject* GetHitIMapObject( SdrObject* pObject, + const Point& rWinPoint, const Window& rCmpWnd ); + + static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = false ); + +private: + static SfxObjectShell* pGlobalDrawPersist; // for AllocModel +public: + static void SetGlobalDrawPersist(SfxObjectShell* pPersist); +protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel(); +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx new file mode 100644 index 000000000000..15ed5ba554dc --- /dev/null +++ b/sc/inc/editsrc.hxx @@ -0,0 +1,195 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_EDITSRC_HXX +#define SC_EDITSRC_HXX + +#include "address.hxx" +#include <editeng/unoedsrc.hxx> +#include <svl/lstner.hxx> + +#include <memory> + +class ScEditEngineDefaulter; +class SvxEditEngineForwarder; + +class ScDocShell; +class ScHeaderFooterContentObj; +class ScCellTextData; +class ScHeaderFooterTextData; +class ScAccessibleTextData; +class SdrObject; + + +class ScHeaderFooterChangedHint : public SfxHint +{ + sal_uInt16 nPart; + +public: + TYPEINFO(); + ScHeaderFooterChangedHint(sal_uInt16 nP); + ~ScHeaderFooterChangedHint(); + + sal_uInt16 GetPart() const { return nPart; } +}; + + +// all ScSharedHeaderFooterEditSource objects for a single text share the same data + +class ScSharedHeaderFooterEditSource : public SvxEditSource +{ +private: + ScHeaderFooterTextData* pTextData; + +protected: + ScHeaderFooterTextData* GetTextData() const { return pTextData; } // for ScHeaderFooterEditSource + +public: + ScSharedHeaderFooterEditSource( ScHeaderFooterTextData* pData ); + virtual ~ScSharedHeaderFooterEditSource(); + + // GetEditEngine is needed because the forwarder doesn't have field functions + ScEditEngineDefaulter* GetEditEngine(); + + virtual SvxEditSource* Clone() const ; + virtual SvxTextForwarder* GetTextForwarder(); + + virtual void UpdateData(); + +}; + +// ScHeaderFooterEditSource with local copy of ScHeaderFooterTextData is used by field objects + +class ScHeaderFooterEditSource : public ScSharedHeaderFooterEditSource +{ +public: + ScHeaderFooterEditSource( ScHeaderFooterContentObj* pContent, sal_uInt16 nP ); + ScHeaderFooterEditSource( ScHeaderFooterContentObj& rContent, sal_uInt16 nP ); + virtual ~ScHeaderFooterEditSource(); + + virtual SvxEditSource* Clone() const; +}; + + +// Data (incl. EditEngine) for cell EditSource is now shared in ScCellTextData + +class ScSharedCellEditSource : public SvxEditSource +{ +private: + ScCellTextData* pCellTextData; + +protected: + ScCellTextData* GetCellTextData() const { return pCellTextData; } // for ScCellEditSource + +public: + ScSharedCellEditSource( ScCellTextData* pData ); + virtual ~ScSharedCellEditSource(); + + // GetEditEngine is needed because the forwarder doesn't have field functions + ScEditEngineDefaulter* GetEditEngine(); + + virtual SvxEditSource* Clone() const; + virtual SvxTextForwarder* GetTextForwarder(); + + virtual void UpdateData(); + + void SetDoUpdateData(sal_Bool bValue); + sal_Bool IsDirty() const; +}; + +// ScCellEditSource with local copy of ScCellTextData is used by ScCellFieldsObj, ScCellFieldObj + +class ScCellEditSource : public ScSharedCellEditSource +{ +public: + ScCellEditSource( ScDocShell* pDocSh, const ScAddress& rP ); + virtual ~ScCellEditSource(); + + virtual SvxEditSource* Clone() const; +}; + + +class ScAnnotationEditSource : public SvxEditSource, public SfxListener +{ +private: + ScDocShell* pDocShell; + ScAddress aCellPos; + ScEditEngineDefaulter* pEditEngine; + SvxEditEngineForwarder* pForwarder; + sal_Bool bDataValid; + + SdrObject* GetCaptionObj(); +public: + ScAnnotationEditSource(ScDocShell* pDocSh, const ScAddress& rP); + virtual ~ScAnnotationEditSource(); + + virtual SvxEditSource* Clone() const ; + virtual SvxTextForwarder* GetTextForwarder(); + virtual void UpdateData(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + + +// EditSource with a shared forwarder for all children of one text object + +class ScSimpleEditSource : public SvxEditSource +{ +private: + SvxTextForwarder* pForwarder; + +public: + ScSimpleEditSource( SvxTextForwarder* pForw ); + virtual ~ScSimpleEditSource(); + + virtual SvxEditSource* Clone() const ; + virtual SvxTextForwarder* GetTextForwarder(); + virtual void UpdateData(); + +}; + +class ScAccessibilityEditSource : public SvxEditSource +{ +private: + ::std::auto_ptr < ScAccessibleTextData > mpAccessibleTextData; + +public: + ScAccessibilityEditSource( ::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData ); + virtual ~ScAccessibilityEditSource(); + + virtual SvxEditSource* Clone() const; + virtual SvxTextForwarder* GetTextForwarder(); + virtual SvxViewForwarder* GetViewForwarder(); + virtual SvxEditViewForwarder* GetEditViewForwarder( sal_Bool bCreate = false ); + virtual void UpdateData(); + virtual SfxBroadcaster& GetBroadcaster() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx new file mode 100644 index 000000000000..35bb41b36e2d --- /dev/null +++ b/sc/inc/editutil.hxx @@ -0,0 +1,260 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_EDITUTIL_HXX +#define SC_EDITUTIL_HXX + +#include "scdllapi.h" +#include "address.hxx" +#include <editeng/editeng.hxx> +#include <svx/pageitem.hxx> +#include <tools/date.hxx> +#include <tools/time.hxx> +#include <tools/gen.hxx> +#include <tools/fract.hxx> + + +class OutputDevice; +class ScDocument; +class ScPatternAttr; +class ScEditEngineDefaulter; + +class ScEditUtil +{ + ScDocument* pDoc; + SCCOL nCol; + SCROW nRow; + SCTAB nTab; + Point aScrPos; + OutputDevice* pDev; // MapMode has to be set + double nPPTX; + double nPPTY; + Fraction aZoomX; + Fraction aZoomY; + + static const char pCalcDelimiters[]; + +public: + static String ModifyDelimiters( const String& rOld ); + + /// Retrieves string with paragraphs delimited by spaces + static String GetSpaceDelimitedString( const EditEngine& rEngine ); + + /// Retrieves string with paragraphs delimited by new lines ('\n'). + static String GetMultilineString( const EditEngine& rEngine ); + +public: + ScEditUtil( ScDocument* pDocument, SCCOL nX, SCROW nY, SCTAB nZ, + const Point& rScrPosPixel, + OutputDevice* pDevice, double nScaleX, double nScaleY, + const Fraction& rX, const Fraction& rY ) : + pDoc(pDocument),nCol(nX),nRow(nY),nTab(nZ), + aScrPos(rScrPosPixel),pDev(pDevice), + nPPTX(nScaleX),nPPTY(nScaleY),aZoomX(rX),aZoomY(rY) {} + + Rectangle GetEditArea( const ScPatternAttr* pPattern, sal_Bool bForceToTop ); +}; + + +class ScEditAttrTester +{ + ScEditEngineDefaulter* pEngine; + SfxItemSet* pEditAttrs; + sal_Bool bNeedsObject; + sal_Bool bNeedsCellAttr; + +public: + ScEditAttrTester( ScEditEngineDefaulter* pEng ); + ~ScEditAttrTester(); + + sal_Bool NeedsObject() const { return bNeedsObject; } + sal_Bool NeedsCellAttr() const { return bNeedsCellAttr; } + const SfxItemSet& GetAttribs() const { return *pEditAttrs; } +}; + + +// construct pool before constructing EditEngine, destroy pool after EditEngine +class ScEnginePoolHelper +{ +protected: + SfxItemPool* pEnginePool; + SfxItemSet* pDefaults; + sal_Bool bDeleteEnginePool; + sal_Bool bDeleteDefaults; + + ScEnginePoolHelper( SfxItemPool* pEnginePool, + sal_Bool bDeleteEnginePool = false ); + ScEnginePoolHelper( const ScEnginePoolHelper& rOrg ); + virtual ~ScEnginePoolHelper(); +}; + + +class SC_DLLPUBLIC ScEditEngineDefaulter : public ScEnginePoolHelper, public EditEngine +{ +private: + using EditEngine::SetText; + +public: + /// bDeleteEnginePool: Engine becomes the owner of the pool + /// and deletes it on destruction + ScEditEngineDefaulter( SfxItemPool* pEnginePool, + sal_Bool bDeleteEnginePool = false ); + /// If rOrg.bDeleteEnginePool: pool gets cloned and will be + /// deleted on destruction. Defaults are not set. + ScEditEngineDefaulter( const ScEditEngineDefaulter& rOrg ); + virtual ~ScEditEngineDefaulter(); + + /// Creates a copy of SfxItemSet if bRememberCopy set + void SetDefaults( const SfxItemSet& rDefaults, sal_Bool bRememberCopy = sal_True ); + + /// Becomes the owner of the SfxItemSet if bTakeOwnership set + void SetDefaults( SfxItemSet* pDefaults, sal_Bool bTakeOwnership = sal_True ); + + /// Set the item in the default ItemSet which is created + /// if it doesn't exist yet. + /// The default ItemSet is then applied to each paragraph. + void SetDefaultItem( const SfxPoolItem& rItem ); + + /// Returns the stored defaults, used to find non-default character attributes + const SfxItemSet& GetDefaults(); + + /// Overwritten method to be able to apply defaults already set + void SetText( const EditTextObject& rTextObject ); + /// Current defaults are not applied, new defaults are applied + void SetTextNewDefaults( const EditTextObject& rTextObject, + const SfxItemSet& rDefaults, sal_Bool bRememberCopy = sal_True ); + /// Current defaults are not applied, new defaults are applied + void SetTextNewDefaults( const EditTextObject& rTextObject, + SfxItemSet* pDefaults, sal_Bool bTakeOwnership = sal_True ); + + /// Overwritten method to be able to apply defaults already set + void SetText( const String& rText ); + /// Current defaults are not applied, new defaults are applied + void SetTextNewDefaults( const String& rText, + const SfxItemSet& rDefaults, sal_Bool bRememberCopy = sal_True ); + /// Current defaults are not applied, new defaults are applied + void SetTextNewDefaults( const String& rText, + SfxItemSet* pDefaults, sal_Bool bTakeOwnership = sal_True ); + + /// Paragraph attributes that are not defaults are copied to + /// character attributes and all paragraph attributes reset + void RemoveParaAttribs(); + + /// Re-apply existing defaults if set, same as in SetText, + /// but without EnableUndo/SetUpdateMode. + void RepeatDefaults(); +}; + + +// 1/100 mm +class SC_DLLPUBLIC ScTabEditEngine : public ScEditEngineDefaulter +{ +private: + void Init(const ScPatternAttr& rPattern); +public: + ScTabEditEngine( ScDocument* pDoc ); // Default + ScTabEditEngine( const ScPatternAttr& rPattern, + SfxItemPool* pEnginePool, + SfxItemPool* pTextObjectPool = NULL ); +}; + + +struct ScHeaderFieldData +{ + String aTitle; // title or file name (if no title) + String aLongDocName; // path and file name + String aShortDocName; // pure file name + String aTabName; + Date aDate; + Time aTime; + long nPageNo; + long nTotalPages; + SvxNumType eNumType; + + ScHeaderFieldData(); +}; + + +// for field commands (or just fields?) in a table +class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter +{ +private: + sal_Bool bExecuteURL; + +public: + ScFieldEditEngine( SfxItemPool* pEnginePool, + SfxItemPool* pTextObjectPool = NULL, + sal_Bool bDeleteEnginePool = false ); + + void SetExecuteURL(sal_Bool bSet) { bExecuteURL = bSet; } + + virtual void FieldClicked( const SvxFieldItem& rField, sal_uInt16, sal_uInt16 ); + virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor ); +}; + + +// for headers/footers with fields +class SC_DLLPUBLIC ScHeaderEditEngine : public ScEditEngineDefaulter +{ +private: + ScHeaderFieldData aData; + +public: + ScHeaderEditEngine( SfxItemPool* pEnginePool, sal_Bool bDeleteEnginePool = false ); + virtual String CalcFieldValue( const SvxFieldItem& rField, sal_uInt16 nPara, sal_uInt16 nPos, Color*& rTxtColor, Color*& rFldColor ); + + void SetTitle(const String& rNew) { aData.aTitle = rNew; } + void SetLongDocName(const String& rNew) { aData.aLongDocName = rNew; } + void SetShortDocName(const String& rNew) { aData.aShortDocName = rNew; } + void SetTabName(const String& rNew) { aData.aTabName = rNew; } + void SetDate(const Date& rNew) { aData.aDate = rNew; } + void SetTime(const Time& rNew) { aData.aTime = rNew; } + void SetPageNo(long nNew) { aData.nPageNo = nNew; } + void SetTotalPages(long nNew) { aData.nTotalPages = nNew; } + void SetNumType(SvxNumType eNew) { aData.eNumType = eNew; } + void SetData(const ScHeaderFieldData& rNew) { aData = rNew; } +}; + +// for Note text objects. +class ScNoteEditEngine : public ScEditEngineDefaulter +{ + +public: + ScNoteEditEngine( SfxItemPool* pEnginePool, + SfxItemPool* pTextObjectPool = NULL, + sal_Bool bDeleteEnginePool = false ); + +}; + +// SvxFieldData derivations were moved to Svx (comment can be deleted?) + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/eventuno.hxx b/sc/inc/eventuno.hxx new file mode 100644 index 000000000000..3bf21a1c78e3 --- /dev/null +++ b/sc/inc/eventuno.hxx @@ -0,0 +1,90 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_EVENTUNO_HXX +#define SC_EVENTUNO_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameReplace.hpp> +#include <cppuhelper/implbase2.hxx> +#include <svl/lstner.hxx> + +#include "global.hxx" + +class ScDocShell; + +class ScSheetEventsObj : public cppu::WeakImplHelper2< + com::sun::star::container::XNameReplace, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScDocShell* mpDocShell; + SCTAB mnTab; + +public: + ScSheetEventsObj(ScDocShell* pDocSh, SCTAB nT); + virtual ~ScSheetEventsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx new file mode 100644 index 000000000000..834a4fee8536 --- /dev/null +++ b/sc/inc/externalrefmgr.hxx @@ -0,0 +1,796 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_EXTERNALREFMGR_HXX +#define SC_EXTERNALREFMGR_HXX + +#include "global.hxx" +#include "address.hxx" +#include "sfx2/objsh.hxx" +#include "sfx2/lnkbase.hxx" +#include "tools/time.hxx" +#include "vcl/timer.hxx" +#include "svl/zforlist.hxx" +#include "scmatrix.hxx" +#include "rangelst.hxx" +#include "formula/token.hxx" + +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> +#include <boost/shared_ptr.hpp> +#include <vector> +#include <list> +#include <set> +#include <formula/ExternalReferenceHelper.hxx> + +class ScDocument; +namespace formula +{ + class FormulaToken; +} +class ScToken; +class ScMatrix; +class ScTokenArray; +class String; +class SfxObjectShellRef; +class Window; +class ScFormulaCell; + +class ScExternalRefCache; + +class ScExternalRefLink : public ::sfx2::SvBaseLink +{ +public: + ScExternalRefLink(ScDocument* pDoc, sal_uInt16 nFileId, const String& rFilter); + virtual ~ScExternalRefLink(); + + virtual void Closed(); + virtual void DataChanged(const String& rMimeType, const ::com::sun::star::uno::Any & rValue); + virtual void Edit(Window* pParent, const Link& rEndEditHdl); + + void SetDoReferesh(bool b); + +private: + ScExternalRefLink(); // disabled + ScExternalRefLink(const ScExternalRefLink&); // disabled + + DECL_LINK( ExternalRefEndEditHdl, ::sfx2::SvBaseLink* ); + + sal_uInt16 mnFileId; + String maFilterName; + ScDocument* mpDoc; + bool mbDoRefresh; +}; + +/** + * Cache table for external reference data. + */ +class ScExternalRefCache +{ +public: + typedef ::formula::FormulaTokenRef TokenRef; + typedef ::boost::shared_ptr<ScTokenArray> TokenArrayRef; + + struct TableName + { + String maUpperName; + String maRealName; + + explicit TableName(const String& rUppper, const String& rReal); + }; + + struct CellFormat + { + bool mbIsSet; + short mnType; + sal_uInt32 mnIndex; + + explicit CellFormat(); + }; + +private: + /** individual cell within cached external ref table. */ + struct Cell + { + TokenRef mxToken; + sal_uInt32 mnFmtIndex; + }; + typedef ::boost::unordered_map<SCCOL, Cell> RowDataType; + typedef ::boost::unordered_map<SCROW, RowDataType> RowsDataType; + +public: + // SUNWS needs a forward declared friend, otherwise types and members + // of the outer class are not accessible. + class Table; + friend class ScExternalRefCache::Table; + + /** + * Represents a single cached table in an external document. It only + * stores non-empty cells; empty cells should never be stored in the data + * cache. Instead, cached ranges should be used to determine whether or + * not a cell is empty or needs fetching from the source document. If a + * cell's value is not stored but its address is within the cached ranges, + * that cell is already queried in the source document and we know it's + * empty. + */ + class Table + { + public: + + enum ReferencedFlag + { + UNREFERENCED, + REFERENCED_MARKED, // marked as referenced during store to file + REFERENCED_PERMANENT // permanently marked, e.g. from within interpreter + }; + + Table(); + ~Table(); + + /** + * Add cell value to the cache. + * + * @param bSetCacheRange if true, mark this cell 'cached'. This is + * false _only when_ adding a range of cell + * values, for performance reasons. + */ + SC_DLLPUBLIC void setCell(SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex = 0, bool bSetCacheRange = true); + SC_DLLPUBLIC TokenRef getCell(SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex = NULL) const; + bool hasRow( SCROW nRow ) const; + /** Set/clear referenced status flag only if current status is not + REFERENCED_PERMANENT. */ + void setReferenced( bool bReferenced ); + /// Unconditionally set the reference status flag. + void setReferencedFlag( ReferencedFlag eFlag ); + ReferencedFlag getReferencedFlag() const; + bool isReferenced() const; + /// Obtain a sorted vector of rows. + void getAllRows(::std::vector<SCROW>& rRows, SCROW nLow = 0, SCROW nHigh = MAXROW) const; + /// Returns the half-open range of used rows in this table. Returns [0,0) if table is empty. + SC_DLLPUBLIC ::std::pair< SCROW, SCROW > getRowRange() const; + /// Obtain a sorted vector of columns. + void getAllCols(SCROW nRow, ::std::vector<SCCOL>& rCols, SCCOL nLow = 0, SCCOL nHigh = MAXCOL) const; + /// Returns the half-open range of used columns in the specified row. Returns [0,0) if row is empty. + SC_DLLPUBLIC ::std::pair< SCCOL, SCCOL > getColRange( SCROW nRow ) const; + void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; + bool isRangeCached(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + + void setCachedCell(SCCOL nCol, SCROW nRow); + void setCachedCellRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + + /** + * Call this to mark the entire table "cached". This will prevent all + * future attempts to access the source document even when non-cached + * cells are queried. In such case, non-cached cells are treated as + * empty cells. Useful when loading a document with own external data + * cache. + */ + SC_DLLPUBLIC void setWholeTableCached(); + private: + bool isInCachedRanges(SCCOL nCol, SCROW nRow) const; + TokenRef getEmptyOrNullToken(SCCOL nCol, SCROW nRow) const; + + private: + /** Data cache */ + RowsDataType maRows; + /** Collection of individual cached ranges. The table ranges are + * not used & always zero. */ + ScRangeList maCachedRanges; + ReferencedFlag meReferenced; + }; + + typedef ::boost::shared_ptr<Table> TableTypeRef; + typedef ::boost::unordered_map<String, size_t, ScStringHashCode> TableNameIndexMap; + + ScExternalRefCache(); + ~ScExternalRefCache(); + + const String* getRealTableName(sal_uInt16 nFileId, const String& rTabName) const; + const String* getRealRangeName(sal_uInt16 nFileId, const String& rRangeName) const; + + /** + * Get a cached cell data at specified cell location. + * + * @param nFileId file ID of an external document + * @param rTabName sheet name + * @param nCol + * @param nRow + * + * @return pointer to the token instance in the cache. + */ + ScExternalRefCache::TokenRef getCellData( + sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, sal_uInt32* pnFmtIndex); + + /** + * Get a cached cell range data. + * + * @return a new token array instance. Note that <i>the caller must + * manage the life cycle of the returned instance</i>, which is + * guaranteed if the TokenArrayRef is properly used.. + */ + ScExternalRefCache::TokenArrayRef getCellRangeData( + sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange); + + ScExternalRefCache::TokenArrayRef getRangeNameTokens(sal_uInt16 nFileId, const String& rName); + void setRangeNameTokens(sal_uInt16 nFileId, const String& rName, TokenArrayRef pArray); + + void setCellData(sal_uInt16 nFileId, const String& rTabName, SCCOL nCol, SCROW nRow, TokenRef pToken, sal_uInt32 nFmtIndex); + + struct SingleRangeData + { + /** This name must be in upper-case. */ + String maTableName; + ScMatrixRef mpRangeData; + }; + void setCellRangeData(sal_uInt16 nFileId, const ScRange& rRange, const ::std::vector<SingleRangeData>& rData, + const TokenArrayRef& pArray); + + bool isDocInitialized(sal_uInt16 nFileId); + void initializeDoc(sal_uInt16 nFileId, const ::std::vector<String>& rTabNames); + String getTableName(sal_uInt16 nFileId, size_t nCacheId) const; + void getAllTableNames(sal_uInt16 nFileId, ::std::vector<rtl::OUString>& rTabNames) const; + SCsTAB getTabSpan( sal_uInt16 nFileId, const String& rStartTabName, const String& rEndTabName ) const; + void getAllNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; + bool hasCacheTable(sal_uInt16 nFileId, const String& rTabName) const; + size_t getCacheTableCount(sal_uInt16 nFileId) const; + + /** + * Set all tables of a document as referenced, used only during + * store-to-file. + * @returns <TRUE/> if ALL tables of ALL documents are marked. + */ + bool setCacheDocReferenced( sal_uInt16 nFileId ); + + /** + * Set a table as referenced, used only during store-to-file. + * @returns <TRUE/> if ALL tables of ALL documents are marked. + */ + bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets, bool bPermanent ); + void setAllCacheTableReferencedStati( bool bReferenced ); + bool areAllCacheTablesReferenced() const; + + /** + * Set a table as permanently referenced, to be called if not in + * mark-during-store-to-file cycle. + */ + void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ); + +private: + struct ReferencedStatus + { + struct DocReferenced + { + ::std::vector<bool> maTables; + bool mbAllTablesReferenced; + // Initially, documents have no tables but all referenced. + DocReferenced() : mbAllTablesReferenced(true) {} + }; + typedef ::std::vector<DocReferenced> DocReferencedVec; + + DocReferencedVec maDocs; + bool mbAllReferenced; + + ReferencedStatus(); + void reset( size_t nDocs ); + void checkAllDocs(); + + } maReferenced; + void addCacheTableToReferenced( sal_uInt16 nFileId, size_t nIndex ); + void addCacheDocToReferenced( sal_uInt16 nFileId ); +public: + + ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const; + ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex); + + void clearCache(sal_uInt16 nFileId); + +private: + struct RangeHash + { + size_t operator()(const ScRange& rRange) const + { + const ScAddress& s = rRange.aStart; + const ScAddress& e = rRange.aEnd; + return s.Tab() + s.Col() + s.Row() + e.Tab() + e.Col() + e.Row(); + } + }; + + typedef ::boost::unordered_map<String, TokenArrayRef, ScStringHashCode> RangeNameMap; + typedef ::boost::unordered_map<ScRange, TokenArrayRef, RangeHash> RangeArrayMap; + typedef ::boost::unordered_map<String, String, ScStringHashCode> NamePairMap; + + // SUNWS needs a forward declared friend, otherwise types and members + // of the outer class are not accessible. + struct DocItem; + friend struct ScExternalRefCache::DocItem; + + /** Represents data cached for a single external document. */ + struct DocItem + { + /** The raw cache tables. */ + ::std::vector<TableTypeRef> maTables; + /** Table name list in correct order, in both upper- and real-case. */ + ::std::vector<TableName> maTableNames; + /** Table name to index map. The names must be stored upper-case. */ + TableNameIndexMap maTableNameIndex; + /** Range name cache. */ + RangeNameMap maRangeNames; + /** Token array cache for cell ranges. */ + RangeArrayMap maRangeArrays; + /** Upper- to real-case mapping for range names. */ + NamePairMap maRealRangeNameMap; + + bool mbInitFromSource; + + DocItem() : mbInitFromSource(false) {} + }; + typedef ::boost::unordered_map<sal_uInt16, DocItem> DocDataType; + DocItem* getDocItem(sal_uInt16 nFileId) const; + +private: + mutable DocDataType maDocs; +}; + +class SC_DLLPUBLIC ScExternalRefManager : public formula::ExternalReferenceHelper +{ +public: + + typedef ::std::set<ScFormulaCell*> RefCellSet; + typedef ::boost::unordered_map<sal_uInt16, RefCellSet> RefCellMap; + + enum LinkUpdateType { LINK_MODIFIED, LINK_BROKEN }; + + /** + * Base class for objects that need to listen to link updates. When a + * link to a certain external file is updated, the notify() method gets + * called. + */ + class LinkListener + { + public: + LinkListener(); + virtual ~LinkListener() = 0; + virtual void notify(sal_uInt16 nFileId, LinkUpdateType eType) = 0; + + struct Hash + { + size_t operator() (const LinkListener* p) const + { + return reinterpret_cast<size_t>(p); + } + }; + }; + + /** + * Use this guard when performing something from the API that might query + * values from external references. Interpreting formula strings is one + * such example. + */ + class ApiGuard + { + public: + ApiGuard(ScDocument* pDoc); + ~ApiGuard(); + private: + ScExternalRefManager* mpMgr; + bool mbOldInteractionEnabled; + }; + +private: + /** Shell instance for a source document. */ + struct SrcShell + { + SfxObjectShellRef maShell; + Time maLastAccess; + }; + + typedef ::boost::unordered_map<sal_uInt16, SrcShell> DocShellMap; + typedef ::boost::unordered_map<sal_uInt16, bool> LinkedDocMap; + + typedef ::boost::unordered_map<sal_uInt16, SvNumberFormatterMergeMap> NumFmtMap; + + + typedef ::boost::unordered_set<LinkListener*, LinkListener::Hash> LinkListeners; + typedef ::boost::unordered_map<sal_uInt16, LinkListeners> LinkListenerMap; + +public: + /** Source document meta-data container. */ + struct SrcFileData + { + String maFileName; /// original file name as loaded from the file. + String maRealFileName; /// file name created from the relative name. + String maRelativeName; + String maFilterName; + String maFilterOptions; + + void maybeCreateRealFileName(const String& rOwnDocName); + }; + +public: + explicit ScExternalRefManager(ScDocument* pDoc); + virtual ~ScExternalRefManager(); + + virtual String getCacheTableName(sal_uInt16 nFileId, size_t nTabIndex) const; + + /** + * Get a cache table instance for specified table and table index. Unlike + * the other method that takes a table name, this method does not create a + * new table when a table is not available for specified index. + * + * @param nFileId file ID + * @param nTabIndex cache table index + * + * @return shared_ptr to the cache table instance + */ + ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, size_t nTabIndex) const; + + /** + * Get a cache table instance for specified file and table name. If the + * table instance is not already present, it'll instantiate a new one and + * append it to the end of the table array. <I>It's important to be + * aware of this fact especially for multi-table ranges for which + * table orders are critical.</I> + * + * Excel filter calls this method to populate the cache table from the + * XCT/CRN records. + * + * @param nFileId file ID + * @param rTabName table name + * @param bCreateNew if true, create a new table instance if it's not + * already present. If false, it returns NULL if the + * specified table's cache doesn't exist. + * @param pnIndex if non-NULL pointer is passed, it stores the internal + * index of a cache table instance. + * + * @return shared_ptr to the cache table instance + */ + ScExternalRefCache::TableTypeRef getCacheTable(sal_uInt16 nFileId, const String& rTabName, bool bCreateNew, size_t* pnIndex = 0); + + /** Returns a vector containing all (real) table names and cache tables of + the specified file. + + The index in the returned vector corresponds to the table index used to + access the cache table, e.g. in getCacheTable(). + */ + void getAllCachedTableNames(sal_uInt16 nFileId, ::std::vector<rtl::OUString>& rTabNames) const; + + /** + * Get the span (distance+sign(distance)) of two sheets of a specified + * file. + * + * @param nFileId file ID + * @param rStartTabName name of first sheet (sheet1) + * @param rEndTabName name of second sheet (sheet2) + * + * @return span + * 1 if sheet2 == sheet1 + * > 1 if sheet2 > sheet1 + * < -1 if sheet2 < sheet1 + * -1 if nFileId or rStartTabName not found + * 0 if rEndTabName not found + */ + SCsTAB getCachedTabSpan( sal_uInt16 nFileId, const String& rStartTabName, const String& rEndTabName ) const; + + /** + * Get all unique number format indices that are used in the cache tables. + * The retrieved indices are sorted in ascending order. + * + * @param rNumFmts (reference) all unique number format indices. + */ + void getAllCachedNumberFormats(::std::vector<sal_uInt32>& rNumFmts) const; + + bool hasCacheTable(sal_uInt16 nFileId, const String& rTabName) const; + size_t getCacheTableCount(sal_uInt16 nFileId) const; + sal_uInt16 getExternalFileCount() const; + + /** + * Mark all tables as referenced that are used by any LinkListener, used + * only during store-to-file. + * @returns <TRUE/> if ALL tables of ALL external documents are marked. + */ + bool markUsedByLinkListeners(); + + bool markUsedExternalRefCells(); + + /** + * Set a table as referenced, used only during store-to-file. + * @returns <TRUE/> if ALL tables of ALL external documents are marked. + */ + bool setCacheTableReferenced( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ); + void setAllCacheTableReferencedStati( bool bReferenced ); + + /** + * Set a table as permanently referenced, to be called if not in + * mark-during-store-to-file cycle. + */ + void setCacheTableReferencedPermanently( sal_uInt16 nFileId, const String& rTabName, size_t nSheets ); + + /** + * @returns <TRUE/> if setAllCacheTableReferencedStati(false) was called, + * <FALSE/> if setAllCacheTableReferencedStati(true) was called. + */ + bool isInReferenceMarking() const { return mbInReferenceMarking; } + + void storeRangeNameTokens(sal_uInt16 nFileId, const String& rName, const ScTokenArray& rArray); + + ScExternalRefCache::TokenRef getSingleRefToken( + sal_uInt16 nFileId, const String& rTabName, const ScAddress& rCell, + const ScAddress* pCurPos, SCTAB* pTab, ScExternalRefCache::CellFormat* pFmt = NULL); + + /** + * Get an array of tokens that consist of the specified external cell + * range. + * + * @param nFileId file ID for an external document + * @param rTabName referenced sheet name + * @param rRange referenced cell range + * @param pCurPos current cursor position to keep track of cells that + * reference an external data. + * + * @return shared_ptr to a token array instance. <i>The caller must not + * delete the instance returned by this method.</i> + */ + ScExternalRefCache::TokenArrayRef getDoubleRefTokens( + sal_uInt16 nFileId, const String& rTabName, const ScRange& rRange, const ScAddress* pCurPos); + + /** + * Get an array of tokens corresponding with a specified name in a + * specified file. + * + * @param pCurPos currnet cell address where this name token is used. + * This is purely to keep track of all cells containing + * external names for refreshing purposes. If this is + * NULL, then the cell will not be added to the list. + * + * @return shared_ptr to array of tokens composing the name + */ + ScExternalRefCache::TokenArrayRef getRangeNameTokens( + sal_uInt16 nFileId, const String& rName, const ScAddress* pCurPos = NULL); + + const String& getOwnDocumentName() const; + bool isOwnDocument(const String& rFile) const; + + /** + * Takes a flat file name, and convert it to an absolute URL path. An + * absolute URL path begines with 'file:///. + * + * @param rFile file name to convert + */ + void convertToAbsName(String& rFile) const; + sal_uInt16 getExternalFileId(const String& rFile); + + /** + * It returns a pointer to the name of the URI associated with a given + * external file ID. In case the original document has moved, it returns + * an URI adjusted for the relocation. + * + * @param nFileId file ID for an external document + * @param bForceOriginal If true, it always returns the original document + * URI even if the referring document has relocated. + * If false, it returns an URI adjusted for + * relocated document. + * + * @return const String* external document URI. + */ + const String* getExternalFileName(sal_uInt16 nFileId, bool bForceOriginal = false); + bool hasExternalFile(sal_uInt16 nFileId) const; + bool hasExternalFile(const String& rFile) const; + const SrcFileData* getExternalFileData(sal_uInt16 nFileId) const; + + const String* getRealTableName(sal_uInt16 nFileId, const String& rTabName) const; + const String* getRealRangeName(sal_uInt16 nFileId, const String& rRangeName) const; + void refreshNames(sal_uInt16 nFileId); + void breakLink(sal_uInt16 nFileId); + void switchSrcFile(sal_uInt16 nFileId, const String& rNewFile, const String& rNewFilter); + + /** + * Set a relative file path for the specified file ID. Note that the + * caller must ensure that the passed URL is a valid relative URL. + * + * @param nFileId file ID for an external document + * @param rRelUrl relative URL + */ + void setRelativeFileName(sal_uInt16 nFileId, const String& rRelUrl); + + /** + * Set the filter name and options if any for a given source document. + * These values get reset when the source document ever gets reloaded. + * + * @param nFileId + * @param rFilterName + * @param rOptions + */ + void setFilterData(sal_uInt16 nFileId, const String& rFilterName, const String& rOptions); + + void clear(); + + bool hasExternalData() const; + + /** + * Re-generates relative names for all stored source files. This is + * necessary when exporting to an ods document, to ensure that all source + * files have their respective relative names for xlink:href export. + * + * @param rBaseFileUrl Absolute URL of the content.xml fragment of the + * document being exported. + */ + void resetSrcFileData(const String& rBaseFileUrl); + + /** + * Stop tracking a specific formula cell. + * + * @param pCell pointer to cell that formerly contained external + * reference. + */ + void removeRefCell(ScFormulaCell* pCell); + + /** + * Register a new link listener to a specified external document. Note + * that the caller is responsible for managing the life cycle of the + * listener object. + */ + void addLinkListener(sal_uInt16 nFileId, LinkListener* pListener); + + /** + * Remove an existing link listener. Note that removing a listener + * pointer here does not delete the listener object instance. + */ + void removeLinkListener(sal_uInt16 nFileId, LinkListener* pListener); + + void removeLinkListener(LinkListener* pListener); + + /** + * Notify all listeners that are listening to a specified external + * document. + * + * @param nFileId file ID for an external document. + */ + void notifyAllLinkListeners(sal_uInt16 nFileId, LinkUpdateType eType); + +private: + ScExternalRefManager(); + ScExternalRefManager(const ScExternalRefManager&); + + void refreshAllRefCells(sal_uInt16 nFileId); + + void insertRefCell(sal_uInt16 nFileId, const ScAddress& rCell); + + void fillCellFormat(sal_uInt32 nFmtIndex, ScExternalRefCache::CellFormat* pFmt) const; + + ScExternalRefCache::TokenRef getSingleRefTokenFromSrcDoc( + sal_uInt16 nFileId, const ScDocument* pSrcDoc, const ScAddress& rCell, + ScExternalRefCache::CellFormat* pFmt); + + /** + * Retrieve a range token array from a source document instance. + * + * @param pSrcDoc pointer to the source document instance. + * @param rTabName name of the first table. + * @param rRange range specified. Upon successful retrieval, this range + * gets modified to contain the correct table IDs, and in + * case the range is larger than the data area of the source + * document, it gets reduced to the data area. + * @param rCacheData an array of structs, with each struct containing the + * table name and the data in the specified range. + * + * @return range token array + */ + ScExternalRefCache::TokenArrayRef getDoubleRefTokensFromSrcDoc( + const ScDocument* pSrcDoc, const String& rTabName, ScRange& rRange, + ::std::vector<ScExternalRefCache::SingleRangeData>& rCacheData); + + /** + * Retrieve range name token array from a source document instance. + * + * @param nFileId file ID of the source document. + * @param pSrcDoc pointer to the source document instance + * @param rName range name to retrieve. Note that the range name lookup + * is case <i>in</i>-sensitive, and upon successful retrieval + * of the range name array, this name gets updated to the + * actual range name with the correct casing. + * + * @return range name token array + */ + ScExternalRefCache::TokenArrayRef getRangeNameTokensFromSrcDoc( + sal_uInt16 nFileId, const ScDocument* pSrcDoc, String& rName); + + const ScDocument* getInMemorySrcDocument(sal_uInt16 nFileId); + const ScDocument* getSrcDocument(sal_uInt16 nFileId); + SfxObjectShellRef loadSrcDocument(sal_uInt16 nFileId, String& rFilter); + bool isFileLoadable(const String& rFile) const; + + void maybeLinkExternalFile(sal_uInt16 nFileId); + + /** + * Try to create a "real" file name from the relative path. The original + * file name may not point to the real document when the referencing and + * referenced documents have been moved. + * + * For the real file name to be created, the relative name should not be + * empty before calling this method, or the real file name will not be + * created. + * + * @param nFileId file ID for an external document + */ + void maybeCreateRealFileName(sal_uInt16 nFileId); + + /** + * Purge those source document instances that have not been accessed for + * the specified duration. + * + * @param nTimeOut time out value in 100th of a second + */ + void purgeStaleSrcDocument(sal_Int32 nTimeOut); + + sal_uInt32 getMappedNumberFormat(sal_uInt16 nFileId, sal_uInt32 nNumFmt, const ScDocument* pSrcDoc); + +private: + /** cache of referenced ranges and names from source documents. */ + ScExternalRefCache maRefCache; + + ScDocument* mpDoc; + + /** + * Source document cache. This stores the original source document shell + * instances. They get purged after a certain period of time. + */ + DocShellMap maDocShells; + + /** list of source documents that are managed by the link manager. */ + LinkedDocMap maLinkedDocs; + + /** + * List of referencing cells that may contain external names. There is + * one list per source document. + */ + RefCellMap maRefCells; + + LinkListenerMap maLinkListeners; + + NumFmtMap maNumFormatMap; + + /** original source file index. */ + ::std::vector<SrcFileData> maSrcFiles; + + /** Status whether in reference marking state. See isInReferenceMarking(). */ + bool mbInReferenceMarking:1; + + /** + * Controls whether or not to allow user interaction. We don't want any + * user interaction when calling from the API. + */ + bool mbUserInteractionEnabled:1; + + AutoTimer maSrcDocTimer; + DECL_LINK(TimeOutHdl, AutoTimer*); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx new file mode 100644 index 000000000000..153416f52aac --- /dev/null +++ b/sc/inc/fielduno.hxx @@ -0,0 +1,453 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FIELDUNO_HXX +#define SC_FIELDUNO_HXX + +#include "address.hxx" +#include "mutexhlp.hxx" + +#include <svl/lstner.hxx> +#include <svl/itemprop.hxx> +#include <editeng/editdata.hxx> +#include <com/sun/star/text/XTextField.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XContainer.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <cppuhelper/component.hxx> +#include <cppuhelper/implbase5.hxx> +#include <osl/mutex.hxx> + +class SvxEditSource; +class SvxFieldItem; +class ScCellFieldObj; +class ScHeaderFieldObj; +class ScHeaderFooterContentObj; +class ScDocShell; + + +class ScCellFieldsObj : public cppu::WeakImplHelper5< + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::container::XContainer, + com::sun::star::util::XRefreshable, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScAddress aCellPos; + SvxEditSource* pEditSource; + /// List of refresh listeners. + cppu::OInterfaceContainerHelper* mpRefreshListeners; + /// mutex to lock the InterfaceContainerHelper + osl::Mutex aMutex; + + ScCellFieldObj* GetObjectByIndex_Impl(sal_Int32 Index) const; + +public: + ScCellFieldsObj(ScDocShell* pDocSh, const ScAddress& rPos); + virtual ~ScCellFieldsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XContainer + virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + + // XRefreshable + virtual void SAL_CALL refresh( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScCellFieldObj : public ScMutexHelper, + public ::cppu::OComponentHelper, + public ::com::sun::star::text::XTextField, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::lang::XServiceInfo, + public SfxListener +{ +private: + const SfxItemPropertySet* pPropSet; + ScDocShell* pDocShell; + ScAddress aCellPos; + SvxEditSource* pEditSource; + ESelection aSelection; + + String aUrl; // content, only iff not already inserted + String aRepresentation; + String aTarget; + + ScCellFieldObj(); // disabled +public: + ScCellFieldObj(ScDocShell* pDocSh, const ScAddress& rPos, + const ESelection& rSel); + virtual ~ScCellFieldObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // called by getImplementation: + void DeleteField(); + sal_Bool IsInserted() const { return pEditSource != NULL; } + SvxFieldItem CreateFieldItem(); + void InitDoc( ScDocShell* pDocSh, const ScAddress& rPos, + const ESelection& rSel ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTextField + virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) + throw(::com::sun::star::uno::RuntimeException); + + // XTextContent + virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xTextRange ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getAnchor() throw(::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScCellFieldObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::text::XTextContent> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + +//------------------------------------------------------------------ + +class ScHeaderFieldsObj : public cppu::WeakImplHelper5< + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::container::XContainer, + com::sun::star::util::XRefreshable, + com::sun::star::lang::XServiceInfo > +{ +private: + ScHeaderFooterContentObj* pContentObj; + sal_uInt16 nPart; + sal_uInt16 nType; + SvxEditSource* pEditSource; + + /// List of refresh listeners. + cppu::OInterfaceContainerHelper* mpRefreshListeners; + /// mutex to lock the InterfaceContainerHelper + osl::Mutex aMutex; + + ScHeaderFieldObj* GetObjectByIndex_Impl(sal_Int32 Index) const; + +public: + ScHeaderFieldsObj(ScHeaderFooterContentObj* pContent, + sal_uInt16 nP, sal_uInt16 nT); + virtual ~ScHeaderFieldsObj(); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XContainer + virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::container::XContainerListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + + // XRefreshable + virtual void SAL_CALL refresh( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScHeaderFieldObj : public ScMutexHelper, + public ::cppu::OComponentHelper, + public ::com::sun::star::text::XTextField, + public ::com::sun::star::beans::XPropertySet, + public ::com::sun::star::lang::XUnoTunnel, + public ::com::sun::star::lang::XServiceInfo +{ +private: + const SfxItemPropertySet* pPropSet; + ScHeaderFooterContentObj* pContentObj; + sal_uInt16 nPart; + sal_uInt16 nType; + SvxEditSource* pEditSource; + ESelection aSelection; + sal_Int16 nFileFormat; // enum SvxFileFormat, valid if not inserted + + ScHeaderFieldObj(); // disabled +public: + ScHeaderFieldObj(ScHeaderFooterContentObj* pContent, sal_uInt16 nP, + sal_uInt16 nT, const ESelection& rSel); + virtual ~ScHeaderFieldObj(); + + // called by getImplementation: + void DeleteField(); + sal_Bool IsInserted() const { return pEditSource != NULL; } + SvxFieldItem CreateFieldItem(); + void InitDoc( ScHeaderFooterContentObj* pContent, sal_uInt16 nP, + const ESelection& rSel ); + + virtual ::com::sun::star::uno::Any SAL_CALL queryAggregation( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XTextField + virtual ::rtl::OUString SAL_CALL getPresentation( sal_Bool bShowCommand ) + throw(::com::sun::star::uno::RuntimeException); + + // XTextContent + virtual void SAL_CALL attach( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xTextRange ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getAnchor() throw(::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScHeaderFieldObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::text::XTextContent> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx new file mode 100644 index 000000000000..f716662ebc23 --- /dev/null +++ b/sc/inc/fillinfo.hxx @@ -0,0 +1,145 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FILLINFO_HXX +#define SC_FILLINFO_HXX + +#include <svx/framelinkarray.hxx> +#include "global.hxx" + +class SfxItemSet; +class SvxBrushItem; +class SvxBoxItem; +class SvxLineItem; +class SvxShadowItem; + +class ScBaseCell; +class ScPatternAttr; + +const sal_uInt8 SC_ROTDIR_NONE = 0; +const sal_uInt8 SC_ROTDIR_STANDARD = 1; +const sal_uInt8 SC_ROTDIR_LEFT = 2; +const sal_uInt8 SC_ROTDIR_RIGHT = 3; +const sal_uInt8 SC_ROTDIR_CENTER = 4; + +const sal_uInt8 SC_CLIPMARK_NONE = 0; +const sal_uInt8 SC_CLIPMARK_LEFT = 1; +const sal_uInt8 SC_CLIPMARK_RIGHT = 2; +const sal_uInt8 SC_CLIPMARK_SIZE = 64; + +enum ScShadowPart +{ + SC_SHADOW_HSTART, + SC_SHADOW_VSTART, + SC_SHADOW_HORIZ, + SC_SHADOW_VERT, + SC_SHADOW_CORNER +}; + +struct CellInfo +{ + ScBaseCell* pCell; + + const ScPatternAttr* pPatternAttr; + const SfxItemSet* pConditionSet; + + const SvxBrushItem* pBackground; + + const SvxBoxItem* pLinesAttr; /// original item from document. + const SvxLineItem* mpTLBRLine; /// original item from document. + const SvxLineItem* mpBLTRLine; /// original item from document. + + const SvxShadowItem* pShadowAttr; // original item (internal) + + const SvxShadowItem* pHShadowOrigin; + const SvxShadowItem* pVShadowOrigin; + + ScShadowPart eHShadowPart : 4; // shadow effective for drawing + ScShadowPart eVShadowPart : 4; + sal_uInt8 nClipMark; + sal_uInt16 nWidth; + sal_uInt8 nRotateDir; + + sal_Bool bMarked : 1; + sal_Bool bEmptyCellText : 1; + + sal_Bool bMerged : 1; + sal_Bool bHOverlapped : 1; + sal_Bool bVOverlapped : 1; + sal_Bool bAutoFilter : 1; + sal_Bool bPushButton : 1; + bool bPopupButton: 1; + bool bFilterActive:1; + + sal_Bool bPrinted : 1; // when required (pagebreak mode) + + sal_Bool bHideGrid : 1; // output-internal + sal_Bool bEditEngine : 1; // output-internal +}; + +const SCCOL SC_ROTMAX_NONE = SCCOL_MAX; + +struct RowInfo +{ + CellInfo* pCellInfo; + + sal_uInt16 nHeight; + SCROW nRowNo; + SCCOL nRotMaxCol; // SC_ROTMAX_NONE, if nothing + + sal_Bool bEmptyBack; + sal_Bool bEmptyText; + sal_Bool bAutoFilter; + sal_Bool bPushButton; + sal_Bool bChanged; // TRUE, if not tested + + inline explicit RowInfo() : pCellInfo( 0 ) {} + +private: + RowInfo( const RowInfo& ); + RowInfo& operator=( const RowInfo& ); +}; + +struct ScTableInfo +{ + svx::frame::Array maArray; + RowInfo* mpRowInfo; + sal_uInt16 mnArrCount; + bool mbPageMode; + + explicit ScTableInfo(); + ~ScTableInfo(); + +private: + ScTableInfo( const ScTableInfo& ); + ScTableInfo& operator=( const ScTableInfo& ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx new file mode 100644 index 000000000000..f868b70715a9 --- /dev/null +++ b/sc/inc/filter.hxx @@ -0,0 +1,143 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FILTER_HXX +#define SC_FILTER_HXX + +#include <tools/string.hxx> +#include <rtl/textenc.h> + +#define ENABLE_LOTUS123_EXPORT 0 + +class SfxMedium; +class SvStream; + +class ScAddress; +class ScDocument; +class ScRange; +class SvNumberFormatter; + +// return values im-/export filter (sal_uLong) + +typedef sal_uLong FltError; + +#define eERR_OK ERRCODE_NONE // no error +#define eERR_OPEN SCERR_IMPORT_OPEN // ... +#define eERR_UNBEK SCERR_IMPORT_UNKNOWN // unknown error, historical meaning +#define eERR_NOMEM SCERR_IMPORT_OUTOFMEM // out of memory +#define eERR_UNKN_WK SCERR_IMPORT_UNKNOWN_WK // unknown WK? format (Lotus 1-2-3) +#define eERR_FORMAT SCERR_IMPORT_FORMAT // format error during reading (no formula error!) +#define eERR_NI SCERR_IMPORT_NI // filter not implemented +#define eERR_UNKN_BIFF SCERR_IMPORT_UNKNOWN_BIFF // unknown BIFF format (Excel) +#define eERR_NI_BIFF SCERR_IMPORT_NI_BIFF // not implemented BIFF format +#define eERR_FILEPASSWD SCERR_IMPORT_FILEPASSWD // file password protected +#define eERR_INTERN SCERR_IMPORT_INTERNAL // internal error +#define eERR_RNGOVRFLW SCWARN_IMPORT_RANGE_OVERFLOW// overflow of cell coordinates + // table restricted to valid area (?) +// more error codes: s. scerrors.hxx + +// for import +enum EXCIMPFORMAT { EIF_AUTO, EIF_BIFF5, EIF_BIFF8, EIF_BIFF_LE4 }; + +// for export +enum ExportFormatLotus { ExpWK1, ExpWK3, ExpWK4 }; +enum ExportFormatExcel { ExpBiff2, ExpBiff3, ExpBiff4, ExpBiff4W, ExpBiff5, ExpBiff8, Exp2007Xml }; + + +// options for DIF im-/export (combine with '|') +#define SC_DIFOPT_PLAIN 0x00000000 +#define SC_DIFOPT_DATE 0x00000001 +#define SC_DIFOPT_TIME 0x00000002 +#define SC_DIFOPT_CURRENCY 0x00000004 + +#define SC_DIFOPT_EXCEL (SC_DIFOPT_DATE|SC_DIFOPT_TIME|SC_DIFOPT_CURRENCY) + +// These are implemented inside the scfilt library and lazy loaded + +class ScRTFImport; +class ScHTMLImport; + +class ScEEAbsImport { + public: + virtual ~ScEEAbsImport() {} + virtual sal_uLong Read( SvStream& rStream, const String& rBaseURL ) = 0; + virtual ScRange GetRange() = 0; + virtual void WriteToDocument( + sal_Bool bSizeColsRows = false, double nOutputFactor = 1.0, + SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0; +}; + +class ScFormatFilterPlugin { + public: + // various import filters + virtual FltError ScImportLotus123( SfxMedium&, ScDocument*, CharSet eSrc = RTL_TEXTENCODING_DONTKNOW ) = 0; + virtual FltError ScImportQuattroPro( SfxMedium &rMedium, ScDocument *pDoc ) = 0; + virtual FltError ScImportExcel( SfxMedium&, ScDocument*, const EXCIMPFORMAT ) = 0; + // eFormat == EIF_AUTO -> matching filter is used automatically + // eFormat == EIF_BIFF5 -> only Biff5 stream is read sucessfully (in an Excel97 doc, too) + // eFormat == EIF_BIFF8 -> only Biff8 stream is read sucessfully (only in Excel97 docs) + // eFormat == EIF_BIFF_LE4 -> only non storage files _might_ be read sucessfully + virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) = 0; + virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos, + const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0; + virtual FltError ScImportRTF( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange ) = 0; + virtual FltError ScImportHTML( SvStream&, const String& rBaseURL, ScDocument*, ScRange& rRange, double nOutputFactor = 1.0, + sal_Bool bCalcWidthHeight = sal_True, SvNumberFormatter* pFormatter = NULL, bool bConvertDate = true ) = 0; + + // various import helpers + virtual ScEEAbsImport *CreateRTFImport( ScDocument* pDoc, const ScRange& rRange ) = 0; + virtual ScEEAbsImport *CreateHTMLImport( ScDocument* pDocP, const String& rBaseURL, const ScRange& rRange, sal_Bool bCalcWidthHeight ) = 0; + virtual String GetHTMLRangeNameList( ScDocument* pDoc, const String& rOrigName ) = 0; + + // various export filters +#if ENABLE_LOTUS123_EXPORT + virtual FltError ScExportLotus123( SvStream&, ScDocument*, ExportFormatLotus, CharSet eDest ) = 0; +#endif + virtual FltError ScExportExcel5( SfxMedium&, ScDocument*, ExportFormatExcel eFormat, CharSet eDest ) = 0; + virtual FltError ScExportDif( SvStream&, ScDocument*, const ScAddress& rOutPos, const CharSet eDest, + sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0; + virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest, + sal_uInt32 nDifOption = SC_DIFOPT_EXCEL ) = 0; + virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, sal_Bool bAll, + const String& rStreamPath, String& rNonConvertibleChars ) = 0; + virtual FltError ScExportRTF( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest ) = 0; +}; + +// scfilt plugin symbol +extern "C" { + SAL_DLLPUBLIC_EXPORT ScFormatFilterPlugin * SAL_CALL ScFilterCreate(void); +} + +class ScFormatFilter { + public: + static ScFormatFilterPlugin &Get(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/filtopt.hxx b/sc/inc/filtopt.hxx new file mode 100644 index 000000000000..1b6de8909431 --- /dev/null +++ b/sc/inc/filtopt.hxx @@ -0,0 +1,64 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FILTOPT_HXX +#define SC_FILTOPT_HXX + +#include <unotools/configitem.hxx> +#include <tools/solar.h> +#include "scdllapi.h" + +//================================================================== +// filter options +//================================================================== + +class SC_DLLPUBLIC ScFilterOptions : public utl::ConfigItem +{ + sal_Bool bWK3Flag; + double fExcelColScale; + double fExcelRowScale; + + com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); + +public: + ScFilterOptions(); + + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames ); + virtual void Commit(); + + sal_Bool GetWK3Flag() const { return bWK3Flag; } + double GetExcelColScale() const { return fExcelColScale; } + double GetExcelRowScale() const { return fExcelRowScale; } + + // values are never modified by office +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/filtuno.hxx b/sc/inc/filtuno.hxx new file mode 100644 index 000000000000..e42bfc19b386 --- /dev/null +++ b/sc/inc/filtuno.hxx @@ -0,0 +1,113 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FILTUNO_HXX +#define SC_FILTUNO_HXX + +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp> +#include <com/sun/star/document/XImporter.hpp> +#include <com/sun/star/document/XExporter.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase5.hxx> +#include "scdllapi.h" + +namespace com { namespace sun { namespace star { namespace io { + class XInputStream; +} } } } + + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + ScFilterOptionsObj_CreateInstance( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& ); + + +class ScFilterOptionsObj : public ::cppu::WeakImplHelper5< + ::com::sun::star::beans::XPropertyAccess, + ::com::sun::star::ui::dialogs::XExecutableDialog, + ::com::sun::star::document::XImporter, + ::com::sun::star::document::XExporter, + ::com::sun::star::lang::XServiceInfo > +{ +private: + ::rtl::OUString aFileName; + ::rtl::OUString aFilterName; + ::rtl::OUString aFilterOptions; + ::com::sun::star::uno::Reference< + ::com::sun::star::io::XInputStream > xInputStream; + sal_Bool bExport; + +public: + ScFilterOptionsObj(); + virtual ~ScFilterOptionsObj(); + + static ::rtl::OUString getImplementationName_Static(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString> getSupportedServiceNames_Static(); + + // XPropertyAccess + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > + SAL_CALL getPropertyValues() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aProps ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XExecutableDialog + virtual void SAL_CALL setTitle( const ::rtl::OUString& aTitle ) + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL execute() throw (::com::sun::star::uno::RuntimeException); + + // XImporter + virtual void SAL_CALL setTargetDocument( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XExporter + virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XComponent >& xDoc ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx new file mode 100644 index 000000000000..6632ce25e7df --- /dev/null +++ b/sc/inc/fmtuno.hxx @@ -0,0 +1,341 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FMTUNO_HXX +#define SC_FMTUNO_HXX + +#include <vector> + +#include <formula/grammar.hxx> +#include <svl/itemprop.hxx> +#include <com/sun/star/sheet/XSheetConditionalEntries.hpp> +#include <com/sun/star/sheet/XSheetCondition.hpp> +#include <com/sun/star/sheet/XSheetCondition2.hpp> +#include <com/sun/star/sheet/XSheetConditionalEntry.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +#include <com/sun/star/sheet/XMultiFormulaTokens.hpp> +#include <com/sun/star/sheet/FormulaToken.hpp> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> +#include <com/sun/star/sheet/ConditionOperator2.hpp> + +#include "address.hxx" +#include "conditio.hxx" + +class ScDocument; +class ScTableConditionalEntry; +class ScConditionalFormat; +class ScValidationData; + + +struct ScCondFormatEntryItem +{ + ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > maTokens1; + ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > maTokens2; + String maExpr1; + String maExpr2; + String maExprNmsp1; + String maExprNmsp2; + String maPosStr; // formula position as text + String maStyle; // display name as stored in ScStyleSheet + ScAddress maPos; + formula::FormulaGrammar::Grammar meGrammar1; // grammar used with maExpr1 + formula::FormulaGrammar::Grammar meGrammar2; // grammar used with maExpr2 + ScConditionMode meMode; + + // Make sure the grammar is initialized for API calls. + ScCondFormatEntryItem(); +}; + +class ScTableConditionalFormat : public cppu::WeakImplHelper5< + com::sun::star::sheet::XSheetConditionalEntries, + com::sun::star::container::XNameAccess, + com::sun::star::container::XEnumerationAccess, + com::sun::star::lang::XUnoTunnel, + com::sun::star::lang::XServiceInfo > +{ +private: + std::vector<ScTableConditionalEntry*> aEntries; + + ScTableConditionalEntry* GetObjectByIndex_Impl(sal_uInt16 nIndex) const; + void AddEntry_Impl(const ScCondFormatEntryItem& aEntry); + + ScTableConditionalFormat(); // disable +public: + ScTableConditionalFormat(ScDocument* pDoc, sal_uLong nKey, + formula::FormulaGrammar::Grammar eGrammar); + virtual ~ScTableConditionalFormat(); + + void FillFormat( ScConditionalFormat& rFormat, ScDocument* pDoc, + formula::FormulaGrammar::Grammar eGrammar) const; + + // XSheetConditionalEntries + virtual void SAL_CALL addNew( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aConditionalEntry ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL clear() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScTableConditionalFormat* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::sheet::XSheetConditionalEntries> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + + +class ScTableConditionalEntry : public cppu::WeakImplHelper3< + com::sun::star::sheet::XSheetCondition2, + com::sun::star::sheet::XSheetConditionalEntry, + com::sun::star::lang::XServiceInfo > +{ +private: + ScCondFormatEntryItem aData; + + ScTableConditionalEntry(); // disabled +public: + ScTableConditionalEntry(const ScCondFormatEntryItem& aItem); + virtual ~ScTableConditionalEntry(); + + void GetData(ScCondFormatEntryItem& rData) const; + + // XSheetCondition + virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getConditionOperator() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormula1( const ::rtl::OUString& aFormula1 ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getFormula2() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormula2( const ::rtl::OUString& aFormula2 ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellAddress SAL_CALL getSourcePosition() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSourcePosition( const ::com::sun::star::table::CellAddress& aSourcePosition ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetConditionalEntry + virtual ::rtl::OUString SAL_CALL getStyleName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStyleName( const ::rtl::OUString& aStyleName ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + + +class ScTableValidationObj : public cppu::WeakImplHelper5< + com::sun::star::sheet::XSheetCondition2, + com::sun::star::sheet::XMultiFormulaTokens, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XUnoTunnel, + com::sun::star::lang::XServiceInfo > +{ +private: + SfxItemPropertySet aPropSet; + sal_uInt16 nMode; // enum ScConditionMode + String aExpr1; + String aExpr2; + String maExprNmsp1; + String maExprNmsp2; + formula::FormulaGrammar::Grammar meGrammar1; // grammar used with aExpr1 and aExpr2 + formula::FormulaGrammar::Grammar meGrammar2; // grammar used with aExpr1 and aExpr2 + ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens1; + ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > aTokens2; + ScAddress aSrcPos; + String aPosString; // formula position as text + sal_uInt16 nValMode; // enum ScValidationMode + sal_Bool bIgnoreBlank; + sal_Int16 nShowList; + sal_Bool bShowInput; + String aInputTitle; + String aInputMessage; + sal_Bool bShowError; + sal_uInt16 nErrorStyle; // enum ScValidErrorStyle + String aErrorTitle; + String aErrorMessage; + + void ClearData_Impl(); + + ScTableValidationObj(); // disabled +public: + ScTableValidationObj(ScDocument* pDoc, sal_uLong nKey, + const formula::FormulaGrammar::Grammar eGrammar); + virtual ~ScTableValidationObj(); + + ScValidationData* CreateValidationData( ScDocument* pDoc, + formula::FormulaGrammar::Grammar eGrammar ) const; + + // XSheetCondition + virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getConditionOperator() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator nOperator ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setConditionOperator( sal_Int32 nOperator ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getFormula1() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormula1( const ::rtl::OUString& aFormula1 ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getFormula2() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormula2( const ::rtl::OUString& aFormula2 ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellAddress SAL_CALL getSourcePosition() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSourcePosition( const ::com::sun::star::table::CellAddress& aSourcePosition ) + throw(::com::sun::star::uno::RuntimeException); + + // XMultiFormulaTokens + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > + SAL_CALL getTokens( sal_Int32 nIndex ) + throw(::com::sun::star::uno::RuntimeException,::com::sun::star::lang::IndexOutOfBoundsException); + virtual void SAL_CALL setTokens( sal_Int32 nIndex, + const ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken >& aTokens ) + throw(::com::sun::star::uno::RuntimeException,::com::sun::star::lang::IndexOutOfBoundsException); + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScTableValidationObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/forbiuno.hxx b/sc/inc/forbiuno.hxx new file mode 100644 index 000000000000..f092401801e9 --- /dev/null +++ b/sc/inc/forbiuno.hxx @@ -0,0 +1,57 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FORBIUNO_HXX +#define SC_FORBIUNO_HXX + +#include <editeng/UnoForbiddenCharsTable.hxx> +#include <svl/lstner.hxx> + +class ScDocShell; + +//------------------------------------------------------------------------ + +// object to set forbidden charaters to document + +class ScForbiddenCharsObj : public SvxUnoForbiddenCharsTable, public SfxListener +{ + ScDocShell* pDocShell; + +protected: + virtual void onChange(); + +public: + ScForbiddenCharsObj( ScDocShell* pDocSh ); + virtual ~ScForbiddenCharsObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/formulaparserpool.hxx b/sc/inc/formulaparserpool.hxx new file mode 100644 index 000000000000..56d1ac0c9a7b --- /dev/null +++ b/sc/inc/formulaparserpool.hxx @@ -0,0 +1,69 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FORMULAPARSERPOOL_HXX +#define SC_FORMULAPARSERPOOL_HXX + +#include <boost/unordered_map.hpp> +#include <com/sun/star/sheet/XFormulaParser.hpp> + +class ScDocument; + +// ============================================================================ + +/** Stores the used instances of the FilterFormulaParser service + implementations, mapped by the formula namespace they support. */ +class ScFormulaParserPool +{ +public: + explicit ScFormulaParserPool( const ScDocument& rDoc ); + ~ScFormulaParserPool(); + + /** Returns true, if a formula parser is registered for the passed namespace. */ + bool hasFormulaParser( const ::rtl::OUString& rNamespace ); + + /** Returns the formula parser that is registered for the passed namespace. */ + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser > + getFormulaParser( const ::rtl::OUString& rNamespace ); + +private: + typedef ::boost::unordered_map< + ::rtl::OUString, + ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XFormulaParser >, + ::rtl::OUStringHash, + ::std::equal_to< ::rtl::OUString > > ParserMap; + + const ScDocument& mrDoc; + ParserMap maParsers; +}; + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx new file mode 100644 index 000000000000..640573559606 --- /dev/null +++ b/sc/inc/formularesult.hxx @@ -0,0 +1,618 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FORMULARESULT_HXX +#define SC_FORMULARESULT_HXX + +#include "token.hxx" + + +/** Store a variable formula cell result, balancing between runtime performance + and memory consumption. */ +class ScFormulaResult +{ + typedef unsigned char Multiline; + static const Multiline MULTILINE_UNKNOWN = 0; + static const Multiline MULTILINE_FALSE = 1; + static const Multiline MULTILINE_TRUE = 2; + + union + { + double mfValue; // double result direct for performance and memory consumption + const formula::FormulaToken* mpToken; // if not, result token obtained from interpreter + }; + sal_uInt16 mnError; // error code + bool mbToken :1; // whether content of union is a token + bool mbEmpty :1; // empty cell result + bool mbEmptyDisplayedAsString :1; // only if mbEmpty + Multiline meMultiline :2; // result is multiline + + /** Reset mnError, mbEmpty and mbEmptyDisplayedAsString to their defaults + prior to assigning other types */ + inline void ResetToDefaults(); + + /** If token is of formula::svError set error code and decrement RefCount. + If token is of formula::svEmptyCell set mbEmpty and mbEmptyAsString and + decrement RefCount. + If token is of formula::svDouble set mfValue and decrement RefCount. + Else assign token to mpToken. NULL is valid => svUnknown. + Other member variables are set accordingly. + @precondition: Token MUST had been IncRef'ed prior to this call! + @precondition: An already existing different mpToken MUST had been + DecRef'ed prior to this call, p will be assigned to mpToken if not + resolved. + ATTENTION! Token may get deleted in this call! */ + inline void ResolveToken( const formula::FormulaToken * p ); + +public: + /** Effectively type svUnknown. */ + ScFormulaResult() + : mpToken(NULL), mnError(0), mbToken(true), + mbEmpty(false), mbEmptyDisplayedAsString(false), + meMultiline(MULTILINE_UNKNOWN) {} + + ScFormulaResult( const ScFormulaResult & r ) + : mnError( r.mnError), mbToken( r.mbToken), + mbEmpty( r.mbEmpty), + mbEmptyDisplayedAsString( r.mbEmptyDisplayedAsString), + meMultiline( r.meMultiline) + { + if (mbToken) + { + mpToken = r.mpToken; + if (mpToken) + { + // Since matrix dimension and + // results are assigned to a matrix + // cell formula token we have to + // clone that instead of sharing it. + const ScMatrixFormulaCellToken* pMatFormula = + r.GetMatrixFormulaCellToken(); + if (pMatFormula) + mpToken = new ScMatrixFormulaCellToken( *pMatFormula); + mpToken->IncRef(); + } + } + else + mfValue = r.mfValue; + } + + /** Same comments as for SetToken() apply! */ + explicit ScFormulaResult( const formula::FormulaToken* p ) + : mnError(0), mbToken(false), + mbEmpty(false), mbEmptyDisplayedAsString(false), + meMultiline(MULTILINE_UNKNOWN) + { + SetToken( p); + } + + ~ScFormulaResult() + { + if (mbToken && mpToken) + mpToken->DecRef(); + } + + /** Well, guess what ... */ + inline ScFormulaResult & operator=( const ScFormulaResult & r ); + + /** Assignment as in operator=() but without return */ + inline void Assign( const ScFormulaResult & r ); + + /** Sets a direct double if token type is formula::svDouble, or mbEmpty if + formula::svEmptyCell, else token. If p is NULL, that is set as well, effectively + resulting in GetType()==svUnknown. If the already existing result is + ScMatrixFormulaCellToken, the upper left ist set to token. + + ATTENTION! formula::FormulaToken had to be allocated using 'new' and if of type + formula::svDouble and no RefCount was set may not be used after this call + because it was deleted after decrement! */ + inline void SetToken( const formula::FormulaToken* p ); + + /** May be NULL if SetToken() did so, also if type formula::svDouble or formula::svError! */ + inline formula::FormulaConstTokenRef GetToken() const; + + /** Return upper left token if formula::svMatrixCell, else return GetToken(). + May be NULL if SetToken() did so, also if type formula::svDouble or formula::svError! */ + inline formula::FormulaConstTokenRef GetCellResultToken() const; + + /** Return type of result, including formula::svError, formula::svEmptyCell, formula::svDouble and + formula::svMatrixCell. */ + inline formula::StackVar GetType() const; + + /** If type is formula::svMatrixCell return the type of upper left element, else + GetType() */ + inline formula::StackVar GetCellResultType() const; + + /** If type is formula::svEmptyCell (including matrix upper left) and should be + displayed as empty string */ + inline bool IsEmptyDisplayedAsString() const; + + /** Test for cell result type formula::svDouble, including upper left if + formula::svMatrixCell. Also included is formula::svError for legacy, because previously + an error result was treated like a numeric value at some places in + ScFormulaCell. Also included is formula::svEmptyCell as a reference to an empty + cell usually is treated as numeric 0. Use GetCellResultType() for + details instead. */ + inline bool IsValue() const; + + /** Determines whether or not the result is a string containing more than + one paragraph */ + inline bool IsMultiline() const; + + /** Get error code if set or GetCellResultType() is formula::svError or svUnknown, + else 0. */ + inline sal_uInt16 GetResultError() const; + + /** Set error code, don't touch token or double. */ + inline void SetResultError( sal_uInt16 nErr ); + + /** Set direct double. Shouldn't be used externally except in + ScFormulaCell for rounded CalcAsShown or SetErrCode(). If + ScMatrixFormulaCellToken the token isn't replaced but upper left result + is modified instead, but only if it was of type formula::svDouble before or not + set at all. */ + inline void SetDouble( double f ); + + /** Return value if type formula::svDouble or formula::svHybridCell or formula::svMatrixCell and upper + left formula::svDouble, else 0.0 */ + inline double GetDouble() const; + + /** Return string if type formula::svString or formula::svHybridCell or formula::svMatrixCell and + upper left formula::svString, else empty string. */ + inline const String & GetString() const; + + /** Return matrix if type formula::svMatrixCell and ScMatrix present, else NULL. */ + inline ScConstMatrixRef GetMatrix() const; + + /** Return formula string if type formula::svHybridCell, else empty string. */ + inline const String & GetHybridFormula() const; + + /** Should only be used by import filters, best in the order + SetHybridDouble(), SetHybridString(), or only SetHybridString() for + formula string to be compiled later. */ + inline void SetHybridDouble( double f ); + + /** Should only be used by import filters, best in the order + SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only + SetHybridFormula() for formula string to be compiled later. */ + inline void SetHybridString( const String & rStr ); + + /** Should only be used by import filters, best in the order + SetHybridDouble(), SetHybridString()/SetHybridFormula(), or only + SetHybridFormula() for formula string to be compiled later. */ + inline void SetHybridFormula( const String & rFormula ); + + /** Get the const ScMatrixFormulaCellToken* if token is of that type, else + NULL. */ + inline const ScMatrixFormulaCellToken* GetMatrixFormulaCellToken() const; + + /** Get the ScMatrixFormulaCellToken* if token is of that type, else NULL. + Shouldn't be used externally except by ScFormulaCell::SetMatColsRows(). */ + inline ScMatrixFormulaCellToken* GetMatrixFormulaCellTokenNonConst(); +}; + + +inline void ScFormulaResult::ResetToDefaults() +{ + mnError = 0; + mbEmpty = false; + mbEmptyDisplayedAsString = false; + meMultiline = MULTILINE_UNKNOWN; +} + + +inline void ScFormulaResult::ResolveToken( const formula::FormulaToken * p ) +{ + ResetToDefaults(); + if (!p) + { + mpToken = p; + mbToken = true; + } + else + { + switch (p->GetType()) + { + case formula::svError: + mnError = p->GetError(); + p->DecRef(); + mbToken = false; + // set in case mnError is 0 now, which shouldn't happen but ... + mfValue = 0.0; + meMultiline = MULTILINE_FALSE; + break; + case formula::svEmptyCell: + mbEmpty = true; + mbEmptyDisplayedAsString = static_cast<const ScEmptyCellToken*>(p)->IsDisplayedAsString(); + p->DecRef(); + mbToken = false; + meMultiline = MULTILINE_FALSE; + break; + case formula::svDouble: + mfValue = p->GetDouble(); + p->DecRef(); + mbToken = false; + meMultiline = MULTILINE_FALSE; + break; + default: + mpToken = p; + mbToken = true; + } + } +} + + +inline ScFormulaResult & ScFormulaResult::operator=( const ScFormulaResult & r ) +{ + Assign( r); + return *this; +} + + +inline void ScFormulaResult::Assign( const ScFormulaResult & r ) +{ + if (this == &r) + return; + if (r.mbEmpty) + { + if (mbToken && mpToken) + mpToken->DecRef(); + mbToken = false; + mbEmpty = true; + mbEmptyDisplayedAsString = r.mbEmptyDisplayedAsString; + meMultiline = r.meMultiline; + } + else if (r.mbToken) + { + // Matrix formula cell token must be cloned, see copy-ctor. + const ScMatrixFormulaCellToken* pMatFormula = + r.GetMatrixFormulaCellToken(); + if (pMatFormula) + SetToken( new ScMatrixFormulaCellToken( *pMatFormula)); + else + SetToken( r.mpToken); + } + else + SetDouble( r.mfValue); + // If there was an error there will be an error, no matter what Set...() + // methods did. + mnError = r.mnError; +} + + +inline void ScFormulaResult::SetToken( const formula::FormulaToken* p ) +{ + ResetToDefaults(); + if (p) + p->IncRef(); + // Handle a result obtained from the interpreter to be assigned to a matrix + // formula cell's ScMatrixFormulaCellToken. + ScMatrixFormulaCellToken* pMatFormula = GetMatrixFormulaCellTokenNonConst(); + if (pMatFormula) + { + const ScMatrixCellResultToken* pMatResult = + (p && p->GetType() == formula::svMatrixCell ? + dynamic_cast<const ScMatrixCellResultToken*>(p) : NULL); + if (pMatResult) + { + const ScMatrixFormulaCellToken* pNewMatFormula = + dynamic_cast<const ScMatrixFormulaCellToken*>(pMatResult); + if (pNewMatFormula) + { + DBG_ERRORFILE( "ScFormulaResult::SetToken: pNewMatFormula and pMatFormula, overriding matrix formula dimension; intended?"); + pMatFormula->SetMatColsRows( pNewMatFormula->GetMatCols(), + pNewMatFormula->GetMatRows()); + } + pMatFormula->Assign( *pMatResult); + p->DecRef(); + } + else if (p) + { + // This may be the result of some constant expression like + // {="string"} that doesn't result in a matrix but still would + // display the result in all cells of this matrix formula. + pMatFormula->Assign( *p); + p->DecRef(); + } + else + { + // NULL result? Well, if you say so ... + pMatFormula->ResetResult(); + } + } + else + { + if (mbToken && mpToken) + mpToken->DecRef(); + ResolveToken( p); + } +} + + +inline void ScFormulaResult::SetDouble( double f ) +{ + ResetToDefaults(); + // Handle a result obtained from the interpreter to be assigned to a matrix + // formula cell's ScMatrixFormulaCellToken. + ScMatrixFormulaCellToken* pMatFormula = GetMatrixFormulaCellTokenNonConst(); + if (pMatFormula) + pMatFormula->SetUpperLeftDouble( f); + else + { + if (mbToken && mpToken) + mpToken->DecRef(); + mfValue = f; + mbToken = false; + meMultiline = MULTILINE_FALSE; + } +} + + +inline formula::StackVar ScFormulaResult::GetType() const +{ + // Order is significant. + if (mnError) + return formula::svError; + if (mbEmpty) + return formula::svEmptyCell; + if (!mbToken) + return formula::svDouble; + if (mpToken) + return mpToken->GetType(); + return formula::svUnknown; +} + + +inline formula::StackVar ScFormulaResult::GetCellResultType() const +{ + formula::StackVar sv = GetType(); + if (sv == formula::svMatrixCell) + // don't need to test for mpToken here, GetType() already did it + sv = static_cast<const ScMatrixCellResultToken*>(mpToken)->GetUpperLeftType(); + return sv; +} + + +inline bool ScFormulaResult::IsEmptyDisplayedAsString() const +{ + if (mbEmpty) + return mbEmptyDisplayedAsString; + if (GetType() == formula::svMatrixCell) + { + // don't need to test for mpToken here, GetType() already did it + const ScEmptyCellToken* p = dynamic_cast<const ScEmptyCellToken*>( + static_cast<const ScMatrixCellResultToken*>( + mpToken)->GetUpperLeftToken().operator->()); + if (p) + return p->IsDisplayedAsString(); + } + return false; +} + + +inline bool ScFormulaResult::IsValue() const +{ + formula::StackVar sv = GetCellResultType(); + return sv == formula::svDouble || sv == formula::svError || sv == formula::svEmptyCell; +} + +inline bool ScFormulaResult::IsMultiline() const +{ + if (meMultiline == MULTILINE_UNKNOWN) + { + const String& rStr = GetString(); + if (rStr.Len() && rStr.Search( _LF ) != STRING_NOTFOUND) + const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_TRUE; + else + const_cast<ScFormulaResult*>(this)->meMultiline = MULTILINE_FALSE; + } + return meMultiline == MULTILINE_TRUE; +} + + +inline sal_uInt16 ScFormulaResult::GetResultError() const +{ + if (mnError) + return mnError; + formula::StackVar sv = GetCellResultType(); + if (sv == formula::svError) + { + if (GetType() == formula::svMatrixCell) + // don't need to test for mpToken here, GetType() already did it + return static_cast<const ScMatrixCellResultToken*>(mpToken)-> + GetUpperLeftToken()->GetError(); + if (mpToken) + return mpToken->GetError(); + } + return 0; +} + + +inline void ScFormulaResult::SetResultError( sal_uInt16 nErr ) +{ + mnError = nErr; +} + + +inline formula::FormulaConstTokenRef ScFormulaResult::GetToken() const +{ + if (mbToken) + return mpToken; + return NULL; +} + + +inline formula::FormulaConstTokenRef ScFormulaResult::GetCellResultToken() const +{ + if (GetType() == formula::svMatrixCell) + // don't need to test for mpToken here, GetType() already did it + return static_cast<const ScMatrixCellResultToken*>(mpToken)->GetUpperLeftToken(); + return GetToken(); +} + + +inline double ScFormulaResult::GetDouble() const +{ + if (mbToken) + { + // Should really not be of type formula::svDouble here. + if (mpToken) + { + switch (mpToken->GetType()) + { + case formula::svHybridCell: + return mpToken->GetDouble(); + case formula::svMatrixCell: + { + const ScMatrixCellResultToken* p = + static_cast<const ScMatrixCellResultToken*>(mpToken); + if (p->GetUpperLeftType() == formula::svDouble) + return p->GetUpperLeftToken()->GetDouble(); + } + break; + default: + ; // nothing + } + } + return 0.0; + } + if (mbEmpty) + return 0.0; + return mfValue; +} + + +inline const String & ScFormulaResult::GetString() const +{ + if (mbToken && mpToken) + { + switch (mpToken->GetType()) + { + case formula::svString: + case formula::svHybridCell: + return mpToken->GetString(); + case formula::svMatrixCell: + { + const ScMatrixCellResultToken* p = + static_cast<const ScMatrixCellResultToken*>(mpToken); + if (p->GetUpperLeftType() == formula::svString) + return p->GetUpperLeftToken()->GetString(); + } + break; + default: + ; // nothing + } + } + return EMPTY_STRING; +} + + +inline ScConstMatrixRef ScFormulaResult::GetMatrix() const +{ + if (GetType() == formula::svMatrixCell) + return static_cast<const ScToken*>(mpToken)->GetMatrix(); + return NULL; +} + + +inline const String & ScFormulaResult::GetHybridFormula() const +{ + if (GetType() == formula::svHybridCell) + { + const ScHybridCellToken* p = dynamic_cast<const ScHybridCellToken*>(mpToken); + if (p) + return p->GetFormula(); + } + return EMPTY_STRING; +} + + +inline void ScFormulaResult::SetHybridDouble( double f ) +{ + ResetToDefaults(); + if (mbToken && mpToken) + { + String aString( GetString()); + String aFormula( GetHybridFormula()); + mpToken->DecRef(); + mpToken = new ScHybridCellToken( f, aString, aFormula); + mpToken->IncRef(); + } + else + { + mfValue = f; + mbToken = false; + meMultiline = MULTILINE_FALSE; + } +} + + +inline void ScFormulaResult::SetHybridString( const String & rStr ) +{ + // Obtain values before changing anything. + double f = GetDouble(); + String aFormula( GetHybridFormula()); + ResetToDefaults(); + if (mbToken && mpToken) + mpToken->DecRef(); + mpToken = new ScHybridCellToken( f, rStr, aFormula); + mpToken->IncRef(); + mbToken = true; +} + + +inline void ScFormulaResult::SetHybridFormula( const String & rFormula ) +{ + // Obtain values before changing anything. + double f = GetDouble(); + String aStr( GetString()); + ResetToDefaults(); + if (mbToken && mpToken) + mpToken->DecRef(); + mpToken = new ScHybridCellToken( f, aStr, rFormula); + mpToken->IncRef(); + mbToken = true; +} + + +inline const ScMatrixFormulaCellToken* ScFormulaResult::GetMatrixFormulaCellToken() const +{ + return (GetType() == formula::svMatrixCell ? + dynamic_cast<const ScMatrixFormulaCellToken*>(mpToken) : NULL); +} + + +inline ScMatrixFormulaCellToken* ScFormulaResult::GetMatrixFormulaCellTokenNonConst() +{ + return const_cast<ScMatrixFormulaCellToken*>( GetMatrixFormulaCellToken()); +} + + +#endif // SC_FORMULARESULT_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx new file mode 100644 index 000000000000..93f26c373bb8 --- /dev/null +++ b/sc/inc/funcdesc.hxx @@ -0,0 +1,420 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FUNCDESC_HXX +#define SC_FUNCDESC_HXX + +/* Function descriptions for function wizard / autopilot */ + +#include "scfuncs.hrc" + +#include <formula/IFunctionDescription.hxx> +#include <sal/types.h> +#include <rtl/ustring.hxx> + +#define MAX_FUNCCAT 12 /* maximum number of categories for functions */ +#define LRU_MAX 10 /* maximal number of last recently used functions */ + +class ScFuncDesc; +class ScFunctionList; +class ScFunctionCategory; +class ScFunctionMgr; + +/** + Stores and generates human readable descriptions for spreadsheet-functions, + e.g.\ functions used in formulas in calc +*/ +class ScFuncDesc : public formula::IFunctionDescription +{ +public: + ScFuncDesc(); + virtual ~ScFuncDesc(); + + /** + Clears the object + + Deletes all objets referenced by the pointers in the class, + sets pointers to NULL, and all numerical variables to 0 + */ + void Clear(); + + /** + Fills a mapping with indexes for non-suppressed arguments + + Fills mapping from visible arguments to real arguments, e.g. if of 4 + parameters the second one is suppressed {0,2,3}. For VAR_ARGS + parameters only one element is added to the end of the sequence. + + @param _rArgumens + Vector, which the indices are written to + */ + virtual void fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArguments) const ; + + /** + Returns the category of the function + + @return the category of the function + */ + virtual const formula::IFunctionCategory* getCategory() const ; + + /** + Returns the description of the function + + @return the description of the function, or an empty OUString if there is no description + */ + virtual ::rtl::OUString getDescription() const ; + + /** + Returns the function signature with parameters from the passed string array. + + @return function signature with parameters + */ + virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ; + + /** + Returns the name of the function + + @return the name of the function, or an empty OUString if there is no name + */ + virtual ::rtl::OUString getFunctionName() const ; + + /** + Returns the help id of the function + + @return help id of the function + */ + virtual ::rtl::OString getHelpId() const ; + + /** + Returns number of arguments + + @return help id of the function + */ + virtual sal_uInt32 getParameterCount() const ; + + /** + Returns description of parameter at given position + + @param _nPos + Position of the parameter + + @return OUString description of the parameter + */ + virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ; + + /** + Returns name of parameter at given position + + @param _nPos + Position of the parameter + + @return OUString name of the parameter + */ + virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ; + + /** + Returns list of all parameter names + + @return OUString containing separated list of all parameter names + */ + ::rtl::OUString GetParamList() const; + + /** + Returns the full function signature + + @return OUString of the form "FUNCTIONNAME( parameter list )" + */ + virtual ::rtl::OUString getSignature() const ; + + /** + Returns the number of non-suppressed arguments + + In case there are variable arguments the number of fixed non-suppressed + arguments plus VAR_ARGS, same as for nArgCount (variable arguments can't + be suppressed). The two functions are equal apart from return type and + name. + + @return number of non-suppressed arguments + */ + sal_uInt16 GetSuppressedArgCount() const; + virtual xub_StrLen getSuppressedArgumentCount() const ; + + /** + Requests function data from AddInCollection + + Logs error message on failure for debugging purposes + */ + virtual void initArgumentInfo() const; + + /** + Returns true if parameter at given position is optional + + @param _nPos + Position of the parameter + + @return true if optional, false if not optional + */ + virtual bool isParameterOptional(sal_uInt32 _nPos) const ; + + /** + Compares functions by name, respecting special characters + + @param a + pointer to first function descriptor + + @param b + pointer to second function descriptor + + @return "(a < b)" + */ + static bool compareByName(const ScFuncDesc* a, const ScFuncDesc* b); + + /** + Stores whether a parameter is optional or suppressed + */ + struct ParameterFlags + { + bool bOptional :1; /**< Parameter is optional */ + bool bSuppress :1; /**< Suppress parameter in UI because not implemented yet */ + + ParameterFlags() : bOptional(false), bSuppress(false) {} + }; + + + + ::rtl::OUString *pFuncName; /**< Function name */ + ::rtl::OUString *pFuncDesc; /**< Description of function */ + ::rtl::OUString **ppDefArgNames; /**< Parameter name(s) */ + ::rtl::OUString **ppDefArgDescs; /**< Description(s) of parameter(s) */ + ParameterFlags *pDefArgFlags; /**< Flags for each parameter */ + sal_uInt16 nFIndex; /**< Unique function index */ + sal_uInt16 nCategory; /**< Function category */ + sal_uInt16 nArgCount; /**< All parameter count, suppressed and unsuppressed */ + rtl::OString sHelpId; /**< HelpId of function */ + bool bIncomplete :1; /**< Incomplete argument info (set for add-in info from configuration) */ + bool bHasSuppressedArgs :1; /**< Whether there is any suppressed parameter. */ +}; + +/** + List of spreadsheet functions. + Generated by retrieving functions from resources, AddIns and StarOne AddIns, + and storing these in one linked list. Functions can be retrieved by index and + by iterating through the list, starting at the First element, and retrieving + the Next elements one by one. + + The length of the longest function name can be retrieved for easier + processing (i.e printing a function list). +*/ +class ScFunctionList +{ +public: + ScFunctionList(); + ~ScFunctionList(); + + sal_uInt32 GetCount() const + { return aFunctionList.size(); } + + const ScFuncDesc* First(); + + const ScFuncDesc* Next(); + + const ScFuncDesc* GetFunction( sal_uInt32 nIndex ) const; + + xub_StrLen GetMaxFuncNameLen() const + { return nMaxFuncNameLen; } + +private: + ::std::vector<const ScFuncDesc*> aFunctionList; /**< List of functions */ + ::std::vector<const ScFuncDesc*>::iterator aFunctionListIter; /**< position in function list */ + xub_StrLen nMaxFuncNameLen; /**< Length of longest function name */ +}; + +/** + Category of spreadsheet functions. + + Contains the name, index and function manager of a category, + as well as a list of functions in the category +*/ +class ScFunctionCategory : public formula::IFunctionCategory +{ +public: + ScFunctionCategory(ScFunctionMgr* _pMgr,::std::vector<const ScFuncDesc*>* _pCategory,sal_uInt32 _nCategory) + : m_pMgr(_pMgr),m_pCategory(_pCategory),m_nCategory(_nCategory){} + virtual ~ScFunctionCategory(){} + + /** + @return count of functions in this category + */ + virtual sal_uInt32 getCount() const; + virtual const formula::IFunctionManager* getFunctionManager() const; + + /** + Gives the _nPos'th function in this category. + + @param _nPos + position of function in this category. + + @return function at the _nPos postion in this category, null if _nPos out of bounds. + */ + virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const; + + /** + @return index number of this category. + */ + virtual sal_uInt32 getNumber() const; + virtual ::rtl::OUString getName() const; + +private: + ScFunctionMgr* m_pMgr; /**< function manager for this category */ + ::std::vector<const ScFuncDesc*>* m_pCategory; /**< list of functions in this category */ + mutable ::rtl::OUString m_sName; /**< name of this category */ + sal_uInt32 m_nCategory; /**< index number of this category */ +}; + +#define SC_FUNCGROUP_COUNT ID_FUNCTION_GRP_ADDINS +/** + Stores spreadsheet functions in categories, including a cumulative ('All') category and makes them accessible. +*/ +class ScFunctionMgr : public formula::IFunctionManager +{ +public: + /** + Retrieves all calc functions, generates cumulative ('All') category, and the categories. + + The function lists of the categories are sorted by (case insensitive) function name + */ + ScFunctionMgr(); + virtual ~ScFunctionMgr(); + + /** + Returns name of category. + + @param _nCategoryNumber + index of category + + @return name of the category specified by _nCategoryNumber, empty string if _nCategoryNumber out of bounds + */ + static ::rtl::OUString GetCategoryName(sal_uInt32 _nCategoryNumber ); + + /** + Returns function by name. + + Searches for a function with the function name rFName, while ignoring case. + + @param rFName + name of the function + + @return pointer to function with the name rFName, null if no such function was found. + */ + const ScFuncDesc* Get( const ::rtl::OUString& rFName ) const; + + /** + Returns function by index. + + Searches for a function with the function index nFIndex. + + @param nFIndex + index of the function + + @return pointer to function with the index nFIndex, null if no such function was found. + */ + const ScFuncDesc* Get( sal_uInt16 nFIndex ) const; + + /** + Returns the first function in category nCategory. + + Selects nCategory as current category and returns first element of this. + + @param nCategory + index of requested category + + @return pointer to first element in current category, null if nCategory out of bounds + */ + const ScFuncDesc* First( sal_uInt16 nCategory = 0 ) const; + + /** + Returns the next function of the current category. + + @return pointer to the next function in current category, null if current category not set. + */ + const ScFuncDesc* Next() const; + + /** + @return number of categories, not counting the cumulative category ('All') + */ + virtual sal_uInt32 getCount() const; + + /** + Returns a category. + + Creates an IFunctionCategory object from a category specified by nPos. + + @param nPos + the index of the category, note that 0 maps to the first category not the cumulative ('All') category. + + @return pointer to an IFunctionCategory object, null if nPos out of bounds. + */ + virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const; + + /** + Appends the last recently used functions. + + Takes the last recently used functions, but maximal LRU_MAX, and appends them to the given vector _rLastRUFunctions. + + @param _rLastRUFunctions + a vector of pointer to IFunctionDescription, by reference. + */ + virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const; + + /** + Implemented because of inheritance \see ScFunctionMgr::Get(const ::rtl::OUString&) const + */ + virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const; + + /** + Maps Etoken to character + + Used for retrieving characters for parantheses and separators. + + @param _eToken + token for which, the corresponding character is retrieved + + @return character + */ + virtual sal_Unicode getSingleToken(const formula::IFunctionManager::EToken _eToken) const; + +private: + ScFunctionList* pFuncList; /**< list of all calc functions */ + ::std::vector<const ScFuncDesc*>* aCatLists[MAX_FUNCCAT]; /**< array of all categories, 0 is the cumulative ('All') category */ + mutable ::std::vector<const ScFuncDesc*>::iterator pCurCatListIter; /**< position in current category */ + mutable ::std::vector<const ScFuncDesc*>::iterator pCurCatListEnd; /**< end of current category */ +}; + +#endif // SC_FUNCDESC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/funcuno.hxx b/sc/inc/funcuno.hxx new file mode 100644 index 000000000000..45758a23d3da --- /dev/null +++ b/sc/inc/funcuno.hxx @@ -0,0 +1,150 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_FUNCUNO_HXX +#define SC_FUNCUNO_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/sheet/XFunctionAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <cppuhelper/implbase3.hxx> +#include <svl/lstner.hxx> + +class ScDocument; +class ScDocOptions; + + +::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + ScFunctionAccess_CreateInstance( + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory >& ); + + +class ScTempDocCache +{ +private: + ScDocument* pDoc; + sal_Bool bInUse; + +public: + ScTempDocCache(); + ~ScTempDocCache(); + + ScDocument* GetDocument() const { return pDoc; } + sal_Bool IsInUse() const { return bInUse; } + void SetInUse( sal_Bool bSet ) { bInUse = bSet; } + + void SetDocument( ScDocument* pNew ); + void Clear(); +}; + +class ScFunctionAccess : public cppu::WeakImplHelper3< + com::sun::star::sheet::XFunctionAccess, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo>, + public SfxListener +{ +private: + ScTempDocCache aDocCache; + ScDocOptions* pOptions; + SfxItemPropertyMap aPropertyMap; + bool mbArray; + bool mbValid; + +public: + ScFunctionAccess(); + virtual ~ScFunctionAccess(); + + static ::rtl::OUString getImplementationName_Static(); + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_Static(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XFunctionAccess + virtual ::com::sun::star::uno::Any SAL_CALL callFunction( + const ::rtl::OUString& aName, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any >& aArguments ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx new file mode 100644 index 000000000000..c2d70620764d --- /dev/null +++ b/sc/inc/global.hxx @@ -0,0 +1,791 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCGLOB_HXX +#define SC_SCGLOB_HXX + +#include "address.hxx" +#include <i18npool/lang.h> +#include <tools/stream.hxx> +#include <osl/endian.h> +#include <com/sun/star/uno/Reference.hxx> +#include "scdllapi.h" + +#include <boost/unordered_map.hpp> + +class ImageList; +class Bitmap; +class SfxItemSet; +class Color; + +// Macro for call profiler (WinNT) +// S_CAP starts a measurement, E_CAP stops it +#if defined( WNT ) && defined( PROFILE ) + +extern "C" { + void StartCAP(); + void StopCAP(); + void DumpCAP(); +}; + +#define S_CAP StartCAP(); +#define E_CAP StopCAP(); DumpCAP(); + +#endif + +#define SC_COLLATOR_IGNORES ( \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ) + +#define SC_TRANSLITERATION_IGNORECASE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ) +#define SC_TRANSLITERATION_CASESENSE 0 + +// Calc has lots of names... +// Clipboard names are in so3/soapp.hxx now +// STRING_SCAPP was "scalc3", "scalc4", now just "scalc" + +#define STRING_SCAPP "scalc" +#define STRING_SCSTREAM "StarCalcDocument" + +#define STRING_STANDARD "Standard" + +// characters + +// '\r' does not work on a Mac... +#define CHAR_CR char(13) + +const sal_Unicode CHAR_NBSP = 0x00A0; +const sal_Unicode CHAR_SHY = 0x00AD; +const sal_Unicode CHAR_ZWSP = 0x200B; +const sal_Unicode CHAR_LRM = 0x200E; +const sal_Unicode CHAR_RLM = 0x200F; +const sal_Unicode CHAR_NBHY = 0x2011; +const sal_Unicode CHAR_ZWNBSP = 0x2060; + +// ---------------------------------------------------------------------------- + +#define MINDOUBLE 1.7e-307 +#define MAXDOUBLE 1.7e307 + +#define MINZOOM 20 +#define MAXZOOM 400 + +const SCSIZE MAXSUBTOTAL = 3; +const SCSIZE MAXQUERY = 8; + +#define SC_START_INDEX_DB_COLL 50000 + // Above this threshold are indices + // for data base areas + +#define PIXEL_PER_INCH 96.0 + +#define CM_PER_INCH 2.54 +#define POINTS_PER_INCH 72.27 +#define PIXEL_PER_POINT (PIXEL_PER_INCH / POINTS_PER_INCH) +#define INCHT_PER_CM (1.0 / CM_PER_INCH) +#define POINTS_PER_CM (POINTS_PER_INCH / CM_PER_INCH) +#define TWIPS_PER_POINT 20.0 +#define TWIPS_PER_INCH (TWIPS_PER_POINT * POINTS_PER_INCH) +#define TWIPS_PER_CM (TWIPS_PER_INCH / CM_PER_INCH) +#define CM_PER_TWIPS (CM_PER_INCH / TWIPS_PER_INCH) +#define TWIPS_PER_PIXEL (TWIPS_PER_INCH / PIXEL_PER_INCH) +#define TWIPS_PER_CHAR (TWIPS_PER_INCH / 13.6) +#define PIXEL_PER_TWIPS (PIXEL_PER_INCH / TWIPS_PER_INCH) +#define HMM_PER_TWIPS (CM_PER_TWIPS * 1000.0) + +#define STD_COL_WIDTH 1285 +#define STD_EXTRA_WIDTH 113 // 2mm extra for optimal width + // standard row height: text + margin - STD_ROWHEIGHT_DIFF + + +#define MAX_EXTRA_WIDTH 23811 // 42cm in TWIPS +#define MAX_EXTRA_HEIGHT 23811 +#define MAX_COL_WIDTH 56693 // 1m in TWIPS +#define MAX_COL_HEIGHT 56693 + +#define STD_ROWHEIGHT_DIFF 23 +#define STD_FONT_HEIGHT 200 // equates 10 points + +//! use ScGlobal::nStdRowHeight instead of STD_ROW_HEIGHT ! + +#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) // 256 Twips, 0.45 cm + + // standard size as OLE server (cells) +#define OLE_STD_CELLS_X 4 +#define OLE_STD_CELLS_Y 5 + +#define SC_SIZE_OPTIMUM 0xFFFF + + // update flags +#define UF_SCROLL_LEFT 1 +#define UF_SCROLL_RIGHT 2 +#define UF_SCROLL_UP 4 +#define UF_SCROLL_DOWN 8 +#define UF_ROW 16 +#define UF_VIEW 32 + + // repaint flags (for messages) +#define PAINT_GRID 1 +#define PAINT_TOP 2 +#define PAINT_LEFT 4 +#define PAINT_EXTRAS 8 +#define PAINT_MARKS 16 +#define PAINT_OBJECTS 32 +#define PAINT_SIZE 64 +#define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE ) + + + // flags for columns / rows + // FILTERED always together with HIDDEN + // FILTERED and MANUALSIZE only valid for rows +const sal_uInt8 CR_HIDDEN = 1; +const sal_uInt8 CR_MANUALBREAK = 8; +const sal_uInt8 CR_FILTERED = 16; +const sal_uInt8 CR_MANUALSIZE = 32; +const sal_uInt8 CR_ALL = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE); + +typedef sal_uInt8 ScBreakType; +const ScBreakType BREAK_NONE = 0; +const ScBreakType BREAK_PAGE = 1; +const ScBreakType BREAK_MANUAL = 2; + +// insert/delete flags +const sal_uInt16 IDF_NONE = 0x0000; +const sal_uInt16 IDF_VALUE = 0x0001; /// Numeric values (and numeric results if IDF_FORMULA is not set). +const sal_uInt16 IDF_DATETIME = 0x0002; /// Dates, times, datetime values. +const sal_uInt16 IDF_STRING = 0x0004; /// Strings (and string results if IDF_FORMULA is not set). +const sal_uInt16 IDF_NOTE = 0x0008; /// Cell notes. +const sal_uInt16 IDF_FORMULA = 0x0010; /// Formula cells. +const sal_uInt16 IDF_HARDATTR = 0x0020; /// Hard cell attributes. +const sal_uInt16 IDF_STYLES = 0x0040; /// Cell styles. +const sal_uInt16 IDF_OBJECTS = 0x0080; /// Drawing objects. +const sal_uInt16 IDF_EDITATTR = 0x0100; /// Rich-text attributes. +const sal_uInt16 IDF_SPECIAL_BOOLEAN = 0x1000; +const sal_uInt16 IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES; +const sal_uInt16 IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA; +const sal_uInt16 IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS; +const sal_uInt16 IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes. +const sal_uInt16 IDF_ADDNOTES = 0x0400; /// Internal use only (copy from clip): do not delete existing cell contents when pasting notes. + +/// Copy flags for auto/series fill functions: do not touch notes and drawing objects. +const sal_uInt16 IDF_AUTOFILL = IDF_ALL & ~(IDF_NOTE | IDF_OBJECTS); + +#define PASTE_NOFUNC 0 +#define PASTE_ADD 1 +#define PASTE_SUB 2 +#define PASTE_MUL 3 +#define PASTE_DIV 4 + +#define PASTE_NONEMPTY 5 + + // bits for HasAttr +#define HASATTR_LINES 1 +#define HASATTR_MERGED 2 +#define HASATTR_OVERLAPPED 4 +#define HASATTR_PROTECTED 8 +#define HASATTR_SHADOW 16 +#define HASATTR_NEEDHEIGHT 32 +#define HASATTR_SHADOW_RIGHT 64 +#define HASATTR_SHADOW_DOWN 128 +#define HASATTR_AUTOFILTER 256 +#define HASATTR_CONDITIONAL 512 +#define HASATTR_ROTATE 1024 +#define HASATTR_NOTOVERLAPPED 2048 +#define HASATTR_RTL 4096 +#define HASATTR_RIGHTORCENTER 8192 // right or centered logical alignment + +#define HASATTR_PAINTEXT ( HASATTR_LINES | HASATTR_SHADOW | HASATTR_CONDITIONAL ) + + +#define EMPTY_STRING ScGlobal::GetEmptyString() + + // layer id's for drawing +#define SC_LAYER_FRONT 0 +#define SC_LAYER_BACK 1 +#define SC_LAYER_INTERN 2 +#define SC_LAYER_CONTROLS 3 +#define SC_LAYER_HIDDEN 4 + + // link tables +#define SC_LINK_NONE 0 +#define SC_LINK_NORMAL 1 +#define SC_LINK_VALUE 2 + + // input +#define SC_ENTER_NORMAL 0 +#define SC_ENTER_BLOCK 1 +#define SC_ENTER_MATRIX 2 + + // step = 10pt, max. indention = 100 steps +#define SC_INDENT_STEP 200 +#define SC_MAX_INDENT 20000 + + // scenario flags +#define SC_SCENARIO_COPYALL 1 +#define SC_SCENARIO_SHOWFRAME 2 +#define SC_SCENARIO_PRINTFRAME 4 +#define SC_SCENARIO_TWOWAY 8 +#define SC_SCENARIO_ATTRIB 16 +#define SC_SCENARIO_VALUE 32 +#define SC_SCENARIO_PROTECT 64 + + +#ifndef DELETEZ +#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; } +#endif + + // is bit set in set? +#define IS_SET(bit,set)(((set)&(bit))==(bit)) + +#define SEL_ALL -1 // input line: select all +#define RES_CANCEL 0 // results of function AutoPilot pages +#define RES_BACKWARD 1 +#define RES_END 2 + +enum CellType + { + CELLTYPE_NONE, + CELLTYPE_VALUE, + CELLTYPE_STRING, + CELLTYPE_FORMULA, + CELLTYPE_NOTE, + CELLTYPE_EDIT, + CELLTYPE_SYMBOLS // for load/save +#if DBG_UTIL + ,CELLTYPE_DESTROYED +#endif + }; + +enum DelCellCmd + { + DEL_CELLSUP, + DEL_CELLSLEFT, + DEL_DELROWS, + DEL_DELCOLS, + DEL_NONE + }; + +enum InsCellCmd + { + INS_CELLSDOWN, + INS_CELLSRIGHT, + INS_INSROWS, + INS_INSCOLS, + INS_NONE + }; + +enum UpdateRefMode + { + URM_INSDEL, + URM_COPY, + URM_MOVE, + URM_REORDER + }; + +enum FillDir + { + FILL_TO_BOTTOM, + FILL_TO_RIGHT, + FILL_TO_TOP, + FILL_TO_LEFT + }; + +enum FillCmd + { + FILL_SIMPLE, + FILL_LINEAR, + FILL_GROWTH, + FILL_DATE, + FILL_AUTO + }; + +enum FillDateCmd + { + FILL_DAY, + FILL_WEEKDAY, + FILL_MONTH, + FILL_YEAR + }; + +enum ScDirection + { + DIR_BOTTOM, + DIR_RIGHT, + DIR_TOP, + DIR_LEFT + }; + +enum ScSizeMode + { + SC_SIZE_DIRECT, // set size or hide if value is 0 + SC_SIZE_OPTIMAL, // set optimal size for everything + SC_SIZE_SHOW, // show with original size + SC_SIZE_VISOPT, // set optimal size only if visible + SC_SIZE_ORIGINAL // only set size, don't change visible flag + }; + +enum ScInputMode + { + SC_INPUT_NONE, + SC_INPUT_TYPE, // input, while not in inplace mode + SC_INPUT_TABLE, // text cursor in the table + SC_INPUT_TOP // text cursor in the input line + }; + +enum ScVObjMode // output modes of objects on a page +{ + VOBJ_MODE_SHOW, + VOBJ_MODE_HIDE +}; + +enum ScAnchorType // anchor of a character object +{ + SCA_CELL, + SCA_PAGE, + SCA_DONTKNOW // for multi selection +}; + +enum ScGetDBMode +{ + SC_DB_MAKE, // create "untitled" (if necessary) + SC_DB_IMPORT, // create "Importx" (if necessary) + SC_DB_OLD // don't create +}; + +/// For ScDBFunc::GetDBData() +enum ScGetDBSelection +{ + /** Keep selection as is, expand to used data area if no selection. */ + SC_DBSEL_KEEP, + + /** Shrink selection to sheet's data area. */ + SC_DBSEL_SHRINK_TO_SHEET_DATA, + + /** Shrink selection to actually used data area within the selection. */ + SC_DBSEL_SHRINK_TO_USED_DATA, + + /** If only one row or portion thereof is selected, shrink row to used data + columns and select further rows down until end of data. If an area is + selected, shrink rows to actually used columns. Else, no selection, + expand to used data area. */ + SC_DBSEL_ROW_DOWN, + + /** Behave as if the range corresponding to a ScDBData area was selected, + for API use. */ + SC_DBSEL_FORCE_MARK +}; + +enum ScLkUpdMode // modes for updating links +{ + LM_ALWAYS, + LM_NEVER, + LM_ON_DEMAND, + LM_UNKNOWN +}; + + +// enum with values equal to old DBObject enum from sdb +enum ScDBObject +{ + ScDbTable, + ScDbQuery +}; + +struct ScImportParam +{ + SCCOL nCol1; + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + sal_Bool bImport; + String aDBName; // alias of data base + String aStatement; + sal_Bool bNative; + sal_Bool bSql; // statement or name? + sal_uInt8 nType; // enum DBObject + + ScImportParam(); + ScImportParam( const ScImportParam& r ); + ~ScImportParam(); + + ScImportParam& operator= ( const ScImportParam& r ); + sal_Bool operator== ( const ScImportParam& r ) const; +}; + +struct ScStringHashCode +{ + size_t operator()( const String& rStr ) const + { + return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() ); + } +}; + +class ScDocument; +class ScDocShell; +class ScDocShellRef; +class SvxSearchItem; +class ScAutoFormat; +class FuncCollection; +class ScUnoAddInCollection; +class ScUserList; +class SvxBrushItem; +class ScFunctionList; +class ScFunctionMgr; +class SfxItemPool; +class SdrModel; +class EditTextObject; +class SfxObjectShell; +class SvNumberFormatter; +class ScUnitConverter; +class CharClass; +class LocaleDataWrapper; +class SvtSysLocale; +class CalendarWrapper; +class CollatorWrapper; +class IntlWrapper; +class OutputDevice; + +namespace com { namespace sun { namespace star { + namespace lang { + struct Locale; + } + namespace i18n { + class XOrdinalSuffix; + } +}}} +namespace utl { + class TransliterationWrapper; +} + +#ifndef _SCALC_EXE +class ScGlobal +{ + static SvxSearchItem* pSearchItem; + static ScAutoFormat* pAutoFormat; + static FuncCollection* pFuncCollection; + static ScUnoAddInCollection* pAddInCollection; + static ScUserList* pUserList; + static String** ppRscString; + static String* pStrScDoc; + static String* pEmptyString; + static String* pStrClipDocName; + static SvxBrushItem* pEmptyBrushItem; + static SvxBrushItem* pButtonBrushItem; + static SvxBrushItem* pEmbeddedBrushItem; + static SvxBrushItem* pProtectedBrushItem; + + static ImageList* pOutlineBitmaps; + + static ScFunctionList* pStarCalcFunctionList; + static ScFunctionMgr* pStarCalcFunctionMgr; + + static ScUnitConverter* pUnitConverter; + + static SvNumberFormatter* pEnglishFormatter; // for UNO / XML export + + static ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XOrdinalSuffix> xOrdinalSuffix; + static CalendarWrapper* pCalendar; + static CollatorWrapper* pCaseCollator; + static CollatorWrapper* pCollator; + static ::utl::TransliterationWrapper* pTransliteration; + static ::utl::TransliterationWrapper* pCaseTransliteration; + static IntlWrapper* pScIntlWrapper; + static ::com::sun::star::lang::Locale* pLocale; + +public: + static SvtSysLocale* pSysLocale; + // for faster access a pointer to the single instance provided by SvtSysLocale + SC_DLLPUBLIC static const CharClass* pCharClass; + // for faster access a pointer to the single instance provided by SvtSysLocale + SC_DLLPUBLIC static const LocaleDataWrapper* pLocaleData; + SC_DLLPUBLIC static const LocaleDataWrapper* GetpLocaleData(); + + static CalendarWrapper* GetCalendar(); + SC_DLLPUBLIC static CollatorWrapper* GetCollator(); + static CollatorWrapper* GetCaseCollator(); + static IntlWrapper* GetScIntlWrapper(); + static ::com::sun::star::lang::Locale* GetLocale(); + + SC_DLLPUBLIC static ::utl::TransliterationWrapper* GetpTransliteration(); + static ::utl::TransliterationWrapper* GetCaseTransliteration(); + + SC_DLLPUBLIC static LanguageType eLnge; + static sal_Unicode cListDelimiter; + + static const String& GetClipDocName(); + static void SetClipDocName( const String& rNew ); + SC_DLLPUBLIC static const SvxSearchItem& GetSearchItem(); + SC_DLLPUBLIC static void SetSearchItem( const SvxSearchItem& rNew ); + SC_DLLPUBLIC static ScAutoFormat* GetAutoFormat(); + static void ClearAutoFormat(); //BugId 54209 + static FuncCollection* GetFuncCollection(); + SC_DLLPUBLIC static ScUnoAddInCollection* GetAddInCollection(); + SC_DLLPUBLIC static ScUserList* GetUserList(); + static void SetUserList( const ScUserList* pNewList ); + SC_DLLPUBLIC static const String& GetRscString( sal_uInt16 nIndex ); + static void OpenURL( const String& rURL, const String& rTarget ); + SC_DLLPUBLIC static String GetAbsDocName( const String& rFileName, + SfxObjectShell* pShell ); + SC_DLLPUBLIC static String GetDocTabName( const String& rFileName, + const String& rTabName ); + SC_DLLPUBLIC static sal_uLong GetStandardFormat( SvNumberFormatter&, + sal_uLong nFormat, short nType ); + SC_DLLPUBLIC static sal_uLong GetStandardFormat( double, SvNumberFormatter&, + sal_uLong nFormat, short nType ); + + SC_DLLPUBLIC static double nScreenPPTX; + SC_DLLPUBLIC static double nScreenPPTY; + + static ScDocShellRef* pDrawClipDocShellRef; + + static sal_uInt16 nDefFontHeight; + static sal_uInt16 nStdRowHeight; + + SC_DLLPUBLIC static long nLastRowHeightExtra; + static long nLastColWidthExtra; + + static void Init(); // during start up + static void InitAddIns(); + static void Clear(); // at the end of the program + + static void UpdatePPT(OutputDevice* pDev); + + static void InitTextHeight(SfxItemPool* pPool); + static SvxBrushItem* GetEmptyBrushItem() { return pEmptyBrushItem; } + static SvxBrushItem* GetButtonBrushItem(); + static SvxBrushItem* GetEmbeddedBrushItem() { return pEmbeddedBrushItem; } + static SvxBrushItem* GetProtectedBrushItem() { return pProtectedBrushItem; } + SC_DLLPUBLIC static const String& GetEmptyString(); + static const String& GetScDocString(); + + /** Returns the specified image list with outline symbols. */ + static ImageList* GetOutlineSymbols(); + + static bool HasStarCalcFunctionList(); + static ScFunctionList* GetStarCalcFunctionList(); + static ScFunctionMgr* GetStarCalcFunctionMgr(); + static void ResetFunctionList(); + + static String GetErrorString(sal_uInt16 nErrNumber); + static String GetLongErrorString(sal_uInt16 nErrNumber); + static sal_Bool EETextObjEqual( const EditTextObject* pObj1, + const EditTextObject* pObj2 ); + static sal_Bool CheckWidthInvalidate( sal_Bool& bNumFormatChanged, + const SfxItemSet& rNewAttrs, + const SfxItemSet& rOldAttrs ); + static sal_Bool HasAttrChanged( const SfxItemSet& rNewAttrs, + const SfxItemSet& rOldAttrs, + const sal_uInt16 nWhich ); + + static ScUnitConverter* GetUnitConverter(); + + /// strchr() functionality on unicode, as long as we need it for ScToken etc. + static const sal_Unicode* UnicodeStrChr( const sal_Unicode* pStr, sal_Unicode c ); + + static inline sal_Unicode ToUpperAlpha( sal_Unicode c ) + { return ( c >= 'a' && c <= 'z' ) ? ( c-'a'+'A' ) : c; } + + /** Adds the string rToken to rTokenList, using a list separator character. + @param rTokenList The string list where the token will be appended to. + @param rToken The token string to append to the token list. + @param cSep The character to separate the tokens. + @param nSepCount Specifies how often cSep is inserted between two tokens. + @param bForceSep true = Always insert separator; false = Only, if not at begin or end. */ + SC_DLLPUBLIC static void AddToken( + String& rTokenList, const String& rToken, + sal_Unicode cSep, xub_StrLen nSepCount = 1, + bool bForceSep = false ); + + /** Returns true, if the first and last character of the string is cQuote. */ + SC_DLLPUBLIC static bool IsQuoted( const String& rString, sal_Unicode cQuote = '\'' ); + + /** Inserts the character cQuote at beginning and end of rString. + @param bEscapeEmbedded If <TRUE/>, embedded quote characters are + escaped by doubling them. + */ +SC_DLLPUBLIC static void AddQuotes( String& rString, sal_Unicode cQuote = '\'', bool bEscapeEmbedded = true ); + + /** Erases the character cQuote from rString, if it exists at beginning AND end. + @param bUnescapeEmbedded If <TRUE/>, embedded doubled quote characters + are unescaped by replacing them with a + single instance. + */ +SC_DLLPUBLIC static void EraseQuotes( String& rString, sal_Unicode cQuote = '\'', bool bUnescapeEmbedded = true ); + + /** Finds an unquoted instance of cChar in rString, starting at + offset nStart. Unquoted instances may occur when concatenating two + quoted strings with a separator, for example, 's1':'s2'. Embedded + quotes have to be escaped by being doubled. Caller must ensure that + nStart points into an unquoted range or the opening quote. Specialty: + if cChar==cQuote the first cQuote character from nStart on is found. + @returns offset if found, else STRING_NOTFOUND + */ +SC_DLLPUBLIC static xub_StrLen FindUnquoted( const String& rString, sal_Unicode cChar, xub_StrLen nStart = 0, sal_Unicode cQuote = '\'' ); + + /** Finds an unquoted instance of cChar in null-terminated pString. Same + semantics as FindUnquoted( const String&, ...) + @returns: pointer to cChar if found, else NULL + */ +SC_DLLPUBLIC static const sal_Unicode* FindUnquoted( const sal_Unicode* pString, sal_Unicode cChar, sal_Unicode cQuote = '\'' ); + + + static CharSet GetCharsetValue( const String& rCharSet ); + static String GetCharsetString( CharSet eVal ); + + /// a "ReadOnly" formatter for UNO/XML export + static SvNumberFormatter* GetEnglishFormatter(); + + static sal_Bool IsSystemRTL(); // depending on system language + static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage + SC_DLLPUBLIC static sal_uInt8 GetDefaultScriptType(); // for all WEAK characters + /** Map ATTR_((CJK|CTL)_)?FONT_... to proper WhichIDs. + If more than one SCRIPTTYPE_... values are or'ed together, prefers + first COMPLEX, then ASIAN */ + SC_DLLPUBLIC static sal_uInt16 GetScriptedWhichID( sal_uInt8 nScriptType, sal_uInt16 nWhich ); + + /** Adds a language item to the item set, if the number format item contains + a language that differs from its parent's language. */ + SC_DLLPUBLIC static void AddLanguage( SfxItemSet& rSet, SvNumberFormatter& rFormatter ); + + /** Obtain the ordinal suffix for a number according to the system locale */ + static String GetOrdinalSuffix( sal_Int32 nNumber); +}; +#endif + +// maybe move to dbdata.hxx (?): + +enum ScQueryOp + { + SC_EQUAL, + SC_LESS, + SC_GREATER, + SC_LESS_EQUAL, + SC_GREATER_EQUAL, + SC_NOT_EQUAL, + SC_TOPVAL, + SC_BOTVAL, + SC_TOPPERC, + SC_BOTPERC, + SC_CONTAINS, + SC_DOES_NOT_CONTAIN, + SC_BEGINS_WITH, + SC_DOES_NOT_BEGIN_WITH, + SC_ENDS_WITH, + SC_DOES_NOT_END_WITH + }; + +enum ScQueryConnect + { + SC_AND, + SC_OR + }; + +enum ScSubTotalFunc + { + SUBTOTAL_FUNC_NONE = 0, + SUBTOTAL_FUNC_AVE = 1, + SUBTOTAL_FUNC_CNT = 2, + SUBTOTAL_FUNC_CNT2 = 3, + SUBTOTAL_FUNC_MAX = 4, + SUBTOTAL_FUNC_MIN = 5, + SUBTOTAL_FUNC_PROD = 6, + SUBTOTAL_FUNC_STD = 7, + SUBTOTAL_FUNC_STDP = 8, + SUBTOTAL_FUNC_SUM = 9, + SUBTOTAL_FUNC_VAR = 10, + SUBTOTAL_FUNC_VARP = 11 + }; + +/* + * dialog returns the special field values "empty"/"not empty" + * as constants SC_EMPTYFIELDS and SC_NONEMPTYFIELDS respectively in nVal in + * conjuctions with the flag bQueryByString = FALSE. + */ + +#define SC_EMPTYFIELDS ((double)0x0042) +#define SC_NONEMPTYFIELDS ((double)0x0043) + +namespace utl +{ + class SearchParam; + class TextSearch; +} + +struct ScQueryEntry +{ + sal_Bool bDoQuery; + sal_Bool bQueryByString; + bool bQueryByDate; + SCCOLROW nField; + ScQueryOp eOp; + ScQueryConnect eConnect; + String* pStr; + double nVal; + utl::SearchParam* pSearchParam; // if RegExp, not saved + utl::TextSearch* pSearchText; // if RegExp, not saved + + ScQueryEntry(); + ScQueryEntry(const ScQueryEntry& r); + ~ScQueryEntry(); + + // creates pSearchParam and pSearchText if necessary, always RegExp! + utl::TextSearch* GetSearchTextPtr( sal_Bool bCaseSens ); + + void Clear(); + ScQueryEntry& operator=( const ScQueryEntry& r ); + sal_Bool operator==( const ScQueryEntry& r ) const; +}; + +class ScArea; + +struct ScConsolidateParam +{ + SCCOL nCol; // cursor position / + SCROW nRow; // or start of destination area respectively + SCTAB nTab; + ScSubTotalFunc eFunction; + sal_uInt16 nDataAreaCount; // number of data areas + ScArea** ppDataAreas; // array of pointers into data areas + sal_Bool bByCol; + sal_Bool bByRow; + sal_Bool bReferenceData; // reference source data + + ScConsolidateParam(); + ScConsolidateParam( const ScConsolidateParam& r ); + ~ScConsolidateParam(); + + ScConsolidateParam& operator= ( const ScConsolidateParam& r ); + sal_Bool operator== ( const ScConsolidateParam& r ) const; + void Clear (); // = ClearDataAreas()+Members + void ClearDataAreas (); + void SetAreas ( ScArea* const* ppAreas, sal_uInt16 nCount ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/globalnames.hxx b/sc/inc/globalnames.hxx new file mode 100644 index 000000000000..ae30bc1e0d61 --- /dev/null +++ b/sc/inc/globalnames.hxx @@ -0,0 +1,34 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Markus Mohrhard <markus.mohrhard@googlemail.com> + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): Kohei Yoshida <kyoshida@novell.com> + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SC_GLOBALNAMES_HXX__ +#define __SC_GLOBALNAMES_HXX__ + +#define STR_DB_LOCAL_NONAME "__Anonymous_Sheet_DB__" +#define STR_DB_GLOBAL_NONAME "__Anonymous_DB__" + +#endif diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc new file mode 100644 index 000000000000..67170455dfa9 --- /dev/null +++ b/sc/inc/globstr.hrc @@ -0,0 +1,595 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#ifndef __GLOBSTR_HRC_ +#define __GLOBSTR_HRC_ + +#define STR_UNDO_DELETECELLS 1 +#define STR_UNDO_CUT 2 +#define STR_UNDO_PASTE 3 +#define STR_UNDO_MOVE 4 +#define STR_UNDO_COPY 5 +#define STR_UNDO_DELETECONTENTS 6 +#define STR_UNDO_SELATTR 7 +#define STR_UNDO_SELATTRLINES 8 +#define STR_UNDO_COLWIDTH 9 +#define STR_UNDO_OPTCOLWIDTH 10 +#define STR_UNDO_ROWHEIGHT 11 +#define STR_UNDO_OPTROWHEIGHT 12 +#define STR_UNDO_AUTOFILL 13 +#define STR_UNDO_MERGE 14 +#define STR_UNDO_REMERGE 15 +#define STR_UNDO_AUTOFORMAT 16 +#define STR_UNDO_REPLACE 17 +#define STR_UNDO_CURSORATTR 18 +#define STR_UNDO_ENTERDATA 19 +#define STR_UNDO_INSCOLBREAK 20 +#define STR_UNDO_DELCOLBREAK 21 +#define STR_UNDO_INSROWBREAK 22 +#define STR_UNDO_DELROWBREAK 23 +#define STR_UNDO_DOOUTLINE 24 +#define STR_UNDO_REDOOUTLINE 25 +#define STR_UNDO_MAKEOUTLINE 26 +#define STR_UNDO_REMAKEOUTLINE 27 +#define STR_UNDO_OUTLINELEVEL 28 +#define STR_UNDO_DOOUTLINEBLK 29 +#define STR_UNDO_REDOOUTLINEBLK 30 +#define STR_UNDO_REMOVEALLOTLNS 31 +#define STR_UNDO_AUTOOUTLINE 32 +#define STR_UNDO_SUBTOTALS 33 +#define STR_UNDO_SORT 34 +#define STR_UNDO_QUERY 35 +#define STR_UNDO_DBDATA 36 +#define STR_UNDO_IMPORTDATA 37 +#define STR_UNDO_REPEATDB 38 + +#define STR_DB_NONAME 39 + +#define STR_MSSG_DOSUBTOTALS_0 40 +#define STR_MSSG_DOSUBTOTALS_1 41 +#define STR_MSSG_DOSUBTOTALS_2 42 +#define STR_MSSG_REPEATDB_0 43 +#define STR_MSSG_MAKEAUTOFILTER_0 44 +#define STR_MSSG_IMPORTDATA_0 45 +#define STR_MSSG_MAKEOUTLINE_0 46 +#define STR_MSSG_REMOVEOUTLINE_0 47 +#define STR_MSSG_PASTEFROMCLIP_0 48 +#define STR_MSSG_PASTEFROMCLIP_1 49 +#define STR_MSSG_MOVEBLOCKTO_0 50 +#define STR_MSSG_INSERTCELLS_0 52 +#define STR_MSSG_DELETECELLS_0 53 +#define STR_MSSG_MERGECELLS_0 54 +#define STR_MSSG_SEARCHANDREPLACE_0 55 +#define STR_MSSG_SOLVE_0 56 +#define STR_MSSG_SOLVE_1 57 +#define STR_MSSG_SOLVE_2 58 +#define STR_MSSG_SOLVE_3 59 +#define STR_MSSG_SOLVE_4 60 +#define STR_MSSG_SOLVE_5 61 +#define STR_MSSG_SOLVE_6 62 + +#define STR_TABLE_GESAMTERGEBNIS 64 +#define STR_TABLE_ERGEBNIS 65 +#define STR_UNDO_SPELLING 66 +#define STR_TABLE_UND 67 +#define STR_TABLE_ODER 68 +#define STR_UNDO_INSERTCELLS 69 +#define STR_TABLE_DEF 70 +#define STR_MOVE_TO_END 72 +#define STR_BOX_YNI 73 +#define STR_NO_REF_TABLE 74 + +#define STR_PIVOTFUNC_SUM 75 // pivot.cxx +#define STR_PIVOTFUNC_COUNT 76 +#define STR_PIVOTFUNC_AVG 77 +#define STR_PIVOTFUNC_MAX 78 +#define STR_PIVOTFUNC_MIN 79 +#define STR_PIVOTFUNC_PROD 80 +#define STR_PIVOTFUNC_COUNT2 90 +#define STR_PIVOTFUNC_STDDEV 91 +#define STR_PIVOTFUNC_STDDEV2 92 +#define STR_PIVOTFUNC_VAR 93 +#define STR_PIVOTFUNC_VAR2 94 +#define STR_PIVOT_TOTAL 95 +#define STR_PIVOT_DATA 96 + +#define STR_PIVOT_INVALID_DBAREA 97 // tabvwsh3.cxx + +#define STR_TABLE 98 +#define STR_COLUMN 99 +#define STR_ROW 100 +#define STR_LOAD_DOC 101 +#define STR_SAVE_DOC 102 + +#define STR_ERR_INVALID_TABREF 103 +#define STR_AREA_ALREADY_INSERTED 104 +#define STR_INVALID_TABREF 105 +#define STR_INVALID_QUERYAREA 106 + +#define STR_REIMPORT_EMPTY 107 +#define STR_NOMULTISELECT 108 +#define STR_FILL_SERIES_PROGRESS 109 // documen3.cxx + +#define STR_UNKNOWN_FILTER 110 + +#define STR_DATABASE_NOTFOUND 111 +#define STR_DATABASE_ABORTED 112 + +#define STR_UNDO_PRINTRANGES 113 + +#define STR_UNDO_DEC_INDENT 114 +#define STR_UNDO_INC_INDENT 115 +#define STR_UNDO_THESAURUS 116 + +#define STR_FILL_TAB 117 +#define STR_NO_VALUE 118 /* moved to compiler.src, keep define! */ +#define STR_UPDATE_SCENARIO 119 +#define STR_ERR_NEWSCENARIO 120 +#define STR_SCENARIO 121 +#define STR_PIVOT_TABLE 122 +#define STR_NEWTABNAMENOTUNIQUE 123 + +#define STR_FUN_TEXT_SUM 124 +#define STR_FUN_TEXT_COUNT 125 +#define STR_FUN_TEXT_AVG 126 +#define STR_FUN_TEXT_MAX 127 +#define STR_FUN_TEXT_MIN 128 +#define STR_FUN_TEXT_PRODUCT 129 +#define STR_FUN_TEXT_STDDEV 130 +#define STR_FUN_TEXT_VAR 131 +#define STR_DOC_STAT 132 + +#define STR_DBNAME_IMPORT 134 + +#define STR_NOCHARTATCURSOR 135 +#define STR_NOAREASELECTED 136 +#define STR_INVALIDTABNAME 137 + +#define STR_PIVOT_NOTFOUND 138 +#define STR_ERROR_STR 139 +#define STR_NV_STR 140 /* moved to compiler.src, keep define! */ +#define STR_EMPTYDATA 141 +#define STR_PIVOT_NODATA 142 +#define STR_PIVOT_MOVENOTALLOWED 143 + +#define STR_PRINT_INVALID_AREA 144 + +#define STR_PAGESTYLE 145 +#define STR_HEADER 146 +#define STR_FOOTER 147 + +#define STR_TEXTATTRS 148 + +#define STR_HFCMD_DELIMITER 149 +#define HFCMD_START 150 +#define STR_HFCMD_PAGE 150 +#define STR_HFCMD_PAGES 151 +#define STR_HFCMD_DATE 152 +#define STR_HFCMD_TIME 153 +#define STR_HFCMD_FILE 154 +#define STR_HFCMD_TABLE 155 +#define HFCMD_END 155 + +#define STR_PROTECTIONERR 156 + +#define STR_PAGEHEADER 157 +#define STR_PAGEFOOTER 158 +#define STR_PAGE 159 +#define STR_LONG_ERR_ILL_ARG 160 +#define STR_LONG_ERR_ILL_PAR 161 +#define STR_LONG_ERR_ILL_FPO 162 +#define STR_LONG_ERR_ILL_CHAR 163 +#define STR_LONG_ERR_ILL_SEP 164 +#define STR_LONG_ERR_PAIR 165 +#define STR_LONG_ERR_OP_EXP 166 +#define STR_LONG_ERR_VAR_EXP 167 +#define STR_LONG_ERR_CODE_OVF 168 +#define STR_LONG_ERR_STR_OVF 169 +#define STR_LONG_ERR_STACK_OVF 170 +#define STR_LONG_ERR_SYNTAX 171 +#define STR_LONG_ERR_CIRC_REF 172 +#define STR_LONG_ERR_NO_NAME 173 +#define STR_LONG_ERR_NO_REF 174 +#define STR_LONG_ERR_NO_CONV 175 +#define STR_LONG_ERR_NO_VALUE 176 +#define STR_LONG_ERR_NV 177 + +#define STR_GRIDCOLOR 178 +#define STR_MERGE_NOTEMPTY 179 +#define STR_CELL_FILTER 180 + +#define STR_TARGETNOTFOUND 181 + +#define STR_INVALID_EPS 182 +#define STR_TABLE_OP 183 // documen4.cxx +#define STR_UNDO_TABOP 184 + +#define STR_INVALID_AFNAME 185 + +#define STR_AREA 186 +#define STR_YES 187 +#define STR_NO 188 +#define STR_PROTECTION 189 +#define STR_FORMULAS 190 +#define STR_HIDE 191 +#define STR_PRINT 192 + +#define STR_INVALID_AFAREA 193 + +#define STR_CASCADE 194 // function auto pilot +#define STR_OPTIONAL 195 +#define STR_REQUIRED 196 +#define STR_EDITFUNCTION 197 +#define STR_INVALID 198 + +#define STR_NOTES 199 +#define STR_QUERY_DELTAB 200 + +#define STR_UNDO_DETREFRESH 201 + +#define STR_UNDO_SHOWNOTE 202 +#define STR_UNDO_HIDENOTE 203 +#define STR_UNDO_DRAGDROP 204 + +#define STR_EXPORT_ASCII_WARNING 205 +#define STR_IMPORT_ERROR 206 +#define STR_IMPORT_ASCII 207 +#define STR_IMPORT_LOTUS 208 +#define STR_IMPORT_DBF 209 +#define STR_EXPORT_ASCII 210 + +#define STR_STYLENAME_STANDARD 71 +#define STR_STYLENAME_RESULT 133 +#define STR_STYLENAME_RESULT1 211 +#define STR_STYLENAME_HEADLINE 212 +#define STR_STYLENAME_HEADLINE1 213 +#define STR_STYLENAME_REPORT 214 +#define STR_STYLENAME_REPORT1 215 + +#define STR_PIVOT_ERROR 216 +#define STR_PIVOT_PROGRESS 217 +#define STR_IMPORT_EXCEL_WARNING 218 +#define STR_SPELLING_STOP_OK 219 +#define STR_THESAURUS_NO_STRING 220 +#define STR_SPELLING_BEGIN_TAB 221 +#define STR_SPELLING_NO_LANG 222 // can be removed later + +#define STR_UNDO_GRAFEDIT 223 + +#define STR_NOLANGERR 224 + +#define STR_UNDO_INSERT_TAB 225 +#define STR_UNDO_DELETE_TAB 226 +#define STR_UNDO_RENAME_TAB 227 +#define STR_UNDO_MOVE_TAB 228 +#define STR_UNDO_COPY_TAB 229 +#define STR_UNDO_APPEND_TAB 230 + +#define STR_CHART_MAINTITLE 231 +#define STR_CHART_SUBTITLE 232 +#define STR_CHART_XTITLE 233 +#define STR_CHART_YTITLE 234 +#define STR_CHART_ZTITLE 235 + +#define STR_ABSREFLOST 236 +#define STR_NAMECONFLICT 237 + +#define STR_ERR_AUTOFILTER 238 +#define STR_MSSG_SEARCHANDREPLACE_1 239 +#define STR_MSSG_SEARCHANDREPLACE_2 240 +#define STR_MSSG_SEARCHANDREPLACE_3 241 + +#define STR_CREATENAME_REPLACE 242 +#define STR_CREATENAME_MARKERR 243 + +#define STR_UNDO_LISTNAMES 244 +#define STR_UNDO_PIVOT_NEW 245 +#define STR_UNDO_PIVOT_MODIFY 246 +#define STR_UNDO_PIVOT_DELETE 247 +#define STR_UNDO_CONSOLIDATE 248 +#define STR_UNDO_USESCENARIO 249 +#define STR_UNDO_MAKESCENARIO 250 + +#define STR_CONSOLIDATE_ERR1 251 +#define STR_SCENARIO_NOTFOUND 252 + +#define STR_UNDO_APPLYCELLSTYLE 253 + +#define STR_UNDO_DETADDPRED 254 +#define STR_UNDO_DETDELPRED 255 +#define STR_UNDO_DETADDSUCC 256 +#define STR_UNDO_DETDELSUCC 257 +#define STR_UNDO_DETADDERROR 258 +#define STR_UNDO_DETDELALL 259 + +#define STR_QUERY_DELENTRY 260 + +#define STR_VOBJ_OBJECT 261 +#define STR_VOBJ_CHART 262 +#define STR_VOBJ_DRAWINGS 263 +#define STR_VOBJ_MODE_SHOW 264 +#define STR_VOBJ_MODE_HIDE 265 + +#define STR_SCATTR_PAGE_TOPDOWN 267 +#define STR_SCATTR_PAGE_LEFTRIGHT 268 +#define STR_SCATTR_PAGE_NOTES 269 +#define STR_SCATTR_PAGE_GRID 270 +#define STR_SCATTR_PAGE_HEADERS 271 +#define STR_SCATTR_PAGE_FORMULAS 272 +#define STR_SCATTR_PAGE_NULLVALS 273 +#define STR_SCATTR_PAGE_PRINTDIR 274 +#define STR_SCATTR_PAGE_FIRSTPAGENO 275 +#define STR_SCATTR_PAGE_SCALE 276 +#define STR_SCATTR_PAGE_SCALETOPAGES 277 + +#define STR_NOREF_STR 278 /* moved to compiler.src, keep define! */ + +#define STR_UNDO_CHARTDATA 280 +#define STR_UNDO_ORIGINALSIZE 281 + +#define STR_LINKERROR 282 +#define STR_LINKERRORFILE 283 +#define STR_LINKERRORTAB 284 +#define STR_UNDO_UPDATELINK 285 + +#define STR_IMPORT_REPLACE 286 + +#define STR_UNDO_REMOVELINK 287 + +#define STR_OVERVIEW 288 +#define STR_DOC_INFO 289 +#define STR_DOC_CREATED 290 +#define STR_DOC_MODIFIED 291 +#define STR_DOC_PRINTED 292 +#define STR_DOC_THEME 293 +#define STR_DOC_KEYWORDS 318 +#define STR_DOC_COMMENT 294 +#define STR_BY 295 +#define STR_ON 296 + +#define STR_RELOAD_TABLES 297 + +#define STR_FILTER_TOOMANY 298 + +#define STR_UNDO_ENTERMATRIX 299 + +#define STR_INSERT_FULL 300 +#define STR_TABINSERT_ERROR 301 +#define STR_PASTE_ERROR 302 +#define STR_PASTE_FULL 303 + +#define STR_ERR_INVALID_AREA 304 + +#define STR_IMPORT_DIF 305 +#define STR_EXPORT_DIF 306 + +#define STR_ERR_NOREF 307 +#define STR_FUN_TEXT_COUNT2 308 +#define STR_NO_NAME_REF 309 /* moved to compiler.src, keep define! */ + +#define STR_MATRIXFRAGMENTERR 310 + +#define STR_UNDO_SHOWTAB 311 +#define STR_UNDO_HIDETAB 312 +#define STR_UNDO_INSERTAREALINK 313 + +#define STR_REIMPORT_AFTER_LOAD 314 + +#define STR_DETINVALID_OVERFLOW 315 +#define STR_GRAPHICNAME 316 +#define STR_INVALIDNAME 317 +#define STR_ERR_LINKOVERLAP 319 + +#define STR_VALID_MACRONOTFOUND 320 +#define STR_VALID_DEFERROR 321 + +#define STR_UNDO_DETINVALID 322 + +#define STR_PROGRESS_CALCULATING 323 +#define STR_PROGRESS_SORTING 324 +#define STR_PROGRESS_HEIGHTING 325 + +#define STR_QUICKHELP_DELETE 326 + +#define STR_FUNCTIONLIST_MORE 327 + +#define STR_PIVOT_STYLE_INNER 328 +#define STR_PIVOT_STYLE_RESULT 329 +#define STR_PIVOT_STYLE_CATEGORY 330 +#define STR_PIVOT_STYLE_TITLE 331 +#define STR_PIVOT_STYLE_FIELDNAME 332 +#define STR_PIVOT_STYLE_TOP 333 + +#define STR_OPERATION_FILTER 334 +#define STR_OPERATION_SORT 335 +#define STR_OPERATION_SUBTOTAL 336 +#define STR_OPERATION_NONE 337 + +#define STR_UNDO_PROTECT_TAB 338 +#define STR_UNDO_UNPROTECT_TAB 339 +#define STR_UNDO_PROTECT_DOC 340 +#define STR_UNDO_UNPROTECT_DOC 341 + +#define STR_PROGRESS_IMPORT 342 + +#define STR_SORT_ERR_MERGED 343 + +#define STR_TIP_WIDTH 344 +#define STR_TIP_HEIGHT 345 +#define STR_TIP_HIDE 346 + +#define STR_UNDO_REMOVEBREAKS 347 +#define STR_UNDO_PRINTSCALE 348 +#define STR_UNDO_DRAG_BREAK 349 + +#define STR_QUICKHELP_REF 350 + +#define STR_PIVOT_OVERLAP 351 +#define STR_PIVOT_NOTEMPTY 352 + +#define STR_QUERY_NOTFOUND 353 + +#define STR_ERR_INSERTOBJ 354 + +#define STR_PROGRESS_COMPARING 355 + +#define STR_CHANGED_BLANK 356 +#define STR_CHANGED_CELL 357 +#define STR_CHANGED_INSERT 358 +#define STR_CHANGED_DELETE 359 +#define STR_CHANGED_MOVE 360 + +#define STR_QUERY_DELSCENARIO 361 +#define STR_UNDO_EDITSCENARIO 362 + +#define STR_END_REDLINING_TITLE 363 +#define STR_END_REDLINING 364 + +#define STR_UNDO_EDITNOTE 365 +#define STR_TABREMOVE_ERROR 366 +#define STR_CLOSE_ERROR_LINK 367 +#define STR_UNDO_RANGENAMES 368 + +#define STR_MSSG_SEARCHANDREPLACE_4 369 +#define STR_MSSG_SEARCHANDREPLACE_5 370 + +#define STR_UNDO_RESIZEMATRIX 371 +#define STR_TIP_RESIZEMATRIX 372 + +#define STR_READONLYERR 373 + +#define STR_PASTE_BIGGER 374 + +#define STR_MACRO_WARNING 375 + +#define STR_EXPORT_DBF 376 + +#define STR_UNDO_APPLYPAGESTYLE 377 +#define STR_UNDO_EDITCELLSTYLE 378 +#define STR_UNDO_EDITPAGESTYLE 379 + +#define STR_DATAPILOT_SUBTOTAL 380 + +#define STR_UNDO_TRANSLITERATE 381 + +#define STR_NO_ADDIN 382 +#define STR_LONG_ERR_NO_ADDIN 383 +#define STR_NO_MACRO 384 +#define STR_LONG_ERR_NO_MACRO 385 + +#define STR_SCATTR_PAGE_SCALETO 386 +#define STR_SCATTR_PAGE_SCALE_WIDTH 387 +#define STR_SCATTR_PAGE_SCALE_HEIGHT 388 +#define STR_SCATTR_PAGE_SCALE_PAGES 389 +#define STR_SCATTR_PAGE_SCALE_AUTO 390 + +#define STR_UNDO_TAB_RTL 391 +#define STR_UNDO_HANGULHANJA 392 +#define STR_UNDO_CHINESE_TRANSLATION 393 + +#define STR_NAME_INPUT_CELL 394 +#define STR_NAME_INPUT_RANGE 395 +#define STR_NAME_INPUT_DBRANGE 396 +#define STR_NAME_INPUT_ROW 397 +#define STR_NAME_INPUT_SHEET 398 +#define STR_NAME_INPUT_DEFINE 399 +#define STR_NAME_ERROR_SELECTION 400 +#define STR_NAME_ERROR_NAME 401 + +#define STR_CHANGED_MOVE_REJECTION_WARNING 402 +#define STR_CHANGED_DELETE_REJECTION_WARNING 403 + +#define STR_HF_NONE_IN_BRACKETS 404 +#define STR_HF_OF 405 +#define STR_HF_OF_QUESTION 406 +#define STR_HF_CREATED_BY 407 +#define STR_HF_CONFIDENTIAL 408 +#define STR_HF_CUSTOMIZED 409 +#define STR_HF_CUSTOM_FOOTER 410 + +#define STR_ERR_DATAPILOT_INPUT 411 + +#define STR_DIV_ZERO 412 /* moved to compiler.src, keep define! */ +#define STR_LONG_ERR_DIV_ZERO 413 +#define STR_NUM_ERROR 414 /* moved to compiler.src, keep define! */ +#define STR_NULL_ERROR 415 /* moved to compiler.src, keep define! */ + +#define STR_RECALC_MANUAL 416 +#define STR_RECALC_AUTO 417 + +#define STR_UNDO_TAB_R1C1 418 + +#define STR_ERR_LONG_NESTED_ARRAY 419 +#define STR_UNDO_TEXTTOCOLUMNS 420 + +#define STR_DOC_UPDATED 421 +#define STR_DOC_WILLBESAVED 422 +#define STR_DOC_WILLNOTBESAVED 423 +#define STR_DOC_DISABLESHARED 424 +#define STR_DOC_NOLONGERSHARED 425 +#define STR_SHARED_DOC_WARNING 426 +#define STR_FILE_LOCKED_TRY_LATER 427 +#define STR_FILE_LOCKED_SAVE_LATER 428 +#define STR_UNKNOWN_USER 429 +#define STR_LONG_ERR_NULL 430 + +#define STR_UNDO_INSERTNOTE 431 +#define STR_UNDO_DELETENOTE 432 +#define STR_STYLE_FAMILY_CELL 433 +#define STR_STYLE_FAMILY_PAGE 434 + +#define STR_ERR_DATAPILOTSOURCE 435 +#define STR_PIVOT_FIRSTROWEMPTYERR 436 +#define STR_PIVOT_ONLYONEROWERR 437 + +#define STR_UNDO_SET_TAB_BG_COLOR 438 +#define STR_UNDO_SET_MULTI_TAB_BG_COLOR 439 +#define STR_UNDO_INSERT_CURRENT_DATE 440 +#define STR_UNDO_INSERT_CURRENT_TIME 441 + +#define STR_OPTIONS_WARN_SEPARATORS 442 +#define STR_SHAPE_AUTOSHAPE 443 +#define STR_SHAPE_RECTANGLE 444 +#define STR_SHAPE_LINE 445 +#define STR_SHAPE_OVAL 446 +#define STR_SHAPE_TEXTBOX 447 + +#define STR_FORM_BUTTON 448 +#define STR_FORM_CHECKBOX 449 +#define STR_FORM_OPTIONBUTTON 450 +#define STR_FORM_LABEL 451 +#define STR_FORM_LISTBOX 452 +#define STR_FORM_GROUPBOX 453 +#define STR_FORM_DROPDOWN 454 +#define STR_FORM_SPINNER 455 +#define STR_FORM_SCROLLBAR 456 + +#define STR_PGNUM 457 + +#define STR_COUNT 458 + +#endif diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h new file mode 100644 index 000000000000..f94f367a60ab --- /dev/null +++ b/sc/inc/helpids.h @@ -0,0 +1,694 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ + +#include "sfx2/sfxcommands.h" +#include "svx/svxcommands.h" +#include "sccommands.h" + +#define HID_INSWIN_POS "SC_HID_INSWIN_POS" +#define HID_INSWIN_CALC "SC_HID_INSWIN_CALC" +#define HID_INSWIN_CANCEL "SC_HID_INSWIN_CANCEL" +#define HID_INSWIN_OK "SC_HID_INSWIN_OK" +#define HID_INSWIN_SUMME "SC_HID_INSWIN_SUMME" +#define HID_INSWIN_FUNC "SC_HID_INSWIN_FUNC" +#define HID_INSWIN_INPUT "SC_HID_INSWIN_INPUT" + +// Hilfe IDs fuer Dokumentfenster -------------------------------------------- +#define HID_SC_WIN_GRIDWIN "SC_HID_SC_WIN_GRIDWIN" +#define HID_SC_WIN_PREVIEW "SC_HID_SC_WIN_PREVIEW" + +// Hilfe IDs fuer einzelne Controls (max.30) --------------------------------- +// Kopf/Fusszeilen Editfenster: Header/Footer links/rechts links/mitte/rechts +#define HID_SC_HF_HLL "SC_HID_SC_HF_HLL" +#define HID_SC_HF_HLC "SC_HID_SC_HF_HLC" +#define HID_SC_HF_HLR "SC_HID_SC_HF_HLR" +#define HID_SC_HF_HRL "SC_HID_SC_HF_HRL" +#define HID_SC_HF_HRC "SC_HID_SC_HF_HRC" +#define HID_SC_HF_HRR "SC_HID_SC_HF_HRR" +#define HID_SC_HF_FLL "SC_HID_SC_HF_FLL" +#define HID_SC_HF_FLC "SC_HID_SC_HF_FLC" +#define HID_SC_HF_FLR "SC_HID_SC_HF_FLR" +#define HID_SC_HF_FRL "SC_HID_SC_HF_FRL" +#define HID_SC_HF_FRC "SC_HID_SC_HF_FRC" +#define HID_SC_HF_FRR "SC_HID_SC_HF_FRR" +// "Spalten" in Teilergebnissen: Gruppe 1/2/3 - nicht mehr! +#define HID_SC_SUBT_COLS_1 "SC_HID_SC_SUBT_COLS_1" +#define HID_SC_SUBT_COLS_2 "SC_HID_SC_SUBT_COLS_2" +#define HID_SC_SUBT_COLS_3 "SC_HID_SC_SUBT_COLS_3" +// Eintraege im Navigator +#define HID_SC_NAVIPI_ENTRIES "SC_HID_SC_NAVIPI_ENTRIES" +#define HID_SC_NAVIPI_ROW "SC_HID_SC_NAVIPI_ROW" +#define HID_SC_NAVIPI_COL "SC_HID_SC_NAVIPI_COL" +#define HID_SC_NAVIPI_DOC "SC_HID_SC_NAVIPI_DOC" +#define HID_SC_NAVIPI_DATA "SC_HID_SC_NAVIPI_DATA" +#define HID_SC_NAVIPI_UP "SC_HID_SC_NAVIPI_UP" +#define HID_SC_NAVIPI_DOWN "SC_HID_SC_NAVIPI_DOWN" +#define HID_SC_NAVIPI_ZOOM "SC_HID_SC_NAVIPI_ZOOM" +#define HID_SC_NAVIPI_ROOT "SC_HID_SC_NAVIPI_ROOT" +#define HID_SC_NAVIPI_SCEN "SC_HID_SC_NAVIPI_SCEN" +#define HID_SC_NAVIPI_DROP "SC_HID_SC_NAVIPI_DROP" +// Teilergebnisse +#define HID_SC_SUBT_GROUP "SC_HID_SC_SUBT_GROUP" +#define HID_SC_SUBT_COLS "SC_HID_SC_SUBT_COLS" +#define HID_SC_SUBT_FUNC "SC_HID_SC_SUBT_FUNC" +// +#define HID_SC_NAVIPI_TOOLBOX "SC_HID_SC_NAVIPI_TOOLBOX" +// Bereich ist voll! + +// Hilfe IDs fuer Dialoge / Pages (max.70) ----------------------------------- +#define HID_SC_AUTOFORMAT "SC_HID_SC_AUTOFORMAT" +#define HID_SC_PIVOTFILTER "SC_HID_SC_PIVOTFILTER" +#define HID_SC_INPORTOPT "SC_HID_SC_INPORTOPT" +#define HID_SC_PIVOTSUBT "SC_HID_SC_PIVOTSUBT" +#define HID_SC_FORM_ARGS "SC_HID_SC_FORM_ARGS" +#define HID_SCPAGE_SORT_FIELDS "SC_HID_SCPAGE_SORT_FIELDS" +#define HID_SCPAGE_SORT_OPTIONS "SC_HID_SCPAGE_SORT_OPTIONS" +#define HID_SCPAGE_SUBT_OPTIONS "SC_HID_SCPAGE_SUBT_OPTIONS" +#define HID_SCPAGE_SUBT_GROUP "SC_HID_SCPAGE_SUBT_GROUP" +#define HID_SCPAGE_PROTECTION "SC_HID_SCPAGE_PROTECTION" +#define HID_SCPAGE_VIEW "SC_HID_SCPAGE_VIEW" +#define HID_SCPAGE_CALC "SC_HID_SCPAGE_CALC" +#define HID_SCPAGE_FORMULA "SC_HID_SCPAGE_FORMULA" +#define HID_SCPAGE_USERLISTS "SC_HID_SCPAGE_USERLISTS" +#define HID_SCPAGE_HFEDIT "SC_HID_SCPAGE_HFEDIT" +#define HID_SCPAGE_AREAS "SC_HID_SCPAGE_AREAS" +#define HID_SCPAGE_COMPATIBILITY "SC_HID_SCPAGE_COMPATIBILITY" +#define HID_SCPAGE_TABLE "SC_HID_SCPAGE_TABLE" +#define HID_SCPAGE_PRINT "SC_HID_SCPAGE_PRINT" + +#define HID_SCPAGE_SUBT_GROUP1 "SC_HID_SCPAGE_SUBT_GROUP1" +#define HID_SCPAGE_SUBT_GROUP2 "SC_HID_SCPAGE_SUBT_GROUP2" +#define HID_SCPAGE_SUBT_GROUP3 "SC_HID_SCPAGE_SUBT_GROUP3" + +#define HID_SCPAGE_HFED_HL "SC_HID_SCPAGE_HFED_HL" +#define HID_SCPAGE_HFED_HR "SC_HID_SCPAGE_HFED_HR" +#define HID_SCPAGE_HFED_FL "SC_HID_SCPAGE_HFED_FL" +#define HID_SCPAGE_HFED_FR "SC_HID_SCPAGE_HFED_FR" + +#define HID_SCPAGE_CONTENT "SC_HID_SCPAGE_CONTENT" +#define HID_SCPAGE_LAYOUT "SC_HID_SCPAGE_LAYOUT" +#define HID_SCPAGE_INPUT "SC_HID_SCPAGE_INPUT" + +#define HID_SC_NAVIGATOR "SC_HID_SC_NAVIGATOR" + +#define HID_SC_MTRIN_VAL "SC_HID_SC_MTRIN_VAL" +#define HID_SC_MTRIN_DEF "SC_HID_SC_MTRIN_DEF" +#define HID_SC_SELENTRY_LIST "SC_HID_SC_SELENTRY_LIST" +#define HID_SC_GROUP_COLS "SC_HID_SC_GROUP_COLS" +#define HID_SC_GROUP_ROWS "SC_HID_SC_GROUP_ROWS" + +#define HID_SC_HF_TEXT "SC_HID_SC_HF_TEXT" +#define HID_SC_HF_FILE "SC_HID_SC_HF_FILE" +#define HID_SC_HF_TABLE "SC_HID_SC_HF_TABLE" +#define HID_SC_HF_PAGE "SC_HID_SC_HF_PAGE" +#define HID_SC_HF_PAGES "SC_HID_SC_HF_PAGES" +#define HID_SC_HF_DATE "SC_HID_SC_HF_DATE" +#define HID_SC_HF_TIME "SC_HID_SC_HF_TIME" + +#define HID_SC_HEADER_EDIT "SC_HID_SC_HEADER_EDIT" +#define HID_SC_FOOTER_EDIT "SC_HID_SC_FOOTER_EDIT" + +#define HID_SC_SCENWIN_TOP "SC_HID_SC_SCENWIN_TOP" +#define HID_SC_SCENWIN_BOTTOM "SC_HID_SC_SCENWIN_BOTTOM" + +#define HID_SC_INPUTWIN "SC_HID_SC_INPUTWIN" + +#define HID_SC_RENAME_NAME "SC_HID_SC_RENAME_NAME" +#define HID_SC_APPEND_NAME "SC_HID_SC_APPEND_NAME" + +// Funktionsautopilot: nur als Unique-IDs +#define HID_SC_FAP_PAGE "SC_HID_SC_FAP_PAGE" +#define HID_SC_FAP_EDIT1 "SC_HID_SC_FAP_EDIT1" +#define HID_SC_FAP_EDIT2 "SC_HID_SC_FAP_EDIT2" +#define HID_SC_FAP_EDIT3 "SC_HID_SC_FAP_EDIT3" +#define HID_SC_FAP_EDIT4 "SC_HID_SC_FAP_EDIT4" + +#define HID_SC_ADD_AUTOFMT "SC_HID_SC_ADD_AUTOFMT" +#define HID_SC_AUTOFMT_NAME "SC_HID_SC_AUTOFMT_NAME" + +#define HID_SC_DROPMODE_URL "SC_HID_SC_DROPMODE_URL" +#define HID_SC_DROPMODE_LINK "SC_HID_SC_DROPMODE_LINK" +#define HID_SC_DROPMODE_COPY "SC_HID_SC_DROPMODE_COPY" + +#define HID_SC_FAP_STRUCT "SC_HID_SC_FAP_STRUCT" +#define HID_SC_ASCII_TABCTR "SC_HID_SC_ASCII_TABCTR" + +#define HID_SC_SCENARIO_DELETE "SC_HID_SC_SCENARIO_DELETE" +#define HID_SC_SCENARIO_EDIT "SC_HID_SC_SCENARIO_EDIT" + +#define HID_SCDLG_FORMULA "SC_HID_SCDLG_FORMULA" +#define HID_SCDLG_CONDFORMAT "SC_HID_SCDLG_CONDFORMAT" +#define HID_COLROWNAMERANGES "SC_HID_COLROWNAMERANGES" + +#define HID_FUNCTION_BOX "SC_HID_FUNCTION_BOX" +#define HID_SCPAGE_OPREDLINE "SC_HID_SCPAGE_OPREDLINE" +#define HID_SC_REDLIN_CTR "SC_HID_SC_REDLIN_CTR" + +//Kopf/FusszeilenDlg: Contextmenue fuer Dateiname +#define HID_FCOMMAND_TITEL "SC_HID_FCOMMAND_TITEL" +#define HID_FCOMMAND_FILENAME "SC_HID_FCOMMAND_FILENAME" +#define HID_FCOMMAND_PATH "SC_HID_FCOMMAND_PATH" + + +// Hilfe IDs fuer Objekt- und Werkzeugleisten (max.10) ----------------------- + +#define HID_SC_TOOLBOX_TOOLS "SC_HID_SC_TOOLBOX_TOOLS" +#define HID_SC_TOOLBOX_TABLE "SC_HID_SC_TOOLBOX_TABLE" +#define HID_SC_TOOLBOX_DRAW "SC_HID_SC_TOOLBOX_DRAW" +#define HID_SC_TOOLBOX_DRTEXT "SC_HID_SC_TOOLBOX_DRTEXT" +#define HID_SC_TOOLBOX_PREVIEW "SC_HID_SC_TOOLBOX_PREVIEW" + +// wrong group - HID_SC_DLG_START is full +#define HID_SC_RENAME_AUTOFMT "SC_HID_SC_RENAME_AUTOFMT" +#define HID_SC_REN_AFMT_NAME "SC_HID_SC_REN_AFMT_NAME" + +#define HID_SC_TOOLBOX_GRAPHIC "SC_HID_SC_TOOLBOX_GRAPHIC" + +#define HID_CHG_PROTECT "SC_HID_CHG_PROTECT" + +#define HID_SC_RENAME_OBJECT "SC_HID_SC_RENAME_OBJECT" + +#define HID_SC_REN_AFMT_DLG "SC_HID_SC_REN_AFMT_DLG" + +// Hilfe IDs fuer Submenus (max.50) ------------------------------------------ +#define HID_SCMENU_EDIT "SC_HID_SCMENU_EDIT" +#define HID_SCMENU_FILL "SC_HID_SCMENU_FILL" +#define HID_SCMENU_DELBREAK "SC_HID_SCMENU_DELBREAK" +#define HID_SCMENU_VIEW "SC_HID_SCMENU_VIEW" +#define HID_SCMENU_TOOLBARS "SC_HID_SCMENU_TOOLBARS" +#define HID_SCMENU_INSERT "SC_HID_SCMENU_INSERT" +#define HID_SCMENU_INSBREAK "SC_HID_SCMENU_INSBREAK" +#define HID_SCMENU_NAME "SC_HID_SCMENU_NAME" +#define HID_SCMENU_GRAPHIC "SC_HID_SCMENU_GRAPHIC" +#define HID_SCMENU_DATA "SC_HID_SCMENU_DATA" +#define HID_SCMENU_FILTER "SC_HID_SCMENU_FILTER" +#define HID_SCMENU_OUTLINE "SC_HID_SCMENU_OUTLINE" +#define HID_SCMENU_PIVOT "SC_HID_SCMENU_PIVOT" +#define HID_SCMENU_EXTRA "SC_HID_SCMENU_EXTRA" +#define HID_SCMENU_SPELLING "SC_HID_SCMENU_SPELLING" +#define HID_SCMENU_AUDIT "SC_HID_SCMENU_AUDIT" +#define HID_SCMENU_PROTECT "SC_HID_SCMENU_PROTECT" +#define HID_SCMENU_CELLCONT "SC_HID_SCMENU_CELLCONT" +#define HID_SCMENU_ROW "SC_HID_SCMENU_ROW" +#define HID_SCMENU_COL "SC_HID_SCMENU_COL" +#define HID_SCMENU_TAB "SC_HID_SCMENU_TAB" +#define HID_SCMENU_MERGE "SC_HID_SCMENU_MERGE" +#define HID_SCMENU_AREA "SC_HID_SCMENU_AREA" +#define HID_SCMENU_OBJMIRROR "SC_HID_SCMENU_OBJMIRROR" +#define HID_SCMENU_OBJARRANGE "SC_HID_SCMENU_OBJARRANGE" +#define HID_SCMENU_ANCHOR "SC_HID_SCMENU_ANCHOR" +#define HID_SCMENU_SENDTO "SC_HID_SCMENU_SENDTO" +#define HID_SCMENU_CHANGES "SC_HID_SCMENU_CHANGES" + +#define HID_SC_FAP_BTN_FX1 "SC_HID_SC_FAP_BTN_FX1" +#define HID_SC_FAP_BTN_FX2 "SC_HID_SC_FAP_BTN_FX2" +#define HID_SC_FAP_BTN_FX3 "SC_HID_SC_FAP_BTN_FX3" +#define HID_SC_FAP_BTN_FX4 "SC_HID_SC_FAP_BTN_FX4" +#define HID_SC_FAP_BTN_REF1 "SC_HID_SC_FAP_BTN_REF1" +#define HID_SC_FAP_BTN_REF2 "SC_HID_SC_FAP_BTN_REF2" +#define HID_SC_FAP_BTN_REF3 "SC_HID_SC_FAP_BTN_REF3" +#define HID_SC_FAP_BTN_REF4 "SC_HID_SC_FAP_BTN_REF4" +#define HID_SC_FAP_FORMULA "SC_HID_SC_FAP_FORMULA" + +#define HID_SC_SORT_ACTION "SC_HID_SC_SORT_ACTION" +#define HID_SC_SORT_AUTHOR "SC_HID_SC_SORT_AUTHOR" +#define HID_SC_SORT_DATE "SC_HID_SC_SORT_DATE" +#define HID_SC_SORT_COMMENT "SC_HID_SC_SORT_COMMENT" +#define HID_SORT_POSITION "SC_HID_SORT_POSITION" +#define HID_SC_CHANGES_COMMENT "SC_HID_SC_CHANGES_COMMENT" +#define HID_SC_FUNCTIONLIST "SC_HID_SC_FUNCTIONLIST" +#define HID_SCPAGE_OPTLOAD "SC_HID_SCPAGE_OPTLOAD" +#define HID_PASSWD_TABLE "SC_HID_PASSWD_TABLE" +#define HID_PASSWD_DOC "SC_HID_PASSWD_DOC" + +#define HID_DATAPILOT_TYPE "SC_HID_DATAPILOT_TYPE" +#define HID_DATAPILOT_DATABASE "SC_HID_DATAPILOT_DATABASE" +#define HID_DATAPILOT_SERVICE "SC_HID_DATAPILOT_SERVICE" + +// Other help IDs (max.70) --------------------------------------------------- +#define HID_SCDLG_LINKAREAURL "SC_HID_SCDLG_LINKAREAURL" +#define HID_SCMENU_EDIT_TABLE "SC_HID_SCMENU_EDIT_TABLE" + +#define HID_SELECTTABLES "SC_HID_SELECTTABLES" +#define HID_SC_REPLCELLSWARN "SC_HID_SC_REPLCELLSWARN" + +// data pilot layout dialog +#define HID_SC_DPLAY_PAGE "SC_HID_SC_DPLAY_PAGE" +#define HID_SC_DPLAY_COLUMN "SC_HID_SC_DPLAY_COLUMN" +#define HID_SC_DPLAY_ROW "SC_HID_SC_DPLAY_ROW" +#define HID_SC_DPLAY_DATA "SC_HID_SC_DPLAY_DATA" +#define HID_SC_DPLAY_SELECT "SC_HID_SC_DPLAY_SELECT" + +#define HID_SC_DRAW_RENAME "SC_HID_SC_DRAW_RENAME" + +#define HID_SC_DPDATAFIELD "SC_HID_SC_DPDATAFIELD" +#define HID_SC_DPSUBT_OPT "SC_HID_SC_DPSUBT_OPT" +#define HID_SC_DPSUBT_HIDE "SC_HID_SC_DPSUBT_HIDE" +#define HID_SC_DPNUMGROUP "SC_HID_SC_DPNUMGROUP" +#define HID_SC_DPDATEGROUP "SC_HID_SC_DPDATEGROUP" +#define HID_SC_DPDATEGROUP_LB "SC_HID_SC_DPDATEGROUP_LB" +#define HID_SC_DPSHOWDETAIL "SC_HID_SC_DPSHOWDETAIL" + +// #i68101# +#define HID_SC_TITLE_DESCRIPTION_OBJECT "SC_HID_SC_TITLE_DESCRIPTION_OBJECT" + +#define HID_SC_SOLVEROPTIONS "SC_HID_SC_SOLVEROPTIONS" +#define HID_SC_SOLVEROPTIONS_LB "SC_HID_SC_SOLVEROPTIONS_LB" +#define HID_SC_SOLVER_INTEGER "SC_HID_SC_SOLVER_INTEGER" +#define HID_SC_SOLVER_DOUBLE "SC_HID_SC_SOLVER_DOUBLE" +#define HID_SC_SOLVER_PROGRESS "SC_HID_SC_SOLVER_PROGRESS" +#define HID_SC_SOLVER_NOSOLUTION "SC_HID_SC_SOLVER_NOSOLUTION" +#define HID_SC_SOLVER_SUCCESS "SC_HID_SC_SOLVER_SUCCESS" + +#define HID_SCDLG_CONFLICTS "SC_HID_SCDLG_CONFLICTS" + +#define HID_SC_HF_HL_DEFINED "SC_HID_SC_HF_HL_DEFINED" +#define HID_SC_HF_HR_DEFINED "SC_HID_SC_HF_HR_DEFINED" +#define HID_SC_HF_FL_DEFINED "SC_HID_SC_HF_FL_DEFINED" +#define HID_SC_HF_FR_DEFINED "SC_HID_SC_HF_FR_DEFINED" + +// Analysis Addin Functions (max.120) ---------------------------------------- +#define HID_AAI_FUNC_WORKDAY "SC_HID_AAI_FUNC_WORKDAY" +#define HID_AAI_FUNC_YEARFRAC "SC_HID_AAI_FUNC_YEARFRAC" +#define HID_AAI_FUNC_EDATE "SC_HID_AAI_FUNC_EDATE" +#define HID_AAI_FUNC_WEEKNUM "SC_HID_AAI_FUNC_WEEKNUM" +#define HID_AAI_FUNC_EOMONTH "SC_HID_AAI_FUNC_EOMONTH" +#define HID_AAI_FUNC_NETWORKDAYS "SC_HID_AAI_FUNC_NETWORKDAYS" +#define HID_AAI_FUNC_AMORDEGRC "SC_HID_AAI_FUNC_AMORDEGRC" +#define HID_AAI_FUNC_AMORLINC "SC_HID_AAI_FUNC_AMORLINC" +#define HID_AAI_FUNC_ACCRINT "SC_HID_AAI_FUNC_ACCRINT" +#define HID_AAI_FUNC_ACCRINTM "SC_HID_AAI_FUNC_ACCRINTM" +#define HID_AAI_FUNC_RECEIVED "SC_HID_AAI_FUNC_RECEIVED" +#define HID_AAI_FUNC_DISC "SC_HID_AAI_FUNC_DISC" +#define HID_AAI_FUNC_DURATION "SC_HID_AAI_FUNC_DURATION" +#define HID_AAI_FUNC_EFFECT "SC_HID_AAI_FUNC_EFFECT" +#define HID_AAI_FUNC_CUMPRINC "SC_HID_AAI_FUNC_CUMPRINC" +#define HID_AAI_FUNC_CUMIPMT "SC_HID_AAI_FUNC_CUMIPMT" +#define HID_AAI_FUNC_PRICE "SC_HID_AAI_FUNC_PRICE" +#define HID_AAI_FUNC_PRICEDISC "SC_HID_AAI_FUNC_PRICEDISC" +#define HID_AAI_FUNC_PRICEMAT "SC_HID_AAI_FUNC_PRICEMAT" +#define HID_AAI_FUNC_MDURATION "SC_HID_AAI_FUNC_MDURATION" +#define HID_AAI_FUNC_NOMINAL "SC_HID_AAI_FUNC_NOMINAL" +#define HID_AAI_FUNC_DOLLARFR "SC_HID_AAI_FUNC_DOLLARFR" +#define HID_AAI_FUNC_DOLLARDE "SC_HID_AAI_FUNC_DOLLARDE" +#define HID_AAI_FUNC_YIELD "SC_HID_AAI_FUNC_YIELD" +#define HID_AAI_FUNC_YIELDDISC "SC_HID_AAI_FUNC_YIELDDISC" +#define HID_AAI_FUNC_YIELDMAT "SC_HID_AAI_FUNC_YIELDMAT" +#define HID_AAI_FUNC_TBILLEQ "SC_HID_AAI_FUNC_TBILLEQ" +#define HID_AAI_FUNC_TBILLPRICE "SC_HID_AAI_FUNC_TBILLPRICE" +#define HID_AAI_FUNC_TBILLYIELD "SC_HID_AAI_FUNC_TBILLYIELD" +#define HID_AAI_FUNC_ODDFPRICE "SC_HID_AAI_FUNC_ODDFPRICE" +#define HID_AAI_FUNC_ODDFYIELD "SC_HID_AAI_FUNC_ODDFYIELD" +#define HID_AAI_FUNC_ODDLPRICE "SC_HID_AAI_FUNC_ODDLPRICE" +#define HID_AAI_FUNC_ODDLYIELD "SC_HID_AAI_FUNC_ODDLYIELD" +#define HID_AAI_FUNC_XIRR "SC_HID_AAI_FUNC_XIRR" +#define HID_AAI_FUNC_XNPV "SC_HID_AAI_FUNC_XNPV" +#define HID_AAI_FUNC_INTRATE "SC_HID_AAI_FUNC_INTRATE" +#define HID_AAI_FUNC_COUPNCD "SC_HID_AAI_FUNC_COUPNCD" +#define HID_AAI_FUNC_COUPDAYS "SC_HID_AAI_FUNC_COUPDAYS" +#define HID_AAI_FUNC_COUPDAYSNC "SC_HID_AAI_FUNC_COUPDAYSNC" +#define HID_AAI_FUNC_COUPDAYBS "SC_HID_AAI_FUNC_COUPDAYBS" +#define HID_AAI_FUNC_COUPPCD "SC_HID_AAI_FUNC_COUPPCD" +#define HID_AAI_FUNC_COUPNUM "SC_HID_AAI_FUNC_COUPNUM" +#define HID_AAI_FUNC_FVSCHEDULE "SC_HID_AAI_FUNC_FVSCHEDULE" +#define HID_AAI_FUNC_ISEVEN "SC_HID_AAI_FUNC_ISEVEN" +#define HID_AAI_FUNC_ISODD "SC_HID_AAI_FUNC_ISODD" +#define HID_AAI_FUNC_GCD "SC_HID_AAI_FUNC_GCD" +#define HID_AAI_FUNC_LCM "SC_HID_AAI_FUNC_LCM" +#define HID_AAI_FUNC_MULTINOMIAL "SC_HID_AAI_FUNC_MULTINOMIAL" +#define HID_AAI_FUNC_SERIESSUM "SC_HID_AAI_FUNC_SERIESSUM" +#define HID_AAI_FUNC_QUOTIENT "SC_HID_AAI_FUNC_QUOTIENT" +#define HID_AAI_FUNC_MROUND "SC_HID_AAI_FUNC_MROUND" +#define HID_AAI_FUNC_SQRTPI "SC_HID_AAI_FUNC_SQRTPI" +#define HID_AAI_FUNC_RANDBETWEEN "SC_HID_AAI_FUNC_RANDBETWEEN" +#define HID_AAI_FUNC_BESSELI "SC_HID_AAI_FUNC_BESSELI" +#define HID_AAI_FUNC_BESSELJ "SC_HID_AAI_FUNC_BESSELJ" +#define HID_AAI_FUNC_BESSELK "SC_HID_AAI_FUNC_BESSELK" +#define HID_AAI_FUNC_BESSELY "SC_HID_AAI_FUNC_BESSELY" +#define HID_AAI_FUNC_BIN2DEC "SC_HID_AAI_FUNC_BIN2DEC" +#define HID_AAI_FUNC_BIN2HEX "SC_HID_AAI_FUNC_BIN2HEX" +#define HID_AAI_FUNC_BIN2OCT "SC_HID_AAI_FUNC_BIN2OCT" +#define HID_AAI_FUNC_DELTA "SC_HID_AAI_FUNC_DELTA" +#define HID_AAI_FUNC_DEC2BIN "SC_HID_AAI_FUNC_DEC2BIN" +#define HID_AAI_FUNC_DEC2HEX "SC_HID_AAI_FUNC_DEC2HEX" +#define HID_AAI_FUNC_DEC2OCT "SC_HID_AAI_FUNC_DEC2OCT" +#define HID_AAI_FUNC_ERF "SC_HID_AAI_FUNC_ERF" +#define HID_AAI_FUNC_ERFC "SC_HID_AAI_FUNC_ERFC" +#define HID_AAI_FUNC_GESTEP "SC_HID_AAI_FUNC_GESTEP" +#define HID_AAI_FUNC_HEX2BIN "SC_HID_AAI_FUNC_HEX2BIN" +#define HID_AAI_FUNC_HEX2DEC "SC_HID_AAI_FUNC_HEX2DEC" +#define HID_AAI_FUNC_HEX2OCT "SC_HID_AAI_FUNC_HEX2OCT" +#define HID_AAI_FUNC_IMABS "SC_HID_AAI_FUNC_IMABS" +#define HID_AAI_FUNC_IMAGINARY "SC_HID_AAI_FUNC_IMAGINARY" +#define HID_AAI_FUNC_IMPOWER "SC_HID_AAI_FUNC_IMPOWER" +#define HID_AAI_FUNC_IMARGUMENT "SC_HID_AAI_FUNC_IMARGUMENT" +#define HID_AAI_FUNC_IMCOS "SC_HID_AAI_FUNC_IMCOS" +#define HID_AAI_FUNC_IMDIV "SC_HID_AAI_FUNC_IMDIV" +#define HID_AAI_FUNC_IMEXP "SC_HID_AAI_FUNC_IMEXP" +#define HID_AAI_FUNC_IMCONJUGATE "SC_HID_AAI_FUNC_IMCONJUGATE" +#define HID_AAI_FUNC_IMLN "SC_HID_AAI_FUNC_IMLN" +#define HID_AAI_FUNC_IMLOG10 "SC_HID_AAI_FUNC_IMLOG10" +#define HID_AAI_FUNC_IMLOG2 "SC_HID_AAI_FUNC_IMLOG2" +#define HID_AAI_FUNC_IMPRODUCT "SC_HID_AAI_FUNC_IMPRODUCT" +#define HID_AAI_FUNC_IMREAL "SC_HID_AAI_FUNC_IMREAL" +#define HID_AAI_FUNC_IMSIN "SC_HID_AAI_FUNC_IMSIN" +#define HID_AAI_FUNC_IMSUB "SC_HID_AAI_FUNC_IMSUB" +#define HID_AAI_FUNC_IMSUM "SC_HID_AAI_FUNC_IMSUM" +#define HID_AAI_FUNC_IMSQRT "SC_HID_AAI_FUNC_IMSQRT" +#define HID_AAI_FUNC_COMPLEX "SC_HID_AAI_FUNC_COMPLEX" +#define HID_AAI_FUNC_OCT2BIN "SC_HID_AAI_FUNC_OCT2BIN" +#define HID_AAI_FUNC_OCT2DEZ "SC_HID_AAI_FUNC_OCT2DEZ" +#define HID_AAI_FUNC_OCT2HEX "SC_HID_AAI_FUNC_OCT2HEX" +#define HID_AAI_FUNC_CONVERT "SC_HID_AAI_FUNC_CONVERT" +#define HID_AAI_FUNC_FACTDOUBLE "SC_HID_AAI_FUNC_FACTDOUBLE" + +// DateFunc Addin Functions (max.20) ----------------------------------------- +#define HID_DAI_FUNC_DAYSINMONTH "SC_HID_DAI_FUNC_DAYSINMONTH" +#define HID_DAI_FUNC_DAYSINYEAR "SC_HID_DAI_FUNC_DAYSINYEAR" +#define HID_DAI_FUNC_WEEKSINYEAR "SC_HID_DAI_FUNC_WEEKSINYEAR" +#define HID_DAI_FUNC_DIFFMONTHS "SC_HID_DAI_FUNC_DIFFMONTHS" +#define HID_DAI_FUNC_DIFFWEEKS "SC_HID_DAI_FUNC_DIFFWEEKS" +#define HID_DAI_FUNC_DIFFYEARS "SC_HID_DAI_FUNC_DIFFYEARS" +#define HID_DAI_FUNC_ROT13 "SC_HID_DAI_FUNC_ROT13" + +#define HID_SCPAGE_OPREDLINBE_FT_CONTENT "SC_HID_SCPAGE_OPREDLINBE_FT_CONTENT" +#define HID_MN_FORMAT_STYLE "SC_HID_MN_FORMAT_STYLE" +#define HID_MN_FORMAT_ALGN "SC_HID_MN_FORMAT_ALGN" +#define HID_MN_FORMAT_LINESPACE "SC_HID_MN_FORMAT_LINESPACE" + + +// Ende Hilfe IDs ------------------------------------------------------------ + +#define HID_SC_FUNC_DUMMY "SC_HID_SC_FUNC_DUMMY" + +#define HID_FUNC_DBANZAHL "SC_HID_FUNC_DBANZAHL" +#define HID_FUNC_DBANZAHL2 "SC_HID_FUNC_DBANZAHL2" +#define HID_FUNC_DBMITTELWERT "SC_HID_FUNC_DBMITTELWERT" +#define HID_FUNC_DBAUSZUG "SC_HID_FUNC_DBAUSZUG" +#define HID_FUNC_DBMAX "SC_HID_FUNC_DBMAX" +#define HID_FUNC_DBMIN "SC_HID_FUNC_DBMIN" +#define HID_FUNC_DBPRODUKT "SC_HID_FUNC_DBPRODUKT" +#define HID_FUNC_DBSTDABW "SC_HID_FUNC_DBSTDABW" +#define HID_FUNC_DBSTDABWN "SC_HID_FUNC_DBSTDABWN" +#define HID_FUNC_DBSUMME "SC_HID_FUNC_DBSUMME" +#define HID_FUNC_DBVARIANZ "SC_HID_FUNC_DBVARIANZ" +#define HID_FUNC_DBVARIANZEN "SC_HID_FUNC_DBVARIANZEN" + +#define HID_FUNC_DATUM "SC_HID_FUNC_DATUM" +#define HID_FUNC_DATWERT "SC_HID_FUNC_DATWERT" +#define HID_FUNC_TAG "SC_HID_FUNC_TAG" +#define HID_FUNC_TAGE360 "SC_HID_FUNC_TAGE360" +#define HID_FUNC_STUNDE "SC_HID_FUNC_STUNDE" +#define HID_FUNC_MINUTE "SC_HID_FUNC_MINUTE" +#define HID_FUNC_MONAT "SC_HID_FUNC_MONAT" +#define HID_FUNC_JETZT "SC_HID_FUNC_JETZT" +#define HID_FUNC_SEKUNDE "SC_HID_FUNC_SEKUNDE" +#define HID_FUNC_ZEIT "SC_HID_FUNC_ZEIT" +#define HID_FUNC_ZEITWERT "SC_HID_FUNC_ZEITWERT" +#define HID_FUNC_HEUTE "SC_HID_FUNC_HEUTE" +#define HID_FUNC_WOCHENTAG "SC_HID_FUNC_WOCHENTAG" +#define HID_FUNC_JAHR "SC_HID_FUNC_JAHR" +#define HID_FUNC_TAGE "SC_HID_FUNC_TAGE" +#define HID_FUNC_KALENDERWOCHE "SC_HID_FUNC_KALENDERWOCHE" +#define HID_FUNC_OSTERSONNTAG "SC_HID_FUNC_OSTERSONNTAG" + +#define HID_FUNC_BW "SC_HID_FUNC_BW" +#define HID_FUNC_ZW "SC_HID_FUNC_ZW" +#define HID_FUNC_ZZR "SC_HID_FUNC_ZZR" +#define HID_FUNC_RMZ "SC_HID_FUNC_RMZ" +#define HID_FUNC_ZINS "SC_HID_FUNC_ZINS" +#define HID_FUNC_ZINSZ "SC_HID_FUNC_ZINSZ" +#define HID_FUNC_KAPZ "SC_HID_FUNC_KAPZ" +#define HID_FUNC_KUMKAPITAL "SC_HID_FUNC_KUMKAPITAL" +#define HID_FUNC_KUMZINSZ "SC_HID_FUNC_KUMZINSZ" +#define HID_FUNC_DIA "SC_HID_FUNC_DIA" +#define HID_FUNC_LIA "SC_HID_FUNC_LIA" +#define HID_FUNC_GDA "SC_HID_FUNC_GDA" +#define HID_FUNC_GDA2 "SC_HID_FUNC_GDA2" +#define HID_FUNC_VDB "SC_HID_FUNC_VDB" +#define HID_FUNC_EFFEKTIV "SC_HID_FUNC_EFFEKTIV" +#define HID_FUNC_NOMINAL "SC_HID_FUNC_NOMINAL" +#define HID_FUNC_NBW "SC_HID_FUNC_NBW" +#define HID_FUNC_IKV "SC_HID_FUNC_IKV" +#define HID_FUNC_LAUFZEIT "SC_HID_FUNC_LAUFZEIT" +#define HID_FUNC_ZGZ "SC_HID_FUNC_ZGZ" +#define HID_FUNC_QIKV "SC_HID_FUNC_QIKV" +#define HID_FUNC_ISPMT "SC_HID_FUNC_ISPMT" + +#define HID_FUNC_ISTBEZUG "SC_HID_FUNC_ISTBEZUG" +#define HID_FUNC_ISTFEHL "SC_HID_FUNC_ISTFEHL" +#define HID_FUNC_ISTFEHLER "SC_HID_FUNC_ISTFEHLER" +#define HID_FUNC_ISTLEER "SC_HID_FUNC_ISTLEER" +#define HID_FUNC_ISTLOG "SC_HID_FUNC_ISTLOG" +#define HID_FUNC_ISTNV "SC_HID_FUNC_ISTNV" +#define HID_FUNC_ISTKTEXT "SC_HID_FUNC_ISTKTEXT" +#define HID_FUNC_ISTTEXT "SC_HID_FUNC_ISTTEXT" +#define HID_FUNC_ISTZAHL "SC_HID_FUNC_ISTZAHL" +#define HID_FUNC_ISTFORMEL "SC_HID_FUNC_ISTFORMEL" +#define HID_FUNC_N "SC_HID_FUNC_N" +#define HID_FUNC_NV "SC_HID_FUNC_NV" +#define HID_FUNC_TYP "SC_HID_FUNC_TYP" +#define HID_FUNC_AKTUELL "SC_HID_FUNC_AKTUELL" +#define HID_FUNC_FORMEL "SC_HID_FUNC_FORMEL" +#define HID_FUNC_ZELLE "SC_HID_FUNC_ZELLE" +#define HID_FUNC_INFO "SC_HID_FUNC_INFO" + + +#define HID_FUNC_FALSCH "SC_HID_FUNC_FALSCH" +#define HID_FUNC_NICHT "SC_HID_FUNC_NICHT" +#define HID_FUNC_WAHR "SC_HID_FUNC_WAHR" +#define HID_FUNC_WENN "SC_HID_FUNC_WENN" +#define HID_FUNC_ODER "SC_HID_FUNC_ODER" +#define HID_FUNC_UND "SC_HID_FUNC_UND" + +#define HID_FUNC_ABS "SC_HID_FUNC_ABS" +#define HID_FUNC_POTENZ "SC_HID_FUNC_POTENZ" +#define HID_FUNC_ANZAHLLEEREZELLEN "SC_HID_FUNC_ANZAHLLEEREZELLEN" +#define HID_FUNC_PI "SC_HID_FUNC_PI" +#define HID_FUNC_SUMME "SC_HID_FUNC_SUMME" +#define HID_FUNC_QUADRATESUMME "SC_HID_FUNC_QUADRATESUMME" +#define HID_FUNC_PRODUKT "SC_HID_FUNC_PRODUKT" +#define HID_FUNC_SUMMEWENN "SC_HID_FUNC_SUMMEWENN" +#define HID_FUNC_ZAEHLENWENN "SC_HID_FUNC_ZAEHLENWENN" +#define HID_FUNC_WURZEL "SC_HID_FUNC_WURZEL" +#define HID_FUNC_ZUFALLSZAHL "SC_HID_FUNC_ZUFALLSZAHL" +#define HID_FUNC_ISTGERADE "SC_HID_FUNC_ISTGERADE" +#define HID_FUNC_ISTUNGERADE "SC_HID_FUNC_ISTUNGERADE" +#define HID_FUNC_KOMBINATIONEN "SC_HID_FUNC_KOMBINATIONEN" +#define HID_FUNC_KOMBINATIONEN2 "SC_HID_FUNC_KOMBINATIONEN2" +#define HID_FUNC_ARCCOS "SC_HID_FUNC_ARCCOS" +#define HID_FUNC_ARCSIN "SC_HID_FUNC_ARCSIN" +#define HID_FUNC_ARCOSHYP "SC_HID_FUNC_ARCOSHYP" +#define HID_FUNC_ARSINHYP "SC_HID_FUNC_ARSINHYP" +#define HID_FUNC_ARCCOT "SC_HID_FUNC_ARCCOT" +#define HID_FUNC_ARCTAN "SC_HID_FUNC_ARCTAN" +#define HID_FUNC_ARCOTHYP "SC_HID_FUNC_ARCOTHYP" +#define HID_FUNC_ARTANHYP "SC_HID_FUNC_ARTANHYP" +#define HID_FUNC_COS "SC_HID_FUNC_COS" +#define HID_FUNC_SIN "SC_HID_FUNC_SIN" +#define HID_FUNC_COT "SC_HID_FUNC_COT" +#define HID_FUNC_TAN "SC_HID_FUNC_TAN" +#define HID_FUNC_COSHYP "SC_HID_FUNC_COSHYP" +#define HID_FUNC_SINHYP "SC_HID_FUNC_SINHYP" +#define HID_FUNC_COTHYP "SC_HID_FUNC_COTHYP" +#define HID_FUNC_TANHYP "SC_HID_FUNC_TANHYP" +#define HID_FUNC_ARCTAN2 "SC_HID_FUNC_ARCTAN2" +#define HID_FUNC_DEG "SC_HID_FUNC_DEG" +#define HID_FUNC_RAD "SC_HID_FUNC_RAD" +#define HID_FUNC_EXP "SC_HID_FUNC_EXP" +#define HID_FUNC_LOG "SC_HID_FUNC_LOG" +#define HID_FUNC_LN "SC_HID_FUNC_LN" +#define HID_FUNC_LOG10 "SC_HID_FUNC_LOG10" +#define HID_FUNC_FAKULTAET "SC_HID_FUNC_FAKULTAET" +#define HID_FUNC_REST "SC_HID_FUNC_REST" +#define HID_FUNC_VORZEICHEN "SC_HID_FUNC_VORZEICHEN" +#define HID_FUNC_TEILERGEBNIS "SC_HID_FUNC_TEILERGEBNIS" +#define HID_FUNC_GANZZAHL "SC_HID_FUNC_GANZZAHL" +#define HID_FUNC_KUERZEN "SC_HID_FUNC_KUERZEN" +#define HID_FUNC_RUNDEN "SC_HID_FUNC_RUNDEN" +#define HID_FUNC_AUFRUNDEN "SC_HID_FUNC_AUFRUNDEN" +#define HID_FUNC_ABRUNDEN "SC_HID_FUNC_ABRUNDEN" +#define HID_FUNC_GERADE "SC_HID_FUNC_GERADE" +#define HID_FUNC_UNGERADE "SC_HID_FUNC_UNGERADE" +#define HID_FUNC_OBERGRENZE "SC_HID_FUNC_OBERGRENZE" +#define HID_FUNC_UNTERGRENZE "SC_HID_FUNC_UNTERGRENZE" +#define HID_FUNC_GGT "SC_HID_FUNC_GGT" +#define HID_FUNC_KGV "SC_HID_FUNC_KGV" +#define HID_FUNC_UMRECHNEN "SC_HID_FUNC_UMRECHNEN" +#define HID_FUNC_EUROCONVERT "SC_HID_FUNC_EUROCONVERT" + +#define HID_FUNC_MTRANS "SC_HID_FUNC_MTRANS" +#define HID_FUNC_MMULT "SC_HID_FUNC_MMULT" +#define HID_FUNC_MDET "SC_HID_FUNC_MDET" +#define HID_FUNC_MINV "SC_HID_FUNC_MINV" +#define HID_FUNC_EINHEITSMATRIX "SC_HID_FUNC_EINHEITSMATRIX" +#define HID_FUNC_SUMMENPRODUKT "SC_HID_FUNC_SUMMENPRODUKT" +#define HID_FUNC_SUMMEX2MY2 "SC_HID_FUNC_SUMMEX2MY2" +#define HID_FUNC_SUMMEX2PY2 "SC_HID_FUNC_SUMMEX2PY2" +#define HID_FUNC_SUMMEXMY2 "SC_HID_FUNC_SUMMEXMY2" +#define HID_FUNC_HAEUFIGKEIT "SC_HID_FUNC_HAEUFIGKEIT" +#define HID_FUNC_RGP "SC_HID_FUNC_RGP" +#define HID_FUNC_RKP "SC_HID_FUNC_RKP" +#define HID_FUNC_TREND "SC_HID_FUNC_TREND" +#define HID_FUNC_VARIATION "SC_HID_FUNC_VARIATION" + +#define HID_FUNC_ANZAHL "SC_HID_FUNC_ANZAHL" +#define HID_FUNC_ANZAHL2 "SC_HID_FUNC_ANZAHL2" +#define HID_FUNC_MAX "SC_HID_FUNC_MAX" +#define HID_FUNC_MIN "SC_HID_FUNC_MIN" +#define HID_FUNC_VARIANZ "SC_HID_FUNC_VARIANZ" +#define HID_FUNC_VARIANZEN "SC_HID_FUNC_VARIANZEN" +#define HID_FUNC_STABW "SC_HID_FUNC_STABW" +#define HID_FUNC_STABWN "SC_HID_FUNC_STABWN" +#define HID_FUNC_MITTELWERT "SC_HID_FUNC_MITTELWERT" +#define HID_FUNC_SUMQUADABW "SC_HID_FUNC_SUMQUADABW" +#define HID_FUNC_MITTELABW "SC_HID_FUNC_MITTELABW" +#define HID_FUNC_SCHIEFE "SC_HID_FUNC_SCHIEFE" +#define HID_FUNC_KURT "SC_HID_FUNC_KURT" +#define HID_FUNC_GEOMITTEL "SC_HID_FUNC_GEOMITTEL" +#define HID_FUNC_HARMITTEL "SC_HID_FUNC_HARMITTEL" +#define HID_FUNC_MODALWERT "SC_HID_FUNC_MODALWERT" +#define HID_FUNC_MEDIAN "SC_HID_FUNC_MEDIAN" +#define HID_FUNC_QUANTIL "SC_HID_FUNC_QUANTIL" +#define HID_FUNC_QUARTILE "SC_HID_FUNC_QUARTILE" +#define HID_FUNC_KGROESSTE "SC_HID_FUNC_KGROESSTE" +#define HID_FUNC_KKLEINSTE "SC_HID_FUNC_KKLEINSTE" +#define HID_FUNC_QUANTILSRANG "SC_HID_FUNC_QUANTILSRANG" +#define HID_FUNC_RANG "SC_HID_FUNC_RANG" +#define HID_FUNC_GESTUTZTMITTEL "SC_HID_FUNC_GESTUTZTMITTEL" +#define HID_FUNC_WAHRSCHBEREICH "SC_HID_FUNC_WAHRSCHBEREICH" +#define HID_FUNC_B "SC_HID_FUNC_B" +#define HID_FUNC_PHI "SC_HID_FUNC_PHI" +#define HID_FUNC_GAUSS "SC_HID_FUNC_GAUSS" +#define HID_FUNC_FISHER "SC_HID_FUNC_FISHER" +#define HID_FUNC_FISHERINV "SC_HID_FUNC_FISHERINV" +#define HID_FUNC_BINOMVERT "SC_HID_FUNC_BINOMVERT" +#define HID_FUNC_NEGBINOMVERT "SC_HID_FUNC_NEGBINOMVERT" +#define HID_FUNC_KRITBINOM "SC_HID_FUNC_KRITBINOM" +#define HID_FUNC_POISSON "SC_HID_FUNC_POISSON" +#define HID_FUNC_NORMVERT "SC_HID_FUNC_NORMVERT" +#define HID_FUNC_NORMINV "SC_HID_FUNC_NORMINV" +#define HID_FUNC_STANDNORMVERT "SC_HID_FUNC_STANDNORMVERT" +#define HID_FUNC_STANDNORMINV "SC_HID_FUNC_STANDNORMINV" +#define HID_FUNC_LOGNORMVERT "SC_HID_FUNC_LOGNORMVERT" +#define HID_FUNC_LOGINV "SC_HID_FUNC_LOGINV" +#define HID_FUNC_EXPONVERT "SC_HID_FUNC_EXPONVERT" +#define HID_FUNC_GAMMAVERT "SC_HID_FUNC_GAMMAVERT" +#define HID_FUNC_GAMMAINV "SC_HID_FUNC_GAMMAINV" +#define HID_FUNC_GAMMALN "SC_HID_FUNC_GAMMALN" +#define HID_FUNC_BETAVERT "SC_HID_FUNC_BETAVERT" +#define HID_FUNC_BETAINV "SC_HID_FUNC_BETAINV" +#define HID_FUNC_WEIBULL "SC_HID_FUNC_WEIBULL" +#define HID_FUNC_HYPGEOMVERT "SC_HID_FUNC_HYPGEOMVERT" +#define HID_FUNC_TVERT "SC_HID_FUNC_TVERT" +#define HID_FUNC_TINV "SC_HID_FUNC_TINV" +#define HID_FUNC_FVERT "SC_HID_FUNC_FVERT" +#define HID_FUNC_FINV "SC_HID_FUNC_FINV" +#define HID_FUNC_CHIVERT "SC_HID_FUNC_CHIVERT" +#define HID_FUNC_CHIINV "SC_HID_FUNC_CHIINV" +#define HID_FUNC_STANDARDISIERUNG "SC_HID_FUNC_STANDARDISIERUNG" +#define HID_FUNC_VARIATIONEN "SC_HID_FUNC_VARIATIONEN" +#define HID_FUNC_VARIATIONEN2 "SC_HID_FUNC_VARIATIONEN2" +#define HID_FUNC_KONFIDENZ "SC_HID_FUNC_KONFIDENZ" +#define HID_FUNC_GTEST "SC_HID_FUNC_GTEST" +#define HID_FUNC_CHITEST "SC_HID_FUNC_CHITEST" +#define HID_FUNC_FTEST "SC_HID_FUNC_FTEST" +#define HID_FUNC_TTEST "SC_HID_FUNC_TTEST" +#define HID_FUNC_BESTIMMTHEITSMASS "SC_HID_FUNC_BESTIMMTHEITSMASS" +#define HID_FUNC_ACHSENABSCHNITT "SC_HID_FUNC_ACHSENABSCHNITT" +#define HID_FUNC_STEIGUNG "SC_HID_FUNC_STEIGUNG" +#define HID_FUNC_STFEHLERYX "SC_HID_FUNC_STFEHLERYX" +#define HID_FUNC_PEARSON "SC_HID_FUNC_PEARSON" +#define HID_FUNC_KORREL "SC_HID_FUNC_KORREL" +#define HID_FUNC_KOVAR "SC_HID_FUNC_KOVAR" +#define HID_FUNC_SCHAETZER "SC_HID_FUNC_SCHAETZER" +#define HID_FUNC_MINA "SC_HID_FUNC_MINA" +#define HID_FUNC_MAXA "SC_HID_FUNC_MAXA" +#define HID_FUNC_MITTELWERTA "SC_HID_FUNC_MITTELWERTA" +#define HID_FUNC_STABWA "SC_HID_FUNC_STABWA" +#define HID_FUNC_STABWNA "SC_HID_FUNC_STABWNA" +#define HID_FUNC_VARIANZA "SC_HID_FUNC_VARIANZA" +#define HID_FUNC_VARIANZENA "SC_HID_FUNC_VARIANZENA" +#define HID_FUNC_CHISQDIST "SC_HID_FUNC_CHISQDIST" +#define HID_FUNC_CHISQINV "SC_HID_FUNC_CHISQINV" +#define HID_FUNC_GAMMA "SC_HID_FUNC_GAMMA" + +#define HID_FUNC_ADRESSE "SC_HID_FUNC_ADRESSE" +#define HID_FUNC_BEREICHE "SC_HID_FUNC_BEREICHE" +#define HID_FUNC_WAHL "SC_HID_FUNC_WAHL" +#define HID_FUNC_SPALTE "SC_HID_FUNC_SPALTE" +#define HID_FUNC_ZEILE "SC_HID_FUNC_ZEILE" +#define HID_FUNC_SPALTEN "SC_HID_FUNC_SPALTEN" +#define HID_FUNC_ZEILEN "SC_HID_FUNC_ZEILEN" +#define HID_FUNC_WVERWEIS "SC_HID_FUNC_WVERWEIS" +#define HID_FUNC_SVERWEIS "SC_HID_FUNC_SVERWEIS" +#define HID_FUNC_INDEX "SC_HID_FUNC_INDEX" +#define HID_FUNC_INDIREKT "SC_HID_FUNC_INDIREKT" +#define HID_FUNC_VERWEIS "SC_HID_FUNC_VERWEIS" +#define HID_FUNC_VERGLEICH "SC_HID_FUNC_VERGLEICH" +#define HID_FUNC_VERSCHIEBUNG "SC_HID_FUNC_VERSCHIEBUNG" +#define HID_FUNC_FEHLERTYP "SC_HID_FUNC_FEHLERTYP" +#define HID_FUNC_VORLAGE "SC_HID_FUNC_VORLAGE" +#define HID_FUNC_DDE "SC_HID_FUNC_DDE" +#define HID_FUNC_TABELLE "SC_HID_FUNC_TABELLE" +#define HID_FUNC_TABELLEN "SC_HID_FUNC_TABELLEN" +#define HID_FUNC_HYPERLINK "SC_HID_FUNC_HYPERLINK" +#define HID_FUNC_GETPIVOTDATA "SC_HID_FUNC_GETPIVOTDATA" + +#define HID_FUNC_CODE "SC_HID_FUNC_CODE" +#define HID_FUNC_DM "SC_HID_FUNC_DM" +#define HID_FUNC_ZEICHEN "SC_HID_FUNC_ZEICHEN" +#define HID_FUNC_SAEUBERN "SC_HID_FUNC_SAEUBERN" +#define HID_FUNC_VERKETTEN "SC_HID_FUNC_VERKETTEN" +#define HID_FUNC_IDENTISCH "SC_HID_FUNC_IDENTISCH" +#define HID_FUNC_FINDEN "SC_HID_FUNC_FINDEN" +#define HID_FUNC_SUCHEN "SC_HID_FUNC_SUCHEN" +#define HID_FUNC_GLAETTEN "SC_HID_FUNC_GLAETTEN" +#define HID_FUNC_GROSS2 "SC_HID_FUNC_GROSS2" +#define HID_FUNC_GROSS "SC_HID_FUNC_GROSS" +#define HID_FUNC_KLEIN "SC_HID_FUNC_KLEIN" +#define HID_FUNC_WERT "SC_HID_FUNC_WERT" +#define HID_FUNC_TEXT "SC_HID_FUNC_TEXT" +#define HID_FUNC_T "SC_HID_FUNC_T" +#define HID_FUNC_ERSETZEN "SC_HID_FUNC_ERSETZEN" +#define HID_FUNC_FEST "SC_HID_FUNC_FEST" +#define HID_FUNC_LAENGE "SC_HID_FUNC_LAENGE" +#define HID_FUNC_LINKS "SC_HID_FUNC_LINKS" +#define HID_FUNC_RECHTS "SC_HID_FUNC_RECHTS" +#define HID_FUNC_TEIL "SC_HID_FUNC_TEIL" +#define HID_FUNC_WIEDERHOLEN "SC_HID_FUNC_WIEDERHOLEN" +#define HID_FUNC_WECHSELN "SC_HID_FUNC_WECHSELN" +#define HID_FUNC_BASIS "SC_HID_FUNC_BASIS" +#define HID_FUNC_DEZIMAL "SC_HID_FUNC_DEZIMAL" +#define HID_FUNC_ROEMISCH "SC_HID_FUNC_ROEMISCH" +#define HID_FUNC_ARABISCH "SC_HID_FUNC_ARABISCH" +#define HID_FUNC_BAHTTEXT "SC_HID_FUNC_BAHTTEXT" +#define HID_FUNC_JIS "SC_HID_FUNC_JIS" +#define HID_FUNC_ASC "SC_HID_FUNC_ASC" +#define HID_FUNC_UNICODE "SC_HID_FUNC_UNICODE" +#define HID_FUNC_UNICHAR "SC_HID_FUNC_UNICHAR" +#define HID_FUNC_NUMBERVALUE "SC_HID_FUNC_NUMBERVALUE" diff --git a/sc/inc/hints.hxx b/sc/inc/hints.hxx new file mode 100644 index 000000000000..4ce3249bda05 --- /dev/null +++ b/sc/inc/hints.hxx @@ -0,0 +1,187 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_HINTS_HXX +#define SC_HINTS_HXX + +#include "global.hxx" +#include "address.hxx" +#include <svl/hint.hxx> + +// --------------------------------------------------------------------------- + +class ScPaintHint : public SfxHint +{ + ScRange aRange; + sal_uInt16 nParts; + sal_Bool bPrint; // flag indicating whether print/preview if affected + + ScPaintHint(); // disabled + +public: + TYPEINFO(); + ScPaintHint( const ScRange& rRng, sal_uInt16 nPaint = PAINT_ALL ); + ~ScPaintHint(); + + void SetPrintFlag(sal_Bool bSet) { bPrint = bSet; } + + const ScRange& GetRange() const { return aRange; } + SCCOL GetStartCol() const { return aRange.aStart.Col(); } + SCROW GetStartRow() const { return aRange.aStart.Row(); } + SCTAB GetStartTab() const { return aRange.aStart.Tab(); } + SCCOL GetEndCol() const { return aRange.aEnd.Col(); } + SCROW GetEndRow() const { return aRange.aEnd.Row(); } + SCTAB GetEndTab() const { return aRange.aEnd.Tab(); } + sal_uInt16 GetParts() const { return nParts; } + sal_Bool GetPrintFlag() const { return bPrint; } +}; + + +class ScUpdateRefHint : public SfxHint +{ + UpdateRefMode eUpdateRefMode; + ScRange aRange; + SCsCOL nDx; + SCsROW nDy; + SCsTAB nDz; + +public: + TYPEINFO(); + + ScUpdateRefHint( UpdateRefMode eMode, const ScRange& rR, + SCsCOL nX, SCsROW nY, SCsTAB nZ ); + ~ScUpdateRefHint(); + + UpdateRefMode GetMode() const { return eUpdateRefMode; } + const ScRange& GetRange() const { return aRange; } + SCsCOL GetDx() const { return nDx; } + SCsROW GetDy() const { return nDy; } + SCsTAB GetDz() const { return nDz; } +}; + + +#define SC_POINTERCHANGED_NUMFMT 1 + +class ScPointerChangedHint : public SfxHint +{ + sal_uInt16 nFlags; + +public: + TYPEINFO(); + + ~ScPointerChangedHint(); + + sal_uInt16 GetFlags() const { return nFlags; } +}; + + +//! move ScLinkRefreshedHint to a different file? + +#define SC_LINKREFTYPE_NONE 0 +#define SC_LINKREFTYPE_SHEET 1 +#define SC_LINKREFTYPE_AREA 2 +#define SC_LINKREFTYPE_DDE 3 + +class ScLinkRefreshedHint : public SfxHint +{ + sal_uInt16 nLinkType; // SC_LINKREFTYPE_... + String aUrl; // used for sheet links + String aDdeAppl; // used for dde links: + String aDdeTopic; + String aDdeItem; + sal_uInt8 nDdeMode; + ScAddress aDestPos; // used to identify area links + //! also use source data for area links? + +public: + TYPEINFO(); + ScLinkRefreshedHint(); + ~ScLinkRefreshedHint(); + + void SetSheetLink( const String& rSourceUrl ); + void SetDdeLink( const String& rA, const String& rT, const String& rI, sal_uInt8 nM ); + void SetAreaLink( const ScAddress& rPos ); + + sal_uInt16 GetLinkType() const { return nLinkType; } + const String& GetUrl() const { return aUrl; } + const String& GetDdeAppl() const { return aDdeAppl; } + const String& GetDdeTopic() const { return aDdeTopic; } + const String& GetDdeItem() const { return aDdeItem; } + sal_uInt8 GetDdeMode() const { return nDdeMode; } + const ScAddress& GetDestPos() const { return aDestPos; } +}; + + +//! move ScAutoStyleHint to a different file? + +class ScAutoStyleHint : public SfxHint +{ + ScRange aRange; + String aStyle1; + String aStyle2; + sal_uLong nTimeout; + +public: + TYPEINFO(); + ScAutoStyleHint( const ScRange& rR, const String& rSt1, + sal_uLong nT, const String& rSt2 ); + ~ScAutoStyleHint(); + + const ScRange& GetRange() const { return aRange; } + const String& GetStyle1() const { return aStyle1; } + sal_uInt32 GetTimeout() const { return nTimeout; } + const String& GetStyle2() const { return aStyle2; } +}; + +class ScDBRangeRefreshedHint : public SfxHint +{ + ScImportParam aParam; + +public: + TYPEINFO(); + ScDBRangeRefreshedHint( const ScImportParam& rP ); + ~ScDBRangeRefreshedHint(); + + const ScImportParam& GetImportParam() const { return aParam; } +}; + +class ScDataPilotModifiedHint : public SfxHint +{ + String maName; + +public: + TYPEINFO(); + ScDataPilotModifiedHint( const String& rName ); + ~ScDataPilotModifiedHint(); + + const String& GetName() const { return maName; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx new file mode 100644 index 000000000000..3a9a17eeed1a --- /dev/null +++ b/sc/inc/inputopt.hxx @@ -0,0 +1,107 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_INPUTOPT_HXX +#define SC_INPUTOPT_HXX + + +#include <unotools/configitem.hxx> +#include <tools/solar.h> + +class SvStream; + + +class ScInputOptions +{ +private: + sal_uInt16 nMoveDir; // enum ScDirection + sal_Bool bMoveSelection; + sal_Bool bEnterEdit; + sal_Bool bExtendFormat; + sal_Bool bRangeFinder; + sal_Bool bExpandRefs; + sal_Bool bMarkHeader; + sal_Bool bUseTabCol; + sal_Bool bTextWysiwyg; + sal_Bool bReplCellsWarn; + +public: + ScInputOptions(); + ScInputOptions( const ScInputOptions& rCpy ); + ~ScInputOptions(); + + void SetDefaults(); + + void SetMoveDir(sal_uInt16 nNew) { nMoveDir = nNew; } + sal_uInt16 GetMoveDir() const { return nMoveDir; } + void SetMoveSelection(sal_Bool bSet) { bMoveSelection = bSet; } + sal_Bool GetMoveSelection() const { return bMoveSelection; } + void SetEnterEdit(sal_Bool bSet) { bEnterEdit = bSet; } + sal_Bool GetEnterEdit() const { return bEnterEdit; } + void SetExtendFormat(sal_Bool bSet) { bExtendFormat = bSet; } + sal_Bool GetExtendFormat() const { return bExtendFormat; } + void SetRangeFinder(sal_Bool bSet) { bRangeFinder = bSet; } + sal_Bool GetRangeFinder() const { return bRangeFinder; } + void SetExpandRefs(sal_Bool bSet) { bExpandRefs = bSet; } + sal_Bool GetExpandRefs() const { return bExpandRefs; } + void SetMarkHeader(sal_Bool bSet) { bMarkHeader = bSet; } + sal_Bool GetMarkHeader() const { return bMarkHeader; } + void SetUseTabCol(sal_Bool bSet) { bUseTabCol = bSet; } + sal_Bool GetUseTabCol() const { return bUseTabCol; } + void SetTextWysiwyg(sal_Bool bSet) { bTextWysiwyg = bSet; } + sal_Bool GetTextWysiwyg() const { return bTextWysiwyg; } + void SetReplaceCellsWarn(sal_Bool bSet) { bReplCellsWarn = bSet; } + sal_Bool GetReplaceCellsWarn() const { return bReplCellsWarn; } + + const ScInputOptions& operator= ( const ScInputOptions& rOpt ); +}; + + +//================================================================== +// CfgItem for input options +//================================================================== + +class ScInputCfg : public ScInputOptions, + public utl::ConfigItem +{ + com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); + +public: + ScInputCfg(); + + void SetOptions( const ScInputOptions& rNew ); + void OptionsChanged(); // after direct access to SetOptions base class + + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames ); + virtual void Commit(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/linkuno.hxx b/sc/inc/linkuno.hxx new file mode 100644 index 000000000000..ea28415edda3 --- /dev/null +++ b/sc/inc/linkuno.hxx @@ -0,0 +1,630 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_LINKUNO_HXX +#define SC_LINKUNO_HXX + +#include <svl/lstner.hxx> +#include <svl/itemprop.hxx> +#include <com/sun/star/sheet/XDDELink.hpp> +#include <com/sun/star/sheet/XDDELinkResults.hpp> +#include <com/sun/star/sheet/XDDELinks.hpp> +#include <com/sun/star/sheet/XExternalDocLink.hpp> +#include <com/sun/star/sheet/XExternalDocLinks.hpp> +#include <com/sun/star/sheet/XExternalSheetCache.hpp> +#include <com/sun/star/sheet/XAreaLink.hpp> +#include <com/sun/star/sheet/XAreaLinks.hpp> +#include <com/sun/star/util/XRefreshable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase5.hxx> + +#include "externalrefmgr.hxx" + +#include <boost/unordered_map.hpp> +#include <vector> + +class ScAreaLink; +class ScDocShell; +class ScTableLink; + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >* XRefreshListenerPtr; +SV_DECL_PTRARR_DEL( XRefreshListenerArr_Impl, XRefreshListenerPtr, 4, 4 ) + + + +class ScSheetLinkObj : public cppu::WeakImplHelper4< + com::sun::star::container::XNamed, + com::sun::star::util::XRefreshable, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + SfxItemPropertySet aPropSet; + ScDocShell* pDocShell; + String aFileName; + XRefreshListenerArr_Impl aRefreshListeners; + + ScTableLink* GetLink_Impl() const; + void Refreshed_Impl(); + void ModifyRefreshDelay_Impl( sal_Int32 nRefresh ); + +public: + ScSheetLinkObj(ScDocShell* pDocSh, const String& rName); + virtual ~ScSheetLinkObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XRefreshable + virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // aus get/setPropertyValue gerufen: + ::rtl::OUString getFileName(void) const; + void setFileName(const ::rtl::OUString& FileName); + ::rtl::OUString getFilter(void) const; + void setFilter(const ::rtl::OUString& Filter); + ::rtl::OUString getFilterOptions(void) const; + void setFilterOptions(const ::rtl::OUString& FilterOptions); + sal_Int32 getRefreshDelay(void) const; + void setRefreshDelay(sal_Int32 nRefreshDelay); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScSheetLinksObj : public cppu::WeakImplHelper4< + com::sun::star::container::XNameAccess, + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + ScSheetLinkObj* GetObjectByIndex_Impl(sal_Int32 nIndex); + ScSheetLinkObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +public: + ScSheetLinksObj(ScDocShell* pDocSh); + virtual ~ScSheetLinksObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScAreaLinkObj : public cppu::WeakImplHelper4< + com::sun::star::sheet::XAreaLink, + com::sun::star::util::XRefreshable, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + SfxItemPropertySet aPropSet; + ScDocShell* pDocShell; + sal_uInt16 nPos; + XRefreshListenerArr_Impl aRefreshListeners; + + void Modify_Impl( const ::rtl::OUString* pNewFile, const ::rtl::OUString* pNewFilter, + const ::rtl::OUString* pNewOptions, const ::rtl::OUString* pNewSource, + const com::sun::star::table::CellRangeAddress* pNewDest ); + void ModifyRefreshDelay_Impl( sal_Int32 nRefresh ); + void Refreshed_Impl(); + +public: + ScAreaLinkObj(ScDocShell* pDocSh, sal_uInt16 nP); + virtual ~ScAreaLinkObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XRefreshable + virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo( ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // called from get/setPropertyValue: + ::rtl::OUString getFileName(void) const; + void setFileName(const ::rtl::OUString& FileName); + ::rtl::OUString getFilter(void) const; + void setFilter(const ::rtl::OUString& Filter); + ::rtl::OUString getFilterOptions(void) const; + void setFilterOptions(const ::rtl::OUString& FilterOptions); + sal_Int32 getRefreshDelay(void) const; + void setRefreshDelay(sal_Int32 nRefreshDelay); + + // XAreaLink + virtual ::rtl::OUString SAL_CALL getSourceArea() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSourceArea( const ::rtl::OUString& aSourceArea ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getDestArea() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDestArea( const ::com::sun::star::table::CellRangeAddress& aDestArea ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScAreaLinksObj : public cppu::WeakImplHelper3< + com::sun::star::sheet::XAreaLinks, + com::sun::star::container::XEnumerationAccess, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + ScAreaLinkObj* GetObjectByIndex_Impl(sal_Int32 nIndex); + +public: + ScAreaLinksObj(ScDocShell* pDocSh); + virtual ~ScAreaLinksObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XAreaLinks + virtual void SAL_CALL insertAtPosition( const ::com::sun::star::table::CellAddress& aDestPos, + const ::rtl::OUString& aFileName, + const ::rtl::OUString& aSourceArea, + const ::rtl::OUString& aFilter, + const ::rtl::OUString& aFilterOptions ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +//! order of XNamed and DDELink changed to avoid "duplicate comdat" symbols + +class ScDDELinkObj : public cppu::WeakImplHelper5< + com::sun::star::sheet::XDDELink, + com::sun::star::container::XNamed, + com::sun::star::util::XRefreshable, + com::sun::star::sheet::XDDELinkResults, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + String aAppl; + String aTopic; + String aItem; + XRefreshListenerArr_Impl aRefreshListeners; + + void Refreshed_Impl(); + +public: + ScDDELinkObj(ScDocShell* pDocSh, const String& rA, + const String& rT, const String& rI); + virtual ~ScDDELinkObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XDDELink + virtual ::rtl::OUString SAL_CALL getApplication() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getTopic() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getItem() throw(::com::sun::star::uno::RuntimeException); + + // XRefreshable + virtual void SAL_CALL refresh() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRefreshListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XRefreshListener >& l ) + throw(::com::sun::star::uno::RuntimeException); + + // XDDELinkResults + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > > + SAL_CALL getResults( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setResults( + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > >& aResults ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScDDELinksObj : public cppu::WeakImplHelper4< + com::sun::star::container::XEnumerationAccess, + com::sun::star::container::XIndexAccess, + com::sun::star::sheet::XDDELinks, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + ScDDELinkObj* GetObjectByIndex_Impl(sal_Int32 nIndex); + ScDDELinkObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +public: + ScDDELinksObj(ScDocShell* pDocSh); + virtual ~ScDDELinksObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XDDELinks + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XDDELink > SAL_CALL addDDELink( + const ::rtl::OUString& aApplication, const ::rtl::OUString& aTopic, + const ::rtl::OUString& aItem, ::com::sun::star::sheet::DDELinkMode nMode ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +class ScExternalSheetCacheObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalSheetCache > +{ +public: + explicit ScExternalSheetCacheObj(ScExternalRefCache::TableTypeRef pTable, size_t nIndex); + ~ScExternalSheetCacheObj(); + + // XExternalSheetCache + virtual void SAL_CALL setCellValue( + sal_Int32 nCol, sal_Int32 nRow, const ::com::sun::star::uno::Any& rAny) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Any SAL_CALL getCellValue(sal_Int32 nCol, sal_Int32 nRow) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllRows() + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getAllColumns(sal_Int32 nRow) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + + // Attributes + virtual sal_Int32 SAL_CALL getTokenIndex() + throw (::com::sun::star::uno::RuntimeException); + +private: + ScExternalSheetCacheObj(); + ScExternalSheetCacheObj(const ScExternalSheetCacheObj&); + +private: + ScExternalRefCache::TableTypeRef mpTable; + size_t mnIndex; +}; + +class ScExternalDocLinkObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLink > +{ +public: + ScExternalDocLinkObj(ScExternalRefManager* pRefMgr, sal_uInt16 nFileId); + ~ScExternalDocLinkObj(); + + // XExternalDocLink + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalSheetCache > + SAL_CALL addSheetCache( const ::rtl::OUString& aSheetName, sal_Bool bDynamicCache ) + throw (::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // Attributes + virtual sal_Int32 SAL_CALL getTokenIndex() + throw (::com::sun::star::uno::RuntimeException); + +private: + ScExternalRefManager* mpRefMgr; + sal_uInt16 mnFileId; +}; + +/** This is the UNO API equivalent of ScExternalRefManager. */ +class ScExternalDocLinksObj : public cppu::WeakImplHelper1< ::com::sun::star::sheet::XExternalDocLinks > +{ +public: + ScExternalDocLinksObj(ScDocShell* pDocShell); + ~ScExternalDocLinksObj(); + + // XExternalDocLinks + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XExternalDocLink > + SAL_CALL addDocLink( const ::rtl::OUString& aDocName ) + throw (::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + +private: + ScExternalDocLinksObj(); + ScExternalDocLinksObj(const ScExternalDocLinksObj&); + +private: + ScDocShell* mpDocShell; + ScExternalRefManager* mpRefMgr; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/listenercalls.hxx b/sc/inc/listenercalls.hxx new file mode 100644 index 000000000000..d5167c96e174 --- /dev/null +++ b/sc/inc/listenercalls.hxx @@ -0,0 +1,81 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_LISTENERCALLS_HXX +#define SC_LISTENERCALLS_HXX + +#include <list> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/EventObject.hpp> + +namespace com { namespace sun { namespace star { + namespace util { + class XModifyListener; + } + namespace lang { + struct EventObject; + } +} } } + + +struct ScUnoListenerEntry +{ + ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > xListener; + ::com::sun::star::lang::EventObject aEvent; + + ScUnoListenerEntry( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& rL, + const ::com::sun::star::lang::EventObject& rE ) : + xListener( rL ), + aEvent( rE ) + {} +}; + + +/** ScUnoListenerCalls stores notifications to XModifyListener that can't be processed + during BroadcastUno and calls them together at the end. +*/ +class ScUnoListenerCalls +{ +private: + ::std::list<ScUnoListenerEntry> aEntries; + +public: + ScUnoListenerCalls(); + ~ScUnoListenerCalls(); + + void Add( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener >& rListener, + const ::com::sun::star::lang::EventObject& rEvent ); + void ExecuteAndClear(); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx new file mode 100644 index 000000000000..9901ba5a5479 --- /dev/null +++ b/sc/inc/lookupcache.hxx @@ -0,0 +1,260 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef INCLUDED_SC_LOOKUPCACHE_HXX +#define INCLUDED_SC_LOOKUPCACHE_HXX + +#include "address.hxx" +#include "global.hxx" +#include "formula/token.hxx" +#include <svl/listener.hxx> +#include <tools/string.hxx> + +#include <boost/unordered_map.hpp> + +class ScDocument; + + +/** Lookup cache for one range used with interpreter functions such as VLOOKUP + and MATCH. Caches query for a specific row and the resulting address looked + up, in case other lookups of the same query in the same row are to be + performed, which usually occur to obtain a different offset column of the + same query. + */ + +class ScLookupCache : public SvtListener +{ +public: + + enum Result + { + NOT_CACHED, /// Query not found in cache. + CRITERIA_DIFFERENT, /// Different criteria for same query position exists. + NOT_AVAILABLE, /// Criteria not available in lookup range. + FOUND /// Criteria found. + }; + + enum QueryOp + { + UNKNOWN, + EQUAL, + LESS_EQUAL, + GREATER_EQUAL + }; + + class QueryCriteria + { + union + { + double mfVal; + const String * mpStr; + }; + bool mbAlloc : 1; + bool mbString : 1; + QueryOp meOp : 2; + + void deleteString() + { + if (mbAlloc && mbString) + delete mpStr; + } + + // prevent usage + QueryCriteria(); + QueryCriteria & operator=( const QueryCriteria & r ); + + public: + + explicit QueryCriteria( const ScQueryEntry & rEntry ) : + mfVal(0.0), mbAlloc(false), mbString(false) + { + switch (rEntry.eOp) + { + case SC_EQUAL : + meOp = EQUAL; + break; + case SC_LESS_EQUAL : + meOp = LESS_EQUAL; + break; + case SC_GREATER_EQUAL : + meOp = GREATER_EQUAL; + break; + default: + meOp = UNKNOWN; + DBG_ERRORFILE( "ScLookupCache::QueryCriteria not prepared for this ScQueryOp"); + } + if (rEntry.bQueryByString) + setString( rEntry.pStr); + else + setDouble( rEntry.nVal); + } + QueryCriteria( const QueryCriteria & r ) : + mfVal( r.mfVal), + mbAlloc( false), + mbString( false), + meOp( r.meOp) + { + if (r.mbString && r.mpStr) + { + mpStr = new String( *r.mpStr); + mbAlloc = mbString = true; + } + } + ~QueryCriteria() + { + deleteString(); + } + + QueryOp getQueryOp() const { return meOp; } + + void setDouble( double fVal ) + { + deleteString(); + mbAlloc = mbString = false; + mfVal = fVal; + } + + void setString( const String * pStr ) + { + deleteString(); + mbAlloc = false; + mbString = true; + mpStr = pStr; + } + + void setString( const String & rStr ) + { + deleteString(); + mbAlloc = mbString = true; + mpStr = new String( rStr); + } + + bool operator==( const QueryCriteria & r ) const + { + return meOp == r.meOp && mbString == r.mbString && + (mbString ? (*mpStr == *r.mpStr) : (mfVal == r.mfVal)); + } + + }; + + /// MUST be new'd because Notify() deletes. + ScLookupCache( ScDocument * pDoc, const ScRange & rRange ); + virtual ~ScLookupCache(); + /// Remove from document structure and delete (!) cache on modify hint. + virtual void Notify( SvtBroadcaster & rBC, const SfxHint & rHint ); + + /// @returns document address in o_rAddress if Result==FOUND + Result lookup( ScAddress & o_rResultAddress, + const QueryCriteria & rCriteria, + const ScAddress & rQueryAddress ) const; + + /** Insert query and result. + @param bAvailable + Pass sal_False if the search didn't deliver a result. A subsequent + lookup() then will return Result::NOT_AVAILABLE. + @returns successful insertion. + */ + bool insert( const ScAddress & rResultAddress, + const QueryCriteria & rCriteria, + const ScAddress & rQueryAddress, + const bool bAvailable ); + + inline const ScRange& getRange() const { return maRange; } + + struct Hash + { + size_t operator()( const ScRange & rRange ) const + { + // Lookups are performed on the first column. + return rRange.hashStartColumn(); + } + }; + +private: + + struct QueryKey + { + SCROW mnRow; + SCTAB mnTab; + QueryOp meOp : 2; + + QueryKey( const ScAddress & rAddress, const QueryOp eOp ) : + mnRow( rAddress.Row()), + mnTab( rAddress.Tab()), + meOp( eOp) + { + } + + bool operator==( const QueryKey & r ) const + { + return mnRow == r.mnRow && mnTab == r.mnTab && meOp == r.meOp && meOp != UNKNOWN; + } + + struct Hash + { + size_t operator()( const QueryKey & r ) const + { + return (static_cast<size_t>(r.mnTab) << 24) ^ + (static_cast<size_t>(r.meOp) << 22) ^ + static_cast<size_t>(r.mnRow); + } + }; + }; + + struct QueryCriteriaAndResult + { + QueryCriteria maCriteria; + ScAddress maAddress; + + QueryCriteriaAndResult( const QueryCriteria & rCriteria, const ScAddress & rAddress ) : + maCriteria( rCriteria), + maAddress( rAddress) + { + } + ~QueryCriteriaAndResult() + { + } + }; + + typedef ::boost::unordered_map< QueryKey, QueryCriteriaAndResult, QueryKey::Hash, ::std::equal_to< QueryKey > > QueryMap; + QueryMap maQueryMap; + ScRange maRange; + ScDocument * mpDoc; + + // prevent usage + ScLookupCache( const ScLookupCache & ); + ScLookupCache & operator=( const ScLookupCache & ); + +}; + + +typedef ::boost::unordered_map< ScRange, ScLookupCache*, ScLookupCache::Hash, ::std::equal_to< ScRange > > ScLookupCacheMap; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/macromgr.hxx b/sc/inc/macromgr.hxx new file mode 100644 index 000000000000..4c8bad9e3ff8 --- /dev/null +++ b/sc/inc/macromgr.hxx @@ -0,0 +1,70 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_MACROMGR_HXX +#define SC_MACROMGR_HXX + +#include <com/sun/star/container/XContainerListener.hpp> + +#include "rtl/ustring.hxx" +#include "scdllapi.h" + +#include <boost/unordered_map.hpp> +#include <boost/unordered_set.hpp> +#include <memory> + +class ScDocument; +class ScFormulaCell; +class ScUserMacroDepTracker; + +class ScMacroManager +{ +public: + explicit ScMacroManager(ScDocument* pDoc); + ~ScMacroManager(); + + SC_DLLPUBLIC void InitUserFuncData(); + SC_DLLPUBLIC void SetUserFuncVolatile( const rtl::OUString& sName, bool isVolatile ); + SC_DLLPUBLIC bool GetUserFuncVolatile( const rtl::OUString& sName ); + + void AddDependentCell(const ::rtl::OUString& aModuleName, ScFormulaCell* pCell); + void RemoveDependentCell(ScFormulaCell* pCell); + void BroadcastModuleUpdate(const ::rtl::OUString& aModuleName); + +private: + typedef boost::unordered_map< ::rtl::OUString, bool, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameBoolMap; + NameBoolMap mhFuncToVolatile; + com::sun::star::uno::Reference< com::sun::star::container::XContainerListener > mxContainerListener; + + ::std::auto_ptr<ScUserMacroDepTracker> mpDepTracker; + ScDocument* mpDoc; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx new file mode 100644 index 000000000000..352ecc1fc5bf --- /dev/null +++ b/sc/inc/markarr.hxx @@ -0,0 +1,88 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_MARKARR_HXX +#define SC_MARKARR_HXX + +#include "address.hxx" +#include <tools/solar.h> + +#define SC_MARKARRAY_DELTA 4 + +struct ScMarkEntry +{ + SCROW nRow; + sal_Bool bMarked; +}; + +class ScMarkArray +{ + SCSIZE nCount; + SCSIZE nLimit; + ScMarkEntry* pData; + +friend class ScMarkArrayIter; +friend class ScDocument; // for FillInfo + +public: + ScMarkArray(); + ~ScMarkArray(); + void Reset( sal_Bool bMarked = false ); + sal_Bool GetMark( SCROW nRow ) const; + void SetMarkArea( SCROW nStartRow, SCROW nEndRow, sal_Bool bMarked ); + sal_Bool IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const; + sal_Bool HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const; + + sal_Bool HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); } + + void CopyMarksTo( ScMarkArray& rDestMarkArray ) const; + + sal_Bool Search( SCROW nRow, SCSIZE& nIndex ) const; + + /// Including current row, may return -1 if bUp and not found + SCsROW GetNextMarked( SCsROW nRow, sal_Bool bUp ) const; + SCROW GetMarkEnd( SCROW nRow, sal_Bool bUp ) const; +}; + + +class ScMarkArrayIter // iterate over selected range +{ + const ScMarkArray* pArray; + SCSIZE nPos; +public: + ScMarkArrayIter( const ScMarkArray* pNewArray ); + ~ScMarkArrayIter(); + + sal_Bool Next( SCROW& rTop, SCROW& rBottom ); +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx new file mode 100644 index 000000000000..51b67d7cb560 --- /dev/null +++ b/sc/inc/markdata.hxx @@ -0,0 +1,123 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_MARKDATA_HXX +#define SC_MARKDATA_HXX + +#include "address.hxx" +#include <tools/solar.h> +#include "scdllapi.h" + +class ScMarkArray; +class ScRangeList; + +//! todo: +//! It should be possible to have MarkArrays for each table, in order to +//! enable "search all" across more than one table again! + + +class SC_DLLPUBLIC ScMarkData +{ +private: + ScRange aMarkRange; // area + ScRange aMultiRange; // maximum area altogether + ScMarkArray* pMultiSel; // multi selection + sal_Bool bTabMarked[MAXTABCOUNT];// table marked + sal_Bool bMarked; // rectangle marked + sal_Bool bMultiMarked; + + sal_Bool bMarking; // area is being marked -> no MarkToMulti + sal_Bool bMarkIsNeg; // cancel if multi selection + +public: + ScMarkData(); + ScMarkData(const ScMarkData& rData); + ~ScMarkData(); + + ScMarkData& operator=(const ScMarkData& rData); + + void ResetMark(); + void SetMarkArea( const ScRange& rRange ); + + void SetMultiMarkArea( const ScRange& rRange, sal_Bool bMark = sal_True ); + + void MarkToMulti(); + void MarkToSimple(); + + sal_Bool IsMarked() const { return bMarked; } + sal_Bool IsMultiMarked() const { return bMultiMarked; } + + void GetMarkArea( ScRange& rRange ) const; + void GetMultiMarkArea( ScRange& rRange ) const; + + void SetAreaTab( SCTAB nTab ); + + void SelectTable( SCTAB nTab, sal_Bool bNew ) { bTabMarked[nTab] = bNew; } + sal_Bool GetTableSelect( SCTAB nTab ) const { return bTabMarked[nTab]; } + + void SelectOneTable( SCTAB nTab ); + SCTAB GetSelectCount() const; + SCTAB GetFirstSelected() const; + + void SetMarkNegative( sal_Bool bFlag ) { bMarkIsNeg = bFlag; } + sal_Bool IsMarkNegative() const { return bMarkIsNeg; } + void SetMarking( sal_Bool bFlag ) { bMarking = bFlag; } + sal_Bool GetMarkingFlag() const { return bMarking; } + + // for FillInfo / Document etc. + const ScMarkArray* GetArray() const { return pMultiSel; } + + sal_Bool IsCellMarked( SCCOL nCol, SCROW nRow, sal_Bool bNoSimple = false ) const; + void FillRangeListWithMarks( ScRangeList* pList, sal_Bool bClear ) const; + void ExtendRangeListTables( ScRangeList* pList ) const; + + void MarkFromRangeList( const ScRangeList& rList, sal_Bool bReset ); + + SCCOLROW GetMarkColumnRanges( SCCOLROW* pRanges ); + SCCOLROW GetMarkRowRanges( SCCOLROW* pRanges ); + + sal_Bool IsColumnMarked( SCCOL nCol ) const; + sal_Bool IsRowMarked( SCROW nRow ) const; + sal_Bool IsAllMarked( const ScRange& rRange ) const; // Multi + + /// May return -1 + SCsROW GetNextMarked( SCCOL nCol, SCsROW nRow, sal_Bool bUp ) const; + sal_Bool HasMultiMarks( SCCOL nCol ) const; + sal_Bool HasAnyMultiMarks() const; + + // adjust table marking: + void InsertTab( SCTAB nTab ); + void DeleteTab( SCTAB nTab ); +}; + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx new file mode 100644 index 000000000000..9246abc08a2d --- /dev/null +++ b/sc/inc/miscuno.hxx @@ -0,0 +1,206 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_MISCUNO_HXX +#define SC_MISCUNO_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <cppuhelper/implbase2.hxx> +#include "scdllapi.h" + +#define SC_SIMPLE_SERVICE_INFO( ClassName, ClassNameAscii, ServiceAscii ) \ +::rtl::OUString SAL_CALL ClassName::getImplementationName() \ + throw(::com::sun::star::uno::RuntimeException) \ +{ \ + return ::rtl::OUString::createFromAscii(ClassNameAscii); \ +} \ +sal_Bool SAL_CALL ClassName::supportsService( const ::rtl::OUString& ServiceName ) \ + throw(::com::sun::star::uno::RuntimeException) \ +{ \ + return !ServiceName.compareToAscii(ServiceAscii); \ +} \ +::com::sun::star::uno::Sequence< ::rtl::OUString > \ + SAL_CALL ClassName::getSupportedServiceNames(void) \ + throw(::com::sun::star::uno::RuntimeException) \ +{ \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1); \ + ::rtl::OUString* pArray = aRet.getArray(); \ + pArray[0] = ::rtl::OUString::createFromAscii(ServiceAscii); \ + return aRet; \ +} + +#define SC_IMPL_DUMMY_PROPERTY_LISTENER( ClassName ) \ + void SAL_CALL ClassName::addPropertyChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XPropertyChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { OSL_FAIL("not implemented"); } \ + void SAL_CALL ClassName::removePropertyChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XPropertyChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { OSL_FAIL("not implemented"); } \ + void SAL_CALL ClassName::addVetoableChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XVetoableChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { OSL_FAIL("not implemented"); } \ + void SAL_CALL ClassName::removeVetoableChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XVetoableChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { OSL_FAIL("not implemented"); } + + +#define SC_QUERYINTERFACE(x) \ + if (rType == getCppuType((const uno::Reference<x>*)0)) \ + { return uno::makeAny(uno::Reference<x>(this)); } + +// SC_QUERY_MULTIPLE( XElementAccess, XIndexAccess ): +// use if interface is used several times in one class + +#define SC_QUERY_MULTIPLE(x,y) \ + if (rType == getCppuType((const uno::Reference<x>*)0)) \ + { uno::Any aR; aR <<= uno::Reference<x>(static_cast<y*>(this)); return aR; } + + +class ScIndexEnumeration : public cppu::WeakImplHelper2< + com::sun::star::container::XEnumeration, + com::sun::star::lang::XServiceInfo > +{ +private: + com::sun::star::uno::Reference<com::sun::star::container::XIndexAccess> xIndex; + rtl::OUString sServiceName; + sal_Int32 nPos; + +public: + ScIndexEnumeration(const com::sun::star::uno::Reference< + com::sun::star::container::XIndexAccess>& rInd, const rtl::OUString& rServiceName); + virtual ~ScIndexEnumeration(); + + // XEnumeration + virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL nextElement() + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw(::com::sun::star::uno::RuntimeException); +}; + +// new (uno 3) variant +class ScNameToIndexAccess : public cppu::WeakImplHelper2< + com::sun::star::container::XIndexAccess, + com::sun::star::lang::XServiceInfo > +{ +private: + com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> xNameAccess; + com::sun::star::uno::Sequence<rtl::OUString> aNames; + +public: + ScNameToIndexAccess( + const com::sun::star::uno::Reference< + com::sun::star::container::XNameAccess>& rNameObj ); + virtual ~ScNameToIndexAccess(); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount( ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements( ) throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw(::com::sun::star::uno::RuntimeException); +}; + +class SC_DLLPUBLIC ScUnoHelpFunctions +{ +public: + static com::sun::star::uno::Reference<com::sun::star::uno::XInterface> + AnyToInterface( const com::sun::star::uno::Any& rAny ); + static sal_Bool GetBoolProperty( const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& xProp, + const ::rtl::OUString& rName, sal_Bool bDefault = false ); + static sal_Int32 GetLongProperty( const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& xProp, + const ::rtl::OUString& rName, long nDefault = 0 ); + static sal_Int32 GetEnumProperty( const com::sun::star::uno::Reference< + com::sun::star::beans::XPropertySet>& xProp, + const ::rtl::OUString& rName, long nDefault ); + static ::rtl::OUString GetStringProperty( + const com::sun::star::uno::Reference<com::sun::star::beans::XPropertySet>& xProp, + const ::rtl::OUString& rName, const ::rtl::OUString& rDefault ); + + static sal_Bool GetBoolFromAny( const com::sun::star::uno::Any& aAny ); + static sal_Int16 GetInt16FromAny( const com::sun::star::uno::Any& aAny ); + static sal_Int32 GetInt32FromAny( const com::sun::star::uno::Any& aAny ); + static sal_Int32 GetEnumFromAny( const com::sun::star::uno::Any& aAny ); + static void SetBoolInAny( com::sun::star::uno::Any& rAny, sal_Bool bValue ); + + static void SetOptionalPropertyValue( + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rPropSet, + const sal_Char* pPropName, const ::com::sun::star::uno::Any& rVal ); + + template<typename ValueType> + static void SetOptionalPropertyValue( + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& rPropSet, + const sal_Char* pPropName, const ValueType& rVal ) + { + ::com::sun::star::uno::Any any; + any <<= rVal; + SetOptionalPropertyValue(rPropSet, pPropName, any); + } +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/mutexhlp.hxx b/sc/inc/mutexhlp.hxx new file mode 100644 index 000000000000..ebe9176799c4 --- /dev/null +++ b/sc/inc/mutexhlp.hxx @@ -0,0 +1,48 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_MUTEXHLP_HXX +#define SC_MUTEXHLP_HXX + +#include <osl/mutex.hxx> + +// used in XComponent implementations to construct a Mutex before the +// OComponentHelper base class + +class ScMutexHelper +{ +private: + ::osl::Mutex maMutex; + +public: + ::osl::Mutex& getMutex() { return maMutex; } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx new file mode 100644 index 000000000000..5ba41a9f6782 --- /dev/null +++ b/sc/inc/nameuno.hxx @@ -0,0 +1,403 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_NAMEUNO_HXX +#define SC_NAMEUNO_HXX + +#include <svl/lstner.hxx> +#include "address.hxx" +#include "formula/grammar.hxx" +#include <com/sun/star/sheet/XLabelRange.hpp> +#include <com/sun/star/sheet/XLabelRanges.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> +#include <com/sun/star/sheet/XNamedRange.hpp> +#include <com/sun/star/sheet/XFormulaTokens.hpp> +#include <com/sun/star/sheet/XNamedRanges.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/document/XActionLockable.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase6.hxx> + +class ScDocShell; +class ScRangeData; +class ScTokenArray; +class ScNamedRangesObj; + +class ScNamedRangeObj : public ::cppu::WeakImplHelper6< + ::com::sun::star::sheet::XNamedRange, + ::com::sun::star::sheet::XFormulaTokens, + ::com::sun::star::sheet::XCellRangeReferrer, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScNamedRangesObj* mpParent; + ScDocShell* pDocShell; + String aName; + +private: + ScRangeData* GetRangeData_Impl(); + void Modify_Impl( const String* pNewName, + const ScTokenArray* pNewTokens, const String* pNewContent, + const ScAddress* pNewPos, const sal_uInt16* pNewType, + const formula::FormulaGrammar::Grammar eGrammar ); + +public: + ScNamedRangeObj(ScNamedRangesObj* pParent, ScDocShell* pDocSh, const String& rNm); + virtual ~ScNamedRangeObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNamedRange + virtual ::rtl::OUString SAL_CALL getContent() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setContent( const ::rtl::OUString& aContent ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellAddress SAL_CALL getReferencePosition() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReferencePosition( + const ::com::sun::star::table::CellAddress& aReferencePosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getType() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setType( sal_Int32 nType ) throw(::com::sun::star::uno::RuntimeException); + + // XFormulaTokens + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL getTokens() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setTokens( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::FormulaToken >& aTokens ) + throw (::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangeReferrer + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getReferredCells() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScNamedRangeObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // methods accessible via getImplementation() + void SetContentWithGrammar( const ::rtl::OUString& aContent, + const formula::FormulaGrammar::Grammar eGrammar ) + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScNamedRangesObj : public ::cppu::WeakImplHelper6< + ::com::sun::star::sheet::XNamedRanges, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::document::XActionLockable, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + // if true, adding new name or modifying existing one will set the + // document 'modified' and broadcast the change. We turn this off during + // import. + sal_Bool mbModifyAndBroadcast; + + ScNamedRangeObj* GetObjectByIndex_Impl(sal_uInt16 nIndex); + ScNamedRangeObj* GetObjectByName_Impl(const ::rtl::OUString& aName); + +protected: + /** called from the XActionLockable interface methods on initial locking */ + virtual void lock(); + + /** called from the XActionLockable interface methods on final unlock */ + virtual void unlock(); + +public: + ScNamedRangesObj(ScDocShell* pDocSh); + virtual ~ScNamedRangesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + bool IsModifyAndBroadcast() const; + + // XNamedRanges + virtual void SAL_CALL addNewByName( const ::rtl::OUString& aName, const ::rtl::OUString& aContent, + const ::com::sun::star::table::CellAddress& aPosition, sal_Int32 nType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addNewFromTitles( const ::com::sun::star::table::CellRangeAddress& aSource, + ::com::sun::star::sheet::Border aBorder ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL outputList( const ::com::sun::star::table::CellAddress& aOutputPosition ) + throw(::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XActionLockable + virtual sal_Bool SAL_CALL isActionLocked() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addActionLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActionLock() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActionLocks( sal_Int16 nLock ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int16 SAL_CALL resetActionLocks() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScLabelRangeObj : public ::cppu::WeakImplHelper2< + ::com::sun::star::sheet::XLabelRange, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + sal_Bool bColumn; + ScRange aRange; // criterion to find range + +private: + ScRangePair* GetData_Impl(); + void Modify_Impl( const ScRange* pLabel, const ScRange* pData ); + +public: + ScLabelRangeObj(ScDocShell* pDocSh, sal_Bool bCol, const ScRange& rR); + virtual ~ScLabelRangeObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XLabelRange + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getLabelArea() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLabelArea( const ::com::sun::star::table::CellRangeAddress& aLabelArea ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getDataArea() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDataArea( const ::com::sun::star::table::CellRangeAddress& aDataArea ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScLabelRangesObj : public ::cppu::WeakImplHelper3< + ::com::sun::star::sheet::XLabelRanges, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + sal_Bool bColumn; + + ScLabelRangeObj* GetObjectByIndex_Impl(size_t nIndex); + +public: + ScLabelRangesObj(ScDocShell* pDocSh, sal_Bool bCol); + virtual ~ScLabelRangesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XLabelRanges + virtual void SAL_CALL addNew( const ::com::sun::star::table::CellRangeAddress& aLabelArea, + const ::com::sun::star::table::CellRangeAddress& aDataArea ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByIndex( sal_Int32 nIndex ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/navicfg.hxx b/sc/inc/navicfg.hxx new file mode 100644 index 000000000000..096f66322e3e --- /dev/null +++ b/sc/inc/navicfg.hxx @@ -0,0 +1,60 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_NAVICFG_HXX +#define SC_NAVICFG_HXX + +#include <tools/solar.h> + + +//================================================================== +// CfgItem for navigator-state +//================================================================== + +class ScNavipiCfg +{ +private: + sal_uInt16 nListMode; + sal_uInt16 nDragMode; + sal_uInt16 nRootType; + +public: + ScNavipiCfg(); + + void SetListMode(sal_uInt16 nNew); + sal_uInt16 GetListMode() const { return nListMode; } + void SetDragMode(sal_uInt16 nNew); + sal_uInt16 GetDragMode() const { return nDragMode; } + void SetRootType(sal_uInt16 nNew); + sal_uInt16 GetRootType() const { return nRootType; } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx new file mode 100644 index 000000000000..42e79d5bcee7 --- /dev/null +++ b/sc/inc/notesuno.hxx @@ -0,0 +1,323 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_NOTESUNO_HXX +#define SC_NOTESUNO_HXX + +#include "address.hxx" +#include <svl/lstner.hxx> +#include <com/sun/star/sheet/XSheetAnnotation.hpp> +#include <com/sun/star/sheet/XSheetAnnotationShapeSupplier.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/text/XSimpleText.hpp> +#include <com/sun/star/text/XTextRangeMover.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase10.hxx> + + +class ScDocShell; +class SvxUnoText; +class ScPostIt; + + +class ScAnnotationObj : public cppu::WeakImplHelper5< + com::sun::star::container::XChild, + com::sun::star::text::XSimpleText, + com::sun::star::sheet::XSheetAnnotation, + com::sun::star::sheet::XSheetAnnotationShapeSupplier, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +public: + ScAnnotationObj(ScDocShell* pDocSh, const ScAddress& rPos); + virtual ~ScAnnotationObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XChild + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + getParent() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& Parent ) + throw(::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + + // XSimpleText + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursorByRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& aTextPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::rtl::OUString& aString, sal_Bool bAbsorb ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetAnnotation + virtual ::com::sun::star::table::CellAddress SAL_CALL getPosition() + throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getAuthor() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getDate() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL getIsVisible() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setIsVisible( sal_Bool bIsVisible ) + throw(::com::sun::star::uno::RuntimeException); + + // XSheetAnnotationShapeSupplier + virtual ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > SAL_CALL + getAnnotationShape() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + +private: + SvxUnoText& GetUnoText(); + + const ScPostIt* ImplGetNote() const; + +private: + ScDocShell* pDocShell; + ScAddress aCellPos; + SvxUnoText* pUnoText; +}; + +class ScAnnotationShapeObj : public cppu::WeakImplHelper10< + com::sun::star::lang::XComponent, + com::sun::star::container::XChild, + com::sun::star::text::XText, + com::sun::star::container::XEnumerationAccess, + com::sun::star::text::XTextRangeMover, + com::sun::star::drawing::XShape, + com::sun::star::beans::XPropertySet, + com::sun::star::beans::XMultiPropertySet, + com::sun::star::beans::XPropertyState, + com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + ScAddress aCellPos; + SvxUnoText* pUnoText; + com::sun::star::uno::Reference < com::sun::star::drawing::XShape > xShape; + +private: + SvxUnoText& GetUnoText(); + com::sun::star::uno::Reference < com::sun::star::drawing::XShape > GetXShape(); + +public: + ScAnnotationShapeObj(ScDocShell* pDocSh, const ScAddress& rPos); + virtual ~ScAnnotationShapeObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XChild + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL + getParent() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& Parent ) + throw(::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType( ) throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasElements( ) throw (::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration( ) throw (::com::sun::star::uno::RuntimeException); + + // XTextRangeMover + virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + ::sal_Int16 nParagraphs ) + throw (::com::sun::star::uno::RuntimeException); + + // XText + virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent, + ::sal_Bool bAbsorb ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent ) + throw (::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XSimpleText + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursorByRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& aTextPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::rtl::OUString& aString, sal_Bool bAbsorb ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + + // XShapeDescriptor + virtual ::rtl::OUString SAL_CALL getShapeType( ) throw (::com::sun::star::uno::RuntimeException); + + // XShape + virtual ::com::sun::star::awt::Point SAL_CALL getPosition( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition ) throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::awt::Size SAL_CALL getSize( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize ) + throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw (::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XComponent + virtual void SAL_CALL dispose( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/olinetab.hxx b/sc/inc/olinetab.hxx new file mode 100644 index 000000000000..d1cf0257c0bd --- /dev/null +++ b/sc/inc/olinetab.hxx @@ -0,0 +1,181 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_OUTLINETAB_HXX +#define SC_OUTLINETAB_HXX + + +#include "collect.hxx" +#include "scdllapi.h" + +#define SC_OL_MAXDEPTH 7 + +class SvStream; +class ScTable; + + +class ScOutlineEntry : public ScDataObject +{ + SCCOLROW nStart; + SCSIZE nSize; + bool bHidden; + bool bVisible; + +public: + ScOutlineEntry( SCCOLROW nNewStart, SCCOLROW nNewSize, + bool bNewHidden = false ); + ScOutlineEntry( const ScOutlineEntry& rEntry ); + + virtual ScDataObject* Clone() const; + + SCCOLROW GetStart() const { return nStart; } + SCSIZE GetSize() const { return nSize; } + SCCOLROW GetEnd() const { return nStart+nSize-1; } + bool IsHidden() const { return bHidden; } // group hidden + bool IsVisible() const { return bVisible; } // control visible? + + void Move( SCsCOLROW nDelta ); + void SetSize( SCSIZE nNewSize ); + void SetPosSize( SCCOLROW nNewPos, SCSIZE nNewSize ); + void SetHidden( bool bNewHidden ); + void SetVisible( bool bNewVisible ); +}; + + +class ScOutlineCollection : public ScSortedCollection +{ +public: + ScOutlineCollection(); + + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; + + sal_uInt16 FindStart( SCCOLROW nMinStart ); +}; + + +class SC_DLLPUBLIC ScOutlineArray +{ +friend class ScSubOutlineIterator; + +private: + sal_uInt16 nDepth; + ScOutlineCollection aCollections[SC_OL_MAXDEPTH]; + + sal_Bool DecDepth(); + void FindEntry( SCCOLROW nSearchPos, sal_uInt16& rFindLevel, sal_uInt16& rFindIndex, + sal_uInt16 nMaxLevel = SC_OL_MAXDEPTH ); + void RemoveSub( SCCOLROW nStartPos, SCCOLROW nEndPos, sal_uInt16 nLevel ); + void PromoteSub( SCCOLROW nStartPos, SCCOLROW nEndPos, sal_uInt16 nStartLevel ); + +public: + ScOutlineArray(); + ScOutlineArray( const ScOutlineArray& rArray ); + + sal_uInt16 GetDepth() const { return nDepth; } + + sal_Bool FindTouchedLevel( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, + sal_uInt16& rFindLevel ) const; + + sal_Bool Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, sal_Bool& rSizeChanged, + sal_Bool bHidden = false, sal_Bool bVisible = sal_True ); + sal_Bool Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, sal_Bool& rSizeChanged ); + + ScOutlineEntry* GetEntry( sal_uInt16 nLevel, sal_uInt16 nIndex ) const; + sal_uInt16 GetCount( sal_uInt16 nLevel ) const; + ScOutlineEntry* GetEntryByPos( sal_uInt16 nLevel, SCCOLROW nPos ) const; + + sal_Bool GetEntryIndex( sal_uInt16 nLevel, SCCOLROW nPos, sal_uInt16& rnIndex ) const; + sal_Bool GetEntryIndexInRange( + sal_uInt16 nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, + sal_uInt16& rnIndex ) const; + + void SetVisibleBelow( sal_uInt16 nLevel, sal_uInt16 nEntry, sal_Bool bValue, + sal_Bool bSkipHidden = false ); + + void GetRange( SCCOLROW& rStart, SCCOLROW& rEnd ) const; + void ExtendBlock( sal_uInt16 nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd ); + + sal_Bool TestInsertSpace( SCSIZE nSize, SCCOLROW nMaxVal ) const; + void InsertSpace( SCCOLROW nStartPos, SCSIZE nSize ); + sal_Bool DeleteSpace( SCCOLROW nStartPos, SCSIZE nSize ); + + bool ManualAction( SCCOLROW nStartPos, SCCOLROW nEndPos, bool bShow, ScTable& rTable, bool bCol ); + + void RemoveAll(); +}; + + +class ScOutlineTable +{ +private: + ScOutlineArray aColOutline; + ScOutlineArray aRowOutline; + +public: + ScOutlineTable(); + ScOutlineTable( const ScOutlineTable& rOutline ); + + const ScOutlineArray* GetColArray() const { return &aColOutline; } + ScOutlineArray* GetColArray() { return &aColOutline; } + const ScOutlineArray* GetRowArray() const { return &aRowOutline; } + ScOutlineArray* GetRowArray() { return &aRowOutline; } + + sal_Bool TestInsertCol( SCSIZE nSize ); + void InsertCol( SCCOL nStartCol, SCSIZE nSize ); + sal_Bool DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo only using original + sal_Bool TestInsertRow( SCSIZE nSize ); + void InsertRow( SCROW nStartRow, SCSIZE nSize ); + sal_Bool DeleteRow( SCROW nStartRow, SCSIZE nSize ); +}; + + +class ScSubOutlineIterator +{ +private: + ScOutlineArray* pArray; + SCCOLROW nStart; + SCCOLROW nEnd; + sal_uInt16 nSubLevel; + sal_uInt16 nSubEntry; + sal_uInt16 nCount; + sal_uInt16 nDepth; + +public: + ScSubOutlineIterator( ScOutlineArray* pOutlineArray ); + ScSubOutlineIterator( ScOutlineArray* pOutlineArray, + sal_uInt16 nLevel, sal_uInt16 nEntry ); + ScOutlineEntry* GetNext(); + sal_uInt16 LastLevel() const; + sal_uInt16 LastEntry() const; + void DeleteLast(); +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/optuno.hxx b/sc/inc/optuno.hxx new file mode 100644 index 000000000000..53dae3500fe8 --- /dev/null +++ b/sc/inc/optuno.hxx @@ -0,0 +1,95 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_OPTUNO_HXX +#define SC_OPTUNO_HXX + +#include "docuno.hxx" +#include "docoptio.hxx" + +#define PROP_UNO_CALCASSHOWN 1 +#define PROP_UNO_DEFTABSTOP 2 +#define PROP_UNO_IGNORECASE 3 +#define PROP_UNO_ITERENABLED 4 +#define PROP_UNO_ITERCOUNT 5 +#define PROP_UNO_ITEREPSILON 6 +#define PROP_UNO_LOOKUPLABELS 7 +#define PROP_UNO_MATCHWHOLE 8 +#define PROP_UNO_NULLDATE 9 +#define PROP_UNO_SPELLONLINE 10 +#define PROP_UNO_STANDARDDEC 11 +#define PROP_UNO_REGEXENABLED 12 + + +class ScDocOptionsHelper +{ +public: + static const SfxItemPropertyMapEntry* GetPropertyMap(); + + static sal_Bool setPropertyValue( ScDocOptions& rOptions, + const SfxItemPropertyMap& rPropMap, + const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ); + static ::com::sun::star::uno::Any getPropertyValue( + const ScDocOptions& rOptions, + const SfxItemPropertyMap& rPropMap, + const ::rtl::OUString& PropertyName ); +}; + + +// empty doc object to supply only doc options + +class ScDocOptionsObj : public ScModelObj +{ +private: + ScDocOptions aOptions; + +public: + ScDocOptionsObj( const ScDocOptions& rOpt ); + virtual ~ScDocOptionsObj(); + + // get/setPropertyValue overloaded to used stored options instead of document + + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/optutil.hxx b/sc/inc/optutil.hxx new file mode 100644 index 000000000000..68a187a97bc6 --- /dev/null +++ b/sc/inc/optutil.hxx @@ -0,0 +1,77 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_OPTUTIL_HXX +#define SC_OPTUTIL_HXX + +#include <unotools/configitem.hxx> +#include <tools/link.hxx> +#include "scdllapi.h" + + +class ScOptionsUtil +{ +public: + // values must correspond with integer values stored in the configuration + enum KeyBindingType { KEY_DEFAULT = 0, KEY_OOO_LEGACY = 1 }; + + static sal_Bool IsMetricSystem(); +}; + + +// ConfigItem for classes that use items from several sub trees + +class SC_DLLPUBLIC ScLinkConfigItem : public utl::ConfigItem +{ + Link aCommitLink; + +public: + ScLinkConfigItem( const rtl::OUString& rSubTree ); + ScLinkConfigItem( const rtl::OUString& rSubTree, sal_Int16 nMode ); + void SetCommitLink( const Link& rLink ); + + virtual void Notify( const com::sun::star::uno::Sequence<rtl::OUString>& aPropertyNames ); + virtual void Commit(); + + void SetModified() { ConfigItem::SetModified(); } + com::sun::star::uno::Sequence< com::sun::star::uno::Any> + GetProperties(const com::sun::star::uno::Sequence< rtl::OUString >& rNames) + { return ConfigItem::GetProperties( rNames ); } + sal_Bool PutProperties( const com::sun::star::uno::Sequence< rtl::OUString >& rNames, + const com::sun::star::uno::Sequence< com::sun::star::uno::Any>& rValues) + { return ConfigItem::PutProperties( rNames, rValues ); } + + using ConfigItem::EnableNotification; + using ConfigItem::GetNodeNames; + +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pagepar.hxx b/sc/inc/pagepar.hxx new file mode 100644 index 000000000000..f1ac7b2a01f5 --- /dev/null +++ b/sc/inc/pagepar.hxx @@ -0,0 +1,88 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_PAGEPAR_HXX +#define SC_PAGEPAR_HXX + +#include "global.hxx" +#include "address.hxx" + +//----------------------------------------------------------------------- + +struct ScPageTableParam +{ + sal_Bool bCellContent; + sal_Bool bNotes; + sal_Bool bGrid; + sal_Bool bHeaders; + sal_Bool bCharts; + sal_Bool bObjects; + sal_Bool bDrawings; + sal_Bool bFormulas; + sal_Bool bNullVals; + sal_Bool bTopDown; + sal_Bool bLeftRight; + sal_Bool bSkipEmpty; + sal_Bool bScaleNone; + sal_Bool bScaleAll; + sal_Bool bScaleTo; + sal_Bool bScalePageNum; + sal_uInt16 nScaleAll; + sal_uInt16 nScaleWidth; + sal_uInt16 nScaleHeight; + sal_uInt16 nScalePageNum; + sal_uInt16 nFirstPageNo; + + ScPageTableParam(); + ~ScPageTableParam(); + + sal_Bool operator== ( const ScPageTableParam& r ) const; + void Reset (); +}; + +struct ScPageAreaParam +{ + sal_Bool bPrintArea; + sal_Bool bRepeatRow; + sal_Bool bRepeatCol; + ScRange aPrintArea; + ScRange aRepeatRow; + ScRange aRepeatCol; + + ScPageAreaParam(); + ~ScPageAreaParam(); + + sal_Bool operator== ( const ScPageAreaParam& r ) const; + void Reset (); +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pageuno.hxx b/sc/inc/pageuno.hxx new file mode 100644 index 000000000000..778986101d27 --- /dev/null +++ b/sc/inc/pageuno.hxx @@ -0,0 +1,58 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_PAGEUNO_HXX +#define SC_PAGEUNO_HXX + +#include <svx/fmdpage.hxx> + +//------------------------------------------------------------------------ + +// SvxFmDrawPage subclass to create ScShapeObj for shapes + +class ScPageObj : public SvxFmDrawPage +{ +public: + ScPageObj( SdrPage* pPage ); + virtual ~ScPageObj() throw(); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + _CreateShape( SdrObject *pObj ) const throw(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& rServiceName ) + throw(com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence<rtl::OUString> SAL_CALL getSupportedServiceNames() + throw(com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/paramisc.hxx b/sc/inc/paramisc.hxx new file mode 100644 index 000000000000..d5532dbe95f4 --- /dev/null +++ b/sc/inc/paramisc.hxx @@ -0,0 +1,79 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_PARAMISC_HXX +#define SC_PARAMISC_HXX + +#include "address.hxx" +#include <tools/solar.h> + +class String; + +struct ScSolveParam +{ + ScAddress aRefFormulaCell; + ScAddress aRefVariableCell; + String* pStrTargetVal; + + ScSolveParam(); + ScSolveParam( const ScSolveParam& r ); + ScSolveParam( const ScAddress& rFormulaCell, + const ScAddress& rVariableCell, + const String& rTargetValStr ); + ~ScSolveParam(); + + ScSolveParam& operator= ( const ScSolveParam& r ); + sal_Bool operator== ( const ScSolveParam& r ) const; +}; + +//----------------------------------------------------------------------- + +struct ScTabOpParam +{ + ScRefAddress aRefFormulaCell; + ScRefAddress aRefFormulaEnd; + ScRefAddress aRefRowCell; + ScRefAddress aRefColCell; + sal_uInt8 nMode; + + ScTabOpParam() {}; + ScTabOpParam( const ScTabOpParam& r ); + ScTabOpParam( const ScRefAddress& rFormulaCell, + const ScRefAddress& rFormulaEnd, + const ScRefAddress& rRowCell, + const ScRefAddress& rColCell, + sal_uInt8 nMd); + ~ScTabOpParam() {}; + + ScTabOpParam& operator= ( const ScTabOpParam& r ); + sal_Bool operator== ( const ScTabOpParam& r ) const; +}; + +#endif // SC_PARAMISC_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx new file mode 100644 index 000000000000..dc58a8a6473a --- /dev/null +++ b/sc/inc/patattr.hxx @@ -0,0 +1,183 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCPATATR_HXX +#define SC_SCPATATR_HXX + +#include <svl/poolitem.hxx> +#include <svl/itemset.hxx> +#include <unotools/fontcvt.hxx> +#include <editeng/svxenum.hxx> +#include "scdllapi.h" + +class Font; +class OutputDevice; +class Fraction; +class ScStyleSheet; +class SvNumberFormatter; +class ScDocument; + + +// how to treat COL_AUTO in GetFont: + +enum ScAutoFontColorMode +{ + SC_AUTOCOL_RAW, // COL_AUTO is returned + SC_AUTOCOL_BLACK, // always use black + SC_AUTOCOL_PRINT, // black or white, depending on background + SC_AUTOCOL_DISPLAY, // from style settings, or black/white if needed + SC_AUTOCOL_IGNOREFONT, // like DISPLAY, but ignore stored font color (assume COL_AUTO) + SC_AUTOCOL_IGNOREBACK, // like DISPLAY, but ignore stored background color (use configured color) + SC_AUTOCOL_IGNOREALL // like DISPLAY, but ignore stored font and background colors +}; + + +class SC_DLLPUBLIC ScPatternAttr: public SfxSetItem +{ + String* pName; + ScStyleSheet* pStyle; +public: + static ScDocument* pDoc; + ScPatternAttr(SfxItemSet* pItemSet, const String& rStyleName); + ScPatternAttr(SfxItemSet* pItemSet, ScStyleSheet* pStyleSheet = NULL); + ScPatternAttr(SfxItemPool* pItemPool); + ScPatternAttr(const ScPatternAttr& rPatternAttr); + + ~ScPatternAttr(); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream& rStream, sal_uInt16 nVersion) const; + virtual SvStream& Store(SvStream& rStream, sal_uInt16 nItemVersion) const; + + virtual int operator==(const SfxPoolItem& rCmp) const; + + const SfxPoolItem& GetItem( sal_uInt16 nWhichP ) const + { return GetItemSet().Get(nWhichP); } + + static const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet ); + const SfxPoolItem& GetItem( sal_uInt16 nWhich, const SfxItemSet* pCondSet ) const; + + // pWhich are no ranges, but single IDs, 0-terminated + sal_Bool HasItemsSet( const sal_uInt16* pWhich ) const; + void ClearItems( const sal_uInt16* pWhich ); + + void DeleteUnchanged( const ScPatternAttr* pOldAttrs ); + + static SvxCellOrientation GetCellOrientation( const SfxItemSet& rItemSet, const SfxItemSet* pCondSet = 0 ); + SvxCellOrientation GetCellOrientation( const SfxItemSet* pCondSet = 0 ) const; + + /** Static helper function to fill a font object from the passed item set. */ + static void GetFont( Font& rFont, const SfxItemSet& rItemSet, + ScAutoFontColorMode eAutoMode, + OutputDevice* pOutDev = NULL, + const Fraction* pScale = NULL, + const SfxItemSet* pCondSet = NULL, + sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL, + const Color* pTextConfigColor = NULL ); + /** Fills a font object from the own item set. */ + void GetFont( Font& rFont, ScAutoFontColorMode eAutoMode, + OutputDevice* pOutDev = NULL, + const Fraction* pScale = NULL, + const SfxItemSet* pCondSet = NULL, + sal_uInt8 nScript = 0, const Color* pBackConfigColor = NULL, + const Color* pTextConfigColor = NULL ) const; + + /** Converts all Calc items contained in rSrcSet to edit engine items and puts them into rEditSet. */ + static void FillToEditItemSet( SfxItemSet& rEditSet, const SfxItemSet& rSrcSet, const SfxItemSet* pCondSet = NULL ); + /** Converts all Calc items contained in the own item set to edit engine items and puts them into pEditSet. */ + void FillEditItemSet( SfxItemSet* pEditSet, const SfxItemSet* pCondSet = NULL ) const; + + /** Converts all edit engine items contained in rEditSet to Calc items and puts them into rDestSet. */ + static void GetFromEditItemSet( SfxItemSet& rDestSet, const SfxItemSet& rEditSet ); + /** Converts all edit engine items contained in pEditSet to Calc items and puts them into the own item set. */ + void GetFromEditItemSet( const SfxItemSet* pEditSet ); + + void FillEditParaItems( SfxItemSet* pSet ) const; + + ScPatternAttr* PutInPool( ScDocument* pDestDoc, ScDocument* pSrcDoc ) const; + + void SetStyleSheet(ScStyleSheet* pNewStyle); + const ScStyleSheet* GetStyleSheet() const { return pStyle; } + const String* GetStyleName() const; + void UpdateStyleSheet(); + void StyleToName(); + + sal_Bool IsVisible() const; + sal_Bool IsVisibleEqual( const ScPatternAttr& rOther ) const; + + /** If font is an old symbol font StarBats/StarMath + with text encoding RTL_TEXTENC_SYMBOL */ + sal_Bool IsSymbolFont() const; + + sal_uLong GetNumberFormat( SvNumberFormatter* ) const; + sal_uLong GetNumberFormat( SvNumberFormatter* pFormatter, + const SfxItemSet* pCondSet ) const; + + long GetRotateVal( const SfxItemSet* pCondSet ) const; + sal_uInt8 GetRotateDir( const SfxItemSet* pCondSet ) const; +}; + + +class ScFontToSubsFontConverter_AutoPtr +{ + FontToSubsFontConverter h; + + void release() + { + if ( h ) + DestroyFontToSubsFontConverter( h ); + } + + // prevent usage + ScFontToSubsFontConverter_AutoPtr( const ScFontToSubsFontConverter_AutoPtr& ); + ScFontToSubsFontConverter_AutoPtr& operator=( const ScFontToSubsFontConverter_AutoPtr& ); + +public: + ScFontToSubsFontConverter_AutoPtr() + : h(0) + {} + ~ScFontToSubsFontConverter_AutoPtr() + { + release(); + } + + ScFontToSubsFontConverter_AutoPtr& operator=( FontToSubsFontConverter hN ) + { + release(); + h = hN; + return *this; + } + + operator FontToSubsFontConverter() const + { return h; } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pch/precompiled_sc.cxx b/sc/inc/pch/precompiled_sc.cxx new file mode 100644 index 000000000000..705088caeddb --- /dev/null +++ b/sc/inc/pch/precompiled_sc.cxx @@ -0,0 +1,31 @@ +/* -*- 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. + * + ************************************************************************/ + +#include "precompiled_sc.hxx" + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx new file mode 100644 index 000000000000..a3f9a790357d --- /dev/null +++ b/sc/inc/pch/precompiled_sc.hxx @@ -0,0 +1,243 @@ +/* -*- 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. + * + ************************************************************************/ + +// MARKER(update_precomp.py): Generated on 2006-07-11 15:52:42.937361 + +#ifdef PRECOMPILED_HEADERS +#include <sal/config.h> +#include "scitems.hxx" + +#include <algorithm> +#include <assert.h> +#include <deque> +#include <stdarg.h> +#include <stddef.h> +#include <stdio.h> +#include <string.h> +#include <iosfwd> +#include <limits.h> +#include <limits> +#include <list> +#include <math.h> +#include <memory> +#include <new> +#include <cfloat> + +#include <boost/bind.hpp> + +#include <basegfx/polygon/b2dpolygon.hxx> +#include <basegfx/polygon/b3dpolygon.hxx> +#include <basegfx/polygon/b3dpolypolygon.hxx> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Type.hxx> +#include <cppu/macros.hxx> +#include <cppuhelper/weakref.hxx> +#include <cstddef> +#include <cwchar> +#include <float.h> +#include <functional> +#include <offuh/com/sun/star/awt/Point.hdl> +#include <offuh/com/sun/star/awt/Point.hpp> +#include <offuh/com/sun/star/awt/Size.hdl> +#include <offuh/com/sun/star/awt/Size.hpp> +#include <offuh/com/sun/star/beans/PropertyVetoException.hdl> +#include <offuh/com/sun/star/beans/PropertyVetoException.hpp> +#include <offuh/com/sun/star/container/ElementExistException.hdl> +#include <offuh/com/sun/star/container/ElementExistException.hpp> +#include <offuh/com/sun/star/container/NoSuchElementException.hpp> +#include <offuh/com/sun/star/container/XElementAccess.hdl> +#include <offuh/com/sun/star/container/XElementAccess.hpp> +#include <offuh/com/sun/star/container/XNameAccess.hpp> +#include <offuh/com/sun/star/datatransfer/DataFlavor.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/DragGestureEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/DragSourceDragEvent.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/DragSourceDragEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/DragSourceDropEvent.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/DragSourceEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetDragEnterEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetDragEvent.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetDragEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetDropEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetEvent.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/DropTargetEvent.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/XDragGestureListener.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/XDragSource.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/XDragSource.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/XDragSourceContext.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/XDragSourceListener.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> +#include <offuh/com/sun/star/datatransfer/dnd/XDropTargetListener.hdl> +#include <offuh/com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> +#include <offuh/com/sun/star/datatransfer/UnsupportedFlavorException.hdl> +#include <offuh/com/sun/star/datatransfer/XTransferable.hpp> +#include <offuh/com/sun/star/drawing/XShape.hpp> +#include <offuh/com/sun/star/embed/InvalidStorageException.hpp> +#include <offuh/com/sun/star/embed/StorageWrappedTargetException.hdl> +#include <offuh/com/sun/star/embed/StorageWrappedTargetException.hpp> +#include <offuh/com/sun/star/embed/XStorage.hdl> +#include <offuh/com/sun/star/embed/XStorage.hpp> +#include <offuh/com/sun/star/io/BufferSizeExceededException.hpp> +#include <offuh/com/sun/star/io/IOException.hdl> +#include <offuh/com/sun/star/io/NotConnectedException.hdl> +#include <offuh/com/sun/star/io/NotConnectedException.hpp> +#include <offuh/com/sun/star/io/XInputStream.hdl> +#include <offuh/com/sun/star/io/XInputStream.hpp> +#include <offuh/com/sun/star/io/XOutputStream.hdl> +#include <offuh/com/sun/star/io/XOutputStream.hpp> +#include <offuh/com/sun/star/io/XStream.hdl> +#include <offuh/com/sun/star/lang/EventObject.hdl> +#include <offuh/com/sun/star/lang/IllegalArgumentException.hpp> +#include <offuh/com/sun/star/lang/WrappedTargetException.hdl> +#include <offuh/com/sun/star/lang/WrappedTargetException.hpp> +#include <offuh/com/sun/star/lang/XComponent.hpp> +#include <offuh/com/sun/star/lang/XEventListener.hpp> +#include <offuh/com/sun/star/packages/NoEncryptionException.hdl> +#include <offuh/com/sun/star/packages/NoEncryptionException.hpp> +#include <offuh/com/sun/star/packages/WrongPasswordException.hdl> +#include <offuh/com/sun/star/packages/WrongPasswordException.hpp> +#include <offuh/com/sun/star/uno/Exception.hdl> +#include <offuh/com/sun/star/uno/Exception.hpp> +#include <offuh/com/sun/star/uno/RuntimeException.hdl> +#include <offuh/com/sun/star/uno/RuntimeException.hpp> +#include <offuh/com/sun/star/uno/XAdapter.hdl> +#include <offuh/com/sun/star/uno/XAdapter.hpp> +#include <offuh/com/sun/star/uno/XInterface.hdl> +#include <offuh/com/sun/star/uno/XReference.hdl> +#include <offuh/com/sun/star/uno/XReference.hpp> +#include <offuh/com/sun/star/uno/XWeak.hpp> +#include <osl/endian.h> +#include <osl/interlck.h> +#include <osl/mutex.hxx> +#include <rtl/alloc.h> +#include <rtl/string.h> +#include <rtl/ustrbuf.h> +#include <rtl/ustring.h> +#include <sal/mathconf.h> +#include <sal/types.h> +#include <sot/exchange.hxx> +#include <sot/factory.hxx> +#include <sot/storage.hxx> +#include <svl/brdcst.hxx> +#include <svl/cenumitm.hxx> +#include <svl/cintitem.hxx> +#include <unotools/fltrcfg.hxx> +#include <svl/intitem.hxx> +#include <svl/listener.hxx> +#include <svl/lstner.hxx> +#include <unotools/pathoptions.hxx> +#include <svl/solar.hrc> +#include <unotools/useroptions.hxx> +#include <editeng/editobj.hxx> +#include <editeng/eeitem.hxx> +#include <svx/fmglob.hxx> +#include <editeng/outlobj.hxx> +#include <svx/sdangitm.hxx> +#include <svx/sderitm.hxx> +#include <svx/sdmetitm.hxx> +#include <svx/sdooitm.hxx> +#include <svx/sdprcitm.hxx> +#include <svx/sdrmasterpagedescriptor.hxx> +#include <svx/sdrpageuser.hxx> +#include <svx/sdtaitm.hxx> +#include <svx/svdglue.hxx> +#include <svx/svdlayer.hxx> +#include <svx/svdoattr.hxx> +#include <svx/svdobj.hxx> +#include <svx/svdpage.hxx> +#include <svx/svdpool.hxx> +#include <svx/svdtrans.hxx> +#include <svx/svdtypes.hxx> +#include <svx/unoapi.hxx> +#include <svx/volume3d.hxx> +#include <svx/xcolit.hxx> +#include <svx/xenum.hxx> +#include <svx/xfillit0.hxx> +#include <svx/xflasit.hxx> +#include <svx/xlineit0.hxx> +#include <svx/xlnasit.hxx> +#include <svx/xtextit0.hxx> +#include <tools/date.hxx> +#include <tools/datetime.hxx> +#include <tools/errcode.hxx> +#include <tools/errinf.hxx> +#include <tools/gen.hxx> +#include <tools/globname.hxx> +#include <tools/rc.hxx> +#include <tools/rtti.hxx> +#include <tools/solar.h> +#include <tools/string.hxx> +#include <tools/toolsdllapi.h> +#include <tools/weakbase.h> +#include <tools/weakbase.hxx> +#include <typeinfo> +#include <typelib/typeclass.h> +#include <typelib/typedescription.h> +#include <typelib/uik.h> +#include <uno/any2.h> +#include <uno/lbnames.h> +#include <uno/sequence2.h> +#include <unotools/ucbstreamhelper.hxx> + +#include <vcl/apptypes.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> +#include <vcl/dllapi.h> +#include <vcl/dndhelp.hxx> +#include <vcl/edit.hxx> +#include <vcl/field.hxx> +#include <tools/fldunit.hxx> +#include <vcl/gdimtf.hxx> +#include <vcl/inputctx.hxx> +#include <vcl/jobset.hxx> +#include <vcl/mapmod.hxx> +#include <vcl/menu.hxx> +#include <vcl/pointr.hxx> +#include <vcl/print.hxx> +#include <vcl/prntypes.hxx> +#include <vcl/ptrstyle.hxx> +#include <vcl/region.hxx> +#include <vcl/salnativewidgets.hxx> +#include <vcl/spinfld.hxx> +#include <vcl/sv.h> +#include <vcl/svapp.hxx> +#include <vcl/vclevent.hxx> +#include <vcl/window.hxx> +#include <vcl/wintypes.hxx> +#include <wchar.h> + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx new file mode 100644 index 000000000000..01bb7be646d2 --- /dev/null +++ b/sc/inc/pivot.hxx @@ -0,0 +1,209 @@ +/* -*- 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. + * + ************************************************************************/ +/* + IMPORTANT: + Strictly adhere to the following sequence when creating a pivot table: + + pPivot->SetColFields(aColArr, aColCount) + pPivot->SetRowFields(aRowArr, aRowCount) + pPivot->SetDataFields(aDataArr, aDataCount) + if (pPivot->CreateData()) + { + pPivotDrawData(); + pPivotReleaseData(); + } + + Make sure that either ColArr or RowArr contains a PivotDataField entry. +*/ + + +#ifndef SC_PIVOT_HXX +#define SC_PIVOT_HXX + +#include "global.hxx" +#include "address.hxx" +#include "dpglobal.hxx" + +#include <vector> +#include <boost/shared_ptr.hpp> + +class SubTotal; +#include "collect.hxx" + +#define PIVOT_DATA_FIELD (MAXCOLCOUNT) +#define PIVOT_FUNC_REF (MAXCOLCOUNT) +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/sheet/DataPilotFieldReference.hpp> +#include <com/sun/star/sheet/DataPilotFieldSortInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldLayoutInfo.hpp> +#include <com/sun/star/sheet/DataPilotFieldAutoShowInfo.hpp> + +class SvStream; +class ScDocument; +class ScUserListData; +class ScProgress; + +struct ScDPLabelData; +typedef ::boost::shared_ptr<ScDPLabelData> ScDPLabelDataRef; + +// ----------------------------------------------------------------------- + +struct PivotField +{ + SCsCOL nCol; + sal_uInt16 nFuncMask; + sal_uInt16 nFuncCount; + ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; + + explicit PivotField( SCsCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE ); + PivotField( const PivotField& r ); + + bool operator==( const PivotField& r ) const; +}; + +// ----------------------------------------------------------------------- + +// implementation still in global2.cxx +struct ScPivotParam +{ + SCCOL nCol; // cursor position / + SCROW nRow; // or start of destination area + SCTAB nTab; + ::std::vector<ScDPLabelDataRef> maLabelArray; + ::std::vector<PivotField> maPageFields; + ::std::vector<PivotField> maColFields; + ::std::vector<PivotField> maRowFields; + ::std::vector<PivotField> maDataFields; + sal_Bool bIgnoreEmptyRows; + sal_Bool bDetectCategories; + sal_Bool bMakeTotalCol; + sal_Bool bMakeTotalRow; + + ScPivotParam(); + ScPivotParam( const ScPivotParam& r ); + ~ScPivotParam(); + + ScPivotParam& operator= ( const ScPivotParam& r ); + bool operator== ( const ScPivotParam& r ) const; + void ClearPivotArrays(); + void SetLabelData (const ::std::vector<ScDPLabelDataRef>& r); +}; + +//------------------------------------------------------------------------ + +struct ScDPName +{ + ::rtl::OUString maName; /// Original name of the dimension. + ::rtl::OUString maLayoutName; /// Layout name (display name) + + explicit ScDPName(const ::rtl::OUString& rName, const ::rtl::OUString& rLayoutName); +}; + +// ============================================================================ + +struct ScDPLabelData +{ + ::rtl::OUString maName; /// Original name of the dimension. + ::rtl::OUString maLayoutName; /// Layout name (display name) + SCCOL mnCol; + sal_uInt16 mnFuncMask; /// Page/Column/Row subtotal function. + sal_Int32 mnUsedHier; /// Used hierarchy. + sal_Int32 mnFlags; /// Flags from the DataPilotSource dimension + bool mbShowAll; /// true = Show all (also empty) results. + bool mbIsValue; /// true = Sum or count in data field. + + struct Member + { + ::rtl::OUString maName; + ::rtl::OUString maLayoutName; + bool mbVisible; + bool mbShowDetails; + + Member(); + + /** + * return the name that should be displayed in the dp dialogs i.e. + * when the layout name is present, use it, or else use the original + * name. + */ + ::rtl::OUString SC_DLLPUBLIC getDisplayName() const; + }; + ::std::vector<Member> maMembers; + ::com::sun::star::uno::Sequence< ::rtl::OUString > maHiers; /// Hierarchies. + ::com::sun::star::sheet::DataPilotFieldSortInfo maSortInfo; /// Sorting info. + ::com::sun::star::sheet::DataPilotFieldLayoutInfo maLayoutInfo; /// Layout info. + ::com::sun::star::sheet::DataPilotFieldAutoShowInfo maShowInfo; /// AutoShow info. + + explicit ScDPLabelData( const String& rName, SCCOL nCol, bool bIsValue ); + + /** + * return the name that should be displayed in the dp dialogs i.e. when + * the layout name is present, use it, or else use the original name. + */ + ::rtl::OUString SC_DLLPUBLIC getDisplayName() const; +}; + +typedef std::vector< ScDPLabelData > ScDPLabelDataVector; + +// ============================================================================ + +struct ScPivotField +{ + SCCOL nCol; + sal_uInt16 nFuncMask; + sal_uInt16 nFuncCount; + ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; + + explicit ScPivotField( SCCOL nNewCol = 0, sal_uInt16 nNewFuncMask = PIVOT_FUNC_NONE ); + + bool operator==( const ScPivotField& r ) const; +}; + +typedef ::std::vector< ScPivotField > ScPivotFieldVector; + +// ============================================================================ + +struct ScDPFuncData +{ + short mnCol; + sal_uInt16 mnFuncMask; + ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; + + explicit ScDPFuncData( short nNewCol, sal_uInt16 nNewFuncMask ); + explicit ScDPFuncData( short nNewCol, sal_uInt16 nNewFuncMask, + const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef ); +}; + +// ============================================================================ + +typedef std::vector< ScDPLabelData > ScDPLabelDataVec; +typedef std::vector<ScDPName> ScDPNameVec; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx new file mode 100644 index 000000000000..5d63b373db21 --- /dev/null +++ b/sc/inc/postit.hxx @@ -0,0 +1,266 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_POSTIT_HXX +#define SC_POSTIT_HXX + +#include <boost/shared_ptr.hpp> +#include <rtl/ustring.hxx> +#include <tools/gen.hxx> +#include "address.hxx" +#include "scdllapi.h" + +class EditTextObject; +class OutlinerParaObject; +class SdrCaptionObj; +class SdrPage; +class SfxItemSet; +class ScDocument; +struct ScCaptionInitData; + +// ============================================================================ + +/** Internal data for a cell annotation. */ +struct SC_DLLPUBLIC ScNoteData +{ + typedef ::boost::shared_ptr< ScCaptionInitData > ScCaptionInitDataRef; + + ::rtl::OUString maDate; /// Creation date of the note. + ::rtl::OUString maAuthor; /// Author of the note. + ScCaptionInitDataRef mxInitData; /// Initial data for invisible notes without SdrObject. + SdrCaptionObj* mpCaption; /// Drawing object representing the cell note. + bool mbShown; /// True = note is visible. + + explicit ScNoteData( bool bShown = false ); + ~ScNoteData(); +}; + +// ============================================================================ + +/** An additional class held by an ScBaseCell instance containing all + information for a cell annotation. + */ +class SC_DLLPUBLIC ScPostIt +{ +public: + /** Creates an empty note and its caption object and places it according to + the passed cell position. */ + explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, bool bShown ); + + /** Copy constructor. Clones the note and its caption to a new document. */ + explicit ScPostIt( ScDocument& rDoc, const ScAddress& rPos, const ScPostIt& rNote ); + + /** Creates a note from the passed note data with existing caption object. + + @param bAlwaysCreateCaption Instead of a pointer to an existing + caption object, the passed note data structure may contain a + reference to an ScCaptionInitData structure containing information + about how to construct a missing caption object. If sal_True is passed, + the caption drawing object will be created immediately from that + data. If sal_False is passed and the note is not visible, it will + continue to cache that data until the caption object is requested. + */ + explicit ScPostIt( + ScDocument& rDoc, const ScAddress& rPos, + const ScNoteData& rNoteData, bool bAlwaysCreateCaption ); + + /** Removes the caption object from drawing layer, if this note is its owner. */ + ~ScPostIt(); + + /** Clones this note and its caption object, if specified. + + @param bCloneCaption If sal_True is passed, clones the caption object and + inserts it into the drawing layer of the destination document. If + sal_False is passed, the cloned note will refer to the old caption + object (used e.g. in Undo documents to restore the pointer to the + existing caption object). + */ + ScPostIt* Clone( + const ScAddress& rOwnPos, + ScDocument& rDestDoc, const ScAddress& rDestPos, + bool bCloneCaption ) const; + + /** Returns the data struct containing all note settings. */ + inline const ScNoteData& GetNoteData() const { return maNoteData; } + + /** Returns the creation date of this note. */ + inline const ::rtl::OUString& GetDate() const { return maNoteData.maDate; } + /** Sets a new creation date for this note. */ + inline void SetDate( const ::rtl::OUString& rDate ) { maNoteData.maDate = rDate; } + + /** Returns the author date of this note. */ + inline const ::rtl::OUString& GetAuthor() const { return maNoteData.maAuthor; } + /** Sets a new author date for this note. */ + inline void SetAuthor( const ::rtl::OUString& rAuthor ) { maNoteData.maAuthor = rAuthor; } + + /** Sets date and author from system settings. */ + void AutoStamp(); + + /** Returns the pointer to the current outliner object, or null. */ + const OutlinerParaObject* GetOutlinerObject() const; + /** Returns the pointer to the current edit text object, or null. */ + const EditTextObject* GetEditTextObject() const; + + /** Returns the caption text of this note. */ + ::rtl::OUString GetText() const; + /** Returns true, if the caption text of this note contains line breaks. */ + bool HasMultiLineText() const; + /** Changes the caption text of this note. All text formatting will be lost. */ + void SetText( const ScAddress& rPos, const ::rtl::OUString& rText ); + + /** Returns an existing note caption object. returns null, if the note + contains initial caption data needed to construct a caption object. */ + inline SdrCaptionObj* GetCaption() const { return maNoteData.mpCaption; } + /** Returns the caption object of this note. Creates the caption object, if + the note contains initial caption data instead of the caption. */ + SdrCaptionObj* GetOrCreateCaption( const ScAddress& rPos ) const; + /** Forgets the pointer to the note caption object. */ + void ForgetCaption(); + + /** Shows or hides the note caption object. */ + void ShowCaption( const ScAddress& rPos, bool bShow = true ); + /** Returns true, if the caption object is visible. */ + inline bool IsCaptionShown() const { return maNoteData.mbShown; } + + /** Shows or hides the caption temporarily (does not change internal visibility state). */ + void ShowCaptionTemp( const ScAddress& rPos, bool bShow = true ); + + /** Updates caption position according to position of the passed cell. */ + void UpdateCaptionPos( const ScAddress& rPos ); + +private: + ScPostIt( const ScPostIt& ); + ScPostIt& operator=( const ScPostIt& ); + + /** Creates the caption object from initial caption data if existing. */ + void CreateCaptionFromInitData( const ScAddress& rPos ) const; + /** Creates a new caption object at the passed cell position, clones passed existing caption. */ + void CreateCaption( const ScAddress& rPos, const SdrCaptionObj* pCaption = 0 ); + /** Removes the caption object from the drawing layer, if this note is its owner. */ + void RemoveCaption(); + +private: + ScDocument& mrDoc; /// Parent document containing the note. + mutable ScNoteData maNoteData; /// Note data with pointer to caption object. +}; + +// ============================================================================ + +class SC_DLLPUBLIC ScNoteUtil +{ +public: + /** Tries to update the position of note caption objects in the specified range. */ + static void UpdateCaptionPositions( ScDocument& rDoc, const ScRange& rRange ); + + /** Creates and returns a caption object for a temporary caption. */ + static SdrCaptionObj* CreateTempCaption( ScDocument& rDoc, const ScAddress& rPos, + SdrPage& rDrawPage, const ::rtl::OUString& rUserText, + const Rectangle& rVisRect, bool bTailFront ); + + /** Creates a cell note using the passed caption drawing object. + + This function is used in import filters to reuse the imported drawing + object as note caption object. + + @param rCaption The drawing object for the cell note. This object MUST + be inserted into the document at the correct drawing page already. + + @return Pointer to the new cell note object if insertion was + successful (i.e. the passed cell position was valid), null + otherwise. The Calc document is the owner of the note object. The + passed item set and outliner object are deleted automatically if + creation of the note was not successful. + */ + static ScPostIt* CreateNoteFromCaption( + ScDocument& rDoc, const ScAddress& rPos, + SdrCaptionObj& rCaption, bool bShown ); + + /** Creates a cell note based on the passed caption object data. + + This function is used in import filters to use an existing imported + item set and outliner object to create a note caption object. For + performance reasons, it is possible to specify that the caption drawing + object for the cell note is not created yet but the note caches the + passed data needed to create the caption object on demand (see + parameter bAlwaysCreateCaption). + + @param pItemSet Pointer to an item set on heap memory containing all + formatting attributes of the caption object. This function takes + ownership of the passed item set. + + @param pOutlinerObj Pointer to an outliner object on heap memory + containing (formatted) text for the caption object. This function + takes ownership of the passed outliner object. + + @param rCaptionRect The absolute position and size of the caption + object. The rectangle may be empty, in this case the default + position and size is used. + + @param bAlwaysCreateCaption If sal_True is passed, the caption drawing + object will be created immediately. If sal_False is passed, the caption + drawing object will not be created if the note is not visible + (bShown = sal_False), but the cell note will cache the passed data. + MUST be set to sal_False outside of import filter implementations! + + @return Pointer to the new cell note object if insertion was + successful (i.e. the passed cell position was valid), null + otherwise. The Calc document is the owner of the note object. + */ + static ScPostIt* CreateNoteFromObjectData( + ScDocument& rDoc, const ScAddress& rPos, + SfxItemSet* pItemSet, OutlinerParaObject* pOutlinerObj, + const Rectangle& rCaptionRect, bool bShown, + bool bAlwaysCreateCaption ); + + /** Creates a cell note based on the passed string and inserts it into the + document. + + @param rNoteText The text used to create the note caption object. Must + not be empty. + + @param bAlwaysCreateCaption If sal_True is passed, the caption drawing + object will be created immediately. If sal_False is passed, the caption + drawing object will not be created if the note is not visible + (bShown = sal_False), but the cell note will cache the passed data. + MUST be set to sal_False outside of import filter implementations! + + @return Pointer to the new cell note object if insertion was + successful (i.e. the passed cell position was valid), null + otherwise. The Calc document is the owner of the note object. + */ + static ScPostIt* CreateNoteFromString( + ScDocument& rDoc, const ScAddress& rPos, + const ::rtl::OUString& rNoteText, bool bShown, + bool bAlwaysCreateCaption ); +}; + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/printopt.hxx b/sc/inc/printopt.hxx new file mode 100644 index 000000000000..5883e7ccb18c --- /dev/null +++ b/sc/inc/printopt.hxx @@ -0,0 +1,101 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_PRINTOPT_HXX +#define SC_PRINTOPT_HXX + +#include <svl/poolitem.hxx> +#include <unotools/configitem.hxx> +#include "scdllapi.h" + +class SC_DLLPUBLIC ScPrintOptions +{ +private: + sal_Bool bSkipEmpty; + sal_Bool bAllSheets; + +public: + ScPrintOptions(); + ScPrintOptions( const ScPrintOptions& rCpy ); + ~ScPrintOptions(); + + sal_Bool GetSkipEmpty() const { return bSkipEmpty; } + void SetSkipEmpty( sal_Bool bVal ) { bSkipEmpty = bVal; } + sal_Bool GetAllSheets() const { return bAllSheets; } + void SetAllSheets( sal_Bool bVal ) { bAllSheets = bVal; } + + void SetDefaults(); + + const ScPrintOptions& operator= ( const ScPrintOptions& rCpy ); + int operator== ( const ScPrintOptions& rOpt ) const; + int operator!= ( const ScPrintOptions& rOpt ) const; +}; + +//================================================================== +// item for the dialog / options page +//================================================================== + +class SC_DLLPUBLIC ScTpPrintItem : public SfxPoolItem +{ +public: + TYPEINFO(); + ScTpPrintItem( sal_uInt16 nWhich, + const ScPrintOptions& rOpt ); + ScTpPrintItem( const ScTpPrintItem& rItem ); + ~ScTpPrintItem(); + + virtual String GetValueText() const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + const ScPrintOptions& GetPrintOptions() const { return theOptions; } + +private: + ScPrintOptions theOptions; +}; + +//================================================================== +// config item +//================================================================== + +class ScPrintCfg : public ScPrintOptions, public utl::ConfigItem +{ + com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); + +public: + ScPrintCfg(); + + void SetOptions( const ScPrintOptions& rNew ); + + virtual void Commit(); + virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/prnsave.hxx b/sc/inc/prnsave.hxx new file mode 100644 index 000000000000..197e8072048d --- /dev/null +++ b/sc/inc/prnsave.hxx @@ -0,0 +1,83 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_PRNSAVE_HXX +#define SC_PRNSAVE_HXX + +#include "address.hxx" +#include <tools/solar.h> + +#include <vector> + +class ScRange; + +class ScPrintSaverTab +{ + typedef ::std::vector< ScRange > ScRangeVec; + + ScRangeVec maPrintRanges; // Array + ScRange* mpRepeatCol; // single + ScRange* mpRepeatRow; // single + sal_Bool mbEntireSheet; + +public: + ScPrintSaverTab(); + ~ScPrintSaverTab(); + + void SetAreas( const ScRangeVec& rRanges, sal_Bool bEntireSheet ); + void SetRepeat( const ScRange* pCol, const ScRange* pRow ); + + const ScRangeVec& GetPrintRanges() const { return maPrintRanges; } + sal_Bool IsEntireSheet() const { return mbEntireSheet; } + const ScRange* GetRepeatCol() const { return mpRepeatCol; } + const ScRange* GetRepeatRow() const { return mpRepeatRow; } + + sal_Bool operator==( const ScPrintSaverTab& rCmp ) const; +}; + +class ScPrintRangeSaver +{ + SCTAB nTabCount; + ScPrintSaverTab* pData; // Array + +public: + ScPrintRangeSaver( SCTAB nCount ); + ~ScPrintRangeSaver(); + + SCTAB GetTabCount() const { return nTabCount; } + ScPrintSaverTab& GetTabData(SCTAB nTab); + const ScPrintSaverTab& GetTabData(SCTAB nTab) const; + + sal_Bool operator==( const ScPrintRangeSaver& rCmp ) const; +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx new file mode 100644 index 000000000000..8e6b4c76cc8d --- /dev/null +++ b/sc/inc/progress.hxx @@ -0,0 +1,161 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_PROGRESS_HXX +#define SC_PROGRESS_HXX + +#include <sfx2/progress.hxx> +#include "scdllapi.h" + +class ScDocument; + +/* + * #i102566 + * Drawing a progress bar update is not cheap, so if we draw it on every + * percentage change of 200 calculations we get one progress draw per 2 + * calculations which is slower than doing the calculations themselves. So as a + * rough guide only do an update per MIN_NO_CODES_PER_PROGRESS_UPDATE + * calculations + */ +#define MIN_NO_CODES_PER_PROGRESS_UPDATE 100 + + +class SC_DLLPUBLIC ScProgress +{ +private: + static SfxProgress* pGlobalProgress; + static sal_uLong nGlobalRange; + static sal_uLong nGlobalPercent; + static sal_Bool bGlobalNoUserBreak; + static ScProgress* pInterpretProgress; + static ScProgress* pOldInterpretProgress; + static sal_uLong nInterpretProgress; + static sal_Bool bAllowInterpretProgress; + static ScDocument* pInterpretDoc; + static sal_Bool bIdleWasDisabled; + + SfxProgress* pProgress; + + // not implemented + ScProgress( const ScProgress& ); + ScProgress& operator=( const ScProgress& ); + + static void CalcGlobalPercent( sal_uLong nVal ) + { + nGlobalPercent = nGlobalRange ? + nVal * 100 / nGlobalRange : 0; + } + +public: + static SfxProgress* GetGlobalSfxProgress() { return pGlobalProgress; } + static sal_Bool IsUserBreak() { return !bGlobalNoUserBreak; } + static void CreateInterpretProgress( ScDocument* pDoc, + sal_Bool bWait = sal_True ); + static ScProgress* GetInterpretProgress() { return pInterpretProgress; } + static void DeleteInterpretProgress(); + static sal_uLong GetInterpretCount() { return nInterpretProgress; } + static sal_uLong GetGlobalRange() { return nGlobalRange; } + static sal_uLong GetGlobalPercent() { return nGlobalPercent; } + + ScProgress( SfxObjectShell* pObjSh, + const String& rText, + sal_uLong nRange, sal_Bool bAllDocs = false, + sal_Bool bWait = sal_True ); + ~ScProgress(); + +#ifdef SC_PROGRESS_CXX + // for DummyInterpret only, never use otherwise!!! + ScProgress(); +#endif + // might be NULL! + SfxProgress* GetSfxProgress() const { return pProgress; } + + sal_Bool SetStateText( sal_uLong nVal, const String &rVal, sal_uLong nNewRange = 0 ) + { + if ( pProgress ) + { + if ( nNewRange ) + nGlobalRange = nNewRange; + CalcGlobalPercent( nVal ); + if ( !pProgress->SetStateText( nVal, rVal, nNewRange ) ) + bGlobalNoUserBreak = false; + return bGlobalNoUserBreak; + } + return sal_True; + } + sal_Bool SetState( sal_uLong nVal, sal_uLong nNewRange = 0 ) + { + if ( pProgress ) + { + if ( nNewRange ) + nGlobalRange = nNewRange; + CalcGlobalPercent( nVal ); + if ( !pProgress->SetState( nVal, nNewRange ) ) + bGlobalNoUserBreak = false; + return bGlobalNoUserBreak; + } + return sal_True; + } + sal_Bool SetStateCountDown( sal_uLong nVal ) + { + if ( pProgress ) + { + CalcGlobalPercent( nGlobalRange - nVal ); + if ( !pProgress->SetState( nGlobalRange - nVal ) ) + bGlobalNoUserBreak = false; + return bGlobalNoUserBreak; + } + return sal_True; + } + sal_Bool SetStateOnPercent( sal_uLong nVal ) + { // only if percentage increased + if ( nGlobalRange && (nVal * 100 / + nGlobalRange) > nGlobalPercent ) + return SetState( nVal ); + return sal_True; + } + sal_Bool SetStateCountDownOnPercent( sal_uLong nVal ) + { // only if percentage increased + if ( nGlobalRange && + ((nGlobalRange - nVal) * 100 / + nGlobalRange) > nGlobalPercent ) + return SetStateCountDown( nVal ); + return sal_True; + } + sal_uLong GetState() + { + if ( pProgress ) + return pProgress->GetState(); + return 0; + } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx new file mode 100644 index 000000000000..1515cd1df7bb --- /dev/null +++ b/sc/inc/queryparam.hxx @@ -0,0 +1,148 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_QUERYPARAM_HXX +#define SC_QUERYPARAM_HXX + +#include "global.hxx" +#include "scmatrix.hxx" + +#include <vector> + +struct ScDBQueryParamInternal; + +struct ScQueryParamBase +{ + bool bHasHeader; + bool bByRow; + bool bInplace; + bool bCaseSens; + bool bRegExp; + bool bDuplicate; + bool bMixedComparison; // whether numbers are smaller than strings + + virtual ~ScQueryParamBase(); + + virtual bool IsValidFieldIndex() const; + + SC_DLLPUBLIC SCSIZE GetEntryCount() const; + SC_DLLPUBLIC ScQueryEntry& GetEntry(SCSIZE n) const; + void Resize(SCSIZE nNew); + SC_DLLPUBLIC void DeleteQuery( SCSIZE nPos ); + void FillInExcelSyntax(String& aCellStr, SCSIZE nIndex); + +protected: + ScQueryParamBase(); + ScQueryParamBase(const ScQueryParamBase& r); + + mutable ::std::vector<ScQueryEntry> maEntries; +}; + +// ============================================================================ + +struct ScQueryParamTable +{ + SCCOL nCol1; + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + SCTAB nTab; + + ScQueryParamTable(); + ScQueryParamTable(const ScQueryParamTable& r); + virtual ~ScQueryParamTable(); +}; + +// ============================================================================ + +struct SC_DLLPUBLIC ScQueryParam : public ScQueryParamBase, public ScQueryParamTable +{ + bool bDestPers; // not saved + SCTAB nDestTab; + SCCOL nDestCol; + SCROW nDestRow; + + ScQueryParam(); + ScQueryParam( const ScQueryParam& r ); + ScQueryParam( const ScDBQueryParamInternal& r ); + virtual ~ScQueryParam(); + + ScQueryParam& operator= ( const ScQueryParam& r ); + sal_Bool operator== ( const ScQueryParam& rOther ) const; + void Clear(); + void ClearDestParams(); + void MoveToDest(); +}; + +// ============================================================================ + +struct ScDBQueryParamBase : public ScQueryParamBase +{ + enum DataType { INTERNAL, MATRIX }; + + SCCOL mnField; /// the field in which the values are processed during iteration. + bool mbSkipString; + + DataType GetType() const; + + virtual ~ScDBQueryParamBase(); + +protected: + ScDBQueryParamBase(DataType eType); + +private: + ScDBQueryParamBase(); + + DataType meType; +}; + +// ============================================================================ + +struct ScDBQueryParamInternal : public ScDBQueryParamBase, public ScQueryParamTable +{ + ScDBQueryParamInternal(); + virtual ~ScDBQueryParamInternal(); + + virtual bool IsValidFieldIndex() const; +}; + +// ============================================================================ + +struct ScDBQueryParamMatrix : public ScDBQueryParamBase +{ + ScMatrixRef mpMatrix; + + ScDBQueryParamMatrix(); + virtual ~ScDBQueryParamMatrix(); + + virtual bool IsValidFieldIndex() const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx new file mode 100644 index 000000000000..95c9f0e701cb --- /dev/null +++ b/sc/inc/rangelst.hxx @@ -0,0 +1,146 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_RANGELST_HXX +#define SC_RANGELST_HXX + +#include "global.hxx" +#include "address.hxx" +#include <tools/solar.h> +#include <vector> + +class ScDocument; + +class SC_DLLPUBLIC ScRangeList : public SvRefBase +{ +public: + ScRangeList() {} + ScRangeList( const ScRangeList& rList ); + virtual ~ScRangeList(); + ScRangeList& operator=(const ScRangeList& rList); + void Append( const ScRange& rRange ) + { + ScRange* pR = new ScRange( rRange ); + maRanges.push_back( pR ); + } + + sal_uInt16 Parse( const String&, ScDocument* = NULL, + sal_uInt16 nMask = SCA_VALID, + formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, + sal_Unicode cDelimiter = 0 ); + + void Format( String&, sal_uInt16 nFlags = 0, ScDocument* = NULL, + formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, + sal_Unicode cDelimiter = 0 ) const; + + void Join( const ScRange&, bool bIsInList = false ); + + bool UpdateReference( UpdateRefMode, ScDocument*, + const ScRange& rWhere, + SCsCOL nDx, + SCsROW nDy, + SCsTAB nDz + ); + + const ScRange* Find( const ScAddress& ) const; + ScRange* Find( const ScAddress& ); + bool operator==( const ScRangeList& ) const; + bool operator!=( const ScRangeList& r ) const; + bool Intersects( const ScRange& ) const; + bool In( const ScRange& ) const; + size_t GetCellCount() const; + + ScRange* Remove(size_t nPos); + void RemoveAll(); + + bool empty() const; + size_t size() const; + ScRange* operator[](size_t idx); + const ScRange* operator[](size_t idx) const; + ScRange* front(); + const ScRange* front() const; + ScRange* back(); + const ScRange* back() const; + void push_back(ScRange* p); + +private: + ::std::vector<ScRange*> maRanges; +}; +SV_DECL_IMPL_REF( ScRangeList ); + + +// RangePairList: +// aRange[0]: actual range, +// aRange[1]: data for that range, e.g. Rows belonging to a ColName +class SC_DLLPUBLIC ScRangePairList : public SvRefBase +{ +public: + virtual ~ScRangePairList(); + ScRangePairList* Clone() const; + void Append( const ScRangePair& rRangePair ) + { + ScRangePair* pR = new ScRangePair( rRangePair ); + maPairs.push_back( pR ); + } + void Join( const ScRangePair&, bool bIsInList = false ); + bool UpdateReference( UpdateRefMode, ScDocument*, + const ScRange& rWhere, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void DeleteOnTab( SCTAB nTab ); + ScRangePair* Find( const ScAddress& ) const; + ScRangePair* Find( const ScRange& ) const; + ScRangePair** CreateNameSortedArray( size_t& nCount, ScDocument* ) const; + bool operator==( const ScRangePairList& ) const; + + ScRangePair* Remove(size_t nPos); + ScRangePair* Remove(ScRangePair* pAdr); + + size_t size() const; + ScRangePair* operator[](size_t idx); + const ScRangePair* operator[](size_t idx) const; + +private: + ::std::vector< ScRangePair* > maPairs; +}; +SV_DECL_IMPL_REF( ScRangePairList ); + +extern "C" int +#ifdef WNT +__cdecl +#endif +ScRangePairList_QsortNameCompare( const void*, const void* ); + +#if defined( ICC ) && defined( SC_RANGELST_CXX ) && defined( OS2 ) + static int _Optlink ICCQsortRPairCompare( const void* a, const void* b) + { return ScRangePairList_QsortNameCompare(a,b); } +#endif + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx new file mode 100644 index 000000000000..3689634ba62d --- /dev/null +++ b/sc/inc/rangenam.hxx @@ -0,0 +1,226 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_RANGENAM_HXX +#define SC_RANGENAM_HXX + +#include "global.hxx" // -> enum UpdateRefMode +#include "address.hxx" +#include "collect.hxx" +#include "formula/grammar.hxx" +#include "scdllapi.h" + +#include <map> +#include <boost/ptr_container/ptr_set.hpp> +#include <boost/ptr_container/ptr_map.hpp> + +//------------------------------------------------------------------------ + +class ScDocument; + +namespace rtl { + class OUStringBuffer; +} + + +//------------------------------------------------------------------------ + +typedef sal_uInt16 RangeType; + +#define RT_NAME ((RangeType)0x0000) +#define RT_DATABASE ((RangeType)0x0001) +#define RT_CRITERIA ((RangeType)0x0002) +#define RT_PRINTAREA ((RangeType)0x0004) +#define RT_COLHEADER ((RangeType)0x0008) +#define RT_ROWHEADER ((RangeType)0x0010) +#define RT_ABSAREA ((RangeType)0x0020) +#define RT_REFAREA ((RangeType)0x0040) +#define RT_ABSPOS ((RangeType)0x0080) +#define RT_SHARED ((RangeType)0x0100) +#define RT_SHAREDMOD ((RangeType)0x0200) + +//------------------------------------------------------------------------ + +class ScTokenArray; + +class ScRangeData +{ +private: + String aName; + String aUpperName; // #i62977# for faster searching (aName is never modified after ctor) + ScTokenArray* pCode; + ScAddress aPos; + RangeType eType; + ScDocument* pDoc; + sal_uInt16 nIndex; + sal_Bool bModified; // is set/cleared by UpdateReference + + // max row and column to use for wrapping of references. If -1 use the + // application's default. + SCROW mnMaxRow; + SCCOL mnMaxCol; + + ScRangeData( sal_uInt16 nIndex ); +public: + typedef ::std::map<sal_uInt16, sal_uInt16> IndexMap; + + SC_DLLPUBLIC ScRangeData( ScDocument* pDoc, + const String& rName, + const String& rSymbol, + const ScAddress& rAdr = ScAddress(), + RangeType nType = RT_NAME, + const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ); + SC_DLLPUBLIC ScRangeData( ScDocument* pDoc, + const String& rName, + const ScTokenArray& rArr, + const ScAddress& rAdr = ScAddress(), + RangeType nType = RT_NAME ); + SC_DLLPUBLIC ScRangeData( ScDocument* pDoc, + const String& rName, + const ScAddress& rTarget ); + // rTarget is ABSPOS jump label + ScRangeData(const ScRangeData& rScRangeData); + + SC_DLLPUBLIC ~ScRangeData(); + + sal_Bool operator== (const ScRangeData& rData) const; + + void GetName( String& rName ) const { rName = aName; } + const String& GetName( void ) const { return aName; } + const String& GetUpperName( void ) const { return aUpperName; } + ScAddress GetPos() const { return aPos; } + // The index has to be unique. If index=0 a new index value is assigned. + void SetIndex( sal_uInt16 nInd ) { nIndex = nInd; } + sal_uInt16 GetIndex() const { return nIndex; } + ScTokenArray* GetCode() { return pCode; } + const ScTokenArray* GetCode() const { return pCode; } + sal_uInt16 GetErrCode(); + sal_Bool HasReferences() const; + void SetDocument( ScDocument* pDocument){ pDoc = pDocument; } + ScDocument* GetDocument() const { return pDoc; } + void SetType( RangeType nType ) { eType = nType; } + void AddType( RangeType nType ) { eType = eType|nType; } + RangeType GetType() const { return eType; } + sal_Bool HasType( RangeType nType ) const; + SC_DLLPUBLIC void GetSymbol( String& rSymbol, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; + SC_DLLPUBLIC void GetSymbol( rtl::OUString& rSymbol, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; + void UpdateSymbol( rtl::OUStringBuffer& rBuffer, const ScAddress&, + const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& r, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + sal_Bool IsModified() const { return bModified; } + + SC_DLLPUBLIC void GuessPosition(); + + void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest ); + void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); + + SC_DLLPUBLIC sal_Bool IsReference( ScRange& rRef ) const; + sal_Bool IsReference( ScRange& rRef, const ScAddress& rPos ) const; + SC_DLLPUBLIC sal_Bool IsValidReference( ScRange& rRef ) const; + sal_Bool IsRangeAtBlock( const ScRange& ) const; + + void UpdateTabRef(SCTAB nOldTable, sal_uInt16 nFlag, SCTAB nNewTable); + void TransferTabRef( SCTAB nOldTab, SCTAB nNewTab ); + + void ValidateTabRefs(); + + void ReplaceRangeNamesInUse( const IndexMap& rMap ); + + static void MakeValidName( String& rName ); + SC_DLLPUBLIC static sal_Bool IsNameValid( const String& rName, ScDocument* pDoc ); + + SC_DLLPUBLIC void SetMaxRow(SCROW nRow); + SCROW GetMaxRow() const; + SC_DLLPUBLIC void SetMaxCol(SCCOL nCol); + SCCOL GetMaxCol() const; +}; + +inline sal_Bool ScRangeData::HasType( RangeType nType ) const +{ + return ( ( eType & nType ) == nType ); +} + +extern "C" int SAL_CALL ScRangeData_QsortNameCompare( const void*, const void* ); + +#if defined( ICC ) && defined( OS2 ) + static int _Optlink ICCQsortNameCompare( const void* a, const void* b) + { return ScRangeData_QsortNameCompare(a,b); } +#endif + +bool operator< (const ScRangeData& left, const ScRangeData& right); + +class ScRangeName +{ +private: + typedef ::boost::ptr_set<ScRangeData> DataType; + DataType maData; + +public: + /// Map that manages stored ScRangeName instances. + typedef ::boost::ptr_map<SCTAB, ScRangeName> TabNameMap; + /// Map that stores non-managed pointers to ScRangeName instances. + typedef ::std::map<SCTAB, const ScRangeName*> TabNameCopyMap; + + static void copyLocalNames(const TabNameMap& rNames, TabNameCopyMap& rCopy); + + typedef DataType::const_iterator const_iterator; + typedef DataType::iterator iterator; + + ScRangeName(); + ScRangeName(const ScRangeName& r); + + SC_DLLPUBLIC const ScRangeData* findByRange(const ScRange& rRange) const; + SC_DLLPUBLIC ScRangeData* findByName(const rtl::OUString& rName); + SC_DLLPUBLIC const ScRangeData* findByName(const rtl::OUString& rName) const; + ScRangeData* findByUpperName(const rtl::OUString& rName); + const ScRangeData* findByUpperName(const rtl::OUString& rName) const; + SC_DLLPUBLIC ScRangeData* findByIndex(sal_uInt16 i); + void UpdateReference(UpdateRefMode eUpdateRefMode, const ScRange& rRange, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz); + void UpdateTabRef(SCTAB nTable, sal_uInt16 nFlag, SCTAB nNewTable = 0); + void UpdateTranspose(const ScRange& rSource, const ScAddress& rDest); + void UpdateGrow(const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY); + + SC_DLLPUBLIC const_iterator begin() const; + SC_DLLPUBLIC const_iterator end() const; + SC_DLLPUBLIC iterator begin(); + SC_DLLPUBLIC iterator end(); + SC_DLLPUBLIC size_t size() const; + bool empty() const; + SC_DLLPUBLIC bool insert(ScRangeData* p); + void erase(const ScRangeData& r); + void erase(const iterator& itr); + void clear(); + bool operator== (const ScRangeName& r) const; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/rangeseq.hxx b/sc/inc/rangeseq.hxx new file mode 100644 index 000000000000..abb7c56e0403 --- /dev/null +++ b/sc/inc/rangeseq.hxx @@ -0,0 +1,116 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_RANGESEQ_HXX +#define SC_RANGESEQ_HXX + +#include <tools/solar.h> +#include <com/sun/star/uno/Any.h> +#include "scmatrix.hxx" + +class SvNumberFormatter; +class ScDocument; +class ScRange; + +class ScRangeToSequence +{ +public: + static sal_Bool FillLongArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange ); + static sal_Bool FillLongArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix ); + static sal_Bool FillDoubleArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange ); + static sal_Bool FillDoubleArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix ); + static sal_Bool FillStringArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange ); + static sal_Bool FillStringArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix, SvNumberFormatter* pFormatter ); + static sal_Bool FillMixedArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange, + sal_Bool bAllowNV = false ); + + /** @param bDataTypes + Additionally to the differentiation between string and double allow + differentiation between other types such as as boolean. Needed for + implementation of XFormulaParser. If <FALSE/>, boolean values are + treated as ordinary double values 1 (true) and 0 (false). + */ + static sal_Bool FillMixedArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix, bool bDataTypes = false ); +}; + + +class ScApiTypeConversion +{ +public: + + /** Convert an uno::Any to double if possible, including integer types. + @param o_fVal + Out: the double value on successful conversion. + @param o_eClass + Out: the uno::TypeClass of rAny. + @returns <TRUE/> if successfully converted. + */ + static bool ConvertAnyToDouble( + double & o_fVal, + com::sun::star::uno::TypeClass & o_eClass, + const com::sun::star::uno::Any & rAny ); + +}; + + +class ScSequenceToMatrix +{ +public: + + /** Convert a sequence of mixed elements to ScMatrix. + + Precondition: rAny.getValueType().equals( getCppuType( (uno::Sequence< uno::Sequence< uno::Any > > *)0)) + + @returns a new'd ScMatrix as ScMatrixRef, NULL if rAny couldn't be read + as type Sequence<Sequence<Any>> + */ + static ScMatrixRef CreateMixedMatrix( const com::sun::star::uno::Any & rAny ); + +}; + + +class ScByteSequenceToString +{ +public: + // rAny must contain Sequence<sal_Int8>, + // may or may not contain 0-bytes at the end + static sal_Bool GetString( String& rString, const com::sun::star::uno::Any& rAny, + sal_uInt16 nEncoding ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx new file mode 100644 index 000000000000..96382e2d528c --- /dev/null +++ b/sc/inc/rangeutl.hxx @@ -0,0 +1,325 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_RANGEUTL_HXX +#define SC_RANGEUTL_HXX + +#include <tools/string.hxx> + +#include "address.hxx" +#include "rangenam.hxx" +#include "scdllapi.h" + +#include <com/sun/star/table/CellAddress.hpp> +#include <com/sun/star/table/CellRangeAddress.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +//------------------------------------------------------------------------ + +class SvStream; + +class ScArea; +class ScDocument; +class ScRange; +class ScRangeName; +class ScRangeList; +class ScDBCollection; + +enum RutlNameScope { RUTL_NONE=0, RUTL_NAMES, RUTL_DBASE }; + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScRangeUtil +{ +public: + ScRangeUtil() {} + ~ScRangeUtil() {} + + sal_Bool MakeArea ( const String& rAreaStr, + ScArea& rArea, + ScDocument* pDoc, + SCTAB nTab, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; + + void CutPosString ( const String& theAreaStr, + String& thePosStr ) const; + + sal_Bool IsAbsTabArea ( const String& rAreaStr, + ScDocument* pDoc, + ScArea*** pppAreas = 0, + sal_uInt16* pAreaCount = 0, + sal_Bool bAcceptCellRef = false, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; + + sal_Bool IsAbsArea ( const String& rAreaStr, + ScDocument* pDoc, + SCTAB nTab, + String* pCompleteStr = 0, + ScRefAddress* pStartPos = 0, + ScRefAddress* pEndPos = 0, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; + + sal_Bool IsRefArea ( const String&, + ScDocument*, + SCTAB, + String* = 0, + ScRefAddress* = 0 ) const + { return false; } + + sal_Bool IsAbsPos ( const String& rPosStr, + ScDocument* pDoc, + SCTAB nTab, + String* pCompleteStr = 0, + ScRefAddress* pPosTripel = 0, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; + + sal_Bool MakeRangeFromName ( const String& rName, + ScDocument* pDoc, + SCTAB nCurTab, + ScRange& rRange, + RutlNameScope eScope=RUTL_NAMES, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; +}; + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScRangeStringConverter +{ +public: + +// helper methods + static void AssignString( + ::rtl::OUString& rString, + const ::rtl::OUString& rNewStr, + sal_Bool bAppendStr, + sal_Unicode cSeperator = ' '); + + static sal_Int32 IndexOf( + const ::rtl::OUString& rString, + sal_Unicode cSearchChar, + sal_Int32 nOffset, + sal_Unicode cQuote = '\''); + + static sal_Int32 IndexOfDifferent( + const ::rtl::OUString& rString, + sal_Unicode cSearchChar, + sal_Int32 nOffset ); + + static sal_Int32 GetTokenCount( + const ::rtl::OUString& rString, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + + static void GetTokenByOffset( + ::rtl::OUString& rToken, + const ::rtl::OUString& rString, + sal_Int32& nOffset, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + + static void AppendTableName( + ::rtl::OUStringBuffer& rBuf, + const ::rtl::OUString& rTabName, + sal_Unicode cQuote = '\''); + +// String to Range core + static sal_Bool GetAddressFromString( + ScAddress& rAddress, + const ::rtl::OUString& rAddressStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Int32& nOffset, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + static sal_Bool GetRangeFromString( + ScRange& rRange, + const ::rtl::OUString& rRangeStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Int32& nOffset, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + static sal_Bool GetRangeListFromString( + ScRangeList& rRangeList, + const ::rtl::OUString& rRangeListStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + + static sal_Bool GetAreaFromString( + ScArea& rArea, + const ::rtl::OUString& rRangeStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Int32& nOffset, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + +// String to Range API + static sal_Bool GetAddressFromString( + ::com::sun::star::table::CellAddress& rAddress, + const ::rtl::OUString& rAddressStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Int32& nOffset, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + static sal_Bool GetRangeFromString( + ::com::sun::star::table::CellRangeAddress& rRange, + const ::rtl::OUString& rRangeStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Int32& nOffset, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + static sal_Bool GetRangeListFromString( + ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress >& rRangeSeq, + const ::rtl::OUString& rRangeListStr, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Unicode cQuote = '\''); + +// Range to String core + static void GetStringFromAddress( + ::rtl::OUString& rString, + const ScAddress& rAddress, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Bool bAppendStr = false, + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + static void GetStringFromRange( + ::rtl::OUString& rString, + const ScRange& rRange, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Bool bAppendStr = false, + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + static void GetStringFromRangeList( + ::rtl::OUString& rString, + const ScRangeList* pRangeList, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D)); + + static void GetStringFromArea( + ::rtl::OUString& rString, + const ScArea& rArea, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Bool bAppendStr = false, + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + +// Range to String API + static void GetStringFromAddress( + ::rtl::OUString& rString, + const ::com::sun::star::table::CellAddress& rAddress, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Bool bAppendStr = false, + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + static void GetStringFromRange( + ::rtl::OUString& rString, + const ::com::sun::star::table::CellRangeAddress& rRange, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_Bool bAppendStr = false, + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + static void GetStringFromRangeList( + ::rtl::OUString& rString, + const ::com::sun::star::uno::Sequence< ::com::sun::star::table::CellRangeAddress >& rRangeSeq, + const ScDocument* pDocument, + formula::FormulaGrammar::AddressConvention eConv, + sal_Unicode cSeperator = ' ', + sal_uInt16 nFormatFlags = (SCA_VALID | SCA_TAB_3D) ); + +// XML Range to Calc Range + static void GetStringFromXMLRangeString( + ::rtl::OUString& rString, + const ::rtl::OUString& rXMLRange, + ScDocument* pDoc ); +}; + +//------------------------------------------------------------------------ + +class ScArea +{ +public: + ScArea( SCTAB tab = 0, + SCCOL colStart = 0, + SCROW rowStart = 0, + SCCOL colEnd = 0, + SCROW rowEnd = 0 ); + + ScArea( const ScArea& r ); + + ScArea& operator= ( const ScArea& r ); + sal_Bool operator== ( const ScArea& r ) const; + sal_Bool operator!= ( const ScArea& r ) const { return !( operator==(r) ); } + +public: + SCTAB nTab; + SCCOL nColStart; + SCROW nRowStart; + SCCOL nColEnd; + SCROW nRowEnd; +}; + +// +// returns areas with reference and all db-areas +// + +class SC_DLLPUBLIC ScAreaNameIterator +{ +private: + ScRangeName* pRangeName; + ScRangeName::const_iterator maRNPos; + ScRangeName::const_iterator maRNEnd; + ScDBCollection* pDBCollection; + bool bFirstPass; + size_t nPos; + +public: + ScAreaNameIterator( ScDocument* pDoc ); + ~ScAreaNameIterator() {} + + sal_Bool Next( String& rName, ScRange& rRange ); + sal_Bool WasDBName() const { return !bFirstPass; } +}; + + +#endif // SC_RANGEUTL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/rechead.hxx b/sc/inc/rechead.hxx new file mode 100644 index 000000000000..689228b7eb4b --- /dev/null +++ b/sc/inc/rechead.hxx @@ -0,0 +1,170 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_RECHEAD_HXX +#define SC_RECHEAD_HXX + +#include <tools/stream.hxx> + +// ID's for files: + +#define SCID_SIZES 0x4200 + +#define SCID_POOLS 0x4210 +#define SCID_DOCPOOL 0x4211 +#define SCID_STYLEPOOL 0x4212 +#define SCID_NEWPOOLS 0x4213 // ID for SC 3.0a +#define SCID_EDITPOOL 0x4214 + +#define SCID_DOCUMENT 0x4220 +#define SCID_DOCFLAGS 0x4221 +#define SCID_TABLE 0x4222 +#define SCID_DRAWING 0x4223 +#define SCID_RANGENAME 0x4224 +#define SCID_DBAREAS 0x4225 +#define SCID_PIVOT 0x4226 +#define SCID_CHARTS 0x4227 +#define SCID_NUMFORMAT 0x4228 +#define SCID_DOCOPTIONS 0x4229 +#define SCID_VIEWOPTIONS 0x422a +#define SCID_PRINTSETUP 0x422b +#define SCID_CHARSET 0x422c +#define SCID_NEWDOCUMENT 0x422d // ID for SC 3.0a +#define SCID_DDELINKS 0x422e +#define SCID_AREALINKS 0x422f +#define SCID_CONDFORMATS 0x4230 +#define SCID_VALIDATION 0x4231 +#define SCID_COLNAMERANGES 0x4232 +#define SCID_ROWNAMERANGES 0x4233 +#define SCID_DETOPLIST 0x4234 +#define SCID_CONSOLIDATA 0x4235 +#define SCID_CHANGETRACK 0x4236 +#define SCID_CHGVIEWSET 0x4237 +#define SCID_LINKUPMODE 0x4238 +#define SCID_DATAPILOT 0x4239 + +#define SCID_COLUMNS 0x4240 +#define SCID_COLROWFLAGS 0x4241 +#define SCID_TABOPTIONS 0x4242 +#define SCID_TABLINK 0x4243 + +#define SCID_COLDATA 0x4250 +#define SCID_COLNOTES 0x4251 +#define SCID_COLATTRIB 0x4252 + +#define SCID_DRAWPOOL 0x4260 +#define SCID_DRAWMODEL 0x4261 + + + +// file version +// if the high-byte is incremented, the document won't be opened by older SCs +#define SC_INITIAL_VERSION 0x0001 +#define SC_FORMULA_LCLVER 0x0002 // formula with local version no. +//-------------------------------- +#define SC_NEW_TOKEN_ARRAYS 0x0003 // new TokenArray format +#define SC_FORMULA_VALUES 0x0004 // values in formula cells +#define SC_FORMULA_VALUES2 0x0005 // values in formula cells +#define SC_DATABYTES 0x0006 // data bytes, small tables +#define SC_DATABYTES2 0x0007 // data bytes, small tables +#define SC_NUMFMT 0x0008 // number format of formula cell +#define SC_NEWIF 0x0009 // new coding of ocIf (komp.) +//-------------------------------- +#define SC_RELATIVE_REFS 0x0010 // relative references +#define SC_SUBTOTAL_FLAG 0x0011 // bSubTotal of formula cell +#define SC_COLROWNAME_RANGEPAIR 0x0012 // ColRowNameRanges as ScRangePair +//-------------------------------- +#define SC_31_EXPORT_VER 0x0012 // version for 3.1-export +//-------------------------------- since 4.0 +#define SC_32K_ROWS 0x0100 // 32000 rows - incompatibel +#define SC_FONTCHARSET 0x0101 // Font-CharSets have to be right +//-------------------------------- +#define SC_40_EXPORT_VER 0x0101 // version for 4.0-Export +//-------------------------------- since 5.0 +#define SC_RECALC_MODE_BITS 0x0201 // TokenArray RecalcMode +#define SC_MATRIX_DOUBLEREF 0x0202 // DoubleRef implicit intersection +#define SC_VERSION_EDITPOOL 0x0203 // EditCells with EditPool +#define SC_SUBTOTAL_BUGFIX 0x0204 // bSubTotal of formula cell (true) +//-------------------------------- since 5.2 +#define SC_CONVERT_RECALC_ON_LOAD 0x0205 // CONVERT function recalculated on each load +//-------------------------------- +#define SC_CURRENT_VERSION 0x0205 + + +// all above SC_31_EXPORT_VER has to be queried during saving, +// because 3.1-export writes this version number. + +// btw: 10 following 09 is not a counting error but an intentional gap, +// because it was not clear, how long the RelRefs development would take. :) + +class SvStream; + +// ----------------------------------------------------------------------- + + // Header with size specification for multiple objects + +class ScMultipleReadHeader +{ +private: + SvStream& rStream; + sal_uInt8* pBuf; + SvMemoryStream* pMemStream; + sal_uLong nEndPos; + sal_uLong nEntryEnd; + sal_uLong nTotalEnd; + +public: + ScMultipleReadHeader(SvStream& rNewStream); + ~ScMultipleReadHeader(); + + void StartEntry(); + void EndEntry(); + sal_uLong BytesLeft() const; +}; + +class ScMultipleWriteHeader +{ +private: + SvStream& rStream; + SvMemoryStream aMemStream; + sal_uLong nDataPos; + sal_uInt32 nDataSize; + sal_uLong nEntryStart; + +public: + ScMultipleWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault = 0); + ~ScMultipleWriteHeader(); + + void StartEntry(); + void EndEntry(); +}; + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/recursionhelper.hxx b/sc/inc/recursionhelper.hxx new file mode 100644 index 000000000000..dc44921d8840 --- /dev/null +++ b/sc/inc/recursionhelper.hxx @@ -0,0 +1,162 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef INCLUDED_RECURSIONHELPER_HXX +#define INCLUDED_RECURSIONHELPER_HXX + +#include "formularesult.hxx" + +#include <list> +#include <stack> +#include <tools/solar.h> + +class ScFormulaCell; + +struct ScFormulaRecursionEntry +{ + ScFormulaCell* pCell; + sal_Bool bOldRunning; + ScFormulaResult aPreviousResult; + ScFormulaRecursionEntry( ScFormulaCell* p, sal_Bool bR, + const ScFormulaResult & rRes ) : + pCell(p), bOldRunning(bR), aPreviousResult( rRes) + { + } +}; + +typedef ::std::list< ScFormulaRecursionEntry > ScFormulaRecursionList; + +class ScRecursionHelper +{ + typedef ::std::stack< ScFormulaCell* > ScRecursionInIterationStack; + ScFormulaRecursionList aRecursionFormulas; + ScFormulaRecursionList::iterator aInsertPos; + ScFormulaRecursionList::iterator aLastIterationStart; + ScRecursionInIterationStack aRecursionInIterationStack; + sal_uInt16 nRecursionCount; + sal_uInt16 nIteration; + bool bInRecursionReturn; + bool bDoingRecursion; + bool bInIterationReturn; + bool bConverging; + + void Init() + { + nRecursionCount = 0; + bInRecursionReturn = bDoingRecursion = bInIterationReturn = false; + aInsertPos = GetEnd(); + ResetIteration(); + } + void ResetIteration() + { + aLastIterationStart = GetEnd(); + nIteration = 0; + bConverging = false; + } + + public: + + ScRecursionHelper() { Init(); } + sal_uInt16 GetRecursionCount() const { return nRecursionCount; } + void IncRecursionCount() { ++nRecursionCount; } + void DecRecursionCount() { --nRecursionCount; } + /// A pure recursion return, no iteration. + bool IsInRecursionReturn() const { return bInRecursionReturn && + !bInIterationReturn; } + void SetInRecursionReturn( bool b ) + { + // Do not use IsInRecursionReturn() here, it decouples iteration. + if (b && !bInRecursionReturn) + aInsertPos = aRecursionFormulas.begin(); + bInRecursionReturn = b; + } + bool IsDoingRecursion() const { return bDoingRecursion; } + void SetDoingRecursion( bool b ) { bDoingRecursion = b; } + void Insert( ScFormulaCell* p, sal_Bool bOldRunning, + const ScFormulaResult & rRes ) + { + aRecursionFormulas.insert( aInsertPos, ScFormulaRecursionEntry( p, + bOldRunning, rRes)); + } + ScFormulaRecursionList::iterator GetStart() + { + return aRecursionFormulas.begin(); + } + ScFormulaRecursionList::iterator GetEnd() + { + return aRecursionFormulas.end(); + } + bool IsInIterationReturn() const { return bInIterationReturn; } + void SetInIterationReturn( bool b ) + { + // An iteration return is always coupled to a recursion return. + SetInRecursionReturn( b); + bInIterationReturn = b; + } + bool IsDoingIteration() const { return nIteration > 0; } + sal_uInt16 GetIteration() const { return nIteration; } + bool & GetConvergingReference() { return bConverging; } + void StartIteration() + { + SetInIterationReturn( false); + nIteration = 1; + bConverging = false; + aLastIterationStart = GetIterationStart(); + } + void ResumeIteration() + { + SetInIterationReturn( false); + aLastIterationStart = GetIterationStart(); + } + void IncIteration() { ++nIteration; } + void EndIteration() + { + aRecursionFormulas.erase( GetIterationStart(), GetIterationEnd()); + ResetIteration(); + } + ScFormulaRecursionList::iterator GetLastIterationStart() { return aLastIterationStart; } + ScFormulaRecursionList::iterator GetIterationStart() { return GetStart(); } + ScFormulaRecursionList::iterator GetIterationEnd() { return GetEnd(); } + /** Any return, recursion or iteration, iteration is always coupled with + recursion. */ + bool IsInReturn() const { return bInRecursionReturn; } + const ScFormulaRecursionList& GetList() const { return aRecursionFormulas; } + ScFormulaRecursionList& GetList() { return aRecursionFormulas; } + ScRecursionInIterationStack& GetRecursionInIterationStack() { return aRecursionInIterationStack; } + void Clear() + { + aRecursionFormulas.clear(); + while (!aRecursionInIterationStack.empty()) + aRecursionInIterationStack.pop(); + Init(); + } +}; + +#endif // INCLUDED_RECURSIONHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx new file mode 100644 index 000000000000..edaee012d7e3 --- /dev/null +++ b/sc/inc/refdata.hxx @@ -0,0 +1,216 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_REFDATA_HXX +#define SC_REFDATA_HXX + +#include "global.hxx" +#include "address.hxx" +#include "scdllapi.h" + + +// Ref-Flags for old (until release 3.1) documents + +struct OldSingleRefBools +{ + sal_uInt8 bRelCol; // Flag values (see further down), 2 bits each in file format + sal_uInt8 bRelRow; + sal_uInt8 bRelTab; + sal_uInt8 bOldFlag3D; // two sal_Bool flags (see further down) +}; + +#define SR_ABSOLUTE 0 // Absolute value +#define SR_RELABS 1 // Relative value as absolute value (until release 3.1) +#define SR_RELATIVE 2 // Relative value as delta value (after release 3.1) +#define SR_DELETED 3 // Deleted col/row/tab + +#define SRF_3D 0x01 // 3D reference, was the sal_Bool (before build 304a) +#define SRF_RELNAME 0x02 // Reference derived from RangeName with relative values +#define SRF_BITS 0x03 // Mask of possible bits + + +struct SC_DLLPUBLIC ScSingleRefData // Single reference (one address) into the sheet +{ + SCsCOL nCol; // Absolute values + SCsROW nRow; + SCsTAB nTab; + SCsCOL nRelCol; // Values relative to the position + SCsROW nRelRow; + SCsTAB nRelTab; + + union + { + sal_Bool bFlags; + struct + { + sal_Bool bColRel :1; + sal_Bool bColDeleted :1; + sal_Bool bRowRel :1; + sal_Bool bRowDeleted :1; + sal_Bool bTabRel :1; + sal_Bool bTabDeleted :1; + sal_Bool bFlag3D :1; // 3D-Ref + sal_Bool bRelName :1; // Reference derived from RangeName with relative values + }Flags; + }; + + // No default ctor, because used in ScRawToken union, set InitFlags! + inline void InitFlags() { bFlags = 0; } // all FALSE + // InitAddress: InitFlags and set address + inline void InitAddress( const ScAddress& rAdr ); + inline void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab ); + // InitAddressRel: InitFlags and set address, everything relative to rPos + inline void InitAddressRel( const ScAddress& rAdr, const ScAddress& rPos ); + inline void SetColRel( sal_Bool bVal ) { Flags.bColRel = (bVal ? sal_True : false ); } + inline sal_Bool IsColRel() const { return Flags.bColRel; } + inline void SetRowRel( sal_Bool bVal ) { Flags.bRowRel = (bVal ? sal_True : false ); } + inline sal_Bool IsRowRel() const { return Flags.bRowRel; } + inline void SetTabRel( sal_Bool bVal ) { Flags.bTabRel = (bVal ? sal_True : false ); } + inline sal_Bool IsTabRel() const { return Flags.bTabRel; } + + inline void SetColDeleted( sal_Bool bVal ) { Flags.bColDeleted = (bVal ? sal_True : false ); } + inline sal_Bool IsColDeleted() const { return Flags.bColDeleted; } + inline void SetRowDeleted( sal_Bool bVal ) { Flags.bRowDeleted = (bVal ? sal_True : false ); } + inline sal_Bool IsRowDeleted() const { return Flags.bRowDeleted; } + inline void SetTabDeleted( sal_Bool bVal ) { Flags.bTabDeleted = (bVal ? sal_True : false ); } + inline sal_Bool IsTabDeleted() const { return Flags.bTabDeleted; } + inline sal_Bool IsDeleted() const { return IsColDeleted() || IsRowDeleted() || IsTabDeleted(); } + + inline void SetFlag3D( sal_Bool bVal ) { Flags.bFlag3D = (bVal ? sal_True : false ); } + inline sal_Bool IsFlag3D() const { return Flags.bFlag3D; } + inline void SetRelName( sal_Bool bVal ) { Flags.bRelName = (bVal ? sal_True : false ); } + inline sal_Bool IsRelName() const { return Flags.bRelName; } + + inline sal_Bool Valid() const; + /// In external references nTab is -1 + inline bool ValidExternal() const; + + void SmartRelAbs( const ScAddress& rPos ); + void CalcRelFromAbs( const ScAddress& rPos ); + void CalcAbsIfRel( const ScAddress& rPos ); + sal_Bool operator==( const ScSingleRefData& ) const; + bool operator!=( const ScSingleRefData& ) const; +}; + +inline void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP ) +{ + InitFlags(); + nCol = nColP; + nRow = nRowP; + nTab = nTabP; +} + +inline void ScSingleRefData::InitAddress( const ScAddress& rAdr ) +{ + InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab()); +} + +inline void ScSingleRefData::InitAddressRel( const ScAddress& rAdr, + const ScAddress& rPos ) +{ + InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab()); + SetColRel( sal_True ); + SetRowRel( sal_True ); + SetTabRel( sal_True ); + CalcRelFromAbs( rPos ); +} + +inline sal_Bool ScSingleRefData::Valid() const +{ + return nCol >= 0 && nCol <= MAXCOL && + nRow >= 0 && nRow <= MAXROW && + nTab >= 0 && nTab <= MAXTAB; +} + +inline bool ScSingleRefData::ValidExternal() const +{ + return nCol >= 0 && nCol <= MAXCOL && + nRow >= 0 && nRow <= MAXROW && + nTab == -1; +} + + +struct ScComplexRefData // Complex reference (a range) into the sheet +{ + ScSingleRefData Ref1; + ScSingleRefData Ref2; + + inline void InitFlags() + { Ref1.InitFlags(); Ref2.InitFlags(); } + inline void InitRange( const ScRange& rRange ) + { + Ref1.InitAddress( rRange.aStart ); + Ref2.InitAddress( rRange.aEnd ); + } + inline void InitRangeRel( const ScRange& rRange, const ScAddress& rPos ) + { + Ref1.InitAddressRel( rRange.aStart, rPos ); + Ref2.InitAddressRel( rRange.aEnd, rPos ); + } + inline void InitRange( SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2 ) + { + Ref1.InitAddress( nCol1, nRow1, nTab1 ); + Ref2.InitAddress( nCol2, nRow2, nTab2 ); + } + inline void SmartRelAbs( const ScAddress& rPos ) + { Ref1.SmartRelAbs( rPos ); Ref2.SmartRelAbs( rPos ); } + inline void CalcRelFromAbs( const ScAddress& rPos ) + { Ref1.CalcRelFromAbs( rPos ); Ref2.CalcRelFromAbs( rPos ); } + inline void CalcAbsIfRel( const ScAddress& rPos ) + { Ref1.CalcAbsIfRel( rPos ); Ref2.CalcAbsIfRel( rPos ); } + inline sal_Bool IsDeleted() const + { return Ref1.IsDeleted() || Ref2.IsDeleted(); } + inline sal_Bool Valid() const + { return Ref1.Valid() && Ref2.Valid(); } + /** In external references nTab is -1 for the start tab and -1 for the end + tab if one sheet, or >=0 if more than one sheets. */ + inline bool ValidExternal() const; + + /// Absolute references have to be up-to-date when calling this! + void PutInOrder(); + inline sal_Bool operator==( const ScComplexRefData& r ) const + { return Ref1 == r.Ref1 && Ref2 == r.Ref2; } + /** Enlarge range if reference passed is not within existing range. + ScAddress position is used to calculate absolute references from + relative references. */ + ScComplexRefData& Extend( const ScSingleRefData & rRef, const ScAddress & rPos ); + ScComplexRefData& Extend( const ScComplexRefData & rRef, const ScAddress & rPos ); +}; + +inline bool ScComplexRefData::ValidExternal() const +{ + return Ref1.ValidExternal() && + Ref2.nCol >= 0 && Ref2.nCol <= MAXCOL && + Ref2.nRow >= 0 && Ref2.nRow <= MAXROW && + Ref2.nTab >= Ref1.nTab; +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx new file mode 100644 index 000000000000..63dcf12c65e8 --- /dev/null +++ b/sc/inc/reffind.hxx @@ -0,0 +1,69 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_REFFIND_HXX +#define SC_REFFIND_HXX + +#include <tools/string.hxx> +#include "address.hxx" + +class ScDocument; + +// ----------------------------------------------------------------------- + +class ScRefFinder +{ +private: + String aFormula; + formula::FormulaGrammar::AddressConvention eConv; + ScDocument* pDoc; + ScAddress maPos; + xub_StrLen nFound; + xub_StrLen nSelStart; + xub_StrLen nSelEnd; + +public: + ScRefFinder( const String& rFormula, const ScAddress& rPos, + ScDocument* pDocument = NULL, + formula::FormulaGrammar::AddressConvention eConvP = formula::FormulaGrammar::CONV_OOO ); + ~ScRefFinder(); + + const String& GetText() const { return aFormula; } + xub_StrLen GetFound() const { return nFound; } + xub_StrLen GetSelStart() const { return nSelStart; } + xub_StrLen GetSelEnd() const { return nSelEnd; } + + void ToggleRel( xub_StrLen nStartPos, xub_StrLen nEndPos ); +}; + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/refreshtimer.hxx b/sc/inc/refreshtimer.hxx new file mode 100644 index 000000000000..9ded9478731f --- /dev/null +++ b/sc/inc/refreshtimer.hxx @@ -0,0 +1,136 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_REFRESHTIMER_HXX +#define SC_REFRESHTIMER_HXX + +#include <vcl/timer.hxx> +#include <osl/mutex.hxx> +#include <scdllapi.h> + +class ScRefreshTimerControl +{ +private: + ::osl::Mutex aMutex; + sal_uInt16 nBlockRefresh; + +public: + ScRefreshTimerControl() : nBlockRefresh(0) {} + + void SetAllowRefresh( sal_Bool b ) + { + if ( b && nBlockRefresh ) + --nBlockRefresh; + else if ( !b && nBlockRefresh < (sal_uInt16)(~0) ) + ++nBlockRefresh; + } + + sal_Bool IsRefreshAllowed() const { return !nBlockRefresh; } + + ::osl::Mutex& GetMutex() { return aMutex; } +}; + +class ScRefreshTimerProtector +{ +private: + ScRefreshTimerControl * const * ppControl; + +public: + ScRefreshTimerProtector( ScRefreshTimerControl * const * pp ); + + ~ScRefreshTimerProtector() + { + if ( ppControl && *ppControl ) + (*ppControl)->SetAllowRefresh( true ); + } +}; + +class ScRefreshTimer : public AutoTimer +{ +private: + ScRefreshTimerControl * const * ppControl; + + void AppendToControl() {} + + void RemoveFromControl() {} + + void Start() + { + if ( GetTimeout() ) + AutoTimer::Start(); + } + +public: + ScRefreshTimer() : ppControl(0) { SetTimeout( 0 ); } + + ScRefreshTimer( sal_uLong nSeconds ) : ppControl(0) + { + SetTimeout( nSeconds * 1000 ); + Start(); + } + + ScRefreshTimer( const ScRefreshTimer& r ) : AutoTimer( r ), ppControl(0) {} + + virtual ~ScRefreshTimer(); + + ScRefreshTimer& operator=( const ScRefreshTimer& r ) + { + SetRefreshControl(0); + AutoTimer::operator=( r ); + return *this; + } + + sal_Bool operator==( const ScRefreshTimer& r ) const + { return GetTimeout() == r.GetTimeout(); } + + sal_Bool operator!=( const ScRefreshTimer& r ) const + { return !ScRefreshTimer::operator==( r ); } + + void StartRefreshTimer() { Start(); } + + void SetRefreshControl( ScRefreshTimerControl * const * pp ) + { + RemoveFromControl(); + ppControl = pp; + AppendToControl(); + } + + void SetRefreshHandler( const Link& rLink ) { SetTimeoutHdl( rLink ); } + + sal_uLong GetRefreshDelay() const { return GetTimeout() / 1000; } + + void StopRefreshTimer() { Stop(); } + + SC_DLLPUBLIC virtual void SetRefreshDelay( sal_uLong nSeconds ); + + SC_DLLPUBLIC virtual void Timeout(); +}; + +#endif // SC_REFRESHTIMER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/reftokenhelper.hxx b/sc/inc/reftokenhelper.hxx new file mode 100644 index 000000000000..36d28f156780 --- /dev/null +++ b/sc/inc/reftokenhelper.hxx @@ -0,0 +1,86 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_REFTOKENHELPER_HXX +#define SC_REFTOKENHELPER_HXX + +#include "token.hxx" + +#include <vector> + +namespace rtl { + class OUString; +} + +class ScDocument; +class ScRange; +class ScRangeList; + +class ScRefTokenHelper +{ +private: + ScRefTokenHelper(); + ScRefTokenHelper(const ScRefTokenHelper&); + ~ScRefTokenHelper(); + +public: + /** + * Compile an array of reference tokens from a data source range string. + * The source range may consist of multiple ranges separated by ';'s. + */ + static void compileRangeRepresentation( + ::std::vector<ScTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc, + ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH); + + static bool getRangeFromToken(ScRange& rRange, const ScTokenRef& pToken, bool bExternal = false); + + static void getRangeListFromTokens(ScRangeList& rRangeList, const ::std::vector<ScTokenRef>& pTokens); + + /** + * Create a double reference token from a range object. + */ + static void getTokenFromRange(ScTokenRef& pToken, const ScRange& rRange); + + static void getTokensFromRangeList(::std::vector<ScTokenRef>& pTokens, const ScRangeList& rRanges); + + static bool SC_DLLPUBLIC isRef(const ScTokenRef& pToken); + static bool SC_DLLPUBLIC isExternalRef(const ScTokenRef& pToken); + + static bool SC_DLLPUBLIC intersects(const ::std::vector<ScTokenRef>& rTokens, const ScTokenRef& pToken); + + static void SC_DLLPUBLIC join(::std::vector<ScTokenRef>& rTokens, const ScTokenRef& pToken); + + static bool getDoubleRefDataFromToken(ScComplexRefData& rData, const ScTokenRef& pToken); + + static ScTokenRef createRefToken(const ScAddress& rAddr); + static ScTokenRef createRefToken(const ScRange& rRange); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc new file mode 100644 index 000000000000..edf2eaeffec6 --- /dev/null +++ b/sc/inc/sc.hrc @@ -0,0 +1,1255 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#ifndef SC_SC_HRC +#define SC_SC_HRC + +#ifndef _SFX_HRC +#include <sfx2/sfx.hrc> // ->#include <solar.hrc> +#endif + +#ifndef _SVX_DIALOGS_HRC +#include <svx/dialogs.hrc> // ->Svx-IDs +#endif + +#include "sfx2/sfxcommands.h" +#include "svx/svxcommands.h" +#include "sccommands.h" +#include "helpids.h" + +#define VAR_ARGS 30 // variable Parameter in scfuncs.src + +#define RID_HANDLEBITMAP 10005 + +// areas + +#define SC_VIEW_START (SID_SC_START) +#define SC_VIEW_END (SID_SC_START + 99) +#define SC_MESSAGE_START (SID_SC_START + 100) +#define SC_MESSAGE_END (SID_SC_START + 199) +#define SC_FUNCTION_START (SID_SC_START + 200) +#define SC_FUNCTION_END (SID_SC_START + 299) +#define SC_PARAM_START (SID_SC_START + 300) +#define SC_PARAM_END (SID_SC_START + 399) + +// stay compatible to the past +#define SC_RESOURCE_START (RID_APP_START+5000) +#define SC_RESOURCE_END (RID_APP_END) + +// help IDs - +// calc has a range of 2000 IDs +// the functions need 11*90 = 990 IDs + +#define HID_SC_SHEET_START (HID_SC_START + 1010) +#define HID_SC_SHELL_START (HID_SC_START + 1030) + +// help IDs for templates +#define HID_SC_SHEET_CELL_STD (HID_SC_SHEET_START +0 ) +#define HID_SC_SHEET_CELL_ERG (HID_SC_SHEET_START +1 ) +#define HID_SC_SHEET_CELL_ERG1 (HID_SC_SHEET_START +2 ) +#define HID_SC_SHEET_CELL_UEB (HID_SC_SHEET_START +3 ) +#define HID_SC_SHEET_CELL_UEB1 (HID_SC_SHEET_START +4 ) +#define HID_SC_SHEET_PAGE_STD (HID_SC_SHEET_START +10 ) +#define HID_SC_SHEET_PAGE_REP (HID_SC_SHEET_START +11 ) + +// help IDs for shells (helper) (max. 20) +#define HID_SCSHELL_APP (HID_SC_SHELL_START +0 ) +#define HID_SCSHELL_DOCSH (HID_SC_SHELL_START +1 ) +#define HID_SCSHELL_DRAWSH (HID_SC_SHELL_START +2 ) +#define HID_SCSHELL_DRTXTOB (HID_SC_SHELL_START +3 ) +#define HID_SCSHELL_PIVOTSH (HID_SC_SHELL_START +4 ) +#define HID_SCSHELL_PREVWSH (HID_SC_SHELL_START +5 ) +#define HID_SCSHELL_TABVWSH (HID_SC_SHELL_START +6 ) +#define HID_SCSHELL_AUDIT (HID_SC_SHELL_START +7 ) +#define HID_SCSHELL_DRAWFORMSH (HID_SC_SHELL_START +8 ) +#define HID_SCSHELL_CELLSH (HID_SC_SHELL_START +9 ) +#define HID_SCSHELL_FORMATSH (HID_SC_SHELL_START +10) +#define HID_SCSHELL_OLEOBEJCTSH (HID_SC_SHELL_START +11) +#define HID_SCSHELL_CHARTSH (HID_SC_SHELL_START +12) +#define HID_SCSHELL_GRAPHIC (HID_SC_SHELL_START +13) +#define HID_SCSHELL_PAGEBREAK (HID_SC_SHELL_START +14) +#define HID_SCSHELL_MEDIA (HID_SC_SHELL_START +15) + + +// view-functions (max. 100) + +#define FID_TESTFUNC0 (SC_VIEW_START) +#define FID_TESTFUNC1 (SC_VIEW_START + 1) +#define FID_TESTFUNC2 (SC_VIEW_START + 2) +#define FID_TESTFUNC3 (SC_VIEW_START + 3) +#define FID_TESTFUNC4 (SC_VIEW_START + 4) +#define FID_TESTFUNC5 (SC_VIEW_START + 5) +#define FID_TESTFUNC6 (SC_VIEW_START + 6) +#define FID_TESTFUNC7 (SC_VIEW_START + 7) +#define FID_TESTFUNC8 (SC_VIEW_START + 8) +#define FID_TESTFUNC9 (SC_VIEW_START + 9) +#define FID_SCALESTATUS (SC_VIEW_START + 10) +#define FID_COLOR (SC_VIEW_START + 11) +#define SID_UPDATECHART (SC_VIEW_START + 13) +#define FID_MARKLEFT (SC_VIEW_START + 14) +#define FID_MARKRIGHT (SC_VIEW_START + 15) +#define FID_MARKUP (SC_VIEW_START + 16) +#define FID_MARKDOWN (SC_VIEW_START + 17) +#define FID_MARKPAGEUP (SC_VIEW_START + 18) +#define FID_MARKPAGEDOWN (SC_VIEW_START + 19) + +// slot-IDs for attributes + +#define SID_SCATTR_HOR_JUSTIFY (SC_VIEW_START + 30) // alignment-page +#define SID_SCATTR_VER_JUSTIFY (SC_VIEW_START + 31) +#define SID_SCATTR_MARGIN (SC_VIEW_START + 32) +#define SID_SCATTR_STACKED (SC_VIEW_START + 33) +#define SID_SCATTR_LINEBREAK (SC_VIEW_START + 35) +#define SID_SCATTR_PROTECTION (SC_VIEW_START + 36) // protection-page + +// other slot-IDs: + +#define SID_SCUSERLISTS (SC_VIEW_START + 37) // user defined lists +#define RES_TBX_DUMMY (SC_VIEW_START + 38) // dummy-item +#define SID_SCVIEWOPTIONS (SC_VIEW_START + 39) +#define SID_SCDOCOPTIONS (SC_VIEW_START + 40) + +// cursor movements as properties: + +#define SID_CURRENTCELL (SC_VIEW_START + 41) +#define SID_CURRENTTAB (SC_VIEW_START + 42) +#define SID_CURRENTDOC (SC_VIEW_START + 43) +#define SID_CURRENTOBJECT (SC_VIEW_START + 44) + +// slot-IDs for special toolbox functions: + +#define SID_NUMBER_CURRENCY (SC_VIEW_START + 45) +#define SID_NUMBER_PERCENT (SC_VIEW_START + 46) + +// "slot" IDs for input images: +#define SID_INPUT_FUNCTION (SC_VIEW_START + 47) +#define SID_INPUT_SUM (SC_VIEW_START + 48) +#define SID_INPUT_EQUAL (SC_VIEW_START + 49) +#define SID_INPUT_CANCEL (SC_VIEW_START + 50) +#define SID_INPUT_OK (SC_VIEW_START + 51) + +#define SID_NUMBER_STANDARD (SC_VIEW_START + 52) +#define SID_NUMBER_DATE (SC_VIEW_START + 53) +#define SID_NUMBER_TWODEC (SC_VIEW_START + 54) +#define SID_NUMBER_SCIENTIFIC (SC_VIEW_START + 55) +#define SID_NUMBER_TIME (SC_VIEW_START + 56) +#define SID_NUMBER_INCDEC (SC_VIEW_START + 57) +#define SID_NUMBER_DECDEC (SC_VIEW_START + 58) + +// misc: +#define SID_LINKS (SC_VIEW_START + 60) +#define SID_INSERT_SIMAGE (SC_VIEW_START + 61) +#define SID_INSERT_SCHART (SC_VIEW_START + 62) +#define SID_INSERT_SMATH (SC_VIEW_START + 63) +#define SID_STANDARD_FONTS (SC_VIEW_START + 64) +#define SID_MIRROR_VERTICAL (SC_VIEW_START + 65) +#define SID_MIRROR_HORIZONTAL (SC_VIEW_START + 66) +#define SID_CELL_FORMAT_RESET (SC_VIEW_START + 67) +#define SID_SCPRINTOPTIONS (SC_VIEW_START + 68) +#define SID_WINDOW_SPLIT (SC_VIEW_START + 69) +#define SID_WINDOW_FIX (SC_VIEW_START + 70) +#ifdef SID_DRAW_CHART +#undef SID_DRAW_CHART +#endif +#define SID_DRAW_CHART (SC_VIEW_START + 71) +#define SID_UPDATETABLINKS (SC_VIEW_START + 72) + +// TabPage entry +#define SID_SC_INPUT_SELECTION (SC_VIEW_START + 73) +#define SID_SC_INPUT_SELECTIONPOS (SC_VIEW_START + 74) +#define SID_SC_INPUT_EDITMODE (SC_VIEW_START + 75) +#define SID_SC_INPUT_FMT_EXPAND (SC_VIEW_START + 76) +#define SID_SC_INPUT_RANGEFINDER (SC_VIEW_START + 77) +#define SID_SC_INPUT_REF_EXPAND (SC_VIEW_START + 78) +#define SID_SC_INPUT_MARK_HEADER (SC_VIEW_START + 79) + +#define SID_REIMPORT_AFTER_LOAD (SC_VIEW_START + 80) +#define SID_DRAW_NOTEEDIT (SC_VIEW_START + 81) + +#define SID_CHOOSE_DESIGN (SC_VIEW_START + 82) +#define SID_EURO_CONVERTER (SC_VIEW_START + 83) +#define SID_EXTERNAL_SOURCE (SC_VIEW_START + 85) + +#define SID_SC_INPUT_TEXTWYSIWYG (SC_VIEW_START + 86) + +#define SID_ENABLE_HYPHENATION (SC_VIEW_START + 87) + +#define SID_RENAME_OBJECT (SC_VIEW_START + 88) +#define SID_FOCUS_INPUTLINE (SC_VIEW_START + 89) +#define SID_SELECT_TABLES (SC_VIEW_START + 90) + +// new entry "Filter..." in DP popup menu +#define SID_DP_FILTER (SC_VIEW_START + 91) + +// replace cell contents warning +#define SID_SC_INPUT_REPLCELLSWARN (SC_VIEW_START + 92) + +// additional IDs for list/range validity +#define FID_VALID_LISTTYPE (SC_VIEW_START + 93) + +// #i68101# ID for changing title & description of an object +#define SID_TITLE_DESCRIPTION_OBJECT (SC_VIEW_START + 94) + +// #i59082# assign macro to shape +#define SID_ASSIGNMACRO (SC_VIEW_START + 95) + +// #i66550# hyperlinks in shapes +#define SID_DRAW_HLINK_EDIT (SC_VIEW_START + 96) +#define SID_DRAW_HLINK_DELETE (SC_VIEW_START + 97) + +// "Zoom / Synchronize sheets" in options dialog +#define SID_SC_OPT_SYNCZOOM (SC_VIEW_START + 98) + +// NOTE: last valid ID is (SC_VIEW_START + 99) + +// messages + +#define FID_INPUTLINE_STATUS (SC_MESSAGE_START) +#define FID_INPUTLINE_ENTER (SC_MESSAGE_START + 1) +#define FID_REPAINT (SC_MESSAGE_START + 2) +#define FID_DATACHANGED (SC_MESSAGE_START + 3) +#define FID_REFMODECHANGED (SC_MESSAGE_START + 4) +#define FID_KILLEDITVIEW (SC_MESSAGE_START + 5) +#define SID_SOLVE (SC_MESSAGE_START + 6) +#define FID_FONT_SELECTED (SC_MESSAGE_START + 7) +#define FID_FILTER_OK (SC_MESSAGE_START + 8) +#define SC_HINT_DRWLAYER_NEW (SC_MESSAGE_START + 9) +#define SID_TABDELETED (SC_MESSAGE_START + 10) +#define FID_INPUTLINE_MATRIX (SC_MESSAGE_START + 11) +#define SID_DLG_RETOK (SC_MESSAGE_START + 12) +#define FID_ANYDATACHANGED (SC_MESSAGE_START + 13) +#define SID_STATUS_DOCPOS (SC_MESSAGE_START + 14) +#define SID_STATUS_PAGESTYLE (SC_MESSAGE_START + 15) +#define SID_STATUS_SELMODE (SC_MESSAGE_START + 16) +#define FID_KILLEDITVIEW_NOPAINT (SC_MESSAGE_START + 17) +#define SID_DLG_MATRIX (SC_MESSAGE_START + 18) +#define SC_HINT_DBAREAS_CHANGED (SC_MESSAGE_START + 19) +#define SC_HINT_AREAS_CHANGED (SC_MESSAGE_START + 20) +#define SC_HINT_TABLES_CHANGED (SC_MESSAGE_START + 21) + +#define SID_STATUS_SELMODE_ERG (SC_MESSAGE_START + 22) +#define SID_STATUS_SELMODE_ERW (SC_MESSAGE_START + 23) +#define SID_STATUS_SELMODE_NORM (SC_MESSAGE_START + 24) + +#define SID_CHART_SOURCE (SC_MESSAGE_START + 25) +#define SID_CHART_NAME (SC_MESSAGE_START + 26) +#define SID_CHART_ADDSOURCE (SC_MESSAGE_START + 27) + +#define SID_AUTO_STYLE (SC_MESSAGE_START + 28) + +#define FID_INPUTLINE_BLOCK (SC_MESSAGE_START + 29) + +#define SID_STATUS_SUM (SC_MESSAGE_START + 30) + +#define SC_HINT_DRAW_CHANGED (SC_MESSAGE_START + 31) +#define SC_HINT_DOCNAME_CHANGED (SC_MESSAGE_START + 32) +#define SC_HINT_AREALINKS_CHANGED (SC_MESSAGE_START + 33) +#define SC_HINT_SHOWRANGEFINDER (SC_MESSAGE_START + 34) +#define SC_HINT_DOC_SAVED (SC_MESSAGE_START + 35) +#define SC_HINT_FORCESETTAB (SC_MESSAGE_START + 36) + +// messages for opening dialogs: +#define SID_OPENDLG_CONSOLIDATE (SC_MESSAGE_START + 50) +#define SID_OPENDLG_PIVOTTABLE (SC_MESSAGE_START + 51) +#define SID_OPENDLG_FUNCTION (SC_MESSAGE_START + 52) +#define SID_OPENDLG_SOLVE (SC_MESSAGE_START + 53) +#define SID_OPENDLG_TABOP (SC_MESSAGE_START + 54) +#define SID_OPENDLG_EDITFUNCTION (SC_MESSAGE_START + 56) +#define SID_OPENDLG_ARGUMENT (SC_MESSAGE_START + 57) +#define SID_OPENDLG_CONDFRMT (SC_MESSAGE_START + 59) +#define SID_OPENDLG_OPTSOLVER (SC_MESSAGE_START + 60) +#define SID_VALIDITY_REFERENCE (SC_MESSAGE_START + 61) +#define SC_HINT_NAVIGATOR_UPDATEALL (SC_MESSAGE_START + 65) + +// functions + + +#define FID_DOC_MANAGER (SC_FUNCTION_START + 1) +#define FID_CURSOR_ENTER (SC_FUNCTION_START + 2) +#define SID_MAIL (SC_FUNCTION_START + 3) +#define FILE_MENU_END (SC_FUNCTION_START + 20) + +#define EDIT_MENU_START (FILE_MENU_END) +#define FID_DELETE_CELLCONTENTS (EDIT_MENU_START + 1) +#define FID_DELETE_CELL (EDIT_MENU_START + 2) +#define FID_DELETE_TABLE (EDIT_MENU_START + 3) +#define FID_FILL_TO_BOTTOM (EDIT_MENU_START + 4) +#define FID_FILL_TO_RIGHT (EDIT_MENU_START + 5) +#define FID_FILL_TO_TOP (EDIT_MENU_START + 6) +#define FID_FILL_TO_LEFT (EDIT_MENU_START + 7) +#define FID_FILL_TAB (EDIT_MENU_START + 8) +#define FID_FILL_SERIES (EDIT_MENU_START + 9) +#define FID_SEARCH_REPLACE_DLG (EDIT_MENU_START + 10) +#define FID_EDIT_OBJECT (EDIT_MENU_START + 11) +#define SID_SC_NAVIGATOR (EDIT_MENU_START + 12) +#define SID_SC_WIZARD (EDIT_MENU_START + 13) +#define SID_SC_EDIT_OBJECT (EDIT_MENU_START + 14) +#define SID_HFEDIT (EDIT_MENU_START + 15) + +#define SID_DEL_ROWS (EDIT_MENU_START + 16)//JN +#define SID_DEL_COLS (EDIT_MENU_START + 17)//JN + +#define FID_CHG_SHOW (EDIT_MENU_START + 19) + +#define EDIT_MENU_END (EDIT_MENU_START + 20) +#define VIEW_MENU_START (EDIT_MENU_END) + +#define FID_TOGGLEOBJECT (VIEW_MENU_START) +#define FID_TOGGLEINPUTLINE (VIEW_MENU_START + 1) +#define FID_TOGGLEHEADERS (VIEW_MENU_START + 2) +#define FID_SCALE (VIEW_MENU_START + 4) +#define FID_TOGGLESYNTAX (VIEW_MENU_START + 5) +#define FID_SCREEN_OPTIONS (VIEW_MENU_START + 6) +#define FID_PAGEBREAKMODE (VIEW_MENU_START + 7) +#define FID_FUNCTION_BOX (VIEW_MENU_START + 8) +#define FID_NORMALVIEWMODE (VIEW_MENU_START + 9) +#define FID_TOGGLEFORMULA (VIEW_MENU_START + 10) + +#define FID_CHG_ACCEPT (VIEW_MENU_START + 18)// DANGER DIRTY ID +#define FID_CHG_COMMENT (VIEW_MENU_START + 19)// DANGER DIRTY ID +#define VIEW_MENU_END (VIEW_MENU_START + 20) + +#define INSERT_MENU_START (VIEW_MENU_END) +#define FID_PAGEBREAK (INSERT_MENU_START) +#define FID_INS_ROWBRK (INSERT_MENU_START + 1) +#define FID_INS_COLBRK (INSERT_MENU_START + 2) +#define FID_DEL_ROWBRK (INSERT_MENU_START + 3) +#define FID_DEL_COLBRK (INSERT_MENU_START + 4) +#define FID_INS_CELL_CONTENTS (INSERT_MENU_START + 5) +#define FID_INS_CELL (INSERT_MENU_START + 6) +#define FID_INS_ROW (INSERT_MENU_START + 7) +#define FID_INS_COLUMN (INSERT_MENU_START + 8) +#define FID_INS_TABLE (INSERT_MENU_START + 9) +#define SID_INS_FUNCTION (INSERT_MENU_START + 10) +#define FID_DEFINE_NAME (INSERT_MENU_START + 11) +#define FID_INSERT_NAME (INSERT_MENU_START + 12) +#define FID_USE_NAME (INSERT_MENU_START + 13) +#define FID_APPLY_NAME (INSERT_MENU_START + 14) +#define FID_INS_TABLE_EXT (INSERT_MENU_START + 15) +#define SID_INSERT_CLIPART (INSERT_MENU_START + 17) //!!! should come from Svx +#define FID_INS_CELLSDOWN (INSERT_MENU_START + 18) +#define FID_INS_CELLSRIGHT (INSERT_MENU_START + 19) +#define INSERT_MENU_END (INSERT_MENU_START + 20) + +#define FORMAT_MENU_START (INSERT_MENU_END) +#define FID_CELL_FORMAT (FORMAT_MENU_START) +#define FID_ROW_HEIGHT (FORMAT_MENU_START + 1) +#define FID_ROW_OPT_HEIGHT (FORMAT_MENU_START + 2) +#define FID_ROW_HIDE (FORMAT_MENU_START + 3) +#define FID_ROW_SHOW (FORMAT_MENU_START + 4) +#define FID_COL_WIDTH (FORMAT_MENU_START + 5) +#define FID_COL_OPT_WIDTH (FORMAT_MENU_START + 6) +#define FID_COL_HIDE (FORMAT_MENU_START + 7) +#define FID_COL_SHOW (FORMAT_MENU_START + 8) +#define FID_TABLE_HIDE (FORMAT_MENU_START + 9) +#define FID_TABLE_SHOW (FORMAT_MENU_START + 10) +#define FID_CONDITIONAL_FORMAT (FORMAT_MENU_START + 11) +#define SID_SCSTYLES (FORMAT_MENU_START + 12) +#define FID_MERGE_ON (FORMAT_MENU_START + 13) +#define FID_MERGE_OFF (FORMAT_MENU_START + 14) +#define SID_FORMATPAGE (FORMAT_MENU_START + 15) +#define SID_TEXT_STANDARD (FORMAT_MENU_START + 16) +#define SID_DRAWTEXT_ATTR_DLG (FORMAT_MENU_START + 17) +#define FID_TABLE_VISIBLE (FORMAT_MENU_START + 18) +#define FID_COL_OPT_DIRECT (FORMAT_MENU_START + 19) +#define FORMAT_MENU_END (FORMAT_MENU_START + 20) + +#define EXTRA_MENU_START (FORMAT_MENU_END) +#define FID_VOICE_CONTROL (EXTRA_MENU_START + 1) +#define SID_RECALC_TITLE (EXTRA_MENU_START + 2) +#define FID_AUTO_CALC (EXTRA_MENU_START + 3) +#define FID_RECALC (EXTRA_MENU_START + 4) +#define FID_UPDATE_DIAGRAMS (EXTRA_MENU_START + 5) +#define FID_PROTECT_TABLE (EXTRA_MENU_START + 6) +#define FID_PROTECT_DOC (EXTRA_MENU_START + 7) +#define SID_EDIT_MACRO (EXTRA_MENU_START + 8) +#define SID_SCOPTIONS (EXTRA_MENU_START + 9) +#define SID_MACRO_CHOOSER (EXTRA_MENU_START + 10) +#define SID_SHARE_DOC (EXTRA_MENU_START + 11) +#define SID_SCENARIOS (EXTRA_MENU_START + 12) +#define SID_ADD_IN_MANAGER (EXTRA_MENU_START + 13) +#define SID_PIVOT_RECALC (EXTRA_MENU_START + 14) +#define SID_PIVOT_KILL (EXTRA_MENU_START + 15) + +// wrong here, but better than nothing +#define SID_SC_HELP_PI (EXTRA_MENU_START + 16) +#define SID_SC_SHOW_KEYBOARD_HELP (EXTRA_MENU_START + 17) + +#define FID_HARD_RECALC (EXTRA_MENU_START + 18) +#define FID_AUTOCOMPLETE (EXTRA_MENU_START + 19) + +#define EXTRA_MENU_END (EXTRA_MENU_START + 20) + +#define DATA_MENU_START (EXTRA_MENU_END) +#define SID_DEFINE_DBNAME (DATA_MENU_START) +#define SID_SELECT_DB (DATA_MENU_START + 1) +#define SID_SORT (DATA_MENU_START + 2) +#define SID_FILTER (DATA_MENU_START + 3) +#define SID_SPECIAL_FILTER (DATA_MENU_START + 4) +#define SID_AUTO_FILTER (DATA_MENU_START + 5) +#define SID_UNFILTER (DATA_MENU_START + 6) +#define SID_QUERY (DATA_MENU_START + 7) +#define SID_SUBTOTALS (DATA_MENU_START + 8) +#define SID_AUTO_OUTLINE (DATA_MENU_START + 13) +#define SID_IMPORT_DATA (DATA_MENU_START + 15) +#define SID_REIMPORT_DATA (DATA_MENU_START + 16) +#define SID_PIVOT_TABLE (DATA_MENU_START + 17) +#define SID_TABOP (DATA_MENU_START + 18) +#define SID_TEXT_TO_COLUMNS (DATA_MENU_START + 19) +#define SID_CONSOLIDATE (DATA_MENU_START + 20) +#define SID_AUTOFILTER_HIDE (DATA_MENU_START + 21) + +#define SID_SBA_IMPORT (DATA_MENU_START + 22) + +#define SID_SORT_DESCENDING (DATA_MENU_START + 23) +#define SID_SORT_ASCENDING (DATA_MENU_START + 24) + +#define DATA_MENU_END (DATA_MENU_START + 25) + +#define TAB_POPUP_START (DATA_MENU_END) +#define RID_POPUP_TAB (TAB_POPUP_START) +#define FID_TAB_MENU_RENAME (TAB_POPUP_START+1) +#define FID_TAB_RENAME (TAB_POPUP_START+2) +#define FID_TAB_MOVE (TAB_POPUP_START+3) +#define FID_TAB_SELECTALL (TAB_POPUP_START+4) +#define FID_TAB_APPEND (TAB_POPUP_START+5) +#define FID_TAB_INDEX (TAB_POPUP_START+6) +#define FID_TAB_RTL (TAB_POPUP_START+7) +#define FID_TAB_DESELECTALL (TAB_POPUP_START+8) +#define FID_TAB_MENU_SET_TAB_BG_COLOR (TAB_POPUP_START + 9) +#define FID_TAB_SET_TAB_BG_COLOR (TAB_POPUP_START + 10) +#define FID_TAB_EVENTS (TAB_POPUP_START+11) + +#define TAB_POPUP_END (TAB_POPUP_START + 20) + +#define OBJBAR_FORMAT_START (TAB_POPUP_END) +#define SID_ALIGNLEFT (OBJBAR_FORMAT_START+6) +#define SID_ALIGNRIGHT (OBJBAR_FORMAT_START+7) +#define SID_ALIGNCENTERHOR (OBJBAR_FORMAT_START+8) +#define SID_ALIGNBLOCK (OBJBAR_FORMAT_START+9) +#define SID_ALIGNTOP (OBJBAR_FORMAT_START+10) +#define SID_ALIGNBOTTOM (OBJBAR_FORMAT_START+11) +#define SID_ALIGNCENTERVER (OBJBAR_FORMAT_START+12) +#define SID_SELECT_SCENARIO (OBJBAR_FORMAT_START+13) + +#define SID_V_ALIGNCELL (OBJBAR_FORMAT_START+14) +#define SID_H_ALIGNCELL (OBJBAR_FORMAT_START+15) + +#define OBJBAR_FORMAT_END (OBJBAR_FORMAT_START+20) + +#define RID_INPUTBAR_START (OBJBAR_FORMAT_END) +#define SID_INPUT_WINDOW (RID_INPUTBAR_START) +#define RID_INPUTBAR_END (RID_INPUTBAR_START+1) + +#define DRAW_BAR_START (RID_INPUTBAR_END) +#define SID_DRAWTOABOVE (DRAW_BAR_START+15) +#define SID_DRAWTOBELOW (DRAW_BAR_START+16) +#define SID_FRAMETOTOP (DRAW_BAR_START+19) +#define SID_FRAMETOBOTTOM (DRAW_BAR_START+20) +#define SID_TOOL_TEXT (DRAW_BAR_START+23) +#define SID_ANCHOR_PAGE (DRAW_BAR_START+24) +#define SID_ANCHOR_CELL (DRAW_BAR_START+25) +#define SID_ANCHOR_TOGGLE (DRAW_BAR_START+26) +#define SID_ORIGINALSIZE (DRAW_BAR_START+27) + +#define DRAW_BAR_END (DRAW_BAR_START+50) + +#define DRAWTEXTBAR_START (DRAW_BAR_END) +#define SID_TEXT_LINESPACING_1 (DRAWTEXTBAR_START) +#define SID_TEXT_LINESPACING_2 (DRAWTEXTBAR_START+1) +#define SID_TEXT_LINESPACING_3 (DRAWTEXTBAR_START+2) +#define DRAWTEXTBAR_END (DRAWTEXTBAR_START+20) + +#define DETECTIVE_START (DRAWTEXTBAR_END) +#define SID_DETECTIVE_ADD_PRED (DETECTIVE_START) +#define SID_DETECTIVE_DEL_PRED (DETECTIVE_START+1) +#define SID_DETECTIVE_ADD_SUCC (DETECTIVE_START+2) +#define SID_DETECTIVE_DEL_SUCC (DETECTIVE_START+3) +#define SID_DETECTIVE_ADD_ERR (DETECTIVE_START+4) +#define SID_DETECTIVE_DEL_ALL (DETECTIVE_START+5) + +#define SID_DETECTIVE_FILLMODE (DETECTIVE_START+6) +#define SID_FILL_ADD_PRED (DETECTIVE_START+7) +#define SID_FILL_DEL_PRED (DETECTIVE_START+8) +#define SID_FILL_ADD_SUCC (DETECTIVE_START+9) +#define SID_FILL_DEL_SUCC (DETECTIVE_START+10) +#define SID_FILL_NONE (DETECTIVE_START+11) +#define SID_FILL_SELECT (DETECTIVE_START+12) + +#define SID_DETECTIVE_INVALID (DETECTIVE_START+13) + +#define SID_DETECTIVE_REFRESH (DETECTIVE_START+14) +#define SID_DETECTIVE_AUTO (DETECTIVE_START+15) + +#define SID_DETECTIVE_MARK_PRED (DETECTIVE_START+16) +#define SID_DETECTIVE_MARK_SUCC (DETECTIVE_START+17) + +#define DETECTIVE_END (DETECTIVE_START+20) + +#define SID_API_SLOTS (DETECTIVE_END) +#define SID_INSERT_MATRIX (SID_API_SLOTS+1) + +#define SID_DELETE_NOTE (SID_API_SLOTS+2) + + +#define SID_PREVIEW_START (SID_API_SLOTS+20) +#define SID_PREVIEW_NEXT (SID_PREVIEW_START) +#define SID_PREVIEW_PREVIOUS (SID_PREVIEW_START+1) +#define SID_PREVIEW_FIRST (SID_PREVIEW_START+2) +#define SID_PREVIEW_LAST (SID_PREVIEW_START+3) +#define SID_PREVIEW_GOTO (SID_PREVIEW_START+4) +#define SID_PREVIEW_ZOOMIN (SID_PREVIEW_START+5) +#define SID_PREVIEW_ZOOMOUT (SID_PREVIEW_START+6) +#define SID_PREVIEW_CLOSE (SID_PREVIEW_START+7) +#define SID_PREVIEW_MARGIN (SID_PREVIEW_START+8) +#define SID_PREVIEW_SCALINGFACTOR (SID_PREVIEW_START+9) +#define SID_PREVIEW_END (SID_PREVIEW_START+20) + +//from sfx: #define SID_KEYFUNC_START (SID_PREVIEW_END+5) +#define SID_CURSORDOWN_SEL (SID_KEYFUNC_START + 0) +#define SID_CURSORUP_SEL (SID_KEYFUNC_START + 1) +#define SID_CURSORLEFT_SEL (SID_KEYFUNC_START + 2) +#define SID_CURSORRIGHT_SEL (SID_KEYFUNC_START + 3) +#define SID_CURSORPAGEDOWN_SEL (SID_KEYFUNC_START + 4) +#define SID_CURSORPAGEUP_SEL (SID_KEYFUNC_START + 5) + +#define SID_CURSORPAGELEFT_ (SID_KEYFUNC_START + 6) +#define SID_CURSORPAGELEFT_SEL (SID_KEYFUNC_START + 7) +#define SID_CURSORPAGERIGHT_ (SID_KEYFUNC_START + 8) +#define SID_CURSORPAGERIGHT_SEL (SID_KEYFUNC_START + 9) + +#define SID_CURSORTOPOFFILE_SEL (SID_KEYFUNC_START + 10) +#define SID_CURSORENDOFFILE_SEL (SID_KEYFUNC_START + 11) +#define SID_CURSORHOME_SEL (SID_KEYFUNC_START + 12) +#define SID_CURSOREND_SEL (SID_KEYFUNC_START + 13) +#define SID_CURSORBLKUP (SID_KEYFUNC_START + 14) +#define SID_CURSORBLKDOWN (SID_KEYFUNC_START + 15) +#define SID_CURSORBLKLEFT (SID_KEYFUNC_START + 16) +#define SID_CURSORBLKRIGHT (SID_KEYFUNC_START + 17) +#define SID_CURSORBLKUP_SEL (SID_KEYFUNC_START + 18) +#define SID_CURSORBLKDOWN_SEL (SID_KEYFUNC_START + 19) +#define SID_CURSORBLKLEFT_SEL (SID_KEYFUNC_START + 20) +#define SID_CURSORBLKRIGHT_SEL (SID_KEYFUNC_START + 21) + +#define SID_NEXT_TABLE (SID_KEYFUNC_START + 22) +#define SID_PREV_TABLE (SID_KEYFUNC_START + 23) + +#define SID_NEXT_UNPROTECT (SID_KEYFUNC_START + 24) +#define SID_PREV_UNPROTECT (SID_KEYFUNC_START + 25) + +#define SID_SELECT_COL (SID_KEYFUNC_START + 26) +#define SID_SELECT_ROW (SID_KEYFUNC_START + 27) +#define SID_SELECT_NONE (SID_KEYFUNC_START + 28) +#define SID_ALIGNCURSOR (SID_KEYFUNC_START + 29) +#define SID_MARKDATAAREA (SID_KEYFUNC_START + 30) +#define SID_SETINPUTMODE (SID_KEYFUNC_START + 31) +#define SID_DELETE_CONTENTS (SID_KEYFUNC_START + 32) + +#define SID_MARKAREA (SID_KEYFUNC_START + 33) + +#define SID_AUTOFILL (SID_KEYFUNC_START + 34) +#define FID_FILL_AUTO (SID_KEYFUNC_START + 35) +#define SID_CANCEL (SID_KEYFUNC_START + 36) + +#define SID_CURSORENTERUP (SID_KEYFUNC_START + 37) +#define SID_CURSORENTERDOWN (SID_KEYFUNC_START + 38) + +#define SID_MARKARRAYFORMULA (SID_KEYFUNC_START + 39) + +#define SID_NEXT_TABLE_SEL (SID_KEYFUNC_START + 40) +#define SID_PREV_TABLE_SEL (SID_KEYFUNC_START + 41) + +#define SID_KEYFUNC_END (SID_KEYFUNC_START + 50) + +#define SID_NEW_SLOTS (SID_KEYFUNC_END) +#define SID_NEW_SLOTS_END (SID_NEW_SLOTS+100) + +#define SID_NEW_TABLENAME (SID_NEW_SLOTS+1) +#define SID_COL_START (SID_NEW_SLOTS+2) +#define SID_ROW_START (SID_NEW_SLOTS+3) +#define SID_COL_END (SID_NEW_SLOTS+4) +#define SID_ROW_END (SID_NEW_SLOTS+5) +#define SID_KEEP_MARK (SID_NEW_SLOTS+6) +#define SID_FILL_DIR (SID_NEW_SLOTS+7) +#define SID_FILL_COUNT (SID_NEW_SLOTS+8) +#define SID_WITH_UNDO (SID_NEW_SLOTS+9) +#define FID_MERGE_TOGGLE (SID_NEW_SLOTS+10) +#define SID_ATTR_ROWHEADERS (SID_NEW_SLOTS+11) +#define SID_ATTR_COLHEADERS (SID_NEW_SLOTS+12) + +#define SID_SC_CELLS (SID_NEW_SLOTS+13) +#define SID_SC_RANGE (SID_NEW_SLOTS+14) +#define SID_SC_SELECTION (SID_NEW_SLOTS+15) +#define SID_SC_CELLTEXT (SID_NEW_SLOTS+16) + +#define SID_SC_NAME_TITLE (SID_NEW_SLOTS+17) + +#define SID_SC_ACTIVECELL (SID_NEW_SLOTS+18) +#define SID_SC_ACTIVETAB (SID_NEW_SLOTS+19) +#define SID_RANGE_ROW (SID_NEW_SLOTS+20) +#define SID_RANGE_COL (SID_NEW_SLOTS+21) +#define SID_RANGE_TABLE (SID_NEW_SLOTS+22) +#define SID_RANGE_VALUE (SID_NEW_SLOTS+23) +#define SID_RANGE_FORMULA (SID_NEW_SLOTS+24) +#define SID_RANGE_TEXT (SID_NEW_SLOTS+25) +#define SID_RANGE_TEXTVALUE (SID_NEW_SLOTS+26) +#define SID_TABLE_ACTIVATE (SID_NEW_SLOTS+27) +#define SID_TABLES_GET (SID_NEW_SLOTS+28) +#define SID_PROP_INTERIOR (SID_NEW_SLOTS+29) +#define SID_PROP_FONT (SID_NEW_SLOTS+30) + +#define SID_DEFINE_PRINTAREA (SID_NEW_SLOTS+31) +#define SID_DELETE_PRINTAREA (SID_NEW_SLOTS+32) +#define SID_CHANGE_PRINTAREA (SID_NEW_SLOTS+33) +#define SID_OPENDLG_EDIT_PRINTAREA (SID_NEW_SLOTS+34) + +#define SID_OLE_OBJECT (SID_NEW_SLOTS+35) +#define SID_OLE_ACTIVATE (SID_NEW_SLOTS+36) +#define SID_OLE_DEACTIVATE (SID_NEW_SLOTS+37) + +#define SID_TOGGLE_REL (SID_NEW_SLOTS+38) +#define SID_DATA_SELECT (SID_NEW_SLOTS+39) + +// search & replace +#define FID_SEARCH (SID_NEW_SLOTS+40) +#define FID_REPEAT_SEARCH (SID_NEW_SLOTS+41) +#define FID_REPLACE (SID_NEW_SLOTS+42) +#define FID_SEARCH_ALL (SID_NEW_SLOTS+43) +#define FID_REPLACE_ALL (SID_NEW_SLOTS+44) +#define FID_SEARCH_COUNT (SID_NEW_SLOTS+45) + +#define SID_SC_SETTEXT (SID_NEW_SLOTS+46) +#define SID_RANGE_ADDRESS (SID_NEW_SLOTS+47) +#define SID_RANGE_OFFSET (SID_NEW_SLOTS+48) +#define SID_NUMBER_FORMAT (SID_NEW_SLOTS+49) + +#define SID_OLE_SELECT (SID_NEW_SLOTS+50) +#define SID_SC_ACTIVEOBJECT (SID_NEW_SLOTS+51) + +#define SID_RANGE_NOTETEXT (SID_NEW_SLOTS+52) +#define FID_INSERT_FILE (SID_NEW_SLOTS+53) + +#define FID_VALIDATION (SID_NEW_SLOTS+54) + +// slots for toolbox controller in toolbar +#define SID_TBXCTL_INSERT (SID_NEW_SLOTS+55) +#define SID_TBXCTL_INSCELLS (SID_NEW_SLOTS+56) +#define SID_TBXCTL_INSOBJ (SID_NEW_SLOTS+57) + +#define SID_DEFINE_COLROWNAMERANGES (SID_NEW_SLOTS+58) + +#define FID_NOTE_VISIBLE (SID_NEW_SLOTS+59) + +// items for validation +#define FID_VALID_MODE (SID_NEW_SLOTS+60) +#define FID_VALID_CONDMODE (SID_NEW_SLOTS+61) +#define FID_VALID_VALUE1 (SID_NEW_SLOTS+62) +#define FID_VALID_VALUE2 (SID_NEW_SLOTS+63) +#define FID_VALID_BLANK (SID_NEW_SLOTS+64) +#define FID_VALID_SHOWHELP (SID_NEW_SLOTS+65) +#define FID_VALID_HELPTITLE (SID_NEW_SLOTS+66) +#define FID_VALID_HELPTEXT (SID_NEW_SLOTS+67) +#define FID_VALID_SHOWERR (SID_NEW_SLOTS+68) +#define FID_VALID_ERRSTYLE (SID_NEW_SLOTS+69) +#define FID_VALID_ERRTITLE (SID_NEW_SLOTS+70) +#define FID_VALID_ERRTEXT (SID_NEW_SLOTS+71) + +#define SID_REFRESH_DBAREA (SID_NEW_SLOTS+72) +#define SID_RANGE_REGION (SID_NEW_SLOTS+73) + +#define FID_FOCUS_POSWND (SID_NEW_SLOTS+74) + +// single slots for different underline kinds (popup menu) +#define SID_ULINE_VAL_NONE (SID_NEW_SLOTS+75) +#define SID_ULINE_VAL_SINGLE (SID_NEW_SLOTS+76) +#define SID_ULINE_VAL_DOUBLE (SID_NEW_SLOTS+77) +#define SID_ULINE_VAL_DOTTED (SID_NEW_SLOTS+78) + +#define FID_DEL_MANUALBREAKS (SID_NEW_SLOTS+79) +#define SID_ADD_PRINTAREA (SID_NEW_SLOTS+80) +#define FID_ADJUST_PRINTZOOM (SID_NEW_SLOTS+81) +#define FID_RESET_PRINTZOOM (SID_NEW_SLOTS+82) + +#define SID_TABLES_COUNT (SID_NEW_SLOTS+83) +#define SID_ACTIVE_OBJ_NAME (SID_NEW_SLOTS+84) +#define SID_OBJECT_LEFT (SID_NEW_SLOTS+85) +#define SID_OBJECT_TOP (SID_NEW_SLOTS+86) +#define SID_OBJECT_WIDTH (SID_NEW_SLOTS+87) +#define SID_OBJECT_HEIGHT (SID_NEW_SLOTS+88) + +#define SID_PIVOT_CREATE (SID_NEW_SLOTS+89) +#define SID_PIVOT_FIELDS (SID_NEW_SLOTS+90) +#define SID_PFIELD_NAME (SID_NEW_SLOTS+91) +#define SID_PFIELD_ORIENTATION (SID_NEW_SLOTS+92) +#define SID_PFIELD_FUNCTION (SID_NEW_SLOTS+93) +#define SID_PIVOT_GET (SID_NEW_SLOTS+94) + +#define SID_DELETE_SCENARIO (SID_NEW_SLOTS+95) +#define SID_EDIT_SCENARIO (SID_NEW_SLOTS+96) + +// idl parameter + +#define SID_SORT_BYROW (SC_PARAM_START) +#define SID_SORT_HASHEADER (SC_PARAM_START+1) +#define SID_SORT_CASESENS (SC_PARAM_START+2) +#define SID_SORT_ATTRIBS (SC_PARAM_START+3) +#define SID_SORT_USERDEF (SC_PARAM_START+4) +#define SID_SORT_NATURALSORT (SC_PARAM_START+5) + +// ressources + +#define RID_OBJECTBAR_APP (SC_RESOURCE_START) +#define RID_OBJECTBAR_FORMAT (SC_RESOURCE_START+1) +#define RID_OBJECTBAR_INPUT (SC_RESOURCE_START+2) +#define RID_POPUP_CELLS (SC_RESOURCE_START+3) +#define RID_POPUP_DRAW (SC_RESOURCE_START+4) +#define RID_TEXT_TOOLBOX (SC_RESOURCE_START+5) +#define RID_OBJECTBAR_PREVIEW (SC_RESOURCE_START+6) +#define RID_POPUP_PREVIEW (SC_RESOURCE_START+7) +#define RID_POPUP_OLE (SC_RESOURCE_START+8) +#define RID_POPUP_CHART (SC_RESOURCE_START+9) +#define RID_OUTLINEBITMAPS (SC_RESOURCE_START+12) +#define RID_DRAW_WIN (SC_RESOURCE_START+13) +#define RID_CNTRLR_WIN (SC_RESOURCE_START+14) +#define RID_GLOBSTR (SC_RESOURCE_START+15) +#define RID_ALIGNMENT_WIN (SC_RESOURCE_START+19) +#define RID_SCFUNCTIONS (SC_RESOURCE_START+20) +#define RID_POPUP_PIVOT (SC_RESOURCE_START+21) +#define RID_IMGLIST_INPUTWIN (SC_RESOURCE_START+22) +#define RID_ERRHDLSC (SC_RESOURCE_START+23) +#define RID_POPUP_GRAPHIC (SC_RESOURCE_START+24) +#define RID_POPUP_DRAWTEXT (SC_RESOURCE_START+29) +#define RID_MN_FORMAT_ALGN (SC_RESOURCE_START+30) +#define RID_MN_FORMAT_STYLE (SC_RESOURCE_START+31) +#define RID_MN_FORMAT_LINESPACE (SC_RESOURCE_START+32) +#define RID_POPUP_EDIT (SC_RESOURCE_START+33) +#define RID_POPUP_AUDIT (SC_RESOURCE_START+34) +#define RID_OBJECTBAR_TOOLS (SC_RESOURCE_START+35) +#define RID_TBXCTL_INSERT (SC_RESOURCE_START+38) +#define RID_TBXCTL_INSCELLS (SC_RESOURCE_START+39) +#define RID_TBXCTL_INSOBJ (SC_RESOURCE_START+40) +#define RID_SC_FUNCTION_DESCRIPTIONS1 (SC_RESOURCE_START+43) +#define RID_SC_FUNCTION_DESCRIPTIONS2 (SC_RESOURCE_START+44) +#define RID_POPUP_CONTROL (SC_RESOURCE_START+45) +#define RID_POPUP_PAGEBREAK (SC_RESOURCE_START+46) +#define RID_POPUP_DRAWFORM (SC_RESOURCE_START+48) +#define RID_SC_ADDIN_ROT13 (SC_RESOURCE_START+50) +#define RID_SC_ADDIN_DFA (SC_RESOURCE_START+51) +#define RID_IMAGELIST_NAVCONT (SC_RESOURCE_START+52) +#define RID_DRAW_OBJECTBAR (SC_RESOURCE_START+53) +#define RID_GRAPHIC_OBJECTBAR (SC_RESOURCE_START+54) +#define RID_MEDIA_OBJECTBAR (SC_RESOURCE_START+60) +#define RID_POPUP_MEDIA (SC_RESOURCE_START+61) +#define RID_FUNCTION_CATEGORIES (SC_RESOURCE_START+62) + +#define STR_START (SC_RESOURCE_START+100) +#define STR_ROWHEIGHT (STR_START) +#define STR_ROWHEIGHT_TITLE (STR_START + 1) +#define STR_OPT_ROWHEIGHT (STR_START + 2) +#define STR_OPT_ROWHEIGHT_TITLE (STR_START + 3) +#define STR_COLWIDTH (STR_START + 4) +#define STR_COLWIDTH_TITLE (STR_START + 5) +#define STR_OPT_COLWIDTH (STR_START + 6) +#define STR_OPT_COLWIDTH_TITLE (STR_START + 7) +#define SCSTR_UNDEFINED (STR_START + 8) +#define SCSTR_NONAME (STR_START + 9) +#define SCSTR_NONE (STR_START + 10) +#define SCSTR_EMPTY (STR_START + 11) +#define SCSTR_NOTEMPTY (STR_START + 12) +#define SCSTR_COLUMN (STR_START + 13) +#define SCSTR_ROW (STR_START + 14) +#define SCSTR_NEW (STR_START + 15) +#define SCSTR_ADD (STR_START + 16) +#define SCSTR_REMOVE (STR_START + 17) +#define SCSTR_CANCEL (STR_START + 18) +#define SCSTR_MODIFY (STR_START + 19) +#define SCSTR_SHOWTABLE (STR_START + 20) +#define SCSTR_HIDDENTABLES (STR_START + 21) +#define SCSTR_SELECTDB (STR_START + 22) +#define SCSTR_AREAS (STR_START + 23) +#define SCSTR_TABLE (STR_START + 24) +#define SCSTR_NAME (STR_START + 25) +#define SCSTR_INSTABLE (STR_START + 26) +#define SCSTR_APDTABLE (STR_START + 27) +#define SCSTR_RENAMETAB (STR_START + 28) +#define STR_INSERTGRAPHIC (STR_START + 29) +#define SCSTR_APPLICATION (STR_START + 31) +#define SCSTR_DOCSHELL (STR_START + 32) +#define SCSTR_TABVIEWSHELL (STR_START + 33) +#define SCSTR_EDITSHELL (STR_START + 34) +#define SCSTR_DRAWSHELL (STR_START + 35) +#define SCSTR_DRAWTEXTSHELL (STR_START + 36) +#define SCSTR_NEWTABLE (STR_START + 37) +#define SCSTR_PREVIEWSHELL (STR_START + 38) + +#define SCSTR_PROTECTDOC (STR_START + 39) +#define SCSTR_UNPROTECTDOC (STR_START + 40) +#define SCSTR_PROTECTTAB (STR_START + 41) +#define SCSTR_UNPROTECTTAB (STR_START + 42) +#define SCSTR_PASSWORD (STR_START + 43) +#define SCSTR_PASSWORDOPT (STR_START + 44) +#define SCSTR_WRONGPASSWORD (STR_START + 45) + +#define SCSTR_PIVOTSHELL (STR_START + 46) +#define SCSTR_END (STR_START + 47) +#define SCSTR_STAT_PRINT (STR_START + 48) + +#define SCSTR_UNKNOWN (STR_START + 49) +#define SCSTR_CHAR_ATTRS (STR_START + 50) +#define SCSTR_ALL (STR_START + 51) +#define SCSTR_STDFILTER (STR_START + 52) + +// Cfg-Item-names +#define SCSTR_CFG_APP (STR_START + 53) +#define SCSTR_CFG_DOC (STR_START + 54) +#define SCSTR_CFG_VIEW (STR_START + 55) +#define SCSTR_CFG_SPELLCHECK (STR_START + 56) +#define SCSTR_CFG_PRINT (STR_START + 57) + +#define SCSTR_AUDITSHELL (STR_START + 58) + +#define SCSTR_CHARSET_USER (STR_START + 59) +#define SCSTR_COLUMN_USER (STR_START + 60) +#define SCSTR_FIELDSEP (STR_START + 61) +#define SCSTR_TEXTSEP (STR_START + 62) + +#define SCSTR_30_APPLICATION (STR_START + 63) +#define SCSTR_30_LONG_DOCNAME (STR_START + 64) + +#define SCSTR_CFG_INPUT (STR_START + 65) + +#define SCSTR_TOP10FILTER (STR_START + 66) + +#define SCSTR_CFG_NAVIPI (STR_START + 67) + +#define SCSTR_40_APPLICATION (STR_START + 68) +#define SCSTR_40_LONG_DOCNAME (STR_START + 69) + +#define SCSTR_DRAWFORMSHELL (STR_START + 70) +#define SCSTR_CELLSHELL (STR_START + 71) +#define SCSTR_FORMATSHELL (STR_START + 72) +#define SCSTR_OLEOBJECTSHELL (STR_START + 73) +#define SCSTR_CHARTSHELL (STR_START + 74) +#define SCSTR_GRAPHICSHELL (STR_START + 75) +#define SCSTR_PAGEBREAKSHELL (STR_START + 76) + +#define SCSTR_GRFILTER_OPENERROR (STR_START + 77) +#define SCSTR_GRFILTER_IOERROR (STR_START + 78) +#define SCSTR_GRFILTER_FORMATERROR (STR_START + 79) +#define SCSTR_GRFILTER_VERSIONERROR (STR_START + 80) +#define SCSTR_GRFILTER_FILTERERROR (STR_START + 81) +#define SCSTR_GRFILTER_TOOBIG (STR_START + 82) +#define SCSTR_UNDO_GRAFFILTER (STR_START + 83) + +#define SCSTR_50_APPLICATION (STR_START + 84) +#define SCSTR_50_LONG_DOCNAME (STR_START + 85) +#define SCSTR_CHG_PROTECT (STR_START + 86) +#define SCSTR_CHG_UNPROTECT (STR_START + 87) + +#define STR_CAPTION_DEFAULT_TEXT (STR_START + 88) + +// dialog: select sheets +#define STR_DLG_SELECTTABLES_TITLE (STR_START + 89) +#define STR_DLG_SELECTTABLES_LBNAME (STR_START + 90) + +// replace cell contents warning +#define STR_REPLCELLSWARN (STR_START + 91) + +#define SCSTR_DPFUNCLISTBOX (STR_START + 92) +#define SCSTR_ALLFILTER (STR_START + 94) +#define SCSTR_MOREBTN_MOREOPTIONS (STR_START + 95) +#define SCSTR_MOREBTN_FEWEROPTIONS (STR_START + 96) + +// items + +#define SCSTR_HOR_JUSTIFY_LEFT (STR_START + 100) +#define SCSTR_HOR_JUSTIFY_CENTER (STR_START + 101) +#define SCSTR_HOR_JUSTIFY_RIGHT (STR_START + 102) +#define SCSTR_HOR_JUSTIFY_BLOCK (STR_START + 103) +#define SCSTR_HOR_JUSTIFY_REPEAT (STR_START + 104) +#define SCSTR_HOR_JUSTIFY_STANDARD (STR_START + 105) +#define SCSTR_VER_JUSTIFY_TOP (STR_START + 106) +#define SCSTR_VER_JUSTIFY_CENTER (STR_START + 107) +#define SCSTR_VER_JUSTIFY_BOTTOM (STR_START + 108) +#define SCSTR_VER_JUSTIFY_STANDARD (STR_START + 109) +#define SCSTR_ORIENTATION_TOPBOTTOM (STR_START + 110) +#define SCSTR_ORIENTATION_BOTTOMTOP (STR_START + 111) +#define SCSTR_ORIENTATION_STANDARD (STR_START + 112) + +// accessibility + +// CSV import +#define STR_ACC_CSVRULER_NAME (STR_START + 150) +#define STR_ACC_CSVRULER_DESCR (STR_START + 151) +#define STR_ACC_CSVGRID_NAME (STR_START + 152) +#define STR_ACC_CSVGRID_DESCR (STR_START + 153) + +// document +#define STR_ACC_DOC_NAME (STR_START + 154) +#define STR_ACC_DOC_DESCR (STR_START + 155) +#define STR_ACC_TABLE_NAME (STR_START + 156) +#define STR_ACC_TABLE_DESCR (STR_START + 157) +#define STR_ACC_CELL_NAME (STR_START + 158) +#define STR_ACC_CELL_DESCR (STR_START + 159) + +// preview +#define STR_ACC_PREVIEWDOC_NAME (STR_START + 160) +#define STR_ACC_PREVIEWDOC_DESCR (STR_START + 161) +#define STR_ACC_HEADERCELL_NAME (STR_START + 162) +#define STR_ACC_HEADERCELL_DESCR (STR_START + 163) +#define STR_ACC_LEFTAREA_NAME (STR_START + 164) +#define STR_ACC_LEFTAREA_DESCR (STR_START + 165) +#define STR_ACC_CENTERAREA_NAME (STR_START + 166) +#define STR_ACC_CENTERAREA_DESCR (STR_START + 167) +#define STR_ACC_RIGHTAREA_NAME (STR_START + 168) +#define STR_ACC_RIGHTAREA_DESCR (STR_START + 169) +#define STR_ACC_HEADER_NAME (STR_START + 170) +#define STR_ACC_HEADER_DESCR (STR_START + 171) +#define STR_ACC_FOOTER_NAME (STR_START + 172) +#define STR_ACC_FOOTER_DESCR (STR_START + 173) + +// Editline +#define STR_ACC_EDITLINE_NAME (STR_START + 174) +#define STR_ACC_EDITLINE_DESCR (STR_START + 175) + +// EditCell +#define STR_ACC_EDITCELL_NAME (STR_START + 176) +#define STR_ACC_EDITCELL_DESCR (STR_START + 177) + +// DataPilot +#define STR_ACC_DATAPILOT_ROW_DESCR (STR_START + 178) +#define STR_ACC_DATAPILOT_COL_DESCR (STR_START + 179) +#define STR_ACC_DATAPILOT_DATA_DESCR (STR_START + 180) +#define STR_ACC_DATAPILOT_SEL_DESCR (STR_START + 181) +#define STR_ACC_DATAPILOT_PAGE_DESCR (STR_START + 182) + +// IAccessibility2 Implementation 2009 +#define STR_ACC_TOOLBAR_FORMULA (STR_START + 184) +#define STR_ACC_DOC_SPREADSHEET (STR_START + 185) +#define STR_ACC_DOC_PREVIEW_SUFFIX (STR_START + 186) +#define STR_ACC_DOC_SPREADSHEET_READONLY (STR_START + 187) + +#define SCSTR_HUMAN_SCDOC_NAME (STR_START + 210) +#define SCSTR_SHORT_SCDOC_NAME (STR_START + 211) +#define SCSTR_LONG_SCDOC_NAME (STR_START + 212) + +#define SCSTR_CLPBRD_CLEAR (STR_START + 213) + +#define SCSTR_FORMULA_AUTOCORRECTION (STR_START + 214) + +#define SCSTR_RENAMEOBJECT (STR_START + 215) +#define SCSTR_PRINT_OPTIONS (STR_START + 216) +#define SCSTR_WARN_ME_IN_FUTURE_CHECK (STR_START + 217) + +// navigator - in the same order as SC_CONTENT_... +#define SCSTR_CONTENT_ROOT (STR_START + 250) +#define SCSTR_CONTENT_TABLE (STR_START + 251) +#define SCSTR_CONTENT_RANGENAME (STR_START + 252) +#define SCSTR_CONTENT_DBAREA (STR_START + 253) +#define SCSTR_CONTENT_GRAPHIC (STR_START + 254) +#define SCSTR_CONTENT_OLEOBJECT (STR_START + 255) +#define SCSTR_CONTENT_NOTE (STR_START + 256) +#define SCSTR_CONTENT_AREALINK (STR_START + 257) +#define SCSTR_CONTENT_DRAWING (STR_START + 258) +// some space for extensions + +// input, quickhelp strings (HelpText now using HelpId from help) +#define SCSTR_QHELP_INPUTWND (STR_START + 307) +#define SCSTR_QHELP_POSWND (STR_START + 308) +#define SCSTR_QHELP_BTNCALC (STR_START + 309) +#define SCSTR_QHELP_BTNOK (STR_START + 310) +#define SCSTR_QHELP_BTNCANCEL (STR_START + 311) +#define SCSTR_QHELP_BTNSUM (STR_START + 312) +#define SCSTR_QHELP_BTNEQUAL (STR_START + 313) + +// validator +#define SCSTR_VALID_MINIMUM (STR_START + 314) +#define SCSTR_VALID_MAXIMUM (STR_START + 315) +#define SCSTR_VALID_VALUE (STR_START + 316) +#define SCSTR_VALID_RANGE (STR_START + 317) +#define SCSTR_VALID_LIST (STR_START + 318) + +// formulator +#define SCSTR_FUDB (STR_START + 389) +#define SCSTR_FUDATE (STR_START + 390) +#define SCSTR_FUFIN (STR_START + 391) +#define SCSTR_FUINFO (STR_START + 392) +#define SCSTR_FULOG (STR_START + 393) +#define SCSTR_FUMATHS (STR_START + 394) +#define SCSTR_FUSTAT (STR_START + 395) +#define SCSTR_FUTAB (STR_START + 396) +#define SCSTR_FUTEXT (STR_START + 397) + +#define SCSTR_COMPILER_STRINGS (STR_START + 398) +#define SCSTR_FILTER_STRINGS (STR_START + 399) +#define SCSTR_COMPILER_INTL_STR (STR_START + 400) + +// media shell +#define SCSTR_MEDIASHELL (STR_START + 401) + +#define RID_SCSTR_ONCLICK (STR_START + 402) + +#define SCSTR_SET_TAB_BG_COLOR (STR_START + 403) +#define SCSTR_NO_TAB_BG_COLOR (STR_START + 404) + +#define STR_END (SCSTR_NO_TAB_BG_COLOR) + +#define BMP_START (STR_END) + +// navigator +#define RID_IMG_DROP_URL (BMP_START + 2) +#define RID_IMG_DROP_LINK (BMP_START + 3) +#define RID_IMG_DROP_COPY (BMP_START + 4) +#define RID_IMG_SELECT_CURRENT (BMP_START + 8) +#define RID_IMG_UNSELECT_CURRENT (BMP_START + 9) + +#define RID_SCPTR_PIVOTCOL (BMP_START + 81) +#define RID_SCPTR_PIVOTROW (BMP_START + 82) +#define RID_SCPTR_DETECTIVE (BMP_START + 83) +#define RID_SCPTR_CHART (BMP_START + 84) + +#define RID_SCICN_DOCUMENT (BMP_START + 95) +#define RID_SCICN_TEMPLATE (BMP_START + 96) +#define RID_SCICN_SC10DOC (BMP_START + 97) + +#define BMP_END (BMP_START + 100) + +#define SC_DIALOGS_START (BMP_END) +#define RID_SCDLG_ATTR (SC_DIALOGS_START) +#define RID_SCPAGE_NUMBER (SC_DIALOGS_START + 1) +#define RID_SCPAGE_ALIGNMENT (SC_DIALOGS_START + 2) +#define RID_SCPAGE_PROTECTION (SC_DIALOGS_START + 3) +#define RID_SCDLG_SORT (SC_DIALOGS_START + 5) +#define RID_SCPAGE_SORT_FIELDS (SC_DIALOGS_START + 6) +#define RID_SCPAGE_SORT_OPTIONS (SC_DIALOGS_START + 7) +#define RID_SCDLG_FILTER (SC_DIALOGS_START + 8) +#define RID_SCDLG_SPEC_FILTER (SC_DIALOGS_START + 9) +#define RID_SCMISCDLGS (SC_DIALOGS_START + 10) +#define RID_SCDLG_DELCELL (SC_DIALOGS_START + 11) +#define RID_SCDLG_INSCELL (SC_DIALOGS_START + 12) +#define RID_SCDLG_DELCONT (SC_DIALOGS_START + 13) +#define RID_SCDLG_INSCONT (SC_DIALOGS_START + 14) +#define RID_SCDLG_MOVETAB (SC_DIALOGS_START + 15) +#define RID_SCDLG_STRINPUT (SC_DIALOGS_START + 16) +#define RID_SCDLG_MTRINPUT (SC_DIALOGS_START + 17) +#define RID_SCDLG_SELENTRY (SC_DIALOGS_START + 18) +#define RID_SCDLG_FILLSERIES (SC_DIALOGS_START + 19) +#define RID_SCDLG_AUTOFORMAT (SC_DIALOGS_START + 20) +#define RID_SCDLG_GROUP (SC_DIALOGS_START + 21) +#define RID_SCDLG_NAMES (SC_DIALOGS_START + 22) +#define RID_SCDLG_DBNAMES (SC_DIALOGS_START + 23) +#define RID_SCDLG_PRINTOPTIONS (SC_DIALOGS_START + 24) +#define RID_SCPAGE_PRINTOPTIONS (SC_DIALOGS_START + 25) +#define RID_SCDLG_SOLVER (SC_DIALOGS_START + 26) +#define RID_SCDLG_SUBTOTALS (SC_DIALOGS_START + 27) +#define RID_SUBTBASE (SC_DIALOGS_START + 28) +#define RID_SCPAGE_SUBT_OPTIONS (SC_DIALOGS_START + 29) +#define RID_SCDLG_OPTIONS (SC_DIALOGS_START + 30) +#define RID_SCPAGE_USERLISTS (SC_DIALOGS_START + 31) +#define RID_SCDLG_PIVOTFILTER (SC_DIALOGS_START + 33) +#define RID_SCDLG_PIVOT_LAYOUT (SC_DIALOGS_START + 34) +#define RID_SCDLG_CONSOLIDATE (SC_DIALOGS_START + 35) +#define RID_SCTBXWND_SCENARIO (SC_DIALOGS_START + 36) +#define RID_SCDLG_FORMULATOR (SC_DIALOGS_START + 37) +#define RID_SCDLG_PIVOTSUBT (SC_DIALOGS_START + 38) +#define RID_SCDLG_NEWSCENARIO (SC_DIALOGS_START + 39) +#define RID_SCDLG_FORMULA (SC_DIALOGS_START + 40) +#define RID_SCDLG_ARGUMENTS (SC_DIALOGS_START + 41) +#define RID_SCDLG_INSERT_TABLE (SC_DIALOGS_START + 42) +#define RID_SCPAGE_TABLE (SC_DIALOGS_START + 43) +#define RID_SCPAGE_AREAS (SC_DIALOGS_START + 44) +#define RID_SCDLG_STYLES_START (SC_DIALOGS_START + 45) +#define RID_SCDLG_STYLES_CHAR (SC_DIALOGS_START + 45) +#define RID_SCDLG_STYLES_PAR (SC_DIALOGS_START + 46) +#define RID_SCDLG_STYLES_FRAME (SC_DIALOGS_START + 47) +#define RID_SCDLG_STYLES_PAGE (SC_DIALOGS_START + 48) +#define RID_SCDLG_STYLES_END (SC_DIALOGS_START + 48) +#define RID_HFBASE (SC_DIALOGS_START + 49) +#define RID_SCDLG_HFEDIT (SC_DIALOGS_START + 50) +#define RID_SCDLG_HFEDIT_ALL (SC_DIALOGS_START + 51) +#define RID_SCDLG_HFED_HEADER (SC_DIALOGS_START + 52) +#define RID_SCDLG_HFED_FOOTER (SC_DIALOGS_START + 53) +#define RID_SCBTN_HFEDIT (SC_DIALOGS_START + 54) +#define RID_SCPAGE_VIEW (SC_DIALOGS_START + 55) +#define RID_SCPAGE_CALC (SC_DIALOGS_START + 56) +#define RID_SCDLG_NAVIGATOR (SC_DIALOGS_START + 57) +#define RID_SCDLG_TABOP (SC_DIALOGS_START + 58) +#define RID_SCDLG_IMPORTOPT (SC_DIALOGS_START + 59) +#define RID_POPUP_ROWHEADER (SC_DIALOGS_START + 60) +#define RID_POPUP_COLHEADER (SC_DIALOGS_START + 61) +#define RID_SCDLG_HFEDIT_SHDR (SC_DIALOGS_START + 62) +#define RID_SCDLG_HFEDIT_SFTR (SC_DIALOGS_START + 63) +#define RID_SCDLG_HFEDIT_LEFTHEADER (SC_DIALOGS_START + 64) +#define RID_SCDLG_HFEDIT_RIGHTHEADER (SC_DIALOGS_START + 65) +#define RID_SCDLG_HFEDIT_LEFTFOOTER (SC_DIALOGS_START + 66) +#define RID_SCDLG_HFEDIT_RIGHTFOOTER (SC_DIALOGS_START + 67) +#define RID_SCDLG_HFEDIT_HEADER (SC_DIALOGS_START + 68) +#define RID_SCDLG_HFEDIT_FOOTER (SC_DIALOGS_START + 69) +#define RID_SCPAGE_PRINT (SC_DIALOGS_START + 70) +#define RID_SCDLG_COLORROW (SC_DIALOGS_START + 71) +#define RID_SCDLG_NAMES_PASTE (SC_DIALOGS_START + 72) +#define RID_SCDLG_NAMES_CREATE (SC_DIALOGS_START + 73) +#define RID_SCDLG_NAMES_APPLY (SC_DIALOGS_START + 74) //NYI + +#define RID_SCDLG_CHAR (SC_DIALOGS_START + 76) +#define RID_SCDLG_PARAGRAPH (SC_DIALOGS_START + 77) + +#define RID_SCPAGE_STAT (SC_DIALOGS_START + 79) +#define RID_SCDLG_CHARTCOLROW (SC_DIALOGS_START + 80) +#define RID_SCDLG_AREAS (SC_DIALOGS_START + 81) + +#define RID_SCDLG_EDITCHAR (SC_DIALOGS_START + 82) + +// popup for statusbar controller +#define RID_POPUP_SUMCTL (SC_DIALOGS_START + 83) +#define RID_SUMCTL_SUM (SC_DIALOGS_START + 84) +#define RID_SUMCTL_MIN (SC_DIALOGS_START + 85) +#define RID_SUMCTL_MAX (SC_DIALOGS_START + 86) +#define RID_SUMCTL_COUNT (SC_DIALOGS_START + 87) +#define RID_SUMCTL_COUNT2 (SC_DIALOGS_START + 88) +#define RID_SUMCTL_AVG (SC_DIALOGS_START + 89) +#define RID_SUMCTL_NONE (SC_DIALOGS_START + 90) + +#define RID_SCDLG_ASCII (SC_DIALOGS_START + 91) + +// popup for drop-mode in navigator +#define RID_POPUP_DROPMODE (SC_DIALOGS_START + 92) +#define RID_DROPMODE_URL (SC_DIALOGS_START + 93) +#define RID_DROPMODE_LINK (SC_DIALOGS_START + 94) +#define RID_DROPMODE_COPY (SC_DIALOGS_START + 95) +#define RID_SCDLG_CONDFORMAT (SC_DIALOGS_START + 96) + +#define RID_SCPAGE_SUBT_GROUP1 (SC_DIALOGS_START + 97) +#define RID_SCPAGE_SUBT_GROUP2 (SC_DIALOGS_START + 98) +#define RID_SCPAGE_SUBT_GROUP3 (SC_DIALOGS_START + 99) + +#define RID_SCPAGE_HFED_HL (SC_DIALOGS_START + 100) +#define RID_SCPAGE_HFED_HR (SC_DIALOGS_START + 101) +#define RID_SCPAGE_HFED_FL (SC_DIALOGS_START + 102) +#define RID_SCPAGE_HFED_FR (SC_DIALOGS_START + 103) + +// derivations from RID_SCDLG_MTRINPUT +#define RID_SCDLG_COL_MAN (SC_DIALOGS_START + 104) +#define RID_SCDLG_COL_OPT (SC_DIALOGS_START + 105) +#define RID_SCDLG_ROW_MAN (SC_DIALOGS_START + 106) +#define RID_SCDLG_ROW_OPT (SC_DIALOGS_START + 107) + +// derivations from RID_SCDLG_SELENTRY +#define RID_SCDLG_SELECTDB (SC_DIALOGS_START + 108) +#define RID_SCDLG_SHOW_TAB (SC_DIALOGS_START + 109) + +// derivations from RID_SCDLG_GROUP +#define RID_SCDLG_GRP_MAKE (SC_DIALOGS_START + 110) +#define RID_SCDLG_GRP_KILL (SC_DIALOGS_START + 111) + +#define RID_SCDLG_COLROWNAMERANGES (SC_DIALOGS_START + 112) + +#define RID_SCPAGE_CONTENT (SC_DIALOGS_START + 113) +#define RID_SCPAGE_LAYOUT (SC_DIALOGS_START + 114) +#define RID_SCPAGE_INPUT (SC_DIALOGS_START + 115) + +#define RID_SCTAB_PARAMETER (SC_DIALOGS_START + 116) +#define RID_SCTAB_FUNCTION (SC_DIALOGS_START + 117) +#define RID_SCTAB_STRUCT (SC_DIALOGS_START + 118) + +#define RID_SCDLG_CHANGES (SC_DIALOGS_START + 119) + +#define RID_POPUP_NAVIPI_SCENARIO (SC_DIALOGS_START + 120) +#define RID_NAVIPI_SCENARIO_DELETE (SC_DIALOGS_START + 121) +#define RID_NAVIPI_SCENARIO_EDIT (SC_DIALOGS_START + 122) + +#define RID_SCDLG_HIGHLIGHT_CHANGES (SC_DIALOGS_START + 123) +#define RID_SCPAGE_OPREDLINE (SC_DIALOGS_START + 124) + +#define RID_SCDLG_SIMPLEREF (SC_DIALOGS_START + 125) +#define WID_SIMPLE_REF (SC_DIALOGS_START + 126) +#define RID_POPUP_CHANGES (SC_DIALOGS_START + 127) +#define RID_SCPAGE_OPTLOAD (SC_DIALOGS_START + 128) + +#define RID_SCDLG_DAPITYPE (SC_DIALOGS_START + 129) +#define RID_SCDLG_DAPISERVICE (SC_DIALOGS_START + 130) +#define RID_SCDLG_DAPIDATA (SC_DIALOGS_START + 131) + +#define RID_SCDLG_LINKAREA (SC_DIALOGS_START + 132) +#define RID_SCDLG_DPDATAFIELD (SC_DIALOGS_START + 133) +#define RID_SCDLG_DPSUBTOTAL_OPT (SC_DIALOGS_START + 134) +#define RID_SCDLG_DPNUMGROUP (SC_DIALOGS_START + 135) +#define RID_SCDLG_DPDATEGROUP (SC_DIALOGS_START + 136) +#define RID_SCDLG_DPSHOWDETAIL (SC_DIALOGS_START + 137) +#define RID_SCDLG_OPTSOLVER (SC_DIALOGS_START + 138) +#define RID_SCDLG_SOLVEROPTIONS (SC_DIALOGS_START + 139) +#define RID_SCDLG_SOLVER_INTEGER (SC_DIALOGS_START + 140) +#define RID_SCDLG_SOLVER_DOUBLE (SC_DIALOGS_START + 141) +#define RID_SCDLG_SOLVER_PROGRESS (SC_DIALOGS_START + 142) +#define RID_SCDLG_SOLVER_NOSOLUTION (SC_DIALOGS_START + 143) +#define RID_SCDLG_SOLVER_SUCCESS (SC_DIALOGS_START + 144) + +#define RID_SCDLG_CONFLICTS (SC_DIALOGS_START + 145) +#define RID_SCDLG_SHAREDOCUMENT (SC_DIALOGS_START + 146) +#define RID_SCDLG_SORT_WARNING (SC_DIALOGS_START + 147) +#define RID_SCDLG_TABPROTECTION (SC_DIALOGS_START + 148) +#define RID_SCDLG_DOCPROTECTION (SC_DIALOGS_START + 149) +#define RID_SCDLG_RETYPEPASS (SC_DIALOGS_START + 150) +#define RID_SCDLG_RETYPEPASS_INPUT (SC_DIALOGS_START + 151) +#define RID_SCDLG_TEXT_IMPORT_OPTIONS (SC_DIALOGS_START + 152) +#define RID_POPUP_FILTER (SC_DIALOGS_START + 153) +#define RID_SCDLG_TAB_BG_COLOR (SC_DIALOGS_START + 154) + +#define SC_DIALOGS_END (SC_DIALOGS_START + 155) + +#ifndef STD_MASKCOLOR +#define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; } +#endif + +#define MID_1 1 +#define MID_2 2 +#define MID_3 3 +#define MID_4 4 + +// ooo-build specific resources + +#define SC_OOO_BUILD_START (SC_DIALOGS_END) + +// toggle sheet grid +#define FID_TAB_TOGGLE_GRID (SC_OOO_BUILD_START + 1) + +// formula options page +#define RID_SCPAGE_FORMULA (SC_OOO_BUILD_START + 2) + +// insert current date and time to cell via command +#define SID_INSERT_CURRENT_DATE (SC_OOO_BUILD_START + 4) +#define SID_INSERT_CURRENT_TIME (SC_OOO_BUILD_START + 5) + +// data Form +#define SID_DATAFORM_NEW (SC_OOO_BUILD_START + 6) // message +#define SID_DATA_FORM (SC_OOO_BUILD_START + 7) // menu (in Data menu) +#define RID_SCDLG_DATAFORM (SC_OOO_BUILD_START + 8) // dialog + +// compatibility options page +#define RID_SCPAGE_COMPATIBILITY (SC_OOO_BUILD_START + 9) + +#endif + diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx new file mode 100644 index 000000000000..b91563195553 --- /dev/null +++ b/sc/inc/scabstdlg.hxx @@ -0,0 +1,516 @@ +/* -*- 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. + * + ************************************************************************/ +#ifndef _SC_ABSTDLG_HXX +#define _SC_ABSTDLG_HXX + +// include --------------------------------------------------------------- + +#include <tools/solar.h> +#include <tools/string.hxx> +#include <sfx2/sfxdlg.hxx> +#include <vcl/syswin.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <vcl/field.hxx> +#include "sc.hrc" +#include "global.hxx" +#include "pivot.hxx" +#include "i18npool/lang.h" + +#include <tabvwsh.hxx> + +class ScAsciiOptions; +class ScAutoFormat; +class ScAutoFormatData; +class ScDocument; +struct ScImportSourceDesc; +class ScViewData; +class ScRangeName; +class ScQueryItem; +class ScImportOptions; +class SfxStyleSheetBase; +class ScDPObject; +struct ScDPFuncData; +struct ScDPNumGroupInfo; +class ScTabViewShell; + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldReference; +} } } } + +class AbstractScImportAsciiDlg : public VclAbstractDialog //add for ScImportAsciiDlg +{ +public: + virtual void GetOptions( ScAsciiOptions& rOpt ) = 0; + virtual void SetTextToColumnsMode() = 0; + virtual void SaveParameters() = 0; +}; + + +class AbstractScAutoFormatDlg : public VclAbstractDialog //add for ScAutoFormatDlg +{ +public: + virtual sal_uInt16 GetIndex() const = 0 ; + virtual String GetCurrFormatName() = 0; +}; + +class AbstractScColRowLabelDlg : public VclAbstractDialog //add for ScColRowLabelDlg +{ +public: + virtual sal_Bool IsCol() = 0; + virtual sal_Bool IsRow() = 0; +}; + +class AbstractScDataPilotDatabaseDlg :public VclAbstractDialog //add for ScDataPilotDatabaseDlg +{ +public: + virtual void GetValues( ScImportSourceDesc& rDesc ) = 0; +}; + +class AbstractScDataPilotSourceTypeDlg : public VclAbstractDialog //add for ScDataPilotSourceTypeDlg +{ +public: + virtual bool IsDatabase() const = 0; + virtual bool IsExternal() const = 0; + virtual bool IsNamedRange() const = 0; + virtual rtl::OUString GetSelectedNamedRange() const = 0; + virtual void AppendNamedRange(const ::rtl::OUString& rName) = 0; +}; + +class AbstractScDataPilotServiceDlg : public VclAbstractDialog //add for ScDataPilotServiceDlg +{ +public: + virtual String GetServiceName() const = 0; + virtual String GetParSource() const = 0 ; + virtual String GetParName() const = 0 ; + virtual String GetParUser() const = 0; + virtual String GetParPass() const = 0; +}; + +class AbstractScDeleteCellDlg : public VclAbstractDialog //add for ScDeleteCellDlg +{ +public: + virtual DelCellCmd GetDelCellCmd() const = 0; +}; + +//for dataform +class AbstractScDataFormDlg : public VclAbstractDialog //add for ScDeleteCellDlg +{ + +}; + +class AbstractScDeleteContentsDlg: public VclAbstractDialog //add for ScDeleteContentsDlg +{ +public: + virtual void DisableObjects() = 0 ; + virtual sal_uInt16 GetDelContentsCmdBits() const = 0; +}; + +class AbstractScFillSeriesDlg: public VclAbstractDialog //add for ScFillSeriesDlg +{ +public: + virtual FillDir GetFillDir() const = 0; + virtual FillCmd GetFillCmd() const = 0; + virtual FillDateCmd GetFillDateCmd() const = 0; + virtual double GetStart() const = 0; + virtual double GetStep() const = 0; + virtual double GetMax() const = 0; + virtual String GetStartStr() const = 0; + virtual void SetEdStartValEnabled(sal_Bool bFlag=false) = 0; +}; + +class AbstractScGroupDlg : public VclAbstractDialog //add for ScGroupDlg +{ +public: + virtual sal_Bool GetColsChecked() const = 0; +}; + +class AbstractScInsertCellDlg : public VclAbstractDialog //add for ScInsertCellDlg +{ +public: + virtual InsCellCmd GetInsCellCmd() const = 0; +}; + +class AbstractScInsertContentsDlg : public VclAbstractDialog //add for ScInsertContentsDlg +{ +public: + virtual sal_uInt16 GetInsContentsCmdBits() const = 0; + virtual sal_uInt16 GetFormulaCmdBits() const = 0 ; + virtual sal_Bool IsSkipEmptyCells() const = 0; + virtual sal_Bool IsLink() const = 0; + virtual void SetFillMode( sal_Bool bSet ) = 0; + virtual void SetOtherDoc( sal_Bool bSet ) = 0; + virtual sal_Bool IsTranspose() const = 0; + virtual void SetChangeTrack( sal_Bool bSet ) = 0; + virtual void SetCellShiftDisabled( int nDisable ) = 0; + virtual InsCellCmd GetMoveMode() = 0; +}; + +class AbstractScInsertTableDlg : public VclAbstractDialog //add for ScInsertTableDlg +{ +public: + virtual sal_Bool GetTablesFromFile() = 0; + virtual sal_Bool GetTablesAsLink() = 0; + virtual const String* GetFirstTable( sal_uInt16* pN = NULL ) = 0; + virtual ScDocShell* GetDocShellTables() = 0; + virtual sal_Bool IsTableBefore() = 0; + virtual sal_uInt16 GetTableCount() = 0; + virtual const String* GetNextTable( sal_uInt16* pN = NULL ) = 0; + +}; + +class AbstractScSelEntryDlg : public VclAbstractDialog //add for ScSelEntryDlg +{ +public: + virtual String GetSelectEntry() const = 0; +}; + +class AbstractScLinkedAreaDlg : public VclAbstractDialog2 //add for ScLinkedAreaDlg +{ +public: + virtual void InitFromOldLink( const String& rFile, const String& rFilter, + const String& rOptions, const String& rSource, + sal_uLong nRefresh ) = 0; + virtual String GetURL() = 0; + virtual String GetFilter() = 0; // may be empty + virtual String GetOptions() = 0; // filter options + virtual String GetSource() = 0; // separated by ";" + virtual sal_uLong GetRefresh() = 0; // 0 if disabled +}; + +class AbstractScMetricInputDlg : public VclAbstractDialog //add for ScMetricInputDlg +{ +public: + virtual long GetInputValue( FieldUnit eUnit = FUNIT_TWIP ) const = 0; +}; + +class AbstractScMoveTableDlg : public VclAbstractDialog //add for ScMoveTableDlg +{ +public: + virtual sal_uInt16 GetSelectedDocument () const = 0; + virtual sal_uInt16 GetSelectedTable () const = 0; + virtual bool GetCopyTable () const = 0; + virtual bool GetRenameTable () const = 0; + virtual void GetTabNameString( String& rString ) const = 0; + virtual void SetForceCopyTable () = 0; + virtual void EnableCopyTable (sal_Bool bFlag=true) = 0; + virtual void EnableRenameTable (sal_Bool bFlag=true) = 0; +}; + +class AbstractScNameCreateDlg : public VclAbstractDialog //add for ScNameCreateDlg +{ +public: + virtual sal_uInt16 GetFlags() const = 0; +}; + +class AbstractScNamePasteDlg : public VclAbstractDialog //add for ScNamePasteDlg +{ +public: + virtual String GetSelectedName() const = 0; +}; + +class AbstractScPivotFilterDlg : public VclAbstractDialog //add for ScPivotFilterDlg +{ +public: + virtual const ScQueryItem& GetOutputItem() = 0; +}; + +class AbstractScDPFunctionDlg : public VclAbstractDialog //add for ScDPFunctionDlg +{ +public: + virtual sal_uInt16 GetFuncMask() const = 0; + virtual ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const = 0; +}; + +class AbstractScDPSubtotalDlg : public VclAbstractDialog //add for ScDPSubtotalDlg +{ +public: + virtual sal_uInt16 GetFuncMask() const = 0; + virtual void FillLabelData( ScDPLabelData& rLabelData ) const = 0; +}; + +class AbstractScDPNumGroupDlg : public VclAbstractDialog +{ +public: + virtual ScDPNumGroupInfo GetGroupInfo() const = 0; +}; + +class AbstractScDPDateGroupDlg : public VclAbstractDialog +{ +public: + virtual ScDPNumGroupInfo GetGroupInfo() const = 0; + virtual sal_Int32 GetDatePart() const = 0; +}; + +class AbstractScDPShowDetailDlg : public VclAbstractDialog //add for ScDPShowDetailDlg +{ +public: + virtual String GetDimensionName() const = 0; +}; + +class AbstractScNewScenarioDlg : public VclAbstractDialog //add for ScNewScenarioDlg +{ +public: + + virtual void SetScenarioData( const String& rName, const String& rComment, + const Color& rColor, sal_uInt16 nFlags ) = 0; + + virtual void GetScenarioData( String& rName, String& rComment, + Color& rColor, sal_uInt16& rFlags ) const = 0; +}; + +class AbstractScShowTabDlg : public VclAbstractDialog //add for ScShowTabDlg +{ +public: + virtual void Insert( const String& rString, sal_Bool bSelected ) = 0; + virtual sal_uInt16 GetSelectEntryCount() const = 0; + virtual void SetDescription(const String& rTitle, const String& rFixedText, const rtl::OString& nDlgHelpId, const rtl::OString& nLbHelpId ) = 0; + virtual String GetSelectEntry(sal_uInt16 nPos) const = 0; + virtual sal_uInt16 GetSelectEntryPos(sal_uInt16 nPos) const = 0; +}; + +class AbstractScStringInputDlg : public VclAbstractDialog //add for ScStringInputDlg +{ +public: + virtual void GetInputString( String& rString ) const = 0; +}; + +class AbstractScTabBgColorDlg : public VclAbstractDialog //add for ScTabBgColorDlg +{ +public: + virtual void GetSelectedColor( Color& rColor ) const = 0; +}; + +class AbstractScImportOptionsDlg : public VclAbstractDialog //add for ScImportOptionsDlg +{ +public: + virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0; +}; + +class AbstractScTextImportOptionsDlg : public VclAbstractDialog //add for ScLangChooserDlg +{ +public: + virtual LanguageType GetLanguageType() const = 0; + virtual bool IsDateConversionSet() const = 0; +}; + +//-------Scabstract fractory --------------------------- +class ScAbstractDialogFactory +{ +public: + SC_DLLPUBLIC static ScAbstractDialogFactory* Create(); + + virtual AbstractScImportAsciiDlg * CreateScImportAsciiDlg( Window* pParent, String aDatName, //add for ScImportAsciiDlg + SvStream* pInStream, int nId, + sal_Unicode cSep = '\t') = 0; + + virtual AbstractScTextImportOptionsDlg * CreateScTextImportOptionsDlg( Window* pParent, int nId ) = 0; + + virtual AbstractScAutoFormatDlg * CreateScAutoFormatDlg( Window* pParent, //add for ScAutoFormatDlg + ScAutoFormat* pAutoFormat, + const ScAutoFormatData* pSelFormatData, + ScDocument* pDoc, + int nId) = 0; + virtual AbstractScColRowLabelDlg * CreateScColRowLabelDlg (Window* pParent, //add for ScColRowLabelDlg + int nId, + sal_Bool bCol = false, + sal_Bool bRow = false) = 0; + + virtual VclAbstractDialog * CreateScColOrRowDlg( Window* pParent, //add for ScColOrRowDlg + const String& rStrTitle, + const String& rStrLabel, + int nId, + sal_Bool bColDefault = sal_True ) = 0; + virtual VclAbstractDialog * CreateScSortWarningDlg ( Window* pParent, const String& rExtendText, const String& rCurrentText, int nId ) = 0; //add for ScSortWarningDlg + virtual AbstractScDataPilotDatabaseDlg * CreateScDataPilotDatabaseDlg (Window* pParent ,int nId ) = 0; //add for ScDataPilotDatabaseDlg + + virtual AbstractScDataPilotSourceTypeDlg * CreateScDataPilotSourceTypeDlg ( Window* pParent, sal_Bool bEnableExternal, int nId ) = 0; //add for ScDataPilotSourceTypeDlg + + virtual AbstractScDataPilotServiceDlg * CreateScDataPilotServiceDlg( Window* pParent, //add for ScDataPilotServiceDlg + const com::sun::star::uno::Sequence<rtl::OUString>& rServices, + int nId ) = 0; + + virtual AbstractScDeleteCellDlg * CreateScDeleteCellDlg( Window* pParent, int nId, sal_Bool bDisallowCellMove = false ) = 0 ; //add for ScDeleteCellDlg + + //for dataform + virtual AbstractScDataFormDlg * CreateScDataFormDlg( Window* pParent, int nId, ScTabViewShell* pTabViewShell ) = 0 ; //add for ScDataFormDlg + + virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg + sal_uInt16 nCheckDefaults = 0 ) = 0; + virtual AbstractScFillSeriesDlg * CreateScFillSeriesDlg( Window* pParent, //add for ScFillSeriesDlg + ScDocument& rDocument, + FillDir eFillDir, + FillCmd eFillCmd, + FillDateCmd eFillDateCmd, + String aStartStr, + double fStep, + double fMax, + sal_uInt16 nPossDir, + int nId) = 0; + + virtual AbstractScGroupDlg * CreateAbstractScGroupDlg( Window* pParent, //add for ScGroupDlg + sal_uInt16 nResId, + int nId, + sal_Bool bUnGroup = false, + sal_Bool bRows = sal_True ) = 0; + + virtual AbstractScInsertCellDlg * CreateScInsertCellDlg( Window* pParent, //add for ScInsertCellDlg + int nId, + sal_Bool bDisallowCellMove = false ) = 0; + + virtual AbstractScInsertContentsDlg * CreateScInsertContentsDlg( Window* pParent, //add for ScInsertContentsDlg + int nId, + sal_uInt16 nCheckDefaults = 0, + const String* pStrTitle = NULL ) = 0; + + virtual AbstractScInsertTableDlg * CreateScInsertTableDlg ( Window* pParent, ScViewData& rViewData, //add for ScInsertTableDlg + SCTAB nTabCount, bool bFromFile, int nId) = 0; + + virtual AbstractScSelEntryDlg * CreateScSelEntryDlg ( Window* pParent, // add for ScSelEntryDlg + sal_uInt16 nResId, + const String& aTitle, + const String& aLbTitle, + List& aEntryList, + int nId ) = 0; + virtual AbstractScLinkedAreaDlg * CreateScLinkedAreaDlg ( Window* pParent, int nId) = 0; //add for ScLinkedAreaDlg + + virtual AbstractScMetricInputDlg * CreateScMetricInputDlg ( Window* pParent, //add for ScMetricInputDlg + sal_uInt16 nResId, // derivative for every dialog! + long nCurrent, + long nDefault, + int nId , + FieldUnit eFUnit = FUNIT_MM, + sal_uInt16 nDecimals = 2, + long nMaximum = 1000, + long nMinimum = 0, + long nFirst = 1, + long nLast = 100 ) = 0; + + virtual AbstractScMoveTableDlg * CreateScMoveTableDlg( Window* pParent, //add for ScMoveTableDlg + const String& rDefault, + int nId ) = 0; + + virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, sal_uInt16 nFlags, int nId ) = 0; //add for ScNameCreateDlg + + virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList, //add for ScNamePasteDlg + int nId , sal_Bool bInsList=sal_True ) = 0; + + virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg + const SfxItemSet& rArgSet, sal_uInt16 nSourceTab , int nId ) = 0; + + virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId, + const ScDPLabelDataVector& rLabelVec, + const ScDPLabelData& rLabelData, + const ScDPFuncData& rFuncData ) = 0; + + virtual AbstractScDPSubtotalDlg * CreateScDPSubtotalDlg( Window* pParent, int nId, + ScDPObject& rDPObj, + const ScDPLabelData& rLabelData, + const ScDPFuncData& rFuncData, + const ScDPNameVec& rDataFields, + bool bEnableLayout ) = 0; + + virtual AbstractScDPNumGroupDlg * CreateScDPNumGroupDlg( Window* pParent, + int nId, + const ScDPNumGroupInfo& rInfo ) = 0; + + virtual AbstractScDPDateGroupDlg * CreateScDPDateGroupDlg( Window* pParent, + int nId, + const ScDPNumGroupInfo& rInfo, + sal_Int32 nDatePart, + const Date& rNullDate ) = 0; + + virtual AbstractScDPShowDetailDlg * CreateScDPShowDetailDlg( Window* pParent, int nId, + ScDPObject& rDPObj, + sal_uInt16 nOrient ) = 0; + + virtual AbstractScNewScenarioDlg * CreateScNewScenarioDlg ( Window* pParent, const String& rName, //add for ScNewScenarioDlg + int nId, + sal_Bool bEdit = false, sal_Bool bSheetProtected = false ) = 0; + virtual AbstractScShowTabDlg * CreateScShowTabDlg ( Window* pParent, int nId ) = 0; //add for ScShowTabDlg + + virtual AbstractScStringInputDlg * CreateScStringInputDlg ( Window* pParent, //add for ScStringInputDlg + const String& rTitle, + const String& rEditTitle, + const String& rDefault, + const rtl::OString& sHelpId, const rtl::OString& sEditHelpId, + int nId ) = 0; + + virtual AbstractScTabBgColorDlg * CreateScTabBgColorDlg ( Window* pParent, //add for ScTabBgColorDlg + const String& rTitle, //Dialog Title + const String& rTabBgColorNoColorText, //Label for no tab color + const Color& rDefaultColor, //Currently selected Color + const rtl::OString& , + int nId ) = 0; + + virtual AbstractScImportOptionsDlg * CreateScImportOptionsDlg ( Window* pParent, //add for ScImportOptionsDlg + int nId, + sal_Bool bAscii = sal_True, + const ScImportOptions* pOptions = NULL, + const String* pStrTitle = NULL, + sal_Bool bMultiByte = false, + sal_Bool bOnlyDbtoolsEncodings = false, + sal_Bool bImport = sal_True ) = 0; + + virtual SfxAbstractTabDialog * CreateScAttrDlg( SfxViewFrame* pFrame, //add for ScAttrDlg + Window* pParent, + const SfxItemSet* pCellAttrs, + int nId) = 0; + + virtual SfxAbstractTabDialog * CreateScHFEditDlg( SfxViewFrame* pFrame, //add for ScHFEditDlg + Window* pParent, + const SfxItemSet& rCoreSet, + const String& rPageStyle, + int nId, + sal_uInt16 nResId = RID_SCDLG_HFEDIT ) = 0; + + virtual SfxAbstractTabDialog * CreateScStyleDlg( Window* pParent,//add for ScStyleDlg + SfxStyleSheetBase& rStyleBase, + sal_uInt16 nRscId, + int nId) = 0; + + virtual SfxAbstractTabDialog * CreateScSubTotalDlg( Window* pParent, //add for ScSubTotalDlg + const SfxItemSet* pArgSet, + int nId) = 0; + + virtual SfxAbstractTabDialog * CreateScCharDlg( Window* pParent, const SfxItemSet* pAttr,//add for ScCharDlg + const SfxObjectShell* pDocShell, int nId ) = 0; + + virtual SfxAbstractTabDialog * CreateScParagraphDlg( Window* pParent, const SfxItemSet* pAttr ,//add for ScParagraphDlg + int nId ) = 0; + + virtual SfxAbstractTabDialog * CreateScValidationDlg( Window* pParent, //add for ScValidationDlg + const SfxItemSet* pArgSet,int nId, ScTabViewShell *pTabVwSh ) = 0; + virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg + const SfxItemSet* pArgSet,int nId ) = 0; + // for tabpage + virtual CreateTabPage GetTabPageCreatorFunc( sal_uInt16 nId ) = 0; + virtual GetTabPageRanges GetTabPageRangesFunc( sal_uInt16 nId ) = 0; +}; +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/sccommands.h b/sc/inc/sccommands.h new file mode 100644 index 000000000000..98c26150305e --- /dev/null +++ b/sc/inc/sccommands.h @@ -0,0 +1,336 @@ +/*************************************************************************
+ *
+ * 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.
+ *
+ ************************************************************************/
+#ifndef SC_SCCOMMANDS_HRC
+#define SC_SCCOMMANDS_HRC
+
+#define CMD_FID_CHG_ACCEPT ".uno:AcceptChanges"
+#define CMD_SID_OLE_ACTIVATE ".uno:ActivateOLE"
+#define CMD_SID_TABLE_ACTIVATE ".uno:ActivateTable"
+#define CMD_SID_SC_ACTIVECELL ".uno:ActiveCell"
+#define CMD_SID_SC_ACTIVETAB ".uno:ActiveTable"
+#define CMD_FID_TAB_APPEND ".uno:Add"
+#define CMD_SID_CHART_ADDSOURCE ".uno:AddChartData"
+#define CMD_SID_ADD_IN_MANAGER ".uno:AddInManager"
+#define CMD_SID_ADD_PRINTAREA ".uno:AddPrintArea"
+#define CMD_SID_RANGE_ADDRESS ".uno:Address"
+#define CMD_FID_ADJUST_PRINTZOOM ".uno:AdjustPrintZoom"
+#define CMD_SID_ALIGNBLOCK ".uno:AlignBlock"
+#define CMD_SID_ALIGNBOTTOM ".uno:AlignBottom"
+#define CMD_SID_ALIGNCENTERHOR ".uno:AlignHorizontalCenter"
+#define CMD_SID_ALIGNLEFT ".uno:AlignLeft"
+#define CMD_SID_ALIGNRIGHT ".uno:AlignRight"
+#define CMD_SID_ALIGNTOP ".uno:AlignTop"
+#define CMD_SID_ALIGNCENTERVER ".uno:AlignVCenter"
+#define CMD_FID_APPLY_NAME ".uno:ApplyNames"
+#define CMD_SID_DETECTIVE_FILLMODE ".uno:AuditingFillMode"
+#define CMD_FID_AUTOCOMPLETE ".uno:AutoComplete"
+#define CMD_FID_FILL_AUTO ".uno:AutoFill"
+#define CMD_FID_AUTO_CALC ".uno:AutomaticCalculation"
+#define CMD_SID_AUTO_OUTLINE ".uno:AutoOutline"
+#define CMD_SID_DETECTIVE_AUTO ".uno:AutoRefreshArrows"
+#define CMD_SID_AUTO_STYLE ".uno:AutoStyle"
+#define CMD_FID_RECALC ".uno:Calculate"
+#define CMD_FID_HARD_RECALC ".uno:CalculateHard"
+#define CMD_SID_CANCEL ".uno:Cancel"
+#define CMD_SID_SC_CELLS ".uno:Cells"
+#define CMD_SID_SC_CELLTEXT ".uno:CellText"
+#define CMD_SID_CHART_SOURCE ".uno:ChangeChartData"
+#define CMD_SID_CHANGE_PRINTAREA ".uno:ChangePrintArea"
+#define CMD_SID_CHOOSE_DESIGN ".uno:ChooseDesign"
+#define CMD_SID_DETECTIVE_DEL_SUCC ".uno:ClearArrowDependents"
+#define CMD_SID_DETECTIVE_DEL_PRED ".uno:ClearArrowPrecedents"
+#define CMD_SID_DETECTIVE_DEL_ALL ".uno:ClearArrows"
+#define CMD_SID_DELETE_CONTENTS ".uno:ClearContents"
+#define CMD_SID_RANGE_COL ".uno:Column"
+#define CMD_FID_COL_WIDTH ".uno:ColumnWidth"
+#define CMD_FID_CHG_COMMENT ".uno:CommentChange"
+#define CMD_FID_CONDITIONAL_FORMAT ".uno:ConditionalFormat"
+#define CMD_SID_OPENDLG_CONDFRMT ".uno:ConditionalFormatDialog"
+#define CMD_SID_CONSOLIDATE ".uno:ConsolidateExec"
+#define CMD_FID_USE_NAME ".uno:CreateNames"
+#define CMD_SID_CREATE_SW_DRAWVIEW ".uno:CreateSWDrawView"
+#define CMD_SID_RANGE_REGION ".uno:CurrentRegion"
+#define CMD_SID_REFRESH_DBAREA ".uno:DataAreaRefresh"
+#define CMD_SID_OPENDLG_CONSOLIDATE ".uno:DataConsolidate"
+#define CMD_SID_OPENDLG_PIVOTTABLE ".uno:DataDataPilotRun"
+#define CMD_SID_AUTO_FILTER ".uno:DataFilterAutoFilter"
+#define CMD_SID_AUTOFILTER_HIDE ".uno:DataFilterHideAutoFilter"
+#define CMD_SID_UNFILTER ".uno:DataFilterRemoveFilter"
+#define CMD_SID_SPECIAL_FILTER ".uno:DataFilterSpecialFilter"
+#define CMD_SID_FILTER ".uno:DataFilterStandardFilter"
+#define CMD_SID_IMPORT_DATA ".uno:DataImport"
+#define CMD_SID_PIVOT_CREATE ".uno:DataPilotCreate"
+#define CMD_SID_PIVOT_TABLE ".uno:DataPilotExec"
+#define CMD_SID_PIVOT_GET ".uno:DataPilotTables"
+#define CMD_SID_REIMPORT_DATA ".uno:DataReImport"
+#define CMD_SID_DATA_SELECT ".uno:DataSelect"
+#define CMD_SID_SORT ".uno:DataSort"
+#define CMD_SID_SUBTOTALS ".uno:DataSubTotals"
+#define CMD_SID_OLE_DEACTIVATE ".uno:Deactivate"
+#define CMD_SID_DEFINE_DBNAME ".uno:DefineDBName"
+#define CMD_SID_DEFINE_COLROWNAMERANGES ".uno:DefineLabelRange"
+#define CMD_FID_DEFINE_NAME ".uno:DefineName"
+#define CMD_SID_DEFINE_PRINTAREA ".uno:DefinePrintArea"
+#define CMD_FID_DELETE_CELL ".uno:DeleteCell"
+#define CMD_FID_DEL_MANUALBREAKS ".uno:DeleteAllBreaks"
+#define CMD_FID_DEL_COLBRK ".uno:DeleteColumnbreak"
+#define CMD_SID_DEL_COLS ".uno:DeleteColumns"
+#define CMD_SID_PIVOT_KILL ".uno:DeletePivotTable"
+#define CMD_SID_DELETE_PRINTAREA ".uno:DeletePrintArea"
+#define CMD_FID_DEL_ROWBRK ".uno:DeleteRowbreak"
+#define CMD_SID_DEL_ROWS ".uno:DeleteRows"
+#define CMD_SID_DELETE_SCENARIO ".uno:DeleteScenario"
+#define CMD_SID_SELECT_NONE ".uno:Deselect"
+#define CMD_SID_DRAW_CHART ".uno:DrawChart"
+#define CMD_SID_DRAW_NOTEEDIT ".uno:DrawEditNote"
+#define CMD_SID_HFEDIT ".uno:EditHeaderAndFooter"
+#define CMD_SID_LINKS ".uno:EditLinks"
+#define CMD_SID_SC_EDIT_OBJECT ".uno:EditObject"
+#define CMD_SID_OPENDLG_EDIT_PRINTAREA ".uno:EditPrintArea"
+#define CMD_SID_EDIT_SCENARIO ".uno:EditScenario"
+#define CMD_SID_EURO_CONVERTER ".uno:EuroConverter"
+#define CMD_FID_FILL_TO_BOTTOM ".uno:FillDown"
+#define CMD_FID_FILL_TO_LEFT ".uno:FillLeft"
+#define CMD_SID_FILL_NONE ".uno:FillModeEnd"
+#define CMD_SID_FILL_DEL_PRED ".uno:FillModeRemovePredescessor"
+#define CMD_SID_FILL_DEL_SUCC ".uno:FillModeRemoveSuccessor"
+#define CMD_SID_FILL_SELECT ".uno:FillModeSelect"
+#define CMD_SID_FILL_ADD_PRED ".uno:FillModeTracePredescessor"
+#define CMD_SID_FILL_ADD_SUCC ".uno:FillModeTraceSuccessor"
+#define CMD_FID_FILL_TO_RIGHT ".uno:FillRight"
+#define CMD_FID_FILL_SERIES ".uno:FillSeries"
+#define CMD_FID_FILL_TAB ".uno:FillTable"
+#define CMD_FID_FILL_TO_TOP ".uno:FillUp"
+#define CMD_FID_FILTER_OK ".uno:FilterExecute"
+#define CMD_SID_PREVIEW_FIRST ".uno:FirstPage"
+#define CMD_FID_FOCUS_POSWND ".uno:FocusCellAddress"
+#define CMD_FID_CELL_FORMAT ".uno:FormatCellDialog"
+#define CMD_SID_RANGE_FORMULA ".uno:Formula"
+#define CMD_SID_WINDOW_FIX ".uno:FreezePanes"
+#define CMD_FID_FUNCTION_BOX ".uno:FunctionBox"
+#define CMD_SID_OPENDLG_FUNCTION ".uno:FunctionDialog"
+#define CMD_SID_SOLVE ".uno:GoalSeek"
+#define CMD_SID_OPENDLG_SOLVE ".uno:GoalSeekDialog"
+#define CMD_SID_OPENDLG_OPTSOLVER ".uno:SolverDialog"
+#define CMD_SID_VALIDITY_REFERENCE ".uno:ValidityReference"
+#define CMD_SID_CURSORBLKDOWN ".uno:GoDownToEndOfData"
+#define CMD_SID_CURSORBLKDOWN_SEL ".uno:GoDownToEndOfDataSel"
+#define CMD_SID_CURSORPAGELEFT_ ".uno:GoLeftBlock"
+#define CMD_SID_CURSORBLKLEFT ".uno:GoLeftToStartOfData"
+#define CMD_SID_CURSORBLKLEFT_SEL ".uno:GoLeftToStartOfDataSel"
+#define CMD_SID_CURSORPAGERIGHT_ ".uno:GoRightBlock"
+#define CMD_SID_CURSORPAGERIGHT_SEL ".uno:GoRightBlockSel"
+#define CMD_SID_CURSORBLKRIGHT ".uno:GoRightToEndOfData"
+#define CMD_SID_CURSORBLKRIGHT_SEL ".uno:GoRightToEndOfDataSel"
+#define CMD_SID_CURRENTCELL ".uno:GoToCell"
+#define CMD_SID_ALIGNCURSOR ".uno:GoToCurrentCell"
+#define CMD_SID_CURRENTDOC ".uno:GotoDocument"
+#define CMD_SID_CURRENTOBJECT ".uno:GoToObject"
+#define CMD_SID_CURSORBLKUP ".uno:GoUpToStartOfData"
+#define CMD_SID_CURSORBLKUP_SEL ".uno:GoUpToStartOfDataSel"
+#define CMD_FID_TABLE_HIDE ".uno:Hide"
+#define CMD_FID_COL_HIDE ".uno:HideColumn"
+#define CMD_FID_ROW_HIDE ".uno:HideRow"
+#define CMD_SID_H_ALIGNCELL ".uno:HorizontalAlignment"
+#define CMD_SID_ENABLE_HYPHENATION ".uno:Hyphenate"
+#define CMD_FID_INPUTLINE_BLOCK ".uno:InputLineBlock"
+#define CMD_FID_INPUTLINE_ENTER ".uno:InputLineEnter"
+#define CMD_FID_INPUTLINE_MATRIX ".uno:InputLineMatrix"
+#define CMD_SID_TBXCTL_INSCELLS ".uno:InsCellsCtrl"
+#define CMD_FID_INS_TABLE ".uno:Insert"
+#define CMD_FID_INS_TABLE_EXT ".uno:InsertSheetFromFile"
+#define CMD_FID_INS_CELL ".uno:InsertCell"
+#define CMD_FID_INS_CELLSDOWN ".uno:InsertCellsDown"
+#define CMD_FID_INS_CELLSRIGHT ".uno:InsertCellsRight"
+#define CMD_FID_INS_COLBRK ".uno:InsertColumnBreak"
+#define CMD_FID_INS_COLUMN ".uno:InsertColumns"
+#define CMD_FID_INS_CELL_CONTENTS ".uno:InsertContents"
+#define CMD_SID_TBXCTL_INSERT ".uno:InsertCtrl"
+#define CMD_SID_EXTERNAL_SOURCE ".uno:InsertExternalDataSource"
+#define CMD_FID_INSERT_FILE ".uno:InsertFile"
+#define CMD_SID_INS_FUNCTION ".uno:InsertFunction"
+#define CMD_SID_INSERT_MATRIX ".uno:InsertMatrix"
+#define CMD_FID_INSERT_NAME ".uno:InsertName"
+#define CMD_SID_INSERT_SIMAGE ".uno:InsertObjectStarImage"
+#define CMD_SID_INSERT_SMATH ".uno:InsertObjectStarMath"
+#define CMD_FID_INS_ROWBRK ".uno:InsertRowBreak"
+#define CMD_FID_INS_ROW ".uno:InsertRows"
+#define CMD_SID_TBXCTL_INSOBJ ".uno:InsObjCtrl"
+#define CMD_SID_CURSORENTERDOWN ".uno:JumpToNextCell"
+#define CMD_SID_NEXT_TABLE ".uno:JumpToNextTable"
+#define CMD_SID_NEXT_TABLE_SEL ".uno:JumpToNextTableSel"
+#define CMD_SID_NEXT_UNPROTECT ".uno:JumpToNextUnprotected"
+#define CMD_SID_CURSORENTERUP ".uno:JumpToPreviousCell"
+#define CMD_SID_PREV_UNPROTECT ".uno:JumpToPreviousUnprotected"
+#define CMD_SID_PREV_TABLE ".uno:JumpToPrevTable"
+#define CMD_SID_PREV_TABLE_SEL ".uno:JumpToPrevTableSel"
+#define CMD_SID_CURRENTTAB ".uno:JumpToTable"
+#define CMD_SID_PREVIEW_LAST ".uno:LastPage"
+#define CMD_FID_MERGE_ON ".uno:MergeCells"
+#define CMD_FID_MERGE_TOGGLE ".uno:ToggleMergeCells"
+#define CMD_SID_OBJECT_MIRROR ".uno:Mirror"
+#define CMD_FID_TAB_MOVE ".uno:Move"
+#define CMD_FID_TAB_RENAME ".uno:Name"
+#define CMD_SID_PREVIEW_NEXT ".uno:NextPage"
+#define CMD_SID_RANGE_NOTETEXT ".uno:NoteText"
+#define CMD_FID_NOTE_VISIBLE ".uno:NoteVisible"
+#define CMD_SID_DELETE_NOTE ".uno:DeleteNote"
+#define CMD_SID_NUMBER_FORMAT ".uno:NumberFormat"
+#define CMD_SID_NUMBER_CURRENCY ".uno:NumberFormatCurrency"
+#define CMD_SID_NUMBER_DATE ".uno:NumberFormatDate"
+#define CMD_SID_NUMBER_DECDEC ".uno:NumberFormatDecDecimals"
+#define CMD_SID_NUMBER_TWODEC ".uno:NumberFormatDecimal"
+#define CMD_SID_NUMBER_INCDEC ".uno:NumberFormatIncDecimals"
+#define CMD_SID_NUMBER_PERCENT ".uno:NumberFormatPercent"
+#define CMD_SID_NUMBER_SCIENTIFIC ".uno:NumberFormatScientific"
+#define CMD_SID_NUMBER_STANDARD ".uno:NumberFormatStandard"
+#define CMD_SID_NUMBER_TIME ".uno:NumberFormatTime"
+#define CMD_SID_OBJECT_HEIGHT ".uno:ObjectHeight"
+#define CMD_SID_OBJECT_LEFT ".uno:ObjectLeft"
+#define CMD_SID_MIRROR_HORIZONTAL ".uno:ObjectMirrorHorizontal"
+#define CMD_SID_MIRROR_VERTICAL ".uno:ObjectMirrorVertical"
+#define CMD_SID_OBJECT_TOP ".uno:ObjectTop"
+#define CMD_SID_OBJECT_WIDTH ".uno:ObjectWidth"
+#define CMD_SID_RANGE_OFFSET ".uno:Offset"
+#define CMD_SID_OLE_OBJECT ".uno:OleObject"
+#define CMD_SID_ORIGINALSIZE ".uno:OriginalSize"
+#define CMD_FID_NORMALVIEWMODE ".uno:NormalViewMode"
+#define CMD_FID_PAGEBREAKMODE ".uno:PagebreakMode"
+#define CMD_SID_FORMATPAGE ".uno:PageFormatDialog"
+#define CMD_SID_PREVIEW_PREVIOUS ".uno:PreviousPage"
+#define CMD_FID_PROTECT_TABLE ".uno:Protect"
+#define CMD_SID_CHG_PROTECT ".uno:ProtectTraceChangeMode"
+#define CMD_SID_SC_SETTEXT ".uno:PutCell"
+#define CMD_SID_SC_RANGE ".uno:Range"
+#define CMD_SID_PIVOT_RECALC ".uno:RecalcPivotTable"
+#define CMD_SID_DETECTIVE_REFRESH ".uno:RefreshArrows"
+#define CMD_SID_REIMPORT_AFTER_LOAD ".uno:ReImportAfterLoad"
+#define CMD_FID_DELETE_TABLE ".uno:Remove"
+#define CMD_SID_TITLE_DESCRIPTION_OBJECT ".uno:ObjectTitleDescription"
+#define CMD_SID_RENAME_OBJECT ".uno:RenameObject"
+#define CMD_FID_REPEAT_SEARCH ".uno:RepeatSearch"
+#define CMD_FID_REPLACE ".uno:Replace"
+#define CMD_FID_REPLACE_ALL ".uno:ReplaceAll"
+#define CMD_SID_CELL_FORMAT_RESET ".uno:ResetAttributes"
+#define CMD_FID_RESET_PRINTZOOM ".uno:ResetPrintZoom"
+#define CMD_SID_RANGE_ROW ".uno:Row"
+#define CMD_FID_ROW_HEIGHT ".uno:RowHeight"
+#define CMD_SID_SBA_IMPORT ".uno:SbaImport"
+#define CMD_FID_SCALE ".uno:Scale"
+#define CMD_SID_SCENARIOS ".uno:ScenarioManager"
+#define CMD_FID_SEARCH ".uno:Search"
+#define CMD_FID_SEARCH_ALL ".uno:SearchAll"
+#define CMD_SID_MARKAREA ".uno:SelectArea"
+#define CMD_SID_OLE_SELECT ".uno:SelectOLE"
+#define CMD_SID_SELECT_COL ".uno:SelectColumn"
+#define CMD_SID_MARKDATAAREA ".uno:SelectData"
+#define CMD_SID_SELECT_DB ".uno:SelectDB"
+#define CMD_SID_SC_ACTIVEOBJECT ".uno:SelectedObject"
+#define CMD_SID_ACTIVE_OBJ_NAME ".uno:SelectedObjectName"
+#define CMD_SID_SC_SELECTION ".uno:Selection"
+#define CMD_SID_SELECT_ROW ".uno:SelectRow"
+#define CMD_SID_SELECT_SCENARIO ".uno:SelectScenario"
+#define CMD_SID_ANCHOR_CELL ".uno:SetAnchorToCell"
+#define CMD_SID_ANCHOR_PAGE ".uno:SetAnchorToPage"
+#define CMD_SID_SETINPUTMODE ".uno:SetInputMode"
+#define CMD_FID_COL_OPT_WIDTH ".uno:SetOptimalColumnWidth"
+#define CMD_FID_COL_OPT_DIRECT ".uno:SetOptimalColumnWidthDirect"
+#define CMD_FID_ROW_OPT_HEIGHT ".uno:SetOptimalRowHeight"
+#define CMD_FID_TABLE_SHOW ".uno:Show"
+#define CMD_FID_CHG_SHOW ".uno:ShowChanges"
+#define CMD_FID_COL_SHOW ".uno:ShowColumn"
+#define CMD_SID_DETECTIVE_ADD_SUCC ".uno:ShowDependents"
+#define CMD_SID_DETECTIVE_ADD_ERR ".uno:ShowErrors"
+#define CMD_SID_DETECTIVE_INVALID ".uno:ShowInvalid"
+#define CMD_SID_DETECTIVE_ADD_PRED ".uno:ShowPrecedents"
+#define CMD_FID_ROW_SHOW ".uno:ShowRow"
+#define CMD_WID_SIMPLE_REF ".uno:SimpleReferenz"
+#define CMD_SID_SORT_ASCENDING ".uno:SortAscending"
+#define CMD_SID_SORT_DESCENDING ".uno:SortDescending"
+#define CMD_FID_MERGE_OFF ".uno:SplitCell"
+#define CMD_SID_WINDOW_SPLIT ".uno:SplitWindow"
+#define CMD_SID_STANDARD_FONTS ".uno:StandardFonts"
+#define CMD_SID_TEXT_STANDARD ".uno:StandardTextAttributes"
+#define CMD_SID_PSZ_FUNCTION ".uno:StatusBarFunc"
+#define CMD_SID_STATUS_DOCPOS ".uno:StatusDocPos"
+#define CMD_SID_STATUS_SUM ".uno:StatusFunction"
+#define CMD_FID_INPUTLINE_STATUS ".uno:StatusInputLine"
+#define CMD_SID_STATUS_PAGESTYLE ".uno:StatusPageStyle"
+#define CMD_FID_SCALESTATUS ".uno:StatusScale"
+#define CMD_SID_STATUS_SELMODE ".uno:StatusSelectionMode"
+#define CMD_SID_STATUS_SELMODE_ERG ".uno:StatusSelectionModeExp"
+#define CMD_SID_STATUS_SELMODE_ERW ".uno:StatusSelectionModeExt"
+#define CMD_SID_STATUS_SELMODE_NORM ".uno:StatusSelectionModeNorm"
+#define CMD_SID_RANGE_TABLE ".uno:Table"
+#define CMD_SID_TABLES_COUNT ".uno:TableCount"
+#define CMD_SID_TABOP ".uno:TableOperation"
+#define CMD_SID_OPENDLG_TABOP ".uno:TableOperationDialog"
+#define CMD_FID_TAB_MENU_RENAME ".uno:RenameTable"
+#define CMD_SID_TABLES_GET ".uno:Tables"
+#define CMD_FID_TAB_SELECTALL ".uno:TableSelectAll"
+#define CMD_FID_TAB_DESELECTALL ".uno:TableDeselectAll"
+#define CMD_SID_DRAWTEXT_ATTR_DLG ".uno:TextAttributes"
+#define CMD_SID_ASSIGNMACRO ".uno:AssignMacro"
+#define CMD_SID_TEXT_TO_COLUMNS ".uno:TextToColumns"
+#define CMD_SID_RANGE_TEXTVALUE ".uno:TextValue"
+#define CMD_SID_ANCHOR_TOGGLE ".uno:ToggleAnchorType"
+#define CMD_SID_TOGGLE_REL ".uno:ToggleRelative"
+#define CMD_FID_PROTECT_DOC ".uno:ToolProtectionDocument"
+#define CMD_SID_SCOPTIONS ".uno:ToolsOptions"
+#define CMD_FID_CHG_RECORD ".uno:TraceChangeMode"
+#define CMD_SID_ULINE_VAL_DOTTED ".uno:UnderlineDotted"
+#define CMD_SID_ULINE_VAL_DOUBLE ".uno:UnderlineDouble"
+#define CMD_SID_ULINE_VAL_NONE ".uno:UnderlineNone"
+#define CMD_SID_ULINE_VAL_SINGLE ".uno:UnderlineSingle"
+#define CMD_SID_UPDATECHART ".uno:UpdateChart"
+#define CMD_SID_UPDATETABLINKS ".uno:UpdateTableLinks"
+#define CMD_FID_VALIDATION ".uno:Validation"
+#define CMD_SID_RANGE_VALUE ".uno:Value"
+#define CMD_SID_V_ALIGNCELL ".uno:VerticalAlignment"
+#define CMD_FID_TOGGLEINPUTLINE ".uno:InputLineVisible"
+#define CMD_FID_TOGGLEHEADERS ".uno:ViewRowColumnHeaders"
+#define CMD_FID_TOGGLEFORMULA ".uno:ToggleFormula"
+#define CMD_FID_TOGGLESYNTAX ".uno:ViewValueHighlighting"
+#define CMD_FID_TABLE_VISIBLE ".uno:Visible"
+#define CMD_SID_ATTR_ALIGN_LINEBREAK ".uno:WrapText"
+#define CMD_SID_PREVIEW_ZOOMIN ".uno:ZoomIn"
+#define CMD_SID_PREVIEW_ZOOMOUT ".uno:ZoomOut"
+#define CMD_SID_FOCUS_INPUTLINE ".uno:FocusInputLine"
+#define CMD_SID_PREVIEW_CLOSE ".uno:ClosePreview"
+#define CMD_SID_PREVIEW_MARGIN ".uno:Margins"
+#define CMD_SID_PREVIEW_SCALINGFACTOR ".uno:ScalingFactor"
+#define CMD_SID_SELECT_TABLES ".uno:SelectTables"
+#define CMD_SID_DP_FILTER ".uno:DataPilotFilter"
+#define CMD_SID_SCATTR_PROTECTION ".uno:Protection"
+#define CMD_SID_MARKARRAYFORMULA ".uno:SelectArrayFormula"
+#define CMD_FID_TAB_RTL ".uno:SheetRightToLeft"
+#define CMD_SID_SHARE_DOC ".uno:ShareDocument"
+#define CMD_FID_TAB_EVENTS ".uno:TableEvents"
+#define CMD_FID_TAB_MENU_SET_TAB_BG_COLOR ".uno:SetTabBgColor"
+#define CMD_FID_TAB_SET_TAB_BG_COLOR ".uno:TabBgColor"
+
+#endif
diff --git a/sc/inc/scdll.hxx b/sc/inc/scdll.hxx new file mode 100644 index 000000000000..93cff7e5bad0 --- /dev/null +++ b/sc/inc/scdll.hxx @@ -0,0 +1,75 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCDLL_HXX +#define SC_SCDLL_HXX + +class ResMgr; +class SvFactory; +class SotFactory; +class StatusBar; +class SfxMedium; +class SfxFilter; + +#include <sfx2/sfxdefs.hxx> +#include <sfx2/module.hxx> +#include <sfx2/docfac.hxx> + +/** + * This class is a wrapper for a Load-On-Demand-DLL. One instance per + * SfxApplication will be created for the runtime of + * SfxApplication-subclass::Main(). + * + * Remember: Do export this class! It is used by the application. + */ +class ScDLL +{ +public: + // Ctor/Dtor must be linked to the application + ScDLL(); + ~ScDLL(); + + // static-init/exit-code must be linked to the application + static void LibInit(); // called from SfxApplication-subclass::Init() + static void LibExit(); // called from SfxApplication-subclass::Exit() + static void PreExit(); // muss vor LibExit gerufen werden + + // DLL-init/exit-code must be linked to the DLL only + static void Init(); // called directly after loading the DLL + static void Exit(); // called directly befor unloading the DLL + + static sal_uLong DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter, + SfxFilterFlags nMust, SfxFilterFlags nDont ); +}; + +#define SC_DLL() ( *(ScModule**) GetAppData(SHL_CALC) ) + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scdllapi.h b/sc/inc/scdllapi.h new file mode 100644 index 000000000000..d38db27f78ec --- /dev/null +++ b/sc/inc/scdllapi.h @@ -0,0 +1,16 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +#ifndef INCLUDED_SCDLLAPI_H +#define INCLUDED_SCDLLAPI_H + +#include "sal/types.h" + +#if defined(SC_DLLIMPLEMENTATION) +#define SC_DLLPUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define SC_DLLPUBLIC SAL_DLLPUBLIC_IMPORT +#endif +#define SC_DLLPRIVATE SAL_DLLPRIVATE + +#endif /* INCLUDED_SCDLLAPI_H */ + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scerrors.hxx b/sc/inc/scerrors.hxx new file mode 100644 index 000000000000..735f7ba12970 --- /dev/null +++ b/sc/inc/scerrors.hxx @@ -0,0 +1,78 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _SCERRORS_HXX +#define _SCERRORS_HXX + +#include <tools/errcode.hxx> + +// ERRCODE_CLASS_READ - file related, displays "Read-Error" in MsgBox +#define SCERR_IMPORT_CONNECT ( 1 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_OPEN ( 2 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_UNKNOWN ( 3 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_OUTOFMEM ( 4 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_UNKNOWN_WK ( 5 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FORMAT ( 6 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_NI ( 7 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_UNKNOWN_BIFF ( 8 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_NI_BIFF ( 9 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FILEPASSWD ( 10 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_INTERNAL ( 11 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_8K_LIMIT ( 12 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_OPEN_FM3 ( 13 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_WRONG_FM3 ( 14 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_INFOLOST ( 15 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FILE_ROWCOL ( 16 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCERR_IMPORT_FORMAT_ROWCOL ( 17 | ERRCODE_CLASS_READ | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_FILE_ROWCOL ( 18 | ERRCODE_CLASS_READ | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) + +// ERRCODE_CLASS_WRITE - file related, displays "Write-Error" in MsgBox +#define SCERR_EXPORT_CONNECT ( 1 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_DATA ( 2 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_ENCODING ( 3 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_FIELDWIDTH ( 4 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) +#define SCERR_EXPORT_SQLEXCEPTION ( 5 | ERRCODE_CLASS_WRITE | ERRCODE_AREA_SC ) + +// ERRCODE_CLASS_IMPORT - does not display "Read-Error" in MsgBox +#define SCWARN_IMPORT_RANGE_OVERFLOW ( 1 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_ROW_OVERFLOW ( 2 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_COLUMN_OVERFLOW ( 3 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_IMPORT_SHEET_OVERFLOW ( 4 | ERRCODE_CLASS_IMPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) + +// ERRCODE_CLASS_EXPORT - does not display "Write-Error" in MsgBox +#define SCWARN_EXPORT_NONCONVERTIBLE_CHARS ( 1 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_ASCII ( 2 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_MAXROW ( 3 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) +#define SCWARN_EXPORT_DATALOST ( 4 | ERRCODE_CLASS_EXPORT | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) + +// ERRCODE_CLASS_GENERAL +#define SCWARN_CORE_HARD_RECALC ( 1 | ERRCODE_CLASS_GENERAL | ERRCODE_WARNING_MASK | ERRCODE_AREA_SC ) + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx new file mode 100644 index 000000000000..c39a23cf029b --- /dev/null +++ b/sc/inc/scextopt.hxx @@ -0,0 +1,124 @@ +/* -*- 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. + * + ************************************************************************/ +#ifndef SC_SCEXTOPT_HXX +#define SC_SCEXTOPT_HXX + +#include <memory> +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include "global.hxx" +#include "rangelst.hxx" + +/** Extended settings for the document, used in import/export filters. */ +struct ScExtDocSettings +{ + String maGlobCodeName; /// Global codename (VBA module name). + double mfTabBarWidth; /// Width of the tabbar, relative to frame window width (0.0 ... 1.0). + sal_uInt32 mnLinkCnt; /// Recursive counter for loading external documents. + SCTAB mnDisplTab; /// Index of displayed sheet. + + explicit ScExtDocSettings(); +}; + +/** Enumerates possible positions of panes in split sheets. */ +enum ScExtPanePos +{ + SCEXT_PANE_TOPLEFT, /// Single, top, left, or top-left pane. + SCEXT_PANE_TOPRIGHT, /// Right, or top-right pane. + SCEXT_PANE_BOTTOMLEFT, /// Bottom, or bottom-left pane. + SCEXT_PANE_BOTTOMRIGHT /// Bottom-right pane. +}; + +/** Extended settings for a sheet, used in import/export filters. */ +struct ScExtTabSettings +{ + ScRange maUsedArea; /// Used area in the sheet (columns/rows only). + ScRangeList maSelection; /// Selected cell ranges (columns/rows only). + ScAddress maCursor; /// The cursor position (column/row only). + ScAddress maFirstVis; /// Top-left visible cell (column/row only). + ScAddress maSecondVis; /// Top-left visible cell in add. panes (column/row only). + ScAddress maFreezePos; /// Position of frozen panes (column/row only). + Point maSplitPos; /// Position of split. + ScExtPanePos meActivePane; /// Active (focused) pane. + Color maGridColor; /// Grid color. + long mnNormalZoom; /// Zoom in percent for normal view. + long mnPageZoom; /// Zoom in percent for pagebreak preview. + bool mbSelected; /// true = Sheet is selected. + bool mbFrozenPanes; /// true = Frozen panes; false = Normal splits. + bool mbPageMode; /// true = Pagebreak mode; false = Normal view mode. + bool mbShowGrid; /// Whether or not to display gridlines. + + explicit ScExtTabSettings(); +}; + +struct ScExtDocOptionsImpl; + +/** Extended options held by an ScDocument containing additional settings for filters. + + This object is owned by a Calc document. It contains global document settings + (struct ScExtDocSettings), settings for all sheets in the document + (struct ScExtTabSettings), and a list of codenames used for VBA import/export. + */ +class SC_DLLPUBLIC ScExtDocOptions +{ +public: + explicit ScExtDocOptions(); + ScExtDocOptions( const ScExtDocOptions& rSrc ); + ~ScExtDocOptions(); + + ScExtDocOptions& operator=( const ScExtDocOptions& rSrc ); + + /** Returns true, if the data needs to be copied to the view data after import. */ + bool IsChanged() const; + /** If set to true, the data will be copied to the view data after import. */ + void SetChanged( bool bChanged ); + + /** Returns read access to the global document settings. */ + const ScExtDocSettings& GetDocSettings() const; + /** Returns read/write access to the global document settings. */ + ScExtDocSettings& GetDocSettings(); + + /** Returns read access to the settings of a sheet, if extant; otherwise 0. */ + const ScExtTabSettings* GetTabSettings( SCTAB nTab ) const; + /** Returns read/write access to the settings of a sheet, may create a new struct. */ + ScExtTabSettings& GetOrCreateTabSettings( SCTAB nTab ); + + /** Returns the number of sheet codenames. */ + SCTAB GetCodeNameCount() const; + /** Returns the specified codename (empty string = no codename). */ + const String& GetCodeName( SCTAB nTab ) const; + /** Appends a codename for a sheet. */ + void SetCodeName( SCTAB nTab, const String& rCodeName ); + +private: + ::std::auto_ptr< ScExtDocOptionsImpl > mxImpl; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scfuncs.hrc b/sc/inc/scfuncs.hrc new file mode 100644 index 000000000000..c44e34fb46cd --- /dev/null +++ b/sc/inc/scfuncs.hrc @@ -0,0 +1,42 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +#include "sc.hrc" + +#define ID_FUNCTION_GRP_DATABASE 1 +#define ID_FUNCTION_GRP_DATETIME 2 +#define ID_FUNCTION_GRP_FINANZ 3 +#define ID_FUNCTION_GRP_INFO 4 +#define ID_FUNCTION_GRP_LOGIC 5 +#define ID_FUNCTION_GRP_MATH 6 +#define ID_FUNCTION_GRP_MATRIX 7 +#define ID_FUNCTION_GRP_STATISTIC 8 +#define ID_FUNCTION_GRP_TABLE 9 +#define ID_FUNCTION_GRP_TEXT 10 +#define ID_FUNCTION_GRP_ADDINS 11 + +#define ID_FUNCTION_OFFSET 90 + diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx new file mode 100644 index 000000000000..e644854373f0 --- /dev/null +++ b/sc/inc/scitems.hxx @@ -0,0 +1,197 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_ITEMS_HXX +#define SC_ITEMS_HXX + +#include <svx/svxids.hrc> + +// EditEngine is not allowed to define it's own ITEMID's +#define _EEITEMID_HXX + +//-------------------------- +// Item-IDs for UI-MsgPool: +//-------------------------- + +//! shall be moved to the below-1000 range! + +#define MSGPOOL_START 1100 +//-------------------------------------- +#define SCITEM_STRING 1100 +#define SCITEM_SEARCHDATA 1101 +#define SCITEM_SORTDATA 1102 +#define SCITEM_QUERYDATA 1103 +#define SCITEM_SUBTDATA 1104 +#define SCITEM_CONSOLIDATEDATA 1105 +#define SCITEM_PIVOTDATA 1106 +#define SCITEM_SOLVEDATA 1107 +#define SCITEM_USERLIST 1108 +#define SCITEM_PRINTWARN 1109 +//-------------------------------------- +#define MSGPOOL_END 1109 + +//------------------------- +// Item-IDs for attributes: +//------------------------- +#define ATTR_STARTINDEX 100 // begin of attributes + +#define ATTR_PATTERN_START 100 // begin of cell-attribute-pattern + +#define ATTR_FONT 100 // begin of cell-attributes +#define ATTR_FONT_HEIGHT 101 +#define ATTR_FONT_WEIGHT 102 +#define ATTR_FONT_POSTURE 103 +#define ATTR_FONT_UNDERLINE 104 +#define ATTR_FONT_OVERLINE 105 +#define ATTR_FONT_CROSSEDOUT 106 +#define ATTR_FONT_CONTOUR 107 +#define ATTR_FONT_SHADOWED 108 +#define ATTR_FONT_COLOR 109 +#define ATTR_FONT_LANGUAGE 110 +#define ATTR_CJK_FONT 111 +#define ATTR_CJK_FONT_HEIGHT 112 +#define ATTR_CJK_FONT_WEIGHT 113 +#define ATTR_CJK_FONT_POSTURE 114 +#define ATTR_CJK_FONT_LANGUAGE 115 +#define ATTR_CTL_FONT 116 +#define ATTR_CTL_FONT_HEIGHT 117 +#define ATTR_CTL_FONT_WEIGHT 118 +#define ATTR_CTL_FONT_POSTURE 119 +#define ATTR_CTL_FONT_LANGUAGE 120 +#define ATTR_FONT_EMPHASISMARK 121 +#define ATTR_USERDEF 122 // not saved in binary files +#define ATTR_FONT_WORDLINE 123 +#define ATTR_FONT_RELIEF 124 +#define ATTR_HYPHENATE 125 +#define ATTR_SCRIPTSPACE 126 +#define ATTR_HANGPUNCTUATION 127 +#define ATTR_FORBIDDEN_RULES 128 +#define ATTR_HOR_JUSTIFY 129 +#define ATTR_HOR_JUSTIFY_METHOD 130 +#define ATTR_INDENT 131 +#define ATTR_VER_JUSTIFY 132 +#define ATTR_VER_JUSTIFY_METHOD 133 +#define ATTR_STACKED 134 +#define ATTR_ROTATE_VALUE 135 +#define ATTR_ROTATE_MODE 136 +#define ATTR_VERTICAL_ASIAN 137 +#define ATTR_WRITINGDIR 138 +#define ATTR_LINEBREAK 139 +#define ATTR_SHRINKTOFIT 140 +#define ATTR_BORDER_TLBR 141 +#define ATTR_BORDER_BLTR 142 +#define ATTR_MARGIN 143 +#define ATTR_MERGE 144 +#define ATTR_MERGE_FLAG 145 +#define ATTR_VALUE_FORMAT 146 +#define ATTR_LANGUAGE_FORMAT 147 +#define ATTR_BACKGROUND 148 +#define ATTR_PROTECTION 149 +#define ATTR_BORDER 150 +#define ATTR_BORDER_INNER 151 // inside, because of template-EditDialog +#define ATTR_SHADOW 152 +#define ATTR_VALIDDATA 153 +#define ATTR_CONDITIONAL 154 + +#define ATTR_PATTERN_END 154 // end cell-attribute-pattern + +#define ATTR_PATTERN 155 + // page attributes +#define ATTR_LRSPACE 156 // editor: PageDesc-TabPage +#define ATTR_ULSPACE 157 +#define ATTR_PAGE 158 +#define ATTR_PAGE_PAPERTRAY 159 +#define ATTR_PAGE_PAPERBIN 160 +#define ATTR_PAGE_SIZE 161 +#define ATTR_PAGE_MAXSIZE 162 +#define ATTR_PAGE_HORCENTER 163 +#define ATTR_PAGE_VERCENTER 164 + +#define ATTR_PAGE_ON 165 // editor: header/footer-page +#define ATTR_PAGE_DYNAMIC 166 +#define ATTR_PAGE_SHARED 167 + +#define ATTR_PAGE_NOTES 168 // editor: table +#define ATTR_PAGE_GRID 169 +#define ATTR_PAGE_HEADERS 170 +#define ATTR_PAGE_CHARTS 171 +#define ATTR_PAGE_OBJECTS 172 +#define ATTR_PAGE_DRAWINGS 173 +#define ATTR_PAGE_TOPDOWN 174 +#define ATTR_PAGE_SCALE 175 +#define ATTR_PAGE_SCALETOPAGES 176 +#define ATTR_PAGE_FIRSTPAGENO 177 + +#define ATTR_PAGE_PRINTAREA 178 // editor: print areas +#define ATTR_PAGE_REPEATROW 179 +#define ATTR_PAGE_REPEATCOL 180 +#define ATTR_PAGE_PRINTTABLES 181 + +#define ATTR_PAGE_HEADERLEFT 182 // contents of header/ +#define ATTR_PAGE_FOOTERLEFT 183 // footer (left) +#define ATTR_PAGE_HEADERRIGHT 184 // contents of header/ +#define ATTR_PAGE_FOOTERRIGHT 185 // footer (right) +#define ATTR_PAGE_HEADERSET 186 // the corresponding sets +#define ATTR_PAGE_FOOTERSET 187 + +#define ATTR_PAGE_FORMULAS 188 +#define ATTR_PAGE_NULLVALS 189 + +#define ATTR_PAGE_SCALETO 190 // #i8868# scale printout to width/height + +#define ATTR_ENDINDEX ATTR_PAGE_SCALETO // end of pool-range + +//-------------------------------- +// Dummy Slot-IDs for dialogs +//-------------------------------- +#define SID_SCATTR_PAGE_NOTES ATTR_PAGE_NOTES +#define SID_SCATTR_PAGE_GRID ATTR_PAGE_GRID +#define SID_SCATTR_PAGE_HEADERS ATTR_PAGE_HEADERS +#define SID_SCATTR_PAGE_CHARTS ATTR_PAGE_CHARTS +#define SID_SCATTR_PAGE_OBJECTS ATTR_PAGE_OBJECTS +#define SID_SCATTR_PAGE_DRAWINGS ATTR_PAGE_DRAWINGS +#define SID_SCATTR_PAGE_TOPDOWN ATTR_PAGE_TOPDOWN +#define SID_SCATTR_PAGE_SCALE ATTR_PAGE_SCALE +#define SID_SCATTR_PAGE_SCALETOPAGES ATTR_PAGE_SCALETOPAGES +#define SID_SCATTR_PAGE_FIRSTPAGENO ATTR_PAGE_FIRSTPAGENO +#define SID_SCATTR_PAGE_PRINTAREA ATTR_PAGE_PRINTAREA +#define SID_SCATTR_PAGE_REPEATROW ATTR_PAGE_REPEATROW +#define SID_SCATTR_PAGE_REPEATCOL ATTR_PAGE_REPEATCOL +#define SID_SCATTR_PAGE_PRINTTABLES ATTR_PAGE_PRINTTABLES +#define SID_SCATTR_PAGE_HEADERLEFT ATTR_PAGE_HEADERLEFT +#define SID_SCATTR_PAGE_FOOTERLEFT ATTR_PAGE_FOOTERLEFT +#define SID_SCATTR_PAGE_HEADERRIGHT ATTR_PAGE_HEADERRIGHT +#define SID_SCATTR_PAGE_FOOTERRIGHT ATTR_PAGE_FOOTERRIGHT +#define SID_SCATTR_PAGE_FORMULAS ATTR_PAGE_FORMULAS +#define SID_SCATTR_PAGE_NULLVALS ATTR_PAGE_NULLVALS +#define SID_SCATTR_PAGE_SCALETO ATTR_PAGE_SCALETO + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx new file mode 100644 index 000000000000..8e14c4694d8a --- /dev/null +++ b/sc/inc/scmatrix.hxx @@ -0,0 +1,383 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_MATRIX_HXX +#define SC_MATRIX_HXX + +#include "global.hxx" +#include "types.hxx" +#include "formula/errorcodes.hxx" +#include <tools/string.hxx> +#include "scdllapi.h" + +#include <boost/intrusive_ptr.hpp> + +class SvStream; +class ScInterpreter; +class SvNumberFormatter; +class ScMatrixImpl; + +typedef sal_uInt8 ScMatValType; +const ScMatValType SC_MATVAL_VALUE = 0x00; +const ScMatValType SC_MATVAL_BOOLEAN = 0x01; +const ScMatValType SC_MATVAL_STRING = 0x02; +const ScMatValType SC_MATVAL_EMPTY = SC_MATVAL_STRING | 0x04; // STRING plus flag +const ScMatValType SC_MATVAL_EMPTYPATH = SC_MATVAL_EMPTY | 0x08; // EMPTY plus flag +const ScMatValType SC_MATVAL_NONVALUE = SC_MATVAL_EMPTYPATH; // mask of all non-value bits + +struct ScMatrixValue +{ + union { + double fVal; + const String* pS; + }; + ScMatValType nType; + + /// Only valid if ScMatrix methods indicate so! + const String& GetString() const { return pS ? *pS : EMPTY_STRING; } + + /// Only valid if ScMatrix methods indicate that this is no string! + sal_uInt16 GetError() const { return GetDoubleErrorValue( fVal); } + + /// Only valid if ScMatrix methods indicate that this is a boolean + bool GetBoolean() const { return fVal != 0.0; } + + ScMatrixValue() : fVal(0.0), nType(SC_MATVAL_EMPTY) {} + + ScMatrixValue(const ScMatrixValue& r) : fVal(r.fVal), nType(r.nType) + { + if (nType == SC_MATVAL_STRING) + // This is probably not necessary but just in case... + pS = r.pS; + } + + bool operator== (const ScMatrixValue& r) const + { + if (nType != r.nType) + return false; + + switch (nType) + { + case SC_MATVAL_VALUE: + case SC_MATVAL_BOOLEAN: + return fVal == r.fVal; + break; + default: + ; + } + if (!pS) + return r.pS == NULL; + + return GetString().Equals(r.GetString()); + } + + bool operator!= (const ScMatrixValue& r) const + { + return !operator==(r); + } + + ScMatrixValue& operator= (const ScMatrixValue& r) + { + nType = r.nType; + fVal = r.fVal; + + if (nType == SC_MATVAL_STRING) + // This is probably not necessary but just in case... + pS = r.pS; + + return *this; + } +}; + +/** + * Matrix data type that can store values of mixed types. Each element can + * be one of the following types: numeric, string, boolean, empty, and empty + * path. + * + * This class also supports four different density types: filled zero, + * filled empty, sparse zero, and sparse empty. The filled density type + * allocates memory for every single element at all times, whereas the + * sparse density types allocates memory only for non-default elements. + */ +class SC_DLLPUBLIC ScMatrix +{ + ScMatrixImpl* pImpl; + mutable size_t nRefCnt; // reference count + + // only delete via Delete() + ~ScMatrix(); + + // not implemented, prevent usage + ScMatrix( const ScMatrix& ); + ScMatrix& operator=( const ScMatrix&); + +public: + enum DensityType + { + FILLED_ZERO, + FILLED_EMPTY, + SPARSE_ZERO, + SPARSE_EMPTY + }; + + /** + * When adding all numerical matrix elements for a scalar result such as + * summation, the interpreter wants to separate the first non-zero value + * with the rest of the summed values. + * + * TODO: Find out if we still need to do this. If not, we can re-write + * ScInterpreter::IterateParameters() to make it simpler and remove this + * struct. + */ + struct IterateResult + { + double mfFirst; + double mfRest; + size_t mnCount; + + IterateResult(double fFirst, double fRest, size_t nCount) : + mfFirst(fFirst), mfRest(fRest), mnCount(nCount) {} + + IterateResult(const IterateResult& r) : + mfFirst(r.mfFirst), mfRest(r.mfRest), mnCount(r.mnCount) {} + }; + + /// The maximum number of elements a matrix may have at runtime. + inline static size_t GetElementsMax() + { + // Roughly 125MB in total, divided by 8+1 per element => 14M elements. + const size_t nMemMax = 0x08000000 / (sizeof(ScMatrixValue) + sizeof(ScMatValType)); + // With MAXROWCOUNT==65536 and 128 columns => 8M elements ~72MB. + const size_t nArbitraryLimit = (size_t)MAXROWCOUNT * 128; + // Stuffed with a million rows would limit this to 14 columns. + return nMemMax < nArbitraryLimit ? nMemMax : nArbitraryLimit; + } + + /// Value or boolean. + inline static bool IsValueType( ScMatValType nType ) + { + return nType <= SC_MATVAL_BOOLEAN; + } + + /// Boolean. + inline static bool IsBooleanType( ScMatValType nType ) + { + return nType == SC_MATVAL_BOOLEAN; + } + + /// String, empty or empty path, but not value nor boolean. + inline static bool IsNonValueType( ScMatValType nType ) + { + return (nType & SC_MATVAL_NONVALUE) != 0; + } + + /** String, but not empty or empty path or any other type. + Not named IsStringType to prevent confusion because previously + IsNonValueType was named IsStringType. */ + inline static bool IsRealStringType( ScMatValType nType ) + { + return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_STRING; + } + + /// Empty, but not empty path or any other type. + inline static bool IsEmptyType( ScMatValType nType ) + { + return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_EMPTY; + } + + /// Empty path, but not empty or any other type. + inline static bool IsEmptyPathType( ScMatValType nType ) + { + return (nType & SC_MATVAL_NONVALUE) == SC_MATVAL_EMPTYPATH; + } + + ScMatrix( SCSIZE nC, SCSIZE nR, DensityType eType = FILLED_ZERO); + + /** Clone the matrix. */ + ScMatrix* Clone() const; + ScMatrix* Clone( DensityType eType) const; + + /** Clone the matrix if mbCloneIfConst (immutable) is set, otherwise + return _this_ matrix, to be assigned to a ScMatrixRef. */ + ScMatrix* CloneIfConst(); + + /** Set the matrix to (im)mutable for CloneIfConst(), only the interpreter + should do this and know the consequences. */ + void SetImmutable( bool bVal ); + + /** + * Resize the matrix to specified new dimension. + */ + void Resize( SCSIZE nC, SCSIZE nR); + + /** Clone the matrix and extend it to the new size. nNewCols and nNewRows + MUST be at least of the size of the original matrix. */ + ScMatrix* CloneAndExtend( SCSIZE nNewCols, SCSIZE nNewRows, DensityType eType) const; + + inline void IncRef() const + { + ++nRefCnt; + } + inline void DecRef() const + { + --nRefCnt; + if (nRefCnt == 0) + delete this; + } + + DensityType GetDensityType() const; + void SetErrorInterpreter( ScInterpreter* p); + void GetDimensions( SCSIZE& rC, SCSIZE& rR) const; + SCSIZE GetElementCount() const; + bool ValidColRow( SCSIZE nC, SCSIZE nR) const; + SCSIZE CalcOffset( SCSIZE nC, SCSIZE nR) const; + + /** For a row vector or column vector, if the position does not point into + the vector but is a valid column or row offset it is adapted such that + it points to an element to be replicated, same column row 0 for a row + vector, same row column 0 for a column vector. Else, for a 2D matrix, + returns false. + */ + bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const; + + /** Checks if the matrix position is within the matrix. If it is not, for a + row vector or column vector the position is adapted such that it points + to an element to be replicated, same column row 0 for a row vector, + same row column 0 for a column vector. Else, for a 2D matrix and + position not within matrix, returns false. + */ + bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const; + + void PutDouble( double fVal, SCSIZE nC, SCSIZE nR); + void PutDouble( double fVal, SCSIZE nIndex); + void PutString( const String& rStr, SCSIZE nC, SCSIZE nR); + void PutString( const String& rStr, SCSIZE nIndex); + void PutEmpty( SCSIZE nC, SCSIZE nR); + /// Jump FALSE without path + void PutEmptyPath( SCSIZE nC, SCSIZE nR); + void PutError( sal_uInt16 nErrorCode, SCSIZE nC, SCSIZE nR ); + void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR); + + void FillDouble( double fVal, + SCSIZE nC1, SCSIZE nR1, SCSIZE nC2, SCSIZE nR2 ); + + /** May be used before obtaining the double value of an element to avoid + passing its NAN around. + @ATTENTION: MUST NOT be used if the element is a string! + Use GetErrorIfNotString() instead if not sure. + @returns 0 if no error, else one of err... constants */ + sal_uInt16 GetError( SCSIZE nC, SCSIZE nR) const; + + /** Use in ScInterpreter to obtain the error code, if any. + @returns 0 if no error or string element, else one of err... constants */ + sal_uInt16 GetErrorIfNotString( SCSIZE nC, SCSIZE nR) const + { return IsValue( nC, nR) ? GetError( nC, nR) : 0; } + + /// @return 0.0 if empty or empty path, else value or DoubleError. + double GetDouble( SCSIZE nC, SCSIZE nR) const; + /// @return 0.0 if empty or empty path, else value or DoubleError. + double GetDouble( SCSIZE nIndex) const; + + /// @return empty string if empty or empty path, else string content. + const String& GetString( SCSIZE nC, SCSIZE nR) const; + /// @return empty string if empty or empty path, else string content. + const String& GetString( SCSIZE nIndex) const; + + /** @returns the matrix element's string if one is present, otherwise the + numerical value formatted as string, or in case of an error the error + string is returned; an empty string for empty, a "FALSE" string for + empty path. */ + String GetString( SvNumberFormatter& rFormatter, SCSIZE nC, SCSIZE nR) const; + + /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate + /// an empty string! + ScMatrixValue Get( SCSIZE nC, SCSIZE nR) const; + + /// @return <TRUE/> if string or empty or empty path, in fact non-value. + sal_Bool IsString( SCSIZE nIndex ) const; + + /// @return <TRUE/> if string or empty or empty path, in fact non-value. + sal_Bool IsString( SCSIZE nC, SCSIZE nR ) const; + + /// @return <TRUE/> if empty or empty path. + sal_Bool IsEmpty( SCSIZE nC, SCSIZE nR ) const; + + /// @return <TRUE/> if empty path. + sal_Bool IsEmptyPath( SCSIZE nC, SCSIZE nR ) const; + + /// @return <TRUE/> if value or boolean. + sal_Bool IsValue( SCSIZE nIndex ) const; + + /// @return <TRUE/> if value or boolean. + sal_Bool IsValue( SCSIZE nC, SCSIZE nR ) const; + + /// @return <TRUE/> if value or boolean or empty or empty path. + sal_Bool IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const; + + /// @return <TRUE/> if boolean. + sal_Bool IsBoolean( SCSIZE nC, SCSIZE nR ) const; + + /// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties + sal_Bool IsNumeric() const; + + void MatTrans( ScMatrix& mRes) const; + void MatCopy ( ScMatrix& mRes) const; + + // Convert ScInterpreter::CompareMat values (-1,0,1) to boolean values + void CompareEqual(); + void CompareNotEqual(); + void CompareLess(); + void CompareGreater(); + void CompareLessEqual(); + void CompareGreaterEqual(); + + double And() const; // logical AND of all matrix values, or NAN + double Or() const; // logical OR of all matrix values, or NAN + + IterateResult Sum(bool bTextAsZero) const; + IterateResult SumSquare(bool bTextAsZero) const; + IterateResult Product(bool bTextAsZero) const; + size_t Count(bool bCountStrings) const; + + // All other matrix functions MatMult, MInv, ... are in ScInterpreter + // to be numerically safe. +}; + +inline void intrusive_ptr_add_ref(const ScMatrix* p) +{ + p->IncRef(); +} + +inline void intrusive_ptr_release(const ScMatrix* p) +{ + p->DecRef(); +} + +#endif // SC_MATRIX_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx new file mode 100644 index 000000000000..1915f5d2c4ba --- /dev/null +++ b/sc/inc/scmod.hxx @@ -0,0 +1,290 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCMOD_HXX +#define SC_SCMOD_HXX + +#include "scdllapi.h" +#include "scdll.hxx" +#include <vcl/timer.hxx> +#include <svl/lstner.hxx> +#include "global.hxx" // ScInputMode +#include "markdata.hxx" // ScMarkData +#include "shellids.hxx" +#include <unotools/options.hxx> +#include <tools/shl.hxx> + +#include <map> +#include <list> +#include <algorithm> + + +class KeyEvent; +class SdrModel; +class SdrView; +class EditView; +class SfxErrorHandler; +class SvxErrorHandler; +class SvtAccessibilityOptions; +class SvtCTLOptions; +class SvtUserOptions; + +namespace svtools { class ColorConfig; } + +class ScRange; +class ScDocument; +class ScViewCfg; +class ScDocCfg; +class ScAppCfg; +class ScInputCfg; +class ScPrintCfg; +class ScViewOptions; +class ScDocOptions; +class ScAppOptions; +class ScInputOptions; +class ScPrintOptions; +class ScInputHandler; +class ScInputWindow; +class ScTabViewShell; +class ScFunctionDlg; +class ScArgDlgBase; +class ScEditFunctionDlg; +class ScMessagePool; +class EditFieldInfo; +class ScNavipiCfg; +class ScAddInCfg; + +class ScTransferObj; +class ScDrawTransferObj; +class ScSelectionTransferObj; + +class ScFormEditData; + +//================================================================== + +// for internal Drag&Drop: + +#define SC_DROP_NAVIGATOR 1 +#define SC_DROP_TABLE 2 + +struct ScDragData +{ + ScTransferObj* pCellTransfer; + ScDrawTransferObj* pDrawTransfer; + + String aLinkDoc; + String aLinkTable; + String aLinkArea; + ScDocument* pJumpLocalDoc; + String aJumpTarget; + String aJumpText; +}; + +struct ScClipData +{ + ScTransferObj* pCellClipboard; + ScDrawTransferObj* pDrawClipboard; +}; + +//================================================================== + + +class ScModule: public SfxModule, public SfxListener, utl::ConfigurationListener +{ + Timer aIdleTimer; + Timer aSpellTimer; + ScDragData aDragData; + ScClipData aClipData; + ScSelectionTransferObj* pSelTransfer; + ScMessagePool* pMessagePool; + // there is no global InputHandler anymore, each View has it's own + ScInputHandler* pRefInputHandler; + ScViewCfg* pViewCfg; + ScDocCfg* pDocCfg; + ScAppCfg* pAppCfg; + ScInputCfg* pInputCfg; + ScPrintCfg* pPrintCfg; + ScNavipiCfg* pNavipiCfg; + ScAddInCfg* pAddInCfg; + svtools::ColorConfig* pColorConfig; + SvtAccessibilityOptions* pAccessOptions; + SvtCTLOptions* pCTLOptions; + SvtUserOptions* pUserOptions; + SfxErrorHandler* pErrorHdl; + SvxErrorHandler* pSvxErrorHdl; + ScFormEditData* pFormEditData; + sal_uInt16 nCurRefDlgId; + sal_Bool bIsWaterCan; + sal_Bool bIsInEditCommand; + sal_Bool bIsInExecuteDrop; + bool mbIsInSharedDocLoading; + bool mbIsInSharedDocSaving; + + std::map<sal_uInt16, std::list<Window*> > m_mapRefWindow; +public: + SFX_DECL_INTERFACE(SCID_APP) + + ScModule( SfxObjectFactory* pFact ); + virtual ~ScModule(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); + void DeleteCfg(); + + // moved by the application + + DECL_LINK( IdleHandler, Timer* ); // Timer instead of idle + DECL_LINK( SpellTimerHdl, Timer* ); + DECL_LINK( CalcFieldValueHdl, EditFieldInfo* ); + + void Execute( SfxRequest& rReq ); + void GetState( SfxItemSet& rSet ); + void HideDisabledSlots( SfxItemSet& rSet ); + + void AnythingChanged(); + + // Drag & Drop: + const ScDragData& GetDragData() const { return aDragData; } + void SetDragObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj ); + void ResetDragObject(); + void SetDragLink( const String& rDoc, const String& rTab, const String& rArea ); + void SetDragJump( ScDocument* pLocalDoc, + const String& rTarget, const String& rText ); + + // clipboard: + const ScClipData& GetClipData() const { return aClipData; } + void SetClipObject( ScTransferObj* pCellObj, ScDrawTransferObj* pDrawObj ); + + ScDocument* GetClipDoc(); // called from document - should be removed later + + // X selection: + ScSelectionTransferObj* GetSelectionTransfer() const { return pSelTransfer; } + void SetSelectionTransfer( ScSelectionTransferObj* pNew ); + + void SetWaterCan( sal_Bool bNew ) { bIsWaterCan = bNew; } + sal_Bool GetIsWaterCan() const { return bIsWaterCan; } + + void SetInEditCommand( sal_Bool bNew ) { bIsInEditCommand = bNew; } + sal_Bool IsInEditCommand() const { return bIsInEditCommand; } + + void SetInExecuteDrop( sal_Bool bNew ) { bIsInExecuteDrop = bNew; } + sal_Bool IsInExecuteDrop() const { return bIsInExecuteDrop; } + + // Options: + const ScViewOptions& GetViewOptions (); +SC_DLLPUBLIC const ScDocOptions& GetDocOptions (); +SC_DLLPUBLIC const ScAppOptions& GetAppOptions (); + const ScInputOptions& GetInputOptions (); +SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions (); + void SetViewOptions ( const ScViewOptions& rOpt ); +SC_DLLPUBLIC void SetDocOptions ( const ScDocOptions& rOpt ); +SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt ); + void SetInputOptions ( const ScInputOptions& rOpt ); + void SetPrintOptions ( const ScPrintOptions& rOpt ); + void InsertEntryToLRUList(sal_uInt16 nFIndex); + void RecentFunctionsChanged(); + + static void GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang, + sal_Bool& rAutoSpell ); + static void SetAutoSpellProperty( sal_Bool bSet ); + static sal_Bool HasThesaurusLanguage( sal_uInt16 nLang ); + + sal_uInt16 GetOptDigitLanguage(); // from CTL options + + ScNavipiCfg& GetNavipiCfg(); + ScAddInCfg& GetAddInCfg(); + svtools::ColorConfig& GetColorConfig(); + SvtAccessibilityOptions& GetAccessOptions(); + SvtCTLOptions& GetCTLOptions(); + SvtUserOptions& GetUserOptions(); + + void ModifyOptions( const SfxItemSet& rOptSet ); + + // InputHandler: + sal_Bool IsEditMode(); // not for SC_INPUT_TYPE + sal_Bool IsInputMode(); // also for SC_INPUT_TYPE + void SetInputMode( ScInputMode eMode ); + sal_Bool InputKeyEvent( const KeyEvent& rKEvt, sal_Bool bStartEdit = false ); + SC_DLLPUBLIC void InputEnterHandler( sal_uInt8 nBlockMode = 0 ); + void InputCancelHandler(); + void InputSelection( EditView* pView ); + void InputChanged( EditView* pView ); + ScInputHandler* GetInputHdl( ScTabViewShell* pViewSh = NULL, sal_Bool bUseRef = sal_True ); + + void SetRefInputHdl( ScInputHandler* pNew ); + ScInputHandler* GetRefInputHdl(); + + void ViewShellGone(ScTabViewShell* pViewSh); + void ViewShellChanged(); + // communication with function-autopilot + void InputGetSelection( xub_StrLen& rStart, xub_StrLen& rEnd ); + void InputSetSelection( xub_StrLen nStart, xub_StrLen nEnd ); + void InputReplaceSelection( const String& rStr ); + String InputGetFormulaStr(); + void ActivateInputWindow( const String* pStr = NULL, + sal_Bool bMatrix = false ); + + void InitFormEditData(); + void ClearFormEditData(); + ScFormEditData* GetFormEditData() { return pFormEditData; } + + // input of reference: + SC_DLLPUBLIC void SetRefDialog( sal_uInt16 nId, sal_Bool bVis, SfxViewFrame* pViewFrm = NULL ); + sal_Bool IsModalMode(SfxObjectShell* pDocSh = NULL); + sal_Bool IsFormulaMode(); + sal_Bool IsRefDialogOpen(); + sal_Bool IsTableLocked(); + void SetReference( const ScRange& rRef, ScDocument* pDoc, + const ScMarkData* pMarkData = NULL ); + void AddRefEntry(); + void EndReference(); + sal_uInt16 GetCurRefDlgId() const { return nCurRefDlgId; } + + // virtual methods for the options dialog + virtual SfxItemSet* CreateItemSet( sal_uInt16 nId ); + virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ); + virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, Window* pParent, const SfxItemSet& rSet ); + + void SetInSharedDocLoading( bool bNew ) { mbIsInSharedDocLoading = bNew; } + bool IsInSharedDocLoading() const { return mbIsInSharedDocLoading; } + void SetInSharedDocSaving( bool bNew ) { mbIsInSharedDocSaving = bNew; } + bool IsInSharedDocSaving() const { return mbIsInSharedDocSaving; } + + SC_DLLPUBLIC sal_Bool RegisterRefWindow( sal_uInt16 nSlotId, Window *pWnd ); + SC_DLLPUBLIC sal_Bool UnregisterRefWindow( sal_uInt16 nSlotId, Window *pWnd ); + SC_DLLPUBLIC sal_Bool IsAliveRefDlg( sal_uInt16 nSlotId, Window *pWnd ); + SC_DLLPUBLIC Window * Find1RefWindow( sal_uInt16 nSlotId, Window *pWndAncestor ); + SC_DLLPUBLIC Window * Find1RefWindow( Window *pWndAncestor ); +}; + +#define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) ) + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scresid.hxx b/sc/inc/scresid.hxx new file mode 100644 index 000000000000..7cb8136f2081 --- /dev/null +++ b/sc/inc/scresid.hxx @@ -0,0 +1,47 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SCRESID_HXX +#define SC_SCRESID_HXX + +#include <tools/resid.hxx> +#include "scdllapi.h" + +//=================================================================== + +class SC_DLLPUBLIC ScResId : public ResId +{ + public: + ScResId( sal_uInt16 nId ); // in scdll.cxx +}; + + + +#endif // SC_SCRESMGR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/scwarngs.hxx b/sc/inc/scwarngs.hxx new file mode 100644 index 000000000000..e8c6ff568830 --- /dev/null +++ b/sc/inc/scwarngs.hxx @@ -0,0 +1,38 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef __SCWARNGS_HXX_ +#define __SCWARNGS_HXX_ + +#define ERRCODE_SC_EXPORT_WRN_ASCII (ERRCODE_WARNING_MASK | ERRCODE_AREA_SC | ERRCODE_CLASS_WRITE | 1) +#define ERRCODE_SC_IMPORT_WRN_RNGOVRFLW (ERRCODE_WARNING_MASK | ERRCODE_AREA_SC | ERRCODE_CLASS_READ | 1) + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx new file mode 100644 index 000000000000..1c6b36c57950 --- /dev/null +++ b/sc/inc/segmenttree.hxx @@ -0,0 +1,164 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SEGMENTTREE_HXX +#define SC_SEGMENTTREE_HXX + +#include "address.hxx" + +#include <memory> + +class ScFlatBoolSegmentsImpl; + +class ScFlatBoolRowSegments +{ +public: + struct RangeData + { + SCROW mnRow1; + SCROW mnRow2; + bool mbValue; + }; + + class ForwardIterator + { + public: + explicit ForwardIterator(ScFlatBoolRowSegments& rSegs); + + bool getValue(SCROW nPos, bool& rVal); + SCROW getLastPos() const; + + private: + ScFlatBoolRowSegments& mrSegs; + + SCROW mnCurPos; + SCROW mnLastPos; + bool mbCurValue; + }; + + class RangeIterator + { + public: + explicit RangeIterator(ScFlatBoolRowSegments& rSegs); + bool getFirst(RangeData& rRange); + bool getNext(RangeData& rRange); + private: + ScFlatBoolRowSegments& mrSegs; + }; + + ScFlatBoolRowSegments(); + ScFlatBoolRowSegments(const ScFlatBoolRowSegments& r); + ~ScFlatBoolRowSegments(); + + bool setTrue(SCROW nRow1, SCROW nRow2); + bool setFalse(SCROW nRow1, SCROW nRow2); + bool getValue(SCROW nRow); + bool getRangeData(SCROW nRow, RangeData& rData); + bool getRangeDataLeaf(SCROW nRow, RangeData& rData); + void removeSegment(SCROW nRow1, SCROW nRow2); + void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary); + + SCROW findLastNotOf(bool bValue) const; + +private: + ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl; +}; + +class ScFlatBoolColSegments +{ +public: + struct RangeData + { + SCCOL mnCol1; + SCCOL mnCol2; + bool mbValue; + }; + ScFlatBoolColSegments(); + ScFlatBoolColSegments(const ScFlatBoolColSegments& r); + ~ScFlatBoolColSegments(); + + bool setTrue(SCCOL nCol1, SCCOL nCol2); + bool setFalse(SCCOL nCol1, SCCOL nCol2); + bool getRangeData(SCCOL nCol, RangeData& rData); + void removeSegment(SCCOL nCol1, SCCOL nCol2); + void insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary); + +private: + ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl; +}; + +class ScFlatUInt16SegmentsImpl; + +class ScFlatUInt16RowSegments +{ +public: + struct RangeData + { + SCROW mnRow1; + SCROW mnRow2; + sal_uInt16 mnValue; + }; + + class ForwardIterator + { + public: + explicit ForwardIterator(ScFlatUInt16RowSegments& rSegs); + + bool getValue(SCROW nPos, sal_uInt16& rVal); + SCROW getLastPos() const; + + private: + ScFlatUInt16RowSegments& mrSegs; + + SCROW mnCurPos; + SCROW mnLastPos; + sal_uInt16 mnCurValue; + }; + + ScFlatUInt16RowSegments(sal_uInt16 nDefault); + ScFlatUInt16RowSegments(const ScFlatUInt16RowSegments& r); + ~ScFlatUInt16RowSegments(); + + void setValue(SCROW nRow1, SCROW nRow2, sal_uInt16 nValue); + sal_uInt16 getValue(SCROW nRow); + sal_uInt32 getSumValue(SCROW nRow1, SCROW nRow2); + bool getRangeData(SCROW nRow, RangeData& rData); + void removeSegment(SCROW nRow1, SCROW nRow2); + void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary); + + SCROW findLastNotOf(sal_uInt16 nValue) const; + + void enableTreeSearch(bool bEnable); + +private: + ::std::auto_ptr<ScFlatUInt16SegmentsImpl> mpImpl; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/servuno.hxx b/sc/inc/servuno.hxx new file mode 100644 index 000000000000..9adca2a1dc93 --- /dev/null +++ b/sc/inc/servuno.hxx @@ -0,0 +1,119 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SERVUNO_HXX +#define SC_SERVUNO_HXX + +#include <com/sun/star/uno/XInterface.hpp> +#include <com/sun/star/uno/Sequence.hxx> + +class String; +class ScDocShell; + + +//! AutoFormat here or global?????? + +#define SC_SERVICE_SHEET 0 +#define SC_SERVICE_URLFIELD 1 +#define SC_SERVICE_PAGEFIELD 2 +#define SC_SERVICE_PAGESFIELD 3 +#define SC_SERVICE_DATEFIELD 4 +#define SC_SERVICE_TIMEFIELD 5 +#define SC_SERVICE_TITLEFIELD 6 +#define SC_SERVICE_FILEFIELD 7 +#define SC_SERVICE_SHEETFIELD 8 +#define SC_SERVICE_CELLSTYLE 9 +#define SC_SERVICE_PAGESTYLE 10 +#define SC_SERVICE_AUTOFORMAT 11 +#define SC_SERVICE_CELLRANGES 12 + +// drawing layer tables +#define SC_SERVICE_GRADTAB 13 +#define SC_SERVICE_HATCHTAB 14 +#define SC_SERVICE_BITMAPTAB 15 +#define SC_SERVICE_TRGRADTAB 16 +#define SC_SERVICE_MARKERTAB 17 +#define SC_SERVICE_DASHTAB 18 +#define SC_SERVICE_NUMRULES 19 + +#define SC_SERVICE_DOCDEFLTS 20 +#define SC_SERVICE_DRAWDEFLTS 21 + +#define SC_SERVICE_DOCSPRSETT 22 +#define SC_SERVICE_DOCCONF 23 + +#define SC_SERVICE_IMAP_RECT 24 +#define SC_SERVICE_IMAP_CIRC 25 +#define SC_SERVICE_IMAP_POLY 26 + +// Support creation of GraphicObjectResolver and EmbeddedObjectResolver +#define SC_SERVICE_EXPORT_GOR 27 +#define SC_SERVICE_IMPORT_GOR 28 +#define SC_SERVICE_EXPORT_EOR 29 +#define SC_SERVICE_IMPORT_EOR 30 + +#define SC_SERVICE_VALBIND 31 +#define SC_SERVICE_LISTCELLBIND 32 +#define SC_SERVICE_LISTSOURCE 33 + +#define SC_SERVICE_CELLADDRESS 34 +#define SC_SERVICE_RANGEADDRESS 35 + +#define SC_SERVICE_SHEETDOCSET 36 + +// BM +#define SC_SERVICE_CHDATAPROV 37 + +// formula parser +#define SC_SERVICE_FORMULAPARS 38 +#define SC_SERVICE_OPCODEMAPPER 39 + +// VBA specific +#define SC_SERVICE_VBAOBJECTPROVIDER 40 +#define SC_SERVICE_VBACODENAMEPROVIDER 41 +#define SC_SERVICE_VBAGLOBALS 42 + +#define SC_SERVICE_COUNT 43 +#define SC_SERVICE_INVALID USHRT_MAX + + +class ScServiceProvider +{ +public: + // pDocShell is not needed for all Services + static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + MakeInstance( sal_uInt16 nType, ScDocShell* pDocShell ); + static ::com::sun::star::uno::Sequence<rtl::OUString> GetAllServiceNames(); + static sal_uInt16 GetProviderType(const String& rServiceName); +}; + + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/shapeuno.hxx b/sc/inc/shapeuno.hxx new file mode 100644 index 000000000000..3c1c0e76b6ed --- /dev/null +++ b/sc/inc/shapeuno.hxx @@ -0,0 +1,246 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SHAPEUNO_HXX +#define SC_SHAPEUNO_HXX + +#include <tools/solar.h> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/text/XTextContent.hpp> +#include <com/sun/star/text/XText.hpp> +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/document/XEventsSupplier.hpp> + +#include <cppuhelper/implbase5.hxx> +#include <cppuhelper/implbase1.hxx> + +namespace com { namespace sun { namespace star { + namespace uno { + class XAggregation; + } + namespace drawing { + class XShape; + } +}}} + +class SdrObject; +struct SvEventDescription; +class ShapeUnoEventAccessImpl; +class ScMacroInfo; + +//------------------------------------------------------------------------ + +// object which aggregates all svx shape objects, +// to add own properties + +typedef ::cppu::WeakImplHelper5 < ::com::sun::star::beans::XPropertySet + , ::com::sun::star::beans::XPropertyState + , ::com::sun::star::text::XTextContent + , ::com::sun::star::document::XEventsSupplier + , ::com::sun::star::lang::XServiceInfo + > ScShapeObj_Base; +typedef ::cppu::ImplHelper1 < ::com::sun::star::text::XText + > ScShapeObj_TextBase; +class ScShapeObj :public ScShapeObj_Base + ,public ScShapeObj_TextBase +{ +private: +friend ScMacroInfo* lcl_getShapeHyperMacroInfo( ScShapeObj* pShape, sal_Bool bCreate ); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XAggregation > mxShapeAgg; + // cached pointers to avoid repeated queryAggregation calls: + ::com::sun::star::beans::XPropertySet* pShapePropertySet; + ::com::sun::star::beans::XPropertyState* pShapePropertyState; + ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > mxPropSetInfo; + com::sun::star::uno::Sequence< sal_Int8 >* pImplementationId; + sal_Bool bIsTextShape; + bool bInitializedNotifier; + + SdrObject* GetSdrObject() const throw(); + + void GetShapePropertySet(); + void GetShapePropertyState(); + +friend class ShapeUnoEventAccessImpl; + +public: + static const SvEventDescription* GetSupportedMacroItems(); + + // ctor modifies xShape parameter + ScShapeObj( ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape > & xShape ); + virtual ~ScShapeObj(); + + // XInterface + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL + getPropertyStates( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( + const ::rtl::OUString& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XTextContent + virtual void SAL_CALL attach(const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange > & xTextRange) + throw( ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getAnchor(void) throw( ::com::sun::star::uno::RuntimeException ); + + // XComponent + virtual void SAL_CALL dispose(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addEventListener(const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & aListener) + throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeEventListener(const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & aListener) + throw( ::com::sun::star::uno::RuntimeException ); + + // XText + virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent, + sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XSimpleText + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursorByRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& aTextPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::rtl::OUString& aString, sal_Bool bAbsorb ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + + // XEventsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameReplace > SAL_CALL getEvents() + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) + throw (::com::sun::star::uno::RuntimeException) ; + virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) + throw (::com::sun::star::uno::RuntimeException); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx new file mode 100644 index 000000000000..b4790684ba05 --- /dev/null +++ b/sc/inc/sheetdata.hxx @@ -0,0 +1,187 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SHEETDATA_HXX +#define SC_SHEETDATA_HXX + +#include <xmloff/maptype.hxx> +#include <editeng/editdata.hxx> +#include <vector> +#include <boost/unordered_set.hpp> + +#include "address.hxx" + +class ScAddress; +class SvXMLNamespaceMap; + + +struct ScStreamEntry +{ + sal_Int32 mnStartOffset; + sal_Int32 mnEndOffset; + + ScStreamEntry() : + mnStartOffset(-1), + mnEndOffset(-1) + { + } + + ScStreamEntry( sal_Int32 nStart, sal_Int32 nEnd ) : + mnStartOffset(nStart), + mnEndOffset(nEnd) + { + } +}; + +struct ScCellStyleEntry +{ + rtl::OUString maName; + ScAddress maCellPos; + + ScCellStyleEntry( const rtl::OUString& rName, const ScAddress& rPos ) : + maName(rName), + maCellPos(rPos) + { + } +}; + +struct ScNoteStyleEntry +{ + rtl::OUString maStyleName; + rtl::OUString maTextStyle; + ScAddress maCellPos; + + ScNoteStyleEntry( const rtl::OUString& rStyle, const rtl::OUString& rText, const ScAddress& rPos ) : + maStyleName(rStyle), + maTextStyle(rText), + maCellPos(rPos) + { + } +}; + +struct ScTextStyleEntry +{ + rtl::OUString maName; + ScAddress maCellPos; + ESelection maSelection; + + ScTextStyleEntry( const rtl::OUString& rName, const ScAddress& rPos, const ESelection& rSel ) : + maName(rName), + maCellPos(rPos), + maSelection(rSel) + { + } +}; + +struct ScLoadedNamespaceEntry +{ + rtl::OUString maPrefix; + rtl::OUString maName; + sal_uInt16 mnKey; + + ScLoadedNamespaceEntry( const rtl::OUString& rPrefix, const rtl::OUString& rName, sal_uInt16 nKey ) : + maPrefix(rPrefix), + maName(rName), + mnKey(nKey) + { + } +}; + +class ScSheetSaveData +{ + boost::unordered_set<rtl::OUString, rtl::OUStringHash> maInitialPrefixes; + std::vector<ScLoadedNamespaceEntry> maLoadedNamespaces; + + std::vector<ScCellStyleEntry> maCellStyles; + std::vector<ScCellStyleEntry> maColumnStyles; + std::vector<ScCellStyleEntry> maRowStyles; + std::vector<ScCellStyleEntry> maTableStyles; + std::vector<ScNoteStyleEntry> maNoteStyles; + std::vector<ScTextStyleEntry> maNoteParaStyles; + std::vector<ScTextStyleEntry> maNoteTextStyles; + std::vector<ScTextStyleEntry> maTextStyles; + std::vector<bool> maBlocked; + std::vector<ScStreamEntry> maStreamEntries; + std::vector<ScStreamEntry> maSaveEntries; + sal_Int32 mnStartTab; + sal_Int32 mnStartOffset; + + ScNoteStyleEntry maPreviousNote; + + bool mbInSupportedSave; + +public: + ScSheetSaveData(); + ~ScSheetSaveData(); + + void AddCellStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddColumnStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddRowStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + void AddTableStyle( const rtl::OUString& rName, const ScAddress& rCellPos ); + + void HandleNoteStyles( const rtl::OUString& rStyleName, const rtl::OUString& rTextName, const ScAddress& rCellPos ); + void AddNoteContentStyle( sal_uInt16 nFamily, const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void AddTextStyle( const rtl::OUString& rName, const ScAddress& rCellPos, const ESelection& rSelection ); + + void BlockSheet( sal_Int32 nTab ); + bool IsSheetBlocked( sal_Int32 nTab ) const; + + void AddStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ); + void GetStreamPos( sal_Int32 nTab, sal_Int32& rStartOffset, sal_Int32& rEndOffset ) const; + bool HasStreamPos( sal_Int32 nTab ) const; + + void StartStreamPos( sal_Int32 nTab, sal_Int32 nStartOffset ); + void EndStreamPos( sal_Int32 nEndOffset ); + + bool HasStartPos() const { return mnStartTab >= 0; } + + void ResetSaveEntries(); + void AddSavePos( sal_Int32 nTab, sal_Int32 nStartOffset, sal_Int32 nEndOffset ); + void UseSaveEntries(); + + void StoreInitialNamespaces( const SvXMLNamespaceMap& rNamespaces ); + void StoreLoadedNamespaces( const SvXMLNamespaceMap& rNamespaces ); + bool AddLoadedNamespaces( SvXMLNamespaceMap& rNamespaces ) const; + + const std::vector<ScCellStyleEntry>& GetCellStyles() const { return maCellStyles; } + const std::vector<ScCellStyleEntry>& GetColumnStyles() const { return maColumnStyles; } + const std::vector<ScCellStyleEntry>& GetRowStyles() const { return maRowStyles; } + const std::vector<ScCellStyleEntry>& GetTableStyles() const { return maTableStyles; } + const std::vector<ScNoteStyleEntry>& GetNoteStyles() const { return maNoteStyles; } + const std::vector<ScTextStyleEntry>& GetNoteParaStyles() const { return maNoteParaStyles; } + const std::vector<ScTextStyleEntry>& GetNoteTextStyles() const { return maNoteTextStyles; } + const std::vector<ScTextStyleEntry>& GetTextStyles() const { return maTextStyles; } + + bool IsInSupportedSave() const; + void SetInSupportedSave( bool bSet ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/sheetevents.hxx b/sc/inc/sheetevents.hxx new file mode 100644 index 000000000000..715b1ab0402a --- /dev/null +++ b/sc/inc/sheetevents.hxx @@ -0,0 +1,66 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_SHEETEVENTS_HXX +#define SC_SHEETEVENTS_HXX + +#include <rtl/ustring.hxx> + +#define SC_SHEETEVENT_FOCUS 0 +#define SC_SHEETEVENT_UNFOCUS 1 +#define SC_SHEETEVENT_SELECT 2 +#define SC_SHEETEVENT_DOUBLECLICK 3 +#define SC_SHEETEVENT_RIGHTCLICK 4 +#define SC_SHEETEVENT_CHANGE 5 +#define SC_SHEETEVENT_CALCULATE 6 +#define SC_SHEETEVENT_COUNT 7 + +class ScSheetEvents +{ + rtl::OUString** mpScriptNames; + + void Clear(); + +public: + ScSheetEvents(); + ScSheetEvents(const ScSheetEvents& rOther); + ~ScSheetEvents(); + + const ScSheetEvents& operator= (const ScSheetEvents& rOther); + + const rtl::OUString* GetScript(sal_Int32 nEvent) const; + void SetScript(sal_Int32 nEvent, const rtl::OUString* pNew); + + static rtl::OUString GetEventName(sal_Int32 nEvent); + static sal_Int32 GetVbaSheetEventId(sal_Int32 nEvent); + static sal_Int32 GetVbaDocumentEventId(sal_Int32 nEvent); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/shellids.hxx b/sc/inc/shellids.hxx new file mode 100644 index 000000000000..b479d4960e9d --- /dev/null +++ b/sc/inc/shellids.hxx @@ -0,0 +1,57 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SHELLIDS_HXX +#define SC_SHELLIDS_HXX + +// Sfx Interface-IDs +#define SCID_APP (SFX_INTERFACE_SC_START+0) +#define SCID_DOC_SHELL (SFX_INTERFACE_SC_START+1) +#define SCID_TABVIEW_SHELL (SFX_INTERFACE_SC_START+2) +#define SCID_TABPOP_SHELL (SFX_INTERFACE_SC_START+3) +#define SCID_EDIT_SHELL (SFX_INTERFACE_SC_START+4) +#define SCID_DRAW_SHELL (SFX_INTERFACE_SC_START+5) +#define SCID_DRAW_TEXT_SHELL (SFX_INTERFACE_SC_START+6) +#define SCID_PREVIEW_SHELL (SFX_INTERFACE_SC_START+7) +#define SCID_PIVOT_SHELL (SFX_INTERFACE_SC_START+8) +#define SCID_AUDITING_SHELL (SFX_INTERFACE_SC_START+9) +#define SCID_FORM_SHELL (SFX_INTERFACE_SC_START+10) + +#define SCID_FORMAT_SHELL (SFX_INTERFACE_SC_START+11) +#define SCID_CELL_SHELL (SFX_INTERFACE_SC_START+12) +#define SCID_OLEOBJECT_SHELL (SFX_INTERFACE_SC_START+13) +#define SCID_CHART_SHELL (SFX_INTERFACE_SC_START+14) +#define SCID_GRAPHIC_SHELL (SFX_INTERFACE_SC_START+15) +#define SCID_PAGEBREAK_SHELL (SFX_INTERFACE_SC_START+16) +#define SCID_MEDIA_SHELL (SFX_INTERFACE_SC_START+17) + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/simplerangelist.hxx b/sc/inc/simplerangelist.hxx new file mode 100644 index 000000000000..efba4dd97cc8 --- /dev/null +++ b/sc/inc/simplerangelist.hxx @@ -0,0 +1,82 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef __SC_SIMPLERANGELIST_HXX__ +#define __SC_SIMPLERANGELIST_HXX__ + +#include <boost/shared_ptr.hpp> + +#include "address.hxx" + +#include <map> +#include <list> + +class ScAddress; +class ScRange; +class ScRangeList; + +/** + * This container is optimized for use in the ods import filter, to store + * ranges for cell styles. We may change the name of this class once we + * have a better name for what it does. Using this is way more efficient + * than ScRangeList. + */ +class ScSimpleRangeList +{ +public: + struct Range + { + SCCOL mnCol1; + SCROW mnRow1; + SCCOL mnCol2; + SCROW mnRow2; + explicit Range(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + + bool contains(const Range& r) const; + }; + typedef ::boost::shared_ptr< ::std::list<Range> > RangeListRef; + typedef ::std::map<SCTAB, RangeListRef> TabType; + + ScSimpleRangeList(); + + void addRange(const ScRange& rRange); + void insertCol(SCCOL nCol, SCTAB nTab); + void insertRow(SCROW nRow, SCTAB nTab); + void getRangeList(::std::list<ScRange>& rList) const; + void clear(); + +private: + RangeListRef findTab(SCTAB nTab); + +private: + TabType maTabs; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx new file mode 100644 index 000000000000..2a270649bd60 --- /dev/null +++ b/sc/inc/sortparam.hxx @@ -0,0 +1,84 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SORTPARAM_HXX +#define SC_SORTPARAM_HXX + +#include "address.hxx" +#include <tools/string.hxx> +#include <tools/solar.h> +#include <com/sun/star/lang/Locale.hpp> +#include "scdllapi.h" + +#define MAXSORT 3 + +struct ScSubTotalParam; +struct ScQueryParam; + +struct SC_DLLPUBLIC ScSortParam +{ + SCCOL nCol1; + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + sal_uInt16 nUserIndex; + bool bHasHeader; + bool bByRow; + bool bCaseSens; + bool bNaturalSort; + bool bUserDef; + bool bIncludePattern; + bool bInplace; + SCTAB nDestTab; + SCCOL nDestCol; + SCROW nDestRow; + bool bDoSort[MAXSORT]; + SCCOLROW nField[MAXSORT]; + bool bAscending[MAXSORT]; + ::com::sun::star::lang::Locale aCollatorLocale; + ::rtl::OUString aCollatorAlgorithm; + sal_uInt16 nCompatHeader; + + ScSortParam(); + ScSortParam( const ScSortParam& r ); + /// SubTotals sort + ScSortParam( const ScSubTotalParam& rSub, const ScSortParam& rOld ); + /// TopTen sort + ScSortParam( const ScQueryParam&, SCCOL nCol ); + + ScSortParam& operator= ( const ScSortParam& r ); + bool operator== ( const ScSortParam& rOther ) const; + void Clear (); + + void MoveToDest(); +}; + + +#endif // SC_SORTPARAM_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/srchuno.hxx b/sc/inc/srchuno.hxx new file mode 100644 index 000000000000..ae19e89ff26e --- /dev/null +++ b/sc/inc/srchuno.hxx @@ -0,0 +1,131 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SRCHUNO_HXX +#define SC_SRCHUNO_HXX + +#include <com/sun/star/util/XReplaceDescriptor.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <svl/itemprop.hxx> +#include <cppuhelper/implbase3.hxx> + + +class SvxSearchItem; + + +class ScCellSearchObj : public cppu::WeakImplHelper3< + com::sun::star::util::XReplaceDescriptor, + com::sun::star::lang::XUnoTunnel, + com::sun::star::lang::XServiceInfo > +{ +private: + SfxItemPropertySet aPropSet; + SvxSearchItem* pSearchItem; + +public: + ScCellSearchObj(); + virtual ~ScCellSearchObj(); + + SvxSearchItem* GetSearchItem() const { return pSearchItem; } + + // XReplaceDescriptor + virtual ::rtl::OUString SAL_CALL getReplaceString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setReplaceString( const ::rtl::OUString& aReplaceString ) + throw(::com::sun::star::uno::RuntimeException); + + // XSearchDescriptor + virtual ::rtl::OUString SAL_CALL getSearchString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setSearchString( const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + + // search/replace should be called from outside (from XSearchable)... + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScCellSearchObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::util::XSearchDescriptor> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx new file mode 100644 index 000000000000..8cf4b134c641 --- /dev/null +++ b/sc/inc/stlpool.hxx @@ -0,0 +1,86 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_STLPOOL_HXX +#define SC_STLPOOL_HXX + +#include <svl/style.hxx> + + +class ScStyleSheet; +class ScDocument; + +class ScStyleSheetPool : public SfxStyleSheetPool +{ +public: + ScStyleSheetPool( SfxItemPool& rPool, + ScDocument* pDocument ); + + void SetDocument( ScDocument* pDocument ); + ScDocument* GetDocument() const { return pDoc; } + + virtual void Remove( SfxStyleSheetBase* pStyle ); + + void SetActualStyleSheet ( SfxStyleSheetBase* pActStyleSheet ) + { pActualStyleSheet = pActStyleSheet; } + + SfxStyleSheetBase* GetActualStyleSheet () + { return pActualStyleSheet; } + + void CreateStandardStyles(); + void CopyStdStylesFrom( ScStyleSheetPool* pSrcPool ); + + void CopyStyleFrom( ScStyleSheetPool* pSrcPool, + const String& rName, SfxStyleFamily eFamily ); + + ScStyleSheet* FindCaseIns( const String& rName, SfxStyleFamily eFam ); + + const String* GetForceStdName() const { return pForceStdName; } + + virtual SfxStyleSheetBase& Make( const String&, SfxStyleFamily eFam, + sal_uInt16 nMask = 0xffff, sal_uInt16 nPos = 0xffff ); + +protected: + virtual ~ScStyleSheetPool(); + + using SfxStyleSheetPool::Create; // calcwarnings: Create(const SfxStyleSheet&) - ever used? + + virtual SfxStyleSheetBase* Create( const String& rName, + SfxStyleFamily eFamily, + sal_uInt16 nMask); + virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& rStyle ); + +private: + SfxStyleSheetBase* pActualStyleSheet; + ScDocument* pDoc; + const String* pForceStdName; +}; + +#endif // SC_STLPOOL_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx new file mode 100644 index 000000000000..cdbe11267d5c --- /dev/null +++ b/sc/inc/stlsheet.hxx @@ -0,0 +1,93 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_STLSHEET_HXX +#define SC_STLSHEET_HXX + +#include <svl/style.hxx> + +//------------------------------------------------------------------------ + +#define SCSTYLEBIT_STANDARD 0x0001 + +//------------------------------------------------------------------------ + +class ScStyleSheetPool; + +class ScStyleSheet : public SfxStyleSheet +{ +friend class ScStyleSheetPool; + +public: + + enum Usage + { + UNKNOWN, + USED, + NOTUSED + }; + +private: + mutable ScStyleSheet::Usage eUsage; + +public: + TYPEINFO(); + + ScStyleSheet( const ScStyleSheet& rStyle ); + + virtual sal_Bool SetParent ( const String& rParentName ); + virtual SfxItemSet& GetItemSet (); + virtual sal_Bool IsUsed () const; + virtual sal_Bool HasFollowSupport () const; + virtual sal_Bool HasParentSupport () const; + + virtual const String& GetName() const; + virtual const String& GetParent() const; + virtual const String& GetFollow() const; + + virtual sal_Bool SetName( const String& ); + + void SetUsage( ScStyleSheet::Usage eUse ) const + { eUsage = eUse; } + ScStyleSheet::Usage GetUsage() const + { return eUsage; } + +protected: + virtual ~ScStyleSheet(); + + ScStyleSheet( const String& rName, + ScStyleSheetPool& rPool, + SfxStyleFamily eFamily, + sal_uInt16 nMask ); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + +#endif // SC_STLSHEET_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx new file mode 100644 index 000000000000..7874175767aa --- /dev/null +++ b/sc/inc/stringutil.hxx @@ -0,0 +1,93 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_STRINGUTIL_HXX +#define SC_STRINGUTIL_HXX + +#include "rtl/ustring.hxx" +#include "scdllapi.h" + +class SvNumberFormatter; + +/** + * Store parameters used in the ScDocument::SetString() method. Various + * options for string-setting operation are specified herein. + */ +struct SC_DLLPUBLIC ScSetStringParam +{ + /** + * Stores the pointer to the number formatter instance to be used during + * number format detection. The caller must manage the life cycle of the + * instance. + */ + SvNumberFormatter* mpNumFormatter; + + /** + * When true, we try to detect special number format (dates etc) from the + * input string, when false, we only try to detect a basic decimal number + * format. + */ + bool mbDetectNumberFormat; + + /** + * When true, set the format of the cell to Text when a string cell is + * requested for a number input. We may want to do this during text file + * import (csv, html etc). + */ + bool mbSetTextCellFormat; + + ScSetStringParam(); +}; + +// ============================================================================ + +class ScStringUtil +{ +public: + /** + * Check if a given string is a simple decimal number (e.g. 12.345). We + * don't do any elaborate parsing here; we only check for the simplest + * case of decimal number format. + * + * Note that preceding and trailing spaces are ignored during parsing. + * + * @param rStr string to parse + * @param dsep decimal separator + * @param gsep group separator (aka thousands separator) + * @param rVal value of successfully parsed number + * + * @return true if the string is a valid number, false otherwise. + */ + static bool parseSimpleNumber( + const ::rtl::OUString& rStr, sal_Unicode dsep, sal_Unicode gsep, double& rVal); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/strload.hxx b/sc/inc/strload.hxx new file mode 100644 index 000000000000..60d507441209 --- /dev/null +++ b/sc/inc/strload.hxx @@ -0,0 +1,53 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_STRLOAD_HXX +#define SC_STRLOAD_HXX + +#include "scresid.hxx" +#include <tools/rc.hxx> + +class ScRscStrLoader : public Resource +{ +public: + ScRscStrLoader( sal_uInt16 nRsc, sal_uInt16 nStrId ) : + Resource( ScResId( nRsc ) ), theStr( ScResId( nStrId ) ) + { + FreeResource(); + } + + const String& GetString() const { return theStr; } + +private: + String theStr; +}; + + +#endif // SC_STRLOAD_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx new file mode 100644 index 000000000000..166405299bd4 --- /dev/null +++ b/sc/inc/styleuno.hxx @@ -0,0 +1,379 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_STYLEUNO_HXX +#define SC_STYLEUNO_HXX + +#include <svl/itemprop.hxx> +#include <svl/lstner.hxx> +#include <rsc/rscsfx.hxx> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/style/XStyle.hpp> +#include <com/sun/star/style/XStyleLoader.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase4.hxx> +#include <cppuhelper/implbase7.hxx> + +class SfxStyleSheetBase; +class ScDocShell; + +class ScStyleFamilyObj; +class ScStyleObj; + + +class ScStyleNameConversion +{ +public: + static String DisplayToProgrammaticName( const String& rDispName, sal_uInt16 nType ); + static String ProgrammaticToDisplayName( const String& rProgName, sal_uInt16 nType ); +}; + + +class ScStyleFamiliesObj : public ::cppu::WeakImplHelper4< + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::container::XNameAccess, + ::com::sun::star::style::XStyleLoader, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + ScStyleFamilyObj* GetObjectByType_Impl(sal_uInt16 Type) const; + ScStyleFamilyObj* GetObjectByIndex_Impl(sal_uInt32 nIndex) const; + ScStyleFamilyObj* GetObjectByName_Impl(const rtl::OUString& aName) const; + +public: + ScStyleFamiliesObj(ScDocShell* pDocSh); + virtual ~ScStyleFamiliesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XStyleLoader + virtual void SAL_CALL loadStylesFromURL( const ::rtl::OUString& URL, + const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aOptions ) + throw(::com::sun::star::io::IOException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL + getStyleLoaderOptions() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScStyleFamilyObj : public ::cppu::WeakImplHelper4< + ::com::sun::star::container::XNameContainer, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + SfxStyleFamily eFamily; // Family + + ScStyleObj* GetObjectByIndex_Impl(sal_uInt32 nIndex); + ScStyleObj* GetObjectByName_Impl(const rtl::OUString& Name); + +public: + ScStyleFamilyObj(ScDocShell* pDocSh, SfxStyleFamily eFam); + virtual ~ScStyleFamilyObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XNameContainer + virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::ElementExistException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const ::rtl::OUString& Name ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, + const ::com::sun::star::uno::Any& aElement ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue ) + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const ::rtl::OUString& PropertyName ) + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +class ScStyleObj : public ::cppu::WeakImplHelper7< + ::com::sun::star::style::XStyle, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::beans::XMultiPropertySet, + ::com::sun::star::beans::XPropertyState, + ::com::sun::star::beans::XMultiPropertyStates, + ::com::sun::star::lang::XUnoTunnel, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + const SfxItemPropertySet* pPropSet; + ScDocShell* pDocShell; + SfxStyleFamily eFamily; // Family + String aStyleName; + + SfxStyleSheetBase* GetStyle_Impl(); + const SfxItemSet* GetStyleItemSet_Impl( const ::rtl::OUString& rPropName, const SfxItemPropertySimpleEntry*& rpEntry ); + void SetOnePropertyValue( const ::rtl::OUString& rPropertyName, + const SfxItemPropertySimpleEntry* pEntry, + const ::com::sun::star::uno::Any* pValue ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + ScStyleObj(); // disabled +public: + ScStyleObj(ScDocShell* pDocSh, SfxStyleFamily eFam, const String& rName); + virtual ~ScStyleObj(); + + // created by getImplementation: + sal_Bool IsInserted() const { return pDocShell != NULL; } + SfxStyleFamily GetFamily() const { return eFamily; } + void InitDoc( ScDocShell* pNewDocSh, const String& rNewName ); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexReplace > + CreateEmptyNumberingRules(); + + // XStyle + virtual sal_Bool SAL_CALL isUserDefined() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL isInUse() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getParentStyle() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParentStyle( const ::rtl::OUString& aParentStyle ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XNamed + virtual ::rtl::OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw(::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XMultiPropertySet + virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) + throw (::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL + getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XPropertyState + virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL + getPropertyStates( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( + const ::rtl::OUString& aPropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XMultiPropertyStates + // getPropertyStates already defined for XPropertyState + virtual void SAL_CALL setAllPropertiesToDefault() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL + getPropertyDefaults( const ::com::sun::star::uno::Sequence< + ::rtl::OUString >& aPropertyNames ) + throw (::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const ::com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScStyleObj* getImplementation( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface> xObj ); + +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/subtotal.hxx b/sc/inc/subtotal.hxx new file mode 100644 index 000000000000..3f4891c97351 --- /dev/null +++ b/sc/inc/subtotal.hxx @@ -0,0 +1,59 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_SUBTOTAL_HXX +#define SC_SUBTOTAL_HXX + +#include "global.hxx" + +class SubTotal +{ +public: + + static sal_Bool SafePlus( double& fVal1, double fVal2); + static sal_Bool SafeMult( double& fVal1, double fVal2); + static sal_Bool SafeDiv( double& fVal1, double fVal2); +}; + + +struct ScFunctionData // to calculate single functions +{ + ScSubTotalFunc eFunc; + double nVal; + long nCount; + sal_Bool bError; + + ScFunctionData( ScSubTotalFunc eFn ) : + eFunc(eFn), nVal(0.0), nCount(0), bError(false) {} +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/subtotalparam.hxx b/sc/inc/subtotalparam.hxx new file mode 100644 index 000000000000..9e64c292f2c4 --- /dev/null +++ b/sc/inc/subtotalparam.hxx @@ -0,0 +1,67 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Kohei Yoshida <kyoshida@novell.com> (Novell, Inc.) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SC_SUBTOTALPARAM_HXX__ +#define __SC_SUBTOTALPARAM_HXX__ + +#include "global.hxx" +#include "address.hxx" + +struct SC_DLLPUBLIC ScSubTotalParam +{ + SCCOL nCol1; // selected area + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + sal_uInt16 nUserIndex; // index into list + bool bRemoveOnly:1; + bool bReplace:1; // replace existing results + bool bPagebreak:1; // page break at change of group + bool bCaseSens:1; // + bool bDoSort:1; // presort + bool bAscending:1; // sort ascending + bool bUserDef:1; // sort user defined + bool bIncludePattern:1; // sort formats + bool bGroupActive[MAXSUBTOTAL]; // active groups + SCCOL nField[MAXSUBTOTAL]; // associated field + SCCOL nSubTotals[MAXSUBTOTAL]; // number of SubTotals + SCCOL* pSubTotals[MAXSUBTOTAL]; // array of columns to be calculated + ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // array of associated functions + + ScSubTotalParam(); + ScSubTotalParam( const ScSubTotalParam& r ); + + ScSubTotalParam& operator= ( const ScSubTotalParam& r ); + bool operator== ( const ScSubTotalParam& r ) const; + void Clear(); + void SetSubTotals( sal_uInt16 nGroup, + const SCCOL* ptrSubTotals, + const ScSubTotalFunc* ptrFuncions, + sal_uInt16 nCount ); +}; + +#endif diff --git a/sc/inc/tabbgcolor.hxx b/sc/inc/tabbgcolor.hxx new file mode 100644 index 000000000000..063c20596938 --- /dev/null +++ b/sc/inc/tabbgcolor.hxx @@ -0,0 +1,51 @@ +/* -*- 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 2008 by Sun Microsystems, Inc. + * + * 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. + * + ************************************************************************/ + +#ifndef SC_TABBGCOLOR_HXX +#define SC_TABBGCOLOR_HXX + +#include "tools/color.hxx" +#include "address.hxx" + +#include <vector> + +struct ScUndoTabColorInfo +{ + SCTAB mnTabId; + Color maOldTabBgColor; + Color maNewTabBgColor; + + explicit ScUndoTabColorInfo(SCTAB nTab); + ScUndoTabColorInfo(const ScUndoTabColorInfo& r); + + typedef ::std::vector<ScUndoTabColorInfo> List; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx new file mode 100644 index 000000000000..cf30f6b23cd8 --- /dev/null +++ b/sc/inc/table.hxx @@ -0,0 +1,964 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TABLE_HXX +#define SC_TABLE_HXX + +#include <vector> +#include <memory> +#include <utility> +#include <tools/gen.hxx> +#include <tools/color.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include "column.hxx" +#include "sortparam.hxx" +#include "compressedarray.hxx" +#include "dbcolect.hxx" + +#include <memory> +#include <set> +#include <boost/shared_ptr.hpp> + +namespace utl { + class SearchParam; + class TextSearch; +} + +namespace com { namespace sun { namespace star { + namespace sheet { + struct TablePageBreakData; + } +} } } + +class SfxItemSet; +class SfxStyleSheetBase; +class SvxBoxInfoItem; +class SvxBoxItem; +class SvxSearchItem; + +class ScAutoFormat; +class ScAutoFormatData; +class ScBaseCell; +class ScDocument; +class ScDrawLayer; +class ScEditDataArray; +class ScFormulaCell; +class ScOutlineTable; +class ScPostIt; +class ScPrintSaverTab; +class ScProgress; +class ScProgress; +class ScRangeList; +class ScSheetEvents; +class ScSortInfoArray; +class ScStyleSheet; +class ScTableLink; +class ScTableProtection; +class ScUserListData; +struct RowInfo; +struct ScFunctionData; +struct ScLineFlags; +class CollatorWrapper; +class ScFlatUInt16RowSegments; +class ScFlatBoolRowSegments; +class ScFlatBoolColSegments; +struct ScSetStringParam; +struct ScColWidthParam; +struct ScColWidthParam; +class ScRangeName; + +typedef boost::unordered_map< ::rtl::OUString, rtl::OUString, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > NameToNameMap; + +class ScTable +{ +private: + typedef ::std::vector< ScRange > ScRangeVec; + typedef ::std::pair< SCCOL, SCROW > ScAddress2D; + typedef ::std::vector< ScAddress2D > ScAddress2DVec; + typedef ::std::auto_ptr< ScAddress2DVec > ScAddress2DVecPtr; + + // data per table + ScColumn aCol[MAXCOLCOUNT]; + + String aName; + String aCodeName; + String aComment; + sal_Bool bScenario; + sal_Bool bLayoutRTL; + sal_Bool bLoadingRTL; + + String aLinkDoc; + String aLinkFlt; + String aLinkOpt; + String aLinkTab; + sal_uLong nLinkRefreshDelay; + sal_uInt8 nLinkMode; + + // page style template + String aPageStyle; + sal_Bool bPageSizeValid; + Size aPageSizeTwips; // size of the print-page + SCCOL nRepeatStartX; // repeating rows/columns + SCCOL nRepeatEndX; // REPEAT_NONE, if not used + SCROW nRepeatStartY; + SCROW nRepeatEndY; + + ::std::auto_ptr<ScTableProtection> pTabProtection; + + sal_uInt16* pColWidth; + ::boost::shared_ptr<ScFlatUInt16RowSegments> mpRowHeights; + + sal_uInt8* pColFlags; + ScBitMaskCompressedArray< SCROW, sal_uInt8>* pRowFlags; + ::boost::shared_ptr<ScFlatBoolColSegments> mpHiddenCols; + ::boost::shared_ptr<ScFlatBoolRowSegments> mpHiddenRows; + ::boost::shared_ptr<ScFlatBoolColSegments> mpFilteredCols; + ::boost::shared_ptr<ScFlatBoolRowSegments> mpFilteredRows; + + ::std::set<SCROW> maRowPageBreaks; + ::std::set<SCROW> maRowManualBreaks; + ::std::set<SCCOL> maColPageBreaks; + ::std::set<SCCOL> maColManualBreaks; + + ScOutlineTable* pOutlineTable; + + ScSheetEvents* pSheetEvents; + + SCCOL nTableAreaX; + SCROW nTableAreaY; + sal_Bool bTableAreaValid; + + // internal management + sal_Bool bVisible; + sal_Bool bStreamValid; + sal_Bool bPendingRowHeights; + sal_Bool bCalcNotification; + + SCTAB nTab; + sal_uInt16 nRecalcLvl; // recursion level Size-Recalc + ScDocument* pDocument; + utl::SearchParam* pSearchParam; + utl::TextSearch* pSearchText; + + mutable String aUpperName; // #i62977# filled only on demand, reset in SetName + + ScAddress2DVecPtr mxUninitNotes; + + // sort parameter to minimize stack size of quicksort + ScSortParam aSortParam; + CollatorWrapper* pSortCollator; + sal_Bool bGlobalKeepQuery; + + ScRangeVec aPrintRanges; + bool bPrintEntireSheet; + + ScRange* pRepeatColRange; + ScRange* pRepeatRowRange; + + sal_uInt16 nLockCount; + + ScRangeList* pScenarioRanges; + Color aScenarioColor; + Color aTabBgColor; + sal_uInt16 nScenarioFlags; + sal_Bool bActiveScenario; + ScDBData* pDBDataNoName; + mutable ScRangeName* mpRangeName; + bool mbPageBreaksValid; + +friend class ScDocument; // for FillInfo +friend class ScDocumentIterator; +friend class ScValueIterator; +friend class ScDBQueryDataIterator; +friend class ScCellIterator; +friend class ScQueryCellIterator; +friend class ScHorizontalCellIterator; +friend class ScHorizontalAttrIterator; +friend class ScDocAttrIterator; +friend class ScAttrRectIterator; + + +public: + ScTable( ScDocument* pDoc, SCTAB nNewTab, const String& rNewName, + sal_Bool bColInfo = sal_True, sal_Bool bRowInfo = sal_True ); + ~ScTable(); + + ScOutlineTable* GetOutlineTable() { return pOutlineTable; } + + SCSIZE GetCellCount(SCCOL nCol) const; + sal_uLong GetCellCount() const; + sal_uLong GetWeightedCount() const; + sal_uLong GetCodeCount() const; // RPN code in formula + + sal_Bool SetOutlineTable( const ScOutlineTable* pNewOutline ); + void StartOutlineTable(); + + void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); + + sal_Bool TestRemoveSubTotals( const ScSubTotalParam& rParam ); + void RemoveSubTotals( ScSubTotalParam& rParam ); + sal_Bool DoSubTotals( ScSubTotalParam& rParam ); + + const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; } + void SetSheetEvents( const ScSheetEvents* pNew ); + + sal_Bool IsVisible() const { return bVisible; } + void SetVisible( sal_Bool bVis ); + + sal_Bool IsStreamValid() const { return bStreamValid; } + void SetStreamValid( sal_Bool bSet, sal_Bool bIgnoreLock = false ); + + sal_Bool IsPendingRowHeights() const { return bPendingRowHeights; } + void SetPendingRowHeights( sal_Bool bSet ); + + sal_Bool GetCalcNotification() const { return bCalcNotification; } + void SetCalcNotification( sal_Bool bSet ); + + sal_Bool IsLayoutRTL() const { return bLayoutRTL; } + sal_Bool IsLoadingRTL() const { return bLoadingRTL; } + void SetLayoutRTL( sal_Bool bSet ); + void SetLoadingRTL( sal_Bool bSet ); + + sal_Bool IsScenario() const { return bScenario; } + void SetScenario( sal_Bool bFlag ); + void GetScenarioComment( String& rComment) const { rComment = aComment; } + void SetScenarioComment( const String& rComment ) { aComment = rComment; } + const Color& GetScenarioColor() const { return aScenarioColor; } + void SetScenarioColor(const Color& rNew) { aScenarioColor = rNew; } + const Color& GetTabBgColor() const; + void SetTabBgColor(const Color& rColor); + sal_uInt16 GetScenarioFlags() const { return nScenarioFlags; } + void SetScenarioFlags(sal_uInt16 nNew) { nScenarioFlags = nNew; } + void SetActiveScenario(sal_Bool bSet) { bActiveScenario = bSet; } + sal_Bool IsActiveScenario() const { return bActiveScenario; } + + sal_uInt8 GetLinkMode() const { return nLinkMode; } + sal_Bool IsLinked() const { return nLinkMode != SC_LINK_NONE; } + const String& GetLinkDoc() const { return aLinkDoc; } + const String& GetLinkFlt() const { return aLinkFlt; } + const String& GetLinkOpt() const { return aLinkOpt; } + const String& GetLinkTab() const { return aLinkTab; } + sal_uLong GetLinkRefreshDelay() const { return nLinkRefreshDelay; } + + void SetLink( sal_uInt8 nMode, const String& rDoc, const String& rFlt, + const String& rOpt, const String& rTab, sal_uLong nRefreshDelay ); + + void GetName( String& rName ) const; + void SetName( const String& rNewName ); + + void SetAnonymousDBData(ScDBData* pDBData); + ScDBData* GetAnonymousDBData(); + + void GetCodeName( String& rName ) const { rName = aCodeName; } + void SetCodeName( const String& rNewName ) { aCodeName = rNewName; } + + const String& GetUpperName() const; + + const String& GetPageStyle() const { return aPageStyle; } + void SetPageStyle( const String& rName ); + void PageStyleModified( const String& rNewName ); + + sal_Bool IsProtected() const; + void SetProtection(const ScTableProtection* pProtect); + ScTableProtection* GetProtection(); + + Size GetPageSize() const; + void SetPageSize( const Size& rSize ); + void SetRepeatArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCROW nEndRow ); + + void RemoveAutoSpellObj(); + + void LockTable(); + void UnlockTable(); + + sal_Bool IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, + SCROW nRow2, sal_Bool* pOnlyNotBecauseOfMatrix = NULL ) const; + sal_Bool IsSelectionEditable( const ScMarkData& rMark, + sal_Bool* pOnlyNotBecauseOfMatrix = NULL ) const; + + sal_Bool HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + bool HasSelectionMatrixFragment( const ScMarkData& rMark ) const; + + sal_Bool IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const; + + void PutCell( const ScAddress&, ScBaseCell* pCell ); + void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell ); + void PutCell(SCCOL nCol, SCROW nRow, sal_uLong nFormatIndex, ScBaseCell* pCell); + // TRUE = numberformat set + sal_Bool SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + ScSetStringParam* pParam = NULL ); + void SetValue( SCCOL nCol, SCROW nRow, const double& rVal ); + void SetError( SCCOL nCol, SCROW nRow, sal_uInt16 nError); + + void GetString( SCCOL nCol, SCROW nRow, String& rString ); + void GetInputString( SCCOL nCol, SCROW nRow, String& rString ); + double GetValue( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetValue( rPos.Row() ) : + 0.0; + } + double GetValue( SCCOL nCol, SCROW nRow ); + void GetFormula( SCCOL nCol, SCROW nRow, String& rFormula ); + + CellType GetCellType( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetCellType( rPos.Row() ) : + CELLTYPE_NONE; + } + CellType GetCellType( SCCOL nCol, SCROW nRow ) const; + ScBaseCell* GetCell( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetCell( rPos.Row() ) : + NULL; + } + ScBaseCell* GetCell( SCCOL nCol, SCROW nRow ) const; + + void GetFirstDataPos(SCCOL& rCol, SCROW& rRow) const; + void GetLastDataPos(SCCOL& rCol, SCROW& rRow) const; + + /** Returns the pointer to a cell note object at the passed cell address. */ + ScPostIt* GetNote( SCCOL nCol, SCROW nRow ); + /** Sets the passed cell note object at the passed cell address. Takes ownership! */ + void TakeNote( SCCOL nCol, SCROW nRow, ScPostIt*& rpNote ); + /** Returns and forgets the cell note object at the passed cell address. */ + ScPostIt* ReleaseNote( SCCOL nCol, SCROW nRow ); + /** Deletes the note at the passed cell address. */ + void DeleteNote( SCCOL nCol, SCROW nRow ); + /** Creates the captions of all uninitialized cell notes. + @param bForced True = always create all captions, false = skip when Undo is disabled. */ + void InitializeNoteCaptions( bool bForced = false ); + + sal_Bool TestInsertRow( SCCOL nStartCol, SCCOL nEndCol, SCSIZE nSize ); + void InsertRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize ); + void DeleteRow( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, SCSIZE nSize, + sal_Bool* pUndoOutline = NULL ); + + sal_Bool TestInsertCol( SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ); + void InsertCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize ); + void DeleteCol( SCCOL nStartCol, SCROW nStartRow, SCROW nEndRow, SCSIZE nSize, + sal_Bool* pUndoOutline = NULL ); + + void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nDelFlag); + void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable, + sal_Bool bKeepScenarioFlags, sal_Bool bCloneNoteCaptions); + void CopyToClip(const ScRangeList& rRanges, ScTable* pTable, + bool bKeepScenarioFlags, bool bCloneNoteCaptions); + void CopyFromClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCsCOL nDx, SCsROW nDy, + sal_uInt16 nInsFlag, sal_Bool bAsLink, sal_Bool bSkipAttrForEmpty, ScTable* pTable); + void StartListeningInArea( SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2 ); + void BroadcastInArea( SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2 ); + + void CopyToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab, + const ScMarkData* pMarkData = NULL, + sal_Bool bAsLink = false, sal_Bool bColRowFlags = sal_True); + void UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uInt16 nFlags, sal_Bool bMarked, ScTable* pDestTab, + const ScMarkData* pMarkData = NULL); + + void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + ScTable* pTransClip, sal_uInt16 nFlags, sal_Bool bAsLink ); + + // mark of this document + void MixMarked( const ScMarkData& rMark, sal_uInt16 nFunction, + sal_Bool bSkipEmpty, ScTable* pSrcTab ); + void MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uInt16 nFunction, sal_Bool bSkipEmpty, ScTable* pSrcTab ); + + void CopyData( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + SCCOL nDestCol, SCROW nDestRow, SCTAB nDestTab ); + + void CopyScenarioFrom( const ScTable* pSrcTab ); + void CopyScenarioTo( ScTable* pDestTab ) const; + sal_Bool TestCopyScenarioTo( const ScTable* pDestTab ) const; + void MarkScenarioIn( ScMarkData& rMark, sal_uInt16 nNeededBits ) const; + sal_Bool HasScenarioRange( const ScRange& rRange ) const; + void InvalidateScenarioRanges(); + const ScRangeList* GetScenarioRanges() const; + + void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const; + + void InvalidateTableArea(); + void InvalidatePageBreaks(); + + sal_Bool GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = empty + sal_Bool GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const; + sal_Bool GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, sal_Bool bNotes ) const; + sal_Bool GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow, + SCCOL& rEndCol, sal_Bool bNotes ) const; + sal_Bool GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol, + SCROW& rEndRow, sal_Bool bNotes ) const; + + sal_Bool GetDataStart( SCCOL& rStartCol, SCROW& rStartRow ) const; + + void ExtendPrintArea( OutputDevice* pDev, + SCCOL nStartCol, SCROW nStartRow, SCCOL& rEndCol, SCROW nEndRow ); + + void GetDataArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, + sal_Bool bIncludeOld, bool bOnlyDown ) const; + + bool ShrinkToUsedDataArea( bool& o_bShrunk, SCCOL& rStartCol, SCROW& rStartRow, + SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; + + SCSIZE GetEmptyLinesInBlock( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, ScDirection eDir ); + + void FindAreaPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY ); + void GetNextPos( SCCOL& rCol, SCROW& rRow, SCsCOL nMovX, SCsROW nMovY, + sal_Bool bMarked, sal_Bool bUnprotected, const ScMarkData& rMark ); + + void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ); + + sal_Bool HasData( SCCOL nCol, SCROW nRow ); + sal_Bool HasStringData( SCCOL nCol, SCROW nRow ); + sal_Bool HasValueData( SCCOL nCol, SCROW nRow ); + sal_Bool HasStringCells( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow ) const; + + sal_uInt16 GetErrCode( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetErrCode( rPos.Row() ) : + 0; + } + + void ResetChanged( const ScRange& rRange ); + + void SetDirty(); + void SetDirty( const ScRange& ); + void SetDirtyAfterLoad(); + void SetDirtyVar(); + void SetTableOpDirty( const ScRange& ); + void CalcAll(); + void CalcAfterLoad(); + void CompileAll(); + void CompileXML( ScProgress& rProgress ); + + void UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + ScDocument* pUndoDoc = NULL, sal_Bool bIncludeDraw = sal_True, bool bUpdateNoteCaptionPos = true ); + + void UpdateDrawRef( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, bool bUpdateNoteCaptionPos = true ); + + void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest, + ScDocument* pUndoDoc ); + + void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); + + void UpdateInsertTab(SCTAB nTable); + void UpdateDeleteTab( SCTAB nTable, sal_Bool bIsMove, ScTable* pRefUndo = NULL ); + void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& ); + void UpdateCompile( sal_Bool bForceIfNameInUse = false ); + void SetTabNo(SCTAB nNewTab); + sal_Bool IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uInt16 nIndex) const; + void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + std::set<sal_uInt16>& rIndexes) const; + void ReplaceRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + const ScRangeData::IndexMap& rMap ); + void Fill( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, FillDateCmd eFillDateCmd, + double nStepValue, double nMaxValue); + String GetAutoFillPreview( const ScRange& rSource, SCCOL nEndX, SCROW nEndY ); + + void UpdateSelectionFunction( ScFunctionData& rData, + SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + const ScMarkData& rMark ); + + void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + sal_uInt16 nFormatNo ); + void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData); + void ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // from sw + sal_Bool SearchAndReplace(const SvxSearchItem& rSearchItem, + SCCOL& rCol, SCROW& rRow, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + + void FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2 ); + + void GetBorderLines( SCCOL nCol, SCROW nRow, + const ::editeng::SvxBorderLine** ppLeft, const ::editeng::SvxBorderLine** ppTop, + const ::editeng::SvxBorderLine** ppRight, const ::editeng::SvxBorderLine** ppBottom ) const; + + bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, sal_uInt16 nMask ) const; + bool HasAttribSelection( const ScMarkData& rMark, sal_uInt16 nMask ) const; + bool ExtendMerge( SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW& rEndRow, + sal_Bool bRefresh, sal_Bool bAttrs ); + const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const; + const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const; + const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const; + + sal_uLong GetNumberFormat( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) : + 0; + } + sal_uLong GetNumberFormat( SCCOL nCol, SCROW nRow ) const; + sal_uInt32 GetNumberFormat( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const; + void MergeSelectionPattern( ScMergePatternState& rState, + const ScMarkData& rMark, sal_Bool bDeep ) const; + void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, sal_Bool bDeep ) const; + void MergeBlockFrame( SvxBoxItem* pLineOuter, SvxBoxInfoItem* pLineInner, + ScLineFlags& rFlags, + SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow ) const; + void ApplyBlockFrame( const SvxBoxItem* pLineOuter, + const SvxBoxInfoItem* pLineInner, + SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow ); + + void ApplyAttr( SCCOL nCol, SCROW nRow, const SfxPoolItem& rAttr ); + void ApplyPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr ); + void ApplyPatternArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + const ScPatternAttr& rAttr, ScEditDataArray* pDataArray = NULL ); + bool SetAttrEntries(SCCOL nCol, ScAttrEntry* pData, SCSIZE nSize); + + void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, sal_Bool bPutToPool = false ) + { + if (ValidColRow(rPos.Col(),rPos.Row())) + aCol[rPos.Col()].SetPattern( rPos.Row(), rAttr, bPutToPool ); + } + void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, sal_Bool bPutToPool = false ); + void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange, + const ScPatternAttr& rPattern, short nNewType ); + + void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle ); + void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle ); + void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark); + void ApplySelectionLineStyle( const ScMarkData& rMark, + const ::editeng::SvxBorderLine* pLine, sal_Bool bColorOnly ); + + const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const; + const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, sal_Bool& rFound ) const; + const ScStyleSheet* GetAreaStyle( sal_Bool& rFound, SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2 ) const; + + void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, sal_Bool bRemoved, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY ); + + sal_Bool IsStyleSheetUsed( const ScStyleSheet& rStyle, sal_Bool bGatherAllStyles ) const; + + bool ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags ); + bool RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, sal_Int16 nFlags ); + + void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark, ScEditDataArray* pDataArray = NULL ); + void DeleteSelection( sal_uInt16 nDelFlag, const ScMarkData& rMark ); + + void ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark ); + void ChangeSelectionIndent( sal_Bool bIncrement, const ScMarkData& rMark ); + + const ScRange* GetRepeatColRange() const { return pRepeatColRange; } + const ScRange* GetRepeatRowRange() const { return pRepeatRowRange; } + void SetRepeatColRange( const ScRange* pNew ); + void SetRepeatRowRange( const ScRange* pNew ); + + sal_uInt16 GetPrintRangeCount() const { return static_cast< sal_uInt16 >( aPrintRanges.size() ); } + const ScRange* GetPrintRange(sal_uInt16 nPos) const; + /** Returns true, if the sheet is always printed. */ + bool IsPrintEntireSheet() const { return bPrintEntireSheet; } + + /** Removes all print ranges. */ + void ClearPrintRanges(); + /** Adds a new print ranges. */ + void AddPrintRange( const ScRange& rNew ); + /** Marks the specified sheet to be printed completely. Deletes old print ranges! */ + void SetPrintEntireSheet(); + + void FillPrintSaver( ScPrintSaverTab& rSaveTab ) const; + void RestorePrintRanges( const ScPrintSaverTab& rSaveTab ); + + sal_uInt16 GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bFormula, const ScMarkData* pMarkData, + const ScColWidthParam* pParam ); + sal_Bool SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bForce, + ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 ); + + void SetOptimalHeightOnly(SCROW nStartRow, SCROW nEndRow, sal_uInt16 nExtra, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bForce, + ScProgress* pOuterProgress = NULL, sal_uLong nProgressStart = 0 ); + + long GetNeededSize( SCCOL nCol, SCROW nRow, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + sal_Bool bWidth, sal_Bool bTotalSize ); + void SetColWidth( SCCOL nCol, sal_uInt16 nNewWidth ); + void SetColWidthOnly( SCCOL nCol, sal_uInt16 nNewWidth ); + void SetRowHeight( SCROW nRow, sal_uInt16 nNewHeight ); + sal_Bool SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight, + double nPPTX, double nPPTY ); + + /** + * Set specified row height to specified ranges. Don't check for drawing + * objects etc. Just set the row height. Nothing else. + * + * Note that setting a new row height via this function will not + * invalidate page breaks. + */ + void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, sal_uInt16 nNewHeight ); + + // nPPT to test for modification + void SetManualHeight( SCROW nStartRow, SCROW nEndRow, sal_Bool bManual ); + + sal_uInt16 GetColWidth( SCCOL nCol ) const; + SC_DLLPUBLIC sal_uInt16 GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const; + sal_uLong GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const; + sal_uLong GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const; + sal_uLong GetColOffset( SCCOL nCol ) const; + sal_uLong GetRowOffset( SCROW nRow ) const; + + /** + * Get the last row such that the height of row 0 to the end row is as + * high as possible without exceeding the specified height value. + * + * @param nHeight maximum desired height + * + * @return SCROW last row of the range within specified height. + */ + SCROW GetRowForHeight(sal_uLong nHeight) const; + + sal_uInt16 GetOriginalWidth( SCCOL nCol ) const; + sal_uInt16 GetOriginalHeight( SCROW nRow ) const; + + sal_uInt16 GetCommonWidth( SCCOL nEndCol ); + + SCROW GetHiddenRowCount( SCROW nRow ); + + void ShowCol(SCCOL nCol, bool bShow); + void ShowRow(SCROW nRow, bool bShow); + void DBShowRow(SCROW nRow, bool bShow); + + void ShowRows(SCROW nRow1, SCROW nRow2, bool bShow); + void DBShowRows(SCROW nRow1, SCROW nRow2, bool bShow); + + void SetColFlags( SCCOL nCol, sal_uInt8 nNewFlags ); + void SetRowFlags( SCROW nRow, sal_uInt8 nNewFlags ); + void SetRowFlags( SCROW nStartRow, SCROW nEndRow, sal_uInt8 nNewFlags ); + + /// @return the index of the last row with any set flags (auto-pagebreak is ignored). + SCROW GetLastFlaggedRow() const; + + /// @return the index of the last changed column (flags and column width, auto pagebreak is ignored). + SCCOL GetLastChangedCol() const; + /// @return the index of the last changed row (flags and row height, auto pagebreak is ignored). + SCROW GetLastChangedRow() const; + + bool IsDataFiltered() const; + sal_uInt8 GetColFlags( SCCOL nCol ) const; + sal_uInt8 GetRowFlags( SCROW nRow ) const; + + const ScBitMaskCompressedArray< SCROW, sal_uInt8> * GetRowFlagsArray() const + { return pRowFlags; } + + sal_Bool UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, sal_Bool bShow ); + sal_Bool UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, sal_Bool bShow ); + + void UpdatePageBreaks( const ScRange* pUserArea ); + void RemoveManualBreaks(); + sal_Bool HasManualBreaks() const; + void SetRowManualBreaks( const ::std::set<SCROW>& rBreaks ); + void SetColManualBreaks( const ::std::set<SCCOL>& rBreaks ); + + void GetAllRowBreaks(::std::set<SCROW>& rBreaks, bool bPage, bool bManual) const; + void GetAllColBreaks(::std::set<SCCOL>& rBreaks, bool bPage, bool bManual) const; + bool HasRowPageBreak(SCROW nRow) const; + bool HasColPageBreak(SCCOL nCol) const; + bool HasRowManualBreak(SCROW nRow) const; + bool HasColManualBreak(SCCOL nCol) const; + + /** + * Get the row position of the next manual break that occurs at or below + * specified row. When no more manual breaks are present at or below + * the specified row, -1 is returned. + * + * @param nRow row at which the search begins. + * + * @return SCROW next row position with manual page break, or -1 if no + * more manual breaks are present. + */ + SCROW GetNextManualBreak(SCROW nRow) const; + + void RemoveRowPageBreaks(SCROW nStartRow, SCROW nEndRow); + void RemoveRowBreak(SCROW nRow, bool bPage, bool bManual); + void RemoveColBreak(SCCOL nCol, bool bPage, bool bManual); + void SetRowBreak(SCROW nRow, bool bPage, bool bManual); + void SetColBreak(SCCOL nCol, bool bPage, bool bManual); + ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::TablePageBreakData> GetRowBreakData() const; + + bool RowHidden(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const; + bool RowHiddenLeaf(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const; + bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const; + bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const; + bool SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden); + bool SetColHidden(SCCOL nStartCol, SCCOL nEndCol, bool bHidden); + void CopyColHidden(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol); + void CopyRowHidden(ScTable& rTable, SCROW nStartRow, SCROW nEndRow); + void CopyRowHeight(ScTable& rSrcTable, SCROW nStartRow, SCROW nEndRow, SCROW nSrcOffset); + SCROW FirstVisibleRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW LastVisibleRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW CountVisibleRows(SCROW nStartRow, SCROW nEndRow) const; + sal_uInt32 GetTotalRowHeight(SCROW nStartRow, SCROW nEndRow) const; + + SCCOLROW LastHiddenColRow(SCCOLROW nPos, bool bCol) const; + + bool RowFiltered(SCROW nRow, SCROW* pFirstRow = NULL, SCROW* pLastRow = NULL) const; + bool ColFiltered(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const; + bool HasFilteredRows(SCROW nStartRow, SCROW nEndRow) const; + void CopyColFiltered(ScTable& rTable, SCCOL nStartCol, SCCOL nEndCol); + void CopyRowFiltered(ScTable& rTable, SCROW nStartRow, SCROW nEndRow); + void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, bool bFiltered); + void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, bool bFiltered); + SCROW FirstNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW LastNonFilteredRow(SCROW nStartRow, SCROW nEndRow) const; + SCROW CountNonFilteredRows(SCROW nStartRow, SCROW nEndRow) const; + + void SyncColRowFlags(); + + void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); + void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); + + void Sort(const ScSortParam& rSortParam, sal_Bool bKeepQuery); + sal_Bool ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam, + sal_Bool* pSpecial = NULL, ScBaseCell* pCell = NULL, + sal_Bool* pbTestEqualCondition = NULL ); + void TopTenQuery( ScQueryParam& ); + SCSIZE Query(ScQueryParam& rQueryParam, sal_Bool bKeepSub); + sal_Bool CreateQueryParam(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); + + void GetFilterEntries(SCCOL nCol, SCROW nRow1, SCROW nRow2, TypedScStrCollection& rStrings, bool& rHasDates); + void GetFilteredFilterEntries( SCCOL nCol, SCROW nRow1, SCROW nRow2, const ScQueryParam& rParam, TypedScStrCollection& rStrings, bool& rHasDates ); + sal_Bool GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, sal_Bool bLimit); + + sal_Bool HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); + sal_Bool HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); + + void DoColResize( SCCOL nCol1, SCCOL nCol2, SCSIZE nAdd ); + + + sal_Int32 GetMaxStringLen( SCCOL nCol, + SCROW nRowStart, SCROW nRowEnd, CharSet eCharSet ) const; + xub_StrLen GetMaxNumberStringLen( sal_uInt16& nPrecision, + SCCOL nCol, + SCROW nRowStart, SCROW nRowEnd ) const; + + void FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges ); + + void IncRecalcLevel(); + void DecRecalcLevel( bool bUpdateNoteCaptionPos = true ); + + sal_Bool IsSortCollatorGlobal() const; + void InitSortCollator( const ScSortParam& rPar ); + void DestroySortCollator(); + void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true ); + + void SetRangeName(ScRangeName* pNew); + ScRangeName* GetRangeName() const; + void UpdateMoveTab(SCTAB nOldPos,SCTAB nNewPos); + +private: + void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd, + FillDateCmd eFillDateCmd, + double nStepValue, double nMaxValue, sal_uInt16 nMinDigits, + sal_Bool bAttribs, ScProgress& rProgress ); + void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + FillCmd& rCmd, FillDateCmd& rDateCmd, + double& rInc, sal_uInt16& rMinDigits, + ScUserListData*& rListData, sal_uInt16& rListIndex); + void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + sal_uLong nFillCount, FillDir eFillDir, ScProgress& rProgress ); + + sal_Bool ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark, + sal_Bool bMarked, sal_Bool bUnprotected ); + + void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + const ScPatternAttr& rAttr, sal_uInt16 nFormatNo); + void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, sal_uInt16 nIndex, ScAutoFormatData& rData); + void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, sal_uInt16 nFlags, sal_uInt16 nIndex, ScAutoFormatData& rData); + sal_Bool SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow, + const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc); + sal_Bool Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc); + sal_Bool SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + sal_Bool Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc); + sal_Bool ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + + sal_Bool SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + ScMarkData& rMark); + sal_Bool ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + ScMarkData& rMark, sal_Bool bIsUndo); + sal_Bool SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark); + sal_Bool ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark, + ScDocument* pUndoDoc); + bool SearchAndReplaceEmptyCells( + const SvxSearchItem& rSearchItem, + SCCOL& rCol, SCROW& rRow, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + bool SearchRangeForEmptyCell(const ScRange& rRange, + const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + String& rUndoStr, ScDocument* pUndoDoc); + bool SearchRangeForAllEmptyCells(const ScRange& rRange, + const SvxSearchItem& rSearchItem, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + + // use the global sort parameter: + sal_Bool IsSorted(SCCOLROW nStart, SCCOLROW nEnd); + void DecoladeRow( ScSortInfoArray*, SCROW nRow1, SCROW nRow2 ); + void SwapCol(SCCOL nCol1, SCCOL nCol2); + void SwapRow(SCROW nRow1, SCROW nRow2); + short CompareCell( sal_uInt16 nSort, + ScBaseCell* pCell1, SCCOL nCell1Col, SCROW nCell1Row, + ScBaseCell* pCell2, SCCOL nCell2Col, SCROW nCell2Row ); + short Compare(SCCOLROW nIndex1, SCCOLROW nIndex2); + short Compare( ScSortInfoArray*, SCCOLROW nIndex1, SCCOLROW nIndex2); + ScSortInfoArray* CreateSortInfoArray( SCCOLROW nInd1, SCCOLROW nInd2 ); + void QuickSort( ScSortInfoArray*, SCsCOLROW nLo, SCsCOLROW nHi); + void SortReorder( ScSortInfoArray*, ScProgress& ); + + sal_Bool CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); + sal_Bool CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); + void GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr); + + sal_Bool RefVisible(ScFormulaCell* pCell); + + sal_Bool IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol); + + void IncDate(double& rVal, sal_uInt16& nDayOfMonth, double nStep, FillDateCmd eCmd); + void FillFormula(sal_uLong& nFormulaCounter, sal_Bool bFirst, ScFormulaCell* pSrcCell, + SCCOL nDestCol, SCROW nDestRow, sal_Bool bLast ); + void UpdateInsertTabAbs(SCTAB nNewPos); + sal_Bool GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, sal_Bool bInSel, + const ScMarkData& rMark) const; + sal_Bool GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ); + sal_Bool TestTabRefAbs(SCTAB nTable); + void CompileDBFormula(); + void CompileDBFormula( sal_Bool bCreateFormulaString ); + void CompileNameFormula( sal_Bool bCreateFormulaString ); + void CompileColRowNameFormula(); + + void StartListening( const ScAddress& rAddress, SvtListener* pListener ); + void EndListening( const ScAddress& rAddress, SvtListener* pListener ); + void StartAllListeners(); + void StartNeededListeners(); // only for cells where NeedsListening()==TRUE + void SetRelNameDirty(); + + void SetLoadingMedium(bool bLoading); + + SCSIZE FillMaxRot( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCCOL nX2, + SCCOL nCol, SCROW nAttrRow1, SCROW nAttrRow2, SCSIZE nArrY, + const ScPatternAttr* pPattern, const SfxItemSet* pCondSet ); + + // idle calculation of OutputDevice text width for cell + // also invalidates script type, broadcasts for "calc as shown" + void InvalidateTextWidth( const ScAddress* pAdrFrom, const ScAddress* pAdrTo, + sal_Bool bNumFormatChanged, sal_Bool bBroadcast ); + + void SkipFilteredRows(SCROW& rRow, SCROW& rLastNonFilteredRow, bool bForward); + + /** + * In case the cell text goes beyond the column width, move the max column + * position to the right. This is called from ExtendPrintArea. + */ + void MaybeAddExtraColumn(SCCOL& rCol, SCROW nRow, OutputDevice* pDev, double nPPTX, double nPPTY); + + void CopyPrintRange(const ScTable& rTable); + + /** + * Use this to iterate through non-empty visible cells in a single column. + */ + class VisibleDataCellIterator + { + public: + static SCROW ROW_NOT_FOUND; + + explicit VisibleDataCellIterator(ScFlatBoolRowSegments& rRowSegs, ScColumn& rColumn); + ~VisibleDataCellIterator(); + + /** + * Set the start row position. In case there is not visible data cell + * at the specified row position, it will move to the position of the + * first visible data cell below that point. + * + * @return First visible data cell if found, or NULL otherwise. + */ + ScBaseCell* reset(SCROW nRow); + + /** + * Find the next visible data cell position. + * + * @return Next visible data cell if found, or NULL otherwise. + */ + ScBaseCell* next(); + + /** + * Get the current row position. + * + * @return Current row position, or ROW_NOT_FOUND if the iterator + * doesn't point to a valid data cell position. + */ + SCROW getRow() const; + + private: + ScFlatBoolRowSegments& mrRowSegs; + ScColumn& mrColumn; + ScBaseCell* mpCell; + SCROW mnCurRow; + SCROW mnUBound; + }; +}; + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx new file mode 100644 index 000000000000..f21d70ec1a7d --- /dev/null +++ b/sc/inc/tablink.hxx @@ -0,0 +1,120 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TABLINK_HXX +#define SC_TABLINK_HXX + +#include "scdllapi.h" +#include "refreshtimer.hxx" +#include <sfx2/lnkbase.hxx> + +#include <sfx2/objsh.hxx> + +class ScDocShell; +struct TableLink_Impl; + +class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer +{ +private: + TableLink_Impl* pImpl; + String aFileName; + String aFilterName; + String aOptions; + sal_Bool bInCreate; + sal_Bool bInEdit; + sal_Bool bAddUndo; + sal_Bool bDoPaint; + +public: + TYPEINFO(); + ScTableLink( ScDocShell* pDocSh, const String& rFile, + const String& rFilter, const String& rOpt, sal_uLong nRefresh ); + ScTableLink( SfxObjectShell* pShell, const String& rFile, + const String& rFilter, const String& rOpt, sal_uLong nRefresh ); + virtual ~ScTableLink(); + virtual void Closed(); + virtual void DataChanged( const String& rMimeType, + const ::com::sun::star::uno::Any & rValue ); + + virtual void Edit( Window*, const Link& rEndEditHdl ); + + sal_Bool Refresh(const String& rNewFile, const String& rNewFilter, + const String* pNewOptions /* = NULL */, sal_uLong nNewRefresh ); + void SetInCreate(sal_Bool bSet) { bInCreate = bSet; } + void SetAddUndo(sal_Bool bSet) { bAddUndo = bSet; } + void SetPaint(sal_Bool bSet) { bDoPaint = bSet; } + + const String& GetFileName() const { return aFileName; } + const String& GetFilterName() const { return aFilterName; } + const String& GetOptions() const { return aOptions; } + + sal_Bool IsUsed() const; + + DECL_LINK( RefreshHdl, ScTableLink* ); + DECL_LINK( TableEndEditHdl, ::sfx2::SvBaseLink* ); +}; + +class ScDocument; +class SfxMedium; + +class SC_DLLPUBLIC ScDocumentLoader +{ +private: + ScDocShell* pDocShell; + SfxObjectShellRef aRef; + SfxMedium* pMedium; + +public: + ScDocumentLoader( const String& rFileName, + String& rFilterName, String& rOptions, + sal_uInt32 nRekCnt = 0, sal_Bool bWithInteraction = false ); + ~ScDocumentLoader(); + ScDocument* GetDocument(); + ScDocShell* GetDocShell() { return pDocShell; } + sal_Bool IsError() const; + String GetTitle() const; + + void ReleaseDocRef(); // without calling DoClose + + static String GetOptions( SfxMedium& rMedium ); + + /** Returns the filter name and options from a file name. + @param bWithContent + true = Tries to detect the filter by looking at the file contents. + false = Detects filter by file name extension only (should be used in filter code only). + @return sal_True if a filter could be found, sal_False otherwise. */ + static sal_Bool GetFilterName( const String& rFileName, + String& rFilter, String& rOptions, + sal_Bool bWithContent, sal_Bool bWithInteraction ); + + static void RemoveAppPrefix( String& rFilterName ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/tabopparams.hxx b/sc/inc/tabopparams.hxx new file mode 100644 index 000000000000..7a505c79c2be --- /dev/null +++ b/sc/inc/tabopparams.hxx @@ -0,0 +1,99 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TABOPPARAMS_HXX +#define SC_TABOPPARAMS_HXX + +#include "global.hxx" +#include "address.hxx" + +#include <vector> + +class ScFormulaCell; + +struct ScInterpreterTableOpParams +{ + ScAddress aOld1; + ScAddress aNew1; + ScAddress aOld2; + ScAddress aNew2; + ScAddress aFormulaPos; + ::std::vector< ScFormulaCell* > aNotifiedFormulaCells; + ::std::vector< ScAddress > aNotifiedFormulaPos; + sal_Bool bValid; + sal_Bool bRefresh; + sal_Bool bCollectNotifications; + + ScInterpreterTableOpParams() + : bValid( false ) + , bRefresh( false ) + , bCollectNotifications( sal_True ) + { + } + + ScInterpreterTableOpParams( const ScInterpreterTableOpParams& r ) + : aOld1( r.aOld1 ) + , aNew1( r.aNew1 ) + , aOld2( r.aOld2 ) + , aNew2( r.aNew2 ) + , aFormulaPos( r.aFormulaPos ) + , aNotifiedFormulaPos( r.aNotifiedFormulaPos ) + , bValid( r.bValid ) + , bRefresh( r.bRefresh ) + , bCollectNotifications( r.bCollectNotifications ) + { + } + + ScInterpreterTableOpParams& operator =( const ScInterpreterTableOpParams& r ) + { + aOld1 = r.aOld1; + aNew1 = r.aNew1; + aOld2 = r.aOld2; + aNew2 = r.aNew2; + aFormulaPos = r.aFormulaPos; + ::std::vector< ScFormulaCell* >().swap( aNotifiedFormulaCells ); + aNotifiedFormulaPos = r.aNotifiedFormulaPos; + bValid = r.bValid; + bRefresh = r.bRefresh; + bCollectNotifications = r.bCollectNotifications; + return *this; + } + + sal_Bool operator ==( const ScInterpreterTableOpParams& r ) + { + return + bValid && r.bValid && + aOld1 == r.aOld1 && + aOld2 == r.aOld2 && + aFormulaPos == r.aFormulaPos ; + } +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx new file mode 100644 index 000000000000..5feab594719f --- /dev/null +++ b/sc/inc/tabprotection.hxx @@ -0,0 +1,188 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TAB_PROTECTION_HXX +#define SC_TAB_PROTECTION_HXX + +#include "sal/types.h" +#include <com/sun/star/uno/Sequence.hxx> + +#include "global.hxx" +#include <boost/shared_ptr.hpp> + +class ScDocument; +class ScTableProtectionImpl; + +enum ScPasswordHash +{ + PASSHASH_SHA1 = 0, + PASSHASH_XL, + PASSHASH_UNSPECIFIED +}; + +class ScPassHashHelper +{ +public: + /** Check for the compatibility of all password hashes. If there is at + least one hash that needs to be regenerated, it returns true. If all + hash values are compatible with the specified hash type, then it + returns false. */ + static bool needsPassHashRegen(const ScDocument& rDoc, ScPasswordHash eHash1, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED); + + static ::rtl::OUString getHashURI(ScPasswordHash eHash); + + static ScPasswordHash getHashTypeFromURI(const ::rtl::OUString& rURI); + +private: + ScPassHashHelper(); + ~ScPassHashHelper(); +}; + +// ============================================================================ + +class SAL_NO_VTABLE ScPassHashProtectable +{ +public: + virtual ~ScPassHashProtectable() = 0; + + virtual bool isProtected() const = 0; + virtual bool isProtectedWithPass() const = 0; + virtual void setProtected(bool bProtected) = 0; + + virtual bool isPasswordEmpty() const = 0; + virtual bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const = 0; + virtual void setPassword(const String& aPassText) = 0; + virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash( + ScPasswordHash eHash, ScPasswordHash eHas2 = PASSHASH_UNSPECIFIED) const = 0; + virtual void setPasswordHash( + const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, + ScPasswordHash eHash = PASSHASH_SHA1, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) = 0; + virtual bool verifyPassword(const String& aPassText) const = 0; +}; + +// ============================================================================ + +class SC_DLLPUBLIC ScDocProtection : public ScPassHashProtectable +{ +public: + enum Option + { + STRUCTURE = 0, + WINDOWS, + CONTENT, + NONE // last item - used to resize the vector + }; + + explicit ScDocProtection(); + explicit ScDocProtection(const ScDocProtection& r); + virtual ~ScDocProtection(); + + virtual bool isProtected() const; + virtual bool isProtectedWithPass() const; + virtual void setProtected(bool bProtected); + + virtual bool isPasswordEmpty() const; + virtual bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const; + virtual void setPassword(const String& aPassText); + virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash( + ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const; + virtual void setPasswordHash( + const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, + ScPasswordHash eHash = PASSHASH_SHA1, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED); + virtual bool verifyPassword(const String& aPassText) const; + + bool isOptionEnabled(Option eOption) const; + void setOption(Option eOption, bool bEnabled); + +private: + ::boost::shared_ptr<ScTableProtectionImpl> mpImpl; +}; + +// ============================================================================ + +/** sheet protection state container + + This class stores sheet's protection state: 1) whether the protection + is on, 2) password and/or password hash, and 3) any associated + protection options. This class is also used as a protection state + container for the undo/redo stack, in which case the password, hash and + the options need to be preserved even when the protection flag is + off. */ +class SC_DLLPUBLIC ScTableProtection : public ScPassHashProtectable +{ +public: + enum Option + { + AUTOFILTER = 0, + DELETE_COLUMNS, + DELETE_ROWS, + FORMAT_CELLS, + FORMAT_COLUMNS, + FORMAT_ROWS, + INSERT_COLUMNS, + INSERT_HYPERLINKS, + INSERT_ROWS, + OBJECTS, + PIVOT_TABLES, + SCENARIOS, + SELECT_LOCKED_CELLS, + SELECT_UNLOCKED_CELLS, + SHEET, + SORT, + NONE // last item - used to resize the vector + }; + + explicit ScTableProtection(); + explicit ScTableProtection(const ScTableProtection& r); + virtual ~ScTableProtection(); + + virtual bool isProtected() const; + virtual bool isProtectedWithPass() const; + virtual void setProtected(bool bProtected); + + virtual bool isPasswordEmpty() const; + virtual bool hasPasswordHash(ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const; + virtual void setPassword(const String& aPassText); + virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash( + ScPasswordHash eHash, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED) const; + virtual void setPasswordHash( + const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, + ScPasswordHash eHash = PASSHASH_SHA1, ScPasswordHash eHash2 = PASSHASH_UNSPECIFIED); + virtual bool verifyPassword(const String& aPassText) const; + + bool isOptionEnabled(Option eOption) const; + void setOption(Option eOption, bool bEnabled); + +private: + ::boost::shared_ptr<ScTableProtectionImpl> mpImpl; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/targuno.hxx b/sc/inc/targuno.hxx new file mode 100644 index 000000000000..15cbb57e0a40 --- /dev/null +++ b/sc/inc/targuno.hxx @@ -0,0 +1,208 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TARGUNO_HXX +#define SC_TARGUNO_HXX + +#include <svl/lstner.hxx> +#include <tools/string.hxx> +#include <com/sun/star/document/XLinkTargetSupplier.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/PropertyValues.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/beans/XPropertySetInfo.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XFastPropertySet.hpp> +#include <com/sun/star/beans/XVetoableChangeListener.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XPropertyStateChangeListener.hpp> +#include <com/sun/star/beans/PropertyAttribute.hpp> +#include <com/sun/star/beans/XPropertiesChangeListener.hpp> +#include <com/sun/star/beans/XPropertyChangeListener.hpp> +#include <com/sun/star/beans/XPropertyAccess.hpp> +#include <com/sun/star/beans/XPropertyContainer.hpp> +#include <com/sun/star/beans/PropertyStateChangeEvent.hpp> +#include <com/sun/star/beans/PropertyChangeEvent.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/container/XHierarchicalNameAccess.hpp> +#include <com/sun/star/container/XNameAccess.hpp> +#include <com/sun/star/container/XContentEnumerationAccess.hpp> +#include <com/sun/star/container/XEnumeration.hpp> +#include <com/sun/star/container/XElementAccess.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <cppuhelper/implbase2.hxx> +#include <cppuhelper/implbase3.hxx> + +class ScDocShell; + + +#define SC_LINKTARGETTYPE_SHEET 0 +#define SC_LINKTARGETTYPE_RANGENAME 1 +#define SC_LINKTARGETTYPE_DBAREA 2 + +#define SC_LINKTARGETTYPE_COUNT 3 + +#define SCLINKTARGET_SERVICE "com.sun.star.document.LinkTarget" + + +//! Graphic / OleObject (need separate collections!) + + +class ScLinkTargetTypesObj : public ::cppu::WeakImplHelper2< + ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + String aNames[SC_LINKTARGETTYPE_COUNT]; + +public: + ScLinkTargetTypesObj(ScDocShell* pDocSh); + virtual ~ScLinkTargetTypesObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // ::com::sun::star::container::XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString& aName) + throw( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); +}; + + +class ScLinkTargetTypeObj : public ::cppu::WeakImplHelper3< + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::document::XLinkTargetSupplier, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + sal_uInt16 nType; + String aName; + +public: + ScLinkTargetTypeObj(ScDocShell* pDocSh, sal_uInt16 nT); + virtual ~ScLinkTargetTypeObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + static void SetLinkTargetBitmap( ::com::sun::star::uno::Any& rRet, sal_uInt16 nType ); + + // ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL setPropertyValue(const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue(const ::rtl::OUString& PropertyName) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addPropertyChangeListener(const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & xListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removePropertyChangeListener(const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener > & aListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL addVetoableChangeListener(const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual void SAL_CALL removeVetoableChangeListener(const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener > & aListener) + throw( ::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::document::XLinkTargetSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL getLinks(void) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); +}; + + +class ScLinkTargetsObj : public ::cppu::WeakImplHelper2< + ::com::sun::star::container::XNameAccess, + ::com::sun::star::lang::XServiceInfo > +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > xCollection; + +public: + ScLinkTargetsObj( const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > & rColl ); + virtual ~ScLinkTargetsObj(); + + // ::com::sun::star::container::XNameAccess + virtual ::com::sun::star::uno::Any SAL_CALL getByName(const ::rtl::OUString& aName) + throw( ::com::sun::star::container::NoSuchElementException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::container::XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException ); + + // ::com::sun::star::lang::XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); + virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx new file mode 100644 index 000000000000..17d6d77a9a7f --- /dev/null +++ b/sc/inc/textuno.hxx @@ -0,0 +1,420 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TEXTSUNO_HXX +#define SC_TEXTSUNO_HXX + +#include "global.hxx" // ScRange, ScAddress +#include "address.hxx" +#include <editeng/unotext.hxx> +#include <svl/brdcst.hxx> +#include <svl/lstner.hxx> +#include <com/sun/star/text/XTextFieldsSupplier.hpp> +#include <com/sun/star/sheet/XHeaderFooterContent.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase5.hxx> +#include "scdllapi.h" + +class EditEngine; +class EditTextObject; +class SvxEditEngineForwarder; +class ScDocShell; +class ScAddress; +class ScCellObj; +class ScSimpleEditSource; +class ScSharedCellEditSource; +class ScEditEngineDefaulter; +class ScFieldEditEngine; + +struct ScHeaderFieldData; + + +#define SC_HDFT_LEFT 0 +#define SC_HDFT_CENTER 1 +#define SC_HDFT_RIGHT 2 + + +// ScHeaderFooterContentObj is a dumb container which must be re-written into +// the page template using setPropertyValue + +class ScHeaderFooterContentObj : public cppu::WeakImplHelper3< + com::sun::star::sheet::XHeaderFooterContent, + com::sun::star::lang::XUnoTunnel, + com::sun::star::lang::XServiceInfo > +{ +private: + EditTextObject* pLeftText; + EditTextObject* pCenterText; + EditTextObject* pRightText; + SfxBroadcaster aBC; + + ScHeaderFooterContentObj(); // disabled + +public: + ScHeaderFooterContentObj( const EditTextObject* pLeft, + const EditTextObject* pCenter, + const EditTextObject* pRight ); + virtual ~ScHeaderFooterContentObj(); + + // for ScPageHFItem (using getImplementation) + const EditTextObject* GetLeftEditObject() const { return pLeftText; } + const EditTextObject* GetCenterEditObject() const { return pCenterText; } + const EditTextObject* GetRightEditObject() const { return pRightText; } + + void AddListener( SfxListener& rListener ); + void RemoveListener( SfxListener& rListener ); + + void UpdateText( sal_uInt16 nPart, EditEngine& rSource ); + + // XHeaderFooterContent + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getLeftText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getCenterText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getRightText() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScHeaderFooterContentObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::sheet::XHeaderFooterContent> xObj ); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +// ScHeaderFooterTextData: shared data between sub objects of a ScHeaderFooterTextObj + +class ScHeaderFooterTextData : public SfxListener +{ +private: + ScHeaderFooterContentObj& rContentObj; + sal_uInt16 nPart; + ScEditEngineDefaulter* pEditEngine; + SvxEditEngineForwarder* pForwarder; + sal_Bool bDataValid; + sal_Bool bInUpdate; + +public: + ScHeaderFooterTextData( ScHeaderFooterContentObj& rContent, + sal_uInt16 nP ); + ~ScHeaderFooterTextData(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // helper functions + SvxTextForwarder* GetTextForwarder(); + void UpdateData(); + ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine; } + + sal_uInt16 GetPart() const { return nPart; } + ScHeaderFooterContentObj& GetContentObj() const { return rContentObj; } +}; + +// ScHeaderFooterTextObj changes the text in a ScHeaderFooterContentObj + +class ScHeaderFooterTextObj : public cppu::WeakImplHelper5< + com::sun::star::text::XText, + com::sun::star::text::XTextRangeMover, + com::sun::star::container::XEnumerationAccess, + com::sun::star::text::XTextFieldsSupplier, + com::sun::star::lang::XServiceInfo > +{ +private: + ScHeaderFooterTextData aTextData; + SvxUnoText* pUnoText; + + void CreateUnoText_Impl(); + +public: + ScHeaderFooterTextObj( ScHeaderFooterContentObj& rContent, + sal_uInt16 nP ); + virtual ~ScHeaderFooterTextObj(); + + const SvxUnoText& GetUnoText(); + + static void FillDummyFieldData( ScHeaderFieldData& rData ); + + // XText + virtual void SAL_CALL insertTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent, + sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeTextContent( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextContent >& xContent ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XSimpleText + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursor() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextCursor > SAL_CALL + createTextCursorByRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& aTextPosition ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertString( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + const ::rtl::OUString& aString, sal_Bool bAbsorb ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertControlCharacter( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + sal_Int16 nControlCharacter, sal_Bool bAbsorb ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // XTextRange + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getString() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setString( const ::rtl::OUString& aString ) + throw(::com::sun::star::uno::RuntimeException); + + // XTextRangeMover + virtual void SAL_CALL moveTextRange( const ::com::sun::star::uno::Reference< + ::com::sun::star::text::XTextRange >& xRange, + sal_Int16 nParagraphs ) + throw(::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XTextFieldsSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumerationAccess > SAL_CALL + getTextFields() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL + getTextFieldMasters() throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + + +// derived cursor objects for getImplementation and getText/getStart/getEnd + +//! uno3: SvxUnoTextCursor is not derived from XUnoTunnel, but should be (?) + +class ScCellTextCursor : public SvxUnoTextCursor +{ + ScCellObj& rTextObj; + +public: + ScCellTextCursor(const ScCellTextCursor& rOther); + ScCellTextCursor(ScCellObj& rText); + virtual ~ScCellTextCursor() throw(); + + ScCellObj& GetCellObj() const { return rTextObj; } + + // SvxUnoTextCursor methods reimplemented here: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScCellTextCursor* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); +}; + +class ScHeaderFooterTextCursor : public SvxUnoTextCursor +{ +private: + ScHeaderFooterTextObj& rTextObj; + +public: + ScHeaderFooterTextCursor(const ScHeaderFooterTextCursor& rOther); + ScHeaderFooterTextCursor(ScHeaderFooterTextObj& rText); + virtual ~ScHeaderFooterTextCursor() throw(); + + // SvxUnoTextCursor methods reimplemented here: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScHeaderFooterTextCursor* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); +}; + +class ScDrawTextCursor : public SvxUnoTextCursor +{ +private: + com::sun::star::uno::Reference< com::sun::star::text::XText > xParentText; + +public: + ScDrawTextCursor(const ScDrawTextCursor& rOther); + ScDrawTextCursor( const com::sun::star::uno::Reference< + com::sun::star::text::XText >& xParent, + const SvxUnoTextBase& rText ); + virtual ~ScDrawTextCursor() throw(); + + // SvxUnoTextCursor methods reimplemented here: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XText > SAL_CALL + getText() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getStart() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > SAL_CALL + getEnd() throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScDrawTextCursor* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); +}; + + +// ScAnnotationTextCursor isn't needed anymore - SvxUnoTextCursor is used instead + + +// ScEditEngineTextObj for formatted cell content that is not inserted in a cell or header/footer +// (used for XML export of change tracking contents) + +class ScSimpleEditSourceHelper +{ + ScEditEngineDefaulter* pEditEngine; + SvxEditEngineForwarder* pForwarder; + ScSimpleEditSource* pOriginalSource; + +public: + ScSimpleEditSourceHelper(); + ~ScSimpleEditSourceHelper(); + + ScSimpleEditSource* GetOriginalSource() const { return pOriginalSource; } + ScEditEngineDefaulter* GetEditEngine() const { return pEditEngine; } +}; + +class ScEditEngineTextObj : public ScSimpleEditSourceHelper, public SvxUnoText +{ +public: + ScEditEngineTextObj(); + virtual ~ScEditEngineTextObj() throw(); + + void SetText( const EditTextObject& rTextObject ); + EditTextObject* CreateTextObject(); +}; + + +// ScCellTextData: shared data between sub objects of a cell text object + +class ScCellTextData : public SfxListener +{ +protected: + ScDocShell* pDocShell; + ScAddress aCellPos; + ScFieldEditEngine* pEditEngine; + SvxEditEngineForwarder* pForwarder; + ScSharedCellEditSource* pOriginalSource; + sal_Bool bDataValid; + sal_Bool bInUpdate; + sal_Bool bDirty; + sal_Bool bDoUpdate; + +protected: + virtual void GetCellText(const ScAddress& rCellPos, String& rText); + +public: + ScCellTextData(ScDocShell* pDocSh, const ScAddress& rP); + virtual ~ScCellTextData(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // helper functions for ScSharedCellEditSource: + virtual SvxTextForwarder* GetTextForwarder(); + void UpdateData(); + ScFieldEditEngine* GetEditEngine() { GetTextForwarder(); return pEditEngine; } + + ScSharedCellEditSource* GetOriginalSource(); // used as argument for SvxUnoText ctor + + // used for ScCellEditSource: + ScDocShell* GetDocShell() const { return pDocShell; } + const ScAddress& GetCellPos() const { return aCellPos; } + + void SetDirty(sal_Bool bValue) { bDirty = bValue; } + sal_Bool IsDirty() const { return bDirty; } + void SetDoUpdate(sal_Bool bValue) { bDoUpdate = bValue; } +}; + +class ScCellTextObj : public ScCellTextData, public SvxUnoText +{ +public: + ScCellTextObj(ScDocShell* pDocSh, const ScAddress& rP); + virtual ~ScCellTextObj() throw(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx new file mode 100644 index 000000000000..9e766b0adb35 --- /dev/null +++ b/sc/inc/token.hxx @@ -0,0 +1,525 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TOKEN_HXX +#define SC_TOKEN_HXX + +#include <memory> +#include <vector> +#include <boost/intrusive_ptr.hpp> + +#include "formula/opcode.hxx" +#include "refdata.hxx" +#include "scmatrix.hxx" +#include <tools/mempool.hxx> +#include "scdllapi.h" +#include "formula/IFunctionDescription.hxx" +#include "formula/token.hxx" + + +class ScJumpMatrix; +class ScToken; + +typedef ::std::vector< ScComplexRefData > ScRefList; +typedef ::boost::intrusive_ptr<ScToken> ScTokenRef; + +class SC_DLLPUBLIC ScToken : public formula::FormulaToken +{ +private: + // not implemented, prevent usage + ScToken(); + ScToken& operator=( const ScToken& ); + +protected: + + ScToken( formula::StackVar eTypeP,OpCode e = ocPush ) : formula::FormulaToken(eTypeP,e) {} + ScToken( const ScToken& r ): formula::FormulaToken(r) {} + +public: + + virtual ~ScToken(); + + /** + Dummy methods to avoid switches and casts where possible, + the real token classes have to overload the appropriate method[s]. + The only methods valid anytime if not overloaded are: + + - GetByte() since this represents the count of parameters to a function + which of course is 0 on non-functions. formula::FormulaByteToken and ScExternal do + overload it. + + - HasForceArray() since also this is only used for operators and + functions and is 0 for other tokens. + + Any other non-overloaded method pops up an assertion. + */ + + virtual const ScSingleRefData& GetSingleRef() const; + virtual ScSingleRefData& GetSingleRef(); + virtual const ScComplexRefData& GetDoubleRef() const; + virtual ScComplexRefData& GetDoubleRef(); + virtual const ScSingleRefData& GetSingleRef2() const; + virtual ScSingleRefData& GetSingleRef2(); + virtual void CalcAbsIfRel( const ScAddress& ); + virtual void CalcRelFromAbs( const ScAddress& ); + virtual const ScMatrix* GetMatrix() const; + virtual ScMatrix* GetMatrix(); + virtual ScJumpMatrix* GetJumpMatrix() const; + virtual const ScRefList* GetRefList() const; + virtual ScRefList* GetRefList(); + + virtual bool TextEqual( const formula::FormulaToken& rToken ) const; + virtual bool Is3DRef() const; // reference with 3D flag set + + /** If rTok1 and rTok2 both are SingleRef or DoubleRef tokens, extend/merge + ranges as needed for ocRange. + @param rPos + The formula's position, used to calculate absolute positions from + relative references. + @param bReuseDoubleRef + If sal_True, a DoubleRef token is reused if passed as rTok1 or rTok2, + else a new DoubleRef token is created and returned. + @return + A reused or new'ed ScDoubleRefToken, or a NULL TokenRef if rTok1 or + rTok2 are not of sv(Single|Double)Ref + */ + static formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, const ScAddress & rPos, bool bReuseDoubleRef ); +}; + +inline void intrusive_ptr_add_ref(const ScToken* p) +{ + p->IncRef(); +} + +inline void intrusive_ptr_release(const ScToken* p) +{ + p->DecRef(); +} + +class ScSingleRefToken : public ScToken +{ +private: + ScSingleRefData aSingleRef; +public: + ScSingleRefToken( const ScSingleRefData& r, OpCode e = ocPush ) : + ScToken( formula::svSingleRef, e ), aSingleRef( r ) {} + ScSingleRefToken( const ScSingleRefToken& r ) : + ScToken( r ), aSingleRef( r.aSingleRef ) {} + virtual const ScSingleRefData& GetSingleRef() const; + virtual ScSingleRefData& GetSingleRef(); + virtual void CalcAbsIfRel( const ScAddress& ); + virtual void CalcRelFromAbs( const ScAddress& ); + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScSingleRefToken(*this); } + + DECL_FIXEDMEMPOOL_NEWDEL( ScSingleRefToken ); +}; + +class ScDoubleRefToken : public ScToken +{ +private: + ScComplexRefData aDoubleRef; +public: + ScDoubleRefToken( const ScComplexRefData& r, OpCode e = ocPush ) : + ScToken( formula::svDoubleRef, e ), aDoubleRef( r ) {} + ScDoubleRefToken( const ScSingleRefData& r, OpCode e = ocPush ) : + ScToken( formula::svDoubleRef, e ) + { + aDoubleRef.Ref1 = r; + aDoubleRef.Ref2 = r; + } + ScDoubleRefToken( const ScDoubleRefToken& r ) : + ScToken( r ), aDoubleRef( r.aDoubleRef ) {} + virtual const ScSingleRefData& GetSingleRef() const; + virtual ScSingleRefData& GetSingleRef(); + virtual const ScComplexRefData& GetDoubleRef() const; + virtual ScComplexRefData& GetDoubleRef(); + virtual const ScSingleRefData& GetSingleRef2() const; + virtual ScSingleRefData& GetSingleRef2(); + virtual void CalcAbsIfRel( const ScAddress& ); + virtual void CalcRelFromAbs( const ScAddress& ); + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScDoubleRefToken(*this); } + + DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRefToken ); +}; + +class ScMatrixToken : public ScToken +{ +private: + ScMatrixRef pMatrix; +public: + ScMatrixToken( ScMatrixRef p ) : + ScToken( formula::svMatrix ), pMatrix( p ) {} + ScMatrixToken( const ScMatrixToken& r ) : + ScToken( r ), pMatrix( r.pMatrix ) {} + virtual const ScMatrix* GetMatrix() const; + virtual ScMatrix* GetMatrix(); + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScMatrixToken(*this); } +}; + + +class ScExternalSingleRefToken : public ScToken +{ +private: + sal_uInt16 mnFileId; + String maTabName; + ScSingleRefData maSingleRef; + + ScExternalSingleRefToken(); // disabled +public: + ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& r ); + ScExternalSingleRefToken( const ScExternalSingleRefToken& r ); + virtual ~ScExternalSingleRefToken(); + + virtual sal_uInt16 GetIndex() const; + virtual const String& GetString() const; + virtual const ScSingleRefData& GetSingleRef() const; + virtual ScSingleRefData& GetSingleRef(); + virtual void CalcAbsIfRel( const ScAddress& ); + virtual void CalcRelFromAbs( const ScAddress& ); + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScExternalSingleRefToken(*this); } +}; + + +class ScExternalDoubleRefToken : public ScToken +{ +private: + sal_uInt16 mnFileId; + String maTabName; // name of the first sheet + ScComplexRefData maDoubleRef; + + ScExternalDoubleRefToken(); // disabled +public: + ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& r ); + ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r ); + virtual ~ScExternalDoubleRefToken(); + + virtual sal_uInt16 GetIndex() const; + virtual const String& GetString() const; + virtual const ScSingleRefData& GetSingleRef() const; + virtual ScSingleRefData& GetSingleRef(); + virtual const ScSingleRefData& GetSingleRef2() const; + virtual ScSingleRefData& GetSingleRef2(); + virtual const ScComplexRefData& GetDoubleRef() const; + virtual ScComplexRefData& GetDoubleRef(); + virtual void CalcAbsIfRel( const ScAddress& ); + virtual void CalcRelFromAbs( const ScAddress& ); + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScExternalDoubleRefToken(*this); } +}; + +class ScNameToken : public ScToken +{ +private: + sal_uInt16 mnIndex; + bool mbGlobal; // true = global, false = local +private: + ScNameToken(); // disabled +public: + ScNameToken(sal_uInt16 nIndex, bool bGlobal); + ScNameToken(const ScNameToken& r); + virtual ~ScNameToken(); + virtual sal_uInt8 GetByte() const; + virtual sal_uInt16 GetIndex() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScNameToken(*this); } +}; + +class ScExternalNameToken : public ScToken +{ +private: + sal_uInt16 mnFileId; + String maName; +private: + ScExternalNameToken(); // disabled +public: + ScExternalNameToken( sal_uInt16 nFileId, const String& rName ); + ScExternalNameToken( const ScExternalNameToken& r ); + virtual ~ScExternalNameToken(); + virtual sal_uInt16 GetIndex() const; + virtual const String& GetString() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScExternalNameToken(*this); } +}; + + +// Only created from within the interpreter, no conversion from ScRawToken, +// never added to ScTokenArray! +class ScJumpMatrixToken : public ScToken +{ +private: + ScJumpMatrix* pJumpMatrix; +public: + ScJumpMatrixToken( ScJumpMatrix* p ) : + ScToken( formula::svJumpMatrix ), pJumpMatrix( p ) {} + ScJumpMatrixToken( const ScJumpMatrixToken& r ) : + ScToken( r ), pJumpMatrix( r.pJumpMatrix ) {} + virtual ~ScJumpMatrixToken(); + virtual ScJumpMatrix* GetJumpMatrix() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScJumpMatrixToken(*this); } +}; + + +// Only created from within the interpreter, no conversion from ScRawToken, +// never added to ScTokenArray! +class ScRefListToken : public ScToken +{ +private: + ScRefList aRefList; +public: + ScRefListToken() : + ScToken( formula::svRefList ) {} + ScRefListToken( const ScRefListToken & r ) : + ScToken( r ), aRefList( r.aRefList ) {} + virtual void CalcAbsIfRel( const ScAddress& ); + virtual void CalcRelFromAbs( const ScAddress& ); + virtual const ScRefList* GetRefList() const; + virtual ScRefList* GetRefList(); + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScRefListToken(*this); } +}; + + +class SC_DLLPUBLIC ScEmptyCellToken : public ScToken +{ + bool bInherited :1; + bool bDisplayedAsString :1; +public: + explicit ScEmptyCellToken( bool bInheritedP, bool bDisplayAsString ) : + ScToken( formula::svEmptyCell ), + bInherited( bInheritedP ), + bDisplayedAsString( bDisplayAsString ) {} + ScEmptyCellToken( const ScEmptyCellToken& r ) : + ScToken( r ), + bInherited( r.bInherited ), + bDisplayedAsString( r.bDisplayedAsString ) {} + bool IsInherited() const { return bInherited; } + bool IsDisplayedAsString() const { return bDisplayedAsString; } + virtual double GetDouble() const; + virtual const String & GetString() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScEmptyCellToken(*this); } +}; + + +/** Transports the result from the interpreter to the formula cell. */ +class SC_DLLPUBLIC ScMatrixCellResultToken : public ScToken +{ + // No non-const access implemented, silence down unxsols4 complaining about + // the public GetMatrix() hiding the one from ScToken. + virtual ScMatrix* GetMatrix(); + +protected: + ScConstMatrixRef xMatrix; + formula::FormulaConstTokenRef xUpperLeft; +public: + ScMatrixCellResultToken( const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ) : + ScToken( formula::svMatrixCell ), + xMatrix( pMat), xUpperLeft( pUL) {} + ScMatrixCellResultToken( const ScMatrixCellResultToken& r ) : + ScToken( r ), xMatrix( r.xMatrix ), + xUpperLeft( r.xUpperLeft ) {} + virtual double GetDouble() const; + virtual const String & GetString() const; + virtual const ScMatrix* GetMatrix() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScMatrixCellResultToken(*this); } + formula::StackVar GetUpperLeftType() const + { + return xUpperLeft ? + xUpperLeft->GetType() : + static_cast<formula::StackVar>(formula::svUnknown); + } + inline formula::FormulaConstTokenRef GetUpperLeftToken() const { return xUpperLeft; } + void Assign( const ScMatrixCellResultToken & r ) + { + xMatrix = r.xMatrix; + xUpperLeft = r.xUpperLeft; + } +}; + + +/** Stores the matrix result at the formula cell, additionally the range the + matrix formula occupies. */ +class SC_DLLPUBLIC ScMatrixFormulaCellToken : public ScMatrixCellResultToken +{ +private: + SCROW nRows; + SCCOL nCols; +public: + ScMatrixFormulaCellToken( SCCOL nC, SCROW nR ) : + ScMatrixCellResultToken( NULL, NULL ), + nRows( nR ), nCols( nC ) {} + ScMatrixFormulaCellToken( const ScMatrixFormulaCellToken& r ) : + ScMatrixCellResultToken( r ), + nRows( r.nRows ), nCols( r.nCols ) + { + // xUpperLeft is modifiable through + // SetUpperLeftDouble(), so clone it. + if (xUpperLeft) + xUpperLeft = xUpperLeft->Clone(); + } + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScMatrixFormulaCellToken(*this); } + void SetMatColsRows( SCCOL nC, SCROW nR ) + { + nRows = nR; + nCols = nC; + } + void GetMatColsRows( SCCOL & nC, SCROW & nR ) const + { + nR = nRows; + nC = nCols; + } + SCCOL GetMatCols() const { return nCols; } + SCROW GetMatRows() const { return nRows; } + + /** Assign matrix result, keep matrix formula + dimension. */ + void Assign( const ScMatrixCellResultToken & r ) + { + ScMatrixCellResultToken::Assign( r); + } + + /** Assign any result, keep matrix formula + dimension. If token is of type + ScMatrixCellResultToken uses the + appropriate Assign() call, other tokens + are assigned to xUpperLeft and xMatrix will + be assigned NULL. */ + void Assign( const formula::FormulaToken & r ); + + /** Modify xUpperLeft if formula::svDouble, or create + new formula::FormulaDoubleToken if not set yet. Does + nothing if xUpperLeft is of different type! */ + void SetUpperLeftDouble( double f); + + /** Reset matrix and upper left, keep matrix + formula dimension. */ + void ResetResult() + { + xMatrix = NULL; + xUpperLeft = NULL; + } +}; + + +class SC_DLLPUBLIC ScHybridCellToken : public ScToken +{ +private: + double fDouble; + String aString; + String aFormula; +public: + ScHybridCellToken( double f, + const String & rStr, + const String & rFormula ) : + ScToken( formula::svHybridCell ), + fDouble( f ), aString( rStr ), + aFormula( rFormula ) {} + ScHybridCellToken( const ScHybridCellToken& r ) : + ScToken( r ), fDouble( r.fDouble), + aString( r.aString), aFormula( r.aFormula) {} + const String & GetFormula() const { return aFormula; } + virtual double GetDouble() const; + virtual const String & GetString() const; + virtual bool operator==( const formula::FormulaToken& rToken ) const; + virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); } +}; + + +// Simplify argument passing to RefUpdate methods with ScSingleRefToken or +// ScDoubleRefToken +class SingleDoubleRefModifier +{ + ScComplexRefData aDub; + ScSingleRefData* pS; + ScComplexRefData* pD; + + // not implemented, prevent usage + SingleDoubleRefModifier( const SingleDoubleRefModifier& ); + SingleDoubleRefModifier& operator=( const SingleDoubleRefModifier& ); + +public: + SingleDoubleRefModifier( ScToken& rT ) + { + if ( rT.GetType() == formula::svSingleRef ) + { + pS = &rT.GetSingleRef(); + aDub.Ref1 = aDub.Ref2 = *pS; + pD = &aDub; + } + else + { + pS = 0; + pD = &rT.GetDoubleRef(); + } + } + SingleDoubleRefModifier( ScSingleRefData& rS ) + { + pS = &rS; + aDub.Ref1 = aDub.Ref2 = *pS; + pD = &aDub; + } + ~SingleDoubleRefModifier() + { + if ( pS ) + *pS = (*pD).Ref1; + } + inline ScComplexRefData& Ref() { return *pD; } +}; + +class SingleDoubleRefProvider +{ +public: + + const ScSingleRefData& Ref1; + const ScSingleRefData& Ref2; + + SingleDoubleRefProvider( const ScToken& r ) + : Ref1( r.GetSingleRef() ), + Ref2( r.GetType() == formula::svDoubleRef ? + r.GetDoubleRef().Ref2 : Ref1 ) + {} + SingleDoubleRefProvider( const ScSingleRefData& r ) + : Ref1( r ), Ref2( r ) + {} + SingleDoubleRefProvider( const ScComplexRefData& r ) + : Ref1( r.Ref1 ), Ref2( r.Ref2 ) + {} + ~SingleDoubleRefProvider() + {} +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx new file mode 100644 index 000000000000..b6a97ecff9c9 --- /dev/null +++ b/sc/inc/tokenarray.hxx @@ -0,0 +1,101 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TOKENARRAY_HXX +#define SC_TOKENARRAY_HXX + +#include "formula/token.hxx" +#include "scmatrix.hxx" +#include <tools/solar.h> +#include "scdllapi.h" +#include <formula/tokenarray.hxx> + +struct ScRawToken; +struct ScSingleRefData; +struct ScComplexRefData; +class ScMatrix; + +class SC_DLLPUBLIC ScTokenArray : public formula::FormulaTokenArray +{ + friend class ScCompiler; + sal_Bool ImplGetReference( ScRange& rRange, sal_Bool bValidOnly ) const; + +public: + ScTokenArray(); + /// Assignment with references to ScToken entries (not copied!) + ScTokenArray( const ScTokenArray& ); + virtual ~ScTokenArray(); + ScTokenArray* Clone() const; /// True copy! + + /// Exactly and only one range (valid or deleted) + sal_Bool IsReference( ScRange& rRange ) const; + /// Exactly and only one valid range (no #REF!s) + sal_Bool IsValidReference( ScRange& rRange ) const; + + + /** Determines the extent of direct adjacent + references. Only use with real functions, e.g. + GetOuterFuncOpCode() == ocSum ! */ + sal_Bool GetAdjacentExtendOfOuterFuncRefs( SCCOLROW& nExtend, + const ScAddress& rPos, ScDirection ); + + formula::FormulaToken* AddRawToken( const ScRawToken& ); + virtual bool AddFormulaToken(const com::sun::star::sheet::FormulaToken& _aToken,formula::ExternalReferenceHelper* _pRef); + virtual formula::FormulaToken* AddOpCode( OpCode eCode ); + /** ScSingleRefToken with ocPush. */ + formula::FormulaToken* AddSingleReference( const ScSingleRefData& rRef ); + /** ScSingleRefOpToken with ocMatRef. */ + formula::FormulaToken* AddMatrixSingleReference( const ScSingleRefData& rRef ); + formula::FormulaToken* AddDoubleReference( const ScComplexRefData& rRef ); + formula::FormulaToken* AddRangeName( sal_uInt16 n, bool bGlobal ); + formula::FormulaToken* AddExternalName( sal_uInt16 nFileId, const String& rName ); + formula::FormulaToken* AddExternalSingleReference( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& rRef ); + formula::FormulaToken* AddExternalDoubleReference( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& rRef ); + formula::FormulaToken* AddMatrix( const ScMatrixRef& p ); + /** ScSingleRefOpToken with ocColRowName. */ + formula::FormulaToken* AddColRowName( const ScSingleRefData& rRef ); + virtual formula::FormulaToken* MergeArray( ); + + /** Merge very last SingleRef+ocRange+SingleRef combination into DoubleRef + and adjust pCode array, or do nothing if conditions not met. + Unconditionally returns last token from the resulting pCode array, or + NULL if there is no pCode (which actually would be caller's fault). */ + formula::FormulaToken* MergeRangeReference( const ScAddress & rPos ); + + /// Assignment with references to ScToken entries (not copied!) + ScTokenArray& operator=( const ScTokenArray& ); + + /// Make 3D references point to old referenced position even if relative + void ReadjustRelative3DReferences( + const ScAddress& rOldPos, + const ScAddress& rNewPos ); +}; + +#endif // SC_TOKENARRAY_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx new file mode 100644 index 000000000000..e213e797a76f --- /dev/null +++ b/sc/inc/tokenuno.hxx @@ -0,0 +1,160 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_TOKENUNO_HXX +#define SC_TOKENUNO_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/FormulaOpCodeMapEntry.hpp> +#include <com/sun/star/sheet/FormulaToken.hpp> +#include <com/sun/star/sheet/XFormulaParser.hpp> +#include <cppuhelper/implbase3.hxx> +#include <svl/lstner.hxx> +#include <formula/FormulaOpCodeMapperObj.hxx> +#include "address.hxx" +#include "compiler.hxx" + +class ScTokenArray; +class ScDocShell; + +// ============================================================================ + +class ScTokenConversion +{ +public: + static bool ConvertToTokenArray( + ScDocument& rDoc, + ScTokenArray& rTokenArray, + const com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence ); + static bool ConvertToTokenSequence( + ScDocument& rDoc, + com::sun::star::uno::Sequence< com::sun::star::sheet::FormulaToken >& rSequence, + const ScTokenArray& rTokenArray ); +}; + +// ============================================================================ + +class ScFormulaParserObj : public ::cppu::WeakImplHelper3< + ::com::sun::star::sheet::XFormulaParser, + ::com::sun::star::beans::XPropertySet, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::FormulaOpCodeMapEntry > maOpCodeMapping; + ::com::sun::star::uno::Sequence< const ::com::sun::star::sheet::ExternalLinkInfo > maExternalLinks; + ScCompiler::OpCodeMapPtr mxOpCodeMap; + ScDocShell* mpDocShell; + sal_Int16 mnConv; + bool mbEnglish; + bool mbIgnoreSpaces; + bool mbCompileFAP; + + void SetCompilerFlags( ScCompiler& rCompiler ) const; + +public: + ScFormulaParserObj(ScDocShell* pDocSh); + virtual ~ScFormulaParserObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XFormulaParser + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::sheet::FormulaToken > SAL_CALL parseFormula( + const ::rtl::OUString& aFormula, + const ::com::sun::star::table::CellAddress& rReferencePos ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL printFormula( const ::com::sun::star::uno::Sequence< + ::com::sun::star::sheet::FormulaToken >& aTokens, + const ::com::sun::star::table::CellAddress& rReferencePos ) + throw (::com::sun::star::uno::RuntimeException); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); +}; + +// ============================================================================ + +class ScFormulaOpCodeMapperObj : public formula::FormulaOpCodeMapperObj +{ +public: + ScFormulaOpCodeMapperObj(::std::auto_ptr<formula::FormulaCompiler> _pCompiler); +}; + +// ============================================================================ + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/types.hxx b/sc/inc/types.hxx new file mode 100644 index 000000000000..bb454a9e0854 --- /dev/null +++ b/sc/inc/types.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Novell, Inc. + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SC_TYPES_HXX__ +#define __SC_TYPES_HXX__ + +#include <boost/intrusive_ptr.hpp> + +class ScMatrix; + +typedef ::boost::intrusive_ptr<ScMatrix> ScMatrixRef; +typedef ::boost::intrusive_ptr<const ScMatrix> ScConstMatrixRef; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/undorangename.hxx b/sc/inc/undorangename.hxx new file mode 100644 index 000000000000..7a50f82e3095 --- /dev/null +++ b/sc/inc/undorangename.hxx @@ -0,0 +1,66 @@ +/* + * Version: MPL 1.1 / GPLv3+ / LGPLv3+ + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (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.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Initial Developer of the Original Code is + * Kohei Yoshida <kyoshida@novell.com> (Novell, Inc) + * Portions created by the Initial Developer are Copyright (C) 2010 the + * Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 3 or later (the "GPLv3+"), or + * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"), + * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable + * instead of those above. + */ + +#ifndef __SC_UNDORANGENAME_HXX__ +#define __SC_UNDORANGENAME_HXX__ + +#include "undobase.hxx" +#include "rangenam.hxx" + +class ScDocShell; + +/** + * Undo object for named ranges, both in global and sheet-local scopes. + */ +class ScUndoAllRangeNames : public ScSimpleUndo +{ +public: + ScUndoAllRangeNames(ScDocShell* pDocSh, + const ScRangeName* pOldGlobal, + const ScRangeName* pNewGlobal, + const ScRangeName::TabNameCopyMap& rOldLocal, + const ScRangeName::TabNameCopyMap& rNewLocal); + + virtual ~ScUndoAllRangeNames(); + + virtual void Undo(); + virtual void Redo(); + virtual void Repeat(SfxRepeatTarget& rTarget); + virtual sal_Bool CanRepeat(SfxRepeatTarget& rTarget) const; + virtual String GetComment() const; + +private: + void DoChange(const ScRangeName& rGlobal, const ScRangeName::TabNameMap& rLocal); + +private: + ScRangeName maOldGlobalNames; + ScRangeName maNewGlobalNames; + ScRangeName::TabNameMap maOldLocalNames; + ScRangeName::TabNameMap maNewLocalNames; +}; + +#endif diff --git a/sc/inc/unitconv.hxx b/sc/inc/unitconv.hxx new file mode 100644 index 000000000000..be51d3cf3de6 --- /dev/null +++ b/sc/inc/unitconv.hxx @@ -0,0 +1,75 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_UNITCONV_HXX +#define SC_UNITCONV_HXX + +#include "collect.hxx" + + +class ScUnitConverterData : public StrData +{ + double fValue; + + // not implemented + ScUnitConverterData& operator=( const ScUnitConverterData& ); + +public: + ScUnitConverterData( const String& rFromUnit, + const String& rToUnit, double fValue = 1.0 ); + ScUnitConverterData( const ScUnitConverterData& ); + virtual ~ScUnitConverterData() {}; + + virtual ScDataObject* Clone() const; + + double GetValue() const { return fValue; } + + static void BuildIndexString( String& rStr, + const String& rFromUnit, const String& rToUnit ); + +}; + + +class ScUnitConverter : public ScStrCollection +{ + // not implemented + ScUnitConverter( const ScUnitConverter& ); + ScUnitConverter& operator=( const ScUnitConverter& ); + +public: + ScUnitConverter( sal_uInt16 nInit = 16, sal_uInt16 nDelta = 4 ); + virtual ~ScUnitConverter() {}; + + sal_Bool GetValue( double& fValue, const String& rFromUnit, + const String& rToUnit ) const; +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx new file mode 100644 index 000000000000..7bc50f1af812 --- /dev/null +++ b/sc/inc/unonames.hxx @@ -0,0 +1,658 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_UNONAMES_HXX +#define SC_UNONAMES_HXX + +// service names +#define SC_SERVICENAME_VALBIND "com.sun.star.table.CellValueBinding" +#define SC_SERVICENAME_LISTCELLBIND "com.sun.star.table.ListPositionCellBinding" +#define SC_SERVICENAME_LISTSOURCE "com.sun.star.table.CellRangeListSource" +#define SC_SERVICENAME_CELLADDRESS "com.sun.star.table.CellAddressConversion" +#define SC_SERVICENAME_RANGEADDRESS "com.sun.star.table.CellRangeAddressConversion" + +#define SC_SERVICENAME_FORMULAPARS "com.sun.star.sheet.FormulaParser" +#define SC_SERVICENAME_OPCODEMAPPER "com.sun.star.sheet.FormulaOpCodeMapper" + +#define SC_SERVICENAME_CHDATAPROV "com.sun.star.chart2.data.DataProvider" +#define SC_SERVICENAME_CHRANGEHILIGHT "com.sun.star.chart2.data.RangeHighlightListener" + +// document +#define SC_UNO_AREALINKS "AreaLinks" +#define SC_UNO_DDELINKS "DDELinks" +#define SC_UNO_EXTERNALDOCLINKS "ExternalDocLinks" +#define SC_UNO_COLLABELRNG "ColumnLabelRanges" +#define SC_UNO_DATABASERNG "DatabaseRanges" +#define SC_UNO_UNNAMEDDBRNG "UnnamedDatabaseRanges" +#define SC_UNO_NAMEDRANGES "NamedRanges" +#define SC_UNO_ROWLABELRNG "RowLabelRanges" +#define SC_UNO_SHEETLINKS "SheetLinks" +#define SC_UNO_FORBIDDEN "ForbiddenCharacters" +#define SC_UNO_HASDRAWPAGES "HasDrawPages" + +// CharacterProperties +#define SC_UNONAME_CCOLOR "CharColor" +#define SC_UNONAME_CHEIGHT "CharHeight" +#define SC_UNONAME_CUNDER "CharUnderline" +#define SC_UNONAME_CUNDLCOL "CharUnderlineColor" +#define SC_UNONAME_CUNDLHAS "CharUnderlineHasColor" +#define SC_UNONAME_COVER "CharOverline" +#define SC_UNONAME_COVRLCOL "CharOverlineColor" +#define SC_UNONAME_COVRLHAS "CharOverlineHasColor" +#define SC_UNONAME_CWEIGHT "CharWeight" +#define SC_UNONAME_CPOST "CharPosture" +#define SC_UNONAME_CCROSS "CharCrossedOut" +#define SC_UNONAME_CSTRIKE "CharStrikeout" +#define SC_UNONAME_CLOCAL "CharLocale" +#define SC_UNONAME_CSHADD "CharShadowed" +#define SC_UNONAME_CFONT "CharFont" +#define SC_UNONAME_COUTL "CharContoured" +#define SC_UNONAME_CEMPHAS "CharEmphasis" +#define SC_UNONAME_CFNAME "CharFontName" +#define SC_UNONAME_CFSTYLE "CharFontStyleName" +#define SC_UNONAME_CFFAMIL "CharFontFamily" +#define SC_UNONAME_CFCHARS "CharFontCharSet" +#define SC_UNONAME_CFPITCH "CharFontPitch" +#define SC_UNONAME_CRELIEF "CharRelief" +#define SC_UNONAME_CWORDMOD "CharWordMode" + +#define SC_UNO_CJK_CFNAME "CharFontNameAsian" +#define SC_UNO_CJK_CFSTYLE "CharFontStyleNameAsian" +#define SC_UNO_CJK_CFFAMIL "CharFontFamilyAsian" +#define SC_UNO_CJK_CFCHARS "CharFontCharSetAsian" +#define SC_UNO_CJK_CFPITCH "CharFontPitchAsian" +#define SC_UNO_CJK_CHEIGHT "CharHeightAsian" +#define SC_UNO_CJK_CWEIGHT "CharWeightAsian" +#define SC_UNO_CJK_CPOST "CharPostureAsian" +#define SC_UNO_CJK_CLOCAL "CharLocaleAsian" + +#define SC_UNO_CTL_CFNAME "CharFontNameComplex" +#define SC_UNO_CTL_CFSTYLE "CharFontStyleNameComplex" +#define SC_UNO_CTL_CFFAMIL "CharFontFamilyComplex" +#define SC_UNO_CTL_CFCHARS "CharFontCharSetComplex" +#define SC_UNO_CTL_CFPITCH "CharFontPitchComplex" +#define SC_UNO_CTL_CHEIGHT "CharHeightComplex" +#define SC_UNO_CTL_CWEIGHT "CharWeightComplex" +#define SC_UNO_CTL_CPOST "CharPostureComplex" +#define SC_UNO_CTL_CLOCAL "CharLocaleComplex" + +// CellProperties +#define SC_UNONAME_CELLSTYL "CellStyle" +#define SC_UNONAME_CELLBACK "CellBackColor" +#define SC_UNONAME_CELLTRAN "IsCellBackgroundTransparent" +#define SC_UNONAME_CELLPRO "CellProtection" +#define SC_UNONAME_CELLHJUS "HoriJustify" +#define SC_UNONAME_CELLVJUS "VertJustify" +#define SC_UNONAME_CELLHJUS_METHOD "HoriJustifyMethod" +#define SC_UNONAME_CELLVJUS_METHOD "VertJustifyMethod" +#define SC_UNONAME_CELLORI "Orientation" +#define SC_UNONAME_NUMFMT "NumberFormat" +#define SC_UNONAME_SHADOW "ShadowFormat" +#define SC_UNONAME_TBLBORD "TableBorder" +#define SC_UNONAME_WRAP "IsTextWrapped" +#define SC_UNONAME_PINDENT "ParaIndent" +#define SC_UNONAME_PTMARGIN "ParaTopMargin" +#define SC_UNONAME_PBMARGIN "ParaBottomMargin" +#define SC_UNONAME_PLMARGIN "ParaLeftMargin" +#define SC_UNONAME_PRMARGIN "ParaRightMargin" +#define SC_UNONAME_ROTANG "RotateAngle" +#define SC_UNONAME_ROTREF "RotateReference" +#define SC_UNONAME_ASIANVERT "AsianVerticalMode" +#define SC_UNONAME_WRITING "WritingMode" + +#define SC_UNONAME_BOTTBORDER "BottomBorder" +#define SC_UNONAME_LEFTBORDER "LeftBorder" +#define SC_UNONAME_RIGHTBORDER "RightBorder" +#define SC_UNONAME_TOPBORDER "TopBorder" + +#define SC_UNONAME_DIAGONAL_TLBR "DiagonalTLBR" +#define SC_UNONAME_DIAGONAL_BLTR "DiagonalBLTR" + +#define SC_UNONAME_SHRINK_TO_FIT "ShrinkToFit" + +#define SC_UNONAME_PISHANG "ParaIsHangingPunctuation" +#define SC_UNONAME_PISCHDIST "ParaIsCharacterDistance" +#define SC_UNONAME_PISFORBID "ParaIsForbiddenRules" +#define SC_UNONAME_PISHYPHEN "ParaIsHyphenation" +#define SC_UNONAME_PADJUST "ParaAdjust" +#define SC_UNONAME_PLASTADJ "ParaLastLineAdjust" + +#define SC_UNONAME_NUMRULES "NumberingRules" + +// Styles +#define SC_UNONAME_DISPNAME "DisplayName" + +// XStyleLoader +#define SC_UNONAME_OVERWSTL "OverwriteStyles" +#define SC_UNONAME_LOADCELL "LoadCellStyles" +#define SC_UNONAME_LOADPAGE "LoadPageStyles" + +// SheetCellRange +#define SC_UNONAME_POS "Position" +#define SC_UNONAME_SIZE "Size" +#define SC_UNONAME_ABSNAME "AbsoluteName" + +// column/row/sheet +#define SC_UNONAME_CELLHGT "Height" +#define SC_UNONAME_CELLWID "Width" +#define SC_UNONAME_CELLVIS "IsVisible" +#define SC_UNONAME_CELLFILT "IsFiltered" +#define SC_UNONAME_MANPAGE "IsManualPageBreak" +#define SC_UNONAME_NEWPAGE "IsStartOfNewPage" +#define SC_UNONAME_OHEIGHT "OptimalHeight" +#define SC_UNONAME_OWIDTH "OptimalWidth" +#define SC_UNONAME_PAGESTL "PageStyle" +#define SC_UNONAME_ISACTIVE "IsActive" +#define SC_UNONAME_BORDCOL "BorderColor" +#define SC_UNONAME_PROTECT "Protected" +#define SC_UNONAME_SHOWBORD "ShowBorder" +#define SC_UNONAME_PRINTBORD "PrintBorder" +#define SC_UNONAME_COPYBACK "CopyBack" +#define SC_UNONAME_COPYSTYL "CopyStyles" +#define SC_UNONAME_COPYFORM "CopyFormulas" +#define SC_UNONAME_TABLAYOUT "TableLayout" +#define SC_UNONAME_AUTOPRINT "AutomaticPrintArea" +#define SC_UNONAME_TABCOLOR "TabColor" + +// LinkTarget +#define SC_UNO_LINKDISPBIT "LinkDisplayBitmap" +#define SC_UNO_LINKDISPNAME "LinkDisplayName" + +// drawing objects +#define SC_UNONAME_IMAGEMAP "ImageMap" +#define SC_UNONAME_ANCHOR "Anchor" +#define SC_UNONAME_HORIPOS "HoriOrientPosition" +#define SC_UNONAME_VERTPOS "VertOrientPosition" +// #i66550 HLINK_FOR_SHAPES +#define SC_UNONAME_HYPERLINK "Hyperlink" +#define SC_UNONAME_MOVEPROTECT "MoveProtect" +#define SC_UNONAME_SIZEPROTECT "SizeProtect" + +// other cell properties +#define SC_UNONAME_CHCOLHDR "ChartColumnAsLabel" +#define SC_UNONAME_CHROWHDR "ChartRowAsLabel" +#define SC_UNONAME_CONDFMT "ConditionalFormat" +#define SC_UNONAME_CONDLOC "ConditionalFormatLocal" +#define SC_UNONAME_CONDXML "ConditionalFormatXML" +#define SC_UNONAME_VALIDAT "Validation" +#define SC_UNONAME_VALILOC "ValidationLocal" +#define SC_UNONAME_VALIXML "ValidationXML" +#define SC_UNONAME_FORMLOC "FormulaLocal" +#define SC_UNONAME_FORMRT "FormulaResultType" + +#define SC_UNONAME_USERDEF "UserDefinedAttributes" +#define SC_UNONAME_TEXTUSER "TextUserDefinedAttributes" + +// auto format +#define SC_UNONAME_INCBACK "IncludeBackground" +#define SC_UNONAME_INCBORD "IncludeBorder" +#define SC_UNONAME_INCFONT "IncludeFont" +#define SC_UNONAME_INCJUST "IncludeJustify" +#define SC_UNONAME_INCNUM "IncludeNumberFormat" +#define SC_UNONAME_INCWIDTH "IncludeWidthAndHeight" + +// function description +#define SC_UNONAME_ARGUMENTS "Arguments" +#define SC_UNONAME_CATEGORY "Category" +#define SC_UNONAME_DESCRIPTION "Description" +#define SC_UNONAME_ID "Id" +#define SC_UNONAME_NAME "Name" + +// application settings +#define SC_UNONAME_DOAUTOCP "DoAutoComplete" +#define SC_UNONAME_ENTERED "EnterEdit" +#define SC_UNONAME_EXPREF "ExpandReferences" +#define SC_UNONAME_EXTFMT "ExtendFormat" +#define SC_UNONAME_LINKUPD "LinkUpdateMode" +#define SC_UNONAME_MARKHDR "MarkHeader" +#define SC_UNONAME_METRIC "Metric" +#define SC_UNONAME_MOVEDIR "MoveDirection" +#define SC_UNONAME_MOVESEL "MoveSelection" +#define SC_UNONAME_RANGEFIN "RangeFinder" +#define SC_UNONAME_SCALE "Scale" +#define SC_UNONAME_STBFUNC "StatusBarFunction" +#define SC_UNONAME_ULISTS "UserLists" +#define SC_UNONAME_USETABCOL "UseTabCol" +#define SC_UNONAME_PRMETRICS "UsePrinterMetrics" +#define SC_UNONAME_PRALLSH "PrintAllSheets" +#define SC_UNONAME_PREMPTY "PrintEmptyPages" +#define SC_UNONAME_REPLWARN "ReplaceCellsWarning" + +// data pilot field +#define SC_UNONAME_FUNCTION "Function" +#define SC_UNONAME_SUBTOTALS "Subtotals" +#define SC_UNONAME_SELPAGE "SelectedPage" +#define SC_UNONAME_USESELPAGE "UseSelectedPage" +#define SC_UNONAME_HASREFERENCE "HasReference" +#define SC_UNONAME_REFERENCE "Reference" +#define SC_UNONAME_HASAUTOSHOW "HasAutoShowInfo" +#define SC_UNONAME_AUTOSHOW "AutoShowInfo" +#define SC_UNONAME_HASSORTINFO "HasSortInfo" +#define SC_UNONAME_SORTINFO "SortInfo" +#define SC_UNONAME_HASLAYOUTINFO "HasLayoutInfo" +#define SC_UNONAME_LAYOUTINFO "LayoutInfo" +#define SC_UNONAME_ISGROUP "IsGroupField" +#define SC_UNONAME_GROUPINFO "GroupInfo" +#define SC_UNONAME_SHOWEMPTY "ShowEmpty" + +// data pilot item +#define SC_UNONAME_SHOWDETAIL "ShowDetail" +#define SC_UNONAME_ISHIDDEN "IsHidden" + +// database options +#define SC_UNONAME_CASE "CaseSensitive" +#define SC_UNONAME_DBNAME "DatabaseName" +#define SC_UNONAME_FORMATS "IncludeFormats" +#define SC_UNONAME_INSBRK "InsertPageBreaks" +#define SC_UNONAME_KEEPFORM "KeepFormats" +#define SC_UNONAME_MOVCELLS "MoveCells" +#define SC_UNONAME_ISUSER "IsUserDefined" +#define SC_UNONAME_ISNATIVE "IsNative" +#define SC_UNONAME_REGEXP "RegularExpressions" +#define SC_UNONAME_SAVEOUT "SaveOutputPosition" +#define SC_UNONAME_SKIPDUP "SkipDuplicates" +#define SC_UNONAME_SRCOBJ "SourceObject" +#define SC_UNONAME_SRCTYPE "SourceType" +#define SC_UNONAME_STRIPDAT "StripData" +#define SC_UNONAME_UNIQUE "UniqueOnly" +#define SC_UNONAME_USEREGEX "UseRegularExpressions" +#define SC_UNONAME_ULIST "UserListEnabled" +#define SC_UNONAME_UINDEX "UserListIndex" +#define SC_UNONAME_BINDFMT "BindFormatsToContent" +#define SC_UNONAME_COPYOUT "CopyOutputData" +#define SC_UNONAME_ISCASE "IsCaseSensitive" +#define SC_UNONAME_ISULIST "IsUserListEnabled" +#define SC_UNONAME_OUTPOS "OutputPosition" +#define SC_UNONAME_CONTHDR "ContainsHeader" +#define SC_UNONAME_MAXFLD "MaxFieldCount" +#define SC_UNONAME_ORIENT "Orientation" +#define SC_UNONAME_ISSORTCOLUMNS "IsSortColumns" +#define SC_UNONAME_SORTFLD "SortFields" +#define SC_UNONAME_SORTASC "SortAscending" +#define SC_UNONAME_ENUSLIST "EnableUserSortList" +#define SC_UNONAME_USINDEX "UserSortListIndex" +#define SC_UNONAME_COLLLOC "CollatorLocale" +#define SC_UNONAME_COLLALG "CollatorAlgorithm" +#define SC_UNONAME_AUTOFLT "AutoFilter" +#define SC_UNONAME_FLTCRT "FilterCriteriaSource" +#define SC_UNONAME_USEFLTCRT "UseFilterCriteriaSource" +#define SC_UNONAME_ENABSORT "EnableSort" +#define SC_UNONAME_FROMSELECT "FromSelection" +#define SC_UNONAME_CONRES "ConnectionResource" +#define SC_UNONAME_TOKENINDEX "TokenIndex" +#define SC_UNONAME_ISSHAREDFMLA "IsSharedFormula" + +// text fields +#define SC_UNONAME_ANCTYPE "AnchorType" +#define SC_UNONAME_ANCTYPES "AnchorTypes" +#define SC_UNONAME_TEXTWRAP "TextWrap" +#define SC_UNONAME_FILEFORM "FileFormat" + +// url field +#define SC_UNONAME_REPR "Representation" +#define SC_UNONAME_TARGET "TargetFrame" +#define SC_UNONAME_URL "URL" + +// conditional format +#define SC_UNONAME_OPERATOR "Operator" +#define SC_UNONAME_FORMULA1 "Formula1" +#define SC_UNONAME_FORMULA2 "Formula2" +#define SC_UNONAME_SOURCEPOS "SourcePosition" +#define SC_UNONAME_SOURCESTR "SourcePositionAsString" // only for use in XML filter +#define SC_UNONAME_FORMULANMSP1 "FormulaNamespace1" // only for use in XML filter +#define SC_UNONAME_FORMULANMSP2 "FormulaNamespace2" // only for use in XML filter +#define SC_UNONAME_GRAMMAR1 "Grammar1" // only for use in XML filter +#define SC_UNONAME_GRAMMAR2 "Grammar2" // only for use in XML filter +#define SC_UNONAME_STYLENAME "StyleName" + +// validation +#define SC_UNONAME_ERRALSTY "ErrorAlertStyle" +#define SC_UNONAME_ERRMESS "ErrorMessage" +#define SC_UNONAME_ERRTITLE "ErrorTitle" +#define SC_UNONAME_IGNOREBL "IgnoreBlankCells" +#define SC_UNONAME_INPMESS "InputMessage" +#define SC_UNONAME_INPTITLE "InputTitle" +#define SC_UNONAME_SHOWERR "ShowErrorMessage" +#define SC_UNONAME_SHOWINP "ShowInputMessage" +#define SC_UNONAME_SHOWLIST "ShowList" +#define SC_UNONAME_TYPE "Type" + +// links +#define SC_UNONAME_FILTER "Filter" +#define SC_UNONAME_FILTOPT "FilterOptions" +#define SC_UNONAME_LINKURL "Url" +#define SC_UNONAME_REFPERIOD "RefreshPeriod" +#define SC_UNONAME_REFDELAY "RefreshDelay" // deprecated, don't use anymore + +// search descriptor +#define SC_UNO_SRCHBACK "SearchBackwards" +#define SC_UNO_SRCHBYROW "SearchByRow" +#define SC_UNO_SRCHCASE "SearchCaseSensitive" +#define SC_UNO_SRCHREGEXP "SearchRegularExpression" +#define SC_UNO_SRCHSIM "SearchSimilarity" +#define SC_UNO_SRCHSIMADD "SearchSimilarityAdd" +#define SC_UNO_SRCHSIMEX "SearchSimilarityExchange" +#define SC_UNO_SRCHSIMREL "SearchSimilarityRelax" +#define SC_UNO_SRCHSIMREM "SearchSimilarityRemove" +#define SC_UNO_SRCHSTYLES "SearchStyles" +#define SC_UNO_SRCHTYPE "SearchType" +#define SC_UNO_SRCHWORDS "SearchWords" +#define SC_UNO_SRCHFILTERED "SearchFiltered" + +// old (5.2) property names for page styles - for compatibility only! +#define OLD_UNO_PAGE_BACKCOLOR "BackgroundColor" +#define OLD_UNO_PAGE_BACKTRANS "IsBackgroundTransparent" +#define OLD_UNO_PAGE_HDRBACKCOL "HeaderBackgroundColor" +#define OLD_UNO_PAGE_HDRBACKTRAN "TransparentHeaderBackground" +#define OLD_UNO_PAGE_HDRSHARED "HeaderShared" +#define OLD_UNO_PAGE_HDRDYNAMIC "HeaderDynamic" +#define OLD_UNO_PAGE_HDRON "HeaderOn" +#define OLD_UNO_PAGE_FTRBACKCOL "FooterBackgroundColor" +#define OLD_UNO_PAGE_FTRBACKTRAN "TransparentFooterBackground" +#define OLD_UNO_PAGE_FTRSHARED "FooterShared" +#define OLD_UNO_PAGE_FTRDYNAMIC "FooterDynamic" +#define OLD_UNO_PAGE_FTRON "FooterOn" + +// page styles +#define SC_UNO_PAGE_BACKCOLOR "BackColor" +#define SC_UNO_PAGE_BACKTRANS "BackTransparent" +#define SC_UNO_PAGE_GRAPHICFILT "BackGraphicFilter" +#define SC_UNO_PAGE_GRAPHICLOC "BackGraphicLocation" +#define SC_UNO_PAGE_GRAPHICURL "BackGraphicURL" +#define SC_UNO_PAGE_LEFTBORDER SC_UNONAME_LEFTBORDER +#define SC_UNO_PAGE_RIGHTBORDER SC_UNONAME_RIGHTBORDER +#define SC_UNO_PAGE_BOTTBORDER SC_UNONAME_BOTTBORDER +#define SC_UNO_PAGE_TOPBORDER SC_UNONAME_TOPBORDER +#define SC_UNO_PAGE_LEFTBRDDIST "LeftBorderDistance" +#define SC_UNO_PAGE_RIGHTBRDDIST "RightBorderDistance" +#define SC_UNO_PAGE_BOTTBRDDIST "BottomBorderDistance" +#define SC_UNO_PAGE_TOPBRDDIST "TopBorderDistance" +#define SC_UNO_PAGE_BORDERDIST "BorderDistance" +#define SC_UNO_PAGE_SHADOWFORM "ShadowFormat" +#define SC_UNO_PAGE_LEFTMARGIN "LeftMargin" +#define SC_UNO_PAGE_RIGHTMARGIN "RightMargin" +#define SC_UNO_PAGE_TOPMARGIN "TopMargin" +#define SC_UNO_PAGE_BOTTMARGIN "BottomMargin" +#define SC_UNO_PAGE_LANDSCAPE "IsLandscape" +#define SC_UNO_PAGE_NUMBERTYPE "NumberingType" +#define SC_UNO_PAGE_SYTLELAYOUT "PageStyleLayout" +#define SC_UNO_PAGE_PAPERTRAY "PrinterPaperTray" +#define SC_UNO_PAGE_SIZE "Size" +#define SC_UNO_PAGE_WIDTH "Width" +#define SC_UNO_PAGE_HEIGHT "Height" +#define SC_UNO_PAGE_CENTERHOR "CenterHorizontally" +#define SC_UNO_PAGE_CENTERVER "CenterVertically" +#define SC_UNO_PAGE_PRINTANNOT "PrintAnnotations" +#define SC_UNO_PAGE_PRINTGRID "PrintGrid" +#define SC_UNO_PAGE_PRINTHEADER "PrintHeaders" +#define SC_UNO_PAGE_PRINTCHARTS "PrintCharts" +#define SC_UNO_PAGE_PRINTOBJS "PrintObjects" +#define SC_UNO_PAGE_PRINTDRAW "PrintDrawing" +#define SC_UNO_PAGE_PRINTDOWN "PrintDownFirst" +#define SC_UNO_PAGE_SCALEVAL "PageScale" +#define SC_UNO_PAGE_SCALETOPAG "ScaleToPages" +#define SC_UNO_PAGE_SCALETOX "ScaleToPagesX" +#define SC_UNO_PAGE_SCALETOY "ScaleToPagesY" +#define SC_UNO_PAGE_FIRSTPAGE "FirstPageNumber" +#define SC_UNO_PAGE_LEFTHDRCONT "LeftPageHeaderContent" +#define SC_UNO_PAGE_LEFTFTRCONT "LeftPageFooterContent" +#define SC_UNO_PAGE_RIGHTHDRCON "RightPageHeaderContent" +#define SC_UNO_PAGE_RIGHTFTRCON "RightPageFooterContent" +#define SC_UNO_PAGE_PRINTFORMUL "PrintFormulas" +#define SC_UNO_PAGE_PRINTZERO "PrintZeroValues" +#define SC_UNO_PAGE_HDRBACKCOL "HeaderBackColor" +#define SC_UNO_PAGE_HDRBACKTRAN "HeaderBackTransparent" +#define SC_UNO_PAGE_HDRGRFFILT "HeaderBackGraphicFilter" +#define SC_UNO_PAGE_HDRGRFLOC "HeaderBackGraphicLocation" +#define SC_UNO_PAGE_HDRGRFURL "HeaderBackGraphicURL" +#define SC_UNO_PAGE_HDRLEFTBOR "HeaderLeftBorder" +#define SC_UNO_PAGE_HDRRIGHTBOR "HeaderRightBorder" +#define SC_UNO_PAGE_HDRBOTTBOR "HeaderBottomBorder" +#define SC_UNO_PAGE_HDRTOPBOR "HeaderTopBorder" +#define SC_UNO_PAGE_HDRLEFTBDIS "HeaderLeftBorderDistance" +#define SC_UNO_PAGE_HDRRIGHTBDIS "HeaderRightBorderDistance" +#define SC_UNO_PAGE_HDRBOTTBDIS "HeaderBottomBorderDistance" +#define SC_UNO_PAGE_HDRTOPBDIS "HeaderTopBorderDistance" +#define SC_UNO_PAGE_HDRBRDDIST "HeaderBorderDistance" +#define SC_UNO_PAGE_HDRSHADOW "HeaderShadowFormat" +#define SC_UNO_PAGE_HDRLEFTMAR "HeaderLeftMargin" +#define SC_UNO_PAGE_HDRRIGHTMAR "HeaderRightMargin" +#define SC_UNO_PAGE_HDRBODYDIST "HeaderBodyDistance" +#define SC_UNO_PAGE_HDRHEIGHT "HeaderHeight" +#define SC_UNO_PAGE_HDRON "HeaderIsOn" +#define SC_UNO_PAGE_HDRDYNAMIC "HeaderIsDynamicHeight" +#define SC_UNO_PAGE_HDRSHARED "HeaderIsShared" +#define SC_UNO_PAGE_FTRBACKCOL "FooterBackColor" +#define SC_UNO_PAGE_FTRBACKTRAN "FooterBackTransparent" +#define SC_UNO_PAGE_FTRGRFFILT "FooterBackGraphicFilter" +#define SC_UNO_PAGE_FTRGRFLOC "FooterBackGraphicLocation" +#define SC_UNO_PAGE_FTRGRFURL "FooterBackGraphicURL" +#define SC_UNO_PAGE_FTRLEFTBOR "FooterLeftBorder" +#define SC_UNO_PAGE_FTRRIGHTBOR "FooterRightBorder" +#define SC_UNO_PAGE_FTRBOTTBOR "FooterBottomBorder" +#define SC_UNO_PAGE_FTRTOPBOR "FooterTopBorder" +#define SC_UNO_PAGE_FTRLEFTBDIS "FooterLeftBorderDistance" +#define SC_UNO_PAGE_FTRRIGHTBDIS "FooterRightBorderDistance" +#define SC_UNO_PAGE_FTRBOTTBDIS "FooterBottomBorderDistance" +#define SC_UNO_PAGE_FTRTOPBDIS "FooterTopBorderDistance" +#define SC_UNO_PAGE_FTRBRDDIST "FooterBorderDistance" +#define SC_UNO_PAGE_FTRSHADOW "FooterShadowFormat" +#define SC_UNO_PAGE_FTRLEFTMAR "FooterLeftMargin" +#define SC_UNO_PAGE_FTRRIGHTMAR "FooterRightMargin" +#define SC_UNO_PAGE_FTRBODYDIST "FooterBodyDistance" +#define SC_UNO_PAGE_FTRHEIGHT "FooterHeight" +#define SC_UNO_PAGE_FTRON "FooterIsOn" +#define SC_UNO_PAGE_FTRDYNAMIC "FooterIsDynamicHeight" +#define SC_UNO_PAGE_FTRSHARED "FooterIsShared" + +// document settings +#define SC_UNO_CALCASSHOWN "CalcAsShown" +#define SC_UNO_DEFTABSTOP "DefaultTabStop" +#define SC_UNO_TABSTOPDIS "TabStopDistance" // is the same like the before, but only the writer name +#define SC_UNO_IGNORECASE "IgnoreCase" +#define SC_UNO_ITERCOUNT "IterationCount" +#define SC_UNO_ITERENABLED "IsIterationEnabled" +#define SC_UNO_ITEREPSILON "IterationEpsilon" +#define SC_UNO_LOOKUPLABELS "LookUpLabels" +#define SC_UNO_MATCHWHOLE "MatchWholeCell" +#define SC_UNO_NULLDATE "NullDate" +#define SC_UNO_SPELLONLINE "SpellOnline" +#define SC_UNO_STANDARDDEC "StandardDecimals" +#define SC_UNO_REGEXENABLED "RegularExpressions" +#define SC_UNO_BASICLIBRARIES "BasicLibraries" +#define SC_UNO_DIALOGLIBRARIES "DialogLibraries" +#define SC_UNO_RUNTIMEUID "RuntimeUID" +#define SC_UNO_HASVALIDSIGNATURES "HasValidSignatures" +#define SC_UNO_ISLOADED "IsLoaded" +#define SC_UNO_ISUNDOENABLED "IsUndoEnabled" +#define SC_UNO_ISADJUSTHEIGHTENABLED "IsAdjustHeightEnabled" +#define SC_UNO_ISEXECUTELINKENABLED "IsExecuteLinkEnabled" +#define SC_UNO_ISCHANGEREADONLYENABLED "IsChangeReadOnlyEnabled" +#define SC_UNO_REFERENCEDEVICE "ReferenceDevice" +#define SC_UNO_CODENAME "CodeName" + +// document properties from FormModel +#define SC_UNO_APPLYFMDES "ApplyFormDesignMode" +#define SC_UNO_AUTOCONTFOC "AutomaticControlFocus" + +// view options +#define SC_UNO_COLROWHDR "HasColumnRowHeaders" +#define SC_UNO_GRIDCOLOR "GridColor" +#define SC_UNO_HIDESPELL "HideSpellMarks" /* deprecated #i91949 */ +#define SC_UNO_HORSCROLL "HasHorizontalScrollBar" +#define SC_UNO_OUTLSYMB "IsOutlineSymbolsSet" +#define SC_UNO_SHEETTABS "HasSheetTabs" +#define SC_UNO_SHOWANCHOR "ShowAnchor" +#define SC_UNO_SHOWCHARTS "ShowCharts" +#define SC_UNO_SHOWDRAW "ShowDrawing" +#define SC_UNO_SHOWFORM "ShowFormulas" +#define SC_UNO_SHOWGRID "ShowGrid" +#define SC_UNO_SHOWHELP "ShowHelpLines" +#define SC_UNO_SHOWNOTES "ShowNotes" +#define SC_UNO_SHOWOBJ "ShowObjects" +#define SC_UNO_SHOWPAGEBR "ShowPageBreaks" +#define SC_UNO_SHOWZERO "ShowZeroValues" +#define SC_UNO_SHOWSOLID "SolidHandles" +#define SC_UNO_VALUEHIGH "IsValueHighlightingEnabled" +#define SC_UNO_VERTSCROLL "HasVerticalScrollBar" +#define SC_UNO_SNAPTORASTER "IsSnapToRaster" +#define SC_UNO_RASTERVIS "RasterIsVisible" +#define SC_UNO_RASTERRESX "RasterResolutionX" +#define SC_UNO_RASTERRESY "RasterResolutionY" +#define SC_UNO_RASTERSUBX "RasterSubdivisionX" +#define SC_UNO_RASTERSUBY "RasterSubdivisionY" +#define SC_UNO_RASTERSYNC "IsRasterAxisSynchronized" +#define SC_UNO_AUTOCALC "AutoCalculate" +#define SC_UNO_PRINTERNAME "PrinterName" +#define SC_UNO_PRINTERSETUP "PrinterSetup" +#define SC_UNO_APPLYDOCINF "ApplyUserData" +#define SC_UNO_CHARCOMP "CharacterCompressionType" +#define SC_UNO_ASIANKERN "IsKernAsianPunctuation" +#define SC_UNO_VISAREA "VisibleArea" +#define SC_UNO_ZOOMTYPE "ZoomType" +#define SC_UNO_ZOOMVALUE "ZoomValue" +#define SC_UNO_UPDTEMPL "UpdateFromTemplate" +#define SC_UNO_FILTERED_RANGE_SELECTION "FilteredRangeSelection" +#define SC_UNO_VISAREASCREEN "VisibleAreaOnScreen" + +/*Stampit enable/disable print cancel */ +#define SC_UNO_ALLOWPRINTJOBCANCEL "AllowPrintJobCancel" + +// old (5.2) property names for view options - for compatibility only! +#define OLD_UNO_COLROWHDR "ColumnRowHeaders" +#define OLD_UNO_HORSCROLL "HorizontalScrollBar" +#define OLD_UNO_OUTLSYMB "OutlineSymbols" +#define OLD_UNO_SHEETTABS "SheetTabs" +#define OLD_UNO_VALUEHIGH "ValueHighlighting" +#define OLD_UNO_VERTSCROLL "VerticalScrollBar" + +// data pilot source +#define SC_UNO_COLGRAND "ColumnGrand" +#define SC_UNO_ROWGRAND "RowGrand" +#define SC_UNO_ORIGINAL "Original" +#define SC_UNO_ISDATALA "IsDataLayoutDimension" +#define SC_UNO_ORIENTAT "Orientation" +#define SC_UNO_POSITION "Position" +#define SC_UNO_FUNCTION "Function" +#define SC_UNO_USEDHIER "UsedHierarchy" +#define SC_UNO_FILTER "Filter" +#define SC_UNO_SUBTOTAL "SubTotals" +#define SC_UNO_SHOWEMPT "ShowEmpty" +#define SC_UNO_ISVISIBL "IsVisible" +#define SC_UNO_SHOWDETA "ShowDetails" +#define SC_UNO_IGNOREEM "IgnoreEmptyRows" +#define SC_UNO_REPEATIF "RepeatIfEmpty" +#define SC_UNO_DATADESC "DataDescription" +#define SC_UNO_NUMBERFO "NumberFormat" +#define SC_UNO_ROWFIELDCOUNT "RowFieldCount" +#define SC_UNO_COLUMNFIELDCOUNT "ColumnFieldCount" +#define SC_UNO_DATAFIELDCOUNT "DataFieldCount" +#define SC_UNO_LAYOUTNAME "LayoutName" +#define SC_UNO_FIELD_SUBTOTALNAME "FieldSubtotalName" +#define SC_UNO_GRANDTOTAL_NAME "GrandTotalName" +#define SC_UNO_HAS_HIDDEN_MEMBER "HasHiddenMember" +#define SC_UNO_FLAGS "Flags" + +// (preliminary:) +#define SC_UNO_REFVALUE "ReferenceValue" +#define SC_UNO_SORTING "Sorting" +#define SC_UNO_AUTOSHOW "AutoShow" +#define SC_UNO_LAYOUT "Layout" + +// data pilot descriptor +#define SC_UNO_IGNEMPROWS "IgnoreEmptyRows" +#define SC_UNO_RPTEMPTY "RepeatIfEmpty" +#define SC_UNO_DRILLDOWN "DrillDownOnDoubleClick" +#define SC_UNO_SHOWFILT "ShowFilterButton" +#define SC_UNO_IMPORTDESC "ImportDescriptor" +#define SC_UNO_SOURCESERV "SourceServiceName" +#define SC_UNO_SERVICEARG "ServiceArguments" + +// properties in data pilot descriptor ServiceArguments +#define SC_UNO_SOURCENAME "SourceName" +#define SC_UNO_OBJECTNAME "ObjectName" +#define SC_UNO_USERNAME "UserName" +#define SC_UNO_PASSWORD "Password" + +// range selection +#define SC_UNONAME_INITVAL "InitialValue" +#define SC_UNONAME_TITLE "Title" +#define SC_UNONAME_CLOSEONUP "CloseOnMouseRelease" +#define SC_UNONAME_SINGLECELL "SingleCellMode" +#define SC_UNONAME_MULTISEL "MultiSelectionMode" + +// XRenderable +#define SC_UNONAME_PAGESIZE "PageSize" +#define SC_UNONAME_RENDERDEV "RenderDevice" +#define SC_UNONAME_SOURCERANGE "SourceRange" +#define SC_UNONAME_INC_NP_AREA "PageIncludesNonprintableArea" + +// CellValueBinding +#define SC_UNONAME_BOUNDCELL "BoundCell" +// CellRangeListSource +#define SC_UNONAME_CELLRANGE "CellRange" + +// CellAddressConversion / CellRangeAddressConversion +#define SC_UNONAME_ADDRESS "Address" +#define SC_UNONAME_UIREPR "UserInterfaceRepresentation" +#define SC_UNONAME_PERSREPR "PersistentRepresentation" +#define SC_UNONAME_XLA1REPR "XLA1Representation" +#define SC_UNONAME_REFSHEET "ReferenceSheet" + +// Security options +#define SC_UNO_LOADREADONLY "LoadReadonly" +#define SC_UNO_MODIFYPASSWORDINFO "ModifyPasswordInfo" + +// FormulaParser +#define SC_UNO_COMPILEENGLISH "CompileEnglish" +#define SC_UNO_FORMULACONVENTION "FormulaConvention" +#define SC_UNO_IGNORELEADING "IgnoreLeadingSpaces" +#define SC_UNO_OPCODEMAP "OpCodeMap" +#define SC_UNO_EXTERNALLINKS "ExternalLinks" +#define SC_UNO_COMPILEFAP "CompileFAP" + +// Chart2 +#define SC_UNONAME_ROLE "Role" +#define SC_UNONAME_HIDDENVALUES "HiddenValues" +#define SC_UNONAME_INCLUDEHIDDENCELLS "IncludeHiddenCells" +#define SC_UNONAME_HIDDENVALUES "HiddenValues" + +// Solver +#define SC_UNONAME_TIMEOUT "Timeout" +#define SC_UNO_SHAREDOC "IsDocumentShared" + +// EventDescriptor +#define SC_UNO_EVENTTYPE "EventType" +#define SC_UNO_SCRIPT "Script" + +// Named ranges +#define SC_UNO_MODIFY_BROADCAST "ModifyAndBroadcast" + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/unoreflist.hxx b/sc/inc/unoreflist.hxx new file mode 100644 index 000000000000..ad64f943c47d --- /dev/null +++ b/sc/inc/unoreflist.hxx @@ -0,0 +1,86 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_UNOREFLIST_HXX +#define SC_UNOREFLIST_HXX + +#include <list> +#include <svl/hint.hxx> +#include "rangelst.hxx" + + +struct ScUnoRefEntry +{ + sal_Int64 nObjectId; + ScRangeList aRanges; + + ScUnoRefEntry( sal_Int64 nId, const ScRangeList& rOldRanges ) : + nObjectId( nId ), + aRanges( rOldRanges ) + { + } +}; + +/** List of RefUpdate changes made to UNO objects during ScUpdateRefHint broadcast. +*/ + +class ScUnoRefList +{ +private: + ::std::list<ScUnoRefEntry> aEntries; + +public: + ScUnoRefList(); + ~ScUnoRefList(); + + void Add( sal_Int64 nId, const ScRangeList& rOldRanges ); + void Undo( ScDocument* pDoc ); + + bool IsEmpty() const { return aEntries.empty(); } +}; + +/** Hint to restore a UNO object to its old state (used during undo). +*/ + +class ScUnoRefUndoHint : public SfxHint +{ + ScUnoRefEntry aEntry; + +public: + TYPEINFO(); + ScUnoRefUndoHint( const ScUnoRefEntry& rRefEntry ); + ~ScUnoRefUndoHint(); + + sal_Int64 GetObjectId() const { return aEntry.nObjectId; } + const ScRangeList& GetRanges() const { return aEntry.aRanges; } +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx new file mode 100644 index 000000000000..af860fd17a9d --- /dev/null +++ b/sc/inc/unowids.hxx @@ -0,0 +1,98 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_UNOWIDS_HXX +#define SC_UNOWIDS_HXX + +#include <tools/solar.h> +#include "scitems.hxx" + + +// WIDs for uno property maps, +// never stored in files + +#define SC_WID_UNO_START 1200 + +#define SC_WID_UNO_CELLSTYL ( SC_WID_UNO_START + 0 ) +#define SC_WID_UNO_CHCOLHDR ( SC_WID_UNO_START + 1 ) +#define SC_WID_UNO_CHROWHDR ( SC_WID_UNO_START + 2 ) +#define SC_WID_UNO_CONDFMT ( SC_WID_UNO_START + 3 ) +#define SC_WID_UNO_CONDLOC ( SC_WID_UNO_START + 4 ) +#define SC_WID_UNO_CONDXML ( SC_WID_UNO_START + 5 ) +#define SC_WID_UNO_TBLBORD ( SC_WID_UNO_START + 6 ) +#define SC_WID_UNO_VALIDAT ( SC_WID_UNO_START + 7 ) +#define SC_WID_UNO_VALILOC ( SC_WID_UNO_START + 8 ) +#define SC_WID_UNO_VALIXML ( SC_WID_UNO_START + 9 ) +#define SC_WID_UNO_POS ( SC_WID_UNO_START + 10 ) +#define SC_WID_UNO_SIZE ( SC_WID_UNO_START + 11 ) +#define SC_WID_UNO_FORMLOC ( SC_WID_UNO_START + 12 ) +#define SC_WID_UNO_FORMRT ( SC_WID_UNO_START + 13 ) +#define SC_WID_UNO_PAGESTL ( SC_WID_UNO_START + 14 ) +#define SC_WID_UNO_CELLVIS ( SC_WID_UNO_START + 15 ) +#define SC_WID_UNO_LINKDISPBIT ( SC_WID_UNO_START + 16 ) +#define SC_WID_UNO_LINKDISPNAME ( SC_WID_UNO_START + 17 ) +#define SC_WID_UNO_CELLWID ( SC_WID_UNO_START + 18 ) +#define SC_WID_UNO_OWIDTH ( SC_WID_UNO_START + 19 ) +#define SC_WID_UNO_NEWPAGE ( SC_WID_UNO_START + 20 ) +#define SC_WID_UNO_MANPAGE ( SC_WID_UNO_START + 21 ) +#define SC_WID_UNO_CELLHGT ( SC_WID_UNO_START + 22 ) +#define SC_WID_UNO_CELLFILT ( SC_WID_UNO_START + 23 ) +#define SC_WID_UNO_OHEIGHT ( SC_WID_UNO_START + 24 ) +#define SC_WID_UNO_DISPNAME ( SC_WID_UNO_START + 25 ) +#define SC_WID_UNO_HEADERSET ( SC_WID_UNO_START + 26 ) +#define SC_WID_UNO_FOOTERSET ( SC_WID_UNO_START + 27 ) +#define SC_WID_UNO_NUMRULES ( SC_WID_UNO_START + 28 ) +#define SC_WID_UNO_ISACTIVE ( SC_WID_UNO_START + 29 ) +#define SC_WID_UNO_BORDCOL ( SC_WID_UNO_START + 30 ) +#define SC_WID_UNO_PROTECT ( SC_WID_UNO_START + 31 ) +#define SC_WID_UNO_SHOWBORD ( SC_WID_UNO_START + 32 ) +#define SC_WID_UNO_PRINTBORD ( SC_WID_UNO_START + 33 ) +#define SC_WID_UNO_COPYBACK ( SC_WID_UNO_START + 34 ) +#define SC_WID_UNO_COPYSTYL ( SC_WID_UNO_START + 35 ) +#define SC_WID_UNO_COPYFORM ( SC_WID_UNO_START + 36 ) +#define SC_WID_UNO_TABLAYOUT ( SC_WID_UNO_START + 37 ) +#define SC_WID_UNO_AUTOPRINT ( SC_WID_UNO_START + 38 ) +#define SC_WID_UNO_ABSNAME ( SC_WID_UNO_START + 39 ) +#define SC_WID_UNO_CODENAME ( SC_WID_UNO_START + 40 ) +#define SC_WID_UNO_TABCOLOR ( SC_WID_UNO_START + 41 ) +#define SC_WID_UNO_END ( SC_WID_UNO_START + 41 ) + + +inline sal_Bool IsScUnoWid( sal_uInt16 nWid ) +{ + return nWid >= SC_WID_UNO_START && nWid <= SC_WID_UNO_END; +} + +inline sal_Bool IsScItemWid( sal_uInt16 nWid ) +{ + return nWid >= ATTR_STARTINDEX && nWid <= ATTR_ENDINDEX; // incl. page +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx new file mode 100644 index 000000000000..259e99d53090 --- /dev/null +++ b/sc/inc/userdat.hxx @@ -0,0 +1,119 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_USERDAT_HXX +#define SC_USERDAT_HXX + +#include <svx/svdobj.hxx> +#include <svtools/imap.hxx> +#include "global.hxx" +#include "address.hxx" + + +//------------------------------------------------------------------------- + +#define SC_DRAWLAYER 0x30334353 // Inventor: "SC30" + +// Object-Ids fuer UserData +#define SC_UD_OBJDATA 1 +#define SC_UD_IMAPDATA 2 +#define SC_UD_MACRODATA 3 + +//------------------------------------------------------------------------- + +class ScDrawObjFactory +{ + DECL_LINK( MakeUserData, SdrObjFactory * ); +public: + ScDrawObjFactory(); + ~ScDrawObjFactory(); +}; + +//------------------------------------------------------------------------- + +class ScDrawObjData : public SdrObjUserData +{ +public: + ScAddress maStart; + ScAddress maEnd; + Point maStartOffset; + Point maEndOffset; + bool mbNote; + Rectangle maLastRect; + + explicit ScDrawObjData(); + +private: + virtual ScDrawObjData* Clone( SdrObject* pObj ) const; +}; + +//------------------------------------------------------------------------- + +class ScIMapInfo : public SdrObjUserData +{ + ImageMap aImageMap; + +public: + ScIMapInfo(); + ScIMapInfo( const ImageMap& rImageMap ); + ScIMapInfo( const ScIMapInfo& rIMapInfo ); + virtual ~ScIMapInfo(); + + virtual SdrObjUserData* Clone( SdrObject* pObj ) const; + + void SetImageMap( const ImageMap& rIMap ) { aImageMap = rIMap; } + const ImageMap& GetImageMap() const { return aImageMap; } +}; + +//------------------------------------------------------------------------- + +class ScMacroInfo : public SdrObjUserData +{ +public: + ScMacroInfo(); + virtual ~ScMacroInfo(); + + virtual SdrObjUserData* Clone( SdrObject* pObj ) const; + + void SetMacro( const rtl::OUString& rMacro ) { maMacro = rMacro; } + const rtl::OUString& GetMacro() const { return maMacro; } + + void SetHlink( const rtl::OUString& rHlink ) { maHlink = rHlink; } + const rtl::OUString& GetHlink() const { return maHlink; } + +private: + rtl::OUString maMacro; + rtl::OUString maHlink; +}; + +//------------------------------------------------------------------------- + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx new file mode 100644 index 000000000000..e88335921eff --- /dev/null +++ b/sc/inc/userlist.hxx @@ -0,0 +1,93 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_USERLIST_HXX +#define SC_USERLIST_HXX + +#include <tools/stream.hxx> +#include "scdllapi.h" +#include "collect.hxx" + +//------------------------------------------------------------------------ +class SC_DLLPUBLIC ScUserListData : public ScDataObject +{ +friend class ScUserList; + String aStr; + sal_uInt16 nTokenCount; + String* pSubStrings; + String* pUpperSub; + + SC_DLLPRIVATE void InitTokens(); + +public: + ScUserListData(const String& rStr); + ScUserListData(const ScUserListData& rData); + virtual ~ScUserListData(); + + virtual ScDataObject* Clone() const { return new ScUserListData(*this); } + + const String& GetString() const { return aStr; } + void SetString( const String& rStr); + sal_uInt16 GetSubCount() const; + sal_Bool GetSubIndex(const String& rSubStr, sal_uInt16& rIndex) const; + String GetSubStr(sal_uInt16 nIndex) const; + StringCompare Compare(const String& rSubStr1, const String& rSubStr2) const; + StringCompare ICompare(const String& rSubStr1, const String& rSubStr2) const; +}; + +//------------------------------------------------------------------------ +class SC_DLLPUBLIC ScUserList : public ScCollection +{ +public: + ScUserList( sal_uInt16 nLim = 4, sal_uInt16 nDel = 4); + ScUserList( const ScUserList& rUserList ) : ScCollection ( rUserList ) {} + + virtual ScDataObject* Clone() const; + + ScUserListData* GetData( const String& rSubStr ) const; + /// If the list in rStr is already inserted + sal_Bool HasEntry( const String& rStr ) const; + + inline ScUserListData* operator[]( const sal_uInt16 nIndex) const; + inline ScUserList& operator= ( const ScUserList& r ); + sal_Bool operator==( const ScUserList& r ) const; + inline sal_Bool operator!=( const ScUserList& r ) const; +}; + +inline ScUserList& ScUserList::operator=( const ScUserList& r ) + { return (ScUserList&)ScCollection::operator=( r ); } + +inline ScUserListData* ScUserList::operator[]( const sal_uInt16 nIndex) const + { return (ScUserListData*)At(nIndex); } + +inline sal_Bool ScUserList::operator!=( const ScUserList& r ) const + { return !operator==( r ); } + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx new file mode 100644 index 000000000000..e2a1f3a6cdcc --- /dev/null +++ b/sc/inc/validat.hxx @@ -0,0 +1,211 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_VALIDAT_HXX +#define SC_VALIDAT_HXX + +#include "conditio.hxx" +#include <com/sun/star/sheet/TableValidationVisibility.hpp> +#include "scdllapi.h" + +namespace ValidListType = ::com::sun::star::sheet::TableValidationVisibility; + +class ScPatternAttr; +class ScTokenArray; +class TypedScStrCollection; + +enum ScValidationMode +{ + SC_VALID_ANY, + SC_VALID_WHOLE, + SC_VALID_DECIMAL, + SC_VALID_DATE, + SC_VALID_TIME, + SC_VALID_TEXTLEN, + SC_VALID_LIST, + SC_VALID_CUSTOM +}; + +enum ScValidErrorStyle +{ + SC_VALERR_STOP, + SC_VALERR_WARNING, + SC_VALERR_INFO, + SC_VALERR_MACRO +}; + +// +// Entry for validation (only one condition exists) +// + +class SC_DLLPUBLIC ScValidationData : public ScConditionEntry +{ + sal_uInt32 nKey; // index in attributes + + ScValidationMode eDataMode; + sal_Bool bShowInput; + sal_Bool bShowError; + ScValidErrorStyle eErrorStyle; + sal_Int16 mnListType; // selection list type: none, unsorted, sorted. + String aInputTitle; + String aInputMessage; + String aErrorTitle; + String aErrorMessage; + + sal_Bool bIsUsed; // temporary during saving + + sal_Bool DoMacro( const ScAddress& rPos, const String& rInput, + ScFormulaCell* pCell, Window* pParent ) const; + + sal_Bool DoScript( const ScAddress& rPos, const String& rInput, + ScFormulaCell* pCell, Window* pParent ) const; + + using ScConditionEntry::operator==; + +public: + ScValidationData( ScValidationMode eMode, ScConditionMode eOper, + const String& rExpr1, const String& rExpr2, + ScDocument* pDocument, const ScAddress& rPos, + const String& rExprNmsp1 = EMPTY_STRING, const String& rExprNmsp2 = EMPTY_STRING, + formula::FormulaGrammar::Grammar eGrammar1 = formula::FormulaGrammar::GRAM_DEFAULT, + formula::FormulaGrammar::Grammar eGrammar2 = formula::FormulaGrammar::GRAM_DEFAULT ); + ScValidationData( ScValidationMode eMode, ScConditionMode eOper, + const ScTokenArray* pArr1, const ScTokenArray* pArr2, + ScDocument* pDocument, const ScAddress& rPos ); + ScValidationData( const ScValidationData& r ); + ScValidationData( ScDocument* pDocument, const ScValidationData& r ); + virtual ~ScValidationData(); + + ScValidationData* Clone() const // real copy + { return new ScValidationData( GetDocument(), *this ); } + ScValidationData* Clone(ScDocument* pNew) const + { return new ScValidationData( pNew, *this ); } + + void ResetInput(); + void ResetError(); + void SetInput( const String& rTitle, const String& rMsg ); + void SetError( const String& rTitle, const String& rMsg, + ScValidErrorStyle eStyle ); + + sal_Bool GetInput( String& rTitle, String& rMsg ) const + { rTitle = aInputTitle; rMsg = aInputMessage; return bShowInput; } + sal_Bool GetErrMsg( String& rTitle, String& rMsg, ScValidErrorStyle& rStyle ) const; + + sal_Bool HasErrMsg() const { return bShowError; } + + ScValidationMode GetDataMode() const { return eDataMode; } + + inline sal_Int16 GetListType() const { return mnListType; } + inline void SetListType( sal_Int16 nListType ) { mnListType = nListType; } + + /** Returns true, if the validation cell will show a selection list. + @descr Use this instead of GetListType() which returns the raw property + regardless of the validation type. */ + bool HasSelectionList() const; + /** Tries to fill the passed collection with list validation entries. + @descr Fills the list only, if this is a list validation and IsShowList() is enabled. + @param rStrings (out-param) The string list to fill with list validation entires. + @return true = rStrings has been filled with at least one entry. */ + bool FillSelectionList( TypedScStrCollection& rStrings, const ScAddress& rPos ) const; + + // with string: during input, with cell: for detective / RC_FORCED + sal_Bool IsDataValid( const String& rTest, const ScPatternAttr& rPattern, + const ScAddress& rPos ) const; + sal_Bool IsDataValid( ScBaseCell* pCell, const ScAddress& rPos ) const; + + // TRUE -> break + sal_Bool DoError( Window* pParent, const String& rInput, const ScAddress& rPos ) const; + void DoCalcError( ScFormulaCell* pCell ) const; + + sal_Bool IsEmpty() const; + sal_uInt32 GetKey() const { return nKey; } + void SetKey(sal_uInt32 nNew) { nKey = nNew; } // only if not inserted! + + void SetUsed(sal_Bool bSet) { bIsUsed = bSet; } + sal_Bool IsUsed() const { return bIsUsed; } + + sal_Bool EqualEntries( const ScValidationData& r ) const; // for undo + + // sort (using PTRARR) by index + // operator== only for sorting + sal_Bool operator ==( const ScValidationData& r ) const { return nKey == r.nKey; } + sal_Bool operator < ( const ScValidationData& r ) const { return nKey < r.nKey; } + +private: + /** Tries to fill the passed collection with list validation entries. + @descr Fills the list only if it is non-NULL, + @param pStrings (out-param) Optionally NULL, string list to fill with list validation entires. + @param pCell can be NULL if it is not necessary to which element in the list is selected. + @param rPos the base address for relative references. + @param rTokArr Formula token array. + @param rMatch (out-param) the index of the first item that matched, -1 if nothing matched. + @return true = Cell range found, rRange is valid, or an error entry stuffed into the list if pCell==NULL. */ + bool GetSelectionFromFormula( TypedScStrCollection* pStrings, + ScBaseCell* pCell, const ScAddress& rPos, + const ScTokenArray& rTokArr, int& rMatch ) const; + + /** Tests, if pCell is equal to what the passed token array represents. */ + bool IsEqualToTokenArray( ScBaseCell* pCell, const ScAddress& rPos, const ScTokenArray& rTokArr ) const; + + /** Tests, if contents of pCell occur in cell range referenced by own formula, or in a string list. */ + bool IsListValid( ScBaseCell* pCell, const ScAddress& rPos ) const; +}; + +// +// list of contitions: +// + +typedef ScValidationData* ScValidationDataPtr; + +SV_DECL_PTRARR_SORT(ScValidationEntries_Impl, ScValidationDataPtr, + SC_COND_GROW, SC_COND_GROW) + +class ScValidationDataList : public ScValidationEntries_Impl +{ +public: + ScValidationDataList() {} + ScValidationDataList(const ScValidationDataList& rList); + ScValidationDataList(ScDocument* pNewDoc, const ScValidationDataList& rList); + ~ScValidationDataList() {} + + void InsertNew( ScValidationData* pNew ) + { if (!Insert(pNew)) delete pNew; } + + ScValidationData* GetData( sal_uInt32 nKey ); + + void CompileXML(); + void UpdateReference( UpdateRefMode eUpdateRefMode, + const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos ); + + sal_Bool operator==( const ScValidationDataList& r ) const; // for ref-undo +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx new file mode 100644 index 000000000000..998f1f693b28 --- /dev/null +++ b/sc/inc/viewopti.hxx @@ -0,0 +1,179 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_VIEWOPTI_HXX +#define SC_VIEWOPTI_HXX + +#include <svx/optgrid.hxx> + +#include <svx/svxids.hrc> +#include "scdllapi.h" +#include "optutil.hxx" +#include "global.hxx" + +//================================================================== +// View-Optionen +//================================================================== + +enum ScViewOption +{ + VOPT_FORMULAS = 0, + VOPT_NULLVALS, + VOPT_SYNTAX, + VOPT_NOTES, + VOPT_VSCROLL, + VOPT_HSCROLL, + VOPT_TABCONTROLS, + VOPT_OUTLINER, + VOPT_HEADER, + VOPT_GRID, + VOPT_HELPLINES, + VOPT_ANCHOR, + VOPT_PAGEBREAKS, + VOPT_SOLIDHANDLES, + VOPT_CLIPMARKS, + VOPT_BIGHANDLES +}; + +enum ScVObjType +{ + VOBJ_TYPE_OLE = 0, + VOBJ_TYPE_CHART, + VOBJ_TYPE_DRAW +}; + +#define MAX_OPT (sal_uInt16)VOPT_BIGHANDLES+1 +#define MAX_TYPE (sal_uInt16)VOBJ_TYPE_DRAW+1 + +#define SC_STD_GRIDCOLOR COL_LIGHTGRAY + +//================================================================== +// SvxGrid-Optionen mit Standard-Operatoren +//================================================================== + +class ScGridOptions : public SvxOptionsGrid +{ +public: + ScGridOptions() : SvxOptionsGrid() {} + ScGridOptions( const SvxOptionsGrid& rOpt ) : SvxOptionsGrid( rOpt ) {} + + void SetDefaults(); + const ScGridOptions& operator= ( const ScGridOptions& rCpy ); + int operator== ( const ScGridOptions& rOpt ) const; + int operator!= ( const ScGridOptions& rOpt ) const { return !(operator==(rOpt)); } +}; + +//================================================================== +// Einstellungen - Ansicht +//================================================================== + +class SC_DLLPUBLIC ScViewOptions +{ +public: + ScViewOptions(); + ScViewOptions( const ScViewOptions& rCpy ); + ~ScViewOptions(); + + void SetDefaults(); + + void SetOption( ScViewOption eOpt, sal_Bool bNew = sal_True ) { aOptArr[eOpt] = bNew; } + sal_Bool GetOption( ScViewOption eOpt ) const { return aOptArr[eOpt]; } + + void SetObjMode( ScVObjType eObj, ScVObjMode eMode ) { aModeArr[eObj] = eMode; } + ScVObjMode GetObjMode( ScVObjType eObj ) const { return aModeArr[eObj]; } + + void SetGridColor( const Color& rCol, const String& rName ) { aGridCol = rCol; aGridColName = rName;} + Color GetGridColor( String* pStrName = NULL ) const; + + const ScGridOptions& GetGridOptions() const { return aGridOpt; } + void SetGridOptions( const ScGridOptions& rNew ) { aGridOpt = rNew; } + SvxGridItem* CreateGridItem( sal_uInt16 nId = SID_ATTR_GRID_OPTIONS ) const; + + const ScViewOptions& operator= ( const ScViewOptions& rCpy ); + int operator== ( const ScViewOptions& rOpt ) const; + int operator!= ( const ScViewOptions& rOpt ) const { return !(operator==(rOpt)); } + +private: + sal_Bool aOptArr [MAX_OPT]; + ScVObjMode aModeArr [MAX_TYPE]; + Color aGridCol; + String aGridColName; + ScGridOptions aGridOpt; +}; + +//================================================================== +// Item fuer Einstellungsdialog - Ansicht +//================================================================== + +class SC_DLLPUBLIC ScTpViewItem : public SfxPoolItem +{ +public: + TYPEINFO(); + ScTpViewItem( sal_uInt16 nWhich, const ScViewOptions& rOpt ); + ScTpViewItem( const ScTpViewItem& rItem ); + ~ScTpViewItem(); + + virtual String GetValueText() const; + virtual int operator==( const SfxPoolItem& ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + const ScViewOptions& GetViewOptions() const { return theOptions; } + +private: + ScViewOptions theOptions; +}; + + +//================================================================== +// CfgItem fuer View-Optionen +//================================================================== + +class ScViewCfg : public ScViewOptions +{ + ScLinkConfigItem aLayoutItem; + ScLinkConfigItem aDisplayItem; + ScLinkConfigItem aGridItem; + + DECL_LINK( LayoutCommitHdl, void* ); + DECL_LINK( DisplayCommitHdl, void* ); + DECL_LINK( GridCommitHdl, void* ); + + com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetDisplayPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetGridPropertyNames(); + +public: + ScViewCfg(); + + void SetOptions( const ScViewOptions& rNew ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx new file mode 100644 index 000000000000..9b4e276465cd --- /dev/null +++ b/sc/inc/viewuno.hxx @@ -0,0 +1,405 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_VIEWUNO_HXX +#define SC_VIEWUNO_HXX + +#include <sfx2/sfxbasecontroller.hxx> +#include <svl/svarray.hxx> +#include <svl/itemprop.hxx> +#include <com/sun/star/view/XFormLayerAccess.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/sheet/XCellRangeReferrer.hpp> +#include <com/sun/star/sheet/XViewSplitable.hpp> +#include <com/sun/star/sheet/XViewFreezable.hpp> +#include <com/sun/star/sheet/XSpreadsheetView.hpp> +#include <com/sun/star/sheet/XEnhancedMouseClickBroadcaster.hpp> +#include <com/sun/star/sheet/XActivationBroadcaster.hpp> +#include <com/sun/star/sheet/XViewPane.hpp> +#include <com/sun/star/sheet/XRangeSelection.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/datatransfer/XTransferableSupplier.hpp> + +#include "address.hxx" + +class ScTabViewShell; + +#define SC_VIEWPANE_ACTIVE 0xFFFF + + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XRangeSelectionListener >* XRangeSelectionListenerPtr; +SV_DECL_PTRARR_DEL( XRangeSelectionListenerArr_Impl, XRangeSelectionListenerPtr, 4, 4 ) + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XRangeSelectionChangeListener >* XRangeSelectionChangeListenerPtr; +SV_DECL_PTRARR_DEL( XRangeSelectionChangeListenerArr_Impl, XRangeSelectionChangeListenerPtr, 4, 4 ) + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::view::XSelectionChangeListener >* XSelectionChangeListenerPtr; +SV_DECL_PTRARR_DEL( XSelectionChangeListenerArr_Impl, XSelectionChangeListenerPtr, 4, 4 ) + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >* XViewPropertyChangeListenerPtr; +SV_DECL_PTRARR_DEL( XViewPropertyChangeListenerArr_Impl, XViewPropertyChangeListenerPtr, 4, 4 ) + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XEnhancedMouseClickHandler >* XMouseClickHandlerPtr; +SV_DECL_PTRARR_DEL( XMouseClickHandlerArr_Impl, XMouseClickHandlerPtr, 4, 4 ) + +typedef ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XActivationEventListener >* XActivationEventListenerPtr; +SV_DECL_PTRARR_DEL( XActivationEventListenerArr_Impl, XActivationEventListenerPtr, 4, 4 ) + + +// ScViewPaneBase not derived from OWeakObject +// to avoid duplicate OWeakObject in ScTabViewObj + +class ScViewPaneBase : public com::sun::star::sheet::XViewPane, + public com::sun::star::sheet::XCellRangeReferrer, + public com::sun::star::view::XFormLayerAccess, + public com::sun::star::lang::XServiceInfo, + public com::sun::star::lang::XTypeProvider, + public SfxListener +{ +private: + ScTabViewShell* pViewShell; + sal_uInt16 nPane; // ScSplitPos oder SC_VIEWPANE_ACTIVE + +protected: + ::com::sun::star::awt::Rectangle GetVisArea() const; + +public: + ScViewPaneBase(ScTabViewShell* pViewSh, sal_uInt16 nP); + virtual ~ScViewPaneBase(); + + ScTabViewShell* GetViewShell() const { return pViewShell; } + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XViewPane + virtual sal_Int32 SAL_CALL getFirstVisibleColumn() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFirstVisibleColumn( sal_Int32 nFirstVisibleColumn ) + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getFirstVisibleRow() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFirstVisibleRow( sal_Int32 nFirstVisibleRow ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::table::CellRangeAddress SAL_CALL getVisibleRange() + throw(::com::sun::star::uno::RuntimeException); + + // XCellRangeReferrer + virtual ::com::sun::star::uno::Reference< ::com::sun::star::table::XCellRange > SAL_CALL + getReferredCells() throw(::com::sun::star::uno::RuntimeException); + + // XFormLayerAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::form::runtime::XFormController > SAL_CALL + getFormController( const ::com::sun::star::uno::Reference< + ::com::sun::star::form::XForm >& Form ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL + isFormDesignMode( ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setFormDesignMode( ::sal_Bool DesignMode ) + throw (::com::sun::star::uno::RuntimeException); + + // XControlAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > SAL_CALL + getControl( const ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XControlModel >& xModel ) + throw(::com::sun::star::container::NoSuchElementException, + ::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); +}; + + +// ScViewPaneObj for direct use (including OWeakObject) + +class ScViewPaneObj : public ScViewPaneBase, public cppu::OWeakObject +{ +public: + ScViewPaneObj(ScTabViewShell* pViewSh, sal_uInt16 nP); + virtual ~ScViewPaneObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); +}; + +// OWeakObject is base of SfxBaseController -> use ScViewPaneBase + +class ScTabViewObj : public ScViewPaneBase, + public SfxBaseController, + public com::sun::star::sheet::XSpreadsheetView, + public com::sun::star::sheet::XEnhancedMouseClickBroadcaster, + public com::sun::star::sheet::XActivationBroadcaster, + public com::sun::star::container::XEnumerationAccess, + public com::sun::star::container::XIndexAccess, + public com::sun::star::view::XSelectionSupplier, + public com::sun::star::beans::XPropertySet, + public com::sun::star::sheet::XViewSplitable, + public com::sun::star::sheet::XViewFreezable, + public com::sun::star::sheet::XRangeSelection, + public com::sun::star::lang::XUnoTunnel, + public com::sun::star::datatransfer::XTransferableSupplier +{ +private: + SfxItemPropertySet aPropSet; + XSelectionChangeListenerArr_Impl aSelectionListeners; + XRangeSelectionListenerArr_Impl aRangeSelListeners; + XRangeSelectionChangeListenerArr_Impl aRangeChgListeners; + XViewPropertyChangeListenerArr_Impl aPropertyChgListeners; + XMouseClickHandlerArr_Impl aMouseClickHandlers; + XActivationEventListenerArr_Impl aActivationListeners; + SCTAB nPreviousTab; + sal_Bool bDrawSelModeSet; + sal_Bool bFilteredRangeSelection; + + ScViewPaneObj* GetObjectByIndex_Impl(sal_uInt16 nIndex) const; + sal_Int16 GetZoom(void) const; + void SetZoom(sal_Int16 Zoom); + sal_Int16 GetZoomType(void) const; + void SetZoomType(sal_Int16 ZoomType); + + com::sun::star::uno::Reference< com::sun::star::uno::XInterface > GetClickedObject(const Point& rPoint) const; + void StartMouseListening(); + void EndMouseListening(); + void StartActivationListening(); + void EndActivationListening(); + + ScTabViewObj(); // disabled +public: + ScTabViewObj(ScTabViewShell* pViewSh); + virtual ~ScTabViewObj(); + + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + const ::com::sun::star::uno::Type & rType ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw(); + virtual void SAL_CALL release() throw(); + + void SelectionChanged(); + void VisAreaChanged(); + // bSameTabButMoved = true if the same sheet as before is activated, used after moving/copying/inserting/deleting a sheet + void SheetChanged( bool bSameTabButMoved = false ); + bool IsMouseListening() const; + sal_Bool MousePressed( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException); + sal_Bool MouseReleased( const ::com::sun::star::awt::MouseEvent& e ) throw (::com::sun::star::uno::RuntimeException); + + void RangeSelDone( const String& rText ); + void RangeSelAborted( const String& rText ); + void RangeSelChanged( const String& rText ); + + // XSelectionSupplier + virtual sal_Bool SAL_CALL select( const ::com::sun::star::uno::Any& aSelection ) + throw(::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getSelection() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionChangeListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::view::XSelectionChangeListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionChangeListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::view::XSelectionChangeListener >& xListener ) + throw(::com::sun::star::uno::RuntimeException); + + //! XPrintable? + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const ::rtl::OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XEnumerationAccess + virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL + createEnumeration() throw(::com::sun::star::uno::RuntimeException); + + // XIndexAccess + virtual sal_Int32 SAL_CALL getCount() throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( sal_Int32 Index ) + throw(::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); + + // XSpreadsheetView + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XSpreadsheet > SAL_CALL + getActiveSheet() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setActiveSheet( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet ) + throw(::com::sun::star::uno::RuntimeException); + + // support expand (but not replace) the active sheet + virtual void SAL_CALL selectSheet( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XSpreadsheet >& xActiveSheet, + sal_Bool bExpand) + throw(::com::sun::star::uno::RuntimeException); + //XEnhancedMouseClickBroadcaster + + virtual void SAL_CALL addEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XEnhancedMouseClickHandler >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeEnhancedMouseClickHandler( const ::com::sun::star::uno::Reference< + ::com::sun::star::awt::XEnhancedMouseClickHandler >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + //XActivationBroadcaster + + virtual void SAL_CALL addActivationEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XActivationEventListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeActivationEventListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XActivationEventListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // XViewSplitable + virtual sal_Bool SAL_CALL getIsWindowSplit() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSplitHorizontal() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSplitVertical() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSplitColumn() throw(::com::sun::star::uno::RuntimeException); + virtual sal_Int32 SAL_CALL getSplitRow() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL splitAtPosition( sal_Int32 nPixelX, sal_Int32 nPixelY ) + throw(::com::sun::star::uno::RuntimeException); + + // XViewFreezable + virtual sal_Bool SAL_CALL hasFrozenPanes() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRows ) + throw(::com::sun::star::uno::RuntimeException); + + // XRangeSelection + virtual void SAL_CALL startRangeSelection( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue >& aArguments ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL abortRangeSelection() throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRangeSelectionListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XRangeSelectionListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRangeSelectionListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XRangeSelectionListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addRangeSelectionChangeListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XRangeSelectionChangeListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeRangeSelectionChangeListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::sheet::XRangeSelectionChangeListener >& aListener ) + throw(::com::sun::star::uno::RuntimeException); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw(::com::sun::star::uno::RuntimeException); + + // XUnoTunnel + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< + sal_Int8 >& aIdentifier ) + throw(::com::sun::star::uno::RuntimeException); + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ScTabViewObj* getImplementation( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface> xObj ); + + // XTypeProvider + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes() + throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() + throw(::com::sun::star::uno::RuntimeException); + + //XTransferableSupplier + virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getTransferable( ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertTransferable( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::uno::RuntimeException); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/waitoff.hxx b/sc/inc/waitoff.hxx new file mode 100644 index 000000000000..0863b6d1b1be --- /dev/null +++ b/sc/inc/waitoff.hxx @@ -0,0 +1,49 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_WAITOFF_HXX +#define SC_WAITOFF_HXX + +#include <sal/types.h> + +class Window; + +class ScWaitCursorOff +{ +private: + Window* pWin; + sal_uInt32 nWaiters; +public: + ScWaitCursorOff( Window* pWin ); + ~ScWaitCursorOff(); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/warnpassword.hxx b/sc/inc/warnpassword.hxx new file mode 100644 index 000000000000..4e3f2d53f499 --- /dev/null +++ b/sc/inc/warnpassword.hxx @@ -0,0 +1,50 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_WARNPASSWORD_HXX +#define SC_WARNPASSWORD_HXX + + + +class SfxMedium; +/** Static API helper functions. */ +class ScWarnPassword +{ +public: + /** Opens a query warning dialog. + @descr Pop up Query on export with a choice of yes/no if a + an encrypted password is imported. + @return true if yes and false if no. default to true. + */ + static bool WarningOnPassword( SfxMedium& rMedium ); +}; + + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx new file mode 100644 index 000000000000..b045c753e4c0 --- /dev/null +++ b/sc/inc/xmlwrap.hxx @@ -0,0 +1,85 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef SC_XMLWRAP_HXX +#define SC_XMLWRAP_HXX + +#include <tools/solar.h> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> + +class ScDocument; +class SfxMedium; +class ScMySharedData; + +#include <tools/errcode.hxx> + +namespace com { namespace sun { namespace star { + namespace beans { struct PropertyValue; } + namespace frame { class XModel; } + namespace task { class XStatusIndicator; } + namespace lang { class XMultiServiceFactory; } + namespace uno { class XInterface; } + namespace embed { class XStorage; } + namespace xml { + namespace sax { struct InputSource; } } +} } } + +class ScXMLImportWrapper +{ + ScDocument& rDoc; + SfxMedium* pMedium; + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > xStorage; + + com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator> GetStatusIndicator(); + + sal_uInt32 ImportFromComponent(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceFactory, + com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xModel, + com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xXMLParser, + com::sun::star::xml::sax::InputSource& aParserInput, + const rtl::OUString& sComponentName, const rtl::OUString& sDocName, const rtl::OUString& sOldDocName, + com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArgs, + sal_Bool bMustBeSuccessfull); + + sal_Bool ExportToComponent(com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xServiceFactory, + com::sun::star::uno::Reference<com::sun::star::frame::XModel>& xModel, + com::sun::star::uno::Reference<com::sun::star::uno::XInterface>& xWriter, + com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aDescriptor, + const rtl::OUString& sName, const rtl::OUString& sMediaType, const rtl::OUString& sComponentName, + const sal_Bool bPlainText, com::sun::star::uno::Sequence<com::sun::star::uno::Any>& aArgs, + ScMySharedData*& pSharedData); + +public: + ScXMLImportWrapper(ScDocument& rD, SfxMedium* pM, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >&); + sal_Bool Import(sal_Bool bStylesOnly, ErrCode& ); + sal_Bool Export(sal_Bool bStylesOnly); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/inc/zforauto.hxx b/sc/inc/zforauto.hxx new file mode 100644 index 000000000000..f3f0f6201e20 --- /dev/null +++ b/sc/inc/zforauto.hxx @@ -0,0 +1,74 @@ +/* -*- 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. + * + ************************************************************************/ + +#ifndef _ZFORAUTO_HXX_ +#define _ZFORAUTO_HXX_ + +#include <tools/string.hxx> +#include <i18npool/lang.h> + + +class SvStream; +class SvNumberFormatter; + + +class ScNumFormatAbbrev +{ + String sFormatstring; + LanguageType eLnge; + LanguageType eSysLnge; +public: + ScNumFormatAbbrev(); + ScNumFormatAbbrev(const ScNumFormatAbbrev& aFormat); + ScNumFormatAbbrev(sal_uLong nFormat, SvNumberFormatter& rFormatter); + void Load( SvStream& rStream, CharSet eByteStrSet ); // loading of the numberformats + void Save( SvStream& rStream, CharSet eByteStrSet ) const; // saving of the numberformats + void PutFormatIndex(sal_uLong nFormat, SvNumberFormatter& rFormatter); + sal_uLong GetFormatIndex( SvNumberFormatter& rFormatter); + inline int operator==(const ScNumFormatAbbrev& rNumFormat) const + { + return ((sFormatstring == rNumFormat.sFormatstring) + && (eLnge == rNumFormat.eLnge) + && (eSysLnge == rNumFormat.eSysLnge)); + } + inline ScNumFormatAbbrev& operator=(const ScNumFormatAbbrev& rNumFormat) + { + sFormatstring = rNumFormat.sFormatstring; + eLnge = rNumFormat.eLnge; + eSysLnge = rNumFormat.eSysLnge; + return *this; + } + inline LanguageType GetLanguage() const { return eLnge; } +}; + + + +#endif + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |