LibreOffice Module sc (master) 1
cellsuno.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <scitems.hxx>
21#include <editeng/eeitem.hxx>
22#include <o3tl/safeint.hxx>
23#include <svx/svdpool.hxx>
24
25#include <utility>
26#include <vcl/svapp.hxx>
27#include <svx/algitem.hxx>
29#include <editeng/boxitem.hxx>
30#include <editeng/editeng.hxx>
31#include <editeng/flditem.hxx>
32#include <editeng/editobj.hxx>
33#include <editeng/unoipset.hxx>
34#include <editeng/langitem.hxx>
35#include <sfx2/linkmgr.hxx>
36#include <svl/numformat.hxx>
37#include <svl/srchitem.hxx>
39#include <svx/unomid.hxx>
40#include <editeng/unoprnms.hxx>
41#include <editeng/unotext.hxx>
42#include <svx/svdpage.hxx>
43#include <sfx2/bindings.hxx>
44#include <svl/zforlist.hxx>
45#include <svl/zformat.hxx>
47#include <float.h>
50
51#include <com/sun/star/awt/XBitmap.hpp>
52#include <com/sun/star/util/CellProtection.hpp>
53#include <com/sun/star/table/CellHoriJustify.hpp>
54#include <com/sun/star/table/CellOrientation.hpp>
55#include <com/sun/star/table/ShadowFormat.hpp>
56#include <com/sun/star/table/TableBorder.hpp>
57#include <com/sun/star/table/TableBorder2.hpp>
58#include <com/sun/star/sheet/CellFlags.hpp>
59#include <com/sun/star/sheet/FormulaResult.hpp>
60#include <com/sun/star/beans/PropertyAttribute.hpp>
61#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
62#include <com/sun/star/lang/Locale.hpp>
63#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
64#include <com/sun/star/beans/SetPropertyTolerantFailed.hpp>
65#include <com/sun/star/text/WritingMode2.hpp>
66#include <com/sun/star/text/textfield/Type.hpp>
67#include <com/sun/star/sheet/XConditionalFormats.hpp>
68#include <com/sun/star/util/XComplexColor.hpp>
69
70#include <autoform.hxx>
71#include <cellvalue.hxx>
72#include <cellmergeoption.hxx>
73#include <cellsuno.hxx>
74#include <cursuno.hxx>
75#include <textuno.hxx>
76#include <editsrc.hxx>
77#include <notesuno.hxx>
78#include <fielduno.hxx>
79#include <docuno.hxx>
80#include <datauno.hxx>
81#include <dapiuno.hxx>
82#include <chartuno.hxx>
83#include <fmtuno.hxx>
84#include <miscuno.hxx>
85#include <convuno.hxx>
86#include <srchuno.hxx>
87#include <nameuno.hxx>
88#include <targuno.hxx>
89#include <tokenuno.hxx>
90#include <eventuno.hxx>
91#include <docsh.hxx>
92#include <markdata.hxx>
93#include <patattr.hxx>
94#include <docpool.hxx>
95#include <docfunc.hxx>
96#include <dbdocfun.hxx>
97#include <olinefun.hxx>
98#include <hints.hxx>
99#include <formulacell.hxx>
100#include <undotab.hxx>
101#include <undoblk.hxx>
102#include <stlsheet.hxx>
103#include <dbdata.hxx>
104#include <attrib.hxx>
105#include <chartarr.hxx>
106#include <chartlis.hxx>
107#include <drwlayer.hxx>
108#include <printfun.hxx>
109#include <prnsave.hxx>
110#include <tablink.hxx>
111#include <dociter.hxx>
112#include <rangeutl.hxx>
113#include <conditio.hxx>
114#include <validat.hxx>
115#include <sc.hrc>
116#include <cellform.hxx>
117#include <globstr.hrc>
118#include <scresid.hxx>
119#include <unonames.hxx>
120#include <styleuno.hxx>
121#include <rangeseq.hxx>
122#include <unowids.hxx>
123#include <paramisc.hxx>
124#include <queryentry.hxx>
125#include <formula/errorcodes.hxx>
126#include <unoreflist.hxx>
127#include <formula/grammar.hxx>
129#include <stringutil.hxx>
130#include <formulaiter.hxx>
131#include <tokenarray.hxx>
132#include <stylehelper.hxx>
133#include <dputil.hxx>
134#include <sortparam.hxx>
135#include <condformatuno.hxx>
136#include <TablePivotCharts.hxx>
137#include <table.hxx>
138#include <refundo.hxx>
139#include <columnspanset.hxx>
140#include <CommonProperties.hxx>
141
142#include <memory>
143
144using namespace com::sun::star;
145
146// The names in the maps must be sorted according to strcmp!
148
149// Left/Right/Top/BottomBorder are mapped directly to the core items,
150// not collected/applied to the borders of a range -> ATTR_BORDER can be used directly
151
153{
154 static const SfxItemPropertyMapEntry aCellsPropertyMap_Impl[] =
155 {
156 { SC_UNONAME_ABSNAME, SC_WID_UNO_ABSNAME, cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
246 };
247 static SfxItemPropertySet aCellsPropertySet( aCellsPropertyMap_Impl );
248 return &aCellsPropertySet;
249}
250
251// CellRange contains all entries from Cells, plus its own entries
252// with Which-ID 0 (those are needed only for getPropertySetInfo).
253
255{
256 static const SfxItemPropertyMapEntry aRangePropertyMap_Impl[] =
257 {
258 { SC_UNONAME_ABSNAME, SC_WID_UNO_ABSNAME, cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
333 { SC_UNONAME_POS, SC_WID_UNO_POS, cppu::UnoType<awt::Point>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
338 { SC_UNONAME_SIZE, SC_WID_UNO_SIZE, cppu::UnoType<awt::Size>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
349 };
350 static SfxItemPropertySet aRangePropertySet( aRangePropertyMap_Impl );
351 return &aRangePropertySet;
352}
353
354// Cell contains entries from CellRange, plus its own entries
355// with Which-ID 0 (those are needed only for getPropertySetInfo).
356
358{
359 static const SfxItemPropertyMapEntry aCellPropertyMap_Impl[] =
360 {
361 { SC_UNONAME_ABSNAME, SC_WID_UNO_ABSNAME, cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
419 { SC_UNONAME_FORMRT, SC_WID_UNO_FORMRT, cppu::UnoType<table::CellContentType>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
421 { SC_UNONAME_FORMRT2, SC_WID_UNO_FORMRT2, cppu::UnoType<sal_Int32>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
440 { SC_UNONAME_POS, SC_WID_UNO_POS, cppu::UnoType<awt::Point>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
445 { SC_UNONAME_SIZE, SC_WID_UNO_SIZE, cppu::UnoType<awt::Size>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
458 };
459 static SfxItemPropertySet aCellPropertySet( aCellPropertyMap_Impl );
460 return &aCellPropertySet;
461}
462
463// Column and Row contain all entries from CellRange, plus its own entries
464// with Which-ID 0 (those are needed only for getPropertySetInfo).
465
467{
468 static const SfxItemPropertyMapEntry aColumnPropertyMap_Impl[] =
469 {
470 { SC_UNONAME_ABSNAME, SC_WID_UNO_ABSNAME, cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
549 { SC_UNONAME_POS, SC_WID_UNO_POS, cppu::UnoType<awt::Point>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
554 { SC_UNONAME_SIZE, SC_WID_UNO_SIZE, cppu::UnoType<awt::Size>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
565 };
566 static SfxItemPropertySet aColumnPropertySet( aColumnPropertyMap_Impl );
567 return &aColumnPropertySet;
568}
569
571{
572 static const SfxItemPropertyMapEntry aRowPropertyMap_Impl[] =
573 {
574 { SC_UNONAME_ABSNAME, SC_WID_UNO_ABSNAME, cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
655 { SC_UNONAME_POS, SC_WID_UNO_POS, cppu::UnoType<awt::Point>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
660 { SC_UNONAME_SIZE, SC_WID_UNO_SIZE, cppu::UnoType<awt::Size>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
670 };
671 static SfxItemPropertySet aRowPropertySet( aRowPropertyMap_Impl );
672 return &aRowPropertySet;
673}
674
676{
677 static const SfxItemPropertyMapEntry aSheetPropertyMap_Impl[] =
678 {
679 { SC_UNONAME_ABSNAME, SC_WID_UNO_ABSNAME, cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
747 { SC_UNO_LINKDISPBIT, SC_WID_UNO_LINKDISPBIT,cppu::UnoType<awt::XBitmap>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
748 { SC_UNO_LINKDISPNAME, SC_WID_UNO_LINKDISPNAME,cppu::UnoType<OUString>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
764 { SC_UNONAME_POS, SC_WID_UNO_POS, cppu::UnoType<awt::Point>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
772 { SC_UNONAME_SIZE, SC_WID_UNO_SIZE, cppu::UnoType<awt::Size>::get(), 0 | beans::PropertyAttribute::READONLY, 0 },
787 };
788 static SfxItemPropertySet aSheetPropertySet( aSheetPropertyMap_Impl );
789 return &aSheetPropertySet;
790}
791
793{
794 static const SfxItemPropertyMapEntry aEditPropertyMap_Impl[] =
795 {
799 SVX_UNOEDIT_NUMBERING_PROPERTY, // for completeness of service ParagraphProperties
802 };
803 return aEditPropertyMap_Impl;
804}
806{
808 return &aEditPropertySet;
809}
810
811constexpr OUStringLiteral SCCHARPROPERTIES_SERVICE = u"com.sun.star.style.CharacterProperties";
812constexpr OUStringLiteral SCPARAPROPERTIES_SERVICE = u"com.sun.star.style.ParagraphProperties";
813constexpr OUStringLiteral SCCELLPROPERTIES_SERVICE = u"com.sun.star.table.CellProperties";
814constexpr OUStringLiteral SCCELLRANGE_SERVICE = u"com.sun.star.table.CellRange";
815constexpr OUStringLiteral SCCELL_SERVICE = u"com.sun.star.table.Cell";
816constexpr OUStringLiteral SCSHEETCELLRANGES_SERVICE = u"com.sun.star.sheet.SheetCellRanges";
817constexpr OUStringLiteral SCSHEETCELLRANGE_SERVICE = u"com.sun.star.sheet.SheetCellRange";
818constexpr OUStringLiteral SCSPREADSHEET_SERVICE = u"com.sun.star.sheet.Spreadsheet";
819constexpr OUStringLiteral SCSHEETCELL_SERVICE = u"com.sun.star.sheet.SheetCell";
820
821SC_SIMPLE_SERVICE_INFO( ScCellFormatsEnumeration, "ScCellFormatsEnumeration", "com.sun.star.sheet.CellFormatRangesEnumeration" )
822SC_SIMPLE_SERVICE_INFO( ScCellFormatsObj, "ScCellFormatsObj", "com.sun.star.sheet.CellFormatRanges" )
823SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsEnumeration, "ScUniqueCellFormatsEnumeration", "com.sun.star.sheet.UniqueCellFormatRangesEnumeration" )
824SC_SIMPLE_SERVICE_INFO( ScUniqueCellFormatsObj, "ScUniqueCellFormatsObj", "com.sun.star.sheet.UniqueCellFormatRanges" )
825SC_SIMPLE_SERVICE_INFO( ScCellRangesBase, "ScCellRangesBase", "stardiv.unknown" )
826SC_SIMPLE_SERVICE_INFO( ScCellsEnumeration, "ScCellsEnumeration", "com.sun.star.sheet.CellsEnumeration" )
827SC_SIMPLE_SERVICE_INFO( ScCellsObj, "ScCellsObj", "com.sun.star.sheet.Cells" )
828SC_SIMPLE_SERVICE_INFO( ScTableColumnObj, "ScTableColumnObj", "com.sun.star.table.TableColumn" )
829SC_SIMPLE_SERVICE_INFO( ScTableRowObj, "ScTableRowObj", "com.sun.star.table.TableRow" )
830
832
834{
835}
836
837void ScLinkListener::Notify( const SfxHint& rHint )
838{
839 aLink.Call( rHint );
840}
841
842static void lcl_CopyProperties( beans::XPropertySet& rDest, beans::XPropertySet& rSource )
843{
844 uno::Reference<beans::XPropertySetInfo> xInfo(rSource.getPropertySetInfo());
845 if (xInfo.is())
846 {
847 const uno::Sequence<beans::Property> aSeq(xInfo->getProperties());
848 for (const beans::Property& rProp : aSeq)
849 {
850 OUString aName(rProp.Name);
851 rDest.setPropertyValue( aName, rSource.getPropertyValue( aName ) );
852 }
853 }
854}
855
856static SCTAB lcl_FirstTab( const ScRangeList& rRanges )
857{
858 if (rRanges.empty())
859 throw std::out_of_range("empty range");
860 const ScRange & rFirst = rRanges[0];
861 return rFirst.aStart.Tab();
862}
863
864static bool lcl_WholeSheet( const ScDocument& rDoc, const ScRangeList& rRanges )
865{
866 if ( rRanges.size() == 1 )
867 {
868 const ScRange & rRange = rRanges[0];
869 if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() &&
870 rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() )
871 return true;
872 }
873 return false;
874}
875
876namespace {
877template<typename BorderLineType>
878const ::editeng::SvxBorderLine* lcl_getBorderLine(
879 ::editeng::SvxBorderLine& rLine, const BorderLineType& rStruct )
880{
881 // Convert from 1/100mm to Twips.
882 if (!SvxBoxItem::LineToSvxLine( rStruct, rLine, true))
883 return nullptr;
884
885 if ( rLine.GetOutWidth() || rLine.GetInWidth() || rLine.GetDistance() )
886 return &rLine;
887 else
888 return nullptr;
889}
890}
891
892const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
893 ::editeng::SvxBorderLine& rLine, const table::BorderLine& rStruct )
894{
895 return lcl_getBorderLine( rLine, rStruct);
896}
897
898const ::editeng::SvxBorderLine* ScHelperFunctions::GetBorderLine(
899 ::editeng::SvxBorderLine& rLine, const table::BorderLine2& rStruct )
900{
901 return lcl_getBorderLine( rLine, rStruct);
902}
903
904namespace {
905template<typename TableBorderType>
906void lcl_fillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const TableBorderType& rBorder )
907{
909 rOuter.SetAllDistances(o3tl::toTwips(rBorder.Distance, o3tl::Length::mm100));
910 rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.TopLine ), SvxBoxItemLine::TOP );
911 rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.BottomLine ), SvxBoxItemLine::BOTTOM );
912 rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.LeftLine ), SvxBoxItemLine::LEFT );
913 rOuter.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.RightLine ), SvxBoxItemLine::RIGHT );
914 rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.HorizontalLine ), SvxBoxInfoItemLine::HORI );
915 rInner.SetLine( ScHelperFunctions::GetBorderLine( aLine, rBorder.VerticalLine ), SvxBoxInfoItemLine::VERT );
916 rInner.SetValid( SvxBoxInfoItemValidFlags::TOP, rBorder.IsTopLineValid );
917 rInner.SetValid( SvxBoxInfoItemValidFlags::BOTTOM, rBorder.IsBottomLineValid );
918 rInner.SetValid( SvxBoxInfoItemValidFlags::LEFT, rBorder.IsLeftLineValid );
919 rInner.SetValid( SvxBoxInfoItemValidFlags::RIGHT, rBorder.IsRightLineValid );
920 rInner.SetValid( SvxBoxInfoItemValidFlags::HORI, rBorder.IsHorizontalLineValid );
921 rInner.SetValid( SvxBoxInfoItemValidFlags::VERT, rBorder.IsVerticalLineValid );
922 rInner.SetValid( SvxBoxInfoItemValidFlags::DISTANCE, rBorder.IsDistanceValid );
923 rInner.SetTable( true );
924}
925}
926
927void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder& rBorder )
928{
929 lcl_fillBoxItems( rOuter, rInner, rBorder);
930}
931
932void ScHelperFunctions::FillBoxItems( SvxBoxItem& rOuter, SvxBoxInfoItem& rInner, const table::TableBorder2& rBorder )
933{
934 lcl_fillBoxItems( rOuter, rInner, rBorder);
935}
936
937void ScHelperFunctions::FillBorderLine( table::BorderLine& rStruct, const ::editeng::SvxBorderLine* pLine )
938{
939 // Convert from Twips to 1/100mm.
940 rStruct = SvxBoxItem::SvxLineToLine( pLine, true);
941}
942
943void ScHelperFunctions::FillBorderLine( table::BorderLine2& rStruct, const ::editeng::SvxBorderLine* pLine )
944{
945 rStruct = SvxBoxItem::SvxLineToLine( pLine, true);
946}
947
948namespace {
949template<typename TableBorderItem>
950void lcl_fillTableBorder( TableBorderItem& rBorder, const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner,
951 bool bInvalidateHorVerDist )
952{
953 ScHelperFunctions::FillBorderLine( rBorder.TopLine, rOuter.GetTop() );
954 ScHelperFunctions::FillBorderLine( rBorder.BottomLine, rOuter.GetBottom() );
955 ScHelperFunctions::FillBorderLine( rBorder.LeftLine, rOuter.GetLeft() );
956 ScHelperFunctions::FillBorderLine( rBorder.RightLine, rOuter.GetRight() );
957 ScHelperFunctions::FillBorderLine( rBorder.HorizontalLine, rInner.GetHori() );
958 ScHelperFunctions::FillBorderLine( rBorder.VerticalLine, rInner.GetVert() );
959
960 rBorder.Distance = rOuter.GetSmallestDistance();
961 rBorder.IsTopLineValid = rInner.IsValid(SvxBoxInfoItemValidFlags::TOP);
962 rBorder.IsBottomLineValid = rInner.IsValid(SvxBoxInfoItemValidFlags::BOTTOM);
963 rBorder.IsLeftLineValid = rInner.IsValid(SvxBoxInfoItemValidFlags::LEFT);
964 rBorder.IsRightLineValid = rInner.IsValid(SvxBoxInfoItemValidFlags::RIGHT);
965 rBorder.IsHorizontalLineValid = !bInvalidateHorVerDist && rInner.IsValid(SvxBoxInfoItemValidFlags::HORI);
966 rBorder.IsVerticalLineValid = !bInvalidateHorVerDist && rInner.IsValid(SvxBoxInfoItemValidFlags::VERT);
967 rBorder.IsDistanceValid = !bInvalidateHorVerDist && rInner.IsValid(SvxBoxInfoItemValidFlags::DISTANCE);
968}
969}
970
972 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist )
973{
974 table::TableBorder aBorder;
975 lcl_fillTableBorder( aBorder, rOuter, rInner, bInvalidateHorVerDist);
976 rAny <<= aBorder;
977}
978
980 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner, bool bInvalidateHorVerDist )
981{
982 table::TableBorder2 aBorder;
983 lcl_fillTableBorder( aBorder, rOuter, rInner, bInvalidateHorVerDist);
984 rAny <<= aBorder;
985}
986
988
990 const SvxBoxItem& rOuter, const SvxBoxInfoItem& rInner )
991{
992 ScDocument& rDoc = pDocShell->GetDocument();
993 bool bUndo(rDoc.IsUndoEnabled());
994 ScDocumentUniquePtr pUndoDoc;
995 if (bUndo)
996 pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
997 size_t nCount = rRanges.size();
998 for (size_t i = 0; i < nCount; ++i)
999 {
1000 ScRange const & rRange = rRanges[ i ];
1001 SCTAB nTab = rRange.aStart.Tab();
1002
1003 if (bUndo)
1004 {
1005 if ( i==0 )
1006 pUndoDoc->InitUndo( rDoc, nTab, nTab );
1007 else
1008 pUndoDoc->AddUndoTab( nTab, nTab );
1009 rDoc.CopyToDocument(rRange, InsertDeleteFlags::ATTRIB, false, *pUndoDoc);
1010 }
1011
1012 ScMarkData aMark(rDoc.GetSheetLimits());
1013 aMark.SetMarkArea( rRange );
1014 aMark.SelectTable( nTab, true );
1015
1016 rDoc.ApplySelectionFrame(aMark, rOuter, &rInner);
1017 // don't need RowHeight if there is only a border
1018 }
1019
1020 if (bUndo)
1021 {
1022 pDocShell->GetUndoManager()->AddUndoAction(
1023 std::make_unique<ScUndoBorder>( pDocShell, rRanges, std::move(pUndoDoc), rOuter, rInner ) );
1024 }
1025
1026 for (size_t i = 0; i < nCount; ++i )
1027 pDocShell->PostPaint( rRanges[ i ], PaintPartFlags::Grid, SC_PF_LINES | SC_PF_TESTMERGE );
1028
1029 pDocShell->SetDocumentModified();
1030}
1031
1034
1035static bool lcl_PutDataArray( ScDocShell& rDocShell, const ScRange& rRange,
1036 const uno::Sequence< uno::Sequence<uno::Any> >& aData )
1037{
1038 ScDocument& rDoc = rDocShell.GetDocument();
1039 ScFieldEditEngine& rEngine = rDoc.GetEditEngine();
1040 SCTAB nTab = rRange.aStart.Tab();
1041 SCCOL nStartCol = rRange.aStart.Col();
1042 SCROW nStartRow = rRange.aStart.Row();
1043 SCCOL nEndCol = rRange.aEnd.Col();
1044 SCROW nEndRow = rRange.aEnd.Row();
1045 bool bUndo(rDoc.IsUndoEnabled());
1046
1047 if ( !rDoc.IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
1048 {
1050 return false;
1051 }
1052
1053 sal_Int32 nCols = 0;
1054 sal_Int32 nRows = aData.getLength();
1055 if ( nRows )
1056 nCols = aData[0].getLength();
1057
1058 if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
1059 {
1061 return false;
1062 }
1063
1064 ScDocumentUniquePtr pUndoDoc;
1065 if ( bUndo )
1066 {
1067 pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
1068 pUndoDoc->InitUndo( rDoc, nTab, nTab );
1070 }
1071
1072 rDoc.DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, InsertDeleteFlags::CONTENTS );
1073
1074 bool bError = false;
1075 SCROW nDocRow = nStartRow;
1076 for (const uno::Sequence<uno::Any>& rColSeq : aData)
1077 {
1078 if ( rColSeq.getLength() == nCols )
1079 {
1080 SCCOL nDocCol = nStartCol;
1081 for (const uno::Any& rElement : rColSeq)
1082 {
1083 ScAddress aPos(nDocCol, nDocRow, nTab);
1084
1085 switch( rElement.getValueTypeClass() )
1086 {
1087 case uno::TypeClass_VOID:
1088 {
1089 // void = "no value"
1090 rDoc.SetError( nDocCol, nDocRow, nTab, FormulaError::NotAvailable );
1091 }
1092 break;
1093
1094 // #87871# accept integer types because Basic passes a floating point
1095 // variable as byte, short or long if it's an integer number.
1096 case uno::TypeClass_BYTE:
1097 case uno::TypeClass_SHORT:
1098 case uno::TypeClass_UNSIGNED_SHORT:
1099 case uno::TypeClass_LONG:
1100 case uno::TypeClass_UNSIGNED_LONG:
1101 case uno::TypeClass_FLOAT:
1102 case uno::TypeClass_DOUBLE:
1103 {
1104 double fVal(0.0);
1105 rElement >>= fVal;
1106 rDoc.SetValue(aPos, fVal);
1107 }
1108 break;
1109
1110 case uno::TypeClass_STRING:
1111 {
1112 OUString aUStr;
1113 rElement >>= aUStr;
1114 if ( !aUStr.isEmpty() )
1115 {
1116 // tdf#146454 - check for a multiline string since setting an edit
1117 // or string cell is in magnitudes slower than setting a plain string
1118 if (ScStringUtil::isMultiline(aUStr))
1119 {
1120 rEngine.SetTextCurrentDefaults(aUStr);
1121 rDoc.SetEditText(aPos, rEngine.CreateTextObject());
1122 }
1123 else
1124 {
1125 ScSetStringParam aParam;
1126 aParam.setTextInput();
1127 rDoc.SetString(aPos, aUStr, &aParam);
1128 }
1129 }
1130 }
1131 break;
1132
1133 // accept Sequence<FormulaToken> for formula cells
1134 case uno::TypeClass_SEQUENCE:
1135 {
1136 uno::Sequence< sheet::FormulaToken > aTokens;
1137 if ( rElement >>= aTokens )
1138 {
1139 ScTokenArray aTokenArray(rDoc);
1140 ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, aTokens );
1141 rDoc.SetFormula(aPos, aTokenArray);
1142 }
1143 else
1144 bError = true;
1145 }
1146 break;
1147
1148 default:
1149 bError = true; // invalid type
1150 }
1151 ++nDocCol;
1152 }
1153 }
1154 else
1155 bError = true; // wrong size
1156
1157 ++nDocRow;
1158 }
1159
1160 bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
1161
1162 if ( pUndoDoc )
1163 {
1164 ScMarkData aDestMark(rDoc.GetSheetLimits());
1165 aDestMark.SelectOneTable( nTab );
1166 rDocShell.GetUndoManager()->AddUndoAction(
1167 std::make_unique<ScUndoPaste>(
1168 &rDocShell, ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab),
1169 aDestMark, std::move(pUndoDoc), nullptr, InsertDeleteFlags::CONTENTS, nullptr, false));
1170 }
1171
1172 if (!bHeight)
1173 rDocShell.PostPaint( rRange, PaintPartFlags::Grid ); // AdjustRowHeight may have painted already
1174
1175 rDocShell.SetDocumentModified();
1176
1177 return !bError;
1178}
1179
1180static bool lcl_PutFormulaArray( ScDocShell& rDocShell, const ScRange& rRange,
1181 const uno::Sequence< uno::Sequence<OUString> >& aData,
1182 const formula::FormulaGrammar::Grammar eGrammar )
1183{
1184 ScDocument& rDoc = rDocShell.GetDocument();
1185 SCTAB nTab = rRange.aStart.Tab();
1186 SCCOL nStartCol = rRange.aStart.Col();
1187 SCROW nStartRow = rRange.aStart.Row();
1188 SCCOL nEndCol = rRange.aEnd.Col();
1189 SCROW nEndRow = rRange.aEnd.Row();
1190 bool bUndo(rDoc.IsUndoEnabled());
1191
1192 if ( !rDoc.IsBlockEditable( nTab, nStartCol,nStartRow, nEndCol,nEndRow ) )
1193 {
1195 return false;
1196 }
1197
1198 sal_Int32 nCols = 0;
1199 sal_Int32 nRows = aData.getLength();
1200 if ( nRows )
1201 nCols = aData[0].getLength();
1202
1203 if ( nCols != nEndCol-nStartCol+1 || nRows != nEndRow-nStartRow+1 )
1204 {
1206 return false;
1207 }
1208
1209 ScDocumentUniquePtr pUndoDoc;
1210 if ( bUndo )
1211 {
1212 pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
1213 pUndoDoc->InitUndo( rDoc, nTab, nTab );
1214 rDoc.CopyToDocument(rRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc);
1215 }
1216
1217 rDoc.DeleteAreaTab( nStartCol, nStartRow, nEndCol, nEndRow, nTab, InsertDeleteFlags::CONTENTS );
1218
1219 bool bError = false;
1220 SCROW nDocRow = nStartRow;
1221 for (const uno::Sequence<OUString>& rColSeq : aData)
1222 {
1223 if ( rColSeq.getLength() == nCols )
1224 {
1225 SCCOL nDocCol = nStartCol;
1226 for (const OUString& aText : rColSeq)
1227 {
1228 ScAddress aPos( nDocCol, nDocRow, nTab );
1229
1230 ScInputStringType aRes =
1232 *rDoc.GetFormatTable(), aText, LANGUAGE_ENGLISH_US);
1233 switch (aRes.meType)
1234 {
1236 rDoc.SetFormula(aPos, aRes.maText, eGrammar);
1237 break;
1239 rDoc.SetValue(aPos, aRes.mfValue);
1240 break;
1242 rDoc.SetTextCell(aPos, aRes.maText);
1243 break;
1244 default:
1245 ;
1246 }
1247
1248 ++nDocCol;
1249 }
1250 }
1251 else
1252 bError = true; // wrong size
1253
1254 ++nDocRow;
1255 }
1256
1257 bool bHeight = rDocShell.AdjustRowHeight( nStartRow, nEndRow, nTab );
1258
1259 if ( pUndoDoc )
1260 {
1261 ScMarkData aDestMark(rDoc.GetSheetLimits());
1262 aDestMark.SelectOneTable( nTab );
1263 rDocShell.GetUndoManager()->AddUndoAction(
1264 std::make_unique<ScUndoPaste>( &rDocShell,
1265 ScRange(nStartCol, nStartRow, nTab, nEndCol, nEndRow, nTab), aDestMark,
1266 std::move(pUndoDoc), nullptr, InsertDeleteFlags::CONTENTS, nullptr, false));
1267 }
1268
1269 if (!bHeight)
1270 rDocShell.PostPaint( rRange, PaintPartFlags::Grid ); // AdjustRowHeight may have painted already
1271
1272 rDocShell.SetDocumentModified();
1273
1274 return !bError;
1275}
1276
1277// used in ScCellRangeObj::getFormulaArray and ScCellObj::GetInputString_Impl
1278static OUString lcl_GetInputString( ScDocument& rDoc, const ScAddress& rPos, bool bEnglish )
1279{
1280 ScRefCellValue aCell(rDoc, rPos);
1281 if (aCell.isEmpty())
1282 return OUString();
1283
1284 OUString aVal;
1285
1286 CellType eType = aCell.getType();
1287 if (eType == CELLTYPE_FORMULA)
1288 {
1289 ScFormulaCell* pForm = aCell.getFormula();
1290 return pForm->GetFormula( formula::FormulaGrammar::mapAPItoGrammar( bEnglish, false));
1291 }
1292
1293 SvNumberFormatter* pFormatter = bEnglish ? ScGlobal::GetEnglishFormatter() :
1294 rDoc.GetFormatTable();
1295 // Since the English formatter was constructed with
1296 // LANGUAGE_ENGLISH_US the "General" format has index key 0,
1297 // we don't have to query.
1298 sal_uInt32 nNumFmt = bEnglish ? 0 : rDoc.GetNumberFormat(rPos);
1299
1300 if (eType == CELLTYPE_EDIT)
1301 {
1302 // GetString on EditCell turns breaks into spaces,
1303 // but we need the breaks here
1304 const EditTextObject* pData = aCell.getEditText();
1305 if (pData)
1306 {
1307 EditEngine& rEngine = rDoc.GetEditEngine();
1308 rEngine.SetText(*pData);
1309 aVal = rEngine.GetText();
1310 }
1311 }
1312 else
1313 aVal = ScCellFormat::GetInputString(aCell, nNumFmt, *pFormatter, rDoc);
1314
1315 // if applicable, prepend ' like in ScTabViewShell::UpdateInputHandler
1317 {
1318 double fDummy;
1319 OUString aTempString = aVal;
1320 bool bIsNumberFormat(pFormatter->IsNumberFormat(aTempString, nNumFmt, fDummy));
1321 if ( bIsNumberFormat )
1322 aTempString = "'" + aTempString;
1323 else if ( aTempString.startsWith("'") )
1324 {
1325 // if the string starts with a "'", add another one because setFormula
1326 // strips one (like text input, except for "text" number formats)
1327 if ( bEnglish || ( pFormatter->GetType(nNumFmt) != SvNumFormatType::TEXT ) )
1328 aTempString = "'" + aTempString;
1329 }
1330 aVal = aTempString;
1331 }
1332 return aVal;
1333}
1334
1335ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, const ScRange& rR) :
1336 pPropSet(lcl_GetCellsPropertySet()),
1337 pDocShell( pDocSh ),
1338 nObjectId( 0 ),
1339 bChartColAsHdr( false ),
1340 bChartRowAsHdr( false ),
1341 bCursorOnly( false ),
1342 bGotDataChangedHint( false ),
1343 aValueListeners( 0 )
1344{
1345 ScRange aCellRange(rR);
1346 aCellRange.PutInOrder();
1347 aRanges.push_back( aCellRange );
1348
1349 if (pDocShell) // Null if created with createInstance
1350 {
1351 ScDocument& rDoc = pDocShell->GetDocument();
1352 rDoc.AddUnoObject(*this);
1353 nObjectId = rDoc.GetNewUnoId();
1354 }
1355}
1356
1357ScCellRangesBase::ScCellRangesBase(ScDocShell* pDocSh, ScRangeList aR) :
1358 pPropSet(lcl_GetCellsPropertySet()),
1359 pDocShell( pDocSh ),
1360 aRanges(std::move( aR )),
1361 nObjectId( 0 ),
1362 bChartColAsHdr( false ),
1363 bChartRowAsHdr( false ),
1364 bCursorOnly( false ),
1365 bGotDataChangedHint( false ),
1366 aValueListeners( 0 )
1367{
1368 if (pDocShell) // Null if created with createInstance
1369 {
1370 ScDocument& rDoc = pDocShell->GetDocument();
1371 rDoc.AddUnoObject(*this);
1372 nObjectId = rDoc.GetNewUnoId();
1373 }
1374}
1375
1376ScCellRangesBase::~ScCellRangesBase()
1377{
1379
1380 // call RemoveUnoObject first, so no notification can happen
1381 // during ForgetCurrentAttrs
1382
1383 if (pDocShell)
1384 pDocShell->GetDocument().RemoveUnoObject(*this);
1385
1386 ForgetCurrentAttrs();
1387 ForgetMarkData();
1388
1389 pValueListener.reset();
1390
1393}
1394
1395void ScCellRangesBase::ForgetCurrentAttrs()
1396{
1397 pCurrentFlat.reset();
1398 pCurrentDeep.reset();
1399 moCurrentDataSet.reset();
1400 moNoDfltCurrentDataSet.reset();
1401
1402 // #i62483# pMarkData can remain unchanged, is deleted only if the range changes (RefChanged)
1403}
1404
1405void ScCellRangesBase::ForgetMarkData()
1406{
1407 pMarkData.reset();
1408}
1409
1410const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsFlat()
1411{
1412 // get and cache direct cell attributes for this object's range
1413
1414 if ( !pCurrentFlat && pDocShell )
1415 {
1416 ScDocument& rDoc = pDocShell->GetDocument();
1417 pCurrentFlat = rDoc.CreateSelectionPattern( *GetMarkData(), false );
1418 }
1419 return pCurrentFlat.get();
1420}
1421
1422const ScPatternAttr* ScCellRangesBase::GetCurrentAttrsDeep()
1423{
1424 // get and cache cell attributes (incl. styles) for this object's range
1425
1426 if ( !pCurrentDeep && pDocShell )
1427 {
1428 ScDocument& rDoc = pDocShell->GetDocument();
1429 pCurrentDeep = rDoc.CreateSelectionPattern( *GetMarkData() );
1430 }
1431 return pCurrentDeep.get();
1432}
1433
1434SfxItemSet* ScCellRangesBase::GetCurrentDataSet(bool bNoDflt)
1435{
1436 if(!moCurrentDataSet)
1437 {
1438 const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
1439 if ( pPattern )
1440 {
1441 // replace Dontcare with Default, so that we always have a reflection
1442 moCurrentDataSet.emplace( pPattern->GetItemSet() );
1443 moNoDfltCurrentDataSet.emplace( pPattern->GetItemSet() );
1444 moCurrentDataSet->ClearInvalidItems();
1445 }
1446 }
1447 if (bNoDflt)
1448 {
1449 if (moNoDfltCurrentDataSet)
1450 return &*moNoDfltCurrentDataSet;
1451 }
1452 else
1453 {
1454 if (moCurrentDataSet)
1455 return &*moCurrentDataSet;
1456 }
1457 return nullptr;
1458}
1459
1460const ScMarkData* ScCellRangesBase::GetMarkData()
1461{
1462 if (!pMarkData)
1463 {
1464 pMarkData.reset( new ScMarkData(GetDocument()->GetSheetLimits(), aRanges) );
1465 }
1466 return pMarkData.get();
1467}
1468
1469void ScCellRangesBase::Notify( SfxBroadcaster&, const SfxHint& rHint )
1470{
1471 const SfxHintId nId = rHint.GetId();
1472 if ( nId == SfxHintId::Dying )
1473 {
1474 // if the document dies, must reset to avoid crash in dtor!
1475 ForgetCurrentAttrs();
1476 pDocShell = nullptr; // invalid
1477
1478 // fdo#72695: if UNO object is already dead, don't revive it with event
1479 if ( m_refCount > 0 && !aValueListeners.empty() )
1480 {
1481 // dispose listeners
1482
1483 lang::EventObject aEvent;
1484 aEvent.Source = getXWeak();
1485 for (uno::Reference<util::XModifyListener> & xValueListener : aValueListeners)
1486 xValueListener->disposing( aEvent );
1487
1488 aValueListeners.clear();
1489
1490 // The listeners can't have the last ref to this, as it's still held
1491 // by the DocShell.
1492 }
1493 }
1494 else if ( nId == SfxHintId::DataChanged )
1495 {
1496 // document content changed -> forget cached attributes
1497 ForgetCurrentAttrs();
1498
1499 if ( bGotDataChangedHint && pDocShell )
1500 {
1501 // This object was notified of content changes, so one call
1502 // for each listener is generated now.
1503 // The calls can't be executed directly because the document's
1504 // UNO broadcaster list must not be modified.
1505 // Instead, add to the document's list of listener calls,
1506 // which will be executed directly after the broadcast of
1507 // SfxHintId::DataChanged.
1508
1509 lang::EventObject aEvent;
1510 aEvent.Source = getXWeak();
1511
1512 // the EventObject holds a Ref to this object until after the listener calls
1513
1514 ScDocument& rDoc = pDocShell->GetDocument();
1515 for (const uno::Reference<util::XModifyListener> & xValueListener : aValueListeners)
1516 rDoc.AddUnoListenerCall( xValueListener, aEvent );
1517
1518 bGotDataChangedHint = false;
1519 }
1520 }
1521 else if ( nId == SfxHintId::ScCalcAll )
1522 {
1523 // broadcast from DoHardRecalc - set bGotDataChangedHint
1524 // (SfxHintId::DataChanged follows separately)
1525
1526 if ( !aValueListeners.empty() )
1527 bGotDataChangedHint = true;
1528 }
1529 else if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
1530 {
1531 ScDocument& rDoc = pDocShell->GetDocument();
1532 std::unique_ptr<ScRangeList> pUndoRanges;
1533 if ( rDoc.HasUnoRefUndo() )
1534 pUndoRanges.reset(new ScRangeList( aRanges ));
1535
1536 if ( aRanges.UpdateReference( pRefHint->GetMode(), &rDoc, pRefHint->GetRange(),
1537 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() ) )
1538 {
1539 if ( pRefHint->GetMode() == URM_INSDEL
1540 && aRanges.size() == 1
1541 && dynamic_cast<ScTableSheetObj*>(this)
1542 )
1543 {
1544 // #101755#; the range size of a sheet does not change
1545 ScRange & rR = aRanges.front();
1546 rR.aStart.SetCol(0);
1547 rR.aStart.SetRow(0);
1548 rR.aEnd.SetCol(rDoc.MaxCol());
1549 rR.aEnd.SetRow(rDoc.MaxRow());
1550 }
1551 RefChanged();
1552
1553 // any change of the range address is broadcast to value (modify) listeners
1554 if ( !aValueListeners.empty() )
1555 bGotDataChangedHint = true;
1556
1557 if ( pUndoRanges )
1558 rDoc.AddUnoRefChange( nObjectId, *pUndoRanges );
1559 }
1560 }
1561 else if ( auto pUndoHint = dynamic_cast<const ScUnoRefUndoHint*>(&rHint) )
1562 {
1563 if ( pUndoHint->GetObjectId() == nObjectId )
1564 {
1565 // restore ranges from hint
1566
1567 aRanges = pUndoHint->GetRanges();
1568
1569 RefChanged();
1570 if ( !aValueListeners.empty() )
1571 bGotDataChangedHint = true; // need to broadcast the undo, too
1572 }
1573 }
1574}
1575
1576void ScCellRangesBase::RefChanged()
1577{
1579
1580 if ( pValueListener && !aValueListeners.empty() )
1581 {
1582 pValueListener->EndListeningAll();
1583
1584 ScDocument& rDoc = pDocShell->GetDocument();
1585 for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
1586 rDoc.StartListeningArea( aRanges[ i ], false, pValueListener.get() );
1587 }
1588
1589 ForgetCurrentAttrs();
1590 ForgetMarkData();
1591}
1592
1593ScDocument* ScCellRangesBase::GetDocument() const
1594{
1595 if (pDocShell)
1596 return &pDocShell->GetDocument();
1597 else
1598 return nullptr;
1599}
1600
1601void ScCellRangesBase::InitInsertRange(ScDocShell* pDocSh, const ScRange& rR)
1602{
1603 if ( pDocShell || !pDocSh )
1604 return;
1605
1606 pDocShell = pDocSh;
1607
1608 ScRange aCellRange(rR);
1609 aCellRange.PutInOrder();
1610 aRanges.RemoveAll();
1611 aRanges.push_back( aCellRange );
1612
1613 pDocShell->GetDocument().AddUnoObject(*this);
1614
1615 RefChanged(); // adjust range in range object
1616}
1617
1618void ScCellRangesBase::AddRange(const ScRange& rRange, const bool bMergeRanges)
1619{
1620 if (bMergeRanges)
1621 aRanges.Join(rRange);
1622 else
1623 aRanges.push_back(rRange);
1624 RefChanged();
1625}
1626
1627void ScCellRangesBase::SetNewRange(const ScRange& rNew)
1628{
1629 ScRange aCellRange(rNew);
1630 aCellRange.PutInOrder();
1631
1632 aRanges.RemoveAll();
1633 aRanges.push_back( aCellRange );
1634 RefChanged();
1635}
1636
1637void ScCellRangesBase::SetNewRanges(const ScRangeList& rNew)
1638{
1639 aRanges = rNew;
1640 RefChanged();
1641}
1642
1643void ScCellRangesBase::SetCursorOnly( bool bSet )
1644{
1645 // set for a selection object that is created from the cursor position
1646 // without anything selected (may contain several sheets)
1647
1648 bCursorOnly = bSet;
1649}
1650
1651void ScCellRangesBase::PaintGridRanges_Impl( )
1652{
1653 for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
1654 pDocShell->PostPaint( aRanges[ i ], PaintPartFlags::Grid );
1655}
1656
1657// XSheetOperation
1658
1659double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunction )
1660{
1661 SolarMutexGuard aGuard;
1662 ScMarkData aMark(*GetMarkData());
1663 aMark.MarkToSimple();
1664 if (!aMark.IsMarked())
1665 aMark.SetMarkNegative(true); // so we can enter dummy position
1666
1667 ScAddress aDummy; // if not marked, ignored if it is negative
1668 double fVal;
1669 ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(nFunction));
1670 ScDocument& rDoc = pDocShell->GetDocument();
1671 if ( !rDoc.GetSelectionFunction( eFunc, aDummy, aMark, fVal ) )
1672 {
1673 throw uno::RuntimeException();
1674 }
1675
1676 return fVal;
1677}
1678
1679void SAL_CALL ScCellRangesBase::clearContents( sal_Int32 nContentFlags )
1680{
1681 SolarMutexGuard aGuard;
1682 if ( !aRanges.empty() )
1683 {
1684 // only for clearContents: EDITATTR is only used if no contents are deleted
1685 InsertDeleteFlags nDelFlags = static_cast<InsertDeleteFlags>(nContentFlags) & InsertDeleteFlags::ALL;
1686 if ( ( nDelFlags & InsertDeleteFlags::EDITATTR ) && ( nDelFlags & InsertDeleteFlags::CONTENTS ) == InsertDeleteFlags::NONE )
1687 nDelFlags |= InsertDeleteFlags::EDITATTR;
1688
1689 pDocShell->GetDocFunc().DeleteContents( *GetMarkData(), nDelFlags, true, true );
1690 }
1691 // otherwise nothing to do
1692}
1693
1694// XPropertyState
1695
1696const SfxItemPropertyMap& ScCellRangesBase::GetItemPropertyMap()
1697{
1698 return pPropSet->getPropertyMap();
1699}
1700
1702 sal_uInt16& rItemWhich )
1703{
1704 // Which-ID of the affected items also when the item can't handle
1705 // the property by itself
1706 if ( !pEntry )
1707 return;
1708
1709 if ( IsScItemWid( pEntry->nWID ) )
1710 rItemWhich = pEntry->nWID;
1711 else
1712 switch ( pEntry->nWID )
1713 {
1714 case SC_WID_UNO_TBLBORD:
1716 rItemWhich = ATTR_BORDER;
1717 break;
1718 case SC_WID_UNO_CONDFMT:
1719 case SC_WID_UNO_CONDLOC:
1720 case SC_WID_UNO_CONDXML:
1721 rItemWhich = ATTR_CONDITIONAL;
1722 break;
1723 case SC_WID_UNO_VALIDAT:
1724 case SC_WID_UNO_VALILOC:
1725 case SC_WID_UNO_VALIXML:
1726 rItemWhich = ATTR_VALIDDATA;
1727 break;
1728 }
1729
1730}
1731
1732beans::PropertyState ScCellRangesBase::GetOnePropertyState( sal_uInt16 nItemWhich, const SfxItemPropertyMapEntry* pEntry )
1733{
1734 beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE;
1735 if ( nItemWhich ) // item wid (from map or special case)
1736 {
1737 // For items that contain several properties (like background),
1738 // "ambiguous" is returned too often here
1739
1740 // for PropertyState, don't look at styles
1741 const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
1742 if ( pPattern )
1743 {
1744 SfxItemState eState = pPattern->GetItemSet().GetItemState( nItemWhich, false );
1745
1746 if ( nItemWhich == ATTR_VALUE_FORMAT && eState == SfxItemState::DEFAULT )
1747 eState = pPattern->GetItemSet().GetItemState( ATTR_LANGUAGE_FORMAT, false );
1748
1749 if ( eState == SfxItemState::SET )
1750 eRet = beans::PropertyState_DIRECT_VALUE;
1751 else if ( eState == SfxItemState::DEFAULT )
1752 eRet = beans::PropertyState_DEFAULT_VALUE;
1753 else if ( eState == SfxItemState::DONTCARE )
1754 eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1755 else
1756 {
1757 OSL_FAIL("unknown ItemState");
1758 }
1759 }
1760 }
1761 else if ( pEntry )
1762 {
1763 if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR || pEntry->nWID == SC_WID_UNO_CHROWHDR || pEntry->nWID == SC_WID_UNO_ABSNAME )
1764 eRet = beans::PropertyState_DIRECT_VALUE;
1765 else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
1766 {
1767 // a style is always set, there's no default state
1768 const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData());
1769 if (pStyle)
1770 eRet = beans::PropertyState_DIRECT_VALUE;
1771 else
1772 eRet = beans::PropertyState_AMBIGUOUS_VALUE;
1773 }
1774 else if ( pEntry->nWID == SC_WID_UNO_NUMRULES )
1775 eRet = beans::PropertyState_DEFAULT_VALUE; // numbering rules are always default
1776 }
1777 return eRet;
1778}
1779
1780beans::PropertyState SAL_CALL ScCellRangesBase::getPropertyState( const OUString& aPropertyName )
1781{
1782 SolarMutexGuard aGuard;
1783 if ( aRanges.empty() )
1784 throw uno::RuntimeException();
1785
1786 const SfxItemPropertyMap& rMap = GetItemPropertyMap(); // from derived class
1787 sal_uInt16 nItemWhich = 0;
1788 const SfxItemPropertyMapEntry* pEntry = rMap.getByName( aPropertyName );
1789 lcl_GetPropertyWhich( pEntry, nItemWhich );
1790 return GetOnePropertyState( nItemWhich, pEntry );
1791}
1792
1793uno::Sequence<beans::PropertyState> SAL_CALL ScCellRangesBase::getPropertyStates(
1794 const uno::Sequence<OUString>& aPropertyNames )
1795{
1796 SolarMutexGuard aGuard;
1797
1798 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
1799
1800 uno::Sequence<beans::PropertyState> aRet(aPropertyNames.getLength());
1801 std::transform(aPropertyNames.begin(), aPropertyNames.end(), aRet.getArray(),
1802 [this, &rPropertyMap](const auto& rName) -> beans::PropertyState {
1803 sal_uInt16 nItemWhich = 0;
1804 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( rName );
1805 lcl_GetPropertyWhich( pEntry, nItemWhich );
1806 return GetOnePropertyState(nItemWhich, pEntry);
1807 });
1808 return aRet;
1809}
1810
1811void SAL_CALL ScCellRangesBase::setPropertyToDefault( const OUString& aPropertyName )
1812{
1813 SolarMutexGuard aGuard;
1814 if ( !pDocShell )
1815 return;
1816
1817 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
1818 sal_uInt16 nItemWhich = 0;
1819 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyName );
1820 lcl_GetPropertyWhich( pEntry, nItemWhich );
1821 if ( nItemWhich ) // item wid (from map or special case)
1822 {
1823 if ( !aRanges.empty() ) // empty = nothing to do
1824 {
1828
1829 sal_uInt16 aWIDs[3];
1830 aWIDs[0] = nItemWhich;
1831 if ( nItemWhich == ATTR_VALUE_FORMAT )
1832 {
1833 aWIDs[1] = ATTR_LANGUAGE_FORMAT; // language for number formats
1834 aWIDs[2] = 0;
1835 }
1836 else
1837 aWIDs[1] = 0;
1838 pDocShell->GetDocFunc().ClearItems( *GetMarkData(), aWIDs, true );
1839 }
1840 }
1841 else if ( pEntry )
1842 {
1843 if ( pEntry->nWID == SC_WID_UNO_CHCOLHDR )
1844 bChartColAsHdr = false;
1845 else if ( pEntry->nWID == SC_WID_UNO_CHROWHDR )
1846 bChartRowAsHdr = false;
1847 else if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
1848 {
1849 OUString aStyleName( ScResId( STR_STYLENAME_STANDARD ) );
1850 pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aStyleName, true );
1851 }
1852 }
1853}
1854
1855uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropertyName )
1856{
1858
1859 SolarMutexGuard aGuard;
1860 uno::Any aAny;
1861
1862 if ( pDocShell )
1863 {
1864 ScDocument& rDoc = pDocShell->GetDocument();
1865 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
1866 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyName );
1867 if ( pEntry )
1868 {
1869 if ( IsScItemWid( pEntry->nWID ) )
1870 {
1871 const ScPatternAttr* pPattern = rDoc.GetDefPattern();
1872 if ( pPattern )
1873 {
1874 const SfxItemSet& rSet = pPattern->GetItemSet();
1875
1876 switch ( pEntry->nWID ) // for item-specific handling
1877 {
1878 case ATTR_VALUE_FORMAT:
1879 // default has no language set
1880 aAny <<= static_cast<sal_Int32>( static_cast<const SfxUInt32Item&>(rSet.Get(pEntry->nWID)).GetValue() );
1881 break;
1882 case ATTR_INDENT:
1883 aAny <<= static_cast<sal_Int16>( convertTwipToMm100(static_cast<const ScIndentItem&>(
1884 rSet.Get(pEntry->nWID)).GetValue()) );
1885 break;
1886 default:
1887 pPropSet->getPropertyValue(aPropertyName, rSet, aAny);
1888 }
1889 }
1890 }
1891 else
1892 switch ( pEntry->nWID )
1893 {
1896 aAny <<= false;
1897 break;
1900 ScResId(STR_STYLENAME_STANDARD), SfxStyleFamily::Para );
1901 break;
1902 case SC_WID_UNO_TBLBORD:
1904 {
1905 const ScPatternAttr* pPattern = rDoc.GetDefPattern();
1906 if ( pPattern )
1907 {
1908 if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
1910 pPattern->GetItem(ATTR_BORDER),
1911 pPattern->GetItem(ATTR_BORDER_INNER) );
1912 else
1914 pPattern->GetItem(ATTR_BORDER),
1915 pPattern->GetItem(ATTR_BORDER_INNER) );
1916 }
1917 }
1918 break;
1919 case SC_WID_UNO_CONDFMT:
1920 case SC_WID_UNO_CONDLOC:
1921 case SC_WID_UNO_CONDXML:
1922 {
1923 bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
1924 bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
1925 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
1926 rDoc.GetStorageGrammar() :
1928
1929 aAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
1930 new ScTableConditionalFormat( &rDoc, 0, aRanges[0].aStart.Tab(), eGrammar ));
1931 }
1932 break;
1933 case SC_WID_UNO_VALIDAT:
1934 case SC_WID_UNO_VALILOC:
1935 case SC_WID_UNO_VALIXML:
1936 {
1937 bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
1938 bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
1939 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
1940 rDoc.GetStorageGrammar() :
1942
1943 aAny <<= uno::Reference<beans::XPropertySet>(
1944 new ScTableValidationObj( rDoc, 0, eGrammar ));
1945 }
1946 break;
1948 {
1950 }
1951 break;
1952 }
1953 }
1954 }
1955
1956 return aAny;
1957}
1958
1959// XPropertySet
1960
1961uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangesBase::getPropertySetInfo()
1962{
1963 SolarMutexGuard aGuard;
1964 static uno::Reference<beans::XPropertySetInfo> aRef(
1965 new SfxItemPropertySetInfo( pPropSet->getPropertyMap() ));
1966 return aRef;
1967}
1968
1969static void lcl_SetCellProperty( const SfxItemPropertyMapEntry& rEntry, const uno::Any& rValue,
1970 ScPatternAttr& rPattern, const ScDocument &rDoc,
1971 sal_uInt16& rFirstItemId, sal_uInt16& rSecondItemId )
1972{
1973 rFirstItemId = rEntry.nWID;
1974 rSecondItemId = 0;
1975
1976 SfxItemSet& rSet = rPattern.GetItemSet();
1977 switch ( rEntry.nWID )
1978 {
1979 case ATTR_VALUE_FORMAT:
1980 {
1981 // language for number formats
1982 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
1983 sal_uLong nOldFormat = rSet.Get( ATTR_VALUE_FORMAT ).GetValue();
1984 LanguageType eOldLang = rSet.Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
1985 nOldFormat = pFormatter->GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
1986
1987 sal_Int32 nIntVal = 0;
1988 if ( !(rValue >>= nIntVal) )
1989 throw lang::IllegalArgumentException();
1990
1991 sal_uLong nNewFormat = static_cast<sal_uLong>(nIntVal);
1992 rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
1993
1994 const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat );
1995 LanguageType eNewLang =
1996 pNewEntry ? pNewEntry->GetLanguage() : LANGUAGE_DONTKNOW;
1997 if ( eNewLang != eOldLang && eNewLang != LANGUAGE_DONTKNOW )
1998 {
2000
2001 // if only language is changed,
2002 // don't touch number format attribute
2003 sal_uLong nNewMod = nNewFormat % SV_COUNTRY_LANGUAGE_OFFSET;
2004 if ( nNewMod == ( nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET ) &&
2006 {
2007 rFirstItemId = 0; // don't use ATTR_VALUE_FORMAT value
2008 }
2009
2010 rSecondItemId = ATTR_LANGUAGE_FORMAT;
2011 }
2012
2013 }
2014 break;
2015 case ATTR_INDENT:
2016 {
2017 sal_Int16 nIntVal = 0;
2018 if ( !(rValue >>= nIntVal) )
2019 throw lang::IllegalArgumentException();
2020
2022
2023 }
2024 break;
2025 case ATTR_ROTATE_VALUE:
2026 {
2027 sal_Int32 nRotVal = 0;
2028 if ( !(rValue >>= nRotVal) )
2029 throw lang::IllegalArgumentException();
2030
2031 // stored value is always between 0 and 360 deg.
2032 nRotVal %= 36000;
2033 if ( nRotVal < 0 )
2034 nRotVal += 36000;
2035
2036 rSet.Put( ScRotateValueItem( Degree100(nRotVal) ) );
2037
2038 }
2039 break;
2040 case ATTR_STACKED:
2041 {
2042 table::CellOrientation eOrient;
2043 if( rValue >>= eOrient )
2044 {
2045 switch( eOrient )
2046 {
2047 case table::CellOrientation_STANDARD:
2048 rSet.Put( ScVerticalStackCell( false ) );
2049 break;
2050 case table::CellOrientation_TOPBOTTOM:
2051 rSet.Put( ScVerticalStackCell( false ) );
2052 rSet.Put( ScRotateValueItem( 27000_deg100 ) );
2053 rSecondItemId = ATTR_ROTATE_VALUE;
2054 break;
2055 case table::CellOrientation_BOTTOMTOP:
2056 rSet.Put( ScVerticalStackCell( false ) );
2057 rSet.Put( ScRotateValueItem( 9000_deg100 ) );
2058 rSecondItemId = ATTR_ROTATE_VALUE;
2059 break;
2060 case table::CellOrientation_STACKED:
2061 rSet.Put( ScVerticalStackCell( true ) );
2062 break;
2063 default:
2064 {
2065 // added to avoid warnings
2066 }
2067 }
2068 }
2069 }
2070 break;
2071 default:
2072 {
2073 lcl_GetCellsPropertySet()->setPropertyValue(rEntry, rValue, rSet);
2074 }
2075 }
2076}
2077
2078void SAL_CALL ScCellRangesBase::setPropertyValue(
2079 const OUString& aPropertyName, const uno::Any& aValue )
2080{
2081 SolarMutexGuard aGuard;
2082
2083 if ( !pDocShell || aRanges.empty() )
2084 throw uno::RuntimeException();
2085
2086 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2087 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyName );
2088 if ( !pEntry )
2089 throw beans::UnknownPropertyException(aPropertyName);
2090
2091 SetOnePropertyValue( pEntry, aValue );
2092}
2093
2094void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry, const uno::Any& aValue )
2095{
2096 if ( !pEntry )
2097 return;
2098
2099 if ( IsScItemWid( pEntry->nWID ) )
2100 {
2101 if ( !aRanges.empty() ) // empty = nothing to do
2102 {
2103 ScDocument& rDoc = pDocShell->GetDocument();
2104
2105 // For parts of compound items with multiple properties (e.g. background)
2106 // the old item has to be first fetched from the document.
2110 // ClearInvalidItems, so that in any case we have an item with the correct type
2111
2112 ScPatternAttr aPattern( *GetCurrentAttrsDeep() );
2113 SfxItemSet& rSet = aPattern.GetItemSet();
2115
2116 sal_uInt16 nFirstItem, nSecondItem;
2117 lcl_SetCellProperty( *pEntry, aValue, aPattern, rDoc, nFirstItem, nSecondItem );
2118
2119 for (sal_uInt16 nWhich = ATTR_PATTERN_START; nWhich <= ATTR_PATTERN_END; nWhich++)
2120 if ( nWhich != nFirstItem && nWhich != nSecondItem )
2121 rSet.ClearItem(nWhich);
2122
2123 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true );
2124 }
2125 }
2126 else // implemented here
2127 switch ( pEntry->nWID )
2128 {
2129 case EE_CHAR_ESCAPEMENT: // Specifically for xlsx import
2130 {
2131 sal_Int32 nValue = 0;
2132 aValue >>= nValue;
2133 if (nValue)
2134 {
2135 for (size_t i = 0, n = aRanges.size(); i < n; ++i)
2136 {
2137 ScRange const & rRange = aRanges[i];
2138
2139 /* TODO: Iterate through the range */
2140 ScAddress aAddr = rRange.aStart;
2141 ScDocument& rDoc = pDocShell->GetDocument();
2142 ScRefCellValue aCell(rDoc, aAddr);
2143
2144 OUString aStr = aCell.getString(&rDoc);
2145 EditEngine aEngine( rDoc.GetEnginePool() );
2146 aEngine.SetEditTextObjectPool(rDoc.GetEditPool());
2147
2148 /* EE_CHAR_ESCAPEMENT seems to be set on the cell _only_ when
2149 * there are no other attribs for the cell.
2150 * So, it is safe to overwrite the complete attribute set.
2151 * If there is a need - getting CellType and processing
2152 * the attributes could be considered.
2153 */
2154 SfxItemSet aAttr = aEngine.GetEmptyItemSet();
2155 aEngine.SetText(aStr);
2156 if( nValue < 0 ) // Subscript
2157 aAttr.Put( SvxEscapementItem( SvxEscapement::Subscript, EE_CHAR_ESCAPEMENT ) );
2158 else // Superscript
2159 aAttr.Put( SvxEscapementItem( SvxEscapement::Superscript, EE_CHAR_ESCAPEMENT ) );
2160 aEngine.QuickSetAttribs(aAttr, ESelection(0, 0, 0, aStr.getLength()));
2161
2162 // The cell will own the text object instance.
2163 rDoc.SetEditText(aRanges[0].aStart, aEngine.CreateTextObject());
2164 }
2165 }
2166 }
2167 break;
2169 // chart header flags are set for this object, not stored with document
2170 bChartColAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2171 break;
2173 bChartRowAsHdr = ScUnoHelpFunctions::GetBoolFromAny( aValue );
2174 break;
2176 {
2177 OUString aStrVal;
2178 aValue >>= aStrVal;
2180 aStrVal, SfxStyleFamily::Para ));
2181 pDocShell->GetDocFunc().ApplyStyle( *GetMarkData(), aString, true );
2182 }
2183 break;
2184 case SC_WID_UNO_TBLBORD:
2185 {
2186 table::TableBorder aBorder;
2187 if ( !aRanges.empty() && ( aValue >>= aBorder ) ) // empty = nothing to do
2188 {
2189 SvxBoxItem aOuter(ATTR_BORDER);
2191 ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder );
2192
2193 ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner );
2194 }
2195 }
2196 break;
2198 {
2199 table::TableBorder2 aBorder2;
2200 if ( !aRanges.empty() && ( aValue >>= aBorder2 ) ) // empty = nothing to do
2201 {
2202 SvxBoxItem aOuter(ATTR_BORDER);
2204 ScHelperFunctions::FillBoxItems( aOuter, aInner, aBorder2 );
2205
2206 ScHelperFunctions::ApplyBorder( pDocShell, aRanges, aOuter, aInner );
2207 }
2208 }
2209 break;
2210 case SC_WID_UNO_CONDFMT:
2211 case SC_WID_UNO_CONDLOC:
2212 case SC_WID_UNO_CONDXML:
2213 {
2214 uno::Reference<sheet::XSheetConditionalEntries> xInterface(aValue, uno::UNO_QUERY);
2215 if ( !aRanges.empty() && xInterface.is() ) // empty = nothing to do
2216 {
2217 ScTableConditionalFormat* pFormat =
2218 dynamic_cast<ScTableConditionalFormat*>( xInterface.get() );
2219 if (pFormat)
2220 {
2221 ScDocument& rDoc = pDocShell->GetDocument();
2222 bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2223 bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2224 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2227
2228 SCTAB nTab = aRanges.front().aStart.Tab();
2229 // To remove conditional formats for all cells in aRanges we need to:
2230 // Remove conditional format data from cells' attributes
2231 rDoc.RemoveCondFormatData( aRanges, nTab, 0 );
2232 // And also remove ranges from conditional formats list
2233 for (size_t i = 0; i < aRanges.size(); ++i)
2234 {
2235 rDoc.GetCondFormList( aRanges[i].aStart.Tab() )->DeleteArea(
2236 aRanges[i].aStart.Col(), aRanges[i].aStart.Row(),
2237 aRanges[i].aEnd.Col(), aRanges[i].aEnd.Row() );
2238 }
2239
2240 // Then we can apply new conditional format if there is one
2241 if (pFormat->getCount())
2242 {
2243 auto pNew = std::make_unique<ScConditionalFormat>( 0, &rDoc ); // Index will be set on inserting
2244 pFormat->FillFormat( *pNew, rDoc, eGrammar );
2245 pNew->SetRange( aRanges );
2246 pDocShell->GetDocFunc().ReplaceConditionalFormat( 0, std::move(pNew), nTab, aRanges );
2247 }
2248
2249 // and repaint
2250 for (size_t i = 0; i < aRanges.size(); ++i)
2251 pDocShell->PostPaint(aRanges[i], PaintPartFlags::Grid);
2252 pDocShell->SetDocumentModified();
2253 }
2254 }
2255 }
2256 break;
2257 case SC_WID_UNO_VALIDAT:
2258 case SC_WID_UNO_VALILOC:
2259 case SC_WID_UNO_VALIXML:
2260 {
2261 uno::Reference<beans::XPropertySet> xInterface(aValue, uno::UNO_QUERY);
2262 if ( !aRanges.empty() && xInterface.is() ) // empty = nothing to do
2263 {
2264 ScTableValidationObj* pValidObj =
2265 dynamic_cast<ScTableValidationObj*>( xInterface.get() );
2266 if (pValidObj)
2267 {
2268 ScDocument& rDoc = pDocShell->GetDocument();
2269 bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2270 bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2271 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2274
2275 std::unique_ptr<ScValidationData> pNewData(
2276 pValidObj->CreateValidationData( rDoc, eGrammar ));
2277 sal_uInt32 nIndex = rDoc.AddValidationEntry( *pNewData );
2278 pNewData.reset();
2279
2280 ScPatternAttr aPattern( rDoc.GetPool() );
2281 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALIDDATA, nIndex ) );
2282 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), aPattern, true );
2283 }
2284 }
2285 }
2286 break;
2287 // SC_WID_UNO_NUMRULES is ignored...
2288 }
2289}
2290
2291uno::Any SAL_CALL ScCellRangesBase::getPropertyValue( const OUString& aPropertyName )
2292{
2293 SolarMutexGuard aGuard;
2294
2295 if ( !pDocShell || aRanges.empty() )
2296 throw uno::RuntimeException();
2297
2298 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2299 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyName );
2300 if ( !pEntry )
2301 throw beans::UnknownPropertyException(aPropertyName);
2302
2303 uno::Any aAny;
2304 GetOnePropertyValue( pEntry, aAny );
2305 return aAny;
2306}
2307
2308void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertyMapEntry* pEntry, uno::Any& rAny )
2309{
2310 if ( !pEntry )
2311 return;
2312
2313 if ( IsScItemWid( pEntry->nWID ) )
2314 {
2315 SfxItemSet* pDataSet = GetCurrentDataSet();
2316 if ( pDataSet )
2317 {
2318 switch ( pEntry->nWID ) // for special handling of items
2319 {
2320 case ATTR_VALUE_FORMAT:
2321 {
2322 ScDocument& rDoc = pDocShell->GetDocument();
2323
2324 sal_uLong nOldFormat =
2325 pDataSet->Get( ATTR_VALUE_FORMAT ).GetValue();
2326 LanguageType eOldLang =
2327 pDataSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage();
2328 nOldFormat = rDoc.GetFormatTable()->
2329 GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang );
2330 rAny <<= static_cast<sal_Int32>(nOldFormat);
2331 }
2332 break;
2333 case ATTR_INDENT:
2334 rAny <<= static_cast<sal_Int16>( convertTwipToMm100(static_cast<const ScIndentItem&>(
2335 pDataSet->Get(pEntry->nWID)).GetValue()) );
2336 break;
2337 case ATTR_STACKED:
2338 {
2339 Degree100 nRot = pDataSet->Get(ATTR_ROTATE_VALUE).GetValue();
2340 bool bStacked = static_cast<const ScVerticalStackCell&>(pDataSet->Get(pEntry->nWID)).GetValue();
2342 }
2343 break;
2344 default:
2345 pPropSet->getPropertyValue(*pEntry, *pDataSet, rAny);
2346 }
2347 }
2348 }
2349 else // implemented here
2350 switch ( pEntry->nWID )
2351 {
2353 rAny <<= bChartColAsHdr;
2354 break;
2356 rAny <<= bChartRowAsHdr;
2357 break;
2359 {
2360 OUString aStyleName;
2361 const ScStyleSheet* pStyle = pDocShell->GetDocument().GetSelectionStyle(*GetMarkData());
2362 if (pStyle)
2363 aStyleName = pStyle->GetName();
2365 aStyleName, SfxStyleFamily::Para );
2366 }
2367 break;
2368 case SC_WID_UNO_TBLBORD:
2370 {
2372 if ( !aRanges.empty() )
2373 {
2374 const ScRange & rFirst = aRanges[ 0 ];
2375 SvxBoxItem aOuter(ATTR_BORDER);
2377
2378 ScDocument& rDoc = pDocShell->GetDocument();
2379 ScMarkData aMark(rDoc.GetSheetLimits());
2380 aMark.SetMarkArea( rFirst );
2381 aMark.SelectTable( rFirst.aStart.Tab(), true );
2382 rDoc.GetSelectionFrame( aMark, aOuter, aInner );
2383
2384 if (pEntry->nWID == SC_WID_UNO_TBLBORD2)
2385 ScHelperFunctions::AssignTableBorder2ToAny( rAny, aOuter, aInner);
2386 else
2387 ScHelperFunctions::AssignTableBorderToAny( rAny, aOuter, aInner);
2388 }
2389 }
2390 break;
2391 case SC_WID_UNO_CONDFMT:
2392 case SC_WID_UNO_CONDLOC:
2393 case SC_WID_UNO_CONDXML:
2394 {
2395 const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
2396 if ( pPattern )
2397 {
2398 ScDocument& rDoc = pDocShell->GetDocument();
2399 bool bEnglish = ( pEntry->nWID != SC_WID_UNO_CONDLOC );
2400 bool bXML = ( pEntry->nWID == SC_WID_UNO_CONDXML );
2401 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2402 rDoc.GetStorageGrammar() :
2404 const ScCondFormatIndexes& rIndex =
2405 pPattern->GetItem(ATTR_CONDITIONAL).GetCondFormatData();
2406 sal_uLong nIndex = 0;
2407 if(!rIndex.empty())
2408 nIndex = rIndex[0];
2409 rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
2410 new ScTableConditionalFormat( &rDoc, nIndex, aRanges.front().aStart.Tab(), eGrammar ));
2411 }
2412 }
2413 break;
2414 case SC_WID_UNO_VALIDAT:
2415 case SC_WID_UNO_VALILOC:
2416 case SC_WID_UNO_VALIXML:
2417 {
2418 const ScPatternAttr* pPattern = GetCurrentAttrsDeep();
2419 if ( pPattern )
2420 {
2421 ScDocument& rDoc = pDocShell->GetDocument();
2422 bool bEnglish = ( pEntry->nWID != SC_WID_UNO_VALILOC );
2423 bool bXML = ( pEntry->nWID == SC_WID_UNO_VALIXML );
2424 formula::FormulaGrammar::Grammar eGrammar = (bXML ?
2425 rDoc.GetStorageGrammar() :
2428 pPattern->GetItem(ATTR_VALIDDATA).GetValue();
2429 rAny <<= uno::Reference<beans::XPropertySet>(
2430 new ScTableValidationObj( rDoc, nIndex, eGrammar ));
2431 }
2432 }
2433 break;
2435 {
2436 // always return empty numbering rules object
2438 }
2439 break;
2440 case SC_WID_UNO_ABSNAME:
2441 {
2442 OUString sRet;
2443 aRanges.Format(sRet, ScRefFlags::RANGE_ABS_3D, pDocShell->GetDocument());
2444 rAny <<= sRet;
2445 }
2446 break;
2448 {
2449 const ScPatternAttr* pPattern = GetCurrentAttrsFlat();
2450 rAny <<= pPattern->GetKey();
2451 }
2452 break;
2453 }
2454}
2455
2456void SAL_CALL ScCellRangesBase::addPropertyChangeListener( const OUString& /* aPropertyName */,
2457 const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
2458{
2459 SolarMutexGuard aGuard;
2460 if ( aRanges.empty() )
2461 throw uno::RuntimeException();
2462
2463 OSL_FAIL("not implemented");
2464}
2465
2466void SAL_CALL ScCellRangesBase::removePropertyChangeListener( const OUString& /* aPropertyName */,
2467 const uno::Reference<beans::XPropertyChangeListener>& /* aListener */)
2468{
2469 SolarMutexGuard aGuard;
2470 if ( aRanges.empty() )
2471 throw uno::RuntimeException();
2472
2473 OSL_FAIL("not implemented");
2474}
2475
2476void SAL_CALL ScCellRangesBase::addVetoableChangeListener( const OUString&,
2477 const uno::Reference<beans::XVetoableChangeListener>&)
2478{
2479 OSL_FAIL("not implemented");
2480}
2481
2482void SAL_CALL ScCellRangesBase::removeVetoableChangeListener( const OUString&,
2483 const uno::Reference<beans::XVetoableChangeListener>&)
2484{
2485 OSL_FAIL("not implemented");
2486}
2487
2488// XMultiPropertySet
2489
2490void SAL_CALL ScCellRangesBase::setPropertyValues( const uno::Sequence< OUString >& aPropertyNames,
2491 const uno::Sequence< uno::Any >& aValues )
2492{
2493 SolarMutexGuard aGuard;
2494
2495 sal_Int32 nCount(aPropertyNames.getLength());
2496 sal_Int32 nValues(aValues.getLength());
2497 if (nCount != nValues)
2498 throw lang::IllegalArgumentException();
2499
2500 if ( !(pDocShell && nCount) )
2501 return;
2502
2503 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2504 const OUString* pNames = aPropertyNames.getConstArray();
2505 const uno::Any* pValues = aValues.getConstArray();
2506
2507 std::unique_ptr<const SfxItemPropertyMapEntry*[]> pEntryArray(new const SfxItemPropertyMapEntry*[nCount]);
2508
2509 sal_Int32 i;
2510 for(i = 0; i < nCount; i++)
2511 {
2512 // first loop: find all properties in map, but handle only CellStyle
2513 // (CellStyle must be set before any other cell properties)
2514
2515 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( pNames[i] );
2516 pEntryArray[i] = pEntry;
2517 if (pEntry)
2518 {
2519 if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2520 {
2521 try
2522 {
2523 SetOnePropertyValue( pEntry, pValues[i] );
2524 }
2525 catch ( lang::IllegalArgumentException& )
2526 {
2527 TOOLS_WARN_EXCEPTION( "sc", "exception when setting cell style"); // not supposed to happen
2528 }
2529 }
2530 }
2531 }
2532
2533 ScDocument& rDoc = pDocShell->GetDocument();
2534 std::unique_ptr<ScPatternAttr> pOldPattern;
2535 std::unique_ptr<ScPatternAttr> pNewPattern;
2536
2537 for(i = 0; i < nCount; i++)
2538 {
2539 // second loop: handle other properties
2540
2541 const SfxItemPropertyMapEntry* pEntry = pEntryArray[i];
2542 if ( pEntry )
2543 {
2544 if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
2545 {
2546 if ( !pOldPattern )
2547 {
2548 pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() ));
2549 pOldPattern->GetItemSet().ClearInvalidItems();
2550 pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() ));
2551 }
2552
2553 // collect items in pNewPattern, apply with one call after the loop
2554
2555 sal_uInt16 nFirstItem, nSecondItem;
2556 lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
2557
2558 // put only affected items into new set
2559 if ( nFirstItem )
2560 pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
2561 if ( nSecondItem )
2562 pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
2563 }
2564 else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
2565 {
2566 // call virtual method to set a single property
2567 SetOnePropertyValue( pEntry, pValues[i] );
2568 }
2569 }
2570 }
2571
2572 if ( pNewPattern && !aRanges.empty() )
2573 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, true );
2574}
2575
2576uno::Sequence<uno::Any> SAL_CALL ScCellRangesBase::getPropertyValues(
2577 const uno::Sequence< OUString >& aPropertyNames )
2578{
2579 SolarMutexGuard aGuard;
2580
2581 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2582
2583 uno::Sequence<uno::Any> aRet(aPropertyNames.getLength());
2584 uno::Any* pProperties = aRet.getArray();
2585 for(sal_Int32 i = 0; i < aPropertyNames.getLength(); i++)
2586 {
2587 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
2588 GetOnePropertyValue( pEntry, pProperties[i] );
2589 }
2590 return aRet;
2591}
2592
2593void SAL_CALL ScCellRangesBase::addPropertiesChangeListener( const uno::Sequence< OUString >& /* aPropertyNames */,
2594 const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2595{
2596 OSL_FAIL("not implemented");
2597}
2598
2599void SAL_CALL ScCellRangesBase::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2600{
2601 OSL_FAIL("not implemented");
2602}
2603
2604void SAL_CALL ScCellRangesBase::firePropertiesChangeEvent( const uno::Sequence< OUString >& /* aPropertyNames */,
2605 const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
2606{
2607 OSL_FAIL("not implemented");
2608}
2609
2610IMPL_LINK( ScCellRangesBase, ValueListenerHdl, const SfxHint&, rHint, void )
2611{
2612 if ( pDocShell && (rHint.GetId() == SfxHintId::ScDataChanged))
2613 {
2614 // This may be called several times for a single change, if several formulas
2615 // in the range are notified. So only a flag is set that is checked when
2616 // SfxHintId::DataChanged is received.
2617
2618 bGotDataChangedHint = true;
2619 }
2620}
2621
2622// XTolerantMultiPropertySet
2623uno::Sequence< beans::SetPropertyTolerantFailed > SAL_CALL ScCellRangesBase::setPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames,
2624 const uno::Sequence< uno::Any >& aValues )
2625{
2626 SolarMutexGuard aGuard;
2627
2628 sal_Int32 nCount(aPropertyNames.getLength());
2629 sal_Int32 nValues(aValues.getLength());
2630 if (nCount != nValues)
2631 throw lang::IllegalArgumentException();
2632
2633 if ( pDocShell && nCount )
2634 {
2635 uno::Sequence < beans::SetPropertyTolerantFailed > aReturns(nCount);
2636 beans::SetPropertyTolerantFailed* pReturns = aReturns.getArray();
2637
2638 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2639 const OUString* pNames = aPropertyNames.getConstArray();
2640 const uno::Any* pValues = aValues.getConstArray();
2641
2642 std::unique_ptr<const SfxItemPropertyMapEntry*[]> pMapArray(new const SfxItemPropertyMapEntry*[nCount]);
2643
2644 sal_Int32 i;
2645 for(i = 0; i < nCount; i++)
2646 {
2647 // first loop: find all properties in map, but handle only CellStyle
2648 // (CellStyle must be set before any other cell properties)
2649
2650 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( pNames[i] );
2651 pMapArray[i] = pEntry;
2652 if (pEntry)
2653 {
2654 if ( pEntry->nWID == SC_WID_UNO_CELLSTYL )
2655 {
2656 try
2657 {
2658 SetOnePropertyValue( pEntry, pValues[i] );
2659 }
2660 catch ( lang::IllegalArgumentException& )
2661 {
2662 TOOLS_WARN_EXCEPTION( "sc", "exception when setting cell style"); // not supposed to happen
2663 }
2664 }
2665 }
2666 }
2667
2668 ScDocument& rDoc = pDocShell->GetDocument();
2669 std::unique_ptr<ScPatternAttr> pOldPattern;
2670 std::unique_ptr<ScPatternAttr> pNewPattern;
2671
2672 sal_Int32 nFailed(0);
2673 for(i = 0; i < nCount; i++)
2674 {
2675 // second loop: handle other properties
2676
2677 const SfxItemPropertyMapEntry* pEntry = pMapArray[i];
2678 if ( pEntry && ((pEntry->nFlags & beans::PropertyAttribute::READONLY) == 0))
2679 {
2680 if ( IsScItemWid( pEntry->nWID ) ) // can be handled by SfxItemPropertySet
2681 {
2682 if ( !pOldPattern )
2683 {
2684 pOldPattern.reset(new ScPatternAttr( *GetCurrentAttrsDeep() ));
2685 pOldPattern->GetItemSet().ClearInvalidItems();
2686 pNewPattern.reset(new ScPatternAttr( rDoc.GetPool() ));
2687 }
2688
2689 // collect items in pNewPattern, apply with one call after the loop
2690 try
2691 {
2692 sal_uInt16 nFirstItem, nSecondItem;
2693 lcl_SetCellProperty( *pEntry, pValues[i], *pOldPattern, rDoc, nFirstItem, nSecondItem );
2694
2695 // put only affected items into new set
2696 if ( nFirstItem )
2697 pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nFirstItem ) );
2698 if ( nSecondItem )
2699 pNewPattern->GetItemSet().Put( pOldPattern->GetItemSet().Get( nSecondItem ) );
2700 }
2701 catch ( lang::IllegalArgumentException& )
2702 {
2703 pReturns[nFailed].Name = pNames[i];
2704 pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
2705 }
2706 }
2707 else if ( pEntry->nWID != SC_WID_UNO_CELLSTYL ) // CellStyle is handled above
2708 {
2709 // call virtual method to set a single property
2710 try
2711 {
2712 SetOnePropertyValue( pEntry, pValues[i] );
2713 }
2714 catch ( lang::IllegalArgumentException& )
2715 {
2716 pReturns[nFailed].Name = pNames[i];
2717 pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::ILLEGAL_ARGUMENT;
2718 }
2719 }
2720 }
2721 else
2722 {
2723 pReturns[nFailed].Name = pNames[i];
2724 if (pEntry)
2725 pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::PROPERTY_VETO;
2726 else
2727 pReturns[nFailed++].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2728 }
2729 }
2730
2731 if ( pNewPattern && !aRanges.empty() )
2732 pDocShell->GetDocFunc().ApplyAttributes( *GetMarkData(), *pNewPattern, true );
2733
2734 aReturns.realloc(nFailed);
2735
2736 return aReturns;
2737 }
2738 return uno::Sequence < beans::SetPropertyTolerantFailed >();
2739}
2740
2741uno::Sequence< beans::GetPropertyTolerantResult > SAL_CALL ScCellRangesBase::getPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames )
2742{
2743 SolarMutexGuard aGuard;
2744
2745 sal_Int32 nCount(aPropertyNames.getLength());
2746 uno::Sequence < beans::GetPropertyTolerantResult > aReturns(nCount);
2747 beans::GetPropertyTolerantResult* pReturns = aReturns.getArray();
2748
2749 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2750
2751 for(sal_Int32 i = 0; i < nCount; i++)
2752 {
2753 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
2754 if (!pEntry)
2755 {
2756 pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2757 }
2758 else
2759 {
2760 sal_uInt16 nItemWhich = 0;
2761 lcl_GetPropertyWhich( pEntry, nItemWhich );
2762 pReturns[i].State = GetOnePropertyState( nItemWhich, pEntry );
2763 GetOnePropertyValue( pEntry, pReturns[i].Value );
2764 pReturns[i].Result = beans::TolerantPropertySetResultType::SUCCESS;
2765 }
2766 }
2767 return aReturns;
2768}
2769
2770uno::Sequence< beans::GetDirectPropertyTolerantResult > SAL_CALL ScCellRangesBase::getDirectPropertyValuesTolerant( const uno::Sequence< OUString >& aPropertyNames )
2771{
2772 SolarMutexGuard aGuard;
2773
2774 sal_Int32 nCount(aPropertyNames.getLength());
2775 uno::Sequence < beans::GetDirectPropertyTolerantResult > aReturns(nCount);
2776 beans::GetDirectPropertyTolerantResult* pReturns = aReturns.getArray();
2777
2778 const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class
2779
2780 sal_Int32 j = 0;
2781 for(sal_Int32 i = 0; i < nCount; i++)
2782 {
2783 const SfxItemPropertyMapEntry* pEntry = rPropertyMap.getByName( aPropertyNames[i] );
2784 if (!pEntry)
2785 {
2786 pReturns[i].Result = beans::TolerantPropertySetResultType::UNKNOWN_PROPERTY;
2787 }
2788 else
2789 {
2790 sal_uInt16 nItemWhich = 0;
2791 lcl_GetPropertyWhich( pEntry, nItemWhich );
2792 pReturns[j].State = GetOnePropertyState( nItemWhich, pEntry );
2793 if (pReturns[j].State == beans::PropertyState_DIRECT_VALUE)
2794 {
2795 GetOnePropertyValue( pEntry, pReturns[j].Value );
2796 pReturns[j].Result = beans::TolerantPropertySetResultType::SUCCESS;
2797 pReturns[j].Name = aPropertyNames[i];
2798 ++j;
2799 }
2800 }
2801 }
2802 if (j < nCount)
2803 aReturns.realloc(j);
2804 return aReturns;
2805}
2806
2807// XIndent
2808
2809void SAL_CALL ScCellRangesBase::decrementIndent()
2810{
2811 SolarMutexGuard aGuard;
2812 if ( pDocShell && !aRanges.empty() )
2813 {
2814 //#97041#; put only MultiMarked ScMarkData in ChangeIndent
2815 ScMarkData aMarkData(*GetMarkData());
2816 aMarkData.MarkToMulti();
2817 pDocShell->GetDocFunc().ChangeIndent( aMarkData, false, true );
2818 }
2819}
2820
2821void SAL_CALL ScCellRangesBase::incrementIndent()
2822{
2823 SolarMutexGuard aGuard;
2824 if ( pDocShell && !aRanges.empty() )
2825 {
2826 //#97041#; put only MultiMarked ScMarkData in ChangeIndent
2827 ScMarkData aMarkData(*GetMarkData());
2828 aMarkData.MarkToMulti();
2829 pDocShell->GetDocFunc().ChangeIndent( aMarkData, true, true );
2830 }
2831}
2832
2833// XChartData
2834
2835std::unique_ptr<ScMemChart> ScCellRangesBase::CreateMemChart_Impl() const
2836{
2837 if ( pDocShell && !aRanges.empty() )
2838 {
2839 ScRangeListRef xChartRanges;
2840 if ( aRanges.size() == 1 )
2841 {
2842 // set useful table limit (only occupied data area)
2843 // (only here - Listeners are registered for the whole area)
2845
2846 const ScDocument & rDoc = pDocShell->GetDocument();
2847 const ScRange & rRange = aRanges[0];
2848 if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() &&
2849 rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() )
2850 {
2851 SCTAB nTab = rRange.aStart.Tab();
2852
2853 SCCOL nStartX;
2854 SCROW nStartY; // Get start
2855 if (!pDocShell->GetDocument().GetDataStart( nTab, nStartX, nStartY ))
2856 {
2857 nStartX = 0;
2858 nStartY = 0;
2859 }
2860
2861 SCCOL nEndX;
2862 SCROW nEndY; // Get end
2863 if (!pDocShell->GetDocument().GetTableArea( nTab, nEndX, nEndY ))
2864 {
2865 nEndX = 0;
2866 nEndY = 0;
2867 }
2868
2869 xChartRanges = new ScRangeList( ScRange( nStartX, nStartY, nTab, nEndX, nEndY, nTab ) );
2870 }
2871 }
2872 if (!xChartRanges.is()) // otherwise take Ranges directly
2873 xChartRanges = new ScRangeList(aRanges);
2874 ScChartArray aArr( pDocShell->GetDocument(), xChartRanges );
2875
2876 // RowAsHdr = ColHeaders and vice versa
2877 aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr );
2878
2879 return aArr.CreateMemChart();
2880 }
2881 return nullptr;
2882}
2883
2884uno::Sequence< uno::Sequence<double> > SAL_CALL ScCellRangesBase::getData()
2885{
2886 SolarMutexGuard aGuard;
2887 std::unique_ptr<ScMemChart> pMemChart(CreateMemChart_Impl());
2888 if ( pMemChart )
2889 {
2890 sal_Int32 nColCount = pMemChart->GetColCount();
2891 sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
2892
2893 uno::Sequence< uno::Sequence<double> > aRowSeq( nRowCount );
2894 uno::Sequence<double>* pRowAry = aRowSeq.getArray();
2895 for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
2896 {
2897 uno::Sequence<double> aColSeq( nColCount );
2898 double* pColAry = aColSeq.getArray();
2899 for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
2900 pColAry[nCol] = pMemChart->GetData( nCol, nRow );
2901
2902 pRowAry[nRow] = aColSeq;
2903 }
2904
2905 return aRowSeq;
2906 }
2907
2908 return {};
2909}
2910
2911ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( sal_Int32 nDataColumns, sal_Int32 nDataRows ) const
2912{
2913 if ( aRanges.size() == 1 )
2914 {
2915 const ScDocument & rDoc = pDocShell->GetDocument();
2916 const ScRange & rRange = aRanges[0];
2917 if ( rRange.aStart.Col() == 0 && rRange.aEnd.Col() == rDoc.MaxCol() &&
2918 rRange.aStart.Row() == 0 && rRange.aEnd.Row() == rDoc.MaxRow() )
2919 {
2920 // if aRanges is a complete sheet, limit to given size
2921
2922 SCTAB nTab = rRange.aStart.Tab();
2923
2924 sal_Int32 nEndColumn = nDataColumns - 1 + ( bChartColAsHdr ? 1 : 0 );
2925 if ( nEndColumn < 0 )
2926 nEndColumn = 0;
2927 if ( nEndColumn > rDoc.MaxCol() )
2928 nEndColumn = rDoc.MaxCol();
2929
2930 sal_Int32 nEndRow = nDataRows - 1 + ( bChartRowAsHdr ? 1 : 0 );
2931 if ( nEndRow < 0 )
2932 nEndRow = 0;
2933 if ( nEndRow > rDoc.MaxRow() )
2934 nEndRow = rDoc.MaxRow();
2935
2936 ScRangeListRef xChartRanges = new ScRangeList( ScRange( 0, 0, nTab, static_cast<SCCOL>(nEndColumn), static_cast<SCROW>(nEndRow), nTab ) );
2937 return xChartRanges;
2938 }
2939 }
2940
2941 return new ScRangeList(aRanges); // as-is
2942}
2943
2944void SAL_CALL ScCellRangesBase::setData( const uno::Sequence< uno::Sequence<double> >& aData )
2945{
2946 SolarMutexGuard aGuard;
2947 bool bDone = false;
2948 sal_Int32 nRowCount = aData.getLength();
2949 sal_Int32 nColCount = nRowCount ? aData[0].getLength() : 0;
2950 ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, nRowCount );
2951 if ( pDocShell && xChartRanges.is() )
2952 {
2953 ScDocument& rDoc = pDocShell->GetDocument();
2954 ScChartArray aArr( rDoc, xChartRanges );
2955 aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
2956 const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
2957 if (pPosMap)
2958 {
2959 if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) &&
2960 pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
2961 {
2962 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
2963 {
2964 const uno::Sequence<double>& rRowSeq = aData[nRow];
2965 const double* pArray = rRowSeq.getConstArray();
2966 nColCount = rRowSeq.getLength();
2967 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
2968 {
2969 const ScAddress* pPos = pPosMap->GetPosition(
2970 sal::static_int_cast<SCCOL>(nCol),
2971 sal::static_int_cast<SCROW>(nRow) );
2972 if (pPos)
2973 {
2974 double fVal = pArray[nCol];
2975 if ( fVal == DBL_MIN )
2976 rDoc.SetEmptyCell(*pPos);
2977 else
2978 rDoc.SetValue(*pPos, pArray[nCol]);
2979 }
2980 }
2981 }
2982
2984 PaintGridRanges_Impl();
2985 pDocShell->SetDocumentModified();
2986 ForceChartListener_Impl(); // call listeners for this object synchronously
2987 bDone = true;
2988 }
2989 }
2990 }
2991
2992 if (!bDone)
2993 throw uno::RuntimeException();
2994}
2995
2996uno::Sequence<OUString> SAL_CALL ScCellRangesBase::getRowDescriptions()
2997{
2998 SolarMutexGuard aGuard;
2999 std::unique_ptr<ScMemChart> pMemChart(CreateMemChart_Impl());
3000 if ( pMemChart )
3001 {
3002 sal_Int32 nRowCount = static_cast<sal_Int32>(pMemChart->GetRowCount());
3003 uno::Sequence<OUString> aSeq( nRowCount );
3004 OUString* pAry = aSeq.getArray();
3005 for (sal_Int32 nRow = 0; nRow < nRowCount; nRow++)
3006 pAry[nRow] = pMemChart->GetRowText(nRow);
3007
3008 return aSeq;
3009 }
3010 return {};
3011}
3012
3013void SAL_CALL ScCellRangesBase::setRowDescriptions(
3014 const uno::Sequence<OUString>& aRowDescriptions )
3015{
3016 SolarMutexGuard aGuard;
3017 bool bDone = false;
3018 if ( bChartColAsHdr )
3019 {
3020 sal_Int32 nRowCount = aRowDescriptions.getLength();
3021 ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( 1, nRowCount );
3022 if ( pDocShell && xChartRanges.is() )
3023 {
3024 ScDocument& rDoc = pDocShell->GetDocument();
3025 ScChartArray aArr( rDoc, xChartRanges );
3026 aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3027 const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3028 if (pPosMap)
3029 {
3030 if ( pPosMap->GetRowCount() == static_cast<SCROW>(nRowCount) )
3031 {
3032 const OUString* pArray = aRowDescriptions.getConstArray();
3033 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
3034 {
3035 const ScAddress* pPos = pPosMap->GetRowHeaderPosition(
3036 static_cast<SCSIZE>(nRow) );
3037 if (pPos)
3038 {
3039 const OUString& aStr = pArray[nRow];
3040 if (aStr.isEmpty())
3041 rDoc.SetEmptyCell(*pPos);
3042 else
3043 {
3044 ScSetStringParam aParam;
3045 aParam.setTextInput();
3046 rDoc.SetString(*pPos, aStr, &aParam);
3047 }
3048 }
3049 }
3050
3052 PaintGridRanges_Impl();
3053 pDocShell->SetDocumentModified();
3054 ForceChartListener_Impl(); // call listeners for this object synchronously
3055 bDone = true;
3056 }
3057 }
3058 }
3059 }
3060
3061 if (!bDone)
3062 throw uno::RuntimeException();
3063}
3064
3065uno::Sequence<OUString> SAL_CALL ScCellRangesBase::getColumnDescriptions()
3066{
3067 SolarMutexGuard aGuard;
3068 std::unique_ptr<ScMemChart> pMemChart(CreateMemChart_Impl());
3069 if ( pMemChart )
3070 {
3071 sal_Int32 nColCount = pMemChart->GetColCount();
3072 uno::Sequence<OUString> aSeq( nColCount );
3073 OUString* pAry = aSeq.getArray();
3074 for (sal_Int32 nCol = 0; nCol < nColCount; nCol++)
3075 pAry[nCol] = pMemChart->GetColText(nCol);
3076
3077 return aSeq;
3078 }
3079 return {};
3080}
3081
3082void SAL_CALL ScCellRangesBase::setColumnDescriptions(
3083 const uno::Sequence<OUString>& aColumnDescriptions )
3084{
3085 SolarMutexGuard aGuard;
3086 bool bDone = false;
3087 if ( bChartRowAsHdr )
3088 {
3089 sal_Int32 nColCount = aColumnDescriptions.getLength();
3090 ScRangeListRef xChartRanges = GetLimitedChartRanges_Impl( nColCount, 1 );
3091 if ( pDocShell && xChartRanges.is() )
3092 {
3093 ScDocument& rDoc = pDocShell->GetDocument();
3094 ScChartArray aArr( rDoc, xChartRanges );
3095 aArr.SetHeaders( bChartRowAsHdr, bChartColAsHdr ); // RowAsHdr = ColHeaders
3096 const ScChartPositionMap* pPosMap = aArr.GetPositionMap();
3097 if (pPosMap)
3098 {
3099 if ( pPosMap->GetColCount() == static_cast<SCCOL>(nColCount) )
3100 {
3101 const OUString* pArray = aColumnDescriptions.getConstArray();
3102 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
3103 {
3104 const ScAddress* pPos = pPosMap->GetColHeaderPosition(
3105 sal::static_int_cast<SCCOL>(nCol) );
3106 if (pPos)
3107 {
3108 const OUString& aStr = pArray[nCol];
3109 if (aStr.isEmpty())
3110 rDoc.SetEmptyCell(*pPos);
3111 else
3112 {
3113 ScSetStringParam aParam;
3114 aParam.setTextInput();
3115 rDoc.SetString(*pPos, aStr, &aParam);
3116 }
3117 }
3118 }
3119
3121 PaintGridRanges_Impl();
3122 pDocShell->SetDocumentModified();
3123 ForceChartListener_Impl(); // call listeners for this object synchronously
3124 bDone = true;
3125 }
3126 }
3127 }
3128 }
3129
3130 if (!bDone)
3131 throw uno::RuntimeException();
3132}
3133
3134void ScCellRangesBase::ForceChartListener_Impl()
3135{
3136 // call Update immediately so the caller to setData etc. can
3137 // recognize the listener call
3138
3139 if (!pDocShell)
3140 return;
3141
3142 ScChartListenerCollection* pColl = pDocShell->GetDocument().GetChartListenerCollection();
3143 if (!pColl)
3144 return;
3145
3147 for (auto const& it : rListeners)
3148 {
3149 ScChartListener *const p = it.second.get();
3150 assert(p);
3151 if (p->GetUnoSource() == static_cast<chart::XChartData*>(this) && p->IsDirty())
3152 p->Update();
3153 }
3154}
3155
3156void SAL_CALL ScCellRangesBase::addChartDataChangeEventListener( const uno::Reference<
3157 chart::XChartDataChangeEventListener >& aListener )
3158{
3159 SolarMutexGuard aGuard;
3160 if ( !pDocShell || aRanges.empty() )
3161 return;
3162
3164
3165 ScDocument& rDoc = pDocShell->GetDocument();
3166 ScRangeListRef aRangesRef( new ScRangeList(aRanges) );
3168 OUString aName = pColl->getUniqueName(u"__Uno");
3169 if (aName.isEmpty())
3170 // failed to create unique name.
3171 return;
3172
3173 ScChartListener* pListener = new ScChartListener( aName, rDoc, aRangesRef );
3174 pListener->SetUno( aListener, this );
3175 pColl->insert( pListener );
3176 pListener->StartListeningTo();
3177}
3178
3179void SAL_CALL ScCellRangesBase::removeChartDataChangeEventListener( const uno::Reference<
3180 chart::XChartDataChangeEventListener >& aListener )
3181{
3182 SolarMutexGuard aGuard;
3183 if ( pDocShell && !aRanges.empty() )
3184 {
3185 ScDocument& rDoc = pDocShell->GetDocument();
3187 pColl->FreeUno( aListener, this );
3188 }
3189}
3190
3191double SAL_CALL ScCellRangesBase::getNotANumber()
3192{
3193 // use DBL_MIN in ScChartArray, because Chart wants it so
3194 return DBL_MIN;
3195}
3196
3197sal_Bool SAL_CALL ScCellRangesBase::isNotANumber( double nNumber )
3198{
3199 // use DBL_MIN in ScChartArray, because Chart wants it so
3200 return (nNumber == DBL_MIN);
3201}
3202
3203// XModifyBroadcaster
3204
3205void SAL_CALL ScCellRangesBase::addModifyListener(const uno::Reference<util::XModifyListener>& aListener)
3206{
3207 SolarMutexGuard aGuard;
3208 if ( aRanges.empty() )
3209 throw uno::RuntimeException();
3210
3211 aValueListeners.emplace_back( aListener );
3212
3213 if ( aValueListeners.size() == 1 )
3214 {
3215 if (!pValueListener)
3216 pValueListener.reset( new ScLinkListener( LINK( this, ScCellRangesBase, ValueListenerHdl ) ) );
3217
3218 ScDocument& rDoc = pDocShell->GetDocument();
3219 for ( size_t i = 0, nCount = aRanges.size(); i < nCount; i++)
3220 rDoc.StartListeningArea( aRanges[ i ], false, pValueListener.get() );
3221
3222 acquire(); // don't lose this object (one ref for all listeners)
3223 }
3224}
3225
3226void SAL_CALL ScCellRangesBase::removeModifyListener( const uno::Reference<util::XModifyListener>& aListener )
3227{
3228
3229 SolarMutexGuard aGuard;
3230 if ( aRanges.empty() )
3231 throw uno::RuntimeException();
3232
3233 rtl::Reference<ScCellRangesBase> xSelfHold(this); // in case the listeners have the last ref
3234
3235 sal_uInt16 nCount = aValueListeners.size();
3236 for ( sal_uInt16 n=nCount; n--; )
3237 {
3238 uno::Reference<util::XModifyListener>& rObj = aValueListeners[n];
3239 if ( rObj == aListener )
3240 {
3241 aValueListeners.erase( aValueListeners.begin() + n );
3242
3243 if ( aValueListeners.empty() )
3244 {
3245 if (pValueListener)
3246 pValueListener->EndListeningAll();
3247
3248 release(); // release the ref for the listeners
3249 }
3250
3251 break;
3252 }
3253 }
3254}
3255
3256// XCellRangesQuery
3257
3258uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryVisibleCells()
3259{
3260 SolarMutexGuard aGuard;
3261 if (pDocShell)
3262 {
3264 SCTAB nTab = lcl_FirstTab(aRanges);
3265
3266 ScMarkData aMarkData(*GetMarkData());
3267
3268 ScDocument& rDoc = pDocShell->GetDocument();
3269 SCCOL nCol = 0, nLastCol;
3270 while (nCol <= rDoc.MaxCol())
3271 {
3272 if (rDoc.ColHidden(nCol, nTab, nullptr, &nLastCol))
3273 // hidden columns. Deselect them.
3274 aMarkData.SetMultiMarkArea(ScRange(nCol, 0, nTab, nLastCol, rDoc.MaxRow(), nTab), false);
3275
3276 nCol = nLastCol + 1;
3277 }
3278
3279 SCROW nRow = 0, nLastRow;
3280 while (nRow <= rDoc.MaxRow())
3281 {
3282 if (rDoc.RowHidden(nRow, nTab, nullptr, &nLastRow))
3283 // These rows are hidden. Deselect them.
3284 aMarkData.SetMultiMarkArea(ScRange(0, nRow, nTab, rDoc.MaxCol(), nLastRow, nTab), false);
3285
3286 nRow = nLastRow + 1;
3287 }
3288
3289 ScRangeList aNewRanges;
3290 aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3291 return new ScCellRangesObj( pDocShell, aNewRanges );
3292 }
3293
3294 return nullptr;
3295}
3296
3297uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryEmptyCells()
3298{
3299 SolarMutexGuard aGuard;
3300 if (pDocShell)
3301 {
3302 ScDocument& rDoc = pDocShell->GetDocument();
3303
3304 ScMarkData aMarkData(*GetMarkData());
3305
3306 // mark occupied cells
3307 for (size_t i = 0, nCount = aRanges.size(); i < nCount; ++i)
3308 {
3309 ScRange const & rRange = aRanges[ i ];
3310
3311 ScCellIterator aIter(rDoc, rRange);
3312 for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3313 {
3314 // notes count as non-empty
3315 if (!aIter.isEmpty())
3316 aMarkData.SetMultiMarkArea(aIter.GetPos(), false);
3317 }
3318 }
3319
3320 ScRangeList aNewRanges;
3321 // IsMultiMarked is not enough (will not be reset during deselecting)
3322 //if (aMarkData.HasAnyMultiMarks()) // #i20044# should be set for all empty range
3323 aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3324
3325 return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges can be empty
3326 }
3327
3328 return nullptr;
3329}
3330
3331uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentCells(
3332 sal_Int16 nContentFlags )
3333{
3334 SolarMutexGuard aGuard;
3335 if (pDocShell)
3336 {
3337 ScDocument& rDoc = pDocShell->GetDocument();
3338
3339 ScMarkData aMarkData(rDoc.GetSheetLimits());
3340
3341 // select matching cells
3342 for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
3343 {
3344 ScRange const & rRange = aRanges[ i ];
3345
3346 ScCellIterator aIter(rDoc, rRange);
3347 for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3348 {
3349 bool bAdd = false;
3350 switch (aIter.getType())
3351 {
3352 case CELLTYPE_STRING:
3353 if ( nContentFlags & sheet::CellFlags::STRING )
3354 bAdd = true;
3355 break;
3356 case CELLTYPE_EDIT:
3357 if ( (nContentFlags & sheet::CellFlags::STRING) || (nContentFlags & sheet::CellFlags::FORMATTED) )
3358 bAdd = true;
3359 break;
3360 case CELLTYPE_FORMULA:
3361 if ( nContentFlags & sheet::CellFlags::FORMULA )
3362 bAdd = true;
3363 break;
3364 case CELLTYPE_VALUE:
3365 if ( (nContentFlags & (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME))
3366 == (sheet::CellFlags::VALUE|sheet::CellFlags::DATETIME) )
3367 bAdd = true;
3368 else
3369 {
3370 // date/time identification
3371
3372 sal_uLong nIndex = static_cast<sal_uLong>(rDoc.GetAttr(
3373 aIter.GetPos(), ATTR_VALUE_FORMAT)->GetValue());
3374 SvNumFormatType nTyp = rDoc.GetFormatTable()->GetType(nIndex);
3375 if ((nTyp == SvNumFormatType::DATE) || (nTyp == SvNumFormatType::TIME) ||
3376 (nTyp == SvNumFormatType::DATETIME))
3377 {
3378 if ( nContentFlags & sheet::CellFlags::DATETIME )
3379 bAdd = true;
3380 }
3381 else
3382 {
3383 if ( nContentFlags & sheet::CellFlags::VALUE )
3384 bAdd = true;
3385 }
3386 }
3387 break;
3388 default:
3389 {
3390 // added to avoid warnings
3391 }
3392 }
3393
3394 if (bAdd)
3395 aMarkData.SetMultiMarkArea(aIter.GetPos());
3396 }
3397 }
3398
3399 if (nContentFlags & sheet::CellFlags::ANNOTATION)
3400 {
3401 std::vector<sc::NoteEntry> aNotes;
3402 rDoc.GetNotesInRange(aRanges, aNotes);
3403
3404 for (const auto& i : aNotes)
3405 {
3406 aMarkData.SetMultiMarkArea(i.maPos);
3407 }
3408 }
3409
3410 ScRangeList aNewRanges;
3411 if (aMarkData.IsMultiMarked())
3412 aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3413
3414 return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges can be empty
3415 }
3416
3417 return nullptr;
3418}
3419
3420uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryFormulaCells(
3421 sal_Int32 nResultFlags )
3422{
3423 SolarMutexGuard aGuard;
3424 if (pDocShell)
3425 {
3426 ScDocument& rDoc = pDocShell->GetDocument();
3427
3428 ScMarkData aMarkData(rDoc.GetSheetLimits());
3429
3430 // select matching cells
3431 for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
3432 {
3433 ScRange const & rRange = aRanges[ i ];
3434
3435 ScCellIterator aIter(rDoc, rRange);
3436 for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3437 {
3438 if (aIter.getType() == CELLTYPE_FORMULA)
3439 {
3440 ScFormulaCell* pFCell = aIter.getFormulaCell();
3441 bool bAdd = false;
3442 if (pFCell->GetErrCode() != FormulaError::NONE)
3443 {
3444 if ( nResultFlags & sheet::FormulaResult::ERROR )
3445 bAdd = true;
3446 }
3447 else if (pFCell->IsValue())
3448 {
3449 if ( nResultFlags & sheet::FormulaResult::VALUE )
3450 bAdd = true;
3451 }
3452 else // String
3453 {
3454 if ( nResultFlags & sheet::FormulaResult::STRING )
3455 bAdd = true;
3456 }
3457
3458 if (bAdd)
3459 aMarkData.SetMultiMarkArea(aIter.GetPos());
3460 }
3461 }
3462 }
3463
3464 ScRangeList aNewRanges;
3465 if (aMarkData.IsMultiMarked())
3466 aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3467
3468 return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges can be empty
3469 }
3470
3471 return nullptr;
3472}
3473
3474uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl(
3475 const table::CellAddress& aCompare, bool bColumnDiff)
3476{
3477 if (pDocShell)
3478 {
3479 size_t nRangeCount = aRanges.size();
3480 size_t i;
3481 ScDocument& rDoc = pDocShell->GetDocument();
3482 ScMarkData aMarkData(rDoc.GetSheetLimits());
3483
3484 SCCOLROW nCmpPos = bColumnDiff ? static_cast<SCCOLROW>(aCompare.Row) : static_cast<SCCOLROW>(aCompare.Column);
3485
3486 // first select everything, where at all something is in the comparison column
3487 // (in the second step the selection is cancelled for equal cells)
3488
3489 SCTAB nTab = lcl_FirstTab(aRanges);
3490 ScRange aCmpRange, aCellRange;
3491 if (bColumnDiff)
3492 aCmpRange = ScRange( 0,nCmpPos,nTab, rDoc.MaxCol(),nCmpPos,nTab );
3493 else
3494 aCmpRange = ScRange( static_cast<SCCOL>(nCmpPos),0,nTab, static_cast<SCCOL>(nCmpPos),rDoc.MaxRow(),nTab );
3495 ScCellIterator aCmpIter(rDoc, aCmpRange);
3496 for (bool bHasCell = aCmpIter.first(); bHasCell; bHasCell = aCmpIter.next())
3497 {
3498 SCCOLROW nCellPos = bColumnDiff ? static_cast<SCCOLROW>(aCmpIter.GetPos().Col()) : static_cast<SCCOLROW>(aCmpIter.GetPos().Row());
3499 if (bColumnDiff)
3500 aCellRange = ScRange( static_cast<SCCOL>(nCellPos),0,nTab,
3501 static_cast<SCCOL>(nCellPos),rDoc.MaxRow(),nTab );
3502 else
3503 aCellRange = ScRange( 0,nCellPos,nTab, rDoc.MaxCol(),nCellPos,nTab );
3504
3505 for (i=0; i<nRangeCount; i++)
3506 {
3507 ScRange aRange( aRanges[ i ] );
3508 if ( aRange.Intersects( aCellRange ) )
3509 {
3510 if (bColumnDiff)
3511 {
3512 aRange.aStart.SetCol(static_cast<SCCOL>(nCellPos));
3513 aRange.aEnd.SetCol(static_cast<SCCOL>(nCellPos));
3514 }
3515 else
3516 {
3517 aRange.aStart.SetRow(nCellPos);
3518 aRange.aEnd.SetRow(nCellPos);
3519 }
3520 aMarkData.SetMultiMarkArea( aRange );
3521 }
3522 }
3523 }
3524
3525 // compare all not empty cells with the comparison column and accordingly
3526 // select or cancel
3527
3528 ScAddress aCmpAddr;
3529 for (i=0; i<nRangeCount; i++)
3530 {
3531 ScRange const & rRange = aRanges[ i ];
3532
3533 ScCellIterator aIter( rDoc, rRange );
3534 for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3535 {
3536 if (bColumnDiff)
3537 aCmpAddr = ScAddress( aIter.GetPos().Col(), nCmpPos, aIter.GetPos().Tab() );
3538 else
3539 aCmpAddr = ScAddress( static_cast<SCCOL>(nCmpPos), aIter.GetPos().Row(), aIter.GetPos().Tab() );
3540
3541 ScRange aOneRange(aIter.GetPos());
3542 if (!aIter.equalsWithoutFormat(aCmpAddr))
3543 aMarkData.SetMultiMarkArea( aOneRange );
3544 else
3545 aMarkData.SetMultiMarkArea( aOneRange, false ); // deselect
3546 }
3547 }
3548
3549 ScRangeList aNewRanges;
3550 if (aMarkData.IsMultiMarked())
3551 aMarkData.FillRangeListWithMarks( &aNewRanges, false );
3552
3553 return new ScCellRangesObj( pDocShell, aNewRanges ); // aNewRanges can be empty
3554 }
3555 return nullptr;
3556}
3557
3558uno::Reference<sheet::XSheetCellRanges > SAL_CALL ScCellRangesBase::queryColumnDifferences(
3559 const table::CellAddress& aCompare )
3560{
3561 SolarMutexGuard aGuard;
3562 return QueryDifferences_Impl( aCompare, true );
3563}
3564
3565uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryRowDifferences(
3566 const table::CellAddress& aCompare )
3567{
3568 SolarMutexGuard aGuard;
3569 return QueryDifferences_Impl( aCompare, false );
3570}
3571
3572uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryIntersection(
3573 const table::CellRangeAddress& aRange )
3574{
3575 SolarMutexGuard aGuard;
3576 ScRange aMask( static_cast<SCCOL>(aRange.StartColumn), static_cast<SCROW>(aRange.StartRow), aRange.Sheet,
3577 static_cast<SCCOL>(aRange.EndColumn), static_cast<SCROW>(aRange.EndRow), aRange.Sheet );
3578
3579 ScRangeList aNew;
3580 for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i )
3581 {
3582 ScRange aTemp( aRanges[ i ] );
3583 if ( aTemp.Intersects( aMask ) )
3584 aNew.Join( ScRange( std::max( aTemp.aStart.Col(), aMask.aStart.Col() ),
3585 std::max( aTemp.aStart.Row(), aMask.aStart.Row() ),
3586 std::max( aTemp.aStart.Tab(), aMask.aStart.Tab() ),
3587 std::min( aTemp.aEnd.Col(), aMask.aEnd.Col() ),
3588 std::min( aTemp.aEnd.Row(), aMask.aEnd.Row() ),
3589 std::min( aTemp.aEnd.Tab(), aMask.aEnd.Tab() ) ) );
3590 }
3591
3592 return new ScCellRangesObj( pDocShell, aNew ); // can be empty
3593}
3594
3595// XFormulaQuery
3596
3597uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryPrecedents(
3598 sal_Bool bRecursive )
3599{
3600 SolarMutexGuard aGuard;
3601 if ( pDocShell )
3602 {
3603 ScDocument& rDoc = pDocShell->GetDocument();
3604
3605 ScRangeList aNewRanges(aRanges);
3606 bool bFound;
3607 do
3608 {
3609 bFound = false;
3610
3611 // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3612 ScMarkData aMarkData(rDoc.GetSheetLimits());
3613 aMarkData.MarkFromRangeList( aNewRanges, false );
3614
3615 for (size_t nR = 0, nCount = aNewRanges.size(); nR<nCount; ++nR)
3616 {
3617 ScRange const & rRange = aNewRanges[ nR];
3618 ScCellIterator aIter(rDoc, rRange);
3619 for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
3620 {
3621 if (aIter.getType() != CELLTYPE_FORMULA)
3622 continue;
3623
3624 ScDetectiveRefIter aRefIter(rDoc, aIter.getFormulaCell());
3625 ScRange aRefRange;
3626 while ( aRefIter.GetNextRef( aRefRange) )
3627 {
3628 if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aRefRange ) )
3629 bFound = true;
3630 aMarkData.SetMultiMarkArea(aRefRange);
3631 }
3632 }
3633 }
3634
3635 aMarkData.FillRangeListWithMarks( &aNewRanges, true );
3636 }
3637 while ( bRecursive && bFound );
3638
3639 return new ScCellRangesObj( pDocShell, aNewRanges );
3640 }
3641
3642 return nullptr;
3643}
3644
3645uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryDependents(
3646 sal_Bool bRecursive )
3647{
3648 SolarMutexGuard aGuard;
3649 if ( pDocShell )
3650 {
3651 ScDocument& rDoc = pDocShell->GetDocument();
3652
3653 ScRangeList aNewRanges(aRanges);
3654 bool bFound;
3655 do
3656 {
3657 bFound = false;
3658
3659 // aMarkData uses aNewRanges, not aRanges, so GetMarkData can't be used
3660 ScMarkData aMarkData(rDoc.GetSheetLimits());
3661 aMarkData.MarkFromRangeList( aNewRanges, false );
3662
3663 SCTAB nTab = lcl_FirstTab(aNewRanges);
3664
3665 ScCellIterator aCellIter( rDoc, ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab) );
3666 for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next())
3667 {
3668 if (aCellIter.getType() != CELLTYPE_FORMULA)
3669 continue;
3670
3671 bool bMark = false;
3672 ScDetectiveRefIter aIter(rDoc, aCellIter.getFormulaCell());
3673 ScRange aRefRange;
3674 while ( aIter.GetNextRef( aRefRange) && !bMark )
3675 {
3676 size_t nRangesCount = aNewRanges.size();
3677 for (size_t nR = 0; nR < nRangesCount; ++nR)
3678 {
3679 ScRange const & rRange = aNewRanges[ nR ];
3680 if (rRange.Intersects(aRefRange))
3681 {
3682 bMark = true; // depending on part of Range
3683 break;
3684 }
3685 }
3686 }
3687 if (bMark)
3688 {
3689 ScRange aCellRange(aCellIter.GetPos());
3690 if ( bRecursive && !bFound && !aMarkData.IsAllMarked( aCellRange ) )
3691 bFound = true;
3692 aMarkData.SetMultiMarkArea(aCellRange);
3693 }
3694 }
3695
3696 aMarkData.FillRangeListWithMarks( &aNewRanges, true );
3697 }
3698 while ( bRecursive && bFound );
3699
3700 return new ScCellRangesObj( pDocShell, aNewRanges );
3701 }
3702
3703 return nullptr;
3704}
3705
3706// XSearchable
3707
3708uno::Reference<util::XSearchDescriptor> SAL_CALL ScCellRangesBase::createSearchDescriptor()
3709{
3710 return new ScCellSearchObj;
3711}
3712
3713uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangesBase::findAll(
3714 const uno::Reference<util::XSearchDescriptor>& xDesc )
3715{
3716 SolarMutexGuard aGuard;
3717 // should we return Null if nothing is found(?)
3718 uno::Reference<container::XIndexAccess> xRet;
3719 if ( pDocShell && xDesc.is() )
3720 {
3721 ScCellSearchObj* pSearch = dynamic_cast<ScCellSearchObj*>( xDesc.get() );
3722 if (pSearch)
3723 {
3724 SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
3725 if (pSearchItem)
3726 {
3727 ScDocument& rDoc = pDocShell->GetDocument();
3728 pSearchItem->SetCommand( SvxSearchCmd::FIND_ALL );
3729 // always only within this object
3730 pSearchItem->SetSelection( !lcl_WholeSheet(rDoc, aRanges) );
3731
3732 ScMarkData aMark(*GetMarkData());
3733
3734 OUString aDummyUndo;
3735 ScRangeList aMatchedRanges;
3736 SCCOL nCol = 0;
3737 SCROW nRow = 0;
3738 SCTAB nTab = 0;
3739 bool bMatchedRangesWereClamped = false;
3740 bool bFound = rDoc.SearchAndReplace(
3741 *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, nullptr, bMatchedRangesWereClamped);
3742 if (bFound)
3743 {
3744 // on findAll always CellRanges no matter how much has been found
3745 xRet.set(new ScCellRangesObj( pDocShell, aMatchedRanges ));
3746 }
3747 }
3748 }
3749 }
3750 return xRet;
3751}
3752
3753uno::Reference<uno::XInterface> ScCellRangesBase::Find_Impl(
3754 const uno::Reference<util::XSearchDescriptor>& xDesc,
3755 const ScAddress* pLastPos )
3756{
3757 uno::Reference<uno::XInterface> xRet;
3758 if ( pDocShell && xDesc.is() )
3759 {
3760 ScCellSearchObj* pSearch = dynamic_cast<ScCellSearchObj*>( xDesc.get() );
3761 if (pSearch)
3762 {
3763 SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
3764 if (pSearchItem)
3765 {
3766 ScDocument& rDoc = pDocShell->GetDocument();
3767 pSearchItem->SetCommand( SvxSearchCmd::FIND );
3768 // only always in this object
3769 pSearchItem->SetSelection( !lcl_WholeSheet(rDoc, aRanges) );
3770
3771 ScMarkData aMark(*GetMarkData());
3772
3773 SCCOL nCol;
3774 SCROW nRow;
3775 SCTAB nTab;
3776 if (pLastPos)
3777 pLastPos->GetVars( nCol, nRow, nTab );
3778 else
3779 {
3780 nTab = lcl_FirstTab(aRanges);
3781 rDoc.GetSearchAndReplaceStart( *pSearchItem, nCol, nRow );
3782 }
3783
3784 OUString aDummyUndo;
3785 ScRangeList aMatchedRanges;
3786 bool bMatchedRangesWereClamped;
3787 bool bFound = rDoc.SearchAndReplace(
3788 *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aDummyUndo, nullptr, bMatchedRangesWereClamped);
3789 if (bFound)
3790 {
3791 ScAddress aFoundPos( nCol, nRow, nTab );
3792 xRet.set(cppu::getXWeak(new ScCellObj( pDocShell, aFoundPos )));
3793 }
3794 }
3795 }
3796 }
3797 return xRet;
3798}
3799
3800uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findFirst(
3801 const uno::Reference<util::XSearchDescriptor>& xDesc )
3802{
3803 SolarMutexGuard aGuard;
3804 return Find_Impl( xDesc, nullptr );
3805}
3806
3807uno::Reference<uno::XInterface> SAL_CALL ScCellRangesBase::findNext(
3808 const uno::Reference<uno::XInterface>& xStartAt,
3809 const uno::Reference<util::XSearchDescriptor >& xDesc )
3810{
3811 SolarMutexGuard aGuard;
3812 if ( xStartAt.is() )
3813 {
3814 ScCellRangesBase* pRangesImp = dynamic_cast<ScCellRangesBase*>( xStartAt.get() );
3815 if ( pRangesImp && pRangesImp->GetDocShell() == pDocShell )
3816 {
3817 const ScRangeList& rStartRanges = pRangesImp->GetRangeList();
3818 if ( rStartRanges.size() == 1 )
3819 {
3820 ScAddress aStartPos = rStartRanges[ 0 ].aStart;
3821 return Find_Impl( xDesc, &aStartPos );
3822 }
3823 }
3824 }
3825 return nullptr;
3826}
3827
3828// XReplaceable
3829
3830uno::Reference<util::XReplaceDescriptor> SAL_CALL ScCellRangesBase::createReplaceDescriptor()
3831{
3832 return new ScCellSearchObj;
3833}
3834
3835sal_Int32 SAL_CALL ScCellRangesBase::replaceAll( const uno::Reference<util::XSearchDescriptor>& xDesc )
3836{
3837 SolarMutexGuard aGuard;
3838 sal_uInt64 nReplaced = 0;
3839 if ( pDocShell && xDesc.is() )
3840 {
3841 ScCellSearchObj* pSearch = dynamic_cast<ScCellSearchObj*>( xDesc.get() );
3842 if (pSearch)
3843 {
3844 SvxSearchItem* pSearchItem = pSearch->GetSearchItem();
3845 if (pSearchItem)
3846 {
3847 ScDocument& rDoc = pDocShell->GetDocument();
3848 bool bUndo(rDoc.IsUndoEnabled());
3849 pSearchItem->SetCommand( SvxSearchCmd::REPLACE_ALL );
3850 // only always in this object
3851 pSearchItem->SetSelection( !lcl_WholeSheet(rDoc, aRanges) );
3852
3853 ScMarkData aMark(*GetMarkData());
3854
3855 SCTAB nTabCount = rDoc.GetTableCount();
3856 bool bProtected = !pDocShell->IsEditable();
3857 for (const auto& rTab : aMark)
3858 {
3859 if (rTab >= nTabCount)
3860 break;
3861 if ( rDoc.IsTabProtected(rTab) )
3862 bProtected = true;
3863 }
3864 if (bProtected)
3865 {
3867 }
3868 else
3869 {
3870 SCTAB nTab = aMark.GetFirstSelected(); // do not use if SearchAndReplace
3871 SCCOL nCol = 0;
3872 SCROW nRow = 0;
3873
3874 OUString aUndoStr;
3875 ScDocumentUniquePtr pUndoDoc;
3876 if (bUndo)
3877 {
3878 pUndoDoc.reset(new ScDocument( SCDOCMODE_UNDO ));
3879 pUndoDoc->InitUndo( rDoc, nTab, nTab );
3880 }
3881 for (const auto& rTab : aMark)
3882 {
3883 if (rTab >= nTabCount)
3884 break;
3885 if (rTab != nTab && bUndo)
3886 pUndoDoc->AddUndoTab( rTab, rTab );
3887 }
3888 std::unique_ptr<ScMarkData> pUndoMark;
3889 if (bUndo)
3890 pUndoMark.reset(new ScMarkData(aMark));
3891
3892 bool bFound = false;
3893 if (bUndo)
3894 {
3895 ScRangeList aMatchedRanges;
3896 bool bMatchedRangesWereClamped;
3897 bFound = rDoc.SearchAndReplace(
3898 *pSearchItem, nCol, nRow, nTab, aMark, aMatchedRanges, aUndoStr, pUndoDoc.get(), bMatchedRangesWereClamped );
3899 }
3900 if (bFound)
3901 {
3902 nReplaced = pUndoDoc->GetCellCount();
3903
3904 pDocShell->GetUndoManager()->AddUndoAction(
3905 std::make_unique<ScUndoReplace>( pDocShell, *pUndoMark, nCol, nRow, nTab,
3906 aUndoStr, std::move(pUndoDoc), pSearchItem ) );
3907
3908 pDocShell->PostPaintGridAll();
3909 pDocShell->SetDocumentModified();
3910 }
3911 }
3912 }
3913 }
3914 }
3915 return nReplaced;
3916}
3917
3918ScCellRangesObj::ScCellRangesObj(ScDocShell* pDocSh, const ScRangeList& rR)
3919 : ScCellRangesBase(pDocSh, rR)
3920{
3921}
3922
3923ScCellRangesObj::~ScCellRangesObj()
3924{
3925}
3926
3927void ScCellRangesObj::RefChanged()
3928{
3929 ScCellRangesBase::RefChanged();
3930}
3931
3932uno::Any SAL_CALL ScCellRangesObj::queryInterface( const uno::Type& rType )
3933{
3934 SC_QUERYINTERFACE( sheet::XSheetCellRangeContainer )
3935 SC_QUERYINTERFACE( sheet::XSheetCellRanges )
3936 SC_QUERYINTERFACE( container::XIndexAccess )
3937 SC_QUERY_MULTIPLE( container::XElementAccess, container::XIndexAccess )
3938 SC_QUERYINTERFACE( container::XEnumerationAccess )
3939 SC_QUERYINTERFACE( container::XNameContainer )
3940 SC_QUERYINTERFACE( container::XNameReplace )
3941 SC_QUERYINTERFACE( container::XNameAccess )
3942
3943 return ScCellRangesBase::queryInterface( rType );
3944}
3945
3946void SAL_CALL ScCellRangesObj::acquire() noexcept
3947{
3948 ScCellRangesBase::acquire();
3949}
3950
3951void SAL_CALL ScCellRangesObj::release() noexcept
3952{
3953 ScCellRangesBase::release();
3954}
3955
3956uno::Sequence<uno::Type> SAL_CALL ScCellRangesObj::getTypes()
3957{
3958 static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences(
3959 ScCellRangesBase::getTypes(),
3960 uno::Sequence<uno::Type>
3961 {
3965 } );
3966 return aTypes;
3967}
3968
3969uno::Sequence<sal_Int8> SAL_CALL ScCellRangesObj::getImplementationId()
3970{
3971 return css::uno::Sequence<sal_Int8>();
3972}
3973
3974// XCellRanges
3975
3976rtl::Reference<ScCellRangeObj> ScCellRangesObj::GetObjectByIndex_Impl(sal_Int32 nIndex) const
3977{
3978 ScDocShell* pDocSh = GetDocShell();
3979 const ScRangeList& rRanges = GetRangeList();
3980 if ( pDocSh && nIndex >= 0 && nIndex < sal::static_int_cast<sal_Int32>(rRanges.size()) )
3981 {
3982 ScRange const & rRange = rRanges[ nIndex ];
3983 if ( rRange.aStart == rRange.aEnd )
3984 return new ScCellObj( pDocSh, rRange.aStart );
3985 else
3986 return new ScCellRangeObj( pDocSh, rRange );
3987 }
3988
3989 return nullptr; // no DocShell or wrong index
3990}
3991
3992uno::Sequence<table::CellRangeAddress> SAL_CALL ScCellRangesObj::getRangeAddresses()
3993{
3994 SolarMutexGuard aGuard;
3995 ScDocShell* pDocSh = GetDocShell();
3996 const ScRangeList& rRanges = GetRangeList();
3997 size_t nCount = rRanges.size();
3998 if ( pDocSh && nCount )
3999 {
4000 table::CellRangeAddress aRangeAddress;
4001 uno::Sequence<table::CellRangeAddress> aSeq(nCount);
4002 table::CellRangeAddress* pAry = aSeq.getArray();
4003 for ( size_t i=0; i < nCount; i++)
4004 {
4005 ScUnoConversion::FillApiRange( aRangeAddress, rRanges[ i ] );
4006 pAry[i] = aRangeAddress;
4007 }
4008 return aSeq;
4009 }
4010
4011 return {}; // can be empty
4012}
4013
4014uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellRangesObj::getCells()
4015{
4016 SolarMutexGuard aGuard;
4017
4018 // getCells with empty range list is possible (no exception),
4019 // the resulting enumeration just has no elements
4020 // (same behaviour as a valid range with no cells)
4021 // This is handled in ScCellsEnumeration ctor.
4022
4023 const ScRangeList& rRanges = GetRangeList();
4024 ScDocShell* pDocSh = GetDocShell();
4025 if (pDocSh)
4026 return new ScCellsObj( pDocSh, rRanges );
4027 return nullptr;
4028}
4029
4030OUString SAL_CALL ScCellRangesObj::getRangeAddressesAsString()
4031{
4032 SolarMutexGuard aGuard;
4033 OUString aString;
4034 ScDocShell* pDocSh = GetDocShell();
4035 const ScRangeList& rRanges = GetRangeList();
4036 if (pDocSh)
4037 rRanges.Format( aString, ScRefFlags::VALID | ScRefFlags::TAB_3D, pDocSh->GetDocument() );
4038 return aString;
4039}
4040
4041// XSheetCellRangeContainer
4042
4043void SAL_CALL ScCellRangesObj::addRangeAddress( const table::CellRangeAddress& rRange,
4044 sal_Bool bMergeRanges )
4045{
4046 SolarMutexGuard aGuard;
4047 ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4048 static_cast<SCROW>(rRange.StartRow),
4049 static_cast<SCTAB>(rRange.Sheet),
4050 static_cast<SCCOL>(rRange.EndColumn),
4051 static_cast<SCROW>(rRange.EndRow),
4052 static_cast<SCTAB>(rRange.Sheet));
4053 AddRange(aRange, bMergeRanges);
4054}
4055
4056static void lcl_RemoveNamedEntry( std::vector<ScCellRangesObj::ScNamedEntry>& rNamedEntries, const ScRange& rRange )
4057{
4058 sal_uInt16 nCount = rNamedEntries.size();
4059 for ( sal_uInt16 n=nCount; n--; )
4060 if ( rNamedEntries[n].GetRange() == rRange )
4061 rNamedEntries.erase( rNamedEntries.begin() + n );
4062}
4063
4064void SAL_CALL ScCellRangesObj::removeRangeAddress( const table::CellRangeAddress& rRange )
4065{
4066 SolarMutexGuard aGuard;
4067 const ScRangeList& rRanges = GetRangeList();
4068
4069 ScRangeList aSheetRanges;
4070 ScRangeList aNotSheetRanges;
4071 for (size_t i = 0; i < rRanges.size(); ++i)
4072 {
4073 if (rRanges[ i].aStart.Tab() == rRange.Sheet)
4074 {
4075 aSheetRanges.push_back( rRanges[ i ] );
4076 }
4077 else
4078 {
4079 aNotSheetRanges.push_back( rRanges[ i ] );
4080 }
4081 }
4082 ScMarkData aMarkData(GetDocument()->GetSheetLimits());
4083 aMarkData.MarkFromRangeList( aSheetRanges, false );
4084 ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4085 static_cast<SCROW>(rRange.StartRow),
4086 static_cast<SCTAB>(rRange.Sheet),
4087 static_cast<SCCOL>(rRange.EndColumn),
4088 static_cast<SCROW>(rRange.EndRow),
4089 static_cast<SCTAB>(rRange.Sheet));
4090 if (aMarkData.GetTableSelect( aRange.aStart.Tab() ))
4091 {
4092 aMarkData.MarkToMulti();
4093 if (!aMarkData.IsAllMarked( aRange ) )
4094 throw container::NoSuchElementException();
4095
4096 aMarkData.SetMultiMarkArea( aRange, false );
4097 lcl_RemoveNamedEntry(m_aNamedEntries, aRange);
4098
4099 }
4100 SetNewRanges(aNotSheetRanges);
4101 ScRangeList aNew;
4102 aMarkData.FillRangeListWithMarks( &aNew, false );
4103 for ( size_t j = 0; j < aNew.size(); ++j)
4104 {
4105 AddRange(aNew[ j ], false);
4106 }
4107}
4108
4109void SAL_CALL ScCellRangesObj::addRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRanges,
4110 sal_Bool bMergeRanges )
4111{
4112 SolarMutexGuard aGuard;
4113 for (const table::CellRangeAddress& rRange : rRanges)
4114 {
4115 ScRange aRange(static_cast<SCCOL>(rRange.StartColumn),
4116 static_cast<SCROW>(rRange.StartRow),
4117 static_cast<SCTAB>(rRange.Sheet),
4118 static_cast<SCCOL>(rRange.EndColumn),
4119 static_cast<SCROW>(rRange.EndRow),
4120 static_cast<SCTAB>(rRange.Sheet));
4121 AddRange(aRange, bMergeRanges);
4122 }
4123}
4124
4125void SAL_CALL ScCellRangesObj::removeRangeAddresses( const uno::Sequence<table::CellRangeAddress >& rRangeSeq )
4126{
4127 // use sometimes a better/faster implementation
4128 for (const table::CellRangeAddress& rRange : rRangeSeq)
4129 {
4130 removeRangeAddress(rRange);
4131 }
4132}
4133
4134// XNameContainer
4135
4136static void lcl_RemoveNamedEntry( std::vector<ScCellRangesObj::ScNamedEntry>& rNamedEntries, std::u16string_view rName )
4137{
4138 sal_uInt16 nCount = rNamedEntries.size();
4139 for ( sal_uInt16 n=nCount; n--; )
4140 if ( rNamedEntries[n].GetName() == rName )
4141 rNamedEntries.erase( rNamedEntries.begin() + n );
4142}
4143
4144void SAL_CALL ScCellRangesObj::insertByName( const OUString& aName, const uno::Any& aElement )
4145{
4146 SolarMutexGuard aGuard;
4147 ScDocShell* pDocSh = GetDocShell();
4148 bool bDone = false;
4149
4151
4152 uno::Reference<uno::XInterface> xInterface(aElement, uno::UNO_QUERY);
4153 if ( pDocSh && xInterface.is() )
4154 {
4155 ScCellRangesBase* pRangesImp = dynamic_cast<ScCellRangesBase*>( xInterface.get() );
4156 if ( pRangesImp && pRangesImp->GetDocShell() == pDocSh )
4157 {
4158 // if explicit name is given and already existing, throw exception
4159
4160 if ( !aName.isEmpty() )
4161 {
4162 size_t nNamedCount = m_aNamedEntries.size();
4163 for (size_t n = 0; n < nNamedCount; n++)
4164 {
4165 if (m_aNamedEntries[n].GetName() == aName)
4166 throw container::ElementExistException();
4167 }
4168 }
4169
4170 ScRangeList aNew(GetRangeList());
4171 const ScRangeList& rAddRanges = pRangesImp->GetRangeList();
4172 size_t nAddCount = rAddRanges.size();
4173 for ( size_t i = 0; i < nAddCount; i++ )
4174 aNew.Join( rAddRanges[ i ] );
4175 SetNewRanges(aNew);
4176 bDone = true;
4177
4178 if ( !aName.isEmpty() && nAddCount == 1 )
4179 {
4180 // if a name is given, also insert into list of named entries
4181 // (only possible for a single range)
4182 // name is not in m_aNamedEntries (tested above)
4183 m_aNamedEntries.emplace_back( ScNamedEntry{aName, rAddRanges[ 0 ]} );
4184 }
4185 }
4186 }
4187
4188 if (!bDone)
4189 {
4190 // invalid element - double names are handled above
4191 throw lang::IllegalArgumentException();
4192 }
4193}
4194
4195static bool lcl_FindRangeByName( const ScRangeList& rRanges, ScDocShell* pDocSh,
4196 std::u16string_view rName, size_t& rIndex )
4197{
4198 if (pDocSh)
4199 {
4200 OUString aRangeStr;
4201 ScDocument& rDoc = pDocSh->GetDocument();
4202 for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
4203 {
4204 aRangeStr = rRanges[ i ].Format(rDoc, ScRefFlags::VALID | ScRefFlags::TAB_3D);
4205 if ( aRangeStr == rName )
4206 {
4207 rIndex = i;
4208 return true;
4209 }
4210 }
4211 }
4212 return false;
4213}
4214
4215static bool lcl_FindRangeOrEntry( const std::vector<ScCellRangesObj::ScNamedEntry>& rNamedEntries,
4216 const ScRangeList& rRanges, ScDocShell* pDocSh,
4217 const OUString& rName, ScRange& rFound )
4218{
4219 // exact range in list?
4220
4221 size_t nIndex = 0;
4222 if ( lcl_FindRangeByName( rRanges, pDocSh, rName, nIndex ) )
4223 {
4224 rFound = rRanges[ nIndex ];
4225 return true;
4226 }
4227
4228 // range contained in selection? (sheet must be specified)
4229
4230 ScRange aCellRange;
4231 ScRefFlags nParse = aCellRange.ParseAny( rName, pDocSh->GetDocument() );
4232 if ( (nParse & ( ScRefFlags::VALID | ScRefFlags::TAB_3D ))
4234 {
4235 ScMarkData aMarkData(pDocSh->GetDocument().GetSheetLimits());
4236 aMarkData.MarkFromRangeList( rRanges, false );
4237 if ( aMarkData.IsAllMarked( aCellRange ) )
4238 {
4239 rFound = aCellRange;
4240 return true;
4241 }
4242 }
4243
4244 // named entry in this object?
4245
4246 for (const auto & rNamedEntry : rNamedEntries)
4247 if ( rNamedEntry.GetName() == rName )
4248 {
4249 // test if named entry is contained in rRanges
4250
4251 const ScRange& rComp = rNamedEntry.GetRange();
4252 ScMarkData aMarkData(pDocSh->GetDocument().GetSheetLimits());
4253 aMarkData.MarkFromRangeList( rRanges, false );
4254 if ( aMarkData.IsAllMarked( rComp ) )
4255 {
4256 rFound = rComp;
4257 return true;
4258 }
4259 }
4260
4261 return false; // not found
4262}
4263
4264void SAL_CALL ScCellRangesObj::removeByName( const OUString& aName )
4265{
4266 SolarMutexGuard aGuard;
4267 bool bDone = false;
4268 ScDocShell* pDocSh = GetDocShell();
4269 const ScRangeList& rRanges = GetRangeList();
4270 size_t nIndex = 0;
4271 if ( lcl_FindRangeByName( rRanges, pDocSh, aName, nIndex ) )
4272 {
4273 // skip a single range
4274 ScRangeList aNew;
4275 for ( size_t i = 0, nCount = rRanges.size(); i < nCount; i++ )
4276 if (i != nIndex)
4277 aNew.push_back( rRanges[ i ] );
4278 SetNewRanges(aNew);
4279 bDone = true;
4280 }
4281 else if (pDocSh)
4282 {
4283 // deselect any ranges (parsed or named entry)
4284 ScRangeList aDiff;
4285 bool bValid = ( aDiff.Parse( aName, pDocSh->GetDocument() ) & ScRefFlags::VALID )
4287 if (!bValid)
4288 {
4289 sal_uInt16 nCount = m_aNamedEntries.size();
4290 for (sal_uInt16 n=0; n<nCount && !bValid; n++)
4291 if (m_aNamedEntries[n].GetName() == aName)
4292 {
4293 aDiff.RemoveAll();
4294 aDiff.push_back(m_aNamedEntries[n].GetRange());
4295 bValid = true;
4296 }
4297 }
4298 if ( bValid )
4299 {
4300 ScMarkData aMarkData(GetDocument()->GetSheetLimits());
4301 aMarkData.MarkFromRangeList( rRanges, false );
4302
4303 for ( size_t i = 0, nDiffCount = aDiff.size(); i < nDiffCount; i++ )
4304 {
4305 ScRange const & rDiffRange = aDiff[ i ];
4306 if (aMarkData.GetTableSelect( rDiffRange.aStart.Tab() ))
4307 aMarkData.SetMultiMarkArea( rDiffRange, false );
4308 }
4309
4310 ScRangeList aNew;
4311 aMarkData.FillRangeListWithMarks( &aNew, false );
4312 SetNewRanges(aNew);
4313
4314 bDone = true;
4315 }
4316 }
4317
4318 if (!m_aNamedEntries.empty())
4319 lcl_RemoveNamedEntry(m_aNamedEntries, aName);
4320
4321 if (!bDone)
4322 throw container::NoSuchElementException(); // not found
4323}
4324
4325// XNameReplace
4326
4327void SAL_CALL ScCellRangesObj::replaceByName( const OUString& aName, const uno::Any& aElement )
4328{
4329 SolarMutexGuard aGuard;
4331 removeByName( aName );
4332 insertByName( aName, aElement );
4333}
4334
4335// XNameAccess
4336
4337uno::Any SAL_CALL ScCellRangesObj::getByName( const OUString& aName )
4338{
4339 SolarMutexGuard aGuard;
4340 uno::Any aRet;
4341
4342 ScDocShell* pDocSh = GetDocShell();
4343 const ScRangeList& rRanges = GetRangeList();
4344 ScRange aRange;
4345 if (!lcl_FindRangeOrEntry(m_aNamedEntries, rRanges,
4346 pDocSh, aName, aRange))
4347 throw container::NoSuchElementException();
4348
4349 uno::Reference<table::XCellRange> xRange;
4350 if ( aRange.aStart == aRange.aEnd )
4351 xRange.set(new ScCellObj( pDocSh, aRange.aStart ));
4352 else
4353 xRange.set(new ScCellRangeObj( pDocSh, aRange ));
4354 aRet <<= xRange;
4355
4356 return aRet;
4357}
4358
4359static bool lcl_FindEntryName( const std::vector<ScCellRangesObj::ScNamedEntry>& rNamedEntries,
4360 const ScRange& rRange, OUString& rName )
4361{
4362 sal_uInt16 nCount = rNamedEntries.size();
4363 for (sal_uInt16 i=0; i<nCount; i++)
4364 if (rNamedEntries[i].GetRange() == rRange)
4365 {
4366 rName = rNamedEntries[i].GetName();
4367 return true;
4368 }
4369 return false;
4370}
4371
4372uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getElementNames()
4373{
4374 SolarMutexGuard aGuard;
4375
4376 ScDocShell* pDocSh = GetDocShell();
4377 const ScRangeList& rRanges = GetRangeList();
4378 if (pDocSh)
4379 {
4380 OUString aRangeStr;
4381 ScDocument& rDoc = pDocSh->GetDocument();
4382 size_t nCount = rRanges.size();
4383
4384 uno::Sequence<OUString> aSeq(nCount);
4385 OUString* pAry = aSeq.getArray();
4386 for (size_t i=0; i < nCount; i++)
4387 {
4388 // use given name if for exactly this range, otherwise just format
4389 ScRange const & rRange = rRanges[ i ];
4390 if (m_aNamedEntries.empty() ||
4391 !lcl_FindEntryName(m_aNamedEntries, rRange, aRangeStr))
4392 {
4393 aRangeStr = rRange.Format(rDoc, ScRefFlags::VALID | ScRefFlags::TAB_3D);
4394 }
4395 pAry[i] = aRangeStr;
4396 }
4397 return aSeq;
4398 }
4399 return {};
4400}
4401
4402sal_Bool SAL_CALL ScCellRangesObj::hasByName( const OUString& aName )
4403{
4404 SolarMutexGuard aGuard;
4405 ScDocShell* pDocSh = GetDocShell();
4406 const ScRangeList& rRanges = GetRangeList();
4407 ScRange aRange;
4408 return lcl_FindRangeOrEntry(m_aNamedEntries, rRanges, pDocSh,
4409 aName, aRange);
4410}
4411
4412// XEnumerationAccess
4413
4414uno::Reference<container::XEnumeration> SAL_CALL ScCellRangesObj::createEnumeration()
4415{
4416 SolarMutexGuard aGuard;
4417 return new ScIndexEnumeration(this, "com.sun.star.sheet.SheetCellRangesEnumeration");
4418}
4419
4420// XIndexAccess
4421
4422sal_Int32 SAL_CALL ScCellRangesObj::getCount()
4423{
4424 SolarMutexGuard aGuard;
4425 const ScRangeList& rRanges = GetRangeList();
4426 return rRanges.size();
4427}
4428
4429uno::Any SAL_CALL ScCellRangesObj::getByIndex( sal_Int32 nIndex )
4430{
4431 SolarMutexGuard aGuard;
4432 uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
4433 if (!xRange.is())
4434 throw lang::IndexOutOfBoundsException();
4435
4436 return uno::Any(xRange);
4437
4438}
4439
4440uno::Type SAL_CALL ScCellRangesObj::getElementType()
4441{
4443}
4444
4445sal_Bool SAL_CALL ScCellRangesObj::hasElements()
4446{
4447 SolarMutexGuard aGuard;
4448 const ScRangeList& rRanges = GetRangeList();
4449 return !rRanges.empty();
4450}
4451
4452// XServiceInfo
4453OUString SAL_CALL ScCellRangesObj::getImplementationName()
4454{
4455 return "ScCellRangesObj";
4456}
4457
4458sal_Bool SAL_CALL ScCellRangesObj::supportsService( const OUString& rServiceName )
4459{
4460 return cppu::supportsService(this, rServiceName);
4461}
4462
4463uno::Sequence<OUString> SAL_CALL ScCellRangesObj::getSupportedServiceNames()
4464{
4469}
4470
4471uno::Reference<table::XCellRange> ScCellRangeObj::CreateRangeFromDoc( const ScDocument& rDoc, const ScRange& rR )
4472{
4473 SfxObjectShell* pObjSh = rDoc.GetDocumentShell();
4474 if ( auto pDocShell = dynamic_cast<ScDocShell*>( pObjSh) )
4475 return new ScCellRangeObj( pDocShell, rR );
4476 return nullptr;
4477}
4478
4480 ScCellRangesBase( pDocSh, rR ),
4481 pRangePropSet( lcl_GetRangePropertySet() ),
4482 aRange( rR )
4483{
4484 aRange.PutInOrder(); // beginning / end correct
4485}
4486
4488{
4489}
4490
4492{
4493 ScCellRangesBase::RefChanged();
4494
4495 const ScRangeList& rRanges = GetRangeList();
4496 OSL_ENSURE(rRanges.size() == 1, "What ranges ?!?!");
4497 if ( !rRanges.empty() )
4498 {
4499 const ScRange & rFirst = rRanges[0];
4500 aRange = rFirst;
4502 }
4503}
4504
4506{
4507 SC_QUERYINTERFACE( sheet::XCellRangeAddressable )
4508 SC_QUERYINTERFACE( table::XCellRange )
4509 SC_QUERYINTERFACE( sheet::XSheetCellRange )
4510 SC_QUERYINTERFACE( sheet::XArrayFormulaRange )
4511 SC_QUERYINTERFACE( sheet::XArrayFormulaTokens )
4512 SC_QUERYINTERFACE( sheet::XCellRangeData )
4513 SC_QUERYINTERFACE( sheet::XCellRangeFormula )
4514 SC_QUERYINTERFACE( sheet::XMultipleOperation )
4515 SC_QUERYINTERFACE( util::XMergeable )
4516 SC_QUERYINTERFACE( sheet::XCellSeries )
4517 SC_QUERYINTERFACE( table::XAutoFormattable )
4518 SC_QUERYINTERFACE( util::XSortable )
4519 SC_QUERYINTERFACE( sheet::XSheetFilterableEx )
4520 SC_QUERYINTERFACE( sheet::XSheetFilterable )
4521 SC_QUERYINTERFACE( sheet::XSubTotalCalculatable )
4522 SC_QUERYINTERFACE( table::XColumnRowRange )
4523 SC_QUERYINTERFACE( util::XImportable )
4524 SC_QUERYINTERFACE( sheet::XCellFormatRangesSupplier )
4525 SC_QUERYINTERFACE( sheet::XUniqueCellFormatRangesSupplier )
4526
4527 return ScCellRangesBase::queryInterface( rType );
4528}
4529
4530void SAL_CALL ScCellRangeObj::acquire() noexcept
4531{
4532 ScCellRangesBase::acquire();
4533}
4534
4535void SAL_CALL ScCellRangeObj::release() noexcept
4536{
4537 ScCellRangesBase::release();
4538}
4539
4540uno::Sequence<uno::Type> SAL_CALL ScCellRangeObj::getTypes()
4541{
4542 static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences(
4543 ScCellRangesBase::getTypes(),
4544 uno::Sequence<uno::Type>
4545 {
4563 } );
4564 return aTypes;
4565}
4566
4567uno::Sequence<sal_Int8> SAL_CALL ScCellRangeObj::getImplementationId()
4568{
4569 return css::uno::Sequence<sal_Int8>();
4570}
4571
4572// XCellRange
4573
4574// ColumnCount / RowCount vanished
4576
4577uno::Reference<table::XCell> ScCellRangeObj::GetCellByPosition_Impl(
4578 sal_Int32 nColumn, sal_Int32 nRow )
4579{
4580 ScDocShell* pDocSh = GetDocShell();
4581 if (!pDocSh)
4582 throw uno::RuntimeException();
4583
4584 if ( nColumn >= 0 && nRow >= 0 )
4585 {
4586 sal_Int32 nPosX = aRange.aStart.Col() + nColumn;
4587 sal_Int32 nPosY = aRange.aStart.Row() + nRow;
4588
4589 if ( nPosX <= aRange.aEnd.Col() && nPosY <= aRange.aEnd.Row() )
4590 {
4591 ScAddress aNew( static_cast<SCCOL>(nPosX), static_cast<SCROW>(nPosY), aRange.aStart.Tab() );
4592 return new ScCellObj( pDocSh, aNew );
4593 }
4594 }
4595
4596 throw lang::IndexOutOfBoundsException();
4597}
4598
4599uno::Reference<table::XCell> SAL_CALL ScCellRangeObj::getCellByPosition(
4600 sal_Int32 nColumn, sal_Int32 nRow )
4601{
4602 SolarMutexGuard aGuard;
4603
4604 return GetCellByPosition_Impl(nColumn, nRow);
4605}
4606
4607uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByPosition(
4608 sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
4609{
4610 SolarMutexGuard aGuard;
4611
4612 ScDocShell* pDocSh = GetDocShell();
4613 if (!pDocSh)
4614 throw uno::RuntimeException();
4615
4616 if ( nLeft >= 0 && nTop >= 0 && nRight >= 0 && nBottom >= 0 )
4617 {
4618 sal_Int32 nStartX = aRange.aStart.Col() + nLeft;
4619 sal_Int32 nStartY = aRange.aStart.Row() + nTop;
4620 sal_Int32 nEndX = aRange.aStart.Col() + nRight;
4621 sal_Int32 nEndY = aRange.aStart.Row() + nBottom;
4622
4623 if ( nStartX <= nEndX && nEndX <= aRange.aEnd.Col() &&
4624 nStartY <= nEndY && nEndY <= aRange.aEnd.Row() )
4625 {
4626 ScRange aNew( static_cast<SCCOL>(nStartX), static_cast<SCROW>(nStartY), aRange.aStart.Tab(),
4627 static_cast<SCCOL>(nEndX), static_cast<SCROW>(nEndY), aRange.aEnd.Tab() );
4628 return new ScCellRangeObj( pDocSh, aNew );
4629 }
4630 }
4631
4632 throw lang::IndexOutOfBoundsException();
4633}
4634
4635uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByName(
4636 const OUString& aName )
4637{
4639}
4640
4641uno::Reference<table::XCellRange> ScCellRangeObj::getCellRangeByName(
4642 const OUString& aName, const ScAddress::Details& rDetails )
4643{
4644 // name refers to the whole document (with the range's table as default),
4645 // valid only if the range is within this range
4646
4647 SolarMutexGuard aGuard;
4648 ScDocShell* pDocSh = GetDocShell();
4649 if ( pDocSh )
4650 {
4651 ScDocument& rDoc = pDocSh->GetDocument();
4652 SCTAB nTab = aRange.aStart.Tab();
4653
4654 ScRange aCellRange;
4655 bool bFound = false;
4656 ScRefFlags nParse = aCellRange.ParseAny( aName, rDoc, rDetails );
4657 if ( nParse & ScRefFlags::VALID )
4658 {
4659 if ( !(nParse & ScRefFlags::TAB_3D) ) // no sheet specified -> this sheet
4660 {
4661 aCellRange.aStart.SetTab(nTab);
4662 aCellRange.aEnd.SetTab(nTab);
4663 }
4664 bFound = true;
4665 }
4666 else
4667 {
4668 if ( ScRangeUtil::MakeRangeFromName( aName, rDoc, nTab, aCellRange, RUTL_NAMES, rDetails) ||
4669 ScRangeUtil::MakeRangeFromName( aName, rDoc, nTab, aCellRange, RUTL_DBASE, rDetails))
4670 bFound = true;
4671 }
4672
4673 if (bFound) // valid only if within this object's range
4674 {
4675 if (!aRange.Contains(aCellRange))
4676 bFound = false;
4677 }
4678
4679 if (bFound)
4680 {
4681 if ( aCellRange.aStart == aCellRange.aEnd )
4682 return new ScCellObj( pDocSh, aCellRange.aStart );
4683 else
4684 return new ScCellRangeObj( pDocSh, aCellRange );
4685 }
4686 }
4687
4688 throw uno::RuntimeException();
4689}
4690
4691// XColumnRowRange
4692
4693uno::Reference<table::XTableColumns> SAL_CALL ScCellRangeObj::getColumns()
4694{
4695 SolarMutexGuard aGuard;
4696 ScDocShell* pDocSh = GetDocShell();
4697 if (pDocSh)
4698 return new ScTableColumnsObj( pDocSh, aRange.aStart.Tab(),
4699 aRange.aStart.Col(), aRange.aEnd.Col() );
4700
4701 OSL_FAIL("Document invalid");
4702 return nullptr;
4703}
4704
4705uno::Reference<table::XTableRows> SAL_CALL ScCellRangeObj::getRows()
4706{
4707 SolarMutexGuard aGuard;
4708 ScDocShell* pDocSh = GetDocShell();
4709 if (pDocSh)
4710 return new ScTableRowsObj( pDocSh, aRange.aStart.Tab(),
4711 aRange.aStart.Row(), aRange.aEnd.Row() );
4712
4713 OSL_FAIL("Document invalid");
4714 return nullptr;
4715}
4716
4717// XAddressableCellRange
4718
4719table::CellRangeAddress SAL_CALL ScCellRangeObj::getRangeAddress()
4720{
4721 SolarMutexGuard aGuard;
4722 table::CellRangeAddress aRet;
4724 return aRet;
4725}
4726
4727// XSheetCellRange
4728
4729uno::Reference<sheet::XSpreadsheet> SAL_CALL ScCellRangeObj::getSpreadsheet()
4730{
4731 SolarMutexGuard aGuard;
4732 ScDocShell* pDocSh = GetDocShell();
4733 if (pDocSh)
4734 return new ScTableSheetObj( pDocSh, aRange.aStart.Tab() );
4735
4736 OSL_FAIL("Document invalid");
4737 return nullptr;
4738}
4739
4740// XArrayFormulaRange
4741
4743{
4744 SolarMutexGuard aGuard;
4745
4746 // Matrix formula if clearly part of a matrix (so when start and end of
4747 // the block belong to the same matrix) else empty string.
4748
4749 ScDocShell* pDocSh = GetDocShell();
4750 if (!pDocSh)
4751 return OUString();
4752
4753 ScDocument& rDoc = pDocSh->GetDocument();
4754 ScRefCellValue aCell1(rDoc, aRange.aStart);
4755 ScRefCellValue aCell2(rDoc, aRange.aEnd);
4756 if (aCell1.getType() == CELLTYPE_FORMULA && aCell2.getType() == CELLTYPE_FORMULA)
4757 {
4758 const ScFormulaCell* pFCell1 = aCell1.getFormula();
4759 const ScFormulaCell* pFCell2 = aCell2.getFormula();
4760 ScAddress aStart1;
4761 ScAddress aStart2;
4762 if (pFCell1->GetMatrixOrigin(rDoc, aStart1) && pFCell2->GetMatrixOrigin(rDoc, aStart2))
4763 {
4764 if (aStart1 == aStart2) // both the same matrix
4765 return pFCell1->GetFormula(); // it doesn't matter from which cell
4766 }
4767 }
4768 return OUString();
4769}
4770
4771void ScCellRangeObj::SetArrayFormula_Impl(const OUString& rFormula,
4772 const formula::FormulaGrammar::Grammar eGrammar)
4773{
4774 ScDocShell* pDocSh = GetDocShell();
4775 if (!pDocSh)
4776 return;
4777
4778 if ( !rFormula.isEmpty() )
4779 {
4780 if ( dynamic_cast<ScTableSheetObj*>( this ) )
4781 {
4782 // don't set array formula for sheet object
4783 throw uno::RuntimeException();
4784 }
4785
4786 pDocSh->GetDocFunc().EnterMatrix( aRange, nullptr, nullptr, rFormula, true, true, OUString()/*rFormulaNmsp*/, eGrammar );
4787 }
4788 else
4789 {
4790 // empty string -> erase array formula
4791 ScMarkData aMark(GetDocument()->GetSheetLimits());
4792 aMark.SetMarkArea( aRange );
4793 aMark.SelectTable( aRange.aStart.Tab(), true );
4794 pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true );
4795 }
4796}
4797
4798void SAL_CALL ScCellRangeObj::setArrayFormula( const OUString& aFormula )
4799{
4800 SolarMutexGuard aGuard;
4801 // GRAM_API for API compatibility.
4803}
4804
4805// XArrayFormulaTokens
4806uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellRangeObj::getArrayTokens()
4807{
4808 SolarMutexGuard aGuard;
4809
4810 // same cell logic as in getArrayFormula
4811
4812 uno::Sequence<sheet::FormulaToken> aSequence;
4813 ScDocShell* pDocSh = GetDocShell();
4814 if (!pDocSh)
4815 return aSequence;
4816
4817 ScDocument& rDoc = pDocSh->GetDocument();
4818 ScRefCellValue aCell1(rDoc, aRange.aStart);
4819 ScRefCellValue aCell2(rDoc, aRange.aEnd);
4820 if (aCell1.getType() == CELLTYPE_FORMULA && aCell2.getType() == CELLTYPE_FORMULA)
4821 {
4822 const ScFormulaCell* pFCell1 = aCell1.getFormula();
4823 const ScFormulaCell* pFCell2 = aCell2.getFormula();
4824 ScAddress aStart1;
4825 ScAddress aStart2;
4826 if (pFCell1->GetMatrixOrigin(rDoc, aStart1) && pFCell2->GetMatrixOrigin(rDoc, aStart2))
4827 {
4828 if (aStart1 == aStart2)
4829 {
4830 const ScTokenArray* pTokenArray = pFCell1->GetCode();
4831 if (pTokenArray)
4832 ScTokenConversion::ConvertToTokenSequence(rDoc, aSequence, *pTokenArray);
4833 }
4834 }
4835 }
4836
4837 return aSequence;
4838}
4839
4840void SAL_CALL ScCellRangeObj::setArrayTokens( const uno::Sequence<sheet::FormulaToken>& rTokens )
4841{
4842 SolarMutexGuard aGuard;
4843 ScDocShell* pDocSh = GetDocShell();
4844 if ( !pDocSh )
4845 return;
4846
4847 if ( rTokens.hasElements() )
4848 {
4849 if ( dynamic_cast<ScTableSheetObj*>( this ) )
4850 {
4851 throw uno::RuntimeException();
4852 }
4853
4854 ScDocument& rDoc = pDocSh->GetDocument();
4855 ScTokenArray aTokenArray(rDoc);
4856 (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
4857
4858 // Actually GRAM_API is a don't-care here because of the token
4859 // array being set, it fits with other API compatibility grammars
4860 // though.
4861 pDocSh->GetDocFunc().EnterMatrix( aRange, nullptr, &aTokenArray, OUString(), true, true, OUString(), formula::FormulaGrammar::GRAM_API );
4862 }
4863 else
4864 {
4865 // empty sequence -> erase array formula
4866 ScMarkData aMark(pDocSh->GetDocument().GetSheetLimits());
4867 aMark.SetMarkArea( aRange );
4868 aMark.SelectTable( aRange.aStart.Tab(), true );
4869 pDocSh->GetDocFunc().DeleteContents( aMark, InsertDeleteFlags::CONTENTS, true, true );
4870 }
4871}
4872
4873// XCellRangeData
4874
4875uno::Sequence< uno::Sequence<uno::Any> > SAL_CALL ScCellRangeObj::getDataArray()
4876{
4877 SolarMutexGuard aGuard;
4878
4879 if ( dynamic_cast<ScTableSheetObj*>( this ) )
4880 {
4881 // don't create a data array for the sheet
4882 throw uno::RuntimeException();
4883 }
4884
4885 ScDocShell* pDocSh = GetDocShell();
4886 if (pDocSh)
4887 {
4888 uno::Any aAny;
4889 // bAllowNV = TRUE: errors as void
4890 if ( ScRangeToSequence::FillMixedArray( aAny, pDocSh->GetDocument(), aRange, true ) )
4891 {
4892 uno::Sequence< uno::Sequence<uno::Any> > aSeq;
4893 if ( aAny >>= aSeq )
4894 return aSeq; // success
4895 }
4896 }
4897
4898 throw uno::RuntimeException(); // no other exceptions specified
4899}
4900
4902 const uno::Sequence< uno::Sequence<uno::Any> >& aArray )
4903{
4904 SolarMutexGuard aGuard;
4905
4906 bool bDone = false;
4907 ScDocShell* pDocSh = GetDocShell();
4908 if (pDocSh)
4909 {
4911 bDone = lcl_PutDataArray( *pDocSh, aRange, aArray );
4912 }
4913
4914 if (!bDone)
4915 throw uno::RuntimeException(); // no other exceptions specified
4916}
4917
4918// XCellRangeFormula
4919
4920uno::Sequence< uno::Sequence<OUString> > SAL_CALL ScCellRangeObj::getFormulaArray()
4921{
4922 SolarMutexGuard aGuard;
4923
4924 if ( dynamic_cast<ScTableSheetObj*>( this ) )
4925 {
4926 // don't create a data array for the sheet
4927 throw uno::RuntimeException();
4928 }
4929
4930 ScDocShell* pDocSh = GetDocShell();
4931 if (pDocSh)
4932 {
4933 SCCOL nStartCol = aRange.aStart.Col();
4934 SCROW nStartRow = aRange.aStart.Row();
4935 SCCOL nEndCol = aRange.aEnd.Col();
4936 SCROW nEndRow = aRange.aEnd.Row();
4937 SCCOL nColCount = nEndCol + 1 - nStartCol;
4938 SCROW nRowCount = nEndRow + 1 - nStartRow;
4939 SCTAB nTab = aRange.aStart.Tab();
4940
4941 uno::Sequence< uno::Sequence<OUString> > aRowSeq( nRowCount );
4942 uno::Sequence<OUString>* pRowAry = aRowSeq.getArray();
4943 for (SCROW nRowIndex = 0; nRowIndex < nRowCount; nRowIndex++)
4944 {
4945 uno::Sequence<OUString> aColSeq( nColCount );
4946 OUString* pColAry = aColSeq.getArray();
4947 for (SCCOL nColIndex = 0; nColIndex < nColCount; nColIndex++)
4948 pColAry[nColIndex] = lcl_GetInputString( pDocSh->GetDocument(),
4949 ScAddress( nStartCol+nColIndex, nStartRow+nRowIndex, nTab ), true );
4950
4951 pRowAry[nRowIndex] = aColSeq;
4952 }
4953
4954 return aRowSeq;
4955 }
4956
4957 throw uno::RuntimeException(); // no other exceptions specified
4958}
4959
4961 const uno::Sequence< uno::Sequence<OUString> >& aArray )
4962{
4963 SolarMutexGuard aGuard;
4964
4965 bool bDone = false;
4966 ScDocShell* pDocSh = GetDocShell();
4967 if (pDocSh)
4968 {
4969 ScExternalRefManager::ApiGuard aExtRefGuard(pDocSh->GetDocument());
4970
4971 // GRAM_API for API compatibility.
4973 }
4974
4975 if (!bDone)
4976 throw uno::RuntimeException(); // no other exceptions specified
4977}
4978
4979// XMultipleOperation
4980
4981void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress& aFormulaRange,
4982 sheet::TableOperationMode nMode,
4983 const table::CellAddress& aColumnCell,
4984 const table::CellAddress& aRowCell )
4985{
4986 SolarMutexGuard aGuard;
4987 ScDocShell* pDocSh = GetDocShell();
4988 if (!pDocSh)
4989 return;
4990
4991 bool bError = false;
4992 ScTabOpParam aParam;
4993 aParam.aRefFormulaCell = ScRefAddress( static_cast<SCCOL>(aFormulaRange.StartColumn),
4994 static_cast<SCROW>(aFormulaRange.StartRow), aFormulaRange.Sheet );
4995 aParam.aRefFormulaEnd = ScRefAddress( static_cast<SCCOL>(aFormulaRange.EndColumn),
4996 static_cast<SCROW>(aFormulaRange.EndRow), aFormulaRange.Sheet );
4997 aParam.aRefRowCell = ScRefAddress( static_cast<SCCOL>(aRowCell.Column),
4998 static_cast<SCROW>(aRowCell.Row), aRowCell.Sheet );
4999 aParam.aRefColCell = ScRefAddress( static_cast<SCCOL>(aColumnCell.Column),
5000 static_cast<SCROW>(aColumnCell.Row), aColumnCell.Sheet );
5001
5002 switch (nMode)
5003 {
5004 case sheet::TableOperationMode_COLUMN:
5006 break;
5007 case sheet::TableOperationMode_ROW:
5008 aParam.meMode = ScTabOpParam::Row;
5009 break;
5010 case sheet::TableOperationMode_BOTH:
5011 aParam.meMode = ScTabOpParam::Both;
5012 break;
5013 default:
5014 bError = true;
5015 }
5016
5017 if (!bError)
5018 pDocSh->GetDocFunc().TabOp( aRange, nullptr, aParam, true, true );
5019}
5020
5021// XMergeable
5022
5023void SAL_CALL ScCellRangeObj::merge( sal_Bool bMerge )
5024{
5025 SolarMutexGuard aGuard;
5026 ScDocShell* pDocSh = GetDocShell();
5027 if ( !pDocSh )
5028 return;
5029
5030 ScCellMergeOption aMergeOption(
5032 aRange.aEnd.Col(), aRange.aEnd.Row(), false);
5033 aMergeOption.maTabs.insert(aRange.aStart.Tab());
5034 if ( bMerge )
5035 pDocSh->GetDocFunc().MergeCells( aMergeOption, false, true, true );
5036 else
5037 pDocSh->GetDocFunc().UnmergeCells( aMergeOption, true, nullptr );
5038
5040}
5041
5043{
5044 SolarMutexGuard aGuard;
5045 ScDocShell* pDocSh = GetDocShell();
5046 return pDocSh && pDocSh->GetDocument().HasAttrib( aRange, HasAttrFlags::Merged );
5047}
5048
5049// XCellSeries
5050
5051void SAL_CALL ScCellRangeObj::fillSeries( sheet::FillDirection nFillDirection,
5052 sheet::FillMode nFillMode, sheet::FillDateMode nFillDateMode,
5053 double fStep, double fEndValue )
5054{
5055 SolarMutexGuard aGuard;
5056 ScDocShell* pDocSh = GetDocShell();
5057 if ( !pDocSh )
5058 return;
5059
5060 bool bError = false;
5061
5062 FillDir eDir = FILL_TO_BOTTOM;
5063 switch (nFillDirection)
5064 {
5065 case sheet::FillDirection_TO_BOTTOM:
5066 eDir = FILL_TO_BOTTOM;
5067 break;
5068 case sheet::FillDirection_TO_RIGHT:
5069 eDir = FILL_TO_RIGHT;
5070 break;
5071 case sheet::FillDirection_TO_TOP:
5072 eDir = FILL_TO_TOP;
5073 break;
5074 case sheet::FillDirection_TO_LEFT:
5075 eDir = FILL_TO_LEFT;
5076 break;
5077 default:
5078 bError = true;
5079 }
5080
5081 FillCmd eCmd = FILL_SIMPLE;
5082 switch ( nFillMode )
5083 {
5084 case sheet::FillMode_SIMPLE:
5085 eCmd = FILL_SIMPLE;
5086 break;
5087 case sheet::FillMode_LINEAR:
5088 eCmd = FILL_LINEAR;
5089 break;
5090 case sheet::FillMode_GROWTH:
5091 eCmd = FILL_GROWTH;
5092 break;
5093 case sheet::FillMode_DATE:
5094 eCmd = FILL_DATE;
5095 break;
5096 case sheet::FillMode_AUTO:
5097 eCmd = FILL_AUTO;
5098 break;
5099 default:
5100 bError = true;
5101 }
5102
5103 FillDateCmd eDateCmd = FILL_DAY;
5104 switch ( nFillDateMode )
5105 {
5106 case sheet::FillDateMode_FILL_DATE_DAY:
5107 eDateCmd = FILL_DAY;
5108 break;
5109 case sheet::FillDateMode_FILL_DATE_WEEKDAY:
5110 eDateCmd = FILL_WEEKDAY;
5111 break;
5112 case sheet::FillDateMode_FILL_DATE_MONTH:
5113 eDateCmd = FILL_MONTH;
5114 break;
5115 case sheet::FillDateMode_FILL_DATE_YEAR:
5116 eDateCmd = FILL_YEAR;
5117 break;
5118 default:
5119 bError = true;
5120 }
5121
5122 if (!bError)
5123 pDocSh->GetDocFunc().FillSeries( aRange, nullptr, eDir, eCmd, eDateCmd,
5124 MAXDOUBLE, fStep, fEndValue, true );
5125}
5126
5127void SAL_CALL ScCellRangeObj::fillAuto( sheet::FillDirection nFillDirection,
5128 sal_Int32 nSourceCount )
5129{
5130 SolarMutexGuard aGuard;
5131 ScDocShell* pDocSh = GetDocShell();
5132 if ( !(pDocSh && nSourceCount) )
5133 return;
5134
5135 ScRange aSourceRange(aRange);
5136 SCCOLROW nCount = 0; // "Dest-Count"
5137 FillDir eDir = FILL_TO_BOTTOM;
5138 bool bError = false;
5139 switch (nFillDirection)
5140 {
5141 case sheet::FillDirection_TO_BOTTOM:
5142 aSourceRange.aEnd.SetRow( static_cast<SCROW>( aSourceRange.aStart.Row() + nSourceCount - 1 ) );
5143 nCount = aRange.aEnd.Row() - aSourceRange.aEnd.Row();
5144 eDir = FILL_TO_BOTTOM;
5145 break;
5146 case sheet::FillDirection_TO_RIGHT:
5147 aSourceRange.aEnd.SetCol( static_cast<SCCOL>( aSourceRange.aStart.Col() + nSourceCount - 1 ) );
5148 nCount = aRange.aEnd.Col() - aSourceRange.aEnd.Col();
5149 eDir = FILL_TO_RIGHT;
5150 break;
5151 case sheet::FillDirection_TO_TOP:
5152 aSourceRange.aStart.SetRow( static_cast<SCROW>( aSourceRange.aEnd.Row() - nSourceCount + 1 ) );
5153 nCount = aSourceRange.aStart.Row() - aRange.aStart.Row();
5154 eDir = FILL_TO_TOP;
5155 break;
5156 case sheet::FillDirection_TO_LEFT:
5157 aSourceRange.aStart.SetCol( static_cast<SCCOL>( aSourceRange.aEnd.Col() - nSourceCount + 1 ) );
5158 nCount = aSourceRange.aStart.Col() - aRange.aStart.Col();
5159 eDir = FILL_TO_LEFT;
5160 break;
5161 default:
5162 bError = true;
5163 }
5164 const ScDocument& rDoc = pDocSh->GetDocument();
5165 if (nCount < 0 || nCount > rDoc.MaxRow()) // overflow
5166 bError = true;
5167
5168 if (!bError)
5169 pDocSh->GetDocFunc().FillAuto( aSourceRange, nullptr, eDir, nCount, true );
5170}
5171
5172// XAutoFormattable
5173
5174void SAL_CALL ScCellRangeObj::autoFormat( const OUString& aName )
5175{
5176 SolarMutexGuard aGuard;
5177 ScDocShell* pDocSh = GetDocShell();
5178 if ( pDocSh )
5179 {
5181 ScAutoFormat::const_iterator it = pAutoFormat->find(aName);
5182 if (it == pAutoFormat->end())
5183 throw lang::IllegalArgumentException();
5184
5185 ScAutoFormat::const_iterator itBeg = pAutoFormat->begin();
5186 size_t nIndex = std::distance(itBeg, it);
5187 pDocSh->GetDocFunc().AutoFormat(aRange, nullptr, nIndex, true);
5188
5189 }
5190}
5191
5192// XSortable
5193
5194uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createSortDescriptor()
5195{
5196 SolarMutexGuard aGuard;
5197 ScSortParam aParam;
5198 ScDocShell* pDocSh = GetDocShell();
5199 if ( pDocSh )
5200 {
5201 // create DB-Area only during execution; API always the exact area
5203 if (pData)
5204 {
5205 pData->GetSortParam(aParam);
5206
5207 // SortDescriptor contains the counted fields inside the area
5208 ScRange aDBRange;
5209 pData->GetArea(aDBRange);
5210 SCCOLROW nFieldStart = aParam.bByRow ?
5211 static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
5212 static_cast<SCCOLROW>(aDBRange.aStart.Row());
5213 for (sal_uInt16 i=0; i<aParam.GetSortKeyCount(); i++)
5214 if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nFieldStart )
5215 aParam.maKeyState[i].nField -= nFieldStart;
5216 }
5217 }
5218
5219 uno::Sequence<beans::PropertyValue> aSeq( ScSortDescriptor::GetPropertyCount() );
5221 return aSeq;
5222}
5223
5224void SAL_CALL ScCellRangeObj::sort( const uno::Sequence<beans::PropertyValue>& aDescriptor )
5225{
5226 SolarMutexGuard aGuard;
5227 ScDocShell* pDocSh = GetDocShell();
5228 if (!pDocSh)
5229 return;
5230
5231 sal_uInt16 i;
5232 ScSortParam aParam;
5233 ScDBData* pData = pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
5234 if (pData)
5235 {
5236 // get old settings if not everything is set anew
5237 pData->GetSortParam(aParam);
5238 SCCOLROW nOldStart = aParam.bByRow ?
5239 static_cast<SCCOLROW>(aRange.aStart.Col()) :
5240 static_cast<SCCOLROW>(aRange.aStart.Row());
5241 for (i=0; i<aParam.GetSortKeyCount(); i++)
5242 if ( aParam.maKeyState[i].bDoSort && aParam.maKeyState[i].nField >= nOldStart )
5243 aParam.maKeyState[i].nField -= nOldStart;
5244 }
5245
5246 ScSortDescriptor::FillSortParam( aParam, aDescriptor );
5247
5248 // SortDescriptor contains the counted fields inside the area
5249 // ByRow can be changed during execution of FillSortParam
5250 SCCOLROW nFieldStart = aParam.bByRow ?
5251 static_cast<SCCOLROW>(aRange.aStart.Col()) :
5252 static_cast<SCCOLROW>(aRange.aStart.Row());
5253 SCCOLROW nFieldEnd = aParam.bByRow ?
5254 static_cast<SCCOLROW>(aRange.aEnd.Col()) :
5255 static_cast<SCCOLROW>(aRange.aEnd.Row());
5256 for (i=0; i<aParam.GetSortKeyCount(); i++)
5257 {
5258 aParam.maKeyState[i].nField += nFieldStart;
5259 // tdf#103632 - sanity check poorly behaved macros.
5260 if (aParam.maKeyState[i].nField > nFieldEnd)
5261 aParam.maKeyState[i].nField = nFieldEnd;
5262 }
5263
5264 SCTAB nTab = aRange.aStart.Tab();
5265 aParam.nCol1 = aRange.aStart.Col();
5266 aParam.nRow1 = aRange.aStart.Row();
5267 aParam.nCol2 = aRange.aEnd.Col();
5268 aParam.nRow2 = aRange.aEnd.Row();
5269
5270 pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
5271
5272 ScDBDocFunc aFunc(*pDocSh); // area must be created
5273 (void)aFunc.Sort( nTab, aParam, true, true, true );
5274}
5275
5276// XFilterable
5277
5278uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptor(
5279 sal_Bool bEmpty )
5280{
5281 SolarMutexGuard aGuard;
5282 ScDocShell* pDocSh = GetDocShell();
5284 if ( !bEmpty && pDocSh )
5285 {
5286 // create DB-Area only during execution; API always the exact area
5288 if (pData)
5289 {
5290 ScQueryParam aParam;
5291 pData->GetQueryParam(aParam);
5292 // FilterDescriptor contains the counted fields inside the area
5293 ScRange aDBRange;
5294 pData->GetArea(aDBRange);
5295 SCCOLROW nFieldStart = aParam.bByRow ?
5296 static_cast<SCCOLROW>(aDBRange.aStart.Col()) :
5297 static_cast<SCCOLROW>(aDBRange.aStart.Row());
5298 SCSIZE nCount = aParam.GetEntryCount();
5299 for (SCSIZE i=0; i<nCount; i++)
5300 {
5301 ScQueryEntry& rEntry = aParam.GetEntry(i);
5302 if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
5303 rEntry.nField -= nFieldStart;
5304 }
5305 pNew->SetParam(aParam);
5306 }
5307 }
5308 return pNew;
5309}
5310
5311void SAL_CALL ScCellRangeObj::filter( const uno::Reference<sheet::XSheetFilterDescriptor>& xDescriptor )
5312{
5313 SolarMutexGuard aGuard;
5314
5315 if (!xDescriptor.is()) return;
5316
5317 // This could be theoretically an unknown object, so only use the
5318 // public XSheetFilterDescriptor interface to copy the data into a
5319 // ScFilterDescriptor object:
5321
5322 ScDocShell* pDocSh = GetDocShell();
5324 uno::Reference< sheet::XSheetFilterDescriptor2 > xDescriptor2( xDescriptor, uno::UNO_QUERY );
5325 if ( xDescriptor2.is() )
5326 {
5327 xImpl->setFilterFields2( xDescriptor2->getFilterFields2() );
5328 }
5329 else
5330 {
5331 xImpl->setFilterFields( xDescriptor->getFilterFields() );
5332 }
5333 // the rest are now properties...
5334
5335 uno::Reference<beans::XPropertySet> xPropSet( xDescriptor, uno::UNO_QUERY );
5336 if (xPropSet.is())
5337 lcl_CopyProperties(*xImpl, *xPropSet);
5338
5339 if (!pDocSh)
5340 return;
5341
5342 ScQueryParam aParam = xImpl->GetParam();
5343 // FilterDescriptor contains the counted fields inside the area
5344 SCCOLROW nFieldStart = aParam.bByRow ?
5345 static_cast<SCCOLROW>(aRange.aStart.Col()) :
5346 static_cast<SCCOLROW>(aRange.aStart.Row());
5347 SCSIZE nCount = aParam.GetEntryCount();
5349 for (SCSIZE i=0; i<nCount; i++)
5350 {
5351 ScQueryEntry& rEntry = aParam.GetEntry(i);
5352 if (rEntry.bDoQuery)
5353 {
5354 rEntry.nField += nFieldStart;
5355 // dialog always shows the string -> must match the value
5357 rItems.resize(1);
5358 ScQueryEntry::Item& rItem = rItems.front();
5359 if (rItem.meType != ScQueryEntry::ByString)
5360 {
5361 OUString aStr;
5362 pDocSh->GetDocument().GetFormatTable()->GetInputLineString(rItem.mfVal, 0, aStr);
5363 rItem.maString = rPool.intern(aStr);
5364 }
5365 }
5366 }
5367
5368 SCTAB nTab = aRange.aStart.Tab();
5369 aParam.nCol1 = aRange.aStart.Col();
5370 aParam.nRow1 = aRange.aStart.Row();
5371 aParam.nCol2 = aRange.aEnd.Col();
5372 aParam.nRow2 = aRange.aEnd.Row();
5373
5374 pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
5375
5378
5379 ScDBDocFunc aFunc(*pDocSh);
5380 aFunc.Query( nTab, aParam, nullptr, true, true ); // area must be created
5381}
5382
5384
5385// XAdvancedFilterSource
5386
5387uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFilterDescriptorByObject(
5388 const uno::Reference<sheet::XSheetFilterable>& xObject )
5389{
5390 SolarMutexGuard aGuard;
5391
5392 // this here is not the area, which will be filtered, instead the area
5393 // with the query
5394
5395 uno::Reference<sheet::XCellRangeAddressable> xAddr( xObject, uno::UNO_QUERY );
5396
5397 ScDocShell* pDocSh = GetDocShell();
5398 if ( !pDocSh || !xAddr.is() )
5399 {
5400 OSL_FAIL("no document or no area");
5401 return nullptr;
5402 }
5403
5405
5407
5408 ScQueryParam aParam = pNew->GetParam();
5409 aParam.bHasHeader = true;
5410
5411 table::CellRangeAddress aDataAddress(xAddr->getRangeAddress());
5412 aParam.nCol1 = static_cast<SCCOL>(aDataAddress.StartColumn);
5413 aParam.nRow1 = static_cast<SCROW>(aDataAddress.StartRow);
5414 aParam.nCol2 = static_cast<SCCOL>(aDataAddress.EndColumn);
5415 aParam.nRow2 = static_cast<SCROW>(aDataAddress.EndRow);
5416 aParam.nTab = aDataAddress.Sheet;
5417
5418 ScDocument& rDoc = pDocSh->GetDocument();
5419 if (!rDoc.CreateQueryParam(aRange, aParam))
5420 return nullptr;
5421
5422 // FilterDescriptor contains the counted fields inside the area
5423 SCCOLROW nFieldStart = aParam.bByRow ?
5424 static_cast<SCCOLROW>(aDataAddress.StartColumn) :
5425 static_cast<SCCOLROW>(aDataAddress.StartRow);
5426 SCSIZE nCount = aParam.GetEntryCount();
5427 for (SCSIZE i=0; i<nCount; i++)
5428 {
5429 ScQueryEntry& rEntry = aParam.GetEntry(i);
5430 if (rEntry.bDoQuery && rEntry.nField >= nFieldStart)
5431 rEntry.nField -= nFieldStart;
5432 }
5433
5434 pNew->SetParam( aParam );
5435 return pNew;
5436}
5437
5438// XSubTotalSource
5439
5440uno::Reference<sheet::XSubTotalDescriptor> SAL_CALL ScCellRangeObj::createSubTotalDescriptor(
5441 sal_Bool bEmpty )
5442{
5443 SolarMutexGuard aGuard;
5445 ScDocShell* pDocSh = GetDocShell();
5446 if ( !bEmpty && pDocSh )
5447 {
5448 // create DB-Area only during execution; API always the exact area
5450 if (pData)
5451 {
5452 ScSubTotalParam aParam;
5453 pData->GetSubTotalParam(aParam);
5454 // SubTotalDescriptor contains the counted fields inside the area
5455 ScRange aDBRange;
5456 pData->GetArea(aDBRange);
5457 SCCOL nFieldStart = aDBRange.aStart.Col();
5458 for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
5459 {
5460 if ( aParam.bGroupActive[i] )
5461 {
5462 if ( aParam.nField[i] >= nFieldStart )
5463 aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] - nFieldStart );
5464 for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
5465 if ( aParam.pSubTotals[i][j] >= nFieldStart )
5466 aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] - nFieldStart );
5467 }
5468 }
5469 pNew->SetParam(aParam);
5470 }
5471 }
5472 return pNew;
5473}
5474
5476 const uno::Reference<sheet::XSubTotalDescriptor>& xDescriptor,
5477 sal_Bool bReplace)
5478{
5479 SolarMutexGuard aGuard;
5480
5481 if (!xDescriptor.is()) return;
5482
5483 ScDocShell* pDocSh = GetDocShell();
5485 dynamic_cast<ScSubTotalDescriptorBase*>( xDescriptor.get() );
5486
5487 if (!(pDocSh && pImp))
5488 return;
5489
5490 ScSubTotalParam aParam;
5491 pImp->GetData(aParam); // virtual method of base class
5492
5493 // SubTotalDescriptor contains the counted fields inside the area
5494 SCCOL nFieldStart = aRange.aStart.Col();
5495 for (sal_uInt16 i=0; i<MAXSUBTOTAL; i++)
5496 {
5497 if ( aParam.bGroupActive[i] )
5498 {
5499 aParam.nField[i] = sal::static_int_cast<SCCOL>( aParam.nField[i] + nFieldStart );
5500 for (SCCOL j=0; j<aParam.nSubTotals[i]; j++)
5501 aParam.pSubTotals[i][j] = sal::static_int_cast<SCCOL>( aParam.pSubTotals[i][j] + nFieldStart );
5502 }
5503 }
5504
5505 aParam.bReplace = bReplace;
5506
5507 SCTAB nTab = aRange.aStart.Tab();
5508 aParam.nCol1 = aRange.aStart.Col();
5509 aParam.nRow1 = aRange.aStart.Row();
5510 aParam.nCol2 = aRange.aEnd.Col();
5511 aParam.nRow2 = aRange.aEnd.Row();
5512
5513 pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
5514
5515 ScDBDocFunc aFunc(*pDocSh);
5516 aFunc.DoSubTotals( nTab, aParam, true, true ); // area must be created
5517}
5518
5520{
5521 SolarMutexGuard aGuard;
5522
5523 ScDocShell* pDocSh = GetDocShell();
5524 if (!pDocSh)
5525 return;
5526
5527 ScSubTotalParam aParam;
5529 if (pData)
5530 pData->GetSubTotalParam(aParam); // also keep field entries during remove
5531
5532 aParam.bRemoveOnly = true;
5533
5534 SCTAB nTab = aRange.aStart.Tab();
5535 aParam.nCol1 = aRange.aStart.Col();
5536 aParam.nRow1 = aRange.aStart.Row();
5537 aParam.nCol2 = aRange.aEnd.Col();
5538 aParam.nRow2 = aRange.aEnd.Row();
5539
5540 pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
5541
5542 ScDBDocFunc aFunc(*pDocSh);
5543 aFunc.DoSubTotals( nTab, aParam, true, true ); // are must be created
5544}
5545
5546uno::Sequence<beans::PropertyValue> SAL_CALL ScCellRangeObj::createImportDescriptor( sal_Bool bEmpty )
5547{
5548 SolarMutexGuard aGuard;
5549 ScImportParam aParam;
5550 ScDocShell* pDocSh = GetDocShell();
5551 if ( !bEmpty && pDocSh )
5552 {
5553 // create DB-Area only during execution; API always the exact area
5555 if (pData)
5556 pData->GetImportParam(aParam);
5557 }
5558
5559 uno::Sequence<beans::PropertyValue> aSeq( ScImportDescriptor::GetPropertyCount() );
5561 return aSeq;
5562}
5563
5564void SAL_CALL ScCellRangeObj::doImport( const uno::Sequence<beans::PropertyValue>& aDescriptor )
5565{
5566 SolarMutexGuard aGuard;
5567 ScDocShell* pDocSh = GetDocShell();
5568 if (!pDocSh)
5569 return;
5570
5571 ScImportParam aParam;
5572 ScImportDescriptor::FillImportParam( aParam, aDescriptor );
5573
5574 SCTAB nTab = aRange.aStart.Tab();
5575 aParam.nCol1 = aRange.aStart.Col();
5576 aParam.nRow1 = aRange.aStart.Row();
5577 aParam.nCol2 = aRange.aEnd.Col();
5578 aParam.nRow2 = aRange.aEnd.Row();
5579
5581
5582 pDocSh->GetDBData( aRange, SC_DB_MAKE, ScGetDBSelection::ForceMark ); // if needed create area
5583
5584 ScDBDocFunc aFunc(*pDocSh); // are must be created
5585 aFunc.DoImport( nTab, aParam, nullptr );
5586}
5587
5588// XCellFormatRangesSupplier
5589
5590uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getCellFormatRanges()
5591{
5592 SolarMutexGuard aGuard;
5593 ScDocShell* pDocSh = GetDocShell();
5594 if ( pDocSh )
5595 return new ScCellFormatsObj( pDocSh, aRange );
5596 return nullptr;
5597}
5598
5599// XUniqueCellFormatRangesSupplier
5600
5601uno::Reference<container::XIndexAccess> SAL_CALL ScCellRangeObj::getUniqueCellFormatRanges()
5602{
5603 SolarMutexGuard aGuard;
5604 ScDocShell* pDocSh = GetDocShell();
5605 if ( pDocSh )
5606 return new ScUniqueCellFormatsObj( pDocSh, aRange );
5607 return nullptr;
5608}
5609
5610// XPropertySet extended for Range-Properties
5611
5612uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellRangeObj::getPropertySetInfo()
5613{
5614 SolarMutexGuard aGuard;
5615 static uno::Reference<beans::XPropertySetInfo> aRef(
5617 return aRef;
5618}
5619
5621{
5622 // Range has only Position and Size in addition to ScCellRangesBase, both are ReadOnly
5623 // -> nothing to do here
5624
5625 ScCellRangesBase::SetOnePropertyValue( pEntry, aValue );
5626}
5627
5629{
5630 if ( !pEntry )
5631 return;
5632
5633 if ( pEntry->nWID == SC_WID_UNO_POS )
5634 {
5635 ScDocShell* pDocSh = GetDocShell();
5636 if (pDocSh)
5637 {
5638 // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
5639 tools::Rectangle aMMRect(pDocSh->GetDocument().GetMMRect(
5642 awt::Point aPos( aMMRect.Left(), aMMRect.Top() );
5643 rAny <<= aPos;
5644 }
5645 }
5646 else if ( pEntry->nWID == SC_WID_UNO_SIZE )
5647 {
5648 ScDocShell* pDocSh = GetDocShell();
5649 if (pDocSh)
5650 {
5651 // GetMMRect converts using HMM_PER_TWIPS, like the DrawingLayer
5652 tools::Rectangle aMMRect = pDocSh->GetDocument().GetMMRect(
5655 Size aSize(aMMRect.GetSize());
5656 awt::Size aAwtSize( aSize.Width(), aSize.Height() );
5657 rAny <<= aAwtSize;
5658 }
5659 }
5660 else
5661 ScCellRangesBase::GetOnePropertyValue( pEntry, rAny );
5662}
5663
5665{
5666 return pRangePropSet->getPropertyMap();
5667}
5668
5669// XServiceInfo
5670
5672{
5673 return "ScCellRangeObj";
5674}
5675
5676sal_Bool SAL_CALL ScCellRangeObj::supportsService( const OUString& rServiceName )
5677{
5678 return cppu::supportsService(this, rServiceName);
5679}
5680
5681uno::Sequence<OUString> SAL_CALL ScCellRangeObj::getSupportedServiceNames()
5682{
5688}
5689
5691{
5692 return lcl_GetEditPropertySet();
5693}
5694
5696{
5698}
5699
5701 ScCellRangeObj( pDocSh, ScRange(rP,rP) ),
5702 pCellPropSet( lcl_GetCellPropertySet() ),
5703 aCellPos( rP ),
5704 nActionLockCount( 0 )
5705{
5706 // pUnoText is allocated on demand (GetUnoText)
5707 // can't be aggregated because getString/setString is handled here
5708}
5709
5711{
5712 if (!mxUnoText.is())
5713 {
5714 mxUnoText.set(new ScCellTextObj(GetDocShell(), aCellPos));
5715 if (nActionLockCount)
5716 {
5717 ScCellEditSource* pEditSource =
5718 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
5719 if (pEditSource)
5720 pEditSource->SetDoUpdateData(false);
5721 }
5722 }
5723 return *mxUnoText;
5724}
5725
5727{
5728}
5729
5731{
5733
5734 const ScRangeList& rRanges = GetRangeList();
5735 OSL_ENSURE(rRanges.size() == 1, "What ranges ?!?!");
5736 if ( !rRanges.empty() )
5737 {
5738 aCellPos = rRanges[ 0 ].aStart;
5739 }
5740}
5741
5743{
5744 SC_QUERYINTERFACE( table::XCell )
5745 SC_QUERYINTERFACE( table::XCell2 )
5746 SC_QUERYINTERFACE( sheet::XFormulaTokens )
5747 SC_QUERYINTERFACE( sheet::XCellAddressable )
5748 SC_QUERYINTERFACE( text::XText )
5749 SC_QUERYINTERFACE( text::XSimpleText )
5750 SC_QUERYINTERFACE( text::XTextRange )
5751 SC_QUERYINTERFACE( container::XEnumerationAccess )
5752 SC_QUERYINTERFACE( container::XElementAccess )
5753 SC_QUERYINTERFACE( sheet::XSheetAnnotationAnchor )
5754 SC_QUERYINTERFACE( text::XTextFieldsSupplier )
5755 SC_QUERYINTERFACE( document::XActionLockable )
5756
5757 return ScCellRangeObj::queryInterface( rType );
5758}
5759
5760void SAL_CALL ScCellObj::acquire() noexcept
5761{
5763}
5764
5765void SAL_CALL ScCellObj::release() noexcept
5766{
5768}
5769
5770uno::Sequence<uno::Type> SAL_CALL ScCellObj::getTypes()
5771{
5772 static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences(
5774 uno::Sequence<uno::Type>
5775 {
5785 } );
5786 return aTypes;
5787}
5788
5789uno::Sequence<sal_Int8> SAL_CALL ScCellObj::getImplementationId()
5790{
5791 return css::uno::Sequence<sal_Int8>();
5792}
5793
5794// helper methods
5795
5796OUString ScCellObj::GetInputString_Impl(bool bEnglish) const // for getFormula / FormulaLocal
5797{
5798 if (GetDocShell())
5799 return lcl_GetInputString( GetDocShell()->GetDocument(), aCellPos, bEnglish );
5800 return OUString();
5801}
5802
5804{
5805 ScDocShell* pDocSh = GetDocShell();
5806 OUString aVal;
5807 if ( pDocSh )
5808 {
5809 ScDocument& rDoc = pDocSh->GetDocument();
5810 ScRefCellValue aCell(rDoc, aCellPos);
5811
5812 aVal = ScCellFormat::GetOutputString(rDoc, aCellPos, aCell);
5813 }
5814 return aVal;
5815}
5816
5817void ScCellObj::SetString_Impl(const OUString& rString, bool bInterpret, bool bEnglish)
5818{
5819 ScDocShell* pDocSh = GetDocShell();
5820 if ( pDocSh )
5821 {
5822 // GRAM_API for API compatibility.
5823 (void)pDocSh->GetDocFunc().SetCellText(
5824 aCellPos, rString, bInterpret, bEnglish, true, formula::FormulaGrammar::GRAM_API );
5825 }
5826}
5827
5829{
5830 ScDocShell* pDocSh = GetDocShell();
5831 if ( pDocSh )
5832 return pDocSh->GetDocument().GetValue( aCellPos );
5833
5834 return 0.0;
5835}
5836
5837void ScCellObj::SetValue_Impl(double fValue)
5838{
5839 ScDocShell* pDocSh = GetDocShell();
5840 if ( pDocSh )
5841 pDocSh->GetDocFunc().SetValueCell(aCellPos, fValue, false);
5842}
5843
5844// only for XML import
5845
5846void ScCellObj::InputEnglishString( const OUString& rText )
5847{
5848 // This is like a mixture of setFormula and property FormulaLocal:
5849 // The cell's number format is checked for "text", a new cell format may be set,
5850 // but all parsing is in English.
5851
5852 ScDocShell* pDocSh = GetDocShell();
5853 if (!pDocSh)
5854 return;
5855
5856 ScDocument& rDoc = pDocSh->GetDocument();
5857 SvNumberFormatter* pFormatter = rDoc.GetFormatTable();
5858 sal_uInt32 nOldFormat = rDoc.GetNumberFormat( aCellPos );
5859 if (pFormatter->GetType(nOldFormat) == SvNumFormatType::TEXT)
5860 {
5861 SetString_Impl(rText, false, false); // text cell
5862 return;
5863 }
5864
5865 ScDocFunc &rFunc = pDocSh->GetDocFunc();
5866
5867 ScInputStringType aRes =
5869
5871 {
5872 if ((nOldFormat % SV_COUNTRY_LANGUAGE_OFFSET) == 0 && aRes.mnFormatType != SvNumFormatType::ALL)
5873 {
5874 // apply a format for the recognized type and the old format's language
5875 sal_uInt32 nNewFormat = ScGlobal::GetStandardFormat(*pFormatter, nOldFormat, aRes.mnFormatType);
5876 if (nNewFormat != nOldFormat)
5877 {
5878 ScPatternAttr aPattern( rDoc.GetPool() );
5879 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) );
5880 // ATTR_LANGUAGE_FORMAT remains unchanged
5881 rFunc.ApplyAttributes( *GetMarkData(), aPattern, true );
5882 }
5883 }
5884 }
5885 switch (aRes.meType)
5886 {
5888 rFunc.SetFormulaCell(
5889 aCellPos,
5891 false);
5892 break;
5894 rFunc.SetValueCell(aCellPos, aRes.mfValue, false);
5895 break;
5897 rFunc.SetStringOrEditCell(aCellPos, aRes.maText, false);
5898 break;
5899 default:
5900 SetString_Impl(rText, false, false); // probably empty string
5901 }
5902}
5903
5904// XText
5905
5906uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursor()
5907{
5908 SolarMutexGuard aGuard;
5909 return new ScCellTextCursor( *this );
5910}
5911
5912uno::Reference<text::XTextCursor> SAL_CALL ScCellObj::createTextCursorByRange(
5913 const uno::Reference<text::XTextRange>& aTextPosition )
5914{
5915 SolarMutexGuard aGuard;
5917
5918 SvxUnoTextRangeBase* pRange = comphelper::getFromUnoTunnel<SvxUnoTextRangeBase>( aTextPosition );
5919 if(pRange)
5920 pCursor->SetSelection( pRange->GetSelection() );
5921 else
5922 {
5923 ScCellTextCursor* pOther = comphelper::getFromUnoTunnel<ScCellTextCursor>( aTextPosition );
5924 if(!pOther)
5925 throw uno::RuntimeException();
5926
5927 pCursor->SetSelection( pOther->GetSelection() );
5928
5929 }
5930
5931 return pCursor;
5932}
5933
5934OUString SAL_CALL ScCellObj::getString()
5935{
5936 SolarMutexGuard aGuard;
5937 return GetOutputString_Impl();
5938}
5939
5940void SAL_CALL ScCellObj::setString( const OUString& aText )
5941{
5942 SolarMutexGuard aGuard;
5943 SetString_Impl(aText, false, false); // always text
5944
5945 // don't create pUnoText here if not there
5946 if (mxUnoText.is())
5947 mxUnoText->SetSelection(ESelection( 0,0, 0,aText.getLength() ));
5948}
5949
5950void SAL_CALL ScCellObj::insertString( const uno::Reference<text::XTextRange>& xRange,
5951 const OUString& aString, sal_Bool bAbsorb )
5952{
5953 // special handling for ScCellTextCursor is no longer needed,
5954 // SvxUnoText::insertString checks for SvxUnoTextRangeBase instead of SvxUnoTextRange
5955
5956 SolarMutexGuard aGuard;
5957 GetUnoText().insertString(xRange, aString, bAbsorb);
5958}
5959
5960void SAL_CALL ScCellObj::insertControlCharacter( const uno::Reference<text::XTextRange>& xRange,
5961 sal_Int16 nControlCharacter, sal_Bool bAbsorb )
5962{
5963 SolarMutexGuard aGuard;
5964 GetUnoText().insertControlCharacter(xRange, nControlCharacter, bAbsorb);
5965}
5966
5967void SAL_CALL ScCellObj::insertTextContent( const uno::Reference<text::XTextRange >& xRange,
5968 const uno::Reference<text::XTextContent >& xContent,
5969 sal_Bool bAbsorb )
5970{
5971 SolarMutexGuard aGuard;
5972 ScDocShell* pDocSh = GetDocShell();
5973 if ( pDocSh && xContent.is() )
5974 {
5975 ScEditFieldObj* pCellField = dynamic_cast<ScEditFieldObj*>(xContent.get());
5976 SvxUnoTextRangeBase* pTextRange = comphelper::getFromUnoTunnel<ScCellTextCursor>( xRange );
5977
5978 if ( pCellField && !pCellField->IsInserted() && pTextRange )
5979 {
5980 SvxEditSource* pEditSource = pTextRange->GetEditSource();
5981 ESelection aSelection(pTextRange->GetSelection());
5982
5983 if (!bAbsorb)
5984 {
5985 // do not replace -> append
5986 aSelection.Adjust();
5987 aSelection.nStartPara = aSelection.nEndPara;
5988 aSelection.nStartPos = aSelection.nEndPos;
5989 }
5990
5991 if (pCellField->GetFieldType() == text::textfield::Type::TABLE)
5992 pCellField->setPropertyValue(SC_UNONAME_TABLEPOS, uno::Any(sal_Int32(aCellPos.Tab())));
5993
5994 SvxFieldItem aItem = pCellField->CreateFieldItem();
5995 SvxTextForwarder* pForwarder = pEditSource->GetTextForwarder();
5996 pForwarder->QuickInsertField( aItem, aSelection );
5997 pEditSource->UpdateData();
5998
5999 // new selection: a digit
6000 aSelection.Adjust();
6001 aSelection.nEndPara = aSelection.nStartPara;
6002 aSelection.nEndPos = aSelection.nStartPos + 1;
6003 uno::Reference<text::XTextRange> xParent(this);
6004 pCellField->InitDoc(
6005 xParent, std::make_unique<ScCellEditSource>(pDocSh, aCellPos), aSelection);
6006
6007 // for bAbsorb=FALSE, the new selection must be behind the inserted content
6008 // (the xml filter relies on this)
6009 if (!bAbsorb)
6010 aSelection.nStartPos = aSelection.nEndPos;
6011
6012 pTextRange->SetSelection( aSelection );
6013
6014 return;
6015 }
6016 }
6017 GetUnoText().insertTextContent(xRange, xContent, bAbsorb);
6018}
6019
6020void SAL_CALL ScCellObj::removeTextContent( const uno::Reference<text::XTextContent>& xContent )
6021{
6022 SolarMutexGuard aGuard;
6023 if ( xContent.is() )
6024 {
6025 ScEditFieldObj* pCellField = dynamic_cast<ScEditFieldObj*>(xContent.get());
6026 if ( pCellField && pCellField->IsInserted() )
6027 {
6029 pCellField->DeleteField();
6030 return;
6031 }
6032 }
6033 GetUnoText().removeTextContent(xContent);
6034}
6035
6036uno::Reference<text::XText> SAL_CALL ScCellObj::getText()
6037{
6038 return this;
6039}
6040
6041uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getStart()
6042{
6043 SolarMutexGuard aGuard;
6044 return GetUnoText().getStart();
6045}
6046
6047uno::Reference<text::XTextRange> SAL_CALL ScCellObj::getEnd()
6048{
6049 SolarMutexGuard aGuard;
6050 return GetUnoText().getEnd();
6051}
6052
6053uno::Reference<container::XEnumeration> SAL_CALL ScCellObj::createEnumeration()
6054{
6055 SolarMutexGuard aGuard;
6056 return GetUnoText().createEnumeration();
6057}
6058
6060{
6061 SolarMutexGuard aGuard;
6062 return GetUnoText().getElementType();
6063}
6064
6066{
6067 SolarMutexGuard aGuard;
6068 return GetUnoText().hasElements();
6069}
6070
6071// XCell
6072
6073OUString SAL_CALL ScCellObj::getFormula()
6074{
6075 SolarMutexGuard aGuard;
6076 return GetInputString_Impl( true /* English */ );
6077}
6078
6079void SAL_CALL ScCellObj::setFormula( const OUString& aFormula )
6080{
6081 SolarMutexGuard aGuard;
6082 SetString_Impl(aFormula, true, true); // Interpret as English
6083}
6084
6085double SAL_CALL ScCellObj::getValue()
6086{
6087 SolarMutexGuard aGuard;
6088 return GetValue_Impl();
6089}
6090
6091void SAL_CALL ScCellObj::setValue( double nValue )
6092{
6093 SolarMutexGuard aGuard;
6095}
6096
6097void SAL_CALL ScCellObj::setFormulaString( const OUString& aFormula)
6098{
6099 SolarMutexGuard aGuard;
6100 ScDocShell *pDocSh = GetDocShell();
6101 if( pDocSh )
6102 {
6103 ScFormulaCell* pCell = new ScFormulaCell( pDocSh->GetDocument(), aCellPos );
6105 pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pCell, false);
6106 }
6107}
6108void SAL_CALL ScCellObj::setFormulaResult( double nValue )
6109{
6110 SolarMutexGuard aGuard;
6111 ScDocShell* pDocSh = GetDocShell();
6112 if (pDocSh)
6113 {
6114 ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
6115 if (aCell.getType() == CELLTYPE_FORMULA)
6116 {
6117 ScFormulaCell* pCell = aCell.getFormula();
6118 pCell->SetHybridDouble( nValue );
6119 pCell->ResetDirty();
6120 pCell->SetChanged(false);
6121 }
6122 }
6123}
6124
6125table::CellContentType SAL_CALL ScCellObj::getType()
6126{
6127 SolarMutexGuard aGuard;
6128 table::CellContentType eRet = table::CellContentType_EMPTY;
6129 ScDocShell* pDocSh = GetDocShell();
6130 if (pDocSh)
6131 {
6132 CellType eCalcType = pDocSh->GetDocument().GetCellType( aCellPos );
6133 switch (eCalcType)
6134 {
6135 case CELLTYPE_VALUE:
6136 eRet = table::CellContentType_VALUE;
6137 break;
6138 case CELLTYPE_STRING:
6139 case CELLTYPE_EDIT:
6140 eRet = table::CellContentType_TEXT;
6141 break;
6142 case CELLTYPE_FORMULA:
6143 eRet = table::CellContentType_FORMULA;
6144 break;
6145 default:
6146 eRet = table::CellContentType_EMPTY;
6147 }
6148 }
6149 else
6150 {
6151 OSL_FAIL("no DocShell");
6152 }
6153
6154 return eRet;
6155}
6156
6158{
6159 SolarMutexGuard aGuard;
6160 sal_Int32 eRet = sheet::FormulaResult::STRING;
6161 ScDocShell* pDocSh = GetDocShell();
6162 if (pDocSh)
6163 {
6165 {
6166 ScFormulaCell* pFCell = pDocSh->GetDocument().GetFormulaCell(aCellPos);
6167 if (!pFCell)
6168 {
6169 // should throw instead of default string?
6170 }
6171 else if (pFCell->GetErrCode() != FormulaError::NONE )
6172 {
6173 eRet = sheet::FormulaResult::ERROR;
6174 }
6175 else if (pFCell->IsValue())
6176 {
6177 eRet = sheet::FormulaResult::VALUE;
6178 }
6179 else
6180 {
6181 eRet = sheet::FormulaResult::STRING;
6182 }
6183 }
6184 }
6185 else
6186 {
6187 OSL_FAIL("no DocShell");
6188 }
6189
6190 return eRet;
6191}
6192
6193table::CellContentType ScCellObj::GetContentType_Impl()
6194{
6195 ScDocShell* pDocSh = GetDocShell();
6196 if ( pDocSh )
6197 {
6198 ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
6199 if (aCell.getType() == CELLTYPE_FORMULA)
6200 {
6201 bool bValue = aCell.getFormula()->IsValue();
6202 return bValue ? table::CellContentType_VALUE : table::CellContentType_TEXT;
6203 }
6204 }
6205 return getType();
6206}
6207
6208sal_Int32 SAL_CALL ScCellObj::getError()
6209{
6210 SolarMutexGuard aGuard;
6211 ScDocShell* pDocSh = GetDocShell();
6212 if (!pDocSh)
6213 {
6214 OSL_FAIL("no DocShell");
6215 return 0;
6216 }
6217
6218 FormulaError nError = FormulaError::NONE;
6219 ScRefCellValue aCell(pDocSh->GetDocument(), aCellPos);
6220 if (aCell.getType() == CELLTYPE_FORMULA)
6221 nError = aCell.getFormula()->GetErrCode();
6222
6223 return static_cast<sal_Int32>(nError);
6224}
6225
6226// XFormulaTokens
6227
6228uno::Sequence<sheet::FormulaToken> SAL_CALL ScCellObj::getTokens()
6229{
6230 SolarMutexGuard aGuard;
6231 uno::Sequence<sheet::FormulaToken> aSequence;
6232 ScDocShell* pDocSh = GetDocShell();
6233 if (!pDocSh)
6234 return aSequence;
6235
6236 ScDocument& rDoc = pDocSh->GetDocument();
6237 ScRefCellValue aCell(rDoc, aCellPos);
6238 if (aCell.getType() == CELLTYPE_FORMULA)
6239 {
6240 ScTokenArray* pTokenArray = aCell.getFormula()->GetCode();
6241 if (pTokenArray)
6242 ScTokenConversion::ConvertToTokenSequence(rDoc, aSequence, *pTokenArray);
6243 }
6244 return aSequence;
6245}
6246
6247void SAL_CALL ScCellObj::setTokens( const uno::Sequence<sheet::FormulaToken>& rTokens )
6248{
6249 SolarMutexGuard aGuard;
6250 ScDocShell* pDocSh = GetDocShell();
6251 if ( pDocSh )
6252 {
6253 ScDocument& rDoc = pDocSh->GetDocument();
6254 ScTokenArray aTokenArray(rDoc);
6255 (void)ScTokenConversion::ConvertToTokenArray( rDoc, aTokenArray, rTokens );
6256
6257 ScFormulaCell* pNewCell = new ScFormulaCell(rDoc, aCellPos, aTokenArray);
6258 (void)pDocSh->GetDocFunc().SetFormulaCell(aCellPos, pNewCell, false);
6259 }
6260}
6261
6262// XCellAddressable
6263
6264table::CellAddress SAL_CALL ScCellObj::getCellAddress()
6265{
6266 SolarMutexGuard aGuard;
6267 table::CellAddress aAdr;
6268 aAdr.Sheet = aCellPos.Tab();
6269 aAdr.Column = aCellPos.Col();
6270 aAdr.Row = aCellPos.Row();
6271 return aAdr;
6272}
6273
6274// XSheetAnnotationAnchor
6275
6276uno::Reference<sheet::XSheetAnnotation> SAL_CALL ScCellObj::getAnnotation()
6277{
6278 SolarMutexGuard aGuard;
6279 ScDocShell* pDocSh = GetDocShell();
6280 if ( pDocSh )
6281 return new ScAnnotationObj( pDocSh, aCellPos );
6282
6283 OSL_FAIL("getAnnotation without DocShell");
6284 return nullptr;
6285}
6286
6287// XFieldTypesSupplier
6288
6289uno::Reference<container::XEnumerationAccess> SAL_CALL ScCellObj::getTextFields()
6290{
6291 SolarMutexGuard aGuard;
6292 ScDocShell* pDocSh = GetDocShell();
6293 if ( pDocSh )
6294 {
6295 uno::Reference<text::XTextRange> xContent(this);
6296 return new ScCellFieldsObj(xContent, pDocSh, aCellPos);
6297 }
6298
6299 return nullptr;
6300}
6301
6302uno::Reference<container::XNameAccess> SAL_CALL ScCellObj::getTextFieldMasters()
6303{
6304 // there is no such thing in Calc (?)
6305 return nullptr;
6306}
6307
6308// XPropertySet extended for Cell-Properties
6309
6310uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCellObj::getPropertySetInfo()
6311{
6312 SolarMutexGuard aGuard;
6313 static uno::Reference<beans::XPropertySetInfo> aRef(
6315 return aRef;
6316}
6317
6319{
6320 if ( !pEntry )
6321 return;
6322
6323 if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
6324 {
6325 OUString aStrVal;
6326 aValue >>= aStrVal;
6327 SetString_Impl(aStrVal, true, false); // interpret locally
6328 }
6329 else if ( pEntry->nWID == SC_WID_UNO_FORMRT || pEntry->nWID == SC_WID_UNO_FORMRT2
6330 || pEntry->nWID == SC_WID_UNO_CELLCONTENTTYPE )
6331 {
6332 // Read-Only
6334 }
6335 else
6336 ScCellRangeObj::SetOnePropertyValue( pEntry, aValue );
6337}
6338
6340{
6341 if ( !pEntry )
6342 return;
6343
6344 if ( pEntry->nWID == SC_WID_UNO_FORMLOC )
6345 {
6346 // sal_False = local
6347 rAny <<= GetInputString_Impl(false);
6348 }
6349 else if ( pEntry->nWID == SC_WID_UNO_FORMRT2 )
6350 {
6351 sal_Int32 eType = GetResultType_Impl();
6352 rAny <<= eType;
6353 }
6354 else if ( pEntry->nWID == SC_WID_UNO_CELLCONTENTTYPE || pEntry->nWID == SC_WID_UNO_FORMRT )
6355 {
6356 table::CellContentType eType = GetContentType_Impl();
6357 rAny <<= eType;
6358 }
6359 else
6361}
6362
6364{
6365 return pCellPropSet->getPropertyMap();
6366}
6367
6368// XServiceInfo
6369
6371{
6372 return "ScCellObj";
6373}
6374
6375sal_Bool SAL_CALL ScCellObj::supportsService( const OUString& rServiceName )
6376{
6377 return cppu::supportsService(this, rServiceName);
6378}
6379
6380uno::Sequence<OUString> SAL_CALL ScCellObj::getSupportedServiceNames()
6381{
6382 return {SCSHEETCELL_SERVICE,
6389}
6390
6391// XActionLockable
6392
6394{
6395 SolarMutexGuard aGuard;
6396 return nActionLockCount != 0;
6397}
6398
6400{
6401 SolarMutexGuard aGuard;
6402 if (!nActionLockCount)
6403 {
6404 if (mxUnoText.is())
6405 {
6406 ScCellEditSource* pEditSource =
6407 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6408 if (pEditSource)
6409 pEditSource->SetDoUpdateData(false);
6410 }
6411 }
6413}
6414
6416{
6417 SolarMutexGuard aGuard;
6418 if (nActionLockCount <= 0)
6419 return;
6420
6422 if (nActionLockCount)
6423 return;
6424
6425 if (mxUnoText.is())
6426 {
6427 ScCellEditSource* pEditSource =
6428 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6429 if (pEditSource)
6430 {
6431 pEditSource->SetDoUpdateData(true);
6432 if (pEditSource->IsDirty())
6433 pEditSource->UpdateData();
6434 }
6435 }
6436}
6437
6438void SAL_CALL ScCellObj::setActionLocks( sal_Int16 nLock )
6439{
6440 SolarMutexGuard aGuard;
6441 if (mxUnoText.is())
6442 {
6443 ScCellEditSource* pEditSource =
6444 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6445 if (pEditSource)
6446 {
6447 pEditSource->SetDoUpdateData(nLock == 0);
6448 if ((nActionLockCount > 0) && (nLock == 0) && pEditSource->IsDirty())
6449 pEditSource->UpdateData();
6450 }
6451 }
6452 nActionLockCount = nLock;
6453}
6454
6456{
6457 SolarMutexGuard aGuard;
6458 sal_uInt16 nRet(nActionLockCount);
6459 if (mxUnoText.is())
6460 {
6461 ScCellEditSource* pEditSource =
6462 static_cast<ScCellEditSource*> (mxUnoText->GetEditSource());
6463 if (pEditSource)
6464 {
6465 pEditSource->SetDoUpdateData(true);
6466 if (pEditSource->IsDirty())
6467 pEditSource->UpdateData();
6468 }
6469 }
6470 nActionLockCount = 0;
6471 return nRet;
6472}
6473
6475{
6476 const SCCOL nMaxcol = pDocSh ? pDocSh->GetDocument().MaxCol() : MAXCOL;
6477 const SCROW nMaxRow = pDocSh ? pDocSh->GetDocument().MaxRow() : MAXROW;
6478 return ScRange(0, 0, nTab, nMaxcol, nMaxRow, nTab);
6479}
6480
6482 ScCellRangeObj( pDocSh, MaxDocRange(pDocSh, nTab) ),
6483 pSheetPropSet(lcl_GetSheetPropertySet())
6484{
6485}
6486
6488{
6489}
6490
6492{
6493 ScDocument& rDoc = pDocSh->GetDocument();
6494 InitInsertRange( pDocSh, ScRange(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab) );
6495}
6496
6498{
6499 SC_QUERYINTERFACE( sheet::XSpreadsheet )
6500 SC_QUERYINTERFACE( container::XNamed )
6501 SC_QUERYINTERFACE( sheet::XSheetPageBreak )
6502 SC_QUERYINTERFACE( sheet::XCellRangeMovement )
6503 SC_QUERYINTERFACE( table::XTableChartsSupplier )
6504 SC_QUERYINTERFACE( sheet::XDataPilotTablesSupplier )
6505 SC_QUERYINTERFACE( sheet::XScenariosSupplier )
6506 SC_QUERYINTERFACE( sheet::XSheetAnnotationsSupplier )
6507 SC_QUERYINTERFACE( drawing::XDrawPageSupplier )
6508 SC_QUERYINTERFACE( sheet::XPrintAreas )
6509 SC_QUERYINTERFACE( sheet::XSheetAuditing )
6510 SC_QUERYINTERFACE( sheet::XSheetOutline )
6511 SC_QUERYINTERFACE( util::XProtectable )
6512 SC_QUERYINTERFACE( sheet::XScenario )
6513 SC_QUERYINTERFACE( sheet::XScenarioEnhanced )
6514 SC_QUERYINTERFACE( sheet::XSheetLinkable )
6515 SC_QUERYINTERFACE( sheet::XExternalSheetName )
6516 SC_QUERYINTERFACE( document::XEventsSupplier )
6517 SC_QUERYINTERFACE( table::XTablePivotChartsSupplier )
6518
6519 return ScCellRangeObj::queryInterface( rType );
6520}
6521
6522void SAL_CALL ScTableSheetObj::acquire() noexcept
6523{
6525}
6526
6527void SAL_CALL ScTableSheetObj::release() noexcept
6528{
6530}
6531
6532uno::Sequence<uno::Type> SAL_CALL ScTableSheetObj::getTypes()
6533{
6534 static const uno::Sequence<uno::Type> aTypes = comphelper::concatSequences(
6536 uno::Sequence<uno::Type>
6537 {
6557 } );
6558 return aTypes;
6559}
6560
6561uno::Sequence<sal_Int8> SAL_CALL ScTableSheetObj::getImplementationId()
6562{
6563 return css::uno::Sequence<sal_Int8>();
6564}
6565
6566// Helper functions
6567
6569{
6570 const ScRangeList& rRanges = GetRangeList();
6571 OSL_ENSURE(rRanges.size() == 1, "What ranges ?!?!");
6572 if ( !rRanges.empty() )
6573 {
6574 return rRanges[ 0 ].aStart.Tab();
6575 }
6576 return 0;
6577}
6578
6579// former XSheet
6580
6581uno::Reference<table::XTableCharts> SAL_CALL ScTableSheetObj::getCharts()
6582{
6583 SolarMutexGuard aGuard;
6584 ScDocShell* pDocSh = GetDocShell();
6585 if ( pDocSh )
6586 return new ScChartsObj( pDocSh, GetTab_Impl() );
6587
6588 OSL_FAIL("no document");
6589 return nullptr;
6590}
6591
6592uno::Reference<table::XTablePivotCharts> SAL_CALL ScTableSheetObj::getPivotCharts()
6593{
6594 SolarMutexGuard aGuard;
6595 ScDocShell* pDocSh = GetDocShell();
6596 if (pDocSh)
6597 return new sc::TablePivotCharts(pDocSh, GetTab_Impl());
6598
6599 OSL_FAIL("no document");
6600 return nullptr;
6601}
6602
6603uno::Reference<sheet::XDataPilotTables> SAL_CALL ScTableSheetObj::getDataPilotTables()
6604{
6605 SolarMutexGuard aGuard;
6606 ScDocShell* pDocSh = GetDocShell();
6607 if ( pDocSh )
6608 return new ScDataPilotTablesObj(*pDocSh, GetTab_Impl());
6609
6610 OSL_FAIL("no document");
6611 return nullptr;
6612}
6613
6614uno::Reference<sheet::XScenarios> SAL_CALL ScTableSheetObj::getScenarios()
6615{
6616 SolarMutexGuard aGuard;
6617 ScDocShell* pDocSh = GetDocShell();
6618
6619 if ( pDocSh )
6620 return new ScScenariosObj( pDocSh, GetTab_Impl() );
6621
6622 OSL_FAIL("no document");
6623 return nullptr;
6624}
6625
6626uno::Reference<sheet::XSheetAnnotations> SAL_CALL ScTableSheetObj::getAnnotations()
6627{
6628 SolarMutexGuard aGuard;
6629 ScDocShell* pDocSh = GetDocShell();
6630
6631 if ( pDocSh )
6632 return new ScAnnotationsObj( pDocSh, GetTab_Impl() );
6633
6634 OSL_FAIL("no document");
6635 return nullptr;
6636}
6637
6638uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByName(
6639 const OUString& rRange )
6640{
6641 SolarMutexGuard aGuard;
6642 return ScCellRangeObj::getCellRangeByName( rRange );
6643}
6644
6645uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursor()
6646{
6647 SolarMutexGuard aGuard;
6648 ScDocShell* pDocSh = GetDocShell();
6649 if ( pDocSh )
6650 {
6652 const ScDocument& rDoc = pDocSh->GetDocument();
6653 SCTAB nTab = GetTab_Impl();
6654 return new ScCellCursorObj( pDocSh, ScRange( 0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab ) );
6655 }
6656 return nullptr;
6657}
6658
6659uno::Reference<sheet::XSheetCellCursor> SAL_CALL ScTableSheetObj::createCursorByRange(
6660 const uno::Reference<sheet::XSheetCellRange>& xCellRange )
6661{
6662 SolarMutexGuard aGuard;
6663 ScDocShell* pDocSh = GetDocShell();
6664 if ( pDocSh && xCellRange.is() )
6665 {
6666 ScCellRangesBase* pRangesImp = dynamic_cast<ScCellRangesBase*>( xCellRange.get() );
6667 if (pRangesImp)
6668 {
6669 const ScRangeList& rRanges = pRangesImp->GetRangeList();
6670 SAL_WARN_IF( rRanges.size() != 1, "sc", "ScTableSheetObj::createCursorByRange: Range? Ranges?");
6671 if (rRanges.empty())
6672 return nullptr;
6673 return new ScCellCursorObj( pDocSh, rRanges[ 0 ] );
6674 }
6675 }
6676 return nullptr;
6677}
6678
6679// XSheetCellRange
6680
6681uno::Reference<sheet::XSpreadsheet> SAL_CALL ScTableSheetObj::getSpreadsheet()
6682{
6683 return this;
6684}
6685
6686// XCellRange
6687
6688uno::Reference<table::XCell> SAL_CALL ScTableSheetObj::getCellByPosition(
6689 sal_Int32 nColumn, sal_Int32 nRow )
6690{
6691 SolarMutexGuard aGuard;
6692 return ScCellRangeObj::GetCellByPosition_Impl(nColumn, nRow);
6693}
6694
6695uno::Reference<table::XCellRange> SAL_CALL ScTableSheetObj::getCellRangeByPosition(
6696 sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom )
6697{
6698 SolarMutexGuard aGuard;
6699 return ScCellRangeObj::getCellRangeByPosition(nLeft,nTop,nRight,nBottom);
6700}
6701
6702uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getColumnPageBreaks()
6703{
6704 SolarMutexGuard aGuard;
6705 ScDocShell* pDocSh = GetDocShell();
6706 if ( pDocSh )
6707 {
6708 ScDocument& rDoc = pDocSh->GetDocument();
6709 SCTAB nTab = GetTab_Impl();
6710
6711 Size aSize(rDoc.GetPageSize( nTab ));
6712 if (aSize.Width() && aSize.Height()) // effective size already set?
6713 rDoc.UpdatePageBreaks( nTab );
6714 else
6715 {
6716 // update breaks like in ScDocShell::PageStyleModified:
6717 ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
6718 aPrintFunc.UpdatePages();
6719 }
6720
6721 SCCOL nCount = 0;
6722 for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, rDoc.MaxCol()))
6723 if (rDoc.HasColBreak(nCol, nTab) != ScBreakType::NONE)
6724 ++nCount;
6725
6726 sheet::TablePageBreakData aData;
6727 uno::Sequence<sheet::TablePageBreakData> aSeq(nCount);
6728 sheet::TablePageBreakData* pAry = aSeq.getArray();
6729 sal_uInt16 nPos = 0;
6730 for (SCCOL nCol : rDoc.GetColumnsRange(nTab, 0, rDoc.MaxCol()))
6731 {
6732 ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
6733 if (nBreak != ScBreakType::NONE)
6734 {
6735 aData.Position = nCol;
6736 aData.ManualBreak = bool(nBreak & ScBreakType::Manual);
6737 pAry[nPos] = aData;
6738 ++nPos;
6739 }
6740 }
6741 return aSeq;
6742 }
6743 return {};
6744}
6745
6746uno::Sequence<sheet::TablePageBreakData> SAL_CALL ScTableSheetObj::getRowPageBreaks()
6747{
6748 SolarMutexGuard aGuard;
6749 ScDocShell* pDocSh = GetDocShell();
6750 if ( pDocSh )
6751 {
6752 ScDocument& rDoc = pDocSh->GetDocument();
6753 SCTAB nTab = GetTab_Impl();
6754
6755 Size aSize(rDoc.GetPageSize( nTab ));
6756 if (aSize.Width() && aSize.Height()) // effective size already set?
6757 rDoc.UpdatePageBreaks( nTab );
6758 else
6759 {
6760 // update breaks like in ScDocShell::PageStyleModified:
6761 ScPrintFunc aPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab );
6762 aPrintFunc.UpdatePages();
6763 }
6764 return rDoc.GetRowBreakData(nTab);
6765 }
6766 return {};
6767}
6768
6770{
6771 SolarMutexGuard aGuard;
6772 ScDocShell* pDocSh = GetDocShell();
6773 if ( !pDocSh )
6774 return;
6775
6777
6778 ScDocument& rDoc = pDocSh->GetDocument();
6779 bool bUndo (rDoc.IsUndoEnabled());
6780 SCTAB nTab = GetTab_Impl();
6781
6782 if (bUndo)
6783 {
6785 pUndoDoc->InitUndo( rDoc, nTab, nTab, true, true );
6786 rDoc.CopyToDocument(0,0,nTab, rDoc.MaxCol(),rDoc.MaxRow(),nTab, InsertDeleteFlags::NONE, false, *pUndoDoc);
6787 pDocSh->GetUndoManager()->AddUndoAction(
6788 std::make_unique<ScUndoRemoveBreaks>( pDocSh, nTab, std::move(pUndoDoc) ) );
6789 }
6790
6791 rDoc.RemoveManualBreaks(nTab);
6792 rDoc.UpdatePageBreaks(nTab);
6793
6794 //? UpdatePageBreakData( sal_True );
6795 pDocSh->SetDocumentModified();
6796 pDocSh->PostPaint(ScRange(0, 0, nTab, rDoc.MaxCol(), rDoc.MaxRow(), nTab), PaintPartFlags::Grid);
6797}
6798
6799// XNamed
6800
6801OUString SAL_CALL ScTableSheetObj::getName()
6802{
6803 SolarMutexGuard aGuard;
6804 OUString aName;
6805 ScDocShell* pDocSh = GetDocShell();
6806 if ( pDocSh )
6807 pDocSh->GetDocument().GetName( GetTab_Impl(), aName );
6808 return aName;
6809}
6810
6811void SAL_CALL ScTableSheetObj::setName( const OUString& aNewName )
6812{
6813 SolarMutexGuard aGuard;
6814 ScDocShell* pDocSh = GetDocShell();
6815 if ( pDocSh )
6816 {
6817 pDocSh->GetDocFunc().RenameTable( GetTab_Impl(), aNewName, true, true );
6818 }
6819}
6820
6821// XDrawPageSupplier
6822
6823uno::Reference<drawing::XDrawPage> SAL_CALL ScTableSheetObj::getDrawPage()
6824{
6825 SolarMutexGuard aGuard;
6826 ScDocShell* pDocSh = GetDocShell();
6827 if ( pDocSh )
6828 {
6829 ScDrawLayer* pDrawLayer = pDocSh->MakeDrawLayer();
6830 OSL_ENSURE(pDrawLayer,"Cannot create Draw-Layer");
6831
6832 SCTAB nTab = GetTab_Impl();
6833 SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nTab));
6834 OSL_ENSURE(pPage,"Draw-Page not found");
6835 if (pPage)
6836 return uno::Reference<drawing::XDrawPage> (pPage->getUnoPage(), uno::UNO_QUERY);
6837
6838 // The DrawPage object will register itself as a Listener at SdrModel
6839 // and should receive all action from there
6840 }
6841 return nullptr;
6842}
6843
6844// XCellMovement
6845
6846void SAL_CALL ScTableSheetObj::insertCells( const table::CellRangeAddress& rRangeAddress,
6847 sheet::CellInsertMode nMode )
6848{
6849 SolarMutexGuard aGuard;
6850 ScDocShell* pDocSh = GetDocShell();
6851 if ( !pDocSh )
6852 return;
6853
6854 bool bDo = true;
6855 InsCellCmd eCmd = INS_NONE;
6856 switch (nMode)
6857 {
6858 case sheet::CellInsertMode_NONE: bDo = false; break;
6859 case sheet::CellInsertMode_DOWN: eCmd = INS_CELLSDOWN; break;
6860 case sheet::CellInsertMode_RIGHT: eCmd = INS_CELLSRIGHT; break;
6861 case sheet::CellInsertMode_ROWS: eCmd = INS_INSROWS_BEFORE; break;
6862 case sheet::CellInsertMode_COLUMNS: eCmd = INS_INSCOLS_BEFORE; break;
6863 default:
6864 OSL_FAIL("insertCells: wrong mode");
6865 bDo = false;
6866 }
6867
6868 if (bDo)
6869 {
6870 OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
6871 ScRange aScRange;
6872 ScUnoConversion::FillScRange( aScRange, rRangeAddress );
6873 (void)pDocSh->GetDocFunc().InsertCells( aScRange, nullptr, eCmd, true, true );
6874 }
6875}
6876
6877void SAL_CALL ScTableSheetObj::removeRange( const table::CellRangeAddress& rRangeAddress,
6878 sheet::CellDeleteMode nMode )
6879{
6880 SolarMutexGuard aGuard;
6881 ScDocShell* pDocSh = GetDocShell();
6882 if ( !pDocSh )
6883 return;
6884
6885 bool bDo = true;
6887 switch (nMode)
6888 {
6889 case sheet::CellDeleteMode_NONE: bDo = false; break;
6890 case sheet::CellDeleteMode_UP: eCmd = DelCellCmd::CellsUp; break;
6891 case sheet::CellDeleteMode_LEFT: eCmd = DelCellCmd::CellsLeft; break;
6892 case sheet::CellDeleteMode_ROWS: eCmd = DelCellCmd::Rows; break;
6893 case sheet::CellDeleteMode_COLUMNS: eCmd = DelCellCmd::Cols; break;
6894 default:
6895 OSL_FAIL("deleteCells: wrong mode");
6896 bDo = false;
6897 }
6898
6899 if (bDo)
6900 {
6901 OSL_ENSURE( rRangeAddress.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
6902 ScRange aScRange;
6903 ScUnoConversion::FillScRange( aScRange, rRangeAddress );
6904 (void)pDocSh->GetDocFunc().DeleteCells( aScRange, nullptr, eCmd, true );
6905 }
6906}
6907
6908void SAL_CALL ScTableSheetObj::moveRange( const table::CellAddress& aDestination,
6909 const table::CellRangeAddress& aSource )
6910{
6911 SolarMutexGuard aGuard;
6912 ScDocShell* pDocSh = GetDocShell();
6913 if ( pDocSh )
6914 {
6915 OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
6916 ScRange aSourceRange;
6917 ScUnoConversion::FillScRange( aSourceRange, aSource );
6918 ScAddress aDestPos( static_cast<SCCOL>(aDestination.Column), static_cast<SCROW>(aDestination.Row), aDestination.Sheet );
6919 (void)pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, true, true, true, true );
6920 }
6921}
6922
6923void SAL_CALL ScTableSheetObj::copyRange( const table::CellAddress& aDestination,
6924 const table::CellRangeAddress& aSource )
6925{
6926 SolarMutexGuard aGuard;
6927 ScDocShell* pDocSh = GetDocShell();
6928 if ( pDocSh )
6929 {
6930 OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" );
6931 ScRange aSourceRange;
6932 ScUnoConversion::FillScRange( aSourceRange, aSource );
6933 ScAddress aDestPos( static_cast<SCCOL>(aDestination.Column), static_cast<SCROW>(aDestination.Row), aDestination.Sheet );
6934 (void)pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, false, true, true, true );
6935 }
6936}
6937
6938// XPrintAreas
6939
6940void ScTableSheetObj::PrintAreaUndo_Impl( std::unique_ptr<ScPrintRangeSaver> pOldRanges )
6941{
6942 // page break and undo
6943 ScDocShell* pDocSh = GetDocShell();
6944
6945 if(!pDocSh)
6946 return;
6947
6948 ScDocument& rDoc = pDocSh->GetDocument();
6949 const bool bUndo(rDoc.IsUndoEnabled());
6950 const SCTAB nTab(GetTab_Impl());
6951
6952 if(bUndo)
6953 {
6954 pDocSh->GetUndoManager()->AddUndoAction(
6955 std::make_unique<ScUndoPrintRange>(
6956 pDocSh,
6957 nTab,
6958 std::move(pOldRanges),
6959 rDoc.CreatePrintRangeSaver())); // create new ranges
6960 }
6961
6962 ScPrintFunc(pDocSh, pDocSh->GetPrinter(), nTab).UpdatePages();
6963 SfxBindings* pBindings = pDocSh->GetViewBindings();
6964
6965 if(pBindings)
6966 {
6967 pBindings->Invalidate(SID_DELETE_PRINTAREA);
6968 }
6969
6970 pDocSh->SetDocumentModified();
6971}
6972
6973uno::Sequence<table::CellRangeAddress> SAL_CALL ScTableSheetObj::getPrintAreas()
6974{
6975 SolarMutexGuard aGuard;
6976 ScDocShell* pDocSh = GetDocShell();
6977 if ( pDocSh )
6978 {
6979 ScDocument& rDoc = pDocSh->GetDocument();
6980 SCTAB nTab = GetTab_Impl();
6981 sal_uInt16 nCount = rDoc.GetPrintRangeCount( nTab );
6982
6983 table::CellRangeAddress aRangeAddress;
6984 uno::Sequence<table::CellRangeAddress> aSeq(nCount);
6985 table::CellRangeAddress* pAry = aSeq.getArray();
6986 for (sal_uInt16 i=0; i<nCount; i++)
6987 {
6988 const ScRange* pRange = rDoc.GetPrintRange( nTab, i );
6989 OSL_ENSURE(pRange,"where is the printing area");
6990 if (pRange)
6991 {
6992 ScUnoConversion::FillApiRange( aRangeAddress, *pRange );
6993 aRangeAddress.Sheet = nTab; // core does not care about sheet index
6994 pAry[i] = aRangeAddress;
6995 }
6996 }
6997 return aSeq;
6998 }
6999 return uno::Sequence<table::CellRangeAddress>();
7000}
7001
7003 const uno::Sequence<table::CellRangeAddress>& aPrintAreas )
7004{
7005 SolarMutexGuard aGuard;
7006 ScDocShell* pDocSh = GetDocShell();
7007 if ( !pDocSh )
7008 return;
7009
7010 std::unique_ptr<ScPrintRangeSaver> pOldRanges;
7011 ScDocument& rDoc = pDocSh->GetDocument();
7012 SCTAB nTab = GetTab_Impl();
7013
7014 if ( rDoc.IsUndoEnabled() )
7015 pOldRanges = rDoc.CreatePrintRangeSaver();
7016
7017 sal_uInt16 nCount = static_cast<sal_uInt16>(aPrintAreas.getLength());
7018 rDoc.ClearPrintRanges( nTab );
7019 if (nCount)
7020 {
7021 ScRange aPrintRange;
7022 for (const table::CellRangeAddress& rPrintArea : aPrintAreas)
7023 {
7024 ScUnoConversion::FillScRange( aPrintRange, rPrintArea );
7025 rDoc.AddPrintRange( nTab, aPrintRange );
7026 }
7027 }
7028
7029 if ( rDoc.IsUndoEnabled() )
7030 PrintAreaUndo_Impl( std::move(pOldRanges) ); // Undo, Page Breaks, Modified etc.
7031}
7032
7034{
7035 SolarMutexGuard aGuard;
7036 ScDocShell* pDocSh = GetDocShell();
7037 if ( pDocSh )
7038 {
7039 ScDocument& rDoc = pDocSh->GetDocument();
7040 SCTAB nTab = GetTab_Impl();
7041 return rDoc.GetRepeatColRange(nTab).has_value();
7042 }
7043 return false;
7044}
7045
7046void SAL_CALL ScTableSheetObj::setPrintTitleColumns( sal_Bool bPrintTitleColumns )
7047{
7048 SolarMutexGuard aGuard;
7049 ScDocShell* pDocSh = GetDocShell();
7050 if ( !pDocSh )
7051 return;
7052
7053 ScDocument& rDoc = pDocSh->GetDocument();
7054 SCTAB nTab = GetTab_Impl();
7055
7056 std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
7057
7058 if ( bPrintTitleColumns )
7059 {
7060 if ( !rDoc.GetRepeatColRange( nTab ) ) // do not change existing area
7061 {
7062 rDoc.SetRepeatColRange( nTab, ScRange( 0, 0, nTab, 0, 0, nTab ) ); // enable
7063 }
7064 }
7065 else
7066 rDoc.SetRepeatColRange( nTab, std::nullopt ); // disable
7067
7068 PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page break, modified etc.
7069
7071}
7072
7073table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleColumns()
7074{
7075 SolarMutexGuard aGuard;
7076 table::CellRangeAddress aRet;
7077 ScDocShell* pDocSh = GetDocShell();
7078 if ( pDocSh )
7079 {
7080 ScDocument& rDoc = pDocSh->GetDocument();
7081 SCTAB nTab = GetTab_Impl();
7082 std::optional<ScRange> oRange = rDoc.GetRepeatColRange(nTab);
7083 if (oRange)
7084 {
7085 ScUnoConversion::FillApiRange( aRet, *oRange );
7086 aRet.Sheet = nTab; // core does not care about sheet index
7087 }
7088 }
7089 return aRet;
7090}
7091
7092void SAL_CALL ScTableSheetObj::setTitleColumns( const table::CellRangeAddress& aTitleColumns )
7093{
7094 SolarMutexGuard aGuard;
7095 ScDocShell* pDocSh = GetDocShell();
7096 if ( !pDocSh )
7097 return;
7098
7099 ScDocument& rDoc = pDocSh->GetDocument();
7100 SCTAB nTab = GetTab_Impl();
7101
7102 std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
7103
7104 ScRange aNew;
7105 ScUnoConversion::FillScRange( aNew, aTitleColumns );
7106 rDoc.SetRepeatColRange( nTab, std::move(aNew) ); // also always enable
7107
7108 PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page breaks, modified etc.
7109}
7110
7112{
7113 SolarMutexGuard aGuard;
7114 ScDocShell* pDocSh = GetDocShell();
7115 if ( pDocSh )
7116 {
7117 ScDocument& rDoc = pDocSh->GetDocument();
7118 SCTAB nTab = GetTab_Impl();
7119 return rDoc.GetRepeatRowRange(nTab).has_value();
7120 }
7121 return false;
7122}
7123
7124void SAL_CALL ScTableSheetObj::setPrintTitleRows( sal_Bool bPrintTitleRows )
7125{
7126 SolarMutexGuard aGuard;
7127 ScDocShell* pDocSh = GetDocShell();
7128 if ( !pDocSh )
7129 return;
7130
7131 ScDocument& rDoc = pDocSh->GetDocument();
7132 SCTAB nTab = GetTab_Impl();
7133
7134 std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
7135
7136 if ( bPrintTitleRows )
7137 {
7138 if ( !rDoc.GetRepeatRowRange( nTab ) ) // do not change existing area
7139 {
7140 rDoc.SetRepeatRowRange( nTab, ScRange(0, 0, nTab, 0, 0, nTab) ); // enable
7141 }
7142 }
7143 else
7144 rDoc.SetRepeatRowRange( nTab, std::nullopt ); // disable
7145
7146 PrintAreaUndo_Impl( std::move(pOldRanges) ); // undo, page breaks, modified etc.
7147
7149}
7150
7151table::CellRangeAddress SAL_CALL ScTableSheetObj::getTitleRows()
7152{
7153 SolarMutexGuard aGuard;
7154 table::CellRangeAddress aRet;
7155 ScDocShell* pDocSh = GetDocShell();
7156 if ( pDocSh )
7157 {
7158 ScDocument& rDoc = pDocSh->GetDocument();
7159 SCTAB nTab = GetTab_Impl();
7160 std::optional<ScRange> oRange = rDoc.GetRepeatRowRange(nTab);
7161 if (oRange)
7162 {
7163 ScUnoConversion::FillApiRange( aRet, *oRange );
7164 aRet.Sheet = nTab; // core does not care about sheet index
7165 }
7166 }
7167 return aRet;
7168}
7169
7170void SAL_CALL ScTableSheetObj::setTitleRows( const table::CellRangeAddress& aTitleRows )
7171{
7172 SolarMutexGuard aGuard;
7173 ScDocShell* pDocSh = GetDocShell();
7174 if ( !pDocSh )
7175 return;
7176
7177 ScDocument& rDoc = pDocSh->GetDocument();
7178 SCTAB nTab = GetTab_Impl();
7179
7180 std::unique_ptr<ScPrintRangeSaver> pOldRanges = rDoc.CreatePrintRangeSaver();
7181
7182 ScRange aNew;
7183 ScUnoConversion::FillScRange( aNew, aTitleRows );
7184 rDoc.SetRepeatRowRange( nTab, std::move(aNew) ); // also always enable
7185
7186 PrintAreaUndo_Impl( std::move(pOldRanges) ); // Undo, page breaks, modified etc.
7187}
7188
7189// XSheetLinkable
7190
7191sheet::SheetLinkMode SAL_CALL ScTableSheetObj::getLinkMode()
7192{
7193 SolarMutexGuard aGuard;
7194 sheet::SheetLinkMode eRet = sheet::SheetLinkMode_NONE;
7195 ScDocShell* pDocSh = GetDocShell();
7196 if ( pDocSh )
7197 {
7198 ScLinkMode nMode = pDocSh->GetDocument().GetLinkMode( GetTab_Impl() );
7199 if ( nMode == ScLinkMode::NORMAL )
7200 eRet = sheet::SheetLinkMode_NORMAL;
7201 else if ( nMode == ScLinkMode::VALUE )
7202 eRet = sheet::SheetLinkMode_VALUE;
7203 }
7204 return eRet;
7205}
7206
7207void SAL_CALL ScTableSheetObj::setLinkMode( sheet::SheetLinkMode nLinkMode )
7208{
7209 SolarMutexGuard aGuard;
7210
7212
7213 OUString aUrl(getLinkUrl());
7214 OUString aSheet(getLinkSheetName());
7215
7216 link( aUrl, aSheet, "", "", nLinkMode );
7217}
7218
7220{
7221 SolarMutexGuard aGuard;
7222 OUString aFile;
7223 ScDocShell* pDocSh = GetDocShell();
7224 if ( pDocSh )
7225 aFile = pDocSh->GetDocument().GetLinkDoc( GetTab_Impl() );
7226 return aFile;
7227}
7228
7229void SAL_CALL ScTableSheetObj::setLinkUrl( const OUString& aLinkUrl )
7230{
7231 SolarMutexGuard aGuard;
7232
7234
7235 sheet::SheetLinkMode eMode = getLinkMode();
7236 OUString aSheet(getLinkSheetName());
7237
7238 link( aLinkUrl, aSheet, "", "", eMode );
7239}
7240
7242{
7243 SolarMutexGuard aGuard;
7244 OUString aSheet;
7245 ScDocShell* pDocSh = GetDocShell();
7246 if ( pDocSh )
7247 aSheet = pDocSh->GetDocument().GetLinkTab( GetTab_Impl() );
7248 return aSheet;
7249}
7250
7251void SAL_CALL ScTableSheetObj::setLinkSheetName( const OUString& aLinkSheetName )
7252{
7253 SolarMutexGuard aGuard;
7254
7256
7257 sheet::SheetLinkMode eMode = getLinkMode();
7258 OUString aUrl(getLinkUrl());
7259
7260 link( aUrl, aLinkSheetName, "", "", eMode );
7261}
7262
7263void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aSheetName,
7264 const OUString& aFilterName, const OUString& aFilterOptions,
7265 sheet::SheetLinkMode nMode )
7266{
7267 SolarMutexGuard aGuard;
7268 ScDocShell* pDocSh = GetDocShell();
7269 if ( !pDocSh )
7270 return;
7271
7272 ScDocument& rDoc = pDocSh->GetDocument();
7273 SCTAB nTab = GetTab_Impl();
7274
7275 OUString aFileString = aUrl;
7276 OUString aFilterString = aFilterName;
7277 OUString aOptString = aFilterOptions;
7278
7279 aFileString = ScGlobal::GetAbsDocName( aFileString, pDocSh );
7280 if (aFilterString.isEmpty())
7281 ScDocumentLoader::GetFilterName( aFileString, aFilterString, aOptString, true, false );
7282
7283 // remove application prefix from filter name here, so the filter options
7284 // aren't reset when the filter name is changed in ScTableLink::DataChanged
7285 ScDocumentLoader::RemoveAppPrefix( aFilterString );
7286
7287 ScLinkMode nLinkMode = ScLinkMode::NONE;
7288 if ( nMode == sheet::SheetLinkMode_NORMAL )
7289 nLinkMode = ScLinkMode::NORMAL;
7290 else if ( nMode == sheet::SheetLinkMode_VALUE )
7291 nLinkMode = ScLinkMode::VALUE;
7292
7293 rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetName, 0/*nRefresh*/ );
7294
7295 pDocSh->UpdateLinks(); // if needed add or delete link
7296 SfxBindings* pBindings = pDocSh->GetViewBindings();
7297 if (pBindings)
7298 pBindings->Invalidate(SID_LINKS);
7299
7301
7302 if ( !(nLinkMode != ScLinkMode::NONE && rDoc.IsExecuteLinkEnabled()) ) // update link
7303 return;
7304
7305 // Always update link also if already exists
7307
7308 sfx2::LinkManager* pLinkManager = rDoc.GetLinkManager();
7309 sal_uInt16 nCount = pLinkManager->GetLinks().size();
7310 for ( sal_uInt16 i=0; i<nCount; i++ )
7311 {
7312 ::sfx2::SvBaseLink* pBase = pLinkManager->GetLinks()[i].get();
7313 if (auto pTabLink = dynamic_cast<ScTableLink*>( pBase))
7314 {
7315 if ( aFileString == pTabLink->GetFileName() )
7316 pTabLink->Update(); // include Paint&Undo
7317
7319 }
7320 }
7321
7323}
7324
7325// XSheetAuditing
7326
7327sal_Bool SAL_CALL ScTableSheetObj::hideDependents( const table::CellAddress& aPosition )
7328{
7329 SolarMutexGuard aGuard;
7330 ScDocShell* pDocSh = GetDocShell();
7331 if ( pDocSh )
7332 {
7333 SCTAB nTab = GetTab_Impl();
7334 OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" );
7335 ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab );
7336 return pDocSh->GetDocFunc().DetectiveDelSucc( aPos );
7337 }
7338 return false;
7339}
7340
7341sal_Bool SAL_CALL ScTableSheetObj::hidePrecedents( const table::CellAddress& aPosition )
7342{
7343 SolarMutexGuard aGuard;
7344 ScDocShell* pDocSh = GetDocShell();
7345 if ( pDocSh )
7346 {
7347 SCTAB nTab = GetTab_Impl();
7348 OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" );
7349 ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab );
7350 return pDocSh->GetDocFunc().DetectiveDelPred( aPos );
7351 }
7352 return false;
7353}
7354
7355sal_Bool SAL_CALL ScTableSheetObj::showDependents( const table::CellAddress& aPosition )
7356{
7357 SolarMutexGuard aGuard;
7358 ScDocShell* pDocSh = GetDocShell();
7359 if ( pDocSh )
7360 {
7361 SCTAB nTab = GetTab_Impl();
7362 OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" );
7363 ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab );
7364 return pDocSh->GetDocFunc().DetectiveAddSucc( aPos );
7365 }
7366 return false;
7367}
7368
7369sal_Bool SAL_CALL ScTableSheetObj::showPrecedents( const table::CellAddress& aPosition )
7370{
7371 SolarMutexGuard aGuard;
7372 ScDocShell* pDocSh = GetDocShell();
7373 if ( pDocSh )
7374 {
7375 SCTAB nTab = GetTab_Impl();
7376 OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" );
7377 ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab );
7378 return pDocSh->GetDocFunc().DetectiveAddPred( aPos );
7379 }
7380 return false;
7381}
7382
7383sal_Bool SAL_CALL ScTableSheetObj::showErrors( const table::CellAddress& aPosition )
7384{
7385 SolarMutexGuard aGuard;
7386 ScDocShell* pDocSh = GetDocShell();
7387 if ( pDocSh )
7388 {
7389 SCTAB nTab = GetTab_Impl();
7390 OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" );
7391 ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab );
7392 return pDocSh->GetDocFunc().DetectiveAddError( aPos );
7393 }
7394 return false;
7395}
7396
7398{
7399 SolarMutexGuard aGuard;
7400 ScDocShell* pDocSh = GetDocShell();
7401 if ( pDocSh )
7402 return pDocSh->GetDocFunc().DetectiveMarkInvalid( GetTab_Impl() );
7403 return false;
7404}
7405
7407{
7408 SolarMutexGuard aGuard;
7409 ScDocShell* pDocSh = GetDocShell();
7410 if ( pDocSh )
7411 pDocSh->GetDocFunc().DetectiveDelAll( GetTab_Impl() );
7412}
7413
7414// XSheetOutline
7415
7416void SAL_CALL ScTableSheetObj::group( const table::CellRangeAddress& rGroupRange,
7417 table::TableOrientation nOrientation )
7418{
7419 SolarMutexGuard aGuard;
7420 ScDocShell* pDocSh = GetDocShell();
7421 if ( pDocSh )
7422 {
7423 bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7424 ScRange aGroupRange;
7425 ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
7426 ScOutlineDocFunc aFunc(*pDocSh);
7427 aFunc.MakeOutline( aGroupRange, bColumns, true, true );
7428 }
7429}
7430
7431void SAL_CALL ScTableSheetObj::ungroup( const table::CellRangeAddress& rGroupRange,
7432 table::TableOrientation nOrientation )
7433{
7434 SolarMutexGuard aGuard;
7435 ScDocShell* pDocSh = GetDocShell();
7436 if ( pDocSh )
7437 {
7438 bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7439 ScRange aGroupRange;
7440 ScUnoConversion::FillScRange( aGroupRange, rGroupRange );
7441 ScOutlineDocFunc aFunc(*pDocSh);
7442 aFunc.RemoveOutline( aGroupRange, bColumns, true, true );
7443 }
7444}
7445
7446void SAL_CALL ScTableSheetObj::autoOutline( const table::CellRangeAddress& rCellRange )
7447{
7448 SolarMutexGuard aGuard;
7449 ScDocShell* pDocSh = GetDocShell();
7450 if ( pDocSh )
7451 {
7452 ScRange aFormulaRange;
7453 ScUnoConversion::FillScRange( aFormulaRange, rCellRange );
7454 ScOutlineDocFunc aFunc(*pDocSh);
7455 aFunc.AutoOutline( aFormulaRange, true );
7456 }
7457}
7458
7460{
7461 SolarMutexGuard aGuard;
7462 ScDocShell* pDocSh = GetDocShell();
7463 if ( pDocSh )
7464 {
7465 SCTAB nTab = GetTab_Impl();
7466 ScOutlineDocFunc aFunc(*pDocSh);
7467 aFunc.RemoveAllOutlines( nTab, true );
7468 }
7469}
7470
7471void SAL_CALL ScTableSheetObj::hideDetail( const table::CellRangeAddress& rCellRange )
7472{
7473 SolarMutexGuard aGuard;
7474 ScDocShell* pDocSh = GetDocShell();
7475 if ( pDocSh )
7476 {
7477 ScRange aMarkRange;
7478 ScUnoConversion::FillScRange( aMarkRange, rCellRange );
7479 ScOutlineDocFunc aFunc(*pDocSh);
7480 aFunc.HideMarkedOutlines( aMarkRange, true );
7481 }
7482}
7483
7484void SAL_CALL ScTableSheetObj::showDetail( const table::CellRangeAddress& rCellRange )
7485{
7486 SolarMutexGuard aGuard;
7487 ScDocShell* pDocSh = GetDocShell();
7488 if ( pDocSh )
7489 {
7490 ScRange aMarkRange;
7491 ScUnoConversion::FillScRange( aMarkRange, rCellRange );
7492 ScOutlineDocFunc aFunc(*pDocSh);
7493 aFunc.ShowMarkedOutlines( aMarkRange, true );
7494 }
7495}
7496
7497void SAL_CALL ScTableSheetObj::showLevel( sal_Int16 nLevel, table::TableOrientation nOrientation )
7498{
7499 SolarMutexGuard aGuard;
7500 ScDocShell* pDocSh = GetDocShell();
7501 if ( pDocSh )
7502 {
7503 bool bColumns = ( nOrientation == table::TableOrientation_COLUMNS );
7504 SCTAB nTab = GetTab_Impl();
7505 ScOutlineDocFunc aFunc(*pDocSh);
7506 aFunc.SelectLevel( nTab, bColumns, nLevel, true, true );
7507 }
7508}
7509
7510// XProtectable
7511
7512void SAL_CALL ScTableSheetObj::protect( const OUString& aPassword )
7513{
7514 SolarMutexGuard aGuard;
7515 ScDocShell* pDocSh = GetDocShell();
7516 // #i108245# if already protected, don't change anything
7517 if ( pDocSh && !pDocSh->GetDocument().IsTabProtected( GetTab_Impl() ) )
7518 {
7519 pDocSh->GetDocFunc().Protect( GetTab_Impl(), aPassword );
7520 }
7521}
7522
7523void SAL_CALL ScTableSheetObj::unprotect( const OUString& aPassword )
7524{
7525 SolarMutexGuard aGuard;
7526 ScDocShell* pDocSh = GetDocShell();
7527 if ( pDocSh )
7528 {
7529 bool bDone = pDocSh->GetDocFunc().Unprotect( GetTab_Impl(), aPassword, true );
7530 if (!bDone)
7531 throw lang::IllegalArgumentException();
7532 }
7533}
7534
7536{
7537 SolarMutexGuard aGuard;
7538 ScDocShell* pDocSh = GetDocShell();
7539 if ( pDocSh )
7540 return pDocSh->GetDocument().IsTabProtected( GetTab_Impl() );
7541
7542 OSL_FAIL("no DocShell");
7543 return false;
7544}
7545
7546// XScenario
7547
7549{
7550 SolarMutexGuard aGuard;
7551 ScDocShell* pDocSh = GetDocShell();
7552 if ( pDocSh )
7553 return pDocSh->GetDocument().IsScenario( GetTab_Impl() );
7554
7555 return false;
7556}
7557
7559{
7560 SolarMutexGuard aGuard;
7561 ScDocShell* pDocSh = GetDocShell();
7562 if ( pDocSh )
7563 {
7564 OUString aComment;
7565 Color aColor;
7566 ScScenarioFlags nFlags;
7567 pDocSh->GetDocument().GetScenarioData( GetTab_Impl(), aComment, aColor, nFlags );
7568 return aComment;
7569 }
7570 return OUString();
7571}
7572
7573void SAL_CALL ScTableSheetObj::setScenarioComment( const OUString& aScenarioComment )
7574{
7575 SolarMutexGuard aGuard;
7576 ScDocShell* pDocSh = GetDocShell();
7577 if ( !pDocSh )
7578 return;
7579
7580 ScDocument& rDoc = pDocSh->GetDocument();
7581 SCTAB nTab = GetTab_Impl();
7582
7583 OUString aName;
7584 OUString aComment;
7585 Color aColor;
7586 ScScenarioFlags nFlags;
7587 rDoc.GetName( nTab, aName );
7588 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7589
7590 aComment = aScenarioComment;
7591
7592 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7593}
7594
7595void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAddress>& rScenRanges )
7596{
7597 SolarMutexGuard aGuard;
7598 ScDocShell* pDocSh = GetDocShell();
7599 if ( !pDocSh )
7600 return;
7601
7602 ScDocument& rDoc = pDocSh->GetDocument();
7603 SCTAB nTab = GetTab_Impl();
7604
7605 if (!rDoc.IsScenario(nTab))
7606 return;
7607
7608 ScMarkData aMarkData(rDoc.GetSheetLimits());
7609 aMarkData.SelectTable( nTab, true );
7610
7611 for (const table::CellRangeAddress& rRange : rScenRanges)
7612 {
7613 OSL_ENSURE( rRange.Sheet == nTab, "addRanges with wrong Tab" );
7614 ScRange aOneRange( static_cast<SCCOL>(rRange.StartColumn), static_cast<SCROW>(rRange.StartRow), nTab,
7615 static_cast<SCCOL>(rRange.EndColumn), static_cast<SCROW>(rRange.EndRow), nTab );
7616
7617 aMarkData.SetMultiMarkArea( aOneRange );
7618 }
7619
7620 // Scenario ranges are tagged with attribute
7621 ScPatternAttr aPattern( rDoc.GetPool() );
7623 aPattern.GetItemSet().Put( ScProtectionAttr( true ) );
7624 pDocSh->GetDocFunc().ApplyAttributes( aMarkData, aPattern, true );
7625}
7626
7628{
7629 SolarMutexGuard aGuard;
7630 ScDocShell* pDocSh = GetDocShell();
7631 if ( !pDocSh )
7632 return;
7633
7634 ScDocument& rDoc = pDocSh->GetDocument();
7635 SCTAB nTab = GetTab_Impl();
7636 OUString aName;
7637 rDoc.GetName( nTab, aName ); // scenario name
7638
7639 SCTAB nDestTab = nTab;
7640 while ( nDestTab > 0 && rDoc.IsScenario(nDestTab) )
7641 --nDestTab;
7642
7643 if ( !rDoc.IsScenario(nDestTab) )
7644 pDocSh->UseScenario( nDestTab, aName );
7645
7647}
7648
7649// XScenarioEnhanced
7650
7651uno::Sequence< table::CellRangeAddress > SAL_CALL ScTableSheetObj::getRanges( )
7652{
7653 SolarMutexGuard aGuard;
7654 ScDocShell* pDocSh = GetDocShell();
7655 if ( pDocSh )
7656 {
7657 ScDocument& rDoc = pDocSh->GetDocument();
7658 SCTAB nTab = GetTab_Impl();
7659 const ScRangeList* pRangeList = rDoc.GetScenarioRanges(nTab);
7660 if (pRangeList)
7661 {
7662 size_t nCount = pRangeList->size();
7663 uno::Sequence< table::CellRangeAddress > aRetRanges( nCount );
7664 table::CellRangeAddress* pAry = aRetRanges.getArray();
7665 for( size_t nIndex = 0; nIndex < nCount; nIndex++ )
7666 {
7667 const ScRange & rRange = (*pRangeList)[nIndex];
7668 pAry->StartColumn = rRange.aStart.Col();
7669 pAry->StartRow = rRange.aStart.Row();
7670 pAry->EndColumn = rRange.aEnd.Col();
7671 pAry->EndRow = rRange.aEnd.Row();
7672 pAry->Sheet = rRange.aStart.Tab();
7673 ++pAry;
7674 }
7675 return aRetRanges;
7676 }
7677 }
7678 return uno::Sequence< table::CellRangeAddress > ();
7679}
7680
7681// XExternalSheetName
7682
7683void ScTableSheetObj::setExternalName( const OUString& aUrl, const OUString& aSheetName )
7684{
7685 SolarMutexGuard aGuard;
7686 ScDocShell* pDocSh = GetDocShell();
7687 if ( pDocSh )
7688 {
7689 ScDocument& rDoc = pDocSh->GetDocument();
7690 const SCTAB nTab = GetTab_Impl();
7691 const OUString aAbsDocName( ScGlobal::GetAbsDocName( aUrl, pDocSh ) );
7692 const OUString aDocTabName( ScGlobal::GetDocTabName( aAbsDocName, aSheetName ) );
7693 if ( !rDoc.RenameTab( nTab, aDocTabName, true /*bExternalDocument*/ ) )
7694 {
7695 throw container::ElementExistException( OUString(), *this );
7696 }
7697 }
7698}
7699
7700// XEventsSupplier
7701
7702uno::Reference<container::XNameReplace> SAL_CALL ScTableSheetObj::getEvents()
7703{
7704 SolarMutexGuard aGuard;
7705 ScDocShell* pDocSh = GetDocShell();
7706 if ( pDocSh )
7707 return new ScSheetEventsObj( pDocSh, GetTab_Impl() );
7708
7709 return nullptr;
7710}
7711
7712// XPropertySet extended for Sheet-Properties
7713
7714uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableSheetObj::getPropertySetInfo()
7715{
7716 SolarMutexGuard aGuard;
7717 static uno::Reference<beans::XPropertySetInfo> aRef(
7719 return aRef;
7720}
7721
7723{
7724 if ( !pEntry )
7725 return;
7726
7727 if ( IsScItemWid( pEntry->nWID ) )
7728 {
7729 // for Item WIDs, call ScCellRangesBase directly
7730 ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
7731 return;
7732 }
7733
7734 // own properties
7735
7736 ScDocShell* pDocSh = GetDocShell();
7737 if (!pDocSh)
7738 return;
7739 ScDocument& rDoc = pDocSh->GetDocument();
7740 SCTAB nTab = GetTab_Impl();
7741 ScDocFunc &rFunc = pDocSh->GetDocFunc();
7742
7743 if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
7744 {
7745 OUString aStrVal;
7746 aValue >>= aStrVal;
7748 aStrVal, SfxStyleFamily::Page ));
7749
7751
7752 if ( rDoc.GetPageStyle( nTab ) != aNewStr )
7753 {
7754 rDoc.SetPageStyle( nTab, aNewStr );
7755 if (!rDoc.IsImportingXML())
7756 {
7757 ScPrintFunc( pDocSh, pDocSh->GetPrinter(), nTab ).UpdatePages();
7758
7759 SfxBindings* pBindings = pDocSh->GetViewBindings();
7760 if (pBindings)
7761 {
7762 pBindings->Invalidate( SID_STYLE_FAMILY4 );
7763 pBindings->Invalidate( SID_STATUS_PAGESTYLE );
7764 pBindings->Invalidate( FID_RESET_PRINTZOOM );
7765 pBindings->Invalidate( SID_ATTR_PARA_LEFT_TO_RIGHT );
7766 pBindings->Invalidate( SID_ATTR_PARA_RIGHT_TO_LEFT );
7767 }
7768 }
7769 pDocSh->SetDocumentModified();
7770 }
7771 }
7772 else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
7773 {
7774 bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
7775 rFunc.SetTableVisible( nTab, bVis, true );
7776 }
7777 else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
7778 {
7779 if (rDoc.IsScenario(nTab))
7781 }
7782 else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
7783 {
7784 if (rDoc.IsScenario(nTab))
7785 {
7786 Color aColor;
7787 if (aValue >>= aColor)
7788 {
7789 OUString aName;
7790 OUString aComment;
7791 ScScenarioFlags nFlags;
7792 Color aTmp;
7793 rDoc.GetName( nTab, aName );
7794 rDoc.GetScenarioData( nTab, aComment, aTmp, nFlags );
7795
7796 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7797 }
7798 }
7799 }
7800 else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
7801 {
7802 if (rDoc.IsScenario(nTab))
7803 {
7804 OUString aName;
7805 OUString aComment;
7806 Color aColor;
7807 ScScenarioFlags nFlags;
7808 rDoc.GetName( nTab, aName );
7809 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7810 bool bModify(false);
7811
7813 {
7814 if (!(nFlags & ScScenarioFlags::Protected))
7815 {
7817 bModify = true;
7818 }
7819 }
7820 else
7821 {
7822 if (nFlags & ScScenarioFlags::Protected)
7823 {
7825 bModify = true;
7826 }
7827 }
7828
7829 if (bModify)
7830 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7831 }
7832 }
7833 else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
7834 {
7835 if (rDoc.IsScenario(nTab))
7836 {
7837 OUString aName;
7838 OUString aComment;
7839 Color aColor;
7840 ScScenarioFlags nFlags;
7841 rDoc.GetName( nTab, aName );
7842 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7843 bool bModify(false);
7844
7846 {
7847 if (!(nFlags & ScScenarioFlags::ShowFrame))
7848 {
7850 bModify = true;
7851 }
7852 }
7853 else
7854 {
7855 if (nFlags & ScScenarioFlags::ShowFrame)
7856 {
7858 bModify = true;
7859 }
7860 }
7861
7862 if (bModify)
7863 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7864 }
7865 }
7866 else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
7867 {
7868 if (rDoc.IsScenario(nTab))
7869 {
7870 OUString aName;
7871 OUString aComment;
7872 Color aColor;
7873 ScScenarioFlags nFlags;
7874 rDoc.GetName( nTab, aName );
7875 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7876 bool bModify(false);
7877
7879 {
7880 if (!(nFlags & ScScenarioFlags::PrintFrame))
7881 {
7883 bModify = true;
7884 }
7885 }
7886 else
7887 {
7888 if (nFlags & ScScenarioFlags::PrintFrame)
7889 {
7891 bModify = true;
7892 }
7893 }
7894
7895 if (bModify)
7896 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7897 }
7898 }
7899 else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
7900 {
7901 if (rDoc.IsScenario(nTab))
7902 {
7903 OUString aName;
7904 OUString aComment;
7905 Color aColor;
7906 ScScenarioFlags nFlags;
7907 rDoc.GetName( nTab, aName );
7908 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7909 bool bModify(false);
7910
7912 {
7913 if (!(nFlags & ScScenarioFlags::TwoWay))
7914 {
7915 nFlags |= ScScenarioFlags::TwoWay;
7916 bModify = true;
7917 }
7918 }
7919 else
7920 {
7921 if (nFlags & ScScenarioFlags::TwoWay)
7922 {
7923 nFlags &= ~ScScenarioFlags::TwoWay;
7924 bModify = true;
7925 }
7926 }
7927
7928 if (bModify)
7929 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7930 }
7931 }
7932 else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
7933 {
7934 if (rDoc.IsScenario(nTab))
7935 {
7936 OUString aName;
7937 OUString aComment;
7938 Color aColor;
7939 ScScenarioFlags nFlags;
7940 rDoc.GetName( nTab, aName );
7941 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7942 bool bModify(false);
7943
7945 {
7946 if (!(nFlags & ScScenarioFlags::Attrib))
7947 {
7948 nFlags |= ScScenarioFlags::Attrib;
7949 bModify = true;
7950 }
7951 }
7952 else
7953 {
7954 if (nFlags & ScScenarioFlags::Attrib)
7955 {
7956 nFlags &= ~ScScenarioFlags::Attrib;
7957 bModify = true;
7958 }
7959 }
7960
7961 if (bModify)
7962 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7963 }
7964 }
7965 else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
7966 {
7967 if (rDoc.IsScenario(nTab))
7968 {
7969 OUString aName;
7970 OUString aComment;
7971 Color aColor;
7972 ScScenarioFlags nFlags;
7973 rDoc.GetName( nTab, aName );
7974 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
7975 bool bModify(false);
7976
7978 {
7979 if (nFlags & ScScenarioFlags::Value)
7980 {
7981 nFlags &= ~ScScenarioFlags::Value;
7982 bModify = true;
7983 }
7984 }
7985 else
7986 {
7987 if (!(nFlags & ScScenarioFlags::Value))
7988 {
7989 nFlags |= ScScenarioFlags::Value;
7990 bModify = true;
7991 }
7992 }
7993
7994 if (bModify)
7995 pDocSh->ModifyScenario( nTab, aName, aComment, aColor, nFlags );
7996 }
7997 }
7998 else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
7999 {
8000 sal_Int16 nValue = 0;
8001 if (aValue >>= nValue)
8002 {
8003 if (nValue == css::text::WritingMode2::RL_TB)
8004 rFunc.SetLayoutRTL(nTab, true);
8005 else
8006 rFunc.SetLayoutRTL(nTab, false);
8007 }
8008 }
8009 else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
8010 {
8011 bool bAutoPrint = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8012 if (bAutoPrint)
8013 rDoc.SetPrintEntireSheet( nTab ); // clears all print ranges
8014 else
8015 {
8016 if (rDoc.IsPrintEntireSheet( nTab ))
8017 rDoc.ClearPrintRanges( nTab ); // if this flag is true, there are no PrintRanges, so Clear clears only the flag.
8018 }
8019 }
8020 else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
8021 {
8022 Color aColor = COL_AUTO;
8023 if ( aValue >>= aColor )
8024 {
8025 if ( rDoc.GetTabBgColor( nTab ) != aColor )
8026 rFunc.SetTabBgColor( nTab, aColor, true, true );
8027 }
8028 }
8029 else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
8030 {
8031 OUString aCodeName;
8032 if (aValue >>= aCodeName)
8033 {
8034 pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName );
8035 }
8036 }
8037 else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
8038 {
8039 uno::Reference<sheet::XConditionalFormats> xCondFormat;
8040 if (aValue >>= xCondFormat)
8041 {
8042 // how to set the format correctly
8043 }
8044 }
8045 else
8046 ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8047}
8048
8050 uno::Any& rAny )
8051{
8052 if ( !pEntry )
8053 return;
8054
8055 ScDocShell* pDocSh = GetDocShell();
8056 if (!pDocSh)
8057 throw uno::RuntimeException();
8058 ScDocument& rDoc = pDocSh->GetDocument();
8059 SCTAB nTab = GetTab_Impl();
8060
8061 if ( pEntry->nWID == SC_WID_UNO_NAMES )
8062 {
8063 rAny <<= uno::Reference<sheet::XNamedRanges>(new ScLocalNamedRangesObj(pDocSh, this));
8064 }
8065 else if ( pEntry->nWID == SC_WID_UNO_PAGESTL )
8066 {
8068 rDoc.GetPageStyle( nTab ), SfxStyleFamily::Page );
8069 }
8070 else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8071 {
8072 bool bVis = rDoc.IsVisible( nTab );
8073 rAny <<= bVis;
8074 }
8075 else if ( pEntry->nWID == SC_WID_UNO_LINKDISPBIT )
8076 {
8077 // no target bitmaps for individual entries (would be all equal)
8078 // ScLinkTargetTypeObj::SetLinkTargetBitmap( aAny, SC_LINKTARGETTYPE_SHEET );
8079 }
8080 else if ( pEntry->nWID == SC_WID_UNO_LINKDISPNAME )
8081 {
8082 // LinkDisplayName for hyperlink dialog
8083 rAny <<= getName(); // sheet name
8084 }
8085 else if ( pEntry->nWID == SC_WID_UNO_ISACTIVE )
8086 {
8087 if (rDoc.IsScenario(nTab))
8088 rAny <<= rDoc.IsActiveScenario( nTab );
8089 }
8090 else if ( pEntry->nWID == SC_WID_UNO_BORDCOL )
8091 {
8092 if (rDoc.IsScenario(nTab))
8093 {
8094 OUString aComment;
8095 Color aColor;
8096 ScScenarioFlags nFlags;
8097 rDoc.GetScenarioData( nTab, aComment, aColor, nFlags );
8098
8099 rAny <<= aColor;
8100 }
8101 }
8102 else if ( pEntry->nWID == SC_WID_UNO_PROTECT )
8103 {
8104 if (rDoc.IsScenario(nTab))
8105 {
8106 ScScenarioFlags nFlags;
8107 rDoc.GetScenarioFlags(nTab, nFlags);
8108
8109 rAny <<= ((nFlags & ScScenarioFlags::Protected) != ScScenarioFlags::NONE);
8110 }
8111 }
8112 else if ( pEntry->nWID == SC_WID_UNO_SHOWBORD )
8113 {
8114 if (rDoc.IsScenario(nTab))
8115 {
8116 ScScenarioFlags nFlags;
8117 rDoc.GetScenarioFlags(nTab, nFlags);
8118
8119 rAny <<= ((nFlags & ScScenarioFlags::ShowFrame) != ScScenarioFlags::NONE);
8120 }
8121 }
8122 else if ( pEntry->nWID == SC_WID_UNO_PRINTBORD )
8123 {
8124 if (rDoc.IsScenario(nTab))
8125 {
8126 ScScenarioFlags nFlags;
8127 rDoc.GetScenarioFlags(nTab, nFlags);
8128
8129 rAny <<= ((nFlags & ScScenarioFlags::PrintFrame) != ScScenarioFlags::NONE);
8130 }
8131 }
8132 else if ( pEntry->nWID == SC_WID_UNO_COPYBACK )
8133 {
8134 if (rDoc.IsScenario(nTab))
8135 {
8136 ScScenarioFlags nFlags;
8137 rDoc.GetScenarioFlags(nTab, nFlags);
8138
8139 rAny <<= ((nFlags & ScScenarioFlags::TwoWay) != ScScenarioFlags::NONE);
8140 }
8141 }
8142 else if ( pEntry->nWID == SC_WID_UNO_COPYSTYL )
8143 {
8144 if (rDoc.IsScenario(nTab))
8145 {
8146 ScScenarioFlags nFlags;
8147 rDoc.GetScenarioFlags(nTab, nFlags);
8148
8149 rAny <<= ((nFlags & ScScenarioFlags::Attrib) != ScScenarioFlags::NONE);
8150 }
8151 }
8152 else if ( pEntry->nWID == SC_WID_UNO_COPYFORM )
8153 {
8154 if (rDoc.IsScenario(nTab))
8155 {
8156 ScScenarioFlags nFlags;
8157 rDoc.GetScenarioFlags(nTab, nFlags);
8158
8159 rAny <<= !(nFlags & ScScenarioFlags::Value);
8160 }
8161 }
8162 else if ( pEntry->nWID == SC_WID_UNO_TABLAYOUT )
8163 {
8164 if (rDoc.IsLayoutRTL(nTab))
8165 rAny <<= sal_Int16(css::text::WritingMode2::RL_TB);
8166 else
8167 rAny <<= sal_Int16(css::text::WritingMode2::LR_TB);
8168 }
8169 else if ( pEntry->nWID == SC_WID_UNO_AUTOPRINT )
8170 {
8171 bool bAutoPrint = rDoc.IsPrintEntireSheet( nTab );
8172 rAny <<= bAutoPrint;
8173 }
8174 else if ( pEntry->nWID == SC_WID_UNO_TABCOLOR )
8175 {
8176 rAny <<= rDoc.GetTabBgColor(nTab);
8177 }
8178 else if ( pEntry->nWID == SC_WID_UNO_CODENAME )
8179 {
8180 OUString aCodeName;
8181 pDocSh->GetDocument().GetCodeName(GetTab_Impl(), aCodeName);
8182 rAny <<= aCodeName;
8183 }
8184 else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT)
8185 {
8186 rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh, nTab));
8187 }
8188 else
8190}
8191
8193{
8194 return pSheetPropSet->getPropertyMap();
8195}
8196
8197// XServiceInfo
8198
8200{
8201 return "ScTableSheetObj";
8202}
8203
8204sal_Bool SAL_CALL ScTableSheetObj::supportsService( const OUString& rServiceName )
8205{
8206 return cppu::supportsService(this, rServiceName);
8207}
8208
8209uno::Sequence<OUString> SAL_CALL ScTableSheetObj::getSupportedServiceNames()
8210{
8211 return {SCSPREADSHEET_SERVICE,
8218}
8219
8221 ScCellRangeObj( pDocSh, ScRange(nCol,0,nTab, nCol, pDocSh->GetDocument().MaxRow(),nTab) ),
8222 pColPropSet(lcl_GetColumnPropertySet())
8223{
8224}
8225
8227{
8228}
8229
8231{
8232 SC_QUERYINTERFACE( container::XNamed )
8233
8234 return ScCellRangeObj::queryInterface( rType );
8235}
8236
8237void SAL_CALL ScTableColumnObj::acquire() noexcept
8238{
8240}
8241
8242void SAL_CALL ScTableColumnObj::release() noexcept
8243{
8245}
8246
8247uno::Sequence<uno::Type> SAL_CALL ScTableColumnObj::getTypes()
8248{
8251 uno::Sequence<uno::Type> { cppu::UnoType<container::XNamed>::get() } );
8252}
8253
8254uno::Sequence<sal_Int8> SAL_CALL ScTableColumnObj::getImplementationId()
8255{
8256 return css::uno::Sequence<sal_Int8>();
8257}
8258
8259// XNamed
8260
8261OUString SAL_CALL ScTableColumnObj::getName()
8262{
8263 SolarMutexGuard aGuard;
8264
8265 const ScRange& rRange = GetRange();
8266 OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
8267 SCCOL nCol = rRange.aStart.Col();
8268
8269 return ScColToAlpha( nCol ); // from global.hxx
8270}
8271
8272void SAL_CALL ScTableColumnObj::setName( const OUString& /* aNewName */ )
8273{
8274 throw uno::RuntimeException(); // read-only
8275}
8276
8277// XPropertySet extended for Column-Properties
8278
8279uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableColumnObj::getPropertySetInfo()
8280{
8281 SolarMutexGuard aGuard;
8282 static uno::Reference<beans::XPropertySetInfo> aRef(
8284 return aRef;
8285}
8286
8288{
8289 if ( !pEntry )
8290 return;
8291
8292 if ( IsScItemWid( pEntry->nWID ) )
8293 {
8294 // for Item WIDs, call ScCellRangesBase directly
8295 ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
8296 return;
8297 }
8298
8299 // own properties
8300
8301 ScDocShell* pDocSh = GetDocShell();
8302 if (!pDocSh)
8303 return;
8304 const ScRange& rRange = GetRange();
8305 OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "Too many columns");
8306 SCCOL nCol = rRange.aStart.Col();
8307 SCTAB nTab = rRange.aStart.Tab();
8308 ScDocFunc &rFunc = pDocSh->GetDocFunc();
8309
8310 std::vector<sc::ColRowSpan> aColArr(1, sc::ColRowSpan(nCol,nCol));
8311
8312 if ( pEntry->nWID == SC_WID_UNO_CELLWID )
8313 {
8314 sal_Int32 nNewWidth = 0;
8315 if ( aValue >>= nNewWidth )
8316 {
8317 // property is 1/100mm, column width is twips
8318 nNewWidth = o3tl::toTwips(nNewWidth, o3tl::Length::mm100);
8319 rFunc.SetWidthOrHeight(
8320 true, aColArr, nTab, SC_SIZE_ORIGINAL, nNewWidth, true, true);
8321 }
8322 }
8323 else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8324 {
8325 bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8327 rFunc.SetWidthOrHeight(true, aColArr, nTab, eMode, 0, true, true);
8328 // SC_SIZE_DIRECT with size 0 will hide
8329 }
8330 else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
8331 {
8332 bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8333 if (bOpt)
8334 rFunc.SetWidthOrHeight(
8335 true, aColArr, nTab, SC_SIZE_OPTIMAL, STD_EXTRA_WIDTH, true, true);
8336 // sal_False on columns currently without effect
8337 }
8338 else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
8339 {
8340 bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8341 if (bSet)
8342 rFunc.InsertPageBreak( true, rRange.aStart, true, true );
8343 else
8344 rFunc.RemovePageBreak( true, rRange.aStart, true, true );
8345 }
8346 else
8347 ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8348}
8349
8351{
8352 if ( !pEntry )
8353 return;
8354
8355 ScDocShell* pDocSh = GetDocShell();
8356 if (!pDocSh)
8357 throw uno::RuntimeException();
8358
8359 ScDocument& rDoc = pDocSh->GetDocument();
8360 const ScRange& rRange = GetRange();
8361 OSL_ENSURE(rRange.aStart.Col() == rRange.aEnd.Col(), "too many columns");
8362 SCCOL nCol = rRange.aStart.Col();
8363 SCTAB nTab = rRange.aStart.Tab();
8364
8365 if ( pEntry->nWID == SC_WID_UNO_CELLWID )
8366 {
8367 // for hidden column, return original height
8368 sal_uInt16 nWidth = rDoc.GetOriginalWidth( nCol, nTab );
8369 // property is 1/100mm, column width is twips
8370 nWidth = static_cast<sal_uInt16>(convertTwipToMm100(nWidth));
8371 rAny <<= static_cast<sal_Int32>(nWidth);
8372 }
8373 else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8374 {
8375 bool bHidden = rDoc.ColHidden(nCol, nTab);
8376 rAny <<= !bHidden;
8377 }
8378 else if ( pEntry->nWID == SC_WID_UNO_OWIDTH )
8379 {
8381 bool bOpt = !(rDoc.GetColFlags( nCol, nTab ) & CRFlags::ManualSize);
8382 rAny <<= bOpt;
8383 }
8384 else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
8385 {
8386 ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
8387 rAny <<= nBreak != ScBreakType::NONE;
8388 }
8389 else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
8390 {
8391 ScBreakType nBreak = rDoc.HasColBreak(nCol, nTab);
8392 rAny <<= bool(nBreak & ScBreakType::Manual);
8393 }
8394 else
8396}
8397
8399{
8400 return pColPropSet->getPropertyMap();
8401}
8402
8404 ScCellRangeObj( pDocSh, ScRange(0,nRow,nTab, pDocSh->GetDocument().MaxCol(),nRow,nTab) ),
8405 pRowPropSet(lcl_GetRowPropertySet())
8406{
8407}
8408
8410{
8411}
8412
8413// XPropertySet extended for Row-Properties
8414
8415uno::Reference<beans::XPropertySetInfo> SAL_CALL ScTableRowObj::getPropertySetInfo()
8416{
8417 SolarMutexGuard aGuard;
8418 static uno::Reference<beans::XPropertySetInfo> aRef(
8420 return aRef;
8421}
8422
8424{
8425 if ( !pEntry )
8426 return;
8427
8428 if ( IsScItemWid( pEntry->nWID ) )
8429 {
8430 // for Item WIDs, call ScCellRangesBase directly
8431 ScCellRangesBase::SetOnePropertyValue(pEntry, aValue);
8432 return;
8433 }
8434
8435 // own properties
8436
8437 ScDocShell* pDocSh = GetDocShell();
8438 if (!pDocSh)
8439 return;
8440 ScDocument& rDoc = pDocSh->GetDocument();
8441 const ScRange& rRange = GetRange();
8442 OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "too many rows");
8443 SCROW nRow = rRange.aStart.Row();
8444 SCTAB nTab = rRange.aStart.Tab();
8445 ScDocFunc &rFunc = pDocSh->GetDocFunc();
8446
8447 std::vector<sc::ColRowSpan> aRowArr(1, sc::ColRowSpan(nRow,nRow));
8448
8449 if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
8450 {
8451 sal_Int32 nNewHeight = 0;
8452 if ( aValue >>= nNewHeight )
8453 {
8454 // property is 1/100mm, row height is twips
8455 nNewHeight = o3tl::toTwips(nNewHeight, o3tl::Length::mm100);
8456 rFunc.SetWidthOrHeight(
8457 false, aRowArr, nTab, SC_SIZE_ORIGINAL, nNewHeight, true, true);
8458 }
8459 }
8460 else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8461 {
8462 bool bVis = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8464 rFunc.SetWidthOrHeight(false, aRowArr, nTab, eMode, 0, true, true);
8465 // SC_SIZE_DIRECT with size zero will hide
8466 }
8467 else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
8468 {
8469 bool bFil = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8470 // SC_SIZE_DIRECT with size zero will hide
8471 rDoc.SetRowFiltered(nRow, nRow, nTab, bFil);
8472 }
8473 else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
8474 {
8475 bool bOpt = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8476 if (bOpt)
8477 rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_OPTIMAL, 0, true, true);
8478 else
8479 {
8480 // set current height again manually
8481 sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
8482 rFunc.SetWidthOrHeight(false, aRowArr, nTab, SC_SIZE_ORIGINAL, nHeight, true, true);
8483 }
8484 }
8485 else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE || pEntry->nWID == SC_WID_UNO_MANPAGE )
8486 {
8487 bool bSet = ScUnoHelpFunctions::GetBoolFromAny( aValue );
8488 if (bSet)
8489 rFunc.InsertPageBreak( false, rRange.aStart, true, true );
8490 else
8491 rFunc.RemovePageBreak( false, rRange.aStart, true, true );
8492 }
8493 else
8494 ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID
8495}
8496
8498{
8499 if ( !pEntry )
8500 return;
8501
8502 ScDocShell* pDocSh = GetDocShell();
8503 if (!pDocSh)
8504 throw uno::RuntimeException();
8505 ScDocument& rDoc = pDocSh->GetDocument();
8506 const ScRange& rRange = GetRange();
8507 OSL_ENSURE(rRange.aStart.Row() == rRange.aEnd.Row(), "too many rows");
8508 SCROW nRow = rRange.aStart.Row();
8509 SCTAB nTab = rRange.aStart.Tab();
8510
8511 if ( pEntry->nWID == SC_WID_UNO_CELLHGT )
8512 {
8513 // for hidden row, return original height
8514 sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab );
8515 // property is 1/100mm, row height is twips
8516 nHeight = static_cast<sal_uInt16>(convertTwipToMm100(nHeight));
8517 rAny <<= static_cast<sal_Int32>(nHeight);
8518 }
8519 else if ( pEntry->nWID == SC_WID_UNO_CELLVIS )
8520 {
8521 bool bHidden = rDoc.RowHidden(nRow, nTab);
8522 rAny <<= !bHidden;
8523 }
8524 else if ( pEntry->nWID == SC_WID_UNO_CELLFILT )
8525 {
8526 bool bVis = rDoc.RowFiltered(nRow, nTab);
8527 rAny <<= bVis;
8528 }
8529 else if ( pEntry->nWID == SC_WID_UNO_OHEIGHT )
8530 {
8531 bool bOpt = !(rDoc.GetRowFlags( nRow, nTab ) & CRFlags::ManualSize);
8532 rAny <<= bOpt;
8533 }
8534 else if ( pEntry->nWID == SC_WID_UNO_NEWPAGE )
8535 {
8536 ScBreakType nBreak = rDoc.HasRowBreak(nRow, nTab);
8537 rAny <<= (nBreak != ScBreakType::NONE);
8538 }
8539 else if ( pEntry->nWID == SC_WID_UNO_MANPAGE )
8540 {
8541 bool bBreak(rDoc.HasRowBreak(nRow, nTab) & ScBreakType::Manual);
8542 rAny <<= bBreak;
8543 }
8544 else
8546}
8547
8549{
8550 return pRowPropSet->getPropertyMap();
8551}
8552
8554 pDocShell( pDocSh ),
8555 aRanges(std::move( aR ))
8556{
8558}
8559
8561{
8563
8564 if (pDocShell)
8566}
8567
8569{
8570 if ( auto pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint) )
8571 {
8572 aRanges.UpdateReference( pRefHint->GetMode(), &pDocShell->GetDocument(), pRefHint->GetRange(),
8573 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() );
8574 }
8575 else if ( rHint.GetId() == SfxHintId::Dying )
8576 {
8577 pDocShell = nullptr;
8578 }
8579}
8580
8581// XEnumerationAccess
8582
8583uno::Reference<container::XEnumeration> SAL_CALL ScCellsObj::createEnumeration()
8584{
8585 SolarMutexGuard aGuard;
8586 if (pDocShell)
8587 return new ScCellsEnumeration( pDocShell, aRanges );
8588 return nullptr;
8589}
8590
8592{
8594}
8595
8597{
8598 SolarMutexGuard aGuard;
8599 bool bHas = false;
8600 if ( pDocShell )
8601 {
8603
8604 uno::Reference<container::XEnumeration> xEnum(new ScCellsEnumeration( pDocShell, aRanges ));
8605 bHas = xEnum->hasMoreElements();
8606 }
8607 return bHas;
8608}
8609
8611 pDocShell( pDocSh ),
8612 aRanges(std::move( aR )),
8613 bAtEnd( false )
8614{
8615 ScDocument& rDoc = pDocShell->GetDocument();
8616 rDoc.AddUnoObject(*this);
8617
8618 if ( aRanges.empty() )
8619 bAtEnd = true;
8620 else
8621 {
8622 SCTAB nTab = aRanges[ 0 ].aStart.Tab();
8623 aPos = ScAddress(0,0,nTab);
8624 CheckPos_Impl(); // set aPos on first matching cell
8625 }
8626}
8627
8629{
8630 if (!pDocShell)
8631 return;
8632
8633 bool bFound = false;
8634 ScDocument& rDoc = pDocShell->GetDocument();
8635 ScRefCellValue aCell(rDoc, aPos);
8636 if (!aCell.isEmpty())
8637 {
8638 if (!pMark)
8639 {
8640 pMark.reset( new ScMarkData(rDoc.GetSheetLimits()) );
8641 pMark->MarkFromRangeList(aRanges, false);
8642 pMark->MarkToMulti(); // needed for GetNextMarkedCell
8643 }
8644 bFound = pMark->IsCellMarked(aPos.Col(), aPos.Row());
8645 }
8646 if (!bFound)
8647 Advance_Impl();
8648}
8649
8651{
8653
8654 if (pDocShell)
8656 pMark.reset();
8657}
8658
8660{
8661 OSL_ENSURE(!bAtEnd,"too much Advance_Impl");
8662 if (!pMark)
8663 {
8665 pMark->MarkFromRangeList( aRanges, false );
8666 pMark->MarkToMulti(); // needed for GetNextMarkedCell
8667 }
8668
8669 SCCOL nCol = aPos.Col();
8670 SCROW nRow = aPos.Row();
8671 SCTAB nTab = aPos.Tab();
8672 bool bFound = pDocShell->GetDocument().GetNextMarkedCell( nCol, nRow, nTab, *pMark );
8673 if (bFound)
8674 aPos.Set( nCol, nRow, nTab );
8675 else
8676 bAtEnd = true; // nothing will follow
8677}
8678
8680{
8681 const ScUpdateRefHint* pRefHint = dynamic_cast<const ScUpdateRefHint*>(&rHint);
8682 if ( pRefHint )
8683 {
8684 if (pDocShell)
8685 {
8686 aRanges.UpdateReference( pRefHint->GetMode(), &pDocShell->GetDocument(), pRefHint->GetRange(),
8687 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() );
8688
8689 pMark.reset(); // recreate from moved area
8690
8691 if (!bAtEnd) // adjust aPos
8692 {
8693 ScRangeList aNew { ScRange(aPos) };
8694 aNew.UpdateReference( pRefHint->GetMode(), &pDocShell->GetDocument(), pRefHint->GetRange(),
8695 pRefHint->GetDx(), pRefHint->GetDy(), pRefHint->GetDz() );
8696 if (aNew.size()==1)
8697 {
8698 aPos = aNew[ 0 ].aStart;
8699 CheckPos_Impl();
8700 }
8701 }
8702 }
8703 }
8704 else if ( rHint.GetId() == SfxHintId::Dying )
8705 {
8706 pDocShell = nullptr;
8707 }
8708}
8709
8710// XEnumeration
8711
8713{
8714 SolarMutexGuard aGuard;
8715 return !bAtEnd;
8716}
8717
8719{
8720 SolarMutexGuard aGuard;
8721 if (pDocShell && !bAtEnd)
8722 {
8723 // interface must match ScCellsObj::getElementType
8724
8725 ScAddress aTempPos(aPos);
8726 Advance_Impl();
8727 return uno::Any(uno::Reference<table::XCell>(new ScCellObj( pDocShell, aTempPos )));
8728 }
8729
8730 throw container::NoSuchElementException(); // no more elements
8731}
8732
8734 pDocShell( pDocSh ),
8735 aTotalRange( rRange )
8736{
8737 ScDocument& rDoc = pDocShell->GetDocument();
8738 rDoc.AddUnoObject(*this);
8739
8740 OSL_ENSURE( aTotalRange.aStart.Tab() == aTotalRange.aEnd.Tab(), "different tables" );
8741}
8742
8744{
8746
8747 if (pDocShell)
8749}
8750
8752{
8753 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
8754 {
8756 }
8757 else if ( rHint.GetId() == SfxHintId::Dying )
8758 {
8759 pDocShell = nullptr;
8760 }
8761}
8762
8764{
8766
8767 if (pDocShell)
8768 {
8769 ScDocument& rDoc = pDocShell->GetDocument();
8770 tools::Long nPos = 0;
8774 SCCOL nCol1, nCol2;
8775 SCROW nRow1, nRow2;
8776 while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
8777 {
8778 if ( nPos == nIndex )
8779 {
8780 SCTAB nTab = aTotalRange.aStart.Tab();
8781 ScRange aNext( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
8782
8783 if ( aNext.aStart == aNext.aEnd )
8784 return new ScCellObj( pDocShell, aNext.aStart );
8785 else
8786 return new ScCellRangeObj( pDocShell, aNext );
8787 }
8788 ++nPos;
8789 }
8790 }
8791 return {};
8792}
8793
8794// XIndexAccess
8795
8796sal_Int32 SAL_CALL ScCellFormatsObj::getCount()
8797{
8798 SolarMutexGuard aGuard;
8799
8801
8802 tools::Long nCount = 0;
8803 if (pDocShell)
8804 {
8805 ScDocument& rDoc = pDocShell->GetDocument();
8809 SCCOL nCol1, nCol2;
8810 SCROW nRow1, nRow2;
8811 while ( aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
8812 ++nCount;
8813 }
8814 return nCount;
8815}
8816
8817uno::Any SAL_CALL ScCellFormatsObj::getByIndex( sal_Int32 nIndex )
8818{
8819 SolarMutexGuard aGuard;
8820
8821 uno::Reference<table::XCellRange> xRange(GetObjectByIndex_Impl(nIndex));
8822 if (!xRange.is())
8823 throw lang::IndexOutOfBoundsException();
8824
8825 return uno::Any(xRange);
8826
8827}
8828
8830{
8832}
8833
8835{
8836 SolarMutexGuard aGuard;
8837 return ( getCount() != 0 );
8838}
8839
8840// XEnumerationAccess
8841
8842uno::Reference<container::XEnumeration> SAL_CALL ScCellFormatsObj::createEnumeration()
8843{
8844 SolarMutexGuard aGuard;
8845 if (pDocShell)
8847 return nullptr;
8848}
8849
8851 pDocShell( pDocSh ),
8852 nTab( rRange.aStart.Tab() ),
8853 bAtEnd( false ),
8854 bDirty( false )
8855{
8856 ScDocument& rDoc = pDocShell->GetDocument();
8857 rDoc.AddUnoObject(*this);
8858
8859 OSL_ENSURE( rRange.aStart.Tab() == rRange.aEnd.Tab(),
8860 "CellFormatsEnumeration: different tables" );
8861
8862 pIter.reset( new ScAttrRectIterator( rDoc, nTab,
8863 rRange.aStart.Col(), rRange.aStart.Row(),
8864 rRange.aEnd.Col(), rRange.aEnd.Row() ) );
8865 Advance_Impl();
8866}
8867
8869{
8871
8872 if (pDocShell)
8874}
8875
8877{
8878 OSL_ENSURE(!bAtEnd,"too many Advance_Impl");
8879
8880 if ( pIter )
8881 {
8882 if ( bDirty )
8883 {
8884 pIter->DataChanged(); // new search for AttrArray-Index
8885 bDirty = false;
8886 }
8887
8888 SCCOL nCol1, nCol2;
8889 SCROW nRow1, nRow2;
8890 if ( pIter->GetNext( nCol1, nCol2, nRow1, nRow2 ) )
8891 aNext = ScRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
8892 else
8893 bAtEnd = true;
8894 }
8895 else
8896 bAtEnd = true; // document vanished or so
8897}
8898
8900{
8902 if (pDocShell && !bAtEnd)
8903 {
8904 if ( aNext.aStart == aNext.aEnd )
8905 pRet = new ScCellObj( pDocShell, aNext.aStart );
8906 else
8907 pRet = new ScCellRangeObj( pDocShell, aNext );
8908 Advance_Impl();
8909 }
8910 return pRet;
8911}
8912
8914{
8915 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
8916 {
8918 }
8919 else
8920 {
8921 const SfxHintId nId = rHint.GetId();
8922 if ( nId == SfxHintId::Dying )
8923 {
8924 pDocShell = nullptr;
8925 pIter.reset();
8926 }
8927 else if ( nId == SfxHintId::DataChanged )
8928 {
8929 bDirty = true; // AttrArray-Index possibly invalid
8930 }
8931 }
8932}
8933
8934// XEnumeration
8935
8937{
8938 SolarMutexGuard aGuard;
8939 return !bAtEnd;
8940}
8941
8943{
8944 SolarMutexGuard aGuard;
8945
8946 if ( bAtEnd || !pDocShell )
8947 throw container::NoSuchElementException(); // no more elements
8948
8949 // interface must match ScCellFormatsObj::getElementType
8950
8951 return uno::Any(uno::Reference<table::XCellRange> (NextObject_Impl()));
8952}
8953
8955{
8957
8958 if (pDocShell)
8960}
8961
8963{
8964 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
8965 {
8967 }
8968 else
8969 {
8970 if ( rHint.GetId() == SfxHintId::Dying )
8971 pDocShell = nullptr;
8972 }
8973}
8974
8975// Fill the list of formats from the document
8976
8977namespace {
8978
8979// hash code to access the range lists by ScPatternAttr pointer
8980struct ScPatternHashCode
8981{
8982 size_t operator()( const ScPatternAttr* pPattern ) const
8983 {
8984 return reinterpret_cast<size_t>(pPattern);
8985 }
8986};
8987
8988}
8989
8990// Hash map to find a range by its start row
8991typedef std::unordered_map< SCROW, ScRange > ScRowRangeHashMap;
8992
8993namespace {
8994
8995// Hash map entry.
8996// The Join method depends on the column-wise order of ScAttrRectIterator
8997class ScUniqueFormatsEntry
8998{
8999 enum EntryState { STATE_EMPTY, STATE_SINGLE, STATE_COMPLEX };
9000
9001 EntryState eState;
9002 ScRange aSingleRange;
9003 ScRowRangeHashMap aJoinedRanges; // "active" ranges to be merged
9004 std::vector<ScRange> aCompletedRanges; // ranges that will no longer be touched
9005 ScRangeListRef aReturnRanges; // result as ScRangeList for further use
9006
9007public:
9008 ScUniqueFormatsEntry() : eState( STATE_EMPTY ) {}
9009
9010 void Join( const ScRange& rNewRange );
9011 const ScRangeList& GetRanges();
9012 void Clear() { aReturnRanges.clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges
9013};
9014
9015}
9016
9017void ScUniqueFormatsEntry::Join( const ScRange& rNewRange )
9018{
9019 // Special-case handling for single range
9020
9021 if ( eState == STATE_EMPTY )
9022 {
9023 aSingleRange = rNewRange;
9024 eState = STATE_SINGLE;
9025 return;
9026 }
9027 if ( eState == STATE_SINGLE )
9028 {
9029 if ( aSingleRange.aStart.Row() == rNewRange.aStart.Row() &&
9030 aSingleRange.aEnd.Row() == rNewRange.aEnd.Row() &&
9031 aSingleRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
9032 {
9033 aSingleRange.aEnd.SetCol( rNewRange.aEnd.Col() );
9034 return; // still a single range
9035 }
9036
9037 SCROW nSingleRow = aSingleRange.aStart.Row();
9038 aJoinedRanges.emplace( nSingleRow, aSingleRange );
9039 eState = STATE_COMPLEX;
9040 // continue normally
9041 }
9042
9043 // This is called in the order of ScAttrRectIterator results.
9044 // rNewRange can only be joined with an existing entry if it's the same rows, starting in the next column.
9045 // If the old entry for the start row extends to a different end row, or ends in a different column, it
9046 // can be moved to aCompletedRanges because it can't be joined with following iterator results.
9047 // Everything happens within one sheet, so Tab can be ignored.
9048
9049 SCROW nStartRow = rNewRange.aStart.Row();
9050 ScRowRangeHashMap::iterator aIter( aJoinedRanges.find( nStartRow ) ); // find the active entry for the start row
9051 if ( aIter != aJoinedRanges.end() )
9052 {
9053 ScRange& rOldRange = aIter->second;
9054 if ( rOldRange.aEnd.Row() == rNewRange.aEnd.Row() &&
9055 rOldRange.aEnd.Col() + 1 == rNewRange.aStart.Col() )
9056 {
9057 // extend existing range
9058 rOldRange.aEnd.SetCol( rNewRange.aEnd.Col() );
9059 }
9060 else
9061 {
9062 // move old range to aCompletedRanges, keep rNewRange for joining
9063 aCompletedRanges.push_back( rOldRange );
9064 rOldRange = rNewRange; // replace in hash map
9065 }
9066 }
9067 else
9068 {
9069 // keep rNewRange for joining
9070 aJoinedRanges.emplace( nStartRow, rNewRange );
9071 }
9072}
9073
9074const ScRangeList& ScUniqueFormatsEntry::GetRanges()
9075{
9076 if ( eState == STATE_SINGLE )
9077 {
9078 aReturnRanges = new ScRangeList( aSingleRange );
9079 return *aReturnRanges;
9080 }
9081
9082 // move remaining entries from aJoinedRanges to aCompletedRanges
9083
9084 for ( const auto& rEntry : aJoinedRanges )
9085 aCompletedRanges.push_back( rEntry.second );
9086 aJoinedRanges.clear();
9087
9088 // sort all ranges for a predictable API result
9089
9090 std::sort( aCompletedRanges.begin(), aCompletedRanges.end() );
9091
9092 // fill and return ScRangeList
9093
9094 aReturnRanges = new ScRangeList;
9095 aReturnRanges->insert( aReturnRanges->end(), aCompletedRanges.begin(), aCompletedRanges.end() );
9096 aCompletedRanges.clear();
9097
9098 return *aReturnRanges;
9099}
9100
9101namespace {
9102
9103// function object to sort the range lists by start of first range
9104struct ScUniqueFormatsOrder
9105{
9106 bool operator()( const ScRangeList& rList1, const ScRangeList& rList2 ) const
9107 {
9108 // all range lists have at least one entry
9109 OSL_ENSURE( !rList1.empty() && !rList2.empty(), "ScUniqueFormatsOrder: empty list" );
9110
9111 // compare start positions using ScAddress comparison operator
9112 return ( rList1[ 0 ].aStart < rList2[ 0 ].aStart );
9113 }
9114};
9115
9116}
9117
9119 pDocShell( pDocSh )
9120{
9122
9123 OSL_ENSURE( rTotalRange.aStart.Tab() == rTotalRange.aEnd.Tab(), "different tables" );
9124
9125 ScDocument& rDoc = pDocShell->GetDocument();
9126 SCTAB nTab = rTotalRange.aStart.Tab();
9127 ScAttrRectIterator aIter( rDoc, nTab,
9128 rTotalRange.aStart.Col(), rTotalRange.aStart.Row(),
9129 rTotalRange.aEnd.Col(), rTotalRange.aEnd.Row() );
9130 SCCOL nCol1, nCol2;
9131 SCROW nRow1, nRow2;
9132
9133 // Collect the ranges for each format in a hash map, to avoid nested loops
9134
9135 std::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > aHashMap;
9136 while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) )
9137 {
9138 ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab );
9139 const ScPatternAttr* pPattern = rDoc.GetPattern(nCol1, nRow1, nTab);
9140 aHashMap[pPattern].Join( aRange );
9141 }
9142
9143 // Fill the vector aRangeLists with the range lists from the hash map
9144
9145 aRangeLists.reserve( aHashMap.size() );
9146 for ( auto& rMapEntry : aHashMap )
9147 {
9148 ScUniqueFormatsEntry& rEntry = rMapEntry.second;
9149 const ScRangeList& rRanges = rEntry.GetRanges();
9150 aRangeLists.push_back( rRanges ); // copy ScRangeList
9151 rEntry.Clear(); // free memory, don't hold both copies of all ranges
9152 }
9153
9154 // Sort the vector by first range's start position, to avoid random shuffling
9155 // due to using the ScPatterAttr pointers
9156
9157 ::std::sort( aRangeLists.begin(), aRangeLists.end(), ScUniqueFormatsOrder() );
9158}
9159
9160
9161// XIndexAccess
9162
9164{
9165 SolarMutexGuard aGuard;
9166
9167 return aRangeLists.size();
9168}
9169
9171{
9172 SolarMutexGuard aGuard;
9173
9175 throw lang::IndexOutOfBoundsException();
9176
9177 return uno::Any(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nIndex])));
9178
9179}
9180
9182{
9184}
9185
9187{
9188 SolarMutexGuard aGuard;
9189 return ( !aRangeLists.empty() );
9190}
9191
9192// XEnumerationAccess
9193
9194uno::Reference<container::XEnumeration> SAL_CALL ScUniqueCellFormatsObj::createEnumeration()
9195{
9196 SolarMutexGuard aGuard;
9197 if (pDocShell)
9198 return new ScUniqueCellFormatsEnumeration( pDocShell, std::vector(aRangeLists) );
9199 return nullptr;
9200}
9201
9202ScUniqueCellFormatsEnumeration::ScUniqueCellFormatsEnumeration(ScDocShell* pDocSh, std::vector<ScRangeList>&& rRangeLists) :
9203 aRangeLists(std::move(rRangeLists)),
9204 pDocShell( pDocSh ),
9205 nCurrentPosition(0)
9206{
9208}
9209
9211{
9213
9214 if (pDocShell)
9216}
9217
9219{
9220 if ( dynamic_cast<const ScUpdateRefHint*>(&rHint) )
9221 {
9223 }
9224 else
9225 {
9226 if ( rHint.GetId() == SfxHintId::Dying )
9227 pDocShell = nullptr;
9228 }
9229}
9230
9231// XEnumeration
9232
9234{
9235 SolarMutexGuard aGuard;
9237}
9238
9240{
9241 SolarMutexGuard aGuard;
9242
9243 if ( !hasMoreElements() || !pDocShell )
9244 throw container::NoSuchElementException(); // no more elements
9245
9246 // interface type must match ScCellFormatsObj::getElementType
9247
9248 return uno::Any(uno::Reference<sheet::XSheetCellRangeContainer>(new ScCellRangesObj(pDocShell, aRangeLists[nCurrentPosition++])));
9249}
9250
9251/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const PropertyValue * pValues
#define CHAR_COLOR_PROPERTIES
#define CELL_BORDER_PROPERTIES
#define CELL_BACKGROUND_COLOR_PROPERTIES
constexpr auto convertTwipToMm100(N n)
void ScColToAlpha(OUStringBuffer &rBuf, SCCOL nCol)
append alpha representation of column to buffer
Definition: address.cxx:1884
const SCROW MAXROW
Definition: address.hxx:68
ScRefFlags
Definition: address.hxx:158
size_t SCSIZE
size_t typedef to be able to find places where code was changed from USHORT to size_t and is used to ...
Definition: address.hxx:44
const SCCOL MAXCOL
Definition: address.hxx:69
AnyEventRef aEvent
@ Scenario
field button for datapilot
static const SvxItemPropertySet * lcl_GetEditPropertySet()
Definition: cellsuno.cxx:805
static OUString lcl_GetInputString(ScDocument &rDoc, const ScAddress &rPos, bool bEnglish)
Definition: cellsuno.cxx:1278
static bool lcl_WholeSheet(const ScDocument &rDoc, const ScRangeList &rRanges)
Definition: cellsuno.cxx:864
static bool lcl_FindRangeByName(const ScRangeList &rRanges, ScDocShell *pDocSh, std::u16string_view rName, size_t &rIndex)
Definition: cellsuno.cxx:4195
static bool lcl_PutDataArray(ScDocShell &rDocShell, const ScRange &rRange, const uno::Sequence< uno::Sequence< uno::Any > > &aData)
move lcl_PutDataArray to docfunc? merge loop with ScFunctionAccess::callFunction
Definition: cellsuno.cxx:1035
static void lcl_GetPropertyWhich(const SfxItemPropertyMapEntry *pEntry, sal_uInt16 &rItemWhich)
Definition: cellsuno.cxx:1701
constexpr OUStringLiteral SCCELLPROPERTIES_SERVICE
Definition: cellsuno.cxx:813
static bool lcl_PutFormulaArray(ScDocShell &rDocShell, const ScRange &rRange, const uno::Sequence< uno::Sequence< OUString > > &aData, const formula::FormulaGrammar::Grammar eGrammar)
Definition: cellsuno.cxx:1180
static bool lcl_FindEntryName(const std::vector< ScCellRangesObj::ScNamedEntry > &rNamedEntries, const ScRange &rRange, OUString &rName)
Definition: cellsuno.cxx:4359
static const SfxItemPropertySet * lcl_GetRangePropertySet()
Definition: cellsuno.cxx:254
constexpr OUStringLiteral SCSHEETCELLRANGES_SERVICE
Definition: cellsuno.cxx:816
static o3tl::span< const SfxItemPropertyMapEntry > lcl_GetEditPropertyMap()
Definition: cellsuno.cxx:792
constexpr OUStringLiteral SCSHEETCELL_SERVICE
Definition: cellsuno.cxx:819
constexpr OUStringLiteral SCSHEETCELLRANGE_SERVICE
Definition: cellsuno.cxx:817
static ScRange MaxDocRange(ScDocShell *pDocSh, SCTAB nTab)
Definition: cellsuno.cxx:6474
static bool lcl_FindRangeOrEntry(const std::vector< ScCellRangesObj::ScNamedEntry > &rNamedEntries, const ScRangeList &rRanges, ScDocShell *pDocSh, const OUString &rName, ScRange &rFound)
Definition: cellsuno.cxx:4215
static SCTAB lcl_FirstTab(const ScRangeList &rRanges)
Definition: cellsuno.cxx:856
static const SfxItemPropertySet * lcl_GetCellsPropertySet()
Instead of Which-ID 0 use special IDs and do not compare via names!
Definition: cellsuno.cxx:152
constexpr OUStringLiteral SCPARAPROPERTIES_SERVICE
Definition: cellsuno.cxx:812
constexpr OUStringLiteral SCCELL_SERVICE
Definition: cellsuno.cxx:815
constexpr OUStringLiteral SCSPREADSHEET_SERVICE
Definition: cellsuno.cxx:818
static void lcl_SetCellProperty(const SfxItemPropertyMapEntry &rEntry, const uno::Any &rValue, ScPatternAttr &rPattern, const ScDocument &rDoc, sal_uInt16 &rFirstItemId, sal_uInt16 &rSecondItemId)
Definition: cellsuno.cxx:1969
static void lcl_CopyProperties(beans::XPropertySet &rDest, beans::XPropertySet &rSource)
Definition: cellsuno.cxx:842
constexpr OUStringLiteral SCCHARPROPERTIES_SERVICE
Definition: cellsuno.cxx:811
static const SfxItemPropertySet * lcl_GetColumnPropertySet()
Definition: cellsuno.cxx:466
static const SfxItemPropertySet * lcl_GetRowPropertySet()
Definition: cellsuno.cxx:570
static const SfxItemPropertySet * lcl_GetCellPropertySet()
Definition: cellsuno.cxx:357
constexpr OUStringLiteral SCCELLRANGE_SERVICE
Definition: cellsuno.cxx:814
std::unordered_map< SCROW, ScRange > ScRowRangeHashMap
Definition: cellsuno.cxx:8991
static const SfxItemPropertySet * lcl_GetSheetPropertySet()
Definition: cellsuno.cxx:675
static void lcl_RemoveNamedEntry(std::vector< ScCellRangesObj::ScNamedEntry > &rNamedEntries, const ScRange &rRange)
Definition: cellsuno.cxx:4056
IMPL_LINK(ScCellRangesBase, ValueListenerHdl, const SfxHint &, rHint, void)
Definition: cellsuno.cxx:2610
sal_uInt16 GetValue() const
sal_uInt32 GetValue() const
OUString GetText(LineEnd eEnd=LINEEND_LF) const
std::unique_ptr< EditTextObject > CreateTextObject()
void SetText(const OUString &rStr)
SCTAB Tab() const
Definition: address.hxx:283
void Set(SCCOL nCol, SCROW nRow, SCTAB nTab)
Definition: address.hxx:403
void SetCol(SCCOL nColP)
Definition: address.hxx:291
void GetVars(SCCOL &nColP, SCROW &nRowP, SCTAB &nTabP) const
Definition: address.hxx:324
static SC_DLLPUBLIC const Details detailsOOOa1
Definition: address.hxx:241
SCROW Row() const
Definition: address.hxx:274
void SetRow(SCROW nRowP)
Definition: address.hxx:287
void SetTab(SCTAB nTabP)
Definition: address.hxx:295
SCCOL Col() const
Definition: address.hxx:279
const ScPatternAttr * GetNext(SCCOL &rCol1, SCCOL &rCol2, SCROW &rRow1, SCROW &rRow2)
Definition: dociter.cxx:1734
MapType::const_iterator const_iterator
Definition: autoform.hxx:191
const_iterator begin() const
Definition: autoform.cxx:803
const_iterator end() const
Definition: autoform.cxx:808
iterator find(const OUString &rName)
Definition: autoform.cxx:782
Data (incl.
Definition: editsrc.hxx:74
bool IsDirty() const
Definition: editsrc.cxx:92
virtual void UpdateData() override
Definition: editsrc.cxx:82
void SetDoUpdateData(bool bValue)
Definition: editsrc.cxx:87
static OUString GetOutputString(ScDocument &rDoc, const ScAddress &rPos, const ScRefCellValue &rCell)
Definition: cellform.cxx:188
static OUString GetInputString(const ScRefCellValue &rCell, sal_uInt32 nFormat, SvNumberFormatter &rFormatter, const ScDocument &rDoc, const svl::SharedString **pShared=nullptr, bool bFiltering=false, bool bForceSystemLocale=false)
Definition: cellform.cxx:129
std::unique_ptr< ScAttrRectIterator > pIter
Definition: cellsuno.hxx:1132
virtual ~ScCellFormatsEnumeration() override
Definition: cellsuno.cxx:8868
virtual css::uno::Any SAL_CALL nextElement() override
Definition: cellsuno.cxx:8942
ScCellFormatsEnumeration(ScDocShell *pDocSh, const ScRange &rR)
Definition: cellsuno.cxx:8850
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: cellsuno.cxx:8913
rtl::Reference< ScCellRangeObj > NextObject_Impl()
Definition: cellsuno.cxx:8899
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: cellsuno.cxx:8936
ScRange aTotalRange
Definition: cellsuno.hxx:1095
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: cellsuno.cxx:8817
virtual ~ScCellFormatsObj() override
Definition: cellsuno.cxx:8743
virtual css::uno::Type SAL_CALL getElementType() override
Definition: cellsuno.cxx:8829
ScCellFormatsObj(ScDocShell *pDocSh, const ScRange &rR)
Definition: cellsuno.cxx:8733
virtual sal_Bool SAL_CALL hasElements() override
Definition: cellsuno.cxx:8834
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: cellsuno.cxx:8842
rtl::Reference< ScCellRangeObj > GetObjectByIndex_Impl(tools::Long nIndex) const
Definition: cellsuno.cxx:8763
virtual sal_Int32 SAL_CALL getCount() override
Definition: cellsuno.cxx:8796
ScDocShell * pDocShell
Definition: cellsuno.hxx:1094
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: cellsuno.cxx:8751
Walk through all cells in an area.
Definition: dociter.hxx:206
really derive cell from range?
Definition: cellsuno.hxx:640
virtual sal_Bool SAL_CALL isActionLocked() override
Definition: cellsuno.cxx:6393
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &aTextPosition) override
Definition: cellsuno.cxx:5912
virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getTokens() override
Definition: cellsuno.cxx:6228
css::table::CellContentType GetContentType_Impl()
Definition: cellsuno.cxx:6193
SvxUnoText & GetUnoText()
Definition: cellsuno.cxx:5710
rtl::Reference< SvxUnoText > mxUnoText
Definition: cellsuno.hxx:642
virtual void SAL_CALL release() noexcept override
Definition: cellsuno.cxx:5765
void SetValue_Impl(double fValue)
Definition: cellsuno.cxx:5837
virtual OUString SAL_CALL getImplementationName() override
Definition: cellsuno.cxx:6370
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: cellsuno.cxx:6375
virtual const SfxItemPropertyMap & GetItemPropertyMap() override
Definition: cellsuno.cxx:6363
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cellsuno.cxx:6310
ScAddress aCellPos
Definition: cellsuno.hxx:644
virtual void SAL_CALL acquire() noexcept override
Definition: cellsuno.cxx:5760
virtual void SAL_CALL setValue(double nValue) override
Definition: cellsuno.cxx:6091
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
Definition: cellsuno.cxx:5960
static const SfxItemPropertyMap & GetCellPropertyMap()
Definition: cellsuno.cxx:5695
virtual sal_Int32 SAL_CALL getError() override
Definition: cellsuno.cxx:6208
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
Definition: cellsuno.cxx:5967
sal_Int16 nActionLockCount
Definition: cellsuno.hxx:645
virtual void RefChanged() override
Definition: cellsuno.cxx:5730
virtual void SAL_CALL addActionLock() override
Definition: cellsuno.cxx:6399
virtual css::uno::Reference< css::sheet::XSheetAnnotation > SAL_CALL getAnnotation() override
Definition: cellsuno.cxx:6276
virtual sal_Bool SAL_CALL hasElements() override
Definition: cellsuno.cxx:6065
virtual css::table::CellAddress SAL_CALL getCellAddress() override
Definition: cellsuno.cxx:6264
const SfxItemPropertySet * pCellPropSet
Definition: cellsuno.hxx:643
ScCellObj(ScDocShell *pDocSh, const ScAddress &rP)
Definition: cellsuno.cxx:5700
virtual void SAL_CALL setTokens(const css::uno::Sequence< css::sheet::FormulaToken > &aTokens) override
Definition: cellsuno.cxx:6247
double GetValue_Impl() const
Definition: cellsuno.cxx:5828
virtual void SetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, const css::uno::Any &aValue) override
Definition: cellsuno.cxx:6318
virtual ~ScCellObj() override
Definition: cellsuno.cxx:5726
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
Definition: cellsuno.cxx:5950
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
Definition: cellsuno.cxx:6020
static const SvxItemPropertySet * GetEditPropertySet()
Definition: cellsuno.cxx:5690
virtual css::uno::Reference< css::text::XText > SAL_CALL getText() override
Definition: cellsuno.cxx:6036
OUString GetInputString_Impl(bool bEnglish) const
Definition: cellsuno.cxx:5796
virtual void SAL_CALL setFormulaResult(double nValue) override
Definition: cellsuno.cxx:6108
virtual css::uno::Type SAL_CALL getElementType() override
Definition: cellsuno.cxx:6059
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: cellsuno.cxx:6053
virtual OUString SAL_CALL getString() override
Definition: cellsuno.cxx:5934
virtual css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
Definition: cellsuno.cxx:5906
virtual void SAL_CALL removeActionLock() override
Definition: cellsuno.cxx:6415
virtual void SAL_CALL setActionLocks(sal_Int16 nLock) override
Definition: cellsuno.cxx:6438
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: cellsuno.cxx:5789
virtual css::table::CellContentType SAL_CALL getType() override
Definition: cellsuno.cxx:6125
virtual void SAL_CALL setFormulaString(const OUString &aFormula) override
Definition: cellsuno.cxx:6097
sal_Int32 GetResultType_Impl() const
Definition: cellsuno.cxx:6157
OUString GetOutputString_Impl() const
Definition: cellsuno.cxx:5803
virtual void GetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, css::uno::Any &) override
Definition: cellsuno.cxx:6339
virtual double SAL_CALL getValue() override
Definition: cellsuno.cxx:6085
void SetString_Impl(const OUString &rString, bool bInterpret, bool bEnglish)
Definition: cellsuno.cxx:5817
void InputEnglishString(const OUString &rText)
Definition: cellsuno.cxx:5846
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
Definition: cellsuno.cxx:6041
virtual css::uno::Reference< css::container::XNameAccess > SAL_CALL getTextFieldMasters() override
Definition: cellsuno.cxx:6302
virtual sal_Int16 SAL_CALL resetActionLocks() override
Definition: cellsuno.cxx:6455
virtual OUString SAL_CALL getFormula() override
Definition: cellsuno.cxx:6073
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: cellsuno.cxx:5742
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
Definition: cellsuno.cxx:6047
virtual void SAL_CALL setString(const OUString &aString) override
Definition: cellsuno.cxx:5940
virtual css::uno::Reference< css::container::XEnumerationAccess > SAL_CALL getTextFields() override
Definition: cellsuno.cxx:6289
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: cellsuno.cxx:5770
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: cellsuno.cxx:6380
virtual void SAL_CALL setFormula(const OUString &aFormula) override
Definition: cellsuno.cxx:6079
virtual void SetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, const css::uno::Any &aValue) override
Definition: cellsuno.cxx:5620
virtual void SAL_CALL sort(const css::uno::Sequence< css::beans::PropertyValue > &xDescriptor) override
Definition: cellsuno.cxx:5224
virtual void SAL_CALL removeSubTotals() override
Definition: cellsuno.cxx:5519
virtual void SAL_CALL applySubTotals(const css::uno::Reference< css::sheet::XSubTotalDescriptor > &xDescriptor, sal_Bool bReplace) override
Definition: cellsuno.cxx:5475
virtual void SAL_CALL setDataArray(const css::uno::Sequence< css::uno::Sequence< css::uno::Any > > &aArray) override
Definition: cellsuno.cxx:4901
const SfxItemPropertySet * pRangePropSet
Definition: cellsuno.hxx:478
const ScRange & GetRange() const
Definition: cellsuno.hxx:482
virtual OUString SAL_CALL getImplementationName() override
Definition: cellsuno.cxx:5671
virtual css::uno::Reference< css::table::XTableColumns > SAL_CALL getColumns() override
Definition: cellsuno.cxx:4693
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: cellsuno.cxx:4505
virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL createFilterDescriptorByObject(const css::uno::Reference< css::sheet::XSheetFilterable > &xObject) override
get/setAutoFilter as properties!!!
Definition: cellsuno.cxx:5387
virtual void GetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, css::uno::Any &) override
Definition: cellsuno.cxx:5628
virtual void RefChanged() override
Definition: cellsuno.cxx:4491
virtual void SAL_CALL acquire() noexcept override
Definition: cellsuno.cxx:4530
virtual void SAL_CALL setFormulaArray(const css::uno::Sequence< css::uno::Sequence< OUString > > &aArray) override
Definition: cellsuno.cxx:4960
css::uno::Reference< css::table::XCell > GetCellByPosition_Impl(sal_Int32 nColumn, sal_Int32 nRow)
are used in Writer for tables ???
Definition: cellsuno.cxx:4577
virtual void SAL_CALL merge(sal_Bool bMerge) override
Definition: cellsuno.cxx:5023
virtual void SAL_CALL fillSeries(css::sheet::FillDirection nFillDirection, css::sheet::FillMode nFillMode, css::sheet::FillDateMode nFillDateMode, double fStep, double fEndValue) override
Definition: cellsuno.cxx:5051
virtual css::uno::Reference< css::table::XTableRows > SAL_CALL getRows() override
Definition: cellsuno.cxx:4705
void SetArrayFormula_Impl(const OUString &rFormula, const formula::FormulaGrammar::Grammar eGrammar)
Definition: cellsuno.cxx:4771
virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL getFormulaArray() override
Definition: cellsuno.cxx:4920
ScCellRangeObj(ScDocShell *pDocSh, const ScRange &rR)
Definition: cellsuno.cxx:4479
virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow) override
Definition: cellsuno.cxx:4599
virtual void SAL_CALL fillAuto(css::sheet::FillDirection nFillDirection, sal_Int32 nSourceCount) override
Definition: cellsuno.cxx:5127
virtual css::uno::Reference< css::sheet::XSheetFilterDescriptor > SAL_CALL createFilterDescriptor(sal_Bool bEmpty) override
Definition: cellsuno.cxx:5278
virtual css::uno::Sequence< css::sheet::FormulaToken > SAL_CALL getArrayTokens() override
Definition: cellsuno.cxx:4806
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom) override
Definition: cellsuno.cxx:4607
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getUniqueCellFormatRanges() override
Definition: cellsuno.cxx:5601
virtual ~ScCellRangeObj() override
Definition: cellsuno.cxx:4487
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: cellsuno.cxx:5681
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: cellsuno.cxx:5676
virtual void SAL_CALL setTableOperation(const css::table::CellRangeAddress &aFormulaRange, css::sheet::TableOperationMode nMode, const css::table::CellAddress &aColumnCell, const css::table::CellAddress &aRowCell) override
Definition: cellsuno.cxx:4981
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName(const OUString &aRange) override
Definition: cellsuno.cxx:4635
virtual void SAL_CALL release() noexcept override
Definition: cellsuno.cxx:4535
virtual void SAL_CALL autoFormat(const OUString &aName) override
Definition: cellsuno.cxx:5174
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: cellsuno.cxx:4567
virtual const SfxItemPropertyMap & GetItemPropertyMap() override
Definition: cellsuno.cxx:5664
static css::uno::Reference< css::table::XCellRange > CreateRangeFromDoc(const ScDocument &rDoc, const ScRange &rR)
Definition: cellsuno.cxx:4471
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL createSortDescriptor() override
Definition: cellsuno.cxx:5194
virtual void SAL_CALL setArrayTokens(const css::uno::Sequence< css::sheet::FormulaToken > &aTokens) override
Definition: cellsuno.cxx:4840
virtual css::table::CellRangeAddress SAL_CALL getRangeAddress() override
Definition: cellsuno.cxx:4719
virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL getDataArray() override
Definition: cellsuno.cxx:4875
virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL getSpreadsheet() override
Definition: cellsuno.cxx:4729
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL createImportDescriptor(sal_Bool bEmpty) override
Definition: cellsuno.cxx:5546
virtual void SAL_CALL setArrayFormula(const OUString &aFormula) override
Definition: cellsuno.cxx:4798
virtual css::uno::Reference< css::sheet::XSubTotalDescriptor > SAL_CALL createSubTotalDescriptor(sal_Bool bEmpty) override
Definition: cellsuno.cxx:5440
virtual void SAL_CALL filter(const css::uno::Reference< css::sheet::XSheetFilterDescriptor > &xDescriptor) override
Definition: cellsuno.cxx:5311
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cellsuno.cxx:5612
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: cellsuno.cxx:4540
virtual void SAL_CALL doImport(const css::uno::Sequence< css::beans::PropertyValue > &aDescriptor) override
Definition: cellsuno.cxx:5564
ScRange aRange
Definition: cellsuno.hxx:479
virtual sal_Bool SAL_CALL getIsMerged() override
Definition: cellsuno.cxx:5042
virtual OUString SAL_CALL getArrayFormula() override
Definition: cellsuno.cxx:4742
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getCellFormatRanges() override
Definition: cellsuno.cxx:5590
SvxSearchItem * GetSearchItem() const
Definition: srchuno.hxx:44
uno3: SvxUnoTextCursor is not derived from XUnoTunnel, but should be (?)
Definition: textuno.hxx:209
ScCellsEnumeration(ScDocShell *pDocSh, ScRangeList aR)
Definition: cellsuno.cxx:8610
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: cellsuno.cxx:8679
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: cellsuno.cxx:8712
virtual css::uno::Any SAL_CALL nextElement() override
Definition: cellsuno.cxx:8718
ScDocShell * pDocShell
Definition: cellsuno.hxx:1061
std::unique_ptr< ScMarkData > pMark
Definition: cellsuno.hxx:1064
virtual ~ScCellsEnumeration() override
Definition: cellsuno.cxx:8650
ScRangeList aRanges
Definition: cellsuno.hxx:1062
ScDocShell * pDocShell
Definition: cellsuno.hxx:1032
virtual sal_Bool SAL_CALL hasElements() override
Definition: cellsuno.cxx:8596
virtual css::uno::Type SAL_CALL getElementType() override
Definition: cellsuno.cxx:8591
ScCellsObj(ScDocShell *pDocSh, ScRangeList aR)
Definition: cellsuno.cxx:8553
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: cellsuno.cxx:8568
virtual ~ScCellsObj() override
Definition: cellsuno.cxx:8560
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: cellsuno.cxx:8583
ScRangeList aRanges
Definition: cellsuno.hxx:1033
bool insert(ScChartListener *pListener)
Definition: chartlis.cxx:388
const ListenersType & getListeners() const
Definition: chartlis.hxx:164
std::map< OUString, std::unique_ptr< ScChartListener > > ListenersType
Definition: chartlis.hxx:125
OUString getUniqueName(std::u16string_view rPrefix) const
Create a unique name that's not taken by any existing chart listener objects.
Definition: chartlis.cxx:420
void FreeUno(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &rListener, const css::uno::Reference< css::chart::XChartData > &rSource)
Definition: chartlis.cxx:475
void StartListeningTo()
Definition: chartlis.cxx:264
void SetUno(const css::uno::Reference< css::chart::XChartDataChangeEventListener > &rListener, const css::uno::Reference< css::chart::XChartData > &rSource)
Definition: chartlis.cxx:134
const ScAddress * GetRowHeaderPosition(SCROW nChartRow) const
Definition: chartpos.hxx:84
const ScAddress * GetColHeaderPosition(SCCOL nChartCol) const
Definition: chartpos.hxx:78
const ScAddress * GetPosition(sal_uInt64 nIndex) const
Definition: chartpos.hxx:64
SCROW GetRowCount() const
Definition: chartpos.hxx:56
SCCOL GetColCount() const
deletes all ScAddress*
Definition: chartpos.hxx:55
SC_DLLPUBLIC bool Sort(SCTAB nTab, const ScSortParam &rSortParam, bool bRecord, bool bPaint, bool bApi)
Definition: dbdocfun.cxx:466
SC_DLLPUBLIC bool Query(SCTAB nTab, const ScQueryParam &rQueryParam, const ScRange *pAdvSource, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:678
void DoSubTotals(SCTAB nTab, const ScSubTotalParam &rParam, bool bRecord, bool bApi)
Definition: dbdocfun.cxx:1038
bool DoImport(SCTAB nTab, const ScImportParam &rParam, const svx::ODataAccessDescriptor *pDescriptor)
Definition: dbdocimp.cxx:121
static SC_DLLPUBLIC ScSubTotalFunc toSubTotalFunc(ScGeneralFunction eGenFunc)
Definition: dputil.cxx:395
DataPilotTables collection per sheet.
Definition: dapiuno.hxx:84
Iterator for references in a formula cell.
Definition: formulaiter.hxx:32
bool DetectiveAddError(const ScAddress &rPos)
Definition: docfunc.cxx:360
bool MoveBlock(const ScRange &rSource, const ScAddress &rDestPos, bool bCut, bool bRecord, bool bPaint, bool bApi)
Definition: docfunc.cxx:2852
bool AutoFormat(const ScRange &rRange, const ScMarkData *pTabMark, sal_uInt16 nFormatNo, bool bApi)
Definition: docfunc.cxx:4205
bool SetStringOrEditCell(const ScAddress &rPos, const OUString &rStr, bool bInteraction)
Definition: docfunc.cxx:1008
bool Protect(SCTAB nTab, const OUString &rPassword)
Definition: docfunc.cxx:4010
bool UnmergeCells(const ScRange &rRange, bool bRecord, ScUndoRemoveMerge *pUndoRemoveMerge)
Definition: docfunc.cxx:5050
bool SetTabBgColor(SCTAB nTab, const Color &rColor, bool bRecord, bool bApi)
Definition: docfunc.cxx:3534
bool DetectiveAddPred(const ScAddress &rPos)
Definition: docfunc.cxx:209
bool SetFormulaCell(const ScAddress &rPos, ScFormulaCell *pCell, bool bInteraction)
Below two methods take ownership of the formula cell instance(s).
Definition: docfunc.cxx:1023
bool SetValueCell(const ScAddress &rPos, double fVal, bool bInteraction)
Definition: docfunc.cxx:867
bool RenameTable(SCTAB nTab, const OUString &rName, bool bRecord, bool bApi)
Definition: docfunc.cxx:3500
SC_DLLPUBLIC bool FillAuto(ScRange &rRange, const ScMarkData *pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, sal_uLong nCount, double fStep, double fMax, bool bRecord, bool bApi)
Definition: docfunc.cxx:4797
bool InsertCells(const ScRange &rRange, const ScMarkData *pTabMark, InsCellCmd eCmd, bool bRecord, bool bApi, bool bPartOfPaste=false)
Definition: docfunc.cxx:1736
bool RemovePageBreak(bool bColumn, const ScAddress &rPos, bool bRecord, bool bSetModified)
Definition: docfunc.cxx:3886
bool SetCellText(const ScAddress &rPos, const OUString &rText, bool bInterpret, bool bEnglish, bool bApi, const formula::FormulaGrammar::Grammar eGrammar)
Definition: docfunc.cxx:1240
bool TabOp(const ScRange &rRange, const ScMarkData *pTabMark, const ScTabOpParam &rParam, bool bRecord, bool bApi)
Definition: docfunc.cxx:4405
SC_DLLPUBLIC bool MergeCells(const ScCellMergeOption &rOption, bool bContents, bool bRecord, bool bApi, bool bEmptyMergedCells=false)
Definition: docfunc.cxx:4933
bool DeleteCells(const ScRange &rRange, const ScMarkData *pTabMark, DelCellCmd eCmd, bool bApi)
Definition: docfunc.cxx:2271
bool DetectiveMarkInvalid(SCTAB nTab)
Definition: docfunc.cxx:397
bool InsertPageBreak(bool bColumn, const ScAddress &rPos, bool bRecord, bool bSetModified)
Definition: docfunc.cxx:3823
bool FillSeries(const ScRange &rRange, const ScMarkData *pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, double fStart, double fStep, double fMax, bool bApi)
Definition: docfunc.cxx:4659
SC_DLLPUBLIC bool DeleteContents(const ScMarkData &rMark, InsertDeleteFlags nFlags, bool bRecord, bool bApi)
Definition: docfunc.cxx:583
void SetTableVisible(SCTAB nTab, bool bVisible, bool bApi)
Definition: docfunc.cxx:3419
SC_DLLPUBLIC bool SetWidthOrHeight(bool bWidth, const std::vector< sc::ColRowSpan > &rRanges, SCTAB nTab, ScSizeMode eMode, sal_uInt16 nSizeTwips, bool bRecord, bool bApi)
Definition: docfunc.cxx:3652
bool DetectiveDelPred(const ScAddress &rPos)
Definition: docfunc.cxx:245
bool DetectiveDelSucc(const ScAddress &rPos)
Definition: docfunc.cxx:321
bool ApplyAttributes(const ScMarkData &rMark, const ScPatternAttr &rPattern, bool bApi)
Definition: docfunc.cxx:1426
bool DetectiveDelAll(SCTAB nTab)
Definition: docfunc.cxx:436
SC_DLLPUBLIC bool EnterMatrix(const ScRange &rRange, const ScMarkData *pTabMark, const ScTokenArray *pTokenArray, const OUString &rString, bool bApi, bool bEnglish, const OUString &rFormulaNmsp, const formula::FormulaGrammar::Grammar)
Definition: docfunc.cxx:4317
bool SetLayoutRTL(SCTAB nTab, bool bRTL)
Definition: docfunc.cxx:3469
bool DetectiveAddSucc(const ScAddress &rPos)
Definition: docfunc.cxx:284
bool Unprotect(SCTAB nTab, const OUString &rPassword, bool bApi)
Definition: docfunc.cxx:4034
void SetDocumentModified()
Definition: docsh.cxx:2982
SfxBindings * GetViewBindings()
Definition: docsh4.cxx:2642
void UseScenario(SCTAB nTab, const OUString &rName, bool bRecord=true)
Definition: docsh5.cxx:669
const ScDocument & GetDocument() const
Definition: docsh.hxx:219
ScDrawLayer * MakeDrawLayer()
Definition: docsh2.cxx:169
void ModifyScenario(SCTAB nTab, const OUString &rName, const OUString &rComment, const Color &rColor, ScScenarioFlags nFlags)
Definition: docsh5.cxx:763
ScDBData * GetDBData(const ScRange &rMarked, ScGetDBMode eMode, ScGetDBSelection eSel)
Definition: docsh5.cxx:115
void PostPaint(SCCOL nStartCol, SCROW nStartRow, SCTAB nStartTab, SCCOL nEndCol, SCROW nEndRow, SCTAB nEndTab, PaintPartFlags nPart, sal_uInt16 nExtFlags=0)
Definition: docsh3.cxx:101
SfxPrinter * GetPrinter(bool bCreateIfNotExist=true)
Definition: docsh3.cxx:451
bool AdjustRowHeight(SCROW nStartRow, SCROW nEndRow, SCTAB nTab)
merge with docfunc
Definition: docsh5.cxx:405
virtual SfxUndoManager * GetUndoManager() override
Definition: docsh.cxx:2968
ScDocFunc & GetDocFunc()
Definition: docsh.hxx:221
void UpdateLinks() override
Definition: docsh6.cxx:318
static void RemoveAppPrefix(OUString &rFilterName)
Definition: tablink.cxx:485
static bool GetFilterName(const OUString &rFileName, OUString &rFilter, OUString &rOptions, bool bWithContent, bool bWithInteraction)
Returns the filter name and options from a file name.
Definition: tablink.cxx:431
SC_DLLPUBLIC bool IsScenario(SCTAB nTab) const
Definition: documen3.cxx:432
void SetEmptyCell(const ScAddress &rPos)
Definition: document.cxx:3471
SC_DLLPUBLIC SfxItemPool * GetEnginePool() const
Definition: documen2.cxx:478
SC_DLLPUBLIC bool SetEditText(const ScAddress &rPos, std::unique_ptr< EditTextObject > pEditText)
This method manages the lifecycle of the passed edit text object.
Definition: document.cxx:3422
ScSheetLimits & GetSheetLimits() const
Definition: document.hxx:898
SC_DLLPUBLIC sal_uInt32 GetNumberFormat(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3640
SC_DLLPUBLIC ScRange GetRange(SCTAB nTab, const tools::Rectangle &rMMRect, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1797
SC_DLLPUBLIC ScPatternAttr * GetDefPattern() const
Definition: document.cxx:6045
SC_DLLPUBLIC OUString GetLinkTab(SCTAB nTab) const
Definition: documen3.cxx:530
void UpdatePageBreaks(SCTAB nTab, const ScRange *pUserArea=nullptr)
Definition: document.cxx:6210
SC_DLLPUBLIC void SetFormula(const ScAddress &rPos, const ScTokenArray &rArray)
Definition: documen2.cxx:1135
SC_DLLPUBLIC Color GetTabBgColor(SCTAB nTab) const
Definition: documen3.cxx:449
SC_DLLPUBLIC bool IsTabProtected(SCTAB nTab) const
Definition: documen3.cxx:1905
SC_DLLPUBLIC SCCOL MaxCol() const
Definition: document.hxx:892
SC_DLLPUBLIC bool RenameTab(SCTAB nTab, const OUString &rName, bool bExternalDocument=false)
Definition: document.cxx:837
SC_DLLPUBLIC bool RowFiltered(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4475
SC_DLLPUBLIC void AddPrintRange(SCTAB nTab, const ScRange &rNew)
Adds a new print ranges.
Definition: document.cxx:6297
SC_DLLPUBLIC void SetTextCell(const ScAddress &rPos, const OUString &rStr)
Call this if you are not sure whether to put this as an edit text or a simple text.
Definition: document.cxx:3452
SC_DLLPUBLIC ScDocumentPool * GetPool()
Definition: document.cxx:6050
void GetSearchAndReplaceStart(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow)
Definition: documen3.cxx:1213
SC_DLLPUBLIC SCROW MaxRow() const
Definition: document.hxx:893
SC_DLLPUBLIC void ClearPrintRanges(SCTAB nTab)
Removes all print ranges.
Definition: document.cxx:6291
SC_DLLPUBLIC ScFieldEditEngine & GetEditEngine()
Definition: documen2.cxx:483
css::uno::Sequence< css::sheet::TablePageBreakData > GetRowBreakData(SCTAB nTab) const
Definition: document.cxx:4408
void AddUnoRefChange(sal_Int64 nId, const ScRangeList &rOldRanges)
Definition: documen3.cxx:1002
SC_DLLPUBLIC double GetValue(const ScAddress &rPos) const
Definition: document.cxx:3626
SC_DLLPUBLIC ScChartListenerCollection * GetChartListenerCollection() const
Definition: document.hxx:2233
SC_DLLPUBLIC void SetPrintEntireSheet(SCTAB nTab)
Marks the specified sheet to be printed completely.
Definition: document.cxx:6303
SC_DLLPUBLIC const ScRange * GetPrintRange(SCTAB nTab, sal_uInt16 nPos)
Definition: document.cxx:6268
formula::FormulaGrammar::Grammar GetStorageGrammar() const
Definition: document.hxx:2543
SC_DLLPUBLIC ScBreakType HasRowBreak(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4355
SC_DLLPUBLIC sal_uInt16 GetOriginalHeight(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4153
SC_DLLPUBLIC void GetScenarioData(SCTAB nTab, OUString &rComment, Color &rColor, ScScenarioFlags &rFlags) const
Definition: documen3.cxx:469
void AddUnoObject(SfxListener &rObject)
Definition: documen3.cxx:901
SC_DLLPUBLIC SfxItemPool * GetEditPool() const
Definition: documen2.cxx:473
SC_DLLPUBLIC bool CreateQueryParam(const ScRange &rRange, ScQueryParam &rQueryParam)
Definition: documen3.cxx:1485
void SetCodeName(const OUString &r)
Definition: document.hxx:610
std::unique_ptr< ScPatternAttr > CreateSelectionPattern(const ScMarkData &rMark, bool bDeep=true)
Definition: document.cxx:5015
SC_DLLPUBLIC bool SetString(SCCOL nCol, SCROW nRow, SCTAB nTab, const OUString &rString, const ScSetStringParam *pParam=nullptr)
Definition: document.cxx:3391
SC_DLLPUBLIC OUString GetPageStyle(SCTAB nTab) const
Definition: document.cxx:6176
void GetSelectionFrame(const ScMarkData &rMark, SvxBoxItem &rLineOuter, SvxBoxInfoItem &rLineInner)
Definition: document.cxx:5064
SC_DLLPUBLIC ScBreakType HasColBreak(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4369
SC_DLLPUBLIC bool RowHidden(SCROW nRow, SCTAB nTab, SCROW *pFirstRow=nullptr, SCROW *pLastRow=nullptr) const
Definition: document.cxx:4416
SC_DLLPUBLIC CRFlags GetRowFlags(SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4335
SC_DLLPUBLIC const ScRangeList * GetScenarioRanges(SCTAB nTab) const
Definition: documen3.cxx:872
SC_DLLPUBLIC void SetRepeatRowRange(SCTAB nTab, std::optional< ScRange > oNew)
Definition: document.cxx:6315
bool IsExecuteLinkEnabled() const
Definition: document.hxx:1602
SC_DLLPUBLIC ScLinkMode GetLinkMode(SCTAB nTab) const
Definition: documen3.cxx:502
SC_DLLPUBLIC bool HasAttrib(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, HasAttrFlags nMask) const
Definition: document.cxx:5161
SC_DLLPUBLIC CRFlags GetColFlags(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4327
bool IsBlockEditable(SCTAB nTab, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, bool *pOnlyNotBecauseOfMatrix=nullptr, bool bNoMatrixAtAll=false) const
Definition: document.cxx:5317
void StartListeningArea(const ScRange &rRange, bool bGroupListening, SvtListener *pListener)
Definition: documen7.cxx:35
bool HasUnoRefUndo() const
Definition: document.hxx:1090
void SetError(SCCOL nCol, SCROW nRow, SCTAB nTab, const FormulaError nError)
Definition: documen2.cxx:1129
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1, SCCOL nCol2, SCROW nRow2, SCTAB nTab2, InsertDeleteFlags nFlags, bool bMarked, ScDocument &rDestDoc, const ScMarkData *pMarks=nullptr, bool bColRowFlags=true)
Definition: document.cxx:2041
SC_DLLPUBLIC void SetValue(SCCOL nCol, SCROW nRow, SCTAB nTab, const double &rVal)
Definition: document.cxx:3477
const OUString & GetCodeName() const
Definition: document.hxx:609
void ApplySelectionFrame(const ScMarkData &rMark, const SvxBoxItem &rLineOuter, const SvxBoxInfoItem *pLineInner)
Definition: document.cxx:5743
SfxObjectShell * GetDocumentShell() const
Definition: document.hxx:1083
SC_DLLPUBLIC std::optional< ScRange > GetRepeatColRange(SCTAB nTab)
Definition: document.cxx:6276
SC_DLLPUBLIC svl::SharedStringPool & GetSharedStringPool()
Definition: documen2.cxx:601
SC_DLLPUBLIC sal_uLong AddValidationEntry(const ScValidationData &rNew)
Definition: documen4.cxx:719
SC_DLLPUBLIC void SetPageStyle(SCTAB nTab, const OUString &rName)
Definition: document.cxx:6170
void SetLink(SCTAB nTab, ScLinkMode nMode, const OUString &rDoc, const OUString &rFilter, const OUString &rOptions, const OUString &rTabName, sal_uLong nRefreshDelay)
Definition: documen3.cxx:544
void AddUnoListenerCall(const css::uno::Reference< css::util::XModifyListener > &rListener, const css::lang::EventObject &rEvent)
Definition: documen3.cxx:980
SC_DLLPUBLIC ScConditionalFormatList * GetCondFormList(SCTAB nTab) const
Definition: documen4.cxx:860
SC_DLLPUBLIC std::optional< ScRange > GetRepeatRowRange(SCTAB nTab)
Definition: document.cxx:6284
SC_DLLPUBLIC SvNumberFormatter * GetFormatTable() const
Definition: documen2.cxx:467
sal_Int64 GetNewUnoId()
Definition: document.hxx:1093
SC_DLLPUBLIC bool ColHidden(SCCOL nCol, SCTAB nTab, SCCOL *pFirstCol=nullptr, SCCOL *pLastCol=nullptr) const
Definition: document.cxx:4430
SC_DLLPUBLIC void SetActiveScenario(SCTAB nTab, bool bActive)
Definition: documen3.cxx:886
bool SearchAndReplace(const SvxSearchItem &rSearchItem, SCCOL &rCol, SCROW &rRow, SCTAB &rTab, const ScMarkData &rMark, ScRangeList &rMatchedRanges, OUString &rUndoStr, ScDocument *pUndoDoc, bool &bMatchedRangesWereClamped)
Definition: documen3.cxx:1307
std::unique_ptr< ScPrintRangeSaver > CreatePrintRangeSaver() const
Definition: document.cxx:6321
SC_DLLPUBLIC void DeleteAreaTab(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2, SCTAB nTab, InsertDeleteFlags nDelFlag)
Definition: document.cxx:1920
SC_DLLPUBLIC bool IsVisible(SCTAB nTab) const
Definition: document.cxx:890
void RemoveUnoObject(SfxListener &rObject)
Definition: documen3.cxx:909
SC_DLLPUBLIC sal_uInt16 GetOriginalWidth(SCCOL nCol, SCTAB nTab) const
Definition: document.cxx:4137
SC_DLLPUBLIC OUString GetLinkDoc(SCTAB nTab) const
Definition: documen3.cxx:509
bool GetNextMarkedCell(SCCOL &rCol, SCROW &rRow, SCTAB nTab, const ScMarkData &rMark)
Definition: documen4.cxx:538
void RemoveCondFormatData(const ScRangeList &rRange, SCTAB nTab, sal_uInt32 nIndex)
Definition: document.cxx:4796
SC_DLLPUBLIC const ScFormulaCell * GetFormulaCell(const ScAddress &rPos) const
Definition: document.cxx:3714
SC_DLLPUBLIC CellType GetCellType(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:3736
SC_DLLPUBLIC bool IsLayoutRTL(SCTAB nTab) const
Definition: document.cxx:974
void GetNotesInRange(const ScRangeList &rRange, std::vector< sc::NoteEntry > &rNotes) const
Definition: document.cxx:6852
SC_DLLPUBLIC void SetRepeatColRange(SCTAB nTab, std::optional< ScRange > oNew)
Definition: document.cxx:6309
SC_DLLPUBLIC sfx2::LinkManager * GetLinkManager()
Definition: documen2.cxx:231
bool IsUndoEnabled() const
Definition: document.hxx:1595
bool GetSelectionFunction(ScSubTotalFunc eFunc, const ScAddress &rCursor, const ScMarkData &rMark, double &rResult)
Definition: documen4.cxx:602
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6261
bool IsPrintEntireSheet(SCTAB nTab) const
Returns true, if the specified sheet is always printed.
Definition: document.cxx:6255
SC_DLLPUBLIC bool GetName(SCTAB nTab, OUString &rName) const
Definition: document.cxx:204
SC_DLLPUBLIC void SetRowFiltered(SCROW nStartRow, SCROW nEndRow, SCTAB nTab, bool bFiltered)
Definition: document.cxx:4496
SC_DLLPUBLIC const SfxPoolItem * GetAttr(SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich) const
Definition: document.cxx:4684
SC_DLLPUBLIC ScColumnsRange GetColumnsRange(SCTAB nTab, SCCOL nColBegin, SCCOL nColEnd) const
Definition: document.cxx:2541
void GetScenarioFlags(SCTAB nTab, ScScenarioFlags &rFlags) const
Definition: documen3.cxx:480
void RemoveManualBreaks(SCTAB nTab)
Definition: document.cxx:6216
SC_DLLPUBLIC const ScPatternAttr * GetPattern(SCCOL nCol, SCROW nRow, SCTAB nTab) const
Definition: document.cxx:4719
Size GetPageSize(SCTAB nTab) const
Definition: document.cxx:6189
SC_DLLPUBLIC bool IsActiveScenario(SCTAB nTab) const
Definition: documen3.cxx:880
SC_DLLPUBLIC tools::Rectangle GetMMRect(SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero=true) const
Definition: documen3.cxx:1986
bool IsImportingXML() const
Definition: document.hxx:2227
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:297
void SetTextCurrentDefaults(const EditTextObject &rTextObject)
SetText and apply defaults already set.
Definition: editutil.cxx:619
void InitDoc(const css::uno::Reference< css::text::XTextRange > &rContent, std::unique_ptr< ScEditSource > pEditSrc, const ESelection &rSel)
Definition: fielduno.cxx:1062
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
Definition: fielduno.cxx:1174
void DeleteField()
Definition: fielduno.cxx:1085
sal_Int32 GetFieldType() const
Definition: fielduno.hxx:202
SvxFieldItem CreateFieldItem()
Definition: fielduno.cxx:1079
bool IsInserted() const
Definition: fielduno.cxx:1101
Use this guard when performing something from the API that might query values from external reference...
void SetChanged(bool b)
bool GetMatrixOrigin(const ScDocument &rDoc, ScAddress &rPos) const
FormulaError GetErrCode()
ScTokenArray * GetCode()
void SetHybridFormula(const OUString &r, const formula::FormulaGrammar::Grammar eGrammar)
For import only: set a temporary formula string to be compiled later.
OUString GetFormula(const formula::FormulaGrammar::Grammar=formula::FormulaGrammar::GRAM_DEFAULT, const ScInterpreterContext *pContext=nullptr) const
void SetHybridDouble(double n)
For import only: set a double result.
static SC_DLLPUBLIC OUString GetDocTabName(std::u16string_view rFileName, std::u16string_view rTabName)
Definition: global2.cxx:324
static SC_DLLPUBLIC sal_uInt32 GetStandardFormat(SvNumberFormatter &, sal_uInt32 nFormat, SvNumFormatType nType)
Definition: global.cxx:160
static SvNumberFormatter * GetEnglishFormatter()
a "ReadOnly" formatter for UNO/XML export
Definition: global.cxx:174
static SC_DLLPUBLIC ScAutoFormat * GetOrCreateAutoFormat()
Definition: global.cxx:266
static SC_DLLPUBLIC OUString GetAbsDocName(const OUString &rFileName, const SfxObjectShell *pShell)
Definition: global2.cxx:287
static void AssignTableBorder2ToAny(css::uno::Any &rAny, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner, bool bInvalidateHorVerDist=false)
Definition: cellsuno.cxx:979
static void FillBorderLine(css::table::BorderLine &rStruct, const ::editeng::SvxBorderLine *pLine)
static void ApplyBorder(ScDocShell *pDocShell, const ScRangeList &rRanges, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner)
move lcl_ApplyBorder to docfunc !
Definition: cellsuno.cxx:989
static void FillBoxItems(SvxBoxItem &rOuter, SvxBoxInfoItem &rInner, const css::table::TableBorder &rBorder)
static void AssignTableBorderToAny(css::uno::Any &rAny, const SvxBoxItem &rOuter, const SvxBoxInfoItem &rInner, bool bInvalidateHorVerDist=false)
Definition: cellsuno.cxx:971
static const ::editeng::SvxBorderLine * GetBorderLine(::editeng::SvxBorderLine &rLine, const css::table::BorderLine &rStruct)
static void FillImportParam(ScImportParam &rParam, const css::uno::Sequence< css::beans::PropertyValue > &rSeq)
Definition: datauno.cxx:205
static void FillProperties(css::uno::Sequence< css::beans::PropertyValue > &rSeq, const ScImportParam &rParam)
Definition: datauno.cxx:165
static tools::Long GetPropertyCount()
Definition: datauno.hxx:81
virtual void Notify(const SfxHint &rHint) override
Definition: cellsuno.cxx:837
Link< const SfxHint &, void > aLink
Definition: cellsuno.hxx:122
todo: It should be possible to have MarkArrays for each table, in order to enable "search all" across...
Definition: markdata.hxx:43
bool IsAllMarked(const ScRange &rRange) const
Definition: markdata.cxx:565
void SelectTable(SCTAB nTab, bool bNew)
Definition: markdata.cxx:157
void SelectOneTable(SCTAB nTab)
Definition: markdata.cxx:174
void SetMultiMarkArea(const ScRange &rRange, bool bMark=true, bool bSetupMulti=false)
Definition: markdata.cxx:107
void SetMarkArea(const ScRange &rRange)
Definition: markdata.cxx:92
void MarkFromRangeList(const ScRangeList &rList, bool bReset)
Definition: markdata.cxx:319
void RemoveOutline(const ScRange &rRange, bool bColumns, bool bRecord, bool bApi)
Definition: olinefun.cxx:138
bool HideMarkedOutlines(const ScRange &rRange, bool bRecord)
Definition: olinefun.cxx:540
void MakeOutline(const ScRange &rRange, bool bColumns, bool bRecord, bool bApi)
Definition: olinefun.cxx:80
bool RemoveAllOutlines(SCTAB nTab, bool bRecord)
Definition: olinefun.cxx:201
bool ShowMarkedOutlines(const ScRange &rRange, bool bRecord)
Definition: olinefun.cxx:426
void AutoOutline(const ScRange &rRange, bool bRecord)
Definition: olinefun.cxx:253
bool SelectLevel(SCTAB nTab, bool bColumns, sal_uInt16 nLevel, bool bRecord, bool bPaint)
Definition: olinefun.cxx:314
sal_uInt64 GetKey() const
Definition: patattr.cxx:1502
SfxItemSet & GetItemSet()
Definition: patattr.hxx:192
const SfxPoolItem & GetItem(sal_uInt16 nWhichP) const
Definition: patattr.hxx:73
bool UpdatePages()
Definition: printfun.cxx:2426
void RemoveAll()
Definition: rangelst.cxx:1101
void Format(OUString &, ScRefFlags nFlags, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, sal_Unicode cDelimiter=0, bool bFullAddressNotation=false) const
Definition: rangelst.cxx:132
void Join(const ScRange &, bool bIsInList=false)
Definition: rangelst.cxx:152
bool empty() const
Definition: rangelst.hxx:88
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1137
size_t size() const
Definition: rangelst.hxx:89
bool UpdateReference(UpdateRefMode, const ScDocument *, const ScRange &rWhere, SCCOL nDx, SCROW nDy, SCTAB nDz)
Definition: rangelst.cxx:357
void insert(std::vector< ScRange >::iterator aPos, std::vector< ScRange >::const_iterator aSourceBegin, std::vector< ScRange >::const_iterator aSourceEnd)
Definition: rangelst.hxx:101
ScRefFlags Parse(std::u16string_view, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, SCTAB nDefaultTab=0, sal_Unicode cDelimiter=0)
Definition: rangelst.cxx:92
static bool FillMixedArray(css::uno::Any &rAny, ScDocument &rDoc, const ScRange &rRange, bool bAllowNV=false)
static bool MakeRangeFromName(const OUString &rName, const ScDocument &rDoc, SCTAB nCurTab, ScRange &rRange, RutlNameScope eScope=RUTL_NAMES, ScAddress::Details const &rDetails=ScAddress::detailsOOOa1, bool bUseDetailsPos=false)
Definition: rangeutl.cxx:233
OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2170
void PutInOrder()
Definition: address.hxx:622
ScAddress aEnd
Definition: address.hxx:498
bool Intersects(const ScRange &rRange) const
Definition: address.hxx:734
bool Contains(const ScAddress &) const
is Address& fully in Range?
Definition: address.hxx:718
ScRefFlags ParseAny(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1)
Definition: address.cxx:1733
ScAddress aStart
Definition: address.hxx:497
static void FillProperties(css::uno::Sequence< css::beans::PropertyValue > &rSeq, const ScSortParam &rParam)
Definition: datauno.cxx:260
static void FillSortParam(ScSortParam &rParam, const css::uno::Sequence< css::beans::PropertyValue > &rSeq)
Definition: datauno.cxx:322
static tools::Long GetPropertyCount()
SortAscending needs to get out of the SheetSortDescriptor service description.
Definition: datauno.hxx:96
static ScInputStringType parseInputString(SvNumberFormatter &rFormatter, const OUString &rStr, LanguageType eLang)
Definition: stringutil.cxx:430
static bool SC_DLLPUBLIC isMultiline(std::u16string_view rStr)
Definition: stringutil.cxx:425
static SC_DLLPUBLIC OUString ProgrammaticToDisplayName(const OUString &rProgName, SfxStyleFamily nType)
static OUString DisplayToProgrammaticName(const OUString &rDispName, SfxStyleFamily nType)
static css::uno::Reference< css::container::XIndexReplace > CreateEmptyNumberingRules()
Definition: styleuno.cxx:1156
virtual void GetData(ScSubTotalParam &rParam) const =0
virtual void GetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, css::uno::Any &) override
Definition: cellsuno.cxx:8350
const SfxItemPropertySet * pColPropSet
Definition: cellsuno.hxx:966
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cellsuno.cxx:8279
virtual ~ScTableColumnObj() override
Definition: cellsuno.cxx:8226
virtual void SAL_CALL setName(const OUString &aName) override
Definition: cellsuno.cxx:8272
ScTableColumnObj(ScDocShell *pDocSh, SCCOL nCol, SCTAB nTab)
Definition: cellsuno.cxx:8220
virtual OUString SAL_CALL getName() override
Definition: cellsuno.cxx:8261
virtual const SfxItemPropertyMap & GetItemPropertyMap() override
Definition: cellsuno.cxx:8398
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: cellsuno.cxx:8247
virtual void SAL_CALL acquire() noexcept override
Definition: cellsuno.cxx:8237
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: cellsuno.cxx:8254
virtual void SetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, const css::uno::Any &aValue) override
Definition: cellsuno.cxx:8287
virtual void SAL_CALL release() noexcept override
Definition: cellsuno.cxx:8242
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: cellsuno.cxx:8230
void FillFormat(ScConditionalFormat &rFormat, ScDocument &rDoc, formula::FormulaGrammar::Grammar eGrammar) const
Definition: fmtuno.cxx:196
virtual sal_Int32 SAL_CALL getCount() override
Definition: fmtuno.cxx:368
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cellsuno.cxx:8415
virtual void SetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, const css::uno::Any &aValue) override
Definition: cellsuno.cxx:8423
ScTableRowObj(ScDocShell *pDocSh, SCROW nRow, SCTAB nTab)
Definition: cellsuno.cxx:8403
const SfxItemPropertySet * pRowPropSet
Definition: cellsuno.hxx:1004
virtual void GetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, css::uno::Any &) override
Definition: cellsuno.cxx:8497
virtual const SfxItemPropertyMap & GetItemPropertyMap() override
Definition: cellsuno.cxx:8548
virtual ~ScTableRowObj() override
Definition: cellsuno.cxx:8409
virtual void SAL_CALL setExternalName(const OUString &aUrl, const OUString &aSheetName) override
Definition: cellsuno.cxx:7683
virtual sal_Bool SAL_CALL getPrintTitleColumns() override
Definition: cellsuno.cxx:7033
virtual void SAL_CALL setPrintTitleRows(sal_Bool bPrintTitleRows) override
Definition: cellsuno.cxx:7124
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
Definition: cellsuno.cxx:6532
virtual void SAL_CALL apply() override
Definition: cellsuno.cxx:7627
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: cellsuno.cxx:6497
virtual void SAL_CALL removeRange(const css::table::CellRangeAddress &aRange, css::sheet::CellDeleteMode nMode) override
Definition: cellsuno.cxx:6877
virtual void SAL_CALL setScenarioComment(const OUString &aScenarioComment) override
Definition: cellsuno.cxx:7573
virtual OUString SAL_CALL getScenarioComment() override
Definition: cellsuno.cxx:7558
virtual void SAL_CALL moveRange(const css::table::CellAddress &aDestination, const css::table::CellRangeAddress &aSource) override
Definition: cellsuno.cxx:6908
virtual void SAL_CALL group(const css::table::CellRangeAddress &aRange, css::table::TableOrientation nOrientation) override
Definition: cellsuno.cxx:7416
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByName(const OUString &aRange) override
Definition: cellsuno.cxx:6638
virtual const SfxItemPropertyMap & GetItemPropertyMap() override
Definition: cellsuno.cxx:8192
virtual OUString SAL_CALL getImplementationName() override
Definition: cellsuno.cxx:8199
virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL createCursorByRange(const css::uno::Reference< css::sheet::XSheetCellRange > &aRange) override
Definition: cellsuno.cxx:6659
virtual css::uno::Reference< css::table::XCellRange > SAL_CALL getCellRangeByPosition(sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom) override
Definition: cellsuno.cxx:6695
virtual void SAL_CALL setLinkUrl(const OUString &aLinkUrl) override
Definition: cellsuno.cxx:7229
virtual sal_Bool SAL_CALL hidePrecedents(const css::table::CellAddress &aPosition) override
Definition: cellsuno.cxx:7341
const SfxItemPropertySet * pSheetPropSet
Definition: cellsuno.hxx:789
virtual void SAL_CALL unprotect(const OUString &aPassword) override
Definition: cellsuno.cxx:7523
ScTableSheetObj(ScDocShell *pDocSh, SCTAB nTab)
Definition: cellsuno.cxx:6481
virtual sal_Bool SAL_CALL getPrintTitleRows() override
Definition: cellsuno.cxx:7111
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: cellsuno.cxx:8209
virtual void GetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, css::uno::Any &) override
Definition: cellsuno.cxx:8049
virtual void SAL_CALL clearOutline() override
Definition: cellsuno.cxx:7459
virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL getColumnPageBreaks() override
Definition: cellsuno.cxx:6702
virtual sal_Bool SAL_CALL hideDependents(const css::table::CellAddress &aPosition) override
Definition: cellsuno.cxx:7327
virtual sal_Bool SAL_CALL showPrecedents(const css::table::CellAddress &aPosition) override
Definition: cellsuno.cxx:7369
virtual css::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() override
Definition: cellsuno.cxx:6561
virtual void SetOnePropertyValue(const SfxItemPropertyMapEntry *pEntry, const css::uno::Any &aValue) override
Definition: cellsuno.cxx:7722
virtual void SAL_CALL acquire() noexcept override
Definition: cellsuno.cxx:6522
virtual void SAL_CALL setPrintAreas(const css::uno::Sequence< css::table::CellRangeAddress > &aPrintAreas) override
Definition: cellsuno.cxx:7002
virtual OUString SAL_CALL getLinkSheetName() override
Definition: cellsuno.cxx:7241
SCTAB GetTab_Impl() const
Definition: cellsuno.cxx:6568
virtual void SAL_CALL ungroup(const css::table::CellRangeAddress &aRange, css::table::TableOrientation nOrientation) override
Definition: cellsuno.cxx:7431
void PrintAreaUndo_Impl(std::unique_ptr< ScPrintRangeSaver > pOldRanges)
Definition: cellsuno.cxx:6940
virtual void SAL_CALL autoOutline(const css::table::CellRangeAddress &aRange) override
Definition: cellsuno.cxx:7446
virtual css::uno::Reference< css::table::XCell > SAL_CALL getCellByPosition(sal_Int32 nColumn, sal_Int32 nRow) override
Definition: cellsuno.cxx:6688
virtual css::uno::Reference< css::sheet::XSpreadsheet > SAL_CALL getSpreadsheet() override
Definition: cellsuno.cxx:6681
virtual void SAL_CALL addRanges(const css::uno::Sequence< css::table::CellRangeAddress > &aRanges) override
Definition: cellsuno.cxx:7595
virtual css::uno::Reference< css::sheet::XSheetCellCursor > SAL_CALL createCursor() override
Definition: cellsuno.cxx:6645
virtual css::uno::Sequence< css::sheet::TablePageBreakData > SAL_CALL getRowPageBreaks() override
Definition: cellsuno.cxx:6746
virtual void SAL_CALL release() noexcept override
Definition: cellsuno.cxx:6527
virtual css::uno::Reference< css::table::XTablePivotCharts > SAL_CALL getPivotCharts() override
Definition: cellsuno.cxx:6592
virtual css::sheet::SheetLinkMode SAL_CALL getLinkMode() override
Definition: cellsuno.cxx:7191
virtual void SAL_CALL setLinkSheetName(const OUString &aLinkSheetName) override
Definition: cellsuno.cxx:7251
virtual void SAL_CALL setLinkMode(css::sheet::SheetLinkMode nLinkMode) override
Definition: cellsuno.cxx:7207
virtual void SAL_CALL setName(const OUString &aName) override
Definition: cellsuno.cxx:6811
virtual css::uno::Reference< css::table::XTableCharts > SAL_CALL getCharts() override
Definition: cellsuno.cxx:6581
virtual OUString SAL_CALL getName() override
Definition: cellsuno.cxx:6801
virtual void SAL_CALL setTitleColumns(const css::table::CellRangeAddress &aTitleColumns) override
Definition: cellsuno.cxx:7092
virtual sal_Bool SAL_CALL showErrors(const css::table::CellAddress &aPosition) override
Definition: cellsuno.cxx:7383
virtual void SAL_CALL protect(const OUString &aPassword) override
Definition: cellsuno.cxx:7512
virtual ~ScTableSheetObj() override
Definition: cellsuno.cxx:6487
virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL getRanges() override
Definition: cellsuno.cxx:7651
virtual css::uno::Reference< css::sheet::XScenarios > SAL_CALL getScenarios() override
Definition: cellsuno.cxx:6614
virtual void SAL_CALL setPrintTitleColumns(sal_Bool bPrintTitleColumns) override
Definition: cellsuno.cxx:7046
virtual void SAL_CALL insertCells(const css::table::CellRangeAddress &aRange, css::sheet::CellInsertMode nMode) override
Definition: cellsuno.cxx:6846
virtual void SAL_CALL removeAllManualPageBreaks() override
Definition: cellsuno.cxx:6769
virtual void SAL_CALL copyRange(const css::table::CellAddress &aDestination, const css::table::CellRangeAddress &aSource) override
Definition: cellsuno.cxx:6923
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
Definition: cellsuno.cxx:8204
virtual css::uno::Reference< css::container::XNameReplace > SAL_CALL getEvents() override
Definition: cellsuno.cxx:7702
virtual void SAL_CALL clearArrows() override
Definition: cellsuno.cxx:7406
virtual css::uno::Reference< css::sheet::XDataPilotTables > SAL_CALL getDataPilotTables() override
Definition: cellsuno.cxx:6603
virtual css::uno::Reference< css::sheet::XSheetAnnotations > SAL_CALL getAnnotations() override
Definition: cellsuno.cxx:6626
virtual void SAL_CALL showLevel(sal_Int16 nLevel, css::table::TableOrientation nOrientation) override
Definition: cellsuno.cxx:7497
virtual sal_Bool SAL_CALL isProtected() override
Definition: cellsuno.cxx:7535
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override
Definition: cellsuno.cxx:6823
virtual OUString SAL_CALL getLinkUrl() override
Definition: cellsuno.cxx:7219
virtual void SAL_CALL link(const OUString &aUrl, const OUString &aSheetName, const OUString &aFilterName, const OUString &aFilterOptions, css::sheet::SheetLinkMode nMode) override
Definition: cellsuno.cxx:7263
virtual sal_Bool SAL_CALL showDependents(const css::table::CellAddress &aPosition) override
Definition: cellsuno.cxx:7355
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: cellsuno.cxx:7714
virtual void SAL_CALL setTitleRows(const css::table::CellRangeAddress &aTitleRows) override
Definition: cellsuno.cxx:7170
virtual css::uno::Sequence< css::table::CellRangeAddress > SAL_CALL getPrintAreas() override
Definition: cellsuno.cxx:6973
virtual css::table::CellRangeAddress SAL_CALL getTitleRows() override
Definition: cellsuno.cxx:7151
void InitInsertSheet(ScDocShell *pDocSh, SCTAB nTab)
Definition: cellsuno.cxx:6491
virtual css::table::CellRangeAddress SAL_CALL getTitleColumns() override
Definition: cellsuno.cxx:7073
virtual void SAL_CALL showDetail(const css::table::CellRangeAddress &aRange) override
Definition: cellsuno.cxx:7484
virtual void SAL_CALL hideDetail(const css::table::CellRangeAddress &aRange) override
Definition: cellsuno.cxx:7471
virtual sal_Bool SAL_CALL getIsScenario() override
Definition: cellsuno.cxx:7548
virtual sal_Bool SAL_CALL showInvalid() override
Definition: cellsuno.cxx:7397
ScValidationData * CreateValidationData(ScDocument &rDoc, formula::FormulaGrammar::Grammar eGrammar) const
Definition: fmtuno.cxx:582
static SC_DLLPUBLIC void ConvertToTokenSequence(const ScDocument &rDoc, css::uno::Sequence< css::sheet::FormulaToken > &rSequence, const ScTokenArray &rTokenArray)
Definition: tokenuno.cxx:380
static SC_DLLPUBLIC bool ConvertToTokenArray(ScDocument &rDoc, ScTokenArray &rTokenArray, const css::uno::Sequence< css::sheet::FormulaToken > &rSequence)
Definition: tokenuno.cxx:374
ScUniqueCellFormatsEnumeration(ScDocShell *pDocShell, std::vector< ScRangeList > &&rRangeLists)
Definition: cellsuno.cxx:9202
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: cellsuno.cxx:9218
virtual ~ScUniqueCellFormatsEnumeration() override
Definition: cellsuno.cxx:9210
virtual css::uno::Any SAL_CALL nextElement() override
Definition: cellsuno.cxx:9239
virtual sal_Bool SAL_CALL hasMoreElements() override
Definition: cellsuno.cxx:9233
std::vector< ScRangeList > aRangeLists
Definition: cellsuno.hxx:1197
virtual sal_Bool SAL_CALL hasElements() override
Definition: cellsuno.cxx:9186
ScUniqueCellFormatsObj(ScDocShell *pDocSh, const ScRange &rR)
Definition: cellsuno.cxx:9118
virtual sal_Int32 SAL_CALL getCount() override
Definition: cellsuno.cxx:9163
ScDocShell * pDocShell
Definition: cellsuno.hxx:1164
std::vector< ScRangeList > aRangeLists
Definition: cellsuno.hxx:1165
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: cellsuno.cxx:8962
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
Definition: cellsuno.cxx:9194
virtual css::uno::Type SAL_CALL getElementType() override
Definition: cellsuno.cxx:9181
virtual ~ScUniqueCellFormatsObj() override
Definition: cellsuno.cxx:8954
virtual css::uno::Any SAL_CALL getByIndex(sal_Int32 Index) override
Definition: cellsuno.cxx:9170
static void FillScRange(ScRange &rScRange, const css::table::CellRangeAddress &rApiRange)
Definition: convuno.hxx:79
static void FillApiRange(css::table::CellRangeAddress &rApiRange, const ScRange &rScRange)
Definition: convuno.hxx:87
static bool GetBoolFromAny(const css::uno::Any &aAny)
Definition: miscuno.cxx:139
Hint to restore a UNO object to its old state (used during undo).
Definition: unoreflist.hxx:61
const ScRange & GetRange() const
Definition: hints.hxx:60
SCCOL GetDx() const
Definition: hints.hxx:61
SCTAB GetDz() const
Definition: hints.hxx:63
SCROW GetDy() const
Definition: hints.hxx:62
UpdateRefMode GetMode() const
Definition: hints.hxx:59
const SdrPage * GetPage(sal_uInt16 nPgNum) const
static SdrItemPool & GetGlobalDrawObjectItemPool()
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
void Invalidate(sal_uInt16 nId)
SfxHintId GetId() const
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
void setPropertyValue(const SfxItemPropertyMapEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
const SfxItemPropertyMap & getPropertyMap() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
void ClearInvalidItems()
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const OUString & GetName() const
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void GetInputLineString(const double &fOutNumber, sal_uInt32 nFIndex, OUString &rOutString, bool bFiltering=false, bool bForceSystemLocale=false)
SvNumFormatType GetType(sal_uInt32 nFIndex) const
const SvNumberformat * GetEntry(sal_uInt32 nKey) const
sal_uInt32 GetFormatForLanguageIfBuiltIn(sal_uInt32 nFormat, LanguageType eLnge=LANGUAGE_DONTKNOW)
bool IsNumberFormat(const OUString &sString, sal_uInt32 &F_Index, double &fOutNumber, SvNumInputOptions eInputOptions=SvNumInputOptions::NONE)
LanguageType GetLanguage() const
void SetTable(bool bNew)
bool IsValid(SvxBoxInfoItemValidFlags nValid) const
const editeng::SvxBorderLine * GetHori() const
const editeng::SvxBorderLine * GetVert() const
void SetValid(SvxBoxInfoItemValidFlags nValid, bool bValid=true)
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
static bool LineToSvxLine(const css::table::BorderLine &rLine, editeng::SvxBorderLine &rSvxLine, bool bConvert)
const editeng::SvxBorderLine * GetTop() const
sal_uInt16 GetSmallestDistance() const
const editeng::SvxBorderLine * GetRight() const
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
static css::table::BorderLine2 SvxLineToLine(const editeng::SvxBorderLine *pLine, bool bConvert)
const editeng::SvxBorderLine * GetLeft() const
const editeng::SvxBorderLine * GetBottom() const
void SetAllDistances(sal_Int16 nNew)
virtual SvxTextForwarder * GetTextForwarder()=0
virtual void UpdateData()=0
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
void SetSelection(bool bNewSelection)
void SetCommand(SvxSearchCmd nNewCommand)
virtual void QuickInsertField(const SvxFieldItem &rFld, const ESelection &rSel)=0
virtual void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
virtual sal_Bool SAL_CALL hasElements() override
virtual void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
virtual void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
css::uno::Type const & get()
sal_uInt16 GetDistance() const
sal_uInt16 GetOutWidth() const
sal_uInt16 GetInWidth() const
static Grammar mapAPItoGrammar(const bool bEnglish, const bool bXML)
bool empty() const
const SvBaseLinks & GetLinks() const
SharedString intern(const OUString &rStr)
constexpr tools::Long Top() const
constexpr Size GetSize() const
constexpr tools::Long Left() const
bool is() const
constexpr ::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
virtual OUString GetName() const override
#define SC_PF_TESTMERGE
Definition: docsh.hxx:77
#define SC_PF_LINES
Definition: docsh.hxx:76
std::unique_ptr< ScDocument, o3tl::default_delete< ScDocument > > ScDocumentUniquePtr
Definition: document.hxx:2720
@ SCDOCMODE_UNDO
Definition: document.hxx:258
float u
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_PARA_XMLATTRIBS(EE_PARA_START+1)
constexpr TypedWhichId< SvxEscapementItem > EE_CHAR_ESCAPEMENT(EE_CHAR_START+10)
constexpr TypedWhichId< SvXMLAttrContainerItem > EE_CHAR_XMLATTRIBS(EE_CHAR_START+28)
FormulaError
DocumentType eType
sal_Int16 nValue
ScGeneralFunction
the css::sheet::GeneralFunction enum is extended by constants in GeneralFunction2,...
const SCSIZE MAXSUBTOTAL
Definition: global.hxx:82
ScBreakType
Definition: global.hxx:139
CellType
Definition: global.hxx:272
@ CELLTYPE_EDIT
Definition: global.hxx:277
@ CELLTYPE_STRING
Definition: global.hxx:275
@ CELLTYPE_FORMULA
Definition: global.hxx:276
@ CELLTYPE_VALUE
Definition: global.hxx:274
@ URM_INSDEL
Definition: global.hxx:302
DelCellCmd
Definition: global.hxx:281
InsCellCmd
Definition: global.hxx:290
@ INS_NONE
Definition: global.hxx:295
@ INS_CELLSDOWN
Definition: global.hxx:291
@ INS_INSCOLS_BEFORE
Definition: global.hxx:294
@ INS_CELLSRIGHT
Definition: global.hxx:292
@ INS_INSROWS_BEFORE
Definition: global.hxx:293
InsertDeleteFlags
Definition: global.hxx:149
@ NOCAPTIONS
Sparklines in a cell.
@ EDITATTR
Drawing objects.
@ ATTRIB
Internal use only (d&d undo): do not delete caption objects of cell notes.
ScSizeMode
Definition: global.hxx:351
@ SC_SIZE_DIRECT
Definition: global.hxx:352
@ SC_SIZE_OPTIMAL
Definition: global.hxx:353
@ SC_SIZE_ORIGINAL
Definition: global.hxx:356
@ SC_SIZE_SHOW
Definition: global.hxx:354
FillDateCmd
Definition: global.hxx:334
@ FILL_MONTH
Definition: global.hxx:337
@ FILL_YEAR
Definition: global.hxx:339
@ FILL_WEEKDAY
Definition: global.hxx:336
@ FILL_DAY
Definition: global.hxx:335
@ ForceMark
Behave as if the range corresponding to a ScDBData area was selected, for API use.
ScLinkMode
Definition: global.hxx:215
ScSubTotalFunc
Definition: global.hxx:860
ScScenarioFlags
Definition: global.hxx:226
constexpr sal_Int32 STD_EXTRA_WIDTH
Definition: global.hxx:88
#define MAXDOUBLE
Definition: global.hxx:77
@ SC_DB_MAKE
create "untitled" (if necessary)
Definition: global.hxx:383
@ SC_DB_OLD
don't create
Definition: global.hxx:386
FillCmd
Definition: global.hxx:317
@ FILL_GROWTH
Definition: global.hxx:320
@ FILL_LINEAR
Definition: global.hxx:319
@ FILL_AUTO
Definition: global.hxx:322
@ FILL_SIMPLE
Definition: global.hxx:318
@ FILL_DATE
Definition: global.hxx:321
FillDir
Definition: global.hxx:309
@ FILL_TO_TOP
Definition: global.hxx:312
@ FILL_TO_RIGHT
Definition: global.hxx:311
@ FILL_TO_LEFT
Definition: global.hxx:313
@ FILL_TO_BOTTOM
Definition: global.hxx:310
SfxHintId
sal_Int32 nIndex
OUString aName
Mode eMode
void * p
sal_Int64 n
#define LANGUAGE_DONTKNOW
#define LANGUAGE_ENGLISH_US
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
#define SAL_WARN_IF(condition, area, stream)
#define MID_TL_HASCOLOR
#define MID_HORJUST_ADJUST
#define MID_LANG_LOCALE
#define MID_RELIEF
#define MID_EMPHASIS
#define MID_FONT_PITCH
#define MID_FONT_CHAR_SET
#define MID_POSTURE
#define MID_FONTHEIGHT
#define MID_FONT_FAMILY
#define MID_CROSSED_OUT
#define MID_WEIGHT
#define MID_TL_STYLE
#define MID_HORJUST_HORJUST
#define MID_GRAPHIC_TRANSPARENT
#define MID_TL_COLOR
#define MID_CROSS_OUT
#define MID_FONT_FAMILY_NAME
#define MID_FONT_STYLE_NAME
aStr
std::unique_ptr< sal_Int32[]> pData
#define SC_QUERYINTERFACE(x)
Definition: miscuno.hxx:86
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
Definition: miscuno.hxx:63
#define SC_QUERY_MULTIPLE(x, y)
Definition: miscuno.hxx:93
void Notify(ScModelObj &rModelObj, const ScRangeList &rChangeRanges, const OUString &rType=OUString("cell-change"), const css::uno::Sequence< css::beans::PropertyValue > &rProperties=css::uno::Sequence< css::beans::PropertyValue >())
Definition: docsh.hxx:498
constexpr OUStringLiteral aData
void Clear(EHistoryType eHistory)
css::uno::Sequence< T > concatSequences(const css::uno::Sequence< T > &rS1, const Ss &... rSn)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
int i
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
constexpr auto toTwips(N number, Length from)
const SvxPageUsage aArr[]
bool GetRanges(std::vector< std::shared_ptr< SwUnoCursor > > &rRanges, SwDoc &rDoc, SwPaM const &rDelPam)
long Long
State
sal_Int16 nId
const char GetValue[]
#define CONVERT_TWIPS
SfxItemState
@ RUTL_DBASE
Definition: rangeutl.hxx:41
@ RUTL_NAMES
Definition: rangeutl.hxx:38
OUString ScResId(TranslateId aId)
Definition: scdll.cxx:90
constexpr TypedWhichId< ScIndentItem > ATTR_INDENT(131)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_FONT_HEIGHT(101)
constexpr TypedWhichId< SfxBoolItem > ATTR_VERTICAL_ASIAN(137)
constexpr TypedWhichId< SvxFontItem > ATTR_CJK_FONT(111)
constexpr TypedWhichId< SfxStringItem > ATTR_HYPERLINK(155)
constexpr TypedWhichId< SvxForbiddenRuleItem > ATTR_FORBIDDEN_RULES(128)
constexpr TypedWhichId< SvxPostureItem > ATTR_CTL_FONT_POSTURE(119)
constexpr TypedWhichId< SvxFontItem > ATTR_CTL_FONT(116)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CJK_FONT_HEIGHT(112)
constexpr TypedWhichId< SvxPostureItem > ATTR_FONT_POSTURE(103)
constexpr TypedWhichId< SvxWeightItem > ATTR_FONT_WEIGHT(102)
constexpr TypedWhichId< SvxWeightItem > ATTR_CJK_FONT_WEIGHT(113)
constexpr TypedWhichId< SvxEmphasisMarkItem > ATTR_FONT_EMPHASISMARK(121)
constexpr TypedWhichId< ScShrinkToFitCell > ATTR_SHRINKTOFIT(140)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_TLBR(141)
constexpr TypedWhichId< SvxShadowedItem > ATTR_FONT_SHADOWED(108)
constexpr TypedWhichId< SvxScriptSpaceItem > ATTR_SCRIPTSPACE(126)
constexpr TypedWhichId< SvxWordLineModeItem > ATTR_FONT_WORDLINE(123)
constexpr TypedWhichId< SvxContourItem > ATTR_FONT_CONTOUR(107)
constexpr TypedWhichId< SvxLanguageItem > ATTR_CTL_FONT_LANGUAGE(120)
constexpr TypedWhichId< SvxBrushItem > ATTR_BACKGROUND(148)
constexpr TypedWhichId< SvxOverlineItem > ATTR_FONT_OVERLINE(105)
constexpr TypedWhichId< SvxShadowItem > ATTR_SHADOW(152)
constexpr TypedWhichId< SvxLanguageItem > ATTR_LANGUAGE_FORMAT(147)
constexpr TypedWhichId< ScRotateValueItem > ATTR_ROTATE_VALUE(135)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_VER_JUSTIFY_METHOD(133)
constexpr TypedWhichId< SvxHorJustifyItem > ATTR_HOR_JUSTIFY(129)
constexpr sal_uInt16 ATTR_PATTERN_START(100)
constexpr TypedWhichId< SvxBoxInfoItem > ATTR_BORDER_INNER(151)
constexpr TypedWhichId< SvxHangingPunctuationItem > ATTR_HANGPUNCTUATION(127)
constexpr TypedWhichId< SvxRotateModeItem > ATTR_ROTATE_MODE(136)
constexpr TypedWhichId< SvxBoxItem > ATTR_BORDER(150)
constexpr TypedWhichId< SvxJustifyMethodItem > ATTR_HOR_JUSTIFY_METHOD(130)
constexpr TypedWhichId< SvxCharReliefItem > ATTR_FONT_RELIEF(124)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALUE_FORMAT(146)
constexpr TypedWhichId< SvxFrameDirectionItem > ATTR_WRITINGDIR(138)
constexpr TypedWhichId< SvxCrossedOutItem > ATTR_FONT_CROSSEDOUT(106)
constexpr TypedWhichId< SvxMarginItem > ATTR_MARGIN(143)
constexpr TypedWhichId< SvxLineItem > ATTR_BORDER_BLTR(142)
constexpr TypedWhichId< ScVerticalStackCell > ATTR_STACKED(134)
constexpr TypedWhichId< SvxVerJustifyItem > ATTR_VER_JUSTIFY(132)
constexpr TypedWhichId< ScHyphenateCell > ATTR_HYPHENATE(125)
constexpr TypedWhichId< SvxFontItem > ATTR_FONT(100)
constexpr TypedWhichId< ScProtectionAttr > ATTR_PROTECTION(149)
constexpr TypedWhichId< SvxLanguageItem > ATTR_FONT_LANGUAGE(110)
constexpr sal_uInt16 ATTR_PATTERN_END(155)
constexpr TypedWhichId< SvxWeightItem > ATTR_CTL_FONT_WEIGHT(118)
constexpr TypedWhichId< SvXMLAttrContainerItem > ATTR_USERDEF(122)
constexpr TypedWhichId< ScLineBreakCell > ATTR_LINEBREAK(139)
constexpr TypedWhichId< SvxPostureItem > ATTR_CJK_FONT_POSTURE(114)
constexpr TypedWhichId< SfxUInt32Item > ATTR_VALIDDATA(153)
constexpr TypedWhichId< SvxLanguageItem > ATTR_CJK_FONT_LANGUAGE(115)
constexpr TypedWhichId< SvxFontHeightItem > ATTR_CTL_FONT_HEIGHT(117)
constexpr TypedWhichId< ScCondFormatItem > ATTR_CONDITIONAL(154)
constexpr TypedWhichId< SvxUnderlineItem > ATTR_FONT_UNDERLINE(104)
static SfxItemSet & rSet
sal_uIntPtr sal_uLong
sal_Int32 nStartPara
sal_Int32 nEndPos
sal_Int32 nStartPos
void Adjust()
sal_Int32 nEndPara
::std::set< SCTAB > maTabs
SCROW nRow1
Definition: global.hxx:442
SCCOL nCol1
Definition: global.hxx:441
SCCOL nCol2
Definition: global.hxx:443
SCROW nRow2
Definition: global.hxx:444
SvNumFormatType mnFormatType
Definition: stringutil.hxx:128
StringType meType
Definition: stringutil.hxx:124
svl::SharedString maString
Definition: queryentry.hxx:49
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:34
SCCOLROW nField
Definition: queryentry.hxx:61
std::vector< Item > QueryItemsType
Definition: queryentry.hxx:58
QueryItemsType & GetQueryItems()
Definition: queryentry.hxx:75
SC_DLLPUBLIC const ScQueryEntry & GetEntry(SCSIZE n) const
Definition: queryparam.cxx:116
SC_DLLPUBLIC SCSIZE GetEntryCount() const
Definition: queryparam.cxx:111
This is very similar to ScCellValue, except that it references the original value instead of copying ...
Definition: cellvalue.hxx:108
ScFormulaCell * getFormula() const
Definition: cellvalue.hxx:137
const EditTextObject * getEditText() const
Definition: cellvalue.hxx:136
bool isEmpty() const
Definition: cellvalue.cxx:667
CellType getType() const
Definition: cellvalue.hxx:133
Store parameters used in the ScDocument::SetString() method.
Definition: stringutil.hxx:35
void setTextInput()
Call this whenever you need to unconditionally set input as text, no matter what the input is.
Definition: stringutil.cxx:39
::std::vector< ScSortKeyState > maKeyState
Definition: sortparam.hxx:130
sal_uInt16 GetSortKeyCount() const
Definition: sortparam.hxx:148
bool bGroupActive[MAXSUBTOTAL]
active groups
SCCOL nField[MAXSUBTOTAL]
associated field
SCCOL nSubTotals[MAXSUBTOTAL]
number of SubTotals
std::unique_ptr< SCCOL[]> pSubTotals[MAXSUBTOTAL]
array of columns to be calculated
SCCOL nCol1
selected area
bool bReplace
replace existing results
Parameter for data table aka multiple operations.
Definition: paramisc.hxx:46
ScRefAddress aRefFormulaEnd
Definition: paramisc.hxx:50
ScRefAddress aRefColCell
Definition: paramisc.hxx:52
ScRefAddress aRefFormulaCell
Definition: paramisc.hxx:49
ScRefAddress aRefRowCell
Definition: paramisc.hxx:51
constexpr OUStringLiteral SCLINKTARGET_SERVICE
Definition: targuno.hxx:41
unsigned char sal_Bool
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
#define MID_MARGIN_LO_MARGIN
#define MID_MARGIN_R_MARGIN
#define MID_MARGIN_L_MARGIN
#define MID_MARGIN_UP_MARGIN
constexpr OUStringLiteral SC_UNONAME_PADJUST
Definition: unonames.hxx:153
constexpr OUStringLiteral SC_UNO_CJK_CFFAMIL
Definition: unonames.hxx:80
constexpr OUStringLiteral SC_UNO_CJK_CFPITCH
Definition: unonames.hxx:82
constexpr OUStringLiteral SC_UNONAME_TABLEPOS
Definition: unonames.hxx:348
constexpr OUStringLiteral SC_UNO_CJK_CPOST
Definition: unonames.hxx:85
constexpr OUStringLiteral SC_UNONAME_CEMPHAS
Definition: unonames.hxx:69
constexpr OUStringLiteral SC_UNONAME_NUMRULES
Definition: unonames.hxx:156
constexpr OUStringLiteral SC_UNONAME_PRMARGIN
Definition: unonames.hxx:119
constexpr OUStringLiteral SC_UNONAME_COVRLHAS
Definition: unonames.hxx:60
constexpr OUStringLiteral SC_UNONAME_CFCHARS
Definition: unonames.hxx:73
constexpr OUStringLiteral SC_UNONAME_CHROWHDR
Definition: unonames.hxx:212
constexpr OUStringLiteral SC_UNONAME_COPYFORM
Definition: unonames.hxx:188
constexpr OUStringLiteral SC_UNONAME_PROTECT
Definition: unonames.hxx:183
constexpr OUStringLiteral SC_UNONAME_CLOCAL
Definition: unonames.hxx:65
constexpr OUStringLiteral SC_UNONAME_HYPERLINK
Definition: unonames.hxx:206
constexpr OUStringLiteral SC_UNO_NAMEDRANGES
Definition: unonames.hxx:45
constexpr OUStringLiteral SC_UNO_CJK_CFCHARS
Definition: unonames.hxx:81
constexpr OUStringLiteral SC_UNONAME_VALIDAT
Definition: unonames.hxx:216
constexpr OUStringLiteral SC_UNONAME_PISHYPHEN
Definition: unonames.hxx:152
constexpr OUStringLiteral SC_UNONAME_SHOWBORD
Definition: unonames.hxx:184
constexpr OUStringLiteral SC_UNONAME_CELLWID
Definition: unonames.hxx:173
constexpr OUStringLiteral SC_UNONAME_WRITING
Definition: unonames.hxx:123
constexpr OUStringLiteral SC_UNONAME_CELLVJUS_METHOD
Definition: unonames.hxx:107
constexpr OUStringLiteral SC_UNONAME_TEXTUSER
Definition: unonames.hxx:225
constexpr OUStringLiteral SC_UNONAME_CSHADD
Definition: unonames.hxx:66
constexpr OUStringLiteral SC_UNONAME_CRELIEF
Definition: unonames.hxx:75
constexpr OUStringLiteral SC_UNO_CTL_CFNAME
Definition: unonames.hxx:88
constexpr OUStringLiteral SC_UNO_CJK_CWEIGHT
Definition: unonames.hxx:84
constexpr OUStringLiteral SC_UNONAME_CUNDLHAS
Definition: unonames.hxx:57
constexpr OUStringLiteral SC_UNONAME_NUMFMT
Definition: unonames.hxx:109
constexpr OUStringLiteral SC_UNONAME_COPYSTYL
Definition: unonames.hxx:187
constexpr OUStringLiteral SC_UNONAME_WRAP
Definition: unonames.hxx:114
constexpr OUStringLiteral SC_UNONAME_CELLHGT
Definition: unonames.hxx:172
constexpr OUStringLiteral SC_UNONAME_CPOST
Definition: unonames.hxx:62
constexpr OUStringLiteral SC_UNO_CODENAME
Definition: unonames.hxx:536
constexpr OUStringLiteral SC_UNO_CTL_CFFAMIL
Definition: unonames.hxx:90
constexpr OUStringLiteral SC_UNONAME_CFFAMIL
Definition: unonames.hxx:72
constexpr OUStringLiteral SC_UNONAME_PINDENT
Definition: unonames.hxx:115
constexpr OUStringLiteral SC_UNONAME_PLMARGIN
Definition: unonames.hxx:118
constexpr OUStringLiteral SC_UNO_CJK_CFSTYLE
Definition: unonames.hxx:79
constexpr OUStringLiteral SC_UNONAME_COVRLCOL
Definition: unonames.hxx:59
constexpr OUStringLiteral SC_UNO_CTL_CWEIGHT
Definition: unonames.hxx:94
constexpr OUStringLiteral SC_UNONAME_CELLTRAN
Definition: unonames.hxx:102
constexpr OUStringLiteral SC_UNO_CTL_CFPITCH
Definition: unonames.hxx:92
constexpr OUStringLiteral SC_UNONAME_CELLORI
Definition: unonames.hxx:108
constexpr OUStringLiteral SC_UNONAME_OHEIGHT
Definition: unonames.hxx:178
constexpr OUStringLiteral SC_UNONAME_CSTRIKE
Definition: unonames.hxx:64
constexpr OUStringLiteral SC_UNO_CTL_CFCHARS
Definition: unonames.hxx:91
constexpr OUStringLiteral SC_UNONAME_ISACTIVE
Definition: unonames.hxx:181
constexpr OUStringLiteral SC_UNONAME_DIAGONAL_BLTR2
Definition: unonames.hxx:145
constexpr OUStringLiteral SC_UNONAME_CHCOLHDR
Definition: unonames.hxx:211
constexpr OUStringLiteral SC_UNONAME_CONDLOC
Definition: unonames.hxx:214
constexpr OUStringLiteral SC_UNONAME_FORMRT2
Definition: unonames.hxx:221
constexpr OUStringLiteral SC_UNONAME_BORDCOL
Definition: unonames.hxx:182
constexpr OUStringLiteral SC_UNONAME_POS
Definition: unonames.hxx:167
constexpr OUStringLiteral SC_UNONAME_VALIXML
Definition: unonames.hxx:218
constexpr OUStringLiteral SC_UNONAME_CFNAME
Definition: unonames.hxx:70
constexpr OUStringLiteral SC_UNONAME_PISFORBID
Definition: unonames.hxx:151
constexpr OUStringLiteral SC_UNONAME_FORMATID
Definition: unonames.hxx:110
constexpr OUStringLiteral SC_UNONAME_CFONT
Definition: unonames.hxx:67
constexpr OUStringLiteral SC_UNO_LINKDISPBIT
Definition: unonames.hxx:197
constexpr OUStringLiteral SC_UNO_CTL_CLOCAL
Definition: unonames.hxx:96
constexpr OUStringLiteral SC_UNO_CJK_CHEIGHT
Definition: unonames.hxx:83
constexpr OUStringLiteral SC_UNONAME_CELLPRO
Definition: unonames.hxx:103
constexpr OUStringLiteral SC_UNONAME_PTMARGIN
Definition: unonames.hxx:116
constexpr OUStringLiteral SC_UNONAME_CCROSS
Definition: unonames.hxx:63
constexpr OUStringLiteral SC_UNO_CJK_CFNAME
Definition: unonames.hxx:78
constexpr OUStringLiteral SC_UNONAME_CWORDMOD
Definition: unonames.hxx:76
constexpr OUStringLiteral SC_UNONAME_PBMARGIN
Definition: unonames.hxx:117
constexpr OUStringLiteral SC_UNONAME_TABCOLOR
Definition: unonames.hxx:191
constexpr OUStringLiteral SC_UNONAME_MANPAGE
Definition: unonames.hxx:176
constexpr OUStringLiteral SC_UNONAME_SHRINK_TO_FIT
Definition: unonames.hxx:147
constexpr OUStringLiteral SC_UNONAME_CONDFMT
Definition: unonames.hxx:213
constexpr OUStringLiteral SC_UNONAME_CFPITCH
Definition: unonames.hxx:74
constexpr OUStringLiteral SC_UNONAME_AUTOPRINT
Definition: unonames.hxx:190
constexpr OUStringLiteral SC_UNONAME_ASIANVERT
Definition: unonames.hxx:122
constexpr OUStringLiteral SC_UNONAME_CELLCONTENTTYPE
Definition: unonames.hxx:222
constexpr OUStringLiteral SC_UNONAME_COVER
Definition: unonames.hxx:58
constexpr OUStringLiteral SC_UNONAME_COUTL
Definition: unonames.hxx:68
constexpr OUStringLiteral SC_UNONAME_SIZE
Definition: unonames.hxx:168
constexpr OUStringLiteral SC_UNONAME_ROTANG
Definition: unonames.hxx:120
constexpr OUStringLiteral SC_UNO_CTL_CHEIGHT
Definition: unonames.hxx:93
constexpr OUStringLiteral SC_UNONAME_VALILOC
Definition: unonames.hxx:217
constexpr OUStringLiteral SC_UNONAME_DIAGONAL_BLTR
Definition: unonames.hxx:142
constexpr OUStringLiteral SC_UNONAME_DIAGONAL_TLBR
Definition: unonames.hxx:141
constexpr OUStringLiteral SC_UNONAME_USERDEF
Definition: unonames.hxx:224
constexpr OUStringLiteral SC_UNONAME_CELLVJUS
Definition: unonames.hxx:105
constexpr OUStringLiteral SC_UNONAME_CONDXML
Definition: unonames.hxx:215
constexpr OUStringLiteral SC_UNONAME_PLASTADJ
Definition: unonames.hxx:154
constexpr OUStringLiteral SC_UNONAME_ROTREF
Definition: unonames.hxx:121
constexpr OUStringLiteral SC_UNONAME_CUNDLCOL
Definition: unonames.hxx:56
constexpr OUStringLiteral SC_UNONAME_TBLBORD
Definition: unonames.hxx:112
constexpr OUStringLiteral SC_UNONAME_DIAGONAL_TLBR2
Definition: unonames.hxx:144
constexpr OUStringLiteral SC_UNONAME_CELLVIS
Definition: unonames.hxx:174
constexpr OUStringLiteral SC_UNONAME_PISHANG
Definition: unonames.hxx:149
constexpr OUStringLiteral SC_UNONAME_FORMRT
Definition: unonames.hxx:220
constexpr OUStringLiteral SC_UNONAME_COPYBACK
Definition: unonames.hxx:186
constexpr OUStringLiteral SC_UNONAME_CWEIGHT
Definition: unonames.hxx:61
constexpr OUStringLiteral SC_UNONAME_NEWPAGE
Definition: unonames.hxx:177
constexpr OUStringLiteral SC_UNONAME_ABSNAME
Definition: unonames.hxx:169
constexpr OUStringLiteral SC_UNONAME_FORMLOC
Definition: unonames.hxx:219
constexpr OUStringLiteral SC_UNO_CTL_CPOST
Definition: unonames.hxx:95
constexpr OUStringLiteral SC_UNONAME_CUNDER
Definition: unonames.hxx:55
constexpr OUStringLiteral SC_UNONAME_SHADOW
Definition: unonames.hxx:111
constexpr OUStringLiteral SC_UNONAME_CELLFILT
Definition: unonames.hxx:175
constexpr OUStringLiteral SC_UNONAME_TBLBORD2
Definition: unonames.hxx:113
constexpr OUStringLiteral SC_UNO_LINKDISPNAME
Definition: unonames.hxx:198
constexpr OUStringLiteral SC_UNONAME_TABLAYOUT
Definition: unonames.hxx:189
constexpr OUStringLiteral SC_UNONAME_PISCHDIST
Definition: unonames.hxx:150
constexpr OUStringLiteral SC_UNONAME_OWIDTH
Definition: unonames.hxx:179
constexpr OUStringLiteral SC_UNONAME_CELLSTYL
Definition: unonames.hxx:99
constexpr OUStringLiteral SC_UNONAME_CHEIGHT
Definition: unonames.hxx:54
constexpr OUStringLiteral SC_UNONAME_PRINTBORD
Definition: unonames.hxx:185
constexpr OUStringLiteral SC_UNONAME_CONDFORMAT
Definition: unonames.hxx:192
constexpr OUStringLiteral SC_UNONAME_CELLHJUS
Definition: unonames.hxx:104
constexpr OUStringLiteral SC_UNO_CTL_CFSTYLE
Definition: unonames.hxx:89
constexpr OUStringLiteral SC_UNONAME_CFSTYLE
Definition: unonames.hxx:71
constexpr OUStringLiteral SC_UNONAME_PAGESTL
Definition: unonames.hxx:180
constexpr OUStringLiteral SC_UNONAME_CELLHJUS_METHOD
Definition: unonames.hxx:106
constexpr OUStringLiteral SC_UNO_CJK_CLOCAL
Definition: unonames.hxx:86
constexpr OUStringLiteral UNO_NAME_EDIT_CHAR_ESCAPEMENT
#define SVX_UNOEDIT_CHAR_PROPERTIES
#define SVX_UNOEDIT_NUMBERING_PROPERTY
#define SVX_UNOEDIT_PARA_PROPERTIES
#define SVX_UNOEDIT_FONT_PROPERTIES
#define SC_WID_UNO_VALIDAT
Definition: unowids.hxx:36
#define SC_WID_UNO_FORMATID
Definition: unowids.hxx:74
#define SC_WID_UNO_CELLSTYL
Definition: unowids.hxx:29
#define SC_WID_UNO_VALILOC
Definition: unowids.hxx:37
#define SC_WID_UNO_CELLVIS
Definition: unowids.hxx:44
#define SC_WID_UNO_CONDLOC
Definition: unowids.hxx:33
#define SC_WID_UNO_CELLCONTENTTYPE
Definition: unowids.hxx:76
#define SC_WID_UNO_OWIDTH
Definition: unowids.hxx:48
#define SC_WID_UNO_LINKDISPNAME
Definition: unowids.hxx:46
#define SC_WID_UNO_TBLBORD2
Definition: unowids.hxx:72
#define SC_WID_UNO_TBLBORD
Definition: unowids.hxx:35
#define SC_WID_UNO_PROTECT
Definition: unowids.hxx:60
#define SC_WID_UNO_FORMRT
Definition: unowids.hxx:42
#define SC_WID_UNO_VALIXML
Definition: unowids.hxx:38
#define SC_WID_UNO_CELLFILT
Definition: unowids.hxx:52
#define SC_WID_UNO_FORMRT2
Definition: unowids.hxx:75
#define SC_WID_UNO_CHCOLHDR
Definition: unowids.hxx:30
#define SC_WID_UNO_CONDFORMAT
Definition: unowids.hxx:73
#define SC_WID_UNO_BORDCOL
Definition: unowids.hxx:59
#define SC_WID_UNO_AUTOPRINT
Definition: unowids.hxx:67
#define SC_WID_UNO_COPYBACK
Definition: unowids.hxx:63
#define SC_WID_UNO_TABCOLOR
Definition: unowids.hxx:70
#define SC_WID_UNO_COPYSTYL
Definition: unowids.hxx:64
#define SC_WID_UNO_SHOWBORD
Definition: unowids.hxx:61
#define SC_WID_UNO_PAGESTL
Definition: unowids.hxx:43
#define SC_WID_UNO_CONDFMT
Definition: unowids.hxx:32
#define SC_WID_UNO_ABSNAME
Definition: unowids.hxx:68
#define SC_WID_UNO_CODENAME
Definition: unowids.hxx:69
bool IsScItemWid(sal_uInt16 nWid)
Definition: unowids.hxx:84
#define SC_WID_UNO_NUMRULES
Definition: unowids.hxx:57
#define SC_WID_UNO_ISACTIVE
Definition: unowids.hxx:58
#define SC_WID_UNO_SIZE
Definition: unowids.hxx:40
#define SC_WID_UNO_CELLWID
Definition: unowids.hxx:47
#define SC_WID_UNO_OHEIGHT
Definition: unowids.hxx:53
#define SC_WID_UNO_CHROWHDR
Definition: unowids.hxx:31
#define SC_WID_UNO_FORMLOC
Definition: unowids.hxx:41
#define SC_WID_UNO_COPYFORM
Definition: unowids.hxx:65
#define SC_WID_UNO_CONDXML
Definition: unowids.hxx:34
#define SC_WID_UNO_CELLHGT
Definition: unowids.hxx:51
#define SC_WID_UNO_MANPAGE
Definition: unowids.hxx:50
#define SC_WID_UNO_NAMES
Definition: unowids.hxx:71
#define SC_WID_UNO_POS
Definition: unowids.hxx:39
#define SC_WID_UNO_NEWPAGE
Definition: unowids.hxx:49
#define SC_WID_UNO_PRINTBORD
Definition: unowids.hxx:62
#define SC_WID_UNO_LINKDISPBIT
Definition: unowids.hxx:45
#define SC_WID_UNO_TABLAYOUT
Definition: unowids.hxx:66
const SvXMLTokenMapEntry aTypes[]
@ TABLE
Definition: xmldpimp.hxx:43
SvNumFormatType
#define SV_COUNTRY_LANGUAGE_OFFSET
#define SV_MAX_COUNT_STANDARD_FORMATS