1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 #ifndef SC_VIEWFUNC_HXX 28 #define SC_VIEWFUNC_HXX 29 30 #include "tabview.hxx" 31 32 #include "tabbgcolor.hxx" 33 34 #ifndef _SVSTDARR_SHORTS 35 #define _SVSTDARR_SHORTS 36 #include <svl/svstdarr.hxx> 37 38 #endif 39 40 #ifndef _SVSTDARR_STRINGS 41 42 #define _SVSTDARR_STRINGS 43 #include <svl/svstdarr.hxx> 44 45 #endif 46 #include <com/sun/star/embed/XEmbeddedObject.hpp> 47 #include <com/sun/star/embed/Aspects.hpp> 48 49 class ScPatternAttr; 50 class ScAutoFormatData; 51 class SvxSearchItem; 52 class SfxItemSet; 53 class SvxBorderLine; 54 class SvxBoxItem; 55 class SvxBoxInfoItem; 56 class SfxStyleSheetBase; 57 class SfxStyleSheet; 58 class SfxPoolItem; 59 class EditTextObject; 60 struct ScSolveParam; 61 struct ScTabOpParam; 62 class ScPostIt; 63 class ScConditionalFormat; 64 class ScValidationData; 65 class ScConversionParam; 66 class SdrModel; 67 class Graphic; 68 class Exchange; 69 class ScRangeList; 70 class SvxHyperlinkItem; 71 class ScTransferObj; 72 class ScTableProtection; 73 74 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } } 75 76 //================================================================== 77 78 class ScViewFunc : public ScTabView 79 { 80 private: 81 ScAddress aFormatSource; // fuer automatisches Erweitern von Formatierung 82 ScRange aFormatArea; 83 sal_Bool bFormatValid; 84 85 public: 86 ScViewFunc( Window* pParent, ScDocShell& rDocSh, ScTabViewShell* pViewShell ); 87 //UNUSED2008-05 ScViewFunc( Window* pParent, const ScViewFunc& rViewFunc, ScTabViewShell* pViewShell ); 88 ~ScViewFunc(); 89 90 const ScPatternAttr* GetSelectionPattern (); 91 void GetSelectionFrame ( SvxBoxItem& rLineOuter, 92 SvxBoxInfoItem& rLineInner ); 93 94 sal_uInt8 GetSelectionScriptType(); 95 96 sal_Bool GetAutoSumArea(ScRangeList& rRangeList); 97 void EnterAutoSum(const ScRangeList& rRangeList, sal_Bool bSubTotal); 98 bool AutoSum( const ScRange& rRange, bool bSubTotal, bool bSetCursor, bool bContinue ); 99 String GetAutoSumFormula( const ScRangeList& rRangeList, bool bSubTotal ); 100 101 void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const String& rString, 102 sal_Bool bRecord = sal_True, const EditTextObject* pData = NULL ); 103 void EnterValue( SCCOL nCol, SCROW nRow, SCTAB nTab, const double& rValue ); 104 void EnterData( SCCOL nCol, SCROW nRow, SCTAB nTab, const EditTextObject* pData, 105 sal_Bool bRecord = sal_True, sal_Bool bTestSimple = sal_False ); 106 107 void EnterMatrix( const String& rString ); 108 void EnterBlock( const String& rString, const EditTextObject* pData ); 109 110 void EnterDataAtCursor( const String& rString ); //! nicht benutzt ? 111 112 SC_DLLPUBLIC void CutToClip( ScDocument* pClipDoc = NULL, sal_Bool bIncludeObjects = sal_False ); 113 SC_DLLPUBLIC sal_Bool CopyToClip( ScDocument* pClipDoc = NULL, sal_Bool bCut = sal_False, sal_Bool bApi = sal_False, 114 sal_Bool bIncludeObjects = sal_False, sal_Bool bStopEdit = sal_True ); 115 ScTransferObj* CopyToTransferable(); 116 SC_DLLPUBLIC sal_Bool PasteFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, 117 sal_uInt16 nFunction = PASTE_NOFUNC, sal_Bool bSkipEmpty = sal_False, 118 sal_Bool bTranspose = sal_False, sal_Bool bAsLink = sal_False, 119 InsCellCmd eMoveMode = INS_NONE, 120 sal_uInt16 nUndoExtraFlags = IDF_NONE, 121 sal_Bool bAllowDialogs = sal_False ); 122 123 void FillTab( sal_uInt16 nFlags, sal_uInt16 nFunction, sal_Bool bSkipEmpty, sal_Bool bAsLink ); 124 125 SC_DLLPUBLIC void PasteFromSystem(); 126 SC_DLLPUBLIC sal_Bool PasteFromSystem( sal_uLong nFormatId, sal_Bool bApi = sal_False ); 127 void PasteFromTransferable( const ::com::sun::star::uno::Reference< 128 ::com::sun::star::datatransfer::XTransferable >& rxTransferable ); 129 130 void PasteDraw(); 131 void PasteDraw( const Point& rLogicPos, SdrModel* pModel, 132 sal_Bool bGroup = sal_False, sal_Bool bSameDocClipboard = sal_False ); 133 134 sal_Bool PasteOnDrawObject( const ::com::sun::star::uno::Reference< 135 ::com::sun::star::datatransfer::XTransferable >& rxTransferable, 136 SdrObject* pHitObj, sal_Bool bLink ); 137 138 sal_Bool PasteDataFormat( sal_uLong nFormatId, 139 const ::com::sun::star::uno::Reference< 140 ::com::sun::star::datatransfer::XTransferable >& rxTransferable, 141 SCCOL nPosX, SCROW nPosY, Point* pLogicPos = NULL, 142 sal_Bool bLink = sal_False, sal_Bool bAllowDialogs = sal_False ); 143 144 sal_Bool PasteFile( const Point&, const String&, sal_Bool bLink=sal_False ); 145 sal_Bool PasteObject( const Point&, const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >&, const Size* = NULL, const Graphic* = NULL, const ::rtl::OUString& = ::rtl::OUString(), sal_Int64 nAspect = ::com::sun::star::embed::Aspects::MSOLE_CONTENT ); 146 sal_Bool PasteBitmap( const Point&, const Bitmap& ); 147 sal_Bool PasteMetaFile( const Point&, const GDIMetaFile& ); 148 sal_Bool PasteGraphic( const Point& rPos, const Graphic& rGraphic, 149 const String& rFile, const String& rFilter ); 150 sal_Bool PasteBookmark( sal_uLong nFormatId, 151 const ::com::sun::star::uno::Reference< 152 ::com::sun::star::datatransfer::XTransferable >& rxTransferable, 153 SCCOL nPosX, SCROW nPosY ); 154 sal_Bool PasteDDE( const ::com::sun::star::uno::Reference< 155 ::com::sun::star::datatransfer::XTransferable >& rxTransferable ); 156 157 sal_Bool ApplyGraphicToObject( SdrObject* pObject, const Graphic& rGraphic ); 158 159 void InsertBookmark( const String& rDescription, const String& rURL, 160 SCCOL nPosX, SCROW nPosY, const String* pTarget = NULL, 161 sal_Bool bTryReplace = sal_False ); 162 sal_Bool HasBookmarkAtCursor( SvxHyperlinkItem* pContent ); 163 164 long DropRequestHdl( Exchange* pExchange ); 165 sal_Bool MoveBlockTo( const ScRange& rSource, const ScAddress& rDestPos, 166 sal_Bool bCut, sal_Bool bRecord, sal_Bool bPaint, sal_Bool bApi ); 167 168 sal_Bool LinkBlock( const ScRange& rSource, const ScAddress& rDestPos, sal_Bool bApi ); 169 170 void CreateNames( sal_uInt16 nFlags ); 171 sal_uInt16 GetCreateNameFlags(); 172 void InsertNameList(); 173 sal_Bool InsertName( const String& rName, const String& rSymbol, 174 const String& rType ); 175 176 void ApplyAttributes( const SfxItemSet* pDialogSet, const SfxItemSet* pOldSet, 177 sal_Bool bRecord = sal_True ); 178 void ApplyAttr( const SfxPoolItem& rAttrItem ); 179 void ApplySelectionPattern( const ScPatternAttr& rAttr, 180 sal_Bool bRecord = sal_True, 181 sal_Bool bCursorOnly = sal_False ); 182 void ApplyPatternLines( const ScPatternAttr& rAttr, 183 const SvxBoxItem* pNewOuter, 184 const SvxBoxInfoItem* pNewInner, sal_Bool bRecord = sal_True ); 185 186 void ApplyUserItemSet( const SfxItemSet& rItemSet ); 187 188 const SfxStyleSheet* GetStyleSheetFromMarked(); 189 void SetStyleSheetToMarked( SfxStyleSheet* pStyleSheet, 190 sal_Bool bRecord = sal_True ); 191 void RemoveStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ); 192 void UpdateStyleSheetInUse( const SfxStyleSheetBase* pStyleSheet ); 193 194 void SetNumberFormat( short nFormatType, sal_uLong nAdd = 0 ); 195 void SetNumFmtByStr( const String& rCode ); 196 void ChangeNumFmtDecimals( sal_Bool bIncrement ); 197 198 void SetConditionalFormat( const ScConditionalFormat& rNew ); 199 void SetValidation( const ScValidationData& rNew ); 200 201 void ChangeIndent( sal_Bool bIncrement ); 202 203 void ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect ); 204 205 void Protect( SCTAB nTab, const String& rPassword ); 206 sal_Bool Unprotect( SCTAB nTab, const String& rPassword ); 207 208 void DeleteCells( DelCellCmd eCmd, sal_Bool bRecord = sal_True ); 209 sal_Bool InsertCells( InsCellCmd eCmd, sal_Bool bRecord = sal_True, sal_Bool bPartOfPaste = sal_False ); 210 void DeleteMulti( sal_Bool bRows, sal_Bool bRecord = sal_True ); 211 212 void DeleteContents( sal_uInt16 nFlags, sal_Bool bRecord = sal_True ); 213 214 void SetWidthOrHeight( sal_Bool bWidth, SCCOLROW nRangeCnt, SCCOLROW* pRanges, 215 ScSizeMode eMode, sal_uInt16 nSizeTwips, 216 sal_Bool bRecord = sal_True, sal_Bool bPaint = sal_True, 217 ScMarkData* pMarkData = NULL ); 218 void SetMarkedWidthOrHeight( sal_Bool bWidth, ScSizeMode eMode, sal_uInt16 nSizeTwips, 219 sal_Bool bRecord = sal_True, sal_Bool bPaint = sal_True ); 220 void ShowMarkedColumns( sal_Bool bShow, sal_Bool bRecord = sal_True ); 221 void ShowMarkedRows( sal_Bool bShow, sal_Bool bRecord = sal_True ); 222 223 sal_Bool AdjustBlockHeight( sal_Bool bPaint = sal_True, ScMarkData* pMarkData = NULL ); 224 sal_Bool AdjustRowHeight( SCROW nStartRow, SCROW nEndRow, sal_Bool bPaint = sal_True ); 225 226 void ModifyCellSize( ScDirection eDir, sal_Bool bOptimal ); 227 228 SC_DLLPUBLIC void InsertPageBreak( sal_Bool bColumn, sal_Bool bRecord = sal_True, 229 const ScAddress* pPos = NULL, 230 sal_Bool bSetModified = sal_True ); 231 SC_DLLPUBLIC void DeletePageBreak( sal_Bool bColumn, sal_Bool bRecord = sal_True, 232 const ScAddress* pPos = NULL, 233 sal_Bool bSetModified = sal_True ); 234 235 void RemoveManualBreaks(); 236 237 void SetPrintZoom(sal_uInt16 nScale, sal_uInt16 nPages); 238 void AdjustPrintZoom(); 239 240 sal_Bool TestMergeCells(); 241 sal_Bool TestRemoveMerge(); 242 243 sal_Bool MergeCells( sal_Bool bApi, sal_Bool& rDoContents, sal_Bool bRecord = sal_True ); 244 sal_Bool RemoveMerge( sal_Bool bRecord = sal_True ); 245 246 void FillSimple( FillDir eDir, sal_Bool bRecord = sal_True ); 247 void FillSeries( FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, 248 double fStart, double fStep, double fMax, sal_Bool bRecord = sal_True ); 249 void FillAuto( FillDir eDir, SCCOL nStartCol, SCROW nStartRow, 250 SCCOL nEndCol, SCROW nEndRow, sal_uLong nCount, sal_Bool bRecord = sal_True ); 251 void FillCrossDblClick(); 252 253 void TransliterateText( sal_Int32 nType ); 254 255 ScAutoFormatData* CreateAutoFormatData(); 256 void AutoFormat( sal_uInt16 nFormatNo, sal_Bool bRecord = sal_True ); 257 258 void SearchAndReplace( const SvxSearchItem* pSearchItem, 259 sal_Bool bAddUndo, sal_Bool bIsApi ); 260 261 void Solve( const ScSolveParam& rParam ); 262 void TabOp( const ScTabOpParam& rParam, sal_Bool bRecord = sal_True ); 263 264 sal_Bool InsertTable( const String& rName, SCTAB nTabNr, sal_Bool bRecord = sal_True ); 265 sal_Bool InsertTables(SvStrings *pNames, SCTAB nTab, SCTAB nCount, sal_Bool bRecord = sal_True); 266 267 268 sal_Bool AppendTable( const String& rName, sal_Bool bRecord = sal_True ); 269 270 sal_Bool DeleteTable( SCTAB nTabNr, sal_Bool bRecord = sal_True ); 271 sal_Bool DeleteTables(const SvShorts &TheTabs, sal_Bool bRecord = sal_True ); 272 273 sal_Bool RenameTable( const String& rName, SCTAB nTabNr ); 274 void MoveTable( sal_uInt16 nDestDocNo, SCTAB nDestTab, sal_Bool bCopy ); 275 void ImportTables( ScDocShell* pSrcShell, 276 SCTAB nCount, const SCTAB* pSrcTabs, 277 sal_Bool bLink,SCTAB nTab); 278 279 bool SetTabBgColor( const Color& rColor, SCTAB nTabNr ); 280 bool SetTabBgColor( ScUndoTabColorInfo::List& rUndoSetTabBgColorInfoList ); 281 282 void InsertTableLink( const String& rFile, 283 const String& rFilter, const String& rOptions, 284 const String& rTabName ); 285 void InsertAreaLink( const String& rFile, 286 const String& rFilter, const String& rOptions, 287 const String& rSource, sal_uLong nRefresh ); 288 289 void ShowTable( const String& rName ); 290 void HideTable( SCTAB nTabNr ); 291 292 void MakeScenario( const String& rName, const String& rComment, 293 const Color& rColor, sal_uInt16 nFlags ); 294 void ExtendScenario(); 295 void UseScenario( const String& rName ); 296 297 void InsertSpecialChar( const String& rStr, const Font& rFont ); 298 299 void InsertDummyObject(); 300 void InsertOleObject(); 301 302 void InsertDraw(); 303 304 void SetSelectionFrameLines( const SvxBorderLine* pLine, 305 sal_Bool bColorOnly ); 306 307 void SetNoteText( const ScAddress& rPos, const String& rNoteText ); 308 void ReplaceNote( const ScAddress& rPos, const String& rNoteText, const String* pAuthor, const String* pDate ); 309 void DoRefConversion( sal_Bool bRecord = sal_True ); 310 311 //UNUSED2008-05 void DoSpellingChecker( sal_Bool bRecord = sal_True ); 312 void DoHangulHanjaConversion( sal_Bool bRecord = sal_True ); 313 void DoThesaurus( sal_Bool bRecord = sal_True ); 314 //UNUSED2008-05 DECL_LINK( SpellError, void * ); 315 316 /** Generic implementation of sheet conversion functions. */ 317 void DoSheetConversion( const ScConversionParam& rParam, sal_Bool bRecord = sal_True ); 318 319 void SetPrintRanges( sal_Bool bEntireSheet, 320 const String* pPrint, 321 const String* pRepCol, const String* pRepRow, 322 sal_Bool bAddPrint ); 323 324 void DetectiveAddPred(); 325 void DetectiveDelPred(); 326 void DetectiveAddSucc(); 327 void DetectiveDelSucc(); 328 void DetectiveAddError(); 329 void DetectiveMarkInvalid(); 330 void DetectiveDelAll(); 331 void DetectiveRefresh(); 332 333 void ShowNote( bool bShow = true ); 334 inline void HideNote() { ShowNote( false ); } 335 void EditNote(); 336 337 void ForgetFormatArea() { bFormatValid = sal_False; } 338 sal_Bool SelectionEditable( sal_Bool* pOnlyNotBecauseOfMatrix = NULL ); 339 340 // interne Hilfsfunktionen 341 protected: 342 void UpdateLineAttrs( SvxBorderLine& rLine, 343 const SvxBorderLine* pDestLine, 344 const SvxBorderLine* pSrcLine, 345 sal_Bool bColor ); 346 347 //UNUSED2008-05 void PaintWidthHeight( sal_Bool bColumns, SCCOLROW nStart, SCCOLROW nEnd ); 348 349 350 private: 351 void PasteRTF( SCCOL nCol, SCROW nStartRow, 352 const ::com::sun::star::uno::Reference< 353 ::com::sun::star::datatransfer::XTransferable >& rxTransferable ); 354 bool PasteMultiRangesFromClip( sal_uInt16 nFlags, ScDocument* pClipDoc, sal_uInt16 nFunction, 355 bool bSkipEmpty, bool bTranspos, bool bAsLink, bool bAllowDialogs, 356 InsCellCmd eMoveMode, sal_uInt16 nCondFlags, sal_uInt16 nUndoFlags ); 357 void PostPasteFromClip(const ScRange& rPasteRange, const ScMarkData& rMark); 358 359 sal_uInt16 GetOptimalColWidth( SCCOL nCol, SCTAB nTab, sal_Bool bFormula ); 360 361 void StartFormatArea(); 362 sal_Bool TestFormatArea( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_Bool bAttrChanged ); 363 void DoAutoAttributes( SCCOL nCol, SCROW nRow, SCTAB nTab, 364 sal_Bool bAttrChanged, sal_Bool bAddUndo ); 365 }; 366 367 368 369 #endif 370 371