diff options
Diffstat (limited to 'sc/inc')
182 files changed, 44744 insertions, 0 deletions
diff --git a/sc/inc/AccessibleFilterMenu.hxx b/sc/inc/AccessibleFilterMenu.hxx new file mode 100644 index 000000000000..df72fec64f57 --- /dev/null +++ b/sc/inc/AccessibleFilterMenu.hxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * 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 diff --git a/sc/inc/AccessibleFilterMenuItem.hxx b/sc/inc/AccessibleFilterMenuItem.hxx new file mode 100644 index 000000000000..ecf5bdc5ad87 --- /dev/null +++ b/sc/inc/AccessibleFilterMenuItem.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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 diff --git a/sc/inc/AccessibleFilterTopWindow.hxx b/sc/inc/AccessibleFilterTopWindow.hxx new file mode 100644 index 000000000000..55fcb503f51b --- /dev/null +++ b/sc/inc/AccessibleFilterTopWindow.hxx @@ -0,0 +1,98 @@ +/************************************************************************* + * + * 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 "AccessibleContextBase.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 diff --git a/sc/inc/AccessibleGlobal.hxx b/sc/inc/AccessibleGlobal.hxx new file mode 100644 index 000000000000..a30ebf7ee18c --- /dev/null +++ b/sc/inc/AccessibleGlobal.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * 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 diff --git a/sc/inc/ViewSettingsSequenceDefines.hxx b/sc/inc/ViewSettingsSequenceDefines.hxx new file mode 100644 index 000000000000..07c3d2b375e0 --- /dev/null +++ b/sc/inc/ViewSettingsSequenceDefines.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * 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 15 + +#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_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 diff --git a/sc/inc/addincfg.hxx b/sc/inc/addincfg.hxx new file mode 100644 index 000000000000..193da4095977 --- /dev/null +++ b/sc/inc/addincfg.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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; + +// com::sun::star::uno::Sequence< rtl::OUString > GetNodeNames(rtl::OUString& rNode) +// { return ConfigItem::GetNodeNames( rNode ); } +}; + + +#endif + diff --git a/sc/inc/addincol.hxx b/sc/inc/addincol.hxx new file mode 100644 index 000000000000..f8c47ab24446 --- /dev/null +++ b/sc/inc/addincol.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * 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> + +#ifndef SC_SCMATRIX_HXX +#include "scmatrix.hxx" +#endif + +#include <hash_map> + + +class String; +class SfxObjectShell; +class ScUnoAddInFuncData; +class ScMatrix; +class ScFuncDesc; + + +typedef ::std::hash_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; + 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; + USHORT nCategory; + rtl::OString sHelpId; + mutable com::sun::star::uno::Sequence< com::sun::star::sheet::LocalizedName> aCompNames; + mutable BOOL bCompInitialized; + +public: + ScUnoAddInFuncData( const String& rNam, const String& rLoc, + const String& rDesc, + USHORT 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; } + USHORT GetCategory() const { return nCategory; } + const rtl::OString GetHelpId() const { return sHelpId; } + + const com::sun::star::uno::Sequence< com::sun::star::sheet::LocalizedName>& GetCompNames() const; + 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 + 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, 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(); + BOOL FillFunctionDesc( long nFunc, ScFuncDesc& rDesc ); + + static BOOL FillFunctionDescFromData( const ScUnoAddInFuncData& rFuncData, ScFuncDesc& rDesc ); + + BOOL GetExcelName( const String& rCalcName, LanguageType eDestLang, String& rRetExcelName ); + 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; + BOOL bValidCount; + // result: + USHORT nErrCode; + 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(); + + BOOL NeedsCaller() const; + void SetCaller( const com::sun::star::uno::Reference< + com::sun::star::uno::XInterface>& rInterface ); + void SetCallerFromObjectShell( SfxObjectShell* pSh ); + + 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 ); + + USHORT GetErrCode() const { return nErrCode; } + BOOL HasString() const { return bHasString; } + BOOL HasMatrix() const { return ( xMatrix.Is() ); } + 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 + diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx new file mode 100644 index 000000000000..64dd9e3e7ea6 --- /dev/null +++ b/sc/inc/address.hxx @@ -0,0 +1,820 @@ +/************************************************************************* + * + * 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 65536 +#define MAXROWCOUNT_DEFINE 1048576 +#define MAXCOLCOUNT_DEFINE 1024 + +// Count values +const SCROW MAXROWCOUNT = MAXROWCOUNT_DEFINE; +const SCCOL MAXCOLCOUNT = MAXCOLCOUNT_DEFINE; +const SCTAB MAXTABCOUNT = 256; +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 +// 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 ); +//UNUSED2009-05 void SetPos( 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 USHORT 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( String&, USHORT = 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 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? + + USHORT 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 ); + + USHORT ParseAny( const String&, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); + SC_DLLPUBLIC USHORT ParseCols( const String&, ScDocument* = NULL, + const ScAddress::Details& rDetails = ScAddress::detailsOOOa1 ); + SC_DLLPUBLIC USHORT 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, USHORT& nFlags, + bool bOnlyAcceptSingle, + const ::com::sun::star::uno::Sequence< + const ::com::sun::star::sheet::ExternalLinkInfo > * pExternalLinks = NULL ); + + SC_DLLPUBLIC void Format( String&, USHORT = 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( USHORT n ) const { return aRange[n]; } + ScRange& GetRange( USHORT 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 + diff --git a/sc/inc/addruno.hxx b/sc/inc/addruno.hxx new file mode 100644 index 000000000000..d6df571a29aa --- /dev/null +++ b/sc/inc/addruno.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 ); + +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 + diff --git a/sc/inc/afmtuno.hxx b/sc/inc/afmtuno.hxx new file mode 100644 index 000000000000..9cb402a03764 --- /dev/null +++ b/sc/inc/afmtuno.hxx @@ -0,0 +1,310 @@ +/************************************************************************* + * + * 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(USHORT 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; + USHORT nFormatIndex; + + ScAutoFormatFieldObj* GetObjectByIndex_Impl(USHORT nIndex); + +public: + ScAutoFormatObj(USHORT 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( USHORT 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; + USHORT nFormatIndex; + USHORT nFieldIndex; + +public: + ScAutoFormatFieldObj(USHORT nFormat, USHORT 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 + diff --git a/sc/inc/appluno.hxx b/sc/inc/appluno.hxx new file mode 100644 index 000000000000..050611eeeb9e --- /dev/null +++ b/sc/inc/appluno.hxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * 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> + +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 + diff --git a/sc/inc/appoptio.hxx b/sc/inc/appoptio.hxx new file mode 100644 index 000000000000..91fc43fc249a --- /dev/null +++ b/sc/inc/appoptio.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * 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(); + + void SetAppMetric( FieldUnit eUnit ) { eMetric = eUnit; } + FieldUnit GetAppMetric() const { return eMetric; } + void SetZoom( USHORT nNew ) { nZoom = nNew; } + USHORT GetZoom() const { return nZoom; } + void SetZoomType( SvxZoomType eNew ) { eZoomType = eNew; } + SvxZoomType GetZoomType() const { return eZoomType; } + void SetSynchronizeZoom( BOOL bNew ) { bSynchronizeZoom = bNew; } + BOOL GetSynchronizeZoom() const { return bSynchronizeZoom; } + USHORT GetLRUFuncListCount() const { return nLRUFuncCount; } + USHORT* GetLRUFuncList() const { return pLRUList; } + void SetLRUFuncList( const USHORT* pList, + const USHORT nCount ); + void SetStatusFunc( USHORT nNew ) { nStatusFunc = nNew; } + USHORT GetStatusFunc() const { return nStatusFunc; } + void SetAutoComplete( BOOL bNew ) { bAutoComplete = bNew; } + BOOL GetAutoComplete() const { return bAutoComplete; } + void SetDetectiveAuto( BOOL bNew ) { bDetectiveAuto = bNew; } + 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(INT32 nNew) { nDefaultObjectSizeWidth = nNew; } + INT32 GetDefaultObjectSizeWidth() const { return nDefaultObjectSizeWidth; } + void SetDefaultObjectSizeHeight(INT32 nNew) { nDefaultObjectSizeHeight = nNew; } + INT32 GetDefaultObjectSizeHeight() const { return nDefaultObjectSizeHeight; } + + void SetShowSharedDocumentWarning( BOOL bNew ) { mbShowSharedDocumentWarning = bNew; } + BOOL GetShowSharedDocumentWarning() const { return mbShowSharedDocumentWarning; } + + + const ScAppOptions& operator= ( const ScAppOptions& rOpt ); + +private: + FieldUnit eMetric; + USHORT nLRUFuncCount; + USHORT* pLRUList; + SvxZoomType eZoomType; + USHORT nZoom; + BOOL bSynchronizeZoom; + USHORT nStatusFunc; + BOOL bAutoComplete; + BOOL bDetectiveAuto; + sal_uInt32 nTrackContentColor; + sal_uInt32 nTrackInsertColor; + sal_uInt32 nTrackDeleteColor; + sal_uInt32 nTrackMoveColor; + ScLkUpdMode eLinkMode; + INT32 nDefaultObjectSizeWidth; + INT32 nDefaultObjectSizeHeight; + 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 + diff --git a/sc/inc/arealink.hxx b/sc/inc/arealink.hxx new file mode 100644 index 000000000000..46ce98709df1 --- /dev/null +++ b/sc/inc/arealink.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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; + BOOL bAddUndo; + BOOL bInCreate; + BOOL bDoInsert; // wird fuer das erste Update auf FALSE gesetzt + + 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, 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 ); + + BOOL Refresh( const String& rNewFile, const String& rNewFilter, + const String& rNewArea, ULONG nNewRefresh ); + + void SetInCreate(BOOL bSet) { bInCreate = bSet; } + void SetDoInsert(BOOL bSet) { bDoInsert = bSet; } + void SetDestArea(const ScRange& rNew); + void SetSource(const String& rDoc, const String& rFlt, const String& rOpt, + const String& rArea); + + 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 + diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx new file mode 100644 index 000000000000..11b21bab0162 --- /dev/null +++ b/sc/inc/attarray.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * 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 ScMarkArray; +class ScPatternAttr; +class ScStyleSheet; +class ScFlatBoolRowSegments; + +class Rectangle; +class SfxItemPoolCache; +class SfxStyleSheetBase; +class SvxBorderLine; +class SvxBoxItem; +class SvxBoxInfoItem; + +#define SC_LINE_EMPTY 0 +#define SC_LINE_SET 1 +#define SC_LINE_DONTCARE 2 + +#define SC_ATTRARRAY_DELTA 4 + +struct ScLineFlags +{ + BYTE nLeft; + BYTE nRight; + BYTE nTop; + BYTE nBottom; + BYTE nHori; + BYTE 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; // fuer FillInfo +friend class ScDocumentIterator; +friend class ScAttrIterator; +friend class ScHorizontalAttrIterator; +friend void lcl_IterGetNumberFormat( ULONG& nFormat, + const ScAttrArray*& rpArr, SCROW& nAttrEndRow, + const ScAttrArray* pNewArr, SCROW nRow, ScDocument* pDoc ); + + BOOL ApplyFrame( const SvxBoxItem* pLineOuter, const SvxBoxInfoItem* pLineInner, + SCROW nStartRow, SCROW nEndRow, + BOOL bLeft, SCCOL nDistRight, BOOL bTop, SCROW nDistBottom ); + +public: + ScAttrArray( SCCOL nNewCol, SCTAB nNewTab, ScDocument* pDoc ); + ~ScAttrArray(); + + void SetTab(SCTAB nNewTab) { nTab = nNewTab; } + void SetCol(SCCOL nNewCol) { nCol = nNewCol; } +#ifdef DBG_UTIL + void TestData() const; +#endif + void Reset( const ScPatternAttr* pPattern, BOOL bAlloc = TRUE ); + 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, 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 SetPattern( SCROW nRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE ); + void SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern, BOOL bPutToPool = FALSE); + void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle ); + void ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache ); + void ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow, + const SvxBorderLine* pLine, BOOL bColorOnly ); + + void ClearItems( SCROW nStartRow, SCROW nEndRow, const USHORT* pWhich ); + void ChangeIndent( SCROW nStartRow, SCROW nEndRow, BOOL bIncrement ); + + /// Including current, may return -1 + SCsROW GetNextUnprotected( SCsROW nRow, BOOL bUp ) const; + + /// May return -1 if not found + SCsROW SearchStyle( SCsROW nRow, const ScStyleSheet* pSearchStyle, + BOOL bUp, ScMarkArray* pMarkArray = NULL ); + BOOL SearchStyleRange( SCsROW& rRow, SCsROW& rEndRow, const ScStyleSheet* pSearchStyle, + BOOL bUp, ScMarkArray* pMarkArray = NULL ); + + BOOL ApplyFlags( SCROW nStartRow, SCROW nEndRow, INT16 nFlags ); + BOOL RemoveFlags( SCROW nStartRow, SCROW nEndRow, INT16 nFlags ); + + BOOL Search( SCROW nRow, SCSIZE& nIndex ) const; + + BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, + BOOL bLeft, BOOL bRight ) const; + bool HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const; + BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, + SCCOL& rPaintCol, SCROW& rPaintRow, + BOOL bRefresh, BOOL bAttrs ); + BOOL RemoveAreaMerge( SCROW nStartRow, SCROW nEndRow ); + + void FindStyleSheet( const SfxStyleSheetBase* pStyleSheet, ScFlatBoolRowSegments& rUsedRows, bool bReset ); + BOOL IsStyleSheetUsed( const ScStyleSheet& rStyle, BOOL bGatherAllStyles ) const; + + void DeleteAreaSafe(SCROW nStartRow, SCROW nEndRow); + void SetPatternAreaSafe( SCROW nStartRow, SCROW nEndRow, + const ScPatternAttr* pWantedPattern, BOOL bDefault ); + void CopyAreaSafe( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray ); + + BOOL IsEmpty() const; + +//UNUSED2008-05 SCROW GetFirstEntryPos() const; +//UNUSED2008-05 SCROW GetLastEntryPos( BOOL bIncludeBottom ) const; + + BOOL GetFirstVisibleAttr( SCROW& rFirstRow ) const; + BOOL GetLastVisibleAttr( SCROW& rLastRow, SCROW nLastData ) const; + BOOL HasVisibleAttrIn( SCROW nStartRow, SCROW nEndRow ) const; + BOOL IsVisibleEqual( const ScAttrArray& rOther, + SCROW nStartRow, SCROW nEndRow ) const; + BOOL IsAllEqual( const ScAttrArray& rOther, 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 ); + void DeleteArea( SCROW nStartRow, SCROW nEndRow ); + void MoveTo( SCROW nStartRow, SCROW nEndRow, ScAttrArray& rAttrArray ); + void CopyArea( SCROW nStartRow, SCROW nEndRow, long nDy, ScAttrArray& rAttrArray, + INT16 nStripFlags = 0 ); + + void DeleteHardAttr( SCROW nStartRow, SCROW nEndRow ); + +//UNUSED2008-05 void ConvertFontsAfterLoad(); // old binary file format +}; + + +// ------------------------------------------------------------------------------ +// Iterator fuer Attribute +// ------------------------------------------------------------------------------ + +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 + + diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx new file mode 100644 index 000000000000..96a0529c48a1 --- /dev/null +++ b/sc/inc/attrib.hxx @@ -0,0 +1,402 @@ +/************************************************************************* + * + * 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 fuer durch Merge verdeckte Zellen + // und Control fuer 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; +class SvxBorderLine; + +BOOL SC_DLLPUBLIC ScHasPriority( const SvxBorderLine* pThis, const 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, USHORT nVer ) const; + + SCsCOL GetColMerge() const {return nColMerge; } + SCsROW GetRowMerge() const {return nRowMerge; } + + 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(INT16 nFlags); + ~ScMergeFlagAttr(); + + BOOL IsHorOverlapped() const { return ( GetValue() & SC_MF_HOR ) != 0; } + BOOL IsVerOverlapped() const { return ( GetValue() & SC_MF_VER ) != 0; } + BOOL IsOverlapped() const { return ( GetValue() & ( SC_MF_HOR | SC_MF_VER ) ) != 0; } + + BOOL HasAutoFilter() const { return ( GetValue() & SC_MF_AUTO ) != 0; } + BOOL HasButton() const { return ( GetValue() & SC_MF_BUTTON ) != 0; } + bool HasDPTable() const { return ( GetValue() & SC_MF_DP_TABLE ) != 0; } + + BOOL IsScenario() const { return ( GetValue() & SC_MF_SCENARIO ) != 0; } +}; + +//------------------------------------------------------------------------ +class SC_DLLPUBLIC ScProtectionAttr: public SfxPoolItem +{ + BOOL bProtection; // Zelle schuetzen + BOOL bHideFormula; // Formel nicht Anzeigen + BOOL bHideCell; // Zelle nicht Anzeigen + BOOL bHidePrint; // Zelle nicht Ausdrucken +public: + TYPEINFO(); + ScProtectionAttr(); + ScProtectionAttr( BOOL bProtect, + BOOL bHFormula = FALSE, + BOOL bHCell = FALSE, + 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, USHORT nVer ) const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ); + + BOOL GetProtection() const { return bProtection; } + BOOL SetProtection( BOOL bProtect); + BOOL GetHideFormula() const { return bHideFormula; } + BOOL SetHideFormula( BOOL bHFormula); + BOOL GetHideCell() const { return bHideCell; } + BOOL SetHideCell( BOOL bHCell); + BOOL GetHidePrint() const { return bHidePrint; } + BOOL SetHidePrint( BOOL bHPrint); + inline ScProtectionAttr& operator=(const ScProtectionAttr& rProtection) + { + bProtection = rProtection.bProtection; + bHideFormula = rProtection.bHideFormula; + bHideCell = rProtection.bHideCell; + bHidePrint = rProtection.bHidePrint; + return *this; + } +}; + + +//---------------------------------------------------------------------------- +// ScRangeItem: verwaltet einen Tabellenbereich + +#define SCR_INVALID 0x01 +#define SCR_ALLTABS 0x02 +#define SCR_TONEWTAB 0x04 + +class ScRangeItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + inline ScRangeItem( const USHORT nWhich ); + inline ScRangeItem( const USHORT nWhich, + const ScRange& rRange, + const USHORT nNewFlags = 0 ); + inline ScRangeItem( const ScRangeItem& rCpy ); + + inline ScRangeItem& operator=( const ScRangeItem &rCpy ); + + // "pure virtual Methoden" vom 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; } + + USHORT GetFlags() const { return nFlags; } + void SetFlags( USHORT nNew ) { nFlags = nNew; } + +private: + ScRange aRange; + USHORT nFlags; +}; + +inline ScRangeItem::ScRangeItem( const USHORT nWhichP ) + : SfxPoolItem( nWhichP ), nFlags( SCR_INVALID ) // == ungueltige Area +{ +} + +inline ScRangeItem::ScRangeItem( const USHORT nWhichP, + const ScRange& rRange, + const USHORT 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: verwaltet eine Liste von Tabellen +//---------------------------------------------------------------------------- +class ScTableListItem : public SfxPoolItem +{ +public: + TYPEINFO(); + + inline ScTableListItem( const USHORT nWhich ); + ScTableListItem( const ScTableListItem& rCpy ); +//UNUSED2008-05 ScTableListItem( const USHORT nWhich, const List& rList ); + ~ScTableListItem(); + + ScTableListItem& operator=( const ScTableListItem &rCpy ); + + // "pure virtual Methoden" vom 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; + +//UNUSED2009-05 BOOL GetTableList( List& aList ) const; +//UNUSED2009-05 void SetTableList( const List& aList ); + +public: + USHORT nCount; + SCTAB* pTabArr; +}; + +inline ScTableListItem::ScTableListItem( const USHORT nWhichP ) + : SfxPoolItem(nWhichP), nCount(0), pTabArr(NULL) +{} + +//---------------------------------------------------------------------------- +// Seitenformat-Item: Kopf-/Fusszeileninhalte + +#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( USHORT 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, USHORT nVer ) const; + + virtual BOOL QueryValue( com::sun::star::uno::Any& rVal, BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const com::sun::star::uno::Any& rVal, BYTE 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 mit Uebereignung der Pointer, nArea siehe defines oben + void SetArea( EditTextObject *pNew, int nArea ); +}; + + +//---------------------------------------------------------------------------- +// Seitenformat-Item: Kopf-/Fusszeileninhalte + +class SC_DLLPUBLIC ScViewObjectModeItem: public SfxEnumItem +{ +public: + TYPEINFO(); + + ScViewObjectModeItem( USHORT nWhich ); + ScViewObjectModeItem( USHORT nWhich, ScVObjMode eMode ); + ~ScViewObjectModeItem(); + + virtual USHORT GetValueCount() const; + virtual String GetValueText( USHORT nVal ) const; + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + virtual SfxPoolItem* Create(SvStream &, USHORT) const; + virtual USHORT GetVersion( USHORT 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( USHORT 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, USHORT 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 BYTE SC_MID_PAGE_SCALETO_WIDTH = 1; +/** Member ID for "page scale to height" value in QueryValue() and PutValue(). */ +const BYTE 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, BYTE nMemberId = 0 ) const; + virtual BOOL PutValue( const ::com::sun::star::uno::Any& rAny, BYTE nMemberId = 0 ); + +private: + sal_uInt16 mnWidth; + sal_uInt16 mnHeight; +}; + +// ============================================================================ + +#endif + diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx new file mode 100644 index 000000000000..094f618fbc7c --- /dev/null +++ b/sc/inc/autoform.hxx @@ -0,0 +1,282 @@ +/************************************************************************* + * + * 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 <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() ); } + + BOOL Load( SvStream& rStream, const ScAfVersions& rVersions, USHORT nVer ); + BOOL Save( SvStream& rStream ); + +#ifdef READ_OLDVERS + BOOL LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); +#endif +}; + + +class SC_DLLPUBLIC ScAutoFormatData : public ScDataObject +{ +private: + String aName; + USHORT nStrResId; + // common flags of Calc and Writer + BOOL bIncludeFont : 1; + BOOL bIncludeJustify : 1; + BOOL bIncludeFrame : 1; + BOOL bIncludeBackground : 1; + + // Calc specific flags + BOOL bIncludeValueFormat : 1; + BOOL bIncludeWidthHeight : 1; + + ScAutoFormatDataField** ppDataField; + + SC_DLLPRIVATE ScAutoFormatDataField& GetField( USHORT nIndex ); + SC_DLLPRIVATE const ScAutoFormatDataField& GetField( USHORT 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; } + + BOOL GetIncludeValueFormat() const { return bIncludeValueFormat; } + BOOL GetIncludeFont() const { return bIncludeFont; } + BOOL GetIncludeJustify() const { return bIncludeJustify; } + BOOL GetIncludeFrame() const { return bIncludeFrame; } + BOOL GetIncludeBackground() const { return bIncludeBackground; } + BOOL GetIncludeWidthHeight() const { return bIncludeWidthHeight; } + + void SetIncludeValueFormat( BOOL bValueFormat ) { bIncludeValueFormat = bValueFormat; } + void SetIncludeFont( BOOL bFont ) { bIncludeFont = bFont; } + void SetIncludeJustify( BOOL bJustify ) { bIncludeJustify = bJustify; } + void SetIncludeFrame( BOOL bFrame ) { bIncludeFrame = bFrame; } + void SetIncludeBackground( BOOL bBackground ) { bIncludeBackground = bBackground; } + void SetIncludeWidthHeight( BOOL bWidthHeight ) { bIncludeWidthHeight = bWidthHeight; } + + const SfxPoolItem* GetItem( USHORT nIndex, USHORT nWhich ) const; + void PutItem( USHORT nIndex, const SfxPoolItem& rItem ); + void CopyItem( USHORT nToIndex, USHORT nFromIndex, USHORT nWhich ); + + const ScNumFormatAbbrev& GetNumFormat( USHORT nIndex ) const; + + BOOL IsEqualData( USHORT nIndex1, USHORT nIndex2 ) const; + + void FillToItemSet( USHORT nIndex, SfxItemSet& rItemSet, ScDocument& rDoc ) const; + void GetFromItemSet( USHORT nIndex, const SfxItemSet& rItemSet, const ScNumFormatAbbrev& rNumFormat ); + + BOOL Load( SvStream& rStream, const ScAfVersions& rVersions ); + BOOL Save( SvStream& rStream ); + +#ifdef READ_OLDVERS + BOOL LoadOld( SvStream& rStream, const ScAfVersions& rVersions ); +#endif +}; + +class SC_DLLPUBLIC ScAutoFormat : public ScSortedCollection +{ +private: + BOOL bSaveLater; + +public: + ScAutoFormat( USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE ); + ScAutoFormat( const ScAutoFormat& AutoFormat ); + virtual ~ScAutoFormat(); + virtual ScDataObject* Clone() const { return new ScAutoFormat( *this ); } + ScAutoFormatData* operator[]( const USHORT nIndex ) const {return (ScAutoFormatData*)At( nIndex );} + virtual short Compare( ScDataObject* pKey1, ScDataObject* pKey2 ) const; + BOOL Load(); + BOOL Save(); + USHORT FindIndexPerName( const String& rName ) const; + void SetSaveLater( BOOL bSet ); + BOOL IsSaveLater() const { return bSaveLater; } +}; + + +#endif diff --git a/sc/inc/autonamecache.hxx b/sc/inc/autonamecache.hxx new file mode 100644 index 000000000000..0eb1b51efe29 --- /dev/null +++ b/sc/inc/autonamecache.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 <hash_map> +#include "address.hxx" +#include "global.hxx" + +typedef ::std::vector< ScAddress > ScAutoNameAddresses; +typedef ::std::hash_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& GetNameOccurences( const String& rName, SCTAB nTab ); +}; + +#endif + diff --git a/sc/inc/bigrange.hxx b/sc/inc/bigrange.hxx new file mode 100644 index 000000000000..d5a066d522cc --- /dev/null +++ b/sc/inc/bigrange.hxx @@ -0,0 +1,273 @@ +/************************************************************************* + * + * 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 INT32 nInt32Min = 0x80000000; +static const INT32 nInt32Max = 0x7fffffff; + + +class ScBigAddress +{ + INT32 nRow; + INT32 nCol; + INT32 nTab; + +public: + ScBigAddress() : nRow(0), nCol(0), nTab(0) {} + ScBigAddress( INT32 nColP, INT32 nRowP, 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() ) {} + + INT32 Col() const { return nCol; } + INT32 Row() const { return nRow; } + INT32 Tab() const { return nTab; } + + void Set( INT32 nColP, INT32 nRowP, INT32 nTabP ) + { nCol = nColP; nRow = nRowP; nTab = nTabP; } + void SetCol( INT32 nColP ) { nCol = nColP; } + void SetRow( INT32 nRowP ) { nRow = nRowP; } + void SetTab( INT32 nTabP ) { nTab = nTabP; } + void IncCol( INT32 n = 1 ) { nCol += n; } + void IncRow( INT32 n = 1 ) { nRow += n; } + void IncTab( INT32 n = 1 ) { nTab += n; } + + void GetVars( INT32& nColP, INT32& nRowP, INT32& nTabP ) const + { nColP = nCol; nRowP = nRow; nTabP = nTab; } + + inline void PutInOrder( ScBigAddress& r ); + inline 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 ) +{ + 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 BOOL ScBigAddress::IsValid( const ScDocument* pDoc ) const +{ //! Min/Max sind ok, kennzeichnen ganze 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( INT32 nCol, INT32 nRow, INT32 nTab ) + : aStart( nCol, nRow, nTab ), aEnd( aStart ) {} + ScBigRange( INT32 nCol1, INT32 nRow1, INT32 nTab1, + INT32 nCol2, INT32 nRow2, INT32 nTab2 ) + : aStart( nCol1, nRow1, nTab1 ), + aEnd( nCol2, nRow2, nTab2 ) {} + + void Set( INT32 nCol1, INT32 nRow1, INT32 nTab1, + INT32 nCol2, INT32 nRow2, INT32 nTab2 ) + { aStart.Set( nCol1, nRow1, nTab1 ); + aEnd.Set( nCol2, nRow2, nTab2 ); } + + void GetVars( INT32& nCol1, INT32& nRow1, INT32& nTab1, + INT32& nCol2, INT32& nRow2, INT32& nTab2 ) const + { aStart.GetVars( nCol1, nRow1, nTab1 ); + aEnd.GetVars( nCol2, nRow2, nTab2 ); } + + BOOL IsValid( const ScDocument* pDoc ) const + { return aStart.IsValid( pDoc ) && aEnd.IsValid( pDoc ); } + inline ScRange MakeRange() const + { return ScRange( aStart.MakeAddress(), + aEnd.MakeAddress() ); } + + inline BOOL In( const ScBigAddress& ) const; // ist Address& in Range? + inline BOOL In( const ScBigRange& ) const; // ist Range& in Range? + inline BOOL Intersects( const ScBigRange& ) const; // ueberschneiden sich zwei Ranges? + + 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 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 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 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 diff --git a/sc/inc/brdcst.hxx b/sc/inc/brdcst.hxx new file mode 100644 index 000000000000..cdba4e3a78bb --- /dev/null +++ b/sc/inc/brdcst.hxx @@ -0,0 +1,70 @@ +/************************************************************************* + * + * 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( 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 diff --git a/sc/inc/callform.hxx b/sc/inc/callform.hxx new file mode 100644 index 000000000000..1e78f0a951be --- /dev/null +++ b/sc/inc/callform.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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" + +//------------------------------------------------------------------------ +#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; + USHORT nNumber; + USHORT nParamCount; + ParamType eAsyncType; + ParamType eParamType[MAXFUNCPARAM]; +private: + FuncData(const String& rIName); +public: + FuncData(const ModuleData*pModule, + const String& rIName, + const String& rFName, + USHORT nNo, + USHORT 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; } + USHORT GetParamCount() const { return nParamCount; } + ParamType GetParamType(USHORT nIndex) const { return eParamType[nIndex]; } + ParamType GetReturnType() const { return eParamType[0]; } + ParamType GetAsyncType() const { return eAsyncType; } + BOOL Call(void** ppParam); + BOOL Unadvice(double nHandle); + + // Name und Beschreibung des Parameters nParam. + // nParam==0 => Desc := Funktions-Beschreibung, + // Name := n/a + BOOL GetParamDesc( String& aName, String& aDesc, USHORT nParam ); +}; + + +//------------------------------------------------------------------------ +class FuncCollection : public ScSortedCollection +{ +public: + FuncCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE) : ScSortedCollection ( nLim, nDel, bDup ) {} + FuncCollection(const FuncCollection& rFuncCollection) : ScSortedCollection ( rFuncCollection ) {} + + virtual ScDataObject* Clone() const { return new FuncCollection(*this); } + FuncData* operator[]( const USHORT nIndex) const {return (FuncData*)At(nIndex);} + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; + BOOL SearchFunc( const String& rName, USHORT& rIndex ) const; +}; + + +BOOL InitExternalFunc(const rtl::OUString& rModuleName); +void ExitExternalFunc(); + +#endif diff --git a/sc/inc/cell.hxx b/sc/inc/cell.hxx new file mode 100644 index 000000000000..ad9ed02a0415 --- /dev/null +++ b/sc/inc/cell.hxx @@ -0,0 +1,506 @@ +/************************************************************************* + * + * 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 <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; + +// ============================================================================ + +/** 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(); // nicht virtuell -> darf nicht direkt aufgerufen werden + +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; + +// fuer Idle-Berechnung + inline USHORT GetTextWidth() const { return nTextWidth; } + inline void SetTextWidth( USHORT nNew ) { nTextWidth = nNew; } + + inline BYTE GetScriptType() const { return nScriptType; } + inline void SetScriptType( BYTE 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. */ + USHORT GetErrorCode() const; + /** ScFormulaCell with formula::svEmptyCell result, or ScNoteCell (may have been + created due to reference to empty cell). */ + BOOL HasEmptyData() const; + BOOL HasValueData() const; + BOOL HasStringData() const; + String GetStringData() const; // nur echte Strings + + static 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: + USHORT nTextWidth; + BYTE eCellType; // enum CellType - BYTE spart Speicher + BYTE 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; // fuer schnelleren Zugriff von Formeln + ScDocument* pDoc; // fuer EditEngine Zugriff mit Pool + + void SetTextObject( const EditTextObject* pObject, + const SfxItemPool* pFromPool ); + + // not implemented + ScEditCell( const ScEditCell& ); + +public: + +#ifdef USE_MEMPOOL + DECL_FIXEDMEMPOOL_NEWDEL( ScEditCell ) +#endif + + ~ScEditCell(); // wegen pData immer! + + ScEditCell( const EditTextObject* pObject, ScDocument*, + const SfxItemPool* pFromPool /* = NULL */ ); + ScEditCell( const ScEditCell& rCell, ScDocument& rDoc ); + // fuer Zeilenumbrueche + 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; } +}; + +// ============================================================================ + +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; + ULONG nFormatIndex; // Number format set by calculation + short nFormatType; // Number format type set by calculation + USHORT nSeenInIteration; // Iteration cycle in which the cell was last encountered + BYTE cMatrixFlag; // One of ScMatrixMode + BOOL bDirty : 1; // Must be (re)calculated + BOOL bChanged : 1; // Whether something changed regarding display/representation + BOOL bRunning : 1; // Already interpreting right now + BOOL bCompile : 1; // Must be (re)compiled + BOOL bSubTotal : 1; // Cell is part of or contains a SubTotal + BOOL bIsIterCell : 1; // Cell is part of a circular reference + BOOL bInChangeTrack : 1; // Cell is in ChangeTrack + BOOL bTableOpDirty : 1; // Dirty flag for TableOp + 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, + BYTE = 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, + BYTE 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(); + inline void SetDirtyVar() { bDirty = TRUE; } + // If setting entire document dirty after load, no broadcasts but still append to FormulaTree. + void SetDirtyAfterLoad(); + inline void ResetTableOpDirtyVar() { bTableOpDirty = FALSE; } + void SetTableOpDirty(); + BOOL IsDirtyOrInTableOpDirty() const; + BOOL GetDirty() const { return bDirty; } + BOOL NeedsListening() const { return bNeedListening; } + void SetNeedsListening( BOOL bVar ) { bNeedListening = bVar; } + void Compile(const String& rFormula, + BOOL bNoListening = FALSE, + const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT ); + void CompileTokenArray( BOOL bNoListening = FALSE ); + void CompileXML( ScProgress& rProgress ); // compile temporary string tokens + void CalcAfterLoad(); + bool MarkUsedExternalReferences(); + void Interpret(); + inline BOOL IsIterCell() const { return bIsIterCell; } + inline USHORT GetSeenInIteration() const { return nSeenInIteration; } + + 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; + BOOL HasRelNameReference() const; + BOOL HasColRowName() const; + + void 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); + BOOL UpdateDeleteTab(SCTAB nTable, BOOL bIsMove = FALSE); + void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo); + void UpdateRenameTab(SCTAB nTable, const String& rName); + BOOL TestTabRefAbs(SCTAB nTable); + void UpdateCompile( BOOL bForceIfNameInUse = FALSE ); + BOOL IsRangeNameInUse(USHORT nIndex) const; + void FindRangeNamesInUse(std::set<USHORT>& rIndexes) const; + void ReplaceRangeNamesInUse( const ScRangeData::IndexMap& rMap ); + BOOL IsSubTotal() const { return bSubTotal; } + BOOL IsChanged() const { return bChanged; } + void ResetChanged() { bChanged = FALSE; } + BOOL IsEmpty(); // formula::svEmptyCell result + // display as empty string if formula::svEmptyCell result + BOOL IsEmptyDisplayedAsString(); + BOOL IsValue(); // also TRUE if formula::svEmptyCell + double GetValue(); + double GetValueAlways(); // ignore errors + void GetString( String& rString ); + const ScMatrix* GetMatrix(); + BOOL GetMatrixOrigin( ScAddress& rPos ) const; + void GetResultDimensions( SCSIZE& rCols, SCSIZE& rRows ); + USHORT GetMatrixEdge( ScAddress& rOrgPos ); + USHORT GetErrCode(); // interpret first if necessary + USHORT GetRawError(); // don't interpret, just return code or result error + short GetFormatType() const { return nFormatType; } + ULONG GetFormatIndex() const { return nFormatIndex; } + void GetFormatInfo( short& nType, ULONG& nIndex ) const + { nType = nFormatType; nIndex = nFormatIndex; } + BYTE GetMatrixFlag() const { return cMatrixFlag; } + ScTokenArray* GetCode() const { return pCode; } + + BOOL IsRunning() const { return bRunning; } + void SetRunning( BOOL bVal ) { bRunning = bVal; } + void CompileDBFormula(); + void CompileDBFormula( BOOL bCreateFormulaString ); + void CompileNameFormula( 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( BOOL bVal ) { bCompile = bVal; } + ScDocument* GetDocument() const { return pDocument; } + void SetMatColsRows( SCCOL nCols, SCROW nRows ); + void GetMatColsRows( SCCOL& nCols, SCROW& nRows ) const; + + // ob Zelle im ChangeTrack und nicht im echten Dokument ist + void SetInChangeTrack( BOOL bVal ) { bInChangeTrack = bVal; } + BOOL IsInChangeTrack() const { return bInChangeTrack; } + + // Zu Typ und Format das entsprechende Standardformat. + // Bei Format "Standard" evtl. das in die Formelzelle + // uebernommene Format. + ULONG GetStandardFormat( SvNumberFormatter& rFormatter, 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( USHORT n ); + inline 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(); +}; + +// Iterator fuer Referenzen in einer Formelzelle +class ScDetectiveRefIter +{ +private: + ScTokenArray* pCode; + ScAddress aPos; +public: + ScDetectiveRefIter( ScFormulaCell* pCell ); + BOOL GetNextRef( ScRange& rRange ); +}; + +// ============================================================================ + +#endif + diff --git a/sc/inc/cellform.hxx b/sc/inc/cellform.hxx new file mode 100644 index 000000000000..b0b445a5993d --- /dev/null +++ b/sc/inc/cellform.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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, // Zahlen als Zahlen + ftForce, // Zahlen als Text + ftCheck // ist das Zahlenformat ein Textformat? +}; + +//------------------------------------------------------------------------ + +class SC_DLLPUBLIC ScCellFormat +{ +public: + static void GetString( ScBaseCell* pCell, ULONG nFormat, String& rString, + Color** ppColor, SvNumberFormatter& rFormatter, + BOOL bNullVals = TRUE, + BOOL bFormula = FALSE, + ScForceTextFmt eForceTextFmt = ftDontForce ); + + static void GetInputString( ScBaseCell* pCell, ULONG nFormat, String& rString, + SvNumberFormatter& rFormatter ); +}; + + + + +#endif + diff --git a/sc/inc/cellsuno.hxx b/sc/inc/cellsuno.hxx new file mode 100644 index 000000000000..a53f167b164a --- /dev/null +++ b/sc/inc/cellsuno.hxx @@ -0,0 +1,1569 @@ +/************************************************************************* + * + * 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 SvxBorderLine; +class SvxBoxItem; +class SvxBoxInfoItem; +class SvxItemPropertySet; + +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 - Basisklasse fuer ScCellRangesObj (mit Index-Access) +// und ScCellRangeObj (ohne Index-Access) + +// XServiceInfo ist in den Ableitungen implementiert + +class ScHelperFunctions +{ +public: + static const SvxBorderLine* GetBorderLine( 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 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; // fuer select() + friend class ScTableSheetObj; // fuer 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; + BOOL bChartColAsHdr; + BOOL bChartRowAsHdr; + BOOL bCursorOnly; + BOOL bGotDataChangedHint; + XModifyListenerArr_Impl aValueListeners; + + DECL_LINK( ValueListenerHdl, SfxHint* ); + +private: + void PaintRanges_Impl( USHORT 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); + const ScMarkData* GetMarkData(); + void ForgetMarkData(); + void ForgetCurrentAttrs(); + + com::sun::star::uno::Reference<com::sun::star::sheet::XSheetCellRanges> + QueryDifferences_Impl(const com::sun::star::table::CellAddress& aCompare, + 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: + // GetItemPropertyMap for derived classes must contain all entries, including base class + virtual const SfxItemPropertyMap* GetItemPropertyMap(); + virtual ::com::sun::star::beans::PropertyState GetOnePropertyState( + USHORT 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(); // fuer SMART_REFLECTION Krempel + 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(); + + // aus Ableitungen, aber auch per getImplementation + ScDocShell* GetDocShell() const { return pDocShell; } + ScDocument* GetDocument() const; + const ScRangeList& GetRangeList() const { return aRanges; } + void AddRange(const ScRange& rRange, const sal_Bool bMergeRanges); + + // per Service erzeugtes Objekt zum Leben erwecken: + void InitInsertRange(ScDocShell* pDocSh, const ScRange& rR); + + void SetNewRange(const ScRange& rNew); // fuer Cursor + void SetNewRanges(const ScRangeList& rNew); + + void SetCursorOnly(BOOL bSet); + 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); + + // XCellRange ist Basisklasse von XSheetCellRange und XSheetOperation +// operator XCellRangeRef() const { return (XSheetCellRange*)this; } + + // 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 ueberladen wegen 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 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(BOOL bEnglish) const; + String GetOutputString_Impl() const; + void SetString_Impl(const String& rString, BOOL bInterpret, 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; } + + // 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 ueberladen wegen Zell-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; // fuer 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 ueberladen wegen 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 ueberladen wegen Spalten-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 ueberladen wegen Zeilen-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; + 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; + BOOL bAtEnd; + 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 + diff --git a/sc/inc/cfgids.hxx b/sc/inc/cfgids.hxx new file mode 100644 index 000000000000..4b07ddd0682f --- /dev/null +++ b/sc/inc/cfgids.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/chart2uno.hxx b/sc/inc/chart2uno.hxx new file mode 100644 index 000000000000..44737e711090 --- /dev/null +++ b/sc/inc/chart2uno.hxx @@ -0,0 +1,698 @@ +/************************************************************************* + * + * 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> +// #ifndef _COM_SUN_STAR_LANG_XUNOTUNNEL_HPP_ +// #include <com/sun/star/lang/XUnoTunnel.hpp> +// #endif +#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 <hash_set> +#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); + +/* virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier > SAL_CALL getNumberFormatsSupplier() + 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; + +}; + + +// LabeledDataSequence ======================================================= + +class ScChart2LabeledDataSequence : public + ::cppu::WeakImplHelper4< + ::com::sun::star::chart2::data::XLabeledDataSequence, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::lang::XServiceInfo >, + SfxListener +{ +public: + + explicit ScChart2LabeledDataSequence( ScDocument* pDoc ); + virtual ~ScChart2LabeledDataSequence(); + + // SfxListener ----------------------------------------------------------- + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // XLabeledDataSequence -------------------------------------------------- + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getValues() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setValues( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getLabel() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLabel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence ) + 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); + + // 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: + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > m_aData; + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > m_aLabel; + ScDocument* m_pDocument; +}; + +// 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<ScSharedTokenRef>* 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); + + // 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 ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference< +// com::sun::star::uno::XInterface> xObj ); + +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 ::std::hash_set<sal_uInt16>& getAllFileIds(); + + private: + ExternalRefListener(); + ExternalRefListener(const ExternalRefListener& r); + + ScChart2DataSequence& mrParent; + ::std::hash_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 ScSharedTokenRef& 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<ScSharedTokenRef> > 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); + + // 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 ScChart2DataSequence* getImplementation( const com::sun::star::uno::Reference< +// com::sun::star::uno::XInterface> xObj ); + + // 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 diff --git a/sc/inc/chartarr.hxx b/sc/inc/chartarr.hxx new file mode 100644 index 000000000000..62f30a17c62e --- /dev/null +++ b/sc/inc/chartarr.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * 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 // nur noch Parameter-Struct +{ + String aName; + ScDocument* pDocument; + ScChartPositioner aPositioner; + BOOL bValid; // fuer Erzeugung aus 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(BOOL bCol, BOOL bRow) { aPositioner.SetHeaders(bCol, bRow); } + BOOL HasColHeaders() const { return aPositioner.HasColHeaders(); } + BOOL HasRowHeaders() const { return aPositioner.HasRowHeaders(); } + BOOL IsValid() const { return bValid; } + void SetName(const String& rNew) { aName = rNew; } + const String& GetName() const { return aName; } + + 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[](USHORT nIndex) const + { return (ScChartArray*)At(nIndex); } + + BOOL operator==(const ScChartCollection& rCmp) const; +}; + + + +#endif + diff --git a/sc/inc/charthelper.hxx b/sc/inc/charthelper.hxx new file mode 100644 index 000000000000..50b8586bdace --- /dev/null +++ b/sc/inc/charthelper.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 <com/sun/star/chart2/XChartDocument.hpp> + +class SdrObject; + +/** Use this to handle charts in a calc document +*/ +class ScChartHelper +{ +public: + static USHORT DoUpdateAllCharts( ScDocument* pDoc ); + static USHORT DoUpdateCharts( const ScAddress& rPos, ScDocument* pDoc ); //use this to replace ScDBFunc::DoUpdateCharts in future + 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 ); +}; + +#endif diff --git a/sc/inc/chartlis.hxx b/sc/inc/chartlis.hxx new file mode 100644 index 000000000000..26831970d5b7 --- /dev/null +++ b/sc/inc/chartlis.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * 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 <hash_set> + +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); + ::std::hash_set<sal_uInt16>& getAllFileIds(); + + private: + ExternalRefListener(); + ExternalRefListener(const ExternalRefListener& r); + + ScChartListener& mrParent; + ::std::hash_set<sal_uInt16> maFileIds; + ScDocument* mpDoc; + }; + +private: + + ::std::auto_ptr<ExternalRefListener> mpExtRefListener; + ::std::auto_ptr< ::std::vector<ScSharedTokenRef> > mpTokens; + + ScChartUnoData* pUnoData; + ScDocument* pDoc; + BOOL bUsed; // fuer ScChartListenerCollection::FreeUnused + BOOL bDirty; + 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<ScSharedTokenRef>* 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; + + BOOL IsUno() const { return (pUnoData != NULL); } + + virtual void Notify( SvtBroadcaster& rBC, const SfxHint& rHint ); + void StartListeningTo(); + void EndListeningTo(); + void ChangeListening( const ScRangeListRef& rRangeListRef, + BOOL bDirty = FALSE ); + void Update(); + ScRangeListRef GetRangeList() const; + void SetRangeList( const ScRangeListRef& rNew ); + void SetRangeList( const ScRange& rNew ); + BOOL IsUsed() const { return bUsed; } + void SetUsed( BOOL bFlg ) { bUsed = bFlg; } + BOOL IsDirty() const { return bDirty; } + void SetDirty( 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 = TRUE; } + void UpdateScheduledSeriesRanges(); + void UpdateSeriesRanges(); + + ExternalRefListener* GetExtRefListener(); + void SetUpdateQueue(); + + BOOL operator==( const ScChartListener& ); + 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(); + + // nur nach copy-ctor noetig, wenn neu ins Dok gehaengt + void StartAllListeners(); + + void ChangeListening( const String& rName, + const ScRangeListRef& rRangeListRef, + BOOL bDirty = FALSE ); + // FreeUnused nur wie in ScDocument::UpdateChartListenerCollection verwenden! + 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&, + BOOL bSetChartRangeLists = FALSE ); + + void SetRangeDirty( const ScRange& rRange ); // z.B. Zeilen/Spalten + + void UpdateScheduledSeriesRanges(); + void UpdateChartsContainingTab( SCTAB nTab ); + + 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 + diff --git a/sc/inc/chartlock.hxx b/sc/inc/chartlock.hxx new file mode 100644 index 000000000000..16f0fdd2cf4c --- /dev/null +++ b/sc/inc/chartlock.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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 diff --git a/sc/inc/chartpos.hxx b/sc/inc/chartpos.hxx new file mode 100644 index 000000000000..84ffd2e877e2 --- /dev/null +++ b/sc/inc/chartpos.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * 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; + ULONG nCount; + SCCOL nColCount; + SCROW nRowCount; + + ScChartPositionMap( SCCOL nChartCols, SCROW nChartRows, + SCCOL nColAdd, // Header-Spalten + SCROW nRowAdd, // Header-Zeilen + Table& rCols // Table mit Col-Tables mit Address* + ); + ~ScChartPositionMap(); //! deletes all ScAddress* + + // not implemented + ScChartPositionMap( const ScChartPositionMap& ); + ScChartPositionMap& operator=( const ScChartPositionMap& ); + +public: + + ULONG GetCount() const { return nCount; } + SCCOL GetColCount() const { return nColCount; } + SCROW GetRowCount() const { return nRowCount; } + + BOOL IsValid( SCCOL nCol, SCROW nRow ) const + { return nCol < nColCount && nRow < nRowCount; } + // Daten spaltenweise + ULONG GetIndex( SCCOL nCol, SCROW nRow ) const + { return (ULONG) nCol * nRowCount + nRow; } + + const ScAddress* GetPosition( ULONG nIndex ) const + { + if ( nIndex < nCount ) + return ppData[ nIndex ]; + return NULL; + } + + //! kann NULL sein und damit "kein Wert" + 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; + } +//UNUSED2009-05 ScRangeListRef GetColRanges( SCCOL nChartCol ) const; +//UNUSED2009-05 ScRangeListRef GetRowRanges( SCROW nChartRow ) const; +}; + + +enum ScChartGlue { + SC_CHARTGLUE_NA, + SC_CHARTGLUE_NONE, // alte Mimik + SC_CHARTGLUE_COLS, // alte Mimik + SC_CHARTGLUE_ROWS, + SC_CHARTGLUE_BOTH +}; + +class ScDocument; + +class ScChartPositioner // nur noch Parameter-Struct +{ + ScRangeListRef aRangeListRef; + ScDocument* pDocument; + ScChartPositionMap* pPositionMap; + ScChartGlue eGlue; + SCCOL nStartCol; + SCROW nStartRow; + BOOL bColHeaders; + BOOL bRowHeaders; + BOOL bDummyUpperLeft; + +private: + void CheckColRowHeaders(); + + void GlueState(); // zusammengefasste Bereiche + 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(BOOL bCol, BOOL bRow) { bColHeaders=bCol; bRowHeaders=bRow; } + BOOL HasColHeaders() const { return bColHeaders; } + BOOL HasRowHeaders() const { return bRowHeaders; } + void SetDummyUpperLeft(BOOL bNew) { bDummyUpperLeft = bNew; } + void SeteGlue(ScChartGlue eNew) { eGlue = eNew; } + void SetStartCol(SCCOL nNew) { nStartCol = nNew; } + void SetStartRow(SCROW nNew) { nStartRow = nNew; } + + BOOL operator==(const ScChartPositioner& rCmp) const; + + void InvalidateGlue() + { + eGlue = SC_CHARTGLUE_NA; + if ( pPositionMap ) + { + delete pPositionMap; + pPositionMap = NULL; + } + } + const ScChartPositionMap* GetPositionMap(); +}; + + +#endif + diff --git a/sc/inc/chartuno.hxx b/sc/inc/chartuno.hxx new file mode 100644 index 000000000000..fe261f26e517 --- /dev/null +++ b/sc/inc/chartuno.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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 sind pro 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 sind pro 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 + diff --git a/sc/inc/chgtrack.hxx b/sc/inc/chgtrack.hxx new file mode 100644 index 000000000000..6cf3d59314ef --- /dev/null +++ b/sc/inc/chgtrack.hxx @@ -0,0 +1,1370 @@ +/************************************************************************* + * + * 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 + +#define DEBUG_CHANGETRACK 0 + + +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 --------------------------------------------- + +// Fuegt sich selbst am Beginn einer Kette ein, bzw. vor einem anderen +// LinkEntry, on delete selbstaendiges ausklinken auch des gelinkten. +// ppPrev == &previous->pNext oder Adresse des Pointers auf Beginn der Kette, +// *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; } +#if DEBUG_CHANGETRACK + String ToString() const; +#endif // DEBUG_CHANGETRACK +}; + +// --- 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; // wer war's + String aComment; // Benutzerkommentar + ScChangeAction* pNext; // naechster in Kette + ScChangeAction* pPrev; // vorheriger in Kette + ScChangeActionLinkEntry* pLinkAny; // irgendwelche Links + ScChangeActionLinkEntry* pLinkDeletedIn; // Zuordnung zu + // geloeschten oder + // druebergemoveten oder + // rejecteten Insert + // Bereichen + ScChangeActionLinkEntry* pLinkDeleted; // Links zu geloeschten + ScChangeActionLinkEntry* pLinkDependent; // Links zu abhaengigen + ULONG nAction; + ULONG nRejectAction; + ScChangeActionType eType; + ScChangeActionState eState; + + + ScChangeAction( ScChangeActionType, + const ScRange& ); + + // only to be used in the XML import + ScChangeAction( ScChangeActionType, + const ScBigRange&, + const ULONG nAction, + const 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 ULONG nAction); + + virtual ~ScChangeAction(); + + String GetRefString( const ScBigRange&, + ScDocument*, BOOL bFlag3D = FALSE ) const; + + void SetActionNumber( ULONG n ) { nAction = n; } + void SetRejectAction( 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 ); + } + 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&, + INT32 nDx, INT32 nDy, INT32 nDz ); + + void Accept(); + virtual BOOL Reject( ScDocument* ) = 0; + void RejectRestoreContents( ScChangeTrack*, + SCsCOL nDx, SCsROW nDy ); + + // used in Reject() instead of IsRejectable() + BOOL IsInternalRejectable() const; + + // Derived classes that hold a pointer to the + // ChangeTrack must return that. Otherwise NULL. + virtual const ScChangeTrack* GetChangeTrack() const = 0; + +public: + + BOOL IsInsertType() const + { + return eType == SC_CAT_INSERT_COLS || + eType == SC_CAT_INSERT_ROWS || + eType == SC_CAT_INSERT_TABS; + } + BOOL IsDeleteType() const + { + return eType == SC_CAT_DELETE_COLS || + eType == SC_CAT_DELETE_ROWS || + eType == SC_CAT_DELETE_TABS; + } + BOOL IsVirgin() const + { return eState == SC_CAS_VIRGIN; } + BOOL IsAccepted() const + { return eState == SC_CAS_ACCEPTED; } + BOOL IsRejected() const + { return eState == SC_CAS_REJECTED; } + + // Action rejects another Action + BOOL IsRejecting() const + { return nRejectAction != 0; } + + // ob Action im Dokument sichtbar ist + BOOL IsVisible() const; + + // ob Action anfassbar ist + BOOL IsTouchable() const; + + // ob Action ein Eintrag in Dialog-Root ist + BOOL IsDialogRoot() const; + + // ob ein Eintrag im Dialog aufklappbar sein soll + BOOL IsDialogParent() const; + + // ob Action ein Delete ist, unter dem + // aufgeklappt mehrere einzelne Deletes sind + BOOL IsMasterDelete() const; + + // ob Action akzeptiert/selektiert/abgelehnt + // werden kann + BOOL IsClickable() const; + + // ob Action abgelehnt werden kann + 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; } + ULONG GetActionNumber() const { return nAction; } + ULONG GetRejectAction() const { return nRejectAction; } + + ScChangeAction* GetNext() const { return pNext; } + ScChangeAction* GetPrev() const { return pPrev; } + + BOOL IsDeletedIn() const + { return GetDeletedIn() != NULL; } + BOOL IsDeleted() const + { return IsDeleteType() || IsDeletedIn(); } + BOOL IsDeletedIn( const ScChangeAction* ) const; + BOOL IsDeletedInDelType( ScChangeActionType ) const; + void RemoveAllDeletedIn(); + + const ScChangeActionLinkEntry* GetFirstDeletedEntry() const + { return pLinkDeleted; } + const ScChangeActionLinkEntry* GetFirstDependentEntry() const + { return pLinkDependent; } + BOOL HasDependent() const + { return pLinkDependent != NULL; } + BOOL HasDeleted() const + { return pLinkDeleted != NULL; } + + // Description wird an String angehaengt. + // Mit bSplitRange wird bei Delete nur + // eine Spalte/Zeile beruecksichtigt (fuer + // Auflistung der einzelnen Eintraege). + virtual void GetDescription( String&, ScDocument*, + BOOL bSplitRange = FALSE, bool bWarning = true ) const; + + virtual void GetRefString( String&, ScDocument*, + BOOL bFlag3D = FALSE ) const; + + // fuer DocumentMerge altes Datum einer anderen + // Action setzen, mit GetDateTimeUTC geholt + void SetDateTimeUTC( const DateTime& rDT ) + { aDateTime = rDT; } + + // Benutzerkommentar setzen + void SetComment( const String& rStr ) + { aComment = rStr; } + + // only to be used in the XML import + void SetDeletedInThis( ULONG nActionNumber, + const ScChangeTrack* pTrack ); + // only to be used in the XML import + void AddDependent( ULONG nActionNumber, + const ScChangeTrack* pTrack ); +#if DEBUG_CHANGETRACK + String ToString( ScDocument* pDoc ) const; +#endif // DEBUG_CHANGETRACK +}; + + +// --- ScChangeActionIns ---------------------------------------------------- + +class ScChangeActionIns : public ScChangeAction +{ + friend class ScChangeTrack; + + ScChangeActionIns( const ScRange& rRange ); + virtual ~ScChangeActionIns(); + + virtual void AddContent( ScChangeActionContent* ) {} + virtual void DeleteCellEntries() {} + + virtual BOOL Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return 0; } + +public: + ScChangeActionIns(const ULONG nActionNumber, + const ScChangeActionState eState, + const 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*, + 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; // abgeschnittener 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&, + INT32 nDx, INT32 nDy, INT32 nDz ); + + virtual BOOL Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } + +public: + ScChangeActionDel(const ULONG nActionNumber, + const ScChangeActionState eState, + const 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 + // wich of nDx and nDy is set is depend on the type + + // ob dieses das unterste einer Reihe (oder + // auch einzeln) ist + BOOL IsBaseDelete() const; + + // ob dieses das oberste einer Reihe (oder + // auch einzeln) ist + BOOL IsTopDelete() const; + + // ob dieses ein Teil einer Reihe ist + BOOL IsMultiDelete() const; + + // ob es eine Col ist, die zu einem TabDelete gehoert + 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*, + 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; + ULONG nStartLastCut; // fuer PasteCut Undo + 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( ULONG nVal ) { nStartLastCut = nVal; } + ULONG GetStartLastCut() const { return nStartLastCut; } + void SetEndLastCut( ULONG nVal ) { nEndLastCut = nVal; } + ULONG GetEndLastCut() const { return nEndLastCut; } + + virtual void UpdateReference( const ScChangeTrack*, + UpdateRefMode, const ScBigRange&, + INT32 nDx, INT32 nDy, INT32 nDz ); + + virtual BOOL Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return pTrack; } + +protected: + using ScChangeAction::GetRefString; + +public: + ScChangeActionMove(const ULONG nActionNumber, + const ScChangeActionState eState, + const 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( INT32& nDx, INT32& nDy, INT32& nDz ) const; + + virtual void GetDescription( String&, ScDocument*, + BOOL bSplitRange = FALSE, bool bWarning = true ) const; + + virtual void GetRefString( String&, ScDocument*, + 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; // an gleicher Position + ScChangeActionContent* pPrevContent; + ScChangeActionContent* pNextInSlot; // in gleichem 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, + 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, + ULONG nFormat, + const ScBaseCell* pOrgCell, + const ScDocument* pFromDoc, + ScDocument* pToDoc ); + + static void SetCell( String& rStr, ScBaseCell* pCell, + ULONG nFormat, const ScDocument* pDoc ); + + static 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&, + INT32 nDx, INT32 nDy, INT32 nDz ); + + virtual BOOL Reject( ScDocument* ); + + virtual const ScChangeTrack* GetChangeTrack() const { return 0; } + + // pRejectActions!=NULL: reject actions get + // stacked, no SetNewValue, no Append + BOOL Select( ScDocument*, ScChangeTrack*, + 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 ULONG nActionNumber, + const ScChangeActionState eState, + const 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 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; + 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, + 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, + ULONG nOldFormat, ScBaseCell* pNewCell, + 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; } + + // moeglichst nicht verwenden, + // setzt nur String bzw. generiert Formelzelle + 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*, + BOOL bSplitRange = FALSE, bool bWarning = true ) const; + virtual void GetRefString( String&, ScDocument*, + BOOL bFlag3D = FALSE ) const; + + static ScChangeActionContentCellType GetContentCellType( const ScBaseCell* ); + + // NewCell + BOOL IsMatrixOrigin() const + { + return GetContentCellType( GetNewCell() ) + == SC_CACCT_MATORG; + } + BOOL IsMatrixReference() const + { + return GetContentCellType( GetNewCell() ) + == SC_CACCT_MATREF; + } + // OldCell + BOOL IsOldMatrixOrigin() const + { + return GetContentCellType( GetOldCell() ) + == SC_CACCT_MATORG; + } + BOOL IsOldMatrixReference() const + { + return GetContentCellType( GetOldCell() ) + == SC_CACCT_MATREF; + } + +}; + + +// --- ScChangeActionReject ------------------------------------------------- + +class Stack; + +class ScChangeActionReject : public ScChangeAction +{ + friend class ScChangeTrack; + friend class ScChangeActionContent; + + ScChangeActionReject( ULONG nReject ) + : ScChangeAction( SC_CAT_REJECT, ScRange() ) + { + SetRejectAction( nReject ); + SetState( SC_CAS_ACCEPTED ); + } + + virtual void AddContent( ScChangeActionContent* ) {} + virtual void DeleteCellEntries() {} + + virtual BOOL Reject( ScDocument* ) { return FALSE; } + + virtual const ScChangeTrack* GetChangeTrack() const { return 0; } + +public: + ScChangeActionReject(const ULONG nActionNumber, + const ScChangeActionState eState, + const 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 angehaengt + SC_CTM_REMOVE, // Actions weggenommen + SC_CTM_CHANGE, // Actions geaendert + SC_CTM_PARENT // war kein Parent und ist jetzt einer +}; + +struct ScChangeTrackMsgInfo +{ + DECL_FIXEDMEMPOOL_NEWDEL( ScChangeTrackMsgInfo ) + + ScChangeTrackMsgType eMsgType; + ULONG nStartAction; + ULONG nEndAction; +}; + +// MsgQueue fuer Benachrichtigung 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 +}; + +// zusaetzlich zu pFirst/pNext/pLast/pPrev eine Table, um schnell sowohl +// per ActionNumber als auch ueber Liste zugreifen zu koennen +DECLARE_TABLE( ScChangeActionTable, ScChangeAction* ) + +// Intern generierte Actions beginnen bei diesem Wert (fast alle Bits gesetzt) +// und werden runtergezaehlt, um sich in einer Table wertemaessig nicht mit den +// "normalen" Actions in die Quere zu kommen. +#define SC_CHGTRACK_GENERATED_START ((UINT32) 0xfffffff0) + +class ScChangeTrack : public utl::ConfigurationListener +{ + friend void ScChangeAction::RejectRestoreContents( ScChangeTrack*, SCsCOL, SCsROW ); + friend BOOL ScChangeActionDel::Reject( ScDocument* pDoc ); + friend void ScChangeActionDel::DeleteCellEntries(); + friend void ScChangeActionMove::DeleteCellEntries(); + friend 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; + ULONG nActionMax; + ULONG nGeneratedMin; + ULONG nMarkLastSaved; + ULONG nStartLastCut; + ULONG nEndLastCut; + ULONG nLastMerge; + ScChangeTrackMergeState eMergeState; + USHORT nLoadedFileFormatVersion; + BOOL bLoadSave; + BOOL bInDelete; + BOOL bInDeleteUndo; + BOOL bInDeleteTop; + BOOL bInPasteCut; + BOOL bUseFixDateTime; + BOOL bTime100thSeconds; + + // not implemented, prevent usage + ScChangeTrack( const ScChangeTrack& ); + ScChangeTrack& operator=( const ScChangeTrack& ); + +#ifdef SC_CHGTRACK_CXX + static SCROW InitContentRowsPerSlot(); + + // TRUE if one is MM_FORMULA and the other is + // not, or if both are and range differs + static BOOL IsMatrixFormulaRangeDifferent( + const ScBaseCell* pOldCell, + const ScBaseCell* pNewCell ); + + void Init(); + void DtorClear(); + void SetLoadSave( BOOL bVal ) { bLoadSave = bVal; } + void SetInDeleteRange( const ScRange& rRange ) + { aInDeleteRange = rRange; } + void SetInDelete( BOOL bVal ) + { bInDelete = bVal; } + void SetInDeleteTop( BOOL bVal ) + { bInDeleteTop = bVal; } + void SetInDeleteUndo( BOOL bVal ) + { bInDeleteUndo = bVal; } + void SetInPasteCut( BOOL bVal ) + { bInPasteCut = bVal; } + void SetMergeState( ScChangeTrackMergeState eState ) + { eMergeState = eState; } + ScChangeTrackMergeState GetMergeState() const { return eMergeState; } + void SetLastMerge( ULONG nVal ) { nLastMerge = nVal; } + ULONG GetLastMerge() const { return nLastMerge; } + + void SetLastCutMoveRange( const ScRange&, ScDocument* ); + + // ModifyMsg blockweise und nicht einzeln erzeugen + void StartBlockModify( ScChangeTrackMsgType, + ULONG nStartAction ); + void EndBlockModify( ULONG nEndAction ); + + void AddDependentWithNotify( ScChangeAction* pParent, + ScChangeAction* pDependent ); + + void Dependencies( ScChangeAction* ); + void UpdateReference( ScChangeAction*, BOOL bUndo ); + void UpdateReference( ScChangeAction** ppFirstAction, + ScChangeAction* pAct, BOOL bUndo ); + void Append( ScChangeAction* pAppend, ULONG nAction ); + SC_DLLPUBLIC void AppendDeleteRange( const ScRange&, + ScDocument* pRefDoc, SCsTAB nDz, + ULONG nRejectingInsert ); + void AppendOneDeleteRange( const ScRange& rOrgRange, + ScDocument* pRefDoc, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + 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 ); + + // Action und alle abhaengigen rejecten, + // Table stammt aus vorherigem GetDependents, + // ist nur bei Insert und Move (MasterType) + // noetig, kann ansonsten NULL sein. + // bRecursion == Aufruf aus Reject mit Table + BOOL Reject( ScChangeAction*, + ScChangeActionTable*, BOOL bRecursion ); + +#endif // SC_CHGTRACK_CXX + + void ClearMsgQueue(); + virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ); + +public: + + static SCSIZE ComputeContentSlot( 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; } + ULONG GetActionMax() const { return nActionMax; } + BOOL IsGenerated( ULONG nAction ) const + { return nAction >= nGeneratedMin; } + ScChangeAction* GetAction( ULONG nAction ) const + { return aTable.Get( nAction ); } + ScChangeAction* GetGenerated( ULONG nGenerated ) const + { return aGeneratedTable.Get( nGenerated ); } + ScChangeAction* GetActionOrGenerated( ULONG nAction ) const + { + return IsGenerated( nAction ) ? + GetGenerated( nAction ) : + GetAction( nAction ); + } + ULONG GetLastSavedActionNumber() const + { return nMarkLastSaved; } + void SetLastSavedActionNumber(ULONG nNew) + { nMarkLastSaved = nNew; } + ScChangeAction* GetLastSaved() const + { return aTable.Get( nMarkLastSaved ); } + ScChangeActionContent** GetContentSlots() const { return ppContentSlots; } + + BOOL IsLoadSave() const { return bLoadSave; } + const ScRange& GetInDeleteRange() const + { return aInDeleteRange; } + BOOL IsInDelete() const { return bInDelete; } + BOOL IsInDeleteTop() const { return bInDeleteTop; } + BOOL IsInDeleteUndo() const { return bInDeleteUndo; } + 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( 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, + ULONG& nStartAction, ULONG& nEndAction, + SCsTAB nDz = 0 ); + // nDz: Multi-TabDel, LookUpContent ist + // um -nDz verschoben zu suchen + + // nachdem neuer Wert im Dokument gesetzt wurde, + // alter Wert aus RefDoc/UndoDoc + void AppendContent( const ScAddress& rPos, + ScDocument* pRefDoc ); + // nachdem neue Werte im Dokument gesetzt wurden, + // alte Werte aus RefDoc/UndoDoc + void AppendContentRange( const ScRange& rRange, + ScDocument* pRefDoc, + ULONG& nStartAction, ULONG& nEndAction, + ScChangeActionClipMode eMode = SC_CACM_NONE ); + // nachdem neuer Wert im Dokument gesetzt wurde, + // alter Wert aus pOldCell, nOldFormat, + // RefDoc==NULL => Doc + void AppendContent( const ScAddress& rPos, + const ScBaseCell* pOldCell, + ULONG nOldFormat, ScDocument* pRefDoc = NULL ); + // nachdem neuer Wert im Dokument gesetzt wurde, + // alter Wert aus pOldCell, Format aus Doc + void AppendContent( const ScAddress& rPos, + const ScBaseCell* pOldCell ); + // nachdem neue Werte im Dokument gesetzt wurden, + // alte Werte aus RefDoc/UndoDoc. + // Alle Contents, wo im RefDoc eine Zelle steht. + void AppendContentsIfInRefDoc( ScDocument* pRefDoc, + ULONG& nStartAction, 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, + ULONG nOldFormat = 0, + ULONG nNewFormat = 0 ); + + // die folgenden beiden nur benutzen wenn's + // nicht anders geht (setzen nur String fuer + // NewValue bzw. Formelerzeugung) + + // bevor neuer Wert im Dokument gesetzt wird + void AppendContent( const ScAddress& rPos, + const String& rNewValue, + ScBaseCell* pOldCell ); + + 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; + } + } + BOOL HasLastCut() const + { + return nEndLastCut > 0 && + nStartLastCut <= nEndLastCut && + pLastCutMove; + } + + SC_DLLPUBLIC void Undo( ULONG nStartAction, ULONG nEndAction, bool bMerge = false ); + + // fuer MergeDocument, Referenzen anpassen, + //! darf nur in einem temporaer geoeffneten + //! Dokument verwendet werden, der Track + //! ist danach verhunzt + void MergePrepare( ScChangeAction* pFirstMerge, bool bShared = false ); + void MergeOwn( ScChangeAction* pAct, ULONG nFirstMerge, bool bShared = false ); + static BOOL MergeIgnore( const ScChangeAction&, ULONG nFirstMerge ); + + // Abhaengige in Table einfuegen. + // Bei Insert sind es echte Abhaengige, + // bei Move abhaengige Contents im FromRange + // und geloeschte im ToRange bzw. Inserts in + // FromRange oder ToRange, + // bei Delete eine Liste der geloeschten, + // bei Content andere Contents an gleicher + // Position oder MatrixReferences zu MatrixOrigin. + // Mit bListMasterDelete werden unter einem + // MasterDelete alle zu diesem Delete gehoerenden + // Deletes einer Reihe gelistet. + // Mit bAllFlat werden auch alle Abhaengigen + // der Abhaengigen flach eingefuegt. + SC_DLLPUBLIC void GetDependents( ScChangeAction*, + ScChangeActionTable&, + BOOL bListMasterDelete = FALSE, + BOOL bAllFlat = FALSE ) const; + + // Reject visible Action (und abhaengige) + BOOL Reject( ScChangeAction*, bool bShared = false ); + + // Accept visible Action (und abhaengige) + SC_DLLPUBLIC BOOL Accept( ScChangeAction* ); + + void AcceptAll(); // alle Virgins + BOOL RejectAll(); // alle Virgins + + // Selektiert einen Content von mehreren an + // gleicher Position und akzeptiert diesen und + // die aelteren, rejected die neueren. + // Mit bOldest==TRUE wird der erste OldValue + // einer Virgin-Content-Kette restauriert. + BOOL SelectContent( ScChangeAction*, + BOOL bOldest = FALSE ); + + // wenn ModifiedLink gesetzt, landen + // Aenderungen in ScChangeTrackMsgQueue + void SetModifiedLink( const Link& r ) + { aModifiedLink = r; ClearMsgQueue(); } + const Link& GetModifiedLink() const { return aModifiedLink; } + ScChangeTrackMsgQueue& GetMsgQueue() { return aMsgQueue; } + + void NotifyModified( ScChangeTrackMsgType eMsgType, + ULONG nStartAction, ULONG nEndAction ); + + USHORT GetLoadedFileFormatVersion() const + { return nLoadedFileFormatVersion; } + + 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(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; } + 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( BOOL bVal ) + { bTime100thSeconds = bVal; } + BOOL IsTime100thSeconds() const + { return bTime100thSeconds; } + + void AppendCloned( ScChangeAction* pAppend ); + SC_DLLPUBLIC ScChangeTrack* Clone( ScDocument* pDocument ) const; + void MergeActionState( ScChangeAction* pAct, const ScChangeAction* pOtherAct ); +#if DEBUG_CHANGETRACK + String ToString() const; +#endif // DEBUG_CHANGETRACK +}; + + +#endif + + diff --git a/sc/inc/chgviset.hxx b/sc/inc/chgviset.hxx new file mode 100644 index 000000000000..ddc0dcc14243 --- /dev/null +++ b/sc/inc/chgviset.hxx @@ -0,0 +1,149 @@ +/************************************************************************* + * + * 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; + BOOL bShowIt; + BOOL bIsDate; + BOOL bIsAuthor; + BOOL bIsComment; + BOOL bIsRange; + BOOL bEveryoneButMe; + BOOL bShowAccepted; + BOOL bShowRejected; + bool mbIsActionRange; + ULONG mnFirstAction; + 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(); + + BOOL ShowChanges() const {return bShowIt;} + void SetShowChanges(BOOL nFlag=TRUE){bShowIt=nFlag;} + + BOOL HasDate() const {return bIsDate;} + void SetHasDate(BOOL nFlag=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;} + + + BOOL HasAuthor() const {return bIsAuthor;} + void SetHasAuthor(BOOL nFlag=TRUE) {bIsAuthor=nFlag;} + + String GetTheAuthorToShow()const {return aAuthorToShow;} + void SetTheAuthorToShow(const String& aString){aAuthorToShow=aString;} + + BOOL HasComment() const {return bIsComment;} + void SetHasComment(BOOL nFlag=TRUE) {bIsComment=nFlag;} + + String GetTheComment()const {return aComment;} + void SetTheComment(const String& aString); + + BOOL IsValidComment(const String* pCommentStr) const; + + BOOL IsEveryoneButMe() const {return bEveryoneButMe;} + void SetEveryoneButMe(BOOL nFlag=TRUE) {bEveryoneButMe=nFlag;} + + + BOOL HasRange() const {return bIsRange;} + void SetHasRange(BOOL nFlag=TRUE) {bIsRange=nFlag;} + + const ScRangeList& GetTheRangeList()const {return aRangeList;} + void SetTheRangeList(const ScRangeList& aRl){aRangeList=aRl;} + + BOOL IsShowAccepted() const { return bShowAccepted; } + void SetShowAccepted( BOOL bVal ) { bShowAccepted = bVal; } + + BOOL IsShowRejected() const { return bShowRejected; } + void SetShowRejected( 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( ULONG& nFirst, ULONG& nLast ) const { nFirst = mnFirstAction; nLast = mnLastAction; } + void SetTheActionRange( ULONG nFirst, ULONG nLast ) { mnFirstAction = nFirst; mnLastAction = nLast; } +}; + + + +#endif + diff --git a/sc/inc/clipparam.hxx b/sc/inc/clipparam.hxx new file mode 100644 index 000000000000..78b5474229d1 --- /dev/null +++ b/sc/inc/clipparam.hxx @@ -0,0 +1,88 @@ +/************************************************************************* + * + * 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 <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; + + 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(); +}; + +// ============================================================================ + +struct ScClipRangeNameData +{ + ScRangeData::IndexMap maRangeMap; + ::std::vector<ScRangeData*> mpRangeNames; + bool mbReplace; + + ScClipRangeNameData(); + ~ScClipRangeNameData(); + void insert(sal_uInt16 nOldIndex, sal_uInt16 nNewIndex); +}; + +#endif diff --git a/sc/inc/collect.hxx b/sc/inc/collect.hxx new file mode 100644 index 000000000000..167ab5929c6a --- /dev/null +++ b/sc/inc/collect.hxx @@ -0,0 +1,204 @@ +/************************************************************************* + * + * 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: + USHORT nCount; + USHORT nLimit; + USHORT nDelta; + ScDataObject** pItems; +public: + ScCollection(USHORT nLim = 4, USHORT nDel = 4); + ScCollection(const ScCollection& rCollection); + virtual ~ScCollection(); + + virtual ScDataObject* Clone() const; + + void AtFree(USHORT nIndex); + void Free(ScDataObject* pScDataObject); + void FreeAll(); + + BOOL AtInsert(USHORT nIndex, ScDataObject* pScDataObject); + virtual BOOL Insert(ScDataObject* pScDataObject); + + ScDataObject* At(USHORT nIndex) const; + virtual USHORT IndexOf(ScDataObject* pScDataObject) const; + USHORT GetCount() const; + + ScDataObject* operator[]( const USHORT nIndex) const {return At(nIndex);} + ScCollection& operator=( const ScCollection& rCol ); +}; + + +class SC_DLLPUBLIC ScSortedCollection : public ScCollection +{ +private: + BOOL bDuplicates; +protected: + // fuer ScStrCollection Load/Store + void SetDups( BOOL bVal ) { bDuplicates = bVal; } + BOOL IsDups() const { return bDuplicates; } +public: + ScSortedCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE); + ScSortedCollection(const ScSortedCollection& rScSortedCollection) : + ScCollection(rScSortedCollection), + bDuplicates(rScSortedCollection.bDuplicates) {} + + virtual USHORT IndexOf(ScDataObject* pScDataObject) const; + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const = 0; + virtual BOOL IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; + BOOL Search(ScDataObject* pScDataObject, USHORT& rIndex) const; + virtual BOOL Insert(ScDataObject* pScDataObject); + virtual BOOL InsertPos(ScDataObject* pScDataObject, USHORT& nIndex); + + 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 nur, wenn StrData nicht in ScStrCollection ist! !!! + // z.B. fuer Searcher + void SetString( const String& rNew ) { aStr = rNew; } +}; + +//------------------------------------------------------------------------ + +class SvStream; + +class SC_DLLPUBLIC ScStrCollection : public ScSortedCollection +{ +public: + ScStrCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE) : + ScSortedCollection ( nLim, nDel, bDup ) {} + ScStrCollection(const ScStrCollection& rScStrCollection) : + ScSortedCollection ( rScStrCollection ) {} + + virtual ScDataObject* Clone() const; + StrData* operator[]( const USHORT 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, + USHORT nType = SC_STRTYPE_STANDARD ) + : aStrValue(rStr), + nValue(nVal), + nStrType(nType) {} + +//UNUSED2008-05 TypedStrData( ScDocument* pDoc, SCCOL nCol, SCROW nRow, SCTAB nTab, +//UNUSED2008-05 BOOL bAllStrings ); + + TypedStrData( const TypedStrData& rCpy ) + : ScDataObject(), + aStrValue(rCpy.aStrValue), + nValue(rCpy.nValue), + nStrType(rCpy.nStrType) {} + + virtual ScDataObject* Clone() const; + + 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; + USHORT nStrType; // 0 = Value +}; + +class SC_DLLPUBLIC TypedScStrCollection : public ScSortedCollection +{ +private: + BOOL bCaseSensitive; + +public: + TypedScStrCollection( USHORT nLim = 4, USHORT nDel = 4, 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 USHORT nIndex) const; + + void SetCaseSensitive( BOOL bSet ); + + BOOL FindText( const String& rStart, String& rResult, USHORT& rPos, BOOL bBack ) const; + BOOL GetExactMatch( String& rString ) const; +}; + +#endif diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx new file mode 100644 index 000000000000..af6292bbd830 --- /dev/null +++ b/sc/inc/column.hxx @@ -0,0 +1,443 @@ +/************************************************************************* + * + * 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 <tools/solar.h> + +#include <set> + +class Fraction; +class OutputDevice; +class Rectangle; +class SfxBroadcaster; +class SfxItemPoolCache; +class SfxItemSet; +class SvtListener; +class SfxPoolItem; +class SfxStyleSheetBase; +class SvxBorderLine; +class SvxBoxInfoItem; +class SvxBoxItem; + +class ScAttrIterator; +class ScAttrArray; +class ScBaseCell; +class ScDocument; +class ScFormulaCell; +class ScMarkData; +class ScPatternAttr; +class ScStyleSheet; +class SvtBroadcaster; +class TypedScStrCollection; +class ScProgress; +class ScPostIt; +struct ScFunctionData; +struct ScLineFlags; +struct ScMergePatternState; +class ScFlatBoolRowSegments; + +#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; // fuer 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; // fuer Import: Groesse beim Allozieren verdoppeln + +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, ULONG 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); + +//UNUSED2009-05 BOOL HasLines( SCROW nRow1, SCROW nRow2, Rectangle& rSizes, +//UNUSED2009-05 BOOL bLeft, BOOL bRight ) const; + bool HasAttrib( SCROW nRow1, SCROW nRow2, USHORT nMask ) const; + BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const; + BOOL ExtendMerge( SCCOL nThisCol, SCROW nStartRow, SCROW nEndRow, + SCCOL& rPaintCol, SCROW& rPaintRow, + BOOL bRefresh, BOOL bAttrs ); + + BOOL IsEmptyVisData(BOOL bNotes) const; // ohne Broadcaster + BOOL IsEmptyData() const; + BOOL IsEmptyAttr() const; + BOOL IsEmpty() const; + + // nur Daten: + 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; // ohne Broadcaster + SCROW GetFirstVisDataPos(BOOL bNotes) const; + BOOL GetPrevDataPos(SCROW& rRow) const; + BOOL GetNextDataPos(SCROW& rRow) const; + void FindDataAreaPos(SCROW& rRow, long nMovY) const; // (ohne Broadcaster) + void FindUsed( SCROW nStartRow, SCROW nEndRow, BOOL* pUsed ) const; + + SCSIZE VisibleCount( SCROW nStartRow, SCROW nEndRow ) const; + + USHORT GetBlockMatrixEdges( SCROW nRow1, SCROW nRow2, USHORT 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, USHORT nDelFlag ); + void DeleteArea(SCROW nStartRow, SCROW nEndRow, USHORT nDelFlag ); + void CopyToClip(SCROW nRow1, SCROW nRow2, ScColumn& rColumn, BOOL bKeepScenarioFlags, BOOL bCloneNoteCaptions); + void CopyFromClip(SCROW nRow1, SCROW nRow2, long nDy, + USHORT 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 ); + + // Markierung von diesem Dokument + void MixMarked( const ScMarkData& rMark, USHORT nFunction, + BOOL bSkipEmpty, ScColumn& rSrcCol ); + void MixData( SCROW nRow1, SCROW nRow2, USHORT nFunction, BOOL bSkipEmpty, + ScColumn& rSrcCol ); + + ScFormulaCell* CreateRefCell( ScDocument* pDestDoc, const ScAddress& rDestPos, + SCSIZE nIndex, USHORT nFlags ) const; + + ScAttrIterator* CreateAttrIterator( SCROW nStartRow, SCROW nEndRow ) const; + + SCCOL GetCol() const { return nCol; } + + // UpdateSelectionFunction: Mehrfachselektion + 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, USHORT nFlags, BOOL bMarked, + ScColumn& rColumn, const ScMarkData* pMarkData = NULL, + BOOL bAsLink = FALSE ); + void UndoToColumn(SCROW nRow1, SCROW nRow2, USHORT 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 = Zahlformat gesetzt + BOOL SetString( SCROW nRow, SCTAB nTab, const String& rString, + formula::FormulaGrammar::AddressConvention conv = formula::FormulaGrammar::CONV_OOO, + SvNumberFormatter* pFormatter = NULL, + bool bDetectNumberFormat = true ); + void SetValue( SCROW nRow, const double& rVal); + void SetError( SCROW nRow, const USHORT 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, + BOOL bAsciiExport = FALSE ) const; + CellType GetCellType( SCROW nRow ) const; + SCSIZE GetCellCount() const { return nCount; } + ULONG GetWeightedCount() const; + ULONG GetCodeCount() const; // RPN-Code in Formeln + USHORT GetErrCode( SCROW nRow ) const; + + BOOL HasStringData( SCROW nRow ) const; + BOOL HasValueData( SCROW nRow ) const; +//UNUSED2009-05 USHORT GetErrorData( 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 ); + + 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 ); + 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, USHORT nIndex) const; + void FindRangeNamesInUse(SCROW nRow1, SCROW nRow2, std::set<USHORT>& rIndexes) const; + void ReplaceRangeNamesInUse( SCROW nRow1, SCROW nRow2, const ScRangeData::IndexMap& rMap ); + + const SfxPoolItem* GetAttr( SCROW nRow, USHORT nWhich ) const; + const ScPatternAttr* GetPattern( SCROW nRow ) const; + const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const; + + ULONG GetNumberFormat( SCROW nRow ) 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 ); + 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 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, INT16 nFlags ); + BOOL RemoveFlags( SCROW nStartRow, SCROW nEndRow, INT16 nFlags ); + void ClearItems( SCROW nStartRow, SCROW nEndRow, const USHORT* pWhich ); + + void RemoveProtected( SCROW nStartRow, SCROW nEndRow ); + + SCsROW ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark ); + void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark ); + + void ClearSelectionItems( const USHORT* 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 ); + USHORT GetOptimalColWidth( OutputDevice* pDev, double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + BOOL bFormula, USHORT nOldWidth, + const ScMarkData* pMarkData, + BOOL bSimpleTextImport ); + void GetOptimalHeight( SCROW nStartRow, SCROW nEndRow, USHORT* pHeight, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + BOOL bShrink, USHORT 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); + +//UNUSED2008-05 SCROW NoteCount( SCROW nMaxRow = MAXROW ) const; + + 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, USHORT nFlags, ScDocument& rDestDoc, const ScAddress& rDestPos); +//UNUSED2008-05 void CorrectSymbolCells( CharSet eStreamCharSet ); +}; + + +class ScColumnIterator // alle Daten eines Bereichs durchgehen +{ + 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 // Daten in selektierten Bereichen durchgehen +{ + 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 + + diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx new file mode 100644 index 000000000000..7d045db3c2aa --- /dev/null +++ b/sc/inc/compiler.hxx @@ -0,0 +1,539 @@ +/************************************************************************* + * + * 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/intruref.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> + + +#ifndef BOOST_SHARED_PTR_HPP_INCLUDED +#include <boost/shared_ptr.hpp> +#endif + +#ifndef INCLUDED_HASH_MAP +#include <hash_map> +#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 + +#if 0 +/* + OpCode eOp; // OpCode + formula::StackVar eType; // type of data + USHORT nRefCnt; // reference count + BOOL bRaw; // not cloned yet and trimmed to real size + */ +#endif + +#define SC_TOKEN_FIX_MEMBERS \ + OpCode eOp; \ + formula::StackVar eType; \ + USHORT nRefCnt; \ + BOOL bRaw; + +struct ScDoubleRawToken +{ +private: + SC_TOKEN_FIX_MEMBERS +public: + union + { // union only to assure alignment identical to ScRawToken + double nValue; + struct { + BYTE 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 USHORT lcl_ScRawTokenOffset(); +private: + SC_TOKEN_FIX_MEMBERS +public: + union { + double nValue; + struct { + BYTE 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; + ScMatrix* pMat; + USHORT nIndex; // index into name collection + sal_Unicode cStr[ MAXSTRLEN+1 ]; // string (up to 255 characters + 0) + short nJump[MAXJUMPCOUNT+1]; // If/Chose token + }; + + //! other members not initialized + ScRawToken() : bRaw( 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(); } + USHORT 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 ); +//UNUSED2008-05 void SetInt( int nVal ); +//UNUSED2008-05 void SetMatrix( ScMatrix* p ); + + // These methods are ok to use, reference count not cleared. +//UNUSED2008-05 ScComplexRefData& GetReference(); +//UNUSED2008-05 void SetReference( ScComplexRefData& rRef ); + void SetName( USHORT n ); + 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&, USHORT 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 ) ); } +}; + + +typedef formula::SimpleIntrusiveReference< struct 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; + const ULONG* mpCharTable; + + + Convention( formula::FormulaGrammar::AddressConvention eConvP ); + virtual ~Convention(); + + virtual void MakeRefStr( rtl::OUStringBuffer& rBuffer, + const ScCompiler& rCompiler, + const ScComplexRefData& rRef, + 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; + }; + 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 + USHORT 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 + + BOOL NextNewToken(bool bInArray = false); + + virtual void SetError(USHORT nError); + xub_StrLen NextSymbol(bool bInArray); + BOOL IsValue( const String& ); + BOOL IsOpCode( const String&, bool bInArray ); + BOOL IsOpCode2( const String& ); + BOOL IsString(); + BOOL IsReference( const String& ); + BOOL IsSingleReference( const String& ); + BOOL IsPredetectedReference( const String& ); + BOOL IsDoubleReference( const String& ); + BOOL IsMacro( const String& ); + BOOL IsNamedRange( const String& ); + bool IsExternalNamedRange( const String& rSymbol ); + BOOL IsDBRange( const String& ); + BOOL IsColRowName( const String& ); + 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 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( 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 ); + + void SetEncodeUrlMode( EncodeUrlMode eMode ); + 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; } + + 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 ); + + BOOL UpdateNameReference( UpdateRefMode eUpdateRefMode, + const ScRange&, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz, + BOOL& rChanged, 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, BOOL bIsName ); + ScRangeData* UpdateDeleteTab(SCTAB nTable, BOOL bIsMove, BOOL bIsName, BOOL& bCompile); + ScRangeData* UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, BOOL bIsName ); + + BOOL HasModifiedRange(); + + /** If the character is allowed as first character in sheet names or + references, includes '$' and '?'. */ + static inline BOOL IsCharWordChar( String const & rStr, + xub_StrLen nPos, + const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) + { + sal_Unicode c = rStr.GetChar( nPos ); + if (c < 128) + { + return pConventions[eConv] ? static_cast<BOOL>( + (pConventions[eConv]->mpCharTable[ UINT8(c) ] & 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 BOOL IsWordChar( String const & rStr, + xub_StrLen nPos, + const formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO ) + { + sal_Unicode c = rStr.GetChar( nPos ); + if (c < 128) + { + return pConventions[eConv] ? static_cast<BOOL>( + (pConventions[eConv]->mpCharTable[ UINT8(c) ] & 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 FALSE and + char>=128, no LetterNumeric test is done and FALSE is returned. */ + static inline bool IsCharFlagAllConventions( String const & rStr, + xub_StrLen nPos, + ULONG nFlags, + bool bTestLetterNumeric = true ) + { + sal_Unicode c = rStr.GetChar( nPos ); + if (c < 128) + { + for ( int nConv = formula::FormulaGrammar::CONV_UNSPECIFIED; + ++nConv < formula::FormulaGrammar::CONV_LAST; ) + { + if (pConventions[nConv] && + ((pConventions[nConv]->mpCharTable[ UINT8(c) ] & 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, 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 BOOL HandleExternalReference(const formula::FormulaToken& _aToken); + virtual BOOL HandleRange(); + virtual BOOL HandleSingleRef(); + virtual 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 BOOL IsImportingXML() const; + + /// Access the CharTable flags + inline ULONG GetCharTableFlags( sal_Unicode c ) + { return c < 128 ? pConv->mpCharTable[ UINT8(c) ] : 0; } +}; + +SC_DLLPUBLIC String GetScCompilerNativeSymbol( OpCode eOp ); //CHINA001 + +#endif diff --git a/sc/inc/compressedarray.hxx b/sc/inc/compressedarray.hxx new file mode 100644 index 000000000000..3b6f35366976 --- /dev/null +++ b/sc/inc/compressedarray.hxx @@ -0,0 +1,669 @@ +/************************************************************************* + * + * 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. USHORT or BYTE 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 value for a row, and it's region start row and end row */ + const D& GetValue( A nPos, size_t& nIndex, A& nStart, 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; + + /** Get previous value and it's region start row. If nIndex==0, nIndex is + not decremented and the value of the first entry is returned again. */ + const D& GetPrevValue( size_t& nIndex, A& nStart ) const; + + /** Return the last row where an entry meets the condition: + (aValue != rCompare). If no entry meets this condition + ::std::numeric_limits<A>::max() is returned. */ + A GetLastUnequalAccess( A nStart, const D& rCompare ); + + /** 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; + /** Get data entry for an index */ + const DataEntry& GetDataEntry( size_t nIndex ) 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>::GetValue( A nPos, size_t& nIndex, A& nStart, + A& nEnd ) const +{ + nIndex = Search( nPos); + nStart = (nIndex > 0 ? pData[nIndex-1].nEnd + 1 : 0); + 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 > +const D& ScCompressedArray<A,D>::GetPrevValue( size_t& nIndex, A& nStart ) const +{ + if (nIndex > 0) + --nIndex; + nStart = (nIndex > 0 ? pData[nIndex-1].nEnd + 1 : 0); + return pData[nIndex].aValue; +} + + +template< typename A, typename D > +size_t ScCompressedArray<A,D>::GetEntryCount() const +{ + return nCount; +} + + +template< typename A, typename D > +const typename ScCompressedArray<A,D>::DataEntry& +ScCompressedArray<A,D>::GetDataEntry( size_t nIndex ) const +{ + return pData[nIndex]; +} + + +// === 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); +} + + +// === ScSummableCompressedArray ============================================= + +/** Data type D must be of a type that is convertable to unsigned long. The + advantage is that specialized methods exist to act on a region of values + for performance reasons. + */ + +template< typename A, typename D > class ScSummableCompressedArray : public ScCompressedArray<A,D> +{ +public: + ScSummableCompressedArray( A nMaxAccessP, + const D& rValue, + size_t nDeltaP = nScCompressedArrayDelta ) + : ScCompressedArray<A,D>( nMaxAccessP, + rValue, nDeltaP) + {} + ScSummableCompressedArray( A nMaxAccessP, + const D* pDataArray, size_t nDataCount ) + : ScCompressedArray<A,D>( nMaxAccessP, + pDataArray, nDataCount) + {} + + /** Returns the sum of all values for a region. If an overflow would occur, + ::std::numeric_limits<unsigned long>::max() is returned. */ + unsigned long SumValues( A nStart, A nEnd ) const; + + /** Returns the sum of all values for a region. If an overflow would occur, + ::std::numeric_limits<unsigned long>::max() is returned. + The caller has to assure that nIndex matches an entry belonging to + nStart, for example, by calling Search(nStart) first! */ + unsigned long SumValuesContinuation( A nStart, A nEnd, + size_t& nIndex ) const; + + /** Returns the sum of all scaled values for a region. If an overflow would + occur, ::std::numeric_limits<unsigned long>::max() is returned. + Summed values are treated as if for each row the expression + (sum += (unsigned long) (scale * value)) had been applied. + The caller has to assure that nIndex matches an entry belonging to + nStart, for example, by calling Search(nStart) first! */ + unsigned long SumScaledValuesContinuation( A nStart, A nEnd, + size_t& nIndex, double fScale ) const; + +}; + + +// === 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 ); + + /** Copy values from rArray and bitwise OR them with rValueToOr. */ + void CopyFromOred( + const ScBitMaskCompressedArray& rArray, + A nStart, A nEnd, const D& rValueToOr, + long nSourceDy = 0 ); + + /** Return the start row of a region where all entries meet the condition: + ((aValue & rBitMask) == rMaskedCompare). If not even nEnd meets + this condition, ::std::numeric_limits<A>::max() is returned. */ + A GetBitStateStart( A nEnd, const D& rBitMask, + const D& rMaskedCompare ) const; + + /** Return the end row of a region where all entries meet the condition: + ((aValue & rBitMask) == rMaskedCompare). If not even nStart meets + this condition, ::std::numeric_limits<A>::max() is returned. */ + A GetBitStateEnd( A nStart, const D& rBitMask, + const D& rMaskedCompare ) const; + + /** 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) == rMaskedCompare), searching between nStart and + nEnd. If no entry meets this condition, ::std::numeric_limits<A>::max() + is returned. */ + SC_DLLPUBLIC A GetLastForCondition( A nStart, A nEnd, + const D& rBitMask, + const D& rMaskedCompare ) const; + + /** Count rows between nStart and nEnd where entries meet the condition: + ((aValue & rBitMask) == rMaskedCompare) */ + A CountForCondition( A nStart, A nEnd, + const D& rBitMask, + const D& rMaskedCompare ) const; + + /** Whether there is any entry between nStart and nEnd where the condition + is met: ((aValue & rBitMask) == rMaskedCompare) */ + SC_DLLPUBLIC bool HasCondition( A nStart, A nEnd, + const D& rBitMask, + const D& rMaskedCompare ) const; + + /** Fill an array with row numbers between nStart and nEnd where entries + meet the condition: ((aValue & rBitMask) == rMaskedCompare). + @return the count of used elements in array. */ + size_t FillArrayForCondition( A nStart, A nEnd, + const D& rBitMask, + const D& rMaskedCompare, + A * pArray, size_t nArraySize ) const; + + /** Count rows between nStart and nEnd where entries meet the condition: + ((aValue & rBitMask) != 0) */ + A CountForAnyBitCondition( A nStart, A nEnd, + const D& rBitMask ) 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; + + /** Sum values of a ScSummableCompressedArray for each row where in *this* + array the condition is met: ((aValue & rBitMask) == rMaskedCompare). */ + template< typename S > + SC_DLLPUBLIC unsigned long SumCoupledArrayForCondition( A nStart, A nEnd, + const D& rBitMask, const D& rMaskedCompare, + const ScSummableCompressedArray<A,S>& rArray ) const; + + /** Sum scaled values of a ScSummableCompressedArray for each row where in + *this* array the condition is met: ((aValue & rBitMask) == rMaskedCompare). */ + template< typename S > + SC_DLLPUBLIC unsigned long SumScaledCoupledArrayForCondition( A nStart, A nEnd, + const D& rBitMask, const D& rMaskedCompare, + const ScSummableCompressedArray<A,S>& rArray, + double fScale ) 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); +} + + +// === ScCoupledCompressedArrayIterator ====================================== + +/** Iterate over a ScBitMaskCompressedArray and retrieve values from a coupled + array for positions where in the bit mask array the condition ((*aIter1 & + rBitMask) == rMaskedCompare) is met. + */ + +template< typename A, typename D, typename S > class ScCoupledCompressedArrayIterator +{ +public: + SC_DLLPUBLIC ScCoupledCompressedArrayIterator( + const ScBitMaskCompressedArray<A,D> & rArray1, + A nStart, A nEnd, + const D& rBitMask, + const D& rMaskedCompare, + const ScCompressedArray<A,S> & rArray2 ); + void NewLimits( A nStart, A nEnd ); + A GetIterStart() const; + A GetIterEnd() const; + bool operator ++(); + A GetPos() const; + operator bool() const; + const S& operator *() const; + SC_DLLPUBLIC bool NextRange(); + A GetRangeStart() const; + A GetRangeEnd() const; + void Resync( A nPos ); + +private: + ScCompressedArrayIterator<A,D> aIter1; + ScCompressedArrayIterator<A,S> aIter2; + const D& rBitMask; + const D& rMaskedCompare; + + void InitLimits(); +}; + + +template< typename A, typename D, typename S > +A ScCoupledCompressedArrayIterator<A,D,S>::GetIterStart() const +{ + return aIter1.GetIterStart(); +} + + +template< typename A, typename D, typename S > +A ScCoupledCompressedArrayIterator<A,D,S>::GetIterEnd() const +{ + return aIter1.GetIterEnd(); +} + + +template< typename A, typename D, typename S > +ScCoupledCompressedArrayIterator<A,D,S>::operator bool() const +{ + return aIter1 && aIter2; +} + + +template< typename A, typename D, typename S > +const S& ScCoupledCompressedArrayIterator<A,D,S>::operator*() const +{ + return *aIter2; +} + + +template< typename A, typename D, typename S > +bool ScCoupledCompressedArrayIterator<A,D,S>::operator ++() +{ + if (aIter1.GetPos() < aIter1.GetRangeEnd()) + { + ++aIter1; + ++aIter2; + return operator bool(); + } + else + return NextRange(); +} + + +template< typename A, typename D, typename S > +A ScCoupledCompressedArrayIterator<A,D,S>::GetPos() const +{ + return aIter2.GetPos(); +} + + +template< typename A, typename D, typename S > +A ScCoupledCompressedArrayIterator<A,D,S>::GetRangeStart() const +{ + return ::std::max( aIter1.GetRangeStart(), aIter2.GetRangeStart()); +} + + +template< typename A, typename D, typename S > +A ScCoupledCompressedArrayIterator<A,D,S>::GetRangeEnd() const +{ + return ::std::min( aIter1.GetRangeEnd(), aIter2.GetRangeEnd()); +} + + +#endif // SC_COMPRESSEDARRAY_HXX diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx new file mode 100644 index 000000000000..75758841af7a --- /dev/null +++ b/sc/inc/conditio.hxx @@ -0,0 +1,301 @@ +/************************************************************************* + * + * 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" + +class ScBaseCell; +class ScFormulaCell; +class ScTokenArray; +class ScRangeList; + + +#define SC_COND_GROW 16 + +// nOptions Flags +#define SC_COND_NOBLANKS 1 + + + // Reihenfolge von ScConditionMode wie ScQueryOp, + // damit einmal zusammengefasst werden kann: + +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_DIRECT, + SC_COND_NONE +}; + +enum ScConditionValType +{ + SC_VAL_VALUE, + SC_VAL_STRING, + SC_VAL_FORMULA +}; + +class SC_DLLPUBLIC ScConditionEntry +{ + // gespeicherte Daten: + ScConditionMode eOp; + USHORT nOptions; + double nVal1; // eingegeben oder berechnet + double nVal2; + String aStrVal1; // eingegeben oder berechnet + 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 + BOOL bIsStr1; // um auch leere Strings zu erkennen + BOOL bIsStr2; + ScTokenArray* pFormula1; // eingegebene Formel + 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; + BOOL bRelRef1; + BOOL bRelRef2; + 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, + BOOL bTextToReal ); + void Interpret( const ScAddress& rPos ); + + BOOL IsValid( double nArg ) const; + BOOL IsValidStr( const String& rArg ) 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 ); // flache Kopie der Formeln + // echte Kopie der Formeln (fuer Ref-Undo): + ScConditionEntry( ScDocument* pDocument, const ScConditionEntry& r ); + virtual ~ScConditionEntry(); + + int operator== ( const ScConditionEntry& r ) const; + + BOOL IsCellValid( ScBaseCell* pCell, const ScAddress& rPos ) const; + + ScConditionMode GetOperation() const { return eOp; } + BOOL IsIgnoreBlank() const { return ( nOptions & SC_COND_NOBLANKS ) == 0; } + void SetIgnoreBlank(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, USHORT nPos, ULONG nNumFmt = 0, + const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; + + ScTokenArray* CreateTokenArry( USHORT 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; } +}; + +// +// einzelner Eintrag fuer bedingte Formatierung +// + +class ScConditionalFormat; + +class SC_DLLPUBLIC ScCondFormatEntry : public ScConditionEntry +{ + String aStyleName; + ScConditionalFormat* pParent; + + 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(); + + void SetParent( ScConditionalFormat* pNew ) { pParent = pNew; } + + 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; +}; + +// +// komplette bedingte Formatierung +// + +class SC_DLLPUBLIC ScConditionalFormat +{ + ScDocument* pDoc; + ScRangeList* pAreas; // Bereiche fuer Paint + sal_uInt32 nKey; // Index in Attributen + ScCondFormatEntry** ppEntries; + USHORT nEntryCount; + BOOL bIsUsed; // temporaer beim Speichern + +public: + ScConditionalFormat(sal_uInt32 nNewKey, ScDocument* pDocument); + ScConditionalFormat(const ScConditionalFormat& r); + ~ScConditionalFormat(); + + // echte Kopie der Formeln (fuer Ref-Undo / zwischen Dokumenten) + ScConditionalFormat* Clone(ScDocument* pNewDoc = NULL) const; + + void AddEntry( const ScCondFormatEntry& rNew ); + + BOOL IsEmpty() const { return (nEntryCount == 0); } + USHORT 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( USHORT nPos ) const; + + const String& GetCellStyle( ScBaseCell* pCell, const ScAddress& rPos ) const; + + 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; } // nur wenn nicht eingefuegt! + + void SetUsed(BOOL bSet) { bIsUsed = bSet; } + BOOL IsUsed() const { return bIsUsed; } + + bool MarkUsedExternalReferences() const; + + // sortiert (per PTRARR) nach Index + // operator== nur fuer die Sortierung + BOOL operator ==( const ScConditionalFormat& r ) const { return nKey == r.nKey; } + BOOL operator < ( const ScConditionalFormat& r ) const { return nKey < r.nKey; } +}; + +// +// Liste der Bereiche und Formate: +// + +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; + + BOOL operator==( const ScConditionalFormatList& r ) const; // fuer Ref-Undo +}; + +#endif + + diff --git a/sc/inc/confuno.hxx b/sc/inc/confuno.hxx new file mode 100644 index 000000000000..bd74406eb37a --- /dev/null +++ b/sc/inc/confuno.hxx @@ -0,0 +1,107 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/consoli.hxx b/sc/inc/consoli.hxx new file mode 100644 index 000000000000..4eb30b12c432 --- /dev/null +++ b/sc/inc/consoli.hxx @@ -0,0 +1,134 @@ +/************************************************************************* + * + * 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 // ohne Constructor ! +{ + SCCOL nCol; + SCROW nRow; + SCTAB nTab; +}; + + +//! Delta-Wert fuer Daten benutzen? + +class ScReferenceList // ohne Constructor ! +{ +private: + SCSIZE nCount; + SCSIZE nFullSize; // inkl. Fuell-Eintraege + 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 ); +}; + +// ----------------------------------------------------------------------- + + +// +// Reihenfolge: +// 1) ScConsData anlegen +// 2) Parameter (Size/Flags) +// 3) AddFields fuer alle Bereiche (nur noetig bei bColByName oder bRowByName) +// 4) DoneFields ( " " ) +// 5) AddData fuer alle Bereiche +// evtl. AddName nach jedem Bereich +// 6) OutputToDocument +// + +//! ab bestimmter Groesse ScDocument Struktur benutzen? + + +class ScConsData +{ +private: + ScSubTotalFunc eFunction; + BOOL bReference; + BOOL bColByName; + BOOL bRowByName; + BOOL bSubTitles; + SCSIZE nColCount; + SCSIZE nRowCount; + BOOL** ppUsed; + double** ppSum; + double** ppCount; + double** ppSumSqr; + ScReferenceList** ppRefs; + String** ppColHeaders; + String** ppRowHeaders; + SCSIZE nDataCount; + SCSIZE nTitleCount; + String** ppTitles; + SCSIZE** ppTitlePos; + BOOL bCornerUsed; + String aCornerText; // nur bei bColByName && bRowByName + +public: + ScConsData(); + ~ScConsData(); + + void SetSize( SCCOL nCols, SCROW nRows ); + void SetFlags( ScSubTotalFunc eFunc, BOOL bColName, BOOL bRowName, BOOL bRef ); + + void InitData(BOOL bDelete=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 + + diff --git a/sc/inc/convuno.hxx b/sc/inc/convuno.hxx new file mode 100644 index 000000000000..0f93d6d6de0d --- /dev/null +++ b/sc/inc/convuno.hxx @@ -0,0 +1,218 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/cursuno.hxx b/sc/inc/cursuno.hxx new file mode 100644 index 000000000000..470f4e3c6f5c --- /dev/null +++ b/sc/inc/cursuno.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/dapiuno.hxx b/sc/inc/dapiuno.hxx new file mode 100644 index 000000000000..c9a5305a05ca --- /dev/null +++ b/sc/inc/dapiuno.hxx @@ -0,0 +1,991 @@ +/************************************************************************* + * + * 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( USHORT nBits ); + static USHORT 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 den Ableitungen: + 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); + + // nur noch aus Property-Funktionen gerufen: + 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 + diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx new file mode 100644 index 000000000000..79902b367ac7 --- /dev/null +++ b/sc/inc/datauno.hxx @@ -0,0 +1,665 @@ +/************************************************************************* + * + * 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 <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/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 gibt's nicht mehr als Uno-Objekt, nur noch 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 gibt's nicht mehr als Uno-Objekt, nur noch 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 - Basisklasse fuer SubTotalDescriptor alleine und im DB-Bereich + +// 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(USHORT 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 - dummer Container zur Benutzung mit XImportTarget + +class ScSubTotalDescriptor : public ScSubTotalDescriptorBase +{ +private: + ScSubTotalParam aStoredParam; + +public: + ScSubTotalDescriptor(); + virtual ~ScSubTotalDescriptor(); + + // von ScSubTotalDescriptorBase: + virtual void GetData( ScSubTotalParam& rParam ) const; + virtual void PutData( const ScSubTotalParam& rParam ); + + // Zugriff von aussen: + void SetParam( const ScSubTotalParam& rNew ); +// const ScSubTotalParam& GetParam() const { return aStoredParam; } +}; + + +// ScRangeSubTotalDescriptor - SubTotalDescriptor eines Datenbank-Bereichs + +class ScRangeSubTotalDescriptor : public ScSubTotalDescriptorBase +{ +private: + ScDatabaseRangeObj* pParent; + +public: + ScRangeSubTotalDescriptor(ScDatabaseRangeObj* pPar); + virtual ~ScRangeSubTotalDescriptor(); + + // von 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; + USHORT nPos; + +public: + ScSubTotalFieldObj( ScSubTotalDescriptorBase* pDesc, USHORT 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 - Basisklasse fuer FilterDescriptor +// alleine, im DB-Bereich und im 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: + ScFilterDescriptorBase(ScDocShell* pDocShell); + virtual ~ScFilterDescriptorBase(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // in den Ableitungen: + // (nField[] hier innerhalb des Bereichs) + 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 - dummer Container zur Benutzung mit XFilterable + +class ScFilterDescriptor : public ScFilterDescriptorBase +{ +private: + ScQueryParam aStoredParam; // nField[] hier innerhalb des Bereichs + +public: + ScFilterDescriptor(ScDocShell* pDocSh); + virtual ~ScFilterDescriptor(); + + // von ScFilterDescriptorBase: + virtual void GetData( ScQueryParam& rParam ) const; + virtual void PutData( const ScQueryParam& rParam ); + + // Zugriff von aussen: + void SetParam( const ScQueryParam& rNew ); + const ScQueryParam& GetParam() const { return aStoredParam; } +}; + + +// ScRangeFilterDescriptor - FilterDescriptor eines Datenbank-Bereichs + +class ScRangeFilterDescriptor : public ScFilterDescriptorBase +{ +private: + ScDatabaseRangeObj* pParent; + +public: + ScRangeFilterDescriptor(ScDocShell* pDocSh, ScDatabaseRangeObj* pPar); + virtual ~ScRangeFilterDescriptor(); + + // von ScFilterDescriptorBase: + virtual void GetData( ScQueryParam& rParam ) const; + virtual void PutData( const ScQueryParam& rParam ); +}; + + +// ScDataPilotFilterDescriptor - FilterDescriptor eines DataPilotDescriptors + +class ScDataPilotFilterDescriptor : public ScFilterDescriptorBase +{ +private: + ScDataPilotDescriptorBase* pParent; + +public: + ScDataPilotFilterDescriptor(ScDocShell* pDocSh, ScDataPilotDescriptorBase* pPar); + virtual ~ScDataPilotFilterDescriptor(); + + // von 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; + +private: + ScDBData* GetDBData_Impl() const; + void Refreshed_Impl(); + +public: + ScDatabaseRangeObj(ScDocShell* pDocSh, const String& rNm); + virtual ~ScDatabaseRangeObj(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // nField[] hier innerhalb des Bereichs: + 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); +// implemented for the XRefreshable Interface +// virtual void SAL_CALL refresh() 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(USHORT 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); +}; + + + +#endif + diff --git a/sc/inc/dbcolect.hxx b/sc/inc/dbcolect.hxx new file mode 100644 index 000000000000..72356683d1a4 --- /dev/null +++ b/sc/inc/dbcolect.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * 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" + +//------------------------------------------------------------------------ + +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 bIncludePattern; + BOOL bSortInplace; + BOOL bSortUserDef; + USHORT 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; // TRUE if created by advanced filter + ScRange aAdvSource; // source range + // SubTotalParam + BOOL bSubRemoveOnly; + BOOL bSubReplace; + BOOL bSubPagebreak; + BOOL bSubCaseSens; + BOOL bSubDoSort; + BOOL bSubAscending; + BOOL bSubIncludePattern; + BOOL bSubUserDef; + USHORT nSubUserIndex; + BOOL bDoSubTotal[MAXSUBTOTAL]; + SCCOL nSubField[MAXSUBTOTAL]; + SCCOL nSubTotals[MAXSUBTOTAL]; + SCCOL* pSubTotals[MAXSUBTOTAL]; + ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; + // Datenbank-Import + BOOL bDBImport; + String aDBName; + String aDBStatement; + BOOL bDBNative; + BOOL bDBSelection; // nicht im Param: Wenn Selektion, Update sperren + BOOL bDBSql; // aDBStatement ist SQL und kein Name + BYTE nDBType; // enum DBObject (bisher nur dbTable, dbQuery) + + USHORT nIndex; // eindeutiger Index fuer Formeln + BOOL bAutoFilter; // AutoFilter? (nicht gespeichert) + BOOL bModified; // wird bei UpdateReference gesetzt/geloescht + + using ScRefreshTimer::operator==; + +public: + SC_DLLPUBLIC ScDBData(const String& rName, + SCTAB nTab, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + BOOL bByR = TRUE, BOOL bHasH = TRUE); + ScDBData(const ScDBData& rData); + ~ScDBData(); + + virtual ScDataObject* Clone() const; + + ScDBData& operator= (const ScDBData& rData); + + BOOL operator== (const ScDBData& rData) 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(USHORT nInd) { nIndex = nInd; } + USHORT 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; } + +//UNUSED2008-05 BOOL IsBeyond(SCROW nMaxRow) const; + + 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 bDoSubTotal[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; } +}; + + +//------------------------------------------------------------------------ +class SC_DLLPUBLIC ScDBCollection : public ScSortedCollection +{ + +private: + Link aRefreshHandler; + ScDocument* pDoc; + USHORT nEntryIndex; // Zaehler fuer die eindeutigen Indizes + +public: + ScDBCollection(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE, ScDocument* pDocument = NULL) : + ScSortedCollection ( nLim, nDel, bDup ), + pDoc ( pDocument ), + nEntryIndex ( SC_START_INDEX_DB_COLL ) // oberhalb der Namen + {} + ScDBCollection(const ScDBCollection& rScDBCollection) : + ScSortedCollection ( rScDBCollection ), + pDoc ( rScDBCollection.pDoc ), + nEntryIndex ( rScDBCollection.nEntryIndex) + {} + + virtual ScDataObject* Clone() const { return new ScDBCollection(*this); } + ScDBData* operator[]( const USHORT nIndex) const {return (ScDBData*)At(nIndex);} + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; + virtual BOOL IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; + ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, BOOL bStartOnly) const; + ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + + BOOL SearchName( const String& rName, USHORT& 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(USHORT nIndex); + USHORT GetEntryIndex() { return nEntryIndex; } + void SetEntryIndex(USHORT nInd) { nEntryIndex = nInd; } + virtual BOOL Insert(ScDataObject* pScDataObject); + + void SetRefreshHandler( const Link& rLink ) + { aRefreshHandler = rLink; } + const Link& GetRefreshHandler() const { return aRefreshHandler; } +}; + +#endif diff --git a/sc/inc/dbdocutl.hxx b/sc/inc/dbdocutl.hxx new file mode 100644 index 000000000000..3071b542f4b6 --- /dev/null +++ b/sc/inc/dbdocutl.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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: + 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, BOOL bCurrency, BOOL* pSimpleFlag = NULL ); +}; + +#endif + diff --git a/sc/inc/dbtoken.hxx b/sc/inc/dbtoken.hxx new file mode 100644 index 000000000000..1cdacfd97323 --- /dev/null +++ b/sc/inc/dbtoken.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * 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 + +BOOL DbgToken( char ); +ScTokenArray* DbgMakeTokenArray + ( ScDocument* pDoc, SCTAB nTab, const String& r, USHORT& rErr ); +void DbgDumpTokenArray( const BYTE* pArr, USHORT 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, + USHORT& rError, + ScMatrix** ppMat); + +#endif + diff --git a/sc/inc/defltuno.hxx b/sc/inc/defltuno.hxx new file mode 100644 index 000000000000..5ef4f501061a --- /dev/null +++ b/sc/inc/defltuno.hxx @@ -0,0 +1,130 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/detdata.hxx b/sc/inc/detdata.hxx new file mode 100644 index 000000000000..31055c270fbf --- /dev/null +++ b/sc/inc/detdata.hxx @@ -0,0 +1,106 @@ +/************************************************************************* + * + * 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; } + + // fuer UpdateRef: + void SetPos(const ScAddress& rNew) { aPos=rNew; } + + int operator== ( const ScDetOpData& r ) const + { return eOperation == r.eOperation && aPos == r.aPos; } +}; + +//------------------------------------------------------------------------ + +// +// Liste der Operationen +// + +typedef ScDetOpData* ScDetOpDataPtr; + +SV_DECL_PTRARR_DEL(ScDetOpArr_Impl, ScDetOpDataPtr, SC_DETOP_GROW, SC_DETOP_GROW) + +class ScDetOpList : public ScDetOpArr_Impl +{ + 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 ); + + BOOL operator==( const ScDetOpList& r ) const; // fuer Ref-Undo + + void Append( ScDetOpData* pData ); + + BOOL HasAddError() const { return bHasAddError; } +}; + + + +#endif diff --git a/sc/inc/detfunc.hxx b/sc/inc/detfunc.hxx new file mode 100644 index 000000000000..5c57d32af898 --- /dev/null +++ b/sc/inc/detfunc.hxx @@ -0,0 +1,166 @@ +/************************************************************************* + * + * 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" + +class SdrObject; +class SdrPage; +class String; + +class ScPostIt; +class ScCommentData; +class ScDetectiveData; +class ScDocument; +class ScAddress; +class ScRange; + +#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 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; + + BOOL HasArrow( const ScAddress& rStart, + SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab ); + + void DeleteArrowsAt( SCCOL nCol, SCROW nRow, BOOL bDestPnt ); + void DeleteBox( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + + BOOL HasError( const ScRange& rRange, ScAddress& rErrPos ); + + void FillAttributes( ScDetectiveData& rData ); + + // called from DrawEntry/DrawAlienEntry and InsertObject + BOOL InsertArrow( SCCOL nCol, SCROW nRow, + SCCOL nRefStartCol, SCROW nRefStartRow, + SCCOL nRefEndCol, SCROW nRefEndRow, + BOOL bFromOtherTab, BOOL bRed, + ScDetectiveData& rData ); + BOOL InsertToOtherTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, BOOL bRed, + ScDetectiveData& rData ); + + // DrawEntry / DrawAlienEntry check for existing arrows and errors + BOOL DrawEntry( SCCOL nCol, SCROW nRow, const ScRange& rRef, + ScDetectiveData& rData ); + BOOL DrawAlienEntry( const ScRange& rRef, + ScDetectiveData& rData ); + + void DrawCircle( SCCOL nCol, SCROW nRow, ScDetectiveData& rData ); + + USHORT InsertPredLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, USHORT nLevel ); + USHORT InsertPredLevelArea( const ScRange& rRef, + ScDetectiveData& rData, USHORT nLevel ); + USHORT FindPredLevel( SCCOL nCol, SCROW nRow, USHORT nLevel, USHORT nDeleteLevel ); + USHORT FindPredLevelArea( const ScRange& rRef, + USHORT nLevel, USHORT nDeleteLevel ); + + USHORT InsertErrorLevel( SCCOL nCol, SCROW nRow, ScDetectiveData& rData, USHORT nLevel ); + + USHORT InsertSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + ScDetectiveData& rData, USHORT nLevel ); + USHORT FindSuccLevel( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + USHORT nLevel, USHORT nDeleteLevel ); + + BOOL FindFrameForObject( SdrObject* pObject, ScRange& rRange ); + + void Modified(); + +public: + ScDetectiveFunc(ScDocument* pDocument, SCTAB nTable) : pDoc(pDocument),nTab(nTable) {} + + BOOL ShowSucc( SCCOL nCol, SCROW nRow ); + BOOL ShowPred( SCCOL nCol, SCROW nRow ); + BOOL ShowError( SCCOL nCol, SCROW nRow ); + + BOOL DeleteSucc( SCCOL nCol, SCROW nRow ); + BOOL DeletePred( SCCOL nCol, SCROW nRow ); + BOOL DeleteAll( ScDetectiveDelete eWhat ); + + BOOL MarkInvalid(BOOL& rOverflow); + + static void UpdateAllComments( ScDocument& rDoc ); // on all tables + void UpdateAllArrowColors(); // on all tables + + static BOOL IsNonAlienArrow( SdrObject* pObject ); + + ScDetectiveObjType GetDetectiveObjectType( SdrObject* pObject, SCTAB nObjTab, + ScAddress& rPosition, ScRange& rSource, BOOL& rRedLine ); + void InsertObject( ScDetectiveObjType eType, const ScAddress& rPosition, + const ScRange& rSource, BOOL bRedLine ); + + static ColorData GetArrowColor(); + static ColorData GetErrorColor(); + static ColorData GetCommentColor(); + static void InitializeColors(); + static BOOL IsColorsInitialized(); +}; + + + +#endif diff --git a/sc/inc/dispuno.hxx b/sc/inc/dispuno.hxx new file mode 100644 index 000000000000..9526ed8ae3db --- /dev/null +++ b/sc/inc/dispuno.hxx @@ -0,0 +1,151 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx new file mode 100644 index 000000000000..d995550a2f1d --- /dev/null +++ b/sc/inc/dociter.hxx @@ -0,0 +1,535 @@ +/************************************************************************* + * + * 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> + +class ScDocument; +class ScBaseCell; +class ScPatternAttr; +class ScAttrArray; +class ScAttrIterator; +class ScRange; + +class ScDocumentIterator // alle nichtleeren Zellen durchgehen +{ +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; + + BOOL GetThis(); + BOOL GetThisCol(); + +public: + ScDocumentIterator( ScDocument* pDocument, SCTAB nStartTable, SCTAB nEndTable ); + ~ScDocumentIterator(); + + BOOL GetFirst(); + BOOL GetNext(); + + ScBaseCell* GetCell(); + const ScPatternAttr* GetPattern(); + void GetPos( SCCOL& rCol, SCROW& rRow, SCTAB& rTab ); +}; + +class ScValueIterator // alle Zahlenwerte in einem Bereich durchgehen +{ +private: + double fNextValue; + ScDocument* pDoc; + const ScAttrArray* pAttrArray; + ULONG nNumFormat; // fuer CalcAsShown + 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; + BOOL bNumValid; + BOOL bSubTotal; + BOOL bNextValid; + BOOL bCalcAsShown; + BOOL bTextAsZero; + + BOOL GetThis(double& rValue, USHORT& rErr); +public: +//UNUSED2008-05 ScValueIterator(ScDocument* pDocument, +//UNUSED2008-05 SCCOL nSCol, SCROW nSRow, SCTAB nSTab, +//UNUSED2008-05 SCCOL nECol, SCROW nERow, SCTAB nETab, +//UNUSED2008-05 BOOL bSTotal = FALSE, BOOL bTextAsZero = FALSE); + + ScValueIterator(ScDocument* pDocument, + const ScRange& rRange, BOOL bSTotal = FALSE, + BOOL bTextAsZero = FALSE ); + void GetCurNumFmtInfo( short& nType, ULONG& nIndex ); + /// Does NOT reset rValue if no value found! + BOOL GetFirst(double& rValue, USHORT& rErr); + /// Does NOT reset rValue if no value found! + BOOL GetNext(double& rValue, USHORT& rErr) + { + return bNextValid ? ( bNextValid = FALSE, rValue = fNextValue, + rErr = 0, nRow = nNextRow, + ++nColRow, bNumValid = FALSE, 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; + ULONG nNumFormat; // for CalcAsShown + 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 // alle Zellen in einem Bereich durchgehen +{ // bei SubTotal aber keine ausgeblendeten und +private: // SubTotalZeilen + ScDocument* pDoc; + SCCOL nStartCol; + SCROW nStartRow; + SCTAB nStartTab; + SCCOL nEndCol; + SCROW nEndRow; + SCTAB nEndTab; + SCCOL nCol; + SCROW nRow; + SCTAB nTab; + SCSIZE nColRow; + BOOL bSubTotal; + + ScBaseCell* GetThis(); +public: + ScCellIterator(ScDocument* pDocument, + SCCOL nSCol, SCROW nSRow, SCTAB nSTab, + SCCOL nECol, SCROW nERow, SCTAB nETab, + BOOL bSTotal = FALSE); + ScCellIterator(ScDocument* pDocument, + const ScRange& rRange, 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 // alle nichtleeren Zellen in einem Bereich +{ // durchgehen + enum StopOnMismatchBits + { + nStopOnMismatchDisabled = 0x00, + nStopOnMismatchEnabled = 0x01, + nStopOnMismatchOccured = 0x02, + nStopOnMismatchExecuted = nStopOnMismatchEnabled | nStopOnMismatchOccured + }; + + enum TestEqualConditionBits + { + nTestEqualConditionDisabled = 0x00, + nTestEqualConditionEnabled = 0x01, + nTestEqualConditionMatched = 0x02, + nTestEqualConditionFulfilled = nTestEqualConditionEnabled | nTestEqualConditionMatched + }; + +private: + ScQueryParam aParam; + ScDocument* pDoc; + const ScAttrArray* pAttrArray; + ULONG nNumFormat; + SCTAB nTab; + SCCOL nCol; + SCROW nRow; + SCSIZE nColRow; + SCROW nAttrEndRow; + BYTE nStopOnMismatch; + BYTE nTestEqualCondition; + BOOL bAdvanceQuery; + 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, BOOL bMod = TRUE); + // fuer bMod = FALSE muss der QueryParam + // weiter aufgefuellt sein (bIsString) + ScBaseCell* GetFirst(); + ScBaseCell* GetNext(); + SCCOL GetCol() { return nCol; } + SCROW GetRow() { return nRow; } + + // setzt alle Entry.nField einen weiter, wenn Spalte + // wechselt, fuer ScInterpreter ScHLookup() + void SetAdvanceQueryParamEntryField( 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 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( BOOL bVal ) + { + nStopOnMismatch = sal::static_int_cast<BYTE>(bVal ? nStopOnMismatchEnabled : + nStopOnMismatchDisabled); + } + 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( BOOL bVal ) + { + nTestEqualCondition = sal::static_int_cast<BYTE>(bVal ? + nTestEqualConditionEnabled : + nTestEqualConditionDisabled); + } + 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 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! + */ + BOOL FindEqualOrSortedLastInRange( SCCOL& nFoundCol, + SCROW& nFoundRow, BOOL bSearchForEqualAfterMismatch = FALSE, + BOOL bIgnoreMismatchOnLeadingStrings = TRUE ); +}; + +class ScDocAttrIterator // alle Attribut-Bereiche +{ +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 // alle Attribut-Bereiche, auch Bereiche ueber mehrere Spalten +{ +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 // alle nichtleeren Zellen in einem Bereich +{ // zeilenweise durchgehen +private: + ScDocument* pDoc; + SCTAB nTab; + SCCOL nStartCol; + SCCOL nEndCol; + SCROW nEndRow; + SCROW* pNextRows; + SCSIZE* pNextIndices; + SCCOL nCol; + SCROW nRow; + BOOL bMore; + +public: + ScHorizontalCellIterator(ScDocument* pDocument, SCTAB nTable, + SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2); + ~ScHorizontalCellIterator(); + + ScBaseCell* GetNext( SCCOL& rCol, SCROW& rRow ); + BOOL ReturnNext( SCCOL& rCol, SCROW& rRow ); + +private: + void Advance(); +}; + + +// +// gibt alle Bereiche mit nicht-Default-Formatierung zurueck (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; + 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 ); +}; + +// +// gibt nichtleere Zellen und Bereiche mit Formatierung zurueck (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; // Ergebnisse nach 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(); + + 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; +}; + +#endif + + diff --git a/sc/inc/docoptio.hxx b/sc/inc/docoptio.hxx new file mode 100644 index 000000000000..6f6d4c859a5c --- /dev/null +++ b/sc/inc/docoptio.hxx @@ -0,0 +1,216 @@ +/************************************************************************* + * + * 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" + +class SC_DLLPUBLIC ScDocOptions +{ + double fIterEps; // Epsilon-Wert dazu + USHORT nIterCount; // Anzahl + sal_uInt16 nPrecStandardFormat; // precision for standard format + USHORT nDay; // Nulldatum: + USHORT nMonth; + USHORT nYear; + USHORT nYear2000; // bis zu welcher zweistelligen Jahreszahl 20xx angenommen wird + USHORT nTabDistance; // Abstand Standardtabulatoren + BOOL bIsIgnoreCase; // Gross-/Kleinschr. bei Vergleichen + BOOL bIsIter; // Iteration bei cirk. Ref + BOOL bCalcAsShown; // berechnen wie angezeigt (Precision) + BOOL bMatchWholeCell; // Suchkriterien muessen ganze Zelle matchen + BOOL bDoAutoSpell; // Auto-Spelling + BOOL bLookUpColRowNames; // Spalten-/Zeilenbeschriftungen automagisch suchen + BOOL bFormulaRegexEnabled; // regular expressions in formulas enabled + +public: + ScDocOptions(); + ScDocOptions( const ScDocOptions& rCpy ); + ~ScDocOptions(); + + BOOL IsLookUpColRowNames() const { return bLookUpColRowNames; } + void SetLookUpColRowNames( BOOL bVal ) { bLookUpColRowNames = bVal; } + BOOL IsAutoSpell() const { return bDoAutoSpell; } + void SetAutoSpell( BOOL bVal ) { bDoAutoSpell = bVal; } + BOOL IsMatchWholeCell() const { return bMatchWholeCell; } + void SetMatchWholeCell( BOOL bVal ){ bMatchWholeCell = bVal; } + BOOL IsIgnoreCase() const { return bIsIgnoreCase; } + void SetIgnoreCase( BOOL bVal ) { bIsIgnoreCase = bVal; } + BOOL IsIter() const { return bIsIter; } + void SetIter( BOOL bVal ) { bIsIter = bVal; } + USHORT GetIterCount() const { return nIterCount; } + void SetIterCount( USHORT nCount) { nIterCount = nCount; } + double GetIterEps() const { return fIterEps; } + void SetIterEps( double fEps ) { fIterEps = fEps; } + + void GetDate( USHORT& rD, USHORT& rM, USHORT& rY ) const + { rD = nDay; rM = nMonth; rY = nYear;} + void SetDate (USHORT nD, USHORT nM, USHORT nY) + { nDay = nD; nMonth = nM; nYear = nY; } + USHORT GetTabDistance() const { return nTabDistance;} + void SetTabDistance( USHORT nTabDist ) {nTabDistance = nTabDist;} + + void ResetDocOptions(); + inline void CopyTo(ScDocOptions& rOpt); + + 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; } + + BOOL IsCalcAsShown() const { return bCalcAsShown; } + void SetCalcAsShown( BOOL bVal ) { bCalcAsShown = bVal; } + + void SetYear2000( USHORT nVal ) { nYear2000 = nVal; } + USHORT GetYear2000() const { return nYear2000; } + + void SetFormulaRegexEnabled( BOOL bVal ) { bFormulaRegexEnabled = bVal; } + BOOL IsFormulaRegexEnabled() const { return bFormulaRegexEnabled; } +}; + + +inline void ScDocOptions::CopyTo(ScDocOptions& rOpt) +{ + rOpt.bIsIgnoreCase = bIsIgnoreCase; + rOpt.bIsIter = bIsIter; + rOpt.nIterCount = nIterCount; + rOpt.fIterEps = fIterEps; + rOpt.nPrecStandardFormat = nPrecStandardFormat; + rOpt.nDay = nDay; + rOpt.nMonth = nMonth; + rOpt.nYear2000 = nYear2000; + rOpt.nYear = nYear; + rOpt.nTabDistance = nTabDistance; + rOpt.bCalcAsShown = bCalcAsShown; + rOpt.bMatchWholeCell = bMatchWholeCell; + rOpt.bDoAutoSpell = bDoAutoSpell; + rOpt.bLookUpColRowNames = bLookUpColRowNames; + rOpt.bFormulaRegexEnabled = bFormulaRegexEnabled; +} + +inline const ScDocOptions& ScDocOptions::operator=( const ScDocOptions& rCpy ) +{ + bIsIgnoreCase = rCpy.bIsIgnoreCase; + bIsIter = rCpy.bIsIter; + nIterCount = rCpy.nIterCount; + fIterEps = rCpy.fIterEps; + nPrecStandardFormat = rCpy.nPrecStandardFormat; + 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; + + 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.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 + ); +} + +inline int ScDocOptions::operator!=( const ScDocOptions& rOpt ) const +{ + return !(operator==(rOpt)); +} + +//================================================================== +// Item fuer Einstellungsdialog - Berechnen +//================================================================== + +class SC_DLLPUBLIC ScTpCalcItem : public SfxPoolItem +{ +public: + TYPEINFO(); +//UNUSED2008-05 ScTpCalcItem( USHORT nWhich ); + ScTpCalcItem( USHORT 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 aLayoutItem; + + DECL_LINK( CalcCommitHdl, void* ); + DECL_LINK( LayoutCommitHdl, void* ); + + com::sun::star::uno::Sequence<rtl::OUString> GetCalcPropertyNames(); + com::sun::star::uno::Sequence<rtl::OUString> GetLayoutPropertyNames(); + +public: + ScDocCfg(); + + void SetOptions( const ScDocOptions& rNew ); +}; + + +#endif + diff --git a/sc/inc/docpool.hxx b/sc/inc/docpool.hxx new file mode 100644 index 000000000000..59bd70592725 --- /dev/null +++ b/sc/inc/docpool.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * 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 USHORT* pVersionMap1; + static USHORT* pVersionMap2; + static USHORT* pVersionMap3; + static USHORT* pVersionMap4; + static USHORT* pVersionMap5; + static USHORT* pVersionMap6; + static USHORT* pVersionMap7; + static USHORT* pVersionMap8; + static USHORT* pVersionMap9; + static USHORT* pVersionMap10; + static USHORT* pVersionMap11; + +public: + ScDocumentPool( SfxItemPool* pSecPool = NULL, BOOL bLoadRefCounts = FALSE ); +protected: + virtual ~ScDocumentPool(); +public: + + virtual SfxItemPool* Clone() const; + virtual SfxMapUnit GetMetric( USHORT nWhich ) const; + + virtual const SfxPoolItem& Put( const SfxPoolItem&, USHORT nWhich = 0 ); + virtual void Remove( const SfxPoolItem& ); + static void CheckRef( const SfxPoolItem& ); + + void StyleDeleted( ScStyleSheet* pStyle ); // Loeschen von Vorlagen im 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 diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx new file mode 100644 index 000000000000..5c4685223281 --- /dev/null +++ b/sc/inc/document.hxx @@ -0,0 +1,1871 @@ +/************************************************************************* + * + * 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 <vos/ref.hxx> +#include "scdllapi.h" +#include "table.hxx" // FastGetRowHeight (inline) +#include "rangelst.hxx" +#include "brdcst.hxx" +#include "tabopparams.hxx" +#include "formula/grammar.hxx" +#include <com/sun/star/chart2/XChartDocument.hpp> +#include "scdllapi.h" + +#include <memory> +#include <map> +#include <set> + +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include <list> +#include "dpobject.hxx" +#include "dptabdat.hxx" +// End Comments + +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 SvxBorderLine; +class SvxBoxInfoItem; +class SvxBoxItem; +class SvxBrushItem; +class SvxForbiddenCharactersTable; +namespace sfx2 { + class LinkManager; + } +class SvxSearchItem; +class SvxShadowItem; +class Window; +class XColorTable; +class List; + +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 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; + +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> +/* +#ifdef _ZFORLIST_DECLARE_TABLE +class SvNumberFormatterIndexTable; +#else +class Table; +typedef Table SvNumberFormatterIndexTable; +#endif +*/ + +#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; + ULONG nCellCount; + USHORT nPageCount; +}; + +// The constant parameters to CopyBlockFromClip +struct ScCopyBlockFromClipParams +{ + ScDocument* pRefUndoDoc; + ScDocument* pClipDoc; + USHORT nInsFlag; + SCTAB nTabStart; + SCTAB nTabEnd; + BOOL bAsLink; + BOOL bSkipAttrForEmpty; +}; + + +// for loading of binary file format symbol string cells which need font conversion +struct ScSymbolStringCellEntry +{ + ScStringCell* pCell; + SCROW nRow; +}; + + +// ----------------------------------------------------------------------- + +// DDE link modes +const BYTE SC_DDE_DEFAULT = 0; +const BYTE SC_DDE_ENGLISH = 1; +const BYTE SC_DDE_TEXT = 2; +const BYTE 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; + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceManager; + + vos::ORef<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; // bedingte Formate + ScValidationDataList* pValidationList; // Gueltigkeit + SvNumberFormatterIndexTable* pFormatExchangeList; // zum Umsetzen von Zahlenformaten + ScTable* pTab[MAXTABCOUNT]; + ScRangeName* pRangeName; + ScDBCollection* pDBCollection; + ScDPCollection* pDPCollection; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + std::list<ScDPObject> m_listDPObjectsInClip; + std::list<ScDPTableDataCache*> m_listDPObjectsCaches; + // End Comments + ScChartCollection* pChartCollection; + std::auto_ptr< ScTemporaryChartLock > apTemporaryChartLock; + ScPatternAttr* pSelectionAttr; // Attribute eines Blocks + mutable sfx2::LinkManager* pLinkManager; + ScFormulaCell* pFormulaTree; // Berechnungsbaum Start + ScFormulaCell* pEOFormulaTree; // Berechnungsbaum Ende, letzte Zelle + ScFormulaCell* pFormulaTrack; // BroadcastTrack Start + ScFormulaCell* pEOFormulaTrack; // BrodcastTrack Ende, letzte Zelle + 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; + vos::ORef<SvxForbiddenCharactersTable> xForbiddenCharacters; + + ScFieldEditEngine* pCacheFieldEditEngine; + + ::std::auto_ptr<ScDocProtection> pDocProtection; + ::std::auto_ptr<ScClipParam> mpClipParam; + + ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr; + + // mutable for lazy construction + mutable ::std::auto_ptr< ScFormulaParserPool > + mxFormulaParserPool; /// Pool for all external formula parsers used by this document. + + String aDocName; // opt: Dokumentname + String aDocCodeName; // opt: Dokumentname + ScRangePairListRef xColNameRanges; + ScRangePairListRef xRowNameRanges; + + ScViewOptions* pViewOptions; // View-Optionen + ScDocOptions* pDocOptions; // Dokument-Optionen + ScExtDocOptions* pExtDocOptions; // fuer 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: + ScTabOpList 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; // Einlesen: Quell-Zeichensatz + + /** 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; + + ULONG nFormulaCodeInTree; // FormelRPN im Formelbaum + ULONG nXMLImportedFormulaCount; // progress count during XML import + USHORT nInterpretLevel; // >0 wenn im Interpreter + USHORT nMacroInterpretLevel; // >0 wenn Macro im Interpreter + USHORT nInterpreterTableOpLevel; // >0 if in Interpreter TableOp + SCTAB nMaxTableNumber; + USHORT nSrcVer; // Dateiversion (Laden/Speichern) + SCROW nSrcMaxRow; // Zeilenzahl zum Laden/Speichern + USHORT nFormulaTrackCount; + USHORT nHardRecalcState; // 0: soft, 1: hard-warn, 2: hard + SCTAB nVisibleTab; // fuer OLE etc. + + ScLkUpdMode eLinkMode; + + BOOL bAutoCalc; // Automatisch Berechnen + BOOL bAutoCalcShellDisabled; // in/von/fuer ScDocShell disabled + // ob noch ForcedFormulas berechnet werden muessen, + // im Zusammenspiel mit ScDocShell SetDocumentModified, + // AutoCalcShellDisabled und TrackFormulas + BOOL bForcedFormulaPending; + BOOL bCalculatingFormulaTree; + BOOL bIsClip; + BOOL bIsUndo; + BOOL bIsVisible; // set from view ctor + + BOOL bIsEmbedded; // Embedded-Bereich anzeigen/anpassen ? + + // kein SetDirty bei ScFormulaCell::CompileTokenArray sondern am Ende + // von ScDocument::CompileAll[WithFormats], CopyScenario, CopyBlockFromClip + BOOL bNoSetDirty; + // kein Broadcast, keine Listener aufbauen waehrend aus einem anderen + // Doc (per Filter o.ae.) inserted wird, erst bei CompileAll / CalcAfterLoad + BOOL bInsertingFromOtherDoc; + bool bLoadingMedium; + bool bImportingXML; // special handling of formula text + BOOL bXMLFromWrapper; // distinguish ScXMLImportWrapper from external component + BOOL bCalcingAfterLoad; // in CalcAfterLoad TRUE + // wenn temporaer keine Listener auf/abgebaut werden sollen + BOOL bNoListening; + BOOL bIdleDisabled; + BOOL bInLinkUpdate; // TableLink or AreaLink + BOOL bChartListenerCollectionNeedsUpdate; + // ob RC_FORCED Formelzellen im Dokument sind/waren (einmal an immer an) + BOOL bHasForcedFormulas; + // ob das Doc gerade zerstoert wird (kein Notify-Tracking etc. mehr) + BOOL bInDtorClear; + // ob bei Spalte/Zeile einfuegen am Rand einer Referenz die Referenz + // erweitert wird, wird in jedem UpdateReference aus InputOptions geholt, + // gesetzt und am Ende von UpdateReference zurueckgesetzt + BOOL bExpandRefs; + // fuer Detektiv-Update, wird bei jeder Aenderung an Formeln gesetzt + BOOL bDetectiveDirty; + + BYTE nMacroCallMode; // Makros per Warnung-Dialog disabled? + BOOL bHasMacroFunc; // valid only after loading + + BYTE nVisSpellState; + + BYTE nAsianCompression; + BYTE nAsianKerning; + BOOL bSetDrawDefaults; + + BOOL bPastingDrawFromOtherDoc; + + BYTE nInDdeLinkUpdate; // originating DDE links (stacked bool) + + BOOL bInUnoBroadcast; + BOOL bInUnoListenerCall; + formula::FormulaGrammar::Grammar eGrammar; + + mutable 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; + +public: + SC_DLLPUBLIC ULONG GetCellCount() const; // alle Zellen + SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const; + ULONG GetWeightedCount() const; // Formeln und Edit staerker gewichtet + ULONG GetCodeCount() const; // RPN-Code in Formeln + DECL_LINK( GetUserDefinedColor, USHORT * ); + // Numberformatter + +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 = sal_False ); + + ScFieldEditEngine* CreateFieldEditEngine(); + void DisposeFieldEditEngine(ScFieldEditEngine*& rpEditEngine); + + SC_DLLPUBLIC ScRangeName* GetRangeName(); + 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, + BOOL bRemoveAutoFilter = FALSE ); + ScDBData* GetDBAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, + BOOL bStartOnly = FALSE) const; + ScDBData* GetDBAtArea(SCTAB nTab, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2) const; + +//UNUSED2008-05 ScRangeData* GetRangeAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab, +//UNUSED2008-05 BOOL bStartOnly = FALSE) const; + SC_DLLPUBLIC 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; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + SC_DLLPUBLIC ScDPTableDataCache* GetDPObjectCache( long nID ); + SC_DLLPUBLIC ScDPTableDataCache* GetUsedDPObjectCache ( ScRange rRange ); + SC_DLLPUBLIC long AddDPObjectCache( ScDPTableDataCache* pData ); + SC_DLLPUBLIC void RemoveDPObjectCache( long nID ); + SC_DLLPUBLIC void RemoveUnusedDPObjectCaches(); + SC_DLLPUBLIC void GetUsedDPObjectCache( std::list<ScDPTableDataCache*>& usedlist ); + SC_DLLPUBLIC long GetNewDPObjectCacheId (); + // End Comments + + SC_DLLPUBLIC ScChartCollection* GetChartCollection() const; + + void StopTemporaryChartLock(); + + void EnsureGraphicNames(); + + SdrObject* GetObjectAtPoint( SCTAB nTab, const Point& rPos ); + 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, + BOOL bColHeaders, BOOL bRowHeaders, BOOL bAdd ); + void UpdateChartArea( const String& rChartName, + const ScRangeListRef& rNewList, + BOOL bColHeaders, BOOL bRowHeaders, BOOL bAdd ); + void GetOldChartParameters( const String& rName, + ScRangeList& rRanges, BOOL& rColHeaders, 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 BOOL HasTable( SCTAB nTab ) const; + SC_DLLPUBLIC BOOL GetName( SCTAB nTab, String& rName ) const; + SC_DLLPUBLIC BOOL GetCodeName( SCTAB nTab, String& rName ) const; + SC_DLLPUBLIC BOOL SetCodeName( SCTAB nTab, String& rName ); + SC_DLLPUBLIC BOOL GetTable( const String& rName, SCTAB& rTab ) const; + 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 BOOL IsDocProtected() const; + BOOL IsDocEditable() const; + SC_DLLPUBLIC 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); + + BOOL IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + BOOL* pOnlyNotBecauseOfMatrix = NULL ) const; + BOOL IsSelectionEditable( const ScMarkData& rMark, + BOOL* pOnlyNotBecauseOfMatrix = NULL ) const; + BOOL HasSelectedBlockMatrixFragment( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + const ScMarkData& rMark ) const; + + BOOL GetMatrixFormulaRange( const ScAddress& rCellPos, ScRange& rMatrix ); + + 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 ); // aus VisArea (1/100 mm) + void SnapVisArea( Rectangle& rRect ) const; // 1/100 mm + + SC_DLLPUBLIC BOOL ValidTabName( const String& rName ) const; + SC_DLLPUBLIC BOOL ValidNewTabName( const String& rName ) const; + SC_DLLPUBLIC void CreateValidTabName(String& rName) const; + SC_DLLPUBLIC BOOL InsertTab( SCTAB nPos, const String& rName, + BOOL bExternalDocument = FALSE ); + SC_DLLPUBLIC BOOL DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc = NULL ); + SC_DLLPUBLIC BOOL RenameTab( SCTAB nTab, const String& rName, + BOOL bUpdateRef = TRUE, + BOOL bExternalDocument = FALSE ); + BOOL MoveTab( SCTAB nOldPos, SCTAB nNewPos ); + BOOL CopyTab( SCTAB nOldPos, SCTAB nNewPos, + const ScMarkData* pOnlyMarked = NULL ); + SC_DLLPUBLIC ULONG TransferTab(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos, + BOOL bInsertNew = TRUE, + BOOL bResultsOnly = FALSE ); + SC_DLLPUBLIC void TransferDrawPage(ScDocument* pSrcDoc, SCTAB nSrcPos, SCTAB nDestPos); + SC_DLLPUBLIC void SetVisible( SCTAB nTab, BOOL bVisible ); + SC_DLLPUBLIC BOOL IsVisible( SCTAB nTab ) const; + BOOL IsStreamValid( SCTAB nTab ) const; + void SetStreamValid( SCTAB nTab, BOOL bSet, BOOL bIgnoreLock = FALSE ); + void LockStreamValid( bool bLock ); + bool IsStreamValidLocked() const { return mbStreamValidLocked; } + BOOL IsPendingRowHeights( SCTAB nTab ) const; + void SetPendingRowHeights( SCTAB nTab, BOOL bSet ); + SC_DLLPUBLIC void SetLayoutRTL( SCTAB nTab, BOOL bRTL ); + SC_DLLPUBLIC BOOL IsLayoutRTL( SCTAB nTab ) const; + BOOL IsNegativePage( SCTAB nTab ) const; + SC_DLLPUBLIC void SetScenario( SCTAB nTab, BOOL bFlag ); + SC_DLLPUBLIC BOOL IsScenario( SCTAB nTab ) const; + SC_DLLPUBLIC void GetScenarioData( SCTAB nTab, String& rComment, + Color& rColor, USHORT& rFlags ) const; + SC_DLLPUBLIC void SetScenarioData( SCTAB nTab, const String& rComment, + const Color& rColor, USHORT 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, USHORT& rFlags ) const; + SC_DLLPUBLIC BOOL IsActiveScenario( SCTAB nTab ) const; + SC_DLLPUBLIC void SetActiveScenario( SCTAB nTab, BOOL bActive ); // nur fuer Undo etc. + SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const; + SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const; + void SetGrammar( formula::FormulaGrammar::Grammar eGram ); + SC_DLLPUBLIC BYTE GetLinkMode( SCTAB nTab ) const; + 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; + ULONG GetLinkRefreshDelay( SCTAB nTab ) const; + void SetLink( SCTAB nTab, BYTE nMode, const String& rDoc, + const String& rFilter, const String& rOptions, + const String& rTabName, ULONG nRefreshDelay ); + BOOL HasLink( const String& rDoc, + const String& rFilter, const String& rOptions ) const; + SC_DLLPUBLIC 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; + + BOOL HasDdeLinks() const; + BOOL HasAreaLinks() const; + void UpdateExternalRefLinks(); + void UpdateDdeLinks(); + void UpdateAreaLinks(); + + // originating DDE links + void IncInDdeLinkUpdate() { if ( nInDdeLinkUpdate < 255 ) ++nInDdeLinkUpdate; } + void DecInDdeLinkUpdate() { if ( nInDdeLinkUpdate ) --nInDdeLinkUpdate; } + BOOL IsInDdeLinkUpdate() const { return nInDdeLinkUpdate != 0; } + + SC_DLLPUBLIC void CopyDdeLinks( ScDocument* pDestDoc ) const; + void DisconnectDdeLinks(); + + // Fuer StarOne Api: + USHORT GetDdeLinkCount() const; + 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, BYTE nMode, USHORT& 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( USHORT 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( USHORT nDdePos, BYTE& 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( USHORT 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 occured, no DDE link created. */ + SC_DLLPUBLIC bool CreateDdeLink( const String& rAppl, const String& rTopic, const String& rItem, BYTE nMode, ScMatrix* pResults = NULL ); + /** 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( USHORT nDdePos, ScMatrix* pResults ); + + + SfxBindings* GetViewBindings(); + SfxObjectShell* GetDocumentShell() const { return pShell; } + ScDrawLayer* GetDrawLayer() { return pDrawLayer; } + SfxBroadcaster* GetDrawBroadcaster(); // zwecks Header-Vermeidung + 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 ); + + // #109985# + 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 ); + //! setzt nur die neue RangeList, keine ChartListener o.ae. + void SetChartRangeList( const String& rChartName, + const ScRangeListRef& rNewRangeListRef ); + + BOOL HasControl( SCTAB nTab, const Rectangle& rMMRect ); + void InvalidateControls( Window* pWin, SCTAB nTab, const Rectangle& rMMRect ); + + void StartAnimations( SCTAB nTab, Window* pWin ); + + BOOL HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect ); + 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 HasCalcNotification( SCTAB nTab ) const; + void SetCalcNotification( SCTAB nTab ); + void ResetCalcNotifications(); + + SC_DLLPUBLIC ScOutlineTable* GetOutlineTable( SCTAB nTab, BOOL bCreate = FALSE ); + BOOL SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline ); + + void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); + + BOOL DoSubTotals( SCTAB nTab, ScSubTotalParam& rParam ); + void RemoveSubTotals( SCTAB nTab, ScSubTotalParam& rParam ); + BOOL TestRemoveSubTotals( SCTAB nTab, const ScSubTotalParam& rParam ); + BOOL HasSubTotalCells( const ScRange& rRange ); + + SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, BOOL bForceTab = FALSE ); +//UNUSED2009-05 SC_DLLPUBLIC void PutCell( const ScAddress&, ScBaseCell* pCell, +//UNUSED2009-05 ULONG nFormatIndex, BOOL bForceTab = FALSE); + SC_DLLPUBLIC void PutCell( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, + BOOL bForceTab = FALSE ); + SC_DLLPUBLIC void PutCell(SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell, + ULONG nFormatIndex, BOOL bForceTab = FALSE); + // return TRUE = Zahlformat gesetzt + SC_DLLPUBLIC BOOL SetString( + SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true ); + SC_DLLPUBLIC void SetValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rVal ); + void SetError( SCCOL nCol, SCROW nRow, SCTAB nTab, const USHORT 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, // Mehrfachoperation + 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 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, ULONG nFormat ); + SC_DLLPUBLIC void GetNumberFormat( SCCOL nCol, SCROW nRow, SCTAB nTab, + sal_uInt32& rFormat ); + 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, ULONG& nIndex, + const ScAddress& rPos, const ScBaseCell* pCell ) const; + void GetFormula( SCCOL nCol, SCROW nRow, SCTAB nTab, String& rFormula, + BOOL bAsciiExport = FALSE ) 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; + +//UNUSED2008-05 void RefreshNoteFlags(); + + SC_DLLPUBLIC BOOL HasData( SCCOL nCol, SCROW nRow, SCTAB nTab ); + SC_DLLPUBLIC BOOL HasStringData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + SC_DLLPUBLIC BOOL HasValueData( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + BOOL HasStringCells( const ScRange& rRange ) const; + + /** Returns true, if there is any data to create a selection list for rPos. */ + 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 ); + + BOOL ExtendMergeSel( SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW& rEndRow, const ScMarkData& rMark, + BOOL bRefresh = FALSE, BOOL bAttrs = FALSE ); + BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW& rEndRow, SCTAB nTab, + BOOL bRefresh = FALSE, BOOL bAttrs = FALSE ); + BOOL ExtendMerge( ScRange& rRange, BOOL bRefresh = FALSE, BOOL bAttrs = FALSE ); + BOOL ExtendTotalMerge( ScRange& rRange ); + SC_DLLPUBLIC BOOL ExtendOverlapped( SCCOL& rStartCol, SCROW& rStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab ); + SC_DLLPUBLIC BOOL ExtendOverlapped( ScRange& rRange ); + + 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 ); + // ohne Ueberpruefung: + 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 ); + + BOOL IsBlockEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, bool bIgnoreNotes = false ) const; + BOOL IsPrintEmpty( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + BOOL bLeftIsEmpty = FALSE, + ScRange* pLastRange = NULL, + Rectangle* pLastMM = NULL ) const; + + BOOL IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + 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, USHORT nMask ); + SC_DLLPUBLIC bool HasAttrib( const ScRange& rRange, USHORT nMask ); + + void GetBorderLines( SCCOL nCol, SCROW nRow, SCTAB nTab, + const SvxBorderLine** ppLeft, + const SvxBorderLine** ppTop, + const SvxBorderLine** ppRight, + const 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(); + + // Automatisch Berechnen + void SetAutoCalc( BOOL bNewAutoCalc ); + BOOL GetAutoCalc() const { return bAutoCalc; } + // Automatisch Berechnen in/von/fuer ScDocShell disabled + void SetAutoCalcShellDisabled( BOOL bNew ) { bAutoCalcShellDisabled = bNew; } + BOOL IsAutoCalcShellDisabled() const { return bAutoCalcShellDisabled; } + // ForcedFormulas zu berechnen + void SetForcedFormulaPending( BOOL bNew ) { bForcedFormulaPending = bNew; } + BOOL IsForcedFormulaPending() const { return bForcedFormulaPending; } + // if CalcFormulaTree() is currently running + BOOL IsCalculatingFormulaTree() { return bCalculatingFormulaTree; } + + USHORT 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. */ + bool ShrinkToDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ) const; + + /** Shrink a range to only include used data area. */ + bool ShrinkToUsedDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow, bool bColumnsOnly ) const; + + void GetDataArea( SCTAB nTab, SCCOL& rStartCol, SCROW& rStartRow, + SCCOL& rEndCol, SCROW& rEndRow, BOOL bIncludeOld, bool bOnlyDown ) const; + SC_DLLPUBLIC BOOL GetCellArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; + SC_DLLPUBLIC BOOL GetTableArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow ) const; + SC_DLLPUBLIC BOOL GetPrintArea( SCTAB nTab, SCCOL& rEndCol, SCROW& rEndRow, + BOOL bNotes = TRUE ) const; + SC_DLLPUBLIC BOOL GetPrintAreaHor( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, + SCCOL& rEndCol, BOOL bNotes = TRUE ) const; + SC_DLLPUBLIC BOOL GetPrintAreaVer( SCTAB nTab, SCCOL nStartCol, SCCOL nEndCol, + SCROW& rEndRow, BOOL bNotes = TRUE ) const; + void InvalidateTableArea(); + + + SC_DLLPUBLIC 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 ); + + 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, + BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark ); + + 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 ); + + BOOL InsertRow( SCCOL nStartCol, SCTAB nStartTab, + SCCOL nEndCol, SCTAB nEndTab, + SCROW nStartRow, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL, + const ScMarkData* pTabMark = NULL ); + SC_DLLPUBLIC 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, BOOL* pUndoOutline = NULL, + const ScMarkData* pTabMark = NULL ); + void DeleteRow( const ScRange& rRange, + ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL ); + BOOL InsertCol( SCROW nStartRow, SCTAB nStartTab, + SCROW nEndRow, SCTAB nEndTab, + SCCOL nStartCol, SCSIZE nSize, ScDocument* pRefUndoDoc = NULL, + const ScMarkData* pTabMark = NULL ); + SC_DLLPUBLIC 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, BOOL* pUndoOutline = NULL, + const ScMarkData* pTabMark = NULL ); + void DeleteCol( const ScRange& rRange, + ScDocument* pRefUndoDoc = NULL, BOOL* pUndoOutline = NULL ); + + BOOL CanInsertRow( const ScRange& rRange ) const; + BOOL CanInsertCol( const ScRange& rRange ) const; + + void FitBlock( const ScRange& rOld, const ScRange& rNew, BOOL bClear = TRUE ); + BOOL CanFitBlock( const ScRange& rOld, const ScRange& rNew ); + + BOOL IsClipOrUndo() const { return bIsClip || bIsUndo; } + BOOL IsUndo() const { return bIsUndo; } + 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( BOOL bCut ); + BOOL IsCutMode(); + void SetClipArea( const ScRange& rArea, BOOL bCut = FALSE ); + + SC_DLLPUBLIC BOOL IsDocVisible() const { return bIsVisible; } + void SetDocVisible( BOOL bSet ); + + 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, USHORT nDelFlag); + void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCTAB nTab, USHORT nDelFlag); + void DeleteAreaTab(const ScRange& rRange, USHORT 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 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, USHORT nInsFlag ); + void BroadcastFromClip( SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, + const ScMarkData& rMark, USHORT 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, + USHORT nInsFlag, + ScDocument* pRefUndoDoc = NULL, + ScDocument* pClipDoc = NULL, + BOOL bResetCut = TRUE, + BOOL bAsLink = FALSE, + BOOL bIncludeFiltered = TRUE, + 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, BOOL bIncludeFiltered); + void GetClipStart(SCCOL& nClipX, SCROW& nClipY); + + BOOL HasClipFilteredRows(); + + BOOL IsClipboardSource() const; + + SC_DLLPUBLIC void TransposeClip( ScDocument* pTransClip, USHORT nFlags, BOOL bAsLink ); + + ScClipParam& GetClipParam(); + void SetClipParam(const ScClipParam& rParam); + + void MixDocument( const ScRange& rRange, USHORT nFunction, BOOL bSkipEmpty, + ScDocument* pSrcDoc ); + + void FillTab( const ScRange& rSrcArea, const ScMarkData& rMark, + USHORT nFlags, USHORT nFunction, + BOOL bSkipEmpty, BOOL bAsLink ); + void FillTabMarked( SCTAB nSrcTab, const ScMarkData& rMark, + USHORT nFlags, USHORT nFunction, + BOOL bSkipEmpty, BOOL bAsLink ); + + void TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nType ); + + SC_DLLPUBLIC void InitUndo( ScDocument* pSrcDoc, SCTAB nTab1, SCTAB nTab2, + BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE ); + void AddUndoTab( SCTAB nTab1, SCTAB nTab2, + BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE ); + SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection, + BOOL bColInfo = FALSE, BOOL bRowInfo = FALSE ); + + // nicht mehr benutzen: + void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL, BOOL bColRowFlags = TRUE); + void UndoToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, + SCCOL nCol2, SCROW nRow2, SCTAB nTab2, + USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL); + + void CopyToDocument(const ScRange& rRange, + USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL, BOOL bColRowFlags = TRUE); + void UndoToDocument(const ScRange& rRange, + USHORT nFlags, BOOL bMarked, ScDocument* pDestDoc, + const ScMarkData* pMarks = NULL); + + void CopyScenario( SCTAB nSrcTab, SCTAB nDestTab, BOOL bNewScenario = FALSE ); + BOOL TestCopyScenario( SCTAB nSrcTab, SCTAB nDestTab ) const; + void MarkScenario( SCTAB nSrcTab, SCTAB nDestTab, + ScMarkData& rDestMark, BOOL bResetMark = TRUE, + USHORT nNeededBits = 0 ) const; + 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, BOOL bIncludeDraw = 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, + 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 ); + + BOOL GetSelectionFunction( ScSubTotalFunc eFunc, + const ScAddress& rCursor, const ScMarkData& rMark, + double& rResult ); + + SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, USHORT 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, BOOL bDeep = TRUE ); + ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, BOOL bDeep = 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, USHORT nWhich ) const; + + SC_DLLPUBLIC const ::com::sun::star::uno::Reference< ::com::sun::star::i18n::XBreakIterator >& GetBreakIterator(); + BOOL HasStringWeakCharacters( const String& rString ); + SC_DLLPUBLIC BYTE GetStringScriptType( const String& rString ); + SC_DLLPUBLIC BYTE GetCellScriptType( ScBaseCell* pCell, ULONG nNumberFormat ); + SC_DLLPUBLIC BYTE GetScriptType( SCCOL nCol, SCROW nRow, SCTAB nTab, ScBaseCell* pCell = NULL ); + + BOOL HasDetectiveOperations() const; + void AddDetectiveOperation( const ScDetOpData& rData ); + void ClearDetectiveOperations(); + ScDetOpList* GetDetOpList() const { return pDetOpList; } + void SetDetOpList(ScDetOpList* pNew); + + 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 USHORT* pWhich, const ScMarkData& rMark ); + void ChangeSelectionIndent( BOOL bIncrement, const ScMarkData& rMark ); + + SC_DLLPUBLIC ULONG AddCondFormat( const ScConditionalFormat& rNew ); + SC_DLLPUBLIC void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges ); + SC_DLLPUBLIC void FindConditionalFormat( ULONG nKey, ScRangeList& rRanges, SCTAB nTab ); + void ConditionalChanged( ULONG nKey ); + + SC_DLLPUBLIC ULONG AddValidationEntry( const ScValidationData& rNew ); + + SC_DLLPUBLIC const ScValidationData* GetValidationEntry( 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 ); + SC_DLLPUBLIC void ApplyPatternAreaTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, + const ScPatternAttr& rAttr ); + 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 SvxBorderLine* pLine, BOOL bColorOnly ); + + const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow, SCTAB nTab ) const; + const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark ) const; + + void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, BOOL bRemoved, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY ); + + BOOL IsStyleSheetUsed( const ScStyleSheet& rStyle, BOOL bGatherAllStyles ) const; + + SC_DLLPUBLIC BOOL ApplyFlagsTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab, INT16 nFlags ); + BOOL RemoveFlagsTab( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab, INT16 nFlags ); + + SC_DLLPUBLIC void SetPattern( const ScAddress&, const ScPatternAttr& rAttr, + BOOL bPutToPool = FALSE ); + SC_DLLPUBLIC void SetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScPatternAttr& rAttr, + BOOL bPutToPool = FALSE ); + void DeleteNumberFormat( const sal_uInt32* pDelKeys, sal_uInt32 nCount ); + + void AutoFormat( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + USHORT nFormatNo, const ScMarkData& rMark ); + void GetAutoFormatData( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + ScAutoFormatData& rData ); + BOOL SearchAndReplace( const SvxSearchItem& rSearchItem, + SCCOL& rCol, SCROW& rRow, SCTAB& rTab, + ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc = NULL ); + + // Col/Row von Folgeaufrufen bestimmen + // (z.B. nicht gefunden von Anfang, oder folgende Tabellen) + static void GetSearchAndReplaceStart( const SvxSearchItem& rSearchItem, + SCCOL& rCol, SCROW& rRow ); + + 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 ); + void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark ); + void DeleteSelectionTab( SCTAB nTab, USHORT nDelFlag, const ScMarkData& rMark ); + + SC_DLLPUBLIC void SetColWidth( SCCOL nCol, SCTAB nTab, USHORT nNewWidth ); + SC_DLLPUBLIC void SetRowHeight( SCROW nRow, SCTAB nTab, USHORT nNewHeight ); + SC_DLLPUBLIC void SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, + USHORT nNewHeight ); + + SC_DLLPUBLIC void SetRowHeightOnly( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, + USHORT nNewHeight ); + void SetManualHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BOOL bManual ); + + SC_DLLPUBLIC USHORT GetColWidth( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab, bool bHiddenAsZero = true ) const; + SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCTAB nTab, SCROW* pStartRow, SCROW* pEndRow, bool bHiddenAsZero = true ) const; + SC_DLLPUBLIC ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const; + SCROW GetRowForHeight( SCTAB nTab, ULONG nHeight ) const; + ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, double fScale ) const; + SC_DLLPUBLIC ULONG GetColOffset( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC ULONG GetRowOffset( SCROW nRow, SCTAB nTab ) const; + + SC_DLLPUBLIC USHORT GetOriginalWidth( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC USHORT GetOriginalHeight( SCROW nRow, SCTAB nTab ) const; + + USHORT GetCommonWidth( SCCOL nEndCol, SCTAB nTab ) const; + + SCROW GetHiddenRowCount( SCROW nRow, SCTAB nTab ) const; + + USHORT GetOptimalColWidth( SCCOL nCol, SCTAB nTab, OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + BOOL bFormula, + const ScMarkData* pMarkData = NULL, + BOOL bSimpleTextImport = FALSE ); + SC_DLLPUBLIC BOOL SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, USHORT nExtra, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + 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, + BOOL bWidth, BOOL bTotalSize = FALSE ); + + SC_DLLPUBLIC void ShowCol(SCCOL nCol, SCTAB nTab, BOOL bShow); + SC_DLLPUBLIC void ShowRow(SCROW nRow, SCTAB nTab, BOOL bShow); + SC_DLLPUBLIC void ShowRows(SCROW nRow1, SCROW nRow2, SCTAB nTab, BOOL bShow); + SC_DLLPUBLIC void SetColFlags( SCCOL nCol, SCTAB nTab, BYTE nNewFlags ); + SC_DLLPUBLIC void SetRowFlags( SCROW nRow, SCTAB nTab, BYTE nNewFlags ); + SC_DLLPUBLIC void SetRowFlags( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, BYTE nNewFlags ); + + SC_DLLPUBLIC BYTE GetColFlags( SCCOL nCol, SCTAB nTab ) const; + SC_DLLPUBLIC BYTE GetRowFlags( SCROW nRow, SCTAB nTab ) const; + + SC_DLLPUBLIC const ScBitMaskCompressedArray< SCROW, BYTE> & GetRowFlagsArray( SCTAB nTab ) const; + SC_DLLPUBLIC ScBitMaskCompressedArray< SCROW, BYTE> & 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 RowHidden(SCROW nRow, SCTAB nTab, SCROW& rLastRow); + SC_DLLPUBLIC bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow, SCTAB nTab); + SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL& rLastCol); + 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); + SC_DLLPUBLIC void SetColFiltered(SCCOL nStartCol, SCCOL nEndCol, 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; + + // #108550#; 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 + BOOL GetColDefault( SCTAB nTab, SCCOL nCol, SCROW nLastRow, SCROW& nDefault); + BOOL GetRowDefault( SCTAB nTab, SCROW nRow, SCCOL nLastCol, SCCOL& nDefault); + + BOOL UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, SCTAB nTab, BOOL bShow ); + BOOL UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, 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 ); + BOOL HasManualBreaks( SCTAB nTab ) const; + + BOOL IsPageStyleInUse( const String& rStrPageStyle, SCTAB* pInTab = NULL ); + BOOL RemovePageStyleInUse( const String& rStrPageStyle ); + BOOL RenamePageStyleInUse( const String& rOld, const String& rNew ); + void ModifyStyleSheet( SfxStyleSheetBase& rPageStyle, + const SfxItemSet& rChanges ); + + void PageStyleModified( SCTAB nTab, const String& rNewName ); + + SC_DLLPUBLIC BOOL NeedPageResetAfterTab( SCTAB nTab ) const; + + // war vorher im PageStyle untergracht. Jetzt an jeder Tabelle: + SC_DLLPUBLIC BOOL HasPrintRange(); + SC_DLLPUBLIC USHORT GetPrintRangeCount( SCTAB nTab ); + SC_DLLPUBLIC const ScRange* GetPrintRange( SCTAB nTab, USHORT nPos ); + SC_DLLPUBLIC const ScRange* GetRepeatColRange( SCTAB nTab ); + SC_DLLPUBLIC const ScRange* GetRepeatRowRange( SCTAB nTab ); + /** Returns true, if the specified sheet is always printed. */ + 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 ); +//UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */ +//UNUSED2009-05 void SetPrintRange( 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 ); + SC_DLLPUBLIC ScRange GetRange( SCTAB nTab, const Rectangle& rMMRect ); + + void UpdStlShtPtrsFrmNms(); + void StylesToNames(); + + SC_DLLPUBLIC void CopyStdStylesFrom( ScDocument* pSrcDoc ); + + CharSet GetSrcCharSet() const { return eSrcSet; } + 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, + BOOL bPageMode, BOOL bFormulaMode, + const ScMarkData* pMarkData = NULL ); + + SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const; + + void Sort( SCTAB nTab, const ScSortParam& rSortParam, BOOL bKeepQuery ); + SCSIZE Query( SCTAB nTab, const ScQueryParam& rQueryParam, BOOL bKeepSub ); + BOOL ValidQuery( SCROW nRow, SCTAB nTab, const ScQueryParam& rQueryParam, BOOL* pSpecial = NULL ); + SC_DLLPUBLIC BOOL CreateQueryParam( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + SCTAB nTab, ScQueryParam& rQueryParam ); + void GetUpperCellString(SCCOL nCol, SCROW nRow, SCTAB nTab, String& rStr); + + BOOL GetFilterEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, + bool bFilter, TypedScStrCollection& rStrings, bool& rHasDates); + SC_DLLPUBLIC BOOL GetFilterEntriesArea( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, + SCTAB nTab, TypedScStrCollection& rStrings, bool& rHasDates ); + BOOL GetDataEntries( SCCOL nCol, SCROW nRow, SCTAB nTab, + TypedScStrCollection& rStrings, BOOL bLimit = FALSE ); + BOOL GetFormulaEntries( TypedScStrCollection& rStrings ); + + BOOL HasAutoFilter( SCCOL nCol, SCROW nRow, SCTAB nTab ); + + SC_DLLPUBLIC BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab ); + SC_DLLPUBLIC BOOL HasRowHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + SCTAB nTab ); + + SfxPrinter* GetPrinter( BOOL bCreateIfNotExist = TRUE ); + void SetPrinter( SfxPrinter* pNewPrinter ); + VirtualDevice* GetVirtualDevice_100th_mm(); + SC_DLLPUBLIC OutputDevice* GetRefDevice(); // WYSIWYG: Printer, otherwise VirtualDevice... + + void EraseNonUsedSharedNames(USHORT nLevel); + BOOL GetNextSpellingCell(SCCOL& nCol, SCROW& nRow, SCTAB nTab, + BOOL bInSel, const ScMarkData& rMark) const; + + BOOL ReplaceStyle(const SvxSearchItem& rSearchItem, + SCCOL nCol, SCROW nRow, SCTAB nTab, + ScMarkData& rMark, 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, BOOL bNumFormatChanged ); + + BOOL IdleCalcTextWidth(); + BOOL IdleCheckLinks(); + + BOOL ContinueOnlineSpelling(); // TRUE = etwas gefunden + + BOOL IsIdleDisabled() const { return bIdleDisabled; } + void DisableIdle(BOOL bDo) { bIdleDisabled = bDo; } + + BOOL IsDetectiveDirty() const { return bDetectiveDirty; } + void SetDetectiveDirty(BOOL bSet) { bDetectiveDirty = bSet; } + + void RemoveAutoSpellObj(); + void SetOnlineSpellPos( const ScAddress& rPos ); + SC_DLLPUBLIC BOOL SetVisibleSpellRange( const ScRange& rRange ); // TRUE = changed + + BYTE GetMacroCallMode() const { return nMacroCallMode; } + void SetMacroCallMode(BYTE nNew) { nMacroCallMode = nNew; } + + BOOL GetHasMacroFunc() const { return bHasMacroFunc; } + void SetHasMacroFunc(BOOL bSet) { bHasMacroFunc = bSet; } + + BOOL CheckMacroWarn(); + + void SetRangeOverflowType(sal_uInt32 nType) { nRangeOverflowType = nType; } + sal_Bool HasRangeOverflow() const { return nRangeOverflowType != 0; } + SC_DLLPUBLIC sal_uInt32 GetRangeOverflowType() const { return nRangeOverflowType; } + + // fuer Broadcasting/Listening + void SetNoSetDirty( BOOL bVal ) { bNoSetDirty = bVal; } + BOOL GetNoSetDirty() const { return bNoSetDirty; } + void SetInsertingFromOtherDoc( BOOL bVal ) { bInsertingFromOtherDoc = bVal; } + BOOL IsInsertingFromOtherDoc() const { return bInsertingFromOtherDoc; } + void SetLoadingMedium( bool bVal ); + void SetImportingXML( bool bVal ); + bool IsImportingXML() const { return bImportingXML; } + void SetXMLFromWrapper( BOOL bVal ); + BOOL IsXMLFromWrapper() const { return bXMLFromWrapper; } + void SetCalcingAfterLoad( BOOL bVal ) { bCalcingAfterLoad = bVal; } + BOOL IsCalcingAfterLoad() const { return bCalcingAfterLoad; } + void SetNoListening( BOOL bVal ) { bNoListening = bVal; } + BOOL GetNoListening() const { return bNoListening; } + ScBroadcastAreaSlotMachine* GetBASM() const { return pBASM; } + + ScChartListenerCollection* GetChartListenerCollection() const + { return pChartListenerCollection; } + void SetChartListenerCollection( ScChartListenerCollection*, + BOOL bSetChartRangeLists = FALSE ); + void UpdateChart( const String& rName ); + void RestoreChartListener( const String& rName ); + SC_DLLPUBLIC void UpdateChartListenerCollection(); + BOOL IsChartListenerCollectionNeedsUpdate() const + { return bChartListenerCollectionNeedsUpdate; } + void SetChartListenerCollectionNeedsUpdate( BOOL bFlg ) + { bChartListenerCollectionNeedsUpdate = bFlg; } + void AddOLEObjectToCollection(const String& rName); + + ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; } + SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew); + + vos::ORef<SvxForbiddenCharactersTable> GetForbiddenCharacters(); + void SetForbiddenCharacters( const vos::ORef<SvxForbiddenCharactersTable> xNew ); + + BYTE GetAsianCompression() const; // CharacterCompressionType values + BOOL IsValidAsianCompression() const; + void SetAsianCompression(BYTE nNew); + + BOOL GetAsianKerning() const; + BOOL IsValidAsianKerning() const; + void SetAsianKerning(BOOL bNew); + + BYTE GetEditTextDirection(SCTAB nTab) const; // EEHorizontalTextDirection values + + SC_DLLPUBLIC ScLkUpdMode GetLinkMode() const { return eLinkMode ;} + void SetLinkMode( ScLkUpdMode nSet ) { eLinkMode = nSet;} + + +private: + ScDocument(const ScDocument& r); // disabled with no definition + + void FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount, + SCCOL nX1, SCCOL nX2 ) const; + + USHORT RowDifferences( SCROW nThisRow, SCTAB nThisTab, + ScDocument& rOtherDoc, + SCROW nOtherRow, SCTAB nOtherTab, + SCCOL nMaxCol, SCCOLROW* pOtherCols ); + USHORT ColDifferences( SCCOL nThisCol, SCTAB nThisTab, + ScDocument& rOtherDoc, + SCCOL nOtherCol, SCTAB nOtherTab, + SCROW nMaxRow, SCCOLROW* pOtherRows ); + void FindOrder( SCCOLROW* pOtherRows, SCCOLROW nThisEndRow, SCCOLROW nOtherEndRow, + BOOL bColumns, + ScDocument& rOtherDoc, SCTAB nThisTab, SCTAB nOtherTab, + SCCOLROW nEndCol, SCCOLROW* pTranslate, + ScProgress* pProgress, ULONG nProAdd ); + BOOL OnlineSpellInRange( const ScRange& rSpellRange, ScAddress& rSpellPos, + USHORT 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( 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( BOOL bOnlyForced = FALSE, + BOOL bNoProgressBar = FALSE ); + void ClearFormulaTree(); + void AppendToFormulaTrack( ScFormulaCell* pCell ); + void RemoveFromFormulaTrack( ScFormulaCell* pCell ); + void TrackFormulas( ULONG nHintId = SC_HINT_DATACHANGED ); + USHORT GetFormulaTrackCount() const { return nFormulaTrackCount; } + BOOL IsInFormulaTree( ScFormulaCell* pCell ) const; + BOOL IsInFormulaTrack( ScFormulaCell* pCell ) const; + USHORT GetHardRecalcState() { return nHardRecalcState; } + void SetHardRecalcState( USHORT nVal ) { nHardRecalcState = nVal; } + void StartAllListeners(); + const ScFormulaCell* GetFormulaTree() const { return pFormulaTree; } + BOOL HasForcedFormulas() const { return bHasForcedFormulas; } + void SetForcedFormulas( BOOL bVal ) { bHasForcedFormulas = bVal; } + ULONG GetFormulaCodeInTree() const { return nFormulaCodeInTree; } + BOOL IsInInterpreter() const { return nInterpretLevel != 0; } + USHORT GetInterpretLevel() { return nInterpretLevel; } + void IncInterpretLevel() + { + if ( nInterpretLevel < USHRT_MAX ) + nInterpretLevel++; + } + void DecInterpretLevel() + { + if ( nInterpretLevel ) + nInterpretLevel--; + } + BOOL IsInMacroInterpreter() const { return nMacroInterpretLevel != 0; } + USHORT GetMacroInterpretLevel() { return nMacroInterpretLevel; } + void IncMacroInterpretLevel() + { + if ( nMacroInterpretLevel < USHRT_MAX ) + nMacroInterpretLevel++; + } + void DecMacroInterpretLevel() + { + if ( nMacroInterpretLevel ) + nMacroInterpretLevel--; + } + BOOL IsInInterpreterTableOp() const { return nInterpreterTableOpLevel != 0; } + USHORT 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; + } + BOOL IsInDtorClear() const { return bInDtorClear; } + void SetExpandRefs( BOOL bVal ) { bExpandRefs = bVal; } + BOOL IsExpandRefs() { return bExpandRefs; } + + SC_DLLPUBLIC void IncSizeRecalcLevel( SCTAB nTab ); + SC_DLLPUBLIC void DecSizeRecalcLevel( SCTAB nTab, bool bUpdateNoteCaptionPos = true ); + + ULONG GetXMLImportedFormulaCount() const { return nXMLImportedFormulaCount; } + void IncXMLImportedFormulaCount( ULONG nVal ) + { + if ( nXMLImportedFormulaCount + nVal > nXMLImportedFormulaCount ) + nXMLImportedFormulaCount += nVal; + } + void DecXMLImportedFormulaCount( ULONG nVal ) + { + if ( nVal <= nXMLImportedFormulaCount ) + nXMLImportedFormulaCount -= nVal; + else + nXMLImportedFormulaCount = 0; + } + + void StartTrackTimer(); + + void CompileDBFormula(); + void CompileDBFormula( BOOL bCreateFormulaString ); + void CompileNameFormula( 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(BOOL bSet); // TableLink or AreaLink + BOOL IsInLinkUpdate() const; // including DdeLink + + SC_DLLPUBLIC SfxItemPool* GetEditPool() const; + SC_DLLPUBLIC SfxItemPool* GetEnginePool() const; + SC_DLLPUBLIC ScFieldEditEngine& GetEditEngine(); + SC_DLLPUBLIC ScNoteEditEngine& GetNoteEngine(); +//UNUSED2009-05 SfxItemPool& GetNoteItemPool(); + + ScRefreshTimerControl* GetRefreshTimerControl() const + { return pRefreshTimerControl; } + ScRefreshTimerControl * const * GetRefreshTimerControlAddress() const + { return &pRefreshTimerControl; } + + void SetPastingDrawFromOtherDoc( BOOL bVal ) + { bPastingDrawFromOtherDoc = bVal; } + BOOL PastingDrawFromOtherDoc() const + { return bPastingDrawFromOtherDoc; } + + /// an ID unique to each document instance + sal_uInt32 GetDocumentID() const; + + void InvalidateStyleSheetUsage() + { bStyleSheetUsageInvalid = 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; + +private: // CLOOK-Impl-Methoden + + /** + * 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(); // bei Gelegenheit auf on-demand umstellen? + void ImplDeleteOptions(); + + void DeleteDrawLayer(); + void DeleteColorTable(); + SC_DLLPUBLIC BOOL DrawGetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) const; + void DrawMovePage( USHORT nOldPos, USHORT nNewPos ); + void DrawCopyPage( USHORT nOldPos, USHORT 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 CopyRangeNamesFromClip(ScDocument* pClipDoc, ScClipRangeNameData& rRangeNames); + void UpdateRangeNamesInFormulas( + ScClipRangeNameData& rRangeNames, const ScRangeList& rDestRanges, const ScMarkData& rMark, + SCCOL nXw, SCROW nYw); + + 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 + + diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx new file mode 100644 index 000000000000..14c9515dfacb --- /dev/null +++ b/sc/inc/docuno.hxx @@ -0,0 +1,860 @@ +/************************************************************************* + * + * 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; + + ::cppu::OInterfaceContainerHelper maChangesListeners; + + 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(); + + 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 UString getClassName(void); + + 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); + + //! XPrintable?? + + // 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(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: +//UNUSED2008-05 ScSpreadsheetSettingsObj(ScDocShell* pDocSh); + 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 haengt am 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; + + 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 + diff --git a/sc/inc/dpcachetable.hxx b/sc/inc/dpcachetable.hxx new file mode 100644 index 000000000000..eab01d078081 --- /dev/null +++ b/sc/inc/dpcachetable.hxx @@ -0,0 +1,249 @@ +/************************************************************************* + * + * 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 <hash_map> +#include <hash_set> +#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 ScDocument; +class ScRange; +class ScDPDimension; +class ScDPCollection; +struct ScDPCacheCell; +struct ScQueryParam; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments +class Date; + +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPTableDataCache; +struct ScDPValueData; +// End Comments +// ---------------------------------------------------------------------------- + +class SC_DLLPUBLIC ScDPCacheTable +{ +public: + /** individual filter item used in SingleFilter and GroupFilter. */ + struct FilterItem + { + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + String maString; + // End Comments + double mfValue; + bool mbHasValue; + + FilterItem(); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + bool match( const ScDPItemData& rCellData ) const; +// End Comments + }; + + /** 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. */ +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + virtual bool match( const ScDPItemData& rCellData ) const = 0; +// End Comments + }; + + /** ordinary single-item filter. */ + class SingleFilter : public FilterBase + { + public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + explicit SingleFilter(String aString, double fValue, bool bHasValue); + // End Comments + virtual ~SingleFilter(){} + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual bool match(const ScDPItemData& rCellData) const; + // End Comments + const String getMatchString(); + double getMatchValue() const; + bool hasValue() const; + + private: + explicit SingleFilter(); + + FilterItem maItem; + }; + + /** multi-item (group) filter. */ + class GroupFilter : public FilterBase + { + public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + GroupFilter(); + // End Comments + virtual ~GroupFilter(){} + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual bool match( const ScDPItemData& rCellData ) const; + // End Comments + 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(); + }; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPCacheTable( ScDocument* pDoc,long nId ); + // End Comments + ~ScDPCacheTable(); + + sal_Int32 getRowSize() const; + sal_Int32 getColSize() const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* 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(); + // End Comments + + /** 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 ::std::hash_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; + //End Comments + + /** Get the field index (i.e. column ID in the original data source) based + on the string value that corresponds with the column title. It returns + -1 if no field matching the string value exists. */ + sal_Int32 getFieldIndex(const String& rStr) const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + /** 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; + // End Comments + /** 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 ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims); + + void clear(); + void swap(ScDPCacheTable& rOther); + bool empty() 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 ::std::hash_set<sal_Int32>& rRepeatIfEmptyDims) const; + void getValueData(ScDocument* pDoc, const ScAddress& rPos, ScDPCacheCell& rCell); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void InitNoneCache( ScDocument* pDoc ); + // End Comments +private: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + /** unique field entires for each field (column). */ + ::std::vector< ::std::vector<SCROW> > maFieldEntries; + // End Comments + /** used to track visibility of rows. The first row below the header row + has the index of 0. */ + ::std::vector<bool> maRowsVisible; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* mpCache; + ScDPTableDataCache* mpNoneCache; + // End Comments +}; +#endif diff --git a/sc/inc/dpdimsave.hxx b/sc/inc/dpdimsave.hxx new file mode 100644 index 000000000000..f887ed91ea32 --- /dev/null +++ b/sc/inc/dpdimsave.hxx @@ -0,0 +1,202 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/dpglobal.hxx b/sc/inc/dpglobal.hxx new file mode 100755 index 000000000000..7de5947cc969 --- /dev/null +++ b/sc/inc/dpglobal.hxx @@ -0,0 +1,209 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dpglobal.hxx,v $ + * $Revision: 1.0 $ + * + * 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. + * + ************************************************************************/ +// Wang Xu Ming - DataPilot migration +// Buffer&&Performance +// +#ifndef _SC_DPGLOBAL_HXX +#define _SC_DPGLOBAL_HXX + +#include <algorithm> +#include <list> +#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 MAX_PAGEFIELDS 10 // maximum count of fields for page area + +#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" + +#define DBG_TRACESTR( x ) \ + {\ + ByteString aTemp( x , RTL_TEXTENCODING_UTF8 ); \ + DBG_TRACE( aTemp.GetBuffer() );\ + } + +class TypedStrData; +class ScDPObject; + +class SC_DLLPUBLIC ScDPItemData +{ +public: + enum { MK_VAL = 0x01, MK_DATA = MK_VAL<<1, MK_ERR = MK_DATA<<1, MK_DATE = MK_ERR<<1, MK_DATEPART = MK_DATE<<1 }; +private: + union + { + ULONG nNumFormat; + sal_Int32 mnDatePart; + }; + + String aString; + double fValue; + BYTE mbFlag; + //BOOL bHasValue: 1 ; + //BOOL bHasData: 1; + //BOOL bErr: 1; + + friend class ScDPTableDataCache; +public: + ScDPItemData() : nNumFormat( 0 ), fValue(0.0), mbFlag( 0 ){} + ScDPItemData( ULONG nNF, const String & rS, double fV, BYTE bF ):nNumFormat(nNF), aString(rS), fValue(fV), mbFlag( bF ){} + ScDPItemData( const String& rS, double fV = 0.0, BOOL bHV = FALSE, const ULONG nNumFormat = 0 , BOOL bData = TRUE) ; + ScDPItemData( ScDocument* pDoc, SCROW nRow, USHORT nCol, USHORT nDocTab ); + + void SetString( const String& rS ) { aString = rS; mbFlag &= ~(MK_VAL|MK_DATE); nNumFormat = 0; mbFlag |= MK_DATA; } +// void SetValue ( double value , ULONG nNumFormat = 0 ) { bHasValue = TRUE; nNumFormat = 0;bHasData = TRUE; bDate = FALSE; fValue = value ;} + 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 ); + +#ifdef DEBUG + void dump() const; +#endif + +public: + BOOL IsHasData() const ; + BOOL IsHasErr() const ; + BOOL IsValue() const; + String GetString() const ; + double GetValue() const ; + ULONG GetNumFormat() const ; + BOOL HasStringData() const ; + BOOL IsDate() const; + BOOL HasDatePart() const; + void SetDate( BOOL b ) ; + + TypedStrData* CreateTypeString( ); + sal_uInt8 GetType() const; + BYTE & GetFlag() throw() { return mbFlag; } + const BYTE & GetFlag() const throw() { return const_cast<ScDPItemData*>(this)->GetFlag(); } +}; + +class SC_DLLPUBLIC ScDPItemDataPool +{ +public: + // construct + ScDPItemDataPool(void); + ScDPItemDataPool(const ScDPItemDataPool& r); + + virtual ~ScDPItemDataPool(void); + 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 ::std::hash_multimap< ScDPItemData, sal_Int32, DataHashFunc > DataHash; + + ::std::vector< ScDPItemData > maItems; + DataHash maItemIds; +}; + +class ScDPInfoWnd; +class ScDocShell; +class ScTabViewShell; +namespace ScDPGlobal +{ +// used for core data + String GetFieldFuncString( const String& rSourceName, USHORT &rFuncMask, BOOL bIsValue ); + String GetFuncString( const String &rString, const USHORT nIndex ); + com::sun::star::uno::Reference<com::sun::star::container::XNameAccess> DP_GetMembers( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>&rSrc, long nField ); +// common operation + String operator + ( const String & rL, const String &rR ); + Rectangle operator *( const Rectangle &rLeft, const std::pair<double,double> & rRight ); +// used for DataPilot Panel + ScDPInfoWnd* GetDPInfoWnd( ScTabViewShell *pViewShell ); + bool ChkDPTableOverlap( ScDocument *pDestDoc, std::list<ScDPObject> & rClipboard, SCCOL nClipStartCol, SCROW nClipStartRow, SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, USHORT nEndTab, BOOL bExcludeClip = FALSE ); + +} +#endif diff --git a/sc/inc/dpgroup.hxx b/sc/inc/dpgroup.hxx new file mode 100644 index 000000000000..a22b6fd6a2eb --- /dev/null +++ b/sc/inc/dpgroup.hxx @@ -0,0 +1,265 @@ +/************************************************************************* + * + * 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 <hash_set> +#include <boost/shared_ptr.hpp> + +#include "dptabdat.hxx" +#include "scdllapi.h" +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpglobal.hxx" +// End Comments +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(sal_False), DateValues(sal_False), AutoStart(sal_False), AutoEnd(sal_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; } + + // Wang Xu Ming -- 2009-9-8 + // DataPilot Migration - Cache&&Performance + void FillColumnEntries( SCCOL nSourceDim, ScDPTableDataCache* pCahe , std::vector< SCROW >& rEntries, + const std::vector< SCROW >& rOriginal ) const; + // End Comments +}; + +// -------------------------------------------------------------------- + +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; + // Wang Xu Ming -- 2009-9-4 + // DataPilot Migration - Cache&&Performance + mutable ::std::vector< SCROW > maMemberEntries; + // End Comments +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; } + +// Wang Xu Ming -- 2009-9-2 +// DataPilot Migration - Cache&&Performance + const std::vector< SCROW >& GetColumnEntries( const ScDPCacheTable& rCacheTable, const std::vector< SCROW >& rOriginal ) const; +// End Comments + 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; +// Wang Xu Ming -- 2009-9-4 +// DataPilot Migration - Cache&&Performance + mutable ::std::vector< SCROW > maMemberEntries; +// End Comments + 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, ScDPTableDataCache* 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 ::std::hash_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; + +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + void FillGroupValues( SCROW* pItemDataIndex, long nCount, const long* pDims ); + virtual long GetSourceDim( long nDim ); +// End Comments + + 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(); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + 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); + +// End Comments + virtual String getDimensionName(long nColumn); + virtual BOOL getIsDataLayoutDimension(long nColumn); + virtual BOOL IsDateDimension(long nDim); + virtual ULONG GetNumberFormat(long nDim); + virtual void DisposeData(); + virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); + + virtual bool IsRepeatIfEmpty(); + + virtual void CreateCacheTable(); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims); + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_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 BOOL IsBaseForGroup(long nDim) const; + virtual long GetGroupBase(long nGroupDim) const; + virtual BOOL IsNumOrDateGroup(long nDim) const; + virtual BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + virtual BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, + const ScDPItemData& rSecondData, long nSecondIndex ) const; +}; + + +#endif + diff --git a/sc/inc/dpobject.hxx b/sc/inc/dpobject.hxx new file mode 100644 index 000000000000..e1b88919dad6 --- /dev/null +++ b/sc/inc/dpobject.hxx @@ -0,0 +1,300 @@ +/************************************************************************* + * + * 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/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; +struct 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 ) { } + + 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 : public ScDataObject +{ +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; + BOOL bSettingsChanged; + BOOL bAlive; // FALSE if only used to hold settings + sal_uInt16 mnAutoFormatIndex; + BOOL bAllowMove; + long nHeaderRows; // page fields plus filter button + bool mbHeaderLayout; // TRUE : grid, FALSE : standard + + + SC_DLLPRIVATE ScDPTableData* GetTableData(); + SC_DLLPRIVATE void CreateObjects(); + SC_DLLPRIVATE void CreateOutput(); + BOOL bRefresh; + long mnCacheId; + +public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + inline void SetRefresh() { bRefresh = TRUE; } + const ScDPTableDataCache* GetCache() const; + long GetCacheId() const; + void SetCacheId( long nCacheId ); + ULONG RefreshCache(); + // End Comments + ScDPObject( ScDocument* pD ); + ScDPObject(const ScDPObject& r); + virtual ~ScDPObject(); + + virtual ScDataObject* Clone() const; + + void SetAlive(BOOL bSet); + void SetAllowMove(BOOL bSet); + + void InvalidateData(); + void InvalidateSource(); + + + 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 SetAutoFormatIndex (const sal_uInt16 nIndex); + sal_uInt16 GetAutoFormatIndex() const; + + 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(); + + BOOL IsSheetData() const; + BOOL IsImportData() const { return(pImpDesc != NULL); } + 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, BOOL& rIsDataLayout, sal_Int32* pFlags = NULL ); + BOOL IsDuplicated( long nDim ); + long GetDimCount(); + void GetHeaderPositionData(const ScAddress& rPos, ::com::sun::star::sheet::DataPilotTableHeaderData& rData); + long GetHeaderDim( const ScAddress& rPos, USHORT& rOrient ); + BOOL GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop, + long nDragDim, + Rectangle& rPosRect, USHORT& rOrient, long& rDimPos ); + BOOL IsFilterButton( const ScAddress& rPos ); + + BOOL GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */ + const std::vector< ScDPGetPivotDataField >& rFilters ); + 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); + + BOOL FillOldParam(ScPivotParam& rParam, BOOL bForFile) const; + BOOL FillLabelData(ScPivotParam& rParam); + void InitFromOldPivot(const ScPivot& rOld, ScDocument* pDoc, BOOL bSetSource); + + BOOL GetHierarchiesNA( sal_Int32 nDim, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xHiers ); + BOOL GetHierarchies( sal_Int32 nDim, com::sun::star::uno::Sequence< rtl::OUString >& rHiers ); + + sal_Int32 GetUsedHierarchy( sal_Int32 nDim ); + + BOOL GetMembersNA( sal_Int32 nDim, com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xMembers ); + 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 ); + 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 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, + PivotField* pFields, SCSIZE nCount, USHORT nOrient, + ScDocument* pDoc, SCROW nRow, SCTAB nTab, + const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSource, + BOOL bOldDefaults, + PivotField* pRefColFields = NULL, SCSIZE nRefColCount = 0, + PivotField* pRefRowFields = NULL, SCSIZE nRefRowCount = 0, + PivotField* pRefPageFields = NULL, SCSIZE nRefPageCount = 0 ); + + static bool IsOrientationAllowed( USHORT nOrient, sal_Int32 nDimFlags ); +}; + + +// ============================================================================ + +class ScDPCollection : public ScCollection +{ +private: + ScDocument* pDoc; +public: + ScDPCollection(ScDocument* pDocument); + ScDPCollection(const ScDPCollection& r); + virtual ~ScDPCollection(); + + virtual ScDataObject* Clone() const; + + ScDPObject* operator[](USHORT nIndex) const {return (ScDPObject*)At(nIndex);} + 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; + + String CreateNewName( USHORT nMin = 1 ) const; + + void FreeTable(ScDPObject* pDPObj); + SC_DLLPUBLIC bool InsertNewTable(ScDPObject* pDPObj); + + bool HasDPTable(SCCOL nCol, SCROW nRow, SCTAB nTab) const; +}; + + +#endif + diff --git a/sc/inc/dpoutput.hxx b/sc/inc/dpoutput.hxx new file mode 100644 index 000000000000..e97a56a9ecf2 --- /dev/null +++ b/sc/inc/dpoutput.hxx @@ -0,0 +1,174 @@ +/************************************************************************* + * + * 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 + UINT32* pColNumFmt; + UINT32* pRowNumFmt; + long nColFmtCount; + long nRowFmtCount; + UINT32 nSingleNumFmt; + + // Output geometry related parameters + BOOL bSizesValid; + BOOL bSizeOverflow; + long nColCount; + long nRowCount; + long nHeaderSize; + bool mbHeaderLayout; // TRUE : grid, 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, + 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); + + BOOL GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */ + const std::vector< ScDPGetPivotDataField >& rFilters ); + long GetHeaderDim( const ScAddress& rPos, USHORT& rOrient ); + BOOL GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop, + long nDragDim, + Rectangle& rPosRect, USHORT& rOrient, long& rDimPos ); + 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 + diff --git a/sc/inc/dpoutputgeometry.hxx b/sc/inc/dpoutputgeometry.hxx new file mode 100644 index 000000000000..7069787e803d --- /dev/null +++ b/sc/inc/dpoutputgeometry.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 diff --git a/sc/inc/dpsave.hxx b/sc/inc/dpsave.hxx new file mode 100644 index 000000000000..8272b850b27e --- /dev/null +++ b/sc/inc/dpsave.hxx @@ -0,0 +1,286 @@ +/************************************************************************* + * + * 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 <tools/string.hxx> +#include <tools/list.hxx> +#include <com/sun/star/sheet/XDimensionsSupplier.hpp> +#include <com/sun/star/sheet/DataPilotFieldOrientation.hpp> +#include "scdllapi.h" +#include <hash_map> +#include <list> +#include <memory> + +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: + String aName; + ::std::auto_ptr<rtl::OUString> mpLayoutName; // custom name to be displayed in the table. + USHORT nVisibleMode; + USHORT nShowDetailsMode; + +public: + ScDPSaveMember(const String& rName); + ScDPSaveMember(const ScDPSaveMember& r); + ~ScDPSaveMember(); + + BOOL operator== ( const ScDPSaveMember& r ) const; + + const String& 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 String& 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: + String aName; + String* pSelectedPage; + ::std::auto_ptr<rtl::OUString> mpLayoutName; + ::std::auto_ptr<rtl::OUString> mpSubtotalName; + BOOL bIsDataLayout; + BOOL bDupFlag; + USHORT nOrientation; + USHORT nFunction; // enum GeneralFunction, for data dimensions + long nUsedHierarchy; + USHORT nShowEmptyMode; //! at level + BOOL bSubTotalDefault; //! at level + long nSubTotalCount; + USHORT* 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 std::hash_map <String, ScDPSaveMember*, rtl::OUStringHash> MemberHash; + typedef std::list <ScDPSaveMember*> MemberList; +private: + MemberHash maMemberHash; + MemberList maMemberList; +public: + ScDPSaveDimension(const String& 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 String& GetName() const { return aName; } + BOOL IsDataLayout() const { return bIsDataLayout; } + + void SetName( const String& rNew ); // used if the source dim was renamed (groups) + + void SetOrientation(USHORT nNew); + void SetSubTotals(long nCount, const USHORT* pFuncs); + long GetSubTotalsCount() const { return nSubTotalCount; } + USHORT GetSubTotalFunc(long nIndex) const { return pSubTotalFuncs[nIndex]; } + bool HasShowEmpty() const; + void SetShowEmpty(BOOL bSet); + BOOL GetShowEmpty() const { return BOOL(nShowEmptyMode); } + void SetFunction(USHORT nNew); // enum GeneralFunction + USHORT 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 String* pPage ); // NULL = no selection (all) + BOOL HasCurrentPage() const; + const String& GetCurrentPage() const; + + USHORT GetOrientation() const { return nOrientation; } + + ScDPSaveMember* GetExistingMemberByName(const String& rName); + ScDPSaveMember* GetMemberByName(const String& rName); + + void SetMemberPosition( const String& 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<String> & deletedDims); + + void UpdateMemberVisibility(const ::std::hash_map< ::rtl::OUString, bool, ::rtl::OUStringHash>& rData); + + bool HasInvisibleMember() const; +}; + + +class ScDPSaveData +{ +private: + List aDimList; + ScDPDimensionSaveData* pDimensionData; // settings that create new dimensions + USHORT nColumnGrandMode; + USHORT nRowGrandMode; + USHORT nIgnoreEmptyMode; + USHORT nRepeatEmptyMode; + BOOL bFilterButton; // not passed to DataPilotSource + BOOL bDrillDown; // not passed to DataPilotSource + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + long mnCacheId; + // End Comments + + /** 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 List& GetDimensions() const { return aDimList; } + void AddDimension(ScDPSaveDimension* pDim) { aDimList.Insert(pDim, LIST_APPEND); } + + ScDPSaveDimension* GetDimensionByName(const String& rName); + SC_DLLPUBLIC ScDPSaveDimension* GetDataLayoutDimension(); + SC_DLLPUBLIC ScDPSaveDimension* GetExistingDataLayoutDimension() const; + + ScDPSaveDimension* DuplicateDimension(const String& rName); + SC_DLLPUBLIC ScDPSaveDimension& DuplicateDimension(const ScDPSaveDimension& rDim); + + SC_DLLPUBLIC ScDPSaveDimension* GetExistingDimensionByName(const String& rName) const; + SC_DLLPUBLIC ScDPSaveDimension* GetNewDimensionByName(const String& rName); + + void RemoveDimensionByName(const String& rName); + + ScDPSaveDimension* GetInnermostDimension(USHORT 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 ); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void Refresh( const com::sun::star::uno::Reference< + com::sun::star::sheet::XDimensionsSupplier>& xSource ); + BOOL IsEmpty() const; + inline long GetCacheId() const{ return mnCacheId; } + inline void SetCacheId( long nCacheId ){ mnCacheId = nCacheId; } + // End Comments + 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 + diff --git a/sc/inc/dpsdbtab.hxx b/sc/inc/dpsdbtab.hxx new file mode 100644 index 000000000000..732e3d30e8df --- /dev/null +++ b/sc/inc/dpsdbtab.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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 <set> + +class ScDPCacheTable; +class ScDocument; + +// -------------------------------------------------------------------- +// +// implementation of ScDPTableData with database data +// + +struct ScImportSourceDesc +{ + String aDBName; + String aObject; + USHORT nType; // enum DataImportMode + BOOL bNative; + + ScImportSourceDesc() : nType(0), bNative(FALSE) {} + + BOOL operator== ( const ScImportSourceDesc& rOther ) const + { return aDBName == rOther.aDBName && + aObject == rOther.aObject && + nType == rOther.nType && + bNative == rOther.bNative; } + + // Wang Xu Ming -- 2009-9-15 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* GetExistDPObjectCache( ScDocument* pDoc ) const; + ScDPTableDataCache* CreateCache( ScDocument* pDoc , long nID ) const; + ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const; + long GetCacheId( ScDocument* pDoc, long nID ) const; + // End Comments +}; + +class ScDatabaseDPData : public ScDPTableData +{ +private: + ScDPCacheTable aCacheTable; +public: + ScDatabaseDPData(ScDocument* pDoc, const ScImportSourceDesc& rImport, long nCacheId = -1); + virtual ~ScDatabaseDPData(); + + virtual long GetColumnCount(); + virtual String getDimensionName(long nColumn); + virtual BOOL getIsDataLayoutDimension(long nColumn); + virtual BOOL IsDateDimension(long nDim); + virtual void DisposeData(); + virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); + + virtual void CreateCacheTable(); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims); + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_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 + diff --git a/sc/inc/dpshttab.hxx b/sc/inc/dpshttab.hxx new file mode 100644 index 000000000000..a8d80072c68a --- /dev/null +++ b/sc/inc/dpshttab.hxx @@ -0,0 +1,110 @@ +/************************************************************************* + * + * 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 <vector> + +namespace com { namespace sun { namespace star { namespace sheet { + struct DataPilotFieldFilter; +}}}} + +class ScDPDimension; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments +// -------------------------------------------------------------------- +// +// implementation of ScDPTableData with sheet data +// + +struct ScSheetSourceDesc +{ + ScRange aSourceRange; + ScQueryParam aQueryParam; + + BOOL operator== ( const ScSheetSourceDesc& rOther ) const + { return aSourceRange == rOther.aSourceRange && + aQueryParam == rOther.aQueryParam; } +// Wang Xu Ming - DataPilot migration +// Buffer&&Performance + ScDPTableDataCache* CreateCache( ScDocument* pDoc, long nID = -1) const; + ULONG CheckValidate( ScDocument* pDoc ) const; + ScDPTableDataCache* GetCache( ScDocument* pDoc, long nID ) const; + ScDPTableDataCache* GetExistDPObjectCache ( ScDocument* pDoc ) const; + long GetCacheId( ScDocument* pDoc, long nID ) const; + +// End Comments +}; + +class SC_DLLPUBLIC ScSheetDPData : public ScDPTableData +{ +private: + ScQueryParam aQuery; + BOOL* pSpecial; + BOOL bIgnoreEmptyRows; + BOOL bRepeatIfEmpty; + + ScDPCacheTable aCacheTable; + +public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScSheetDPData( ScDocument* pD, const ScSheetSourceDesc& rDesc, long nCacheId = -1 ); + virtual ~ScSheetDPData(); + // End Comments + virtual long GetColumnCount(); + virtual String getDimensionName(long nColumn); + virtual BOOL getIsDataLayoutDimension(long nColumn); + virtual BOOL IsDateDimension(long nDim); + virtual ULONG GetNumberFormat(long nDim); + virtual void DisposeData(); + virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ); + + virtual bool IsRepeatIfEmpty(); + + virtual void CreateCacheTable(); + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rCatDims); + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_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 + diff --git a/sc/inc/dptabdat.hxx b/sc/inc/dptabdat.hxx new file mode 100644 index 000000000000..6323434ca4ad --- /dev/null +++ b/sc/inc/dptabdat.hxx @@ -0,0 +1,211 @@ +/************************************************************************* + * + * 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" +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dptablecache.hxx" +// End Comments +#include <tools/string.hxx> + +#include <vector> +#include <set> +#include <hash_map> +#include <hash_set> + +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; + BYTE nType; + + void Set( double fV, BYTE nT ) { fValue = fV; nType = nT; } +}; + +class ScDPResultMember; +class ScDPDimension; +class ScDPLevel; +class ScDPInitState; +class ScDPResultMember; +class ScDocument; + + class SC_DLLPUBLIC ScDPTableData +{ + // cached data for GetDatePart + long nLastDateVal; + long nLastHier; + long nLastLevel; + long nLastRet; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + long mnCacheId; + const ScDocument* mpDoc; + // End Comments +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(); + }; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableData(ScDocument* pDoc, long nCacheId ); + // End Comments + 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; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + virtual const std::vector< SCROW >& GetColumnEntries( long nColumn ) ; + long GetCacheId() const; + // End Comments + virtual String getDimensionName(long nColumn) = 0; + virtual BOOL getIsDataLayoutDimension(long nColumn) = 0; + virtual BOOL IsDateDimension(long nDim) = 0; + virtual ULONG GetNumberFormat(long nDim); + virtual UINT32 GetNumberFormatByIdx( NfIndexTableOffset ); + virtual void DisposeData() = 0; + virtual void SetEmptyFlags( BOOL bIgnoreEmptyRows, BOOL bRepeatIfEmpty ) = 0; + + virtual bool IsRepeatIfEmpty(); + + virtual void CreateCacheTable() = 0; + virtual void FilterCacheTable(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, const ::std::hash_set<sal_Int32>& rDataDims) = 0; + virtual void GetDrillDownData(const ::std::vector<ScDPCacheTable::Criterion>& rCriteria, + const ::std::hash_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 BOOL IsBaseForGroup(long nDim) const; + virtual long GetGroupBase(long nGroupDim) const; + virtual BOOL IsNumOrDateGroup(long nDim) const; + virtual BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + virtual BOOL HasCommonElement( const ScDPItemData& rFirstData, long nFirstIndex, + const ScDPItemData& rSecondData, long nSecondIndex ) const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + 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); + // End Comments +protected: + /** This structure stores vector arrays that hold intermediate data for + each row during cache table iteration. */ + struct CalcRowData + { + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ::std::vector< SCROW > aColData; + ::std::vector< SCROW > aRowData; + ::std::vector< SCROW > aPageData; + // End Comments + ::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: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void GetItemData(const ScDPCacheTable& rCacheTable, sal_Int32 nRow, + const ::std::vector<long>& rDims, ::std::vector< SCROW >& rItemData); + // End Comments +}; +#endif + diff --git a/sc/inc/dptablecache.hxx b/sc/inc/dptablecache.hxx new file mode 100644 index 000000000000..953c793093be --- /dev/null +++ b/sc/inc/dptablecache.hxx @@ -0,0 +1,122 @@ +/************************************************************************* + * + * 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 + * + * $RCSfile: dptablecache.hxx,v $ + * $Revision: 1.0 $ + * + * 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 DPTABLECACHE_HXX +#define DPTABLECACHE_HXX +// Wang Xu Ming -- 12/21/2008 +// Add Data Cache Support. +#ifndef SC_SCGLOB_HXX +#include "global.hxx" +#endif +//Added by PengYunQuan for SODC_16015 +#include <svl/zforlist.hxx> +//end +#include <vector> +#include "dpglobal.hxx" + +#include <com/sun/star/sdbc/DataType.hpp> +#include <com/sun/star/sdbc/XRow.hpp> +#include <com/sun/star/sdbc/XRowSet.hpp> + +class ScDPTableDataCache; +class TypedStrData; +struct ScQueryParam; + +// -------------------------------------------------------------------- +// +// base class ScDPTableData to allow implementation with tabular data +// by deriving only of this +// + +class SC_DLLPUBLIC ScDPTableDataCache +{ + long mnID; + ScDocument* mpDoc; + + long mnColumnCount; // Column count + + std::vector<ScDPItemData*>* mpTableDataValues; //Data Pilot Table's index - value map + std::vector<SCROW>* mpSourceData; //Data Pilot Table's Source data + std::vector<SCROW>* mpGlobalOrder; //Sorted members index + std::vector<SCROW>* mpIndexOrder; //Index the sorted number + std::vector<ScDPItemData*> mrLabelNames; //Source Label data + std::vector<BOOL> mbEmptyRow; //If empty row? + mutable ScDPItemDataPool maAdditionalDatas; +public: + SCROW GetOrder( long nDim, SCROW nIndex ) const; + SCROW GetIdByItemData( long nDim, String sItemData ) const; + SCROW GetIdByItemData( long nDim, const ScDPItemData& rData ) const; + + SCROW GetAdditionalItemID ( String sItemData ); + SCROW GetAdditionalItemID( const ScDPItemData& rData ); + + SCCOL GetDimensionIndex( String sName) const; + const ScDPItemData* GetSortedItemData( SCCOL nDim, SCROW nOrder ) const; + ULONG GetNumType ( ULONG nFormat ) const; + ULONG GetNumberFormat( long nDim ) const; + BOOL IsDateDimension( long nDim ) const ; + ULONG GetDimNumType( SCCOL nDim) const; + SCROW GetDimMemberCount( SCCOL nDim ) const; + + SCROW GetSortedItemDataId( SCCOL nDim, SCROW nOrder ) const; + const std::vector<ScDPItemData*>& GetDimMemberValues( SCCOL nDim )const; + void SetId( long nId ){ mnID = nId;} + void AddRow( ScDPItemData* pRow, USHORT nCount ); + 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( USHORT nDim, SCROW nRow, BOOL bRepeatIfEmpty ) const; + String GetDimensionName( USHORT nColumn ) const; + bool IsEmptyMember( SCROW nRow, USHORT nColumn ) const; + bool IsRowEmpty( SCROW nRow ) const; + bool IsValid() const; + bool ValidQuery( SCROW nRow, const ScQueryParam& rQueryParam, BOOL* pSpecial ); + + ScDocument* GetDoc() const;//ms-cache-core + long GetColumnCount() const; + long GetId() const; + + const ScDPItemData* GetItemDataById( long nDim, SCROW nId ) const; + + BOOL operator== ( const ScDPTableDataCache& r ) const; + +//construction + ScDPTableDataCache( ScDocument* pDoc ); +//deconstruction + virtual ~ScDPTableDataCache(); + +protected: +private: + void AddLabel( ScDPItemData* pData); + BOOL AddData( long nDim, ScDPItemData* itemData ); +}; + +#endif //DPTABLECACHE_HXX diff --git a/sc/inc/dptabres.hxx b/sc/inc/dptabres.hxx new file mode 100644 index 000000000000..7f9720a4b143 --- /dev/null +++ b/sc/inc/dptabres.hxx @@ -0,0 +1,738 @@ +/************************************************************************* + * + * 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 <hash_map> +#include <hash_set> +#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; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments +// +// Member names that are being processed for InitFrom/LateInitFrom +// (needed for initialization of grouped items) +// + +class ScDPInitState +{ + long* pIndex; // array +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + SCROW* pData; // array + // End Comments + long nCount; + +public: + ScDPInitState(); + ~ScDPInitState(); + + void AddMember( long nSourceIndex,SCROW nMember); + void RemoveMember(); + + long GetCount() const { return nCount; } + const long* GetSource() const { return pIndex; } +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + const SCROW* GetNameIds() const { return pData; } + SCROW GetNameIdForIndex( long nIndexValue ) const; +// End Comments +}; + +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 ); + BOOL IsCalculated() const; + + double GetResult() const; + BOOL HasError() const; + BOOL HasData() const; + + void SetResult( double fNew ); + void SetEmpty( 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; + BOOL bIsInColRoot; + +public: + ScDPRowTotals(); + ~ScDPRowTotals(); + + ScDPAggData* GetRowTotal( long nMeasure ); + ScDPAggData* GetGrandTotal( long nMeasure ); + + BOOL IsInColRoot() const { return bIsInColRoot; } + void SetInColRoot(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 +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + +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 std::hash_map < SCROW, ScDPParentDimData *, MemberHashIndexFunc> DimMemberHash; + +class ResultMembers +{ + DimMemberHash maMemberHash; + BOOL mbHasHideDetailsMember; +public: + ScDPParentDimData* FindMember( const SCROW& nIndex ) const; + void InsertMember( ScDPParentDimData* pNew ); + BOOL IsHasHideDetailsMembers() const { return mbHasHideDetailsMember; } + void SetHasHideDetailsMembers( BOOL b ) { mbHasHideDetailsMember=b; } + ResultMembers(); + virtual ~ResultMembers(); +}; + +class LateInitParams +{ +private: + const ::std::vector<ScDPDimension*>& mppDim; + const ::std::vector<ScDPLevel*>& mppLev; + + BOOL mbRow; + BOOL mbInitChild; + BOOL mbAllChildren; +public: + LateInitParams( const ::std::vector<ScDPDimension*>& ppDim, const ::std::vector<ScDPLevel*>& ppLev, + BOOL bRow, BOOL bInitChild = TRUE , BOOL bAllChildren = FALSE); + ~LateInitParams(); + + void SetInitChild( BOOL b ) { mbInitChild = b; } + void SetInitAllChildren( 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 BOOL GetInitChild() const {return mbInitChild; } + inline BOOL GetInitAllChild() const { return mbAllChildren; } + inline BOOL IsRow() const { return mbRow; } + BOOL IsEnd( size_t nPos ) const ; +}; +// End Comments + +class ScDPResultData +{ +private: + ScDPSource* pSource; //! Ref + //! keep things like measure lists here + + long nMeasCount; + ScSubTotalFunc* pMeasFuncs; + ::com::sun::star::sheet::DataPilotFieldReference* pMeasRefs; + USHORT* pMeasRefOrient; + String* pMeasNames; + BOOL bLateInit; + BOOL bDataAtCol; + 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 USHORT* pRefOrient, const String* pNames ); + void SetDataLayoutOrientation( USHORT nOrient ); + void SetLateInit( BOOL bSet ); + + long GetMeasureCount() const { return nMeasCount; } + ScSubTotalFunc GetMeasureFunction(long nMeasure) const; + String GetMeasureString(long nMeasure, BOOL bForce, ScSubTotalFunc eForceFunc, bool& rbTotalResult) const; + String GetMeasureDimensionName(long nMeasure) const; + const ::com::sun::star::sheet::DataPilotFieldReference& GetMeasureRefVal(long nMeasure) const; + USHORT GetMeasureRefOrient(long nMeasure) const; + + BOOL IsDataAtCol() const { return bDataAtCol; } + BOOL IsDataAtRow() const { return bDataAtRow; } + BOOL IsLateInit() const { return bLateInit; } + + long GetColStartMeasure() const; + long GetRowStartMeasure() const; + + long GetCountForMeasure( long nMeas ) const + { return ( nMeas == SC_DPMEASURE_ALL ) ? nMeasCount : 1; } + + BOOL IsBaseForGroup( long nDim ) const; // any group + long GetGroupBase( long nGroupDim ) const; + BOOL IsNumOrDateGroup( long nDim ) const; + // Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + BOOL IsInGroup( const ScDPItemData& rGroupData, long nGroupIndex, + long nBaseDataId, long nBaseIndex ) const; + BOOL IsInGroup( SCROW nGroupDataId, long nGroupIndex, + const ScDPItemData& rBaseData, long nBaseIndex ) const; + BOOL HasCommonElement( SCROW nFirstDataId, long nFirstIndex, + const ScDPItemData& rSecondData, long nSecondIndex ) const; + + ResultMembers* GetDimResultMembers( long nDim , ScDPDimension* pDim , ScDPLevel* pLevel) const ; + +// End Comments + const ScDPSource* GetSource() const; +}; + + +class ScDPResultMember +{ +private: + const ScDPResultData* pResultData; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPParentDimData aParentDimData; + // End Comments + ScDPResultDimension* pChildDimension; + ScDPDataMember* pDataRoot; + BOOL bHasElements; + BOOL bForceSubTotal; + BOOL bHasHiddenDetails; + BOOL bInitialized; + BOOL bAutoHidden; + ScDPAggData aColTotal; // to store column totals + + USHORT nMemberStep; // step to show details +public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPResultMember( const ScDPResultData* pData, const ScDPParentDimData& rParentDimData, + BOOL bForceSub ); //! Ref + ScDPResultMember( const ScDPResultData* pData, BOOL bForceSub ); + // End Comments + ~ScDPResultMember(); + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void InitFrom( const ::std::vector<ScDPDimension*>& ppDim, + const ::std::vector<ScDPLevel*>& ppLev, + size_t nPos, + ScDPInitState& rInitState, + BOOL bInitChild = TRUE ); + void LateInitFrom( + LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState); + void CheckShowEmpty( BOOL bShow = FALSE ); + // End Comments + String GetName() const; + void FillItemData( ScDPItemData& rData ) const; + BOOL IsValid() const; + BOOL IsVisible() const; + long GetSize(long nMeasure) const; + BOOL HasHiddenDetails() const; + BOOL IsSubTotalInTitle(long nMeasure) const; + +// BOOL SubTotalEnabled() const; + long GetSubTotalCount( long* pUserSubStart = NULL ) const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + BOOL IsNamedItem( SCROW nIndex ) const; + bool IsValidEntry( const ::std::vector< SCROW >& aMembers ) const; + // End Comments + + void SetHasElements() { bHasElements = TRUE; } + void SetAutoHidden() { bAutoHidden = TRUE; } + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void ProcessData( const ::std::vector<SCROW>& aChildMembers, + const ScDPResultDimension* pDataDim, + const ::std::vector<SCROW>& aDataMembers, + const ::std::vector<ScDPValueData>& aValues ); + // End Comments + void FillMemberResults( com::sun::star::uno::Sequence< + com::sun::star::sheet::MemberResult>* pSequences, + long& rPos, long nMeasure, 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( 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; } + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + 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 BOOL IsRoot() const { return GetParentLevel() == NULL; } + SCROW GetDataId( ) const ; + // End Comments + 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; + BOOL IsVisible() const; + BOOL HasData( long nMeasure, const ScDPSubTotalState& rSubState ) const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + BOOL IsNamedItem( SCROW r ) const; + // End Comments + BOOL HasHiddenDetails() const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void ProcessData( const ::std::vector< SCROW >& aChildMembers, const ::std::vector<ScDPValueData>& aValues, + const ScDPSubTotalState& rSubState ); + // End Comments + 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, BOOL bIsSubTotalRow, + const ScDPSubTotalState& rSubState ) const; + + void UpdateDataRow( const ScDPResultMember* pRefMember, long nMeasure, BOOL bIsSubTotalRow, + const ScDPSubTotalState& rSubState ); + void UpdateRunningTotals( const ScDPResultMember* pRefMember, long nMeasure, 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 : + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + typedef std::vector <ScDPResultMember *> MemberArray; + typedef std::map < SCROW , ScDPResultMember *> MemberHash; + // End Comments +private: + const ScDPResultData* pResultData; + MemberArray maMemberArray; + MemberHash maMemberHash; + BOOL bInitialized; + String aDimensionName; //! or ptr to IntDimension? + BOOL bIsDataLayout; //! or ptr to IntDimension? + BOOL bSortByData; + BOOL bSortAscending; + long nSortMeasure; + ScMemberSortOrder aMemberOrder; // used when sorted by measure + BOOL bAutoShow; + BOOL bAutoTopItems; + long nAutoMeasure; + long nAutoCount; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPResultMember* FindMember( SCROW iData ) const; + ScDPResultMember* AddMember( const ScDPParentDimData& aData ); + ScDPResultMember* InsertMember( ScDPParentDimData* pMemberData ); + ResultMembers* GetResultMember( ScDPDimension* pDim, ScDPLevel* pLevel ); + void InitWithMembers( LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState ); + // End Comments +public: + ScDPResultDimension( const ScDPResultData* pData ); + ~ScDPResultDimension(); + + // allocates new members + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void InitFrom( const ::std::vector<ScDPDimension*>& ppDim, + const ::std::vector<ScDPLevel*>& ppLev, + size_t nPos, + ScDPInitState& rInitState , BOOL bInitChild = TRUE ); + void LateInitFrom( LateInitParams& rParams, + const ::std::vector< SCROW >& pItemData, + size_t nPos, + ScDPInitState& rInitState ); + void CheckShowEmpty( BOOL bShow = FALSE ); + + // End Comments + long GetSize(long nMeasure) const; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + 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 + // End Comments + 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; } + + BOOL IsDataLayout() const { return bIsDataLayout; } + String GetName() const { return aDimensionName; } + + BOOL IsSortByData() const { return bSortByData; } + BOOL IsSortAscending() const { return bSortAscending; } + long GetSortMeasure() const { return nSortMeasure; } + + BOOL IsAutoShow() const { return bAutoShow; } + 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; + BOOL bIsDataLayout; //! or ptr to IntDimension? + +public: + ScDPDataDimension( const ScDPResultData* pData ); + ~ScDPDataDimension(); + + void InitFrom( const ScDPResultDimension* pDim ); // recursive + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + void ProcessData( const ::std::vector< SCROW >& aDataMembers, const ::std::vector<ScDPValueData>& aValues, + const ScDPSubTotalState& rSubState ); + // End Comments + void FillDataRow( const ScDPResultDimension* pRefDim, + com::sun::star::uno::Sequence<com::sun::star::sheet::DataResult>& rSequence, + long nCol, long nMeasure, BOOL bIsSubTotalRow, + const ScDPSubTotalState& rSubState ) const; + + void UpdateDataRow( const ScDPResultDimension* pRefDim, long nMeasure, BOOL bIsSubTotalRow, + const ScDPSubTotalState& rSubState ) const; + void UpdateRunningTotals( const ScDPResultDimension* pRefDim, long nMeasure, 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: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPResultVisibilityData( ScDPSource* pSource); + // End Comments + ~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 ::std::hash_set<ScDPItemData, MemberHash> VisibleMemberType; + typedef ::std::hash_map<String, VisibleMemberType, ScStringHashCode> DimMemberType; + DimMemberType maDimensions; + + ScDPSource* mpSource; +}; + +#endif + diff --git a/sc/inc/dptabsrc.hxx b/sc/inc/dptabsrc.hxx new file mode 100644 index 000000000000..18210f38e80e --- /dev/null +++ b/sc/inc/dptabsrc.hxx @@ -0,0 +1,875 @@ +/************************************************************************* + * + * 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 <hash_map> +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include <list> +// End Comments +#include <memory> +#include <tools/string.hxx> +#include <tools/list.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> +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +#include "dpglobal.hxx" +// End Comments +#include "dptabdat.hxx" + +namespace com { namespace sun { namespace star { + namespace sheet { + struct DataPilotFieldFilter; + } + namespace table { + struct CellAddress; + } +}}} + +class ScDPResultMember; +class ScDPResultData; +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance +class ScDPItemData; +// End Comments +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; + BOOL bColumnGrand; + BOOL bRowGrand; + BOOL bIgnoreEmptyRows; + 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; + List aColLevelList; + List aRowLevelList; + BOOL bResultOverflow; + + ::std::auto_ptr<rtl::OUString> mpGrandTotalName; + + void CreateRes_Impl(); + void FillMemberResults(); + void FillLevelList( USHORT nOrientation, List& 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(::std::hash_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 ); // TableData is deleted by Source + virtual ~ScDPSource(); + + ScDPTableData* GetData() { return pData; } + const ScDPTableData* GetData() const { return pData; } + + void SetGrandTotalName(const ::rtl::OUString& rName); + const ::rtl::OUString* GetGrandTotalName() const; + + USHORT GetOrientation(long nColumn); + void SetOrientation(long nColumn, USHORT nNew); + long GetPosition(long nColumn); + + long GetDataDimensionCount(); + ScDPDimension* GetDataDimension(long nIndex); + String GetDataDimName(long nIndex); + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPTableDataCache* GetCache(); + const ScDPItemData* GetItemDataById( long nDim, long nId ); + long GetDataLayoutDim(){ return pData->GetColumnCount(); } + SCROW GetMemberId( long nDim, const ScDPItemData& rData ); + // End Comments + BOOL IsDataLayoutDimension(long nDim); + USHORT GetDataLayoutOrientation(); + + BOOL IsDateDimension(long nDim); + UINT32 GetNumberFormat(long nDim); + + 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(); + +//UNUSED2009-05 void DumpState( ScDocument* pDoc, const ScAddress& rPos ); + + // 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 BOOL getColumnGrand() const; + virtual void setColumnGrand(BOOL bSet); + virtual BOOL getRowGrand() const; + virtual void setRowGrand(BOOL bSet); + + virtual BOOL getIgnoreEmptyRows() const; + virtual void setIgnoreEmptyRows(BOOL bSet); + virtual BOOL getRepeatIfEmpty() const; + virtual void setRepeatIfEmpty(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; + USHORT 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" + 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 USHORT getOrientation() const; + virtual void setOrientation(USHORT nNew); + virtual long getPosition() const; + virtual void setPosition(long nNew); + virtual BOOL getIsDataLayoutDimension() const; + virtual USHORT getFunction() const; + virtual void setFunction(USHORT nNew); // for data dimension + virtual long getUsedHierarchy() const; + virtual void setUsedHierarchy(long nNew); + virtual BOOL isDuplicated() const; + + BOOL HasSelectedPage() const { return bHasSelectedPage; } + const ScDPItemData& GetSelectedData(); + + const ::com::sun::star::sheet::DataPilotFieldReference& GetReferenceValue() const; + +//UNUSED2009-05 BOOL IsValidPage( const ScDPItemData& rData ); +// Wang Xu Ming -- 2009-8-17 +// DataPilot Migration - Cache&&Performance + BOOL IsVisible( const ScDPItemData& rData ); +// End Comments +}; + +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; + 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 + 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 BOOL getShowEmpty() const; + virtual void setShowEmpty(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( 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; } + + BOOL IsOutlineLayout() const + { return bEnableLayout && + aLayoutInfo.LayoutMode != + ::com::sun::star::sheet::DataPilotFieldLayoutMode::TABULAR_LAYOUT; } + + BOOL IsSubtotalsAtTop() const + { return bEnableLayout && + aLayoutInfo.LayoutMode == + ::com::sun::star::sheet::DataPilotFieldLayoutMode::OUTLINE_SUBTOTALS_TOP; } + + 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 ::std::hash_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 + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + const std::vector<sal_Int32>& GetGlobalOrder(); + const ScDPItemData* GetSrcItemDataByIndex( SCROW nIndex); + SCROW GetSrcItemsCount(); + // End Comments +}; + +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; + + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + SCROW mnDataId; + // End Comments +// String aCaption; // visible name (changeable by user) + ::std::auto_ptr<rtl::OUString> mpLayoutName; + + sal_Int32 nPosition; // manual sorting + BOOL bVisible; + BOOL bShowDet; + +public: + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + ScDPMember( ScDPSource* pSrc, long nD, long nH, long nL, + SCROW nIndex /*const String& rN, double fV, BOOL bHV */); + // End Comments + virtual ~ScDPMember(); + + BOOL IsNamedItem( const ScDPItemData& r ) const; + String GetNameStr() const; + void FillItemData( ScDPItemData& rData ) const; + // Wang Xu Ming -- 2009-8-17 + // DataPilot Migration - Cache&&Performance + // const ScDPItemData& GetItemData() const{ return maData; } + const ScDPItemData& GetItemData() const; + inline SCROW GetItemDataId() const { return mnDataId; } + BOOL IsNamedItem( SCROW nIndex ) const; + // End Comments + + 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 BOOL getIsVisible() const; + virtual void setIsVisible(BOOL bSet); + virtual BOOL getShowDetails() const; + virtual void setShowDetails(BOOL bSet); + + sal_Int32 getPosition() const; + void setPosition(sal_Int32 nNew); +}; + + +#endif + diff --git a/sc/inc/drawattr.hxx b/sc/inc/drawattr.hxx new file mode 100644 index 000000000000..ee4f48ad9cf5 --- /dev/null +++ b/sc/inc/drawattr.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * 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(USHORT nWhichP) : SfxEnumItem(nWhichP){} + + + virtual String GetValueText() const; + + + virtual String GetValueText(USHORT nVal) const; + virtual USHORT GetValueCount() const + {return((USHORT)SVX_SNAP_DRAW_TEXT);} + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const; + + virtual SfxPoolItem* Create( SvStream& rStream, USHORT nVer ) const; + + inline SvxDrawToolItem& operator=(const SvxDrawToolItem& + rDrawTool) + { + SetValue( rDrawTool.GetValue() ); + return *this; + + } +}; +#endif + + diff --git a/sc/inc/drawpage.hxx b/sc/inc/drawpage.hxx new file mode 100644 index 000000000000..9c39fc71e5af --- /dev/null +++ b/sc/inc/drawpage.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + +#ifndef _FM_FMPAGE_HXX +#include <svx/fmpage.hxx> +#endif + + +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 + + diff --git a/sc/inc/drdefuno.hxx b/sc/inc/drdefuno.hxx new file mode 100644 index 000000000000..09fd3368271e --- /dev/null +++ b/sc/inc/drdefuno.hxx @@ -0,0 +1,52 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/drwlayer.hxx b/sc/inc/drwlayer.hxx new file mode 100644 index 000000000000..7dd9903f82a1 --- /dev/null +++ b/sc/inc/drwlayer.hxx @@ -0,0 +1,233 @@ +/************************************************************************* + * + * 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; } +}; + +// ----------------------------------------------------------------------- +// +// Das Anpassen der Detektiv-UserData muss zusammen mit den Draw-Undo's +// in der SdrUndoGroup liegen, darum von SdrUndoAction abgeleitet: + +class ScUndoObjData : public SdrUndoObj +{ +private: + ScAddress aOldStt; + ScAddress aOldEnd; + ScAddress aNewStt; + ScAddress aNewEnd; + 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: +//REMOVE SotStorageRef xPictureStorage; + String aName; + ScDocument* pDoc; + SdrUndoGroup* pUndoGroup; + BOOL bRecording; + BOOL bAdjustEnabled; + BOOL bHyphenatorSet; + +private: + void MoveAreaTwips( SCTAB nTab, const Rectangle& rArea, const Point& rMove, + const Point& rTopLeft ); + void MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2, + SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos ); + + void RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos ); + +public: + ScDrawLayer( ScDocument* pDocument, const String& rName ); + virtual ~ScDrawLayer(); + + virtual SdrPage* AllocPage(FASTBOOL 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; + +//REMOVE void ReleasePictureStorage(); + + BOOL HasObjects() const; + + BOOL ScAddPage( SCTAB nTab ); + void ScRemovePage( SCTAB nTab ); + void ScRenamePage( SCTAB nTab, const String& rNewName ); + void ScMovePage( USHORT nOldPos, USHORT nNewPos ); + // inkl. Inhalt, bAlloc=FALSE -> nur Inhalt + void ScCopyPage( USHORT nOldPos, USHORT nNewPos, BOOL bAlloc ); + + ScDocument* GetDocument() const { return pDoc; } + + void UpdateBasic(); // DocShell-Basic in DrawPages setzen + void UseHyphenator(); + + BOOL GetPrintArea( ScRange& rRange, BOOL bSetHor, BOOL bSetVer ) const; + + // automatische Anpassungen + + void EnableAdjust( BOOL bSet = TRUE ) { bAdjustEnabled = bSet; } + + void BeginCalcUndo(); + SdrUndoGroup* GetCalcUndo(); + 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, BOOL bInsDel, bool bUpdateNoteCaptionPos = true ); + void WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips ); + void HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips ); + + 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 ); +#if 0 + void DeleteObjects( SCTAB nTab ); +#endif + + 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( USHORT 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, USHORT 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(); + + // Verankerung setzen und ermitteln + static void SetAnchor( SdrObject*, ScAnchorType ); + static ScAnchorType GetAnchor( const SdrObject* ); + + // Positionen fuer Detektivlinien + static ScDrawObjData* GetObjData( SdrObject* pObj, 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, BOOL bCreate = FALSE ); + +private: + static SfxObjectShell* pGlobalDrawPersist; // fuer AllocModel +public: + static void SetGlobalDrawPersist(SfxObjectShell* pPersist); +protected: + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel(); +}; + + +#endif + + diff --git a/sc/inc/editsrc.hxx b/sc/inc/editsrc.hxx new file mode 100644 index 000000000000..ed4423d629a8 --- /dev/null +++ b/sc/inc/editsrc.hxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * 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 +{ + USHORT nPart; + +public: + TYPEINFO(); + ScHeaderFooterChangedHint(USHORT nP); + ~ScHeaderFooterChangedHint(); + + USHORT 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, USHORT nP ); + ScHeaderFooterEditSource( ScHeaderFooterContentObj& rContent, USHORT 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; + 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 = sal_False ); + virtual void UpdateData(); + virtual SfxBroadcaster& GetBroadcaster() const; +}; + +#endif + diff --git a/sc/inc/editutil.hxx b/sc/inc/editutil.hxx new file mode 100644 index 000000000000..aefa789d2587 --- /dev/null +++ b/sc/inc/editutil.hxx @@ -0,0 +1,264 @@ +/************************************************************************* + * + * 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 muss eingestellt sein + double nPPTX; + double nPPTY; + Fraction aZoomX; + Fraction aZoomY; + + static const char __FAR_DATA 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, BOOL bForceToTop ); +}; + + +class ScEditAttrTester +{ + ScEditEngineDefaulter* pEngine; + SfxItemSet* pEditAttrs; + BOOL bNeedsObject; + BOOL bNeedsCellAttr; + +public: + ScEditAttrTester( ScEditEngineDefaulter* pEng ); + ~ScEditAttrTester(); + + BOOL NeedsObject() const { return bNeedsObject; } + 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; + BOOL bDeleteEnginePool; + BOOL bDeleteDefaults; + + ScEnginePoolHelper( SfxItemPool* pEnginePool, + 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, + 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, BOOL bRememberCopy = TRUE ); + + /// Becomes the owner of the SfxItemSet if bTakeOwnership set + void SetDefaults( SfxItemSet* pDefaults, BOOL bTakeOwnership = 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, BOOL bRememberCopy = TRUE ); + /// Current defaults are not applied, new defaults are applied + void SetTextNewDefaults( const EditTextObject& rTextObject, + SfxItemSet* pDefaults, BOOL bTakeOwnership = 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, BOOL bRememberCopy = TRUE ); + /// Current defaults are not applied, new defaults are applied + void SetTextNewDefaults( const String& rText, + SfxItemSet* pDefaults, BOOL bTakeOwnership = 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 + // pEnginePool = ScDocument.GetEnginePool() + // pTextObjectPool = ScDocument.GetEditPool() + ScTabEditEngine( const ScPatternAttr& rPattern, + SfxItemPool* pEnginePool, + SfxItemPool* pTextObjectPool = NULL ); +}; + + +struct ScHeaderFieldData +{ + String aTitle; // Titel oder Dateiname wenn kein Titel + String aLongDocName; // Pfad und Dateiname + String aShortDocName; // nur Dateiname + String aTabName; + Date aDate; + Time aTime; + long nPageNo; + long nTotalPages; + SvxNumType eNumType; + + ScHeaderFieldData(); +}; + + +// fuer Feldbefehle in der Tabelle +class SC_DLLPUBLIC ScFieldEditEngine : public ScEditEngineDefaulter +{ +private: + BOOL bExecuteURL; + +public: + // pEnginePool = ScDocument.GetEnginePool() + // pTextObjectPool = ScDocument.GetEditPool() + ScFieldEditEngine( SfxItemPool* pEnginePool, + SfxItemPool* pTextObjectPool = NULL, + BOOL bDeleteEnginePool = FALSE ); + + void SetExecuteURL(BOOL bSet) { bExecuteURL = bSet; } + + virtual void FieldClicked( const SvxFieldItem& rField, USHORT, USHORT ); + virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT nPos, Color*& rTxtColor, Color*& rFldColor ); +}; + + +// for headers/footers with fields +class SC_DLLPUBLIC ScHeaderEditEngine : public ScEditEngineDefaulter +{ +private: + ScHeaderFieldData aData; + +public: + ScHeaderEditEngine( SfxItemPool* pEnginePool, BOOL bDeleteEnginePool = FALSE ); + virtual String CalcFieldValue( const SvxFieldItem& rField, USHORT nPara, USHORT 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: + // pEnginePool = ScDocument.GetEnginePool() + // pTextObjectPool = ScDocument.GetEditPool() + ScNoteEditEngine( SfxItemPool* pEnginePool, + SfxItemPool* pTextObjectPool = NULL, + BOOL bDeleteEnginePool = FALSE ); + +}; + +// SvxFieldData-Ableitungen sind nach Svx verschoben + + +#endif + + diff --git a/sc/inc/eventuno.hxx b/sc/inc/eventuno.hxx new file mode 100755 index 000000000000..f3ae72f0f1bf --- /dev/null +++ b/sc/inc/eventuno.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sheetdata.hxx,v $ + * $Revision: 1.16.32.2 $ + * + * 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 + diff --git a/sc/inc/externalrefmgr.hxx b/sc/inc/externalrefmgr.hxx new file mode 100644 index 000000000000..818920885493 --- /dev/null +++ b/sc/inc/externalrefmgr.hxx @@ -0,0 +1,758 @@ +/************************************************************************* + * + * 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 <hash_map> +#include <hash_set> +#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 ::boost::shared_ptr< formula::FormulaToken> 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 ::std::hash_map<SCCOL, Cell> RowDataType; + typedef ::std::hash_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; + const ScRangeList& getCachedRanges() 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 ::std::hash_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, + 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<String>& 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(); + explicit ReferencedStatus( size_t nDocs ); + 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 ::std::hash_map<String, TokenArrayRef, ScStringHashCode> RangeNameMap; + typedef ::std::hash_map<ScRange, TokenArrayRef, RangeHash> RangeArrayMap; + typedef ::std::hash_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 ::std::hash_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 ::std::hash_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 ::std::hash_map<sal_uInt16, SrcShell> DocShellMap; + typedef ::std::hash_map<sal_uInt16, bool> LinkedDocMap; + + typedef ::std::hash_map<sal_uInt16, SvNumberFormatterMergeMap> NumFmtMap; + + + typedef ::std::hash_set<LinkListener*, LinkListener::Hash> LinkListeners; + typedef ::std::hash_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<String>& 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); + + 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, 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 diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx new file mode 100644 index 000000000000..584d62451cc6 --- /dev/null +++ b/sc/inc/fielduno.hxx @@ -0,0 +1,454 @@ +/************************************************************************* + * + * 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(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; // Inhalt, wenn noch nicht eingefuegt (nur dann!) + 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 ); + + // per getImplementation gerufen: + void DeleteField(); + 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; + USHORT nPart; + UINT16 nType; + SvxEditSource* pEditSource; + + /// List of refresh listeners. + cppu::OInterfaceContainerHelper* mpRefreshListeners; + /// mutex to lock the InterfaceContainerHelper + osl::Mutex aMutex; + + ScHeaderFieldObj* GetObjectByIndex_Impl(INT32 Index) const; + +public: + ScHeaderFieldsObj(ScHeaderFooterContentObj* pContent, + USHORT nP, USHORT 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; + USHORT nPart; + UINT16 nType; + SvxEditSource* pEditSource; + ESelection aSelection; + sal_Int16 nFileFormat; // enum SvxFileFormat, valid if not inserted + + ScHeaderFieldObj(); // disabled +public: + ScHeaderFieldObj(ScHeaderFooterContentObj* pContent, USHORT nP, + USHORT nT, const ESelection& rSel); + virtual ~ScHeaderFieldObj(); + + // per getImplementation gerufen: + void DeleteField(); + BOOL IsInserted() const { return pEditSource != NULL; } + SvxFieldItem CreateFieldItem(); + void InitDoc( ScHeaderFooterContentObj* pContent, USHORT 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 + diff --git a/sc/inc/fillinfo.hxx b/sc/inc/fillinfo.hxx new file mode 100644 index 000000000000..8dead5b4fb05 --- /dev/null +++ b/sc/inc/fillinfo.hxx @@ -0,0 +1,153 @@ +/************************************************************************* + * + * 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 BYTE SC_ROTDIR_NONE = 0; +const BYTE SC_ROTDIR_STANDARD = 1; +const BYTE SC_ROTDIR_LEFT = 2; +const BYTE SC_ROTDIR_RIGHT = 3; +const BYTE SC_ROTDIR_CENTER = 4; + +const BYTE SC_CLIPMARK_NONE = 0; +const BYTE SC_CLIPMARK_LEFT = 1; +const BYTE SC_CLIPMARK_RIGHT = 2; +const BYTE 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 (intern) + + const SvxShadowItem* pHShadowOrigin; + const SvxShadowItem* pVShadowOrigin; + + ScShadowPart eHShadowPart : 4; // Schatten effektiv zum Zeichnen + ScShadowPart eVShadowPart : 4; + BYTE nClipMark; + USHORT nWidth; + BYTE nRotateDir; + + BOOL bMarked : 1; + BOOL bEmptyCellText : 1; + + BOOL bMerged : 1; + BOOL bHOverlapped : 1; + BOOL bVOverlapped : 1; + BOOL bAutoFilter : 1; + BOOL bPushButton : 1; + bool bPopupButton: 1; + bool bFilterActive:1; + + BOOL bPrinted : 1; // bei Bedarf (Pagebreak-Modus) + + BOOL bHideGrid : 1; // output-intern + BOOL bEditEngine : 1; // output-intern +}; + +const SCCOL SC_ROTMAX_NONE = SCCOL_MAX; + +// ============================================================================ + +struct RowInfo +{ + CellInfo* pCellInfo; + + USHORT nHeight; + SCROW nRowNo; + SCCOL nRotMaxCol; // SC_ROTMAX_NONE, wenn nichts + + BOOL bEmptyBack; + BOOL bEmptyText; + BOOL bAutoFilter; + BOOL bPushButton; + BOOL bChanged; // TRUE, wenn nicht getestet + + inline explicit RowInfo() : pCellInfo( 0 ) {} + +private: + RowInfo( const RowInfo& ); + RowInfo& operator=( const RowInfo& ); +}; + +// ============================================================================ + +struct ScTableInfo +{ + svx::frame::Array maArray; + RowInfo* mpRowInfo; + USHORT mnArrCount; + bool mbPageMode; + + explicit ScTableInfo(); + ~ScTableInfo(); + +private: + ScTableInfo( const ScTableInfo& ); + ScTableInfo& operator=( const ScTableInfo& ); +}; + +// ============================================================================ + +#endif + diff --git a/sc/inc/filter.hxx b/sc/inc/filter.hxx new file mode 100644 index 000000000000..ae0fd92f6858 --- /dev/null +++ b/sc/inc/filter.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * 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-Werte Im-/Exportfilter (ULONG) + +typedef ULONG FltError; +//enum FltError { + +#define eERR_OK ERRCODE_NONE // kein Fehler, alles OK +#define eERR_OPEN SCERR_IMPORT_OPEN // ... +#define eERR_UNBEK SCERR_IMPORT_UNKNOWN // unbekannter Fehler, auch historische Bedeutung +#define eERR_NOMEM SCERR_IMPORT_OUTOFMEM // nicht mehr genuegend Speicher zur Verfuegung +#define eERR_UNKN_WK SCERR_IMPORT_UNKNOWN_WK // unbekanntes WK?-Format (Lotus 1-2-3) +#define eERR_FORMAT SCERR_IMPORT_FORMAT // Formatfehler beim Lesen (kein Formel-Fehler!) +#define eERR_NI SCERR_IMPORT_NI // Nicht implementierter Filter +#define eERR_UNKN_BIFF SCERR_IMPORT_UNKNOWN_BIFF // unbekanntes BIFF-Format (Excel) +#define eERR_NI_BIFF SCERR_IMPORT_NI_BIFF // nicht implementiertes BIFF-Format +#define eERR_FILEPASSWD SCERR_IMPORT_FILEPASSWD // File Passwordgeschuetzt +#define eERR_INTERN SCERR_IMPORT_INTERNAL // interner Fehler +#define eERR_RNGOVRFLW SCWARN_IMPORT_RANGE_OVERFLOW// ueberlauf der Zellkoordinaten: + // Tabelle abgschnitten auf erlaubtem Bereich +// mehr Fehlercodes siehe scerrors.hxx + +// }; + + +// fuer Import +enum EXCIMPFORMAT { EIF_AUTO, EIF_BIFF5, EIF_BIFF8, EIF_BIFF_LE4 }; + +// fuer Export +enum ExportFormatLotus { ExpWK1, ExpWK3, ExpWK4 }; +enum ExportFormatExcel { ExpBiff2, ExpBiff3, ExpBiff4, ExpBiff4W, ExpBiff5, ExpBiff8, Exp2007Xml }; + + +// Optionen fuer DIF-Im-/Export (Kombination ueber '|') +#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 ULONG Read( SvStream& rStream, const String& rBaseURL ) = 0; + virtual ScRange GetRange() = 0; + virtual void WriteToDocument( + 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 -> passender Filter wird automatisch verwendet + // eFormat == EIF_BIFF5 -> nur Biff5-Stream fuehrt zum Erfolg (auch wenn in einem Excel97-Doc) + // eFormat == EIF_BIFF8 -> nur Biff8-Stream fuehrt zum Erfolg (nur in Excel97-Docs) + // eFormat == EIF_BIFF_LE4 -> nur Nicht-Storage-Dateien _koennen_ zum Erfolg fuehren + virtual FltError ScImportStarCalc10( SvStream&, ScDocument* ) = 0; + virtual FltError ScImportDif( SvStream&, ScDocument*, const ScAddress& rInsPos, + const CharSet eSrc = RTL_TEXTENCODING_DONTKNOW, 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, + BOOL bCalcWidthHeight = 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, 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, + UINT32 nDifOption = SC_DIFOPT_EXCEL ) = 0; + virtual FltError ScExportDif( SvStream&, ScDocument*, const ScRange& rRange, const CharSet eDest, + UINT32 nDifOption = SC_DIFOPT_EXCEL ) = 0; + virtual FltError ScExportHTML( SvStream&, const String& rBaseURL, ScDocument*, const ScRange& rRange, const CharSet eDest, 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" { + ScFormatFilterPlugin * SAL_CALL ScFilterCreate(void); +} + +class ScFormatFilter { + public: + static ScFormatFilterPlugin &Get(); +}; + +#endif + diff --git a/sc/inc/filtopt.hxx b/sc/inc/filtopt.hxx new file mode 100644 index 000000000000..0efdfeeb5a30 --- /dev/null +++ b/sc/inc/filtopt.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * 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 +{ + 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(); + + BOOL GetWK3Flag() const { return bWK3Flag; } + double GetExcelColScale() const { return fExcelColScale; } + double GetExcelRowScale() const { return fExcelRowScale; } + + // values are never modified by office +}; + + +#endif + diff --git a/sc/inc/filtuno.hxx b/sc/inc/filtuno.hxx new file mode 100644 index 000000000000..2bddb7fdd02c --- /dev/null +++ b/sc/inc/filtuno.hxx @@ -0,0 +1,111 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx new file mode 100644 index 000000000000..eebd808c30a4 --- /dev/null +++ b/sc/inc/fmtuno.hxx @@ -0,0 +1,332 @@ +/************************************************************************* + * + * 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 "address.hxx" +#include "conditio.hxx" +#include <formula/grammar.hxx> +#include <tools/list.hxx> +#include <svl/itemprop.hxx> +#include <com/sun/star/sheet/XSheetConditionalEntries.hpp> +#include <com/sun/star/sheet/XSheetCondition.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> + + +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: + List aEntries; + + ScTableConditionalEntry* GetObjectByIndex_Impl(USHORT nIndex) const; + void AddEntry_Impl(const ScCondFormatEntryItem& aEntry); + + ScTableConditionalFormat(); // disable +public: + ScTableConditionalFormat(ScDocument* pDoc, ULONG nKey, + formula::FormulaGrammar::Grammar eGrammar); + virtual ~ScTableConditionalFormat(); + + void FillFormat( ScConditionalFormat& rFormat, ScDocument* pDoc, + formula::FormulaGrammar::Grammar eGrammar) const; + void DataChanged(); + + // 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::XSheetCondition, + com::sun::star::sheet::XSheetConditionalEntry, + com::sun::star::lang::XServiceInfo > +{ +private: + ScTableConditionalFormat* pParent; + ScCondFormatEntryItem aData; + + ScTableConditionalEntry(); // disabled +public: + ScTableConditionalEntry(ScTableConditionalFormat* pPar, + 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 void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator 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::XSheetCondition, + com::sun::star::sheet::XMultiFormulaTokens, + com::sun::star::beans::XPropertySet, + com::sun::star::lang::XUnoTunnel, + com::sun::star::lang::XServiceInfo > +{ +private: + SfxItemPropertySet aPropSet; + USHORT 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 + USHORT nValMode; // enum ScValidationMode + BOOL bIgnoreBlank; + sal_Int16 nShowList; + BOOL bShowInput; + String aInputTitle; + String aInputMessage; + BOOL bShowError; + USHORT nErrorStyle; // enum ScValidErrorStyle + String aErrorTitle; + String aErrorMessage; + + void ClearData_Impl(); + + ScTableValidationObj(); // disabled +public: + ScTableValidationObj(ScDocument* pDoc, ULONG nKey, + const formula::FormulaGrammar::Grammar eGrammar); + virtual ~ScTableValidationObj(); + + ScValidationData* CreateValidationData( ScDocument* pDoc, + formula::FormulaGrammar::Grammar eGrammar ) const; + void DataChanged(); + + // XSheetCondition + virtual ::com::sun::star::sheet::ConditionOperator SAL_CALL getOperator() + throw(::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setOperator( ::com::sun::star::sheet::ConditionOperator 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 + diff --git a/sc/inc/forbiuno.hxx b/sc/inc/forbiuno.hxx new file mode 100644 index 000000000000..05e23cf96506 --- /dev/null +++ b/sc/inc/forbiuno.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/formulaparserpool.hxx b/sc/inc/formulaparserpool.hxx new file mode 100644 index 000000000000..c65f7f9428ce --- /dev/null +++ b/sc/inc/formulaparserpool.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * 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 <hash_map> +#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 ::std::hash_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 + diff --git a/sc/inc/formularesult.hxx b/sc/inc/formularesult.hxx new file mode 100644 index 000000000000..bd99cca8f5d9 --- /dev/null +++ b/sc/inc/formularesult.hxx @@ -0,0 +1,615 @@ +/************************************************************************* + * + * 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 + }; + USHORT 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 USHORT GetResultError() const; + + /** Set error code, don't touch token or double. */ + inline void SetResultError( USHORT 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 USHORT 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( USHORT 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 diff --git a/sc/inc/funcdesc.hxx b/sc/inc/funcdesc.hxx new file mode 100644 index 000000000000..a46b8f52a638 --- /dev/null +++ b/sc/inc/funcdesc.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * 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 / most recent used + * list et al. Separated from the global.hxx lump, implementation still in + * global.cxx + */ + +#include <tools/list.hxx> +#include <tools/string.hxx> +#include <formula/IFunctionDescription.hxx> + +#define MAX_FUNCCAT 12 /* maximum number of categories for functions */ + +class ScFuncDesc : public formula::IFunctionDescription +{ +public: + + virtual ::rtl::OUString getFunctionName() const ; + virtual const formula::IFunctionCategory* getCategory() const ; + virtual ::rtl::OUString getDescription() const ; + // GetSuppressedArgCount + virtual xub_StrLen getSuppressedArgumentCount() const ; + /** Returns the function signature with parameters from the passed string array. */ + virtual ::rtl::OUString getFormula(const ::std::vector< ::rtl::OUString >& _aArguments) const ; + // GetVisibleArgMapping + /** Returns 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. */ + virtual void fillVisibleArgumentMapping(::std::vector<USHORT>& _rArguments) const ; + virtual void initArgumentInfo() const; + virtual ::rtl::OUString getSignature() const ; + virtual rtl::OString getHelpId() const ; + + // parameter + virtual sal_uInt32 getParameterCount() const ; + virtual ::rtl::OUString getParameterName(sal_uInt32 _nPos) const ; + virtual ::rtl::OUString getParameterDescription(sal_uInt32 _nPos) const ; + virtual bool isParameterOptional(sal_uInt32 _nPos) const ; + + struct ParameterFlags + { + bool bOptional :1; // Parameter is optional + bool bSuppress :1; // Suppress parameter in UI because not implemented yet + + ParameterFlags() : bOptional(false), bSuppress(false) {} + }; + + + ScFuncDesc(); + virtual ~ScFuncDesc(); + + void Clear(); + + /** Returns a semicolon separated list of all parameter names. */ + String GetParamList () const; + /** Returns the full function signature: "FUNCTIONNAME( parameter list )". */ + String 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). */ + USHORT GetSuppressedArgCount() const; + + String *pFuncName; // Function name + String *pFuncDesc; // Description of function + String **ppDefArgNames; // Parameter name(s) + String **ppDefArgDescs; // Description(s) of parameter(s) + ParameterFlags *pDefArgFlags; // Flags for each parameter + USHORT nFIndex; // Unique function index + USHORT nCategory; // Function category + USHORT 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. +}; + +//============================================================================ + +class ScFunctionList +{ +public: + ScFunctionList(); + ~ScFunctionList(); + + ULONG GetCount() const + { return aFunctionList.Count(); } + + const ScFuncDesc* First() + { return (const ScFuncDesc*) aFunctionList.First(); } + + const ScFuncDesc* Next() + { return (const ScFuncDesc*) aFunctionList.Next(); } + + const ScFuncDesc* GetFunction( ULONG nIndex ) const + { return (const ScFuncDesc*) aFunctionList.GetObject( nIndex ); } + + xub_StrLen GetMaxFuncNameLen() const + { return nMaxFuncNameLen; } + +private: + List aFunctionList; + xub_StrLen nMaxFuncNameLen; +}; + +//============================================================================ +class ScFunctionCategory : public formula::IFunctionCategory +{ + ScFunctionMgr* m_pMgr; + List* m_pCategory; + mutable ::rtl::OUString m_sName; + sal_uInt32 m_nCategory; +public: + ScFunctionCategory(ScFunctionMgr* _pMgr,List* _pCategory,sal_uInt32 _nCategory) : m_pMgr(_pMgr),m_pCategory(_pCategory),m_nCategory(_nCategory){} + virtual ~ScFunctionCategory(){} + virtual sal_uInt32 getCount() const; + virtual const formula::IFunctionManager* getFunctionManager() const; + virtual const formula::IFunctionDescription* getFunction(sal_uInt32 _nPos) const; + virtual sal_uInt32 getNumber() const; + virtual ::rtl::OUString getName() const; +}; +//============================================================================ +#define SC_FUNCGROUP_COUNT ID_FUNCTION_GRP_ADDINS +class ScFunctionMgr : public formula::IFunctionManager +{ +public: + ScFunctionMgr(); + virtual ~ScFunctionMgr(); + + static String GetCategoryName(sal_uInt32 _nCategoryNumber ); + + const ScFuncDesc* Get( const String& rFName ) const; + const ScFuncDesc* Get( USHORT nFIndex ) const; + const ScFuncDesc* First( USHORT nCategory = 0 ) const; + const ScFuncDesc* Next() const; + + // formula::IFunctionManager + virtual sal_uInt32 getCount() const; + virtual const formula::IFunctionCategory* getCategory(sal_uInt32 nPos) const; + virtual void fillLastRecentlyUsedFunctions(::std::vector< const formula::IFunctionDescription*>& _rLastRUFunctions) const; + virtual const formula::IFunctionDescription* getFunctionByName(const ::rtl::OUString& _sFunctionName) const; + virtual sal_Unicode getSingleToken(const formula::IFunctionManager::EToken _eToken) const; +private: + ScFunctionList* pFuncList; + List* aCatLists[MAX_FUNCCAT]; + mutable List* pCurCatList; +}; + +//============================================================================ +#endif // SC_FUNCDESC_HXX diff --git a/sc/inc/funcuno.hxx b/sc/inc/funcuno.hxx new file mode 100644 index 000000000000..4413782a0e2f --- /dev/null +++ b/sc/inc/funcuno.hxx @@ -0,0 +1,148 @@ +/************************************************************************* + * + * 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; + BOOL bInUse; + +public: + ScTempDocCache(); + ~ScTempDocCache(); + + ScDocument* GetDocument() const { return pDoc; } + BOOL IsInUse() const { return bInUse; } + void SetInUse( 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 + diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx new file mode 100644 index 000000000000..8178eb4a01d2 --- /dev/null +++ b/sc/inc/global.hxx @@ -0,0 +1,894 @@ +/************************************************************************* + * + * 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 <hash_map> + +class ImageList; +class Bitmap; +class SfxItemSet; +class Color; + +// Macro fuer den Call-Profiler unter WinNT +// mit S_CAP kann eine Messung gestarted, mit E_CAP wieder gestoppt werden +#if defined( WNT ) && defined( PROFILE ) + +extern "C" { + void StartCAP(); + void StopCAP(); + void DumpCAP(); +}; + +#define S_CAP StartCAP(); +#define E_CAP StopCAP(); DumpCAP(); + +#endif + +#if 0 +// I18N doesn't get this right, can't specify more than one to ignore +#define SC_COLLATOR_IGNORES ( \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE | \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_KANA | \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_WIDTH ) +#else +#define SC_COLLATOR_IGNORES ( \ + ::com::sun::star::i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ) +#endif +#if 0 +// #107998# Don't ignore Width and Kana. The issue was mainly with AutoInput, +// but affects also comparison of names in general. +#define SC_TRANSLITERATION_IGNORECASE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE | \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ) +#define SC_TRANSLITERATION_CASESENSE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ) +#else +#define SC_TRANSLITERATION_IGNORECASE ( \ + ::com::sun::star::i18n::TransliterationModules_IGNORE_CASE ) +#define SC_TRANSLITERATION_CASESENSE 0 +#endif + +//------------------------------------------------------------------------ + +// die 1000 Namen des Calc... +// Clipboard-Namen sind jetzt in so3/soapp.hxx +// STRING_SCAPP war "scalc3", "scalc4", jetzt nur noch "scalc" + +#define STRING_SCAPP "scalc" +#define STRING_SCSTREAM "StarCalcDocument" + +#define STRING_STANDARD "Standard" + +// characters ----------------------------------------------------------------- + +// '\r' geht auf'm Mac nicht... +#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 + +#ifdef SC_ROWLIMIT_TYPECONVERSION_NOCONVPASS +const size_t MAXSUBTOTAL = 3; +const size_t MAXQUERY = 8; +const size_t PIVOT_MAXFIELD = 8; +const size_t PIVOT_MAXPAGEFIELD = 10; +#else +const SCSIZE MAXSUBTOTAL = 3; +const SCSIZE MAXQUERY = 8; +const SCSIZE PIVOT_MAXFIELD = 8; +const SCSIZE PIVOT_MAXPAGEFIELD = 10; +#endif + +#define SC_START_INDEX_DB_COLL 50000 + // Oberhalb dieser Grenze liegen + // die Indizes fuer DBBereiche + +/* +#ifdef OS2 +#define PIXEL_PER_INCH 72.0 +#else +#define PIXEL_PER_INCH 96.0 +#endif +*/ + +#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 fuer optimale Breite + // Standard Zeilenhoehe: Text + Rand - 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 // entspricht 10 Punkt + +//! statt STD_ROW_HEIGHT ScGlobal::nStdRowHeight benutzen ! + +#define STD_ROW_HEIGHT (12.8 * TWIPS_PER_POINT) // 256 Twips, 0.45 cm + + // Standardgroesse als Ole-Server (Zellen) +#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 (fuer Messages) +#define PAINT_GRID 1 +#define PAINT_TOP 2 +#define PAINT_LEFT 4 +#define PAINT_EXTRAS 8 +#define PAINT_INVERT 16 +#define PAINT_MARKS 32 +#define PAINT_OBJECTS 64 +#define PAINT_SIZE 128 +#define PAINT_ALL ( PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS | PAINT_OBJECTS | PAINT_SIZE ) + + + // Flags fuer Spalten / Zeilen + // FILTERED immer zusammen mit HIDDEN + // FILTERED und MANUALSIZE nur fuer Zeilen moeglich +const BYTE CR_HIDDEN = 1; +//const BYTE CR_MARKED = 2; +//const BYTE CR_PAGEBREAK = 4; +const BYTE CR_MANUALBREAK = 8; +const BYTE CR_FILTERED = 16; +const BYTE CR_MANUALSIZE = 32; +const BYTE CR_ALL = (CR_HIDDEN | CR_MANUALBREAK | CR_FILTERED | CR_MANUALSIZE); + +typedef BYTE ScBreakType; +const ScBreakType BREAK_NONE = 0; +const ScBreakType BREAK_PAGE = 1; +const ScBreakType BREAK_MANUAL = 2; + +// Insert-/Delete-Flags +const USHORT IDF_NONE = 0x0000; +const USHORT IDF_VALUE = 0x0001; /// Numeric values (and numeric results if IDF_FORMULA is not set). +const USHORT IDF_DATETIME = 0x0002; /// Dates, times, datetime values. +const USHORT IDF_STRING = 0x0004; /// Strings (and string results if IDF_FORMULA is not set). +const USHORT IDF_NOTE = 0x0008; /// Cell notes. +const USHORT IDF_FORMULA = 0x0010; /// Formula cells. +const USHORT IDF_HARDATTR = 0x0020; /// Hard cell attributes. +const USHORT IDF_STYLES = 0x0040; /// Cell styles. +const USHORT IDF_OBJECTS = 0x0080; /// Drawing objects. +const USHORT IDF_EDITATTR = 0x0100; /// Rich-text attributes. +const USHORT IDF_ATTRIB = IDF_HARDATTR | IDF_STYLES; +const USHORT IDF_CONTENTS = IDF_VALUE | IDF_DATETIME | IDF_STRING | IDF_NOTE | IDF_FORMULA; +const USHORT IDF_ALL = IDF_CONTENTS | IDF_ATTRIB | IDF_OBJECTS; +const USHORT IDF_NOCAPTIONS = 0x0200; /// Internal use only (undo etc.): do not copy/delete caption objects of cell notes. +const USHORT 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 USHORT 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 fuer 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 fuer 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 + + // Tabellen linken +#define SC_LINK_NONE 0 +#define SC_LINK_NORMAL 1 +#define SC_LINK_VALUE 2 + + // Eingabe +#define SC_ENTER_NORMAL 0 +#define SC_ENTER_BLOCK 1 +#define SC_ENTER_MATRIX 2 + + // Step = 10pt, max. Einzug = 100 Schritte +#define SC_INDENT_STEP 200 +#define SC_MAX_INDENT 20000 + + // Szenario-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 + + // Ist Bit in Set gesetzt? +#define IS_SET(bit,set)(((set)&(bit))==(bit)) + +#define SEL_ALL -1 // Eingabezeile: alles Selektieren +#define RES_CANCEL 0 // Resultate der Funk.AutoPilot-Seiten +#define RES_BACKWARD 1 +#define RES_END 2 + +enum CellType + { + CELLTYPE_NONE, + CELLTYPE_VALUE, + CELLTYPE_STRING, + CELLTYPE_FORMULA, + CELLTYPE_NOTE, + CELLTYPE_EDIT, + CELLTYPE_SYMBOLS // fuer Laden/Speichern +#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, // Eingabe, ohne im Inplace-Modus zu sein + SC_INPUT_TABLE, // Textcursor in der Tabelle + SC_INPUT_TOP // Textcursor in der Eingabezeile + }; + +enum ScVObjMode // Ausgabemodi von Objekten auf einer Seite +{ + VOBJ_MODE_SHOW, + VOBJ_MODE_HIDE + // #i80528# VOBJ_MODE_DUMMY removed, no longer supported +}; + +enum ScAnchorType // Verankerung eines Zeichenobjekts +{ + SCA_CELL, + SCA_PAGE, + SCA_DONTKNOW // bei Mehrfachselektion +}; + +enum ScGetDBMode +{ + SC_DB_MAKE, // wenn noetig, "unbenannt" anlegen + SC_DB_IMPORT, // wenn noetig, "Importx" anlegen + SC_DB_OLD // nicht neu anlegen +}; + +/// 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 +{ //Verknuepfungen + LM_ALWAYS, //immer aktualisieren + LM_NEVER, //niemals + LM_ON_DEMAND, //auf nachfrage + LM_UNKNOWN //Shit happens +}; + + +// ----------------------------------------------------------------------- + +//================================================================== + +// ----------------------------------------------------------------------- + +// enum with values equal to old DBObject enum from sdb +enum ScDBObject +{ + ScDbTable, + ScDbQuery +}; + +struct ScImportParam +{ + SCCOL nCol1; + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + BOOL bImport; + String aDBName; // Alias der Datenbank + String aStatement; + BOOL bNative; + BOOL bSql; // Statement oder Name? + BYTE nType; // enum DBObject + + ScImportParam(); + ScImportParam( const ScImportParam& r ); + ~ScImportParam(); + + ScImportParam& operator= ( const ScImportParam& r ); + BOOL operator== ( const ScImportParam& r ) const; +//UNUSED2009-05 void Clear (); +}; + +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 ImageList* pOutlineBitmapsHC; + +// static Bitmap* pAnchorBitmap; +// static Bitmap* pGrayAnchorBitmap; + + 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(); //CHINA001 + 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( USHORT 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 ULONG GetStandardFormat( SvNumberFormatter&, + ULONG nFormat, short nType ); + SC_DLLPUBLIC static ULONG GetStandardFormat( double, SvNumberFormatter&, + ULONG nFormat, short nType ); + + SC_DLLPUBLIC static double nScreenPPTX; + SC_DLLPUBLIC static double nScreenPPTY; + + static ScDocShellRef* pDrawClipDocShellRef; + + static USHORT nDefFontHeight; + static USHORT nStdRowHeight; + + SC_DLLPUBLIC static long nLastRowHeightExtra; + static long nLastColWidthExtra; + + static void Init(); // am Anfang + static void InitAddIns(); + static void Clear(); // bei Programmende + + 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. + @param bHC false = standard symbols; true = high contrast symbols. */ + static ImageList* GetOutlineSymbols( bool bHC ); + +// static const Bitmap& GetAnchorBitmap(); +// static const Bitmap& GetGrayAnchorBitmap(); + + static bool HasStarCalcFunctionList(); + static ScFunctionList* GetStarCalcFunctionList(); + static ScFunctionMgr* GetStarCalcFunctionMgr(); + static void ResetFunctionList(); + + static String GetErrorString(USHORT nErrNumber); + static String GetLongErrorString(USHORT nErrNumber); + static BOOL EETextObjEqual( const EditTextObject* pObj1, + const EditTextObject* pObj2 ); + static BOOL CheckWidthInvalidate( BOOL& bNumFormatChanged, + const SfxItemSet& rNewAttrs, + const SfxItemSet& rOldAttrs ); + static BOOL HasAttrChanged( const SfxItemSet& rNewAttrs, + const SfxItemSet& rOldAttrs, + const USHORT 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 BOOL IsSystemRTL(); // depending on system language + static LanguageType GetEditDefaultLanguage(); // for EditEngine::SetDefaultLanguage + SC_DLLPUBLIC static BYTE 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 USHORT GetScriptedWhichID( BYTE nScriptType, USHORT 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 + +//================================================================== +// evtl. in dbdata.hxx auslagern (?): + +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 liefert die ausgezeichneten Feldwerte "leer"/"nicht leer" + * als Konstanten SC_EMPTYFIELDS bzw. SC_NONEMPTYFIELDS in nVal in + * Verbindung mit dem Schalter bQueryByString auf FALSE. + */ + +#define SC_EMPTYFIELDS ((double)0x0042) +#define SC_NONEMPTYFIELDS ((double)0x0043) + +namespace utl +{ + class SearchParam; + class TextSearch; +} + +struct ScQueryEntry +{ + BOOL bDoQuery; + BOOL bQueryByString; + bool bQueryByDate; + SCCOLROW nField; + ScQueryOp eOp; + ScQueryConnect eConnect; + String* pStr; + double nVal; + utl::SearchParam* pSearchParam; // falls RegExp, nicht gespeichert + utl::TextSearch* pSearchText; // falls RegExp, nicht gespeichert + + ScQueryEntry(); + ScQueryEntry(const ScQueryEntry& r); + ~ScQueryEntry(); + + // legt ggbf. pSearchParam und pSearchText an, immer RegExp! + utl::TextSearch* GetSearchTextPtr( BOOL bCaseSens ); + + void Clear(); + ScQueryEntry& operator=( const ScQueryEntry& r ); + BOOL operator==( const ScQueryEntry& r ) const; +}; + +// ----------------------------------------------------------------------- + +struct SC_DLLPUBLIC ScSubTotalParam +{ + SCCOL nCol1; // Selektierter Bereich + SCROW nRow1; + SCCOL nCol2; + SCROW nRow2; + BOOL bRemoveOnly; + BOOL bReplace; // vorhandene Ergebnisse ersetzen + BOOL bPagebreak; // Seitenumbruch bei Gruppenwechsel + BOOL bCaseSens; // Gross-/Kleinschreibung + BOOL bDoSort; // vorher sortieren + BOOL bAscending; // aufsteigend sortieren + BOOL bUserDef; // Benutzer-def. Sort.Reihenfolge + USHORT nUserIndex; // Index auf Liste + BOOL bIncludePattern; // Formate mit sortieren + BOOL bGroupActive[MAXSUBTOTAL]; // aktive Gruppen + SCCOL nField[MAXSUBTOTAL]; // zugehoeriges Feld + SCCOL nSubTotals[MAXSUBTOTAL]; // Anzahl der SubTotals + SCCOL* pSubTotals[MAXSUBTOTAL]; // Array der zu berechnenden Spalten + ScSubTotalFunc* pFunctions[MAXSUBTOTAL]; // Array der zugehoerige Funktionen + + ScSubTotalParam(); + ScSubTotalParam( const ScSubTotalParam& r ); + + ScSubTotalParam& operator= ( const ScSubTotalParam& r ); + BOOL operator== ( const ScSubTotalParam& r ) const; + void Clear (); + void SetSubTotals ( USHORT nGroup, + const SCCOL* ptrSubTotals, + const ScSubTotalFunc* ptrFuncions, + USHORT nCount ); +}; + +// ----------------------------------------------------------------------- +class ScArea; + +struct ScConsolidateParam +{ + SCCOL nCol; // Cursor Position / + SCROW nRow; // bzw. Anfang des Zielbereiches + SCTAB nTab; + ScSubTotalFunc eFunction; // Berechnungsvorschrift + USHORT nDataAreaCount; // Anzahl der Datenbereiche + ScArea** ppDataAreas; // Zeiger-Array auf Datenbereiche + BOOL bByCol; // nach Spalten + BOOL bByRow; // nach Zeilen + BOOL bReferenceData; // Quelldaten referenzieren + + ScConsolidateParam(); + ScConsolidateParam( const ScConsolidateParam& r ); + ~ScConsolidateParam(); + + ScConsolidateParam& operator= ( const ScConsolidateParam& r ); + BOOL operator== ( const ScConsolidateParam& r ) const; + void Clear (); // = ClearDataAreas()+Members + void ClearDataAreas (); + void SetAreas ( ScArea* const* ppAreas, USHORT nCount ); +}; + +// ----------------------------------------------------------------------- +extern ::utl::TransliterationWrapper* GetScGlobalpTransliteration();//CHINA001 +extern const LocaleDataWrapper* GetScGlobalpLocaleData(); + +#endif diff --git a/sc/inc/globstr.hrc b/sc/inc/globstr.hrc new file mode 100644 index 000000000000..31934067988a --- /dev/null +++ b/sc/inc/globstr.hrc @@ -0,0 +1,583 @@ +/************************************************************************* + * + * 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 +// unused: 63 + +#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_STYLENAME_STANDARD 71 s.u. +#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_STYLENAME_RESULT 133 s.u. + +#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 // Funktionsautopilot +#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 // kann spaeter wieder raus + +#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 +//#i80528##define STR_VOBJ_MODE_DUMMY 266 + +#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! */ +// unused: 279 + +#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 +// 318 ist oben +#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_COUNT 440 + +#endif + diff --git a/sc/inc/helpids.h b/sc/inc/helpids.h new file mode 100644 index 000000000000..f1803639cba2 --- /dev/null +++ b/sc/inc/helpids.h @@ -0,0 +1,692 @@ +/************************************************************************* + * + * 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_USERLISTS "SC_HID_SCPAGE_USERLISTS" +#define HID_SCPAGE_HFEDIT "SC_HID_SCPAGE_HFEDIT" +#define HID_SCPAGE_AREAS "SC_HID_SCPAGE_AREAS" +#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..fca3d184a4a2 --- /dev/null +++ b/sc/inc/hints.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * 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; + USHORT nParts; + BOOL bPrint; // Flag, ob auch Druck/Vorschau betroffen ist + + ScPaintHint(); // disabled + +public: + TYPEINFO(); + ScPaintHint( const ScRange& rRng, USHORT nPaint = PAINT_ALL ); + ~ScPaintHint(); + + void SetPrintFlag(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(); } + USHORT GetParts() const { return nParts; } + 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 +{ + USHORT nFlags; + +public: + TYPEINFO(); + +//UNUSED2008-05 ScPointerChangedHint( USHORT nF ); + ~ScPointerChangedHint(); + + USHORT 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 +{ + USHORT nLinkType; // SC_LINKREFTYPE_... + String aUrl; // used for sheet links + String aDdeAppl; // used for dde links: + String aDdeTopic; + String aDdeItem; + BYTE 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, BYTE nM ); + void SetAreaLink( const ScAddress& rPos ); + + USHORT 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; } + BYTE 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; + ULONG nTimeout; + +public: + TYPEINFO(); + ScAutoStyleHint( const ScRange& rR, const String& rSt1, + ULONG nT, const String& rSt2 ); + ~ScAutoStyleHint(); + + const ScRange& GetRange() const { return aRange; } + const String& GetStyle1() const { return aStyle1; } + 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 diff --git a/sc/inc/inputopt.hxx b/sc/inc/inputopt.hxx new file mode 100644 index 000000000000..62e258b76500 --- /dev/null +++ b/sc/inc/inputopt.hxx @@ -0,0 +1,105 @@ +/************************************************************************* + * + * 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: + USHORT nMoveDir; // enum ScDirection + BOOL bMoveSelection; + BOOL bEnterEdit; + BOOL bExtendFormat; + BOOL bRangeFinder; + BOOL bExpandRefs; + BOOL bMarkHeader; + BOOL bUseTabCol; + BOOL bTextWysiwyg; + BOOL bReplCellsWarn; + +public: + ScInputOptions(); + ScInputOptions( const ScInputOptions& rCpy ); + ~ScInputOptions(); + + void SetDefaults(); + + void SetMoveDir(USHORT nNew) { nMoveDir = nNew; } + USHORT GetMoveDir() const { return nMoveDir; } + void SetMoveSelection(BOOL bSet) { bMoveSelection = bSet; } + BOOL GetMoveSelection() const { return bMoveSelection; } + void SetEnterEdit(BOOL bSet) { bEnterEdit = bSet; } + BOOL GetEnterEdit() const { return bEnterEdit; } + void SetExtendFormat(BOOL bSet) { bExtendFormat = bSet; } + BOOL GetExtendFormat() const { return bExtendFormat; } + void SetRangeFinder(BOOL bSet) { bRangeFinder = bSet; } + BOOL GetRangeFinder() const { return bRangeFinder; } + void SetExpandRefs(BOOL bSet) { bExpandRefs = bSet; } + BOOL GetExpandRefs() const { return bExpandRefs; } + void SetMarkHeader(BOOL bSet) { bMarkHeader = bSet; } + BOOL GetMarkHeader() const { return bMarkHeader; } + void SetUseTabCol(BOOL bSet) { bUseTabCol = bSet; } + BOOL GetUseTabCol() const { return bUseTabCol; } + void SetTextWysiwyg(BOOL bSet) { bTextWysiwyg = bSet; } + BOOL GetTextWysiwyg() const { return bTextWysiwyg; } + void SetReplaceCellsWarn(BOOL bSet) { bReplCellsWarn = bSet; } + BOOL GetReplaceCellsWarn() const { return bReplCellsWarn; } + + const ScInputOptions& operator= ( const ScInputOptions& rOpt ); +}; + + +//================================================================== +// CfgItem fuer Eingabe-Optionen +//================================================================== + +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 + diff --git a/sc/inc/linkuno.hxx b/sc/inc/linkuno.hxx new file mode 100644 index 000000000000..284d851a45da --- /dev/null +++ b/sc/inc/linkuno.hxx @@ -0,0 +1,634 @@ +/************************************************************************* + * + * 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 <hash_map> +#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(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; + USHORT 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, USHORT 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); + + // 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); + + // 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(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(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 + diff --git a/sc/inc/listenercalls.hxx b/sc/inc/listenercalls.hxx new file mode 100644 index 000000000000..988cd2a24dd7 --- /dev/null +++ b/sc/inc/listenercalls.hxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/lookupcache.hxx b/sc/inc/lookupcache.hxx new file mode 100644 index 000000000000..431f995d27c2 --- /dev/null +++ b/sc/inc/lookupcache.hxx @@ -0,0 +1,257 @@ +/************************************************************************* + * + * 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 <hash_map> + +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 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 ::std::hash_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 ::std::hash_map< ScRange, ScLookupCache*, ScLookupCache::Hash, ::std::equal_to< ScRange > > ScLookupCacheMap; + +#endif diff --git a/sc/inc/makefile.mk b/sc/inc/makefile.mk new file mode 100644 index 000000000000..a3bcf29670a1 --- /dev/null +++ b/sc/inc/makefile.mk @@ -0,0 +1,48 @@ +#************************************************************************* +# +# 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. +# +#************************************************************************* +PRJ=.. + +PRJNAME=sc +TARGET=inc + +# --- Settings ----------------------------------------------------- + +.INCLUDE : settings.mk +.INCLUDE : $(PRJ)$/util$/makefile.pmk + +# --- Files -------------------------------------------------------- +# --- Targets ------------------------------------------------------- + +.INCLUDE : target.mk + +.IF "$(ENABLE_PCH)"!="" +ALLTAR : \ + $(SLO)$/precompiled.pch \ + $(SLO)$/precompiled_ex.pch + +.ENDIF # "$(ENABLE_PCH)"!="" + diff --git a/sc/inc/markarr.hxx b/sc/inc/markarr.hxx new file mode 100644 index 000000000000..78bb2a6bba3d --- /dev/null +++ b/sc/inc/markarr.hxx @@ -0,0 +1,87 @@ +/************************************************************************* + * + * 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; + BOOL bMarked; +}; + +class ScMarkArray +{ + SCSIZE nCount; + SCSIZE nLimit; + ScMarkEntry* pData; + +friend class ScMarkArrayIter; +friend class ScDocument; // fuer FillInfo + +public: + ScMarkArray(); + ~ScMarkArray(); + void Reset( BOOL bMarked = FALSE ); + BOOL GetMark( SCROW nRow ) const; + void SetMarkArea( SCROW nStartRow, SCROW nEndRow, BOOL bMarked ); + BOOL IsAllMarked( SCROW nStartRow, SCROW nEndRow ) const; + BOOL HasOneMark( SCROW& rStartRow, SCROW& rEndRow ) const; + + BOOL HasMarks() const { return ( nCount > 1 || ( nCount == 1 && pData[0].bMarked ) ); } + + void CopyMarksTo( ScMarkArray& rDestMarkArray ) const; + + BOOL Search( SCROW nRow, SCSIZE& nIndex ) const; +//UNUSED2009-05 void DeleteArea(SCROW nStartRow, SCROW nEndRow); + + /// Including current row, may return -1 if bUp and not found + SCsROW GetNextMarked( SCsROW nRow, BOOL bUp ) const; + SCROW GetMarkEnd( SCROW nRow, BOOL bUp ) const; +}; + + +class ScMarkArrayIter // selektierte Bereiche durchgehen +{ + const ScMarkArray* pArray; + SCSIZE nPos; +public: + ScMarkArrayIter( const ScMarkArray* pNewArray ); + ~ScMarkArrayIter(); + + BOOL Next( SCROW& rTop, SCROW& rBottom ); +}; + + + +#endif + diff --git a/sc/inc/markdata.hxx b/sc/inc/markdata.hxx new file mode 100644 index 000000000000..a982c8db47dd --- /dev/null +++ b/sc/inc/markdata.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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: +//! Es muss auch die Moeglichkeit geben, MarkArrays pro Tabelle zu halten, +//! damit "alle suchen" ueber mehrere Tabellen wieder funktioniert! + + +class SC_DLLPUBLIC ScMarkData +{ +private: + ScRange aMarkRange; // Bereich + ScRange aMultiRange; // maximaler Bereich insgesamt + ScMarkArray* pMultiSel; // Mehrfachselektion + BOOL bTabMarked[MAXTABCOUNT];// Tabelle selektiert + BOOL bMarked; // Rechteck markiert + BOOL bMultiMarked; // mehrfach markiert + + BOOL bMarking; // Bereich wird aufgezogen -> kein MarkToMulti + BOOL bMarkIsNeg; // Aufheben bei Mehrfachselektion + +public: + ScMarkData(); + ScMarkData(const ScMarkData& rData); + ~ScMarkData(); + + ScMarkData& operator=(const ScMarkData& rData); + + void ResetMark(); + void SetMarkArea( const ScRange& rRange ); + + void SetMultiMarkArea( const ScRange& rRange, BOOL bMark = TRUE ); + + void MarkToMulti(); + void MarkToSimple(); + + BOOL IsMarked() const { return bMarked; } + BOOL IsMultiMarked() const { return bMultiMarked; } + + void GetMarkArea( ScRange& rRange ) const; + void GetMultiMarkArea( ScRange& rRange ) const; + + void SetAreaTab( SCTAB nTab ); + + void SelectTable( SCTAB nTab, BOOL bNew ) { bTabMarked[nTab] = bNew; } + BOOL GetTableSelect( SCTAB nTab ) const { return bTabMarked[nTab]; } + + void SelectOneTable( SCTAB nTab ); + SCTAB GetSelectCount() const; + SCTAB GetFirstSelected() const; + + void SetMarkNegative( BOOL bFlag ) { bMarkIsNeg = bFlag; } + BOOL IsMarkNegative() const { return bMarkIsNeg; } + void SetMarking( BOOL bFlag ) { bMarking = bFlag; } + BOOL GetMarkingFlag() const { return bMarking; } + + // fuer FillInfo / Document etc. + const ScMarkArray* GetArray() const { return pMultiSel; } + + BOOL IsCellMarked( SCCOL nCol, SCROW nRow, BOOL bNoSimple = FALSE ) const; + void FillRangeListWithMarks( ScRangeList* pList, BOOL bClear ) const; + void ExtendRangeListTables( ScRangeList* pList ) const; + + void MarkFromRangeList( const ScRangeList& rList, BOOL bReset ); + + SCCOLROW GetMarkColumnRanges( SCCOLROW* pRanges ); + SCCOLROW GetMarkRowRanges( SCCOLROW* pRanges ); + + BOOL IsColumnMarked( SCCOL nCol ) const; + BOOL IsRowMarked( SCROW nRow ) const; + BOOL IsAllMarked( const ScRange& rRange ) const; // Multi + + /// May return -1 + SCsROW GetNextMarked( SCCOL nCol, SCsROW nRow, BOOL bUp ) const; + BOOL HasMultiMarks( SCCOL nCol ) const; + BOOL HasAnyMultiMarks() const; + + // Tabellen-Markierungen anpassen: + void InsertTab( SCTAB nTab ); + void DeleteTab( SCTAB nTab ); +}; + + + +#endif + + diff --git a/sc/inc/miscuno.hxx b/sc/inc/miscuno.hxx new file mode 100644 index 000000000000..d1958eccceac --- /dev/null +++ b/sc/inc/miscuno.hxx @@ -0,0 +1,313 @@ +/************************************************************************* + * + * 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) \ + { DBG_ERROR("not implemented"); } \ + void SAL_CALL ClassName::removePropertyChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XPropertyChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { DBG_ERROR("not implemented"); } \ + void SAL_CALL ClassName::addVetoableChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XVetoableChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { DBG_ERROR("not implemented"); } \ + void SAL_CALL ClassName::removeVetoableChangeListener( const rtl::OUString&, \ + const uno::Reference<beans::XVetoableChangeListener>&) \ + throw(beans::UnknownPropertyException, \ + lang::WrappedTargetException, uno::RuntimeException) \ + { DBG_ERROR("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); +}; + +//UNUSED2008-05 class ScEmptyEnumerationAccess : public cppu::WeakImplHelper2< +//UNUSED2008-05 com::sun::star::container::XEnumerationAccess, +//UNUSED2008-05 com::sun::star::lang::XServiceInfo > +//UNUSED2008-05 { +//UNUSED2008-05 public: +//UNUSED2008-05 ScEmptyEnumerationAccess(); +//UNUSED2008-05 virtual ~ScEmptyEnumerationAccess(); +//UNUSED2008-05 +//UNUSED2008-05 // XEnumerationAccess +//UNUSED2008-05 virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XEnumeration > SAL_CALL +//UNUSED2008-05 createEnumeration() throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 +//UNUSED2008-05 // XElementAccess +//UNUSED2008-05 virtual ::com::sun::star::uno::Type SAL_CALL getElementType() +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual sal_Bool SAL_CALL hasElements() throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 +//UNUSED2008-05 // XServiceInfo +//UNUSED2008-05 virtual ::rtl::OUString SAL_CALL getImplementationName( ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 }; + +//UNUSED2008-05 class ScEmptyEnumeration : public cppu::WeakImplHelper2< +//UNUSED2008-05 com::sun::star::container::XEnumeration, +//UNUSED2008-05 com::sun::star::lang::XServiceInfo > +//UNUSED2008-05 { +//UNUSED2008-05 public: +//UNUSED2008-05 ScEmptyEnumeration(); +//UNUSED2008-05 virtual ~ScEmptyEnumeration(); +//UNUSED2008-05 +//UNUSED2008-05 // XEnumeration +//UNUSED2008-05 virtual sal_Bool SAL_CALL hasMoreElements() throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual ::com::sun::star::uno::Any SAL_CALL nextElement() +//UNUSED2008-05 throw(::com::sun::star::container::NoSuchElementException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 +//UNUSED2008-05 // XServiceInfo +//UNUSED2008-05 virtual ::rtl::OUString SAL_CALL getImplementationName( ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 }; + +// 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); +}; + +//UNUSED2008-05 class ScPrintSettingsObj : public cppu::WeakImplHelper2< +//UNUSED2008-05 com::sun::star::beans::XPropertySet, +//UNUSED2008-05 com::sun::star::lang::XServiceInfo > +//UNUSED2008-05 { +//UNUSED2008-05 public: +//UNUSED2008-05 ScPrintSettingsObj(); +//UNUSED2008-05 virtual ~ScPrintSettingsObj(); +//UNUSED2008-05 +//UNUSED2008-05 // XPropertySet +//UNUSED2008-05 virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > +//UNUSED2008-05 SAL_CALL getPropertySetInfo() +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual void SAL_CALL setPropertyValue( const ::rtl::OUString& aPropertyName, +//UNUSED2008-05 const ::com::sun::star::uno::Any& aValue ) +//UNUSED2008-05 throw(::com::sun::star::beans::UnknownPropertyException, +//UNUSED2008-05 ::com::sun::star::beans::PropertyVetoException, +//UNUSED2008-05 ::com::sun::star::lang::IllegalArgumentException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( +//UNUSED2008-05 const ::rtl::OUString& PropertyName ) +//UNUSED2008-05 throw(::com::sun::star::beans::UnknownPropertyException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual void SAL_CALL addPropertyChangeListener( const ::rtl::OUString& aPropertyName, +//UNUSED2008-05 const ::com::sun::star::uno::Reference< +//UNUSED2008-05 ::com::sun::star::beans::XPropertyChangeListener >& xListener ) +//UNUSED2008-05 throw(::com::sun::star::beans::UnknownPropertyException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual void SAL_CALL removePropertyChangeListener( const ::rtl::OUString& aPropertyName, +//UNUSED2008-05 const ::com::sun::star::uno::Reference< +//UNUSED2008-05 ::com::sun::star::beans::XPropertyChangeListener >& aListener ) +//UNUSED2008-05 throw(::com::sun::star::beans::UnknownPropertyException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual void SAL_CALL addVetoableChangeListener( const ::rtl::OUString& PropertyName, +//UNUSED2008-05 const ::com::sun::star::uno::Reference< +//UNUSED2008-05 ::com::sun::star::beans::XVetoableChangeListener >& aListener ) +//UNUSED2008-05 throw(::com::sun::star::beans::UnknownPropertyException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual void SAL_CALL removeVetoableChangeListener( const ::rtl::OUString& PropertyName, +//UNUSED2008-05 const ::com::sun::star::uno::Reference< +//UNUSED2008-05 ::com::sun::star::beans::XVetoableChangeListener >& aListener ) +//UNUSED2008-05 throw(::com::sun::star::beans::UnknownPropertyException, +//UNUSED2008-05 ::com::sun::star::lang::WrappedTargetException, +//UNUSED2008-05 ::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 +//UNUSED2008-05 // XServiceInfo +//UNUSED2008-05 virtual ::rtl::OUString SAL_CALL getImplementationName( ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) +//UNUSED2008-05 throw(::com::sun::star::uno::RuntimeException); +//UNUSED2008-05 }; + + +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 = sal_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 + diff --git a/sc/inc/mutexhlp.hxx b/sc/inc/mutexhlp.hxx new file mode 100644 index 000000000000..bd45332b9817 --- /dev/null +++ b/sc/inc/mutexhlp.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/nameuno.hxx b/sc/inc/nameuno.hxx new file mode 100644 index 000000000000..b8cb1ad91754 --- /dev/null +++ b/sc/inc/nameuno.hxx @@ -0,0 +1,351 @@ +/************************************************************************* + * + * 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 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: + 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(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::WeakImplHelper5< + ::com::sun::star::sheet::XNamedRanges, + ::com::sun::star::container::XEnumerationAccess, + ::com::sun::star::container::XIndexAccess, + ::com::sun::star::document::XActionLockable, + ::com::sun::star::lang::XServiceInfo >, + public SfxListener +{ +private: + ScDocShell* pDocShell; + + 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 ); + + // 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); + + // 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; // Kriterium um Bereich zu finden + +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(sal_uInt16 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 + diff --git a/sc/inc/navicfg.hxx b/sc/inc/navicfg.hxx new file mode 100644 index 000000000000..23cd38e1f10a --- /dev/null +++ b/sc/inc/navicfg.hxx @@ -0,0 +1,58 @@ +/************************************************************************* + * + * 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 fuer Navigator-Zustand +//================================================================== + +class ScNavipiCfg +{ +private: + USHORT nListMode; + USHORT nDragMode; + USHORT nRootType; + +public: + ScNavipiCfg(); + + void SetListMode(USHORT nNew); + USHORT GetListMode() const { return nListMode; } + void SetDragMode(USHORT nNew); + USHORT GetDragMode() const { return nDragMode; } + void SetRootType(USHORT nNew); + USHORT GetRootType() const { return nRootType; } +}; + + +#endif + diff --git a/sc/inc/notesuno.hxx b/sc/inc/notesuno.hxx new file mode 100644 index 000000000000..a1648132f8e1 --- /dev/null +++ b/sc/inc/notesuno.hxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/olinetab.hxx b/sc/inc/olinetab.hxx new file mode 100644 index 000000000000..82a49b3ba025 --- /dev/null +++ b/sc/inc/olinetab.hxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * 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; } // Gruppe versteckt + bool IsVisible() const { return bVisible; } // Control sichtbar? + + 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; + + USHORT FindStart( SCCOLROW nMinStart ); +}; + + +class SC_DLLPUBLIC ScOutlineArray +{ +friend class ScSubOutlineIterator; + +private: + USHORT nDepth; + ScOutlineCollection aCollections[SC_OL_MAXDEPTH]; + + BOOL DecDepth(); + void FindEntry( SCCOLROW nSearchPos, USHORT& rFindLevel, USHORT& rFindIndex, + USHORT nMaxLevel = SC_OL_MAXDEPTH ); + void RemoveSub( SCCOLROW nStartPos, SCCOLROW nEndPos, USHORT nLevel ); + void PromoteSub( SCCOLROW nStartPos, SCCOLROW nEndPos, USHORT nStartLevel ); + +public: + ScOutlineArray(); + ScOutlineArray( const ScOutlineArray& rArray ); + + USHORT GetDepth() const { return nDepth; } + + BOOL FindTouchedLevel( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, + USHORT& rFindLevel ) const; + + BOOL Insert( SCCOLROW nStartPos, SCCOLROW nEndPos, BOOL& rSizeChanged, + BOOL bHidden = FALSE, BOOL bVisible = TRUE ); + BOOL Remove( SCCOLROW nBlockStart, SCCOLROW nBlockEnd, BOOL& rSizeChanged ); + + ScOutlineEntry* GetEntry( USHORT nLevel, USHORT nIndex ) const; + USHORT GetCount( USHORT nLevel ) const; + ScOutlineEntry* GetEntryByPos( USHORT nLevel, SCCOLROW nPos ) const; + + BOOL GetEntryIndex( USHORT nLevel, SCCOLROW nPos, USHORT& rnIndex ) const; + BOOL GetEntryIndexInRange( + USHORT nLevel, SCCOLROW nBlockStart, SCCOLROW nBlockEnd, + USHORT& rnIndex ) const; + + void SetVisibleBelow( USHORT nLevel, USHORT nEntry, BOOL bValue, + BOOL bSkipHidden = FALSE ); + + void GetRange( SCCOLROW& rStart, SCCOLROW& rEnd ) const; + void ExtendBlock( USHORT nLevel, SCCOLROW& rBlkStart, SCCOLROW& rBlkEnd ); + + BOOL TestInsertSpace( SCSIZE nSize, SCCOLROW nMaxVal ) const; + void InsertSpace( SCCOLROW nStartPos, SCSIZE nSize ); + 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; } + + BOOL TestInsertCol( SCSIZE nSize ); + void InsertCol( SCCOL nStartCol, SCSIZE nSize ); + BOOL DeleteCol( SCCOL nStartCol, SCSIZE nSize ); // TRUE: Undo nur ueber Original + BOOL TestInsertRow( SCSIZE nSize ); + void InsertRow( SCROW nStartRow, SCSIZE nSize ); + BOOL DeleteRow( SCROW nStartRow, SCSIZE nSize ); +}; + + +class ScSubOutlineIterator +{ +private: + ScOutlineArray* pArray; + SCCOLROW nStart; + SCCOLROW nEnd; + USHORT nSubLevel; + USHORT nSubEntry; + USHORT nCount; + USHORT nDepth; + +public: + ScSubOutlineIterator( ScOutlineArray* pOutlineArray ); + ScSubOutlineIterator( ScOutlineArray* pOutlineArray, + USHORT nLevel, USHORT nEntry ); + ScOutlineEntry* GetNext(); + USHORT LastLevel() const; + USHORT LastEntry() const; + void DeleteLast(); +}; + +#endif + + diff --git a/sc/inc/optuno.hxx b/sc/inc/optuno.hxx new file mode 100644 index 000000000000..094ff1cfea32 --- /dev/null +++ b/sc/inc/optuno.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/optutil.hxx b/sc/inc/optutil.hxx new file mode 100644 index 000000000000..83b23a3c9ef9 --- /dev/null +++ b/sc/inc/optutil.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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: + static 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; + +// sal_Bool EnableNotification(com::sun::star::uno::Sequence< rtl::OUString >& rNames) +// { return ConfigItem::EnableNotification( rNames ); } + +// com::sun::star::uno::Sequence< rtl::OUString > GetNodeNames(rtl::OUString& rNode) +// { return ConfigItem::GetNodeNames( rNode ); } +}; + +#endif + + diff --git a/sc/inc/pagepar.hxx b/sc/inc/pagepar.hxx new file mode 100644 index 000000000000..935046e81a48 --- /dev/null +++ b/sc/inc/pagepar.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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 +{ + BOOL bCellContent; + BOOL bNotes; + BOOL bGrid; + BOOL bHeaders; + BOOL bCharts; + BOOL bObjects; + BOOL bDrawings; + BOOL bFormulas; + BOOL bNullVals; + BOOL bTopDown; + BOOL bLeftRight; + BOOL bSkipEmpty; + BOOL bScaleNone; + BOOL bScaleAll; + BOOL bScaleTo; + BOOL bScalePageNum; + USHORT nScaleAll; + USHORT nScaleWidth; + USHORT nScaleHeight; + USHORT nScalePageNum; + USHORT nFirstPageNo; + + ScPageTableParam(); + ~ScPageTableParam(); + + BOOL operator== ( const ScPageTableParam& r ) const; + void Reset (); +}; + +struct ScPageAreaParam +{ + BOOL bPrintArea; + BOOL bRepeatRow; + BOOL bRepeatCol; + ScRange aPrintArea; + ScRange aRepeatRow; + ScRange aRepeatCol; + + ScPageAreaParam(); + ~ScPageAreaParam(); + + BOOL operator== ( const ScPageAreaParam& r ) const; + void Reset (); +}; + + +#endif + + diff --git a/sc/inc/pageuno.hxx b/sc/inc/pageuno.hxx new file mode 100644 index 000000000000..4b897748db1e --- /dev/null +++ b/sc/inc/pageuno.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/paramisc.hxx b/sc/inc/paramisc.hxx new file mode 100644 index 000000000000..896fec2e88d9 --- /dev/null +++ b/sc/inc/paramisc.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * 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 ); + BOOL operator== ( const ScSolveParam& r ) const; +}; + +//----------------------------------------------------------------------- + +struct ScTabOpParam +{ + ScRefAddress aRefFormulaCell; + ScRefAddress aRefFormulaEnd; + ScRefAddress aRefRowCell; + ScRefAddress aRefColCell; + BYTE nMode; + + ScTabOpParam() {}; + ScTabOpParam( const ScTabOpParam& r ); + ScTabOpParam( const ScRefAddress& rFormulaCell, + const ScRefAddress& rFormulaEnd, + const ScRefAddress& rRowCell, + const ScRefAddress& rColCell, + BYTE nMd); + ~ScTabOpParam() {}; + + ScTabOpParam& operator= ( const ScTabOpParam& r ); + BOOL operator== ( const ScTabOpParam& r ) const; +}; + +#endif // SC_PARAMISC_HXX + diff --git a/sc/inc/patattr.hxx b/sc/inc/patattr.hxx new file mode 100644 index 000000000000..b8929a450576 --- /dev/null +++ b/sc/inc/patattr.hxx @@ -0,0 +1,193 @@ +/************************************************************************* + * + * 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, USHORT nVersion) const; + virtual SvStream& Store(SvStream& rStream, USHORT nItemVersion) const; + + virtual int operator==(const SfxPoolItem& rCmp) const; + + const SfxPoolItem& GetItem( USHORT nWhichP ) const + { return GetItemSet().Get(nWhichP); } + + static const SfxPoolItem& GetItem( USHORT nWhich, const SfxItemSet& rItemSet, const SfxItemSet* pCondSet ); + const SfxPoolItem& GetItem( USHORT nWhich, const SfxItemSet* pCondSet ) const; + + // pWhich sind keine Ranges, sondern einzelne IDs, 0-terminiert + BOOL HasItemsSet( const USHORT* pWhich ) const; + void ClearItems( const USHORT* 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, + BYTE 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, + BYTE 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(); + + BOOL IsVisible() const; + BOOL IsVisibleEqual( const ScPatternAttr& rOther ) const; + + /** If font is an old symbol font StarBats/StarMath + with text encoding RTL_TEXTENC_SYMBOL */ + BOOL IsSymbolFont() const; + +//UNUSED2008-05 /** Create a FontToSubsFontConverter if needed for +//UNUSED2008-05 this pattern, else return 0. +//UNUSED2008-05 +//UNUSED2008-05 @param nFlags is the bit mask which shall be +//UNUSED2008-05 used for CreateFontToSubsFontConverter(). +//UNUSED2008-05 +//UNUSED2008-05 The converter must be destroyed by the caller +//UNUSED2008-05 using DestroyFontToSubsFontConverter() which +//UNUSED2008-05 should be accomplished using the +//UNUSED2008-05 ScFontToSubsFontConverter_AutoPtr +//UNUSED2008-05 */ +//UNUSED2008-05 FontToSubsFontConverter GetSubsFontConverter( ULONG nFlags ) const; + + ULONG GetNumberFormat( SvNumberFormatter* ) const; + ULONG GetNumberFormat( SvNumberFormatter* pFormatter, + const SfxItemSet* pCondSet ) const; + + long GetRotateVal( const SfxItemSet* pCondSet ) const; + BYTE 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 diff --git a/sc/inc/pch/precompiled_sc.cxx b/sc/inc/pch/precompiled_sc.cxx new file mode 100755 index 000000000000..6d7b708ffd69 --- /dev/null +++ b/sc/inc/pch/precompiled_sc.cxx @@ -0,0 +1,28 @@ +/************************************************************************* + * + * 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" diff --git a/sc/inc/pch/precompiled_sc.hxx b/sc/inc/pch/precompiled_sc.hxx new file mode 100644 index 000000000000..048d7b638d57 --- /dev/null +++ b/sc/inc/pch/precompiled_sc.hxx @@ -0,0 +1,245 @@ +/************************************************************************* + * + * 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/list.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 <vcl/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 <vos/macros.hxx> +#include <vos/object.hxx> +#include <vos/types.hxx> +#include <wchar.h> + +#endif + diff --git a/sc/inc/pivot.hxx b/sc/inc/pivot.hxx new file mode 100644 index 000000000000..489f272bc8ba --- /dev/null +++ b/sc/inc/pivot.hxx @@ -0,0 +1,199 @@ +/************************************************************************* + * + * 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. + * + ************************************************************************/ +/* + WICHTIG: + Folgende Reihenfolge beim Aufbau der Pivot-Tabelle unbedingt einzuhalten: + + pPivot->SetColFields(aColArr, aColCount) + pPivot->SetRowFields(aRowArr, aRowCount) + pPivot->SetDataFields(aDataArr, aDataCount) + if (pPivot->CreateData()) + { + pPivotDrawData(); + pPivotReleaseData(); + } + + ausserdem ist sicherzustellen, dass entweder das ColArr oder das RowArr + einen PivotDataField Eintrag enthalten + +*/ + + +#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; + USHORT nFuncMask; + USHORT nFuncCount; + ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; + + explicit PivotField( SCsCOL nNewCol = 0, USHORT nNewFuncMask = PIVOT_FUNC_NONE ); + + bool operator==( const PivotField& r ) const; +}; + +// ----------------------------------------------------------------------- + +// implementation still in global2.cxx +struct ScPivotParam +{ + SCCOL nCol; // Cursor Position / + SCROW nRow; // bzw. Anfang des Zielbereiches + SCTAB nTab; + ::std::vector<ScDPLabelDataRef> maLabelArray; + PivotField aPageArr[PIVOT_MAXPAGEFIELD]; + PivotField aColArr[PIVOT_MAXFIELD]; + PivotField aRowArr[PIVOT_MAXFIELD]; + PivotField aDataArr[PIVOT_MAXFIELD]; + SCSIZE nPageCount; + SCSIZE nColCount; + SCSIZE nRowCount; + SCSIZE nDataCount; + BOOL bIgnoreEmptyRows; + BOOL bDetectCategories; + BOOL bMakeTotalCol; + BOOL bMakeTotalRow; + + ScPivotParam(); + ScPivotParam( const ScPivotParam& r ); + ~ScPivotParam(); + + ScPivotParam& operator= ( const ScPivotParam& r ); + BOOL operator== ( const ScPivotParam& r ) const; +//UNUSED2009-05 void Clear (); + void ClearPivotArrays(); + void SetLabelData (const ::std::vector<ScDPLabelDataRef>& r); + void SetPivotArrays ( const PivotField* pPageArr, + const PivotField* pColArr, + const PivotField* pRowArr, + const PivotField* pDataArr, + SCSIZE nPageCnt, + SCSIZE nColCnt, + SCSIZE nRowCnt, + SCSIZE nDataCnt ); +}; + +// ----------------------------------------------------------------------- + +typedef PivotField PivotFieldArr[PIVOT_MAXFIELD]; +typedef PivotField PivotPageFieldArr[PIVOT_MAXPAGEFIELD]; + +//------------------------------------------------------------------------ + +struct ScDPLabelData +{ + ::rtl::OUString maName; /// Original name of the dimension. + ::rtl::OUString maLayoutName; /// Layout name (display name) + SCsCOL mnCol; + USHORT mnFuncMask; /// Page/Column/Row subtotal function. + sal_Int32 mnUsedHier; /// Used hierarchy. + sal_Int32 mnFlags; /// Flags from the DataPilotSource dimension + bool mbShowAll; /// true = Show all (also empty) results. + bool mbIsValue; /// true = Sum or count in data field. + + 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, short 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; +}; + +// ============================================================================ + +struct ScDPFuncData +{ + short mnCol; + USHORT mnFuncMask; + ::com::sun::star::sheet::DataPilotFieldReference maFieldRef; + + explicit ScDPFuncData( short nNewCol, USHORT nNewFuncMask ); + explicit ScDPFuncData( short nNewCol, USHORT nNewFuncMask, + const ::com::sun::star::sheet::DataPilotFieldReference& rFieldRef ); +}; + +// ============================================================================ + +typedef std::vector< ScDPLabelData > ScDPLabelDataVec; +typedef std::vector< String > ScDPNameVec; + +// ============================================================================ + +#endif diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx new file mode 100644 index 000000000000..a4363e3adfbc --- /dev/null +++ b/sc/inc/postit.hxx @@ -0,0 +1,263 @@ +/************************************************************************* + * + * 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 TRUE is passed, + the caption drawing object will be created immediately from that + data. If 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 TRUE is passed, clones the caption object and + inserts it into the drawing layer of the destination document. If + 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 TRUE is passed, the caption drawing + object will be created immediately. If FALSE is passed, the caption + drawing object will not be created if the note is not visible + (bShown = FALSE), but the cell note will cache the passed data. + MUST be set to 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 TRUE is passed, the caption drawing + object will be created immediately. If FALSE is passed, the caption + drawing object will not be created if the note is not visible + (bShown = FALSE), but the cell note will cache the passed data. + MUST be set to 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 diff --git a/sc/inc/printopt.hxx b/sc/inc/printopt.hxx new file mode 100644 index 000000000000..ec063d2d0e9b --- /dev/null +++ b/sc/inc/printopt.hxx @@ -0,0 +1,99 @@ +/************************************************************************* + * + * 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: + BOOL bSkipEmpty; + BOOL bAllSheets; + +public: + ScPrintOptions(); + ScPrintOptions( const ScPrintOptions& rCpy ); + ~ScPrintOptions(); + + BOOL GetSkipEmpty() const { return bSkipEmpty; } + void SetSkipEmpty( BOOL bVal ) { bSkipEmpty = bVal; } + BOOL GetAllSheets() const { return bAllSheets; } + void SetAllSheets( 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(); +//UNUSED2008-05 ScTpPrintItem( USHORT nWhich ); + ScTpPrintItem( USHORT 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 diff --git a/sc/inc/prnsave.hxx b/sc/inc/prnsave.hxx new file mode 100644 index 000000000000..b28d04cf48bf --- /dev/null +++ b/sc/inc/prnsave.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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; // einzeln + ScRange* mpRepeatRow; // einzeln + BOOL mbEntireSheet; + +public: + ScPrintSaverTab(); + ~ScPrintSaverTab(); + + void SetAreas( const ScRangeVec& rRanges, BOOL bEntireSheet ); + void SetRepeat( const ScRange* pCol, const ScRange* pRow ); + + const ScRangeVec& GetPrintRanges() const { return maPrintRanges; } + BOOL IsEntireSheet() const { return mbEntireSheet; } + const ScRange* GetRepeatCol() const { return mpRepeatCol; } + const ScRange* GetRepeatRow() const { return mpRepeatRow; } + + 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; + + BOOL operator==( const ScPrintRangeSaver& rCmp ) const; +}; + + +#endif + + diff --git a/sc/inc/progress.hxx b/sc/inc/progress.hxx new file mode 100644 index 000000000000..a9cd3d2544bd --- /dev/null +++ b/sc/inc/progress.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * 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 ULONG nGlobalRange; + static ULONG nGlobalPercent; + static BOOL bGlobalNoUserBreak; + static ScProgress* pInterpretProgress; + static ScProgress* pOldInterpretProgress; + static ULONG nInterpretProgress; + static BOOL bAllowInterpretProgress; + static ScDocument* pInterpretDoc; + static BOOL bIdleWasDisabled; + + SfxProgress* pProgress; + + // not implemented + ScProgress( const ScProgress& ); + ScProgress& operator=( const ScProgress& ); + + static void CalcGlobalPercent( ULONG nVal ) + { + nGlobalPercent = nGlobalRange ? + nVal * 100 / nGlobalRange : 0; + } + +public: + static SfxProgress* GetGlobalSfxProgress() { return pGlobalProgress; } + static BOOL IsUserBreak() { return !bGlobalNoUserBreak; } + static void CreateInterpretProgress( ScDocument* pDoc, + BOOL bWait = TRUE ); + static ScProgress* GetInterpretProgress() { return pInterpretProgress; } + static void DeleteInterpretProgress(); + static ULONG GetInterpretCount() { return nInterpretProgress; } + static ULONG GetGlobalRange() { return nGlobalRange; } + static ULONG GetGlobalPercent() { return nGlobalPercent; } + + ScProgress( SfxObjectShell* pObjSh, + const String& rText, + ULONG nRange, BOOL bAllDocs = FALSE, + BOOL bWait = TRUE ); + ~ScProgress(); + +#ifdef SC_PROGRESS_CXX + // nur fuer DummyInterpret, sonst nie benutzen!!! + ScProgress(); +#endif + // kann NULL sein! + SfxProgress* GetSfxProgress() const { return pProgress; } + + BOOL SetStateText( ULONG nVal, const String &rVal, ULONG nNewRange = 0 ) + { + if ( pProgress ) + { + if ( nNewRange ) + nGlobalRange = nNewRange; + CalcGlobalPercent( nVal ); + if ( !pProgress->SetStateText( nVal, rVal, nNewRange ) ) + bGlobalNoUserBreak = FALSE; + return bGlobalNoUserBreak; + } + return TRUE; + } + BOOL SetState( ULONG nVal, ULONG nNewRange = 0 ) + { + if ( pProgress ) + { + if ( nNewRange ) + nGlobalRange = nNewRange; + CalcGlobalPercent( nVal ); + if ( !pProgress->SetState( nVal, nNewRange ) ) + bGlobalNoUserBreak = FALSE; + return bGlobalNoUserBreak; + } + return TRUE; + } + BOOL SetStateCountDown( ULONG nVal ) + { + if ( pProgress ) + { + CalcGlobalPercent( nGlobalRange - nVal ); + if ( !pProgress->SetState( nGlobalRange - nVal ) ) + bGlobalNoUserBreak = FALSE; + return bGlobalNoUserBreak; + } + return TRUE; + } + BOOL SetStateOnPercent( ULONG nVal ) + { // nur wenn Prozent mehr als vorher + if ( nGlobalRange && (nVal * 100 / + nGlobalRange) > nGlobalPercent ) + return SetState( nVal ); + return TRUE; + } + BOOL SetStateCountDownOnPercent( ULONG nVal ) + { // nur wenn Prozent mehr als vorher + if ( nGlobalRange && + ((nGlobalRange - nVal) * 100 / + nGlobalRange) > nGlobalPercent ) + return SetStateCountDown( nVal ); + return TRUE; + } + ULONG GetState() + { + if ( pProgress ) + return pProgress->GetState(); + return 0; + } +}; + + +#endif + diff --git a/sc/inc/queryparam.hxx b/sc/inc/queryparam.hxx new file mode 100644 index 000000000000..8e84f1e53e36 --- /dev/null +++ b/sc/inc/queryparam.hxx @@ -0,0 +1,142 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: interpre.hxx,v $ + * $Revision: 1.35.44.2 $ + * + * 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(); + + 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; // nicht gespeichert + SCTAB nDestTab; + SCCOL nDestCol; + SCROW nDestRow; + + ScQueryParam(); + ScQueryParam( const ScQueryParam& r ); + ScQueryParam( const ScDBQueryParamInternal& r ); + virtual ~ScQueryParam(); + + ScQueryParam& operator= ( const ScQueryParam& r ); + 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(); +}; + +// ============================================================================ + +struct ScDBQueryParamMatrix : public ScDBQueryParamBase +{ + ScMatrixRef mpMatrix; + + ScDBQueryParamMatrix(); + virtual ~ScDBQueryParamMatrix(); +}; + +#endif diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx new file mode 100644 index 000000000000..e00fce10da1c --- /dev/null +++ b/sc/inc/rangelst.hxx @@ -0,0 +1,117 @@ +/************************************************************************* + * + * 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> + +class ScDocument; + +typedef ScRange* ScRangePtr; +DECLARE_LIST( ScRangeListBase, ScRangePtr ) +class SC_DLLPUBLIC ScRangeList : public ScRangeListBase, public SvRefBase +{ +private: + using ScRangeListBase::operator==; + using ScRangeListBase::operator!=; + +public: + ScRangeList() {} + ScRangeList( const ScRangeList& rList ); + virtual ~ScRangeList(); + ScRangeList& operator=(const ScRangeList& rList); + void RemoveAll(); + void Append( const ScRange& rRange ) + { + ScRangePtr pR = new ScRange( rRange ); + Insert( pR, LIST_APPEND ); + } + USHORT Parse( const String&, ScDocument* = NULL, + USHORT nMask = SCA_VALID, + formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, + sal_Unicode cDelimiter = 0 ); + void Format( String&, USHORT 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 ); + ScRange* Find( const ScAddress& ) const; + BOOL operator==( const ScRangeList& ) const; + BOOL operator!=( const ScRangeList& r ) const; + BOOL Intersects( const ScRange& ) const; + BOOL In( const ScRange& ) const; + ULONG GetCellCount() const; +}; +SV_DECL_IMPL_REF( ScRangeList ); + + +// RangePairList: erster Range (aRange[0]) eigentlicher Range, zweiter +// Range (aRange[1]) Daten zu diesem Range, z.B. Rows eines ColName +DECLARE_LIST( ScRangePairListBase, ScRangePair* ) +class ScRangePairList : public ScRangePairListBase, public SvRefBase +{ +private: + using ScRangePairListBase::operator==; + +public: + virtual ~ScRangePairList(); + ScRangePairList* Clone() const; + void Append( const ScRangePair& rRangePair ) + { + ScRangePair* pR = new ScRangePair( rRangePair ); + Insert( pR, LIST_APPEND ); + } + 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( ULONG& nCount, ScDocument* ) const; + BOOL operator==( const ScRangePairList& ) const; +}; +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 diff --git a/sc/inc/rangenam.hxx b/sc/inc/rangenam.hxx new file mode 100644 index 000000000000..a9f324b8b737 --- /dev/null +++ b/sc/inc/rangenam.hxx @@ -0,0 +1,224 @@ +/************************************************************************* + * + * 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> + +//------------------------------------------------------------------------ + +class ScDocument; + +namespace rtl { + class OUStringBuffer; +} + + +//------------------------------------------------------------------------ + +typedef USHORT 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 : public ScDataObject +{ +private: + String aName; + String aUpperName; // #i62977# for faster searching (aName is never modified after ctor) + ScTokenArray* pCode; + ScAddress aPos; + RangeType eType; + ScDocument* pDoc; + USHORT nIndex; + BOOL bModified; // wird bei UpdateReference gesetzt/geloescht + + // max row and column to use for wrapping of references. If -1 use the + // application's default. + SCROW mnMaxRow; + SCCOL mnMaxCol; + + friend class ScRangeName; + ScRangeData( USHORT 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 ist ABSPOS Sprungmarke + ScRangeData(const ScRangeData& rScRangeData); + + SC_DLLPUBLIC virtual ~ScRangeData(); + + + virtual ScDataObject* Clone() const; + + 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; } + // Der Index muss eindeutig sein. Ist er 0, wird ein neuer Index vergeben + void SetIndex( USHORT nInd ) { nIndex = nInd; } + USHORT GetIndex() const { return nIndex; } + ScTokenArray* GetCode() { return pCode; } + USHORT GetErrCode(); + 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; } + BOOL HasType( RangeType nType ) const; + SC_DLLPUBLIC void GetSymbol( String& 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 ); + 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 BOOL IsReference( ScRange& rRef ) const; + BOOL IsReference( ScRange& rRef, const ScAddress& rPos ) const; + BOOL IsValidReference( ScRange& rRef ) const; + +//UNUSED2009-05 BOOL IsRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const; + BOOL IsRangeAtBlock( const ScRange& ) const; + + void UpdateTabRef(SCTAB nOldTable, USHORT nFlag, SCTAB nNewTable); + void TransferTabRef( SCTAB nOldTab, SCTAB nNewTab ); + + void ValidateTabRefs(); + + void ReplaceRangeNamesInUse( const IndexMap& rMap ); + + static void MakeValidName( String& rName ); + SC_DLLPUBLIC static 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 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 + +//------------------------------------------------------------------------ + +class ScRangeName : public ScSortedCollection +{ +private: + ScDocument* pDoc; + USHORT nSharedMaxIndex; + + using ScSortedCollection::Clone; // calcwarnings: shouldn't be used + +public: + ScRangeName(USHORT nLim = 4, USHORT nDel = 4, BOOL bDup = FALSE, + ScDocument* pDocument = NULL) : + ScSortedCollection ( nLim, nDel, bDup ), + pDoc ( pDocument ), + nSharedMaxIndex ( 1 ) {} // darf nicht 0 sein!! + + ScRangeName(const ScRangeName& rScRangeName, ScDocument* pDocument); + + virtual ScDataObject* Clone(ScDocument* pDocP) const + { return new ScRangeName(*this, pDocP); } + ScRangeData* operator[]( const USHORT nIndex) const + { return (ScRangeData*)At(nIndex); } + virtual short Compare(ScDataObject* pKey1, ScDataObject* pKey2) const; + virtual BOOL IsEqual(ScDataObject* pKey1, ScDataObject* pKey2) const; + +//UNUSED2009-05 ScRangeData* GetRangeAtCursor( const ScAddress&, BOOL bStartOnly ) const; + SC_DLLPUBLIC ScRangeData* GetRangeAtBlock( const ScRange& ) const; + + SC_DLLPUBLIC BOOL SearchName( const String& rName, USHORT& rPos ) const; + // SearchNameUpper must be called with an upper-case search string + BOOL SearchNameUpper( const String& rUpperName, USHORT& rPos ) const; + void UpdateReference(UpdateRefMode eUpdateRefMode, + const ScRange& rRange, + SCsCOL nDx, SCsROW nDy, SCsTAB nDz ); + void UpdateTabRef(SCTAB nTable, USHORT nFlag, SCTAB nNewTable = 0); + void UpdateTranspose( const ScRange& rSource, const ScAddress& rDest ); + void UpdateGrow( const ScRange& rArea, SCCOL nGrowX, SCROW nGrowY ); + virtual BOOL Insert(ScDataObject* pScDataObject); + SC_DLLPUBLIC ScRangeData* FindIndex(USHORT nIndex); + USHORT GetSharedMaxIndex() { return nSharedMaxIndex; } + void SetSharedMaxIndex(USHORT nInd) { nSharedMaxIndex = nInd; } + USHORT GetEntryIndex(); +}; + +#endif + diff --git a/sc/inc/rangeseq.hxx b/sc/inc/rangeseq.hxx new file mode 100644 index 000000000000..6238ea5f8050 --- /dev/null +++ b/sc/inc/rangeseq.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * 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 BOOL FillLongArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange ); + static BOOL FillLongArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix ); + static BOOL FillDoubleArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange ); + static BOOL FillDoubleArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix ); + static BOOL FillStringArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange ); + static BOOL FillStringArray( com::sun::star::uno::Any& rAny, + const ScMatrix* pMatrix, SvNumberFormatter* pFormatter ); + static BOOL FillMixedArray( com::sun::star::uno::Any& rAny, + ScDocument* pDoc, const ScRange& rRange, + 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 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 BOOL GetString( String& rString, const com::sun::star::uno::Any& rAny, + sal_uInt16 nEncoding ); +}; + +#endif + diff --git a/sc/inc/rangeutl.hxx b/sc/inc/rangeutl.hxx new file mode 100644 index 000000000000..ea5d2a901b54 --- /dev/null +++ b/sc/inc/rangeutl.hxx @@ -0,0 +1,321 @@ +/************************************************************************* + * + * 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 "address.hxx" +#include <tools/string.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() {} + + 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; + + BOOL IsAbsTabArea ( const String& rAreaStr, + ScDocument* pDoc, + ScArea*** pppAreas = 0, + USHORT* pAreaCount = 0, + BOOL bAcceptCellRef = FALSE, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; + + 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; + + BOOL IsRefArea ( const String&, + ScDocument*, + SCTAB, + String* = 0, + ScRefAddress* = 0 ) const + { return FALSE; } + + BOOL IsAbsPos ( const String& rPosStr, + ScDocument* pDoc, + SCTAB nTab, + String* pCompleteStr = 0, + ScRefAddress* pPosTripel = 0, + ScAddress::Details const & rDetails = ScAddress::detailsOOOa1 ) const; + + 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 = sal_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 = sal_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 = sal_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 = sal_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 = sal_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 ); + BOOL operator== ( const ScArea& r ) const; + BOOL operator!= ( const ScArea& r ) const { return !( operator==(r) ); } + +public: + SCTAB nTab; + SCCOL nColStart; + SCROW nRowStart; + SCCOL nColEnd; + SCROW nRowEnd; +}; + +//------------------------------------------------------------------------ + +// +// gibt Bereiche mit Referenz und alle DB-Bereiche zurueck +// + +class SC_DLLPUBLIC ScAreaNameIterator +{ +private: + ScRangeName* pRangeName; + ScDBCollection* pDBCollection; + BOOL bFirstPass; + USHORT nPos; + String aStrNoName; + +public: + ScAreaNameIterator( ScDocument* pDoc ); + ~ScAreaNameIterator() {} + + BOOL Next( String& rName, ScRange& rRange ); + BOOL WasDBName() const { return !bFirstPass; } +}; + + +#endif // SC_RANGEUTL_HXX + diff --git a/sc/inc/rechead.hxx b/sc/inc/rechead.hxx new file mode 100644 index 000000000000..348159c12ce1 --- /dev/null +++ b/sc/inc/rechead.hxx @@ -0,0 +1,170 @@ +/************************************************************************* + * + * 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 fuer Dateien: + +#define SCID_SIZES 0x4200 + +#define SCID_POOLS 0x4210 +#define SCID_DOCPOOL 0x4211 +#define SCID_STYLEPOOL 0x4212 +#define SCID_NEWPOOLS 0x4213 // ID fuer 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 fuer 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 + + + +// Dateiversion +// Falls das obere Byte inkrementiert wird, wird das Doc von +// aelteren SCs nicht mehr geladen! + +#define SC_INITIAL_VERSION 0x0001 +#define SC_FORMULA_LCLVER 0x0002 // Formalen mit lokaler VerNr +//-------------------------------- +#define SC_NEW_TOKEN_ARRAYS 0x0003 // neues TokenArray-Format +#define SC_FORMULA_VALUES 0x0004 // Werte in Formelzellen +#define SC_FORMULA_VALUES2 0x0005 // Werte in Formelzellen +#define SC_DATABYTES 0x0006 // Datenbytes, kleine Tables +#define SC_DATABYTES2 0x0007 // Datenbytes, kleine Tables +#define SC_NUMFMT 0x0008 // Zahlenformat an Formelzelle +#define SC_NEWIF 0x0009 // neue Codierung von ocIf (komp.) +//-------------------------------- +#define SC_RELATIVE_REFS 0x0010 // relative Referenzen +#define SC_SUBTOTAL_FLAG 0x0011 // bSubTotal der Formelzelle +#define SC_COLROWNAME_RANGEPAIR 0x0012 // ColRowNameRanges als ScRangePair +//-------------------------------- +#define SC_31_EXPORT_VER 0x0012 // Version bei 3.1-Export +//-------------------------------- ab 4.0 +#define SC_32K_ROWS 0x0100 // 32000 Zeilen - inkompatibel +#define SC_FONTCHARSET 0x0101 // Font-CharSets muessen stimmen +//-------------------------------- +#define SC_40_EXPORT_VER 0x0101 // Version bei 4.0-Export +//-------------------------------- ab 5.0 +#define SC_RECALC_MODE_BITS 0x0201 // TokenArray RecalcMode +#define SC_MATRIX_DOUBLEREF 0x0202 // DoubleRef implizite Schnittmenge +#define SC_VERSION_EDITPOOL 0x0203 // EditCells mit EditPool +#define SC_SUBTOTAL_BUGFIX 0x0204 // bSubTotal der Formelzelle wirklich +//-------------------------------- ab 5.2 +#define SC_CONVERT_RECALC_ON_LOAD 0x0205 // #73616# CONVERT function recalculated on each load +//-------------------------------- +#define SC_CURRENT_VERSION 0x0205 + + +// alles ueber SC_31_EXPORT_VER muss auch beim Speichern abgefragt werden, +// weil 3.1-Export diese Versionsnummer schreibt. + +// btw: 10 nach 09 ist kein Zaehlfehler sondern eine absichtliche Luecke, +// weil nicht klar war, wie lange die RelRefs Entwicklung dauern wuerde.. :) + +class SvStream; + +// ----------------------------------------------------------------------- + + // Header mit Groessenangaben fuer mehrere Objekte + +class ScMultipleReadHeader +{ +private: + SvStream& rStream; + BYTE* pBuf; + SvMemoryStream* pMemStream; + ULONG nEndPos; + ULONG nEntryEnd; + ULONG nTotalEnd; + +public: + ScMultipleReadHeader(SvStream& rNewStream); + ~ScMultipleReadHeader(); + + void StartEntry(); + void EndEntry(); + ULONG BytesLeft() const; +}; + +class ScMultipleWriteHeader +{ +private: + SvStream& rStream; + SvMemoryStream aMemStream; + ULONG nDataPos; + sal_uInt32 nDataSize; + ULONG nEntryStart; + +public: + ScMultipleWriteHeader(SvStream& rNewStream, sal_uInt32 nDefault = 0); + ~ScMultipleWriteHeader(); + + void StartEntry(); + void EndEntry(); +}; + +#endif + + diff --git a/sc/inc/recursionhelper.hxx b/sc/inc/recursionhelper.hxx new file mode 100644 index 000000000000..7b24e1a409b4 --- /dev/null +++ b/sc/inc/recursionhelper.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * 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; + BOOL bOldRunning; + ScFormulaResult aPreviousResult; + ScFormulaRecursionEntry( ScFormulaCell* p, 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; + USHORT nRecursionCount; + USHORT 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(); } + USHORT 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, 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; } + USHORT 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 diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx new file mode 100644 index 000000000000..f42f930084be --- /dev/null +++ b/sc/inc/refdata.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * 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 +{ + BYTE bRelCol; // Flag values (see further down), 2 bits each in file format + BYTE bRelRow; + BYTE bRelTab; + BYTE bOldFlag3D; // two 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 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 + { + BOOL bFlags; + struct + { + BOOL bColRel :1; + BOOL bColDeleted :1; + BOOL bRowRel :1; + BOOL bRowDeleted :1; + BOOL bTabRel :1; + BOOL bTabDeleted :1; + BOOL bFlag3D :1; // 3D-Ref + 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( BOOL bVal ) { Flags.bColRel = (bVal ? TRUE : FALSE ); } + inline BOOL IsColRel() const { return Flags.bColRel; } + inline void SetRowRel( BOOL bVal ) { Flags.bRowRel = (bVal ? TRUE : FALSE ); } + inline BOOL IsRowRel() const { return Flags.bRowRel; } + inline void SetTabRel( BOOL bVal ) { Flags.bTabRel = (bVal ? TRUE : FALSE ); } + inline BOOL IsTabRel() const { return Flags.bTabRel; } + + inline void SetColDeleted( BOOL bVal ) { Flags.bColDeleted = (bVal ? TRUE : FALSE ); } + inline BOOL IsColDeleted() const { return Flags.bColDeleted; } + inline void SetRowDeleted( BOOL bVal ) { Flags.bRowDeleted = (bVal ? TRUE : FALSE ); } + inline BOOL IsRowDeleted() const { return Flags.bRowDeleted; } + inline void SetTabDeleted( BOOL bVal ) { Flags.bTabDeleted = (bVal ? TRUE : FALSE ); } + inline BOOL IsTabDeleted() const { return Flags.bTabDeleted; } + inline BOOL IsDeleted() const { return IsColDeleted() || IsRowDeleted() || IsTabDeleted(); } + + inline void SetFlag3D( BOOL bVal ) { Flags.bFlag3D = (bVal ? TRUE : FALSE ); } + inline BOOL IsFlag3D() const { return Flags.bFlag3D; } + inline void SetRelName( BOOL bVal ) { Flags.bRelName = (bVal ? TRUE : FALSE ); } + inline BOOL IsRelName() const { return Flags.bRelName; } + + inline 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 ); + 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( TRUE ); + SetRowRel( TRUE ); + SetTabRel( TRUE ); + CalcRelFromAbs( rPos ); +} + +inline 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 BOOL IsDeleted() const + { return Ref1.IsDeleted() || Ref2.IsDeleted(); } + inline 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 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 diff --git a/sc/inc/reffind.hxx b/sc/inc/reffind.hxx new file mode 100644 index 000000000000..775571adeab7 --- /dev/null +++ b/sc/inc/reffind.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * 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; + xub_StrLen nFound; + xub_StrLen nSelStart; + xub_StrLen nSelEnd; + +public: + static const sal_Unicode __FAR_DATA pDelimiters[]; + + ScRefFinder( const String& rFormula, + 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 + + diff --git a/sc/inc/refreshtimer.hxx b/sc/inc/refreshtimer.hxx new file mode 100644 index 000000000000..2a8512848ef0 --- /dev/null +++ b/sc/inc/refreshtimer.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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 <tools/list.hxx> +#include <vcl/timer.hxx> +#include <vos/mutex.hxx> +#include <scdllapi.h> + +#define SC_REFRESHTIMER_CONTROL_LIST 0 +#if SC_REFRESHTIMER_CONTROL_LIST +class ScRefreshTimer; +DECLARE_LIST( ScRefreshTimerList, ScRefreshTimer* ) +#endif + +class ScRefreshTimerControl +{ +private: + ::vos::OMutex aMutex; + USHORT nBlockRefresh; + +public: +#if SC_REFRESHTIMER_CONTROL_LIST + ScRefreshTimerList aList; +#endif + + ScRefreshTimerControl() : nBlockRefresh(0) {} + + void SetAllowRefresh( BOOL b ) + { + if ( b && nBlockRefresh ) + --nBlockRefresh; + else if ( !b && nBlockRefresh < (USHORT)(~0) ) + ++nBlockRefresh; + } + BOOL IsRefreshAllowed() const { return !nBlockRefresh; } + ::vos::OMutex& 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() + { +#if SC_REFRESHTIMER_CONTROL_LIST + if ( ppControl && *ppControl ) + (*ppControl)->aList.Insert( this, LIST_APPEND ); +#endif + } + void RemoveFromControl() + { +#if SC_REFRESHTIMER_CONTROL_LIST + if ( ppControl && *ppControl ) + (*ppControl)->aList.Remove( this ); +#endif + } + + void Start() + { + if ( GetTimeout() ) + AutoTimer::Start(); + } + +public: + ScRefreshTimer() : ppControl(0) + { SetTimeout( 0 ); } + ScRefreshTimer( 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; + } + + BOOL operator==( const ScRefreshTimer& r ) const + { return GetTimeout() == r.GetTimeout(); } + + 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 ); } + + ULONG GetRefreshDelay() const + { return GetTimeout() / 1000; } + + void StopRefreshTimer() + { Stop(); } + + SC_DLLPUBLIC virtual void SetRefreshDelay( ULONG nSeconds ); + SC_DLLPUBLIC virtual void Timeout(); +}; + + +#endif // SC_REFRESHTIMER_HXX + diff --git a/sc/inc/reftokenhelper.hxx b/sc/inc/reftokenhelper.hxx new file mode 100644 index 000000000000..86fd36f691fa --- /dev/null +++ b/sc/inc/reftokenhelper.hxx @@ -0,0 +1,80 @@ +/************************************************************************* + * + * 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<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc, + ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH); + + static bool getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal = false); + + static void getRangeListFromTokens(ScRangeList& rRangeList, const ::std::vector<ScSharedTokenRef>& pTokens); + + /** + * Create a double reference token from a range object. + */ + static void getTokenFromRange(ScSharedTokenRef& pToken, const ScRange& rRange); + + static void getTokensFromRangeList(::std::vector<ScSharedTokenRef>& pTokens, const ScRangeList& rRanges); + + static bool SC_DLLPUBLIC isRef(const ScSharedTokenRef& pToken); + static bool SC_DLLPUBLIC isExternalRef(const ScSharedTokenRef& pToken); + + static bool SC_DLLPUBLIC intersects(const ::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken); + + static void SC_DLLPUBLIC join(::std::vector<ScSharedTokenRef>& rTokens, const ScSharedTokenRef& pToken); + + static bool getDoubleRefDataFromToken(ScComplexRefData& rData, const ScSharedTokenRef& pToken); +}; + +#endif diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc new file mode 100644 index 000000000000..159da72a34d2 --- /dev/null +++ b/sc/inc/sc.hrc @@ -0,0 +1,1288 @@ +/************************************************************************* + * + * 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 + +// Bereiche ------------------------------------------------------------------ + +#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) + +// kompatibel zu frueher bleiben: +#define SC_RESOURCE_START (RID_APP_START+5000) +#define SC_RESOURCE_END (RID_APP_END) + +// --------------------------------------------------------------------------- +// Hilfe IDs ----------------------------------------------------------------- +// Calc hat einen Bereich von 2000 IDs +// Die Funktionen brauchen 11*90 = 990 IDs + +#define HID_SC_SHEET_START (HID_SC_START + 1010) +#define HID_SC_SHELL_START (HID_SC_START + 1030) + +// --------------------------------------------------------------------------- + +// Hilfe IDs fuer Vorlagen --------------------------------------------------- +#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 ) + +// Hilfe IDs fuer Shells (Helferlein) (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-Funktionen (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) +//aus sfx: #define SID_REPAINT (SC_VIEW_START + 12) +#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 fuer Attribute: + +#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 + +// sonstige Slot-IDs: + +#define SID_SCUSERLISTS (SC_VIEW_START + 37) // Benutzerdef.Listen +#define RES_TBX_DUMMY (SC_VIEW_START + 38) // Dummy-Item +#define SID_SCVIEWOPTIONS (SC_VIEW_START + 39) +#define SID_SCDOCOPTIONS (SC_VIEW_START + 40) + +// Cursorbewegungen als 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 fuer spez. ToolBox-Funktionen: + +#define SID_NUMBER_CURRENCY (SC_VIEW_START + 45) +#define SID_NUMBER_PERCENT (SC_VIEW_START + 46) + +// "Slot" Ids fuer Eingabezeilen 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) + +// Sonstiges: +#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 Eingabe +#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_CHG_PROTECT (SC_VIEW_START + 84) -> moved to SVX +#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) + +// #97776# new entry "Filter..." in DP popup menu +#define SID_DP_FILTER (SC_VIEW_START + 91) + +// #101160# 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 & Descriptopn of an Object +#define SID_TITLE_DESCRIPTION_OBJECT (SC_VIEW_START + 94) + +// #i59082# assign macro to shape +#define SID_ASSIGNMACRO (SC_VIEW_START + 95) + +#ifdef ISSUE66550_HLINK_FOR_SHAPES +// #i66550# hyperlinks in shapes +#define SID_DRAW_HLINK_EDIT (SC_VIEW_START + 96) +#define SID_DRAW_HLINK_DELETE (SC_VIEW_START + 97) +#endif + +// "Zoom / Synchronize sheets" in options dialog +#define SID_SC_OPT_SYNCZOOM (SC_VIEW_START + 98) + +// NOTE: last valid ID is (SC_VIEW_START + 99) + +// Nachrichten ------------------------------------------------------------- + +#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) + +// Nachricht zum Oeffnen von Dialogen: +#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_CHART (SC_MESSAGE_START + 55) +#define SID_OPENDLG_EDITFUNCTION (SC_MESSAGE_START + 56) +#define SID_OPENDLG_ARGUMENT (SC_MESSAGE_START + 57) +//#define SID_OPENDLG_MODCHART (SC_MESSAGE_START + 58) +#define SID_OPENDLG_CONDFRMT (SC_MESSAGE_START + 59) +#define SID_OPENDLG_OPTSOLVER (SC_MESSAGE_START + 60) +//<!--Added by PengYunQuan for Validity Cell Range Picker +#define SID_VALIDITY_REFERENCE (SC_MESSAGE_START + 61) +//-->Added by PengYunQuan for Validity Cell Range Picker +#define SC_HINT_NAVIGATOR_UPDATEALL (SC_MESSAGE_START + 65) + +// Funktionen ------------------------------------------------------------ + + +//#define FID_PRINT_PREVIEW (SC_FUNCTION_START) +#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_RECORD (EDIT_MENU_START + 18) -> moved to SVX +#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) +// Compare/Merge jetzt aus Sfx +//#define FID_CHG_COMPARE (VIEW_MENU_START + 16)// DANGER DIRTY ID +//#define FID_CHG_MERGE (VIEW_MENU_START + 17)// DANGER DIRTY ID +#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_CHARMAP (INSERT_MENU_START + 15)//!!! kommt von sfx +//aus sfx: #define SID_INSERT_POSTIT (INSERT_MENU_START + 16) +#define SID_INSERT_CLIPART (INSERT_MENU_START + 17) //!!! sollte vom Svx kommen +#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) + +// hier falsch, aber erstmal +#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) +//aus sfx: #define SID_OUTLINE_HIDE (DATA_MENU_START + 9) +//aus sfx: #define SID_OUTLINE_SHOW (DATA_MENU_START + 10) +//aus sfx: #define SID_OUTLINE_MAKE (DATA_MENU_START + 11) +//aus sfx: #define SID_OUTLINE_REMOVE (DATA_MENU_START + 12) +#define SID_AUTO_OUTLINE (DATA_MENU_START + 13) +//aus sfx: #define SID_OUTLINE_DELETEALL (DATA_MENU_START + 14) +#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_GROUP (DRAW_BAR_START+17) +//#define SID_UNGROUP (DRAW_BAR_START+18) +#define SID_FRAMETOTOP (DRAW_BAR_START+19) +#define SID_FRAMETOBOTTOM (DRAW_BAR_START+20) +//aus sfx: #define SID_FRAME_UP (DRAW_BAR_START+21) +//aus sfx: #define SID_FRAME_DOWN (DRAW_BAR_START+22) +#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 DETECTIVE_END (DETECTIVE_START+20) + +#define SID_API_SLOTS (DETECTIVE_END) +//aus sfx: #define SID_ENTER_STRING (SID_API_SLOTS) +#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) + +//aus 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) +//aus sfx: #define SID_ATTR_SECIALCHAR (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) + +// Suchen & Ersetzen +#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 fuer Toolbox Controller in der Werkzeugleiste +#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 fuer Gueltigkeit +#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) + +// einzelne Slots fuer verschiedene Unterstreich-Arten (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 --------------------------------------------------------- + +//aus sfx: #define FN_PARAM_1 (SC_PARAM_START) +//aus sfx: #define FN_PARAM_2 (SC_PARAM_START+1) +//aus sfx: #define FN_PARAM_3 (SC_PARAM_START+2) +//aus sfx: #define FN_PARAM_4 (SC_PARAM_START+3) +//aus sfx: #define FN_PARAM_5 (SC_PARAM_START+4) +//aus sfx: #define FN_PARAM_6 (SC_PARAM_START+5) +//aus sfx: #define FN_PARAM_7 (SC_PARAM_START+6) +//aus sfx: #define FN_PARAM_8 (SC_PARAM_START+7) +#define FN_PARAM_9 (FN_PARAM_8+1) + +#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) + +// Resourcen ------------------------------------------------------------- + +#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_ANCHORBITMAP (SC_RESOURCE_START+10) +//#define RID_GRAYANCHORBITMAP (SC_RESOURCE_START+11) +#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) +// free +// free +#define RID_TBXCTL_INSERT (SC_RESOURCE_START+38) +#define RID_TBXCTL_INSCELLS (SC_RESOURCE_START+39) +#define RID_TBXCTL_INSOBJ (SC_RESOURCE_START+40) +// free +// free +#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) +// free +#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) +// free +// free +#define RID_IMAGELIST_H_NAVCONT (SC_RESOURCE_START+57) +#define RID_OUTLINEBITMAPS_H (SC_RESOURCE_START+58) +#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 STR_BASIC_IDE (STR_START + 30) +#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-Namen +#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) + +// #98185# +#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) + +// #101160# Replace cell contents warning +#define STR_REPLCELLSWARN (STR_START + 91) + +#define SCSTR_DPFUNCLISTBOX (STR_START + 92) +#define STR_PRINT_NOTHING (STR_START + 93) +#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 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) + +// Navigator - in der Reihenfolge wie 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) +// hier ein wenig Platz fuer Erweiterungen + +// Eingabezeile, Quickhelp-Strings (HelpText jetzt per HelpId aus Hilfe) +#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 +// not used anymore: RID_BMP_EXPAND, RID_BMP_COLLAPSE +//#define RID_BMP_EXPAND (BMP_START) +//#define RID_BMP_COLLAPSE (BMP_START + 1) +#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_H_DROP_URL (BMP_START + 5) +#define RID_IMG_H_DROP_LINK (BMP_START + 6) +#define RID_IMG_H_DROP_COPY (BMP_START + 7) +#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_SCDLG_CHARTRANGE (SC_DIALOGS_START + 78) + +#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 fuer 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 fuer Drop-Modus im 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) + +// Ableitungen von 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) + +// Ableitungen von RID_SCDLG_SELENTRY +#define RID_SCDLG_SELECTDB (SC_DIALOGS_START + 108) +#define RID_SCDLG_SHOW_TAB (SC_DIALOGS_START + 109) + +// Ableitungen von 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 + +// mask color for high contrast +#define SC_HC_MASKCOLOR STD_MASKCOLOR + +#define MID_1 1 +#define MID_2 2 +#define MID_3 3 +#define MID_4 4 + +#endif + + diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx new file mode 100644 index 000000000000..40711a200e19 --- /dev/null +++ b/sc/inc/scabstdlg.hxx @@ -0,0 +1,502 @@ +/************************************************************************* + * + * 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" + +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; +//<!--Added by PengYunQuan for Validity Cell Range Picker +class ScTabViewShell; +//-->Added by PengYunQuan for Validity Cell Range Picker + +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 USHORT GetIndex() const = 0 ; + virtual String GetCurrFormatName() = 0; +}; + +class AbstractScColRowLabelDlg : public VclAbstractDialog //add for ScColRowLabelDlg +{ +public: + virtual BOOL IsCol() = 0; + virtual 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; +}; + +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; +}; + +class AbstractScDeleteContentsDlg: public VclAbstractDialog //add for ScDeleteContentsDlg +{ +public: + virtual void DisableObjects() = 0 ; + virtual USHORT 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(BOOL bFlag=FALSE) = 0; +}; + +class AbstractScGroupDlg : public VclAbstractDialog //add for ScGroupDlg +{ +public: + virtual 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 USHORT GetInsContentsCmdBits() const = 0; + virtual USHORT GetFormulaCmdBits() const = 0 ; + virtual BOOL IsSkipEmptyCells() const = 0; + virtual BOOL IsLink() const = 0; + virtual void SetFillMode( BOOL bSet ) = 0; + virtual void SetOtherDoc( BOOL bSet ) = 0; + virtual BOOL IsTranspose() const = 0; + virtual void SetChangeTrack( BOOL bSet ) = 0; + virtual void SetCellShiftDisabled( int nDisable ) = 0; + virtual InsCellCmd GetMoveMode() = 0; +}; + +class AbstractScInsertTableDlg : public VclAbstractDialog //add for ScInsertTableDlg +{ +public: + virtual BOOL GetTablesFromFile() = 0; + virtual BOOL GetTablesAsLink() = 0; + virtual const String* GetFirstTable( USHORT* pN = NULL ) = 0; + virtual ScDocShell* GetDocShellTables() = 0; + virtual BOOL IsTableBefore() = 0; + virtual USHORT GetTableCount() = 0; + virtual const String* GetNextTable( USHORT* 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, + 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 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 USHORT GetSelectedDocument () const = 0; + virtual USHORT GetSelectedTable () const = 0; + virtual BOOL GetCopyTable () const = 0; + virtual void SetCopyTable (BOOL bFlag=TRUE) = 0; + virtual void EnableCopyTable (BOOL bFlag=TRUE) = 0; +}; + +class AbstractScNameCreateDlg : public VclAbstractDialog //add for ScNameCreateDlg +{ +public: + virtual USHORT 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 USHORT GetFuncMask() const = 0; + virtual ::com::sun::star::sheet::DataPilotFieldReference GetFieldRef() const = 0; +}; + +class AbstractScDPSubtotalDlg : public VclAbstractDialog //add for ScDPSubtotalDlg +{ +public: + virtual USHORT 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, USHORT nFlags ) = 0; + + virtual void GetScenarioData( String& rName, String& rComment, + Color& rColor, USHORT& rFlags ) const = 0; +}; + +class AbstractScShowTabDlg : public VclAbstractDialog //add for ScShowTabDlg +{ +public: + virtual void Insert( const String& rString, BOOL bSelected ) = 0; + virtual USHORT GetSelectEntryCount() const = 0; + virtual void SetDescription(const String& rTitle, const String& rFixedText, const rtl::OString& nDlgHelpId, const rtl::OString& nLbHelpId ) = 0; + virtual String GetSelectEntry(USHORT nPos) const = 0; + virtual USHORT GetSelectEntryPos(USHORT 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: + 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, + BOOL bCol = FALSE, + BOOL bRow = FALSE) = 0; + + virtual VclAbstractDialog * CreateScColOrRowDlg( Window* pParent, //add for ScColOrRowDlg + const String& rStrTitle, + const String& rStrLabel, + int nId, + BOOL bColDefault = 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, 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, BOOL bDisallowCellMove = FALSE ) = 0 ; //add for ScDeleteCellDlg + + virtual AbstractScDeleteContentsDlg * CreateScDeleteContentsDlg(Window* pParent,int nId, //add for ScDeleteContentsDlg + USHORT 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, + USHORT nPossDir, + int nId) = 0; + + virtual AbstractScGroupDlg * CreateAbstractScGroupDlg( Window* pParent, //add for ScGroupDlg + USHORT nResId, + int nId, + BOOL bUnGroup = FALSE, + BOOL bRows = TRUE ) = 0; + + virtual AbstractScInsertCellDlg * CreateScInsertCellDlg( Window* pParent, //add for ScInsertCellDlg + int nId, + BOOL bDisallowCellMove = FALSE ) = 0; + + virtual AbstractScInsertContentsDlg * CreateScInsertContentsDlg( Window* pParent, //add for ScInsertContentsDlg + int nId, + USHORT 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 + USHORT 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 + USHORT nResId, // Ableitung fuer jeden Dialog! + long nCurrent, + long nDefault, + int nId , + FieldUnit eFUnit = FUNIT_MM, + USHORT nDecimals = 2, + long nMaximum = 1000, + long nMinimum = 0, + long nFirst = 1, + long nLast = 100 ) = 0; + + virtual AbstractScMoveTableDlg * CreateScMoveTableDlg( Window* pParent, int nId ) = 0; //add for ScMoveTableDlg + + virtual AbstractScNameCreateDlg * CreateScNameCreateDlg ( Window * pParent, USHORT nFlags, int nId ) = 0; //add for ScNameCreateDlg + + virtual AbstractScNamePasteDlg * CreateScNamePasteDlg ( Window * pParent, const ScRangeName* pList, //add for ScNamePasteDlg + int nId , BOOL bInsList=TRUE ) = 0; + + virtual AbstractScPivotFilterDlg * CreateScPivotFilterDlg ( Window* pParent, //add for ScPivotFilterDlg + const SfxItemSet& rArgSet, USHORT nSourceTab , int nId ) = 0; + + virtual AbstractScDPFunctionDlg * CreateScDPFunctionDlg( Window* pParent, int nId, + const ScDPLabelDataVec& 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, + USHORT nOrient ) = 0; + + virtual AbstractScNewScenarioDlg * CreateScNewScenarioDlg ( Window* pParent, const String& rName, //add for ScNewScenarioDlg + int nId, + BOOL bEdit = FALSE, 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, + BOOL bAscii = TRUE, + const ScImportOptions* pOptions = NULL, + const String* pStrTitle = NULL, + BOOL bMultiByte = FALSE, + BOOL bOnlyDbtoolsEncodings = FALSE, + BOOL bImport = 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, + USHORT nResId = RID_SCDLG_HFEDIT ) = 0; + + virtual SfxAbstractTabDialog * CreateScStyleDlg( Window* pParent,//add for ScStyleDlg + SfxStyleSheetBase& rStyleBase, + USHORT 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; + + //<!--Modified by PengYunQuan for Validity Cell Range Picker + //virtual SfxAbstractTabDialog * CreateScValidationDlg( Window* pParent, //add for ScValidationDlg + // const SfxItemSet* pArgSet,int nId ) = 0; + + virtual SfxAbstractTabDialog * CreateScValidationDlg( Window* pParent, //add for ScValidationDlg + const SfxItemSet* pArgSet,int nId, ScTabViewShell *pTabVwSh ) = 0; + //-->Modified by PengYunQuan for Validity Cell Range Picker + virtual SfxAbstractTabDialog * CreateScSortDlg( Window* pParent, //add for ScSortDlg + const SfxItemSet* pArgSet,int nId ) = 0; + // for tabpage + virtual CreateTabPage GetTabPageCreatorFunc( USHORT nId ) = 0; + virtual GetTabPageRanges GetTabPageRangesFunc( USHORT nId ) = 0; +}; +#endif + 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..a10c794b9c43 --- /dev/null +++ b/sc/inc/scdll.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * 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> + +//------------------------------------------------------------------------- + +class ScDLL + +/* [Description] + + 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. +*/ + +{ +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 ULONG DetectFilter( SfxMedium& rMedium, const SfxFilter** ppFilter, + SfxFilterFlags nMust, SfxFilterFlags nDont ); +}; + +#define SC_DLL() ( *(ScModule**) GetAppData(SHL_CALC) ) + +#endif + + diff --git a/sc/inc/scdllapi.h b/sc/inc/scdllapi.h new file mode 100644 index 000000000000..c2d1b16ea588 --- /dev/null +++ b/sc/inc/scdllapi.h @@ -0,0 +1,13 @@ +#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 */ diff --git a/sc/inc/scerrors.hxx b/sc/inc/scerrors.hxx new file mode 100644 index 000000000000..4f128ed57604 --- /dev/null +++ b/sc/inc/scerrors.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/scextopt.hxx b/sc/inc/scextopt.hxx new file mode 100644 index 000000000000..ad3fd4b1b51e --- /dev/null +++ b/sc/inc/scextopt.hxx @@ -0,0 +1,131 @@ +/************************************************************************* + * + * 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. + + 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 + 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..6788c906cb8d --- /dev/null +++ b/sc/inc/scitems.hxx @@ -0,0 +1,195 @@ +/************************************************************************* + * + * 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 + +#ifndef _SVX_SVXIDS_HRC +#include <svx/svxids.hrc> +#endif + +// EditEngine darf nicht ihre eigenen ITEMID's definieren +#define _EEITEMID_HXX + +//-------------------------- +// Item-IDs fuer UI-MsgPool: +//-------------------------- + +//! sollten auch nach unter 1000 verschoben werden! + +#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 fuer Attribute: +//------------------------- +#define ATTR_STARTINDEX 100 // Anfang Attribute + +#define ATTR_PATTERN_START 100 // Anfang Zellattribut-Pattern + +#define ATTR_FONT 100 // Anfang Zellattribute +#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_INDENT 130 +#define ATTR_VER_JUSTIFY 131 +#define ATTR_STACKED 132 +#define ATTR_ROTATE_VALUE 133 +#define ATTR_ROTATE_MODE 134 +#define ATTR_VERTICAL_ASIAN 135 +#define ATTR_WRITINGDIR 136 +#define ATTR_LINEBREAK 137 +#define ATTR_SHRINKTOFIT 138 +#define ATTR_BORDER_TLBR 139 +#define ATTR_BORDER_BLTR 140 +#define ATTR_MARGIN 141 +#define ATTR_MERGE 142 +#define ATTR_MERGE_FLAG 143 +#define ATTR_VALUE_FORMAT 144 +#define ATTR_LANGUAGE_FORMAT 145 +#define ATTR_BACKGROUND 146 +#define ATTR_PROTECTION 147 +#define ATTR_BORDER 148 +#define ATTR_BORDER_INNER 149 // innen, wg. Vorlagen-EditDialog +#define ATTR_SHADOW 150 +#define ATTR_VALIDDATA 151 +#define ATTR_CONDITIONAL 152 + +#define ATTR_PATTERN_END 152 // Ende Zellattribut-Pattern + +#define ATTR_PATTERN 153 + // Seitenattribute +#define ATTR_LRSPACE 154 // Editor: PageDesc-TabPage +#define ATTR_ULSPACE 155 +#define ATTR_PAGE 156 +#define ATTR_PAGE_PAPERTRAY 157 +#define ATTR_PAGE_PAPERBIN 158 +#define ATTR_PAGE_SIZE 159 +#define ATTR_PAGE_MAXSIZE 160 +#define ATTR_PAGE_HORCENTER 161 +#define ATTR_PAGE_VERCENTER 162 + +#define ATTR_PAGE_ON 163 // Editor: Header/Footer-Page +#define ATTR_PAGE_DYNAMIC 164 +#define ATTR_PAGE_SHARED 165 + +#define ATTR_PAGE_NOTES 166 // Editor: Tabelle +#define ATTR_PAGE_GRID 167 +#define ATTR_PAGE_HEADERS 168 +#define ATTR_PAGE_CHARTS 169 +#define ATTR_PAGE_OBJECTS 170 +#define ATTR_PAGE_DRAWINGS 171 +#define ATTR_PAGE_TOPDOWN 172 +#define ATTR_PAGE_SCALE 173 +#define ATTR_PAGE_SCALETOPAGES 174 +#define ATTR_PAGE_FIRSTPAGENO 175 + +#define ATTR_PAGE_PRINTAREA 176 // Editor: Druckbereiche +#define ATTR_PAGE_REPEATROW 177 +#define ATTR_PAGE_REPEATCOL 178 +#define ATTR_PAGE_PRINTTABLES 179 + +#define ATTR_PAGE_HEADERLEFT 180 // Inhalte der Kopf-/ +#define ATTR_PAGE_FOOTERLEFT 181 // Fusszeilen (links) +#define ATTR_PAGE_HEADERRIGHT 182 // Inhalte der Kopf-/ +#define ATTR_PAGE_FOOTERRIGHT 183 // Fusszeilen (rechts) +#define ATTR_PAGE_HEADERSET 184 // die Sets dazu... +#define ATTR_PAGE_FOOTERSET 185 + +#define ATTR_PAGE_FORMULAS 186 +#define ATTR_PAGE_NULLVALS 187 + +#define ATTR_PAGE_SCALETO 188 // #i8868# scale printout to with/height + +#define ATTR_ENDINDEX ATTR_PAGE_SCALETO // Ende Pool-Range + +//-------------------------------- +// Dummy Slot-IDs fuer Dialoge +//-------------------------------- +#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 + + diff --git a/sc/inc/scmatrix.hxx b/sc/inc/scmatrix.hxx new file mode 100644 index 000000000000..b788672aa715 --- /dev/null +++ b/sc/inc/scmatrix.hxx @@ -0,0 +1,443 @@ +/************************************************************************* + * + * 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 "formula/intruref.hxx" +#include "formula/errorcodes.hxx" +#include <tools/string.hxx> +#include "scdllapi.h" + +class SvStream; +class ScInterpreter; +class SvNumberFormatter; + +typedef BYTE 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 + +union ScMatrixValue +{ + double fVal; + String* pS; + + /// 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! + USHORT GetError() const { return GetDoubleErrorValue( fVal); } + + /// Only valid if ScMatrix methods indicate that this is a boolean + bool GetBoolean() const { return fVal != 0.; } +}; + +/** Matrix representation of double values and strings. + + @ATTENTION: optimized for speed and double values. + + <p> Matrix elements are NOT initialized after construction! + + <p> All methods using an SCSIZE nIndex parameter and all Is...() methods do + NOT check the range for validity! However, the Put...() and Get...() + methods using nCol/nRow parameters do check the range. + + <p> Methods using nCol/nRow parameters do replicate a single row vector if + nRow > 0 and nCol < nColCount, respectively a column vector if nCol + > 0 and nRow < nRowCount. + + <p> GetString( SCSIZE nIndex ) does not check if there really is a string, + do this with IsString() first. GetString( SCSIZE nC, SCSIZE nR ) does check + it and returns and empty string if there is no string. Both GetDouble() + methods don't check for a string, do this with IsNumeric() or IsString() or + IsValue() first. + + <p> The GetString( SvNumberFormatter&, ...) methods return the matrix + element's string if one is present, otherwise the numerical value is + formatted as a string, or in case of an error the error string is returned. + + <p> PutDouble() does not reset an eventual string! Use + PutDoubleAndResetString() if that is wanted. Also the FillDouble...() + methods don't reset strings. As a consequence memory leaks may occur if + used wrong. + */ +class SC_DLLPUBLIC ScMatrix +{ + ScMatrixValue* pMat; + ScMatValType* mnValType; + ULONG mnNonValue; // how many strings and empties + ScInterpreter* pErrorInterpreter; + mutable ULONG nRefCnt; // reference count + SCSIZE nColCount; + SCSIZE nRowCount; + bool mbCloneIfConst; // Whether the matrix is cloned with a CloneIfConst() call. + + void ResetIsString(); + void DeleteIsString(); + void CreateMatrix( SCSIZE nC, SCSIZE nR); + void Clear(); + + // pStr may be NULL, bFlag MUST NOT be 0 + void PutStringEntry( const String* pStr, BYTE bFlag, SCSIZE nIndex ); + + // only delete via Delete() + ~ScMatrix(); + + // not implemented, prevent usage + ScMatrix( const ScMatrix& ); + ScMatrix& operator=( const ScMatrix&); + + void SetErrorAtInterpreter( USHORT nError) const; + +public: + + /// 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; + } + + /** If nC*nR results in more than GetElementsMax() entries, a 1x1 matrix is + created instead and a double error value (errStackOverflow) is set. + Compare nC and nR with a GetDimensions() call to check. */ + ScMatrix( SCSIZE nC, SCSIZE nR) : nRefCnt(0), mbCloneIfConst(true) { CreateMatrix( nC, nR); } + + /** Clone the matrix. */ + ScMatrix* Clone() 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. */ + inline void SetImmutable( bool bVal ) { mbCloneIfConst = bVal; } + + /** + * Resize the matrix to specified new dimension. Note that this operation + * clears all stored values. + */ + 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 ) const; + + /// Disable refcounting forever, may only be deleted via Delete() afterwards. + inline void SetEternalRef() { nRefCnt = ULONG_MAX; } + inline bool IsEternalRef() const { return nRefCnt == ULONG_MAX; } + inline void IncRef() const + { + if ( !IsEternalRef() ) + ++nRefCnt; + } + inline void DecRef() const + { + if ( nRefCnt > 0 && !IsEternalRef() ) + if ( --nRefCnt == 0 ) + delete this; + } + inline void Delete() + { + if ( nRefCnt == 0 || IsEternalRef() ) + delete this; + else + --nRefCnt; + } + + void SetErrorInterpreter( ScInterpreter* p) + { pErrorInterpreter = p; } + + ScMatrix( SvStream& rStream); + void Store( SvStream& rStream) const; + + void GetDimensions( SCSIZE& rC, SCSIZE& rR) const + { rC = nColCount; rR = nRowCount; }; + SCSIZE GetElementCount() const + { return nColCount * nRowCount; } + inline bool ValidColRow( SCSIZE nC, SCSIZE nR) const + { return nC < nColCount && nR < nRowCount; } + inline SCSIZE CalcOffset( SCSIZE nC, SCSIZE nR) const + { return nC * nRowCount + nR; } + + /** 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. + */ + inline bool ValidColRowReplicated( SCSIZE & rC, SCSIZE & rR ) const + { + if (nColCount == 1 && nRowCount == 1) + { + rC = 0; + rR = 0; + return true; + } + else if (nColCount == 1 && rR < nRowCount) + { + rC = 0; + return true; + } + else if (nRowCount == 1 && rC < nColCount) + { + rR = 0; + return true; + } + return false; + } + + /** 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. + */ + inline bool ValidColRowOrReplicated( SCSIZE & rC, SCSIZE & rR ) const + { + return ValidColRow( rC, rR) || ValidColRowReplicated( rC, rR); + } + + + void PutDouble( double fVal, SCSIZE nC, SCSIZE nR); + void PutDouble( double fVal, SCSIZE nIndex) + { pMat[nIndex].fVal = fVal; } + void PutString( const String& rStr, SCSIZE nC, SCSIZE nR); + void PutString( const String& rStr, SCSIZE nIndex); + void PutEmpty( SCSIZE nC, SCSIZE nR); + void PutEmpty( SCSIZE nIndex); + /// Jump FALSE without path + void PutEmptyPath( SCSIZE nC, SCSIZE nR); + void PutEmptyPath( SCSIZE nIndex); + void PutError( USHORT nErrorCode, SCSIZE nC, SCSIZE nR ) + { PutDouble( CreateDoubleError( nErrorCode ), nC, nR ); } + void PutError( USHORT nErrorCode, SCSIZE nIndex ) + { PutDouble( CreateDoubleError( nErrorCode ), nIndex ); } + void PutBoolean( bool bVal, SCSIZE nC, SCSIZE nR); + void PutBoolean( bool bVal, SCSIZE nIndex); + + 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 */ + USHORT GetError( SCSIZE nC, SCSIZE nR) const; + USHORT GetError( SCSIZE nIndex) const + { return pMat[nIndex].GetError(); } + + /** Use in ScInterpreter to obtain the error code, if any. + @returns 0 if no error or string element, else one of err... constants */ + USHORT GetErrorIfNotString( SCSIZE nC, SCSIZE nR) const + { return IsValue( nC, nR) ? GetError( nC, nR) : 0; } + USHORT GetErrorIfNotString( SCSIZE nIndex) const + { return IsValue( nIndex) ? GetError( nIndex) : 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 + { + if ( pErrorInterpreter ) + { + USHORT nError = GetDoubleErrorValue( pMat[nIndex].fVal); + if ( nError ) + SetErrorAtInterpreter( nError); + } + return pMat[nIndex].fVal; + } + + /// @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 + { return pMat[nIndex].GetString(); } + + /** @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; + String GetString( SvNumberFormatter& rFormatter, SCSIZE nIndex) const; + + /// @ATTENTION: If bString the ScMatrixValue->pS may still be NULL to indicate + /// an empty string! + const ScMatrixValue* Get( SCSIZE nC, SCSIZE nR, ScMatValType& nType) const; + + /// @return <TRUE/> if string or empty or empty path, in fact non-value. + BOOL IsString( SCSIZE nIndex ) const + { return mnValType && IsNonValueType( mnValType[nIndex]); } + + /// @return <TRUE/> if string or empty or empty path, in fact non-value. + BOOL IsString( SCSIZE nC, SCSIZE nR ) const + { + ValidColRowReplicated( nC, nR ); + return mnValType && IsNonValueType( mnValType[ nC * nRowCount + nR ]); + } + + /// @return <TRUE/> if empty or empty path. + BOOL IsEmpty( SCSIZE nIndex ) const + { return mnValType && ((mnValType[nIndex] & SC_MATVAL_EMPTY) == SC_MATVAL_EMPTY); } + + /// @return <TRUE/> if empty or empty path. + BOOL IsEmpty( SCSIZE nC, SCSIZE nR ) const + { + ValidColRowReplicated( nC, nR ); + return mnValType && ((mnValType[ nC * nRowCount + nR ] & SC_MATVAL_EMPTY) == SC_MATVAL_EMPTY); + } + + /// @return <TRUE/> if empty path. + BOOL IsEmptyPath( SCSIZE nC, SCSIZE nR ) const + { + ValidColRowReplicated( nC, nR ); + return mnValType && ((mnValType[ nC * nRowCount + nR ] & SC_MATVAL_EMPTYPATH) == SC_MATVAL_EMPTYPATH); + } + + /// @return <TRUE/> if empty path. + BOOL IsEmptyPath( SCSIZE nIndex ) const + { return mnValType && ((mnValType[nIndex] & SC_MATVAL_EMPTYPATH) == SC_MATVAL_EMPTYPATH); } + + /// @return <TRUE/> if value or boolean. + BOOL IsValue( SCSIZE nIndex ) const + { return !mnValType || IsValueType( mnValType[nIndex]); } + + /// @return <TRUE/> if value or boolean. + BOOL IsValue( SCSIZE nC, SCSIZE nR ) const + { + ValidColRowReplicated( nC, nR ); + return !mnValType || IsValueType( mnValType[ nC * nRowCount + nR ]); + } + + /// @return <TRUE/> if value or boolean or empty or empty path. + BOOL IsValueOrEmpty( SCSIZE nIndex ) const + { return !mnValType || IsValueType( mnValType[nIndex] ) || + ((mnValType[nIndex] & SC_MATVAL_EMPTY) == SC_MATVAL_EMPTY); } + + /// @return <TRUE/> if value or boolean or empty or empty path. + BOOL IsValueOrEmpty( SCSIZE nC, SCSIZE nR ) const + { + ValidColRowReplicated( nC, nR ); + return !mnValType || IsValueType( mnValType[ nC * nRowCount + nR ]) || + ((mnValType[ nC * nRowCount + nR ] & SC_MATVAL_EMPTY) == + SC_MATVAL_EMPTY); + } + + /// @return <TRUE/> if boolean. + BOOL IsBoolean( SCSIZE nIndex ) const + { return mnValType && IsBooleanType( mnValType[nIndex]); } + + /// @return <TRUE/> if boolean. + BOOL IsBoolean( SCSIZE nC, SCSIZE nR ) const + { + ValidColRowReplicated( nC, nR ); + return mnValType && IsBooleanType( mnValType[ nC * nRowCount + nR ]); + } + + /// @return <TRUE/> if entire matrix is numeric, including booleans, with no strings or empties + BOOL IsNumeric() const + { return 0 == mnNonValue; } + + void MatTrans( ScMatrix& mRes) const; + void MatCopy ( ScMatrix& mRes) const; + +//UNUSED2009-05 /** Copy upper left of this matrix to mRes matrix. +//UNUSED2009-05 This matrix's dimensions must be greater or equal to the mRes matrix +//UNUSED2009-05 dimensions. +//UNUSED2009-05 */ +//UNUSED2009-05 void MatCopyUpperLeft( 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(); // logical AND of all matrix values, or NAN + double Or(); // logical OR of all matrix values, or NAN + + // All other matrix functions MatMult, MInv, ... are in ScInterpreter + // to be numerically safe. +}; + + +typedef formula::SimpleIntrusiveReference< class ScMatrix > ScMatrixRef; +typedef formula::SimpleIntrusiveReference< const class ScMatrix > ScConstMatrixRef; + + +#endif // SC_MATRIX_HXX diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx new file mode 100644 index 000000000000..e1d9ab0fd4b9 --- /dev/null +++ b/sc/inc/scmod.hxx @@ -0,0 +1,295 @@ +/************************************************************************* + * + * 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> + +//<!--Added by PengYunQuan for Validity Cell Range Picker +#include <map> +#include <list> +#include <algorithm> +//-->Added by PengYunQuan for Validity Cell Range Picker + + +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; + // globalen InputHandler gibt's nicht mehr, jede View hat einen + 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; + USHORT nCurRefDlgId; + BOOL bIsWaterCan; + BOOL bIsInEditCommand; + BOOL bIsInExecuteDrop; + bool mbIsInSharedDocLoading; + bool mbIsInSharedDocSaving; + + //<!--Added by PengYunQuan for Validity Cell Range Picker + std::map<USHORT, std::list<Window*> > m_mapRefWindow; + //-->Added by PengYunQuan for Validity Cell Range Picker +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(); + + // von der Applikation verschoben: + + DECL_LINK( IdleHandler, Timer* ); // Timer statt 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( BOOL bNew ) { bIsWaterCan = bNew; } + BOOL GetIsWaterCan() const { return bIsWaterCan; } + + void SetInEditCommand( BOOL bNew ) { bIsInEditCommand = bNew; } + BOOL IsInEditCommand() const { return bIsInEditCommand; } + + void SetInExecuteDrop( BOOL bNew ) { bIsInExecuteDrop = bNew; } + BOOL IsInExecuteDrop() const { return bIsInExecuteDrop; } + + // Options: + const ScViewOptions& GetViewOptions (); + const ScDocOptions& GetDocOptions (); +SC_DLLPUBLIC const ScAppOptions& GetAppOptions (); + const ScInputOptions& GetInputOptions (); +SC_DLLPUBLIC const ScPrintOptions& GetPrintOptions (); + void SetViewOptions ( const ScViewOptions& rOpt ); + void SetDocOptions ( const ScDocOptions& rOpt ); +SC_DLLPUBLIC void SetAppOptions ( const ScAppOptions& rOpt ); + void SetInputOptions ( const ScInputOptions& rOpt ); + void SetPrintOptions ( const ScPrintOptions& rOpt ); + void InsertEntryToLRUList(USHORT nFIndex); + void RecentFunctionsChanged(); + + static void GetSpellSettings( USHORT& rDefLang, USHORT& rCjkLang, USHORT& rCtlLang, + BOOL& rAutoSpell ); + static void SetAutoSpellProperty( BOOL bSet ); + static BOOL HasThesaurusLanguage( USHORT nLang ); + + USHORT GetOptDigitLanguage(); // from CTL options + + ScNavipiCfg& GetNavipiCfg(); + ScAddInCfg& GetAddInCfg(); + svtools::ColorConfig& GetColorConfig(); + SvtAccessibilityOptions& GetAccessOptions(); + SvtCTLOptions& GetCTLOptions(); + SvtUserOptions& GetUserOptions(); + + void ModifyOptions( const SfxItemSet& rOptSet ); + + // InputHandler: + BOOL IsEditMode(); // nicht bei SC_INPUT_TYPE + BOOL IsInputMode(); // auch bei SC_INPUT_TYPE + void SetInputMode( ScInputMode eMode ); + BOOL InputKeyEvent( const KeyEvent& rKEvt, BOOL bStartEdit = FALSE ); + SC_DLLPUBLIC void InputEnterHandler( BYTE nBlockMode = 0 ); + void InputCancelHandler(); + void InputSelection( EditView* pView ); + void InputChanged( EditView* pView ); + ScInputHandler* GetInputHdl( ScTabViewShell* pViewSh = NULL, BOOL bUseRef = TRUE ); + + void SetRefInputHdl( ScInputHandler* pNew ); + ScInputHandler* GetRefInputHdl(); + + void ViewShellGone(ScTabViewShell* pViewSh); + void ViewShellChanged(); + // Kommunikation mit Funktionsautopilot + 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, + BOOL bMatrix = FALSE ); + + void InitFormEditData(); + void ClearFormEditData(); + ScFormEditData* GetFormEditData() { return pFormEditData; } + + // Referenzeingabe: + //<!--Added by PengYunQuan for Validity Cell Range Picker + //void SetRefDialog( USHORT nId, BOOL bVis, SfxViewFrame* pViewFrm = NULL ); + SC_DLLPUBLIC void SetRefDialog( USHORT nId, BOOL bVis, SfxViewFrame* pViewFrm = NULL ); + //-->Added by PengYunQuan for Validity Cell Range Picker + BOOL IsModalMode(SfxObjectShell* pDocSh = NULL); + BOOL IsFormulaMode(); + BOOL IsRefDialogOpen(); + BOOL IsTableLocked(); + void SetReference( const ScRange& rRef, ScDocument* pDoc, + const ScMarkData* pMarkData = NULL ); + void AddRefEntry(); + void EndReference(); + USHORT GetCurRefDlgId() const { return nCurRefDlgId; } + + //virtuelle Methoden fuer den Optionendialog + virtual SfxItemSet* CreateItemSet( USHORT nId ); + virtual void ApplyItemSet( USHORT nId, const SfxItemSet& rSet ); + virtual SfxTabPage* CreateTabPage( USHORT 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 BOOL RegisterRefWindow( USHORT nSlotId, Window *pWnd ); + SC_DLLPUBLIC BOOL UnregisterRefWindow( USHORT nSlotId, Window *pWnd ); + SC_DLLPUBLIC BOOL IsAliveRefDlg( USHORT nSlotId, Window *pWnd ); + SC_DLLPUBLIC Window * Find1RefWindow( USHORT nSlotId, Window *pWndAncestor ); + SC_DLLPUBLIC Window * Find1RefWindow( Window *pWndAncestor ); +}; + +#define SC_MOD() ( *(ScModule**) GetAppData(SHL_CALC) ) + +#endif + + diff --git a/sc/inc/scresid.hxx b/sc/inc/scresid.hxx new file mode 100644 index 000000000000..067e5f03e307 --- /dev/null +++ b/sc/inc/scresid.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * 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( USHORT nId ); // in scdll.cxx +}; + + + +#endif // SC_SCRESMGR_HXX + diff --git a/sc/inc/scwarngs.hxx b/sc/inc/scwarngs.hxx new file mode 100644 index 000000000000..e823a66f7a80 --- /dev/null +++ b/sc/inc/scwarngs.hxx @@ -0,0 +1,36 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/segmenttree.hxx b/sc/inc/segmenttree.hxx new file mode 100644 index 000000000000..195331c750ad --- /dev/null +++ b/sc/inc/segmenttree.hxx @@ -0,0 +1,172 @@ +/************************************************************************* + * + * 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(); + + void setTrue(SCROW nRow1, SCROW nRow2); + void setFalse(SCROW nRow1, SCROW nRow2); + bool getValue(SCROW nRow); + bool getRangeData(SCROW nRow, RangeData& rData); + void removeSegment(SCROW nRow1, SCROW nRow2); + void insertSegment(SCROW nRow, SCROW nSize, bool bSkipStartBoundary); + + SCROW findLastNotOf(bool bValue) const; + + void enableTreeSearch(bool bEnable); + void setInsertFromBack(bool bInsertFromBack); + +private: + ::std::auto_ptr<ScFlatBoolSegmentsImpl> mpImpl; +}; + +// ============================================================================ + +class ScFlatBoolColSegments +{ +public: + struct RangeData + { + SCCOL mnCol1; + SCCOL mnCol2; + bool mbValue; + }; + ScFlatBoolColSegments(); + ScFlatBoolColSegments(const ScFlatBoolColSegments& r); + ~ScFlatBoolColSegments(); + + void setTrue(SCCOL nCol1, SCCOL nCol2); + void setFalse(SCCOL nCol1, SCCOL nCol2); + bool getValue(SCCOL nCol); + bool getRangeData(SCCOL nCol, RangeData& rData); + void removeSegment(SCCOL nCol1, SCCOL nCol2); + void insertSegment(SCCOL nCol, SCCOL nSize, bool bSkipStartBoundary); + + void enableTreeSearch(bool bEnable); + void setInsertFromBack(bool bInsertFromBack); + +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); + void setInsertFromBack(bool bInsertFromBack); + +private: + ::std::auto_ptr<ScFlatUInt16SegmentsImpl> mpImpl; +}; + +#endif diff --git a/sc/inc/servuno.hxx b/sc/inc/servuno.hxx new file mode 100644 index 000000000000..4f2f1ec40de2 --- /dev/null +++ b/sc/inc/servuno.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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 wirklich hier oder besser 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 + +// #100263# 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 wird nicht fuer alle Services benoetigt + 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(); +//UNUSED2008-05 static String GetProviderName(sal_uInt16 nObjectType); + static sal_uInt16 GetProviderType(const String& rServiceName); +}; + + + +#endif + diff --git a/sc/inc/shapeuno.hxx b/sc/inc/shapeuno.hxx new file mode 100644 index 000000000000..ddbbf3108daf --- /dev/null +++ b/sc/inc/shapeuno.hxx @@ -0,0 +1,242 @@ +/************************************************************************* + * + * 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; + +//------------------------------------------------------------------------ + +// 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: + ::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; + 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 + diff --git a/sc/inc/sheetdata.hxx b/sc/inc/sheetdata.hxx new file mode 100644 index 000000000000..de67786ff9fe --- /dev/null +++ b/sc/inc/sheetdata.hxx @@ -0,0 +1,185 @@ +/************************************************************************* + * + * 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 <hash_set> + +#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 +{ + std::hash_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 + diff --git a/sc/inc/sheetevents.hxx b/sc/inc/sheetevents.hxx new file mode 100644 index 000000000000..bb27f5cf2068 --- /dev/null +++ b/sc/inc/sheetevents.hxx @@ -0,0 +1,67 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: sheetdata.hxx,v $ + * $Revision: 1.16.32.2 $ + * + * 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 + diff --git a/sc/inc/shellids.hxx b/sc/inc/shellids.hxx new file mode 100644 index 000000000000..7f4ccb60259f --- /dev/null +++ b/sc/inc/shellids.hxx @@ -0,0 +1,55 @@ +/************************************************************************* + * + * 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 + + diff --git a/sc/inc/sortparam.hxx b/sc/inc/sortparam.hxx new file mode 100644 index 000000000000..650293893678 --- /dev/null +++ b/sc/inc/sortparam.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * 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; + BOOL bHasHeader; + BOOL bByRow; + BOOL bCaseSens; + BOOL bUserDef; + USHORT nUserIndex; + 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; + String aCollatorAlgorithm; + USHORT 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 diff --git a/sc/inc/srchuno.hxx b/sc/inc/srchuno.hxx new file mode 100644 index 000000000000..f8f82ed25aff --- /dev/null +++ b/sc/inc/srchuno.hxx @@ -0,0 +1,129 @@ +/************************************************************************* + * + * 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 muss von aussen (vom XSearchable) gerufen werden... + + // 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 + diff --git a/sc/inc/stlpool.hxx b/sc/inc/stlpool.hxx new file mode 100644 index 000000000000..946a861231d9 --- /dev/null +++ b/sc/inc/stlpool.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * 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 ); +//UNUSED2008-05 void UpdateStdNames(); + + void CopyStyleFrom( ScStyleSheetPool* pSrcPool, + const String& rName, SfxStyleFamily eFamily ); + + ScStyleSheet* FindCaseIns( const String& rName, SfxStyleFamily eFam ); + +//UNUSED2009-05 void SetForceStdName( const String* pSet ); + const String* GetForceStdName() const { return pForceStdName; } + + virtual SfxStyleSheetBase& Make( const String&, SfxStyleFamily eFam, + USHORT nMask = 0xffff, USHORT nPos = 0xffff ); + +protected: + virtual ~ScStyleSheetPool(); + + using SfxStyleSheetPool::Create; // calcwarnings: Create(const SfxStyleSheet&) - ever used? + + virtual SfxStyleSheetBase* Create( const String& rName, + SfxStyleFamily eFamily, + USHORT nMask); + virtual SfxStyleSheetBase* Create( const SfxStyleSheetBase& rStyle ); + +private: + SfxStyleSheetBase* pActualStyleSheet; + ScDocument* pDoc; + const String* pForceStdName; +}; + +#endif // SC_STLPOOL_HXX + diff --git a/sc/inc/stlsheet.hxx b/sc/inc/stlsheet.hxx new file mode 100644 index 000000000000..4e42be6e2563 --- /dev/null +++ b/sc/inc/stlsheet.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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 BOOL SetParent ( const String& rParentName ); + virtual SfxItemSet& GetItemSet (); + virtual BOOL IsUsed () const; + virtual BOOL HasFollowSupport () const; + virtual BOOL HasParentSupport () const; + + virtual const String& GetName() const; + virtual const String& GetParent() const; + virtual const String& GetFollow() const; + + virtual 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, + USHORT nMask ); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); +}; + +#endif // SC_STLSHEET_HXX + diff --git a/sc/inc/stringutil.hxx b/sc/inc/stringutil.hxx new file mode 100644 index 000000000000..c50c0d8cf156 --- /dev/null +++ b/sc/inc/stringutil.hxx @@ -0,0 +1,56 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: table.hxx,v $ + * $Revision: 1.35 $ + * + * 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" + +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. + * + * @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 diff --git a/sc/inc/strload.hxx b/sc/inc/strload.hxx new file mode 100644 index 000000000000..6b44d8e4e3ef --- /dev/null +++ b/sc/inc/strload.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * 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( USHORT nRsc, USHORT nStrId ) : + Resource( ScResId( nRsc ) ), theStr( ScResId( nStrId ) ) + { + FreeResource(); + } + + const String& GetString() const { return theStr; } + +private: + String theStr; +}; + + +#endif // SC_STRLOAD_HXX + diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx new file mode 100644 index 000000000000..a1dee10fd75d --- /dev/null +++ b/sc/inc/styleuno.hxx @@ -0,0 +1,378 @@ +/************************************************************************* + * + * 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/implbase3.hxx> +#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, UINT16 nType ); + static String ProgrammaticToDisplayName( const String& rProgName, 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(UINT16 Type) const; + ScStyleFamilyObj* GetObjectByIndex_Impl(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; // Familie + + ScStyleObj* GetObjectByIndex_Impl(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; // Familie + 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(); + + // per getImplementation gerufen: + 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 + diff --git a/sc/inc/subtotal.hxx b/sc/inc/subtotal.hxx new file mode 100644 index 000000000000..4349c2759ae9 --- /dev/null +++ b/sc/inc/subtotal.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * 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 BOOL SafePlus( double& fVal1, double fVal2); + static BOOL SafeMult( double& fVal1, double fVal2); + static BOOL SafeDiv( double& fVal1, double fVal2); +}; + + +struct ScFunctionData // zum Berechnen von einzelnen Funktionen +{ + ScSubTotalFunc eFunc; + double nVal; + long nCount; + BOOL bError; + + ScFunctionData( ScSubTotalFunc eFn ) : + eFunc(eFn), nVal(0.0), nCount(0), bError(FALSE) {} +}; + + +#endif + + diff --git a/sc/inc/tabbgcolor.hxx b/sc/inc/tabbgcolor.hxx new file mode 100644 index 000000000000..c2b2a63baf65 --- /dev/null +++ b/sc/inc/tabbgcolor.hxx @@ -0,0 +1,54 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: tabbgcolor.hxx,v $ + * $Revision: 1.00 $ + * + * 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; + + bool IsDefaultOldTabBgColor() const; + bool IsDefaultNewTabBgColor() const; + + explicit ScUndoTabColorInfo(SCTAB nTab); + ScUndoTabColorInfo(const ScUndoTabColorInfo& r); + + typedef ::std::vector<ScUndoTabColorInfo> List; +}; + +#endif diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx new file mode 100644 index 000000000000..63cefe22626a --- /dev/null +++ b/sc/inc/table.hxx @@ -0,0 +1,927 @@ +/************************************************************************* + * + * 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 <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 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; + + +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; + + // Daten pro Tabelle ------------------ + ScColumn aCol[MAXCOLCOUNT]; + + String aName; + String aCodeName; + String aComment; + BOOL bScenario; + BOOL bLayoutRTL; + BOOL bLoadingRTL; + + String aLinkDoc; + String aLinkFlt; + String aLinkOpt; + String aLinkTab; + ULONG nLinkRefreshDelay; + BYTE nLinkMode; + + // Seitenformatvorlage + String aPageStyle; + BOOL bPageSizeValid; + Size aPageSizeTwips; // Groesse der Druck-Seite + SCCOL nRepeatStartX; // Wiederholungszeilen/Spalten + SCCOL nRepeatEndX; // REPEAT_NONE, wenn nicht benutzt + SCROW nRepeatStartY; + SCROW nRepeatEndY; + + ::std::auto_ptr<ScTableProtection> pTabProtection; + + USHORT* pColWidth; + ::boost::shared_ptr<ScFlatUInt16RowSegments> mpRowHeights; + + BYTE* pColFlags; + ScBitMaskCompressedArray< SCROW, BYTE>* 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; + BOOL bTableAreaValid; + + // interne Verwaltung ------------------ + BOOL bVisible; + BOOL bStreamValid; + BOOL bPendingRowHeights; + BOOL bCalcNotification; + + SCTAB nTab; + USHORT nRecalcLvl; // Rekursionslevel Size-Recalc + ScDocument* pDocument; + utl::SearchParam* pSearchParam; + utl::TextSearch* pSearchText; + + mutable String aUpperName; // #i62977# filled only on demand, reset in SetName + + ScAddress2DVecPtr mxUninitNotes; + + // SortierParameter um den Stackbedarf von Quicksort zu Minimieren + ScSortParam aSortParam; + CollatorWrapper* pSortCollator; + BOOL bGlobalKeepQuery; + BOOL bSharedNameInserted; + + ScRangeVec aPrintRanges; + BOOL bPrintEntireSheet; + + ScRange* pRepeatColRange; + ScRange* pRepeatRowRange; + + USHORT nLockCount; + + ScRangeList* pScenarioRanges; + Color aScenarioColor; + Color aTabBgColor; + USHORT nScenarioFlags; + BOOL bActiveScenario; + bool mbPageBreaksValid; + +friend class ScDocument; // fuer 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, + BOOL bColInfo = TRUE, BOOL bRowInfo = TRUE ); + ~ScTable(); + + ScOutlineTable* GetOutlineTable() { return pOutlineTable; } + + SCSIZE GetCellCount(SCCOL nCol) const; + ULONG GetCellCount() const; + ULONG GetWeightedCount() const; + ULONG GetCodeCount() const; // RPN-Code in Formeln + + BOOL SetOutlineTable( const ScOutlineTable* pNewOutline ); + void StartOutlineTable(); + + void DoAutoOutline( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); + + BOOL TestRemoveSubTotals( const ScSubTotalParam& rParam ); + void RemoveSubTotals( ScSubTotalParam& rParam ); + BOOL DoSubTotals( ScSubTotalParam& rParam ); + + const ScSheetEvents* GetSheetEvents() const { return pSheetEvents; } + void SetSheetEvents( const ScSheetEvents* pNew ); + + BOOL IsVisible() const { return bVisible; } + void SetVisible( BOOL bVis ); + + BOOL IsStreamValid() const { return bStreamValid; } + void SetStreamValid( BOOL bSet, BOOL bIgnoreLock = FALSE ); + + BOOL IsPendingRowHeights() const { return bPendingRowHeights; } + void SetPendingRowHeights( BOOL bSet ); + + BOOL GetCalcNotification() const { return bCalcNotification; } + void SetCalcNotification( BOOL bSet ); + + BOOL IsLayoutRTL() const { return bLayoutRTL; } + BOOL IsLoadingRTL() const { return bLoadingRTL; } + void SetLayoutRTL( BOOL bSet ); + void SetLoadingRTL( BOOL bSet ); + + BOOL IsScenario() const { return bScenario; } + void SetScenario( 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); + USHORT GetScenarioFlags() const { return nScenarioFlags; } + void SetScenarioFlags(USHORT nNew) { nScenarioFlags = nNew; } + void SetActiveScenario(BOOL bSet) { bActiveScenario = bSet; } + BOOL IsActiveScenario() const { return bActiveScenario; } + + BYTE GetLinkMode() const { return nLinkMode; } + 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; } + ULONG GetLinkRefreshDelay() const { return nLinkRefreshDelay; } + + void SetLink( BYTE nMode, const String& rDoc, const String& rFlt, + const String& rOpt, const String& rTab, ULONG nRefreshDelay ); + + void GetName( String& rName ) const; + void SetName( const String& rNewName ); + + 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 ); + + 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(); + + BOOL IsBlockEditable( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, + SCROW nRow2, BOOL* pOnlyNotBecauseOfMatrix = NULL ) const; + BOOL IsSelectionEditable( const ScMarkData& rMark, + BOOL* pOnlyNotBecauseOfMatrix = NULL ) const; + + BOOL HasBlockMatrixFragment( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + BOOL HasSelectionMatrixFragment( const ScMarkData& rMark ) const; + + BOOL IsBlockEmpty( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, bool bIgnoreNotes = false ) const; + + void PutCell( const ScAddress&, ScBaseCell* pCell ); +//UNUSED2009-05 void PutCell( const ScAddress&, ULONG nFormatIndex, ScBaseCell* pCell); + void PutCell( SCCOL nCol, SCROW nRow, ScBaseCell* pCell ); + void PutCell(SCCOL nCol, SCROW nRow, ULONG nFormatIndex, ScBaseCell* pCell); + // TRUE = Zahlformat gesetzt + BOOL SetString( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, + SvNumberFormatter* pFormatter = NULL, bool bDetectNumberFormat = true ); + void SetValue( SCCOL nCol, SCROW nRow, const double& rVal ); + void SetError( SCCOL nCol, SCROW nRow, USHORT 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, + BOOL bAsciiExport = FALSE ); + + 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 ); + + 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, + BOOL* pUndoOutline = NULL ); + + 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, + BOOL* pUndoOutline = NULL ); + + void DeleteArea(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nDelFlag); + void CopyToClip(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScTable* pTable, + BOOL bKeepScenarioFlags, 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, + USHORT nInsFlag, BOOL bAsLink, 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, + USHORT nFlags, BOOL bMarked, ScTable* pDestTab, + const ScMarkData* pMarkData = NULL, + BOOL bAsLink = FALSE, BOOL bColRowFlags = TRUE); + void UndoToTable(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + USHORT nFlags, BOOL bMarked, ScTable* pDestTab, + const ScMarkData* pMarkData = NULL); + + void TransposeClip( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + ScTable* pTransClip, USHORT nFlags, BOOL bAsLink ); + + // Markierung von diesem Dokument + void MixMarked( const ScMarkData& rMark, USHORT nFunction, + BOOL bSkipEmpty, ScTable* pSrcTab ); + void MixData( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + USHORT nFunction, 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; + BOOL TestCopyScenarioTo( const ScTable* pDestTab ) const; + void MarkScenarioIn( ScMarkData& rMark, USHORT nNeededBits ) const; + BOOL HasScenarioRange( const ScRange& rRange ) const; + void InvalidateScenarioRanges(); + const ScRangeList* GetScenarioRanges() const; + + void CopyUpdated( const ScTable* pPosTab, ScTable* pDestTab ) const; + + void InvalidateTableArea(); + void InvalidatePageBreaks(); + + BOOL GetCellArea( SCCOL& rEndCol, SCROW& rEndRow ) const; // FALSE = leer + BOOL GetTableArea( SCCOL& rEndCol, SCROW& rEndRow ) const; + BOOL GetPrintArea( SCCOL& rEndCol, SCROW& rEndRow, BOOL bNotes ) const; + BOOL GetPrintAreaHor( SCROW nStartRow, SCROW nEndRow, + SCCOL& rEndCol, BOOL bNotes ) const; + BOOL GetPrintAreaVer( SCCOL nStartCol, SCCOL nEndCol, + SCROW& rEndRow, BOOL bNotes ) const; + + 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, + BOOL bIncludeOld, bool bOnlyDown ) const; + + bool ShrinkToUsedDataArea( 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, + BOOL bMarked, BOOL bUnprotected, const ScMarkData& rMark ); + + void LimitChartArea( SCCOL& rStartCol, SCROW& rStartRow, SCCOL& rEndCol, SCROW& rEndRow ); + + BOOL HasData( SCCOL nCol, SCROW nRow ); + BOOL HasStringData( SCCOL nCol, SCROW nRow ); + BOOL HasValueData( SCCOL nCol, SCROW nRow ); +//UNUSED2008-05 USHORT GetErrorData(SCCOL nCol, SCROW nRow) const; + BOOL HasStringCells( SCCOL nStartCol, SCROW nStartRow, + SCCOL nEndCol, SCROW nEndRow ) const; + + USHORT GetErrCode( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetErrCode( rPos.Row() ) : + 0; + } +//UNUSED2008-05 USHORT GetErrCode( SCCOL nCol, SCROW nRow ) const; + + 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, BOOL bIncludeDraw = 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); +//UNUSED2008-05 void UpdateInsertTabOnlyCells(SCTAB nTable); + void UpdateDeleteTab( SCTAB nTable, BOOL bIsMove, ScTable* pRefUndo = NULL ); + void UpdateMoveTab(SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo, ScProgress& ); + void UpdateCompile( BOOL bForceIfNameInUse = FALSE ); + void SetTabNo(SCTAB nNewTab); + BOOL IsRangeNameInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + USHORT nIndex) const; + void FindRangeNamesInUse(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + std::set<USHORT>& 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, + 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, + USHORT nFormatNo ); + void GetAutoFormatData(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, ScAutoFormatData& rData); + void ScReplaceTabsStr( String& rStr, const String& rSrch, const String& rRepl ); // aus sw + 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 SvxBorderLine** ppLeft, const SvxBorderLine** ppTop, + const SvxBorderLine** ppRight, const SvxBorderLine** ppBottom ) const; + +//UNUSED2009-05 BOOL HasLines( const ScRange& rRange, Rectangle& rSizes ) const; + bool HasAttrib( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, USHORT nMask ) const; + BOOL HasAttribSelection( const ScMarkData& rMark, USHORT nMask ) const; + BOOL ExtendMerge( SCCOL nStartCol, SCROW nStartRow, + SCCOL& rEndCol, SCROW& rEndRow, + BOOL bRefresh, BOOL bAttrs ); + const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, USHORT nWhich ) const; + const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const; + const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const; + + ULONG GetNumberFormat( const ScAddress& rPos ) const + { + return ValidColRow(rPos.Col(),rPos.Row()) ? + aCol[rPos.Col()].GetNumberFormat( rPos.Row() ) : + 0; + } + ULONG GetNumberFormat( SCCOL nCol, SCROW nRow ) const; + void MergeSelectionPattern( ScMergePatternState& rState, + const ScMarkData& rMark, BOOL bDeep ) const; + void MergePatternArea( ScMergePatternState& rState, SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2, 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 ); + void SetPattern( const ScAddress& rPos, const ScPatternAttr& rAttr, 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, 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 SvxBorderLine* pLine, BOOL bColorOnly ); + + const ScStyleSheet* GetStyle( SCCOL nCol, SCROW nRow ) const; + const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, BOOL& rFound ) const; + const ScStyleSheet* GetAreaStyle( BOOL& rFound, SCCOL nCol1, SCROW nRow1, + SCCOL nCol2, SCROW nRow2 ) const; + + void StyleSheetChanged( const SfxStyleSheetBase* pStyleSheet, BOOL bRemoved, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY ); + + BOOL IsStyleSheetUsed( const ScStyleSheet& rStyle, BOOL bGatherAllStyles ) const; + + BOOL ApplyFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags ); + BOOL RemoveFlags( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, INT16 nFlags ); + + void ApplySelectionCache( SfxItemPoolCache* pCache, const ScMarkData& rMark ); + void DeleteSelection( USHORT nDelFlag, const ScMarkData& rMark ); + + void ClearSelectionItems( const USHORT* pWhich, const ScMarkData& rMark ); + void ChangeSelectionIndent( 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 ); + + USHORT GetPrintRangeCount() const { return static_cast< USHORT >( aPrintRanges.size() ); } + const ScRange* GetPrintRange(USHORT 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 ); +//UNUSED2009-05 /** Removes all old print ranges and sets the passed print ranges. */ +//UNUSED2009-05 void SetPrintRange( 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 ); + + USHORT GetOptimalColWidth( SCCOL nCol, OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + BOOL bFormula, const ScMarkData* pMarkData, + BOOL bSimpleTextImport ); + BOOL SetOptimalHeight( SCROW nStartRow, SCROW nEndRow, USHORT nExtra, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + BOOL bForce, + ScProgress* pOuterProgress = NULL, ULONG nProgressStart = 0 ); + long GetNeededSize( SCCOL nCol, SCROW nRow, + OutputDevice* pDev, + double nPPTX, double nPPTY, + const Fraction& rZoomX, const Fraction& rZoomY, + BOOL bWidth, BOOL bTotalSize ); + void SetColWidth( SCCOL nCol, USHORT nNewWidth ); + void SetRowHeight( SCROW nRow, USHORT nNewHeight ); + BOOL SetRowHeightRange( SCROW nStartRow, SCROW nEndRow, USHORT 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, USHORT nNewHeight ); + + // nPPT fuer Test auf Veraenderung + void SetManualHeight( SCROW nStartRow, SCROW nEndRow, BOOL bManual ); + + USHORT GetColWidth( SCCOL nCol ) const; + SC_DLLPUBLIC USHORT GetRowHeight( SCROW nRow, SCROW* pStartRow = NULL, SCROW* pEndRow = NULL, bool bHiddenAsZero = true ) const; + ULONG GetRowHeight( SCROW nStartRow, SCROW nEndRow ) const; + ULONG GetScaledRowHeight( SCROW nStartRow, SCROW nEndRow, double fScale ) const; + ULONG GetColOffset( SCCOL nCol ) const; + 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(ULONG nHeight) const; + + USHORT GetOriginalWidth( SCCOL nCol ) const; + USHORT GetOriginalHeight( SCROW nRow ) const; + + USHORT 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, BYTE nNewFlags ); + void SetRowFlags( SCROW nRow, BYTE nNewFlags ); + void SetRowFlags( SCROW nStartRow, SCROW nEndRow, BYTE 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; + + BYTE GetColFlags( SCCOL nCol ) const; + BYTE GetRowFlags( SCROW nRow ) const; + + const ScBitMaskCompressedArray< SCROW, BYTE> * GetRowFlagsArray() const + { return pRowFlags; } + + BOOL UpdateOutlineCol( SCCOL nStartCol, SCCOL nEndCol, BOOL bShow ); + BOOL UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, BOOL bShow ); + + void UpdatePageBreaks( const ScRange* pUserArea ); + void RemoveManualBreaks(); + 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 RowHidden(SCROW nRow, SCROW& rLastRow) const; + bool HasHiddenRows(SCROW nStartRow, SCROW nEndRow) const; + bool ColHidden(SCCOL nCol, SCCOL& rLastCol) const; + bool ColHidden(SCCOL nCol, SCCOL* pFirstCol = NULL, SCCOL* pLastCol = NULL) const; + void SetRowHidden(SCROW nStartRow, SCROW nEndRow, bool bHidden); + void 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, BOOL bKeepQuery); + BOOL ValidQuery(SCROW nRow, const ScQueryParam& rQueryParam, + BOOL* pSpecial = NULL, ScBaseCell* pCell = NULL, + BOOL* pbTestEqualCondition = NULL ); + void TopTenQuery( ScQueryParam& ); + SCSIZE Query(ScQueryParam& rQueryParam, BOOL bKeepSub); + 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 ); + BOOL GetDataEntries(SCCOL nCol, SCROW nRow, TypedScStrCollection& rStrings, BOOL bLimit); + + BOOL HasColHeader( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ); + 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( ULONG nKey, ScRangeList& rRanges ); + + void IncRecalcLevel() { ++nRecalcLvl; } + void DecRecalcLevel( bool bUpdateNoteCaptionPos = true ) { if (!--nRecalcLvl) SetDrawPageSize(true, bUpdateNoteCaptionPos); } + + BOOL IsSortCollatorGlobal() const; + void InitSortCollator( const ScSortParam& rPar ); + void DestroySortCollator(); + +private: + void FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + ULONG nFillCount, FillDir eFillDir, FillCmd eFillCmd, + FillDateCmd eFillDateCmd, + double nStepValue, double nMaxValue, USHORT nMinDigits, + BOOL bAttribs, ScProgress& rProgress ); + void FillAnalyse( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + FillCmd& rCmd, FillDateCmd& rDateCmd, + double& rInc, USHORT& rMinDigits, + ScUserListData*& rListData, USHORT& rListIndex); + void FillAuto( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, + ULONG nFillCount, FillDir eFillDir, ScProgress& rProgress ); + + BOOL ValidNextPos( SCCOL nCol, SCROW nRow, const ScMarkData& rMark, + BOOL bMarked, BOOL bUnprotected ); + + void AutoFormatArea(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, + const ScPatternAttr& rAttr, USHORT nFormatNo); + void GetAutoFormatAttr(SCCOL nCol, SCROW nRow, USHORT nIndex, ScAutoFormatData& rData); + void GetAutoFormatFrame(SCCOL nCol, SCROW nRow, USHORT nFlags, USHORT nIndex, ScAutoFormatData& rData); + BOOL SearchCell(const SvxSearchItem& rSearchItem, SCCOL nCol, SCROW nRow, + const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc); + BOOL Search(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc); + BOOL SearchAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + BOOL Replace(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + const ScMarkData& rMark, String& rUndoStr, ScDocument* pUndoDoc); + BOOL ReplaceAll(const SvxSearchItem& rSearchItem, ScMarkData& rMark, + String& rUndoStr, ScDocument* pUndoDoc); + + BOOL SearchStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + ScMarkData& rMark); + BOOL ReplaceStyle(const SvxSearchItem& rSearchItem, SCCOL& rCol, SCROW& rRow, + ScMarkData& rMark, BOOL bIsUndo); + BOOL SearchAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark); + BOOL ReplaceAllStyle(const SvxSearchItem& rSearchItem, ScMarkData& rMark, + ScDocument* pUndoDoc); + + // benutzen globalen SortParam: + 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( USHORT 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& ); + + BOOL CreateExcelQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); + BOOL CreateStarQuery(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, ScQueryParam& rQueryParam); + void GetUpperCellString(SCCOL nCol, SCROW nRow, String& rStr); + + BOOL RefVisible(ScFormulaCell* pCell); + + BOOL IsEmptyLine(SCROW nRow, SCCOL nStartCol, SCCOL nEndCol); + + void IncDate(double& rVal, USHORT& nDayOfMonth, double nStep, FillDateCmd eCmd); + void FillFormula(ULONG& nFormulaCounter, BOOL bFirst, ScFormulaCell* pSrcCell, + SCCOL nDestCol, SCROW nDestRow, BOOL bLast ); + void UpdateInsertTabAbs(SCTAB nNewPos); + BOOL GetNextSpellingCell(SCCOL& rCol, SCROW& rRow, BOOL bInSel, + const ScMarkData& rMark) const; + BOOL GetNextMarkedCell( SCCOL& rCol, SCROW& rRow, const ScMarkData& rMark ); + void SetDrawPageSize( bool bResetStreamValid = true, bool bUpdateNoteCaptionPos = true ); + BOOL TestTabRefAbs(SCTAB nTable); + void CompileDBFormula(); + void CompileDBFormula( BOOL bCreateFormulaString ); + void CompileNameFormula( 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, + BOOL bNumFormatChanged, BOOL bBroadcast ); + + /** + * 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); + + /** + * 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 + + diff --git a/sc/inc/tablink.hxx b/sc/inc/tablink.hxx new file mode 100644 index 000000000000..72b4de611c2e --- /dev/null +++ b/sc/inc/tablink.hxx @@ -0,0 +1,121 @@ +/************************************************************************* + * + * 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> +//REMOVE #ifndef SO2_DECL_SVEMBEDDEDOBJECT_DEFINED +//REMOVE #define SO2_DECL_SVEMBEDDEDOBJECT_DEFINED +//REMOVE SO2_DECL_REF(SvEmbeddedObject) +//REMOVE #endif + +class ScDocShell; +struct TableLink_Impl; + +class ScTableLink : public ::sfx2::SvBaseLink, public ScRefreshTimer +{ +private: + TableLink_Impl* pImpl; + String aFileName; + String aFilterName; + String aOptions; + BOOL bInCreate; + BOOL bInEdit; + BOOL bAddUndo; + BOOL bDoPaint; + +public: + TYPEINFO(); + ScTableLink( ScDocShell* pDocSh, const String& rFile, + const String& rFilter, const String& rOpt, ULONG nRefresh ); + ScTableLink( SfxObjectShell* pShell, const String& rFile, + const String& rFilter, const String& rOpt, 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 ); + + BOOL Refresh(const String& rNewFile, const String& rNewFilter, + const String* pNewOptions /* = NULL */, ULONG nNewRefresh ); + void SetInCreate(BOOL bSet) { bInCreate = bSet; } + void SetAddUndo(BOOL bSet) { bAddUndo = bSet; } + void SetPaint(BOOL bSet) { bDoPaint = bSet; } + + const String& GetFileName() const { return aFileName; } + const String& GetFilterName() const { return aFilterName; } + const String& GetOptions() const { return aOptions; } + + 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, + UINT32 nRekCnt = 0, BOOL bWithInteraction = FALSE ); + ~ScDocumentLoader(); + ScDocument* GetDocument(); + ScDocShell* GetDocShell() { return pDocShell; } + 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 TRUE if a filter could be found, FALSE otherwise. */ + static BOOL GetFilterName( const String& rFileName, + String& rFilter, String& rOptions, + BOOL bWithContent, BOOL bWithInteraction ); + + static void RemoveAppPrefix( String& rFilterName ); +}; + +#endif diff --git a/sc/inc/tabopparams.hxx b/sc/inc/tabopparams.hxx new file mode 100644 index 000000000000..7baa461061fd --- /dev/null +++ b/sc/inc/tabopparams.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * 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; + BOOL bValid; + BOOL bRefresh; + BOOL bCollectNotifications; + + ScInterpreterTableOpParams() + : bValid( FALSE ) + , bRefresh( FALSE ) + , bCollectNotifications( TRUE ) + { + } + + ScInterpreterTableOpParams( const ScInterpreterTableOpParams& r ) + : aOld1( r.aOld1 ) + , aNew1( r.aNew1 ) + , aOld2( r.aOld2 ) + , aNew2( r.aNew2 ) + , aFormulaPos( r.aFormulaPos ) + //! never copied! , aNotifiedFormulaCells( r.aNotifiedFormulaCells ) + , 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; + //! never copied! aNotifiedFormulaCells = r.aNotifiedFormulaCells; + //! instead, empty anything eventually present + ::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 ; + // aNotifiedFormula(Cells|Pos), aNew1, aNew2, bRefresh, + // bCollectNotifications are not compared + } +}; + +DECLARE_LIST( ScTabOpList, ScInterpreterTableOpParams* ) + +#endif // SC_TABOPPARAMS_HXX + diff --git a/sc/inc/tabprotection.hxx b/sc/inc/tabprotection.hxx new file mode 100644 index 000000000000..d8dbd45d27fa --- /dev/null +++ b/sc/inc/tabprotection.hxx @@ -0,0 +1,177 @@ +/************************************************************************* + * + * 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 <vector> +#include <boost/shared_ptr.hpp> + +#define ENABLE_SHEET_PROTECTION 0 + +class ScDocument; +class ScTableProtectionImpl; + +enum ScPasswordHash +{ + PASSHASH_OOO = 0, + PASSHASH_XL +}; + +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 eHash); + +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) const = 0; + virtual void setPassword(const String& aPassText) = 0; + virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const = 0; + virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, + ScPasswordHash eHash = PASSHASH_OOO) = 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) const; + virtual void setPassword(const String& aPassText); + virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const; + virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, + ScPasswordHash eHash = PASSHASH_OOO); + 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) const; + virtual void setPassword(const String& aPassText); + virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const; + virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, + ScPasswordHash eHash = PASSHASH_OOO); + 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 diff --git a/sc/inc/targuno.hxx b/sc/inc/targuno.hxx new file mode 100644 index 000000000000..857f4c0c25e2 --- /dev/null +++ b/sc/inc/targuno.hxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/textuno.hxx b/sc/inc/textuno.hxx new file mode 100644 index 000000000000..e8ff73bf7d85 --- /dev/null +++ b/sc/inc/textuno.hxx @@ -0,0 +1,418 @@ +/************************************************************************* + * + * 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 ist ein dummer Container, der per setPropertyValue +// wieder in die Seitenvorlage geschrieben werden muss + +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(); + + // fuer ScPageHFItem (per 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( USHORT 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; + USHORT nPart; + ScEditEngineDefaulter* pEditEngine; + SvxEditEngineForwarder* pForwarder; + BOOL bDataValid; + BOOL bInUpdate; + +public: + ScHeaderFooterTextData( ScHeaderFooterContentObj& rContent, + USHORT nP ); + ~ScHeaderFooterTextData(); + + virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); + + // helper functions + SvxTextForwarder* GetTextForwarder(); + void UpdateData(); + ScEditEngineDefaulter* GetEditEngine() { GetTextForwarder(); return pEditEngine; } + + USHORT GetPart() const { return nPart; } + ScHeaderFooterContentObj& GetContentObj() const { return rContentObj; } +}; + +// ScHeaderFooterTextObj veraendert den Text in einem 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, + USHORT 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; + BOOL bDataValid; + BOOL bInUpdate; + BOOL bDirty; + 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(BOOL bValue) { bDirty = bValue; } + BOOL IsDirty() const { return bDirty; } + void SetDoUpdate(BOOL bValue) { bDoUpdate = bValue; } +}; + +class ScCellTextObj : public ScCellTextData, public SvxUnoText +{ +public: + ScCellTextObj(ScDocShell* pDocSh, const ScAddress& rP); + virtual ~ScCellTextObj() throw(); +}; + + +#endif + diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx new file mode 100644 index 000000000000..e4659921e7be --- /dev/null +++ b/sc/inc/token.hxx @@ -0,0 +1,507 @@ +/************************************************************************* + * + * 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/shared_ptr.hpp> + +#include "formula/opcode.hxx" +#include "refdata.hxx" +#include "scmatrix.hxx" +#include "formula/intruref.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 formula::SimpleIntrusiveReference< class ScToken > ScTokenRef; + +/** + * Another ref-counted token type using shared_ptr. <b>Be extra careful + * not to mix use of this smart pointer type with ScTokenRef</b>, since + * mixing them might cause a premature object deletion because the same + * object may be ref-counted by two different smart pointer wrappers. + * + * You have been warned. + */ +typedef ::boost::shared_ptr< ScToken > ScSharedTokenRef; + +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 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 ); +}; + +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( ScMatrix* 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 USHORT 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 USHORT 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 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 USHORT 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( ScMatrix* 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 diff --git a/sc/inc/tokenarray.hxx b/sc/inc/tokenarray.hxx new file mode 100644 index 000000000000..5ded8f4410d3 --- /dev/null +++ b/sc/inc/tokenarray.hxx @@ -0,0 +1,97 @@ +/************************************************************************* + * + * 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 <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; + BOOL ImplGetReference( ScRange& rRange, 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) + BOOL IsReference( ScRange& rRange ) const; + /// Exactly and only one valid range (no #REF!s) + BOOL IsValidReference( ScRange& rRange ) const; + + + /** Determines the extent of direct adjacent + references. Only use with real functions, e.g. + GetOuterFuncOpCode() == ocSum ! */ + 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* 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( ScMatrix* 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 + diff --git a/sc/inc/tokenuno.hxx b/sc/inc/tokenuno.hxx new file mode 100644 index 000000000000..c727063281e6 --- /dev/null +++ b/sc/inc/tokenuno.hxx @@ -0,0 +1,158 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/unitconv.hxx b/sc/inc/unitconv.hxx new file mode 100644 index 000000000000..e21140699e4c --- /dev/null +++ b/sc/inc/unitconv.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * 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( USHORT nInit = 16, USHORT nDelta = 4 ); + virtual ~ScUnitConverter() {}; + + BOOL GetValue( double& fValue, const String& rFromUnit, + const String& rToUnit ) const; +}; + + +#endif + diff --git a/sc/inc/unoguard.hxx b/sc/inc/unoguard.hxx new file mode 100644 index 000000000000..e5e57e959e7b --- /dev/null +++ b/sc/inc/unoguard.hxx @@ -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. + * + ************************************************************************/ + +#ifndef SC_UNOGUARD_HXX +#define SC_UNOGUARD_HXX + +#include <vos/mutex.hxx> + +class ScUnoGuard : public vos::OGuard +{ +public: + ScUnoGuard(); + ~ScUnoGuard() {} +}; + + +#endif + diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx new file mode 100644 index 000000000000..1e56743d8129 --- /dev/null +++ b/sc/inc/unonames.hxx @@ -0,0 +1,645 @@ +/************************************************************************* + * + * 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_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_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" + +// 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" + +// 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" + +/*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_REFSHEET "ReferenceSheet" + +// --> PB 2004-08-23 #i33095# 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" + +#endif + diff --git a/sc/inc/unoreflist.hxx b/sc/inc/unoreflist.hxx new file mode 100644 index 000000000000..3947f28cfb12 --- /dev/null +++ b/sc/inc/unoreflist.hxx @@ -0,0 +1,84 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx new file mode 100644 index 000000000000..175022a0ba14 --- /dev/null +++ b/sc/inc/unowids.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * 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 BOOL IsScUnoWid( USHORT nWid ) +{ + return nWid >= SC_WID_UNO_START && nWid <= SC_WID_UNO_END; +} + +inline BOOL IsScItemWid( USHORT nWid ) +{ + return nWid >= ATTR_STARTINDEX && nWid <= ATTR_ENDINDEX; // incl. page +} + +#endif + diff --git a/sc/inc/userdat.hxx b/sc/inc/userdat.hxx new file mode 100644 index 000000000000..88dea98ec22a --- /dev/null +++ b/sc/inc/userdat.hxx @@ -0,0 +1,118 @@ +/************************************************************************* + * + * 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; + bool mbNote; + + 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; } + +#ifdef ISSUE66550_HLINK_FOR_SHAPES + void SetHlink( const rtl::OUString& rHlink ) { maHlink = rHlink; } + const rtl::OUString& GetHlink() const { return maHlink; } +#endif + +private: + rtl::OUString maMacro; +#ifdef ISSUE66550_HLINK_FOR_SHAPES + rtl::OUString maHlink; +#endif +}; + +//------------------------------------------------------------------------- + +#endif + + diff --git a/sc/inc/userlist.hxx b/sc/inc/userlist.hxx new file mode 100644 index 000000000000..7190cd189156 --- /dev/null +++ b/sc/inc/userlist.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * 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; + USHORT 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); + USHORT GetSubCount() const; + BOOL GetSubIndex(const String& rSubStr, USHORT& rIndex) const; + String GetSubStr(USHORT 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( USHORT nLim = 4, USHORT 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 + BOOL HasEntry( const String& rStr ) const; + + inline ScUserListData* operator[]( const USHORT nIndex) const; + inline ScUserList& operator= ( const ScUserList& r ); + BOOL operator==( const ScUserList& r ) const; + inline BOOL operator!=( const ScUserList& r ) const; +}; + +inline ScUserList& ScUserList::operator=( const ScUserList& r ) + { return (ScUserList&)ScCollection::operator=( r ); } + +inline ScUserListData* ScUserList::operator[]( const USHORT nIndex) const + { return (ScUserListData*)At(nIndex); } + +inline BOOL ScUserList::operator!=( const ScUserList& r ) const + { return !operator==( r ); } + +#endif + diff --git a/sc/inc/validat.hxx b/sc/inc/validat.hxx new file mode 100644 index 000000000000..1bff57055f82 --- /dev/null +++ b/sc/inc/validat.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * 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 +}; + +// +// Eintrag fuer Gueltigkeit (es gibt nur eine Bedingung) +// + +class SC_DLLPUBLIC ScValidationData : public ScConditionEntry +{ + sal_uInt32 nKey; // Index in Attributen + + ScValidationMode eDataMode; + BOOL bShowInput; + BOOL bShowError; + ScValidErrorStyle eErrorStyle; + sal_Int16 mnListType; // selection list type: none, unsorted, sorted. + String aInputTitle; + String aInputMessage; + String aErrorTitle; + String aErrorMessage; + + BOOL bIsUsed; // temporaer beim Speichern + + BOOL DoMacro( const ScAddress& rPos, const String& rInput, + ScFormulaCell* pCell, Window* pParent ) const; + + 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 // echte Kopie + { 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 ); + + BOOL GetInput( String& rTitle, String& rMsg ) const + { rTitle = aInputTitle; rMsg = aInputMessage; return bShowInput; } + BOOL GetErrMsg( String& rTitle, String& rMsg, ScValidErrorStyle& rStyle ) const; + + 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; + + // mit String: bei Eingabe, mit Zelle: fuer Detektiv / RC_FORCED + BOOL IsDataValid( const String& rTest, const ScPatternAttr& rPattern, + const ScAddress& rPos ) const; + BOOL IsDataValid( ScBaseCell* pCell, const ScAddress& rPos ) const; + + // TRUE -> Abbruch + BOOL DoError( Window* pParent, const String& rInput, const ScAddress& rPos ) const; + void DoCalcError( ScFormulaCell* pCell ) const; + + BOOL IsEmpty() const; + sal_uInt32 GetKey() const { return nKey; } + void SetKey(sal_uInt32 nNew) { nKey = nNew; } // nur wenn nicht eingefuegt! + + void SetUsed(BOOL bSet) { bIsUsed = bSet; } + BOOL IsUsed() const { return bIsUsed; } + + BOOL EqualEntries( const ScValidationData& r ) const; // fuer Undo + + // sortiert (per PTRARR) nach Index + // operator== nur fuer die Sortierung + BOOL operator ==( const ScValidationData& r ) const { return nKey == r.nKey; } + 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; +}; + +// +// Liste der Bedingungen: +// + +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 ); + + /** Temporarily during save, returns RefManager's decision whether ALL + * references are marked now. */ + bool MarkUsedExternalReferences() const; + + BOOL operator==( const ScValidationDataList& r ) const; // fuer Ref-Undo +}; + +#endif + diff --git a/sc/inc/viewopti.hxx b/sc/inc/viewopti.hxx new file mode 100644 index 000000000000..44625ad2aeb5 --- /dev/null +++ b/sc/inc/viewopti.hxx @@ -0,0 +1,179 @@ +/************************************************************************* + * + * 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> + +#ifndef _SVX_SVXIDS_HRC //autogen +#include <svx/svxids.hrc> +#endif +#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 (USHORT)VOPT_BIGHANDLES+1 +#define MAX_TYPE (USHORT)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, BOOL bNew = TRUE ) { aOptArr[eOpt] = bNew; } + 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( USHORT 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: + 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(); +//UNUSED2008-05 ScTpViewItem( USHORT nWhich ); + ScTpViewItem( USHORT 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 diff --git a/sc/inc/viewuno.hxx b/sc/inc/viewuno.hxx new file mode 100644 index 000000000000..19b5c60fd070 --- /dev/null +++ b/sc/inc/viewuno.hxx @@ -0,0 +1,396 @@ +/************************************************************************* + * + * 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; + USHORT nPane; // ScSplitPos oder SC_VIEWPANE_ACTIVE + +protected: + ::com::sun::star::awt::Rectangle GetVisArea() const; + +public: + ScViewPaneBase(ScTabViewShell* pViewSh, USHORT 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, USHORT 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; + + ScViewPaneObj* GetObjectByIndex_Impl(USHORT nIndex) const; + INT16 GetZoom(void) const; + void SetZoom(INT16 Zoom); + INT16 GetZoomType(void) const; + void SetZoomType(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(); + void SheetChanged(); + 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); + + //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 + diff --git a/sc/inc/waitoff.hxx b/sc/inc/waitoff.hxx new file mode 100644 index 000000000000..b17435f23d7f --- /dev/null +++ b/sc/inc/waitoff.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * 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 <tools/solar.h> + +class Window; + +class ScWaitCursorOff +{ +private: + Window* pWin; + ULONG nWaiters; +public: + ScWaitCursorOff( Window* pWin ); + ~ScWaitCursorOff(); +}; + + +#endif diff --git a/sc/inc/warnpassword.hxx b/sc/inc/warnpassword.hxx new file mode 100644 index 000000000000..15d35a70d8a2 --- /dev/null +++ b/sc/inc/warnpassword.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * 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 + diff --git a/sc/inc/xmlwrap.hxx b/sc/inc/xmlwrap.hxx new file mode 100644 index 000000000000..926b6ef50cd1 --- /dev/null +++ b/sc/inc/xmlwrap.hxx @@ -0,0 +1,85 @@ +/************************************************************************* + * + * 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; + +//UNUSED2008-05 com::sun::star::uno::Reference< com::sun::star::task::XStatusIndicator> GetStatusIndicator( +//UNUSED2008-05 com::sun::star::uno::Reference< com::sun::star::frame::XModel >& rModel); + 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 >&); + BOOL Import(sal_Bool bStylesOnly, ErrCode& ); + BOOL Export(sal_Bool bStylesOnly); +}; + +#endif + diff --git a/sc/inc/zforauto.hxx b/sc/inc/zforauto.hxx new file mode 100644 index 000000000000..7c5e9a2f07cb --- /dev/null +++ b/sc/inc/zforauto.hxx @@ -0,0 +1,72 @@ +/************************************************************************* + * + * 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(ULONG nFormat, SvNumberFormatter& rFormatter); + void Load( SvStream& rStream, CharSet eByteStrSet ); // Laden der Zahlenformate + void Save( SvStream& rStream, CharSet eByteStrSet ) const; // Speichern der Zahlenformate + void PutFormatIndex(ULONG nFormat, SvNumberFormatter& rFormatter); + 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 + + |